clew-code 0.3.6 → 0.4.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 +118 -320
- package/dist/main.js +2602 -2775
- package/package.json +161 -166
- package/scripts/bun-run.mjs +1 -1
- package/scripts/install.ps1 +129 -21
package/package.json
CHANGED
|
@@ -1,166 +1,161 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "clew-code",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "ClewCode — multi-provider AI coding agent CLI",
|
|
5
|
-
"main": "./dist/main.js",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"bin": {
|
|
8
|
-
"clew": "bin/clew.cjs",
|
|
9
|
-
"clewcode": "bin/clew.cjs"
|
|
10
|
-
},
|
|
11
|
-
"files": [
|
|
12
|
-
"bin/",
|
|
13
|
-
"dist/",
|
|
14
|
-
"docs/",
|
|
15
|
-
"scripts/",
|
|
16
|
-
"README.md",
|
|
17
|
-
"LICENSE.md"
|
|
18
|
-
],
|
|
19
|
-
"repository": {
|
|
20
|
-
"type": "git",
|
|
21
|
-
"url": "git+https://github.com/ClewCode/ClewCode.git"
|
|
22
|
-
},
|
|
23
|
-
"bugs": {
|
|
24
|
-
"url": "https://github.com/ClewCode/ClewCode/issues"
|
|
25
|
-
},
|
|
26
|
-
"homepage": "https://github.com/ClewCode/ClewCode#readme",
|
|
27
|
-
"scripts": {
|
|
28
|
-
"prebuild-version": "node scripts/prebuild-version.mjs",
|
|
29
|
-
"dev": "bun run prebuild-version && node scripts/bun-run.mjs --watch",
|
|
30
|
-
"start": "bun run prebuild-version && node scripts/bun-run.mjs",
|
|
31
|
-
"dev:channels": "bun run prebuild-version && node scripts/bun-run.mjs -- --dangerously-load-development-channels server:clew-orc",
|
|
32
|
-
"build": "bun run prebuild-version && NODE_ENV=production bun build --production --define.TRANSCRIPT_CLASSIFIER=true --define.CHICAGO_MCP=true --define.VOICE_MODE=true src/main.tsx --outdir ./dist --target bun --external electron --external 'chromium-bidi*' --external '@ant/claude-for-chrome-mcp' --external '@anthropic-ai/bedrock-sdk' --external '@anthropic-ai/foundry-sdk' --external '@anthropic-ai/vertex-sdk' --external '@anthropic-ai/mcpb' --external '@aws-sdk/client-bedrock-runtime' --external 'google-auth-library' --external 'sharp' --external 'asciichart' --external 'audio-capture-napi' --external 'modifiers-napi' --external '@xenova/transformers' --external 'onnxruntime-node' --external playwright --external 'playwright-core' --external 'node-pty' && node scripts/postbuild-inject-macro.mjs",
|
|
33
|
-
"prepublishOnly": "bun run build",
|
|
34
|
-
"test": "bun test",
|
|
35
|
-
"lint": "biome lint --write src/",
|
|
36
|
-
"lint:check": "biome lint src/",
|
|
37
|
-
"format": "biome format --write src/",
|
|
38
|
-
"format:check": "biome format src/",
|
|
39
|
-
"check": "biome check --write src/",
|
|
40
|
-
"check:ci": "biome ci src/",
|
|
41
|
-
"ast-grep": "bun x ast-grep",
|
|
42
|
-
"codegraph": "bun run scripts/codegraph.ts",
|
|
43
|
-
"docs:generate": "bun run scripts/generate-docs.ts",
|
|
44
|
-
"docs:watch": "bun --watch run scripts/generate-docs.ts",
|
|
45
|
-
"preload": "bun run scripts/preload.ts",
|
|
46
|
-
"session": "bun run scripts/session.ts",
|
|
47
|
-
"relay": "bun run src/remote/relay-server.ts",
|
|
48
|
-
"install:unix": "bash scripts/install.sh",
|
|
49
|
-
"install:win": "powershell -ExecutionPolicy Bypass -File scripts/install.ps1"
|
|
50
|
-
},
|
|
51
|
-
"keywords": [
|
|
52
|
-
"ai",
|
|
53
|
-
"coding-assistant",
|
|
54
|
-
"anthropic",
|
|
55
|
-
"openai",
|
|
56
|
-
"google",
|
|
57
|
-
"gemini",
|
|
58
|
-
"claude",
|
|
59
|
-
"gpt",
|
|
60
|
-
"openrouter",
|
|
61
|
-
"kilocode",
|
|
62
|
-
"opencode"
|
|
63
|
-
],
|
|
64
|
-
"author": "Dek1milliontoken",
|
|
65
|
-
"license": "SEE LICENSE.md",
|
|
66
|
-
"dependencies": {
|
|
67
|
-
"@agentclientprotocol/sdk": "^0.
|
|
68
|
-
"@ai-sdk/anthropic": "^3.0.
|
|
69
|
-
"@ai-sdk/google": "^3.0.
|
|
70
|
-
"@ai-sdk/openai": "^3.0.
|
|
71
|
-
"@anthropic-ai/sandbox-runtime": "0.0.
|
|
72
|
-
"@anthropic-ai/sdk": "^0.104.
|
|
73
|
-
"@aws-sdk/client-bedrock": "^3.
|
|
74
|
-
"@aws-sdk/client-sts": "^3.
|
|
75
|
-
"@azure/identity": "^4.13.1",
|
|
76
|
-
"@commander-js/extra-typings": "^15.0.0",
|
|
77
|
-
"@google/generative-ai": "0.24.1",
|
|
78
|
-
"@growthbook/growthbook": "^1.6.5",
|
|
79
|
-
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
80
|
-
"@openrouter/ai-sdk-provider": "^2.9.1",
|
|
81
|
-
"@opentelemetry/api": "^1.9.1",
|
|
82
|
-
"@opentelemetry/exporter-logs-otlp-grpc": "^0.219.0",
|
|
83
|
-
"@opentelemetry/exporter-logs-otlp-http": "^0.219.0",
|
|
84
|
-
"@opentelemetry/exporter-logs-otlp-proto": "^0.219.0",
|
|
85
|
-
"@opentelemetry/exporter-metrics-otlp-grpc": "^0.219.0",
|
|
86
|
-
"@opentelemetry/exporter-metrics-otlp-http": "^0.219.0",
|
|
87
|
-
"@opentelemetry/exporter-metrics-otlp-proto": "^0.219.0",
|
|
88
|
-
"@opentelemetry/exporter-prometheus": "^0.219.0",
|
|
89
|
-
"@opentelemetry/exporter-trace-otlp-grpc": "^0.219.0",
|
|
90
|
-
"@opentelemetry/exporter-trace-otlp-http": "^0.219.0",
|
|
91
|
-
"@opentelemetry/exporter-trace-otlp-proto": "^0.219.0",
|
|
92
|
-
"@opentelemetry/resources": "2.8.0",
|
|
93
|
-
"@opentelemetry/sdk-logs": "^0.219.0",
|
|
94
|
-
"@opentelemetry/sdk-metrics": "2.8.0",
|
|
95
|
-
"@opentelemetry/sdk-node": "^0.219.0",
|
|
96
|
-
"@opentelemetry/sdk-trace-base": "2.8.0",
|
|
97
|
-
"@opentelemetry/sdk-trace-node": "2.8.0",
|
|
98
|
-
"@opentelemetry/semantic-conventions": "1.41.1",
|
|
99
|
-
"@sentry/node": "^10.
|
|
100
|
-
"@types/react": "^19.2.17",
|
|
101
|
-
"@types/react-dom": "^19.2.3",
|
|
102
|
-
"@types/ws": "^8.18.1",
|
|
103
|
-
"@xenova/transformers": "^2.17.2",
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"bidi-js": "1.0.3",
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
"
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"ink": "^
|
|
120
|
-
"ink-
|
|
121
|
-
"ink-
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"
|
|
125
|
-
"
|
|
126
|
-
"
|
|
127
|
-
"
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
"
|
|
131
|
-
"
|
|
132
|
-
"
|
|
133
|
-
"
|
|
134
|
-
"
|
|
135
|
-
"
|
|
136
|
-
"
|
|
137
|
-
"
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
"
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
"
|
|
144
|
-
"
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
"
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
"
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
"
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
"@types/lodash-es": "^4.17.12",
|
|
163
|
-
"@types/semver": "^7.7.1"
|
|
164
|
-
},
|
|
165
|
-
"optionalDependencies": {}
|
|
166
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "clew-code",
|
|
3
|
+
"version": "0.4.1",
|
|
4
|
+
"description": "ClewCode — multi-provider AI coding agent CLI",
|
|
5
|
+
"main": "./dist/main.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"clew": "bin/clew.cjs",
|
|
9
|
+
"clewcode": "bin/clew.cjs"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"bin/",
|
|
13
|
+
"dist/",
|
|
14
|
+
"docs/",
|
|
15
|
+
"scripts/",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE.md"
|
|
18
|
+
],
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/ClewCode/ClewCode.git"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/ClewCode/ClewCode/issues"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/ClewCode/ClewCode#readme",
|
|
27
|
+
"scripts": {
|
|
28
|
+
"prebuild-version": "node scripts/prebuild-version.mjs",
|
|
29
|
+
"dev": "bun run prebuild-version && node scripts/bun-run.mjs --watch",
|
|
30
|
+
"start": "bun run prebuild-version && node scripts/bun-run.mjs",
|
|
31
|
+
"dev:channels": "bun run prebuild-version && node scripts/bun-run.mjs -- --dangerously-load-development-channels server:clew-orc",
|
|
32
|
+
"build": "bun run prebuild-version && NODE_ENV=production bun build --production --define.TRANSCRIPT_CLASSIFIER=true --define.CHICAGO_MCP=true --define.VOICE_MODE=true --define.AWAY_SUMMARY=true src/main.tsx --outdir ./dist --target bun --external electron --external 'chromium-bidi*' --external '@ant/claude-for-chrome-mcp' --external '@anthropic-ai/bedrock-sdk' --external '@anthropic-ai/foundry-sdk' --external '@anthropic-ai/vertex-sdk' --external '@anthropic-ai/mcpb' --external '@aws-sdk/client-bedrock-runtime' --external 'google-auth-library' --external 'sharp' --external 'asciichart' --external 'audio-capture-napi' --external 'modifiers-napi' --external '@xenova/transformers' --external 'onnxruntime-node' --external playwright --external 'playwright-core' --external 'node-pty' && node scripts/postbuild-inject-macro.mjs",
|
|
33
|
+
"prepublishOnly": "bun run build",
|
|
34
|
+
"test": "bun test",
|
|
35
|
+
"lint": "biome lint --write src/",
|
|
36
|
+
"lint:check": "biome lint src/",
|
|
37
|
+
"format": "biome format --write src/",
|
|
38
|
+
"format:check": "biome format src/",
|
|
39
|
+
"check": "biome check --write src/",
|
|
40
|
+
"check:ci": "biome ci src/",
|
|
41
|
+
"ast-grep": "bun x ast-grep",
|
|
42
|
+
"codegraph": "bun run scripts/codegraph.ts",
|
|
43
|
+
"docs:generate": "bun run scripts/generate-docs.ts",
|
|
44
|
+
"docs:watch": "bun --watch run scripts/generate-docs.ts",
|
|
45
|
+
"preload": "bun run scripts/preload.ts",
|
|
46
|
+
"session": "bun run scripts/session.ts",
|
|
47
|
+
"relay": "bun run src/remote/relay-server.ts",
|
|
48
|
+
"install:unix": "bash scripts/install.sh",
|
|
49
|
+
"install:win": "powershell -ExecutionPolicy Bypass -File scripts/install.ps1"
|
|
50
|
+
},
|
|
51
|
+
"keywords": [
|
|
52
|
+
"ai",
|
|
53
|
+
"coding-assistant",
|
|
54
|
+
"anthropic",
|
|
55
|
+
"openai",
|
|
56
|
+
"google",
|
|
57
|
+
"gemini",
|
|
58
|
+
"claude",
|
|
59
|
+
"gpt",
|
|
60
|
+
"openrouter",
|
|
61
|
+
"kilocode",
|
|
62
|
+
"opencode"
|
|
63
|
+
],
|
|
64
|
+
"author": "Dek1milliontoken",
|
|
65
|
+
"license": "SEE LICENSE.md",
|
|
66
|
+
"dependencies": {
|
|
67
|
+
"@agentclientprotocol/sdk": "^0.29.0",
|
|
68
|
+
"@ai-sdk/anthropic": "^3.0.86",
|
|
69
|
+
"@ai-sdk/google": "^3.0.83",
|
|
70
|
+
"@ai-sdk/openai": "^3.0.74",
|
|
71
|
+
"@anthropic-ai/sandbox-runtime": "0.0.59",
|
|
72
|
+
"@anthropic-ai/sdk": "^0.104.2",
|
|
73
|
+
"@aws-sdk/client-bedrock": "^3.1075.0",
|
|
74
|
+
"@aws-sdk/client-sts": "^3.1075.0",
|
|
75
|
+
"@azure/identity": "^4.13.1",
|
|
76
|
+
"@commander-js/extra-typings": "^15.0.0",
|
|
77
|
+
"@google/generative-ai": "0.24.1",
|
|
78
|
+
"@growthbook/growthbook": "^1.6.5",
|
|
79
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
80
|
+
"@openrouter/ai-sdk-provider": "^2.9.1",
|
|
81
|
+
"@opentelemetry/api": "^1.9.1",
|
|
82
|
+
"@opentelemetry/exporter-logs-otlp-grpc": "^0.219.0",
|
|
83
|
+
"@opentelemetry/exporter-logs-otlp-http": "^0.219.0",
|
|
84
|
+
"@opentelemetry/exporter-logs-otlp-proto": "^0.219.0",
|
|
85
|
+
"@opentelemetry/exporter-metrics-otlp-grpc": "^0.219.0",
|
|
86
|
+
"@opentelemetry/exporter-metrics-otlp-http": "^0.219.0",
|
|
87
|
+
"@opentelemetry/exporter-metrics-otlp-proto": "^0.219.0",
|
|
88
|
+
"@opentelemetry/exporter-prometheus": "^0.219.0",
|
|
89
|
+
"@opentelemetry/exporter-trace-otlp-grpc": "^0.219.0",
|
|
90
|
+
"@opentelemetry/exporter-trace-otlp-http": "^0.219.0",
|
|
91
|
+
"@opentelemetry/exporter-trace-otlp-proto": "^0.219.0",
|
|
92
|
+
"@opentelemetry/resources": "2.8.0",
|
|
93
|
+
"@opentelemetry/sdk-logs": "^0.219.0",
|
|
94
|
+
"@opentelemetry/sdk-metrics": "2.8.0",
|
|
95
|
+
"@opentelemetry/sdk-node": "^0.219.0",
|
|
96
|
+
"@opentelemetry/sdk-trace-base": "2.8.0",
|
|
97
|
+
"@opentelemetry/sdk-trace-node": "2.8.0",
|
|
98
|
+
"@opentelemetry/semantic-conventions": "1.41.1",
|
|
99
|
+
"@sentry/node": "^10.60.0",
|
|
100
|
+
"@types/react": "^19.2.17",
|
|
101
|
+
"@types/react-dom": "^19.2.3",
|
|
102
|
+
"@types/ws": "^8.18.1",
|
|
103
|
+
"@xenova/transformers": "^2.17.2",
|
|
104
|
+
"ansis": "^4.3.1",
|
|
105
|
+
"asciichart": "^1.5.25",
|
|
106
|
+
"bidi-js": "1.0.3",
|
|
107
|
+
"chokidar": "5.0.0",
|
|
108
|
+
"commander": "^15.0.0",
|
|
109
|
+
"conf": "^15.1.0",
|
|
110
|
+
"diff": "^9.0.0",
|
|
111
|
+
"dotenv": "^17.4.2",
|
|
112
|
+
"fflate": "^0.8.3",
|
|
113
|
+
"fuse.js": "^7.4.2",
|
|
114
|
+
"https-proxy-agent": "^9.1.0",
|
|
115
|
+
"ignore": "^7.0.5",
|
|
116
|
+
"ink": "^7.1.0",
|
|
117
|
+
"ink-divider": "^4.1.1",
|
|
118
|
+
"ink-markdown": "^1.0.4",
|
|
119
|
+
"ink-select-input": "^6.2.0",
|
|
120
|
+
"ink-spinner": "^5.0.0",
|
|
121
|
+
"ink-text-input": "^6.0.0",
|
|
122
|
+
"is-docker": "^4.0.0",
|
|
123
|
+
"is-wsl": "^3.1.1",
|
|
124
|
+
"jsonc-parser": "^3.3.1",
|
|
125
|
+
"jsonrepair": "^3.14.0",
|
|
126
|
+
"lru-cache": "^11.5.1",
|
|
127
|
+
"lucide-react": "^1.21.0",
|
|
128
|
+
"nano-spawn": "^2.1.0",
|
|
129
|
+
"node-pty": "^1.1.0",
|
|
130
|
+
"ofetch": "^1.5.1",
|
|
131
|
+
"open": "^11.0.0",
|
|
132
|
+
"openai": "^6.44.0",
|
|
133
|
+
"p-map": "^7.0.4",
|
|
134
|
+
"picomatch": "^4.0.4",
|
|
135
|
+
"playwright": "^1.61.1",
|
|
136
|
+
"proper-lockfile": "^4.1.2",
|
|
137
|
+
"qrcode": "^1.5.4",
|
|
138
|
+
"react": "^19.2.7",
|
|
139
|
+
"react-dom": "^19.2.7",
|
|
140
|
+
"react-markdown": "^10.1.0",
|
|
141
|
+
"react-reconciler": "0.33.0",
|
|
142
|
+
"shell-quote": "^1.8.4",
|
|
143
|
+
"signal-exit": "^4.1.0",
|
|
144
|
+
"tree-kill": "^1.2.2",
|
|
145
|
+
"turndown": "^7.2.4",
|
|
146
|
+
"usehooks-ts": "^3.1.1",
|
|
147
|
+
"vscode-jsonrpc": "^9.0.0",
|
|
148
|
+
"xss": "^1.0.15",
|
|
149
|
+
"zod": "^4.4.3"
|
|
150
|
+
},
|
|
151
|
+
"overrides": {
|
|
152
|
+
"react-reconciler": "0.33.0"
|
|
153
|
+
},
|
|
154
|
+
"devDependencies": {
|
|
155
|
+
"@ast-grep/cli": "^0.44.0",
|
|
156
|
+
"@biomejs/biome": "^2.5.1",
|
|
157
|
+
"@types/bun": "latest",
|
|
158
|
+
"@types/semver": "^7.7.1"
|
|
159
|
+
},
|
|
160
|
+
"optionalDependencies": {}
|
|
161
|
+
}
|
package/scripts/bun-run.mjs
CHANGED
|
@@ -25,7 +25,7 @@ const macroJson = JSON.stringify({
|
|
|
25
25
|
ISSUES_EXPLAINER: 'visit https://github.com/ClewCode/ClewCode/issues',
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
const args = ['run', '--define', `MACRO:${macroJson}
|
|
28
|
+
const args = ['run', '--define', `MACRO:${macroJson}`, '--define.AWAY_SUMMARY=true'];
|
|
29
29
|
if (isWatch) args.push('--watch');
|
|
30
30
|
args.push(join(root, 'src/main.tsx'), ...extraArgs);
|
|
31
31
|
|
package/scripts/install.ps1
CHANGED
|
@@ -1,40 +1,148 @@
|
|
|
1
1
|
#!/usr/bin/env pwsh
|
|
2
2
|
#Requires -PSEdition Desktop
|
|
3
|
-
#Requires -RunAsAdministrator
|
|
4
3
|
|
|
5
4
|
$ErrorActionPreference = 'Stop'
|
|
6
5
|
|
|
7
|
-
function Write-Info
|
|
8
|
-
function Write-Warn
|
|
9
|
-
function Write-
|
|
6
|
+
function Write-Info { Write-Host "[OK] $($args -join ' ')" -ForegroundColor Green }
|
|
7
|
+
function Write-Warn { Write-Host "[!] $($args -join ' ')" -ForegroundColor Yellow }
|
|
8
|
+
function Write-Fail {
|
|
9
|
+
Write-Host "[X] $($args -join ' ')" -ForegroundColor Red
|
|
10
|
+
exit 1
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function Split-PathList([string]$PathValue) {
|
|
14
|
+
if ([string]::IsNullOrWhiteSpace($PathValue)) {
|
|
15
|
+
return @()
|
|
16
|
+
}
|
|
17
|
+
return $PathValue.Split([IO.Path]::PathSeparator) |
|
|
18
|
+
Where-Object { -not [string]::IsNullOrWhiteSpace($_) } |
|
|
19
|
+
ForEach-Object { $_.Trim().Trim('"').TrimEnd('\') }
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function Test-PathListContains([string]$PathValue, [string]$Needle) {
|
|
23
|
+
if ([string]::IsNullOrWhiteSpace($Needle)) {
|
|
24
|
+
return $false
|
|
25
|
+
}
|
|
26
|
+
$normalizedNeedle = $Needle.Trim().Trim('"').TrimEnd('\')
|
|
27
|
+
foreach ($entry in (Split-PathList $PathValue)) {
|
|
28
|
+
if ([string]::Equals($entry, $normalizedNeedle, [StringComparison]::OrdinalIgnoreCase)) {
|
|
29
|
+
return $true
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return $false
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function Get-BunGlobalBin {
|
|
36
|
+
try {
|
|
37
|
+
$bin = (& bun pm bin -g 2>$null | Select-Object -First 1).Trim()
|
|
38
|
+
if (-not [string]::IsNullOrWhiteSpace($bin)) {
|
|
39
|
+
return $bin
|
|
40
|
+
}
|
|
41
|
+
} catch {
|
|
42
|
+
# Fall through to Bun's default Windows global bin.
|
|
43
|
+
}
|
|
44
|
+
return (Join-Path $env:USERPROFILE '.bun\bin')
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function Get-ClewCommandPath([string]$BinDir) {
|
|
48
|
+
$command = Get-Command clew -ErrorAction SilentlyContinue
|
|
49
|
+
if ($command) {
|
|
50
|
+
return $command.Source
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
foreach ($name in @('clew.cmd', 'clew.exe', 'clew')) {
|
|
54
|
+
$candidate = Join-Path $BinDir $name
|
|
55
|
+
if (Test-Path $candidate) {
|
|
56
|
+
return $candidate
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return $null
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function Get-ClewVersion([string]$CommandPath) {
|
|
64
|
+
if ([string]::IsNullOrWhiteSpace($CommandPath)) {
|
|
65
|
+
return 'unknown'
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
$versionOutput = (& $CommandPath --version 2>$null | Select-Object -First 1).Trim()
|
|
70
|
+
if (-not [string]::IsNullOrWhiteSpace($versionOutput)) {
|
|
71
|
+
return $versionOutput
|
|
72
|
+
}
|
|
73
|
+
} catch {
|
|
74
|
+
# Keep installer completion non-fatal if version probing fails.
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return 'unknown'
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
Write-Host 'Setting up Clew Code...'
|
|
81
|
+
Write-Host ''
|
|
10
82
|
|
|
11
|
-
# ── Install bun if missing ───────────────────────────────────────────────────
|
|
12
83
|
if (-not (Get-Command bun -ErrorAction SilentlyContinue)) {
|
|
13
|
-
Write-Info 'Bun not found
|
|
84
|
+
Write-Info 'Bun not found - installing...'
|
|
14
85
|
try {
|
|
15
|
-
$null = & powershell -NoProfile -Command
|
|
86
|
+
$null = & powershell -NoProfile -Command 'irm bun.sh/install.ps1 | iex' 2>&1
|
|
16
87
|
} catch {
|
|
17
|
-
Write-
|
|
88
|
+
Write-Fail "Bun install failed: $($_.Exception.Message)"
|
|
18
89
|
}
|
|
19
|
-
|
|
90
|
+
|
|
20
91
|
$env:Path = [Environment]::GetEnvironmentVariable('Path', 'User') +
|
|
21
|
-
|
|
92
|
+
[IO.Path]::PathSeparator +
|
|
93
|
+
[Environment]::GetEnvironmentVariable('Path', 'Machine')
|
|
94
|
+
|
|
95
|
+
$bunDefaultBin = Join-Path $env:USERPROFILE '.bun\bin'
|
|
96
|
+
if (-not (Test-PathListContains $env:Path $bunDefaultBin)) {
|
|
97
|
+
$env:Path = "$bunDefaultBin$([IO.Path]::PathSeparator)$env:Path"
|
|
98
|
+
}
|
|
99
|
+
|
|
22
100
|
if (-not (Get-Command bun -ErrorAction SilentlyContinue)) {
|
|
23
|
-
Write-
|
|
101
|
+
Write-Fail 'Bun installed but was not found in PATH. Restart your shell and try again.'
|
|
24
102
|
}
|
|
25
|
-
Write-Info "Bun $(& bun --version) installed"
|
|
26
|
-
} else {
|
|
27
|
-
Write-Info "Bun $(& bun --version) found"
|
|
28
103
|
}
|
|
29
104
|
|
|
30
|
-
|
|
31
|
-
Write-Info 'Installing clew-code via
|
|
105
|
+
Write-Info "Bun $(& bun --version) found"
|
|
106
|
+
Write-Info 'Installing clew-code via Bun...'
|
|
107
|
+
|
|
32
108
|
# --ignore-scripts skips sharp (from @xenova/transformers) install script,
|
|
33
|
-
# which
|
|
34
|
-
#
|
|
109
|
+
# which is only needed for image/ComputerUse features and can fail on machines
|
|
110
|
+
# without native build tooling.
|
|
35
111
|
& bun install -g clew-code --ignore-scripts
|
|
36
112
|
|
|
37
|
-
|
|
113
|
+
$bunGlobalBin = Get-BunGlobalBin
|
|
114
|
+
if (-not (Test-PathListContains $env:Path $bunGlobalBin)) {
|
|
115
|
+
$env:Path = "$bunGlobalBin$([IO.Path]::PathSeparator)$env:Path"
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
$clewPath = Get-ClewCommandPath $bunGlobalBin
|
|
119
|
+
if ([string]::IsNullOrWhiteSpace($clewPath)) {
|
|
120
|
+
Write-Fail "clew-code installed, but the clew command was not found in $bunGlobalBin."
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
$clewVersion = Get-ClewVersion $clewPath
|
|
124
|
+
|
|
125
|
+
Write-Host ''
|
|
126
|
+
Write-Host 'Clew Code successfully installed!' -ForegroundColor Green
|
|
127
|
+
Write-Host ''
|
|
128
|
+
Write-Host " Version: $clewVersion"
|
|
129
|
+
Write-Host " Location: $clewPath"
|
|
130
|
+
Write-Host ''
|
|
131
|
+
Write-Host ' Next: Run clew --help to get started'
|
|
132
|
+
Write-Host ''
|
|
133
|
+
|
|
134
|
+
$userPath = [Environment]::GetEnvironmentVariable('Path', 'User')
|
|
135
|
+
$machinePath = [Environment]::GetEnvironmentVariable('Path', 'Machine')
|
|
136
|
+
$isOnPermanentPath =
|
|
137
|
+
(Test-PathListContains $userPath $bunGlobalBin) -or
|
|
138
|
+
(Test-PathListContains $machinePath $bunGlobalBin)
|
|
139
|
+
|
|
140
|
+
if (-not $isOnPermanentPath) {
|
|
141
|
+
Write-Warn 'Setup notes:'
|
|
142
|
+
Write-Host " - Native installation exists but $bunGlobalBin is not in your PATH."
|
|
143
|
+
Write-Host ' Add it via System Properties -> Environment Variables -> User PATH -> New.'
|
|
144
|
+
Write-Host ' Then restart your terminal.'
|
|
145
|
+
Write-Host ''
|
|
146
|
+
}
|
|
38
147
|
|
|
39
|
-
|
|
40
|
-
Start-Process pwsh -ArgumentList "-NoExit", "clew"
|
|
148
|
+
Write-Host 'Installation complete!' -ForegroundColor Green
|