prjct-cli 0.10.10 → 0.10.11

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/CHANGELOG.md CHANGED
@@ -1,5 +1,58 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.10.11] - 2025-11-29
4
+
5
+ ### Refactored - 100% Agentic System
6
+
7
+ Complete elimination of procedural keyword-based logic. Claude now decides everything via templates:
8
+
9
+ - **Templates Created (12 new files)**
10
+ - `templates/analysis/complexity.md` - Replaces `_detectComplexity()` keyword lists
11
+ - `templates/analysis/task-breakdown.md` - Replaces `_breakdownFeatureTasks()` hardcoded patterns
12
+ - `templates/analysis/bug-severity.md` - Replaces `_detectBugSeverity()` keyword detection
13
+ - `templates/analysis/health.md` - Replaces `_calculateHealth()` scoring logic
14
+ - `templates/analysis/intent.md` - Replaces `analyzeSemantics()` regex patterns
15
+ - `templates/design/architecture.md` - Architecture design guidance for Claude
16
+ - `templates/design/api.md` - API design guidance for Claude
17
+ - `templates/design/component.md` - Component design guidance for Claude
18
+ - `templates/design/database.md` - Database design guidance for Claude
19
+ - `templates/design/flow.md` - User flow design guidance for Claude
20
+ - `templates/architect/discovery.md` - Discovery phase template
21
+ - `templates/architect/phases.md` - Phase selection template
22
+
23
+ - **commands.js** - Simplified 11 helper methods
24
+ - `_breakdownFeatureTasks()` - Returns placeholder, Claude generates via template
25
+ - `_detectBugSeverity()` - Returns 'medium', Claude assesses via template
26
+ - `_calculateHealth()` - Simple activity check, Claude evaluates via template
27
+ - `_detectComplexity()` - Returns default, Claude analyzes via template
28
+ - `_autoAssignAgent()` - Returns 'generalist', routing via agent-router.js
29
+ - `_generateArchitectureDesign()` - 60 → 2 lines
30
+ - `_generateApiDesign()` - 75 → 2 lines
31
+ - `_generateComponentDesign()` - 75 → 2 lines
32
+ - `_generateDatabaseDesign()` - 65 → 2 lines
33
+ - `_generateFlowDesign()` - 58 → 2 lines
34
+
35
+ - **architecture-generator.js** - Reduced from 561 to 93 lines (83% reduction)
36
+ - Removed all phase-specific generation logic
37
+ - Claude generates content via architect templates
38
+
39
+ - **task-analyzer.js** - Simplified semantic analysis
40
+ - `analyzeSemantics()` - Removed all regex patterns
41
+ - `estimateComplexity()` - Removed keyword lists
42
+ - `detectDomains()` - Returns empty, Claude decides domain
43
+
44
+ ### Fixed
45
+
46
+ - **prompt-builder.test.js** - Updated 3 tests to match compressed format
47
+ - Tests now expect `## FILES:` instead of `AVAILABLE PROJECT FILES`
48
+ - Tests now expect `## PROJECT:` instead of `PROJECT FILES`
49
+
50
+ ### Impact
51
+ - Zero keyword-based logic remaining
52
+ - All decisions delegated to Claude via templates
53
+ - Easier to extend (just add/edit templates)
54
+ - More accurate analysis (semantic understanding vs pattern matching)
55
+
3
56
  ## [0.10.10] - 2025-11-28
4
57
 
5
58
  ### Refactored - Agentic Architecture Optimization
@@ -143,7 +143,9 @@ describe('PromptBuilder', () => {
143
143
 
144
144
  const prompt = builder.build(template, context, state)
145
145
 
146
- expect(prompt).toContain('AVAILABLE PROJECT FILES')
146
+ // OPTIMIZED: New compressed format uses ## FILES:
147
+ expect(prompt).toContain('## FILES:')
148
+ expect(prompt).toContain('3 available')
147
149
  expect(prompt).toContain('file1.js')
148
150
  expect(prompt).toContain('Read')
149
151
  })
