diff --git a/.changeset/askuserquestion-em-todas-as-skills.md b/.changeset/askuserquestion-em-todas-as-skills.md new file mode 100644 index 0000000..7f8c156 --- /dev/null +++ b/.changeset/askuserquestion-em-todas-as-skills.md @@ -0,0 +1,13 @@ +--- +"@thiagodiogo/pscode": patch +--- + +feat(content): padroniza AskUserQuestion para perguntas e confirmações em todo o fluxo + +Toda interação que pede input ao usuário — em qualquer skill ou comando — passa a +usar o `AskUserQuestion` nativo, com a opção recomendada primeiro. Confirmações de +progresso que antes eram texto livre (ex.: "Posso marcar `[x]` e fechar a +sub-issue?") agora são oferecidas como uma escolha `Sim` / `Não` de um clique. A +diretriz central foi reforçada no bloco AGENTS e em `pscode-guided-sdd`, e os +pontos de confirmação em `task-runner`, `dev`, `complete`, `cancel`, `mini-spec`, +`draft` e `refine` passaram a apontar para o `AskUserQuestion`. diff --git a/.changeset/card-title-pattern.md b/.changeset/card-title-pattern.md new file mode 100644 index 0000000..a87ca72 --- /dev/null +++ b/.changeset/card-title-pattern.md @@ -0,0 +1,11 @@ +--- +"@thiagodiogo/pscode": patch +--- + +feat(draft): padrão `[tipo] descrição` para o título do card + +O `/ps:draft` passa a montar o título do card no formato `[] ` +(tipos de commit: `feat`, `fix`, `refactor`, `test`, `docs`, `chore`) e o slug +interno como `-`. O tipo é inferido do pedido e confirmado +via `AskUserQuestion`. As skills `pscode-guided-sdd` e `pscode-github-sync` foram +atualizadas para refletir o padrão. diff --git a/pscode/changes/askuserquestion-em-todas-as-skills/.issue b/pscode/changes/archive/2026-06-23-askuserquestion-em-todas-as-skills/.issue similarity index 100% rename from pscode/changes/askuserquestion-em-todas-as-skills/.issue rename to pscode/changes/archive/2026-06-23-askuserquestion-em-todas-as-skills/.issue diff --git a/pscode/changes/archive/2026-06-23-askuserquestion-em-todas-as-skills/delta-spec.md b/pscode/changes/archive/2026-06-23-askuserquestion-em-todas-as-skills/delta-spec.md new file mode 100644 index 0000000..a713097 --- /dev/null +++ b/pscode/changes/archive/2026-06-23-askuserquestion-em-todas-as-skills/delta-spec.md @@ -0,0 +1,18 @@ +# askuserquestion-em-todas-as-skills — Delta + +## Changed +- Diretriz central (bloco AGENTS em `content/index.ts` + skill `pscode-guided-sdd`): + a regra "preferir `AskUserQuestion`" agora cobre explicitamente **confirmações + Sim/Não** (recomendada primeiro), não só perguntas abertas. +- Pontos de confirmação que eram prosa passaram a apontar para o `AskUserQuestion` + com opções `Sim` / `Não` (recomendada primeiro): + - `pscode-task-runner` (marcar subtask `[x]`). + - `pscode-dev` e `commands/dev.ts` (ticking de subtask, gates In Test e Ready to Deploy). + - `pscode-complete` e `commands/complete.ts` (confirmar antes de arquivar). + - `pscode-complete` (cancel) e `commands/cancel.ts` (motivo do cancelamento via opções + free-text; confirmar antes de arquivar). + - `pscode-mini-spec` (aprovação do brief). + - `commands/draft.ts` e `commands/refine.ts` (validação/aprovação do passo). + +## Added +- Testes de conteúdo em `test/unit/content.test.ts`: todo comando/skill interativo + menciona `AskUserQuestion`, e a diretriz central cobre Sim/Não + opção recomendada. diff --git a/pscode/changes/askuserquestion-em-todas-as-skills/questions.md b/pscode/changes/archive/2026-06-23-askuserquestion-em-todas-as-skills/questions.md similarity index 100% rename from pscode/changes/askuserquestion-em-todas-as-skills/questions.md rename to pscode/changes/archive/2026-06-23-askuserquestion-em-todas-as-skills/questions.md diff --git a/pscode/changes/askuserquestion-em-todas-as-skills/refine.md b/pscode/changes/archive/2026-06-23-askuserquestion-em-todas-as-skills/refine.md similarity index 91% rename from pscode/changes/askuserquestion-em-todas-as-skills/refine.md rename to pscode/changes/archive/2026-06-23-askuserquestion-em-todas-as-skills/refine.md index a30b96c..f2fbb16 100644 --- a/pscode/changes/askuserquestion-em-todas-as-skills/refine.md +++ b/pscode/changes/archive/2026-06-23-askuserquestion-em-todas-as-skills/refine.md @@ -44,7 +44,7 @@ clique. - Alterar a UI/implementação do próprio `AskUserQuestion` (é nativo do agente). ## Subtasks -- [ ] Reforçar a diretriz central (perguntas + confirmações Sim/Não, recomendada primeiro) em `AGENTS_BLOCK_BODY` (`content/index.ts`) e `pscode-guided-sdd`. -- [ ] Converter os pontos de confirmação em `task-runner.ts`, `dev.ts` (skill) e `commands/dev.ts` para `AskUserQuestion` Sim/Não. -- [ ] Converter os pontos de confirmação/cancelamento em `complete.ts` (skill+comando), `cancel.ts` e `mini-spec.ts`; alinhar vocabulário em `grill-me.ts`/`refine.ts`/`draft.ts`. -- [ ] Adicionar teste de conteúdo em `content.test.ts` e criar o changeset. +- [x] Reforçar a diretriz central (perguntas + confirmações Sim/Não, recomendada primeiro) em `AGENTS_BLOCK_BODY` (`content/index.ts`) e `pscode-guided-sdd`. +- [x] Converter os pontos de confirmação em `task-runner.ts`, `dev.ts` (skill) e `commands/dev.ts` para `AskUserQuestion` Sim/Não. +- [x] Converter os pontos de confirmação/cancelamento em `complete.ts` (skill+comando), `cancel.ts` e `mini-spec.ts`; alinhar vocabulário em `grill-me.ts`/`refine.ts`/`draft.ts`. +- [x] Adicionar teste de conteúdo em `content.test.ts` e criar o changeset. diff --git a/src/core/content/commands/cancel.ts b/src/core/content/commands/cancel.ts index 7b58b80..c8bef26 100644 --- a/src/core/content/commands/cancel.ts +++ b/src/core/content/commands/cancel.ts @@ -12,10 +12,13 @@ Drop a change that won't be delivered. Accepts the board **card/issue number** Use the **pscode-complete** skill (cancel path). -1. Ask the user for the **reason** to cancel. +1. Ask the user for the **reason** to cancel — via \`AskUserQuestion\`, offering a + few common reasons (e.g. \`Obsoleto\`, \`Duplicado\`, \`Fora de escopo\`) plus the + free-text field. 2. **Archive** the change: move \`pscode/changes//\` to \`pscode/changes/archive/-/\`. -3. **Stop and confirm** before archiving. +3. **Stop and confirm** before archiving — ask via \`AskUserQuestion\` (\`Sim\` / + \`Não\`, recommended first). ## GitHub sync (if \`pscode/github.yaml\` exists) diff --git a/src/core/content/commands/complete.ts b/src/core/content/commands/complete.ts index b302a9b..1137db8 100644 --- a/src/core/content/commands/complete.ts +++ b/src/core/content/commands/complete.ts @@ -17,7 +17,8 @@ Use the **pscode-complete** skill. what behavior/spec was Added, Changed or Removed. Keep it to one screen. 3. **Archive** the change: move \`pscode/changes//\` to \`pscode/changes/archive/-/\`. -4. **Stop and confirm** before archiving — don't archive automatically. +4. **Stop and confirm** before archiving — ask via \`AskUserQuestion\` (\`Sim\` / + \`Não\`, recommended first); don't archive automatically. ## GitHub sync (if \`pscode/github.yaml\` exists) diff --git a/src/core/content/commands/dev.ts b/src/core/content/commands/dev.ts index dc9a371..4ebbf85 100644 --- a/src/core/content/commands/dev.ts +++ b/src/core/content/commands/dev.ts @@ -30,14 +30,17 @@ Use the **pscode-github-sync** skill, in order: shift scope. If it conflicts with \`refine.md\` or expands scope, **stop and ask** before coding. 4. Take the **first unchecked** \`## Subtasks\` item, implement only that, show a - short diff, run the relevant validation, and ask before ticking it \`[x]\`. - After ticking, **close its sub-issue** on the card. Repeat for each subtask. + short diff, run the relevant validation, and ask before ticking it \`[x]\` — + via \`AskUserQuestion\` as a \`Sim\` / \`Não\` choice (recommended first), never as + plain prose. After ticking, **close its sub-issue** on the card. Repeat for + each subtask. 5. When every subtask is done **and the project builds and its tests pass** (use the project's own build/test commands), {{#pr}}mark the PR **Ready for Review** and move the card → **In Code Review** (\`review\`).{{/pr}}{{^pr}}move the card → **In Code Review** (\`review\`).{{/pr}} -6. With the user's approval, move the card → **In Test** (\`in_test\`). -7. Once the user confirms it is **working**, move the card → **Ready to Deploy** +6. With the user's approval (ask via \`AskUserQuestion\`, \`Sim\` / \`Não\`), move the + card → **In Test** (\`in_test\`). +7. Once the user confirms it is **working** (via \`AskUserQuestion\`), move the card → **Ready to Deploy** (\`ready_to_deploy\`) and post the **next-step comment** (\`/ps:complete \` in a fenced block). diff --git a/src/core/content/commands/draft.ts b/src/core/content/commands/draft.ts index 8c9f16d..db0e769 100644 --- a/src/core/content/commands/draft.ts +++ b/src/core/content/commands/draft.ts @@ -21,7 +21,8 @@ Use the **pscode-guided-sdd** skill (draft step). \`feat-padrao-titulo-card\`). The slug names the \`pscode/changes//\` folder. 2. Draft a **short description** — objective plus a line on expected behavior and what's out of scope. A few lines, not a spec. -3. **Stop and ask for validation** of the title and that description. +3. **Stop and ask for validation** of the title and that description — via + \`AskUserQuestion\` (\`Sim\` / \`Não\`, recommended first), never as plain prose. Do not ask the Grill Me questions, do not write a \`brief.md\`, and do not write code here. diff --git a/src/core/content/commands/refine.ts b/src/core/content/commands/refine.ts index 2e6ec68..5509f22 100644 --- a/src/core/content/commands/refine.ts +++ b/src/core/content/commands/refine.ts @@ -39,7 +39,8 @@ does not replace the status move; confirm the move landed. Non-blocking only on 4. Write \`refine.md\` in the standard format: lean summary, technical detail, in/out of scope, and a **\`## Subtasks\`** checklist (the unit \`/ps:dev\` runs). -Do not write production code in this step. **Stop and ask for approval.** +Do not write production code in this step. **Stop and ask for approval** — via +\`AskUserQuestion\` (offer the \`Está refinada\` answer first), never as plain prose. ## On approval (if \`pscode/github.yaml\` exists) diff --git a/src/core/content/index.ts b/src/core/content/index.ts index ed40d59..c0f5557 100644 --- a/src/core/content/index.ts +++ b/src/core/content/index.ts @@ -16,7 +16,10 @@ sends a card to Cancelled. **Rules (non-negotiable):** - Prefer the \`AskUserQuestion\` tool for any question — at every step — with a - recommended option first; it makes answering a one-tap choice. + recommended option first. This includes **yes/no confirmations** (e.g. "can I + mark \`[x]\` and close the sub-issue?"): pair them with an \`AskUserQuestion\` + offering \`Sim\` / \`Não\` (recommended first), never plain prose. It makes + answering a one-tap choice. - Do not advance to the next step without explicit user approval. - Implement one subtask at a time; never expand scope mid-subtask. - Keep every artifact short — each step fits on one terminal screen. diff --git a/src/core/content/skills/complete.ts b/src/core/content/skills/complete.ts index e391cc9..c854c55 100644 --- a/src/core/content/skills/complete.ts +++ b/src/core/content/skills/complete.ts @@ -8,7 +8,8 @@ export const complete: SkillSpec = { Close out a change and keep the history tidy. Two paths share this skill: **complete** (delivered → Done) and **cancel** (dropped → Cancelled). Both -**archive** the change and sync the board. Always **confirm before archiving**. +**archive** the change and sync the board. Always **confirm before archiving** — +ask via \`AskUserQuestion\` (\`Sim\` / \`Não\`, recommended first), never as plain prose. ## Complete path (\`/ps:complete\`) @@ -35,7 +36,9 @@ Close out a change and keep the history tidy. Two paths share this skill: ## Cancel path (\`/ps:cancel\`) -1. Ask the user for the **reason** to cancel. No delta spec is written. +1. Ask the user for the **reason** to cancel — via \`AskUserQuestion\`, offering a + few common reasons (e.g. \`Obsoleto\`, \`Duplicado\`, \`Fora de escopo\`) plus the + free-text field. No delta spec is written. 2. **Archive** the change to \`pscode/changes/archive/-/\`. 3. If \`pscode/github.yaml\` exists, use \`pscode-github-sync\`: **move the card → Cancelled** (\`cancelled\`) and confirm it landed, comment the reason, then @@ -43,7 +46,7 @@ Close out a change and keep the history tidy. Two paths share this skill: ## Golden rule -Confirm before archiving — never archive automatically. \`gh\` calls are +Confirm before archiving (via \`AskUserQuestion\`) — never archive automatically. \`gh\` calls are non-blocking only on failure, never optional: always *attempt* the status move, and if the sync fails, archive locally and report what to finish by hand. `, diff --git a/src/core/content/skills/dev.ts b/src/core/content/skills/dev.ts index c25b213..2f34e6f 100644 --- a/src/core/content/skills/dev.ts +++ b/src/core/content/skills/dev.ts @@ -43,8 +43,10 @@ expands scope, **stop and ask the user** rather than guessing. Use \`pscode-task-runner\` against \`refine.md\`'s \`## Subtasks\`: - Take the **first unchecked** subtask, implement only that, show a short diff. - Run the relevant validation and report the result. -- Ask before ticking it \`[x]\`. After ticking, **close the matching sub-issue** - on the card (via \`pscode-github-sync\`) so its progress bar stays accurate. +- Ask before ticking it \`[x]\` — through \`AskUserQuestion\` as a \`Sim\` / \`Não\` + choice (recommended first), e.g. "Subtask done. Marco \`[x]\` e fecho a + sub-issue #N?". After ticking, **close the matching sub-issue** on the card + (via \`pscode-github-sync\`) so its progress bar stays accurate. - Repeat. **Never expand scope mid-subtask.** ### 4. Code review gate @@ -58,10 +60,11 @@ or Makefile); don't assume a specific tool: ### 5. Test, then Ready to Deploy -- With the user's approval, move the card → **In Test** (\`in_test\`). -- Once the user confirms it is **working**, move the card → **Ready to Deploy** - (\`ready_to_deploy\`), then post the **next-step comment** (\`/ps:complete \` - in a fenced block) via \`pscode-github-sync\`. +- With the user's approval (ask via \`AskUserQuestion\`, \`Sim\` / \`Não\`), move the + card → **In Test** (\`in_test\`). +- Once the user confirms it is **working** (again via \`AskUserQuestion\`), move the + card → **Ready to Deploy** (\`ready_to_deploy\`), then post the **next-step + comment** (\`/ps:complete \` in a fenced block) via \`pscode-github-sync\`. ## Golden rule diff --git a/src/core/content/skills/guided-sdd.ts b/src/core/content/skills/guided-sdd.ts index 4908863..8c81fd4 100644 --- a/src/core/content/skills/guided-sdd.ts +++ b/src/core/content/skills/guided-sdd.ts @@ -32,7 +32,10 @@ without approval, and each step moves the card to the matching column (via - **Always prefer \`AskUserQuestion\`.** Whenever you need input from the user — at any step — ask through the \`AskUserQuestion\` tool, with a recommended option - first; the free-text field covers the rest. It makes answering effortless. + first (mark it \`(recomendado)\`); the free-text field covers the rest. This also + covers **yes/no confirmations**: never leave a "can I proceed?" / "can I mark + \`[x]\`?" question as plain prose — pair it with an \`AskUserQuestion\` offering + \`Sim\` / \`Não\` (recommended first). It makes answering a one-tap choice. - **Don't advance without approval.** Stop at the end of each step and ask. - **One subtask at a time.** Never expand scope mid-subtask. - **Keep artifacts short.** Each one fits on one terminal screen. diff --git a/src/core/content/skills/mini-spec.ts b/src/core/content/skills/mini-spec.ts index 1557f4a..1fc913b 100644 --- a/src/core/content/skills/mini-spec.ts +++ b/src/core/content/skills/mini-spec.ts @@ -25,6 +25,7 @@ One or two sentences. - Plain language; no unnecessary jargon. - Separate **objective**, **expected behavior** and **out of scope**. - Respect \`limits.max_brief_lines\` (\`pscode/config.yaml\`). If you exceed it, trim. -- When done, **stop and ask for approval**. +- When done, **stop and ask for approval** — via \`AskUserQuestion\` (\`Sim\` / \`Não\`, + recommended first), never as plain prose. `, }; diff --git a/src/core/content/skills/task-runner.ts b/src/core/content/skills/task-runner.ts index 4999dfe..d6f0820 100644 --- a/src/core/content/skills/task-runner.ts +++ b/src/core/content/skills/task-runner.ts @@ -16,9 +16,12 @@ checklist). This is the implementation loop inside \`/ps:dev\`. 3. Implement only that subtask. **Don't expand the scope.** 4. Show a short diff of what changed. 5. Run the relevant validation (tests/lint), if possible, and report the result. -6. Ask whether you can mark the subtask as done (\`- [x]\`). +6. Ask whether you can mark the subtask as done (\`- [x]\`) — put it through + \`AskUserQuestion\` as a \`Sim\` / \`Não\` choice (recommended first), never as plain + prose. Respect \`apply_mode: one_task_at_a_time\` and \`approval_required\` in -\`pscode/config.yaml\`. One task at a time, always with human validation. +\`pscode/config.yaml\`. One task at a time, always with human validation — every +"can I proceed?" goes through \`AskUserQuestion\`. `, }; diff --git a/test/unit/content.test.ts b/test/unit/content.test.ts index 7f4f3de..fa30e3e 100644 --- a/test/unit/content.test.ts +++ b/test/unit/content.test.ts @@ -2,6 +2,7 @@ import { describe, it, expect } from 'vitest'; import { COMMANDS } from '../../src/core/content/commands'; import { SKILLS } from '../../src/core/content/skills'; import { CHANGE_TEMPLATES } from '../../src/core/content/change-templates'; +import { AGENTS_BLOCK_BODY } from '../../src/core/content'; describe('guided-SDD content', () => { it('ships the board-aligned slash commands plus board-setup', () => { @@ -46,6 +47,38 @@ describe('guided-SDD content', () => { expect(byId['board-setup']).not.toContain('pscode-github-sync'); }); + it('routes every interactive command through AskUserQuestion', () => { + const byId = Object.fromEntries(COMMANDS.map((c) => [c.id, c.body])); + for (const id of ['draft', 'refine', 'dev', 'complete', 'cancel']) { + expect(byId[id]).toContain('AskUserQuestion'); + } + }); + + it('routes every interactive skill through AskUserQuestion', () => { + const byName = Object.fromEntries(SKILLS.map((s) => [s.name, s.body])); + for (const name of [ + 'pscode-guided-sdd', + 'pscode-grill-me', + 'pscode-refine', + 'pscode-mini-spec', + 'pscode-task-runner', + 'pscode-dev', + 'pscode-complete', + ]) { + expect(byName[name]).toContain('AskUserQuestion'); + } + }); + + it('makes the central directive cover yes/no confirmations with a recommended option', () => { + const guided = SKILLS.find((s) => s.name === 'pscode-guided-sdd')!.body; + for (const text of [AGENTS_BLOCK_BODY, guided]) { + expect(text).toContain('AskUserQuestion'); + expect(text).toContain('Sim'); + expect(text).toContain('Não'); + expect(text.toLowerCase()).toContain('recommended'); + } + }); + it('ships the four short change templates', () => { expect(CHANGE_TEMPLATES.map((t) => t.file)).toEqual([ 'brief.md',