harnesstap 1.6.0 → 1.6.2
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 +18 -1
- package/dist/apply-REDAJFNT.js +50 -0
- package/dist/{approve-R6AWQB3I.js → approve-2VEAGEYX.js} +9 -9
- package/dist/{audit-2HNKFPSU.js → audit-2KSDWKR7.js} +9 -9
- package/dist/{auth-C54KRLNF.js → auth-VSOK5XXO.js} +7 -7
- package/dist/bin.js +2 -2
- package/dist/{chunk-A3TZT4WT.js → chunk-2AMFXAQB.js} +13 -4
- package/dist/chunk-2AMFXAQB.js.map +1 -0
- package/dist/{chunk-3277RVZT.js → chunk-32JTZAO7.js} +3 -3
- package/dist/{chunk-2XDYQXP2.js → chunk-3TIUWC2Z.js} +10 -10
- package/dist/{chunk-K4UDZUJ2.js → chunk-3YXS6AN5.js} +2 -2
- package/dist/{chunk-D7R577XZ.js → chunk-4MK2BRYB.js} +8 -8
- package/dist/{chunk-MHMFF6A5.js → chunk-4YHTVGRE.js} +2 -2
- package/dist/{chunk-5HACBPK2.js → chunk-66LQ4B65.js} +14 -14
- package/dist/{chunk-EPXAOEBB.js → chunk-6YIVNY56.js} +4 -4
- package/dist/{chunk-PCNHBMBU.js → chunk-AY55OHND.js} +2 -2
- package/dist/{chunk-ZKMSHLXP.js → chunk-B5LCF5J2.js} +2 -2
- package/dist/{chunk-HV3ENT2F.js → chunk-BRISZWFM.js} +2 -2
- package/dist/{chunk-R6VFJKZB.js → chunk-CO6YFR3D.js} +2 -2
- package/dist/{chunk-UZCAYOIQ.js → chunk-CPZM54UB.js} +7 -7
- package/dist/{chunk-OHZNDV4A.js → chunk-EA7EROYV.js} +4 -4
- package/dist/{chunk-OHZNDV4A.js.map → chunk-EA7EROYV.js.map} +1 -1
- package/dist/{chunk-MQCH3YZ5.js → chunk-FAL7MVPU.js} +5 -5
- package/dist/{chunk-42E2MPES.js → chunk-GVNXAIXG.js} +6 -6
- package/dist/{chunk-S2D5PWAO.js → chunk-HL2M67GG.js} +2 -2
- package/dist/{chunk-RQLVXJH2.js → chunk-I6KQT3PW.js} +2 -2
- package/dist/{chunk-MHLAIGIM.js → chunk-J7WZWGDH.js} +2 -2
- package/dist/{chunk-6FXJIKEG.js → chunk-JRHQSSD4.js} +4 -4
- package/dist/{chunk-WQ3F4O7U.js → chunk-LY7NVETO.js} +4 -4
- package/dist/{chunk-WQ3F4O7U.js.map → chunk-LY7NVETO.js.map} +1 -1
- package/dist/{chunk-WGVU3LA5.js → chunk-NAIB6MPR.js} +2 -12
- package/dist/chunk-NAIB6MPR.js.map +1 -0
- package/dist/{chunk-M7PHQ3UC.js → chunk-OQLNXYL5.js} +1630 -785
- package/dist/chunk-OQLNXYL5.js.map +1 -0
- package/dist/{chunk-R27VZIF6.js → chunk-Q4UO2MDZ.js} +2 -2
- package/dist/{chunk-BUA7WFI4.js → chunk-QKXPKKZO.js} +1761 -895
- package/dist/chunk-QKXPKKZO.js.map +1 -0
- package/dist/{chunk-XNS4I3W6.js → chunk-R4TM7KE5.js} +4 -4
- package/dist/{chunk-CBSDMRMY.js → chunk-RP4BBXDP.js} +2 -2
- package/dist/{chunk-GZU4LVFF.js → chunk-RV7Q6ZJZ.js} +6 -6
- package/dist/{chunk-TERYL7JH.js → chunk-S5L5KKUX.js} +20 -20
- package/dist/chunk-S5L5KKUX.js.map +1 -0
- package/dist/{chunk-QGTDQNVV.js → chunk-SBUP7UHE.js} +3 -3
- package/dist/{chunk-M6FEDSHY.js → chunk-THKF6P4Q.js} +6 -6
- package/dist/{chunk-3Q72LZPJ.js → chunk-THOVAUGF.js} +50 -53
- package/dist/chunk-THOVAUGF.js.map +1 -0
- package/dist/{chunk-V4UNYSZO.js → chunk-U3BFGU66.js} +2 -2
- package/dist/{chunk-MQCAPCAF.js → chunk-US54JBMX.js} +6 -6
- package/dist/{chunk-UC27MQ3T.js → chunk-VVU5ZFRV.js} +3 -3
- package/dist/{chunk-T4EKNX2Q.js → chunk-XIQACTMH.js} +3 -3
- package/dist/{chunk-UK2IV2ZQ.js → chunk-Y4RNG5OY.js} +2 -2
- package/dist/{chunk-R4NV3Q7G.js → chunk-YWKLUVCC.js} +2 -2
- package/dist/{chunk-L6BJCRBU.js → chunk-Z24TLVN5.js} +13 -25
- package/dist/chunk-Z24TLVN5.js.map +1 -0
- package/dist/{chunk-OWE3OSX6.js → chunk-ZEXB4ORV.js} +8 -8
- package/dist/{chunk-CR2TYMKC.js → chunk-ZQSL5DNH.js} +34 -34
- package/dist/{compile-B2QG6BAQ.js → compile-EQFNP5PS.js} +32 -32
- package/dist/{config-D3F6ICZ2.js → config-NALKAQZW.js} +11 -11
- package/dist/{cursor-local-install-4HDIBX22.js → cursor-local-install-6DRGQ6U7.js} +6 -6
- package/dist/{cursor-local-install-LL367GZY.js → cursor-local-install-KY3PVFZY.js} +3 -3
- package/dist/{doctor-QSGETVDE.js → doctor-PSFWURF6.js} +9 -9
- package/dist/{environment-2JS4RWQA.js → environment-IH6UHY5Q.js} +16 -16
- package/dist/{github-JXSTHLY2.js → github-42TN2FWA.js} +7 -7
- package/dist/{harness-GBI3AMLH.js → harness-464THUQE.js} +38 -70
- package/dist/harness-464THUQE.js.map +1 -0
- package/dist/{help-VIRMBOPJ.js → help-2WLAAUHJ.js} +2 -2
- package/dist/{help-VIRMBOPJ.js.map → help-2WLAAUHJ.js.map} +1 -1
- package/dist/{help-EC52ERIE.js → help-GITID5T7.js} +8 -8
- package/dist/{host-plugin-view-kept-XKHD6NGU.js → host-plugin-view-kept-USEF3O7L.js} +9 -9
- package/dist/index.d.ts +10 -0
- package/dist/index.js +9 -9
- package/dist/{init-OK3K6ILG.js → init-ZRBNVSSY.js} +17 -17
- package/dist/live-read-cache-EXERTB5C.js +12 -0
- package/dist/{live-read-cache-ESQQJBNS.js → live-read-cache-V7PNM5C7.js} +3 -3
- package/dist/{lock-AA2F4I3K.js → lock-FOGZUIAX.js} +8 -8
- package/dist/{marketplace-QUYCV23F.js → marketplace-HRBZHD72.js} +7 -7
- package/dist/{mcp-CIHSR4DD.js → mcp-QKKRROXZ.js} +32 -32
- package/dist/{migrate-TQPEZYS5.js → migrate-LTIWDOB4.js} +14 -14
- package/dist/{notifications-TAELTPDW.js → notifications-D7XCAXPE.js} +12 -12
- package/dist/open-DGLJYZVH.js +20 -0
- package/dist/{pack-VUO4UBWL.js → pack-K6XBNLDU.js} +8 -8
- package/dist/plugin-3V7YESUD.js +47 -0
- package/dist/plugin-from-project-QZQCQVMR.js +15 -0
- package/dist/{policy-Z5TL4N3V.js → policy-HSCKBNAV.js} +8 -8
- package/dist/{profile-QFI7SL3S.js → profile-BGYKPWC7.js} +27 -27
- package/dist/{project-3KR3EPYR.js → project-NGMOEYZY.js} +45 -78
- package/dist/project-NGMOEYZY.js.map +1 -0
- package/dist/{resource-45BPRQ7V.js → resource-C2L3SYQP.js} +23 -23
- package/dist/status-refresh-worker.js +2 -2
- package/dist/{version-QUJZGTZ5.js → version-XQS3VKYR.js} +2 -2
- package/package.json +1 -1
- package/dist/apply-FTAIL3X3.js +0 -50
- package/dist/chunk-3Q72LZPJ.js.map +0 -1
- package/dist/chunk-A3TZT4WT.js.map +0 -1
- package/dist/chunk-BUA7WFI4.js.map +0 -1
- package/dist/chunk-L6BJCRBU.js.map +0 -1
- package/dist/chunk-M7PHQ3UC.js.map +0 -1
- package/dist/chunk-TERYL7JH.js.map +0 -1
- package/dist/chunk-WGVU3LA5.js.map +0 -1
- package/dist/harness-GBI3AMLH.js.map +0 -1
- package/dist/live-read-cache-WPUFHVMZ.js +0 -12
- package/dist/open-D3GWGDSQ.js +0 -20
- package/dist/plugin-L3466DHK.js +0 -47
- package/dist/plugin-from-project-U5UGKTJH.js +0 -15
- package/dist/project-3KR3EPYR.js.map +0 -1
- /package/dist/{apply-FTAIL3X3.js.map → apply-REDAJFNT.js.map} +0 -0
- /package/dist/{approve-R6AWQB3I.js.map → approve-2VEAGEYX.js.map} +0 -0
- /package/dist/{audit-2HNKFPSU.js.map → audit-2KSDWKR7.js.map} +0 -0
- /package/dist/{auth-C54KRLNF.js.map → auth-VSOK5XXO.js.map} +0 -0
- /package/dist/{chunk-3277RVZT.js.map → chunk-32JTZAO7.js.map} +0 -0
- /package/dist/{chunk-2XDYQXP2.js.map → chunk-3TIUWC2Z.js.map} +0 -0
- /package/dist/{chunk-K4UDZUJ2.js.map → chunk-3YXS6AN5.js.map} +0 -0
- /package/dist/{chunk-D7R577XZ.js.map → chunk-4MK2BRYB.js.map} +0 -0
- /package/dist/{chunk-MHMFF6A5.js.map → chunk-4YHTVGRE.js.map} +0 -0
- /package/dist/{chunk-5HACBPK2.js.map → chunk-66LQ4B65.js.map} +0 -0
- /package/dist/{chunk-EPXAOEBB.js.map → chunk-6YIVNY56.js.map} +0 -0
- /package/dist/{chunk-PCNHBMBU.js.map → chunk-AY55OHND.js.map} +0 -0
- /package/dist/{chunk-ZKMSHLXP.js.map → chunk-B5LCF5J2.js.map} +0 -0
- /package/dist/{chunk-HV3ENT2F.js.map → chunk-BRISZWFM.js.map} +0 -0
- /package/dist/{chunk-R6VFJKZB.js.map → chunk-CO6YFR3D.js.map} +0 -0
- /package/dist/{chunk-UZCAYOIQ.js.map → chunk-CPZM54UB.js.map} +0 -0
- /package/dist/{chunk-MQCH3YZ5.js.map → chunk-FAL7MVPU.js.map} +0 -0
- /package/dist/{chunk-42E2MPES.js.map → chunk-GVNXAIXG.js.map} +0 -0
- /package/dist/{chunk-S2D5PWAO.js.map → chunk-HL2M67GG.js.map} +0 -0
- /package/dist/{chunk-RQLVXJH2.js.map → chunk-I6KQT3PW.js.map} +0 -0
- /package/dist/{chunk-MHLAIGIM.js.map → chunk-J7WZWGDH.js.map} +0 -0
- /package/dist/{chunk-6FXJIKEG.js.map → chunk-JRHQSSD4.js.map} +0 -0
- /package/dist/{chunk-R27VZIF6.js.map → chunk-Q4UO2MDZ.js.map} +0 -0
- /package/dist/{chunk-XNS4I3W6.js.map → chunk-R4TM7KE5.js.map} +0 -0
- /package/dist/{chunk-CBSDMRMY.js.map → chunk-RP4BBXDP.js.map} +0 -0
- /package/dist/{chunk-GZU4LVFF.js.map → chunk-RV7Q6ZJZ.js.map} +0 -0
- /package/dist/{chunk-QGTDQNVV.js.map → chunk-SBUP7UHE.js.map} +0 -0
- /package/dist/{chunk-M6FEDSHY.js.map → chunk-THKF6P4Q.js.map} +0 -0
- /package/dist/{chunk-V4UNYSZO.js.map → chunk-U3BFGU66.js.map} +0 -0
- /package/dist/{chunk-MQCAPCAF.js.map → chunk-US54JBMX.js.map} +0 -0
- /package/dist/{chunk-UC27MQ3T.js.map → chunk-VVU5ZFRV.js.map} +0 -0
- /package/dist/{chunk-T4EKNX2Q.js.map → chunk-XIQACTMH.js.map} +0 -0
- /package/dist/{chunk-UK2IV2ZQ.js.map → chunk-Y4RNG5OY.js.map} +0 -0
- /package/dist/{chunk-R4NV3Q7G.js.map → chunk-YWKLUVCC.js.map} +0 -0
- /package/dist/{chunk-OWE3OSX6.js.map → chunk-ZEXB4ORV.js.map} +0 -0
- /package/dist/{chunk-CR2TYMKC.js.map → chunk-ZQSL5DNH.js.map} +0 -0
- /package/dist/{compile-B2QG6BAQ.js.map → compile-EQFNP5PS.js.map} +0 -0
- /package/dist/{config-D3F6ICZ2.js.map → config-NALKAQZW.js.map} +0 -0
- /package/dist/{cursor-local-install-4HDIBX22.js.map → cursor-local-install-6DRGQ6U7.js.map} +0 -0
- /package/dist/{cursor-local-install-LL367GZY.js.map → cursor-local-install-KY3PVFZY.js.map} +0 -0
- /package/dist/{doctor-QSGETVDE.js.map → doctor-PSFWURF6.js.map} +0 -0
- /package/dist/{environment-2JS4RWQA.js.map → environment-IH6UHY5Q.js.map} +0 -0
- /package/dist/{github-JXSTHLY2.js.map → github-42TN2FWA.js.map} +0 -0
- /package/dist/{help-EC52ERIE.js.map → help-GITID5T7.js.map} +0 -0
- /package/dist/{host-plugin-view-kept-XKHD6NGU.js.map → host-plugin-view-kept-USEF3O7L.js.map} +0 -0
- /package/dist/{init-OK3K6ILG.js.map → init-ZRBNVSSY.js.map} +0 -0
- /package/dist/{live-read-cache-ESQQJBNS.js.map → live-read-cache-EXERTB5C.js.map} +0 -0
- /package/dist/{live-read-cache-WPUFHVMZ.js.map → live-read-cache-V7PNM5C7.js.map} +0 -0
- /package/dist/{lock-AA2F4I3K.js.map → lock-FOGZUIAX.js.map} +0 -0
- /package/dist/{marketplace-QUYCV23F.js.map → marketplace-HRBZHD72.js.map} +0 -0
- /package/dist/{mcp-CIHSR4DD.js.map → mcp-QKKRROXZ.js.map} +0 -0
- /package/dist/{migrate-TQPEZYS5.js.map → migrate-LTIWDOB4.js.map} +0 -0
- /package/dist/{notifications-TAELTPDW.js.map → notifications-D7XCAXPE.js.map} +0 -0
- /package/dist/{open-D3GWGDSQ.js.map → open-DGLJYZVH.js.map} +0 -0
- /package/dist/{pack-VUO4UBWL.js.map → pack-K6XBNLDU.js.map} +0 -0
- /package/dist/{plugin-L3466DHK.js.map → plugin-3V7YESUD.js.map} +0 -0
- /package/dist/{plugin-from-project-U5UGKTJH.js.map → plugin-from-project-QZQCQVMR.js.map} +0 -0
- /package/dist/{policy-Z5TL4N3V.js.map → policy-HSCKBNAV.js.map} +0 -0
- /package/dist/{profile-QFI7SL3S.js.map → profile-BGYKPWC7.js.map} +0 -0
- /package/dist/{resource-45BPRQ7V.js.map → resource-C2L3SYQP.js.map} +0 -0
- /package/dist/{version-QUJZGTZ5.js.map → version-XQS3VKYR.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
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 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 isTransparentCrossHarnessGap,\n resourceScopesForPlugins,\n} from \"./cross-harness-gap.js\";\nimport {\n buildHostManagedStatus,\n type HostManagedStatus,\n profileSkillNameMap,\n} from \"./cursor-host-managed-skills.js\";\nimport { binaryExpectedFileMatchesDisk, fileContentsEquivalentForDrift } from \"./file-contents-drift.js\";\nimport { isNativeAgentPluginCachePath } from \"./native-agent-plugins.js\";\nimport { getGitOrigin, normalizeGitUrl } from \"./git.js\";\nimport {\n buildHarnessLiveStatusMap,\n declaredMcpFromExpectedFiles,\n type HarnessLiveStatus,\n} from \"./global-profile-status-panel.js\";\nimport type { HarnessScope } from \"./harness-scope.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<T extends { path: string; content: string }>(\n expectedFiles: T[],\n): T[] {\n const seen = new Set<string>();\n const unique: T[] = [];\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; encoding?: \"utf8\" | \"base64\" }>,\n): DriftFileChange[] {\n const changes: DriftFileChange[] = [];\n const homeRoot = resolveHomeRoot();\n for (const file of uniqueExpectedFiles(expectedFiles)) {\n if (isNativeAgentPluginCachePath(file.path)) continue;\n if (binaryExpectedFileMatchesDisk(join(rootPath, file.path), file)) continue;\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 scopeByResource?: ReadonlyMap<string, HarnessScope>,\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 onDiskSiblingPaths = siblings.filter(\n (path) =>\n path !== change.path && readRootFile(rootPath, path) !== null,\n );\n return !isTransparentCrossHarnessGap({\n path: change.path,\n onDiskSiblingPaths,\n scope: scopeByResource?.get(`${mapped.type}:${mapped.name}`),\n });\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 annotateKeptContentDiffs(classified, groups);\n}\n\n/**\n * A content diff that apply will skip (user-modified or unmanaged) is a keep,\n * same groups as the confirm dialog. It must not stay labeled as a write.\n */\nfunction annotateKeptContentDiffs(\n changes: DriftFileChange[],\n groups: PlannedRemovals,\n): DriftFileChange[] {\n if (groups.owned_modified.length === 0 && groups.unmanaged.length === 0) {\n return changes;\n }\n const modified = new Set(groups.owned_modified);\n const unmanaged = new Set(groups.unmanaged);\n return changes.map((change) => {\n if (change.type !== \"modified\" || change.removal_group) {\n return change;\n }\n if (modified.has(change.path)) {\n return { ...change, removal_group: \"owned_modified\" as const };\n }\n if (unmanaged.has(change.path)) {\n return { ...change, removal_group: \"unmanaged\" as const };\n }\n return change;\n });\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 resourceScopesForPlugins(pluginIds),\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 { portableScopeTip, SCOPE_COPY, scopeLine } from \"../../copy/scope.js\";\nimport { getDb } from \"../../db/connection.js\";\nimport { initializeSchema } from \"../../db/schema.js\";\nimport { getHarnessPreference } from \"../../models/harness.js\";\nimport { resolvePluginSelector } from \"../../models/plugin-model.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 { resourceHarnessScope } from \"../../services/harness-scope.js\";\nimport { registeredHarnessesOf } from \"../../services/harness-targets.js\";\nimport { isPortableMcpResource } from \"../../services/mcp-target.js\";\nimport { mergePluginsForApply } from \"../../services/plugin-apply-merge.js\";\nimport { collectProfilePluginIds } from \"../../services/profile-apply.js\";\nimport {\n type ProfileApplyPreview,\n type ProfileApplyPreviewScope,\n previewProfileApply,\n} from \"../../services/profile-apply-preview.js\";\nimport { type DriftFileChange, driftChangeIsKept } from \"../../services/project-drift.js\";\nimport { isPromptCancellationError } from \"../../services/wizards/shared.js\";\nimport { ui } from \"../../ui/index.js\";\nimport { parseOutputFormat, printJson } from \"../../utils/output-format.js\";\nimport { formatCount } from \"../formatting.js\";\nimport { resolvePluginMutationTarget } from \"../handlers/resolve-plugin-mutation-target.js\";\nimport { renderCliError } from \"../runtime.js\";\nimport { formatCommand } from \"../shared.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 if (driftChangeIsKept(change)) {\n return previewRemovalLabel(change.removal_group);\n }\n switch (change.type) {\n case \"deleted\":\n case \"modified\":\n return SCOPE_COPY.willWrite;\n case \"added\":\n return previewRemovalLabel(change.removal_group);\n default: {\n const unhandled: never = change.type;\n return String(unhandled);\n }\n }\n}\n\nfunction previewRemovalLabel(\n group: DriftFileChange[\"removal_group\"],\n): string {\n switch (group) {\n case \"owned_modified\":\n return SCOPE_COPY.keptYouChanged;\n case \"unmanaged\":\n return SCOPE_COPY.keptNotMadeByHarnessTap;\n case \"owned_unmodified\":\n case undefined:\n return SCOPE_COPY.willRemove;\n default: {\n const unhandled: never = group;\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 keptCount = preview.files.changes.filter((change) => driftChangeIsKept(change)).length;\n const wouldChange = preview.files.changes.length - keptCount;\n const keptSuffix = keptCount > 0 ? ` · ${keptCount} kept` : \"\";\n ui.dim(\n `${wouldChange} would change${keptSuffix} · ${preview.files.expected_count} managed`,\n );\n if (preview.files.changes.length === 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,iBAAiB;AAAA,EACjB,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,gBAAgB;AAAA,EAChB,yBAAyB;AAC3B;AAEO,SAAS,mBAAmB,IAAoB;AACrD,SAAO,YAAY,EAAE,GAAG,QAAQ;AAClC;AAGO,SAAS,kBAAkB,OAAkC;AAClE,MAAI,MAAM,WAAW,GAAG;AACtB,WAAO;AAAA,EACT;AACA,MAAI,MAAM,WAAW,GAAG;AACtB,WAAO,MAAM,CAAC,KAAK;AAAA,EACrB;AACA,MAAI,MAAM,WAAW,GAAG;AACtB,WAAO,GAAG,MAAM,CAAC,CAAC,QAAQ,MAAM,CAAC,CAAC;AAAA,EACpC;AACA,SAAO,GAAG,MAAM,MAAM,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,QAAQ,MAAM,MAAM,SAAS,CAAC,CAAC;AACxE;AAEO,SAAS,iBAAiB,KAAgC;AAC/D,SAAO,kBAAkB,IAAI,IAAI,kBAAkB,CAAC;AACtD;AAMO,SAAS,gBAAgB,KAAgC;AAC9D,MAAI,IAAI,WAAW,GAAG;AACpB,WAAO,WAAW;AAAA,EACpB;AACA,MAAI,IAAI,UAAU,GAAG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AAW;AACnB;AAAA,MACF;AACA,cAAQ,WAAW;AACnB,qBAAe,KAAK;AAAA,IACtB;AAAA,EACF,CAAC;AACL;;;AClaO,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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/on-conflict.ts","../src/cli/shared.ts","../src/cli/user-errors.ts"],"sourcesContent":["/** Shared --on-conflict vocabulary (DS-6). Hidden aliases for one release: overwrite, ignore, fail. */\n\nexport const ON_CONFLICT_VALUES = [\"replace\", \"skip\", \"prompt\", \"cancel\"] as const;\nexport type OnConflictValue = (typeof ON_CONFLICT_VALUES)[number];\n\nexport const ON_CONFLICT_HELP =\n \"What to do when it already exists: replace, skip, prompt or cancel. overwrite, ignore and fail are aliases\";\n\nexport const ON_CONFLICT_PLUGIN_IMPORT_HELP =\n \"What to do when it already exists: replace, skip, prompt, cancel or merge. overwrite, ignore and fail are aliases\";\n\n/** Apply, profile, and project: non-interactive default is cancel. Pass --on-conflict replace in CI. */\nexport const ON_CONFLICT_APPLY_HELP =\n \"What to do when it already exists: replace, skip, prompt or cancel. overwrite, ignore and fail are aliases. Non-interactive default: cancel\";\n\nexport const ON_CONFLICT_VALUE_HELP = {\n replace: \"Replace the existing one\",\n skip: \"Keep the existing one and move on\",\n prompt: \"Ask each time\",\n cancel: \"Stop without changing anything\",\n merge: \"Merge with the existing plugin (plugin import only)\",\n} as const;\n\nfunction mapAlias(value: string): string {\n switch (value) {\n case \"overwrite\":\n return \"replace\";\n case \"ignore\":\n return \"skip\";\n case \"fail\":\n return \"cancel\";\n default:\n return value;\n }\n}\n\nexport function parseOnConflict(\n value: string | undefined,\n opts?: { allowMerge?: boolean },\n): OnConflictValue | \"merge\" | undefined {\n if (!value) {\n return undefined;\n }\n const mapped = mapAlias(value);\n switch (mapped) {\n case \"replace\":\n case \"skip\":\n case \"prompt\":\n case \"cancel\":\n return mapped;\n case \"merge\":\n if (opts?.allowMerge) {\n return \"merge\";\n }\n throw new Error(`Invalid --on-conflict value: ${value}. Use replace, skip, prompt or cancel.`);\n default:\n throw new Error(\n opts?.allowMerge\n ? `Invalid --on-conflict value: ${value}. Use replace, skip, prompt, cancel or merge.`\n : `Invalid --on-conflict value: ${value}. Use replace, skip, prompt or cancel.`,\n );\n }\n}\n\nexport function toResourceSyncOnConflict(\n value: OnConflictValue | \"merge\" | undefined,\n): \"overwrite\" | \"ignore\" | \"fail\" | undefined {\n if (!value || value === \"merge\" || value === \"prompt\") {\n return undefined;\n }\n switch (value) {\n case \"replace\":\n return \"overwrite\";\n case \"skip\":\n return \"ignore\";\n case \"cancel\":\n return \"fail\";\n default: {\n const _exhaustive: never = value;\n return _exhaustive;\n }\n }\n}\n\nexport function toPluginImportOnConflict(\n value: OnConflictValue | \"merge\" | undefined,\n): \"overwrite\" | \"cancel\" | \"merge\" | undefined {\n if (!value) {\n return undefined;\n }\n switch (value) {\n case \"replace\":\n return \"overwrite\";\n case \"cancel\":\n case \"skip\":\n return \"cancel\";\n case \"merge\":\n return \"merge\";\n case \"prompt\":\n return \"cancel\";\n default: {\n const _exhaustive: never = value;\n return _exhaustive;\n }\n }\n}\n","import { basename } from \"node:path\";\nimport { CliUsageError } from \"../services/cli-errors.js\";\nimport { ensureErrorPrefix } from \"./messages.js\";\nimport { isCommanderError, mapUserFacingError } from \"./user-errors.js\";\n\nexport const GUIDE_SCENARIOS_URL =\n \"https://github.com/harnesstap/harnesstap/blob/main/docs/scenarios/scenarios.md\";\n\nexport const GIT_ORIGIN_HINTS = [\n \"Add a remote: git remote add origin <url>\",\n \"Snapshots, drift, history, and revert require a git repository with origin configured.\",\n];\n\nexport function resolveInvocationName(): \"harnesstap\" | \"ht\" {\n return basename(process.argv[1] ?? \"\") === \"ht\" ? \"ht\" : \"harnesstap\";\n}\n\nexport function shellQuote(value: string): string {\n if (value.length === 0) {\n return '\"\"';\n }\n if (/^[A-Za-z0-9_./:@+=,-]+$/.test(value)) {\n return value;\n }\n return `\"${value.replaceAll(\"\\\\\", \"\\\\\\\\\").replaceAll(\"\\\"\", \"\\\\\\\"\")}\"`;\n}\n\n/** DS-6: hints always say `ht` and shell-quote each argument (W2-1, W3-3). */\nexport function formatCommand(pathOrArgs: string | readonly string[]): string {\n if (typeof pathOrArgs === \"string\") {\n const trimmed = pathOrArgs.trim();\n const stripped = trimmed.replace(/^(?:harnesstap|ht)\\s+/, \"\");\n return stripped.length > 0 ? `ht ${stripped}` : \"ht\";\n }\n return [\"ht\", ...pathOrArgs.map(shellQuote)].join(\" \");\n}\n\nexport function formatHintCommand(args: readonly string[]): string {\n return formatCommand(args);\n}\n\nexport function fail(\n message: string,\n opts?: { hint?: string; hints?: string[]; exitCode?: number },\n): void {\n process.exitCode = opts?.exitCode ?? 1;\n const error = ensureErrorPrefix(message);\n console.error(error);\n const hints = opts?.hints ?? (opts?.hint ? [opts.hint] : []);\n // A hint that only repeats the error (for example a mapped git failure) is skipped.\n const printed = new Set([error]);\n for (const hint of hints) {\n if (hint.trim().length === 0) continue;\n const key = ensureErrorPrefix(hint);\n if (printed.has(key)) continue;\n printed.add(key);\n console.error(hint);\n }\n}\n\nfunction hintsFromError(error: unknown): string[] {\n if (!error || typeof error !== \"object\" || !(\"hints\" in error)) return [];\n const raw = (error as { hints?: unknown }).hints;\n if (!Array.isArray(raw)) return [];\n return raw.filter(\n (hint): hint is string => typeof hint === \"string\" && hint.trim().length > 0,\n );\n}\n\nexport function failCaught(error: unknown, opts?: { exitCode?: number }): void {\n if (error instanceof CliUsageError) {\n fail(error.message, {\n hint: error.hints[0],\n exitCode: opts?.exitCode ?? error.exitCode,\n });\n return;\n }\n const mapped = mapUserFacingError(error);\n const commanderHint = isCommanderError(error)\n ? undefined\n : mapped.hint;\n const ownHints = hintsFromError(error);\n const hints = commanderHint\n ? [commanderHint, ...ownHints.filter((hint) => hint !== commanderHint)]\n : ownHints;\n fail(mapped.message, {\n hints,\n exitCode: opts?.exitCode ?? mapped.exitCode,\n });\n}\n\n/** DS-6: packaged help and scenario playbooks always show `ht`. */\nexport function formatScenarioCommand(path: string): string {\n const trimmed = path.trim();\n const stripped = trimmed.replace(/^(?:harnesstap|ht)\\s+/, \"\");\n return stripped.length > 0 ? `ht ${stripped}` : \"ht\";\n}\n\nexport function collectRepeatedOption(value: string, previous: string[]): string[] {\n return [...previous, value];\n}\n\nexport function reportNoGitOrigin(_retryCommand?: string): void {\n fail(\"No git remote origin configured.\", {\n hint: GIT_ORIGIN_HINTS[0],\n });\n}\n\nexport function isVerboseMode(argv: string[] = process.argv): boolean {\n return argv.includes(\"-v\") || argv.includes(\"--verbose\");\n}\n\nexport function isGroupedCommandFallbackError(error: unknown): error is {\n code: string;\n exitCode: number;\n message: string;\n} {\n if (!error || typeof error !== \"object\") {\n return false;\n }\n\n const candidate = error as {\n code?: unknown;\n exitCode?: unknown;\n message?: unknown;\n };\n\n return candidate.code === \"commander.excessArguments\"\n && candidate.exitCode === 1\n && typeof candidate.message === \"string\"\n && /too many arguments for '(plugin|resource|plugin|auth|migrate|harness|environment|profile)'/i.test(candidate.message);\n}\n","import { CLI_ERRORS, CLI_HINTS } from \"./messages.js\";\nimport { gitFailureHint, mapGitStderr } from \"../utils/git-errors.js\";\n\nexport { gitFailureHint, mapGitStderr } from \"../utils/git-errors.js\";\n\nexport interface MappedCliError {\n message: string;\n hint?: string;\n exitCode: number;\n}\n\nfunction nodePathFromEnoent(error: Error): string | undefined {\n if (\"path\" in error && typeof error.path === \"string\" && error.path.length > 0) {\n return error.path;\n }\n const match = /ENOENT: no such file or directory, (?:stat|open|scandir|mkdir|unlink) '([^']+)'/.exec(\n error.message,\n );\n return match?.[1];\n}\n\nexport function isSqliteUniqueError(error: unknown): boolean {\n if (!error || typeof error !== \"object\") {\n return false;\n }\n const candidate = error as { code?: unknown; message?: unknown };\n const code = typeof candidate.code === \"string\" ? candidate.code : \"\";\n const message = typeof candidate.message === \"string\" ? candidate.message : \"\";\n return (\n code === \"SQLITE_CONSTRAINT_UNIQUE\"\n || code === \"SQLITE_CONSTRAINT\"\n || message.includes(\"UNIQUE constraint failed\")\n );\n}\n\nfunction mapSqliteUnique(message: string): MappedCliError {\n if (message.includes(\"plugins.\")) {\n return {\n message: CLI_ERRORS.uniqueConstraintGeneric.replace(\n \"That name already exists.\",\n \"A plugin with that name already exists.\",\n ),\n hint: CLI_HINTS.onConflictReplace,\n exitCode: 1,\n };\n }\n if (message.includes(\"environments\")) {\n return {\n message: \"An environment with that name already exists.\",\n hint: CLI_HINTS.onConflictReplace,\n exitCode: 1,\n };\n }\n return {\n message: CLI_ERRORS.uniqueConstraintGeneric,\n hint: CLI_HINTS.onConflictReplace,\n exitCode: 1,\n };\n}\n\nfunction commanderExitCode(error: unknown): number {\n if (error && typeof error === \"object\" && \"exitCode\" in error) {\n const raw = (error as { exitCode?: unknown }).exitCode;\n if (typeof raw === \"number\" && raw > 0) {\n return raw;\n }\n }\n return 1;\n}\n\nexport function isCommanderError(error: unknown): boolean {\n if (!error || typeof error !== \"object\" || !(\"code\" in error)) {\n return false;\n }\n return String((error as { code?: unknown }).code ?? \"\").startsWith(\"commander.\");\n}\n\nexport function mapUserFacingError(error: unknown): MappedCliError {\n const exitCode = commanderExitCode(error);\n\n if (error instanceof Error && isSqliteUniqueError(error)) {\n return { ...mapSqliteUnique(error.message), exitCode };\n }\n\n if (error instanceof Error) {\n const code = \"code\" in error ? String((error as { code?: unknown }).code ?? \"\") : \"\";\n if (code === \"ENOENT\") {\n const filePath = nodePathFromEnoent(error);\n return {\n message: CLI_ERRORS.fileNotFound(filePath ?? \"that path\"),\n exitCode,\n };\n }\n const lower = error.message.toLowerCase();\n if (\n lower.includes(\"could not read username\")\n || lower.includes(\"terminal prompts disabled\")\n || lower.includes(\"authentication failed\")\n || /\\bfatal:/.test(lower)\n || error.message.startsWith(\"Couldn't reach\")\n ) {\n return {\n message: mapGitStderr(error.message),\n hint: gitFailureHint(),\n exitCode,\n };\n }\n return { message: error.message, exitCode };\n }\n\n return { message: String(error), exitCode };\n}\n\nexport function commanderHelpHint(commandPath: string): string {\n return CLI_HINTS.seeOptions(commandPath);\n}\n"],"mappings":";;;;;;;;;;AAKO,IAAM,mBACX;AAEK,IAAM,iCACX;AAGK,IAAM,yBACX;AAEK,IAAM,yBAAyB;AAAA,EACpC,SAAS;AAAA,EACT,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,OAAO;AACT;AAEA,SAAS,SAAS,OAAuB;AACvC,UAAQ,OAAO;AAAA,IACb,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEO,SAAS,gBACd,OACA,MACuC;AACvC,MAAI,CAAC,OAAO;AACV,WAAO;AAAA,EACT;AACA,QAAM,SAAS,SAAS,KAAK;AAC7B,UAAQ,QAAQ;AAAA,IACd,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,UAAI,MAAM,YAAY;AACpB,eAAO;AAAA,MACT;AACA,YAAM,IAAI,MAAM,gCAAgC,KAAK,wCAAwC;AAAA,IAC/F;AACE,YAAM,IAAI;AAAA,QACR,MAAM,aACF,gCAAgC,KAAK,kDACrC,gCAAgC,KAAK;AAAA,MAC3C;AAAA,EACJ;AACF;AAEO,SAAS,yBACd,OAC6C;AAC7C,MAAI,CAAC,SAAS,UAAU,WAAW,UAAU,UAAU;AACrD,WAAO;AAAA,EACT;AACA,UAAQ,OAAO;AAAA,IACb,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,SAAS;AACP,YAAM,cAAqB;AAC3B,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ACT;AAEA,QAAM,YAAY;AAMlB,SAAO,UAAU,SAAS,+BACrB,UAAU,aAAa,KACvB,OAAO,UAAU,YAAY,YAC7B,8FAA8F,KAAK,UAAU,OAAO;AAC3H;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/commands/harness.ts","../src/services/harness-union-sync.ts","../src/services/harness-sync-preview.ts","../src/services/instruction-file-links.ts"],"sourcesContent":["import { resolve } from \"node:path\";\nimport { Option, type Command } from \"commander\";\nimport { loadSettings } from \"../../config/settings.js\";\nimport { getDb, getHarnesstapDir } from \"../../db/connection.js\";\nimport { initializeSchema } from \"../../db/schema.js\";\nimport {\n getHarnessPreference,\n getProjectHarnessConfig,\n setHarnessPreference,\n setProjectHarnessConfig,\n} from \"../../models/harness.js\";\nimport { getProjectByOrigin, upsertProject } from \"../../models/project.js\";\nimport { getAllPlatforms } from \"../../platforms/registry.js\";\nimport {\n getGitOrigin,\n normalizeGitUrl,\n projectNameFromUrl,\n} from \"../../services/git.js\";\nimport { resolveHarnessSelection } from \"../../services/harness-config.js\";\nimport {\n syncConfiguredHarnesses,\n} from \"../../services/harness-union-sync.js\";\nimport { getDedicatedSerializerPlatformIds } from \"../../services/platform-serializers.js\";\nimport {\n DEFAULT_PLUGIN_RESOURCE_MODE,\n parsePluginResourceMode,\n} from \"../../services/plugin-resource-mode.js\";\nimport { detectPlatforms } from \"../../services/scanner.js\";\nimport { registeredHarnessesOf } from \"../../services/harness-targets.js\";\nimport { shouldUseWizard } from \"../../services/wizards/shared.js\";\nimport { ui } from \"../../ui/index.js\";\nimport { parseOutputFormat, printJson } from \"../../utils/output-format.js\";\nimport { formatCount } from \"../formatting.js\";\nimport { parseHarnessList } from \"../handlers/parse-flags.js\";\nimport { configureCommandGroup } from \"../help.js\";\nimport {\n fail,\n formatCommand,\n reportNoGitOrigin,\n} from \"../shared.js\";\n\nconst NATIVE_HARNESS_IDS = new Set(getDedicatedSerializerPlatformIds());\n\nfunction handleHarnessListCommand(\n opts: { format?: string; supported?: boolean } = {},\n): void {\n const format = parseOutputFormat(opts.format);\n const platforms = getAllPlatforms().filter(\n (platform) => !opts.supported || NATIVE_HARNESS_IDS.has(platform.id),\n );\n if (format === \"json\") {\n printJson(\n platforms.map((platform) => ({\n id: platform.id,\n name: platform.name,\n supports: [...platform.supports].sort(),\n })),\n );\n return;\n }\n const rows = platforms.map((p) => ({\n id: p.id,\n name: p.name,\n supports: [...p.supports].join(\", \"),\n }));\n ui.table.print({\n columns: [\n { key: \"id\", header: \"ID\", width: 20 },\n { key: \"name\", header: \"NAME\", width: 20 },\n { key: \"supports\", header: \"SUPPORTS\", width: 40 },\n ],\n rows,\n summary: `${platforms.length} harnesses`,\n empty: \"No harnesses found.\",\n });\n}\n\nasync function handleHarnessSetCommand(opts: {\n harnesses?: string;\n main?: string;\n aliases?: string;\n interactive?: boolean;\n noInteractive?: boolean;\n}): Promise<void> {\n const db = getDb();\n initializeSchema(db);\n const useWizard = shouldUseWizard({\n interactive: opts.interactive,\n noInteractive: opts.noInteractive,\n missingRequiredArgs: !opts.harnesses && !opts.main && !opts.aliases,\n });\n const selection = await resolveHarnessSelection({\n harnesses: parseHarnessList(opts.harnesses),\n main: opts.main,\n aliases: parseHarnessList(opts.aliases),\n nonInteractive: !useWizard,\n current: getHarnessPreference(),\n });\n const saved = setHarnessPreference(selection);\n ui.success(\n `Set harness preference ${ui.icons.hint} ${ui.theme.accent(registeredHarnessesOf(saved).join(\", \"))}`,\n );\n}\n\nfunction handleHarnessStatusCommand(opts: { format?: string }): void {\n const db = getDb();\n initializeSchema(db);\n const format = parseOutputFormat(opts.format);\n const preference = getHarnessPreference();\n if (format === \"json\") {\n printJson(\n preference ?? {\n registered_harnesses: [],\n },\n );\n return;\n }\n if (!preference) {\n ui.dim(\"No harness preference configured.\");\n return;\n }\n ui.panel({\n title: [\"HARNESS\"],\n rows: [\n [\"Registered\", registeredHarnessesOf(preference).join(\", \") || \"(none)\"],\n [\n \"Plugin resources\",\n loadSettings(getHarnesstapDir()).harnessSync.pluginResources,\n ],\n ],\n });\n}\n\nasync function handleHarnessProjectSetCommand(opts: {\n project: string;\n harnesses?: string;\n main?: string;\n aliases?: string;\n materializationStrategy?: string;\n interactive?: boolean;\n noInteractive?: boolean;\n}): Promise<void> {\n const db = getDb();\n initializeSchema(db);\n const projectRoot = resolve(opts.project);\n const gitOrigin = getGitOrigin(projectRoot);\n if (!gitOrigin) {\n reportNoGitOrigin(`${formatCommand(\"harness project set --project . --harnesses claude-code,cursor\")}`);\n return;\n }\n\n const project = upsertProject({\n git_origin: normalizeGitUrl(gitOrigin),\n name: projectNameFromUrl(gitOrigin),\n local_path: projectRoot,\n });\n\n const useWizard = shouldUseWizard({\n interactive: opts.interactive,\n noInteractive: opts.noInteractive,\n missingRequiredArgs: !opts.harnesses && !opts.main && !opts.aliases,\n });\n\n const selection = await resolveHarnessSelection({\n harnesses: parseHarnessList(opts.harnesses),\n main: opts.main,\n aliases: parseHarnessList(opts.aliases),\n nonInteractive: !useWizard,\n current: getProjectHarnessConfig(project.id),\n detected: detectPlatforms(projectRoot),\n });\n\n const saved = setProjectHarnessConfig({\n project_id: project.id,\n registered_harnesses: selection.registered_harnesses,\n ...(opts.materializationStrategy\n ? {\n materialization_strategy:\n opts.materializationStrategy === \"copy\" ? \"copy\" : \"symlink-preferred\",\n }\n : {}),\n });\n ui.success(\n `Set project harness preference ${ui.icons.hint} ${ui.theme.accent(registeredHarnessesOf(saved).join(\", \"))}`,\n );\n}\n\nasync function handleHarnessSyncCommand(opts: {\n project?: string;\n dryRun?: boolean;\n format?: string;\n pluginResources?: string;\n}): Promise<void> {\n const db = getDb();\n initializeSchema(db);\n const format = parseOutputFormat(opts.format);\n const scope = opts.project ? \"project\" : \"global\";\n const pluginResourceMode = opts.pluginResources\n ? parsePluginResourceMode(opts.pluginResources)\n : undefined;\n try {\n const result = await syncConfiguredHarnesses({\n scope,\n ...(opts.project ? { projectRoot: resolve(opts.project) } : {}),\n dryRun: opts.dryRun,\n ...(pluginResourceMode ? { pluginResourceMode } : {}),\n });\n if (format === \"json\") {\n printJson(result);\n return;\n }\n const verb = opts.dryRun ? \"Would sync\" : \"Synced\";\n ui.success(\n `${verb} ${result.platforms_synced.join(\", \")} ${ui.icons.hint} ${formatCount(result.files_written, \"file\")}`,\n );\n if (result.conflicts.length > 0) {\n ui.dim(\n `${formatCount(result.conflicts.length, \"conflict\")} resolved with last-write (newest on-disk copy)`,\n );\n }\n for (const warning of result.surface_warnings) {\n ui.warn(\n `${warning.harness} surface ${warning.path} is not rematerialized to ${warning.alias_harnesses.join(\", \")}: ${warning.message}`,\n );\n }\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n process.exitCode = 1;\n fail(message, {\n hints: [formatCommand(\"harness set --harnesses <slugs>\")],\n });\n }\n}\n\nfunction handleHarnessProjectStatusCommand(opts: {\n project: string;\n format?: string;\n}): void {\n const db = getDb();\n initializeSchema(db);\n const format = parseOutputFormat(opts.format);\n const projectRoot = resolve(opts.project);\n const gitOrigin = getGitOrigin(projectRoot);\n if (!gitOrigin) {\n reportNoGitOrigin(`${formatCommand(\"harness project status --project .\")}`);\n return;\n }\n\n const project = getProjectByOrigin(normalizeGitUrl(gitOrigin));\n const config = project ? getProjectHarnessConfig(project.id) : undefined;\n\n if (format === \"json\") {\n printJson(\n config ?? {\n registered_harnesses: [],\n materialization_strategy: \"symlink-preferred\",\n },\n );\n return;\n }\n\n if (!config) {\n ui.dim(\"No project harness preference configured.\");\n return;\n }\n\n ui.panel({\n title: [\"HARNESS\", \"project\"],\n rows: [\n [\"Registered\", registeredHarnessesOf(config).join(\", \") || \"(none)\"],\n [\"Materialization\", config.materialization_strategy],\n ],\n });\n}\n\nexport function registerHarnessCommands(root: Command): void {\n const harnessCmd = configureCommandGroup(\n root\n .command(\"harness\")\n .alias(\"h\")\n .description(\"Manage the registered harness set\"),\n );\n\n harnessCmd\n .command(\"list\")\n .alias(\"ls\")\n .option(\"--supported\", \"Only show natively serialized harnesses\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .description(\"List supported harnesses\")\n .action(handleHarnessListCommand);\n\n harnessCmd\n .command(\"set\")\n .option(\"--harnesses <slugs>\", \"Comma-separated registered harness slugs\")\n .addOption(new Option(\"--main <slug>\", \"Deprecated: prepended to the registered set\").hideHelp())\n .addOption(new Option(\"--aliases <slugs>\", \"Deprecated: appended to the registered set\").hideHelp())\n .option(\"--interactive\", \"Prompt instead of relying on explicit flags\")\n .description(\"Set global registered harnesses\")\n .action(handleHarnessSetCommand);\n\n harnessCmd\n .command(\"status\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .description(\"Show global harness preferences\")\n .action(handleHarnessStatusCommand);\n\n harnessCmd\n .command(\"sync\")\n .option(\"--project <path>\", \"Sync a git-backed project instead of home\")\n .option(\"--dry-run\", \"Show what would be written without writing files\")\n .option(\n \"--plugin-resources <mode>\",\n `How to materialize Cursor/Claude plugin files into .agents: symlink, copy, or clone (default ${DEFAULT_PLUGIN_RESOURCE_MODE}, or harnessSync.pluginResources in config.jsonc)`,\n )\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .description(\n \"Union resources from registered harnesses and materialize with last-write conflicts\",\n )\n .action(handleHarnessSyncCommand);\n\n const harnessProjectCmd = configureCommandGroup(\n harnessCmd\n .command(\"project\")\n .description(\"Manage harness preferences for a git-backed project\"),\n );\n\n harnessProjectCmd\n .command(\"set\")\n .option(\"--project <path>\", \"Project directory\", \".\")\n .option(\"--harnesses <slugs>\", \"Comma-separated registered harness slugs\")\n .addOption(new Option(\"--main <slug>\", \"Deprecated: prepended to the registered set\").hideHelp())\n .addOption(new Option(\"--aliases <slugs>\", \"Deprecated: appended to the registered set\").hideHelp())\n .option(\n \"--materialization-strategy <strategy>\",\n \"Materialization strategy: symlink-preferred or copy\",\n )\n .option(\"--interactive\", \"Prompt instead of relying on explicit flags\")\n .description(\"Set project-scoped registered harnesses\")\n .action(handleHarnessProjectSetCommand);\n\n harnessProjectCmd\n .command(\"status\")\n .option(\"--project <path>\", \"Project directory\", \".\")\n .option(\"--format <mode>\", \"Output format: human or json\", \"human\")\n .description(\"Show project-scoped harness preferences\")\n .action(handleHarnessProjectStatusCommand);\n}\n","import { existsSync, statSync } from \"node:fs\";\nimport { isAbsolute, join, resolve } from \"node:path\";\nimport { loadSettings } from \"../config/settings.js\";\nimport { getHarnesstapDir } from \"../db/connection.js\";\nimport {\n getHarnessPreference,\n getProjectHarnessConfig,\n} from \"../models/harness.js\";\nimport { upsertProject } from \"../models/project.js\";\nimport { createSnapshot } from \"../models/snapshot.js\";\nimport { captureManagedSnapshotState } from \"./snapshot-capture.js\";\nimport type {\n CursorSkillMode,\n ResourceCreateInput,\n SerializerTarget,\n SurfaceWarning,\n} from \"../types.js\";\nimport { resolveHomeRoot } from \"../utils/home-root.js\";\nimport {\n type ApplyResult,\n generateFiles,\n materializeFiles,\n writeFiles,\n} from \"./applier.js\";\nimport { getGitOrigin, normalizeGitUrl, projectNameFromUrl } from \"./git.js\";\nimport {\n toPortableEmitResources,\n type UnionConflict,\n unionHarnessResources,\n} from \"./harness-resource-union.js\";\nimport {\n countHarnessSyncChanges,\n type HarnessSyncChangeCount,\n} from \"./harness-sync-preview.js\";\nimport { uniqueHarnessTargets } from \"./harness-targets.js\";\nimport {\n extractHostPluginMaterial,\n type ExtractHostPluginMaterialResult,\n materializeSkillHubPlan,\n planPluginSkillHub,\n portableHarnessesForPluginFanout,\n} from \"./host-plugin-material.js\";\nimport {\n applyInstructionLinks,\n pairInstructionFiles,\n} from \"./instruction-file-links.js\";\nimport { persistWrittenMaterializations } from \"./materialization-ownership.js\";\nimport { getPlatformSerializer } from \"./platform-serializers.js\";\nimport {\n DEFAULT_PLUGIN_RESOURCE_MODE,\n type PluginResourceMode,\n} from \"./plugin-resource-mode.js\";\nimport { resourceIdentity } from \"./reference-resources.js\";\nimport {\n dropPluginTranslatedResources,\n writeHarnessSyncPluginTranslationMarkers,\n} from \"./plugin-translation-marker.js\";\nimport {\n persistScanResults,\n scanPlatform,\n} from \"./scanner.js\";\nimport {\n collectManagedSkillPlacements,\n flattenUniqueFiles,\n pinSkillEmitsToExistingLivePaths,\n preferSharedSkillEmits,\n} from \"./shared-emit-paths.js\";\n\nexport type HarnessUnionSyncCode =\n | \"no_registered_harnesses\"\n | \"need_two_harnesses\";\n\nexport class HarnessUnionSyncError extends Error {\n readonly code: HarnessUnionSyncCode;\n\n constructor(code: HarnessUnionSyncCode, message: string) {\n super(message);\n this.name = \"HarnessUnionSyncError\";\n this.code = code;\n }\n}\n\nexport interface SyncConfiguredHarnessesOptions {\n scope?: \"global\" | \"project\";\n projectRoot?: string;\n homeRoot?: string;\n dryRun?: boolean;\n pluginResourceMode?: PluginResourceMode;\n}\n\nexport interface SyncConfiguredHarnessesResult {\n registered_harnesses: string[];\n conflict_policy: \"last-write\";\n platforms_synced: string[];\n files_written: number;\n harness_changes: HarnessSyncChangeCount[];\n conflicts: UnionConflict[];\n files: string[];\n plugin_resource_mode: PluginResourceMode;\n surface_warnings: SurfaceWarning[];\n}\n\nfunction resolvePluginResourceMode(\n override?: PluginResourceMode,\n): PluginResourceMode {\n if (override) return override;\n try {\n return loadSettings(getHarnesstapDir()).harnessSync.pluginResources;\n } catch {\n return DEFAULT_PLUGIN_RESOURCE_MODE;\n }\n}\n\nfunction resolveConfiguredSelection(projectRoot?: string): {\n registered_harnesses: string[];\n cursor_skill_mode?: CursorSkillMode;\n} {\n const global = getHarnessPreference();\n if (projectRoot) {\n const gitOrigin = getGitOrigin(projectRoot);\n if (gitOrigin) {\n const project = upsertProject({\n git_origin: normalizeGitUrl(gitOrigin),\n name: projectNameFromUrl(gitOrigin),\n local_path: projectRoot,\n });\n const projectConfig = getProjectHarnessConfig(project.id);\n const registered = uniqueHarnessTargets(\n projectConfig?.registered_harnesses ?? [],\n );\n if (registered.length > 0) {\n return {\n registered_harnesses: registered,\n ...(projectConfig?.cursor_skill_mode\n ? { cursor_skill_mode: projectConfig.cursor_skill_mode }\n : {}),\n };\n }\n }\n }\n\n const registered = uniqueHarnessTargets(global?.registered_harnesses ?? []);\n if (registered.length === 0) {\n throw new HarnessUnionSyncError(\n \"no_registered_harnesses\",\n \"No harnesses configured. Run ht harness set --harnesses <slugs>.\",\n );\n }\n\n return { registered_harnesses: registered };\n}\n\nfunction resourceMtimeMs(rootPath: string, source: string): number | undefined {\n if (!source) return undefined;\n const full = isAbsolute(source) ? source : join(rootPath, source);\n try {\n if (!existsSync(full)) return undefined;\n return statSync(full).mtimeMs;\n } catch {\n return undefined;\n }\n}\n\nasync function scanConfiguredSlices(\n platformIds: readonly string[],\n target: SerializerTarget,\n rootPath: string,\n): Promise<Array<{\n platformId: string;\n resources: ResourceCreateInput[];\n mtimesMs: Map<string, number>;\n}>> {\n const slices = [];\n for (const platformId of platformIds) {\n let resources: ResourceCreateInput[];\n if (target === \"global\") {\n const serializer = getPlatformSerializer(platformId);\n const scanned = serializer.scanGlobal\n ? await serializer.scanGlobal(rootPath)\n : await serializer.scan(rootPath);\n resources = dropPluginTranslatedResources(rootPath, scanned);\n } else {\n const scan = await scanPlatform(platformId, rootPath);\n resources = scan.resources;\n }\n const mtimesMs = new Map<string, number>();\n for (const resource of resources) {\n const mtime = resourceMtimeMs(rootPath, resource.source);\n if (mtime !== undefined) {\n mtimesMs.set(resourceIdentity(resource), mtime);\n }\n }\n slices.push({ platformId, resources, mtimesMs });\n }\n return slices;\n}\n\n/**\n * Union resources from the registered harness set, resolve same-identity\n * conflicts with last-write, then materialize through existing serializers.\n */\nexport async function syncConfiguredHarnesses(\n options: SyncConfiguredHarnessesOptions = {},\n): Promise<SyncConfiguredHarnessesResult> {\n const scope = options.scope ?? \"global\";\n const target: SerializerTarget = scope === \"global\" ? \"global\" : \"project\";\n const projectRoot = options.projectRoot\n ? resolve(options.projectRoot)\n : undefined;\n const rootPath =\n target === \"global\"\n ? (options.homeRoot ?? resolveHomeRoot())\n : (projectRoot ?? resolve(\".\"));\n\n const selection = resolveConfiguredSelection(\n target === \"project\" ? rootPath : undefined,\n );\n const platforms = uniqueHarnessTargets(selection.registered_harnesses);\n if (platforms.length < 2) {\n throw new HarnessUnionSyncError(\n \"need_two_harnesses\",\n \"Add another harness to sync.\",\n );\n }\n\n const slices = await scanConfiguredSlices(platforms, target, rootPath);\n const unioned = unionHarnessResources(slices, \"last-write\");\n const emitResources = toPortableEmitResources(unioned.resources);\n const serializeOptions = selection.cursor_skill_mode\n ? { target, skillCursorMode: selection.cursor_skill_mode }\n : { target };\n const pluginResourceMode = resolvePluginResourceMode(options.pluginResourceMode);\n const portablePlatforms = portableHarnessesForPluginFanout(platforms);\n const homeRoot = options.homeRoot ?? resolveHomeRoot();\n\n const previousSkillPlacements = collectManagedSkillPlacements(rootPath);\n const skipSkillNames = new Set(previousSkillPlacements.keys());\n const pinFromPrevious = previousSkillPlacements.size > 0\n ? { previousManagedPlacements: previousSkillPlacements }\n : undefined;\n const generated = await generateFiles(\n emitResources,\n platforms,\n rootPath,\n pinFromPrevious\n ? { ...serializeOptions, ...pinFromPrevious }\n : serializeOptions,\n );\n const preferred = pinSkillEmitsToExistingLivePaths(\n rootPath,\n preferSharedSkillEmits(generated, platforms, target, { skipSkillNames }),\n platforms,\n target,\n pinFromPrevious,\n );\n\n const extraResults: ApplyResult[] = [];\n let skillHubPlans: ReturnType<typeof planPluginSkillHub> = [];\n let extracted: ExtractHostPluginMaterialResult = {\n skills: [],\n resources: [],\n resourcePlugins: new Map(),\n };\n if (target === \"global\" && portablePlatforms.length > 0) {\n const occupied = new Set(unioned.resources.map(resourceIdentity));\n extracted = await extractHostPluginMaterial(\n unioned.resources,\n homeRoot,\n occupied,\n );\n if (extracted.resources.length > 0) {\n const extraGenerated = await generateFiles(\n toPortableEmitResources(extracted.resources),\n portablePlatforms,\n rootPath,\n pinFromPrevious\n ? { ...serializeOptions, ...pinFromPrevious }\n : serializeOptions,\n );\n extraResults.push(\n ...pinSkillEmitsToExistingLivePaths(\n rootPath,\n preferSharedSkillEmits(extraGenerated, portablePlatforms, target, {\n skipSkillNames,\n }),\n portablePlatforms,\n target,\n pinFromPrevious,\n ),\n );\n }\n skillHubPlans = planPluginSkillHub(\n extracted.skills,\n portablePlatforms,\n target,\n );\n }\n\n const paired = pairInstructionFiles(\n flattenUniqueFiles([...preferred, ...extraResults]),\n pluginResourceMode,\n );\n const files = paired.files;\n const filePaths = [\n ...files.map((file) => file.path.replace(/\\\\/g, \"/\")),\n ...paired.links.map((link) => link.path),\n ...skillHubPlans.map((plan) => plan.skillMdPath),\n ].filter((path, index, all) => all.indexOf(path) === index);\n const harness_changes = countHarnessSyncChanges({\n platforms,\n slices,\n unionResources: unioned.resources,\n extracted,\n });\n\n const payload = {\n registered_harnesses: platforms,\n conflict_policy: \"last-write\" as const,\n platforms_synced: platforms,\n files_written: filePaths.length,\n harness_changes,\n conflicts: unioned.conflicts,\n files: filePaths,\n plugin_resource_mode: pluginResourceMode,\n surface_warnings: [...preferred, ...extraResults].flatMap(\n (result) => result.surface_warnings ?? [],\n ),\n };\n\n if (options.dryRun) {\n return payload;\n }\n\n let writtenByApply = new Set<string>();\n if (target === \"project\") {\n const gitOrigin = getGitOrigin(rootPath);\n if (gitOrigin) {\n const project = upsertProject({\n git_origin: normalizeGitUrl(gitOrigin),\n name: projectNameFromUrl(gitOrigin),\n local_path: rootPath,\n });\n createSnapshot({\n project_id: project.id,\n label: `Before harness sync (${platforms.join(\", \")})`,\n state: captureManagedSnapshotState({\n rootPath,\n resources: emitResources,\n generated: preferred,\n }),\n });\n }\n writeFiles(files, rootPath);\n } else {\n const materialized = await materializeFiles(files, rootPath, {\n conflictPolicy: \"replace\",\n });\n writtenByApply = new Set(\n materialized.writtenFiles.map((path) => path.replace(/\\\\/g, \"/\")),\n );\n }\n applyInstructionLinks(rootPath, paired.links, pluginResourceMode);\n materializeSkillHubPlan(rootPath, skillHubPlans, pluginResourceMode);\n await writeHarnessSyncPluginTranslationMarkers({\n rootPath,\n scope: target === \"global\" ? \"global\" : \"project\",\n extracted,\n skillHubPlans,\n extraResults,\n portablePlatforms,\n target,\n serializeOptions,\n });\n\n persistWrittenMaterializations({\n scope: target === \"global\" ? \"global\" : \"project\",\n project_id: null,\n root_path: rootPath,\n platformResults: preferred.map((result: ApplyResult) => ({\n platformId: result.platformId,\n files: result.files,\n writtenPaths: result.files\n .map((file) => file.path.replace(/\\\\/g, \"/\"))\n .filter((path) =>\n target === \"project\"\n ? filePaths.includes(path)\n : writtenByApply.has(path),\n ),\n })),\n });\n\n const afterSlices = await scanConfiguredSlices(platforms, target, rootPath);\n persistScanResults(afterSlices, {\n conflictPolicy: \"overwrite\",\n originRef: rootPath,\n });\n\n return payload;\n}\n","import type { ResourceCreateInput } from \"../types.js\";\nimport { isClaudeLocalMcpResource } from \"./claude-local-mcp.js\";\nimport {\n type HarnessScanSlice,\n resourceFingerprint,\n} from \"./harness-resource-union.js\";\nimport {\n type ExtractHostPluginMaterialResult,\n isHostPluginTreePlatform,\n} from \"./host-plugin-material.js\";\nimport { isHostPluginPinResource } from \"./host-plugin-serialize.js\";\nimport { resourceIdentity } from \"./reference-resources.js\";\n\nexport interface HarnessSyncChangeCount {\n harness: string;\n changes: number;\n added: number;\n removed: number;\n modified: number;\n}\n\nexport interface CountHarnessSyncChangesInput {\n platforms: readonly string[];\n slices: readonly HarnessScanSlice[];\n unionResources: readonly ResourceCreateInput[];\n extracted: ExtractHostPluginMaterialResult;\n}\n\nfunction isHostPluginPin(resource: ResourceCreateInput): boolean {\n return isHostPluginPinResource({\n type: resource.type,\n metadata: resource.metadata,\n origin_ref: resource.origin_ref ?? \"\",\n });\n}\n\nfunction sliceByIdentity(\n slice: HarnessScanSlice | undefined,\n): Map<string, ResourceCreateInput> {\n const byIdentity = new Map<string, ResourceCreateInput>();\n if (!slice) return byIdentity;\n for (const resource of slice.resources) {\n byIdentity.set(resourceIdentity(resource), resource);\n }\n return byIdentity;\n}\n\nfunction sliceSkillNames(slice: HarnessScanSlice | undefined): Set<string> {\n const names = new Set<string>();\n if (!slice) return names;\n for (const resource of slice.resources) {\n if (resource.type === \"skill\") names.add(resource.name);\n }\n return names;\n}\n\nfunction skipPreviewResource(\n resource: ResourceCreateInput,\n portable: boolean,\n): boolean {\n if (isClaudeLocalMcpResource(resource)) return true;\n if (portable && isHostPluginPin(resource)) return true;\n return false;\n}\n\n/**\n * Count resources that would be added, removed, or updated on each harness.\n *\n * One `type:name:namespace` is one change, matching inventory rows. Host\n * plugin pins count as a single resource on Claude/Cursor; portable harnesses\n * get extracted plugin skills/resources instead of those pin trees.\n * `changes` is added + removed + modified.\n */\nexport function countHarnessSyncChanges(\n input: CountHarnessSyncChangesInput,\n): HarnessSyncChangeCount[] {\n const slices = new Map(\n input.slices.map((slice) => [slice.platformId, slice]),\n );\n\n return input.platforms.map((harness) => {\n const slice = slices.get(harness);\n const current = sliceByIdentity(slice);\n const skillNames = sliceSkillNames(slice);\n const portable = !isHostPluginTreePlatform(harness);\n const planned = new Set<string>();\n let added = 0;\n let modified = 0;\n let removed = 0;\n\n const consider = (resource: ResourceCreateInput): void => {\n if (skipPreviewResource(resource, portable)) return;\n const identity = resourceIdentity(resource);\n if (planned.has(identity)) return;\n planned.add(identity);\n const existing = current.get(identity);\n if (!existing) {\n added += 1;\n return;\n }\n if (resourceFingerprint(existing) !== resourceFingerprint(resource)) {\n modified += 1;\n }\n };\n\n for (const resource of input.unionResources) {\n consider(resource);\n }\n\n if (portable) {\n for (const resource of input.extracted.resources) {\n consider(resource);\n }\n for (const skill of input.extracted.skills) {\n const identity = `skill:${skill.name}:`;\n if (planned.has(identity)) continue;\n planned.add(identity);\n if (!skillNames.has(skill.name)) added += 1;\n }\n }\n\n for (const [identity, resource] of current) {\n if (skipPreviewResource(resource, portable)) continue;\n if (!planned.has(identity)) removed += 1;\n }\n\n return {\n harness,\n added,\n removed,\n modified,\n changes: added + removed + modified,\n };\n });\n}\n","import { mkdirSync } from \"node:fs\";\nimport { basename, dirname, join, relative } from \"node:path\";\nimport type { SerializedFile } from \"../types.js\";\nimport { materializeFromSource, replaceWithRelativeSymlink } from \"./link-materialize.js\";\nimport type { PluginResourceMode } from \"./plugin-resource-mode.js\";\n\nconst INSTRUCTION_BASENAMES = new Set([\"AGENTS.md\", \"CLAUDE.md\"]);\n\nexport interface InstructionLink {\n path: string;\n target: string;\n}\n\nexport interface PairedInstructionFiles {\n files: SerializedFile[];\n links: InstructionLink[];\n}\n\nfunction posixPath(path: string): string {\n return path.replace(/\\\\/g, \"/\");\n}\n\nfunction instructionBasename(path: string): string {\n return basename(posixPath(path));\n}\n\nfunction isInstructionFile(path: string): boolean {\n return INSTRUCTION_BASENAMES.has(instructionBasename(path));\n}\n\nfunction normalizeInstructionContent(content: string): string {\n return content.replace(/\\r\\n/g, \"\\n\").replace(/\\n+$/, \"\");\n}\n\nfunction pickCanonical(group: readonly SerializedFile[]): SerializedFile {\n const agents = group.find((file) => instructionBasename(file.path) === \"AGENTS.md\");\n if (agents) return agents;\n const first = group[0];\n if (!first) {\n throw new Error(\"instruction group is empty\");\n }\n return first;\n}\n\n/**\n * When CLAUDE.md and AGENTS.md would hold the same text, keep AGENTS.md as\n * the real file. Claude Code 2.1.277+ reads CLAUDE.md when that path exists\n * and ignores AGENTS.md by default, so a CLAUDE.md → AGENTS.md link gives\n * Claude the shared text without a second load. OpenCode reads AGENTS.md.\n *\n * `copy` keeps independent files. `symlink` links CLAUDE.md at AGENTS.md.\n * `clone` uses copy-on-write (falls back to copy).\n */\nexport function pairInstructionFiles(\n files: readonly SerializedFile[],\n mode: PluginResourceMode,\n): PairedInstructionFiles {\n if (mode === \"copy\") {\n return { files: [...files], links: [] };\n }\n\n const instruction = files.filter((file) => isInstructionFile(file.path));\n if (instruction.length < 2) {\n return { files: [...files], links: [] };\n }\n\n const rest = files.filter((file) => !isInstructionFile(file.path));\n const groups = new Map<string, SerializedFile[]>();\n for (const file of instruction) {\n const key = normalizeInstructionContent(file.content);\n const group = groups.get(key) ?? [];\n group.push(file);\n groups.set(key, group);\n }\n\n const filesOut: SerializedFile[] = [...rest];\n const links: InstructionLink[] = [];\n for (const group of groups.values()) {\n if (group.length === 1) {\n const only = group[0];\n if (only) filesOut.push(only);\n continue;\n }\n const canonical = pickCanonical(group);\n filesOut.push(canonical);\n for (const file of group) {\n if (posixPath(file.path) === posixPath(canonical.path)) continue;\n links.push({\n path: posixPath(file.path),\n target: posixPath(canonical.path),\n });\n }\n }\n\n return { files: filesOut, links };\n}\n\nexport function applyInstructionLinks(\n rootPath: string,\n links: readonly InstructionLink[],\n mode: PluginResourceMode,\n): void {\n if (mode === \"copy\" || links.length === 0) return;\n\n for (const link of links) {\n const dest = join(rootPath, link.path);\n const canonical = join(rootPath, link.target);\n mkdirSync(dirname(dest), { recursive: true });\n switch (mode) {\n case \"symlink\": {\n const relativeTarget = relative(dirname(dest), canonical) || basename(canonical);\n replaceWithRelativeSymlink(dest, relativeTarget);\n break;\n }\n case \"clone\":\n materializeFromSource(dest, canonical, \"clone\");\n break;\n default: {\n const exhaustive: never = mode;\n throw new Error(`Unsupported instruction link mode: ${exhaustive}`);\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,WAAAA,gBAAe;AACxB,SAAS,cAA4B;;;ACDrC,SAAS,YAAY,gBAAgB;AACrC,SAAS,YAAY,QAAAC,OAAM,eAAe;;;AC2B1C,SAAS,gBAAgB,UAAwC;AAC/D,SAAO,wBAAwB;AAAA,IAC7B,MAAM,SAAS;AAAA,IACf,UAAU,SAAS;AAAA,IACnB,YAAY,SAAS,cAAc;AAAA,EACrC,CAAC;AACH;AAEA,SAAS,gBACP,OACkC;AAClC,QAAM,aAAa,oBAAI,IAAiC;AACxD,MAAI,CAAC,MAAO,QAAO;AACnB,aAAW,YAAY,MAAM,WAAW;AACtC,eAAW,IAAI,iBAAiB,QAAQ,GAAG,QAA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AAuB;AAEjC,aACG,QAAQ,QAAQ,EAChB,OAAO,mBAAmB,gCAAgC,OAAO,EACjE,YAAY,iCAAiC,EAC7C,OAAO,0BAA0B;AAEpC,aACG,QAAQ,MAAM,EACd,OAAO,oBAAoB,2CAA2C,EACtE,OAAO,aAAa,kDAAkD,EACtE;AAAA,IACC;AAAA,IACA,gGAAgG,4BAA4B;AAAA,EAC9H,EACC,OAAO,mBAAmB,gCAAgC,OAAO,EACjE;AAAA,IACC;AAAA,EACF,EACC,OAAO,wBAAwB;AAElC,QAAM,oBAAoB;AAAA,IACxB,WACG,QAAQ,SAAS,EACjB,YAAY,qDAAqD;AAAA,EACtE;AAEA,oBACG,QAAQ,KAAK,EACb,OAAO,oBAAoB,qBAAqB,GAAG,EACnD,OAAO,uBAAuB,0CAA0C,EACxE,UAAU,IAAI,OAAO,iBAAiB,6CAA6C,EAAE,SAAS,CAAC,EAC/F,UAAU,IAAI,OAAO,qBAAqB,4CAA4C,EAAE,SAAS,CAAC,EAClG;AAAA,IACC;AAAA,IACA;AAAA,EACF,EACC,OAAO,iBAAiB,6CAA6C,EACrE,YAAY,yCAAyC,EACrD,OAAO,8BAA8B;AAExC,oBACG,QAAQ,QAAQ,EAChB,OAAO,oBAAoB,qBAAqB,GAAG,EACnD,OAAO,mBAAmB,gCAAgC,OAAO,EACjE,YAAY,yCAAyC,EACrD,OAAO,iCAAiC;AAC7C;","names":["resolve","join","registered","join","resolve"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
clearLiveReadCaches
|
|
3
|
-
} from "./chunk-BUA7WFI4.js";
|
|
4
|
-
import "./chunk-UC27MQ3T.js";
|
|
5
|
-
import "./chunk-V4UNYSZO.js";
|
|
6
|
-
import "./chunk-CWXCZBJR.js";
|
|
7
|
-
import "./chunk-A3TZT4WT.js";
|
|
8
|
-
import "./chunk-OHZNDV4A.js";
|
|
9
|
-
export {
|
|
10
|
-
clearLiveReadCaches
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=live-read-cache-WPUFHVMZ.js.map
|
package/dist/open-D3GWGDSQ.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
registerOpenCommand
|
|
3
|
-
} from "./chunk-OWE3OSX6.js";
|
|
4
|
-
import "./chunk-MQCH3YZ5.js";
|
|
5
|
-
import "./chunk-6FXJIKEG.js";
|
|
6
|
-
import "./chunk-CR2TYMKC.js";
|
|
7
|
-
import "./chunk-RQLVXJH2.js";
|
|
8
|
-
import "./chunk-T4EKNX2Q.js";
|
|
9
|
-
import "./chunk-R4NV3Q7G.js";
|
|
10
|
-
import "./chunk-WGVU3LA5.js";
|
|
11
|
-
import "./chunk-BUA7WFI4.js";
|
|
12
|
-
import "./chunk-UC27MQ3T.js";
|
|
13
|
-
import "./chunk-V4UNYSZO.js";
|
|
14
|
-
import "./chunk-CWXCZBJR.js";
|
|
15
|
-
import "./chunk-A3TZT4WT.js";
|
|
16
|
-
import "./chunk-OHZNDV4A.js";
|
|
17
|
-
export {
|
|
18
|
-
registerOpenCommand
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=open-D3GWGDSQ.js.map
|
package/dist/plugin-L3466DHK.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
handleProjectApplyCommand,
|
|
3
|
-
registerDeprecatedLayerAlias,
|
|
4
|
-
registerPluginCommands
|
|
5
|
-
} from "./chunk-3Q72LZPJ.js";
|
|
6
|
-
import "./chunk-5HACBPK2.js";
|
|
7
|
-
import "./chunk-D7R577XZ.js";
|
|
8
|
-
import "./chunk-GZU4LVFF.js";
|
|
9
|
-
import "./chunk-MQCAPCAF.js";
|
|
10
|
-
import "./chunk-R6VFJKZB.js";
|
|
11
|
-
import "./chunk-42E2MPES.js";
|
|
12
|
-
import "./chunk-CHQGE2HF.js";
|
|
13
|
-
import "./chunk-HV3ENT2F.js";
|
|
14
|
-
import "./chunk-UK2IV2ZQ.js";
|
|
15
|
-
import "./chunk-L6BJCRBU.js";
|
|
16
|
-
import "./chunk-MQCH3YZ5.js";
|
|
17
|
-
import "./chunk-6FXJIKEG.js";
|
|
18
|
-
import "./chunk-VZQG2JDV.js";
|
|
19
|
-
import "./chunk-MHLAIGIM.js";
|
|
20
|
-
import "./chunk-EPXAOEBB.js";
|
|
21
|
-
import "./chunk-R27VZIF6.js";
|
|
22
|
-
import "./chunk-K4UDZUJ2.js";
|
|
23
|
-
import "./chunk-KRI4R7EM.js";
|
|
24
|
-
import "./chunk-37E5M4JX.js";
|
|
25
|
-
import "./chunk-S2D5PWAO.js";
|
|
26
|
-
import "./chunk-3FIWOI3H.js";
|
|
27
|
-
import "./chunk-CR2TYMKC.js";
|
|
28
|
-
import "./chunk-RQLVXJH2.js";
|
|
29
|
-
import "./chunk-T4EKNX2Q.js";
|
|
30
|
-
import "./chunk-XNS4I3W6.js";
|
|
31
|
-
import "./chunk-I6XFZLTJ.js";
|
|
32
|
-
import "./chunk-MHMFF6A5.js";
|
|
33
|
-
import "./chunk-QGTDQNVV.js";
|
|
34
|
-
import "./chunk-R4NV3Q7G.js";
|
|
35
|
-
import "./chunk-WGVU3LA5.js";
|
|
36
|
-
import "./chunk-BUA7WFI4.js";
|
|
37
|
-
import "./chunk-UC27MQ3T.js";
|
|
38
|
-
import "./chunk-V4UNYSZO.js";
|
|
39
|
-
import "./chunk-CWXCZBJR.js";
|
|
40
|
-
import "./chunk-A3TZT4WT.js";
|
|
41
|
-
import "./chunk-OHZNDV4A.js";
|
|
42
|
-
export {
|
|
43
|
-
handleProjectApplyCommand,
|
|
44
|
-
registerDeprecatedLayerAlias,
|
|
45
|
-
registerPluginCommands
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=plugin-L3466DHK.js.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createPluginFromProject,
|
|
3
|
-
previewPluginFromProject
|
|
4
|
-
} from "./chunk-MHMFF6A5.js";
|
|
5
|
-
import "./chunk-BUA7WFI4.js";
|
|
6
|
-
import "./chunk-UC27MQ3T.js";
|
|
7
|
-
import "./chunk-V4UNYSZO.js";
|
|
8
|
-
import "./chunk-CWXCZBJR.js";
|
|
9
|
-
import "./chunk-A3TZT4WT.js";
|
|
10
|
-
import "./chunk-OHZNDV4A.js";
|
|
11
|
-
export {
|
|
12
|
-
createPluginFromProject,
|
|
13
|
-
previewPluginFromProject
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=plugin-from-project-U5UGKTJH.js.map
|