An open source design system that's fully customizable and agent ready
TypeScript
feat(cli): padding phrases and low-density topics fail integration check --strict (DEC-8) (#7740)
Joey4a2f608f8e14
diff --git a/.changeset/doc-fluff.md b/.changeset/doc-fluff.mdnew file mode 100644index 0000000000..93f6585bf9--- /dev/null+++ b/.changeset/doc-fluff.md@@ -0,0 +1,6 @@+---+'@astryxdesign/cli': patch+---++[feat] `doctor integration docs` (and so `integration check`) lists fluff in a package's prose, in the new `fluff` field: each padding phrase such as "in order to", "note that", or "it is worth noting", with its file line and what to write instead, and each topic of 80 or more prose words in which fewer than half the words carry content. Each is also a `doc_fluff` warning, so `integration check --strict` (new in this release) fails until it is cut; `doctor integration docs` still exits 0. The phrase list and the floor are in the check-your-docs guide (`astryx docs cli/integrations/building-blocks/docs/check-your-docs`). Core's `browser-support` guide loses its one padding phrase, and three of Core's guides (`debug-and-gap-reports`, `sections-and-placement`, `publishing`) are tightened to meet the density floor.+@josephfarinadiff --git a/packages/cli/README.md b/packages/cli/README.mdindex 5d32de4839..e4cd4c7772 100644--- a/packages/cli/README.md+++ b/packages/cli/README.md@@ -419,68 +419,68 @@ Every response has a `type` discriminant. The full set is below (generated from<!-- BEGIN GENERATED: response-types -->-| Type | What `data` carries |-| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| `init.run` | The install receipt: the `mode` (`default` \| `features`), the features run, agent-doc files written, any soft `docsError`, whether theme guidance was emitted, the template outcome (`workflow` \| `created` \| `skipped`) plus its path, and whether the next-steps were emitted. |-| `init.remove` | The removal receipt — returned when --remove-agents is set: `data.removed` is true when a managed agent-docs block was found and removed, and false when there was none to remove. |-| `component.list` | The component catalog grouped by component group (each component's group field): `detail` (the level: names \| compact \| full) and `components`, the grouped map of names entries ({name, package, and optional canonical import for integrations}), brief entries ({name, package, description, import}), or a full ComponentDoc per entry with its package. |-| `component.batch` | The component specialization of the shared `BatchResponse` and `BatchRow` types. An explicit programmatic selector array, or two or more CLI selectors, returns one ordered receipt: `count` plus `results`, one row per selector including duplicates. Every row carries `selector` and `status` (found \| not_found \| ambiguous \| error). A found row carries `result`, the same {type, data} response as one selector. An ambiguous row carries `code`, `error`, and `candidates` ({package, component, kind, installed}). Other failed rows carry `code`, `error`, and optional `suggestions` ({name, reason}). |-| `component.detail` | One component's authored ComponentDoc plus ownership fields (package, the owner; import, the specifier; sourceAvailable, whether source exists) and parentDoc (present when the component is documented inside another component's doc, naming that doc). The envelope's package names the same owner. |-| `component.detail.props` | Just one component's props table (ComponentPropDoc[]). The envelope's package names the npm package that owns the component. |-| `component.detail.source` | One component's source file, as {component, source}. The envelope's package names the npm package that owns the component. |-| `component.detail.showcase` | One component's showcase example, as {component, aspectRatio, source}. The envelope's package names the npm package that owns the component. |-| `component.detail.blocks` | One component's example blocks, as {component, showcase, examples, related} of BlockEntry ({name, package, displayName, description, isShowcase, category}); each block names the package that owns it, and the envelope's package names the component's owner. |-| `docs.list` | All reference-doc topics as DocsListEntry[] ({topic, description, package, replaces?}), in read order; meta.namespaces lists the docs tree's top-level namespaces, and meta.notLoaded each package whose docs did not load. |-| `docs.detail` | One topic's full ReferenceDoc (the JSON read of a topic, --full, --dense, or a topic with one section), with token-ref blocks inlined and each section naming the package that wrote it, plus links ({up, previous, next}: the commands that open the level it sits in and its neighbors there). |-| `docs.index` | One topic's section index, the text read of a topic with more than one section (and --index): the topic's name, title, and description, plus sections, each {id, title, package, summary} (pass the id as the section argument; package is the npm package that wrote the section; summary is the section's one-line summary), and links ({up, previous, next}: the commands that open the level it sits in and its neighbors there). |-| `docs.detail.section` | One ReferenceSection of a topic, found by key or title, with token-ref blocks inlined, plus links ({up, previous, next}: the commands that open its topic index and the sections before and after it). The envelope's package names the npm package that wrote the section. |-| `docs.node` | One node of the docs tree, read by its route: its id, kind, package, title, summary, and breadcrumb, plus a namespace's slots with their children (one level down, each naming its package) or a typed doc's content, and links ({up, previous, next, related}: the commands that open its parent, its neighbors, and the docs it names). |-| `blog.list` | The feed URL plus every post parsed from the RSS feed, each with slug, title, description, date, type, authors, link, and plaintext URL. |-| `blog.detail` | One post's metadata plus the feed URL and the post's full plaintext body. |-| `discover.list` | What the project has, the integrations it loads and the official packages it declares, official packages first (name, category, components, version, a list per other kind they add, and latest when a source knows it); meta.available lists what the project could add, the official packages first, each with the command that adds it, and meta.sources reports each source, the official list last; when it lists no integration it carries meta.configured to tell "nothing configured" from "nothing discovered". |-| `discover.detail` | One package, for an @scope/name or @scope/name@version query: what the shown version adds, whether the project has it, and, when a source knows the package, its versions, latest release, and the command that adds it. |-| `discover.detail.doc` | The validated ComponentDoc for one installed component, for an @scope/name/Component query. |-| `discover.item` | One item that is not an installed component, for an @scope/name/<item> query: its kind, name, package, version, and whether the project has the package. |-| `discover.search` | The echoed query plus every matching item and package across all packages, each with its kind and whether the project has it, even when only one matches; total is set when --limit cut the list. |-| `search` | The echoed query, `matchCount` (total matches, before `limit`), and results, a ranked SearchResultEntry[] bounded by `limit`: each {domain, name, package, score, reason, description, command} (package is the npm package that owns the result), plus import (components, hooks), title, parent (the command that opens the level above), and, for a hit on one section, section (docs), or displayName and kind (templates). |-| `build.help` | The how-to-build-a-page playbook, emitted when no query is given: `playbook: true`, a title, the ordered steps (title, commands, optional returns), the on-system rules, and related lookups. Commands are bare subcommands for the caller to render with its own invocation. |-| `build.kit` | The template to start from and its kit: query, hasResults, matchCount (never a cap), directMatch, start {name, package, command, basis, reason, alternatives, ...} (the start and each alternative name the package that owns the template), pages (search's closest templates), blocks and domain as SearchResultEntry[] (each naming its package), frame and foundation (Core component names), and hint {reason, commands} when thin. |-| `swizzle.list` | The names of swizzlable components discoverable from cwd's @astryxdesign/core. The envelope's package is @astryxdesign/core. |-| `swizzle.copy` | An eject receipt: component name, owning package, output directory, files-copied count, the written file names, whether any file uses StyleX, and, when the owner has an issues URL, feedback ({issuesUrl, ghCommand?}): where to report the gap that led to swizzling. The envelope's package names the same owning package. |-| `gap-report.categories` | The fixed gap category values and human-readable labels; when a loaded integration names its own issues URL, meta.destinations lists every destination ({to, default, issuesUrl}) and meta.ask tells an agent to ask the person. |-| `gap-report.file` | An aggregate receipt: overall status, the selected package, issuesUrl (or null), deliveries in handler order, each {handlerType: project \| integration \| fallback, handler, audience, status, url, message}, and filedCount/routedOnlyCount totals; without --to, when a loaded integration names its own issues URL, destinations and ask as on gap-report.categories. |-| `template.list` | The effective discovered TemplateListEntry[] for pages and blocks. A winning replacement entry includes optional `replaces`, naming the Core id omitted from the default list. |-| `template.show` | The resolved template's source, exactly as a copy writes it, plus its description, kind, the component names it composes, and demoMediaReplaced (how many Astryx demo media references were replaced with placeholders for you to swap for your own media). |-| `template.skeleton` | A layout skeleton (structural tags with spatial annotations) plus the template's description and the components it composes. The envelope's package names the npm package that owns the template. |-| `template.copy` | A scaffold receipt: template id, output directory, written file name, file count, demoMediaReplaced (how many Astryx demo media references were replaced with placeholders), notes (setup notes naming what the template needs that the project lacks — missing packages, missing StyleX compiler; empty when satisfied), missingPackages (external package names the template imports that are not in the project), and installCommand (a ready-to-run install command with the detected package manager and workspace version ranges; null when nothing is missing, or when several lockfiles leave the package manager undetermined). The envelope's package names the npm package that owns the template. |-| `template.cdn` | A write receipt for the no-build-step CDN starter page: the path (relative to cwd), the Astryx version every CDN URL was pinned to, whether it was written, and the reason it was not. `exists` when a file was already there, which is a success. |-| `hook.list` | The hook catalog grouped by category: `detail` (the level: names \| compact \| full) and `components`, the grouped map of hook names, brief entries, or a full HookDoc per entry. The envelope's package is @astryxdesign/core, the only package that ships hooks. |-| `hook.detail` | One hook's full authored HookDoc. The envelope's package is @astryxdesign/core. |-| `hook.detail.params` | Just one hook's parameters table (HookParamDoc[]). The envelope's package is @astryxdesign/core. |-| `theme.build` | A theme build receipt: name, tokenCount and componentCount (override counts), sizeKB, the written outputs {css, cssDts, js, dts, and variantsDts when applicable}, warnings (defects to fix), and notices (advisories about a correct theme, such as a named font it does not load). |-| `theme.build.check` | The --check receipt: theme name, an upToDate flag, the stale outputs (each {path, reason: missing \| outdated}), and the full list of checked paths. Writes nothing. |-| `theme.build.batch` | Several themes built in one invocation: `count` plus one {file, receipt} per theme in argument order, where receipt is that theme's theme.build (or theme.build.check) envelope, or null when it produced no CSS. |-| `theme.list` | Every bundled, installed package, and local theme as a ThemeListEntry[]. Each entry has slug, displayName, description, maintained, owner package or local root, source, added, and default fields. Optional meta.unmigratedCopies names earlier descriptor-less copies, their missing descriptor, and the upgrade command; those copies are not data entries. |-| `theme.app` | The app theme record after add, remove, or use. It includes every added theme and its built imports, the default slug, generated module path, and the command change. After add, the envelope package names the npm package that owns the added theme; a local theme has none. |-| `theme.eject` | A local source-fork receipt with the resolved slug, displayName, source theme maintained flag, source-selector package, outputDir, source entry, exportName, and every file written, including the descriptor. The written local descriptor always uses maintained: false. |-| `theme.template` | A write receipt for the annotated theme template: the path (relative to cwd), whether it was written, and the reason it was not. `exists` when a file was already there, which is a success. |-| `theme.targets` | The whole themeable surface: the echoed filter, componentCount, and targets, one per theming target — {key, className, component, props, states}, where props and states are its legal override keys. |-| `theme.palette.generate` | An author-reviewable OKLCH palette candidate, its reproducibility receipt, summary counts, and optional candidate/receipt file-write result. |-| `upgrade.list` | Every available codemod, oldest→newest, as {name, package, title, version, optional}; returned for --list without running anything. |-| `upgrade.registry` | The copied-composition receipt for --registry: applied, ok, the counts (found, current, wouldUpdate, updated, wouldMerge, merged, wouldRefreshReceipt, receiptsRefreshed, conflicts, missing, invalid, failed), and items. |-| `upgrade.status` | A short-circuit outcome with no codemods run (up_to_date, no_codemods, or config_fixable), each carrying the agent-docs summary. no_codemods and config_fixable carry cliBehindCore ({cliVersion, command}) when the installed Core is newer than the CLI, which then has no codemods for the releases after its own version. |-| `upgrade.run` | The run receipt: from/to versions, codemod count, integrations processed, the agent-docs summary, sourcePathFound (false when the resolved source directory does not exist, so no source file was read), and (apply mode) filesChanged, transformsApplied, and per-codemod errors. When the installed Core is newer than the CLI, it also carries cliBehindCore ({cliVersion, command}): codemods for the releases after cliVersion did not run. |-| `manifest` | The CLI capability manifest: name, version, apiVersion, description, globalOptions, commands (each name, description, arguments, options, json, aliases?, responseTypes?, examples?, exitCodes? as [{code, when}], subcommands?), jsonSupported, and the flat responseTypes index. |-| `help` | Help, in one of two shapes. A bare `astryx --json` returns the root manifest: name, version, commands (the command names), jsonSupported, and manifest (the full payload `astryx manifest --json` returns). `--help --json` on any command, or `astryx help [command] --json`, returns that command's help: command, description, usage, options (each flags, description, and defaultValue and choices when set), and subcommands (each name and description). data.manifest marks the first shape; data.usage marks the second. |-| `version` | The CLI version, for `astryx --version --json`: {version}. |-| `doctor` | The health-check report: `checks` (each with id, label, status: pass \| warn \| fail \| info, a message, and an optional fix, always present on warn and fail) plus a `summary` of counts per status. |-| `integration.add` | A contribution-writer receipt: kind, name, optional root {path, created}, integration-manifest path, every affected project-relative path, written, and dryRun. |-| `integration.pack-check` | The packed-package check: name, version, packable, tarball {filename, fileCount, size, unpackedSize} or null, inventory {manifest, roots [{kind, path, expectedFiles, missingFiles, complete}], expectedFiles, packedFiles}, contributions {local, packed}, each null or {themes [{slug, exportName}], components, templates [{id, type, name}], codemods [{version, id}], docs, agentDocsAppend}, and issues [{code, severity, message}]. |-| `integration.validate` | The validation result: validated (false when nothing was validated: with no package.json the issues list carries one no_package error so the command exits 1, and with a package.json but no integration manifest the issues list is empty and proves nothing), the package name and version (both null when validated is false) plus issues, an AstryxIntegrationIssue[] of {code, severity: warning \| error, message}. When the manifest loads, docTypes checks each doc against its published authoring type: status (checked \| skipped), reason, typescript, docs, findings (all warnings, each naming the field and a fix), unchecked, and fixtures (test fixture docs not checked). |-| `integration.template-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and non-blocking Core template-id conflicts as {id, severity: warning, integrationPackage, integrationType, integrationName, coreMatches, message, command}. |-| `integration.component-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and non-blocking conflicts where an integration component name is also owned by Core; each conflict includes the exact package-qualified command. When the manifest loads and declares a components root, propDrift compares documented props with the TypeScript props: status (checked \| skipped), reason, typescript, components, typesCompared, typesSkipped, findings (all warnings), unchecked, typesNotCompared, and propsNotChecked. |-| `integration.doc-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` \| `error`) and `relationship` (`replaces` \| `extends` \| `accidental`). copiedPassages lists each pair of topics that repeat 10 or more words of prose word for word: topic, section, otherTopic, otherOwner (package \| core), words, passages, owner (the topic that should keep the text), text (the passage as the topic writes it), line (where the copy starts in the topic to change, or null), and message (the exact replacement); each is also a copied_passage warning in issues. |-| `integration.check` | Every source check of an integration package in one result: validated (false when no integration manifest was found, so nothing was checked), the package name and version, strict, and checks, one entry per check (validate, components, templates, docs), each with check, errors, warnings, skipped, failed, and response, the envelope that check returns on its own. The totals are errors, warnings, and skipped; unchecked counts what the checks could not compare. With --strict, failures lists each warning and each piece of skipped work again as an error, in the issue format the checks use; it is empty without --strict. failed decides the exit code. |+| Type | What `data` carries |+| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |+| `init.run` | The install receipt: the `mode` (`default` \| `features`), the features run, agent-doc files written, any soft `docsError`, whether theme guidance was emitted, the template outcome (`workflow` \| `created` \| `skipped`) plus its path, and whether the next-steps were emitted. |+| `init.remove` | The removal receipt — returned when --remove-agents is set: `data.removed` is true when a managed agent-docs block was found and removed, and false when there was none to remove. |+| `component.list` | The component catalog grouped by component group (each component's group field): `detail` (the level: names \| compact \| full) and `components`, the grouped map of names entries ({name, package, and optional canonical import for integrations}), brief entries ({name, package, description, import}), or a full ComponentDoc per entry with its package. |+| `component.batch` | The component specialization of the shared `BatchResponse` and `BatchRow` types. An explicit programmatic selector array, or two or more CLI selectors, returns one ordered receipt: `count` plus `results`, one row per selector including duplicates. Every row carries `selector` and `status` (found \| not_found \| ambiguous \| error). A found row carries `result`, the same {type, data} response as one selector. An ambiguous row carries `code`, `error`, and `candidates` ({package, component, kind, installed}). Other failed rows carry `code`, `error`, and optional `suggestions` ({name, reason}). |+| `component.detail` | One component's authored ComponentDoc plus ownership fields (package, the owner; import, the specifier; sourceAvailable, whether source exists) and parentDoc (present when the component is documented inside another component's doc, naming that doc). The envelope's package names the same owner. |+| `component.detail.props` | Just one component's props table (ComponentPropDoc[]). The envelope's package names the npm package that owns the component. |+| `component.detail.source` | One component's source file, as {component, source}. The envelope's package names the npm package that owns the component. |+| `component.detail.showcase` | One component's showcase example, as {component, aspectRatio, source}. The envelope's package names the npm package that owns the component. |+| `component.detail.blocks` | One component's example blocks, as {component, showcase, examples, related} of BlockEntry ({name, package, displayName, description, isShowcase, category}); each block names the package that owns it, and the envelope's package names the component's owner. |+| `docs.list` | All reference-doc topics as DocsListEntry[] ({topic, description, package, replaces?}), in read order; meta.namespaces lists the docs tree's top-level namespaces, and meta.notLoaded each package whose docs did not load. |+| `docs.detail` | One topic's full ReferenceDoc (the JSON read of a topic, --full, --dense, or a topic with one section), with token-ref blocks inlined and each section naming the package that wrote it, plus links ({up, previous, next}: the commands that open the level it sits in and its neighbors there). |+| `docs.index` | One topic's section index, the text read of a topic with more than one section (and --index): the topic's name, title, and description, plus sections, each {id, title, package, summary} (pass the id as the section argument; package is the npm package that wrote the section; summary is the section's one-line summary), and links ({up, previous, next}: the commands that open the level it sits in and its neighbors there). |+| `docs.detail.section` | One ReferenceSection of a topic, found by key or title, with token-ref blocks inlined, plus links ({up, previous, next}: the commands that open its topic index and the sections before and after it). The envelope's package names the npm package that wrote the section. |+| `docs.node` | One node of the docs tree, read by its route: its id, kind, package, title, summary, and breadcrumb, plus a namespace's slots with their children (one level down, each naming its package) or a typed doc's content, and links ({up, previous, next, related}: the commands that open its parent, its neighbors, and the docs it names). |+| `blog.list` | The feed URL plus every post parsed from the RSS feed, each with slug, title, description, date, type, authors, link, and plaintext URL. |+| `blog.detail` | One post's metadata plus the feed URL and the post's full plaintext body. |+| `discover.list` | What the project has, the integrations it loads and the official packages it declares, official packages first (name, category, components, version, a list per other kind they add, and latest when a source knows it); meta.available lists what the project could add, the official packages first, each with the command that adds it, and meta.sources reports each source, the official list last; when it lists no integration it carries meta.configured to tell "nothing configured" from "nothing discovered". |+| `discover.detail` | One package, for an @scope/name or @scope/name@version query: what the shown version adds, whether the project has it, and, when a source knows the package, its versions, latest release, and the command that adds it. |+| `discover.detail.doc` | The validated ComponentDoc for one installed component, for an @scope/name/Component query. |+| `discover.item` | One item that is not an installed component, for an @scope/name/<item> query: its kind, name, package, version, and whether the project has the package. |+| `discover.search` | The echoed query plus every matching item and package across all packages, each with its kind and whether the project has it, even when only one matches; total is set when --limit cut the list. |+| `search` | The echoed query, `matchCount` (total matches, before `limit`), and results, a ranked SearchResultEntry[] bounded by `limit`: each {domain, name, package, score, reason, description, command} (package is the npm package that owns the result), plus import (components, hooks), title, parent (the command that opens the level above), and, for a hit on one section, section (docs), or displayName and kind (templates). |+| `build.help` | The how-to-build-a-page playbook, emitted when no query is given: `playbook: true`, a title, the ordered steps (title, commands, optional returns), the on-system rules, and related lookups. Commands are bare subcommands for the caller to render with its own invocation. |+| `build.kit` | The template to start from and its kit: query, hasResults, matchCount (never a cap), directMatch, start {name, package, command, basis, reason, alternatives, ...} (the start and each alternative name the package that owns the template), pages (search's closest templates), blocks and domain as SearchResultEntry[] (each naming its package), frame and foundation (Core component names), and hint {reason, commands} when thin. |+| `swizzle.list` | The names of swizzlable components discoverable from cwd's @astryxdesign/core. The envelope's package is @astryxdesign/core. |+| `swizzle.copy` | An eject receipt: component name, owning package, output directory, files-copied count, the written file names, whether any file uses StyleX, and, when the owner has an issues URL, feedback ({issuesUrl, ghCommand?}): where to report the gap that led to swizzling. The envelope's package names the same owning package. |+| `gap-report.categories` | The fixed gap category values and human-readable labels; when a loaded integration names its own issues URL, meta.destinations lists every destination ({to, default, issuesUrl}) and meta.ask tells an agent to ask the person. |+| `gap-report.file` | An aggregate receipt: overall status, the selected package, issuesUrl (or null), deliveries in handler order, each {handlerType: project \| integration \| fallback, handler, audience, status, url, message}, and filedCount/routedOnlyCount totals; without --to, when a loaded integration names its own issues URL, destinations and ask as on gap-report.categories. |+| `template.list` | The effective discovered TemplateListEntry[] for pages and blocks. A winning replacement entry includes optional `replaces`, naming the Core id omitted from the default list. |+| `template.show` | The resolved template's source, exactly as a copy writes it, plus its description, kind, the component names it composes, and demoMediaReplaced (how many Astryx demo media references were replaced with placeholders for you to swap for your own media). |+| `template.skeleton` | A layout skeleton (structural tags with spatial annotations) plus the template's description and the components it composes. The envelope's package names the npm package that owns the template. |+| `template.copy` | A scaffold receipt: template id, output directory, written file name, file count, demoMediaReplaced (how many Astryx demo media references were replaced with placeholders), notes (setup notes naming what the template needs that the project lacks — missing packages, missing StyleX compiler; empty when satisfied), missingPackages (external package names the template imports that are not in the project), and installCommand (a ready-to-run install command with the detected package manager and workspace version ranges; null when nothing is missing, or when several lockfiles leave the package manager undetermined). The envelope's package names the npm package that owns the template. |+| `template.cdn` | A write receipt for the no-build-step CDN starter page: the path (relative to cwd), the Astryx version every CDN URL was pinned to, whether it was written, and the reason it was not. `exists` when a file was already there, which is a success. |+| `hook.list` | The hook catalog grouped by category: `detail` (the level: names \| compact \| full) and `components`, the grouped map of hook names, brief entries, or a full HookDoc per entry. The envelope's package is @astryxdesign/core, the only package that ships hooks. |+| `hook.detail` | One hook's full authored HookDoc. The envelope's package is @astryxdesign/core. |+| `hook.detail.params` | Just one hook's parameters table (HookParamDoc[]). The envelope's package is @astryxdesign/core. |+| `theme.build` | A theme build receipt: name, tokenCount and componentCount (override counts), sizeKB, the written outputs {css, cssDts, js, dts, and variantsDts when applicable}, warnings (defects to fix), and notices (advisories about a correct theme, such as a named font it does not load). |+| `theme.build.check` | The --check receipt: theme name, an upToDate flag, the stale outputs (each {path, reason: missing \| outdated}), and the full list of checked paths. Writes nothing. |+| `theme.build.batch` | Several themes built in one invocation: `count` plus one {file, receipt} per theme in argument order, where receipt is that theme's theme.build (or theme.build.check) envelope, or null when it produced no CSS. |+| `theme.list` | Every bundled, installed package, and local theme as a ThemeListEntry[]. Each entry has slug, displayName, description, maintained, owner package or local root, source, added, and default fields. Optional meta.unmigratedCopies names earlier descriptor-less copies, their missing descriptor, and the upgrade command; those copies are not data entries. |+| `theme.app` | The app theme record after add, remove, or use. It includes every added theme and its built imports, the default slug, generated module path, and the command change. After add, the envelope package names the npm package that owns the added theme; a local theme has none. |+| `theme.eject` | A local source-fork receipt with the resolved slug, displayName, source theme maintained flag, source-selector package, outputDir, source entry, exportName, and every file written, including the descriptor. The written local descriptor always uses maintained: false. |+| `theme.template` | A write receipt for the annotated theme template: the path (relative to cwd), whether it was written, and the reason it was not. `exists` when a file was already there, which is a success. |+| `theme.targets` | The whole themeable surface: the echoed filter, componentCount, and targets, one per theming target — {key, className, component, props, states}, where props and states are its legal override keys. |+| `theme.palette.generate` | An author-reviewable OKLCH palette candidate, its reproducibility receipt, summary counts, and optional candidate/receipt file-write result. |+| `upgrade.list` | Every available codemod, oldest→newest, as {name, package, title, version, optional}; returned for --list without running anything. |+| `upgrade.registry` | The copied-composition receipt for --registry: applied, ok, the counts (found, current, wouldUpdate, updated, wouldMerge, merged, wouldRefreshReceipt, receiptsRefreshed, conflicts, missing, invalid, failed), and items. |+| `upgrade.status` | A short-circuit outcome with no codemods run (up_to_date, no_codemods, or config_fixable), each carrying the agent-docs summary. no_codemods and config_fixable carry cliBehindCore ({cliVersion, command}) when the installed Core is newer than the CLI, which then has no codemods for the releases after its own version. |+| `upgrade.run` | The run receipt: from/to versions, codemod count, integrations processed, the agent-docs summary, sourcePathFound (false when the resolved source directory does not exist, so no source file was read), and (apply mode) filesChanged, transformsApplied, and per-codemod errors. When the installed Core is newer than the CLI, it also carries cliBehindCore ({cliVersion, command}): codemods for the releases after cliVersion did not run. |+| `manifest` | The CLI capability manifest: name, version, apiVersion, description, globalOptions, commands (each name, description, arguments, options, json, aliases?, responseTypes?, examples?, exitCodes? as [{code, when}], subcommands?), jsonSupported, and the flat responseTypes index. |+| `help` | Help, in one of two shapes. A bare `astryx --json` returns the root manifest: name, version, commands (the command names), jsonSupported, and manifest (the full payload `astryx manifest --json` returns). `--help --json` on any command, or `astryx help [command] --json`, returns that command's help: command, description, usage, options (each flags, description, and defaultValue and choices when set), and subcommands (each name and description). data.manifest marks the first shape; data.usage marks the second. |+| `version` | The CLI version, for `astryx --version --json`: {version}. |+| `doctor` | The health-check report: `checks` (each with id, label, status: pass \| warn \| fail \| info, a message, and an optional fix, always present on warn and fail) plus a `summary` of counts per status. |+| `integration.add` | A contribution-writer receipt: kind, name, optional root {path, created}, integration-manifest path, every affected project-relative path, written, and dryRun. |+| `integration.pack-check` | The packed-package check: name, version, packable, tarball {filename, fileCount, size, unpackedSize} or null, inventory {manifest, roots [{kind, path, expectedFiles, missingFiles, complete}], expectedFiles, packedFiles}, contributions {local, packed}, each null or {themes [{slug, exportName}], components, templates [{id, type, name}], codemods [{version, id}], docs, agentDocsAppend}, and issues [{code, severity, message}]. |+| `integration.validate` | The validation result: validated (false when nothing was validated: with no package.json the issues list carries one no_package error so the command exits 1, and with a package.json but no integration manifest the issues list is empty and proves nothing), the package name and version (both null when validated is false) plus issues, an AstryxIntegrationIssue[] of {code, severity: warning \| error, message}. When the manifest loads, docTypes checks each doc against its published authoring type: status (checked \| skipped), reason, typescript, docs, findings (all warnings, each naming the field and a fix), unchecked, and fixtures (test fixture docs not checked). |+| `integration.template-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and non-blocking Core template-id conflicts as {id, severity: warning, integrationPackage, integrationType, integrationName, coreMatches, message, command}. |+| `integration.component-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and non-blocking conflicts where an integration component name is also owned by Core; each conflict includes the exact package-qualified command. When the manifest loads and declares a components root, propDrift compares documented props with the TypeScript props: status (checked \| skipped), reason, typescript, components, typesCompared, typesSkipped, findings (all warnings), unchecked, typesNotCompared, and propsNotChecked. |+| `integration.doc-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` \| `error`) and `relationship` (`replaces` \| `extends` \| `accidental`). copiedPassages lists each pair of topics that repeat 10 or more words of prose word for word: topic, section, otherTopic, otherOwner (package \| core), words, passages, owner (the topic that should keep the text), text (the passage as the topic writes it), line (where the copy starts in the topic to change, or null), and message (the exact replacement); each is also a copied_passage warning in issues. fluff lists padding phrases and low-density topics: topic, kind (phrase \| density), phrase, section, file, line, density, and message (what to cut or write instead); each is also a doc_fluff warning in issues. |+| `integration.check` | Every source check of an integration package in one result: validated (false when no integration manifest was found, so nothing was checked), the package name and version, strict, and checks, one entry per check (validate, components, templates, docs), each with check, errors, warnings, skipped, failed, and response, the envelope that check returns on its own. The totals are errors, warnings, and skipped; unchecked counts what the checks could not compare. With --strict, failures lists each warning and each piece of skipped work again as an error, in the issue format the checks use; it is empty without --strict. failed decides the exit code. |<!-- END GENERATED: response-types --><!-- Generated by scripts/generate-cli-readme.mjs from the response-types EnumDoc. Run `pnpm -F @astryxdesign/cli readme`. -->diff --git a/packages/cli/api/integration/_adapter.mjs b/packages/cli/api/integration/_adapter.mjsindex 5f7a71b586..9b3fc1b63d 100644--- a/packages/cli/api/integration/_adapter.mjs+++ b/packages/cli/api/integration/_adapter.mjs@@ -16,6 +16,7 @@ import {} from '../../foundation/discovery/component-discovery.mjs';import {comparePropDocs} from '../../foundation/discovery/prop-drift.mjs';import {findCopiedPassages} from '../../foundation/discovery/copied-passages.mjs';+import {findFluff} from '../../foundation/discovery/doc-fluff.mjs';/*** Each component doc's props compared with the component's TypeScript props,@@ -65,3 +66,15 @@ export async function integrationPropDrift(integration, cwd) {export function integrationCopiedPassages(discovered) {return findCopiedPassages(discovered);}++/**+ * Padding phrases and low-density topics in a package's prose+ * (architecture:cli-surface DEC-8). Reads the package's topics, and Core's+ * guides for the density median a finding names.+ *+ * @param {Parameters<typeof findFluff>[0]} discovered the package's docs, as+ * discoverIntegrationDocs returns them+ */+export function integrationFluff(discovered) {+ return findFluff(discovered);+}diff --git a/packages/cli/api/integration/authoring-checks.mjs b/packages/cli/api/integration/authoring-checks.mjsindex 7189dc2c15..ea2986c5f7 100644--- a/packages/cli/api/integration/authoring-checks.mjs+++ b/packages/cli/api/integration/authoring-checks.mjs@@ -29,7 +29,11 @@ import {discoverOwnedComponents,} from '../../foundation/discovery/component-discovery.mjs';import {loadComponentReplacements} from '../component/_adapter.mjs';-import {integrationCopiedPassages, integrationPropDrift} from './_adapter.mjs';+import {+ integrationCopiedPassages,+ integrationFluff,+ integrationPropDrift,+} from './_adapter.mjs';import {discoverBuiltinTopics,discoverIntegrationDocs,@@ -325,10 +329,20 @@ export async function integrationDocConflicts(pkg, options = {}) {/** @type {import('./authoring-checks.type.mjs').CopiedPassage[]} */const copiedPassages = [];+ /** @type {import('./authoring-checks.type.mjs').DocFluff[]} */+ const fluff = [];if (!resolved.integration?.docs || name == null) {return {type: 'integration.doc-conflicts',- data: {validated, name, version, findings: [], copiedPassages, issues},+ data: {+ validated,+ name,+ version,+ findings: [],+ copiedPassages,+ fluff,+ issues,+ },};}@@ -427,10 +441,16 @@ export async function integrationDocConflicts(pkg, options = {}) {for (const {message} of copiedPassages) {issues.push({code: 'copied_passage', severity: 'warning', message});}+ // Docs should be dense: padding phrases and mostly-glue topics, listed+ // and warned about the same way (DEC-8).+ fluff.push(...(await integrationFluff(discovered)));+ for (const {message} of fluff) {+ issues.push({code: 'doc_fluff', severity: 'warning', message});+ }}return {type: 'integration.doc-conflicts',- data: {validated, name, version, findings, copiedPassages, issues},+ data: {validated, name, version, findings, copiedPassages, fluff, issues},};}diff --git a/packages/cli/api/integration/authoring-checks.test.mjs b/packages/cli/api/integration/authoring-checks.test.mjsindex 1842344457..0a407eb139 100644--- a/packages/cli/api/integration/authoring-checks.test.mjs+++ b/packages/cli/api/integration/authoring-checks.test.mjs@@ -888,3 +888,153 @@ describe('integrationDocConflicts copied passages and extensions', () => {expect(found[0].message).not.toContain('{@link');});});++describe('integrationDocConflicts fluff', () => {+ const fluff = (/** @type {any} */ result) => result.data.fluff;++ it('lists each padding phrase with its line and what to write instead', async () => {+ writeTopics([+ {+ name: 'acme-setup',+ text: 'In order to start, run the setup command once.',+ },+ ]);++ const result = await integrationDocConflicts(undefined, {cwd: tmpDir});+ const [hit, ...rest] = fluff(result);++ expect(rest).toEqual([]);+ expect(result.data.issues).toEqual([+ {code: 'doc_fluff', severity: 'warning', message: hit.message},+ ]);+ expect(hit).toMatchObject({+ topic: 'acme-setup',+ kind: 'phrase',+ phrase: 'in order to',+ section: 'Overview',+ file: expect.stringMatching(/acme-setup\.doc\.mjs$/),+ line: 1,+ density: null,+ });+ expect(hit.message).toContain('Write "to" instead.');+ });++ it('finds each line within its own string, not in code or another field', async () => {+ writeTopics([]);+ fs.writeFileSync(+ path.join(tmpDir, 'docs', 'acme-lines.doc.mjs'),+ [+ 'export default {',+ " type: 'generic',",+ " name: 'acme-lines',",+ " title: 'Fixture',",+ " description: 'Build the package in order to publish it.',",+ " sections: [{title: 'Overview', content: [",+ " {type: 'code', lang: 'text', code: 'in order to build'},",+ " {type: 'prose', text: 'Note that the build runs once per package and writes its output.'},",+ " {type: 'prose', text: 'Run the build in order to refresh the generated files for the docs.'},",+ ' ]}],',+ '};',+ '',+ ].join('\n'),+ );++ const found = fluff(+ await integrationDocConflicts(undefined, {cwd: tmpDir}),+ ).map((/** @type {any} */ each) => [each.phrase, each.line]);++ expect(found).toEqual([+ ['in order to', 5],+ ['note that', 8],+ ['in order to', 9],+ ]);+ });++ it('gives each use its own line in multi-line and concatenated strings', async () => {+ writeTopics([]);+ fs.writeFileSync(+ path.join(tmpDir, 'docs', 'acme-multi.doc.mjs'),+ [+ 'export default {',+ " type: 'generic',",+ " name: 'acme-multi',",+ " title: 'Fixture',",+ " description: 'Fixture topic.',",+ " sections: [{title: 'Overview', content: [",+ " {type: 'prose', text: `Build the package first.",+ 'Run the build in order to refresh the files.',+ 'Run it again in order to check them.`},',+ " {type: 'prose', text: 'Publishing reads the built files ' +",+ " 'in order to ship them, so build before you publish.'},",+ ' ]}],',+ '};',+ '',+ ].join('\n'),+ );++ const found = fluff(+ await integrationDocConflicts(undefined, {cwd: tmpDir}),+ ).map((/** @type {any} */ each) => each.line);++ expect(found).toEqual([8, 9, 11]);+ });++ it('finds the line of strings that open or end with code, links, quotes or escapes', async () => {+ writeTopics([]);+ fs.writeFileSync(+ path.join(tmpDir, 'docs', 'acme-shapes.doc.mjs'),+ [+ 'export default {',+ " type: 'generic',",+ " name: 'acme-shapes',",+ " title: 'Fixture',",+ " description: 'Fixture topic.',",+ " sections: [{title: 'Overview', content: [",+ " {type: 'prose', text: '`build` runs first, in order to check it.'},",+ " {type: 'prose', text: '{@link generic:acme-shapes} runs it in order to ship.'},",+ " {type: 'prose', text: '\"Build\" is a step you run in order to test (and ship).'},",+ " {type: 'prose', text: '(Build) runs it once in order to publish the app\\'s files.'},",+ " {type: 'prose', text: 'Run the build in order to check the files.'},",+ " {type: 'prose', text: 'Run the build in order to publish the files.'},",+ ' ]}],',+ '};',+ '',+ ].join('\n'),+ );++ const found = fluff(+ await integrationDocConflicts(undefined, {cwd: tmpDir}),+ ).map((/** @type {any} */ each) => each.line);++ expect(found).toEqual([7, 8, 9, 10, 11, 12]);+ });++ it('lists a long topic that is mostly glue, and not a dense one', async () => {+ const glue = Array.from(+ {length: 12},+ () =>+ 'So that is why it is the one that you would want to use if you can.',+ ).join(' ');+ const dense = Array.from(+ {length: 8},+ (_, i) =>+ `Name codemod folder ${i} after the Core version whose upgrade runs it.`,+ ).join(' ');+ writeTopics([+ {name: 'acme-glue', text: glue},+ {name: 'acme-dense', text: dense},+ ]);++ const found = fluff(+ await integrationDocConflicts(undefined, {cwd: tmpDir}),+ );++ expect(found.map((/** @type {any} */ each) => each.topic)).toEqual([+ 'acme-glue',+ ]);+ expect(found[0]).toMatchObject({kind: 'density', phrase: null});+ expect(found[0].density).toBeLessThan(0.5);+ expect(found[0].message).toContain("Core's guides have a median of");+ expect(found[0].message).toContain('under the 50% floor');+ });+});diff --git a/packages/cli/api/integration/authoring-checks.type.mjs b/packages/cli/api/integration/authoring-checks.type.mjsindex 2f9186f892..67b0100d94 100644--- a/packages/cli/api/integration/authoring-checks.type.mjs+++ b/packages/cli/api/integration/authoring-checks.type.mjs@@ -68,6 +68,24 @@* @property {string} message what is repeated, and the exact fix: the passage in `topic` replaced by a link to `owner`*/+/**+ * Fluff in a topic's prose: a padding phrase (`kind: 'phrase'`, with the+ * phrase, its section, and the file line where it was found), or a topic of+ * 80 or more prose words of which fewer than half are content words+ * (`kind: 'density'`, with the share). Each is also a `doc_fluff` warning, so+ * `integration check --strict` fails on it (architecture:cli-surface DEC-8).+ *+ * @typedef {object} DocFluff+ * @property {string} topic+ * @property {'phrase' | 'density'} kind+ * @property {string | null} phrase the padding phrase, for `kind: 'phrase'`+ * @property {string | null} section the title of the section it is in+ * @property {string} file the doc file+ * @property {number | null} line the file line that holds the phrase, when one line does+ * @property {number | null} density the share of content words, for `kind: 'density'`+ * @property {string} message what to cut or write instead+ */+/*** Each of the three authoring checks reports `validated`: false means no* integration manifest was found, so nothing was inspected and the empty@@ -100,7 +118,7 @@/*** @typedef {object} IntegrationDocConflictResponse* @property {'integration.doc-conflicts'} type- * @property {{validated: boolean, name: string | null, version: string | null, findings: IntegrationDocFinding[], copiedPassages: CopiedPassage[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data+ * @property {{validated: boolean, name: string | null, version: string | null, findings: IntegrationDocFinding[], copiedPassages: CopiedPassage[], fluff: DocFluff[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data*/export {};diff --git a/packages/cli/api/integration/integrationDocConflicts.doc.mjs b/packages/cli/api/integration/integrationDocConflicts.doc.mjsindex 3d6b6e4b81..d78895fb8c 100644--- a/packages/cli/api/integration/integrationDocConflicts.doc.mjs+++ b/packages/cli/api/integration/integrationDocConflicts.doc.mjs@@ -17,7 +17,9 @@ export const doc = {'conflicts that need an explicit relationship or a rename. `copiedPassages` lists each ' +'pair of topics that repeat 10 or more words of prose word for word: two of the ' +"package's topics, or one of them and a Core topic other than the one it replaces. " +- 'Code and examples are not compared. Each entry is also a `copied_passage` warning, so ' ++ 'Code and examples are not compared. `fluff` lists each padding phrase, with its file ' ++ 'line, and each topic of 80 or more prose words in which fewer than half carry content. ' ++ 'Each entry of either list is also a warning (`copied_passage`, `doc_fluff`), so ' +'`integration check --strict` fails on it; the check itself still fails only on errors.',importPath: '@astryxdesign/cli/api',signature:@@ -35,7 +37,7 @@ export const doc = {{type: 'integration.doc-conflicts',description:- '`validated` (false when no integration manifest was found, so nothing was inspected), integration identity, structural issues, classified Core doc relationships, and `copiedPassages`.',+ '`validated` (false when no integration manifest was found, so nothing was inspected), integration identity, structural issues, classified Core doc relationships, `copiedPassages`, and `fluff`.',},],examples: [diff --git a/packages/cli/assets/docs/browser-support.doc.mjs b/packages/cli/assets/docs/browser-support.doc.mjsindex 69d8b78682..3b9b17f283 100644--- a/packages/cli/assets/docs/browser-support.doc.mjs+++ b/packages/cli/assets/docs/browser-support.doc.mjs@@ -149,7 +149,7 @@ export const docs = {type: 'list',style: 'ordered',items: [- 'Polyfill anchor positioning. Load a CSS anchor positioning polyfill conditionally behind an `@supports` check so it costs nothing on Tier 1. This is the lowest-effort way to get correct positioning; note that polyfills may not cover every position-fallback feature.',+ 'Polyfill anchor positioning. Load a CSS anchor positioning polyfill conditionally behind an `@supports` check so it costs nothing on Tier 1. This is the lowest-effort way to get correct positioning; polyfills may not cover every position-fallback feature.','Provide a JS positioning fallback. Detect missing support with `CSS.supports("anchor-name", "--x")` and position layers with a measurement-based library (e.g. a floating-element positioner) when it returns false. More code, full control.','Accept degraded positioning. Document for your users that on Tier 2 browsers, layered surfaces open correctly but may not sit next to their trigger. Cheapest, and often fine for internal tools on evergreen browsers.',],diff --git a/packages/cli/assets/docs/tree/check-your-docs.doc.mjs b/packages/cli/assets/docs/tree/check-your-docs.doc.mjsindex 927c3f5bd4..e5056e8e4b 100644--- a/packages/cli/assets/docs/tree/check-your-docs.doc.mjs+++ b/packages/cli/assets/docs/tree/check-your-docs.doc.mjs@@ -32,12 +32,16 @@ export const docs = {{type: 'code',lang: 'text',- code: 'Checking integration docs: @acme/[email protected]\n\n[ok] The docs tree and every link in these docs check out.\n\n[ok] No doc topics overlap with Core.\n[ok] No topic copies a passage from another.',+ code: 'Checking integration docs: @acme/[email protected]\n\n[ok] The docs tree and every link in these docs check out.\n\n[ok] No doc topics overlap with Core.\n[ok] No topic copies a passage from another.\n[ok] No filler phrases or low-density topics.',},{type: 'prose',text: 'Write each fact in one topic. When two of your topics, or one of yours and a Core topic, repeat 10 or more words of prose word for word, the check lists the pair as a `copied_passage` warning. It names the topic that keeps the text (a Core topic, or of your two the one the passage fits) and the line in the other where to put the link instead ({@link generic:links}). Code and examples are not compared, and a topic may carry the text of the Core topic it replaces. A run with fewer than 4 distinct content words (words other than function words such as \"the\", \"in\" or \"it\"), or one that three or more topics share (a series lead-in), is not listed. Each listed pair is also a warning (`copied_passage`): `doctor integration docs` still exits 0, and `integration check --strict` fails until you fix it.',},+ {+ type: 'prose',+ text: "Keep docs dense. The check lists, as a `doc_fluff` warning, each padding phrase in your prose, with its file line and what to write instead, and each topic of 80 or more prose words in which fewer than half the words carry content (words other than function words such as the, and, in), with its measured share and the floor of 0.5. `doctor integration docs` still exits 0, and `integration check --strict` fails until you cut it. Code, examples, and quoted text are not read. The phrases: `it\'s important to note`, `it is important to note`, `important to note that`, `it\'s worth noting`, `it is worth noting`, `worth noting that`, `it should be noted`, `please note`, `note that` (opening a sentence), `as mentioned above`, `as mentioned earlier`, `as mentioned before`, `as noted above`, `as you can see`, `needless to say`, `in order to`, `due to the fact that`, `for the purpose of`, `at this point in time`, `in other words`, `basically`, `essentially`, `obviously`.",+ },{type: 'prose',text: 'Its arguments and exit codes are in {@link command:doctor integration docs}.',diff --git a/packages/cli/assets/docs/tree/checks.doc.mjs b/packages/cli/assets/docs/tree/checks.doc.mjsindex 96df01d5fd..52e817a4db 100644--- a/packages/cli/assets/docs/tree/checks.doc.mjs+++ b/packages/cli/assets/docs/tree/checks.doc.mjs@@ -48,9 +48,9 @@ export const docs = {],['`npx astryx doctor integration docs`',- 'Your docs tree, every link, topic names against Core, and passages two topics repeat word for word',+ 'Your docs tree, every link, topic names against Core, passages two topics repeat word for word, and padding phrases and low-density topics','A topic takes a Core topic name without `replaces` or `extends`, a doc is invalid (`invalid_doc`), or a namespace or placement fails, which hides the doc (`invalid_doc_graph`)',- 'A link names no doc (`invalid_doc_graph`), or two topics repeat a passage word for word (`copied_passage`)',+ 'A link names no doc (`invalid_doc_graph`), two topics repeat a passage word for word (`copied_passage`), or prose pads with a listed phrase or falls under the density floor (`doc_fluff`)',],['`npx astryx integration check`',diff --git a/packages/cli/assets/docs/tree/debug-and-gap-reports.doc.mjs b/packages/cli/assets/docs/tree/debug-and-gap-reports.doc.mjsindex d78667b767..5ee7e8ff5e 100644--- a/packages/cli/assets/docs/tree/debug-and-gap-reports.doc.mjs+++ b/packages/cli/assets/docs/tree/debug-and-gap-reports.doc.mjs@@ -23,7 +23,7 @@ export const docs = {content: [{type: 'prose',- text: 'Export a `debug` function from `astryx.integration.mjs`, and the CLI calls it once for each command run in an app that loads your package.',+ text: 'Export a `debug` function from `astryx.integration.mjs`; the CLI calls it once per command run in an app loading your package.',},{type: 'code',@@ -52,11 +52,11 @@ export default {},{type: 'prose',- text: "An app records every command only when its `astryx.config` names `integrations` or `debug`, as listing your package does. Otherwise your handler runs only for commands that load the app's project, such as `component` and `docs`, and not for `--version` or a mistyped command. In an app whose config names neither word, each of those commands also prints a warning on stderr.",+ text: "An app records every command only when its `astryx.config` names `integrations` or `debug`, as listing your package does. Otherwise your handler runs only for commands loading the app's project, such as `component` and `docs`, never for `--version` or a mistyped command. In an app whose config names neither word, those commands also print a stderr warning.",},{type: 'prose',- text: '`debug` is a named export, not a manifest field, so a CLI that does not know it ignores it and loads the rest of your manifest.',+ text: '`debug` is a named export, not a manifest field, so an older CLI ignores it and loads the rest of your manifest.',},],},@@ -75,7 +75,7 @@ export default {},{type: 'prose',- text: 'From then on, your handler no longer runs in that app.',+ text: 'Your handler then no longer runs in that app.',},],},@@ -150,7 +150,7 @@ message: Rerun with --confirm-public to file this report.`,content: [{type: 'prose',- text: "When the app has no `gapReport` handler at all, the CLI routes the report to the target package's `issuesUrl` from its manifest instead.",+ text: "With no `gapReport` handler in the app, the CLI routes the report to the target package's manifest `issuesUrl`.",},{type: 'list',@@ -173,14 +173,14 @@ message: Rerun with --confirm-public to file this report.`,content: [{type: 'prose',- text: 'When an app loads packages that name their own `issuesUrl`, a report can go to the default (the handlers, or the fallback above) or to one of those packages. `astryx gap-report --list-categories` and the receipt of a report filed without `--to` list every destination, with a line telling the agent to ask the person.',+ text: 'When an app loads packages naming their own `issuesUrl`, a report can go to the default (the handlers, or the fallback above) or to one of those packages. `astryx gap-report --list-categories` and the receipt of a report filed without `--to` list every destination, with a line telling the agent to ask the person.',},{type: 'list',style: 'unordered',items: ['An agent asks the person where to file. It never picks a package destination on its own.',- "`--to <package>` carries the person's choice: the report goes only to that package's `issuesUrl`, under the same `--confirm-public` rule, and the handlers do not run.",+ "`--to <package>` carries the person's choice: the report goes only to that package's `issuesUrl`, under the same `--confirm-public` rule, and no handler runs.",'Without a choice, leave out `--to`; the report goes to the default.','A `--to` that names no destination fails before anything is sent and lists the destinations.',],diff --git a/packages/cli/assets/docs/tree/publishing.doc.mjs b/packages/cli/assets/docs/tree/publishing.doc.mjsindex 8690bb88bf..3fb3ea55f0 100644--- a/packages/cli/assets/docs/tree/publishing.doc.mjs+++ b/packages/cli/assets/docs/tree/publishing.doc.mjs@@ -14,7 +14,7 @@ export const docs = {category: 'guide',keywords: ['publish an integration', 'npm publish', 'release'],description:- 'Publish your package to npm under the right release tag, and check it before and after.',+ 'Publish your package to npm under the right release tag, checking it before and after.',sections: [{id: 'check-before-you-publish',@@ -79,7 +79,7 @@ export const docs = {},{type: 'prose',- text: 'To let apps try a release first, publish it under `next`, then point `latest` at it when it is ready.',+ text: 'To let apps try a release first, publish it under `next`, then point `latest` at it once ready.',},{type: 'code',diff --git a/packages/cli/assets/docs/tree/sections-and-placement.doc.mjs b/packages/cli/assets/docs/tree/sections-and-placement.doc.mjsindex 6cef07935d..00c0542ed7 100644--- a/packages/cli/assets/docs/tree/sections-and-placement.doc.mjs+++ b/packages/cli/assets/docs/tree/sections-and-placement.doc.mjs@@ -95,8 +95,8 @@ export const docs = {type: 'list',style: 'unordered',items: [- 'A `parent` that your package does not ship, such as `namespace:cli`, "names no namespace".',- 'A `slot` that the namespace does not declare "is not a slot of namespace"; the message lists the slots it does declare.',+ 'A `parent` your package does not ship, such as `namespace:cli`, "names no namespace".',+ 'A `slot` the namespace does not declare "is not a slot of namespace"; the message lists the declared slots.','The check exits 1; see {@link generic:check-your-docs}.',],},diff --git a/packages/cli/clients/cli/commands/doctor-integration-docs.doc.mjs b/packages/cli/clients/cli/commands/doctor-integration-docs.doc.mjsindex 75fe616494..bde2202bd2 100644--- a/packages/cli/clients/cli/commands/doctor-integration-docs.doc.mjs+++ b/packages/cli/clients/cli/commands/doctor-integration-docs.doc.mjs@@ -16,7 +16,8 @@ export const doc = {'A same-name topic without `replaces` or `extends` is an accidental conflict ' +'and fails until the author declares the relationship or renames it. ' +'It also lists each pair of topics (two of the package, or one of them and a Core topic other than the one it replaces) ' +- 'that repeat 10 or more words of prose word for word, as a `copied_passage` warning (exit 0; `integration check --strict` fails on it). See {@link generic:check-your-docs}.',+ 'that repeat 10 or more words of prose word for word, and each padding phrase and low-density topic, ' ++ 'each as a warning (`copied_passage`, `doc_fluff`; exit 0, and `integration check --strict` fails on it). See {@link generic:check-your-docs}.',fn: 'integrationDocConflicts',args: [{diff --git a/packages/cli/clients/cli/commands/doctor.mjs b/packages/cli/clients/cli/commands/doctor.mjsindex 1cb5f60c1f..ea7387de0a 100644--- a/packages/cli/clients/cli/commands/doctor.mjs+++ b/packages/cli/clients/cli/commands/doctor.mjs@@ -390,10 +390,12 @@ function printDocConflicts(data) {section(`Checking integration docs: ${integrationLabel(data) ?? '(local package)'}`,),- // A copied passage is listed below with its pair, so its issue is not- // printed twice.+ // A copied passage or fluff is listed below with its detail, so its+ // issue is not printed twice....issueBlocks(- data.issues.filter(issue => issue.code !== 'copied_passage'),+ data.issues.filter(+ issue => issue.code !== 'copied_passage' && issue.code !== 'doc_fluff',+ ),),];if (@@ -443,6 +445,30 @@ function printDocConflicts(data) {}),);}+ const fluff = data.fluff ?? [];+ if (fluff.length === 0) {+ if (!data.issues.some(issue => issue.severity === 'error')) {+ output.push(text('[ok] No filler phrases or low-density topics.'));+ }+ } else {+ output.push(+ text(+ `[warn] ${fluff.length} fluff finding(s) (doc_fluff): words that add length, not meaning. Cut each one.`,+ ),+ records(fluff, {+ fields: [+ 'topic',+ 'kind',+ 'phrase',+ 'section',+ 'file',+ 'line',+ 'density',+ 'message',+ ],+ }),+ );+ }emit(...output);}diff --git a/packages/cli/clients/cli/commands/integration-check.test.mjs b/packages/cli/clients/cli/commands/integration-check.test.mjsindex 88eaecf1ba..8dadbd0fd5 100644--- a/packages/cli/clients/cli/commands/integration-check.test.mjs+++ b/packages/cli/clients/cli/commands/integration-check.test.mjs@@ -330,3 +330,41 @@ describe('a copied passage', () => {expect(strict.stdout).toContain('copied_passage');});});++describe('a padding phrase', () => {+ it('keeps doctor integration docs at exit 0, and fails integration check --strict', async () => {+ fs.writeFileSync(+ path.join(tmpDir, 'package.json'),+ JSON.stringify({name: '@acme/widgets', version: '1.2.3'}),+ );+ fs.writeFileSync(+ path.join(tmpDir, 'astryx.integration.mjs'),+ `export default {docs: './docs'};\n`,+ );+ fs.mkdirSync(path.join(tmpDir, 'docs'));+ const doc = {+ type: 'generic',+ name: 'acme-setup',+ title: 'Fixture',+ description: 'Fixture topic.',+ sections: [+ {+ title: 'Overview',+ content: [{type: 'prose', text: 'In order to start, run the setup.'}],+ },+ ],+ };+ fs.writeFileSync(+ path.join(tmpDir, 'docs', 'acme-setup.doc.mjs'),+ `export default ${JSON.stringify(doc)};\n`,+ );++ const doctor = await runCli(['doctor', 'integration', 'docs'], tmpDir);+ expect(doctor.status).toBe(0);+ expect(doctor.stdout).toContain('1 fluff finding(s)');++ const strict = await runCli(['integration', 'check', '--strict'], tmpDir);+ expect(strict.status).toBe(1);+ expect(strict.stdout).toContain('doc_fluff');+ });+});diff --git a/packages/cli/foundation/discovery/copied-passages.mjs b/packages/cli/foundation/discovery/copied-passages.mjsindex 9650ae8925..ea523916c1 100644--- a/packages/cli/foundation/discovery/copied-passages.mjs+++ b/packages/cli/foundation/discovery/copied-passages.mjs@@ -424,7 +424,7 @@ let coreGuides = null;* @returns {Promise<any>} the doc, or null for one that does not load (the* load problem is reported elsewhere)*/-async function loadQuietly(file) {+export async function loadQuietly(file) {try {return await loadTopicModule(file);} catch {@@ -433,7 +433,7 @@ async function loadQuietly(file) {}/** @returns {Promise<IndexedGuides>} the CLI's own guides, read and indexed once */-function loadCoreGuides() {+export function loadCoreGuides() {coreGuides ??= (async () => {/** @type {GuideWords[]} */const guides = [];diff --git a/packages/cli/foundation/discovery/doc-fluff.mjs b/packages/cli/foundation/discovery/doc-fluff.mjsnew file mode 100644index 0000000000..751bca3396--- /dev/null+++ b/packages/cli/foundation/discovery/doc-fluff.mjs@@ -0,0 +1,328 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * Fluff in docs: padding phrases that add words and no meaning, and guides+ * whose prose is mostly function words. Docs are read by people and agents+ * with a budget, so every word should carry something.+ *+ * Only prose is read (the same strings copied passages compare), and inline+ * code and quoted text are set aside, so a phrase inside a command, or one+ * quoted as an example, never counts.+ */++import fs from 'node:fs';++import {builtinGuideFiles} from './docs-discovery.mjs';+import {+ contentWords,+ fileWords,+ lineAtOffset,+ locateWords,+ loadQuietly,+ proseStrings,+ passageWords,+ textWords,+} from './copied-passages.mjs';++/**+ * Padding phrases: each can be cut, or replaced by a shorter word, without+ * losing meaning. Only phrases that are padding in every use are listed;+ * words such as "just", "simply" or "really", and phrases such as "whether or+ * not" or "keep in mind", which carry meaning in a correct sentence ("not+ * simply a wrapper", "regardless of whether"), are not.+ */+export const FILLER_PHRASES = [+ "it's important to note",+ 'it is important to note',+ 'important to note that',+ "it's worth noting",+ 'it is worth noting',+ 'worth noting that',+ 'it should be noted',+ 'please note',+ 'note that',+ 'as mentioned above',+ 'as mentioned earlier',+ 'as mentioned before',+ 'as noted above',+ 'as you can see',+ 'needless to say',+ 'in order to',+ 'due to the fact that',+ 'for the purpose of',+ 'at this point in time',+ 'in other words',+ 'basically',+ 'essentially',+ 'obviously',+];++/** What to write instead, where a phrase is not simply cut. */+const INSTEAD = {+ 'in order to': 'to',+ 'due to the fact that': 'because',+ 'for the purpose of': 'to or for',+ 'at this point in time': 'now',+};++/** A guide shorter than this many prose words is not scored for density. */+export const DENSITY_MIN_WORDS = 80;++/**+ * A guide whose share of content words is below this is mostly glue. Core's+ * own guides score from about 0.51 up, with a median near 0.62.+ */+export const MIN_DENSITY = 0.5;++/**+ * @param {string} phrase+ * @returns {RegExp}+ */+function phrasePattern(phrase) {+ const escaped = phrase.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');+ // "note that" is padding as a sentence opener ("Note that X"), not inside+ // one ("a note that explains").+ return phrase === 'note that'+ ? new RegExp(`(?:^|[.;:!?]\\s+)${escaped}\\b`, 'gi')+ : // A hyphen joins words ("non-obviously"), so it bounds no phrase.+ new RegExp(`(?<![a-z'-])${escaped}(?![a-z-])`, 'gi');+}++const PATTERNS = FILLER_PHRASES.map(phrase => ({+ phrase,+ pattern: phrasePattern(phrase),+}));++/**+ * A prose string with what is not prose blanked out, length kept: `{@link}`+ * pointers, inline code, and quoted text. A quoted phrase is mentioned, not+ * used ("cut 'in order to'").+ *+ * @param {string} text+ * @returns {string}+ */+export function maskProse(text) {+ // A quoted phrase is mentioned, not used ("cut 'in order to'"), so quotes+ // are set aside along with inline code. Each mask keeps the text's length,+ // so an offset in the masked text is an offset in the text.+ const blank = (/** @type {string} */ span) => ' '.repeat(span.length);+ return (+ text+ // A pointer names a doc, and its target is no prose ("{@link+ // generic:obviously-fast}").+ .replace(/\{@link\s[^}]*\}/g, blank)+ .replace(/`[^`]*`/g, blank)+ .replace(/"[^"]*"|“[^”]*”|‘[^’]*’/g, blank)+ .replace(/’/g, "'")+ // A single-quoted span opens and closes beside a non-letter, so the+ // apostrophe in "don't" or "it's" opens nothing.+ .replace(/(?<![A-Za-z])'[^']*'(?![A-Za-z])/g, blank)+ );+}++/**+ * Each padding phrase in a text, outside inline code and quotes, in order,+ * with its offset in the text.+ *+ * `thatAfter` is true when the phrase is followed by a "that" a reader cuts+ * with it ("It is worth noting that the cache is shared").+ *+ * @param {string} text+ * @returns {{phrase: string, at: number, thatAfter: boolean}[]}+ */+export function fillerAt(text) {+ const prose = maskProse(text);+ /** @type {{phrase: string, at: number, thatAfter: boolean}[]} */+ const found = [];+ for (const {phrase, pattern} of PATTERNS) {+ for (const match of prose.matchAll(pattern)) {+ // A phrase inside a longer listed one ("note that" in "worth noting+ // that") is the longer one's.+ const at = match.index + match[0].toLowerCase().indexOf(phrase);+ if (+ !found.some(each => at >= each.at && at < each.at + each.phrase.length)+ ) {+ found.push({+ phrase,+ at,+ // Only a phrase that ends in note or noting leads into a "that"+ // clause the reader cuts with it; "Obviously that works" and "As+ // noted above that flag" keep their "that".+ thatAfter:+ /\bnot(?:e|ed|ing)$/.test(phrase) &&+ !phrase.endsWith('that') &&+ /^\s+that\b/i.test(prose.slice(at + phrase.length)),+ });+ }+ }+ }+ return found.sort((a, b) => a.at - b.at);+}++/**+ * Each padding phrase in a text, outside inline code and quotes, in order.+ *+ * @param {string} text+ * @returns {string[]}+ */+export function fillerIn(text) {+ return fillerAt(text).map(each => each.phrase);+}++/**+ * The share of a doc's prose words that are content words.+ *+ * @param {{word: string}[]} words+ * @returns {number}+ */+export function density(words) {+ if (words.length === 0) return 1;+ let content = 0;+ for (let i = 0; i < words.length; i++) {+ if (contentWords(words, i, 1) === 1) content++;+ }+ return content / words.length;+}++/**+ * A number rounded down to `places` decimals, so a share under the floor+ * never reads as the floor.+ *+ * @param {number} value+ * @param {number} places+ * @returns {number}+ */+export function floorTo(value, places) {+ const scale = 10 ** places;+ return Math.floor(value * scale + 1e-9) / scale;+}++/**+ * A share as a percent with one decimal, rounded down ("49.5%").+ *+ * @param {number} share+ * @returns {string}+ */+export function sharePercent(share) {+ return `${floorTo(share * 100, 1).toFixed(1)}%`;+}++/**+ * The words a topic's density is measured on: its prose, without what the+ * phrase check also leaves unread (links, inline code, quoted text).+ *+ * @param {unknown} doc+ * @returns {{word: string}[]}+ */+export function densityWords(doc) {+ return proseStrings(doc).flatMap(({text}) =>+ passageWords(maskProse(text)).map(word => ({word})),+ );+}++/**+ * The median density of Core's own guides of at least+ * {@link DENSITY_MIN_WORDS} words.+ *+ * @returns {Promise<number>}+ */+export async function coreDensityMedian() {+ // Core's guides are measured the way a package's topics are.+ /** @type {number[]} */+ const scores = [];+ for (const file of builtinGuideFiles()) {+ const doc = await loadQuietly(file);+ if (typeof doc?.name !== 'string') continue;+ const words = densityWords(doc);+ if (words.length >= DENSITY_MIN_WORDS) scores.push(density(words));+ }+ scores.sort((a, b) => a - b);+ return scores.length === 0 ? 0 : scores[Math.floor(scores.length / 2)];+}++/**+ * Fluff in a package's topics: every padding phrase, with its section and+ * file line, and every topic of at least {@link DENSITY_MIN_WORDS} words+ * whose density is below {@link MIN_DENSITY}.+ *+ * @param {{records: {name: string, path: string}[], guides?: {name: string, ref?: {topicFile?: string}}[]}} discovered+ * the package's docs, as discoverIntegrationDocs returns them+ * @returns {Promise<import('../../api/integration/authoring-checks.type.mjs').DocFluff[]>}+ */+export async function findFluff(discovered) {+ const topics = [+ ...discovered.records.map(record => ({+ name: record.name,+ file: record.path,+ })),+ ...(discovered.guides ?? []).map(guide => ({+ name: guide.name,+ file: guide.ref?.topicFile,+ })),+ ];+ /** @type {import('../../api/integration/authoring-checks.type.mjs').DocFluff[]} */+ const found = [];+ /** @type {number | null} */+ let median = null;+ for (const {name, file} of topics) {+ const doc = file ? await loadQuietly(file) : null;+ if (!doc || !file) continue;+ /** @type {{word: string, line: number}[]} */+ let source = [];+ try {+ source = fileWords(fs.readFileSync(file, 'utf8'));+ } catch {+ // No line numbers; each finding still names its section.+ }+ // Each string is found by its whole run of words, from where the last+ // one was found, so two strings that open alike keep their own lines.+ let cursor = 0;+ for (const {text, section} of proseStrings(doc)) {+ const words = textWords(text);+ let index = locateWords(source, words, cursor);+ if (index < 0) index = locateWords(source, words);+ if (index >= 0) cursor = index + words.length;+ for (const {phrase, at, thatAfter} of fillerAt(text)) {+ const line = index < 0 ? null : lineAtOffset(source, index, words, at);+ const where = section ? ` (section "${section}")` : '';+ const instead = /** @type {Record<string, string>} */ (INSTEAD)[phrase];+ found.push({+ topic: name,+ kind: 'phrase',+ phrase,+ section,+ file,+ line,+ density: null,+ message:+ `"${name}"${where} pads its prose with "${phrase}"` ++ `${line == null ? '' : ` (line ${line})`}. ` ++ (instead+ ? `Write "${instead}" instead.`+ : thatAfter+ ? 'Cut it and the "that" after it; the sentence says the same without them.'+ : 'Cut it; the sentence says the same without it.'),+ });+ }+ }+ const words = densityWords(doc);+ if (words.length < DENSITY_MIN_WORDS) continue;+ const score = density(words);+ if (score >= MIN_DENSITY) continue;+ median ??= await coreDensityMedian();+ found.push({+ topic: name,+ kind: 'density',+ phrase: null,+ section: null,+ file,+ line: null,+ density: floorTo(score, 3),+ message:+ `"${name}" is mostly glue: ${sharePercent(score)} of its ${words.length} prose words carry content, ` ++ `under the ${Math.round(MIN_DENSITY * 100)}% floor (Core's guides have a median of ${Math.round(median * 100)}%). ` ++ 'Cut filler and restated context until each sentence states one thing.',+ });+ }+ return found;+}diff --git a/packages/cli/foundation/discovery/doc-fluff.test.mjs b/packages/cli/foundation/discovery/doc-fluff.test.mjsnew file mode 100644index 0000000000..bb7cb80111--- /dev/null+++ b/packages/cli/foundation/discovery/doc-fluff.test.mjs@@ -0,0 +1,142 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++import {describe, expect, it} from 'vitest';++import {+ density,+ densityWords,+ fillerAt,+ fillerIn,+ floorTo,+ sharePercent,+} from './doc-fluff.mjs';+import {passageWords} from './copied-passages.mjs';++const words = (/** @type {string} */ text) =>+ passageWords(text).map(word => ({word}));++describe('fillerIn', () => {+ it('finds padding phrases in order, the longest one only', () => {+ expect(+ fillerIn(+ 'In order to start, it is worth noting that you basically run it. Note that it builds.',+ ),+ ).toEqual(['in order to', 'it is worth noting', 'basically', 'note that']);+ });++ it('leaves inline code, quotes, a noun "note", and ambiguous words alone', () => {+ expect(+ fillerIn(+ 'Run `basically --in order to`. Cut "in order to" and “basically”. Add a note that explains it. Copy just this one file; it really is the source.',+ ),+ ).toEqual([]);+ });++ it('sets aside single-quoted text, but not an apostrophe', () => {+ expect(+ fillerIn(+ "Avoid ‘basically’ and ‘obviously’. Don't write 'it is worth noting that' in a guide.",+ ),+ ).toEqual([]);+ expect(fillerIn("Don't pad: it's important to note the order.")).toEqual([+ "it's important to note",+ ]);+ });++ it('lists no phrase that carries meaning in a correct sentence', () => {+ expect(+ fillerIn(+ 'It is not simply a wrapper. Every app gets a theme whether or not anyone picks one. Keep in mind the order. Feel free to skip it.',+ ),+ ).toEqual([]);+ });++ it('reads a curly apostrophe like a straight one', () => {+ expect(fillerIn('It’s important to note the order.')).toEqual([+ "it's important to note",+ ]);+ });+});++describe('fillerAt', () => {+ it('reads no phrase inside a link target or a hyphenated word', () => {+ expect(+ fillerIn(+ 'Read {@link generic:obviously-fast} before you tune the build.',+ ),+ ).toEqual([]);+ expect(fillerIn('A non-obviously slow build still passes.')).toEqual([]);+ expect(fillerIn('It is obviously slow.')).toEqual(['obviously']);+ });++ it('marks a "that" the reader cuts with the phrase', () => {+ expect(+ fillerAt('It is worth noting that the cache is shared.').map(+ each => each.thatAfter,+ ),+ ).toEqual([true]);+ expect(+ fillerAt('Basically, the cache is shared.').map(each => each.thatAfter),+ ).toEqual([false]);+ // Only a note or noting phrase leads a clause the reader cuts.+ expect(+ fillerAt('Obviously that works only in a browser.').map(+ each => each.thatAfter,+ ),+ ).toEqual([false]);+ expect(+ fillerAt('As noted above that flag is required.').map(+ each => each.thatAfter,+ ),+ ).toEqual([false]);+ });+});++describe('densityWords', () => {+ it('measures prose only, not quoted text, inline code or links', () => {+ const doc = {+ sections: [+ {+ title: 'Overview',+ content: [+ {+ type: 'prose',+ text: 'Theme tokens set colors. Write "it is in the" or `of the` as {@link generic:theme} shows.',+ },+ ],+ },+ ],+ };+ expect(densityWords(doc).map(each => each.word)).toEqual([+ 'theme',+ 'tokens',+ 'set',+ 'colors.',+ 'write',+ 'or',+ 'as',+ 'shows.',+ ]);+ });+});++describe('share rounding', () => {+ it('rounds a share under the floor down, never up to it', () => {+ expect(floorTo(0.4995, 3)).toBe(0.499);+ expect(sharePercent(0.4995)).toBe('49.9%');+ expect(sharePercent(0.5)).toBe('50.0%');+ });+});++describe('density', () => {+ it('scores a padded sentence well below a dense one', () => {+ const padded = words(+ 'So that is why it is the one that you would want to use if you can.',+ );+ const dense = words(+ 'Name each codemod folder after the Core version whose upgrade runs it.',+ );+ expect(density(padded)).toBeLessThan(0.3);+ expect(density(dense)).toBeGreaterThan(0.6);+ });+});diff --git a/packages/cli/foundation/doc-compiler/doc-loads.test.mjs b/packages/cli/foundation/doc-compiler/doc-loads.test.mjsindex 8944dd2573..d2b27c180b 100644--- a/packages/cli/foundation/doc-compiler/doc-loads.test.mjs+++ b/packages/cli/foundation/doc-compiler/doc-loads.test.mjs@@ -256,6 +256,10 @@ const RUNNERS = {runs: "the CLI's own guides and the package's topics, to compare their prose for passages two topics repeat",sites: ['builtinGuideFiles', 'loadTopicModule'],},+ 'foundation/discovery/doc-fluff.mjs': {+ runs: "the CLI's own guides, to measure the median share of content words a topic's density is compared with",+ sites: ['builtinGuideFiles'],+ },'foundation/discovery/docs-discovery.mjs': {runs: 'a contributed topic, for its catalog fields: name, title, description, category, and relationships',sites: ['importDocModule'],diff --git a/packages/cli/foundation/response/response-types.doc.mjs b/packages/cli/foundation/response/response-types.doc.mjsindex 50b274e110..698cf722be 100644--- a/packages/cli/foundation/response/response-types.doc.mjs+++ b/packages/cli/foundation/response/response-types.doc.mjs@@ -348,7 +348,7 @@ export const doc = {{value: 'integration.doc-conflicts',description:- 'validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` | `error`) and `relationship` (`replaces` | `extends` | `accidental`). copiedPassages lists each pair of topics that repeat 10 or more words of prose word for word: topic, section, otherTopic, otherOwner (package | core), words, passages, owner (the topic that should keep the text), text (the passage as the topic writes it), line (where the copy starts in the topic to change, or null), and message (the exact replacement); each is also a copied_passage warning in issues.',+ 'validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` | `error`) and `relationship` (`replaces` | `extends` | `accidental`). copiedPassages lists each pair of topics that repeat 10 or more words of prose word for word: topic, section, otherTopic, otherOwner (package | core), words, passages, owner (the topic that should keep the text), text (the passage as the topic writes it), line (where the copy starts in the topic to change, or null), and message (the exact replacement); each is also a copied_passage warning in issues. fluff lists padding phrases and low-density topics: topic, kind (phrase | density), phrase, section, file, line, density, and message (what to cut or write instead); each is also a doc_fluff warning in issues.',},{value: 'integration.check',diff --git a/packages/cli/test/core-doc-quality.test.mjs b/packages/cli/test/core-doc-quality.test.mjsindex 0b0ad0f21a..ee76cd2710 100644--- a/packages/cli/test/core-doc-quality.test.mjs+++ b/packages/cli/test/core-doc-quality.test.mjs@@ -3,7 +3,7 @@/*** Core's own guides pass the doc-quality checks `integration check --strict`* holds every integration to (architecture:cli-surface DEC-8): no two guides- * repeat a passage word for word.+ * repeat a passage word for word, and none pads its prose.*/import {describe, expect, it} from 'vitest';@@ -12,6 +12,13 @@ import {builtinGuideFiles,loadTopicModule,} from '../foundation/discovery/docs-discovery.mjs';+import {+ DENSITY_MIN_WORDS,+ MIN_DENSITY,+ density,+ densityWords,+ fillerIn,+} from '../foundation/discovery/doc-fluff.mjs';import {BOILERPLATE_TOPICS,MIN_CONTENT_WORDS,@@ -19,16 +26,17 @@ import {contentWords,trimBoilerplate,proseWords,+ proseStrings,sharedPassages,} from '../foundation/discovery/copied-passages.mjs';-/** @returns {Promise<{name: string, words: ReturnType<typeof proseWords>}[]>} */+/** @returns {Promise<{name: string, doc: unknown, words: ReturnType<typeof proseWords>}[]>} */async function coreGuides() {const guides = [];for (const file of builtinGuideFiles()) {const doc = /** @type {any} */ (await loadTopicModule(file));if (typeof doc?.name === 'string') {- guides.push({name: doc.name, words: proseWords(doc)});+ guides.push({name: doc.name, doc, words: proseWords(doc)});}}return guides;@@ -83,4 +91,19 @@ describe("Core's guides", () => {'Keep the fact in the guide that owns it and link to it from the other.',).toEqual([]);});++ it('use no padding phrase and keep their density above the floor', async () => {+ const fluff = [];+ for (const {name, doc} of await coreGuides()) {+ for (const {text} of proseStrings(doc)) {+ for (const phrase of fillerIn(text)) fluff.push(`${name}: "${phrase}"`);+ }+ // Measured as the check measures a package's topics.+ const words = densityWords(doc);+ if (words.length >= DENSITY_MIN_WORDS && density(words) < MIN_DENSITY) {+ fluff.push(`${name}: density ${density(words).toFixed(2)}`);+ }+ }+ expect(fluff, 'Cut the phrase, or write the shorter word.').toEqual([]);+ });});diff --git a/packages/cli/test/integration-check-failures.json b/packages/cli/test/integration-check-failures.jsonindex 13b502a88b..e6f905a2dc 100644--- a/packages/cli/test/integration-check-failures.json+++ b/packages/cli/test/integration-check-failures.json@@ -4,7 +4,7 @@"validate": ["docTypes", "issues"],"components": ["conflicts", "issues", "propDrift"],"templates": ["conflicts", "issues"],- "docs": ["copiedPassages", "findings", "issues"]+ "docs": ["copiedPassages", "findings", "fluff", "issues"]},"reports": {"docTypes": "doc_types_skipped",@@ -17,6 +17,7 @@"component_name_conflict","copied_passage","core_not_found",+ "doc_fluff","doc_types_skipped","duplicate_doc","duplicate_provider",