@anthropic-ai/claude-code 2.1.287 → 2.1.288

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.
Files changed (2) hide show
  1. package/install.cjs +30 -4
  2. package/package.json +9 -9
package/install.cjs CHANGED
@@ -5,9 +5,13 @@
5
5
  // and copies it over the bin/claude.exe placeholder. After this runs, `claude` execs
6
6
  // the native binary directly — no Node.js process stays resident.
7
7
  //
8
- // If the native package isn't present (--omit=optional), prints instructions and
9
- // leaves the placeholder stub in place. cli-wrapper.cjs (same directory) can be
10
- // invoked manually as a fallback that keeps working via require.resolve + spawn.
8
+ // If the native package isn't present (or this release channel doesn't ship one
9
+ // for the platform), prints instructions and leaves the placeholder stub in
10
+ // place; builds that set FAIL_ON_MISSING_NATIVE also exit 1 so npm removes the
11
+ // non-working install — and, on an update, puts the previous version back —
12
+ // instead of leaving the stub as `claude` (failInstallUnlessOptionalOmitted).
13
+ // cli-wrapper.cjs (same directory) can be invoked manually as a fallback that
14
+ // keeps working via require.resolve + spawn.
11
15
  //
12
16
  // Platform detection + PLATFORMS map is duplicated in cli-wrapper.cjs — keep in sync.
13
17
 
@@ -27,6 +31,8 @@ const path = require('path')
27
31
  // Replaced at build time via sed. Keep the literals below as markers.
28
32
  const PACKAGE_PREFIX = '@anthropic-ai/claude-code'
29
33
  const BINARY_NAME = 'claude'
34
+ // Substituted to 'true' or 'false'; an unsubstituted marker reads as false.
35
+ const FAIL_ON_MISSING_NATIVE = 'false' === 'true'
30
36
  const WRAPPER_NAME = require('./package.json').name
31
37
 
32
38
  const PLATFORMS = {
@@ -138,6 +144,24 @@ function placeBinary(src, dest) {
138
144
  }
139
145
  }
140
146
 
147
+ // See the header: FAIL_ON_MISSING_NATIVE builds fail an install that cannot
148
+ // produce a working `claude`. A user who passed --omit=optional (or has
149
+ // omit=optional in npmrc) asked for that outcome, so theirs stays soft; npm
150
+ // hands that setting to lifecycle scripts as npm_config_omit (the deprecated
151
+ // optional=false / --no-optional spelling is never exported).
152
+ function failInstallUnlessOptionalOmitted() {
153
+ if (
154
+ !FAIL_ON_MISSING_NATIVE ||
155
+ (process.env.npm_config_omit || '').includes('optional')
156
+ ) {
157
+ return
158
+ }
159
+ console.error(
160
+ ' Failing this install so npm does not leave a non-working claude in place.',
161
+ )
162
+ process.exitCode = 1
163
+ }
164
+
141
165
  function main() {
142
166
  const platformKey = getPlatformKey()
143
167
  const info = PLATFORMS[platformKey]
@@ -165,6 +189,7 @@ function main() {
165
189
  .map(p => p.replace(PACKAGE_PREFIX + '-', ''))
166
190
  .join(', ')}`,
167
191
  )
192
+ failInstallUnlessOptionalOmitted()
168
193
  return
169
194
  }
170
195
 
@@ -194,12 +219,13 @@ function main() {
194
219
  return
195
220
  }
196
221
  console.error(
197
- ' This happens with --omit=optional or when the download failed.',
222
+ ' This happens with --omit=optional or when the download failed; re-run the install to fetch it.',
198
223
  )
199
224
  console.error(
200
225
  ' The `claude` command will print instructions when invoked.',
201
226
  )
202
227
  console.error(' Fallback: node ' + path.join(__dirname, 'cli-wrapper.cjs'))
228
+ failInstallUnlessOptionalOmitted()
203
229
  return
204
230
  }
205
231
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anthropic-ai/claude-code",
3
- "version": "2.1.287",
3
+ "version": "2.1.288",
4
4
  "bin": {
5
5
  "claude": "bin/claude.exe"
6
6
  },
@@ -21,14 +21,14 @@
21
21
  },
22
22
  "dependencies": {},
23
23
  "optionalDependencies": {
24
- "@anthropic-ai/claude-code-darwin-arm64": "2.1.287",
25
- "@anthropic-ai/claude-code-darwin-x64": "2.1.287",
26
- "@anthropic-ai/claude-code-linux-x64": "2.1.287",
27
- "@anthropic-ai/claude-code-linux-arm64": "2.1.287",
28
- "@anthropic-ai/claude-code-linux-x64-musl": "2.1.287",
29
- "@anthropic-ai/claude-code-linux-arm64-musl": "2.1.287",
30
- "@anthropic-ai/claude-code-win32-x64": "2.1.287",
31
- "@anthropic-ai/claude-code-win32-arm64": "2.1.287"
24
+ "@anthropic-ai/claude-code-darwin-arm64": "2.1.288",
25
+ "@anthropic-ai/claude-code-darwin-x64": "2.1.288",
26
+ "@anthropic-ai/claude-code-linux-x64": "2.1.288",
27
+ "@anthropic-ai/claude-code-linux-arm64": "2.1.288",
28
+ "@anthropic-ai/claude-code-linux-x64-musl": "2.1.288",
29
+ "@anthropic-ai/claude-code-linux-arm64-musl": "2.1.288",
30
+ "@anthropic-ai/claude-code-win32-x64": "2.1.288",
31
+ "@anthropic-ai/claude-code-win32-arm64": "2.1.288"
32
32
  },
33
33
  "files": [
34
34
  "bin/claude.exe",