@sdlcai/setup 0.3.3 → 0.3.7

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/cli.mjs +23 -3
  2. package/package.json +1 -1
package/bin/cli.mjs CHANGED
@@ -21,7 +21,8 @@ const SCOPE = '@avanade-region-iceg';
21
21
  const ASSETS = {
22
22
  'ava-custom-agents': { pkg: '@avanade-region-iceg/ava-agents', args: ['install'], label: 'AVA custom agents' },
23
23
  'ava-agents': { pkg: '@avanade-region-iceg/ava-agents', args: ['install'], label: 'AVA custom agents' },
24
- 'mnemo': { pkg: '@avanade-region-iceg/mnemo-setup', args: [], label: 'mnemo (memory)' },
24
+ 'mnemo': { pkg: '@avanade-region-iceg/mnemo-setup', args: [], label: 'mnemo (AVA memory)' },
25
+ 'ava-mem': { pkg: '@avanade-region-iceg/mnemo-setup', args: [], label: 'mnemo (AVA memory)' },
25
26
  'gh-mnemo': { pkg: '@avanade-region-iceg/gh-mnemo', args: [], label: 'mnemo gh extension' },
26
27
  };
27
28
 
@@ -108,6 +109,11 @@ Examples:
108
109
  function main() {
109
110
  const argv = process.argv.slice(2);
110
111
  const asset = argv[0];
112
+ if (asset === '--version' || asset === '-v') {
113
+ const { version } = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
114
+ console.log(version);
115
+ process.exit(0);
116
+ }
111
117
  if (!asset || asset === '-h' || asset === '--help') help(asset ? 0 : 1);
112
118
 
113
119
  const target = ASSETS[asset];
@@ -123,8 +129,22 @@ function main() {
123
129
  configureNpmAuth(token);
124
130
 
125
131
  info(`\n→ Installing ${target.label} (${target.pkg})…\n`);
126
- const r = run('npx', ['--yes', target.pkg, ...target.args, ...passthrough]);
127
- process.exit(r.status ?? 0);
132
+ // Install to a known dir then invoke the bin file directly with node.
133
+ // Avoids the Windows cmd.exe PATH issue where npx / npm-exec cannot
134
+ // resolve the temporary .bin wrapper after a nested shell spawn.
135
+ const installDir = join(homedir(), '.sdlcai', target.pkg.replace(/[@/]/g, '-'));
136
+ const r1 = run('npm', ['install', '--prefix', installDir, '--no-save', '--no-audit', '--no-fund', target.pkg]);
137
+ if (r1.status !== 0) die(`Failed to install ${target.pkg}.`);
138
+ const pkgJsonPath = join(installDir, 'node_modules', ...target.pkg.split('/'), 'package.json');
139
+ const pkgMeta = JSON.parse(readFileSync(pkgJsonPath, 'utf8'));
140
+ const binMap = typeof pkgMeta.bin === 'string'
141
+ ? { [pkgMeta.name.replace(/^@[^/]+\//, '')]: pkgMeta.bin }
142
+ : (pkgMeta.bin || {});
143
+ const binRel = Object.values(binMap)[0];
144
+ if (!binRel) die(`No binary declared in ${target.pkg}.`);
145
+ const binAbs = join(installDir, 'node_modules', ...target.pkg.split('/'), ...binRel.split('/'));
146
+ const r2 = spawnSync(process.execPath, [binAbs, ...target.args, ...passthrough], { stdio: 'inherit' });
147
+ process.exit(r2.status ?? 0);
128
148
  }
129
149
 
130
150
  main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdlcai/setup",
3
- "version": "0.3.3",
3
+ "version": "0.3.7",
4
4
  "description": "One-command bootstrap for private Avanade dev-tool assets (AVA agents, mnemo, …): GitHub browser login + Avanade-Region-ICEG access gate + install.",
5
5
  "type": "module",
6
6
  "bin": {