Repository navigation
feat(cli): experimental icon search answers phrases and export names - #12138
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on three new spec:AST-084 FR6 requirements: the word-match tier (score 20) and its ranking, the doubled weight for query words that spell a mapped definition's name, and reading an export name as its words. An engineering owner records it by commenting /approve-spec <full head SHA> on this pull request (the author may, as an engineering owner), or amends or rejects them, and also rules whether word matches order by weight or by set order, since a backup set's icon can now lead the main set's icons at the same score, unlike the unchanged FR6 equal-score sentence, FR8 and the icon-sets guide. The planned rebase onto #12128 and #12131 makes a new head, which needs its own approval. These fixes are needed either way:
- The equal-weight tie-break (
icon-ranking.mjs:471) counts a word carried only as a tag as a named id part, solock buttonrankspadlock(taggedlock) ahead oflock-open, against the stated "fewer id parts the query does not name, then id"; count the id parts no query word names instead. <set>/<id>for a missing multi-part id now suggests word matches instead of the nearest spellings, so the typoarrow-up-rigthno longer suggestsarrow-up-right(detail.mjs:49-62); keep word matches out of this caller, or state the change in FR7.icon addnow lists definitions that share a single word at score 20 (forcircle-check-big:contrast,error,info,stop), which FR13's "definitions that fit it" does not cover (add.mjs:536-571); keep word matches out of this caller, or state it in FR13.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Release note: a query of several words that no icon matches as a whole returns word matches at score 20 — verified (
icon-ranking.mjs:404-408; test aticon.test.mjs:610-629). - Release note: the icon carrying the rarest words comes first — verified (
icon-ranking.mjs:463-470; test aticon.test.mjs:631-643). - Release note: a word that names a definition the set maps an icon for counts twice for that icon — verified (
icon-ranking.mjs:499-511; test aticon.test.mjs:653-666). - Release note: a word no icon carries counts for nothing — verified (only carried words are summed,
icon-ranking.mjs:467). - Release note: an export name such as
SearchIconorChevronDownIconreads as its words — verified (icon-ranking.mjs:270,282-286; test aticon.test.mjs:566-579). - Release note and description: a query that already had an answer keeps it — verified for searches (
icon-ranking.mjs:403-407; the test aticon.test.mjs:668-681passes before and after); the missing-id hints and theicon addlisting do change (findings above). - Description: ties keep set order, then fewer id parts the query does not name, then id — false for the middle key (
icon-ranking.mjs:471). - Description: an icon carries a word through its id parts, its words, or a mapped definition's words, including plural or singular — verified (
icon-ranking.mjs:439-448,519-526; test aticon.test.mjs:645-651). - Description: the weight formula, with mapped-definition name words counted twice — verified (
icon-ranking.mjs:463-470). - Description:
copy button clipboardreturned no matches before and returnsclipboard-copyfirst after — verified (the new test fails on the base and passes on the head). - Description: no new option, field or type;
--limit,--setandmatchCountunchanged — verified (search.mjs:59-77,icon.type.mjs:50). - Description: the listed test run, the strict typecheck and the knowledge check pass — verified (focused tests and the knowledge check rerun; CI typecheck passed).
- Description: four published icon sets answer agent-style requests better — not checkable; the requests and data are not in the pull request.
- Description: writing rubric results for the record edit — verified (present tense, no research, status or references added).
- File
.changeset/icon-search-words.md— clear. - File
docs/specs/AST-084-icon-sets/spec.md— awaits owner approval; its tie-break sentence is not what the code does; the FR6–FR8 verification row names no new case. - File
packages/cli/api/icon/icon.doc.mjs— clear; matches the code. - File
packages/cli/api/icon/icon.test.mjs— clear; no case where the asked word is carried only as a tag. - File
packages/cli/foundation/discovery/icon-ranking.mjs— tie-break at line 471; the new tier reaches the detail and add callers through line 408.
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on the three new spec:AST-084 FR6 requirements: the word-match tier (score 20) and its ranking, the doubled weight for query words that spell a mapped definition's name, and reading an export name as its words. An engineering owner records it by commenting /approve-spec <full head SHA> on this pull request (the author may, as an engineering owner), or amends or rejects them, and also rules whether word matches order by weight or by set order: a backup set's icon can now lead the main set's icons at the same score, unlike the unchanged FR6 equal-score sentence and FR8, and once rebased the same question reaches rankIconIndex() under spec:AST-033 FR2a's index order. The planned rebase onto #12131 makes a new head, which needs its own approval. These fixes are needed either way:
- Miss: Reading an export name at the filler-word step replaces the word as typed, so in a set whose ids keep a compound word whole,
PaperClip iconandLightBulb icon, which findpaperclipandlightbulbat 90 onmain, now return only an unrelated word match at 20 (icon-ranking.mjs:270); rank both the unsplit and the split query and keep the reading with the better answer. <set>/<id>for a missing multi-part id now suggests word matches instead of the nearest spellings, so the typoarrow-up-rigthno longer suggestsarrow-up-right(detail.mjs:49-62); keep word matches out of this caller, or state the change in FR7.- The equal-weight tie-break (
icon-ranking.mjs:471) counts a word carried only as a tag as a named id part, solock buttonrankspadlock(taggedlock) ahead oflock-open, against the stated "fewer id parts the query does not name, then id"; count the id parts no query word names instead. icon addnow lists definitions that share a single word at score 20 (forcircle-check-big:contrast,error,info,stop), which FR13's "lists the definitions that fit it" does not cover (add.mjs:536-571); keep word matches out of this listing, or state it in FR13.- The changeset's "Word matches appear only where nothing answered before" and the description's "The word stage changes no query that already had an answer" are false at this head, because
PaperClip icon,<set>/<id>typos andicon addall answered before and now get word matches; fix those or say what changes for them.
Claims and files checked
Review mode: incremental; reason: none
- changed rules (0): none
- Claim, phrases that nothing matches as a whole now return word matches at score 20 with the words in the reason: verified (
icon-ranking.mjs:404-408,:484-488; test aticon.test.mjs:610-629). - Claim, a word weighs ln((icons + 1) / (carriers + 1)), summed per icon, and words that spell a mapped definition's whole name count twice: verified (
icon-ranking.mjs:463-470,:499-511; tests aticon.test.mjs:631-666). - Claim, ties keep set order, then fewer id parts the query does not name, then id: false for words carried only as tags (
icon-ranking.mjs:471). - Claim, an icon carries a word through an id part, a part of one of its words or a mapped definition's word, singular or plural: verified (
icon-ranking.mjs:439-448,:519-526; test aticon.test.mjs:645-651). - Claim, the word stage changes no query that already had an answer: false (
PaperClip icon,<set>/<id>typos,icon add). - Claim, export names read as their words (
SearchIcon,ChevronDownIconat 90,XMarkIcon): verified (test aticon.test.mjs:566-579). - Claim,
icon arrowUpnow reads asarrow up: verified by readingicon-ranking.mjs:269-286. - Claim, no new option, field or type, and
matchCount,--limitand--setbehave as before: verified (no API rows; option code unchanged). - Claim, queries the existing tiers answer as typed with a whole word, single words that are not export names, and queries whose words no icon carries stay unchanged: verified (
icon-ranking.mjs:403,:408; test aticon.test.mjs:668-681). - Claim,
copy button clipboardreturns the combined icon first, then icons carrying one word: verified (test aticon.test.mjs:610-629). - Claim, measured gains on four published icon sets: not verifiable from the repository.
- Changeset, word matches at 20 with the rarest words first, mapped-definition words counted twice, uncarried words counting for nothing, export names read as words: verified (same evidence as above).
- Changeset, word matches appear only where nothing answered before: false (see findings).
- File
.changeset/icon-search-words.md: finding (false claim). - File
docs/specs/AST-084-icon-sets/spec.md: awaits the owner decision; the verification row names no word-match case (non-blocking). - File
packages/cli/api/icon/icon.doc.mjs: follows the owner decision on ordering. - File
packages/cli/api/icon/icon.test.mjs: clear; missing the export-name, tie and caller cases the fixes need. - File
packages/cli/foundation/discovery/icon-ranking.mjs: findings (export-name split, tie-break, word matches reaching other callers).
…ames keep the better reading; tie counts named id parts
b8cd5cd to
07627e6
Compare
|
/approve-spec 07627e6 Owner decision (icon-set records owner, covering this head): the three AST-084 FR6 additions are approved. (1) A query of several words that nothing else answers lists word matches, ranked first by the number of id parts that no query word names. (2) Query words that spell a mapped definition's name weigh double. (3) An export name is read as its words, both the typed and the split reading are ranked, and the better reading answers (the typed one on a tie). Word matching is opt-in, so near-spelling suggestions for |
|
/approve-spec 07627e6 |
There was a problem hiding this comment.
Changes requested: one fix in the word stage, then this is ready for another look.
- A compound written as an export name drops out of the word stage:
rankWordsreceives only the split reading (packages/cli/foundation/discovery/icon-ranking.mjs:419), so in a set that keepspaperclipwhole,PaperClip buttonanswerspaper-planeandscrollwhilepaperclip buttonanswerspaperclip; ranking the word stage over the words of both readings, with a test for that phrase, fixes it.
The spec:AST-084 FR6 additions carry an engineering owner's approval for this head, and the earlier findings (the unnamed-id-part tie break, word matches in <set>/<id> and icon add, the filler-step split, the changeset wording) are fixed. Optional: one test that <set>/<id> or icon add with a multi-part id still takes no word matches.
Claims and files checked
Review mode: full; reason: rebase
- Changeset: a multi-word query nothing matches returns word matches at score 20 — verified (
icon.test.mjsphrase test; probe ofcopy button clipboard). - Changeset: the project's set first, rarest words first within a set — verified (
icon-ranking.mjs:496-506; set-order and weight tests). - Changeset: words naming a mapped definition count twice, uncarried words count for nothing — verified (
icon-ranking.mjs:482-489,522-534; double-count test). - Changeset: word matches only in the search's own answer and only where nothing answered — verified (
search.mjs:114,170;icon-ranking.mjs:418-419; opt-in test). - Changeset: export names read as words, and an answered query changes only for a better split match — verified (
icon-ranking.mjs:414-417, strict comparison; export-name tests). - Description:
copy button clipboardreturned nothing and now returnsclipboard-copyfirst — verified (probe on base and head). - Description:
PaperClip iconfindspaperclipin a whole-compound set andpaper-clipin a split one — verified (tie test). - Description: no new option, field or type;
matchCount,--limitand--setunchanged — verified (no doc or type change; existing tests pass). - Description: only the finder's search opts into word matches, so
<set>/<id>hints,icon addand set-check hints are unchanged — verified (detail.mjs:50,add.mjs:537,icon-set-checks.mjs:1132; identical hints forarrow-up-rigth). - Description: queries an existing reading answered keep their answers, and plain single words are unchanged — verified for the word stage (
icon-ranking.mjs:410,418); the export-name reading can still win with a higher score, as the description's own bullet says. - Description: an icon carries a word through its id parts, its words or a mapped definition's words — verified (
icon-ranking.mjs:458-467,542-549). - Description: the measured lift on published icon sets and in a project with no set — not checkable here, as no published set is in the repository.
- Description: the listed tests exist and pass — verified (63 files, 1433 tests pass at the head; 8 of the new tests fail on the base).
.changeset/icon-search-words.md— clear.docs/specs/AST-084-icon-sets/spec.md— clear (FR6 additions owner-approved for this head).packages/cli/api/icon/icon.doc.mjs— clear.packages/cli/api/icon/icon.test.mjs— no case for an export name inside a phrase (finding above).packages/cli/api/icon/search/search.mjs— clear.packages/cli/foundation/discovery/icon-ranking.mjs— finding at line 419.
…export-name reading
|
/approve-spec ff39f86 |
There was a problem hiding this comment.
Changes requested: two fixes, then this is ready for another look. The spec:AST-084 FR6 additions are approved for this head, and the earlier word-stage finding is fixed: PaperClip button now puts paperclip first where a set keeps it whole.
- Miss:
exportNameWords(packages/cli/foundation/discovery/icon-ranking.mjs:284-288) re-implements the export-name split thaticonIdOfinfoundation/discovery/icon-set-writer.mjsalready owns and disagrees with it on digits, so export names such asBars3Icon,Cog8ToothIconandSquares2X2Iconmiss their own icons (bars-3,cog-8-tooth,squares-2x2); read each capitalised word throughiconIdOf, drop the copy, and add a digit case to the tests. - Miss: the description says missing-id suggestions for
<set>/<id>are unchanged, but an id written as an export name (<set>/XMark,<set>/ChevronDown) now gets the split reading's matches as its hints, so the description should say so, or the split reading should be opt-in there too.
Claims and files checked
Review mode: full; reason: spec-record
- Claim (changeset): a phrase no icon matches as a whole gets score-20 word matches, the project's set first and the rarest words first within a set: verified (
icon-ranking.mjs:499-514, new tests). - Claim (changeset): a word naming a mapped definition counts twice and a word no icon carries counts for nothing: verified (
icon-ranking.mjs:489-492,525-537). - Claim (changeset): word matches appear only in the search's own answer and only where nothing answered before: verified (
search.mjs:114,search.mjs:170,icon-ranking.mjs:419-420). - Claim (changeset): an export name is also read as its words and an answered query changes only when the split reading scores higher: verified (
icon-ranking.mjs:415-418), apart from the digit split above. - Claim (description): the finder answers nothing today for a phrase with a word no icon carries: verified on the base.
- Claim (description): word weights come from the installed sets, with no word list: verified.
- Claim (description):
SearchIconasks forsearch,PaperClip iconfindspapercliporpaper-clip, andPaperClip buttonleads with either: verified (tests and probes). - Claim (description): a request written as an export name, the form the command prints in its import lines, is read as its words: false for names with digits (first finding).
- Claim (description): FR6 gains the export-name reading, the word step, its score and order, and the FR7 and FR13 exclusion: verified.
- Claim (description): new matches report score 20 with a
words "…"reason: verified (new test). - Claim (description): no new option, field or type,
matchCount,--limitand--setas before, and only the finder's search answer asks for word matches: verified. - Claim (description): answered queries, single words that are not export names,
icon adddefinitions and set-check suggestions are unchanged: verified. - Claim (description): missing-id suggestions for
<set>/<id>are unchanged: false for an id written as an export name (second finding). - Claim (description): mistyped multi-part ids keep identical hints: verified (
arrow-up-rigth,circle-chek,magnifying-glas). - Claim (description): measured gains over four published icon sets and a held-out request set: not checkable here, as the data is not in the repository.
- Claim (description): the listed new tests and testing commands: verified; the new cases fail on the base and pass on the head, the four test files and the knowledge check pass.
- File
.changeset/icon-search-words.md: clear. - File
docs/specs/AST-084-icon-sets/spec.md: clear. - File
packages/cli/api/icon/icon.doc.mjs: clear. - File
packages/cli/api/icon/icon.test.mjs: clear; it has no digit export-name case and no<set>/<id>oricon addcase with a multi-part id. - File
packages/cli/api/icon/search/search.mjs: clear. - File
packages/cli/foundation/discovery/icon-ranking.mjs: first finding.
… icons, digits included
|
/approve-spec 256661f |
There was a problem hiding this comment.
Approved pending CI: the required unit, UI and build jobs are still running on this head. The spec:AST-084 FR6 additions are approved for this head, and both earlier findings are fixed: export names are now read through iconIdOf, so Bars3Icon, Cog8ToothIcon and Squares2X2Icon find their own icons, and the description now says how <set>/<id> suggestions change for an id written as an export name.
- Optional: one
<set>/<id>test with a mistyped multi-part id and one with an export-name id (<set>/XMark) would hold the callers that take no word matches and the new suggestion.
Claims and files checked
Review mode: incremental; reason: none
- Claim (changeset): a query of several words that no icon matches as a whole returns score-20 word matches, the project's set first and rarer words first within a set: verified (
icon-ranking.mjs:422-424,501-511; new tests). - Claim (changeset): a word naming a mapped definition counts twice, and a word no icon carries counts for nothing: verified (
icon-ranking.mjs:487-494,527-539; test). - Claim (changeset): word matches appear only in the search's own answer and only where nothing answered before: verified (
search.mjs:114,170;icon-ranking.mjs:421-422). - Claim (changeset): an export name is also read as its words, and an answered query changes only when the split reading scores higher: verified (
icon-ranking.mjs:415-420; no query the base answered changed across 2,616 cross-library export names). - Claim (description): today a phrase holding a word no icon carries returns an empty list: verified on the base.
- Claim (description): word weights come from the installed sets, with no word list or per-query rule: verified (
rankWords). - Claim (description): an export name is read by the rule that names icons when a set is written, now in a small shared module, so the ranker does not load the writer: verified (
icon-id.mjs:20-40,icon-ranking.mjs:72,286,icon-set-writer.mjs:59,64). - Claim (description):
SearchIconasks forsearchandBars3Iconforbars 3: verified (tests). - Claim (description): the typed reading wins a tie, so
PaperClip iconfindspapercliporpaper-clip, andPaperClip buttonleads with either: verified (tests;LightBulb iconis exercised in the whole-compound set only). - Claim (description): the record edit adds FR6 sentences for the export-name reading, the word step, its score and order, and keeps word matches out of missing-id suggestions and fitting definitions, describing only this code: verified.
- Claim (description): multi-word queries that matched nothing return score-20 matches with a
words "…"reason: verified (test). - Claim (description): a missing
<set>/<id>written as an export name leads with the icon it names, and other missing ids keep their suggestions: verified (probe over Heroicons- and Lucide-shaped sets). - Claim (description): no new option, field or type;
matchCount,--limitand--setas before; only the finder's search answer asks for word matches: verified. - Claim (description): answered queries, single words that are not export names, other missing-id suggestions,
icon adddefinitions and set-check suggestions stay as they were: verified (the word step runs only after every reading is empty; those callers pass nowords; probes). - Claim (description):
copy button clipboardreturnsclipboard-copyfirst, then icons that carry one of the words: verified (probe). - Claim (description): word matches keep set order, then weight, then fewer id parts no query word names, then id, and a word carried only as a tag names no id part: verified (
icon-ranking.mjs:495-511; test). - Claim (description): an icon carries a word through its id parts, its words or a mapped definition's words, plural or singular included: verified (
icon-ranking.mjs:463-472,547-554). - Claim (description): mistyped multi-part ids keep identical suggestions: verified on base and head; which icon leads depends on the set's ids.
- Claim (description): the rejected alternatives and their measured effects: not checkable here, apart from replacing the typed word with its split, whose loss of a whole compound's exact answer an earlier revision showed.
- Claim (description): the writing-rubric results (present-tense FR6 sentences; no research, pull request or project status in the record) and the scope checklist (one capability, nothing unrelated, no internal context): verified against the record diff and every added line.
- Claim (description): measured gains over four published icon sets, a held-out request set and the no-set built-in names: not checkable here, as the data is not in the repository.
- Claim (description): the listed new tests and testing commands: verified; the seven test files pass (270 tests), the structure and knowledge checks pass, and the new digit case fails on the previous revision; the spec-routing lookup was not rerun.
- File
.changeset/icon-search-words.md: clear. - File
docs/specs/AST-084-icon-sets/spec.md: clear. - File
packages/cli/api/icon/icon.doc.mjs: clear. - File
packages/cli/api/icon/icon.test.mjs: clear; it has no<set>/<id>caller case (non-blocking). - File
packages/cli/api/icon/search/search.mjs: clear. - File
packages/cli/foundation/discovery/icon-ranking.mjs: clear. - File
packages/cli/foundation/discovery/icon-set-writer.mjs: clear. - File
packages/cli/foundation/text/icon-id.mjs: clear.
Stack: #12138 → #12187 → #12205
User need
Agents and people ask
astryx experimental iconfor a glyph in a phrase: the glyph plus the control around it, such ascopy button clipboard,info tooltip, orrefresh icon button. Today the finder answers only a query it can match as a whole: the whole phrase, a word start, a partial match, or a query whose every word starts a part of one icon. A phrase that names a glyph next to a word no icon carries (button,tooltip) matches nothing, so the answer is an empty list and the caller gives up or guesses an export name. Agents usually write an icon request as a phrase like this.Problem and solution fit
mapnames the icon for count twice: the map is the set author's own statement of what the icon means. The weights come from the installed sets themselves; there is no word list and no per-query rule.SearchIcon,ChevronDownIcon,Bars3Icon, the formiconprints in its import lines) is one lower-cased token that matches no id. At the step that already leaves out filler words, the query is now also read with each word that holds a capital letter turned into the icon id its export name stands for, by the same rule that names icons when a set is written (SearchIconasks forsearch;Bars3Iconforbars 3). That rule moves from the set writer to a small shared module, so the ranker does not load the writer. The reading whose best match scores higher answers, and the word as typed wins a tie, soPaperClip iconstill finds apaperclipicon where a set keeps the compound whole, and findspaper-clipwhere a set splits it. Word matches read the words of both readings, soPaperClip buttonleads withpapercliporpaper-clipalike.Current specification
docs/specs/AST-084-icon-sets/spec.mdFR6 owns howastryx experimental icon <words>ranks icons. This PR adds sentences to FR6 for the export-name reading, the word-match step, its score and its order, and that FR7's missing-id suggestions and FR13's fitting definitions never include word matches. The record edit describes the code in this PR only.Public delta and caller burden
astryx experimental icon <words>andicon()from@astryxdesign/cli/api(both experimental): a query of several words that matched nothing now returns word matches, withscore: 20and areasonsuch aswords "copy", "clipboard".<set>/<id>written as an export name (<set>/XMark) is read the same way, so its suggestions lead with the icon it names; suggestions for other missing ids are unchanged.matchCount,--limit, and--setbehave as before.rankIcons()(internal) takes{words: true}to ask for word matches; only the finder's search answer passes it.<set>/<id>that is not written as an export name; the definitionsicon addlists; the icon-set checks' suggestions.Before:
astryx experimental icon "copy button clipboard" --set <set>returnsmatches: [].After: it returns
clipboard-copy(or the set's equivalent) first, then the icons that carry only one of the words.Design and alternatives
ln((icons searched + 1) / (icons that carry the word + 1)), summed over the words an icon carries, with the words that spell a mapped definition's whole name counted twice; then the icon whose id holds fewer parts that no query word names (a word carried only as a tag names no id part); then id order.button,tooltip). The weights already ignore words that no icon carries, and a list would need upkeep for every new word.menu,text) then outranked an icon that carries more of the query; counting those words twice keeps the evidence additive.paperclip) lost its exact answer.Evidence
arrow-up-rigth,circle-chek,magnifying-glas) are identical before and after:arrow-up-right,circle-check,magnifying-glassfirst.packages/cli/api/icon/icon.test.mjs: export names (SearchIcon,ChevronDownIcon,XMarkIcon, and with digitsBars3Icon,Cog8ToothIcon,Squares2X2Icon); the better of the split and typed readings (PaperClip icon,LightBulb iconin a set with whole compound ids and in one with split ids), and word matches over the words of both (PaperClip button); a phrase with a word no icon carries; a rare word outweighs a common one; a word carried only as a tag names no id part; set order first among word matches; word matches only with{words: true}; definition words and plural or singular forms count; words that name a mapped definition count twice; queries that existing readings answer, and unanswerable single words, stay as they were.Scope
Components: cli (
foundation/discovery/icon-ranking.mjs,foundation/text/icon-id.mjsmoved fromfoundation/discovery/icon-set-writer.mjs,api/icon/search/search.mjs,api/icon/icon.doc.mjs), AST-084 FR6Testing
npx vitest run --project node packages/cli/api/icon/icon.test.mjs packages/cli/clients/cli/commands/icon.test.mjs packages/cli/foundation/discovery/icon-set-checks.test.mjs packages/cli/foundation/discovery/template-icons.test.mjs packages/cli/api/icon/search/icon-index.test.mjs packages/cli/foundation/discovery/icon-set-writer.test.mjs packages/cli/clients/cli/commands/icon-authoring.test.mjsnode scripts/check-cli-structure.mjspnpm check:knowledgepnpm specs:for --diff origin/mainWriting rubric results
R1 narration: none; the FR6 sentences state what the ranking does, in the present tense.
R2 research: none in the record; the measurement stays in this description.
R3 evidence: the FR6–FR8 verification row names the new cases as states; no basis cell names a pull request.
R4 rejected alternatives: none added to the record.
R5 change references: none.
R6 open questions: none touched.
R7 project status: none.