agents-inc 0.153.0 → 0.155.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +65 -0
- package/dist/chunk-2H7UWE2G.js +246 -0
- package/dist/chunk-2H7UWE2G.js.map +1 -0
- package/dist/{chunk-ZNDLUWWD.js → chunk-4A4L3YIW.js} +5 -5
- package/dist/chunk-4G2YHZIM.js +132 -0
- package/dist/chunk-4G2YHZIM.js.map +1 -0
- package/dist/{chunk-WDAO3RUY.js → chunk-5F2YR5XV.js} +3 -3
- package/dist/{chunk-JFAUQDZM.js → chunk-5OKLCVM4.js} +3 -3
- package/dist/{chunk-REKOWTIB.js → chunk-5QZAK6J7.js} +44 -10
- package/dist/chunk-5QZAK6J7.js.map +1 -0
- package/dist/{chunk-VECFAKM5.js → chunk-6RLV45HN.js} +10 -10
- package/dist/{chunk-VECFAKM5.js.map → chunk-6RLV45HN.js.map} +1 -1
- package/dist/{chunk-K7PJDWER.js → chunk-CLFHC2DK.js} +15 -106
- package/dist/chunk-CLFHC2DK.js.map +1 -0
- package/dist/chunk-D2CAV7MG.js +61 -0
- package/dist/chunk-D2CAV7MG.js.map +1 -0
- package/dist/{chunk-NXGMM5YN.js → chunk-F2AMBBIA.js} +6 -6
- package/dist/{chunk-NXGMM5YN.js.map → chunk-F2AMBBIA.js.map} +1 -1
- package/dist/{chunk-HEBPKK5L.js → chunk-F5T6TV4Z.js} +213 -92
- package/dist/chunk-F5T6TV4Z.js.map +1 -0
- package/dist/{chunk-K3O3YQYG.js → chunk-G47TDUK3.js} +2 -2
- package/dist/{chunk-U2DNAHFE.js → chunk-GS2NZ3GD.js} +8 -8
- package/dist/chunk-GS2NZ3GD.js.map +1 -0
- package/dist/{chunk-ORJ5Y222.js → chunk-H6UTKTLK.js} +176 -256
- package/dist/chunk-H6UTKTLK.js.map +1 -0
- package/dist/{chunk-M5HSTNYU.js → chunk-HG4JPXJT.js} +11 -29
- package/dist/chunk-HG4JPXJT.js.map +1 -0
- package/dist/{chunk-VGEBYCQZ.js → chunk-HTYH7CKN.js} +4 -15
- package/dist/chunk-HTYH7CKN.js.map +1 -0
- package/dist/{chunk-JC7DBPRD.js → chunk-HXKOIWLU.js} +2 -2
- package/dist/chunk-HXKOIWLU.js.map +1 -0
- package/dist/{chunk-NSJ2S7R5.js → chunk-ILUVL7WM.js} +2 -2
- package/dist/{chunk-R54KIGN2.js → chunk-IO5YBKHV.js} +13 -2
- package/dist/chunk-IO5YBKHV.js.map +1 -0
- package/dist/chunk-IXRZAHZF.js +53 -0
- package/dist/chunk-IXRZAHZF.js.map +1 -0
- package/dist/chunk-JCPANDNR.js +35 -0
- package/dist/chunk-JCPANDNR.js.map +1 -0
- package/dist/{chunk-R4SEU3DF.js → chunk-LJCNUP6M.js} +2 -2
- package/dist/{chunk-FRWKCE6R.js → chunk-MHRC3KRX.js} +5 -5
- package/dist/chunk-MHRC3KRX.js.map +1 -0
- package/dist/chunk-MO5FGLVS.js +142 -0
- package/dist/chunk-MO5FGLVS.js.map +1 -0
- package/dist/{chunk-Q5FLW4JG.js → chunk-OKH64JZE.js} +2 -2
- package/dist/{chunk-WG6V6VJV.js → chunk-PCC4LBKB.js} +2 -2
- package/dist/chunk-PMUABBPG.js +258 -0
- package/dist/chunk-PMUABBPG.js.map +1 -0
- package/dist/{chunk-EFU6P3B7.js → chunk-PNMM5HNX.js} +5 -5
- package/dist/{chunk-4VYALFQZ.js → chunk-QWVXOCXO.js} +6 -6
- package/dist/{chunk-35VOK7XE.js → chunk-RWOYPOMR.js} +4365 -4355
- package/dist/chunk-RWOYPOMR.js.map +1 -0
- package/dist/{chunk-IO4VEW5U.js → chunk-SY4X2LND.js} +4 -4
- package/dist/{chunk-XGMOXMS4.js → chunk-TBOVYLQJ.js} +2 -2
- package/dist/{chunk-BMGBA6HJ.js → chunk-TNGMF4UX.js} +20 -20
- package/dist/{chunk-BMGBA6HJ.js.map → chunk-TNGMF4UX.js.map} +1 -1
- package/dist/{chunk-TY6CAOL7.js → chunk-UMH2YZKG.js} +14 -5
- package/dist/chunk-UMH2YZKG.js.map +1 -0
- package/dist/{chunk-6CNRMCFM.js → chunk-VPASBA7P.js} +2 -2
- package/dist/{chunk-NXQAY5U7.js → chunk-WCAUUBHO.js} +5860 -5126
- package/dist/chunk-WCAUUBHO.js.map +1 -0
- package/dist/{chunk-V3ENMW7G.js → chunk-WFRTHH3A.js} +3 -3
- package/dist/{chunk-2HC2SNRP.js → chunk-WTJ3AY33.js} +1 -5
- package/dist/chunk-WTJ3AY33.js.map +1 -0
- package/dist/{chunk-F7Z5I6GU.js → chunk-WUQ3MTPF.js} +11 -5
- package/dist/{chunk-F7Z5I6GU.js.map → chunk-WUQ3MTPF.js.map} +1 -1
- package/dist/{chunk-U2YSGBHA.js → chunk-XAXJWXI4.js} +93 -43
- package/dist/chunk-XAXJWXI4.js.map +1 -0
- package/dist/{chunk-ACKC577F.js → chunk-Y5Y7XHVU.js} +4 -4
- package/dist/{chunk-X5XJ6WKO.js → chunk-YO2LTXB4.js} +107 -16
- package/dist/chunk-YO2LTXB4.js.map +1 -0
- package/dist/{chunk-FIHTAFST.js → chunk-ZUAZHDKP.js} +64 -65
- package/dist/chunk-ZUAZHDKP.js.map +1 -0
- package/dist/commands/build/marketplace.js +98 -120
- package/dist/commands/build/marketplace.js.map +1 -1
- package/dist/commands/build/plugins.js +8 -8
- package/dist/commands/compile.js +57 -24
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/doctor.js +220 -79
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/edit.js +608 -100
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/eject.js +26 -21
- package/dist/commands/eject.js.map +1 -1
- package/dist/commands/init.js +41 -39
- package/dist/commands/list.js +11 -11
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/new/marketplace.js +243 -0
- package/dist/commands/new/marketplace.js.map +1 -0
- package/dist/commands/search.js +34 -24
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/share.js +67 -0
- package/dist/commands/share.js.map +1 -0
- package/dist/commands/uninstall.js +234 -196
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.js +9 -9
- package/dist/commands/update.js.map +1 -1
- package/dist/components/common/prompt-confirm.js +1 -1
- package/dist/components/common/removal-plan-confirm.js +10 -0
- package/dist/components/common/select-list.js +2 -2
- package/dist/components/wizard/category-grid.js +5 -5
- package/dist/components/wizard/checkbox-grid.js +5 -5
- package/dist/components/wizard/domain-selection.js +11 -11
- package/dist/components/wizard/run-wizard-session.js +29 -28
- package/dist/components/wizard/scroll-affordance.js +2 -2
- package/dist/components/wizard/skill-agent-summary.js +6 -6
- package/dist/components/wizard/source-grid.js +6 -6
- package/dist/components/wizard/stack-selection.js +8 -8
- package/dist/components/wizard/step-agents.js +10 -11
- package/dist/components/wizard/step-build.js +9 -9
- package/dist/components/wizard/step-confirm.js +10 -10
- package/dist/components/wizard/step-sources.js +10 -10
- package/dist/components/wizard/step-stack.js +9 -9
- package/dist/components/wizard/summary-panel.js +9 -9
- package/dist/components/wizard/toast.js +2 -2
- package/dist/components/wizard/wizard-layout.js +14 -14
- package/dist/components/wizard/wizard-tabs.js +2 -2
- package/dist/components/wizard/wizard.js +27 -27
- package/dist/copy-local-skills-NSUTBVLJ.js +14 -0
- package/dist/hooks/init.js +42 -62
- package/dist/hooks/init.js.map +1 -1
- package/dist/load-agent-defs-X4E57I2U.js +15 -0
- package/dist/{loader-4U7UCE2Y.js → loader-G6BFG2VA.js} +3 -3
- package/dist/recompile-project-agents-JE4MM72I.js +20 -0
- package/dist/{source-loader-ZNSYJJCI.js → source-loader-3DL3NYUX.js} +7 -5
- package/dist/source-loader-3DL3NYUX.js.map +1 -0
- package/dist/src/agents/developer/ai-developer/critical-reminders.md +1 -1
- package/dist/src/agents/developer/ai-developer/critical-requirements.md +1 -1
- package/dist/src/agents/developer/ai-developer/identity.md +1 -1
- package/dist/src/agents/developer/ai-developer/playbook.md +1 -1
- package/dist/src/agents/developer/api-developer/identity.md +1 -1
- package/dist/src/agents/developer/cli-developer/identity.md +1 -1
- package/dist/src/agents/developer/web-developer/identity.md +1 -1
- package/dist/src/agents/meta/codex-keeper/identity.md +1 -1
- package/dist/src/agents/meta/convention-keeper/identity.md +1 -1
- package/dist/src/agents/meta/skill-summoner/identity.md +1 -1
- package/dist/src/agents/researcher/ai-researcher/identity.md +1 -1
- package/dist/src/agents/researcher/api-researcher/identity.md +1 -1
- package/dist/src/agents/researcher/cli-researcher/identity.md +1 -1
- package/dist/src/agents/researcher/web-researcher/identity.md +1 -1
- package/dist/src/agents/reviewer/reviewer/playbook.md +1 -1
- package/dist/src/agents/tester/ai-tester/identity.md +1 -1
- package/dist/src/agents/tester/api-tester/critical-reminders.md +1 -1
- package/dist/src/agents/tester/api-tester/critical-requirements.md +1 -1
- package/dist/src/agents/tester/api-tester/identity.md +2 -2
- package/dist/src/agents/tester/cli-tester/identity.md +1 -1
- package/dist/src/agents/tester/web-tester/identity.md +3 -3
- package/dist/stores/wizard-store.js +7 -5
- package/package.json +10 -7
- package/src/agents/developer/ai-developer/critical-reminders.md +1 -1
- package/src/agents/developer/ai-developer/critical-requirements.md +1 -1
- package/src/agents/developer/ai-developer/identity.md +1 -1
- package/src/agents/developer/ai-developer/playbook.md +1 -1
- package/src/agents/developer/api-developer/identity.md +1 -1
- package/src/agents/developer/cli-developer/identity.md +1 -1
- package/src/agents/developer/web-developer/identity.md +1 -1
- package/src/agents/meta/codex-keeper/identity.md +1 -1
- package/src/agents/meta/convention-keeper/identity.md +1 -1
- package/src/agents/meta/skill-summoner/identity.md +1 -1
- package/src/agents/researcher/ai-researcher/identity.md +1 -1
- package/src/agents/researcher/api-researcher/identity.md +1 -1
- package/src/agents/researcher/cli-researcher/identity.md +1 -1
- package/src/agents/researcher/web-researcher/identity.md +1 -1
- package/src/agents/reviewer/reviewer/playbook.md +1 -1
- package/src/agents/tester/ai-tester/identity.md +1 -1
- package/src/agents/tester/api-tester/critical-reminders.md +1 -1
- package/src/agents/tester/api-tester/critical-requirements.md +1 -1
- package/src/agents/tester/api-tester/identity.md +2 -2
- package/src/agents/tester/cli-tester/identity.md +1 -1
- package/src/agents/tester/web-tester/identity.md +3 -3
- package/src/schemas/custom-metadata.schema.json +3 -0
- package/src/schemas/metadata.schema.json +3 -0
- package/src/schemas/plugin.schema.json +3 -0
- package/src/schemas/project-config.schema.json +4 -8
- package/src/schemas/project-source-config.schema.json +2 -2
- package/dist/chunk-2HC2SNRP.js.map +0 -1
- package/dist/chunk-35VOK7XE.js.map +0 -1
- package/dist/chunk-FIHTAFST.js.map +0 -1
- package/dist/chunk-FRWKCE6R.js.map +0 -1
- package/dist/chunk-HEBPKK5L.js.map +0 -1
- package/dist/chunk-JC7DBPRD.js.map +0 -1
- package/dist/chunk-K7PJDWER.js.map +0 -1
- package/dist/chunk-KET3EVGX.js +0 -41
- package/dist/chunk-KET3EVGX.js.map +0 -1
- package/dist/chunk-M5HSTNYU.js.map +0 -1
- package/dist/chunk-NXQAY5U7.js.map +0 -1
- package/dist/chunk-OJJLYHM3.js +0 -34
- package/dist/chunk-OJJLYHM3.js.map +0 -1
- package/dist/chunk-ORJ5Y222.js.map +0 -1
- package/dist/chunk-R54KIGN2.js.map +0 -1
- package/dist/chunk-REKOWTIB.js.map +0 -1
- package/dist/chunk-TY6CAOL7.js.map +0 -1
- package/dist/chunk-U2DNAHFE.js.map +0 -1
- package/dist/chunk-U2YSGBHA.js.map +0 -1
- package/dist/chunk-VGEBYCQZ.js.map +0 -1
- package/dist/chunk-X5XJ6WKO.js.map +0 -1
- package/dist/copy-local-skills-KF2RAVD3.js +0 -14
- package/dist/load-agent-defs-DGXGBU3Q.js +0 -15
- package/dist/recompile-project-agents-CJVBAWDJ.js +0 -20
- /package/dist/{chunk-ZNDLUWWD.js.map → chunk-4A4L3YIW.js.map} +0 -0
- /package/dist/{chunk-WDAO3RUY.js.map → chunk-5F2YR5XV.js.map} +0 -0
- /package/dist/{chunk-JFAUQDZM.js.map → chunk-5OKLCVM4.js.map} +0 -0
- /package/dist/{chunk-K3O3YQYG.js.map → chunk-G47TDUK3.js.map} +0 -0
- /package/dist/{chunk-NSJ2S7R5.js.map → chunk-ILUVL7WM.js.map} +0 -0
- /package/dist/{chunk-R4SEU3DF.js.map → chunk-LJCNUP6M.js.map} +0 -0
- /package/dist/{chunk-Q5FLW4JG.js.map → chunk-OKH64JZE.js.map} +0 -0
- /package/dist/{chunk-WG6V6VJV.js.map → chunk-PCC4LBKB.js.map} +0 -0
- /package/dist/{chunk-EFU6P3B7.js.map → chunk-PNMM5HNX.js.map} +0 -0
- /package/dist/{chunk-4VYALFQZ.js.map → chunk-QWVXOCXO.js.map} +0 -0
- /package/dist/{chunk-IO4VEW5U.js.map → chunk-SY4X2LND.js.map} +0 -0
- /package/dist/{chunk-XGMOXMS4.js.map → chunk-TBOVYLQJ.js.map} +0 -0
- /package/dist/{chunk-6CNRMCFM.js.map → chunk-VPASBA7P.js.map} +0 -0
- /package/dist/{chunk-V3ENMW7G.js.map → chunk-WFRTHH3A.js.map} +0 -0
- /package/dist/{chunk-ACKC577F.js.map → chunk-Y5Y7XHVU.js.map} +0 -0
- /package/dist/{copy-local-skills-KF2RAVD3.js.map → components/common/removal-plan-confirm.js.map} +0 -0
- /package/dist/{load-agent-defs-DGXGBU3Q.js.map → copy-local-skills-NSUTBVLJ.js.map} +0 -0
- /package/dist/{loader-4U7UCE2Y.js.map → load-agent-defs-X4E57I2U.js.map} +0 -0
- /package/dist/{recompile-project-agents-CJVBAWDJ.js.map → loader-G6BFG2VA.js.map} +0 -0
- /package/dist/{source-loader-ZNSYJJCI.js.map → recompile-project-agents-JE4MM72I.js.map} +0 -0
|
@@ -1,32 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "../chunk-
|
|
3
|
+
RemovalPlanConfirm
|
|
4
|
+
} from "../chunk-D2CAV7MG.js";
|
|
5
|
+
import "../chunk-OZXAJNLA.js";
|
|
5
6
|
import {
|
|
6
7
|
promptConfirm
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-NXGMM5YN.js";
|
|
8
|
+
} from "../chunk-JCPANDNR.js";
|
|
9
|
+
import "../chunk-WUQ3MTPF.js";
|
|
10
|
+
import "../chunk-5QZAK6J7.js";
|
|
11
11
|
import {
|
|
12
12
|
loadAgentDefs
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-MHRC3KRX.js";
|
|
14
|
+
import "../chunk-F2AMBBIA.js";
|
|
14
15
|
import {
|
|
15
|
-
listAgentMdFiles
|
|
16
|
-
|
|
16
|
+
listAgentMdFiles,
|
|
17
|
+
splitAgentsByProvenance
|
|
18
|
+
} from "../chunk-ZUAZHDKP.js";
|
|
17
19
|
import "../chunk-JFLVEFFP.js";
|
|
18
20
|
import {
|
|
19
21
|
BaseCommand,
|
|
20
22
|
EXIT_CODES
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
import "../chunk-
|
|
23
|
-
import "../chunk-
|
|
23
|
+
} from "../chunk-YO2LTXB4.js";
|
|
24
|
+
import "../chunk-UMH2YZKG.js";
|
|
25
|
+
import "../chunk-G47TDUK3.js";
|
|
24
26
|
import {
|
|
25
27
|
ConfigLoadError,
|
|
26
28
|
INFO_MESSAGES,
|
|
27
29
|
SUCCESS_MESSAGES,
|
|
30
|
+
UNINSTALL_PLAN,
|
|
28
31
|
buildMarketplacePluginRef,
|
|
29
32
|
claudePluginUninstallBestEffort,
|
|
33
|
+
compiledAgentsRemoval,
|
|
30
34
|
getProjectPluginsDir,
|
|
31
35
|
isClaudeCLIAvailable,
|
|
32
36
|
isHomeDirectory,
|
|
@@ -34,6 +38,7 @@ import {
|
|
|
34
38
|
listPluginNames,
|
|
35
39
|
loadProjectConfigFromDir,
|
|
36
40
|
loadSkillsMatrixFromSource,
|
|
41
|
+
localSkillsRemoval,
|
|
37
42
|
mutateGlobal,
|
|
38
43
|
parseMarketplacePluginRef,
|
|
39
44
|
propagateGlobalRemoval,
|
|
@@ -42,94 +47,133 @@ import {
|
|
|
42
47
|
registeredProjectsUpdateFailed,
|
|
43
48
|
registeredProjectsUpdated,
|
|
44
49
|
resolveInstallPaths,
|
|
45
|
-
toClaudePluginScope
|
|
46
|
-
|
|
50
|
+
toClaudePluginScope,
|
|
51
|
+
unmarkedAgentsKept
|
|
52
|
+
} from "../chunk-WCAUUBHO.js";
|
|
47
53
|
import {
|
|
48
54
|
directoryExists,
|
|
49
55
|
fileExists,
|
|
50
56
|
getErrorMessage,
|
|
51
57
|
listDirectories,
|
|
52
|
-
remove
|
|
53
|
-
|
|
54
|
-
|
|
58
|
+
remove,
|
|
59
|
+
removeDirIfEmpty
|
|
60
|
+
} from "../chunk-XAXJWXI4.js";
|
|
61
|
+
import "../chunk-RWOYPOMR.js";
|
|
55
62
|
import "../chunk-VASLW636.js";
|
|
56
63
|
import {
|
|
57
64
|
CLAUDE_DIR,
|
|
58
65
|
CLAUDE_SRC_DIR,
|
|
59
|
-
CLI_COLORS,
|
|
60
66
|
DEFAULT_BRANDING,
|
|
61
67
|
EJECT_SOURCE,
|
|
62
68
|
STANDARD_FILES
|
|
63
|
-
} from "../chunk-
|
|
69
|
+
} from "../chunk-IO5YBKHV.js";
|
|
64
70
|
import "../chunk-VZRO7RYT.js";
|
|
65
71
|
|
|
66
72
|
// src/cli/commands/uninstall.tsx
|
|
67
73
|
import "react";
|
|
68
74
|
import { partition } from "remeda";
|
|
69
75
|
import path from "path";
|
|
70
|
-
import { readdir } from "fs/promises";
|
|
71
76
|
import { Flags } from "@oclif/core";
|
|
72
|
-
import {
|
|
73
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
77
|
+
import { jsx } from "react/jsx-runtime";
|
|
74
78
|
function buildRemovalPlan(target) {
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
79
|
+
const agents = compiledAgentsEntry(target);
|
|
80
|
+
return {
|
|
81
|
+
entries: [
|
|
82
|
+
...pluginsEntry(target),
|
|
83
|
+
...localSkillsEntry(target),
|
|
84
|
+
...agents,
|
|
85
|
+
...configManifestEntry(target)
|
|
86
|
+
],
|
|
87
|
+
kept: keptStatements(target, agents)
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function hasAnythingToRemove(plan) {
|
|
91
|
+
return plan.entries.length > 0;
|
|
92
|
+
}
|
|
93
|
+
function pluginsEntry(target) {
|
|
94
|
+
if (!target.hasPlugins) return [];
|
|
95
|
+
return [{ kind: "plugins", pluginsDir: target.pluginsDir, names: [...target.cliPluginNames] }];
|
|
96
|
+
}
|
|
97
|
+
function localSkillsEntry(target) {
|
|
98
|
+
if (!target.hasLocalSkills) return [];
|
|
99
|
+
return [{ kind: "skills", skillsDir: target.skillsDir }];
|
|
100
|
+
}
|
|
101
|
+
function compiledAgentsEntry(target) {
|
|
102
|
+
if (!target.hasLocalAgents) return [];
|
|
103
|
+
const agentNames = identifiableAgents(target);
|
|
104
|
+
if (agentNames.length === 0) return [];
|
|
105
|
+
return [{ kind: "agents", agentsDir: target.agentsDir, agentNames }];
|
|
106
|
+
}
|
|
107
|
+
function identifiableAgents(target) {
|
|
108
|
+
if (target.configuredAgents.length > 0) return target.configuredAgents;
|
|
109
|
+
return target.markedAgents;
|
|
110
|
+
}
|
|
111
|
+
function configManifestEntry(target) {
|
|
112
|
+
const fileNames = [
|
|
113
|
+
...target.hasClaudeSrcConfig ? [STANDARD_FILES.CONFIG_TS] : [],
|
|
114
|
+
...target.hasClaudeSrcConfigTypes ? [STANDARD_FILES.CONFIG_TYPES_TS] : []
|
|
115
|
+
];
|
|
116
|
+
if (fileNames.length === 0) return [];
|
|
117
|
+
return [{ kind: "config", claudeSrcDir: target.claudeSrcDir, fileNames }];
|
|
118
|
+
}
|
|
119
|
+
function keptStatements(target, agentRemovals) {
|
|
120
|
+
const removing = new Set(agentRemovals.flatMap((entry) => entry.agentNames));
|
|
121
|
+
const kept = target.unmarkedAgents.filter((name) => !removing.has(name));
|
|
122
|
+
if (kept.length === 0) return [];
|
|
123
|
+
return [unmarkedAgentsKept(target.agentsDir, kept.length)];
|
|
124
|
+
}
|
|
125
|
+
function planEntry(plan, kind) {
|
|
126
|
+
return plan.entries.find(
|
|
127
|
+
(entry) => entry.kind === kind
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
function describeEntry(entry) {
|
|
131
|
+
switch (entry.kind) {
|
|
132
|
+
case "plugins":
|
|
133
|
+
return { label: UNINSTALL_PLAN.PLUGINS_HEADING, items: entry.names };
|
|
134
|
+
case "skills":
|
|
135
|
+
return {
|
|
136
|
+
label: UNINSTALL_PLAN.CLI_MANAGED_FILES_HEADING,
|
|
137
|
+
items: [localSkillsRemoval(entry.skillsDir)]
|
|
138
|
+
};
|
|
139
|
+
case "agents":
|
|
140
|
+
return {
|
|
141
|
+
label: UNINSTALL_PLAN.CLI_MANAGED_FILES_HEADING,
|
|
142
|
+
items: [compiledAgentsRemoval(entry.agentsDir)]
|
|
143
|
+
};
|
|
144
|
+
case "config":
|
|
145
|
+
return {
|
|
146
|
+
label: UNINSTALL_PLAN.CONFIG_HEADING,
|
|
147
|
+
items: entry.fileNames.map((fileName) => `${entry.claudeSrcDir}/${fileName}`)
|
|
148
|
+
};
|
|
149
|
+
default: {
|
|
150
|
+
const _exhaustive = entry;
|
|
151
|
+
return _exhaustive;
|
|
92
152
|
}
|
|
93
|
-
sections.push({ label: "Config:", items });
|
|
94
153
|
}
|
|
95
|
-
return sections;
|
|
96
154
|
}
|
|
97
|
-
var
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
message: "Are you sure you want to uninstall?",
|
|
117
|
-
onConfirm: () => {
|
|
118
|
-
onConfirm();
|
|
119
|
-
exit();
|
|
120
|
-
},
|
|
121
|
-
onCancel: () => {
|
|
122
|
-
onCancel();
|
|
123
|
-
exit();
|
|
124
|
-
},
|
|
125
|
-
defaultValue: false
|
|
126
|
-
}
|
|
127
|
-
)
|
|
128
|
-
] });
|
|
129
|
-
};
|
|
155
|
+
var PLAN_SECTION_ORDER = [
|
|
156
|
+
UNINSTALL_PLAN.PLUGINS_HEADING,
|
|
157
|
+
UNINSTALL_PLAN.CLI_MANAGED_FILES_HEADING,
|
|
158
|
+
UNINSTALL_PLAN.CONFIG_HEADING
|
|
159
|
+
];
|
|
160
|
+
function planSections(entries) {
|
|
161
|
+
const described = entries.map(describeEntry);
|
|
162
|
+
return PLAN_SECTION_ORDER.flatMap(
|
|
163
|
+
(label) => sectionWithItems(label, itemsUnder(described, label))
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
function itemsUnder(described, label) {
|
|
167
|
+
return described.filter((section) => section.label === label).flatMap((section) => section.items);
|
|
168
|
+
}
|
|
169
|
+
function sectionWithItems(label, items) {
|
|
170
|
+
if (items.length === 0) return [];
|
|
171
|
+
return [{ label, items }];
|
|
172
|
+
}
|
|
173
|
+
var UNINSTALL_CONFIRM_MESSAGE = "Are you sure you want to uninstall?";
|
|
130
174
|
var Uninstall = class _Uninstall extends BaseCommand {
|
|
131
175
|
static summary = `Remove ${DEFAULT_BRANDING.NAME} from this project`;
|
|
132
|
-
static description = `Uninstall ${DEFAULT_BRANDING.NAME} from this project. Removes CLI-managed skills (matched by
|
|
176
|
+
static description = `Uninstall ${DEFAULT_BRANDING.NAME} from this project. Removes CLI-managed skills (matched by marketplace), compiled agents, plugins, and the .claude-src/ config manifest (config.ts + config-types.ts). User-created content is preserved.`;
|
|
133
177
|
static examples = [
|
|
134
178
|
"<%= config.bin %> <%= command.id %>",
|
|
135
179
|
"<%= config.bin %> <%= command.id %> --yes"
|
|
@@ -151,17 +195,18 @@ var Uninstall = class _Uninstall extends BaseCommand {
|
|
|
151
195
|
`Could not read the project config \u2014 plugins and compiled agents it lists may be left behind: ${reason}`
|
|
152
196
|
)
|
|
153
197
|
);
|
|
154
|
-
|
|
198
|
+
const plan = buildRemovalPlan(target);
|
|
199
|
+
if (!hasAnythingToRemove(plan)) {
|
|
155
200
|
this.reportNothingToUninstall();
|
|
156
201
|
return;
|
|
157
202
|
}
|
|
158
|
-
const confirmed = flags.yes ? this.printRemovalPlan(
|
|
203
|
+
const confirmed = flags.yes ? this.printRemovalPlan(plan) : await this.confirmRemoval(plan);
|
|
159
204
|
if (!confirmed) {
|
|
160
205
|
this.log("");
|
|
161
206
|
this.log("Uninstall cancelled");
|
|
162
207
|
this.exit(EXIT_CODES.CANCELLED);
|
|
163
208
|
}
|
|
164
|
-
await this.executeUninstall(target, projectDir);
|
|
209
|
+
await this.executeUninstall(plan, target, projectDir);
|
|
165
210
|
this.reportSuccess();
|
|
166
211
|
}
|
|
167
212
|
printHeader() {
|
|
@@ -176,45 +221,42 @@ var Uninstall = class _Uninstall extends BaseCommand {
|
|
|
176
221
|
this.log("");
|
|
177
222
|
this.log(INFO_MESSAGES.NO_CHANGES_MADE);
|
|
178
223
|
}
|
|
179
|
-
printRemovalPlan(
|
|
180
|
-
this.log(
|
|
224
|
+
printRemovalPlan(plan) {
|
|
225
|
+
this.log(UNINSTALL_PLAN.PREVIEW_HEADING);
|
|
181
226
|
this.log("");
|
|
182
|
-
for (const section of
|
|
227
|
+
for (const section of planSections(plan.entries)) {
|
|
183
228
|
this.log(` ${section.label}`);
|
|
184
229
|
for (const item of section.items) {
|
|
185
230
|
this.log(` ${item}`);
|
|
186
231
|
}
|
|
187
232
|
}
|
|
233
|
+
for (const statement of plan.kept) {
|
|
234
|
+
this.log("");
|
|
235
|
+
this.log(statement);
|
|
236
|
+
}
|
|
188
237
|
this.log("");
|
|
189
238
|
return true;
|
|
190
239
|
}
|
|
191
|
-
async confirmRemoval(
|
|
192
|
-
const outcome = await promptConfirm(({ onConfirm, onCancel }) => /* @__PURE__ */ jsx(
|
|
240
|
+
async confirmRemoval(plan) {
|
|
241
|
+
const outcome = await promptConfirm(({ onConfirm, onCancel }) => /* @__PURE__ */ jsx(
|
|
242
|
+
RemovalPlanConfirm,
|
|
243
|
+
{
|
|
244
|
+
heading: UNINSTALL_PLAN.PREVIEW_HEADING,
|
|
245
|
+
sections: planSections(plan.entries),
|
|
246
|
+
statements: plan.kept,
|
|
247
|
+
message: UNINSTALL_CONFIRM_MESSAGE,
|
|
248
|
+
onConfirm,
|
|
249
|
+
onCancel
|
|
250
|
+
}
|
|
251
|
+
));
|
|
193
252
|
return outcome === "confirmed";
|
|
194
253
|
}
|
|
195
|
-
async executeUninstall(target, projectDir) {
|
|
254
|
+
async executeUninstall(plan, target, projectDir) {
|
|
196
255
|
const isGlobalUninstall = isHomeDirectory(projectDir);
|
|
197
256
|
const propagation = isGlobalUninstall ? await this.prepareGlobalPropagation(target, projectDir) : null;
|
|
198
|
-
|
|
199
|
-
this.log("Uninstalling plugins...");
|
|
200
|
-
try {
|
|
201
|
-
const pluginResult = await uninstallPlugins(
|
|
202
|
-
target,
|
|
203
|
-
projectDir,
|
|
204
|
-
(name) => this.log(` Uninstalled plugin '${name}'`)
|
|
205
|
-
);
|
|
206
|
-
this.logSuccess(
|
|
207
|
-
`Uninstalled ${pluginResult.totalUninstalled} ${pluginResult.totalUninstalled === 1 ? "plugin" : "plugins"}`
|
|
208
|
-
);
|
|
209
|
-
} catch (error) {
|
|
210
|
-
this.log("Plugin uninstall failed");
|
|
211
|
-
this.error(getErrorMessage(error), {
|
|
212
|
-
exit: EXIT_CODES.ERROR
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
}
|
|
257
|
+
await this.removePlannedPlugins(planEntry(plan, "plugins"), target.config, projectDir);
|
|
216
258
|
try {
|
|
217
|
-
await this.removeLocalFiles(target);
|
|
259
|
+
await this.removeLocalFiles(plan, target);
|
|
218
260
|
} catch (error) {
|
|
219
261
|
this.log("Failed to remove local files");
|
|
220
262
|
this.error(getErrorMessage(error), {
|
|
@@ -260,7 +302,7 @@ var Uninstall = class _Uninstall extends BaseCommand {
|
|
|
260
302
|
skipExtraSources: true,
|
|
261
303
|
matrixOnly: true
|
|
262
304
|
}),
|
|
263
|
-
loadAgentDefs(
|
|
305
|
+
loadAgentDefs()
|
|
264
306
|
]);
|
|
265
307
|
return { globalConfig, matrix: sourceResult.matrix, agents: agentDefs.agents };
|
|
266
308
|
} catch (error) {
|
|
@@ -299,27 +341,17 @@ var Uninstall = class _Uninstall extends BaseCommand {
|
|
|
299
341
|
this.logSuccess(SUCCESS_MESSAGES.UNINSTALL_COMPLETE);
|
|
300
342
|
this.log("");
|
|
301
343
|
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
);
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
);
|
|
312
|
-
}
|
|
313
|
-
const agentResult = await removeMatchingAgents(
|
|
314
|
-
target,
|
|
315
|
-
(agentName) => this.log(` Uninstalled agent '${agentName}'`)
|
|
316
|
-
);
|
|
317
|
-
if (agentResult.removedCount > 0) {
|
|
318
|
-
this.logSuccess(
|
|
319
|
-
`Removed ${agentResult.removedCount} compiled ${agentResult.removedCount === 1 ? "agent" : "agents"}`
|
|
320
|
-
);
|
|
344
|
+
/**
|
|
345
|
+
* Each step acts only when the plan carries its entry, so what the user was shown and
|
|
346
|
+
* what this run removes are the same list read twice.
|
|
347
|
+
*/
|
|
348
|
+
async removeLocalFiles(plan, target) {
|
|
349
|
+
await this.removePlannedSkills(planEntry(plan, "skills"));
|
|
350
|
+
await this.removePlannedAgents(planEntry(plan, "agents"));
|
|
351
|
+
for (const statement of plan.kept) {
|
|
352
|
+
this.log(statement);
|
|
321
353
|
}
|
|
322
|
-
const cleanup = await cleanupEmptyDirs(target);
|
|
354
|
+
const cleanup = await cleanupEmptyDirs(target, planEntry(plan, "config"));
|
|
323
355
|
if (cleanup.claudeSrcDirRemoved) {
|
|
324
356
|
this.logSuccess(`Removed ${CLAUDE_SRC_DIR}/`);
|
|
325
357
|
} else if (cleanup.claudeSrcManifestRemoved) {
|
|
@@ -331,24 +363,64 @@ var Uninstall = class _Uninstall extends BaseCommand {
|
|
|
331
363
|
this.log(`Kept ${CLAUDE_DIR}/ (contains user content)`);
|
|
332
364
|
}
|
|
333
365
|
}
|
|
366
|
+
async removePlannedPlugins(entry, config, projectDir) {
|
|
367
|
+
if (!entry) return;
|
|
368
|
+
this.log("Uninstalling plugins...");
|
|
369
|
+
try {
|
|
370
|
+
const pluginResult = await uninstallPlugins(
|
|
371
|
+
entry,
|
|
372
|
+
config,
|
|
373
|
+
projectDir,
|
|
374
|
+
(name) => this.log(` Uninstalled plugin '${name}'`)
|
|
375
|
+
);
|
|
376
|
+
this.logSuccess(
|
|
377
|
+
`Uninstalled ${pluginResult.totalUninstalled} ${pluginResult.totalUninstalled === 1 ? "plugin" : "plugins"}`
|
|
378
|
+
);
|
|
379
|
+
} catch (error) {
|
|
380
|
+
this.log("Plugin uninstall failed");
|
|
381
|
+
this.error(getErrorMessage(error), {
|
|
382
|
+
exit: EXIT_CODES.ERROR
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
async removePlannedSkills(entry) {
|
|
387
|
+
if (!entry) return;
|
|
388
|
+
const result = await removeMatchingSkills(
|
|
389
|
+
entry,
|
|
390
|
+
(dirName) => this.log(` Uninstalled skill '${dirName}'`),
|
|
391
|
+
(dirName) => this.warn(`Skipping '${dirName}': not created by ${DEFAULT_BRANDING.NAME} CLI`)
|
|
392
|
+
);
|
|
393
|
+
if (result.removedCount === 0) return;
|
|
394
|
+
this.logSuccess(
|
|
395
|
+
`Removed ${result.removedCount} CLI-installed ${result.removedCount === 1 ? "skill" : "skills"}`
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
async removePlannedAgents(entry) {
|
|
399
|
+
if (!entry) return;
|
|
400
|
+
const result = await removeMatchingAgents(
|
|
401
|
+
entry,
|
|
402
|
+
(agentName) => this.log(` Uninstalled agent '${agentName}'`)
|
|
403
|
+
);
|
|
404
|
+
if (result.removedCount === 0) return;
|
|
405
|
+
this.logSuccess(
|
|
406
|
+
`Removed ${result.removedCount} compiled ${result.removedCount === 1 ? "agent" : "agents"}`
|
|
407
|
+
);
|
|
408
|
+
}
|
|
334
409
|
};
|
|
335
|
-
function hasAnythingToRemove(target) {
|
|
336
|
-
return target.hasPlugins || target.hasLocalSkills || target.hasLocalAgents || target.hasClaudeSrcConfig || target.hasClaudeSrcConfigTypes;
|
|
337
|
-
}
|
|
338
410
|
function collectConfiguredAgents(config) {
|
|
339
411
|
if (!config?.agents) return [];
|
|
340
412
|
return config.agents.map((a) => a.name);
|
|
341
413
|
}
|
|
342
414
|
function getCliInstalledPluginKeys(config) {
|
|
343
415
|
if (!config?.skills) return /* @__PURE__ */ new Set();
|
|
344
|
-
const {
|
|
416
|
+
const { marketplaceName } = config;
|
|
345
417
|
return new Set(
|
|
346
418
|
config.skills.flatMap((skill) => [
|
|
347
|
-
// Primary key: skill.id@skill.
|
|
348
|
-
buildMarketplacePluginRef(skill.id, skill.
|
|
419
|
+
// Primary key: skill.id@skill.origin
|
|
420
|
+
buildMarketplacePluginRef(skill.id, skill.origin),
|
|
349
421
|
// Marketplace variant for plugins installed via marketplace where
|
|
350
|
-
// skill.
|
|
351
|
-
...
|
|
422
|
+
// skill.origin may differ (e.g., "eject" vs the marketplace name)
|
|
423
|
+
...marketplaceName && skill.origin !== marketplaceName && skill.origin !== EJECT_SOURCE ? [buildMarketplacePluginRef(skill.id, marketplaceName)] : []
|
|
352
424
|
])
|
|
353
425
|
);
|
|
354
426
|
}
|
|
@@ -375,14 +447,16 @@ async function detectUninstallTarget(projectDir, onConfigLoadFailed) {
|
|
|
375
447
|
hasClaudeDir,
|
|
376
448
|
hasClaudeSrcConfig,
|
|
377
449
|
hasClaudeSrcConfigTypes,
|
|
378
|
-
config
|
|
450
|
+
config,
|
|
451
|
+
agentProvenance
|
|
379
452
|
] = await Promise.all([
|
|
380
453
|
directoryExists(skillsDir),
|
|
381
454
|
directoryExists(agentsDir),
|
|
382
455
|
directoryExists(claudeDir),
|
|
383
456
|
fileExists(claudeSrcConfigPath),
|
|
384
457
|
fileExists(claudeSrcConfigTypesPath),
|
|
385
|
-
loadUninstallConfig(projectDir, onConfigLoadFailed)
|
|
458
|
+
loadUninstallConfig(projectDir, onConfigLoadFailed),
|
|
459
|
+
splitAgentsByProvenance(agentsDir)
|
|
386
460
|
]);
|
|
387
461
|
let pluginNames = [];
|
|
388
462
|
try {
|
|
@@ -412,30 +486,23 @@ async function detectUninstallTarget(projectDir, onConfigLoadFailed) {
|
|
|
412
486
|
claudeDir,
|
|
413
487
|
claudeSrcDir,
|
|
414
488
|
config,
|
|
415
|
-
configuredAgents
|
|
489
|
+
configuredAgents,
|
|
490
|
+
markedAgents: agentProvenance.marked,
|
|
491
|
+
unmarkedAgents: agentProvenance.unmarked
|
|
416
492
|
};
|
|
417
493
|
}
|
|
418
494
|
function shouldRemoveSkill(forkedFrom) {
|
|
419
495
|
return forkedFrom !== null;
|
|
420
496
|
}
|
|
421
|
-
async function removeMatchingSkills(
|
|
422
|
-
|
|
423
|
-
return {
|
|
424
|
-
removedCount: 0,
|
|
425
|
-
skippedCount: 0,
|
|
426
|
-
removedNames: [],
|
|
427
|
-
skippedNames: [],
|
|
428
|
-
dirCleaned: false
|
|
429
|
-
};
|
|
430
|
-
}
|
|
431
|
-
const classified = await classifySkillDirs(target.skillsDir);
|
|
497
|
+
async function removeMatchingSkills(entry, onRemoved, onSkipped) {
|
|
498
|
+
const classified = await classifySkillDirs(entry.skillsDir);
|
|
432
499
|
const removedNames = await removeClassifiedSkills(
|
|
433
500
|
classified.toRemove,
|
|
434
|
-
|
|
501
|
+
entry.skillsDir,
|
|
435
502
|
onRemoved
|
|
436
503
|
);
|
|
437
504
|
classified.toSkip.forEach((name) => onSkipped?.(name));
|
|
438
|
-
const dirCleaned = await cleanupSkillsDir(
|
|
505
|
+
const dirCleaned = await cleanupSkillsDir(entry.skillsDir, classified.toSkip.length === 0);
|
|
439
506
|
return {
|
|
440
507
|
removedCount: removedNames.length,
|
|
441
508
|
skippedCount: classified.toSkip.length,
|
|
@@ -466,68 +533,47 @@ async function cleanupSkillsDir(dir, allRemoved) {
|
|
|
466
533
|
if (!allRemoved) return false;
|
|
467
534
|
return removeDirIfEmpty(dir);
|
|
468
535
|
}
|
|
469
|
-
async function
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
await remove(dir);
|
|
473
|
-
return true;
|
|
474
|
-
}
|
|
475
|
-
async function removeMatchingAgents(target, onRemoved) {
|
|
476
|
-
if (!target.hasLocalAgents) {
|
|
477
|
-
return { removedCount: 0, removedNames: [], dirCleaned: false };
|
|
478
|
-
}
|
|
479
|
-
if (target.configuredAgents.length === 0) {
|
|
480
|
-
return { removedCount: 0, removedNames: [], dirCleaned: false };
|
|
481
|
-
}
|
|
482
|
-
const agentFiles = await listAgentFiles(target.agentsDir);
|
|
483
|
-
const removedNames = agentFiles.map((agentFile) => agentFile.replace(/\.md$/, "")).filter((agentName) => target.configuredAgents.includes(agentName));
|
|
536
|
+
async function removeMatchingAgents(entry, onRemoved) {
|
|
537
|
+
const agentFiles = await listAgentFiles(entry.agentsDir);
|
|
538
|
+
const removedNames = agentFiles.map((agentFile) => agentFile.replace(/\.md$/, "")).filter((agentName) => entry.agentNames.includes(agentName));
|
|
484
539
|
for (const agentName of removedNames) {
|
|
485
|
-
await remove(path.join(
|
|
540
|
+
await remove(path.join(entry.agentsDir, `${agentName}.md`));
|
|
486
541
|
onRemoved?.(agentName);
|
|
487
542
|
}
|
|
488
|
-
const dirCleaned = await removeDirIfEmpty(
|
|
543
|
+
const dirCleaned = await removeDirIfEmpty(entry.agentsDir);
|
|
489
544
|
return {
|
|
490
545
|
removedCount: removedNames.length,
|
|
491
546
|
removedNames,
|
|
492
547
|
dirCleaned
|
|
493
548
|
};
|
|
494
549
|
}
|
|
495
|
-
async function uninstallPlugins(
|
|
496
|
-
if (!target.hasPlugins) {
|
|
497
|
-
return { uninstalledNames: [], totalUninstalled: 0 };
|
|
498
|
-
}
|
|
550
|
+
async function uninstallPlugins(entry, config, projectDir, onUninstalled) {
|
|
499
551
|
const cliAvailable = await isClaudeCLIAvailable();
|
|
500
|
-
for (const pluginName of
|
|
552
|
+
for (const pluginName of entry.names) {
|
|
501
553
|
if (cliAvailable) {
|
|
502
554
|
const skillId = parseMarketplacePluginRef(pluginName);
|
|
503
|
-
const skillConfig =
|
|
555
|
+
const skillConfig = config?.skills.find((s) => s.id === skillId);
|
|
504
556
|
const primaryScope = toClaudePluginScope(skillConfig?.scope);
|
|
505
557
|
await claudePluginUninstallBestEffort(pluginName, primaryScope, projectDir);
|
|
506
558
|
}
|
|
507
|
-
const pluginPath = path.join(
|
|
559
|
+
const pluginPath = path.join(entry.pluginsDir, pluginName);
|
|
508
560
|
await remove(pluginPath);
|
|
509
561
|
onUninstalled?.(pluginName);
|
|
510
562
|
}
|
|
511
563
|
return {
|
|
512
|
-
uninstalledNames:
|
|
513
|
-
totalUninstalled:
|
|
564
|
+
uninstalledNames: entry.names,
|
|
565
|
+
totalUninstalled: entry.names.length
|
|
514
566
|
};
|
|
515
567
|
}
|
|
516
|
-
async function removeConfigManifest(
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
}
|
|
522
|
-
if (target.hasClaudeSrcConfigTypes) {
|
|
523
|
-
await remove(path.join(target.claudeSrcDir, STANDARD_FILES.CONFIG_TYPES_TS));
|
|
524
|
-
manifestRemoved = true;
|
|
525
|
-
}
|
|
526
|
-
const dirRemoved = manifestRemoved && await removeDirIfEmpty(target.claudeSrcDir);
|
|
527
|
-
return { manifestRemoved, dirRemoved };
|
|
568
|
+
async function removeConfigManifest(entry) {
|
|
569
|
+
if (!entry) return { manifestRemoved: false, dirRemoved: false };
|
|
570
|
+
await Promise.all(
|
|
571
|
+
entry.fileNames.map((fileName) => remove(path.join(entry.claudeSrcDir, fileName)))
|
|
572
|
+
);
|
|
573
|
+
return { manifestRemoved: true, dirRemoved: await removeDirIfEmpty(entry.claudeSrcDir) };
|
|
528
574
|
}
|
|
529
|
-
async function cleanupEmptyDirs(target) {
|
|
530
|
-
const manifest = await removeConfigManifest(
|
|
575
|
+
async function cleanupEmptyDirs(target, manifestEntry) {
|
|
576
|
+
const manifest = await removeConfigManifest(manifestEntry);
|
|
531
577
|
const claudeDirRemoved = target.hasClaudeDir && await removeDirIfEmpty(target.claudeDir);
|
|
532
578
|
const claudeDirKept = !claudeDirRemoved && target.hasClaudeDir && await directoryExists(target.claudeDir);
|
|
533
579
|
return {
|
|
@@ -537,14 +583,6 @@ async function cleanupEmptyDirs(target) {
|
|
|
537
583
|
claudeDirKept
|
|
538
584
|
};
|
|
539
585
|
}
|
|
540
|
-
async function isDirectoryEmpty(dirPath) {
|
|
541
|
-
try {
|
|
542
|
-
const allEntries = await readdir(dirPath);
|
|
543
|
-
return allEntries.length === 0;
|
|
544
|
-
} catch {
|
|
545
|
-
return true;
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
586
|
async function listAgentFiles(agentsDir) {
|
|
549
587
|
try {
|
|
550
588
|
return await listAgentMdFiles(agentsDir);
|