@orchestrator-claude/cli 1.7.2 → 1.7.3

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 (51) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/templates/base/.orchestrator/patterns/legacy/README.md +360 -0
  4. package/dist/templates/base/.orchestrator/patterns/legacy/php/laravel.patterns.json +396 -0
  5. package/dist/templates/base/.orchestrator/templates/legacy/README.md +296 -0
  6. package/dist/templates/base/.orchestrator/templates/legacy/analysis-report.md.hbs +342 -0
  7. package/dist/templates/base/.orchestrator/templates/legacy/api-spec.yaml.hbs +263 -0
  8. package/dist/templates/base/.orchestrator/templates/legacy/business-rules.md.hbs +449 -0
  9. package/dist/templates/base/.orchestrator/templates/legacy/database-schema.md.hbs +356 -0
  10. package/dist/templates/base/.orchestrator/templates/legacy/dead-code-report.md.hbs +330 -0
  11. package/dist/templates/base/.orchestrator/templates/legacy/discovery-report.md.hbs +267 -0
  12. package/dist/templates/base/.orchestrator/templates/legacy/final-report.md.hbs +451 -0
  13. package/dist/templates/base/.orchestrator/templates/legacy/inventory.json.schema +346 -0
  14. package/dist/templates/base/.orchestrator/templates/legacy/migration-roadmap.md.hbs +571 -0
  15. package/dist/templates/base/.orchestrator/templates/legacy/tech-debt.md.hbs +412 -0
  16. package/dist/templates/base/claude/agents/api-extractor.md +665 -0
  17. package/dist/templates/base/claude/agents/business-rule-miner.md +734 -0
  18. package/dist/templates/base/claude/agents/code-archaeologist.md +715 -0
  19. package/dist/templates/base/claude/agents/legacy-discoverer.md +578 -0
  20. package/dist/templates/base/claude/agents/legacy-synthesizer.md +1097 -0
  21. package/dist/templates/base/claude/agents/schema-extractor.md +767 -0
  22. package/dist/templates/workflows/README.md +137 -0
  23. package/dist/templates/workflows/bug-fix.json +73 -0
  24. package/dist/templates/workflows/feature-development.json +87 -0
  25. package/dist/templates/workflows/legacy-analysis.json +288 -0
  26. package/dist/templates/workflows/refactoring.json +73 -0
  27. package/package.json +1 -1
  28. package/templates/base/.orchestrator/patterns/legacy/README.md +360 -0
  29. package/templates/base/.orchestrator/patterns/legacy/php/laravel.patterns.json +396 -0
  30. package/templates/base/.orchestrator/templates/legacy/README.md +296 -0
  31. package/templates/base/.orchestrator/templates/legacy/analysis-report.md.hbs +342 -0
  32. package/templates/base/.orchestrator/templates/legacy/api-spec.yaml.hbs +263 -0
  33. package/templates/base/.orchestrator/templates/legacy/business-rules.md.hbs +449 -0
  34. package/templates/base/.orchestrator/templates/legacy/database-schema.md.hbs +356 -0
  35. package/templates/base/.orchestrator/templates/legacy/dead-code-report.md.hbs +330 -0
  36. package/templates/base/.orchestrator/templates/legacy/discovery-report.md.hbs +267 -0
  37. package/templates/base/.orchestrator/templates/legacy/final-report.md.hbs +451 -0
  38. package/templates/base/.orchestrator/templates/legacy/inventory.json.schema +346 -0
  39. package/templates/base/.orchestrator/templates/legacy/migration-roadmap.md.hbs +571 -0
  40. package/templates/base/.orchestrator/templates/legacy/tech-debt.md.hbs +412 -0
  41. package/templates/base/claude/agents/api-extractor.md +665 -0
  42. package/templates/base/claude/agents/business-rule-miner.md +734 -0
  43. package/templates/base/claude/agents/code-archaeologist.md +715 -0
  44. package/templates/base/claude/agents/legacy-discoverer.md +578 -0
  45. package/templates/base/claude/agents/legacy-synthesizer.md +1097 -0
  46. package/templates/base/claude/agents/schema-extractor.md +767 -0
  47. package/templates/workflows/README.md +137 -0
  48. package/templates/workflows/bug-fix.json +73 -0
  49. package/templates/workflows/feature-development.json +87 -0
  50. package/templates/workflows/legacy-analysis.json +288 -0
  51. package/templates/workflows/refactoring.json +73 -0
