@iloom/cli 0.12.0 → 0.13.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -2
- package/dist/{ClaudeContextManager-IENAE2CP.js → ClaudeContextManager-RRGREEZQ.js} +4 -4
- package/dist/{ClaudeService-YIJCZUUB.js → ClaudeService-LEPW6QAC.js} +3 -3
- package/dist/{IssueTrackerFactory-2OI7YIN6.js → IssueTrackerFactory-KE2BDCLC.js} +3 -3
- package/dist/{LoomLauncher-3TSFW7QP.js → LoomLauncher-GKQMR5E6.js} +4 -4
- package/dist/README.md +17 -2
- package/dist/{SettingsManager-BMQCAXPP.js → SettingsManager-KQU7OX7G.js} +4 -2
- package/dist/{build-DMWSIME6.js → build-V3KADFMO.js} +6 -6
- package/dist/{chunk-QFDM23CO.js → chunk-3XEXT35Z.js} +2 -2
- package/dist/{chunk-FV4KXBGO.js → chunk-4VQXMEEP.js} +2 -2
- package/dist/{chunk-V5IYLWRA.js → chunk-H3T3EPF3.js} +2 -2
- package/dist/{chunk-QF2DROQR.js → chunk-JDN4SPV3.js} +2 -2
- package/dist/{chunk-M3FBM4T3.js → chunk-KQSV7FOG.js} +2 -2
- package/dist/{chunk-R7DGN73N.js → chunk-NTDY5AMO.js} +2 -2
- package/dist/{chunk-35CBWAJL.js → chunk-NUUFP53X.js} +2 -2
- package/dist/{chunk-IS46GQRA.js → chunk-PD75ZCFT.js} +14 -14
- package/dist/chunk-PD75ZCFT.js.map +1 -0
- package/dist/{chunk-EQIII6GI.js → chunk-Q7VXHJP6.js} +3 -3
- package/dist/{chunk-IHSA7VGI.js → chunk-QED2WB2D.js} +4 -4
- package/dist/{chunk-OPQC4OWM.js → chunk-QNPJXO53.js} +3 -3
- package/dist/{chunk-YWNF5755.js → chunk-QQULYI2S.js} +2 -2
- package/dist/{chunk-HIGWKLQR.js → chunk-QXGM32TO.js} +2 -2
- package/dist/{chunk-PMB6TYV4.js → chunk-RFCAPHL5.js} +2 -2
- package/dist/{chunk-OKB2NEDQ.js → chunk-SA446KA2.js} +5 -5
- package/dist/{chunk-ZM2AYHMO.js → chunk-SN4S5CWL.js} +2 -2
- package/dist/{chunk-XVCGPTEQ.js → chunk-TAEVA4QR.js} +2 -2
- package/dist/chunk-TAEVA4QR.js.map +1 -0
- package/dist/{chunk-PDG74IJT.js → chunk-TN2D2RX7.js} +22 -20
- package/dist/chunk-TN2D2RX7.js.map +1 -0
- package/dist/{chunk-GWJWECZB.js → chunk-VVQQIG64.js} +16 -17
- package/dist/{chunk-GWJWECZB.js.map → chunk-VVQQIG64.js.map} +1 -1
- package/dist/{chunk-653XBU3L.js → chunk-WGUGB54H.js} +10 -1
- package/dist/chunk-WGUGB54H.js.map +1 -0
- package/dist/{chunk-KCZSUJUR.js → chunk-X5DRLONY.js} +4 -4
- package/dist/{chunk-VA6CWUAE.js → chunk-XCP2WDYA.js} +2 -2
- package/dist/{chunk-HKEXRZMU.js → chunk-YUOVWWJX.js} +310 -5
- package/dist/chunk-YUOVWWJX.js.map +1 -0
- package/dist/{chunk-BFF27W3S.js → chunk-ZUIFO7B4.js} +2 -2
- package/dist/{cleanup-RLBLNQZN.js → cleanup-RJKLI47I.js} +19 -19
- package/dist/cleanup-RJKLI47I.js.map +1 -0
- package/dist/cli.js +89 -85
- package/dist/cli.js.map +1 -1
- package/dist/{commit-RILBXFWO.js → commit-SUHRUMDE.js} +6 -6
- package/dist/{compile-QEL5724K.js → compile-2MD346PO.js} +6 -6
- package/dist/{contribute-EHWLYOMZ.js → contribute-P4BMRY7C.js} +3 -3
- package/dist/database-helpers-PRDFNDRO.js +11 -0
- package/dist/{dev-server-2WSWZXJG.js → dev-server-ZNTLWOL5.js} +8 -8
- package/dist/{feedback-I6ZEHEUB.js → feedback-Q6WG2WX4.js} +2 -2
- package/dist/{git-I3PO6FY7.js → git-TX2IEMB3.js} +3 -3
- package/dist/{ignite-XZFYRVRJ.js → ignite-P644W2PK.js} +9 -9
- package/dist/index.d.ts +36 -2
- package/dist/index.js +17 -9
- package/dist/index.js.map +1 -1
- package/dist/{init-A6WRP77L.js → init-5HFY7JG6.js} +5 -5
- package/dist/{install-deps-HXP2TM7G.js → install-deps-J4ALTM27.js} +6 -6
- package/dist/{issues-SUFQJY6O.js → issues-LZMIF22U.js} +4 -4
- package/dist/{lint-FDZC77GL.js → lint-XIXKU22H.js} +6 -6
- package/dist/mcp/issue-management-server.js +8 -0
- package/dist/mcp/issue-management-server.js.map +1 -1
- package/dist/{open-US4XACLW.js → open-KUO35JIJ.js} +8 -8
- package/dist/{plan-PL3ZB32J.js → plan-7CF56OIR.js} +17 -17
- package/dist/prompts/init-prompt.txt +24 -0
- package/dist/prompts/issue-prompt.txt +1 -1
- package/dist/prompts/regular-prompt.txt +1 -1
- package/dist/{rebase-JA3RW2XO.js → rebase-MAMWPA2L.js} +5 -5
- package/dist/{recap-5TO42HN2.js → recap-IDBO3KM5.js} +6 -6
- package/dist/{run-KKCRBRLW.js → run-RGZHCQ6M.js} +8 -8
- package/dist/schema/settings.schema.json +24 -0
- package/dist/{shell-GAB2FCXH.js → shell-7ADCDFIV.js} +5 -5
- package/dist/{summary-P7QE3TNW.js → summary-7J2HORFD.js} +7 -7
- package/dist/{test-6LFB5WOO.js → test-SRB7EWU6.js} +6 -6
- package/dist/{test-git-PYJOYSED.js → test-git-G7ATVIXG.js} +3 -3
- package/dist/{test-jira-SM7IU5HW.js → test-jira-Q2HPA522.js} +3 -3
- package/dist/{test-prefix-HIRZBXTM.js → test-prefix-JMDGXR5A.js} +3 -3
- package/dist/{test-webserver-43PVP2JL.js → test-webserver-GZFVXBGD.js} +5 -5
- package/dist/{vscode-HXIXRZ3A.js → vscode-3I7ISHUU.js} +5 -5
- package/package.json +1 -1
- package/dist/chunk-653XBU3L.js.map +0 -1
- package/dist/chunk-HKEXRZMU.js.map +0 -1
- package/dist/chunk-IS46GQRA.js.map +0 -1
- package/dist/chunk-PDG74IJT.js.map +0 -1
- package/dist/chunk-XVCGPTEQ.js.map +0 -1
- package/dist/cleanup-RLBLNQZN.js.map +0 -1
- package/dist/neon-helpers-LCZAN4U4.js +0 -11
- /package/dist/{ClaudeContextManager-IENAE2CP.js.map → ClaudeContextManager-RRGREEZQ.js.map} +0 -0
- /package/dist/{ClaudeService-YIJCZUUB.js.map → ClaudeService-LEPW6QAC.js.map} +0 -0
- /package/dist/{IssueTrackerFactory-2OI7YIN6.js.map → IssueTrackerFactory-KE2BDCLC.js.map} +0 -0
- /package/dist/{LoomLauncher-3TSFW7QP.js.map → LoomLauncher-GKQMR5E6.js.map} +0 -0
- /package/dist/{SettingsManager-BMQCAXPP.js.map → SettingsManager-KQU7OX7G.js.map} +0 -0
- /package/dist/{build-DMWSIME6.js.map → build-V3KADFMO.js.map} +0 -0
- /package/dist/{chunk-QFDM23CO.js.map → chunk-3XEXT35Z.js.map} +0 -0
- /package/dist/{chunk-FV4KXBGO.js.map → chunk-4VQXMEEP.js.map} +0 -0
- /package/dist/{chunk-V5IYLWRA.js.map → chunk-H3T3EPF3.js.map} +0 -0
- /package/dist/{chunk-QF2DROQR.js.map → chunk-JDN4SPV3.js.map} +0 -0
- /package/dist/{chunk-M3FBM4T3.js.map → chunk-KQSV7FOG.js.map} +0 -0
- /package/dist/{chunk-R7DGN73N.js.map → chunk-NTDY5AMO.js.map} +0 -0
- /package/dist/{chunk-35CBWAJL.js.map → chunk-NUUFP53X.js.map} +0 -0
- /package/dist/{chunk-EQIII6GI.js.map → chunk-Q7VXHJP6.js.map} +0 -0
- /package/dist/{chunk-IHSA7VGI.js.map → chunk-QED2WB2D.js.map} +0 -0
- /package/dist/{chunk-OPQC4OWM.js.map → chunk-QNPJXO53.js.map} +0 -0
- /package/dist/{chunk-YWNF5755.js.map → chunk-QQULYI2S.js.map} +0 -0
- /package/dist/{chunk-HIGWKLQR.js.map → chunk-QXGM32TO.js.map} +0 -0
- /package/dist/{chunk-PMB6TYV4.js.map → chunk-RFCAPHL5.js.map} +0 -0
- /package/dist/{chunk-OKB2NEDQ.js.map → chunk-SA446KA2.js.map} +0 -0
- /package/dist/{chunk-ZM2AYHMO.js.map → chunk-SN4S5CWL.js.map} +0 -0
- /package/dist/{chunk-KCZSUJUR.js.map → chunk-X5DRLONY.js.map} +0 -0
- /package/dist/{chunk-VA6CWUAE.js.map → chunk-XCP2WDYA.js.map} +0 -0
- /package/dist/{chunk-BFF27W3S.js.map → chunk-ZUIFO7B4.js.map} +0 -0
- /package/dist/{commit-RILBXFWO.js.map → commit-SUHRUMDE.js.map} +0 -0
- /package/dist/{compile-QEL5724K.js.map → compile-2MD346PO.js.map} +0 -0
- /package/dist/{contribute-EHWLYOMZ.js.map → contribute-P4BMRY7C.js.map} +0 -0
- /package/dist/{git-I3PO6FY7.js.map → database-helpers-PRDFNDRO.js.map} +0 -0
- /package/dist/{dev-server-2WSWZXJG.js.map → dev-server-ZNTLWOL5.js.map} +0 -0
- /package/dist/{feedback-I6ZEHEUB.js.map → feedback-Q6WG2WX4.js.map} +0 -0
- /package/dist/{ignite-XZFYRVRJ.js.map → git-TX2IEMB3.js.map} +0 -0
- /package/dist/{neon-helpers-LCZAN4U4.js.map → ignite-P644W2PK.js.map} +0 -0
- /package/dist/{init-A6WRP77L.js.map → init-5HFY7JG6.js.map} +0 -0
- /package/dist/{install-deps-HXP2TM7G.js.map → install-deps-J4ALTM27.js.map} +0 -0
- /package/dist/{issues-SUFQJY6O.js.map → issues-LZMIF22U.js.map} +0 -0
- /package/dist/{lint-FDZC77GL.js.map → lint-XIXKU22H.js.map} +0 -0
- /package/dist/{open-US4XACLW.js.map → open-KUO35JIJ.js.map} +0 -0
- /package/dist/{plan-PL3ZB32J.js.map → plan-7CF56OIR.js.map} +0 -0
- /package/dist/{rebase-JA3RW2XO.js.map → rebase-MAMWPA2L.js.map} +0 -0
- /package/dist/{recap-5TO42HN2.js.map → recap-IDBO3KM5.js.map} +0 -0
- /package/dist/{run-KKCRBRLW.js.map → run-RGZHCQ6M.js.map} +0 -0
- /package/dist/{shell-GAB2FCXH.js.map → shell-7ADCDFIV.js.map} +0 -0
- /package/dist/{summary-P7QE3TNW.js.map → summary-7J2HORFD.js.map} +0 -0
- /package/dist/{test-6LFB5WOO.js.map → test-SRB7EWU6.js.map} +0 -0
- /package/dist/{test-git-PYJOYSED.js.map → test-git-G7ATVIXG.js.map} +0 -0
- /package/dist/{test-jira-SM7IU5HW.js.map → test-jira-Q2HPA522.js.map} +0 -0
- /package/dist/{test-prefix-HIRZBXTM.js.map → test-prefix-JMDGXR5A.js.map} +0 -0
- /package/dist/{test-webserver-43PVP2JL.js.map → test-webserver-GZFVXBGD.js.map} +0 -0
- /package/dist/{vscode-HXIXRZ3A.js.map → vscode-3I7ISHUU.js.map} +0 -0
|
@@ -137,9 +137,17 @@ var NeonSettingsSchema = z.object({
|
|
|
137
137
|
projectId: z.string().min(1).regex(/^[a-zA-Z0-9-]+$/, "Neon project ID must contain only letters, numbers, and hyphens").describe('Neon project ID found in your project URL (e.g., "fantastic-fox-3566354")'),
|
|
138
138
|
parentBranch: z.string().min(1).describe("Branch from which new database branches are created")
|
|
139
139
|
});
|
|
140
|
+
var SupabaseSettingsSchema = z.object({
|
|
141
|
+
projectRef: z.string().min(1).describe('Supabase project reference ID (e.g., "abcdefghijklmnop")'),
|
|
142
|
+
parentBranch: z.string().min(1).optional().describe("Reserved for future use. Supabase currently always branches from the default branch."),
|
|
143
|
+
withData: z.boolean().optional().describe("Whether to include data when creating a new branch (defaults to true)")
|
|
144
|
+
});
|
|
140
145
|
var DatabaseProvidersSettingsSchema = z.object({
|
|
141
146
|
neon: NeonSettingsSchema.optional().describe(
|
|
142
147
|
"Neon database configuration. Requires Neon CLI installed and authenticated for database branching."
|
|
148
|
+
),
|
|
149
|
+
supabase: SupabaseSettingsSchema.optional().describe(
|
|
150
|
+
"Supabase database configuration. Requires Supabase CLI installed and authenticated for database branching."
|
|
143
151
|
)
|
|
144
152
|
}).optional();
|
|
145
153
|
var IloomSettingsSchema = z.object({
|
|
@@ -673,10 +681,11 @@ export {
|
|
|
673
681
|
DevServerSettingsSchema,
|
|
674
682
|
DevServerSettingsSchemaNoDefaults,
|
|
675
683
|
NeonSettingsSchema,
|
|
684
|
+
SupabaseSettingsSchema,
|
|
676
685
|
DatabaseProvidersSettingsSchema,
|
|
677
686
|
IloomSettingsSchema,
|
|
678
687
|
IloomSettingsSchemaNoDefaults,
|
|
679
688
|
redactSensitiveFields,
|
|
680
689
|
SettingsManager
|
|
681
690
|
};
|
|
682
|
-
//# sourceMappingURL=chunk-
|
|
691
|
+
//# sourceMappingURL=chunk-WGUGB54H.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/SettingsManager.ts"],"sourcesContent":["import { readFile } from 'fs/promises'\nimport path from 'path'\nimport os from 'os'\nimport { z } from 'zod'\nimport deepmerge from 'deepmerge'\nimport { logger } from '../utils/logger.js'\n\n// Merge mode: canonical values + legacy aliases accepted at parse time\nexport const mergeModeValues = ['local', 'pr', 'draft-pr', 'github-pr', 'github-draft-pr', 'bitbucket-pr'] as const\nexport type MergeMode = 'local' | 'pr' | 'draft-pr'\nconst mergeModeTransform = (val: string): MergeMode => {\n\tconst map: Record<string, MergeMode> = { 'github-pr': 'pr', 'github-draft-pr': 'draft-pr', 'bitbucket-pr': 'pr' }\n\treturn (map[val] ?? val) as MergeMode\n}\n\n/**\n * Zod schema for base agent settings (without nested agents)\n */\nexport const BaseAgentSettingsSchema = z.object({\n\tmodel: z\n\t\t.enum(['sonnet', 'opus', 'haiku'])\n\t\t.optional()\n\t\t.describe('Claude model shorthand: sonnet, opus, or haiku'),\n\tswarmModel: z\n\t\t.enum(['sonnet', 'opus', 'haiku'])\n\t\t.optional()\n\t\t.describe('Model to use for this agent in swarm mode. Overrides the base model when running inside swarm workers.'),\n\tenabled: z\n\t\t.boolean()\n\t\t.optional()\n\t\t.describe('Whether this agent is enabled. Defaults to true.'),\n\tproviders: z\n\t\t.record(\n\t\t\tz.enum(['claude', 'gemini', 'codex']),\n\t\t\tz.string()\n\t\t)\n\t\t.optional()\n\t\t.describe('Map of review providers to model names. Keys: claude, gemini, codex. Values: model name strings (e.g., \"sonnet\", \"gemini-3-pro-preview\", \"gpt-5.2-codex\")'),\n\treview: z\n\t\t.boolean()\n\t\t.optional()\n\t\t.describe('Whether artifacts from this agent should be reviewed before posting (defaults to false)'),\n\tswarmReview: z\n\t\t.boolean()\n\t\t.optional()\n\t\t.describe('Whether artifacts from this agent should be reviewed in swarm mode. Defaults to false if not set (review is off in swarm mode for speed and cost unless explicitly enabled).'),\n})\n\n/**\n * Zod schema for agent settings.\n */\nexport const AgentSettingsSchema = BaseAgentSettingsSchema\n\n/**\n * Zod schema for spin agent settings with default model\n * Used for the spin orchestrator configuration\n */\nexport const SpinAgentSettingsSchema = z.object({\n\tmodel: z\n\t\t.enum(['sonnet', 'opus', 'haiku'])\n\t\t.default('opus')\n\t\t.describe('Claude model shorthand for spin orchestrator'),\n\tswarmModel: z\n\t\t.enum(['sonnet', 'opus', 'haiku'])\n\t\t.optional()\n\t\t.describe('Model for the spin orchestrator when running in swarm mode. Overrides spin.model for swarm workflows.'),\n\tpostSwarmReview: z\n\t\t.boolean()\n\t\t.default(true)\n\t\t.describe('Run a full code review after swarm completion, auto-fixing issues with confidence 80+. Defaults to true.'),\n})\n\n/**\n * Zod schema for plan command settings with default model\n * Used for the plan command configuration\n */\nexport const PlanCommandSettingsSchema = z.object({\n\tmodel: z\n\t\t.enum(['sonnet', 'opus', 'haiku'])\n\t\t.default('opus')\n\t\t.describe('Claude model shorthand for plan command'),\n\tplanner: z\n\t\t.enum(['claude', 'gemini', 'codex'])\n\t\t.default('claude')\n\t\t.describe('AI provider for creating the plan'),\n\treviewer: z\n\t\t.enum(['claude', 'gemini', 'codex', 'none'])\n\t\t.default('none')\n\t\t.describe('AI provider for reviewing the plan (none to skip review)'),\n\twaveVerification: z\n\t\t.boolean()\n\t\t.default(true)\n\t\t.describe('When enabled, the planner generates verification child issues between dependency waves to catch integration issues early.'),\n})\n\n/**\n * Zod schema for summary settings with default model\n * Used for session summary generation configuration\n */\nexport const SummarySettingsSchema = z.object({\n\tmodel: z\n\t\t.enum(['sonnet', 'opus', 'haiku'])\n\t\t.default('sonnet')\n\t\t.describe('Claude model shorthand for session summary generation'),\n})\n\n/**\n * Zod schema for workflow permission configuration\n */\nexport const WorkflowPermissionSchema = z.object({\n\tpermissionMode: z\n\t\t.enum(['plan', 'acceptEdits', 'bypassPermissions', 'default'])\n\t\t.optional()\n\t\t.describe('Permission mode for Claude CLI in this workflow type'),\n\tnoVerify: z\n\t\t.boolean()\n\t\t.optional()\n\t\t.describe('Skip pre-commit hooks (--no-verify) when committing during commit and finish workflows'),\n\tstartIde: z\n\t\t.boolean()\n\t\t.default(true)\n\t\t.describe('Launch IDE (code) when starting this workflow type'),\n\tstartDevServer: z\n\t\t.boolean()\n\t\t.default(true)\n\t\t.describe('Launch development server when starting this workflow type'),\n\tstartAiAgent: z\n\t\t.boolean()\n\t\t.default(true)\n\t\t.describe('Launch Claude Code agent when starting this workflow type'),\n\tstartTerminal: z\n\t\t.boolean()\n\t\t.default(false)\n\t\t.describe('Launch terminal window without dev server when starting this workflow type'),\n\tgenerateSummary: z\n\t\t.boolean()\n\t\t.default(true)\n\t\t.describe('Generate and post Claude session summary when finishing this workflow type'),\n})\n\n/**\n * Non-defaulting variant for pre-merge validation\n * This prevents Zod from polluting partial settings with default values before merge\n */\nexport const WorkflowPermissionSchemaNoDefaults = z.object({\n\tpermissionMode: z\n\t\t.enum(['plan', 'acceptEdits', 'bypassPermissions', 'default'])\n\t\t.optional()\n\t\t.describe('Permission mode for Claude CLI in this workflow type'),\n\tnoVerify: z\n\t\t.boolean()\n\t\t.optional()\n\t\t.describe('Skip pre-commit hooks (--no-verify) when committing during commit and finish workflows'),\n\tstartIde: z\n\t\t.boolean()\n\t\t.optional()\n\t\t.describe('Launch IDE (code) when starting this workflow type'),\n\tstartDevServer: z\n\t\t.boolean()\n\t\t.optional()\n\t\t.describe('Launch development server when starting this workflow type'),\n\tstartAiAgent: z\n\t\t.boolean()\n\t\t.optional()\n\t\t.describe('Launch Claude Code agent when starting this workflow type'),\n\tstartTerminal: z\n\t\t.boolean()\n\t\t.optional()\n\t\t.describe('Launch terminal window without dev server when starting this workflow type'),\n\tgenerateSummary: z\n\t\t.boolean()\n\t\t.optional()\n\t\t.describe('Generate and post Claude session summary when finishing this workflow type'),\n})\n\n/**\n * Zod schema for workflows settings\n */\nexport const WorkflowsSettingsSchema = z\n\t.object({\n\t\tissue: WorkflowPermissionSchema.optional(),\n\t\tpr: WorkflowPermissionSchema.optional(),\n\t\tregular: WorkflowPermissionSchema.optional(),\n\t})\n\t.optional()\n\n/**\n * Non-defaulting variant for pre-merge validation\n */\nexport const WorkflowsSettingsSchemaNoDefaults = z\n\t.object({\n\t\tissue: WorkflowPermissionSchemaNoDefaults.optional(),\n\t\tpr: WorkflowPermissionSchemaNoDefaults.optional(),\n\t\tregular: WorkflowPermissionSchemaNoDefaults.optional(),\n\t})\n\t.optional()\n\n/**\n * Zod schema for capabilities settings\n */\nexport const CapabilitiesSettingsSchema = z\n\t.object({\n\t\tweb: z\n\t\t\t.object({\n\t\t\t\tbasePort: z\n\t\t\t\t\t.number()\n\t\t\t\t\t.min(1, 'Base port must be >= 1')\n\t\t\t\t\t.max(65535, 'Base port must be <= 65535')\n\t\t\t\t\t.optional()\n\t\t\t\t\t.describe('Base port for web workspace port calculations (default: 3000)'),\n\t\t\t\tdevServer: z\n\t\t\t\t\t.enum(['process', 'docker'])\n\t\t\t\t\t.default('process')\n\t\t\t\t\t.describe('Dev server mode: \"process\" runs natively, \"docker\" runs inside a Docker container with port mapping'),\n\t\t\t\tdockerFile: z\n\t\t\t\t\t.string()\n\t\t\t\t\t.default('./Dockerfile')\n\t\t\t\t\t.describe('Path to Dockerfile relative to worktree root (only used when devServer is \"docker\")'),\n\t\t\t\tcontainerPort: z\n\t\t\t\t\t.number()\n\t\t\t\t\t.min(1, 'Container port must be >= 1')\n\t\t\t\t\t.max(65535, 'Container port must be <= 65535')\n\t\t\t\t\t.optional()\n\t\t\t\t\t.describe('Port the app runs on inside the Docker container (auto-detected from EXPOSE directive if not set)'),\n\t\t\t\tdockerBuildArgs: z\n\t\t\t\t\t.record(z.string())\n\t\t\t\t\t.optional()\n\t\t\t\t\t.describe('Build arguments to pass to docker build (e.g., {\"NODE_ENV\": \"development\"})'),\n\t\t\t\tdockerRunArgs: z\n\t\t\t\t\t.array(z.string())\n\t\t\t\t\t.optional()\n\t\t\t\t\t.describe('Additional arguments for docker run (e.g., [\"-v\", \"./src:/app/src\"] for volume mounts)'),\n\t\t\t})\n\t\t\t.optional()\n\t\t\t.describe('Web dev server settings. To declare a project as a web project, add \"web\" to the capabilities array in .iloom/package.iloom.json or .iloom/package.iloom.local.json.'),\n\t\tdatabase: z\n\t\t\t.object({\n\t\t\t\tdatabaseUrlEnvVarName: z\n\t\t\t\t\t.string()\n\t\t\t\t\t.min(1, 'Database URL variable name cannot be empty')\n\t\t\t\t\t.regex(/^[A-Z_][A-Z0-9_]*$/, 'Must be valid env var name (uppercase, underscores)')\n\t\t\t\t\t.optional()\n\t\t\t\t\t.default('DATABASE_URL')\n\t\t\t\t\t.describe('Name of environment variable for database connection URL'),\n\t\t\t})\n\t\t\t.optional(),\n\t})\n\t.optional()\n\n/**\n * Non-defaulting variant for pre-merge validation\n */\nexport const CapabilitiesSettingsSchemaNoDefaults = z\n\t.object({\n\t\tweb: z\n\t\t\t.object({\n\t\t\t\tbasePort: z\n\t\t\t\t\t.number()\n\t\t\t\t\t.min(1, 'Base port must be >= 1')\n\t\t\t\t\t.max(65535, 'Base port must be <= 65535')\n\t\t\t\t\t.optional()\n\t\t\t\t\t.describe('Base port for web workspace port calculations (default: 3000)'),\n\t\t\t\tdevServer: z\n\t\t\t\t\t.enum(['process', 'docker'])\n\t\t\t\t\t.optional()\n\t\t\t\t\t.describe('Dev server mode: \"process\" runs natively, \"docker\" runs inside a Docker container with port mapping'),\n\t\t\t\tdockerFile: z\n\t\t\t\t\t.string()\n\t\t\t\t\t.optional()\n\t\t\t\t\t.describe('Path to Dockerfile relative to worktree root (only used when devServer is \"docker\")'),\n\t\t\t\tcontainerPort: z\n\t\t\t\t\t.number()\n\t\t\t\t\t.min(1, 'Container port must be >= 1')\n\t\t\t\t\t.max(65535, 'Container port must be <= 65535')\n\t\t\t\t\t.optional()\n\t\t\t\t\t.describe('Port the app runs on inside the Docker container (auto-detected from EXPOSE directive if not set)'),\n\t\t\t\tdockerBuildArgs: z\n\t\t\t\t\t.record(z.string())\n\t\t\t\t\t.optional()\n\t\t\t\t\t.describe('Build arguments to pass to docker build (e.g., {\"NODE_ENV\": \"development\"})'),\n\t\t\t\tdockerRunArgs: z\n\t\t\t\t\t.array(z.string())\n\t\t\t\t\t.optional()\n\t\t\t\t\t.describe('Additional arguments for docker run (e.g., [\"-v\", \"./src:/app/src\"] for volume mounts)'),\n\t\t\t})\n\t\t\t.optional()\n\t\t\t.describe('Web dev server settings. To declare a project as a web project, add \"web\" to the capabilities array in .iloom/package.iloom.json or .iloom/package.iloom.local.json.'),\n\t\tdatabase: z\n\t\t\t.object({\n\t\t\t\tdatabaseUrlEnvVarName: z\n\t\t\t\t\t.string()\n\t\t\t\t\t.min(1, 'Database URL variable name cannot be empty')\n\t\t\t\t\t.regex(/^[A-Z_][A-Z0-9_]*$/, 'Must be valid env var name (uppercase, underscores)')\n\t\t\t\t\t.optional()\n\t\t\t\t\t.describe('Name of environment variable for database connection URL'),\n\t\t\t})\n\t\t\t.optional(),\n\t})\n\t.optional()\n\n/**\n * Zod schema for Docker dev server settings\n */\nexport const DevServerSettingsSchema = z.object({\n\tmode: z\n\t\t.enum(['docker'])\n\t\t.default('docker')\n\t\t.describe('Dev server mode. Currently only \"docker\" is supported.'),\n\tdocker: z\n\t\t.object({\n\t\t\tdockerFile: z\n\t\t\t\t.string()\n\t\t\t\t.default('./Dockerfile')\n\t\t\t\t.refine(\n\t\t\t\t\t(val) => {\n\t\t\t\t\t\t// Must be a relative path (no leading slash)\n\t\t\t\t\t\tif (path.isAbsolute(val)) return false\n\t\t\t\t\t\t// Must not traverse outside the project root\n\t\t\t\t\t\tconst normalized = path.normalize(val)\n\t\t\t\t\t\tif (normalized.startsWith('..')) return false\n\t\t\t\t\t\treturn true\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t'dockerFile must be a relative path that does not traverse outside the project root (no leading \"/\" and no \"../\" escaping)',\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t\t.describe('Path to Dockerfile relative to worktree root'),\n\t\t\tcontainerPort: z\n\t\t\t\t.number()\n\t\t\t\t.min(1, 'Container port must be >= 1')\n\t\t\t\t.max(65535, 'Container port must be <= 65535')\n\t\t\t\t.optional()\n\t\t\t\t.describe('Port the app runs on inside the Docker container (auto-detected from EXPOSE directive if not set)'),\n\t\t\tbuildArgs: z\n\t\t\t\t.record(z.string(), z.string())\n\t\t\t\t.optional()\n\t\t\t\t.describe('Build arguments to pass to docker build'),\n\t\t\trunArgs: z\n\t\t\t\t.array(z.string())\n\t\t\t\t.optional()\n\t\t\t\t.describe('Additional arguments for docker run'),\n\t\t})\n\t\t.optional(),\n})\n\n/**\n * Non-defaulting variant of DevServerSettingsSchema for pre-merge validation\n * This prevents Zod from polluting partial settings with default values before merge\n */\nexport const DevServerSettingsSchemaNoDefaults = z.object({\n\tmode: z\n\t\t.enum(['docker'])\n\t\t.optional()\n\t\t.describe('Dev server mode. Currently only \"docker\" is supported.'),\n\tdocker: z\n\t\t.object({\n\t\t\tdockerFile: z\n\t\t\t\t.string()\n\t\t\t\t.optional()\n\t\t\t\t.refine(\n\t\t\t\t\t(val) => {\n\t\t\t\t\t\tif (val === undefined) return true\n\t\t\t\t\t\tif (path.isAbsolute(val)) return false\n\t\t\t\t\t\tconst normalized = path.normalize(val)\n\t\t\t\t\t\tif (normalized.startsWith('..')) return false\n\t\t\t\t\t\treturn true\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t'dockerFile must be a relative path that does not traverse outside the project root (no leading \"/\" and no \"../\" escaping)',\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t\t.describe('Path to Dockerfile relative to worktree root'),\n\t\t\tcontainerPort: z\n\t\t\t\t.number()\n\t\t\t\t.min(1, 'Container port must be >= 1')\n\t\t\t\t.max(65535, 'Container port must be <= 65535')\n\t\t\t\t.optional()\n\t\t\t\t.describe('Port the app runs on inside the Docker container (auto-detected from EXPOSE directive if not set)'),\n\t\t\tbuildArgs: z\n\t\t\t\t.record(z.string(), z.string())\n\t\t\t\t.optional()\n\t\t\t\t.describe('Build arguments to pass to docker build'),\n\t\t\trunArgs: z\n\t\t\t\t.array(z.string())\n\t\t\t\t.optional()\n\t\t\t\t.describe('Additional arguments for docker run'),\n\t\t})\n\t\t.optional(),\n})\n\n/**\n * Zod schema for Neon database provider settings\n */\nexport const NeonSettingsSchema = z.object({\n\tprojectId: z\n\t\t.string()\n\t\t.min(1)\n\t\t.regex(/^[a-zA-Z0-9-]+$/, 'Neon project ID must contain only letters, numbers, and hyphens')\n\t\t.describe('Neon project ID found in your project URL (e.g., \"fantastic-fox-3566354\")'),\n\tparentBranch: z\n\t\t.string()\n\t\t.min(1)\n\t\t.describe('Branch from which new database branches are created'),\n})\n\n/**\n * Zod schema for Supabase database provider settings\n */\nexport const SupabaseSettingsSchema = z.object({\n\tprojectRef: z\n\t\t.string()\n\t\t.min(1)\n\t\t.describe('Supabase project reference ID (e.g., \"abcdefghijklmnop\")'),\n\tparentBranch: z\n\t\t.string()\n\t\t.min(1)\n\t\t.optional()\n\t\t.describe('Reserved for future use. Supabase currently always branches from the default branch.'),\n\twithData: z\n\t\t.boolean()\n\t\t.optional()\n\t\t.describe('Whether to include data when creating a new branch (defaults to true)'),\n})\n\n/**\n * Zod schema for database provider settings\n */\nexport const DatabaseProvidersSettingsSchema = z\n\t.object({\n\t\tneon: NeonSettingsSchema.optional().describe(\n\t\t\t'Neon database configuration. Requires Neon CLI installed and authenticated for database branching.',\n\t\t),\n\t\tsupabase: SupabaseSettingsSchema.optional().describe(\n\t\t\t'Supabase database configuration. Requires Supabase CLI installed and authenticated for database branching.',\n\t\t),\n\t})\n\t.optional()\n\n/**\n * Zod schema for iloom settings\n */\nexport const IloomSettingsSchema = z.object({\n\tmainBranch: z\n\t\t.string()\n\t\t.min(1, \"Settings 'mainBranch' cannot be empty\")\n\t\t.optional()\n\t\t.describe('Name of the main/primary branch for the repository'),\n\tsourceEnvOnStart: z\n\t\t.boolean()\n\t\t.default(false)\n\t\t.describe(\n\t\t\t'Source all dotenv-flow files (.env, .env.local, .env.development, .env.development.local) when launching terminal processes (Claude, dev server, terminal). ' +\n\t\t\t\t'Files are sourced in precedence order so later files override earlier ones. ' +\n\t\t\t\t'NOTE TO AI AGENTS: Before making changes to settings files, YOU MUST OFFER to check .env file compatibility. ' +\n\t\t\t\t'WARNING: Unquoted values in .env files may break sourcing in bash/zsh shells. ' +\n\t\t\t\t'Before enabling, verify ALL your .env.* files do not contain unquoted special characters ' +\n\t\t\t\t'(e.g., database URLs with ?, &, or other shell metacharacters). ' +\n\t\t\t\t'Shell compatibility issues may cause processes to fail or behave unexpectedly.',\n\t\t),\n\tworktreePrefix: z\n\t\t.string()\n\t\t.optional()\n\t\t.refine(\n\t\t\t(val) => {\n\t\t\t\tif (val === undefined) return true // undefined = use default calculation\n\t\t\t\tif (val === '') return true // empty string = no prefix mode\n\n\t\t\t\t// Allowlist: only alphanumeric, hyphens, underscores, and forward slashes\n\t\t\t\tconst allowedChars = /^[a-zA-Z0-9\\-_/]+$/\n\t\t\t\tif (!allowedChars.test(val)) return false\n\n\t\t\t\t// Reject if only special characters (no alphanumeric content)\n\t\t\t\tif (/^[-_/]+$/.test(val)) return false\n\n\t\t\t\t// Check each segment (split by /) contains at least one alphanumeric character\n\t\t\t\tconst segments = val.split('/')\n\t\t\t\tfor (const segment of segments) {\n\t\t\t\t\tif (segment && /^[-_]+$/.test(segment)) {\n\t\t\t\t\t\t// Segment exists but contains only hyphens/underscores\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn true\n\t\t\t},\n\t\t\t{\n\t\t\t\tmessage:\n\t\t\t\t\t\"worktreePrefix contains invalid characters. Only alphanumeric characters, hyphens (-), underscores (_), and forward slashes (/) are allowed. Use forward slashes for nested directories.\",\n\t\t\t},\n\t\t)\n\t\t.describe(\n\t\t\t'Prefix for worktree directories. Empty string disables prefix. Defaults to <repo-name>-looms if not set.',\n\t\t),\n\tprotectedBranches: z\n\t\t.array(z.string().min(1, 'Protected branch name cannot be empty'))\n\t\t.optional()\n\t\t.describe('List of branches that cannot be deleted (defaults to [mainBranch, \"main\", \"master\", \"develop\"])'),\n\tcopyGitIgnoredPatterns: z\n\t\t.array(z.string().min(1, 'Pattern cannot be empty'))\n\t\t.optional()\n\t\t.describe('Glob patterns for gitignored files to copy to looms (e.g., [\"*.db\", \"data/*.sqlite\"]). Great for local dbs and large test data files that are too big to commit to git. Note: .env (dotenv-flow) files, iloom\\'s and claude\\'s local settings are automatically copied and do not need to be specified here.'),\n\tworkflows: WorkflowsSettingsSchema.describe('Per-workflow-type permission configurations'),\n\tagents: z\n\t\t.record(z.string(), AgentSettingsSchema)\n\t\t.optional()\n\t\t.nullable()\n\t\t.describe(\n\t\t\t'Per-agent configuration overrides. Available agents: ' +\n\t\t\t\t'iloom-issue-analyzer (analyzes issues), ' +\n\t\t\t\t'iloom-issue-planner (creates implementation plans), ' +\n\t\t\t\t'iloom-issue-analyze-and-plan (combined analysis and planning), ' +\n\t\t\t\t'iloom-issue-complexity-evaluator (evaluates complexity), ' +\n\t\t\t\t'iloom-issue-enhancer (enhances issue descriptions), ' +\n\t\t\t\t'iloom-issue-implementer (implements code changes), ' +\n\t\t\t\t'iloom-code-reviewer (reviews code changes against requirements), ' +\n\t\t\t\t'iloom-artifact-reviewer (reviews artifacts before posting), ' +\n\t\t\t\t'iloom-swarm-worker (swarm worker agent, dynamically generated). ' +\n\t\t\t\t'Use swarmModel on any agent to override its model in swarm mode.',\n\t\t),\n\tspin: SpinAgentSettingsSchema.optional().describe(\n\t\t'Spin orchestrator configuration. Model defaults to opus when not configured.',\n\t),\n\tplan: PlanCommandSettingsSchema.optional().describe(\n\t\t'Plan command configuration. Model defaults to opus, planner to claude, reviewer to none when not configured.',\n\t),\n\tsummary: SummarySettingsSchema.optional().describe(\n\t\t'Session summary generation configuration. Model defaults to sonnet when not configured.',\n\t),\n\tcapabilities: CapabilitiesSettingsSchema.describe('Project capability configurations'),\n\tdevServer: DevServerSettingsSchema.optional().describe('Docker-based dev server configuration'),\n\tdatabaseProviders: DatabaseProvidersSettingsSchema.describe('Database provider configurations'),\n\tissueManagement: z\n\t\t.object({\n\t\t\t// SYNC: If this default changes, update displayDefaultsBox() in src/utils/first-run-setup.ts\n\t\t\tprovider: z.enum(['github', 'linear', 'jira']).optional().default('github').describe('Issue tracker provider (github, linear, jira)'),\n\t\t\tgithub: z\n\t\t\t\t.object({\n\t\t\t\t\tremote: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.min(1, 'Remote name cannot be empty')\n\t\t\t\t\t\t.describe('Git remote name to use for GitHub operations'),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t\tlinear: z\n\t\t\t\t.object({\n\t\t\t\t\tteamId: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.min(1, 'Team ID cannot be empty')\n\t\t\t\t\t\t.describe('Linear team identifier (e.g., \"ENG\", \"PLAT\")'),\n\t\t\t\t\tbranchFormat: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.optional()\n\t\t\t\t\t\t.describe('Branch naming template for Linear issues'),\n\t\t\t\t\tapiToken: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.optional()\n\t\t\t\t\t\t.describe('Linear API token (lin_api_...). SECURITY: Store in settings.local.json only, never commit to source control.'),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t\tjira: z\n\t\t\t\t.object({\n\t\t\t\t\thost: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.min(1, 'Jira host cannot be empty')\n\t\t\t\t\t\t.describe('Jira instance URL (e.g., \"https://yourcompany.atlassian.net\")'),\n\t\t\t\t\tusername: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.min(1, 'Jira username/email cannot be empty')\n\t\t\t\t\t\t.describe('Jira username or email address'),\n\t\t\t\t\tapiToken: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.optional()\n\t\t\t\t\t\t.describe('Jira API token. SECURITY: Store in settings.local.json only, never commit to source control. Generate at: https://id.atlassian.com/manage-profile/security/api-tokens'),\n\t\t\t\t\tprojectKey: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.min(1, 'Project key cannot be empty')\n\t\t\t\t\t\t.describe('Jira project key (e.g., \"PROJ\", \"ENG\")'),\n\t\t\t\t\tboardId: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.optional()\n\t\t\t\t\t\t.describe('Jira board ID for sprint/workflow operations (optional)'),\n\t\t\t\t\ttransitionMappings: z\n\t\t\t\t\t\t.record(z.string(), z.string())\n\t\t\t\t\t\t.optional()\n\t\t\t\t\t\t.describe('Map iloom states to Jira transition names (e.g., {\"In Review\": \"Start Review\"})'),\n\t\t\t\t\tdefaultIssueType: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.min(1)\n\t\t\t\t\t\t.optional()\n\t\t\t\t\t\t.default('Task')\n\t\t\t\t\t\t.describe('Default Jira issue type name for creating issues (e.g., \"Task\", \"Story\", \"Bug\")'),\n\t\t\t\t\tdefaultSubtaskType: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.min(1)\n\t\t\t\t\t\t.optional()\n\t\t\t\t\t\t.default('Subtask')\n\t\t\t\t\t\t.describe('Default Jira issue type name for creating subtasks/child issues (e.g., \"Subtask\", \"Sub-task\")'),\n\t\t\t\t\tdoneStatuses: z\n\t\t\t\t\t\t.array(z.string())\n\t\t\t\t\t\t.optional()\n\t\t\t\t\t\t.default(['Done'])\n\t\t\t\t\t\t.describe('Status names to exclude from issue lists (e.g., [\"Done\", \"Closed\", \"Verify\"])'),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional()\n\t\t.describe('Issue management configuration'),\n\tversionControl: z\n\t\t.object({\n\t\t\tprovider: z.enum(['github', 'bitbucket']).optional().default('github').describe('Version control provider (github, bitbucket)'),\n\t\t\tbitbucket: z\n\t\t\t\t.object({\n\t\t\t\t\tusername: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.min(1, 'BitBucket username cannot be empty')\n\t\t\t\t\t\t.describe('BitBucket username'),\n\t\t\t\t\tapiToken: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.optional()\n\t\t\t\t\t\t.describe('BitBucket API token. SECURITY: Store in settings.local.json only, never commit to source control. Generate at: https://bitbucket.org/account/settings/app-passwords/ (Note: App passwords deprecated Sep 2025, use API tokens)'),\n\t\t\t\t\tworkspace: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.optional()\n\t\t\t\t\t\t.describe('BitBucket workspace (optional, auto-detected from git remote if not provided)'),\n\t\t\t\t\trepoSlug: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.optional()\n\t\t\t\t\t\t.describe('BitBucket repository slug (optional, auto-detected from git remote if not provided)'),\n\t\t\t\treviewers: z\n\t\t\t\t\t.array(z.string().describe('Reviewer username'))\n\t\t\t\t\t.optional()\n\t\t\t\t\t.describe('List of usernames to add as PR reviewers. Usernames are resolved to Bitbucket account IDs at PR creation time.'),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional()\n\t\t.describe('Version control provider configuration'),\n\tmergeBehavior: z\n\t\t.object({\n\t\t\t// SYNC: If this default changes, update displayDefaultsBox() in src/utils/first-run-setup.ts\n\t\t\tmode: z.enum(mergeModeValues).default('local').transform(mergeModeTransform),\n\t\t\tremote: z.string().optional(),\n\t\t\tautoCommitPush: z\n\t\t\t\t.boolean()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t'Auto-commit and push after code review in draft PR mode. Defaults to true when mode is draft-pr.'\n\t\t\t\t),\n\t\t\tprTitlePrefix: z.boolean().default(false).optional().describe('Prefix PR titles with the issue number (e.g., \"QLH-123: Title\"). Default: false'),\n\t\t\topenBrowserOnFinish: z\n\t\t\t\t.boolean()\n\t\t\t\t.default(true)\n\t\t\t\t.describe(\n\t\t\t\t\t'Open the PR in the default browser after finishing in pr or draft-pr mode. Use --no-browser flag to override.'\n\t\t\t\t),\n\t\t})\n\t\t.optional()\n\t\t.describe('Merge behavior configuration: local (merge locally), pr (create PR), or draft-pr (create draft PR at start, mark ready on finish)'),\n\tide: z\n\t\t.object({\n\t\t\t// SYNC: If this default changes, update displayDefaultsBox() in src/utils/first-run-setup.ts\n\t\t\ttype: z\n\t\t\t\t.enum(['vscode', 'cursor', 'webstorm', 'sublime', 'intellij', 'windsurf', 'antigravity'])\n\t\t\t\t.default('vscode')\n\t\t\t\t.describe(\n\t\t\t\t\t'IDE to launch when starting a loom. Options: vscode (Visual Studio Code), cursor (Cursor AI editor), ' +\n\t\t\t\t\t\t'webstorm (JetBrains WebStorm), sublime (Sublime Text), intellij (JetBrains IntelliJ IDEA), ' +\n\t\t\t\t\t\t'windsurf (Windsurf editor), antigravity (Antigravity IDE).'\n\t\t\t\t),\n\t\t})\n\t\t.optional()\n\t\t.describe(\n\t\t\t'IDE configuration for workspace launches. Controls which editor opens when you start a loom. ' +\n\t\t\t\t'Supports VSCode, Cursor, WebStorm, Sublime Text, IntelliJ, Windsurf, and Antigravity. ' +\n\t\t\t\t'Note: Color synchronization (title bar colors) only works with VSCode-compatible editors (vscode, cursor, windsurf, antigravity).'\n\t\t),\n\tcolors: z\n\t\t.object({\n\t\t\tterminal: z\n\t\t\t\t.boolean()\n\t\t\t\t.default(true)\n\t\t\t\t.describe('Apply terminal background colors based on branch name (macOS only)'),\n\t\t\tvscode: z\n\t\t\t\t.boolean()\n\t\t\t\t.default(false)\n\t\t\t\t.describe(\n\t\t\t\t\t'Apply VSCode/Cursor title bar colors based on branch name. ' +\n\t\t\t\t\t\t'Note: This modifies .vscode/settings.json which may be in source control. ' +\n\t\t\t\t\t\t'Default is false for safety; enable via init or explicitly if .vscode is gitignored.'\n\t\t\t\t),\n\t\t})\n\t\t.optional()\n\t\t.describe('Color synchronization settings for workspace identification'),\n\tattribution: z\n\t\t.enum(['off', 'upstreamOnly', 'on'])\n\t\t.default('upstreamOnly')\n\t\t.describe(\n\t\t\t'Controls when iloom attribution appears in session summaries. ' +\n\t\t\t\t'\"off\" - never show attribution. ' +\n\t\t\t\t'\"upstreamOnly\" - only show for contributions to external repositories (e.g., open source). ' +\n\t\t\t\t'\"on\" - always show attribution.'\n\t\t),\n\tgit: z\n\t\t.object({\n\t\t\tcommitTimeout: z\n\t\t\t\t.number()\n\t\t\t\t.min(1000, 'Commit timeout must be at least 1000ms')\n\t\t\t\t.max(600000, 'Commit timeout cannot exceed 600000ms (10 minutes)')\n\t\t\t\t.default(60000)\n\t\t\t\t.describe('Timeout in milliseconds for git commit operations. Increase for long-running pre-commit hooks.'),\n\t\t})\n\t\t.default({ }) // ensures the object always exists and uses default for the inner properties\n\t\t.describe('Git operation settings'),\n})\n\n/**\n * Non-defaulting variant for pre-merge validation\n * This prevents Zod from polluting partial settings with default values before merge\n */\nexport const IloomSettingsSchemaNoDefaults = z.object({\n\tmainBranch: z\n\t\t.string()\n\t\t.min(1, \"Settings 'mainBranch' cannot be empty\")\n\t\t.optional()\n\t\t.describe('Name of the main/primary branch for the repository'),\n\tsourceEnvOnStart: z\n\t\t.boolean()\n\t\t.optional()\n\t\t.describe(\n\t\t\t'Source all dotenv-flow files (.env, .env.local, .env.development, .env.development.local) when launching terminal processes (Claude, dev server, terminal). ' +\n\t\t\t\t'Files are sourced in precedence order so later files override earlier ones. ' +\n\t\t\t\t'NOTE TO AI AGENTS: Before making changes to settings files, YOU MUST OFFER to check .env compatibility. ' +\n\t\t\t\t'WARNING: Unquoted values in .env files may break sourcing in bash/zsh shells. ' +\n\t\t\t\t'Before enabling, verify ALL your .env.* files do not contain unquoted special characters ' +\n\t\t\t\t'(e.g., database URLs with ?, &, or other shell metacharacters). ' +\n\t\t\t\t'Shell compatibility issues may cause processes to fail or behave unexpectedly.',\n\t\t),\n\tworktreePrefix: z\n\t\t.string()\n\t\t.optional()\n\t\t.refine(\n\t\t\t(val) => {\n\t\t\t\tif (val === undefined) return true // undefined = use default calculation\n\t\t\t\tif (val === '') return true // empty string = no prefix mode\n\n\t\t\t\t// Allowlist: only alphanumeric, hyphens, underscores, and forward slashes\n\t\t\t\tconst allowedChars = /^[a-zA-Z0-9\\-_/]+$/\n\t\t\t\tif (!allowedChars.test(val)) return false\n\n\t\t\t\t// Reject if only special characters (no alphanumeric content)\n\t\t\t\tif (/^[-_/]+$/.test(val)) return false\n\n\t\t\t\t// Check each segment (split by /) contains at least one alphanumeric character\n\t\t\t\tconst segments = val.split('/')\n\t\t\t\tfor (const segment of segments) {\n\t\t\t\t\tif (segment && /^[-_]+$/.test(segment)) {\n\t\t\t\t\t\t// Segment exists but contains only hyphens/underscores\n\t\t\t\t\t\treturn false\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn true\n\t\t\t},\n\t\t\t{\n\t\t\t\tmessage:\n\t\t\t\t\t\"worktreePrefix contains invalid characters. Only alphanumeric characters, hyphens (-), underscores (_), and forward slashes (/) are allowed. Use forward slashes for nested directories.\",\n\t\t\t},\n\t\t)\n\t\t.describe(\n\t\t\t'Prefix for worktree directories. Empty string disables prefix. Defaults to <repo-name>-looms if not set.',\n\t\t),\n\tprotectedBranches: z\n\t\t.array(z.string().min(1, 'Protected branch name cannot be empty'))\n\t\t.optional()\n\t\t.describe('List of branches that cannot be deleted (defaults to [mainBranch, \"main\", \"master\", \"develop\"])'),\n\tcopyGitIgnoredPatterns: z\n\t\t.array(z.string().min(1, 'Pattern cannot be empty'))\n\t\t.optional()\n\t\t.describe('Glob patterns for gitignored files to copy to looms (e.g., [\"*.db\", \"data/*.sqlite\"]). Great for local dbs and large test data files that are too big to commit to git. Note: .env (dotenv-flow) files, iloom\\'s and claude\\'s local settings are automatically copied and do not need to be specified here.'),\n\tworkflows: WorkflowsSettingsSchemaNoDefaults.describe('Per-workflow-type permission configurations'),\n\tagents: z\n\t\t.record(z.string(), AgentSettingsSchema)\n\t\t.optional()\n\t\t.nullable()\n\t\t.describe(\n\t\t\t'Per-agent configuration overrides. Available agents: ' +\n\t\t\t\t'iloom-issue-analyzer (analyzes issues), ' +\n\t\t\t\t'iloom-issue-planner (creates implementation plans), ' +\n\t\t\t\t'iloom-issue-analyze-and-plan (combined analysis and planning), ' +\n\t\t\t\t'iloom-issue-complexity-evaluator (evaluates complexity), ' +\n\t\t\t\t'iloom-issue-enhancer (enhances issue descriptions), ' +\n\t\t\t\t'iloom-issue-implementer (implements code changes), ' +\n\t\t\t\t'iloom-code-reviewer (reviews code changes against requirements), ' +\n\t\t\t\t'iloom-artifact-reviewer (reviews artifacts before posting), ' +\n\t\t\t\t'iloom-swarm-worker (swarm worker agent, dynamically generated). ' +\n\t\t\t\t'Use swarmModel on any agent to override its model in swarm mode.',\n\t\t),\n\tspin: z\n\t\t.object({\n\t\t\tmodel: z.enum(['sonnet', 'opus', 'haiku']).optional(),\n\t\t\tswarmModel: z.enum(['sonnet', 'opus', 'haiku']).optional(),\n\t\t\tpostSwarmReview: z.boolean().optional(),\n\t\t})\n\t\t.optional()\n\t\t.describe('Spin orchestrator configuration'),\n\tplan: z\n\t\t.object({\n\t\t\tmodel: z.enum(['sonnet', 'opus', 'haiku']).optional(),\n\t\t\tplanner: z.enum(['claude', 'gemini', 'codex']).optional(),\n\t\t\treviewer: z.enum(['claude', 'gemini', 'codex', 'none']).optional(),\n\t\t\twaveVerification: z.boolean().optional(),\n\t\t})\n\t\t.optional()\n\t\t.describe('Plan command configuration'),\n\tsummary: z\n\t\t.object({\n\t\t\tmodel: z.enum(['sonnet', 'opus', 'haiku']).optional(),\n\t\t})\n\t\t.optional()\n\t\t.describe('Session summary generation configuration'),\n\tcapabilities: CapabilitiesSettingsSchemaNoDefaults.describe('Project capability configurations'),\n\tdevServer: DevServerSettingsSchemaNoDefaults.optional().describe('Docker-based dev server configuration'),\n\tdatabaseProviders: DatabaseProvidersSettingsSchema.describe('Database provider configurations'),\n\tissueManagement: z\n\t\t.object({\n\t\t\tprovider: z.enum(['github', 'linear', 'jira']).optional().describe('Issue tracker provider (github, linear, jira)'),\n\t\t\tgithub: z\n\t\t\t\t.object({\n\t\t\t\t\tremote: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.min(1, 'Remote name cannot be empty')\n\t\t\t\t\t\t.describe('Git remote name to use for GitHub operations'),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t\tlinear: z\n\t\t\t\t.object({\n\t\t\t\t\tteamId: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.min(1, 'Team ID cannot be empty')\n\t\t\t\t\t\t.describe('Linear team identifier (e.g., \"ENG\", \"PLAT\")'),\n\t\t\t\t\tbranchFormat: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.optional()\n\t\t\t\t\t\t.describe('Branch naming template for Linear issues'),\n\t\t\t\t\tapiToken: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.optional()\n\t\t\t\t\t\t.describe('Linear API token (lin_api_...). SECURITY: Store in settings.local.json only, never commit to source control.'),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t\tjira: z\n\t\t\t\t.object({\n\t\t\t\t\thost: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.min(1, 'Jira host cannot be empty')\n\t\t\t\t\t\t.describe('Jira instance URL (e.g., \"https://yourcompany.atlassian.net\")'),\n\t\t\t\t\tusername: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.min(1, 'Jira username/email cannot be empty')\n\t\t\t\t\t\t.describe('Jira username or email address'),\n\t\t\t\t\tapiToken: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.optional()\n\t\t\t\t\t\t.describe('Jira API token. SECURITY: Store in settings.local.json only, never commit to source control. Generate at: https://id.atlassian.com/manage-profile/security/api-tokens'),\n\t\t\t\t\tprojectKey: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.min(1, 'Project key cannot be empty')\n\t\t\t\t\t\t.describe('Jira project key (e.g., \"PROJ\", \"ENG\")'),\n\t\t\t\t\tboardId: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.optional()\n\t\t\t\t\t\t.describe('Jira board ID for sprint/workflow operations (optional)'),\n\t\t\t\t\ttransitionMappings: z\n\t\t\t\t\t\t.record(z.string(), z.string())\n\t\t\t\t\t\t.optional()\n\t\t\t\t\t\t.describe('Map iloom states to Jira transition names (e.g., {\"In Review\": \"Start Review\"})'),\n\t\t\t\t\tdefaultIssueType: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.min(1)\n\t\t\t\t\t\t.optional()\n\t\t\t\t\t\t.describe('Default Jira issue type name for creating issues (e.g., \"Task\", \"Story\", \"Bug\")'),\n\t\t\t\t\tdefaultSubtaskType: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.min(1)\n\t\t\t\t\t\t.optional()\n\t\t\t\t\t\t.describe('Default Jira issue type name for creating subtasks/child issues (e.g., \"Subtask\", \"Sub-task\")'),\n\t\t\t\t\tdoneStatuses: z\n\t\t\t\t\t\t.array(z.string())\n\t\t\t\t\t\t.optional()\n\t\t\t\t\t\t.default(['Done'])\n\t\t\t\t\t\t.describe('Status names to exclude from issue lists (e.g., [\"Done\", \"Closed\", \"Verify\"])'),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional()\n\t\t.describe('Issue management configuration'),\n\tversionControl: z\n\t\t.object({\n\t\t\tprovider: z.enum(['github', 'bitbucket']).optional().describe('Version control provider (github, bitbucket)'),\n\t\t\tbitbucket: z\n\t\t\t\t.object({\n\t\t\t\t\tusername: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.min(1, 'BitBucket username cannot be empty')\n\t\t\t\t\t\t.describe('BitBucket username'),\n\t\t\t\t\tapiToken: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.optional()\n\t\t\t\t\t\t.describe('BitBucket API token. SECURITY: Store in settings.local.json only, never commit to source control. Generate at: https://bitbucket.org/account/settings/app-passwords/ (Note: App passwords deprecated Sep 2025, use API tokens)'),\n\t\t\t\t\tworkspace: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.optional()\n\t\t\t\t\t\t.describe('BitBucket workspace (optional, auto-detected from git remote if not provided)'),\n\t\t\t\t\trepoSlug: z\n\t\t\t\t\t\t.string()\n\t\t\t\t\t\t.optional()\n\t\t\t\t\t\t.describe('BitBucket repository slug (optional, auto-detected from git remote if not provided)'),\n\t\t\t\treviewers: z\n\t\t\t\t\t.array(z.string().describe('Reviewer username'))\n\t\t\t\t\t.optional()\n\t\t\t\t\t.describe('List of usernames to add as PR reviewers. Usernames are resolved to Bitbucket account IDs at PR creation time.'),\n\t\t\t\t})\n\t\t\t\t.optional(),\n\t\t})\n\t\t.optional()\n\t\t.describe('Version control provider configuration'),\n\tmergeBehavior: z\n\t\t.object({\n\t\t\tmode: z.enum(mergeModeValues).transform(mergeModeTransform).optional(),\n\t\t\tremote: z.string().optional(),\n\t\t\tautoCommitPush: z\n\t\t\t\t.boolean()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t'Auto-commit and push after code review in draft PR mode. Defaults to true when mode is draft-pr.'\n\t\t\t\t),\n\t\t\tprTitlePrefix: z.boolean().optional(),\n\t\t\topenBrowserOnFinish: z\n\t\t\t\t.boolean()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t'Open the PR in the default browser after finishing in pr or draft-pr mode. Use --no-browser flag to override.'\n\t\t\t\t),\n\t\t})\n\t\t.optional()\n\t\t.describe('Merge behavior configuration: local (merge locally), pr (create PR), or draft-pr (create draft PR at start, mark ready on finish)'),\n\tide: z\n\t\t.object({\n\t\t\ttype: z\n\t\t\t\t.enum(['vscode', 'cursor', 'webstorm', 'sublime', 'intellij', 'windsurf', 'antigravity'])\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t'IDE to launch when starting a loom. Options: vscode (Visual Studio Code), cursor (Cursor AI editor), ' +\n\t\t\t\t\t\t'webstorm (JetBrains WebStorm), sublime (Sublime Text), intellij (JetBrains IntelliJ IDEA), ' +\n\t\t\t\t\t\t'windsurf (Windsurf editor), antigravity (Antigravity IDE).'\n\t\t\t\t),\n\t\t})\n\t\t.optional()\n\t\t.describe(\n\t\t\t'IDE configuration for workspace launches. Controls which editor opens when you start a loom. ' +\n\t\t\t\t'Supports VSCode, Cursor, WebStorm, Sublime Text, IntelliJ, Windsurf, and Antigravity. ' +\n\t\t\t\t'Note: Color synchronization (title bar colors) only works with VSCode-compatible editors (vscode, cursor, windsurf, antigravity).'\n\t\t),\n\tcolors: z\n\t\t.object({\n\t\t\tterminal: z\n\t\t\t\t.boolean()\n\t\t\t\t.optional()\n\t\t\t\t.describe('Apply terminal background colors based on branch name (macOS only)'),\n\t\t\tvscode: z\n\t\t\t\t.boolean()\n\t\t\t\t.optional()\n\t\t\t\t.describe(\n\t\t\t\t\t'Apply VSCode/Cursor title bar colors based on branch name. ' +\n\t\t\t\t\t\t'Note: This modifies .vscode/settings.json which may be in source control.'\n\t\t\t\t),\n\t\t})\n\t\t.optional()\n\t\t.describe('Color synchronization settings for workspace identification'),\n\tattribution: z\n\t\t.enum(['off', 'upstreamOnly', 'on'])\n\t\t.optional()\n\t\t.describe(\n\t\t\t'Controls when iloom attribution appears in session summaries. ' +\n\t\t\t\t'\"off\" - never show attribution. ' +\n\t\t\t\t'\"upstreamOnly\" - only show for contributions to external repositories (e.g., open source). ' +\n\t\t\t\t'\"on\" - always show attribution.'\n\t\t),\n\tgit: z\n\t\t.object({\n\t\t\tcommitTimeout: z\n\t\t\t\t.number()\n\t\t\t\t.min(1000, 'Commit timeout must be at least 1000ms')\n\t\t\t\t.max(600000, 'Commit timeout cannot exceed 600000ms (10 minutes)')\n\t\t\t\t.optional()\n\t\t\t\t.describe('Timeout in milliseconds for git commit operations. Increase for long-running pre-commit hooks.'),\n\t\t})\n\t\t.optional()\n\t\t.describe('Git operation settings'),\n})\n\n/**\n * TypeScript type for dev server settings derived from Zod schema\n */\nexport type DevServerSettings = z.infer<typeof DevServerSettingsSchema>\n\n/**\n * TypeScript type for Neon settings derived from Zod schema\n */\nexport type NeonSettings = z.infer<typeof NeonSettingsSchema>\n\n/**\n * TypeScript type for Supabase settings derived from Zod schema\n */\nexport type SupabaseSettings = z.infer<typeof SupabaseSettingsSchema>\n\n/**\n * TypeScript type for database providers settings derived from Zod schema\n */\nexport type DatabaseProvidersSettings = z.infer<typeof DatabaseProvidersSettingsSchema>\n\n/**\n * TypeScript type for agent settings derived from Zod schema\n */\nexport type AgentSettings = z.infer<typeof AgentSettingsSchema>\n\n/**\n * TypeScript type for spin agent settings derived from Zod schema\n */\nexport type SpinAgentSettings = z.infer<typeof SpinAgentSettingsSchema>\n\n/**\n * TypeScript type for plan command settings derived from Zod schema\n */\nexport type PlanCommandSettings = z.infer<typeof PlanCommandSettingsSchema>\n\n/**\n * TypeScript type for summary settings derived from Zod schema\n */\nexport type SummarySettings = z.infer<typeof SummarySettingsSchema>\n\n/**\n * TypeScript type for workflow permission configuration derived from Zod schema\n */\nexport type WorkflowPermission = z.infer<typeof WorkflowPermissionSchema>\n\n/**\n * TypeScript type for workflows settings derived from Zod schema\n */\nexport type WorkflowsSettings = z.infer<typeof WorkflowsSettingsSchema>\n\n/**\n * TypeScript type for capabilities settings derived from Zod schema\n */\nexport type CapabilitiesSettings = z.infer<typeof CapabilitiesSettingsSchema>\n\n/**\n * TypeScript type for IDE settings derived from Zod schema\n */\nexport type IdeSettings = z.infer<typeof IloomSettingsSchema>['ide']\n\n/**\n * TypeScript type for iloom settings derived from Zod schema\n */\nexport type IloomSettings = z.infer<typeof IloomSettingsSchema>\n\n/**\n * TypeScript input type for iloom settings (before Zod defaults are applied)\n * Used for validation where partial/input objects need to be accepted\n */\nexport type IloomSettingsInput = z.input<typeof IloomSettingsSchema>\n\n/**\n * Recursively redact sensitive fields (tokens, secrets, passwords) from an object.\n * Returns a deep copy with sensitive string values replaced by '[REDACTED]'.\n */\nexport function redactSensitiveFields(obj: unknown): unknown {\n\tif (obj === null || obj === undefined) return obj\n\tif (typeof obj !== 'object') return obj\n\tif (Array.isArray(obj)) return obj.map(redactSensitiveFields)\n\n\tconst sensitiveKeys = ['apitoken', 'token', 'secret', 'password', 'credential']\n\tconst result: Record<string, unknown> = {}\n\tfor (const [key, value] of Object.entries(obj as Record<string, unknown>)) {\n\t\tconst lowerKey = key.toLowerCase()\n\t\tif (sensitiveKeys.some(s => lowerKey.includes(s)) && typeof value === 'string') {\n\t\t\tresult[key] = '[REDACTED]'\n\t\t} else if (typeof value === 'object' && value !== null) {\n\t\t\tresult[key] = redactSensitiveFields(value)\n\t\t} else {\n\t\t\tresult[key] = value\n\t\t}\n\t}\n\treturn result\n}\n\n/**\n * Manages project-level settings from .iloom/settings.json\n */\nexport class SettingsManager {\n\t/**\n\t * Load settings from global, project, and local sources with proper precedence\n\t * Merge hierarchy (lowest to highest priority):\n\t * 1. Global settings (~/.config/iloom-ai/settings.json)\n\t * 2. Project settings (<PROJECT_ROOT>/.iloom/settings.json)\n\t * 3. Local settings (<PROJECT_ROOT>/.iloom/settings.local.json)\n\t * 4. CLI overrides (--set flags)\n\t * Returns empty object if all files don't exist (not an error)\n\t */\n\tasync loadSettings(\n\t\tprojectRoot?: string,\n\t\tcliOverrides?: Partial<IloomSettings>,\n\t): Promise<IloomSettings> {\n\t\tconst root = this.getProjectRoot(projectRoot)\n\n\t\t// Load global settings (lowest priority)\n\t\tconst globalSettings = await this.loadGlobalSettingsFile()\n\t\tconst globalSettingsPath = this.getGlobalSettingsPath()\n\t\tlogger.debug(`🌍 Global settings from ${globalSettingsPath}:`, JSON.stringify(redactSensitiveFields(globalSettings), null, 2))\n\n\t\t// Load base settings from settings.json\n\t\tconst baseSettings = await this.loadSettingsFile(root, 'settings.json')\n\t\tconst baseSettingsPath = path.join(root, '.iloom', 'settings.json')\n\t\tlogger.debug(`📄 Base settings from ${baseSettingsPath}:`, JSON.stringify(redactSensitiveFields(baseSettings), null, 2))\n\n\t\t// Load local overrides from settings.local.json\n\t\tconst localSettings = await this.loadSettingsFile(root, 'settings.local.json')\n\t\tconst localSettingsPath = path.join(root, '.iloom', 'settings.local.json')\n\t\tlogger.debug(`📄 Local settings from ${localSettingsPath}:`, JSON.stringify(redactSensitiveFields(localSettings), null, 2))\n\n\t\t// Deep merge with priority: cliOverrides > localSettings > baseSettings > globalSettings\n\t\tlet merged = this.mergeSettings(this.mergeSettings(globalSettings, baseSettings), localSettings)\n\t\tlogger.debug('🔄 After merging global + base + local settings:', JSON.stringify(redactSensitiveFields(merged), null, 2))\n\n\t\tif (cliOverrides && Object.keys(cliOverrides).length > 0) {\n\t\t\tlogger.debug('⚙️ CLI overrides to apply:', JSON.stringify(redactSensitiveFields(cliOverrides), null, 2))\n\t\t\tmerged = this.mergeSettings(merged, cliOverrides)\n\t\t\tlogger.debug('🔄 After applying CLI overrides:', JSON.stringify(redactSensitiveFields(merged), null, 2))\n\t\t}\n\n\t\t// Validate merged result\n\t\ttry {\n\t\t\tconst finalSettings = IloomSettingsSchema.parse(merged)\n\n\t\t\t// Debug: Log final merged configuration\n\t\t\tthis.logFinalConfiguration(finalSettings)\n\n\t\t\treturn finalSettings\n\t\t} catch (error) {\n\t\t\t// Show all Zod validation errors\n\t\t\tif (error instanceof z.ZodError) {\n\t\t\t\tconst errorMsg = this.formatAllZodErrors(error, '<merged settings>')\n\t\t\t\t// Enhance error message if CLI overrides were applied\n\t\t\t\tif (cliOverrides && Object.keys(cliOverrides).length > 0) {\n\t\t\t\t\tthrow new Error(`${errorMsg.message}\\n\\nNote: CLI overrides were applied. Check your --set arguments.`)\n\t\t\t\t}\n\t\t\t\tthrow errorMsg\n\t\t\t}\n\t\t\tthrow error\n\t\t}\n\t}\n\n\t/**\n\t * Log the final merged configuration for debugging\n\t */\n\tprivate logFinalConfiguration(settings: IloomSettings): void {\n\t\tlogger.debug('📋 Final merged configuration:', JSON.stringify(redactSensitiveFields(settings), null, 2))\n\t}\n\n\t/**\n\t * Load and parse a single settings file\n\t * Returns empty object if file doesn't exist (not an error)\n\t * Uses non-defaulting schema to prevent polluting partial settings with defaults before merge\n\t */\n\tprivate async loadSettingsFile(\n\t\tprojectRoot: string,\n\t\tfilename: string,\n\t): Promise<z.infer<typeof IloomSettingsSchemaNoDefaults>> {\n\t\tconst settingsPath = path.join(projectRoot, '.iloom', filename)\n\n\t\ttry {\n\t\t\tconst content = await readFile(settingsPath, 'utf-8')\n\t\t\tlet parsed: unknown\n\n\t\t\ttry {\n\t\t\t\tparsed = JSON.parse(content)\n\t\t\t} catch (error) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Failed to parse settings file at ${settingsPath}: ${error instanceof Error ? error.message : 'Invalid JSON'}`,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\t// Basic type checking - ensure it's an object, but don't validate schema completeness\n\t\t\t// Individual files may be incomplete (e.g., Linear config split between files)\n\t\t\t// Final validation will happen on the merged result in loadSettings()\n\t\t\tif (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Settings validation failed at ${filename}:\\n - root: Expected object, received ${typeof parsed}`\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn parsed as z.infer<typeof IloomSettingsSchemaNoDefaults>\n\t\t} catch (error) {\n\t\t\t// File not found is not an error - return empty settings\n\t\t\tif ((error as { code?: string }).code === 'ENOENT') {\n\t\t\t\tlogger.debug(`No settings file found at ${settingsPath}, using defaults`)\n\t\t\t\treturn {}\n\t\t\t}\n\n\t\t\t// Re-throw parsing errors\n\t\t\tthrow error\n\t\t}\n\t}\n\n\t/**\n\t * Deep merge two settings objects with priority to override\n\t * Uses deepmerge library with array replacement strategy\n\t */\n\tprivate mergeSettings(\n\t\tbase: Partial<IloomSettings> | z.infer<typeof IloomSettingsSchemaNoDefaults>,\n\t\toverride: Partial<IloomSettings> | z.infer<typeof IloomSettingsSchemaNoDefaults>,\n\t): IloomSettings {\n\t\t// Use deepmerge with array replacement (not concatenation)\n\t\t// Type assertion is safe because the merged result will be validated with IloomSettingsSchema\n\t\t// which applies all the defaults after merging\n\t\treturn deepmerge(base as Record<string, unknown>, override as Record<string, unknown>, {\n\t\t\t// Replace arrays instead of concatenating them\n\t\t\tarrayMerge: (_destinationArray, sourceArray) => sourceArray,\n\t\t}) as IloomSettings\n\t}\n\n\t/**\n\t * Format all Zod validation errors into a single error message\n\t */\n\tprivate formatAllZodErrors(error: z.ZodError, settingsPath: string): Error {\n\t\tconst errorMessages = error.issues.map(issue => {\n\t\t\tconst path = issue.path.length > 0 ? issue.path.join('.') : 'root'\n\t\t\treturn ` - ${path}: ${issue.message}`\n\t\t})\n\n\t\treturn new Error(\n\t\t\t`Settings validation failed at ${settingsPath}:\\n${errorMessages.join('\\n')}`,\n\t\t)\n\t}\n\n\t/**\n\t * Validate settings structure and model names using Zod schema\n\t * This method is kept for testing purposes but uses Zod internally\n\t * @internal - Only used in tests via bracket notation\n\t */\n\t// @ts-expect-error - Used in tests via bracket notation, TypeScript can't detect this usage\n\tprivate validateSettings(settings: IloomSettingsInput): void {\n\t\ttry {\n\t\t\tIloomSettingsSchema.parse(settings)\n\t\t} catch (error) {\n\t\t\tif (error instanceof z.ZodError) {\n\t\t\t\tthrow this.formatAllZodErrors(error, '<validation>')\n\t\t\t}\n\t\t\tthrow error\n\t\t}\n\t}\n\n\t/**\n\t * Get project root (defaults to process.cwd())\n\t */\n\tprivate getProjectRoot(projectRoot?: string): string {\n\t\treturn projectRoot ?? process.cwd()\n\t}\n\n\t/**\n\t * Get global config directory path (~/.config/iloom-ai)\n\t */\n\tprivate getGlobalConfigDir(): string {\n\t\treturn path.join(os.homedir(), '.config', 'iloom-ai')\n\t}\n\n\t/**\n\t * Get global settings file path (~/.config/iloom-ai/settings.json)\n\t */\n\tprivate getGlobalSettingsPath(): string {\n\t\treturn path.join(this.getGlobalConfigDir(), 'settings.json')\n\t}\n\n\t/**\n\t * Load and parse global settings file\n\t * Returns empty object if file doesn't exist (not an error)\n\t * Warns but returns empty object on validation/parse errors (graceful degradation)\n\t */\n\tprivate async loadGlobalSettingsFile(): Promise<z.infer<typeof IloomSettingsSchemaNoDefaults>> {\n\t\tconst settingsPath = this.getGlobalSettingsPath()\n\n\t\ttry {\n\t\t\tconst content = await readFile(settingsPath, 'utf-8')\n\t\t\tlet parsed: unknown\n\n\t\t\ttry {\n\t\t\t\tparsed = JSON.parse(content)\n\t\t\t} catch (error) {\n\t\t\t\tlogger.warn(\n\t\t\t\t\t`Failed to parse global settings file at ${settingsPath}: ${error instanceof Error ? error.message : 'Invalid JSON'}. Ignoring global settings.`,\n\t\t\t\t)\n\t\t\t\treturn {}\n\t\t\t}\n\n\t\t\t// Validate with non-defaulting schema\n\t\t\ttry {\n\t\t\t\tconst validated = IloomSettingsSchemaNoDefaults.strict().parse(parsed)\n\t\t\t\treturn validated\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof z.ZodError) {\n\t\t\t\t\tconst errorMsg = this.formatAllZodErrors(error, 'global settings')\n\t\t\t\t\tlogger.warn(`${errorMsg.message}. Ignoring global settings.`)\n\t\t\t\t} else {\n\t\t\t\t\tlogger.warn(`Validation error in global settings: ${error instanceof Error ? error.message : 'Unknown error'}. Ignoring global settings.`)\n\t\t\t\t}\n\t\t\t\treturn {}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\t// File not found is not an error - return empty settings\n\t\t\tif ((error as { code?: string }).code === 'ENOENT') {\n\t\t\t\tlogger.debug(`No global settings file found at ${settingsPath}`)\n\t\t\t\treturn {}\n\t\t\t}\n\n\t\t\t// Other file system errors - warn and continue\n\t\t\tlogger.warn(`Error reading global settings file at ${settingsPath}: ${error instanceof Error ? error.message : 'Unknown error'}. Ignoring global settings.`)\n\t\t\treturn {}\n\t\t}\n\t}\n\n\t/**\n\t * Get effective protected branches list with mainBranch always included\n\t *\n\t * This method provides a single source of truth for protected branches logic:\n\t * 1. Use configured protectedBranches if provided\n\t * 2. Otherwise use defaults: [mainBranch, 'main', 'master', 'develop']\n\t * 3. ALWAYS ensure mainBranch is included even if user configured custom list\n\t *\n\t * @param projectRoot - Optional project root directory (defaults to process.cwd())\n\t * @returns Array of protected branch names with mainBranch guaranteed to be included\n\t */\n\tasync getProtectedBranches(projectRoot?: string): Promise<string[]> {\n\t\tconst settings = await this.loadSettings(projectRoot)\n\t\t// SYNC: If this default changes, update displayDefaultsBox() in src/utils/first-run-setup.ts\n\t\tconst mainBranch = settings.mainBranch ?? 'main'\n\n\t\t// Build protected branches list:\n\t\t// 1. Use configured protectedBranches if provided\n\t\t// 2. Otherwise use defaults: [mainBranch, 'main', 'master', 'develop']\n\t\t// 3. ALWAYS ensure mainBranch is included even if user configured custom list\n\t\tlet protectedBranches: string[]\n\t\tif (settings.protectedBranches) {\n\t\t\t// Use configured list but ensure mainBranch is always included\n\t\t\tprotectedBranches = settings.protectedBranches.includes(mainBranch)\n\t\t\t\t? settings.protectedBranches\n\t\t\t\t: [mainBranch, ...settings.protectedBranches]\n\t\t} else {\n\t\t\t// Use defaults with current mainBranch\n\t\t\tprotectedBranches = [mainBranch, 'main', 'master', 'develop']\n\t\t}\n\n\t\treturn protectedBranches\n\t}\n\n\t/**\n\t * Get the spin orchestrator model with default applied\n\t * Default is defined in SpinAgentSettingsSchema\n\t *\n\t * @param settings - Pre-loaded settings object\n\t * @returns Model shorthand ('opus', 'sonnet', or 'haiku')\n\t */\n\tgetSpinModel(settings?: IloomSettings, mode?: 'swarm'): 'sonnet' | 'opus' | 'haiku' {\n\t\tif (mode === 'swarm') {\n\t\t\tif (settings?.spin?.swarmModel) {\n\t\t\t\treturn settings.spin.swarmModel\n\t\t\t}\n\t\t\t// Default to opus for swarm orchestrator (\"Balanced\" mode)\n\t\t\treturn 'opus'\n\t\t}\n\t\treturn settings?.spin?.model ?? SpinAgentSettingsSchema.parse({}).model\n\t}\n\n\t/**\n\t * Get the plan command model with default applied\n\t * Default is defined in PlanCommandSettingsSchema\n\t *\n\t * @param settings - Pre-loaded settings object\n\t * @returns Model shorthand ('opus', 'sonnet', or 'haiku')\n\t */\n\tgetPlanModel(settings?: IloomSettings): 'sonnet' | 'opus' | 'haiku' {\n\t\treturn settings?.plan?.model ?? PlanCommandSettingsSchema.parse({}).model\n\t}\n\n\t/**\n\t * Get the plan command planner with default applied\n\t * Default is 'claude'\n\t *\n\t * @param settings - Pre-loaded settings object\n\t * @returns Planner provider ('claude', 'gemini', or 'codex')\n\t */\n\tgetPlanPlanner(settings?: IloomSettings): 'claude' | 'gemini' | 'codex' {\n\t\treturn settings?.plan?.planner ?? 'claude'\n\t}\n\n\t/**\n\t * Get the plan command reviewer with default applied\n\t * Default is 'none' (no review step)\n\t *\n\t * @param settings - Pre-loaded settings object\n\t * @returns Reviewer provider ('claude', 'gemini', 'codex', or 'none')\n\t */\n\tgetPlanReviewer(settings?: IloomSettings): 'claude' | 'gemini' | 'codex' | 'none' {\n\t\treturn settings?.plan?.reviewer ?? 'none'\n\t}\n\n\t/**\n\t * Get the plan command waveVerification setting with default applied\n\t * Default is true (verification tasks are generated)\n\t *\n\t * @param settings - Pre-loaded settings object\n\t * @returns Whether wave verification is enabled\n\t */\n\tgetPlanWaveVerification(settings?: IloomSettings): boolean {\n\t\treturn settings?.plan?.waveVerification !== false\n\t}\n\n\t/**\n\t * Get the session summary model with default applied\n\t * Default is defined in SummarySettingsSchema\n\t *\n\t * @param settings - Pre-loaded settings object\n\t * @returns Model shorthand ('opus', 'sonnet', or 'haiku')\n\t */\n\tgetSummaryModel(settings?: IloomSettings): 'sonnet' | 'opus' | 'haiku' {\n\t\treturn settings?.summary?.model ?? SummarySettingsSchema.parse({}).model\n\t}\n}\n"],"mappings":";;;;;;AAAA,SAAS,gBAAgB;AACzB,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,SAAS,SAAS;AAClB,OAAO,eAAe;AAIf,IAAM,kBAAkB,CAAC,SAAS,MAAM,YAAY,aAAa,mBAAmB,cAAc;AAEzG,IAAM,qBAAqB,CAAC,QAA2B;AACtD,QAAM,MAAiC,EAAE,aAAa,MAAM,mBAAmB,YAAY,gBAAgB,KAAK;AAChH,SAAQ,IAAI,GAAG,KAAK;AACrB;AAKO,IAAM,0BAA0B,EAAE,OAAO;AAAA,EAC/C,OAAO,EACL,KAAK,CAAC,UAAU,QAAQ,OAAO,CAAC,EAChC,SAAS,EACT,SAAS,gDAAgD;AAAA,EAC3D,YAAY,EACV,KAAK,CAAC,UAAU,QAAQ,OAAO,CAAC,EAChC,SAAS,EACT,SAAS,wGAAwG;AAAA,EACnH,SAAS,EACP,QAAQ,EACR,SAAS,EACT,SAAS,kDAAkD;AAAA,EAC7D,WAAW,EACT;AAAA,IACA,EAAE,KAAK,CAAC,UAAU,UAAU,OAAO,CAAC;AAAA,IACpC,EAAE,OAAO;AAAA,EACV,EACC,SAAS,EACT,SAAS,2JAA2J;AAAA,EACtK,QAAQ,EACN,QAAQ,EACR,SAAS,EACT,SAAS,yFAAyF;AAAA,EACpG,aAAa,EACX,QAAQ,EACR,SAAS,EACT,SAAS,8KAA8K;AAC1L,CAAC;AAKM,IAAM,sBAAsB;AAM5B,IAAM,0BAA0B,EAAE,OAAO;AAAA,EAC/C,OAAO,EACL,KAAK,CAAC,UAAU,QAAQ,OAAO,CAAC,EAChC,QAAQ,MAAM,EACd,SAAS,8CAA8C;AAAA,EACzD,YAAY,EACV,KAAK,CAAC,UAAU,QAAQ,OAAO,C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AAS;AACrB,WAAI,0CAAU,SAAV,mBAAgB,YAAY;AAC/B,eAAO,SAAS,KAAK;AAAA,MACtB;AAEA,aAAO;AAAA,IACR;AACA,aAAO,0CAAU,SAAV,mBAAgB,UAAS,wBAAwB,MAAM,CAAC,CAAC,EAAE;AAAA,EACnE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,aAAa,UAAuD;AA92CrE;AA+2CE,aAAO,0CAAU,SAAV,mBAAgB,UAAS,0BAA0B,MAAM,CAAC,CAAC,EAAE;AAAA,EACrE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,eAAe,UAAyD;AAz3CzE;AA03CE,aAAO,0CAAU,SAAV,mBAAgB,YAAW;AAAA,EACnC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,gBAAgB,UAAkE;AAp4CnF;AAq4CE,aAAO,0CAAU,SAAV,mBAAgB,aAAY;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,wBAAwB,UAAmC;AA/4C5D;AAg5CE,aAAO,0CAAU,SAAV,mBAAgB,sBAAqB;AAAA,EAC7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,gBAAgB,UAAuD;AA15CxE;AA25CE,aAAO,0CAAU,YAAV,mBAAmB,UAAS,sBAAsB,MAAM,CAAC,CAAC,EAAE;AAAA,EACpE;AACD;","names":["path"]}
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
} from "./chunk-NXMDEL3F.js";
|
|
5
5
|
import {
|
|
6
6
|
VCSProviderFactory
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-KQSV7FOG.js";
|
|
8
8
|
import {
|
|
9
9
|
IssueManagementProviderFactory
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-NTDY5AMO.js";
|
|
11
11
|
import {
|
|
12
12
|
PromptTemplateManager
|
|
13
13
|
} from "./chunk-7RCUWU3I.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
} from "./chunk-DDHWZNGL.js";
|
|
21
21
|
import {
|
|
22
22
|
SettingsManager
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-WGUGB54H.js";
|
|
24
24
|
import {
|
|
25
25
|
MetadataManager
|
|
26
26
|
} from "./chunk-4JZEQBWV.js";
|
|
@@ -379,4 +379,4 @@ var SessionSummaryService = class {
|
|
|
379
379
|
export {
|
|
380
380
|
SessionSummaryService
|
|
381
381
|
};
|
|
382
|
-
//# sourceMappingURL=chunk-
|
|
382
|
+
//# sourceMappingURL=chunk-X5DRLONY.js.map
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-DDHWZNGL.js";
|
|
10
10
|
import {
|
|
11
11
|
SettingsManager
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WGUGB54H.js";
|
|
13
13
|
import {
|
|
14
14
|
logger
|
|
15
15
|
} from "./chunk-VRPPI6GU.js";
|
|
@@ -121,4 +121,4 @@ var ClaudeService = class {
|
|
|
121
121
|
export {
|
|
122
122
|
ClaudeService
|
|
123
123
|
};
|
|
124
|
-
//# sourceMappingURL=chunk-
|
|
124
|
+
//# sourceMappingURL=chunk-XCP2WDYA.js.map
|
|
@@ -32,6 +32,8 @@ function validateNeonConfig(config) {
|
|
|
32
32
|
var NeonProvider = class {
|
|
33
33
|
constructor(config) {
|
|
34
34
|
this.config = config;
|
|
35
|
+
this.displayName = "Neon";
|
|
36
|
+
this.installHint = "npm install -g neonctl";
|
|
35
37
|
this._isConfigured = false;
|
|
36
38
|
getLogger().debug("NeonProvider initialized with config:", {
|
|
37
39
|
projectId: config.projectId,
|
|
@@ -432,10 +434,313 @@ var NeonProvider = class {
|
|
|
432
434
|
}
|
|
433
435
|
};
|
|
434
436
|
|
|
435
|
-
// src/
|
|
436
|
-
|
|
437
|
-
|
|
437
|
+
// src/lib/providers/SupabaseProvider.ts
|
|
438
|
+
import { execa as execa2 } from "execa";
|
|
439
|
+
function validateSupabaseConfig(config) {
|
|
440
|
+
if (!config.projectRef) {
|
|
441
|
+
return {
|
|
442
|
+
valid: false,
|
|
443
|
+
error: "Supabase projectRef is required. Configure in .iloom/settings.json under databaseProviders.supabase"
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
if (!/^[a-zA-Z0-9-]+$/.test(config.projectRef)) {
|
|
447
|
+
return {
|
|
448
|
+
valid: false,
|
|
449
|
+
error: "Supabase projectRef contains invalid characters"
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
return { valid: true };
|
|
453
|
+
}
|
|
454
|
+
var SupabaseProvider = class {
|
|
455
|
+
constructor(config) {
|
|
456
|
+
this.config = config;
|
|
457
|
+
this._isConfigured = false;
|
|
458
|
+
this.displayName = "Supabase CLI";
|
|
459
|
+
this.installHint = "Install with: npm install -g supabase";
|
|
460
|
+
getLogger().debug("SupabaseProvider initialized with config:", {
|
|
461
|
+
projectRef: config.projectRef,
|
|
462
|
+
parentBranch: config.parentBranch,
|
|
463
|
+
withData: config.withData,
|
|
464
|
+
hasProjectRef: !!config.projectRef,
|
|
465
|
+
hasParentBranch: !!config.parentBranch
|
|
466
|
+
});
|
|
467
|
+
const validation = validateSupabaseConfig(config);
|
|
468
|
+
if (!validation.valid) {
|
|
469
|
+
getLogger().debug(`SupabaseProvider not configured: ${validation.error}`);
|
|
470
|
+
getLogger().debug("Supabase database branching will not be used");
|
|
471
|
+
this._isConfigured = false;
|
|
472
|
+
} else {
|
|
473
|
+
this._isConfigured = true;
|
|
474
|
+
}
|
|
475
|
+
if (config.parentBranch) {
|
|
476
|
+
getLogger().debug(
|
|
477
|
+
`parentBranch '${config.parentBranch}' is stored but Supabase currently always branches from the default branch`
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Check if provider is properly configured
|
|
483
|
+
* Returns true if projectRef and parentBranch are valid in settings
|
|
484
|
+
*/
|
|
485
|
+
isConfigured() {
|
|
486
|
+
return this._isConfigured;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Execute a Supabase CLI command and return stdout
|
|
490
|
+
* Throws an error if the command fails
|
|
491
|
+
*
|
|
492
|
+
* @param args - Command arguments to pass to supabase CLI
|
|
493
|
+
* @param cwd - Optional working directory to run the command from (defaults to current directory)
|
|
494
|
+
*/
|
|
495
|
+
async executeSupabaseCommand(args, cwd, timeout = 3e4) {
|
|
496
|
+
if (!this._isConfigured) {
|
|
497
|
+
throw new Error(
|
|
498
|
+
"SupabaseProvider is not configured. Check databaseProviders.supabase configuration in .iloom/settings.json"
|
|
499
|
+
);
|
|
500
|
+
}
|
|
501
|
+
const command = `supabase ${args.join(" ")}`;
|
|
502
|
+
getLogger().debug(`Executing Supabase CLI command: ${command}`);
|
|
503
|
+
getLogger().debug(`Project ref being used: ${this.config.projectRef}`);
|
|
504
|
+
if (cwd) {
|
|
505
|
+
getLogger().debug(`Working directory: ${cwd}`);
|
|
506
|
+
}
|
|
507
|
+
const result = await execa2("supabase", args, {
|
|
508
|
+
timeout,
|
|
509
|
+
encoding: "utf8",
|
|
510
|
+
stdio: "pipe",
|
|
511
|
+
...cwd && { cwd }
|
|
512
|
+
});
|
|
513
|
+
return result.stdout;
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Check if supabase CLI is available
|
|
517
|
+
*/
|
|
518
|
+
async isCliAvailable() {
|
|
519
|
+
try {
|
|
520
|
+
await execa2("supabase", ["--version"], {
|
|
521
|
+
timeout: 5e3,
|
|
522
|
+
stdio: "pipe"
|
|
523
|
+
});
|
|
524
|
+
return true;
|
|
525
|
+
} catch (error) {
|
|
526
|
+
const errorCode = error.code;
|
|
527
|
+
if (errorCode === "ENOENT" || errorCode === "EACCES") {
|
|
528
|
+
return false;
|
|
529
|
+
}
|
|
530
|
+
return true;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Check if user is authenticated with Supabase CLI
|
|
535
|
+
*
|
|
536
|
+
* @param cwd - Optional working directory to run the command from (prevents issues with deleted directories)
|
|
537
|
+
* @throws Error if authentication check fails for reasons other than not being authenticated
|
|
538
|
+
*/
|
|
539
|
+
async isAuthenticated(cwd) {
|
|
540
|
+
var _a;
|
|
541
|
+
const cliAvailable = await this.isCliAvailable();
|
|
542
|
+
if (!cliAvailable) {
|
|
543
|
+
return false;
|
|
544
|
+
}
|
|
545
|
+
try {
|
|
546
|
+
await execa2("supabase", ["projects", "list"], {
|
|
547
|
+
timeout: 1e4,
|
|
548
|
+
stdio: "pipe",
|
|
549
|
+
...cwd && { cwd }
|
|
550
|
+
});
|
|
551
|
+
return true;
|
|
552
|
+
} catch (error) {
|
|
553
|
+
const execaError = error;
|
|
554
|
+
const stderr = ((_a = execaError.stderr) == null ? void 0 : _a.trim()) ?? "";
|
|
555
|
+
const isAuthError = stderr.toLowerCase().includes("not authenticated") || stderr.toLowerCase().includes("not logged in") || stderr.toLowerCase().includes("authentication required") || stderr.toLowerCase().includes("login required") || stderr.toLowerCase().includes("access token not provided") || stderr.toLowerCase().includes("you need to be logged in");
|
|
556
|
+
if (isAuthError) {
|
|
557
|
+
return false;
|
|
558
|
+
}
|
|
559
|
+
throw error;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Sanitize branch name for Supabase (replace slashes with hyphens)
|
|
564
|
+
* Supabase uses hyphens as separator (not underscores like Neon)
|
|
565
|
+
*/
|
|
566
|
+
sanitizeBranchName(branchName) {
|
|
567
|
+
let sanitized = branchName.replace(/\//g, "-").replace(/[^a-zA-Z0-9_-]/g, "").replace(/^-+/, "");
|
|
568
|
+
return sanitized || "unnamed-branch";
|
|
569
|
+
}
|
|
570
|
+
/**
|
|
571
|
+
* List all branches in the Supabase project
|
|
572
|
+
*
|
|
573
|
+
* @param cwd - Optional working directory to run commands from
|
|
574
|
+
*/
|
|
575
|
+
async listBranches(cwd) {
|
|
576
|
+
const output = await this.executeSupabaseCommand(
|
|
577
|
+
["branches", "list", "--project-ref", this.config.projectRef, "-o", "json"],
|
|
578
|
+
cwd
|
|
579
|
+
);
|
|
580
|
+
let jsonString = output;
|
|
581
|
+
const firstBracket = output.indexOf("[");
|
|
582
|
+
if (firstBracket > 0) {
|
|
583
|
+
jsonString = output.slice(firstBracket);
|
|
584
|
+
}
|
|
585
|
+
let branches;
|
|
586
|
+
try {
|
|
587
|
+
branches = JSON.parse(jsonString);
|
|
588
|
+
} catch (parseError) {
|
|
589
|
+
throw new Error(
|
|
590
|
+
`Failed to parse Supabase branch list as JSON: ${parseError instanceof Error ? parseError.message : String(parseError)}`
|
|
591
|
+
);
|
|
592
|
+
}
|
|
593
|
+
return branches.map((branch) => branch.name);
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* Check if a branch exists
|
|
597
|
+
* Uses `supabase branches get` for a direct lookup (more efficient than listing all)
|
|
598
|
+
*
|
|
599
|
+
* @param name - Branch name to check
|
|
600
|
+
* @param cwd - Optional working directory to run commands from
|
|
601
|
+
*/
|
|
602
|
+
async branchExists(name, cwd) {
|
|
603
|
+
var _a, _b;
|
|
604
|
+
const sanitizedName = this.sanitizeBranchName(name);
|
|
605
|
+
try {
|
|
606
|
+
await this.executeSupabaseCommand(
|
|
607
|
+
["branches", "get", sanitizedName, "--project-ref", this.config.projectRef],
|
|
608
|
+
cwd
|
|
609
|
+
);
|
|
610
|
+
return true;
|
|
611
|
+
} catch (error) {
|
|
612
|
+
const execaError = error;
|
|
613
|
+
const stderr = ((_a = execaError.stderr) == null ? void 0 : _a.toLowerCase()) ?? "";
|
|
614
|
+
const stdout = ((_b = execaError.stdout) == null ? void 0 : _b.toLowerCase()) ?? "";
|
|
615
|
+
const message = (error instanceof Error ? error.message : String(error)).toLowerCase();
|
|
616
|
+
const isNotFound = stderr.includes("not found") || stderr.includes("does not exist") || stderr.includes("no branch") || stdout.includes("not found") || message.includes("not found") || message.includes("does not exist");
|
|
617
|
+
if (isNotFound) {
|
|
618
|
+
return false;
|
|
619
|
+
}
|
|
620
|
+
throw error;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Get connection string for a specific branch
|
|
625
|
+
* Parses POSTGRES_URL_NON_POOLING from `supabase branches get <name> -o env` output
|
|
626
|
+
* Connection strings are never logged at info level or above (security)
|
|
627
|
+
*
|
|
628
|
+
* @param branch - Branch name to get connection string for
|
|
629
|
+
* @param cwd - Optional working directory to run commands from
|
|
630
|
+
*/
|
|
631
|
+
async getConnectionString(branch, cwd) {
|
|
632
|
+
const sanitizedBranch = this.sanitizeBranchName(branch);
|
|
633
|
+
const output = await this.executeSupabaseCommand(
|
|
634
|
+
["branches", "get", sanitizedBranch, "--project-ref", this.config.projectRef, "-o", "env"],
|
|
635
|
+
cwd
|
|
636
|
+
);
|
|
637
|
+
const match = output.match(/^POSTGRES_URL_NON_POOLING=(.+)$/m);
|
|
638
|
+
if (!(match == null ? void 0 : match[1])) {
|
|
639
|
+
throw new Error(
|
|
640
|
+
`Could not find POSTGRES_URL_NON_POOLING in branch '${branch}' environment output`
|
|
641
|
+
);
|
|
642
|
+
}
|
|
643
|
+
const connectionString = match[1].trim();
|
|
644
|
+
getLogger().debug(`Connection string retrieved for branch '${branch}'`);
|
|
645
|
+
return connectionString;
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Create a new database branch
|
|
649
|
+
* Returns connection string for the branch
|
|
650
|
+
*
|
|
651
|
+
* Note: Supabase preview branches always branch from the production database.
|
|
652
|
+
* The fromBranch parameter is accepted for interface compatibility but ignored.
|
|
653
|
+
*
|
|
654
|
+
* @param name - Name for the new branch
|
|
655
|
+
* @param fromBranch - Accepted for interface compatibility but ignored (Supabase always branches from production)
|
|
656
|
+
* @param cwd - Optional working directory to run commands from
|
|
657
|
+
*/
|
|
658
|
+
async createBranch(name, fromBranch, cwd) {
|
|
659
|
+
void fromBranch;
|
|
660
|
+
const sanitizedName = this.sanitizeBranchName(name);
|
|
661
|
+
getLogger().info("Creating Supabase database branch...");
|
|
662
|
+
getLogger().info(` New branch: ${sanitizedName}`);
|
|
663
|
+
const args = [
|
|
664
|
+
"branches",
|
|
665
|
+
"create",
|
|
666
|
+
sanitizedName,
|
|
667
|
+
"--project-ref",
|
|
668
|
+
this.config.projectRef
|
|
669
|
+
];
|
|
670
|
+
if (this.config.withData !== false) {
|
|
671
|
+
args.push("--with-data");
|
|
672
|
+
}
|
|
673
|
+
await this.executeSupabaseCommand(args, cwd, 3e5);
|
|
674
|
+
getLogger().success("Database branch created successfully");
|
|
675
|
+
getLogger().info("Getting connection string for new database branch...");
|
|
676
|
+
const connectionString = await this.getConnectionString(sanitizedName, cwd);
|
|
677
|
+
return connectionString;
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Delete a database branch
|
|
681
|
+
*
|
|
682
|
+
* @param name - Name of the branch to delete
|
|
683
|
+
* @param isPreview - Accepted but ignored (Neon-specific concept for Vercel preview databases)
|
|
684
|
+
* @param cwd - Optional working directory to run commands from (prevents issues with deleted directories)
|
|
685
|
+
*/
|
|
686
|
+
async deleteBranch(name, isPreview = false, cwd) {
|
|
687
|
+
void isPreview;
|
|
688
|
+
const sanitizedName = this.sanitizeBranchName(name);
|
|
689
|
+
getLogger().info(`Checking for Supabase database branch: ${sanitizedName}`);
|
|
690
|
+
try {
|
|
691
|
+
const exists = await this.branchExists(sanitizedName, cwd);
|
|
692
|
+
if (!exists) {
|
|
693
|
+
getLogger().info(`No database branch found for '${name}'`);
|
|
694
|
+
return {
|
|
695
|
+
success: true,
|
|
696
|
+
deleted: false,
|
|
697
|
+
notFound: true,
|
|
698
|
+
branchName: sanitizedName
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
getLogger().info(`Deleting Supabase database branch: ${sanitizedName}`);
|
|
702
|
+
await this.executeSupabaseCommand(
|
|
703
|
+
["branches", "delete", sanitizedName, "--project-ref", this.config.projectRef],
|
|
704
|
+
cwd
|
|
705
|
+
);
|
|
706
|
+
getLogger().success("Database branch deleted successfully");
|
|
707
|
+
return {
|
|
708
|
+
success: true,
|
|
709
|
+
deleted: true,
|
|
710
|
+
notFound: false,
|
|
711
|
+
branchName: sanitizedName
|
|
712
|
+
};
|
|
713
|
+
} catch (error) {
|
|
714
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
715
|
+
getLogger().error(`Failed to delete database branch: ${errorMessage}`);
|
|
716
|
+
return {
|
|
717
|
+
success: false,
|
|
718
|
+
deleted: false,
|
|
719
|
+
notFound: false,
|
|
720
|
+
error: errorMessage,
|
|
721
|
+
branchName: sanitizedName
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
// src/utils/database-helpers.ts
|
|
728
|
+
function createDatabaseProviderFromSettings(settings) {
|
|
729
|
+
var _a, _b;
|
|
438
730
|
const neonConfig = (_a = settings.databaseProviders) == null ? void 0 : _a.neon;
|
|
731
|
+
const supabaseConfig = (_b = settings.databaseProviders) == null ? void 0 : _b.supabase;
|
|
732
|
+
if (neonConfig && supabaseConfig) {
|
|
733
|
+
throw new Error(
|
|
734
|
+
"Cannot configure both Neon and Supabase database providers simultaneously. Remove one from databaseProviders in .iloom/settings.json."
|
|
735
|
+
);
|
|
736
|
+
}
|
|
737
|
+
if (supabaseConfig) {
|
|
738
|
+
return new SupabaseProvider({
|
|
739
|
+
projectRef: supabaseConfig.projectRef,
|
|
740
|
+
...supabaseConfig.parentBranch && { parentBranch: supabaseConfig.parentBranch },
|
|
741
|
+
...supabaseConfig.withData !== void 0 && { withData: supabaseConfig.withData }
|
|
742
|
+
});
|
|
743
|
+
}
|
|
439
744
|
return new NeonProvider({
|
|
440
745
|
projectId: (neonConfig == null ? void 0 : neonConfig.projectId) ?? "",
|
|
441
746
|
parentBranch: (neonConfig == null ? void 0 : neonConfig.parentBranch) ?? ""
|
|
@@ -443,6 +748,6 @@ function createNeonProviderFromSettings(settings) {
|
|
|
443
748
|
}
|
|
444
749
|
|
|
445
750
|
export {
|
|
446
|
-
|
|
751
|
+
createDatabaseProviderFromSettings
|
|
447
752
|
};
|
|
448
|
-
//# sourceMappingURL=chunk-
|
|
753
|
+
//# sourceMappingURL=chunk-YUOVWWJX.js.map
|