prjct-cli 0.42.0 → 0.44.1
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 +97 -0
- package/core/agentic/command-executor.ts +15 -5
- package/core/ai-tools/formatters.ts +302 -0
- package/core/ai-tools/generator.ts +124 -0
- package/core/ai-tools/index.ts +15 -0
- package/core/ai-tools/registry.ts +195 -0
- package/core/cli/linear.ts +61 -2
- package/core/commands/analysis.ts +36 -2
- package/core/commands/commands.ts +2 -2
- package/core/commands/planning.ts +8 -4
- package/core/commands/shipping.ts +9 -7
- package/core/commands/workflow.ts +67 -17
- package/core/index.ts +3 -1
- package/core/infrastructure/ai-provider.ts +11 -36
- package/core/integrations/issue-tracker/types.ts +7 -1
- package/core/integrations/linear/client.ts +56 -24
- package/core/integrations/linear/index.ts +3 -0
- package/core/integrations/linear/sync.ts +313 -0
- package/core/schemas/index.ts +3 -0
- package/core/schemas/issues.ts +144 -0
- package/core/schemas/state.ts +3 -0
- package/core/services/sync-service.ts +71 -4
- package/core/utils/agent-stream.ts +138 -0
- package/core/utils/branding.ts +2 -3
- package/core/utils/next-steps.ts +95 -0
- package/core/utils/output.ts +26 -0
- package/core/workflow/index.ts +6 -0
- package/core/workflow/state-machine.ts +185 -0
- package/dist/bin/prjct.mjs +2382 -541
- package/package.json +1 -1
- package/templates/_bases/tracker-base.md +11 -0
- package/templates/commands/done.md +18 -13
- package/templates/commands/git.md +143 -54
- package/templates/commands/merge.md +121 -13
- package/templates/commands/review.md +1 -1
- package/templates/commands/ship.md +165 -20
- package/templates/commands/sync.md +17 -0
- package/templates/commands/task.md +123 -17
- package/templates/global/ANTIGRAVITY.md +2 -4
- package/templates/global/CLAUDE.md +115 -28
- package/templates/global/CURSOR.mdc +1 -3
- package/templates/global/GEMINI.md +2 -4
- package/templates/global/WINDSURF.md +1 -3
- package/templates/subagents/workflow/prjct-shipper.md +1 -2
package/package.json
CHANGED
|
@@ -9,6 +9,17 @@ description: 'Base template for issue tracker integrations'
|
|
|
9
9
|
|
|
10
10
|
All issue tracker integrations (Linear, JIRA, GitHub Issues, Monday.com) inherit from this base.
|
|
11
11
|
|
|
12
|
+
## CRITICAL - SDK vs MCP
|
|
13
|
+
|
|
14
|
+
| Tracker | Method | Why |
|
|
15
|
+
|---------|--------|-----|
|
|
16
|
+
| **Linear** | **SDK ONLY** | Per-project credentials, 4x faster |
|
|
17
|
+
| **JIRA** | **SDK ONLY** | Per-project credentials, 4x faster |
|
|
18
|
+
| GitHub | MCP | Simple token auth |
|
|
19
|
+
| Monday | MCP | OAuth only |
|
|
20
|
+
|
|
21
|
+
**For Linear and JIRA**: NEVER use MCP tools (`mcp__linear__*`, `mcp__jira__*`). ALWAYS use the SDK CLI helper.
|
|
22
|
+
|
|
12
23
|
---
|
|
13
24
|
|
|
14
25
|
## Common Context Variables
|
|
@@ -26,20 +26,25 @@ WRITE `{globalPath}/storage/state.json`
|
|
|
26
26
|
|
|
27
27
|
## Sync Issue Tracker Status
|
|
28
28
|
|
|
29
|
-
IF `currentTask.
|
|
29
|
+
IF `currentTask.linearId` exists:
|
|
30
30
|
|
|
31
31
|
```
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
# Update Linear issue to Done using sync layer
|
|
33
|
+
# This updates both Linear API and local issues.json cache
|
|
34
|
+
|
|
35
|
+
IMPORT: linearSync from core/integrations/linear
|
|
36
|
+
CALL: linearSync.pushStatus(projectId, currentTask.linearId, 'done')
|
|
37
|
+
|
|
38
|
+
OUTPUT: "Linear: {linearId} → Done"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
ELSE IF `currentTask.externalId` AND `currentTask.externalProvider == "jira"`:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
# Update JIRA issue to Done
|
|
45
|
+
IMPORT: jiraService from core/integrations/jira
|
|
46
|
+
CALL: jiraService.markDone(currentTask.externalId)
|
|
47
|
+
OUTPUT: "JIRA: {externalId} → Done"
|
|
43
48
|
```
|
|
44
49
|
|
|
45
50
|
---
|
|
@@ -49,7 +54,7 @@ ELSE IF currentTask.externalProvider == "jira":
|
|
|
49
54
|
{task} ({duration})
|
|
50
55
|
|
|
51
56
|
Files: {count} | Commits: {count}
|
|
52
|
-
{
|
|
57
|
+
{linearId ? "Linear: {linearId} → Done" : ""}
|
|
53
58
|
|
|
54
59
|
Next:
|
|
55
60
|
- More work? → `p. task "description"`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
allowed-tools: [Bash, Read, Write]
|
|
2
|
+
allowed-tools: [Bash, Read, Write, AskUserQuestion]
|
|
3
3
|
description: 'Smart git operations with context'
|
|
4
4
|
architecture: 'Write-Through (JSON → MD → Events)'
|
|
5
5
|
storage-layer: true
|
|
@@ -8,11 +8,11 @@ source-of-truth: 'storage/state.json'
|
|
|
8
8
|
|
|
9
9
|
# /p:git - Smart Git Operations
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## ⛔ MANDATORY WORKFLOW - FOLLOW STEPS IN ORDER
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
**All git operations through prjct MUST follow these rules.**
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
---
|
|
16
16
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
@@ -23,6 +23,33 @@ Reads from **Storage (JSON)** as source of truth.
|
|
|
23
23
|
/p:git undo # Undo last commit
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
## ⛔ GLOBAL BLOCKING RULES
|
|
27
|
+
|
|
28
|
+
### Rule 1: Protected Branch Check (ALL OPERATIONS)
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
CURRENT_BRANCH=$(git branch --show-current)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**⛔ IF branch is `main` or `master`:**
|
|
35
|
+
```
|
|
36
|
+
For commit: STOP. "Cannot commit on main. Create a feature branch."
|
|
37
|
+
For push: STOP. "Cannot push to main. Use p. ship to create PR."
|
|
38
|
+
ABORT the operation entirely.
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Rule 2: Dirty Working Directory
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
git status --porcelain
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**⛔ IF uncommitted changes AND operation is push/sync:**
|
|
48
|
+
```
|
|
49
|
+
STOP. "Uncommitted changes detected. Commit first with p. git commit."
|
|
50
|
+
ABORT.
|
|
51
|
+
```
|
|
52
|
+
|
|
26
53
|
## Context Variables
|
|
27
54
|
- `{projectId}`: From `.prjct/prjct.config.json`
|
|
28
55
|
- `{globalPath}`: `~/.prjct-cli/projects/{projectId}`
|
|
@@ -31,65 +58,129 @@ Reads from **Storage (JSON)** as source of truth.
|
|
|
31
58
|
|
|
32
59
|
## Flow: commit
|
|
33
60
|
|
|
34
|
-
### Step 1:
|
|
35
|
-
|
|
36
|
-
|
|
61
|
+
### Step 1: Pre-flight Checks (BLOCKING)
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Get current branch
|
|
65
|
+
CURRENT_BRANCH=$(git branch --show-current)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**⛔ IF on main/master:**
|
|
69
|
+
```
|
|
70
|
+
STOP. DO NOT PROCEED.
|
|
71
|
+
OUTPUT: "Cannot commit on protected branch: {currentBranch}"
|
|
72
|
+
OUTPUT: "Create a feature branch first with: p. task 'description'"
|
|
73
|
+
ABORT.
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# Check for changes
|
|
78
|
+
git status --porcelain
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**⛔ IF no changes:**
|
|
82
|
+
```
|
|
83
|
+
STOP. DO NOT PROCEED.
|
|
84
|
+
OUTPUT: "Nothing to commit."
|
|
85
|
+
ABORT.
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Step 2: Show Plan and Get Approval (BLOCKING)
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
git diff --stat
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
OUTPUT:
|
|
96
|
+
"""
|
|
97
|
+
## Commit Plan
|
|
98
|
+
|
|
99
|
+
Branch: {currentBranch}
|
|
100
|
+
Changes:
|
|
101
|
+
{git diff --stat output}
|
|
37
102
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
ELSE:
|
|
42
|
-
SET: {expectedBranch} = null
|
|
103
|
+
Will create commit with prjct footer.
|
|
104
|
+
Proceed? (yes/no)
|
|
105
|
+
"""
|
|
43
106
|
|
|
44
|
-
|
|
45
|
-
|
|
107
|
+
WAIT for explicit approval.
|
|
108
|
+
DO NOT assume.
|
|
109
|
+
```
|
|
46
110
|
|
|
47
|
-
|
|
48
|
-
OUTPUT:
|
|
49
|
-
```
|
|
50
|
-
⚠️ Cannot commit on protected branch: {currentBranch}
|
|
111
|
+
### Step 3: Stage and Commit
|
|
51
112
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
113
|
+
```bash
|
|
114
|
+
git add .
|
|
115
|
+
git commit -m "$(cat <<'EOF'
|
|
116
|
+
{type}: {description}
|
|
55
117
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
118
|
+
Generated with [p/](https://www.prjct.app/)
|
|
119
|
+
EOF
|
|
120
|
+
)"
|
|
121
|
+
```
|
|
60
122
|
|
|
61
|
-
|
|
62
|
-
Expected: {expectedBranch}
|
|
123
|
+
**⛔ The prjct footer is MANDATORY. No exceptions.**
|
|
63
124
|
|
|
64
|
-
|
|
65
|
-
```
|
|
66
|
-
STOP
|
|
125
|
+
### Step 4: Log to Memory
|
|
67
126
|
|
|
68
|
-
|
|
69
|
-
1. Git: `add .` → stage changes
|
|
70
|
-
2. Create: commit message with prjct metadata
|
|
71
|
-
3. Commit: with message
|
|
72
|
-
4. Log: `memory/events.jsonl`
|
|
127
|
+
APPEND to `{globalPath}/memory/events.jsonl`
|
|
73
128
|
|
|
74
129
|
## Flow: push
|
|
75
130
|
|
|
76
|
-
### Step 1:
|
|
77
|
-
|
|
78
|
-
|
|
131
|
+
### Step 1: Pre-flight Checks (BLOCKING)
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
CURRENT_BRANCH=$(git branch --show-current)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**⛔ IF on main/master:**
|
|
138
|
+
```
|
|
139
|
+
STOP. DO NOT PROCEED.
|
|
140
|
+
OUTPUT: "Cannot push directly to main/master."
|
|
141
|
+
OUTPUT: "Use `p. ship` to create a Pull Request instead."
|
|
142
|
+
ABORT.
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
git status --porcelain
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**⛔ IF uncommitted changes:**
|
|
150
|
+
```
|
|
151
|
+
STOP. DO NOT PROCEED.
|
|
152
|
+
OUTPUT: "Uncommitted changes detected. Commit first."
|
|
153
|
+
ABORT.
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Step 2: Show Plan and Get Approval (BLOCKING)
|
|
79
157
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
158
|
+
```bash
|
|
159
|
+
git log origin/{currentBranch}..HEAD --oneline 2>/dev/null || git log --oneline -3
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
OUTPUT:
|
|
164
|
+
"""
|
|
165
|
+
## Push Plan
|
|
84
166
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
167
|
+
Branch: {currentBranch}
|
|
168
|
+
Commits to push:
|
|
169
|
+
{commits}
|
|
170
|
+
|
|
171
|
+
Proceed? (yes/no)
|
|
172
|
+
"""
|
|
173
|
+
|
|
174
|
+
WAIT for explicit approval.
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Step 3: Execute Push
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
git push -u origin {currentBranch}
|
|
181
|
+
```
|
|
88
182
|
|
|
89
|
-
|
|
90
|
-
1. Git: `status` → verify clean
|
|
91
|
-
2. Git: `push -u origin {currentBranch}` with branch tracking
|
|
92
|
-
3. Handle: errors (upstream, conflicts)
|
|
183
|
+
**IF push fails:** Show error and STOP. Do not retry automatically.
|
|
93
184
|
|
|
94
185
|
## Flow: sync
|
|
95
186
|
|
|
@@ -106,20 +197,18 @@ IF {currentBranch} == "main" OR {currentBranch} == "master":
|
|
|
106
197
|
|
|
107
198
|
{details if any}
|
|
108
199
|
|
|
109
|
-
|
|
110
|
-
Designed for [Claude](https://www.anthropic.com/claude)
|
|
200
|
+
Generated with [p/](https://www.prjct.app/)
|
|
111
201
|
|
|
112
202
|
```
|
|
113
203
|
|
|
114
|
-
**NON-NEGOTIABLE: The
|
|
204
|
+
**NON-NEGOTIABLE: The `Generated with [p/]` line MUST appear in ALL commits.**
|
|
115
205
|
|
|
116
206
|
Use HEREDOC for proper formatting:
|
|
117
207
|
```bash
|
|
118
208
|
git commit -m "$(cat <<'EOF'
|
|
119
209
|
{type}: {description}
|
|
120
210
|
|
|
121
|
-
|
|
122
|
-
Designed for [Claude](https://www.anthropic.com/claude)
|
|
211
|
+
Generated with [p/](https://www.prjct.app/)
|
|
123
212
|
|
|
124
213
|
EOF
|
|
125
214
|
)"
|
|
@@ -1,38 +1,146 @@
|
|
|
1
1
|
---
|
|
2
|
-
allowed-tools: [Bash, Read, Write]
|
|
2
|
+
allowed-tools: [Bash, Read, Write, AskUserQuestion]
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# p. merge
|
|
6
6
|
|
|
7
|
+
## ⛔ MANDATORY WORKFLOW - DO NOT SKIP ANY STEP
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
### STEP 1: Pre-flight Checks (BLOCKING)
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# 1a. Check if there's an active task with a PR
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**⛔ IF no `currentTask`:**
|
|
18
|
+
```
|
|
19
|
+
STOP. DO NOT PROCEED.
|
|
20
|
+
Tell user: "No active task. Use p. task first."
|
|
21
|
+
ABORT.
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**⛔ IF no PR number in task state:**
|
|
25
|
+
```
|
|
26
|
+
STOP. DO NOT PROCEED.
|
|
27
|
+
Tell user: "No PR found. Run p. ship first to create a PR."
|
|
28
|
+
ABORT.
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
### STEP 2: Check PR Status (BLOCKING)
|
|
34
|
+
|
|
7
35
|
```bash
|
|
8
|
-
|
|
36
|
+
gh pr view {prNumber} --json reviewDecision,mergeable,state,statusCheckRollup
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**⛔ IF PR is not approved:**
|
|
40
|
+
```
|
|
41
|
+
STOP. DO NOT PROCEED.
|
|
42
|
+
Tell user: "PR needs approval. Get reviews first."
|
|
43
|
+
Show: gh pr view {prNumber} --web
|
|
44
|
+
ABORT.
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**⛔ IF PR has merge conflicts:**
|
|
48
|
+
```
|
|
49
|
+
STOP. DO NOT PROCEED.
|
|
50
|
+
Tell user: "PR has conflicts. Resolve them first:
|
|
51
|
+
git checkout {branch}
|
|
52
|
+
git pull origin main
|
|
53
|
+
# fix conflicts
|
|
54
|
+
git push"
|
|
55
|
+
ABORT.
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**⛔ IF CI checks are failing:**
|
|
59
|
+
```
|
|
60
|
+
STOP. DO NOT PROCEED.
|
|
61
|
+
Tell user: "CI checks are failing. Fix them first."
|
|
62
|
+
Show failing checks.
|
|
63
|
+
ABORT.
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
### STEP 3: Show Plan and Get Approval (BLOCKING)
|
|
69
|
+
|
|
70
|
+
Show the user:
|
|
71
|
+
```
|
|
72
|
+
## Merge Plan
|
|
73
|
+
|
|
74
|
+
PR: #{prNumber} - {title}
|
|
75
|
+
Branch: {branch} → main
|
|
76
|
+
Strategy: squash
|
|
77
|
+
|
|
78
|
+
Will do:
|
|
79
|
+
1. Merge PR with squash
|
|
80
|
+
2. Delete feature branch
|
|
81
|
+
3. Update local main
|
|
82
|
+
|
|
83
|
+
Proceed? (yes/no)
|
|
9
84
|
```
|
|
10
85
|
|
|
11
|
-
|
|
12
|
-
|
|
86
|
+
**⛔ WAIT for explicit approval. Do not assume.**
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### STEP 4: Execute Merge
|
|
13
91
|
|
|
14
92
|
```bash
|
|
15
|
-
gh pr
|
|
93
|
+
gh pr merge {prNumber} --squash --delete-branch
|
|
16
94
|
```
|
|
17
95
|
|
|
18
|
-
|
|
19
|
-
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
### STEP 5: Update Local
|
|
20
99
|
|
|
21
100
|
```bash
|
|
22
|
-
|
|
23
|
-
git
|
|
101
|
+
git checkout main
|
|
102
|
+
git pull origin main
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
### STEP 6: Update Task State
|
|
108
|
+
|
|
109
|
+
- Set `currentTask.status = "merged"`
|
|
110
|
+
- Set `currentTask.mergedAt = {now}`
|
|
111
|
+
- Clear PR reference
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### STEP 7: Update Linear (if applicable)
|
|
116
|
+
|
|
117
|
+
IF `currentTask.linearId`:
|
|
24
118
|
```
|
|
119
|
+
Update Linear issue status to "Done" or "Merged"
|
|
120
|
+
Add comment: "PR #{prNumber} merged"
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
25
124
|
|
|
26
|
-
|
|
125
|
+
## Output Format
|
|
27
126
|
|
|
28
|
-
**Output**:
|
|
29
127
|
```
|
|
30
|
-
✅
|
|
128
|
+
✅ Merged: {title}
|
|
31
129
|
|
|
32
130
|
PR: #{prNumber}
|
|
33
131
|
Strategy: squash
|
|
132
|
+
Branch: {branch} (deleted)
|
|
34
133
|
|
|
35
134
|
Next:
|
|
36
|
-
- Release → `p. ship`
|
|
37
135
|
- New task → `p. task "description"`
|
|
136
|
+
- See backlog → `p. next`
|
|
38
137
|
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## ⛔ VIOLATIONS
|
|
142
|
+
|
|
143
|
+
- ❌ Merging without PR approval
|
|
144
|
+
- ❌ Merging with failing CI
|
|
145
|
+
- ❌ Merging with conflicts
|
|
146
|
+
- ❌ Not waiting for user approval
|