@contentful/experience-design-system-cli 2.11.4-dev-build-d47ab65.0 → 2.12.1-dev-build-589b615.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.
Files changed (142) hide show
  1. package/README.md +214 -357
  2. package/dist/package.json +1 -1
  3. package/dist/src/analyze/extract/astro.js +9 -0
  4. package/dist/src/analyze/extract/react.js +23 -0
  5. package/dist/src/analyze/extract/stencil.js +3 -0
  6. package/dist/src/analyze/extract/vue.js +6 -0
  7. package/dist/src/analyze/extract/web-components.js +10 -0
  8. package/dist/src/analyze/pre-classify.d.ts +1 -1
  9. package/dist/src/analyze/pre-classify.js +3 -3
  10. package/dist/src/analyze/select/persistence.d.ts +13 -0
  11. package/dist/src/analyze/select/persistence.js +38 -0
  12. package/dist/src/analyze/select/preview-annotations.d.ts +26 -0
  13. package/dist/src/analyze/select/preview-annotations.js +62 -0
  14. package/dist/src/analyze/select/tui/App.js +5 -2
  15. package/dist/src/analyze/select/tui/components/ComponentRationalePanel.d.ts +30 -0
  16. package/dist/src/analyze/select/tui/components/ComponentRationalePanel.js +137 -0
  17. package/dist/src/analyze/select/tui/components/FieldEditor.d.ts +58 -1
  18. package/dist/src/analyze/select/tui/components/FieldEditor.js +637 -161
  19. package/dist/src/analyze/select/tui/components/FinalizeDialog.js +1 -1
  20. package/dist/src/analyze/select/tui/components/JsonPanel.js +5 -1
  21. package/dist/src/analyze/select/tui/components/RationalePanel.d.ts +34 -0
  22. package/dist/src/analyze/select/tui/components/RationalePanel.js +92 -0
  23. package/dist/src/analyze/select/tui/components/Sidebar.d.ts +13 -1
  24. package/dist/src/analyze/select/tui/components/Sidebar.js +27 -3
  25. package/dist/src/analyze/select/tui/hooks/scroll-offset.d.ts +29 -0
  26. package/dist/src/analyze/select/tui/hooks/scroll-offset.js +26 -0
  27. package/dist/src/analyze/select-agent/command.d.ts +2 -0
  28. package/dist/src/analyze/select-agent/command.js +259 -45
  29. package/dist/src/analyze/select-agent/show-rationale.d.ts +35 -0
  30. package/dist/src/analyze/select-agent/show-rationale.js +92 -0
  31. package/dist/src/apply/command.js +7 -3
  32. package/dist/src/apply/tui/ServerApplyView.d.ts +3 -1
  33. package/dist/src/apply/tui/ServerApplyView.js +3 -2
  34. package/dist/src/credentials-store.d.ts +5 -0
  35. package/dist/src/credentials-store.js +7 -1
  36. package/dist/src/generate/agent-runner.d.ts +14 -0
  37. package/dist/src/generate/agent-runner.js +16 -0
  38. package/dist/src/generate/command.d.ts +6 -0
  39. package/dist/src/generate/command.js +45 -10
  40. package/dist/src/generate/progress.d.ts +9 -0
  41. package/dist/src/generate/progress.js +11 -0
  42. package/dist/src/generate/prompt-builder.d.ts +8 -0
  43. package/dist/src/generate/prompt-builder.js +22 -11
  44. package/dist/src/import/agent-model-resolve.d.ts +23 -0
  45. package/dist/src/import/agent-model-resolve.js +35 -0
  46. package/dist/src/import/auto-filter-resolve.d.ts +12 -0
  47. package/dist/src/import/auto-filter-resolve.js +16 -0
  48. package/dist/src/import/command.js +248 -8
  49. package/dist/src/import/orchestrator.d.ts +2 -0
  50. package/dist/src/import/orchestrator.js +11 -3
  51. package/dist/src/import/print-prompt.d.ts +35 -0
  52. package/dist/src/import/print-prompt.js +31 -0
  53. package/dist/src/import/tui/CustomPromptBanner.d.ts +11 -0
  54. package/dist/src/import/tui/CustomPromptBanner.js +7 -0
  55. package/dist/src/import/tui/WizardApp.d.ts +112 -8
  56. package/dist/src/import/tui/WizardApp.js +814 -333
  57. package/dist/src/import/tui/auto-filter-error.d.ts +2 -0
  58. package/dist/src/import/tui/auto-filter-error.js +29 -0
  59. package/dist/src/import/tui/final-review-host.d.ts +15 -0
  60. package/dist/src/import/tui/final-review-host.js +20 -0
  61. package/dist/src/import/tui/push-decision-gate-helpers.d.ts +8 -0
  62. package/dist/src/import/tui/push-decision-gate-helpers.js +8 -0
  63. package/dist/src/import/tui/push-progress.d.ts +23 -0
  64. package/dist/src/import/tui/push-progress.js +14 -0
  65. package/dist/src/import/tui/run-print-files-helpers.d.ts +26 -0
  66. package/dist/src/import/tui/run-print-files-helpers.js +8 -0
  67. package/dist/src/import/tui/run-teaser.d.ts +5 -0
  68. package/dist/src/import/tui/run-teaser.js +9 -0
  69. package/dist/src/import/tui/runLivePreview.d.ts +35 -0
  70. package/dist/src/import/tui/runLivePreview.js +73 -0
  71. package/dist/src/import/tui/runScopeGate.d.ts +22 -0
  72. package/dist/src/import/tui/runScopeGate.js +28 -0
  73. package/dist/src/import/tui/scope-gate-host.d.ts +21 -0
  74. package/dist/src/import/tui/scope-gate-host.js +20 -0
  75. package/dist/src/import/tui/spawn-generate.d.ts +33 -0
  76. package/dist/src/import/tui/spawn-generate.js +53 -0
  77. package/dist/src/import/tui/steps/CredentialsStep.d.ts +25 -1
  78. package/dist/src/import/tui/steps/CredentialsStep.js +31 -3
  79. package/dist/src/import/tui/steps/DoneStep.d.ts +6 -1
  80. package/dist/src/import/tui/steps/DoneStep.js +10 -4
  81. package/dist/src/import/tui/steps/GenerateReviewStep.d.ts +29 -2
  82. package/dist/src/import/tui/steps/GenerateReviewStep.js +412 -48
  83. package/dist/src/import/tui/steps/PushDecisionGateStep.d.ts +19 -0
  84. package/dist/src/import/tui/steps/PushDecisionGateStep.js +76 -0
  85. package/dist/src/import/tui/steps/PushingStep.d.ts +10 -0
  86. package/dist/src/import/tui/steps/PushingStep.js +40 -0
  87. package/dist/src/import/tui/steps/ScopeGateStep.d.ts +23 -0
  88. package/dist/src/import/tui/steps/ScopeGateStep.js +243 -0
  89. package/dist/src/import/tui/steps/TokenInputStep.js +20 -3
  90. package/dist/src/import/tui/useLivePreview.d.ts +35 -0
  91. package/dist/src/import/tui/useLivePreview.js +120 -0
  92. package/dist/src/import/tui/wizard-generate-progress.d.ts +21 -0
  93. package/dist/src/import/tui/wizard-generate-progress.js +25 -0
  94. package/dist/src/import/tui/wizard-save-flow.d.ts +37 -0
  95. package/dist/src/import/tui/wizard-save-flow.js +20 -0
  96. package/dist/src/import/tui/wizard-state-transitions.d.ts +80 -0
  97. package/dist/src/import/tui/wizard-state-transitions.js +79 -0
  98. package/dist/src/lib/contentful-urls.d.ts +34 -0
  99. package/dist/src/lib/contentful-urls.js +41 -0
  100. package/dist/src/program.js +2 -0
  101. package/dist/src/runs/export-helpers.d.ts +30 -0
  102. package/dist/src/runs/export-helpers.js +59 -0
  103. package/dist/src/runs/fingerprint.d.ts +47 -0
  104. package/dist/src/runs/fingerprint.js +75 -0
  105. package/dist/src/runs/ls-command.d.ts +12 -0
  106. package/dist/src/runs/ls-command.js +137 -0
  107. package/dist/src/runs/modify-launcher.d.ts +24 -0
  108. package/dist/src/runs/modify-launcher.js +36 -0
  109. package/dist/src/runs/path-prompt.d.ts +8 -0
  110. package/dist/src/runs/path-prompt.js +72 -0
  111. package/dist/src/runs/push-creds-prompt.d.ts +25 -0
  112. package/dist/src/runs/push-creds-prompt.js +39 -0
  113. package/dist/src/runs/push-helpers.d.ts +29 -0
  114. package/dist/src/runs/push-helpers.js +69 -0
  115. package/dist/src/runs/replay-helpers.d.ts +67 -0
  116. package/dist/src/runs/replay-helpers.js +148 -0
  117. package/dist/src/runs/resolve-run-target.d.ts +12 -0
  118. package/dist/src/runs/resolve-run-target.js +45 -0
  119. package/dist/src/runs/run-picker-mount.d.ts +46 -0
  120. package/dist/src/runs/run-picker-mount.js +72 -0
  121. package/dist/src/runs/run-picker.d.ts +17 -0
  122. package/dist/src/runs/run-picker.js +145 -0
  123. package/dist/src/runs/save-conflict.d.ts +8 -0
  124. package/dist/src/runs/save-conflict.js +56 -0
  125. package/dist/src/runs/save-path-resolver.d.ts +55 -0
  126. package/dist/src/runs/save-path-resolver.js +71 -0
  127. package/dist/src/runs/staleness.d.ts +38 -0
  128. package/dist/src/runs/staleness.js +140 -0
  129. package/dist/src/runs/store.d.ts +78 -0
  130. package/dist/src/runs/store.js +136 -0
  131. package/dist/src/session/cache-keys.d.ts +15 -0
  132. package/dist/src/session/cache-keys.js +38 -0
  133. package/dist/src/session/db.d.ts +89 -3
  134. package/dist/src/session/db.js +447 -104
  135. package/dist/src/setup/auto-filter-prompt.d.ts +13 -0
  136. package/dist/src/setup/auto-filter-prompt.js +24 -0
  137. package/dist/src/setup/command.d.ts +7 -0
  138. package/dist/src/setup/command.js +58 -2
  139. package/dist/src/types.d.ts +6 -0
  140. package/package.json +2 -2
  141. package/skills/generate-components.md +54 -6
  142. package/skills/select-components.md +13 -4
package/README.md CHANGED
@@ -1,20 +1,36 @@
1
1
  # @contentful/experience-design-system-cli
2
2
 
3
- CLI for extracting, reviewing, generating, validating, and pushing Contentful Experience Design System component definitions into Experiences
3
+ CLI for extracting, reviewing, generating, validating, and pushing Contentful Experience Design System component definitions into Experiences.
4
+
5
+ ## Binaries
6
+
7
+ The package installs three equivalent binaries:
8
+
9
+ | Binary | Notes |
10
+ | ------------------------------- | -------------------------------------------------------------------- |
11
+ | `experiences` | Preferred entry point — short and operator-facing |
12
+ | `exo` | Shorthand for Experience Orchestration |
13
+ | `experience-design-system-cli` | Full name; used in CI / scripts where clarity matters |
14
+
15
+ The rest of this README uses `experiences`.
4
16
 
5
17
  ## CLI Overview
6
18
 
7
- The commands form a pipeline. Run them in order, or use `import` to orchestrate the whole thing at once:
19
+ There are two ways to use the CLI:
8
20
 
9
- ```
10
- analyze extract → analyze select-agent → generate components → apply push
11
- ```
21
+ 1. **`experiences import`** — the wizard. Drives the full pipeline (extract → AI select → scope-gate → generate → final-review → save/push) from a single command. Works in two modes: a full-screen interactive TUI in a real terminal, and a non-interactive headless mode when you pass `--auto-accept-scope` plus credentials. **This is the recommended path for almost everyone.**
22
+
23
+ 2. **Standalone subcommands** — for piping into other tools, CI parity with the wizard, or for debugging individual steps:
24
+
25
+ ```
26
+ analyze extract → analyze select-agent → generate components → apply push
27
+ ```
12
28
 
13
- `analyze select-agent` uses an AI agent to decide which extracted components belong in Contentful Experience Orchestration. You can substitute it with `analyze select` for manual/pattern-based selection.
29
+ `analyze select-agent` is the agent-driven selection step the wizard uses. You can replace it with `analyze select` for the older manual JsonEditor TUI.
14
30
 
15
- **Determinism boundary.** `analyze extract` is fully deterministic: ts-morph AST parsing produces the same component list and prop shape on every run, then a deterministic pre-classifier and a structural non-authorable filter (see below) shape the output. AI enters the pipeline at `analyze select-agent` and `generate components`, where coding agents make per-component decisions. This split keeps the extracted artifact reproducible and inspectable — if an extracted component looks wrong, the cause is in the rules, not in agent variability.
31
+ **Determinism boundary.** `analyze extract` is fully deterministic: ts-morph AST parsing produces the same component list and prop shape on every run, then a deterministic pre-classifier and a structural non-authorable filter shape the output. AI enters the pipeline at `analyze select-agent` and `generate components`, where coding agents make per-component decisions. This split keeps the extracted artifact reproducible — if an extracted component looks wrong, the cause is in the rules, not in agent variability.
16
32
 
17
- All intermediate data flows through a local SQLite session database (`~/.contentful/experience-design-system-cli/pipeline.db`). No JSON files are written between steps — each command reads its inputs from the session and writes its outputs back to it. Use `print` to export session data to JSON files on demand (e.g. for inspection or manual validation).
33
+ All intermediate data flows through a local SQLite session database (`~/.contentful/experience-design-system-cli/pipeline.db`). No JSON files are written between steps — each command reads its inputs from the session and writes its outputs back to it. Use `print` to export session data to JSON files on demand. The wizard additionally maintains a separate **runs.json** file (`~/.config/experiences/runs.json`) that records each successful wizard session so it can be replayed later with `--push-from-run` or `--modify`.
18
34
 
19
35
  ---
20
36
 
@@ -33,9 +49,11 @@ All intermediate data flows through a local SQLite session database (`~/.content
33
49
 
34
50
  The CLI invokes the agent non-interactively in a subprocess. If the binary is not found in `$PATH`, the command exits 1 and prints manual fallback instructions.
35
51
 
52
+ `experiences setup` persists your chosen agent (and optional model + custom prompt paths) to `~/.config/experiences/credentials.json`; later commands pick them up automatically.
53
+
36
54
  ### Contentful credentials
37
55
 
38
- `apply preview`, `apply select`, `apply push`, and `import` require access to a Contentful space. Set these environment variables (or pass the equivalent flags):
56
+ `apply preview`, `apply select`, `apply push`, and `import` (when pushing) require access to a Contentful space. Set these environment variables or pass the equivalent flags:
39
57
 
40
58
  ```bash
41
59
  export CONTENTFUL_MANAGEMENT_TOKEN=<your-cma-token> # required
@@ -43,486 +61,326 @@ export CONTENTFUL_SPACE_ID=<your-space-id> # required
43
61
  export CONTENTFUL_ENVIRONMENT_ID=master # required
44
62
  ```
45
63
 
46
- **Option A Contentful CLI:**
47
-
48
- ```bash
49
- npm install -g contentful-cli
50
- contentful login # opens browser OAuth flow; token is stored in ~/.contentfulrc.json
51
- ```
52
-
53
- After logging in, retrieve the token:
54
-
55
- ```bash
56
- # Prints the stored token
57
- contentful login
58
-
59
- # Or read it directly
60
- cat ~/.contentfulrc.json
61
- ```
62
-
63
- **Option B — Contentful web app:**
64
-
65
- Settings → API keys → Content management tokens → Generate personal token.
66
-
67
- Once you have the token, export it:
64
+ Or run `experiences setup` once and they get saved to `credentials.json` and pre-filled in the wizard.
68
65
 
69
- ```bash
70
- export CONTENTFUL_MANAGEMENT_TOKEN=<your-cma-token>
71
- ```
72
-
73
- Alternatively, pass `--cma-token`, `--space-id`, and `--environment-id` directly on each command.
66
+ In the wizard's credentials step you can press `[s] Skip` to save-only without pushing — useful when you want a checked-in `components.json` without a live push.
74
67
 
75
68
  ---
76
69
 
77
- ## Commands
78
-
79
- ### `analyze extract`
80
-
81
- Extract component definitions from a project source tree.
70
+ ## The `import` wizard
82
71
 
83
72
  ```bash
84
- experience-design-system-cli analyze extract --project <path> [--dir <src-dir>]
73
+ experiences import [flags]
85
74
  ```
86
75
 
87
- | Option | Default | Description |
88
- |---|---|---|
89
- | `--project <path>` | _(required)_ | Path to the project root |
90
- | `--dir <path>` | `src` (falls back to project root) | Source directory relative to project root |
91
-
92
- Scans `.tsx`, `.ts`, `.jsx`, `.js`, `.vue`, and `.astro` files. Ignores `node_modules`, `dist`, `build`, `.next`, `.nuxt`, `coverage`, `storybook-static`, and `out` directories. Also ignores `*.stories.*`, `*.story.*`, `*.spec.*`, and `*.test.*` files.
93
-
94
- Writes extracted components to the session database and prints `session=<id>` to stdout. In an interactive terminal, a scrollable TUI displays the extraction summary (including a warning for any components with 0 props and 0 slots); press `q` or `Enter` to exit.
95
-
96
- #### Non-authorable component filter
97
-
98
- Before storing components, `analyze extract` runs a deterministic filter that drops infrastructure components which have no authoring surface (Context providers, analytics shims, security utilities, layout helpers). The filter uses prop-shape signals only — no component-name or source-path patterns — so it works regardless of how a host repo organizes its design system. A component is dropped if **any** of:
76
+ `experiences import` is the primary entry point. In a TTY it launches a full-screen wizard. In headless mode (any of `--auto-accept-scope`, `--skip-apply`, `--skip-analyze`, `--skip-generate`, `--yes`, `--dry-run`, or credential flags) it runs non-interactively. Without either, it fails loud rather than hanging.
99
77
 
100
- 1. Zero props and zero slots.
101
- 2. Source calls `createContext()` and the component has a prop literally named `value`.
102
- 3. Source calls `createContext()` and the component has zero props.
103
- 4. Source calls `createContext()` and the component has exactly one non-handler prop.
104
- 5. Every prop is a handler or ref (function-typed, `EventHandler`, `Dispatch`, `SetStateAction`, `Ref<>`, name starts with `on`/`set`, or named `ref`/`innerRef`).
105
-
106
- Each dropped component is reported as a warning (`Skipped non-authorable component: <Name> (<reason>)`) so the operator can audit. The rule set was selected via Monte-Carlo evaluation against a hand-labelled corpus to maximize precision (zero false positives) over recall — components that look like normal authoring surface but are actually infrastructure are deferred to the AI selection stage rather than dropped here.
107
-
108
- ---
109
-
110
- ### `analyze select`
78
+ ### Wizard step machine
111
79
 
112
- Interactively select components for generation and optionally patch their definitions. Alias: `analyze edit`.
113
-
114
- ```bash
115
- experience-design-system-cli analyze select [--session <id>] [--project-root <path>]
116
80
  ```
117
-
118
- | Option | Default | Description |
119
- |---|---|---|
120
- | `--session <id>` | most recent completed `analyze extract` | Session ID from `analyze extract` |
121
- | `--project-root <path>` | `cwd` | Project root for resolving component source files |
122
- | `--select-all` | — | Select all components without launching the TUI |
123
- | `--select <pattern>` | | Select components whose name contains pattern (repeatable) |
124
- | `--deselect <pattern>` | — | Deselect components whose name contains pattern (repeatable) |
125
- | `--accept-all` | | Alias for `--select-all` |
126
- | `--reject <pattern>` | | Alias for `--deselect <pattern>` (repeatable) |
127
- | `--patch <path>` | — | Path to a JSON patch file for structured overrides |
128
-
129
- Without `--select-all`, `--select`, `--deselect`, or `--patch`, launches a full-screen TUI (requires 60+ columns). With any non-interactive flag, exits immediately after applying decisions.
130
-
131
- #### Keyboard Reference
132
-
133
- | Key | Action |
134
- |---|---|
135
- | `↑` / `k` | Navigate up |
136
- | `↓` / `j` | Navigate down |
137
- | `Tab` | Toggle focus between sidebar and main panel |
138
- | `a` | Accept selected component |
139
- | `r` | Reject selected component |
140
- | `e` | Enter edit mode for selected component |
141
- | `s` | Toggle source code panel (requires 120+ cols) |
142
- | `A` | Approve all unreviewed components |
143
- | `F` | Open finalize dialog |
144
- | `q` | Quit (prompts if unsaved edits) |
145
- | `?` | Toggle help overlay |
146
-
147
- **In edit mode:**
148
-
149
- | Key | Action |
150
- |---|---|
151
- | Arrow keys | Move cursor |
152
- | `Ctrl+S` | Save edits (validates JSON) |
153
- | `Ctrl+Z` | Undo |
154
- | `Esc` | Discard changes |
155
-
156
- #### Patch file format
157
-
158
- `--patch` accepts a JSON array of operations. Each operation targets a component by name:
159
-
160
- ```json
161
- [
162
- { "component": "Button", "status": "accepted" },
163
- { "component": "Input", "status": "rejected" },
164
- { "component": "Card", "set": { "props[name=variant].type": "string" } }
165
- ]
81
+ welcome
82
+
83
+ extracting — runs analyze extract; spawns generate in parallel (prefetch)
84
+
85
+ [auto-filter] — analyze select-agent runs automatically (skip with --no-auto-filter)
86
+
87
+ scope-gate single human review gate: confirm AI selection, toggle components
88
+
89
+ credentials — operator types space-id / env / token (generate is already running)
90
+ press [s] Skip to save-only without pushing
91
+
92
+ final-review — minimum-viable port of the JsonEditor; edit names, $description,
93
+ $default, $allowedComponents per slot, $values, source/rationale panels
94
+
95
+ preview — diff vs. live Contentful
96
+
97
+ push-decision-gate — choose Save AND push (default) or one of the alternatives
98
+
99
+ pushing done — push emits a Contentful webapp view URL for the imported components
166
100
  ```
167
101
 
168
- `set` paths support dot notation and array item matching with `[name=value]` predicates.
102
+ There is now a single human review gate (`scope-gate`) before generation; the legacy two-step extract-review + select-review flow has been collapsed.
169
103
 
170
- #### Session resume
104
+ ### Configurable AI auto-filter
171
105
 
172
- The review session is persisted in `~/.contentful/experience-design-system-cli/`. If the TUI is interrupted, re-running with the same `--session` resumes where you left off.
106
+ The auto-filter (`analyze select-agent` invoked before scope-gate) is on by default. Override per-run with `--auto-filter` / `--no-auto-filter`; the value last selected in the wizard is persisted to `credentials.json` so subsequent runs default to your last choice.
173
107
 
174
- ---
108
+ ### Save-and-push default
175
109
 
176
- ### `analyze select-agent`
110
+ The push-decision-gate defaults to **save AND push**: it writes `components.json` and `tokens.json` to disk *and* pushes to Contentful in one step. Use `--no-save` to push-only or `--no-push` to save-only. `--out-dir <path>` picks the save directory non-interactively (otherwise the wizard prompts).
177
111
 
178
- Use an AI agent to decide which extracted components belong in Contentful Experience Orchestration as Component Types. Accepts any component that renders visible UI (atoms, molecules, and organisms are all valid) and rejects non-visual infrastructure: React hooks, context providers, A/B testing or variant-routing wrappers, analytics trackers, and security utilities. Runs one agent invocation per component at configurable concurrency, mirroring how `generate components` works.
112
+ ### Replaying prior runs
179
113
 
180
- ```bash
181
- experience-design-system-cli analyze select-agent --agent claude [--session <id>]
182
- ```
114
+ After every successful wizard session, the CLI appends a record to `~/.config/experiences/runs.json` and prints a teaser pointing at the run-id. Subsequent invocations can reuse that record:
183
115
 
184
- | Option | Default | Description |
185
- |---|---|---|
186
- | `--agent <name>` | _(required)_ | Agent to use: `claude`, `codex`, `opencode`, or `cursor` |
187
- | `--session <id>` | most recent completed `analyze extract` | Session ID from `analyze extract` |
188
- | `--project-root <path>` | `cwd` | Project root for resolving component source files |
189
- | `--model <name>` | agent default | Model to use (defaults to a small/fast model per agent) |
190
- | `--verbose` | — | Show full agent output including reasoning text |
191
- | `--dry-run` | — | Print the prompt for the first component without invoking the agent |
116
+ | Flag | What it does |
117
+ | --------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
118
+ | `--push-from-run <id-or-path>` | Re-push the recorded session to Contentful without re-opening the wizard or writing to disk. Mutually exclusive with `--modify`, `--project`, `--no-save`, `--no-push`. |
119
+ | `--modify <id-or-path>` | Re-open the wizard at final-review with the prior run pre-populated. Pair with `--overwrite` (save back to recorded `savePath`) or `--save-as-new` (prompt for new path). |
120
+ | `--overwrite` / `--save-as-new` | Save-mode selector for `--modify`; mutually exclusive with each other. |
192
121
 
193
- Results are written to the same session state file used by `analyze select`, so `generate components` will pick up the decisions automatically. If you want to review or override the agent's selections, run `analyze select --session <id>` after `select-agent` completes.
122
+ Both flags accept either a run id or a filesystem path that matches a recorded `savePath`.
194
123
 
195
- ---
124
+ ### Custom skill prompts
196
125
 
197
- ### `generate components`
126
+ Pass `--select-prompt-path <path>` and/or `--generate-prompt-path <path>` to swap in a custom `.md` skill prompt instead of the bundled one. The CLI emits a banner at agent invocation noting the override. Paths can also be saved via `experiences setup`.
198
127
 
199
- Invoke a coding agent to generate CDF component definitions from raw analysis output. Results are stored in the session database and passed directly to `apply` commands via `--session`. Use `print components` to export them to a JSON file on demand.
128
+ ### Flag reference `experiences import`
200
129
 
201
- ```bash
202
- experience-design-system-cli generate components --agent claude [--session <id>]
203
- ```
130
+ | Flag | Default | Description |
131
+ | --------------------------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
132
+ | `--space-id <id>` | `CONTENTFUL_SPACE_ID` env / saved | Contentful space ID (required unless `--skip-apply` / `--no-push`) |
133
+ | `--environment-id <id>` | `CONTENTFUL_ENVIRONMENT_ID` env | Contentful environment ID |
134
+ | `--cma-token <token>` | `CONTENTFUL_MANAGEMENT_TOKEN` env | CMA personal access token |
135
+ | `--project <path>` | `.` | Project root to analyze |
136
+ | `--out <path>` | `<project>/.contentful` | Headless-mode output directory |
137
+ | `--out-dir <path>` | _(prompt)_ | Save directory for `components.json` / `tokens.json`; bypasses inline save-path prompt |
138
+ | `--agent <name>` | saved by setup / `claude` | Agent for `analyze select-agent` and `generate components` |
139
+ | `--model <name>` | agent default | Model name |
140
+ | `--tokens <path>` | — | DTCG `tokens.json` to push alongside generated components |
141
+ | `--auto-accept-scope` | off | Accept all extracted components without prompting (required for non-TTY without other headless flags) |
142
+ | `--auto-filter` / `--no-auto-filter` | persisted in `credentials.json` | Force AI auto-filter on or off; overrides saved preference |
143
+ | `--no-live-preview` | live preview on | Skip the automatic preview re-run after each FieldEditor save |
144
+ | `--no-push` | push on | Run extract → scope-gate → generate → final-review and exit without pushing |
145
+ | `--no-save` | save on | Push without writing `components.json` / `tokens.json` to disk |
146
+ | `--push-from-run <id-or-path>` | — | Re-push a prior run; never writes to disk |
147
+ | `--modify <id-or-path>` | — | Re-open the wizard at final-review with a prior run loaded |
148
+ | `--overwrite` | — | With `--modify`: save back to recorded `savePath` |
149
+ | `--save-as-new` | — | With `--modify`: always save to a new path |
150
+ | `--select-prompt-path <path>` | saved by setup | Custom `.md` skill prompt for `analyze select-agent` |
151
+ | `--generate-prompt-path <path>` | saved by setup | Custom `.md` skill prompt for `generate components` |
152
+ | `--select-all` | — | Headless: accept all extracted components (bypasses agentic select) |
153
+ | `--select <pattern>` | — | Headless: accept components matching pattern (repeatable; bypasses agentic select) |
154
+ | `--deselect <pattern>` | — | Headless: reject components matching pattern (repeatable; bypasses agentic select) |
155
+ | `--skip-analyze` | — | Reuse most recent `analyze extract` session |
156
+ | `--skip-generate` | — | Reuse most recent `generate components` session |
157
+ | `--print` | — | Headless: write `components.json` to `--out` after generation |
158
+ | `--skip-apply` | — | Stop after generate; do not push |
159
+ | `--no-cache` | cache on | Bypass extract/select/generate fine-grained caches and force re-run; forwarded to `analyze select-agent` and `generate components` |
160
+ | `--yes` | — | Skip interactive confirmation in `apply push` |
161
+ | `--verbose` | — | Show full agent output and all entity progress |
162
+ | `--exclude-invalid` | off (fail loud) | Auto-reject components with validation errors instead of refusing to proceed |
163
+ | `--viewports <path>` | catch-all viewport | JSON file with viewport array (passed to `apply push`) |
164
+ | `--host <url>` | `https://api.contentful.com` | Override API base URL |
165
+ | `--on-conflict <mode>` | _(prompt via `<SaveConflictGate>`)_ | Headless conflict resolution when a file already exists at the save path: `overwrite`, `skip`, or `fail`. Bypasses the wizard's interactive save-conflict gate. Mutex with `--no-save`. |
166
+ | `--print-prompt` | — | Print the generate prompt to stdout and exit. Replaces the prompt-print semantics of `--dry-run`. |
167
+ | `--dry-run` | _(deprecated)_ | Deprecated alias for `--print-prompt`. Emits a stderr deprecation notice; prompt-print semantics will be removed in a future release. |
204
168
 
205
- | Option | Default | Description |
206
- |---|---|---|
207
- | `--agent <name>` | _(required)_ | Agent to use: `claude`, `codex`, `opencode`, or `cursor` |
208
- | `--session <id>` | most recent completed `analyze extract` | Session ID from `analyze extract` |
209
- | `--tokens <path>` | — | Path to `tokens.json` for token-linked prop resolution (optional) |
210
- | `--token-map <path>` | — | Path to `token-name-map.json` sidecar (optional) |
211
- | `--model <name>` | agent default | Model to use (defaults to a small/fast model per agent) |
212
- | `--dry-run` | — | Print the prompt without invoking the agent |
169
+ ### Run-picker at wizard start
213
170
 
214
- Raw components are loaded from the session database and embedded directly in the prompt no intermediate file is read. On success, generated CDF components are written back to the session database and `session=<id>` is printed to stdout.
171
+ When `~/.config/experiences/runs.json` contains one or more entries, none of `--push-from-run`, `--modify`, or `--project` was passed, and stdin is a TTY, the wizard opens with an interactive **run picker** before the welcome step. The operator can:
215
172
 
216
- **Autonomous mode** (default): the agent runs non-interactively, prints its result between `<<<EDS_OUTPUT_START>>>` / `<<<EDS_OUTPUT_END>>>` sentinel markers, and the CLI stores the validated CDF in the session database.
173
+ - Pick a recent run, then choose **Push** or **Modify** equivalent to invoking `--push-from-run` or `--modify` for that run id
174
+ - Select **Show all** to expand beyond the most-recent rows
175
+ - Select **Start a new run** to fall through to the normal `welcome → extracting → ...` flow
217
176
 
218
- If the agent binary is not found in `$PATH`, the command exits 1 and prints manual fallback instructions including the skill file path.
177
+ The mount decision is deterministic passing any of `--push-from-run`, `--modify`, or `--project` skips the picker and lands on the existing step machine.
219
178
 
220
- ---
179
+ ### `--modify` end-to-end behavior
221
180
 
222
- ### `generate components edit`
181
+ `--modify <id-or-path>` is fully wired: the wizard loads the recorded session from `pipeline.db` (skipping extract and generate entirely), pre-fills credentials from the run record's `pushedTo` target, and lands directly on `final-review` — or on `scope-gate` if the run record carries an `entryStep` hint. Pair with `--overwrite` or `--save-as-new` to control the save target.
223
182
 
224
- Review and correct the output of `generate components` before pushing.
183
+ ### `--model` and `--agent` overrides
225
184
 
226
- ```bash
227
- experience-design-system-cli generate components edit [--session <id>]
228
- ```
185
+ `--model <name>` overrides the stored model for this run. The resolution order is:
229
186
 
230
- | Option | Default | Description |
231
- |---|---|---|
232
- | `--session <id>` | most recent active session | Session ID to operate on |
233
- | `--accept-all` | — | Accept all definitions without launching the TUI |
234
- | `--reject <pattern>` | — | Reject definitions whose name contains pattern (repeatable) |
235
- | `--patch <path>` | — | Path to a JSON patch file for structured overrides |
187
+ 1. `--model <name>` flag
188
+ 2. `model` field saved in `~/.config/experiences/credentials.json`
189
+ 3. Built-in default for the chosen agent
236
190
 
237
- ---
191
+ `--agent <name>` works the same way and is a fully functional wizard override — earlier releases plumbed the flag but the commander default shadowed it; the flag now wins over the saved value as expected.
238
192
 
239
193
  ---
240
194
 
241
- ### `generate tokens`
195
+ ## `experiences runs`
242
196
 
243
- Invoke a coding agent to generate DTCG design tokens from raw token data. Results are stored in the session database and passed directly to `apply` commands via `--session`. Use `print tokens` to export them to a JSON file on demand.
197
+ List recorded wizard runs from `~/.config/experiences/runs.json`, or print the detail view for a single run.
244
198
 
245
199
  ```bash
246
- experience-design-system-cli generate tokens --agent claude [--raw-tokens <path>]
200
+ experiences runs [<id-or-path>] [--project <path>] [--limit <n>] [--pushed | --not-pushed] [--json]
247
201
  ```
248
202
 
249
- | Option | Default | Description |
250
- |---|---|---|
251
- | `--agent <name>` | _(required)_ | Agent to use: `claude`, `codex`, `opencode`, or `cursor` |
252
- | `--raw-tokens <path>` | | Path to raw token input file |
253
- | `--model <name>` | agent default | Model to use (defaults to a small/fast model per agent) |
254
- | `--dry-run` | | Print the prompt without invoking the agent |
255
-
256
- ---
257
-
258
- ### `generate tokens edit`
259
-
260
- Review and correct the output of `generate tokens` before pushing.
203
+ | Option | Description |
204
+ | ------------------- | ---------------------------------------------------------------------------------------- |
205
+ | `<id-or-path>` | Positional. Print the detail view for a single run by id or recorded save path. Path resolution sniffs for `/`, `./`, or `~/` prefix (and the bare `.` / `~` values) via `resolveRunTarget()`. |
206
+ | `--project <path>` | Filter by source project path (absolute). |
207
+ | `--limit <n>` | Cap the number of rows printed. |
208
+ | `--pushed` | Show only runs that were pushed to Contentful. Mutex with `--not-pushed`. |
209
+ | `--not-pushed` | Show only runs that were never pushed. Mutex with `--pushed`. |
210
+ | `--json` | Emit machine-readable output: `RunRecord[]` for the list view; a single `RunRecord` object when combined with `<id-or-path>`. |
261
211
 
262
- ```bash
263
- experience-design-system-cli generate tokens edit [--session <id>]
264
- ```
212
+ Each row prints the run id, creation time, project path, save path, component count, and push target (or `(not pushed)`). Table columns auto-expand to fit content — long project / save paths are no longer truncated. Below the table, a copy-friendly footer prints command hints (`--push-from-run`, `--modify`) for the newest run.
265
213
 
266
- Accepts the same flags as `generate components edit`.
214
+ Pair with `--push-from-run` or `--modify` on `experiences import` to replay a row.
267
215
 
268
216
  ---
269
217
 
270
- ### `print components`
218
+ ## Standalone subcommands
271
219
 
272
- Write generated CDF component definitions from the session database to a JSON file.
220
+ The standalone subcommands below are pinned by snapshot test (`test/analyze/select-flags.test.ts` and friends) and remain backwards-compatible. The wizard internally calls these same commands.
273
221
 
274
- ```bash
275
- experience-design-system-cli print components [--session <id>] [--out <path>]
276
- ```
277
-
278
- | Option | Default | Description |
279
- |---|---|---|
280
- | `--session <id>` | most recent completed `generate components` session | Session ID to read from |
281
- | `--out <path>` | `components.json` | Output file path |
282
-
283
- Exits 1 if no generated components exist for the session.
284
-
285
- ---
286
-
287
- ### `print tokens`
222
+ ### `analyze extract`
288
223
 
289
- Write generated DTCG design tokens from the session database to a JSON file.
224
+ Extract component definitions from a project source tree.
290
225
 
291
226
  ```bash
292
- experience-design-system-cli print tokens [--session <id>] [--out <path>]
227
+ experiences analyze extract --project <path> [--dir <src-dir>]
293
228
  ```
294
229
 
295
230
  | Option | Default | Description |
296
231
  |---|---|---|
297
- | `--session <id>` | most recent completed `generate tokens` session | Session ID to read from |
298
- | `--out <path>` | `tokens.json` | Output file path |
299
-
300
- Reconstructs the full DTCG nested tree (groups + leaf tokens) from the normalized session storage. Exits 1 if no generated tokens exist for the session.
301
-
302
- ---
303
-
304
- ### `print validate`
305
-
306
- Validate CDF component definitions and/or DTCG token files against their schemas.
232
+ | `--project <path>` | _(required)_ | Path to the project root |
233
+ | `--dir <path>` | `src` (falls back to project root) | Source directory relative to project root |
307
234
 
308
- ```bash
309
- experience-design-system-cli print validate [--components <path>] [--tokens <path>]
310
- ```
235
+ Scans `.tsx`, `.ts`, `.jsx`, `.js`, `.vue`, and `.astro` files. Ignores `node_modules`, `dist`, `build`, `.next`, `.nuxt`, `coverage`, `storybook-static`, `out`, `demo(s)`, and `example(s)` directories. Also ignores `*.stories.*`, `*.story.*`, `*.spec.*`, and `*.test.*` files.
311
236
 
312
- | Option | Description |
313
- |---|---|
314
- | `--components <path>` | Path to a CDF component JSON file |
315
- | `--tokens <path>` | Path to a DTCG token JSON file |
237
+ Writes extracted components to the session database and prints `session=<id>` to stdout. In an interactive terminal, a scrollable TUI displays the extraction summary; press `q` or `Enter` to exit.
316
238
 
317
- At least one flag is required. In an interactive terminal, a scrollable TUI displays validation results. Exit code: `0` if all files are valid, `1` if any errors are found.
239
+ The deterministic non-authorable filter drops infrastructure components with no authoring surface (Context providers, refs-only wrappers, etc.); each drop is reported as a warning so the operator can audit.
318
240
 
319
241
  ---
320
242
 
321
- ### `apply preview`
243
+ ### `analyze select`
322
244
 
323
- Show a read-only diff of what `apply push` would do.
245
+ Standalone JsonEditor TUI for picking which components to include. Alias: `analyze edit`. **Untouched by the wizard rebuild** — the rich full-screen editor remains the way to operate outside the wizard.
324
246
 
325
247
  ```bash
326
- experience-design-system-cli apply preview \
327
- --space-id $CONTENTFUL_SPACE_ID \
328
- --environment-id master \
329
- --session <id>
248
+ experiences analyze select [--session <id>] [--project-root <path>]
330
249
  ```
331
250
 
332
- At least one of `--session`, `--components`, or `--tokens` is required. `--session` and `--components` are mutually exclusive.
333
-
334
251
  | Option | Default | Description |
335
252
  |---|---|---|
336
- | `--session <id>` | | Session ID from `generate components` (reads components from session DB) |
337
- | `--components <path>` | | Path to a CDF `components.json` file (alternative to `--session`) |
338
- | `--tokens <path>` | — | Path to a DTCG `tokens.json` file |
339
- | `--space-id <id>` | _(required)_ | Contentful space ID |
340
- | `--environment-id <id>` | _(required)_ | Contentful environment ID |
341
- | `--cma-token <token>` | `CONTENTFUL_MANAGEMENT_TOKEN` env | CMA personal access token or app token |
342
- | `--viewports <path>` | single catch-all viewport | JSON file with a viewport array applied to every imported component type |
343
- | `--host <url>` | `https://api.contentful.com` | Override API base URL |
344
- | `--include-unchanged` | — | Include unchanged entities in non-interactive JSON output |
345
-
346
- In interactive mode, renders a two-level TUI: a summary view listing entities by status (new / changed / unchanged / conflict), with `Enter` to expand into a property-level diff view. In non-interactive mode, writes a structured JSON diff to stdout. Exit code: `0` if the diff is clean, `1` if there are kind conflicts that would block the push.
253
+ | `--session <id>` | most recent completed `analyze extract` | Session ID from `analyze extract` |
254
+ | `--project-root <path>` | `cwd` | Project root for resolving component source files |
255
+ | `--select-all` | — | Select all components without launching the TUI |
256
+ | `--select <pattern>` | | Select components whose name contains pattern (repeatable) |
257
+ | `--deselect <pattern>` | | Deselect components whose name contains pattern (repeatable) |
258
+ | `--accept-all` | | Alias for `--select-all` |
259
+ | `--reject <pattern>` | | Alias for `--deselect <pattern>` (repeatable) |
260
+ | `--patch <path>` | | Path to a JSON patch file for structured overrides |
261
+ | `--exclude-invalid` | — | With `--select-all`: auto-reject components with validation errors |
262
+ | `--exclude-components <names>` | — | Comma-separated names to force-reject regardless of other flags |
263
+
264
+ Without any non-interactive flag, launches a full-screen TUI requiring 60+ columns. Keyboard reference and patch-file format are unchanged from prior releases.
347
265
 
348
266
  ---
349
267
 
350
- ### `apply select`
268
+ ### `analyze select-agent`
351
269
 
352
- Choose a subset of entities to push. Opens a checkbox TUI after computing the diff, or use non-interactive flags.
270
+ Use an AI agent to decide which extracted components belong in Contentful Experience Orchestration. Runs one agent invocation per component at configurable concurrency.
353
271
 
354
272
  ```bash
355
- experience-design-system-cli apply select \
356
- --space-id $CONTENTFUL_SPACE_ID \
357
- --environment-id master \
358
- --session <id>
273
+ experiences analyze select-agent [--agent <name>] [--session <id>]
359
274
  ```
360
275
 
361
- Accepts the same flags as `apply preview` (except `--include-unchanged`), plus:
362
-
363
276
  | Option | Default | Description |
364
277
  |---|---|---|
365
- | `--select-all` | | Select all entities without launching TUI |
366
- | `--select <pattern>` | | Select entities by ID pattern (repeatable) |
367
- | `--deselect <pattern>` | | Deselect entities by ID pattern (repeatable) |
368
-
369
- **Default TUI selection:** entities with status `new` or `changed` are pre-selected; `unchanged` and `kindConflict` start unchecked.
278
+ | `--agent <name>` | saved by `experiences setup` | Agent: `claude`, `codex`, `opencode`, or `cursor` |
279
+ | `--session <id>` | most recent completed `analyze extract` | Session ID from `analyze extract` |
280
+ | `--project-root <path>` | `cwd` | Project root for resolving component source files |
281
+ | `--model <name>` | agent default | Model to use |
282
+ | `--verbose` | | Show full agent output including reasoning text |
283
+ | `--dry-run` | — | Print the prompt for the first component without invoking the agent |
284
+ | `--exclude-invalid` | — | Auto-reject components with validation errors instead of failing loud |
285
+ | `--select-prompt-path <path>` | saved by setup | Custom `.md` skill prompt (bypasses bundled invariants); emits a banner at invocation |
286
+ | `--no-select-cache` | cache on | Skip the per-component select cache and re-LLM every component |
287
+ | `--no-cache` | cache on | Skip all fine-grained caches (extract, select, generate) |
288
+ | `--show-rationale` | — | Read-only mode. Print the recorded accept / reject rationale for every component in the session and exit. Reads `raw_components.reject_reason` from the pipeline DB — no LLM call, no schema change. |
289
+ | `--json` | — | With `--show-rationale`: emit the rationale rows as JSON for scripting. |
370
290
 
371
- **Keyboard map (TUI):**
291
+ Decisions are written to the same review state file used by `analyze select`, so `generate components` picks them up automatically. Each `(component-hash, prompt-hash, cli-version)` triple is cached; changing the prompt file via `--select-prompt-path` already busts the corresponding cache entries.
372
292
 
373
- | Key | Action |
374
- |---|---|
375
- | `↑` / `↓` | Move cursor |
376
- | `Space` | Toggle entity |
377
- | `A` | Select all |
378
- | `N` | Deselect all |
379
- | `I` | Push selected entities |
380
- | `Q` | Quit without pushing |
293
+ `--show-rationale` is a separate read-only mode — it does not invoke the agent and is safe to run against a completed session at any time. Pair with `--session <id>` to target a specific session; otherwise it auto-resolves to the most recent completed `analyze extract`.
381
294
 
382
295
  ---
383
296
 
384
- ### `apply push`
297
+ ### `generate components`
385
298
 
386
- Write component types and design tokens to Contentful ExO.
299
+ Invoke a coding agent to generate CDF component definitions. Results are stored in the session database.
387
300
 
388
301
  ```bash
389
- experience-design-system-cli apply push \
390
- --space-id $CONTENTFUL_SPACE_ID \
391
- --environment-id master \
392
- --session <id>
302
+ experiences generate components [--agent <name>] [--session <id>]
393
303
  ```
394
304
 
395
- Accepts the same flags as `apply preview` (except `--include-unchanged`), plus:
396
-
397
305
  | Option | Default | Description |
398
306
  |---|---|---|
399
- | `--yes` | | Skip interactive confirmation (required in non-TTY mode) |
400
-
401
- Design tokens are written first (component types may reference token kinds). Each entity write is recorded in the session database atomically — if the push is interrupted, re-running with the same flags resumes from where it left off, skipping already-succeeded entities.
402
-
403
- #### Viewport configuration
404
-
405
- By default every imported component type gets a single catch-all viewport:
406
-
407
- ```json
408
- [{ "id": "all", "query": "*", "displayName": "All Sizes", "previewSize": "100%" }]
409
- ```
307
+ | `--agent <name>` | saved by setup | Agent: `claude`, `codex`, `opencode`, or `cursor` |
308
+ | `--session <id>` | most recent completed `analyze extract` | Session ID from `analyze extract` |
309
+ | `--tokens <path>` | | Path to `tokens.json` for token-linked prop resolution |
310
+ | `--token-map <path>` | — | Path to `token-name-map.json` sidecar |
311
+ | `--model <name>` | agent default | Model to use |
312
+ | `--verbose` | — | Show full agent output |
313
+ | `--dry-run` | | Print the prompt without invoking the agent |
314
+ | `--generate-prompt-path <path>` | saved by setup | Custom `.md` skill prompt; emits a banner at invocation |
315
+ | `--no-cache` | cache on | Bypass all fine-grained caches and force re-run |
410
316
 
411
- To apply a custom set, pass `--viewports <path>` with a JSON array of objects containing `id`, `query`, `displayName`, and `previewSize`.
317
+ Raw components are loaded from the session database and embedded directly in the prompt — no intermediate file is read. The agent emits one JSON tool-call object per line; per-component results (CDF body + LLM rationale + source location) are persisted to the session DB.
412
318
 
413
319
  ---
414
320
 
415
- ### `import`
321
+ ### `generate components edit` / `generate tokens edit`
416
322
 
417
- Run the full pipeline in one command: analyze select-agent generate push.
323
+ Non-interactive correction of generated output via `--accept-all`, `--reject`, or `--patch`. The interactive TUI variant is not currently shipped.
418
324
 
419
- ```bash
420
- experience-design-system-cli import \
421
- --space-id $CONTENTFUL_SPACE_ID \
422
- --environment-id master \
423
- --cma-token $CONTENTFUL_MANAGEMENT_TOKEN \
424
- --project <path> \
425
- --agent claude
426
- ```
427
-
428
- Contentful credentials (`--space-id`, `--environment-id`, `--cma-token`) are only required when the apply step runs. Pass `--skip-apply` to run the pipeline without pushing to Contentful.
325
+ ---
429
326
 
430
- The select step uses `analyze select-agent` by default, letting the agent decide which components belong in Experience Orchestration. Pass `--select-all`, `--select`, or `--deselect` to override with pattern-based selection instead. To review and select components interactively, run the steps manually rather than using `import`.
327
+ ### `generate tokens`
431
328
 
432
- | Option | Default | Description |
433
- |---|---|---|
434
- | `--space-id <id>` | _(required unless `--skip-apply`)_ | Contentful space ID |
435
- | `--environment-id <id>` | _(required unless `--skip-apply`)_ | Contentful environment ID |
436
- | `--cma-token <token>` | `CONTENTFUL_MANAGEMENT_TOKEN` env | CMA personal access token or app token |
437
- | `--project <path>` | `.` | Path to the project root to analyze |
438
- | `--out <path>` | `<project>/.contentful` | Directory where `components.json` is written when `--print` is set |
439
- | `--agent <name>` | `claude` | Agent to use for `analyze select-agent` and `generate components` |
440
- | `--model <name>` | agent default | Model to use for agent steps |
441
- | `--select-all` | — | Skip agentic select; accept all extracted components |
442
- | `--select <pattern>` | — | Skip agentic select; accept components matching pattern (repeatable) |
443
- | `--deselect <pattern>` | — | Skip agentic select; deselect components matching pattern (repeatable) |
444
- | `--skip-analyze` | — | Skip analyze; use most recent `analyze extract` session |
445
- | `--skip-generate` | — | Skip generate; use most recent `generate components` session |
446
- | `--print` | — | Write `components.json` to `--out` after generation |
447
- | `--skip-apply` | — | Skip pushing to Contentful (stops after generate) |
448
- | `--no-cache` | — | Re-run all steps even if output already exists |
449
- | `--yes` | — | Skip interactive confirmation in `apply push` |
450
- | `--viewports <path>` | — | JSON file with viewport array (passed to `apply push`) |
451
- | `--host <url>` | — | Override API base URL (passed to `apply push`) |
452
- | `--dry-run` | — | Print the generate prompt without invoking the agent |
329
+ Same shape as `generate components`, plus `--raw-tokens <path>`.
453
330
 
454
331
  ---
455
332
 
456
- ### `session list`
333
+ ### `print components` / `print tokens` / `print validate`
457
334
 
458
- List all pipeline sessions.
335
+ Unchanged from prior releases.
459
336
 
460
337
  ```bash
461
- experience-design-system-cli session list [--status <status>] [--limit <n>] [--json]
338
+ experiences print components [--session <id>] [--out <path>]
339
+ experiences print tokens [--session <id>] [--out <path>]
340
+ experiences print validate [--components <path>] [--tokens <path>]
462
341
  ```
463
342
 
464
- | Option | Default | Description |
465
- |---|---|---|
466
- | `--status <status>` | — | Filter by `in-progress`, `complete`, `failed`, or `interrupted` |
467
- | `--all` | — | Include interrupted sessions (hidden by default) |
468
- | `--limit <n>` | `20` | Max rows to return |
469
- | `--json` | — | Force JSON output |
343
+ `print validate` exits `0` on success, `1` on validation errors.
470
344
 
471
345
  ---
472
346
 
473
- ### `session show <id>`
347
+ ### `apply preview` / `apply select` / `apply push`
474
348
 
475
- Show all steps for a session.
349
+ These subcommands are the non-wizard route to the same diff and push logic. Flag surfaces are unchanged.
476
350
 
477
- ```bash
478
- experience-design-system-cli session show <id> [--json]
479
- ```
480
-
481
- ---
482
-
483
- ### `session stats`
484
-
485
- Show aggregate storage and record counts for the pipeline database.
351
+ `apply push` and `apply select` now emit a Contentful webapp view URL for the imported components in their JSON summary (`viewUrl`) so callers can deep-link into the management UI after a successful push.
486
352
 
487
353
  ```bash
488
- experience-design-system-cli session stats [--json]
354
+ experiences apply preview --space-id <id> --environment-id <env> --session <id>
355
+ experiences apply select --space-id <id> --environment-id <env> --session <id>
356
+ experiences apply push --space-id <id> --environment-id <env> --session <id> [--yes]
489
357
  ```
490
358
 
491
- ---
492
-
493
- ### `session prune`
359
+ Shared flags: `--components`, `--tokens`, `--session`, `--space-id`, `--environment-id`, `--cma-token`, `--host`, `--viewports`. `apply preview` adds `--include-unchanged`. `apply select` adds `--select-all`, `--select`, `--deselect`, `--force`. `apply push` adds `--yes`, `--verbose`, `--force`, `--dry-run`.
494
360
 
495
- Delete sessions matching criteria.
361
+ Design tokens are written first (component types may reference token kinds). Each entity write is recorded in the session database atomically — interrupted pushes resume from where they left off.
496
362
 
497
- ```bash
498
- experience-design-system-cli session prune --older-than 30d [--dry-run] [--yes]
499
- ```
363
+ ---
500
364
 
501
- | Option | Description |
502
- |---|---|
503
- | `--id <id>` | Delete a specific session by ID |
504
- | `--older-than <duration>` | Delete sessions older than this age (e.g. `30d`, `2w`, `1y`) |
505
- | `--status <status>` | Delete sessions by last step status: `complete`, `failed`, `interrupted` |
506
- | `--yes` | Skip confirmation prompt |
507
- | `--dry-run` | Print what would be deleted without deleting |
365
+ ### `session list` / `session show` / `session stats` / `session prune`
508
366
 
509
- At least one of `--id`, `--older-than`, or `--status` is required.
367
+ Lower-level pipeline-session management. Unchanged from prior releases; see `experiences session --help` for the full flag surface. Most operators should use `experiences runs` instead.
510
368
 
511
369
  ---
512
370
 
513
371
  ## Session Database
514
372
 
515
- All pipeline state is stored in `~/.contentful/experience-design-system-cli/pipeline.db` (SQLite). The path can be overridden with the `EDS_PIPELINE_DB_PATH` environment variable.
373
+ All pipeline state is stored in `~/.contentful/experience-design-system-cli/pipeline.db` (SQLite). The path can be overridden with the `EDS_PIPELINE_DB_PATH` environment variable. The push-resumption database is at `~/.contentful/experience-design-system-cli/import.db` (override with `EDS_IMPORT_DB_PATH`).
516
374
 
517
- Sessions are created by `analyze extract` and shared across all downstream commands. Use `session list` to see active sessions and `session prune` to clean up old ones.
375
+ Wizard run history is separate: `~/.config/experiences/runs.json`.
518
376
 
519
377
  ---
520
378
 
521
379
  ## Terminal Compatibility
522
380
 
523
- - Minimum 60 columns required for `analyze edit` interactive mode
381
+ - Minimum 60 columns required for the wizard and the `analyze select` TUI
524
382
  - 80+ columns recommended for full sidebar + detail view
525
- - 120+ columns required to show the source code panel
383
+ - 120+ columns required to show the source code panel in `analyze select`
526
384
  - `NO_COLOR=1` suppresses all ANSI color output
527
385
  - Windows: supported via Ink v4; known limitations with older ConEmu and cmd.exe
528
386
 
@@ -543,4 +401,3 @@ pnpm -F @contentful/experience-design-system-cli test
543
401
  # Typecheck
544
402
  pnpm -F @contentful/experience-design-system-cli typecheck
545
403
  ```
546
-