prjct-cli 0.22.0 → 0.25.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 +76 -0
- package/CLAUDE.md +14 -7
- package/core/commands/command-data.ts +21 -8
- package/core/commands/setup.ts +52 -17
- package/core/infrastructure/setup.ts +101 -0
- package/core/schemas/project.ts +1 -0
- package/package.json +1 -1
- package/templates/commands/bug.md +79 -3
- package/templates/commands/feature.md +28 -677
- package/templates/commands/git.md +82 -6
- package/templates/commands/now.md +32 -119
- package/templates/commands/ship.md +265 -39
- package/templates/commands/sync.md +41 -3
- package/templates/commands/task.md +686 -0
- package/templates/global/CLAUDE.md +10 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,81 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.25.0] - 2025-12-30
|
|
4
|
+
|
|
5
|
+
### Maintenance Release
|
|
6
|
+
|
|
7
|
+
Version bump for release preparation.
|
|
8
|
+
|
|
9
|
+
## [0.24.0] - 2025-12-28
|
|
10
|
+
|
|
11
|
+
### Breaking Change: Unified Task Command
|
|
12
|
+
|
|
13
|
+
Consolidated `/p:now`, `/p:feature`, and `/p:work` into a single `/p:task` command with agentic classification.
|
|
14
|
+
|
|
15
|
+
**New Command: `/p:task`**
|
|
16
|
+
- Unified entry point for all work
|
|
17
|
+
- Agentic type classification (not keyword-based)
|
|
18
|
+
- 7-phase development workflow for all task types
|
|
19
|
+
- Git branch management with type-based prefixes
|
|
20
|
+
|
|
21
|
+
**Agentic Classification:**
|
|
22
|
+
The agent analyzes task descriptions holistically to determine type:
|
|
23
|
+
- `feature` - Adds new functionality
|
|
24
|
+
- `bug` - Something broken or incorrect
|
|
25
|
+
- `improvement` - Enhances existing functionality
|
|
26
|
+
- `refactor` - Reorganizes without behavior change
|
|
27
|
+
- `chore` - Maintenance, deps, docs
|
|
28
|
+
|
|
29
|
+
**Migration:**
|
|
30
|
+
```
|
|
31
|
+
/p:now "fix login bug" → /p:task "fix login bug"
|
|
32
|
+
/p:feature "add dark mode" → /p:task "add dark mode"
|
|
33
|
+
/p:work "update docs" → /p:task "update docs"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Deprecated Commands:**
|
|
37
|
+
- `/p:now` - Redirects to `/p:task`
|
|
38
|
+
- `/p:feature` - Redirects to `/p:task`
|
|
39
|
+
- `/p:work` - Redirects to `/p:task`
|
|
40
|
+
|
|
41
|
+
**Files Changed:**
|
|
42
|
+
- `templates/commands/task.md` - New unified template
|
|
43
|
+
- `templates/commands/now.md` - Deprecated, redirects
|
|
44
|
+
- `templates/commands/feature.md` - Deprecated, redirects
|
|
45
|
+
- `core/commands/command-data.ts` - Registry updates
|
|
46
|
+
- `templates/global/CLAUDE.md` - Updated workflow docs
|
|
47
|
+
- `CLAUDE.md` - Updated project docs
|
|
48
|
+
|
|
49
|
+
## [0.23.0] - 2025-12-28
|
|
50
|
+
|
|
51
|
+
### Feature: Branch + PR Workflow
|
|
52
|
+
|
|
53
|
+
Integrated git branch management and PR-based shipping workflow.
|
|
54
|
+
|
|
55
|
+
**Branch Management:**
|
|
56
|
+
- `/p:now` auto-creates feature branches when on main/master
|
|
57
|
+
- `/p:bug` auto-creates bug branches with proper naming
|
|
58
|
+
- Handles uncommitted changes (stash/commit/abort prompts)
|
|
59
|
+
- Tracks branch info in state.json
|
|
60
|
+
|
|
61
|
+
**Protected Branch Validation:**
|
|
62
|
+
- `/p:git` blocks commits/pushes to main/master
|
|
63
|
+
- Validates current branch matches expected task branch
|
|
64
|
+
- Clear error messages with recovery instructions
|
|
65
|
+
|
|
66
|
+
**PR-Based Shipping (`/p:ship`):**
|
|
67
|
+
- Creates PR via `gh` CLI instead of direct push
|
|
68
|
+
- Generates PR description with quality metrics
|
|
69
|
+
- Waits for CI checks (up to 10 min)
|
|
70
|
+
- Records CI status (passed/failed/timeout)
|
|
71
|
+
- Supports `--draft` flag for WIP PRs
|
|
72
|
+
|
|
73
|
+
**Template Updates:**
|
|
74
|
+
- `templates/commands/bug.md` - Branch creation + stashing
|
|
75
|
+
- `templates/commands/git.md` - Protected branch checks
|
|
76
|
+
- `templates/commands/now.md` - Feature branch workflow
|
|
77
|
+
- `templates/commands/ship.md` - Full PR lifecycle
|
|
78
|
+
|
|
3
79
|
## [0.20.1] - 2025-12-26
|
|
4
80
|
|
|
5
81
|
### Refactor: Type Consolidation
|
package/CLAUDE.md
CHANGED
|
@@ -86,19 +86,18 @@ User Action → Storage (JSON) → Context (MD) → Sync Events
|
|
|
86
86
|
## Core Workflow
|
|
87
87
|
|
|
88
88
|
```
|
|
89
|
-
/p:sync → /p:
|
|
89
|
+
/p:sync → /p:task "description" → [work] → /p:done → /p:ship
|
|
90
90
|
```
|
|
91
91
|
|
|
92
92
|
## Commands
|
|
93
93
|
|
|
94
|
-
### Core Commands
|
|
94
|
+
### Core Commands
|
|
95
95
|
| Command | Purpose |
|
|
96
96
|
|---------|---------|
|
|
97
97
|
| `/p:init` | Initialize project with deep analysis |
|
|
98
98
|
| `/p:idea` | Transform ideas into architectures |
|
|
99
|
-
| `/p:
|
|
99
|
+
| `/p:task` | Start task with agentic classification + 7-phase workflow |
|
|
100
100
|
| `/p:spec` | Create detailed specifications |
|
|
101
|
-
| `/p:now [task]` | Start/show current task |
|
|
102
101
|
| `/p:pause` | Pause active task |
|
|
103
102
|
| `/p:resume` | Resume paused task |
|
|
104
103
|
| `/p:next` | Show priority queue |
|
|
@@ -109,6 +108,13 @@ User Action → Storage (JSON) → Context (MD) → Sync Events
|
|
|
109
108
|
| `/p:sync` | Analyze repo, generate agents |
|
|
110
109
|
| `/p:suggest` | Context-aware recommendations |
|
|
111
110
|
|
|
111
|
+
### Deprecated Commands
|
|
112
|
+
| Command | Migration |
|
|
113
|
+
|---------|-----------|
|
|
114
|
+
| `/p:now` | Use `/p:task` instead |
|
|
115
|
+
| `/p:feature` | Use `/p:task` instead |
|
|
116
|
+
| `/p:work` | Use `/p:task` instead |
|
|
117
|
+
|
|
112
118
|
### Optional Commands
|
|
113
119
|
| Command | Purpose |
|
|
114
120
|
|---------|---------|
|
|
@@ -123,9 +129,10 @@ User Action → Storage (JSON) → Context (MD) → Sync Events
|
|
|
123
129
|
|
|
124
130
|
Messages starting with `p.` trigger commands:
|
|
125
131
|
```
|
|
126
|
-
p.
|
|
127
|
-
p.
|
|
128
|
-
p.
|
|
132
|
+
p. task add auth → /p:task "add auth"
|
|
133
|
+
p. task fix login → /p:task "fix login"
|
|
134
|
+
p. done → /p:done
|
|
135
|
+
p. ship login → /p:ship "login"
|
|
129
136
|
```
|
|
130
137
|
|
|
131
138
|
## Template-Driven Execution
|
|
@@ -51,16 +51,27 @@ export const COMMANDS: CommandMeta[] = [
|
|
|
51
51
|
requiresProject: true,
|
|
52
52
|
features: ['Simple ideas -> Quick capture', 'Complex ideas -> Full architecture'],
|
|
53
53
|
},
|
|
54
|
+
{
|
|
55
|
+
name: 'task',
|
|
56
|
+
group: 'core',
|
|
57
|
+
description: 'Start task with agentic classification and 7-phase workflow',
|
|
58
|
+
usage: { claude: '/p:task "<description>"', terminal: 'prjct task "<description>"' },
|
|
59
|
+
params: '<description>',
|
|
60
|
+
implemented: true,
|
|
61
|
+
hasTemplate: true,
|
|
62
|
+
requiresProject: true,
|
|
63
|
+
features: ['Agentic type classification', '7-phase workflow', 'Git branch management', 'Task breakdown'],
|
|
64
|
+
},
|
|
54
65
|
{
|
|
55
66
|
name: 'feature',
|
|
56
67
|
group: 'core',
|
|
57
|
-
description: '
|
|
58
|
-
usage: { claude: '/p:
|
|
68
|
+
description: 'DEPRECATED - Use /p:task instead',
|
|
69
|
+
usage: { claude: '/p:task "<description>"', terminal: 'prjct task "<description>"' },
|
|
59
70
|
params: '<description>',
|
|
60
71
|
implemented: true,
|
|
61
72
|
hasTemplate: true,
|
|
62
73
|
requiresProject: true,
|
|
63
|
-
|
|
74
|
+
deprecated: true,
|
|
64
75
|
},
|
|
65
76
|
{
|
|
66
77
|
name: 'spec',
|
|
@@ -75,22 +86,24 @@ export const COMMANDS: CommandMeta[] = [
|
|
|
75
86
|
{
|
|
76
87
|
name: 'now',
|
|
77
88
|
group: 'core',
|
|
78
|
-
description: '
|
|
79
|
-
usage: { claude: '/p:
|
|
80
|
-
params: '[task]
|
|
89
|
+
description: 'DEPRECATED - Use /p:task instead',
|
|
90
|
+
usage: { claude: '/p:task "<description>"', terminal: 'prjct task "<description>"' },
|
|
91
|
+
params: '[task]',
|
|
81
92
|
implemented: true,
|
|
82
93
|
hasTemplate: true,
|
|
83
94
|
requiresProject: true,
|
|
95
|
+
deprecated: true,
|
|
84
96
|
},
|
|
85
97
|
{
|
|
86
98
|
name: 'work',
|
|
87
99
|
group: 'core',
|
|
88
|
-
description: '
|
|
89
|
-
usage: { claude: '/p:
|
|
100
|
+
description: 'DEPRECATED - Use /p:task instead',
|
|
101
|
+
usage: { claude: '/p:task "<description>"', terminal: 'prjct task "<description>"' },
|
|
90
102
|
params: '[task]',
|
|
91
103
|
implemented: true,
|
|
92
104
|
hasTemplate: true,
|
|
93
105
|
requiresProject: true,
|
|
106
|
+
deprecated: true,
|
|
94
107
|
},
|
|
95
108
|
{
|
|
96
109
|
name: 'pause',
|
package/core/commands/setup.ts
CHANGED
|
@@ -130,28 +130,63 @@ export class SetupCommands extends PrjctCommandsBase {
|
|
|
130
130
|
const settingsPath = path.join(claudeDir, 'settings.json')
|
|
131
131
|
const statusLinePath = path.join(claudeDir, 'prjct-statusline.sh')
|
|
132
132
|
|
|
133
|
+
// Version is embedded at install time
|
|
133
134
|
const scriptContent = `#!/bin/bash
|
|
134
135
|
# prjct Status Line for Claude Code
|
|
135
|
-
# Shows
|
|
136
|
+
# Shows version update notifications and current task
|
|
137
|
+
|
|
138
|
+
# Current CLI version (embedded at install time)
|
|
139
|
+
CLI_VERSION="${VERSION}"
|
|
136
140
|
|
|
137
141
|
# Read JSON context from stdin (provided by Claude Code)
|
|
138
142
|
read -r json
|
|
139
143
|
|
|
140
|
-
#
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
#
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
#
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
if [ -
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
144
|
+
# Extract cwd from JSON
|
|
145
|
+
CWD=$(echo "$json" | grep -o '"cwd"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/.*"cwd"[[:space:]]*:[[:space:]]*"\\([^"]*\\)".*/\\1/')
|
|
146
|
+
|
|
147
|
+
# Check if this is a prjct project
|
|
148
|
+
CONFIG="$CWD/.prjct/prjct.config.json"
|
|
149
|
+
if [[ -f "$CONFIG" ]]; then
|
|
150
|
+
# Extract projectId
|
|
151
|
+
PROJECT_ID=$(grep -o '"projectId"[[:space:]]*:[[:space:]]*"[^"]*"' "$CONFIG" | sed 's/.*"projectId"[[:space:]]*:[[:space:]]*"\\([^"]*\\)".*/\\1/')
|
|
152
|
+
|
|
153
|
+
if [[ -n "$PROJECT_ID" ]]; then
|
|
154
|
+
PROJECT_JSON="$HOME/.prjct-cli/projects/$PROJECT_ID/project.json"
|
|
155
|
+
|
|
156
|
+
# Check version mismatch
|
|
157
|
+
if [[ -f "$PROJECT_JSON" ]]; then
|
|
158
|
+
PROJECT_VERSION=$(grep -o '"cliVersion"[[:space:]]*:[[:space:]]*"[^"]*"' "$PROJECT_JSON" | sed 's/.*"cliVersion"[[:space:]]*:[[:space:]]*"\\([^"]*\\)".*/\\1/')
|
|
159
|
+
|
|
160
|
+
# If no cliVersion or different version, show update notice
|
|
161
|
+
if [[ -z "$PROJECT_VERSION" ]] || [[ "$PROJECT_VERSION" != "$CLI_VERSION" ]]; then
|
|
162
|
+
echo "⚠️ prjct v$CLI_VERSION available! Run /p:sync"
|
|
163
|
+
exit 0
|
|
164
|
+
fi
|
|
165
|
+
else
|
|
166
|
+
# No project.json means project needs sync
|
|
167
|
+
echo "⚠️ prjct v$CLI_VERSION available! Run /p:sync"
|
|
168
|
+
exit 0
|
|
169
|
+
fi
|
|
170
|
+
|
|
171
|
+
# Show current task if exists
|
|
172
|
+
STATE="$HOME/.prjct-cli/projects/$PROJECT_ID/storage/state.json"
|
|
173
|
+
if [[ -f "$STATE" ]]; then
|
|
174
|
+
TASK=$(grep -o '"description"[[:space:]]*:[[:space:]]*"[^"]*"' "$STATE" | head -1 | sed 's/.*"description"[[:space:]]*:[[:space:]]*"\\([^"]*\\)".*/\\1/')
|
|
175
|
+
STATUS=$(grep -o '"status"[[:space:]]*:[[:space:]]*"[^"]*"' "$STATE" | head -1 | sed 's/.*"status"[[:space:]]*:[[:space:]]*"\\([^"]*\\)".*/\\1/')
|
|
176
|
+
|
|
177
|
+
if [[ -n "$TASK" ]] && [[ "$STATUS" == "active" ]]; then
|
|
178
|
+
# Truncate task to 40 chars
|
|
179
|
+
TASK_SHORT="\${TASK:0:40}"
|
|
180
|
+
[[ \${#TASK} -gt 40 ]] && TASK_SHORT="$TASK_SHORT..."
|
|
181
|
+
echo "🎯 $TASK_SHORT"
|
|
182
|
+
exit 0
|
|
183
|
+
fi
|
|
184
|
+
fi
|
|
185
|
+
fi
|
|
154
186
|
fi
|
|
187
|
+
|
|
188
|
+
# Default: show prjct branding
|
|
189
|
+
echo "⚡ prjct"
|
|
155
190
|
`
|
|
156
191
|
fs.writeFileSync(statusLinePath, scriptContent, { mode: 0o755 })
|
|
157
192
|
|
|
@@ -204,8 +239,8 @@ fi
|
|
|
204
239
|
console.log(` ${chalk.bold('1.')} Initialize your project:`)
|
|
205
240
|
console.log(` ${chalk.green('cd your-project && prjct init')}`)
|
|
206
241
|
console.log('')
|
|
207
|
-
console.log(` ${chalk.bold('2.')}
|
|
208
|
-
console.log(` ${chalk.green('prjct
|
|
242
|
+
console.log(` ${chalk.bold('2.')} Start your first task:`)
|
|
243
|
+
console.log(` ${chalk.green('prjct task "build auth"')}`)
|
|
209
244
|
console.log('')
|
|
210
245
|
console.log(` ${chalk.bold('3.')} Ship & celebrate:`)
|
|
211
246
|
console.log(` ${chalk.green('prjct ship "user login"')}`)
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { execSync } from 'child_process'
|
|
16
|
+
import fs from 'fs'
|
|
17
|
+
import path from 'path'
|
|
18
|
+
import os from 'os'
|
|
16
19
|
import installer from './command-installer'
|
|
17
20
|
import editorsConfig from './editors-config'
|
|
18
21
|
import { VERSION } from '../utils/version'
|
|
@@ -106,6 +109,9 @@ export async function run(): Promise<SetupResults> {
|
|
|
106
109
|
|
|
107
110
|
// Step 4b: Install documentation files
|
|
108
111
|
await installer.installDocs()
|
|
112
|
+
|
|
113
|
+
// Step 4c: Install status line with version check
|
|
114
|
+
await installStatusLine()
|
|
109
115
|
}
|
|
110
116
|
|
|
111
117
|
// Step 5: Save version in editors-config
|
|
@@ -120,6 +126,101 @@ export async function run(): Promise<SetupResults> {
|
|
|
120
126
|
// Default export for CommonJS require
|
|
121
127
|
export default { run }
|
|
122
128
|
|
|
129
|
+
/**
|
|
130
|
+
* Install status line script with version check
|
|
131
|
+
*/
|
|
132
|
+
async function installStatusLine(): Promise<void> {
|
|
133
|
+
try {
|
|
134
|
+
const claudeDir = path.join(os.homedir(), '.claude')
|
|
135
|
+
const settingsPath = path.join(claudeDir, 'settings.json')
|
|
136
|
+
const statusLinePath = path.join(claudeDir, 'prjct-statusline.sh')
|
|
137
|
+
|
|
138
|
+
// Ensure .claude directory exists
|
|
139
|
+
if (!fs.existsSync(claudeDir)) {
|
|
140
|
+
fs.mkdirSync(claudeDir, { recursive: true })
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Version is embedded at install time
|
|
144
|
+
const scriptContent = `#!/bin/bash
|
|
145
|
+
# prjct Status Line for Claude Code
|
|
146
|
+
# Shows version update notifications and current task
|
|
147
|
+
|
|
148
|
+
# Current CLI version (embedded at install time)
|
|
149
|
+
CLI_VERSION="${VERSION}"
|
|
150
|
+
|
|
151
|
+
# Read JSON context from stdin (provided by Claude Code)
|
|
152
|
+
read -r json
|
|
153
|
+
|
|
154
|
+
# Extract cwd from JSON
|
|
155
|
+
CWD=$(echo "$json" | grep -o '"cwd"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/.*"cwd"[[:space:]]*:[[:space:]]*"\\([^"]*\\)".*/\\1/')
|
|
156
|
+
|
|
157
|
+
# Check if this is a prjct project
|
|
158
|
+
CONFIG="$CWD/.prjct/prjct.config.json"
|
|
159
|
+
if [[ -f "$CONFIG" ]]; then
|
|
160
|
+
# Extract projectId
|
|
161
|
+
PROJECT_ID=$(grep -o '"projectId"[[:space:]]*:[[:space:]]*"[^"]*"' "$CONFIG" | sed 's/.*"projectId"[[:space:]]*:[[:space:]]*"\\([^"]*\\)".*/\\1/')
|
|
162
|
+
|
|
163
|
+
if [[ -n "$PROJECT_ID" ]]; then
|
|
164
|
+
PROJECT_JSON="$HOME/.prjct-cli/projects/$PROJECT_ID/project.json"
|
|
165
|
+
|
|
166
|
+
# Check version mismatch
|
|
167
|
+
if [[ -f "$PROJECT_JSON" ]]; then
|
|
168
|
+
PROJECT_VERSION=$(grep -o '"cliVersion"[[:space:]]*:[[:space:]]*"[^"]*"' "$PROJECT_JSON" | sed 's/.*"cliVersion"[[:space:]]*:[[:space:]]*"\\([^"]*\\)".*/\\1/')
|
|
169
|
+
|
|
170
|
+
# If no cliVersion or different version, show update notice
|
|
171
|
+
if [[ -z "$PROJECT_VERSION" ]] || [[ "$PROJECT_VERSION" != "$CLI_VERSION" ]]; then
|
|
172
|
+
echo "⚠️ prjct v$CLI_VERSION available! Run /p:sync"
|
|
173
|
+
exit 0
|
|
174
|
+
fi
|
|
175
|
+
else
|
|
176
|
+
# No project.json means project needs sync
|
|
177
|
+
echo "⚠️ prjct v$CLI_VERSION available! Run /p:sync"
|
|
178
|
+
exit 0
|
|
179
|
+
fi
|
|
180
|
+
|
|
181
|
+
# Show current task if exists
|
|
182
|
+
STATE="$HOME/.prjct-cli/projects/$PROJECT_ID/storage/state.json"
|
|
183
|
+
if [[ -f "$STATE" ]]; then
|
|
184
|
+
TASK=$(grep -o '"description"[[:space:]]*:[[:space:]]*"[^"]*"' "$STATE" | head -1 | sed 's/.*"description"[[:space:]]*:[[:space:]]*"\\([^"]*\\)".*/\\1/')
|
|
185
|
+
STATUS=$(grep -o '"status"[[:space:]]*:[[:space:]]*"[^"]*"' "$STATE" | head -1 | sed 's/.*"status"[[:space:]]*:[[:space:]]*"\\([^"]*\\)".*/\\1/')
|
|
186
|
+
|
|
187
|
+
if [[ -n "$TASK" ]] && [[ "$STATUS" == "active" ]]; then
|
|
188
|
+
# Truncate task to 40 chars
|
|
189
|
+
TASK_SHORT="\${TASK:0:40}"
|
|
190
|
+
[[ \${#TASK} -gt 40 ]] && TASK_SHORT="$TASK_SHORT..."
|
|
191
|
+
echo "🎯 $TASK_SHORT"
|
|
192
|
+
exit 0
|
|
193
|
+
fi
|
|
194
|
+
fi
|
|
195
|
+
fi
|
|
196
|
+
fi
|
|
197
|
+
|
|
198
|
+
# Default: show prjct branding
|
|
199
|
+
echo "⚡ prjct"
|
|
200
|
+
`
|
|
201
|
+
fs.writeFileSync(statusLinePath, scriptContent, { mode: 0o755 })
|
|
202
|
+
|
|
203
|
+
// Update settings.json to use this status line
|
|
204
|
+
let settings: Record<string, unknown> = {}
|
|
205
|
+
if (fs.existsSync(settingsPath)) {
|
|
206
|
+
try {
|
|
207
|
+
settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'))
|
|
208
|
+
} catch {
|
|
209
|
+
// Invalid JSON, start fresh
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
settings.statusLine = {
|
|
214
|
+
type: 'command',
|
|
215
|
+
command: statusLinePath
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2))
|
|
219
|
+
} catch {
|
|
220
|
+
// Silently fail - status line is optional
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
123
224
|
/**
|
|
124
225
|
* Show setup results
|
|
125
226
|
*/
|
package/core/schemas/project.ts
CHANGED
|
@@ -19,6 +19,7 @@ export const ProjectItemSchema = z.object({
|
|
|
19
19
|
repoPath: z.string(),
|
|
20
20
|
description: z.string().optional(),
|
|
21
21
|
version: z.string().optional(),
|
|
22
|
+
cliVersion: z.string().optional(), // prjct-cli version used to sync
|
|
22
23
|
techStack: z.array(z.string()),
|
|
23
24
|
fileCount: z.number(),
|
|
24
25
|
commitCount: z.number(),
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
allowed-tools: [Read, Write, Bash, Task, Glob]
|
|
2
|
+
allowed-tools: [Read, Write, Bash, Task, Glob, AskUserQuestion]
|
|
3
3
|
description: 'Report bug with auto-priority and auto-start'
|
|
4
4
|
architecture: 'Write-Through (JSON → MD → Events)'
|
|
5
5
|
storage-layer: true
|
|
@@ -129,6 +129,73 @@ GENERATE: {sessionId} = UUID v4
|
|
|
129
129
|
bun -e "console.log(crypto.randomUUID())" 2>/dev/null || node -e "console.log(require('crypto').randomUUID())"
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
+
### Step 5.5: Create Bug Branch
|
|
133
|
+
|
|
134
|
+
#### Check Current Branch
|
|
135
|
+
BASH: `git branch --show-current`
|
|
136
|
+
SET: {currentBranch} = result
|
|
137
|
+
|
|
138
|
+
IF {currentBranch} == "main" OR {currentBranch} == "master":
|
|
139
|
+
OUTPUT: "Creating bug branch..."
|
|
140
|
+
|
|
141
|
+
#### Handle Uncommitted Changes
|
|
142
|
+
BASH: `git status --porcelain`
|
|
143
|
+
SET: {hasChanges} = (result not empty)
|
|
144
|
+
|
|
145
|
+
IF {hasChanges}:
|
|
146
|
+
IF {severity} == "critical" OR {severity} == "high":
|
|
147
|
+
# Auto-stash for urgent bugs
|
|
148
|
+
BASH: `git stash push -m "prjct: stashed for urgent bug fix"`
|
|
149
|
+
SET: {stashedChanges} = true
|
|
150
|
+
OUTPUT: "Stashed changes for urgent bug fix"
|
|
151
|
+
ELSE:
|
|
152
|
+
USE AskUserQuestion:
|
|
153
|
+
```
|
|
154
|
+
question: "Uncommitted changes detected. How to proceed?"
|
|
155
|
+
header: "Git Changes"
|
|
156
|
+
options:
|
|
157
|
+
- label: "Stash changes"
|
|
158
|
+
description: "Temporarily save changes, create branch, then continue"
|
|
159
|
+
- label: "Commit first"
|
|
160
|
+
description: "Commit current changes before switching"
|
|
161
|
+
- label: "Abort"
|
|
162
|
+
description: "Cancel and queue bug for later"
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
IF choice == "Stash changes":
|
|
166
|
+
BASH: `git stash push -m "prjct: stashed for {description}"`
|
|
167
|
+
SET: {stashedChanges} = true
|
|
168
|
+
ELSE IF choice == "Commit first":
|
|
169
|
+
OUTPUT: "Commit your changes first, then run /p:bug again"
|
|
170
|
+
STOP
|
|
171
|
+
ELSE:
|
|
172
|
+
SET: {laterFlag} = true
|
|
173
|
+
SET: {autoStarted} = false
|
|
174
|
+
→ Skip to Step 6
|
|
175
|
+
|
|
176
|
+
#### Create Bug Branch
|
|
177
|
+
SET: {bugSlug} = slugify({description})
|
|
178
|
+
LIMIT: {bugSlug} to 50 characters, lowercase, replace spaces with hyphens
|
|
179
|
+
SET: {branchName} = "bug/{bugSlug}"
|
|
180
|
+
|
|
181
|
+
BASH: `git checkout -b {branchName}`
|
|
182
|
+
IF command fails (branch exists):
|
|
183
|
+
BASH: `git checkout {branchName}`
|
|
184
|
+
IF still fails:
|
|
185
|
+
OUTPUT: "Failed to create/checkout branch: {branchName}"
|
|
186
|
+
SET: {laterFlag} = true
|
|
187
|
+
SET: {autoStarted} = false
|
|
188
|
+
→ Skip to Step 6
|
|
189
|
+
|
|
190
|
+
SET: {branchCreated} = true
|
|
191
|
+
SET: {baseBranch} = {currentBranch}
|
|
192
|
+
OUTPUT: "✅ Created branch: {branchName}"
|
|
193
|
+
|
|
194
|
+
ELSE:
|
|
195
|
+
SET: {branchName} = {currentBranch}
|
|
196
|
+
SET: {branchCreated} = false
|
|
197
|
+
SET: {baseBranch} = null
|
|
198
|
+
|
|
132
199
|
### Update state.json
|
|
133
200
|
```json
|
|
134
201
|
{
|
|
@@ -139,7 +206,13 @@ bun -e "console.log(crypto.randomUUID())" 2>/dev/null || node -e "console.log(re
|
|
|
139
206
|
"startedAt": "{now}",
|
|
140
207
|
"sessionId": "{sessionId}",
|
|
141
208
|
"type": "bug",
|
|
142
|
-
"priority": "{severity}"
|
|
209
|
+
"priority": "{severity}",
|
|
210
|
+
"branch": {
|
|
211
|
+
"name": "{branchName}",
|
|
212
|
+
"createdByPrjct": {branchCreated},
|
|
213
|
+
"baseBranch": "{baseBranch}",
|
|
214
|
+
"createdAt": "{now}"
|
|
215
|
+
}
|
|
143
216
|
},
|
|
144
217
|
"previousTask": {existing previousTask if any},
|
|
145
218
|
"lastUpdated": "{now}"
|
|
@@ -156,6 +229,7 @@ WRITE: `{statePath}`
|
|
|
156
229
|
Priority: {severity}
|
|
157
230
|
Started: {now}
|
|
158
231
|
Session: {sessionId}
|
|
232
|
+
Branch: {branchName}
|
|
159
233
|
```
|
|
160
234
|
WRITE: `{nowContextPath}`
|
|
161
235
|
|
|
@@ -221,7 +295,7 @@ ELSE:
|
|
|
221
295
|
```
|
|
222
296
|
🐛 [{severity}] {description}
|
|
223
297
|
|
|
224
|
-
|
|
298
|
+
Branch: {branchName}
|
|
225
299
|
Session: {sessionId}
|
|
226
300
|
|
|
227
301
|
/p:done when fixed
|
|
@@ -312,4 +386,6 @@ Start later: /p:now "🐛 payment not processing"
|
|
|
312
386
|
| Error | Response | Action |
|
|
313
387
|
|-------|----------|--------|
|
|
314
388
|
| No project | "No prjct project" | STOP |
|
|
389
|
+
| On protected branch with changes | Ask/auto-stash for urgent | WAIT |
|
|
390
|
+
| Branch creation fails | Queue bug for later | CONTINUE |
|
|
315
391
|
| Write fails | Log warning | CONTINUE |
|