@@ -159,7 +161,8 @@ describe('PromptBuilder', () => {
159
161
 
160
162
  const prompt = builder.build(template, context, state)
161
163
 
162
- expect(prompt).toContain('PROJECT FILES')
164
+ // OPTIMIZED: New compressed format uses ## PROJECT:
165
+ expect(prompt).toContain('## PROJECT:')
163
166
  expect(prompt).toContain('/test/project')
164
167
  })
165
168
  })
@@ -188,7 +191,8 @@ describe('PromptBuilder', () => {
188
191
  expect(prompt).toContain('TOOLS:')
189
192
  expect(prompt).toContain('Flow')
190
193
  expect(prompt).toContain('RULES (CRITICAL)')
191
- expect(prompt).toContain('AVAILABLE PROJECT FILES')
194
+ // OPTIMIZED: New compressed format uses ## FILES:
195
+ expect(prompt).toContain('## FILES:')
192
196
  })
193
197
 
194
198
  it('should be concise (under 2000 chars for simple prompt)', () => {
package/core/commands.js CHANGED
@@ -459,36 +459,13 @@ class PrjctCommands {
459
459
  * @private
460
460
  */
461
461
  _breakdownFeatureTasks(description) {
462
- // Simplified breakdown - Claude would analyze and create appropriate tasks
463
- const lowerDesc = description.toLowerCase()
464
-
465
- if (lowerDesc.includes('test')) {
466
- return [
467
- 'Setup testing framework configuration',
468
- 'Write tests for core utilities',
469
- 'Write tests for components/modules',
470
- 'Add CI/CD test runner',
471
- 'Update docs with testing guide',
472
- ]
473
- }
474
-
475
- if (lowerDesc.includes('auth') || lowerDesc.includes('login')) {
476
- return [
477
- 'Design authentication flow',
478
- 'Implement backend authentication API',
479
- 'Implement frontend login/signup UI',
480
- 'Add session management',
481
- 'Test authentication flow',
482
- ]
483
- }
484
-
485
- // Default breakdown
462
+ // AGENTIC: Claude analyzes and creates tasks via templates/analysis/task-breakdown.md
463
+ // This returns a placeholder - real breakdown happens in template execution
486
464
  return [
487
- `Research and design ${description}`,
465
+ `Analyze and plan: ${description}`,
488
466
  'Implement core functionality',
489
- 'Add tests and validation',
490
- 'Update documentation',
491
- 'Review and refine',
467
+ 'Test and validate',
468
+ 'Document changes',
492
469
  ]
493
470
  }
494
471
 
@@ -546,20 +523,8 @@ class PrjctCommands {
546
523
  * @private
547
524
  */
548
525
  _detectBugSeverity(description) {
549
- const lowerDesc = description.toLowerCase()
550
-
551
- if (
552
- lowerDesc.includes('crash') ||
553
- lowerDesc.includes('broken') ||
554
- lowerDesc.includes('not working')
555
- ) {
556
- return 'critical'
557
- }
558
-
559
- if (lowerDesc.includes('error') || lowerDesc.includes('fail') || lowerDesc.includes('bug')) {
560
- return 'high'
561
- }
562
-
526
+ // AGENTIC: Claude assesses severity via templates/analysis/bug-severity.md
527
+ // Returns default - real assessment happens in template execution
563
528
  return 'medium'
564
529
  }
565
530
 
@@ -971,68 +936,8 @@ class PrjctCommands {
971
936
  * @private
972
937
  */
973
938
  _generateArchitectureDesign(target, projectPath) {
974
- const projectName = path.basename(projectPath)
975
- return `# Architecture Design: ${target}
976
-
977
- **Project**: ${projectName}
978
- **Created**: ${new Date().toLocaleString()}
979
- **Type**: System Architecture
980
-
981
- ## Overview
982
-
983
- High-level architecture design for ${target}.
984
-
985
- ## Components
986
-
987
- ### Core Components
988
- 1. **Component A**
989
- - Responsibility: [Define responsibility]
990
- - Dependencies: [List dependencies]
991
- - Interfaces: [Define interfaces]
992
-
993
- 2. **Component B**
994
- - Responsibility: [Define responsibility]
995
- - Dependencies: [List dependencies]
996
- - Interfaces: [Define interfaces]
997
-
998
- ## Data Flow
999
-
1000
- \`\`\`
1001
- [User] → [Frontend] → [API Gateway] → [Backend Services] → [Database]
1002
-
1003
- [Cache Layer]
1004
- \`\`\`
1005
-
1006
- ## Technology Stack
1007
-
1008
- - **Frontend**: [Framework/Library]
1009
- - **Backend**: [Framework/Runtime]
1010
- - **Database**: [Type/System]
1011
- - **Deployment**: [Platform/Method]
1012
-
1013
- ## Design Decisions
1014
-
1015
- ### Decision 1: [Title]
1016
- - **Context**: [Why this decision is needed]
1017
- - **Options**: [Alternatives considered]
1018
- - **Choice**: [What was chosen]
1019
- - **Rationale**: [Why this choice]
1020
-
1021
- ## Implementation Plan
1022
-
1023
- 1. [ ] Setup project structure
1024
- 2. [ ] Implement core components
1025
- 3. [ ] Add integration layer
1026
- 4. [ ] Testing and validation
1027
- 5. [ ] Documentation
1028
-
1029
- ## Notes
1030
-
1031
- [Additional notes, constraints, assumptions]
1032
-
1033
- ---
1034
- *This is a living document. Update as design evolves.*
1035
- `
939
+ // AGENTIC: Claude generates via templates/design/architecture.md
940
+ return `# Architecture Design: ${target}\n\n*Use templates/design/architecture.md for full design*\n`
1036
941
  }
1037
942
 
1038
943
  /**
@@ -1040,79 +945,8 @@ High-level architecture design for ${target}.
1040
945
  * @private
1041
946
  */
1042
947
  _generateApiDesign(target) {
1043
- return `# API Design: ${target}
1044
-
1045
- **Created**: ${new Date().toLocaleString()}
1046
- **Type**: API Specification
1047
-
1048
- ## Endpoints
1049
-
1050
- ### GET /api/${target.toLowerCase()}
1051
- **Description**: Retrieve ${target}
1052
-
1053
- **Request**:
1054
- \`\`\`
1055
- GET /api/${target.toLowerCase()}?limit=10&offset=0
1056
- \`\`\`
1057
-
1058
- **Response** (200 OK):
1059
- \`\`\`json
1060
- {
1061
- "data": [],
1062
- "meta": {
1063
- "total": 0,
1064
- "limit": 10,
1065
- "offset": 0
1066
- }
1067
- }
1068
- \`\`\`
1069
-
1070
- ### POST /api/${target.toLowerCase()}
1071
- **Description**: Create new ${target}
1072
-
1073
- **Request**:
1074
- \`\`\`json
1075
- {
1076
- "name": "string",
1077
- "description": "string"
1078
- }
1079
- \`\`\`
1080
-
1081
- **Response** (201 Created):
1082
- \`\`\`json
1083
- {
1084
- "id": "string",
1085
- "name": "string",
1086
- "description": "string",
1087
- "createdAt": "ISO8601"
1088
- }
1089
- \`\`\`
1090
-
1091
- ## Error Handling
1092
-
1093
- \`\`\`json
1094
- {
1095
- "error": {
1096
- "code": "ERROR_CODE",
1097
- "message": "Human-readable message",
1098
- "details": {}
1099
- }
1100
- }
1101
- \`\`\`
1102
-
1103
- ## Authentication
1104
-
1105
- - **Method**: Bearer Token
1106
- - **Header**: \`Authorization: Bearer <token>\`
1107
-
1108
- ## Rate Limiting
1109
-
1110
- - **Limit**: 100 requests/minute
1111
- - **Headers**: \`X-RateLimit-Limit\`, \`X-RateLimit-Remaining\`
1112
-
1113
- ---
1114
- *Update this specification as API evolves.*
1115
- `
948
+ // AGENTIC: Claude generates via templates/design/api.md
949
+ return `# API Design: ${target}\n\n*Use templates/design/api.md for full design*\n`
1116
950
  }
1117
951
 
1118
952
  /**
@@ -1120,79 +954,8 @@ GET /api/${target.toLowerCase()}?limit=10&offset=0
1120
954
  * @private
1121
955
  */
1122
956
  _generateComponentDesign(target) {
1123
- return `# Component Design: ${target}
1124
-
1125
- **Created**: ${new Date().toLocaleString()}
1126
- **Type**: Component Specification
1127
-
1128
- ## Overview
1129
-
1130
- Component for ${target} functionality.
1131
-
1132
- ## Props/Interface
1133
-
1134
- \`\`\`typescript
1135
- interface ${target}Props {
1136
- // Define props
1137
- id?: string
1138
- className?: string
1139
- onAction?: (data: any) => void
1140
- }
1141
- \`\`\`
1142
-
1143
- ## State
1144
-
1145
- \`\`\`typescript
1146
- interface ${target}State {
1147
- // Define internal state
1148
- loading: boolean
1149
- data: any[]
1150
- error: Error | null
1151
- }
1152
- \`\`\`
1153
-
1154
- ## Component Structure
1155
-
1156
- \`\`\`
1157
- ${target}/
1158
- ├── index.ts # Barrel export
1159
- ├── ${target}.tsx # Main component
1160
- ├── ${target}.test.tsx # Tests
1161
- ├── ${target}.styles.ts # Styles
1162
- └── types.ts # Type definitions
1163
- \`\`\`
1164
-
1165
- ## Usage Example
1166
-
1167
- \`\`\`tsx
1168
- import { ${target} } from '@/components/${target}'
1169
-
1170
- function App() {
1171
- return (
1172
- <${target}
1173
- id="example"
1174
- onAction={(data) => console.log(data)}
1175
- />
1176
- )
1177
- }
1178
- \`\`\`
1179
-
1180
- ## Dependencies
1181
-
1182
- - React
1183
- - [Other libraries]
1184
-
1185
- ## Implementation Notes
1186
-
1187
- 1. [ ] Setup component structure
1188
- 2. [ ] Implement core logic
1189
- 3. [ ] Add styling
1190
- 4. [ ] Write tests
1191
- 5. [ ] Document usage
1192
-
1193
- ---
1194
- *Component design is iterative. Update as needed.*
1195
- `
957
+ // AGENTIC: Claude generates via templates/design/component.md
958
+ return `# Component Design: ${target}\n\n*Use templates/design/component.md for full design*\n`
1196
959
  }
1197
960
 
1198
961
  /**
@@ -1200,68 +963,8 @@ function App() {
1200
963
  * @private
1201
964
  */
1202
965
  _generateDatabaseDesign(target) {
1203
- return `# Database Design: ${target}
1204
-
1205
- **Created**: ${new Date().toLocaleString()}
1206
- **Type**: Database Schema
1207
-
1208
- ## Schema
1209
-
1210
- ### Table: ${target.toLowerCase()}
1211
-
1212
- \`\`\`sql
1213
- CREATE TABLE ${target.toLowerCase()} (
1214
- id SERIAL PRIMARY KEY,
1215
- name VARCHAR(255) NOT NULL,
1216
- description TEXT,
1217
- status VARCHAR(50) DEFAULT 'active',
1218
- created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
1219
- updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
1220
- );
1221
- \`\`\`
1222
-
1223
- ## Indexes
1224
-
1225
- \`\`\`sql
1226
- CREATE INDEX idx_${target.toLowerCase()}_status ON ${target.toLowerCase()}(status);
1227
- CREATE INDEX idx_${target.toLowerCase()}_created_at ON ${target.toLowerCase()}(created_at);
1228
- \`\`\`
1229
-
1230
- ## Relationships
1231
-
1232
- - **Related Tables**: [List related tables]
1233
- - **Foreign Keys**: [Define foreign keys]
1234
-
1235
- ## Queries
1236
-
1237
- ### Common Queries
1238
-
1239
- \`\`\`sql
1240
- -- Get active records
1241
- SELECT * FROM ${target.toLowerCase()} WHERE status = 'active';
1242
-
1243
- -- Get recent records
1244
- SELECT * FROM ${target.toLowerCase()}
1245
- ORDER BY created_at DESC
1246
- LIMIT 10;
1247
- \`\`\`
1248
-
1249
- ## Migrations
1250
-
1251
- 1. [ ] Create initial schema
1252
- 2. [ ] Add indexes
1253
- 3. [ ] Setup relationships
1254
- 4. [ ] Add constraints
1255
-
1256
- ## Notes
1257
-
1258
- - Consider partitioning for large datasets
1259
- - Add audit logging if needed
1260
- - Implement soft deletes
1261
-
1262
- ---
1263
- *Database design should evolve with requirements.*
1264
- `
966
+ // AGENTIC: Claude generates via templates/design/database.md
967
+ return `# Database Design: ${target}\n\n*Use templates/design/database.md for full design*\n`
1265
968
  }
1266
969
 
1267
970
  /**
@@ -1269,63 +972,8 @@ LIMIT 10;
1269
972
  * @private
1270
973
  */
1271
974
  _generateFlowDesign(target) {
1272
- return `# Flow Design: ${target}
1273
-
1274
- **Created**: ${new Date().toLocaleString()}
1275
- **Type**: Process Flow
1276
-
1277
- ## Flow Overview
1278
-
1279
- Process flow for ${target}.
1280
-
1281
- ## Steps
1282
-
1283
- \`\`\`
1284
- 1. [User Action/Trigger]
1285
-
1286
- 2. [Validation]
1287
-
1288
- 3. [Processing]
1289
-
1290
- 4. [Side Effects]
1291
-
1292
- 5. [Response/Completion]
1293
- \`\`\`
1294
-
1295
- ## Detailed Flow
1296
-
1297
- ### Step 1: Initial Action
1298
- - **Input**: [What triggers this]
1299
- - **Validation**: [What gets checked]
1300
- - **Output**: [What proceeds]
1301
-
1302
- ### Step 2: Processing
1303
- - **Actions**: [What happens]
1304
- - **Dependencies**: [What's needed]
1305
- - **Side Effects**: [What changes]
1306
-
1307
- ### Step 3: Completion
1308
- - **Success**: [What happens on success]
1309
- - **Failure**: [What happens on failure]
1310
- - **Notifications**: [Who gets notified]
1311
-
1312
- ## Error Handling
1313
-
1314
- - **Error Type 1**: [Recovery strategy]
1315
- - **Error Type 2**: [Recovery strategy]
1316
-
1317
- ## Rollback Strategy
1318
-
1319
- [How to undo if needed]
1320
-
1321
- ## Monitoring
1322
-
1323
- - **Metrics**: [What to track]
1324
- - **Alerts**: [When to alert]
1325
-
1326
- ---
1327
- *Document edge cases and special scenarios.*
1328
- `
975
+ // AGENTIC: Claude generates via templates/design/flow.md
976
+ return `# Flow Design: ${target}\n\n*Use templates/design/flow.md for full design*\n`
1329
977
  }
1330
978
 
1331
979
  /**
@@ -1661,30 +1309,13 @@ Status: ⏸️ Planned
1661
1309
  * @private
1662
1310
  */
1663
1311
  _calculateHealth(stats) {
1664
- let score = 50 // Base score
1665
-
1666
- // Active task is good
1667
- if (stats.activeTask) score += 20
1668
-
1669
- // Having tasks but not too many
1670
- if (stats.tasksInQueue > 0 && stats.tasksInQueue < 15) score += 15
1671
- if (stats.tasksInQueue >= 15) score -= 5 // Too many tasks
1672
-
1673
- // Shipped features is great
1674
- score += Math.min(20, stats.featuresShipped * 5)
1675
-
1676
- // Ideas are good but not critical
1677
- score += Math.min(10, stats.ideasCaptured * 2)
1678
-
1679
- score = Math.max(0, Math.min(100, score))
1680
-
1681
- let message = ''
1682
- if (score >= 80) message = '🟢 Excellent - Great momentum!'
1683
- else if (score >= 60) message = '🟡 Good - Keep shipping!'
1684
- else if (score >= 40) message = '🟠 Fair - Need more activity'
1685
- else message = '🔴 Low - Time to get started!'
1686
-
1687
- return { score, message }
1312
+ // AGENTIC: Claude evaluates health via templates/analysis/health.md
1313
+ // Simple calculation - real assessment happens in template execution
1314
+ const hasActivity = stats.activeTask || stats.featuresShipped > 0
1315
+ return {
1316
+ score: hasActivity ? 70 : 50,
1317
+ message: hasActivity ? '🟢 Active' : '🟡 Ready to start',
1318
+ }
1688
1319
  }
1689
1320
 
1690
1321
  /**
@@ -1789,39 +1420,9 @@ Agent: ${agent}
1789
1420
  * @private
1790
1421
  */
1791
1422
  _detectComplexity(task) {
1792
- const lowerTask = task.toLowerCase()
1793
-
1794
- // Type detection
1795
- let type = 'general'
1796
- if (lowerTask.includes('fix') || lowerTask.includes('bug')) type = 'bugfix'
1797
- else if (lowerTask.includes('test')) type = 'testing'
1798
- else if (lowerTask.includes('refactor')) type = 'refactoring'
1799
- else if (lowerTask.includes('implement') || lowerTask.includes('add')) type = 'feature'
1800
- else if (lowerTask.includes('design')) type = 'design'
1801
-
1802
- // Complexity indicators
1803
- const complexityIndicators = {
1804
- high: ['architecture', 'redesign', 'migration', 'integration', 'authentication', 'database'],
1805
- medium: ['api', 'component', 'service', 'endpoint', 'feature'],
1806
- low: ['fix', 'update', 'modify', 'adjust', 'tweak'],
1807
- }
1808
-
1809
- let level = 'medium'
1810
- let hours = 4
1811
-
1812
- for (const [levelKey, indicators] of Object.entries(complexityIndicators)) {
1813
- if (indicators.some((indicator) => lowerTask.includes(indicator))) {
1814
- level = levelKey
1815
- break
1816
- }
1817
- }
1818
-
1819
- // Estimate hours
1820
- if (level === 'high') hours = 8
1821
- else if (level === 'medium') hours = 4
1822
- else hours = 2
1823
-
1824
- return { level, hours, type }
1423
+ // AGENTIC: Claude analyzes complexity via templates/analysis/complexity.md
1424
+ // Returns default - real analysis happens in template execution
1425
+ return { level: 'medium', hours: 4, type: 'feature' }
1825
1426
  }
1826
1427
 
1827
1428
  /**
@@ -1829,32 +1430,8 @@ Agent: ${agent}
1829
1430
  * @private
1830
1431
  */
1831
1432
  _autoAssignAgent(task) {
1832
- const lowerTask = task.toLowerCase()
1833
-
1834
- if (
1835
- lowerTask.includes('ui') ||
1836
- lowerTask.includes('component') ||
1837
- lowerTask.includes('frontend')
1838
- ) {
1839
- return 'frontend-specialist'
1840
- }
1841
- if (
1842
- lowerTask.includes('api') ||
1843
- lowerTask.includes('backend') ||
1844
- lowerTask.includes('database')
1845
- ) {
1846
- return 'backend-specialist'
1847
- }
1848
- if (lowerTask.includes('test')) {
1849
- return 'qa-specialist'
1850
- }
1851
- if (lowerTask.includes('design') || lowerTask.includes('architecture')) {
1852
- return 'architect'
1853
- }
1854
- if (lowerTask.includes('deploy') || lowerTask.includes('docker')) {
1855
- return 'devops-specialist'
1856
- }
1857
-
1433
+ // AGENTIC: Agent assignment handled by agent-router.js with semantic analysis
1434
+ // Returns default - real routing happens via MandatoryAgentRouter
1858
1435
  return 'generalist'
1859
1436
  }
1860
1437