Skip to content

fix(do): accept free-form /do <goal>, infer project from conversation#92

Merged
joedanz merged 1 commit into
mainfrom
fix/do-command-free-form-goal
May 6, 2026
Merged

fix(do): accept free-form /do <goal>, infer project from conversation#92
joedanz merged 1 commit into
mainfrom
fix/do-command-free-form-goal

Conversation

@joedanz
Copy link
Copy Markdown
Owner

@joedanz joedanz commented May 6, 2026

Summary

The /do command previously rejected any args that didn't match the strict work on <goal> in <project> grammar — so /do fix the readme typo printed Could not parse \/do` arguments. But the conversation already carries a snapshot project_id, so the explicit in ` is only needed when overriding it.

This change adds a free-form fallback: when the strict parser fails, fall through to parseRoutedMessage (the same parser the routed-channel chat path uses) and use the snapshot project.

Behavior

Input Before After
/do resume-from-brainstorm unchanged
/do work on X in mission parse + override snapshot unchanged
/do work on X in nonexistent hard-reject (E9) unchanged
/do fix the readme typo "Could not parse" error snapshot project + free-form goal
/do fix it, branch off feat/x "Could not parse" error snapshot project + branchRef extracted
free-form, no snapshot n/a REPLY_DO_NO_PROJECT

The strict parse succeeds only on the work on … in … shape, so all explicit-override paths are byte-identical.

Test plan

  • Vitest: 11/11 in do-command.test.ts (8 existing + 3 new — free-form goal, branch tail, no-snapshot)
  • Vitest: 78/78 in packages/core/src/messaging
  • pnpm build clean
  • pnpm typecheck clean
  • biome check clean on all touched files
  • Manual: send /do fix the panic in a Discord DM tied to a project — should promote to a task using the snapshot project

Previously `/do` rejected any args that didn't match the strict
`work on <goal> in <project>` grammar. The conversation already
carries a snapshot project_id, so the explicit `in <project>` is
only needed when overriding. Free-form args now fall through to
`parseRoutedMessage` and use the snapshot project.

- `/do fix the bug` — uses snapshot project + args as goal (NEW)
- `/do work on X in mission` — explicit override (unchanged)
- `/do` alone — resume-from-brainstorm prompt (unchanged)
- Trailing `branch off <ref>` works in free-form mode too

Hard-reject for `work on X in <bad-slug>` is preserved (E9 semantics).
Free-form with no snapshot still returns REPLY_DO_NO_PROJECT.
@joedanz joedanz merged commit aa951d1 into main May 6, 2026
3 checks passed
@joedanz joedanz deleted the fix/do-command-free-form-goal branch May 6, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant