@sdlcai/setup 1.0.0 → 1.0.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/bin/cli.mjs +14 -10
- package/package.json +1 -1
package/bin/cli.mjs
CHANGED
|
@@ -13,17 +13,18 @@ import { readFileSync, writeFileSync, existsSync } from 'node:fs';
|
|
|
13
13
|
import { homedir } from 'node:os';
|
|
14
14
|
import { join } from 'node:path';
|
|
15
15
|
|
|
16
|
-
const ORG = 'Avanade-Region-ICEG'; // membership gate
|
|
17
|
-
const REGISTRY = 'https://npm.pkg.github.com'; // where
|
|
18
|
-
const
|
|
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
19
|
|
|
20
|
-
// asset name ->
|
|
20
|
+
// asset name -> installer package + args; gated:false skips the Avanade org check
|
|
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
24
|
'mnemo': { pkg: '@avanade-region-iceg/mnemo-setup', args: [], label: 'mnemo (AVA memory)' },
|
|
25
25
|
'ava-mem': { pkg: '@avanade-region-iceg/mnemo-setup', args: [], label: 'mnemo (AVA memory)' },
|
|
26
26
|
'gh-mnemo': { pkg: '@avanade-region-iceg/gh-mnemo', args: [], label: 'mnemo gh extension' },
|
|
27
|
+
'ba-agents': { pkg: '@fsabatini82/ba-agents', scope: '@fsabatini82', args: ['install'], label: 'BA Expert agents', gated: false },
|
|
27
28
|
};
|
|
28
29
|
|
|
29
30
|
const WIN = process.platform === 'win32';
|
|
@@ -75,14 +76,15 @@ function gateOrg() {
|
|
|
75
76
|
info(`✓ Access to ${ORG} confirmed.`);
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
function configureNpmAuth(token) {
|
|
79
|
+
function configureNpmAuth(token, scope = DEFAULT_SCOPE) {
|
|
79
80
|
const rc = join(homedir(), '.npmrc');
|
|
80
81
|
let lines = existsSync(rc) ? readFileSync(rc, 'utf8').split(/\r?\n/) : [];
|
|
81
|
-
|
|
82
|
-
lines.
|
|
82
|
+
// Remove stale entries for this scope and the shared token line; re-add below.
|
|
83
|
+
lines = lines.filter((l) => !l.startsWith(`${scope}:registry=`) && !l.includes('//npm.pkg.github.com/:_authToken='));
|
|
84
|
+
lines.push(`${scope}:registry=${REGISTRY}`);
|
|
83
85
|
lines.push(`//npm.pkg.github.com/:_authToken=${token}`);
|
|
84
86
|
writeFileSync(rc, lines.filter(Boolean).join('\n') + '\n');
|
|
85
|
-
info(`✓ Configured GitHub Packages auth (${rc}).`);
|
|
87
|
+
info(`✓ Configured GitHub Packages auth for ${scope} (${rc}).`);
|
|
86
88
|
}
|
|
87
89
|
|
|
88
90
|
function help(exit) {
|
|
@@ -123,10 +125,12 @@ function main() {
|
|
|
123
125
|
const rest = argv.slice(1);
|
|
124
126
|
const passthrough = rest[0] === '--' ? rest.slice(1) : rest;
|
|
125
127
|
|
|
128
|
+
const scope = target.scope || DEFAULT_SCOPE;
|
|
129
|
+
|
|
126
130
|
ensureGh();
|
|
127
131
|
const token = ensureAuth();
|
|
128
|
-
gateOrg();
|
|
129
|
-
configureNpmAuth(token);
|
|
132
|
+
if (target.gated !== false) gateOrg();
|
|
133
|
+
configureNpmAuth(token, scope);
|
|
130
134
|
|
|
131
135
|
info(`\n→ Installing ${target.label} (${target.pkg})…\n`);
|
|
132
136
|
// Install to a known dir then invoke the bin file directly with node.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdlcai/setup",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
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": {
|