openspec-stack-init 1.0.2 → 1.0.4

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
@@ -19,14 +19,30 @@ npx openspec-stack-init ./my-project --dry-run
19
19
 
20
20
  ## What it installs
21
21
 
22
- | Tool | What it does | Non-interactive flag used |
22
+ | Tool | What it does | How |
23
23
  |---|---|---|
24
- | **OpenSpec** | Spec-driven development | `openspec init --tools claude --profile expanded --force` |
25
- | **Beads** | Git-backed issue tracker / agent memory | `bd init --quiet` + `bd setup claude` |
24
+ | **OpenSpec** | Spec-driven development | `openspec init --tools claude --profile core --force` |
25
+ | **Beads** | Git-backed issue tracker / agent memory | `bd init --quiet` + `bd setup claude` (CLI hooks) |
26
26
  | **claude-mem** | Automatic session memory via hooks | `claude plugin marketplace add` + `claude plugin install` |
27
27
  | **openspec-to-beads** | Syncs OpenSpec tasks.md → Beads issues | `npx @smithery/cli skill add` |
28
28
  | **/migrate-to-openspec** | Brownfield migration skill | Copied to `.claude/skills/migrate-to-openspec/` |
29
29
 
30
+ ### Beads: CLI vs Claude Code Plugin
31
+
32
+ This package installs **Beads CLI level** only:
33
+
34
+ - `bd init` — creates `.beads/` and `issues.jsonl` in your project (git-committed)
35
+ - `bd setup claude` — installs `SessionStart` and `PreCompact` hooks so Claude Code gets task context automatically
36
+
37
+ There is also an **optional Beads Claude Code Plugin** that adds slash commands (`/beads:ready`, `/beads:create`, etc.) and an MCP server. It cannot be installed automatically from a shell script — install it manually inside Claude Code if you want it:
38
+
39
+ ```
40
+ /plugin marketplace add steveyegge/beads
41
+ /plugin install beads
42
+ ```
43
+
44
+ For most projects the CLI level is sufficient — Claude Code agents call `bd` via bash.
45
+
30
46
  ## Prerequisites
31
47
 
32
48
  > ⚠️ **This package does NOT install the tools below for you.**
