prjct-cli 0.10.9 → 0.10.10

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.
@@ -1,71 +1,262 @@
1
1
  ---
2
- allowed-tools: [Read, Write, Bash, Glob, Grep, TodoWrite]
2
+ allowed-tools: [Read, Write, Bash, Glob, Grep]
3
3
  description: 'Sync state + generate agents + detect patterns'
4
+ timestamp-rule: 'GetTimestamp() for all timestamps'
4
5
  ---
5
6
 
6
- # /p:sync
7
+ # /p:sync - Sync Project State
7
8
 
8
- ## Flow
9
+ ## Context Variables
10
+ - `{projectId}`: From `.prjct/prjct.config.json`
11
+ - `{globalPath}`: `~/.prjct-cli/projects/{projectId}`
12
+ - `{analysisPath}`: `{globalPath}/analysis`
13
+ - `{agentsPath}`: `{globalPath}/agents`
14
+ - `{memoryPath}`: `{globalPath}/memory/context.jsonl`
9
15
 
10
- 1. Execute `/p:analyze` generates `analysis/repo-summary.md`
11
- 2. Execute pattern analysis → generates `analysis/patterns.md`
12
- 3. Read both analysis files
13
- 4. Generate agents per technology → `agents/`
14
- 5. Update `CLAUDE.md` with patterns summary
15
- 6. Log to memory
16
+ ## Step 1: Read Config
16
17
 
17
- ## Pattern Analysis (Step 2)
18
+ READ: `.prjct/prjct.config.json`
19
+ EXTRACT: `projectId`
18
20
 
19
- Read `templates/analysis/patterns.md` and execute:
21
+ IF file not found:
22
+ OUTPUT: "No prjct project. Run /p:init first."
23
+ STOP
20
24
 
21
- 1. **Sample 5-10 source files** across different directories
22
- 2. **Detect design patterns**: SOLID, DRY, factories, etc.
23
- 3. **Extract conventions**: naming, style, structure
24
- 4. **Flag anti-patterns**: god classes, duplication, mixed concerns
25
- 5. **Generate recommendations**: immediate fixes + best practices
25
+ ## Step 2: Analyze Repository
26
26
 
27
- ### Key Files to Analyze
27
+ ### Detect Stack
28
+ GLOB: `**/*.{js,ts,jsx,tsx,py,rb,go,rs,java}`
29
+ GLOB: `**/package.json`, `**/Cargo.toml`, `**/go.mod`, `**/requirements.txt`
30
+
31
+ EXTRACT:
32
+ - {languages}: List of languages found
33
+ - {frameworks}: Detected frameworks (React, Express, Django, etc.)
34
+ - {packageManager}: npm, yarn, pnpm, pip, cargo, etc.
35
+
36
+ ### Analyze File Structure
37
+ BASH: `find . -type f -name "*.{ext}" | head -50`
38
+
39
+ DETERMINE:
40
+ - {sourceDir}: Main source directory (src/, lib/, app/)
41
+ - {testDir}: Test directory (test/, tests/, __tests__/)
42
+ - {configFiles}: Config files found
43
+
44
+ ### Generate repo-summary.md
45
+
46
+ WRITE: `{analysisPath}/repo-summary.md`
47
+
48
+ ```markdown
49
+ # Repository Summary
50
+
51
+ > Generated: {GetTimestamp()}
52
+
53
+ ## Stack
54
+ - Languages: {languages}
55
+ - Frameworks: {frameworks}
56
+ - Package Manager: {packageManager}
57
+
58
+ ## Structure
59
+ - Source: {sourceDir}
60
+ - Tests: {testDir}
61
+ - Entry: {entryPoint}
62
+
63
+ ## Files
64
+ - Total: {fileCount}
65
+ - Source: {sourceCount}
66
+ - Tests: {testCount}
28
67
  ```
29
- - Main entry point (bin/, src/index, main)
30
- - Largest source files (potential god classes)
31
- - Utility/helper directories (DRY evidence)
32
- - Test files (testing patterns)
33
- - Config files (tooling conventions)
68
+
69
+ ## Step 3: Pattern Analysis
70
+
71
+ ### Sample Files
72
+ READ 5-10 representative source files:
73
+ - Main entry point
74
+ - Largest files (potential complexity)
75
+ - Utility/helper files
76
+ - Test files
77
+ - Config files
78
+
79
+ ### Detect Patterns
80
+
81
+ Analyze for:
82
+ 1. **SOLID Principles**: Evidence of each
83
+ 2. **DRY**: Shared utilities, constants
84
+ 3. **Design Patterns**: Factory, singleton, observer, repository
85
+ 4. **Code Style**: Naming, formatting, imports
86
+
87
+ ### Detect Anti-Patterns
88
+
89
+ Flag:
90
+ - God classes (files > 300 lines)
91
+ - Deep nesting (> 4 levels)
92
+ - Code duplication
93
+ - Magic numbers
94
+ - Mixed concerns
95
+
96
+ ### Generate patterns.md
97
+
98
+ WRITE: `{analysisPath}/patterns.md`
99
+
100
+ ```markdown
101
+ # Code Patterns - {project}
102
+
103
+ > Generated: {GetTimestamp()}
104
+
105
+ ## Patterns Detected
106
+ - {pattern}: {where} - {example}
107
+
108
+ ## Conventions (MUST FOLLOW)
109
+ - Functions: {convention}
110
+ - Classes: {convention}
111
+ - Files: {convention}
112
+ - Async: {pattern}
113
+
114
+ ## Anti-Patterns ⚠️
115
+ 1. **{issue}**: {file:line} - Fix: {action}
116
+
117
+ ## Recommendations
118
+ 1. {action}
34
119
  ```
35
120
 
36
- ### Output
37
- Save to `analysis/patterns.md` with:
38
- - Detected patterns (what to follow)
39
- - Conventions (MUST match in new code)
40
- - Anti-patterns found (with fixes)
41
- - Recommendations (for quality)
121
+ ## Step 4: Generate Agents
122
+
123
+ Based on detected stack, generate specialized agents:
124
+
125
+ ### Agent Generation Rules
42
126
 
43
- ## Agent Generation (Step 4)
127
+ IF {languages} includes JavaScript/TypeScript:
128
+ IF React/Vue/Angular detected:
129
+ GENERATE: `agents/fe.md` (Frontend Specialist)
130
+ IF Express/Fastify/Nest detected:
131
+ GENERATE: `agents/be.md` (Backend Specialist)
44
132
 
45
- Use: `generateDynamicAgent(name, config)`
133
+ IF {languages} includes Python:
134
+ GENERATE: `agents/py.md` (Python Specialist)
46
135
 
47
- ## CLAUDE.md Update (Step 5)
136
+ IF tests detected:
137
+ GENERATE: `agents/qa.md` (Quality Specialist)
138
+
139
+ ALWAYS GENERATE:
140
+ - `agents/coordinator.md` (Orchestration)
141
+
142
+ ### Agent Template
143
+
144
+ For each agent, WRITE to `{agentsPath}/{name}.md`:
48
145
 
49
- Add patterns summary section:
50
146
  ```markdown
51
- ## Code Patterns
147
+ # {Name} Agent
148
+
149
+ ## Role
150
+ {Specialized role description}
52
151
 
53
- **Follow these patterns in ALL new code:**
54
- - {key conventions from patterns.md}
55
- - {design patterns to apply}
152
+ ## Skills
153
+ - {skill1}
154
+ - {skill2}
56
155
 
57
- **Avoid these anti-patterns:**
58
- - {detected anti-patterns}
156
+ ## Patterns to Follow
157
+ {From patterns.md}
158
+
159
+ ## Files I Own
160
+ {Directories/patterns this agent handles}
161
+ ```
162
+
163
+ ## Step 5: Update Project CLAUDE.md
164
+
165
+ READ: `{globalPath}/CLAUDE.md`
166
+
167
+ IF exists:
168
+ ### Add Patterns Summary
169
+
170
+ INSERT section:
171
+ ```markdown
172
+ ## Code Patterns
173
+
174
+ **Follow in ALL new code:**
175
+ - {key conventions}
176
+ - {design patterns}
177
+
178
+ **Avoid:**
179
+ - {anti-patterns}
180
+ ```
181
+
182
+ WRITE: `{globalPath}/CLAUDE.md`
183
+
184
+ ## Step 6: Log to Memory
185
+
186
+ APPEND to: `{memoryPath}`
187
+
188
+ Single line (JSONL):
189
+ ```json
190
+ {"timestamp":"{GetTimestamp()}","action":"sync","stack":"{languages}","agents":{agentCount},"patterns":{patternCount}}
191
+ ```
192
+
193
+ ## Output
194
+
195
+ SUCCESS:
196
+ ```
197
+ 🔄 Synced
198
+
199
+ Stack:
200
+ ├── Languages: {languages}
201
+ ├── Frameworks: {frameworks}
202
+ └── Package Manager: {packageManager}
203
+
204
+ Generated:
205
+ ├── Agents: {agentCount}
206
+ ├── Patterns: {patternCount} detected
207
+ └── Anti-patterns: {antiPatternCount} flagged
208
+
209
+ Files:
210
+ ├── analysis/repo-summary.md
211
+ ├── analysis/patterns.md
212
+ └── agents/*.md
213
+
214
+ Next:
215
+ • /p:feature - Start building
216
+ • /p:context - See full context
217
+ • /p:now - Set current task
218
+ ```
219
+
220
+ ## Error Handling
221
+
222
+ | Error | Response | Action |
223
+ |-------|----------|--------|
224
+ | No config | "No prjct project" | STOP |
225
+ | No source files | "Empty project" | WARN, continue |
226
+ | Write fails | Log warning | CONTINUE |
227
+
228
+ ## Examples
229
+
230
+ ### Example 1: Node.js Project
59
231
  ```
232
+ 🔄 Synced
233
+
234
+ Stack:
235
+ ├── Languages: JavaScript, TypeScript
236
+ ├── Frameworks: Express, React
237
+ └── Package Manager: npm
60
238
 
61
- ## Response
239
+ Generated:
240
+ ├── Agents: 4 (coordinator, fe, be, qa)
241
+ ├── Patterns: 8 detected
242
+ └── Anti-patterns: 2 flagged
62
243
 
244
+ Next: /p:feature | /p:context
245
+ ```
246
+
247
+ ### Example 2: Python Project
63
248
  ```
64
249
  🔄 Synced
65
- ├── Stack: {languages/frameworks}
66
- ├── Agents: {count} generated
67
- ├── Patterns: {count} detected
68
- └── Anti-patterns: {count} flagged
69
250
 
70
- Next: /p:context or /p:now
251
+ Stack:
252
+ ├── Languages: Python
253
+ ├── Frameworks: Django
254
+ └── Package Manager: pip
255
+
256
+ Generated:
257
+ ├── Agents: 3 (coordinator, py, qa)
258
+ ├── Patterns: 5 detected
259
+ └── Anti-patterns: 1 flagged
260
+
261
+ Next: /p:feature | /p:context
71
262
  ```