@thiagodiogo/pscode 2.0.0 → 2.1.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/LICENSE +22 -22
- package/README.md +142 -142
- package/bin/pscode.js +4 -4
- package/dist/commands/feedback.js +4 -4
- package/dist/commands/schema.js +60 -60
- package/dist/core/collections/initiatives/templates.js +57 -57
- package/dist/core/command-generation/adapters/claude.js +8 -8
- package/dist/core/command-generation/adapters/codex.js +6 -6
- package/dist/core/command-generation/adapters/cursor.js +8 -8
- package/dist/core/command-generation/adapters/gemini.js +5 -5
- package/dist/core/command-generation/adapters/github-copilot.js +5 -5
- package/dist/core/completions/generators/bash-generator.js +41 -41
- package/dist/core/completions/generators/fish-generator.js +7 -7
- package/dist/core/completions/generators/powershell-generator.js +29 -29
- package/dist/core/completions/generators/zsh-generator.js +33 -33
- package/dist/core/completions/templates/bash-templates.js +24 -24
- package/dist/core/completions/templates/fish-templates.js +38 -38
- package/dist/core/completions/templates/powershell-templates.js +28 -28
- package/dist/core/completions/templates/zsh-templates.js +39 -39
- package/dist/core/profiles.d.ts +1 -1
- package/dist/core/profiles.js +1 -1
- package/dist/core/templates/workflows/apply-change.js +264 -264
- package/dist/core/templates/workflows/archive-change.js +204 -204
- package/dist/core/templates/workflows/bulk-archive-change.js +472 -472
- package/dist/core/templates/workflows/continue-change.js +214 -214
- package/dist/core/templates/workflows/explore.js +735 -735
- package/dist/core/templates/workflows/feedback.js +97 -97
- package/dist/core/templates/workflows/ff-change.js +180 -180
- package/dist/core/templates/workflows/new-change.js +123 -123
- package/dist/core/templates/workflows/onboard.js +584 -584
- package/dist/core/templates/workflows/propose.js +324 -324
- package/dist/core/templates/workflows/trello-draft.js +194 -194
- package/dist/core/templates/workflows/trello-next-step-comment.d.ts +26 -0
- package/dist/core/templates/workflows/trello-next-step-comment.js +58 -0
- package/dist/core/templates/workflows/trello-setup.js +292 -292
- package/dist/core/templates/workflows/verify-change.js +318 -318
- package/dist/core/workspace/open-surface.js +30 -30
- package/package.json +1 -1
- package/schemas/spec-driven/schema.yaml +153 -153
- package/schemas/spec-driven/templates/design.md +19 -19
- package/schemas/spec-driven/templates/proposal.md +23 -23
- package/schemas/spec-driven/templates/spec.md +8 -8
- package/schemas/spec-driven/templates/tasks.md +9 -9
- package/schemas/workspace-planning/schema.yaml +72 -72
- package/schemas/workspace-planning/templates/design.md +33 -33
- package/schemas/workspace-planning/templates/proposal.md +28 -28
- package/schemas/workspace-planning/templates/spec.md +9 -9
- package/schemas/workspace-planning/templates/tasks.md +15 -15
- package/scripts/postinstall.js +83 -83
|
@@ -18,330 +18,330 @@ export function getPsProposeCommandTemplate() {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
function getProposeInstructions() {
|
|
21
|
-
return `Propose a new change - create the change and generate all artifacts in one step.
|
|
22
|
-
|
|
23
|
-
I'll create a change with artifacts:
|
|
24
|
-
- proposal.md (what & why)
|
|
25
|
-
- design.md (how)
|
|
26
|
-
- tasks.md (implementation steps)
|
|
27
|
-
|
|
28
|
-
After artifacts are created, a **refinement validation loop** runs: the user reviews the plan, gives feedback, and when satisfied the Trello card is moved to Ready to Dev.
|
|
29
|
-
|
|
30
|
-
When ready to implement, run /ps:apply
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
**Input**: The user's request should include a change name (kebab-case) OR a description of what they want to build.
|
|
35
|
-
|
|
36
|
-
**Steps**
|
|
37
|
-
|
|
38
|
-
1. **If no clear input provided, ask what they want to build**
|
|
39
|
-
|
|
40
|
-
Use the **AskUserQuestion tool** (open-ended, no preset options) to ask:
|
|
41
|
-
> "What change do you want to work on? Describe what you want to build or fix."
|
|
42
|
-
|
|
43
|
-
From their description, derive a kebab-case name (e.g., "add user authentication" → \`add-user-auth\`).
|
|
44
|
-
|
|
45
|
-
**IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
|
|
46
|
-
|
|
47
|
-
2. **Create the change directory**
|
|
48
|
-
\`\`\`bash
|
|
49
|
-
pscode new change "<name>"
|
|
50
|
-
\`\`\`
|
|
51
|
-
This creates a scaffolded change in the planning home resolved by the CLI with \`.pscode.yaml\`.
|
|
52
|
-
|
|
53
|
-
3. **Trello Integration (optional)**
|
|
54
|
-
|
|
55
|
-
Use the **Read tool** (NOT a shell command) to read \`pscode/trello.yaml\` from the current working directory.
|
|
56
|
-
The Read tool is cross-platform and works on Windows, macOS, and Linux — never use \`cat\` or shell commands to read this file.
|
|
57
|
-
If the Read tool returns an error (file not found), skip all Trello steps and continue to Step 4.
|
|
58
|
-
|
|
59
|
-
Otherwise, parse the YAML and extract \`boardId\`, \`lists.backlog\`, \`lists.refining\`, \`lists.ready\`, and \`labels\`.
|
|
60
|
-
|
|
61
|
-
**3a. Detect label (if labels enabled)**
|
|
62
|
-
|
|
63
|
-
If \`labels.enabled = true\` and \`labels.items\` is present, determine which label to apply based on the change description provided by the user.
|
|
64
|
-
Use these classification rules:
|
|
65
|
-
|
|
66
|
-
| Label | Quando usar |
|
|
67
|
-
|-----------------|------------------------------------------------------------------------------|
|
|
68
|
-
| 🐛 BUG | Menciona erro, falha, bug, quebrado, não funciona, comportamento incorreto |
|
|
69
|
-
| ⚙️ IMPLEMENTAÇÃO | Nova feature, adicionar, criar, implementar algo que não existe ainda |
|
|
70
|
-
| ✨ MELHORIA | Melhorar, otimizar, refinar, aprimorar, performance de algo que já existe |
|
|
71
|
-
| 💳 DÉBITO TÉCNICO | Refatorar, limpar, reorganizar, remover código legado, dívida técnica |
|
|
72
|
-
|
|
73
|
-
- If the change clearly matches one label (>80% confidence) → use it silently, without asking.
|
|
74
|
-
- If ambiguous → use **AskUserQuestion**:
|
|
75
|
-
> "Que tipo de change é essa?"
|
|
76
|
-
> - 🐛 BUG — Erro ou comportamento incorreto
|
|
77
|
-
> - ⚙️ IMPLEMENTAÇÃO — Nova funcionalidade
|
|
78
|
-
> - ✨ MELHORIA — Aperfeiçoamento de algo existente
|
|
79
|
-
> - 💳 DÉBITO TÉCNICO — Refatoração e limpeza de código
|
|
80
|
-
> - Sem label — Não categorizar
|
|
81
|
-
- Save as \`chosenLabel\` (or \`null\`). Only use label keys present in \`labels.items\`.
|
|
82
|
-
|
|
83
|
-
**3b. Sync Trello card:**
|
|
84
|
-
|
|
85
|
-
a. If \`lists.backlog\` is configured, search for an existing card by name (case-insensitive, partial match):
|
|
86
|
-
\`\`\`tool
|
|
87
|
-
mcp__claude_ai_Trello_Custom__get_cards { list_id: "<lists.backlog.id>" }
|
|
88
|
-
\`\`\`
|
|
89
|
-
|
|
90
|
-
b. **If card found in backlog AND \`lists.refining\` is configured:**
|
|
91
|
-
Move it to the refining list:
|
|
92
|
-
\`\`\`tool
|
|
93
|
-
mcp__claude_ai_Trello_Custom__update_card { card_id: "<id>", list_id: "<lists.refining.id>" }
|
|
94
|
-
\`\`\`
|
|
95
|
-
Save \`cardId\`.
|
|
96
|
-
|
|
97
|
-
c. **If card found but no refining list configured:** keep card in backlog, save \`cardId\`.
|
|
98
|
-
|
|
99
|
-
d. **If no card found AND \`lists.refining\` is configured:**
|
|
100
|
-
Create a new card directly in the refining list:
|
|
101
|
-
\`\`\`tool
|
|
102
|
-
mcp__claude_ai_Trello_Custom__create_card
|
|
103
|
-
list_id: "<lists.refining.id>"
|
|
104
|
-
name: "<human-readable change name in Portuguese>"
|
|
105
|
-
desc: "Change iniciada via /ps:propose"
|
|
106
|
-
\`\`\`
|
|
107
|
-
Save \`cardId\`.
|
|
108
|
-
|
|
109
|
-
e. **If no card found and no refining list:** create in backlog. Save \`cardId\`.
|
|
110
|
-
|
|
111
|
-
f. **Apply label (if resolved):**
|
|
112
|
-
If \`chosenLabel\` is not null and \`cardId\` is saved:
|
|
113
|
-
\`\`\`tool
|
|
114
|
-
mcp__claude_ai_Trello_Custom__add_label_to_card
|
|
115
|
-
card_id: "<cardId>"
|
|
116
|
-
label_id: "<chosenLabel.id>"
|
|
117
|
-
\`\`\`
|
|
118
|
-
|
|
119
|
-
g. **Assign the current user:**
|
|
120
|
-
\`\`\`tool
|
|
121
|
-
mcp__claude_ai_Trello_Custom__get_me
|
|
122
|
-
mcp__claude_ai_Trello_Custom__add_card_member { card_id: "<cardId>", member_id: "<me.id>" }
|
|
123
|
-
\`\`\`
|
|
124
|
-
|
|
125
|
-
If any Trello call fails, log the error and continue — Trello is auxiliary, never blocking.
|
|
126
|
-
|
|
127
|
-
4. **Get the artifact build order**
|
|
128
|
-
\`\`\`bash
|
|
129
|
-
pscode status --change "<name>" --json
|
|
130
|
-
\`\`\`
|
|
131
|
-
Parse the JSON to get:
|
|
132
|
-
- \`applyRequires\`: array of artifact IDs needed before implementation
|
|
133
|
-
- \`artifacts\`: list of all artifacts with their status and dependencies
|
|
134
|
-
- \`planningHome\`, \`changeRoot\`, \`artifactPaths\`, and \`actionContext\`: path and scope context
|
|
135
|
-
|
|
136
|
-
5. **Create artifacts in sequence until apply-ready**
|
|
137
|
-
|
|
138
|
-
Use the **TodoWrite tool** to track progress through the artifacts.
|
|
139
|
-
|
|
140
|
-
Loop through artifacts in dependency order:
|
|
141
|
-
|
|
142
|
-
a. **For each artifact that is \`ready\` (dependencies satisfied)**:
|
|
143
|
-
- Get instructions:
|
|
144
|
-
\`\`\`bash
|
|
145
|
-
pscode instructions <artifact-id> --change "<name>" --json
|
|
146
|
-
\`\`\`
|
|
147
|
-
- The instructions JSON includes:
|
|
148
|
-
- \`context\`: Project background (constraints for you - do NOT include in output)
|
|
149
|
-
- \`rules\`: Artifact-specific rules (constraints for you - do NOT include in output)
|
|
150
|
-
- \`template\`: The structure to use for your output file
|
|
151
|
-
- \`instruction\`: Schema-specific guidance for this artifact type
|
|
152
|
-
- \`resolvedOutputPath\`: Resolved path or pattern to write the artifact
|
|
153
|
-
- \`dependencies\`: Completed artifacts to read for context
|
|
154
|
-
- Read any completed dependency files for context
|
|
155
|
-
- Create the artifact file using \`template\` as the structure and write it to \`resolvedOutputPath\`
|
|
156
|
-
- Apply \`context\` and \`rules\` as constraints — do NOT copy them into the file
|
|
157
|
-
- Show brief progress: "Created <artifact-id>"
|
|
158
|
-
|
|
159
|
-
b. **Continue until all \`applyRequires\` artifacts are complete**
|
|
160
|
-
- After creating each artifact, re-run \`pscode status --change "<name>" --json\`
|
|
161
|
-
- Check if every artifact ID in \`applyRequires\` has \`status: "done"\`
|
|
162
|
-
- Stop when all \`applyRequires\` artifacts are done
|
|
163
|
-
|
|
164
|
-
c. **If an artifact requires user input** (unclear context):
|
|
165
|
-
- Use **AskUserQuestion tool** to clarify
|
|
166
|
-
- Then continue with creation
|
|
167
|
-
|
|
168
|
-
6. **Show final status**
|
|
169
|
-
\`\`\`bash
|
|
170
|
-
pscode status --change "<name>"
|
|
171
|
-
\`\`\`
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
## Refinement Validation Loop
|
|
176
|
-
|
|
177
|
-
After all artifacts are created, enter the **refinement validation loop**. This loop runs until the user approves the plan or explicitly cancels.
|
|
178
|
-
|
|
179
|
-
### Step R1 — Show Refinement Summary
|
|
180
|
-
|
|
181
|
-
Present the following structured summary to the user. Read \`proposal.md\`, \`design.md\`, and \`tasks.md\` from the change directory to extract the relevant information.
|
|
182
|
-
|
|
183
|
-
\`\`\`markdown
|
|
184
|
-
## 🔍 Refinamento da Proposta — <name>
|
|
185
|
-
|
|
186
|
-
**Objetivo:** <1-2 sentences summarizing what will be built, from proposal.md>
|
|
187
|
-
|
|
188
|
-
### O que será implementado
|
|
189
|
-
<3-5 bullet points extracted from design.md / tasks.md describing the main implementation steps>
|
|
190
|
-
|
|
191
|
-
### Escopo e decisões técnicas
|
|
192
|
-
<2-3 key technical decisions or constraints from design.md>
|
|
193
|
-
|
|
194
|
-
### Tarefas geradas
|
|
195
|
-
<numbered list of tasks from tasks.md (brief, one line each)>
|
|
196
|
-
|
|
197
|
-
---
|
|
198
|
-
Para iniciar a implementação quando aprovado:
|
|
199
|
-
\`\`\`
|
|
200
|
-
/ps:apply <name>
|
|
201
|
-
\`\`\`
|
|
202
|
-
\`\`\`
|
|
203
|
-
|
|
204
|
-
---
|
|
205
|
-
|
|
206
|
-
### Step R2 — Ask for user approval
|
|
207
|
-
|
|
208
|
-
Use **AskUserQuestion** to ask:
|
|
209
|
-
|
|
210
|
-
> "A implementação e o planejamento estão de acordo com o esperado?"
|
|
211
|
-
|
|
212
|
-
Options:
|
|
213
|
-
- ✅ Sim, está refinada — mover para Ready to Dev
|
|
214
|
-
- 🔄 Não, quero ajustar o plano
|
|
215
|
-
- ❌ Cancelar (manter em refinamento)
|
|
216
|
-
|
|
217
|
-
**Do NOT update the Trello card description or add any comment before the user approves.**
|
|
218
|
-
|
|
219
|
-
---
|
|
220
|
-
|
|
221
|
-
### Step R2a — If APPROVED (Sim, está refinada)
|
|
222
|
-
|
|
223
|
-
1. **Update Trello card description** (if \`cardId\` exists):
|
|
224
|
-
Build the description from the artifacts already read in Step R1:
|
|
225
|
-
\`\`\`tool
|
|
226
|
-
mcp__claude_ai_Trello_Custom__update_card
|
|
227
|
-
card_id: "<cardId>"
|
|
228
|
-
desc: |
|
|
229
|
-
**Objetivo:** <summary from proposal.md>
|
|
230
|
-
|
|
231
|
-
**O que será implementado:**
|
|
232
|
-
<bullet list from design.md / tasks.md>
|
|
233
|
-
|
|
234
|
-
**Decisões técnicas:**
|
|
235
|
-
<key decisions from design.md>
|
|
236
|
-
|
|
237
|
-
**Artefatos:** pscode/changes/<name>/
|
|
238
|
-
\`\`\`
|
|
239
|
-
|
|
240
|
-
2. **Add a comment** in Portuguese (if \`cardId\` exists):
|
|
241
|
-
\`\`\`tool
|
|
242
|
-
mcp__claude_ai_Trello_Custom__add_comment
|
|
243
|
-
card_id: "<cardId>"
|
|
244
|
-
text: |
|
|
245
|
-
## Proposta refinada ✓
|
|
246
|
-
|
|
247
|
-
**Change:** \`<name>\`
|
|
248
|
-
**Artefatos gerados:** proposal.md · design.md · tasks.md
|
|
249
|
-
|
|
250
|
-
### Resumo
|
|
251
|
-
<2-3 line summary of what will be built>
|
|
252
|
-
|
|
253
|
-
### Para iniciar a implementação
|
|
254
|
-
\`\`\`
|
|
255
|
-
/ps:apply <name>
|
|
256
|
-
\`\`\`
|
|
257
|
-
|
|
258
|
-
_Aguardando aprovação para mover para Ready to Dev._
|
|
259
|
-
\`\`\`
|
|
260
|
-
|
|
261
|
-
3. **Move the Trello card to the ready list** (if \`lists.ready\` is configured and \`cardId\` exists):
|
|
262
|
-
\`\`\`tool
|
|
263
|
-
mcp__claude_ai_Trello_Custom__update_card
|
|
264
|
-
card_id: "<cardId>"
|
|
265
|
-
list_id: "<lists.ready.id>"
|
|
266
|
-
\`\`\`
|
|
267
|
-
|
|
268
|
-
4. **Add a final Trello comment** (if cardId exists):
|
|
269
|
-
\`\`\`tool
|
|
270
|
-
mcp__claude_ai_Trello_Custom__add_comment
|
|
271
|
-
card_id: "<cardId>"
|
|
272
|
-
text: |
|
|
273
|
-
## ✅ Aprovado para Ready to Dev
|
|
274
|
-
|
|
275
|
-
O planejamento foi revisado e aprovado.
|
|
276
|
-
|
|
277
|
-
### Próximo passo
|
|
278
|
-
\`\`\`
|
|
279
|
-
/ps:apply <name>
|
|
280
|
-
\`\`\`
|
|
281
|
-
\`\`\`
|
|
282
|
-
|
|
283
|
-
5. **Show success message:**
|
|
284
|
-
\`\`\`markdown
|
|
285
|
-
## ✅ Pronto para desenvolvimento!
|
|
286
|
-
|
|
287
|
-
**Change:** <name>
|
|
288
|
-
**Card movido para:** <lists.ready.name>
|
|
289
|
-
|
|
290
|
-
Quando quiser iniciar a implementação:
|
|
291
|
-
\`\`\`
|
|
292
|
-
/ps:apply <name>
|
|
293
|
-
\`\`\`
|
|
294
|
-
\`\`\`
|
|
295
|
-
|
|
296
|
-
---
|
|
297
|
-
|
|
298
|
-
### Step R2b — If NOT APPROVED (Quero ajustar o plano)
|
|
299
|
-
|
|
300
|
-
1. **Ask what needs to change** using **AskUserQuestion**:
|
|
301
|
-
> "O que você gostaria de ajustar no plano? Descreva as mudanças necessárias."
|
|
302
|
-
|
|
303
|
-
2. **Apply the requested changes** to the relevant artifacts:
|
|
304
|
-
- Changes to scope or requirements → update \`proposal.md\`
|
|
305
|
-
- Changes to technical approach → update \`design.md\`
|
|
306
|
-
- Changes to tasks → update \`tasks.md\`
|
|
307
|
-
|
|
308
|
-
3. **Go back to Step R1** and show the updated refinement summary.
|
|
309
|
-
Keep looping until the user approves or cancels.
|
|
310
|
-
**Do NOT update the Trello description or add comments until the user approves.**
|
|
311
|
-
|
|
312
|
-
---
|
|
313
|
-
|
|
314
|
-
### Step R2c — If CANCELLED
|
|
315
|
-
|
|
316
|
-
Show:
|
|
317
|
-
\`\`\`markdown
|
|
318
|
-
## ⏸ Refinamento pausado
|
|
319
|
-
|
|
320
|
-
O card permanece em **<current list name>**.
|
|
321
|
-
Retome o refinamento quando quiser com \`/ps:explore <name>\`.
|
|
322
|
-
\`\`\`
|
|
323
|
-
|
|
324
|
-
Do NOT move the card. Stop the loop.
|
|
325
|
-
|
|
326
|
-
---
|
|
327
|
-
|
|
328
|
-
**Artifact Creation Guidelines**
|
|
329
|
-
|
|
330
|
-
- Follow the \`instruction\` field from \`pscode instructions\` for each artifact type
|
|
331
|
-
- Read dependency artifacts for context before creating new ones
|
|
332
|
-
- Use \`template\` as the structure — fill in its sections
|
|
333
|
-
- **IMPORTANT**: \`context\` and \`rules\` are constraints for YOU, not content for the file
|
|
334
|
-
|
|
335
|
-
**Guardrails**
|
|
336
|
-
- Create ALL artifacts needed for implementation (as defined by schema's \`apply.requires\`)
|
|
337
|
-
- Always read dependency artifacts before creating a new one
|
|
338
|
-
- If context is critically unclear, ask the user — but prefer reasonable decisions to keep momentum
|
|
339
|
-
- If a change with that name already exists, ask if user wants to continue it or create a new one
|
|
340
|
-
- Verify each artifact file exists after writing before proceeding to next
|
|
341
|
-
- If Trello tools fail, continue normally — Trello is auxiliary, not blocking
|
|
342
|
-
- All content written to Trello must be in Portuguese
|
|
343
|
-
- **The refinement loop is mandatory** — never skip it even if the user didn't mention Trello; the approval question must always be asked
|
|
344
|
-
- **Preserve the loop** — do not exit until the user explicitly approves (moves to Ready to Dev) or cancels
|
|
21
|
+
return `Propose a new change - create the change and generate all artifacts in one step.
|
|
22
|
+
|
|
23
|
+
I'll create a change with artifacts:
|
|
24
|
+
- proposal.md (what & why)
|
|
25
|
+
- design.md (how)
|
|
26
|
+
- tasks.md (implementation steps)
|
|
27
|
+
|
|
28
|
+
After artifacts are created, a **refinement validation loop** runs: the user reviews the plan, gives feedback, and when satisfied the Trello card is moved to Ready to Dev.
|
|
29
|
+
|
|
30
|
+
When ready to implement, run /ps:apply
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
**Input**: The user's request should include a change name (kebab-case) OR a description of what they want to build.
|
|
35
|
+
|
|
36
|
+
**Steps**
|
|
37
|
+
|
|
38
|
+
1. **If no clear input provided, ask what they want to build**
|
|
39
|
+
|
|
40
|
+
Use the **AskUserQuestion tool** (open-ended, no preset options) to ask:
|
|
41
|
+
> "What change do you want to work on? Describe what you want to build or fix."
|
|
42
|
+
|
|
43
|
+
From their description, derive a kebab-case name (e.g., "add user authentication" → \`add-user-auth\`).
|
|
44
|
+
|
|
45
|
+
**IMPORTANT**: Do NOT proceed without understanding what the user wants to build.
|
|
46
|
+
|
|
47
|
+
2. **Create the change directory**
|
|
48
|
+
\`\`\`bash
|
|
49
|
+
pscode new change "<name>"
|
|
50
|
+
\`\`\`
|
|
51
|
+
This creates a scaffolded change in the planning home resolved by the CLI with \`.pscode.yaml\`.
|
|
52
|
+
|
|
53
|
+
3. **Trello Integration (optional)**
|
|
54
|
+
|
|
55
|
+
Use the **Read tool** (NOT a shell command) to read \`pscode/trello.yaml\` from the current working directory.
|
|
56
|
+
The Read tool is cross-platform and works on Windows, macOS, and Linux — never use \`cat\` or shell commands to read this file.
|
|
57
|
+
If the Read tool returns an error (file not found), skip all Trello steps and continue to Step 4.
|
|
58
|
+
|
|
59
|
+
Otherwise, parse the YAML and extract \`boardId\`, \`lists.backlog\`, \`lists.refining\`, \`lists.ready\`, and \`labels\`.
|
|
60
|
+
|
|
61
|
+
**3a. Detect label (if labels enabled)**
|
|
62
|
+
|
|
63
|
+
If \`labels.enabled = true\` and \`labels.items\` is present, determine which label to apply based on the change description provided by the user.
|
|
64
|
+
Use these classification rules:
|
|
65
|
+
|
|
66
|
+
| Label | Quando usar |
|
|
67
|
+
|-----------------|------------------------------------------------------------------------------|
|
|
68
|
+
| 🐛 BUG | Menciona erro, falha, bug, quebrado, não funciona, comportamento incorreto |
|
|
69
|
+
| ⚙️ IMPLEMENTAÇÃO | Nova feature, adicionar, criar, implementar algo que não existe ainda |
|
|
70
|
+
| ✨ MELHORIA | Melhorar, otimizar, refinar, aprimorar, performance de algo que já existe |
|
|
71
|
+
| 💳 DÉBITO TÉCNICO | Refatorar, limpar, reorganizar, remover código legado, dívida técnica |
|
|
72
|
+
|
|
73
|
+
- If the change clearly matches one label (>80% confidence) → use it silently, without asking.
|
|
74
|
+
- If ambiguous → use **AskUserQuestion**:
|
|
75
|
+
> "Que tipo de change é essa?"
|
|
76
|
+
> - 🐛 BUG — Erro ou comportamento incorreto
|
|
77
|
+
> - ⚙️ IMPLEMENTAÇÃO — Nova funcionalidade
|
|
78
|
+
> - ✨ MELHORIA — Aperfeiçoamento de algo existente
|
|
79
|
+
> - 💳 DÉBITO TÉCNICO — Refatoração e limpeza de código
|
|
80
|
+
> - Sem label — Não categorizar
|
|
81
|
+
- Save as \`chosenLabel\` (or \`null\`). Only use label keys present in \`labels.items\`.
|
|
82
|
+
|
|
83
|
+
**3b. Sync Trello card:**
|
|
84
|
+
|
|
85
|
+
a. If \`lists.backlog\` is configured, search for an existing card by name (case-insensitive, partial match):
|
|
86
|
+
\`\`\`tool
|
|
87
|
+
mcp__claude_ai_Trello_Custom__get_cards { list_id: "<lists.backlog.id>" }
|
|
88
|
+
\`\`\`
|
|
89
|
+
|
|
90
|
+
b. **If card found in backlog AND \`lists.refining\` is configured:**
|
|
91
|
+
Move it to the refining list:
|
|
92
|
+
\`\`\`tool
|
|
93
|
+
mcp__claude_ai_Trello_Custom__update_card { card_id: "<id>", list_id: "<lists.refining.id>" }
|
|
94
|
+
\`\`\`
|
|
95
|
+
Save \`cardId\`.
|
|
96
|
+
|
|
97
|
+
c. **If card found but no refining list configured:** keep card in backlog, save \`cardId\`.
|
|
98
|
+
|
|
99
|
+
d. **If no card found AND \`lists.refining\` is configured:**
|
|
100
|
+
Create a new card directly in the refining list:
|
|
101
|
+
\`\`\`tool
|
|
102
|
+
mcp__claude_ai_Trello_Custom__create_card
|
|
103
|
+
list_id: "<lists.refining.id>"
|
|
104
|
+
name: "<human-readable change name in Portuguese>"
|
|
105
|
+
desc: "Change iniciada via /ps:propose"
|
|
106
|
+
\`\`\`
|
|
107
|
+
Save \`cardId\`.
|
|
108
|
+
|
|
109
|
+
e. **If no card found and no refining list:** create in backlog. Save \`cardId\`.
|
|
110
|
+
|
|
111
|
+
f. **Apply label (if resolved):**
|
|
112
|
+
If \`chosenLabel\` is not null and \`cardId\` is saved:
|
|
113
|
+
\`\`\`tool
|
|
114
|
+
mcp__claude_ai_Trello_Custom__add_label_to_card
|
|
115
|
+
card_id: "<cardId>"
|
|
116
|
+
label_id: "<chosenLabel.id>"
|
|
117
|
+
\`\`\`
|
|
118
|
+
|
|
119
|
+
g. **Assign the current user:**
|
|
120
|
+
\`\`\`tool
|
|
121
|
+
mcp__claude_ai_Trello_Custom__get_me
|
|
122
|
+
mcp__claude_ai_Trello_Custom__add_card_member { card_id: "<cardId>", member_id: "<me.id>" }
|
|
123
|
+
\`\`\`
|
|
124
|
+
|
|
125
|
+
If any Trello call fails, log the error and continue — Trello is auxiliary, never blocking.
|
|
126
|
+
|
|
127
|
+
4. **Get the artifact build order**
|
|
128
|
+
\`\`\`bash
|
|
129
|
+
pscode status --change "<name>" --json
|
|
130
|
+
\`\`\`
|
|
131
|
+
Parse the JSON to get:
|
|
132
|
+
- \`applyRequires\`: array of artifact IDs needed before implementation
|
|
133
|
+
- \`artifacts\`: list of all artifacts with their status and dependencies
|
|
134
|
+
- \`planningHome\`, \`changeRoot\`, \`artifactPaths\`, and \`actionContext\`: path and scope context
|
|
135
|
+
|
|
136
|
+
5. **Create artifacts in sequence until apply-ready**
|
|
137
|
+
|
|
138
|
+
Use the **TodoWrite tool** to track progress through the artifacts.
|
|
139
|
+
|
|
140
|
+
Loop through artifacts in dependency order:
|
|
141
|
+
|
|
142
|
+
a. **For each artifact that is \`ready\` (dependencies satisfied)**:
|
|
143
|
+
- Get instructions:
|
|
144
|
+
\`\`\`bash
|
|
145
|
+
pscode instructions <artifact-id> --change "<name>" --json
|
|
146
|
+
\`\`\`
|
|
147
|
+
- The instructions JSON includes:
|
|
148
|
+
- \`context\`: Project background (constraints for you - do NOT include in output)
|
|
149
|
+
- \`rules\`: Artifact-specific rules (constraints for you - do NOT include in output)
|
|
150
|
+
- \`template\`: The structure to use for your output file
|
|
151
|
+
- \`instruction\`: Schema-specific guidance for this artifact type
|
|
152
|
+
- \`resolvedOutputPath\`: Resolved path or pattern to write the artifact
|
|
153
|
+
- \`dependencies\`: Completed artifacts to read for context
|
|
154
|
+
- Read any completed dependency files for context
|
|
155
|
+
- Create the artifact file using \`template\` as the structure and write it to \`resolvedOutputPath\`
|
|
156
|
+
- Apply \`context\` and \`rules\` as constraints — do NOT copy them into the file
|
|
157
|
+
- Show brief progress: "Created <artifact-id>"
|
|
158
|
+
|
|
159
|
+
b. **Continue until all \`applyRequires\` artifacts are complete**
|
|
160
|
+
- After creating each artifact, re-run \`pscode status --change "<name>" --json\`
|
|
161
|
+
- Check if every artifact ID in \`applyRequires\` has \`status: "done"\`
|
|
162
|
+
- Stop when all \`applyRequires\` artifacts are done
|
|
163
|
+
|
|
164
|
+
c. **If an artifact requires user input** (unclear context):
|
|
165
|
+
- Use **AskUserQuestion tool** to clarify
|
|
166
|
+
- Then continue with creation
|
|
167
|
+
|
|
168
|
+
6. **Show final status**
|
|
169
|
+
\`\`\`bash
|
|
170
|
+
pscode status --change "<name>"
|
|
171
|
+
\`\`\`
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Refinement Validation Loop
|
|
176
|
+
|
|
177
|
+
After all artifacts are created, enter the **refinement validation loop**. This loop runs until the user approves the plan or explicitly cancels.
|
|
178
|
+
|
|
179
|
+
### Step R1 — Show Refinement Summary
|
|
180
|
+
|
|
181
|
+
Present the following structured summary to the user. Read \`proposal.md\`, \`design.md\`, and \`tasks.md\` from the change directory to extract the relevant information.
|
|
182
|
+
|
|
183
|
+
\`\`\`markdown
|
|
184
|
+
## 🔍 Refinamento da Proposta — <name>
|
|
185
|
+
|
|
186
|
+
**Objetivo:** <1-2 sentences summarizing what will be built, from proposal.md>
|
|
187
|
+
|
|
188
|
+
### O que será implementado
|
|
189
|
+
<3-5 bullet points extracted from design.md / tasks.md describing the main implementation steps>
|
|
190
|
+
|
|
191
|
+
### Escopo e decisões técnicas
|
|
192
|
+
<2-3 key technical decisions or constraints from design.md>
|
|
193
|
+
|
|
194
|
+
### Tarefas geradas
|
|
195
|
+
<numbered list of tasks from tasks.md (brief, one line each)>
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
Para iniciar a implementação quando aprovado:
|
|
199
|
+
\`\`\`
|
|
200
|
+
/ps:apply <name>
|
|
201
|
+
\`\`\`
|
|
202
|
+
\`\`\`
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
### Step R2 — Ask for user approval
|
|
207
|
+
|
|
208
|
+
Use **AskUserQuestion** to ask:
|
|
209
|
+
|
|
210
|
+
> "A implementação e o planejamento estão de acordo com o esperado?"
|
|
211
|
+
|
|
212
|
+
Options:
|
|
213
|
+
- ✅ Sim, está refinada — mover para Ready to Dev
|
|
214
|
+
- 🔄 Não, quero ajustar o plano
|
|
215
|
+
- ❌ Cancelar (manter em refinamento)
|
|
216
|
+
|
|
217
|
+
**Do NOT update the Trello card description or add any comment before the user approves.**
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
### Step R2a — If APPROVED (Sim, está refinada)
|
|
222
|
+
|
|
223
|
+
1. **Update Trello card description** (if \`cardId\` exists):
|
|
224
|
+
Build the description from the artifacts already read in Step R1:
|
|
225
|
+
\`\`\`tool
|
|
226
|
+
mcp__claude_ai_Trello_Custom__update_card
|
|
227
|
+
card_id: "<cardId>"
|
|
228
|
+
desc: |
|
|
229
|
+
**Objetivo:** <summary from proposal.md>
|
|
230
|
+
|
|
231
|
+
**O que será implementado:**
|
|
232
|
+
<bullet list from design.md / tasks.md>
|
|
233
|
+
|
|
234
|
+
**Decisões técnicas:**
|
|
235
|
+
<key decisions from design.md>
|
|
236
|
+
|
|
237
|
+
**Artefatos:** pscode/changes/<name>/
|
|
238
|
+
\`\`\`
|
|
239
|
+
|
|
240
|
+
2. **Add a comment** in Portuguese (if \`cardId\` exists):
|
|
241
|
+
\`\`\`tool
|
|
242
|
+
mcp__claude_ai_Trello_Custom__add_comment
|
|
243
|
+
card_id: "<cardId>"
|
|
244
|
+
text: |
|
|
245
|
+
## Proposta refinada ✓
|
|
246
|
+
|
|
247
|
+
**Change:** \`<name>\`
|
|
248
|
+
**Artefatos gerados:** proposal.md · design.md · tasks.md
|
|
249
|
+
|
|
250
|
+
### Resumo
|
|
251
|
+
<2-3 line summary of what will be built>
|
|
252
|
+
|
|
253
|
+
### Para iniciar a implementação
|
|
254
|
+
\`\`\`
|
|
255
|
+
/ps:apply <name>
|
|
256
|
+
\`\`\`
|
|
257
|
+
|
|
258
|
+
_Aguardando aprovação para mover para Ready to Dev._
|
|
259
|
+
\`\`\`
|
|
260
|
+
|
|
261
|
+
3. **Move the Trello card to the ready list** (if \`lists.ready\` is configured and \`cardId\` exists):
|
|
262
|
+
\`\`\`tool
|
|
263
|
+
mcp__claude_ai_Trello_Custom__update_card
|
|
264
|
+
card_id: "<cardId>"
|
|
265
|
+
list_id: "<lists.ready.id>"
|
|
266
|
+
\`\`\`
|
|
267
|
+
|
|
268
|
+
4. **Add a final Trello comment** (if cardId exists):
|
|
269
|
+
\`\`\`tool
|
|
270
|
+
mcp__claude_ai_Trello_Custom__add_comment
|
|
271
|
+
card_id: "<cardId>"
|
|
272
|
+
text: |
|
|
273
|
+
## ✅ Aprovado para Ready to Dev
|
|
274
|
+
|
|
275
|
+
O planejamento foi revisado e aprovado.
|
|
276
|
+
|
|
277
|
+
### Próximo passo
|
|
278
|
+
\`\`\`
|
|
279
|
+
/ps:apply <name>
|
|
280
|
+
\`\`\`
|
|
281
|
+
\`\`\`
|
|
282
|
+
|
|
283
|
+
5. **Show success message:**
|
|
284
|
+
\`\`\`markdown
|
|
285
|
+
## ✅ Pronto para desenvolvimento!
|
|
286
|
+
|
|
287
|
+
**Change:** <name>
|
|
288
|
+
**Card movido para:** <lists.ready.name>
|
|
289
|
+
|
|
290
|
+
Quando quiser iniciar a implementação:
|
|
291
|
+
\`\`\`
|
|
292
|
+
/ps:apply <name>
|
|
293
|
+
\`\`\`
|
|
294
|
+
\`\`\`
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
### Step R2b — If NOT APPROVED (Quero ajustar o plano)
|
|
299
|
+
|
|
300
|
+
1. **Ask what needs to change** using **AskUserQuestion**:
|
|
301
|
+
> "O que você gostaria de ajustar no plano? Descreva as mudanças necessárias."
|
|
302
|
+
|
|
303
|
+
2. **Apply the requested changes** to the relevant artifacts:
|
|
304
|
+
- Changes to scope or requirements → update \`proposal.md\`
|
|
305
|
+
- Changes to technical approach → update \`design.md\`
|
|
306
|
+
- Changes to tasks → update \`tasks.md\`
|
|
307
|
+
|
|
308
|
+
3. **Go back to Step R1** and show the updated refinement summary.
|
|
309
|
+
Keep looping until the user approves or cancels.
|
|
310
|
+
**Do NOT update the Trello description or add comments until the user approves.**
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
### Step R2c — If CANCELLED
|
|
315
|
+
|
|
316
|
+
Show:
|
|
317
|
+
\`\`\`markdown
|
|
318
|
+
## ⏸ Refinamento pausado
|
|
319
|
+
|
|
320
|
+
O card permanece em **<current list name>**.
|
|
321
|
+
Retome o refinamento quando quiser com \`/ps:explore <name>\`.
|
|
322
|
+
\`\`\`
|
|
323
|
+
|
|
324
|
+
Do NOT move the card. Stop the loop.
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
**Artifact Creation Guidelines**
|
|
329
|
+
|
|
330
|
+
- Follow the \`instruction\` field from \`pscode instructions\` for each artifact type
|
|
331
|
+
- Read dependency artifacts for context before creating new ones
|
|
332
|
+
- Use \`template\` as the structure — fill in its sections
|
|
333
|
+
- **IMPORTANT**: \`context\` and \`rules\` are constraints for YOU, not content for the file
|
|
334
|
+
|
|
335
|
+
**Guardrails**
|
|
336
|
+
- Create ALL artifacts needed for implementation (as defined by schema's \`apply.requires\`)
|
|
337
|
+
- Always read dependency artifacts before creating a new one
|
|
338
|
+
- If context is critically unclear, ask the user — but prefer reasonable decisions to keep momentum
|
|
339
|
+
- If a change with that name already exists, ask if user wants to continue it or create a new one
|
|
340
|
+
- Verify each artifact file exists after writing before proceeding to next
|
|
341
|
+
- If Trello tools fail, continue normally — Trello is auxiliary, not blocking
|
|
342
|
+
- All content written to Trello must be in Portuguese
|
|
343
|
+
- **The refinement loop is mandatory** — never skip it even if the user didn't mention Trello; the approval question must always be asked
|
|
344
|
+
- **Preserve the loop** — do not exit until the user explicitly approves (moves to Ready to Dev) or cancels
|
|
345
345
|
`;
|
|
346
346
|
}
|
|
347
347
|
//# sourceMappingURL=propose.js.map
|