harnesstap 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -15
- package/dist/apply-QSS4242W.js +67 -0
- package/dist/apply-QSS4242W.js.map +1 -0
- package/dist/approve-CNYQY6DC.js +181 -0
- package/dist/approve-CNYQY6DC.js.map +1 -0
- package/dist/audit-V4SUV7KA.js +434 -0
- package/dist/audit-V4SUV7KA.js.map +1 -0
- package/dist/auth-63FOHIQ3.js +220 -0
- package/dist/auth-63FOHIQ3.js.map +1 -0
- package/dist/bin.js +166 -0
- package/dist/bin.js.map +1 -0
- package/dist/chunk-2H7UOFLK.js +11 -0
- package/dist/chunk-2H7UOFLK.js.map +1 -0
- package/dist/chunk-2NE3QYMP.js +103 -0
- package/dist/chunk-2NE3QYMP.js.map +1 -0
- package/dist/chunk-2P2EOYEW.js +1140 -0
- package/dist/chunk-2P2EOYEW.js.map +1 -0
- package/dist/chunk-37E5M4JX.js +34 -0
- package/dist/chunk-37E5M4JX.js.map +1 -0
- package/dist/chunk-37LQQWMF.js +496 -0
- package/dist/chunk-37LQQWMF.js.map +1 -0
- package/dist/chunk-3FIWOI3H.js +98 -0
- package/dist/chunk-3FIWOI3H.js.map +1 -0
- package/dist/chunk-3PGC6OA3.js +540 -0
- package/dist/chunk-3PGC6OA3.js.map +1 -0
- package/dist/chunk-4IHKBIY3.js +118 -0
- package/dist/chunk-4IHKBIY3.js.map +1 -0
- package/dist/chunk-4ZUBRLSP.js +17 -0
- package/dist/chunk-4ZUBRLSP.js.map +1 -0
- package/dist/chunk-5F3LNDZG.js +9 -0
- package/dist/chunk-5F3LNDZG.js.map +1 -0
- package/dist/chunk-5TXI6BI2.js +1359 -0
- package/dist/chunk-5TXI6BI2.js.map +1 -0
- package/dist/chunk-6P5IO4BX.js +235 -0
- package/dist/chunk-6P5IO4BX.js.map +1 -0
- package/dist/chunk-ABXUKHAU.js +571 -0
- package/dist/chunk-ABXUKHAU.js.map +1 -0
- package/dist/chunk-AOUDSNRK.js +1357 -0
- package/dist/chunk-AOUDSNRK.js.map +1 -0
- package/dist/chunk-BNDJJAEI.js +311 -0
- package/dist/chunk-BNDJJAEI.js.map +1 -0
- package/dist/chunk-C2IWSFF5.js +818 -0
- package/dist/chunk-C2IWSFF5.js.map +1 -0
- package/dist/chunk-CHQGE2HF.js +283 -0
- package/dist/chunk-CHQGE2HF.js.map +1 -0
- package/dist/chunk-DEJLP7QJ.js +681 -0
- package/dist/chunk-DEJLP7QJ.js.map +1 -0
- package/dist/chunk-DJ6FN6EW.js +532 -0
- package/dist/chunk-DJ6FN6EW.js.map +1 -0
- package/dist/chunk-E4WRTRMH.js +1173 -0
- package/dist/chunk-E4WRTRMH.js.map +1 -0
- package/dist/chunk-E5QXNU3K.js +238 -0
- package/dist/chunk-E5QXNU3K.js.map +1 -0
- package/dist/chunk-EMTBGOR3.js +2959 -0
- package/dist/chunk-EMTBGOR3.js.map +1 -0
- package/dist/chunk-FFWYIGQ4.js +18 -0
- package/dist/chunk-FFWYIGQ4.js.map +1 -0
- package/dist/chunk-I6XFZLTJ.js +9 -0
- package/dist/chunk-I6XFZLTJ.js.map +1 -0
- package/dist/chunk-IHWAOIAU.js +172 -0
- package/dist/chunk-IHWAOIAU.js.map +1 -0
- package/dist/chunk-IHZUYG66.js +583 -0
- package/dist/chunk-IHZUYG66.js.map +1 -0
- package/dist/chunk-JQOKQKQT.js +158 -0
- package/dist/chunk-JQOKQKQT.js.map +1 -0
- package/dist/chunk-JRFUTIEH.js +426 -0
- package/dist/chunk-JRFUTIEH.js.map +1 -0
- package/dist/chunk-KCBI6JQC.js +115 -0
- package/dist/chunk-KCBI6JQC.js.map +1 -0
- package/dist/chunk-KDUQMINL.js +60 -0
- package/dist/chunk-KDUQMINL.js.map +1 -0
- package/dist/chunk-KLR2DURP.js +656 -0
- package/dist/chunk-KLR2DURP.js.map +1 -0
- package/dist/chunk-KRI4R7EM.js +25 -0
- package/dist/chunk-KRI4R7EM.js.map +1 -0
- package/dist/chunk-LYQMK6SV.js +87 -0
- package/dist/chunk-LYQMK6SV.js.map +1 -0
- package/dist/chunk-MK3Q37ZN.js +183 -0
- package/dist/chunk-MK3Q37ZN.js.map +1 -0
- package/dist/chunk-MSGAGV7B.js +346 -0
- package/dist/chunk-MSGAGV7B.js.map +1 -0
- package/dist/chunk-MZQRSERO.js +430 -0
- package/dist/chunk-MZQRSERO.js.map +1 -0
- package/dist/chunk-N3WIJXXM.js +691 -0
- package/dist/chunk-N3WIJXXM.js.map +1 -0
- package/dist/chunk-NAGAJ5UM.js +145 -0
- package/dist/chunk-NAGAJ5UM.js.map +1 -0
- package/dist/chunk-NFYPBTKO.js +302 -0
- package/dist/chunk-NFYPBTKO.js.map +1 -0
- package/dist/chunk-NPO2IG6G.js +491 -0
- package/dist/chunk-NPO2IG6G.js.map +1 -0
- package/dist/chunk-OS6NUIBJ.js +38 -0
- package/dist/chunk-OS6NUIBJ.js.map +1 -0
- package/dist/chunk-PFUK3HJ4.js +296 -0
- package/dist/chunk-PFUK3HJ4.js.map +1 -0
- package/dist/chunk-PMQ55GDB.js +115 -0
- package/dist/chunk-PMQ55GDB.js.map +1 -0
- package/dist/chunk-QIVE2YFJ.js +514 -0
- package/dist/chunk-QIVE2YFJ.js.map +1 -0
- package/dist/chunk-QKXD3EUF.js +691 -0
- package/dist/chunk-QKXD3EUF.js.map +1 -0
- package/dist/chunk-RNQYUWF6.js +32 -0
- package/dist/chunk-RNQYUWF6.js.map +1 -0
- package/dist/chunk-S2E4SSQV.js +41 -0
- package/dist/chunk-S2E4SSQV.js.map +1 -0
- package/dist/chunk-SN4BXX3B.js +186 -0
- package/dist/chunk-SN4BXX3B.js.map +1 -0
- package/dist/chunk-SNVAMWB7.js +40 -0
- package/dist/chunk-SNVAMWB7.js.map +1 -0
- package/dist/chunk-T5VRREN4.js +696 -0
- package/dist/chunk-T5VRREN4.js.map +1 -0
- package/dist/chunk-TKBMHZTS.js +10945 -0
- package/dist/chunk-TKBMHZTS.js.map +1 -0
- package/dist/chunk-TNJPTUE4.js +35 -0
- package/dist/chunk-TNJPTUE4.js.map +1 -0
- package/dist/chunk-TQ2NA4Z4.js +24 -0
- package/dist/chunk-TQ2NA4Z4.js.map +1 -0
- package/dist/chunk-TXXDMDPN.js +998 -0
- package/dist/chunk-TXXDMDPN.js.map +1 -0
- package/dist/chunk-UWXUBU7V.js +184 -0
- package/dist/chunk-UWXUBU7V.js.map +1 -0
- package/dist/chunk-UYRK2H24.js +141 -0
- package/dist/chunk-UYRK2H24.js.map +1 -0
- package/dist/chunk-V4IXIM3C.js +806 -0
- package/dist/chunk-V4IXIM3C.js.map +1 -0
- package/dist/chunk-VFHVXXP4.js +6438 -0
- package/dist/chunk-VFHVXXP4.js.map +1 -0
- package/dist/chunk-VQVUJYYY.js +244 -0
- package/dist/chunk-VQVUJYYY.js.map +1 -0
- package/dist/chunk-VZQG2JDV.js +9 -0
- package/dist/chunk-VZQG2JDV.js.map +1 -0
- package/dist/chunk-W7HQ5X3S.js +610 -0
- package/dist/chunk-W7HQ5X3S.js.map +1 -0
- package/dist/chunk-WMSQAFK5.js +65 -0
- package/dist/chunk-WMSQAFK5.js.map +1 -0
- package/dist/chunk-WMYTBJPB.js +364 -0
- package/dist/chunk-WMYTBJPB.js.map +1 -0
- package/dist/chunk-WNLFNCOH.js +7795 -0
- package/dist/chunk-WNLFNCOH.js.map +1 -0
- package/dist/chunk-WRX7CB2M.js +6448 -0
- package/dist/chunk-WRX7CB2M.js.map +1 -0
- package/dist/chunk-XGTTOO4R.js +84 -0
- package/dist/chunk-XGTTOO4R.js.map +1 -0
- package/dist/chunk-YSXRBUR4.js +682 -0
- package/dist/chunk-YSXRBUR4.js.map +1 -0
- package/dist/chunk-YTC2EG64.js +1759 -0
- package/dist/chunk-YTC2EG64.js.map +1 -0
- package/dist/compile-J3UGQSS3.js +161 -0
- package/dist/compile-J3UGQSS3.js.map +1 -0
- package/dist/config-5BPSZND3.js +438 -0
- package/dist/config-5BPSZND3.js.map +1 -0
- package/dist/doctor-BVFKLJVO.js +111 -0
- package/dist/doctor-BVFKLJVO.js.map +1 -0
- package/dist/environment-3RI5H32O.js +2745 -0
- package/dist/environment-3RI5H32O.js.map +1 -0
- package/dist/github-YFJQVH5K.js +114 -0
- package/dist/github-YFJQVH5K.js.map +1 -0
- package/dist/harness-ECGHPEKA.js +746 -0
- package/dist/harness-ECGHPEKA.js.map +1 -0
- package/dist/help-ELPNPPEM.js +2079 -0
- package/dist/help-ELPNPPEM.js.map +1 -0
- package/dist/help-UL5XLY3I.js +1892 -0
- package/dist/help-UL5XLY3I.js.map +1 -0
- package/dist/index.d.ts +164 -1
- package/dist/index.js +50 -59246
- package/dist/index.js.map +1 -1
- package/dist/init-UJQTDHW7.js +873 -0
- package/dist/init-UJQTDHW7.js.map +1 -0
- package/dist/lock-XUMJ63NZ.js +455 -0
- package/dist/lock-XUMJ63NZ.js.map +1 -0
- package/dist/marketplace-ZUMOLVXE.js +495 -0
- package/dist/marketplace-ZUMOLVXE.js.map +1 -0
- package/dist/mcp-RZA5O2ND.js +202 -0
- package/dist/mcp-RZA5O2ND.js.map +1 -0
- package/dist/migrate-CYQI2FH6.js +1043 -0
- package/dist/migrate-CYQI2FH6.js.map +1 -0
- package/dist/open-AWOAWLKO.js +32 -0
- package/dist/open-AWOAWLKO.js.map +1 -0
- package/dist/pack-2QD5ZUIO.js +99 -0
- package/dist/pack-2QD5ZUIO.js.map +1 -0
- package/dist/plugin-GQSSSFX4.js +64 -0
- package/dist/plugin-GQSSSFX4.js.map +1 -0
- package/dist/plugin-from-project-SIQUFYIO.js +16 -0
- package/dist/plugin-from-project-SIQUFYIO.js.map +1 -0
- package/dist/policy-CT4JRCJI.js +105 -0
- package/dist/policy-CT4JRCJI.js.map +1 -0
- package/dist/profile-4JQ6LECP.js +1886 -0
- package/dist/profile-4JQ6LECP.js.map +1 -0
- package/dist/project-JG7QWXRG.js +1392 -0
- package/dist/project-JG7QWXRG.js.map +1 -0
- package/dist/resource-QRMR6CSD.js +555 -0
- package/dist/resource-QRMR6CSD.js.map +1 -0
- package/dist/version-LZ5POOXY.js +17 -0
- package/dist/version-LZ5POOXY.js.map +1 -0
- package/package.json +21 -14
- package/schemas/ap-package.v1.json +36 -0
- package/schemas/fixtures/catalog-missing-schema.ap.json +13 -0
- package/schemas/fixtures/confidence.ap.json +13 -0
- package/schemas/fixtures/context7.ap.json +13 -0
- package/schemas/fixtures/minimal-with-schema.ap.json +13 -0
- package/schemas/fixtures/superpowers.ap.json +13 -0
- package/schemas/fixtures/third-party-skills.ap.json +13 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/copy/scope.ts","../src/cli/commands/profile-live-files.ts","../src/services/profile-file-diff.ts","../src/services/profile-apply-preview.ts","../src/services/apply-preview-inherited.ts","../src/services/profile-remove-resource.ts","../src/services/profile-restore-file.ts","../src/cli/handlers/profile-live-files.ts","../src/cli/commands/profile-preview.ts","../src/cli/commands/parity-register.ts"],"sourcesContent":["import { getPlatform } from \"../platforms/registry.js\";\nimport type { HarnessScope } from \"../services/harness-scope.js\";\n\n/** DS-1 scope copy. ASCII punctuation only. */\n\nexport const SCOPE_COPY = {\n appliesToAll: \"Applies to all your harnesses\",\n notSetUp: \"Not set up for any harness yet\",\n detectHarnesses: \"Detect harnesses\",\n foundInSettingsSuffix: \"Found in its settings.\",\n useOn: \"Use on\",\n selectAll: \"Select all\",\n none: \"None\",\n emptyHint: \"Pick at least one harness\",\n linkedTooltip: \"These read the same folder, so they share one setting\",\n allTooltip: \"On all harnesses. Pick which ones\",\n orphanedTooltip: \"Its harnesses are gone. Pick new ones\",\n main: \"Main\",\n mainTooltip: \"Your main harness. It wins when harnesses disagree.\",\n alsoUseOnPrefix: \"Also use on\",\n notNow: \"Not now\",\n willWrite: \"Will write\",\n upToDate: \"Up to date\",\n notInProfile: \"Not in profile\",\n willRemove: \"Will remove\",\n keptYouChanged: \"Kept. You changed it.\",\n keptNotMadeByHarnessTap: \"Kept. Not made by HarnessTap.\",\n} as const;\n\nexport function harnessDisplayName(id: string): string {\n return getPlatform(id)?.name ?? id;\n}\n\n/** Join display names: \"A and B\" / \"A, B and C\". */\nexport function formatHarnessList(names: readonly string[]): string {\n if (names.length === 0) {\n return \"\";\n }\n if (names.length === 1) {\n return names[0] ?? \"\";\n }\n if (names.length === 2) {\n return `${names[0]} and ${names[1]}`;\n }\n return `${names.slice(0, -1).join(\", \")} and ${names[names.length - 1]}`;\n}\n\nexport function formatHarnessIds(ids: readonly string[]): string {\n return formatHarnessList(ids.map(harnessDisplayName));\n}\n\n/**\n * Subset scope line: \"Only on Claude Code and Codex\",\n * or \"Only on Claude Code, Codex, Cursor and {n} more\" for 4+.\n */\nexport function subsetScopeLine(ids: readonly string[]): string {\n if (ids.length === 0) {\n return SCOPE_COPY.notSetUp;\n }\n if (ids.length <= 3) {\n return `Only on ${formatHarnessIds(ids)}`;\n }\n const visible = ids.slice(0, 3).map(harnessDisplayName);\n const extra = ids.length - visible.length;\n return `Only on ${visible.join(\", \")} and ${extra} more`;\n}\n\nexport function scopeLine(\n scope: HarnessScope,\n options?: { originPortable?: boolean },\n): string {\n if (scope.kind === \"all\") {\n return SCOPE_COPY.appliesToAll;\n }\n const line = subsetScopeLine(scope.harnesses);\n if (options?.originPortable && scope.harnesses.length === 1) {\n return `${line}. ${SCOPE_COPY.foundInSettingsSuffix}`;\n }\n return line;\n}\n\nexport function alsoUseOnLabel(ids: readonly string[]): string {\n if (ids.length <= 3) {\n return `${SCOPE_COPY.alsoUseOnPrefix} ${formatHarnessIds(ids)}`;\n }\n const visible = ids.slice(0, 3).map(harnessDisplayName);\n const extra = ids.length - visible.length;\n return `${SCOPE_COPY.alsoUseOnPrefix} ${visible.join(\", \")} and ${extra} more`;\n}\n\nexport function portableMcpTooltip(ids: readonly string[]): string {\n return `This server works anywhere. Add it to ${formatHarnessIds(ids)} too.`;\n}\n\nexport function nowOnToast(ids: readonly string[]): string {\n return `Now on ${formatHarnessIds(ids)}`;\n}\n\nexport function skippedNotUsedOnFooter(count: number, harnessId: string): string {\n return `${count} skipped. Not used on ${harnessDisplayName(harnessId)}.`;\n}\n\nexport function portableScopeTip(input: {\n resourceName: string;\n targetIds: readonly string[];\n command: string;\n}): string {\n return `Tip: \"${input.resourceName}\" also works on ${formatHarnessIds(input.targetIds)}. Run ${input.command}.`;\n}\n","import { Option, type Command } from \"commander\";\nimport { isPromptCancellationError } from \"../../services/wizards/shared.js\";\nimport { CliUsageError } from \"../../services/cli-errors.js\";\nimport { COMMAND_HELP_REGISTRY } from \"../../services/cli-help-registry.js\";\nimport { ui } from \"../../ui/index.js\";\nimport { renderCliError } from \"../runtime.js\";\nimport { fail } from \"../shared.js\";\nimport {\n handleProfileAddAllResourcesCommand,\n handleProfileAddResourceCommand,\n handleProfileCommitResourceCommand,\n handleProfileFileDiffCommand,\n handleProfileRemoveResourceCommand,\n handleProfileRestoreFileCommand,\n} from \"../handlers/profile-live-files.js\";\n\nfunction addFormatInteractiveOptions(cmd: Command): Command {\n return cmd\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .option(\"--no-interactive\", \"Disable interactive prompts\")\n .option(\"--interactive\", \"Enable interactive prompts\");\n}\n\nfunction addLiveScopeOptions(cmd: Command): Command {\n return addFormatInteractiveOptions(cmd)\n .addOption(\n new Option(\"--scope <home|project>\", \"home or project\")\n .choices([\"home\", \"project\"])\n .makeOptionMandatory(),\n )\n .option(\"--project <path>\", \"Project path (required when --scope project)\")\n .option(\"--harness <slug>\", \"Harness slug\");\n}\n\nasync function runLiveAction(work: () => Promise<void>): Promise<void> {\n try {\n await work();\n } catch (err) {\n if (isPromptCancellationError(err)) {\n ui.info(\"Operation cancelled.\");\n process.exitCode = 0;\n return;\n }\n process.exitCode = 1;\n if (err instanceof CliUsageError) {\n renderCliError(err);\n return;\n }\n fail(err instanceof Error ? err.message : String(err));\n }\n}\n\nfunction assignLiveFileHelp(): void {\n COMMAND_HELP_REGISTRY[\"profile.add-resource\"] = {\n description: \"Adopt one untracked on-disk resource into the profile library\",\n examples: [\n \"profile add-resource work --selector skill:foo --scope home\",\n \"profile add-resource work --selector skill:foo --scope project --project . --format json\",\n ],\n };\n COMMAND_HELP_REGISTRY[\"profile.add-all-resources\"] = {\n description: \"Adopt every untracked material resource in the scope\",\n examples: [\n \"profile add-all-resources work --scope home\",\n \"profile add-all-resources work --scope project --project . --format json\",\n ],\n };\n COMMAND_HELP_REGISTRY[\"profile.commit-resource\"] = {\n description: \"Snapshot live disk into the profile library\",\n examples: [\n \"profile commit-resource work --path .claude/skills/foo/SKILL.md --scope home\",\n \"profile commit-resource work --selector skill:foo --scope home --format json\",\n ],\n };\n COMMAND_HELP_REGISTRY[\"profile.remove-resource\"] = {\n description: \"Detach a material resource from the profile stack\",\n examples: [\n \"profile remove-resource work --selector skill:foo -y\",\n \"profile remove-resource work --selector skill:foo --format json -y\",\n ],\n };\n COMMAND_HELP_REGISTRY[\"profile.restore-file\"] = {\n description: \"Overwrite the live managed file with the profile snapshot\",\n examples: [\n \"profile restore-file work --path .claude/skills/foo/SKILL.md --scope home -y\",\n \"profile restore-file work --path .claude/skills/foo/SKILL.md --scope home --format json -y\",\n ],\n };\n COMMAND_HELP_REGISTRY[\"profile.file-diff\"] = {\n description: \"Show live content vs after-apply (profile) as a unified diff\",\n examples: [\n \"profile file-diff work --path .claude/skills/foo/SKILL.md --scope home\",\n \"profile file-diff work --path .claude/skills/foo/SKILL.md --scope home --format json\",\n ],\n };\n}\n\nexport function registerProfileLiveFileCommands(profileCmd: Command): void {\n assignLiveFileHelp();\n\n addLiveScopeOptions(\n profileCmd\n .command(\"add-resource\")\n .argument(\"<name>\", \"Profile plugin name or selector\")\n .requiredOption(\"--selector <type:name>\", \"Resource selector\")\n .description(\"Adopt one untracked on-disk resource into the profile library\"),\n ).action(async (name: string, opts) => {\n await runLiveAction(() => handleProfileAddResourceCommand(name, opts));\n });\n\n addLiveScopeOptions(\n profileCmd\n .command(\"add-all-resources\")\n .argument(\"<name>\", \"Profile plugin name or selector\")\n .description(\"Adopt every untracked material resource in the scope\"),\n ).action(async (name: string, opts) => {\n await runLiveAction(() => handleProfileAddAllResourcesCommand(name, opts));\n });\n\n addLiveScopeOptions(\n profileCmd\n .command(\"commit-resource\")\n .argument(\"<name>\", \"Profile plugin name or selector\")\n .option(\"--path <path>\", \"Managed relative path\")\n .option(\"--selector <type:name>\", \"Resource selector\")\n .description(\"Snapshot live disk into the profile library\"),\n ).action(async (name: string, opts) => {\n await runLiveAction(() => handleProfileCommitResourceCommand(name, opts));\n });\n\n addFormatInteractiveOptions(\n profileCmd\n .command(\"remove-resource\")\n .argument(\"<name>\", \"Profile plugin name or selector\")\n .requiredOption(\"--selector <type:name>\", \"Resource selector\")\n .option(\"--plugin-id <id>\", \"Plugin id in the profile stack\")\n .option(\"-y, --yes\", \"Skip the confirmation prompt\")\n .description(\"Detach a material resource from the profile stack\"),\n ).action(async (name: string, opts) => {\n await runLiveAction(() => handleProfileRemoveResourceCommand(name, opts));\n });\n\n addLiveScopeOptions(\n profileCmd\n .command(\"restore-file\")\n .argument(\"<name>\", \"Profile plugin name or selector\")\n .requiredOption(\"--path <path>\", \"Managed relative path\")\n .option(\"-y, --yes\", \"Skip the confirmation prompt\")\n .description(\"Overwrite the live managed file with the profile snapshot\"),\n ).action(async (name: string, opts) => {\n await runLiveAction(() => handleProfileRestoreFileCommand(name, opts));\n });\n\n addLiveScopeOptions(\n profileCmd\n .command(\"file-diff\")\n .argument(\"<name>\", \"Profile plugin name or selector\")\n .requiredOption(\"--path <path>\", \"Managed relative path\")\n .description(\"Show live content vs after-apply (profile) as a unified diff\"),\n ).action(async (name: string, opts) => {\n await runLiveAction(() => handleProfileFileDiffCommand(name, opts));\n });\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { isAbsolute, join } from \"node:path\";\nimport {\n collectExpectedManagedFiles,\n type ProfileApplyPreviewScope,\n} from \"./profile-apply-preview.js\";\nimport {\n isMcpConfigManagedPath,\n resourceKeyFromManagedPath,\n} from \"./profile-commit-resource.js\";\nimport { scopeHostConfigToResource } from \"./host-config-resource-detail.js\";\nimport { scopeMcpConfigToServer } from \"./mcp-resource-detail.js\";\nimport { isMergeableHostConfigPath } from \"./merged-host-config.js\";\nimport { normalizeManagedPath } from \"./profile-untracked-resources.js\";\n\nexport interface ManagedFileDiff {\n path: string;\n absolute_path: string;\n /** Expected content from the profile (last applied / would-apply snapshot). */\n expected: string;\n /** Current on-disk content, or null if the file is missing. */\n current: string | null;\n}\n\nconst ONE_TO_ONE_DIFF_TYPES = new Set([\"skill\", \"agent\", \"command\", \"rule\", \"instruction\"]);\nconst HOST_CONFIG_DIFF_TYPES = new Set([\"permission\", \"hook\", \"env_var\"]);\n\nfunction readLiveFile(absolutePath: string): string | null {\n if (!existsSync(absolutePath)) {\n return null;\n }\n try {\n return readFileSync(absolutePath, \"utf-8\");\n } catch {\n return null;\n }\n}\n\nfunction namesEqualIgnoreCase(left: string, right: string): boolean {\n return left.toLowerCase() === right.toLowerCase();\n}\n\nfunction pathsReferToSameManagedFile(\n left: string,\n right: string,\n rootPath: string,\n): boolean {\n const a = normalizeManagedPath(left, rootPath);\n const b = normalizeManagedPath(right, rootPath);\n if (a === b) {\n return true;\n }\n return a.endsWith(`/${b}`) || b.endsWith(`/${a}`);\n}\n\nfunction resolveLiveAbsolute(path: string, rootPath: string): string {\n const normalized = normalizeManagedPath(path, rootPath);\n if (isAbsolute(normalized)) {\n return normalized;\n }\n return join(rootPath, normalized);\n}\n\nfunction resourceMatchesFile(\n resource: { type: string; name: string },\n filePath: string,\n rootPath: string,\n): boolean {\n const mapped = resourceKeyFromManagedPath(filePath, rootPath);\n return (\n mapped !== null\n && mapped.type === resource.type\n && namesEqualIgnoreCase(mapped.name, resource.name)\n );\n}\n\nfunction findExpectedManagedFile(input: {\n expectedFiles: Array<{ path: string; content: string }>;\n requestedPath: string;\n rootPath: string;\n resource?: { type: string; name: string };\n}): { path: string; content: string } | undefined {\n const byPath = input.expectedFiles.find((file) =>\n pathsReferToSameManagedFile(file.path, input.requestedPath, input.rootPath),\n );\n const resource = input.resource;\n if (!resource?.type || !resource.name.trim()) {\n return byPath;\n }\n\n const byIdentity = input.expectedFiles.find((file) =>\n resourceMatchesFile(resource, file.path, input.rootPath),\n );\n\n if (ONE_TO_ONE_DIFF_TYPES.has(resource.type)) {\n if (byPath && resourceMatchesFile(resource, byPath.path, input.rootPath)) {\n return byPath;\n }\n return byIdentity ?? byPath;\n }\n\n if (resource.type === \"mcp_server\") {\n if (byPath && isMcpConfigManagedPath(byPath.path, input.rootPath)) {\n return byPath;\n }\n return (\n input.expectedFiles.find((file) =>\n isMcpConfigManagedPath(file.path, input.rootPath),\n )\n ?? byPath\n );\n }\n\n if (HOST_CONFIG_DIFF_TYPES.has(resource.type)) {\n if (byPath && isMergeableHostConfigPath(byPath.path)) {\n return byPath;\n }\n return (\n input.expectedFiles.find((file) => isMergeableHostConfigPath(file.path))\n ?? byPath\n );\n }\n\n return byIdentity ?? byPath;\n}\n\nfunction resolveCurrentAbsolute(input: {\n requestedPath: string;\n matchPath: string;\n rootPath: string;\n resource?: { type: string; name: string };\n}): string {\n const matchAbs = join(\n input.rootPath,\n normalizeManagedPath(input.matchPath, input.rootPath),\n );\n const requestedAbs = resolveLiveAbsolute(input.requestedPath, input.rootPath);\n if (input.resource && ONE_TO_ONE_DIFF_TYPES.has(input.resource.type)) {\n return matchAbs;\n }\n if (existsSync(requestedAbs)) {\n return requestedAbs;\n }\n return matchAbs;\n}\n\nfunction applyResourceScope(input: {\n relativePath: string;\n rootPath: string;\n expected: string;\n current: string | null;\n resource?: { type: string; name: string };\n}): { expected: string; current: string | null } {\n const resourceName = input.resource?.name.trim() ?? \"\";\n const resourceType = input.resource?.type ?? \"\";\n if (!resourceName || !resourceType) {\n return { expected: input.expected, current: input.current };\n }\n\n if (\n resourceType === \"mcp_server\"\n && isMcpConfigManagedPath(input.relativePath, input.rootPath)\n ) {\n return {\n expected: scopeMcpConfigToServer(input.expected, resourceName) ?? input.expected,\n current: scopeMcpConfigToServer(input.current, resourceName),\n };\n }\n\n if (\n HOST_CONFIG_DIFF_TYPES.has(resourceType)\n && isMergeableHostConfigPath(input.relativePath)\n ) {\n const resource = { type: resourceType, name: resourceName };\n return {\n expected: scopeHostConfigToResource(input.expected, resource) ?? input.expected,\n current: scopeHostConfigToResource(input.current, resource),\n };\n }\n\n return { expected: input.expected, current: input.current };\n}\n\nexport async function getManagedFileDiff(input: {\n profileSelector: string;\n path: string;\n scope: ProfileApplyPreviewScope;\n projectPath?: string;\n harness?: string;\n resource?: { type: string; name: string };\n}): Promise<ManagedFileDiff> {\n const profile = input.profileSelector.trim();\n const requestedPath = input.path.trim();\n\n const collected = await collectExpectedManagedFiles({\n profile,\n scope: input.scope,\n ...(input.projectPath ? { projectPath: input.projectPath } : {}),\n ...(input.harness ? { harness: input.harness } : {}),\n });\n\n if (collected.warning) {\n throw new Error(collected.warning);\n }\n\n const match = findExpectedManagedFile({\n expectedFiles: collected.expectedFiles,\n requestedPath,\n rootPath: collected.rootPath,\n ...(input.resource ? { resource: input.resource } : {}),\n });\n\n if (!match) {\n const liveAbsolute = resolveLiveAbsolute(requestedPath, collected.rootPath);\n if (\n input.resource?.type === \"agent\"\n && readLiveFile(liveAbsolute) !== null\n ) {\n const relativePath = normalizeManagedPath(liveAbsolute, collected.rootPath);\n const live = readLiveFile(liveAbsolute) ?? \"\";\n return {\n path: relativePath,\n absolute_path: liveAbsolute,\n expected: live,\n current: live,\n };\n }\n throw new Error(`Path is not a managed file for this profile: ${input.path}`);\n }\n\n const relativePath = normalizeManagedPath(match.path, collected.rootPath);\n const absolutePath = resolveCurrentAbsolute({\n requestedPath,\n matchPath: match.path,\n rootPath: collected.rootPath,\n ...(input.resource ? { resource: input.resource } : {}),\n });\n const scoped = applyResourceScope({\n relativePath,\n rootPath: collected.rootPath,\n expected: match.content,\n current: readLiveFile(absolutePath),\n ...(input.resource ? { resource: input.resource } : {}),\n });\n\n return {\n path: relativePath,\n absolute_path: absolutePath,\n expected: scoped.expected,\n current: scoped.current,\n };\n}\n","import { existsSync, readFileSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport { isEmptyBuiltinProfile, isProfilePlugin } from \"../constants/profile.js\";\nimport { resolvePluginSelector } from \"../models/plugin-model.js\";\nimport { getProjectByLocalPath, getProjectByOrigin } from \"../models/project.js\";\nimport { getLatestSnapshot } from \"../models/snapshot.js\";\nimport type { McpServerMetadata, Resource } from \"../types.js\";\nimport { resolveHomeRoot } from \"../utils/home-root.js\";\nimport { getActiveProfileName } from \"./active-profile.js\";\nimport { generateFiles } from \"./applier.js\";\nimport {\n collectOwnedPreviewResources,\n expectedFileMatchesLiveForPreview,\n omitInheritedPluginFileChanges,\n} from \"./apply-preview-inherited.js\";\nimport {\n buildHostManagedStatus,\n type HostManagedStatus,\n profileSkillNameMap,\n} from \"./cursor-host-managed-skills.js\";\nimport { fileContentsEquivalentForDrift } from \"./file-contents-drift.js\";\nimport { getGitOrigin, normalizeGitUrl } from \"./git.js\";\nimport {\n buildHarnessLiveStatusMap,\n declaredMcpFromExpectedFiles,\n type HarnessLiveStatus,\n} from \"./global-profile-status-panel.js\";\nimport {\n isMergeableHostConfigPath,\n} from \"./merged-host-config.js\";\nimport { mergePluginsForApply } from \"./plugin-apply-merge.js\";\nimport {\n type ApplyProfilePluginResult,\n applyProfilePlugin,\n clearGlobalProfileApply,\n collectProfilePluginIds,\n} from \"./profile-apply.js\";\nimport { resourceKeyFromManagedPath } from \"./profile-commit-resource.js\";\nimport {\n buildProfileContents,\n type ProfileContents,\n type ProfileContentsResource,\n} from \"./profile-contents.js\";\nimport { detectNotStagedProfileResources } from \"./profile-untracked-resources.js\";\nimport type { DriftFileChange } from \"./project-drift.js\";\nimport {\n type RecoveryAction,\n SingletonConflictError,\n UnsatisfiableConstraintError,\n} from \"./resolve/types.js\";\nimport {\n emptyPlannedRemovals,\n groupPlannedRemovals,\n type PlannedRemovalGroup,\n type PlannedRemovals,\n planSafeFileRemovals,\n} from \"./safe-file-removal.js\";\nimport { detectPlatforms } from \"./scanner.js\";\nimport { withAffectedResources } from \"./scoped-file-content-delta.js\";\n\nexport type ProfileApplyPreviewScope = \"home\" | \"project\";\n\nexport interface ProfileApplyPreviewRequest {\n profile: string;\n scope: ProfileApplyPreviewScope;\n projectPath?: string;\n harness?: string;\n}\n\nexport interface ProfileApplyPreview {\n profile: string;\n scope: ProfileApplyPreviewScope;\n contents: ProfileContents | null;\n harnesses?: Record<string, HarnessLiveStatus>;\n /** Material resources on disk not attached to the target profile (not staged). */\n not_staged: ProfileContentsResource[];\n /** @deprecated Use not_staged. */\n untracked_resources: ProfileContentsResource[];\n files: {\n expected_count: number;\n /** File changes for tracked (profile-managed) paths only. */\n changes: DriftFileChange[];\n root_path: string;\n /** Resource identities owned by the target apply set (including inherited plugin material). */\n owned_resources?: Array<{ type: string; name: string }>;\n };\n /** Planned whole-file removals grouped by ownership (DT-3). */\n removals: PlannedRemovals;\n relative_to_active: boolean;\n warning?: string;\n recovery_actions?: RecoveryAction[];\n /** App-managed inventory for home scope; never applied or persisted. */\n host_managed?: HostManagedStatus;\n}\n\nfunction warningFromError(error: unknown): {\n warning: string;\n recovery_actions?: RecoveryAction[];\n} {\n if (error instanceof UnsatisfiableConstraintError) {\n return {\n warning: error.message,\n recovery_actions: error.actions,\n };\n }\n if (error instanceof SingletonConflictError) {\n return {\n warning: error.message,\n recovery_actions: error.actions,\n };\n }\n return {\n warning: error instanceof Error ? error.message : String(error),\n };\n}\n\nfunction notProfileWarning(pluginName: string): {\n warning: string;\n recovery_actions: RecoveryAction[];\n} {\n return {\n warning: `plugin \"${pluginName}\" is not tagged as a profile`,\n recovery_actions: [\n {\n id: \"tag-as-profile\",\n label: `Tag ${pluginName} as a profile`,\n pluginName,\n },\n ],\n };\n}\n\nfunction spreadWarningFields(input: {\n warning?: string;\n recovery_actions?: RecoveryAction[];\n}): { warning?: string; recovery_actions?: RecoveryAction[] } {\n return {\n ...(input.warning ? { warning: input.warning } : {}),\n ...(input.recovery_actions ? { recovery_actions: input.recovery_actions } : {}),\n };\n}\n\nfunction readRootFile(rootPath: string, relativePath: string): string | null {\n const fullPath = join(rootPath, relativePath);\n if (!existsSync(fullPath)) {\n return null;\n }\n try {\n return readFileSync(fullPath, \"utf-8\");\n } catch {\n return null;\n }\n}\n\nfunction declaredMcpFromExpectedApply(expectedApply: ApplyProfilePluginResult): {\n namesByHarness: Record<string, string[]>;\n configsByHarness: Record<string, Record<string, McpServerMetadata>>;\n} {\n return declaredMcpFromExpectedFiles(\n expectedApply.harnesses,\n expectedApply.expected_files ?? [],\n );\n}\n\nfunction uniqueExpectedFiles(\n expectedFiles: Array<{ path: string; content: string }>,\n): Array<{ path: string; content: string }> {\n const seen = new Set<string>();\n const unique: Array<{ path: string; content: string }> = [];\n for (const file of expectedFiles) {\n if (seen.has(file.path)) {\n continue;\n }\n seen.add(file.path);\n unique.push(file);\n }\n return unique;\n}\n\nfunction compareExpectedFiles(\n rootPath: string,\n expectedFiles: Array<{ path: string; content: string }>,\n): DriftFileChange[] {\n const changes: DriftFileChange[] = [];\n const homeRoot = resolveHomeRoot();\n for (const file of uniqueExpectedFiles(expectedFiles)) {\n const current = readRootFile(rootPath, file.path);\n if (expectedFileMatchesLiveForPreview(homeRoot, file, current)) {\n continue;\n }\n if (current === null) {\n changes.push(\n withAffectedResources({ path: file.path, type: \"deleted\" }, file.content, null),\n );\n continue;\n }\n if (!fileContentsEquivalentForDrift(file.path, current, file.content)) {\n changes.push(\n withAffectedResources(\n { path: file.path, type: \"modified\" },\n file.content,\n current,\n ),\n );\n }\n }\n return changes;\n}\n\n/**\n * Hide \"would add\" gaps for alternate harness materializations when the same\n * profile resource is already present on disk under another harness path, and\n * leftover extra-harness copies when apply still keeps that resource elsewhere,\n * including extra-harness content noise when another copy already matches.\n * Apply still writes or deletes those files; File changes stays transparent.\n */\nexport function omitTransparentCrossHarnessAdds(\n rootPath: string,\n expectedFiles: Array<{ path: string; content: string }>,\n changes: DriftFileChange[],\n): DriftFileChange[] {\n const siblingPathsByResource = new Map<string, string[]>();\n for (const file of uniqueExpectedFiles(expectedFiles)) {\n const mapped = resourceKeyFromManagedPath(file.path);\n if (!mapped) {\n continue;\n }\n const key = `${mapped.type}:${mapped.name}`;\n const siblings = siblingPathsByResource.get(key) ?? [];\n siblings.push(file.path);\n siblingPathsByResource.set(key, siblings);\n }\n\n return changes.filter((change) => {\n const mapped = resourceKeyFromManagedPath(change.path);\n if (!mapped) {\n return true;\n }\n const siblings = siblingPathsByResource.get(`${mapped.type}:${mapped.name}`) ?? [];\n switch (change.type) {\n case \"deleted\": {\n const materializedElsewhere = siblings.some(\n (path) =>\n path !== change.path && readRootFile(rootPath, path) !== null,\n );\n return !materializedElsewhere;\n }\n case \"added\":\n return siblings.length === 0;\n case \"modified\": {\n const siblingMatches = siblings.some((path) => {\n if (path === change.path) {\n return false;\n }\n const expected = expectedFiles.find((file) => file.path === path);\n if (!expected) {\n return false;\n }\n const current = readRootFile(rootPath, path);\n if (current === null) {\n return false;\n }\n return fileContentsEquivalentForDrift(\n path,\n current,\n expected.content,\n );\n });\n return !siblingMatches;\n }\n default: {\n const neverType: never = change.type;\n return neverType;\n }\n }\n });\n}\n\n/**\n * Claude `.claude/settings.json` is a shared host config. Apply merges\n * profile-managed keys and never deletes the whole file, so preview must not\n * list it as a would-delete (`added`) stack item.\n */\nfunction omitMergeableHostConfigRemovals(\n changes: DriftFileChange[],\n): DriftFileChange[] {\n return changes.filter(\n (change) =>\n !(change.type === \"added\" && isMergeableHostConfigPath(change.path)),\n );\n}\n\nfunction withMappedResources(changes: DriftFileChange[]): DriftFileChange[] {\n return changes.map((change) => {\n const mapped = resourceKeyFromManagedPath(change.path);\n return mapped ? { ...change, resource: mapped } : change;\n });\n}\n\n/**\n * Map planned apply removals into File changes as drift \"added\" (on disk, not\n * expected → apply would delete). Skip paths that are already gone so Target\n * preview does not show phantom − rows.\n */\nfunction pushRemovalChange(\n next: DriftFileChange[],\n seen: Set<string>,\n rootPath: string,\n path: string,\n removal_group: PlannedRemovalGroup,\n): void {\n if (seen.has(path) || isMergeableHostConfigPath(path)) {\n return;\n }\n if (readRootFile(rootPath, path) === null) {\n return;\n }\n seen.add(path);\n next.push({ path, type: \"added\", removal_group });\n}\n\nfunction classifyPreviewRemovals(\n rootPath: string,\n removedFiles: string[] | undefined,\n skippedRemovals?: ApplyProfilePluginResult[\"skipped_removals\"],\n extraPaths: readonly string[] = [],\n): PlannedRemovals {\n const candidates = [\n ...new Set([\n ...(removedFiles ?? []),\n ...(skippedRemovals ?? [])\n .filter((skip) => skip.reason !== \"missing\")\n .map((skip) => skip.path),\n ...extraPaths,\n ]),\n ];\n const groups = groupPlannedRemovals(planSafeFileRemovals(rootPath, candidates));\n const pull = (list: string[], path: string) => {\n const index = list.indexOf(path);\n if (index >= 0) {\n list.splice(index, 1);\n }\n };\n for (const skip of skippedRemovals ?? []) {\n if (skip.reason === \"missing\") {\n continue;\n }\n if (skip.reason === \"modified\") {\n pull(groups.owned_unmodified, skip.path);\n pull(groups.unmanaged, skip.path);\n if (!groups.owned_modified.includes(skip.path)) {\n groups.owned_modified.push(skip.path);\n }\n continue;\n }\n if (skip.reason === \"unmanaged\" || skip.reason === \"preexisting\") {\n pull(groups.owned_unmodified, skip.path);\n pull(groups.owned_modified, skip.path);\n if (!groups.unmanaged.includes(skip.path)) {\n groups.unmanaged.push(skip.path);\n }\n }\n }\n return groups;\n}\n\nexport function withManagedRemovals(\n rootPath: string,\n changes: DriftFileChange[],\n removedFiles: string[] | undefined,\n skippedRemovals?: ApplyProfilePluginResult[\"skipped_removals\"],\n): DriftFileChange[] {\n const groups = classifyPreviewRemovals(\n rootPath,\n removedFiles,\n skippedRemovals,\n );\n const classified = changes.filter((change) => change.type !== \"added\");\n const seen = new Set(classified.map((change) => change.path));\n for (const path of groups.owned_unmodified) {\n pushRemovalChange(classified, seen, rootPath, path, \"owned_unmodified\");\n }\n for (const path of groups.owned_modified) {\n pushRemovalChange(classified, seen, rootPath, path, \"owned_modified\");\n }\n for (const path of groups.unmanaged) {\n pushRemovalChange(classified, seen, rootPath, path, \"unmanaged\");\n }\n return classified;\n}\n\nfunction targetPinRefs(pluginIds?: string[]): Set<string> {\n if (!pluginIds || pluginIds.length === 0) {\n return new Set();\n }\n return new Set(\n mergePluginsForApply(pluginIds).pluginPins.map((pin) => pin.ref),\n );\n}\n\nfunction buildPreviewFileChanges(\n rootPath: string,\n expectedFiles: Array<{ path: string; content: string }>,\n removedFiles: string[] | undefined,\n pluginIds?: string[],\n skippedRemovals?: ApplyProfilePluginResult[\"skipped_removals\"],\n): DriftFileChange[] {\n const mapped = withMappedResources(\n omitMergeableHostConfigRemovals(\n omitTransparentCrossHarnessAdds(\n rootPath,\n expectedFiles,\n withManagedRemovals(\n rootPath,\n compareExpectedFiles(rootPath, expectedFiles),\n removedFiles,\n skippedRemovals,\n ),\n ),\n ),\n );\n return omitInheritedPluginFileChanges(\n resolveHomeRoot(),\n mapped,\n targetPinRefs(pluginIds),\n );\n}\n\nfunction previewFilesResult(\n rootPath: string,\n expectedFiles: Array<{ path: string; content: string }>,\n removedFiles: string[] | undefined,\n pluginIds?: string[],\n skippedRemovals?: ApplyProfilePluginResult[\"skipped_removals\"],\n): ProfileApplyPreview[\"files\"] {\n return {\n expected_count: expectedFiles.length,\n changes: buildPreviewFileChanges(\n rootPath,\n expectedFiles,\n removedFiles,\n pluginIds,\n skippedRemovals,\n ),\n root_path: rootPath,\n owned_resources: collectOwnedPreviewResources(expectedFiles),\n };\n}\n\nfunction previewRemovals(\n rootPath: string,\n removedFiles: string[] | undefined,\n skippedRemovals?: ApplyProfilePluginResult[\"skipped_removals\"],\n): PlannedRemovals {\n return classifyPreviewRemovals(rootPath, removedFiles, skippedRemovals);\n}\n\nfunction isMaterialResource(resource: Resource): boolean {\n return resource.type !== \"plugin\";\n}\n\nexport interface CollectExpectedManagedFilesInput {\n profile: string;\n scope: ProfileApplyPreviewScope;\n projectPath?: string;\n harness?: string;\n}\n\nexport interface CollectExpectedManagedFilesResult {\n rootPath: string;\n expectedFiles: Array<{ path: string; content: string }>;\n warning?: string;\n recovery_actions?: RecoveryAction[];\n expectedApply?: ApplyProfilePluginResult;\n pluginIds?: string[];\n removedFiles?: string[];\n}\n\nasync function collectHomeExpectedManagedFiles(\n profile: string,\n harness?: string,\n): Promise<CollectExpectedManagedFilesResult> {\n const homeRoot = resolveHomeRoot();\n\n if (isEmptyBuiltinProfile(profile)) {\n try {\n const expectedApply = await clearGlobalProfileApply({\n dryRun: true,\n harness,\n conflictPolicy: \"replace\",\n pull: false,\n });\n return {\n rootPath: homeRoot,\n expectedFiles: uniqueExpectedFiles(expectedApply.expected_files ?? []),\n expectedApply,\n removedFiles: expectedApply.removed_files,\n };\n } catch (error) {\n return {\n rootPath: homeRoot,\n expectedFiles: [],\n ...warningFromError(error),\n };\n }\n }\n\n const plugin = resolvePluginSelector(profile);\n if (!plugin) {\n return {\n rootPath: homeRoot,\n expectedFiles: [],\n warning: `missing plugin \"${profile}\"`,\n };\n }\n if (!isProfilePlugin(plugin)) {\n return {\n rootPath: homeRoot,\n expectedFiles: [],\n ...notProfileWarning(plugin.name),\n };\n }\n\n const pluginIds = collectProfilePluginIds(plugin);\n try {\n const expectedApply = await applyProfilePlugin(profile, {\n dryRun: true,\n harness,\n conflictPolicy: \"replace\",\n pull: false,\n });\n return {\n rootPath: homeRoot,\n expectedFiles: uniqueExpectedFiles(expectedApply.expected_files ?? []),\n expectedApply,\n pluginIds,\n removedFiles: expectedApply.removed_files,\n };\n } catch (error) {\n return {\n rootPath: homeRoot,\n expectedFiles: [],\n pluginIds,\n ...warningFromError(error),\n };\n }\n}\n\nfunction snapshotPreviousPaths(resolvedRoot: string): string[] {\n const gitOriginRaw = getGitOrigin(resolvedRoot);\n const gitOrigin = gitOriginRaw ? normalizeGitUrl(gitOriginRaw) : null;\n const project =\n getProjectByLocalPath(resolvedRoot)\n ?? (gitOrigin ? getProjectByOrigin(gitOrigin) : undefined)\n ?? null;\n const snapshot = project ? getLatestSnapshot(project.id) : null;\n return snapshot\n ? Object.values(snapshot.state.platform_files).flatMap((files) =>\n Object.keys(files),\n )\n : [];\n}\n\nasync function collectProjectExpectedManagedFiles(\n profile: string,\n projectPath?: string,\n harness?: string,\n): Promise<CollectExpectedManagedFilesResult> {\n if (!projectPath) {\n return {\n rootPath: resolve(\"\"),\n expectedFiles: [],\n warning: \"projectPath is required for project scope\",\n };\n }\n\n const resolvedRoot = resolve(projectPath);\n const plugin = resolvePluginSelector(profile);\n if (!plugin) {\n return {\n rootPath: resolvedRoot,\n expectedFiles: [],\n warning: `missing plugin \"${profile}\"`,\n };\n }\n if (!isProfilePlugin(plugin) && !isEmptyBuiltinProfile(profile)) {\n return {\n rootPath: resolvedRoot,\n expectedFiles: [],\n ...notProfileWarning(plugin.name),\n };\n }\n\n const detected = detectPlatforms(resolvedRoot);\n const platformIds = harness\n ? detected.filter((id) => id === harness)\n : detected;\n\n if (isEmptyBuiltinProfile(profile) || platformIds.length === 0) {\n return {\n rootPath: resolvedRoot,\n expectedFiles: [],\n removedFiles: snapshotPreviousPaths(resolvedRoot),\n };\n }\n\n const pluginIds = collectProfilePluginIds(plugin);\n const merged = mergePluginsForApply(pluginIds);\n const material = merged.resources.filter(isMaterialResource);\n try {\n const generated = await generateFiles(material, platformIds, resolvedRoot, {\n target: \"project\",\n claudeConfig: merged.claude,\n });\n const expectedFiles = uniqueExpectedFiles(\n generated.flatMap((result) =>\n result.files.map((file) => ({ path: file.path, content: file.content })),\n ),\n );\n const previousPaths = snapshotPreviousPaths(resolvedRoot);\n const desired = new Set(expectedFiles.map((file) => file.path));\n const removedFiles = previousPaths.filter((path) => !desired.has(path));\n return {\n rootPath: resolvedRoot,\n expectedFiles,\n pluginIds,\n removedFiles,\n };\n } catch (error) {\n return {\n rootPath: resolvedRoot,\n expectedFiles: [],\n pluginIds,\n ...warningFromError(error),\n };\n }\n}\n\nexport async function collectExpectedManagedFiles(\n input: CollectExpectedManagedFilesInput,\n): Promise<CollectExpectedManagedFilesResult> {\n if (input.scope === \"project\") {\n return collectProjectExpectedManagedFiles(\n input.profile,\n input.projectPath,\n input.harness,\n );\n }\n return collectHomeExpectedManagedFiles(input.profile, input.harness);\n}\n\nasync function previewHomeApply(\n profile: string,\n harness?: string,\n): Promise<\n Pick<ProfileApplyPreview, \"harnesses\" | \"files\" | \"removals\" | \"warning\" | \"recovery_actions\">\n> {\n const collected = await collectHomeExpectedManagedFiles(profile, harness);\n\n if (collected.warning) {\n if (collected.pluginIds) {\n const merged = mergePluginsForApply(collected.pluginIds);\n const declaredMcpByHarness = {\n \"claude-code\": merged.resources\n .filter((resource) => resource.type === \"mcp_server\")\n .map((resource) => resource.name),\n cursor: merged.resources\n .filter((resource) => resource.type === \"mcp_server\")\n .map((resource) => resource.name),\n };\n return {\n harnesses: buildHarnessLiveStatusMap({\n depth: \"full\",\n homeRoot: collected.rootPath,\n declaredPins: merged.pluginPins,\n declaredMcpByHarness,\n }),\n files: {\n expected_count: 0,\n changes: withMappedResources([]),\n root_path: collected.rootPath,\n },\n removals: emptyPlannedRemovals(),\n ...spreadWarningFields(collected),\n };\n }\n return {\n files: {\n expected_count: 0,\n changes: withMappedResources([]),\n root_path: collected.rootPath,\n },\n removals: emptyPlannedRemovals(),\n ...spreadWarningFields(collected),\n };\n }\n\n if (isEmptyBuiltinProfile(profile)) {\n return {\n harnesses: buildHarnessLiveStatusMap({\n depth: \"full\",\n homeRoot: collected.rootPath,\n declaredPins: [],\n declaredMcpByHarness: {},\n }),\n files: previewFilesResult(\n collected.rootPath,\n collected.expectedFiles,\n collected.removedFiles,\n collected.pluginIds,\n collected.expectedApply?.skipped_removals,\n ),\n removals: previewRemovals(\n collected.rootPath,\n collected.removedFiles,\n collected.expectedApply?.skipped_removals,\n ),\n };\n }\n\n const declaredPins = collected.pluginIds\n ? mergePluginsForApply(collected.pluginIds).pluginPins\n : [];\n const declaredMcp = collected.expectedApply\n ? declaredMcpFromExpectedApply(collected.expectedApply)\n : { namesByHarness: {}, configsByHarness: {} };\n return {\n harnesses: buildHarnessLiveStatusMap({\n depth: \"full\",\n homeRoot: collected.rootPath,\n declaredPins,\n declaredMcpByHarness: declaredMcp.namesByHarness,\n expectedMcpConfigsByHarness: declaredMcp.configsByHarness,\n }),\n files: previewFilesResult(\n collected.rootPath,\n collected.expectedFiles,\n collected.removedFiles,\n collected.pluginIds,\n collected.expectedApply?.skipped_removals,\n ),\n removals: previewRemovals(\n collected.rootPath,\n collected.removedFiles,\n collected.expectedApply?.skipped_removals,\n ),\n };\n}\n\nasync function previewProjectApply(\n profile: string,\n projectPath?: string,\n harness?: string,\n): Promise<Pick<ProfileApplyPreview, \"files\" | \"removals\" | \"warning\" | \"recovery_actions\">> {\n const collected = await collectProjectExpectedManagedFiles(\n profile,\n projectPath,\n harness,\n );\n\n return {\n files: previewFilesResult(\n collected.rootPath,\n collected.expectedFiles,\n collected.removedFiles,\n collected.pluginIds,\n collected.expectedApply?.skipped_removals,\n ),\n removals: previewRemovals(\n collected.rootPath,\n collected.removedFiles,\n collected.expectedApply?.skipped_removals,\n ),\n ...spreadWarningFields(collected),\n };\n}\n\nexport async function previewProfileApply(\n input: ProfileApplyPreviewRequest,\n): Promise<ProfileApplyPreview> {\n const profile = input.profile.trim();\n const contents = buildProfileContents(profile);\n const relativeToActive = getActiveProfileName() === profile;\n const notStaged = await detectNotStagedProfileResources({\n profileSelector: profile,\n scope: input.scope,\n ...(input.projectPath ? { projectPath: input.projectPath } : {}),\n ...(input.harness ? { harness: input.harness } : {}),\n });\n\n if (input.scope === \"project\") {\n const projectPreview = await previewProjectApply(\n profile,\n input.projectPath,\n input.harness,\n );\n return {\n profile,\n scope: \"project\",\n contents,\n not_staged: notStaged,\n untracked_resources: notStaged,\n files: projectPreview.files,\n removals: projectPreview.removals,\n relative_to_active: relativeToActive,\n ...spreadWarningFields(projectPreview),\n };\n }\n\n const homePreview = await previewHomeApply(profile, input.harness);\n return {\n profile,\n scope: \"home\",\n contents,\n not_staged: notStaged,\n untracked_resources: notStaged,\n ...(homePreview.harnesses ? { harnesses: homePreview.harnesses } : {}),\n files: homePreview.files,\n removals: homePreview.removals,\n relative_to_active: relativeToActive,\n host_managed: buildHostManagedStatus({\n homeRoot: homePreview.files.root_path,\n profileSkills: profileSkillNameMap(contents?.resources ?? []),\n }),\n ...spreadWarningFields(homePreview),\n };\n}\n","import { findResourceByKey, getResource } from \"../models/resource.js\";\nimport type { Resource, ResourceType } from \"../types.js\";\nimport { MATERIAL_RESOURCE_TYPES } from \"../types.js\";\nimport {\n mcpConfigContentsEquivalent,\n parseMcpServersDocument,\n} from \"./mcp-config-bridge.js\";\nimport { fileContentsEquivalentForDrift } from \"./file-contents-drift.js\";\nimport { hostPluginPinIsInstalled, listHostNativeMcpNames } from \"./host-native-mcp.js\";\nimport {\n isMcpConfigManagedPath,\n resourceKeyFromManagedPath,\n} from \"./profile-commit-resource.js\";\nimport type { DriftFileChange } from \"./project-drift.js\";\n\nconst MATERIAL_TYPE_SET = new Set<string>(MATERIAL_RESOURCE_TYPES);\n\nexport interface OwnedPreviewResource {\n type: string;\n name: string;\n}\n\nfunction findMaterialResource(type: string, name: string): Resource | undefined {\n if (!MATERIAL_TYPE_SET.has(type)) {\n return undefined;\n }\n return (\n getResource(`${type}:${name}`)\n ?? findResourceByKey(type as ResourceType, name, \"\")\n );\n}\n\nfunction nativeMcpNamesForPath(homeRoot: string, path: string): Set<string> {\n const normalized = path.replace(/\\\\/g, \"/\");\n if (normalized.includes(\".cursor/\") && /(^|\\/)mcp\\.json$/i.test(normalized)) {\n return listHostNativeMcpNames(homeRoot, \"cursor\");\n }\n if (\n /(^|\\/)\\.mcp\\.json$/i.test(normalized)\n || /(^|\\/)\\.claude\\.json$/i.test(normalized)\n ) {\n return listHostNativeMcpNames(homeRoot, \"claude-code\");\n }\n return new Set();\n}\n\n/**\n * Treat host-native plugin MCP servers as already present when comparing\n * expected vs live MCP config for apply preview.\n */\nexport function mcpPreviewContentsEquivalent(\n current: string | null,\n expected: string,\n nativeNames: ReadonlySet<string>,\n): boolean {\n let expectedDocument: unknown;\n try {\n expectedDocument = JSON.parse(expected) as unknown;\n } catch {\n return false;\n }\n const expectedServers = parseMcpServersDocument(expectedDocument);\n const expectedNames = Object.keys(expectedServers);\n const nonNativeExpected = expectedNames.filter((name) => !nativeNames.has(name));\n\n if (current === null) {\n return expectedNames.length === 0 || nonNativeExpected.length === 0;\n }\n\n let currentDocument: unknown;\n try {\n currentDocument = JSON.parse(current) as unknown;\n } catch {\n return false;\n }\n const currentServers = parseMcpServersDocument(currentDocument);\n const mergedCurrent: Record<string, (typeof expectedServers)[string]> = {\n ...currentServers,\n };\n for (const name of expectedNames) {\n const expectedMeta = expectedServers[name];\n if (nativeNames.has(name) && expectedMeta && !(name in mergedCurrent)) {\n mergedCurrent[name] = expectedMeta;\n }\n }\n\n return mcpConfigContentsEquivalent(\n JSON.stringify({ mcpServers: mergedCurrent }),\n JSON.stringify({ mcpServers: expectedServers }),\n );\n}\n\nexport function collectOwnedPreviewResources(\n expectedFiles: Array<{ path: string; content: string }>,\n): OwnedPreviewResource[] {\n const order: string[] = [];\n const byKey = new Map<string, OwnedPreviewResource>();\n const add = (type: string, name: string) => {\n const key = `${type}:${name}`;\n if (byKey.has(key)) {\n return;\n }\n order.push(key);\n byKey.set(key, { type, name });\n };\n\n for (const file of expectedFiles) {\n const mapped = resourceKeyFromManagedPath(file.path);\n if (mapped) {\n add(mapped.type, mapped.name);\n }\n if (!isMcpConfigManagedPath(file.path)) {\n continue;\n }\n try {\n const document = JSON.parse(file.content) as unknown;\n for (const name of Object.keys(parseMcpServersDocument(document))) {\n add(\"mcp_server\", name);\n }\n } catch {\n // skip invalid MCP payloads\n }\n }\n\n return order\n .map((key) => byKey.get(key))\n .filter((entry): entry is OwnedPreviewResource => entry !== undefined);\n}\n\nfunction resourceIsDeployedHostPluginOwned(\n type: string,\n name: string,\n homeRoot: string,\n): { originRef: string; installed: boolean } | null {\n const resource = findMaterialResource(type, name);\n if (\n !resource\n || resource.origin_kind !== \"marketplace_link\"\n || !resource.origin_ref\n ) {\n return null;\n }\n return {\n originRef: resource.origin_ref,\n installed: hostPluginPinIsInstalled(homeRoot, resource.origin_ref),\n };\n}\n\n/**\n * Drop stack/file preview noise for resources already deployed by an installed\n * host plugin (marketplace pin). MCP config paths are handled separately.\n */\nexport function omitInheritedPluginFileChanges(\n homeRoot: string,\n changes: DriftFileChange[],\n targetPinRefs: ReadonlySet<string>,\n): DriftFileChange[] {\n return changes.filter((change) => {\n if (isMcpConfigManagedPath(change.path)) {\n return true;\n }\n const mapped = change.resource ?? resourceKeyFromManagedPath(change.path);\n if (!mapped || mapped.type === \"mcp_server\") {\n return true;\n }\n const owned = resourceIsDeployedHostPluginOwned(\n mapped.type,\n mapped.name,\n homeRoot,\n );\n if (!owned?.installed) {\n return true;\n }\n switch (change.type) {\n case \"deleted\":\n case \"modified\":\n return false;\n case \"added\":\n return !targetPinRefs.has(owned.originRef);\n default: {\n const neverType: never = change.type;\n return neverType;\n }\n }\n });\n}\n\nexport function expectedFileMatchesLiveForPreview(\n homeRoot: string,\n file: { path: string; content: string },\n current: string | null,\n): boolean {\n if (isMcpConfigManagedPath(file.path)) {\n const nativeNames = nativeMcpNamesForPath(homeRoot, file.path);\n if (nativeNames.size > 0) {\n return mcpPreviewContentsEquivalent(current, file.content, nativeNames);\n }\n }\n if (current === null) {\n return false;\n }\n return fileContentsEquivalentForDrift(file.path, current, file.content);\n}\n","import { isProfilePlugin } from \"../constants/profile.js\";\nimport {\n getPluginResources,\n removeResourceFromPlugin,\n resolvePluginSelector,\n touchPluginUpdatedAt,\n} from \"../models/plugin-model.js\";\nimport { resolveResource } from \"../models/resource.js\";\nimport { collectProfilePluginIds } from \"./profile-apply.js\";\nimport { markPluginDirty } from \"./plugin-versioning.js\";\nimport {\n type ProfileContentsResource,\n toContentsResource,\n} from \"./profile-contents.js\";\n\nconst COMPOSITION_RESOURCE_TYPES = new Set([\"plugin\"]);\n\nexport function removeResourceFromProfile(input: {\n profileSelector: string;\n resourceType: string;\n resourceName: string;\n pluginId?: string;\n}): ProfileContentsResource {\n const profilePlugin = resolvePluginSelector(input.profileSelector);\n if (!profilePlugin) {\n throw new Error(`Profile not found: ${input.profileSelector}`);\n }\n if (!isProfilePlugin(profilePlugin)) {\n throw new Error(`Plugin \"${profilePlugin.name}\" is not tagged as a profile`);\n }\n if (COMPOSITION_RESOURCE_TYPES.has(input.resourceType)) {\n throw new Error(`Cannot remove composition resource type: ${input.resourceType}`);\n }\n\n const stackPluginIds = collectProfilePluginIds(profilePlugin);\n const stackPluginIdSet = new Set(stackPluginIds);\n if (input.pluginId && !stackPluginIdSet.has(input.pluginId)) {\n throw new Error(`Plugin is not part of profile stack: ${input.pluginId}`);\n }\n\n const selector = `${input.resourceType}:${input.resourceName}`;\n const resolved = resolveResource(selector, { mode: \"compose\" });\n if (resolved.status === \"not_found\") {\n throw new Error(`Resource not found in profile: ${selector}`);\n }\n if (resolved.status === \"ambiguous\") {\n throw new Error(`Ambiguous resource selector: ${selector}`);\n }\n\n const resourceId = resolved.resource.id;\n const searchPluginIds = input.pluginId ? [input.pluginId] : stackPluginIds;\n let removedFromPluginId: string | null = null;\n for (const pluginId of searchPluginIds) {\n const attached = getPluginResources(pluginId);\n if (attached.some((resource) => resource.id === resourceId)) {\n markPluginDirty(pluginId);\n removeResourceFromPlugin(pluginId, resourceId);\n touchPluginUpdatedAt(pluginId);\n removedFromPluginId = pluginId;\n break;\n }\n }\n\n if (!removedFromPluginId) {\n throw new Error(`Resource is not attached to profile: ${selector}`);\n }\n\n return toContentsResource(resolved.resource);\n}\n","import { mkdirSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport {\n collectExpectedManagedFiles,\n type ProfileApplyPreviewScope,\n} from \"./profile-apply-preview.js\";\nimport { normalizeManagedPath } from \"./profile-untracked-resources.js\";\n\nexport async function restoreManagedFile(input: {\n profileSelector: string;\n path: string;\n scope: ProfileApplyPreviewScope;\n projectPath?: string;\n harness?: string;\n}): Promise<{ path: string; absolute_path: string }> {\n const profile = input.profileSelector.trim();\n const requestedPath = normalizeManagedPath(input.path.trim());\n\n const collected = await collectExpectedManagedFiles({\n profile,\n scope: input.scope,\n ...(input.projectPath ? { projectPath: input.projectPath } : {}),\n ...(input.harness ? { harness: input.harness } : {}),\n });\n\n if (collected.warning) {\n throw new Error(collected.warning);\n }\n\n const match = collected.expectedFiles.find((file) => {\n const normalized = normalizeManagedPath(file.path, collected.rootPath);\n return (\n normalized === requestedPath\n || normalizeManagedPath(file.path) === requestedPath\n );\n });\n\n if (!match) {\n throw new Error(`Path is not a managed file for this profile: ${input.path}`);\n }\n\n const relativePath = normalizeManagedPath(match.path, collected.rootPath);\n const absolutePath = join(collected.rootPath, relativePath);\n\n mkdirSync(dirname(absolutePath), { recursive: true });\n writeFileSync(absolutePath, match.content, \"utf-8\");\n\n return { path: relativePath, absolute_path: absolutePath };\n}\n","import { getDb } from \"../../db/connection.js\";\nimport { initializeSchema } from \"../../db/schema.js\";\nimport { missingRequiredArg } from \"../../services/cli-errors.js\";\nimport { parseResourceSelector } from \"../../services/resource-selector.js\";\nimport type { ProfileApplyPreviewScope } from \"../../services/profile-apply-preview.js\";\nimport {\n commitManagedPathFromLive,\n commitManagedResourceFromLive,\n} from \"../../services/profile-commit-resource.js\";\nimport { getManagedFileDiff } from \"../../services/profile-file-diff.js\";\nimport { removeResourceFromProfile } from \"../../services/profile-remove-resource.js\";\nimport { restoreManagedFile } from \"../../services/profile-restore-file.js\";\nimport {\n addAllUntrackedResourcesToProfile,\n addResourceToProfile,\n} from \"../../services/profile-untracked-resources.js\";\nimport {\n promptForConfirmation,\n shouldUseBrowsePicker,\n} from \"../../services/wizards/shared.js\";\nimport { ui } from \"../../ui/index.js\";\nimport { parseOutputFormat, printJson } from \"../../utils/output-format.js\";\nimport { buildUnifiedDiffLines } from \"../../utils/unified-diff.js\";\n\nexport interface LiveScopeOpts {\n scope?: string;\n project?: string;\n harness?: string;\n format?: string;\n interactive?: boolean;\n noInteractive?: boolean;\n}\n\nexport interface ConfirmOpts {\n yes?: boolean;\n format?: string;\n noInteractive?: boolean;\n}\n\nfunction initDb(): void {\n const db = getDb();\n initializeSchema(db);\n}\n\nfunction requireTypeNameSelector(\n raw: string | undefined,\n commandPath: string,\n): { type: string; name: string } {\n if (!raw) {\n throw missingRequiredArg(\"selector\", commandPath);\n }\n const parsed = parseResourceSelector(raw);\n if (!parsed.type || parsed.name.trim().length === 0) {\n throw missingRequiredArg(\"selector\", commandPath);\n }\n return { type: parsed.type, name: parsed.name };\n}\n\nfunction requireLiveScope(\n opts: LiveScopeOpts,\n commandPath: string,\n): {\n scope: ProfileApplyPreviewScope;\n projectPath?: string;\n harness?: string;\n} {\n if (opts.scope !== \"home\" && opts.scope !== \"project\") {\n throw missingRequiredArg(\"scope\", commandPath);\n }\n const harness = opts.harness?.trim();\n if (opts.scope === \"project\") {\n const projectPath = opts.project?.trim();\n if (!projectPath) {\n throw missingRequiredArg(\"project\", commandPath);\n }\n return {\n scope: opts.scope,\n projectPath,\n ...(harness ? { harness } : {}),\n };\n }\n return {\n scope: opts.scope,\n ...(harness ? { harness } : {}),\n };\n}\n\nasync function confirmOrRefuse(input: {\n message: string;\n yes?: boolean;\n format?: string;\n noInteractive?: boolean;\n}): Promise<\"proceed\" | \"cancelled\" | \"refused\"> {\n if (input.yes) {\n return \"proceed\";\n }\n if (shouldUseBrowsePicker({\n noInteractive: input.noInteractive,\n format: input.format,\n })) {\n const confirmed = await promptForConfirmation({\n message: input.message,\n default: false,\n });\n if (!confirmed) {\n ui.info(\"Operation cancelled.\");\n return \"cancelled\";\n }\n return \"proceed\";\n }\n process.exitCode = 1;\n ui.hint(\"Pass -y to confirm.\");\n return \"refused\";\n}\n\nexport async function handleProfileAddResourceCommand(\n name: string,\n opts: LiveScopeOpts & { selector?: string },\n): Promise<void> {\n initDb();\n const format = parseOutputFormat(opts.format);\n const selector = requireTypeNameSelector(opts.selector, \"profile add-resource\");\n const scope = requireLiveScope(opts, \"profile add-resource\");\n const resource = await addResourceToProfile({\n profileSelector: name,\n resourceType: selector.type,\n resourceName: selector.name,\n ...scope,\n });\n if (format === \"json\") {\n printJson({ resource });\n return;\n }\n ui.success(`Added ${selector.type}:${selector.name} to profile ${name}.`);\n}\n\nexport async function handleProfileAddAllResourcesCommand(\n name: string,\n opts: LiveScopeOpts,\n): Promise<void> {\n initDb();\n const format = parseOutputFormat(opts.format);\n const scope = requireLiveScope(opts, \"profile add-all-resources\");\n const result = await addAllUntrackedResourcesToProfile({\n profileSelector: name,\n ...scope,\n });\n if (format === \"json\") {\n printJson(result);\n return;\n }\n const noun = result.added_count === 1 ? \"resource\" : \"resources\";\n ui.success(`Added ${result.added_count} ${noun} to profile ${name}.`);\n}\n\nexport async function handleProfileCommitResourceCommand(\n name: string,\n opts: LiveScopeOpts & { path?: string; selector?: string },\n): Promise<void> {\n initDb();\n const format = parseOutputFormat(opts.format);\n const scope = requireLiveScope(opts, \"profile commit-resource\");\n const path = opts.path?.trim() ?? \"\";\n const hasSelector = Boolean(opts.selector?.trim());\n if (!path && !hasSelector) {\n throw missingRequiredArg(\"path\", \"profile commit-resource\");\n }\n\n if (path && !hasSelector) {\n const resources = await commitManagedPathFromLive({\n profileSelector: name,\n path,\n ...scope,\n });\n if (format === \"json\") {\n printJson({ resource: resources[0] ?? null, resources });\n return;\n }\n ui.success(`Committed ${path} into profile ${name}.`);\n return;\n }\n\n const selector = requireTypeNameSelector(opts.selector, \"profile commit-resource\");\n if (path) {\n const resources = await commitManagedPathFromLive({\n profileSelector: name,\n path,\n resourceType: selector.type,\n resourceName: selector.name,\n ...scope,\n });\n if (format === \"json\") {\n printJson({ resource: resources[0] ?? null, resources });\n return;\n }\n ui.success(`Committed ${path} into profile ${name}.`);\n return;\n }\n\n const resource = await commitManagedResourceFromLive({\n profileSelector: name,\n resourceType: selector.type,\n resourceName: selector.name,\n ...scope,\n });\n if (format === \"json\") {\n printJson({ resource });\n return;\n }\n ui.success(`Committed ${selector.type}:${selector.name} into profile ${name}.`);\n}\n\nexport async function handleProfileRemoveResourceCommand(\n name: string,\n opts: ConfirmOpts & { selector?: string; pluginId?: string },\n): Promise<void> {\n initDb();\n const format = parseOutputFormat(opts.format);\n const selector = requireTypeNameSelector(opts.selector, \"profile remove-resource\");\n const gate = await confirmOrRefuse({\n message: `Remove ${selector.type}:${selector.name} from profile ${name}?`,\n yes: opts.yes,\n format: opts.format,\n noInteractive: opts.noInteractive,\n });\n if (gate !== \"proceed\") {\n return;\n }\n const resource = removeResourceFromProfile({\n profileSelector: name,\n resourceType: selector.type,\n resourceName: selector.name,\n ...(opts.pluginId?.trim() ? { pluginId: opts.pluginId.trim() } : {}),\n });\n if (format === \"json\") {\n printJson({ resource });\n return;\n }\n ui.success(`Removed ${selector.type}:${selector.name} from profile ${name}.`);\n}\n\nexport async function handleProfileRestoreFileCommand(\n name: string,\n opts: LiveScopeOpts & ConfirmOpts & { path?: string },\n): Promise<void> {\n initDb();\n const format = parseOutputFormat(opts.format);\n const scope = requireLiveScope(opts, \"profile restore-file\");\n const path = opts.path?.trim() ?? \"\";\n if (!path) {\n throw missingRequiredArg(\"path\", \"profile restore-file\");\n }\n const gate = await confirmOrRefuse({\n message:\n `Overwrite ${path} with the profile version? Live edits cannot be restored.`,\n yes: opts.yes,\n format: opts.format,\n noInteractive: opts.noInteractive,\n });\n if (gate !== \"proceed\") {\n return;\n }\n const result = await restoreManagedFile({\n profileSelector: name,\n path,\n ...scope,\n });\n if (format === \"json\") {\n printJson(result);\n return;\n }\n ui.success(`Restored ${result.path}.`);\n}\n\nexport async function handleProfileFileDiffCommand(\n name: string,\n opts: LiveScopeOpts & { path?: string },\n): Promise<void> {\n initDb();\n const format = parseOutputFormat(opts.format);\n const scope = requireLiveScope(opts, \"profile file-diff\");\n const path = opts.path?.trim() ?? \"\";\n if (!path) {\n throw missingRequiredArg(\"path\", \"profile file-diff\");\n }\n const diff = await getManagedFileDiff({\n profileSelector: name,\n path,\n ...scope,\n });\n if (format === \"json\") {\n printJson({\n path: diff.path,\n absolute_path: diff.absolute_path,\n expected: diff.expected,\n current: diff.current,\n });\n return;\n }\n const lines = buildUnifiedDiffLines(diff.path, diff.current ?? \"\", diff.expected);\n console.log(lines.map((line) => line.text).join(\"\\n\"));\n}\n","import type { Command } from \"commander\";\nimport { getDb } from \"../../db/connection.js\";\nimport { initializeSchema } from \"../../db/schema.js\";\nimport { getActiveProfileName } from \"../../services/active-profile.js\";\nimport { CliUsageError, missingRequiredArg } from \"../../services/cli-errors.js\";\nimport { COMMAND_HELP_REGISTRY } from \"../../services/cli-help-registry.js\";\nimport {\n type ProfileApplyPreview,\n type ProfileApplyPreviewScope,\n previewProfileApply,\n} from \"../../services/profile-apply-preview.js\";\nimport { isPromptCancellationError } from \"../../services/wizards/shared.js\";\nimport { ui } from \"../../ui/index.js\";\nimport { parseOutputFormat, printJson } from \"../../utils/output-format.js\";\nimport { resolvePluginMutationTarget } from \"../handlers/resolve-plugin-mutation-target.js\";\nimport { renderCliError } from \"../runtime.js\";\nimport { formatCount } from \"../formatting.js\";\nimport { formatCommand } from \"../shared.js\";\nimport { SCOPE_COPY, portableScopeTip, scopeLine } from \"../../copy/scope.js\";\nimport { getHarnessPreference } from \"../../models/harness.js\";\nimport { collectProfilePluginIds } from \"../../services/profile-apply.js\";\nimport { mergePluginsForApply } from \"../../services/plugin-apply-merge.js\";\nimport { resolvePluginSelector } from \"../../models/plugin-model.js\";\nimport { registeredHarnessesOf } from \"../../services/harness-targets.js\";\nimport { resourceHarnessScope } from \"../../services/harness-scope.js\";\nimport { isPortableMcpResource } from \"../../services/mcp-target.js\";\nimport type { DriftFileChange } from \"../../services/project-drift.js\";\n\nconst CLI_PREVIEW_SCOPES = [\"home\", \"project\", \"both\"] as const;\ntype CliPreviewScope = (typeof CLI_PREVIEW_SCOPES)[number];\n\nconst PROFILE_PREVIEW_HELP = {\n description:\n \"Show apply preview for a profile (contents, files, untracked, recovery) without writing\",\n examples: [\n \"profile preview\",\n \"profile preview work --format json\",\n \"profile preview work --scope project --project .\",\n \"profile preview work --scope both\",\n ],\n} as const;\n\nfunction isCliPreviewScope(value: string): value is CliPreviewScope {\n return (CLI_PREVIEW_SCOPES as readonly string[]).includes(value);\n}\n\nfunction parseCliPreviewScope(value: string | undefined): CliPreviewScope {\n const scope = value ?? \"home\";\n if (!isCliPreviewScope(scope)) {\n throw new CliUsageError(\n `Invalid --scope value: ${scope}. Use home, project, or both.`,\n );\n }\n return scope;\n}\n\nfunction resolveProjectPathForScope(\n scope: CliPreviewScope,\n project: string | undefined,\n): string | undefined {\n if (scope === \"home\") {\n return undefined;\n }\n const projectPath = (project ?? \".\").trim();\n if (!projectPath) {\n throw new CliUsageError(\"projectPath is required for project scope\");\n }\n return projectPath;\n}\n\nasync function resolvePreviewProfileName(input: {\n name: string | undefined;\n format?: string;\n interactive?: boolean;\n noInteractive?: boolean;\n}): Promise<string | undefined> {\n const trimmed = input.name?.trim();\n if (trimmed) {\n return trimmed;\n }\n const active = getActiveProfileName();\n if (active) {\n return active;\n }\n return resolvePluginMutationTarget({\n pluginName: undefined,\n profileMode: true,\n interactive: input.interactive,\n noInteractive: input.noInteractive,\n format: input.format,\n message: \"Which profile do you want to preview?\",\n });\n}\n\nfunction engineScopes(scope: CliPreviewScope): ProfileApplyPreviewScope[] {\n switch (scope) {\n case \"home\":\n return [\"home\"];\n case \"project\":\n return [\"project\"];\n case \"both\":\n return [\"home\", \"project\"];\n default: {\n const _exhaustive: never = scope;\n return _exhaustive;\n }\n }\n}\n\nasync function loadPreview(input: {\n profile: string;\n scope: ProfileApplyPreviewScope;\n projectPath?: string;\n harness?: string;\n}): Promise<ProfileApplyPreview> {\n return previewProfileApply({\n profile: input.profile,\n scope: input.scope,\n ...(input.projectPath ? { projectPath: input.projectPath } : {}),\n ...(input.harness ? { harness: input.harness } : {}),\n });\n}\n\nfunction printInstallGaps(preview: ProfileApplyPreview): void {\n if (preview.scope !== \"home\" || !preview.harnesses) {\n return;\n }\n for (const status of Object.values(preview.harnesses)) {\n for (const plugin of status.plugins) {\n if (plugin.state === \"missing\") {\n ui.dim(`plugin ${plugin.id} not installed`);\n }\n }\n for (const mcp of status.mcp) {\n switch (mcp.state) {\n case \"missing\":\n ui.dim(`mcp ${mcp.name} not installed`);\n break;\n case \"mismatch\":\n ui.dim(`mcp ${mcp.name} different value`);\n break;\n case \"present\":\n case \"extra\":\n break;\n default: {\n const _exhaustive: never = mcp.state;\n void _exhaustive;\n break;\n }\n }\n }\n }\n}\n\nfunction printHostManagedCollisions(preview: ProfileApplyPreview): void {\n const collisionCount = preview.host_managed?.cursor?.collisions.length ?? 0;\n if (collisionCount > 0) {\n ui.warn(\n `${formatCount(collisionCount, \"Cursor host-managed skill name collision\")} with user or profile skills.`,\n );\n }\n}\n\nfunction previewChangeLabel(change: DriftFileChange): string {\n switch (change.type) {\n case \"added\":\n case \"modified\":\n return SCOPE_COPY.willWrite;\n case \"deleted\":\n return SCOPE_COPY.willRemove;\n default: {\n const unhandled: never = change.type;\n return String(unhandled);\n }\n }\n}\n\nfunction printPortableMcpTips(preview: ProfileApplyPreview): void {\n const plugin = resolvePluginSelector(preview.profile);\n if (!plugin) {\n return;\n }\n const registered = registeredHarnessesOf(getHarnessPreference());\n if (registered.length === 0) {\n return;\n }\n const resources = mergePluginsForApply(collectProfilePluginIds(plugin)).resources;\n for (const resource of resources) {\n if (!isPortableMcpResource(resource)) {\n continue;\n }\n const scope = resourceHarnessScope(resource);\n if (scope.kind !== \"subset\") {\n continue;\n }\n const extra = registered.filter((id) => !scope.harnesses.includes(id));\n if (extra.length === 0) {\n continue;\n }\n const command = formatCommand([\n \"resource\",\n \"scope\",\n resource.name,\n \"--add\",\n extra.join(\",\"),\n ]);\n ui.hint(\n portableScopeTip({\n resourceName: resource.name,\n targetIds: extra,\n command,\n }),\n );\n }\n}\n\nfunction printHumanPreview(preview: ProfileApplyPreview): void {\n ui.info(\n `Profile ${preview.profile} scope=${preview.scope} root=${preview.files.root_path}`,\n );\n if (preview.relative_to_active) {\n ui.dim(\"already active\");\n }\n\n if (preview.warning) {\n ui.warn(preview.warning);\n }\n\n ui.subheader(\"Contents\");\n const contents = preview.contents;\n const hasPlugins = (contents?.plugins.length ?? 0) > 0;\n const hasPins = (contents?.plugin_pins.length ?? 0) > 0;\n if (contents?.stack_summary) {\n ui.dim(contents.stack_summary);\n }\n if (!contents || (!hasPlugins && !hasPins)) {\n ui.hint(\"Add plugins or resources from your library.\");\n } else {\n for (const plugin of contents.plugins) {\n ui.info(`plugin ${plugin.name}@${plugin.version}`);\n for (const resource of plugin.resources) {\n const scope = resource.harness_scope\n ? scopeLine(\n Array.isArray(resource.harness_scope)\n ? { kind: \"subset\", harnesses: resource.harness_scope }\n : { kind: \"all\" },\n )\n : SCOPE_COPY.appliesToAll;\n ui.dim(` ${resource.type}:${resource.name} ${scope}`);\n }\n }\n for (const pin of contents.plugin_pins) {\n ui.info(`pin ${pin.ref}@${pin.version_constraint}`);\n }\n }\n\n ui.subheader(\"Files\");\n const changeCount = preview.files.changes.length;\n ui.dim(`${changeCount} would change · ${preview.files.expected_count} managed`);\n if (changeCount === 0) {\n ui.hint(\"No file changes.\");\n } else {\n for (const change of preview.files.changes) {\n const resource = change.resource\n ? ` [${change.resource.type}:${change.resource.name}]`\n : \"\";\n ui.info(`${previewChangeLabel(change)} ${change.path}${resource}`);\n }\n }\n printInstallGaps(preview);\n\n const untracked = preview.not_staged.length > 0\n ? preview.not_staged\n : preview.untracked_resources;\n if (untracked.length > 0) {\n ui.subheader(SCOPE_COPY.notInProfile);\n for (const resource of untracked) {\n ui.info(`${resource.type}:${resource.name} ${resource.source}`);\n }\n }\n\n if (preview.recovery_actions && preview.recovery_actions.length > 0) {\n ui.subheader(\"Recovery\");\n for (const action of preview.recovery_actions) {\n ui.warn(`${action.id} ${action.label}`);\n }\n ui.hint(\"Recovery stays interactive on apply; preview does not run these.\");\n ui.hint(\"File adopt/restore is a separate command.\");\n }\n\n printHostManagedCollisions(preview);\n printPortableMcpTips(preview);\n}\n\nexport async function handleProfilePreviewCommand(\n name: string | undefined,\n opts: {\n scope?: string;\n project?: string;\n harness?: string;\n format?: string;\n interactive?: boolean;\n noInteractive?: boolean;\n },\n): Promise<void> {\n const db = getDb();\n initializeSchema(db);\n const format = parseOutputFormat(opts.format);\n const cliScope = parseCliPreviewScope(opts.scope);\n const projectPath = resolveProjectPathForScope(cliScope, opts.project);\n const harness = opts.harness?.trim() || undefined;\n\n const resolvedName = await resolvePreviewProfileName({\n name,\n format: opts.format,\n interactive: opts.interactive,\n noInteractive: opts.noInteractive,\n });\n if (!resolvedName) {\n process.exitCode = 1;\n renderCliError(missingRequiredArg(\"name\", \"profile preview\"));\n return;\n }\n\n const scopes = engineScopes(cliScope);\n const previews: ProfileApplyPreview[] = [];\n for (const scope of scopes) {\n previews.push(\n await loadPreview({\n profile: resolvedName,\n scope,\n projectPath,\n harness,\n }),\n );\n }\n\n if (format === \"json\") {\n if (cliScope === \"both\") {\n printJson({ home: previews[0], project: previews[1] });\n } else {\n printJson(previews[0]);\n }\n return;\n }\n\n if (cliScope === \"both\") {\n const [homePreview, projectPreview] = previews;\n if (homePreview === undefined || projectPreview === undefined) {\n throw new Error(\"expected home and project apply previews\");\n }\n ui.header(\"Home\");\n printHumanPreview(homePreview);\n ui.header(\"Project\");\n printHumanPreview(projectPreview);\n return;\n }\n\n const [preview] = previews;\n if (preview === undefined) {\n throw new Error(\"expected apply preview\");\n }\n printHumanPreview(preview);\n}\n\nexport function registerProfilePreviewCommand(profileCmd: Command): void {\n COMMAND_HELP_REGISTRY[\"profile.preview\"] = {\n description: PROFILE_PREVIEW_HELP.description,\n examples: [...PROFILE_PREVIEW_HELP.examples],\n };\n\n profileCmd\n .command(\"preview\")\n .argument(\"[name]\", \"Profile plugin name or selector\")\n .option(\"--scope <home|project|both>\", \"Apply preview scope\", \"home\")\n .option(\"--project <path>\", \"Project directory for project scope\", \".\")\n .option(\"--harness <slugs>\", \"Comma-separated harness slugs forwarded to preview\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .option(\"--no-interactive\", \"Disable interactive wizards\")\n .option(\"--interactive\", \"Prompt instead of relying on explicit flags\")\n .description(PROFILE_PREVIEW_HELP.description)\n .action(async (\n name: string | undefined,\n opts: {\n scope?: string;\n project?: string;\n harness?: string;\n format?: string;\n interactive?: boolean;\n noInteractive?: boolean;\n },\n ) => {\n try {\n await handleProfilePreviewCommand(name, opts);\n } catch (error) {\n if (isPromptCancellationError(error)) {\n process.exitCode = 1;\n return;\n }\n process.exitCode = 1;\n renderCliError(error);\n }\n });\n}\n","import type { Command } from \"commander\";\nimport { registerOpenCommand } from \"./open.js\";\nimport { registerProfileLiveFileCommands } from \"./profile-live-files.js\";\nimport { registerProfilePreviewCommand } from \"./profile-preview.js\";\nimport { registerResourceDirectoriesCommand } from \"./resource-directories.js\";\n\nexport function registerParityCommands(root: Command): void {\n registerOpenCommand(root);\n}\n\nexport function registerProfileParityCommands(profileCmd: Command): void {\n registerProfilePreviewCommand(profileCmd);\n registerProfileLiveFileCommands(profileCmd);\n}\n\nexport function registerResourceParityCommands(resourceCmd: Command): void {\n registerResourceDirectoriesCommand(resourceCmd);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKO,IAAM,aAAa;AAAA,EACxB,cAAc;AAAA,EACd,UAAU;AAAA,EACV,iBAAiB;AAAA,EACjB,uBAAuB;AAAA,EACvB,OAAO;AAAA,EACP,WAAW;AAAA,EACX,MAAM;AAAA,EACN,WAAW;AAAA,EACX,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,MAAM;AAAA,EACN,aAAa;AAAA,EAC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AAM,CAAC,OAAO,IAAI;AAClB,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI,MAAM,wBAAwB;AAAA,EAC1C;AACA,oBAAkB,OAAO;AAC3B;AAEO,SAAS,8BAA8B,YAA2B;AACvE,wBAAsB,iBAAiB,IAAI;AAAA,IACzC,aAAa,qBAAqB;AAAA,IAClC,UAAU,CAAC,GAAG,qBAAqB,QAAQ;AAAA,EAC7C;AAEA,aACG,QAAQ,SAAS,EACjB,SAAS,UAAU,iCAAiC,EACpD,OAAO,+BAA+B,uBAAuB,MAAM,EACnE,OAAO,oBAAoB,uCAAuC,GAAG,EACrE,OAAO,qBAAqB,oDAAoD,EAChF,OAAO,mBAAmB,gCAAgC,OAAO,EACjE,OAAO,oBAAoB,6BAA6B,EACxD,OAAO,iBAAiB,6CAA6C,EACrE,YAAY,qBAAqB,WAAW,EAC5C,OAAO,OACN,MACA,SAQG;AACH,QAAI;AACF,YAAM,4BAA4B,MAAM,IAAI;AAAA,IAC9C,SAAS,OAAO;AACd,UAAI,0BAA0B,KAAK,GAAG;AACpC,gBAAQ,WAAW;AACnB;AAAA,MACF;AACA,cAAQ,WAAW;AACnB,qBAAe,KAAK;AAAA,IACtB;AAAA,EACF,CAAC;AACL;;;ACzYO,SAAS,8BAA8B,YAA2B;AACvE,gCAA8B,UAAU;AACxC,kCAAgC,UAAU;AAC5C;AAEO,SAAS,+BAA+B,aAA4B;AACzE,qCAAmC,WAAW;AAChD;","names":["existsSync","readFileSync","join","targetPinRefs","existsSync","readFileSync","join","relativePath","join","join"]}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import {
|
|
2
|
+
handleApplyCommand
|
|
3
|
+
} from "./chunk-WMYTBJPB.js";
|
|
4
|
+
import {
|
|
5
|
+
addApplyCommandOptions,
|
|
6
|
+
resolveProjectCompileTargets
|
|
7
|
+
} from "./chunk-VFHVXXP4.js";
|
|
8
|
+
import "./chunk-3PGC6OA3.js";
|
|
9
|
+
import "./chunk-T5VRREN4.js";
|
|
10
|
+
import "./chunk-EMTBGOR3.js";
|
|
11
|
+
import "./chunk-QIVE2YFJ.js";
|
|
12
|
+
import "./chunk-MK3Q37ZN.js";
|
|
13
|
+
import "./chunk-PMQ55GDB.js";
|
|
14
|
+
import "./chunk-QKXD3EUF.js";
|
|
15
|
+
import {
|
|
16
|
+
resolveUserPath
|
|
17
|
+
} from "./chunk-AOUDSNRK.js";
|
|
18
|
+
import "./chunk-V4IXIM3C.js";
|
|
19
|
+
import "./chunk-UYRK2H24.js";
|
|
20
|
+
import "./chunk-VZQG2JDV.js";
|
|
21
|
+
import "./chunk-4IHKBIY3.js";
|
|
22
|
+
import "./chunk-4ZUBRLSP.js";
|
|
23
|
+
import "./chunk-DJ6FN6EW.js";
|
|
24
|
+
import "./chunk-KRI4R7EM.js";
|
|
25
|
+
import "./chunk-YSXRBUR4.js";
|
|
26
|
+
import "./chunk-6P5IO4BX.js";
|
|
27
|
+
import "./chunk-BNDJJAEI.js";
|
|
28
|
+
import "./chunk-S2E4SSQV.js";
|
|
29
|
+
import "./chunk-XGTTOO4R.js";
|
|
30
|
+
import "./chunk-37E5M4JX.js";
|
|
31
|
+
import "./chunk-JQOKQKQT.js";
|
|
32
|
+
import "./chunk-3FIWOI3H.js";
|
|
33
|
+
import "./chunk-CHQGE2HF.js";
|
|
34
|
+
import "./chunk-37LQQWMF.js";
|
|
35
|
+
import "./chunk-WNLFNCOH.js";
|
|
36
|
+
import "./chunk-E5QXNU3K.js";
|
|
37
|
+
import "./chunk-NAGAJ5UM.js";
|
|
38
|
+
import "./chunk-N3WIJXXM.js";
|
|
39
|
+
import "./chunk-TNJPTUE4.js";
|
|
40
|
+
import "./chunk-KDUQMINL.js";
|
|
41
|
+
import "./chunk-2NE3QYMP.js";
|
|
42
|
+
import "./chunk-MSGAGV7B.js";
|
|
43
|
+
import "./chunk-I6XFZLTJ.js";
|
|
44
|
+
import {
|
|
45
|
+
TargetFlagError,
|
|
46
|
+
previewApmTargets
|
|
47
|
+
} from "./chunk-W7HQ5X3S.js";
|
|
48
|
+
import "./chunk-JRFUTIEH.js";
|
|
49
|
+
import "./chunk-PFUK3HJ4.js";
|
|
50
|
+
import "./chunk-WRX7CB2M.js";
|
|
51
|
+
import "./chunk-IHZUYG66.js";
|
|
52
|
+
import "./chunk-E4WRTRMH.js";
|
|
53
|
+
import "./chunk-MZQRSERO.js";
|
|
54
|
+
import "./chunk-DEJLP7QJ.js";
|
|
55
|
+
import "./chunk-TKBMHZTS.js";
|
|
56
|
+
import "./chunk-TXXDMDPN.js";
|
|
57
|
+
import "./chunk-C2IWSFF5.js";
|
|
58
|
+
import "./chunk-NPO2IG6G.js";
|
|
59
|
+
import "./chunk-5TXI6BI2.js";
|
|
60
|
+
import {
|
|
61
|
+
parseOutputFormat,
|
|
62
|
+
printJson
|
|
63
|
+
} from "./chunk-TQ2NA4Z4.js";
|
|
64
|
+
import {
|
|
65
|
+
fail,
|
|
66
|
+
failCaught,
|
|
67
|
+
formatCommand
|
|
68
|
+
} from "./chunk-NFYPBTKO.js";
|
|
69
|
+
import {
|
|
70
|
+
ui
|
|
71
|
+
} from "./chunk-ABXUKHAU.js";
|
|
72
|
+
import "./chunk-2P2EOYEW.js";
|
|
73
|
+
import "./chunk-VQVUJYYY.js";
|
|
74
|
+
import "./chunk-KLR2DURP.js";
|
|
75
|
+
|
|
76
|
+
// src/cli/commands/compile.ts
|
|
77
|
+
import { Option } from "commander";
|
|
78
|
+
async function handleCompileCommand(extraArgs, opts) {
|
|
79
|
+
if (extraArgs.length > 0) {
|
|
80
|
+
process.exitCode = 1;
|
|
81
|
+
fail(
|
|
82
|
+
"ht compile does not take a plugin selector. It reads repo-root apm.yml.",
|
|
83
|
+
{
|
|
84
|
+
hints: [formatCommand("compile"), formatCommand("apply <plugin>")]
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
await handleApplyCommand([], opts);
|
|
90
|
+
}
|
|
91
|
+
function handleTargetsCommand(opts) {
|
|
92
|
+
let projectRoot;
|
|
93
|
+
try {
|
|
94
|
+
projectRoot = resolveUserPath(opts.project ?? ".", { mustExist: true });
|
|
95
|
+
} catch (error) {
|
|
96
|
+
fail(error instanceof Error ? error.message : String(error));
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const format = opts.json ? "json" : parseOutputFormat(opts.format);
|
|
100
|
+
try {
|
|
101
|
+
const resolved = resolveProjectCompileTargets({
|
|
102
|
+
projectRoot
|
|
103
|
+
});
|
|
104
|
+
const rows = previewApmTargets(resolved, { includeAgentSkills: Boolean(opts.all) });
|
|
105
|
+
if (format === "json") {
|
|
106
|
+
printJson({
|
|
107
|
+
source: resolved.source,
|
|
108
|
+
resolved: resolved.canonicalTargets,
|
|
109
|
+
harnesses: resolved.harnessTargets,
|
|
110
|
+
warnings: resolved.warnings,
|
|
111
|
+
targets: rows
|
|
112
|
+
});
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
for (const warning of resolved.warnings) {
|
|
116
|
+
ui.warn(warning);
|
|
117
|
+
}
|
|
118
|
+
console.log(
|
|
119
|
+
ui.renderTable({
|
|
120
|
+
columns: [
|
|
121
|
+
{ key: "target", header: "TARGET", width: 14 },
|
|
122
|
+
{ key: "status", header: "STATUS", width: 10 },
|
|
123
|
+
{ key: "source", header: "SOURCE", width: 36 },
|
|
124
|
+
{ key: "deployDir", header: "DEPLOY DIR", width: 12 }
|
|
125
|
+
],
|
|
126
|
+
rows: rows.map((row) => ({
|
|
127
|
+
target: row.target,
|
|
128
|
+
status: row.status,
|
|
129
|
+
source: row.source,
|
|
130
|
+
deployDir: row.deployDir
|
|
131
|
+
}))
|
|
132
|
+
})
|
|
133
|
+
);
|
|
134
|
+
if (resolved.source === "empty") {
|
|
135
|
+
ui.info("No target is active. Declare targets: in apm.yml or add a harness config directory.");
|
|
136
|
+
}
|
|
137
|
+
} catch (error) {
|
|
138
|
+
failCaught(error, {
|
|
139
|
+
exitCode: error instanceof TargetFlagError ? 2 : 1
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function registerCompileCommand(root) {
|
|
144
|
+
const compile = root.command("compile").description("Compile local .apm/ primitives into resolved target harness directories").allowExcessArguments(true);
|
|
145
|
+
addApplyCommandOptions(compile);
|
|
146
|
+
compile.action(async (opts) => {
|
|
147
|
+
await handleCompileCommand(compile.args, opts);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
function registerTargetsCommand(root) {
|
|
151
|
+
root.command("targets").description("Show which apply harness targets resolve for this project, and why").option("--project <path>", "Project directory", ".").addOption(new Option("--json", "Emit machine-readable JSON").hideHelp()).option("--all", "Include the agent-skills meta-target row").option("--format <mode>", "Output format: human or json", "human").action((opts) => {
|
|
152
|
+
handleTargetsCommand(opts);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
export {
|
|
156
|
+
handleCompileCommand,
|
|
157
|
+
handleTargetsCommand,
|
|
158
|
+
registerCompileCommand,
|
|
159
|
+
registerTargetsCommand
|
|
160
|
+
};
|
|
161
|
+
//# sourceMappingURL=compile-J3UGQSS3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/commands/compile.ts"],"sourcesContent":["import { Option, type Command } from \"commander\";\nimport {\n addApplyCommandOptions,\n type ApplyCommandOpts,\n} from \"../../services/apply-command-options.js\";\nimport { handleApplyCommand, type ApplyCommandActionOpts } from \"./apply.js\";\nimport { resolveProjectCompileTargets } from \"../../services/compile-apm.js\";\nimport { previewApmTargets, TargetFlagError } from \"../../services/apm-targets.js\";\nimport { parseOutputFormat, printJson } from \"../../utils/output-format.js\";\nimport { resolveUserPath } from \"../../utils/user-path.js\";\nimport { ui } from \"../../ui/index.js\";\nimport {\n fail,\n failCaught,\n formatCommand,\n} from \"../shared.js\";\n\nexport interface TargetsCommandOpts {\n project?: string;\n json?: boolean;\n all?: boolean;\n format?: string;\n}\n\nexport async function handleCompileCommand(\n extraArgs: string[],\n opts: ApplyCommandActionOpts,\n): Promise<void> {\n if (extraArgs.length > 0) {\n process.exitCode = 1;\n fail(\n \"ht compile does not take a plugin selector. It reads repo-root apm.yml.\",\n {\n hints: [formatCommand(\"compile\"), formatCommand(\"apply <plugin>\")],\n },\n );\n return;\n }\n\n await handleApplyCommand([], opts);\n}\n\nexport function handleTargetsCommand(opts: TargetsCommandOpts): void {\n let projectRoot: string;\n try {\n projectRoot = resolveUserPath(opts.project ?? \".\", { mustExist: true });\n } catch (error) {\n fail(error instanceof Error ? error.message : String(error));\n return;\n }\n const format = opts.json ? \"json\" : parseOutputFormat(opts.format);\n\n try {\n const resolved = resolveProjectCompileTargets({\n projectRoot,\n });\n const rows = previewApmTargets(resolved, { includeAgentSkills: Boolean(opts.all) });\n\n if (format === \"json\") {\n printJson({\n source: resolved.source,\n resolved: resolved.canonicalTargets,\n harnesses: resolved.harnessTargets,\n warnings: resolved.warnings,\n targets: rows,\n });\n return;\n }\n\n for (const warning of resolved.warnings) {\n ui.warn(warning);\n }\n\n console.log(\n ui.renderTable({\n columns: [\n { key: \"target\", header: \"TARGET\", width: 14 },\n { key: \"status\", header: \"STATUS\", width: 10 },\n { key: \"source\", header: \"SOURCE\", width: 36 },\n { key: \"deployDir\", header: \"DEPLOY DIR\", width: 12 },\n ],\n rows: rows.map((row) => ({\n target: row.target,\n status: row.status,\n source: row.source,\n deployDir: row.deployDir,\n })),\n }),\n );\n\n if (resolved.source === \"empty\") {\n ui.info(\"No target is active. Declare targets: in apm.yml or add a harness config directory.\");\n }\n } catch (error) {\n failCaught(error, {\n exitCode: error instanceof TargetFlagError ? 2 : 1,\n });\n }\n}\n\nexport function registerCompileCommand(root: Command): void {\n const compile = root\n .command(\"compile\")\n .description(\"Compile local .apm/ primitives into resolved target harness directories\")\n .allowExcessArguments(true);\n addApplyCommandOptions(compile);\n compile.action(async (opts: ApplyCommandOpts) => {\n await handleCompileCommand(compile.args, opts);\n });\n}\n\nexport function registerTargetsCommand(root: Command): void {\n root\n .command(\"targets\")\n .description(\"Show which apply harness targets resolve for this project, and why\")\n .option(\"--project <path>\", \"Project directory\", \".\")\n .addOption(new Option(\"--json\", \"Emit machine-readable JSON\").hideHelp())\n .option(\"--all\", \"Include the agent-skills meta-target row\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .action((opts: TargetsCommandOpts) => {\n handleTargetsCommand(opts);\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,cAA4B;AAwBrC,eAAsB,qBACpB,WACA,MACe;AACf,MAAI,UAAU,SAAS,GAAG;AACxB,YAAQ,WAAW;AACnB;AAAA,MACE;AAAA,MACA;AAAA,QACE,OAAO,CAAC,cAAc,SAAS,GAAG,cAAc,gBAAgB,CAAC;AAAA,MACnE;AAAA,IACF;AACA;AAAA,EACF;AAEA,QAAM,mBAAmB,CAAC,GAAG,IAAI;AACnC;AAEO,SAAS,qBAAqB,MAAgC;AACnE,MAAI;AACJ,MAAI;AACF,kBAAc,gBAAgB,KAAK,WAAW,KAAK,EAAE,WAAW,KAAK,CAAC;AAAA,EACxE,SAAS,OAAO;AACd,SAAK,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAC3D;AAAA,EACF;AACA,QAAM,SAAS,KAAK,OAAO,SAAS,kBAAkB,KAAK,MAAM;AAEjE,MAAI;AACF,UAAM,WAAW,6BAA6B;AAAA,MAC5C;AAAA,IACF,CAAC;AACD,UAAM,OAAO,kBAAkB,UAAU,EAAE,oBAAoB,QAAQ,KAAK,GAAG,EAAE,CAAC;AAElF,QAAI,WAAW,QAAQ;AACrB,gBAAU;AAAA,QACR,QAAQ,SAAS;AAAA,QACjB,UAAU,SAAS;AAAA,QACnB,WAAW,SAAS;AAAA,QACpB,UAAU,SAAS;AAAA,QACnB,SAAS;AAAA,MACX,CAAC;AACD;AAAA,IACF;AAEA,eAA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