@voxgig/sdkgen 4.29.0 → 4.30.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/bin/voxgig-sdkgen CHANGED
@@ -8,7 +8,7 @@ const { Shape, One, Skip } = require('shape')
8
8
 
9
9
  const { SdkGen } = require('../dist/sdkgen.js')
10
10
 
11
- const VERSION = '4.29.0'
11
+ const VERSION = '4.30.0'
12
12
  const KONSOLE = console
13
13
 
14
14
 
@@ -0,0 +1,39 @@
1
+ type Mode = 'setup' | 'check' | 'dry-run';
2
+ type Publication = {
3
+ pkg: string;
4
+ file: string;
5
+ };
6
+ type TrustSpec = {
7
+ repository: string;
8
+ publish: Publication[];
9
+ mode: Mode;
10
+ replace: boolean;
11
+ otp?: string;
12
+ };
13
+ type TrustEntry = {
14
+ id?: string;
15
+ type?: string;
16
+ file?: string;
17
+ repository?: string;
18
+ environment?: string;
19
+ permissions?: string[];
20
+ };
21
+ type Assessment = {
22
+ match?: TrustEntry;
23
+ extra: TrustEntry[];
24
+ };
25
+ type NpmPort = {
26
+ list(pkg: string): TrustEntry[];
27
+ create(pkg: string, repository: string, file: string): void;
28
+ revoke(pkg: string, id: string): void;
29
+ };
30
+ declare function parseArgs(argv: string[]): TrustSpec;
31
+ declare function parseTrustList(text: string): TrustEntry[];
32
+ declare function assess(pub: Publication, repository: string, entries: TrustEntry[]): Assessment;
33
+ declare function trustCommand(repository: string, pub: Publication): string;
34
+ declare function run(spec: TrustSpec, npm: NpmPort, out: (line: string) => void): number;
35
+ declare function npmFailure(action: string, stderr: string): string;
36
+ declare function npmTrustScript(repository: string | null, publish: Publication[]): string;
37
+ declare function main(argv: string[]): number;
38
+ export type { Assessment, NpmPort, Publication, TrustEntry, TrustSpec, };
39
+ export { assess, main, npmFailure, npmTrustScript, parseArgs, parseTrustList, run, trustCommand, };
@@ -0,0 +1,308 @@
1
+ "use strict";
2
+ /* Copyright (c) 2026 Voxgig Ltd, MIT License */
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.assess = assess;
5
+ exports.main = main;
6
+ exports.npmFailure = npmFailure;
7
+ exports.npmTrustScript = npmTrustScript;
8
+ exports.parseArgs = parseArgs;
9
+ exports.parseTrustList = parseTrustList;
10
+ exports.run = run;
11
+ exports.trustCommand = trustCommand;
12
+ const node_child_process_1 = require("node:child_process");
13
+ const USAGE = 'usage: npm-trust --repository <owner/repo> ' +
14
+ '--publish <package>=<workflow.yml> [--publish ...] ' +
15
+ '[--check | --dry-run] [--replace] [--otp <code>]';
16
+ const REPOSITORY_RE = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/;
17
+ const WORKFLOW_RE = /^[A-Za-z0-9_.-]+\.ya?ml$/;
18
+ const PACKAGE_RE = /^(@[a-z0-9][a-z0-9._~-]*\/)?[a-z0-9][a-z0-9._~-]*$/;
19
+ function parseArgs(argv) {
20
+ const spec = { repository: '', publish: [], mode: 'setup', replace: false };
21
+ const modes = [];
22
+ for (let i = 0; i < argv.length; i++) {
23
+ const arg = argv[i];
24
+ const value = () => {
25
+ const v = argv[++i];
26
+ if (null == v || v.startsWith('--')) {
27
+ throw new Error(`${arg} needs a value\n${USAGE}`);
28
+ }
29
+ return v;
30
+ };
31
+ if ('--repository' === arg) {
32
+ if ('' !== spec.repository) {
33
+ throw new Error('--repository is given twice; the generated script already names it');
34
+ }
35
+ spec.repository = value();
36
+ }
37
+ else if ('--publish' === arg) {
38
+ const v = value();
39
+ const eq = v.indexOf('=');
40
+ spec.publish.push({ pkg: v.slice(0, eq < 0 ? v.length : eq), file: eq < 0 ? '' : v.slice(eq + 1) });
41
+ }
42
+ else if ('--check' === arg || '--dry-run' === arg) {
43
+ modes.push(arg.slice(2));
44
+ }
45
+ else if ('--replace' === arg) {
46
+ spec.replace = true;
47
+ }
48
+ else if ('--otp' === arg) {
49
+ spec.otp = value();
50
+ }
51
+ else {
52
+ throw new Error(`unknown argument: ${arg}\n${USAGE}`);
53
+ }
54
+ }
55
+ if (1 < modes.length) {
56
+ throw new Error(`--check and --dry-run are alternatives\n${USAGE}`);
57
+ }
58
+ spec.mode = modes[0] || 'setup';
59
+ if ('check' === spec.mode && spec.replace) {
60
+ throw new Error('--check changes nothing, so it cannot --replace');
61
+ }
62
+ if (!REPOSITORY_RE.test(spec.repository)) {
63
+ throw new Error(`--repository must be owner/repo, got: ${spec.repository || '(none)'}\n${USAGE}`);
64
+ }
65
+ if (0 === spec.publish.length) {
66
+ throw new Error(`at least one --publish is required\n${USAGE}`);
67
+ }
68
+ const seen = new Set();
69
+ for (const { pkg, file } of spec.publish) {
70
+ if (!PACKAGE_RE.test(pkg)) {
71
+ throw new Error(`not an npm package name: ${pkg}`);
72
+ }
73
+ if (!WORKFLOW_RE.test(file)) {
74
+ throw new Error(`${pkg}: the workflow must be a .yml file name, not a path, got: ${file || '(none)'}`);
75
+ }
76
+ if (seen.has(pkg)) {
77
+ throw new Error(`${pkg} is named twice`);
78
+ }
79
+ seen.add(pkg);
80
+ }
81
+ return spec;
82
+ }
83
+ // `npm trust list --json` prints one pretty-printed object per configuration
84
+ // rather than an array, so the objects are split out by brace depth.
85
+ function parseTrustList(text) {
86
+ const src = text.trim();
87
+ if ('' === src) {
88
+ return [];
89
+ }
90
+ try {
91
+ const whole = JSON.parse(src);
92
+ return Array.isArray(whole) ? whole : [whole];
93
+ }
94
+ catch {
95
+ // Not a single JSON value: fall through to the object stream.
96
+ }
97
+ const entries = [];
98
+ let depth = 0;
99
+ let start = -1;
100
+ let inString = false;
101
+ let escaped = false;
102
+ for (let i = 0; i < src.length; i++) {
103
+ const c = src[i];
104
+ if (inString) {
105
+ if (escaped) {
106
+ escaped = false;
107
+ }
108
+ else if ('\\' === c) {
109
+ escaped = true;
110
+ }
111
+ else if ('"' === c) {
112
+ inString = false;
113
+ }
114
+ }
115
+ else if ('"' === c) {
116
+ inString = true;
117
+ }
118
+ else if ('{' === c) {
119
+ if (0 === depth) {
120
+ start = i;
121
+ }
122
+ depth++;
123
+ }
124
+ else if ('}' === c) {
125
+ depth--;
126
+ if (0 === depth) {
127
+ entries.push(JSON.parse(src.slice(start, i + 1)));
128
+ }
129
+ }
130
+ }
131
+ if (0 !== depth) {
132
+ throw new Error('could not read the output of `npm trust list --json`');
133
+ }
134
+ return entries;
135
+ }
136
+ // The generated workflows declare no GitHub environment, so a configuration
137
+ // that names one would never match the job's OIDC token.
138
+ function assess(pub, repository, entries) {
139
+ const matches = (e) => 'github' === e.type &&
140
+ repository.toLowerCase() === String(e.repository || '').toLowerCase() &&
141
+ pub.file === e.file &&
142
+ null == e.environment &&
143
+ (null == e.permissions || e.permissions.includes('createPackage'));
144
+ const match = entries.find(matches);
145
+ return { match, extra: entries.filter((e) => e !== match) };
146
+ }
147
+ function describe(e) {
148
+ return [
149
+ e.type || '?',
150
+ e.repository || '?',
151
+ e.file || '?',
152
+ ...(null == e.environment ? [] : ['environment ' + e.environment]),
153
+ ...(null == e.permissions ? [] : ['[' + e.permissions.join(', ') + ']']),
154
+ ...(null == e.id ? [] : ['id ' + e.id]),
155
+ ].join(' ');
156
+ }
157
+ function trustCommand(repository, pub) {
158
+ return `npm trust github ${pub.pkg} --repository ${repository} ` +
159
+ `--file ${pub.file} --allow-publish`;
160
+ }
161
+ function run(spec, npm, out) {
162
+ if ('dry-run' === spec.mode) {
163
+ for (const pub of spec.publish) {
164
+ out(`${pub.pkg}: ${trustCommand(spec.repository, pub)}`);
165
+ }
166
+ if (spec.replace) {
167
+ out('--replace would also revoke any other trusted publisher of these packages.');
168
+ }
169
+ return 0;
170
+ }
171
+ let drift = false;
172
+ // Nothing is created beside a configuration this repository did not ask
173
+ // for, so a replacement revokes first and creates after.
174
+ for (const pub of spec.publish) {
175
+ const { match, extra } = assess(pub, spec.repository, npm.list(pub.pkg));
176
+ const wanted = `github ${spec.repository} ${pub.file}`;
177
+ let kept = 0;
178
+ for (const e of extra) {
179
+ if ('setup' === spec.mode && spec.replace && null != e.id) {
180
+ npm.revoke(pub.pkg, e.id);
181
+ out(`${pub.pkg}: revoked: ${describe(e)}`);
182
+ }
183
+ else {
184
+ kept++;
185
+ out(`${pub.pkg}: also trusted, and not by this repository's workflows: ${describe(e)}` +
186
+ ('setup' === spec.mode ? ' (--replace revokes it)' : ''));
187
+ }
188
+ }
189
+ const create = null == match && 'setup' === spec.mode && 0 === kept;
190
+ if (null != match) {
191
+ out(`${pub.pkg}: trusted: ${wanted}`);
192
+ }
193
+ else if (create) {
194
+ npm.create(pub.pkg, spec.repository, pub.file);
195
+ out(`${pub.pkg}: now trusted: ${wanted}`);
196
+ }
197
+ else {
198
+ out(`${pub.pkg}: NOT trusted: ${wanted}`);
199
+ }
200
+ drift = drift || 0 < kept || (null == match && !create);
201
+ }
202
+ return drift ? 1 : 0;
203
+ }
204
+ function npmFailure(action, stderr) {
205
+ if (/EOTP|one-time pass/i.test(stderr)) {
206
+ return `${action} needs a one-time password: run again with --otp <code>`;
207
+ }
208
+ if (/E404|not found/i.test(stderr)) {
209
+ return `${action}: the package is not on npm yet. Publish its first version ` +
210
+ 'by hand, then set up trusted publishing';
211
+ }
212
+ if (/E401|ENEEDAUTH/.test(stderr)) {
213
+ return `${action}: not logged in to npm with publish rights. Run \`npm login\` first`;
214
+ }
215
+ return `${action} failed:\n${stderr.trim()}`;
216
+ }
217
+ // An npm without the command still exits 0 from `npm trust --help`, printing
218
+ // "Unknown command", so only the usage text tells a capable npm apart.
219
+ function trustCapableNpm() {
220
+ const shell = 'win32' === process.platform;
221
+ const probe = (0, node_child_process_1.spawnSync)('npm', ['trust', '--help'], { encoding: 'utf8', shell });
222
+ return /npm trust github/.test(String(probe.stdout || '') + String(probe.stderr || '')) ?
223
+ ['npm'] : ['npx', '--yes', 'npm@latest'];
224
+ }
225
+ // A captured call has no terminal, so npm raises EOTP instead of prompting;
226
+ // the mutating calls keep the terminal and can prompt.
227
+ function npmPort(otp) {
228
+ const npm = trustCapableNpm();
229
+ const shell = 'win32' === process.platform;
230
+ const otpArgs = null == otp ? [] : ['--otp', otp];
231
+ const call = (args, capture) => {
232
+ const res = (0, node_child_process_1.spawnSync)(npm[0], [...npm.slice(1), ...args, ...otpArgs], {
233
+ encoding: 'utf8',
234
+ stdio: capture ? ['ignore', 'pipe', 'pipe'] : 'inherit',
235
+ shell,
236
+ });
237
+ if (null != res.error) {
238
+ throw new Error(`could not run ${npm[0]}: ${res.error.message}`);
239
+ }
240
+ if (0 !== res.status) {
241
+ throw new Error(npmFailure(`npm ${args.slice(0, 3).join(' ')}`, String(res.stderr || '')));
242
+ }
243
+ return String(res.stdout || '');
244
+ };
245
+ return {
246
+ list: (pkg) => parseTrustList(call(['trust', 'list', pkg, '--json'], true)),
247
+ create: (pkg, repository, file) => {
248
+ call(['trust', 'github', pkg, '--repository', repository,
249
+ '--file', file, '--allow-publish', '--yes'], false);
250
+ },
251
+ revoke: (pkg, id) => {
252
+ call(['trust', 'revoke', pkg, '--id=' + id], false);
253
+ },
254
+ };
255
+ }
256
+ function shellQuote(value) {
257
+ return "'" + value.replace(/'/g, "'\\''") + "'";
258
+ }
259
+ // A null repository still writes the script, so one generated while the
260
+ // repository was on github.com cannot outlive the move.
261
+ function npmTrustScript(repository, publish) {
262
+ if (null == repository) {
263
+ return `#!/usr/bin/env bash
264
+ # Generated by @voxgig/sdkgen. npm trusts GitHub Actions only for a repository
265
+ # on github.com, and this project's repository is elsewhere.
266
+ echo 'npm trusted publishing needs the repository on github.com; see .sdk/PUBLISHING.md.' >&2
267
+ exit 1
268
+ `;
269
+ }
270
+ const args = [
271
+ '--repository ' + shellQuote(repository),
272
+ ...publish.map((p) => '--publish ' + shellQuote(`${p.pkg}=${p.file}`)),
273
+ '"$@"',
274
+ ];
275
+ return `#!/usr/bin/env bash
276
+ # Generated by @voxgig/sdkgen. Registers this repository's npm publish
277
+ # workflows as trusted publishers; --check reports drift, --dry-run changes nothing.
278
+ set -euo pipefail
279
+ sdk_dir="$(cd -- "$(dirname -- "\${BASH_SOURCE[0]}")/.." && pwd)"
280
+ trust="$sdk_dir/node_modules/@voxgig/sdkgen/dist/admin/npm-trust.js"
281
+ if [[ ! -f "$trust" ]]; then
282
+ echo 'Install or update the .sdk dependencies to configure npm trusted publishing.' >&2
283
+ exit 1
284
+ fi
285
+ exec node "$trust" \\
286
+ ${args.join(' \\\n ')}
287
+ `;
288
+ }
289
+ const OFFLINE = {
290
+ list() { throw new Error('--dry-run does not contact npm'); },
291
+ create() { throw new Error('--dry-run does not contact npm'); },
292
+ revoke() { throw new Error('--dry-run does not contact npm'); },
293
+ };
294
+ function main(argv) {
295
+ try {
296
+ const spec = parseArgs(argv);
297
+ const npm = 'dry-run' === spec.mode ? OFFLINE : npmPort(spec.otp);
298
+ return run(spec, npm, (line) => console.log(line));
299
+ }
300
+ catch (err) {
301
+ console.error(err.message);
302
+ return 2;
303
+ }
304
+ }
305
+ if (require.main === module) {
306
+ process.exitCode = main(process.argv.slice(2));
307
+ }
308
+ //# sourceMappingURL=npm-trust.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"npm-trust.js","sourceRoot":"","sources":["../../src/admin/npm-trust.ts"],"names":[],"mappings":";AAAA,gDAAgD;;QA+Y9C,MAAM;QACN,IAAI;QACJ,UAAU;QACV,cAAc;QACd,SAAS;QACT,cAAc;QACd,GAAG;QACH,YAAY;AApZd,2DAA8C;AAuC9C,MAAM,KAAK,GACT,6CAA6C;IAC7C,qDAAqD;IACrD,kDAAkD,CAAA;AAEpD,MAAM,aAAa,GAAG,oCAAoC,CAAA;AAC1D,MAAM,WAAW,GAAG,0BAA0B,CAAA;AAC9C,MAAM,UAAU,GAAG,oDAAoD,CAAA;AAGvE,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,IAAI,GAAc,EAAE,UAAU,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAA;IACtF,MAAM,KAAK,GAAW,EAAE,CAAA;IAExB,KAAK,IAAI,CAAC,GAAG,CAAC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G,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;IACpD,CAAC;IACD,OAAO,GAAQ,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QAC1B,OAAO,CAAC,CAAA;IACV,CAAC;AACH,CAAC;AAGD,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;AAChD,CAAC"}
@@ -5,6 +5,7 @@ exports.PublishWorkflow = void 0;
5
5
  const jostraca_1 = require("jostraca");
6
6
  const types_1 = require("../types");
7
7
  const packageMeta_1 = require("../helpers/packageMeta");
8
+ const npm_trust_1 = require("../admin/npm-trust");
8
9
  const PublishWorkflow = (0, jostraca_1.cmp)(function PublishWorkflow(props) {
9
10
  const { ctx$ } = props;
10
11
  const { model } = ctx$;
@@ -25,19 +26,26 @@ const PublishWorkflow = (0, jostraca_1.cmp)(function PublishWorkflow(props) {
25
26
  if (0 === npmTargets.length) {
26
27
  return;
27
28
  }
28
- const { repoUrl } = (0, packageMeta_1.repoInfo)(model);
29
+ // npm trusts GitHub Actions only for a repository on github.com.
30
+ const { host, path } = (0, packageMeta_1.repoInfo)(model);
31
+ const repository = 'github.com' === host.toLowerCase() ? path : null;
29
32
  (0, jostraca_1.Folder)({ name: '.github' }, () => {
30
33
  (0, jostraca_1.Folder)({ name: 'workflows' }, () => {
31
34
  for (const target of npmTargets) {
32
- (0, jostraca_1.File)({ name: `publish-${target.name}.yml` }, () => {
33
- (0, jostraca_1.Content)(publishWorkflow(model, target, npmTargets));
35
+ (0, jostraca_1.File)({ name: workflowFile(target) }, () => {
36
+ (0, jostraca_1.Content)(publishWorkflow(model, target, npmTargets, repository));
34
37
  });
35
38
  }
36
39
  });
37
40
  });
38
41
  (0, jostraca_1.Folder)({ name: '.sdk' }, () => {
39
42
  (0, jostraca_1.File)({ name: 'PUBLISHING.md' }, () => {
40
- (0, jostraca_1.Content)(publishingDoc(model, npmTargets, repoUrl));
43
+ (0, jostraca_1.Content)(publishingDoc(model, npmTargets, repository));
44
+ });
45
+ (0, jostraca_1.Folder)({ name: 'admin' }, () => {
46
+ (0, jostraca_1.File)({ name: 'setup-npm-trust.sh', mode: 0o755 }, () => {
47
+ (0, jostraca_1.Content)((0, npm_trust_1.npmTrustScript)(repository, npmTargets.map((t) => ({ pkg: (0, packageMeta_1.packageName)(model, t.name), file: workflowFile(t) }))));
48
+ });
41
49
  });
42
50
  });
43
51
  ctx$.log.info({
@@ -46,6 +54,9 @@ const PublishWorkflow = (0, jostraca_1.cmp)(function PublishWorkflow(props) {
46
54
  });
47
55
  });
48
56
  exports.PublishWorkflow = PublishWorkflow;
57
+ function workflowFile(target) {
58
+ return `publish-${target.name}.yml`;
59
+ }
49
60
  function isPrimaryNpm(model, target, npmTargets) {
50
61
  if (1 === npmTargets.length) {
51
62
  return true;
@@ -56,10 +67,14 @@ function releaseTag(model, target, npmTargets) {
56
67
  return isPrimaryNpm(model, target, npmTargets) ?
57
68
  'v$VERSION' : `${target.name}/v$VERSION`;
58
69
  }
59
- function publishWorkflow(model, target, npmTargets) {
70
+ function publishWorkflow(model, target, npmTargets, repository) {
60
71
  const name = target.name;
61
72
  const tag = releaseTag(model, target, npmTargets);
62
73
  const pkg = (0, packageMeta_1.packageName)(model, name);
74
+ const setup = null == repository ? '' : `
75
+ # .sdk/admin/setup-npm-trust.sh registers exactly this, and with --check
76
+ # reports any drift from it.
77
+ #`;
63
78
  return `# Generated by @voxgig/sdkgen. Do not edit.
64
79
  #
65
80
  # Publishes ${pkg} (the \`${name}/\` target) to npm, via GitHub OIDC Trusted
@@ -70,10 +85,10 @@ function publishWorkflow(model, target, npmTargets) {
70
85
  # SET UP ONCE, by a maintainer with publish rights — see .sdk/PUBLISHING.md:
71
86
  #
72
87
  # npm trust github ${pkg} \\
73
- # --repository <owner>/<repo> \\
74
- # --file publish-${name}.yml \\
88
+ # --repository ${repository ?? '<owner>/<repo>'} \\
89
+ # --file ${workflowFile(target)} \\
75
90
  # --allow-publish
76
- #
91
+ #${setup}
77
92
  # THE FILENAME IS PART OF THAT CONFIGURATION. Renaming this file breaks
78
93
  # publishing until the npm side is updated to match.
79
94
  #
@@ -263,16 +278,23 @@ jobs:
263
278
  echo "pushed \$TAG" >> "\$GITHUB_STEP_SUMMARY"
264
279
  `;
265
280
  }
266
- function publishingDoc(model, targets, repoUrl) {
281
+ function publishingDoc(model, targets, repository) {
267
282
  const pkg = (0, packageMeta_1.packageName)(model, targets[0].name);
268
- const repo = String(repoUrl || '')
269
- .replace(/^git\+/, '')
270
- .replace(/^(https?:\/\/)?(www\.)?github\.com[/:]/, '')
271
- .replace(/\.git$/, '')
272
- .replace(/\/+$/, '');
273
- const owner = '' === repo ? '<owner>/<repo>' : repo;
283
+ const first = workflowFile(targets[0]);
284
+ const setupHow = null == repository ? 'run:' :
285
+ 'run\n`.sdk/admin/setup-npm-trust.sh`. It registers every workflow in the table\n' +
286
+ 'above and leaves a package that is already set up alone; for the\n' +
287
+ `\`${targets[0].name}\` target it runs:`;
288
+ const setupCheck = null == repository ? '' : `
289
+ Run the script again with \`--check\` at any time. It compares what npm holds
290
+ with what these workflows need, changes nothing, and exits non-zero on any
291
+ difference, including a trusted publisher this repository did not ask for.
292
+ \`--replace\` revokes those, \`--dry-run\` prints the commands without contacting
293
+ npm, and \`--otp <code>\` hands npm a one-time password when it asks for one.
294
+ An npm with no \`npm trust\` command is bypassed for \`npx npm@latest\`.
295
+ `;
274
296
  const rows = targets.map((t) => `| \`${t.name}/\` | ${(0, packageMeta_1.packageName)(model, t.name)} | ` +
275
- `\`.github/workflows/publish-${t.name}.yml\` |`).join('\n');
297
+ `\`.github/workflows/${workflowFile(t)}\` |`).join('\n');
276
298
  // WHICH TAG EACH TARGET CUTS. Worth a table rather than a sentence: the
277
299
  // primary npm target owns the bare `v<version>` and every other one is
278
300
  // prefixed, so with more than one npm target the answer differs per row.
@@ -307,7 +329,7 @@ publish credential, and attaches SLSA provenance as it goes.
307
329
  2. Commit and push to \`main\`, and let CI go green.
308
330
  3. Run the workflow from the Actions tab, or:
309
331
 
310
- gh workflow run publish-${targets[0].name}.yml --ref main -f expect_sha=$(git rev-parse HEAD)
332
+ gh workflow run ${first} --ref main -f expect_sha=$(git rev-parse HEAD)
311
333
 
312
334
  \`expect_sha\` is optional and worth using: it refuses if \`main\` moved between
313
335
  the commit you checked and the run resolving.
@@ -338,21 +360,20 @@ its token into the git config for the whole job.
338
360
 
339
361
  ## One-time set-up
340
362
 
341
- npm has to be told which repository and which workflow file may publish this
363
+ npm has to be told which repository and which workflow file may publish each
342
364
  package. From a machine logged in to npm with publish rights (2FA is
343
- required):
365
+ required), ${setupHow}
344
366
 
345
367
  npm trust github ${pkg} \\
346
- --repository ${owner} \\
347
- --file publish-${targets[0].name}.yml \\
368
+ --repository ${repository ?? '<owner>/<repo>'} \\
369
+ --file ${first} \\
348
370
  --allow-publish
349
-
350
- Then \`npm trust list ${pkg}\` shows it, and
351
- \`npm trust revoke ${pkg} --id=<id>\` removes it.
371
+ ${setupCheck}
372
+ \`npm trust list ${pkg}\` shows the configuration, and
373
+ \`npm trust revoke ${pkg} --id=<id>\` removes one.
352
374
 
353
375
  **The workflow filename is part of the configuration.** Renaming
354
- \`publish-${targets[0].name}.yml\` breaks publishing until the npm side is
355
- updated to match.
376
+ \`${first}\` breaks publishing until the npm side is updated to match.
356
377
 
357
378
  **A brand-new package cannot be set up this way.** npm only offers the
358
379
  trusted-publisher settings once a version exists, so the FIRST release of a
@@ -1 +1 @@
1
- {"version":3,"file":"PublishWorkflow.js","sourceRoot":"","sources":["../../src/cmp/PublishWorkflow.ts"],"names":[],"mappings":";AAAA,qDAAqD;;;AAErD,uCAA2D;AAE3D,oCAGiB;AAEj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;;;4BASzB,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI;;;;;yBAKlB,KAAK;;;;;;;;;;;;;;;EAe5B,OAAO;;;;;;;;;;;;;;;;;;aAkBI,QAAQ;;uBAEE,GAAG;qBACL,UAAU,IAAI,gBAAgB;eACpC,KAAK;;EAElB,UAAU;mBACO,GAAG;qBACD,GAAG;;;IAGpB,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BR,CAAA;AACD,CAAC"}
package/dist/sdkgen.d.ts CHANGED
@@ -14,6 +14,7 @@ import { AgentGuideFeature } from './cmp/AgentGuideFeature';
14
14
  import { License } from './cmp/License';
15
15
  import { Security } from './cmp/Security';
16
16
  import { PublishWorkflow } from './cmp/PublishWorkflow';
17
+ import { npmTrustScript } from './admin/npm-trust';
17
18
  import { Changelog } from './cmp/Changelog';
18
19
  import { Test } from './cmp/Test';
19
20
  import { TestControl, TEST_CONTROL_EXCLUDE } from './cmp/TestControl';
@@ -138,4 +139,4 @@ export declare const Inject: Component;
138
139
  export declare const Line: Component;
139
140
  export declare const Slot: Component;
140
141
  export declare const List: Component;
141
- export { Main, Deploy, License, Security, PublishWorkflow, Changelog, Entity, Feature, Test, TestControl, TEST_CONTROL_EXCLUDE, Readme, ReadmeTop, AgentGuideTop, AgentGuide, AgentGuideFeature, ReadmeInstall, ReadmeQuick, ReadmeErrors, ReadmeIntro, ReadmeModel, ReadmeOptions, ReadmeEntity, ReadmeHowto, ReadmeExplanation, ReadmeRef, ReadmeRefFeatures, FeatureHook, registerComponent, resolvedFor, liveHint, pointFacts, hasLiveScenarios, Jostraca, SdkGen, requirePath, isAuthActive, resolveAuthPrefix, resolveAuthIn, resolveAuthName, isAuthSuppressed, isHttpBasicAuth, CONFIG_DATA_THRESHOLD, CONFIG_REPR_VALUES, isConfigData, configRepr, configReprSetting, configDefinition, clean, rawStringLiteral, SdkGenError, buildIdNames, entityRelationName, flowSteps, getMatchEntries, collectDeps, pointSegments, pointParts, pointTerminalParam, pointPathKey, canonToType, canonToSpec, entityDataSpec, entityOpSpec, entitySpecs, optionSpec, featureOptionSpec, entitySpecMap, canonToDtype, canonKey, canonScalarKey, OP_SUFFIX, opTypeName, opParams, ownPoint, opActions, entityActions, entityPath, opRequestShape, entityIdField, entityDataIdField, entityOps, entityPrimaryOp, pickExampleEntity, entityClassName, entityTypeCollisions, warnEntityTypeCollisions, deriveEntityNames, entityCollection, guardModelNames, isReservedName, safeVarName, exampleVarName, phpEntityAccessor, entityCacheField, isRbCoreConstant, isRbSdkConstant, rbSafeTypeName, isSwiftSdkType, swiftSafeTypeName, isPhpReservedType, isPhpSdkClass, phpSafeTypeName, isTsReservedType, tsSafeTypeName, serverVariables, hasServerVariables, serverVarEnv, liveStrict, primaryOpCall, idLiteral, matchArg, dataArg, litFor, featureOf, availableFeatures, findFeatureSources, featureExcludes, fullsetExcludes, srcFeatureExcludes, pluginExcludes, pluginExcludesFor, stationLibrary, featureApplies, targetFeatures, featureTags, unknownTags, TAGS, definitionPath, definitionFolder, definitionNames, MANIFEST, manifestPath, readManifest, validateManifest, jsProp, jsOptProp, jsKey, luaKey, prefixLeadingDigit, packageName, sdkName, installCommand, registryState, isPublished, registryName, vendorCommand, pkgDescription, nonAffiliation, keywords, authorInfo, contributorList, envName, envToken, goModule, goVersion, goPackageIdent, packageVersion, repoInfo, apiName, langLabel, originName, PUBLISHER, PUBLISHER_URL, SECURITY_EMAIL, GENERATOR_URL, };
142
+ export { Main, Deploy, License, Security, PublishWorkflow, npmTrustScript, Changelog, Entity, Feature, Test, TestControl, TEST_CONTROL_EXCLUDE, Readme, ReadmeTop, AgentGuideTop, AgentGuide, AgentGuideFeature, ReadmeInstall, ReadmeQuick, ReadmeErrors, ReadmeIntro, ReadmeModel, ReadmeOptions, ReadmeEntity, ReadmeHowto, ReadmeExplanation, ReadmeRef, ReadmeRefFeatures, FeatureHook, registerComponent, resolvedFor, liveHint, pointFacts, hasLiveScenarios, Jostraca, SdkGen, requirePath, isAuthActive, resolveAuthPrefix, resolveAuthIn, resolveAuthName, isAuthSuppressed, isHttpBasicAuth, CONFIG_DATA_THRESHOLD, CONFIG_REPR_VALUES, isConfigData, configRepr, configReprSetting, configDefinition, clean, rawStringLiteral, SdkGenError, buildIdNames, entityRelationName, flowSteps, getMatchEntries, collectDeps, pointSegments, pointParts, pointTerminalParam, pointPathKey, canonToType, canonToSpec, entityDataSpec, entityOpSpec, entitySpecs, optionSpec, featureOptionSpec, entitySpecMap, canonToDtype, canonKey, canonScalarKey, OP_SUFFIX, opTypeName, opParams, ownPoint, opActions, entityActions, entityPath, opRequestShape, entityIdField, entityDataIdField, entityOps, entityPrimaryOp, pickExampleEntity, entityClassName, entityTypeCollisions, warnEntityTypeCollisions, deriveEntityNames, entityCollection, guardModelNames, isReservedName, safeVarName, exampleVarName, phpEntityAccessor, entityCacheField, isRbCoreConstant, isRbSdkConstant, rbSafeTypeName, isSwiftSdkType, swiftSafeTypeName, isPhpReservedType, isPhpSdkClass, phpSafeTypeName, isTsReservedType, tsSafeTypeName, serverVariables, hasServerVariables, serverVarEnv, liveStrict, primaryOpCall, idLiteral, matchArg, dataArg, litFor, featureOf, availableFeatures, findFeatureSources, featureExcludes, fullsetExcludes, srcFeatureExcludes, pluginExcludes, pluginExcludesFor, stationLibrary, featureApplies, targetFeatures, featureTags, unknownTags, TAGS, definitionPath, definitionFolder, definitionNames, MANIFEST, manifestPath, readManifest, validateManifest, jsProp, jsOptProp, jsKey, luaKey, prefixLeadingDigit, packageName, sdkName, installCommand, registryState, isPublished, registryName, vendorCommand, pkgDescription, nonAffiliation, keywords, authorInfo, contributorList, envName, envToken, goModule, goVersion, goPackageIdent, packageVersion, repoInfo, apiName, langLabel, originName, PUBLISHER, PUBLISHER_URL, SECURITY_EMAIL, GENERATOR_URL, };
package/dist/sdkgen.js CHANGED
@@ -37,10 +37,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
38
  };
39
39
  Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.ReadmeRef = exports.ReadmeExplanation = exports.ReadmeHowto = exports.ReadmeEntity = exports.ReadmeOptions = exports.ReadmeModel = exports.ReadmeIntro = exports.ReadmeErrors = exports.ReadmeQuick = exports.ReadmeInstall = exports.AgentGuideFeature = exports.AgentGuide = exports.AgentGuideTop = exports.ReadmeTop = exports.Readme = exports.TEST_CONTROL_EXCLUDE = exports.TestControl = exports.Test = exports.Feature = exports.Entity = exports.Changelog = exports.PublishWorkflow = exports.Security = exports.License = exports.Deploy = exports.Main = exports.List = exports.Slot = exports.Line = exports.Inject = exports.Fragment = exports.Copy = exports.Content = exports.File = exports.Folder = exports.Project = exports.omap = exports.deep = exports.indent = exports.template = exports.getx = exports.get = exports.vmap = exports.cmap = exports.kebabify = exports.camelify = exports.snakify = exports.each = exports.names = exports.cmp = void 0;
41
- exports.entityActions = exports.opActions = exports.ownPoint = exports.opParams = exports.opTypeName = exports.OP_SUFFIX = exports.canonScalarKey = exports.canonKey = exports.canonToDtype = exports.entitySpecMap = exports.featureOptionSpec = exports.optionSpec = exports.entitySpecs = exports.entityOpSpec = exports.entityDataSpec = exports.canonToSpec = exports.canonToType = exports.pointPathKey = exports.pointTerminalParam = exports.pointParts = exports.pointSegments = exports.collectDeps = exports.getMatchEntries = exports.flowSteps = exports.entityRelationName = exports.buildIdNames = exports.SdkGenError = exports.rawStringLiteral = exports.clean = exports.configDefinition = exports.configReprSetting = exports.configRepr = exports.isConfigData = exports.CONFIG_REPR_VALUES = exports.CONFIG_DATA_THRESHOLD = exports.isHttpBasicAuth = exports.isAuthSuppressed = exports.resolveAuthName = exports.resolveAuthIn = exports.resolveAuthPrefix = exports.isAuthActive = exports.requirePath = exports.Jostraca = exports.hasLiveScenarios = exports.pointFacts = exports.liveHint = exports.resolvedFor = exports.registerComponent = exports.FeatureHook = exports.ReadmeRefFeatures = void 0;
42
- exports.unknownTags = exports.featureTags = exports.targetFeatures = exports.featureApplies = exports.stationLibrary = exports.pluginExcludesFor = exports.pluginExcludes = exports.srcFeatureExcludes = exports.fullsetExcludes = exports.featureExcludes = exports.findFeatureSources = exports.availableFeatures = exports.featureOf = exports.litFor = exports.dataArg = exports.matchArg = exports.idLiteral = exports.primaryOpCall = exports.liveStrict = exports.serverVarEnv = exports.hasServerVariables = exports.serverVariables = exports.tsSafeTypeName = exports.isTsReservedType = exports.phpSafeTypeName = exports.isPhpSdkClass = exports.isPhpReservedType = exports.swiftSafeTypeName = exports.isSwiftSdkType = exports.rbSafeTypeName = exports.isRbSdkConstant = exports.isRbCoreConstant = exports.entityCacheField = exports.phpEntityAccessor = exports.exampleVarName = exports.safeVarName = exports.isReservedName = exports.guardModelNames = exports.entityCollection = exports.deriveEntityNames = exports.warnEntityTypeCollisions = exports.entityTypeCollisions = exports.entityClassName = exports.pickExampleEntity = exports.entityPrimaryOp = exports.entityOps = exports.entityDataIdField = exports.entityIdField = exports.opRequestShape = exports.entityPath = void 0;
43
- exports.GENERATOR_URL = exports.SECURITY_EMAIL = exports.PUBLISHER_URL = exports.PUBLISHER = exports.originName = exports.langLabel = exports.apiName = exports.repoInfo = exports.packageVersion = exports.goPackageIdent = exports.goVersion = exports.goModule = exports.envToken = exports.envName = exports.contributorList = exports.authorInfo = exports.keywords = exports.nonAffiliation = exports.pkgDescription = exports.vendorCommand = exports.registryName = exports.isPublished = exports.registryState = exports.installCommand = exports.sdkName = exports.packageName = exports.prefixLeadingDigit = exports.luaKey = exports.jsKey = exports.jsOptProp = exports.jsProp = exports.validateManifest = exports.readManifest = exports.manifestPath = exports.MANIFEST = exports.definitionNames = exports.definitionFolder = exports.definitionPath = exports.TAGS = void 0;
40
+ exports.ReadmeExplanation = exports.ReadmeHowto = exports.ReadmeEntity = exports.ReadmeOptions = exports.ReadmeModel = exports.ReadmeIntro = exports.ReadmeErrors = exports.ReadmeQuick = exports.ReadmeInstall = exports.AgentGuideFeature = exports.AgentGuide = exports.AgentGuideTop = exports.ReadmeTop = exports.Readme = exports.TEST_CONTROL_EXCLUDE = exports.TestControl = exports.Test = exports.Feature = exports.Entity = exports.Changelog = exports.npmTrustScript = exports.PublishWorkflow = exports.Security = exports.License = exports.Deploy = exports.Main = exports.List = exports.Slot = exports.Line = exports.Inject = exports.Fragment = exports.Copy = exports.Content = exports.File = exports.Folder = exports.Project = exports.omap = exports.deep = exports.indent = exports.template = exports.getx = exports.get = exports.vmap = exports.cmap = exports.kebabify = exports.camelify = exports.snakify = exports.each = exports.names = exports.cmp = void 0;
41
+ exports.opActions = exports.ownPoint = exports.opParams = exports.opTypeName = exports.OP_SUFFIX = exports.canonScalarKey = exports.canonKey = exports.canonToDtype = exports.entitySpecMap = exports.featureOptionSpec = exports.optionSpec = exports.entitySpecs = exports.entityOpSpec = exports.entityDataSpec = exports.canonToSpec = exports.canonToType = exports.pointPathKey = exports.pointTerminalParam = exports.pointParts = exports.pointSegments = exports.collectDeps = exports.getMatchEntries = exports.flowSteps = exports.entityRelationName = exports.buildIdNames = exports.SdkGenError = exports.rawStringLiteral = exports.clean = exports.configDefinition = exports.configReprSetting = exports.configRepr = exports.isConfigData = exports.CONFIG_REPR_VALUES = exports.CONFIG_DATA_THRESHOLD = exports.isHttpBasicAuth = exports.isAuthSuppressed = exports.resolveAuthName = exports.resolveAuthIn = exports.resolveAuthPrefix = exports.isAuthActive = exports.requirePath = exports.Jostraca = exports.hasLiveScenarios = exports.pointFacts = exports.liveHint = exports.resolvedFor = exports.registerComponent = exports.FeatureHook = exports.ReadmeRefFeatures = exports.ReadmeRef = void 0;
42
+ exports.featureTags = exports.targetFeatures = exports.featureApplies = exports.stationLibrary = exports.pluginExcludesFor = exports.pluginExcludes = exports.srcFeatureExcludes = exports.fullsetExcludes = exports.featureExcludes = exports.findFeatureSources = exports.availableFeatures = exports.featureOf = exports.litFor = exports.dataArg = exports.matchArg = exports.idLiteral = exports.primaryOpCall = exports.liveStrict = exports.serverVarEnv = exports.hasServerVariables = exports.serverVariables = exports.tsSafeTypeName = exports.isTsReservedType = exports.phpSafeTypeName = exports.isPhpSdkClass = exports.isPhpReservedType = exports.swiftSafeTypeName = exports.isSwiftSdkType = exports.rbSafeTypeName = exports.isRbSdkConstant = exports.isRbCoreConstant = exports.entityCacheField = exports.phpEntityAccessor = exports.exampleVarName = exports.safeVarName = exports.isReservedName = exports.guardModelNames = exports.entityCollection = exports.deriveEntityNames = exports.warnEntityTypeCollisions = exports.entityTypeCollisions = exports.entityClassName = exports.pickExampleEntity = exports.entityPrimaryOp = exports.entityOps = exports.entityDataIdField = exports.entityIdField = exports.opRequestShape = exports.entityPath = exports.entityActions = void 0;
43
+ exports.GENERATOR_URL = exports.SECURITY_EMAIL = exports.PUBLISHER_URL = exports.PUBLISHER = exports.originName = exports.langLabel = exports.apiName = exports.repoInfo = exports.packageVersion = exports.goPackageIdent = exports.goVersion = exports.goModule = exports.envToken = exports.envName = exports.contributorList = exports.authorInfo = exports.keywords = exports.nonAffiliation = exports.pkgDescription = exports.vendorCommand = exports.registryName = exports.isPublished = exports.registryState = exports.installCommand = exports.sdkName = exports.packageName = exports.prefixLeadingDigit = exports.luaKey = exports.jsKey = exports.jsOptProp = exports.jsProp = exports.validateManifest = exports.readManifest = exports.manifestPath = exports.MANIFEST = exports.definitionNames = exports.definitionFolder = exports.definitionPath = exports.TAGS = exports.unknownTags = void 0;
44
44
  exports.SdkGen = SdkGen;
45
45
  const node_fs_1 = __importDefault(require("node:fs"));
46
46
  const node_path_1 = __importDefault(require("node:path"));
@@ -97,6 +97,8 @@ const Security_1 = require("./cmp/Security");
97
97
  Object.defineProperty(exports, "Security", { enumerable: true, get: function () { return Security_1.Security; } });
98
98
  const PublishWorkflow_1 = require("./cmp/PublishWorkflow");
99
99
  Object.defineProperty(exports, "PublishWorkflow", { enumerable: true, get: function () { return PublishWorkflow_1.PublishWorkflow; } });
100
+ const npm_trust_1 = require("./admin/npm-trust");
101
+ Object.defineProperty(exports, "npmTrustScript", { enumerable: true, get: function () { return npm_trust_1.npmTrustScript; } });
100
102
  const Changelog_1 = require("./cmp/Changelog");
101
103
  Object.defineProperty(exports, "Changelog", { enumerable: true, get: function () { return Changelog_1.Changelog; } });
102
104
  const Test_1 = require("./cmp/Test");