harnesstap 1.4.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/apply-ZGEAY6YZ.js +50 -0
- package/dist/{approve-FBGYQGWN.js → approve-VPVMU2MM.js} +10 -13
- package/dist/{approve-FBGYQGWN.js.map → approve-VPVMU2MM.js.map} +1 -1
- package/dist/{audit-VI4QZ6X2.js → audit-AO7AGET3.js} +11 -15
- package/dist/{audit-VI4QZ6X2.js.map → audit-AO7AGET3.js.map} +1 -1
- package/dist/{auth-4CQCDS2W.js → auth-7YRIJNXU.js} +10 -12
- package/dist/{auth-4CQCDS2W.js.map → auth-7YRIJNXU.js.map} +1 -1
- package/dist/bin.js +13 -34
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-OML4HXKT.js → chunk-262KZULH.js} +16 -22
- package/dist/chunk-262KZULH.js.map +1 -0
- package/dist/{chunk-ZUASVASP.js → chunk-26QGX47N.js} +26097 -16881
- package/dist/chunk-26QGX47N.js.map +1 -0
- package/dist/{chunk-3P6BWL5F.js → chunk-27IPOVKQ.js} +2 -2
- package/dist/{chunk-M4KLHJ6U.js → chunk-2BESDRYP.js} +8 -10
- package/dist/{chunk-M4KLHJ6U.js.map → chunk-2BESDRYP.js.map} +1 -1
- package/dist/{chunk-PCMON7Y2.js → chunk-2BWIEB2G.js} +8 -10
- package/dist/{chunk-PCMON7Y2.js.map → chunk-2BWIEB2G.js.map} +1 -1
- package/dist/{chunk-XTVGCVU4.js → chunk-2NMLWSUH.js} +41 -42
- package/dist/chunk-2NMLWSUH.js.map +1 -0
- package/dist/{chunk-TQ2NA4Z4.js → chunk-4E3G4H5B.js} +8 -2
- package/dist/chunk-4E3G4H5B.js.map +1 -0
- package/dist/chunk-4QCGTUTM.js +61 -0
- package/dist/chunk-4QCGTUTM.js.map +1 -0
- package/dist/{chunk-TPEJFLV7.js → chunk-6RKJZW2N.js} +4 -6
- package/dist/{chunk-TPEJFLV7.js.map → chunk-6RKJZW2N.js.map} +1 -1
- package/dist/{chunk-JQOKQKQT.js → chunk-7IBFH736.js} +2 -2
- package/dist/{chunk-P2C7JPLD.js → chunk-CKJIS2FM.js} +6 -6
- package/dist/{chunk-R7ZOYVN3.js → chunk-CUOEQQFI.js} +187 -59
- package/dist/chunk-CUOEQQFI.js.map +1 -0
- package/dist/{chunk-REHRUNBB.js → chunk-CWXCZBJR.js} +70 -5
- package/dist/chunk-CWXCZBJR.js.map +1 -0
- package/dist/{chunk-4ZQ2SCGY.js → chunk-FLYQEB6D.js} +509 -207
- package/dist/chunk-FLYQEB6D.js.map +1 -0
- package/dist/{chunk-U6DXASQP.js → chunk-HC7IZY75.js} +2 -2
- package/dist/{chunk-UVVZHWD2.js → chunk-I4DKV63E.js} +2 -2
- package/dist/{chunk-PNGF5EV2.js → chunk-JEC5PWNH.js} +2 -2
- package/dist/{chunk-MR7IOHSX.js → chunk-KFIRABC7.js} +16 -22
- package/dist/{chunk-MR7IOHSX.js.map → chunk-KFIRABC7.js.map} +1 -1
- package/dist/{chunk-6LTLYV5D.js → chunk-LGWFLVZQ.js} +1064 -265
- package/dist/chunk-LGWFLVZQ.js.map +1 -0
- package/dist/{chunk-RDG5DT7S.js → chunk-LX6PMOOC.js} +54 -40
- package/dist/chunk-LX6PMOOC.js.map +1 -0
- package/dist/{chunk-WGP4GUYZ.js → chunk-MILGCNBK.js} +9 -11
- package/dist/{chunk-WGP4GUYZ.js.map → chunk-MILGCNBK.js.map} +1 -1
- package/dist/chunk-MKLJBW5N.js +14 -0
- package/dist/{chunk-N3ZCH64F.js → chunk-MSKTWYHG.js} +86 -32
- package/dist/chunk-MSKTWYHG.js.map +1 -0
- package/dist/{chunk-WG5A6EAU.js → chunk-MTCCUYBZ.js} +821 -28
- package/dist/chunk-MTCCUYBZ.js.map +1 -0
- package/dist/{chunk-BPWFQKI5.js → chunk-NIFKCS7J.js} +2 -2
- package/dist/{chunk-43BDGVN3.js → chunk-NWOYPK2O.js} +56 -9
- package/dist/chunk-NWOYPK2O.js.map +1 -0
- package/dist/{chunk-3FS775NP.js → chunk-NXILQDJG.js} +85 -4
- package/dist/chunk-NXILQDJG.js.map +1 -0
- package/dist/chunk-QF73VLAW.js +31673 -0
- package/dist/chunk-QF73VLAW.js.map +1 -0
- package/dist/{chunk-RFQ3N7FB.js → chunk-QHCGA6LC.js} +11 -19
- package/dist/chunk-QHCGA6LC.js.map +1 -0
- package/dist/{chunk-L6YZE5MY.js → chunk-QPJZKWML.js} +5 -7
- package/dist/{chunk-L6YZE5MY.js.map → chunk-QPJZKWML.js.map} +1 -1
- package/dist/{chunk-ULCD6DJE.js → chunk-RM7VP6ID.js} +24 -61
- package/dist/chunk-RM7VP6ID.js.map +1 -0
- package/dist/{chunk-7HP6AAI3.js → chunk-SMLO5YPI.js} +2 -2
- package/dist/{chunk-73OJQTBW.js → chunk-T2JBSRGG.js} +2 -2
- package/dist/{chunk-IE7B6Q5K.js → chunk-U5Y6WKKT.js} +17 -18
- package/dist/chunk-U5Y6WKKT.js.map +1 -0
- package/dist/chunk-UEA4NCY2.js +106 -0
- package/dist/chunk-UEA4NCY2.js.map +1 -0
- package/dist/chunk-VAPCU2FX.js +70 -0
- package/dist/chunk-VAPCU2FX.js.map +1 -0
- package/dist/{chunk-RVEXPMM3.js → chunk-WEJVFNRO.js} +3 -5
- package/dist/{chunk-RVEXPMM3.js.map → chunk-WEJVFNRO.js.map} +1 -1
- package/dist/{chunk-IMROMZ2K.js → chunk-WWFVMCTR.js} +19 -14
- package/dist/chunk-WWFVMCTR.js.map +1 -0
- package/dist/chunk-XPONNOBR.js +102 -0
- package/dist/chunk-XPONNOBR.js.map +1 -0
- package/dist/{chunk-N3VGY3T3.js → chunk-Y3HJ2F2W.js} +7 -5
- package/dist/{chunk-N3VGY3T3.js.map → chunk-Y3HJ2F2W.js.map} +1 -1
- package/dist/{chunk-2A36HWDE.js → chunk-Y4I7ZCAE.js} +129 -136
- package/dist/chunk-Y4I7ZCAE.js.map +1 -0
- package/dist/{chunk-GRASK6M6.js → chunk-ZREU2UHM.js} +5 -5
- package/dist/{chunk-QA5U36JN.js → chunk-ZT7ANP3H.js} +774 -364
- package/dist/chunk-ZT7ANP3H.js.map +1 -0
- package/dist/{chunk-EOPFER6N.js → chunk-ZUXFPAVX.js} +19 -5
- package/dist/chunk-ZUXFPAVX.js.map +1 -0
- package/dist/{chunk-D432JAXV.js → chunk-ZWB6YXVQ.js} +153 -25
- package/dist/chunk-ZWB6YXVQ.js.map +1 -0
- package/dist/{chunk-23XSG7LI.js → chunk-ZZQDJGWX.js} +4 -4
- package/dist/{compile-GXADKGH5.js → compile-IMJHVXQO.js} +33 -37
- package/dist/{compile-GXADKGH5.js.map → compile-IMJHVXQO.js.map} +1 -1
- package/dist/{config-JMHNA2U5.js → config-FVVN3NWL.js} +16 -21
- package/dist/{config-JMHNA2U5.js.map → config-FVVN3NWL.js.map} +1 -1
- package/dist/cursor-local-install-JS5KSOES.js +94 -0
- package/dist/{cursor-local-install-46RWRBDT.js.map → cursor-local-install-JS5KSOES.js.map} +1 -1
- package/dist/{cursor-local-install-46RWRBDT.js → cursor-local-install-QU5R2FV5.js} +8 -12
- package/dist/cursor-local-install-QU5R2FV5.js.map +1 -0
- package/dist/{doctor-N7ZULPOL.js → doctor-A7VUJSCP.js} +14 -17
- package/dist/doctor-A7VUJSCP.js.map +1 -0
- package/dist/{environment-OBB3WU5B.js → environment-6INIUBNC.js} +42 -50
- package/dist/environment-6INIUBNC.js.map +1 -0
- package/dist/{github-PBYBGOLH.js → github-TFJT3P53.js} +9 -10
- package/dist/{github-PBYBGOLH.js.map → github-TFJT3P53.js.map} +1 -1
- package/dist/{harness-7KYATIV6.js → harness-WQNC5HPZ.js} +46 -84
- package/dist/harness-WQNC5HPZ.js.map +1 -0
- package/dist/{help-EE3AJQD4.js → help-NMS3EXJB.js} +15 -20
- package/dist/{help-EE3AJQD4.js.map → help-NMS3EXJB.js.map} +1 -1
- package/dist/{help-VXWKLQ6A.js → help-VW4RIICD.js} +57 -575
- package/dist/help-VW4RIICD.js.map +1 -0
- package/dist/host-plugin-view-kept-HYCHDB4D.js +139 -0
- package/dist/host-plugin-view-kept-HYCHDB4D.js.map +1 -0
- package/dist/index.js +12 -16
- package/dist/{init-LBTMPDVJ.js → init-RXYL5ZUE.js} +33 -41
- package/dist/{init-LBTMPDVJ.js.map → init-RXYL5ZUE.js.map} +1 -1
- package/dist/live-read-cache-BHU6L7MA.js +13 -0
- package/dist/live-read-cache-NQU7M2C7.js +12 -0
- package/dist/{lock-WLJRXRVK.js → lock-3H3Z65DS.js} +9 -12
- package/dist/{lock-WLJRXRVK.js.map → lock-3H3Z65DS.js.map} +1 -1
- package/dist/{marketplace-GXSV6QIY.js → marketplace-KW35PJCY.js} +26 -79
- package/dist/marketplace-KW35PJCY.js.map +1 -0
- package/dist/{mcp-XPDWWU75.js → mcp-2HUGVDJ5.js} +33 -37
- package/dist/{mcp-XPDWWU75.js.map → mcp-2HUGVDJ5.js.map} +1 -1
- package/dist/{migrate-SBUIWN3U.js → migrate-6VAPYNXI.js} +93 -34
- package/dist/migrate-6VAPYNXI.js.map +1 -0
- package/dist/notifications-Y7KQCN6K.js +154 -0
- package/dist/notifications-Y7KQCN6K.js.map +1 -0
- package/dist/open-FADABB2S.js +20 -0
- package/dist/{pack-A73LDVOX.js → pack-NTECD3BZ.js} +10 -14
- package/dist/{pack-A73LDVOX.js.map → pack-NTECD3BZ.js.map} +1 -1
- package/dist/plugin-T2YFCYIO.js +47 -0
- package/dist/plugin-from-project-FGX5AHW6.js +15 -0
- package/dist/{policy-6VY3CMSU.js → policy-3FOWB4GR.js} +9 -12
- package/dist/{policy-6VY3CMSU.js.map → policy-3FOWB4GR.js.map} +1 -1
- package/dist/{profile-YCKPMRRU.js → profile-HM3ROXXB.js} +108 -78
- package/dist/profile-HM3ROXXB.js.map +1 -0
- package/dist/{project-KHPPBKPN.js → project-3DTXKMI6.js} +512 -119
- package/dist/project-3DTXKMI6.js.map +1 -0
- package/dist/{resource-IJU3FAN5.js → resource-TZDZAVZ6.js} +55 -45
- package/dist/resource-TZDZAVZ6.js.map +1 -0
- package/dist/status-refresh-worker.js +1155 -0
- package/dist/status-refresh-worker.js.map +1 -0
- package/dist/{version-Z66FWWMQ.js → version-AMZJHJIB.js} +3 -3
- package/dist/version-AMZJHJIB.js.map +1 -0
- package/package.json +16 -11
- package/dist/apply-SUNDXRJ3.js +0 -54
- package/dist/chunk-2A36HWDE.js.map +0 -1
- package/dist/chunk-2H7UOFLK.js +0 -11
- package/dist/chunk-3FS775NP.js.map +0 -1
- package/dist/chunk-43BDGVN3.js.map +0 -1
- package/dist/chunk-4ZQ2SCGY.js.map +0 -1
- package/dist/chunk-6LTLYV5D.js.map +0 -1
- package/dist/chunk-D432JAXV.js.map +0 -1
- package/dist/chunk-DF4Z7LAD.js +0 -3463
- package/dist/chunk-DF4Z7LAD.js.map +0 -1
- package/dist/chunk-EOPFER6N.js.map +0 -1
- package/dist/chunk-G6WKY2W4.js +0 -389
- package/dist/chunk-G6WKY2W4.js.map +0 -1
- package/dist/chunk-IE7B6Q5K.js.map +0 -1
- package/dist/chunk-IMROMZ2K.js.map +0 -1
- package/dist/chunk-M2U3J7UX.js +0 -46
- package/dist/chunk-M2U3J7UX.js.map +0 -1
- package/dist/chunk-N3ZCH64F.js.map +0 -1
- package/dist/chunk-NAGAJ5UM.js +0 -145
- package/dist/chunk-NAGAJ5UM.js.map +0 -1
- package/dist/chunk-OML4HXKT.js.map +0 -1
- package/dist/chunk-QA5U36JN.js.map +0 -1
- package/dist/chunk-R7ZOYVN3.js.map +0 -1
- package/dist/chunk-RDG5DT7S.js.map +0 -1
- package/dist/chunk-REHRUNBB.js.map +0 -1
- package/dist/chunk-RFQ3N7FB.js.map +0 -1
- package/dist/chunk-TQ2NA4Z4.js.map +0 -1
- package/dist/chunk-ULCD6DJE.js.map +0 -1
- package/dist/chunk-WG5A6EAU.js.map +0 -1
- package/dist/chunk-XGTTOO4R.js +0 -84
- package/dist/chunk-XGTTOO4R.js.map +0 -1
- package/dist/chunk-XTVGCVU4.js.map +0 -1
- package/dist/chunk-XUJKZQZA.js +0 -235
- package/dist/chunk-XUJKZQZA.js.map +0 -1
- package/dist/chunk-ZUASVASP.js.map +0 -1
- package/dist/doctor-N7ZULPOL.js.map +0 -1
- package/dist/environment-OBB3WU5B.js.map +0 -1
- package/dist/harness-7KYATIV6.js.map +0 -1
- package/dist/help-VXWKLQ6A.js.map +0 -1
- package/dist/live-read-cache-TUSP7U3D.js +0 -10
- package/dist/marketplace-GXSV6QIY.js.map +0 -1
- package/dist/migrate-SBUIWN3U.js.map +0 -1
- package/dist/open-HDGLYYVU.js +0 -24
- package/dist/plugin-CEO6ZJM5.js +0 -51
- package/dist/plugin-from-project-UK7VJVUP.js +0 -18
- package/dist/profile-YCKPMRRU.js.map +0 -1
- package/dist/project-KHPPBKPN.js.map +0 -1
- package/dist/resource-IJU3FAN5.js.map +0 -1
- /package/dist/{apply-SUNDXRJ3.js.map → apply-ZGEAY6YZ.js.map} +0 -0
- /package/dist/{chunk-3P6BWL5F.js.map → chunk-27IPOVKQ.js.map} +0 -0
- /package/dist/{chunk-JQOKQKQT.js.map → chunk-7IBFH736.js.map} +0 -0
- /package/dist/{chunk-P2C7JPLD.js.map → chunk-CKJIS2FM.js.map} +0 -0
- /package/dist/{chunk-U6DXASQP.js.map → chunk-HC7IZY75.js.map} +0 -0
- /package/dist/{chunk-UVVZHWD2.js.map → chunk-I4DKV63E.js.map} +0 -0
- /package/dist/{chunk-PNGF5EV2.js.map → chunk-JEC5PWNH.js.map} +0 -0
- /package/dist/{chunk-2H7UOFLK.js.map → chunk-MKLJBW5N.js.map} +0 -0
- /package/dist/{chunk-BPWFQKI5.js.map → chunk-NIFKCS7J.js.map} +0 -0
- /package/dist/{chunk-7HP6AAI3.js.map → chunk-SMLO5YPI.js.map} +0 -0
- /package/dist/{chunk-73OJQTBW.js.map → chunk-T2JBSRGG.js.map} +0 -0
- /package/dist/{chunk-GRASK6M6.js.map → chunk-ZREU2UHM.js.map} +0 -0
- /package/dist/{chunk-23XSG7LI.js.map → chunk-ZZQDJGWX.js.map} +0 -0
- /package/dist/{live-read-cache-TUSP7U3D.js.map → live-read-cache-BHU6L7MA.js.map} +0 -0
- /package/dist/{open-HDGLYYVU.js.map → live-read-cache-NQU7M2C7.js.map} +0 -0
- /package/dist/{plugin-CEO6ZJM5.js.map → open-FADABB2S.js.map} +0 -0
- /package/dist/{plugin-from-project-UK7VJVUP.js.map → plugin-T2YFCYIO.js.map} +0 -0
- /package/dist/{version-Z66FWWMQ.js.map → plugin-from-project-FGX5AHW6.js.map} +0 -0
|
@@ -1,59 +1,81 @@
|
|
|
1
1
|
import {
|
|
2
2
|
handleUseCommand
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2BESDRYP.js";
|
|
4
4
|
import {
|
|
5
5
|
makeIdColumn
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HC7IZY75.js";
|
|
7
7
|
import {
|
|
8
8
|
resolveUserPath
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-CUOEQQFI.js";
|
|
10
|
+
import "./chunk-ZUXFPAVX.js";
|
|
11
|
+
import "./chunk-SMLO5YPI.js";
|
|
12
12
|
import "./chunk-VZQG2JDV.js";
|
|
13
|
-
import {
|
|
14
|
-
promptForChoice
|
|
15
|
-
} from "./chunk-NAGAJ5UM.js";
|
|
16
13
|
import {
|
|
17
14
|
initializeSchema
|
|
18
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-NXILQDJG.js";
|
|
19
16
|
import "./chunk-I6XFZLTJ.js";
|
|
20
17
|
import {
|
|
21
18
|
parseOutputFormat,
|
|
22
19
|
printJson
|
|
23
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-4E3G4H5B.js";
|
|
24
21
|
import {
|
|
25
22
|
ON_CONFLICT_APPLY_HELP,
|
|
26
23
|
fail,
|
|
27
|
-
formatCommand
|
|
28
|
-
|
|
29
|
-
} from "./chunk-RFQ3N7FB.js";
|
|
24
|
+
formatCommand
|
|
25
|
+
} from "./chunk-QHCGA6LC.js";
|
|
30
26
|
import {
|
|
31
27
|
applyImportedSnapshotToGlobal,
|
|
32
28
|
applyScanConflicts,
|
|
29
|
+
asRestoreFile,
|
|
33
30
|
backupAndRewriteFile,
|
|
34
31
|
buildProjectStatusPayload,
|
|
35
32
|
captureManagedSnapshotState,
|
|
36
33
|
classifyManagedPathOwnership,
|
|
34
|
+
createSnapshot,
|
|
37
35
|
detectPlatforms,
|
|
36
|
+
detectProjectDriftFromLatest,
|
|
38
37
|
dropHarnessSkillsDuplicatingPluginSource,
|
|
38
|
+
ensureProjectForRoot,
|
|
39
39
|
executeSafeFileRemovals,
|
|
40
|
+
findProjectForRoot,
|
|
41
|
+
findSnapshotById,
|
|
40
42
|
flattenLiveRestoreFiles,
|
|
41
43
|
formatDriftStatusLabel,
|
|
42
44
|
formatResourceTypeSummary,
|
|
45
|
+
formatUpdatesLine,
|
|
43
46
|
generateFiles,
|
|
47
|
+
getGlobalApplySnapshot,
|
|
44
48
|
getHarnessPreference,
|
|
49
|
+
getProject,
|
|
45
50
|
getProjectHarnessConfig,
|
|
51
|
+
hasClaudeWrittenRecordShape,
|
|
46
52
|
hasPluginSourceLayout,
|
|
47
53
|
hasSharedProjectResourceFiles,
|
|
54
|
+
hashFileOrLink,
|
|
48
55
|
hashGeneratedContent,
|
|
49
56
|
hashOnDiskFile,
|
|
57
|
+
isClaudeSettingsPath2 as isClaudeSettingsPath,
|
|
58
|
+
isHostPluginViewBackupId,
|
|
50
59
|
isPluginSourcePath,
|
|
60
|
+
isSharedMergedConfigPath,
|
|
61
|
+
listGlobalApplySnapshots,
|
|
51
62
|
listImportedSnapshots,
|
|
63
|
+
listSnapshots,
|
|
52
64
|
mainScanLacksPluginSkills,
|
|
53
65
|
materializeFiles,
|
|
54
66
|
mergeReferenceResourceInputs,
|
|
55
67
|
persistMergedProjectScan,
|
|
68
|
+
reconcileMarketplacePluginTrees,
|
|
69
|
+
resolveProjectIdentity,
|
|
56
70
|
resolveScanGlobalHarnessTargets,
|
|
71
|
+
restoreBlockedGroupMessage,
|
|
72
|
+
restoreBlockedMessage,
|
|
73
|
+
restoreBlocker,
|
|
74
|
+
restoreForgottenEnabledKeys,
|
|
75
|
+
restoreForgottenSettingsMarketplaces,
|
|
76
|
+
restoreHostPluginViewBackup,
|
|
77
|
+
restoreRemovedHostPluginViews,
|
|
78
|
+
restoreRemovedOwnership,
|
|
57
79
|
restoreSafeRemovalBackup,
|
|
58
80
|
scanAndPersistPluginSource,
|
|
59
81
|
scanPlatform,
|
|
@@ -61,54 +83,242 @@ import {
|
|
|
61
83
|
scanPluginSourceForMerge,
|
|
62
84
|
scanProjectWithPluginSource,
|
|
63
85
|
setProjectHarnessConfig,
|
|
86
|
+
shortenHomePath,
|
|
64
87
|
snapshotAbsentPaths,
|
|
88
|
+
snapshotLinks,
|
|
65
89
|
uniqueHarnessTargets,
|
|
66
90
|
writeFiles
|
|
67
|
-
} from "./chunk-
|
|
68
|
-
import
|
|
69
|
-
|
|
70
|
-
|
|
91
|
+
} from "./chunk-26QGX47N.js";
|
|
92
|
+
import {
|
|
93
|
+
promptForChoice,
|
|
94
|
+
resolveHomeRoot
|
|
95
|
+
} from "./chunk-LGWFLVZQ.js";
|
|
96
|
+
import "./chunk-MSKTWYHG.js";
|
|
97
|
+
import "./chunk-CWXCZBJR.js";
|
|
98
|
+
import "./chunk-T2JBSRGG.js";
|
|
71
99
|
import {
|
|
100
|
+
CLI_COPY,
|
|
72
101
|
createProgress,
|
|
102
|
+
formatCount,
|
|
73
103
|
formatRelativeTime,
|
|
104
|
+
getDb,
|
|
74
105
|
kvBlock,
|
|
75
106
|
panel,
|
|
107
|
+
restoredRemovedLine,
|
|
76
108
|
status,
|
|
77
109
|
subheader,
|
|
78
110
|
table,
|
|
79
111
|
theme,
|
|
80
112
|
ui
|
|
81
|
-
} from "./chunk-
|
|
82
|
-
import {
|
|
83
|
-
createSnapshot,
|
|
84
|
-
detectProjectDriftFromLatest,
|
|
85
|
-
findSnapshotById,
|
|
86
|
-
getGitOrigin,
|
|
87
|
-
getGlobalApplySnapshot,
|
|
88
|
-
getProject,
|
|
89
|
-
getProjectByOrigin,
|
|
90
|
-
listGlobalApplySnapshots,
|
|
91
|
-
listSnapshots,
|
|
92
|
-
normalizeGitUrl,
|
|
93
|
-
projectNameFromUrl,
|
|
94
|
-
resolveHomeRoot,
|
|
95
|
-
upsertProject
|
|
96
|
-
} from "./chunk-DF4Z7LAD.js";
|
|
97
|
-
import "./chunk-G6WKY2W4.js";
|
|
98
|
-
import "./chunk-73OJQTBW.js";
|
|
99
|
-
import {
|
|
100
|
-
CLI_COPY,
|
|
101
|
-
formatCount,
|
|
102
|
-
getDb,
|
|
103
|
-
restoredRemovedLine
|
|
104
|
-
} from "./chunk-WG5A6EAU.js";
|
|
113
|
+
} from "./chunk-MTCCUYBZ.js";
|
|
105
114
|
|
|
106
115
|
// src/cli/commands/project.ts
|
|
107
116
|
import { resolve as resolve2 } from "path";
|
|
108
117
|
|
|
109
118
|
// src/services/snapshot-revert.ts
|
|
110
|
-
import { existsSync, readFileSync } from "fs";
|
|
111
|
-
import { resolve } from "path";
|
|
119
|
+
import { existsSync, lstatSync, mkdirSync, readFileSync, readlinkSync, symlinkSync } from "fs";
|
|
120
|
+
import { dirname, resolve } from "path";
|
|
121
|
+
|
|
122
|
+
// src/services/revert-plugin-registry.ts
|
|
123
|
+
var REGISTRY_RE = /^(.*)\/plugins\/(installed_plugins|known_marketplaces)\.json$/;
|
|
124
|
+
function jsonKeys(content, field) {
|
|
125
|
+
if (content === void 0) return [];
|
|
126
|
+
try {
|
|
127
|
+
const parsed = JSON.parse(content);
|
|
128
|
+
const value = field ? parsed[field] : parsed;
|
|
129
|
+
return typeof value === "object" && value !== null ? Object.keys(value) : [];
|
|
130
|
+
} catch {
|
|
131
|
+
return [];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
function harnessTapRegistered(content) {
|
|
135
|
+
if (content === void 0) return [];
|
|
136
|
+
try {
|
|
137
|
+
const plugins = JSON.parse(content).plugins;
|
|
138
|
+
if (typeof plugins !== "object" || plugins === null) return [];
|
|
139
|
+
return Object.entries(plugins).filter(([, rows]) => !(Array.isArray(rows) && rows.length > 0 && rows.every(hasClaudeWrittenRecordShape))).map(([ref]) => ref);
|
|
140
|
+
} catch {
|
|
141
|
+
return [];
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function listed(names, noun) {
|
|
145
|
+
const shown = names.slice(0, 3).join(", ");
|
|
146
|
+
const more = names.length > 3 ? ` and ${names.length - 3} more` : "";
|
|
147
|
+
return `${noun}${names.length === 1 ? "" : "s"} ${shown}${more}`;
|
|
148
|
+
}
|
|
149
|
+
function pluginsInCache(files, cache) {
|
|
150
|
+
const found = /* @__PURE__ */ new Set();
|
|
151
|
+
for (const file of files) {
|
|
152
|
+
if (!file.path.startsWith(cache)) continue;
|
|
153
|
+
const [marketplace, name] = file.path.slice(cache.length).split("/");
|
|
154
|
+
if (marketplace && name) found.add(`${name}@${marketplace}`);
|
|
155
|
+
}
|
|
156
|
+
return [...found];
|
|
157
|
+
}
|
|
158
|
+
function heldBackByRegistry(files, keptPaths) {
|
|
159
|
+
const held = { prefixes: [], enabledKeys: [], recordKeys: [], skips: [] };
|
|
160
|
+
const content = new Map(files.map((file) => [file.path, file.content]));
|
|
161
|
+
for (const registry of keptPaths) {
|
|
162
|
+
const match = REGISTRY_RE.exec(registry);
|
|
163
|
+
if (!match) continue;
|
|
164
|
+
const root = match[1] ?? "";
|
|
165
|
+
const pluginsDir = `${root}/plugins`;
|
|
166
|
+
const cache = `${pluginsDir}/cache/`;
|
|
167
|
+
const installed = `${pluginsDir}/installed_plugins.json`;
|
|
168
|
+
const file = registry.slice(pluginsDir.length + 1);
|
|
169
|
+
const registered = harnessTapRegistered(content.get(installed));
|
|
170
|
+
if (match[2] === "installed_plugins") {
|
|
171
|
+
const names = [];
|
|
172
|
+
for (const key of registered) {
|
|
173
|
+
const [name, marketplace] = key.split("@");
|
|
174
|
+
if (!name || !marketplace) continue;
|
|
175
|
+
held.prefixes.push(`${cache}${marketplace}/${name}/`);
|
|
176
|
+
held.enabledKeys.push(key);
|
|
177
|
+
names.push(key);
|
|
178
|
+
}
|
|
179
|
+
if (names.length > 0) {
|
|
180
|
+
held.skips.push({
|
|
181
|
+
path: registry,
|
|
182
|
+
reason: "unmanaged",
|
|
183
|
+
message: `Skipped restoring ${listed(names, "plugin")} (${file} was kept as it is, so ${names.length === 1 ? "it is" : "they are"} not registered there).`
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
} else {
|
|
187
|
+
const marketplaces = jsonKeys(content.get(registry));
|
|
188
|
+
for (const marketplace of marketplaces) {
|
|
189
|
+
held.prefixes.push(`${cache}${marketplace}/`, `${pluginsDir}/marketplaces/${marketplace}/`);
|
|
190
|
+
for (const key of [...registered, ...pluginsInCache(files, cache)]) {
|
|
191
|
+
if (key.endsWith(`@${marketplace}`)) held.enabledKeys.push(key);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
if (marketplaces.length > 0) {
|
|
195
|
+
held.skips.push({
|
|
196
|
+
path: registry,
|
|
197
|
+
reason: "unmanaged",
|
|
198
|
+
message: `Skipped restoring ${listed(marketplaces, "marketplace")} and ${marketplaces.length === 1 ? "its" : "their"} plugins (${file} was kept as it is, so ${marketplaces.length === 1 ? "it is" : "they are"} not registered there).`
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
holdBackBlockedPlugins(keptPaths, content, held);
|
|
204
|
+
const touched = held.prefixes.some((prefix) => files.some((file) => file.path.startsWith(prefix)));
|
|
205
|
+
const keys = held.enabledKeys.length > 0;
|
|
206
|
+
if (!touched && !keys) return void 0;
|
|
207
|
+
held.enabledKeys = [...new Set(held.enabledKeys)];
|
|
208
|
+
held.recordKeys = [...new Set(held.recordKeys)];
|
|
209
|
+
return held;
|
|
210
|
+
}
|
|
211
|
+
var CACHE_FILE_RE = /^(.*)\/plugins\/cache\/([^/]+)\/([^/]+)\//;
|
|
212
|
+
function holdBackBlockedPlugins(keptPaths, content, held) {
|
|
213
|
+
const done = /* @__PURE__ */ new Set();
|
|
214
|
+
for (const path of keptPaths) {
|
|
215
|
+
const match = CACHE_FILE_RE.exec(path);
|
|
216
|
+
if (!match) continue;
|
|
217
|
+
const [, root = "", marketplace = "", name = ""] = match;
|
|
218
|
+
const key = `${name}@${marketplace}`;
|
|
219
|
+
if (done.has(`${root}/${key}`)) continue;
|
|
220
|
+
const registered = harnessTapRegistered(content.get(`${root}/plugins/installed_plugins.json`));
|
|
221
|
+
if (!registered.includes(key)) continue;
|
|
222
|
+
done.add(`${root}/${key}`);
|
|
223
|
+
held.prefixes.push(`${root}/plugins/cache/${marketplace}/${name}/`);
|
|
224
|
+
held.enabledKeys.push(key);
|
|
225
|
+
held.recordKeys.push(key);
|
|
226
|
+
held.skips.push({
|
|
227
|
+
path,
|
|
228
|
+
reason: "unmanaged",
|
|
229
|
+
message: `Skipped restoring plugin ${key} as a whole: some of its files cannot be put back, so it is not registered or enabled either.`
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function enabledPluginsOf(raw) {
|
|
234
|
+
if (raw === void 0) return {};
|
|
235
|
+
try {
|
|
236
|
+
const enabled = JSON.parse(raw).enabledPlugins;
|
|
237
|
+
return typeof enabled === "object" && enabled !== null && !Array.isArray(enabled) ? enabled : {};
|
|
238
|
+
} catch {
|
|
239
|
+
return {};
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
function withoutEnabledKeys(content, keys, live) {
|
|
243
|
+
if (keys.length === 0) return content;
|
|
244
|
+
try {
|
|
245
|
+
const parsed = JSON.parse(content);
|
|
246
|
+
const enabled = parsed.enabledPlugins;
|
|
247
|
+
if (typeof enabled !== "object" || enabled === null) return content;
|
|
248
|
+
const next = { ...enabled };
|
|
249
|
+
const onDisk = enabledPluginsOf(live);
|
|
250
|
+
for (const key of keys) {
|
|
251
|
+
if (key in onDisk) next[key] = onDisk[key];
|
|
252
|
+
else delete next[key];
|
|
253
|
+
}
|
|
254
|
+
const indent = /^\{\n( +)"/.exec(content)?.[1]?.length ?? 2;
|
|
255
|
+
const tail = content.endsWith("\n") ? "\n" : "";
|
|
256
|
+
return `${JSON.stringify({ ...parsed, enabledPlugins: next }, null, indent)}${tail}`;
|
|
257
|
+
} catch {
|
|
258
|
+
return content;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
var MERGED_SETTINGS_FIELDS = ["enabledPlugins", "extraKnownMarketplaces"];
|
|
262
|
+
function objectOf(value) {
|
|
263
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
264
|
+
}
|
|
265
|
+
function withSnapshotSettingsKeys(snapshot, live) {
|
|
266
|
+
try {
|
|
267
|
+
const wanted = objectOf(JSON.parse(snapshot));
|
|
268
|
+
const current = objectOf(JSON.parse(live));
|
|
269
|
+
if (!wanted || !current) return void 0;
|
|
270
|
+
const next = { ...current };
|
|
271
|
+
let added = false;
|
|
272
|
+
for (const field of MERGED_SETTINGS_FIELDS) {
|
|
273
|
+
const from = objectOf(wanted[field]);
|
|
274
|
+
if (!from) continue;
|
|
275
|
+
const have = current[field] === void 0 ? {} : objectOf(current[field]);
|
|
276
|
+
if (!have) continue;
|
|
277
|
+
const merged = { ...have };
|
|
278
|
+
for (const [key, value] of Object.entries(from)) {
|
|
279
|
+
if (key in merged) continue;
|
|
280
|
+
merged[key] = value;
|
|
281
|
+
added = true;
|
|
282
|
+
}
|
|
283
|
+
next[field] = merged;
|
|
284
|
+
}
|
|
285
|
+
if (!added) return live;
|
|
286
|
+
const indent = /^\{\n( +)"/.exec(live)?.[1]?.length ?? 2;
|
|
287
|
+
const tail = live.endsWith("\n") ? "\n" : "";
|
|
288
|
+
return `${JSON.stringify(next, null, indent)}${tail}`;
|
|
289
|
+
} catch {
|
|
290
|
+
return void 0;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
function withoutInstalledRecords(content, refs, live) {
|
|
294
|
+
if (refs.length === 0) return content;
|
|
295
|
+
try {
|
|
296
|
+
const parsed = JSON.parse(content);
|
|
297
|
+
const plugins = objectOf(parsed.plugins);
|
|
298
|
+
if (!plugins) return content;
|
|
299
|
+
const next = { ...plugins };
|
|
300
|
+
const onDisk = live === void 0 ? void 0 : objectOf(JSON.parse(live).plugins);
|
|
301
|
+
for (const ref of refs) {
|
|
302
|
+
if (onDisk && ref in onDisk) next[ref] = onDisk[ref];
|
|
303
|
+
else delete next[ref];
|
|
304
|
+
}
|
|
305
|
+
const indent = /^\{\n( +)"/.exec(content)?.[1]?.length ?? 2;
|
|
306
|
+
const tail = content.endsWith("\n") ? "\n" : "";
|
|
307
|
+
return `${JSON.stringify({ ...parsed, plugins: next }, null, indent)}${tail}`;
|
|
308
|
+
} catch {
|
|
309
|
+
return content;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
function registersNoPlugin(content) {
|
|
313
|
+
try {
|
|
314
|
+
const plugins = objectOf(JSON.parse(content).plugins);
|
|
315
|
+
return plugins !== void 0 && Object.keys(plugins).length === 0;
|
|
316
|
+
} catch {
|
|
317
|
+
return false;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// src/services/snapshot-revert.ts
|
|
112
322
|
var PREFIX_MIN = 8;
|
|
113
323
|
function parseStoredState(raw) {
|
|
114
324
|
if (typeof raw !== "object" || raw === null) {
|
|
@@ -124,7 +334,7 @@ function capturedStateUseful(state) {
|
|
|
124
334
|
if (!state) {
|
|
125
335
|
return false;
|
|
126
336
|
}
|
|
127
|
-
return Object.keys(state.platform_files).length > 0 || Object.keys(state.disk_files ?? {}).length > 0 || (state.absent_paths?.length ?? 0) > 0 || Object.keys(state.harness_files ?? {}).length > 0;
|
|
337
|
+
return Object.keys(state.platform_files).length > 0 || Object.keys(state.disk_files ?? {}).length > 0 || Object.keys(state.disk_files_base64 ?? {}).length > 0 || (state.absent_paths?.length ?? 0) > 0 || Object.keys(state.harness_files ?? {}).length > 0 || Object.keys(state.disk_links ?? {}).length > 0 || (state.trashed_files?.length ?? 0) > 0;
|
|
128
338
|
}
|
|
129
339
|
function findGlobalByPrefix(prefix) {
|
|
130
340
|
const matches = listGlobalApplySnapshots().filter((row) => row.id.startsWith(prefix));
|
|
@@ -148,6 +358,7 @@ function resolveRevertPlan(snapshotId) {
|
|
|
148
358
|
label: projectSnap.label,
|
|
149
359
|
createdAt: projectSnap.created_at,
|
|
150
360
|
restoreFiles: flattenLiveRestoreFiles(projectSnap.state),
|
|
361
|
+
restoreLinks: snapshotLinks(projectSnap.state),
|
|
151
362
|
absentPaths: snapshotAbsentPaths(projectSnap.state),
|
|
152
363
|
hasCapturedState: capturedStateUseful(projectSnap.state)
|
|
153
364
|
};
|
|
@@ -163,18 +374,29 @@ function resolveRevertPlan(snapshotId) {
|
|
|
163
374
|
rootPath: resolveHomeRoot(),
|
|
164
375
|
label: globalSnap.profile_name,
|
|
165
376
|
createdAt: globalSnap.created_at,
|
|
166
|
-
restoreFiles: state ? flattenLiveRestoreFiles(state) : [],
|
|
377
|
+
restoreFiles: state ? flattenLiveRestoreFiles(state, globalSnap.id) : [],
|
|
378
|
+
restoreLinks: state ? snapshotLinks(state) : [],
|
|
167
379
|
absentPaths: state ? snapshotAbsentPaths(state) : [],
|
|
168
380
|
hasCapturedState: capturedStateUseful(state)
|
|
169
381
|
};
|
|
170
382
|
}
|
|
383
|
+
function readLive(rootPath, path) {
|
|
384
|
+
try {
|
|
385
|
+
return readFileSync(resolve(rootPath, path), "utf-8");
|
|
386
|
+
} catch {
|
|
387
|
+
return void 0;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
171
390
|
function shouldRestorePath(rootPath, file) {
|
|
172
391
|
const fullPath = resolve(rootPath, file.path);
|
|
392
|
+
if (restoreBlocker(rootPath, file.path) !== void 0) {
|
|
393
|
+
return "skip-blocked";
|
|
394
|
+
}
|
|
173
395
|
if (!existsSync(fullPath)) {
|
|
174
396
|
return "write";
|
|
175
397
|
}
|
|
176
|
-
const
|
|
177
|
-
if (
|
|
398
|
+
const wanted = file.bytes;
|
|
399
|
+
if (readFileSync(fullPath).equals(wanted)) {
|
|
178
400
|
return "unchanged";
|
|
179
401
|
}
|
|
180
402
|
const ownership = classifyManagedPathOwnership(rootPath, file.path);
|
|
@@ -184,11 +406,35 @@ function shouldRestorePath(rootPath, file) {
|
|
|
184
406
|
if (ownership === "owned") {
|
|
185
407
|
return "write";
|
|
186
408
|
}
|
|
187
|
-
if (hashOnDiskFile(fullPath) === hashGeneratedContent(
|
|
409
|
+
if (hashOnDiskFile(fullPath) === hashGeneratedContent(wanted.toString("utf-8"))) {
|
|
188
410
|
return "unchanged";
|
|
189
411
|
}
|
|
190
412
|
return "skip-modified";
|
|
191
413
|
}
|
|
414
|
+
function textRestoreFile(path, text, mode) {
|
|
415
|
+
return { path, content: text, bytes: Buffer.from(text, "utf-8"), ...mode === void 0 ? {} : { mode } };
|
|
416
|
+
}
|
|
417
|
+
function skippedWarnings(skipped) {
|
|
418
|
+
const byBlocker = /* @__PURE__ */ new Map();
|
|
419
|
+
const warnings = [];
|
|
420
|
+
for (const entry of skipped) {
|
|
421
|
+
if (entry.reason === "missing") continue;
|
|
422
|
+
if (entry.blockedBy === void 0) {
|
|
423
|
+
warnings.push(entry.message);
|
|
424
|
+
continue;
|
|
425
|
+
}
|
|
426
|
+
byBlocker.set(entry.blockedBy, [...byBlocker.get(entry.blockedBy) ?? [], entry]);
|
|
427
|
+
}
|
|
428
|
+
for (const [blocker, entries] of byBlocker) {
|
|
429
|
+
const [first] = entries;
|
|
430
|
+
if (entries.length === 1 && first) {
|
|
431
|
+
warnings.push(first.message);
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
warnings.push(restoreBlockedGroupMessage(blocker, entries.map((entry) => entry.path)));
|
|
435
|
+
}
|
|
436
|
+
return warnings;
|
|
437
|
+
}
|
|
192
438
|
function executeRevert(plan, options = {}) {
|
|
193
439
|
const restored = [];
|
|
194
440
|
const skipped = [];
|
|
@@ -196,13 +442,72 @@ function executeRevert(plan, options = {}) {
|
|
|
196
442
|
restored.push(
|
|
197
443
|
...restoreSafeRemovalBackup({
|
|
198
444
|
snapshotId: plan.id,
|
|
199
|
-
rootPath: plan.rootPath
|
|
445
|
+
rootPath: plan.rootPath,
|
|
446
|
+
onSkip: (skip) => skipped.push(skip)
|
|
200
447
|
})
|
|
201
448
|
);
|
|
202
449
|
}
|
|
450
|
+
const planFiles = plan.restoreFiles.map(asRestoreFile);
|
|
451
|
+
const decisions = planFiles.map((file) => ({
|
|
452
|
+
file,
|
|
453
|
+
decision: shouldRestorePath(plan.rootPath, file)
|
|
454
|
+
}));
|
|
455
|
+
const kept = new Set(
|
|
456
|
+
decisions.filter((entry) => entry.decision.startsWith("skip")).map((entry) => entry.file.path)
|
|
457
|
+
);
|
|
458
|
+
const linkOutcomes = (plan.restoreLinks ?? []).map((link) => {
|
|
459
|
+
const fullPath = resolve(plan.rootPath, link.path);
|
|
460
|
+
const blocker = restoreBlocker(plan.rootPath, link.path);
|
|
461
|
+
if (blocker !== void 0) {
|
|
462
|
+
return {
|
|
463
|
+
kind: "skip",
|
|
464
|
+
link,
|
|
465
|
+
skip: {
|
|
466
|
+
path: link.path,
|
|
467
|
+
reason: "unmanaged",
|
|
468
|
+
blockedBy: blocker,
|
|
469
|
+
message: restoreBlockedMessage(link.path, blocker, "link")
|
|
470
|
+
}
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
let current;
|
|
474
|
+
try {
|
|
475
|
+
current = lstatSync(fullPath).isSymbolicLink() ? readlinkSync(fullPath) : null;
|
|
476
|
+
} catch {
|
|
477
|
+
current = void 0;
|
|
478
|
+
}
|
|
479
|
+
if (current === link.target) return { kind: "present", link };
|
|
480
|
+
if (current === void 0) return { kind: "make", link };
|
|
481
|
+
return {
|
|
482
|
+
kind: "skip",
|
|
483
|
+
link,
|
|
484
|
+
skip: {
|
|
485
|
+
path: link.path,
|
|
486
|
+
reason: "modified",
|
|
487
|
+
message: `Skipped restoring the link ${link.path} (something else is at that path now).`
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
});
|
|
491
|
+
for (const entry of linkOutcomes) if (entry.kind === "skip") kept.add(entry.link.path);
|
|
492
|
+
const heldBack = heldBackByRegistry(planFiles, kept);
|
|
493
|
+
if (heldBack) skipped.push(...heldBack.skips);
|
|
494
|
+
const isHeldBack = (path) => heldBack?.prefixes.some((prefix) => path.startsWith(prefix)) === true;
|
|
203
495
|
const toWrite = [];
|
|
204
|
-
for (const file of
|
|
205
|
-
|
|
496
|
+
for (const { file: planned, decision } of decisions) {
|
|
497
|
+
if (isHeldBack(planned.path) && !(heldBack?.recordKeys.length && decision.startsWith("skip"))) continue;
|
|
498
|
+
let file = planned;
|
|
499
|
+
if (heldBack && heldBack.enabledKeys.length > 0 && planned.path.endsWith("/settings.json")) {
|
|
500
|
+
file = textRestoreFile(
|
|
501
|
+
planned.path,
|
|
502
|
+
withoutEnabledKeys(planned.content, heldBack.enabledKeys, readLive(plan.rootPath, planned.path)),
|
|
503
|
+
planned.mode
|
|
504
|
+
);
|
|
505
|
+
} else if (heldBack && heldBack.recordKeys.length > 0 && planned.path.endsWith("/plugins/installed_plugins.json")) {
|
|
506
|
+
const live = readLive(plan.rootPath, planned.path);
|
|
507
|
+
const text = withoutInstalledRecords(planned.content, heldBack.recordKeys, live);
|
|
508
|
+
if (live === void 0 && registersNoPlugin(text)) continue;
|
|
509
|
+
file = textRestoreFile(planned.path, text, planned.mode);
|
|
510
|
+
}
|
|
206
511
|
switch (decision) {
|
|
207
512
|
case "write":
|
|
208
513
|
toWrite.push(file);
|
|
@@ -211,13 +516,31 @@ function executeRevert(plan, options = {}) {
|
|
|
211
516
|
case "unchanged":
|
|
212
517
|
restored.push(file.path);
|
|
213
518
|
break;
|
|
214
|
-
case "skip-modified":
|
|
519
|
+
case "skip-modified": {
|
|
520
|
+
const live = isClaudeSettingsPath(file.path) ? readLive(plan.rootPath, file.path) : void 0;
|
|
521
|
+
const merged = live === void 0 ? void 0 : withSnapshotSettingsKeys(file.content, live);
|
|
522
|
+
if (merged !== void 0) {
|
|
523
|
+
if (merged !== live) toWrite.push(textRestoreFile(file.path, merged));
|
|
524
|
+
restored.push(file.path);
|
|
525
|
+
break;
|
|
526
|
+
}
|
|
215
527
|
skipped.push({
|
|
216
528
|
path: file.path,
|
|
217
529
|
reason: "modified",
|
|
218
530
|
message: `Skipped restoring ${file.path} (modified since HarnessTap wrote it).`
|
|
219
531
|
});
|
|
220
532
|
break;
|
|
533
|
+
}
|
|
534
|
+
case "skip-blocked": {
|
|
535
|
+
const blocker = restoreBlocker(plan.rootPath, file.path) ?? file.path;
|
|
536
|
+
skipped.push({
|
|
537
|
+
path: file.path,
|
|
538
|
+
reason: "unmanaged",
|
|
539
|
+
blockedBy: blocker,
|
|
540
|
+
message: restoreBlockedMessage(file.path, blocker)
|
|
541
|
+
});
|
|
542
|
+
break;
|
|
543
|
+
}
|
|
221
544
|
case "skip-unmanaged":
|
|
222
545
|
skipped.push({
|
|
223
546
|
path: file.path,
|
|
@@ -231,12 +554,28 @@ function executeRevert(plan, options = {}) {
|
|
|
231
554
|
}
|
|
232
555
|
}
|
|
233
556
|
}
|
|
557
|
+
const linksToMake = [];
|
|
558
|
+
for (const entry of linkOutcomes) {
|
|
559
|
+
if (isHeldBack(entry.link.path) && entry.kind !== "skip") continue;
|
|
560
|
+
if (entry.kind === "skip") {
|
|
561
|
+
skipped.push(entry.skip);
|
|
562
|
+
continue;
|
|
563
|
+
}
|
|
564
|
+
if (entry.kind === "make") linksToMake.push(entry.link);
|
|
565
|
+
restored.push(entry.link.path);
|
|
566
|
+
}
|
|
234
567
|
if (!options.dryRun) {
|
|
568
|
+
for (const link of linksToMake) {
|
|
569
|
+
const fullPath = resolve(plan.rootPath, link.path);
|
|
570
|
+
mkdirSync(dirname(fullPath), { recursive: true });
|
|
571
|
+
symlinkSync(link.target, fullPath);
|
|
572
|
+
}
|
|
235
573
|
for (const file of toWrite) {
|
|
236
574
|
backupAndRewriteFile({
|
|
237
575
|
rootPath: plan.rootPath,
|
|
238
576
|
relativePath: file.path,
|
|
239
|
-
nextContent: file.
|
|
577
|
+
nextContent: file.bytes,
|
|
578
|
+
mode: file.mode,
|
|
240
579
|
applyId: options.applyId ?? plan.id,
|
|
241
580
|
snapshotId: plan.id
|
|
242
581
|
});
|
|
@@ -248,8 +587,29 @@ function executeRevert(plan, options = {}) {
|
|
|
248
587
|
applyId: options.applyId ?? plan.id,
|
|
249
588
|
snapshotId: plan.id
|
|
250
589
|
});
|
|
590
|
+
if (!options.dryRun) {
|
|
591
|
+
restoreRemovedOwnership({
|
|
592
|
+
snapshotId: plan.id,
|
|
593
|
+
rootPath: plan.rootPath,
|
|
594
|
+
restoredPaths: restored,
|
|
595
|
+
hashOf: hashFileOrLink,
|
|
596
|
+
isMergedConfig: isSharedMergedConfigPath
|
|
597
|
+
});
|
|
598
|
+
restoreRemovedHostPluginViews({
|
|
599
|
+
snapshotId: plan.id,
|
|
600
|
+
rootPath: plan.rootPath,
|
|
601
|
+
restoredPaths: restored,
|
|
602
|
+
hashOf: hashFileOrLink
|
|
603
|
+
});
|
|
604
|
+
for (const path of new Set(restored)) {
|
|
605
|
+
if (!isClaudeSettingsPath(path)) continue;
|
|
606
|
+
restoreForgottenEnabledKeys(resolve(plan.rootPath, path), plan.id);
|
|
607
|
+
restoreForgottenSettingsMarketplaces(resolve(plan.rootPath, path), plan.id);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
if (!options.dryRun) reconcileMarketplacePluginTrees(plan.rootPath);
|
|
251
611
|
const warnings = [
|
|
252
|
-
...skipped
|
|
612
|
+
...skippedWarnings(skipped),
|
|
253
613
|
...removal.warnings
|
|
254
614
|
];
|
|
255
615
|
return {
|
|
@@ -261,8 +621,8 @@ function executeRevert(plan, options = {}) {
|
|
|
261
621
|
}
|
|
262
622
|
|
|
263
623
|
// src/services/project-sync.ts
|
|
264
|
-
import { existsSync as existsSync3, mkdirSync, symlinkSync, unlinkSync } from "fs";
|
|
265
|
-
import { dirname, join as join2, relative } from "path";
|
|
624
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync2, symlinkSync as symlinkSync2, unlinkSync } from "fs";
|
|
625
|
+
import { dirname as dirname2, join as join2, relative } from "path";
|
|
266
626
|
|
|
267
627
|
// src/services/harness-surface-gaps.ts
|
|
268
628
|
import { existsSync as existsSync2, readdirSync, readFileSync as readFileSync2 } from "fs";
|
|
@@ -393,9 +753,9 @@ function writeAliasFiles(files, projectRoot, strategy, mainFiles) {
|
|
|
393
753
|
let written = 0;
|
|
394
754
|
for (const file of files) {
|
|
395
755
|
const fullPath = join2(projectRoot, file.path);
|
|
396
|
-
const parent =
|
|
756
|
+
const parent = dirname2(fullPath);
|
|
397
757
|
if (!existsSync3(parent)) {
|
|
398
|
-
|
|
758
|
+
mkdirSync2(parent, { recursive: true });
|
|
399
759
|
}
|
|
400
760
|
const mainPathForContent = mainByContent.get(file.content);
|
|
401
761
|
const useSymlink = strategy === "symlink-preferred" && mainPathForContent !== void 0 && mainPathForContent !== file.path;
|
|
@@ -407,8 +767,8 @@ function writeAliasFiles(files, projectRoot, strategy, mainFiles) {
|
|
|
407
767
|
} catch {
|
|
408
768
|
}
|
|
409
769
|
}
|
|
410
|
-
const relTarget = relative(
|
|
411
|
-
|
|
770
|
+
const relTarget = relative(dirname2(fullPath), target);
|
|
771
|
+
symlinkSync2(relTarget, fullPath);
|
|
412
772
|
written++;
|
|
413
773
|
continue;
|
|
414
774
|
}
|
|
@@ -528,27 +888,19 @@ async function syncProject(options) {
|
|
|
528
888
|
forceShiftReference,
|
|
529
889
|
referenceStrategy = "disk"
|
|
530
890
|
} = options;
|
|
531
|
-
const
|
|
532
|
-
|
|
533
|
-
if (
|
|
534
|
-
const
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
891
|
+
const project = ensureProjectForRoot(projectRoot);
|
|
892
|
+
const projectId = project.id;
|
|
893
|
+
if (forceShiftReference) {
|
|
894
|
+
const current = getProjectHarnessConfig(project.id);
|
|
895
|
+
setProjectHarnessConfig({
|
|
896
|
+
project_id: project.id,
|
|
897
|
+
registered_harnesses: uniqueHarnessTargets([
|
|
898
|
+
forceShiftReference,
|
|
899
|
+
...current?.registered_harnesses ?? []
|
|
900
|
+
]),
|
|
901
|
+
materialization_strategy: current?.materialization_strategy,
|
|
902
|
+
cursor_skill_mode: current?.cursor_skill_mode
|
|
538
903
|
});
|
|
539
|
-
projectId = project.id;
|
|
540
|
-
if (forceShiftReference) {
|
|
541
|
-
const current = getProjectHarnessConfig(project.id);
|
|
542
|
-
setProjectHarnessConfig({
|
|
543
|
-
project_id: project.id,
|
|
544
|
-
registered_harnesses: uniqueHarnessTargets([
|
|
545
|
-
forceShiftReference,
|
|
546
|
-
...current?.registered_harnesses ?? []
|
|
547
|
-
]),
|
|
548
|
-
materialization_strategy: current?.materialization_strategy,
|
|
549
|
-
cursor_skill_mode: current?.cursor_skill_mode
|
|
550
|
-
});
|
|
551
|
-
}
|
|
552
904
|
}
|
|
553
905
|
const harnesses = resolveSyncHarnesses(
|
|
554
906
|
projectId,
|
|
@@ -585,17 +937,15 @@ async function syncProject(options) {
|
|
|
585
937
|
surface_warnings: surfaceWarnings
|
|
586
938
|
};
|
|
587
939
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
});
|
|
598
|
-
}
|
|
940
|
+
createSnapshot({
|
|
941
|
+
project_id: projectId,
|
|
942
|
+
label: `Before mirror (${harnesses.from_harness})`,
|
|
943
|
+
state: captureManagedSnapshotState({
|
|
944
|
+
rootPath: projectRoot,
|
|
945
|
+
resources,
|
|
946
|
+
generated: allGenerated
|
|
947
|
+
})
|
|
948
|
+
});
|
|
599
949
|
const mainFiles = mainGenerated[0]?.files ?? [];
|
|
600
950
|
let filesWritten = 0;
|
|
601
951
|
for (const result of aliasGenerated) {
|
|
@@ -685,6 +1035,10 @@ function renderProjectStatusHuman(payload) {
|
|
|
685
1035
|
)
|
|
686
1036
|
]);
|
|
687
1037
|
}
|
|
1038
|
+
const updatesLine = formatUpdatesLine(payload.updates);
|
|
1039
|
+
if (updatesLine) {
|
|
1040
|
+
profileRows.push(["Updates", updatesLine]);
|
|
1041
|
+
}
|
|
688
1042
|
panel({ title: ["PROFILE"], rows: profileRows });
|
|
689
1043
|
subheader("APPLIED PLUGINS");
|
|
690
1044
|
if (payload.applied_plugins.length === 0) {
|
|
@@ -802,6 +1156,7 @@ function projectStatusPayloadToJson(payload) {
|
|
|
802
1156
|
},
|
|
803
1157
|
project_resources: payload.project_resources,
|
|
804
1158
|
...payload.lock ? { lock: payload.lock } : {},
|
|
1159
|
+
updates: payload.updates,
|
|
805
1160
|
...payload.project ? {
|
|
806
1161
|
applied_plugins_count: payload.applied_plugins.length,
|
|
807
1162
|
snapshots: payload.snapshots_count
|
|
@@ -1067,23 +1422,14 @@ async function handleScanCommand(path, opts) {
|
|
|
1067
1422
|
}
|
|
1068
1423
|
}
|
|
1069
1424
|
}
|
|
1070
|
-
const
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
}
|
|
1074
|
-
const normalized = normalizeGitUrl(gitOrigin);
|
|
1075
|
-
const name = projectNameFromUrl(gitOrigin);
|
|
1076
|
-
const existingProject = getProjectByOrigin(normalized);
|
|
1077
|
-
upsertProject({
|
|
1078
|
-
git_origin: normalized,
|
|
1079
|
-
name,
|
|
1080
|
-
local_path: projectRoot
|
|
1081
|
-
});
|
|
1425
|
+
const identity = resolveProjectIdentity(projectRoot);
|
|
1426
|
+
const existingProject = findProjectForRoot(projectRoot, identity);
|
|
1427
|
+
const { name } = ensureProjectForRoot(projectRoot, identity);
|
|
1082
1428
|
if (!existingProject) {
|
|
1083
1429
|
console.log("");
|
|
1084
1430
|
ui.success(`Project linked: ${name}`);
|
|
1085
1431
|
ui.hint(
|
|
1086
|
-
"Enables apply snapshots, drift checks (status --check), history, and revert for this
|
|
1432
|
+
"Enables apply snapshots, drift checks (status --check), history, and revert for this folder."
|
|
1087
1433
|
);
|
|
1088
1434
|
} else if (resolve2(existingProject.local_path) !== resolve2(projectRoot)) {
|
|
1089
1435
|
ui.hint(`Updated local path for ${name}.`);
|
|
@@ -1100,12 +1446,7 @@ function handleHistoryCommand(path, opts) {
|
|
|
1100
1446
|
fail(error instanceof Error ? error.message : String(error));
|
|
1101
1447
|
return;
|
|
1102
1448
|
}
|
|
1103
|
-
const
|
|
1104
|
-
if (!gitOrigin) {
|
|
1105
|
-
reportNoGitOrigin(formatCommand("history"));
|
|
1106
|
-
return;
|
|
1107
|
-
}
|
|
1108
|
-
const project = getProjectByOrigin(normalizeGitUrl(gitOrigin));
|
|
1449
|
+
const project = findProjectForRoot(projectRoot);
|
|
1109
1450
|
if (!project) {
|
|
1110
1451
|
if (format === "json") {
|
|
1111
1452
|
printJson({ snapshots: [] });
|
|
@@ -1146,9 +1487,60 @@ function handleHistoryCommand(path, opts) {
|
|
|
1146
1487
|
{ key: "label", header: "LABEL", width: showId ? 36 : 50 }
|
|
1147
1488
|
],
|
|
1148
1489
|
rows,
|
|
1149
|
-
summary:
|
|
1490
|
+
summary: formatCount(rows.length, "snapshot")
|
|
1150
1491
|
});
|
|
1151
1492
|
}
|
|
1493
|
+
function revertHostPluginViewBackup(backupId, opts, format) {
|
|
1494
|
+
const result = restoreHostPluginViewBackup(backupId, {
|
|
1495
|
+
dryRun: opts.dryRun,
|
|
1496
|
+
forceRemove: opts.forceRemove
|
|
1497
|
+
});
|
|
1498
|
+
if (!result) return;
|
|
1499
|
+
const changed = result.skipped.filter((file) => file.reason === "changed").map((file) => file.path);
|
|
1500
|
+
const blocked = result.skipped.filter((file) => file.reason === "blocked");
|
|
1501
|
+
if (format === "json") {
|
|
1502
|
+
printJson({
|
|
1503
|
+
dry_run: Boolean(opts.dryRun),
|
|
1504
|
+
backup_id: backupId,
|
|
1505
|
+
kind: "plugin-folder-backup",
|
|
1506
|
+
folder: result.hostView,
|
|
1507
|
+
restored: result.restored,
|
|
1508
|
+
kept: changed,
|
|
1509
|
+
blocked: blocked.map((file) => ({ path: file.path, blocked_by: file.blockedBy ?? null })),
|
|
1510
|
+
replaced_backup_id: result.replacedBackupId ?? null
|
|
1511
|
+
});
|
|
1512
|
+
return;
|
|
1513
|
+
}
|
|
1514
|
+
const where = shortenHomePath(result.hostView);
|
|
1515
|
+
if (opts.dryRun) {
|
|
1516
|
+
console.log(CLI_COPY.dryRunNothingChanged);
|
|
1517
|
+
}
|
|
1518
|
+
if (changed.length > 0) {
|
|
1519
|
+
ui.warn(
|
|
1520
|
+
`Kept ${formatCount(changed.length, "file")} in ${where} that changed since the backup: ${changed.join(", ")}. To back up the current copies and put the old ones back, run the command again with --force-remove.`
|
|
1521
|
+
);
|
|
1522
|
+
}
|
|
1523
|
+
const describeBlocked = (files) => files.map((file) => `${file.path} (${file.blockedBy} is in the way)`).join(", ");
|
|
1524
|
+
const forceable = opts.forceRemove ? [] : blocked.filter((file) => file.canForce);
|
|
1525
|
+
const notForceable = blocked.filter((file) => !forceable.includes(file));
|
|
1526
|
+
if (forceable.length > 0) {
|
|
1527
|
+
ui.warn(
|
|
1528
|
+
`Could not restore ${formatCount(forceable.length, "file")} in ${where}: ${describeBlocked(forceable)}. To back up what is in the way and put the old ones back, run the command again with --force-remove.`
|
|
1529
|
+
);
|
|
1530
|
+
}
|
|
1531
|
+
if (notForceable.length > 0) {
|
|
1532
|
+
ui.warn(
|
|
1533
|
+
`Could not restore ${formatCount(notForceable.length, "file")} in ${where}: ${describeBlocked(notForceable)}. HarnessTap never removes files it did not write. Move them away, then run the command again.`
|
|
1534
|
+
);
|
|
1535
|
+
}
|
|
1536
|
+
if (result.replacedBackupId) {
|
|
1537
|
+
ui.info(
|
|
1538
|
+
`Backed up the files it replaced first. To undo, run \`${formatCommand(["revert", result.replacedBackupId])}\`.`
|
|
1539
|
+
);
|
|
1540
|
+
}
|
|
1541
|
+
const verb = opts.dryRun ? "Would restore" : "Restored";
|
|
1542
|
+
ui.success(`${verb} ${formatCount(result.restored.length, "file")} in ${where}.`);
|
|
1543
|
+
}
|
|
1152
1544
|
function handleRevertCommand(snapshotId, opts) {
|
|
1153
1545
|
const db = getDb();
|
|
1154
1546
|
initializeSchema(db);
|
|
@@ -1159,6 +1551,10 @@ function handleRevertCommand(snapshotId, opts) {
|
|
|
1159
1551
|
});
|
|
1160
1552
|
return;
|
|
1161
1553
|
}
|
|
1554
|
+
if (isHostPluginViewBackupId(snapshotId)) {
|
|
1555
|
+
revertHostPluginViewBackup(snapshotId, opts, format);
|
|
1556
|
+
return;
|
|
1557
|
+
}
|
|
1162
1558
|
const plan = resolveRevertPlan(snapshotId);
|
|
1163
1559
|
if ("error" in plan) {
|
|
1164
1560
|
fail(plan.error, {
|
|
@@ -1183,6 +1579,9 @@ function handleRevertCommand(snapshotId, opts) {
|
|
|
1183
1579
|
}
|
|
1184
1580
|
if (opts.dryRun) {
|
|
1185
1581
|
console.log(CLI_COPY.dryRunNothingChanged);
|
|
1582
|
+
for (const warning of result.warnings) {
|
|
1583
|
+
ui.warn(warning);
|
|
1584
|
+
}
|
|
1186
1585
|
console.log(
|
|
1187
1586
|
restoredRemovedLine(result.restored.length, result.removed.length, {
|
|
1188
1587
|
dryRun: true
|
|
@@ -1207,13 +1606,7 @@ async function handleProjectStatusCommand(path, opts) {
|
|
|
1207
1606
|
return;
|
|
1208
1607
|
}
|
|
1209
1608
|
if (opts.check) {
|
|
1210
|
-
const
|
|
1211
|
-
if (!gitOrigin) {
|
|
1212
|
-
reportNoGitOrigin(formatCommand("status --check"));
|
|
1213
|
-
return;
|
|
1214
|
-
}
|
|
1215
|
-
const normalizedOrigin = normalizeGitUrl(gitOrigin);
|
|
1216
|
-
const project = getProjectByOrigin(normalizedOrigin);
|
|
1609
|
+
const project = findProjectForRoot(projectRoot);
|
|
1217
1610
|
if (!project) {
|
|
1218
1611
|
if (format === "json") {
|
|
1219
1612
|
printJson({
|
|
@@ -1375,4 +1768,4 @@ export {
|
|
|
1375
1768
|
registerProjectCommandsAfterConfig,
|
|
1376
1769
|
registerProjectCommandsBeforeConfig
|
|
1377
1770
|
};
|
|
1378
|
-
//# sourceMappingURL=project-
|
|
1771
|
+
//# sourceMappingURL=project-3DTXKMI6.js.map
|