Repository navigation
feat(cli): doctor's kept-cache row prints a short brief; --json keeps the whole message - #12607
Conversation
…on keeps the whole message
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Package | Where | Signature | Usage | |
|---|---|---|---|---|
| + | cli |
./api · Types · type DoctorCheck |
brief?: string | undefined |
import type {DoctorCheck} from '@astryxdesign/cli/api'; const x: DoctorCheck = {brief: …} |
Not run on this PR: add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.
Generated by PR Enrichment workflow | View full report
|
Owner decision (engineering owner, covering this pull request): in default |
|
/approve-spec daea8fd |
There was a problem hiding this comment.
Changes requested. The short kept-cache row matches the approved spec sentence and the focused tests pass, but the new brief field needs its consumer docs and the description needs one correction.
Blocking
packages/cli/api/doctor/doctor.doc.mjs(thedoctor()returns description thatastryx docs cli/api/functions/doctorprints) lists every check field except the new optionalbrief, and AST-017 FR13 requires every response field in the consumer-facing schema docs, so addbriefthere.- The description says the CLI conventions guide lets a long prose field print "a short form", but the guide and cli-surface INV4 allow only its first sentence, so please cite the approved AST-081 FR7 sentence as the basis instead.
Worth a look
- Under Yarn Plug'n'Play the text row is now identical to a plain run and no longer says that the run keeps no catalog; one clause when
summary.pnpis set would keep that fact.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: the text row is short where it was a paragraph of about 2 KB: verified (2,063 to 480 bytes in a packed-CLI run).
- Claim: the row names the folder, entry count and size, the
--jsonpointer and a clear command: verified (doctor.mjs:2851, records test). - Claim: the clear command adds the transpile folder once it exists: verified (
doctor.mjs:2845-2846, records test). - Claim: JSON keeps
messageand adds an optionalbrief, which text prints, with the legend readingmessage (or brief)only then: verified (commands/doctor.mjs:71-73,:101-107). - Claim: ids, statuses, the summary and exit codes do not change: verified (diff, doctor tests).
- Claim:
doctor --jsonlists every kept item: imprecise, it prints the kinds of kept results, not the entries (non-blocking). - Claim: before, the row only said that deleting the folder clears it: verified (base message).
- Claim: the spec record gains one sentence about text output: verified.
- Claim: text stays a projection of JSON and the legend names the printed key: verified.
- Claim: the conventions guide allows a short form: false, it allows the first sentence (blocking).
- Claim:
briefis typed and documented: typed (doctor.type.mjs:22), consumer docs missing (blocking). - Claim: consumer docs ship with the feature: false (blocking).
- Claim:
removeFolderCommandtakes several folders in POSIX and PowerShell form: verified (old-transpile-cache.test.mjs). - Claim: the report shrinks from 5,993 to 4,330 bytes and the row from 1,997 to 281: not repeated on that project; this review measured 6,335 to 4,763 and 2,063 to 480 bytes.
- Claim: a blind A/B with three agents favours the new output: not checkable from the repository.
- Claim: only the legend line and the kept-cache row differ: verified (only
gather-cachesetsbrief). - Claim: the listed tests pass: verified (7 files, 517 passed, 1 skipped).
- Claim: API type verification, knowledge check and Prettier pass: verified.
- Claim: strict typecheck shows no errors in changed files: verified (CI's typecheck job passed at this head).
- Claim: no doc sample quotes this row, no internal context, nothing unrelated: verified.
- File:
.changeset/doctor-kept-cache-brief.md: wording note (non-blocking). - File:
docs/specs/AST-081-global-mode/spec.md: clear (owner-approved for this head). - File:
packages/cli/api/doctor/doctor.mjs: non-blocking notes (Plug'n'Play clause, wording). - File:
packages/cli/api/doctor/doctor.type.mjs: clear. - File:
packages/cli/api/doctor/old-transpile-cache.test.mjs: clear. - File:
packages/cli/clients/cli/commands/doctor.mjs: clear. - File:
packages/cli/test-utils/packed-gather-cache-fixture.mjs: clear. - File:
packages/cli/test/packed-gather-cache.hosted.test.mjs: clear. - File:
packages/cli/test/packed-gather-cache.malformed.test.mjs: clear. - File:
packages/cli/test/packed-gather-cache.records.test.mjs: clear. - File:
packages/cli/api/doctor/doctor.doc.mjs(unchanged): blocking, missingbrief.
| label: 'Kept catalog cache', | ||
| status: 'info', | ||
| message: `search, build, component, template, theme, discover, docs and doctor keep what they gather (search's catalogs, each integration's check results, template discovery's records, the component list and whether the installed Core still matches the stored one, Core's and integrations' components with the doc parts the component matcher scores, Core hooks' declared keywords, integrations' theme records, what theme build checks a theme against in Core's component docs, the JavaScript theme build compiles from a theme's local TypeScript or JSX modules, what theme build finds when it checks a theme's pseudo-class keys and token names, the lookup commands' not-found hint's name summaries, npm's list of the files an integration package packs, the CLI's own docs tree, discover's record of the integrations a project loads and what each adds, and what it searches in its sources' saved copies, which search's discover line reads, and doctor's docs checks and theme-wiring scan) in ${summary.dir} (${summary.entries} ${summary.entries === 1 ? 'entry' : 'entries'}, ${size})${summary.pnp ? ", but not in a run under Yarn Plug'n'Play's loader, such as `yarn astryx`, which gathers every time" : ''}; each is used only while nothing it read has changed, the installed CLI's own files judged by its build id and folder (an upgrade, a reinstall or a copy in another folder changes them; in-place edits aren't supported), and deleting the folder clears it. A lookup command's not-found path may also create the folder, for its name index, and so may an integration package's \`integration check\` of itself, for npm's list. On Linux, when a debug handler is set, runs also keep the locale and time zone here. The folder holds at most ${summary.limitBytes / (1024 * 1024)} MB, dropping oldest entries first; the transpile cache in ${summary.transpiledDir} keeps its copies in ${SUBFOLDERS} subfolders, each holding at most 1/${SUBFOLDERS} of that, and drops the copies made longest ago first.`, | ||
| brief: `${entries} (${size}) in ${summary.dir}. \`${formatCliCommand('doctor --json', ctx.cwd)}\` lists every kept item and the size limits. To clear the caches, run: ${removeFolderCommand(kept)}.`, |
There was a problem hiding this comment.
Non-blocking, two small points on the brief:
- Under Yarn Plug'n'Play (
summary.pnp) this text is now identical to a plain run, soyarn astryx doctorno longer says that the run keeps no catalog. Appending something like "This run keeps none (Yarn Plug'n'Play)." whensummary.pnpis set keeps that fact. doctor --jsonprints the whole message, which names every kind of kept result rather than each entry; "prints the whole message" (the spec sentence's wording) is more accurate than "lists every kept item". The changeset uses the same phrase.
|
/approve-spec cd95478 |
There was a problem hiding this comment.
Approved pending CI: CI has not finished on this head yet. Both earlier requests are addressed: the doctor() docs now describe the optional brief field, and the description cites the approved AST-081 FR7 sentence as the basis for the text form.
The two non-blocking points on the brief still stand as optional follow-ups: a Yarn Plug'n'Play run no longer says in text that it keeps no catalog, and "prints the whole message" would describe doctor --json more exactly than "lists every kept item".
Claims and files checked
Review mode: incremental; reason: none
- Changed rules (0): none.
- Claim: the default text row is short where it was a paragraph of about 2 KB: verified (a 1,879-character message becomes a 410-character brief in a packed-CLI run; records test).
- Claim: the row names the folder, its entry count and size, the
doctor --jsoncommand and the exact clear command: verified (doctor.mjs:2851). - Claim: the clear command also names the transpile folder when it exists: verified (
doctor.mjs:2845-2846, records test). - Claim: JSON keeps the whole
messageand adds an optionalbrief, which text prints in its place under the legendmessage (or brief): verified (commands/doctor.mjs:71-73,:101-108). - Claim: ids, statuses, the summary and exit codes do not change, and
--jsonis identical apart frombrief: verified (the message template is unchanged; doctor tests). - Claim:
doctor --jsonlists every kept item and the size limits: imprecise, it prints the message, which names every kind of kept result rather than each entry (non-blocking). - Claim: agents read the default report in full, and the row was about a third of it: consistent with the repository's agent guide and an earlier packed run (2,063 of 6,335 bytes); not re-measured on the author's project.
- Claim: before, the row only said that deleting the folder clears it: verified (base message).
- Claim: the global-mode record gains the quoted sentence: verified (AST-081 FR7).
- Claim:
briefis its own JSON field and the legend names it, so every printed value maps to a JSON key: verified (cli-surface INV5;commands/doctor.mjs:101-104). - Claim:
briefis in the response type and in the consumer schema docs thatastryx docs cli/api/functions/doctorprints: verified (doctor.type.mjs:22,doctor.doc.mjs:51, docs output at this head). - Claim:
removeFolderCommandtakes a list in POSIX and PowerShell form: verified (old-transpile-cache.test.mjs:99-119). - Claim: the rejected alternatives (shortening
message, first sentence of every row): design rationale, consistent with the code. - Claim: the report shrinks from 5,993 to 4,330 bytes and the row from 1,997 to 281: not repeated on that project; the same direction here.
- Claim: a blind A/B with three agents favours the new output: not checkable from the repository.
- Claim: only the legend line and the kept-cache row differ: verified (only
gather-cachesetsbrief). - Claim: the record edit adds one sentence with no narration or project status: verified.
- Claim: no doc sample quotes this row: verified.
- Claim: public text carries no internal context: verified.
- Claim: the listed tests pass: verified (7 files, 517 passed, 1 skipped; the doc readers, 5 files, 499 passed).
- Claim: API type verification, the knowledge check and Prettier pass: verified; the strict typecheck runs in CI's typecheck job, still running.
- File
.changeset/doctor-kept-cache-brief.md: clear (wording note above). - File
docs/specs/AST-081-global-mode/spec.md: clear (approved for this head). - File
packages/cli/api/doctor/doctor.doc.mjs: clear. - File
packages/cli/api/doctor/doctor.mjs: two non-blocking notes on line 2851. - File
packages/cli/api/doctor/doctor.type.mjs: clear. - File
packages/cli/api/doctor/old-transpile-cache.test.mjs: clear. - File
packages/cli/clients/cli/commands/doctor.mjs: clear. - File
packages/cli/test-utils/packed-gather-cache-fixture.mjs: clear. - File
packages/cli/test/packed-gather-cache.hosted.test.mjs: clear. - File
packages/cli/test/packed-gather-cache.malformed.test.mjs: clear. - File
packages/cli/test/packed-gather-cache.records.test.mjs: clear.
User need
Default
astryx doctortext is read in full by agents on every run. Thegather-cache(kept catalog cache) row had grown to about 2 KB as more kinds of kept results were added, about a third of the whole default report on a typical project. A reader needs only four facts from that row: where the cache is, how much it holds, how to see everything it keeps, and how to clear it.Problem and solution fit
messagestays whole, so no fact is lost.brieffield. Text printsbriefin the message's place. The brief names only the folder, its entry count and size, the command that lists every kept item and the size limits (astryx doctor --json), and the exact command that clears the caches.Current specification
spec:AST-081FR7 says what doctor's cache row names. This PR adds one sentence there, which is the basis for the text form: "Text output prints the row's brief in place of that message: the folder, its entry count and size, thedoctor --jsoncommand that prints the whole message, and the command that removes the catalogs folder and, when it exists, the transpile folder."briefis its own JSON field, and text prints it under a legend that names it (message (or brief)), so every printed value maps to a JSON key (architecture:cli-surfaceINV5).spec:AST-017FR13:briefis in the response type (doctor.type.mjs) and in the consumer schema docs (doctor.doc.mjs, printed byastryx docs cli/api/functions/doctor).Public delta and caller burden
Text, before (one row, 1,997 bytes):
Text, after (281 bytes):
The legend reads
Each check: status, id, label, message (or brief), fixonly when a check has a brief.JSON: additive only.
DoctorCheckgains optionalbrief(typed indoctor.type.mjs, documented indoctor.doc.mjs).message, ids, statuses, the summary, and exit codes are unchanged. Checked by comparingdoctor --jsonbefore and after withbriefremoved: identical.removeFolderCommandnow also takes a list of folders (rm -rf a b; on WindowsRemove-Item -Recurse -Force -LiteralPath a, b).Design and alternatives
A per-check
briefkeeps the data model explicit: the JSON consumer gets the same short form, and the text view needs no special case for one check id.Rejected: shortening
messageitself (JSON would lose facts); printing the first sentence of every check's message (changes every other row and drops facts without naming a route).Evidence
Bytes of default
astryx doctor(text) on a consumer project (the sandbox app's files, Core linked, packed CLI, fresh cache aftersearch,component,template --list,docs,build,theme --list,discover, and a mistypedcomponent; same paths in both):doctorThat is 1,663 B (28%) less per run. Only the legend line and the kept-cache row differ.
Blind A/B: three agents with no context, each given one version of that output and no tools, answered the same five questions.
npx @astryxdesign/[email protected] doctor --jsonrm -rfof the folder and was unsure about the transpile folderrm -rf /home/dev/.cache/astryx/catalogsdocs clidoctor --json, which the row says shows the size limitsResult: the new output is better on the questions about listing and clearing, and the same on the rest. (A first draft of the brief said only "lists every kept item"; its reader answered question 4 with "not stated", so the brief now also says that
--jsonshows the size limits. That reader gave the same answers as above on the other questions.)Writing rubric results
Record changed:
spec:AST-081FR7, one sentence added.R1 narration: none; the sentence states what text output prints.
R2 research: none in the record; the bytes and the A/B live in this description.
R3 evidence: no evidence cell changed.
R4 rejected alternatives: none in the record.
R5 change references: none.
R6 answered open questions: none.
R7 project status: none.
Scope
Components: CLI
doctor(api/doctor/doctor.mjs,clients/cli/commands/doctor.mjs)No doc sample quotes this row, so no doc sample changed.
Testing
vitest --project node:test/packed-gather-cache.records.test.mjs(new: the brief's exact shape, the transpile folder joining the clear command once it exists, text printing the brief and not the message, the legend),test/packed-gather-cache.hosted.test.mjs,test/packed-gather-cache.malformed.test.mjs(their count masks now share one helper that also covers the brief),api/doctor/old-transpile-cache.test.mjs(new: several folders, POSIX and PowerShell),clients/cli/commands/doctor.test.mjs,api/doctor/doctor.test.mjs,clients/cli/commands/text-json-parity.test.mjs: all pass.node .github/scripts/cli-api-types-verify.mjs: pass.tsc --project tsconfig.strict.json: no errors in changed files. The only errors are the missing built@astryxdesign/theme-neutraloutput in two templates on this machine, which this change does not touch.pnpm check:knowledge: aligned. Prettier: clean.