@qazuor/claude-code-config 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1248 -0
  3. package/dist/bin.cjs +11886 -0
  4. package/dist/bin.cjs.map +1 -0
  5. package/dist/bin.d.cts +1 -0
  6. package/dist/bin.d.ts +1 -0
  7. package/dist/bin.js +11869 -0
  8. package/dist/bin.js.map +1 -0
  9. package/dist/index.cjs +3887 -0
  10. package/dist/index.cjs.map +1 -0
  11. package/dist/index.d.cts +1325 -0
  12. package/dist/index.d.ts +1325 -0
  13. package/dist/index.js +3835 -0
  14. package/dist/index.js.map +1 -0
  15. package/package.json +86 -0
  16. package/templates/.log/notifications.log +1775 -0
  17. package/templates/agents/README.md +164 -0
  18. package/templates/agents/_registry.json +443 -0
  19. package/templates/agents/design/content-writer.md +353 -0
  20. package/templates/agents/design/ux-ui-designer.md +382 -0
  21. package/templates/agents/engineering/astro-engineer.md +293 -0
  22. package/templates/agents/engineering/db-drizzle-engineer.md +360 -0
  23. package/templates/agents/engineering/express-engineer.md +316 -0
  24. package/templates/agents/engineering/fastify-engineer.md +399 -0
  25. package/templates/agents/engineering/hono-engineer.md +263 -0
  26. package/templates/agents/engineering/mongoose-engineer.md +473 -0
  27. package/templates/agents/engineering/nestjs-engineer.md +429 -0
  28. package/templates/agents/engineering/nextjs-engineer.md +451 -0
  29. package/templates/agents/engineering/node-typescript-engineer.md +347 -0
  30. package/templates/agents/engineering/prisma-engineer.md +432 -0
  31. package/templates/agents/engineering/react-senior-dev.md +394 -0
  32. package/templates/agents/engineering/tanstack-start-engineer.md +447 -0
  33. package/templates/agents/engineering/tech-lead.md +269 -0
  34. package/templates/agents/product/product-functional.md +329 -0
  35. package/templates/agents/product/product-technical.md +578 -0
  36. package/templates/agents/quality/debugger.md +514 -0
  37. package/templates/agents/quality/qa-engineer.md +390 -0
  38. package/templates/agents/specialized/enrichment-agent.md +277 -0
  39. package/templates/agents/specialized/i18n-specialist.md +322 -0
  40. package/templates/agents/specialized/seo-ai-specialist.md +387 -0
  41. package/templates/agents/specialized/tech-writer.md +300 -0
  42. package/templates/code-style/.editorconfig +27 -0
  43. package/templates/code-style/.prettierignore +25 -0
  44. package/templates/code-style/.prettierrc +12 -0
  45. package/templates/code-style/biome.json +78 -0
  46. package/templates/code-style/commitlint.config.js +44 -0
  47. package/templates/commands/README.md +175 -0
  48. package/templates/commands/_registry.json +420 -0
  49. package/templates/commands/add-new-entity.md +211 -0
  50. package/templates/commands/audit/accessibility-audit.md +360 -0
  51. package/templates/commands/audit/performance-audit.md +290 -0
  52. package/templates/commands/audit/security-audit.md +231 -0
  53. package/templates/commands/code-check.md +127 -0
  54. package/templates/commands/five-why.md +225 -0
  55. package/templates/commands/formatting/format-markdown.md +197 -0
  56. package/templates/commands/git/commit.md +247 -0
  57. package/templates/commands/meta/create-agent.md +257 -0
  58. package/templates/commands/meta/create-command.md +312 -0
  59. package/templates/commands/meta/create-skill.md +321 -0
  60. package/templates/commands/meta/help.md +318 -0
  61. package/templates/commands/planning/check-completed-tasks.md +224 -0
  62. package/templates/commands/planning/cleanup-issues.md +248 -0
  63. package/templates/commands/planning/planning-cleanup.md +251 -0
  64. package/templates/commands/planning/sync-planning-github.md +133 -0
  65. package/templates/commands/planning/sync-todos-github.md +203 -0
  66. package/templates/commands/quality-check.md +211 -0
  67. package/templates/commands/run-tests.md +159 -0
  68. package/templates/commands/start-feature-plan.md +232 -0
  69. package/templates/commands/start-refactor-plan.md +244 -0
  70. package/templates/commands/sync-planning.md +176 -0
  71. package/templates/commands/update-docs.md +242 -0
  72. package/templates/docs/CHECKPOINT-SYSTEM.md +504 -0
  73. package/templates/docs/INDEX.md +677 -0
  74. package/templates/docs/RECOMMENDED-HOOKS.md +415 -0
  75. package/templates/docs/_registry.json +329 -0
  76. package/templates/docs/diagrams/README.md +220 -0
  77. package/templates/docs/diagrams/agent-hierarchy.mmd +55 -0
  78. package/templates/docs/diagrams/documentation-map.mmd +61 -0
  79. package/templates/docs/diagrams/tools-relationship.mmd +55 -0
  80. package/templates/docs/diagrams/workflow-decision-tree.mmd +38 -0
  81. package/templates/docs/doc-sync.md +533 -0
  82. package/templates/docs/examples/end-to-end-workflow.md +1505 -0
  83. package/templates/docs/glossary.md +495 -0
  84. package/templates/docs/guides/mockup-prompt-engineering.md +644 -0
  85. package/templates/docs/guides/mockup-setup.md +737 -0
  86. package/templates/docs/learnings/README.md +250 -0
  87. package/templates/docs/learnings/common-architectural-patterns.md +123 -0
  88. package/templates/docs/learnings/common-mistakes-to-avoid.md +149 -0
  89. package/templates/docs/learnings/markdown-formatting-standards.md +104 -0
  90. package/templates/docs/learnings/monorepo-command-execution.md +64 -0
  91. package/templates/docs/learnings/optimization-tips.md +146 -0
  92. package/templates/docs/learnings/planning-linear-sync-workflow.md +70 -0
  93. package/templates/docs/learnings/shell-compatibility-fish.md +46 -0
  94. package/templates/docs/learnings/test-organization-structure.md +68 -0
  95. package/templates/docs/mcp-installation.md +613 -0
  96. package/templates/docs/mcp-servers.md +989 -0
  97. package/templates/docs/notification-installation.md +570 -0
  98. package/templates/docs/quick-start.md +354 -0
  99. package/templates/docs/standards/architecture-patterns.md +1064 -0
  100. package/templates/docs/standards/atomic-commits.md +513 -0
  101. package/templates/docs/standards/code-standards.md +993 -0
  102. package/templates/docs/standards/design-standards.md +656 -0
  103. package/templates/docs/standards/documentation-standards.md +1160 -0
  104. package/templates/docs/standards/testing-standards.md +969 -0
  105. package/templates/docs/system-maintenance.md +604 -0
  106. package/templates/docs/templates/PDR-template.md +561 -0
  107. package/templates/docs/templates/TODOs-template.md +534 -0
  108. package/templates/docs/templates/tech-analysis-template.md +800 -0
  109. package/templates/docs/workflows/README.md +519 -0
  110. package/templates/docs/workflows/atomic-task-protocol.md +955 -0
  111. package/templates/docs/workflows/decision-tree.md +482 -0
  112. package/templates/docs/workflows/edge-cases.md +856 -0
  113. package/templates/docs/workflows/phase-1-planning.md +957 -0
  114. package/templates/docs/workflows/phase-2-implementation.md +896 -0
  115. package/templates/docs/workflows/phase-3-validation.md +792 -0
  116. package/templates/docs/workflows/phase-4-finalization.md +927 -0
  117. package/templates/docs/workflows/quick-fix-protocol.md +505 -0
  118. package/templates/docs/workflows/task-atomization.md +537 -0
  119. package/templates/docs/workflows/task-completion-protocol.md +448 -0
  120. package/templates/hooks/on-notification.sh +28 -0
  121. package/templates/schemas/checkpoint.schema.json +97 -0
  122. package/templates/schemas/code-registry.schema.json +84 -0
  123. package/templates/schemas/pdr.schema.json +314 -0
  124. package/templates/schemas/problems.schema.json +55 -0
  125. package/templates/schemas/tech-analysis.schema.json +404 -0
  126. package/templates/schemas/telemetry.schema.json +298 -0
  127. package/templates/schemas/todos.schema.json +234 -0
  128. package/templates/schemas/workflows.schema.json +69 -0
  129. package/templates/scripts/add-changelogs.sh +105 -0
  130. package/templates/scripts/generate-code-registry.ts +270 -0
  131. package/templates/scripts/health-check.sh +343 -0
  132. package/templates/scripts/sync-registry.sh +40 -0
  133. package/templates/scripts/telemetry-report.ts +36 -0
  134. package/templates/scripts/validate-docs.sh +224 -0
  135. package/templates/scripts/validate-registry.sh +225 -0
  136. package/templates/scripts/validate-schemas.ts +283 -0
  137. package/templates/scripts/validate-structure.sh +165 -0
  138. package/templates/scripts/worktree-cleanup.sh +81 -0
  139. package/templates/scripts/worktree-create.sh +63 -0
  140. package/templates/sessions/planning/.gitkeep +0 -0
  141. package/templates/sessions/planning/archived/.gitkeep +0 -0
  142. package/templates/settings.json +202 -0
  143. package/templates/settings.local.json +138 -0
  144. package/templates/skills/README.md +197 -0
  145. package/templates/skills/_registry.json +473 -0
  146. package/templates/skills/audit/accessibility-audit.md +309 -0
  147. package/templates/skills/audit/performance-audit.md +257 -0
  148. package/templates/skills/audit/security-audit.md +217 -0
  149. package/templates/skills/auth/nextauth-patterns.md +308 -0
  150. package/templates/skills/brand-guidelines.md +240 -0
  151. package/templates/skills/documentation/markdown-formatter.md +302 -0
  152. package/templates/skills/git/git-commit-helper.md +321 -0
  153. package/templates/skills/i18n/i18n-patterns.md +251 -0
  154. package/templates/skills/patterns/error-handling-patterns.md +242 -0
  155. package/templates/skills/patterns/tdd-methodology.md +342 -0
  156. package/templates/skills/qa/qa-criteria-validator.md +383 -0
  157. package/templates/skills/qa/web-app-testing.md +398 -0
  158. package/templates/skills/react/react-hook-form-patterns.md +359 -0
  159. package/templates/skills/state/redux-toolkit-patterns.md +272 -0
  160. package/templates/skills/state/tanstack-query-patterns.md +299 -0
  161. package/templates/skills/state/zustand-patterns.md +301 -0
  162. package/templates/skills/tech/mermaid-diagram-specialist.md +195 -0
  163. package/templates/skills/tech/shadcn-specialist.md +252 -0
  164. package/templates/skills/tech/vercel-specialist.md +297 -0
  165. package/templates/skills/testing/api-app-testing.md +254 -0
  166. package/templates/skills/testing/performance-testing.md +275 -0
  167. package/templates/skills/testing/security-testing.md +348 -0
  168. package/templates/skills/utils/add-memory.md +295 -0
  169. package/templates/skills/utils/json-data-auditor.md +283 -0
  170. package/templates/skills/utils/pdf-creator-editor.md +342 -0
  171. package/templates/tools/format-markdown.sh +185 -0
@@ -0,0 +1,234 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://example.com/schemas/todos.schema.json",
4
+ "title": "TODOs Document",
5
+ "description": "JSON Schema for validating TODOs documents with atomized tasks",
6
+ "type": "object",
7
+ "required": ["metadata", "summary", "phases", "tasks"],
8
+ "properties": {
9
+ "metadata": {
10
+ "type": "object",
11
+ "required": ["planningCode", "relatedPDR", "relatedTechAnalysis", "version"],
12
+ "properties": {
13
+ "planningCode": {
14
+ "type": "string",
15
+ "pattern": "^P(F|R|B)?-\\d{3,4}$",
16
+ "description": "Planning code with mandatory dash (e.g., P-001, PF-004, PR-002, PB-042)"
17
+ },
18
+ "relatedPDR": {
19
+ "type": "string",
20
+ "description": "Path to related PDR document"
21
+ },
22
+ "relatedTechAnalysis": {
23
+ "type": "string",
24
+ "description": "Path to related tech-analysis document"
25
+ },
26
+ "version": {
27
+ "type": "string",
28
+ "pattern": "^\\d+\\.\\d+(\\.\\d+)?$"
29
+ },
30
+ "createdAt": {
31
+ "type": "string",
32
+ "format": "date-time"
33
+ },
34
+ "updatedAt": {
35
+ "type": "string",
36
+ "format": "date-time"
37
+ }
38
+ }
39
+ },
40
+ "summary": {
41
+ "type": "object",
42
+ "required": ["totalTasks", "totalPhases", "totalHours", "completedTasks"],
43
+ "properties": {
44
+ "totalTasks": {
45
+ "type": "integer",
46
+ "minimum": 1
47
+ },
48
+ "totalPhases": {
49
+ "type": "integer",
50
+ "minimum": 1
51
+ },
52
+ "totalHours": {
53
+ "type": "number",
54
+ "minimum": 0.5
55
+ },
56
+ "completedTasks": {
57
+ "type": "integer",
58
+ "minimum": 0
59
+ },
60
+ "completedHours": {
61
+ "type": "number",
62
+ "minimum": 0
63
+ },
64
+ "percentComplete": {
65
+ "type": "number",
66
+ "minimum": 0,
67
+ "maximum": 100
68
+ }
69
+ }
70
+ },
71
+ "phases": {
72
+ "type": "array",
73
+ "minItems": 1,
74
+ "items": {
75
+ "type": "object",
76
+ "required": ["id", "name", "description", "estimatedHours", "tasks"],
77
+ "properties": {
78
+ "id": {
79
+ "type": "integer",
80
+ "minimum": 1
81
+ },
82
+ "name": {
83
+ "type": "string",
84
+ "minLength": 3
85
+ },
86
+ "description": {
87
+ "type": "string",
88
+ "minLength": 10
89
+ },
90
+ "estimatedHours": {
91
+ "type": "number",
92
+ "minimum": 0.5
93
+ },
94
+ "priority": {
95
+ "type": "string",
96
+ "enum": ["P0", "P1", "P2", "P3"]
97
+ },
98
+ "status": {
99
+ "type": "string",
100
+ "enum": ["pending", "in-progress", "completed", "blocked"],
101
+ "default": "pending"
102
+ },
103
+ "tasks": {
104
+ "type": "array",
105
+ "items": {
106
+ "type": "string",
107
+ "pattern": "^P(F|R|B)\\d{3,4}-\\d+(\\.\\d+)?$"
108
+ },
109
+ "description": "Task codes belonging to this phase"
110
+ },
111
+ "blockingFor": {
112
+ "type": "array",
113
+ "items": {
114
+ "type": "integer"
115
+ },
116
+ "description": "Phase IDs that are blocked by this phase"
117
+ }
118
+ }
119
+ }
120
+ },
121
+ "tasks": {
122
+ "type": "array",
123
+ "minItems": 1,
124
+ "items": {
125
+ "type": "object",
126
+ "required": ["code", "title", "description", "estimatedHours", "priority", "phase", "status"],
127
+ "properties": {
128
+ "code": {
129
+ "type": "string",
130
+ "pattern": "^P(F|R|B)\\d{3,4}-\\d+(\\.\\d+)?$",
131
+ "description": "Task code (e.g., PF001-1, PF004-2.1, PR002-5, PB042-1)"
132
+ },
133
+ "title": {
134
+ "type": "string",
135
+ "minLength": 5,
136
+ "maxLength": 200
137
+ },
138
+ "description": {
139
+ "type": "string",
140
+ "minLength": 10
141
+ },
142
+ "estimatedHours": {
143
+ "type": "number",
144
+ "minimum": 0.5,
145
+ "maximum": 4,
146
+ "description": "Tasks must be atomized: 0.5-4 hours each"
147
+ },
148
+ "actualHours": {
149
+ "type": "number",
150
+ "minimum": 0
151
+ },
152
+ "priority": {
153
+ "type": "string",
154
+ "enum": ["P0", "P1", "P2", "P3"]
155
+ },
156
+ "phase": {
157
+ "type": "integer",
158
+ "minimum": 1,
159
+ "description": "Phase ID this task belongs to"
160
+ },
161
+ "status": {
162
+ "type": "string",
163
+ "enum": ["pending", "in-progress", "completed", "blocked", "skipped"],
164
+ "default": "pending"
165
+ },
166
+ "dependencies": {
167
+ "type": "array",
168
+ "items": {
169
+ "type": "string",
170
+ "pattern": "^P(F|R|B)\\d{3,4}-\\d+(\\.\\d+)?$"
171
+ },
172
+ "description": "Task codes that must complete before this task"
173
+ },
174
+ "canParallelize": {
175
+ "type": "boolean",
176
+ "default": false,
177
+ "description": "Can be done in parallel with other tasks"
178
+ },
179
+ "assignedTo": {
180
+ "type": "string",
181
+ "description": "Agent or person assigned to this task"
182
+ },
183
+ "tags": {
184
+ "type": "array",
185
+ "items": {
186
+ "type": "string",
187
+ "enum": ["documentation", "code", "testing", "review", "deployment", "refactor", "research"]
188
+ }
189
+ },
190
+ "githubIssue": {
191
+ "type": "integer",
192
+ "description": "Related GitHub issue number"
193
+ },
194
+ "startedAt": {
195
+ "type": "string",
196
+ "format": "date-time"
197
+ },
198
+ "completedAt": {
199
+ "type": "string",
200
+ "format": "date-time"
201
+ },
202
+ "notes": {
203
+ "type": "string"
204
+ },
205
+ "blockedBy": {
206
+ "type": "string",
207
+ "description": "Reason if task is blocked"
208
+ }
209
+ }
210
+ }
211
+ },
212
+ "validation": {
213
+ "type": "object",
214
+ "properties": {
215
+ "allTasksAtomized": {
216
+ "type": "boolean",
217
+ "description": "All tasks are 0.5-4 hours"
218
+ },
219
+ "noCyclicDependencies": {
220
+ "type": "boolean",
221
+ "description": "No circular dependencies detected"
222
+ },
223
+ "allDependenciesExist": {
224
+ "type": "boolean",
225
+ "description": "All referenced dependencies exist"
226
+ },
227
+ "totalHoursMatch": {
228
+ "type": "boolean",
229
+ "description": "Sum of task hours matches totalHours"
230
+ }
231
+ }
232
+ }
233
+ }
234
+ }
@@ -0,0 +1,69 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://example.com/schemas/workflows.schema.json",
4
+ "title": "Workflows",
5
+ "description": "JSON Schema for validating workflow definitions",
6
+ "type": "object",
7
+ "required": ["metadata", "workflows"],
8
+ "properties": {
9
+ "metadata": {
10
+ "type": "object",
11
+ "required": ["version"],
12
+ "properties": {
13
+ "version": {"type": "string", "pattern": "^\\d+\\.\\d+(\\.\\d+)?$"},
14
+ "lastUpdated": {"type": "string", "format": "date-time"}
15
+ }
16
+ },
17
+ "workflows": {
18
+ "type": "array",
19
+ "minItems": 1,
20
+ "items": {
21
+ "type": "object",
22
+ "required": ["id", "name", "level", "criteria", "steps"],
23
+ "properties": {
24
+ "id": {"type": "string", "pattern": "^WF-L\\d$"},
25
+ "name": {"type": "string"},
26
+ "level": {"type": "integer", "minimum": 1, "maximum": 3},
27
+ "criteria": {
28
+ "type": "object",
29
+ "required": ["duration", "complexity"],
30
+ "properties": {
31
+ "duration": {"type": "string"},
32
+ "complexity": {"type": "string", "enum": ["trivial", "low", "medium", "high"]},
33
+ "requiresPDR": {"type": "boolean"},
34
+ "requiresTechAnalysis": {"type": "boolean"},
35
+ "requiresTODOs": {"type": "boolean"}
36
+ }
37
+ },
38
+ "steps": {
39
+ "type": "array",
40
+ "minItems": 1,
41
+ "items": {
42
+ "type": "object",
43
+ "required": ["id", "name", "description"],
44
+ "properties": {
45
+ "id": {"type": "integer", "minimum": 1},
46
+ "name": {"type": "string"},
47
+ "description": {"type": "string"},
48
+ "agent": {"type": "string"},
49
+ "command": {"type": "string"},
50
+ "skill": {"type": "string"},
51
+ "optional": {"type": "boolean", "default": false},
52
+ "parallelizable": {"type": "boolean", "default": false},
53
+ "estimatedMinutes": {"type": "integer", "minimum": 1}
54
+ }
55
+ }
56
+ },
57
+ "outputs": {
58
+ "type": "array",
59
+ "items": {"type": "string"}
60
+ },
61
+ "validation": {
62
+ "type": "array",
63
+ "items": {"type": "string"}
64
+ }
65
+ }
66
+ }
67
+ }
68
+ }
69
+ }
@@ -0,0 +1,105 @@
1
+ #!/bin/bash
2
+
3
+ # Script to add CHANGELOG section to all .claude/*.md files
4
+ # Usage: bash .claude/scripts/add-changelogs.sh
5
+
6
+ set -e
7
+
8
+ CHANGELOG_TEMPLATE="
9
+
10
+ ---
11
+
12
+ ## Changelog
13
+
14
+ | Version | Date | Changes | Author | Related |
15
+ |---------|------|---------|--------|---------|
16
+ | 1.0.0 | 2025-10-31 | Initial version | @tech-lead | P-004 |
17
+ "
18
+
19
+ # Function to add changelog if not exists
20
+ add_changelog() {
21
+ local file="$1"
22
+
23
+ # Skip if file already has Changelog section
24
+ if grep -q "^## Changelog" "$file"; then
25
+ echo " ā­ļø Skipped (already has changelog): $(basename "$file")"
26
+ return
27
+ fi
28
+
29
+ # Add changelog at the end
30
+ echo "$CHANGELOG_TEMPLATE" >> "$file"
31
+ echo " āœ… Added changelog: $(basename "$file")"
32
+ }
33
+
34
+ echo "šŸ” Adding CHANGELOG sections to .claude files..."
35
+ echo ""
36
+
37
+ # Process all markdown files in .claude (excluding README.md and specific docs)
38
+ total=0
39
+ added=0
40
+
41
+ # Commands
42
+ echo "šŸ“‹ Processing commands..."
43
+ for file in .claude/commands/**/*.md; do
44
+ if [[ -f "$file" ]] && [[ "$(basename "$file")" != "README.md" ]]; then
45
+ add_changelog "$file"
46
+ ((total++))
47
+ fi
48
+ done
49
+
50
+ # Skills
51
+ echo ""
52
+ echo "šŸŽÆ Processing skills..."
53
+ for file in .claude/skills/**/*.md; do
54
+ if [[ -f "$file" ]] && [[ "$(basename "$file")" != "README.md" ]]; then
55
+ add_changelog "$file"
56
+ ((total++))
57
+ fi
58
+ done
59
+
60
+ # Agents
61
+ echo ""
62
+ echo "šŸ¤– Processing agents..."
63
+ for file in .claude/agents/**/*.md; do
64
+ if [[ -f "$file" ]] && [[ "$(basename "$file")" != "README.md" ]]; then
65
+ add_changelog "$file"
66
+ ((total++))
67
+ fi
68
+ done
69
+
70
+ # Docs (selected files, not all)
71
+ echo ""
72
+ echo "šŸ“š Processing documentation..."
73
+ for file in .claude/docs/{quick-start,glossary,mcp-servers,doc-sync,system-maintenance,CHECKPOINT-SYSTEM,RECOMMENDED-HOOKS}.md; do
74
+ if [[ -f "$file" ]]; then
75
+ add_changelog "$file"
76
+ ((total++))
77
+ fi
78
+ done
79
+
80
+ # Workflows
81
+ for file in .claude/docs/workflows/*.md; do
82
+ if [[ -f "$file" ]] && [[ "$(basename "$file")" != "README.md" ]] && [[ "$(basename "$file")" != "INDEX.md" ]]; then
83
+ add_changelog "$file"
84
+ ((total++))
85
+ fi
86
+ done
87
+
88
+ # Standards
89
+ for file in .claude/docs/standards/*.md; do
90
+ if [[ -f "$file" ]]; then
91
+ add_changelog "$file"
92
+ ((total++))
93
+ fi
94
+ done
95
+
96
+ # Learnings
97
+ for file in .claude/docs/learnings/*.md; do
98
+ if [[ -f "$file" ]] && [[ "$(basename "$file")" != "README.md" ]]; then
99
+ add_changelog "$file"
100
+ ((total++))
101
+ fi
102
+ done
103
+
104
+ echo ""
105
+ echo "āœ… Done! Processed $total files"
@@ -0,0 +1,270 @@
1
+ #!/usr/bin/env tsx
2
+ /**
3
+ * Code Registry Generator
4
+ *
5
+ * Generates .code-registry.json from all planning sessions.
6
+ * The registry provides quick lookup of planning codes and their task codes.
7
+ *
8
+ * Usage:
9
+ * tsx .claude/scripts/generate-code-registry.ts
10
+ *
11
+ * Output:
12
+ * .claude/sessions/planning/.code-registry.json
13
+ */
14
+
15
+ import { readFileSync, writeFileSync, readdirSync, statSync, existsSync } from 'node:fs';
16
+ import { join, resolve } from 'node:path';
17
+
18
+ interface RegistrySession {
19
+ code: string;
20
+ type: 'feature' | 'refactor' | 'bugfix';
21
+ fullCode: string;
22
+ sessionPath: string;
23
+ status: 'active' | 'completed' | 'archived' | 'cancelled';
24
+ createdAt?: string;
25
+ completedAt?: string;
26
+ archivedAt?: string;
27
+ tasks: string[];
28
+ }
29
+
30
+ interface CodeRegistry {
31
+ version: string;
32
+ generatedAt: string;
33
+ lastPlanningNumber: number;
34
+ registry: RegistrySession[];
35
+ }
36
+
37
+ const PLANNING_ROOT = resolve(process.cwd(), '.claude/sessions/planning');
38
+ const REGISTRY_PATH = join(PLANNING_ROOT, '.code-registry.json');
39
+
40
+ /**
41
+ * Extract task codes from TODOs.md content
42
+ */
43
+ function extractTaskCodes(content: string): string[] {
44
+ const taskCodes: string[] = [];
45
+ const lines = content.split('\n');
46
+
47
+ for (const line of lines) {
48
+ // Match heading: ### PF004-1: Task Title or ### PF004-1 Task Title
49
+ const headingMatch = line.match(/^###\s+(P[FRB]\d{3,4}-\d+(?:\.\d+)?)/);
50
+ if (headingMatch) {
51
+ taskCodes.push(headingMatch[1]);
52
+ }
53
+ }
54
+
55
+ return taskCodes;
56
+ }
57
+
58
+ /**
59
+ * Determine session status from checkpoint or TODOs
60
+ */
61
+ function determineStatus(sessionPath: string): RegistrySession['status'] {
62
+ const checkpointPath = join(sessionPath, '.checkpoint.json');
63
+
64
+ try {
65
+ if (existsSync(checkpointPath)) {
66
+ const checkpoint = JSON.parse(readFileSync(checkpointPath, 'utf-8'));
67
+ if (checkpoint.currentPhase === 4 && checkpoint.status === 'completed') {
68
+ return 'completed';
69
+ }
70
+ return 'active';
71
+ }
72
+ } catch (error) {
73
+ console.warn(` Warning: Could not read checkpoint at ${checkpointPath}`);
74
+ }
75
+
76
+ // Fallback: check if all tasks in TODOs are completed
77
+ const todosPath = join(sessionPath, 'TODOs.md');
78
+ try {
79
+ if (existsSync(todosPath)) {
80
+ const content = readFileSync(todosPath, 'utf-8');
81
+ const hasIncompleteTasks = /^-\s+\[\s\]/m.test(content);
82
+ return hasIncompleteTasks ? 'active' : 'completed';
83
+ }
84
+ } catch (error) {
85
+ console.warn(` Warning: Could not read TODOs at ${todosPath}`);
86
+ }
87
+
88
+ return 'active';
89
+ }
90
+
91
+ /**
92
+ * Extract planning code and type from session directory name
93
+ */
94
+ function parsePlanningCode(dirName: string): { code: string; type: RegistrySession['type']; fullCode: string } {
95
+ // Pattern: P-001, PF-004, PR-002, PB-042
96
+ const match = dirName.match(/^(P([FRB])?-\d{3,4})/);
97
+ if (!match) {
98
+ return { code: 'UNKNOWN', type: 'feature', fullCode: dirName };
99
+ }
100
+
101
+ const code = match[1];
102
+ const prefix = match[2];
103
+
104
+ let type: RegistrySession['type'] = 'feature';
105
+ if (prefix === 'R') type = 'refactor';
106
+ if (prefix === 'B') type = 'bugfix';
107
+ if (!prefix) type = 'feature'; // P-XXX defaults to feature
108
+
109
+ return { code, type, fullCode: dirName };
110
+ }
111
+
112
+ /**
113
+ * Extract creation date from git or filesystem
114
+ */
115
+ function getCreationDate(sessionPath: string): string | undefined {
116
+ try {
117
+ const stat = statSync(sessionPath);
118
+ // Format as ISO 8601 date-time
119
+ const date = stat.birthtime || stat.mtime;
120
+ return date.toISOString();
121
+ } catch (error) {
122
+ return undefined;
123
+ }
124
+ }
125
+
126
+ /**
127
+ * Find all planning sessions (excluding archived)
128
+ */
129
+ function findPlanningSessions(baseDir: string): string[] {
130
+ const sessions: string[] = [];
131
+
132
+ try {
133
+ const entries = readdirSync(baseDir);
134
+
135
+ for (const entry of entries) {
136
+ const fullPath = join(baseDir, entry);
137
+
138
+ // Skip non-directories, hidden files, and archived folder
139
+ if (entry.startsWith('.') || entry === 'archived' || !statSync(fullPath).isDirectory()) {
140
+ continue;
141
+ }
142
+
143
+ // Must match planning code pattern
144
+ if (/^P[FRB]?-\d{3,4}/.test(entry)) {
145
+ sessions.push(fullPath);
146
+ }
147
+ }
148
+ } catch (error) {
149
+ console.error(`Error reading planning directory: ${error}`);
150
+ }
151
+
152
+ return sessions;
153
+ }
154
+
155
+ /**
156
+ * Calculate last planning number from all sessions
157
+ */
158
+ function calculateLastPlanningNumber(sessions: RegistrySession[]): number {
159
+ let maxNumber = 0;
160
+
161
+ for (const session of sessions) {
162
+ const match = session.code.match(/(\d+)/);
163
+ if (match) {
164
+ const num = parseInt(match[1], 10);
165
+ if (num > maxNumber) {
166
+ maxNumber = num;
167
+ }
168
+ }
169
+ }
170
+
171
+ return maxNumber;
172
+ }
173
+
174
+ /**
175
+ * Generate code registry
176
+ */
177
+ function generateRegistry(): CodeRegistry {
178
+ const sessionPaths = findPlanningSessions(PLANNING_ROOT);
179
+ const sessions: RegistrySession[] = [];
180
+
181
+ console.log(`Found ${sessionPaths.length} planning sessions\n`);
182
+
183
+ for (const sessionPath of sessionPaths) {
184
+ const dirName = sessionPath.split('/').pop()!;
185
+ const { code, type, fullCode } = parsePlanningCode(dirName);
186
+ const status = determineStatus(sessionPath);
187
+ const createdAt = getCreationDate(sessionPath);
188
+
189
+ // Extract task codes from TODOs.md
190
+ let tasks: string[] = [];
191
+ const todosPath = join(sessionPath, 'TODOs.md');
192
+ try {
193
+ if (existsSync(todosPath)) {
194
+ const content = readFileSync(todosPath, 'utf-8');
195
+ tasks = extractTaskCodes(content);
196
+ }
197
+ } catch (error) {
198
+ console.warn(` Warning: Could not read TODOs.md for ${code}`);
199
+ }
200
+
201
+ sessions.push({
202
+ code,
203
+ type,
204
+ fullCode,
205
+ sessionPath: dirName,
206
+ status,
207
+ createdAt,
208
+ tasks
209
+ });
210
+
211
+ console.log(` āœ“ ${code} (${type}) - ${tasks.length} tasks - ${status}`);
212
+ }
213
+
214
+ // Sort sessions by code
215
+ sessions.sort((a, b) => a.code.localeCompare(b.code));
216
+
217
+ const lastPlanningNumber = calculateLastPlanningNumber(sessions);
218
+
219
+ return {
220
+ version: '1.0.0',
221
+ generatedAt: new Date().toISOString(),
222
+ lastPlanningNumber,
223
+ registry: sessions
224
+ };
225
+ }
226
+
227
+ /**
228
+ * Main execution
229
+ */
230
+ function main() {
231
+ console.log('šŸ” Generating code registry from planning sessions...\n');
232
+
233
+ const registry = generateRegistry();
234
+
235
+ console.log(`\nāœ… Registry generated successfully!`);
236
+ console.log(` Version: ${registry.version}`);
237
+ console.log(` Sessions: ${registry.registry.length}`);
238
+ console.log(` Last Planning Number: ${registry.lastPlanningNumber}`);
239
+ console.log(` Output: ${REGISTRY_PATH}\n`);
240
+
241
+ writeFileSync(REGISTRY_PATH, JSON.stringify(registry, null, 2), 'utf-8');
242
+
243
+ // Print summary by status
244
+ const statusCounts = registry.registry.reduce((acc, session) => {
245
+ acc[session.status] = (acc[session.status] || 0) + 1;
246
+ return acc;
247
+ }, {} as Record<string, number>);
248
+
249
+ console.log('šŸ“Š Status summary:');
250
+ Object.entries(statusCounts).forEach(([status, count]) => {
251
+ console.log(` ${status}: ${count}`);
252
+ });
253
+
254
+ // Print summary by type
255
+ const typeCounts = registry.registry.reduce((acc, session) => {
256
+ acc[session.type] = (acc[session.type] || 0) + 1;
257
+ return acc;
258
+ }, {} as Record<string, number>);
259
+
260
+ console.log('\nšŸ“‹ Type summary:');
261
+ Object.entries(typeCounts).forEach(([type, count]) => {
262
+ console.log(` ${type}: ${count}`);
263
+ });
264
+
265
+ // Total tasks
266
+ const totalTasks = registry.registry.reduce((sum, session) => sum + session.tasks.length, 0);
267
+ console.log(`\nšŸ“ Total tasks: ${totalTasks}`);
268
+ }
269
+
270
+ main();