@design-ai/cli 4.55.0 → 4.57.0
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/.claude-plugin/plugin.json +109 -25
- package/CHANGELOG.md +75 -0
- package/README.ko.md +15 -32
- package/README.md +18 -31
- package/cli/bin/design-ai.mjs +1 -0
- package/cli/commands/help.mjs +7 -4
- package/cli/commands/index.mjs +292 -0
- package/cli/commands/learn-help.mjs +149 -0
- package/cli/commands/learn-print-profile.mjs +373 -0
- package/cli/commands/learn-print-restore.mjs +349 -0
- package/cli/commands/learn-print-signals.mjs +453 -0
- package/cli/commands/learn.mjs +60 -1281
- package/cli/commands/pack.mjs +7 -3
- package/cli/commands/prompt.mjs +7 -3
- package/cli/commands/search.mjs +94 -1
- package/cli/lib/dispatch.mjs +3 -0
- package/cli/lib/embedding-index.mjs +199 -0
- package/cli/lib/embedding-provider.mjs +121 -0
- package/cli/lib/embedding-rerank.mjs +52 -0
- package/cli/lib/learn-args.mjs +490 -0
- package/cli/lib/learn-backup.mjs +748 -0
- package/cli/lib/learn-curation.mjs +612 -0
- package/cli/lib/learn-eval.mjs +459 -0
- package/cli/lib/learn-profile.mjs +763 -0
- package/cli/lib/learn-select.mjs +223 -0
- package/cli/lib/learn-shared.mjs +158 -0
- package/cli/lib/learn-test-support.mjs +218 -0
- package/cli/lib/learn-usage.mjs +360 -0
- package/cli/lib/learn.mjs +83 -3694
- package/cli/lib/lexical.mjs +137 -0
- package/cli/lib/local-config.mjs +110 -0
- package/cli/lib/mcp-server.mjs +221 -13
- package/cli/lib/pack.mjs +31 -4
- package/cli/lib/prompt.mjs +42 -4
- package/cli/lib/recall.mjs +193 -0
- package/cli/lib/retrieval-index.mjs +0 -0
- package/cli/lib/search-ranked.mjs +170 -0
- package/cli/lib/search.mjs +11 -1
- package/cli/lib/signals-backlog-commands.mjs +673 -0
- package/cli/lib/signals-backlog.mjs +361 -0
- package/cli/lib/signals-eval.mjs +176 -0
- package/cli/lib/signals-readiness.mjs +247 -0
- package/cli/lib/signals-registry.mjs +377 -0
- package/cli/lib/signals-render.mjs +478 -0
- package/cli/lib/signals-shared.mjs +75 -0
- package/cli/lib/signals.mjs +16 -2337
- package/cli/lib/site-analysis.mjs +297 -0
- package/cli/lib/site-args.mjs +433 -0
- package/cli/lib/site-bundle-build.mjs +127 -0
- package/cli/lib/site-bundle-check.mjs +454 -0
- package/cli/lib/site-bundle-commands.mjs +95 -0
- package/cli/lib/site-bundle-compare.mjs +157 -0
- package/cli/lib/site-bundle-contract.mjs +79 -0
- package/cli/lib/site-bundle-files.mjs +87 -0
- package/cli/lib/site-bundle-handoff-expected.mjs +173 -0
- package/cli/lib/site-bundle-handoff-runbook-action-summary.mjs +332 -0
- package/cli/lib/site-bundle-handoff-runbook-actions.mjs +113 -0
- package/cli/lib/site-bundle-handoff-runbook-evidence-fields.mjs +164 -0
- package/cli/lib/site-bundle-handoff-runbook-evidence.mjs +334 -0
- package/cli/lib/site-bundle-handoff-runbook-format.mjs +31 -0
- package/cli/lib/site-bundle-handoff-runbook-human-lines.mjs +167 -0
- package/cli/lib/site-bundle-handoff-runbook-maps.mjs +238 -0
- package/cli/lib/site-bundle-handoff-runbook-next-step.mjs +278 -0
- package/cli/lib/site-bundle-handoff-runbook-stage-metadata.mjs +84 -0
- package/cli/lib/site-bundle-handoff-runbook.mjs +444 -0
- package/cli/lib/site-bundle-handoff-summary.mjs +183 -0
- package/cli/lib/site-bundle-handoff.mjs +271 -0
- package/cli/lib/site-bundle-readme.mjs +98 -0
- package/cli/lib/site-bundle-repair-report.mjs +143 -0
- package/cli/lib/site-bundle-repair.mjs +68 -0
- package/cli/lib/site-content.mjs +399 -0
- package/cli/lib/site-evidence.mjs +35 -0
- package/cli/lib/site-mcp-commands.mjs +28 -0
- package/cli/lib/site-mcp-probes.mjs +159 -0
- package/cli/lib/site-mcp-readiness.mjs +157 -0
- package/cli/lib/site-mcp-report.mjs +324 -0
- package/cli/lib/site-next-actions.mjs +333 -0
- package/cli/lib/site-options.mjs +104 -0
- package/cli/lib/site-prompts.mjs +332 -0
- package/cli/lib/site-starter.mjs +153 -0
- package/cli/lib/site-strings.mjs +23 -0
- package/cli/lib/site-tasks.mjs +93 -0
- package/cli/lib/site-test-support.mjs +68 -0
- package/cli/lib/site-workflow-graph.mjs +309 -0
- package/cli/lib/site-workspace.mjs +492 -0
- package/cli/lib/site.mjs +108 -6617
- package/cli/lib/skill-proposals-apply-commands.mjs +135 -0
- package/cli/lib/skill-proposals-apply-contract.mjs +750 -0
- package/cli/lib/skill-proposals-apply-plan.mjs +118 -0
- package/cli/lib/skill-proposals-generate.mjs +298 -0
- package/cli/lib/skill-proposals-render.mjs +532 -0
- package/cli/lib/skill-proposals-review.mjs +262 -0
- package/cli/lib/skill-proposals.mjs +15 -2046
- package/cli/lib/workspace-args.mjs +83 -0
- package/cli/lib/workspace-git.mjs +169 -0
- package/cli/lib/workspace-learning.mjs +483 -0
- package/cli/lib/workspace-repo.mjs +139 -0
- package/cli/lib/workspace-report.mjs +283 -0
- package/cli/lib/workspace-test-support.mjs +99 -0
- package/cli/lib/workspace.mjs +30 -1056
- package/docs/AI-LEARNING-PHASE2.md +215 -0
- package/docs/DISTRIBUTION.ko.md +35 -6
- package/docs/DISTRIBUTION.md +35 -8
- package/docs/NEXT-SURFACE-DECISION.md +125 -0
- package/docs/PRODUCT-READINESS.md +3 -3
- package/docs/RELEASE-CHECKLIST.md +20 -3
- package/docs/RELEASE-GATES.ko.md +35 -0
- package/docs/RELEASE-GATES.md +234 -0
- package/docs/ROADMAP.md +2232 -8
- package/docs/external-status.md +20 -7
- package/docs/inspection-20260630.md +169 -0
- package/docs/integrations/design-ai-mcp-server.md +35 -3
- package/docs/integrations/vscode-walkthrough.ko.md +3 -3
- package/docs/integrations/vscode-walkthrough.md +3 -3
- package/docs/reference/ant-design.md +413 -0
- package/docs/reference/awesome-design-md.md +439 -0
- package/docs/reference/mui.md +783 -0
- package/docs/reference/shadcn-ui.md +298 -0
- package/docs/site-overrides/main.html +1 -1
- package/examples/component-accordion-actions.md +5 -5
- package/examples/component-accordion-details.md +5 -5
- package/examples/component-accordion-summary.md +5 -5
- package/examples/component-accordion.md +3 -3
- package/examples/component-affix.md +1 -1
- package/examples/component-alert-dialog.md +1 -1
- package/examples/component-alert-title.md +1 -1
- package/examples/component-alert.md +3 -3
- package/examples/component-anchor.md +1 -1
- package/examples/component-app-bar.md +1 -1
- package/examples/component-aspect-ratio.md +1 -1
- package/examples/component-auto-complete.md +2 -2
- package/examples/component-avatar-group.md +5 -5
- package/examples/component-avatar.md +3 -3
- package/examples/component-back-top.md +1 -1
- package/examples/component-backdrop.md +1 -1
- package/examples/component-badge.md +3 -3
- package/examples/component-border-beam.md +3 -3
- package/examples/component-bottom-navigation.md +1 -1
- package/examples/component-box.md +1 -1
- package/examples/component-breadcrumb.md +3 -3
- package/examples/component-button-base.md +3 -3
- package/examples/component-button-group.md +2 -2
- package/examples/component-button.md +3 -3
- package/examples/component-calendar.md +2 -2
- package/examples/component-card-actions.md +1 -1
- package/examples/component-card-content.md +1 -1
- package/examples/component-card-header.md +1 -1
- package/examples/component-card-media.md +1 -1
- package/examples/component-card.md +3 -3
- package/examples/component-carousel.md +2 -2
- package/examples/component-cascader.md +1 -1
- package/examples/component-chart.md +1 -1
- package/examples/component-checkbox.md +3 -3
- package/examples/component-click-away-listener.md +1 -1
- package/examples/component-code.md +1 -1
- package/examples/component-collapsible.md +1 -1
- package/examples/component-color-picker.md +1 -1
- package/examples/component-combobox.md +1 -1
- package/examples/component-command.md +1 -1
- package/examples/component-config-provider.md +3 -3
- package/examples/component-context-menu.md +1 -1
- package/examples/component-css-baseline.md +3 -3
- package/examples/component-date-picker.md +2 -2
- package/examples/component-descriptions.md +1 -1
- package/examples/component-dialog-actions.md +1 -1
- package/examples/component-dialog-content-text.md +1 -1
- package/examples/component-dialog-content.md +1 -1
- package/examples/component-dialog-title.md +1 -1
- package/examples/component-dialog.md +2 -2
- package/examples/component-divider.md +3 -3
- package/examples/component-drawer.md +3 -3
- package/examples/component-dropdown.md +3 -3
- package/examples/component-empty.md +2 -2
- package/examples/component-fade.md +1 -1
- package/examples/component-field.md +1 -1
- package/examples/component-filled-input.md +1 -1
- package/examples/component-flex.md +1 -1
- package/examples/component-float-button.md +2 -2
- package/examples/component-form-control-label.md +1 -1
- package/examples/component-form-control.md +1 -1
- package/examples/component-form-controls.md +1 -1
- package/examples/component-form-group.md +1 -1
- package/examples/component-form-helper-text.md +1 -1
- package/examples/component-form-label.md +1 -1
- package/examples/component-form.md +2 -2
- package/examples/component-grid.md +2 -2
- package/examples/component-grow.md +1 -1
- package/examples/component-hover-card.md +1 -1
- package/examples/component-icon-button.md +1 -1
- package/examples/component-icon.md +1 -1
- package/examples/component-image-list.md +1 -1
- package/examples/component-image.md +1 -1
- package/examples/component-input-adornment.md +1 -1
- package/examples/component-input-base.md +1 -1
- package/examples/component-input-number.md +1 -1
- package/examples/component-input-otp.md +2 -2
- package/examples/component-input.md +3 -3
- package/examples/component-item.md +1 -1
- package/examples/component-label.md +1 -1
- package/examples/component-layout.md +1 -1
- package/examples/component-link.md +1 -1
- package/examples/component-list-item-avatar.md +1 -1
- package/examples/component-list-item-button.md +1 -1
- package/examples/component-list-item-icon.md +1 -1
- package/examples/component-list-item-text.md +1 -1
- package/examples/component-list-item.md +1 -1
- package/examples/component-list-subheader.md +1 -1
- package/examples/component-list.md +2 -2
- package/examples/component-masonry.md +1 -1
- package/examples/component-mentions.md +1 -1
- package/examples/component-menu-item.md +1 -1
- package/examples/component-menu-list.md +1 -1
- package/examples/component-menu.md +1 -1
- package/examples/component-menubar.md +1 -1
- package/examples/component-message.md +1 -1
- package/examples/component-mobile-stepper.md +1 -1
- package/examples/component-modal.md +5 -5
- package/examples/component-navigation-menu.md +1 -1
- package/examples/component-notification.md +1 -1
- package/examples/component-outlined-input.md +1 -1
- package/examples/component-pagination.md +3 -3
- package/examples/component-paper.md +1 -1
- package/examples/component-popconfirm.md +1 -1
- package/examples/component-popover.md +3 -3
- package/examples/component-popper.md +1 -1
- package/examples/component-progress.md +2 -2
- package/examples/component-qr-code.md +1 -1
- package/examples/component-radio.md +3 -3
- package/examples/component-rate.md +2 -2
- package/examples/component-resizable.md +1 -1
- package/examples/component-result.md +1 -1
- package/examples/component-scroll-area.md +1 -1
- package/examples/component-segmented.md +3 -3
- package/examples/component-select.md +3 -3
- package/examples/component-separator.md +1 -1
- package/examples/component-sheet.md +1 -1
- package/examples/component-sidebar.md +1 -1
- package/examples/component-skeleton.md +3 -3
- package/examples/component-slide.md +1 -1
- package/examples/component-slider.md +3 -3
- package/examples/component-snackbar-content.md +1 -1
- package/examples/component-snackbar.md +1 -1
- package/examples/component-sonner.md +1 -1
- package/examples/component-space.md +1 -1
- package/examples/component-speed-dial-action.md +1 -1
- package/examples/component-speed-dial.md +1 -1
- package/examples/component-spin.md +2 -2
- package/examples/component-spinner.md +1 -1
- package/examples/component-splitter.md +2 -2
- package/examples/component-stack.md +1 -1
- package/examples/component-statistic.md +1 -1
- package/examples/component-step-button.md +4 -4
- package/examples/component-step-connector.md +4 -4
- package/examples/component-step-content.md +1 -1
- package/examples/component-step-icon.md +1 -1
- package/examples/component-step-label.md +1 -1
- package/examples/component-step.md +2 -2
- package/examples/component-steps.md +2 -2
- package/examples/component-swipeable-drawer.md +1 -1
- package/examples/component-switch.md +3 -3
- package/examples/component-tab-scroll-button.md +5 -5
- package/examples/component-tab.md +1 -1
- package/examples/component-table-body.md +1 -1
- package/examples/component-table-cell.md +1 -1
- package/examples/component-table-container.md +1 -1
- package/examples/component-table-footer.md +1 -1
- package/examples/component-table-head.md +1 -1
- package/examples/component-table-pagination.md +1 -1
- package/examples/component-table-row.md +1 -1
- package/examples/component-table-sort-label.md +1 -1
- package/examples/component-table.md +2 -2
- package/examples/component-tabs.md +3 -3
- package/examples/component-tag-badge.md +2 -2
- package/examples/component-tag.md +1 -1
- package/examples/component-textarea-autosize.md +1 -1
- package/examples/component-textarea.md +1 -1
- package/examples/component-time-picker.md +1 -1
- package/examples/component-timeline.md +1 -1
- package/examples/component-toast.md +4 -4
- package/examples/component-toggle-button.md +1 -1
- package/examples/component-toggle.md +1 -1
- package/examples/component-toolbar.md +1 -1
- package/examples/component-tooltip.md +3 -3
- package/examples/component-tour.md +1 -1
- package/examples/component-transfer.md +1 -1
- package/examples/component-tree-select.md +1 -1
- package/examples/component-tree.md +1 -1
- package/examples/component-typography.md +2 -2
- package/examples/component-upload.md +1 -1
- package/examples/component-watermark.md +1 -1
- package/examples/component-zoom.md +1 -1
- package/knowledge/COVERAGE.md +4 -3
- package/knowledge/components/INDEX.md +202 -202
- package/knowledge/patterns/brand-references.md +72 -72
- package/package.json +1 -1
- package/tools/audit/local-ci.py +16 -1
- package/tools/audit/package-smoke.py +717 -9
- package/tools/audit/registry-smoke.py +912 -10
- package/tools/audit/release-metadata.py +47 -1
- package/tools/audit/smoke_assertions.py +998 -35
- package/tools/migrations/refs-links-to-reference-pages.py +179 -0
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://github.com/sungjin9288/design-ai/actions/workflows/audit.yml)
|
|
4
4
|
[](https://sungjin9288.github.io/design-ai/)
|
|
5
5
|
[](knowledge/PRINCIPLES.md)
|
|
6
|
-
[](examples/README.md)
|
|
7
7
|
[](skills/README.md)
|
|
8
8
|
|
|
9
9
|
> 🇺🇸 English / [🇰🇷 한국어](https://github.com/sungjin9288/design-ai/blob/main/README.ko.md)
|
|
@@ -12,14 +12,14 @@ A model-agnostic design knowledge base + skill system. Drop it in front of any A
|
|
|
12
12
|
|
|
13
13
|
> **Not a model. Not a fine-tune.** A structured corpus of design expertise + agent-ready instructions that turn a general-purpose LLM into an expert.
|
|
14
14
|
|
|
15
|
-
> **Distribution status, checked 2026-
|
|
15
|
+
> **Distribution status, checked 2026-07-02:** local `npm run release:check` passes, GitHub Pages docs are live, GitHub Release `v4.56.0` is published, `@design-ai/cli@4.56.0` is public on npm with registry smoke coverage, the Homebrew formula is pinned to `v4.56.0`, and `sungjin.design-ai-vscode@0.4.1` is public on the VS Code Marketplace. See [`docs/external-status.md`](docs/external-status.md).
|
|
16
16
|
|
|
17
17
|
## Coverage at a glance
|
|
18
18
|
|
|
19
19
|
| Domain | Knowledge | Worked examples | Skill |
|
|
20
20
|
|---|---|---|---|
|
|
21
21
|
| Design tokens (W3C DTCG, OKLCH) | ✓ | ✓ | `color-palette` |
|
|
22
|
-
| Components (Ant + MUI + shadcn synthesis) | ✓ |
|
|
22
|
+
| Components (Ant + MUI + shadcn synthesis) | ✓ | 210 component specs | `component-spec-writer` |
|
|
23
23
|
| UX patterns (auth, pricing, hero, forms, etc.) | ✓ | ✓ | `ux-audit`, `design-critique` |
|
|
24
24
|
| Website improvement control tower | ✓ | ✓ | `website-improvement` |
|
|
25
25
|
| Korean i18n (Hangul, payments, app store, fintech) | ✓ | ✓ | (cross-cutting) |
|
|
@@ -34,7 +34,7 @@ A model-agnostic design knowledge base + skill system. Drop it in front of any A
|
|
|
34
34
|
|
|
35
35
|
## Install (Claude Code)
|
|
36
36
|
|
|
37
|
-
### Option A: Git clone / local install
|
|
37
|
+
### Option A: Git clone / local install
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
40
|
git clone https://github.com/sungjin9288/design-ai.git
|
|
@@ -42,9 +42,9 @@ cd design-ai
|
|
|
42
42
|
./install.sh
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
-
### Option B: NPM
|
|
45
|
+
### Option B: NPM
|
|
46
46
|
|
|
47
|
-
Use this path
|
|
47
|
+
Use this path for the public npm package.
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
50
|
npx @design-ai/cli install
|
|
@@ -57,7 +57,7 @@ npm install -g @design-ai/cli
|
|
|
57
57
|
design-ai install
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
### Option C: Homebrew
|
|
60
|
+
### Option C: Homebrew tap
|
|
61
61
|
|
|
62
62
|
```bash
|
|
63
63
|
brew tap sungjin9288/design-ai https://github.com/sungjin9288/design-ai.git
|
|
@@ -75,7 +75,7 @@ Any available path installs all 20 skills, 17 commands, and 4 agents under `~/.c
|
|
|
75
75
|
/design-from-brief Korean fintech for freelancers
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
CLI commands: `design-ai install [--json]`, `update [--dry-run] [--json]`, `uninstall [--json]`, `status [--json]`, `list [skills|commands|agents] [--json]`, `route <brief|--from-file file|--stdin|--list|--eval-template|--eval> [--limit N] [--explain] [--strict] [--json]`, `routes [--json]`, `prompt <brief|--from-file file|--stdin|--eval-template|--eval> [--out file] [--route id] [--with-learning] [--learning-category kind] [--learning-limit N] [--strict] [--json]`, `pack <brief|--from-file file|--stdin|--eval-template|--eval> [--out file] [--route id] [--with-learning] [--learning-category kind] [--learning-limit N] [--max-bytes N] [--strict] [--json]`, `learn [--init|--remember text|--feedback text|--list|--export|--query text|--explain|--backup|--redact|--verify|--diff|--restore|--restore-backups [--prune]|--import|--audit [--fix]|--curate|--stats|--usage|--signals [--strict]|--agent-backlog [--strict]|--propose-skills [--min-evidence N] [--review-file path] [--review-check|--apply-plan] [--strict]|--eval-template|--eval [--strict]|--forget id|--clear] [--json|--report|--patch|--review-template] [--out file]`, `check <artifact.md|--stdin|--examples> [--route id|--all-routes] [--issues-only] [--strict] [--learn [--yes] [--learning-file path]] [--json]`, `workspace [--root path] [--learning-file path] [--learning-usage path] [--learning-eval path] [--strict] [--json]`, `site <workspace.json|--stdin> [--strict] [--json|--mcp-check [--probes]|--mcp-plan [--probes] [--json]|--next-actions [--json]|--graph|--tasks|--bundle|--report|--prompts|--prompt id [--task id]] [--out file] | site <bundle-dir> --bundle-check [--json] | site <bundle-dir> --bundle-compare other-bundle-dir [--json] | site <bundle-dir> --bundle-handoff [--task id] [--json] | site <bundle-dir> --bundle-repair [--yes] [--json] [--out file] | site --init --name name --live-url url [--next-actions] [--out file] | site --init --name name --live-url url --bundle --out dir | site --from-intake file.md|--stdin [--json|--next-actions [--json]|--tasks|--bundle [--tasks] --out dir] [--out file] | site --intake-template [--language en|ko] [--json] [--out file] | site --sample [--out file] | site --prompt-list [--json]`, `examples [query|--route id] [--limit N] [--json]`, `search <query> [--dir kind] [--limit N] [--json]`, `show <file[:line]> [--lines N:M] [--context N] [--json]`, `audit [--strict] [--quiet] [--json]`, `doctor [--strict] [--json] [--fix]`, `mcp`, `version [--json]`, `help [command|--json]`.
|
|
78
|
+
CLI commands: `design-ai install [--json]`, `update [--dry-run] [--json]`, `uninstall [--json]`, `status [--json]`, `list [skills|commands|agents] [--json]`, `route <brief|--from-file file|--stdin|--list|--eval-template|--eval> [--limit N] [--explain] [--strict] [--json]`, `routes [--json]`, `prompt <brief|--from-file file|--stdin|--eval-template|--eval> [--out file] [--route id] [--with-learning] [--learning-category kind] [--learning-limit N] [--with-recall] [--recall-limit N] [--strict] [--json]`, `pack <brief|--from-file file|--stdin|--eval-template|--eval> [--out file] [--route id] [--with-learning] [--learning-category kind] [--learning-limit N] [--with-recall] [--recall-limit N] [--max-bytes N] [--strict] [--json]`, `learn [--init|--remember text|--feedback text|--list|--export|--query text|--explain|--recall query|--backup|--redact|--verify|--diff|--restore|--restore-backups [--prune]|--import|--audit [--fix]|--curate|--stats|--usage|--signals [--strict]|--agent-backlog [--strict]|--propose-skills [--min-evidence N] [--review-file path] [--review-check|--apply-plan] [--strict]|--eval-template|--eval [--strict]|--forget id|--clear] [--json|--report|--patch|--review-template] [--out file]`, `check <artifact.md|--stdin|--examples> [--route id|--all-routes] [--issues-only] [--strict] [--learn [--yes] [--learning-file path]] [--json]`, `workspace [--root path] [--learning-file path] [--learning-usage path] [--learning-eval path] [--strict] [--json]`, `site <workspace.json|--stdin> [--strict] [--json|--mcp-check [--probes]|--mcp-plan [--probes] [--json]|--next-actions [--json]|--graph|--tasks|--bundle|--report|--prompts|--prompt id [--task id]] [--out file] | site <bundle-dir> --bundle-check [--json] | site <bundle-dir> --bundle-compare other-bundle-dir [--json] | site <bundle-dir> --bundle-handoff [--task id] [--json] | site <bundle-dir> --bundle-repair [--yes] [--json] [--out file] | site --init --name name --live-url url [--next-actions] [--out file] | site --init --name name --live-url url --bundle --out dir | site --from-intake file.md|--stdin [--json|--next-actions [--json]|--tasks|--bundle [--tasks] --out dir] [--out file] | site --intake-template [--language en|ko] [--json] [--out file] | site --sample [--out file] | site --prompt-list [--json]`, `examples [query|--route id] [--limit N] [--json]`, `search <query> [--dir kind] [--limit N] [--ranked] [--embeddings [--provider "cmd args"]] [--json]`, `index [--build|--status|--verify] [--json] [--embeddings [--provider "cmd args"]]`, `show <file[:line]> [--lines N:M] [--context N] [--json]`, `audit [--strict] [--quiet] [--json]`, `doctor [--strict] [--json] [--fix]`, `mcp`, `version [--json]`, `help [command|--json]`.
|
|
79
79
|
|
|
80
80
|
See [`docs/DISTRIBUTION.md`](docs/DISTRIBUTION.md) for the full distribution guide.
|
|
81
81
|
|
|
@@ -88,7 +88,7 @@ See [`docs/DISTRIBUTION.md`](docs/DISTRIBUTION.md) for the full distribution gui
|
|
|
88
88
|
| **Cursor** | Open this dir; symlink or copy `AGENTS.md` to `.cursorrules`. [Walkthrough](docs/integrations/cursor-walkthrough.md). |
|
|
89
89
|
| **Aider** | Pass `AGENTS.md` as system prompt. [Walkthrough](docs/integrations/aider-walkthrough.md). |
|
|
90
90
|
| **Anthropic / OpenAI SDK** | Embed relevant skill `PLAYBOOK.md` files in your prompt. [Walkthrough](docs/integrations/sdk-walkthrough.md). |
|
|
91
|
-
| **VS Code** |
|
|
91
|
+
| **VS Code** | Install the public Marketplace extension for sidebar trees + quick-pick commands. [Walkthrough](docs/integrations/vscode-walkthrough.md). |
|
|
92
92
|
| **Plain prompt** | Paste any `skills/*/PLAYBOOK.md` body — each is self-contained. |
|
|
93
93
|
|
|
94
94
|
See [`docs/USING.md`](docs/USING.md) for per-agent setup details, or the linked walkthroughs for concrete example sessions.
|
|
@@ -125,7 +125,7 @@ design-ai/
|
|
|
125
125
|
│ ├── spatial/ # VR / AR / panels / comfort
|
|
126
126
|
│ └── i18n/ # Korean typography, payments, app store, ...
|
|
127
127
|
│
|
|
128
|
-
├── examples/ #
|
|
128
|
+
├── examples/ # 221 worked outputs (what "good" looks like)
|
|
129
129
|
│
|
|
130
130
|
├── skills/ # 20 reusable playbooks (task-focused)
|
|
131
131
|
│ ├── design-system-builder/ illustration-designer/
|
|
@@ -213,9 +213,11 @@ Refresh refs/ on demand: `./tools/extractors/run-all.sh`.
|
|
|
213
213
|
|
|
214
214
|
## Status
|
|
215
215
|
|
|
216
|
-
See [`docs/ROADMAP.md`](docs/ROADMAP.md) for the full phase log and [`docs/PRODUCT-READINESS.md`](docs/PRODUCT-READINESS.md) for the current completion boundary. Currently at **v4.
|
|
216
|
+
See [`docs/ROADMAP.md`](docs/ROADMAP.md) for the full phase log and [`docs/PRODUCT-READINESS.md`](docs/PRODUCT-READINESS.md) for the current completion boundary. Currently at **v4.56.0**: public npm publish, provenance-backed GitHub Actions release, public registry smoke, Website Console MCP readiness, workspace learning restore/eval coverage, handoff bundle verification, and 90%+ component coverage are complete.
|
|
217
217
|
|
|
218
|
-
Core design consulting workflows are locally release-ready. The website improvement control tower
|
|
218
|
+
Core design consulting workflows are locally release-ready. The website improvement control tower ships as a zero-dependency static Web App plus a `website-improvement` route/skill/command, covering Site Profiles, audit checklists, MCP readiness, refactor prompts, handoff evidence tracking, and bundle export/verify/repair. Local learning preferences are available through `design-ai learn` — profile bootstrap, feedback capture, a read-only signals registry, skill-proposal generation from repeated QA signals, and full backup/restore/curate/audit tooling, all local-only and opt-in. AI model training or fine-tuning remains outside the shipped scope.
|
|
219
|
+
|
|
220
|
+
Full assertion-level detail for every one of the surfaces above — including every `learn`, `site`, and `workspace` flag and what it verifies — lives in [`docs/RELEASE-GATES.md`](docs/RELEASE-GATES.md).
|
|
219
221
|
|
|
220
222
|
The corpus has been audited under CI checks since v1.7. It currently runs 8 audits:
|
|
221
223
|
- Frontmatter validity
|
|
@@ -232,31 +234,16 @@ All 8 pass on every commit to `main`.
|
|
|
232
234
|
## Contributing
|
|
233
235
|
|
|
234
236
|
See [`docs/CONTRIBUTING.md`](docs/CONTRIBUTING.md). The bar:
|
|
235
|
-
- Run `npm run release:check` as the core gate before release PRs or tags. It
|
|
236
|
-
-
|
|
237
|
-
- The same `npm run release:check` gate also preserves Website Console bundle boundary metadata guard phases for bundle-check JSON/human and bundle-handoff JSON/prompt boundary metadata plus full `release:self-test` evidence recording through unit tests, strict audits, whitespace checks, package contents, release metadata, release self-tests, and packed-tarball smoke.
|
|
238
|
-
- The same `npm run release:check` gate now also preserves the Product Readiness release policy full gate guard for Website Console bundle boundary metadata full `release:check` evidence through unit tests, strict audits, whitespace checks, package contents, release metadata, release self-tests, and packed-tarball smoke.
|
|
239
|
-
- The same `npm run release:check` gate now also preserves the Product Readiness release policy full gate evidence guard through unit tests, strict audits, whitespace checks, package contents, release metadata, release self-tests, and packed-tarball smoke.
|
|
240
|
-
- Packed-tarball smoke also verifies route eval, prompt eval, and pack eval checkpoint output for installed-bin and one-shot `npm exec --package <tarball>` paths.
|
|
241
|
-
- Packed-tarball smoke also verifies `design-ai learn --signals --report --out learning-signals.md` Markdown signal reports, learn signals JSON `--out` file-write confirmations, and `design-ai learn --agent-backlog --report --out agent-backlog.md` focused agent backlog Markdown reports plus agent backlog JSON `--out` file-write confirmations and `design-ai learn --agent-backlog --strict --json` agent backlog strict gates, focused agent backlog readiness summaries, `optionalGapDetails` JSON field coverage, check index JSON field coverage, Markdown check index section coverage, and check-capture optional-gap semantics for installed-bin and one-shot `npm exec --package <tarball>` paths. That smoke coverage also preserves the optional refresh-only runbook selection reason so no-command agent backlog output treats refresh as status metadata, not an executable handoff command.
|
|
242
|
-
- Packed-tarball smoke also verifies `design-ai learn --propose-skills --min-evidence 3 --json` threshold skipping, learn skill proposals JSON `--out` file-write confirmations, `design-ai learn --propose-skills --report --out skill-proposals.md` Markdown review artifacts, `design-ai learn --propose-skills --review-file skill-proposals.review.json --json` read-only review decision joins, `design-ai learn --propose-skills --review-file skill-proposals.review.json --review-check --json` read-only review-file readiness checks, `design-ai learn --propose-skills --review-file skill-proposals.review.json --review-check --report --out skill-proposal-review-check.md` read-only review-check Markdown reports, `design-ai learn --propose-skills --review-file skill-proposals.review.json --apply-plan --json` read-only accepted proposal apply plans, human apply-plan command contract summaries via `design-ai learn --propose-skills --review-file skill-proposals.review.json --apply-plan` with the `Command contract` section, `design-ai learn --propose-skills --review-file skill-proposals.review.json --apply-plan --report --out skill-proposal-apply-plan.md` read-only apply-plan Markdown reports, `design-ai learn --propose-skills --review-template --out skill-proposals.review.json` JSON review templates, `design-ai learn --propose-skills --patch --out skill-proposals.patch` unified diff handoffs, and `design-ai learn --propose-skills --strict --json` as an expected-failure skill proposal readiness gate for installed-bin and one-shot `npm exec --package <tarball>` paths.
|
|
243
|
-
- After npm publish completes, run `npm run registry:smoke` to verify the public `npm exec --package` install path, including human `design-ai version` and machine-readable version metadata from JSON `design-ai version --json`, `design-ai help` top-level help, the `design-ai help --json` topic catalog with probe-capable Website Console site help usage, functional aliases, all three `list` catalog domains in human and JSON mode, human / JSON corpus discovery output, route JSON output, route catalog output, and route stdin input, explicit `show --lines` output and `route --explain` output, unknown command failure, unknown help-topic failure, unknown list-domain failure, and unknown search-dir failure, unknown route-id suggestion, unknown option suggestion, unknown value suggestion, and numeric range failure, prompt JSON output, prompt markdown output, prompt from-file output, prompt stdin output, pack JSON output, pack markdown output, pack from-file output, and pack stdin output, prompt/pack forced `--out` overwrite and prompt/pack file-write confirmations, check examples output, check artifact output, check stdin output, check all-routes output, and check learning capture output, human `design-ai audit --strict --quiet` output and JSON `design-ai audit --strict --quiet --json` machine-readable repository-audit output, public registry JSON `design-ai learn --verify` output plus public registry learn verify `--out` file-write confirmation, public registry JSON `design-ai learn --backup` output plus public registry learn backup `--out` file-write confirmation, public registry human / JSON `design-ai learn --stats` profile summary output plus public registry learn stats `--out` file-write confirmation, human `design-ai update --dry-run` output, `design-ai update --dry-run --json` machine-readable update plan, human diagnostics output from `design-ai doctor --strict`, machine-readable diagnostics output from `design-ai doctor --json`, and human `design-ai install` output plus `design-ai install --json` machine-readable install lifecycle output, human `design-ai status` output plus JSON status including `design-ai status --json` machine-readable install-state output, and human `design-ai uninstall` output plus `design-ai uninstall --json` machine-readable uninstall lifecycle output.
|
|
244
|
-
- Registry smoke also verifies public registry `design-ai workspace --strict --json` workspace strict failure/success readiness checks from the published package path.
|
|
245
|
-
- Registry smoke also verifies public registry `design-ai workspace --learning-eval learning-eval.json --strict --json` checkpoint summaries with freshness metadata plus auto-detected learning usage sidecar summaries from the published package path.
|
|
246
|
-
- Registry smoke also verifies public registry `design-ai workspace` workspace restore-backups readiness with restore rollback backup inventory from the published package path.
|
|
247
|
-
- Registry smoke also verifies public registry `design-ai site` Website Console export validation, including public registry `design-ai site --stdin --next-actions --json` next-action operator checklist contract with `mcpProbeCounts` probe count telemetry plus shared smoke assertion self-test coverage for Website Console next-actions MCP probe counts plus public registry `design-ai site --stdin --next-actions --json --out file --force` next-action operator checklist output-file persistence plus public registry `design-ai site --stdin --next-actions --out file --force` next-action human checklist output-file persistence, sample workspace coverage, prompt template listing, MCP readiness, MCP readiness probes, MCP readiness probe JSON with `--out` file-write confirmation plus shared MCP probe output-file smoke assertions plus embedded MCP check probe next-step commands plus executable embedded MCP check probe command smoke coverage plus human MCP check probe command guidance and output-file smoke coverage plus embedded MCP check probe human report output command, MCP action plan, MCP probe action plan, MCP probe action plan JSON with `--out` file-write confirmation plus embedded MCP action plan probe output-file commands plus MCP action plan human report output command parity plus MCP action plan emitted human report command smoke coverage plus MCP action plan emitted check JSON command smoke coverage plus MCP action plan emitted self-archive command smoke coverage plus shared MCP action plan command mapping self-test coverage, handoff bundle, bundle-check JSON/human and bundle-handoff JSON/prompt boundary metadata for deterministic-local, no-external-call, and no-target-repo-mutation handoff validation, bundle-check/compare/handoff `mcpProbeCounts` probe count telemetry plus package smoke self-test coverage for Website Console bundle MCP probe counts plus bundled Website Console `mcp-probes.json` saved probe evidence payload assertion instead of the full `site --mcp-check --probes --json` response, bundle-repair, refactor task generation, and task-selected prompt generation from the published package path.
|
|
248
|
-
- Registry smoke also verifies public registry JSON `design-ai learn --feedback` output plus public registry learn feedback `--out` file-write confirmation, public registry `design-ai learn --feedback --from-file`, public registry `design-ai learn --feedback --stdin`, public registry JSON `design-ai learn --init` preview/apply output, and public registry learn init duplicate-skip output.
|
|
249
|
-
- Registry smoke also verifies public registry JSON `design-ai learn --restore` preview/apply output plus public registry learn restore `--out` file-write confirmation, public registry learn restore rollback backup verification, public registry learn restore `--backup-file` path coverage, public registry `design-ai learn --restore-backups` restore rollback backup inventory coverage, and public registry `design-ai learn --restore-backups --prune` restore rollback backup pruning coverage.
|
|
250
|
-
- Registry smoke also verifies public registry JSON `design-ai learn --import` dry-run/apply output plus public registry learn import `--out` file-write confirmation plus public registry JSON `design-ai learn --redact` output, public registry `design-ai learn --redact --from-file`, public registry `design-ai learn --redact --stdin`, and public registry learn redact `--out` file-write confirmation.
|
|
251
|
-
- Registry smoke also verifies public registry human / JSON `design-ai learn --audit` cleanup suggestion output plus public registry learn audit `--out` file-write confirmation and public registry `design-ai learn --audit --fix --dry-run` cleanup preview and confirmed apply output.
|
|
252
|
-
- Registry smoke also verifies public registry query-filtered learn list explanation/export JSON output, public registry brief-relevant prompt/pack learning selection and prompt/pack learning usage sidecar recording with public registry prompt/pack --with-learning, and public registry `design-ai learn --eval-template` checkpoint generation plus public registry generated checkpoint strict validation.
|
|
253
|
-
- Registry smoke also verifies public registry learning readiness Markdown report coverage so `design-ai learn --signals --report --out learning-signals.md` and `design-ai learn --agent-backlog --report --out agent-backlog.md` preserve the `Readiness check index` section from the published package path.
|
|
237
|
+
- Run `npm run release:check` as the core gate before release PRs or tags. It wraps `npm test` (CLI unit tests), `npm run audit:strict` (all 8 audits), `git diff --check` (whitespace), `npm run package:check` (package contents), `npm run release:metadata` (release metadata + Product Readiness guard), `npm run release:self-test` (release assertion self-tests), and `npm run package:smoke` (packed-tarball smoke covering install, `site`, `workspace`, `learn`, and help/version/audit surfaces for both installed-bin and one-shot `npm exec --package <tarball>` paths).
|
|
238
|
+
- After npm publish completes, run `npm run registry:smoke` to verify the same surfaces against the public `npm exec --package` install path.
|
|
254
239
|
- Knowledge files use `<!-- hand-written -->` marker if hand-authored.
|
|
255
240
|
- Skill PLAYBOOKs include a verification phase checklist.
|
|
256
241
|
- Korean strings spelled out in Korean (no machine translation passing through).
|
|
257
242
|
- All audits pass.
|
|
258
243
|
- Before pushing for CI, run `npm run ci:local` when you need local parity with the non-publishing GitHub workflows. It wraps `release:check`, Python syntax checks, knowledge size budget, VS Code extension compile/unit tests, the MkDocs build, and the MkDocs warning policy used by the docs deployment workflow: no non-`refs/` warnings, with refs-only warnings capped at the accepted baseline.
|
|
259
244
|
|
|
245
|
+
The exhaustive list of every command and flag that `release:check`, packed-tarball smoke, and registry smoke assert on is preserved in [`docs/RELEASE-GATES.md`](docs/RELEASE-GATES.md).
|
|
246
|
+
|
|
260
247
|
## License
|
|
261
248
|
|
|
262
249
|
MIT. See [LICENSE](https://github.com/sungjin9288/design-ai/blob/main/LICENSE).
|
package/cli/bin/design-ai.mjs
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
// status Show what's installed
|
|
9
9
|
// list [domain] List skills / commands / knowledge (optionally filtered)
|
|
10
10
|
// search Search the local design-ai markdown corpus
|
|
11
|
+
// index Build, inspect, and verify the local retrieval index
|
|
11
12
|
// show Print a corpus file or line range
|
|
12
13
|
// route Recommend and explain commands, skills, and knowledge for a brief
|
|
13
14
|
// routes List available route ids
|
package/cli/commands/help.mjs
CHANGED
|
@@ -17,6 +17,7 @@ import { runMcp } from "./mcp.mjs";
|
|
|
17
17
|
import { runPack } from "./pack.mjs";
|
|
18
18
|
import { runPrompt } from "./prompt.mjs";
|
|
19
19
|
import { runRoute } from "./route.mjs";
|
|
20
|
+
import { runIndex } from "./index.mjs";
|
|
20
21
|
import { runSearch } from "./search.mjs";
|
|
21
22
|
import { runShow } from "./show.mjs";
|
|
22
23
|
import { runSite } from "./site.mjs";
|
|
@@ -32,17 +33,18 @@ export const HELP_COMMANDS = [
|
|
|
32
33
|
{ topic: "uninstall", usage: "uninstall [--json]", description: "Remove symlinks (keeps source files)" },
|
|
33
34
|
{ topic: "status", usage: "status [--json]", description: "Show what's installed (use VERBOSE=1 for full list)" },
|
|
34
35
|
{ topic: "list", usage: "list [skills|commands|agents] [--json]", description: "List catalog from the plugin manifest" },
|
|
35
|
-
{ topic: "search", usage: "search <query> [--dir kind] [--limit N] [--json]", description: "Search the local markdown corpus" },
|
|
36
|
+
{ topic: "search", usage: "search <query> [--dir kind] [--limit N] [--ranked] [--embeddings [--provider \"cmd args\"]] [--json]", description: "Search the local markdown corpus" },
|
|
37
|
+
{ topic: "index", usage: "index [--build|--status|--verify] [--json] [--embeddings [--provider \"cmd args\"]]", description: "Build, inspect, and verify the local retrieval index" },
|
|
36
38
|
{ topic: "show", usage: "show <file[:line]> [--lines N:M] [--context N] [--json]", description: "Print a corpus file or line range" },
|
|
37
39
|
{ topic: "route", usage: "route <brief|--from-file file|--stdin|--list|--eval-template|--eval> [--limit N]", description: "Recommend commands, skills, knowledge, and route eval checkpoints" },
|
|
38
40
|
{ topic: "routes", usage: "routes [--json]", description: "List available route ids" },
|
|
39
|
-
{ topic: "prompt", usage: "prompt <brief|--from-file file|--stdin|--eval-template|--eval> [--route id] [--with-learning] [--learning-category kind] [--learning-limit N] [--out file]", description: "Generate a ready-to-use agent prompt and prompt-plan eval checkpoints" },
|
|
40
|
-
{ topic: "pack", usage: "pack <brief|--from-file file|--stdin|--eval-template|--eval> [--route id] [--with-learning] [--learning-category kind] [--learning-limit N] [--max-bytes N]", description: "Generate prompt plus bounded context and prompt-pack eval checkpoints" },
|
|
41
|
+
{ topic: "prompt", usage: "prompt <brief|--from-file file|--stdin|--eval-template|--eval> [--route id] [--with-learning] [--learning-category kind] [--learning-limit N] [--with-recall] [--recall-limit N] [--out file]", description: "Generate a ready-to-use agent prompt and prompt-plan eval checkpoints" },
|
|
42
|
+
{ topic: "pack", usage: "pack <brief|--from-file file|--stdin|--eval-template|--eval> [--route id] [--with-learning] [--learning-category kind] [--learning-limit N] [--with-recall] [--recall-limit N] [--max-bytes N]", description: "Generate prompt plus bounded context and prompt-pack eval checkpoints" },
|
|
41
43
|
{ topic: "check", usage: "check <artifact.md|--stdin|--examples> [--route id|--all-routes] [--learn]", description: "Check generated Markdown artifact quality; add --issues-only or --learn" },
|
|
42
44
|
{ topic: "audit", usage: "audit [--strict] [--quiet] [--json]", description: "Run repository quality checks" },
|
|
43
45
|
{ topic: "doctor", usage: "doctor [--strict] [--json] [--fix]", description: "Diagnose source, runtime, and install state" },
|
|
44
46
|
{ topic: "examples", usage: "examples [query] [--route id] [--limit N] [--json]", description: "Find worked examples for a route or query" },
|
|
45
|
-
{ topic: "learn", usage: "learn [--init|--remember text|--feedback text|--list|--export|--query text|--explain|--backup|--redact|--verify|--diff|--restore|--restore-backups [--prune]|--import|--audit [--fix]|--curate|--stats|--usage|--signals [--strict]|--agent-backlog [--strict]|--propose-skills [--min-evidence N] [--review-file path] [--review-check|--apply-plan] [--strict]|--eval-template|--eval [--strict]|--forget id|--clear] [--json|--report|--patch|--review-template] [--out file]", description: "Manage local learning preferences, usage reports, signal registry, agent backlog, skill proposals, and eval checkpoints for prompt personalization" },
|
|
47
|
+
{ topic: "learn", usage: "learn [--init|--remember text|--feedback text|--list|--export|--query text|--explain|--recall query|--backup|--redact|--verify|--diff|--restore|--restore-backups [--prune]|--import|--audit [--fix]|--curate|--stats|--usage|--signals [--strict]|--agent-backlog [--strict]|--propose-skills [--min-evidence N] [--review-file path] [--review-check|--apply-plan] [--strict]|--eval-template|--eval [--strict]|--forget id|--clear] [--json|--report|--patch|--review-template] [--out file]", description: "Manage local learning preferences, usage reports, signal registry, agent backlog, skill proposals, and eval checkpoints for prompt personalization" },
|
|
46
48
|
{ topic: "workspace", usage: "workspace [--root path] [--learning-file path] [--learning-usage path] [--learning-eval path] [--strict] [--json]", description: "Show read-only local dogfood readiness: git, repository, learning usage, eval checkpoints, and release scripts" },
|
|
47
49
|
{ topic: "site", usage: "site <workspace.json|--stdin> [--strict] [--json|--mcp-check [--probes]|--mcp-plan [--probes] [--json]|--next-actions [--json]|--graph|--tasks|--bundle|--report|--prompts|--prompt id [--task id]] [--out file] | site <bundle-dir> --bundle-check [--json] | site <bundle-dir> --bundle-compare other-bundle-dir [--json] | site <bundle-dir> --bundle-handoff [--task id] [--json] | site <bundle-dir> --bundle-repair [--yes] [--json] [--out file] | site --init --name name --live-url url [--next-actions] [--out file] | site --init --name name --live-url url --bundle --out dir | site --from-intake file.md|--stdin [--json|--next-actions [--json]|--tasks|--bundle [--tasks] --out dir] [--out file] | site --intake-template [--language en|ko] [--json] [--out file] | site --sample [--out file] | site --prompt-list [--json]", description: "Validate Website Improvement Console exports and generate handoff artifacts" },
|
|
48
50
|
{ topic: "mcp", usage: "mcp", description: "Start the stdio MCP server for Claude Code, Codex, and other MCP clients" },
|
|
@@ -79,6 +81,7 @@ const HELP_RUNNERS = {
|
|
|
79
81
|
status: () => runStatus(["--help"]),
|
|
80
82
|
list: () => runList(["--help"]),
|
|
81
83
|
search: () => runSearch(["--help"]),
|
|
84
|
+
index: () => runIndex(["--help"]),
|
|
82
85
|
show: () => runShow(["--help"]),
|
|
83
86
|
route: () => runRoute(["--help"]),
|
|
84
87
|
routes: printRoutesHelp,
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
// `design-ai index` — build, inspect, and verify the local retrieval index.
|
|
2
|
+
// Explicit-only: nothing here runs in the background or on behalf of other commands.
|
|
3
|
+
|
|
4
|
+
import { DESIGN_AI_HOME } from "../lib/paths.mjs";
|
|
5
|
+
import { dim, header, info, success, warn } from "../lib/log.mjs";
|
|
6
|
+
import {
|
|
7
|
+
buildEmbeddingIndex,
|
|
8
|
+
embeddingIndexStatus,
|
|
9
|
+
loadEmbeddingIndexFile,
|
|
10
|
+
writeEmbeddingIndex,
|
|
11
|
+
} from "../lib/embedding-index.mjs";
|
|
12
|
+
import { configuredEmbeddingProvider, defaultConfigFile } from "../lib/local-config.mjs";
|
|
13
|
+
import {
|
|
14
|
+
buildCorpusIndex,
|
|
15
|
+
buildLearningIndex,
|
|
16
|
+
defaultIndexDir,
|
|
17
|
+
retrievalIndexStatus,
|
|
18
|
+
verifyRetrievalIndexes,
|
|
19
|
+
writeRetrievalIndexes,
|
|
20
|
+
} from "../lib/retrieval-index.mjs";
|
|
21
|
+
import { defaultLearningFile } from "../lib/learn-shared.mjs";
|
|
22
|
+
import { unknownOptionMessage } from "../lib/suggest.mjs";
|
|
23
|
+
|
|
24
|
+
const INDEX_OPTIONS = ["-h", "--help", "--build", "--status", "--verify", "--json", "--embeddings", "--provider"];
|
|
25
|
+
|
|
26
|
+
// A bare --provider command string is split on spaces (documented here and in
|
|
27
|
+
// printHelp): "python3 embed.py --quiet" -> command "python3", args ["embed.py",
|
|
28
|
+
// "--quiet"]. Providers whose command or args need spaces/quoting should be
|
|
29
|
+
// configured via ~/.design-ai/config.json embeddings.provider.args instead — that
|
|
30
|
+
// is the robust path; --provider is the quick one-shot override.
|
|
31
|
+
function parseProviderFlag(value) {
|
|
32
|
+
const parts = String(value || "").trim().split(/\s+/).filter(Boolean);
|
|
33
|
+
if (parts.length === 0) return null;
|
|
34
|
+
return { command: parts[0], args: parts.slice(1) };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function parseIndexArgs(args) {
|
|
38
|
+
const out = { action: "status", json: false, help: false, embeddings: false, provider: "" };
|
|
39
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
40
|
+
const arg = args[i];
|
|
41
|
+
if (arg === "-h" || arg === "--help") {
|
|
42
|
+
out.help = true;
|
|
43
|
+
} else if (arg === "--json") {
|
|
44
|
+
out.json = true;
|
|
45
|
+
} else if (arg === "--build") {
|
|
46
|
+
out.action = "build";
|
|
47
|
+
} else if (arg === "--status") {
|
|
48
|
+
out.action = "status";
|
|
49
|
+
} else if (arg === "--verify") {
|
|
50
|
+
out.action = "verify";
|
|
51
|
+
} else if (arg === "--embeddings") {
|
|
52
|
+
out.embeddings = true;
|
|
53
|
+
} else if (arg === "--provider") {
|
|
54
|
+
out.provider = args[i + 1] || "";
|
|
55
|
+
i += 1;
|
|
56
|
+
} else {
|
|
57
|
+
throw new Error(unknownOptionMessage("index", arg, INDEX_OPTIONS));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return out;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function printHelp() {
|
|
64
|
+
console.log("Usage: design-ai index [--build|--status|--verify] [--json] [--embeddings [--provider \"cmd args\"]]\n");
|
|
65
|
+
console.log("Manages the local retrieval index (derived, rebuildable cache files).");
|
|
66
|
+
console.log("Index files stay on this machine and are safe to delete at any time.\n");
|
|
67
|
+
console.log("Options:");
|
|
68
|
+
console.log(" --build Build/refresh the corpus + learning retrieval index (explicit, never background)");
|
|
69
|
+
console.log(" --status Report index paths, digests, staleness, and document counts. Default action");
|
|
70
|
+
console.log(" --verify Rebuild in memory and compare against the stored index; read-only");
|
|
71
|
+
console.log(" --json Emit machine-readable output");
|
|
72
|
+
console.log(" --embeddings Also build the opt-in local embedding sidecar (requires a provider)");
|
|
73
|
+
console.log(" --provider \"cmd args\" Embedding provider command for this invocation (overrides config).");
|
|
74
|
+
console.log(" Split on spaces; for commands needing quoting, use the config file's");
|
|
75
|
+
console.log(" embeddings.provider.args array instead (~/.design-ai/config.json)");
|
|
76
|
+
console.log("\nEmbeddings are never built by default: --embeddings requires a provider from --provider or");
|
|
77
|
+
console.log("~/.design-ai/config.json (embeddings.provider), and both a config AND the --embeddings flag");
|
|
78
|
+
console.log("are required — config alone never silently enables it.");
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function statusLine(label, entry) {
|
|
82
|
+
if (!entry.present) return `${label}: missing (run design-ai index --build)`;
|
|
83
|
+
if (entry.error) return `${label}: unreadable — ${entry.error}`;
|
|
84
|
+
const freshness = entry.fresh ? "fresh" : "stale (run design-ai index --build)";
|
|
85
|
+
return `${label}: ${freshness} — ${entry.documentCount} documents, generated ${entry.generatedAt}`;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function embeddingsStatusLine(embeddings) {
|
|
89
|
+
if (!embeddings) return "Embeddings: not built (opt-in; design-ai index --build --embeddings --provider ...)";
|
|
90
|
+
if (embeddings.error) return `Embeddings: unreadable — ${embeddings.error}`;
|
|
91
|
+
const freshness = embeddings.fresh ? "fresh" : "stale (run design-ai index --build --embeddings)";
|
|
92
|
+
const providerLabel = embeddings.provider ? ` (provider: ${embeddings.provider.command})` : "";
|
|
93
|
+
return `Embeddings: ${freshness} — ${embeddings.documentCount} vectors, generated ${embeddings.generatedAt}${providerLabel}`;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function printStatus(status) {
|
|
97
|
+
header("design-ai index", "status");
|
|
98
|
+
info(`Index dir: ${status.indexDir}`);
|
|
99
|
+
info(statusLine("Corpus index", status.corpus));
|
|
100
|
+
info(statusLine("Learning index", status.learning));
|
|
101
|
+
info(embeddingsStatusLine(status.embeddings));
|
|
102
|
+
if (status.fresh) {
|
|
103
|
+
success("Index is fresh.");
|
|
104
|
+
} else {
|
|
105
|
+
warn(`Index is not fresh. Rebuild with: ${status.buildCommand}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function resolveProvider({ flagProvider, configFile }) {
|
|
110
|
+
if (flagProvider) return { provider: parseProviderFlag(flagProvider), source: "flag" };
|
|
111
|
+
const configured = configuredEmbeddingProvider(configFile);
|
|
112
|
+
if (configured) return { provider: configured, source: "config" };
|
|
113
|
+
return { provider: null, source: "" };
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function embeddingsUnavailableError({ configFile }) {
|
|
117
|
+
return [
|
|
118
|
+
"--embeddings requires a provider: pass --provider \"command args\" for this invocation,",
|
|
119
|
+
`or configure embeddings.provider in ${configFile} (see docs/AI-LEARNING-PHASE2.md, Phase B).`,
|
|
120
|
+
].join("\n");
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// index --status embeddings section shape (nullable, present only when the sidecar
|
|
124
|
+
// file exists): { file, present, fresh, sourceMatch, generatedAt, documentCount,
|
|
125
|
+
// provider, storedDigest, currentDigest, error }. Positioned after "learning" and
|
|
126
|
+
// before top-level "fresh" in the JSON payload (documented contract).
|
|
127
|
+
function embeddingsStatusSection(context) {
|
|
128
|
+
const raw = embeddingIndexStatus(context);
|
|
129
|
+
if (!raw.present) return null;
|
|
130
|
+
return raw;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export async function runIndex(args) {
|
|
134
|
+
const parsed = parseIndexArgs(args);
|
|
135
|
+
if (parsed.help) {
|
|
136
|
+
printHelp();
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const context = {
|
|
141
|
+
designAiPath: DESIGN_AI_HOME,
|
|
142
|
+
indexDir: defaultIndexDir(),
|
|
143
|
+
learningFile: defaultLearningFile(),
|
|
144
|
+
};
|
|
145
|
+
const configFile = defaultConfigFile();
|
|
146
|
+
|
|
147
|
+
if (parsed.action === "build") {
|
|
148
|
+
const corpus = buildCorpusIndex({ designAiPath: context.designAiPath });
|
|
149
|
+
const learning = buildLearningIndex({ filePath: context.learningFile });
|
|
150
|
+
const written = writeRetrievalIndexes({ indexDir: context.indexDir, corpus, learning });
|
|
151
|
+
|
|
152
|
+
let embeddingsResult = null;
|
|
153
|
+
if (parsed.embeddings) {
|
|
154
|
+
const { provider } = resolveProvider({ flagProvider: parsed.provider, configFile });
|
|
155
|
+
if (!provider) {
|
|
156
|
+
embeddingsResult = { ok: false, error: embeddingsUnavailableError({ configFile }) };
|
|
157
|
+
} else {
|
|
158
|
+
const built = buildEmbeddingIndex({
|
|
159
|
+
provider,
|
|
160
|
+
designAiPath: context.designAiPath,
|
|
161
|
+
learningFile: context.learningFile,
|
|
162
|
+
});
|
|
163
|
+
if (built.ok) {
|
|
164
|
+
const writtenEmbeddings = writeEmbeddingIndex({ indexDir: context.indexDir, payload: built.payload });
|
|
165
|
+
embeddingsResult = {
|
|
166
|
+
ok: true,
|
|
167
|
+
file: writtenEmbeddings.file,
|
|
168
|
+
documentCount: built.payload.vectors.length,
|
|
169
|
+
provider: { command: built.payload.provider.command, modelLabel: built.payload.provider.modelLabel, dimensions: built.payload.provider.dimensions },
|
|
170
|
+
};
|
|
171
|
+
} else {
|
|
172
|
+
embeddingsResult = { ok: false, error: built.error };
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
if (parsed.json) {
|
|
178
|
+
const payload = {
|
|
179
|
+
action: "build",
|
|
180
|
+
indexDir: context.indexDir,
|
|
181
|
+
corpus: { file: written.corpusFile, documentCount: corpus.stats.documentCount, digest: corpus.source.corpusDigest },
|
|
182
|
+
learning: { file: written.learningFile, documentCount: learning.stats.documentCount, digest: learning.source.learningDigest },
|
|
183
|
+
};
|
|
184
|
+
if (embeddingsResult) payload.embeddings = embeddingsResult;
|
|
185
|
+
console.log(JSON.stringify(payload, null, 2));
|
|
186
|
+
if (embeddingsResult && !embeddingsResult.ok) process.exitCode = 1;
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
header("design-ai index", "build");
|
|
191
|
+
info(`Corpus index: ${written.corpusFile} (${corpus.stats.documentCount} documents)`);
|
|
192
|
+
info(`Learning index: ${written.learningFile} (${learning.stats.documentCount} entries)`);
|
|
193
|
+
success("Index built.");
|
|
194
|
+
if (embeddingsResult) {
|
|
195
|
+
if (embeddingsResult.ok) {
|
|
196
|
+
success(`Embedding index built: ${embeddingsResult.file} (${embeddingsResult.documentCount} vectors)`);
|
|
197
|
+
} else {
|
|
198
|
+
warn(`Embedding index not built: ${embeddingsResult.error}`);
|
|
199
|
+
process.exitCode = 1;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
if (parsed.action === "verify") {
|
|
206
|
+
const verify = verifyRetrievalIndexes(context);
|
|
207
|
+
const embeddings = embeddingsStatusSection(context);
|
|
208
|
+
let embeddingsCheck = null;
|
|
209
|
+
if (embeddings) {
|
|
210
|
+
if (embeddings.error) {
|
|
211
|
+
embeddingsCheck = { name: "embeddings", file: embeddings.file, matches: false, reason: embeddings.error };
|
|
212
|
+
} else {
|
|
213
|
+
const { provider } = resolveProvider({ flagProvider: parsed.provider, configFile });
|
|
214
|
+
if (!provider) {
|
|
215
|
+
embeddingsCheck = {
|
|
216
|
+
name: "embeddings",
|
|
217
|
+
file: embeddings.file,
|
|
218
|
+
matches: true,
|
|
219
|
+
skipped: true,
|
|
220
|
+
reason: "skipped: provider unavailable (pass --provider or configure ~/.design-ai/config.json to verify embedding content)",
|
|
221
|
+
};
|
|
222
|
+
} else {
|
|
223
|
+
const rebuilt = buildEmbeddingIndex({
|
|
224
|
+
provider,
|
|
225
|
+
designAiPath: context.designAiPath,
|
|
226
|
+
learningFile: context.learningFile,
|
|
227
|
+
});
|
|
228
|
+
if (!rebuilt.ok) {
|
|
229
|
+
embeddingsCheck = {
|
|
230
|
+
name: "embeddings",
|
|
231
|
+
file: embeddings.file,
|
|
232
|
+
matches: true,
|
|
233
|
+
skipped: true,
|
|
234
|
+
reason: `skipped: provider unavailable (${rebuilt.error})`,
|
|
235
|
+
};
|
|
236
|
+
} else {
|
|
237
|
+
const stored = loadEmbeddingIndexFile(embeddings.file);
|
|
238
|
+
const normalize = (payload) => {
|
|
239
|
+
const { generatedAt, ...rest } = payload || {};
|
|
240
|
+
return JSON.stringify(rest);
|
|
241
|
+
};
|
|
242
|
+
const matches = normalize(stored.payload) === normalize(rebuilt.payload);
|
|
243
|
+
embeddingsCheck = {
|
|
244
|
+
name: "embeddings",
|
|
245
|
+
file: embeddings.file,
|
|
246
|
+
matches,
|
|
247
|
+
reason: matches ? "" : "stored embedding index differs from an in-memory rebuild of its sources",
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
verify.checks.push(embeddingsCheck);
|
|
253
|
+
verify.ok = verify.ok && (embeddingsCheck.matches !== false);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
if (parsed.json) {
|
|
257
|
+
console.log(JSON.stringify({ action: "verify", ...verify }, null, 2));
|
|
258
|
+
} else {
|
|
259
|
+
header("design-ai index", "verify");
|
|
260
|
+
for (const check of verify.checks) {
|
|
261
|
+
if (check.matches) {
|
|
262
|
+
info(check.skipped ? `${check.name}: ${check.reason}` : `${check.name}: matches an in-memory rebuild`);
|
|
263
|
+
} else {
|
|
264
|
+
warn(`${check.name}: ${check.reason}`);
|
|
265
|
+
console.log(` ${dim(check.file)}`);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
if (verify.ok) success("Stored index matches its sources.");
|
|
269
|
+
}
|
|
270
|
+
if (!verify.ok) process.exitCode = 1;
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const status = retrievalIndexStatus(context);
|
|
275
|
+
const embeddings = embeddingsStatusSection(context);
|
|
276
|
+
const fresh = embeddings ? status.fresh && embeddings.fresh : status.fresh;
|
|
277
|
+
// Key order is a documented contract (embeddings sits after learning, before
|
|
278
|
+
// fresh) — build the object explicitly rather than relying on spread order.
|
|
279
|
+
const fullStatus = {
|
|
280
|
+
indexDir: status.indexDir,
|
|
281
|
+
corpus: status.corpus,
|
|
282
|
+
learning: status.learning,
|
|
283
|
+
embeddings,
|
|
284
|
+
fresh,
|
|
285
|
+
buildCommand: status.buildCommand,
|
|
286
|
+
};
|
|
287
|
+
if (parsed.json) {
|
|
288
|
+
console.log(JSON.stringify({ action: "status", ...fullStatus }, null, 2));
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
printStatus(fullStatus);
|
|
292
|
+
}
|