Skip to content

Detect missing auth settings and exit hooks#332

Open
michael-webster wants to merge 3 commits into
mainfrom
fact-140-auth-check-hook
Open

Detect missing auth settings and exit hooks#332
michael-webster wants to merge 3 commits into
mainfrom
fact-140-auth-check-hook

Conversation

@michael-webster
Copy link
Copy Markdown
Contributor

@michael-webster michael-webster commented May 13, 2026

Detect missing CircleCI auth settings and exits code 1 to indicate a failure.

Adds `chunk auth check` for use in hooks: exits 1 with an actionable
message directing users to run `chunk auth set circleci` when no token
is configured. Uses a silent-exit error type so main.go exits cleanly
without reprinting the message.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@michael-webster michael-webster force-pushed the fact-140-auth-check-hook branch from 7bdb9b1 to 061a8a6 Compare May 13, 2026 17:18
Comment thread internal/cmd/usererr.go
// silentExitError carries an exit code. main.go detects ExitCode() and calls
// os.Exit directly, skipping further error printing. Use after writing your
// own message to stderr.
type silentExitError struct{ code int }
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using this since we are controlling the output for the agent.

…mmand

chunk validate now exits with ExitAuthError (3) and the existing
suggestionCircleCIAuth hint when running as a Stop hook and CircleCI
auth is not configured but remote commands are present. Previously the
hook would silently fall back to local execution, hiding the auth
problem from the agent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@michael-webster michael-webster force-pushed the fact-140-auth-check-hook branch from 061a8a6 to 59907e6 Compare May 13, 2026 17:21
@michael-webster michael-webster marked this pull request as ready for review May 13, 2026 17:22
Resolves rc once at the same scope level so the token resolution path
is consistent with ensureCircleCIClient and not bypassed by nesting.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@hanabel1
Copy link
Copy Markdown
Contributor

don't know if I'm missing it, but where is the chunk auth check command ..

@michael-webster michael-webster changed the title Add chunk auth check command that exits 1 when CircleCI auth is missing Detect missing auth settings and exit hooks May 15, 2026
@michael-webster
Copy link
Copy Markdown
Contributor Author

don't know if I'm missing it, but where is the chunk auth check command ..

Ah stale PR description. I decided to instead detect the missing settings directly.

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.

2 participants