@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.
- package/LICENSE +21 -21
- package/README.md +48 -44
- package/bin/cli.mjs +167 -163
- 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**
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
sdlcai
|
|
9
|
-
sdlcai
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
|
32
|
-
|
|
33
|
-
| `
|
|
34
|
-
| `
|
|
35
|
-
| `
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
//
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
'
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
lines.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
sdlcai
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
//
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
|
|
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.
|
|
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
|
-
"
|
|
10
|
-
"
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
+
}
|