Repository navigation
[feat] cli: discover matches word by word, names Core's match on a miss - #12219
Conversation
astryx discover <words> now scores items with search's shared word scorer: a query matches by the words of an item's name, title, summary and keywords, and the item's package description adds words. Items that match every word come first and alone; otherwise matches rank by how many words they match. When discover finds nothing, the not-found error suggests the first Core component or hook astryx search gives for the query, through the lookups' shared other-command hint. astryx search prints its "More in packages you could add" line only when the saved copy of a discover catalog has an addable item that carries a word of the query. It reads only the saved copy; with none, the line prints as before.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision, and three fixes are needed.
This pull request rewrites the current spec:AST-051 FR4: discover matches word by word, ranks by words matched before name closeness, and suggests Core's match on a miss. No record yet covers the new rule that astryx search leaves out its "More in packages you could add" line. An engineering owner records the FR4 decision by commenting /approve-spec <full head SHA>, and the author may do so as an engineering owner; the footer rule needs a named clause, or an owner ruling that it needs none.
Blocking:
- With a saved catalog copy,
astryx search gothicdrops the discover line even thoughastryx discover gothiclists the uninstalled@astryxdesign/theme-gothic, becausesavedCataloginpackages/cli/api/discover/_adapter.mjsleaves out the official package list that discover always reads; add the official packages that no source covers, and test an official-only match. withCoreMatchinpackages/cli/api/discover/discover.mjsrunsapi/search'ssearch(), which loads the project and reads docs from disk, from the discover entry, whicharchitecture:cli-surfaceINV21 reserves for the subject's adapter; move that call intodiscover/_adapter.mjs.- The changeset's example "
discover bar chartfindsBarChart" already worked before this change, and typed unquoted it searches only "bar" becausediscovertakes one argument; use a quoted example the old matcher missed, such asdiscover 'chart categories', or join discover's words assearchdoes.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: discover scores items with search's shared word scorer. Verified in the search leaf's
rankandscoreQuery. - Claim: items match by name words, title, summary and keywords. Verified in
candidateOfand the leaf tests. - Claim: a package's description adds words but never matches an item alone. Verified in
rankand the "directory" test. - Claim: every-word matches are listed alone, otherwise ranked by words matched. Verified by the
everyWordcut andbyMatch. - Claim: no new matcher. Verified for the discover leaf; the footer adds its own word-overlap check,
anyAvailableWord. - Claim: a miss suggests search's first Core component or hook, and
discover modalsuggestsastryx component AlertDialog. Verified with the CLI; this applies only where discover answers queries, and the hint can push out a near-name suggestion. - Claim:
hintForandwithOtherCommandare now exported. Partly false:withOtherCommandwas already exported. - Claim: search prints the discover line only when the saved copy has an addable word match, reads only that copy, and prints as before without one. Verified as written, but the check leaves out the official list (blocking).
- Claim: the footer check misses only word-start, typo and synonym matches. False: it misses every official-list package.
- Claim: FR4 is amended in place and no record is added. Verified; the footer rule is not in the rewrite.
- Claim: the
discover.searchJSON shape is unchanged, and a miss may carry one more suggestion of the same shape. Verified withdiscover modal --json; with near-name suggestions present, the hint replaces the last one. - Claim: search
--jsonis unchanged, and only the text line can be left out. Verified in the search command handler. - Claim: no new options or API exports. Verified: the API index and the command docs are unchanged.
- Claim: multi-word queries found nothing before, and
discover bar chartnow findsBarChart. False: the old near-miss rule found it, and unquoted the command reads only "bar". - Claim: the saved copy was checked before it was saved, and an unreadable copy leaves the line as before. Verified: the copy is written after validation, and the handler catches errors.
- Claim: search makes no subprocess or network call. Verified by the test's source marker and the code.
- Claim: the other lookup misses print the same output. Verified: the shared hint module only gains an
export. - Claim: replay-set precision 0.94, recall 0.91, and a +12 ms median. Not verifiable from the repository.
- Claim: the new and changed tests pass. Verified for the discover, search and suggest scope.
.changeset/discover-word-aware.md: finding (example claim).docs/specs/AST-051-discover-integration-manager/spec.md: needs owner approval.packages/cli/api/discover/_adapter.mjs: finding (official list).packages/cli/api/discover/_adapter.test.mjs: clear.packages/cli/api/discover/_catalog-view.mjs: clear.packages/cli/api/discover/discover.core-match.test.mjs: clear.packages/cli/api/discover/discover.mjs: finding (INV21).packages/cli/api/discover/discover.test.mjs: clear.packages/cli/api/discover/search/search.mjs: clear, with its behavior waiting on the FR4 decision.packages/cli/api/discover/search/search.test.mjs: clear.packages/cli/clients/cli/commands/search.discover-hint.test.mjs: clear (no official-only case).packages/cli/clients/cli/commands/search.mjs: finding (relies on the incomplete check).packages/cli/foundation/suggest/other-command.mjs: clear.
…ed words The saved-catalog read behind search's discover line adds the official packages no source covers, as discover does, so an official-only match keeps the line. The Core-match hint for a discover miss runs in the discover adapter. `astryx discover` reads every unquoted word as part of the query, as search does. spec:AST-051 FR4 states the word matching and the miss hint, and FR13 states when search prints its discover line.
PR Analysis Report🔎 Preview ·
|
…er line The Core-match hint for a discover miss names search's first Core component or hook only when search answers the whole query with it by a name or keyword: one word at search's keyword strength, or every word of a longer query. A Core entry found only through prose, or through some of the words, is no longer named. Search's "More in packages you could add" line shows only when an item a project could add answers every word of the query (or a synonym search reads for it), as an item in discover's every-word tier does; one shared word no longer shows it. spec:AST-051 FR4 and FR13 say so.
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision and two fixes; the earlier official-list, adapter and changeset findings are fixed.
This pull request rewrites the current spec:AST-051 FR4 (word-by-word matching, ranking by words matched before name closeness, every typed word as the query, Core's match on a miss) and adds FR13 for when astryx search prints its discover line, so an engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request, which the author may do as an engineering owner.
Blocking:
- Miss: with a saved catalog copy,
astryx search barchartdrops the "More in packages you could add" line althoughastryx discover barchartlistsBarChart, becauseanyAvailableWordinpackages/cli/api/discover/search/search.mjscompares only split words; also count an item whose joined name or title equals the joined query, add abarchartcase to the leaf test, and correct the description's claim that the check misses only word-start, typo and synonym matches. - The description's user need says any query of two or more words found nothing, but on the base
discover 'bar chart'listsBarChartanddiscover 'line chart'listsSparkline, so say instead that such a query matched only when its words stood together, in order, in an item's name or text.
Smaller points: unquoted astryx discover @acme/charts BarChart now fails with Package "@acme/charts BarChart" not found, and when near-name suggestions exist the Core hint replaces the last one instead of adding a suggestion.
Claims and files checked
Review mode: full; reason: spec-record
- Changeset: discover matches word by word like search, and every word is part of the query. Verified: the leaf uses search's scorer, the argument is variadic, and the CLI joins the words.
- Changeset: items match by name words, title, summary and keywords, and the package description adds words. Verified in the leaf's candidate and rank functions and the leaf tests.
- Changeset:
discover chart categoriesfindsBarChart, which the old phrase match missed. Verified: the base matcher finds nothing for that phrase; the head listsBarChart. - Changeset: every-word matches are listed alone, otherwise ranked by words matched. Verified by the every-word cut and the comparator.
- Changeset: a miss suggests search's first Core component or hook, such as
AlertDialogformodal. Verified with the CLI. - Changeset: search prints the discover line only when a saved catalog copy has an addable item carrying a query word, and as before with no copy. Verified as written; the word check misses exact names typed in lowercase (blocking).
- Changeset: search reads only the saved copy and never calls a source. Verified by the source-marker test and the code.
- Description: any multi-word query found nothing on the base. False: phrase and near-miss matches worked (blocking).
- Description: a miss stopped with no lead, and search always printed the discover line. Verified, apart from
--type hook, which never printed it. - Description: the leaf uses search's shared scorer with its word forms, typo rule and synonyms, and the package description never matches alone. Verified, including the "directory" test.
- Description: no new matcher. Verified for discover; the footer adds its own word check, which the description explains.
- Description: the miss hint goes through the shared other-command hint, which is now exported, and the adapter runs the search. Verified; only
hintForgains an export, aswithOtherCommandwas already exported. - Description: the footer reads the saved copies and the official list, never a source. Verified, with an official-only test.
- Description: FR4 is amended in place and FR13 added, with no new record. Verified.
- Description: the argument is variadic and the
discover.searchJSON shape is unchanged. Verified. - Description: a miss may carry one more suggestion of the same shape. Partly: with near-name suggestions the hint replaces one.
- Description: search
--jsonis unchanged and only the text line can be left out. Verified in the handler. - Description: no new options or API exports. Verified for options and package exports; the discover argument becomes variadic.
- Description: the example outputs. Verified with the CLI.
- Description: the footer check misses only word-start, typo and synonym matches. False: it also misses an exact name typed in lowercase (blocking).
- Description: the saved copy was checked before saving, and an unreadable copy leaves the line as before. Verified: copies are written after validation and the handler catches errors.
- Description: replay-set top-3, precision 0.94, recall 0.91 and +12 ms. Not verifiable from the repository.
- Description: search makes no subprocess or network call, and other lookups' misses print as before. Verified by the marker test and the unchanged shared hint.
- Description: the new and changed tests pass. Verified for the discover, search, suggest, command and golden scope.
.changeset/discover-word-aware.md: clear.docs/specs/AST-051-discover-integration-manager/spec.md: needs owner approval (FR4, FR13).packages/cli/api/discover/_adapter.mjs: clear.packages/cli/api/discover/_adapter.test.mjs: clear.packages/cli/api/discover/_catalog-view.mjs: clear.packages/cli/api/discover/discover.core-match.test.mjs: clear.packages/cli/api/discover/discover.mjs: clear.packages/cli/api/discover/discover.test.mjs: clear.packages/cli/api/discover/search/search.mjs: finding (footer word check).packages/cli/api/discover/search/search.test.mjs: clear (no lowercase-name case).packages/cli/clients/cli/commands/discover.doc.mjs: clear.packages/cli/clients/cli/commands/discover.mjs: clear (non-blocking note on an unquoted package path).packages/cli/clients/cli/commands/search.discover-hint.test.mjs: clear.packages/cli/clients/cli/commands/search.mjs: clear, relying on the word check above.packages/cli/foundation/suggest/other-command.mjs: clear.packages/cli/test/__golden__/no-icon-set/help.txt: clear.packages/cli/test/__golden__/no-icon-set/manifest.json: clear.
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision and two fixes.
This pull request rewrites the current spec:AST-051 FR4 (word-by-word matching ranked by words matched before name closeness, every typed word as the query, and Core's match on a miss) and adds FR13 for when astryx search prints its discover line, so an engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner.
Blocking:
- With a saved catalog copy,
astryx search barchartandastryx search employee typeaheaddrop the "More in packages you could add" line althoughastryx discoverlistsBarChartandPersonPickerfor them, becauseanyAvailableNamedinpackages/cli/api/discover/search/search.mjscompares split words only and ignores the package-description words discover's every-word tier counts; count an item whose joined name or title equals the joined query and let the package's words fill in asrank()does (amending FR13's own-text wording to match), add both cases tosearch.test.mjs, and correct the description and changeset claims that the check matches discover's every-word tier and misses only word-start, typo and synonym matches. - The description's user need says any query of two or more words found nothing, but on the base
astryx discover 'bar chart'listsBarChartand the leaf answers'line chart'withSparkline, so say instead that such a query matched only when its words stood together, in order, in an item's name or text, and that the CLI dropped unquoted words after the first.
Smaller points: unquoted astryx discover @acme/charts BarChart now fails with Package "@acme/charts BarChart" not found, the Core hint replaces the last near-name suggestion instead of adding one, and two JSDoc comments still say the footer check needs only one query word.
Claims and files checked
Review mode: full; reason: spec-record
- Changeset: discover matches word by word like search, with every word part of the query. Verified: the leaf scores with search's scorer, the argument is variadic, and the command joins the words.
- Changeset: items match by name words, title, summary and keywords, and the package description adds words. Verified in the leaf's candidate and rank functions and the leaf tests.
- Changeset:
discover chart categoriesnow findsBarChart, which the old whole-phrase match missed. Verified: the base phrase match finds nothing; the head listsBarChart. - Changeset: every-word matches are listed alone, otherwise ranked by words matched. Verified by the every-word cut and the comparator.
- Changeset: a miss suggests search's first Core component or hook when search matches it by name or keyword, such as
AlertDialogformodal. Verified with the CLI and the miss tests. - Changeset: search prints the discover line only when an addable item in the saved copy answers every query word, and as before with no copy. False for a joined name such as
barchart(blocking); the no-copy case is verified. - Changeset: search reads only the saved copy and never calls a source. Verified by the source-marker test and the code.
- Description: any query of two or more words found nothing on the base. False:
'bar chart'and'line chart'found items (blocking). - Description: a miss stopped with no lead, and search always printed the discover line. Verified, apart from
--type hook, which never printed it. - Description: the leaf uses search's shared scorer with its word forms, typo rule and synonyms, and the package description never matches alone. Verified, including the
directorytest. - Description: the every-word cut, then ranking by words matched and score, with no new matcher. Verified for discover; the footer adds its own check, which the description explains.
- Description: the miss hint goes through the shared other-command hint, now exported, and the adapter runs the search. Verified; only
hintForgains an export. - Description: the hint names only a Core entry search matched by name or keyword, never a prose or partial match. Verified by the score gate and its tests.
- Description: the footer reads the saved copies and the official list, never a source, and prints the line with no copy. Verified, with an official-only test.
- Description: the footer needs every word or a synonym, as discover's every-word tier does. Partly false: joined names and package-description words that discover counts are missed (blocking).
- Description: FR4 is amended in place and FR13 added, with no new record. Verified.
- Description: the argument is variadic and the
discover.searchJSON shape is unchanged. Verified. - Description: a miss may carry one more suggestion of the same shape. Partly: with near-name suggestions the hint replaces the last one.
- Description: search
--jsonis unchanged and only the text line can be left out. Verified in the handler. - Description: no new options or API exports. Verified for options and package entry points; the discover argument becomes variadic.
- Description: the example outputs for
discover chart categoriesanddiscover modal. Verified with the CLI. - Description: the footer check misses only word-start, typo and synonym matches. False: synonyms now count, and joined names and package-description words are missed (blocking).
- Description: a saved copy is read as saved, and one that does not read leaves the line as before. Verified: the command catches the error and prints the line.
- Description: the replay-set judgements and the +12 ms timing. Not verifiable from the repository.
- Description: search makes no subprocess or network call, and other lookups' misses print as before. Verified by the marker test and the unchanged shared hint.
- Description: the new and changed tests pass. Verified for the discover, search, suggest, command and golden scope, also merged with the current base branch.
.changeset/discover-word-aware.md: finding (its footer claim, first blocking item).docs/specs/AST-051-discover-integration-manager/spec.md: needs owner approval (FR4, FR13).packages/cli/api/discover/_adapter.mjs: clear.packages/cli/api/discover/_adapter.test.mjs: clear.packages/cli/api/discover/_catalog-view.mjs: clear.packages/cli/api/discover/discover.core-match.test.mjs: clear.packages/cli/api/discover/discover.mjs: clear (non-blocking stale JSDoc).packages/cli/api/discover/discover.test.mjs: clear.packages/cli/api/discover/search/search.mjs: finding (footer check, blocking).packages/cli/api/discover/search/search.test.mjs: finding (no joined-name or package-description footer case).packages/cli/clients/cli/commands/discover.doc.mjs: clear.packages/cli/clients/cli/commands/discover.mjs: clear (non-blocking note on an unquoted package path).packages/cli/clients/cli/commands/search.discover-hint.test.mjs: clear.packages/cli/clients/cli/commands/search.mjs: clear (non-blocking stale JSDoc).packages/cli/foundation/suggest/other-command.mjs: clear.packages/cli/test/__golden__/no-icon-set/help.txt: clear.packages/cli/test/__golden__/no-icon-set/manifest.json: clear.
Search's discover line counts an item whose name or title is the query with its words joined (`barchart`), and lets the package's description fill in words the item's own text lacks, as discover's every-word tier does; the item's own text still answers at least one word. After a package path, discover takes the next unquoted word as its item, so `discover @acme/charts BarChart` opens the item. The Core-match hint follows discover's own near names instead of replacing the last one. spec:AST-051 FR4 and FR13 say so.
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision and three fixes.
This pull request rewrites the current spec:AST-051 FR4 (word-by-word matching ranked by words matched before name closeness, every typed word as the query, and Core's match on a miss) and adds FR13 for when astryx search prints its discover line, so an engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner.
Blocking:
- Miss: with a saved catalog copy,
astryx search frobnicatorstill ends with "More in packages you could add" when only an integration the project loads throughastryx.configwithout declaring it inpackage.jsonanswers the query, whileastryx discover frobnicatorfinds nothing, becauseaddableMatchpasses no installed packages tosearchItems(packages/cli/api/discover/discover.mjs:185-186); count the integrations the project loads as installed there, as discover's own search does, and add a footer test with a configured, undeclared integration that a source also lists. - The new FR4 sentence and the description say that after a package path the next word is its item, but
packages/cli/clients/cli/commands/discover.mjs:330-332joins with/only after an@scope/name, soastryx discover acme-widgets WidgetGridsearches both words instead of openingacme-widgets/WidgetGrid; say "after a scoped package name" in FR4, the description and the code comment, or join when the first word names a package discover knows. - The description says the miss hint goes through
hintForandwithOtherCommand, now exported, butwithCoreMatchnow uses onlyhintFor, the one new export, andwithOtherCommandwas already exported on the base, so namehintForalone.
The earlier footer findings for barchart and employee typeahead, the description's account of the base, the hint order and the unquoted @scope/name Item case are fixed. One smaller point: FR13's verification row lists --json, which no test runs with a saved copy.
Claims and files checked
Review mode: full; reason: spec-record
- Changeset: discover matches word by word like search, every word is part of the query, and items match by name words, title, summary and keywords with the package description adding words. Verified in the leaf and its tests.
- Changeset:
discover chart categoriesnow findsBarChart, which the old whole-phrase match missed. Verified with the CLI on base and head. - Changeset: every-word matches are listed alone, otherwise ranked by words matched. Verified by the every-word cut and the comparator.
- Changeset: a miss suggests search's first Core component or hook when search matches it by name or keyword, such as
AlertDialogformodal. Verified with the CLI and the miss tests. - Changeset: search keeps the discover line only when a package the project could add has an item that answers the whole query, by a joined name or every word with package words; as before with no copy; it never calls a source. False for an integration the project loads without declaring it (first blocking item); the rest verified.
- Description: discover matched the whole query as one substring of a name or text, and the CLI dropped unquoted words after the first. Verified on the base.
- Description: a miss stopped with no lead, and search always printed the discover line. Verified, apart from
--type hook, which never printed it. - Description: every unquoted word is the query and after a package path the next word is its item. False for unscoped package names (second blocking item).
- Description: the leaf uses search's shared scorer with its word forms, typo rule and synonyms, and the package description never matches alone. Verified, including the
directorytest. - Description: the every-word cut, then ranking by words matched and score, with no new matcher in discover. Verified; the footer's own check is described separately.
- Description: the miss hint goes through the shared hint builders,
hintForandwithOtherCommand, now exported. False: onlyhintForis used and newly exported (third blocking item). - Description: the hint follows discover's near names and names only a Core entry search matched by name or keyword. Verified by the score gate and the order test.
- Description: the adapter runs that search, keeping the entry and leaves free of file and process access. Verified.
- Description: the footer reads the saved copies and the official list, counts joined names, every word or a synonym with package words, and skips word-start, typo and joined-keyword matches. Verified with the CLI and tests, apart from the loaded-integration case.
- Description: FR4 is amended in place and FR13 added, with no new record. Verified.
- Description: the argument is variadic and the
discover.searchJSON shape is unchanged. Verified. - Description: a miss may carry one more suggestion of the same shape. Verified.
- Description: search
--jsonis unchanged and only the text line can be left out. Verified in the handler, which returns JSON before the footer. - Description: no new options or API exports. Verified for options and package entry points; the discover argument becomes variadic.
- Description: the example outputs for
discover chart categoriesanddiscover modal. Verified with the CLI. - Description: a saved copy is read as saved, and one that does not read leaves the line as before. Verified: the command catches the error and prints the line.
- Description: the replay-set judgements and the timing figure. Not verifiable from the repository.
- Description: search makes no subprocess or network call, and other lookups' misses print as before. Verified by the source-marker test and the unchanged shared hint.
- Description: the new and changed tests and the listed checks pass. Verified for the discover, search, suggest and command tests, also merged with the current base branch, and for the JSON-API typecheck, structure, knowledge and changeset checks.
.changeset/discover-word-aware.md: finding (its footer claim, first blocking item).docs/specs/AST-051-discover-integration-manager/spec.md: needs owner approval (FR4, FR13); finding (the package-path sentence, second blocking item).packages/cli/api/discover/_adapter.mjs: clear.packages/cli/api/discover/_adapter.test.mjs: clear.packages/cli/api/discover/_catalog-view.mjs: clear.packages/cli/api/discover/discover.core-match.test.mjs: clear.packages/cli/api/discover/discover.mjs: finding (no installed packages in the footer check, first blocking item).packages/cli/api/discover/discover.test.mjs: clear.packages/cli/api/discover/search/search.mjs: clear.packages/cli/api/discover/search/search.test.mjs: clear.packages/cli/clients/cli/commands/discover.doc.mjs: clear.packages/cli/clients/cli/commands/discover.mjs: finding (scoped-only join, second blocking item).packages/cli/clients/cli/commands/search.discover-hint.test.mjs: finding (no case with a loaded, undeclared integration; no--jsoncase).packages/cli/clients/cli/commands/search.mjs: clear.packages/cli/foundation/suggest/other-command.mjs: clear.packages/cli/test/__golden__/no-icon-set/help.txt: clear.packages/cli/test/__golden__/no-icon-set/manifest.json: clear.
Search's "More in packages you could add" line now shows exactly when `astryx discover <query>` would list a match: it runs discover's own search over the saved catalog copies and the official packages no source covers, with the packages the project has (the integrations it loads included), and applies no rule of its own. It ranks first without the docs installed packages add, which take a read of the whole docs catalog; a match settles the answer, and only a query with no match reads them and ranks again. A pre-test that skips only items the scorer cannot match keeps ranking cheap without changing any result. FR4 says the word after a scoped package name is its item, and FR13 says the line shows when discover would answer.
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision and two fixes.
This pull request rewrites the current spec:AST-051 FR4 (word-by-word matching ranked by words matched before name closeness, every typed word as the query, and Core's match on a miss) and adds FR13 for when astryx search prints its discover line, so an engineering owner records that decision by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner.
Blocking:
- The new
mayMatchpre-test (packages/cli/api/discover/search/search.mjs:149-191) drops items search's scorer matches, a hyphenated word read joined (multi-selectis the keywordmultiselect) and a synonym's typo, so with a source that listsMultiSelectorkeyedmultiselect,astryx discover tags multi-selectanswers not found; add each token with-and_removed to the words whose prefixes count and the synonyms' lengths tolengths(with both, a 17,892-query comparison shows the same results with and without the pre-test), and add a leaf case for it. - With
--type themeor--type doc,wouldAnswernarrows the check to that kind (packages/cli/api/discover/discover.mjs:213) while the line namesdiscover <query>and FR13 and the description say it prints exactly whendiscover <query>would list a match, soastryx search chart --type themedrops the line thoughastryx discover chartlistsBarChart; state the narrowing in FR13 and the description and print--type <kind>in the line, or drop the kind from the check.
The earlier findings about loaded integrations in the footer, the package-path sentence and the hint path are fixed. One smaller point: FR13's verification row lists --json, which no test runs with a saved copy.
Claims and files checked
Review mode: full; reason: spec-record
- Changeset: discover matches word by word as search does, by the words of an item's name, title, summary and keywords, with its package's description adding words. False for a hyphenated word read joined and a synonym's typo, which the pre-test drops (first blocking item); the rest verified in the leaf and its tests.
- Changeset:
discover chart categoriesfindsBarChart, which the old match missed. Verified with the CLI on the base and the head. - Changeset: every-word matches are listed alone, and matches rank by how many words they match. Verified in the ranking and its tests.
- Changeset: a miss suggests search's first Core component or hook when search matches it by name or keyword, such as
AlertDialogfordiscover modal. Verified with the CLI, also on the head merged with the current base branch. - Changeset: search prints the discover line only when discover would list a match, decided by discover's own ranking over the saved copy. Verified: a printed line always means discover lists a match.
- Changeset: with no saved copy the line prints as before, and search never calls a source. Verified by the command tests.
- Description: discover matched the whole query as one substring, and the CLI dropped unquoted words after the first. Verified on the base.
- Description: a miss stopped with nothing more, and search always ended with the discover line. Verified, apart from
--type hook, which never printed it. - Description: every unquoted word is the query, and after a scoped package name the next word is its item. Verified.
- Description: the leaf scores with search's shared word scorer, and a package description never matches an item alone. Verified, apart from the pre-test (first blocking item).
- Description: the every-word cut, then ranking by words matched and score, with no new matcher. Verified; the pre-test is a second filter in front of it.
- Description: the miss hint goes through the shared hint,
hintFor, now exported, and names only a whole-query name or keyword match. Verified. - Description: the discover adapter runs that search. Verified.
- Description: search prints the line exactly when discover would list a match, with no rule of its own. False with a
--typethat names a discover kind (second blocking item). - Description: search reads only the saved copies and the official list. Verified.
- Description: the pre-test skips only items the scorer cannot match and changes no result. False (first blocking item).
- Description: the argument is variadic, the
discover.searchJSON shape is unchanged, and a miss may carry one more suggestion of the same shape. Verified. - Description: only the text line can be left out, and
--jsonis unchanged. Verified: the handler returns JSON before it asks discover. - Description: no new options or API exports. Verified for options and package entry points.
- Description: the example outputs for
discover chart categoriesanddiscover modal. Verified with the CLI. - Description: the footer ranks without the installed packages' docs first and reads them only on a miss, since more items never empty discover's list. Verified in the code.
- Description: the timing figures, the replay-set judgements and the 108 agreeing queries. Not verifiable from the repository.
- Description: search makes no subprocess or network call. Verified by the source-marker test.
- Description: the other lookups' misses print as before. Verified: the shared hint module changes only its
hintForexport. - Description: the listed tests and checks pass. Verified for the discover, search, suggest and golden suites, also merged with the current base branch, and the JSON-API typecheck; CI lint passes.
.changeset/discover-word-aware.md: finding (its word-by-word claim, first blocking item).docs/specs/AST-051-discover-integration-manager/spec.md: needs owner approval (FR4, FR13); finding (FR13 against--type, second blocking item).packages/cli/api/discover/_adapter.mjs: clear.packages/cli/api/discover/_adapter.test.mjs: clear.packages/cli/api/discover/_catalog-view.mjs: clear.packages/cli/api/discover/discover.core-match.test.mjs: clear.packages/cli/api/discover/discover.mjs: finding (the--typenarrowing, second blocking item).packages/cli/api/discover/discover.test.mjs: clear.packages/cli/api/discover/search/search.mjs: finding (the pre-test, first blocking item).packages/cli/api/discover/search/search.test.mjs: finding (no hyphenated-word case, first blocking item).packages/cli/clients/cli/commands/discover.doc.mjs: clear.packages/cli/clients/cli/commands/discover.mjs: clear.packages/cli/clients/cli/commands/search.discover-hint.test.mjs: finding (no--typecase with a discover kind, no--jsoncase).packages/cli/clients/cli/commands/search.mjs: clear.packages/cli/foundation/suggest/other-command.mjs: clear.packages/cli/test/__golden__/no-icon-set/help.txt: clear.packages/cli/test/__golden__/no-icon-set/manifest.json: clear.
Discover's record of the integrations a project loads, and what each adds, the names of their docs included, is kept between runs in the per-user catalogs folder and used only while every file it read is unchanged, so search's discover line costs a warm search only its ranking. The line's check stops at the first match, which settles it. The ranking pre-test reads a word with `-` or `_` joined, as the scorer does, and counts the synonyms' lengths for typos, so it never drops a match. With `--type <kind>`, the line names `discover <query> --type <kind>`. spec:AST-051 FR13, spec:AST-081 FR7, the architecture's kept list and doctor's catalogs row say so.
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision; no code fixes are required.
This pull request rewrites the current spec:AST-051 FR4 (word-by-word matching ranked by words matched, the package description adding words, and Core's match on a miss). It adds FR13, which says when astryx search prints its discover line, --type included, and it adds discover's kept installed record to the per-user writes that spec:AST-081 FR7 and architecture:cli-surface INV10 allow. Approval needs an engineering owner to approve those record changes for this exact head by commenting /approve-spec <full head SHA>; the author may do so as an engineering owner. The earlier findings on the pre-test and on the --type check are fixed.
- Non-blocking. Miss:
astryx discover @acme/charts bar chartjoins every word into the item path (packages/cli/clients/cli/commands/discover.mjs:332) and fails, but FR4 says only the next word is the item; join with/only for@scope/namefollowed by one word.
Claims and files checked
Review mode: full; reason: spec-record
- Claim: discover reads every word and matches by name words, title, summary and keywords, the package description adding words. Verified:
discover/search/search.mjscandidate and rank code, word-by-word leaf tests. - Claim:
discover chart categoriesfinds BarChart, which the phrase match missed. Verified: the head lists BarChart alone; the base read onlychart. - Claim: items matching every word are listed alone, ranked by words matched. Verified:
rankItems. - Claim: a miss suggests search's first strong Core component or hook, such as AlertDialog for
modal. Verified: head run, core-match tests. - Claim: search prints its discover line only when discover would list a match over the saved copy, and names
--type. Verified: discover-hint tests, head runs. - Claim: with no saved copy the line still prints. Verified: discover-hint test.
- Claim: search never calls a discover source. Verified: source-call marker test.
- Claim: the base matched one substring, dropped unquoted words, and always printed the line. Verified: base runs.
- Claim: after a scoped package name the next word is its item. Verified for two words; with three or more words, see the note above.
- Claim: there is no new matcher, and the pre-test changes no result. Verified: 15,902 queries compared with and without it.
- Claim: the miss hint uses only search's keyword-strength and every-word tiers, through the shared hint. Verified:
withCoreMatch. - Claim: discover's installed record is kept and stamp-checked. Verified: packed kept-catalog test.
- Claim: JSON output, options and API exports are unchanged, and other lookup misses print as before. Verified:
api/index.mjs, the JSON test, the export-only change toother-command.mjs. - Claim: the timing figures and the 108-query replay. Not reproduced.
- Claim: the listed tests and checks pass. Verified: discover, search, CLI command, docs-graph, experimental-isolation, structure and JSON API typecheck runs.
- Files clear:
.changeset/discover-word-aware.md,docs/architecture/cli-surface.md,docs/specs/AST-051-discover-integration-manager/spec.mdanddocs/specs/AST-081-global-mode/spec.md(both await owner approval),packages/cli/api/discover/_adapter.mjs,_adapter.test.mjs,_catalog-view.mjs,discover.core-match.test.mjs,discover.mjs,discover.test.mjs,search/search.mjs,search/search.test.mjs,packages/cli/api/doctor/doctor.mjs,packages/cli/clients/cli/commands/discover.doc.mjs,search.discover-hint.test.mjs,search.mjs,packages/cli/foundation/fs/gather-cache.mjs,packages/cli/foundation/suggest/other-command.mjs, bothno-icon-setgoldens,packages/cli/test/packed-gather-cache.discover-docs.test.mjs. - File with a note:
packages/cli/clients/cli/commands/discover.mjs(word join).
`astryx discover @scope/name Item` opens that item; any other run of unquoted words, a scoped name followed by several included, stays one free-text query, as spec:AST-051 FR4 says.
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision and one fix.
This pull request rewrites the current spec:AST-051 FR4 (word-by-word matching ranked by words matched, plus a Core suggestion on a miss), adds FR13 (when astryx search prints its discover line), and adds discover's kept installed record to the per-user writes in spec:AST-081 FR7 and architecture:cli-surface INV10. An engineering owner records that decision by commenting /approve-spec with the full head SHA, and the author may do so as an engineering owner.
Required fix:
- Miss: a project's own discover source saves its catalog under the single label
astryx.configfor every project (packages/cli/api/discover/_adapter.mjs:764, read at:814), so when two projects each setdiscover,astryx searchshows or hides its discover line according to whichever project last randiscover; key that copy by the project root and add a two-project case tosearch.discover-hint.test.mjs.
Also, discover @acme/charts bar chart now fails as a package name (packages/cli/clients/cli/commands/discover.mjs:333), and the branch needs a merge of main (two small conflicts, in _adapter.mjs and clients/cli/commands/search.mjs).
Claims and files checked
Review mode: full; reason: spec-record
Claims:
- Every word after
discoveris one query, and items match word by word, with the package description adding words: verified (discover/search/search.mjsrank;discover chart categorieslists BarChart alone). discover chart categoriesfinds BarChart by its summary, which the old whole-phrase match missed: verified (main readchartalone, and the quoted phrase matches no text).- When some items match every word, only those are listed, ranked by words matched: verified (
rankItems; thebar chartcase insearch.test.mjs). - A miss suggests search's first Core component or hook only on a name or keyword match (
discover modal→ AlertDialog): verified (withCoreMatch,discover.core-match.test.mjs, a run). - Search prints its discover line exactly when the
discovercommand it names would list a match: false when two projects each setdiscoverinastryx.config(two-project run); true within one project (search.discover-hint.test.mjs). - With
--type <kind>, the line names that option, and the check keeps that kind: verified (discoverHint, test). - With no saved copy, the line prints as before, and search never calls a discover source: verified (tests, source-call marker).
- On main, unquoted words after the first were dropped, a miss stopped, and search always printed the line: verified (runs on main).
- A scoped package name followed by one word opens that item: verified (a run).
- No new matcher: the leaf uses search's
scoreQuery: verified (imports). - The Core hint runs in discover's adapter through the shared, now exported hint: verified (
_adapter.mjs,other-command.mjs). - The line uses discover's own search over the saved copies, the official packages no source covers and the loaded integrations: verified within one project (
wouldAnswer, tests); false across projects (above). - The installed record is kept between runs, checked against every file it read, and an unwritable folder gives a fresh answer: verified (
packed-gather-cache.discover-docs.test.mjs). - The pre-test changes no result: verified (word-form, synonym, typo and hyphen cases in
search.test.mjs; the leaf is unchanged since a 15,902-query comparison with and without it). - JSON shapes are unchanged, a miss may carry one more suggestion, only the text line can disappear, and there are no new options or exports: verified (
search.mjs,api/index.mjs,search.doc.mjs). - Other lookup misses print as before: verified (the
other-commandtests pass; only anexportkeyword was added). - The timings, the 108- and 5,633-query replays, and "remaining failures fail the same on main": not reproduced.
Files:
.changeset/discover-word-aware.md: its "only when thediscovercommand it names would list a match" fails across projects.docs/architecture/cli-surface.md: the INV10 entry awaits owner approval.docs/specs/AST-051-discover-integration-manager/spec.md: the FR4 rewrite and FR13 await owner approval.docs/specs/AST-081-global-mode/spec.md: the FR7 entry awaits owner approval.packages/cli/api/discover/_adapter.mjs: the sharedastryx.configsaved copy (blocking); a conflict withmain.packages/cli/api/discover/_adapter.test.mjs: clear.packages/cli/api/discover/_catalog-view.mjs: clear.packages/cli/api/discover/discover.core-match.test.mjs: clear.packages/cli/api/discover/discover.mjs: clear.packages/cli/api/discover/discover.test.mjs: clear.packages/cli/api/discover/search/search.mjs: clear.packages/cli/api/discover/search/search.test.mjs: clear.packages/cli/api/doctor/doctor.mjs: clear.packages/cli/clients/cli/commands/discover.doc.mjs: clear.packages/cli/clients/cli/commands/discover.mjs: more than one word after a package path fails as a package name (non-blocking).packages/cli/clients/cli/commands/search.discover-hint.test.mjs: no two-project case.packages/cli/clients/cli/commands/search.mjs: a conflict withmain(non-blocking).packages/cli/foundation/fs/gather-cache.mjs: clear.packages/cli/foundation/suggest/other-command.mjs: clear.packages/cli/test/__golden__/no-icon-set/help.txt: clear.packages/cli/test/__golden__/no-icon-set/manifest.json: clear.packages/cli/test/packed-gather-cache.discover-docs.test.mjs: clear.
Search's discover line reads one kept record of what discover searches in its sources' saved copies (the project's packages and every item the copies list), kept while every file it read is unchanged, and discover's list, detail, doc and item code loads only for answers that need it, so a warm search pays about 10 ms for the line. A project's own source saves its copies per project root, so one project's catalog never decides another's line. A run of words after a scoped package name is a free-text query unless it is exactly one item word.
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision and one fix.
This pull request rewrites the current spec:AST-051 FR4 (word-by-word matching ranked by words matched, plus a Core suggestion on a miss), adds FR13 (when astryx search prints its discover line) and an FR8 sentence (a project's own saved catalog copy is kept per project), and adds the new kept records to the per-user writes in spec:AST-081 FR7 and architecture:cli-surface INV10. An engineering owner records that decision by commenting /approve-spec with the full head SHA, and the author may do so as an engineering owner.
Required fix:
- A project's own source now saves its catalog copy under the folder the command runs in instead of the project root (
packages/cli/api/discover/_adapter.mjs:770), so with the catalog host downastryx discoverin a subfolder such assrc/lists none of that source's packages, whichmainstill found in the saved copy, andastryx searchthere ignores the project's copy; key it by the config's folder and add a subfolder case tosearch.discover-hint.test.mjs.
Also, astryx discover @acme charts now opens the @acme/charts package page, though @acme is no scoped package name (packages/cli/clients/cli/commands/discover.mjs:333).
Claims and files checked
Review mode: full; reason: spec-record
Claims:
- Every unquoted word after
discoveris one query, matched word by word with search's scorer, the package description adding only missing words: verified (discover/search/search.mjsrank;discover chart categorieslistsBarChartalone). - A scoped package name and one word open that item, and more words are one free-text query: verified (runs;
search.discover-hint.test.mjs). - When some items match every word only those are listed, ranked by words matched and then by score: verified (
rankItems; thebar chartcase insearch.test.mjs). - A miss names search's first Core component or hook only on a name or keyword match, so
discover modalsuggestsAlertDialog: verified (withCoreMatch,discover.core-match.test.mjs, a run). - Search prints its discover line exactly when the
discovercommand it names would list a match, judged over the saved copies: verified in the folder that saved the copy and across projects; false from a project subfolder (a subfolder run). - With
--type <kind>the line names that option and the check keeps that kind: verified (discoverHint, test). - With no saved copy the line prints as before, and search never calls a discover source: verified (tests, source-call marker).
- A project's own source saves its copies per project root, so one project's catalog never decides another's line: per project verified (two-project test); per root false, the key is the run folder (
_adapter.mjs:770). - Discover's record of the loaded integrations is kept between runs, checked against every file it read, and an unwritable folder gives a fresh answer: verified (
packed-gather-cache.discover-docs.test.mjs). - The
discover.searchJSON shape andsearch --jsonare unchanged, a miss may carry one more suggestion, and there are no new options or exports: verified (search.mjs,api/index.mjs,commands/search.mjs). - Other lookup misses and the unknown-command hint print as before: verified (the
other-commandtests pass; only anexportkeyword was added). - On
main, unquoted words after the first were dropped, a miss stopped, and search always printed the line: verified (base runs). - The changeset's
discover chart categoriesexample is something the old whole-phrase match missed: verified (base readschartalone, and the phrase is in no item text). - The timings, the 108-query and 5,633-query replays, and that the remaining local failures fail the same on
main: not reproduced.
Files:
.changeset/discover-word-aware.md: its "only when thediscovercommand it names would list a match" fails from a project subfolder.docs/architecture/cli-surface.md: the INV10 entry awaits owner approval.docs/specs/AST-051-discover-integration-manager/spec.md: the FR4 rewrite, the FR8 sentence and FR13 await owner approval; the FR8 sentence says per project root, the code keys per run folder.docs/specs/AST-081-global-mode/spec.md: the FR7 entry awaits owner approval.packages/cli/api/discover/_adapter.mjs: the project-source copy keyed by the run folder (blocking).packages/cli/api/discover/_adapter.test.mjs: clear.packages/cli/api/discover/_catalog-view.mjs: clear.packages/cli/api/discover/discover.core-match.test.mjs: clear.packages/cli/api/discover/discover.mjs: clear.packages/cli/api/discover/discover.test.mjs: clear.packages/cli/api/discover/search/search.mjs: clear.packages/cli/api/discover/search/search.test.mjs: clear.packages/cli/api/doctor/doctor.mjs: clear.packages/cli/clients/cli/commands/discover.doc.mjs: clear.packages/cli/clients/cli/commands/discover.mjs:@acme chartsopens a package (non-blocking).packages/cli/clients/cli/commands/search.discover-hint.test.mjs: no subfolder case.packages/cli/clients/cli/commands/search.mjs: clear.packages/cli/foundation/fs/gather-cache.mjs: clear.packages/cli/foundation/suggest/other-command.mjs: clear.packages/cli/test/__golden__/no-icon-set/help.txt: clear.packages/cli/test/__golden__/no-icon-set/manifest.json: clear.packages/cli/test/packed-gather-cache.discover-docs.test.mjs: clear.
… scoped names A project's own discover source saves its copies under the folder that holds the config, so every folder in the project, `src/` included, reads the same copy when the source is down, and search's discover line there reads it too. Only a whole `@scope/name` followed by one word names an item; `discover @acme charts` is a free-text query.
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision and one fix.
This pull request rewrites the current spec:AST-051 FR4 (word-by-word matching ranked by words matched, plus a Core suggestion on a miss), adds FR13 (when astryx search prints its discover line) and an FR8 sentence (a project's own saved catalog copy is kept per project root), and adds the new kept records to the per-user writes in spec:AST-081 FR7 and architecture:cli-surface INV10. An engineering owner records that decision by commenting /approve-spec with the full head SHA, and the author may do so as an engineering owner.
Required fix:
- The kept saved-search record is now keyed by the project root while what it keeps reads the run folder's
package.json(packages/cli/api/discover/_adapter.mjs:875), so in a published CLI a project that declares a package it has not installed getsastryx search's discover line in every folder from whichever folder searched first, hiding the line insrc/whereastryx discover bar chartlistsBarChart, or showing it in the root where that command finds nothing; key the record by the run folder again (or read declarations from the project root) and add a packed case that searches fromsrc/and then the root.
The subfolder saved copy and astryx discover @acme charts are fixed at this head.
Claims and files checked
Review mode: incremental; reason: none
changed rules (0): none
Claims:
- Every unquoted word after
discoveris one query, matched word by word with search's scorer, the package description adding only missing words: verified (discover/search/search.mjsrank;discover chart categorieslistsBarChartalone). - A whole scoped package name and one word open that item, and any other run of words is one free-text query: verified (runs;
search.discover-hint.test.mjs, including@acme charts). - When some items match every word only those are listed, ranked by words matched and then by score: verified (
rankItems; thebar chartcase insearch.test.mjs). - A miss names search's first Core component or hook only on a name or keyword match, so
discover modalsuggestsAlertDialog: verified (withCoreMatch,discover.core-match.test.mjs, a run). - Search prints its discover line exactly when the
discovercommand it names would list a match, judged over the saved copies: verified per folder, from a subfolder and across projects; false across folders of one project that declares an uninstalled package, in a published CLI (a packed run). - With
--type <kind>the line names that option and the check keeps that kind: verified (discoverHint, test). - With no saved copy the line prints as before, and search never calls a discover source: verified (tests, source-call marker).
- A project's own source saves its copies per project root, so one project's catalog never decides another's line: verified (
projectRoot; the two-project and subfolder tests). - Discover's record of the loaded integrations is kept between runs, checked against every file it read, and an unwritable folder gives a fresh answer: verified (
packed-gather-cache.discover-docs.test.mjs). - The
discover.searchJSON shape andsearch --jsonare unchanged, a miss may carry one more suggestion, and there are no new options or exports: verified (search.mjs,api/index.mjs,commands/search.mjs). - Other lookup misses and the unknown-command hint print as before: verified (the
other-commandtests pass; only anexportkeyword was added). - On
main, unquoted words after the first were dropped, a miss stopped, and search always printed the line: verified (base runs). - The changeset's
discover chart categoriesexample is something the old whole-phrase match missed: verified (base readschartalone, and the phrase is in no item text). - The timings, the 108-query and 5,633-query replays, and that the remaining local failures fail the same on
main: not reproduced.
Files:
.changeset/discover-word-aware.md: its "only when thediscovercommand it names would list a match" fails across folders with a declared, uninstalled package.docs/architecture/cli-surface.md: the INV10 entry awaits owner approval.docs/specs/AST-051-discover-integration-manager/spec.md: the FR4 rewrite, the FR8 sentence and FR13 await owner approval.docs/specs/AST-081-global-mode/spec.md: the FR7 entry awaits owner approval.packages/cli/api/discover/_adapter.mjs: the kept saved-search record keyed by the project root (blocking).packages/cli/api/discover/_adapter.test.mjs: clear.packages/cli/api/discover/_catalog-view.mjs: clear.packages/cli/api/discover/discover.core-match.test.mjs: clear.packages/cli/api/discover/discover.mjs: clear;savedSearchInputreads the run folder's declarations, which the blocking finding covers.packages/cli/api/discover/discover.test.mjs: clear.packages/cli/api/discover/search/search.mjs: clear.packages/cli/api/discover/search/search.test.mjs: clear.packages/cli/api/doctor/doctor.mjs: clear.packages/cli/clients/cli/commands/discover.doc.mjs: clear.packages/cli/clients/cli/commands/discover.mjs: clear.packages/cli/clients/cli/commands/search.discover-hint.test.mjs: no cross-folder case in a published CLI.packages/cli/clients/cli/commands/search.mjs: clear.packages/cli/foundation/fs/gather-cache.mjs: clear.packages/cli/foundation/suggest/other-command.mjs: clear.packages/cli/test/__golden__/no-icon-set/help.txt: clear.packages/cli/test/__golden__/no-icon-set/manifest.json: clear.packages/cli/test/packed-gather-cache.discover-docs.test.mjs: clear.
The kept record of what discover searches holds what the run folder's package.json declares, as discover counts it, so it is kept per folder the command runs in again: a record one folder kept never decides search's discover line in another.
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision; no code fixes are required.
This pull request rewrites the current spec:AST-051 FR4 (word-by-word matching ranked by words matched, plus a Core suggestion on a miss), adds FR13 (when astryx search prints its discover line) and an FR8 sentence (a project's own saved catalog copy is kept per project root), and adds the new kept records to the per-user writes in spec:AST-081 FR7 and architecture:cli-surface INV10. Because it intentionally changes those current records, approval needs an engineering owner to accept the updated text: they record that decision by commenting /approve-spec with the full head SHA, and the author may do so as an engineering owner.
The kept record behind search's discover line is keyed by the folder the command runs in again, and the new packed test covers searching from the project root and from src/.
Claims and files checked
Review mode: incremental; reason: none
changed rules (0): none
Claims:
- Every unquoted word after
discoveris one query, matched word by word with search's scorer, the package description adding only missing words: verified (discover/search/search.mjsrank;discover chart categorieslistsBarChartalone). - A whole scoped package name and one word open that item, and any other run of words is one free-text query: verified (head runs;
search.discover-hint.test.mjs). - When some items match every word only those are listed, ranked by words matched and then by score: verified (
rankItems; thebar chartcase insearch.test.mjs). - A miss names search's first Core component or hook only on a name or keyword match, so
discover modalsuggestsAlertDialog: verified (withCoreMatch,discover.core-match.test.mjs, a head run). - Search prints its discover line exactly when the
discovercommand it names would list a match, judged over the saved copies: verified per folder, from a subfolder and across projects (search.discover-hint.test.mjs; the packed two-folder case). - With
--type <kind>the line names that option and the check keeps that kind: verified (discoverHint, test). - With no saved copy the line prints as before, and search never calls a discover source: verified (tests, source-call marker).
- A project's own source saves its copies per project root, so one project's catalog never decides another's line: verified (
projectRoot; the two-project and subfolder tests). - Discover's record of the loaded integrations is kept between runs, checked against every file it read, and an unwritable folder gives a fresh answer: verified (
packed-gather-cache.discover-docs.test.mjs). - The
discover.searchJSON shape andsearch --jsonare unchanged, a miss may carry one more suggestion, and there are no new options or exports: verified (search.mjs,api/index.mjs,commands/search.mjs). - Other lookup misses and the unknown-command hint print as before: verified (the
other-commandtests pass; only anexportkeyword was added). - On
main, unquoted words after the first were dropped, a miss stopped, and search always printed the line: verified (base runs). - The changeset's
discover chart categoriesexample is something the old whole-phrase match missed: verified (the base readschartalone, and the phrase is in no item text). - The timings, the 108-query and 5,633-query replays, and that the remaining local failures fail the same on
main: not reproduced.
Files:
.changeset/discover-word-aware.md: clear.docs/architecture/cli-surface.md: the INV10 entry awaits owner approval.docs/specs/AST-051-discover-integration-manager/spec.md: the FR4 rewrite, the FR8 sentence and FR13 await owner approval.docs/specs/AST-081-global-mode/spec.md: the FR7 entry awaits owner approval.packages/cli/api/discover/_adapter.mjs: clear; the kept record is keyed by the run folder.packages/cli/api/discover/_adapter.test.mjs: clear.packages/cli/api/discover/_catalog-view.mjs: clear.packages/cli/api/discover/discover.core-match.test.mjs: clear.packages/cli/api/discover/discover.mjs: clear.packages/cli/api/discover/discover.test.mjs: clear.packages/cli/api/discover/search/search.mjs: clear.packages/cli/api/discover/search/search.test.mjs: clear.packages/cli/api/doctor/doctor.mjs: clear.packages/cli/clients/cli/commands/discover.doc.mjs: clear.packages/cli/clients/cli/commands/discover.mjs: clear.packages/cli/clients/cli/commands/search.discover-hint.test.mjs: clear.packages/cli/clients/cli/commands/search.mjs: clear.packages/cli/foundation/fs/gather-cache.mjs: clear.packages/cli/foundation/suggest/other-command.mjs: clear.packages/cli/test/__golden__/no-icon-set/help.txt: clear.packages/cli/test/__golden__/no-icon-set/manifest.json: clear.packages/cli/test/packed-gather-cache.discover-docs.test.mjs: clear; the two-folder case fails with the old key.
The kept record of what discover searches holds only what the ranking reads, and is read back as stored, without a walk over it. The ranking pre-test also needs a typed word to share all but three letters with a name or keyword before it counts as a possible typo, which keeps out items no edit could match. The catalog schema is built on first use, and discover's catalog view, leaves and package scanner load only for answers that need them, so search's warm path loads none of them.
There was a problem hiding this comment.
Approval waits on an engineering owner's spec decision; no code fixes are required.
This pull request rewrites the current spec:AST-051 FR4 (word-by-word matching ranked by words matched, plus a Core suggestion on a miss), adds FR13 (when astryx search prints its discover line) and an FR8 sentence (a project's own saved catalog copy is kept per project root), and adds the new kept records to the per-user writes in spec:AST-081 FR7 and architecture:cli-surface INV10. Because it intentionally changes those current records, approval needs an engineering owner to accept the updated text: they record that decision by commenting /approve-spec with the full head SHA, and the author may do so as an engineering owner.
The latest commit only makes search's discover line cheaper; discover lists the same matches with and without the new pre-test across a wide query set.
Claims and files checked
Review mode: incremental; reason: none
changed rules (0): none
Claims:
- Every unquoted word after
discoveris one query, matched word by word with search's scorer, the package description adding only missing words: verified (discover/search/search.mjsrank;discover chart categorieslistsBarChartalone). - A whole scoped package name and one word open that item, and any other run of words is one free-text query: verified (head runs;
search.discover-hint.test.mjs). - When some items match every word only those are listed, ranked by words matched and then by score: verified (
rankItems; thebar chartcase insearch.test.mjs). - A miss names search's first Core component or hook only on a name or keyword match, so
discover modalsuggestsAlertDialog: verified (withCoreMatch,discover.core-match.test.mjs, a head run). - Search prints its discover line exactly when the
discovercommand it names would list a match, judged over the saved copies: verified per folder, from a subfolder and across projects (search.discover-hint.test.mjs; the packed two-folder case). - With
--type <kind>the line names that option and the check keeps that kind: verified (discoverHint, test). - With no saved copy the line prints as before, and search never calls a discover source: verified (tests, source-call marker).
- A project's own source saves its copies per project root: verified (
sourceOrigins; the two-project and subfolder tests). - Discover's record of the loaded integrations is kept between runs, checked against every file it read, and an unwritable folder gives a fresh answer: verified (
packed-gather-cache.discover-docs.test.mjs). - A warm search reads one small record, the first match settles the answer, and the pre-test changes no result: verified (
answersAnystops at the first match; the leaf gives the same lists with and without the pre-test over 11,367 queries in five kinds). - Discover's catalog view, leaves, package scanner and catalog schema load only for answers that need them: verified (none is in
discover.mjs's static imports; the schema is built on first use). - The
discover.searchJSON shape andsearch --jsonare unchanged, a miss may carry one more suggestion, and there are no new options or exports: verified (search.mjs,api/index.mjs,commands/search.mjs). - Other lookup misses and the unknown-command hint print as before: verified (the
other-commandtests pass; only anexportkeyword was added). - On
main, unquoted words after the first were dropped, a miss stopped, and search always printed the line: verified (base runs). - The changeset's
discover chart categoriesexample is something the old whole-phrase match missed: verified (the base readschartalone, and the phrase is in no item text). - The timings, the 108-query replay, and that the remaining local failures fail the same on
main: not reproduced.
Files:
.changeset/discover-word-aware.md: clear.docs/architecture/cli-surface.md: the INV10 entry awaits owner approval.docs/specs/AST-051-discover-integration-manager/spec.md: the FR4 rewrite, the FR8 sentence and FR13 await owner approval.docs/specs/AST-081-global-mode/spec.md: the FR7 entry awaits owner approval.packages/cli/api/discover/_adapter.mjs: clear; the kept record keeps the run-folder key and a plain codec.packages/cli/api/discover/_adapter.test.mjs: clear.packages/cli/api/discover/_catalog-view.mjs: clear.packages/cli/api/discover/detail/doc/doc.mjs: clear; awaits the now-async lookup.packages/cli/api/discover/discover.core-match.test.mjs: clear.packages/cli/api/discover/discover.mjs: clear; the slimmer record carries every field the ranking reads.packages/cli/api/discover/discover.test.mjs: clear.packages/cli/api/discover/search/search.mjs: clear; the shared-letters bound drops no match.packages/cli/api/discover/search/search.test.mjs: clear.packages/cli/api/doctor/doctor.mjs: clear.packages/cli/authoring/discover/parse.mjs: clear; the schema moves into a builder unchanged.packages/cli/clients/cli/commands/discover.doc.mjs: clear.packages/cli/clients/cli/commands/discover.mjs: clear.packages/cli/clients/cli/commands/search.discover-hint.test.mjs: clear.packages/cli/clients/cli/commands/search.mjs: clear.packages/cli/foundation/fs/gather-cache.mjs: clear.packages/cli/foundation/suggest/other-command.mjs: clear.packages/cli/test/__golden__/no-icon-set/help.txt: clear.packages/cli/test/__golden__/no-icon-set/manifest.json: clear.packages/cli/test/packed-gather-cache.discover-docs.test.mjs: clear.
|
Owner decision (search ranking owner, covering this pull request): approved. |
|
/approve-spec 6a04f6b |
|
/approve-spec e811f7d |
There was a problem hiding this comment.
Approved pending CI: CI has not finished on this head yet.
An engineering owner approved the spec:AST-051 FR4, FR8 and FR13 changes and the spec:AST-081 FR7 and architecture:cli-surface INV10 entries at this head, and the focused discover and search tests pass, so no code change is needed. The two earlier inline notes, on a scoped package name followed by one word and on the project catalog copy shared across projects, are fixed.
Claims and files checked
Review mode: incremental; reason: none
changed rules (0): none
Claims:
- Every unquoted word after
discoveris one query, matched word by word with search's scorer; a package's description adds only missing words and never matches alone: verified (api/discover/search/search.mjsrankandcandidateOf; the leaf's word-by-word tests; a head run ofdiscover chart categories). - A whole scoped package name followed by one word opens that item, and any other run of words is one free-text query: verified (
clients/cli/commands/discover.mjs:333-339,api/discover/discover.mjspackageShaped; head runs;search.discover-hint.test.mjs). - When some items match every word only those are listed, ranked by words matched and then by score: verified (
rankItems; thebar chartleaf case). - A miss adds, after discover's own near names, search's first Core component or hook only on a name or keyword match, so
discover modalsuggestsAlertDialog: verified (withCoreMatchin the discover adapter;discover.core-match.test.mjs; a head run). - Search prints its discover line exactly when that
discovercommand would list a match, by discover's own search over the saved copies and the official packages no source covers: verified (wouldAnswer,savedSearchInput,answersAny;search.discover-hint.test.mjs, including a loaded but undeclared integration, two projects and a subfolder with the source down). - With
--type <kind>the line names that option and the check keeps that kind: verified (discoverHint; head runs with--type componentand--type theme). - With no saved copy the line prints as before, and search never calls a discover source: verified (the call-marker tests; a head run before any discover).
- A project's own source saves its copies per project root: verified (
sourceOrigins; the two-project and subfolder tests). - Discover's record of the loaded integrations is kept between runs, checked against every file it read, and a cache folder that cannot be written leaves a fresh answer: verified (
describeInstalled; the packed kept-catalog tests). - A warm search reads one small record, the first match settles the answer, and the pre-test changes no result: verified (
answersAnystops at the first match; the leaf gives the same lists with and without the pre-test over 11,367 queries in five kinds). - Discover's catalog view, leaves, package scanner and catalog schema load only for answers that need them: verified (dynamic imports in
discover.mjsand the adapter; the schema is built on first use inparse.mjs). - The
discover.searchJSON shape andsearch --jsonare unchanged, a miss may carry one more suggestion of the same shape, and there are no new options or exports: verified (search.mjsmatch mapping;api/index.mjs; the JSON test). - Search's text output changes only in the discover line: verified (the test compares the output with the line removed).
- Other lookup misses and the unknown-command hint print as before: verified (only an
exportkeyword was added tohintFor; the other-command tests pass). - On the base, unquoted words after the first were dropped, a miss stopped, search always printed the line, and the quoted
chart categoriesphrase found nothing: verified (base runs). - The listed tests, type checks, structure, knowledge and changeset checks and lint pass: verified at this head; prettier passes on the changed lines (one untouched hunk of
other-command.mjsfails the same way on the base); the API type sync was not rerun. - The timings, the 108-query and 5,633-query replays, the
iconranking note and that the remaining local failures also fail on the base: not reproduced (measurements).
Files:
.changeset/discover-word-aware.md: cleardocs/architecture/cli-surface.md: clear; the INV10 entry is owner-approved at this headdocs/specs/AST-051-discover-integration-manager/spec.md: clear; FR4, FR8 and FR13 are owner-approved at this headdocs/specs/AST-081-global-mode/spec.md: clear; the FR7 entry is owner-approved at this headpackages/cli/api/discover/_adapter.mjs: clearpackages/cli/api/discover/_adapter.test.mjs: clearpackages/cli/api/discover/_catalog-view.mjs: clearpackages/cli/api/discover/detail/doc/doc.mjs: clear; awaits the now-async lookuppackages/cli/api/discover/discover.core-match.test.mjs: clearpackages/cli/api/discover/discover.mjs: clearpackages/cli/api/discover/discover.test.mjs: clearpackages/cli/api/discover/search/search.mjs: clearpackages/cli/api/discover/search/search.test.mjs: clearpackages/cli/api/doctor/doctor.mjs: clearpackages/cli/authoring/discover/parse.mjs: clear; the schema moves into a builder unchangedpackages/cli/clients/cli/commands/discover.doc.mjs: clearpackages/cli/clients/cli/commands/discover.mjs: clearpackages/cli/clients/cli/commands/search.discover-hint.test.mjs: clearpackages/cli/clients/cli/commands/search.mjs: clearpackages/cli/foundation/fs/gather-cache.mjs: clearpackages/cli/foundation/suggest/other-command.mjs: clearpackages/cli/test/__golden__/no-icon-set/help.txt: clearpackages/cli/test/__golden__/no-icon-set/manifest.json: clearpackages/cli/test/packed-gather-cache.discover-docs.test.mjs: clear
User need
An agent building an app asks
astryx discoverfor what it needs in its own words:employee typeahead,chart categories,line chart sparkline time series. Discover matched the whole query as one substring of an item's name or text, so a query of several words matched only when its words stood together, in order, in one item's name or text, and the CLI dropped unquoted words after the first.astryx searchreads the same words one by one. When discover found nothing, it said so and stopped, even when Core already has the answer. Andastryx searchended every answer with "More in packages you could add: astryx discover ", including when discover has nothing for that query, which sends the reader to a dead end.Problem and solution fit
astryx discoverreads every unquoted word as part of the query, as search does; a scoped package name followed by one word names that item (discover @acme/charts BarChart); any other run of words, a scoped name followed by several included, is one free-text query. The discover search leaf scores each item with search's shared word scorer (scoreQuery, the same word forms, typo rule and synonyms). An item matches by the words of its name (camelCase split), title, summary and keywords; its package's description adds words the item's own text lacks, but never matches an item on its own. When some item matches every word, only such items are listed (the cut search's suggestions make); otherwise matches rank by how many words they match, then by score. No new matcher.astryx searchgives for the query, through the lookups' shared other-command hint (hintFor, now exported), when search answers the whole query with it by a name or keyword (search's own keyword-strength and every-word tiers). A Core entry search found only through prose or some of the words is not named. The discover adapter runs that search (architecture:cli-surfaceINV21).discover modalsuggestsastryx component AlertDialog, search's first Core match.astryx searchprints the line exactly when thediscovercommand it names would list a match: it runs discover's own search (the same installed packages, the integrations the project loads included, and the same catalog items, ranked and cut the same way) over the saved catalog copies and the official packages no source covers, with no rule of its own. With--type <kind>, the line namesdiscover <query> --type <kind>and the check is kept to that kind. It reads only the saved copies and the official list the CLI carries, never a discover source. With no saved copy, the line prints as before. Discover's record of the integrations a project loads (what each adds, docs included) is kept between runs through the existing kept-catalog machinery, stamp-checked like the docs tree, so a warm search pays only for the ranking; the first match settles the answer, and a pre-test that skips only items the scorer cannot match keeps ranking cheap without changing any result. A project's own source (itsastryx.configdiscover) saves its copies per project root, so one project's catalog never decides another's line.Current specification
spec:AST-051FR4 owns how discover search matches and ranks. This PR amends FR4 in place: every unquoted word is part of the query, matching is word by word with search's scorer, ranking is by words matched before how strongly, and a miss suggests search's first Core component or hook. It addsspec:AST-051FR13 for whenastryx searchprints its discover line. It adds no new record.Public delta and caller burden
discover <words>: every unquoted word is part of the query (the argument is variadic, as search's is); more queries find matches; thediscover.searchJSON shape is unchanged.ERR_NOT_FOUNDerror may carry one moresuggestionsentry ({name: 'astryx component Dialog', reason: 'a component'}). The shape is unchanged.astryx searchtext output: only the "More in packages you could add" line can now be left out.--jsonoutput is unchanged.Design and alternatives
astryx discover's own search instead of a rule of its own, so it can never disagree with discover. Most of its cost was discover describing the integrations a project loads (their templates, themes and codemods, and the names of their docs, which read the project's whole docs catalog). That record is now kept between runs in the per-user catalogs folder (spec:AST-081FR7), used only while every file it read is unchanged, as the docs tree and the name index are. A folder that cannot be written leaves the answer as a fresh run gives it.package.jsondeclares), as a small record of only what the ranking reads. A warm search reads that one record and ranks; the first match settles the answer, and a pre-test skips items no word, form, synonym or typo could match. Discover's catalog view, list, detail, doc and item code, its package scanner and the catalog schema load only for answers that need them.astryx searchthe hint suggests is then warm. With the catalog already kept, a miss costs about +0.06 s.Evidence
On a replay set of discover queries against a saved catalog:
icon, where a package whose name only contains the letters (heroicons) left the top 3. Many multi-word queries that found nothing now find matches.astryx searchtext output is byte-identical apart from the discover line (and its blank line);--jsonis identical for every query.astryx discoveron all 108 replay queries, 108 agree.astryx searchon an installed CLI, A/B against main: median +6 ms (answered) and +7 ms (not answered); first runs +43 to +85 ms (see Design).build,component,hook,template,docsmisses and the unknown-command hint print the same output as before.Scope
Components: CLI discover search, CLI search command
Writing rubric results
spec:AST-051FR4 amendment and FR13:R1 narration: none; FR4 and FR13 state what discover and search do, in the present tense.
R2 research: none in the record; the replay evidence stays in this description.
R3 evidence: the FR4 and FR13 verification rows name test files and cases, not changes.
R4 rejected alternatives: none added.
R5 change references: none.
R6 open questions: none.
Testing
pnpm vitest run --project node packages/cli: new and changed tests pass (discover search leaf: word-by-word, package-description words, identifier spelling, every-word cut, the strong-answer check and its pre-test (word forms, synonyms, typos still found); discover miss names Core's match; saved catalog read without calling a source; search's discover line with and without a saved copy, never calling a source, output identical apart from the line). The remaining failures in this environment (theme build, locale, Yarn PnP) fail the same on main.pnpm -F @astryxdesign/cli typecheck:json-api,typecheck:authoring,sync:api-types,node scripts/check-cli-structure.mjs,pnpm check:knowledge,pnpm check:changesets, eslint and prettier on changed files.