From 22507483b8de861b16f6bd6810adf331a362105b Mon Sep 17 00:00:00 2001 From: bgagent Date: Wed, 17 Jun 2026 15:32:33 -0400 Subject: [PATCH] fix(jira): validate repo onboarding at map time (#369) bgagent jira map (and linear onboard-project) accepted and persisted a project->repo mapping for a repo with no active Blueprint. Every label trigger then failed at task creation with 422 REPO_NOT_ONBOARDED, with no visible operator feedback. Add a shared checkRepoOnboarding helper (cli/src/repo-onboarding.ts) that reads the RepoTable via the RepoTableName stack output and reports whether the repo has a status='active' row -- mirroring the runtime gate in repo-config.ts. Both map commands now refuse (with actionable guidance) to persist a mapping for a non-onboarded repo, unless --skip-onboarding-check is passed. An inconclusive check (missing output / IAM gap) warns and proceeds rather than blocking a valid mapping. Linear's onboard-project gets the same guard since it shares the create-task-core onboarding gate. Docs: JIRA_SETUP_GUIDE.md and LINEAR_SETUP_GUIDE.md state the Blueprint-onboarding prerequisite and document --skip-onboarding-check; Starlight mirrors regenerated. Tests: new repo-onboarding.test.ts plus map-guard cases in jira/linear command tests (423 pass). --- cli/src/commands/jira.ts | 19 +++ cli/src/commands/linear.ts | 19 +++ cli/src/repo-onboarding.ts | 150 ++++++++++++++++++ cli/test/commands/jira.test.ts | 70 +++++++- cli/test/commands/linear.test.ts | 93 ++++++++++- cli/test/repo-onboarding.test.ts | 125 +++++++++++++++ docs/guides/JIRA_SETUP_GUIDE.md | 6 + docs/guides/LINEAR_SETUP_GUIDE.md | 7 +- .../content/docs/using/Jira-setup-guide.md | 6 + .../content/docs/using/Linear-setup-guide.md | 7 +- 10 files changed, 494 insertions(+), 8 deletions(-) create mode 100644 cli/src/repo-onboarding.ts create mode 100644 cli/test/repo-onboarding.test.ts diff --git a/cli/src/commands/jira.ts b/cli/src/commands/jira.ts index 46e799fa..3b4139c1 100644 --- a/cli/src/commands/jira.ts +++ b/cli/src/commands/jira.ts @@ -44,6 +44,7 @@ import { StoredJiraOauthToken, } from '../jira-oauth'; import { awaitOauthCallback, CALLBACK_URL } from '../oauth-callback-server'; +import { checkRepoOnboarding, notOnboardedGuidance } from '../repo-onboarding'; /** Default label that triggers an ABCA task when applied to a Jira issue. */ const DEFAULT_LABEL_FILTER = 'bgagent'; @@ -652,6 +653,7 @@ export function makeJiraCommand(): Command { .option('--label