harnesstap 1.4.0 → 1.6.1
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 +3 -1
- package/dist/apply-ZGEAY6YZ.js +50 -0
- package/dist/{approve-FBGYQGWN.js → approve-VPVMU2MM.js} +10 -13
- package/dist/{approve-FBGYQGWN.js.map → approve-VPVMU2MM.js.map} +1 -1
- package/dist/{audit-VI4QZ6X2.js → audit-AO7AGET3.js} +11 -15
- package/dist/{audit-VI4QZ6X2.js.map → audit-AO7AGET3.js.map} +1 -1
- package/dist/{auth-4CQCDS2W.js → auth-7YRIJNXU.js} +10 -12
- package/dist/{auth-4CQCDS2W.js.map → auth-7YRIJNXU.js.map} +1 -1
- package/dist/bin.js +13 -34
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-OML4HXKT.js → chunk-262KZULH.js} +16 -22
- package/dist/chunk-262KZULH.js.map +1 -0
- package/dist/{chunk-ZUASVASP.js → chunk-26QGX47N.js} +26097 -16881
- package/dist/chunk-26QGX47N.js.map +1 -0
- package/dist/{chunk-3P6BWL5F.js → chunk-27IPOVKQ.js} +2 -2
- package/dist/{chunk-M4KLHJ6U.js → chunk-2BESDRYP.js} +8 -10
- package/dist/{chunk-M4KLHJ6U.js.map → chunk-2BESDRYP.js.map} +1 -1
- package/dist/{chunk-PCMON7Y2.js → chunk-2BWIEB2G.js} +8 -10
- package/dist/{chunk-PCMON7Y2.js.map → chunk-2BWIEB2G.js.map} +1 -1
- package/dist/{chunk-XTVGCVU4.js → chunk-2NMLWSUH.js} +41 -42
- package/dist/chunk-2NMLWSUH.js.map +1 -0
- package/dist/{chunk-TQ2NA4Z4.js → chunk-4E3G4H5B.js} +8 -2
- package/dist/chunk-4E3G4H5B.js.map +1 -0
- package/dist/chunk-4QCGTUTM.js +61 -0
- package/dist/chunk-4QCGTUTM.js.map +1 -0
- package/dist/{chunk-TPEJFLV7.js → chunk-6RKJZW2N.js} +4 -6
- package/dist/{chunk-TPEJFLV7.js.map → chunk-6RKJZW2N.js.map} +1 -1
- package/dist/{chunk-JQOKQKQT.js → chunk-7IBFH736.js} +2 -2
- package/dist/{chunk-P2C7JPLD.js → chunk-CKJIS2FM.js} +6 -6
- package/dist/{chunk-R7ZOYVN3.js → chunk-CUOEQQFI.js} +187 -59
- package/dist/chunk-CUOEQQFI.js.map +1 -0
- package/dist/{chunk-REHRUNBB.js → chunk-CWXCZBJR.js} +70 -5
- package/dist/chunk-CWXCZBJR.js.map +1 -0
- package/dist/{chunk-4ZQ2SCGY.js → chunk-FLYQEB6D.js} +509 -207
- package/dist/chunk-FLYQEB6D.js.map +1 -0
- package/dist/{chunk-U6DXASQP.js → chunk-HC7IZY75.js} +2 -2
- package/dist/{chunk-UVVZHWD2.js → chunk-I4DKV63E.js} +2 -2
- package/dist/{chunk-PNGF5EV2.js → chunk-JEC5PWNH.js} +2 -2
- package/dist/{chunk-MR7IOHSX.js → chunk-KFIRABC7.js} +16 -22
- package/dist/{chunk-MR7IOHSX.js.map → chunk-KFIRABC7.js.map} +1 -1
- package/dist/{chunk-6LTLYV5D.js → chunk-LGWFLVZQ.js} +1064 -265
- package/dist/chunk-LGWFLVZQ.js.map +1 -0
- package/dist/{chunk-RDG5DT7S.js → chunk-LX6PMOOC.js} +54 -40
- package/dist/chunk-LX6PMOOC.js.map +1 -0
- package/dist/{chunk-WGP4GUYZ.js → chunk-MILGCNBK.js} +9 -11
- package/dist/{chunk-WGP4GUYZ.js.map → chunk-MILGCNBK.js.map} +1 -1
- package/dist/chunk-MKLJBW5N.js +14 -0
- package/dist/{chunk-N3ZCH64F.js → chunk-MSKTWYHG.js} +86 -32
- package/dist/chunk-MSKTWYHG.js.map +1 -0
- package/dist/{chunk-WG5A6EAU.js → chunk-MTCCUYBZ.js} +821 -28
- package/dist/chunk-MTCCUYBZ.js.map +1 -0
- package/dist/{chunk-BPWFQKI5.js → chunk-NIFKCS7J.js} +2 -2
- package/dist/{chunk-43BDGVN3.js → chunk-NWOYPK2O.js} +56 -9
- package/dist/chunk-NWOYPK2O.js.map +1 -0
- package/dist/{chunk-3FS775NP.js → chunk-NXILQDJG.js} +85 -4
- package/dist/chunk-NXILQDJG.js.map +1 -0
- package/dist/chunk-QF73VLAW.js +31673 -0
- package/dist/chunk-QF73VLAW.js.map +1 -0
- package/dist/{chunk-RFQ3N7FB.js → chunk-QHCGA6LC.js} +11 -19
- package/dist/chunk-QHCGA6LC.js.map +1 -0
- package/dist/{chunk-L6YZE5MY.js → chunk-QPJZKWML.js} +5 -7
- package/dist/{chunk-L6YZE5MY.js.map → chunk-QPJZKWML.js.map} +1 -1
- package/dist/{chunk-ULCD6DJE.js → chunk-RM7VP6ID.js} +24 -61
- package/dist/chunk-RM7VP6ID.js.map +1 -0
- package/dist/{chunk-7HP6AAI3.js → chunk-SMLO5YPI.js} +2 -2
- package/dist/{chunk-73OJQTBW.js → chunk-T2JBSRGG.js} +2 -2
- package/dist/{chunk-IE7B6Q5K.js → chunk-U5Y6WKKT.js} +17 -18
- package/dist/chunk-U5Y6WKKT.js.map +1 -0
- package/dist/chunk-UEA4NCY2.js +106 -0
- package/dist/chunk-UEA4NCY2.js.map +1 -0
- package/dist/chunk-VAPCU2FX.js +70 -0
- package/dist/chunk-VAPCU2FX.js.map +1 -0
- package/dist/{chunk-RVEXPMM3.js → chunk-WEJVFNRO.js} +3 -5
- package/dist/{chunk-RVEXPMM3.js.map → chunk-WEJVFNRO.js.map} +1 -1
- package/dist/{chunk-IMROMZ2K.js → chunk-WWFVMCTR.js} +19 -14
- package/dist/chunk-WWFVMCTR.js.map +1 -0
- package/dist/chunk-XPONNOBR.js +102 -0
- package/dist/chunk-XPONNOBR.js.map +1 -0
- package/dist/{chunk-N3VGY3T3.js → chunk-Y3HJ2F2W.js} +7 -5
- package/dist/{chunk-N3VGY3T3.js.map → chunk-Y3HJ2F2W.js.map} +1 -1
- package/dist/{chunk-2A36HWDE.js → chunk-Y4I7ZCAE.js} +129 -136
- package/dist/chunk-Y4I7ZCAE.js.map +1 -0
- package/dist/{chunk-GRASK6M6.js → chunk-ZREU2UHM.js} +5 -5
- package/dist/{chunk-QA5U36JN.js → chunk-ZT7ANP3H.js} +774 -364
- package/dist/chunk-ZT7ANP3H.js.map +1 -0
- package/dist/{chunk-EOPFER6N.js → chunk-ZUXFPAVX.js} +19 -5
- package/dist/chunk-ZUXFPAVX.js.map +1 -0
- package/dist/{chunk-D432JAXV.js → chunk-ZWB6YXVQ.js} +153 -25
- package/dist/chunk-ZWB6YXVQ.js.map +1 -0
- package/dist/{chunk-23XSG7LI.js → chunk-ZZQDJGWX.js} +4 -4
- package/dist/{compile-GXADKGH5.js → compile-IMJHVXQO.js} +33 -37
- package/dist/{compile-GXADKGH5.js.map → compile-IMJHVXQO.js.map} +1 -1
- package/dist/{config-JMHNA2U5.js → config-FVVN3NWL.js} +16 -21
- package/dist/{config-JMHNA2U5.js.map → config-FVVN3NWL.js.map} +1 -1
- package/dist/cursor-local-install-JS5KSOES.js +94 -0
- package/dist/{cursor-local-install-46RWRBDT.js.map → cursor-local-install-JS5KSOES.js.map} +1 -1
- package/dist/{cursor-local-install-46RWRBDT.js → cursor-local-install-QU5R2FV5.js} +8 -12
- package/dist/cursor-local-install-QU5R2FV5.js.map +1 -0
- package/dist/{doctor-N7ZULPOL.js → doctor-A7VUJSCP.js} +14 -17
- package/dist/doctor-A7VUJSCP.js.map +1 -0
- package/dist/{environment-OBB3WU5B.js → environment-6INIUBNC.js} +42 -50
- package/dist/environment-6INIUBNC.js.map +1 -0
- package/dist/{github-PBYBGOLH.js → github-TFJT3P53.js} +9 -10
- package/dist/{github-PBYBGOLH.js.map → github-TFJT3P53.js.map} +1 -1
- package/dist/{harness-7KYATIV6.js → harness-WQNC5HPZ.js} +46 -84
- package/dist/harness-WQNC5HPZ.js.map +1 -0
- package/dist/{help-EE3AJQD4.js → help-NMS3EXJB.js} +15 -20
- package/dist/{help-EE3AJQD4.js.map → help-NMS3EXJB.js.map} +1 -1
- package/dist/{help-VXWKLQ6A.js → help-VW4RIICD.js} +57 -575
- package/dist/help-VW4RIICD.js.map +1 -0
- package/dist/host-plugin-view-kept-HYCHDB4D.js +139 -0
- package/dist/host-plugin-view-kept-HYCHDB4D.js.map +1 -0
- package/dist/index.js +12 -16
- package/dist/{init-LBTMPDVJ.js → init-RXYL5ZUE.js} +33 -41
- package/dist/{init-LBTMPDVJ.js.map → init-RXYL5ZUE.js.map} +1 -1
- package/dist/live-read-cache-BHU6L7MA.js +13 -0
- package/dist/live-read-cache-NQU7M2C7.js +12 -0
- package/dist/{lock-WLJRXRVK.js → lock-3H3Z65DS.js} +9 -12
- package/dist/{lock-WLJRXRVK.js.map → lock-3H3Z65DS.js.map} +1 -1
- package/dist/{marketplace-GXSV6QIY.js → marketplace-KW35PJCY.js} +26 -79
- package/dist/marketplace-KW35PJCY.js.map +1 -0
- package/dist/{mcp-XPDWWU75.js → mcp-2HUGVDJ5.js} +33 -37
- package/dist/{mcp-XPDWWU75.js.map → mcp-2HUGVDJ5.js.map} +1 -1
- package/dist/{migrate-SBUIWN3U.js → migrate-6VAPYNXI.js} +93 -34
- package/dist/migrate-6VAPYNXI.js.map +1 -0
- package/dist/notifications-Y7KQCN6K.js +154 -0
- package/dist/notifications-Y7KQCN6K.js.map +1 -0
- package/dist/open-FADABB2S.js +20 -0
- package/dist/{pack-A73LDVOX.js → pack-NTECD3BZ.js} +10 -14
- package/dist/{pack-A73LDVOX.js.map → pack-NTECD3BZ.js.map} +1 -1
- package/dist/plugin-T2YFCYIO.js +47 -0
- package/dist/plugin-from-project-FGX5AHW6.js +15 -0
- package/dist/{policy-6VY3CMSU.js → policy-3FOWB4GR.js} +9 -12
- package/dist/{policy-6VY3CMSU.js.map → policy-3FOWB4GR.js.map} +1 -1
- package/dist/{profile-YCKPMRRU.js → profile-HM3ROXXB.js} +108 -78
- package/dist/profile-HM3ROXXB.js.map +1 -0
- package/dist/{project-KHPPBKPN.js → project-3DTXKMI6.js} +512 -119
- package/dist/project-3DTXKMI6.js.map +1 -0
- package/dist/{resource-IJU3FAN5.js → resource-TZDZAVZ6.js} +55 -45
- package/dist/resource-TZDZAVZ6.js.map +1 -0
- package/dist/status-refresh-worker.js +1155 -0
- package/dist/status-refresh-worker.js.map +1 -0
- package/dist/{version-Z66FWWMQ.js → version-AMZJHJIB.js} +3 -3
- package/dist/version-AMZJHJIB.js.map +1 -0
- package/package.json +16 -11
- package/dist/apply-SUNDXRJ3.js +0 -54
- package/dist/chunk-2A36HWDE.js.map +0 -1
- package/dist/chunk-2H7UOFLK.js +0 -11
- package/dist/chunk-3FS775NP.js.map +0 -1
- package/dist/chunk-43BDGVN3.js.map +0 -1
- package/dist/chunk-4ZQ2SCGY.js.map +0 -1
- package/dist/chunk-6LTLYV5D.js.map +0 -1
- package/dist/chunk-D432JAXV.js.map +0 -1
- package/dist/chunk-DF4Z7LAD.js +0 -3463
- package/dist/chunk-DF4Z7LAD.js.map +0 -1
- package/dist/chunk-EOPFER6N.js.map +0 -1
- package/dist/chunk-G6WKY2W4.js +0 -389
- package/dist/chunk-G6WKY2W4.js.map +0 -1
- package/dist/chunk-IE7B6Q5K.js.map +0 -1
- package/dist/chunk-IMROMZ2K.js.map +0 -1
- package/dist/chunk-M2U3J7UX.js +0 -46
- package/dist/chunk-M2U3J7UX.js.map +0 -1
- package/dist/chunk-N3ZCH64F.js.map +0 -1
- package/dist/chunk-NAGAJ5UM.js +0 -145
- package/dist/chunk-NAGAJ5UM.js.map +0 -1
- package/dist/chunk-OML4HXKT.js.map +0 -1
- package/dist/chunk-QA5U36JN.js.map +0 -1
- package/dist/chunk-R7ZOYVN3.js.map +0 -1
- package/dist/chunk-RDG5DT7S.js.map +0 -1
- package/dist/chunk-REHRUNBB.js.map +0 -1
- package/dist/chunk-RFQ3N7FB.js.map +0 -1
- package/dist/chunk-TQ2NA4Z4.js.map +0 -1
- package/dist/chunk-ULCD6DJE.js.map +0 -1
- package/dist/chunk-WG5A6EAU.js.map +0 -1
- package/dist/chunk-XGTTOO4R.js +0 -84
- package/dist/chunk-XGTTOO4R.js.map +0 -1
- package/dist/chunk-XTVGCVU4.js.map +0 -1
- package/dist/chunk-XUJKZQZA.js +0 -235
- package/dist/chunk-XUJKZQZA.js.map +0 -1
- package/dist/chunk-ZUASVASP.js.map +0 -1
- package/dist/doctor-N7ZULPOL.js.map +0 -1
- package/dist/environment-OBB3WU5B.js.map +0 -1
- package/dist/harness-7KYATIV6.js.map +0 -1
- package/dist/help-VXWKLQ6A.js.map +0 -1
- package/dist/live-read-cache-TUSP7U3D.js +0 -10
- package/dist/marketplace-GXSV6QIY.js.map +0 -1
- package/dist/migrate-SBUIWN3U.js.map +0 -1
- package/dist/open-HDGLYYVU.js +0 -24
- package/dist/plugin-CEO6ZJM5.js +0 -51
- package/dist/plugin-from-project-UK7VJVUP.js +0 -18
- package/dist/profile-YCKPMRRU.js.map +0 -1
- package/dist/project-KHPPBKPN.js.map +0 -1
- package/dist/resource-IJU3FAN5.js.map +0 -1
- /package/dist/{apply-SUNDXRJ3.js.map → apply-ZGEAY6YZ.js.map} +0 -0
- /package/dist/{chunk-3P6BWL5F.js.map → chunk-27IPOVKQ.js.map} +0 -0
- /package/dist/{chunk-JQOKQKQT.js.map → chunk-7IBFH736.js.map} +0 -0
- /package/dist/{chunk-P2C7JPLD.js.map → chunk-CKJIS2FM.js.map} +0 -0
- /package/dist/{chunk-U6DXASQP.js.map → chunk-HC7IZY75.js.map} +0 -0
- /package/dist/{chunk-UVVZHWD2.js.map → chunk-I4DKV63E.js.map} +0 -0
- /package/dist/{chunk-PNGF5EV2.js.map → chunk-JEC5PWNH.js.map} +0 -0
- /package/dist/{chunk-2H7UOFLK.js.map → chunk-MKLJBW5N.js.map} +0 -0
- /package/dist/{chunk-BPWFQKI5.js.map → chunk-NIFKCS7J.js.map} +0 -0
- /package/dist/{chunk-7HP6AAI3.js.map → chunk-SMLO5YPI.js.map} +0 -0
- /package/dist/{chunk-73OJQTBW.js.map → chunk-T2JBSRGG.js.map} +0 -0
- /package/dist/{chunk-GRASK6M6.js.map → chunk-ZREU2UHM.js.map} +0 -0
- /package/dist/{chunk-23XSG7LI.js.map → chunk-ZZQDJGWX.js.map} +0 -0
- /package/dist/{live-read-cache-TUSP7U3D.js.map → live-read-cache-BHU6L7MA.js.map} +0 -0
- /package/dist/{open-HDGLYYVU.js.map → live-read-cache-NQU7M2C7.js.map} +0 -0
- /package/dist/{plugin-CEO6ZJM5.js.map → open-FADABB2S.js.map} +0 -0
- /package/dist/{plugin-from-project-UK7VJVUP.js.map → plugin-T2YFCYIO.js.map} +0 -0
- /package/dist/{version-Z66FWWMQ.js.map → plugin-from-project-FGX5AHW6.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/services/migrate-scope.ts","../src/services/migrate.ts","../src/services/resource-import-export.ts","../src/services/order-to-override-migration.ts","../src/services/wizards/migrate-export.ts","../src/services/wizards/migrate-import.ts","../src/cli/commands/migrate.ts"],"sourcesContent":["import { existsSync, statSync } from \"node:fs\";\nimport { extname, join, resolve } from \"node:path\";\nimport { getPlugin, getPluginResources } from \"../models/plugin-model.js\";\nimport type { Plugin } from \"../types.js\";\nimport {\n buildApPackageFiles,\n writeApPackageFiles,\n writeApZipArchive,\n} from \"./agent-plugins/files.js\";\nimport { importApPackageFiles } from \"./agent-plugins/import.js\";\nimport {\n isApEnvelopePath,\n writeApEnvelope,\n} from \"./agent-plugins/envelope.js\";\nimport { slugifyApName } from \"./agent-plugins/name.js\";\nimport { loadVerifiedPackageFiles } from \"./apm-bundle.js\";\nimport {\n isLegacyTomlTransportPath,\n legacyTomlTransportRejection,\n} from \"./legacy-toml-transport.js\";\nimport type { AnyMigrateManifest, MigrateManifest } from \"./migrate.js\";\nimport { exportMigrationState, importMigrationState } from \"./migrate.js\";\nimport { assertPluginsCleanForShare } from \"./plugin-versioning.js\";\nimport {\n exportResourceToFile,\n formatResourceSelector,\n importResourceFromFile,\n} from \"./resource-import-export.js\";\n\nexport type MigrateScope = \"workspace\" | \"plugin\" | \"resource\";\n\nexport interface MigrateExportCliOpts {\n file?: string;\n outputFile?: string;\n workspace?: boolean;\n plugin?: string;\n resource?: string;\n /** Deprecated: rejected by {@link rejectEnvironmentScope}. */\n environment?: string;\n includePlugins?: boolean;\n embedPlugins?: boolean;\n singleFile?: boolean;\n /** Write a .zip of the Agent Plugins package. */\n archive?: boolean;\n /** Also write Copilot files and Codex hook settings. Plugin scope only. */\n vendorExtensions?: boolean;\n onSkip?: (message: string) => void;\n}\n\nexport interface MigrateImportCliOpts {\n file?: string;\n workspace?: boolean;\n plugin?: boolean;\n resource?: boolean;\n /** Deprecated: rejected by {@link rejectEnvironmentScope}. */\n environment?: boolean | string;\n}\n\nexport type WorkspaceExportResult = {\n scope: \"workspace\";\n output: string;\n manifest: MigrateManifest;\n};\n\nexport type PluginExportResult = {\n scope: \"plugin\";\n output: string;\n plugins: string[];\n files: string[];\n};\n\nexport type ResourceExportResult = {\n scope: \"resource\";\n output: string;\n resource: string;\n files: string[];\n};\n\nexport type ScopedExportResult =\n | WorkspaceExportResult\n | PluginExportResult\n | ResourceExportResult;\n\nexport type WorkspaceImportResult = {\n scope: \"workspace\";\n manifest: AnyMigrateManifest;\n plugins_imported: number;\n environments_imported: number;\n};\n\nexport type PluginImportResult = {\n scope: \"plugin\";\n plugin: string;\n plugins: string[];\n resources_imported: number;\n};\n\nexport type ResourceImportResult = {\n scope: \"resource\";\n resource: string;\n action: \"created\" | \"updated\" | \"unchanged\";\n};\n\nexport type ScopedImportResult =\n | WorkspaceImportResult\n | PluginImportResult\n | ResourceImportResult;\n\nfunction countScopeFlags(opts: {\n workspace?: boolean;\n plugin?: string | boolean;\n resource?: string | boolean;\n}): number {\n let count = 0;\n if (opts.workspace) count++;\n if (opts.plugin) count++;\n if (opts.resource) count++;\n return count;\n}\n\nexport function assertExclusiveScopeFlags(opts: {\n workspace?: boolean;\n plugin?: string | boolean;\n resource?: string | boolean;\n}): void {\n if (countScopeFlags(opts) > 1) {\n throw new Error(\"Choose only one of --workspace, --plugin, or --resource.\");\n }\n}\n\nexport function rejectEnvironmentScope(opts: { environment?: string | boolean }): void {\n if (opts.environment) {\n throw new Error(\n \"Environments are no longer exported on their own: they are machine-local \" +\n \"secret references. Use --workspace to back them up with everything else.\",\n );\n }\n}\n\nfunction embedPlugins(opts: MigrateExportCliOpts): boolean {\n return opts.includePlugins ?? opts.embedPlugins ?? false;\n}\n\nfunction resolvePluginOrThrow(selector: string): Plugin {\n const first = selector.split(\",\")[0]?.trim() ?? selector;\n const plugin = getPlugin(first);\n if (!plugin) {\n throw new Error(`Plugin not found: ${first}`);\n }\n return plugin;\n}\n\nexport function resolveExportScope(opts: MigrateExportCliOpts): {\n scope: MigrateScope;\n outputPath: string;\n pluginSelector?: string;\n resourceSelector?: string;\n singleFile: boolean;\n archive: boolean;\n} {\n rejectEnvironmentScope(opts);\n assertExclusiveScopeFlags(opts);\n const outputPath = opts.outputFile ?? opts.file;\n const resolvedExplicit =\n outputPath && outputPath.length > 0 ? resolve(outputPath) : undefined;\n const pathIsZip = resolvedExplicit?.toLowerCase().endsWith(\".zip\") === true;\n const archive = opts.archive === true || pathIsZip;\n if (opts.singleFile === true && archive) {\n throw new Error(\"Choose a package directory, a .zip, or a .ap.json envelope.\");\n }\n const singleFile =\n !archive && (\n opts.singleFile === true\n || (resolvedExplicit != null && isApEnvelopePath(resolvedExplicit))\n );\n\n if (opts.plugin) {\n const firstPlugin = opts.plugin.split(\",\")[0]?.trim() ?? \"plugin\";\n const apName = slugifyApName(firstPlugin);\n const path = resolvedExplicit ?? resolve(\n archive ? `${apName}.zip` : singleFile ? `${apName}.ap.json` : apName,\n );\n return {\n scope: \"plugin\",\n outputPath: path,\n pluginSelector: opts.plugin,\n singleFile,\n archive,\n };\n }\n\n if (opts.resource) {\n const colon = opts.resource.indexOf(\":\");\n const rest = colon === -1 ? opts.resource : opts.resource.slice(colon + 1);\n const name = slugifyApName(rest.split(\"@\")[0] ?? \"export\");\n const path = resolvedExplicit ?? resolve(singleFile ? `${name}.ap.json` : name);\n if (archive) {\n throw new Error(\"Resource export writes a directory or a .ap.json envelope.\");\n }\n return {\n scope: \"resource\",\n outputPath: path,\n resourceSelector: opts.resource,\n singleFile,\n archive: false,\n };\n }\n\n if (opts.workspace) {\n if (!outputPath || outputPath.length === 0) {\n throw new Error(\"Output path is required for workspace export.\");\n }\n return { scope: \"workspace\", outputPath: resolve(outputPath), singleFile: false, archive: false };\n }\n\n if (outputPath && outputPath.length > 0) {\n const resolvedOutput = resolve(outputPath);\n const lower = resolvedOutput.toLowerCase();\n if (lower.endsWith(\".tar.gz\")) {\n return { scope: \"workspace\", outputPath: resolvedOutput, singleFile: false, archive: false };\n }\n if (\n extname(resolvedOutput).toLowerCase() === \".json\"\n && !isApEnvelopePath(resolvedOutput)\n ) {\n return { scope: \"workspace\", outputPath: resolvedOutput, singleFile: false, archive: false };\n }\n }\n\n throw new Error(\n \"Specify export scope: --workspace, --plugin <name>, or --resource <selector>.\",\n );\n}\n\nexport function detectImportScopeFromFile(filePath: string): MigrateScope {\n const resolved = resolve(filePath);\n if (statSync(resolved).isDirectory()) {\n if (!existsSync(join(resolved, \"plugin.json\"))) {\n throw new Error(\n `${resolved} is a directory but has no plugin.json: expected an Agent Plugins package.`,\n );\n }\n return \"plugin\";\n }\n const lower = resolved.toLowerCase();\n if (lower.endsWith(\".tar.gz\")) return \"workspace\";\n if (isApEnvelopePath(resolved) || lower.endsWith(\".zip\")) return \"plugin\";\n if (isLegacyTomlTransportPath(resolved)) {\n throw new Error(legacyTomlTransportRejection(resolved));\n }\n throw new Error(\n `Cannot tell what ${resolved} is. Pass an Agent Plugins package directory, ` +\n \"an .ap.json envelope, or a .tar.gz workspace archive.\",\n );\n}\n\nexport function resolveImportScope(opts: MigrateImportCliOpts): MigrateScope {\n rejectEnvironmentScope(opts);\n assertExclusiveScopeFlags({\n workspace: opts.workspace,\n plugin: opts.plugin,\n resource: opts.resource,\n });\n if (!opts.file || opts.file.length === 0) {\n throw new Error(\"Import file path is required.\");\n }\n\n let scope: MigrateScope;\n if (opts.workspace) {\n scope = \"workspace\";\n } else if (opts.plugin) {\n scope = \"plugin\";\n } else if (opts.resource) {\n scope = \"resource\";\n } else {\n return detectImportScopeFromFile(opts.file);\n }\n\n const detected = detectImportScopeFromFile(opts.file);\n if (detected !== scope) {\n throw new Error(\n `Import file looks like ${detected} data but --${scope} was specified.`,\n );\n }\n return scope;\n}\n\nexport function exportScopedMigration(\n resolved: ReturnType<typeof resolveExportScope>,\n opts: MigrateExportCliOpts,\n): ScopedExportResult {\n const includePlugins = embedPlugins(opts);\n\n switch (resolved.scope) {\n case \"workspace\": {\n const manifest = exportMigrationState({\n outputPath: resolved.outputPath,\n includePlugins,\n ...(opts.onSkip ? { onSkip: opts.onSkip } : {}),\n });\n return {\n scope: \"workspace\",\n output: resolved.outputPath,\n manifest,\n };\n }\n case \"plugin\": {\n if (!resolved.pluginSelector) {\n throw new Error(\"Plugin selector is required for plugin export.\");\n }\n const plugin = resolvePluginOrThrow(resolved.pluginSelector);\n assertPluginsCleanForShare([plugin]);\n const files = buildApPackageFiles(plugin.id, {\n vendorExtensions: opts.vendorExtensions === true,\n });\n let written: string[];\n if (resolved.archive) {\n if (existsSync(resolved.outputPath) && statSync(resolved.outputPath).isDirectory()) {\n throw new Error(\n `Refusing to replace directory ${resolved.outputPath} with a zip archive.`,\n );\n }\n written = writeApZipArchive(files, resolved.outputPath);\n } else if (resolved.singleFile) {\n writeApEnvelope(files, resolved.outputPath);\n written = Object.keys(files).sort();\n } else {\n written = writeApPackageFiles(files, resolved.outputPath);\n }\n return {\n scope: \"plugin\",\n output: resolved.outputPath,\n plugins: [plugin.name],\n files: written,\n };\n }\n case \"resource\": {\n if (!resolved.resourceSelector) {\n throw new Error(\"Resource selector is required for resource export.\");\n }\n const exportDoc = exportResourceToFile(\n resolved.resourceSelector,\n resolved.outputPath,\n { singleFile: resolved.singleFile },\n );\n return {\n scope: \"resource\",\n output: resolved.outputPath,\n resource: formatResourceSelector(exportDoc),\n files: exportDoc.files,\n };\n }\n default: {\n const neverScope: never = resolved.scope;\n throw new Error(`Unsupported export scope: ${neverScope}`);\n }\n }\n}\n\nexport function importScopedMigration(\n scope: MigrateScope,\n filePath: string,\n): ScopedImportResult {\n const resolved = resolve(filePath);\n\n switch (scope) {\n case \"workspace\": {\n const result = importMigrationState({ archivePath: resolved });\n return {\n scope: \"workspace\",\n manifest: result.manifest,\n plugins_imported: result.plugins_imported,\n environments_imported: result.environments_imported,\n };\n }\n case \"plugin\": {\n const files = loadVerifiedPackageFiles(resolved);\n const plugin = importApPackageFiles(files);\n return {\n scope: \"plugin\",\n plugin: plugin.name,\n plugins: [plugin.name],\n resources_imported: getPluginResources(plugin.id).length,\n };\n }\n case \"resource\": {\n const result = importResourceFromFile(resolved);\n return {\n scope: \"resource\",\n resource: formatResourceSelector(result.resource),\n action: result.action,\n };\n }\n default: {\n const neverScope: never = scope;\n throw new Error(`Unsupported import scope: ${neverScope}`);\n }\n }\n}\n","import {\n cpSync,\n existsSync,\n mkdirSync,\n mkdtempSync,\n readFileSync,\n readdirSync,\n rmSync,\n statSync,\n writeFileSync,\n} from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { join, resolve } from \"node:path\";\nimport { execSync } from \"node:child_process\";\nimport { getHarnesstapDir } from \"../db/connection.js\";\nimport { getHarnessPreference, setHarnessPreference } from \"../models/harness.js\";\nimport { listPlugins } from \"../models/plugin-model.js\";\nimport { loadSettings } from \"../config/settings.js\";\nimport type { HarnesstapSettings } from \"../config/settings.js\";\nimport type { HarnessPreference, HarnessSelection } from \"../types.js\";\nimport { registeredFromLegacyParts } from \"./harness-targets.js\";\nimport {\n formatEnvironmentToml,\n importEnvironmentToml,\n listEnvironmentDocuments,\n} from \"./environment-import-export.js\";\nimport { listContainedFiles, assertArchiveMembersContained } from \"../utils/path-containment.js\";\nimport {\n buildApPackageFiles,\n writeApPackageFiles,\n readApPackageFiles,\n} from \"./agent-plugins/files.js\";\nimport { importApPackageFiles } from \"./agent-plugins/import.js\";\nimport { slugifyApName } from \"./agent-plugins/name.js\";\nimport { ManifestValidationError } from \"./agent-plugins/validate.js\";\nimport { skippedInvalidPluginExport } from \"../copy/cli.js\";\nimport {\n envelopeFromFiles,\n parseApEnvelope,\n} from \"./agent-plugins/envelope.js\";\nimport { isLegacyPluginTomlPath } from \"./legacy-toml-transport.js\";\n\nfunction selectionFromArchive(raw: unknown): HarnessSelection {\n const rec = (raw ?? {}) as Record<string, unknown>;\n if (Array.isArray(rec.registered_harnesses)) {\n return {\n registered_harnesses: rec.registered_harnesses.filter(\n (entry): entry is string => typeof entry === \"string\",\n ),\n };\n }\n return {\n registered_harnesses: registeredFromLegacyParts(\n typeof rec.main_harness === \"string\" ? rec.main_harness : null,\n Array.isArray(rec.alias_harnesses)\n ? rec.alias_harnesses.filter((entry): entry is string => typeof entry === \"string\")\n : [],\n ),\n };\n}\n\nexport const MIGRATE_MANIFEST_VERSION_V1 = 1 as const;\nexport const MIGRATE_MANIFEST_VERSION = 2 as const;\n\nexport interface MigrateManifestV1 {\n version: typeof MIGRATE_MANIFEST_VERSION_V1;\n exported_at: string;\n plugin_count: number;\n include_plugins: boolean;\n includes_active_profile: boolean;\n}\n\nexport interface MigrateManifest {\n version: typeof MIGRATE_MANIFEST_VERSION;\n exported_at: string;\n plugin_count: number;\n environment_count: number;\n /** Slugified plugin directory names packed under `plugins/`. */\n plugins: string[];\n include_plugins: boolean;\n includes_active_profile: boolean;\n}\n\nexport type AnyMigrateManifest = MigrateManifestV1 | MigrateManifest;\n\nexport interface MigrateExportOptions {\n outputPath: string;\n includePlugins?: boolean;\n onSkip?: (message: string) => void;\n}\n\nexport interface MigrateImportOptions {\n archivePath: string;\n}\n\nfunction writeJson(path: string, data: unknown): void {\n writeFileSync(path, JSON.stringify(data, null, 2), \"utf-8\");\n}\n\nfunction listArchiveMembers(archivePath: string): string[] {\n const listing = execSync(`tar -tzf \"${archivePath}\"`, {\n encoding: \"utf-8\",\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n });\n return listing\n .split(\"\\n\")\n .map((line) => line.trim())\n .filter((line) => line.length > 0);\n}\n\nfunction extractArchive(archivePath: string, destDir: string): void {\n const resolved = resolve(archivePath);\n if (resolved.endsWith(\".json\") && !resolved.endsWith(\".ap.json\")) {\n mkdirSync(join(destDir, \"state\"), { recursive: true });\n cpSync(resolved, join(destDir, \"state\", \"migrate.json\"));\n return;\n }\n // Reject path-traversal members before write; post-walk only sees files under destDir.\n assertArchiveMembersContained(destDir, listArchiveMembers(resolved));\n execSync(`tar -xzf \"${resolved}\" -C \"${destDir}\"`, { stdio: \"pipe\" });\n // Catch in-tree symlink escapes that resolve outside the destination.\n listContainedFiles(destDir);\n}\n\nfunction createArchive(sourceDir: string, outputPath: string): void {\n const resolved = resolve(outputPath);\n if (resolved.endsWith(\".json\") && !resolved.endsWith(\".ap.json\")) {\n const manifest = readFileSync(join(sourceDir, \"manifest.json\"), \"utf-8\");\n const environmentsDir = join(sourceDir, \"environments\");\n const pluginsDir = join(sourceDir, \"plugins\");\n const plugins: unknown[] = [];\n if (existsSync(pluginsDir)) {\n for (const entry of readdirSync(pluginsDir)) {\n const packageDir = join(pluginsDir, entry);\n if (!statSync(packageDir).isDirectory()) continue;\n if (!existsSync(join(packageDir, \"plugin.json\"))) {\n throw new Error(\n `Archive plugin directory ${entry} is missing plugin.json`,\n );\n }\n plugins.push(envelopeFromFiles(readApPackageFiles(packageDir)));\n }\n }\n const state: Record<string, unknown> = {\n manifest: JSON.parse(manifest) as AnyMigrateManifest,\n harness: existsSync(join(sourceDir, \"harness.json\"))\n ? JSON.parse(readFileSync(join(sourceDir, \"harness.json\"), \"utf-8\"))\n : null,\n config: existsSync(join(sourceDir, \"config.json\"))\n ? JSON.parse(readFileSync(join(sourceDir, \"config.json\"), \"utf-8\"))\n : null,\n active_profile: existsSync(join(sourceDir, \"active-profile.json\"))\n ? JSON.parse(readFileSync(join(sourceDir, \"active-profile.json\"), \"utf-8\"))\n : null,\n plugins,\n };\n if (existsSync(environmentsDir)) {\n state.environments = readdirSync(environmentsDir)\n .filter((f) => f.endsWith(\".toml\"))\n .map((f) => readFileSync(join(environmentsDir, f), \"utf-8\"));\n }\n writeFileSync(resolved, JSON.stringify(state, null, 2), \"utf-8\");\n return;\n }\n execSync(`tar -czf \"${resolved}\" -C \"${sourceDir}\" .`, { stdio: \"pipe\" });\n}\n\nfunction dirnameSafe(path: string): string {\n const idx = path.lastIndexOf(\"/\");\n return idx >= 0 ? path.slice(0, idx) : \".\";\n}\n\nfunction isMigrateManifestV1(manifest: AnyMigrateManifest): manifest is MigrateManifestV1 {\n return manifest.version === MIGRATE_MANIFEST_VERSION_V1;\n}\n\n/**\n * Export all plugins, environments, harness preferences, and config into an archive.\n */\nexport function exportMigrationState(opts: MigrateExportOptions): MigrateManifest {\n const workDir = mkdtempSync(join(tmpdir(), \"harnesstap-migrate-\"));\n const pluginsDir = join(workDir, \"plugins\");\n const environmentsDir = join(workDir, \"environments\");\n mkdirSync(pluginsDir, { recursive: true });\n mkdirSync(environmentsDir, { recursive: true });\n\n const plugins = listPlugins();\n const pluginNames: string[] = [];\n for (const plugin of plugins) {\n const slug = slugifyApName(plugin.name);\n const packageDir = join(pluginsDir, slug);\n try {\n writeApPackageFiles(buildApPackageFiles(plugin.id), packageDir);\n pluginNames.push(slug);\n } catch (error) {\n if (error instanceof ManifestValidationError) {\n opts.onSkip?.(skippedInvalidPluginExport(plugin.name));\n continue;\n }\n throw error;\n }\n }\n\n const environments = listEnvironmentDocuments();\n for (const environment of environments) {\n writeFileSync(\n join(environmentsDir, `${environment.name}.toml`),\n formatEnvironmentToml(environment),\n \"utf-8\",\n );\n }\n\n const harness = getHarnessPreference();\n if (harness) {\n writeJson(join(workDir, \"harness.json\"), harness);\n }\n\n const config = loadSettings(getHarnesstapDir());\n writeJson(join(workDir, \"config.json\"), config);\n const harnesstapDir = getHarnesstapDir();\n const activeProfilePath = join(harnesstapDir, \"active-profile.json\");\n const includesActiveProfile = existsSync(activeProfilePath);\n if (includesActiveProfile) {\n cpSync(activeProfilePath, join(workDir, \"active-profile.json\"));\n }\n\n const manifest: MigrateManifest = {\n version: MIGRATE_MANIFEST_VERSION,\n exported_at: new Date().toISOString(),\n plugin_count: plugins.length,\n environment_count: environments.length,\n plugins: pluginNames,\n include_plugins: opts.includePlugins ?? false,\n includes_active_profile: includesActiveProfile,\n };\n writeJson(join(workDir, \"manifest.json\"), manifest);\n\n mkdirSync(dirnameSafe(resolve(opts.outputPath)), { recursive: true });\n createArchive(workDir, opts.outputPath);\n rmSync(workDir, { recursive: true, force: true });\n\n return manifest;\n}\n\nfunction importEnvironmentsFromDir(environmentsDir: string): number {\n if (!existsSync(environmentsDir)) {\n return 0;\n }\n let imported = 0;\n for (const file of readdirSync(environmentsDir)) {\n if (!file.endsWith(\".toml\")) continue;\n importEnvironmentToml(readFileSync(join(environmentsDir, file), \"utf-8\"));\n imported++;\n }\n return imported;\n}\n\nfunction importPluginsFromDir(pluginsDir: string): number {\n if (!existsSync(pluginsDir)) {\n return 0;\n }\n let imported = 0;\n for (const entry of readdirSync(pluginsDir)) {\n const packageDir = join(pluginsDir, entry);\n if (!statSync(packageDir).isDirectory()) {\n if (isLegacyPluginTomlPath(entry) || entry.endsWith(\".toml\")) {\n throw new Error(\n \"This archive stores plugins as TOML, which is no longer supported. \" +\n \"Re-export with a current CLI to produce Agent Plugins packages.\",\n );\n }\n continue;\n }\n if (!existsSync(join(packageDir, \"plugin.json\"))) {\n throw new Error(\n `Archive plugin directory ${entry} is missing plugin.json`,\n );\n }\n importApPackageFiles(readApPackageFiles(packageDir));\n imported++;\n }\n return imported;\n}\n\n/**\n * Import a migration archive produced by exportMigrationState.\n */\nexport function importMigrationState(opts: MigrateImportOptions): {\n manifest: AnyMigrateManifest;\n plugins_imported: number;\n environments_imported: number;\n} {\n const workDir = mkdtempSync(join(tmpdir(), \"harnesstap-migrate-import-\"));\n\n try {\n extractArchive(opts.archivePath, workDir);\n\n let manifest: AnyMigrateManifest;\n let pluginsDir: string;\n let environmentsDir: string;\n let harnessPath: string;\n let configPath: string;\n\n if (existsSync(join(workDir, \"state\", \"migrate.json\"))) {\n const state = JSON.parse(\n readFileSync(join(workDir, \"state\", \"migrate.json\"), \"utf-8\"),\n ) as {\n manifest: AnyMigrateManifest;\n harness: HarnessPreference | null;\n config: HarnesstapSettings;\n active_profile: { name?: string } | null;\n plugins: unknown[];\n environments?: string[];\n };\n manifest = state.manifest;\n pluginsDir = join(workDir, \"import-plugins\");\n environmentsDir = join(workDir, \"import-environments\");\n mkdirSync(pluginsDir, { recursive: true });\n mkdirSync(environmentsDir, { recursive: true });\n for (let i = 0; i < state.plugins.length; i++) {\n const packageDir = join(pluginsDir, `plugin-${i}`);\n const envelopeRaw = JSON.stringify(state.plugins[i]);\n const files = parseApEnvelope(envelopeRaw, `archive plugin ${i}`);\n writeApPackageFiles(files, packageDir);\n }\n if (state.environments) {\n for (let i = 0; i < state.environments.length; i++) {\n writeFileSync(\n join(environmentsDir, `environment-${i}.toml`),\n state.environments[i] ?? \"\",\n \"utf-8\",\n );\n }\n }\n if (state.harness) {\n writeJson(join(workDir, \"harness.json\"), state.harness);\n }\n writeJson(join(workDir, \"config.json\"), state.config);\n if (state.active_profile) {\n writeJson(join(workDir, \"active-profile.json\"), state.active_profile);\n }\n harnessPath = join(workDir, \"harness.json\");\n configPath = join(workDir, \"config.json\");\n } else {\n manifest = JSON.parse(\n readFileSync(join(workDir, \"manifest.json\"), \"utf-8\"),\n ) as AnyMigrateManifest;\n pluginsDir = join(workDir, \"plugins\");\n environmentsDir = join(workDir, \"environments\");\n harnessPath = join(workDir, \"harness.json\");\n configPath = join(workDir, \"config.json\");\n }\n const activeProfilePath = join(workDir, \"active-profile.json\");\n\n if (isMigrateManifestV1(manifest)) {\n throw new Error(\n \"This archive uses manifest version 1, which stored plugins as TOML. \" +\n \"Version 1 archives were never released and are not supported.\",\n );\n }\n\n const manifestVersion = manifest.version;\n if (manifestVersion !== MIGRATE_MANIFEST_VERSION) {\n throw new Error(`Unsupported migration manifest version: ${manifestVersion}`);\n }\n\n const pluginsImported = importPluginsFromDir(pluginsDir);\n const environmentsImported = importEnvironmentsFromDir(environmentsDir);\n\n if (existsSync(harnessPath)) {\n const harness = JSON.parse(\n readFileSync(harnessPath, \"utf-8\"),\n ) as HarnessPreference;\n setHarnessPreference(selectionFromArchive(harness));\n }\n\n if (existsSync(configPath)) {\n const config = JSON.parse(\n readFileSync(configPath, \"utf-8\"),\n ) as HarnesstapSettings;\n const targetDir = getHarnesstapDir();\n mkdirSync(targetDir, { recursive: true });\n writeJson(join(targetDir, \"config.json\"), config);\n }\n if (existsSync(activeProfilePath)) {\n const activeProfile = JSON.parse(\n readFileSync(activeProfilePath, \"utf-8\"),\n ) as { name?: string };\n const targetDir = getHarnesstapDir();\n mkdirSync(targetDir, { recursive: true });\n writeJson(join(targetDir, \"active-profile.json\"), activeProfile);\n }\n\n return {\n manifest,\n plugins_imported: pluginsImported,\n environments_imported: environmentsImported,\n };\n } finally {\n rmSync(workDir, { recursive: true, force: true });\n }\n}\n","import { existsSync, statSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { getPluginResources } from \"../models/plugin-model.js\";\nimport { getResource, resolveResource } from \"../models/resource.js\";\nimport type { Resource } from \"../types.js\";\nimport {\n buildApPackageFilesForResource,\n readApPackageFiles,\n writeApPackageFiles,\n} from \"./agent-plugins/files.js\";\nimport {\n isApEnvelopePath,\n readApEnvelope,\n writeApEnvelope,\n} from \"./agent-plugins/envelope.js\";\nimport { importApPackageFiles } from \"./agent-plugins/import.js\";\nimport { isCompositionResourceType } from \"./plugin-composition.js\";\nimport { parseResourceSelector } from \"./resource-selector.js\";\n\nexport interface ResourcePackageExportResult {\n type: Resource[\"type\"];\n name: string;\n description: string;\n content: string;\n metadata: Resource[\"metadata\"];\n namespace: string;\n origin_kind: Resource[\"origin_kind\"];\n origin_ref: string;\n content_hash: string;\n content_blob_ref: string;\n files: string[];\n}\n\nexport function formatResourceSelector(\n resource: Pick<Resource, \"type\" | \"name\" | \"namespace\">,\n): string {\n const namePart = resource.namespace\n ? `${resource.name}@${resource.namespace}`\n : resource.name;\n return `${resource.type}:${namePart}`;\n}\n\nexport function exportResourceToFile(\n selector: string,\n filePath: string,\n options?: { singleFile?: boolean },\n): ResourcePackageExportResult {\n const parsed = parseResourceSelector(selector);\n if (parsed.type && isCompositionResourceType(parsed.type)) {\n throw new Error(\n `Cannot export composition resource type: ${parsed.type}`,\n );\n }\n const resolved = resolveResource(selector);\n if (resolved.status !== \"found\") {\n throw new Error(\n resolved.status === \"ambiguous\"\n ? `Ambiguous resource selector: ${selector}`\n : `Resource not found: ${selector}`,\n );\n }\n if (isCompositionResourceType(resolved.resource.type)) {\n throw new Error(\n `Cannot export composition resource type: ${resolved.resource.type}`,\n );\n }\n const out = resolve(filePath);\n const files = buildApPackageFilesForResource(resolved.resource.id);\n const singleFile = options?.singleFile === true || isApEnvelopePath(out);\n const written = singleFile\n ? (writeApEnvelope(files, out), Object.keys(files).sort())\n : writeApPackageFiles(files, out);\n const { id: _id, created_at: _c, updated_at: _u, source: _s, ...payload } =\n resolved.resource;\n return {\n ...payload,\n files: written,\n };\n}\n\nexport function importResourceFromFile(filePath: string): {\n resource: Resource;\n action: \"created\" | \"updated\" | \"unchanged\";\n} {\n const resolved = resolve(filePath);\n if (!existsSync(resolved)) {\n throw new Error(`Path not found: ${resolved}`);\n }\n const packageFiles = statSync(resolved).isDirectory()\n ? readApPackageFiles(resolved)\n : isApEnvelopePath(resolved)\n ? readApEnvelope(resolved)\n : (() => {\n throw new Error(\n `${resolved} is not an Agent Plugins package directory or .ap.json envelope.`,\n );\n })();\n\n const plugin = importApPackageFiles(packageFiles);\n const resources = getPluginResources(plugin.id);\n const resource = resources[0];\n if (!resource) {\n throw new Error(`Package ${resolved} did not contain any resources.`);\n }\n const stored = getResource(resource.id) ?? resource;\n return {\n resource: stored,\n action: \"created\",\n };\n}\n","import {\n getPluginById,\n getPluginResources,\n listPluginDependencies,\n listPlugins,\n} from \"../models/plugin-model.js\";\nimport { listProjects } from \"../models/project.js\";\nimport { getLatestSnapshot } from \"../models/snapshot.js\";\nimport type { SnapshotState } from \"../types.js\";\nimport { setPluginResourceOverride } from \"./plugin-overrides.js\";\nimport {\n type ResolutionResult,\n resolutionKey,\n resolveComposition,\n} from \"./resolve/index.js\";\n\nexport interface OrderMigrationReport {\n projectsWithSnapshot: number;\n projectsWithoutSnapshot: number;\n overridesWritten: Array<{ root: string; key: string; winner: string }>;\n warnings: string[];\n}\n\nexport interface MigrateOrderToOverridesOptions {\n /** When true, report overrides that would be written without persisting them. */\n dryRun?: boolean;\n}\n\n/**\n * Reproduce previously applied results under nearest-to-root precedence.\n *\n * For every project with a recorded apply snapshot, compare the resource that\n * the old ordered merge materialized against the one resolution now picks. Where\n * they differ, write an explicit `overrides.resources` entry on the root so the\n * applied result is unchanged. Projects with no snapshot get a warning listing\n * the resources whose winner may change.\n */\nexport function migrateOrderToOverrides(\n options: MigrateOrderToOverridesOptions = {},\n): OrderMigrationReport {\n const report: OrderMigrationReport = {\n projectsWithSnapshot: 0,\n projectsWithoutSnapshot: 0,\n overridesWritten: [],\n warnings: [],\n };\n const dryRun = options.dryRun === true;\n\n for (const project of listProjects()) {\n const snapshot = getLatestSnapshot(project.id);\n const state = snapshot?.state as SnapshotState | undefined;\n const rootPlugin = state?.plugins?.[state.plugins.length - 1];\n if (!rootPlugin) {\n report.projectsWithoutSnapshot += 1;\n continue;\n }\n report.projectsWithSnapshot += 1;\n\n let resolution: ResolutionResult;\n try {\n resolution = resolveComposition({ rootSelectors: [rootPlugin.name] });\n } catch {\n report.warnings.push(\n `${project.name}: ${rootPlugin.name} no longer resolves; run ` +\n `\\`ht plugin apply ${rootPlugin.name} --explain\\` to inspect.`,\n );\n continue;\n }\n\n const previousWinnerByKey = new Map<string, string>();\n for (const resource of state?.resources ?? []) {\n const owner = ownerPluginName(resource.id, resolution.selected);\n if (owner) {\n previousWinnerByKey.set(resolutionKey(resource), owner);\n }\n }\n\n for (const decision of resolution.decisions) {\n const previous = previousWinnerByKey.get(decision.key);\n if (!previous || previous === decision.winner.pluginName) continue;\n if (!dryRun) {\n setPluginResourceOverride(resolution.root.pluginId, decision.key, previous);\n }\n report.overridesWritten.push({\n root: resolution.root.name,\n key: decision.key,\n winner: previous,\n });\n }\n }\n\n // Projects with no snapshot: name the resources whose winner may change.\n if (report.projectsWithoutSnapshot > 0) {\n for (const project of listProjects()) {\n if (getLatestSnapshot(project.id)) continue;\n const contested = collectContestedKeys();\n if (contested.keys.length > 0) {\n report.warnings.push(\n `${project.name}: no apply snapshot recorded, so previous winners are unknown. ` +\n `Contested: ${contested.keys.join(\", \")}. ` +\n `Run \\`ht plugin apply ${contested.explainRoot} --explain\\` to inspect.`,\n );\n } else {\n report.warnings.push(\n `${project.name}: no apply snapshot recorded, so previous winners are unknown.`,\n );\n }\n }\n }\n\n return report;\n}\n\nfunction collectContestedKeys(): { keys: string[]; explainRoot: string } {\n const keys: string[] = [];\n let explainRoot = \"<root>\";\n for (const plugin of listPlugins()) {\n if (listPluginDependencies(plugin.id).length === 0) continue;\n try {\n const resolution = resolveComposition({ rootSelectors: [plugin.name] });\n for (const decision of resolution.decisions) {\n if (decision.losers.length === 0) continue;\n if (!keys.includes(decision.key)) {\n keys.push(decision.key);\n }\n }\n if (explainRoot === \"<root>\") {\n explainRoot = plugin.name;\n }\n } catch {\n // Skip plugins that no longer resolve; the project-level warning still fires.\n }\n }\n return { keys, explainRoot };\n}\n\nfunction ownerPluginName(\n resourceId: string,\n selected: ReturnType<typeof resolveComposition>[\"selected\"],\n): string | undefined {\n for (const frame of selected) {\n const plugin = getPluginById(frame.pluginId);\n if (!plugin) continue;\n if (getPluginResources(plugin.id).some((resource) => resource.id === resourceId)) {\n return plugin.name;\n }\n }\n return undefined;\n}\n","import inquirer from \"inquirer\";\nimport { listResources } from \"../../models/resource.js\";\nimport { toPluginChoices } from \"../completion/choices.js\";\nimport type { MigrateScope } from \"../migrate-scope.js\";\nimport { isCompositionResourceType } from \"../plugin-composition.js\";\nimport { slugifyApName } from \"../agent-plugins/name.js\";\nimport {\n formatResourceSelectionLabel,\n sortResourcesByUpdatedAt,\n toResourceListRows,\n} from \"../../ui/resource-list-render.js\";\nimport { promptForSearchableChoice, promptForValue } from \"./shared.js\";\n\nexport type MigrateExportWizardResult = {\n scope: MigrateScope;\n outputPath: string;\n plugin?: string;\n resource?: string;\n embedPlugins?: boolean;\n singleFile?: boolean;\n};\n\nexport async function runMigrateExportWizard(): Promise<MigrateExportWizardResult> {\n const { scope } = await inquirer.prompt<{ scope: MigrateScope }>([\n {\n type: \"list\",\n name: \"scope\",\n message: \"What should be exported?\",\n choices: [\n { name: \"Workspace (full local library)\", value: \"workspace\" },\n { name: \"Plugin\", value: \"plugin\" },\n { name: \"Resource\", value: \"resource\" },\n ],\n },\n ]);\n\n if (scope === \"plugin\") {\n const choices = toPluginChoices();\n const plugin = choices.length > 0\n ? await promptForSearchableChoice({ message: \"Which plugin?\", choices })\n : await promptForValue({ message: \"Plugin name or ID\" });\n const firstPlugin = plugin.split(\",\")[0]?.trim() ?? \"plugin\";\n const apName = slugifyApName(firstPlugin);\n const { singleFile } = await inquirer.prompt<{ singleFile: boolean }>([\n {\n type: \"confirm\",\n name: \"singleFile\",\n message: \"Write a single .ap.json envelope?\",\n default: false,\n },\n ]);\n const outputPath = await promptForValue({\n message: \"Output path\",\n default: singleFile ? `./${apName}.ap.json` : `./${apName}`,\n });\n return { scope, plugin, outputPath, singleFile };\n }\n\n if (scope === \"resource\") {\n const resources = sortResourcesByUpdatedAt(\n toResourceListRows(listResources()).filter(\n (resource) => !isCompositionResourceType(resource.type),\n ),\n );\n if (resources.length === 0) {\n throw new Error(\n \"No exportable resources in workspace. Scan or create resources first.\",\n );\n }\n const choices = resources.map((resource) => ({\n name: formatResourceSelectionLabel(resource),\n value: `${resource.type}:${resource.name}${resource.namespace ? `@${resource.namespace}` : \"\"}`,\n }));\n const resource = await promptForSearchableChoice({\n message: \"Which resource?\",\n choices,\n });\n const rest = resource.split(\":\")[1] ?? \"resource\";\n const name = slugifyApName(rest.split(\"@\")[0] ?? \"resource\");\n const { singleFile } = await inquirer.prompt<{ singleFile: boolean }>([\n {\n type: \"confirm\",\n name: \"singleFile\",\n message: \"Write a single .ap.json envelope?\",\n default: false,\n },\n ]);\n const outputPath = await promptForValue({\n message: \"Output path\",\n default: singleFile ? `./${name}.ap.json` : `./${name}`,\n });\n return { scope, resource, outputPath, singleFile };\n }\n\n const outputPath = await promptForValue({\n message: \"Output archive path\",\n default: \"./harnesstap-backup.tar.gz\",\n });\n const { embed } = await inquirer.prompt<{ embed: boolean }>([\n {\n type: \"confirm\",\n name: \"embed\",\n message: \"Embed plugin trees in plugin exports?\",\n default: false,\n },\n ]);\n return { scope, outputPath, embedPlugins: embed };\n}\n","import {\n detectImportScopeFromFile,\n type MigrateScope,\n} from \"../migrate-scope.js\";\nimport { promptForValue } from \"./shared.js\";\n\nexport async function runMigrateImportWizard(): Promise<{\n file: string;\n scope: MigrateScope;\n}> {\n const file = await promptForValue({ message: \"Import file path\" });\n const scope = detectImportScopeFromFile(file);\n return { file, scope };\n}\n","import type { Command } from \"commander\";\nimport { getDb } from \"../../db/connection.js\";\nimport { initializeSchema } from \"../../db/schema.js\";\nimport {\n exportScopedMigration,\n importScopedMigration,\n resolveExportScope,\n resolveImportScope,\n type ScopedExportResult,\n type ScopedImportResult,\n} from \"../../services/migrate-scope.js\";\nimport {\n migrateOrderToOverrides,\n type OrderMigrationReport,\n} from \"../../services/order-to-override-migration.js\";\nimport { runMigrateExportWizard } from \"../../services/wizards/migrate-export.js\";\nimport { runMigrateImportWizard } from \"../../services/wizards/migrate-import.js\";\nimport { shouldUseWizard } from \"../../services/wizards/shared.js\";\nimport { ui } from \"../../ui/index.js\";\nimport { shortenHomePath } from \"../../utils/home-path.js\";\nimport { parseOutputFormat, printJson } from \"../../utils/output-format.js\";\nimport { formatCount } from \"../formatting.js\";\nimport { configureCommandGroup } from \"../help.js\";\nimport { fail, failCaught } from \"../shared.js\";\n\nfunction printMigrateExportHuman(result: ScopedExportResult): void {\n const output = shortenHomePath(result.output);\n switch (result.scope) {\n case \"workspace\":\n ui.success(\n `Exported migration archive ${ui.icons.hint} ${output} ${ui.icons.bullet} ${result.manifest.plugin_count} plugins, ${result.manifest.environment_count} environments`,\n );\n return;\n case \"plugin\":\n ui.success(\n `Exported plugin ${ui.theme.accent(result.plugins.join(\", \"))} ${ui.icons.hint} ${output}`,\n );\n return;\n case \"resource\":\n ui.success(\n `Exported resource ${ui.theme.accent(result.resource)} ${ui.icons.hint} ${output}`,\n );\n return;\n default: {\n const neverResult: never = result;\n throw new Error(`Unsupported export result: ${String(neverResult)}`);\n }\n }\n}\n\nfunction printMigrateImportHuman(result: ScopedImportResult): void {\n switch (result.scope) {\n case \"workspace\":\n ui.success(\n `Imported migration archive ${ui.icons.bullet} ${formatCount(result.plugins_imported, \"plugin\")}, ${formatCount(result.environments_imported, \"environment\")}`,\n );\n return;\n case \"plugin\":\n ui.success(\n `Imported plugin ${ui.theme.accent(result.plugin)} ${ui.icons.bullet} ${formatCount(result.resources_imported, \"resource\")}`,\n );\n return;\n case \"resource\":\n ui.success(\n `Imported resource ${ui.theme.accent(result.resource)} ${ui.icons.bullet} ${result.action}`,\n );\n return;\n default: {\n const neverResult: never = result;\n throw new Error(`Unsupported import result: ${String(neverResult)}`);\n }\n }\n}\n\nasync function handleMigrateExportCommand(\n file: string | undefined,\n opts: {\n file?: string;\n workspace?: boolean;\n plugin?: string;\n resource?: string;\n environment?: string;\n includePlugins?: boolean;\n embedPlugins?: boolean;\n singleFile?: boolean;\n archive?: boolean;\n vendorExtensions?: boolean;\n format?: string;\n noInteractive?: boolean;\n interactive?: boolean;\n },\n): Promise<void> {\n const db = getDb();\n initializeSchema(db, { allowLegacyRead: true });\n const format = parseOutputFormat(opts.format);\n\n let exportOpts = {\n ...opts,\n file: opts.file ?? file,\n };\n\n const useWizard = shouldUseWizard({\n interactive: opts.interactive,\n noInteractive: opts.noInteractive,\n format: opts.format,\n missingRequiredArgs:\n !exportOpts.file\n && !exportOpts.plugin\n && !exportOpts.resource\n && !exportOpts.environment\n && !exportOpts.workspace,\n });\n\n if (useWizard) {\n const wizard = await runMigrateExportWizard();\n exportOpts = {\n ...exportOpts,\n file: wizard.outputPath,\n workspace: wizard.scope === \"workspace\" ? true : undefined,\n plugin: wizard.plugin,\n resource: wizard.resource,\n includePlugins: wizard.embedPlugins,\n singleFile: wizard.singleFile,\n };\n }\n\n try {\n const resolved = resolveExportScope(exportOpts);\n const result = exportScopedMigration(resolved, {\n ...exportOpts,\n onSkip: (message) => ui.warn(message),\n });\n if (format === \"json\") {\n if (result.scope === \"workspace\") {\n printJson({ ...result.manifest, output: result.output, scope: result.scope });\n return;\n }\n printJson(result);\n return;\n }\n printMigrateExportHuman(result);\n } catch (err) {\n fail(err instanceof Error ? err.message : String(err));\n process.exitCode = 1;\n }\n}\n\nasync function handleMigrateImportCommand(\n file: string | undefined,\n opts: {\n workspace?: boolean;\n plugin?: boolean;\n resource?: boolean;\n environment?: boolean;\n format?: string;\n noInteractive?: boolean;\n interactive?: boolean;\n } = {},\n): Promise<void> {\n const db = getDb();\n initializeSchema(db);\n const format = parseOutputFormat(opts.format);\n\n let importFile = file;\n let scopeOverride: ReturnType<typeof resolveImportScope> | undefined;\n\n const useWizard = shouldUseWizard({\n interactive: opts.interactive,\n noInteractive: opts.noInteractive,\n format: opts.format,\n missingRequiredArgs: !importFile,\n });\n\n if (useWizard) {\n const wizard = await runMigrateImportWizard();\n importFile = wizard.file;\n scopeOverride = wizard.scope;\n }\n\n if (!importFile) {\n fail(\"Import file path is required.\");\n process.exitCode = 1;\n return;\n }\n\n try {\n const scope = scopeOverride ?? resolveImportScope({ ...opts, file: importFile });\n const result = importScopedMigration(scope, importFile);\n if (format === \"json\") {\n printJson(result);\n return;\n }\n printMigrateImportHuman(result);\n } catch (err) {\n failCaught(err);\n }\n}\n\nfunction printMigrateResolveOrderHuman(\n report: OrderMigrationReport,\n dryRun: boolean,\n): void {\n const dryRunSuffix = dryRun ? ` ${ui.icons.bullet} dry-run` : \"\";\n if (report.overridesWritten.length === 0) {\n const aligned =\n report.projectsWithSnapshot > 0\n ? \"Last applied winners already match current resolution. No overrides to write\"\n : \"No apply snapshots to compare. No overrides to write\";\n ui.success(`${aligned}${dryRunSuffix}`);\n } else {\n const overrideCount = formatCount(report.overridesWritten.length, \"override\");\n const projectCount = formatCount(report.projectsWithSnapshot, \"project\");\n const verb = dryRun ? \"Would write\" : \"Wrote\";\n ui.success(\n `${verb} ${overrideCount} across ${projectCount}${dryRunSuffix}`,\n );\n }\n for (const warning of report.warnings) {\n ui.warn(warning);\n }\n}\n\nfunction handleMigrateResolveOrderCommand(opts: {\n dryRun?: boolean;\n format?: string;\n}): void {\n const db = getDb();\n initializeSchema(db, { allowLegacyRead: true });\n const format = parseOutputFormat(opts.format);\n const dryRun = opts.dryRun === true;\n const report = migrateOrderToOverrides({ dryRun });\n if (format === \"json\") {\n printJson(report);\n return;\n }\n printMigrateResolveOrderHuman(report, dryRun);\n}\n\nexport function registerMigrateCommands(root: Command): void {\n const migrateCmd = configureCommandGroup(\n root\n .command(\"migrate\")\n .alias(\"m\")\n .description(\"Export or import workspace, plugins, or resources for offline sharing\"),\n );\n\n migrateCmd\n .command(\"export\")\n .argument(\n \"[file]\",\n \"Output path (package directory, .ap.json envelope, or .tar.gz workspace archive)\",\n )\n .option(\"--workspace\", \"Export full workspace archive\")\n .option(\"--plugin <name>\", \"Export plugin(s); comma-separated names or IDs\")\n .option(\"--resource <selector>\", \"Export one resource (type:name or type:name@namespace)\")\n .option(\n \"--environment <name>\",\n \"Removed: environments are machine-local; use --workspace\",\n )\n .option(\"--single-file\", \"Write a .ap.json envelope instead of a package directory\")\n .option(\"--archive\", \"Write a .zip of the Agent Plugins package\")\n .option(\n \"--vendor-extensions\",\n \"Also write com.github.copilot files and Codex hook settings\",\n )\n .option(\"-o, --file <path>\", \"Output path (overrides positional)\")\n .option(\"--include-plugins\", \"Embed plugin trees (workspace scope)\")\n .option(\"--embed-plugins\", \"Alias for --include-plugins\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .description(\"Export workspace, plugin, or resource for offline sharing\")\n .action(handleMigrateExportCommand);\n\n migrateCmd\n .command(\"import\")\n .argument(\n \"[file]\",\n \"package directory, .ap.json envelope, or .tar.gz workspace archive\",\n )\n .option(\"--workspace\", \"Force workspace archive import\")\n .option(\"--plugin\", \"Force Agent Plugins package import\")\n .option(\"--resource\", \"Force single-resource package import\")\n .option(\n \"--environment\",\n \"Removed: environments are machine-local; use --workspace\",\n )\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .description(\"Import workspace, plugin, or resource from file\")\n .action(handleMigrateImportCommand);\n\n migrateCmd\n .command(\"resolve-order\")\n .option(\"--dry-run\", \"Report what would be written without writing\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .description(\n \"Pin last-applied resource winners as overrides where current resolution would pick a different plugin\",\n )\n .action(handleMigrateResolveOrderCommand);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAAAA,aAAY,YAAAC,iBAAgB;AACrC,SAAS,SAAS,QAAAC,OAAM,WAAAC,gBAAe;;;ACDvC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,cAAc;AACvB,SAAS,MAAM,eAAe;AAC9B,SAAS,gBAAgB;AA6BzB,SAAS,qBAAqB,KAAgC;AAC5D,QAAM,MAAO,OAAO,CAAC;AACrB,MAAI,MAAM,QAAQ,IAAI,oBAAoB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AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,OAAO,iBAAiB,0DAA0D,EAClF,OAAO,aAAa,2CAA2C,EAC/D;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,OAAO,qBAAqB,oCAAoC,EAChE,OAAO,qBAAqB,sCAAsC,EAClE,OAAO,mBAAmB,6BAA6B,EACvD,OAAO,mBAAmB,gCAAgC,OAAO,EACjE,YAAY,2DAA2D,EACvE,OAAO,0BAA0B;AAEpC,aACG,QAAQ,QAAQ,EAChB;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,OAAO,eAAe,gCAAgC,EACtD,OAAO,YAAY,oCAAoC,EACvD,OAAO,cAAc,sCAAsC,EAC3D;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,OAAO,mBAAmB,gCAAgC,OAAO,EACjE,YAAY,iDAAiD,EAC7D,OAAO,0BAA0B;AAEpC,aACG,QAAQ,eAAe,EACvB,OAAO,aAAa,8CAA8C,EAClE,OAAO,mBAAmB,gCAAgC,OAAO,EACjE;AAAA,IACC;AAAA,EACF,EACC,OAAO,gCAAgC;AAC5C;","names":["existsSync","statSync","join","resolve","existsSync","statSync","resolve","resolve","existsSync","statSync","resolve","statSync","existsSync","join","outputPath","resource"]}
|
package/dist/open-HDGLYYVU.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
registerOpenCommand
|
|
3
|
-
} from "./chunk-WGP4GUYZ.js";
|
|
4
|
-
import "./chunk-N3VGY3T3.js";
|
|
5
|
-
import "./chunk-GRASK6M6.js";
|
|
6
|
-
import "./chunk-RDG5DT7S.js";
|
|
7
|
-
import "./chunk-NAGAJ5UM.js";
|
|
8
|
-
import "./chunk-3FS775NP.js";
|
|
9
|
-
import "./chunk-43BDGVN3.js";
|
|
10
|
-
import "./chunk-TQ2NA4Z4.js";
|
|
11
|
-
import "./chunk-RFQ3N7FB.js";
|
|
12
|
-
import "./chunk-ZUASVASP.js";
|
|
13
|
-
import "./chunk-6LTLYV5D.js";
|
|
14
|
-
import "./chunk-N3ZCH64F.js";
|
|
15
|
-
import "./chunk-REHRUNBB.js";
|
|
16
|
-
import "./chunk-2A36HWDE.js";
|
|
17
|
-
import "./chunk-DF4Z7LAD.js";
|
|
18
|
-
import "./chunk-G6WKY2W4.js";
|
|
19
|
-
import "./chunk-73OJQTBW.js";
|
|
20
|
-
import "./chunk-WG5A6EAU.js";
|
|
21
|
-
export {
|
|
22
|
-
registerOpenCommand
|
|
23
|
-
};
|
|
24
|
-
//# sourceMappingURL=open-HDGLYYVU.js.map
|
package/dist/plugin-CEO6ZJM5.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
handleProjectApplyCommand,
|
|
3
|
-
registerDeprecatedLayerAlias,
|
|
4
|
-
registerPluginCommands
|
|
5
|
-
} from "./chunk-QA5U36JN.js";
|
|
6
|
-
import "./chunk-4ZQ2SCGY.js";
|
|
7
|
-
import "./chunk-R7ZOYVN3.js";
|
|
8
|
-
import "./chunk-D432JAXV.js";
|
|
9
|
-
import "./chunk-MR7IOHSX.js";
|
|
10
|
-
import "./chunk-EOPFER6N.js";
|
|
11
|
-
import "./chunk-OML4HXKT.js";
|
|
12
|
-
import "./chunk-XUJKZQZA.js";
|
|
13
|
-
import "./chunk-CHQGE2HF.js";
|
|
14
|
-
import "./chunk-7HP6AAI3.js";
|
|
15
|
-
import "./chunk-ULCD6DJE.js";
|
|
16
|
-
import "./chunk-N3VGY3T3.js";
|
|
17
|
-
import "./chunk-GRASK6M6.js";
|
|
18
|
-
import "./chunk-VZQG2JDV.js";
|
|
19
|
-
import "./chunk-PNGF5EV2.js";
|
|
20
|
-
import "./chunk-P2C7JPLD.js";
|
|
21
|
-
import "./chunk-UVVZHWD2.js";
|
|
22
|
-
import "./chunk-3P6BWL5F.js";
|
|
23
|
-
import "./chunk-KRI4R7EM.js";
|
|
24
|
-
import "./chunk-XGTTOO4R.js";
|
|
25
|
-
import "./chunk-37E5M4JX.js";
|
|
26
|
-
import "./chunk-JQOKQKQT.js";
|
|
27
|
-
import "./chunk-3FIWOI3H.js";
|
|
28
|
-
import "./chunk-RDG5DT7S.js";
|
|
29
|
-
import "./chunk-NAGAJ5UM.js";
|
|
30
|
-
import "./chunk-3FS775NP.js";
|
|
31
|
-
import "./chunk-43BDGVN3.js";
|
|
32
|
-
import "./chunk-BPWFQKI5.js";
|
|
33
|
-
import "./chunk-I6XFZLTJ.js";
|
|
34
|
-
import "./chunk-23XSG7LI.js";
|
|
35
|
-
import "./chunk-TQ2NA4Z4.js";
|
|
36
|
-
import "./chunk-RFQ3N7FB.js";
|
|
37
|
-
import "./chunk-ZUASVASP.js";
|
|
38
|
-
import "./chunk-6LTLYV5D.js";
|
|
39
|
-
import "./chunk-N3ZCH64F.js";
|
|
40
|
-
import "./chunk-REHRUNBB.js";
|
|
41
|
-
import "./chunk-2A36HWDE.js";
|
|
42
|
-
import "./chunk-DF4Z7LAD.js";
|
|
43
|
-
import "./chunk-G6WKY2W4.js";
|
|
44
|
-
import "./chunk-73OJQTBW.js";
|
|
45
|
-
import "./chunk-WG5A6EAU.js";
|
|
46
|
-
export {
|
|
47
|
-
handleProjectApplyCommand,
|
|
48
|
-
registerDeprecatedLayerAlias,
|
|
49
|
-
registerPluginCommands
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=plugin-CEO6ZJM5.js.map
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createPluginFromProject,
|
|
3
|
-
previewPluginFromProject
|
|
4
|
-
} from "./chunk-BPWFQKI5.js";
|
|
5
|
-
import "./chunk-ZUASVASP.js";
|
|
6
|
-
import "./chunk-6LTLYV5D.js";
|
|
7
|
-
import "./chunk-N3ZCH64F.js";
|
|
8
|
-
import "./chunk-REHRUNBB.js";
|
|
9
|
-
import "./chunk-2A36HWDE.js";
|
|
10
|
-
import "./chunk-DF4Z7LAD.js";
|
|
11
|
-
import "./chunk-G6WKY2W4.js";
|
|
12
|
-
import "./chunk-73OJQTBW.js";
|
|
13
|
-
import "./chunk-WG5A6EAU.js";
|
|
14
|
-
export {
|
|
15
|
-
createPluginFromProject,
|
|
16
|
-
previewPluginFromProject
|
|
17
|
-
};
|
|
18
|
-
//# sourceMappingURL=plugin-from-project-UK7VJVUP.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/commands/profile.ts","../src/services/profile-enable-prompt.ts","../src/services/profile-delete-prompt.ts","../src/services/profile-switch.ts","../src/services/profile-use-resolve.ts","../src/cli/handlers/profile-create.ts","../src/services/profile-from-home.ts","../src/services/profile-create.ts"],"sourcesContent":["import { Option, type Command } from \"commander\";\nimport { getDb } from \"../../db/connection.js\";\nimport { initializeSchema } from \"../../db/schema.js\";\nimport { PROFILE_PLUGIN_TAG, isProfilePlugin } from \"../../constants/profile.js\";\nimport { getPlugin, resolvePluginSelector } from \"../../models/plugin-model.js\";\nimport { dryRunStashLine, SWITCH_CHANGES_FLAG_HELP } from \"../../copy/cli.js\";\nimport { listAttachedPluginRefs } from \"../../services/plugin-composition.js\";\nimport { missingRequiredArg } from \"../../services/cli-errors.js\";\nimport { handlePluginListCommand } from \"../../services/plugin-list.js\";\nimport {\n promptMaterializationConflict,\n reportApplyCancelled,\n resolveApplyConflictPolicy,\n} from \"../../services/materialization-conflicts.js\";\nimport {\n deleteProfileCommand,\n listProfilePluginsCommand,\n showProfileCommand,\n useProfileCommand,\n} from \"../../services/profile-commands.js\";\nimport { PinnedPluginInstallConsentError } from \"../../services/plugin-pin-apply.js\";\nimport { detectGlobalProfileStatus } from \"../../services/global-profile-drift.js\";\nimport { maybePromptProfilePluginDelete } from \"../../services/profile-delete-prompt.js\";\nimport { maybeSyncActiveProfileBeforeSwitch } from \"../../services/profile-switch-prompt.js\";\nimport {\n SwitchRestoreFailedError,\n switchProfile,\n} from \"../../services/profile-switch.js\";\nimport {\n applyProfileStashCommand,\n listProfileStashEntries,\n popProfileStashCommand,\n stashProfileCommand,\n} from \"../../services/profile-stash.js\";\nimport { resolveProfileUseSelection } from \"../../services/profile-use-resolve.js\";\nimport {\n executeProjectUse,\n} from \"../../services/project-config-use.js\";\nimport {\n mapProfileUseDelegationOptions,\n renderProjectUseHuman,\n} from \"../../services/use-command.js\";\nimport {\n isPromptCancellationError,\n} from \"../../services/wizards/shared.js\";\nimport type { Plugin } from \"../../types.js\";\nimport { ui } from \"../../ui/index.js\";\nimport { parseOutputFormat, printJson } from \"../../utils/output-format.js\";\nimport { formatCount, formatPluginLabel } from \"../formatting.js\";\nimport { configureCommandGroup } from \"../help.js\";\nimport { handlePluginInstallCommand } from \"../handlers/plugin-install.js\";\nimport {\n countMaterialPluginResources,\n handlePluginPublishCommand,\n} from \"../handlers/plugin-publish.js\";\nimport { handlePluginShowCommand } from \"../handlers/plugin-show-command.js\";\nimport { resolvePluginMutationTarget } from \"../handlers/resolve-plugin-mutation-target.js\";\nimport { CLI_ERRORS, CLI_HINTS, ON_CONFLICT_APPLY_HELP } from \"../messages.js\";\nimport { renderCliError } from \"../runtime.js\";\nimport {\n fail,\n failCaught,\n formatCommand,\n formatHintCommand,\n} from \"../shared.js\";\nimport {\n printApplyDryRun,\n printApplyPayload,\n} from \"../print-apply-summary.js\";\nimport { registerProfileCreateCommand } from \"../handlers/profile-create.js\";\nimport { registerProfileParityCommands } from \"./parity-register.js\";\n\nasync function handleProfilePullCommand(\n selector: string,\n opts: {\n as?: string;\n org?: string;\n catalog?: string;\n version?: string;\n account?: string;\n baseUrl?: string;\n format?: string;\n },\n): Promise<void> {\n const installed = await handlePluginInstallCommand(selector, opts);\n if (!installed || process.exitCode) {\n return;\n }\n\n const installedPlugin = getPlugin(installed.pluginName);\n if (!installedPlugin || isProfilePlugin(installedPlugin)) {\n return;\n }\n\n ui.warn(\n `Installed plugin ${ui.theme.accent(installed.pluginName)} is not tagged as a profile.`,\n );\n}\n\nfunction warnProfilePublishValidation(plugin: Plugin): void {\n const refs = listAttachedPluginRefs(plugin.id);\n const materialCount = countMaterialPluginResources(plugin.id);\n if (refs.length === 0 && materialCount === 0) {\n ui.warn(\n `Profile ${ui.theme.accent(plugin.name)} has no plugin references and no material resources.`,\n );\n }\n\n const unresolvedLocalRefs: string[] = [];\n for (const ref of refs) {\n const local = resolvePluginSelector(\n ref.version_constraint\n ? `${ref.dependency_name}@${ref.version_constraint}`\n : ref.dependency_name,\n );\n if (!local) {\n continue;\n }\n if (!local.org_slug || !local.catalog_slug) {\n unresolvedLocalRefs.push(ref.dependency_name);\n }\n }\n\n if (unresolvedLocalRefs.length > 0) {\n ui.warn(\n `Profile ${ui.theme.accent(plugin.name)} references unpublished local plugins: ${unresolvedLocalRefs.join(\", \")}`,\n );\n }\n}\n\nasync function handleProfilePublishCommand(\n pluginName: string,\n opts: { org?: string; catalog?: string; account?: string; format?: string },\n): Promise<void> {\n const db = getDb();\n initializeSchema(db);\n const plugin = getPlugin(pluginName);\n if (!plugin) {\n process.exitCode = 1;\n fail(`Plugin not found: ${pluginName}`);\n return;\n }\n if (!isProfilePlugin(plugin)) {\n ui.warn(`Plugin \"${plugin.name}\" is not tagged as a profile.`);\n }\n warnProfilePublishValidation(plugin);\n await handlePluginPublishCommand(pluginName, undefined, { ...opts, kind: \"profile\" });\n}\n\nexport function registerProfileCommands(root: Command): void {\n const profileCmd = configureCommandGroup(\n root\n .command(\"profile\")\n .alias(\"p\")\n .description(\"Manage profile plugins and global profile switching\"),\n);\n\nprofileCmd\n .command(\"list\")\n .alias(\"ls\")\n .option(\"-s, --search <query>\", \"Filter by name, description, or tags\")\n .option(\"--remote\", \"Include remote catalog profile plugins\")\n .addOption(new Option(\"--local-only\", \"List only local profile plugins\").hideHelp())\n .option(\"--remote-only\", \"List only remote catalog profile plugins\")\n .option(\"--account <name>\", \"Cloud account to use for remote listing\")\n .option(\"--base-url <url>\", \"HarnessTap Cloud base URL\")\n .option(\"--no-interactive\", \"Disable interactive wizards\")\n .option(\"--interactive\", \"Enable interactive wizards\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .description(\"List local profile plugins (pass --remote to include the catalog)\")\n .action(async (opts: {\n search?: string;\n remote?: boolean;\n localOnly?: boolean;\n remoteOnly?: boolean;\n account?: string;\n baseUrl?: string;\n noInteractive?: boolean;\n interactive?: boolean;\n format?: string;\n }) => {\n const db = getDb();\n initializeSchema(db);\n try {\n await handlePluginListCommand({\n profileMode: true,\n localPluginsProvider: listProfilePluginsCommand,\n tag: PROFILE_PLUGIN_TAG,\n search: opts.search,\n remote: opts.remote,\n localOnly: opts.localOnly,\n remoteOnly: opts.remoteOnly,\n format: parseOutputFormat(opts.format),\n account: opts.account,\n baseUrl: opts.baseUrl,\n noInteractive: opts.noInteractive,\n interactive: opts.interactive,\n });\n } catch (error) {\n if (isPromptCancellationError(error)) {\n process.exitCode = 1;\n return;\n }\n process.exitCode = 1;\n fail(error instanceof Error ? error.message : String(error));\n }\n });\n\nprofileCmd\n .command(\"show\")\n .argument(\"[name]\", \"Profile plugin name or selector\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .option(\"--show-id\", \"Show IDs in list-oriented human tables\")\n .option(\"--interactive\", \"Prompt instead of relying on explicit flags\")\n .description(\"Show profile plugin details, resources, and dependencies\")\n .action(async (\n name: string | undefined,\n opts: {\n format?: string;\n showId?: boolean;\n interactive?: boolean;\n noInteractive?: boolean;\n },\n ) => {\n const db = getDb();\n initializeSchema(db);\n const resolvedName = name ?? await resolvePluginMutationTarget({\n pluginName: name,\n profileMode: true,\n interactive: opts.interactive,\n noInteractive: opts.noInteractive,\n format: opts.format,\n message: \"Which profile do you want to show?\",\n });\n if (!resolvedName) {\n process.exitCode = 1;\n renderCliError(missingRequiredArg(\"name\", \"profile show\"));\n return;\n }\n const payload = showProfileCommand(resolvedName);\n handlePluginShowCommand(formatPluginLabel(payload.profile), opts, {\n active: payload.active,\n });\n });\n\nprofileCmd\n .command(\"status\")\n .option(\"--harness <slugs>\", \"Comma-separated harness slugs (defaults to global harness preference)\")\n .option(\"--depth <mode>\", \"Status scan depth: fast or full\", \"full\")\n .option(\"--project <path>\", \"Project directory for project drift checks\")\n .option(\"--check\", \"Exit with code 1 when global state is out of sync with the active profile\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .description(\"Show the active profile and whether global harness files are in sync\")\n .action(async (opts: {\n harness?: string;\n depth?: string;\n project?: string;\n check?: boolean;\n format?: string;\n }) => {\n const db = getDb();\n initializeSchema(db);\n const format = parseOutputFormat(opts.format);\n const depth = opts.depth === \"fast\" ? \"fast\" : \"full\";\n try {\n const status = await detectGlobalProfileStatus({\n harness: opts.harness,\n depth,\n projectPath: opts.project,\n });\n if (format === \"json\") {\n printJson(status);\n } else if (!status.active_profile) {\n ui.info(\"No active profile set.\");\n } else if (status.warning) {\n ui.warn(status.warning);\n } else if (!status.applied) {\n ui.warn(\n `Active profile ${ui.theme.accent(status.active_profile)} has not been applied globally yet.`,\n );\n ui.hint(\n `Run ${formatHintCommand([\"profile\", \"use\", status.active_profile])} to materialize home harness files.`,\n );\n } else if (!status.has_drift) {\n ui.success(`Global harness files are in sync with profile ${ui.theme.accent(status.active_profile)}.`);\n } else {\n ui.warn(\n `Global harness files are out of sync with profile ${ui.theme.accent(status.active_profile)}.`,\n );\n if (!status.stack_in_sync) {\n ui.dim(\"Profile stack changed since the last global apply.\");\n }\n if (status.changes.length > 0) {\n ui.dim(\n `${formatCount(status.changes.length, \"file\")} ${status.changes.length === 1 ? \"differs\" : \"differ\"} on disk.`,\n );\n for (const change of status.changes) {\n console.log(` ${change.path}`);\n }\n }\n ui.hint(\n `Run ${formatHintCommand([\"profile\", \"use\", status.active_profile])} to refresh global harness files.`,\n );\n }\n\n const collisionCount = status.host_managed?.cursor?.collisions.length ?? 0;\n if (format !== \"json\" && collisionCount > 0) {\n ui.warn(\n `${formatCount(collisionCount, \"Cursor host-managed skill name collision\")} with user or profile skills.`,\n );\n ui.hint(\n \"Cursor built-ins live under ~/.cursor/skills-cursor/ (read-only inventory). User skills belong in ~/.cursor/skills/.\",\n );\n }\n\n if (opts.check && status.has_drift) {\n process.exitCode = 1;\n }\n } catch (err) {\n process.exitCode = 1;\n fail(err instanceof Error ? err.message : String(err));\n }\n });\n\nprofileCmd\n .command(\"use\")\n .argument(\"[name]\", \"Profile plugin name or selector\")\n .option(\"--profile <name>\", \"Profile key from apm.yml\")\n .option(\"--project <path>\", \"Project directory for apm.yml discovery\", \".\")\n .option(\"--dry-run\", \"Show what would be written or removed\")\n .option(\n \"--harness <slugs>\",\n \"Comma-separated harness slugs (defaults to global harness preference)\",\n )\n .option(\n \"--on-conflict <policy>\",\n ON_CONFLICT_APPLY_HELP,\n )\n .option(\n \"--force-remove\",\n \"Also remove user-modified managed files and unmanaged files in the planned removal set\",\n )\n .option(\"--account <name>\", \"Cloud account name for dependency pulls\")\n .option(\"--base-url <url>\", \"Cloud base URL for dependency pulls\")\n .option(\"--no-pull\", \"Do not auto-pull missing published plugin dependencies\")\n .option(\"--force\", \"Apply even when the profile is already active and in sync\")\n .option(\"--no-interactive\", \"Disable interactive prompts\")\n .option(\"--interactive\", \"Enable interactive prompts\")\n .option(\"-y, --yes\", \"Install pinned marketplace plugins without a prompt\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .option(\n \"--changes <action>\",\n SWITCH_CHANGES_FLAG_HELP,\n )\n .description(\"Switch the active profile and apply globally to harness home paths\")\n .action(async (name: string | undefined, 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 forceRemove?: boolean;\n interactive?: boolean;\n noInteractive?: boolean;\n yes?: boolean;\n format?: string;\n changes?: string;\n }) => {\n const db = getDb();\n initializeSchema(db);\n const format = parseOutputFormat(opts.format);\n\n if (!name) {\n try {\n const selection = await resolveProfileUseSelection({\n name,\n profile: opts.profile,\n project: opts.project,\n interactive: opts.interactive,\n noInteractive: opts.noInteractive,\n format: opts.format,\n });\n if (!selection) {\n fail(CLI_ERRORS.missingProfileName, { hint: CLI_HINTS.profileUseExample });\n return;\n }\n if (selection.kind === \"project\") {\n const result = await executeProjectUse(\n mapProfileUseDelegationOptions({ ...opts, profile: selection.profileKey }),\n );\n if (format === \"json\") {\n printJson(result);\n return;\n }\n renderProjectUseHuman(result);\n return;\n }\n name = selection.pluginName;\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n fail(message, {\n hint: message === CLI_ERRORS.missingProfileName ? CLI_HINTS.profileUseExample : undefined,\n });\n return;\n }\n }\n\n const conflictPolicy = resolveApplyConflictPolicy({\n onConflict: opts.onConflict,\n noInteractive: opts.noInteractive ?? format === \"json\",\n });\n try {\n if (!opts.dryRun) {\n const sync = await maybeSyncActiveProfileBeforeSwitch({\n targetProfileName: name,\n harness: opts.harness,\n format,\n changes: opts.changes,\n noInteractive: opts.noInteractive,\n });\n if (sync === \"abort\") {\n process.exitCode = 1;\n return;\n }\n }\n const payload = await useProfileCommand(name, {\n dryRun: opts.dryRun,\n harness: opts.harness,\n pull: opts.pull,\n account: opts.account,\n baseUrl: opts.baseUrl,\n conflictPolicy,\n forceRemove: opts.forceRemove,\n yes: Boolean(opts.yes),\n interactive: opts.noInteractive === true ? false : opts.interactive,\n ...(conflictPolicy === \"prompt\"\n ? { conflictResolver: promptMaterializationConflict }\n : {}),\n });\n if (payload.cancelled) {\n process.exitCode = 1;\n }\n if (format === \"json\") {\n printJson(payload);\n return;\n }\n if (payload.cancelled) {\n reportApplyCancelled(payload.conflicts, \"profile\");\n return;\n }\n if (payload.default_environment_name) {\n ui.info(`Default environment: ${payload.default_environment_name}`);\n }\n if ((payload.pulled_plugins?.length ?? 0) > 0) {\n ui.info(\n `Pulled ${payload.pulled_plugins?.length ?? 0} missing plugin dependencies:`,\n );\n for (const pulled of payload.pulled_plugins ?? []) {\n console.log(` - ${pulled.plugin_name} (${pulled.source})`);\n }\n }\n printApplyPayload(payload);\n } catch (err) {\n process.exitCode = 1;\n if (err instanceof PinnedPluginInstallConsentError) {\n fail(err.message, { hint: err.hint });\n return;\n }\n failCaught(err);\n }\n });\n\nconst stashCmd = profileCmd\n .command(\"stash\")\n .option(\"--dry-run\", \"Show what would be cleared without writing\")\n .option(\n \"--harness <slugs>\",\n \"Comma-separated harness slugs (defaults to global harness preference)\",\n )\n .option(\n \"--on-conflict <policy>\",\n ON_CONFLICT_APPLY_HELP,\n )\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .description(\"Stash untracked on-disk resources for the active profile (like git stash -u)\")\n .action(async (opts: {\n dryRun?: boolean;\n harness?: string;\n onConflict?: string;\n format?: string;\n noInteractive?: boolean;\n }) => {\n const db = getDb();\n initializeSchema(db);\n const format = parseOutputFormat(opts.format);\n const conflictPolicy = resolveApplyConflictPolicy({\n onConflict: opts.onConflict,\n noInteractive: opts.noInteractive ?? format === \"json\",\n });\n try {\n const result = await stashProfileCommand({\n dryRun: opts.dryRun,\n harness: opts.harness,\n conflictPolicy,\n pull: false,\n ...(conflictPolicy === \"prompt\"\n ? { conflictResolver: promptMaterializationConflict }\n : {}),\n });\n if (format === \"json\") {\n printJson(result);\n return;\n }\n const stashCount = result.entry.contents.resources.length;\n if (result.cleared.dry_run) {\n console.log(dryRunStashLine(stashCount, result.entry.profile_name));\n printApplyDryRun({\n wouldWrite: [],\n wouldRemove: result.cleared.removed_files ?? [],\n wouldKeep: [],\n unchanged: 0,\n header: false,\n });\n return;\n }\n ui.success(\n `Stashed ${formatCount(stashCount, \"untracked resource\")} for profile ${ui.theme.accent(result.entry.profile_name)}.`,\n );\n if ((result.cleared.removed_files?.length ?? 0) > 0) {\n ui.dim(`Removed ${formatCount(result.cleared.removed_files?.length ?? 0, \"managed file\")}.`);\n }\n ui.hint(`Restore with ${formatCommand([\"profile\", \"stash\", \"pop\"])}.`);\n } catch (err) {\n process.exitCode = 1;\n fail(err instanceof Error ? err.message : String(err));\n }\n });\n\nstashCmd\n .command(\"list\")\n .alias(\"ls\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .description(\"List stashed profiles\")\n .action((opts: { format?: string }) => {\n const db = getDb();\n initializeSchema(db);\n const format = parseOutputFormat(opts.format);\n const entries = listProfileStashEntries();\n if (format === \"json\") {\n printJson({ entries });\n return;\n }\n if (entries.length === 0) {\n ui.info(\"No stashed profiles.\");\n return;\n }\n for (const [index, entry] of entries.entries()) {\n ui.info(\n `stash@{${index}}: ${ui.theme.accent(entry.profile_name)} (${entry.id})`,\n );\n }\n });\n\nstashCmd\n .command(\"pop\")\n .option(\"--dry-run\", \"Show what would be restored without writing\")\n .option(\n \"--harness <slugs>\",\n \"Comma-separated harness slugs (defaults to global harness preference)\",\n )\n .option(\n \"--on-conflict <policy>\",\n ON_CONFLICT_APPLY_HELP,\n )\n .option(\"--account <name>\", \"Cloud account name for dependency pulls\")\n .option(\"--base-url <url>\", \"Cloud base URL for dependency pulls\")\n .option(\"--no-pull\", \"Do not auto-pull missing published plugin dependencies\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .description(\"Restore the most recent stashed profile and remove it from the stash\")\n .action(async (opts: {\n dryRun?: boolean;\n harness?: string;\n onConflict?: string;\n account?: string;\n baseUrl?: string;\n pull?: boolean;\n format?: string;\n noInteractive?: boolean;\n }) => {\n const db = getDb();\n initializeSchema(db);\n const format = parseOutputFormat(opts.format);\n const conflictPolicy = resolveApplyConflictPolicy({\n onConflict: opts.onConflict,\n noInteractive: opts.noInteractive ?? format === \"json\",\n });\n try {\n const result = await popProfileStashCommand({\n dryRun: opts.dryRun,\n harness: opts.harness,\n pull: opts.pull,\n account: opts.account,\n baseUrl: opts.baseUrl,\n conflictPolicy,\n ...(conflictPolicy === \"prompt\"\n ? { conflictResolver: promptMaterializationConflict }\n : {}),\n });\n if (format === \"json\") {\n printJson(result);\n return;\n }\n if (result.restored.cancelled) {\n process.exitCode = 1;\n ui.warn(\"Profile restore cancelled.\");\n return;\n }\n const dryPrefix = result.restored.dry_run ? `${ui.theme.muted(\"[dry run] \")} ` : \"\";\n ui.success(\n `${dryPrefix}Restored stashed profile ${ui.theme.accent(result.entry.profile_name)}.`,\n );\n } catch (err) {\n process.exitCode = 1;\n fail(err instanceof Error ? err.message : String(err));\n }\n });\n\nstashCmd\n .command(\"apply\")\n .option(\"--dry-run\", \"Show what would be restored without writing\")\n .option(\n \"--harness <slugs>\",\n \"Comma-separated harness slugs (defaults to global harness preference)\",\n )\n .option(\n \"--on-conflict <policy>\",\n ON_CONFLICT_APPLY_HELP,\n )\n .option(\"--account <name>\", \"Cloud account name for dependency pulls\")\n .option(\"--base-url <url>\", \"Cloud base URL for dependency pulls\")\n .option(\"--no-pull\", \"Do not auto-pull missing published plugin dependencies\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .description(\"Restore the most recent stashed profile without removing it from the stash\")\n .action(async (opts: {\n dryRun?: boolean;\n harness?: string;\n onConflict?: string;\n account?: string;\n baseUrl?: string;\n pull?: boolean;\n format?: string;\n noInteractive?: boolean;\n }) => {\n const db = getDb();\n initializeSchema(db);\n const format = parseOutputFormat(opts.format);\n const conflictPolicy = resolveApplyConflictPolicy({\n onConflict: opts.onConflict,\n noInteractive: opts.noInteractive ?? format === \"json\",\n });\n try {\n const result = await applyProfileStashCommand({\n dryRun: opts.dryRun,\n harness: opts.harness,\n pull: opts.pull,\n account: opts.account,\n baseUrl: opts.baseUrl,\n conflictPolicy,\n ...(conflictPolicy === \"prompt\"\n ? { conflictResolver: promptMaterializationConflict }\n : {}),\n });\n if (format === \"json\") {\n printJson(result);\n return;\n }\n if (result.restored.cancelled) {\n process.exitCode = 1;\n ui.warn(\"Profile restore cancelled.\");\n return;\n }\n if (result.restored.dry_run) {\n printApplyDryRun({\n wouldWrite: result.restored.restored_files,\n wouldRemove: [],\n wouldKeep: [],\n unchanged: 0,\n });\n return;\n }\n ui.success(\n `Applied stashed profile ${ui.theme.accent(result.entry.profile_name)}.`,\n );\n } catch (err) {\n process.exitCode = 1;\n fail(err instanceof Error ? err.message : String(err));\n }\n });\n\nprofileCmd\n .command(\"switch\")\n .argument(\"<name>\", \"Profile plugin name or selector\")\n .option(\"--dry-run\", \"Show what would be written or removed\")\n .option(\n \"--harness <slugs>\",\n \"Comma-separated harness slugs (defaults to global harness preference)\",\n )\n .option(\n \"--on-conflict <policy>\",\n ON_CONFLICT_APPLY_HELP,\n )\n .option(\n \"--force-remove\",\n \"Also remove user-modified managed files and unmanaged files in the planned removal set\",\n )\n .option(\"--account <name>\", \"Cloud account name for dependency pulls\")\n .option(\"--base-url <url>\", \"Cloud base URL for dependency pulls\")\n .option(\"--no-pull\", \"Do not auto-pull missing published plugin dependencies\")\n .option(\"--no-interactive\", \"Disable interactive prompts\")\n .option(\"--interactive\", \"Enable interactive prompts\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .option(\n \"--changes <action>\",\n SWITCH_CHANGES_FLAG_HELP,\n )\n .description(\"Switch the active profile and restore the previous one on failure\")\n .action(async (name: string, opts: {\n dryRun?: boolean;\n harness?: string;\n onConflict?: string;\n forceRemove?: boolean;\n account?: string;\n baseUrl?: string;\n pull?: boolean;\n interactive?: boolean;\n noInteractive?: boolean;\n format?: string;\n changes?: string;\n }) => {\n const db = getDb();\n initializeSchema(db);\n const format = parseOutputFormat(opts.format);\n const conflictPolicy = resolveApplyConflictPolicy({\n onConflict: opts.onConflict,\n noInteractive: opts.noInteractive ?? format === \"json\",\n });\n try {\n if (!opts.dryRun) {\n const sync = await maybeSyncActiveProfileBeforeSwitch({\n targetProfileName: name,\n harness: opts.harness,\n format,\n changes: opts.changes,\n noInteractive: opts.noInteractive,\n });\n if (sync === \"abort\") {\n process.exitCode = 1;\n return;\n }\n }\n const result = await switchProfile(name, {\n apply: {\n dryRun: opts.dryRun,\n harness: opts.harness,\n pull: opts.pull,\n account: opts.account,\n baseUrl: opts.baseUrl,\n conflictPolicy,\n forceRemove: opts.forceRemove,\n ...(conflictPolicy === \"prompt\"\n ? { conflictResolver: promptMaterializationConflict }\n : {}),\n },\n });\n if (format === \"json\") {\n printJson(result);\n return;\n }\n if (result.cancelled) {\n process.exitCode = 1;\n ui.warn(\"Profile switch cancelled.\");\n return;\n }\n if (!result.ok) {\n process.exitCode = 1;\n fail(`Failed to switch to profile ${ui.theme.accent(name)}: ${result.apply_error}`);\n ui.info(\n `Restored previous profile ${ui.theme.accent(result.restored.profile_name)}.`,\n );\n return;\n }\n if (result.apply.default_environment_name && !result.apply.dry_run) {\n ui.info(`Default environment: ${result.apply.default_environment_name}`);\n }\n printApplyPayload(result.apply);\n } catch (err) {\n process.exitCode = 1;\n if (err instanceof SwitchRestoreFailedError) {\n fail(err.message);\n return;\n }\n fail(err instanceof Error ? err.message : String(err));\n }\n });\n\n registerProfileCreateCommand(profileCmd);\n\nprofileCmd\n .command(\"delete\")\n .argument(\"<name>\", \"Profile plugin name or selector\")\n .option(\"--plugin\", \"Also delete the underlying plugin without prompting\")\n .option(\"-y, --yes\", \"Skip the interactive plugin delete prompt\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .description(\"Demote a profile plugin and optionally delete the underlying plugin\")\n .action(async (name: string, opts: {\n plugin?: boolean;\n yes?: boolean;\n format?: string;\n }) => {\n const db = getDb();\n initializeSchema(db);\n const format = parseOutputFormat(opts.format);\n try {\n const demoted = deleteProfileCommand(name);\n let pluginDeleted = false;\n if (opts.plugin || format === \"human\") {\n pluginDeleted = await maybePromptProfilePluginDelete({\n pluginName: demoted.plugin_name,\n pluginId: demoted.plugin_id,\n format: opts.format,\n yes: opts.yes,\n deletePluginFlag: opts.plugin,\n });\n }\n\n if (format === \"json\") {\n printJson({\n ...demoted,\n plugin_deleted: pluginDeleted,\n });\n return;\n }\n\n ui.success(`Demoted profile ${ui.theme.accent(demoted.plugin_name)}`);\n if (demoted.was_active) {\n ui.info(\"Cleared active profile pointer.\");\n }\n if (pluginDeleted) {\n ui.success(`Deleted plugin ${ui.theme.accent(demoted.plugin_name)}`);\n }\n } catch (err) {\n process.exitCode = 1;\n if (isPromptCancellationError(err)) {\n ui.info(\"Operation cancelled.\");\n return;\n }\n fail(err instanceof Error ? err.message : String(err));\n }\n });\n\nprofileCmd\n .command(\"pull\")\n .argument(\"<selector>\", \"Catalog profile selector\")\n .option(\"--as <name>\", \"Install as local plugin name\")\n .option(\"--org <slug>\", \"Organization slug helper for short selectors\")\n .option(\"--catalog <slug>\", \"Catalog slug helper for short selectors\")\n .option(\"--version <version>\", \"Plugin version helper for short selectors\")\n .option(\"--account <name>\", \"Cloud account name\")\n .option(\"--base-url <url>\", \"Cloud base URL\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .description(\"Pull a profile plugin from catalog\")\n .action(async (selector: string, opts: {\n as?: string;\n org?: string;\n catalog?: string;\n version?: string;\n account?: string;\n baseUrl?: string;\n format?: string;\n }) => {\n await handleProfilePullCommand(selector, opts);\n });\n\nprofileCmd\n .command(\"publish\")\n .argument(\"<name>\", \"Profile plugin name\")\n .option(\"--org <slug>\", \"Organization slug\")\n .option(\"--catalog <slug>\", \"Catalog slug\")\n .option(\"--account <name>\", \"Cloud account name\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .description(\"Publish a profile plugin with validation warnings\")\n .action(async (name: string, opts: {\n org?: string;\n catalog?: string;\n account?: string;\n format?: string;\n }) => {\n await handleProfilePublishCommand(name, opts);\n });\n\n registerProfileParityCommands(profileCmd);\n}\n","import { printApplyPayload } from \"../cli/print-apply-summary.js\";\nimport { formatHtArgs } from \"../copy/cli.js\";\nimport { ui } from \"../ui/index.js\";\nimport { detectGlobalProfileStatus } from \"./global-profile-drift.js\";\nimport { useProfileCommand } from \"./profile-commands.js\";\nimport { maybeSyncActiveProfileBeforeSwitch } from \"./profile-switch-prompt.js\";\nimport { promptForConfirmation } from \"./wizards/shared.js\";\nimport {\n promptMaterializationConflict,\n reportApplyCancelled,\n resolveApplyConflictPolicy,\n} from \"./materialization-conflicts.js\";\n\nexport function shouldPromptProfileEnable(input: {\n yes?: boolean;\n format?: string;\n}): boolean {\n if (input.yes || input.format === \"json\") {\n return false;\n }\n if (\n process.argv.includes(\"--no-interactive\")\n || process.env.HARNESSTAP_NO_INTERACTIVE === \"1\"\n ) {\n return false;\n }\n\n const ciValue = process.env.CI?.trim().toLowerCase();\n const ciEnabled = Boolean(\n ciValue && ciValue !== \"0\" && ciValue !== \"false\" && ciValue !== \"no\",\n );\n if (ciEnabled) {\n return false;\n }\n\n return Boolean(\n process.env.HARNESSTAP_FORCE_WIZARD === \"1\"\n || (process.stdin.isTTY && process.stdout.isTTY),\n );\n}\n\nexport async function maybePromptProfileEnable(input: {\n profileName: string;\n format?: string;\n yes?: boolean;\n harness?: string;\n pull?: boolean;\n account?: string;\n baseUrl?: string;\n onConflictUse?: string;\n}): Promise<void> {\n const format = input.format ?? \"human\";\n if (format !== \"human\") {\n return;\n }\n\n const status = await detectGlobalProfileStatus({ harness: input.harness });\n if (status.active_profile === input.profileName && !status.has_drift) {\n ui.success(\n `Profile ${ui.theme.accent(input.profileName)} is already active and in sync globally.`,\n );\n return;\n }\n\n if (!shouldPromptProfileEnable({ yes: input.yes, format })) {\n if (status.active_profile === input.profileName) {\n ui.hint(`Run ${formatHtArgs([\"profile\", \"use\", input.profileName])} to apply globally.`);\n return;\n }\n ui.hint(\n `Switch to it with ${formatHtArgs([\"profile\", \"use\", input.profileName])} or ${formatHtArgs([input.profileName])}`,\n );\n return;\n }\n\n const message = status.active_profile === input.profileName\n ? `Apply profile ${input.profileName} to your global harness files now?`\n : `Enable profile ${input.profileName} globally and set it as active?`;\n\n const confirmed = await promptForConfirmation({\n message,\n default: true,\n });\n\n if (!confirmed) {\n ui.hint(\n `Switch later with ${formatHtArgs([\"profile\", \"use\", input.profileName])} or ${formatHtArgs([input.profileName])}`,\n );\n return;\n }\n\n if (\n status.active_profile\n && status.active_profile !== input.profileName\n ) {\n const sync = await maybeSyncActiveProfileBeforeSwitch({\n targetProfileName: input.profileName,\n harness: input.harness,\n yes: input.yes,\n format,\n });\n if (sync === \"abort\") {\n return;\n }\n }\n\n const conflictPolicy = resolveApplyConflictPolicy({\n onConflict: input.onConflictUse,\n });\n const applied = await useProfileCommand(input.profileName, {\n harness: input.harness,\n pull: input.pull,\n account: input.account,\n baseUrl: input.baseUrl,\n conflictPolicy,\n ...(conflictPolicy === \"prompt\"\n ? { conflictResolver: promptMaterializationConflict }\n : {}),\n });\n\n if (applied.cancelled) {\n reportApplyCancelled(applied.conflicts, \"profile\");\n return;\n }\n\n printApplyPayload(applied);\n}\n","import { formatHtArgs } from \"../copy/cli.js\";\nimport { deletePlugin } from \"../models/plugin-model.js\";\nimport { ui } from \"../ui/index.js\";\nimport { promptForConfirmation } from \"./wizards/shared.js\";\nimport { shouldPromptProfileEnable } from \"./profile-enable-prompt.js\";\n\nexport async function maybePromptProfilePluginDelete(input: {\n pluginName: string;\n pluginId: string;\n format?: string;\n yes?: boolean;\n deletePluginFlag?: boolean;\n}): Promise<boolean> {\n if (input.deletePluginFlag) {\n if (!deletePlugin(input.pluginId)) {\n throw new Error(`Failed to delete plugin ${input.pluginName}`);\n }\n return true;\n }\n\n const format = input.format ?? \"human\";\n if (format !== \"human\") {\n return false;\n }\n\n if (!shouldPromptProfileEnable({ yes: input.yes, format })) {\n ui.hint(\n `Plugin ${ui.theme.accent(input.pluginName)} was kept. Delete with ${formatHtArgs([\"plugin\", \"delete\", input.pluginName])}`,\n );\n return false;\n }\n\n const confirmed = await promptForConfirmation({\n message: `Also delete plugin ${input.pluginName}?`,\n default: false,\n });\n\n if (!confirmed) {\n ui.hint(\n `Plugin ${ui.theme.accent(input.pluginName)} was kept. Delete with ${formatHtArgs([\"plugin\", \"delete\", input.pluginName])}`,\n );\n return false;\n }\n\n if (!deletePlugin(input.pluginId)) {\n throw new Error(`Failed to delete plugin ${input.pluginName}`);\n }\n return true;\n}\n","import { ui } from \"../ui/index.js\";\nimport { getActiveProfileName } from \"./active-profile.js\";\nimport type { ApplyProfilePluginOptions, ApplyProfilePluginResult } from \"./profile-apply.js\";\nimport { withProfileApplyLock } from \"./profile-apply-lock.js\";\nimport { clearLiveReadCaches } from \"./live-read-cache.js\";\nimport { useProfileCommandUnlocked } from \"./profile-commands.js\";\n\nexport type ProfileSwitchStep =\n | \"validate_baseline\"\n | \"apply_home\"\n | \"apply_project\"\n | \"restore_previous\"\n | \"complete\";\n\nexport type ProfileSwitchStepStatus = \"started\" | \"completed\" | \"failed\" | \"cancelled\";\n\nexport interface ProfileSwitchStepEvent {\n step: ProfileSwitchStep;\n status: ProfileSwitchStepStatus;\n profile_name?: string;\n error?: string;\n}\n\nconst WRITE_WINDOW_STEPS = new Set<ProfileSwitchStep>([\n \"apply_home\",\n \"restore_previous\",\n]);\n\nexport function isProfileSwitchCancelAllowed(\n events: readonly ProfileSwitchStepEvent[],\n): boolean {\n for (let index = events.length - 1; index >= 0; index -= 1) {\n const event = events[index];\n if (!event || !WRITE_WINDOW_STEPS.has(event.step)) {\n continue;\n }\n return event.status !== \"started\";\n }\n return true;\n}\n\nexport const PROFILE_SWITCH_CANCEL_DISABLED_MESSAGE =\n \"Cancel is disabled while an apply step is running\";\n\nexport const PROFILE_SWITCH_SIGINT_HINT =\n \"Ctrl-C cancels before apply starts; it is ignored while files are being written.\";\n\nfunction isSigintCancelAllowed(events: readonly ProfileSwitchStepEvent[]): boolean {\n return !events.some(\n (event) => event.step === \"apply_home\" && event.status === \"started\",\n );\n}\n\nfunction cliArgvRequestsJson(argv: readonly string[]): boolean {\n const formatIndex = argv.findIndex((arg) => arg === \"--format\" || arg === \"-f\");\n if (formatIndex >= 0) {\n return (argv[formatIndex + 1] ?? \"\").toLowerCase() === \"json\";\n }\n return argv.some(\n (arg) => arg === \"--format=json\" || arg === \"-f=json\",\n );\n}\n\nfunction installProfileSwitchSigint(events: ProfileSwitchStepEvent[]): {\n isCancelled: () => boolean;\n uninstall: () => void;\n} {\n let cancelled = false;\n const onSigint = (): void => {\n if (!isSigintCancelAllowed(events)) {\n process.stderr.write(`${PROFILE_SWITCH_CANCEL_DISABLED_MESSAGE}\\n`);\n return;\n }\n cancelled = true;\n };\n process.on(\"SIGINT\", onSigint);\n if (!cliArgvRequestsJson(process.argv)) {\n ui.hint(PROFILE_SWITCH_SIGINT_HINT);\n }\n return {\n isCancelled: () => cancelled,\n uninstall: () => {\n process.off(\"SIGINT\", onSigint);\n },\n };\n}\n\nexport type ProfileSwitchStepListener = (event: ProfileSwitchStepEvent) => void;\n\nexport interface SwitchProfileOptions {\n apply: ApplyProfilePluginOptions;\n onStep?: ProfileSwitchStepListener;\n isCancelled?: () => boolean;\n useProfile?: typeof useProfileCommandUnlocked;\n}\n\nexport interface SwitchProfileSuccess {\n ok: true;\n cancelled: false;\n previous_profile: string | null;\n apply: ApplyProfilePluginResult;\n events: ProfileSwitchStepEvent[];\n}\n\nexport interface SwitchProfileCancelled {\n ok: false;\n cancelled: true;\n previous_profile: string | null;\n events: ProfileSwitchStepEvent[];\n}\n\nexport interface SwitchProfileFailed {\n ok: false;\n cancelled: false;\n previous_profile: string | null;\n apply_error: string;\n restored: ApplyProfilePluginResult;\n events: ProfileSwitchStepEvent[];\n}\n\nexport type SwitchProfileResult =\n | SwitchProfileSuccess\n | SwitchProfileCancelled\n | SwitchProfileFailed;\n\nexport class SwitchRestoreFailedError extends Error {\n readonly targetProfile: string;\n readonly previousProfile: string;\n readonly applyError: string;\n readonly restoreError: string;\n\n constructor(input: {\n targetProfile: string;\n previousProfile: string;\n applyError: string;\n restoreError: string;\n }) {\n super(\n `Failed to switch to profile \"${input.targetProfile}\" and could not restore \"${input.previousProfile}\".`,\n );\n this.name = \"SwitchRestoreFailed\";\n this.targetProfile = input.targetProfile;\n this.previousProfile = input.previousProfile;\n this.applyError = input.applyError;\n this.restoreError = input.restoreError;\n }\n}\n\nfunction formatError(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\nfunction emitStep(\n events: ProfileSwitchStepEvent[],\n onStep: ProfileSwitchStepListener | undefined,\n event: ProfileSwitchStepEvent,\n): void {\n events.push(event);\n onStep?.(event);\n}\n\nfunction checkCancellation(\n options: SwitchProfileOptions,\n events: ProfileSwitchStepEvent[],\n previousProfile: string | null,\n step: ProfileSwitchStep,\n): SwitchProfileCancelled | null {\n if (!options.isCancelled?.()) {\n return null;\n }\n emitStep(events, options.onStep, {\n step,\n status: \"cancelled\",\n });\n return {\n ok: false,\n cancelled: true,\n previous_profile: previousProfile,\n events,\n };\n}\n\nexport async function switchProfile(\n selector: string,\n options: SwitchProfileOptions,\n): Promise<SwitchProfileResult> {\n const events: ProfileSwitchStepEvent[] = [];\n const ownsSigint = options.isCancelled === undefined;\n const sigint = ownsSigint ? installProfileSwitchSigint(events) : null;\n const resolvedOptions: SwitchProfileOptions = ownsSigint\n ? { ...options, isCancelled: () => sigint?.isCancelled() === true }\n : options;\n\n try {\n return await withProfileApplyLock(async () => {\n const previousProfile = getActiveProfileName() ?? null;\n const useProfile = resolvedOptions.useProfile ?? useProfileCommandUnlocked;\n\n emitStep(events, resolvedOptions.onStep, {\n step: \"validate_baseline\",\n status: \"started\",\n });\n const cancelledBeforeBaseline = checkCancellation(\n resolvedOptions,\n events,\n previousProfile,\n \"validate_baseline\",\n );\n if (cancelledBeforeBaseline) {\n return cancelledBeforeBaseline;\n }\n // First apply after init has no snapshot yet: proceed and establish one.\n // Restore-on-failure only matters when a previous apply baseline exists.\n emitStep(events, resolvedOptions.onStep, {\n step: \"validate_baseline\",\n status: \"completed\",\n });\n\n const cancelledBeforeApply = checkCancellation(\n resolvedOptions,\n events,\n previousProfile,\n \"apply_home\",\n );\n if (cancelledBeforeApply) {\n return cancelledBeforeApply;\n }\n\n emitStep(events, resolvedOptions.onStep, {\n step: \"apply_home\",\n status: \"started\",\n profile_name: selector,\n });\n\n try {\n const apply = await useProfile(selector, resolvedOptions.apply);\n if (apply.cancelled) {\n emitStep(events, resolvedOptions.onStep, {\n step: \"apply_home\",\n status: \"cancelled\",\n profile_name: selector,\n });\n return {\n ok: false,\n cancelled: true,\n previous_profile: previousProfile,\n events,\n };\n }\n emitStep(events, resolvedOptions.onStep, {\n step: \"apply_home\",\n status: \"completed\",\n profile_name: selector,\n });\n emitStep(events, resolvedOptions.onStep, {\n step: \"complete\",\n status: \"completed\",\n profile_name: selector,\n });\n return {\n ok: true,\n cancelled: false,\n previous_profile: previousProfile,\n apply,\n events,\n };\n } catch (error) {\n const applyError = formatError(error);\n emitStep(events, resolvedOptions.onStep, {\n step: \"apply_home\",\n status: \"failed\",\n profile_name: selector,\n error: applyError,\n });\n\n if (!previousProfile || previousProfile === selector) {\n throw error;\n }\n\n const cancelledBeforeRestore = checkCancellation(\n resolvedOptions,\n events,\n previousProfile,\n \"restore_previous\",\n );\n if (cancelledBeforeRestore) {\n return cancelledBeforeRestore;\n }\n\n emitStep(events, resolvedOptions.onStep, {\n step: \"restore_previous\",\n status: \"started\",\n profile_name: previousProfile,\n });\n\n try {\n const restored = await useProfile(previousProfile, resolvedOptions.apply);\n if (restored.cancelled) {\n throw new Error(\"Restore apply was cancelled.\");\n }\n emitStep(events, resolvedOptions.onStep, {\n step: \"restore_previous\",\n status: \"completed\",\n profile_name: previousProfile,\n });\n return {\n ok: false,\n cancelled: false,\n previous_profile: previousProfile,\n apply_error: applyError,\n restored,\n events,\n };\n } catch (restoreError) {\n const restoreMessage = formatError(restoreError);\n emitStep(events, resolvedOptions.onStep, {\n step: \"restore_previous\",\n status: \"failed\",\n profile_name: previousProfile,\n error: restoreMessage,\n });\n throw new SwitchRestoreFailedError({\n targetProfile: selector,\n previousProfile,\n applyError,\n restoreError: restoreMessage,\n });\n }\n }\n });\n } finally {\n sigint?.uninstall();\n clearLiveReadCaches();\n }\n}\n","import { resolveUserPath } from \"../utils/user-path.js\";\nimport { listProfilePlugins } from \"../constants/profile.js\";\nimport { getActiveProfileName } from \"./active-profile.js\";\nimport {\n findProjectConfig,\n getProfileEntry,\n type ProjectProfileEntry,\n type ResolvedProjectConfig,\n} from \"./project-config.js\";\nimport { resolveExpectedPluginName } from \"./project-config-use.js\";\nimport { buildProjectProfileChoices } from \"./wizards/project-use.js\";\nimport {\n promptForChoice,\n promptForSearchableChoice,\n type PromptChoice,\n shouldUseWizard,\n} from \"./wizards/shared.js\";\n\nconst PROJECT_PREFIX = \"project:\";\nconst GLOBAL_PREFIX = \"global:\";\n\nexport type ProfileUseSelection =\n | { kind: \"project\"; profileKey: string }\n | { kind: \"global\"; pluginName: string };\n\nfunction encodeProjectChoice(profileKey: string): string {\n return `${PROJECT_PREFIX}${profileKey}`;\n}\n\nfunction encodeGlobalChoice(pluginName: string): string {\n return `${GLOBAL_PREFIX}${pluginName}`;\n}\n\nfunction decodeProfileUseChoice(value: string): ProfileUseSelection {\n if (value.startsWith(PROJECT_PREFIX)) {\n return { kind: \"project\", profileKey: value.slice(PROJECT_PREFIX.length) };\n }\n if (value.startsWith(GLOBAL_PREFIX)) {\n return { kind: \"global\", pluginName: value.slice(GLOBAL_PREFIX.length) };\n }\n throw new Error(`Invalid profile selection: ${value}`);\n}\n\nfunction collectProjectPluginNames(config: ResolvedProjectConfig): Set<string> {\n const names = new Set<string>();\n for (const entry of config.profiles) {\n try {\n names.add(resolveExpectedPluginName(config, entry));\n } catch {\n // Skip entries that cannot be resolved yet (e.g. missing inline plugin).\n }\n }\n return names;\n}\n\nfunction buildGlobalProfileChoices(\n config: ResolvedProjectConfig | null,\n): PromptChoice<string>[] {\n const coveredPluginNames = config ? collectProjectPluginNames(config) : new Set<string>();\n return listProfilePlugins()\n .filter((plugin) => !coveredPluginNames.has(plugin.name))\n .map((plugin) => ({\n name: `${plugin.name}${getActiveProfileName() === plugin.name ? \" (active)\" : \"\"}`,\n value: encodeGlobalChoice(plugin.name),\n }));\n}\n\nfunction buildCombinedProfileUseChoices(\n config: ResolvedProjectConfig | null,\n): PromptChoice<string>[] {\n const choices: PromptChoice<string>[] = [];\n\n if (config && config.profiles.length > 0) {\n for (const entry of config.profiles) {\n choices.push({\n name: `[project] ${formatProjectProfileLabel(config, entry)}`,\n value: encodeProjectChoice(entry.name),\n });\n }\n }\n\n choices.push(...buildGlobalProfileChoices(config));\n return choices;\n}\n\nfunction formatProjectProfileLabel(\n config: ResolvedProjectConfig,\n entry: ProjectProfileEntry,\n): string {\n const choice = buildProjectProfileChoices(config).find(\n (candidate) => candidate.value === entry.name,\n );\n return choice?.name ?? entry.name;\n}\n\nfunction resolveDefaultProfileUseChoice(\n config: ResolvedProjectConfig | null,\n choices: PromptChoice<string>[],\n): string | undefined {\n if (config?.default_profile) {\n const projectChoice = encodeProjectChoice(config.default_profile);\n if (choices.some((choice) => choice.value === projectChoice)) {\n return projectChoice;\n }\n }\n\n const active = getActiveProfileName();\n if (active) {\n const globalChoice = encodeGlobalChoice(active);\n if (choices.some((choice) => choice.value === globalChoice)) {\n return globalChoice;\n }\n }\n\n return choices[0]?.value;\n}\n\nasync function promptForProfileUseSelection(\n config: ResolvedProjectConfig | null,\n): Promise<ProfileUseSelection> {\n const choices = buildCombinedProfileUseChoices(config);\n if (choices.length === 0) {\n throw new Error(\"No profiles available. Create one with `ht profile create <name>`.\");\n }\n\n const message = config\n ? \"Which profile should be applied globally?\"\n : \"Which profile plugin should be applied globally?\";\n const defaultChoice = resolveDefaultProfileUseChoice(config, choices);\n\n const value =\n choices.length >= 8\n ? await promptForSearchableChoice({ message, choices, default: defaultChoice })\n : await promptForChoice({ message, choices, default: defaultChoice });\n\n return decodeProfileUseChoice(value);\n}\n\nexport async function resolveProfileUseSelection(input: {\n name?: string;\n profile?: string;\n project?: string;\n interactive?: boolean;\n noInteractive?: boolean;\n format?: string;\n}): Promise<ProfileUseSelection | null> {\n if (input.name) {\n return { kind: \"global\", pluginName: input.name };\n }\n\n const projectPath = resolveUserPath(input.project ?? process.cwd());\n const config = findProjectConfig(projectPath);\n\n if (input.profile) {\n if (!config) {\n throw new Error(\n \"No project config found. Omit --profile to switch a local profile plugin by name.\",\n );\n }\n getProfileEntry(config, input.profile);\n return { kind: \"project\", profileKey: input.profile };\n }\n\n const interactive = shouldUseWizard({\n interactive: input.interactive,\n noInteractive: input.noInteractive,\n format: input.format,\n missingRequiredArgs: true,\n });\n\n if (interactive) {\n return promptForProfileUseSelection(config);\n }\n\n throw new Error(\"Pass a profile name.\");\n}\n","import type { Command } from \"commander\";\nimport inquirer from \"inquirer\";\nimport { getDb, getHarnesstapDir } from \"../../db/connection.js\";\nimport { initializeSchema } from \"../../db/schema.js\";\nimport { PROFILE_PLUGIN_TAG, isProfilePlugin } from \"../../constants/profile.js\";\nimport { getPlugin, listPlugins } from \"../../models/plugin-model.js\";\nimport { getResource, listResources } from \"../../models/resource.js\";\nimport { createPluginFromSource } from \"../../services/plugin-from-source.js\";\nimport { assertSupportedHarnessTargets } from \"../../services/harness-targets.js\";\nimport {\n promptMaterializationConflict,\n reportApplyCancelled,\n resolveApplyConflictPolicy,\n} from \"../../services/materialization-conflicts.js\";\nimport {\n commitProfileCreate,\n previewProfileCreate,\n type ProfileConflictPolicy,\n type ProfileCreateInput,\n type ProfileCreatePreview,\n type ProfileCreateSource,\n} from \"../../services/profile-create.js\";\nimport {\n createProfileCommand,\n tagProfileCommand,\n useProfileCommand,\n} from \"../../services/profile-commands.js\";\nimport { maybePromptProfileEnable } from \"../../services/profile-enable-prompt.js\";\nimport { maybeSyncActiveProfileBeforeSwitch } from \"../../services/profile-switch-prompt.js\";\nimport {\n resolveSkillPackageCheckout,\n type PluginSourceConflictPolicy,\n} from \"../../services/skill-package-resolve.js\";\nimport { runPluginCreateFromSourceWizard } from \"../../services/wizards/plugin-create-from-source.js\";\nimport {\n isPromptCancellationError,\n shouldUseWizard,\n} from \"../../services/wizards/shared.js\";\nimport { ui } from \"../../ui/index.js\";\nimport { resolveHomeRoot } from \"../../utils/home-root.js\";\nimport { parseOutputFormat, printJson } from \"../../utils/output-format.js\";\nimport { formatCount } from \"../formatting.js\";\nimport { parseCommaSeparatedList } from \"./parse-flags.js\";\nimport { collectRepeatedOption } from \"../shared.js\";\nimport { parseOnConflict, toPluginImportOnConflict } from \"../on-conflict.js\";\nimport { ON_CONFLICT_APPLY_HELP, ON_CONFLICT_PLUGIN_IMPORT_HELP } from \"../messages.js\";\nimport { printApplyPayload } from \"../print-apply-summary.js\";\n\nfunction parsePluginSourceConflictPolicy(\n value: string | undefined,\n): PluginSourceConflictPolicy | undefined {\n return toPluginImportOnConflict(parseOnConflict(value, { allowMerge: true }));\n}\n\nexport interface ProfileCreateCommandOpts {\n description?: string;\n version?: string;\n from?: string;\n skill?: string;\n all?: boolean;\n excludeCategory?: string[];\n onConflict?: string;\n use?: boolean;\n dryRun?: boolean;\n harness?: string;\n format?: string;\n interactive?: boolean;\n noInteractive?: boolean;\n yes?: boolean;\n onConflictUse?: string;\n account?: string;\n baseUrl?: string;\n pull?: boolean;\n compose?: boolean;\n plugins?: string | string[];\n resources?: string | string[];\n fromHome?: boolean;\n fromProject?: string;\n preview?: boolean;\n}\n\nconst SINGLE_SOURCE_MESSAGE =\n \"Pass only one of --from, --compose, --from-home, or --from-project.\";\nconst PREVIEW_SOURCE_MESSAGE =\n \"--preview applies to --compose, --from-home, and --from-project. Skill-package create uses --dry-run.\";\nconst PREVIEW_USE_MESSAGE =\n \"Do not combine --preview with --use or --dry-run.\";\nconst COMPOSE_SELECTION_FLAGS_MESSAGE =\n \"--plugins and --resources are only valid with --compose.\";\nconst COMPOSE_ON_CONFLICT_MESSAGE =\n \"--on-conflict is only valid with --from, --from-home, or --from-project.\";\n\nfunction flattenSelectors(value: string | string[] | undefined): string[] {\n const parts = Array.isArray(value) ? value : value ? [value] : [];\n return parts.flatMap((entry) =>\n entry.split(\",\").map((item) => item.trim()).filter(Boolean),\n );\n}\n\nfunction selectedCreateSources(opts: ProfileCreateCommandOpts): string[] {\n const sources: string[] = [];\n if (opts.from) sources.push(\"from\");\n if (opts.compose) sources.push(\"compose\");\n if (opts.fromHome) sources.push(\"from-home\");\n if (opts.fromProject !== undefined) sources.push(\"from-project\");\n return sources;\n}\n\nfunction isLibraryCreateSource(opts: ProfileCreateCommandOpts): boolean {\n return Boolean(opts.compose || opts.fromHome || opts.fromProject !== undefined);\n}\n\nfunction assertCreateSourceFlags(opts: ProfileCreateCommandOpts): void {\n if (selectedCreateSources(opts).length > 1) {\n throw new Error(SINGLE_SOURCE_MESSAGE);\n }\n\n const pluginSelectors = flattenSelectors(opts.plugins);\n const resourceSelectors = flattenSelectors(opts.resources);\n if (!opts.compose && (pluginSelectors.length > 0 || resourceSelectors.length > 0)) {\n throw new Error(COMPOSE_SELECTION_FLAGS_MESSAGE);\n }\n\n if (opts.compose && opts.onConflict !== undefined) {\n throw new Error(COMPOSE_ON_CONFLICT_MESSAGE);\n }\n\n if (opts.preview && (opts.use || opts.dryRun)) {\n throw new Error(PREVIEW_USE_MESSAGE);\n }\n\n if (opts.preview && !isLibraryCreateSource(opts)) {\n throw new Error(PREVIEW_SOURCE_MESSAGE);\n }\n\n if ((opts.fromHome || opts.fromProject !== undefined) && opts.onConflict) {\n parseHomeProjectConflictPolicy(opts.onConflict);\n }\n}\n\nfunction resolvePluginId(selector: string): string {\n const plugin = getPlugin(selector);\n if (!plugin) {\n throw new Error(`Plugin not found: ${selector}`);\n }\n return plugin.id;\n}\n\nfunction resolveResourceId(selector: string): string {\n const resource = getResource(selector);\n if (!resource) {\n throw new Error(`Resource not found: ${selector}`);\n }\n return resource.id;\n}\n\nfunction parseHomeProjectConflictPolicy(\n value: string | undefined,\n): ProfileConflictPolicy {\n if (!value) return \"skip\";\n const parsed = parseOnConflict(value);\n if (parsed === \"skip\") return \"skip\";\n if (parsed === \"replace\") return \"overwrite\";\n throw new Error(`Invalid --on-conflict value: ${value}. Use skip or replace.`);\n}\n\nasync function resolveComposeIds(\n opts: ProfileCreateCommandOpts,\n format: ReturnType<typeof parseOutputFormat>,\n): Promise<{ pluginIds: string[]; resourceIds: string[] }> {\n const pluginSelectors = flattenSelectors(opts.plugins);\n const resourceSelectors = flattenSelectors(opts.resources);\n if (pluginSelectors.length > 0 || resourceSelectors.length > 0) {\n return {\n pluginIds: pluginSelectors.map(resolvePluginId),\n resourceIds: resourceSelectors.map(resolveResourceId),\n };\n }\n\n const shouldPrompt = shouldUseWizard({\n noInteractive: opts.noInteractive ?? opts.yes ?? opts.interactive === false,\n interactive: opts.interactive,\n format,\n missingRequiredArgs: true,\n });\n if (!shouldPrompt) {\n throw new Error(\n \"A composed profile requires at least one plugin or resource selection\",\n );\n }\n\n return promptComposeSelections();\n}\n\nasync function promptComposeSelections(): Promise<{\n pluginIds: string[];\n resourceIds: string[];\n}> {\n const answers = await inquirer.prompt<{\n pluginIds: string[];\n resourceIds: string[];\n }>([\n {\n type: \"checkbox\",\n name: \"pluginIds\",\n message: \"Plugins to attach\",\n choices: listPlugins().map((plugin) => ({\n name: plugin.name,\n value: plugin.id,\n })),\n },\n {\n type: \"checkbox\",\n name: \"resourceIds\",\n message: \"Resources to add\",\n choices: listResources().map((resource) => ({\n name: `${resource.type}: ${resource.name}`,\n value: resource.id,\n })),\n },\n ]);\n return {\n pluginIds: answers.pluginIds ?? [],\n resourceIds: answers.resourceIds ?? [],\n };\n}\n\nfunction conflictLabel(conflict: unknown, index: number): string {\n if (typeof conflict !== \"object\" || conflict === null) {\n return String(conflict);\n }\n const row = conflict as Record<string, unknown>;\n if (typeof row.name === \"string\") {\n const type = typeof row.type === \"string\" ? `${row.type}: ` : \"\";\n return `${type}${row.name}`;\n }\n if (typeof row.existingResource === \"object\" && row.existingResource !== null) {\n const resource = row.existingResource as Record<string, unknown>;\n if (typeof resource.name === \"string\") {\n const type =\n typeof resource.type === \"string\" ? `${resource.type}: ` : \"\";\n return `${type}${resource.name}`;\n }\n }\n return `Conflict ${index + 1}`;\n}\n\nfunction sourcePhrase(source: ProfileCreateSource): string {\n switch (source) {\n case \"compose\":\n return \"compose\";\n case \"home\":\n return \"home\";\n case \"project\":\n return \"project\";\n default: {\n const exhaustive: never = source;\n throw new Error(`Unsupported profile create source: ${String(exhaustive)}`);\n }\n }\n}\n\nfunction printHumanPreview(preview: ProfileCreatePreview): void {\n ui.success(`Would create profile ${ui.theme.accent(preview.name)} from ${sourcePhrase(preview.source)}`);\n ui.kvBlock([\n { key: \"Imports\", value: String(preview.totalImports) },\n { key: \"Conflicts\", value: String(preview.conflicts.length) },\n { key: \"Warnings\", value: String(preview.warnings.length) },\n ]);\n preview.conflicts.forEach((conflict, index) => {\n ui.info(conflictLabel(conflict, index));\n });\n for (const warning of preview.warnings) {\n ui.warn(warning);\n }\n ui.hint(\n \"Re-run without --preview to create. Use --on-conflict replace to replace library copies.\",\n );\n}\n\nasync function buildLibraryCreateInput(\n name: string,\n opts: ProfileCreateCommandOpts,\n format: ReturnType<typeof parseOutputFormat>,\n): Promise<ProfileCreateInput> {\n if (opts.compose) {\n const selections = await resolveComposeIds(opts, format);\n return {\n source: \"compose\",\n name,\n ...(opts.description !== undefined ? { description: opts.description } : {}),\n pluginIds: selections.pluginIds,\n resourceIds: selections.resourceIds,\n };\n }\n if (opts.fromHome) {\n return {\n source: \"home\",\n name,\n ...(opts.description !== undefined ? { description: opts.description } : {}),\n conflictPolicy: parseHomeProjectConflictPolicy(opts.onConflict),\n };\n }\n if (opts.fromProject !== undefined) {\n return {\n source: \"project\",\n name,\n ...(opts.description !== undefined ? { description: opts.description } : {}),\n projectPath: opts.fromProject,\n conflictPolicy: parseHomeProjectConflictPolicy(opts.onConflict),\n };\n }\n throw new Error(SINGLE_SOURCE_MESSAGE);\n}\n\nasync function handleLibraryProfileCreate(\n name: string,\n opts: ProfileCreateCommandOpts,\n format: ReturnType<typeof parseOutputFormat>,\n): Promise<\"preview\" | \"committed\"> {\n const input = await buildLibraryCreateInput(name, opts, format);\n if (opts.preview) {\n const preview = await previewProfileCreate(input);\n if (format === \"json\") {\n printJson(preview);\n } else {\n printHumanPreview(preview);\n }\n return \"preview\";\n }\n\n const result = await commitProfileCreate(input);\n if (format === \"json\") {\n if (!opts.use) {\n printJson(result);\n }\n return \"committed\";\n }\n ui.success(\n `Created profile ${ui.theme.accent(result.profile.name)} ${ui.icons.bullet} ${formatCount(result.imported_count, \"imported\", \"imported\")}`,\n );\n return \"committed\";\n}\n\nexport async function handleProfileCreateCommand(\n name: string,\n opts: ProfileCreateCommandOpts,\n): Promise<void> {\n const format = parseOutputFormat(opts.format);\n const db = getDb();\n initializeSchema(db);\n const version = opts.version ?? \"1.0.0\";\n\n assertCreateSourceFlags(opts);\n\n if (isLibraryCreateSource(opts)) {\n const libraryResult = await handleLibraryProfileCreate(name, opts, format);\n if (libraryResult === \"preview\") {\n return;\n }\n if (format === \"json\" && !opts.use) {\n return;\n }\n } else if (opts.from) {\n const harnesstapDir = getHarnesstapDir();\n const homeRoot = resolveHomeRoot();\n const skillNames = parseCommaSeparatedList(opts.skill);\n const excludeCategories = [\n ...(opts.excludeCategory ?? []),\n ].flatMap((entry) => entry.split(\",\").map((part) => part.trim()).filter(Boolean));\n const onConflictFlag = parsePluginSourceConflictPolicy(opts.onConflict);\n const harnesses = parseCommaSeparatedList(opts.harness);\n if (harnesses) {\n assertSupportedHarnessTargets(harnesses);\n }\n\n const resolvedPackage = await resolveSkillPackageCheckout(opts.from, harnesstapDir);\n const shouldPrompt = shouldUseWizard({\n noInteractive: opts.yes,\n interactive: opts.interactive,\n format,\n missingRequiredArgs: !opts.all && (!skillNames || skillNames.length === 0),\n });\n\n const wizard = await runPluginCreateFromSourceWizard({\n pluginName: name,\n pluginVersion: version,\n discovered: resolvedPackage.discovered,\n skillNames,\n all: opts.all,\n excludeCategories: excludeCategories.length > 0 ? excludeCategories : undefined,\n onConflict: onConflictFlag,\n shouldPrompt,\n });\n\n if (wizard.cancelled) {\n ui.info(\"Operation cancelled.\");\n return;\n }\n\n const result = await createPluginFromSource({\n name,\n source: opts.from,\n version,\n description: opts.description,\n tags: [PROFILE_PLUGIN_TAG],\n skillNames: wizard.skillNames,\n all: wizard.all,\n excludeCategories: excludeCategories.length > 0 ? excludeCategories : undefined,\n onConflict: onConflictFlag ?? wizard.onConflict,\n dryRun: opts.dryRun,\n homeRoot,\n harnesstapDir,\n });\n\n if (!isProfilePlugin(result.plugin)) {\n tagProfileCommand(result.plugin.name);\n }\n\n if (opts.dryRun && !opts.use) {\n if (format === \"json\") {\n printJson({\n plugin: result.plugin,\n created: true,\n promoted: true,\n namespace: result.namespace,\n attached_skills: result.attachedSkills,\n });\n return;\n }\n ui.success(\n `Dry run ${ui.icons.hint} would create profile ${ui.theme.accent(result.plugin.name)} with ${formatCount(result.attachedSkills.length, \"skill\")} from ${result.namespace}`,\n );\n return;\n }\n\n if (format !== \"json\") {\n ui.success(\n `Created profile ${ui.theme.accent(result.plugin.name)} ${ui.icons.bullet} ${formatCount(result.attachedSkills.length, \"skill\")} attached from ${result.namespace}`,\n );\n } else if (!opts.use) {\n printJson({\n plugin: result.plugin,\n created: true,\n promoted: true,\n namespace: result.namespace,\n attached_skills: result.attachedSkills,\n });\n return;\n }\n } else {\n const result = createProfileCommand({\n name,\n description: opts.description,\n version,\n });\n\n if (format === \"json\" && !opts.use) {\n printJson(result);\n return;\n }\n\n if (result.created) {\n ui.success(`Created profile ${ui.theme.accent(result.plugin.name)}`);\n } else if (result.promoted) {\n ui.success(`Tagged plugin ${ui.theme.accent(result.plugin.name)} as profile`);\n } else {\n ui.info(`Profile ${ui.theme.accent(result.plugin.name)} already exists`);\n }\n }\n\n if (opts.use) {\n const conflictPolicy = resolveApplyConflictPolicy({\n onConflict: opts.onConflictUse,\n });\n try {\n if (!opts.dryRun) {\n const sync = await maybeSyncActiveProfileBeforeSwitch({\n targetProfileName: name,\n harness: opts.harness,\n yes: opts.yes,\n format,\n });\n if (sync === \"abort\") {\n process.exitCode = 1;\n return;\n }\n }\n const applied = await useProfileCommand(name, {\n dryRun: opts.dryRun,\n harness: opts.harness,\n pull: opts.pull,\n account: opts.account,\n baseUrl: opts.baseUrl,\n conflictPolicy,\n ...(conflictPolicy === \"prompt\"\n ? { conflictResolver: promptMaterializationConflict }\n : {}),\n });\n if (applied.cancelled) {\n process.exitCode = 1;\n }\n if (format === \"json\") {\n printJson({ apply: applied });\n return;\n }\n if (applied.cancelled) {\n reportApplyCancelled(applied.conflicts, \"profile\");\n return;\n }\n printApplyPayload(applied);\n return;\n } catch (err) {\n process.exitCode = 1;\n ui.danger(err instanceof Error ? err.message : String(err));\n return;\n }\n }\n\n if (format === \"json\") {\n return;\n }\n\n try {\n await maybePromptProfileEnable({\n profileName: name,\n format: opts.format,\n yes: opts.yes,\n harness: opts.harness,\n pull: opts.pull,\n account: opts.account,\n baseUrl: opts.baseUrl,\n onConflictUse: opts.onConflictUse,\n });\n } catch (err) {\n if (isPromptCancellationError(err)) {\n ui.info(\"Operation cancelled.\");\n return;\n }\n throw err;\n }\n}\n\nexport function registerProfileCreateSourceOptions(command: Command): Command {\n return command\n .option(\"--compose\", \"Create by attaching library plugins and resources\")\n .option(\n \"--plugins <selectors>\",\n \"Compose: plugin names or ids (comma-separated, repeatable)\",\n collectRepeatedOption,\n [],\n )\n .option(\n \"--resources <selectors>\",\n \"Compose: resource names or ids (comma-separated, repeatable)\",\n collectRepeatedOption,\n [],\n )\n .option(\"--from-home\", \"Import from global home harness files\")\n .option(\"--from-project <path>\", \"Import from a project path\")\n .option(\"--preview\", \"Print create preview without writing\")\n .option(\"--no-interactive\", \"Don't open the compose picker\");\n}\n\nexport function registerProfileCreateCommand(profileCmd: Command): void {\n const createCmd = profileCmd\n .command(\"create\")\n .argument(\"<name>\", \"Profile plugin name\")\n .option(\"-d, --description <text>\", \"Profile description\")\n .option(\"--version <semver>\", \"Plugin version when creating from a source\", \"1.0.0\")\n .option(\n \"--from <source>\",\n \"Skill package source (owner/repo, git URL, or local path)\",\n )\n .option(\"--skill <names>\", \"Comma-separated skills to attach when using --from\")\n .option(\"--all\", \"Attach all discovered skills when using --from\")\n .option(\n \"--exclude-category <names>\",\n \"Exclude skill categories when using --from (repeatable or comma-separated)\",\n collectRepeatedOption,\n [],\n )\n .option(\n \"--on-conflict <policy>\",\n `${ON_CONFLICT_PLUGIN_IMPORT_HELP} (default: cancel). merge is plugin import only.`,\n )\n .option(\"--use\", \"Apply globally and set as the active profile\")\n .option(\"--dry-run\", \"Preview profile apply when used with --use\")\n .option(\"--harness <slugs>\", \"Harness targets for --use\")\n .option(\n \"--on-conflict-use <policy>\",\n ON_CONFLICT_APPLY_HELP,\n )\n .option(\"--account <name>\", \"Cloud account for dependency pulls during --use\")\n .option(\"--base-url <url>\", \"Cloud base URL for dependency pulls during --use\")\n .option(\"--no-pull\", \"Do not auto-pull missing published dependencies during --use\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .option(\"--interactive\", \"Prompt for skill selection when using --from\")\n .option(\"-y, --yes\", \"Skip prompts when using --from\");\n registerProfileCreateSourceOptions(createCmd)\n .description(\"Create a profile plugin, promote an existing plugin, or import from a skill package\")\n .action(async (name: string, opts: ProfileCreateCommandOpts) => {\n try {\n await handleProfileCreateCommand(name, opts);\n } catch (err) {\n process.exitCode = 1;\n if (isPromptCancellationError(err)) {\n return;\n }\n ui.danger(err instanceof Error ? err.message : String(err));\n }\n });\n}\n","import {\n addResourceToPlugin,\n createPlugin,\n getPluginByName,\n} from \"../models/plugin-model.js\";\nimport { PROFILE_PLUGIN_TAG, isEmptyBuiltinProfile } from \"../constants/profile.js\";\nimport { listResources } from \"../models/resource.js\";\nimport type { Plugin, Resource, ResourceCreateInput } from \"../types.js\";\nimport { resolveHomeRoot } from \"../utils/home-root.js\";\nimport { ProfileReservedNameError } from \"./profile-commands.js\";\nimport {\n persistScanResults,\n scanHomeDefaults,\n} from \"./scanner.js\";\nimport { diskCaptureHarnessScope } from \"./harness-scope.js\";\n\nexport type ProfileConflictPolicy = \"skip\" | \"overwrite\";\n\nexport class ProfilePluginExistsError extends Error {\n constructor(name: string) {\n super(`Plugin already exists: ${name}`);\n this.name = \"ProfilePluginExistsError\";\n }\n}\n\nexport interface ProfileFromHomePreview {\n totalImports: number;\n platformIds: string[];\n conflicts: Array<{\n type: string;\n name: string;\n namespace: string | null;\n }>;\n warning?: string;\n}\n\nexport interface ProfileFromHomeResult {\n plugin: Plugin;\n imported_count: number;\n resources: Resource[];\n}\n\nfunction resourceNamespace(resource: ResourceCreateInput): string {\n return resource.namespace ?? \"\";\n}\n\nfunction resourceKey(resource: ResourceCreateInput): string {\n return `${resource.type}:${resource.name}:${resourceNamespace(resource)}`;\n}\n\nfunction createNewProfilePlugin(input: {\n name: string;\n description?: string;\n}): Plugin {\n try {\n return createPlugin({\n name: input.name,\n ...(input.description !== undefined\n ? { description: input.description }\n : {}),\n tags: [PROFILE_PLUGIN_TAG],\n });\n } catch (error) {\n if (getPluginByName(input.name)) {\n throw new ProfilePluginExistsError(input.name);\n }\n throw error;\n }\n}\n\nexport async function previewProfileFromHome(input?: {\n homeRoot?: string;\n platform?: string;\n}): Promise<ProfileFromHomePreview> {\n const homeRoot = input?.homeRoot ?? resolveHomeRoot();\n const results = await scanHomeDefaults(input?.platform, homeRoot);\n const scannedResources = results.flatMap((result) => result.resources);\n const existingByKey = new Map(\n listResources().map((resource) => [resourceKey(resource), resource]),\n );\n const conflicts = [];\n const conflictKeys = new Set<string>();\n\n for (const scanned of scannedResources) {\n const key = resourceKey(scanned);\n const existing = existingByKey.get(key);\n if (\n !existing\n || existing.content === scanned.content\n || conflictKeys.has(key)\n ) {\n continue;\n }\n conflictKeys.add(key);\n conflicts.push({\n type: scanned.type,\n name: scanned.name,\n namespace: resourceNamespace(scanned) || null,\n });\n }\n\n const preview: ProfileFromHomePreview = {\n totalImports: scannedResources.length,\n platformIds: results.map((result) => result.platformId),\n conflicts,\n };\n if (scannedResources.length === 0) {\n preview.warning = \"No supported home resources found\";\n }\n return preview;\n}\n\nexport async function createProfileFromHome(input: {\n name: string;\n description?: string;\n homeRoot?: string;\n platform?: string;\n conflictPolicy: ProfileConflictPolicy;\n}): Promise<ProfileFromHomeResult> {\n if (isEmptyBuiltinProfile(input.name)) {\n throw new ProfileReservedNameError(input.name);\n }\n if (getPluginByName(input.name)) {\n throw new ProfilePluginExistsError(input.name);\n }\n\n const homeRoot = input.homeRoot ?? resolveHomeRoot();\n const scanResults = await scanHomeDefaults(input.platform, homeRoot);\n const persisted = persistScanResults(scanResults, {\n conflictPolicy: input.conflictPolicy,\n originRef: homeRoot,\n });\n const plugin = createNewProfilePlugin({\n name: input.name,\n ...(input.description !== undefined\n ? { description: input.description }\n : {}),\n });\n\n for (const resource of persisted.resolved) {\n addResourceToPlugin(plugin.id, resource.id, diskCaptureHarnessScope(resource));\n }\n\n return {\n plugin,\n imported_count: persisted.resolved.length,\n resources: persisted.resolved,\n };\n}\n","import {\n addResourceToPlugin,\n createPlugin,\n getPluginByName,\n listPlugins,\n} from \"../models/plugin-model.js\";\nimport { PROFILE_PLUGIN_TAG, isEmptyBuiltinProfile } from \"../constants/profile.js\";\nimport { listResources } from \"../models/resource.js\";\nimport type { Plugin, Resource } from \"../types.js\";\nimport {\n addPluginAttachment,\n formatPluginRef,\n} from \"./plugin-composition.js\";\nimport { previewPluginFromProject } from \"./plugin-from-project.js\";\nimport {\n createProfileFromHome,\n previewProfileFromHome,\n ProfilePluginExistsError,\n} from \"./profile-from-home.js\";\nimport { ProfileReservedNameError } from \"./profile-commands.js\";\nimport { persistMergedProjectScan } from \"./scanner.js\";\n\nexport { ProfilePluginExistsError };\n\nexport type ProfileCreateSource = \"compose\" | \"home\" | \"project\";\nexport type ProfileConflictPolicy = \"skip\" | \"overwrite\";\n\nexport interface ProfileCreateComposeInput {\n source: \"compose\";\n name: string;\n description?: string;\n pluginIds?: string[];\n resourceIds?: string[];\n use?: boolean;\n}\n\nexport interface ProfileCreateHomeInput {\n source: \"home\";\n name: string;\n description?: string;\n conflictPolicy: ProfileConflictPolicy;\n platform?: string;\n use?: boolean;\n}\n\nexport interface ProfileCreateProjectInput {\n source: \"project\";\n name: string;\n description?: string;\n projectPath: string;\n conflictPolicy: ProfileConflictPolicy;\n platform?: string;\n use?: boolean;\n}\n\nexport type ProfileCreateInput =\n | ProfileCreateComposeInput\n | ProfileCreateHomeInput\n | ProfileCreateProjectInput;\n\nexport interface ProfileCreatePreview {\n source: ProfileCreateSource;\n name: string;\n totalImports: number;\n conflicts: unknown[];\n warnings: string[];\n}\n\ninterface ComposeSelections {\n plugins: ReturnType<typeof listPlugins>;\n resourceIds: string[];\n resourcesById: Map<string, Resource>;\n}\n\nfunction assertProfileNameAvailable(name: string): void {\n if (isEmptyBuiltinProfile(name)) {\n throw new ProfileReservedNameError(name);\n }\n if (getPluginByName(name)) {\n throw new ProfilePluginExistsError(name);\n }\n}\n\nfunction createNewProfilePlugin(input: {\n name: string;\n description?: string;\n}): Plugin {\n try {\n return createPlugin({\n name: input.name,\n ...(input.description !== undefined\n ? { description: input.description }\n : {}),\n tags: [PROFILE_PLUGIN_TAG],\n });\n } catch (error) {\n if (getPluginByName(input.name)) {\n throw new ProfilePluginExistsError(input.name);\n }\n throw error;\n }\n}\n\nfunction resolveComposeSelections(\n input: ProfileCreateComposeInput,\n): ComposeSelections {\n const pluginIds = [...new Set(input.pluginIds ?? [])];\n const resourceIds = [...new Set(input.resourceIds ?? [])];\n if (pluginIds.length + resourceIds.length === 0) {\n throw new Error(\"A composed profile requires at least one plugin or resource selection\");\n }\n\n const pluginsById = new Map(listPlugins().map((plugin) => [plugin.id, plugin]));\n const resourcesById = new Map(\n listResources().map((resource) => [resource.id, resource]),\n );\n const plugins = pluginIds.map((id) => {\n const plugin = pluginsById.get(id);\n if (!plugin) {\n throw new Error(`Plugin not found: ${id}`);\n }\n return plugin;\n });\n for (const id of resourceIds) {\n if (!resourcesById.has(id)) {\n throw new Error(`Resource not found: ${id}`);\n }\n }\n return { plugins, resourceIds, resourcesById };\n}\n\nfunction assertProjectPath(projectPath: string): void {\n if (projectPath.trim().length === 0) {\n throw new Error(\"projectPath is required for project profile creation\");\n }\n}\n\nfunction unreachableSource(source: never): never {\n throw new Error(`Unsupported profile create source: ${String(source)}`);\n}\n\nexport async function previewProfileCreate(\n input: ProfileCreateInput,\n): Promise<ProfileCreatePreview> {\n switch (input.source) {\n case \"compose\": {\n assertProfileNameAvailable(input.name);\n const selections = resolveComposeSelections(input);\n return {\n source: input.source,\n name: input.name,\n totalImports: selections.plugins.length + selections.resourceIds.length,\n conflicts: [],\n warnings: [],\n };\n }\n case \"home\": {\n const preview = await previewProfileFromHome({\n ...(input.platform ? { platform: input.platform } : {}),\n });\n return {\n source: input.source,\n name: input.name,\n totalImports: preview.totalImports,\n conflicts: preview.conflicts,\n warnings: preview.warning ? [preview.warning] : [],\n };\n }\n case \"project\": {\n assertProjectPath(input.projectPath);\n const preview = await previewPluginFromProject({\n name: input.name,\n projectRoot: input.projectPath,\n ...(input.platform ? { platform: input.platform } : {}),\n });\n return {\n source: input.source,\n name: input.name,\n totalImports: preview.totalImports,\n conflicts: preview.conflicts,\n warnings: [],\n };\n }\n default:\n return unreachableSource(input);\n }\n}\n\nexport async function commitProfileCreate(input: ProfileCreateInput): Promise<{\n profile: { name: string; id: string; version: string };\n imported_count: number;\n used: boolean;\n}> {\n switch (input.source) {\n case \"compose\": {\n assertProfileNameAvailable(input.name);\n const selections = resolveComposeSelections(input);\n const plugin = createNewProfilePlugin({\n name: input.name,\n ...(input.description !== undefined\n ? { description: input.description }\n : {}),\n });\n for (const dependency of selections.plugins) {\n await addPluginAttachment({\n plugin,\n selector: dependency.name,\n type: \"plugin\",\n });\n }\n for (const resourceId of selections.resourceIds) {\n const resource = selections.resourcesById.get(resourceId);\n if (resource?.type === \"plugin\") {\n await addPluginAttachment({\n plugin,\n selector: formatPluginRef(resource),\n type: \"plugin\",\n });\n } else {\n addResourceToPlugin(plugin.id, resourceId);\n }\n }\n return {\n profile: {\n name: plugin.name,\n id: plugin.id,\n version: plugin.version,\n },\n imported_count: selections.plugins.length + selections.resourceIds.length,\n used: false,\n };\n }\n case \"home\": {\n assertProfileNameAvailable(input.name);\n const result = await createProfileFromHome({\n name: input.name,\n ...(input.description !== undefined\n ? { description: input.description }\n : {}),\n conflictPolicy: input.conflictPolicy,\n ...(input.platform ? { platform: input.platform } : {}),\n });\n return {\n profile: {\n name: result.plugin.name,\n id: result.plugin.id,\n version: result.plugin.version,\n },\n imported_count: result.imported_count,\n used: false,\n };\n }\n case \"project\": {\n assertProjectPath(input.projectPath);\n assertProfileNameAvailable(input.name);\n const persisted = await persistMergedProjectScan(\n input.projectPath,\n input.platform,\n {\n conflictPolicy: input.conflictPolicy,\n originRef: input.projectPath,\n namespace: input.name,\n },\n );\n const plugin = createNewProfilePlugin({\n name: input.name,\n ...(input.description !== undefined\n ? { description: input.description }\n : { description: `Inferred from ${input.projectPath}` }),\n });\n for (const resource of persisted.resources) {\n addResourceToPlugin(plugin.id, resource.id);\n }\n return {\n profile: {\n name: plugin.name,\n id: plugin.id,\n version: plugin.version,\n },\n imported_count: persisted.resources.length,\n used: false,\n };\n }\n default:\n return unreachableSource(input);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAA4B;;;ACa9B,SAAS,0BAA0B,OAG9B;AACV,MAAI,MAAM,OAAO,MAAM,WAAW,QAAQ;AACxC,WAAO;AAAA,EACT;AACA,MACE,QAAQ,KAAK,SAAS,kBAAkB,KACrC,QAAQ,IAAI,8BAA8B,KAC7C;AACA,WAAO;AAAA,EACT;AAEA,QAAM,UAAU,QAAQ,IAAI,IAAI,KAAK,EAAE,YAAY;AACnD,QAAM,YAAY;AAAA,IAChB,WAAW,YAAY,OAAO,YAAY,WAAW,YAAY;AAAA,EACnE;AACA,MAAI,WAAW;AACb,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL,QAAQ,IAAI,4BAA4B,OAClC,QAAQ,MAAM,SAAS,QAAQ,OAAO;AAAA,EAC9C;AACF;AAEA,eAAsB,yBAAyB,OAS7B;AAChB,QAAM,SAAS,MAAM,UAAU;AAC/B,MAAI,WAAW,SAAS;A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