harnesstap 1.3.2 → 1.4.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 +2 -0
- package/dist/apply-SUNDXRJ3.js +54 -0
- package/dist/{approve-L7IFSYBO.js → approve-FBGYQGWN.js} +14 -15
- package/dist/{approve-L7IFSYBO.js.map → approve-FBGYQGWN.js.map} +1 -1
- package/dist/{audit-PBJDK7A4.js → audit-VI4QZ6X2.js} +30 -39
- package/dist/{audit-PBJDK7A4.js.map → audit-VI4QZ6X2.js.map} +1 -1
- package/dist/{auth-OM73RLNS.js → auth-4CQCDS2W.js} +17 -19
- package/dist/{auth-OM73RLNS.js.map → auth-4CQCDS2W.js.map} +1 -1
- package/dist/bin.js +3 -3
- package/dist/{chunk-YRGM7RAD.js → chunk-23XSG7LI.js} +7 -11
- package/dist/{chunk-YRGM7RAD.js.map → chunk-23XSG7LI.js.map} +1 -1
- package/dist/{chunk-LDVXYN6F.js → chunk-2A36HWDE.js} +63 -13
- package/dist/chunk-2A36HWDE.js.map +1 -0
- package/dist/{chunk-QNAIDM6W.js → chunk-3FS775NP.js} +51 -4
- package/dist/chunk-3FS775NP.js.map +1 -0
- package/dist/{chunk-XCPWLGPB.js → chunk-3P6BWL5F.js} +2 -2
- package/dist/{chunk-JJJJ2RAD.js → chunk-43BDGVN3.js} +19 -6
- package/dist/chunk-43BDGVN3.js.map +1 -0
- package/dist/{chunk-CZ4T75PP.js → chunk-4ZQ2SCGY.js} +146 -78
- package/dist/chunk-4ZQ2SCGY.js.map +1 -0
- package/dist/{chunk-ZVANUFPF.js → chunk-6LTLYV5D.js} +353 -267
- package/dist/chunk-6LTLYV5D.js.map +1 -0
- package/dist/{chunk-OPVIX7E4.js → chunk-73OJQTBW.js} +6 -2
- package/dist/chunk-73OJQTBW.js.map +1 -0
- package/dist/{chunk-WXRPQICX.js → chunk-7HP6AAI3.js} +2 -2
- package/dist/{chunk-ENHDEB7Z.js → chunk-BPWFQKI5.js} +5 -7
- package/dist/{chunk-ENHDEB7Z.js.map → chunk-BPWFQKI5.js.map} +1 -1
- package/dist/{chunk-64R32MG2.js → chunk-D432JAXV.js} +44 -19
- package/dist/chunk-D432JAXV.js.map +1 -0
- package/dist/chunk-DF4Z7LAD.js +3463 -0
- package/dist/chunk-DF4Z7LAD.js.map +1 -0
- package/dist/{chunk-FUV7QYBS.js → chunk-EOPFER6N.js} +71 -318
- package/dist/chunk-EOPFER6N.js.map +1 -0
- package/dist/chunk-G6WKY2W4.js +389 -0
- package/dist/chunk-G6WKY2W4.js.map +1 -0
- package/dist/{chunk-IHW4PCDT.js → chunk-GRASK6M6.js} +5 -5
- package/dist/{chunk-R4PTE774.js → chunk-IE7B6Q5K.js} +33 -39
- package/dist/chunk-IE7B6Q5K.js.map +1 -0
- package/dist/{chunk-UNRR4KH5.js → chunk-IMROMZ2K.js} +6 -5
- package/dist/{chunk-UNRR4KH5.js.map → chunk-IMROMZ2K.js.map} +1 -1
- package/dist/{chunk-G5RWVZZ7.js → chunk-L6YZE5MY.js} +3 -3
- package/dist/{chunk-SNVAMWB7.js → chunk-M2U3J7UX.js} +7 -1
- package/dist/chunk-M2U3J7UX.js.map +1 -0
- package/dist/{chunk-AFKCNFPP.js → chunk-M4KLHJ6U.js} +16 -13
- package/dist/chunk-M4KLHJ6U.js.map +1 -0
- package/dist/{chunk-XRXFJTAT.js → chunk-MR7IOHSX.js} +16 -19
- package/dist/chunk-MR7IOHSX.js.map +1 -0
- package/dist/{chunk-UEHDEADL.js → chunk-N3VGY3T3.js} +15 -15
- package/dist/chunk-N3VGY3T3.js.map +1 -0
- package/dist/{chunk-IKAGGJEO.js → chunk-N3ZCH64F.js} +496 -10
- package/dist/chunk-N3ZCH64F.js.map +1 -0
- package/dist/{chunk-U472S6IB.js → chunk-OML4HXKT.js} +20 -22
- package/dist/chunk-OML4HXKT.js.map +1 -0
- package/dist/{chunk-3EGM4IUI.js → chunk-P2C7JPLD.js} +3 -3
- package/dist/{chunk-MFCZN253.js → chunk-PCMON7Y2.js} +7 -7
- package/dist/{chunk-FBYAIBHP.js → chunk-PNGF5EV2.js} +2 -2
- package/dist/{chunk-6JMVGKMD.js → chunk-QA5U36JN.js} +187 -203
- package/dist/chunk-QA5U36JN.js.map +1 -0
- package/dist/{chunk-AVZOFMJX.js → chunk-R7ZOYVN3.js} +241 -126
- package/dist/chunk-R7ZOYVN3.js.map +1 -0
- package/dist/{chunk-YVJQ2QDG.js → chunk-RDG5DT7S.js} +45 -49
- package/dist/{chunk-YVJQ2QDG.js.map → chunk-RDG5DT7S.js.map} +1 -1
- package/dist/{chunk-VQVUJYYY.js → chunk-REHRUNBB.js} +8 -3
- package/dist/chunk-REHRUNBB.js.map +1 -0
- package/dist/{chunk-Y2JGMICO.js → chunk-RFQ3N7FB.js} +19 -29
- package/dist/chunk-RFQ3N7FB.js.map +1 -0
- package/dist/{chunk-EY4ES5MG.js → chunk-RVEXPMM3.js} +3 -3
- package/dist/{chunk-6I3RY6R5.js → chunk-TPEJFLV7.js} +13 -15
- package/dist/{chunk-6I3RY6R5.js.map → chunk-TPEJFLV7.js.map} +1 -1
- package/dist/{chunk-IAZNF35S.js → chunk-U6DXASQP.js} +2 -2
- package/dist/{chunk-OQ4KBUN2.js → chunk-ULCD6DJE.js} +30 -8
- package/dist/chunk-ULCD6DJE.js.map +1 -0
- package/dist/{chunk-BXSS2S4W.js → chunk-UVVZHWD2.js} +2 -2
- package/dist/{chunk-24V5ZSIF.js → chunk-WG5A6EAU.js} +269 -13
- package/dist/chunk-WG5A6EAU.js.map +1 -0
- package/dist/{chunk-LGWUTV5Q.js → chunk-WGP4GUYZ.js} +10 -10
- package/dist/{chunk-GWQVYGRD.js → chunk-XTVGCVU4.js} +124 -83
- package/dist/chunk-XTVGCVU4.js.map +1 -0
- package/dist/{chunk-YX7MVSDA.js → chunk-XUJKZQZA.js} +8 -8
- package/dist/chunk-XUJKZQZA.js.map +1 -0
- package/dist/chunk-ZUASVASP.js +30317 -0
- package/dist/chunk-ZUASVASP.js.map +1 -0
- package/dist/{compile-SDOASKGL.js → compile-GXADKGH5.js} +37 -50
- package/dist/{compile-SDOASKGL.js.map → compile-GXADKGH5.js.map} +1 -1
- package/dist/{config-4VZTVZKF.js → config-JMHNA2U5.js} +22 -35
- package/dist/{config-4VZTVZKF.js.map → config-JMHNA2U5.js.map} +1 -1
- package/dist/cursor-local-install-46RWRBDT.js +98 -0
- package/dist/cursor-local-install-46RWRBDT.js.map +1 -0
- package/dist/{doctor-HH6CFBRQ.js → doctor-N7ZULPOL.js} +18 -19
- package/dist/{doctor-HH6CFBRQ.js.map → doctor-N7ZULPOL.js.map} +1 -1
- package/dist/{environment-K7YMJJYN.js → environment-OBB3WU5B.js} +60 -71
- package/dist/{environment-K7YMJJYN.js.map → environment-OBB3WU5B.js.map} +1 -1
- package/dist/{github-A6TYG7WS.js → github-PBYBGOLH.js} +17 -17
- package/dist/{harness-772XBFZQ.js → harness-7KYATIV6.js} +56 -67
- package/dist/{harness-772XBFZQ.js.map → harness-7KYATIV6.js.map} +1 -1
- package/dist/{help-QR4VTJZU.js → help-EE3AJQD4.js} +48 -52
- package/dist/help-EE3AJQD4.js.map +1 -0
- package/dist/{help-TLHNRJJ6.js → help-VXWKLQ6A.js} +55 -15
- package/dist/help-VXWKLQ6A.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +16 -24
- package/dist/{init-AOKFPZHG.js → init-LBTMPDVJ.js} +43 -56
- package/dist/init-LBTMPDVJ.js.map +1 -0
- package/dist/live-read-cache-TUSP7U3D.js +10 -0
- package/dist/{lock-INAXNLMC.js → lock-WLJRXRVK.js} +16 -16
- package/dist/{marketplace-TUVLLPBG.js → marketplace-GXSV6QIY.js} +62 -28
- package/dist/marketplace-GXSV6QIY.js.map +1 -0
- package/dist/{mcp-MMWGRASN.js → mcp-XPDWWU75.js} +35 -48
- package/dist/{mcp-MMWGRASN.js.map → mcp-XPDWWU75.js.map} +1 -1
- package/dist/{migrate-55S4XODX.js → migrate-SBUIWN3U.js} +79 -64
- package/dist/migrate-SBUIWN3U.js.map +1 -0
- package/dist/open-HDGLYYVU.js +24 -0
- package/dist/{pack-VZIBS42E.js → pack-A73LDVOX.js} +16 -22
- package/dist/{pack-VZIBS42E.js.map → pack-A73LDVOX.js.map} +1 -1
- package/dist/plugin-CEO6ZJM5.js +51 -0
- package/dist/plugin-from-project-UK7VJVUP.js +18 -0
- package/dist/{policy-P3HGLEZS.js → policy-6VY3CMSU.js} +13 -14
- package/dist/{policy-P3HGLEZS.js.map → policy-6VY3CMSU.js.map} +1 -1
- package/dist/{profile-STS3CZUK.js → profile-YCKPMRRU.js} +96 -102
- package/dist/profile-YCKPMRRU.js.map +1 -0
- package/dist/{project-R4DGM3ZG.js → project-KHPPBKPN.js} +63 -77
- package/dist/{project-R4DGM3ZG.js.map → project-KHPPBKPN.js.map} +1 -1
- package/dist/{resource-GJVEDXVZ.js → resource-IJU3FAN5.js} +42 -49
- package/dist/{resource-GJVEDXVZ.js.map → resource-IJU3FAN5.js.map} +1 -1
- package/dist/{version-FUHV4O6U.js → version-Z66FWWMQ.js} +2 -2
- package/dist/version-Z66FWWMQ.js.map +1 -0
- package/package.json +3 -2
- package/dist/apply-Q5SFF3FY.js +0 -67
- package/dist/chunk-24V5ZSIF.js.map +0 -1
- package/dist/chunk-3JOPDYQD.js +0 -730
- package/dist/chunk-3JOPDYQD.js.map +0 -1
- package/dist/chunk-555XE3NJ.js +0 -60
- package/dist/chunk-555XE3NJ.js.map +0 -1
- package/dist/chunk-64R32MG2.js.map +0 -1
- package/dist/chunk-6JMVGKMD.js.map +0 -1
- package/dist/chunk-6ZWKF3YZ.js +0 -7795
- package/dist/chunk-6ZWKF3YZ.js.map +0 -1
- package/dist/chunk-AFKCNFPP.js.map +0 -1
- package/dist/chunk-AUWWL6KX.js +0 -296
- package/dist/chunk-AUWWL6KX.js.map +0 -1
- package/dist/chunk-AVZOFMJX.js.map +0 -1
- package/dist/chunk-CZ4T75PP.js.map +0 -1
- package/dist/chunk-FUV7QYBS.js.map +0 -1
- package/dist/chunk-GWQVYGRD.js.map +0 -1
- package/dist/chunk-HENOKIBB.js +0 -346
- package/dist/chunk-HENOKIBB.js.map +0 -1
- package/dist/chunk-HWL67OCJ.js +0 -238
- package/dist/chunk-HWL67OCJ.js.map +0 -1
- package/dist/chunk-IKAGGJEO.js.map +0 -1
- package/dist/chunk-JJJJ2RAD.js.map +0 -1
- package/dist/chunk-JRFUTIEH.js +0 -426
- package/dist/chunk-JRFUTIEH.js.map +0 -1
- package/dist/chunk-KJIFZLHN.js +0 -11066
- package/dist/chunk-KJIFZLHN.js.map +0 -1
- package/dist/chunk-LDVXYN6F.js.map +0 -1
- package/dist/chunk-MHOTXMD2.js +0 -430
- package/dist/chunk-MHOTXMD2.js.map +0 -1
- package/dist/chunk-NEPUP33Q.js +0 -35
- package/dist/chunk-NEPUP33Q.js.map +0 -1
- package/dist/chunk-OPVIX7E4.js.map +0 -1
- package/dist/chunk-OQ4KBUN2.js.map +0 -1
- package/dist/chunk-OXVCYRZB.js +0 -491
- package/dist/chunk-OXVCYRZB.js.map +0 -1
- package/dist/chunk-PJQAMC6L.js +0 -183
- package/dist/chunk-PJQAMC6L.js.map +0 -1
- package/dist/chunk-PW5QXRBA.js +0 -1173
- package/dist/chunk-PW5QXRBA.js.map +0 -1
- package/dist/chunk-QNAIDM6W.js.map +0 -1
- package/dist/chunk-R4PTE774.js.map +0 -1
- package/dist/chunk-S2E4KSYW.js +0 -610
- package/dist/chunk-S2E4KSYW.js.map +0 -1
- package/dist/chunk-SNVAMWB7.js.map +0 -1
- package/dist/chunk-U472S6IB.js.map +0 -1
- package/dist/chunk-UEHDEADL.js.map +0 -1
- package/dist/chunk-VQVUJYYY.js.map +0 -1
- package/dist/chunk-XRXFJTAT.js.map +0 -1
- package/dist/chunk-Y2JGMICO.js.map +0 -1
- package/dist/chunk-YX7MVSDA.js.map +0 -1
- package/dist/chunk-ZGRBIBO7.js +0 -681
- package/dist/chunk-ZGRBIBO7.js.map +0 -1
- package/dist/chunk-ZTBAMBAI.js +0 -6448
- package/dist/chunk-ZTBAMBAI.js.map +0 -1
- package/dist/chunk-ZVANUFPF.js.map +0 -1
- package/dist/help-QR4VTJZU.js.map +0 -1
- package/dist/help-TLHNRJJ6.js.map +0 -1
- package/dist/init-AOKFPZHG.js.map +0 -1
- package/dist/marketplace-TUVLLPBG.js.map +0 -1
- package/dist/migrate-55S4XODX.js.map +0 -1
- package/dist/open-SLFQV45J.js +0 -32
- package/dist/plugin-WLEFFBRY.js +0 -64
- package/dist/plugin-from-project-UV2O364T.js +0 -16
- package/dist/profile-STS3CZUK.js.map +0 -1
- /package/dist/{apply-Q5SFF3FY.js.map → apply-SUNDXRJ3.js.map} +0 -0
- /package/dist/{chunk-XCPWLGPB.js.map → chunk-3P6BWL5F.js.map} +0 -0
- /package/dist/{chunk-WXRPQICX.js.map → chunk-7HP6AAI3.js.map} +0 -0
- /package/dist/{chunk-IHW4PCDT.js.map → chunk-GRASK6M6.js.map} +0 -0
- /package/dist/{chunk-G5RWVZZ7.js.map → chunk-L6YZE5MY.js.map} +0 -0
- /package/dist/{chunk-3EGM4IUI.js.map → chunk-P2C7JPLD.js.map} +0 -0
- /package/dist/{chunk-MFCZN253.js.map → chunk-PCMON7Y2.js.map} +0 -0
- /package/dist/{chunk-FBYAIBHP.js.map → chunk-PNGF5EV2.js.map} +0 -0
- /package/dist/{chunk-EY4ES5MG.js.map → chunk-RVEXPMM3.js.map} +0 -0
- /package/dist/{chunk-IAZNF35S.js.map → chunk-U6DXASQP.js.map} +0 -0
- /package/dist/{chunk-BXSS2S4W.js.map → chunk-UVVZHWD2.js.map} +0 -0
- /package/dist/{chunk-LGWUTV5Q.js.map → chunk-WGP4GUYZ.js.map} +0 -0
- /package/dist/{github-A6TYG7WS.js.map → github-PBYBGOLH.js.map} +0 -0
- /package/dist/{open-SLFQV45J.js.map → live-read-cache-TUSP7U3D.js.map} +0 -0
- /package/dist/{lock-INAXNLMC.js.map → lock-WLJRXRVK.js.map} +0 -0
- /package/dist/{plugin-WLEFFBRY.js.map → open-HDGLYYVU.js.map} +0 -0
- /package/dist/{plugin-from-project-UV2O364T.js.map → plugin-CEO6ZJM5.js.map} +0 -0
- /package/dist/{version-FUHV4O6U.js.map → plugin-from-project-UK7VJVUP.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/services/use-command.ts"],"sourcesContent":["import { resolve } from \"node:path\";\nimport { getDb } from \"../db/connection.js\";\nimport { initializeSchema } from \"../db/schema.js\";\nimport { ui } from \"../ui/index.js\";\nimport { printApplyPayload } from \"../cli/print-apply-summary.js\";\nimport { formatCount } from \"../copy/plurals.js\";\nimport { parseOutputFormat, printJson } from \"../utils/output-format.js\";\nimport { MISSING_PROJECT_CONFIG_MESSAGE } from \"./project-config-messages.js\";\nimport {\n executeProjectUse,\n type ProjectUseOptions,\n type ProjectUseResult,\n} from \"./project-config-use.js\";\nimport {\n findProjectConfig,\n resolveProfileEnvironment,\n type ProjectProfileEntry,\n type ResolvedProjectConfig,\n} from \"./project-config.js\";\n\nexport interface UseCommandOptions {\n profile?: string;\n project?: string;\n list?: boolean;\n dryRun?: boolean;\n force?: boolean;\n pull?: boolean;\n harness?: string;\n account?: string;\n baseUrl?: string;\n onConflict?: string;\n interactive?: boolean;\n noInteractive?: boolean;\n format?: string;\n}\n\ninterface ProjectProfileListRow {\n profile: string;\n source: string;\n target: string;\n environment: string;\n default: string;\n}\n\nfunction profileTarget(entry: ProjectProfileEntry): string {\n switch (entry.source) {\n case \"catalog\":\n case \"local\":\n return entry.selector ?? \"\";\n case \"inline\":\n return entry.plugin ?? \"\";\n default: {\n const unhandledSource: never = entry.source;\n throw new Error(`Unhandled profile source: ${unhandledSource}`);\n }\n }\n}\n\nfunction buildProjectProfileListRows(config: ResolvedProjectConfig): ProjectProfileListRow[] {\n return config.profiles.map((entry) => ({\n profile: entry.name,\n source: entry.source,\n target: profileTarget(entry),\n environment: resolveProfileEnvironment(config, entry) ?? \"\",\n default: entry.name === config.default_profile ? \"*\" : \"\",\n }));\n}\n\nfunction listProjectProfiles(config: ResolvedProjectConfig, format: \"human\" | \"json\"): void {\n const rows = buildProjectProfileListRows(config);\n\n if (format === \"json\") {\n printJson(\n rows.map((row) => ({\n profile: row.profile,\n source: row.source,\n selector_or_plugin: row.target,\n environment: row.environment || undefined,\n default: row.default === \"*\",\n })),\n );\n return;\n }\n\n if (rows.length === 0) {\n ui.dim(\"No profiles configured in project config.\");\n return;\n }\n\n ui.table.print({\n columns: [\n { key: \"profile\", header: \"PROFILE\", width: 16 },\n { key: \"source\", header: \"SOURCE\", width: 10 },\n { key: \"target\", header: \"SELECTOR/PLUGIN\", width: 24 },\n { key: \"environment\", header: \"ENVIRONMENT\", width: 16 },\n { key: \"default\", header: \"\", width: 2 },\n ],\n rows,\n summary: formatCount(rows.length, \"profile\"),\n });\n}\n\nexport function renderProjectUseHuman(result: ProjectUseResult): void {\n if (result.skipped) {\n const environmentSuffix = result.environment_name\n ? ` with environment ${ui.theme.accent(result.environment_name)}`\n : \"\";\n ui.info(\n `Profile ${ui.theme.accent(result.profile_key)} (${result.plugin_name}) is already active and in sync${environmentSuffix}.`,\n );\n return;\n }\n\n if (result.cancelled) {\n process.exitCode = 1;\n ui.warn(\"Profile apply cancelled.\");\n return;\n }\n\n if (result.environment_name) {\n ui.info(`Environment: ${ui.theme.accent(result.environment_name)}`);\n }\n if ((result.pulled_plugins?.length ?? 0) > 0) {\n ui.info(`Pulled ${result.pulled_plugins?.length ?? 0} missing plugin dependencies:`);\n for (const pulled of result.pulled_plugins ?? []) {\n console.log(` - ${pulled.plugin_name} (${pulled.source})`);\n }\n }\n printApplyPayload(result);\n}\n\nfunction toProjectUseOptions(opts: UseCommandOptions): ProjectUseOptions {\n return {\n profile: opts.profile,\n project: opts.project,\n dryRun: opts.dryRun,\n force: opts.force,\n pull: opts.pull,\n harness: opts.harness,\n account: opts.account,\n baseUrl: opts.baseUrl,\n onConflict: opts.onConflict,\n format: opts.format,\n interactive: opts.interactive,\n noInteractive: opts.noInteractive,\n };\n}\n\nexport async function handleUseCommand(opts: UseCommandOptions): Promise<void> {\n const db = getDb();\n initializeSchema(db);\n const format = parseOutputFormat(opts.format);\n const projectPath = resolve(opts.project ?? process.cwd());\n\n if (opts.list) {\n const config = findProjectConfig(projectPath);\n if (!config) {\n process.exitCode = 1;\n ui.danger(MISSING_PROJECT_CONFIG_MESSAGE);\n return;\n }\n listProjectProfiles(config, format);\n return;\n }\n\n try {\n const result = await executeProjectUse({\n ...toProjectUseOptions({ ...opts, project: projectPath }),\n });\n if (format === \"json\") {\n printJson(result);\n return;\n }\n renderProjectUseHuman(result);\n } catch (err) {\n process.exitCode = 1;\n ui.danger(err instanceof Error ? err.message : String(err));\n }\n}\n\nexport function mapProfileUseDelegationOptions(opts: {\n profile?: string;\n project?: string;\n dryRun?: boolean;\n harness?: string;\n onConflict?: string;\n account?: string;\n baseUrl?: string;\n pull?: boolean;\n force?: boolean;\n interactive?: boolean;\n noInteractive?: boolean;\n format?: string;\n}): ProjectUseOptions {\n return {\n profile: opts.profile,\n project: opts.project,\n dryRun: opts.dryRun,\n force: opts.force,\n pull: opts.pull,\n harness: opts.harness,\n account: opts.account,\n baseUrl: opts.baseUrl,\n onConflict: opts.onConflict,\n format: opts.format,\n interactive: opts.interactive,\n noInteractive: opts.noInteractive,\n };\n}\n\nexport async function handleProfileUseProjectDelegation(\n opts: Parameters<typeof mapProfileUseDelegationOptions>[0],\n): Promise<boolean> {\n const config = findProjectConfig(resolve(opts.project ?? process.cwd()));\n if (!config) {\n return false;\n }\n\n const format = parseOutputFormat(opts.format);\n try {\n const result = await executeProjectUse(mapProfileUseDelegationOptions(opts));\n if (format === \"json\") {\n printJson(result);\n return true;\n }\n renderProjectUseHuman(result);\n return true;\n } catch (err) {\n process.exitCode = 1;\n ui.danger(err instanceof Error ? err.message : String(err));\n return true;\n }\n}\n"],"mapp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-
} from "./chunk-KJIFZLHN.js";
|
|
8
|
-
import {
|
|
9
|
-
CliUsageError
|
|
10
|
-
} from "./chunk-Y2JGMICO.js";
|
|
11
|
-
import {
|
|
12
|
-
CLI_ERRORS,
|
|
13
|
-
CLI_HINTS,
|
|
14
|
-
getDb
|
|
15
|
-
} from "./chunk-24V5ZSIF.js";
|
|
16
|
-
|
|
17
|
-
// src/models/project.ts
|
|
18
|
-
import { resolve } from "path";
|
|
19
|
-
import { ulid } from "ulid";
|
|
20
|
-
function createProject(input) {
|
|
21
|
-
const db = getDb();
|
|
22
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
23
|
-
const id = ulid();
|
|
24
|
-
db.prepare(
|
|
25
|
-
`INSERT INTO projects (id, git_origin, name, local_path, created_at)
|
|
26
|
-
VALUES (?, ?, ?, ?, ?)`
|
|
27
|
-
).run(id, input.git_origin, input.name, input.local_path, now);
|
|
28
|
-
return { id, ...input, created_at: now };
|
|
29
|
-
}
|
|
30
|
-
function getProjectByOrigin(gitOrigin) {
|
|
31
|
-
const db = getDb();
|
|
32
|
-
return db.prepare("SELECT * FROM projects WHERE git_origin = ?").get(gitOrigin);
|
|
33
|
-
}
|
|
34
|
-
function getProject(id) {
|
|
35
|
-
const db = getDb();
|
|
36
|
-
return db.prepare("SELECT * FROM projects WHERE id = ?").get(id);
|
|
37
|
-
}
|
|
38
|
-
function upsertProject(input) {
|
|
39
|
-
const existing = getProjectByOrigin(input.git_origin);
|
|
40
|
-
if (existing) {
|
|
41
|
-
const db = getDb();
|
|
42
|
-
db.prepare("UPDATE projects SET local_path = ?, name = ? WHERE id = ?").run(
|
|
43
|
-
input.local_path,
|
|
44
|
-
input.name,
|
|
45
|
-
existing.id
|
|
46
|
-
);
|
|
47
|
-
return { ...existing, local_path: input.local_path, name: input.name };
|
|
48
|
-
}
|
|
49
|
-
return createProject(input);
|
|
50
|
-
}
|
|
51
|
-
function listProjects() {
|
|
52
|
-
const db = getDb();
|
|
53
|
-
return db.prepare("SELECT * FROM projects ORDER BY name").all();
|
|
54
|
-
}
|
|
55
|
-
function getProjectByLocalPath(localPath) {
|
|
56
|
-
const normalized = resolve(localPath);
|
|
57
|
-
return listProjects().find((project) => resolve(project.local_path) === normalized);
|
|
58
|
-
}
|
|
59
|
-
function applyPluginToProject(input) {
|
|
60
|
-
const db = getDb();
|
|
61
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
62
|
-
db.prepare(
|
|
63
|
-
`INSERT OR REPLACE INTO project_plugins (project_id, plugin_id, platforms, applied_at)
|
|
64
|
-
VALUES (?, ?, ?, ?)`
|
|
65
|
-
).run(input.project_id, input.plugin_id, JSON.stringify(input.platforms), now);
|
|
66
|
-
}
|
|
67
|
-
function applyConfiguredPluginToProject(input) {
|
|
68
|
-
applyPluginToProject({
|
|
69
|
-
project_id: input.project_id,
|
|
70
|
-
plugin_id: input.configured_plugin_id,
|
|
71
|
-
platforms: input.platforms
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
function getProjectPlugins(projectId) {
|
|
75
|
-
const db = getDb();
|
|
76
|
-
const rows = db.prepare(
|
|
77
|
-
"SELECT * FROM project_plugins WHERE project_id = ? ORDER BY applied_at DESC"
|
|
78
|
-
).all(projectId);
|
|
79
|
-
return rows.map((row) => ({
|
|
80
|
-
...row,
|
|
81
|
-
platforms: JSON.parse(row.platforms)
|
|
82
|
-
}));
|
|
83
|
-
}
|
|
84
|
-
function getProjectConfiguredPlugins(projectId) {
|
|
85
|
-
return getProjectPlugins(projectId);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// src/models/harness.ts
|
|
89
|
-
var CURSOR_SKILL_MODES = /* @__PURE__ */ new Set([
|
|
90
|
-
"agent-requested",
|
|
91
|
-
"always-on",
|
|
92
|
-
"agents-skills"
|
|
93
|
-
]);
|
|
94
|
-
function parseCursorSkillMode(value) {
|
|
95
|
-
if (!value) return void 0;
|
|
96
|
-
return CURSOR_SKILL_MODES.has(value) ? value : void 0;
|
|
97
|
-
}
|
|
98
|
-
function parseRegisteredJson(value) {
|
|
99
|
-
try {
|
|
100
|
-
const parsed = JSON.parse(value);
|
|
101
|
-
if (!Array.isArray(parsed)) return [];
|
|
102
|
-
return normalizeRegisteredHarnesses(
|
|
103
|
-
parsed.filter((entry) => typeof entry === "string")
|
|
104
|
-
);
|
|
105
|
-
} catch {
|
|
106
|
-
return [];
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
function normalizeSelection(selection) {
|
|
110
|
-
return {
|
|
111
|
-
registered_harnesses: normalizeRegisteredHarnesses(selection.registered_harnesses)
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
function rowToPreference(row) {
|
|
115
|
-
return {
|
|
116
|
-
registered_harnesses: parseRegisteredJson(row.registered_harnesses),
|
|
117
|
-
updated_at: row.updated_at
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
function rowToProjectHarness(row) {
|
|
121
|
-
const cursor_skill_mode = parseCursorSkillMode(row.cursor_skill_mode);
|
|
122
|
-
return {
|
|
123
|
-
project_id: row.project_id,
|
|
124
|
-
registered_harnesses: parseRegisteredJson(row.registered_harnesses),
|
|
125
|
-
materialization_strategy: row.materialization_strategy === "copy" ? "copy" : "symlink-preferred",
|
|
126
|
-
...cursor_skill_mode ? { cursor_skill_mode } : {},
|
|
127
|
-
updated_at: row.updated_at
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
function getHarnessPreference() {
|
|
131
|
-
const db = getDb();
|
|
132
|
-
const row = db.prepare("SELECT * FROM harness_preferences WHERE scope = 'default'").get();
|
|
133
|
-
return row ? rowToPreference(row) : void 0;
|
|
134
|
-
}
|
|
135
|
-
function setHarnessPreference(selection) {
|
|
136
|
-
const db = getDb();
|
|
137
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
138
|
-
const normalized = normalizeSelection(selection);
|
|
139
|
-
db.prepare(
|
|
140
|
-
`INSERT INTO harness_preferences (scope, registered_harnesses, updated_at)
|
|
141
|
-
VALUES ('default', ?, ?)
|
|
142
|
-
ON CONFLICT(scope) DO UPDATE SET
|
|
143
|
-
registered_harnesses = excluded.registered_harnesses,
|
|
144
|
-
updated_at = excluded.updated_at`
|
|
145
|
-
).run(
|
|
146
|
-
JSON.stringify(normalized.registered_harnesses),
|
|
147
|
-
now
|
|
148
|
-
);
|
|
149
|
-
return {
|
|
150
|
-
...normalized,
|
|
151
|
-
updated_at: now
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
function getProjectHarnessConfig(projectId) {
|
|
155
|
-
const db = getDb();
|
|
156
|
-
const row = db.prepare("SELECT * FROM project_harnesses WHERE project_id = ?").get(projectId);
|
|
157
|
-
return row ? rowToProjectHarness(row) : void 0;
|
|
158
|
-
}
|
|
159
|
-
function setProjectHarnessConfig(input) {
|
|
160
|
-
const db = getDb();
|
|
161
|
-
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
162
|
-
const normalized = normalizeSelection({
|
|
163
|
-
registered_harnesses: input.registered_harnesses
|
|
164
|
-
});
|
|
165
|
-
const materialization_strategy = input.materialization_strategy ?? "symlink-preferred";
|
|
166
|
-
const existing = getProjectHarnessConfig(input.project_id);
|
|
167
|
-
const cursor_skill_mode = input.cursor_skill_mode ?? existing?.cursor_skill_mode;
|
|
168
|
-
db.prepare(
|
|
169
|
-
`INSERT INTO project_harnesses (
|
|
170
|
-
project_id, registered_harnesses, materialization_strategy,
|
|
171
|
-
cursor_skill_mode, updated_at
|
|
172
|
-
)
|
|
173
|
-
VALUES (?, ?, ?, ?, ?)
|
|
174
|
-
ON CONFLICT(project_id) DO UPDATE SET
|
|
175
|
-
registered_harnesses = excluded.registered_harnesses,
|
|
176
|
-
materialization_strategy = excluded.materialization_strategy,
|
|
177
|
-
cursor_skill_mode = excluded.cursor_skill_mode,
|
|
178
|
-
updated_at = excluded.updated_at`
|
|
179
|
-
).run(
|
|
180
|
-
input.project_id,
|
|
181
|
-
JSON.stringify(normalized.registered_harnesses),
|
|
182
|
-
materialization_strategy,
|
|
183
|
-
cursor_skill_mode ?? null,
|
|
184
|
-
now
|
|
185
|
-
);
|
|
186
|
-
return {
|
|
187
|
-
project_id: input.project_id,
|
|
188
|
-
...normalized,
|
|
189
|
-
materialization_strategy,
|
|
190
|
-
...cursor_skill_mode ? { cursor_skill_mode } : {},
|
|
191
|
-
updated_at: now
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// src/services/harness-targets.ts
|
|
196
|
-
function parsePlatformFilter(platform) {
|
|
197
|
-
return platform?.split(",").map((p) => p.trim()).filter(Boolean);
|
|
198
|
-
}
|
|
199
|
-
function uniqueHarnessTargets(harnesses) {
|
|
200
|
-
return [...new Set(harnesses.filter(Boolean))];
|
|
201
|
-
}
|
|
202
|
-
function normalizeRegisteredHarnesses(harnesses) {
|
|
203
|
-
return uniqueHarnessTargets(harnesses);
|
|
204
|
-
}
|
|
205
|
-
function registeredHarnessesOf(selection) {
|
|
206
|
-
if (!selection?.registered_harnesses) return [];
|
|
207
|
-
return normalizeRegisteredHarnesses(selection.registered_harnesses);
|
|
208
|
-
}
|
|
209
|
-
function registeredFromLegacyParts(main, aliases) {
|
|
210
|
-
return normalizeRegisteredHarnesses([
|
|
211
|
-
...main ? [main] : [],
|
|
212
|
-
...aliases ?? []
|
|
213
|
-
]);
|
|
214
|
-
}
|
|
215
|
-
function assertSupportedHarnessTargets(harnesses) {
|
|
216
|
-
const supported = new Set(getAllPlatforms().map((platform) => platform.id));
|
|
217
|
-
const invalid = harnesses.filter((harness) => !supported.has(harness));
|
|
218
|
-
if (invalid.length > 0) {
|
|
219
|
-
throw new Error(`Unsupported harness: ${invalid.join(", ")}`);
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
function resolveRegisteredGlobalApplyHarnesses(harnessOption) {
|
|
223
|
-
const explicitTargets = uniqueHarnessTargets(parsePlatformFilter(harnessOption) ?? []);
|
|
224
|
-
if (explicitTargets.length > 0) {
|
|
225
|
-
assertSupportedHarnessTargets(explicitTargets);
|
|
226
|
-
return explicitTargets;
|
|
227
|
-
}
|
|
228
|
-
const preferredTargets = registeredHarnessesOf(getHarnessPreference());
|
|
229
|
-
if (preferredTargets.length > 0) {
|
|
230
|
-
assertSupportedHarnessTargets(preferredTargets);
|
|
231
|
-
return preferredTargets;
|
|
232
|
-
}
|
|
233
|
-
throw new CliUsageError(CLI_ERRORS.noHarnesses, [CLI_HINTS.harnessSetOrFlag]);
|
|
234
|
-
}
|
|
235
|
-
function resolveScanGlobalHarnessTargets(harnessOption, homeRoot = resolveHomeRoot()) {
|
|
236
|
-
const explicitTargets = uniqueHarnessTargets(parsePlatformFilter(harnessOption) ?? []);
|
|
237
|
-
if (explicitTargets.length > 0) {
|
|
238
|
-
assertSupportedHarnessTargets(explicitTargets);
|
|
239
|
-
return explicitTargets;
|
|
240
|
-
}
|
|
241
|
-
const preference = getHarnessPreference();
|
|
242
|
-
if (preference) {
|
|
243
|
-
const preferredTargets = registeredHarnessesOf(preference);
|
|
244
|
-
assertSupportedHarnessTargets(preferredTargets);
|
|
245
|
-
return preferredTargets;
|
|
246
|
-
}
|
|
247
|
-
const detectedTargets = uniqueHarnessTargets(
|
|
248
|
-
detectHomePlatforms(homeRoot).map((result) => result.platformId)
|
|
249
|
-
);
|
|
250
|
-
if (detectedTargets.length > 0) {
|
|
251
|
-
return detectedTargets;
|
|
252
|
-
}
|
|
253
|
-
throw new Error(
|
|
254
|
-
"No global harness targets configured. Run ht harness set or pass --harness <slugs>."
|
|
255
|
-
);
|
|
256
|
-
}
|
|
257
|
-
function collectApplyPreferenceHarnesses(projectRoot) {
|
|
258
|
-
const projectByPath = getProjectByLocalPath(projectRoot);
|
|
259
|
-
const projectConfig = projectByPath ? getProjectHarnessConfig(projectByPath.id) : void 0;
|
|
260
|
-
if (projectConfig) {
|
|
261
|
-
const preferredTargets = registeredHarnessesOf(projectConfig);
|
|
262
|
-
assertSupportedHarnessTargets(preferredTargets);
|
|
263
|
-
return preferredTargets;
|
|
264
|
-
}
|
|
265
|
-
const preference = getHarnessPreference();
|
|
266
|
-
if (preference) {
|
|
267
|
-
const preferredTargets = registeredHarnessesOf(preference);
|
|
268
|
-
assertSupportedHarnessTargets(preferredTargets);
|
|
269
|
-
return preferredTargets;
|
|
270
|
-
}
|
|
271
|
-
return [];
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
export {
|
|
275
|
-
getProjectByOrigin,
|
|
276
|
-
getProject,
|
|
277
|
-
upsertProject,
|
|
278
|
-
listProjects,
|
|
279
|
-
getProjectByLocalPath,
|
|
280
|
-
applyConfiguredPluginToProject,
|
|
281
|
-
getProjectConfiguredPlugins,
|
|
282
|
-
parsePlatformFilter,
|
|
283
|
-
uniqueHarnessTargets,
|
|
284
|
-
normalizeRegisteredHarnesses,
|
|
285
|
-
registeredHarnessesOf,
|
|
286
|
-
registeredFromLegacyParts,
|
|
287
|
-
assertSupportedHarnessTargets,
|
|
288
|
-
resolveRegisteredGlobalApplyHarnesses,
|
|
289
|
-
resolveScanGlobalHarnessTargets,
|
|
290
|
-
collectApplyPreferenceHarnesses,
|
|
291
|
-
getHarnessPreference,
|
|
292
|
-
setHarnessPreference,
|
|
293
|
-
getProjectHarnessConfig,
|
|
294
|
-
setProjectHarnessConfig
|
|
295
|
-
};
|
|
296
|
-
//# sourceMappingURL=chunk-AUWWL6KX.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/models/project.ts","../src/models/harness.ts","../src/services/harness-targets.ts"],"sourcesContent":["import { getDb } from \"../db/connection.js\";\nimport { resolve } from \"node:path\";\nimport { ulid } from \"ulid\";\nimport type { Project, ProjectPlugin } from \"../types.js\";\n\nexport function createProject(input: {\n git_origin: string;\n name: string;\n local_path: string;\n}): Project {\n const db = getDb();\n const now = new Date().toISOString();\n const id = ulid();\n\n db.prepare(\n `INSERT INTO projects (id, git_origin, name, local_path, created_at)\n VALUES (?, ?, ?, ?, ?)`,\n ).run(id, input.git_origin, input.name, input.local_path, now);\n\n return { id, ...input, created_at: now };\n}\n\nexport function getProjectByOrigin(gitOrigin: string): Project | undefined {\n const db = getDb();\n return db\n .prepare(\"SELECT * FROM projects WHERE git_origin = ?\")\n .get(gitOrigin) as Project | undefined;\n}\n\nexport function getProject(id: string): Project | undefined {\n const db = getDb();\n return db.prepare(\"SELECT * FROM projects WHERE id = ?\").get(id) as\n | Project\n | undefined;\n}\n\nexport function upsertProject(input: {\n git_origin: string;\n name: string;\n local_path: string;\n}): Project {\n const existing = getProjectByOrigin(input.git_origin);\n if (existing) {\n const db = getDb();\n db.prepare(\"UPDATE projects SET local_path = ?, name = ? WHERE id = ?\").run(\n input.local_path,\n input.name,\n existing.id,\n );\n return { ...existing, local_path: input.local_path, name: input.name };\n }\n return createProject(input);\n}\n\nexport function listProjects(): Project[] {\n const db = getDb();\n return db.prepare(\"SELECT * FROM projects ORDER BY name\").all() as Project[];\n}\n\nexport function getProjectByLocalPath(localPath: string): Project | undefined {\n const normalized = resolve(localPath);\n return listProjects().find((project) => resolve(project.local_path) === normalized);\n}\n\nexport function applyPluginToProject(input: {\n project_id: string;\n plugin_id: string;\n platforms: string[];\n}): void {\n const db = getDb();\n const now = new Date().toISOString();\n\n db.prepare(\n `INSERT OR REPLACE INTO project_plugins (project_id, plugin_id, platforms, applied_at)\n VALUES (?, ?, ?, ?)`,\n ).run(input.project_id, input.plugin_id, JSON.stringify(input.platforms), now);\n}\n\n/** @deprecated Use applyPluginToProject */\nexport function applyConfiguredPluginToProject(input: {\n project_id: string;\n configured_plugin_id: string;\n platforms: string[];\n}): void {\n applyPluginToProject({\n project_id: input.project_id,\n plugin_id: input.configured_plugin_id,\n platforms: input.platforms,\n });\n}\n\nexport function getProjectPlugins(projectId: string): ProjectPlugin[] {\n const db = getDb();\n const rows = db\n .prepare(\n \"SELECT * FROM project_plugins WHERE project_id = ? ORDER BY applied_at DESC\",\n )\n .all(projectId) as Array<Omit<ProjectPlugin, \"platforms\"> & { platforms: string }>;\n\n return rows.map((row) => ({\n ...row,\n platforms: JSON.parse(row.platforms) as string[],\n }));\n}\n\n/** @deprecated Use getProjectPlugins */\nexport function getProjectConfiguredPlugins(projectId: string): ProjectPlugin[] {\n return getProjectPlugins(projectId);\n}\n\n/** @deprecated Use applyPluginToProject */\nexport const applyLayerToProject = applyPluginToProject;\n/** @deprecated Use applyConfiguredPluginToProject */\nexport const applyConfiguredLayerToProject = applyConfiguredPluginToProject;\n/** @deprecated Use getProjectPlugins */\nexport const getProjectLayers = getProjectPlugins;\n/** @deprecated Use getProjectConfiguredPlugins */\nexport const getProjectConfiguredLayers = getProjectConfiguredPlugins;\n","import { getDb } from \"../db/connection.js\";\nimport { normalizeRegisteredHarnesses } from \"../services/harness-targets.js\";\nimport type {\n CursorSkillMode,\n HarnessPreference,\n HarnessSelection,\n ProjectHarnessConfig,\n} from \"../types.js\";\n\ninterface HarnessPreferenceRow {\n scope: string;\n registered_harnesses: string;\n updated_at: string;\n}\n\ninterface ProjectHarnessRow {\n project_id: string;\n registered_harnesses: string;\n materialization_strategy: string;\n cursor_skill_mode: string | null;\n updated_at: string;\n}\n\nconst CURSOR_SKILL_MODES = new Set<CursorSkillMode>([\n \"agent-requested\",\n \"always-on\",\n \"agents-skills\",\n]);\n\nfunction parseCursorSkillMode(value: string | null | undefined): CursorSkillMode | undefined {\n if (!value) return undefined;\n return CURSOR_SKILL_MODES.has(value as CursorSkillMode)\n ? (value as CursorSkillMode)\n : undefined;\n}\n\nfunction parseRegisteredJson(value: string): string[] {\n try {\n const parsed = JSON.parse(value) as unknown;\n if (!Array.isArray(parsed)) return [];\n return normalizeRegisteredHarnesses(\n parsed.filter((entry): entry is string => typeof entry === \"string\"),\n );\n } catch {\n return [];\n }\n}\n\nfunction normalizeSelection(selection: HarnessSelection): HarnessSelection {\n return {\n registered_harnesses: normalizeRegisteredHarnesses(selection.registered_harnesses),\n };\n}\n\nfunction rowToPreference(row: HarnessPreferenceRow): HarnessPreference {\n return {\n registered_harnesses: parseRegisteredJson(row.registered_harnesses),\n updated_at: row.updated_at,\n };\n}\n\nfunction rowToProjectHarness(row: ProjectHarnessRow): ProjectHarnessConfig {\n const cursor_skill_mode = parseCursorSkillMode(row.cursor_skill_mode);\n return {\n project_id: row.project_id,\n registered_harnesses: parseRegisteredJson(row.registered_harnesses),\n materialization_strategy:\n row.materialization_strategy === \"copy\" ? \"copy\" : \"symlink-preferred\",\n ...(cursor_skill_mode ? { cursor_skill_mode } : {}),\n updated_at: row.updated_at,\n };\n}\n\nexport function getHarnessPreference(): HarnessPreference | undefined {\n const db = getDb();\n const row = db\n .prepare(\"SELECT * FROM harness_preferences WHERE scope = 'default'\")\n .get() as HarnessPreferenceRow | undefined;\n return row ? rowToPreference(row) : undefined;\n}\n\nexport function setHarnessPreference(\n selection: HarnessSelection,\n): HarnessPreference {\n const db = getDb();\n const now = new Date().toISOString();\n const normalized = normalizeSelection(selection);\n\n db.prepare(\n `INSERT INTO harness_preferences (scope, registered_harnesses, updated_at)\n VALUES ('default', ?, ?)\n ON CONFLICT(scope) DO UPDATE SET\n registered_harnesses = excluded.registered_harnesses,\n updated_at = excluded.updated_at`,\n ).run(\n JSON.stringify(normalized.registered_harnesses),\n now,\n );\n\n return {\n ...normalized,\n updated_at: now,\n };\n}\n\nexport function getProjectHarnessConfig(\n projectId: string,\n): ProjectHarnessConfig | undefined {\n const db = getDb();\n const row = db\n .prepare(\"SELECT * FROM project_harnesses WHERE project_id = ?\")\n .get(projectId) as ProjectHarnessRow | undefined;\n return row ? rowToProjectHarness(row) : undefined;\n}\n\nexport function setProjectHarnessConfig(input: {\n project_id: string;\n registered_harnesses: string[];\n materialization_strategy?: \"symlink-preferred\" | \"copy\";\n cursor_skill_mode?: CursorSkillMode;\n}): ProjectHarnessConfig {\n const db = getDb();\n const now = new Date().toISOString();\n const normalized = normalizeSelection({\n registered_harnesses: input.registered_harnesses,\n });\n const materialization_strategy =\n input.materialization_strategy ?? \"symlink-preferred\";\n const existing = getProjectHarnessConfig(input.project_id);\n const cursor_skill_mode =\n input.cursor_skill_mode ?? existing?.cursor_skill_mode;\n\n db.prepare(\n `INSERT INTO project_harnesses (\n project_id, registered_harnesses, materialization_strategy,\n cursor_skill_mode, updated_at\n )\n VALUES (?, ?, ?, ?, ?)\n ON CONFLICT(project_id) DO UPDATE SET\n registered_harnesses = excluded.registered_harnesses,\n materialization_strategy = excluded.materialization_strategy,\n cursor_skill_mode = excluded.cursor_skill_mode,\n updated_at = excluded.updated_at`,\n ).run(\n input.project_id,\n JSON.stringify(normalized.registered_harnesses),\n materialization_strategy,\n cursor_skill_mode ?? null,\n now,\n );\n\n return {\n project_id: input.project_id,\n ...normalized,\n materialization_strategy,\n ...(cursor_skill_mode ? { cursor_skill_mode } : {}),\n updated_at: now,\n };\n}\n\nexport function deleteProjectHarnessConfig(projectId: string): boolean {\n const db = getDb();\n const result = db\n .prepare(\"DELETE FROM project_harnesses WHERE project_id = ?\")\n .run(projectId);\n return result.changes > 0;\n}\n","import { CLI_ERRORS, CLI_HINTS } from \"../copy/cli.js\";\nimport { getHarnessPreference, getProjectHarnessConfig } from \"../models/harness.js\";\nimport { getProjectByLocalPath } from \"../models/project.js\";\nimport { getAllPlatforms } from \"../platforms/registry.js\";\nimport { CliUsageError } from \"./cli-errors.js\";\nimport { detectHomePlatforms } from \"./scanner.js\";\nimport { resolveHomeRoot } from \"../utils/home-root.js\";\n\nexport function parsePlatformFilter(platform?: string): string[] | undefined {\n return platform?.split(\",\").map((p) => p.trim()).filter(Boolean);\n}\n\nexport function uniqueHarnessTargets(harnesses: readonly string[]): string[] {\n return [...new Set(harnesses.filter(Boolean))];\n}\n\n/** Ordered registered set. Drops empties and duplicates, first occurrence wins. */\nexport function normalizeRegisteredHarnesses(\n harnesses: readonly string[],\n): string[] {\n return uniqueHarnessTargets(harnesses);\n}\n\nexport function registeredHarnessesOf(\n selection:\n | { registered_harnesses?: readonly string[] }\n | null\n | undefined,\n): string[] {\n if (!selection?.registered_harnesses) return [];\n return normalizeRegisteredHarnesses(selection.registered_harnesses);\n}\n\n/** `--main`/`--aliases` and pre-v32 archive JSON. */\nexport function registeredFromLegacyParts(\n main?: string | null,\n aliases?: readonly string[] | null,\n): string[] {\n return normalizeRegisteredHarnesses([\n ...(main ? [main] : []),\n ...(aliases ?? []),\n ]);\n}\n\nexport function assertSupportedHarnessTargets(harnesses: string[]): void {\n const supported = new Set(getAllPlatforms().map((platform) => platform.id));\n const invalid = harnesses.filter((harness) => !supported.has(harness));\n if (invalid.length > 0) {\n throw new Error(`Unsupported harness: ${invalid.join(\", \")}`);\n }\n}\n\n/**\n * Global apply / profile use targets: explicit `--harness`, else the\n * registered set. Never falls back to filesystem detection of default\n * harnesses (claude-code, warp, jules, …) when none are registered.\n */\nexport function resolveRegisteredGlobalApplyHarnesses(harnessOption?: string): string[] {\n const explicitTargets = uniqueHarnessTargets(parsePlatformFilter(harnessOption) ?? []);\n if (explicitTargets.length > 0) {\n assertSupportedHarnessTargets(explicitTargets);\n return explicitTargets;\n }\n\n const preferredTargets = registeredHarnessesOf(getHarnessPreference());\n if (preferredTargets.length > 0) {\n assertSupportedHarnessTargets(preferredTargets);\n return preferredTargets;\n }\n\n throw new CliUsageError(CLI_ERRORS.noHarnesses, [CLI_HINTS.harnessSetOrFlag]);\n}\n\nexport function resolveScanGlobalHarnessTargets(\n harnessOption?: string,\n homeRoot = resolveHomeRoot(),\n): string[] {\n const explicitTargets = uniqueHarnessTargets(parsePlatformFilter(harnessOption) ?? []);\n if (explicitTargets.length > 0) {\n assertSupportedHarnessTargets(explicitTargets);\n return explicitTargets;\n }\n\n const preference = getHarnessPreference();\n if (preference) {\n const preferredTargets = registeredHarnessesOf(preference);\n assertSupportedHarnessTargets(preferredTargets);\n return preferredTargets;\n }\n\n const detectedTargets = uniqueHarnessTargets(\n detectHomePlatforms(homeRoot).map((result) => result.platformId),\n );\n if (detectedTargets.length > 0) {\n return detectedTargets;\n }\n\n throw new Error(\n \"No global harness targets configured. Run ht harness set or pass --harness <slugs>.\",\n );\n}\n\n/**\n * Project then global harness preference slugs. Filesystem detection is a\n * later step in `resolveCompileTargets` so declared `targets:` stay portable.\n */\nexport function collectApplyPreferenceHarnesses(projectRoot: string): string[] {\n const projectByPath = getProjectByLocalPath(projectRoot);\n const projectConfig = projectByPath\n ? getProjectHarnessConfig(projectByPath.id)\n : undefined;\n if (projectConfig) {\n const preferredTargets = registeredHarnessesOf(projectConfig);\n assertSupportedHarnessTargets(preferredTargets);\n return preferredTargets;\n }\n\n const preference = getHarnessPreference();\n if (preference) {\n const preferredTargets = registeredHarnessesOf(preference);\n assertSupportedHarnessTargets(preferredTargets);\n return preferredTargets;\n }\n\n return [];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AACA,SAAS,eAAe;AACxB,SAAS,YAAY;AAGd,SAAS,cAAc,OAIlB;AACV,QAAM,KAAK,MAAM;AACjB,QAAM,OAAM,oBAAI,KAAK,GAAE,YAAY;AACnC,QAAM,KAAK,KAAK;AAEhB,KAAG;AAAA,IACD;AAAA;AAAA,EAEF,EAAE,IAAI,IAAI,MAAM,YAAY,MAAM,MAAM,MAAM,YAAY,GAAG;AAE7D,SAAO,EAAE,IAAI,GAAG,OAAO,YAAY,IAAI;AACzC;AAEO,SAAS,mBAAmB,WAAwC;AACzE,QAAM,KAAK,MAAM;AACjB,SAAO,GACJ,QAAQ,6CAA6C,EACrD,IAAI,SAAS;AAClB;AAEO,SAAS,WAAW,IAAiC;AAC1D,QAAM,KAAK,MAAM;AACjB,SAAO,GAAG,QAAQ,qCAAqC,EAAE,IAAI,EAAE;AAGjE;AAEO,SAAS,cAAc,OAIlB;AACV,QAAM,WAAW,mBAAmB,MAAM,UAAU;AACpD,MAAI,UAAU;AACZ,UAAM,KAAK,MAAM;AACjB,OAAG,QAAQ,2DAA2D,EAAE;AAAA,MACtE,MAAM;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,IACX;AACA,WAAO,EAAE,GAAG,UAAU,YAAY,MAAM,YAAY,MAAM,MA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cAAc,EAAE,IACxC;AACJ,MAAI,eAAe;AACjB,UAAM,mBAAmB,sBAAsB,aAAa;AAC5D,kCAA8B,gBAAgB;AAC9C,WAAO;AAAA,EACT;AAEA,QAAM,aAAa,qBAAqB;AACxC,MAAI,YAAY;AACd,UAAM,mBAAmB,sBAAsB,UAAU;AACzD,kCAA8B,gBAAgB;AAC9C,WAAO;AAAA,EACT;AAEA,SAAO,CAAC;AACV;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/user-path.ts","../src/services/materialization-conflicts.ts","../src/cli/print-apply-summary.ts","../src/services/global-profile-drift.ts","../src/services/profile-stash.ts","../src/services/profile-switch-prompt.ts","../src/services/wizards/project-use.ts","../src/services/project-config-use.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { isAbsolute, join, resolve } from \"node:path\";\nimport { resolveHomeRoot } from \"./home-root.js\";\n\nexport class UserPathError extends Error {\n readonly input: string;\n\n constructor(input: string, resolved: string) {\n super(`Directory not found: ${input}.`);\n this.name = \"UserPathError\";\n this.input = input;\n this.resolved = resolved;\n }\n\n readonly resolved: string;\n}\n\nexport function expandUserPath(arg: string, home = resolveHomeRoot()): string {\n const trimmed = arg.trim();\n if (trimmed === \"~\") {\n return home;\n }\n if (trimmed.startsWith(\"~/\") || trimmed.startsWith(\"~\\\\\")) {\n return join(home, trimmed.slice(2));\n }\n return isAbsolute(trimmed) ? trimmed : resolve(trimmed);\n}\n\nexport function resolveUserPath(\n arg: string,\n opts?: { mustExist?: boolean; home?: string },\n): string {\n const resolved = resolve(expandUserPath(arg, opts?.home ?? resolveHomeRoot()));\n if (opts?.mustExist && !existsSync(resolved)) {\n throw new UserPathError(arg, resolved);\n }\n return resolved;\n}\n","import { ON_CONFLICT_VALUE_HELP, parseOnConflict } from \"../cli/on-conflict.js\";\nimport { ui } from \"../ui/index.js\";\nimport type {\n ConflictPolicy,\n ConflictResolution,\n MaterializationConflict,\n} from \"./applier.js\";\nimport { promptForChoice } from \"./wizards/shared.js\";\n\nexport function resolveApplyConflictPolicy(opts: {\n onConflict?: string;\n noInteractive?: boolean;\n}): ConflictPolicy {\n const parsed = opts.onConflict ? parseOnConflict(opts.onConflict) : undefined;\n if (\n parsed === \"replace\" ||\n parsed === \"skip\" ||\n parsed === \"prompt\" ||\n parsed === \"cancel\"\n ) {\n return parsed;\n }\n if (\n opts.noInteractive ||\n process.env.CI === \"true\" ||\n process.env.HARNESSTAP_NO_INTERACTIVE === \"1\" ||\n !process.stdin.isTTY ||\n !process.stdout.isTTY\n ) {\n return \"cancel\";\n }\n return \"prompt\";\n}\n\nexport async function promptMaterializationConflict(\n conflict: MaterializationConflict,\n): Promise<ConflictResolution> {\n const ownerSummary =\n conflict.owners.length > 0\n ? conflict.owners\n .map((owner) => `${owner.plugin_name}@${owner.plugin_version ?? \"?\"}`)\n .join(\", \")\n : \"another plugin or manual edit\";\n\n ui.warn(`File already exists: ${conflict.path}`);\n ui.dim(` Previously written by: ${ownerSummary}`);\n\n return promptForChoice({\n message: `How should HarnessTap handle ${conflict.path}?`,\n choices: [\n { name: ON_CONFLICT_VALUE_HELP.replace, value: \"replace\" as const },\n { name: ON_CONFLICT_VALUE_HELP.skip, value: \"skip\" as const },\n { name: ON_CONFLICT_VALUE_HELP.cancel, value: \"cancel\" as const },\n ],\n });\n}\n","import {\n applyHeaderLine,\n applyWroteLine,\n CLI_COPY,\n dryRunSectionHeader,\n dryRunWouldLine,\n keptFilesHeader,\n keptReasonLabel,\n snapshotSavedUndoLine,\n} from \"../copy/cli.js\";\nimport { ui } from \"../ui/index.js\";\n\nexport interface ApplyKeptFile {\n path: string;\n reason: \"modified\" | \"unmanaged\";\n}\n\nexport function keptFromSkippedRemovals(\n skipped: readonly { path: string; reason: string }[] | undefined,\n): ApplyKeptFile[] {\n return (skipped ?? []).flatMap((entry) => {\n const reason = removalSkipReason(entry.reason);\n return reason ? [{ path: entry.path, reason }] : [];\n });\n}\n\nexport function printApplyPayload(payload: {\n profile_name: string;\n harnesses: readonly string[];\n files: readonly unknown[];\n written_files: readonly string[];\n removed_files?: readonly string[];\n skipped_removals?: readonly { path: string; reason: string; message?: string }[];\n snapshot_id?: string;\n dry_run?: boolean;\n removal_backup?: string;\n}): void {\n const kept = keptFromSkippedRemovals(payload.skipped_removals);\n const unchanged = Math.max(0, payload.files.length - payload.written_files.length);\n if (payload.dry_run) {\n printApplyDryRun({\n wouldWrite: payload.written_files,\n wouldRemove: payload.removed_files ?? [],\n wouldKeep: kept,\n unchanged,\n });\n } else {\n printApplySuccess({\n name: payload.profile_name,\n harnessCount: payload.harnesses.length,\n wrote: payload.written_files.length,\n removed: payload.removed_files?.length ?? 0,\n kept,\n unchanged,\n snapshotId: payload.snapshot_id,\n });\n }\n for (const skipped of payload.skipped_removals ?? []) {\n if (skipped.reason === \"missing\") {\n continue;\n }\n if (skipped.message) {\n ui.warn(skipped.message);\n }\n }\n if (!payload.dry_run && payload.removal_backup && (payload.removed_files?.length ?? 0) > 0) {\n ui.info(`Backup: ${payload.removal_backup}`);\n }\n}\n\nexport function printApplyDryRun(input: {\n wouldWrite: readonly string[];\n wouldRemove: readonly string[];\n wouldKeep: readonly ApplyKeptFile[];\n unchanged: number;\n header?: string | false;\n}): void {\n if (input.header !== false) {\n console.log(input.header ?? CLI_COPY.dryRunNothingChanged);\n console.log(\"\");\n }\n if (input.wouldWrite.length > 0) {\n console.log(dryRunSectionHeader(\"write\", input.wouldWrite.length));\n for (const path of input.wouldWrite) {\n console.log(` ${path}`);\n }\n }\n if (input.wouldRemove.length > 0) {\n console.log(dryRunSectionHeader(\"remove\", input.wouldRemove.length));\n for (const path of input.wouldRemove) {\n console.log(` ${path}`);\n }\n }\n if (input.wouldKeep.length > 0) {\n console.log(dryRunSectionHeader(\"keep\", input.wouldKeep.length));\n for (const entry of input.wouldKeep) {\n console.log(` ${entry.path} ${keptReasonLabel(entry.reason)}`);\n }\n }\n console.log(\"\");\n console.log(\n dryRunWouldLine({\n write: input.wouldWrite.length,\n remove: input.wouldRemove.length,\n keep: input.wouldKeep.length,\n unchanged: input.unchanged,\n }),\n );\n}\n\nexport function printKeptFiles(kept: readonly ApplyKeptFile[]): void {\n if (kept.length === 0) {\n return;\n }\n console.log(keptFilesHeader(kept.length));\n for (const entry of kept) {\n console.log(` ${entry.path} ${keptReasonLabel(entry.reason)}`);\n }\n console.log(`${CLI_COPY.forceRemoveHint} ht apply --force-remove`);\n}\n\nexport function printApplySuccess(input: {\n name: string;\n harnessCount: number;\n wrote: number;\n removed: number;\n kept: readonly ApplyKeptFile[];\n unchanged: number;\n snapshotId?: string;\n}): void {\n console.log(applyHeaderLine(input.name, input.harnessCount));\n console.log(\n applyWroteLine({\n wrote: input.wrote,\n removed: input.removed,\n kept: input.kept.length,\n unchanged: input.unchanged,\n }),\n );\n if (input.wrote > 0 || input.removed > 0) {\n printKeptFiles(input.kept);\n }\n if (input.snapshotId) {\n console.log(snapshotSavedUndoLine(`ht revert ${input.snapshotId}`));\n }\n}\n\nexport function removalSkipReason(\n reason: string,\n): \"modified\" | \"unmanaged\" | undefined {\n if (reason === \"modified\") {\n return \"modified\";\n }\n if (reason === \"unmanaged\" || reason === \"preexisting\") {\n return \"unmanaged\";\n }\n return undefined;\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { listMaterializationsForRootPath } from \"../models/resource-materialization.js\";\nimport { hashOnDiskFile } from \"./safe-file-removal.js\";\nimport { isEmptyBuiltinProfile, isProfilePlugin } from \"../constants/profile.js\";\nimport { getLatestGlobalApplySnapshotForProfile } from \"../models/global-apply-snapshot.js\";\nimport { resolvePluginSelector } from \"../models/plugin-model.js\";\nimport { resolveHomeRoot } from \"../utils/home-root.js\";\nimport { getActiveProfileName } from \"./active-profile.js\";\nimport {\n applyProfilePlugin,\n clearGlobalProfileApply,\n collectProfilePluginIds,\n type ApplyProfilePluginResult,\n} from \"./profile-apply.js\";\nimport { mergePluginsForApply } from \"./plugin-apply-merge.js\";\nimport { fileContentsEquivalentForDrift } from \"./file-contents-drift.js\";\nimport { withAffectedResources } from \"./scoped-file-content-delta.js\";\nimport type { DriftFileChange } from \"./project-drift.js\";\nimport { detectNotStagedProfileResources } from \"./profile-untracked-resources.js\";\nimport {\n buildProfileContents,\n type ProfileContents,\n} from \"./profile-contents.js\";\nimport {\n buildHostManagedStatus,\n profileSkillNameMap,\n type HostManagedStatus,\n} from \"./cursor-host-managed-skills.js\";\nimport {\n buildHarnessLiveStatusMap,\n classifyGlobalDriftChanges,\n collectOwnedGlobalProfileFiles,\n computeGlobalProfilePanelStatus,\n countMissingHarnessRows,\n declaredMcpFromExpectedFiles,\n resolveProjectDriftSummary,\n type GlobalProfileDriftSummary,\n type GlobalProfilePanelStatus,\n type GlobalProfileStatusDepth,\n type HarnessLiveStatus,\n} from \"./global-profile-status-panel.js\";\n\nexport interface GlobalProfileStatus {\n active_profile: string | null;\n profile_exists: boolean;\n applied: boolean;\n snapshot_id: string | null;\n snapshot_at: string | null;\n stack_in_sync: boolean;\n has_drift: boolean;\n changes: DriftFileChange[];\n warning?: string;\n depth: GlobalProfileStatusDepth;\n as_of: string;\n panel: GlobalProfilePanelStatus;\n harnesses: Record<string, HarnessLiveStatus>;\n drift_summary: GlobalProfileDriftSummary;\n contents?: ProfileContents | null;\n untracked_resource_count?: number;\n /** Alias for untracked_resource_count (not-staged working-tree resources). */\n not_staged_count?: number;\n /** App-managed inventory (full depth only); never applied or persisted. */\n host_managed?: HostManagedStatus;\n}\n\nfunction readGlobalFile(homeRoot: string, relativePath: string): string | null {\n const fullPath = join(homeRoot, relativePath);\n if (!existsSync(fullPath)) {\n return null;\n }\n try {\n return readFileSync(fullPath, \"utf-8\");\n } catch {\n return null;\n }\n}\n\nfunction pluginIdsMatch(left: string[], right: string[]): boolean {\n if (left.length !== right.length) {\n return false;\n }\n return left.every((pluginId, index) => pluginId === right[index]);\n}\n\nfunction declaredMcpFromExpectedApply(expectedApply: ApplyProfilePluginResult) {\n return declaredMcpFromExpectedFiles(\n expectedApply.harnesses,\n expectedApply.expected_files ?? [],\n );\n}\n\nfunction declaredMcpNamesFromMergedPlugins(pluginIds: string[]): Record<string, string[]> {\n const merged = mergePluginsForApply(pluginIds);\n const names = merged.resources\n .filter((resource) => resource.type === \"mcp_server\")\n .map((resource) => resource.name);\n return {\n \"claude-code\": names,\n cursor: names,\n };\n}\n\nfunction buildBaseStatusFields(input: {\n depth: GlobalProfileStatusDepth;\n activeProfile: string | null;\n profileExists: boolean;\n applied: boolean;\n snapshotId: string | null;\n snapshotAt: string | null;\n stackInSync: boolean;\n hasDrift: boolean;\n changes: DriftFileChange[];\n warning?: string;\n projectPath?: string;\n expectedApply?: ApplyProfilePluginResult;\n pluginIds?: string[];\n}): GlobalProfileStatus {\n const asOf = new Date().toISOString();\n const homeRoot = resolveHomeRoot();\n const ownedFiles = collectOwnedGlobalProfileFiles(input.snapshotId);\n const { owned, nonOwned } = classifyGlobalDriftChanges(input.changes, ownedFiles);\n\n const declaredPins =\n input.pluginIds && input.pluginIds.length > 0\n ? mergePluginsForApply(input.pluginIds).pluginPins\n : [];\n const declaredFromExpected = input.expectedApply\n ? declaredMcpFromExpectedApply(input.expectedApply)\n : null;\n const declaredMcpByHarness =\n declaredFromExpected?.namesByHarness\n ?? (input.pluginIds\n ? declaredMcpNamesFromMergedPlugins(input.pluginIds)\n : { \"claude-code\": [], cursor: [] });\n\n const harnesses = buildHarnessLiveStatusMap({\n depth: input.depth,\n homeRoot,\n declaredPins,\n declaredMcpByHarness,\n ...(declaredFromExpected\n ? { expectedMcpConfigsByHarness: declaredFromExpected.configsByHarness }\n : {}),\n });\n const { missingPlugins, missingMcp } =\n input.depth === \"full\"\n ? countMissingHarnessRows(harnesses)\n : { missingPlugins: 0, missingMcp: 0 };\n\n const contents = input.activeProfile\n ? buildProfileContents(input.activeProfile)\n : null;\n const hostManaged =\n input.depth === \"full\"\n ? buildHostManagedStatus({\n homeRoot,\n profileSkills: profileSkillNameMap(contents?.resources ?? []),\n })\n : undefined;\n\n const projectDrift = resolveProjectDriftSummary(input.projectPath);\n const panel = computeGlobalProfilePanelStatus({\n depth: input.depth,\n applied: input.applied,\n activeProfile: input.activeProfile,\n stackInSync: input.stackInSync,\n ownedDriftCount: owned.length,\n nonOwnedDriftCount: nonOwned.length,\n missingPluginCount: missingPlugins,\n missingMcpCount: missingMcp,\n projectDrift,\n warning: input.warning,\n hostManagedCollisionCount: hostManaged?.cursor?.collisions.length ?? 0,\n });\n\n const driftSummary: GlobalProfileDriftSummary = {\n global: {\n status: !input.applied\n ? \"pending\"\n : input.hasDrift\n ? \"drifted\"\n : \"clean\",\n owned_changes: owned.length,\n non_owned_changes: nonOwned.length,\n },\n ...(projectDrift ? { project: projectDrift } : {}),\n };\n\n return {\n active_profile: input.activeProfile,\n profile_exists: input.profileExists,\n applied: input.applied,\n snapshot_id: input.snapshotId,\n snapshot_at: input.snapshotAt,\n stack_in_sync: input.stackInSync,\n has_drift: input.hasDrift,\n changes: input.changes,\n ...(input.warning ? { warning: input.warning } : {}),\n depth: input.depth,\n as_of: asOf,\n panel,\n harnesses,\n drift_summary: driftSummary,\n contents,\n ...(hostManaged ? { host_managed: hostManaged } : {}),\n };\n}\n\nasync function finalizeGlobalProfileStatus(\n fields: Parameters<typeof buildBaseStatusFields>[0],\n harness?: string,\n): Promise<GlobalProfileStatus> {\n const status = buildBaseStatusFields(fields);\n if (\n fields.depth !== \"full\"\n || !status.active_profile\n || isEmptyBuiltinProfile(status.active_profile)\n ) {\n return status;\n }\n try {\n const notStaged = await detectNotStagedProfileResources({\n profileSelector: status.active_profile,\n scope: \"home\",\n ...(harness ? { harness } : {}),\n });\n return {\n ...status,\n untracked_resource_count: notStaged.length,\n not_staged_count: notStaged.length,\n };\n } catch {\n return status;\n }\n}\n\nexport async function detectGlobalProfileStatus(input: {\n harness?: string;\n depth?: GlobalProfileStatusDepth;\n projectPath?: string;\n} = {}): Promise<GlobalProfileStatus> {\n const depth = input.depth ?? \"full\";\n const activeProfile = getActiveProfileName() ?? null;\n if (!activeProfile) {\n return finalizeGlobalProfileStatus(\n {\n depth,\n activeProfile: null,\n profileExists: false,\n applied: false,\n snapshotId: null,\n snapshotAt: null,\n stackInSync: false,\n hasDrift: false,\n changes: [],\n projectPath: input.projectPath,\n },\n input.harness,\n );\n }\n\n const plugin = resolvePluginSelector(activeProfile);\n if (!plugin) {\n if (isEmptyBuiltinProfile(activeProfile)) {\n const latestSnapshot = getLatestGlobalApplySnapshotForProfile(activeProfile);\n let expectedApply: ApplyProfilePluginResult;\n try {\n expectedApply = await clearGlobalProfileApply({\n dryRun: true,\n harness: input.harness,\n conflictPolicy: \"replace\",\n pull: false,\n });\n } catch (error) {\n return finalizeGlobalProfileStatus({\n depth,\n activeProfile,\n profileExists: true,\n applied: Boolean(latestSnapshot),\n snapshotId: latestSnapshot?.id ?? null,\n snapshotAt: latestSnapshot?.created_at ?? null,\n stackInSync: false,\n hasDrift: true,\n changes: [],\n warning: error instanceof Error ? error.message : String(error),\n projectPath: input.projectPath,\n pluginIds: [],\n });\n }\n\n const stackInSync = latestSnapshot\n ? pluginIdsMatch(latestSnapshot.plugin_ids, expectedApply.configured_plugin_ids)\n : false;\n const applied = Boolean(latestSnapshot);\n const hasDrift = !applied || !stackInSync;\n\n return finalizeGlobalProfileStatus({\n depth,\n activeProfile,\n profileExists: true,\n applied,\n snapshotId: latestSnapshot?.id ?? null,\n snapshotAt: latestSnapshot?.created_at ?? null,\n stackInSync,\n hasDrift,\n changes: [],\n projectPath: input.projectPath,\n expectedApply,\n pluginIds: [],\n });\n }\n\n return finalizeGlobalProfileStatus({\n depth,\n activeProfile,\n profileExists: false,\n applied: false,\n snapshotId: null,\n snapshotAt: null,\n stackInSync: false,\n hasDrift: true,\n changes: [],\n warning: `missing plugin \"${activeProfile}\"`,\n projectPath: input.projectPath,\n });\n }\n\n if (!isProfilePlugin(plugin)) {\n return finalizeGlobalProfileStatus({\n depth,\n activeProfile,\n profileExists: true,\n applied: false,\n snapshotId: null,\n snapshotAt: null,\n stackInSync: false,\n hasDrift: true,\n changes: [],\n warning: `plugin \"${plugin.name}\" is not tagged as a profile`,\n projectPath: input.projectPath,\n });\n }\n\n const latestSnapshot = getLatestGlobalApplySnapshotForProfile(activeProfile);\n const homeRoot = resolveHomeRoot();\n const pluginIds = collectProfilePluginIds(plugin);\n let expectedApply: ApplyProfilePluginResult;\n try {\n expectedApply = await applyProfilePlugin(activeProfile, {\n dryRun: true,\n harness: input.harness,\n conflictPolicy: \"replace\",\n pull: false,\n pinSkillEmits: false,\n mergeLiveSkillMarkdown: false,\n });\n } catch (error) {\n return finalizeGlobalProfileStatus({\n depth,\n activeProfile,\n profileExists: true,\n applied: Boolean(latestSnapshot),\n snapshotId: latestSnapshot?.id ?? null,\n snapshotAt: latestSnapshot?.created_at ?? null,\n stackInSync: false,\n hasDrift: true,\n changes: [],\n warning: error instanceof Error ? error.message : String(error),\n projectPath: input.projectPath,\n pluginIds,\n });\n }\n\n const stackInSync = latestSnapshot\n ? pluginIdsMatch(latestSnapshot.plugin_ids, expectedApply.configured_plugin_ids)\n : false;\n\n const changes: DriftFileChange[] = [];\n for (const file of expectedApply.expected_files ?? []) {\n const current = readGlobalFile(homeRoot, file.path);\n const owned = listMaterializationsForRootPath(homeRoot, file.path);\n if (current === null) {\n if (owned.length === 0) {\n continue;\n }\n changes.push(\n withAffectedResources({ path: file.path, type: \"deleted\" }, file.content, null),\n );\n continue;\n }\n if (owned.length > 0) {\n const diskHash = hashOnDiskFile(join(homeRoot, file.path));\n if (owned.some((row) => row.generated_hash === diskHash)) {\n continue;\n }\n if (fileContentsEquivalentForDrift(file.path, current, file.content)) {\n continue;\n }\n changes.push(\n withAffectedResources(\n { path: file.path, type: \"modified\" },\n file.content,\n current,\n ),\n );\n continue;\n }\n if (!fileContentsEquivalentForDrift(file.path, current, file.content)) {\n changes.push(\n withAffectedResources(\n { path: file.path, type: \"modified\" },\n file.content,\n current,\n ),\n );\n }\n }\n\n const applied = Boolean(latestSnapshot);\n const hasDrift = !applied || !stackInSync || changes.length > 0;\n\n return finalizeGlobalProfileStatus(\n {\n depth,\n activeProfile,\n profileExists: true,\n applied,\n snapshotId: latestSnapshot?.id ?? null,\n snapshotAt: latestSnapshot?.created_at ?? null,\n stackInSync,\n hasDrift,\n changes,\n projectPath: input.projectPath,\n expectedApply,\n pluginIds,\n },\n input.harness,\n );\n}\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { ulid } from \"ulid\";\nimport { isEmptyBuiltinProfile } from \"../constants/profile.js\";\nimport { getHarnesstapDir } from \"../db/connection.js\";\nimport { getLatestGlobalApplySnapshotForProfile } from \"../models/global-apply-snapshot.js\";\nimport { getActiveProfileName } from \"./active-profile.js\";\nimport type { ApplyProfilePluginOptions } from \"./profile-apply.js\";\nimport { withProfileApplyLock } from \"./profile-apply-lock.js\";\nimport { flattenLiveRestoreFiles } from \"./snapshot-capture.js\";\nimport {\n buildProfileContents,\n type ProfileContents,\n} from \"./profile-contents.js\";\nimport type { DriftFileChange } from \"./project-drift.js\";\nimport {\n buildContentsFromResources,\n captureUntrackedResourcesForStash,\n removeUntrackedStashFiles,\n restoreUntrackedStashFiles,\n stashedFilesToDriftChanges,\n type StashedFileSnapshot,\n} from \"./profile-untracked-resources.js\";\nimport { resolveHomeRoot } from \"../utils/home-root.js\";\n\nexport interface ProfileStashEntry {\n id: string;\n profile_name: string;\n created_at: string;\n contents: ProfileContents;\n file_changes: DriftFileChange[];\n stashed_files: StashedFileSnapshot[];\n}\n\ninterface ProfileStashFile {\n entries: ProfileStashEntry[];\n}\n\nexport class ProfileStashError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"ProfileStashError\";\n }\n}\n\nfunction emptyProfileContents(): ProfileContents {\n return {\n plugins: [],\n stack_resource_count: 0,\n stack_summary: null,\n type_counts: {},\n resources: [],\n plugin_pins: [],\n mcp_servers: [],\n };\n}\n\nfunction getProfileStashPath(): string {\n return join(getHarnesstapDir(), \"profile-stash.json\");\n}\n\nfunction isProfileContents(value: unknown): value is ProfileContents {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n const candidate = value as Partial<ProfileContents>;\n return Array.isArray(candidate.resources);\n}\n\nfunction isStashedFileSnapshot(value: unknown): value is StashedFileSnapshot {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n const candidate = value as Partial<StashedFileSnapshot>;\n return typeof candidate.path === \"string\" && typeof candidate.content === \"string\";\n}\n\nfunction hydrateStashEntry(raw: unknown): ProfileStashEntry | null {\n if (typeof raw !== \"object\" || raw === null) {\n return null;\n }\n const entry = raw as Partial<ProfileStashEntry>;\n if (\n typeof entry.id !== \"string\"\n || typeof entry.profile_name !== \"string\"\n || typeof entry.created_at !== \"string\"\n ) {\n return null;\n }\n\n const contents = isProfileContents(entry.contents)\n ? entry.contents\n : buildProfileContents(entry.profile_name) ?? emptyProfileContents();\n const fileChanges = Array.isArray(entry.file_changes)\n ? entry.file_changes.filter(\n (change): change is DriftFileChange =>\n typeof change === \"object\"\n && change !== null\n && typeof (change as DriftFileChange).path === \"string\"\n && typeof (change as DriftFileChange).type === \"string\",\n )\n : [];\n const stashedFiles = Array.isArray(entry.stashed_files)\n ? entry.stashed_files.filter(isStashedFileSnapshot)\n : [];\n\n return {\n id: entry.id,\n profile_name: entry.profile_name,\n created_at: entry.created_at,\n contents,\n file_changes: fileChanges,\n stashed_files: stashedFiles,\n };\n}\n\nfunction readProfileStashFile(): ProfileStashFile {\n const filePath = getProfileStashPath();\n if (!existsSync(filePath)) {\n return { entries: [] };\n }\n try {\n const parsed = JSON.parse(readFileSync(filePath, \"utf-8\")) as Partial<ProfileStashFile>;\n if (!Array.isArray(parsed.entries)) {\n return { entries: [] };\n }\n const entries = parsed.entries\n .map((entry) => hydrateStashEntry(entry))\n .filter((entry): entry is ProfileStashEntry => entry !== null);\n return { entries };\n } catch {\n return { entries: [] };\n }\n}\n\nfunction writeProfileStashFile(file: ProfileStashFile): void {\n const home = getHarnesstapDir();\n mkdirSync(home, { recursive: true });\n writeFileSync(\n getProfileStashPath(),\n `${JSON.stringify(file, null, 2)}\\n`,\n \"utf-8\",\n );\n}\n\nexport function listProfileStashEntries(): ProfileStashEntry[] {\n return readProfileStashFile().entries;\n}\n\nfunction pushProfileStashEntry(input: {\n profile_name: string;\n contents: ProfileContents;\n file_changes: DriftFileChange[];\n stashed_files: StashedFileSnapshot[];\n}): ProfileStashEntry {\n const file = readProfileStashFile();\n const entry: ProfileStashEntry = {\n id: ulid(),\n profile_name: input.profile_name,\n created_at: new Date().toISOString(),\n contents: input.contents,\n file_changes: input.file_changes,\n stashed_files: input.stashed_files,\n };\n file.entries.unshift(entry);\n writeProfileStashFile(file);\n return entry;\n}\n\nfunction popProfileStashEntry(): ProfileStashEntry | undefined {\n const file = readProfileStashFile();\n const entry = file.entries.shift();\n if (entry) {\n writeProfileStashFile(file);\n }\n return entry;\n}\n\nfunction peekProfileStashEntry(): ProfileStashEntry | undefined {\n return readProfileStashFile().entries[0];\n}\n\nfunction resolveStashableActiveProfile(): string {\n const activeProfile = getActiveProfileName();\n if (!activeProfile) {\n throw new ProfileStashError(\n \"No active profile to stash. Set one with profile use <name> first.\",\n );\n }\n if (isEmptyBuiltinProfile(activeProfile)) {\n throw new ProfileStashError(\n 'Legacy active profile \"empty\" has no stashable state. Run profile use <name>, then profile stash.',\n );\n }\n return activeProfile;\n}\n\nexport interface StashClearedUntrackedResult {\n dry_run: boolean;\n profile_name: string;\n removed_files: string[];\n}\n\nexport interface StashProfileResult {\n entry: ProfileStashEntry;\n cleared: StashClearedUntrackedResult;\n}\n\nfunction readHomeFile(homeRoot: string, relativePath: string): string | null {\n const fullPath = resolve(homeRoot, relativePath);\n if (!existsSync(fullPath)) {\n return null;\n }\n try {\n return readFileSync(fullPath, \"utf-8\");\n } catch {\n return null;\n }\n}\n\nfunction lastWrittenContent(profileName: string, relativePath: string): string | undefined {\n const snapshot = getLatestGlobalApplySnapshotForProfile(profileName);\n if (!snapshot?.state) {\n return undefined;\n }\n return flattenLiveRestoreFiles(snapshot.state).find((file) => file.path === relativePath)?.content;\n}\n\n/**\n * Stash modified managed files (the same set `--changes save` walks) and restore\n * last-apply bytes when known. Never deletes the path.\n */\nexport async function stashManagedDriftChanges(input: {\n changes: DriftFileChange[];\n dryRun?: boolean;\n}): Promise<StashProfileResult> {\n return withProfileApplyLock(async () => {\n const profileName = resolveStashableActiveProfile();\n const homeRoot = resolveHomeRoot();\n const files: StashedFileSnapshot[] = [];\n for (const change of input.changes) {\n const current = readHomeFile(homeRoot, change.path);\n if (current === null) {\n continue;\n }\n files.push({ path: change.path, content: current });\n }\n if (files.length === 0) {\n throw new ProfileStashError(\"No unsaved changes to stash.\");\n }\n\n const contents = buildProfileContents(profileName) ?? emptyProfileContents();\n const fileChanges = stashedFilesToDriftChanges(files);\n\n if (!input.dryRun) {\n for (const file of files) {\n const previous = lastWrittenContent(profileName, file.path);\n if (previous === undefined) {\n continue;\n }\n const fullPath = resolve(homeRoot, file.path);\n mkdirSync(dirname(fullPath), { recursive: true });\n writeFileSync(fullPath, previous, \"utf-8\");\n }\n }\n\n if (input.dryRun) {\n return {\n entry: {\n id: \"dry-run\",\n profile_name: profileName,\n created_at: new Date().toISOString(),\n contents,\n file_changes: fileChanges,\n stashed_files: files,\n },\n cleared: {\n dry_run: true,\n profile_name: profileName,\n removed_files: [],\n },\n };\n }\n\n const entry = pushProfileStashEntry({\n profile_name: profileName,\n contents,\n file_changes: fileChanges,\n stashed_files: files,\n });\n return {\n entry,\n cleared: {\n dry_run: false,\n profile_name: profileName,\n removed_files: [],\n },\n };\n });\n}\n\nexport async function stashProfileCommand(\n options: ApplyProfilePluginOptions,\n): Promise<StashProfileResult> {\n return withProfileApplyLock(async () => {\n const profileName = resolveStashableActiveProfile();\n let capture: Awaited<ReturnType<typeof captureUntrackedResourcesForStash>>;\n try {\n capture = await captureUntrackedResourcesForStash({\n profileSelector: profileName,\n harness: options.harness,\n });\n } catch (error) {\n throw new ProfileStashError(\n error instanceof Error ? error.message : String(error),\n );\n }\n\n const homeRoot = resolveHomeRoot();\n const contents = buildContentsFromResources(capture.resources);\n const fileChanges = stashedFilesToDriftChanges(capture.files);\n const removedFiles = removeUntrackedStashFiles(\n homeRoot,\n capture.files,\n options.dryRun,\n );\n\n if (options.dryRun) {\n return {\n entry: {\n id: \"dry-run\",\n profile_name: profileName,\n created_at: new Date().toISOString(),\n contents,\n file_changes: fileChanges,\n stashed_files: capture.files,\n },\n cleared: {\n dry_run: true,\n profile_name: profileName,\n removed_files: removedFiles,\n },\n };\n }\n\n const entry = pushProfileStashEntry({\n profile_name: profileName,\n contents,\n file_changes: fileChanges,\n stashed_files: capture.files,\n });\n\n return {\n entry,\n cleared: {\n dry_run: false,\n profile_name: profileName,\n removed_files: removedFiles,\n },\n };\n });\n}\n\nexport interface RestoreStashedUntrackedResult {\n dry_run: boolean;\n profile_name: string;\n restored_files: string[];\n cancelled: boolean;\n}\n\nexport interface RestoreProfileStashResult {\n entry: ProfileStashEntry;\n restored: RestoreStashedUntrackedResult;\n removed: boolean;\n}\n\nexport async function popProfileStashCommand(\n options: ApplyProfilePluginOptions,\n): Promise<RestoreProfileStashResult> {\n return withProfileApplyLock(async () => {\n const entry = popProfileStashEntry();\n if (!entry) {\n throw new ProfileStashError(\"No stashed profile to restore.\");\n }\n const homeRoot = resolveHomeRoot();\n const restoredFiles = restoreUntrackedStashFiles(\n homeRoot,\n entry.stashed_files,\n options.dryRun,\n );\n return {\n entry,\n restored: {\n dry_run: options.dryRun === true,\n profile_name: entry.profile_name,\n restored_files: restoredFiles,\n cancelled: false,\n },\n removed: true,\n };\n });\n}\n\nexport async function applyProfileStashCommand(\n options: ApplyProfilePluginOptions,\n): Promise<RestoreProfileStashResult> {\n return withProfileApplyLock(async () => {\n const entry = peekProfileStashEntry();\n if (!entry) {\n throw new ProfileStashError(\"No stashed profile to restore.\");\n }\n const homeRoot = resolveHomeRoot();\n const restoredFiles = restoreUntrackedStashFiles(\n homeRoot,\n entry.stashed_files,\n options.dryRun,\n );\n return {\n entry,\n restored: {\n dry_run: options.dryRun === true,\n profile_name: entry.profile_name,\n restored_files: restoredFiles,\n cancelled: false,\n },\n removed: false,\n };\n });\n}\n","import {\n discardConfirm,\n discardedChangesLine,\n SWITCH_CHANGES_VALUES,\n type SwitchChangesValue,\n savedChangesLine,\n stashedChangesLine,\n unsavedChangesFlagHint,\n unsavedChangesLine,\n} from \"../copy/cli.js\";\nimport { ui } from \"../ui/index.js\";\nimport {\n detectGlobalProfileStatus,\n type GlobalProfileStatus,\n} from \"./global-profile-drift.js\";\nimport { commitManagedPathFromLive } from \"./profile-commit-resource.js\";\nimport { stashManagedDriftChanges } from \"./profile-stash.js\";\nimport {\n promptForChoice,\n promptForConfirmation,\n shouldUseBrowsePicker,\n} from \"./wizards/shared.js\";\n\nexport type SwitchChangesDecision = \"continue\" | \"abort\";\n\nexport function parseSwitchChanges(\n raw: string | undefined,\n): SwitchChangesValue | \"invalid\" | undefined {\n if (raw === undefined || raw === \"\") {\n return undefined;\n }\n if ((SWITCH_CHANGES_VALUES as readonly string[]).includes(raw)) {\n return raw as SwitchChangesValue;\n }\n return \"invalid\";\n}\n\nexport async function maybeSyncActiveProfileBeforeSwitch(input: {\n targetProfileName: string;\n harness?: string;\n yes?: boolean;\n format?: string;\n changes?: string;\n noInteractive?: boolean;\n}): Promise<SwitchChangesDecision> {\n const format = input.format ?? \"human\";\n\n let status: GlobalProfileStatus;\n try {\n status = await detectGlobalProfileStatus({\n harness: input.harness,\n depth: \"full\",\n });\n } catch (error) {\n ui.warn(error instanceof Error ? error.message : String(error));\n return \"continue\";\n }\n\n if (!status.active_profile || status.active_profile === input.targetProfileName) {\n return \"continue\";\n }\n if (status.changes.length === 0) {\n return \"continue\";\n }\n\n const count = status.changes.length;\n const parsedChanges = parseSwitchChanges(input.changes);\n if (parsedChanges === \"invalid\") {\n ui.danger('Error: Invalid --changes. Use save, stash or discard.');\n return \"abort\";\n }\n\n const interactive =\n !input.yes\n && shouldUseBrowsePicker({\n noInteractive: input.noInteractive,\n format,\n });\n\n let action: SwitchChangesValue | \"cancel\";\n if (parsedChanges) {\n action = parsedChanges;\n } else if (!interactive) {\n ui.danger(`Error: ${unsavedChangesLine(status.active_profile, count)}`);\n ui.hint(unsavedChangesFlagHint());\n return \"abort\";\n } else {\n ui.warn(unsavedChangesLine(status.active_profile, count));\n action = await promptForChoice({\n message: \"What should HarnessTap do with them?\",\n choices: [\n { name: `Save them to \"${status.active_profile}\"`, value: \"save\" as const },\n { name: \"Stash them\", value: \"stash\" as const },\n { name: \"Discard them\", value: \"discard\" as const },\n { name: \"Cancel\", value: \"cancel\" as const },\n ],\n });\n }\n\n switch (action) {\n case \"cancel\":\n return \"abort\";\n case \"save\": {\n for (const change of status.changes) {\n try {\n await commitManagedPathFromLive({\n profileSelector: status.active_profile,\n path: change.path,\n scope: \"home\",\n ...(input.harness ? { harness: input.harness } : {}),\n });\n } catch {\n // Aggregate paths or unmapped files stay on disk; switch still proceeds.\n }\n }\n ui.success(savedChangesLine(status.active_profile, count));\n return \"continue\";\n }\n case \"stash\": {\n await stashManagedDriftChanges({\n changes: status.changes,\n });\n ui.success(stashedChangesLine(count, \"ht profile stash pop\"));\n return \"continue\";\n }\n case \"discard\": {\n if (interactive && parsedChanges !== \"discard\") {\n const confirmed = await promptForConfirmation({\n message: discardConfirm(count),\n default: false,\n });\n if (!confirmed) {\n return \"abort\";\n }\n }\n ui.success(discardedChangesLine(count));\n return \"continue\";\n }\n default: {\n const unhandled: never = action;\n throw new Error(`Unhandled switch changes action: ${String(unhandled)}`);\n }\n }\n}\n","import {\n resolveProfileEnvironment,\n type ProjectProfileEntry,\n type ResolvedProjectConfig,\n} from \"../project-config.js\";\nimport {\n promptForChoice,\n promptForSearchableChoice,\n type PromptChoice,\n} from \"./shared.js\";\n\nfunction formatProfilePluginHint(entry: ProjectProfileEntry): string {\n switch (entry.source) {\n case \"catalog\":\n case \"local\":\n return entry.selector ?? entry.name;\n case \"inline\":\n return entry.plugin ?? entry.name;\n default: {\n const unhandledSource: never = entry.source;\n throw new Error(`Unhandled profile source: ${unhandledSource}`);\n }\n }\n}\n\nfunction formatProjectProfileChoiceName(\n config: ResolvedProjectConfig,\n entry: ProjectProfileEntry,\n): string {\n const parts = [entry.name, entry.source, formatProfilePluginHint(entry)];\n const environment = resolveProfileEnvironment(config, entry);\n if (environment) {\n parts.push(`env ${environment}`);\n }\n return parts.join(\" · \");\n}\n\nexport function buildProjectProfileChoices(\n config: ResolvedProjectConfig,\n): PromptChoice<string>[] {\n return config.profiles.map((entry) => ({\n name: formatProjectProfileChoiceName(config, entry),\n value: entry.name,\n }));\n}\n\nfunction resolveDefaultProfileKey(config: ResolvedProjectConfig): string | undefined {\n const defaultProfile = config.default_profile;\n if (!defaultProfile) {\n return undefined;\n }\n return config.profiles.some((profile) => profile.name === defaultProfile)\n ? defaultProfile\n : undefined;\n}\n\nexport async function promptForProjectProfile(\n config: ResolvedProjectConfig,\n): Promise<string> {\n const choices = buildProjectProfileChoices(config);\n const defaultProfile = resolveDefaultProfileKey(config);\n const message = \"Which project profile should be used?\";\n\n if (choices.length >= 5) {\n return promptForSearchableChoice({\n message,\n choices,\n default: defaultProfile,\n });\n }\n\n return promptForChoice({\n message,\n choices,\n default: defaultProfile,\n });\n}\n","import {\n isEmptyBuiltinProfile,\n isProfilePlugin,\n} from \"../constants/profile.js\";\nimport {\n addResourceToPlugin,\n createPlugin,\n resolvePluginSelector,\n} from \"../models/plugin-model.js\";\nimport {\n normalizeResourceInput,\n upsertResource,\n} from \"../models/resource.js\";\nimport type { ClaudePluginConfig, ResourceType } from \"../types.js\";\nimport { useEnvironmentCommand } from \"./environment-commands.js\";\nimport {\n formatEnvironmentToml,\n importEnvironmentToml,\n} from \"./environment-import-export.js\";\nimport { detectGlobalProfileStatus } from \"./global-profile-drift.js\";\nimport { installPluginFromCatalog } from \"./plugin-catalog-install.js\";\nimport { parsePluginSelector, resolveRemotePluginSelector } from \"./plugin-selector.js\";\nimport {\n promptMaterializationConflict,\n resolveApplyConflictPolicy,\n} from \"./materialization-conflicts.js\";\nimport {\n findProjectConfig,\n getProfileEntry,\n resolveProfileEnvironment,\n type ProjectProfileEntry,\n type ProjectPluginTable,\n type ResolvedProjectConfig,\n} from \"./project-config.js\";\nimport { MISSING_PROJECT_CONFIG_MESSAGE } from \"./project-config-messages.js\";\nimport { promptForProjectProfile } from \"./wizards/project-use.js\";\nimport { shouldUseWizard } from \"./wizards/shared.js\";\nimport { useProfileCommand } from \"./profile-commands.js\";\nimport { stashProfileCommand, ProfileStashError } from \"./profile-stash.js\";\nimport { maybeSyncActiveProfileBeforeSwitch } from \"./profile-switch-prompt.js\";\nimport { clearGlobalProfileApply, type ApplyProfilePluginResult } from \"./profile-apply.js\";\nimport { clearActiveProfileName, getActiveProfileName } from \"./active-profile.js\";\nimport { getGlobalActiveEnvironmentName } from \"./environment-session.js\";\n\nexport interface ProjectUseOptions {\n profile?: string;\n project?: string;\n dryRun?: boolean;\n force?: boolean;\n pull?: boolean;\n harness?: string;\n account?: string;\n baseUrl?: string;\n onConflict?: string;\n format?: string;\n yes?: boolean;\n interactive?: boolean;\n noInteractive?: boolean;\n}\n\nexport type ProjectUseResult =\n | {\n skipped: true;\n profile_key: string;\n plugin_name: string;\n environment_name?: string;\n }\n | ({\n skipped: false;\n profile_key: string;\n plugin_name: string;\n environment_name?: string;\n stashed?: boolean;\n stash_id?: string;\n } & ApplyProfilePluginResult);\n\nfunction assertProfilePlugin(plugin: { name: string; tags: string[] }, context: string): void {\n if (!isProfilePlugin(plugin)) {\n throw new Error(`Plugin \"${plugin.name}\" is not tagged as a profile (${context})`);\n }\n}\n\nfunction resolvePluginNameFromSelector(selector: string): string {\n const existing = resolvePluginSelector(selector);\n if (existing) {\n return existing.name;\n }\n return parsePluginSelector(selector).name;\n}\n\nexport function resolveExpectedPluginName(\n config: ResolvedProjectConfig,\n entry: ProjectProfileEntry,\n): string {\n switch (entry.source) {\n case \"catalog\":\n case \"local\": {\n const selector = entry.selector;\n if (!selector) {\n throw new Error(`Profile ${entry.name} is missing a plugin selector.`);\n }\n return resolvePluginNameFromSelector(selector);\n }\n case \"inline\": {\n const pluginKey = entry.plugin;\n if (!pluginKey) {\n throw new Error(`Inline profile ${entry.name} is missing a plugin reference.`);\n }\n const inlinePlugin = config.plugins.find((plugin) => plugin.name === pluginKey);\n return inlinePlugin?.name ?? pluginKey;\n }\n default: {\n const unhandledSource: never = entry.source;\n throw new Error(`Unhandled profile source: ${unhandledSource}`);\n }\n }\n}\n\nfunction resolvePreviewPluginName(\n config: ResolvedProjectConfig,\n entry: ProjectProfileEntry,\n): string {\n return resolveExpectedPluginName(config, entry);\n}\n\nfunction findInlinePluginTable(\n config: ResolvedProjectConfig,\n pluginKey: string,\n): ProjectPluginTable {\n const plugin = config.plugins.find((entry) => entry.name === pluginKey);\n if (!plugin) {\n throw new Error(`Inline profile references unknown plugin: ${pluginKey}`);\n }\n return plugin;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction importInlinePluginTable(pluginTable: ProjectPluginTable) {\n const resourcesRaw = Array.isArray(pluginTable.resources) ? pluginTable.resources : [];\n const plugin = createPlugin({\n name: pluginTable.name,\n version: typeof pluginTable.version === \"string\" ? pluginTable.version : \"1.0.0\",\n description: typeof pluginTable.description === \"string\" ? pluginTable.description : \"\",\n tags: Array.isArray(pluginTable.tags) ? pluginTable.tags.map(String) : [],\n ...(isRecord(pluginTable.claude)\n ? { claude: pluginTable.claude as ClaudePluginConfig }\n : {}),\n });\n\n for (const raw of resourcesRaw) {\n if (!isRecord(raw)) continue;\n const metadata = isRecord(raw.metadata)\n ? raw.metadata\n : typeof raw.metadata_json === \"string\"\n ? (JSON.parse(raw.metadata_json) as Record<string, unknown>)\n : {};\n const upserted = upsertResource(\n normalizeResourceInput({\n type: String(raw.type ?? \"\") as ResourceType,\n name: String(raw.name ?? \"\"),\n description: String(raw.description ?? \"\"),\n content: String(raw.content ?? \"\"),\n metadata,\n source: `project-inline:${pluginTable.name}`,\n namespace: String(raw.namespace ?? \"\"),\n origin_kind: (raw.origin_kind ?? \"manual\") as \"manual\",\n origin_ref: String(raw.origin_ref ?? \"\"),\n }),\n { policy: \"overwrite\" },\n );\n if (upserted.action === \"skipped\") {\n throw new Error(`Failed to import inline resource: ${String(raw.type)}:${String(raw.name)}`);\n }\n addResourceToPlugin(plugin.id, upserted.resource.id);\n }\n\n return plugin;\n}\n\nexport async function resolveProjectProfileKey(\n config: ResolvedProjectConfig,\n options: Pick<ProjectUseOptions, \"profile\" | \"format\" | \"interactive\" | \"noInteractive\">,\n): Promise<string> {\n if (options.profile) {\n getProfileEntry(config, options.profile);\n return options.profile;\n }\n\n if (config.profiles.length === 0) {\n throw new Error(\"Project config has no profiles\");\n }\n\n if (config.profiles.length === 1) {\n const [onlyProfile] = config.profiles;\n if (!onlyProfile) {\n throw new Error(\"Project config has no profiles\");\n }\n return onlyProfile.name;\n }\n\n if (\n shouldUseWizard({\n interactive: options.interactive,\n noInteractive: options.noInteractive,\n format: options.format,\n missingRequiredArgs: !options.profile,\n })\n ) {\n return promptForProjectProfile(config);\n }\n\n throw new Error(\"multiple profiles configured; pass --profile <name>\");\n}\n\nexport async function resolveProjectProfilePluginName(\n config: ResolvedProjectConfig,\n entry: ProjectProfileEntry,\n options: Pick<ProjectUseOptions, \"pull\" | \"account\" | \"baseUrl\">,\n): Promise<string> {\n const pull = options.pull ?? true;\n\n switch (entry.source) {\n case \"catalog\": {\n const selector = entry.selector;\n if (!selector) {\n throw new Error(`Catalog profile ${entry.name} is missing a plugin selector.`);\n }\n const existing = resolvePluginSelector(selector);\n if (existing) {\n assertProfilePlugin(existing, `catalog profile ${entry.name}`);\n return existing.name;\n }\n if (!pull) {\n throw new Error(\n `Profile plugin not found locally: ${selector}. Re-run with pull enabled or install the plugin first.`,\n );\n }\n\n const parsed = parsePluginSelector(selector);\n if (parsed.scope === \"published\") {\n const remote = resolveRemotePluginSelector(selector, {});\n const installed = await installPluginFromCatalog(remote, {\n account: options.account,\n baseUrl: options.baseUrl,\n });\n const plugin = resolvePluginSelector(installed.pluginName);\n if (!plugin) {\n throw new Error(`Plugin not found after catalog install: ${installed.pluginName}`);\n }\n assertProfilePlugin(plugin, `catalog profile ${entry.name}`);\n return plugin.name;\n }\n\n throw new Error(`Profile plugin not found locally: ${selector}`);\n }\n case \"local\": {\n const selector = entry.selector;\n if (!selector) {\n throw new Error(`Local profile ${entry.name} is missing a plugin selector.`);\n }\n const plugin = resolvePluginSelector(selector);\n if (!plugin) {\n throw new Error(`Profile plugin not found locally: ${selector}`);\n }\n assertProfilePlugin(plugin, `local profile ${entry.name}`);\n return plugin.name;\n }\n case \"inline\": {\n const pluginKey = entry.plugin;\n if (!pluginKey) {\n throw new Error(`Inline profile ${entry.name} is missing a plugin reference.`);\n }\n const pluginTable = findInlinePluginTable(config, pluginKey);\n const imported = importInlinePluginTable(pluginTable);\n assertProfilePlugin(imported, `inline profile ${entry.name}`);\n return imported.name;\n }\n default: {\n const unhandledSource: never = entry.source;\n throw new Error(`Unhandled profile source: ${unhandledSource}`);\n }\n }\n}\n\nexport async function importProjectConfigEnvironments(\n config: ResolvedProjectConfig,\n): Promise<void> {\n for (const environment of config.environments) {\n importEnvironmentToml(formatEnvironmentToml(environment), {\n createIfMissing: true,\n });\n }\n}\n\nexport async function shouldSkipProjectUse(input: {\n pluginName: string;\n environmentName?: string;\n force?: boolean;\n harness?: string;\n}): Promise<boolean> {\n if (input.force) {\n return false;\n }\n\n const activeProfile = getActiveProfileName();\n if (activeProfile !== input.pluginName) {\n return false;\n }\n\n const activeEnvironment = getGlobalActiveEnvironmentName();\n const environmentMatches =\n input.environmentName === undefined\n ? activeEnvironment === undefined\n : activeEnvironment === input.environmentName;\n if (!environmentMatches) {\n return false;\n }\n\n const status = await detectGlobalProfileStatus({ harness: input.harness });\n return (\n (!status.has_drift && status.stack_in_sync) ||\n (status.applied && !status.has_drift)\n );\n}\n\nexport async function executeProjectUse(\n options: ProjectUseOptions = {},\n): Promise<ProjectUseResult> {\n if (options.profile && isEmptyBuiltinProfile(options.profile)) {\n const conflictPolicy = resolveApplyConflictPolicy({\n onConflict: options.onConflict,\n noInteractive: options.noInteractive ?? options.format === \"json\",\n });\n let stashed: Awaited<ReturnType<typeof stashProfileCommand>> | undefined;\n try {\n stashed = await stashProfileCommand({\n harness: options.harness,\n dryRun: options.dryRun,\n conflictPolicy,\n pull: false,\n ...(conflictPolicy === \"prompt\"\n ? { conflictResolver: promptMaterializationConflict }\n : {}),\n });\n } catch (error) {\n if (!(error instanceof ProfileStashError)) {\n throw error;\n }\n }\n const cleared = await clearGlobalProfileApply({\n harness: options.harness,\n dryRun: options.dryRun,\n conflictPolicy,\n pull: false,\n ...(conflictPolicy === \"prompt\"\n ? { conflictResolver: promptMaterializationConflict }\n : {}),\n });\n if (!options.dryRun) {\n clearActiveProfileName();\n }\n return {\n skipped: false,\n profile_key: stashed?.entry.profile_name ?? getActiveProfileName() ?? \"empty\",\n plugin_name: cleared.profile_name,\n stashed: Boolean(stashed),\n ...(stashed ? { stash_id: stashed.entry.id } : {}),\n ...cleared,\n };\n }\n\n const config = findProjectConfig(options.project ?? process.cwd());\n if (!config) {\n throw new Error(MISSING_PROJECT_CONFIG_MESSAGE);\n }\n\n const profileKey = await resolveProjectProfileKey(config, {\n profile: options.profile,\n format: options.format,\n interactive: options.interactive,\n noInteractive: options.noInteractive,\n });\n const entry = getProfileEntry(config, profileKey);\n const environmentName = resolveProfileEnvironment(config, entry);\n const expectedPluginName = resolveExpectedPluginName(config, entry);\n const dryRun = options.dryRun === true;\n\n if (\n await shouldSkipProjectUse({\n pluginName: expectedPluginName,\n environmentName,\n force: options.force,\n harness: options.harness,\n })\n ) {\n return {\n skipped: true,\n profile_key: profileKey,\n plugin_name: expectedPluginName,\n ...(environmentName ? { environment_name: environmentName } : {}),\n };\n }\n\n if (!dryRun) {\n await importProjectConfigEnvironments(config);\n }\n\n const pluginName = dryRun\n ? resolvePreviewPluginName(config, entry)\n : await resolveProjectProfilePluginName(config, entry, {\n pull: options.pull ?? true,\n account: options.account,\n baseUrl: options.baseUrl,\n });\n\n if (environmentName && !dryRun) {\n useEnvironmentCommand(environmentName);\n }\n\n if (!dryRun) {\n const sync = await maybeSyncActiveProfileBeforeSwitch({\n targetProfileName: pluginName,\n harness: options.harness,\n yes: options.yes,\n format: options.format,\n });\n if (sync === \"abort\") {\n throw new Error(\"Profile switch cancelled.\");\n }\n }\n\n const conflictPolicy = resolveApplyConflictPolicy({\n onConflict: options.onConflict,\n noInteractive: options.noInteractive ?? options.format === \"json\",\n });\n const applied = await useProfileCommand(pluginName, {\n harness: options.harness,\n dryRun: options.dryRun,\n pull: options.pull ?? true,\n account: options.account,\n baseUrl: options.baseUrl,\n conflictPolicy,\n ...(conflictPolicy === \"prompt\"\n ? { conflictResolver: promptMaterializationConflict }\n : {}),\n });\n\n return {\n skipped: false,\n profile_key: profileKey,\n plugin_name: pluginName,\n ...(environmentName ? { environment_name: environmentName } : {}),\n ...applied,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,YAAY,MAAM,eAAe;AAGnC,IAAM,gBAAN,cAA4B,MAAM;AAAA,EAC9B;AAAA,EAET,YAAY,OAAe,UAAkB;AAC3C,UAAM,wBAAwB,KAAK,GAAG;AACtC,SAAK,OAAO;AACZ,SAAK,QAAQ;AACb,SAAK,WAAW;AAAA,EAClB;AAAA,EAES;AACX;AAEO,SAAS,eAAe,KAAa,OAAO,gBAAgB,GAAW;AAC5E,QAAM,UAAU,IAAI,KAAK;AACzB,MAAI,YAAY,KAAK;AACnB,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,W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B,WACnB,EAAE,kBAAkB,8BAA8B,IAClD,CAAC;AAAA,EACP,CAAC;AAED,SAAO;AAAA,IACL,SAAS;AAAA,IACT,aAAa;AAAA,IACb,aAAa;AAAA,IACb,GAAI,kBAAkB,EAAE,kBAAkB,gBAAgB,IAAI,CAAC;AAAA,IAC/D,GAAG;AAAA,EACL;AACF;","names":["existsSync","join","join","existsSync","latestSnapshot","expectedApply","stackInSync","applied","hasDrift","existsSync","readFileSync","join","resolve","join","existsSync","readFileSync","resolve","conflictPolicy"]}
|