Skip to content

fix: /init with no args — accept follow-up as cast prompt, create team files in fresh projects#217

Merged
bradygaster merged 3 commits intobradygaster:devfrom
williamhallatt:williamhallatt/216-init-no-args-broken
Mar 7, 2026
Merged

fix: /init with no args — accept follow-up as cast prompt, create team files in fresh projects#217
bradygaster merged 3 commits intobradygaster:devfrom
williamhallatt:williamhallatt/216-init-no-args-broken

Conversation

@williamhallatt
Copy link
Copy Markdown
Contributor

Closes #216

Summary

Fixes two related bugs in the /init no-args TUI flow that together produced the UX shown in the issue.


Bug 1 — Follow-up message ignored after /init (no args)

Fix:

  • Added awaitInitPrompt?: boolean to CommandResult interface (commands.ts)
  • Added awaitingInitPrompt state to App.tsx — when set, the next non-slash message is intercepted and dispatched as a coordinator cast with skipCastConfirmation: false
  • Added bypass in handleDispatch (index.ts): when parsed.skipCastConfirmation !== undefined, skip the team-file guard and call handleInitCast directly

Bug 2 — After team is hired, coordinator says "no team yet"

Found during smoke testing. After confirming y to the team proposal in a fresh project, the TUI showed:

✅ Team hired! 7 members created.
📌 Routing your message to the team now...
Squad: This project doesn't have a Squad team yet.

Root cause: createTeam in cast.ts only ran the if (existsSync(teamPath)) update path. In a fresh project (no .squad/ directory), neither team.md nor routing.md existed, so both were silently skipped. buildCoordinatorPrompt then failed to read the missing team.md and fell back to its NO TEAM CONFIGURED instructions.

Fix: Added else branches to create team.md and routing.md from scratch when the files don't exist. The ## Members table is populated with data rows so hasRosterEntries() returns true and the coordinator enters Team Mode correctly.


Files changed

File Change
packages/squad-cli/src/cli/shell/commands.ts Added awaitInitPrompt? to CommandResult; handleInit sets it on no-args path
packages/squad-cli/src/cli/shell/components/App.tsx awaitingInitPrompt state; intercepts follow-up message and routes as cast
packages/squad-cli/src/cli/shell/index.ts handleDispatch bypasses team-file guard when skipCastConfirmation !== undefined
packages/squad-cli/src/cli/core/cast.ts createTeam now creates team.md and routing.md in fresh projects
test/init-autocast.test.ts 8 new test cases for the follow-up routing fix
test/cast-parser.test.ts 9 new integration tests for createTeam (fresh + existing project paths)

All 63 tests pass (npx vitest run test/init-autocast.test.ts test/cast-parser.test.ts).

@williamhallatt williamhallatt changed the base branch from main to dev March 6, 2026 03:15
…radygaster#216)

When the user runs '/init' with no inline prompt, the TUI showed guidance
text but did not track any state. The user's next message then hit the
'No Squad team found' guard in handleDispatch and showed an error instead
of starting team casting.

Changes:
- commands.ts: add awaitInitPrompt?: boolean to CommandResult; set it in
  the no-args /init path alongside the existing guidance output
- App.tsx: track awaitingInitPrompt state; when set, route the next
  non-slash message as a coordinator cast with skipCastConfirmation: false
  (shows confirmation dialog, same as freeform cast)
- index.ts handleDispatch: when skipCastConfirmation is explicitly set
  (true or false, not undefined) and team.md is absent, bypass the
  'No Squad team found' guard and call handleInitCast directly

This means the full init flow now works end-to-end:
  /init            → guidance text + set awaitingInitPrompt
  <description>    → routed as cast → handleInitCast → team proposed
  y                → finalizeCast → team files created
  <original msg>   → re-dispatched to the new team

Tests added in test/init-autocast.test.ts covering:
- awaitInitPrompt=true on no-args /init
- awaitInitPrompt=true on whitespace-only args
- awaitInitPrompt undefined when inline prompt provided
- guard bypass contract for skipCastConfirmation values
In a fresh project (no .squad/ directory), createTeam was only running
the 'if (existsSync(teamPath))' update path, silently skipping both
team.md and routing.md creation. After finalizeCast, dispatchToCoordinator
would build a new session, buildCoordinatorPrompt would fail to read
team.md, and the coordinator would fall through to the 'NO TEAM CONFIGURED'
prompt -- telling the user to run /init again.