@@ -101,4 +117,4 @@ node src/index.js ./target-project
101
117
  ```bash
102
118
  npm publish --access public
103
119
  # Then anyone can run: npx openspec-stack-init
104
- ```
120
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openspec-stack-init",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "description": "Initialize OpenSpec + Beads + claude-mem + skills in any project",
6
6
  "author": {
@@ -142,6 +142,14 @@ Search for and read:
142
142
  5. Any .md files in root or subdirectories (sample up to 30 files)
143
143
  6. Comments at the top of key source files that describe the module purpose
144
144
  7. Any openspec/ folder content that already exists
145
+ 8. **Implementation plan files** (search multiple common locations):
146
+ - Search directories: docs/implementation-plans/, docs/plans/, plans/, docs/design/, design/
147
+ - Search for files matching patterns: *-PLAN.md, *-IMPLEMENTATION.md, *-DESIGN.md, IMPLEMENTATION-*.md
148
+ - For each plan file found:
149
+ * Read FULL CONTENT (not just summary)
150
+ * Extract: scope, detailed tasks, library/technology choices, presets/patterns, integration approach
151
+ * Summarize each plan in 200-300 words
152
+ * Note which planned work item (phase/milestone) this plan supports
145
153
 
146
154
  For each document found, extract:
147
155
  - Its PURPOSE (what does it describe?)
@@ -170,6 +178,7 @@ Return your findings as a structured markdown report under these exact headings:
170
178
  ## EXTRACTED_REQUIREMENTS (bulleted list of concrete requirements found)
171
179
  ## ARCHITECTURAL_DECISIONS (decisions already made, from ADRs or docs)
172
180
  ## FUTURE_PLANS (things mentioned as planned/upcoming/TODO in documentation)
181
+ ## IMPLEMENTATION_PLANS (full summaries of each plan file with scope, tasks, library choices, presets)
173
182
  ## RAW_EXCERPTS (paste the most important 3-5 paragraphs from docs verbatim)
174
183
  ## CLAUDE_MD_AUDIT
175
184
  ### Current references in CLAUDE.md:
@@ -185,6 +194,43 @@ Task prompt:
185
194
  You are a read-only scout agent. Find ALL signals of active work and technical debt.
186
195
  Do NOT modify any files.
187
196
 
197
+ PART A — PLANNED WORK DISCOVERY (Generic across projects)
198
+
199
+ 1. SEARCH FOR PLANNING DOCUMENTS
200
+ Try multiple common file names (check in order, use first found):
201
+ ```bash
202
+ for file in docs/ROADMAP.md ROADMAP.md docs/TODO.md TODO.md docs/PLAN.md PLAN.md docs/TASKS.md TASKS.md docs/BACKLOG.md BACKLOG.md; do
203
+ if [ -f "$file" ]; then
204
+ echo "FOUND: $file"
205
+ cat "$file"
206
+ break
207
+ fi
208
+ done
209
+ ```
210
+
211
+ 2. EXTRACT PLANNED WORK
212
+ Look for patterns indicating planned/future work:
213
+ - Sections with headers containing: "Planned", "Not Started", "Future", "Upcoming", "TODO", "Backlog"
214
+ - Unchecked task lists: `[ ]` or `- [ ]`
215
+ - Phase/milestone markers: "Phase N:", "Milestone:", "Sprint:"
216
+ - Status markers: "Status: Planned", "Status: Not started"
217
+
218
+ 3. FOR EACH PLANNED ITEM, document:
219
+ - Item identifier (phase number, milestone name, or section title)
220
+ - Title/description
221
+ - Goal (1 sentence if available)
222
+ - Status (Planned / Not started / Future)
223
+ - Implementation plan reference (if mentioned, e.g., "See [PLAN.md]")
224
+ - Task count (how many unchecked tasks `[ ]`)
225
+
226
+ 4. FIND FUTURE/EXPLORATORY SECTIONS
227
+ Search for section headers containing any of these keywords:
228
+ - "Future", "Exploratory", "Backlog", "Ideas", "Future Work", "Wishlist", "Nice to Have", "Someday", "Research"
229
+
230
+ Extract all items listed under these sections (bullets, numbered lists, paragraphs)
231
+
232
+ PART B — CODE DEBT MARKERS
233
+
188
234
  1. SEARCH FOR DEBT MARKERS
189
235
  Run these searches across all source files:
190
236
  First, build exclusion flags from .gitignore:
@@ -222,6 +268,21 @@ Do NOT modify any files.
222
268
  - Files with many commented-out blocks
223
269
 
224
270
  Return your findings as a structured markdown report under these headings:
271
+ ## PLANNED_WORK (list all planned items from planning documents)
272
+ ### Item: <identifier> - <title>
273
+ - Goal: ...
274
+ - Status: ...
275
+ - Source: <file path>
276
+ - Implementation plan: <file path if referenced>
277
+ - Task count: <N unchecked tasks>
278
+
279
+ ## FUTURE_EXPLORATORY (list all items from Future/Exploratory sections)
280
+ - Source: <file path and section name>
281
+ - Items:
282
+ - <item 1>
283
+ - <item 2>
284
+ [...]
285
+
225
286
  ## DEBT_SUMMARY (count by category: X features, Y bugs, Z debt items, etc.)
226
287
  ## FEATURES (list: "filename:line - description")
227
288
  ## BUGS (list: "filename:line - description")
@@ -364,10 +425,62 @@ Note at the top of each spec file: `# Auto-generated — review for accuracy`
364
425
 
365
426
  ## Phase 6: Create OpenSpec Changes for Active Work
366
427
 
367
- For each item in Scout Agent 3's FEATURES and BUGS lists that represents
368
- **unfinished or planned work**, create an OpenSpec change.
428
+ ### Part A: Changes from Planned Work (Planning Documents)
429
+
430
+ For each item in Scout Agent 3's **PLANNED_WORK** list:
431
+
432
+ 1. **Read the implementation plan file** (if referenced):
433
+ - Use Read tool to get full content of the implementation plan
434
+ - Extract detailed task list, library/technology choices, presets/patterns, integration approach
435
+ - If no implementation plan file exists, use the item description from the planning document
436
+
437
+ 2. Create `openspec/changes/<kebab-name>/`
438
+
439
+ 3. Write `proposal.md`:
440
+
441
+ ```markdown
442
+ # Proposal: <Item Title>
443
+ # Auto-generated from: <source file> <item identifier> — review and refine as needed.
444
+
445
+ ## Why
446
+ <Extract goal and rationale from planning document>
447
+
448
+ Discovered in: `<source file>` <item identifier>
449
+ <If implementation plan exists: "Detailed plan: `<path to implementation plan>`">
450
+
451
+ ## What Changes
452
+ <List the systems/files affected from implementation plan or item description>
453
+
454
+ ## Impact
455
+ **If not done**: <Describe consequences of not implementing>
456
+
457
+ **If done**: <Describe benefits of implementing>
458
+
459
+ **Breaking changes**: <None / describe any breaking changes>
460
+
461
+ **Systems affected**:
462
+ <List affected systems from implementation plan or item description>
463
+
464
+ ## Rollback
465
+ If this feature causes issues:
466
+ 1. Remove the tool/feature from affected files
467
+ 2. Delete generated files
468
+ 3. Remove tests
469
+ 4. <Any data migration rollback steps>
470
+ ```
471
+
472
+ 4. Write `tasks.md`:
473
+ - If implementation plan exists: Extract detailed tasks from the plan
474
+ - If no implementation plan: Create tasks from the planning document's task list
475
+ - Break into atomic steps (1-3 files per task)
476
+ - Include library evaluation tasks if plan mentions alternatives
477
+ - Include preset implementation tasks if plan lists presets
478
+ - Include testing and documentation tasks
369
479
 
370
- For each such item:
480
+ ### Part B: Changes from Code TODOs/FIXMEs
481
+
482
+ For each item in Scout Agent 3's FEATURES and BUGS lists that represents
483
+ **unfinished or planned work** from code comments:
371
484
 
372
485
  1. Create `openspec/changes/<kebab-name>/`
373
486
  2. Write `proposal.md`:
@@ -406,10 +519,40 @@ Original comment: `<exact text of the TODO/FIXME>`
406
519
  **Limit**: Create at most **20 changes** on first pass. If there are more,
407
520
  create a summary file at `openspec/changes/_backlog.md` listing all remaining items.
408
521
 
522
+ ### Part C: Future/Exploratory Backlog
523
+
524
+ If Scout Agent 3 found **FUTURE_EXPLORATORY** items:
525
+
526
+ 1. Create `openspec/changes/_future-ideas.md`:
527
+
528
+ ```markdown
529
+ # Future Ideas & Exploratory Work
530
+
531
+ Items from <source file> and other exploratory notes.
532
+ These are not committed work but ideas for future consideration.
533
+
534
+ Source: <file path and section name>
535
+
536
+ <Organize items by category if possible, otherwise list as-is>
537
+
538
+ ## <Category 1>
539
+ - <item 1>
540
+ - <item 2>
541
+
542
+ ## <Category 2>
543
+ - <item 3>
544
+ - <item 4>
545
+
546
+ ## Uncategorized
547
+ - <remaining items>
548
+ ```
549
+
550
+ 2. Do NOT create full OpenSpec changes for exploratory items (they're not planned work)
551
+ 3. Note in migration report: "X exploratory ideas captured in openspec/changes/_future-ideas.md"
552
+
409
553
  > **Note on Beads sync:** Do NOT create Beads issues manually here.
410
- > After migration is complete, use the `/openspec-to-beads` skill to sync
411
- > all OpenSpec changes to Beads in one step. It was installed by
412
- > `openspec-stack-init` and handles this automatically.
554
+ > After migration is complete, Phase 9 will automatically create Beads issues
555
+ > from all OpenSpec changes.
413
556
 
414
557
  ---
415
558
 
@@ -491,6 +634,9 @@ By: /migrate-to-openspec skill
491
634
  ### Changes Created (<N> total)
492
635
  <list of changes/*/proposal.md with source location each>
493
636
 
637
+ ### Future Ideas
638
+ <N exploratory ideas in changes/_future-ideas.md (if found)>
639
+
494
640
  ### Backlog
495
641
  <N remaining items in changes/_backlog.md — review manually>
496
642
 
@@ -549,11 +695,72 @@ Original CLAUDE.md backed up to: `CLAUDE.md.pre-migration`
549
695
  ## Suggested Next Steps
550
696
 
551
697
  1. Review this report carefully, especially the CLAUDE.md optimization section
552
- 2. Run `/openspec-to-beads` sync all OpenSpec changes to Beads issues
553
- 3. Run `/opsx:explore` let Claude validate the migration made sense
554
- 4. Pick one change from openspec/changes/ and run `/opsx:apply <n>`
698
+ 2. Review Beads issues with `bd list --status=open` (<N> issues created automatically)
699
+ 3. Validate the migration baseline with `/opsx:explore` (already executed)
700
+ 4. Pick one change from openspec/changes/ and run `/opsx:apply <change-name>` to start implementation
701
+ ```
702
+
703
+ ---
704
+
705
+ ## Phase 9: Create Beads Issues from OpenSpec Changes
706
+
707
+ This phase converts all OpenSpec changes into Beads issues for task tracking.
708
+
709
+ ### Step 1 — Verify Beads is initialized
710
+
711
+ ```bash
712
+ bd list --json 2>&1 || echo "BEADS_NOT_INITIALIZED"
555
713
  ```
556
714
 
715
+ If Beads is not initialized, skip this phase and note in the final announcement:
716
+ "⚠️ Beads not initialized. Run `bd init` then manually create issues from openspec/changes/"
717
+
718
+ ### Step 2 — Loop through all OpenSpec changes
719
+
720
+ ```bash
721
+ ls openspec/changes/ | grep -v "^_" | grep -v "archive"
722
+ ```
723
+
724
+ For each change directory (excluding _backlog.md, _future-ideas.md, and archive/):
725
+
726
+ 1. Read `openspec/changes/<change>/proposal.md` to extract:
727
+ - Title (from first # heading)
728
+ - Goal/Why section (for description)
729
+
730
+ 2. Create Beads issue:
731
+ ```bash
732
+ bd create \
733
+ --title="<Title from proposal>" \
734
+ --type=feature \
735
+ --priority=2 \
736
+ --description="<Goal from proposal>. See openspec/changes/<change>/"
737
+ ```
738
+
739
+ 3. Capture the issue ID from output (format: `<project>-<id>`)
740
+
741
+ ### Step 3 — Report created issues
742
+
743
+ Count total issues created and list them in format:
744
+ ```
745
+ Created <N> Beads issues from OpenSpec changes:
746
+ - <issue-id-1>: <title>
747
+ - <issue-id-2>: <title>
748
+ [...]
749
+ ```
750
+
751
+ ### Step 4 — Run opsx:explore for validation
752
+
753
+ After all Beads issues are created, automatically invoke the opsx:explore skill:
754
+
755
+ ```bash
756
+ # This will be handled by Skill tool invocation
757
+ ```
758
+
759
+ Use the Skill tool to invoke `opsx:explore` with no arguments. This validates the migration baseline and explores the OpenSpec structure.
760
+
761
+ If the skill invocation fails or the skill doesn't exist, note in the final announcement:
762
+ "⚠️ Could not run /opsx:explore automatically. Run it manually to validate the migration."
763
+
557
764
  ---
558
765
 
559
766
  ## Final Announcement
@@ -564,15 +771,18 @@ Tell the user:
564
771
  >
565
772
  > - `openspec/config.yaml` — project context injected into every future spec
566
773
  > - `openspec/specs/` — <N> architecture and feature specs
567
- > - `openspec/changes/` — <N> active changes from TODOs/FIXMEs
774
+ > - `openspec/changes/` — <N> active changes from planned work and code TODOs
775
+ > - `openspec/changes/_future-ideas.md` — <N> exploratory ideas captured (if found)
568
776
  > - `CLAUDE.md` — optimized: <N> redundant doc references removed (~<N> tokens saved per session)
569
777
  > - `CLAUDE.md.pre-migration` — backup of original
570
778
  > - `openspec/MIGRATION_REPORT.md` — full summary, token savings, docs to archive
779
+ > - **Beads issues**: <N> issues created from OpenSpec changes (or note if Beads not initialized)
780
+ > - **Validation**: /opsx:explore executed (or note if failed)
571
781
  >
572
- > **Recommended next steps:**
573
- > 1. Read `openspec/MIGRATION_REPORT.md`
574
- > 2. Run `/openspec-to-beads` to sync changes Beads issues
575
- > 3. Run `/opsx:explore` to validate the baseline
782
+ > **Next steps:**
783
+ > 1. Read `openspec/MIGRATION_REPORT.md` for detailed analysis
784
+ > 2. Review Beads issues with `bd list --status=open`
785
+ > 3. Pick a change and run `/opsx:apply <change-name>` to start implementation
576
786
 
577
787
  ---
578
788
 
package/src/index.js CHANGED
@@ -226,6 +226,13 @@ if (existsSync(join(TARGET_DIR, "openspec"))) {
226
226
  const ok = run("openspec init --tools claude --profile core --force");
227
227
  if (ok) {
228
228
  log.ok("OpenSpec initialized (core profile, Claude tools)");
229
+
230
+ // Remove default config.yaml so custom template can be written in Step 3
231
+ const defaultConfig = join(TARGET_DIR, "openspec", "config.yaml");
232
+ if (existsSync(defaultConfig)) {
233
+ unlinkSync(defaultConfig);
234
+ }
235
+
229
236
  // Switch to expanded profile to unlock: new, ff, verify, sync, bulk-archive, onboard
230
237
  // openspec config profile sets the global default, openspec update regenerates skill files
231
238
  const expanded = run("openspec config profile expanded", { silent: true }) &&
@@ -258,7 +265,7 @@ context: |
258
265
 
259
266
  # TODO: fill in your actual stack and conventions
260
267
  # Tech stack: e.g. TypeScript, React, Node.js / Unity, C# / Python, Django
261
- # Architecture: e.g. MVC, HMVC, ECS, microservices
268
+ # Architecture: e.g. MVC, HMVC, ECS, Redux, MVVM, microservices
262
269
  # Testing: e.g. Jest, NUnit, pytest
263
270
  # Key constraints: e.g. legacy codebase, must support IE11, no breaking API changes
264
271
 
@@ -266,6 +273,7 @@ rules:
266
273
  proposal:
267
274
  - Always include a rollback plan for legacy code changes
268
275
  - List all affected modules
276
+ - Always include an "## Alternatives Considered" section listing at least 2 alternative approaches with their pros, cons, and reason for rejection. Format each as: "### Option: <name> / Pros: ... / Cons: ... / Why rejected: ..."
269
277
  specs:
270
278
  - Use Given/When/Then format for scenarios
271
279
  design: