prjct-cli 0.10.8 → 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,17 +1,262 @@
1
1
  ---
2
- allowed-tools: [Read, Write, Bash, TodoWrite]
3
- description: 'Sync state + generate agents'
2
+ allowed-tools: [Read, Write, Bash, Glob, Grep]
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
- 1. Execute `/p:analyze`
10
- 2. Read `analysis/repo-summary.md`
11
- 3. Generate agents per technology → `agents/`
12
- 4. Log to memory
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`
13
15
 
14
- Use: `generateDynamicAgent(name, config)`
16
+ ## Step 1: Read Config
15
17
 
16
- ## Response
17
- `🔄 Synced | Generated: {agents} | Next: /p:context`
18
+ READ: `.prjct/prjct.config.json`
19
+ EXTRACT: `projectId`
20
+
21
+ IF file not found:
22
+ OUTPUT: "No prjct project. Run /p:init first."
23
+ STOP
24
+
25
+ ## Step 2: Analyze Repository
26
+
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}
67
+ ```
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}
119
+ ```
120
+
121
+ ## Step 4: Generate Agents
122
+
123
+ Based on detected stack, generate specialized agents:
124
+
125
+ ### Agent Generation Rules
126
+
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)
132
+
133
+ IF {languages} includes Python:
134
+ GENERATE: `agents/py.md` (Python Specialist)
135
+
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`:
145
+
146
+ ```markdown
147
+ # {Name} Agent
148
+
149
+ ## Role
150
+ {Specialized role description}
151
+
152
+ ## Skills
153
+ - {skill1}
154
+ - {skill2}
155
+
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
231
+ ```
232
+ 🔄 Synced
233
+
234
+ Stack:
235
+ ├── Languages: JavaScript, TypeScript
236
+ ├── Frameworks: Express, React
237
+ └── Package Manager: npm
238
+
239
+ Generated:
240
+ ├── Agents: 4 (coordinator, fe, be, qa)
241
+ ├── Patterns: 8 detected
242
+ └── Anti-patterns: 2 flagged
243
+
244
+ Next: /p:feature | /p:context
245
+ ```
246
+
247
+ ### Example 2: Python Project
248
+ ```
249
+ 🔄 Synced
250
+
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
262
+ ```