Commit graph

3 commits

Author SHA1 Message Date
matt wilkie
ba46bd5f3b
fix: repair nightly test failures for TestInitCancel_E2E and dolt autostart (#2969)
TestInitCancel_E2E: The --contributor flag was rejected because
isNonInteractiveInit() detected non-interactive mode (CI=true + piped
stdin). Fix by supporting BD_NON_INTERACTIVE=0/false to explicitly
force interactive mode, and set it in the test env.

TestE2E_AutoStartedRepoLocalServerPersistsAcrossCommands: init
defaulted to embedded mode since a35edfd2, but the test needs server
mode for dolt status/start/stop. Fix by adding --server to init args.

Also adds unit tests for the new BD_NON_INTERACTIVE=0 override.

Amp-Thread-ID: https://ampcode.com/threads/T-019d4f2d-9137-742b-bf44-ed413fe59cd0

Co-authored-by: Amp <amp@ampcode.com>
2026-04-02 11:04:32 -07:00
beads/crew/emma
999f87593c fix(test): remove tautological TestRoleFlagValidation
TestRoleFlagValidation reimplemented the same switch statement from production
code and tested its own local logic instead of exercising the actual role
validation in init.go. Remove it — the production validation (which calls
FatalError/os.Exit) is better covered by integration tests, and this unit
test provided false confidence.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 20:32:22 -07:00
Harry
5e60961852 feat(init): add --non-interactive and --role flags for CI/cloud agents
Add --non-interactive flag to bd init that skips all interactive prompts,
enabling autonomous CI/GHA workflows to run bd init without blocking.

Non-interactive mode is resolved with precedence:
  1. --non-interactive flag (explicit)
  2. BD_NON_INTERACTIVE=1 env var
  3. CI=true env var
  4. stdin is not a terminal (auto-detected)

When non-interactive:
  - Role defaults to "maintainer" (override with --role flag)
  - Fork .git/info/exclude is auto-configured when fork detected
  - --contributor/--team wizards are rejected (require interaction)
  - Existing force-destroy handling (--destroy-token) is unchanged

Add --role flag to set beads.role without prompting. Accepts
"maintainer" or "contributor". Overrides existing role when
explicitly provided.

Backward compatible: without --non-interactive, all existing
interactive behavior is preserved.

Closes: bd-v2u

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-30 12:28:04 -07:00