prjct-cli 0.28.1 → 0.28.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.
- package/CHANGELOG.md +93 -0
- package/core/agentic/index.ts +11 -1
- package/core/agentic/prompt-builder.ts +2 -2
- package/core/agentic/token-estimator.ts +264 -0
- package/core/commands/command-data.ts +0 -33
- package/core/commands/commands.ts +4 -12
- package/core/commands/registry.ts +0 -37
- package/core/index.ts +0 -2
- package/core/infrastructure/setup.ts +28 -0
- package/core/infrastructure/slash-command-registry.ts +176 -0
- package/core/types/config.ts +1 -1
- package/core/types/index.ts +0 -2
- package/core/types/integrations.ts +22 -40
- package/core/types/storage.ts +0 -8
- package/core/types/task.ts +0 -4
- package/dist/bin/prjct.mjs +3 -82
- package/package.json +1 -1
- package/templates/agentic/subagent-generation.md +241 -81
- package/templates/commands/init.md +1 -44
- package/templates/commands/ship.md +106 -81
- package/templates/commands/sync.md +154 -402
- package/templates/commands/task.md +14 -31
- package/templates/global/CLAUDE.md +166 -35
- package/templates/guides/agent-generation.md +164 -0
- package/templates/guides/integrations.md +149 -0
- package/templates/mcp-config.json +23 -46
- package/templates/shared/validation.md +75 -0
- package/CLAUDE.md +0 -170
- package/core/integrations/notion/client.ts +0 -413
- package/core/integrations/notion/index.ts +0 -46
- package/core/integrations/notion/setup.ts +0 -235
- package/core/integrations/notion/sync.ts +0 -818
- package/core/integrations/notion/templates.ts +0 -246
- package/core/plugin/builtin/notion.ts +0 -178
- package/templates/agentic/agents/uxui.md +0 -218
- package/templates/commands/feature.md +0 -46
- package/templates/commands/now.md +0 -53
- package/templates/skills/notion-push.md +0 -116
- package/templates/skills/notion-setup.md +0 -199
- package/templates/skills/notion-sync.md +0 -290
- package/templates/subagents/domain/backend.md +0 -106
- package/templates/subagents/domain/database.md +0 -118
- package/templates/subagents/domain/devops.md +0 -149
- package/templates/subagents/domain/frontend.md +0 -100
- package/templates/subagents/domain/testing.md +0 -166
|
@@ -1,127 +1,287 @@
|
|
|
1
|
-
# Sub-Agent Generation
|
|
1
|
+
# Sub-Agent Generation (AGENTIC)
|
|
2
2
|
|
|
3
|
-
Generate Claude Code sub-agents
|
|
3
|
+
Generate Claude Code sub-agents dynamically based on ACTUAL project analysis.
|
|
4
|
+
|
|
5
|
+
**CRITICAL**: There are NO hardcoded templates. You MUST analyze the project and GENERATE agents from scratch.
|
|
4
6
|
|
|
5
7
|
## Input Context
|
|
6
8
|
|
|
7
9
|
You have access to:
|
|
8
|
-
- `{analysis}` - repo-
|
|
10
|
+
- `{analysis}` - repo-analysis.json with detected technologies
|
|
9
11
|
- `{projectPath}` - Path to project root
|
|
10
12
|
- `{projectId}` - Project identifier
|
|
13
|
+
- `{globalPath}` - ~/.prjct-cli/projects/{projectId}
|
|
11
14
|
|
|
12
15
|
## Output Location
|
|
13
16
|
|
|
14
|
-
Write sub-agents to: `{globalPath}/agents/`
|
|
17
|
+
Write sub-agents to: `{globalPath}/agents/`
|
|
15
18
|
|
|
16
19
|
## Sub-Agent Format (Claude Code)
|
|
17
20
|
|
|
18
21
|
```markdown
|
|
19
22
|
---
|
|
20
23
|
name: agent-name
|
|
24
|
+
agentId: p.agent.{name}
|
|
21
25
|
description: When to use this agent. Include "Use PROACTIVELY" for auto-invocation.
|
|
22
|
-
tools: Read, Write, Glob, Grep, Bash
|
|
23
26
|
model: sonnet
|
|
24
|
-
|
|
27
|
+
temperature: {0.1-0.4}
|
|
28
|
+
maxSteps: {50-100}
|
|
29
|
+
tools:
|
|
30
|
+
- Read
|
|
31
|
+
- Write
|
|
32
|
+
- Edit
|
|
33
|
+
- Bash
|
|
34
|
+
- Glob
|
|
35
|
+
- Grep
|
|
36
|
+
permissions:
|
|
37
|
+
Bash: ask
|
|
38
|
+
Write: allow
|
|
39
|
+
Edit: allow
|
|
40
|
+
"rm *": deny
|
|
41
|
+
skills: [{detected-skill}]
|
|
42
|
+
mcp: [{detected-mcp-servers}]
|
|
43
|
+
projectId: {projectId}
|
|
44
|
+
projectPath: {projectPath}
|
|
25
45
|
---
|
|
26
46
|
|
|
27
|
-
Agent
|
|
47
|
+
# {Agent Name}
|
|
48
|
+
|
|
49
|
+
## Stack Detected
|
|
50
|
+
{ACTUAL technologies found in THIS project}
|
|
51
|
+
|
|
52
|
+
## Project Structure
|
|
53
|
+
{ACTUAL directory structure for this domain}
|
|
54
|
+
|
|
55
|
+
## Code Patterns (EXTRACTED FROM PROJECT)
|
|
56
|
+
{REAL patterns found by reading actual files}
|
|
57
|
+
|
|
58
|
+
## Quality Checklist
|
|
59
|
+
{Based on project conventions}
|
|
60
|
+
|
|
61
|
+
## Commands
|
|
62
|
+
{ACTUAL commands from package.json/Makefile/etc}
|
|
28
63
|
```
|
|
29
64
|
|
|
30
|
-
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Generation Process (AGENTIC)
|
|
31
68
|
|
|
32
|
-
|
|
69
|
+
### Step 1: Analyze Project Deeply
|
|
33
70
|
|
|
34
|
-
|
|
71
|
+
DO NOT use templates. Instead:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
1. READ package.json, go.mod, Cargo.toml, requirements.txt, etc.
|
|
75
|
+
2. GLOB for source files: **/*.ts, **/*.tsx, **/*.py, **/*.go, etc.
|
|
76
|
+
3. READ 3-5 representative files from each domain
|
|
77
|
+
4. EXTRACT actual patterns, conventions, naming
|
|
78
|
+
5. CHECK for linter/formatter configs
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Step 2: Determine Domains Present
|
|
82
|
+
|
|
83
|
+
Based on your analysis, identify which domains exist:
|
|
84
|
+
|
|
85
|
+
| Domain | Detection Method |
|
|
86
|
+
|--------|------------------|
|
|
87
|
+
| frontend | React/Vue/Angular/Svelte in deps, .tsx/.vue files |
|
|
88
|
+
| backend | Express/Fastify/Hono/Gin/Flask in deps, API routes |
|
|
89
|
+
| database | Prisma/Drizzle/TypeORM schemas, SQL files |
|
|
90
|
+
| testing | Jest/Vitest/Pytest configs, *.test.* files |
|
|
91
|
+
| devops | Dockerfile, .github/workflows, k8s/ |
|
|
92
|
+
| uxui | UI components + design tokens/theme |
|
|
93
|
+
| mobile | React Native/Flutter/SwiftUI |
|
|
94
|
+
| cli | Command definitions, arg parsing |
|
|
95
|
+
| ml | Model files, training scripts |
|
|
96
|
+
|
|
97
|
+
### Step 3: Generate Each Agent FROM SCRATCH
|
|
98
|
+
|
|
99
|
+
For EACH detected domain:
|
|
100
|
+
|
|
101
|
+
1. **Analyze domain-specific files**
|
|
102
|
+
```
|
|
103
|
+
READ actual source files in that domain
|
|
104
|
+
EXTRACT: imports, exports, naming, structure
|
|
105
|
+
```
|
|
35
106
|
|
|
36
|
-
|
|
107
|
+
2. **Determine configuration**
|
|
108
|
+
- `temperature`: 0.1 for DB, 0.2 for backend/testing, 0.3 for frontend, 0.4 for uxui
|
|
109
|
+
- `maxSteps`: 50 for simple, 75 for medium, 100 for complex
|
|
110
|
+
- `tools`: Based on what the domain needs
|
|
111
|
+
- `permissions`: Deny destructive commands
|
|
112
|
+
|
|
113
|
+
3. **Discover skills and MCP**
|
|
114
|
+
- Search claude-plugins.dev for relevant skills
|
|
115
|
+
- Determine if context7 MCP is needed (library docs)
|
|
116
|
+
|
|
117
|
+
4. **Write agent with REAL patterns**
|
|
118
|
+
```
|
|
119
|
+
Include ACTUAL code examples from the project
|
|
120
|
+
Include ACTUAL commands from package.json
|
|
121
|
+
Include ACTUAL file structure
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Step 4: Generate Workflow Agents (ALWAYS)
|
|
125
|
+
|
|
126
|
+
These 3 agents are always generated but STILL need project context:
|
|
37
127
|
|
|
38
128
|
#### prjct-workflow.md
|
|
39
129
|
- Commands: /p:now, /p:done, /p:next, /p:pause, /p:resume
|
|
40
|
-
-
|
|
41
|
-
- Purpose: Task lifecycle management
|
|
130
|
+
- Adapt with: project paths, detected commands
|
|
42
131
|
|
|
43
132
|
#### prjct-planner.md
|
|
44
133
|
- Commands: /p:feature, /p:idea, /p:spec, /p:bug
|
|
45
|
-
-
|
|
46
|
-
- Purpose: Feature planning and breakdown
|
|
134
|
+
- Adapt with: detected stack for planning context
|
|
47
135
|
|
|
48
136
|
#### prjct-shipper.md
|
|
49
137
|
- Commands: /p:ship
|
|
50
|
-
-
|
|
51
|
-
- Purpose: Git operations, testing, deployment
|
|
138
|
+
- Adapt with: actual test/build/lint commands from project
|
|
52
139
|
|
|
53
|
-
|
|
140
|
+
---
|
|
54
141
|
|
|
55
|
-
|
|
142
|
+
## MCP Integration
|
|
56
143
|
|
|
57
|
-
|
|
58
|
-
|-------------|----------|-------|-------|
|
|
59
|
-
| React, Vue, Angular, Svelte, CSS, HTML | `frontend.md` | Read, Write, Glob, Grep | `frontend-design` |
|
|
60
|
-
| Node.js, Express, Go, Python API, REST, GraphQL | `backend.md` | Read, Write, Bash, Glob, Grep | `javascript-typescript` or `python-development` |
|
|
61
|
-
| PostgreSQL, MySQL, MongoDB, Redis, Prisma | `database.md` | Read, Write, Bash | (none) |
|
|
62
|
-
| Docker, Kubernetes, CI/CD, GitHub Actions | `devops.md` | Read, Bash, Glob | `developer-kit` |
|
|
63
|
-
| Bun test, Jest, Pytest, Testing Library | `testing.md` | Read, Write, Bash | `developer-kit` |
|
|
64
|
-
| ANY frontend UI (web or mobile) | `uxui.md` | Read, Write, Glob, Grep | `frontend-design` |
|
|
144
|
+
Determine which agents need MCP servers:
|
|
65
145
|
|
|
66
|
-
|
|
146
|
+
```
|
|
147
|
+
IF agent works with libraries/frameworks:
|
|
148
|
+
ADD mcp: [context7]
|
|
67
149
|
|
|
68
|
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
150
|
+
Agents that typically need context7:
|
|
151
|
+
- frontend (React, Vue docs)
|
|
152
|
+
- backend (Express, Hono docs)
|
|
153
|
+
- database (Prisma, Drizzle docs)
|
|
154
|
+
- uxui (component library docs)
|
|
155
|
+
- prjct-planner (framework docs for planning)
|
|
156
|
+
```
|
|
72
157
|
|
|
73
|
-
|
|
158
|
+
---
|
|
74
159
|
|
|
75
|
-
|
|
76
|
-
```
|
|
77
|
-
Read("{globalPath}/analysis/repo-summary.md")
|
|
78
|
-
```
|
|
160
|
+
## Skill Discovery
|
|
79
161
|
|
|
80
|
-
|
|
81
|
-
```
|
|
82
|
-
Bash("mkdir -p {globalPath}/agents")
|
|
83
|
-
```
|
|
162
|
+
For each agent, search for relevant skills:
|
|
84
163
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
164
|
+
```
|
|
165
|
+
WebFetch: https://claude-plugins.dev/skills?q={domain}+{stack}
|
|
166
|
+
|
|
167
|
+
Examples:
|
|
168
|
+
- frontend + React → search "react frontend"
|
|
169
|
+
- backend + TypeScript → search "typescript backend"
|
|
170
|
+
- testing + Bun → search "bun testing"
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
If no skill found, leave skills empty or create minimal custom skill.
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Output Format
|
|
178
|
+
|
|
179
|
+
After generating each agent:
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
Generated: {agent}.md
|
|
183
|
+
Stack: {detected technologies}
|
|
184
|
+
Patterns: {count} extracted from {files analyzed}
|
|
185
|
+
Skills: {linked skills}
|
|
186
|
+
MCP: {linked mcp servers}
|
|
187
|
+
Path: {globalPath}/agents/{agent}.md
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Critical Rules
|
|
193
|
+
|
|
194
|
+
1. **NO TEMPLATES** - Generate everything from project analysis
|
|
195
|
+
2. **NO HARDCODING** - Every value comes from detection
|
|
196
|
+
3. **REAL PATTERNS** - Include actual code examples from the project
|
|
197
|
+
4. **ACTUAL COMMANDS** - Use real commands from package.json/Makefile
|
|
198
|
+
5. **PROJECT-SPECIFIC** - Each agent is unique to this project
|
|
199
|
+
6. **GLOBAL STORAGE** - Write to `{globalPath}/agents/`, never local
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Example: Generated Backend Agent
|
|
204
|
+
|
|
205
|
+
This is an EXAMPLE of what a generated agent might look like (NOT a template to copy):
|
|
206
|
+
|
|
207
|
+
```markdown
|
|
208
|
+
---
|
|
209
|
+
name: backend
|
|
210
|
+
agentId: p.agent.backend
|
|
211
|
+
description: Backend specialist for Hono + Bun. Use PROACTIVELY for API routes and server logic.
|
|
212
|
+
model: sonnet
|
|
213
|
+
temperature: 0.2
|
|
214
|
+
maxSteps: 75
|
|
215
|
+
tools:
|
|
216
|
+
- Read
|
|
217
|
+
- Write
|
|
218
|
+
- Edit
|
|
219
|
+
- Bash
|
|
220
|
+
- Glob
|
|
221
|
+
- Grep
|
|
222
|
+
permissions:
|
|
223
|
+
Bash: ask
|
|
224
|
+
Write: allow
|
|
225
|
+
Edit: allow
|
|
226
|
+
"rm *": deny
|
|
227
|
+
skills: [javascript-typescript]
|
|
228
|
+
mcp: [context7]
|
|
229
|
+
projectId: abc123
|
|
230
|
+
projectPath: /Users/dev/my-project
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
# Backend Agent for my-project
|
|
234
|
+
|
|
235
|
+
## Stack Detected
|
|
236
|
+
- Runtime: Bun 1.0
|
|
237
|
+
- Framework: Hono 4.x
|
|
238
|
+
- Validation: Zod
|
|
239
|
+
- Database: Drizzle + SQLite
|
|
240
|
+
|
|
241
|
+
## Project Structure
|
|
242
|
+
```
|
|
243
|
+
core/
|
|
244
|
+
├── routes/ # API endpoints
|
|
245
|
+
├── services/ # Business logic
|
|
246
|
+
├── middleware/ # Auth, logging
|
|
247
|
+
└── types/ # TypeScript types
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Code Patterns (FROM THIS PROJECT)
|
|
251
|
+
|
|
252
|
+
### Route Structure
|
|
253
|
+
```typescript
|
|
254
|
+
// Extracted from core/routes/users.ts
|
|
255
|
+
app.get('/users/:id', async (c) => {
|
|
256
|
+
const { id } = c.req.param()
|
|
257
|
+
const user = await userService.findById(id)
|
|
258
|
+
return c.json(user)
|
|
259
|
+
})
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Error Handling
|
|
263
|
+
```typescript
|
|
264
|
+
// Extracted from core/middleware/error.ts
|
|
265
|
+
app.onError((err, c) => {
|
|
266
|
+
console.error(err)
|
|
267
|
+
return c.json({ error: err.message }, 500)
|
|
268
|
+
})
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## Commands
|
|
272
|
+
|
|
273
|
+
| Action | Command |
|
|
274
|
+
|--------|---------|
|
|
275
|
+
| Dev | `bun run dev` |
|
|
276
|
+
| Test | `bun test` |
|
|
277
|
+
| Build | `bun run build` |
|
|
278
|
+
| Lint | `bun run lint` |
|
|
118
279
|
|
|
119
280
|
## Critical Rules
|
|
281
|
+
- Use Hono's context (c) pattern
|
|
282
|
+
- Validate with Zod before processing
|
|
283
|
+
- Return proper HTTP status codes
|
|
284
|
+
- Use existing service layer pattern
|
|
285
|
+
```
|
|
120
286
|
|
|
121
|
-
|
|
122
|
-
- **ALWAYS write agents to `{globalPath}/agents/`** (global storage)
|
|
123
|
-
- NEVER hardcode technology detection in TypeScript
|
|
124
|
-
- ALWAYS read and analyze repo-summary.md
|
|
125
|
-
- ADAPT templates to project context
|
|
126
|
-
- Use Claude Code frontmatter format exactly
|
|
127
|
-
- Include "Use PROACTIVELY" in descriptions for auto-invocation
|
|
287
|
+
This agent was GENERATED by analyzing the actual project, not copied from a template.
|
|
@@ -136,45 +136,6 @@ WRITE: `.prjct/prjct.config.json`
|
|
|
136
136
|
}
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
-
## Step: Optional Integrations
|
|
140
|
-
|
|
141
|
-
After core setup, offer optional integrations.
|
|
142
|
-
|
|
143
|
-
### Notion Integration (Optional)
|
|
144
|
-
|
|
145
|
-
Ask: "Would you like to connect with Notion for dashboards and progress tracking?"
|
|
146
|
-
|
|
147
|
-
If yes:
|
|
148
|
-
1. Guide user to create Notion integration at https://www.notion.so/my-integrations
|
|
149
|
-
2. Ask for API token (starts with `ntn_`)
|
|
150
|
-
3. Ask for parent page ID (where to create databases)
|
|
151
|
-
4. Create 4 databases:
|
|
152
|
-
- prjct: Shipped Features
|
|
153
|
-
- prjct: Roadmap
|
|
154
|
-
- prjct: Ideas
|
|
155
|
-
- prjct: Active Tasks
|
|
156
|
-
5. Store config in `project.json`:
|
|
157
|
-
|
|
158
|
-
```json
|
|
159
|
-
{
|
|
160
|
-
"integrations": {
|
|
161
|
-
"notion": {
|
|
162
|
-
"enabled": true,
|
|
163
|
-
"workspaceName": "{workspace}",
|
|
164
|
-
"databases": {
|
|
165
|
-
"shipped": "{dbId}",
|
|
166
|
-
"roadmap": "{dbId}",
|
|
167
|
-
"ideas": "{dbId}",
|
|
168
|
-
"tasks": "{dbId}"
|
|
169
|
-
},
|
|
170
|
-
"syncOn": { "ship": true, "idea": true }
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
If no: Skip and continue (integration can be added later with `/p:notion setup`).
|
|
177
|
-
|
|
178
139
|
## Response
|
|
179
140
|
|
|
180
141
|
```
|
|
@@ -189,13 +150,9 @@ Structure:
|
|
|
189
150
|
├── sync/ # Backend events
|
|
190
151
|
└── agents/ # Specialists
|
|
191
152
|
|
|
192
|
-
Integrations:
|
|
193
|
-
• Notion: {enabled|disabled}
|
|
194
|
-
|
|
195
153
|
Next:
|
|
196
154
|
• /p:sync - Analyze project and generate agents
|
|
197
|
-
• /p:
|
|
198
|
-
• /p:notion setup - Connect Notion (if skipped)
|
|
155
|
+
• /p:task "{first_task}" - Start first task
|
|
199
156
|
• /p:help - See all commands
|
|
200
157
|
```
|
|
201
158
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
allowed-tools: [Read, Write, Bash, Glob, Grep, AskUserQuestion]
|
|
3
3
|
description: 'Ship feature with automated PR workflow'
|
|
4
|
+
requires-thinking: true
|
|
4
5
|
tool-permissions:
|
|
5
6
|
bash:
|
|
6
7
|
allow: ["git status", "git log", "git diff", "git add", "git commit", "git push", "gh pr create", "gh pr view", "npm test", "npm run", "bun test", "bun run"]
|
|
@@ -12,6 +13,18 @@ tool-permissions:
|
|
|
12
13
|
|
|
13
14
|
Ship completed work with pre-flight checks, code review, PR creation, and CI verification.
|
|
14
15
|
|
|
16
|
+
## Pre-Ship Think Block (MANDATORY)
|
|
17
|
+
|
|
18
|
+
**Use `<think>` to verify before ANY ship action:**
|
|
19
|
+
|
|
20
|
+
<think>
|
|
21
|
+
- [ ] All subtasks complete? No TODO/FIXME left?
|
|
22
|
+
- [ ] Tests + lint pass? No debug statements or secrets?
|
|
23
|
+
- [ ] On feature branch (not main)? All changes committed?
|
|
24
|
+
- [ ] Breaking changes documented? Migrations ready?
|
|
25
|
+
If ANY fails → STOP and fix first.
|
|
26
|
+
</think>
|
|
27
|
+
|
|
15
28
|
## Usage
|
|
16
29
|
```
|
|
17
30
|
/p:ship [feature] [--blocking] [--skip-review] [--draft]
|
|
@@ -219,21 +232,96 @@ IF {issues}.length > 0:
|
|
|
219
232
|
ELSE:
|
|
220
233
|
OUTPUT: "Code review passed. No high-confidence issues found."
|
|
221
234
|
|
|
222
|
-
### Step 5: Version Bump
|
|
223
|
-
|
|
224
|
-
|
|
235
|
+
### Step 5: Version Bump (REQUIRED)
|
|
236
|
+
|
|
237
|
+
**CRITICAL: Version MUST be bumped before creating PR.**
|
|
238
|
+
|
|
239
|
+
#### 5.1 Read current version
|
|
240
|
+
READ: `package.json` (or Cargo.toml, pyproject.toml, version.txt)
|
|
241
|
+
EXTRACT: {currentVersion}
|
|
242
|
+
|
|
243
|
+
#### 5.2 Determine bump type from commits
|
|
244
|
+
BASH: `git log --oneline $(git describe --tags --abbrev=0 2>/dev/null || echo "HEAD~20")..HEAD`
|
|
245
|
+
ANALYZE commits:
|
|
246
|
+
- "BREAKING" or "major:" → major bump
|
|
247
|
+
- "feat:" or "feature:" → minor bump
|
|
248
|
+
- else → patch bump
|
|
249
|
+
|
|
250
|
+
SET: {bumpType} = detected type
|
|
251
|
+
SET: {newVersion} = calculated version
|
|
252
|
+
|
|
253
|
+
#### 5.3 Update version file
|
|
254
|
+
UPDATE version in package.json (or equivalent):
|
|
255
|
+
```bash
|
|
256
|
+
# For Node.js projects
|
|
257
|
+
npm version {bumpType} --no-git-tag-version
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
IF version update fails:
|
|
261
|
+
OUTPUT: "❌ Failed to update version. Fix manually and retry."
|
|
262
|
+
STOP
|
|
263
|
+
|
|
264
|
+
OUTPUT: "📦 Version: {currentVersion} → {newVersion}"
|
|
265
|
+
|
|
266
|
+
### Step 6: Update CHANGELOG (REQUIRED)
|
|
267
|
+
|
|
268
|
+
**CRITICAL: CHANGELOG.md MUST be updated before creating PR.**
|
|
269
|
+
|
|
270
|
+
#### 6.1 Check if CHANGELOG exists
|
|
271
|
+
BASH: `test -f CHANGELOG.md && echo "exists" || echo "missing"`
|
|
225
272
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
- else → patch
|
|
273
|
+
IF missing:
|
|
274
|
+
CREATE `CHANGELOG.md` with header:
|
|
275
|
+
```markdown
|
|
276
|
+
# Changelog
|
|
231
277
|
|
|
232
|
-
|
|
278
|
+
All notable changes to this project will be documented in this file.
|
|
233
279
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
280
|
+
## [Unreleased]
|
|
281
|
+
|
|
282
|
+
## [{newVersion}] - {date}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
#### 6.2 Get commits since last tag
|
|
286
|
+
BASH: `git log --oneline --pretty=format:"- %s" $(git describe --tags --abbrev=0 2>/dev/null || echo "HEAD~20")..HEAD`
|
|
287
|
+
SET: {commits} = result
|
|
288
|
+
|
|
289
|
+
#### 6.3 Categorize changes
|
|
290
|
+
PARSE commits and categorize:
|
|
291
|
+
- `feat:` → ### Added
|
|
292
|
+
- `fix:` → ### Fixed
|
|
293
|
+
- `refactor:` → ### Changed
|
|
294
|
+
- `docs:` → ### Documentation
|
|
295
|
+
- `perf:` → ### Performance
|
|
296
|
+
- `BREAKING:` → ### Breaking Changes
|
|
297
|
+
|
|
298
|
+
#### 6.4 Insert changelog entry
|
|
299
|
+
GET date: `date +%Y-%m-%d`
|
|
300
|
+
SET: {today} = result
|
|
301
|
+
|
|
302
|
+
INSERT after `## [Unreleased]` in CHANGELOG.md:
|
|
303
|
+
```markdown
|
|
304
|
+
|
|
305
|
+
## [{newVersion}] - {today}
|
|
306
|
+
|
|
307
|
+
### Added
|
|
308
|
+
{feat commits}
|
|
309
|
+
|
|
310
|
+
### Fixed
|
|
311
|
+
{fix commits}
|
|
312
|
+
|
|
313
|
+
### Changed
|
|
314
|
+
{other commits}
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
OUTPUT: "📝 CHANGELOG.md updated for v{newVersion}"
|
|
318
|
+
|
|
319
|
+
#### 6.5 Verify changes are staged
|
|
320
|
+
BASH: `git add package.json CHANGELOG.md`
|
|
321
|
+
|
|
322
|
+
IF no changes staged:
|
|
323
|
+
OUTPUT: "❌ Version or CHANGELOG not updated. Cannot ship."
|
|
324
|
+
STOP
|
|
237
325
|
|
|
238
326
|
### Step 7: Create Pull Request
|
|
239
327
|
|
|
@@ -580,76 +668,13 @@ Check CI status on GitHub.
|
|
|
580
668
|
|
|
581
669
|
## Examples
|
|
582
670
|
|
|
583
|
-
### Example 1: Successful Ship with PR
|
|
584
671
|
```
|
|
585
|
-
/p:ship "add
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
Review: Passed
|
|
590
|
-
|
|
591
|
-
📎 PR created: https://github.com/user/repo/pull/42
|
|
592
|
-
Waiting for CI checks...
|
|
593
|
-
⏳ Waiting for 3 CI checks...
|
|
594
|
-
✅ All CI checks passed
|
|
595
|
-
|
|
596
|
-
🚀 PR Ready: add user auth
|
|
597
|
-
|
|
598
|
-
Version: 1.2.0 → 1.3.0
|
|
599
|
-
Changes: medium (87 lines in 5 files)
|
|
600
|
-
Quality: Lint ✅ | Tests ✅
|
|
601
|
-
CI: ✅ Passed
|
|
602
|
-
|
|
603
|
-
📎 PR: https://github.com/user/repo/pull/42
|
|
604
|
-
|
|
605
|
-
Next steps:
|
|
606
|
-
1. Request review from team
|
|
607
|
-
2. Merge when approved
|
|
608
|
-
```
|
|
609
|
-
|
|
610
|
-
### Example 2: Ship with CI Failure
|
|
611
|
-
```
|
|
612
|
-
/p:ship "fix login bug"
|
|
613
|
-
|
|
614
|
-
Pre-flight: Small changes (28 lines in 2 files)
|
|
615
|
-
Quality: Lint ✅ | Tests ✅
|
|
616
|
-
Review: Passed
|
|
617
|
-
|
|
618
|
-
📎 PR created: https://github.com/user/repo/pull/43
|
|
619
|
-
Waiting for CI checks...
|
|
620
|
-
|
|
621
|
-
❌ CI checks failed:
|
|
622
|
-
- build: failure
|
|
623
|
-
- test: failure
|
|
624
|
-
|
|
625
|
-
⚠️ PR Created (CI Failed): fix login bug
|
|
626
|
-
|
|
627
|
-
📎 PR: https://github.com/user/repo/pull/43
|
|
628
|
-
|
|
629
|
-
Fix CI issues and push again.
|
|
630
|
-
```
|
|
631
|
-
|
|
632
|
-
### Example 3: Blocked on Protected Branch
|
|
633
|
-
```
|
|
634
|
-
/p:ship "new feature"
|
|
635
|
-
|
|
636
|
-
⚠️ Cannot ship from protected branch: main
|
|
637
|
-
|
|
638
|
-
Create a feature branch first with /p:now "task name"
|
|
639
|
-
```
|
|
640
|
-
|
|
641
|
-
### Example 4: Draft PR
|
|
642
|
-
```
|
|
643
|
-
/p:ship "work in progress" --draft
|
|
644
|
-
|
|
645
|
-
📎 PR created (draft): https://github.com/user/repo/pull/44
|
|
646
|
-
|
|
647
|
-
🚀 PR Created: work in progress
|
|
648
|
-
CI: ⏳ Still running
|
|
649
|
-
|
|
650
|
-
📎 PR: https://github.com/user/repo/pull/44
|
|
672
|
+
/p:ship "add auth" → 🚀 v1.2.0→1.3.0 | PR: .../pull/42 | CI ✅
|
|
673
|
+
/p:ship "fix bug" → ⚠️ PR created, CI ❌ - fix and push
|
|
674
|
+
/p:ship --draft → 📎 Draft PR created
|
|
675
|
+
/p:ship (on main) → ⚠️ Cannot ship from protected branch
|
|
651
676
|
```
|
|
652
677
|
|
|
653
678
|
## References
|
|
654
|
-
- Architecture
|
|
655
|
-
- Validation
|
|
679
|
+
- Architecture: `~/.prjct-cli/docs/architecture.md`
|
|
680
|
+
- Validation: `templates/shared/validation.md`
|