specweave 0.33.4 → 0.33.5
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/CLAUDE.md +20 -12
- package/dist/src/cli/commands/jobs.js +19 -2
- package/dist/src/cli/commands/jobs.js.map +1 -1
- package/dist/src/cli/commands/living-docs.js +1 -1
- package/dist/src/cli/commands/living-docs.js.map +1 -1
- package/dist/src/cli/helpers/init/external-import-grouping.d.ts.map +1 -1
- package/dist/src/cli/helpers/init/external-import-grouping.js +11 -7
- package/dist/src/cli/helpers/init/external-import-grouping.js.map +1 -1
- package/dist/src/cli/workers/clone-worker.js +22 -5
- package/dist/src/cli/workers/clone-worker.js.map +1 -1
- package/dist/src/core/background/job-dependency.d.ts.map +1 -1
- package/dist/src/core/background/job-dependency.js +1 -0
- package/dist/src/core/background/job-dependency.js.map +1 -1
- package/dist/src/core/background/job-launcher.js +2 -2
- package/dist/src/core/background/job-launcher.js.map +1 -1
- package/dist/src/core/background/job-manager.d.ts +8 -0
- package/dist/src/core/background/job-manager.d.ts.map +1 -1
- package/dist/src/core/background/job-manager.js +19 -1
- package/dist/src/core/background/job-manager.js.map +1 -1
- package/dist/src/core/background/types.d.ts +9 -1
- package/dist/src/core/background/types.d.ts.map +1 -1
- package/dist/src/core/background/types.js +8 -1
- package/dist/src/core/background/types.js.map +1 -1
- package/dist/src/importers/external-importer.d.ts +26 -5
- package/dist/src/importers/external-importer.d.ts.map +1 -1
- package/dist/src/importers/item-converter.d.ts.map +1 -1
- package/dist/src/importers/item-converter.js +18 -1
- package/dist/src/importers/item-converter.js.map +1 -1
- package/dist/src/importers/jira-importer.d.ts.map +1 -1
- package/dist/src/importers/jira-importer.js +15 -1
- package/dist/src/importers/jira-importer.js.map +1 -1
- package/dist/src/living-docs/smart-doc-organizer.js +1 -1
- package/dist/src/living-docs/smart-doc-organizer.js.map +1 -1
- package/dist/src/utils/docs-preview/config-generator.d.ts.map +1 -1
- package/dist/src/utils/docs-preview/config-generator.js +4 -0
- package/dist/src/utils/docs-preview/config-generator.js.map +1 -1
- package/dist/src/utils/notification-constants.d.ts +8 -6
- package/dist/src/utils/notification-constants.d.ts.map +1 -1
- package/dist/src/utils/notification-constants.js +8 -6
- package/dist/src/utils/notification-constants.js.map +1 -1
- package/dist/src/utils/notification-manager.d.ts +24 -0
- package/dist/src/utils/notification-manager.d.ts.map +1 -1
- package/dist/src/utils/notification-manager.js +29 -0
- package/dist/src/utils/notification-manager.js.map +1 -1
- package/package.json +1 -1
- package/plugins/specweave/commands/specweave-judge-llm.md +296 -0
- package/plugins/specweave/commands/specweave-organize-docs.md +2 -2
- package/plugins/specweave/hooks/hooks.json +10 -0
- package/plugins/specweave/hooks/v2/guards/metadata-json-guard.sh +87 -0
- package/plugins/specweave/hooks/v2/guards/metadata-json-guard.test.sh +302 -0
- package/plugins/specweave/hooks/v2/guards/per-us-project-validator.sh +72 -18
- package/plugins/specweave/hooks/v2/guards/per-us-project-validator.test.sh +406 -0
- package/plugins/specweave/scripts/session-watchdog.sh +10 -4
- package/plugins/specweave/skills/increment-planner/SKILL.md +1 -1
- package/plugins/specweave-docs/commands/build.md +4 -4
- package/plugins/specweave-docs/commands/generate.md +1 -1
- package/plugins/specweave-docs/commands/health.md +1 -1
- package/plugins/specweave-docs/commands/init.md +1 -1
- package/plugins/specweave-docs/commands/organize.md +2 -2
- package/plugins/specweave-docs/commands/validate.md +1 -1
- package/plugins/specweave-docs/commands/view.md +391 -0
- package/plugins/specweave-docs/skills/preview/SKILL.md +56 -17
- package/src/templates/AGENTS.md.template +24 -28
- package/src/templates/CLAUDE.md.template +12 -8
- package/plugins/specweave/commands/specweave-judge.md +0 -276
- package/plugins/specweave-docs/commands/preview.md +0 -274
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: specweave:judge
|
|
3
|
-
description: Validate completed work using LLM-as-Judge pattern. Works on any files, not just increments.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# /specweave:judge - Work Validation via Judge LLM
|
|
7
|
-
|
|
8
|
-
Validate any completed work using the LLM-as-Judge pattern with deep reasoning.
|
|
9
|
-
|
|
10
|
-
## Purpose
|
|
11
|
-
|
|
12
|
-
Use when you've completed work (files, git changes, any code) and want AI-powered validation:
|
|
13
|
-
- Works on **any files** (not just SpecWeave increments)
|
|
14
|
-
- Uses **chain-of-thought reasoning** for thorough analysis
|
|
15
|
-
- Returns **clear verdict** with detailed reasoning
|
|
16
|
-
|
|
17
|
-
## Usage
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
# Validate specific files
|
|
21
|
-
/specweave:judge src/file.ts
|
|
22
|
-
/specweave:judge "src/**/*.ts"
|
|
23
|
-
|
|
24
|
-
# Validate git changes
|
|
25
|
-
/specweave:judge --staged # Staged changes
|
|
26
|
-
/specweave:judge --last-commit # Last commit
|
|
27
|
-
/specweave:judge --diff main # Diff vs branch
|
|
28
|
-
|
|
29
|
-
# Validation modes
|
|
30
|
-
/specweave:judge src/file.ts --quick # Fast (~10s)
|
|
31
|
-
/specweave:judge src/file.ts --deep # Thorough (~60s)
|
|
32
|
-
/specweave:judge src/file.ts --strict # Fail on any concern
|
|
33
|
-
|
|
34
|
-
# Additional options
|
|
35
|
-
/specweave:judge src/file.ts --fix # Include fix suggestions
|
|
36
|
-
/specweave:judge src/file.ts --export # Export report to markdown
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## How It Works
|
|
40
|
-
|
|
41
|
-
When you invoke `/specweave:judge`, Claude will:
|
|
42
|
-
|
|
43
|
-
### Step 1: Gather Input
|
|
44
|
-
|
|
45
|
-
Determine what to validate:
|
|
46
|
-
- If file paths provided → read those files
|
|
47
|
-
- If `--staged` → get staged git changes
|
|
48
|
-
- If `--last-commit` → get files from last commit
|
|
49
|
-
- If `--diff <branch>` → get diff against branch
|
|
50
|
-
|
|
51
|
-
### Step 2: Analyze with Judge LLM Pattern
|
|
52
|
-
|
|
53
|
-
Use chain-of-thought reasoning to evaluate:
|
|
54
|
-
|
|
55
|
-
```markdown
|
|
56
|
-
<thinking>
|
|
57
|
-
1. **Read**: Understand what the code does
|
|
58
|
-
2. **Analyze**: Check for issues across dimensions:
|
|
59
|
-
- Correctness: Does it work as intended?
|
|
60
|
-
- Completeness: Are edge cases handled?
|
|
61
|
-
- Security: Any vulnerabilities?
|
|
62
|
-
- Performance: Any obvious issues?
|
|
63
|
-
- Maintainability: Is it clean and clear?
|
|
64
|
-
3. **Evaluate**: Weigh findings by severity
|
|
65
|
-
4. **Decide**: Form verdict based on analysis
|
|
66
|
-
</thinking>
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### Step 3: Return Verdict
|
|
70
|
-
|
|
71
|
-
```
|
|
72
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
73
|
-
JUDGE VERDICT: APPROVED | CONCERNS | REJECTED
|
|
74
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
75
|
-
|
|
76
|
-
Confidence: 0.XX
|
|
77
|
-
Files Analyzed: N
|
|
78
|
-
|
|
79
|
-
REASONING:
|
|
80
|
-
[Chain-of-thought explanation of findings]
|
|
81
|
-
|
|
82
|
-
ISSUES (if any):
|
|
83
|
-
🔴 CRITICAL: [title]
|
|
84
|
-
[description]
|
|
85
|
-
📍 [file:line]
|
|
86
|
-
💡 [suggestion]
|
|
87
|
-
|
|
88
|
-
🟡 HIGH: [title]
|
|
89
|
-
...
|
|
90
|
-
|
|
91
|
-
🟢 LOW: [title]
|
|
92
|
-
...
|
|
93
|
-
|
|
94
|
-
VERDICT: [summary sentence]
|
|
95
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
## Verdict Meanings
|
|
99
|
-
|
|
100
|
-
| Verdict | Meaning | Action |
|
|
101
|
-
|---------|---------|--------|
|
|
102
|
-
| **APPROVED** | Work looks good, no significant issues | Safe to proceed |
|
|
103
|
-
| **CONCERNS** | Some issues found, worth addressing | Review and fix if time permits |
|
|
104
|
-
| **REJECTED** | Critical issues found | Must fix before proceeding |
|
|
105
|
-
|
|
106
|
-
## Validation Modes
|
|
107
|
-
|
|
108
|
-
### Quick Mode (`--quick`)
|
|
109
|
-
- Fast validation (~10 seconds)
|
|
110
|
-
- Focuses on obvious issues
|
|
111
|
-
- Good for frequent checks during development
|
|
112
|
-
- Cost: ~$0.02-0.05
|
|
113
|
-
|
|
114
|
-
### Default Mode
|
|
115
|
-
- Balanced validation (~30 seconds)
|
|
116
|
-
- Thorough analysis of all dimensions
|
|
117
|
-
- Good for pre-commit validation
|
|
118
|
-
- Cost: ~$0.05-0.10
|
|
119
|
-
|
|
120
|
-
### Deep Mode (`--deep`)
|
|
121
|
-
- Most thorough validation (~60 seconds)
|
|
122
|
-
- Extended thinking for complex reasoning
|
|
123
|
-
- Good for critical code or security review
|
|
124
|
-
- Cost: ~$0.10-0.20
|
|
125
|
-
|
|
126
|
-
### Strict Mode (`--strict`)
|
|
127
|
-
- Any concern results in REJECTED
|
|
128
|
-
- Use for critical paths, security code, or CI gates
|
|
129
|
-
|
|
130
|
-
## Examples
|
|
131
|
-
|
|
132
|
-
### Example 1: Validate a new feature
|
|
133
|
-
|
|
134
|
-
```
|
|
135
|
-
User: /specweave:judge src/core/auth/login.ts
|
|
136
|
-
|
|
137
|
-
Claude:
|
|
138
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
139
|
-
JUDGE VERDICT: APPROVED
|
|
140
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
141
|
-
|
|
142
|
-
Confidence: 0.85
|
|
143
|
-
Files Analyzed: 1
|
|
144
|
-
|
|
145
|
-
REASONING:
|
|
146
|
-
The login implementation follows security best practices:
|
|
147
|
-
- Password hashing uses bcrypt with appropriate cost factor
|
|
148
|
-
- Rate limiting is implemented (5 attempts, 15 min lockout)
|
|
149
|
-
- Input validation prevents injection attacks
|
|
150
|
-
- Error messages don't leak user existence
|
|
151
|
-
|
|
152
|
-
No critical or high-severity issues found.
|
|
153
|
-
|
|
154
|
-
VERDICT: Implementation is solid and ready for use.
|
|
155
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
### Example 2: Validate staged changes
|
|
159
|
-
|
|
160
|
-
```
|
|
161
|
-
User: /specweave:judge --staged
|
|
162
|
-
|
|
163
|
-
Claude:
|
|
164
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
165
|
-
JUDGE VERDICT: CONCERNS
|
|
166
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
167
|
-
|
|
168
|
-
Confidence: 0.78
|
|
169
|
-
Files Analyzed: 3
|
|
170
|
-
|
|
171
|
-
REASONING:
|
|
172
|
-
Changes add new API endpoint but have some issues:
|
|
173
|
-
- Missing input validation on user-provided data
|
|
174
|
-
- Error messages could leak internal paths
|
|
175
|
-
- No rate limiting on new endpoint
|
|
176
|
-
|
|
177
|
-
🟡 HIGH: Missing Input Validation
|
|
178
|
-
User input passed directly to database query
|
|
179
|
-
📍 src/api/users.ts:45
|
|
180
|
-
💡 Add Zod schema validation before processing
|
|
181
|
-
|
|
182
|
-
🟡 HIGH: Information Disclosure
|
|
183
|
-
Stack traces exposed in error responses
|
|
184
|
-
📍 src/api/users.ts:62
|
|
185
|
-
💡 Use production error handler that sanitizes output
|
|
186
|
-
|
|
187
|
-
VERDICT: Address the input validation before merging.
|
|
188
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
### Example 3: Deep validation with fixes
|
|
192
|
-
|
|
193
|
-
```
|
|
194
|
-
User: /specweave:judge src/payments/checkout.ts --deep --fix
|
|
195
|
-
|
|
196
|
-
Claude:
|
|
197
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
198
|
-
JUDGE VERDICT: REJECTED
|
|
199
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
200
|
-
|
|
201
|
-
Confidence: 0.92
|
|
202
|
-
Files Analyzed: 1
|
|
203
|
-
|
|
204
|
-
REASONING:
|
|
205
|
-
Critical security issue found in payment processing:
|
|
206
|
-
- API key hardcoded in source file
|
|
207
|
-
- No HTTPS enforcement for payment requests
|
|
208
|
-
- Missing idempotency key handling
|
|
209
|
-
|
|
210
|
-
🔴 CRITICAL: Hardcoded API Key
|
|
211
|
-
Stripe API key exposed in source code
|
|
212
|
-
📍 src/payments/checkout.ts:12
|
|
213
|
-
💡 Move to environment variable:
|
|
214
|
-
```typescript
|
|
215
|
-
// Before (INSECURE)
|
|
216
|
-
const stripe = new Stripe('sk_live_xxx...');
|
|
217
|
-
|
|
218
|
-
// After (SECURE)
|
|
219
|
-
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!);
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
🔴 CRITICAL: No HTTPS Enforcement
|
|
223
|
-
Payment requests may go over HTTP
|
|
224
|
-
📍 src/payments/checkout.ts:34
|
|
225
|
-
💡 Add protocol check:
|
|
226
|
-
```typescript
|
|
227
|
-
if (process.env.NODE_ENV === 'production' && !req.secure) {
|
|
228
|
-
return res.status(403).json({ error: 'HTTPS required' });
|
|
229
|
-
}
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
VERDICT: MUST FIX before deployment - security critical.
|
|
233
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
## Difference from /specweave:qa
|
|
237
|
-
|
|
238
|
-
| Aspect | `/specweave:qa` | `/specweave:judge` |
|
|
239
|
-
|--------|-----------------|-------------------|
|
|
240
|
-
| **Scope** | Increments only | Any files |
|
|
241
|
-
| **Input** | Increment ID | Files, git diff |
|
|
242
|
-
| **Pattern** | 7-dimension scoring | Judge LLM reasoning |
|
|
243
|
-
| **Focus** | Spec quality, risks | Code correctness |
|
|
244
|
-
| **When** | Before increment close | After any work |
|
|
245
|
-
|
|
246
|
-
## Best Practices
|
|
247
|
-
|
|
248
|
-
1. **Use frequently**: Run during development, not just at the end
|
|
249
|
-
2. **Use `--staged`**: Validate before committing
|
|
250
|
-
3. **Use `--strict` for critical code**: Payment, auth, security
|
|
251
|
-
4. **Fix CRITICAL issues immediately**: Never ignore these
|
|
252
|
-
5. **Address CONCERNS before release**: They matter
|
|
253
|
-
6. **Use after bug fixes**: Especially effective when work has definitive expected behavior
|
|
254
|
-
|
|
255
|
-
**Simplest workflow** - just mention "llm judge" in your prompt:
|
|
256
|
-
```
|
|
257
|
-
"llm judge my fix"
|
|
258
|
-
"use llm judge on this"
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
Claude will automatically gather context and apply the pattern - no need to specify files.
|
|
262
|
-
|
|
263
|
-
This follows the [LLM-as-Judge pattern](https://www.anthropic.com/engineering/multi-agent-research-system) - single LLM call with structured evaluation proves more consistent than multiple validation passes.
|
|
264
|
-
|
|
265
|
-
## Limitations
|
|
266
|
-
|
|
267
|
-
- ❌ Doesn't execute tests (use test runners)
|
|
268
|
-
- ❌ Doesn't auto-apply fixes (only suggests)
|
|
269
|
-
- ❌ May miss domain-specific issues
|
|
270
|
-
- ❌ Not a replacement for human review
|
|
271
|
-
|
|
272
|
-
## Related
|
|
273
|
-
|
|
274
|
-
- `/specweave:qa` - Increment-bound quality assessment
|
|
275
|
-
- `/specweave-core:code-review` - Prompt-based code review
|
|
276
|
-
- `ado-sync-judge` agent - Uses judge pattern for sync validation
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: specweave-docs:preview
|
|
3
|
-
description: Launch Docusaurus documentation server for internal living docs. Validates docs first, auto-fixes issues, auto-setup on first run. Port 3015.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Documentation Preview Command
|
|
7
|
-
|
|
8
|
-
Launch Docusaurus development server with hot reload, Mermaid diagrams, and auto-generated sidebar.
|
|
9
|
-
|
|
10
|
-
**CRITICAL**: Runs pre-flight validation to catch issues BEFORE starting the server.
|
|
11
|
-
|
|
12
|
-
## Your Task
|
|
13
|
-
|
|
14
|
-
**IMPORTANT**: This command must work in ANY SpecWeave user project, not just the SpecWeave repo itself.
|
|
15
|
-
|
|
16
|
-
### Step 1: Check Prerequisites
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
# Verify internal docs exist
|
|
20
|
-
ls -la .specweave/docs/internal/
|
|
21
|
-
|
|
22
|
-
# If missing, inform user:
|
|
23
|
-
# "No internal documentation found at .specweave/docs/internal/.
|
|
24
|
-
# Run 'specweave init' first or create the folder structure."
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
### Step 1.5: CRITICAL - Run Pre-Flight Validation
|
|
28
|
-
|
|
29
|
-
**ALWAYS run validation BEFORE starting the server!**
|
|
30
|
-
|
|
31
|
-
```typescript
|
|
32
|
-
import { DocsValidator } from '../../../src/utils/docs-validator.js';
|
|
33
|
-
|
|
34
|
-
const validator = new DocsValidator({
|
|
35
|
-
docsPath: '.specweave/docs/internal',
|
|
36
|
-
autoFix: true, // Auto-fix common issues
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
console.log('\n🔍 Running pre-flight validation...\n');
|
|
40
|
-
const result = await validator.validate();
|
|
41
|
-
|
|
42
|
-
// Show summary
|
|
43
|
-
console.log(DocsValidator.formatResult(result));
|
|
44
|
-
|
|
45
|
-
// If errors remain after auto-fix, STOP and report
|
|
46
|
-
if (!result.valid) {
|
|
47
|
-
console.log('\n❌ Documentation has errors that must be fixed before preview.');
|
|
48
|
-
console.log(' Fix the issues above, then try again.\n');
|
|
49
|
-
process.exit(1);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
console.log('\n✅ Validation passed! Starting server...\n');
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
**What this catches:**
|
|
56
|
-
- YAML frontmatter errors (unquoted colons, tabs)
|
|
57
|
-
- MDX compatibility issues (unquoted attributes, unclosed tags)
|
|
58
|
-
- Duplicate routes
|
|
59
|
-
- Broken internal links
|
|
60
|
-
|
|
61
|
-
**Auto-fixes applied:**
|
|
62
|
-
- Wraps YAML values with colons in quotes
|
|
63
|
-
- Quotes HTML attributes
|
|
64
|
-
- Adds closing slashes to void elements (`<br>` → `<br />`)
|
|
65
|
-
- Converts tabs to spaces in YAML
|
|
66
|
-
|
|
67
|
-
### Step 2: Check for Cached Installation
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
# Check if Docusaurus is already set up in cache
|
|
71
|
-
if [ -d ".specweave/cache/docs-site/node_modules" ]; then
|
|
72
|
-
echo "✓ Docusaurus installation found in cache"
|
|
73
|
-
NEEDS_INSTALL=false
|
|
74
|
-
else
|
|
75
|
-
echo "⚙ First-time setup: Installing Docusaurus (~30 seconds)..."
|
|
76
|
-
NEEDS_INSTALL=true
|
|
77
|
-
fi
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### Step 3: First-Time Setup (if needed)
|
|
81
|
-
|
|
82
|
-
If `NEEDS_INSTALL=true`, create the cached Docusaurus installation:
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
# Create cache directory
|
|
86
|
-
mkdir -p .specweave/cache/docs-site
|
|
87
|
-
|
|
88
|
-
# Create package.json
|
|
89
|
-
cat > .specweave/cache/docs-site/package.json << 'EOF'
|
|
90
|
-
{
|
|
91
|
-
"name": "specweave-docs-preview",
|
|
92
|
-
"version": "1.0.0",
|
|
93
|
-
"private": true,
|
|
94
|
-
"scripts": {
|
|
95
|
-
"start": "docusaurus start --port 3015",
|
|
96
|
-
"build": "docusaurus build",
|
|
97
|
-
"clear": "docusaurus clear"
|
|
98
|
-
},
|
|
99
|
-
"dependencies": {
|
|
100
|
-
"@docusaurus/core": "^3.9.2",
|
|
101
|
-
"@docusaurus/preset-classic": "^3.9.2",
|
|
102
|
-
"@docusaurus/theme-mermaid": "^3.9.2",
|
|
103
|
-
"@mdx-js/react": "^3.0.0",
|
|
104
|
-
"clsx": "^2.0.0",
|
|
105
|
-
"prism-react-renderer": "^2.3.0",
|
|
106
|
-
"react": "^19.0.0",
|
|
107
|
-
"react-dom": "^19.0.0"
|
|
108
|
-
},
|
|
109
|
-
"engines": {
|
|
110
|
-
"node": ">=20.0"
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
EOF
|
|
114
|
-
|
|
115
|
-
# Create Docusaurus config pointing to internal docs
|
|
116
|
-
cat > .specweave/cache/docs-site/docusaurus.config.ts << 'EOF'
|
|
117
|
-
import {themes as prismThemes} from 'prism-react-renderer';
|
|
118
|
-
import type {Config} from '@docusaurus/types';
|
|
119
|
-
import type * as Preset from '@docusaurus/preset-classic';
|
|
120
|
-
|
|
121
|
-
const config: Config = {
|
|
122
|
-
title: 'Internal Documentation',
|
|
123
|
-
tagline: 'SpecWeave Living Documentation',
|
|
124
|
-
favicon: 'img/favicon.ico',
|
|
125
|
-
future: { v4: true },
|
|
126
|
-
url: 'http://localhost:3015',
|
|
127
|
-
baseUrl: '/',
|
|
128
|
-
onBrokenLinks: 'warn',
|
|
129
|
-
onBrokenMarkdownLinks: 'warn',
|
|
130
|
-
i18n: { defaultLocale: 'en', locales: ['en'] },
|
|
131
|
-
markdown: { mermaid: true, format: 'md' },
|
|
132
|
-
themes: ['@docusaurus/theme-mermaid'],
|
|
133
|
-
presets: [
|
|
134
|
-
[
|
|
135
|
-
'classic',
|
|
136
|
-
{
|
|
137
|
-
docs: {
|
|
138
|
-
// Path relative to this config file → ../../docs/internal/
|
|
139
|
-
path: '../../docs/internal',
|
|
140
|
-
routeBasePath: '/',
|
|
141
|
-
sidebarPath: './sidebars.ts',
|
|
142
|
-
showLastUpdateTime: true,
|
|
143
|
-
sidebarCollapsible: true,
|
|
144
|
-
sidebarCollapsed: true,
|
|
145
|
-
},
|
|
146
|
-
blog: false,
|
|
147
|
-
theme: { customCss: './src/css/custom.css' },
|
|
148
|
-
} satisfies Preset.Options,
|
|
149
|
-
],
|
|
150
|
-
],
|
|
151
|
-
themeConfig: {
|
|
152
|
-
colorMode: {
|
|
153
|
-
defaultMode: 'dark',
|
|
154
|
-
disableSwitch: false,
|
|
155
|
-
respectPrefersColorScheme: true,
|
|
156
|
-
},
|
|
157
|
-
navbar: {
|
|
158
|
-
title: 'Internal Docs',
|
|
159
|
-
items: [
|
|
160
|
-
{to: '/', label: 'Home', position: 'left'},
|
|
161
|
-
{type: 'search', position: 'right'},
|
|
162
|
-
],
|
|
163
|
-
},
|
|
164
|
-
footer: {
|
|
165
|
-
style: 'dark',
|
|
166
|
-
copyright: `SpecWeave Living Documentation`,
|
|
167
|
-
},
|
|
168
|
-
prism: {
|
|
169
|
-
theme: prismThemes.github,
|
|
170
|
-
darkTheme: prismThemes.dracula,
|
|
171
|
-
additionalLanguages: ['bash', 'typescript', 'yaml', 'json'],
|
|
172
|
-
},
|
|
173
|
-
mermaid: { theme: {light: 'neutral', dark: 'dark'} },
|
|
174
|
-
} satisfies Preset.ThemeConfig,
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
export default config;
|
|
178
|
-
EOF
|
|
179
|
-
|
|
180
|
-
# Create auto-generated sidebar
|
|
181
|
-
cat > .specweave/cache/docs-site/sidebars.ts << 'EOF'
|
|
182
|
-
import type {SidebarsConfig} from '@docusaurus/plugin-content-docs';
|
|
183
|
-
|
|
184
|
-
const sidebars: SidebarsConfig = {
|
|
185
|
-
docs: [
|
|
186
|
-
{
|
|
187
|
-
type: 'autogenerated',
|
|
188
|
-
dirName: '.',
|
|
189
|
-
},
|
|
190
|
-
],
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
export default sidebars;
|
|
194
|
-
EOF
|
|
195
|
-
|
|
196
|
-
# Create minimal CSS
|
|
197
|
-
mkdir -p .specweave/cache/docs-site/src/css
|
|
198
|
-
cat > .specweave/cache/docs-site/src/css/custom.css << 'EOF'
|
|
199
|
-
:root {
|
|
200
|
-
--ifm-color-primary: #2563eb;
|
|
201
|
-
--ifm-code-font-size: 95%;
|
|
202
|
-
}
|
|
203
|
-
[data-theme='dark'] {
|
|
204
|
-
--ifm-color-primary: #60a5fa;
|
|
205
|
-
}
|
|
206
|
-
EOF
|
|
207
|
-
|
|
208
|
-
# Create static folder with placeholder favicon
|
|
209
|
-
mkdir -p .specweave/cache/docs-site/static/img
|
|
210
|
-
echo '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y=".9em" font-size="90">📚</text></svg>' > .specweave/cache/docs-site/static/img/favicon.ico
|
|
211
|
-
|
|
212
|
-
# Install dependencies using PUBLIC npm registry (avoids Azure DevOps/private registry issues)
|
|
213
|
-
cd .specweave/cache/docs-site && npm install --registry=https://registry.npmjs.org --legacy-peer-deps
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
### Step 4: Start the Server
|
|
217
|
-
|
|
218
|
-
```bash
|
|
219
|
-
cd .specweave/cache/docs-site && npm start
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
This will:
|
|
223
|
-
- Start Docusaurus on **http://localhost:3015**
|
|
224
|
-
- Enable hot reload (edit markdown, see changes instantly)
|
|
225
|
-
- Render Mermaid diagrams
|
|
226
|
-
- Auto-generate sidebar from folder structure
|
|
227
|
-
|
|
228
|
-
### Output to User
|
|
229
|
-
|
|
230
|
-
After starting, display:
|
|
231
|
-
|
|
232
|
-
```
|
|
233
|
-
📚 Documentation Preview Server Started!
|
|
234
|
-
|
|
235
|
-
URL: http://localhost:3015
|
|
236
|
-
Content: .specweave/docs/internal/
|
|
237
|
-
|
|
238
|
-
Features:
|
|
239
|
-
• Hot reload - edit markdown, see changes instantly
|
|
240
|
-
• Mermaid diagrams - architecture diagrams render beautifully
|
|
241
|
-
• Auto sidebar - generated from folder structure
|
|
242
|
-
• Dark/light mode - toggle in navbar
|
|
243
|
-
|
|
244
|
-
Press Ctrl+C to stop the server.
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
## What You Get
|
|
248
|
-
|
|
249
|
-
- **Hot reload** - Edit markdown, see changes instantly
|
|
250
|
-
- **Auto sidebar** - Generated from folder structure
|
|
251
|
-
- **Mermaid diagrams** - Architecture diagrams render beautifully
|
|
252
|
-
- **Dark/light mode** - Toggle in navbar
|
|
253
|
-
- **Local search** - Instant search across all docs
|
|
254
|
-
|
|
255
|
-
## Troubleshooting
|
|
256
|
-
|
|
257
|
-
### Port already in use
|
|
258
|
-
```bash
|
|
259
|
-
lsof -i :3015 && kill -9 $(lsof -t -i :3015)
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
### Reinstall from scratch
|
|
263
|
-
```bash
|
|
264
|
-
rm -rf .specweave/cache/docs-site && /specweave-docs:preview
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
### npm registry issues
|
|
268
|
-
The setup uses `--registry=https://registry.npmjs.org` to bypass private registry configurations.
|
|
269
|
-
|
|
270
|
-
## See Also
|
|
271
|
-
|
|
272
|
-
- `/specweave-docs:build` - Build static site for deployment
|
|
273
|
-
- `/specweave-docs:organize` - Generate themed indexes for large folders
|
|
274
|
-
- `/specweave-docs:health` - Documentation health report
|