Fix: add else-branches to create team.md and routing.md from scratch when
the files don't yet exist. The fresh team.md includes a proper ## Members
section with data rows so hasRosterEntries() returns true and the
coordinator enters Team Mode correctly.

Tests: 9 new createTeam integration tests in cast-parser.test.ts covering:
- fresh project creates team.md with ## Members data rows
- fresh project creates routing.md
- project description included in header
- hasRosterEntries passes after createTeam (coordinator regression guard)
- built-in Scribe and Ralph added
- agent charter and history files created
- existing project Members section updated without clobbering surrounding content
- existing project passes hasRosterEntries after update
@williamhallatt williamhallatt force-pushed the williamhallatt/216-init-no-args-broken branch from fd217e4 to f8ea328 Compare March 6, 2026 03:22
williamhallatt added a commit to williamhallatt/squad that referenced this pull request Mar 6, 2026
)

Closes bradygaster#218

Five gaps identified during PR bradygaster#217 contribution from a fork:
- Fork-first setup instructions in Getting Started
- PR process now specifies --base dev and explicit --head
- Changeset added as a required step in the PR checklist
- Branch Strategy: bradygaster/dev clarified as PR target for all contributions
- New 'Keeping Your Fork in Sync' section with rebase instructions

Also captures fork procedure in Kobayashi's charter (permanent procedure)
and history (lessons from today's session).
@bradygaster bradygaster merged commit 20970f9 into bradygaster:dev Mar 7, 2026
1 check failed
@williamhallatt williamhallatt deleted the williamhallatt/216-init-no-args-broken branch March 7, 2026 01:27
bradygaster added a commit that referenced this pull request Mar 7, 2026
Session: 2026-03-07T01-13-00Z-phase2-complete
Requested by: Brady

Changes:
- Merged 3 inbox decisions (Kobayashi PR merges, Keaton community PRs, Fenster template fix)
- Logged orchestration results for all 3 agents (Kobayashi, Keaton, Hockney)
- Logged Phase 2 session completion
- Appended Phase 2 results to agent history files (cross-agent updates)
- Deduplicated: No duplicate decisions found; all 3 inbox items were new.

Merges completed:
- PR #232: Scribe runtime state fix (86598f4)
- PR #212: Version stamp preservation (0fedcce)
- PR #230: CLI wire-up squad link + squad init --mode remote (6d0bd56)
- PR #217: TUI /init no-args flow fix (20970f9)
- PR #219: Fork contribution workflow docs (157b8c0)

Test results: 130/134 test files passing. 12 pre-existing failures in consult, REPL, status, acceptance modes. Core CLI solid.
jongio pushed a commit to jongio/squad that referenced this pull request Mar 9, 2026
…#217)

- Update Quick Start section with npm install as primary option
- Add Legacy section for GitHub-native distribution reference
- Add Monorepo Development section documenting build/test/lint workflow
- Update command table to show 'squad' command format
- Update help text in src/index.ts to reflect npm-based installation
- Add Installation and Insider channel sections to help output
- Create CONTRIBUTING.md with development workflow and monorepo guide

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jongio pushed a commit to jongio/squad that referenced this pull request Mar 9, 2026
…help-update

docs: update README, help output, and add CONTRIBUTING.md (bradygaster#217)
jongio pushed a commit to jongio/squad that referenced this pull request Mar 9, 2026
Session: 2026-02-21T2225-m5-docs-bugfix
Scribe: Merged decision inbox and logged orchestration

Changes:
- Created orchestration logs for McManus (docs bradygaster#217), Fenster (guard bradygaster#273), Kobayashi (blocked bradygaster#209)
- Created session log: M5 round with two PRs merged, one issue blocked
- Merged decisions: ensureSquadPath() guard, CLI routing testability pattern
- Deleted merged inbox files: fenster-no-root-clutter.md, hockney-resolution-tests.md
- Updated agents history.md with cross-team updates
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.

TUI: init command without inline prompt does not accept follow-up message as project description

2 participants