@vibecompass/vibecompass 0.2.1 → 0.3.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/README.md CHANGED
@@ -12,19 +12,28 @@ Shipped today:
12
12
 
13
13
  - `vibecompass init` for scaffolding a project-memory root
14
14
  - interactive guided init for placement, workflow bootstrap, and first-session setup
15
+ - lightweight starter architecture/session memory plus example-only decision guidance
15
16
  - generated `context.md` plus opt-in workflow guide files
16
17
  - opt-in starter `CLAUDE.md` / `AGENTS.md` templates that are created once and never overwritten
17
18
  - `vibecompass start-session` / `vibecompass close-session` for lane-aware local builder workflow
18
19
  - `vibecompass list-sessions` / `vibecompass switch-session` for multiple active session lanes
19
20
  - `vibecompass end-session` as a discoverable alias for `close-session`
20
21
  - `vibecompass sync-agents` for generated `CLAUDE.md`, `AGENTS.md`, `.cursorrules`, and `.github/copilot-instructions.md` views
22
+ - `vibecompass docs-review --guided` — print a comprehensive review prompt for your chosen LLM to run
23
+ - `vibecompass docs-review --submit-hosted` — submit the review request to the hosted app (execution paused; details below)
24
+ - `vibecompass docs-review --run-local --provider anthropic` — local provider adapter that saves review output locally
25
+ - `vibecompass docs-review --apply-output` — apply accepted architecture-doc blocks into canonical `architecture/` docs
26
+ - `vibecompass docs-review --complete` — mark the review accepted after the docs land
21
27
  - canonical file scanning and validation
22
28
  - `state/manifest.json` generation
23
29
  - JavaScript read-model helpers for project, feature, decision, and file context
24
30
 
25
31
  Not shipped yet:
26
32
 
27
- - hosted sync commands such as push, pull-preview, and pull-export
33
+ - hosted sync commands (push, pull-preview, pull-export)
34
+ - hosted docs-review execution that runs the review and writes canonical docs
35
+ - additional local docs-review providers beyond Anthropic
36
+ - automatic acceptance of review findings without a local apply step
28
37
 
29
38
  The package is publishable now as the file-contract and read-model core. The
30
39
  broader local-primary sync workflow is still being built on top of it.
@@ -59,9 +68,9 @@ npx -y @vibecompass/vibecompass init --guided
59
68
  ```
60
69
 
61
70
  Guided init asks about repo topology, recommends a placement pattern
62
- (`workspace-root`, `dedicated-memory-repo`, or `primary-repo`), scaffolds the
63
- workflow files you opt into, and can open the first builder session
64
- immediately.
71
+ (`workspace-root`, `dedicated-memory-repo`, or `primary-repo`), writes
72
+ lightweight starter project memory, scaffolds the workflow files you opt into,
73
+ and can open the first builder session immediately.
65
74
 
66
75
  When the owner directory is a workspace root or primary repo, the canonical
67
76
  root defaults to `.compass/` inside that directory. For a dedicated memory repo,
@@ -86,7 +95,22 @@ npx -y @vibecompass/vibecompass init \
86
95
  --session-working-on "Validate the local-first MCP workflow"
87
96
  ```
88
97
 
89
- That creates the canonical root plus, when workflow scaffolding is enabled:
98
+ That creates the canonical root plus lightweight starter memory:
99
+
100
+ ```text
101
+ PROJECT_MEMORY_ROOT/project.yaml
102
+ PROJECT_MEMORY_ROOT/architecture/overview/project-shape.md
103
+ PROJECT_MEMORY_ROOT/decisions/EXAMPLE.md # example-only, ignored by canonical parsing
104
+ PROJECT_MEMORY_ROOT/sessions/YYYY-MM-DD-1-project-memory-initialized.md
105
+ PROJECT_MEMORY_ROOT/state/manifest.json
106
+ ```
107
+
108
+ The starter architecture doc is intentionally marked as initial scaffold
109
+ coverage. It is useful orientation, not a comprehensive review. Before risky
110
+ implementation work, inspect the relevant code and replace or expand the
111
+ starter docs with evidence-backed domain/feature/component docs.
112
+
113
+ When workflow scaffolding is enabled, init also creates:
90
114
 
91
115
  ```text
92
116
  PROJECT_MEMORY_ROOT/context.md
@@ -100,6 +124,53 @@ AGENTS.md # at the tooling root, only if missing and --with-agents is
100
124
  `context.md` is a derived package-owned file. Re-running `init --force --with-workflow`
101
125
  regenerates it; do not treat it as a hand-edited source document.
102
126
 
127
+ ## After init: generate real architecture docs
128
+
129
+ `init` writes a small starter map of your project. To turn it into real
130
+ architecture docs, run a docs-review and let your AI tool write them:
131
+
132
+ ```bash
133
+ npx -y @vibecompass/vibecompass docs-review --guided
134
+ ```
135
+
136
+ You can run this right after `init`, or any time later — for example after
137
+ scope expands, or before risky implementation work. `start-session` will
138
+ remind you with a non-blocking warning if no completed review exists.
139
+
140
+ What happens:
141
+
142
+ 1. The CLI asks which LLM you'll use, then prints a versioned prompt template with fixed review criteria.
143
+ 2. You paste that prompt into your AI tool (Claude Code, Codex, Cursor, etc.).
144
+ 3. The AI reads your repo and writes architecture docs under
145
+ `architecture/<domain>/<feature>/<component>.md`.
146
+ 4. Run `vibecompass docs-review --apply-output` after accepting fenced
147
+ architecture-doc blocks, or `--complete` if accepted docs were written
148
+ manually.
149
+
150
+ The guided prompt is deterministic apart from project-specific fields
151
+ (`project`, `mode`, `root`, provider, and model). It uses the same structure
152
+ VibeCompass dogfoods: read project memory first, inspect source evidence,
153
+ write component docs with review metadata, preserve the starter overview, and
154
+ emit accepted docs as `vibecompass-architecture-doc` blocks.
155
+
156
+ The package never calls an AI itself — that's intentional. You stay in
157
+ control of which provider runs the review and what gets saved.
158
+
159
+ ### Other ways to run a review
160
+
161
+ - `--submit-hosted` sends the review request to the hosted app and records a
162
+ run ID. The hosted worker that actually runs the review and writes docs
163
+ isn't live yet, so the submission is durably accepted but no scan runs
164
+ against it.
165
+ - `--run-local --provider anthropic` calls Anthropic directly with your
166
+ `ANTHROPIC_API_KEY` and saves the raw output to
167
+ `state/docs-review-output.md`.
168
+ - `--apply-output` writes accepted fenced architecture-doc blocks from
169
+ `state/docs-review-output.md` into canonical `architecture/` docs and
170
+ completes the local review marker.
171
+
172
+ For most users, stick with `--guided`.
173
+
103
174
  If you do not chain straight into a first session from `init`, open one later:
104
175
 
105
176
  ```bash
@@ -265,6 +336,10 @@ This command updates the `Current session` block in `CLAUDE.md` and creates
265
336
  `sessions/active/<lane-id>/session.yaml`, `wip.md`, and `handoff.md` for the
266
337
  next session number. It also updates `sessions/active/index.yaml`.
267
338
 
339
+ If no completed docs-review marker exists under `state/docs-review.json`,
340
+ `start-session` prints a non-blocking warning that starter docs are not a
341
+ comprehensive architecture review.
342
+
268
343
  ### `vibecompass list-sessions`
269
344
 
