@deepseek-ai/dsh 0.1.5-rc.2 → 0.1.6-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +2 -2
- package/README.md +9 -5
- package/README.zh.md +15 -11
- package/lib/bin.js +118 -48
- package/lib/{dump-config-lFgMwK8i.js → dump-config-Bb5YvFIX.js} +1 -1
- package/lib/plugin-DJ-rVHUS.js +31 -0
- package/lib/{profile-boot-Dk-7KqJc.js → profile-boot-BNu17Y9U.js} +85 -130
- package/lib/profile-boot.js +2 -0
- package/lib/types/args.d.ts +56 -0
- package/lib/types/bin.d.ts +11 -0
- package/lib/types/dump-config.d.ts +18 -0
- package/lib/types/plugin.d.ts +7 -0
- package/lib/types/process-shutdown.d.ts +20 -0
- package/lib/types/profile-boot.d.ts +92 -0
- package/lib/types/startup-diagnostics.d.ts +19 -0
- package/package.json +123 -110
- package/lib/plugin-Ddi42qoW.js +0 -130
- package/lib/profile-boot-BP_C0vpU.js +0 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh",
|
|
3
|
-
"description": "dsh CLI: profile
|
|
4
|
-
"version": "0.1.
|
|
3
|
+
"description": "dsh CLI: profile launch, plugin management, and configuration inspection",
|
|
4
|
+
"version": "0.1.6-alpha.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"dsh": "lib/bin.js"
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
|
-
"lib/*.js"
|
|
18
|
+
"lib/*.js",
|
|
19
|
+
"lib/types/*.d.ts"
|
|
19
20
|
],
|
|
20
21
|
"dsh": {
|
|
21
22
|
"configTrees": [
|
|
@@ -30,76 +31,81 @@
|
|
|
30
31
|
"dependencies": {
|
|
31
32
|
"commander": "^15.0.0",
|
|
32
33
|
"js-yaml": "^4.2.0",
|
|
33
|
-
"node-addon-require-builtin": "^0.1.
|
|
34
|
+
"node-addon-require-builtin": "^0.1.6",
|
|
34
35
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
35
|
-
"@deepseek-ai/
|
|
36
|
+
"@deepseek-ai/dsh-hmr": "^0.1.6-alpha.2",
|
|
36
37
|
"@deepseek-ai/cordis-plugin-include": "^1.0.7",
|
|
37
|
-
"@deepseek-ai/cordis-plugin-loader": "^1.0.3",
|
|
38
38
|
"@deepseek-ai/cordis-plugin-timer": "^1.1.4",
|
|
39
|
-
"@deepseek-ai/dsh-acp-app": "^0.1.
|
|
40
|
-
"@deepseek-ai/dsh-agent-instructions": "^0.1.
|
|
41
|
-
"@deepseek-ai/dsh-agent-tool-presentation": "^0.1.
|
|
42
|
-
"@deepseek-ai/dsh-app-boot": "^0.1.
|
|
43
|
-
"@deepseek-ai/dsh-base": "^0.1.
|
|
44
|
-
"@deepseek-ai/dsh-client-ui-agent-preset": "^0.1.
|
|
45
|
-
"@deepseek-ai/dsh-client-ui-cordis": "^0.1.
|
|
46
|
-
"@deepseek-ai/dsh-
|
|
47
|
-
"@deepseek-ai/
|
|
48
|
-
"@deepseek-ai/dsh-
|
|
49
|
-
"@deepseek-ai/dsh-
|
|
50
|
-
"@deepseek-ai/dsh-
|
|
51
|
-
"@deepseek-ai/dsh-
|
|
52
|
-
"@deepseek-ai/dsh-
|
|
53
|
-
"@deepseek-ai/dsh-
|
|
54
|
-
"@deepseek-ai/dsh-
|
|
55
|
-
"@deepseek-ai/dsh-
|
|
56
|
-
"@deepseek-ai/dsh-
|
|
57
|
-
"@deepseek-ai/dsh-
|
|
58
|
-
"@deepseek-ai/dsh-
|
|
59
|
-
"@deepseek-ai/dsh-
|
|
60
|
-
"@deepseek-ai/dsh-
|
|
61
|
-
"@deepseek-ai/dsh-
|
|
62
|
-
"@deepseek-ai/dsh-
|
|
63
|
-
"@deepseek-ai/dsh-
|
|
64
|
-
"@deepseek-ai/dsh-
|
|
65
|
-
"@deepseek-ai/dsh-
|
|
66
|
-
"@deepseek-ai/dsh-
|
|
67
|
-
"@deepseek-ai/dsh-
|
|
68
|
-
"@deepseek-ai/dsh-
|
|
69
|
-
"@deepseek-ai/dsh-
|
|
70
|
-
"@deepseek-ai/dsh-
|
|
71
|
-
"@deepseek-ai/dsh-
|
|
72
|
-
"@deepseek-ai/dsh-
|
|
73
|
-
"@deepseek-ai/dsh-
|
|
74
|
-
"@deepseek-ai/dsh-
|
|
75
|
-
"@deepseek-ai/dsh-
|
|
76
|
-
"@deepseek-ai/dsh-
|
|
77
|
-
"@deepseek-ai/dsh-
|
|
78
|
-
"@deepseek-ai/dsh-
|
|
79
|
-
"@deepseek-ai/dsh-
|
|
80
|
-
"@deepseek-ai/dsh-
|
|
81
|
-
"@deepseek-ai/dsh-tool-
|
|
82
|
-
"@deepseek-ai/dsh-tool-
|
|
83
|
-
"@deepseek-ai/dsh-
|
|
84
|
-
"@deepseek-ai/dsh-
|
|
85
|
-
"@deepseek-ai/dsh-tool-
|
|
86
|
-
"@deepseek-ai/dsh-tool-
|
|
87
|
-
"@deepseek-ai/dsh-tool-
|
|
88
|
-
"@deepseek-ai/dsh-tool-
|
|
89
|
-
"@deepseek-ai/dsh-tool-
|
|
90
|
-
"@deepseek-ai/dsh-tool-
|
|
91
|
-
"@deepseek-ai/dsh-tool-
|
|
92
|
-
"@deepseek-ai/dsh-tool-
|
|
93
|
-
"@deepseek-ai/dsh-tool-
|
|
94
|
-
"@deepseek-ai/dsh-tool-
|
|
95
|
-
"@deepseek-ai/dsh-
|
|
96
|
-
"@deepseek-ai/dsh-
|
|
97
|
-
"@deepseek-ai/dsh-tool-
|
|
98
|
-
"@deepseek-ai/dsh-
|
|
99
|
-
"@deepseek-ai/dsh-workflow
|
|
100
|
-
"@deepseek-ai/dsh-
|
|
101
|
-
"@deepseek-ai/dsh-
|
|
102
|
-
"@deepseek-ai/
|
|
39
|
+
"@deepseek-ai/dsh-acp-app": "^0.1.6-alpha.2",
|
|
40
|
+
"@deepseek-ai/dsh-agent-instructions": "^0.1.6-alpha.2",
|
|
41
|
+
"@deepseek-ai/dsh-agent-tool-presentation": "^0.1.6-alpha.2",
|
|
42
|
+
"@deepseek-ai/dsh-app-boot": "^0.1.6-alpha.2",
|
|
43
|
+
"@deepseek-ai/dsh-base": "^0.1.6-alpha.2",
|
|
44
|
+
"@deepseek-ai/dsh-client-ui-agent-preset": "^0.1.6-alpha.2",
|
|
45
|
+
"@deepseek-ai/dsh-client-ui-cordis": "^0.1.6-alpha.2",
|
|
46
|
+
"@deepseek-ai/dsh-cmdline": "^0.1.6-alpha.2",
|
|
47
|
+
"@deepseek-ai/cordis-plugin-loader": "^1.0.3",
|
|
48
|
+
"@deepseek-ai/dsh-command-compact": "^0.1.6-alpha.2",
|
|
49
|
+
"@deepseek-ai/dsh-command-goal": "^0.1.6-alpha.2",
|
|
50
|
+
"@deepseek-ai/dsh-compaction-tool-result-pruner": "^0.1.6-alpha.2",
|
|
51
|
+
"@deepseek-ai/dsh-cordis-client-runner": "^0.1.6-alpha.2",
|
|
52
|
+
"@deepseek-ai/dsh-experimental-agent-team-profile": "^0.1.6-alpha.2",
|
|
53
|
+
"@deepseek-ai/dsh-experimental-agent-team-web-profile": "^0.1.6-alpha.2",
|
|
54
|
+
"@deepseek-ai/dsh-goal": "^0.1.6-alpha.2",
|
|
55
|
+
"@deepseek-ai/dsh-fs-local": "^0.1.6-alpha.2",
|
|
56
|
+
"@deepseek-ai/dsh-goal-round-driver": "^0.1.6-alpha.2",
|
|
57
|
+
"@deepseek-ai/dsh-headless": "^0.1.6-alpha.2",
|
|
58
|
+
"@deepseek-ai/dsh-compaction-basic": "^0.1.6-alpha.2",
|
|
59
|
+
"@deepseek-ai/dsh-home-paths": "^0.1.6-alpha.2",
|
|
60
|
+
"@deepseek-ai/dsh-hooks-claude-code": "^0.1.6-alpha.2",
|
|
61
|
+
"@deepseek-ai/dsh-hooks-codex": "^0.1.6-alpha.2",
|
|
62
|
+
"@deepseek-ai/dsh-jobs-local": "^0.1.6-alpha.2",
|
|
63
|
+
"@deepseek-ai/dsh-launch-environment": "^0.1.6-alpha.2",
|
|
64
|
+
"@deepseek-ai/dsh-mcp-client": "^0.1.6-alpha.2",
|
|
65
|
+
"@deepseek-ai/dsh-persona": "^0.1.6-alpha.2",
|
|
66
|
+
"@deepseek-ai/dsh-plan-mode": "^0.1.6-alpha.2",
|
|
67
|
+
"@deepseek-ai/dsh-pwsh-local": "^0.1.6-alpha.2",
|
|
68
|
+
"@deepseek-ai/dsh-pwsh-sandbox": "^0.1.6-alpha.2",
|
|
69
|
+
"@deepseek-ai/dsh-schedule": "^0.1.6-alpha.2",
|
|
70
|
+
"@deepseek-ai/dsh-sdk-app": "^0.1.6-alpha.2",
|
|
71
|
+
"@deepseek-ai/dsh-sdk-minimal": "^0.1.6-alpha.2",
|
|
72
|
+
"@deepseek-ai/dsh-session-projection": "^0.1.6-alpha.2",
|
|
73
|
+
"@deepseek-ai/dsh-session-reference": "^0.1.6-alpha.2",
|
|
74
|
+
"@deepseek-ai/dsh-skill": "^0.1.6-alpha.2",
|
|
75
|
+
"@deepseek-ai/dsh-skill-filesystem": "^0.1.6-alpha.2",
|
|
76
|
+
"@deepseek-ai/dsh-terminal": "^0.1.6-alpha.2",
|
|
77
|
+
"@deepseek-ai/dsh-terminal-bash": "^0.1.6-alpha.2",
|
|
78
|
+
"@deepseek-ai/dsh-time-context": "^0.1.6-alpha.2",
|
|
79
|
+
"@deepseek-ai/dsh-tmux-context": "^0.1.6-alpha.2",
|
|
80
|
+
"@deepseek-ai/dsh-token-meter": "^0.1.6-alpha.2",
|
|
81
|
+
"@deepseek-ai/dsh-tool-bash": "^0.1.6-alpha.2",
|
|
82
|
+
"@deepseek-ai/dsh-tool-bash-persistent": "^0.1.6-alpha.2",
|
|
83
|
+
"@deepseek-ai/dsh-tool-ask-user": "^0.1.6-alpha.2",
|
|
84
|
+
"@deepseek-ai/dsh-tool-present": "^0.1.6-alpha.2",
|
|
85
|
+
"@deepseek-ai/dsh-tool-cordis": "^0.1.6-alpha.2",
|
|
86
|
+
"@deepseek-ai/dsh-tool-fs": "^0.1.6-alpha.2",
|
|
87
|
+
"@deepseek-ai/dsh-tool-fs-search": "^0.1.6-alpha.2",
|
|
88
|
+
"@deepseek-ai/dsh-tool-goal": "^0.1.6-alpha.2",
|
|
89
|
+
"@deepseek-ai/dsh-tool-jobs": "^0.1.6-alpha.2",
|
|
90
|
+
"@deepseek-ai/dsh-tool-pwsh": "^0.1.6-alpha.2",
|
|
91
|
+
"@deepseek-ai/dsh-tool-pwsh-persistent": "^0.1.6-alpha.2",
|
|
92
|
+
"@deepseek-ai/dsh-tool-ralph": "^0.1.6-alpha.2",
|
|
93
|
+
"@deepseek-ai/dsh-tool-skill": "^0.1.6-alpha.2",
|
|
94
|
+
"@deepseek-ai/dsh-tool-str-replace-editor": "^0.1.6-alpha.2",
|
|
95
|
+
"@deepseek-ai/dsh-tool-subagent": "^0.1.6-alpha.2",
|
|
96
|
+
"@deepseek-ai/dsh-tool-subagent-control": "^0.1.6-alpha.2",
|
|
97
|
+
"@deepseek-ai/dsh-tool-todo": "^0.1.6-alpha.2",
|
|
98
|
+
"@deepseek-ai/dsh-tool-web": "^0.1.6-alpha.2",
|
|
99
|
+
"@deepseek-ai/dsh-tool-workflow": "^0.1.6-alpha.2",
|
|
100
|
+
"@deepseek-ai/dsh-web-app": "^0.1.6-alpha.2",
|
|
101
|
+
"@deepseek-ai/dsh-webhook": "^0.1.6-alpha.2",
|
|
102
|
+
"@deepseek-ai/dsh-webhook-github": "^0.1.6-alpha.2",
|
|
103
|
+
"@deepseek-ai/schemastery": "^3.18.2",
|
|
104
|
+
"@deepseek-ai/dsh-workflow-ptc": "^0.1.6-alpha.2",
|
|
105
|
+
"@deepseek-ai/dsh-http-proxy": "^0.1.6-alpha.2",
|
|
106
|
+
"@deepseek-ai/dsh-mcp-resources": "^0.1.6-alpha.2",
|
|
107
|
+
"@deepseek-ai/dsh-plugin-manager": "^0.1.6-alpha.2",
|
|
108
|
+
"@deepseek-ai/dsh-atomic-write": "^0.1.6-alpha.2"
|
|
103
109
|
},
|
|
104
110
|
"devDependencies": {
|
|
105
111
|
"@agentclientprotocol/sdk": "1.4.0",
|
|
@@ -107,45 +113,52 @@
|
|
|
107
113
|
"@types/ws": "8.18.1",
|
|
108
114
|
"execa": "^10.0.0",
|
|
109
115
|
"ws": "8.21.0",
|
|
110
|
-
"@deepseek-ai/dsh-acp": "^0.1.
|
|
111
|
-
"@deepseek-ai/dsh-agent": "^0.1.
|
|
112
|
-
"@deepseek-ai/dsh-agent-loop": "^0.1.
|
|
113
|
-
"@deepseek-ai/dsh-agent-loop-testkit": "^0.1.
|
|
114
|
-
"@deepseek-ai/dsh-attachment-local": "^0.1.
|
|
115
|
-
"@deepseek-ai/dsh-bash-local": "^0.1.
|
|
116
|
-
"@deepseek-ai/dsh-credentials-local": "^0.1.
|
|
117
|
-
"@deepseek-ai/dsh-deepseek-llm-api-extensions": "^0.1.
|
|
118
|
-
"@deepseek-ai/dsh-experimental-agent-team": "^0.1.
|
|
119
|
-
"@deepseek-ai/dsh-experimental-
|
|
120
|
-
"@deepseek-ai/dsh-experimental-tool-agent-team": "^0.1.
|
|
121
|
-
"@deepseek-ai/dsh-fs-observation-policy": "^0.1.
|
|
122
|
-
"@deepseek-ai/dsh-fs-sandbox": "^0.1.
|
|
123
|
-
"@deepseek-ai/dsh-host-frontend-static": "^0.1.
|
|
124
|
-
"@deepseek-ai/dsh-
|
|
125
|
-
"@deepseek-ai/dsh-llm": "^0.1.
|
|
126
|
-
"@deepseek-ai/dsh-llm-
|
|
127
|
-
"@deepseek-ai/dsh-llm-
|
|
128
|
-
"@deepseek-ai/dsh-
|
|
129
|
-
"@deepseek-ai/dsh-
|
|
130
|
-
"@deepseek-ai/dsh-
|
|
131
|
-
"@deepseek-ai/dsh-
|
|
132
|
-
"@deepseek-ai/dsh-
|
|
133
|
-
"@deepseek-ai/dsh-
|
|
134
|
-
"@deepseek-ai/dsh-session": "^0.1.
|
|
135
|
-
"@deepseek-ai/dsh-session-
|
|
136
|
-
"@deepseek-ai/dsh-session-
|
|
137
|
-
"@deepseek-ai/dsh-
|
|
138
|
-
"@deepseek-ai/dsh-
|
|
139
|
-
"@deepseek-ai/dsh-
|
|
140
|
-
"@deepseek-ai/dsh-settings": "^0.1.
|
|
141
|
-
"@deepseek-ai/dsh-
|
|
142
|
-
"@deepseek-ai/dsh-
|
|
143
|
-
"@deepseek-ai/dsh-subagent-fork-in-process": "^0.1.
|
|
144
|
-
"@deepseek-ai/dsh-
|
|
145
|
-
"@deepseek-ai/dsh-
|
|
146
|
-
"@deepseek-ai/dsh-
|
|
147
|
-
"@deepseek-ai/dsh-
|
|
148
|
-
"@deepseek-ai/dsh-
|
|
149
|
-
|
|
116
|
+
"@deepseek-ai/dsh-acp": "^0.1.6-alpha.2",
|
|
117
|
+
"@deepseek-ai/dsh-agent": "^0.1.6-alpha.2",
|
|
118
|
+
"@deepseek-ai/dsh-agent-loop": "^0.1.6-alpha.2",
|
|
119
|
+
"@deepseek-ai/dsh-agent-loop-testkit": "^0.1.6-alpha.2",
|
|
120
|
+
"@deepseek-ai/dsh-attachment-local": "^0.1.6-alpha.2",
|
|
121
|
+
"@deepseek-ai/dsh-bash-local": "^0.1.6-alpha.2",
|
|
122
|
+
"@deepseek-ai/dsh-credentials-local": "^0.1.6-alpha.2",
|
|
123
|
+
"@deepseek-ai/dsh-deepseek-llm-api-extensions": "^0.1.6-alpha.2",
|
|
124
|
+
"@deepseek-ai/dsh-experimental-agent-team": "^0.1.6-alpha.2",
|
|
125
|
+
"@deepseek-ai/dsh-experimental-ptc-runtime-python": "^0.1.6-alpha.2",
|
|
126
|
+
"@deepseek-ai/dsh-experimental-tool-agent-team": "^0.1.6-alpha.2",
|
|
127
|
+
"@deepseek-ai/dsh-fs-observation-policy": "^0.1.6-alpha.2",
|
|
128
|
+
"@deepseek-ai/dsh-fs-sandbox": "^0.1.6-alpha.2",
|
|
129
|
+
"@deepseek-ai/dsh-host-frontend-static": "^0.1.6-alpha.2",
|
|
130
|
+
"@deepseek-ai/dsh-llm-deepseek": "^0.1.6-alpha.2",
|
|
131
|
+
"@deepseek-ai/dsh-llm-mock-server": "^0.1.6-alpha.2",
|
|
132
|
+
"@deepseek-ai/dsh-llm-pi-ai": "^0.1.6-alpha.2",
|
|
133
|
+
"@deepseek-ai/dsh-llm-replay": "^0.1.6-alpha.2",
|
|
134
|
+
"@deepseek-ai/dsh-loader-smoke": "^0.1.6-alpha.2",
|
|
135
|
+
"@deepseek-ai/dsh-plugin-package-inventory-deepseek": "^0.1.6-alpha.2",
|
|
136
|
+
"@deepseek-ai/dsh-sandbox-local": "^0.1.6-alpha.2",
|
|
137
|
+
"@deepseek-ai/dsh-sandbox-policy": "^0.1.6-alpha.2",
|
|
138
|
+
"@deepseek-ai/dsh-session": "^0.1.6-alpha.2",
|
|
139
|
+
"@deepseek-ai/dsh-session-checkpoint-policy": "^0.1.6-alpha.2",
|
|
140
|
+
"@deepseek-ai/dsh-session-log-deepseek": "^0.1.6-alpha.2",
|
|
141
|
+
"@deepseek-ai/dsh-session-persistence-jsonl": "^0.1.6-alpha.2",
|
|
142
|
+
"@deepseek-ai/dsh-session-query": "^0.1.6-alpha.2",
|
|
143
|
+
"@deepseek-ai/dsh-shell-env": "^0.1.6-alpha.2",
|
|
144
|
+
"@deepseek-ai/dsh-llm": "^0.1.6-alpha.2",
|
|
145
|
+
"@deepseek-ai/dsh-settings": "^0.1.6-alpha.2",
|
|
146
|
+
"@deepseek-ai/dsh-settings-file": "^0.1.6-alpha.2",
|
|
147
|
+
"@deepseek-ai/dsh-subagent": "^0.1.6-alpha.2",
|
|
148
|
+
"@deepseek-ai/dsh-host-webserver": "^0.1.6-alpha.2",
|
|
149
|
+
"@deepseek-ai/dsh-subagent-fork-in-process": "^0.1.6-alpha.2",
|
|
150
|
+
"@deepseek-ai/dsh-subprocess-local": "^0.1.6-alpha.2",
|
|
151
|
+
"@deepseek-ai/dsh-subagent-spawn-in-process": "^0.1.6-alpha.2",
|
|
152
|
+
"@deepseek-ai/dsh-tools": "^0.1.6-alpha.2",
|
|
153
|
+
"@deepseek-ai/dsh-user-approval": "^0.1.6-alpha.2",
|
|
154
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.6-alpha.2"
|
|
155
|
+
},
|
|
156
|
+
"exports": {
|
|
157
|
+
"./profile-boot": {
|
|
158
|
+
"types": "./lib/types/profile-boot.d.ts",
|
|
159
|
+
"default": "./lib/profile-boot.js"
|
|
160
|
+
},
|
|
161
|
+
"./lib/*": "./lib/*",
|
|
162
|
+
"./package.json": "./package.json"
|
|
150
163
|
}
|
|
151
164
|
}
|
package/lib/plugin-Ddi42qoW.js
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { t as INSTALL_ANCHOR } from "./profile-boot-Dk-7KqJc.js";
|
|
2
|
-
import { existsSync } from "node:fs";
|
|
3
|
-
import { DEFAULT_PROFILE_BUNDLES, PROFILE_TEMPLATES, initProfile, readProfileManifest, resolveBundleDir, resolveProfileDir, writeProfileManifest } from "@deepseek-ai/dsh-app-boot";
|
|
4
|
-
import { join, resolve } from "node:path";
|
|
5
|
-
import { spawnSync } from "node:child_process";
|
|
6
|
-
//#region lib/types/plugin.js
|
|
7
|
-
/**
|
|
8
|
-
* `dsh plugin --profile <name> <args...>` — profile plugin management as a
|
|
9
|
-
* thin pnpm forwarder: initialize the profile on first use, run
|
|
10
|
-
* `pnpm <args...>` in the profile directory, then reconcile the
|
|
11
|
-
* `dsh.profile.bundles` layer list against the installed state (a dependency
|
|
12
|
-
* resolving to a package that declares `dsh.bundle` joins the layer stack; a
|
|
13
|
-
* removed or bundle-less dependency leaves it). Reconciling by installed
|
|
14
|
-
* state, not by dependency diff, means `update` activates a package that
|
|
15
|
-
* gained its `dsh.bundle` declaration in a newer version.
|
|
16
|
-
* @module @deepseek-ai/dsh/plugin
|
|
17
|
-
*/
|
|
18
|
-
const NAME = "dsh";
|
|
19
|
-
/**
|
|
20
|
-
* Whether a resolved dependency exports a profile patch, i.e. is a bundle.
|
|
21
|
-
* @param packageName - the dependency's package name.
|
|
22
|
-
* @param profileDir - the profile directory (resolution anchor).
|
|
23
|
-
* @returns true when the package manifest declares `dsh.bundle`.
|
|
24
|
-
*/
|
|
25
|
-
function exportsPatch(packageName, profileDir) {
|
|
26
|
-
let dir;
|
|
27
|
-
try {
|
|
28
|
-
dir = resolveBundleDir(NAME, packageName, INSTALL_ANCHOR, profileDir);
|
|
29
|
-
} catch {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
return readProfileManifest(NAME, dir).dsh?.bundle?.patch !== void 0;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Reconcile `dsh.profile.bundles` against the installed state: pnpm has
|
|
36
|
-
* already written the real installed names (so a git/path/tarball/alias spec
|
|
37
|
-
* on the command line reconciles by its true package name) and materialized
|
|
38
|
-
* the packages. A dependency that resolves to a `dsh.bundle`-declaring
|
|
39
|
-
* package joins the layer stack (appended in dependency order); a
|
|
40
|
-
* dependency-listed name that no longer does — removed, or the installed
|
|
41
|
-
* version dropped the declaration — leaves it. In-box bundles from the
|
|
42
|
-
* profile template are not dependencies and are never touched. Warns once
|
|
43
|
-
* per newly-added bundle-less dependency (a plain library is fine; the
|
|
44
|
-
* warning is orientation).
|
|
45
|
-
*/
|
|
46
|
-
function reconcilePlugins(before, profileDir) {
|
|
47
|
-
const after = readProfileManifest(NAME, profileDir);
|
|
48
|
-
const beforeDeps = new Set(Object.keys(before.dependencies ?? {}));
|
|
49
|
-
const dependencies = Object.keys(after.dependencies ?? {});
|
|
50
|
-
const plugins = after.dsh?.profile?.bundles ?? [];
|
|
51
|
-
let changed = false;
|
|
52
|
-
for (const packageName of dependencies) {
|
|
53
|
-
const isBundle = exportsPatch(packageName, profileDir);
|
|
54
|
-
if (isBundle && !plugins.includes(packageName)) {
|
|
55
|
-
plugins.push(packageName);
|
|
56
|
-
changed = true;
|
|
57
|
-
} else if (!isBundle && !beforeDeps.has(packageName)) process.stderr.write(`${NAME}: warning: ${packageName} declares no dsh.bundle — installed as a plain dependency, not a profile layer (a later update that gains one activates it automatically)
|
|
58
|
-
`);
|
|
59
|
-
}
|
|
60
|
-
const dependencySet = new Set(dependencies);
|
|
61
|
-
for (const packageName of [...plugins]) {
|
|
62
|
-
const wasDependency = beforeDeps.has(packageName) || dependencySet.has(packageName);
|
|
63
|
-
const stillBundle = dependencySet.has(packageName) && exportsPatch(packageName, profileDir);
|
|
64
|
-
if (wasDependency && !stillBundle) {
|
|
65
|
-
plugins.splice(plugins.indexOf(packageName), 1);
|
|
66
|
-
changed = true;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (!changed) return;
|
|
70
|
-
after.dsh = {
|
|
71
|
-
...after.dsh,
|
|
72
|
-
profile: {
|
|
73
|
-
...after.dsh?.profile,
|
|
74
|
-
bundles: plugins
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
writeProfileManifest(profileDir, after);
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Rewrite relative filesystem specs against the user's invoking directory.
|
|
81
|
-
* pnpm runs with cwd = the profile directory, so a bare `.` or `../plugin`
|
|
82
|
-
* (or their `file:`/`link:` forms) would silently resolve inside the profile
|
|
83
|
-
* — `add .` from a plugin checkout would self-link the profile. Absolute
|
|
84
|
-
* specs, registry names, and every other pnpm argument pass through
|
|
85
|
-
* untouched.
|
|
86
|
-
* @param argument - one pnpm argument, verbatim from argv.
|
|
87
|
-
* @param cwd - the directory `dsh` was invoked from.
|
|
88
|
-
* @returns the argument with a relative path spec anchored to `cwd`.
|
|
89
|
-
*/
|
|
90
|
-
function anchorPathSpec(argument, cwd) {
|
|
91
|
-
const match = /^(?<prefix>(?:file|link):)?(?<path>\.{1,2}(?:[/\\].*)?)$/.exec(argument);
|
|
92
|
-
if (match?.groups?.path === void 0) return argument;
|
|
93
|
-
return `${match.groups.prefix ?? ""}${resolve(cwd, match.groups.path)}`;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Run one `dsh plugin` invocation: init if needed, forward to pnpm, reconcile.
|
|
97
|
-
* @param profile - the profile name.
|
|
98
|
-
* @param args - pnpm arguments with relative path specs anchored to the invoking directory.
|
|
99
|
-
* @returns the pnpm exit code.
|
|
100
|
-
*/
|
|
101
|
-
function runPlugin(profile, args) {
|
|
102
|
-
const dir = resolveProfileDir(profile);
|
|
103
|
-
if (!existsSync(join(dir, "package.json"))) {
|
|
104
|
-
const template = PROFILE_TEMPLATES[profile];
|
|
105
|
-
initProfile(dir, template?.bundles ?? DEFAULT_PROFILE_BUNDLES, template?.patchReload);
|
|
106
|
-
process.stderr.write(`${NAME}: initialized profile ${profile} at ${dir}\n`);
|
|
107
|
-
}
|
|
108
|
-
const before = readProfileManifest(NAME, dir);
|
|
109
|
-
const result = spawnSync("pnpm", args.map((argument) => anchorPathSpec(argument, process.cwd())), {
|
|
110
|
-
cwd: dir,
|
|
111
|
-
stdio: "inherit",
|
|
112
|
-
shell: process.platform === "win32"
|
|
113
|
-
});
|
|
114
|
-
if (result.error !== void 0) {
|
|
115
|
-
if (result.error.code === "ENOENT") {
|
|
116
|
-
process.stderr.write(`${NAME}: pnpm not found on PATH — install pnpm to manage profile plugins\n`);
|
|
117
|
-
return 127;
|
|
118
|
-
}
|
|
119
|
-
throw result.error;
|
|
120
|
-
}
|
|
121
|
-
const exitCode = result.status ?? 1;
|
|
122
|
-
if (exitCode === 0) reconcilePlugins(before, dir);
|
|
123
|
-
else {
|
|
124
|
-
process.stderr.write(`${NAME}: pnpm failed in profile directory ${dir}\n`);
|
|
125
|
-
if (args.some((argument) => /^git\+|^github:|\.git(?:#|$)/.test(argument))) process.stderr.write(`${NAME}: git-hosted plugins build on install via their prepare script, which pnpm blocks until allowed — add the exact key pnpm printed above under allowBuilds in ${join(dir, "pnpm-workspace.yaml")}, then re-run\n`);
|
|
126
|
-
}
|
|
127
|
-
return exitCode;
|
|
128
|
-
}
|
|
129
|
-
//#endregion
|
|
130
|
-
export { runPlugin };
|