@open-agent-toolkit/cli 0.0.37 → 0.0.39
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/assets/docs/cli-utilities/tool-packs.md +4 -0
- package/assets/docs/docs-tooling/add-docs-to-a-repo.md +32 -0
- package/assets/docs/docs-tooling/commands.md +2 -0
- package/assets/docs/docs-tooling/workflows.md +5 -1
- package/assets/docs/workflows/skills/index.md +2 -1
- package/assets/public-package-versions.json +4 -4
- package/assets/skills/oat-docs-bootstrap/SKILL.md +1171 -0
- package/assets/skills/oat-docs-bootstrap/assets/AGENTS.md.template +63 -0
- package/assets/skills/oat-project-complete/SKILL.md +17 -8
- package/assets/templates/docs-app-fuma/docs/contributing.md +1 -2
- package/assets/templates/docs-app-fuma/docs/getting-started.md +1 -1
- package/assets/templates/docs-app-fuma/docs/index.md +2 -2
- package/dist/commands/init/tools/shared/skill-manifest.d.ts +1 -1
- package/dist/commands/init/tools/shared/skill-manifest.d.ts.map +1 -1
- package/dist/commands/init/tools/shared/skill-manifest.js +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,1171 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: oat-docs-bootstrap
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
description: Use when bootstrapping a new OAT docs app in a repo. Guides the user through preflight detection, richer input gathering than the raw CLI, `oat docs init` invocation with labeled post-patches for open CLI gaps, build verification, post-scaffold config inspection, and an educational walkthrough. Supports Fumadocs (full path) and MkDocs (lean path with defined minimum contract).
|
|
5
|
+
argument-hint: '<optional-target-dir>'
|
|
6
|
+
disable-model-invocation: true
|
|
7
|
+
user-invocable: true
|
|
8
|
+
allowed-tools: Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Docs Bootstrap
|
|
12
|
+
|
|
13
|
+
Bootstrap a docs app in this repo and guide the user through understanding how it works. Wraps `oat docs init` with preflight detection, richer input gathering, labeled post-patches for open CLI gaps (FP-11 Turbopack root, FP-12 site-title coherence, FP-13 template content, FP-15 docs-app AGENTS.md, FP-16 `## Contents` link extensions, FP-17 `contributing.md` three-surfaces cleanup), build verification, post-scaffold config inspection, and an educational walkthrough covering the `index.md` + `## Contents` navigation contract, scaffolded agent-instruction surfaces, and the OAT docs ecosystem (`oat-project-document`, `oat-docs-analyze`, `oat-docs-apply`).
|
|
14
|
+
|
|
15
|
+
## Prerequisites
|
|
16
|
+
|
|
17
|
+
- A repository initialized for OAT (`.oat/config.json` readable, `.agents/` present).
|
|
18
|
+
- The OAT CLI is runnable (either as a workspace binary via `pnpm run cli --` or an installed `oat` binary on PATH).
|
|
19
|
+
- A feature request or intent: "add docs to this repo" or equivalent.
|
|
20
|
+
|
|
21
|
+
## Mode Assertion
|
|
22
|
+
|
|
23
|
+
**OAT MODE: Docs Bootstrap**
|
|
24
|
+
|
|
25
|
+
**Purpose:** Turn `oat docs init` scaffolding into a support-rich onboarding experience — preflight, inputs, CLI invocation with labeled post-patches, build verification, config inspection, educational walkthrough, and optional content kickoff. Two framework paths: Fumadocs (full) and MkDocs (lean with defined minimum contract).
|
|
26
|
+
|
|
27
|
+
**BLOCKED Activities:**
|
|
28
|
+
|
|
29
|
+
- No reimplementing CLI scaffold logic (the CLI remains the source of truth for template rendering, version resolution, and configuration writes)
|
|
30
|
+
- No fabricating files the CLI does not create, with one documented exception: the FP-15 bridge AGENTS.md, which is written only when the CLI has not scaffolded one and whose content is migrated upstream when the CLI fix lands
|
|
31
|
+
- No expanding scope into content authoring (that's `oat-docs-analyze` / `oat-docs-apply` / `oat-project-document`)
|
|
32
|
+
- No silent failures — every error has a surfaced remediation
|
|
33
|
+
|
|
34
|
+
**ALLOWED Activities:**
|
|
35
|
+
|
|
36
|
+
- Inspecting repo state read-only before any mutation
|
|
37
|
+
- Prompting the user for richer inputs than the CLI asks for (notably a site name separate from the package/app name)
|
|
38
|
+
- Invoking `oat docs init` non-interactively with collected flags
|
|
39
|
+
- Applying labeled, idempotent post-patches for open CLI gaps (FP-11/FP-12/FP-13/FP-15/FP-16/FP-17) only when capability detection shows the CLI has not addressed them
|
|
40
|
+
- Running install + build and classifying failures against known patterns
|
|
41
|
+
- Reading `.oat/config.json` back to verify paths and prompting for `requireForProjectCompletion`
|
|
42
|
+
- Narrating the scaffolded output as a chunked educational walkthrough
|
|
43
|
+
- Delegating optional initial content population to `oat-docs-analyze` + `oat-docs-apply`
|
|
44
|
+
|
|
45
|
+
**Self-Correction Protocol:**
|
|
46
|
+
If you catch yourself:
|
|
47
|
+
|
|
48
|
+
- Writing scaffold-template content directly instead of calling the CLI → STOP (the CLI owns templates; you own the surrounding experience)
|
|
49
|
+
- Narrating AGENTS.md content word-for-word in the Walkthrough → STOP (the Walkthrough points at AGENTS.md; it does not read it aloud)
|
|
50
|
+
- Expanding into full content generation → STOP (delegate to analyze/apply)
|
|
51
|
+
- Applying a post-patch without running capability detection first → STOP (patches must be gated on deterministic probes and file-shape checks)
|
|
52
|
+
|
|
53
|
+
**Recovery:**
|
|
54
|
+
|
|
55
|
+
1. Acknowledge the deviation
|
|
56
|
+
2. Return to the current Step
|
|
57
|
+
3. Document any deviation in the final Walkthrough summary so the user knows what happened
|
|
58
|
+
|
|
59
|
+
## Progress Indicators (User-Facing)
|
|
60
|
+
|
|
61
|
+
Provide lightweight progress feedback so the user can tell what's happening at each boundary.
|
|
62
|
+
|
|
63
|
+
- Print a phase banner once at start using horizontal separators, e.g.:
|
|
64
|
+
|
|
65
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
66
|
+
OAT ▸ DOCS BOOTSTRAP
|
|
67
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
68
|
+
|
|
69
|
+
- Before each major component, print a compact step indicator:
|
|
70
|
+
- `[1/7] Preflight…`
|
|
71
|
+
- `[2/7] Gathering inputs…`
|
|
72
|
+
- `[3/7] Scaffolding…`
|
|
73
|
+
- `[4/7] Verifying build…`
|
|
74
|
+
- `[5/7] Inspecting config…`
|
|
75
|
+
- `[6/7] Walkthrough…`
|
|
76
|
+
- `[7/7] Optional content kickoff…`
|
|
77
|
+
|
|
78
|
+
- For long-running operations (install, build, analyze/apply delegation), print a start line and a completion line; optional duration.
|
|
79
|
+
- Keep it concise; don't print a line for every shell command.
|
|
80
|
+
|
|
81
|
+
## Process
|
|
82
|
+
|
|
83
|
+
### Step 0: Resolve Active Project and Environment
|
|
84
|
+
|
|
85
|
+
Bootstrap the skill's working context. This step is purely read-only and establishes what the rest of the skill operates on.
|
|
86
|
+
|
|
87
|
+
**0a. Resolve repo root and CLI binary:**
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
|
|
91
|
+
CLI_CMD="oat"
|
|
92
|
+
if ! command -v oat >/dev/null 2>&1; then
|
|
93
|
+
# Fall back to the workspace CLI if there's no installed binary
|
|
94
|
+
if [ -f "$REPO_ROOT/package.json" ] && grep -q '"cli"' "$REPO_ROOT/package.json"; then
|
|
95
|
+
CLI_CMD="pnpm run cli --"
|
|
96
|
+
fi
|
|
97
|
+
fi
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
**0b. Read active OAT project context (optional):**
|
|
101
|
+
|
|
102
|
+
The skill can be invoked outside an active OAT project (e.g., a fresh repo with no project tracking). If an active project exists, surface it so the Educational Walkthrough can link to it; if not, proceed without. Do not block on active-project state — docs bootstrap is scoped to the repo, not to a project.
|
|
103
|
+
|
|
104
|
+
**0c. Print the banner:**
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
108
|
+
OAT ▸ DOCS BOOTSTRAP
|
|
109
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Step 1: Preflight Detector
|
|
113
|
+
|
|
114
|
+
Inspect the working tree before any mutation. Determine the repo shape, detect existing docs setup, and surface conflicts that require user decisions later. This step is strictly read-only; any fix or prompt flows through the Input Gatherer (Step 2).
|
|
115
|
+
|
|
116
|
+
Print `[1/7] Preflight…` at the start of this step.
|
|
117
|
+
|
|
118
|
+
**1a. Detect repo shape.**
|
|
119
|
+
|
|
120
|
+
Check in order; the first match wins:
|
|
121
|
+
|
|
122
|
+
1. If `pnpm-workspace.yaml` exists at `$REPO_ROOT` → **`monorepo`**
|
|
123
|
+
2. If `$REPO_ROOT/package.json` has a non-empty `workspaces` field (array or `{packages: []}`) → **`monorepo`**
|
|
124
|
+
3. If both `$REPO_ROOT/apps/` and `$REPO_ROOT/packages/` directories exist → **`monorepo`**
|
|
125
|
+
4. Otherwise → **`single-package`**
|
|
126
|
+
|
|
127
|
+
Once `single-package` is identified, apply the nested-standalone heuristic: if the user will place the docs app in a subdirectory of the repo (the common case for single-package repos) and that subdirectory will have its own `pnpm-lock.yaml` after scaffold + install, treat the shape as **`nested-standalone`**. This is a single-package shape with its own docs-app lockfile, which affects the Turbopack root patch (FP-11) and the install command pattern.
|
|
128
|
+
|
|
129
|
+
In practice: for Fumadocs, any single-package repo with a target subdirectory is `nested-standalone`. For MkDocs, the shape stays `single-package` because MkDocs doesn't have the Turbopack concern.
|
|
130
|
+
|
|
131
|
+
**1b. Detect existing docs setup.**
|
|
132
|
+
|
|
133
|
+
Read (do not modify):
|
|
134
|
+
|
|
135
|
+
- `$REPO_ROOT/.oat/config.json`, extract the `documentation` section if present. Record `configDocumentation` (the parsed object) or `null`.
|
|
136
|
+
- Presence of an existing docs app directory. Inference sources: the `root` field of `configDocumentation` if present; common locations like `apps/docs`, `apps/*-docs`, `documentation/`, `docs/` at repo root (for single-package). Record `docsAppPath` (the absolute path) or `null`.
|
|
137
|
+
- `$REPO_ROOT/AGENTS.md` (if it exists): scan for a `## Documentation` section. Record `agentsMdSection: true | false`.
|
|
138
|
+
|
|
139
|
+
**1c. Identify conflicts.**
|
|
140
|
+
|
|
141
|
+
Build `conflicts: []` by adding an entry for each finding:
|
|
142
|
+
|
|
143
|
+
- If `configDocumentation` is non-null → `{ kind: 'existing-config', detail: <summary of what's there> }`
|
|
144
|
+
- If `docsAppPath` exists on disk → `{ kind: 'existing-app-dir', detail: <path + whether it has uncommitted changes> }`
|
|
145
|
+
- If `agentsMdSection` is true → `{ kind: 'existing-agents-section', detail: <what the section says> }`
|
|
146
|
+
|
|
147
|
+
Conflicts are **recorded**, not **resolved**. Resolution happens in Step 2 (Input Gatherer). Preflight remains single-purpose.
|
|
148
|
+
|
|
149
|
+
**1d. Resolve defaults for the Input Gatherer.**
|
|
150
|
+
|
|
151
|
+
Derive:
|
|
152
|
+
|
|
153
|
+
- `repoName`: `basename($REPO_ROOT)`
|
|
154
|
+
- `siteName` default: humanized form of `repoName` (e.g., `cyclone-app` → `Cyclone App`, `vox_mobile` → `Vox Mobile`, `docs` → `Docs`). Do not append " Documentation" here — that's a concern of the scaffold, not of the default.
|
|
155
|
+
- `appName` default:
|
|
156
|
+
- If shape is `monorepo`: `{repoName}-docs` (e.g., `open-agent-toolkit-docs`)
|
|
157
|
+
- If shape is `single-package` or `nested-standalone`: `docs`
|
|
158
|
+
- `targetDir` default:
|
|
159
|
+
- If shape is `monorepo`: `apps/{appName}`
|
|
160
|
+
- If shape is `single-package`: `{appName}` (subdirectory of repo root)
|
|
161
|
+
- If shape is `nested-standalone`: same as single-package (`{appName}`)
|
|
162
|
+
|
|
163
|
+
**1e. Emit the Preflight Result.**
|
|
164
|
+
|
|
165
|
+
Record internally (not persisted to disk) for the Input Gatherer and downstream components:
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
Preflight Result:
|
|
169
|
+
repoShape: 'monorepo' | 'single-package' | 'nested-standalone'
|
|
170
|
+
repoName: string
|
|
171
|
+
existingDocs:
|
|
172
|
+
configDocumentation: OatDocumentationConfig | null
|
|
173
|
+
docsAppPath: absolute-path-string | null
|
|
174
|
+
agentsMdSection: boolean
|
|
175
|
+
conflicts: Array<{ kind, detail }>
|
|
176
|
+
defaults:
|
|
177
|
+
appName: string
|
|
178
|
+
targetDir: string
|
|
179
|
+
siteName: string
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**Design discipline:**
|
|
183
|
+
|
|
184
|
+
- **Read-only invariant.** Preflight never writes files, never modifies config, never runs scaffold. Every fix or prompt flows through later components.
|
|
185
|
+
- **Conflict surfacing is a list, not a branch.** Preflight returns all conflicts found; the Input Gatherer presents them together. This keeps Preflight single-purpose and predictable.
|
|
186
|
+
- **`nested-standalone` is a first-class shape** distinct from `single-package`. The CLI conflates them, but the skill treats them separately because Turbopack root (FP-11), build command patterns, and nested `.oat/config.json` handling all differ.
|
|
187
|
+
|
|
188
|
+
### Step 2: Input Gatherer
|
|
189
|
+
|
|
190
|
+
Collect the inputs needed to invoke `oat docs init` and apply post-scaffold patches. The skill asks for richer inputs than the CLI prompts for — most importantly, a **site name** separate from the package/app name (the FP-12 workaround). Ask one question at a time, surfacing defaults from the Preflight Result, and end with a coherence check before scaffold.
|
|
191
|
+
|
|
192
|
+
Print `[2/7] Gathering inputs…` at the start of this step.
|
|
193
|
+
|
|
194
|
+
**2a. Resolve Preflight conflicts (if any).**
|
|
195
|
+
|
|
196
|
+
If `conflicts[]` from Preflight is non-empty, present them together and collect a `conflictResolution`. See the **Conflict Resolution Contract** sub-procedure below for the exact semantics of each option. Do not proceed to input questions until the user has chosen a resolution.
|
|
197
|
+
|
|
198
|
+
If `conflicts[]` is empty, skip conflict handling and go to 2b.
|
|
199
|
+
|
|
200
|
+
**2b. Ask for inputs, one at a time.**
|
|
201
|
+
|
|
202
|
+
Each question includes plain-language context explaining what the value affects. Defaults come from the Preflight Result. Ask sequentially — each answer can inform the next default.
|
|
203
|
+
|
|
204
|
+
- **Framework.** `"Which docs framework? Fumadocs (Next.js, primary path) or MkDocs (Python, lean path)?"` Default: `fumadocs`.
|
|
205
|
+
- **Site name.** `"What's the name of the product or project these docs are for?"` Default: `defaults.siteName` (humanized repo name). Explain: "This becomes the display title — what shows up in the site header, browser tab, and page headings. It is **not** the package name." This is the FP-12 workaround — distinct from `appName`.
|
|
206
|
+
- **Package / app name.** `"What should the docs package be called?"` Default: `defaults.appName`. Explain: "This becomes the `package.json` `name`, the directory name, and the pnpm filter (e.g., `pnpm --filter {appName} dev`). It does **not** show up in the UI."
|
|
207
|
+
- **Target directory.** `"Where should the docs app live?"` Default: `defaults.targetDir`. Explain: "Relative to repo root. Monorepos typically use `apps/{appName}`; single-package repos use `{appName}` as a subdirectory."
|
|
208
|
+
- **Site description.** `"One-sentence description of the docs site?"` Default: empty. Explain: "Used for search previews, social cards, and page metadata. Optional but strongly recommended."
|
|
209
|
+
- **Lint mode.** `"Markdown linting — `markdownlint-cli2`or`none`?"` Default: `none`.
|
|
210
|
+
- **Format mode.** `"Markdown formatting — `oxfmt`or`none`?"` Default: `oxfmt`.
|
|
211
|
+
|
|
212
|
+
**2c. Validate inputs.**
|
|
213
|
+
|
|
214
|
+
- `appName`: no spaces, no uppercase, no leading/trailing hyphens, matches `^[a-z0-9][a-z0-9-]*[a-z0-9]$` or single lowercase char. Reject and re-prompt on failure.
|
|
215
|
+
- `siteName`: non-empty after trim. Reject empty.
|
|
216
|
+
- `targetDir`: must be relative (no leading `/`, no `..`), must be writable based on the chosen `conflictResolution` (e.g., `replace` requires the path to be empty-after-cleanup; `second-app` requires a fresh path that doesn't overlap with an existing docs app).
|
|
217
|
+
- `framework`: must be `fumadocs` or `mkdocs`.
|
|
218
|
+
- `lint`: must be `none` or `markdownlint-cli2`.
|
|
219
|
+
- `format`: must be `none` or `oxfmt`.
|
|
220
|
+
|
|
221
|
+
**2d. Coherence check.**
|
|
222
|
+
|
|
223
|
+
Before proceeding to scaffold, summarize what the user chose and confirm:
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
Here's what I'll scaffold:
|
|
227
|
+
|
|
228
|
+
Framework: {framework}
|
|
229
|
+
Display title: {siteName} Documentation ← shown in header / tab / page headings
|
|
230
|
+
Package name: {appName} ← used by pnpm filter / directory name
|
|
231
|
+
Target dir: {targetDir} ← relative to repo root
|
|
232
|
+
Description: {siteDescription | "(none)"}
|
|
233
|
+
Lint: {lint}
|
|
234
|
+
Format: {format}
|
|
235
|
+
|
|
236
|
+
Does this look right? (yes / adjust)
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
If `adjust`, ask which field to change and loop back to the question for that field. Re-show the coherence check after the adjustment. Continue looping until the user confirms `yes`.
|
|
240
|
+
|
|
241
|
+
**2e. Emit the Input Result.**
|
|
242
|
+
|
|
243
|
+
Record internally for the Scaffold Runner:
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
Input Result:
|
|
247
|
+
framework: 'fumadocs' | 'mkdocs'
|
|
248
|
+
siteName: string // FP-12 workaround: display title distinct from appName
|
|
249
|
+
appName: string
|
|
250
|
+
targetDir: string
|
|
251
|
+
siteDescription: string
|
|
252
|
+
lint: 'none' | 'markdownlint-cli2'
|
|
253
|
+
format: 'oxfmt' | 'none'
|
|
254
|
+
conflictResolution: 'replace' | 'second-app' | 'abort' | 'repair' | null
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
#### Conflict Resolution Contract (sub-procedure)
|
|
258
|
+
|
|
259
|
+
When Preflight (Step 1) records non-empty `conflicts[]`, present them to the user together and collect exactly one resolution. Each resolution below has a precise definition in terms of **allowed mutations**, **preserved state**, and **stop conditions**. The Scaffold Runner (Step 3) reads the chosen resolution and adjusts its behavior; it never reinvents these semantics.
|
|
260
|
+
|
|
261
|
+
Resolution options:
|
|
262
|
+
|
|
263
|
+
- **`replace`** — Treat the existing docs setup as disposable and scaffold fresh.
|
|
264
|
+
- **Allowed mutations (executed by this sub-procedure before Scaffold Runner begins):**
|
|
265
|
+
- Remove the existing docs app directory (`existingDocs.docsAppPath`), if present on disk.
|
|
266
|
+
- Remove the `documentation` section from `$REPO_ROOT/.oat/config.json`, if present. The CLI will rewrite it during init.
|
|
267
|
+
- Remove the `## Documentation` section from `$REPO_ROOT/AGENTS.md`, if present. The CLI upserts its own.
|
|
268
|
+
- **Preserved state:** Everything outside the three touchpoints above. Git history is preserved — deletions are tracked normally and remain recoverable via `git revert` / `git checkout`.
|
|
269
|
+
- **Stop conditions:**
|
|
270
|
+
- If the existing docs app directory contains **uncommitted changes** (tracked or untracked), **refuse** and surface a focused error: `Refusing to replace {docsAppPath}: it contains uncommitted changes. Commit or stash before choosing 'replace'.` The user must resolve the working tree before retrying.
|
|
271
|
+
- If any allowed mutation fails (e.g., permission error removing the directory), **stop the flow before Scaffold Runner** — partial cleanup leaves an inconsistent state that the CLI cannot recover from.
|
|
272
|
+
- **`second-app`** — Add a new docs app alongside the existing one (currently a **deferred feature**).
|
|
273
|
+
- **Allowed mutations:** None. This resolution is not functional in the current CLI.
|
|
274
|
+
- **Preserved state:** Everything.
|
|
275
|
+
- **Stop conditions:** The current `OatDocumentationConfig` shape (`packages/cli/src/config/oat-config.ts`) supports a single `documentation` object. Until the CLI gains multi-docs support, **refuse with an explicit explanation** and redirect the user to the other three resolutions:
|
|
276
|
+
|
|
277
|
+
```
|
|
278
|
+
'second-app' isn't available yet: the OAT config schema currently supports a single
|
|
279
|
+
documentation section, so adding a second docs app would overwrite the first's config.
|
|
280
|
+
|
|
281
|
+
Pick another resolution:
|
|
282
|
+
- replace — remove the existing docs app and scaffold fresh at the same path
|
|
283
|
+
- abort — exit without changes; keep the existing setup as-is
|
|
284
|
+
- repair — run `oat-docs-analyze` on the existing setup and decide from there
|
|
285
|
+
|
|
286
|
+
(When the CLI schema adds multi-docs support, 'second-app' becomes available without
|
|
287
|
+
any further changes to this skill.)
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Re-prompt for a resolution; do not allow `second-app` to proceed.
|
|
291
|
+
|
|
292
|
+
- **`abort`** — Stop the flow without any mutation.
|
|
293
|
+
- **Allowed mutations:** None.
|
|
294
|
+
- **Preserved state:** Everything.
|
|
295
|
+
- **Stop conditions:** Print a compact summary of what was detected and exit immediately. No CLI invocation, no post-patches, no Walkthrough. Example summary:
|
|
296
|
+
|
|
297
|
+
```
|
|
298
|
+
Aborting docs bootstrap. Nothing was changed.
|
|
299
|
+
|
|
300
|
+
Detected:
|
|
301
|
+
- {existing-config / existing-app-dir / existing-agents-section as applicable}
|
|
302
|
+
|
|
303
|
+
To revisit later, rerun this skill; Preflight is idempotent.
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
- **`repair`** — Fix the existing setup in place rather than replacing it. Delegate to the docs-analysis pack.
|
|
307
|
+
- **Allowed mutations (by this sub-procedure):** None directly. The bootstrap skill does not modify existing docs app files. It hands off to `oat-docs-analyze` (read-only audit) and, with user approval, to `oat-docs-apply` (applies approved recommendations).
|
|
308
|
+
- **Preserved state:** Existing docs app directory, the `documentation` config section, the root `AGENTS.md` `## Documentation` section — all preserved unless analyze surfaces a recommendation and the user approves it via apply.
|
|
309
|
+
- **Stop conditions:**
|
|
310
|
+
- Invoke `oat-docs-analyze` and surface its report to the user. If analyze cannot produce meaningful recommendations (e.g., `documentation.index` points at a missing file, or the app directory is empty), **stop the flow before Scaffold Runner**, report what analyze found, and ask the user whether to escalate to `replace`.
|
|
311
|
+
- If analyze + apply complete cleanly, the existing setup is now the target — **do not proceed to Scaffold Runner**; exit with a summary that points at the repaired app. Scaffolding on top of a repaired app would re-introduce the conflicts Preflight surfaced.
|
|
312
|
+
|
|
313
|
+
**Presentation pattern:**
|
|
314
|
+
|
|
315
|
+
Print the conflict summary once, then ask for a resolution. Example:
|
|
316
|
+
|
|
317
|
+
```
|
|
318
|
+
Preflight detected existing docs setup:
|
|
319
|
+
- existing-config: .oat/config.json has a `documentation` section pointing at apps/docs
|
|
320
|
+
- existing-app-dir: apps/docs exists on disk (clean working tree)
|
|
321
|
+
- existing-agents-section: AGENTS.md has a ## Documentation section
|
|
322
|
+
|
|
323
|
+
How should I proceed?
|
|
324
|
+
1. replace — remove the existing docs app and scaffold fresh at the same path
|
|
325
|
+
2. second-app — (deferred) add a new docs app alongside; not available in current CLI
|
|
326
|
+
3. abort — exit without changes
|
|
327
|
+
4. repair — run `oat-docs-analyze` / `oat-docs-apply` on the existing setup
|
|
328
|
+
|
|
329
|
+
Choose:
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
Record the user's choice as `conflictResolution` in the Input Result. If the user chose `second-app`, loop back to the prompt after surfacing the refusal message; do not emit `conflictResolution: 'second-app'`.
|
|
333
|
+
|
|
334
|
+
**Pre-scaffold invariant:**
|
|
335
|
+
|
|
336
|
+
No matter which resolution the user picks, the Scaffold Runner (Step 3) **never** invokes `oat docs init` until:
|
|
337
|
+
|
|
338
|
+
1. The chosen resolution's "Allowed mutations" have **completed successfully**, and
|
|
339
|
+
2. The working-tree state **matches what the CLI expects** for that resolution (e.g., for `replace`: the target directory is empty or absent, the `documentation` config section is cleared, the root `AGENTS.md` `## Documentation` section is cleared; for `abort` / `repair`: the skill has already exited).
|
|
340
|
+
|
|
341
|
+
If any mutation fails or any invariant check fails, **stop the flow before scaffold** and surface the error. A partial resolution followed by a scaffold produces a worse end state than either doing nothing or completing the resolution cleanly.
|
|
342
|
+
|
|
343
|
+
### Step 3: Scaffold Runner
|
|
344
|
+
|
|
345
|
+
Invoke `oat docs init` with the collected inputs and then apply labeled post-patches for any CLI gaps the Capability Detection sub-procedure reports as still-open. The Scaffold Runner has four phases: **CLI invocation** (authored here), **Capability Detection** (p03-t02), **site-identity patches** (p03-t03), and **scaffold-integrity patches** (p03-t04).
|
|
346
|
+
|
|
347
|
+
Print `[3/7] Scaffolding…` at the start of this step.
|
|
348
|
+
|
|
349
|
+
**Precondition:** The Conflict Resolution Contract's "Allowed mutations" have completed and the working-tree state matches what the CLI expects (Step 2's pre-scaffold invariant). If any resolution-triggered mutation is still pending, **do not invoke the CLI** — stop the flow and surface the missing state.
|
|
350
|
+
|
|
351
|
+
**3a. Assemble CLI flags.**
|
|
352
|
+
|
|
353
|
+
Build the flag list deterministically from the Input Result (Step 2e) and the Capability Detection result (Step 3b). Non-interactive mode is mandatory — the skill owns the interactive flow; the CLI runs headless.
|
|
354
|
+
|
|
355
|
+
Base flags (always passed):
|
|
356
|
+
|
|
357
|
+
- `--yes` — non-interactive
|
|
358
|
+
- `--framework {framework}` — from Input Result
|
|
359
|
+
- `--name {appName}` — from Input Result
|
|
360
|
+
- `--target-dir {targetDir}` — from Input Result
|
|
361
|
+
- `--description {siteDescription}` — from Input Result (pass empty string if user left blank)
|
|
362
|
+
- `--lint {lint}` — from Input Result
|
|
363
|
+
- `--format {format}` — from Input Result
|
|
364
|
+
|
|
365
|
+
Capability-gated flags (added only when the Capability Probe reports support):
|
|
366
|
+
|
|
367
|
+
- `--site-name {siteName}` — only if `capabilities.siteNameFlag === true` (FP-12 upstream fix landed). If `false`, **do not pass it**, and queue the FP-12 post-patch instead (applied in p03-t03).
|
|
368
|
+
|
|
369
|
+
Do not pass flags the CLI doesn't advertise. Never assume a flag exists because the skill wants it — the Capability Probe is the source of truth for what's safe to pass.
|
|
370
|
+
|
|
371
|
+
**3b. Run Capability Detection.**
|
|
372
|
+
|
|
373
|
+
Before CLI invocation, probe the installed CLI to discover which FP-11 / FP-12 / FP-13 / FP-15 / FP-16 / FP-17 gaps it has already closed. Post-patches must never run blindly — they must be gated on both a CLI-level capability probe **and** a file-shape check on the specific target file. This self-ratcheting keeps the skill correct as CLI fixes land upstream.
|
|
374
|
+
|
|
375
|
+
**CLI help probe.** Run `$CLI_CMD docs init --help` exactly once, capture stdout, and grep the flag list for known markers. Record boolean capability flags on the `capabilities` object:
|
|
376
|
+
|
|
377
|
+
- `siteNameFlag` — `true` if `--site-name` (or equivalent alias like `--title`) appears in the help output. Implies FP-12 upstream fix has landed.
|
|
378
|
+
- `turbopackRootFlag` — `true` if a flag for forwarding a Turbopack root (or a `--framework-config` passthrough that accepts `turbopack.root`) appears. Implies FP-11 fix has landed in some form.
|
|
379
|
+
- `agentsMdScaffoldFlag` — `true` if the help output mentions `AGENTS.md` scaffolding or the CLI's scaffold template list includes `AGENTS.md`. Implies FP-15 fix has landed.
|
|
380
|
+
|
|
381
|
+
For FP-16, there is no CLI-level help-probe marker; the capability is detected purely by file-shape check on the scaffolded `docs/index.md` (see below). When the CLI scaffold template is fixed upstream, the file-shape check will classify as `patched-shape` and the FP-16 patch will skip automatically.
|
|
382
|
+
|
|
383
|
+
If the `--help` invocation fails (non-zero exit or empty stdout), treat all capabilities as `false` and record a warning in `Scaffold Result.cliLogs.stderr` — do not guess. Assuming a capability that doesn't exist leads to a broken scaffold; assuming absence just means an extra post-patch runs unnecessarily.
|
|
384
|
+
|
|
385
|
+
**File-shape checks per patch target.** After the CLI writes the scaffold (3c completes), but before 3d applies any patch, read the target file and classify it as one of three states: `scaffold-shape` (unmodified CLI output, patch is safe), `patched-shape` (already patched by a previous skill run, patch is a no-op), or `drift` (neither — the file has been hand-edited or third-party-modified).
|
|
386
|
+
|
|
387
|
+
For each patch, the classification rule is:
|
|
388
|
+
|
|
389
|
+
- **FP-12 targets** — the patch sets display-title references in four files:
|
|
390
|
+
- `<appRoot>/app/layout.tsx` (Fumadocs only): scaffold shape has `DocsLayout` with `branding: { title: '{appName}' }` (the CLI writes the package name); patched shape has `branding: { title: '{siteName}' }` surrounded by `<!-- FP-12 patch -->` markers.
|
|
391
|
+
- `<appRoot>/docs/index.md`: scaffold shape has frontmatter `title: '{appName}'` and `# {appName}` H1; patched shape substitutes `{siteName}` in both positions.
|
|
392
|
+
- `<appRoot>/docs/getting-started.md`: scaffold shape has a body reference to `{appName}`; patched shape uses `{siteName}`.
|
|
393
|
+
- `<appRoot>/docs/contributing.md`: scaffold shape has `# {appName}` H1; patched shape uses `{siteName}`.
|
|
394
|
+
- Classification: if the marker string (`appName` where expected in scaffold shape, `siteName` where expected in patched shape) matches exactly, the file is in that shape. If neither pattern matches (e.g., the user already renamed things manually), classify as `drift`.
|
|
395
|
+
- **FP-11 target** — `<appRoot>/next.config.js` (Fumadocs, nested-standalone only):
|
|
396
|
+
- Scaffold shape: single-line `export default createDocsConfig()` or near-equivalent with no `turbopack` option.
|
|
397
|
+
- Patched shape (via passthrough): `createDocsConfig({ turbopack: { root: __dirname } })` plus `<!-- FP-11 patch -->` marker comment.
|
|
398
|
+
- Patched shape (via wrapper replacement): explicit `createMDX()` + hand-written config with `turbopack: { root: __dirname }` and the `<!-- FP-11 patch -->` marker.
|
|
399
|
+
- Classification: pattern-match on the wrapper call or the `createMDX()` import; any other shape is `drift`.
|
|
400
|
+
- **FP-13 targets** — the five sub-findings (empty descriptions, bare commands, false lint claim, generated-file warning, Node version mismatch) each target a specific line or section (see design.md). Scaffold shape for each is "unchanged CLI scaffold output"; patched shape has the `<!-- FP-13 patch -->` marker comment adjacent to the rewrite. Sub-finding E (Node version) additionally reads `.nvmrc` / `package.json` `engines.node` at scaffold time to determine the correct version to write.
|
|
401
|
+
- **FP-16 target** — `<appRoot>/docs/index.md` `## Contents` section (Fumadocs only):
|
|
402
|
+
- Scaffold shape: `## Contents` list items have extension-less link targets, e.g. `- [Getting Started](getting-started) - ...`. Detect by regex-matching bulleted list items where the link target is a slug (no file extension, no trailing slash) that corresponds to a real `.md` file in the same directory (or an `index.md` inside a matching subdirectory).
|
|
403
|
+
- Patched shape: `## Contents` list items have `.md`-suffixed link targets (e.g. `- [Getting Started](getting-started.md) - ...`) with a `<!-- FP-16 patch -->` / `<!-- /FP-16 patch -->` marker wrapping the whole `## Contents` block.
|
|
404
|
+
- Drift: neither scaffold nor patched shape — likely user-edited with mixed or inconsistent extensions. Record as `refused` with a suggested manual fix ("normalize all `## Contents` links to `.md`-suffixed form so the `docs-transforms` remark-links plugin handles routing").
|
|
405
|
+
- **FP-17 target** — `<appRoot>/docs/contributing.md` `## Agent guidance` section (Fumadocs only):
|
|
406
|
+
- Scaffold shape: the section contains a short bulleted list of generic agent advice (typically two bullets: treating `index.md` as truth, preferring links to source files). Detect by matching the `## Agent guidance` heading followed by a small bulleted list.
|
|
407
|
+
- Patched shape: the section contains a one-paragraph pointer to the docs-app `AGENTS.md`, wrapped in `<!-- FP-17 patch: three-surfaces cleanup -->` / `<!-- /FP-17 patch -->` markers.
|
|
408
|
+
- Drift: user-edited with content beyond the scaffold bullets (paragraphs, custom agent rules, links to other files). Classify as `refused` — do not collapse user-authored content; instead suggest the user move custom guidance into `<appRoot>/AGENTS.md` and trim `contributing.md` to the pointer form manually.
|
|
409
|
+
- **FP-15 target** — `<appRoot>/AGENTS.md`:
|
|
410
|
+
- Scaffold shape: file **does not exist** (current CLI doesn't scaffold it).
|
|
411
|
+
- Patched shape: file exists and begins with `# AGENTS —` (the template's H1 form).
|
|
412
|
+
- Any other state (file exists but has a different H1, file was hand-written) classifies as `drift`.
|
|
413
|
+
|
|
414
|
+
**Refuse-and-surface contract.** If any target classifies as `drift`, the associated patch **does not run**. Instead, record an entry in `Scaffold Result.patchesApplied` with `status: 'refused'`, the target path, the observed shape snippet, and a suggested manual fix for the user. Example:
|
|
415
|
+
|
|
416
|
+
```
|
|
417
|
+
patchesApplied:
|
|
418
|
+
- id: FP-12/layout.tsx
|
|
419
|
+
status: refused
|
|
420
|
+
target: /abs/path/apps/docs/app/layout.tsx
|
|
421
|
+
reason: drift — expected `branding: { title: 'docs' }` (scaffold) or patched-shape marker; found neither
|
|
422
|
+
suggestedFix: manually set `DocsLayout.branding.title` to {siteName} and ensure `export const metadata = { title, description }` is present
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
Continue with remaining patches; one `refused` entry does not stop the flow. The Post-Scaffold Inspector (Step 5) surfaces the refused list to the user so they can address it manually.
|
|
426
|
+
|
|
427
|
+
**Probe ordering.**
|
|
428
|
+
|
|
429
|
+
- The CLI help probe runs **before** `oat docs init` (3c) so its result can feed flag assembly (3a).
|
|
430
|
+
- The file-shape checks run **after** `oat docs init` (3c) so they operate on the actual scaffold output.
|
|
431
|
+
- The post-patch sub-procedures (3d, site-identity and scaffold-integrity) read the combined `capabilities` record and target classifications to decide whether to apply each patch.
|
|
432
|
+
|
|
433
|
+
**3c. Invoke the CLI.**
|
|
434
|
+
|
|
435
|
+
Execute `oat docs init` as a non-interactive child process. Use `$CLI_CMD` resolved in Step 0 (`oat` or `pnpm run cli --`):
|
|
436
|
+
|
|
437
|
+
```bash
|
|
438
|
+
$CLI_CMD docs init {flags...}
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
Capture both stdout and stderr. **Do not** stream output directly to the user; the Educational Walkthrough (Step 6) references specific CLI log lines, so the skill needs the captured text.
|
|
442
|
+
|
|
443
|
+
**On non-zero exit:**
|
|
444
|
+
|
|
445
|
+
- Surface the CLI's stderr **verbatim** to the user (no re-wording — the user needs to see exactly what the CLI said).
|
|
446
|
+
- Print the exit code and the exact flag list that was passed.
|
|
447
|
+
- **Stop the flow.** Do not apply any post-patches. Do not proceed to Build Verifier. A failed scaffold produces an undefined state; guessing at recovery is worse than letting the user diagnose.
|
|
448
|
+
- Example surfaced error:
|
|
449
|
+
|
|
450
|
+
```
|
|
451
|
+
oat docs init exited with code 2.
|
|
452
|
+
|
|
453
|
+
Flags passed:
|
|
454
|
+
--yes --framework fumadocs --name docs --target-dir docs
|
|
455
|
+
--description "" --lint none --format oxfmt
|
|
456
|
+
|
|
457
|
+
CLI stderr:
|
|
458
|
+
{ verbatim CLI stderr }
|
|
459
|
+
|
|
460
|
+
Docs bootstrap stopped. Resolve the CLI error and re-run this skill.
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
**On zero exit:**
|
|
464
|
+
|
|
465
|
+
- Read back `$REPO_ROOT/.oat/config.json` to resolve `appRoot` from the newly written `documentation.root` entry. This is authoritative; do not infer from `targetDir` alone.
|
|
466
|
+
- Enumerate files under `appRoot` that did not exist before 3c (the Preflight Result's read-only snapshot provides the "before" set). Record as `createdFiles[]`.
|
|
467
|
+
- Emit the Scaffold Result for downstream sub-procedures:
|
|
468
|
+
|
|
469
|
+
```
|
|
470
|
+
Scaffold Result:
|
|
471
|
+
scaffoldSucceeded: true
|
|
472
|
+
appRoot: absolute-path-string
|
|
473
|
+
createdFiles: string[] // paths relative to appRoot
|
|
474
|
+
capabilities: { siteNameFlag: boolean, ... } // from Capability Detection (3b)
|
|
475
|
+
cliLogs: { stdout: string, stderr: string } // retained for Walkthrough
|
|
476
|
+
patchesApplied: [] // populated by 3c/3d site-identity + scaffold-integrity sub-procedures
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
The Walkthrough (Step 6) and Post-Scaffold Inspector (Step 5) both consume `Scaffold Result`; keep it structured and avoid shell-side ephemeral state.
|
|
480
|
+
|
|
481
|
+
**3d. Apply post-patches.**
|
|
482
|
+
|
|
483
|
+
Each patch:
|
|
484
|
+
|
|
485
|
+
- Reads the relevant capability flag from `Scaffold Result.capabilities` and the file-shape detection from Capability Detection (3b).
|
|
486
|
+
- Runs only if the capability is **absent** (the CLI didn't already address the gap) AND the file-shape check passes.
|
|
487
|
+
- Is **labeled** with a comment marker (e.g., `<!-- FP-12 patch -->`) so it can be found and removed deterministically when the CLI fix lands upstream.
|
|
488
|
+
- Is **idempotent** — running the patch twice is a no-op.
|
|
489
|
+
- Appends an entry to `Scaffold Result.patchesApplied` with `{ id, status: 'applied' | 'skipped' | 'refused', reason? }`.
|
|
490
|
+
|
|
491
|
+
##### Site-identity patches (FP-12 + FP-15)
|
|
492
|
+
|
|
493
|
+
These patches close the "site name + AGENTS.md" gaps. They run after `oat docs init` (3c) and before scaffold-integrity patches (see 3d ordering note below). Site-identity must run before scaffold-integrity because the FP-13 sub-findings may reference `{siteName}` strings that FP-12 has just written.
|
|
494
|
+
|
|
495
|
+
**FP-12: title patches.**
|
|
496
|
+
|
|
497
|
+
Gate: run **only if** `capabilities.siteNameFlag === false`. If the CLI wrote the site title itself, skip the entire FP-12 group and record `{ id: 'FP-12', status: 'skipped', reason: 'CLI --site-name flag supported' }`.
|
|
498
|
+
|
|
499
|
+
Per-file edits (Fumadocs only — MkDocs has no `layout.tsx`; its title handling is covered by the MkDocs Minimum Contract in Step 6). **Critical ordering: insert the `layout.tsx` metadata export first — it's the load-bearing change for HTML `<head>` (page title, meta description, Open Graph). Everything else below is display-title coherence.**
|
|
500
|
+
|
|
501
|
+
- **`<appRoot>/app/layout.tsx` — `export const metadata`.** This is the most important FP-12 edit: without it, the exported HTML has no `<title>`, no meta description, and no Open Graph tags. `DocsLayout`'s `branding.title` prop does **not** populate page metadata — it only renders nav chrome. `@open-agent-toolkit/docs-config`'s `createDocsConfig()` also does **not** accept or forward title/description — passing them there is a no-op (verified in the docs-config source: it reads `basePath` and ignores everything else). Next.js metadata must come from a module-scope `export const metadata`.
|
|
502
|
+
|
|
503
|
+
If no `export const metadata` exists in the file, insert it after the imports:
|
|
504
|
+
|
|
505
|
+
```tsx
|
|
506
|
+
/* FP-12 patch: site metadata */
|
|
507
|
+
export const metadata = {
|
|
508
|
+
title: '{siteName} Documentation',
|
|
509
|
+
description: '{siteDescription}',
|
|
510
|
+
};
|
|
511
|
+
/* /FP-12 patch */
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
(Use JS comment markers here — TSX does not allow HTML comments at module scope.) Idempotency: if `export const metadata` already exists anywhere in the file, skip; do not merge or replace user-authored metadata.
|
|
515
|
+
|
|
516
|
+
**Anti-patterns — do not do any of these (they look like they should work, they don't):**
|
|
517
|
+
- Passing `title` / `description` to `createDocsConfig()` in `next.config.js`. The wrapper ignores those keys; the exported HTML stays empty. Verify any `next.config.js` patch you consider against `@open-agent-toolkit/docs-config`'s actual exports.
|
|
518
|
+
- Setting `branding.title` alone and calling it done. `branding` populates nav chrome only; browser tab, search previews, and social cards all read `metadata`.
|
|
519
|
+
- Inserting `metadata` into a non-layout file (e.g., `page.tsx` under `[[...slug]]`). For site-wide metadata, `layout.tsx` is the authoritative location.
|
|
520
|
+
|
|
521
|
+
- **`<appRoot>/app/layout.tsx` — `branding.title`.** Scaffold shape has `branding: { title: '{appName}' }`. Replace the literal string value with `{siteName}` (the user-supplied display title) wrapped in FP-12 markers:
|
|
522
|
+
|
|
523
|
+
```tsx
|
|
524
|
+
<!-- FP-12 patch: branding title -->
|
|
525
|
+
branding={{ title: '{siteName}' }}
|
|
526
|
+
<!-- /FP-12 patch -->
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
Idempotency: if the marker `<!-- FP-12 patch: branding title -->` is already present, skip and record `status: 'skipped'`. This is the nav-chrome display title — a separate concern from the metadata export above.
|
|
530
|
+
|
|
531
|
+
- **`<appRoot>/docs/index.md`.** Two edits:
|
|
532
|
+
1. Frontmatter `title: '{appName}'` → `title: '{siteName}'`.
|
|
533
|
+
2. First H1 `# {appName}` → `# {siteName}`.
|
|
534
|
+
Wrap each edit with HTML-comment markers (`<!-- FP-12 patch: index title -->` / `<!-- /FP-12 patch -->` around the frontmatter line; same pattern around the H1 line). Idempotency: marker absence = scaffold shape, safe to patch; marker present = already patched, skip.
|
|
535
|
+
|
|
536
|
+
- **`<appRoot>/docs/getting-started.md`.** Body contains references to `{appName}` in the intro paragraph (per the scaffold template). Replace those references with `{siteName}`, wrapped in an HTML-comment marker on the first occurrence. Idempotency: marker absence = patch; marker present = skip.
|
|
537
|
+
|
|
538
|
+
- **`<appRoot>/docs/contributing.md`.** H1 `# {appName}` → `# {siteName}`, same marker pattern as `index.md`'s H1.
|
|
539
|
+
|
|
540
|
+
Failure handling: if Capability Detection (3b) classified any of these files as `drift`, the patch is already recorded as `refused` in `Scaffold Result.patchesApplied` — skip and move on. Do not re-check drift here.
|
|
541
|
+
|
|
542
|
+
**FP-15: AGENTS.md write-if-missing.**
|
|
543
|
+
|
|
544
|
+
Gate: run **only if** `capabilities.agentsMdScaffoldFlag === false` AND `<appRoot>/AGENTS.md` does not exist on disk.
|
|
545
|
+
|
|
546
|
+
- If the CLI scaffolded `AGENTS.md` itself, skip with `status: 'skipped', reason: 'CLI scaffolds AGENTS.md'`.
|
|
547
|
+
- If the file already exists (user hand-authored, or a previous skill run wrote it), **never overwrite**. Skip with `status: 'skipped', reason: 'AGENTS.md already present — not overwriting'`.
|
|
548
|
+
|
|
549
|
+
Procedure when gate passes:
|
|
550
|
+
|
|
551
|
+
1. Read the template from `.agents/skills/oat-docs-bootstrap/assets/AGENTS.md.template`.
|
|
552
|
+
2. Substitute placeholders:
|
|
553
|
+
- `{{SITE_NAME}}` → `{siteName}` (Input Result)
|
|
554
|
+
- `{{APP_DIR}}` → `{targetDir}` (Input Result; the scaffolded app path relative to repo root)
|
|
555
|
+
- `{{REPO_NAME}}` → `{repoName}` (Preflight Result)
|
|
556
|
+
- `{{GENERATE_INDEX_CMD}}` → rendered per repo shape:
|
|
557
|
+
- `monorepo`: `pnpm --filter {appName} run docs:generate-index` (if the scaffold exposes that script) or the equivalent `pnpm -w run cli -- docs generate-index --docs-dir {appDir}/docs --output {appDir}/index.md`
|
|
558
|
+
- `nested-standalone`: `(cd {appDir} && pnpm run docs:generate-index)` or the `-w` equivalent
|
|
559
|
+
- `single-package`: `pnpm run docs:generate-index`
|
|
560
|
+
- Fall back to the `pnpm -w run cli -- docs generate-index ...` form if the scaffold did not write a `docs:generate-index` script (determined by grepping `<appRoot>/package.json` after scaffold).
|
|
561
|
+
3. Write the rendered content to `<appRoot>/AGENTS.md`.
|
|
562
|
+
4. Wrap the entire file in an HTML comment banner at the top — not for idempotency (file existence is the idempotency check), but so the user knows this file was written by the skill and can be regenerated: `<!-- Generated by oat-docs-bootstrap (FP-15 bridge). Safe to hand-edit after generation. -->`.
|
|
563
|
+
5. Record `{ id: 'FP-15', status: 'applied', target: '<appRoot>/AGENTS.md' }` in `patchesApplied`.
|
|
564
|
+
|
|
565
|
+
When the CLI eventually scaffolds `AGENTS.md` natively and `agentsMdScaffoldFlag` becomes `true`, the bridge template in this skill can be retired (or folded back into the skill as a reference for how the CLI's template evolved).
|
|
566
|
+
|
|
567
|
+
##### Scaffold-integrity patches (FP-11 + FP-13 + FP-16 + FP-17)
|
|
568
|
+
|
|
569
|
+
These patches close the "scaffold works but produces inaccurate or incomplete output" gaps. They run after the site-identity patches so FP-13 sub-findings operate on the correct `{siteName}` text.
|
|
570
|
+
|
|
571
|
+
**FP-11: Turbopack root patch.**
|
|
572
|
+
|
|
573
|
+
Gate: run **only if** `repoShape === 'nested-standalone'` AND `framework === 'fumadocs'` AND `capabilities.turbopackRootFlag === false`. Monorepo and single-package shapes do not hit the multi-lockfile warning; MkDocs has no Turbopack concern. If any gate is unmet, record `{ id: 'FP-11', status: 'skipped', reason: '<gate that failed>' }`.
|
|
574
|
+
|
|
575
|
+
Two code paths, selected by the file-shape classification of `<appRoot>/next.config.js` from Capability Detection (3b):
|
|
576
|
+
|
|
577
|
+
- **Path A — `createDocsConfig` passthrough.** If `<appRoot>/next.config.js` is in scaffold shape using `createDocsConfig()` AND `@open-agent-toolkit/docs-config` exposes a `turbopack` passthrough option (determined by reading the installed package's type declarations or `package.json` exports), pass `{ root: __dirname }` through:
|
|
578
|
+
|
|
579
|
+
```js
|
|
580
|
+
// <!-- FP-11 patch: turbopack root passthrough -->
|
|
581
|
+
export default createDocsConfig({
|
|
582
|
+
turbopack: { root: __dirname },
|
|
583
|
+
});
|
|
584
|
+
// <!-- /FP-11 patch -->
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
Idempotency: if the marker is already present, skip with `status: 'skipped'`.
|
|
588
|
+
|
|
589
|
+
- **Path B — wrapper replacement.** If the passthrough isn't supported (the `@open-agent-toolkit/docs-config` version installed is older than the one that added it), replace the `createDocsConfig()` wrapper with an explicit `createMDX()` + hand-written Next config. Preserve any user-authored edits the wrapper had accumulated (by diffing against the known scaffold shape before replacing):
|
|
590
|
+
|
|
591
|
+
```js
|
|
592
|
+
// <!-- FP-11 patch: wrapper replaced for turbopack root -->
|
|
593
|
+
import createMDX from 'fumadocs-mdx/next';
|
|
594
|
+
|
|
595
|
+
const withMDX = createMDX();
|
|
596
|
+
|
|
597
|
+
/** @type {import('next').NextConfig} */
|
|
598
|
+
const config = {
|
|
599
|
+
reactStrictMode: true,
|
|
600
|
+
turbopack: { root: __dirname },
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
export default withMDX(config);
|
|
604
|
+
// <!-- /FP-11 patch -->
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
Before replacing, snapshot the original `next.config.js` to `next.config.js.pre-fp11.bak` in the same directory so the user can inspect the prior state. Record the backup path in `patchesApplied` so the Walkthrough can mention it.
|
|
608
|
+
|
|
609
|
+
Idempotency: if the marker is present, skip; if the wrapper replacement has already happened but without the marker (indicating a user-customized variant), classify as `drift` and refuse.
|
|
610
|
+
|
|
611
|
+
**FP-13: template-content patches.**
|
|
612
|
+
|
|
613
|
+
Four sub-findings, each with its own gate, target, and idempotency check. All sub-findings apply to Fumadocs; MkDocs handling lives in the Walkthrough's MkDocs Minimum Contract (Step 6, p05-t02) because the MkDocs scaffold's content layout differs and doesn't share these specific gaps.
|
|
614
|
+
|
|
615
|
+
- **Sub-finding A: Empty `description:` frontmatter.** Targets: `<appRoot>/docs/getting-started.md:3` and `<appRoot>/docs/contributing.md:3`.
|
|
616
|
+
- Gate: the target line matches `description: ''` (scaffold shape).
|
|
617
|
+
- Patch: replace with static defaults:
|
|
618
|
+
- `getting-started.md`: `description: 'Set up the local environment and preview the docs site.'`
|
|
619
|
+
- `contributing.md`: `description: 'Authoring conventions and navigation rules for this docs site.'`
|
|
620
|
+
- Wrap each edit with `<!-- FP-13 patch: description-A -->` / `<!-- /FP-13 patch -->` on the line above.
|
|
621
|
+
- Idempotency: marker present = skip.
|
|
622
|
+
- Rationale: these are per-page descriptions, not site-level — do not template on `{siteDescription}`; use static text that describes the page's own purpose.
|
|
623
|
+
|
|
624
|
+
- **Sub-finding B: Bare install/build commands lack working-directory context.** Target: `<appRoot>/docs/getting-started.md` (the install/build code block, per scaffold lines 15-33 or nearest equivalent after FP-12 patches).
|
|
625
|
+
- Gate: the block contains a bare `pnpm install` / `pnpm dev` / `pnpm build` sequence with no `--filter` or `cd` prefix (scaffold shape).
|
|
626
|
+
- Patch: rewrite the block per `repoShape`:
|
|
627
|
+
- `monorepo`: prefix each command with `pnpm --filter {appName}` (e.g., `pnpm --filter {appName} install`, `... dev`, `... build`).
|
|
628
|
+
- `nested-standalone`: prefix each command with `cd {appDir} && ` (e.g., `cd apps/docs && pnpm install`).
|
|
629
|
+
- `single-package`: leave bare form — it works correctly from repo root.
|
|
630
|
+
- Wrap the entire rewritten block with `<!-- FP-13 patch: commands-B -->` / `<!-- /FP-13 patch -->`.
|
|
631
|
+
- Idempotency: marker present = skip. If the block has drifted (not bare, not already patched), classify as `drift` and refuse.
|
|
632
|
+
|
|
633
|
+
- **Sub-finding C: False `docs:lint` claim.** Target: `<appRoot>/docs/contributing.md` line describing the `docs:lint` script (near line 31 per scaffold, may have shifted).
|
|
634
|
+
- Gate: `lint === 'none'` (Input Result) AND the line contains the exact scaffold string "Run Markdown formatting and linting as configured for this docs app."
|
|
635
|
+
- Patch: replace with "Run Markdown formatting as configured for this docs app." (dropping "and linting").
|
|
636
|
+
- If `lint === 'markdownlint-cli2'`, the original claim is accurate — skip with `status: 'skipped', reason: 'linting is configured'`.
|
|
637
|
+
- Wrap with `<!-- FP-13 patch: lint-claim-C -->` / `<!-- /FP-13 patch -->`.
|
|
638
|
+
- Idempotency: marker present = skip.
|
|
639
|
+
|
|
640
|
+
- **Sub-finding D: Generated `index.md` lacks "do not hand-edit" warning.** Two sub-targets:
|
|
641
|
+
- **D.1 — `contributing.md` explanatory section.** Append a "Generated files" section to `<appRoot>/docs/contributing.md` (before any closing References section if present). Two sentences:
|
|
642
|
+
|
|
643
|
+
```markdown
|
|
644
|
+
<!-- FP-13 patch: generated-files-D -->
|
|
645
|
+
|
|
646
|
+
## Generated files
|
|
647
|
+
|
|
648
|
+
The root-level `index.md` at `<appRoot>/index.md` is regenerated from `docs/index.md` and its `## Contents` sections on every `predev` / `prebuild`. Do not hand-edit it; edit the authored source under `docs/` instead.
|
|
649
|
+
|
|
650
|
+
<!-- /FP-13 patch -->
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
Idempotency: marker present = skip.
|
|
654
|
+
|
|
655
|
+
- **D.2 — Generated `index.md` header comment.** The header to prepend:
|
|
656
|
+
|
|
657
|
+
```markdown
|
|
658
|
+
<!-- generated by oat docs generate-index; do not hand-edit. Source: docs/index.md -->
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
**Two-pass strategy. Both passes MUST run — do not treat the second as optional.**
|
|
662
|
+
|
|
663
|
+
**Pass 1 (best-effort, at scaffold time).** If `<appRoot>/index.md` exists after the CLI's `init` completes, prepend the header directly. Record `{ id: 'FP-13/D.2', status: 'applied', pass: 'scaffold-time' }`. If the file does not yet exist, also add a one-time hook: modify `<appRoot>/package.json` to wrap `prebuild`/`predev` so that the generated `index.md` is prefixed with the header on first run. Hook marker: `<!-- FP-13 patch: generated-header-D2 -->`.
|
|
664
|
+
|
|
665
|
+
**Pass 2 (correctness backstop, after Build Verifier).** After the Build Verifier (Step 4) completes install + build, the `prebuild`/`predev` script should have run and `<appRoot>/index.md` should now exist with the header. Verify:
|
|
666
|
+
- If `<appRoot>/index.md` exists AND starts with the header → no action; record `{ id: 'FP-13/D.2', status: 'already-present', pass: 'post-build-verify' }`.
|
|
667
|
+
- If `<appRoot>/index.md` exists AND does NOT start with the header → **prepend it directly** (the hook did not fire, or was skipped). Record `{ id: 'FP-13/D.2', status: 'applied-directly', pass: 'post-build-verify' }`.
|
|
668
|
+
- If `<appRoot>/index.md` still does not exist → the build did not run generate-index. This is a deeper scaffold issue — surface as a refused patch with `reason: 'generated index.md not present after build; check prebuild script'` and let the user investigate.
|
|
669
|
+
|
|
670
|
+
The direct-write pass is the correctness backstop. The hook alone is not reliable enough (some users run `pnpm dev` before touching anything else; the hook might be skipped if another prebuild step short-circuits; the hook modification may conflict with user-customized package.json scripts).
|
|
671
|
+
|
|
672
|
+
- **E — Node version mismatch.** Target: `<appRoot>/docs/getting-started.md` "Prerequisites" section. The scaffold's `- Node.js 20+` claim (or any hard-coded major version) should reflect the **consuming repo's** actual Node requirement, not a scaffold-time default.
|
|
673
|
+
- Gate: always run when `<appRoot>/docs/getting-started.md` exists and has a `- Node.js` bullet in a "Prerequisites" section.
|
|
674
|
+
- Read (in priority order) `$REPO_ROOT/.nvmrc`, then `$REPO_ROOT/package.json` `engines.node`. If a version is found and it's different from the hard-coded version in the scaffold, rewrite the bullet to reference the detected version.
|
|
675
|
+
- Wrap the rewritten line with `<!-- FP-13 patch: node-version-E -->` / `<!-- /FP-13 patch -->`.
|
|
676
|
+
- If neither source is present or parseable, leave the scaffold default and record `{ id: 'FP-13/E', status: 'skipped', reason: 'no .nvmrc or engines.node to detect' }`.
|
|
677
|
+
- Idempotency: marker present = skip.
|
|
678
|
+
|
|
679
|
+
**FP-16: `## Contents` link-extension patch.**
|
|
680
|
+
|
|
681
|
+
Gate: run **only if** `framework === 'fumadocs'` AND the Capability Detection file-shape check classified `<appRoot>/docs/index.md` as `scaffold-shape` for FP-16 (extension-less `## Contents` links on real `.md` targets). If the scaffold has been fixed upstream and the file is already `patched-shape` (links are `.md`-suffixed), skip with `status: 'skipped', reason: 'CLI scaffold uses .md-suffixed links'`.
|
|
682
|
+
|
|
683
|
+
Target: `<appRoot>/docs/index.md` `## Contents` section. For each list item whose link target is extension-less:
|
|
684
|
+
|
|
685
|
+
- If the target corresponds to a sibling `.md` file (e.g., `getting-started` → `getting-started.md`), rewrite to append `.md`.
|
|
686
|
+
- If the target corresponds to a sibling subdirectory with an `index.md` (e.g., `reference` → `reference/`, with `reference/index.md`), rewrite to `reference/index.md`.
|
|
687
|
+
- Leave absolute URLs, anchors (`#section`), and already-suffixed links untouched.
|
|
688
|
+
|
|
689
|
+
Wrap the rewritten `## Contents` block with markers:
|
|
690
|
+
|
|
691
|
+
```markdown
|
|
692
|
+
<!-- FP-16 patch: .md-suffixed ## Contents -->
|
|
693
|
+
|
|
694
|
+
## Contents
|
|
695
|
+
|
|
696
|
+
- [Getting Started](getting-started.md) - Set up the local docs toolchain and preview the site.
|
|
697
|
+
- [Contributing](contributing.md) - Authoring conventions and navigation rules.
|
|
698
|
+
|
|
699
|
+
<!-- /FP-16 patch -->
|
|
700
|
+
```
|
|
701
|
+
|
|
702
|
+
Idempotency: if the marker `<!-- FP-16 patch: .md-suffixed ## Contents -->` is already present, skip with `status: 'skipped'`. If the `## Contents` section has drifted (mixed extensions, non-bulleted structure, extra prose between items), classify as `drift` per Capability Detection and record `refused` — do not attempt a partial rewrite.
|
|
703
|
+
|
|
704
|
+
**Rationale.** The `@open-agent-toolkit/docs-transforms` remark-links plugin strips `.md` / `dir/index.md` at build time for Fumadocs routing, so `.md`-suffixed authored links render correctly. `.md`-suffixed form is what `apps/oat-docs` uses in practice and is what agents can follow via direct file open without path inference. Extension-less links are the scaffold's historical form but are agent-hostile; FP-16 normalizes to the correct convention. When the CLI scaffold template is fixed upstream, the file-shape check will skip this patch automatically.
|
|
705
|
+
|
|
706
|
+
**FP-17: `contributing.md` three-surfaces cleanup.**
|
|
707
|
+
|
|
708
|
+
Gate: run **only if** `framework === 'fumadocs'` AND `<appRoot>/docs/contributing.md` exists AND contains a `## Agent guidance` section with scaffold-shape bullet content (short list of "treat index.md as truth", "prefer linking to source files", or similar).
|
|
709
|
+
|
|
710
|
+
Target: the `## Agent guidance` section in `<appRoot>/docs/contributing.md`. This section duplicates the role of the docs-app `AGENTS.md` (FP-15 bridge) and violates the three-surfaces discipline the Walkthrough Section D teaches:
|
|
711
|
+
|
|
712
|
+
- `docs/contributing.md` → human authoring conventions (Markdown features, frontmatter, linting).
|
|
713
|
+
- `<appRoot>/AGENTS.md` → agent runtime reference (how to add pages, restructure nav, audit/apply).
|
|
714
|
+
- Root `AGENTS.md` `## Documentation` section → repo-wide pointer.
|
|
715
|
+
|
|
716
|
+
Patch: replace the section body with a one-line pointer and marker:
|
|
717
|
+
|
|
718
|
+
```markdown
|
|
719
|
+
<!-- FP-17 patch: three-surfaces cleanup -->
|
|
720
|
+
|
|
721
|
+
## Agent guidance
|
|
722
|
+
|
|
723
|
+
See `AGENTS.md` in this directory for how agents should work inside this docs app. This `contributing.md` covers human authoring conventions; `AGENTS.md` covers agent runtime discipline (adding pages, restructuring nav, audit/apply, three agent-instruction surfaces). Keeping those concerns separate keeps each file useful to its audience.
|
|
724
|
+
|
|
725
|
+
<!-- /FP-17 patch -->
|
|
726
|
+
```
|
|
727
|
+
|
|
728
|
+
Idempotency: if the marker `<!-- FP-17 patch: three-surfaces cleanup -->` is already present, skip with `status: 'skipped'`. If the `## Agent guidance` section has been edited beyond scaffold shape (more than the two or three default bullets; contains content that isn't "docs conventions already in AGENTS.md"), classify as `drift` and refuse — do not collapse user-authored content.
|
|
729
|
+
|
|
730
|
+
**Rationale.** Without this patch, agents reading `docs/contributing.md` find partial agent guidance that duplicates (and risks diverging from) the docs-app `AGENTS.md`. The three-surfaces model only works if each surface is the single-source-of-truth for its audience.
|
|
731
|
+
|
|
732
|
+
**Refuse-and-surface.** Every patch above respects the drift classification from Capability Detection. If a target was classified `drift`, the patch was already recorded as `refused` in 3b — skip here and do not re-check.
|
|
733
|
+
|
|
734
|
+
##### Post-patch ordering
|
|
735
|
+
|
|
736
|
+
Inside 3d, patches run in this order:
|
|
737
|
+
|
|
738
|
+
1. Site-identity patches (this section) — FP-12 before FP-15 is irrelevant; they target disjoint files.
|
|
739
|
+
2. Scaffold-integrity patches (p03-t04) — these run after site-identity because FP-13 sub-findings may reference strings FP-12 just rewrote.
|
|
740
|
+
|
|
741
|
+
**Design discipline:**
|
|
742
|
+
|
|
743
|
+
- **CLI is the source of truth for templates.** The Scaffold Runner never rewrites template content, re-renders frontmatter, or fabricates files the CLI was supposed to create. Post-patches only adjust specific known-gap locations, and every patch is labeled.
|
|
744
|
+
- **Capability Detection gates every patch.** No patch runs blindly; the file-shape check must pass, and the capability must be absent. This means the skill self-ratchets as CLI fixes land — when `--site-name` is supported upstream, FP-12 patches are skipped automatically.
|
|
745
|
+
- **Failure is loud, not silent.** CLI non-zero exit stops the flow with the verbatim error. Ambiguous file shapes record a `refused` patch status rather than guessing.
|
|
746
|
+
|
|
747
|
+
### Step 4: Build Verifier
|
|
748
|
+
|
|
749
|
+
Install dependencies and build the scaffolded docs app. Classify failures against a small list of known patterns. Auto-fix only when there is a single known-correct remedy; surface everything else with context and stop the flow.
|
|
750
|
+
|
|
751
|
+
Print `[4/7] Verifying build…` at the start of this step.
|
|
752
|
+
|
|
753
|
+
Skip this step entirely if `Scaffold Result.scaffoldSucceeded !== true` — a failed scaffold produces an undefined state; installing and building on top of it makes things worse.
|
|
754
|
+
|
|
755
|
+
**4a. Install dependencies.**
|
|
756
|
+
|
|
757
|
+
Command varies by repo shape (from Preflight Result) and framework (Fumadocs only uses pnpm; MkDocs uses Python tooling — handled in the MkDocs Minimum Contract, Step 6):
|
|
758
|
+
|
|
759
|
+
- `monorepo`: run `pnpm install` at `$REPO_ROOT`.
|
|
760
|
+
- `single-package`: run `pnpm install` at `$REPO_ROOT`.
|
|
761
|
+
- `nested-standalone`: run `pnpm install` inside `<appRoot>` (`cd <appRoot> && pnpm install`). The nested lockfile means install must happen at the app root, not repo root.
|
|
762
|
+
|
|
763
|
+
For Fumadocs, capture both stdout and stderr. Print a start line (`Installing dependencies…`) and a completion line with duration.
|
|
764
|
+
|
|
765
|
+
**4b. Build.**
|
|
766
|
+
|
|
767
|
+
Command varies by shape:
|
|
768
|
+
|
|
769
|
+
- `monorepo`: `pnpm --filter {appName} build` at `$REPO_ROOT`.
|
|
770
|
+
- `single-package`: `pnpm build` at `$REPO_ROOT`.
|
|
771
|
+
- `nested-standalone`: `pnpm build` inside `<appRoot>`.
|
|
772
|
+
|
|
773
|
+
Capture both stdout and stderr. Print a start line (`Building {appName}…`) and a completion line with duration.
|
|
774
|
+
|
|
775
|
+
**4c. Classify failures against known patterns.**
|
|
776
|
+
|
|
777
|
+
Inspect the captured install and build output. For each known pattern below, check whether the output matches; if yes, apply the specified handling. Patterns are disjoint — match the first one that fits; do not cascade.
|
|
778
|
+
|
|
779
|
+
- **`ERR_PNPM_NO_MATCHING_VERSION` on `@open-agent-toolkit/*`.**
|
|
780
|
+
- Detection: `ERR_PNPM_NO_MATCHING_VERSION` appears in install stderr, and the failing package is under the `@open-agent-toolkit/` scope.
|
|
781
|
+
- Handling: **surface-only, do not auto-fix.** This typically indicates a local pnpm registry link drift that the user needs to resolve (rebuild/link the workspace packages). Surface the verbatim error, explain the cause in one sentence, and suggest the user re-run after resolving their local package state. Do not retry.
|
|
782
|
+
- **`fumadocs-mdx: command not found` accompanied by a "node_modules missing" warning.**
|
|
783
|
+
- Detection: build stderr contains `fumadocs-mdx: command not found` AND the output contains a warning about missing `node_modules` or skipped install.
|
|
784
|
+
- Handling: **auto-fix by rerunning install.** Re-run 4a once, then re-run 4b. If the second attempt still fails with the same pattern, escalate to surface-only — do not loop.
|
|
785
|
+
- **Turbopack "inferred workspace root" warning.**
|
|
786
|
+
- Detection: build stdout/stderr contains the Next.js/Turbopack inferred-root warning about multiple lockfiles.
|
|
787
|
+
- Handling: **benign if FP-11 patch was applied** (check `patchesApplied` for `status: 'applied'` on `FP-11/*`). If FP-11 was applied and the warning still appears, flag as an inconsistency in the Inspection stage, but do not fail the build. If FP-11 was not applied (e.g., shape was not `nested-standalone`), the warning shouldn't appear; if it does, flag it for the user because something unexpected is going on.
|
|
788
|
+
- **FP-10 tsconfig rewrite churn.**
|
|
789
|
+
- Detection: build stdout contains repeated "Rewriting tsconfig..." lines (the historical FP-10 symptom prior to PR #27).
|
|
790
|
+
- Handling: **flag as regression.** PR #27 is supposed to have fixed this; if it still happens, add to `knownIssues[]` with note "FP-10 regression suspected — report to CLI maintainers". Build may still succeed, so do not halt the flow on this alone.
|
|
791
|
+
|
|
792
|
+
**4d. Unknown-error stop.**
|
|
793
|
+
|
|
794
|
+
If install or build fails with output that does not match any known pattern above:
|
|
795
|
+
|
|
796
|
+
- **Stop the flow.** Do not proceed to Post-Scaffold Inspector (Step 5) or Walkthrough (Step 6).
|
|
797
|
+
- Surface the last 40 lines of captured stderr verbatim.
|
|
798
|
+
- Print the command that failed and the working directory it ran in.
|
|
799
|
+
- Tell the user: `Build Verifier stopped on an unrecognized error. Resolve the error and re-run this skill.`
|
|
800
|
+
|
|
801
|
+
**Auto-fix discipline.** Auto-fix is narrow by design — it applies only when there is a **single known-correct answer**. Everything else is surfaced. The goal is to save the user time on truly deterministic retries (like the `fumadocs-mdx` + missing-node_modules combination) without masking real failures under speculative "try again" loops.
|
|
802
|
+
|
|
803
|
+
**Cross-reference.** FP-13 (template-content sub-findings) is **not** a Build Verifier concern — FP-13 is handled entirely by the Scaffold Runner post-patches (Step 3d). The Build Verifier does not inspect markdown content or re-apply FP-13 patches; it only classifies install/build failures.
|
|
804
|
+
|
|
805
|
+
**4e. Emit the Verification Result.**
|
|
806
|
+
|
|
807
|
+
Record internally for the Post-Scaffold Inspector and Walkthrough:
|
|
808
|
+
|
|
809
|
+
```
|
|
810
|
+
Verification Result:
|
|
811
|
+
installSucceeded: boolean
|
|
812
|
+
buildSucceeded: boolean
|
|
813
|
+
knownIssues: Array<{ pattern, severity: 'benign' | 'flagged' | 'surface-only' | 'auto-fixed', detail }>
|
|
814
|
+
unrecognizedError: { command, cwd, stderrTail } | null
|
|
815
|
+
logs: { install: { stdout, stderr }, build: { stdout, stderr } }
|
|
816
|
+
```
|
|
817
|
+
|
|
818
|
+
The Walkthrough references `knownIssues[]` when narrating what the user just saw; the Inspector uses it to correlate drift findings with build-time warnings.
|
|
819
|
+
|
|
820
|
+
### Step 5: Post-Scaffold Inspector
|
|
821
|
+
|
|
822
|
+
Read the post-scaffold configuration back, verify its paths, detect drift between config and filesystem, handle nested-standalone dual-config, and collect the `requireForProjectCompletion` opt-in before the Walkthrough. This is the **only** component that writes to `.oat/config.json` — Preflight and Input Gatherer are read-only; Scaffold Runner writes via the CLI.
|
|
823
|
+
|
|
824
|
+
Print `[5/7] Inspecting config…` at the start of this step.
|
|
825
|
+
|
|
826
|
+
Skip this step if `Verification Result.buildSucceeded !== true` — inspecting a broken scaffold invites the user to act on inaccurate state.
|
|
827
|
+
|
|
828
|
+
**5a. Read parent `.oat/config.json` and parse `documentation`.**
|
|
829
|
+
|
|
830
|
+
Read `$REPO_ROOT/.oat/config.json` after scaffold. The CLI wrote (or updated) the `documentation` section with `root`, `tooling`, `config`, and `index` fields. Parse the section into an `InspectionState` object:
|
|
831
|
+
|
|
832
|
+
```
|
|
833
|
+
InspectionState (parent):
|
|
834
|
+
configPath: $REPO_ROOT/.oat/config.json
|
|
835
|
+
documentation: OatDocumentationConfig | null
|
|
836
|
+
issues: [] // populated by 5b–5d
|
|
837
|
+
```
|
|
838
|
+
|
|
839
|
+
If the `documentation` section is missing or malformed after a successful CLI invocation, that's a severe skill-versus-CLI mismatch — flag it loudly in `issues[]` with `severity: 'critical'` and surface to the user before continuing. Do not try to fabricate a section.
|
|
840
|
+
|
|
841
|
+
**5b. Verify paths per field.**
|
|
842
|
+
|
|
843
|
+
For each field in `documentation`, check that the referenced path exists and has the expected type:
|
|
844
|
+
|
|
845
|
+
- `root`: must be a directory that exists on disk (absolute or resolved-relative to `$REPO_ROOT`).
|
|
846
|
+
- `index`: must be a file that exists on disk (Fumadocs: `<appRoot>/index.md`; MkDocs: `<appRoot>/docs/index.md`). The generated root `index.md` is part of the contract even though it's regenerated every build.
|
|
847
|
+
- `config`: MkDocs only — must be a file that exists on disk (`<appRoot>/mkdocs.yml`). For Fumadocs, this field is absent; no check needed.
|
|
848
|
+
- `tooling.framework`: must match the Input Result `framework`. Mismatch is surprising and indicates drift.
|
|
849
|
+
- `tooling.lint` / `tooling.format`: must match Input Result values.
|
|
850
|
+
|
|
851
|
+
For each check that fails, append an entry to `issues[]`:
|
|
852
|
+
|
|
853
|
+
```
|
|
854
|
+
{ field: 'documentation.root', severity: 'critical', detail: 'path does not exist: ...' }
|
|
855
|
+
```
|
|
856
|
+
|
|
857
|
+
**5c. Nested-standalone dual-config handling.**
|
|
858
|
+
|
|
859
|
+
If `repoShape === 'nested-standalone'`, the docs app may have its own `.oat/config.json` (inherited or copied from the parent during scaffold). Check for `<appRoot>/.oat/config.json`:
|
|
860
|
+
|
|
861
|
+
- If present: parse it as a second `InspectionState (nested)` record. Verify its paths relative to its own root. Note this explicitly for the Walkthrough — the user may be confused about why there are two configs; the Walkthrough (Section D) explains it.
|
|
862
|
+
- If absent: this is the common case; record nothing and move on.
|
|
863
|
+
|
|
864
|
+
The parent config describes the repo's docs; the nested config (when present) scopes OAT operations executed from inside the docs app. Do **not** try to reconcile the two or rewrite one to match the other — they serve different scopes by design. Surface what you found; let the user decide.
|
|
865
|
+
|
|
866
|
+
**5d. Drift detection (config ↔ filesystem ↔ patches).**
|
|
867
|
+
|
|
868
|
+
Beyond basic path existence, check for drift between the config and what the Scaffold Runner actually did:
|
|
869
|
+
|
|
870
|
+
- If `Scaffold Result.patchesApplied` contains an FP-11 wrapper-replacement entry (Path B), confirm that the config does not reference the old wrapper path. Config referencing `createDocsConfig` would be stale; record as `driftFinding`.
|
|
871
|
+
- For every `status: 'refused'` entry in `patchesApplied`, surface the refusal here (the Scaffold Runner recorded a `suggestedFix`; repeat it). These are the main user-actionable items from the inspection.
|
|
872
|
+
- If Turbopack "inferred workspace root" was flagged in `Verification Result.knownIssues` despite FP-11 having been applied, record a `driftFinding` — FP-11's patch should have suppressed the warning.
|
|
873
|
+
|
|
874
|
+
Each drift finding appends to `issues[]` with `severity: 'warning'` (user should address) or `severity: 'info'` (worth mentioning but not blocking).
|
|
875
|
+
|
|
876
|
+
**5e. `requireForProjectCompletion` opt-in prompt.**
|
|
877
|
+
|
|
878
|
+
This is a project-completion gate: when set to `true` on the `documentation` section, OAT project workflows check that the docs are up-to-date before marking a project complete. Default is `false`.
|
|
879
|
+
|
|
880
|
+
Before asking, explain what it does:
|
|
881
|
+
|
|
882
|
+
```
|
|
883
|
+
OAT projects can optionally require that docs are updated before completion.
|
|
884
|
+
If enabled, `oat-project-complete` won't mark a project done until the
|
|
885
|
+
`oat-docs-analyze` report shows no open recommendations.
|
|
886
|
+
|
|
887
|
+
Enable this for {appName}? (default: no)
|
|
888
|
+
```
|
|
889
|
+
|
|
890
|
+
If user opts in (`yes`), write `documentation.requireForProjectCompletion: true` to `$REPO_ROOT/.oat/config.json` using the **atomic config write** pattern (read → mutate → write, preserving all other fields). Do not rewrite fields the CLI owns — only mutate `requireForProjectCompletion`.
|
|
891
|
+
|
|
892
|
+
If user opts out (default), record the decision in `InspectionState.issues` as `{ severity: 'info', detail: 'requireForProjectCompletion remains false (not opted in)' }` and move on; do not write to the config.
|
|
893
|
+
|
|
894
|
+
**Write-once discipline:** 5e is the only point in this skill where `.oat/config.json` is mutated outside of the CLI's own writes. Preflight is read-only (Step 1). Input Gatherer is read-only (Step 2). Scaffold Runner's writes flow through the CLI (Step 3c). Post-patches (Step 3d) mutate scaffold output files, not the config. If you find yourself about to write `.oat/config.json` anywhere else, stop — it belongs here.
|
|
895
|
+
|
|
896
|
+
**5f. Emit the Inspection Result.**
|
|
897
|
+
|
|
898
|
+
Record for the Walkthrough:
|
|
899
|
+
|
|
900
|
+
```
|
|
901
|
+
Inspection Result:
|
|
902
|
+
parent: InspectionState
|
|
903
|
+
nested: InspectionState | null // only present if nested-standalone + nested config exists
|
|
904
|
+
issues: Array<{ field?, severity: 'critical' | 'warning' | 'info', detail, suggestedFix? }>
|
|
905
|
+
requireForProjectCompletion: boolean // final value after 5e
|
|
906
|
+
```
|
|
907
|
+
|
|
908
|
+
The Walkthrough's Section D (Configuration readback) references `issues[]` verbatim — format it so it reads cleanly when printed to the user.
|
|
909
|
+
|
|
910
|
+
### Step 6: Educational Walkthrough
|
|
911
|
+
|
|
912
|
+
Narrate the scaffolded docs app as a chunked conversation, not a wall of text. The Walkthrough's job is to turn the user from "I ran a scaffold" into "I know how this docs app works". It is **not** a re-explanation of the CLI's output, nor a recitation of the AGENTS.md content — both are live files the user can read; the Walkthrough contextualizes them.
|
|
913
|
+
|
|
914
|
+
Print `[6/7] Walkthrough…` at the start of this step.
|
|
915
|
+
|
|
916
|
+
Skip this step if `Verification Result.buildSucceeded !== true` OR `Inspection Result.issues` contains any `severity: 'critical'` — narrating a broken scaffold teaches the wrong model.
|
|
917
|
+
|
|
918
|
+
**Format discipline.** Each section below is a short spoken-style chunk (3–6 short paragraphs), references concrete paths from the `Scaffold Result` / `Inspection Result`, and ends with a single-sentence "what this means for you" takeaway. After each section, pause and check the user wants to continue: `Ready for the next section? (yes / skip to summary)`. If the user says `skip to summary`, jump directly to Step 7's Exit summary.
|
|
919
|
+
|
|
920
|
+
**Audience discipline.** The Walkthrough is a **setup-time** narration — it runs once, now. The docs-app `AGENTS.md` (FP-15 bridge or CLI-scaffolded) is the **runtime** reference future agents will read when working inside the docs app. These are different audiences at different times; the Walkthrough does not duplicate the AGENTS.md content. If you find yourself reading AGENTS.md content aloud, stop — point the user at the file path instead.
|
|
921
|
+
|
|
922
|
+
#### Section A (both frameworks) — Your OAT documentation config
|
|
923
|
+
|
|
924
|
+
Ground this section in the `Inspection Result.parent.documentation` object read back in Step 5, not in generic field documentation. The user just saw the scaffold write this; the Walkthrough tells them what it means.
|
|
925
|
+
|
|
926
|
+
Narrate each field actually present in their config (skip fields that are absent — don't teach MkDocs-only fields to a Fumadocs user):
|
|
927
|
+
|
|
928
|
+
- **`documentation.root`** — the scaffolded app directory. Downstream tools (`oat-project-document`, `oat-docs-analyze`, `oat-docs-apply`) use this to find "the docs" without the user having to tell them.
|
|
929
|
+
- **`documentation.tooling`** — framework + lint + format. `oat-docs-analyze` uses `framework` to pick the right rule set; the tooling values also get echoed into the `## Documentation` section the CLI wrote into root `AGENTS.md`.
|
|
930
|
+
- **`documentation.index`** — the authored `docs/index.md`. This is the content map (not the generated root `index.md` — that's Section B). Tools read this to understand top-level navigation intent.
|
|
931
|
+
- **`documentation.config`** (MkDocs only) — path to `mkdocs.yml`. Present for MkDocs because its chrome/nav is YAML-configured; absent for Fumadocs because chrome is code.
|
|
932
|
+
- **`documentation.requireForProjectCompletion`** — the opt-in collected in Step 5e. If `true`, `oat-project-complete` will block project completion until `oat-docs-analyze` reports no open recommendations. Explain whichever value is set on this project.
|
|
933
|
+
|
|
934
|
+
End with: "This config is how every OAT docs tool finds your docs. Editing it by hand is supported — but changes to `root` or `config` paths need to match reality on disk."
|
|
935
|
+
|
|
936
|
+
#### Section B (both frameworks) — The two `index.md` files
|
|
937
|
+
|
|
938
|
+
This section prevents the footgun from FP-13 sub-finding D: users silently hand-edit the generated `index.md` and wonder why their edits vanish on the next build.
|
|
939
|
+
|
|
940
|
+
Narrate:
|
|
941
|
+
|
|
942
|
+
- **The authored source** at `<appRoot>/docs/index.md`. This is the file the user edits. It has frontmatter (`title`, `description`) and a `## Contents` section listing direct children of the docs root. It is the top of a fractal: every directory has its own `index.md`, each with its own `## Contents`.
|
|
943
|
+
- **The generated map** at `<appRoot>/index.md` (when Fumadocs — the path differs for MkDocs; use the `documentation.index` path resolved by the Inspector if it differs). Regenerated on every `predev` / `prebuild` by the `oat docs generate-index` command. Machine-shaped: rolls up every `## Contents` section in the tree into a single searchable map that tools consume. **Hand-edits are silently clobbered.**
|
|
944
|
+
- **How to tell them apart when opening a file.** If the file sits inside `docs/`, it's authored. If it sits at `<appRoot>/index.md` (outside `docs/`), it's generated — and if Scaffold-integrity FP-13/D.2 patched it, the first line is a `<!-- generated … -->` banner confirming so.
|
|
945
|
+
|
|
946
|
+
End with: "Always edit `docs/index.md` and the `## Contents` sections. Never edit the root-level `index.md` — your edits will disappear next build."
|
|
947
|
+
|
|
948
|
+
#### Section C (both frameworks) — The `## Contents` contract
|
|
949
|
+
|
|
950
|
+
This section explains why tooling works at all — the contract every OAT docs tool relies on.
|
|
951
|
+
|
|
952
|
+
Narrate:
|
|
953
|
+
|
|
954
|
+
- **Every directory under `docs/` has an `index.md`.** No exceptions, no `overview.md`, no README-as-index. Missing `index.md`s are the first thing `oat-docs-analyze` flags.
|
|
955
|
+
- **Every `index.md` has a `## Contents` section.** The section is a plain Markdown bulleted list of links to the direct children of that directory — both subdirectory `index.md`s and leaf pages.
|
|
956
|
+
- **Link targets use `.md` extensions.** Leaf pages link as `[Title](page.md)`; subdirectories link as `[Section](subdir/index.md)`. The `@open-agent-toolkit/docs-transforms` remark-links plugin normalizes these at build time for Fumadocs routing (`.md` stripped; `dir/index.md` collapsed to `dir`). `.md`-suffixed authored links render correctly **and** let agents follow each link to the target file without path inference — the best of both worlds.
|
|
957
|
+
- **The `## Contents` section is the machine-readable local map.** It's what `oat docs nav sync` reads to regenerate framework nav, what `oat docs generate-index` reads to roll up the tree, and what `oat-docs-analyze` reads to find orphaned pages.
|
|
958
|
+
- **Anything not listed in `## Contents` is invisible to the tooling.** Adding a Markdown file is not enough — it must also appear under the parent `index.md`'s `## Contents`.
|
|
959
|
+
|
|
960
|
+
Show the user their own `docs/index.md` `## Contents` as a concrete example (read the file and paste the relevant 5–15 lines). If `patchesApplied` includes an `FP-16` entry with `status: 'applied'`, mention it — the skill rewrote the scaffold's extension-less links to `.md`-suffixed form so agents can follow them. Then note: "That's the pattern. Every directory you create from now on follows the same shape — `.md`-suffixed links, bulleted list, dash-separated summary per entry."
|
|
961
|
+
|
|
962
|
+
End with: "`## Contents` is how navigation stays in sync with filesystem. If the nav tooling seems confused, the answer is almost always 'check the nearest `## Contents`'. Always author with `.md` extensions; the build pipeline handles routing."
|
|
963
|
+
|
|
964
|
+
#### Section D (both frameworks) — Three agent-instruction surfaces
|
|
965
|
+
|
|
966
|
+
The docs app is surrounded by three separate places agents and humans are expected to read. Each has a distinct audience and a distinct time. Conflating them is the source of most "why isn't AGENTS.md helping me?" confusion.
|
|
967
|
+
|
|
968
|
+
Narrate the three surfaces with audience + time discipline:
|
|
969
|
+
|
|
970
|
+
1. **Root `AGENTS.md` `## Documentation` section** — the repo-wide pointer. A 4-line breadcrumb every agent working anywhere in the repo reads first. Written/updated by `oat docs init` (or `oat-docs-apply`). Purpose: "docs live here; here's the framework; here's the config path." Not a tutorial — a signpost.
|
|
971
|
+
2. **Docs-app `AGENTS.md`** at `<appRoot>/AGENTS.md` — the ongoing reference for agents who are **working inside the docs app**, not setting it up. This is the FP-15 bridge file (or CLI-scaffolded equivalent if `capabilities.agentsMdScaffoldFlag === true`). Task-framed sections: "When you need to add a new page", "When you need to restructure navigation", "When you need to audit or bulk-edit docs". **Audience discipline:** this file exists for the agent working on docs content **six months from now**, not for the agent running this skill today. Everything in it should still be useful at that time. If content would only matter at setup time, it belongs in this Walkthrough, not in `AGENTS.md`.
|
|
972
|
+
3. **`docs/contributing.md`** — human-authoring conventions. Markdown feature reference (code blocks, mermaid, GFM alerts), frontmatter requirements, linting/formatting commands (if enabled). Not agent instructions — human reference. Agents working with docs content may read it for the Markdown feature list, but its primary audience is a human contributor.
|
|
973
|
+
|
|
974
|
+
End with: "Three surfaces, three audiences, three lifetimes. Root `AGENTS.md` = repo-wide pointer. Docs-app `AGENTS.md` = future agents working inside the docs app. `contributing.md` = humans. Keeping them separate keeps each one useful."
|
|
975
|
+
|
|
976
|
+
#### Section E (Fumadocs only) — Framework deep dive
|
|
977
|
+
|
|
978
|
+
Skip this section entirely when `framework === 'mkdocs'`; the MkDocs equivalent (with its Minimum Contract) is Section F.
|
|
979
|
+
|
|
980
|
+
Narrate how the Fumadocs scaffold actually works, grounded in files the user can open alongside you:
|
|
981
|
+
|
|
982
|
+
- **`app/layout.tsx` — `DocsLayout` renders the chrome.** The `<DocsLayout>` component from `@open-agent-toolkit/docs-theme` wraps every docs page with the top nav, sidebar, and search UI. It accepts a `branding` prop with `title`, `logo`, etc. **Runtime insight (worth knowing):** the compiled theme bundle only forwards `branding.title` into the nav header chrome — it doesn't use it for page metadata, social cards, or browser tab titles. That's why FP-12's patches also add `export const metadata = { title, description }` to `layout.tsx`: the chrome title and the document title are two separate concerns, and the scaffold only wired the first. **Anti-pattern to avoid:** passing `title` / `description` to `createDocsConfig()` in `next.config.js` is a no-op — the wrapper only reads `basePath` and ignores those keys. If your HTML `<head>` comes back empty (no `<title>`, no meta description, no Open Graph), the `export const metadata` in `layout.tsx` is missing.
|
|
983
|
+
- **`next.config.js` — `createMDX()` picks up `docs/`.** The Fumadocs MDX pipeline uses `@open-agent-toolkit/docs-config`'s `createDocsConfig()` wrapper, which under the hood calls `createMDX()` with the docs directory hardcoded to `docs/`. Both `.md` and `.mdx` files are compiled at build time; frontmatter becomes typed metadata accessible from layouts and listings. **Default to `.md`** for plain content pages — agents, linters, grep rules, and the `remark-links` plugin all handle `.md` more predictably than `.mdx`. Reach for `.mdx` only when a page actually needs a JSX component inline (an embedded `<Callout>`, an interactive widget, a custom layout). FlexSearch indexes them identically.
|
|
984
|
+
- **FlexSearch static indexing.** Search is client-side — on build, Fumadocs scans every `.md`/`.mdx` file under `docs/` and emits a precomputed FlexSearch index that loads alongside the first route. No server; no search API call. That's also why renaming a page without a redirect loses deep links silently: the old index entry stops existing at the next build, and the new one doesn't know the old slug.
|
|
985
|
+
- **`@open-agent-toolkit/docs-theme` branding.** The theme package centralizes the nav/sidebar/footer look and forwards only a small surface of props. Don't expect `branding` to influence metadata; use the FP-12 `metadata` export for that.
|
|
986
|
+
- **FP-11 Turbopack root.** If your repo is `nested-standalone` (docs app has its own lockfile inside the monorepo), Next's Turbopack infers the wrong workspace root and warns about multiple lockfiles. The FP-11 patch sets `turbopack: { root: __dirname }` either via `createDocsConfig` passthrough or (if the passthrough isn't available) by replacing the wrapper with an explicit `createMDX()` config. Check `patchesApplied` to see which code path your scaffold used.
|
|
987
|
+
|
|
988
|
+
End with: "Fumadocs gives you a typed MDX-capable pipeline with client-side search and code-owned chrome. Prefer `.md` for plain content, reach for `.mdx` only when you need embedded components. Branding is one layer (nav only); metadata is a separate, explicit concern. Most page-level edits are frontmatter + Markdown; only layout/theme changes go in `app/`."
|
|
989
|
+
|
|
990
|
+
#### Section F (MkDocs only) — Lean summary with Minimum Contract
|
|
991
|
+
|
|
992
|
+
Skip this section entirely when `framework === 'fumadocs'`.
|
|
993
|
+
|
|
994
|
+
Narrate the minimum mental model a user needs to work productively in MkDocs, then **mark clearly** what is in scope for this skill vs. what is not. MkDocs has a sprawling ecosystem (Material theme, plugin catalog, Python env specifics) that a scaffold-time walkthrough cannot cover without ballooning beyond usefulness.
|
|
995
|
+
|
|
996
|
+
In scope (required — share these):
|
|
997
|
+
|
|
998
|
+
- **`mkdocs.yml` is the root config.** Site name, nav, theme, plugins, Markdown extensions — all in one YAML file. The CLI scaffolded one tuned for the OAT conventions.
|
|
999
|
+
- **Material theme provides the default UI.** Light/dark toggle, responsive sidebar, search UI. Config lives under `theme:` in `mkdocs.yml`.
|
|
1000
|
+
- **Plugins are pip-installed and named in `mkdocs.yml`.** The scaffold's `requirements.txt` pins the plugins currently wired in. Adding a new plugin = add to both files.
|
|
1001
|
+
- **Python environment via `requirements.txt` + `setup-docs.sh`.** The scaffold provides a `setup-docs.sh` that creates a venv, installs `requirements.txt`, and is idempotent on re-run. Use it; the skill assumes you will.
|
|
1002
|
+
- **The shared concepts still apply.** The `## Contents` contract (Section C), the two `index.md` model (Section B — note for MkDocs the generated artifact is the `nav:` section of `mkdocs.yml`, not a root `index.md`), and the three agent-instruction surfaces (Section D) all transfer directly.
|
|
1003
|
+
|
|
1004
|
+
Deferred (out of scope for this skill — point, don't teach):
|
|
1005
|
+
|
|
1006
|
+
- **Material theme internals.** Customizing palettes beyond light/dark, component overrides, template extensions. See the Material docs.
|
|
1007
|
+
- **Plugin authoring.** Writing your own MkDocs plugin. See the MkDocs plugin docs.
|
|
1008
|
+
- **Python env debugging.** Venv activation issues, dependency conflicts, pip resolution failures. General Python tooling help.
|
|
1009
|
+
- **MkDocs-specific Markdown extensions beyond the shared set.** Admonitions, tabs, content tabs, abbreviations, etc. See Material's Markdown extension docs.
|
|
1010
|
+
- **Deployment patterns** (GitHub Pages, Netlify, self-hosted). Framework-agnostic; outside the bootstrap scope.
|
|
1011
|
+
|
|
1012
|
+
End with: "That's the Minimum Contract. Everything on the deferred list has good upstream docs; this skill's job is to get you productive inside OAT's conventions. For the Material deep-dive, the MkDocs plugin ecosystem, or deployment, look at the linked references."
|
|
1013
|
+
|
|
1014
|
+
#### Section G (both frameworks) — The OAT docs ecosystem
|
|
1015
|
+
|
|
1016
|
+
Introduce the three tools the user will use after scaffold, ordered by when they'll meet each one:
|
|
1017
|
+
|
|
1018
|
+
- **`oat-project-document`** — runs during OAT project workflows. When a project wraps up (or at phase boundaries), this skill reads `discovery.md`, `spec.md`, `design.md`, `plan.md`, `implementation.md` and proposes evidence-backed documentation updates. No speculation: every proposed update traces back to a source artifact. The user approves the updates before they land. This is the primary way project-derived docs stay current without requiring the user to hand-write them.
|
|
1019
|
+
- **`oat-docs-analyze`** — read-only audit of the docs surface. Checks the `## Contents` contract (every dir has `index.md`; every `index.md` has `## Contents`; every link resolves), surfaces drift between filesystem and config, and flags orphaned pages. Produces a report at `.oat/repo/analysis/` — never mutates content. Run it periodically, and before changes to doc-heavy areas.
|
|
1020
|
+
- **`oat-docs-apply`** — executes approved analyze recommendations. Creates a branch, runs the fixes, syncs derived navigation artifacts, and (optionally) opens a PR. Will not make unapproved changes or invent new conventions. This is the intended path for any bulk content change; hand-editing a dozen pages at once skips the safety net.
|
|
1021
|
+
|
|
1022
|
+
End with: "`oat-project-document` fills docs from project artifacts. `oat-docs-analyze` tells you where the docs are drifting. `oat-docs-apply` fixes approved drift with a safety net. Together they're the reason hand-authoring docs from scratch isn't the expected path in OAT."
|
|
1023
|
+
|
|
1024
|
+
### Step 7: Optional Content Kickoff
|
|
1025
|
+
|
|
1026
|
+
After the Walkthrough, offer — but do not require — to populate initial documentation via the docs-analysis pack. Content authoring is outside this skill's scope (`oat-docs-analyze` + `oat-docs-apply` own it), so this step delegates if the user wants to go further now, and hands off with actionable commands if they don't.
|
|
1027
|
+
|
|
1028
|
+
Print `[7/7] Optional content kickoff…` at the start of this step.
|
|
1029
|
+
|
|
1030
|
+
**7a. Offer the option.**
|
|
1031
|
+
|
|
1032
|
+
Ask once, plainly:
|
|
1033
|
+
|
|
1034
|
+
```
|
|
1035
|
+
Your docs app is scaffolded and verified. Want to populate initial documentation
|
|
1036
|
+
now by running the docs-analysis pack?
|
|
1037
|
+
|
|
1038
|
+
oat-docs-analyze — reads your scaffolded `docs/` surface and proposes
|
|
1039
|
+
content recommendations (missing pages, incomplete `## Contents`, link gaps)
|
|
1040
|
+
without changing anything.
|
|
1041
|
+
|
|
1042
|
+
oat-docs-apply — executes approved recommendations on a branch, runs nav
|
|
1043
|
+
sync, and optionally opens a PR.
|
|
1044
|
+
|
|
1045
|
+
Options:
|
|
1046
|
+
yes — run analyze now, then apply on approval
|
|
1047
|
+
no — exit; you can run these any time later
|
|
1048
|
+
```
|
|
1049
|
+
|
|
1050
|
+
**7b. If the user accepts (`yes`).**
|
|
1051
|
+
|
|
1052
|
+
Delegate — do not re-implement analyze/apply logic here.
|
|
1053
|
+
|
|
1054
|
+
1. Invoke the `oat-docs-analyze` skill against the scaffolded app. Pass the Inspection Result's `documentation.root` path so analyze targets the right surface. Wait for analyze to complete.
|
|
1055
|
+
2. Surface analyze's report to the user in its native form — do not re-summarize. The user reads it, decides which recommendations to approve.
|
|
1056
|
+
3. If the user approves any recommendations, invoke the `oat-docs-apply` skill with the approved subset. Wait for apply to complete.
|
|
1057
|
+
4. Report the outcome back briefly: branch name, PR URL if opened, files changed count.
|
|
1058
|
+
|
|
1059
|
+
If analyze produces no recommendations (the scaffold is complete and nothing's missing — unlikely on a fresh scaffold but possible), tell the user and skip apply.
|
|
1060
|
+
|
|
1061
|
+
**7c. If the user declines (`no`).**
|
|
1062
|
+
|
|
1063
|
+
Hand off with specific, runnable commands. Don't say "run analyze later" — give them the exact invocation for this repo:
|
|
1064
|
+
|
|
1065
|
+
- `oat-docs-analyze` (skill invocation from this repo's provider) to audit the docs surface.
|
|
1066
|
+
- `oat-docs-apply` (skill invocation) to execute approved recommendations.
|
|
1067
|
+
- `oat-project-document` (skill invocation during OAT project workflows) to propose evidence-backed updates from project artifacts.
|
|
1068
|
+
|
|
1069
|
+
Proceed to the Exit summary regardless of whether the user accepted or declined.
|
|
1070
|
+
|
|
1071
|
+
#### Exit summary
|
|
1072
|
+
|
|
1073
|
+
The final output of Step 7 — and of the skill. Regardless of whether the Content Kickoff delegated or was skipped, print a single scannable summary the user can refer back to later.
|
|
1074
|
+
|
|
1075
|
+
Format as a bulleted summary, not prose. Keep it tight — this is a handoff, not a recap:
|
|
1076
|
+
|
|
1077
|
+
```
|
|
1078
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1079
|
+
OAT ▸ DOCS BOOTSTRAP COMPLETE
|
|
1080
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
1081
|
+
|
|
1082
|
+
App: {appName}
|
|
1083
|
+
Location: {appRoot}
|
|
1084
|
+
Framework: {framework}
|
|
1085
|
+
Config: {configPath} (documentation section)
|
|
1086
|
+
|
|
1087
|
+
Created:
|
|
1088
|
+
- <count> files (see `git status` or `git log -1` for the full list)
|
|
1089
|
+
|
|
1090
|
+
Patches applied:
|
|
1091
|
+
- FP-11 Turbopack root: {applied | skipped | refused | n/a}
|
|
1092
|
+
- FP-12 site title + metadata: {applied | skipped | refused}
|
|
1093
|
+
- FP-13 template content (A–D): {applied | skipped | refused} per sub-finding
|
|
1094
|
+
- FP-15 docs-app AGENTS.md: {applied | skipped}
|
|
1095
|
+
|
|
1096
|
+
Build:
|
|
1097
|
+
- Install: {ok | known-issue: ...}
|
|
1098
|
+
- Build: {ok | known-issue: ...}
|
|
1099
|
+
- Known issues (from Verification Result.knownIssues): {list or 'none'}
|
|
1100
|
+
|
|
1101
|
+
Inspection:
|
|
1102
|
+
- Config paths verified: {ok | see issues below}
|
|
1103
|
+
- Drift findings: {list or 'none'}
|
|
1104
|
+
- requireForProjectCompletion: {true | false}
|
|
1105
|
+
|
|
1106
|
+
Where things live:
|
|
1107
|
+
- Authored content: {appRoot}/docs/
|
|
1108
|
+
- Content map: {appRoot}/docs/index.md (and nested `## Contents`)
|
|
1109
|
+
- Generated index: {path, if Fumadocs} (regenerated on build — don't hand-edit)
|
|
1110
|
+
- Agent instructions:
|
|
1111
|
+
· Root AGENTS.md `## Documentation` — repo-wide pointer
|
|
1112
|
+
· {appRoot}/AGENTS.md — reference for future agents working in this docs app
|
|
1113
|
+
· {appRoot}/docs/contributing.md — human authoring conventions
|
|
1114
|
+
|
|
1115
|
+
Next:
|
|
1116
|
+
- Run `<framework-specific dev command>` to serve locally
|
|
1117
|
+
- Run `oat-docs-analyze` to audit the docs surface (read-only)
|
|
1118
|
+
- Run `oat-docs-apply` to execute approved recommendations
|
|
1119
|
+
- Run `oat-project-document` during OAT project workflows to keep docs current
|
|
1120
|
+
|
|
1121
|
+
Reminder: the docs-app AGENTS.md at {appRoot}/AGENTS.md tells future agents how
|
|
1122
|
+
to work inside this docs app. Read it before making non-trivial doc changes.
|
|
1123
|
+
```
|
|
1124
|
+
|
|
1125
|
+
Substitute every `{placeholder}` with the actual value from `Scaffold Result`, `Verification Result`, or `Inspection Result`. If a patch was `skipped` because the CLI already handled it (e.g., `agentsMdScaffoldFlag === true`), say so explicitly rather than printing `n/a` — the user should know when the CLI has caught up with the skill.
|
|
1126
|
+
|
|
1127
|
+
For the "Next" section's `<framework-specific dev command>`, render:
|
|
1128
|
+
|
|
1129
|
+
- Fumadocs + `monorepo`: `pnpm --filter {appName} dev`
|
|
1130
|
+
- Fumadocs + `nested-standalone`: `cd {appRoot} && pnpm dev`
|
|
1131
|
+
- Fumadocs + `single-package`: `pnpm dev`
|
|
1132
|
+
- MkDocs (any shape): `{appRoot}/setup-docs.sh && cd {appRoot} && mkdocs serve`
|
|
1133
|
+
|
|
1134
|
+
End the skill with the summary. Do not prompt for more input — the user knows what to do next, and the summary contains the commands.
|
|
1135
|
+
|
|
1136
|
+
## Success Criteria
|
|
1137
|
+
|
|
1138
|
+
A successful `oat-docs-bootstrap` run satisfies every invariant below. Any failure of an invariant either blocks progression (critical) or is surfaced to the user in the Exit summary with a `suggestedFix` (warning) so the user knows what to address.
|
|
1139
|
+
|
|
1140
|
+
**Pipeline invariants:**
|
|
1141
|
+
|
|
1142
|
+
- Preflight ran read-only — no files mutated, no config written, no scaffold invoked.
|
|
1143
|
+
- Input Gatherer collected the full Input Result (framework, siteName, appName, targetDir, siteDescription, lint, format) plus any `conflictResolution` required by Preflight conflicts; all inputs validated before scaffold.
|
|
1144
|
+
- Conflict Resolution Contract's "Allowed mutations" completed for the chosen resolution; pre-scaffold invariant satisfied before `oat docs init` ran.
|
|
1145
|
+
- Scaffold Runner invoked `oat docs init` non-interactively with capability-gated flags; CLI exited zero; `Scaffold Result.appRoot` resolved from `.oat/config.json` (not from input alone).
|
|
1146
|
+
- Capability Detection produced a deterministic `capabilities` record before scaffold (for flag gating) and classified each patch target after scaffold (scaffold-shape / patched-shape / drift).
|
|
1147
|
+
- Every applied post-patch is labeled with a marker comment (`<!-- FP-NN patch -->` or `/* FP-NN patch */`) and is idempotent; no patch ran without passing both its capability gate and its file-shape check.
|
|
1148
|
+
- Build Verifier ran install + build with commands matching `repoShape`; failures classified against known patterns; unknown errors halted the flow before Inspector/Walkthrough.
|
|
1149
|
+
- Post-Scaffold Inspector verified every `documentation.*` path against disk; drift findings recorded with `suggestedFix`; nested-standalone dual-config surfaced without reconciliation.
|
|
1150
|
+
- `requireForProjectCompletion` decision collected from user; written to `.oat/config.json` only on opt-in; never silently default-true.
|
|
1151
|
+
- Walkthrough narrated setup-time context, not AGENTS.md runtime content; skipped framework-irrelevant sections; paused between sections with a `skip to summary` escape.
|
|
1152
|
+
- Optional Content Kickoff delegated to `oat-docs-analyze` + `oat-docs-apply` on accept; handed off with specific commands on decline.
|
|
1153
|
+
- Exit summary printed with actual values (not placeholders) for app, framework, patches applied, build status, inspection findings, and next-step commands.
|
|
1154
|
+
|
|
1155
|
+
**Ratcheting invariants:**
|
|
1156
|
+
|
|
1157
|
+
- When a CLI capability is detected as present (`capabilities.{flag} === true`), the corresponding post-patch is **skipped** — not applied redundantly. The skill self-ratchets as CLI fixes land.
|
|
1158
|
+
- Every patch's `status` is recorded in `Scaffold Result.patchesApplied` as `applied` / `skipped` / `refused` with a `reason`. The Exit summary surfaces this so the user sees which CLI gaps the skill had to cover vs. which the CLI handled directly.
|
|
1159
|
+
- When `capabilities.agentsMdScaffoldFlag === true` (CLI has added native AGENTS.md scaffolding), the FP-15 bridge in this skill is skipped and can be retired from the assets directory.
|
|
1160
|
+
|
|
1161
|
+
**Stop-on-broken-state invariants:**
|
|
1162
|
+
|
|
1163
|
+
- If `Scaffold Result.scaffoldSucceeded !== true`: Build Verifier is skipped; Inspector is skipped; Walkthrough is skipped; Exit summary reports the CLI error verbatim.
|
|
1164
|
+
- If `Verification Result.buildSucceeded !== true`: Inspector is skipped; Walkthrough is skipped; Exit summary reports the unclassified failure.
|
|
1165
|
+
- If `Inspection Result.issues` contains any `severity: 'critical'`: Walkthrough is skipped; Exit summary surfaces the critical finding.
|
|
1166
|
+
|
|
1167
|
+
**Audience-discipline invariants:**
|
|
1168
|
+
|
|
1169
|
+
- The Walkthrough narrates setup-time concepts; it does not recite the docs-app AGENTS.md word-for-word.
|
|
1170
|
+
- The docs-app AGENTS.md (FP-15 bridge or CLI-native) contains only guidance that would still be useful six months after scaffold — no "how this was set up" content.
|
|
1171
|
+
- The three agent-instruction surfaces (root `AGENTS.md` `## Documentation`, docs-app `AGENTS.md`, `docs/contributing.md`) are kept distinct by audience + lifetime; the Walkthrough's Section D makes this explicit to the user.
|