270
345
  ```text
@@ -332,6 +407,72 @@ memory. It creates missing files with managed markers, replaces existing
332
407
  managed regions, preserves content outside markers, and warns instead of
333
408
  overwriting existing unmarked files.
334
409
 
410
+ ### `vibecompass docs-review`
411
+
412
+ ```text
413
+ vibecompass docs-review --guided [options]
414
+ ```
415
+
416
+ Options:
417
+
418
+ - `--root <path>`: project-memory root; defaults to `.compass`
419
+ - `--guided`: print a comprehensive review prompt for your chosen LLM to run (recommended)
420
+ - `--submit-hosted`: submit the review request to the hosted app (execution paused; submission durable)
421
+ - `--run-local`: run the generated review request with a local provider
422
+ - `--provider <name>`: local provider for `--run-local`; currently `anthropic`
423
+ - `--run-local-anthropic`: compatibility alias for `--run-local --provider anthropic`
424
+ - `--apply-output`: apply accepted architecture-doc blocks from review output
425
+ - `--output <path>`: review output path for `--apply-output`; defaults to `state/docs-review-output.md`
426
+ - `--complete`: mark accepted docs-review changes as completed in local state
427
+ - `--llm <name>`: preferred LLM/provider to record for the review (e.g. `claude`, `codex`, `gemini`)
428
+ - `--model <name>`: model name/version to record for the review
429
+ - `--anthropic-env-var <name>`: env var for local Anthropic runtime; defaults to `ANTHROPIC_API_KEY`
430
+ - `--max-tokens <number>`: local Anthropic output budget, 1024–32000; defaults to 16000
431
+
432
+ Plain `--guided` does not call an AI itself; it prints a review prompt your
433
+ chosen LLM runs. `--submit-hosted`, `--run-local`, and `--apply-output` are
434
+ explicit alternative steps.
435
+
436
+ Project-mode requirements:
437
+
438
+ - `local-only` — `--guided` can use any external LLM; `--run-local` requires a supported local provider key
439
+ - `local-primary` — hosted sync binding preferred for hosted submission; local provider key accepted for `--run-local`
440
+ - `hosted-only` — hosted sync binding required
441
+
442
+ `--run-local --provider anthropic` always uses local Anthropic regardless of
443
+ hosted binding, so hosted precedence does not apply when that flag is set.
444
+
445
+ `--submit-hosted` uses `sync.credential_env_var` and records the hosted run
446
+ ID in `state/docs-review.json`. Submission is durable today; the hosted
447
+ worker that runs the review and writes canonical docs is not yet live, so
448
+ no scan executes against the submitted request. Local files stay untouched.
449
+
450
+ `--run-local-anthropic` remains as a compatibility alias. New scripts should
451
+ use `--run-local --provider anthropic`.
452
+
453
+ `--apply-output` looks for accepted architecture docs in fenced blocks:
454
+
455
+ ````md
456
+ ```vibecompass-architecture-doc path=architecture/domain/feature/component.md
457
+ ---
458
+ domain: Platform
459
+ feature: Example
460
+ component: Backend
461
+ status: In progress
462
+ ---
463
+
464
+ ## Description
465
+ Accepted review content.
466
+ ```
467
+ ````
468
+
469
+ Only `architecture/*.md` paths are writable through this apply step.
470
+
471
+ `vibecompass docs-review --complete` updates the marker in
472
+ `state/docs-review.json` to `status: "completed"` once the docs have
473
+ landed, preserving the recorded `llm` / `model` so future sessions know
474
+ what reviewed the architecture.
475
+
335
476
  ### Prompt commands
336
477
 
337
478
  These are the default prompt commands used by the scaffolded workflow files:
@@ -340,19 +481,22 @@ These are the default prompt commands used by the scaffolded workflow files:
340
481
  - `join as reviewer`: reviewer role trigger
341
482
  - `review handoff`: reviewer reads the selected lane's latest `wip.md`, `handoff.md`, latest finalized note, and relevant diffs before appending findings
342
483
  - `address review`: builder reads the latest reviewer feedback in the selected lane's `wip.md` / `handoff.md`, responds inline, applies accepted changes, and refreshes the builder handoff
484
+ - `close session`: builder runs the close-out checklist and ends with `vibecompass close-session --session <lane-id>`; `end session` is accepted as a synonym
343
485
 
344
486
  They are prompt commands for AI-tool behavior, not package CLI commands.
345
487
  Reviewer handback ends when the reviewer has updated the selected lane's
346
488
  `wip.md` and `handoff.md`; there is no extra reviewer-exit step. The builder
347
489
  remains in builder role, uses `address review` until findings are resolved or
348
- explicitly deferred, and then runs `vibecompass close-session --session
349
- <lane-id>` using the workflow defaults recorded in `project.yaml`.
490
+ explicitly deferred, and then uses the `close session` prompt to run
491
+ `vibecompass close-session --session <lane-id>` using the workflow defaults
492
+ recorded in `project.yaml`.
350
493
 
351
494
  ## JavaScript API
352
495
 
353
496
  ```js
354
497
  import {
355
498
  initializeProjectMemory,
499
+ preflightDocsReview,
356
500
  startProjectSession,
357
501
  closeProjectSession,
358
502
  syncAgentInstructionFiles,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibecompass/vibecompass",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Local-first project-memory core for VibeCompass",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.js CHANGED
@@ -3,6 +3,7 @@
3
3
  import { realpathSync } from 'node:fs';
4
4
  import { pathToFileURL } from 'node:url';
5
5
  import { initializeProjectMemory } from './init.js';
6
+ import { preflightDocsReview } from './docs-review.js';
6
7
  import { resolveInitCliOptions } from './setup.js';
7
8
  import { closeProjectSession, listProjectSessions, startProjectSession, switchProjectSession } from './session.js';
8
9
  import { syncAgentInstructionFiles } from './generators/agent-files/index.js';
@@ -70,6 +71,7 @@ export async function runCli(argv, io = createDefaultIo(), runtime = {}) {
70
71
  io.stdout.write(`Updated ${sessionResult.claudePath}\n`);
71
72
  io.stdout.write(`Created ${sessionResult.wipFilePath}\n`);
72
73
  io.stdout.write(`Created ${sessionResult.handoffFilePath}\n`);
74
+ writeWarnings(io, sessionResult.warnings);
73
75
  writeAgentFileSyncResult(io, sessionResult.agentFileSync);
74
76
  }
75
77
 
@@ -85,6 +87,7 @@ export async function runCli(argv, io = createDefaultIo(), runtime = {}) {
85
87
  io.stdout.write(`Updated ${result.claudePath}\n`);
86
88
  io.stdout.write(`Created ${result.wipFilePath}\n`);
87
89
  io.stdout.write(`Created ${result.handoffFilePath}\n`);
90
+ writeWarnings(io, result.warnings);
88
91
  writeAgentFileSyncResult(io, result.agentFileSync);
89
92
  return 0;
90
93
  }
@@ -144,6 +147,47 @@ export async function runCli(argv, io = createDefaultIo(), runtime = {}) {
144
147
  return 0;
145
148
  }
146
149
 
150
+ if (parsed.command === 'docs-review') {
151
+ const result = await preflightDocsReview({
152
+ ...parsed.options,
153
+ ...(runtime.cwd ? { cwd: runtime.cwd } : {}),
154
+ }, {
155
+ io,
156
+ env: runtime.env,
157
+ runtime,
158
+ });
159
+ io.stdout.write(`Docs-review: ${result.status}\n`);
160
+ if (result.llm) {
161
+ io.stdout.write(`LLM: ${result.llm}\n`);
162
+ }
163
+ if (result.model) {
164
+ io.stdout.write(`Model: ${result.model}\n`);
165
+ }
166
+ if (result.runtime) {
167
+ io.stdout.write(`Runtime: ${result.runtime.provider}\n`);
168
+ }
169
+ if (result.hosted) {
170
+ io.stdout.write(`Hosted run: ${result.hosted.run_id}\n`);
171
+ }
172
+ if (result.localReview) {
173
+ io.stdout.write(`Local review output: ${result.localReview.output_path}\n`);
174
+ }
175
+ if (result.applied) {
176
+ io.stdout.write(`Applied architecture docs: ${result.applied.architecture_docs.length}\n`);
177
+ for (const entry of result.applied.architecture_docs) {
178
+ io.stdout.write(`- ${entry.path} (${entry.status})\n`);
179
+ }
180
+ }
181
+ writeWarnings(io, result.warnings);
182
+ io.stdout.write(`Recorded ${result.statePath}\n`);
183
+ io.stdout.write(`${result.message}\n`);
184
+ if (result.reviewPrompt) {
185
+ io.stdout.write('Architecture review prompt:\n');
186
+ io.stdout.write(`${result.reviewPrompt}\n`);
187
+ }
188
+ return 0;
189
+ }
190
+
147
191
  throw new Error(`Unknown command "${parsed.command}".`);
148
192
  }
149
193
 
@@ -175,6 +219,10 @@ export function parseCliArgs(argv) {
175
219
  return parseSyncAgentsArgs(rest);
176
220
  }
177
221
 
222
+ if (command === 'docs-review') {
223
+ return parseDocsReviewArgs(rest);
224
+ }
225
+
178
226
  return { command };
179
227
  }
180
228
 
@@ -587,6 +635,85 @@ function parseSyncAgentsArgs(argv) {
587
635
  };
588
636
  }
589
637
 
638
+ function parseDocsReviewArgs(argv) {
639
+ const parsed = {};
640
+
641
+ for (let index = 0; index < argv.length; index += 1) {
642
+ const token = argv[index];
643
+
644
+ if (token === '--guided') {
645
+ parsed.guided = true;
646
+ continue;
647
+ }
648
+
649
+ if (token === '--submit-hosted') {
650
+ parsed.submitHosted = true;
651
+ continue;
652
+ }
653
+
654
+ if (token === '--complete') {
655
+ parsed.complete = true;
656
+ continue;
657
+ }
658
+
659
+ if (token === '--run-local-anthropic') {
660
+ parsed.runLocalAnthropic = true;
661
+ continue;
662
+ }
663
+
664
+ if (token === '--run-local') {
665
+ parsed.runLocal = true;
666
+ continue;
667
+ }
668
+
669
+ if (token === '--apply-output') {
670
+ parsed.applyOutput = true;
671
+ continue;
672
+ }
673
+
674
+ if (!token.startsWith('--')) {
675
+ throw new Error(`Unexpected argument "${token}".`);
676
+ }
677
+
678
+ const value = argv[index + 1];
679
+ if (value === undefined) {
680
+ throw new Error(`Flag "${token}" requires a value.`);
681
+ }
682
+ index += 1;
683
+
684
+ switch (token) {
685
+ case '--root':
686
+ parsed.rootDir = value;
687
+ break;
688
+ case '--llm':
689
+ parsed.llm = value;
690
+ break;
691
+ case '--model':
692
+ parsed.model = value;
693
+ break;
694
+ case '--anthropic-env-var':
695
+ parsed.anthropicEnvVar = value;
696
+ break;
697
+ case '--provider':
698
+ parsed.provider = value;
699
+ break;
700
+ case '--output':
701
+ parsed.outputPath = value;
702
+ break;
703
+ case '--max-tokens':
704
+ parsed.maxTokens = value;
705
+ break;
706
+ default:
707
+ throw new Error(`Unknown flag "${token}".`);
708
+ }
709
+ }
710
+
711
+ return {
712
+ command: 'docs-review',
713
+ options: parsed,
714
+ };
715
+ }
716
+
590
717
  function writeAgentFileSyncResult(io, result) {
591
718
  if (!result) {
592
719
  return;
@@ -600,6 +727,12 @@ function writeAgentFileSyncResult(io, result) {
600
727
  }
601
728
  }
602
729
 
730
+ function writeWarnings(io, warnings = []) {
731
+ for (const warning of warnings) {
732
+ io.stderr.write(`Warning: ${warning}\n`);
733
+ }
734
+ }
735
+
603
736
  function splitAssignment(value, flagName) {
604
737
  const separatorIndex = value.indexOf('=');
605
738
  if (separatorIndex <= 0 || separatorIndex === value.length - 1) {
@@ -619,6 +752,7 @@ function usageText() {
619
752
  ' vibecompass list-sessions [options]',
620
753
  ' vibecompass switch-session <id> [options]',
621
754
  ' vibecompass sync-agents [options]',
755
+ ' vibecompass docs-review --guided [options]',
622
756
  '',
623
757
  'Init options:',
624
758
  ' --root <path> Project-memory root. Defaults to .compass',
@@ -679,6 +813,21 @@ function usageText() {
679
813
  ' --tooling-root <path> Directory where agent files are written. Defaults to cwd',
680
814
  ' --format <name> Optional format: claude_md, agents_md, cursor_rules, copilot_instructions',
681
815
  ' --dry-run Show planned writes without changing files',
816
+ '',
817
+ 'Docs-review options:',
818
+ ' --root <path> Project-memory root. Defaults to .compass',
819
+ ' --guided Accepted for the explicit comprehensive-review workflow',
820
+ ' --submit-hosted Submit the generated review request to hosted sync',
821
+ ' --complete Mark accepted docs-review changes as completed locally',
822
+ ' --run-local Run the generated review request with a local provider',
823
+ ' --provider <name> Local provider for --run-local. Currently: anthropic',
824
+ ' --run-local-anthropic Compatibility alias for --run-local --provider anthropic',
825
+ ' --apply-output Apply accepted architecture doc blocks from review output',
826
+ ' --output <path> Review output path for --apply-output; defaults to state/docs-review-output.md',
827
+ ' --llm <name> Preferred LLM/provider to run the external architecture review',
828
+ ' --model <name> Model name to record for the review',
829
+ ' --anthropic-env-var <name> Env var to use for local Anthropic docs-review runtime',
830
+ ' --max-tokens <number> Local Anthropic max_tokens, 1024-32000. Defaults to 16000',
682
831
  ].join('\n');
683
832
  }
684
833