@mclean-capital/neura 2.1.1 → 2.1.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/core/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.1.
|
|
1
|
+
2.1.2
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAqDA;;;;;GAKG;AACH,wBAAsB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CA+GnD"}
|
package/dist/commands/update.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
import { spawnSync } from 'child_process';
|
|
2
|
+
import { execSync, spawnSync } from 'child_process';
|
|
3
3
|
import { existsSync } from 'fs';
|
|
4
4
|
import { join } from 'path';
|
|
5
5
|
import { CLI_VERSION } from '../version.js';
|
|
@@ -22,19 +22,33 @@ const PACKAGE_NAME = '@mclean-capital/neura';
|
|
|
22
22
|
* install layout); the caller falls back to printing a manual instruction.
|
|
23
23
|
*/
|
|
24
24
|
function resolveFreshCliEntrypoint() {
|
|
25
|
+
// We use execSync rather than spawnSync here to avoid DEP0190. The npm
|
|
26
|
+
// CLI on Windows is `npm.cmd` (a shell-script wrapper), and spawning
|
|
27
|
+
// `.cmd`/`.bat` files on Windows requires `shell: true` (CVE-2024-27980).
|
|
28
|
+
// But `spawnSync(cmd, args, { shell: true })` is deprecated in Node 22+
|
|
29
|
+
// because the args are concatenated into the shell command string
|
|
30
|
+
// without escaping. execSync with a single pre-joined command string
|
|
31
|
+
// sidesteps both problems — and because every token in this command is
|
|
32
|
+
// a hardcoded constant, there's no injection surface.
|
|
25
33
|
const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
try {
|
|
35
|
+
const stdout = execSync(`${npmCmd} root -g`, {
|
|
36
|
+
encoding: 'utf-8',
|
|
37
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
38
|
+
});
|
|
39
|
+
const globalRoot = stdout.trim();
|
|
40
|
+
if (!globalRoot)
|
|
41
|
+
return null;
|
|
42
|
+
// npm packages with scopes live at <root>/@scope/name/
|
|
43
|
+
const candidate = join(globalRoot, PACKAGE_NAME, 'dist', 'index.js');
|
|
44
|
+
return existsSync(candidate) ? candidate : null;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
// `npm` not on PATH, `npm root -g` exited non-zero, or the candidate
|
|
48
|
+
// path isn't where we expected — caller falls back to manual
|
|
49
|
+
// instructions.
|
|
34
50
|
return null;
|
|
35
|
-
|
|
36
|
-
const candidate = join(globalRoot, PACKAGE_NAME, 'dist', 'index.js');
|
|
37
|
-
return existsSync(candidate) ? candidate : null;
|
|
51
|
+
}
|
|
38
52
|
}
|
|
39
53
|
/**
|
|
40
54
|
* Update Neura by reinstalling the npm package and restarting the core service.
|
|
@@ -77,13 +91,17 @@ export async function updateCommand() {
|
|
|
77
91
|
// want to run `npm install -g` and re-register the service below. Both
|
|
78
92
|
// operations are idempotent and fast when nothing actually changes.
|
|
79
93
|
const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
|
80
|
-
|
|
94
|
+
const installCmd = `${npmCmd} install -g ${PACKAGE_NAME}@latest`;
|
|
95
|
+
console.log(chalk.dim(` Running: ${installCmd}`));
|
|
81
96
|
console.log();
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
97
|
+
// Same DEP0190 reasoning as `resolveFreshCliEntrypoint` above: use
|
|
98
|
+
// execSync with a single pre-joined command string rather than
|
|
99
|
+
// `spawnSync(cmd, args, { shell: true })`. All three tokens in this
|
|
100
|
+
// string are hardcoded constants — no injection surface.
|
|
101
|
+
try {
|
|
102
|
+
execSync(installCmd, { stdio: 'inherit' });
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
87
105
|
console.log();
|
|
88
106
|
console.log(chalk.red(' ✗ npm install failed. Check your network connection and try running the\n' +
|
|
89
107
|
' command above manually.'));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,MAAM,YAAY,GAAG,uBAAuB,CAAC;AAE7C;;;;;;;;;;;;;;;GAeG;AACH,SAAS,yBAAyB;IAChC,uEAAuE;IACvE,qEAAqE;IACrE,0EAA0E;IAC1E,wEAAwE;IACxE,kEAAkE;IAClE,qEAAqE;IACrE,uEAAuE;IACvE,sDAAsD;IACtD,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC;IAChE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,MAAM,UAAU,EAAE;YAC3C,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,CAAC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