@thiagodiogo/pscode 2.4.0 → 2.6.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.
|
@@ -118,10 +118,35 @@ function getApplyInstructions() {
|
|
|
118
118
|
> - Descrição do PR: use o template definido em \`pr.description.template\`
|
|
119
119
|
> - Ao abrir o PR: \`<"comente o link do PR nesta task" se pr.comments.linkInTask: true, senão omita>\`
|
|
120
120
|
|
|
121
|
-
The agent MUST create the branch with the configured pattern before making any code changes.
|
|
122
121
|
Template variables available: \`{change-name}\` = current change name, \`{type}\` = feat/fix/chore, \`{ticket}\` = ticket ID if available.
|
|
123
122
|
|
|
124
|
-
**
|
|
123
|
+
**Detect whether a PR already exists for this change** (it may have been opened in \`/ps:propose\`). Resolve the branch name from \`pr.branch.pattern\`, then check the current branch and its PR:
|
|
124
|
+
\`\`\`bash
|
|
125
|
+
git checkout <branch> # if it already exists; otherwise it will be created below
|
|
126
|
+
gh pr view --json state,url
|
|
127
|
+
\`\`\`
|
|
128
|
+
|
|
129
|
+
- **If a PR already exists** (the \`gh pr view\` returns an open PR): do NOT open another — just continue working on the existing PR. Save its URL as \`prUrl\`.
|
|
130
|
+
|
|
131
|
+
- **If NO PR exists:** open one in **DRAFT automatically, without asking the user**:
|
|
132
|
+
1. Create the branch with the configured \`pr.branch.pattern\` if it does not exist yet (\`git checkout -b <branch>\`) — the agent MUST be on this branch before making any code changes.
|
|
133
|
+
2. Commit any pending planning artifacts: \`git add -A && git commit -m "chore(<change-name>): planning artifacts"\` (skip if nothing to commit).
|
|
134
|
+
3. Push and set upstream: \`git push -u origin <branch>\`.
|
|
135
|
+
4. Open the PR in DRAFT, deriving the title from \`pr.title.template\` and the body from \`pr.description.template\`:
|
|
136
|
+
\`gh pr create --draft --title "<resolved title>" --body "<resolved description>"\`.
|
|
137
|
+
5. Capture the PR URL as \`prUrl\`.
|
|
138
|
+
|
|
139
|
+
**Comentário do link no tracker:** after opening a PR (or detecting an existing one just opened), if \`pr.comments.linkInTask: true\` and a Trello \`cardId\` was saved in Step 2, comment the PR link on the card:
|
|
140
|
+
\`\`\`tool
|
|
141
|
+
mcp__claude_ai_Trello_Custom__add_comment
|
|
142
|
+
card_id: "<cardId>"
|
|
143
|
+
text: |
|
|
144
|
+
🔀 Pull Request (DRAFT): <prUrl>
|
|
145
|
+
\`\`\`
|
|
146
|
+
|
|
147
|
+
**Tratamento de falha (não-bloqueante):** if \`gh\` or \`git\` fails — \`gh\` not installed, not authenticated, or no GitHub remote — **do NOT block**: state what failed and how to fix it (e.g., \`gh auth login\`), ask whether the user wants the agent to resolve it in parallel, and **continue the implementation regardless**. The branch and local commits are preserved.
|
|
148
|
+
|
|
149
|
+
**If \`pscode/config.yaml\` does not exist, or \`pr.enabled: false\`, or file not found:** continue normally without any PR instructions — no branch, no PR.
|
|
125
150
|
|
|
126
151
|
6. **Show current progress**
|
|
127
152
|
|
|
@@ -44,9 +44,8 @@ function getArchiveInstructions() {
|
|
|
44
44
|
If status reports \`actionContext.mode: "workspace-planning"\`, explain that workspace archive is not supported in this slice and STOP.
|
|
45
45
|
|
|
46
46
|
**If any artifacts are not \`done\`:**
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
- Proceed if user confirms
|
|
47
|
+
- Record a warning listing the incomplete artifacts (to surface in the final summary)
|
|
48
|
+
- Proceed automatically — do NOT use \`AskUserQuestion\` and do NOT block on this
|
|
50
49
|
|
|
51
50
|
3. **Check task completion status**
|
|
52
51
|
|
|
@@ -55,26 +54,20 @@ function getArchiveInstructions() {
|
|
|
55
54
|
Count tasks marked with \`- [ ]\` (incomplete) vs \`- [x]\` (complete).
|
|
56
55
|
|
|
57
56
|
**If incomplete tasks found:**
|
|
58
|
-
-
|
|
59
|
-
-
|
|
60
|
-
- Proceed if user confirms
|
|
57
|
+
- Record a warning showing the count of incomplete tasks (to surface in the final summary)
|
|
58
|
+
- Proceed automatically — do NOT use \`AskUserQuestion\` and do NOT block on this
|
|
61
59
|
|
|
62
60
|
**If no tasks file exists:** Proceed without task-related warning.
|
|
63
61
|
|
|
64
|
-
4. **
|
|
62
|
+
4. **Sync delta specs into main specs automatically**
|
|
65
63
|
|
|
66
|
-
Use \`artifactPaths.specs.existingOutputPaths\` from status JSON to check for delta specs. If none exist, proceed
|
|
64
|
+
Use \`artifactPaths.specs.existingOutputPaths\` from status JSON to check for delta specs. If none exist, proceed directly to the archive step — there is nothing to sync.
|
|
67
65
|
|
|
68
|
-
**If delta specs exist:**
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
|
|
73
|
-
**Prompt options:**
|
|
74
|
-
- If changes needed: "Sync now (recommended)", "Archive without syncing"
|
|
75
|
-
- If already synced: "Archive now", "Sync anyway", "Cancel"
|
|
76
|
-
|
|
77
|
-
If user chooses sync, use Task tool (subagent_type: "general-purpose", prompt: "Use Skill tool to invoke pscode-sync-specs for change '<name>'. Delta spec analysis: <include the analyzed delta spec summary>"). Proceed to archive regardless of choice.
|
|
66
|
+
**If delta specs exist, sync them inline yourself (no prompt, no subagent):**
|
|
67
|
+
- For each delta spec, read it and compare it with its corresponding main spec at \`pscode/specs/<capability>/spec.md\` (create the main spec if it does not exist yet).
|
|
68
|
+
- Apply the delta directly to the main spec: \`## ADDED Requirements\` are inserted, \`## MODIFIED Requirements\` replace the matching requirement, \`## REMOVED Requirements\` are deleted, and renames update the heading. Use the **Edit/Write tools** to apply the changes.
|
|
69
|
+
- Do NOT use \`AskUserQuestion\` and do NOT delegate to a \`pscode-sync-specs\` skill (it does not exist) — perform the merge inline.
|
|
70
|
+
- After applying, keep an informative summary of what was synced (adds, modifications, removals, renames) to show in the final summary. This summary is informational only — never blocking.
|
|
78
71
|
|
|
79
72
|
5. **Perform the archive**
|
|
80
73
|
|
|
@@ -144,7 +137,7 @@ function getArchiveInstructions() {
|
|
|
144
137
|
Change: <change-name>
|
|
145
138
|
Schema: <schema-name>
|
|
146
139
|
Arquivada em: <archive-path>
|
|
147
|
-
Specs: <sincronizado / sem delta specs
|
|
140
|
+
Specs: <sincronizado / sem delta specs>
|
|
148
141
|
Tasks: <N>/<N> concluidas
|
|
149
142
|
|
|
150
143
|
Fluxo encerrado. Nenhuma acao adicional necessaria.
|
|
@@ -158,8 +151,8 @@ function getArchiveInstructions() {
|
|
|
158
151
|
- Change name
|
|
159
152
|
- Schema that was used
|
|
160
153
|
- Archive location
|
|
161
|
-
- Spec sync status (synced /
|
|
162
|
-
- Note about any warnings (incomplete artifacts/tasks)
|
|
154
|
+
- Spec sync status (synced / no delta specs)
|
|
155
|
+
- Note about any warnings (incomplete artifacts/tasks that were archived anyway)
|
|
163
156
|
- Trello: mention if card was moved to "Concluído"
|
|
164
157
|
|
|
165
158
|
**Output On Success**
|
|
@@ -184,13 +177,12 @@ All artifacts complete. All tasks complete.
|
|
|
184
177
|
**Change:** <change-name>
|
|
185
178
|
**Schema:** <schema-name>
|
|
186
179
|
**Archived to:** <archive-path>
|
|
187
|
-
**Specs:**
|
|
180
|
+
**Specs:** ✓ Synced to main specs
|
|
188
181
|
**Trello:** Card moved to ✅ Concluído ← only shown if Trello is configured
|
|
189
182
|
|
|
190
183
|
**Warnings:**
|
|
191
184
|
- Archived with 2 incomplete artifacts
|
|
192
185
|
- Archived with 3 incomplete tasks
|
|
193
|
-
- Delta spec sync was skipped
|
|
194
186
|
|
|
195
187
|
Review the archive if this was not intentional.
|
|
196
188
|
\`\`\`
|
|
@@ -212,13 +204,13 @@ Target archive directory already exists.
|
|
|
212
204
|
\`\`\`
|
|
213
205
|
|
|
214
206
|
**Guardrails**
|
|
215
|
-
-
|
|
207
|
+
- Change selection (Step 1) is the ONLY interactive point — prompt for it only when no name is provided
|
|
208
|
+
- Never use \`AskUserQuestion\` to confirm sync or archiving; sync and archive run automatically
|
|
216
209
|
- Use artifact graph (pscode status --json) for completion checking
|
|
217
|
-
- Don't block archive on warnings —
|
|
210
|
+
- Don't block archive on warnings — record them and surface in the final summary
|
|
218
211
|
- Preserve .pscode.yaml when moving to archive (it moves with the directory)
|
|
219
212
|
- Show clear summary of what happened
|
|
220
|
-
- If
|
|
221
|
-
- If delta specs exist, always run the sync assessment and show the combined summary before prompting
|
|
213
|
+
- If delta specs exist, sync them inline yourself (agent-driven merge into main specs) — there is no \`pscode-sync-specs\` skill
|
|
222
214
|
- If Trello tools fail, continue normally — Trello is auxiliary, not blocking
|
|
223
215
|
- All content written to Trello must be in Portuguese
|
|
224
216
|
`;
|
|
@@ -64,12 +64,52 @@ When ready to implement, run /ps:apply
|
|
|
64
64
|
|
|
65
65
|
Os artefatos gerados a partir do Passo 2 SHALL refletir esse entendimento refinado.
|
|
66
66
|
|
|
67
|
+
1c. **PR Integration — abrir PR draft no início (opcional)**
|
|
68
|
+
|
|
69
|
+
Use the **Read tool** (NOT a shell command) to read \`pscode/config.yaml\` from the current working directory.
|
|
70
|
+
If the Read tool returns an error (file not found), or \`pr.enabled\` is not \`true\`, **skip this step entirely** — no PR, no branch, no checkpoint commits — and continue to Step 2. Opening the PR is then left to \`/ps:apply\`. Set \`PR_OPENED = false\`.
|
|
71
|
+
|
|
72
|
+
**If \`pscode/config.yaml\` exists and \`pr.enabled: true\`:**
|
|
73
|
+
|
|
74
|
+
Ask **once**, using the **AskUserQuestion tool**, whether to open the draft PR now:
|
|
75
|
+
> "Quer abrir o Pull Request em DRAFT agora? O PR nasce em draft e cresce junto com o refinamento."
|
|
76
|
+
> - ✅ Sim, abrir o PR draft agora (Recomendada)
|
|
77
|
+
> - ❌ Não, deixar para o apply
|
|
78
|
+
|
|
79
|
+
**If the user declines (Não):** continue the normal flow from Step 2 without any PR steps. Do NOT create a branch or commit automatically. The PR will be opened later by \`/ps:apply\`. Set \`PR_OPENED = false\`.
|
|
80
|
+
|
|
81
|
+
**If the user accepts (Sim):** proceed **without asking for any further authorization**:
|
|
82
|
+
1. Resolve the branch name from \`pr.branch.pattern\`, substituting \`{change-name}\` with the change name, \`{type}\` with feat/fix/chore (infer from the change; default \`feat\`), and \`{ticket}\` with the ticket ID if available.
|
|
83
|
+
2. Create and switch to the branch: \`git checkout -b <branch>\`.
|
|
84
|
+
3. Create the change scaffold (this is Step 2): \`pscode new change "<name>"\`.
|
|
85
|
+
4. Stage and commit the scaffold: \`git add -A && git commit -m "chore(<name>): scaffold change"\`.
|
|
86
|
+
5. Push and set upstream: \`git push -u origin <branch>\`.
|
|
87
|
+
6. Open the PR in **DRAFT**, deriving the title from \`pr.title.template\` and the body from \`pr.description.template\` (substitute \`{change-name}\`/\`{type}\`/\`{ticket}\`):
|
|
88
|
+
\`gh pr create --draft --title "<resolved title>" --body "<resolved description>"\`.
|
|
89
|
+
7. Capture the PR URL from the \`gh\` output, save it as \`prUrl\`, and set \`PR_OPENED = true\`.
|
|
90
|
+
|
|
91
|
+
**Comentário do link no tracker:** after the PR is opened, if \`pr.comments.linkInTask: true\` and a Trello \`cardId\` exists, comment the PR link on the card:
|
|
92
|
+
\`\`\`tool
|
|
93
|
+
mcp__claude_ai_Trello_Custom__add_comment
|
|
94
|
+
card_id: "<cardId>"
|
|
95
|
+
text: |
|
|
96
|
+
🔀 Pull Request (DRAFT) aberto: <prUrl>
|
|
97
|
+
\`\`\`
|
|
98
|
+
The \`cardId\` is resolved in Step 3 — if it is not available yet when the PR is opened, post this comment right after Step 3 instead.
|
|
99
|
+
|
|
100
|
+
**Tratamento de falha (não-bloqueante):** if \`gh\` or \`git\` fails — \`gh\` not installed, not authenticated, or no GitHub remote — **do NOT block**:
|
|
101
|
+
- Clearly state what failed and how to fix it (e.g., "instale o \`gh\` CLI", "rode \`gh auth login\`", "configure um remote GitHub").
|
|
102
|
+
- Ask whether the user wants the agent to resolve it in parallel (e.g., run \`gh auth login\`).
|
|
103
|
+
- **Continue the propose flow regardless.** Any branch already created and local commits are preserved; set \`PR_OPENED = true\` only if the PR was actually opened.
|
|
104
|
+
|
|
67
105
|
2. **Create the change directory**
|
|
68
106
|
\`\`\`bash
|
|
69
107
|
pscode new change "<name>"
|
|
70
108
|
\`\`\`
|
|
71
109
|
This creates a scaffolded change in the planning home resolved by the CLI with \`.pscode.yaml\`.
|
|
72
110
|
|
|
111
|
+
**If you already created the change scaffold in Step 1c** (PR accepted), skip this step — the change directory already exists.
|
|
112
|
+
|
|
73
113
|
3. **Trello Integration (optional)**
|
|
74
114
|
|
|
75
115
|
Use the **Read tool** (NOT a shell command) to read \`pscode/trello.yaml\` from the current working directory.
|
|
@@ -190,6 +230,14 @@ When ready to implement, run /ps:apply
|
|
|
190
230
|
pscode status --change "<name>"
|
|
191
231
|
\`\`\`
|
|
192
232
|
|
|
233
|
+
7. **Checkpoint commit — após gerar os artefatos (only if \`PR_OPENED = true\`)**
|
|
234
|
+
|
|
235
|
+
If a draft PR was opened in Step 1c, commit and push the generated artifacts as a checkpoint so the PR reflects the refined plan:
|
|
236
|
+
\`\`\`bash
|
|
237
|
+
git add -A && git commit -m "docs(<name>): add planning artifacts" && git push
|
|
238
|
+
\`\`\`
|
|
239
|
+
If \`PR_OPENED = false\`, skip — no automatic commits. Failures here are non-blocking (same handling as Step 1c).
|
|
240
|
+
|
|
193
241
|
---
|
|
194
242
|
|
|
195
243
|
## Refinement Validation Loop
|
|
@@ -334,7 +382,14 @@ ${applyNextStep}
|
|
|
334
382
|
- Changes to technical approach → update \`design.md\`
|
|
335
383
|
- Changes to tasks → update \`tasks.md\`
|
|
336
384
|
|
|
337
|
-
3. **
|
|
385
|
+
3. **Checkpoint commit — após o ajuste (only if \`PR_OPENED = true\`)**:
|
|
386
|
+
If a draft PR was opened in Step 1c, commit and push the adjusted artifacts as a checkpoint:
|
|
387
|
+
\`\`\`bash
|
|
388
|
+
git add -A && git commit -m "docs(<name>): refine plan" && git push
|
|
389
|
+
\`\`\`
|
|
390
|
+
If \`PR_OPENED = false\`, skip. Failures here are non-blocking (same handling as Step 1c).
|
|
391
|
+
|
|
392
|
+
4. **Go back to Step R1** and show the updated refinement summary, then **re-run Step R1b**
|
|
338
393
|
so the Trello card description and comment reflect the adjusted plan before asking again.
|
|
339
394
|
Keep looping until the user approves or cancels.
|
|
340
395
|
|