prjct-cli 0.15.1 → 0.18.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.
- package/CHANGELOG.md +35 -0
- package/bin/dev.js +0 -1
- package/bin/serve.js +19 -20
- package/core/__tests__/agentic/memory-system.test.ts +2 -1
- package/core/__tests__/agentic/plan-mode.test.ts +2 -1
- package/core/agentic/agent-router.ts +79 -14
- package/core/agentic/command-executor/command-executor.ts +2 -74
- package/core/agentic/services.ts +0 -48
- package/core/agentic/template-loader.ts +35 -1
- package/core/command-registry/setup-commands.ts +15 -0
- package/core/commands/base.ts +96 -77
- package/core/commands/planning.ts +13 -2
- package/core/commands/setup.ts +3 -85
- package/core/domain/agent-generator.ts +9 -17
- package/core/errors.ts +209 -0
- package/core/infrastructure/config-manager.ts +22 -5
- package/core/infrastructure/path-manager.ts +23 -1
- package/core/infrastructure/setup.ts +5 -50
- package/core/storage/ideas-storage.ts +4 -0
- package/core/storage/queue-storage.ts +4 -0
- package/core/storage/shipped-storage.ts +4 -0
- package/core/storage/state-storage.ts +4 -0
- package/core/storage/storage-manager.ts +52 -13
- package/core/sync/auth-config.ts +145 -0
- package/core/sync/index.ts +30 -0
- package/core/sync/oauth-handler.ts +148 -0
- package/core/sync/sync-client.ts +252 -0
- package/core/sync/sync-manager.ts +358 -0
- package/core/utils/logger.ts +19 -12
- package/package.json +2 -4
- package/templates/agentic/subagent-generation.md +109 -0
- package/templates/commands/auth.md +234 -0
- package/templates/commands/sync.md +129 -13
- package/templates/subagents/domain/backend.md +105 -0
- package/templates/subagents/domain/database.md +118 -0
- package/templates/subagents/domain/devops.md +148 -0
- package/templates/subagents/domain/frontend.md +99 -0
- package/templates/subagents/domain/testing.md +169 -0
- package/templates/subagents/workflow/prjct-planner.md +158 -0
- package/templates/subagents/workflow/prjct-shipper.md +179 -0
- package/templates/subagents/workflow/prjct-workflow.md +98 -0
- package/bin/generate-views.js +0 -209
- package/bin/migrate-to-json.js +0 -742
- package/core/agentic/context-filter.ts +0 -365
- package/core/agentic/parallel-tools.ts +0 -165
- package/core/agentic/response-templates.ts +0 -164
- package/core/agentic/semantic-compression.ts +0 -273
- package/core/agentic/think-blocks.ts +0 -202
- package/core/agentic/validation-rules.ts +0 -313
- package/core/domain/agent-matcher.ts +0 -130
- package/core/domain/agent-validator.ts +0 -250
- package/core/domain/architect-session.ts +0 -315
- package/core/domain/product-standards.ts +0 -106
- package/core/domain/smart-cache.ts +0 -167
- package/core/domain/task-analyzer.ts +0 -296
- package/core/infrastructure/legacy-installer-detector/cleanup.ts +0 -216
- package/core/infrastructure/legacy-installer-detector/detection.ts +0 -95
- package/core/infrastructure/legacy-installer-detector/index.ts +0 -171
- package/core/infrastructure/legacy-installer-detector/migration.ts +0 -87
- package/core/infrastructure/legacy-installer-detector/types.ts +0 -42
- package/core/infrastructure/legacy-installer-detector.ts +0 -7
- package/core/infrastructure/migrator/file-operations.ts +0 -125
- package/core/infrastructure/migrator/index.ts +0 -288
- package/core/infrastructure/migrator/project-scanner.ts +0 -90
- package/core/infrastructure/migrator/reports.ts +0 -117
- package/core/infrastructure/migrator/types.ts +0 -124
- package/core/infrastructure/migrator/validation.ts +0 -94
- package/core/infrastructure/migrator/version-migration.ts +0 -117
- package/core/infrastructure/migrator.ts +0 -10
- package/core/infrastructure/uuid-migration.ts +0 -750
- package/templates/commands/migrate-all.md +0 -96
- package/templates/commands/migrate.md +0 -140
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Sub-Agent Generation
|
|
2
|
+
|
|
3
|
+
Generate Claude Code sub-agents for this project based on detected stack.
|
|
4
|
+
|
|
5
|
+
## Input Context
|
|
6
|
+
|
|
7
|
+
You have access to:
|
|
8
|
+
- `{analysis}` - repo-summary.md with detected technologies
|
|
9
|
+
- `{projectPath}` - Path to project root
|
|
10
|
+
- `{projectId}` - Project identifier
|
|
11
|
+
|
|
12
|
+
## Output Location
|
|
13
|
+
|
|
14
|
+
Write sub-agents to: `{projectPath}/.claude/agents/`
|
|
15
|
+
|
|
16
|
+
## Sub-Agent Format (Claude Code)
|
|
17
|
+
|
|
18
|
+
```markdown
|
|
19
|
+
---
|
|
20
|
+
name: agent-name
|
|
21
|
+
description: When to use this agent. Include "Use PROACTIVELY" for auto-invocation.
|
|
22
|
+
tools: Read, Write, Glob, Grep, Bash
|
|
23
|
+
model: sonnet
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
Agent system prompt here...
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Generation Rules
|
|
30
|
+
|
|
31
|
+
### 1. ALWAYS Generate Workflow Agents
|
|
32
|
+
|
|
33
|
+
These are REQUIRED for every prjct project:
|
|
34
|
+
|
|
35
|
+
#### prjct-workflow.md
|
|
36
|
+
- Commands: /p:now, /p:done, /p:next, /p:pause, /p:resume
|
|
37
|
+
- Tools: Read, Write, Glob
|
|
38
|
+
- Purpose: Task lifecycle management
|
|
39
|
+
|
|
40
|
+
#### prjct-planner.md
|
|
41
|
+
- Commands: /p:feature, /p:idea, /p:spec, /p:bug
|
|
42
|
+
- Tools: Read, Write, Glob, Grep
|
|
43
|
+
- Purpose: Feature planning and breakdown
|
|
44
|
+
|
|
45
|
+
#### prjct-shipper.md
|
|
46
|
+
- Commands: /p:ship
|
|
47
|
+
- Tools: Read, Write, Bash, Glob
|
|
48
|
+
- Purpose: Git operations, testing, deployment
|
|
49
|
+
|
|
50
|
+
### 2. Generate Domain Agents Based on Stack
|
|
51
|
+
|
|
52
|
+
Analyze `{analysis}` and create ONLY relevant domain agents:
|
|
53
|
+
|
|
54
|
+
| If Detected | Generate | Tools |
|
|
55
|
+
|-------------|----------|-------|
|
|
56
|
+
| React, Vue, Angular, Svelte, CSS, HTML | `frontend.md` | Read, Write, Glob, Grep |
|
|
57
|
+
| Node.js, Express, Go, Python API, REST, GraphQL | `backend.md` | Read, Write, Bash, Glob, Grep |
|
|
58
|
+
| PostgreSQL, MySQL, MongoDB, Redis, Prisma | `database.md` | Read, Write, Bash |
|
|
59
|
+
| Docker, Kubernetes, CI/CD, GitHub Actions | `devops.md` | Read, Bash, Glob |
|
|
60
|
+
| Jest, Pytest, Vitest, Testing Library | `testing.md` | Read, Write, Bash |
|
|
61
|
+
|
|
62
|
+
### 3. Adapt to Project Context
|
|
63
|
+
|
|
64
|
+
Each generated agent should include:
|
|
65
|
+
- Project-specific paths from analysis
|
|
66
|
+
- Detected frameworks and versions
|
|
67
|
+
- Relevant patterns found in codebase
|
|
68
|
+
|
|
69
|
+
## Execution Steps
|
|
70
|
+
|
|
71
|
+
1. **Read Analysis**
|
|
72
|
+
```
|
|
73
|
+
Read("{projectPath}/.prjct-cli/projects/{projectId}/analysis/repo-summary.md")
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
2. **Create Directory**
|
|
77
|
+
```
|
|
78
|
+
Bash("mkdir -p {projectPath}/.claude/agents")
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
3. **Generate Workflow Agents** (always)
|
|
82
|
+
- Read template from `templates/subagents/workflow/prjct-workflow.md`
|
|
83
|
+
- Adapt with project context
|
|
84
|
+
- Write to `{projectPath}/.claude/agents/prjct-workflow.md`
|
|
85
|
+
- Repeat for prjct-planner.md and prjct-shipper.md
|
|
86
|
+
|
|
87
|
+
4. **Generate Domain Agents** (based on analysis)
|
|
88
|
+
- For each detected technology stack:
|
|
89
|
+
- Read corresponding template from `templates/subagents/domain/`
|
|
90
|
+
- Adapt with project-specific details
|
|
91
|
+
- Write to `{projectPath}/.claude/agents/`
|
|
92
|
+
|
|
93
|
+
5. **Report Generated Agents**
|
|
94
|
+
```
|
|
95
|
+
Generated sub-agents in .claude/agents/:
|
|
96
|
+
- prjct-workflow.md (workflow)
|
|
97
|
+
- prjct-planner.md (workflow)
|
|
98
|
+
- prjct-shipper.md (workflow)
|
|
99
|
+
- frontend.md (detected: React)
|
|
100
|
+
- backend.md (detected: Node.js)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Critical Rules
|
|
104
|
+
|
|
105
|
+
- NEVER hardcode technology detection in TypeScript
|
|
106
|
+
- ALWAYS read and analyze repo-summary.md
|
|
107
|
+
- ADAPT templates to project context
|
|
108
|
+
- Use Claude Code frontmatter format exactly
|
|
109
|
+
- Include "Use PROACTIVELY" in descriptions for auto-invocation
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
---
|
|
2
|
+
allowed-tools: [Read, Write, Bash]
|
|
3
|
+
description: 'Manage Cloud Authentication'
|
|
4
|
+
timestamp-rule: 'GetTimestamp() for all timestamps'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# /p:auth - Cloud Authentication
|
|
8
|
+
|
|
9
|
+
Manage authentication for prjct cloud sync.
|
|
10
|
+
|
|
11
|
+
## Subcommands
|
|
12
|
+
|
|
13
|
+
| Command | Purpose |
|
|
14
|
+
|---------|---------|
|
|
15
|
+
| `/p:auth` | Show current auth status |
|
|
16
|
+
| `/p:auth login` | Authenticate with prjct cloud |
|
|
17
|
+
| `/p:auth logout` | Clear authentication |
|
|
18
|
+
| `/p:auth status` | Detailed auth status |
|
|
19
|
+
|
|
20
|
+
## Context Variables
|
|
21
|
+
- `{authPath}`: `~/.prjct-cli/config/auth.json`
|
|
22
|
+
- `{apiUrl}`: API base URL (default: https://api.prjct.app)
|
|
23
|
+
- `{dashboardUrl}`: Web dashboard URL (https://app.prjct.app)
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## /p:auth (default) - Show Status
|
|
28
|
+
|
|
29
|
+
### Flow
|
|
30
|
+
|
|
31
|
+
1. READ: `{authPath}`
|
|
32
|
+
2. IF authenticated:
|
|
33
|
+
- Show email and API key prefix
|
|
34
|
+
3. ELSE:
|
|
35
|
+
- Show "Not authenticated" message
|
|
36
|
+
|
|
37
|
+
### Output (Authenticated)
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
☁️ Cloud Sync: Connected
|
|
41
|
+
|
|
42
|
+
Email: {email}
|
|
43
|
+
API Key: {apiKeyPrefix}...
|
|
44
|
+
Last auth: {lastAuth}
|
|
45
|
+
|
|
46
|
+
Sync enabled for all projects.
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Output (Not Authenticated)
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
☁️ Cloud Sync: Not connected
|
|
53
|
+
|
|
54
|
+
Run `/p:auth login` to enable cloud sync.
|
|
55
|
+
|
|
56
|
+
Benefits:
|
|
57
|
+
- Sync progress across devices
|
|
58
|
+
- Access from web dashboard
|
|
59
|
+
- Backup your project data
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## /p:auth login - Authenticate
|
|
65
|
+
|
|
66
|
+
### Flow
|
|
67
|
+
|
|
68
|
+
1. **Check existing auth**
|
|
69
|
+
READ: `{authPath}`
|
|
70
|
+
IF already authenticated:
|
|
71
|
+
ASK: "You're already logged in as {email}. Re-authenticate? (y/n)"
|
|
72
|
+
IF no: STOP
|
|
73
|
+
|
|
74
|
+
2. **Open dashboard**
|
|
75
|
+
OUTPUT: "Opening prjct dashboard to get your API key..."
|
|
76
|
+
OPEN browser: `{dashboardUrl}/settings/api-keys`
|
|
77
|
+
|
|
78
|
+
3. **Wait for API key**
|
|
79
|
+
OUTPUT instructions:
|
|
80
|
+
```
|
|
81
|
+
1. Log in to prjct.app (GitHub OAuth)
|
|
82
|
+
2. Go to Settings → API Keys
|
|
83
|
+
3. Click "Create New Key"
|
|
84
|
+
4. Copy the key (starts with prjct_)
|
|
85
|
+
5. Paste it below
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
4. **Get API key from user**
|
|
89
|
+
PROMPT: "Paste your API key: "
|
|
90
|
+
READ: `{apiKey}` from user input
|
|
91
|
+
|
|
92
|
+
5. **Validate key**
|
|
93
|
+
- Check format starts with "prjct_"
|
|
94
|
+
- Test connection with GET /health
|
|
95
|
+
- Fetch user info with GET /auth/me
|
|
96
|
+
|
|
97
|
+
IF invalid:
|
|
98
|
+
OUTPUT: "Invalid API key. Please try again."
|
|
99
|
+
STOP
|
|
100
|
+
|
|
101
|
+
6. **Save auth**
|
|
102
|
+
WRITE: `{authPath}`
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"apiKey": "{apiKey}",
|
|
106
|
+
"apiUrl": "https://api.prjct.app",
|
|
107
|
+
"userId": "{userId}",
|
|
108
|
+
"email": "{email}",
|
|
109
|
+
"lastAuth": "{GetTimestamp()}"
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Output (Success)
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
✅ Authentication successful!
|
|
117
|
+
|
|
118
|
+
Logged in as: {email}
|
|
119
|
+
API Key: {apiKeyPrefix}...
|
|
120
|
+
|
|
121
|
+
Cloud sync is now enabled. Your projects will sync automatically
|
|
122
|
+
when you run /p:sync or /p:ship.
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Output (Failure)
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
❌ Authentication failed
|
|
129
|
+
|
|
130
|
+
{error}
|
|
131
|
+
|
|
132
|
+
Please check your API key and try again.
|
|
133
|
+
Get a new key at: {dashboardUrl}/settings/api-keys
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## /p:auth logout - Clear Auth
|
|
139
|
+
|
|
140
|
+
### Flow
|
|
141
|
+
|
|
142
|
+
1. READ: `{authPath}`
|
|
143
|
+
IF not authenticated:
|
|
144
|
+
OUTPUT: "Not logged in. Nothing to do."
|
|
145
|
+
STOP
|
|
146
|
+
|
|
147
|
+
2. ASK: "Are you sure you want to log out? (y/n)"
|
|
148
|
+
IF no: STOP
|
|
149
|
+
|
|
150
|
+
3. DELETE or CLEAR: `{authPath}`
|
|
151
|
+
|
|
152
|
+
### Output
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
✅ Logged out successfully
|
|
156
|
+
|
|
157
|
+
Cloud sync is now disabled.
|
|
158
|
+
Run `/p:auth login` to re-enable.
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## /p:auth status - Detailed Status
|
|
164
|
+
|
|
165
|
+
### Flow
|
|
166
|
+
|
|
167
|
+
1. READ: `{authPath}`
|
|
168
|
+
2. IF authenticated:
|
|
169
|
+
- Test connection
|
|
170
|
+
- Show detailed status
|
|
171
|
+
3. ELSE:
|
|
172
|
+
- Show not connected message
|
|
173
|
+
|
|
174
|
+
### Output (Connected)
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
☁️ Cloud Authentication Status
|
|
178
|
+
|
|
179
|
+
Connection: ✓ Connected
|
|
180
|
+
Email: {email}
|
|
181
|
+
User ID: {userId}
|
|
182
|
+
API Key: {apiKeyPrefix}...
|
|
183
|
+
API URL: {apiUrl}
|
|
184
|
+
Last Auth: {lastAuth}
|
|
185
|
+
|
|
186
|
+
API Status: ✓ Reachable
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Output (Connection Error)
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
☁️ Cloud Authentication Status
|
|
193
|
+
|
|
194
|
+
Connection: ⚠️ Error
|
|
195
|
+
Email: {email}
|
|
196
|
+
API Key: {apiKeyPrefix}...
|
|
197
|
+
API URL: {apiUrl}
|
|
198
|
+
|
|
199
|
+
Error: {connectionError}
|
|
200
|
+
|
|
201
|
+
Try `/p:auth login` to re-authenticate.
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Error Handling
|
|
207
|
+
|
|
208
|
+
| Error | Response |
|
|
209
|
+
|-------|----------|
|
|
210
|
+
| Invalid key format | "API key must start with prjct_" |
|
|
211
|
+
| Key rejected by API | "Invalid or expired API key" |
|
|
212
|
+
| Network error | "Cannot connect to {apiUrl}. Check internet." |
|
|
213
|
+
| Already logged in | Offer to re-authenticate |
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Auth File Structure
|
|
218
|
+
|
|
219
|
+
Location: `~/.prjct-cli/config/auth.json`
|
|
220
|
+
|
|
221
|
+
```json
|
|
222
|
+
{
|
|
223
|
+
"apiKey": "prjct_live_xxxxxxxxxxxxxxxxxxxx",
|
|
224
|
+
"apiUrl": "https://api.prjct.app",
|
|
225
|
+
"userId": "uuid-from-server",
|
|
226
|
+
"email": "user@example.com",
|
|
227
|
+
"lastAuth": "2024-01-15T10:00:00.000Z"
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**Security Notes:**
|
|
232
|
+
- API key is stored in plain text (like git credentials)
|
|
233
|
+
- File permissions should be 600 (user read/write only)
|
|
234
|
+
- Never commit this file to version control
|
|
@@ -336,20 +336,67 @@ WRITE: `{globalPath}/project.json`
|
|
|
336
336
|
|
|
337
337
|
---
|
|
338
338
|
|
|
339
|
-
## Step 7: Generate Agents (AGENTIC)
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
role: 'specific role',
|
|
348
|
-
domain: 'domain',
|
|
349
|
-
expertise: 'technologies'
|
|
350
|
-
})
|
|
339
|
+
## Step 7: Generate Claude Code Sub-Agents (AGENTIC)
|
|
340
|
+
|
|
341
|
+
Generate sub-agents for Claude Code in the PROJECT's `.claude/agents/` directory.
|
|
342
|
+
|
|
343
|
+
### 7.1 Create Directory
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
mkdir -p {cwd}/.claude/agents
|
|
351
347
|
```
|
|
352
348
|
|
|
349
|
+
### 7.2 Read Generation Instructions
|
|
350
|
+
|
|
351
|
+
READ: `templates/agentic/subagent-generation.md`
|
|
352
|
+
|
|
353
|
+
This template contains:
|
|
354
|
+
- Which workflow agents to ALWAYS generate
|
|
355
|
+
- Which domain agents to generate based on stack
|
|
356
|
+
- Format and structure requirements
|
|
357
|
+
|
|
358
|
+
### 7.3 Generate Workflow Agents (ALWAYS)
|
|
359
|
+
|
|
360
|
+
These 3 agents are ALWAYS created for every prjct project:
|
|
361
|
+
|
|
362
|
+
**prjct-workflow.md** - Handles: /p:now, /p:done, /p:next, /p:pause, /p:resume
|
|
363
|
+
READ template: `templates/subagents/workflow/prjct-workflow.md`
|
|
364
|
+
ADAPT with: projectId, projectPath
|
|
365
|
+
WRITE to: `{cwd}/.claude/agents/prjct-workflow.md`
|
|
366
|
+
|
|
367
|
+
**prjct-planner.md** - Handles: /p:feature, /p:idea, /p:spec, /p:bug
|
|
368
|
+
READ template: `templates/subagents/workflow/prjct-planner.md`
|
|
369
|
+
ADAPT with: projectId, projectPath
|
|
370
|
+
WRITE to: `{cwd}/.claude/agents/prjct-planner.md`
|
|
371
|
+
|
|
372
|
+
**prjct-shipper.md** - Handles: /p:ship
|
|
373
|
+
READ template: `templates/subagents/workflow/prjct-shipper.md`
|
|
374
|
+
ADAPT with: projectId, projectPath, detected test/lint commands
|
|
375
|
+
WRITE to: `{cwd}/.claude/agents/prjct-shipper.md`
|
|
376
|
+
|
|
377
|
+
### 7.4 Generate Domain Agents (Based on Stack)
|
|
378
|
+
|
|
379
|
+
Analyze `{techStack}` from Step 3 and generate ONLY relevant domain agents:
|
|
380
|
+
|
|
381
|
+
| If Detected | Generate | Template |
|
|
382
|
+
|-------------|----------|----------|
|
|
383
|
+
| React, Vue, Angular, Svelte, CSS | `frontend.md` | `templates/subagents/domain/frontend.md` |
|
|
384
|
+
| Node.js, Express, Go, Python API | `backend.md` | `templates/subagents/domain/backend.md` |
|
|
385
|
+
| PostgreSQL, MySQL, MongoDB, Prisma | `database.md` | `templates/subagents/domain/database.md` |
|
|
386
|
+
| Docker, Kubernetes, GitHub Actions | `devops.md` | `templates/subagents/domain/devops.md` |
|
|
387
|
+
| Jest, Pytest, Vitest, testing | `testing.md` | `templates/subagents/domain/testing.md` |
|
|
388
|
+
|
|
389
|
+
For EACH detected stack:
|
|
390
|
+
1. READ template from `templates/subagents/domain/{name}.md`
|
|
391
|
+
2. ADAPT description with detected frameworks (e.g., "React specialist" not just "frontend")
|
|
392
|
+
3. WRITE to `{cwd}/.claude/agents/{name}.md`
|
|
393
|
+
|
|
394
|
+
### 7.5 Report Generated Agents
|
|
395
|
+
|
|
396
|
+
Track which agents were generated for output:
|
|
397
|
+
- `{workflowAgents}`: Always 3 (prjct-workflow, prjct-planner, prjct-shipper)
|
|
398
|
+
- `{domainAgents}`: List of domain agents generated
|
|
399
|
+
|
|
353
400
|
---
|
|
354
401
|
|
|
355
402
|
## Step 8: Log to Memory
|
|
@@ -362,6 +409,52 @@ APPEND to: `{globalPath}/memory/events.jsonl`
|
|
|
362
409
|
|
|
363
410
|
---
|
|
364
411
|
|
|
412
|
+
## Step 9: Backend Sync (Cloud)
|
|
413
|
+
|
|
414
|
+
Sync with prjct API if authenticated.
|
|
415
|
+
|
|
416
|
+
### 9.1 Check Authentication
|
|
417
|
+
|
|
418
|
+
READ: `~/.prjct-cli/config/auth.json`
|
|
419
|
+
|
|
420
|
+
IF no auth OR no apiKey:
|
|
421
|
+
SET: `{cloudSync}` = false
|
|
422
|
+
OUTPUT TIP: "💡 Run `prjct auth` to enable cloud sync"
|
|
423
|
+
CONTINUE to output (skip 9.2, 9.3)
|
|
424
|
+
|
|
425
|
+
ELSE:
|
|
426
|
+
SET: `{cloudSync}` = true
|
|
427
|
+
|
|
428
|
+
### 9.2 Push Pending Events
|
|
429
|
+
|
|
430
|
+
READ: `{globalPath}/sync/pending.json`
|
|
431
|
+
COUNT: `{pendingCount}` events
|
|
432
|
+
|
|
433
|
+
IF pendingCount > 0:
|
|
434
|
+
CALL syncManager.push(projectId)
|
|
435
|
+
|
|
436
|
+
IF success:
|
|
437
|
+
SET: `{pushedCount}` = result.count
|
|
438
|
+
OUTPUT: "☁️ Pushed {pushedCount} events to cloud"
|
|
439
|
+
ELSE:
|
|
440
|
+
OUTPUT: "⚠️ Cloud sync failed: {error}. Events queued for retry."
|
|
441
|
+
SET: `{syncError}` = error
|
|
442
|
+
ELSE:
|
|
443
|
+
SET: `{pushedCount}` = 0
|
|
444
|
+
|
|
445
|
+
### 9.3 Pull Updates (if push succeeded)
|
|
446
|
+
|
|
447
|
+
IF cloudSync AND no syncError:
|
|
448
|
+
CALL syncManager.pull(projectId)
|
|
449
|
+
|
|
450
|
+
IF success AND result.count > 0:
|
|
451
|
+
SET: `{pulledCount}` = result.count
|
|
452
|
+
OUTPUT: "📥 Pulled {pulledCount} updates from cloud"
|
|
453
|
+
ELSE:
|
|
454
|
+
SET: `{pulledCount}` = 0
|
|
455
|
+
|
|
456
|
+
---
|
|
457
|
+
|
|
365
458
|
## Output
|
|
366
459
|
|
|
367
460
|
```
|
|
@@ -385,6 +478,19 @@ APPEND to: `{globalPath}/memory/events.jsonl`
|
|
|
385
478
|
├── context/shipped.md
|
|
386
479
|
└── context/CLAUDE.md
|
|
387
480
|
|
|
481
|
+
🤖 Claude Code Sub-Agents ({workflowAgents.length + domainAgents.length})
|
|
482
|
+
├── Workflow: prjct-workflow, prjct-planner, prjct-shipper
|
|
483
|
+
└── Domain: {domainAgents.join(', ') || 'none'}
|
|
484
|
+
|
|
485
|
+
{IF cloudSync}
|
|
486
|
+
☁️ Cloud Sync
|
|
487
|
+
├── Pushed: {pushedCount} events
|
|
488
|
+
├── Pulled: {pulledCount} updates
|
|
489
|
+
└── Status: {syncError ? "⚠️ " + syncError : "✓ Synced"}
|
|
490
|
+
{ELSE}
|
|
491
|
+
💡 Cloud sync disabled. Run `prjct auth` to enable.
|
|
492
|
+
{ENDIF}
|
|
493
|
+
|
|
388
494
|
{IF hasUncommittedChanges}
|
|
389
495
|
⚠️ You have uncommitted changes
|
|
390
496
|
|
|
@@ -426,8 +532,18 @@ Next: /p:now to start a new task
|
|
|
426
532
|
│ └── shipped.md # Shipped
|
|
427
533
|
├── sync/ # Backend Sync
|
|
428
534
|
│ └── pending.json # Events queue
|
|
429
|
-
├── agents/ # Specialists
|
|
535
|
+
├── agents/ # Specialists (legacy)
|
|
430
536
|
├── memory/ # Audit Trail
|
|
431
537
|
│ └── events.jsonl
|
|
432
538
|
└── project.json # Metadata
|
|
539
|
+
|
|
540
|
+
{cwd}/.claude/agents/ # Claude Code Sub-Agents (PER PROJECT)
|
|
541
|
+
├── prjct-workflow.md # /p:now, /p:done, /p:next
|
|
542
|
+
├── prjct-planner.md # /p:feature, /p:idea, /p:spec
|
|
543
|
+
├── prjct-shipper.md # /p:ship
|
|
544
|
+
├── frontend.md # (if React/Vue/Angular detected)
|
|
545
|
+
├── backend.md # (if Node/Go/Python API detected)
|
|
546
|
+
├── database.md # (if DB detected)
|
|
547
|
+
├── devops.md # (if Docker/K8s detected)
|
|
548
|
+
└── testing.md # (if test framework detected)
|
|
433
549
|
```
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: backend
|
|
3
|
+
description: Backend specialist for Node.js, Go, Python, REST APIs, and GraphQL. Use PROACTIVELY when user works on APIs, servers, or backend logic.
|
|
4
|
+
tools: Read, Write, Bash, Glob, Grep
|
|
5
|
+
model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are a backend specialist agent for this project.
|
|
9
|
+
|
|
10
|
+
## Your Expertise
|
|
11
|
+
|
|
12
|
+
- **Runtimes**: Node.js, Bun, Deno, Go, Python, Rust
|
|
13
|
+
- **Frameworks**: Express, Fastify, Hono, Gin, FastAPI, Axum
|
|
14
|
+
- **APIs**: REST, GraphQL, gRPC, WebSockets
|
|
15
|
+
- **Auth**: JWT, OAuth, Sessions, API Keys
|
|
16
|
+
|
|
17
|
+
## Project Context
|
|
18
|
+
|
|
19
|
+
When invoked, analyze the project's backend stack:
|
|
20
|
+
1. Read `package.json`, `go.mod`, `requirements.txt`, or `Cargo.toml`
|
|
21
|
+
2. Identify framework and patterns
|
|
22
|
+
3. Check for existing API structure
|
|
23
|
+
|
|
24
|
+
## Code Patterns
|
|
25
|
+
|
|
26
|
+
### API Structure
|
|
27
|
+
Follow project's existing patterns. Common patterns:
|
|
28
|
+
|
|
29
|
+
**Express/Fastify:**
|
|
30
|
+
```typescript
|
|
31
|
+
// Route handler
|
|
32
|
+
export async function getUser(req: Request, res: Response) {
|
|
33
|
+
const { id } = req.params
|
|
34
|
+
const user = await userService.findById(id)
|
|
35
|
+
res.json(user)
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Go (Gin/Chi):**
|
|
40
|
+
```go
|
|
41
|
+
func GetUser(c *gin.Context) {
|
|
42
|
+
id := c.Param("id")
|
|
43
|
+
user, err := userService.FindByID(id)
|
|
44
|
+
if err != nil {
|
|
45
|
+
c.JSON(500, gin.H{"error": err.Error()})
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
c.JSON(200, user)
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Error Handling
|
|
53
|
+
- Use consistent error format
|
|
54
|
+
- Include error codes
|
|
55
|
+
- Log errors appropriately
|
|
56
|
+
- Never expose internal details to clients
|
|
57
|
+
|
|
58
|
+
### Validation
|
|
59
|
+
- Validate all inputs
|
|
60
|
+
- Use schema validation (Zod, Joi, etc.)
|
|
61
|
+
- Return meaningful validation errors
|
|
62
|
+
|
|
63
|
+
## Quality Guidelines
|
|
64
|
+
|
|
65
|
+
1. **Security**: Validate inputs, sanitize outputs, use parameterized queries
|
|
66
|
+
2. **Performance**: Use appropriate indexes, cache when needed
|
|
67
|
+
3. **Reliability**: Handle errors gracefully, implement retries
|
|
68
|
+
4. **Observability**: Log important events, add metrics
|
|
69
|
+
|
|
70
|
+
## Common Tasks
|
|
71
|
+
|
|
72
|
+
### Creating Endpoints
|
|
73
|
+
1. Check existing route structure
|
|
74
|
+
2. Follow RESTful conventions
|
|
75
|
+
3. Add validation middleware
|
|
76
|
+
4. Include error handling
|
|
77
|
+
5. Add to route registry/index
|
|
78
|
+
|
|
79
|
+
### Middleware
|
|
80
|
+
1. Check existing middleware patterns
|
|
81
|
+
2. Keep middleware focused (single responsibility)
|
|
82
|
+
3. Order matters - auth before business logic
|
|
83
|
+
|
|
84
|
+
### Services
|
|
85
|
+
1. Keep business logic in services
|
|
86
|
+
2. Services are testable units
|
|
87
|
+
3. Inject dependencies
|
|
88
|
+
|
|
89
|
+
## Output Format
|
|
90
|
+
|
|
91
|
+
When creating/modifying backend code:
|
|
92
|
+
```
|
|
93
|
+
✅ {action}: {endpoint/service}
|
|
94
|
+
|
|
95
|
+
Files: {count} | Routes: {affected routes}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Critical Rules
|
|
99
|
+
|
|
100
|
+
- NEVER expose sensitive data in responses
|
|
101
|
+
- ALWAYS validate inputs
|
|
102
|
+
- USE parameterized queries (prevent SQL injection)
|
|
103
|
+
- FOLLOW existing error handling patterns
|
|
104
|
+
- LOG errors but don't expose internals
|
|
105
|
+
- CHECK for existing similar endpoints/services
|