From 221b667851900ed9033b2b5d088046a7a9d175f0 Mon Sep 17 00:00:00 2001 From: swapnil <78632212+swapnilpaliwal-sd@users.noreply.github.com> Date: Fri, 25 Sep 2026 14:23:43 -0700 Subject: [PATCH] context: a tree with every file at its root is scoped to the root, not refused (#1345) The scope menu is built from the directories above the indexed files, so a repository whose files sit at its root had nothing to offer, and context refused with an empty list of suggestions. The root is the one scope such a tree has: context now uses it and says so, the way a single-package tree is handled. --- .../axiomcode/skills/axiomcode/scripts/axiomcode-context | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/axiomcode/skills/axiomcode/scripts/axiomcode-context b/plugins/axiomcode/skills/axiomcode/scripts/axiomcode-context index 5da024309..da189d673 100755 --- a/plugins/axiomcode/skills/axiomcode/scripts/axiomcode-context +++ b/plugins/axiomcode/skills/axiomcode/scripts/axiomcode-context @@ -419,7 +419,7 @@ def main(argv): # does not filter. It does not weight either: boosting seeds inside it and penalising files outside # it was swept over 57 real commits and was worth at most 0.012 recall@10 against not doing it, which # is noise at that sample size. The menu is worth printing for the reader; it is not worth ranking on. - rank = rank_dirs(g, scope_terms(g, task)) if not scopes else None + rank = rank_dirs(g, scope_terms(g, task)) if not scopes else None; flat = False if not scopes: # One candidate is not a choice: take it and SAY SO, rather than refusing and being handed back # the only path there was. This is NOT the offered-scope case above, so it is not marked @@ -430,6 +430,11 @@ def main(argv): if sole: scopes = [sole] print(f"scope: {sole} (the only package this graph indexes; --in overrides)\n") + elif g.sym and not dirs_with_counts(g): + # every indexed file sits at the root, so the root is the one scope there is, and it narrows nothing. + # Refusing here offered an empty menu: a correction the reader could not act on (#1345) + flat = True + print("scope: the repository root (every indexed file sits there; --in overrides)\n") elif rank: # Several candidates, and a caller holding an issue and no symbol — which is the caller this # verb was written for, and by construction the one who cannot name the scope. Refusing here @@ -452,7 +457,7 @@ def main(argv): + ("…" if n > 4 else "") + ")") print(" no --in was given, so NOTHING below is narrowed to it — " "pass --in to narrow.\n") - bad = require_scope(g, scopes, terms, rank=rank, flag=' --in-offered') + bad = None if flat else require_scope(g, scopes, terms, rank=rank, flag=' --in-offered') if bad is not None: return bad # a symbol is kept when it is under ANY of the scopes -- the union, because the caller naming two roots