@astryxdesign/cli 0.7.2 → 0.7.3-canary.04c7468
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +104 -71
- package/api/build/_adapter.d.mts +58 -0
- package/api/build/_adapter.mjs +127 -3
- package/api/build/blocks/blocks.d.mts +92 -0
- package/api/build/blocks/blocks.mjs +528 -0
- package/api/build/blocks/blocks.test.mjs +238 -0
- package/api/build/blocks/blocks.weights.json +1 -0
- package/api/build/build.mjs +25 -6
- package/api/build/build.type.mjs +1 -1
- package/api/build/kit/answer.d.mts +18 -0
- package/api/build/kit/answer.mjs +195 -0
- package/api/build/kit/answer.test.mjs +108 -0
- package/api/build/kit/kind.d.mts +25 -0
- package/api/build/kit/kind.mjs +170 -0
- package/api/build/kit/kit.d.mts +2 -4
- package/api/build/kit/kit.mjs +8 -398
- package/api/build/kit/rank.d.mts +3 -32
- package/api/build/kit/rank.mjs +25 -342
- package/api/build/kit/rank.test.mjs +2 -1
- package/api/build/kit/signals.d.mts +79 -0
- package/api/build/kit/signals.mjs +295 -0
- package/api/build/kit/start.d.mts +32 -0
- package/api/build/kit/start.mjs +163 -0
- package/api/build/kit/words.d.mts +72 -0
- package/api/build/kit/words.mjs +202 -0
- package/api/build/tree.d.mts +20 -0
- package/api/build/tree.mjs +53 -0
- package/api/build/tree.test.mjs +185 -0
- package/api/build/tree.weights.json +1 -0
- package/api/component/_adapter.mjs +39 -5
- package/api/component/component-replacement.test.mjs +1 -0
- package/api/component/component.mjs +17 -3
- package/api/component/component.test.mjs +15 -0
- package/api/component/doc-links.test.mjs +2 -2
- package/api/discover/_adapter.d.mts +1 -2
- package/api/discover/_adapter.mjs +42 -17
- package/api/discover/_adapter.test.mjs +42 -0
- package/api/discover/discover.mjs +0 -1
- package/api/docs/_adapter.d.mts +2 -2
- package/api/docs/_adapter.mjs +82 -23
- package/api/docs/docs-homes.test.mjs +127 -0
- package/api/docs/docs.doc.mjs +3 -3
- package/api/docs/docs.test.mjs +35 -19
- package/api/docs/integration-tree.test.mjs +20 -20
- package/api/docs/integrationDocs.test.mjs +1 -1
- package/api/docs/namespace-section.test.mjs +6 -6
- package/api/docs/reference-blocks.test.mjs +2 -2
- package/api/doctor/_adapter.d.mts +33 -13
- package/api/doctor/_adapter.mjs +55 -25
- package/api/doctor/doctor.d.mts +23 -5
- package/api/doctor/doctor.mjs +183 -40
- package/api/doctor/doctor.test.mjs +95 -12
- package/api/hook/hook.mjs +1 -1
- package/api/init/init.doc.mjs +20 -6
- package/api/init/init.test.mjs +18 -2
- package/api/init/init.type.d.mts +3 -3
- package/api/init/init.type.mjs +3 -3
- package/api/init/remove/remove.mjs +17 -4
- package/api/init/remove/remove.test.mjs +114 -2
- package/api/init/run/run.mjs +69 -6
- package/api/integration/_adapter.d.mts +8 -0
- package/api/integration/_adapter.mjs +21 -1
- package/api/integration/authoring-checks.mjs +83 -9
- package/api/integration/authoring-checks.test.mjs +220 -0
- package/api/integration/pack-check.mjs +123 -4
- package/api/integration/pack-check.test.mjs +87 -0
- package/api/integration/validate-integration-case-disk.test.mjs +111 -0
- package/api/integration/validate-integration-fixes.test.mjs +6 -5
- package/api/integration/validate-integration-gaps.test.mjs +1975 -0
- package/api/integration/validate-integration.d.mts +15 -2
- package/api/integration/validate-integration.mjs +298 -39
- package/api/integration/validate-integration.type.d.mts +90 -1
- package/api/integration/validate-integration.type.mjs +67 -2
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/search/ORDERING.md +28 -0
- package/api/search/_adapter.d.mts +82 -2
- package/api/search/_adapter.mjs +157 -10
- package/api/search/_adapter.test.mjs +173 -0
- package/api/search/_candidate-score.d.mts +40 -0
- package/api/search/_candidate-score.mjs +238 -0
- package/api/search/_cards.json +6098 -0
- package/api/search/_compound.d.mts +50 -0
- package/api/search/_compound.mjs +170 -0
- package/api/search/_doc-searcher.d.mts +4 -0
- package/api/search/_doc-searcher.mjs +23 -0
- package/api/search/_doc-searcher.test.mjs +36 -0
- package/api/search/_doc-searcher.weights.json +1 -0
- package/api/search/_doc-text.d.mts +30 -0
- package/api/search/_doc-text.mjs +87 -0
- package/api/search/_entries.d.mts +63 -0
- package/api/search/_entries.mjs +232 -0
- package/api/search/_entries.test.mjs +48 -0
- package/api/search/_features.d.mts +35 -0
- package/api/search/_features.mjs +155 -0
- package/api/search/_gather-components.d.mts +26 -0
- package/api/search/_gather-components.mjs +284 -0
- package/api/search/_gather-docs.d.mts +20 -0
- package/api/search/_gather-docs.mjs +254 -0
- package/api/search/_gather-hooks.d.mts +12 -0
- package/api/search/_gather-hooks.mjs +52 -0
- package/api/search/_gather-templates.d.mts +25 -0
- package/api/search/_gather-templates.mjs +107 -0
- package/api/search/_lexical.d.mts +135 -0
- package/api/search/_lexical.mjs +351 -0
- package/api/search/_main-searcher.d.mts +19 -0
- package/api/search/_main-searcher.mjs +115 -0
- package/api/search/_main-searcher.test.mjs +106 -0
- package/api/search/_main-searcher.weights.json +1 -0
- package/api/search/_module-doc.d.mts +32 -0
- package/api/search/_module-doc.mjs +78 -0
- package/api/search/_order.d.mts +32 -0
- package/api/search/_order.mjs +162 -0
- package/api/search/_order.test.mjs +72 -0
- package/api/search/_priority.d.mts +50 -0
- package/api/search/_priority.mjs +139 -0
- package/api/search/_query-words.d.mts +25 -0
- package/api/search/_query-words.mjs +92 -0
- package/api/search/_query.d.mts +65 -0
- package/api/search/_query.mjs +176 -0
- package/api/search/_result.d.mts +97 -0
- package/api/search/_result.mjs +150 -0
- package/api/search/_score.d.mts +60 -0
- package/api/search/_score.mjs +283 -0
- package/api/search/_synonyms.d.mts +21 -0
- package/api/search/_synonyms.mjs +67 -0
- package/api/search/_template-searcher.d.mts +4 -0
- package/api/search/_template-searcher.mjs +23 -0
- package/api/search/_template-searcher.test.mjs +40 -0
- package/api/search/_template-searcher.weights.json +1 -0
- package/api/search/_titles.d.mts +33 -0
- package/api/search/_titles.mjs +65 -0
- package/api/search/_words.d.mts +64 -0
- package/api/search/_words.mjs +157 -0
- package/api/search/search.d.mts +22 -305
- package/api/search/search.doc.mjs +8 -6
- package/api/search/search.mjs +56 -2482
- package/api/search/search.test.mjs +14 -14
- package/api/search/search.type.d.mts +6 -1
- package/api/search/search.type.mjs +6 -1
- package/api/search/tree.d.mts +15 -0
- package/api/search/tree.mjs +40 -0
- package/api/search/tree.test.mjs +66 -0
- package/api/search/tree.weights.json +1 -0
- package/api/template/template.mjs +5 -1
- package/api/theme/build/build.packed-old-core.test.mjs +1 -0
- package/api/upgrade/_adapter.d.mts +57 -9
- package/api/upgrade/_adapter.mjs +198 -28
- package/api/upgrade/registry/registry.d.mts +10 -4
- package/api/upgrade/registry/registry.mjs +33 -16
- package/api/upgrade/registry/registry.test.mjs +85 -0
- package/api/upgrade/run/run.d.mts +4 -2
- package/api/upgrade/run/run.mjs +13 -2
- package/api/upgrade/run/run.test.mjs +417 -3
- package/api/upgrade/upgrade.doc.mjs +10 -5
- package/api/upgrade/upgrade.mjs +13 -2
- package/api/upgrade/upgrade.test.mjs +194 -0
- package/api/upgrade/upgrade.type.d.mts +5 -3
- package/api/upgrade/upgrade.type.mjs +8 -6
- package/assets/codemods/transforms/v0.7.0/__tests__/validate-data-token-ownership.test.mjs +11 -0
- package/assets/codemods/transforms/v0.7.0/validate-data-token-ownership.mjs +3 -3
- package/assets/docs/author-a-theme.doc.mjs +2 -2
- package/assets/docs/is-my-code-good.doc.mjs +287 -0
- package/assets/docs/tree/add-a-component.doc.mjs +1 -1
- package/assets/docs/tree/add-a-theme.doc.mjs +1 -1
- package/assets/docs/tree/add-a-topic.doc.mjs +2 -2
- package/assets/docs/tree/agent-guidance.doc.mjs +1 -1
- package/assets/docs/tree/api.doc.mjs +6 -0
- package/assets/docs/tree/{integrations.doc.mjs → authoring.doc.mjs} +15 -6
- package/assets/docs/tree/block-template.doc.mjs +1 -1
- package/assets/docs/tree/build-the-template.doc.mjs +1 -1
- package/assets/docs/tree/building-blocks.doc.mjs +2 -2
- package/assets/docs/tree/check-the-props.doc.mjs +1 -1
- package/assets/docs/tree/check-your-docs.doc.mjs +2 -2
- package/assets/docs/tree/checks.doc.mjs +3 -3
- package/assets/docs/tree/ci-and-containers.doc.mjs +13 -0
- package/assets/docs/tree/cli-command.doc.mjs +1 -1
- package/assets/docs/tree/cli.doc.mjs +1 -1
- package/assets/docs/tree/codemods.doc.mjs +1 -1
- package/assets/docs/tree/component-family.doc.mjs +1 -1
- package/assets/docs/tree/component-imports.doc.mjs +1 -1
- package/assets/docs/tree/components.doc.mjs +1 -1
- package/assets/docs/tree/configuration.doc.mjs +1 -1
- package/assets/docs/tree/debug-and-gap-reports.doc.mjs +1 -1
- package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
- package/assets/docs/tree/describe-the-component.doc.mjs +1 -1
- package/assets/docs/tree/docs.doc.mjs +1 -1
- package/assets/docs/tree/document-the-template.doc.mjs +1 -1
- package/assets/docs/tree/document-the-theme.doc.mjs +1 -1
- package/assets/docs/tree/export-template-assets.doc.mjs +1 -1
- package/assets/docs/tree/extend-or-replace.doc.mjs +1 -1
- package/assets/docs/{authoring.doc.mjs → tree/field-reference.doc.mjs} +4 -3
- package/assets/docs/tree/fonts-and-assets.doc.mjs +1 -1
- package/assets/docs/tree/generate-a-palette.doc.mjs +1 -1
- package/assets/docs/tree/global-integrations.doc.mjs +2 -2
- package/assets/docs/tree/grade-template-with-agent.doc.mjs +4 -4
- package/assets/docs/tree/help.doc.mjs +2 -2
- package/assets/docs/tree/host-entry.doc.mjs +128 -0
- package/assets/docs/tree/links.doc.mjs +1 -1
- package/assets/docs/tree/package-and-test.doc.mjs +1 -1
- package/assets/docs/tree/page-template.doc.mjs +1 -1
- package/assets/docs/tree/publishing.doc.mjs +1 -1
- package/assets/docs/tree/quick-start.doc.mjs +1 -1
- package/assets/docs/tree/replace-a-core-component.doc.mjs +1 -1
- package/assets/docs/tree/replace-a-core-template.doc.mjs +1 -1
- package/assets/docs/tree/sections-and-placement.doc.mjs +1 -1
- package/assets/docs/tree/see-it-in-an-app.doc.mjs +1 -1
- package/assets/docs/tree/ship.doc.mjs +2 -2
- package/assets/docs/tree/short-and-findable.doc.mjs +1 -1
- package/assets/docs/tree/single-component.doc.mjs +1 -1
- package/assets/docs/tree/start-a-template.doc.mjs +1 -1
- package/assets/docs/tree/subcomponent.doc.mjs +1 -1
- package/assets/docs/tree/template-assets.doc.mjs +1 -1
- package/assets/docs/tree/template-doc-overview.doc.mjs +2 -2
- package/assets/docs/tree/template-fonts.doc.mjs +1 -1
- package/assets/docs/tree/template-grading-rubric.doc.mjs +17 -38
- package/assets/docs/tree/template-icons.doc.mjs +1 -1
- package/assets/docs/tree/template-images-media.doc.mjs +1 -1
- package/assets/docs/tree/template-styles.doc.mjs +1 -1
- package/assets/docs/tree/templates.doc.mjs +1 -1
- package/assets/docs/tree/test-in-an-app.doc.mjs +1 -1
- package/assets/docs/tree/test-template-in-app.doc.mjs +1 -1
- package/assets/docs/tree/themes.doc.mjs +1 -1
- package/assets/docs/tree/tokens-data.doc.mjs +2 -2
- package/assets/docs/tree/troubleshooting.doc.mjs +1 -1
- package/assets/docs/tree/upgrading.doc.mjs +1 -1
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +1 -1
- package/assets/docs/tree/verify-packed-template.doc.mjs +1 -1
- package/assets/docs/tree/versioning.doc.mjs +5 -1
- package/assets/docs/tree/write-good-templates.doc.mjs +1 -1
- package/assets/docs/tree/write-the-template-file.doc.mjs +1 -1
- package/assets/docs/use-integrations.doc.mjs +120 -0
- package/assets/docs/working-with-ai.doc.mjs +6 -2
- package/assets/templates/themes/butter/butterTheme.ts +4 -2
- package/assets/templates/themes/stone/stoneTheme.ts +4 -2
- package/assets/templates/themes/y2k/y2kTheme.ts +4 -2
- package/authoring/debug/parse.d.mts +1 -1
- package/authoring/doctypes/schema/schema.doc.mjs +1 -1
- package/authoring/integration/integration.doc.mjs +1 -1
- package/authoring/integration/type.ts +1 -1
- package/clients/cli/bin/astryx.mjs +7 -78
- package/clients/cli/command-result-coverage.test.mjs +6 -5
- package/clients/cli/commands/build-theme.color-scheme.test.mjs +1 -1
- package/clients/cli/commands/{component/index.mjs → component.mjs} +37 -37
- package/clients/cli/commands/component.test.mjs +6 -6
- package/clients/cli/commands/docs.doc.mjs +2 -2
- package/clients/cli/commands/docs.mjs +1 -1
- package/clients/cli/commands/docs.test.mjs +14 -14
- package/clients/cli/commands/doctor-integration.test.mjs +49 -1
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/doctor.mjs +40 -0
- package/clients/cli/commands/doctor.test.mjs +65 -0
- package/clients/cli/commands/{hook/index.mjs → hook.mjs} +22 -22
- package/clients/cli/commands/import-hint-correctness.test.mjs +1 -1
- package/clients/cli/commands/init.behavior.test.mjs +230 -1
- package/clients/cli/commands/init.doc.mjs +28 -9
- package/clients/cli/commands/init.flag-help.test.mjs +1 -0
- package/clients/cli/commands/init.mjs +2 -2
- package/clients/cli/commands/integration-check.test.mjs +48 -0
- package/clients/cli/commands/integration.doc.mjs +1 -1
- package/clients/cli/commands/manifest.doc.mjs +1 -1
- package/clients/cli/commands/manifest.mjs +67 -0
- package/clients/cli/commands/outside-project.test.mjs +101 -1
- package/clients/cli/commands/postinstall.doc.mjs +23 -0
- package/clients/cli/commands/postinstall.mjs +31 -0
- package/clients/cli/commands/setup-nudge.test.mjs +78 -0
- package/clients/cli/commands/{build-theme.mjs → theme.mjs} +1 -1
- package/clients/cli/commands/upgrade.doc.mjs +4 -2
- package/clients/cli/commands/upgrade.mjs +9 -2
- package/clients/cli/commands/upgrade.subfolder-path.test.mjs +97 -0
- package/clients/cli/index.mjs +54 -94
- package/clients/cli/lib/component-format.mjs +1 -1
- package/clients/cli/lib/define-command.mjs +12 -7
- package/clients/cli/lib/exit-codes.test.mjs +5 -0
- package/clients/cli/lib/manifest.test.mjs +12 -0
- package/clients/cli/lib/welcome-box.mjs +50 -0
- package/clients/cli/run.mjs +108 -0
- package/foundation/agent-docs/agent-doc-state.d.mts +32 -7
- package/foundation/agent-docs/agent-doc-state.mjs +58 -9
- package/foundation/agent-docs/agent-docs.d.mts +100 -12
- package/foundation/agent-docs/agent-docs.mjs +1017 -105
- package/foundation/agent-docs/agent-docs.path-safety.test.mjs +1239 -17
- package/foundation/agent-docs/agent-docs.test.mjs +683 -39
- package/foundation/agent-docs/computer-agent-text.d.mts +39 -2
- package/foundation/agent-docs/computer-agent-text.mjs +135 -8
- package/foundation/agent-docs/computer-agent-text.test.mjs +99 -2
- package/foundation/config/project.mjs +20 -22
- package/foundation/config/project.test.mjs +56 -0
- package/foundation/discovery/authoring-self-docs.d.mts +7 -0
- package/foundation/discovery/authoring-self-docs.mjs +16 -4
- package/foundation/discovery/authoring-self-docs.test.mjs +15 -3
- package/foundation/discovery/authoring-surface.d.mts +1 -1
- package/foundation/discovery/authoring-surface.mjs +2 -2
- package/foundation/discovery/authoring-surface.test.mjs +1 -1
- package/foundation/discovery/cli-self-docs.d.mts +2 -1
- package/foundation/discovery/cli-self-docs.mjs +4 -3
- package/foundation/discovery/cli-self-docs.test.mjs +2 -2
- package/foundation/discovery/component-discovery.d.mts +37 -0
- package/foundation/discovery/component-discovery.mjs +80 -5
- package/foundation/discovery/component-loader.d.mts +1 -1
- package/foundation/discovery/docs-discovery.mjs +14 -1
- package/foundation/discovery/module-exports.d.mts +41 -0
- package/foundation/discovery/module-exports.mjs +253 -0
- package/foundation/discovery/runner-allowlist.d.mts +2 -4
- package/foundation/discovery/runner-allowlist.mjs +2 -4
- package/foundation/discovery/runner-commands.d.mts +77 -0
- package/foundation/discovery/runner-commands.mjs +294 -0
- package/foundation/discovery/runner-commands.test.mjs +128 -0
- package/foundation/discovery/stray-pointers.test.mjs +1 -1
- package/foundation/discovery/template-adapter.mjs +18 -1
- package/foundation/discovery/template-needs.mjs +1 -44
- package/foundation/discovery/theme-discovery.mjs +147 -3
- package/foundation/doc-compiler/doc-loads.test.mjs +33 -9
- package/foundation/doc-compiler/read.mjs +59 -1
- package/foundation/doc-compiler/read.test.mjs +11 -2
- package/foundation/doc-compiler/split-topic-keywords.test.mjs +3 -2
- package/foundation/doc-compiler/tree.d.mts +32 -6
- package/foundation/doc-compiler/tree.mjs +77 -43
- package/foundation/doc-compiler/tree.test.mjs +7 -7
- package/foundation/fs/paths.d.mts +70 -8
- package/foundation/fs/paths.mjs +556 -38
- package/foundation/fs/paths.test.mjs +430 -54
- package/foundation/fs/read-record.d.mts +18 -0
- package/foundation/fs/read-record.mjs +131 -0
- package/foundation/fs/read-record.test.mjs +77 -0
- package/foundation/integrations/autolink.d.mts +2 -1
- package/foundation/integrations/autolink.mjs +4 -13
- package/foundation/integrations/cli-peer-version.d.mts +36 -0
- package/foundation/integrations/cli-peer-version.mjs +132 -0
- package/foundation/integrations/cli-peer-version.test.mjs +354 -0
- package/foundation/integrations/computer-integrations.d.mts +6 -3
- package/foundation/integrations/computer-integrations.mjs +38 -9
- package/foundation/integrations/contribution-inventory.d.mts +15 -20
- package/foundation/integrations/contribution-inventory.mjs +41 -5
- package/foundation/integrations/exports-subpaths.d.mts +57 -0
- package/foundation/integrations/exports-subpaths.mjs +113 -0
- package/foundation/integrations/integrations.d.mts +27 -1
- package/foundation/integrations/integrations.mjs +61 -2
- package/foundation/integrations/public-imports.d.mts +118 -0
- package/foundation/integrations/public-imports.mjs +1769 -0
- package/foundation/integrations/public-imports.test.mjs +1793 -0
- package/foundation/integrations/validate-contributions.d.mts +115 -0
- package/foundation/integrations/validate-contributions.mjs +1168 -13
- package/foundation/release/cache.test.mjs +24 -21
- package/foundation/release/global-state.d.mts +8 -4
- package/foundation/release/global-state.mjs +4 -2
- package/foundation/release/handoff.d.mts +23 -4
- package/foundation/release/handoff.mjs +175 -8
- package/foundation/release/notices.d.mts +62 -8
- package/foundation/release/notices.mjs +136 -25
- package/foundation/release/notices.test.mjs +21 -0
- package/foundation/release/run-context.mjs +14 -0
- package/foundation/response/response-types.doc.mjs +1 -1
- package/foundation/route/route.d.mts +285 -0
- package/foundation/route/route.mjs +324 -0
- package/foundation/route/route.test.mjs +153 -0
- package/foundation/runtime/hosted-runtime.test.mjs +403 -0
- package/foundation/runtime/locked-versions.d.mts +32 -0
- package/foundation/runtime/locked-versions.mjs +65 -0
- package/foundation/runtime/package-root.d.mts +91 -0
- package/foundation/runtime/package-root.mjs +174 -0
- package/foundation/runtime/package-set.d.mts +62 -0
- package/foundation/runtime/package-set.mjs +130 -0
- package/foundation/runtime/package-set.test.mjs +432 -0
- package/foundation/text/string-utils.d.mts +2 -1
- package/foundation/text/string-utils.mjs +16 -5
- package/foundation/text/suggest-order.d.mts +72 -0
- package/foundation/text/suggest-order.mjs +363 -0
- package/foundation/text/suggest-order.test.mjs +259 -0
- package/host/door-conformance.test.mjs +274 -0
- package/host/index.d.ts +116 -0
- package/host/index.mjs +295 -0
- package/host/index.test.mjs +302 -0
- package/package.json +14 -9
package/api/build/_adapter.d.mts
CHANGED
|
@@ -32,6 +32,27 @@
|
|
|
32
32
|
* @returns {Promise<PageTemplate[]>}
|
|
33
33
|
*/
|
|
34
34
|
export function loadPageTemplates(cwd: string): Promise<PageTemplate[]>;
|
|
35
|
+
/**
|
|
36
|
+
* A block the kit can name, as search names a block result.
|
|
37
|
+
* @typedef {object} BlockTemplate
|
|
38
|
+
* @property {string} name The block's own id, as search reports it.
|
|
39
|
+
* @property {string} package The npm package that owns this block.
|
|
40
|
+
* @property {string} displayName Human-facing name.
|
|
41
|
+
* @property {string} description What the block is.
|
|
42
|
+
* @property {string} command `astryx template <id> --type block`, as search prints it.
|
|
43
|
+
*/
|
|
44
|
+
/**
|
|
45
|
+
* Every ready page template and every block the project can scaffold, from one
|
|
46
|
+
* discovery: pages as {@link loadPageTemplates} returns them, blocks as
|
|
47
|
+
* {@link BlockTemplate}. Discovery failures leave both empty.
|
|
48
|
+
*
|
|
49
|
+
* @param {string} cwd
|
|
50
|
+
* @returns {Promise<{pages: PageTemplate[], blocks: BlockTemplate[]}>}
|
|
51
|
+
*/
|
|
52
|
+
export function loadTemplates(cwd: string): Promise<{
|
|
53
|
+
pages: PageTemplate[];
|
|
54
|
+
blocks: BlockTemplate[];
|
|
55
|
+
}>;
|
|
35
56
|
/**
|
|
36
57
|
* The components the project can use, Core's and its integrations', each with
|
|
37
58
|
* the keywords its own doc declares: what the ranker reads to tell a part of a
|
|
@@ -48,6 +69,18 @@ export function loadComponents(cwd: string): Promise<ComponentWords[]>;
|
|
|
48
69
|
* @returns {import('./kit/weights.mjs').WeightsFile | null}
|
|
49
70
|
*/
|
|
50
71
|
export function loadWeights(): import("./kit/weights.mjs").WeightsFile | null;
|
|
72
|
+
/**
|
|
73
|
+
* The classifier weights of build's root (tree.weights.json), read once.
|
|
74
|
+
* @returns {import('../../foundation/route/route.mjs').ClassifierWeights}
|
|
75
|
+
*/
|
|
76
|
+
export function loadTreeWeights(): import("../../foundation/route/route.mjs").ClassifierWeights;
|
|
77
|
+
/**
|
|
78
|
+
* The block picker's weights (blocks/blocks.weights.json), read once; null
|
|
79
|
+
* when the file is absent, unreadable, or not the shape the picker reads, in
|
|
80
|
+
* which case build names its own blocks.
|
|
81
|
+
* @returns {import('./blocks/blocks.mjs').BlockPickerWeights | null}
|
|
82
|
+
*/
|
|
83
|
+
export function loadBlockPicker(): import("./blocks/blocks.mjs").BlockPickerWeights | null;
|
|
51
84
|
/**
|
|
52
85
|
* Whether a parsed weights file has the shape the kit reads: every row has a
|
|
53
86
|
* weight per candidate, every bias a number per candidate, and three blend
|
|
@@ -125,3 +158,28 @@ export type ComponentWords = {
|
|
|
125
158
|
*/
|
|
126
159
|
keywords: string[];
|
|
127
160
|
};
|
|
161
|
+
/**
|
|
162
|
+
* A block the kit can name, as search names a block result.
|
|
163
|
+
*/
|
|
164
|
+
export type BlockTemplate = {
|
|
165
|
+
/**
|
|
166
|
+
* The block's own id, as search reports it.
|
|
167
|
+
*/
|
|
168
|
+
name: string;
|
|
169
|
+
/**
|
|
170
|
+
* The npm package that owns this block.
|
|
171
|
+
*/
|
|
172
|
+
package: string;
|
|
173
|
+
/**
|
|
174
|
+
* Human-facing name.
|
|
175
|
+
*/
|
|
176
|
+
displayName: string;
|
|
177
|
+
/**
|
|
178
|
+
* What the block is.
|
|
179
|
+
*/
|
|
180
|
+
description: string;
|
|
181
|
+
/**
|
|
182
|
+
* `astryx template <id> --type block`, as search prints it.
|
|
183
|
+
*/
|
|
184
|
+
command: string;
|
|
185
|
+
};
|
package/api/build/_adapter.mjs
CHANGED
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
* contribute.
|
|
10
10
|
* @output Ready page templates as `{name, displayName, description, category,
|
|
11
11
|
* keywords, command}`, where `command` is the `astryx template` command that
|
|
12
|
-
* selects exactly that template;
|
|
12
|
+
* selects exactly that template; blocks as search names them; components as
|
|
13
|
+
* `{name, keywords}`; the kit's matcher weights, the root's classifier
|
|
14
|
+
* weights, and the block picker's weights.
|
|
13
15
|
* @position Beside build.mjs (api/build/). The kit leaf reads templates and
|
|
14
16
|
* components only through here, because a subject's `_adapter.mjs` is its
|
|
15
17
|
* only environment access. This adds no discovery of its own: templates come
|
|
@@ -63,13 +65,35 @@ export {withListingCache} from '../../foundation/fs/listing-cache.mjs';
|
|
|
63
65
|
* @returns {Promise<PageTemplate[]>}
|
|
64
66
|
*/
|
|
65
67
|
export async function loadPageTemplates(cwd) {
|
|
68
|
+
return (await loadTemplates(cwd)).pages;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* A block the kit can name, as search names a block result.
|
|
73
|
+
* @typedef {object} BlockTemplate
|
|
74
|
+
* @property {string} name The block's own id, as search reports it.
|
|
75
|
+
* @property {string} package The npm package that owns this block.
|
|
76
|
+
* @property {string} displayName Human-facing name.
|
|
77
|
+
* @property {string} description What the block is.
|
|
78
|
+
* @property {string} command `astryx template <id> --type block`, as search prints it.
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Every ready page template and every block the project can scaffold, from one
|
|
83
|
+
* discovery: pages as {@link loadPageTemplates} returns them, blocks as
|
|
84
|
+
* {@link BlockTemplate}. Discovery failures leave both empty.
|
|
85
|
+
*
|
|
86
|
+
* @param {string} cwd
|
|
87
|
+
* @returns {Promise<{pages: PageTemplate[], blocks: BlockTemplate[]}>}
|
|
88
|
+
*/
|
|
89
|
+
export async function loadTemplates(cwd) {
|
|
66
90
|
let templates;
|
|
67
91
|
try {
|
|
68
92
|
templates = await discoverTemplates(cwd);
|
|
69
93
|
} catch {
|
|
70
|
-
return [];
|
|
94
|
+
return {pages: [], blocks: []};
|
|
71
95
|
}
|
|
72
|
-
|
|
96
|
+
const pages = templates
|
|
73
97
|
.filter(t => t.type === 'page' && t.isReady !== false)
|
|
74
98
|
.map(t => ({
|
|
75
99
|
name: t.dirName,
|
|
@@ -83,6 +107,16 @@ export async function loadPageTemplates(cwd) {
|
|
|
83
107
|
// owns the Core id it names, so that id selects it, not its own.
|
|
84
108
|
command: `astryx template ${t.replaces ?? t.dirName} --type page`,
|
|
85
109
|
}));
|
|
110
|
+
const blocks = templates
|
|
111
|
+
.filter(t => t.type === 'block')
|
|
112
|
+
.map(t => ({
|
|
113
|
+
name: t.dirName,
|
|
114
|
+
package: t.package ?? '@astryxdesign/core',
|
|
115
|
+
displayName: t.name,
|
|
116
|
+
description: t.description || '',
|
|
117
|
+
command: `astryx template ${t.replaces ?? t.dirName} --type block`,
|
|
118
|
+
}));
|
|
119
|
+
return {pages, blocks};
|
|
86
120
|
}
|
|
87
121
|
|
|
88
122
|
/**
|
|
@@ -126,6 +160,48 @@ export function loadWeights() {
|
|
|
126
160
|
return weights ?? null;
|
|
127
161
|
}
|
|
128
162
|
|
|
163
|
+
/** @type {import('../../foundation/route/route.mjs').ClassifierWeights | undefined} */
|
|
164
|
+
let treeWeights;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* The classifier weights of build's root (tree.weights.json), read once.
|
|
168
|
+
* @returns {import('../../foundation/route/route.mjs').ClassifierWeights}
|
|
169
|
+
*/
|
|
170
|
+
export function loadTreeWeights() {
|
|
171
|
+
treeWeights ??= JSON.parse(
|
|
172
|
+
fs.readFileSync(new URL('./tree.weights.json', import.meta.url), 'utf8'),
|
|
173
|
+
);
|
|
174
|
+
return /** @type {import('../../foundation/route/route.mjs').ClassifierWeights} */ (
|
|
175
|
+
treeWeights
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** @type {import('./blocks/blocks.mjs').BlockPickerWeights | null | undefined} */
|
|
180
|
+
let blockPicker;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* The block picker's weights (blocks/blocks.weights.json), read once; null
|
|
184
|
+
* when the file is absent, unreadable, or not the shape the picker reads, in
|
|
185
|
+
* which case build names its own blocks.
|
|
186
|
+
* @returns {import('./blocks/blocks.mjs').BlockPickerWeights | null}
|
|
187
|
+
*/
|
|
188
|
+
export function loadBlockPicker() {
|
|
189
|
+
if (blockPicker === undefined) {
|
|
190
|
+
try {
|
|
191
|
+
const file = JSON.parse(
|
|
192
|
+
fs.readFileSync(
|
|
193
|
+
new URL('./blocks/blocks.weights.json', import.meta.url),
|
|
194
|
+
'utf8',
|
|
195
|
+
),
|
|
196
|
+
);
|
|
197
|
+
blockPicker = isBlockPickerWeights(file) ? file : null;
|
|
198
|
+
} catch {
|
|
199
|
+
blockPicker = null;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return blockPicker ?? null;
|
|
203
|
+
}
|
|
204
|
+
|
|
129
205
|
/**
|
|
130
206
|
* Whether a parsed weights file has the shape the kit reads: every row has a
|
|
131
207
|
* weight per candidate, every bias a number per candidate, and three blend
|
|
@@ -159,6 +235,54 @@ export function isWeightsFile(file) {
|
|
|
159
235
|
);
|
|
160
236
|
}
|
|
161
237
|
|
|
238
|
+
/** The ranking coefficients the picker reads. */
|
|
239
|
+
const PICKER_THETA = [
|
|
240
|
+
'g',
|
|
241
|
+
'grank',
|
|
242
|
+
'gmargin',
|
|
243
|
+
'seen',
|
|
244
|
+
'lex',
|
|
245
|
+
'sscore',
|
|
246
|
+
'scov',
|
|
247
|
+
'srank',
|
|
248
|
+
'inkit',
|
|
249
|
+
'kitpos',
|
|
250
|
+
'mention',
|
|
251
|
+
'show',
|
|
252
|
+
];
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Whether a parsed block picker file has the shape the picker reads: a
|
|
256
|
+
* vocabulary with an idf per entry, two signed byte matrices of vocabulary x
|
|
257
|
+
* dims (base64) with their scales, the lexical weight, the known blocks, and
|
|
258
|
+
* the ranking coefficients.
|
|
259
|
+
* @param {any} w
|
|
260
|
+
* @returns {w is import('./blocks/blocks.mjs').BlockPickerWeights}
|
|
261
|
+
*/
|
|
262
|
+
function isBlockPickerWeights(w) {
|
|
263
|
+
const n = Array.isArray(w?.vocab) ? w.vocab.length : 0;
|
|
264
|
+
const size = (/** @type {unknown} */ s) =>
|
|
265
|
+
typeof s === 'string' ? Buffer.from(s, 'base64').length : -1;
|
|
266
|
+
return (
|
|
267
|
+
n > 0 &&
|
|
268
|
+
w.vocab.every((/** @type {unknown} */ t) => typeof t === 'string') &&
|
|
269
|
+
Array.isArray(w.idf) &&
|
|
270
|
+
w.idf.length === n &&
|
|
271
|
+
w.idf.every((/** @type {unknown} */ x) => Number.isFinite(x)) &&
|
|
272
|
+
Number.isInteger(w.dims) &&
|
|
273
|
+
w.dims > 0 &&
|
|
274
|
+
size(w.request) === n * w.dims &&
|
|
275
|
+
size(w.doc) === n * w.dims &&
|
|
276
|
+
Number.isFinite(w.requestScale) &&
|
|
277
|
+
Number.isFinite(w.docScale) &&
|
|
278
|
+
Number.isFinite(w.lexical) &&
|
|
279
|
+
Array.isArray(w.known) &&
|
|
280
|
+
w.known.every((/** @type {unknown} */ b) => typeof b === 'string') &&
|
|
281
|
+
!!w.theta &&
|
|
282
|
+
PICKER_THETA.every(k => Number.isFinite(w.theta[k]))
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
|
|
162
286
|
/**
|
|
163
287
|
* Analyze what a start template needs that the project lacks. The kit leaf
|
|
164
288
|
* calls this through the adapter rather than reading the file itself, because
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A word with a plural or verb ending removed (words over four letters):
|
|
6
|
+
* "-ies" becomes "-y"; "-es" goes only after s, x, z, ch, or sh; otherwise a
|
|
7
|
+
* final "s" goes, but never after another "s"; then "-ing" or "-ed".
|
|
8
|
+
* @param {string} w
|
|
9
|
+
* @returns {string}
|
|
10
|
+
*/
|
|
11
|
+
export function stemOf(w: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* An identifier's words, lowercase: "SideNavNestedItems" -> side, nav,
|
|
14
|
+
* nested, items.
|
|
15
|
+
* @param {string} text
|
|
16
|
+
* @returns {string[]}
|
|
17
|
+
*/
|
|
18
|
+
export function wordsOf(text: string): string[];
|
|
19
|
+
/**
|
|
20
|
+
* A text's stemmed content words, then its adjacent pairs as `a_b`.
|
|
21
|
+
* @param {string} text
|
|
22
|
+
* @returns {string[]}
|
|
23
|
+
*/
|
|
24
|
+
export function termsOf(text: string): string[];
|
|
25
|
+
/**
|
|
26
|
+
* The blocks build names for a request, ranked by the picker.
|
|
27
|
+
* @param {string} request
|
|
28
|
+
* @param {{kitBlocks: string[], searched: BlockScore[], foreign: string[], catalog: CatalogBlock[], components: CatalogComponent[]}} signals
|
|
29
|
+
* @param {BlockPickerWeights} weights
|
|
30
|
+
* @returns {{names: string[], entries: Map<string, SearchResultEntry>}} as
|
|
31
|
+
* many names as build's own list, best first; an entry for each listed
|
|
32
|
+
* block search did not return
|
|
33
|
+
*/
|
|
34
|
+
export function pickBlocks(request: string, signals: {
|
|
35
|
+
kitBlocks: string[];
|
|
36
|
+
searched: BlockScore[];
|
|
37
|
+
foreign: string[];
|
|
38
|
+
catalog: CatalogBlock[];
|
|
39
|
+
components: CatalogComponent[];
|
|
40
|
+
}, weights: BlockPickerWeights): {
|
|
41
|
+
names: string[];
|
|
42
|
+
entries: Map<string, SearchResultEntry>;
|
|
43
|
+
};
|
|
44
|
+
export type BlockPickerWeights = {
|
|
45
|
+
/**
|
|
46
|
+
* stemmed words and `a_b` word pairs
|
|
47
|
+
*/
|
|
48
|
+
vocab: string[];
|
|
49
|
+
/**
|
|
50
|
+
* one per vocab entry, x1024
|
|
51
|
+
*/
|
|
52
|
+
idf: number[];
|
|
53
|
+
/**
|
|
54
|
+
* the width of the shared space
|
|
55
|
+
*/
|
|
56
|
+
dims: number;
|
|
57
|
+
/**
|
|
58
|
+
* base64 bytes, vocab.length x dims, row-major, each a signed weight offset by 128
|
|
59
|
+
*/
|
|
60
|
+
request: string;
|
|
61
|
+
requestScale: number;
|
|
62
|
+
/**
|
|
63
|
+
* base64 bytes, vocab.length x dims, row-major, each a signed weight offset by 128
|
|
64
|
+
*/
|
|
65
|
+
doc: string;
|
|
66
|
+
docScale: number;
|
|
67
|
+
/**
|
|
68
|
+
* the weight of the plain overlap
|
|
69
|
+
*/
|
|
70
|
+
lexical: number;
|
|
71
|
+
/**
|
|
72
|
+
* the blocks the matrices were fitted with
|
|
73
|
+
*/
|
|
74
|
+
known: string[];
|
|
75
|
+
/**
|
|
76
|
+
* the ranking coefficients
|
|
77
|
+
*/
|
|
78
|
+
theta: Record<string, number>;
|
|
79
|
+
};
|
|
80
|
+
export type BlockScore = import("../kit/signals.mjs").BlockScore;
|
|
81
|
+
export type CatalogBlock = {
|
|
82
|
+
name: string;
|
|
83
|
+
package?: string;
|
|
84
|
+
displayName?: string;
|
|
85
|
+
description?: string;
|
|
86
|
+
command?: string;
|
|
87
|
+
};
|
|
88
|
+
export type CatalogComponent = {
|
|
89
|
+
name: string;
|
|
90
|
+
keywords?: string[];
|
|
91
|
+
};
|
|
92
|
+
export type SearchResultEntry = import("../../search/search.type.mjs").SearchResultEntry;
|