@sdlcai/setup 1.3.0 → 1.4.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 (4) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +48 -44
  3. package/bin/cli.mjs +167 -163
  4. package/package.json +30 -27
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Fabio Sabatini
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Fabio Sabatini
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,44 +1,48 @@
1
- # @sdlcai/setup
2
-
3
- One command to install private **Avanade** dev-tool assets — the AVA agents, mnemo, and future
4
- assets — with a secure GitHub browser login and an access gate.
5
-
6
- ```bash
7
- npm i -g @sdlcai/setup # once (public, no auth)
8
- sdlcai ava-custom-agents
9
- sdlcai mnemo -- --local --scope user --project acme --yes
10
- # or, where npx is healthy: npx @sdlcai/setup ava-custom-agents
11
- ```
12
-
13
- ## What it does
14
- 1. **GitHub browser login** (via `gh` — passkey / 2FA).
15
- 2. **Verifies access** to the `Avanade-Region-ICEG` org (read-only pre-flight gate).
16
- 3. **Configures GitHub Packages auth** in your `~/.npmrc`.
17
- 4. **Runs the asset's own installer.**
18
-
19
- No OAuth App to register, no org-admin actions — `gh` is GitHub's own trusted CLI. The assets stay
20
- private on GitHub Packages; this launcher is just the public, one-command front door. The real
21
- security boundary remains each private package's own access control.
22
-
23
- ## Prerequisites
24
- - **Node.js ≥ 18**
25
- - **GitHub CLI (`gh`)** — https://cli.github.com (`winget install GitHub.cli` · `brew install gh`)
26
- - A GitHub account with access to **`Avanade-Region-ICEG`**.
27
-
28
- ## Assets
29
- | asset | installs |
30
- |---|---|
31
- | `ava-custom-agents` (alias `ava-agents`) | `@avanade-region-iceg/ava-agents install` |
32
- | `mnemo` (alias `ava-mem`, `memiq`) | `@avanade-region-iceg/mnemo-setup` |
33
- | `gh-mnemo` | `@avanade-region-iceg/gh-mnemo` |
34
- | `ba-agents` | `@fsabatini82/ba-agents install` |
35
- | `meet2spec` | `@avanade-region-iceg/meet2spec` |
36
-
37
- Everything after the asset name is passed through to its installer (use `--` to separate).
38
- Add a new asset by adding one line to `ASSETS` in `bin/cli.mjs`.
39
-
40
- ## Publish (maintainer)
41
- ```bash
42
- npm login # the account that owns the @sdlcai org
43
- npm publish --access public # public launcher
44
- ```
1
+ # @sdlcai/setup
2
+
3
+ One command to install dev-tool assets: private **Avanade** assets (the AVA agents, mnemo, …),
4
+ behind a GitHub login and an org access gate, and public ones such as `memiq-public` (MIT, local only),
5
+ which skip the gate.
6
+
7
+ ```bash
8
+ npm i -g @sdlcai/setup # once (public, no auth)
9
+ sdlcai ava-custom-agents
10
+ sdlcai mnemo -- --local --scope user --project acme --yes
11
+ sdlcai memiq-public --yes # public edition: local install only
12
+ # or, where npx is healthy: npx @sdlcai/setup ava-custom-agents
13
+ ```
14
+
15
+ ## What it does
16
+ 1. **GitHub browser login** (via `gh` — passkey / 2FA).
17
+ 2. **Verifies access** to the `Avanade-Region-ICEG` org (read-only pre-flight gate) — private assets only.
18
+ 3. **Configures GitHub Packages auth** in your `~/.npmrc`.
19
+ 4. **Runs the asset's own installer.**
20
+
21
+ No OAuth App to register, no org-admin actions — `gh` is GitHub's own trusted CLI. The private assets
22
+ stay on GitHub Packages; the real security boundary remains each package's own access control.
23
+ The public assets are on GitHub Packages too, so they still need a GitHub account and a token.
24
+
25
+ ## Prerequisites
26
+ - **Node.js ≥ 18**
27
+ - **GitHub CLI (`gh`)** — https://cli.github.com (`winget install GitHub.cli` · `brew install gh`)
28
+ - A GitHub account. Private assets also require access to **`Avanade-Region-ICEG`**.
29
+
30
+ ## Assets
31
+ | asset | installs |
32
+ |---|---|
33
+ | `ava-custom-agents` (alias `ava-agents`) | `@avanade-region-iceg/ava-agents install` |
34
+ | `mnemo` (alias `ava-mem`, `memiq`) | `@avanade-region-iceg/mnemo-setup` |
35
+ | `memiq-public` | `@fsabatini82/memiq` — public edition (MIT): local install only, rejects `--url`, `--token`, `--demo` |
36
+ | `ada` | `@fsabatini82/ada-assistant-setup` — installs the Ada local assistant (private signed images pulled with your own GitHub login; no org gate). Needs WSL2 on Windows; `-- --plan` shows the steps and changes nothing |
37
+ | `gh-mnemo` | `@avanade-region-iceg/gh-mnemo` |
38
+ | `ba-agents` | `@fsabatini82/ba-agents install` (public, MIT) |
39
+ | `meet2spec` | `@avanade-region-iceg/meet2spec` |
40
+
41
+ Everything after the asset name is passed through to its installer (use `--` to separate).
42
+ Add a new asset by adding one line to `ASSETS` in `bin/cli.mjs`.
43
+
44
+ ## Publish (maintainer)
45
+ ```bash
46
+ npm login # the account that owns the @sdlcai org
47
+ npm publish --access public # public launcher
48
+ ```
package/bin/cli.mjs CHANGED
@@ -1,163 +1,167 @@
1
- #!/usr/bin/env node
2
- /**
3
- * @sdlcai/setup — one-command bootstrap for private Avanade dev-tool assets.
4
- *
5
- * npx @sdlcai/setup <asset> [-- asset-args…]
6
- *
7
- * Flow: GitHub browser login (via `gh`) → verify Avanade-Region-ICEG membership →
8
- * configure GitHub Packages auth in ~/.npmrc → run the asset's own installer.
9
- * No OAuth App to register, no org-admin actions. `gh` is GitHub's own trusted CLI.
10
- */
11
- import { spawnSync } from 'node:child_process';
12
- import { readFileSync, writeFileSync, existsSync } from 'node:fs';
13
- import { homedir } from 'node:os';
14
- import { join } from 'node:path';
15
-
16
- const ORG = 'Avanade-Region-ICEG'; // membership gate (Avanade assets only)
17
- const REGISTRY = 'https://npm.pkg.github.com'; // where all assets live
18
- const DEFAULT_SCOPE = '@avanade-region-iceg';
19
-
20
- // asset name -> installer package + args; gated:false skips the Avanade org check
21
- const ASSETS = {
22
- 'ava-custom-agents': { pkg: '@avanade-region-iceg/ava-agents', args: ['install'], label: 'AVA custom agents' },
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 (AVA memory)' },
25
- 'ava-mem': { pkg: '@avanade-region-iceg/mnemo-setup', args: [], label: 'mnemo (AVA memory)' },
26
- 'memiq': { pkg: '@avanade-region-iceg/mnemo-setup', args: [], label: 'memiq (AVA memory, new brand)' },
27
- 'gh-mnemo': { pkg: '@avanade-region-iceg/gh-mnemo', args: [], label: 'mnemo gh extension' },
28
- 'ba-agents': { pkg: '@fsabatini82/ba-agents', scope: '@fsabatini82', args: ['install'], label: 'BA Expert agents', gated: false },
29
- 'meet2spec': { pkg: '@avanade-region-iceg/meet2spec', args: [], label: 'meet2spec (meeting recorder)' },
30
- // memiq public edition (GitHub Packages, user scope): local install only, no org gate
31
- 'memiq-public': { pkg: '@fsabatini82/memiq', scope: '@fsabatini82', args: ['--local'], forbid: ['--url', '--token', '--demo'], label: 'memiq (AVA memory, local only)', gated: false },
32
- };
33
-
34
- const WIN = process.platform === 'win32';
35
- const die = (m) => { console.error(`\n✖ ${m}`); process.exit(1); };
36
- const info = (m) => console.log(m);
37
- const run = (cmd, args, opts = {}) => spawnSync(cmd, args, { stdio: 'inherit', shell: WIN, ...opts });
38
- const out = (cmd, args) => { const r = spawnSync(cmd, args, { encoding: 'utf8', shell: WIN }); return r.status === 0 ? (r.stdout || '').trim() : null; };
39
- const ok = (cmd, args) => spawnSync(cmd, args, { encoding: 'utf8', shell: WIN }).status === 0;
40
-
41
- function ensureGh() {
42
- if (out('gh', ['--version'])) return;
43
- die('GitHub CLI (gh) is required — install it first, then re-run:\n' +
44
- ' Windows: winget install GitHub.cli\n' +
45
- ' macOS: brew install gh\n' +
46
- ' Linux: see https://github.com/cli/cli#installation\n' +
47
- ' https://cli.github.com');
48
- }
49
-
50
- function tokenScopes() {
51
- const r = spawnSync('gh', ['auth', 'status', '-h', 'github.com'], { encoding: 'utf8', shell: WIN });
52
- const m = `${r.stdout || ''}${r.stderr || ''}`.match(/Token scopes:([^\r\n]*)/i);
53
- return m ? m[1] : '';
54
- }
55
-
56
- function ensureAuth() {
57
- if (!ok('gh', ['auth', 'status', '-h', 'github.com'])) {
58
- info('→ GitHub login (a browser window will open — use your passkey / 2FA)…');
59
- if (run('gh', ['auth', 'login', '-h', 'github.com', '-p', 'https', '-w']).status !== 0) {
60
- die('GitHub login failed.');
61
- }
62
- }
63
- const need = ['read:org', 'read:packages'];
64
- const have = tokenScopes();
65
- if (!need.every((s) => have.includes(`'${s}'`))) {
66
- info('→ Granting permissions (read:org, read:packages) — authorize in the browser…');
67
- run('gh', ['auth', 'refresh', '-h', 'github.com', '-s', need.join(',')]);
68
- }
69
- const token = out('gh', ['auth', 'token', '-h', 'github.com']);
70
- if (!token) die('Could not obtain a GitHub token.');
71
- return token;
72
- }
73
-
74
- function gateOrg() {
75
- info(`→ Checking access to ${ORG}…`);
76
- if (!ok('gh', ['api', '--hostname', 'github.com', `user/memberships/orgs/${ORG}`])) {
77
- die(`Access denied: your GitHub account is not an active member of ${ORG}.\n` +
78
- ` Request access from your team, then re-run.`);
79
- }
80
- info(`✓ Access to ${ORG} confirmed.`);
81
- }
82
-
83
- function configureNpmAuth(token, scope = DEFAULT_SCOPE) {
84
- const rc = join(homedir(), '.npmrc');
85
- let lines = existsSync(rc) ? readFileSync(rc, 'utf8').split(/\r?\n/) : [];
86
- // Remove stale entries for this scope and the shared token line; re-add below.
87
- lines = lines.filter((l) => !l.startsWith(`${scope}:registry=`) && !l.includes('//npm.pkg.github.com/:_authToken='));
88
- lines.push(`${scope}:registry=${REGISTRY}`);
89
- lines.push(`//npm.pkg.github.com/:_authToken=${token}`);
90
- writeFileSync(rc, lines.filter(Boolean).join('\n') + '\n');
91
- info(`✓ Configured GitHub Packages auth for ${scope} (${rc}).`);
92
- }
93
-
94
- function help(exit) {
95
- console.log(
96
- `@sdlcai/setup — install a private Avanade dev-tool asset with one command.
97
-
98
- Usage:
99
- sdlcai <asset> [-- asset-args…] (after: npm i -g @sdlcai/setup)
100
- npx @sdlcai/setup <asset> [-- asset-args…] (alternative, where npx is healthy)
101
-
102
- Assets:
103
- ${Object.keys(ASSETS).map((a) => ` ${a}`).join('\n')}
104
-
105
- It logs you into GitHub (browser + passkey/2FA), checks ${ORG} access,
106
- configures GitHub Packages auth, then runs the asset's installer.
107
-
108
- Examples:
109
- sdlcai ava-custom-agents
110
- sdlcai mnemo -- --local --scope user --project acme --yes
111
- sdlcai gh-mnemo
112
- sdlcai meet2spec`);
113
- process.exit(exit);
114
- }
115
-
116
- function main() {
117
- const argv = process.argv.slice(2);
118
- const asset = argv[0];
119
- if (asset === '--version' || asset === '-v') {
120
- const { version } = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
121
- console.log(version);
122
- process.exit(0);
123
- }
124
- if (!asset || asset === '-h' || asset === '--help') help(asset ? 0 : 1);
125
-
126
- const target = ASSETS[asset];
127
- if (!target) die(`Unknown asset "${asset}". Known: ${Object.keys(ASSETS).join(', ')}`);
128
-
129
- // everything after the asset (drop a leading "--" separator if present) is passed through
130
- const rest = argv.slice(1);
131
- const passthrough = rest[0] === '--' ? rest.slice(1) : rest;
132
-
133
- // an edition that is local-only refuses cloud flags here, before any login or install
134
- const refused = (target.forbid || []).filter((f) => passthrough.some((x) => x === f || x.startsWith(`${f}=`)));
135
- if (refused.length) die(`${asset} installs local only; not allowed: ${refused.join(', ')}`);
136
-
137
- const scope = target.scope || DEFAULT_SCOPE;
138
-
139
- ensureGh();
140
- const token = ensureAuth();
141
- if (target.gated !== false) gateOrg();
142
- configureNpmAuth(token, scope);
143
-
144
- info(`\n→ Installing ${target.label} (${target.pkg})…\n`);
145
- // Install to a known dir then invoke the bin file directly with node.
146
- // Avoids the Windows cmd.exe PATH issue where npx / npm-exec cannot
147
- // resolve the temporary .bin wrapper after a nested shell spawn.
148
- const installDir = join(homedir(), '.sdlcai', target.pkg.replace(/[@/]/g, '-'));
149
- const r1 = run('npm', ['install', '--prefix', installDir, '--no-save', '--no-audit', '--no-fund', target.pkg]);
150
- if (r1.status !== 0) die(`Failed to install ${target.pkg}.`);
151
- const pkgJsonPath = join(installDir, 'node_modules', ...target.pkg.split('/'), 'package.json');
152
- const pkgMeta = JSON.parse(readFileSync(pkgJsonPath, 'utf8'));
153
- const binMap = typeof pkgMeta.bin === 'string'
154
- ? { [pkgMeta.name.replace(/^@[^/]+\//, '')]: pkgMeta.bin }
155
- : (pkgMeta.bin || {});
156
- const binRel = Object.values(binMap)[0];
157
- if (!binRel) die(`No binary declared in ${target.pkg}.`);
158
- const binAbs = join(installDir, 'node_modules', ...target.pkg.split('/'), ...binRel.split('/'));
159
- const r2 = spawnSync(process.execPath, [binAbs, ...target.args, ...passthrough], { stdio: 'inherit' });
160
- process.exit(r2.status ?? 0);
161
- }
162
-
163
- main();
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @sdlcai/setup — one-command bootstrap for private Avanade dev-tool assets.
4
+ *
5
+ * npx @sdlcai/setup <asset> [-- asset-args…]
6
+ *
7
+ * Flow: GitHub browser login (via `gh`) → verify Avanade-Region-ICEG membership →
8
+ * configure GitHub Packages auth in ~/.npmrc → run the asset's own installer.
9
+ * No OAuth App to register, no org-admin actions. `gh` is GitHub's own trusted CLI.
10
+ */
11
+ import { spawnSync } from 'node:child_process';
12
+ import { readFileSync, writeFileSync, existsSync } from 'node:fs';
13
+ import { homedir } from 'node:os';
14
+ import { join } from 'node:path';
15
+
16
+ const ORG = 'Avanade-Region-ICEG'; // membership gate (Avanade assets only)
17
+ const REGISTRY = 'https://npm.pkg.github.com'; // where all assets live
18
+ const DEFAULT_SCOPE = '@avanade-region-iceg';
19
+
20
+ // asset name -> installer package + args; gated:false skips the Avanade org check
21
+ const ASSETS = {
22
+ 'ava-custom-agents': { pkg: '@avanade-region-iceg/ava-agents', args: ['install'], label: 'AVA custom agents' },
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 (AVA memory)' },
25
+ 'ava-mem': { pkg: '@avanade-region-iceg/mnemo-setup', args: [], label: 'mnemo (AVA memory)' },
26
+ 'memiq': { pkg: '@avanade-region-iceg/mnemo-setup', args: [], label: 'memiq (AVA memory, new brand)' },
27
+ 'gh-mnemo': { pkg: '@avanade-region-iceg/gh-mnemo', args: [], label: 'mnemo gh extension' },
28
+ 'ba-agents': { pkg: '@fsabatini82/ba-agents', scope: '@fsabatini82', args: ['install'], label: 'BA Expert agents', gated: false },
29
+ 'meet2spec': { pkg: '@avanade-region-iceg/meet2spec', args: [], label: 'meet2spec (meeting recorder)' },
30
+ // Ada local assistant (F6c-3): the public bootstrap only (GitHub Packages, user scope); it logs into ghcr.io with the same gh token and pulls the
31
+ // PRIVATE signed images itself, so there is no org gate here (access is per GitHub user on the packages). Installs WSL-side Docker, never WSL.
32
+ 'ada': { pkg: '@fsabatini82/ada-assistant-setup', scope: '@fsabatini82', args: [], label: 'Ada local assistant (private signed images)', gated: false },
33
+ // memiq public edition (GitHub Packages, user scope): local install only, no org gate
34
+ 'memiq-public': { pkg: '@fsabatini82/memiq', scope: '@fsabatini82', args: ['--local'], forbid: ['--url', '--token', '--demo'], label: 'memiq (AVA memory, local only)', gated: false },
35
+ };
36
+
37
+ const WIN = process.platform === 'win32';
38
+ const die = (m) => { console.error(`\n✖ ${m}`); process.exit(1); };
39
+ const info = (m) => console.log(m);
40
+ const run = (cmd, args, opts = {}) => spawnSync(cmd, args, { stdio: 'inherit', shell: WIN, ...opts });
41
+ const out = (cmd, args) => { const r = spawnSync(cmd, args, { encoding: 'utf8', shell: WIN }); return r.status === 0 ? (r.stdout || '').trim() : null; };
42
+ const ok = (cmd, args) => spawnSync(cmd, args, { encoding: 'utf8', shell: WIN }).status === 0;
43
+
44
+ function ensureGh() {
45
+ if (out('gh', ['--version'])) return;
46
+ die('GitHub CLI (gh) is required — install it first, then re-run:\n' +
47
+ ' Windows: winget install GitHub.cli\n' +
48
+ ' macOS: brew install gh\n' +
49
+ ' Linux: see https://github.com/cli/cli#installation\n' +
50
+ ' https://cli.github.com');
51
+ }
52
+
53
+ function tokenScopes() {
54
+ const r = spawnSync('gh', ['auth', 'status', '-h', 'github.com'], { encoding: 'utf8', shell: WIN });
55
+ const m = `${r.stdout || ''}${r.stderr || ''}`.match(/Token scopes:([^\r\n]*)/i);
56
+ return m ? m[1] : '';
57
+ }
58
+
59
+ function ensureAuth() {
60
+ if (!ok('gh', ['auth', 'status', '-h', 'github.com'])) {
61
+ info('→ GitHub login (a browser window will open — use your passkey / 2FA)…');
62
+ if (run('gh', ['auth', 'login', '-h', 'github.com', '-p', 'https', '-w']).status !== 0) {
63
+ die('GitHub login failed.');
64
+ }
65
+ }
66
+ const need = ['read:org', 'read:packages'];
67
+ const have = tokenScopes();
68
+ if (!need.every((s) => have.includes(`'${s}'`))) {
69
+ info('→ Granting permissions (read:org, read:packages) — authorize in the browser…');
70
+ run('gh', ['auth', 'refresh', '-h', 'github.com', '-s', need.join(',')]);
71
+ }
72
+ const token = out('gh', ['auth', 'token', '-h', 'github.com']);
73
+ if (!token) die('Could not obtain a GitHub token.');
74
+ return token;
75
+ }
76
+
77
+ function gateOrg() {
78
+ info(`→ Checking access to ${ORG}…`);
79
+ if (!ok('gh', ['api', '--hostname', 'github.com', `user/memberships/orgs/${ORG}`])) {
80
+ die(`Access denied: your GitHub account is not an active member of ${ORG}.\n` +
81
+ ` Request access from your team, then re-run.`);
82
+ }
83
+ info(`✓ Access to ${ORG} confirmed.`);
84
+ }
85
+
86
+ function configureNpmAuth(token, scope = DEFAULT_SCOPE) {
87
+ const rc = join(homedir(), '.npmrc');
88
+ let lines = existsSync(rc) ? readFileSync(rc, 'utf8').split(/\r?\n/) : [];
89
+ // Remove stale entries for this scope and the shared token line; re-add below.
90
+ lines = lines.filter((l) => !l.startsWith(`${scope}:registry=`) && !l.includes('//npm.pkg.github.com/:_authToken='));
91
+ lines.push(`${scope}:registry=${REGISTRY}`);
92
+ lines.push(`//npm.pkg.github.com/:_authToken=${token}`);
93
+ writeFileSync(rc, lines.filter(Boolean).join('\n') + '\n');
94
+ info(`✓ Configured GitHub Packages auth for ${scope} (${rc}).`);
95
+ }
96
+
97
+ function help(exit) {
98
+ console.log(
99
+ `@sdlcai/setup — install a private Avanade dev-tool asset with one command.
100
+
101
+ Usage:
102
+ sdlcai <asset> [-- asset-args…] (after: npm i -g @sdlcai/setup)
103
+ npx @sdlcai/setup <asset> [-- asset-args…] (alternative, where npx is healthy)
104
+
105
+ Assets:
106
+ ${Object.keys(ASSETS).map((a) => ` ${a}`).join('\n')}
107
+
108
+ It logs you into GitHub (browser + passkey/2FA), checks ${ORG} access,
109
+ configures GitHub Packages auth, then runs the asset's installer.
110
+
111
+ Examples:
112
+ sdlcai ava-custom-agents
113
+ sdlcai mnemo -- --local --scope user --project acme --yes
114
+ sdlcai gh-mnemo
115
+ sdlcai meet2spec
116
+ sdlcai ada # Ada local assistant on a clean Windows PC (needs WSL2)`);
117
+ process.exit(exit);
118
+ }
119
+
120
+ function main() {
121
+ const argv = process.argv.slice(2);
122
+ const asset = argv[0];
123
+ if (asset === '--version' || asset === '-v') {
124
+ const { version } = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
125
+ console.log(version);
126
+ process.exit(0);
127
+ }
128
+ if (!asset || asset === '-h' || asset === '--help') help(asset ? 0 : 1);
129
+
130
+ const target = ASSETS[asset];
131
+ if (!target) die(`Unknown asset "${asset}". Known: ${Object.keys(ASSETS).join(', ')}`);
132
+
133
+ // everything after the asset (drop a leading "--" separator if present) is passed through
134
+ const rest = argv.slice(1);
135
+ const passthrough = rest[0] === '--' ? rest.slice(1) : rest;
136
+
137
+ // an edition that is local-only refuses cloud flags here, before any login or install
138
+ const refused = (target.forbid || []).filter((f) => passthrough.some((x) => x === f || x.startsWith(`${f}=`)));
139
+ if (refused.length) die(`${asset} installs local only; not allowed: ${refused.join(', ')}`);
140
+
141
+ const scope = target.scope || DEFAULT_SCOPE;
142
+
143
+ ensureGh();
144
+ const token = ensureAuth();
145
+ if (target.gated !== false) gateOrg();
146
+ configureNpmAuth(token, scope);
147
+
148
+ info(`\n→ Installing ${target.label} (${target.pkg})…\n`);
149
+ // Install to a known dir then invoke the bin file directly with node.
150
+ // Avoids the Windows cmd.exe PATH issue where npx / npm-exec cannot
151
+ // resolve the temporary .bin wrapper after a nested shell spawn.
152
+ const installDir = join(homedir(), '.sdlcai', target.pkg.replace(/[@/]/g, '-'));
153
+ const r1 = run('npm', ['install', '--prefix', installDir, '--no-save', '--no-audit', '--no-fund', target.pkg]);
154
+ if (r1.status !== 0) die(`Failed to install ${target.pkg}.`);
155
+ const pkgJsonPath = join(installDir, 'node_modules', ...target.pkg.split('/'), 'package.json');
156
+ const pkgMeta = JSON.parse(readFileSync(pkgJsonPath, 'utf8'));
157
+ const binMap = typeof pkgMeta.bin === 'string'
158
+ ? { [pkgMeta.name.replace(/^@[^/]+\//, '')]: pkgMeta.bin }
159
+ : (pkgMeta.bin || {});
160
+ const binRel = Object.values(binMap)[0];
161
+ if (!binRel) die(`No binary declared in ${target.pkg}.`);
162
+ const binAbs = join(installDir, 'node_modules', ...target.pkg.split('/'), ...binRel.split('/'));
163
+ const r2 = spawnSync(process.execPath, [binAbs, ...target.args, ...passthrough], { stdio: 'inherit' });
164
+ process.exit(r2.status ?? 0);
165
+ }
166
+
167
+ main();
package/package.json CHANGED
@@ -1,27 +1,30 @@
1
- {
2
- "name": "@sdlcai/setup",
3
- "version": "1.3.0",
4
- "description": "One-command bootstrap for private Avanade dev-tool assets (AVA agents, mnemo, …): GitHub browser login + Avanade-Region-ICEG access gate + install.",
5
- "type": "module",
6
- "bin": {
7
- "sdlcai": "bin/cli.mjs"
8
- },
9
- "files": [
10
- "bin"
11
- ],
12
- "engines": {
13
- "node": ">=18"
14
- },
15
- "keywords": [
16
- "sdlc",
17
- "avanade",
18
- "installer",
19
- "bootstrap",
20
- "ava-agents",
21
- "mnemo"
22
- ],
23
- "license": "MIT",
24
- "publishConfig": {
25
- "access": "public"
26
- }
27
- }
1
+ {
2
+ "name": "@sdlcai/setup",
3
+ "version": "1.4.0",
4
+ "description": "One-command bootstrap for private Avanade dev-tool assets (AVA agents, mnemo, …): GitHub browser login + Avanade-Region-ICEG access gate + install.",
5
+ "type": "module",
6
+ "bin": {
7
+ "sdlcai": "bin/cli.mjs"
8
+ },
9
+ "scripts": {
10
+ "test": "node tests/test-assets.mjs"
11
+ },
12
+ "files": [
13
+ "bin"
14
+ ],
15
+ "engines": {
16
+ "node": ">=18"
17
+ },
18
+ "keywords": [
19
+ "sdlc",
20
+ "avanade",
21
+ "installer",
22
+ "bootstrap",
23
+ "ava-agents",
24
+ "mnemo"
25
+ ],
26
+ "license": "MIT",
27
+ "publishConfig": {
28
+ "access": "public"
29
+ }
30
+ }