@pjmendonca/devflow 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/CHANGELOG.md +526 -0
  2. package/LICENSE +21 -0
  3. package/README.md +620 -0
  4. package/bin/devflow-checkpoint.js +10 -0
  5. package/bin/devflow-collab.js +10 -0
  6. package/bin/devflow-cost.js +10 -0
  7. package/bin/devflow-create-persona.js +10 -0
  8. package/bin/devflow-init.js +10 -0
  9. package/bin/devflow-memory.js +10 -0
  10. package/bin/devflow-new-doc.js +10 -0
  11. package/bin/devflow-personalize.js +10 -0
  12. package/bin/devflow-setup-checkpoint.js +10 -0
  13. package/bin/devflow-story.js +10 -0
  14. package/bin/devflow-tech-debt.js +10 -0
  15. package/bin/devflow-validate-overrides.js +10 -0
  16. package/bin/devflow-validate.js +10 -0
  17. package/bin/devflow-version.js +10 -0
  18. package/lib/constants.js +30 -0
  19. package/lib/exec-python.js +78 -0
  20. package/lib/python-check.js +178 -0
  21. package/package.json +64 -0
  22. package/tooling/.automation/agents/architect.md +135 -0
  23. package/tooling/.automation/agents/ba.md +70 -0
  24. package/tooling/.automation/agents/dev.md +79 -0
  25. package/tooling/.automation/agents/maintainer.md +97 -0
  26. package/tooling/.automation/agents/pm.md +116 -0
  27. package/tooling/.automation/agents/reviewer.md +141 -0
  28. package/tooling/.automation/agents/sm.md +61 -0
  29. package/tooling/.automation/agents/writer.md +193 -0
  30. package/tooling/.automation/config.ps1.template +61 -0
  31. package/tooling/.automation/config.sh.template +48 -0
  32. package/tooling/.automation/memory/.gitkeep +6 -0
  33. package/tooling/.automation/memory/knowledge/kg_integration-test.json +94 -0
  34. package/tooling/.automation/memory/knowledge/kg_test-story.json +300 -0
  35. package/tooling/.automation/memory/shared/shared_integration-test.json +30 -0
  36. package/tooling/.automation/memory/shared/shared_test-story.json +78 -0
  37. package/tooling/.automation/overrides/templates/README.md +113 -0
  38. package/tooling/.automation/overrides/templates/architect/README.md +27 -0
  39. package/tooling/.automation/overrides/templates/architect/cloud-native.yaml +92 -0
  40. package/tooling/.automation/overrides/templates/architect/enterprise-architect.yaml +85 -0
  41. package/tooling/.automation/overrides/templates/architect/pragmatic-minimalist.yaml +88 -0
  42. package/tooling/.automation/overrides/templates/ba/README.md +27 -0
  43. package/tooling/.automation/overrides/templates/ba/agile-storyteller.yaml +86 -0
  44. package/tooling/.automation/overrides/templates/ba/domain-expert.yaml +91 -0
  45. package/tooling/.automation/overrides/templates/ba/requirements-engineer.yaml +89 -0
  46. package/tooling/.automation/overrides/templates/dev/README.md +32 -0
  47. package/tooling/.automation/overrides/templates/dev/junior-mentored.yaml +39 -0
  48. package/tooling/.automation/overrides/templates/dev/performance-engineer.yaml +43 -0
  49. package/tooling/.automation/overrides/templates/dev/rapid-prototyper.yaml +52 -0
  50. package/tooling/.automation/overrides/templates/dev/security-focused.yaml +43 -0
  51. package/tooling/.automation/overrides/templates/dev/senior-fullstack.yaml +39 -0
  52. package/tooling/.automation/overrides/templates/maintainer/README.md +27 -0
  53. package/tooling/.automation/overrides/templates/maintainer/devops-maintainer.yaml +113 -0
  54. package/tooling/.automation/overrides/templates/maintainer/legacy-steward.yaml +94 -0
  55. package/tooling/.automation/overrides/templates/maintainer/oss-maintainer.yaml +94 -0
  56. package/tooling/.automation/overrides/templates/pm/README.md +27 -0
  57. package/tooling/.automation/overrides/templates/pm/agile-pm.yaml +91 -0
  58. package/tooling/.automation/overrides/templates/pm/hybrid-delivery.yaml +87 -0
  59. package/tooling/.automation/overrides/templates/pm/traditional-pm.yaml +91 -0
  60. package/tooling/.automation/overrides/templates/reviewer/README.md +11 -0
  61. package/tooling/.automation/overrides/templates/reviewer/mentoring-reviewer.yaml +45 -0
  62. package/tooling/.automation/overrides/templates/reviewer/quick-sanity.yaml +50 -0
  63. package/tooling/.automation/overrides/templates/reviewer/thorough-critic.yaml +48 -0
  64. package/tooling/.automation/overrides/templates/sm/README.md +11 -0
  65. package/tooling/.automation/overrides/templates/sm/agile-coach.yaml +52 -0
  66. package/tooling/.automation/overrides/templates/sm/startup-pm.yaml +50 -0
  67. package/tooling/.automation/overrides/templates/sm/technical-lead.yaml +47 -0
  68. package/tooling/.automation/overrides/templates/user-profile.template.yaml +62 -0
  69. package/tooling/.automation/overrides/templates/writer/README.md +27 -0
  70. package/tooling/.automation/overrides/templates/writer/api-documentarian.yaml +99 -0
  71. package/tooling/.automation/overrides/templates/writer/docs-as-code.yaml +108 -0
  72. package/tooling/.automation/overrides/templates/writer/user-guide-author.yaml +100 -0
  73. package/tooling/completions/DevflowCompletion.ps1 +213 -0
  74. package/tooling/completions/_run-story +116 -0
  75. package/tooling/completions/run-story-completion.bash +136 -0
  76. package/tooling/docs/DOC-STANDARD.md +717 -0
  77. package/tooling/docs/sprint-status.yaml.template +24 -0
  78. package/tooling/docs/templates/bug-report.md +234 -0
  79. package/tooling/docs/templates/migration-spec.md +274 -0
  80. package/tooling/docs/templates/refactor-spec.md +86 -0
  81. package/tooling/docs/templates/tech-debt.md +86 -0
  82. package/tooling/scripts/context_checkpoint.py +556 -0
  83. package/tooling/scripts/cost_dashboard.py +617 -0
  84. package/tooling/scripts/create-persona.py +690 -0
  85. package/tooling/scripts/create-persona.sh +435 -0
  86. package/tooling/scripts/init-project-workflow.ps1 +651 -0
  87. package/tooling/scripts/init-project-workflow.py +70 -0
  88. package/tooling/scripts/init-project-workflow.sh +746 -0
  89. package/tooling/scripts/lib/__init__.py +35 -0
  90. package/tooling/scripts/lib/agent_handoff.py +526 -0
  91. package/tooling/scripts/lib/agent_router.py +698 -0
  92. package/tooling/scripts/lib/checkpoint-integration.ps1 +245 -0
  93. package/tooling/scripts/lib/checkpoint-integration.sh +191 -0
  94. package/tooling/scripts/lib/claude-cli.ps1 +952 -0
  95. package/tooling/scripts/lib/claude-cli.sh +1293 -0
  96. package/tooling/scripts/lib/cost_config.py +222 -0
  97. package/tooling/scripts/lib/cost_display.py +443 -0
  98. package/tooling/scripts/lib/cost_tracker.py +710 -0
  99. package/tooling/scripts/lib/currency_converter.py +328 -0
  100. package/tooling/scripts/lib/errors.py +438 -0
  101. package/tooling/scripts/lib/override-loader.sh +286 -0
  102. package/tooling/scripts/lib/pair_programming.py +589 -0
  103. package/tooling/scripts/lib/shared_memory.py +637 -0
  104. package/tooling/scripts/lib/swarm_orchestrator.py +689 -0
  105. package/tooling/scripts/memory_summarize.py +324 -0
  106. package/tooling/scripts/new-doc.ps1 +405 -0
  107. package/tooling/scripts/new-doc.py +93 -0
  108. package/tooling/scripts/new-doc.sh +534 -0
  109. package/tooling/scripts/personalize_agent.py +385 -0
  110. package/tooling/scripts/rollback-migration.sh +540 -0
  111. package/tooling/scripts/run-collab.ps1 +251 -0
  112. package/tooling/scripts/run-collab.py +605 -0
  113. package/tooling/scripts/run-collab.sh +110 -0
  114. package/tooling/scripts/run-story.ps1 +490 -0
  115. package/tooling/scripts/run-story.py +387 -0
  116. package/tooling/scripts/run-story.sh +467 -0
  117. package/tooling/scripts/setup-checkpoint-service.ps1 +219 -0
  118. package/tooling/scripts/setup-checkpoint-service.py +87 -0
  119. package/tooling/scripts/setup-checkpoint-service.sh +236 -0
  120. package/tooling/scripts/tech-debt-tracker.py +608 -0
  121. package/tooling/scripts/update_version.py +244 -0
  122. package/tooling/scripts/validate-overrides.py +511 -0
  123. package/tooling/scripts/validate-overrides.sh +432 -0
  124. package/tooling/scripts/validate_setup.py +539 -0
@@ -0,0 +1,93 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Cross-Platform Documentation Generator
4
+
5
+ Automatically detects the operating system and runs the appropriate script.
6
+ Works on Windows, macOS, and Linux.
7
+
8
+ Usage:
9
+ python new-doc.py --type <type> --name <name> [--author <name>]
10
+
11
+ Examples:
12
+ python new-doc.py --type guide --name "setup-guide"
13
+ python new-doc.py --type spec --name "epic-4" --author "SM Agent"
14
+ """
15
+
16
+ import os
17
+ import subprocess
18
+ import sys
19
+ from pathlib import Path
20
+
21
+ SCRIPT_DIR = Path(__file__).parent
22
+
23
+
24
+ def get_platform():
25
+ """Detect the current platform."""
26
+ if sys.platform == "win32":
27
+ return "windows"
28
+ elif sys.platform == "darwin":
29
+ return "macos"
30
+ else:
31
+ return "linux"
32
+
33
+
34
+ def run_windows(args):
35
+ """Run PowerShell script on Windows."""
36
+ script = SCRIPT_DIR / "new-doc.ps1"
37
+
38
+ if not script.exists():
39
+ print(f"Error: PowerShell script not found: {script}")
40
+ return 1
41
+
42
+ # Convert args to PowerShell format
43
+ ps_args = []
44
+ i = 0
45
+ while i < len(args):
46
+ arg = args[i]
47
+ if arg.startswith("--"):
48
+ # Convert --type to -Type
49
+ param_name = arg[2:].title()
50
+ ps_args.append(f"-{param_name}")
51
+ else:
52
+ ps_args.append(arg)
53
+ i += 1
54
+
55
+ cmd = ["powershell", "-ExecutionPolicy", "Bypass", "-File", str(script)] + ps_args
56
+ return subprocess.call(cmd)
57
+
58
+
59
+ def run_unix(args):
60
+ """Run shell script on macOS/Linux."""
61
+ script = SCRIPT_DIR / "new-doc.sh"
62
+
63
+ if not script.exists():
64
+ print(f"Error: Shell script not found: {script}")
65
+ return 1
66
+
67
+ # Ensure script is executable
68
+ os.chmod(script, 0o755)
69
+
70
+ cmd = [str(script)] + args
71
+ return subprocess.call(cmd)
72
+
73
+
74
+ def main():
75
+ if len(sys.argv) < 2:
76
+ print(__doc__)
77
+ print("\nDetected platform:", get_platform())
78
+ return 1
79
+
80
+ args = sys.argv[1:]
81
+ platform = get_platform()
82
+
83
+ print(f"Platform: {platform}")
84
+ print()
85
+
86
+ if platform == "windows":
87
+ return run_windows(args)
88
+ else:
89
+ return run_unix(args)
90
+
91
+
92
+ if __name__ == "__main__":
93
+ sys.exit(main())
@@ -0,0 +1,534 @@
1
+ #!/usr/bin/env bash
2
+ ################################################################################
3
+ # NEW-DOC - Documentation Template Generator
4
+ #
5
+ # Creates new documentation files following the Stronger documentation standard
6
+ #
7
+ # Usage:
8
+ # ./new-doc.sh --type guide --name "checkpoint-setup"
9
+ # ./new-doc.sh --type spec --name "epic-4"
10
+ # ./new-doc.sh --type status --name "integration-report"
11
+ ################################################################################
12
+
13
+ set -e
14
+
15
+ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
16
+ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
17
+ DOCS_DIR="$PROJECT_ROOT/tooling/docs"
18
+
19
+ # Colors
20
+ GREEN='\033[0;32m'
21
+ YELLOW='\033[1;33m'
22
+ BLUE='\033[0;34m'
23
+ RED='\033[0;31m'
24
+ NC='\033[0m'
25
+
26
+ print_usage() {
27
+ cat << EOF
28
+ Usage: ./new-doc.sh --type <type> --name <name> [options]
29
+
30
+ Options:
31
+ --type <type> Document type (guide|spec|status|reference|example)
32
+ --name <name> Document name (kebab-case)
33
+ --author <name> Author name (default: current user)
34
+ --help Show this help message
35
+
36
+ Examples:
37
+ ./new-doc.sh --type guide --name "checkpoint-setup"
38
+ ./new-doc.sh --type spec --name "epic-4" --author "SM Agent"
39
+ ./new-doc.sh --type status --name "sprint-report"
40
+
41
+ Document types:
42
+ guide - User-facing guides and tutorials
43
+ spec - Technical specifications
44
+ status - Status reports and tracking
45
+ reference - Quick reference sheets
46
+ example - Code examples and patterns
47
+
48
+ EOF
49
+ }
50
+
51
+ create_guide_template() {
52
+ local name="$1"
53
+ local author="$2"
54
+ local date=$(date +%Y-%m-%d)
55
+
56
+ cat << 'EOF'
57
+ # [Document Title]
58
+
59
+ **Type**: Guide
60
+ **Version**: 1.0
61
+ **Last Updated**: ${date}
62
+ **Author**: ${author}
63
+ **Status**: Draft
64
+
65
+ ---
66
+
67
+ ## Purpose
68
+
69
+ [1-2 sentence description of what this guide helps users accomplish]
70
+
71
+ ## Table of Contents
72
+
73
+ - [Prerequisites](#prerequisites)
74
+ - [Quick Start](#quick-start)
75
+ - [Step-by-Step Instructions](#step-by-step-instructions)
76
+ - [Examples](#examples)
77
+ - [Troubleshooting](#troubleshooting)
78
+ - [Next Steps](#next-steps)
79
+ - [Related Documents](#related-documents)
80
+
81
+ ---
82
+
83
+ ## Prerequisites
84
+
85
+ Before starting, ensure you have:
86
+
87
+ - [ ] Prerequisite 1
88
+ - [ ] Prerequisite 2
89
+ - [ ] Prerequisite 3
90
+
91
+ ---
92
+
93
+ ## Quick Start
94
+
95
+ For experienced users:
96
+
97
+ ```bash
98
+ # Quick command to get started
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Step-by-Step Instructions
104
+
105
+ ### Step 1: [First Step]
106
+
107
+ Description of what to do.
108
+
109
+ ```bash
110
+ # Command to run
111
+ ```
112
+
113
+ **Expected output**:
114
+ ```
115
+ Output here
116
+ ```
117
+
118
+ ### Step 2: [Second Step]
119
+
120
+ Description of what to do.
121
+
122
+ ```bash
123
+ # Command to run
124
+ ```
125
+
126
+ ---
127
+
128
+ ## Examples
129
+
130
+ ### Example 1: [Common Use Case]
131
+
132
+ **Problem**: [What problem this solves]
133
+
134
+ **Solution**:
135
+ ```bash
136
+ # Commands
137
+ ```
138
+
139
+ **Result**: [What happens]
140
+
141
+ ---
142
+
143
+ ## Troubleshooting
144
+
145
+ ### Issue: [Common Problem]
146
+
147
+ **Symptoms**: [What you see]
148
+
149
+ **Cause**: [Why it happens]
150
+
151
+ **Solution**:
152
+ ```bash
153
+ # Fix commands
154
+ ```
155
+
156
+ ---
157
+
158
+ ## Next Steps
159
+
160
+ After completing this guide:
161
+
162
+ 1. [Next logical step]
163
+ 2. [Another option]
164
+ 3. [Advanced topics]
165
+
166
+ ---
167
+
168
+ ## Related Documents
169
+
170
+ - [Link](path) - Description
171
+ - [Link](path) - Description
172
+
173
+ ---
174
+
175
+ ## Changelog
176
+
177
+ ### 1.0 (${date})
178
+ - Initial version
179
+
180
+ ---
181
+
182
+ **Document Control**
183
+ - **Created**: ${date}
184
+ - **Last Reviewed**: ${date}
185
+ - **Next Review**: [Date +1 month]
186
+ - **Owner**: ${author}
187
+ EOF
188
+ }
189
+
190
+ create_spec_template() {
191
+ local name="$1"
192
+ local author="$2"
193
+ local date=$(date +%Y-%m-%d)
194
+
195
+ cat << 'EOF'
196
+ # [Technical Specification Title]
197
+
198
+ **Type**: Spec
199
+ **Version**: 1.0
200
+ **Last Updated**: ${date}
201
+ **Author**: ${author}
202
+ **Status**: Draft
203
+
204
+ ---
205
+
206
+ ## Overview
207
+
208
+ [High-level description of what is being specified]
209
+
210
+ ## Table of Contents
211
+
212
+ - [Objectives and Scope](#objectives-and-scope)
213
+ - [Architecture](#architecture)
214
+ - [Implementation Details](#implementation-details)
215
+ - [Dependencies](#dependencies)
216
+ - [Testing Requirements](#testing-requirements)
217
+ - [Acceptance Criteria](#acceptance-criteria)
218
+
219
+ ---
220
+
221
+ ## Objectives and Scope
222
+
223
+ ### In Scope
224
+ - Feature 1
225
+ - Feature 2
226
+ - Feature 3
227
+
228
+ ### Out of Scope
229
+ - Feature A
230
+ - Feature B
231
+ - Feature C
232
+
233
+ ### Success Criteria
234
+ - [ ] Criterion 1
235
+ - [ ] Criterion 2
236
+ - [ ] Criterion 3
237
+
238
+ ---
239
+
240
+ ## Architecture
241
+
242
+ ### System Components
243
+
244
+ ```
245
+ [ASCII diagram or description]
246
+ ```
247
+
248
+ ### Data Flow
249
+
250
+ ```
251
+ [Flow description]
252
+ ```
253
+
254
+ ---
255
+
256
+ ## Implementation Details
257
+
258
+ ### Component 1: [Name]
259
+
260
+ **Purpose**: [What it does]
261
+
262
+ **Files to Create**:
263
+ - `path/to/file1.dart`
264
+ - `path/to/file2.dart`
265
+
266
+ **Files to Modify**:
267
+ - `path/to/existing.dart`
268
+
269
+ **Implementation**:
270
+ ```dart
271
+ // Code example
272
+ ```
273
+
274
+ ---
275
+
276
+ ## Dependencies
277
+
278
+ | Dependency | Version | Purpose |
279
+ |-----------|---------|---------|
280
+ | package_name | ^1.0.0 | Description |
281
+
282
+ ---
283
+
284
+ ## Testing Requirements
285
+
286
+ ### Unit Tests
287
+ - [ ] Test scenario 1
288
+ - [ ] Test scenario 2
289
+
290
+ ### Integration Tests
291
+ - [ ] Test scenario 1
292
+ - [ ] Test scenario 2
293
+
294
+ ### Test Coverage Target
295
+ - Minimum: 80%
296
+ - Target: 90%
297
+
298
+ ---
299
+
300
+ ## Acceptance Criteria
301
+
302
+ - [ ] AC 1: [Specific, measurable criterion]
303
+ - [ ] AC 2: [Specific, measurable criterion]
304
+ - [ ] AC 3: [Specific, measurable criterion]
305
+
306
+ ---
307
+
308
+ ## Related Documents
309
+
310
+ - [Link](path) - Description
311
+
312
+ ---
313
+
314
+ ## Changelog
315
+
316
+ ### 1.0 (${date})
317
+ - Initial specification
318
+
319
+ ---
320
+
321
+ **Document Control**
322
+ - **Created**: ${date}
323
+ - **Last Reviewed**: ${date}
324
+ - **Next Review**: [Date +1 month]
325
+ - **Owner**: ${author}
326
+ EOF
327
+ }
328
+
329
+ create_status_template() {
330
+ local name="$1"
331
+ local author="$2"
332
+ local date=$(date +%Y-%m-%d)
333
+
334
+ cat << 'EOF'
335
+ # [Status Report Title]
336
+
337
+ **Type**: Status
338
+ **Version**: 1.0
339
+ **Last Updated**: ${date}
340
+ **Author**: ${author}
341
+ **Status**: Active
342
+
343
+ ---
344
+
345
+ ## Current Status
346
+
347
+ **Overall**: [Green/Yellow/Red]
348
+
349
+ **Summary**: [1-sentence current state]
350
+
351
+ ---
352
+
353
+ ## Integration Points
354
+
355
+ | Component | Status | Notes |
356
+ |-----------|--------|-------|
357
+ | Component 1 | ✅ Complete | Working as expected |
358
+ | Component 2 | 🚧 In Progress | 75% complete |
359
+ | Component 3 | ⚪ Not Started | Planned for next week |
360
+
361
+ ---
362
+
363
+ ## What's Working
364
+
365
+ ✅ Feature 1 - Fully operational
366
+ ✅ Feature 2 - Deployed and tested
367
+ ✅ Feature 3 - In production
368
+
369
+ ---
370
+
371
+ ## What's Not Working
372
+
373
+ ❌ Issue 1 - Description
374
+ ⚠️ Issue 2 - Description
375
+
376
+ ---
377
+
378
+ ## Metrics
379
+
380
+ | Metric | Value | Target | Status |
381
+ |--------|-------|--------|--------|
382
+ | Coverage | 85% | 80% | ✅ |
383
+ | Performance | 200ms | <300ms | ✅ |
384
+ | Bugs | 3 | <5 | ✅ |
385
+
386
+ ---
387
+
388
+ ## Next Steps
389
+
390
+ ### Immediate (This Week)
391
+ 1. [ ] Task 1
392
+ 2. [ ] Task 2
393
+
394
+ ### Short Term (Next Week)
395
+ 1. [ ] Task 3
396
+ 2. [ ] Task 4
397
+
398
+ ### Long Term
399
+ 1. [ ] Goal 1
400
+ 2. [ ] Goal 2
401
+
402
+ ---
403
+
404
+ ## Related Documents
405
+
406
+ - [Link](path) - Description
407
+
408
+ ---
409
+
410
+ ## Changelog
411
+
412
+ ### 1.0 (${date})
413
+ - Initial status report
414
+
415
+ ---
416
+
417
+ **Document Control**
418
+ - **Created**: ${date}
419
+ - **Last Reviewed**: ${date}
420
+ - **Next Review**: [Weekly/Monthly]
421
+ - **Owner**: ${author}
422
+ EOF
423
+ }
424
+
425
+ main() {
426
+ local doc_type=""
427
+ local doc_name=""
428
+ local author="$(whoami)"
429
+
430
+ # Parse arguments
431
+ while [[ $# -gt 0 ]]; do
432
+ case "$1" in
433
+ --type)
434
+ doc_type="$2"
435
+ shift 2
436
+ ;;
437
+ --name)
438
+ doc_name="$2"
439
+ shift 2
440
+ ;;
441
+ --author)
442
+ author="$2"
443
+ shift 2
444
+ ;;
445
+ --help)
446
+ print_usage
447
+ exit 0
448
+ ;;
449
+ *)
450
+ echo -e "${RED}Unknown option: $1${NC}"
451
+ print_usage
452
+ exit 1
453
+ ;;
454
+ esac
455
+ done
456
+
457
+ # Validate required arguments
458
+ if [[ -z "$doc_type" || -z "$doc_name" ]]; then
459
+ echo -e "${RED}Error: --type and --name are required${NC}"
460
+ print_usage
461
+ exit 1
462
+ fi
463
+
464
+ # Validate document type
465
+ case "$doc_type" in
466
+ guide|spec|status|reference|example)
467
+ ;;
468
+ *)
469
+ echo -e "${RED}Error: Invalid type '$doc_type'${NC}"
470
+ echo -e "${YELLOW}Valid types: guide, spec, status, reference, example${NC}"
471
+ exit 1
472
+ ;;
473
+ esac
474
+
475
+ # Create filename
476
+ local filename="${doc_type^^}-${doc_name}.md"
477
+ local subdir="$DOCS_DIR"
478
+ local output_file="$subdir/$filename"
479
+
480
+ # Create subdirectory if needed (future organization)
481
+ # mkdir -p "$subdir"
482
+
483
+ # Check if file exists
484
+ if [[ -f "$output_file" ]]; then
485
+ echo -e "${YELLOW}File already exists: $output_file${NC}"
486
+ echo -e "${YELLOW}Overwrite? (y/n)${NC}"
487
+ read -r OVERWRITE
488
+ if [[ ! "$OVERWRITE" =~ ^[Yy]$ ]]; then
489
+ echo -e "${BLUE}Aborted.${NC}"
490
+ exit 0
491
+ fi
492
+ fi
493
+
494
+ # Generate template
495
+ echo -e "${BLUE}Creating $doc_type document: $filename${NC}"
496
+
497
+ local template=""
498
+ case "$doc_type" in
499
+ guide)
500
+ template=$(create_guide_template "$doc_name" "$author")
501
+ ;;
502
+ spec)
503
+ template=$(create_spec_template "$doc_name" "$author")
504
+ ;;
505
+ status)
506
+ template=$(create_status_template "$doc_name" "$author")
507
+ ;;
508
+ reference)
509
+ template=$(create_guide_template "$doc_name" "$author") # Similar to guide
510
+ ;;
511
+ example)
512
+ template=$(create_guide_template "$doc_name" "$author") # Similar to guide
513
+ ;;
514
+ esac
515
+
516
+ # Substitute variables in template
517
+ local date=$(date +%Y-%m-%d)
518
+ template="${template//\$\{date\}/$date}"
519
+ template="${template//\$\{author\}/$author}"
520
+
521
+ # Write file
522
+ echo "$template" > "$output_file"
523
+
524
+ echo -e "${GREEN}✅ Created: $output_file${NC}"
525
+ echo ""
526
+ echo -e "${BLUE}Next steps:${NC}"
527
+ echo " 1. Edit the document: $output_file"
528
+ echo " 2. Fill in the template placeholders"
529
+ echo " 3. Review against: tooling/docs/DOC-STANDARD.md"
530
+ echo " 4. Validate: ./tooling/scripts/validate-doc.sh $output_file"
531
+ echo ""
532
+ }
533
+
534
+ main "$@"