Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .changeset/askuserquestion-em-todas-as-skills.md
Original file line number Diff line number Diff line change
@@ -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`.
11 changes: 11 additions & 0 deletions .changeset/card-title-pattern.md
Original file line number Diff line number Diff line change
@@ -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 `[<tipo>] <descrição>`
(tipos de commit: `feat`, `fix`, `refactor`, `test`, `docs`, `chore`) e o slug
interno como `<tipo>-<descrição-kebab>`. 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.
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
7 changes: 5 additions & 2 deletions src/core/content/commands/cancel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/<slug>/\` to
\`pscode/changes/archive/<YYYY-MM-DD>-<slug>/\`.
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)

Expand Down
3 changes: 2 additions & 1 deletion src/core/content/commands/complete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/<slug>/\` to
\`pscode/changes/archive/<YYYY-MM-DD>-<slug>/\`.
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)

Expand Down
11 changes: 7 additions & 4 deletions src/core/content/commands/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <card#>\`
in a fenced block).

Expand Down
3 changes: 2 additions & 1 deletion src/core/content/commands/draft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ Use the **pscode-guided-sdd** skill (draft step).
\`feat-padrao-titulo-card\`). The slug names the \`pscode/changes/<slug>/\` 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.
Expand Down
3 changes: 2 additions & 1 deletion src/core/content/commands/refine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
5 changes: 4 additions & 1 deletion src/core/content/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 6 additions & 3 deletions src/core/content/skills/complete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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\`)

Expand All @@ -35,15 +36,17 @@ 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/<YYYY-MM-DD>-<slug>/\`.
3. If \`pscode/github.yaml\` exists, use \`pscode-github-sync\`: **move the card →
Cancelled** (\`cancelled\`) and confirm it landed, comment the reason, then
**close** the Issue.

## 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.
`,
Expand Down
15 changes: 9 additions & 6 deletions src/core/content/skills/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 <card#>\`
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 <card#>\` in a fenced block) via \`pscode-github-sync\`.

## Golden rule

Expand Down
5 changes: 4 additions & 1 deletion src/core/content/skills/guided-sdd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 2 additions & 1 deletion src/core/content/skills/mini-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
`,
};
7 changes: 5 additions & 2 deletions src/core/content/skills/task-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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\`.
`,
};
33 changes: 33 additions & 0 deletions test/unit/content.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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',
Expand Down
Loading