ystack 0.1.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/CHANGELOG.md +24 -0
- package/LICENSE +21 -0
- package/LINTING.md +198 -0
- package/PHILOSOPHY.md +132 -0
- package/PLAN.md +515 -0
- package/README.md +103 -0
- package/RUNTIMES.md +199 -0
- package/bin/cli.js +973 -0
- package/hooks/context-monitor.js +30 -0
- package/hooks/session-start.sh +35 -0
- package/hooks/workflow-nudge.js +107 -0
- package/package.json +39 -0
- package/skills/address-review/SKILL.md +244 -0
- package/skills/build/SKILL.md +246 -0
- package/skills/build/resources/plan-checker.md +121 -0
- package/skills/docs/SKILL.md +160 -0
- package/skills/go/SKILL.md +216 -0
- package/skills/go/resources/executor.md +57 -0
- package/skills/import/SKILL.md +306 -0
- package/skills/pr/SKILL.md +152 -0
- package/skills/review/SKILL.md +184 -0
- package/skills/scaffold/SKILL.md +549 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: go
|
|
3
|
+
description: >
|
|
4
|
+
Execute a plan created by /build. Runs each task with a fresh subagent, produces
|
|
5
|
+
atomic commits, and updates structured notes. Use this skill when the user says
|
|
6
|
+
'go', '/go', 'execute', 'run the plan', 'execute the plan', 'start building',
|
|
7
|
+
'let's do it', or confirms a plan and wants to proceed with implementation.
|
|
8
|
+
Requires a PLAN.md from a prior /build run.
|
|
9
|
+
user-invocable: true
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# /go — Execute the Plan
|
|
13
|
+
|
|
14
|
+
You are the execution phase of the ystack agent harness. You take a PLAN.md produced by `/build` and execute each task, producing atomic commits per task.
|
|
15
|
+
|
|
16
|
+
**Your job is to implement, not to redesign.** Follow the plan. If something doesn't work as planned, follow the deviation rules — don't silently change the approach.
|
|
17
|
+
|
|
18
|
+
## Phase 0: Load the Plan
|
|
19
|
+
|
|
20
|
+
1. Find the active plan. Look for `.context/` directories with a PLAN.md:
|
|
21
|
+
```bash
|
|
22
|
+
ls .context/*/PLAN.md 2>/dev/null
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
2. If multiple plans exist, list them and ask which to execute:
|
|
26
|
+
> Found plans for:
|
|
27
|
+
> - `refund-reason` — Add refund reason to payments (3 tasks)
|
|
28
|
+
> - `oauth-support` — Add OAuth to auth module (4 tasks)
|
|
29
|
+
>
|
|
30
|
+
> Which plan should I execute?
|
|
31
|
+
|
|
32
|
+
3. If no plan exists:
|
|
33
|
+
> No plan found. Run `/build <feature>` first to create one.
|
|
34
|
+
|
|
35
|
+
4. Read the full PLAN.md and DECISIONS.md for context:
|
|
36
|
+
```
|
|
37
|
+
.context/<feature-id>/PLAN.md
|
|
38
|
+
.context/<feature-id>/DECISIONS.md
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
5. Parse the plan: extract success criteria, tasks, file targets, dependencies, and verification steps.
|
|
42
|
+
|
|
43
|
+
## Phase 1: Compute Execution Order
|
|
44
|
+
|
|
45
|
+
Determine which tasks can run and in what order.
|
|
46
|
+
|
|
47
|
+
1. **Build the dependency graph** from `Depends on:` fields in each task.
|
|
48
|
+
|
|
49
|
+
2. **Group into waves:**
|
|
50
|
+
- **Wave 1:** Tasks with no dependencies (can run in parallel)
|
|
51
|
+
- **Wave 2:** Tasks that depend only on Wave 1 tasks
|
|
52
|
+
- **Wave 3:** Tasks that depend on Wave 1 or 2 tasks
|
|
53
|
+
- etc.
|
|
54
|
+
|
|
55
|
+
3. **Present the execution order:**
|
|
56
|
+
```
|
|
57
|
+
Execution order:
|
|
58
|
+
Wave 1: task-1 (Schema and types)
|
|
59
|
+
Wave 2: task-2 (API endpoint), task-3 (Validation)
|
|
60
|
+
Wave 3: task-4 (Admin UI) — depends on task-2
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
4. Proceed immediately — no confirmation needed (the user already approved the plan in `/build`).
|
|
64
|
+
|
|
65
|
+
## Phase 2: Execute Tasks
|
|
66
|
+
|
|
67
|
+
For each wave, execute all tasks in the wave. Within a wave, tasks are independent and can run in parallel (if the runtime supports subagents).
|
|
68
|
+
|
|
69
|
+
### Per-task execution:
|
|
70
|
+
|
|
71
|
+
**Step 1: Read context**
|
|
72
|
+
|
|
73
|
+
Read ONLY the files listed in the task's `Files:` field. If the task references a doc page, read that too. Do not read unrelated files — the plan already scoped what matters.
|
|
74
|
+
|
|
75
|
+
Also read:
|
|
76
|
+
- DECISIONS.md — for the locked decisions relevant to this task
|
|
77
|
+
- Any files produced by prior tasks in earlier waves (new types, new schemas)
|
|
78
|
+
|
|
79
|
+
**Step 2: Implement**
|
|
80
|
+
|
|
81
|
+
Follow the task's `Do:` field exactly. Write the code.
|
|
82
|
+
|
|
83
|
+
Rules:
|
|
84
|
+
- Implement what the task says. Not more, not less.
|
|
85
|
+
- Follow existing code patterns in the files you're modifying. Match style, naming, imports.
|
|
86
|
+
- If the task references a doc page contract (e.g., "API shape defined in docs"), implement exactly what the docs specify.
|
|
87
|
+
- Run the project linter if available (`pnpm fix`, `ultracite fix`, or equivalent) after making changes.
|
|
88
|
+
|
|
89
|
+
**Step 3: Verify**
|
|
90
|
+
|
|
91
|
+
Run the task's `Verify:` step. Common verification patterns:
|
|
92
|
+
|
|
93
|
+
- `pnpm typecheck` — types compile
|
|
94
|
+
- `pnpm check` — lint passes
|
|
95
|
+
- Grep for expected patterns — `grep -r "refundReason" packages/db/src/schema.ts`
|
|
96
|
+
- File existence — `ls packages/shared/src/types/payments.ts`
|
|
97
|
+
- Test execution — `pnpm test --filter=<package>`
|
|
98
|
+
|
|
99
|
+
If verification fails, fix the issue and re-verify. Do not skip verification.
|
|
100
|
+
|
|
101
|
+
**Step 4: Commit**
|
|
102
|
+
|
|
103
|
+
Create an atomic commit for this task. Use Conventional Commits format:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
<type>(<scope>): <description>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Where:
|
|
110
|
+
- `type` = `feat`, `fix`, `refactor`, `chore`, `test` (match the nature of the change)
|
|
111
|
+
- `scope` = the package or module affected (e.g., `db`, `api`, `admin`, `shared`)
|
|
112
|
+
- `description` = what changed, in imperative mood
|
|
113
|
+
|
|
114
|
+
Stage only the files this task modified. Do not stage unrelated changes.
|
|
115
|
+
|
|
116
|
+
**Step 5: Update notes**
|
|
117
|
+
|
|
118
|
+
If Beads is available (`bd` CLI), update the bead's structured notes:
|
|
119
|
+
```bash
|
|
120
|
+
bd update <bead-id> --notes "COMPLETED: <what was done>
|
|
121
|
+
KEY DECISIONS: <any implementation decisions made>"
|
|
122
|
+
bd close <bead-id> --reason "<summary>"
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
If Beads is not available, append to a `SUMMARY.md` in the feature's `.context/` directory.
|
|
126
|
+
|
|
127
|
+
### Subagent execution (Tier 1 runtimes)
|
|
128
|
+
|
|
129
|
+
On runtimes that support subagents (Claude Code, Gemini CLI), each task SHOULD be executed by a fresh subagent. This prevents context rot — the subagent gets a clean context window with only the task description and file targets.
|
|
130
|
+
|
|
131
|
+
Spawn the subagent with:
|
|
132
|
+
- The task description (Do, Files, Verify fields)
|
|
133
|
+
- The relevant locked decisions from DECISIONS.md
|
|
134
|
+
- Any doc page references from the task
|
|
135
|
+
- The executor agent prompt from `resources/executor.md`
|
|
136
|
+
|
|
137
|
+
After the subagent completes, verify its work in the orchestrator context before moving to the next wave.
|
|
138
|
+
|
|
139
|
+
### Inline execution (Tier 2+ runtimes or small plans)
|
|
140
|
+
|
|
141
|
+
On runtimes without subagent support, or when the plan has only 1-2 tasks, execute tasks directly in the current context. Same steps, just no context isolation.
|
|
142
|
+
|
|
143
|
+
## Phase 3: Handle Deviations
|
|
144
|
+
|
|
145
|
+
During execution, you may encounter situations the plan didn't anticipate. Follow these rules strictly:
|
|
146
|
+
|
|
147
|
+
### Rule 1: Auto-fix — Minor bugs in existing code
|
|
148
|
+
> While modifying `payments.ts`, you notice an unused import.
|
|
149
|
+
|
|
150
|
+
**Action:** Fix it silently. Include in the same commit. Not worth stopping for.
|
|
151
|
+
|
|
152
|
+
### Rule 2: Auto-fix — Missing critical functionality
|
|
153
|
+
> The task says "add Zod validation" but the file doesn't import Zod yet.
|
|
154
|
+
|
|
155
|
+
**Action:** Add the import. This is implied by the task. Include in the same commit.
|
|
156
|
+
|
|
157
|
+
### Rule 3: Auto-fix — Blocking issues in adjacent code
|
|
158
|
+
> The task depends on a type that has a typo in its definition, causing typecheck to fail.
|
|
159
|
+
|
|
160
|
+
**Action:** Fix the typo. Note it in the commit message. It's blocking your task.
|
|
161
|
+
|
|
162
|
+
### Rule 4: STOP — Architectural decisions
|
|
163
|
+
> The task says "add column to transactions table" but you discover transactions is actually a view, not a table.
|
|
164
|
+
|
|
165
|
+
**Action:** STOP execution. Report the issue to the user:
|
|
166
|
+
> **Deviation detected in task-2:**
|
|
167
|
+
> The plan assumes `transactions` is a table, but it's a view over `transaction_log`.
|
|
168
|
+
> Adding a column requires modifying the underlying table instead.
|
|
169
|
+
>
|
|
170
|
+
> Options:
|
|
171
|
+
> 1. Add the column to `transaction_log` and update the view
|
|
172
|
+
> 2. Revise the plan
|
|
173
|
+
> 3. Skip this task and continue with others
|
|
174
|
+
|
|
175
|
+
Wait for user decision before proceeding.
|
|
176
|
+
|
|
177
|
+
### Rule 5: STOP — Scope change
|
|
178
|
+
> While implementing, you realize the feature needs a database migration that wasn't in the plan.
|
|
179
|
+
|
|
180
|
+
**Action:** STOP. Report to the user. A migration is a significant scope addition — the user should decide.
|
|
181
|
+
|
|
182
|
+
## Phase 4: Report Results
|
|
183
|
+
|
|
184
|
+
After all tasks complete (or if execution stops due to a deviation), report:
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
## Execution Summary
|
|
188
|
+
|
|
189
|
+
### Completed
|
|
190
|
+
- task-1: Schema and types ✓ (commit: abc1234)
|
|
191
|
+
- task-2: API endpoint ✓ (commit: def5678)
|
|
192
|
+
- task-3: Admin UI ✓ (commit: ghi9012)
|
|
193
|
+
|
|
194
|
+
### Verification
|
|
195
|
+
- pnpm typecheck: PASS
|
|
196
|
+
- pnpm check: PASS
|
|
197
|
+
|
|
198
|
+
### Notes
|
|
199
|
+
- [Any deviations, auto-fixes, or observations worth mentioning]
|
|
200
|
+
|
|
201
|
+
### Next Steps
|
|
202
|
+
- Run /review to verify against success criteria
|
|
203
|
+
- Run /docs if documentation needs updating
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Write this summary to `.context/<feature-id>/SUMMARY.md`.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## What This Skill Does NOT Do
|
|
211
|
+
|
|
212
|
+
- **Does not create plans.** That's `/build`. If no PLAN.md exists, say so.
|
|
213
|
+
- **Does not redesign.** Follow the plan. Deviations go through the deviation rules.
|
|
214
|
+
- **Does not update docs.** That's `/docs`.
|
|
215
|
+
- **Does not create PRs.** That's `/pr`.
|
|
216
|
+
- **Does not skip verification.** Every task's Verify step must run.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Task Executor
|
|
2
|
+
|
|
3
|
+
You are a task execution agent. You receive a single task from an execution plan and implement it. You have a fresh context window — no prior conversation history.
|
|
4
|
+
|
|
5
|
+
## Input
|
|
6
|
+
|
|
7
|
+
You will receive:
|
|
8
|
+
- A task description with `Files`, `Do`, and `Verify` fields
|
|
9
|
+
- Relevant locked decisions from DECISIONS.md
|
|
10
|
+
- Optional: doc page references to read for contracts and specs
|
|
11
|
+
|
|
12
|
+
## Process
|
|
13
|
+
|
|
14
|
+
1. **Read files.** Read every file listed in the `Files` field. Understand the existing code before modifying it.
|
|
15
|
+
|
|
16
|
+
2. **Read decisions.** Check the locked decisions for anything relevant to this task. Follow them exactly.
|
|
17
|
+
|
|
18
|
+
3. **Read docs.** If the task references a doc page, read it. The docs define the contracts — implement what they specify.
|
|
19
|
+
|
|
20
|
+
4. **Implement.** Follow the `Do` field. Write code that:
|
|
21
|
+
- Matches the existing style in the files you're modifying
|
|
22
|
+
- Uses the same patterns (imports, naming, error handling)
|
|
23
|
+
- Follows the locked decisions
|
|
24
|
+
- Does exactly what the task says — not more, not less
|
|
25
|
+
|
|
26
|
+
5. **Lint.** Run the project linter if available (`pnpm fix` or equivalent).
|
|
27
|
+
|
|
28
|
+
6. **Verify.** Run the `Verify` step. If it fails, fix and re-verify.
|
|
29
|
+
|
|
30
|
+
7. **Report.** When done, output:
|
|
31
|
+
```
|
|
32
|
+
## Task Complete
|
|
33
|
+
|
|
34
|
+
### What was done
|
|
35
|
+
- [Specific changes made]
|
|
36
|
+
|
|
37
|
+
### Files modified
|
|
38
|
+
- [list of files]
|
|
39
|
+
|
|
40
|
+
### Verification
|
|
41
|
+
- [verification step]: PASS/FAIL
|
|
42
|
+
|
|
43
|
+
### Decisions applied
|
|
44
|
+
- [which locked decisions informed the implementation]
|
|
45
|
+
|
|
46
|
+
### Notes
|
|
47
|
+
- [anything unexpected, auto-fixes applied, observations]
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Rules
|
|
51
|
+
|
|
52
|
+
- You implement ONE task. Do not look at other tasks in the plan.
|
|
53
|
+
- Do not modify files outside your `Files` list unless absolutely necessary (e.g., a shared import file).
|
|
54
|
+
- If you encounter something that contradicts the task description, STOP and report it — do not silently work around it.
|
|
55
|
+
- Match existing code patterns. If the codebase uses arrow functions, use arrow functions. If it uses `for...of`, use `for...of`. Don't introduce new patterns.
|
|
56
|
+
- Do not add comments explaining your changes. The commit message handles that.
|
|
57
|
+
- Do not add error handling, validation, or features beyond what the task specifies.
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: import
|
|
3
|
+
description: >
|
|
4
|
+
Analyze an existing codebase and generate a ystack module registry, Beads epics,
|
|
5
|
+
and a documentation gap report. Use this skill when the user says 'import', '/import',
|
|
6
|
+
'adopt this project', 'onboard this repo', 'scan the codebase', 'set up ystack here',
|
|
7
|
+
or when adding ystack to a project that already has code and possibly docs.
|
|
8
|
+
Supports incremental adoption with --module flag.
|
|
9
|
+
user-invocable: true
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# /import — Adopt an Existing Project
|
|
13
|
+
|
|
14
|
+
You analyze an existing codebase and produce a module registry, Beads epics, and a gap report. This is the on-ramp for projects that already have code.
|
|
15
|
+
|
|
16
|
+
**You do NOT modify code or docs.** You produce a registry and report. The user decides what to act on.
|
|
17
|
+
|
|
18
|
+
## Phase 0: Determine Scope
|
|
19
|
+
|
|
20
|
+
1. Check if `ystack.config.json` already exists:
|
|
21
|
+
```bash
|
|
22
|
+
cat ystack.config.json 2>/dev/null
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
2. If a `--module <name>` argument was provided, scope the import to that module only. Otherwise, scan the entire repo.
|
|
26
|
+
|
|
27
|
+
3. If the config already has modules registered, note which are new vs. already known.
|
|
28
|
+
|
|
29
|
+
## Phase 1: Scan the Codebase
|
|
30
|
+
|
|
31
|
+
Analyze the repo structure to detect logical modules. Spawn parallel research for each area:
|
|
32
|
+
|
|
33
|
+
### 1a: Structure scan
|
|
34
|
+
|
|
35
|
+
Map the directory tree to identify module boundaries:
|
|
36
|
+
```bash
|
|
37
|
+
# Find package.json files (monorepo packages)
|
|
38
|
+
find . -name "package.json" -not -path "*/node_modules/*" -maxdepth 3
|
|
39
|
+
|
|
40
|
+
# Get directory structure
|
|
41
|
+
ls -d apps/*/ packages/*/ 2>/dev/null
|
|
42
|
+
|
|
43
|
+
# Check for monorepo config
|
|
44
|
+
cat turbo.json 2>/dev/null
|
|
45
|
+
cat pnpm-workspace.yaml 2>/dev/null
|
|
46
|
+
cat lerna.json 2>/dev/null
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Classify each directory:
|
|
50
|
+
- `apps/*` → likely an app module (UI, server, API)
|
|
51
|
+
- `packages/*` → likely a library package
|
|
52
|
+
- `src/modules/*` or `src/features/*` → feature-based structure (single-app repo)
|
|
53
|
+
- Top-level `src/` without sub-packages → single-module project
|
|
54
|
+
|
|
55
|
+
### 1b: Dependency scan
|
|
56
|
+
|
|
57
|
+
Map imports between modules to understand connections:
|
|
58
|
+
```bash
|
|
59
|
+
# Find cross-package imports
|
|
60
|
+
grep -r "from ['\"]@" packages/ apps/ --include="*.ts" --include="*.tsx" -l 2>/dev/null
|
|
61
|
+
|
|
62
|
+
# Check package.json dependencies for workspace references
|
|
63
|
+
cat packages/*/package.json | grep "workspace:" 2>/dev/null
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Build a dependency graph: which modules import from which.
|
|
67
|
+
|
|
68
|
+
### 1c: Schema scan
|
|
69
|
+
|
|
70
|
+
Identify data models, API routes, and type definitions:
|
|
71
|
+
```bash
|
|
72
|
+
# Database schemas
|
|
73
|
+
find . -path "*/schema*" -name "*.ts" -not -path "*/node_modules/*" 2>/dev/null
|
|
74
|
+
find . -path "*/migrations*" -not -path "*/node_modules/*" -type d 2>/dev/null
|
|
75
|
+
|
|
76
|
+
# API routes
|
|
77
|
+
find . -path "*/routes/*" -o -path "*/api/*" -name "*.ts" -not -path "*/node_modules/*" 2>/dev/null
|
|
78
|
+
|
|
79
|
+
# Shared types
|
|
80
|
+
find . -path "*/types/*" -name "*.ts" -not -path "*/node_modules/*" 2>/dev/null
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 1d: Docs scan
|
|
84
|
+
|
|
85
|
+
Find existing documentation and map it to modules:
|
|
86
|
+
```bash
|
|
87
|
+
# Nextra
|
|
88
|
+
ls docs/src/content/_meta.ts 2>/dev/null && find docs/src/content -name "*.mdx" -o -name "*.md" 2>/dev/null
|
|
89
|
+
|
|
90
|
+
# Fumadocs
|
|
91
|
+
ls content/docs/meta.json 2>/dev/null && find content/docs -name "*.mdx" -o -name "*.md" 2>/dev/null
|
|
92
|
+
|
|
93
|
+
# Generic docs
|
|
94
|
+
ls docs/ README.md CLAUDE.md AGENTS.md 2>/dev/null
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Read `_meta.ts` or `meta.json` files to understand the doc site structure. Read `CLAUDE.md` and `AGENTS.md` for project context.
|
|
98
|
+
|
|
99
|
+
## Phase 2: Detect Modules
|
|
100
|
+
|
|
101
|
+
Group the scan results into logical modules.
|
|
102
|
+
|
|
103
|
+
### Grouping rules
|
|
104
|
+
|
|
105
|
+
1. **Monorepo packages** — each `apps/` and `packages/` directory is a candidate module.
|
|
106
|
+
|
|
107
|
+
2. **Cross-cutting modules** — some modules span multiple packages. Look for:
|
|
108
|
+
- A package that has schema files in `packages/db/` AND routes in `apps/api/` AND UI in `apps/admin/` → likely one module with scope across all three
|
|
109
|
+
- Shared types that are consumed by multiple packages → the types belong to whichever module defines the domain
|
|
110
|
+
|
|
111
|
+
3. **Feature modules within a package** — a large package might contain multiple modules:
|
|
112
|
+
- `packages/core/src/features/onboarding/index.ts` → could be its own sub-module
|
|
113
|
+
- Only split if the docs site treats it as a separate section
|
|
114
|
+
|
|
115
|
+
4. **Infrastructure vs. domain** — separate infrastructure (db, shared, tsconfig) from domain modules (payments, auth, dashboard). Infrastructure packages are usually not their own modules unless the docs site documents them.
|
|
116
|
+
|
|
117
|
+
### Module detection output
|
|
118
|
+
|
|
119
|
+
For each detected module, determine:
|
|
120
|
+
- **Name** — human-readable identifier
|
|
121
|
+
- **Scope** — glob patterns for files that belong to this module
|
|
122
|
+
- **Doc page** — matching docs path (if docs exist) or `null`
|
|
123
|
+
- **Status** — `implemented` (has code), `documented` (has docs), `both`, or `gap`
|
|
124
|
+
- **Features** — key files/exports that represent implemented features
|
|
125
|
+
- **Dependencies** — other modules this one imports from
|
|
126
|
+
|
|
127
|
+
### Present findings
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
## Detected Modules (8)
|
|
131
|
+
|
|
132
|
+
| Module | Scope | Docs | Status |
|
|
133
|
+
|--------|-------|------|--------|
|
|
134
|
+
| payments | packages/payments/**, apps/api/src/routes/payments.* | shared/payments | both |
|
|
135
|
+
| auth | packages/shared/src/auth/**, apps/api/src/routes/auth.* | shared/authentication | both |
|
|
136
|
+
| dashboard | apps/dashboard/** | dashboard | both |
|
|
137
|
+
| admin | apps/admin/** | admin-dashboard | docs only (stub) |
|
|
138
|
+
| notifications | packages/notifications/** | notifications | both |
|
|
139
|
+
| billing | packages/billing/** | billing | code only (no docs) |
|
|
140
|
+
| db | packages/db/** | (infrastructure) | — |
|
|
141
|
+
| shared | packages/shared/** | shared | partial |
|
|
142
|
+
|
|
143
|
+
Connections:
|
|
144
|
+
payments → db, shared
|
|
145
|
+
dashboard → payments, billing, notifications, db
|
|
146
|
+
admin → payments, dashboard, billing
|
|
147
|
+
...
|
|
148
|
+
|
|
149
|
+
Does this look right? I'll generate the registry from this.
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Wait for user confirmation.** The user may want to merge, split, or rename modules.
|
|
153
|
+
|
|
154
|
+
## Phase 3: Generate Module Registry
|
|
155
|
+
|
|
156
|
+
Create or update `ystack.config.json`:
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"project": "<detected-project-name>",
|
|
161
|
+
"docs": {
|
|
162
|
+
"root": "<detected-docs-root>",
|
|
163
|
+
"framework": "<nextra|fumadocs|unknown>"
|
|
164
|
+
},
|
|
165
|
+
"modules": {
|
|
166
|
+
"payments": {
|
|
167
|
+
"doc": "shared/payments",
|
|
168
|
+
"scope": [
|
|
169
|
+
"packages/payments/**",
|
|
170
|
+
"packages/db/src/schema/transactions.*",
|
|
171
|
+
"apps/api/src/routes/payments.*"
|
|
172
|
+
],
|
|
173
|
+
"status": "active"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
For each module:
|
|
180
|
+
- `doc` — the matching docs path, or `null` if no docs exist
|
|
181
|
+
- `scope` — glob patterns covering all files that belong to this module
|
|
182
|
+
- `status` — `"active"` if code exists, `"planned"` if only docs/stubs
|
|
183
|
+
|
|
184
|
+
If the config already exists, merge new modules — don't overwrite existing entries.
|
|
185
|
+
|
|
186
|
+
## Phase 4: Create Beads Epics
|
|
187
|
+
|
|
188
|
+
If Beads (`bd`) is available:
|
|
189
|
+
|
|
190
|
+
1. Create an epic per module:
|
|
191
|
+
```bash
|
|
192
|
+
bd create "<Module Name>" -t epic --metadata '{"doc": "<module-slug>", "ystack": true}'
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
2. For each implemented feature detected in the code, create a **closed** child bead:
|
|
196
|
+
```bash
|
|
197
|
+
bd create "<Feature description>" -t feature --parent <epic-id>
|
|
198
|
+
bd close <bead-id> --reason "Pre-existing implementation detected by /import"
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
3. Add inter-module dependencies:
|
|
202
|
+
```bash
|
|
203
|
+
bd dep add <epic-id> related:<dependent-epic-id>
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
4. Update `ystack.config.json` with epic IDs.
|
|
207
|
+
|
|
208
|
+
If Beads is not available, skip and note:
|
|
209
|
+
> Beads not detected. Run `bd init` to enable progress tracking.
|
|
210
|
+
|
|
211
|
+
## Phase 5: Generate Gap Report
|
|
212
|
+
|
|
213
|
+
Analyze the delta between code and docs:
|
|
214
|
+
|
|
215
|
+
```markdown
|
|
216
|
+
## Import Report
|
|
217
|
+
|
|
218
|
+
### Project: <name>
|
|
219
|
+
### Modules: N detected, M documented
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
### Fully Documented (N)
|
|
224
|
+
- payments — docs match implementation
|
|
225
|
+
- auth — docs match implementation
|
|
226
|
+
|
|
227
|
+
### Code Without Docs (N)
|
|
228
|
+
- billing — 5 features implemented, no doc pages
|
|
229
|
+
- Invoice generation
|
|
230
|
+
- Subscription management
|
|
231
|
+
- Usage metering
|
|
232
|
+
- Refund processing
|
|
233
|
+
- Payment method CRUD
|
|
234
|
+
|
|
235
|
+
### Docs Without Code (N)
|
|
236
|
+
- admin/analytics — doc page exists but feature not implemented
|
|
237
|
+
|
|
238
|
+
### Stale Docs (N)
|
|
239
|
+
- shared/storage — docs reference old S3 API, code uses R2 SDK
|
|
240
|
+
Evidence: docs mention `@aws-sdk/client-s3`, code imports `@acme/shared/storage`
|
|
241
|
+
|
|
242
|
+
### Missing Cross-References (N)
|
|
243
|
+
- dashboard/index.mdx mentions "Payments" but doesn't link to /shared/payments
|
|
244
|
+
- billing has no doc page, so nothing can link to it
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
### Recommended Next Steps
|
|
249
|
+
1. Run `/scaffold` or `/docs` to create docs for billing (5 undocumented features)
|
|
250
|
+
2. Update shared/storage docs (stale — S3 → R2 migration)
|
|
251
|
+
3. Add cross-reference links in dashboard/index.mdx
|
|
252
|
+
4. `/build` for any new features — the registry is ready
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Stale docs detection
|
|
256
|
+
|
|
257
|
+
Compare code and docs for inconsistencies:
|
|
258
|
+
- **Imports in docs vs. code** — do docs reference packages the code no longer uses?
|
|
259
|
+
- **API routes** — do docs describe endpoints that don't exist (or miss ones that do)?
|
|
260
|
+
- **Schema fields** — do data model tables in docs match actual schema files?
|
|
261
|
+
- **Module names** — do docs use old names for renamed modules?
|
|
262
|
+
|
|
263
|
+
Only flag clear mismatches. Don't flag vague prose that's technically correct.
|
|
264
|
+
|
|
265
|
+
## Phase 6: Summary
|
|
266
|
+
|
|
267
|
+
```
|
|
268
|
+
## Import Complete
|
|
269
|
+
|
|
270
|
+
### Registry
|
|
271
|
+
ystack.config.json — N modules registered
|
|
272
|
+
|
|
273
|
+
### Beads
|
|
274
|
+
N epics created, M features tracked (K pre-closed as implemented)
|
|
275
|
+
|
|
276
|
+
### Documentation
|
|
277
|
+
N pages found, M gaps detected
|
|
278
|
+
|
|
279
|
+
### Next Steps
|
|
280
|
+
- Fix N doc gaps with /docs or /scaffold
|
|
281
|
+
- Run /build to start new feature work
|
|
282
|
+
- The module registry connects code ↔ docs ↔ beads
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## Incremental Adoption
|
|
288
|
+
|
|
289
|
+
With `--module <name>`:
|
|
290
|
+
|
|
291
|
+
1. Only scan files matching the specified module name or path
|
|
292
|
+
2. Only create one module entry in the registry
|
|
293
|
+
3. Only create one epic in Beads
|
|
294
|
+
4. Gap report scoped to that module
|
|
295
|
+
|
|
296
|
+
This is useful for large repos where a full scan is too slow, or when onboarding one team at a time.
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## What This Skill Does NOT Do
|
|
301
|
+
|
|
302
|
+
- **Does not modify code.** Read-only scan.
|
|
303
|
+
- **Does not modify existing docs.** Reports gaps, doesn't fix them.
|
|
304
|
+
- **Does not install tooling.** No Turborepo, Ultracite, Nextra — that's `npx ystack init` or `create`.
|
|
305
|
+
- **Does not create doc pages.** Reports what's missing — `/docs` or `/scaffold` creates them.
|
|
306
|
+
- **Does not guess features.** Only reports what it can detect from code structure, exports, and file names.
|