@@ -0,0 +1,396 @@
1
+ {
2
+ "id": "php-laravel",
3
+ "stack": {
4
+ "language": "php",
5
+ "framework": "laravel",
6
+ "versions": ["6.x", "7.x", "8.x", "9.x", "10.x", "11.x"],
7
+ "ecosystem": "composer"
8
+ },
9
+ "detection": {
10
+ "indicators": [
11
+ {
12
+ "type": "file",
13
+ "path": "artisan",
14
+ "confidence": 0.90,
15
+ "description": "Laravel Artisan CLI tool"
16
+ },
17
+ {
18
+ "type": "file",
19
+ "path": "composer.json",
20
+ "contains": "laravel/framework",
21
+ "confidence": 0.95,
22
+ "description": "Laravel framework dependency in Composer"
23
+ },
24
+ {
25
+ "type": "file",
26
+ "path": "composer.json",
27
+ "contains": "illuminate/",
28
+ "confidence": 0.85,
29
+ "description": "Laravel Illuminate components"
30
+ },
31
+ {
32
+ "type": "directory",
33
+ "path": "app/Http/Controllers",
34
+ "confidence": 0.80,
35
+ "description": "Laravel controllers directory"
36
+ },
37
+ {
38
+ "type": "directory",
39
+ "path": "app/Models",
40
+ "confidence": 0.75,
41
+ "description": "Laravel 8+ models directory"
42
+ },
43
+ {
44
+ "type": "directory",
45
+ "path": "database/migrations",
46
+ "confidence": 0.80,
47
+ "description": "Laravel migrations directory"
48
+ },
49
+ {
50
+ "type": "file",
51
+ "path": "config/app.php",
52
+ "confidence": 0.70,
53
+ "description": "Laravel application config"
54
+ },
55
+ {
56
+ "type": "directory",
57
+ "path": "resources/views",
58
+ "confidence": 0.70,
59
+ "description": "Laravel Blade views"
60
+ },
61
+ {
62
+ "type": "file",
63
+ "path": "routes/web.php",
64
+ "confidence": 0.85,
65
+ "description": "Laravel web routes"
66
+ }
67
+ ],
68
+ "minConfidence": 0.80
69
+ },
70
+ "patterns": {
71
+ "routes": {
72
+ "description": "HTTP route definitions",
73
+ "files": [
74
+ "routes/web.php",
75
+ "routes/api.php",
76
+ "routes/channels.php",
77
+ "routes/console.php",
78
+ "routes/*.php"
79
+ ],
80
+ "regex": [
81
+ "Route::(get|post|put|patch|delete|options|any)\\s*\\(\\s*['\"]([^'\"]+)['\"]",
82
+ "Route::resource\\s*\\(\\s*['\"]([^'\"]+)['\"]\\s*,\\s*['\"]?([^'\"]+)['\"]?",
83
+ "Route::apiResource\\s*\\(\\s*['\"]([^'\"]+)['\"]\\s*,\\s*['\"]?([^'\"]+)['\"]?",
84
+ "Route::group\\s*\\(",
85
+ "Route::middleware\\s*\\([^)]+\\)\\s*->\\s*(get|post|put|patch|delete)\\s*\\(\\s*['\"]([^'\"]+)['\"]"
86
+ ],
87
+ "extractors": {
88
+ "method": 1,
89
+ "path": 2,
90
+ "controller": 3
91
+ }
92
+ },
93
+ "controllers": {
94
+ "description": "Controller classes",
95
+ "files": [
96
+ "app/Http/Controllers/**/*.php",
97
+ "app/Http/Controllers/*.php"
98
+ ],
99
+ "regex": [
100
+ "class\\s+(\\w+Controller)\\s+extends\\s+Controller",
101
+ "class\\s+(\\w+)\\s+extends\\s+Controller",
102
+ "public\\s+function\\s+(index|show|store|update|destroy|create|edit)\\s*\\(",
103
+ "public\\s+function\\s+(\\w+)\\s*\\([^)]*Request",
104
+ "@param\\s+Request\\s+\\$request"
105
+ ],
106
+ "extractors": {
107
+ "className": 1,
108
+ "methodName": 1
109
+ }
110
+ },
111
+ "models": {
112
+ "description": "Eloquent models and entities",
113
+ "files": [
114
+ "app/Models/**/*.php",
115
+ "app/Models/*.php",
116
+ "app/*.php"
117
+ ],
118
+ "regex": [
119
+ "class\\s+(\\w+)\\s+extends\\s+Model",
120
+ "class\\s+(\\w+)\\s+extends\\s+Authenticatable",
121
+ "class\\s+(\\w+)\\s+extends\\s+Pivot",
122
+ "protected\\s+\\$table\\s*=\\s*['\"]([^'\"]+)['\"]",
123
+ "protected\\s+\\$fillable\\s*=\\s*\\[",
124
+ "protected\\s+\\$guarded\\s*=\\s*\\[",
125
+ "protected\\s+\\$hidden\\s*=\\s*\\[",
126
+ "protected\\s+\\$casts\\s*=\\s*\\[",
127
+ "public\\s+function\\s+(\\w+)\\s*\\(\\)\\s*:\\s*HasMany",
128
+ "public\\s+function\\s+(\\w+)\\s*\\(\\)\\s*:\\s*BelongsTo",
129
+ "public\\s+function\\s+(\\w+)\\s*\\(\\)\\s*:\\s*BelongsToMany"
130
+ ],
131
+ "extractors": {
132
+ "modelName": 1,
133
+ "tableName": 2,
134
+ "relationName": 1
135
+ }
136
+ },
137
+ "migrations": {
138
+ "description": "Database migrations",
139
+ "files": [
140
+ "database/migrations/*.php"
141
+ ],
142
+ "regex": [
143
+ "Schema::create\\s*\\(\\s*['\"]([^'\"]+)['\"]",
144
+ "Schema::table\\s*\\(\\s*['\"]([^'\"]+)['\"]",
145
+ "Schema::drop\\s*\\(\\s*['\"]([^'\"]+)['\"]",
146
+ "\\$table->(\\w+)\\s*\\(\\s*['\"]([^'\"]+)['\"]",
147
+ "\\$table->foreign\\s*\\(\\s*['\"]([^'\"]+)['\"]",
148
+ "\\$table->index\\s*\\(\\s*['\"]([^'\"]+)['\"]"
149
+ ],
150
+ "extractors": {
151
+ "tableName": 1,
152
+ "columnType": 1,
153
+ "columnName": 2
154
+ }
155
+ },
156
+ "middleware": {
157
+ "description": "HTTP middleware",
158
+ "files": [
159
+ "app/Http/Middleware/**/*.php",
160
+ "app/Http/Middleware/*.php"
161
+ ],
162
+ "regex": [
163
+ "class\\s+(\\w+Middleware)",
164
+ "class\\s+(\\w+)\\s+",
165
+ "public\\s+function\\s+handle\\s*\\(\\s*Request\\s+\\$request",
166
+ "public\\s+function\\s+handle\\s*\\(\\s*\\$request\\s*,\\s*Closure\\s+\\$next"
167
+ ],
168
+ "extractors": {
169
+ "className": 1
170
+ }
171
+ },
172
+ "services": {
173
+ "description": "Service layer classes",
174
+ "files": [
175
+ "app/Services/**/*.php",
176
+ "app/Services/*.php",
177
+ "app/Service/**/*.php"
178
+ ],
179
+ "regex": [
180
+ "class\\s+(\\w+Service)",
181
+ "class\\s+(\\w+)\\s+",
182
+ "public\\s+function\\s+(\\w+)\\s*\\("
183
+ ],
184
+ "extractors": {
185
+ "serviceName": 1,
186
+ "methodName": 1
187
+ }
188
+ },
189
+ "repositories": {
190
+ "description": "Repository pattern implementations",
191
+ "files": [
192
+ "app/Repositories/**/*.php",
193
+ "app/Repositories/*.php",
194
+ "app/Repository/**/*.php"
195
+ ],
196
+ "regex": [
197
+ "class\\s+(\\w+Repository)",
198
+ "class\\s+(\\w+)\\s+implements\\s+\\w+RepositoryInterface",
199
+ "public\\s+function\\s+(find|findById|findAll|create|update|delete)\\s*\\("
200
+ ],
201
+ "extractors": {
202
+ "repoName": 1,
203
+ "methodName": 1
204
+ }
205
+ },
206
+ "jobs": {
207
+ "description": "Queue jobs and async tasks",
208
+ "files": [
209
+ "app/Jobs/**/*.php",
210
+ "app/Jobs/*.php"
211
+ ],
212
+ "regex": [
213
+ "class\\s+(\\w+)\\s+implements\\s+ShouldQueue",
214
+ "class\\s+(\\w+Job)",
215
+ "public\\s+function\\s+handle\\s*\\("
216
+ ],
217
+ "extractors": {
218
+ "jobName": 1
219
+ }
220
+ },
221
+ "events": {
222
+ "description": "Event classes",
223
+ "files": [
224
+ "app/Events/**/*.php",
225
+ "app/Events/*.php"
226
+ ],
227
+ "regex": [
228
+ "class\\s+(\\w+Event)",
229
+ "class\\s+(\\w+)\\s+",
230
+ "use\\s+Dispatchable"
231
+ ],
232
+ "extractors": {
233
+ "eventName": 1
234
+ }
235
+ },
236
+ "listeners": {
237
+ "description": "Event listeners",
238
+ "files": [
239
+ "app/Listeners/**/*.php",
240
+ "app/Listeners/*.php"
241
+ ],
242
+ "regex": [
243
+ "class\\s+(\\w+Listener)",
244
+ "class\\s+(\\w+)\\s+",
245
+ "public\\s+function\\s+handle\\s*\\(\\s*(\\w+)"
246
+ ],
247
+ "extractors": {
248
+ "listenerName": 1,
249
+ "eventType": 2
250
+ }
251
+ },
252
+ "requests": {
253
+ "description": "Form request validation classes",
254
+ "files": [
255
+ "app/Http/Requests/**/*.php",
256
+ "app/Http/Requests/*.php"
257
+ ],
258
+ "regex": [
259
+ "class\\s+(\\w+Request)\\s+extends\\s+FormRequest",
260
+ "public\\s+function\\s+rules\\s*\\(\\)",
261
+ "public\\s+function\\s+authorize\\s*\\(\\)"
262
+ ],
263
+ "extractors": {
264
+ "requestName": 1
265
+ }
266
+ },
267
+ "tests": {
268
+ "description": "PHPUnit tests",
269
+ "files": [
270
+ "tests/**/*Test.php",
271
+ "tests/**/*.php"
272
+ ],
273
+ "regex": [
274
+ "class\\s+(\\w+Test)\\s+extends\\s+TestCase",
275
+ "public\\s+function\\s+(test\\w+)\\s*\\(",
276
+ "@test"
277
+ ],
278
+ "extractors": {
279
+ "testClass": 1,
280
+ "testMethod": 1
281
+ }
282
+ },
283
+ "providers": {
284
+ "description": "Service providers",
285
+ "files": [
286
+ "app/Providers/**/*.php",
287
+ "app/Providers/*.php"
288
+ ],
289
+ "regex": [
290
+ "class\\s+(\\w+ServiceProvider)\\s+extends\\s+ServiceProvider",
291
+ "public\\s+function\\s+register\\s*\\(",
292
+ "public\\s+function\\s+boot\\s*\\("
293
+ ],
294
+ "extractors": {
295
+ "providerName": 1
296
+ }
297
+ },
298
+ "commands": {
299
+ "description": "Artisan console commands",
300
+ "files": [
301
+ "app/Console/Commands/**/*.php",
302
+ "app/Console/Commands/*.php"
303
+ ],
304
+ "regex": [
305
+ "class\\s+(\\w+)\\s+extends\\s+Command",
306
+ "protected\\s+\\$signature\\s*=\\s*['\"]([^'\"]+)['\"]",
307
+ "protected\\s+\\$description\\s*=\\s*['\"]([^'\"]+)['\"]",
308
+ "public\\s+function\\s+handle\\s*\\("
309
+ ],
310
+ "extractors": {
311
+ "commandClass": 1,
312
+ "signature": 2,
313
+ "description": 3
314
+ }
315
+ },
316
+ "config": {
317
+ "description": "Configuration files",
318
+ "files": [
319
+ "config/*.php"
320
+ ],
321
+ "regex": [
322
+ "return\\s+\\[",
323
+ "['\"]([^'\"]+)['\"]\\s*=>",
324
+ "env\\s*\\(\\s*['\"]([^'\"]+)['\"]"
325
+ ],
326
+ "extractors": {
327
+ "configKey": 1,
328
+ "envVar": 2
329
+ }
330
+ },
331
+ "views": {
332
+ "description": "Blade template views",
333
+ "files": [
334
+ "resources/views/**/*.blade.php"
335
+ ],
336
+ "regex": [
337
+ "@extends\\s*\\(['\"]([^'\"]+)['\"]\\)",
338
+ "@section\\s*\\(['\"]([^'\"]+)['\"]\\)",
339
+ "@include\\s*\\(['\"]([^'\"]+)['\"]\\)",
340
+ "@component\\s*\\(['\"]([^'\"]+)['\"]\\)",
341
+ "{{\\s*\\$([a-zA-Z_]\\w*)\\s*}}"
342
+ ],
343
+ "extractors": {
344
+ "layoutName": 1,
345
+ "sectionName": 1,
346
+ "includeName": 1,
347
+ "variableName": 1
348
+ }
349
+ }
350
+ },
351
+ "metrics": {
352
+ "complexity": {
353
+ "cyclomaticComplexity": {
354
+ "tool": "phpmd",
355
+ "threshold": 10
356
+ },
357
+ "maintainabilityIndex": {
358
+ "tool": "phpmetrics",
359
+ "threshold": 65
360
+ }
361
+ },
362
+ "quality": {
363
+ "codeStandards": {
364
+ "tool": "phpcs",
365
+ "standard": "PSR-12"
366
+ },
367
+ "staticAnalysis": {
368
+ "tool": "phpstan",
369
+ "level": 5
370
+ }
371
+ }
372
+ },
373
+ "exclusions": {
374
+ "directories": [
375
+ "vendor/",
376
+ "node_modules/",
377
+ "storage/",
378
+ "bootstrap/cache/",
379
+ "public/",
380
+ ".git/"
381
+ ],
382
+ "files": [
383
+ "*.min.js",
384
+ "*.min.css",
385
+ "_ide_helper.php"
386
+ ]
387
+ },
388
+ "metadata": {
389
+ "author": "implementer-agent",
390
+ "created": "2026-01-23",
391
+ "lastUpdated": "2026-01-23",
392
+ "version": "1.0.0",
393
+ "tested": true,
394
+ "coverage": "Laravel 6.x - 11.x"
395
+ }
396
+ }
@@ -0,0 +1,296 @@
1
+ # Legacy Analysis Templates
2
+
3
+ **Version:** 1.0
4
+ **Created:** 2026-01-23
5
+ **RFC:** RFC-004-LEGACY-ANALYSIS-WORKFLOW.md
6
+
7
+ ---
8
+
9
+ ## Purpose
10
+
11
+ Templates provide consistent structure for artifacts generated during legacy analysis. All templates use [Handlebars](https://handlebarsjs.com/) syntax for variable interpolation and logic.
12
+
13
+ ---
14
+
15
+ ## Template Files
16
+
17
+ | Template | Phase | Description |
18
+ |----------|-------|-------------|
19
+ | `discovery-report.md.hbs` | DISCOVER | Technology stack detection and structure overview |
20
+ | `inventory.json.schema` | INVENTORY | JSON schema for asset catalog |
21
+ | `analysis-report.md.hbs` | ANALYZE | Code quality and technical debt analysis |
22
+ | `dead-code-report.md.hbs` | ANALYZE | Dead code identification and locations |
23
+ | `tech-debt.md.hbs` | ANALYZE | Technical debt catalog with priorities |
24
+ | `api-spec.yaml.hbs` | MAP | OpenAPI 3.0 API specification |
25
+ | `database-schema.md.hbs` | MAP | Database schema documentation with ER diagram |
26
+ | `business-rules.md.hbs` | DOCUMENT | Business rules extracted from code |
27
+ | `migration-roadmap.md.hbs` | RECOMMEND | Migration strategy and phased roadmap |
28
+ | `final-report.md.hbs` | RECOMMEND | Executive summary consolidating all findings |
29
+
30
+ ---
31
+
32
+ ## Handlebars Syntax
33
+
34
+ ### Variables
35
+
36
+ ```handlebars
37
+ {{projectName}}
38
+ {{stack.language}}
39
+ {{stack.framework}}
40
+ ```
41
+
42
+ ### Conditionals
43
+
44
+ ```handlebars
45
+ {{#if hasTests}}
46
+ Test coverage: {{coverage}}%
47
+ {{else}}
48
+ No tests found
49
+ {{/if}}
50
+ ```
51
+
52
+ ### Loops
53
+
54
+ ```handlebars
55
+ {{#each routes}}
56
+ - {{method}} {{path}}
57
+ {{/each}}
58
+ ```
59
+
60
+ ### Helpers
61
+
62
+ ```handlebars
63
+ {{uppercase stack.framework}}
64
+ {{formatDate analysis.completedAt}}
65
+ {{pluralize issueCount "issue"}}
66
+ ```
67
+
68
+ ---
69
+
70
+ ## Severity Classification
71
+
72
+ All templates that report issues MUST use this classification (from AGENT-PROMPT-STANDARDS v1.1):
73
+
74
+ | Severity | Emoji | Meaning |
75
+ |----------|-------|---------|
76
+ | `CRITICAL` | ❌ | Blocks progress, security risk, data loss |
77
+ | `HIGH` | ⚠️ | Significant issue, violates architecture |
78
+ | `MEDIUM` | ⚡ | Quality issue, technical debt |
79
+ | `LOW` | ℹ️ | Minor improvement, style |
80
+
81
+ ### Example Usage
82
+
83
+ ```markdown
84
+ ## Findings
85
+
86
+ ### ❌ CRITICAL
87
+ - **SEC-001**: SQL injection vulnerability
88
+ - Location: `src/api/users.php:45`
89
+ - Impact: Data breach risk
90
+ - Fix: Use parameterized queries
91
+
92
+ ### ⚠️ HIGH
93
+ - **ARCH-001**: Circular dependency detected
94
+ - Location: ServiceA -> ServiceB -> ServiceA
95
+ - Impact: Hard to test, fragile
96
+ - Fix: Introduce interface, dependency injection
97
+ ```
98
+
99
+ ---
100
+
101
+ ## Template Development Guidelines
102
+
103
+ ### DO
104
+ - Use semantic variable names (`{{controllerCount}}` not `{{c}}`)
105
+ - Include examples in comments
106
+ - Provide fallback values for optional fields
107
+ - Follow AGENT-PROMPT-STANDARDS severity classification
108
+ - Use Mermaid for diagrams when applicable
109
+ - Include location (file:line) for all findings
110
+
111
+ ### DON'T
112
+ - Hardcode values (use variables)
113
+ - Expose secrets in templates
114
+ - Use complex logic (keep templates simple)
115
+ - Assume all fields are present (use conditionals)
116
+ - Mix concerns (one template per artifact type)
117
+
118
+ ---
119
+
120
+ ## Mermaid Diagrams
121
+
122
+ Templates use [Mermaid](https://mermaid.js.org/) for visual diagrams:
123
+
124
+ ### Entity-Relationship Diagram
125
+
126
+ ```mermaid
127
+ erDiagram
128
+ CUSTOMER ||--o{ ORDER : places
129
+ ORDER ||--|{ LINE_ITEM : contains
130
+ CUSTOMER {
131
+ int id PK
132
+ string name
133
+ string email UK
134
+ }
135
+ ```
136
+
137
+ ### Flowchart
138
+
139
+ ```mermaid
140
+ flowchart TD
141
+ A[Start] --> B{Has Tests?}
142
+ B -->|Yes| C[Run Tests]
143
+ B -->|No| D[Skip Tests]
144
+ C --> E[Deploy]
145
+ D --> E
146
+ ```
147
+
148
+ ### Sequence Diagram
149
+
150
+ ```mermaid
151
+ sequenceDiagram
152
+ User->>Controller: HTTP Request
153
+ Controller->>Service: Business Logic
154
+ Service->>Repository: Database Query
155
+ Repository-->>Service: Data
156
+ Service-->>Controller: Response
157
+ Controller-->>User: HTTP Response
158
+ ```
159
+
160
+ ---
161
+
162
+ ## Adding a New Template
163
+
164
+ ### 1. Create Template File
165
+
166
+ ```bash
167
+ touch .orchestrator/templates/legacy/my-artifact.md.hbs
168
+ ```
169
+
170
+ ### 2. Define Template Structure
171
+
172
+ ```handlebars
173
+ # {{artifactName}}
174
+
175
+ **Generated:** {{generatedAt}}
176
+ **Agent:** {{agentName}}
177
+
178
+ ---
179
+
180
+ ## Summary
181
+
182
+ {{summary}}
183
+
184
+ ---
185
+
186
+ ## Details
187
+
188
+ {{#each items}}
189
+ ### {{name}}
190
+ - **Type:** {{type}}
191
+ - **Location:** {{location}}
192
+ - **Severity:** {{severity}}
193
+ {{/each}}
194
+ ```
195
+
196
+ ### 3. Document Variables
197
+
198
+ Add to README.md:
199
+
200
+ ```markdown
201
+ ### my-artifact.md.hbs
202
+
203
+ **Phase:** MY_PHASE
204
+ **Variables:**
205
+ - `artifactName` (string): Name of the artifact
206
+ - `generatedAt` (ISO8601): Generation timestamp
207
+ - `agentName` (string): Generating agent
208
+ - `summary` (string): Brief summary
209
+ - `items` (array): List of findings
210
+ - `name` (string)
211
+ - `type` (string)
212
+ - `location` (string)
213
+ - `severity` (CRITICAL|HIGH|MEDIUM|LOW)
214
+ ```
215
+
216
+ ### 4. Test Template
217
+
218
+ Create test data and render:
219
+
220
+ ```javascript
221
+ const Handlebars = require('handlebars');
222
+ const template = fs.readFileSync('my-artifact.md.hbs', 'utf8');
223
+ const render = Handlebars.compile(template);
224
+ const output = render(testData);
225
+ ```
226
+
227
+ ---
228
+
229
+ ## Variable Conventions
230
+
231
+ ### Naming
232
+ - Use camelCase: `controllerCount`, `apiEndpoints`
233
+ - Use descriptive names: `databaseTableCount` not `dbtc`
234
+ - Use plurals for arrays: `routes`, `models`, `findings`
235
+
236
+ ### Types
237
+ - **String**: `projectName`, `stackLanguage`
238
+ - **Number**: `fileCount`, `lineOfCode`
239
+ - **Boolean**: `hasTests`, `isLegacy`
240
+ - **Date**: `analyzedAt`, `createdAt` (ISO8601 format)
241
+ - **Array**: `routes`, `models`, `findings`
242
+ - **Object**: `stack`, `metrics`, `analysis`
243
+
244
+ ### Required vs Optional
245
+
246
+ Mark optional variables in documentation:
247
+
248
+ ```markdown
249
+ - `projectName` (string, required): Project name
250
+ - `description` (string, optional): Project description
251
+ - `tests` (array, optional): Test files found
252
+ ```
253
+
254
+ ---
255
+
256
+ ## Validation
257
+
258
+ Templates are validated before rendering:
259
+
260
+ 1. **Syntax Validation**: Valid Handlebars syntax
261
+ 2. **Variable Validation**: All referenced variables provided
262
+ 3. **Output Validation**: Generated artifact matches expected schema
263
+ 4. **Security Validation**: No secrets exposed in output
264
+
265
+ ---
266
+
267
+ ## References
268
+
269
+ - [Handlebars Documentation](https://handlebarsjs.com/)
270
+ - [Mermaid Documentation](https://mermaid.js.org/)
271
+ - [AGENT-PROMPT-STANDARDS](../../../project-guidelines/agents/AGENT-PROMPT-STANDARDS.md)
272
+ - [RFC-004 Legacy Analysis Workflow](../../../project-guidelines/rfcs/RFC-004-LEGACY-ANALYSIS-WORKFLOW.md)
273
+
274
+ ---
275
+
276
+ ## Directory Contents
277
+
278
+ ```
279
+ templates/legacy/
280
+ ├── README.md # This file
281
+ ├── discovery-report.md.hbs # Discovery phase
282
+ ├── inventory.json.schema # Inventory schema
283
+ ├── analysis-report.md.hbs # Analysis phase
284
+ ├── dead-code-report.md.hbs # Dead code findings
285
+ ├── tech-debt.md.hbs # Technical debt catalog
286
+ ├── api-spec.yaml.hbs # API specification
287
+ ├── database-schema.md.hbs # Database schema
288
+ ├── business-rules.md.hbs # Business rules
289
+ ├── migration-roadmap.md.hbs # Migration roadmap
290
+ └── final-report.md.hbs # Final report
291
+ ```
292
+
293
+ ---
294
+
295
+ **Maintained by:** Orchestrator System
296
+ **Last Updated:** 2026-01-23