harnesstap 1.4.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/apply-ZGEAY6YZ.js +50 -0
- package/dist/{approve-FBGYQGWN.js → approve-VPVMU2MM.js} +10 -13
- package/dist/{approve-FBGYQGWN.js.map → approve-VPVMU2MM.js.map} +1 -1
- package/dist/{audit-VI4QZ6X2.js → audit-AO7AGET3.js} +11 -15
- package/dist/{audit-VI4QZ6X2.js.map → audit-AO7AGET3.js.map} +1 -1
- package/dist/{auth-4CQCDS2W.js → auth-7YRIJNXU.js} +10 -12
- package/dist/{auth-4CQCDS2W.js.map → auth-7YRIJNXU.js.map} +1 -1
- package/dist/bin.js +13 -34
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-OML4HXKT.js → chunk-262KZULH.js} +16 -22
- package/dist/chunk-262KZULH.js.map +1 -0
- package/dist/{chunk-ZUASVASP.js → chunk-26QGX47N.js} +26097 -16881
- package/dist/chunk-26QGX47N.js.map +1 -0
- package/dist/{chunk-3P6BWL5F.js → chunk-27IPOVKQ.js} +2 -2
- package/dist/{chunk-M4KLHJ6U.js → chunk-2BESDRYP.js} +8 -10
- package/dist/{chunk-M4KLHJ6U.js.map → chunk-2BESDRYP.js.map} +1 -1
- package/dist/{chunk-PCMON7Y2.js → chunk-2BWIEB2G.js} +8 -10
- package/dist/{chunk-PCMON7Y2.js.map → chunk-2BWIEB2G.js.map} +1 -1
- package/dist/{chunk-XTVGCVU4.js → chunk-2NMLWSUH.js} +41 -42
- package/dist/chunk-2NMLWSUH.js.map +1 -0
- package/dist/{chunk-TQ2NA4Z4.js → chunk-4E3G4H5B.js} +8 -2
- package/dist/chunk-4E3G4H5B.js.map +1 -0
- package/dist/chunk-4QCGTUTM.js +61 -0
- package/dist/chunk-4QCGTUTM.js.map +1 -0
- package/dist/{chunk-TPEJFLV7.js → chunk-6RKJZW2N.js} +4 -6
- package/dist/{chunk-TPEJFLV7.js.map → chunk-6RKJZW2N.js.map} +1 -1
- package/dist/{chunk-JQOKQKQT.js → chunk-7IBFH736.js} +2 -2
- package/dist/{chunk-P2C7JPLD.js → chunk-CKJIS2FM.js} +6 -6
- package/dist/{chunk-R7ZOYVN3.js → chunk-CUOEQQFI.js} +187 -59
- package/dist/chunk-CUOEQQFI.js.map +1 -0
- package/dist/{chunk-REHRUNBB.js → chunk-CWXCZBJR.js} +70 -5
- package/dist/chunk-CWXCZBJR.js.map +1 -0
- package/dist/{chunk-4ZQ2SCGY.js → chunk-FLYQEB6D.js} +509 -207
- package/dist/chunk-FLYQEB6D.js.map +1 -0
- package/dist/{chunk-U6DXASQP.js → chunk-HC7IZY75.js} +2 -2
- package/dist/{chunk-UVVZHWD2.js → chunk-I4DKV63E.js} +2 -2
- package/dist/{chunk-PNGF5EV2.js → chunk-JEC5PWNH.js} +2 -2
- package/dist/{chunk-MR7IOHSX.js → chunk-KFIRABC7.js} +16 -22
- package/dist/{chunk-MR7IOHSX.js.map → chunk-KFIRABC7.js.map} +1 -1
- package/dist/{chunk-6LTLYV5D.js → chunk-LGWFLVZQ.js} +1064 -265
- package/dist/chunk-LGWFLVZQ.js.map +1 -0
- package/dist/{chunk-RDG5DT7S.js → chunk-LX6PMOOC.js} +54 -40
- package/dist/chunk-LX6PMOOC.js.map +1 -0
- package/dist/{chunk-WGP4GUYZ.js → chunk-MILGCNBK.js} +9 -11
- package/dist/{chunk-WGP4GUYZ.js.map → chunk-MILGCNBK.js.map} +1 -1
- package/dist/chunk-MKLJBW5N.js +14 -0
- package/dist/{chunk-N3ZCH64F.js → chunk-MSKTWYHG.js} +86 -32
- package/dist/chunk-MSKTWYHG.js.map +1 -0
- package/dist/{chunk-WG5A6EAU.js → chunk-MTCCUYBZ.js} +821 -28
- package/dist/chunk-MTCCUYBZ.js.map +1 -0
- package/dist/{chunk-BPWFQKI5.js → chunk-NIFKCS7J.js} +2 -2
- package/dist/{chunk-43BDGVN3.js → chunk-NWOYPK2O.js} +56 -9
- package/dist/chunk-NWOYPK2O.js.map +1 -0
- package/dist/{chunk-3FS775NP.js → chunk-NXILQDJG.js} +85 -4
- package/dist/chunk-NXILQDJG.js.map +1 -0
- package/dist/chunk-QF73VLAW.js +31673 -0
- package/dist/chunk-QF73VLAW.js.map +1 -0
- package/dist/{chunk-RFQ3N7FB.js → chunk-QHCGA6LC.js} +11 -19
- package/dist/chunk-QHCGA6LC.js.map +1 -0
- package/dist/{chunk-L6YZE5MY.js → chunk-QPJZKWML.js} +5 -7
- package/dist/{chunk-L6YZE5MY.js.map → chunk-QPJZKWML.js.map} +1 -1
- package/dist/{chunk-ULCD6DJE.js → chunk-RM7VP6ID.js} +24 -61
- package/dist/chunk-RM7VP6ID.js.map +1 -0
- package/dist/{chunk-7HP6AAI3.js → chunk-SMLO5YPI.js} +2 -2
- package/dist/{chunk-73OJQTBW.js → chunk-T2JBSRGG.js} +2 -2
- package/dist/{chunk-IE7B6Q5K.js → chunk-U5Y6WKKT.js} +17 -18
- package/dist/chunk-U5Y6WKKT.js.map +1 -0
- package/dist/chunk-UEA4NCY2.js +106 -0
- package/dist/chunk-UEA4NCY2.js.map +1 -0
- package/dist/chunk-VAPCU2FX.js +70 -0
- package/dist/chunk-VAPCU2FX.js.map +1 -0
- package/dist/{chunk-RVEXPMM3.js → chunk-WEJVFNRO.js} +3 -5
- package/dist/{chunk-RVEXPMM3.js.map → chunk-WEJVFNRO.js.map} +1 -1
- package/dist/{chunk-IMROMZ2K.js → chunk-WWFVMCTR.js} +19 -14
- package/dist/chunk-WWFVMCTR.js.map +1 -0
- package/dist/chunk-XPONNOBR.js +102 -0
- package/dist/chunk-XPONNOBR.js.map +1 -0
- package/dist/{chunk-N3VGY3T3.js → chunk-Y3HJ2F2W.js} +7 -5
- package/dist/{chunk-N3VGY3T3.js.map → chunk-Y3HJ2F2W.js.map} +1 -1
- package/dist/{chunk-2A36HWDE.js → chunk-Y4I7ZCAE.js} +129 -136
- package/dist/chunk-Y4I7ZCAE.js.map +1 -0
- package/dist/{chunk-GRASK6M6.js → chunk-ZREU2UHM.js} +5 -5
- package/dist/{chunk-QA5U36JN.js → chunk-ZT7ANP3H.js} +774 -364
- package/dist/chunk-ZT7ANP3H.js.map +1 -0
- package/dist/{chunk-EOPFER6N.js → chunk-ZUXFPAVX.js} +19 -5
- package/dist/chunk-ZUXFPAVX.js.map +1 -0
- package/dist/{chunk-D432JAXV.js → chunk-ZWB6YXVQ.js} +153 -25
- package/dist/chunk-ZWB6YXVQ.js.map +1 -0
- package/dist/{chunk-23XSG7LI.js → chunk-ZZQDJGWX.js} +4 -4
- package/dist/{compile-GXADKGH5.js → compile-IMJHVXQO.js} +33 -37
- package/dist/{compile-GXADKGH5.js.map → compile-IMJHVXQO.js.map} +1 -1
- package/dist/{config-JMHNA2U5.js → config-FVVN3NWL.js} +16 -21
- package/dist/{config-JMHNA2U5.js.map → config-FVVN3NWL.js.map} +1 -1
- package/dist/cursor-local-install-JS5KSOES.js +94 -0
- package/dist/{cursor-local-install-46RWRBDT.js.map → cursor-local-install-JS5KSOES.js.map} +1 -1
- package/dist/{cursor-local-install-46RWRBDT.js → cursor-local-install-QU5R2FV5.js} +8 -12
- package/dist/cursor-local-install-QU5R2FV5.js.map +1 -0
- package/dist/{doctor-N7ZULPOL.js → doctor-A7VUJSCP.js} +14 -17
- package/dist/doctor-A7VUJSCP.js.map +1 -0
- package/dist/{environment-OBB3WU5B.js → environment-6INIUBNC.js} +42 -50
- package/dist/environment-6INIUBNC.js.map +1 -0
- package/dist/{github-PBYBGOLH.js → github-TFJT3P53.js} +9 -10
- package/dist/{github-PBYBGOLH.js.map → github-TFJT3P53.js.map} +1 -1
- package/dist/{harness-7KYATIV6.js → harness-WQNC5HPZ.js} +46 -84
- package/dist/harness-WQNC5HPZ.js.map +1 -0
- package/dist/{help-EE3AJQD4.js → help-NMS3EXJB.js} +15 -20
- package/dist/{help-EE3AJQD4.js.map → help-NMS3EXJB.js.map} +1 -1
- package/dist/{help-VXWKLQ6A.js → help-VW4RIICD.js} +57 -575
- package/dist/help-VW4RIICD.js.map +1 -0
- package/dist/host-plugin-view-kept-HYCHDB4D.js +139 -0
- package/dist/host-plugin-view-kept-HYCHDB4D.js.map +1 -0
- package/dist/index.js +12 -16
- package/dist/{init-LBTMPDVJ.js → init-RXYL5ZUE.js} +33 -41
- package/dist/{init-LBTMPDVJ.js.map → init-RXYL5ZUE.js.map} +1 -1
- package/dist/live-read-cache-BHU6L7MA.js +13 -0
- package/dist/live-read-cache-NQU7M2C7.js +12 -0
- package/dist/{lock-WLJRXRVK.js → lock-3H3Z65DS.js} +9 -12
- package/dist/{lock-WLJRXRVK.js.map → lock-3H3Z65DS.js.map} +1 -1
- package/dist/{marketplace-GXSV6QIY.js → marketplace-KW35PJCY.js} +26 -79
- package/dist/marketplace-KW35PJCY.js.map +1 -0
- package/dist/{mcp-XPDWWU75.js → mcp-2HUGVDJ5.js} +33 -37
- package/dist/{mcp-XPDWWU75.js.map → mcp-2HUGVDJ5.js.map} +1 -1
- package/dist/{migrate-SBUIWN3U.js → migrate-6VAPYNXI.js} +93 -34
- package/dist/migrate-6VAPYNXI.js.map +1 -0
- package/dist/notifications-Y7KQCN6K.js +154 -0
- package/dist/notifications-Y7KQCN6K.js.map +1 -0
- package/dist/open-FADABB2S.js +20 -0
- package/dist/{pack-A73LDVOX.js → pack-NTECD3BZ.js} +10 -14
- package/dist/{pack-A73LDVOX.js.map → pack-NTECD3BZ.js.map} +1 -1
- package/dist/plugin-T2YFCYIO.js +47 -0
- package/dist/plugin-from-project-FGX5AHW6.js +15 -0
- package/dist/{policy-6VY3CMSU.js → policy-3FOWB4GR.js} +9 -12
- package/dist/{policy-6VY3CMSU.js.map → policy-3FOWB4GR.js.map} +1 -1
- package/dist/{profile-YCKPMRRU.js → profile-HM3ROXXB.js} +108 -78
- package/dist/profile-HM3ROXXB.js.map +1 -0
- package/dist/{project-KHPPBKPN.js → project-3DTXKMI6.js} +512 -119
- package/dist/project-3DTXKMI6.js.map +1 -0
- package/dist/{resource-IJU3FAN5.js → resource-TZDZAVZ6.js} +55 -45
- package/dist/resource-TZDZAVZ6.js.map +1 -0
- package/dist/status-refresh-worker.js +1155 -0
- package/dist/status-refresh-worker.js.map +1 -0
- package/dist/{version-Z66FWWMQ.js → version-AMZJHJIB.js} +3 -3
- package/dist/version-AMZJHJIB.js.map +1 -0
- package/package.json +16 -11
- package/dist/apply-SUNDXRJ3.js +0 -54
- package/dist/chunk-2A36HWDE.js.map +0 -1
- package/dist/chunk-2H7UOFLK.js +0 -11
- package/dist/chunk-3FS775NP.js.map +0 -1
- package/dist/chunk-43BDGVN3.js.map +0 -1
- package/dist/chunk-4ZQ2SCGY.js.map +0 -1
- package/dist/chunk-6LTLYV5D.js.map +0 -1
- package/dist/chunk-D432JAXV.js.map +0 -1
- package/dist/chunk-DF4Z7LAD.js +0 -3463
- package/dist/chunk-DF4Z7LAD.js.map +0 -1
- package/dist/chunk-EOPFER6N.js.map +0 -1
- package/dist/chunk-G6WKY2W4.js +0 -389
- package/dist/chunk-G6WKY2W4.js.map +0 -1
- package/dist/chunk-IE7B6Q5K.js.map +0 -1
- package/dist/chunk-IMROMZ2K.js.map +0 -1
- package/dist/chunk-M2U3J7UX.js +0 -46
- package/dist/chunk-M2U3J7UX.js.map +0 -1
- package/dist/chunk-N3ZCH64F.js.map +0 -1
- package/dist/chunk-NAGAJ5UM.js +0 -145
- package/dist/chunk-NAGAJ5UM.js.map +0 -1
- package/dist/chunk-OML4HXKT.js.map +0 -1
- package/dist/chunk-QA5U36JN.js.map +0 -1
- package/dist/chunk-R7ZOYVN3.js.map +0 -1
- package/dist/chunk-RDG5DT7S.js.map +0 -1
- package/dist/chunk-REHRUNBB.js.map +0 -1
- package/dist/chunk-RFQ3N7FB.js.map +0 -1
- package/dist/chunk-TQ2NA4Z4.js.map +0 -1
- package/dist/chunk-ULCD6DJE.js.map +0 -1
- package/dist/chunk-WG5A6EAU.js.map +0 -1
- package/dist/chunk-XGTTOO4R.js +0 -84
- package/dist/chunk-XGTTOO4R.js.map +0 -1
- package/dist/chunk-XTVGCVU4.js.map +0 -1
- package/dist/chunk-XUJKZQZA.js +0 -235
- package/dist/chunk-XUJKZQZA.js.map +0 -1
- package/dist/chunk-ZUASVASP.js.map +0 -1
- package/dist/doctor-N7ZULPOL.js.map +0 -1
- package/dist/environment-OBB3WU5B.js.map +0 -1
- package/dist/harness-7KYATIV6.js.map +0 -1
- package/dist/help-VXWKLQ6A.js.map +0 -1
- package/dist/live-read-cache-TUSP7U3D.js +0 -10
- package/dist/marketplace-GXSV6QIY.js.map +0 -1
- package/dist/migrate-SBUIWN3U.js.map +0 -1
- package/dist/open-HDGLYYVU.js +0 -24
- package/dist/plugin-CEO6ZJM5.js +0 -51
- package/dist/plugin-from-project-UK7VJVUP.js +0 -18
- package/dist/profile-YCKPMRRU.js.map +0 -1
- package/dist/project-KHPPBKPN.js.map +0 -1
- package/dist/resource-IJU3FAN5.js.map +0 -1
- /package/dist/{apply-SUNDXRJ3.js.map → apply-ZGEAY6YZ.js.map} +0 -0
- /package/dist/{chunk-3P6BWL5F.js.map → chunk-27IPOVKQ.js.map} +0 -0
- /package/dist/{chunk-JQOKQKQT.js.map → chunk-7IBFH736.js.map} +0 -0
- /package/dist/{chunk-P2C7JPLD.js.map → chunk-CKJIS2FM.js.map} +0 -0
- /package/dist/{chunk-U6DXASQP.js.map → chunk-HC7IZY75.js.map} +0 -0
- /package/dist/{chunk-UVVZHWD2.js.map → chunk-I4DKV63E.js.map} +0 -0
- /package/dist/{chunk-PNGF5EV2.js.map → chunk-JEC5PWNH.js.map} +0 -0
- /package/dist/{chunk-2H7UOFLK.js.map → chunk-MKLJBW5N.js.map} +0 -0
- /package/dist/{chunk-BPWFQKI5.js.map → chunk-NIFKCS7J.js.map} +0 -0
- /package/dist/{chunk-7HP6AAI3.js.map → chunk-SMLO5YPI.js.map} +0 -0
- /package/dist/{chunk-73OJQTBW.js.map → chunk-T2JBSRGG.js.map} +0 -0
- /package/dist/{chunk-GRASK6M6.js.map → chunk-ZREU2UHM.js.map} +0 -0
- /package/dist/{chunk-23XSG7LI.js.map → chunk-ZZQDJGWX.js.map} +0 -0
- /package/dist/{live-read-cache-TUSP7U3D.js.map → live-read-cache-BHU6L7MA.js.map} +0 -0
- /package/dist/{open-HDGLYYVU.js.map → live-read-cache-NQU7M2C7.js.map} +0 -0
- /package/dist/{plugin-CEO6ZJM5.js.map → open-FADABB2S.js.map} +0 -0
- /package/dist/{plugin-from-project-UK7VJVUP.js.map → plugin-T2YFCYIO.js.map} +0 -0
- /package/dist/{version-Z66FWWMQ.js.map → plugin-from-project-FGX5AHW6.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/user-path.ts","../src/services/materialization-conflicts.ts","../src/cli/print-apply-summary.ts","../src/services/global-profile-drift.ts","../src/services/profile-stash.ts","../src/services/profile-switch-prompt.ts","../src/services/wizards/project-use.ts","../src/services/project-config-use.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { isAbsolute, join, resolve } from \"node:path\";\nimport { resolveHomeRoot } from \"./home-root.js\";\n\nexport class UserPathError extends Error {\n readonly input: string;\n\n constructor(input: string, resolved: string) {\n super(`Directory not found: ${input}.`);\n this.name = \"UserPathError\";\n this.input = input;\n this.resolved = resolved;\n }\n\n readonly resolved: string;\n}\n\nexport function expandUserPath(arg: string, home = resolveHomeRoot()): string {\n const trimmed = arg.trim();\n if (trimmed === \"~\") {\n return home;\n }\n if (trimmed.startsWith(\"~/\") || trimmed.startsWith(\"~\\\\\")) {\n return join(home, trimmed.slice(2));\n }\n return isAbsolute(trimmed) ? trimmed : resolve(trimmed);\n}\n\nexport function resolveUserPath(\n arg: string,\n opts?: { mustExist?: boolean; home?: string },\n): string {\n const resolved = resolve(expandUserPath(arg, opts?.home ?? resolveHomeRoot()));\n if (opts?.mustExist && !existsSync(resolved)) {\n throw new UserPathError(arg, resolved);\n }\n return resolved;\n}\n","import { ON_CONFLICT_VALUE_HELP, parseOnConflict } from \"../cli/on-conflict.js\";\nimport { applyCancelledMessage, onConflictReplaceHint } from \"../copy/cli.js\";\nimport { ui } from \"../ui/index.js\";\nimport type {\n ConflictPolicy,\n ConflictResolution,\n MaterializationConflict,\n} from \"./applier.js\";\nimport { promptForChoice } from \"./wizards/shared.js\";\n\nexport function resolveApplyConflictPolicy(opts: {\n onConflict?: string;\n noInteractive?: boolean;\n}): ConflictPolicy {\n const parsed = opts.onConflict ? parseOnConflict(opts.onConflict) : undefined;\n if (\n parsed === \"replace\" ||\n parsed === \"skip\" ||\n parsed === \"prompt\" ||\n parsed === \"cancel\"\n ) {\n return parsed;\n }\n if (\n opts.noInteractive ||\n process.env.CI === \"true\" ||\n process.env.HARNESSTAP_NO_INTERACTIVE === \"1\" ||\n !process.stdin.isTTY ||\n !process.stdout.isTTY\n ) {\n return \"cancel\";\n }\n return \"prompt\";\n}\n\n/** Name the conflicting files and give one --on-conflict hint. Sets exit code 1. */\nexport function reportApplyCancelled(\n conflicts: readonly string[],\n scope: \"profile\" | \"apply\" = \"apply\",\n): void {\n process.exitCode = 1;\n ui.warn(applyCancelledMessage(conflicts, scope), {\n hint: onConflictReplaceHint(conflicts),\n });\n}\n\nexport async function promptMaterializationConflict(\n conflict: MaterializationConflict,\n): Promise<ConflictResolution> {\n const ownerSummary =\n conflict.owners.length > 0\n ? conflict.owners\n .map((owner) => `${owner.plugin_name}@${owner.plugin_version ?? \"?\"}`)\n .join(\", \")\n : \"another plugin or manual edit\";\n\n ui.warn(`File already exists: ${conflict.path}`);\n ui.dim(` Previously written by: ${ownerSummary}`);\n\n return promptForChoice({\n message: `How should HarnessTap handle ${conflict.path}?`,\n choices: [\n { name: ON_CONFLICT_VALUE_HELP.replace, value: \"replace\" as const },\n { name: ON_CONFLICT_VALUE_HELP.skip, value: \"skip\" as const },\n { name: ON_CONFLICT_VALUE_HELP.cancel, value: \"cancel\" as const },\n ],\n });\n}\n","import {\n applyHeaderLine,\n applyWroteLine,\n CLI_COPY,\n CLI_HINTS,\n dryRunSectionHeader,\n dryRunWouldLine,\n forceRemoveHintLine,\n keptFilesHeader,\n keptReportedBeforeLine,\n keptReasonLabel,\n snapshotSavedUndoLine,\n} from \"../copy/cli.js\";\nimport {\n allKeptHostPluginViewPaths,\n hostPluginViewChangeCounts,\n hostPluginViewForceReplace,\n pendingKeptHostPluginViewPaths,\n} from \"../services/package-cache/host-plugin-view-policy.js\";\nimport { isClaudePluginRegistryPath } from \"../services/claude-plugin-registration-prune.js\";\nimport { ui } from \"../ui/index.js\";\n\nexport interface ApplyKeptFile {\n path: string;\n reason: \"modified\" | \"unmanaged\";\n /** False when --force-remove would not remove the file either. */\n forceable?: boolean;\n}\n\nexport function keptFromSkippedRemovals(\n skipped: readonly { path: string; reason: string; forceable?: boolean }[] | undefined,\n): ApplyKeptFile[] {\n return (skipped ?? []).flatMap((entry) => {\n const reason = removalSkipReason(entry.reason);\n if (!reason) return [];\n return [\n entry.forceable === false\n ? { path: entry.path, reason, forceable: false }\n : { path: entry.path, reason },\n ];\n });\n}\n\nexport function printApplyPayload(payload: {\n profile_name: string;\n harnesses: readonly string[];\n files: readonly unknown[];\n written_files: readonly string[];\n removed_files?: readonly string[];\n skipped_removals?: readonly { path: string; reason: string; message?: string; forceable?: boolean }[];\n snapshot_id?: string;\n dry_run?: boolean;\n removal_backup?: string;\n}): void {\n const kept = keptFromSkippedRemovals(payload.skipped_removals);\n const unchanged = Math.max(0, payload.files.length - payload.written_files.length);\n if (payload.dry_run) {\n printApplyDryRun({\n wouldWrite: payload.written_files,\n wouldRemove: payload.removed_files ?? [],\n wouldKeep: kept,\n unchanged,\n });\n } else {\n printApplySuccess({\n name: payload.profile_name,\n harnessCount: payload.harnesses.length,\n wrote: payload.written_files.length,\n removed: payload.removed_files?.length ?? 0,\n kept,\n unchanged,\n snapshotId: payload.snapshot_id,\n });\n }\n const listedKept = kept.length > 0;\n for (const skipped of payload.skipped_removals ?? []) {\n if (skipped.reason === \"missing\") {\n continue;\n }\n if (listedKept && removalSkipReason(skipped.reason)) {\n continue;\n }\n if (skipped.message) {\n ui.warn(skipped.message);\n }\n }\n // The removal itself already printed \"Removed N files. Backup: <dir>\"\n // (profile-apply warnSkippedRemovals), so the backup folder is not repeated.\n}\n\nexport function printApplyDryRun(input: {\n wouldWrite: readonly string[];\n wouldRemove: readonly string[];\n wouldKeep: readonly ApplyKeptFile[];\n unchanged: number;\n header?: string | false;\n}): void {\n if (input.header !== false) {\n console.log(input.header ?? CLI_COPY.dryRunNothingChanged);\n console.log(\"\");\n }\n if (input.wouldWrite.length > 0) {\n console.log(dryRunSectionHeader(\"write\", input.wouldWrite.length));\n for (const path of input.wouldWrite) {\n console.log(` ${path}`);\n }\n }\n if (input.wouldRemove.length > 0) {\n console.log(dryRunSectionHeader(\"remove\", input.wouldRemove.length));\n for (const path of input.wouldRemove) {\n console.log(` ${path}`);\n }\n }\n if (input.wouldKeep.length > 0) {\n console.log(dryRunSectionHeader(\"keep\", input.wouldKeep.length));\n for (const entry of input.wouldKeep) {\n console.log(` ${entry.path} ${keptReasonLabel(entry.reason, entry.path)}`);\n }\n }\n console.log(\"\");\n console.log(\n dryRunWouldLine({\n write: input.wouldWrite.length,\n remove: input.wouldRemove.length,\n keep: input.wouldKeep.length,\n unchanged: input.unchanged,\n }),\n );\n}\n\nexport function printKeptFiles(kept: readonly ApplyKeptFile[]): void {\n if (kept.length === 0) {\n return;\n }\n console.log(keptFilesHeader(kept.length));\n for (const entry of kept) {\n console.log(` ${entry.path} ${keptReasonLabel(entry.reason, entry.path)}`);\n }\n // HarnessTap keeps the entries Claude Code changed in its plugin registries\n // even with --force-remove, so suggesting it for those alone is wrong.\n if (kept.every((entry) => isClaudePluginRegistryPath(entry.path))) {\n return;\n }\n // With --force-remove already in effect, or when it would remove none of\n // these files, suggesting it is wrong.\n const forceable = kept.filter(\n (entry) => entry.forceable !== false && !isClaudePluginRegistryPath(entry.path),\n );\n console.log(\n hostPluginViewForceReplace() || forceable.length === 0\n ? CLI_HINTS.forceRemoveAlreadyUsed\n : forceRemoveHintLine(forceable.length),\n );\n}\n\nexport function printApplySuccess(input: {\n name: string;\n harnessCount: number;\n wrote: number;\n removed: number;\n kept: readonly ApplyKeptFile[];\n unchanged: number;\n snapshotId?: string;\n}): void {\n console.log(applyHeaderLine(input.name, input.harnessCount));\n // Files a plugin cache folder refresh added, replaced or removed count too, so the\n // line never says nothing changed next to \"Backed up and replaced ...\".\n const pluginFolder = hostPluginViewChangeCounts();\n // Kept files in a plugin cache folder get their own, more detailed notice.\n // List each kept file once, and count both.\n const folderKept = new Set(pendingKeptHostPluginViewPaths());\n const kept = input.kept.filter((entry) => !folderKept.has(entry.path));\n // Kept files in a plugin cache folder that an earlier apply already reported get no\n // notice again, but they are still kept, so the count and a pointer include them.\n const listedPaths = new Set([...folderKept, ...kept.map((entry) => entry.path)]);\n const reportedBefore = allKeptHostPluginViewPaths().filter((path) => !listedPaths.has(path));\n const keptTotal = listedPaths.size + new Set(reportedBefore).size;\n console.log(\n applyWroteLine({\n wrote: input.wrote + pluginFolder.replaced + pluginFolder.added,\n removed: input.removed + pluginFolder.removed,\n kept: keptTotal,\n unchanged: input.unchanged,\n }),\n );\n if (kept.length > 0) {\n printKeptFiles(kept);\n }\n if (reportedBefore.length > 0) {\n console.log(keptReportedBeforeLine(new Set(reportedBefore).size));\n }\n if (input.snapshotId) {\n console.log(snapshotSavedUndoLine(`ht revert ${input.snapshotId}`));\n }\n}\n\nexport function removalSkipReason(\n reason: string,\n): \"modified\" | \"unmanaged\" | undefined {\n if (reason === \"modified\") {\n return \"modified\";\n }\n if (reason === \"unmanaged\" || reason === \"preexisting\") {\n return \"unmanaged\";\n }\n return undefined;\n}\n","import { runTracedStatus, traceCount, traceSpan } from \"./status-trace.js\";\nimport { unreadNotificationCount } from \"./notifications.js\";\nimport { readUpstreamCheckSummary, type UpstreamCheckSummary } from \"./upstream-check-read.js\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { harnesstapDirForHomeRoot } from \"../db/connection.js\";\nimport { diffHostPluginView } from \"./package-cache/host-plugin.js\";\nimport { emittedHostPluginTree } from \"./host-plugin-serialize.js\";\nimport {\n CLAUDE_KNOWN_MARKETPLACES_PATH,\n HARNESSTAP_CLAUDE_MARKETPLACES_ROOT,\n claudeChangedMarketplaces,\n harnessTapClaudeMarketplaceManifestPath,\n} from \"./claude-marketplace-registration.js\";\nimport { hostPluginPackageDir } from \"./package-cache/paths.js\";\nimport { isEmptyBuiltinProfile, isProfilePlugin } from \"../constants/profile.js\";\nimport { getLatestGlobalApplySnapshotForProfile } from \"../models/global-apply-snapshot.js\";\nimport { resolvePluginSelector } from \"../models/plugin-model.js\";\nimport { listMaterializationsForRootPath } from \"../models/resource-materialization.js\";\nimport { resolveHomeRoot } from \"../utils/home-root.js\";\nimport { getActiveProfileName } from \"./active-profile.js\";\nimport {\n isTransparentCrossHarnessGap,\n resourceScopesForPlugins,\n liveSkillCopiesForMissingPath,\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 {\n buildHarnessLiveStatusMap,\n classifyGlobalDriftChanges,\n collectOwnedGlobalProfileFiles,\n computeGlobalProfilePanelStatus,\n countMissingHarnessRows,\n declaredMcpFromExpectedFiles,\n filesOnlyMarketplacePinRefs,\n listMissingHarnessRows,\n type GlobalProfileDriftSummary,\n type GlobalProfilePanelStatus,\n type GlobalProfileStatusDepth,\n type HarnessLiveStatus,\n resolveProjectDriftSummary,\n} from \"./global-profile-status-panel.js\";\nimport type { HarnessScope } from \"./harness-scope.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} from \"./profile-contents.js\";\nimport { detectNotStagedProfileResources } from \"./profile-untracked-resources.js\";\nimport { type DriftFileChange, driftChangeIsKept } from \"./project-drift.js\";\nimport { hashOnDiskFile } from \"./safe-file-removal.js\";\nimport { withAffectedResources } from \"./scoped-file-content-delta.js\";\nimport { readDiskTextOnce } from \"./status-disk-read.js\";\nimport { inStatusComputation, runInStatusComputation } from \"./status-computation.js\";\nimport { withStatusReadCache } from \"./status-read-cache.js\";\n\ntype StatusFieldInput = Parameters<typeof buildBaseStatusFields>[0];\n\ninterface DriftCore {\n fields: Omit<StatusFieldInput, \"depth\">;\n harness?: string;\n watchedPaths: string[];\n}\n\nlet driftCoreComputes = 0;\n\n/** How many times the dry-run core has actually run. Tests use this. */\nexport function readDriftCoreComputeCount(): number {\n return driftCoreComputes;\n}\n\nfunction driftCore(\n fields: Omit<StatusFieldInput, \"depth\">,\n harness: string | undefined,\n homeRoot: string,\n): DriftCore {\n const watchedPaths = (fields.expectedApply?.expected_files ?? []).map((file) =>\n join(homeRoot, file.path),\n );\n return { fields, harness, watchedPaths };\n}\n\nexport interface GlobalProfileStatus {\n active_profile: string | null;\n profile_exists: boolean;\n applied: boolean;\n snapshot_id: string | null;\n snapshot_at: string | null;\n stack_in_sync: boolean;\n has_drift: boolean;\n changes: DriftFileChange[];\n warning?: string;\n depth: GlobalProfileStatusDepth;\n as_of: string;\n panel: GlobalProfilePanelStatus;\n harnesses: Record<string, HarnessLiveStatus>;\n drift_summary: GlobalProfileDriftSummary;\n contents?: ProfileContents | null;\n untracked_resource_count?: number;\n /** Alias for untracked_resource_count (not-staged working-tree resources). */\n not_staged_count?: number;\n /** App-managed inventory (full depth only); never applied or persisted. */\n host_managed?: HostManagedStatus;\n /**\n * True when this payload is the previous result and a fresh read is running.\n * Absent or false after apply, switch, and install, which wait for a new read.\n */\n refreshing?: boolean;\n /** Pending upstream updates from the last check. Read from the table only, never the network. */\n updates?: UpstreamCheckSummary;\n /** Unread notifications, for the Desktop bell. One indexed count, outside the cache. */\n unread_count?: number;\n}\n\n/**\n * One answer to \"is the global state in sync with the active profile\" for the\n * human output, `profile status --check`, and the JSON panel: file drift plus\n * declared plugins and MCP servers a full status found missing.\n */\nexport function globalProfileStatusGaps(status: GlobalProfileStatus): {\n inSync: boolean;\n missing: Array<{ harness: string; kind: \"plugin\" | \"mcp\"; id: string }>;\n} {\n const missing = status.depth === \"full\" ? listMissingHarnessRows(status.harnesses) : [];\n return { inSync: !status.has_drift && missing.length === 0, missing };\n}\n\nconst HOST_PLUGIN_VIEW_PATH = /^(\\.claude\\/plugins\\/cache\\/([^/]+)\\/([^/]+)\\/([^/]+))\\//;\n\n/** True for a file inside a host plugin cache folder, which apply refreshes from the plugin. */\nexport function isHostPluginViewPath(path: string): boolean {\n return HOST_PLUGIN_VIEW_PATH.test(path.replaceAll(\"\\\\\", \"/\"));\n}\n\n/**\n * A host plugin cache folder (`~/.claude/plugins/cache/<mkt>/<name>/<ver>`)\n * is emitted from itself, so comparing the expected files with the disk finds\n * nothing even when it holds the user's files instead of the plugin's. Compare\n * each such folder with HarnessTap's copy of the plugin instead. Files a\n * refresh would keep are reported as kept, not as pending writes.\n */\nexport function hostPluginFolderChanges(\n homeRoot: string,\n expectedFiles: ReadonlyArray<{ path: string }>,\n known: readonly DriftFileChange[],\n): DriftFileChange[] {\n const folders = new Map<string, { marketplace: string; name: string; version: string }>();\n for (const file of expectedFiles) {\n const match = HOST_PLUGIN_VIEW_PATH.exec(file.path.replaceAll(\"\\\\\", \"/\"));\n if (!match?.[1] || !match[2] || !match[3] || !match[4]) continue;\n folders.set(match[1], { marketplace: match[2], name: match[3], version: match[4] });\n }\n if (folders.size === 0) return [];\n const seen = new Set(known.map((change) => change.path));\n const harnesstapDir = harnesstapDirForHomeRoot(homeRoot);\n const changes: DriftFileChange[] = [];\n for (const [folder, plugin] of folders) {\n const canonicalDir = hostPluginPackageDir(harnesstapDir, plugin.marketplace, plugin.name, plugin.version);\n const differences = diffHostPluginView({\n homeRoot,\n hostView: join(homeRoot, folder),\n canonicalDir,\n });\n // Spec plugins are translated for the host on write (`mcp.json` becomes\n // `.mcp.json`, for example), so compare with what the apply writes.\n const emitted = differences.length > 0\n ? emittedHostPluginTree(canonicalDir, \"claude-code\", plugin.name)\n : new Map<string, { content: string; encoding?: \"utf8\" | \"base64\" }>();\n for (const difference of differences) {\n const path = `${folder}/${difference.path}`;\n if (seen.has(path)) continue;\n const written = emitted.get(difference.path);\n if (difference.state === \"missing\" ? !written : matchesEmitted(join(homeRoot, path), written)) {\n continue;\n }\n seen.add(path);\n if (difference.state === \"missing\") changes.push({ path, type: \"deleted\" });\n else if (difference.state === \"stale\") changes.push({ path, type: \"modified\" });\n else if (difference.state === \"modified\") {\n // HarnessTap wrote the file and it changed since: in Claude Code's\n // plugin cache, that is Claude Code updating the plugin.\n changes.push({ path, type: \"modified\", removal_group: \"owned_modified\", changed_by: \"claude-code\" });\n } else {\n changes.push({ path, type: \"modified\", removal_group: \"unmanaged\" });\n }\n }\n }\n return changes;\n}\n\nfunction matchesEmitted(\n fullPath: string,\n file: { content: string; encoding?: \"utf8\" | \"base64\" } | undefined,\n): boolean {\n if (!file) return false;\n const binary = binaryExpectedFileMatchesDisk(fullPath, file);\n if (binary !== undefined) return binary;\n try {\n return readFileSync(fullPath, \"utf-8\") === file.content;\n } catch {\n return false;\n }\n}\n\nfunction isHarnessTapClaudeMarketplaceFile(path: string): boolean {\n return path.replaceAll(\"\\\\\", \"/\").startsWith(`${HARNESSTAP_CLAUDE_MARKETPLACES_ROOT}/`);\n}\n\n/**\n * Marketplace entries HarnessTap registers for this profile that Claude Code\n * rewrote since. Apply leaves them as they are, so the file itself matches\n * what apply would write; report each entry as a kept change.\n */\nexport function claudeChangedMarketplaceEntries(\n homeRoot: string,\n expectedFiles: ReadonlyArray<{ path: string }>,\n): DriftFileChange[] {\n const wanted = new Set(expectedFiles.map((file) => file.path));\n return [...claudeChangedMarketplaces(homeRoot)]\n .filter((marketplace) => wanted.has(harnessTapClaudeMarketplaceManifestPath(marketplace)))\n .sort()\n .map((marketplace) => ({\n path: CLAUDE_KNOWN_MARKETPLACES_PATH,\n type: \"modified\" as const,\n removal_group: \"owned_modified\" as const,\n changed_by: \"claude-code\" as const,\n detail: `marketplace ${marketplace}`,\n }));\n}\n\nfunction keptContentDiff(\n path: string,\n keptModified: ReadonlySet<string>,\n keptUnmanaged: ReadonlySet<string>,\n): DriftFileChange {\n if (keptModified.has(path)) {\n return { path, type: \"modified\", removal_group: \"owned_modified\" };\n }\n if (keptUnmanaged.has(path)) {\n return { path, type: \"modified\", removal_group: \"unmanaged\" };\n }\n return { path, type: \"modified\" };\n}\n\nfunction isMissingExpectedFileTransparent(\n homeRoot: string,\n path: string,\n expectedPathsByResource: ReadonlyMap<string, readonly string[]>,\n scopeByResource: ReadonlyMap<string, HarnessScope>,\n harnesses: readonly string[],\n): boolean {\n const mapped = resourceKeyFromManagedPath(path);\n if (!mapped) {\n return true;\n }\n const key = `${mapped.type}:${mapped.name}`;\n const siblings = expectedPathsByResource.get(key) ?? [];\n const onDiskSiblingPaths = siblings.filter(\n (sibling) => sibling !== path && readGlobalFile(homeRoot, sibling) !== null,\n );\n for (const live of liveSkillCopiesForMissingPath(path, harnesses, (candidate) => readGlobalFile(homeRoot, candidate) !== null)) {\n if (!onDiskSiblingPaths.includes(live)) onDiskSiblingPaths.push(live);\n }\n return isTransparentCrossHarnessGap({\n path,\n onDiskSiblingPaths,\n scope: scopeByResource.get(key),\n });\n}\n\nfunction readGlobalFile(homeRoot: string, relativePath: string): string | null {\n const fullPath = join(homeRoot, relativePath);\n if (!inStatusComputation()) return readGlobalFileUncached(fullPath);\n if (!existsSync(fullPath)) return null;\n return readDiskTextOnce(fullPath);\n}\n\nfunction readGlobalFileUncached(fullPath: string): string | null {\n if (!existsSync(fullPath)) {\n return null;\n }\n try {\n return readFileSync(fullPath, \"utf-8\");\n } catch {\n return null;\n }\n}\n\nfunction pluginIdsMatch(left: string[], right: string[]): boolean {\n if (left.length !== right.length) {\n return false;\n }\n return left.every((pluginId, index) => pluginId === right[index]);\n}\n\nfunction declaredMcpFromExpectedApply(expectedApply: ApplyProfilePluginResult) {\n return declaredMcpFromExpectedFiles(\n expectedApply.harnesses,\n expectedApply.expected_files ?? [],\n );\n}\n\nfunction declaredMcpNamesFromMergedPlugins(pluginIds: string[]): Record<string, string[]> {\n const merged = mergePluginsForApply(pluginIds);\n const names = merged.resources\n .filter((resource) => resource.type === \"mcp_server\")\n .map((resource) => resource.name);\n return {\n \"claude-code\": names,\n cursor: names,\n };\n}\n\nfunction buildBaseStatusFields(input: {\n depth: GlobalProfileStatusDepth;\n activeProfile: string | null;\n profileExists: boolean;\n applied: boolean;\n snapshotId: string | null;\n snapshotAt: string | null;\n stackInSync: boolean;\n hasDrift: boolean;\n changes: DriftFileChange[];\n warning?: string;\n projectPath?: string;\n expectedApply?: ApplyProfilePluginResult;\n pluginIds?: string[];\n}): GlobalProfileStatus {\n const asOf = new Date().toISOString();\n const homeRoot = resolveHomeRoot();\n const ownedFiles = traceSpan(\"db.owned-files\", () => collectOwnedGlobalProfileFiles(input.snapshotId));\n const blockingChanges = input.changes.filter((change) => !driftChangeIsKept(change));\n const { owned, nonOwned } = classifyGlobalDriftChanges(blockingChanges, ownedFiles);\n\n const declaredPins =\n input.pluginIds && input.pluginIds.length > 0\n ? traceSpan(\"base.merge-plugins\", () => mergePluginsForApply(input.pluginIds ?? []).pluginPins)\n : [];\n const declaredFromExpected = input.expectedApply\n ? declaredMcpFromExpectedApply(input.expectedApply)\n : null;\n const declaredMcpByHarness =\n declaredFromExpected?.namesByHarness\n ?? (input.pluginIds\n ? declaredMcpNamesFromMergedPlugins(input.pluginIds)\n : { \"claude-code\": [], cursor: [] });\n\n const filesOnlyPinRefs = input.expectedApply?.resolution\n ? {\n \"claude-code\": filesOnlyMarketplacePinRefs(input.expectedApply.resolution, \"claude-code\"),\n cursor: filesOnlyMarketplacePinRefs(input.expectedApply.resolution, \"cursor\"),\n }\n : undefined;\n\n const harnesses = traceSpan(\"base.harness-live-status\", () => buildHarnessLiveStatusMap({\n depth: input.depth,\n homeRoot,\n declaredPins,\n ...(filesOnlyPinRefs ? { filesOnlyPinRefs } : {}),\n declaredMcpByHarness,\n ...(declaredFromExpected\n ? { expectedMcpConfigsByHarness: declaredFromExpected.configsByHarness }\n : {}),\n }));\n const { missingPlugins, missingMcp } =\n input.depth === \"full\"\n ? countMissingHarnessRows(harnesses)\n : { missingPlugins: 0, missingMcp: 0 };\n\n const contents = input.activeProfile\n ? traceSpan(\"base.profile-contents\", () => buildProfileContents(input.activeProfile ?? \"\"))\n : null;\n const hostManaged =\n input.depth === \"full\"\n ? traceSpan(\"base.host-managed\", () =>\n buildHostManagedStatus({\n homeRoot,\n profileSkills: profileSkillNameMap(contents?.resources ?? []),\n }),\n )\n : undefined;\n\n const projectDrift = traceSpan(\"base.project-drift\", () => resolveProjectDriftSummary(input.projectPath));\n const panel = computeGlobalProfilePanelStatus({\n depth: input.depth,\n applied: input.applied,\n activeProfile: input.activeProfile,\n stackInSync: input.stackInSync,\n ownedDriftCount: owned.length,\n nonOwnedDriftCount: nonOwned.length,\n missingPluginCount: missingPlugins,\n missingMcpCount: missingMcp,\n projectDrift,\n warning: input.warning,\n hostManagedCollisionCount: hostManaged?.cursor?.collisions.length ?? 0,\n });\n\n const driftSummary: GlobalProfileDriftSummary = {\n global: {\n status: !input.applied\n ? \"pending\"\n : input.hasDrift\n ? \"drifted\"\n : \"clean\",\n owned_changes: owned.length,\n non_owned_changes: nonOwned.length,\n },\n ...(projectDrift ? { project: projectDrift } : {}),\n };\n\n return {\n active_profile: input.activeProfile,\n profile_exists: input.profileExists,\n applied: input.applied,\n snapshot_id: input.snapshotId,\n snapshot_at: input.snapshotAt,\n stack_in_sync: input.stackInSync,\n has_drift: input.hasDrift,\n changes: input.changes,\n ...(input.warning ? { warning: input.warning } : {}),\n depth: input.depth,\n as_of: asOf,\n panel,\n harnesses,\n drift_summary: driftSummary,\n contents,\n ...(hostManaged ? { host_managed: hostManaged } : {}),\n };\n}\n\nasync function finalizeGlobalProfileStatus(\n fields: Parameters<typeof buildBaseStatusFields>[0],\n harness?: string,\n): Promise<GlobalProfileStatus> {\n const status = traceSpan(\"base\", () => buildBaseStatusFields(fields));\n if (\n fields.depth !== \"full\"\n || !status.active_profile\n || isEmptyBuiltinProfile(status.active_profile)\n ) {\n return status;\n }\n try {\n const notStaged = await traceSpan(\"not-staged\", () =>\n detectNotStagedProfileResources({\n profileSelector: status.active_profile ?? \"\",\n scope: \"home\",\n ...(harness ? { harness } : {}),\n }),\n );\n return {\n ...status,\n untracked_resource_count: notStaged.length,\n not_staged_count: notStaged.length,\n };\n } catch {\n return status;\n }\n}\n\n/**\n * Fast depth keeps the same drift fields as a full read (`changes`,\n * `has_drift`, `stack_in_sync`, `drift_summary`). The desktop drift pill\n * replaces those from every fast poll, so a cold fast read still runs the\n * dry-run. The full result, including that dry-run and profile contents, is\n * cached. A warm read is a map lookup while file watchers are healthy.\n * Status does not read Cursor's state.vscdb or logs folder. Where a watcher\n * could not be installed, mtimes and sizes of the remaining files are\n * checked instead.\n * A later read of the same depth skips the dry-run. Cold and refresh both\n * run on the background worker. The caller waits for a cold read, and the\n * main thread does not run that dry-run. When a watched input changes, the\n * previous result is returned with `refreshing` set. A warm or stale\n * response does not wait for that read. A status-relevant database write on\n * this process, or a commit from another process (`data_version`), drops the\n * snapshot, so the next read waits and includes that write. Apply, switch,\n * and install clear the cache first,\n * so the next read waits and is not stale. Overlapping callers share one\n * in-flight computation.\n */\nexport async function detectGlobalProfileStatus(input: {\n harness?: string;\n depth?: GlobalProfileStatusDepth;\n projectPath?: string;\n} = {}): Promise<GlobalProfileStatus> {\n const depth = input.depth ?? \"full\";\n const request = {\n depth,\n harness: input.harness,\n projectPath: input.projectPath,\n };\n const status = await withStatusReadCache(request, () => runInStatusComputation(async () => {\n const core = await withStatusReadCache(\n { ...request, includeDepth: false },\n async () => {\n const loaded = await loadDriftCore(input);\n return { value: loaded, watchedPaths: loaded.watchedPaths };\n },\n );\n const projected = await finalizeGlobalProfileStatus(\n { ...core.fields, depth },\n core.harness,\n );\n return { value: projected, watchedPaths: core.watchedPaths };\n }), { staleWhileRefresh: true });\n return {\n ...status,\n as_of: new Date().toISOString(),\n refreshing: status.refreshing === true,\n // Outside the cache: one indexed read, so a finished check shows at once.\n updates: readUpstreamCheckSummary(),\n unread_count: unreadNotificationCount(),\n };\n}\n\n/**\n * Full status computation with no cache. The refresh worker runs this off the\n * request thread. A warm or stale response must not wait for it.\n */\nexport async function loadGlobalProfileStatusSnapshot(input: {\n harness?: string;\n depth?: GlobalProfileStatusDepth;\n projectPath?: string;\n} = {}): Promise<{ value: GlobalProfileStatus; watchedPaths: string[] }> {\n const depth = input.depth ?? \"full\";\n return runInStatusComputation(() =>\n runTracedStatus(`depth=${depth} harness=${input.harness ?? \"*\"}`, async () => {\n const loaded = await traceSpan(\"drift-core\", () => loadDriftCore(input));\n const projected = await traceSpan(\"finalize\", () =>\n finalizeGlobalProfileStatus({ ...loaded.fields, depth }, loaded.harness),\n );\n return { value: projected, watchedPaths: loaded.watchedPaths };\n }),\n );\n}\n\nasync function loadDriftCore(input: {\n harness?: string;\n depth?: GlobalProfileStatusDepth;\n projectPath?: string;\n}): Promise<DriftCore> {\n driftCoreComputes += 1;\n const homeRoot = resolveHomeRoot();\n const activeProfile = getActiveProfileName() ?? null;\n if (!activeProfile) {\n return driftCore(\n {\n activeProfile: null,\n profileExists: false,\n applied: false,\n snapshotId: null,\n snapshotAt: null,\n stackInSync: false,\n hasDrift: false,\n changes: [],\n projectPath: input.projectPath,\n },\n input.harness,\n homeRoot,\n );\n }\n\n const plugin = traceSpan(\"db.resolve-profile\", () => resolvePluginSelector(activeProfile));\n if (!plugin) {\n if (isEmptyBuiltinProfile(activeProfile)) {\n const latestSnapshot = getLatestGlobalApplySnapshotForProfile(activeProfile);\n let expectedApply: ApplyProfilePluginResult;\n try {\n expectedApply = await clearGlobalProfileApply({\n dryRun: true,\n harness: input.harness,\n conflictPolicy: \"replace\",\n pull: false,\n });\n } catch (error) {\n return driftCore({\n activeProfile,\n profileExists: true,\n applied: Boolean(latestSnapshot),\n snapshotId: latestSnapshot?.id ?? null,\n snapshotAt: latestSnapshot?.created_at ?? null,\n stackInSync: false,\n hasDrift: true,\n changes: [],\n warning: error instanceof Error ? error.message : String(error),\n projectPath: input.projectPath,\n pluginIds: [],\n }, input.harness, homeRoot);\n }\n\n const stackInSync = latestSnapshot\n ? pluginIdsMatch(latestSnapshot.plugin_ids, expectedApply.configured_plugin_ids)\n : false;\n const applied = Boolean(latestSnapshot);\n const hasDrift = !applied || !stackInSync;\n\n return driftCore({\n activeProfile,\n profileExists: true,\n applied,\n snapshotId: latestSnapshot?.id ?? null,\n snapshotAt: latestSnapshot?.created_at ?? null,\n stackInSync,\n hasDrift,\n changes: [],\n projectPath: input.projectPath,\n expectedApply,\n pluginIds: [],\n }, input.harness, homeRoot);\n }\n\n return driftCore({\n activeProfile,\n profileExists: false,\n applied: false,\n snapshotId: null,\n snapshotAt: null,\n stackInSync: false,\n hasDrift: true,\n changes: [],\n warning: `missing plugin \"${activeProfile}\"`,\n projectPath: input.projectPath,\n }, input.harness, homeRoot);\n }\n\n if (!isProfilePlugin(plugin)) {\n return driftCore({\n activeProfile,\n profileExists: true,\n applied: false,\n snapshotId: null,\n snapshotAt: null,\n stackInSync: false,\n hasDrift: true,\n changes: [],\n warning: `plugin \"${plugin.name}\" is not tagged as a profile`,\n projectPath: input.projectPath,\n }, input.harness, homeRoot);\n }\n\n const latestSnapshot = getLatestGlobalApplySnapshotForProfile(activeProfile);\n const pluginIds = collectProfilePluginIds(plugin);\n let expectedApply: ApplyProfilePluginResult;\n try {\n expectedApply = await traceSpan(\"dry-run\", () =>\n applyProfilePlugin(activeProfile, {\n dryRun: true,\n harness: input.harness,\n conflictPolicy: \"replace\",\n pull: false,\n pinSkillEmits: false,\n mergeLiveSkillMarkdown: false,\n }),\n );\n traceCount(\"dry-run\", \"expected_files\", expectedApply.expected_files?.length ?? 0);\n } catch (error) {\n return driftCore({\n activeProfile,\n profileExists: true,\n applied: Boolean(latestSnapshot),\n snapshotId: latestSnapshot?.id ?? null,\n snapshotAt: latestSnapshot?.created_at ?? null,\n stackInSync: false,\n hasDrift: true,\n changes: [],\n warning: error instanceof Error ? error.message : String(error),\n projectPath: input.projectPath,\n pluginIds,\n }, input.harness, homeRoot);\n }\n\n const stackInSync = latestSnapshot\n ? pluginIdsMatch(latestSnapshot.plugin_ids, expectedApply.configured_plugin_ids)\n : false;\n\n const changes: DriftFileChange[] = [];\n const keptModified = new Set(expectedApply.removals?.owned_modified ?? []);\n const keptUnmanaged = new Set(expectedApply.removals?.unmanaged ?? []);\n const scopeByResource = resourceScopesForPlugins(pluginIds);\n const expectedPathsByResource = new Map<string, string[]>();\n for (const file of expectedApply.expected_files ?? []) {\n const mapped = resourceKeyFromManagedPath(file.path);\n if (!mapped) {\n continue;\n }\n const key = `${mapped.type}:${mapped.name}`;\n const paths = expectedPathsByResource.get(key) ?? [];\n paths.push(file.path);\n expectedPathsByResource.set(key, paths);\n }\n traceSpan(\"drift.compare-files\", () => {\n for (const file of expectedApply.expected_files ?? []) {\n if (isNativeAgentPluginCachePath(file.path)) continue;\n // Compared with HarnessTap's copy of the plugin below.\n if (isHostPluginViewPath(file.path)) continue;\n if (binaryExpectedFileMatchesDisk(join(homeRoot, file.path), file)) continue;\n const current = readGlobalFile(homeRoot, file.path);\n const owned = listMaterializationsForRootPath(homeRoot, file.path);\n if (current === null) {\n if (owned.length === 0 && isMissingExpectedFileTransparent(\n homeRoot,\n file.path,\n expectedPathsByResource,\n scopeByResource,\n expectedApply.harnesses,\n )) {\n continue;\n }\n changes.push(\n withAffectedResources({ path: file.path, type: \"deleted\" }, file.content, null),\n );\n continue;\n }\n if (owned.length > 0) {\n const diskHash = hashOnDiskFile(join(homeRoot, file.path));\n if (owned.some((row) => row.generated_hash === diskHash)) {\n continue;\n }\n if (fileContentsEquivalentForDrift(file.path, current, file.content)) {\n continue;\n }\n if (isHarnessTapClaudeMarketplaceFile(file.path)) {\n // Apply keeps a marketplace file HarnessTap wrote that changed since.\n changes.push({ path: file.path, type: \"modified\", removal_group: \"owned_modified\", changed_by: \"claude-code\" });\n continue;\n }\n changes.push(\n withAffectedResources(\n keptContentDiff(file.path, keptModified, keptUnmanaged),\n file.content,\n current,\n ),\n );\n continue;\n }\n if (!fileContentsEquivalentForDrift(file.path, current, file.content)) {\n changes.push(\n withAffectedResources(\n keptContentDiff(file.path, keptModified, keptUnmanaged),\n file.content,\n current,\n ),\n );\n }\n }\n });\n\n traceSpan(\"drift.host-plugin-folders\", () => {\n changes.push(...hostPluginFolderChanges(homeRoot, expectedApply.expected_files ?? [], changes));\n });\n changes.push(...claudeChangedMarketplaceEntries(homeRoot, expectedApply.expected_files ?? []));\n\n const applied = Boolean(latestSnapshot);\n const blockingChanges = changes.filter((change) => !driftChangeIsKept(change));\n const hasDrift = !applied || !stackInSync || blockingChanges.length > 0;\n\n return driftCore(\n {\n activeProfile,\n profileExists: true,\n applied,\n snapshotId: latestSnapshot?.id ?? null,\n snapshotAt: latestSnapshot?.created_at ?? null,\n stackInSync,\n hasDrift,\n changes,\n projectPath: input.projectPath,\n expectedApply,\n pluginIds,\n },\n input.harness,\n homeRoot,\n );\n}\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { ulid } from \"ulid\";\nimport { isEmptyBuiltinProfile } from \"../constants/profile.js\";\nimport { getHarnesstapDir } from \"../db/connection.js\";\nimport { getLatestGlobalApplySnapshotForProfile } from \"../models/global-apply-snapshot.js\";\nimport { getActiveProfileName } from \"./active-profile.js\";\nimport type { ApplyProfilePluginOptions } from \"./profile-apply.js\";\nimport { withProfileApplyLock } from \"./profile-apply-lock.js\";\nimport { flattenLiveRestoreFiles } from \"./snapshot-capture.js\";\nimport {\n buildProfileContents,\n type ProfileContents,\n} from \"./profile-contents.js\";\nimport type { DriftFileChange } from \"./project-drift.js\";\nimport {\n buildContentsFromResources,\n captureUntrackedResourcesForStash,\n removeUntrackedStashFiles,\n restoreUntrackedStashFiles,\n stashedFilesToDriftChanges,\n type StashedFileSnapshot,\n} from \"./profile-untracked-resources.js\";\nimport { resolveHomeRoot } from \"../utils/home-root.js\";\n\nexport interface ProfileStashEntry {\n id: string;\n profile_name: string;\n created_at: string;\n contents: ProfileContents;\n file_changes: DriftFileChange[];\n stashed_files: StashedFileSnapshot[];\n}\n\ninterface ProfileStashFile {\n entries: ProfileStashEntry[];\n}\n\nexport class ProfileStashError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"ProfileStashError\";\n }\n}\n\nfunction emptyProfileContents(): ProfileContents {\n return {\n plugins: [],\n stack_resource_count: 0,\n stack_summary: null,\n type_counts: {},\n resources: [],\n plugin_pins: [],\n mcp_servers: [],\n };\n}\n\nfunction getProfileStashPath(): string {\n return join(getHarnesstapDir(), \"profile-stash.json\");\n}\n\nfunction isProfileContents(value: unknown): value is ProfileContents {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n const candidate = value as Partial<ProfileContents>;\n return Array.isArray(candidate.resources);\n}\n\nfunction isStashedFileSnapshot(value: unknown): value is StashedFileSnapshot {\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n const candidate = value as Partial<StashedFileSnapshot>;\n return typeof candidate.path === \"string\" && typeof candidate.content === \"string\";\n}\n\nfunction hydrateStashEntry(raw: unknown): ProfileStashEntry | null {\n if (typeof raw !== \"object\" || raw === null) {\n return null;\n }\n const entry = raw as Partial<ProfileStashEntry>;\n if (\n typeof entry.id !== \"string\"\n || typeof entry.profile_name !== \"string\"\n || typeof entry.created_at !== \"string\"\n ) {\n return null;\n }\n\n const contents = isProfileContents(entry.contents)\n ? entry.contents\n : buildProfileContents(entry.profile_name) ?? emptyProfileContents();\n const fileChanges = Array.isArray(entry.file_changes)\n ? entry.file_changes.filter(\n (change): change is DriftFileChange =>\n typeof change === \"object\"\n && change !== null\n && typeof (change as DriftFileChange).path === \"string\"\n && typeof (change as DriftFileChange).type === \"string\",\n )\n : [];\n const stashedFiles = Array.isArray(entry.stashed_files)\n ? entry.stashed_files.filter(isStashedFileSnapshot)\n : [];\n\n return {\n id: entry.id,\n profile_name: entry.profile_name,\n created_at: entry.created_at,\n contents,\n file_changes: fileChanges,\n stashed_files: stashedFiles,\n };\n}\n\nfunction readProfileStashFile(): ProfileStashFile {\n const filePath = getProfileStashPath();\n if (!existsSync(filePath)) {\n return { entries: [] };\n }\n try {\n const parsed = JSON.parse(readFileSync(filePath, \"utf-8\")) as Partial<ProfileStashFile>;\n if (!Array.isArray(parsed.entries)) {\n return { entries: [] };\n }\n const entries = parsed.entries\n .map((entry) => hydrateStashEntry(entry))\n .filter((entry): entry is ProfileStashEntry => entry !== null);\n return { entries };\n } catch {\n return { entries: [] };\n }\n}\n\nfunction writeProfileStashFile(file: ProfileStashFile): void {\n const home = getHarnesstapDir();\n mkdirSync(home, { recursive: true });\n writeFileSync(\n getProfileStashPath(),\n `${JSON.stringify(file, null, 2)}\\n`,\n \"utf-8\",\n );\n}\n\nexport function listProfileStashEntries(): ProfileStashEntry[] {\n return readProfileStashFile().entries;\n}\n\nfunction pushProfileStashEntry(input: {\n profile_name: string;\n contents: ProfileContents;\n file_changes: DriftFileChange[];\n stashed_files: StashedFileSnapshot[];\n}): ProfileStashEntry {\n const file = readProfileStashFile();\n const entry: ProfileStashEntry = {\n id: ulid(),\n profile_name: input.profile_name,\n created_at: new Date().toISOString(),\n contents: input.contents,\n file_changes: input.file_changes,\n stashed_files: input.stashed_files,\n };\n file.entries.unshift(entry);\n writeProfileStashFile(file);\n return entry;\n}\n\nfunction popProfileStashEntry(): ProfileStashEntry | undefined {\n const file = readProfileStashFile();\n const entry = file.entries.shift();\n if (entry) {\n writeProfileStashFile(file);\n }\n return entry;\n}\n\nfunction peekProfileStashEntry(): ProfileStashEntry | undefined {\n return readProfileStashFile().entries[0];\n}\n\nfunction resolveStashableActiveProfile(): string {\n const activeProfile = getActiveProfileName();\n if (!activeProfile) {\n throw new ProfileStashError(\n \"No active profile to stash. Set one with profile use <name> first.\",\n );\n }\n if (isEmptyBuiltinProfile(activeProfile)) {\n throw new ProfileStashError(\n 'Legacy active profile \"empty\" has no stashable state. Run profile use <name>, then profile stash.',\n );\n }\n return activeProfile;\n}\n\nexport interface StashClearedUntrackedResult {\n dry_run: boolean;\n profile_name: string;\n removed_files: string[];\n}\n\nexport interface StashProfileResult {\n entry: ProfileStashEntry;\n cleared: StashClearedUntrackedResult;\n}\n\nfunction readHomeFile(homeRoot: string, relativePath: string): string | null {\n const fullPath = resolve(homeRoot, relativePath);\n if (!existsSync(fullPath)) {\n return null;\n }\n try {\n const bytes = readFileSync(fullPath);\n const text = bytes.toString(\"utf-8\");\n // The stash keeps text. A file that is not UTF-8 text (an image, a font)\n // would come back changed, so it is left in place, never stashed or rewritten.\n return Buffer.from(text, \"utf-8\").equals(bytes) ? text : null;\n } catch {\n return null;\n }\n}\n\nfunction lastWrittenContent(profileName: string, relativePath: string): Buffer | undefined {\n const snapshot = getLatestGlobalApplySnapshotForProfile(profileName);\n if (!snapshot?.state) {\n return undefined;\n }\n return flattenLiveRestoreFiles(snapshot.state, snapshot.id).find((file) => file.path === relativePath)?.bytes;\n}\n\n/**\n * Stash modified managed files (the same set `--changes save` walks) and restore\n * last-apply bytes when known. Never deletes the path.\n */\nexport async function stashManagedDriftChanges(input: {\n changes: DriftFileChange[];\n dryRun?: boolean;\n}): Promise<StashProfileResult> {\n return withProfileApplyLock(async () => {\n const profileName = resolveStashableActiveProfile();\n const homeRoot = resolveHomeRoot();\n const files: StashedFileSnapshot[] = [];\n for (const change of input.changes) {\n const current = readHomeFile(homeRoot, change.path);\n if (current === null) {\n continue;\n }\n files.push({ path: change.path, content: current });\n }\n if (files.length === 0) {\n throw new ProfileStashError(\"No unsaved changes to stash.\");\n }\n\n const contents = buildProfileContents(profileName) ?? emptyProfileContents();\n const fileChanges = stashedFilesToDriftChanges(files);\n\n if (!input.dryRun) {\n for (const file of files) {\n const previous = lastWrittenContent(profileName, file.path);\n if (previous === undefined) {\n continue;\n }\n const fullPath = resolve(homeRoot, file.path);\n mkdirSync(dirname(fullPath), { recursive: true });\n writeFileSync(fullPath, previous);\n }\n }\n\n if (input.dryRun) {\n return {\n entry: {\n id: \"dry-run\",\n profile_name: profileName,\n created_at: new Date().toISOString(),\n contents,\n file_changes: fileChanges,\n stashed_files: files,\n },\n cleared: {\n dry_run: true,\n profile_name: profileName,\n removed_files: [],\n },\n };\n }\n\n const entry = pushProfileStashEntry({\n profile_name: profileName,\n contents,\n file_changes: fileChanges,\n stashed_files: files,\n });\n return {\n entry,\n cleared: {\n dry_run: false,\n profile_name: profileName,\n removed_files: [],\n },\n };\n });\n}\n\nexport async function stashProfileCommand(\n options: ApplyProfilePluginOptions,\n): Promise<StashProfileResult> {\n return withProfileApplyLock(async () => {\n const profileName = resolveStashableActiveProfile();\n let capture: Awaited<ReturnType<typeof captureUntrackedResourcesForStash>>;\n try {\n capture = await captureUntrackedResourcesForStash({\n profileSelector: profileName,\n harness: options.harness,\n });\n } catch (error) {\n throw new ProfileStashError(\n error instanceof Error ? error.message : String(error),\n );\n }\n\n const homeRoot = resolveHomeRoot();\n const contents = buildContentsFromResources(capture.resources);\n const fileChanges = stashedFilesToDriftChanges(capture.files);\n const removedFiles = removeUntrackedStashFiles(\n homeRoot,\n capture.files,\n options.dryRun,\n );\n\n if (options.dryRun) {\n return {\n entry: {\n id: \"dry-run\",\n profile_name: profileName,\n created_at: new Date().toISOString(),\n contents,\n file_changes: fileChanges,\n stashed_files: capture.files,\n },\n cleared: {\n dry_run: true,\n profile_name: profileName,\n removed_files: removedFiles,\n },\n };\n }\n\n const entry = pushProfileStashEntry({\n profile_name: profileName,\n contents,\n file_changes: fileChanges,\n stashed_files: capture.files,\n });\n\n return {\n entry,\n cleared: {\n dry_run: false,\n profile_name: profileName,\n removed_files: removedFiles,\n },\n };\n });\n}\n\nexport interface RestoreStashedUntrackedResult {\n dry_run: boolean;\n profile_name: string;\n restored_files: string[];\n cancelled: boolean;\n}\n\nexport interface RestoreProfileStashResult {\n entry: ProfileStashEntry;\n restored: RestoreStashedUntrackedResult;\n removed: boolean;\n}\n\nexport async function popProfileStashCommand(\n options: ApplyProfilePluginOptions,\n): Promise<RestoreProfileStashResult> {\n return withProfileApplyLock(async () => {\n const entry = popProfileStashEntry();\n if (!entry) {\n throw new ProfileStashError(\"No stashed profile to restore.\");\n }\n const homeRoot = resolveHomeRoot();\n const restoredFiles = restoreUntrackedStashFiles(\n homeRoot,\n entry.stashed_files,\n options.dryRun,\n );\n return {\n entry,\n restored: {\n dry_run: options.dryRun === true,\n profile_name: entry.profile_name,\n restored_files: restoredFiles,\n cancelled: false,\n },\n removed: true,\n };\n });\n}\n\nexport async function applyProfileStashCommand(\n options: ApplyProfilePluginOptions,\n): Promise<RestoreProfileStashResult> {\n return withProfileApplyLock(async () => {\n const entry = peekProfileStashEntry();\n if (!entry) {\n throw new ProfileStashError(\"No stashed profile to restore.\");\n }\n const homeRoot = resolveHomeRoot();\n const restoredFiles = restoreUntrackedStashFiles(\n homeRoot,\n entry.stashed_files,\n options.dryRun,\n );\n return {\n entry,\n restored: {\n dry_run: options.dryRun === true,\n profile_name: entry.profile_name,\n restored_files: restoredFiles,\n cancelled: false,\n },\n removed: false,\n };\n });\n}\n","import {\n discardConfirm,\n discardedChangesLine,\n SWITCH_CHANGES_VALUES,\n type SwitchChangesValue,\n savedChangesLine,\n stashedChangesLine,\n unsavedChangesFlagHint,\n unsavedChangesLine,\n} from \"../copy/cli.js\";\nimport { ui } from \"../ui/index.js\";\nimport {\n detectGlobalProfileStatus,\n type GlobalProfileStatus,\n isHostPluginViewPath,\n} from \"./global-profile-drift.js\";\nimport { commitManagedPathFromLive } from \"./profile-commit-resource.js\";\nimport { stashManagedDriftChanges } from \"./profile-stash.js\";\nimport {\n promptForChoice,\n promptForConfirmation,\n shouldUseBrowsePicker,\n} from \"./wizards/shared.js\";\n\nexport type SwitchChangesDecision = \"continue\" | \"abort\";\n\nexport function parseSwitchChanges(\n raw: string | undefined,\n): SwitchChangesValue | \"invalid\" | undefined {\n if (raw === undefined || raw === \"\") {\n return undefined;\n }\n if ((SWITCH_CHANGES_VALUES as readonly string[]).includes(raw)) {\n return raw as SwitchChangesValue;\n }\n return \"invalid\";\n}\n\nexport async function maybeSyncActiveProfileBeforeSwitch(input: {\n targetProfileName: string;\n harness?: string;\n yes?: boolean;\n format?: string;\n changes?: string;\n noInteractive?: boolean;\n}): Promise<SwitchChangesDecision> {\n const format = input.format ?? \"human\";\n\n let status: GlobalProfileStatus;\n try {\n status = await detectGlobalProfileStatus({\n harness: input.harness,\n depth: \"full\",\n });\n } catch (error) {\n ui.warn(error instanceof Error ? error.message : String(error));\n return \"continue\";\n }\n\n if (!status.active_profile || status.active_profile === input.targetProfileName) {\n return \"continue\";\n }\n // Files in a plugin cache folder are the plugin's, not the profile's: they\n // cannot be saved to it, and apply keeps the user's own files there. They\n // are listed by `profile status` but are not unsaved changes. Neither are\n // the plugin registry entries Claude Code changed: apply keeps those too.\n const changes = status.changes.filter((change) =>\n !isHostPluginViewPath(change.path) && change.changed_by !== \"claude-code\");\n if (changes.length === 0) {\n return \"continue\";\n }\n\n const count = changes.length;\n const parsedChanges = parseSwitchChanges(input.changes);\n if (parsedChanges === \"invalid\") {\n ui.danger('Error: Invalid --changes. Use save, stash or discard.');\n return \"abort\";\n }\n\n const interactive =\n !input.yes\n && shouldUseBrowsePicker({\n noInteractive: input.noInteractive,\n format,\n });\n\n let action: SwitchChangesValue | \"cancel\";\n if (parsedChanges) {\n action = parsedChanges;\n } else if (!interactive) {\n ui.danger(`Error: ${unsavedChangesLine(status.active_profile, count)}`);\n ui.hint(unsavedChangesFlagHint());\n return \"abort\";\n } else {\n ui.warn(unsavedChangesLine(status.active_profile, count));\n action = await promptForChoice({\n message: \"What should HarnessTap do with them?\",\n choices: [\n { name: `Save them to \"${status.active_profile}\"`, value: \"save\" as const },\n { name: \"Stash them\", value: \"stash\" as const },\n { name: \"Discard them\", value: \"discard\" as const },\n { name: \"Cancel\", value: \"cancel\" as const },\n ],\n });\n }\n\n switch (action) {\n case \"cancel\":\n return \"abort\";\n case \"save\": {\n for (const change of changes) {\n try {\n await commitManagedPathFromLive({\n profileSelector: status.active_profile,\n path: change.path,\n scope: \"home\",\n ...(input.harness ? { harness: input.harness } : {}),\n });\n } catch {\n // Aggregate paths or unmapped files stay on disk; switch still proceeds.\n }\n }\n ui.success(savedChangesLine(status.active_profile, count));\n return \"continue\";\n }\n case \"stash\": {\n await stashManagedDriftChanges({\n changes,\n });\n ui.success(stashedChangesLine(count, \"ht profile stash pop\"));\n return \"continue\";\n }\n case \"discard\": {\n if (interactive && parsedChanges !== \"discard\") {\n const confirmed = await promptForConfirmation({\n message: discardConfirm(count),\n default: false,\n });\n if (!confirmed) {\n return \"abort\";\n }\n }\n ui.success(discardedChangesLine(count));\n return \"continue\";\n }\n default: {\n const unhandled: never = action;\n throw new Error(`Unhandled switch changes action: ${String(unhandled)}`);\n }\n }\n}\n","import {\n resolveProfileEnvironment,\n type ProjectProfileEntry,\n type ResolvedProjectConfig,\n} from \"../project-config.js\";\nimport {\n promptForChoice,\n promptForSearchableChoice,\n type PromptChoice,\n} from \"./shared.js\";\n\nfunction formatProfilePluginHint(entry: ProjectProfileEntry): string {\n switch (entry.source) {\n case \"catalog\":\n case \"local\":\n return entry.selector ?? entry.name;\n case \"inline\":\n return entry.plugin ?? entry.name;\n default: {\n const unhandledSource: never = entry.source;\n throw new Error(`Unhandled profile source: ${unhandledSource}`);\n }\n }\n}\n\nfunction formatProjectProfileChoiceName(\n config: ResolvedProjectConfig,\n entry: ProjectProfileEntry,\n): string {\n const parts = [entry.name, entry.source, formatProfilePluginHint(entry)];\n const environment = resolveProfileEnvironment(config, entry);\n if (environment) {\n parts.push(`env ${environment}`);\n }\n return parts.join(\" · \");\n}\n\nexport function buildProjectProfileChoices(\n config: ResolvedProjectConfig,\n): PromptChoice<string>[] {\n return config.profiles.map((entry) => ({\n name: formatProjectProfileChoiceName(config, entry),\n value: entry.name,\n }));\n}\n\nfunction resolveDefaultProfileKey(config: ResolvedProjectConfig): string | undefined {\n const defaultProfile = config.default_profile;\n if (!defaultProfile) {\n return undefined;\n }\n return config.profiles.some((profile) => profile.name === defaultProfile)\n ? defaultProfile\n : undefined;\n}\n\nexport async function promptForProjectProfile(\n config: ResolvedProjectConfig,\n): Promise<string> {\n const choices = buildProjectProfileChoices(config);\n const defaultProfile = resolveDefaultProfileKey(config);\n const message = \"Which project profile should be used?\";\n\n if (choices.length >= 5) {\n return promptForSearchableChoice({\n message,\n choices,\n default: defaultProfile,\n });\n }\n\n return promptForChoice({\n message,\n choices,\n default: defaultProfile,\n });\n}\n","import {\n isEmptyBuiltinProfile,\n isProfilePlugin,\n} from \"../constants/profile.js\";\nimport {\n addResourceToPlugin,\n createPlugin,\n resolvePluginSelector,\n} from \"../models/plugin-model.js\";\nimport {\n normalizeResourceInput,\n upsertResource,\n} from \"../models/resource.js\";\nimport type { ClaudePluginConfig, ResourceType } from \"../types.js\";\nimport { useEnvironmentCommand } from \"./environment-commands.js\";\nimport {\n formatEnvironmentToml,\n importEnvironmentToml,\n} from \"./environment-import-export.js\";\nimport { detectGlobalProfileStatus } from \"./global-profile-drift.js\";\nimport { installPluginFromCatalog } from \"./plugin-catalog-install.js\";\nimport { parsePluginSelector, resolveRemotePluginSelector } from \"./plugin-selector.js\";\nimport {\n promptMaterializationConflict,\n resolveApplyConflictPolicy,\n} from \"./materialization-conflicts.js\";\nimport {\n findProjectConfig,\n getProfileEntry,\n resolveProfileEnvironment,\n type ProjectProfileEntry,\n type ProjectPluginTable,\n type ResolvedProjectConfig,\n} from \"./project-config.js\";\nimport { MISSING_PROJECT_CONFIG_MESSAGE } from \"./project-config-messages.js\";\nimport { promptForProjectProfile } from \"./wizards/project-use.js\";\nimport { shouldUseWizard } from \"./wizards/shared.js\";\nimport { useProfileCommand } from \"./profile-commands.js\";\nimport { stashProfileCommand, ProfileStashError } from \"./profile-stash.js\";\nimport { maybeSyncActiveProfileBeforeSwitch } from \"./profile-switch-prompt.js\";\nimport { clearGlobalProfileApply, type ApplyProfilePluginResult } from \"./profile-apply.js\";\nimport { clearActiveProfileName, getActiveProfileName } from \"./active-profile.js\";\nimport { getGlobalActiveEnvironmentName } from \"./environment-session.js\";\n\nexport interface ProjectUseOptions {\n profile?: string;\n project?: string;\n dryRun?: boolean;\n force?: boolean;\n pull?: boolean;\n harness?: string;\n account?: string;\n baseUrl?: string;\n onConflict?: string;\n format?: string;\n yes?: boolean;\n interactive?: boolean;\n noInteractive?: boolean;\n}\n\nexport type ProjectUseResult =\n | {\n skipped: true;\n profile_key: string;\n plugin_name: string;\n environment_name?: string;\n }\n | ({\n skipped: false;\n profile_key: string;\n plugin_name: string;\n environment_name?: string;\n stashed?: boolean;\n stash_id?: string;\n } & ApplyProfilePluginResult);\n\nfunction assertProfilePlugin(plugin: { name: string; tags: string[] }, context: string): void {\n if (!isProfilePlugin(plugin)) {\n throw new Error(`Plugin \"${plugin.name}\" is not tagged as a profile (${context})`);\n }\n}\n\nfunction resolvePluginNameFromSelector(selector: string): string {\n const existing = resolvePluginSelector(selector);\n if (existing) {\n return existing.name;\n }\n return parsePluginSelector(selector).name;\n}\n\nexport function resolveExpectedPluginName(\n config: ResolvedProjectConfig,\n entry: ProjectProfileEntry,\n): string {\n switch (entry.source) {\n case \"catalog\":\n case \"local\": {\n const selector = entry.selector;\n if (!selector) {\n throw new Error(`Profile ${entry.name} is missing a plugin selector.`);\n }\n return resolvePluginNameFromSelector(selector);\n }\n case \"inline\": {\n const pluginKey = entry.plugin;\n if (!pluginKey) {\n throw new Error(`Inline profile ${entry.name} is missing a plugin reference.`);\n }\n const inlinePlugin = config.plugins.find((plugin) => plugin.name === pluginKey);\n return inlinePlugin?.name ?? pluginKey;\n }\n default: {\n const unhandledSource: never = entry.source;\n throw new Error(`Unhandled profile source: ${unhandledSource}`);\n }\n }\n}\n\nfunction resolvePreviewPluginName(\n config: ResolvedProjectConfig,\n entry: ProjectProfileEntry,\n): string {\n return resolveExpectedPluginName(config, entry);\n}\n\nfunction findInlinePluginTable(\n config: ResolvedProjectConfig,\n pluginKey: string,\n): ProjectPluginTable {\n const plugin = config.plugins.find((entry) => entry.name === pluginKey);\n if (!plugin) {\n throw new Error(`Inline profile references unknown plugin: ${pluginKey}`);\n }\n return plugin;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\n\nfunction importInlinePluginTable(pluginTable: ProjectPluginTable) {\n const resourcesRaw = Array.isArray(pluginTable.resources) ? pluginTable.resources : [];\n const plugin = createPlugin({\n name: pluginTable.name,\n version: typeof pluginTable.version === \"string\" ? pluginTable.version : \"1.0.0\",\n description: typeof pluginTable.description === \"string\" ? pluginTable.description : \"\",\n tags: Array.isArray(pluginTable.tags) ? pluginTable.tags.map(String) : [],\n ...(isRecord(pluginTable.claude)\n ? { claude: pluginTable.claude as ClaudePluginConfig }\n : {}),\n });\n\n for (const raw of resourcesRaw) {\n if (!isRecord(raw)) continue;\n const metadata = isRecord(raw.metadata)\n ? raw.metadata\n : typeof raw.metadata_json === \"string\"\n ? (JSON.parse(raw.metadata_json) as Record<string, unknown>)\n : {};\n const upserted = upsertResource(\n normalizeResourceInput({\n type: String(raw.type ?? \"\") as ResourceType,\n name: String(raw.name ?? \"\"),\n description: String(raw.description ?? \"\"),\n content: String(raw.content ?? \"\"),\n metadata,\n source: `project-inline:${pluginTable.name}`,\n namespace: String(raw.namespace ?? \"\"),\n origin_kind: (raw.origin_kind ?? \"manual\") as \"manual\",\n origin_ref: String(raw.origin_ref ?? \"\"),\n }),\n { policy: \"overwrite\" },\n );\n if (upserted.action === \"skipped\") {\n throw new Error(`Failed to import inline resource: ${String(raw.type)}:${String(raw.name)}`);\n }\n addResourceToPlugin(plugin.id, upserted.resource.id);\n }\n\n return plugin;\n}\n\nexport async function resolveProjectProfileKey(\n config: ResolvedProjectConfig,\n options: Pick<ProjectUseOptions, \"profile\" | \"format\" | \"interactive\" | \"noInteractive\">,\n): Promise<string> {\n if (options.profile) {\n getProfileEntry(config, options.profile);\n return options.profile;\n }\n\n if (config.profiles.length === 0) {\n throw new Error(\"Project config has no profiles\");\n }\n\n if (config.profiles.length === 1) {\n const [onlyProfile] = config.profiles;\n if (!onlyProfile) {\n throw new Error(\"Project config has no profiles\");\n }\n return onlyProfile.name;\n }\n\n if (\n shouldUseWizard({\n interactive: options.interactive,\n noInteractive: options.noInteractive,\n format: options.format,\n missingRequiredArgs: !options.profile,\n })\n ) {\n return promptForProjectProfile(config);\n }\n\n throw new Error(\"multiple profiles configured; pass --profile <name>\");\n}\n\nexport async function resolveProjectProfilePluginName(\n config: ResolvedProjectConfig,\n entry: ProjectProfileEntry,\n options: Pick<ProjectUseOptions, \"pull\" | \"account\" | \"baseUrl\">,\n): Promise<string> {\n const pull = options.pull ?? true;\n\n switch (entry.source) {\n case \"catalog\": {\n const selector = entry.selector;\n if (!selector) {\n throw new Error(`Catalog profile ${entry.name} is missing a plugin selector.`);\n }\n const existing = resolvePluginSelector(selector);\n if (existing) {\n assertProfilePlugin(existing, `catalog profile ${entry.name}`);\n return existing.name;\n }\n if (!pull) {\n throw new Error(\n `Profile plugin not found locally: ${selector}. Re-run with pull enabled or install the plugin first.`,\n );\n }\n\n const parsed = parsePluginSelector(selector);\n if (parsed.scope === \"published\") {\n const remote = resolveRemotePluginSelector(selector, {});\n const installed = await installPluginFromCatalog(remote, {\n account: options.account,\n baseUrl: options.baseUrl,\n });\n const plugin = resolvePluginSelector(installed.pluginName);\n if (!plugin) {\n throw new Error(`Plugin not found after catalog install: ${installed.pluginName}`);\n }\n assertProfilePlugin(plugin, `catalog profile ${entry.name}`);\n return plugin.name;\n }\n\n throw new Error(`Profile plugin not found locally: ${selector}`);\n }\n case \"local\": {\n const selector = entry.selector;\n if (!selector) {\n throw new Error(`Local profile ${entry.name} is missing a plugin selector.`);\n }\n const plugin = resolvePluginSelector(selector);\n if (!plugin) {\n throw new Error(`Profile plugin not found locally: ${selector}`);\n }\n assertProfilePlugin(plugin, `local profile ${entry.name}`);\n return plugin.name;\n }\n case \"inline\": {\n const pluginKey = entry.plugin;\n if (!pluginKey) {\n throw new Error(`Inline profile ${entry.name} is missing a plugin reference.`);\n }\n const pluginTable = findInlinePluginTable(config, pluginKey);\n const imported = importInlinePluginTable(pluginTable);\n assertProfilePlugin(imported, `inline profile ${entry.name}`);\n return imported.name;\n }\n default: {\n const unhandledSource: never = entry.source;\n throw new Error(`Unhandled profile source: ${unhandledSource}`);\n }\n }\n}\n\nexport async function importProjectConfigEnvironments(\n config: ResolvedProjectConfig,\n): Promise<void> {\n for (const environment of config.environments) {\n importEnvironmentToml(formatEnvironmentToml(environment), {\n createIfMissing: true,\n });\n }\n}\n\nexport async function shouldSkipProjectUse(input: {\n pluginName: string;\n environmentName?: string;\n force?: boolean;\n harness?: string;\n}): Promise<boolean> {\n if (input.force) {\n return false;\n }\n\n const activeProfile = getActiveProfileName();\n if (activeProfile !== input.pluginName) {\n return false;\n }\n\n const activeEnvironment = getGlobalActiveEnvironmentName();\n const environmentMatches =\n input.environmentName === undefined\n ? activeEnvironment === undefined\n : activeEnvironment === input.environmentName;\n if (!environmentMatches) {\n return false;\n }\n\n const status = await detectGlobalProfileStatus({ harness: input.harness });\n return (\n (!status.has_drift && status.stack_in_sync) ||\n (status.applied && !status.has_drift)\n );\n}\n\nexport async function executeProjectUse(\n options: ProjectUseOptions = {},\n): Promise<ProjectUseResult> {\n if (options.profile && isEmptyBuiltinProfile(options.profile)) {\n const conflictPolicy = resolveApplyConflictPolicy({\n onConflict: options.onConflict,\n noInteractive: options.noInteractive ?? options.format === \"json\",\n });\n let stashed: Awaited<ReturnType<typeof stashProfileCommand>> | undefined;\n try {\n stashed = await stashProfileCommand({\n harness: options.harness,\n dryRun: options.dryRun,\n conflictPolicy,\n pull: false,\n ...(conflictPolicy === \"prompt\"\n ? { conflictResolver: promptMaterializationConflict }\n : {}),\n });\n } catch (error) {\n if (!(error instanceof ProfileStashError)) {\n throw error;\n }\n }\n const cleared = await clearGlobalProfileApply({\n harness: options.harness,\n dryRun: options.dryRun,\n conflictPolicy,\n pull: false,\n ...(conflictPolicy === \"prompt\"\n ? { conflictResolver: promptMaterializationConflict }\n : {}),\n });\n if (!options.dryRun) {\n clearActiveProfileName();\n }\n return {\n skipped: false,\n profile_key: stashed?.entry.profile_name ?? getActiveProfileName() ?? \"empty\",\n plugin_name: cleared.profile_name,\n stashed: Boolean(stashed),\n ...(stashed ? { stash_id: stashed.entry.id } : {}),\n ...cleared,\n };\n }\n\n const config = findProjectConfig(options.project ?? process.cwd());\n if (!config) {\n throw new Error(MISSING_PROJECT_CONFIG_MESSAGE);\n }\n\n const profileKey = await resolveProjectProfileKey(config, {\n profile: options.profile,\n format: options.format,\n interactive: options.interactive,\n noInteractive: options.noInteractive,\n });\n const entry = getProfileEntry(config, profileKey);\n const environmentName = resolveProfileEnvironment(config, entry);\n const expectedPluginName = resolveExpectedPluginName(config, entry);\n const dryRun = options.dryRun === true;\n\n if (\n await shouldSkipProjectUse({\n pluginName: expectedPluginName,\n environmentName,\n force: options.force,\n harness: options.harness,\n })\n ) {\n return {\n skipped: true,\n profile_key: profileKey,\n plugin_name: expectedPluginName,\n ...(environmentName ? { environment_name: environmentName } : {}),\n };\n }\n\n if (!dryRun) {\n await importProjectConfigEnvironments(config);\n }\n\n const pluginName = dryRun\n ? resolvePreviewPluginName(config, entry)\n : await resolveProjectProfilePluginName(config, entry, {\n pull: options.pull ?? true,\n account: options.account,\n baseUrl: options.baseUrl,\n });\n\n if (environmentName && !dryRun) {\n useEnvironmentCommand(environmentName);\n }\n\n if (!dryRun) {\n const sync = await maybeSyncActiveProfileBeforeSwitch({\n targetProfileName: pluginName,\n harness: options.harness,\n yes: options.yes,\n format: options.format,\n });\n if (sync === \"abort\") {\n throw new Error(\"Profile switch cancelled.\");\n }\n }\n\n const conflictPolicy = resolveApplyConflictPolicy({\n onConflict: options.onConflict,\n noInteractive: options.noInteractive ?? options.format === \"json\",\n });\n const applied = await useProfileCommand(pluginName, {\n harness: options.harness,\n dryRun: options.dryRun,\n pull: options.pull ?? true,\n account: options.account,\n baseUrl: options.baseUrl,\n conflictPolicy,\n ...(conflictPolicy === \"prompt\"\n ? { conflictResolver: promptMaterializationConflict }\n : {}),\n });\n\n return {\n skipped: false,\n profile_key: profileKey,\n plugin_name: pluginName,\n ...(environmentName ? { environment_name: environmentName } : {}),\n ...applied,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,YAAY,MAAM,eAAe;AAGnC,IAAM,gBAAN,cAA4B,MAAM;AAAA,EAC9B;AAAA,EAET,YAAY,OAAe,UAAkB;AAC3C,UAAM,wBAAwB,KAAK,GAAG;AACtC,SAAK,OAAO;AACZ,SAAK,QAAQ;AACb,SAAK,WAAW;AAAA,EAClB;AAAA,EAES;AACX;AAEO,SAAS,eAAe,KAAa,OAAO,gBAAgB,GAAW;AAC5E,QAAM,UAAU,IAAI,KAAK;AACzB,MAAI,YAAY,KAAK;AACnB,WAAO;AAAA,EACT;AACA,MAAI,QAAQ,WAAW,IAAI,KAAK,QAAQ,WAAW,KAAK,GAAG;AACzD,WAAO,KAAK,MAAM,QAAQ,MAAM,CAAC,CAAC;AAAA,EACpC;AACA,SAAO,WAAW,OAAO,IAAI,UAAU,QAAQ,OAAO;AACxD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SAAS,QAAQ;AAAA,IACjB;AAAA,IACA,GAAI,mBAAmB,WACnB,EAAE,kBAAkB,8BAA8B,IAClD,CAAC;AAAA,EACP,CAAC;AAED,SAAO;AAAA,IACL,SAAS;AAAA,IACT,aAAa;AAAA,IACb,aAAa;AAAA,IACb,GAAI,kBAAkB,EAAE,kBAAkB,gBAAgB,IAAI,CAAC;AAAA,IAC/D,GAAG;AAAA,EACL;AACF;","names":["existsSync","join","join","existsSync","latestSnapshot","expectedApply","stackInSync","applied","hasDrift","join","existsSync","readFileSync","join","resolve","join","existsSync","readFileSync","resolve","conflictPolicy"]}
|
|
@@ -13,6 +13,32 @@ function parsePluginResourceMode(value) {
|
|
|
13
13
|
// src/config/settings.ts
|
|
14
14
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
15
15
|
import { join } from "path";
|
|
16
|
+
var UPDATE_MODES = ["off", "notify", "install"];
|
|
17
|
+
var UPDATE_FREQUENCIES = ["hourly", "daily", "weekly"];
|
|
18
|
+
var UPDATE_FREQUENCY_MS = {
|
|
19
|
+
hourly: 60 * 60 * 1e3,
|
|
20
|
+
daily: 24 * 60 * 60 * 1e3,
|
|
21
|
+
weekly: 7 * 24 * 60 * 60 * 1e3
|
|
22
|
+
};
|
|
23
|
+
var DEFAULT_UPDATE_SETTINGS = {
|
|
24
|
+
mode: "notify",
|
|
25
|
+
frequency: "daily",
|
|
26
|
+
prompted: false
|
|
27
|
+
};
|
|
28
|
+
function isUpdateMode(value) {
|
|
29
|
+
return typeof value === "string" && UPDATE_MODES.includes(value);
|
|
30
|
+
}
|
|
31
|
+
function isUpdateFrequency(value) {
|
|
32
|
+
return typeof value === "string" && UPDATE_FREQUENCIES.includes(value);
|
|
33
|
+
}
|
|
34
|
+
function parseUpdateSettings(value) {
|
|
35
|
+
const raw = value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
36
|
+
return {
|
|
37
|
+
mode: isUpdateMode(raw.mode) ? raw.mode : DEFAULT_UPDATE_SETTINGS.mode,
|
|
38
|
+
frequency: isUpdateFrequency(raw.frequency) ? raw.frequency : DEFAULT_UPDATE_SETTINGS.frequency,
|
|
39
|
+
prompted: raw.prompted === true
|
|
40
|
+
};
|
|
41
|
+
}
|
|
16
42
|
var VALID_PLATFORMS = /* @__PURE__ */ new Set([
|
|
17
43
|
"claude-code",
|
|
18
44
|
"cursor",
|
|
@@ -33,7 +59,8 @@ var DEFAULTS = {
|
|
|
33
59
|
harnessSync: {
|
|
34
60
|
pluginResources: DEFAULT_PLUGIN_RESOURCE_MODE,
|
|
35
61
|
nativeAgentPlugins: false
|
|
36
|
-
}
|
|
62
|
+
},
|
|
63
|
+
updates: DEFAULT_UPDATE_SETTINGS
|
|
37
64
|
};
|
|
38
65
|
function isPluginMarketplacePlatform(value) {
|
|
39
66
|
return typeof value === "string" && VALID_PLATFORMS.has(value);
|
|
@@ -196,7 +223,8 @@ function loadSettings(harnesstapDir) {
|
|
|
196
223
|
harnessSync: {
|
|
197
224
|
pluginResources: isPluginResourceMode(pluginResources) ? pluginResources : DEFAULTS.harnessSync.pluginResources,
|
|
198
225
|
nativeAgentPlugins
|
|
199
|
-
}
|
|
226
|
+
},
|
|
227
|
+
updates: parseUpdateSettings(raw.updates)
|
|
200
228
|
};
|
|
201
229
|
} catch {
|
|
202
230
|
return DEFAULTS;
|
|
@@ -230,20 +258,57 @@ function saveSettings(harnesstapDir, settings) {
|
|
|
230
258
|
...existing,
|
|
231
259
|
plugins: settings.plugins,
|
|
232
260
|
pluginVersionHistoryLimit: settings.pluginVersionHistoryLimit,
|
|
233
|
-
harnessSync: settings.harnessSync
|
|
261
|
+
harnessSync: settings.harnessSync,
|
|
262
|
+
updates: settings.updates
|
|
234
263
|
},
|
|
235
264
|
path
|
|
236
265
|
);
|
|
237
266
|
}
|
|
267
|
+
function loadUpdateSettings(harnesstapDir) {
|
|
268
|
+
return loadSettings(harnesstapDir).updates;
|
|
269
|
+
}
|
|
270
|
+
function saveUpdateSettings(harnesstapDir, patch) {
|
|
271
|
+
const path = settingsPath(harnesstapDir);
|
|
272
|
+
const existing = readToolkitConfigRecord(harnesstapDir, path);
|
|
273
|
+
const next = parseUpdateSettings({ ...parseUpdateSettings(existing.updates), ...patch });
|
|
274
|
+
writeToolkitConfigRecord(harnesstapDir, { ...existing, updates: next }, path);
|
|
275
|
+
return next;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// src/telemetry/product.ts
|
|
279
|
+
var productOverride;
|
|
280
|
+
function setTelemetryProduct(product) {
|
|
281
|
+
productOverride = product;
|
|
282
|
+
}
|
|
283
|
+
function resolveTelemetryProduct() {
|
|
284
|
+
if (productOverride) {
|
|
285
|
+
return productOverride;
|
|
286
|
+
}
|
|
287
|
+
const env = process.env.HARNESSTAP_PRODUCT?.trim().toLowerCase();
|
|
288
|
+
if (env === "cli" || env === "desktop") {
|
|
289
|
+
return env;
|
|
290
|
+
}
|
|
291
|
+
const exe = `${process.argv[1] ?? ""} ${process.execPath}`;
|
|
292
|
+
if (exe.includes("ht-agent")) {
|
|
293
|
+
return "desktop";
|
|
294
|
+
}
|
|
295
|
+
return "cli";
|
|
296
|
+
}
|
|
238
297
|
|
|
239
298
|
export {
|
|
240
299
|
DEFAULT_PLUGIN_RESOURCE_MODE,
|
|
241
300
|
parsePluginResourceMode,
|
|
301
|
+
isUpdateMode,
|
|
302
|
+
isUpdateFrequency,
|
|
242
303
|
DEFAULT_MARKETPLACE_REFRESH_MAX_AGE_MINUTES,
|
|
243
304
|
marketplaceRefreshMaxAgeMs,
|
|
244
305
|
parseTrackedBranches,
|
|
245
306
|
parseJsonc,
|
|
246
307
|
loadSettings,
|
|
247
|
-
saveSettings
|
|
308
|
+
saveSettings,
|
|
309
|
+
loadUpdateSettings,
|
|
310
|
+
saveUpdateSettings,
|
|
311
|
+
setTelemetryProduct,
|
|
312
|
+
resolveTelemetryProduct
|
|
248
313
|
};
|
|
249
|
-
//# sourceMappingURL=chunk-
|
|
314
|
+
//# sourceMappingURL=chunk-CWXCZBJR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/services/plugin-resource-mode.ts","../src/config/settings.ts","../src/telemetry/product.ts"],"sourcesContent":["export const PLUGIN_RESOURCE_MODES = [\"symlink\", \"copy\", \"clone\"] as const;\n\nexport type PluginResourceMode = (typeof PLUGIN_RESOURCE_MODES)[number];\n\nexport const DEFAULT_PLUGIN_RESOURCE_MODE: PluginResourceMode = \"symlink\";\n\nexport function isPluginResourceMode(value: unknown): value is PluginResourceMode {\n return value === \"symlink\" || value === \"copy\" || value === \"clone\";\n}\n\nexport function parsePluginResourceMode(\n value: string | undefined,\n): PluginResourceMode {\n if (isPluginResourceMode(value)) return value;\n throw new Error(\n `Invalid plugin resource mode: ${value}. Use symlink, copy, or clone.`,\n );\n}\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport {\n DEFAULT_PLUGIN_RESOURCE_MODE,\n isPluginResourceMode,\n type PluginResourceMode,\n} from \"../services/plugin-resource-mode.js\";\n\nexport type PluginMarketplacePlatform =\n | \"claude-code\"\n | \"cursor\"\n | \"goose\"\n | \"copilot-cli\";\n\nexport interface PluginMarketplaceEntry {\n name: string;\n url: string;\n platforms: PluginMarketplacePlatform[];\n /** Extra git branches to catalog. Empty/omitted tracks only the default branch. */\n trackedBranches?: string[];\n}\n\nexport type UpdateMode = \"off\" | \"notify\" | \"install\";\nexport type UpdateFrequency = \"hourly\" | \"daily\" | \"weekly\";\n\n/** Upstream update checks (B3). Auto-install stays off unless the user picks it. */\nexport interface UpdateSettings {\n /** off: no remote checks (synced profiles still follow their parent). notify: check and show updates. install: also install in-range minor and patch versions. */\n mode: UpdateMode;\n /** How often the Desktop sidecar checks upstreams. */\n frequency: UpdateFrequency;\n /** True once the one-time \"Keep plugins up to date?\" prompt was answered. */\n prompted: boolean;\n}\n\nexport const UPDATE_MODES: readonly UpdateMode[] = [\"off\", \"notify\", \"install\"];\nexport const UPDATE_FREQUENCIES: readonly UpdateFrequency[] = [\"hourly\", \"daily\", \"weekly\"];\n\nexport const UPDATE_FREQUENCY_MS: Record<UpdateFrequency, number> = {\n hourly: 60 * 60 * 1000,\n daily: 24 * 60 * 60 * 1000,\n weekly: 7 * 24 * 60 * 60 * 1000,\n};\n\nexport const DEFAULT_UPDATE_SETTINGS: UpdateSettings = {\n mode: \"notify\",\n frequency: \"daily\",\n prompted: false,\n};\n\nexport function isUpdateMode(value: unknown): value is UpdateMode {\n return typeof value === \"string\" && (UPDATE_MODES as readonly string[]).includes(value);\n}\n\nexport function isUpdateFrequency(value: unknown): value is UpdateFrequency {\n return typeof value === \"string\" && (UPDATE_FREQUENCIES as readonly string[]).includes(value);\n}\n\nexport function parseUpdateSettings(value: unknown): UpdateSettings {\n const raw = value && typeof value === \"object\" && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : {};\n return {\n mode: isUpdateMode(raw.mode) ? raw.mode : DEFAULT_UPDATE_SETTINGS.mode,\n frequency: isUpdateFrequency(raw.frequency) ? raw.frequency : DEFAULT_UPDATE_SETTINGS.frequency,\n prompted: raw.prompted === true,\n };\n}\n\nexport interface HarnesstapSettings {\n plugins: {\n refreshMaxAgeHours: number;\n marketplaceRefreshMaxAgeMinutes: number;\n marketplaces: PluginMarketplaceEntry[];\n };\n pluginVersionHistoryLimit: number;\n harnessSync: {\n pluginResources: PluginResourceMode;\n /** When true, Codex and Copilot load Agent Plugins packages instead of the portable extract. */\n nativeAgentPlugins: boolean;\n };\n updates: UpdateSettings;\n}\n\nconst VALID_PLATFORMS = new Set<PluginMarketplacePlatform>([\n \"claude-code\",\n \"cursor\",\n \"goose\",\n \"copilot-cli\",\n]);\n\nexport const DEFAULT_MARKETPLACE_REFRESH_MAX_AGE_MINUTES = 60;\n\nexport function marketplaceRefreshMaxAgeMs(minutes: number): number {\n return minutes * 60 * 1000;\n}\n\nconst DEFAULTS: HarnesstapSettings = {\n plugins: {\n refreshMaxAgeHours: 24,\n marketplaceRefreshMaxAgeMinutes: DEFAULT_MARKETPLACE_REFRESH_MAX_AGE_MINUTES,\n marketplaces: [],\n },\n pluginVersionHistoryLimit: 10,\n harnessSync: {\n pluginResources: DEFAULT_PLUGIN_RESOURCE_MODE,\n nativeAgentPlugins: false,\n },\n updates: DEFAULT_UPDATE_SETTINGS,\n};\n\nfunction isPluginMarketplacePlatform(\n value: unknown,\n): value is PluginMarketplacePlatform {\n return (\n typeof value === \"string\" &&\n VALID_PLATFORMS.has(value as PluginMarketplacePlatform)\n );\n}\n\nexport function parseTrackedBranches(value: unknown): string[] {\n if (!Array.isArray(value)) return [];\n\n const seen = new Set<string>();\n const branches: string[] = [];\n for (const item of value) {\n if (typeof item !== \"string\") continue;\n const trimmed = item.trim();\n if (!trimmed || seen.has(trimmed)) continue;\n seen.add(trimmed);\n branches.push(trimmed);\n }\n return branches;\n}\n\nexport function settingsPath(harnesstapDir: string): string {\n return existsSync(join(harnesstapDir, \"config.jsonc\"))\n ? join(harnesstapDir, \"config.jsonc\")\n : join(harnesstapDir, \"config.json\");\n}\n\nexport function parseMarketplaces(value: unknown): PluginMarketplaceEntry[] {\n if (!Array.isArray(value)) return [];\n\n const marketplaces: PluginMarketplaceEntry[] = [];\n for (const row of value) {\n if (typeof row !== \"object\" || row === null) continue;\n\n const record = row as Record<string, unknown>;\n const name = record.name;\n const url = record.url;\n const platforms = record.platforms;\n\n if (typeof name !== \"string\") continue;\n const trimmedName = name.trim();\n if (trimmedName.length === 0) continue;\n if (typeof url !== \"string\") continue;\n const trimmedUrl = url.trim();\n if (trimmedUrl.length === 0) continue;\n if (!Array.isArray(platforms)) continue;\n\n const parsedPlatforms = platforms.filter(isPluginMarketplacePlatform);\n if (parsedPlatforms.length === 0) continue;\n\n const trackedBranches = parseTrackedBranches(record.trackedBranches);\n marketplaces.push({\n name: trimmedName,\n url: trimmedUrl,\n platforms: parsedPlatforms,\n ...(trackedBranches.length > 0 ? { trackedBranches } : {}),\n });\n }\n\n return marketplaces;\n}\n\nexport function parseJsonc(content: string): unknown {\n let normalized = \"\";\n let inString = false;\n let stringQuote = '\"';\n let escaping = false;\n let inLineComment = false;\n let inBlockComment = false;\n\n for (let index = 0; index < content.length; index++) {\n const char = content[index];\n const nextChar = content[index + 1];\n\n if (inLineComment) {\n if (char === \"\\n\") {\n inLineComment = false;\n normalized += char;\n }\n continue;\n }\n\n if (inBlockComment) {\n if (char === \"*\" && nextChar === \"/\") {\n inBlockComment = false;\n index++;\n }\n continue;\n }\n\n if (inString) {\n normalized += char;\n if (escaping) {\n escaping = false;\n continue;\n }\n if (char === \"\\\\\") {\n escaping = true;\n continue;\n }\n if (char === stringQuote) {\n inString = false;\n }\n continue;\n }\n\n if ((char === '\"' || char === \"'\") && !inString) {\n inString = true;\n stringQuote = char;\n normalized += char;\n continue;\n }\n\n if (char === \"/\" && nextChar === \"/\") {\n inLineComment = true;\n index++;\n continue;\n }\n\n if (char === \"/\" && nextChar === \"*\") {\n inBlockComment = true;\n index++;\n continue;\n }\n\n if (char === \",\") {\n let lookahead = index + 1;\n while (lookahead < content.length) {\n const lookaheadChar = content[lookahead];\n const lookaheadNextChar = content[lookahead + 1];\n\n if (lookaheadChar !== undefined && /\\s/.test(lookaheadChar)) {\n lookahead++;\n continue;\n }\n\n if (lookaheadChar === \"/\" && lookaheadNextChar === \"/\") {\n lookahead += 2;\n while (lookahead < content.length && content[lookahead] !== \"\\n\") {\n lookahead++;\n }\n continue;\n }\n\n if (lookaheadChar === \"/\" && lookaheadNextChar === \"*\") {\n lookahead += 2;\n while (\n lookahead < content.length &&\n !(content[lookahead] === \"*\" && content[lookahead + 1] === \"/\")\n ) {\n lookahead++;\n }\n lookahead += 2;\n continue;\n }\n\n if (lookaheadChar === \"}\" || lookaheadChar === \"]\") {\n break;\n }\n\n normalized += char;\n break;\n }\n\n if (lookahead >= content.length) {\n normalized += char;\n }\n continue;\n }\n\n normalized += char;\n }\n\n return JSON.parse(normalized);\n}\n\nexport function loadSettings(harnesstapDir: string): HarnesstapSettings {\n const path = settingsPath(harnesstapDir);\n if (!existsSync(path)) return DEFAULTS;\n try {\n const raw = parseJsonc(readFileSync(path, \"utf-8\")) as Partial<HarnesstapSettings> & {\n harnessSync?: { pluginResources?: unknown; nativeAgentPlugins?: unknown };\n };\n const hours = raw.plugins?.refreshMaxAgeHours;\n const marketplaceMinutes = raw.plugins?.marketplaceRefreshMaxAgeMinutes;\n const limit = raw.pluginVersionHistoryLimit;\n const pluginResources = raw.harnessSync?.pluginResources;\n const nativeAgentPlugins = raw.harnessSync?.nativeAgentPlugins === true;\n return {\n plugins: {\n refreshMaxAgeHours:\n typeof hours === \"number\" && hours > 0\n ? hours\n : DEFAULTS.plugins.refreshMaxAgeHours,\n marketplaceRefreshMaxAgeMinutes:\n typeof marketplaceMinutes === \"number\" && marketplaceMinutes > 0\n ? marketplaceMinutes\n : DEFAULTS.plugins.marketplaceRefreshMaxAgeMinutes,\n marketplaces: parseMarketplaces(raw.plugins?.marketplaces),\n },\n pluginVersionHistoryLimit:\n typeof limit === \"number\" && Number.isInteger(limit) && limit >= 1\n ? limit\n : DEFAULTS.pluginVersionHistoryLimit,\n harnessSync: {\n pluginResources: isPluginResourceMode(pluginResources)\n ? pluginResources\n : DEFAULTS.harnessSync.pluginResources,\n nativeAgentPlugins,\n },\n updates: parseUpdateSettings((raw as { updates?: unknown }).updates),\n };\n } catch {\n return DEFAULTS;\n }\n}\n\nexport function readToolkitConfigRecord(\n harnesstapDir: string,\n path = settingsPath(harnesstapDir),\n): Record<string, unknown> {\n if (!existsSync(path)) {\n return {};\n }\n try {\n const parsed = parseJsonc(readFileSync(path, \"utf-8\"));\n if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n return parsed as Record<string, unknown>;\n }\n return {};\n } catch {\n return {};\n }\n}\n\nexport function writeToolkitConfigRecord(\n harnesstapDir: string,\n record: Record<string, unknown>,\n path = settingsPath(harnesstapDir),\n): void {\n mkdirSync(harnesstapDir, { recursive: true });\n writeFileSync(path, `${JSON.stringify(record, null, 2)}\\n`, \"utf-8\");\n}\n\nexport function saveSettings(\n harnesstapDir: string,\n settings: HarnesstapSettings,\n): void {\n const path = settingsPath(harnesstapDir);\n const existing = readToolkitConfigRecord(harnesstapDir, path);\n writeToolkitConfigRecord(\n harnesstapDir,\n {\n ...existing,\n plugins: settings.plugins,\n pluginVersionHistoryLimit: settings.pluginVersionHistoryLimit,\n harnessSync: settings.harnessSync,\n updates: settings.updates,\n },\n path,\n );\n}\n\nexport function loadUpdateSettings(harnesstapDir: string): UpdateSettings {\n return loadSettings(harnesstapDir).updates;\n}\n\n/**\n * Change only the `updates` keys. Every other key in config.jsonc is kept as\n * it is (the file is rewritten as JSON, like every other settings write).\n */\nexport function saveUpdateSettings(\n harnesstapDir: string,\n patch: Partial<UpdateSettings>,\n): UpdateSettings {\n const path = settingsPath(harnesstapDir);\n const existing = readToolkitConfigRecord(harnesstapDir, path);\n const next = parseUpdateSettings({ ...parseUpdateSettings(existing.updates), ...patch });\n writeToolkitConfigRecord(harnesstapDir, { ...existing, updates: next }, path);\n return next;\n}\n","import type { TelemetryProduct } from \"./types.js\";\n\nlet productOverride: TelemetryProduct | undefined;\n\nexport function setTelemetryProduct(product: TelemetryProduct): void {\n productOverride = product;\n}\n\nexport function resetTelemetryProductForTests(): void {\n productOverride = undefined;\n}\n\nexport function resolveTelemetryProduct(): TelemetryProduct {\n if (productOverride) {\n return productOverride;\n }\n const env = process.env.HARNESSTAP_PRODUCT?.trim().toLowerCase();\n if (env === \"cli\" || env === \"desktop\") {\n return env;\n }\n const exe = `${process.argv[1] ?? \"\"} ${process.execPath}`;\n if (exe.includes(\"ht-agent\")) {\n return \"desktop\";\n }\n return \"cli\";\n}\n"],"mappings":";AAIO,IAAM,+BAAmD;AAEzD,SAAS,qBAAqB,OAA6C;AAChF,SAAO,UAAU,aAAa,UAAU,UAAU,UAAU;AAC9D;AAEO,SAAS,wBACd,OACoB;AACpB,MAAI,qBAAqB,KAAK,EAAG,QA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