dimcode 0.3.18 → 0.3.19-beta.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.
Files changed (2) hide show
  1. package/bin/dim.mjs +23 -6
  2. package/package.json +6 -6
package/bin/dim.mjs CHANGED
@@ -22,14 +22,17 @@ try {
22
22
  }
23
23
  catch {}
24
24
 
25
- // Inner binary file name shipped inside each platform sub-package's bin/.
26
- // Only needed when the binary basename differs from the wrapper package name
27
- // (goatchain-cli → bin/goatchain). dimcode and dimagent ship a binary named
28
- // after the package, so they fall through to `wrapperName`.
25
+ // Platform package and binary aliases let multiple wrapper names consume one
26
+ // immutable payload. dimagent shares dimcode's packages; goatchain is separate.
29
27
  const BINARY_BASENAMES = {
28
+ 'dimagent': 'dimcode',
30
29
  'goatchain-cli': 'goatchain',
31
30
  }
32
31
  const binaryBasename = BINARY_BASENAMES[wrapperName] || wrapperName
32
+ const PLATFORM_PACKAGE_PREFIXES = {
33
+ 'dimagent': 'dimcode',
34
+ }
35
+ const platformPackagePrefix = PLATFORM_PACKAGE_PREFIXES[wrapperName] || wrapperName
33
36
 
34
37
  const wrapperDir = path.join(__dirname, '..').replace(/\\/g, '/').toLowerCase()
35
38
  const wrapperPm
@@ -64,7 +67,7 @@ async function runOpentui(restArgs) {
64
67
  const archMap = { x64: 'x64', arm64: 'arm64' }
65
68
  const platform = platformMap[os.platform()] || os.platform()
66
69
  const arch = archMap[os.arch()] || os.arch()
67
- const base = wrapperName + '-' + platform + '-' + arch
70
+ const base = platformPackagePrefix + '-' + platform + '-' + arch
68
71
  const binary = platform === 'windows' ? binaryBasename + '.exe' : binaryBasename
69
72
 
70
73
  if (process.env.DIMCODE_DEBUG) {
@@ -240,6 +243,10 @@ function findBinary(startDir, base, binary) {
240
243
  }
241
244
 
242
245
  function spawnBinary(target, forwardedArgs) {
246
+ const cwd = readCurrentDirectory()
247
+ if (!cwd)
248
+ process.exit(2)
249
+
243
250
  const env = {
244
251
  ...process.env,
245
252
  DIMCODE_NPM_PACKAGE: wrapperName,
@@ -251,7 +258,7 @@ function spawnBinary(target, forwardedArgs) {
251
258
 
252
259
  const result = childProcess.spawnSync(target, forwardedArgs, {
253
260
  stdio: 'inherit',
254
- cwd: process.cwd(),
261
+ cwd,
255
262
  env,
256
263
  windowsHide: false,
257
264
  })
@@ -278,3 +285,13 @@ function spawnBinary(target, forwardedArgs) {
278
285
  }
279
286
  process.exit(typeof result.status === 'number' ? result.status : 0)
280
287
  }
288
+
289
+ function readCurrentDirectory() {
290
+ try {
291
+ return process.cwd()
292
+ }
293
+ catch {
294
+ console.error('[dim] The current directory no longer exists or cannot be accessed.')
295
+ console.error('[dim] Change to an existing directory with cd, then run dim again.')
296
+ }
297
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dimcode",
3
- "version": "0.3.18",
3
+ "version": "0.3.19-beta.0",
4
4
  "description": "AI coding agent CLI and terminal coding assistant with an interactive TUI (beta channel)",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,10 +12,10 @@
12
12
  "README.zh.md"
13
13
  ],
14
14
  "optionalDependencies": {
15
- "dimcode-darwin-arm64": "0.3.18",
16
- "dimcode-darwin-x64": "0.3.18",
17
- "dimcode-linux-arm64": "0.3.18",
18
- "dimcode-linux-x64": "0.3.18",
19
- "dimcode-windows-x64": "0.3.18"
15
+ "dimcode-darwin-arm64": "0.3.19-beta.0",
16
+ "dimcode-darwin-x64": "0.3.19-beta.0",
17
+ "dimcode-linux-arm64": "0.3.19-beta.0",
18
+ "dimcode-linux-x64": "0.3.19-beta.0",
19
+ "dimcode-windows-x64": "0.3.19-beta.0"
20
20
  }
21
21
  }