prjct-cli 0.35.3 → 0.35.4
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/core/commands/analysis.ts +58 -32
- package/core/commands/command-data.ts +11 -50
- package/core/commands/commands.ts +18 -21
- package/core/commands/context.ts +238 -0
- package/core/commands/register.ts +7 -5
- package/core/commands/setup.ts +1 -17
- package/core/index.ts +2 -4
- package/core/services/index.ts +2 -0
- package/core/services/sync-service.ts +1080 -0
- package/core/types/commands.ts +0 -12
- package/core/types/index.ts +0 -1
- package/dist/bin/prjct.mjs +1215 -307
- package/package.json +2 -8
- package/templates/agentic/agent-routing.md +22 -88
- package/templates/agentic/agents/uxui.md +42 -197
- package/templates/agentic/context-filtering.md +14 -56
- package/templates/agentic/orchestrator.md +26 -302
- package/templates/agentic/skill-integration.md +37 -289
- package/templates/agentic/subagent-generation.md +31 -104
- package/templates/agentic/task-fragmentation.md +39 -273
- package/templates/agents/AGENTS.md +32 -188
- package/templates/commands/bug.md +22 -520
- package/templates/commands/dash.md +26 -161
- package/templates/commands/done.md +19 -250
- package/templates/commands/enrich.md +21 -732
- package/templates/commands/idea.md +18 -160
- package/templates/commands/init.md +20 -209
- package/templates/commands/merge.md +21 -185
- package/templates/commands/next.md +21 -103
- package/templates/commands/pause.md +21 -272
- package/templates/commands/resume.md +18 -411
- package/templates/commands/setup.md +0 -1
- package/templates/commands/ship.md +30 -627
- package/templates/commands/sync.md +11 -1448
- package/templates/commands/task.md +17 -439
- package/templates/commands/test.md +30 -259
- package/CLAUDE.md +0 -211
- package/packages/shared/package.json +0 -29
- package/packages/shared/src/index.ts +0 -10
- package/packages/shared/src/schemas.ts +0 -124
- package/packages/shared/src/types.ts +0 -187
- package/packages/shared/src/unified.ts +0 -174
- package/packages/shared/src/utils.ts +0 -148
- package/packages/shared/tsconfig.json +0 -18
|
@@ -1,175 +1,33 @@
|
|
|
1
1
|
---
|
|
2
|
-
allowed-tools: [Read, Write, Bash
|
|
3
|
-
description: 'Quick idea capture'
|
|
4
|
-
timestamp-rule: 'GetTimestamp() and GetDate() for timestamps'
|
|
5
|
-
architecture: 'Write-Through (JSON → MD → Events)'
|
|
6
|
-
storage-layer: true
|
|
7
|
-
source-of-truth: 'storage/ideas.json'
|
|
8
|
-
claude-context: 'context/ideas.md'
|
|
9
|
-
backend-sync: 'sync/pending.json'
|
|
2
|
+
allowed-tools: [Read, Write, Bash]
|
|
10
3
|
---
|
|
11
4
|
|
|
12
|
-
#
|
|
5
|
+
# p. idea "$ARGUMENTS"
|
|
13
6
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
User Action → Storage (JSON) → Context (MD) → Sync Events
|
|
7
|
+
```bash
|
|
8
|
+
prjct context idea
|
|
18
9
|
```
|
|
19
10
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
## Context Variables
|
|
25
|
-
- `{projectId}`: From `.prjct/prjct.config.json`
|
|
26
|
-
- `{globalPath}`: `~/.prjct-cli/projects/{projectId}`
|
|
27
|
-
- `{ideasStoragePath}`: `{globalPath}/storage/ideas.json`
|
|
28
|
-
- `{ideasContextPath}`: `{globalPath}/context/ideas.md`
|
|
29
|
-
- `{syncPath}`: `{globalPath}/sync/pending.json`
|
|
30
|
-
- `{memoryPath}`: `{globalPath}/memory/events.jsonl`
|
|
31
|
-
- `{text}`: User-provided idea text
|
|
32
|
-
|
|
33
|
-
## Step 1: Read Config
|
|
34
|
-
|
|
35
|
-
READ: `.prjct/prjct.config.json`
|
|
36
|
-
EXTRACT: `projectId`
|
|
37
|
-
|
|
38
|
-
IF file not found:
|
|
39
|
-
OUTPUT: "No prjct project. Run /p:init first."
|
|
40
|
-
STOP
|
|
41
|
-
|
|
42
|
-
## Step 2: Analyze Idea
|
|
43
|
-
|
|
44
|
-
Based on {text}, detect:
|
|
45
|
-
|
|
46
|
-
### Priority Detection
|
|
47
|
-
- If mentions "urgent", "critical", "asap" → priority = "high"
|
|
48
|
-
- If mentions "later", "maybe", "nice to have" → priority = "low"
|
|
49
|
-
- Default → priority = "medium"
|
|
50
|
-
|
|
51
|
-
### Tag Detection
|
|
52
|
-
- If mentions UI/design → add `#ui` tag
|
|
53
|
-
- If mentions performance → add `#perf` tag
|
|
54
|
-
- If mentions bug/fix → add `#bug` tag
|
|
55
|
-
- If mentions API/backend → add `#api` tag
|
|
56
|
-
- If mentions security → add `#security` tag
|
|
57
|
-
- If mentions docs → add `#docs` tag
|
|
58
|
-
|
|
59
|
-
## Step 3: Update Storage (SOURCE OF TRUTH)
|
|
11
|
+
Detect priority from keywords:
|
|
12
|
+
- urgent/critical/asap → high
|
|
13
|
+
- later/maybe/nice-to-have → low
|
|
14
|
+
- default → medium
|
|
60
15
|
|
|
61
|
-
|
|
62
|
-
SET: {now} = GetTimestamp()
|
|
16
|
+
Detect tags: #ui, #perf, #bug, #api, #security, #docs
|
|
63
17
|
|
|
64
|
-
|
|
65
|
-
READ: `{ideasStoragePath}` or create default:
|
|
18
|
+
ADD to `{globalPath}/storage/ideas.json`:
|
|
66
19
|
```json
|
|
67
|
-
{
|
|
68
|
-
"ideas": [],
|
|
69
|
-
"lastUpdated": null
|
|
70
|
-
}
|
|
20
|
+
{"id":"{uuid}","text":"$ARGUMENTS","priority":"{priority}","tags":[...],"status":"pending","createdAt":"{now}"}
|
|
71
21
|
```
|
|
72
22
|
|
|
73
|
-
|
|
74
|
-
```json
|
|
75
|
-
{
|
|
76
|
-
"id": "{ideaId}",
|
|
77
|
-
"text": "{text}",
|
|
78
|
-
"priority": "{priority}",
|
|
79
|
-
"tags": ["{detected_tags}"],
|
|
80
|
-
"status": "pending",
|
|
81
|
-
"createdAt": "{now}"
|
|
82
|
-
}
|
|
23
|
+
**Output**:
|
|
83
24
|
```
|
|
25
|
+
💡 $ARGUMENTS
|
|
84
26
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
SET: lastUpdated = {now}
|
|
88
|
-
WRITE: `{ideasStoragePath}`
|
|
89
|
-
|
|
90
|
-
## Step 4: Generate Context (FOR CLAUDE)
|
|
91
|
-
|
|
92
|
-
WRITE: `{ideasContextPath}`
|
|
93
|
-
|
|
94
|
-
```markdown
|
|
95
|
-
# IDEAS
|
|
96
|
-
|
|
97
|
-
## Pending
|
|
98
|
-
|
|
99
|
-
{FOR EACH idea in ideas WHERE status == "pending":}
|
|
100
|
-
- **{idea.text}** {idea.tags.join(' ')}
|
|
101
|
-
- Priority: {idea.priority}
|
|
102
|
-
- Added: {idea.createdAt}
|
|
103
|
-
{END FOR}
|
|
27
|
+
Priority: {priority}
|
|
28
|
+
Tags: {tags}
|
|
104
29
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
- ~~{idea.text}~~ → Feature: {idea.convertedTo}
|
|
109
|
-
{END FOR}
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
## Step 5: Queue Sync Event (FOR BACKEND)
|
|
113
|
-
|
|
114
|
-
READ: `{syncPath}` or create empty array
|
|
115
|
-
APPEND event:
|
|
116
|
-
```json
|
|
117
|
-
{
|
|
118
|
-
"type": "idea.created",
|
|
119
|
-
"path": ["ideas"],
|
|
120
|
-
"data": {
|
|
121
|
-
"ideaId": "{ideaId}",
|
|
122
|
-
"text": "{text}",
|
|
123
|
-
"priority": "{priority}",
|
|
124
|
-
"tags": ["{detected_tags}"]
|
|
125
|
-
},
|
|
126
|
-
"timestamp": "{now}",
|
|
127
|
-
"projectId": "{projectId}"
|
|
128
|
-
}
|
|
129
|
-
```
|
|
130
|
-
WRITE: `{syncPath}`
|
|
131
|
-
|
|
132
|
-
## Step 6: Log to Memory (AUDIT TRAIL)
|
|
133
|
-
|
|
134
|
-
APPEND to: `{memoryPath}`
|
|
135
|
-
```json
|
|
136
|
-
{"timestamp":"{now}","action":"idea_added","ideaId":"{ideaId}","text":"{text}","priority":"{priority}"}
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
## Response
|
|
140
|
-
|
|
141
|
-
`💡 {text} | Saved | Start: /p:feature "{text}"`
|
|
142
|
-
|
|
143
|
-
## Error Handling
|
|
144
|
-
|
|
145
|
-
| Error | Response | Action |
|
|
146
|
-
|-------|----------|--------|
|
|
147
|
-
| No project | "No prjct project" | STOP |
|
|
148
|
-
| No text | "What's your idea?" | ASK |
|
|
149
|
-
| Write fails | Log warning | CONTINUE |
|
|
150
|
-
|
|
151
|
-
## Examples
|
|
152
|
-
|
|
153
|
-
### Example 1: Simple Idea
|
|
154
|
-
**Input:** `/p:idea add dark mode support`
|
|
155
|
-
|
|
156
|
-
**Output:**
|
|
157
|
-
```
|
|
158
|
-
💡 add dark mode support | Saved | Start: /p:feature "add dark mode support"
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### Example 2: Idea with Priority
|
|
162
|
-
**Input:** `/p:idea urgent fix login bug`
|
|
163
|
-
|
|
164
|
-
**Output:**
|
|
165
|
-
```
|
|
166
|
-
💡 urgent fix login bug [high] | Saved | Start: /p:feature "fix login bug"
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### Example 3: Idea with Tags
|
|
170
|
-
**Input:** `/p:idea improve API performance`
|
|
171
|
-
|
|
172
|
-
**Output:**
|
|
173
|
-
```
|
|
174
|
-
💡 improve API performance #api #perf | Saved
|
|
30
|
+
Next:
|
|
31
|
+
- Start work → `p. task "$ARGUMENTS"`
|
|
32
|
+
- See ideas → `p. dash`
|
|
175
33
|
```
|
|
@@ -1,227 +1,38 @@
|
|
|
1
1
|
---
|
|
2
|
-
allowed-tools: [Read, Write, Bash]
|
|
3
|
-
description: 'Initialize prjct'
|
|
4
|
-
timestamp-rule: 'GetTimestamp() for all timestamps'
|
|
5
|
-
architecture: 'Write-Through (JSON → MD → Events)'
|
|
6
|
-
storage-layer: true
|
|
2
|
+
allowed-tools: [Read, Write, Bash, AskUserQuestion]
|
|
7
3
|
---
|
|
8
4
|
|
|
9
|
-
#
|
|
5
|
+
# p. init
|
|
10
6
|
|
|
11
|
-
|
|
7
|
+
Check if already initialized (`.prjct/prjct.config.json` exists)
|
|
12
8
|
|
|
13
|
-
|
|
9
|
+
Generate UUID: `crypto.randomUUID()`
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
11
|
+
Create directories in `~/.prjct-cli/projects/{projectId}/`:
|
|
12
|
+
- storage/ (state.json, queue.json, ideas.json, shipped.json)
|
|
13
|
+
- context/
|
|
14
|
+
- sync/
|
|
15
|
+
- agents/
|
|
16
|
+
- memory/
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
**CRITICAL**: Project IDs MUST be standard UUIDs for PostgreSQL consistency.
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
Format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
|
|
26
|
-
Example: 550e8400-e29b-41d4-a716-446655440000
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Generate using: `crypto.randomUUID()`
|
|
30
|
-
|
|
31
|
-
## Flow
|
|
32
|
-
|
|
33
|
-
1. **Check existing**: Read `.prjct/prjct.config.json`
|
|
34
|
-
2. **Generate UUID**: Use `crypto.randomUUID()`
|
|
35
|
-
3. **Create directories**: storage/, context/, sync/, agents/, memory/
|
|
36
|
-
4. **Create config files**: local + global
|
|
37
|
-
5. **Analyze project**: Detect stack, dependencies
|
|
38
|
-
6. **Generate agents**: Based on detected stack
|
|
39
|
-
|
|
40
|
-
## Directory Structure
|
|
41
|
-
|
|
42
|
-
```
|
|
43
|
-
~/.prjct-cli/projects/{projectId}/
|
|
44
|
-
├── storage/ # Source of Truth (JSON)
|
|
45
|
-
│ ├── state.json # Current + paused task
|
|
46
|
-
│ ├── queue.json # Task queue
|
|
47
|
-
│ ├── ideas.json # Ideas list
|
|
48
|
-
│ └── shipped.json # Shipped features
|
|
49
|
-
├── context/ # For Claude (MD)
|
|
50
|
-
│ ├── CLAUDE.md # Full context
|
|
51
|
-
│ ├── now.md # Current task
|
|
52
|
-
│ ├── next.md # Queue
|
|
53
|
-
│ ├── ideas.md # Ideas
|
|
54
|
-
│ └── shipped.md # Shipped
|
|
55
|
-
├── sync/ # Backend Sync
|
|
56
|
-
│ └── pending.json # Events queue
|
|
57
|
-
├── agents/ # Specialists
|
|
58
|
-
├── memory/ # Audit Trail
|
|
59
|
-
│ └── events.jsonl
|
|
60
|
-
├── progress/ # Historical Data
|
|
61
|
-
│ └── sessions/{YYYY-MM}/
|
|
62
|
-
└── project.json # Metadata
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Step: Create Storage Files
|
|
66
|
-
|
|
67
|
-
### storage/state.json
|
|
68
|
-
```json
|
|
69
|
-
{
|
|
70
|
-
"currentTask": null,
|
|
71
|
-
"pausedTask": null,
|
|
72
|
-
"previousTask": null,
|
|
73
|
-
"lastUpdated": null
|
|
74
|
-
}
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### storage/queue.json
|
|
18
|
+
Create `.prjct/prjct.config.json`:
|
|
78
19
|
```json
|
|
79
|
-
{
|
|
80
|
-
"tasks": [],
|
|
81
|
-
"lastUpdated": null
|
|
82
|
-
}
|
|
20
|
+
{"projectId": "{uuid}", "dataPath": "~/.prjct-cli/projects/{uuid}"}
|
|
83
21
|
```
|
|
84
22
|
|
|
85
|
-
|
|
86
|
-
```json
|
|
87
|
-
{
|
|
88
|
-
"ideas": [],
|
|
89
|
-
"lastUpdated": null
|
|
90
|
-
}
|
|
91
|
-
```
|
|
23
|
+
Create `{globalPath}/project.json` with project name from package.json
|
|
92
24
|
|
|
93
|
-
|
|
94
|
-
```json
|
|
95
|
-
{
|
|
96
|
-
"shipped": [],
|
|
97
|
-
"lastUpdated": null
|
|
98
|
-
}
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### sync/pending.json
|
|
102
|
-
```json
|
|
103
|
-
[]
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
## Step: Create project.json (REQUIRED)
|
|
107
|
-
|
|
108
|
-
This file is the source of truth for the web dashboard.
|
|
109
|
-
|
|
110
|
-
### Determine Project Name
|
|
111
|
-
- Try package.json → `name` field
|
|
112
|
-
- Try Cargo.toml → `[package] name`
|
|
113
|
-
- Try pyproject.toml → `[project] name`
|
|
114
|
-
- Fallback to directory name
|
|
115
|
-
|
|
116
|
-
WRITE: `{globalPath}/project.json`
|
|
117
|
-
|
|
118
|
-
```json
|
|
119
|
-
{
|
|
120
|
-
"projectId": "{projectId}",
|
|
121
|
-
"repoPath": "{cwd}",
|
|
122
|
-
"name": "{projectName}",
|
|
123
|
-
"createdAt": "{GetTimestamp()}",
|
|
124
|
-
"lastSync": "{GetTimestamp()}"
|
|
125
|
-
}
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
## Step: Create Local Config
|
|
129
|
-
|
|
130
|
-
WRITE: `.prjct/prjct.config.json`
|
|
131
|
-
|
|
132
|
-
```json
|
|
133
|
-
{
|
|
134
|
-
"projectId": "{projectId}",
|
|
135
|
-
"dataPath": "~/.prjct-cli/projects/{projectId}"
|
|
136
|
-
}
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
## Step: Install MCP Servers
|
|
140
|
-
|
|
141
|
-
Install required MCP servers by merging `templates/mcp-config.json` into `~/.claude/settings.json`.
|
|
142
|
-
|
|
143
|
-
```
|
|
144
|
-
READ: templates/mcp-config.json
|
|
145
|
-
READ: ~/.claude/settings.json (if exists)
|
|
146
|
-
MERGE: mcpServers (don't overwrite existing)
|
|
147
|
-
WRITE: ~/.claude/settings.json
|
|
148
|
-
|
|
149
|
-
Servers installed:
|
|
150
|
-
- context7: Library documentation lookup
|
|
151
|
-
- Atlassian: JIRA/Confluence (OAuth, SSO compatible)
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
## Step: Optional Integrations
|
|
155
|
-
|
|
156
|
-
After core setup, offer optional integrations.
|
|
157
|
-
|
|
158
|
-
### JIRA Integration (Optional)
|
|
159
|
-
|
|
160
|
-
Ask: "Would you like to connect with JIRA for issue tracking?"
|
|
161
|
-
|
|
162
|
-
If yes:
|
|
163
|
-
1. MCP server already installed (Atlassian)
|
|
164
|
-
2. Ask user to authenticate:
|
|
165
|
-
- "Run `p. jira setup` after init completes"
|
|
166
|
-
- First use will open browser for OAuth (SSO compatible)
|
|
167
|
-
3. Store config in `project.json`:
|
|
168
|
-
|
|
169
|
-
```json
|
|
170
|
-
{
|
|
171
|
-
"integrations": {
|
|
172
|
-
"jira": {
|
|
173
|
-
"enabled": true,
|
|
174
|
-
"provider": "jira",
|
|
175
|
-
"authMode": "mcp"
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
If no: Skip (integration can be added later with `p. jira setup`).
|
|
182
|
-
|
|
183
|
-
### Linear Integration (Optional)
|
|
184
|
-
|
|
185
|
-
Ask: "Would you like to connect with Linear for issue tracking?"
|
|
186
|
-
|
|
187
|
-
If yes:
|
|
188
|
-
1. Ask for LINEAR_API_KEY (from https://linear.app/settings/api)
|
|
189
|
-
2. Run `p. linear setup` to complete configuration
|
|
190
|
-
|
|
191
|
-
## Response
|
|
25
|
+
Optional: Ask about JIRA/Linear integration
|
|
192
26
|
|
|
27
|
+
**Output**:
|
|
193
28
|
```
|
|
194
29
|
✅ Initialized prjct
|
|
195
30
|
|
|
196
|
-
Project ID: {
|
|
197
|
-
Data
|
|
198
|
-
|
|
199
|
-
Structure:
|
|
200
|
-
├── storage/ # JSON (source of truth)
|
|
201
|
-
├── context/ # MD (for Claude)
|
|
202
|
-
├── sync/ # Backend events
|
|
203
|
-
└── agents/ # Specialists
|
|
204
|
-
|
|
205
|
-
MCP Servers:
|
|
206
|
-
• context7: Library docs ✓
|
|
207
|
-
• Atlassian: JIRA/Confluence ✓
|
|
208
|
-
|
|
209
|
-
Integrations:
|
|
210
|
-
• JIRA: {enabled|disabled}
|
|
211
|
-
• Linear: {enabled|disabled}
|
|
31
|
+
Project ID: {uuid}
|
|
32
|
+
Data: ~/.prjct-cli/projects/{uuid}/
|
|
212
33
|
|
|
213
34
|
Next:
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
• p. task "{first_task}" - Start first task
|
|
218
|
-
• p. help - See all commands
|
|
35
|
+
- Analyze project → `p. sync`
|
|
36
|
+
- Start first task → `p. task "description"`
|
|
37
|
+
- See help → `p. help`
|
|
219
38
|
```
|
|
220
|
-
|
|
221
|
-
## Error Handling
|
|
222
|
-
|
|
223
|
-
| Error | Response |
|
|
224
|
-
|-------|----------|
|
|
225
|
-
| Already initialized | Show existing projectId |
|
|
226
|
-
| Permission denied | Suggest chmod |
|
|
227
|
-
| Write fails | Show error |
|
|
@@ -1,202 +1,38 @@
|
|
|
1
1
|
---
|
|
2
|
-
allowed-tools: [Bash, Read, Write
|
|
3
|
-
description: 'Merge PR to main branch'
|
|
4
|
-
timestamp-rule: 'GetTimestamp() for ALL timestamps'
|
|
5
|
-
architecture: 'Write-Through (JSON -> MD -> Events)'
|
|
6
|
-
storage-layer: true
|
|
7
|
-
source-of-truth: 'storage/state.json'
|
|
2
|
+
allowed-tools: [Bash, Read, Write]
|
|
8
3
|
---
|
|
9
4
|
|
|
10
|
-
#
|
|
5
|
+
# p. merge
|
|
11
6
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
## Usage
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
/p:merge [--squash|--rebase|--merge] # Merge strategy (default: squash)
|
|
18
|
-
[--delete-branch] # Delete branch after merge
|
|
7
|
+
```bash
|
|
8
|
+
prjct context merge
|
|
19
9
|
```
|
|
20
10
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- `{globalPath}`: `~/.prjct-cli/projects/{projectId}`
|
|
24
|
-
- `{statePath}`: `{globalPath}/storage/state.json`
|
|
25
|
-
- `{memoryPath}`: `{globalPath}/memory/events.jsonl`
|
|
26
|
-
- `{syncPath}`: `{globalPath}/sync/pending.json`
|
|
27
|
-
|
|
28
|
-
## Step 1: Validate Project
|
|
29
|
-
|
|
30
|
-
READ: `.prjct/prjct.config.json`
|
|
31
|
-
EXTRACT: `projectId`
|
|
32
|
-
|
|
33
|
-
IF file not found:
|
|
34
|
-
OUTPUT: "No prjct project. Run /p:init first."
|
|
35
|
-
STOP
|
|
36
|
-
|
|
37
|
-
## Step 2: Validate Workflow Phase
|
|
38
|
-
|
|
39
|
-
READ: `{globalPath}/storage/state.json`
|
|
40
|
-
|
|
41
|
-
IF currentTask is null:
|
|
42
|
-
OUTPUT: "No active task. Use p. task to start one."
|
|
43
|
-
STOP
|
|
44
|
-
|
|
45
|
-
IF currentTask.workflow exists:
|
|
46
|
-
IF currentTask.workflow.phase != "review":
|
|
47
|
-
OUTPUT:
|
|
48
|
-
```
|
|
49
|
-
Cannot merge. Current phase: {currentTask.workflow.phase}
|
|
50
|
-
|
|
51
|
-
Required phase: review
|
|
52
|
-
|
|
53
|
-
Workflow: analyze → branch → implement → test → review → merge → ship → verify
|
|
54
|
-
|
|
55
|
-
Complete code review first with p. review
|
|
56
|
-
```
|
|
57
|
-
STOP
|
|
58
|
-
|
|
59
|
-
## Step 3: Verify PR Status
|
|
60
|
-
|
|
61
|
-
SET: {prNumber} = currentTask.branch.prNumber
|
|
62
|
-
|
|
63
|
-
IF {prNumber} is null:
|
|
64
|
-
OUTPUT: "No PR found. Run p. review first to create PR."
|
|
65
|
-
STOP
|
|
66
|
-
|
|
67
|
-
### Check PR is approved
|
|
68
|
-
BASH: `gh pr view {prNumber} --json reviewDecision,mergeable,state`
|
|
69
|
-
SET: {decision} = result.reviewDecision
|
|
70
|
-
SET: {mergeable} = result.mergeable
|
|
71
|
-
SET: {state} = result.state
|
|
72
|
-
|
|
73
|
-
IF {state} == "MERGED":
|
|
74
|
-
OUTPUT: "PR already merged."
|
|
75
|
-
-> Skip to Step 5 (update workflow)
|
|
76
|
-
|
|
77
|
-
IF {decision} != "APPROVED":
|
|
78
|
-
OUTPUT:
|
|
79
|
-
```
|
|
80
|
-
⚠️ PR not approved yet
|
|
81
|
-
|
|
82
|
-
Current status: {decision}
|
|
83
|
-
|
|
84
|
-
Get approvals and run p. merge again.
|
|
85
|
-
```
|
|
86
|
-
STOP
|
|
87
|
-
|
|
88
|
-
IF {mergeable} != "MERGEABLE":
|
|
89
|
-
OUTPUT:
|
|
90
|
-
```
|
|
91
|
-
⚠️ PR has conflicts or is not mergeable
|
|
92
|
-
|
|
93
|
-
Status: {mergeable}
|
|
94
|
-
|
|
95
|
-
Resolve conflicts and run p. merge again.
|
|
96
|
-
```
|
|
97
|
-
STOP
|
|
98
|
-
|
|
99
|
-
## Step 4: Merge PR
|
|
11
|
+
IF no `currentTask` → "No active task"
|
|
12
|
+
IF no PR → "Run p. review first"
|
|
100
13
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
IF --rebase: {strategy} = "rebase"
|
|
104
|
-
IF --merge: {strategy} = "merge"
|
|
105
|
-
|
|
106
|
-
OUTPUT: "Merging PR #{prNumber} with {strategy} strategy..."
|
|
107
|
-
|
|
108
|
-
BASH: `gh pr merge {prNumber} --{strategy} --auto 2>&1`
|
|
109
|
-
|
|
110
|
-
IF command fails:
|
|
111
|
-
OUTPUT: "Merge failed. Check PR status on GitHub."
|
|
112
|
-
STOP
|
|
113
|
-
|
|
114
|
-
### Delete branch if requested
|
|
115
|
-
IF --delete-branch OR currentTask.branch.createdByPrjct:
|
|
116
|
-
BASH: `git branch -d {currentTask.branch.name} 2>/dev/null`
|
|
117
|
-
BASH: `git push origin --delete {currentTask.branch.name} 2>/dev/null`
|
|
118
|
-
OUTPUT: "Deleted branch: {currentTask.branch.name}"
|
|
119
|
-
|
|
120
|
-
### Switch to base branch
|
|
121
|
-
BASH: `git checkout {currentTask.branch.baseBranch}`
|
|
122
|
-
BASH: `git pull origin {currentTask.branch.baseBranch}`
|
|
123
|
-
|
|
124
|
-
## Step 5: Update Workflow Phase
|
|
125
|
-
|
|
126
|
-
SET: {now} = GetTimestamp()
|
|
127
|
-
|
|
128
|
-
### Get merge commit
|
|
129
|
-
BASH: `git rev-parse HEAD`
|
|
130
|
-
SET: {mergeCommit} = result
|
|
131
|
-
|
|
132
|
-
SET: currentTask.workflow.phase = "merge"
|
|
133
|
-
SET: currentTask.workflow.checkpoints.merge = {
|
|
134
|
-
"completedAt": "{now}",
|
|
135
|
-
"data": {
|
|
136
|
-
"mergeCommit": "{mergeCommit}",
|
|
137
|
-
"prNumber": {prNumber},
|
|
138
|
-
"strategy": "{strategy}"
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
SET: currentTask.workflow.lastCheckpoint = "merge"
|
|
142
|
-
|
|
143
|
-
WRITE: `{statePath}`
|
|
144
|
-
|
|
145
|
-
## Step 6: Log Events
|
|
146
|
-
|
|
147
|
-
APPEND to `{memoryPath}`:
|
|
148
|
-
```json
|
|
149
|
-
{"timestamp":"{now}","action":"phase_advanced","taskId":"{currentTask.id}","from":"review","to":"merge"}
|
|
150
|
-
{"timestamp":"{now}","action":"checkpoint_completed","taskId":"{currentTask.id}","checkpoint":"merge","data":{"mergeCommit":"{mergeCommit}"}}
|
|
14
|
+
```bash
|
|
15
|
+
gh pr view {prNumber} --json reviewDecision,mergeable,state
|
|
151
16
|
```
|
|
152
17
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
18
|
+
IF not approved → "Get approvals first"
|
|
19
|
+
IF has conflicts → "Resolve conflicts first"
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
gh pr merge {prNumber} --squash --auto
|
|
23
|
+
git checkout main && git pull
|
|
156
24
|
```
|
|
157
25
|
|
|
158
|
-
|
|
26
|
+
Delete branch if created by prjct
|
|
159
27
|
|
|
28
|
+
**Output**:
|
|
160
29
|
```
|
|
161
|
-
|
|
30
|
+
✅ PR Merged
|
|
162
31
|
|
|
163
|
-
Task: {currentTask.description}
|
|
164
32
|
PR: #{prNumber}
|
|
165
|
-
|
|
166
|
-
Strategy: {strategy}
|
|
167
|
-
|
|
168
|
-
Phase: merge (6/11 checkpoints)
|
|
33
|
+
Strategy: squash
|
|
169
34
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
3. implement ✓
|
|
174
|
-
4. test ✓
|
|
175
|
-
5. review ✓
|
|
176
|
-
6. merge ✓
|
|
177
|
-
7-10. ship ← next
|
|
178
|
-
|
|
179
|
-
Next: p. ship to release
|
|
35
|
+
Next:
|
|
36
|
+
- Release → `p. ship`
|
|
37
|
+
- New task → `p. task "description"`
|
|
180
38
|
```
|
|
181
|
-
|
|
182
|
-
## Error Handling
|
|
183
|
-
|
|
184
|
-
| Error | Response | Action |
|
|
185
|
-
|-------|----------|--------|
|
|
186
|
-
| No project | "No prjct project" | STOP |
|
|
187
|
-
| No active task | "No active task" | STOP |
|
|
188
|
-
| Wrong phase | Show required phase | STOP |
|
|
189
|
-
| No PR | "Run p. review first" | STOP |
|
|
190
|
-
| Not approved | "Get approvals first" | STOP |
|
|
191
|
-
| Conflicts | "Resolve conflicts" | STOP |
|
|
192
|
-
| Merge fails | Show error | STOP |
|
|
193
|
-
|
|
194
|
-
## Natural Language Triggers
|
|
195
|
-
|
|
196
|
-
- `p. merge` -> /p:merge
|
|
197
|
-
- `p. merge pr` -> /p:merge
|
|
198
|
-
|
|
199
|
-
## References
|
|
200
|
-
|
|
201
|
-
- Architecture: `~/.prjct-cli/docs/architecture.md`
|
|
202
|
-
- Workflow: `~/.prjct-cli/docs/workflow.md`
|