@voxgig/create-sdkgen 0.16.3 → 0.16.5

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/create-sdkgen CHANGED
@@ -14,6 +14,32 @@ const { CreateSdkGen } = require('../dist/create-sdkgen.js')
14
14
 
15
15
  let KONSOLE = global['con'+'sole']
16
16
 
17
+ // Print stack traces only when the user actually selected a verbose level.
18
+ // Read from argv directly: handleError can fire before options are parsed.
19
+ //
20
+ // Both spellings must agree. `--debug=warn` carries its value in one token,
21
+ // but the space-separated `--debug warn` leaves a BARE `--debug` in argv — so
22
+ // matching a bare token turned stacks on for every level, including warn/error,
23
+ // while the `=` form correctly did not.
24
+ function debugLevel() {
25
+ const argv = process.argv
26
+ for (let i = 0; i < argv.length; i++) {
27
+ const a = argv[i]
28
+ if (a.startsWith('--debug=')) {
29
+ return a.slice('--debug='.length)
30
+ }
31
+ if ('--debug' === a) {
32
+ // Bare flag: the level is the NEXT token, unless another option follows
33
+ // (or nothing does), in which case no level was selected.
34
+ const next = argv[i + 1]
35
+ return (null != next && !next.startsWith('-')) ? next : ''
36
+ }
37
+ }
38
+ return ''
39
+ }
40
+
41
+ const DEBUG_STACK = ['debug', 'trace'].includes(debugLevel())
42
+
17
43
  run()
18
44
 
19
45
 
@@ -35,7 +61,11 @@ async function run() {
35
61
 
36
62
  options = validateOptions(options)
37
63
 
38
- generate(options)
64
+ // AWAIT: generate() is async. Dropping the promise meant every async
65
+ // failure (a failing `npm install` / `add-target`, a write error) escaped
66
+ // this catch and surfaced as a raw unhandled-rejection crash dump instead
67
+ // of a Voxgig error message with a non-zero exit.
68
+ await generate(options)
39
69
  }
40
70
  catch(err) {
41
71
  handleError(err)
@@ -52,7 +82,7 @@ function exit(err) {
52
82
  }
53
83
 
54
84
 
55
- function generate(options) {
85
+ async function generate(options) {
56
86
  const createSdkGen = CreateSdkGen({
57
87
  debug: options.debug
58
88
  })
@@ -72,8 +102,8 @@ function generate(options) {
72
102
  }
73
103
 
74
104
  // console.log('OPTIONS', options)
75
-
76
- createSdkGen.generate(spec)
105
+
106
+ return createSdkGen.generate(spec)
77
107
  }
78
108
 
79
109
 
@@ -215,10 +245,18 @@ function validateOptions(rawOptions) {
215
245
 
216
246
 
217
247
  function handleError(err) {
218
- console.log(err)
219
- console.trace()
220
-
221
- KONSOLE.log('Voxgig Create SDK Error: '+err)
248
+ // The message is the useful part; the stack is noise for a CLI user and
249
+ // used to be printed BEFORE the message (twice, with a bare console.trace()
250
+ // pointing at handleError itself rather than at the failure). Keep the
251
+ // stack behind --debug for the cases where it is actually wanted.
252
+ const msg = (err && err.message) ? err.message : String(err)
253
+
254
+ KONSOLE.log('Voxgig Create SDK Error: ' + msg)
255
+
256
+ if (DEBUG_STACK && err && err.stack) {
257
+ KONSOLE.log(err.stack)
258
+ }
259
+
222
260
  exit(err)
223
261
  }
224
262
 
@@ -76,7 +76,12 @@ function CreateSdkGen(opts) {
76
76
  node_path_1.default.join(cwd, name + (name.endsWith('-sdk') ? '' : '-sdk')) :
77
77
  node_path_1.default.isAbsolute(spec.folder) ? spec.folder :
78
78
  node_path_1.default.join(cwd, spec.folder);
79
- logCreate(folder);
79
+ // A dry run must not touch the filesystem — logCreate() mkdir's
80
+ // <folder>/.sdk/log and appends to create.log, which created a real
81
+ // directory tree for a run that is supposed to write nothing.
82
+ if (!dryrun) {
83
+ logCreate(folder);
84
+ }
80
85
  const jopts = {
81
86
  fs: () => fs,
82
87
  debug,
@@ -209,6 +214,27 @@ async function installNpm(spec, opts, model) {
209
214
  log.info({ point: 'generate-install', note: 'running npm install in ' + cwd });
210
215
  await runNpm(['install'], spawn_opts);
211
216
  }
217
+ // `-t` / `-f` are INDEPENDENT of `--no-install`: the documented contract is
218
+ // that --no-install skips `npm install`, not that it drops the requested
219
+ // targets and features. Adding them is still valid without an install when
220
+ // the project already has its toolchain (re-scaffolding an existing folder
221
+ // is a supported flow — "if run against an existing folder generated files
222
+ // will be overwritten").
223
+ //
224
+ // They ARE npm run scripts that resolve @voxgig/sdkgen from node_modules, so
225
+ // without one they cannot work. Fail with an actionable message rather than
226
+ // the raw module-resolution error — and rather than silently skipping, which
227
+ // reports success while leaving config.aontu without the requested entries.
228
+ const wanted = [
229
+ (spec.target ?? []).length ? '--target' : '',
230
+ (spec.feature ?? []).length ? '--feature' : '',
231
+ ].filter(Boolean);
232
+ if (0 < wanted.length && !Fs.existsSync(node_path_1.default.join(cwd, 'node_modules'))) {
233
+ throw new Error(`${wanted.join(' / ')} needs the project toolchain, but ` +
234
+ `${node_path_1.default.join(cwd, 'node_modules')} does not exist ` +
235
+ `(--no-install was given). Re-run without --no-install, or run ` +
236
+ `\`npm install\` then \`npm run add-target\` / \`add-feature\` in ${cwd}.`);
237
+ }
212
238
  await installTargets(spec, opts, model, spawn_opts);
213
239
  await installFeatures(spec, opts, model, spawn_opts);
214
240
  }
@@ -1 +1 @@
1
- {"version":3,"file":"create-sdkgen.js","sourceRoot":"","sources":["../src/create-sdkgen.ts"],"names":[],"mappings":";AAAA,yDAAyD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0UvD,oCAAY;AAxUd,4CAA6B;AAC7B,4CAA6B;AAC7B,0DAA4B;AAC5B,iDAAqC;AAErC,yDAA0C;AAE1C,uCAA4D;AAE5D,mEAAiC;AA8BjC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAA;AAG1C,MAAM,UAAU,GAAG,MAAM,CAAA;AAGzB,2EAA2E;AAC3E,2BAA2B;AAC3B,SAAS,YAAY,CAAC,IAA6B;IACjD,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,IAAI,EAAE,CAAA;IAExB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;IACxB,MAAM,IAAI,GAAG,IAAA,iBAAU,EAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;IACvC,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,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B,EAAE,MAAM,EAAE,UAAU;QAC5C,IAAI,EAAE,kBAAkB,GAAG,UAAU;KACtC,CAAC,CAAA;IAEF,MAAM,MAAM,CAAC,CAAC,KAAK,EAAE,YAAY,EAAE,UAAU,CAAC,EAAE,UAAU,CAAC,CAAA;AAC7D,CAAC;AAGD,KAAK,UAAU,eAAe,CAAC,IAAkB,EAAE,IAAS,EAAE,KAAU,EAAE,UAAe;IACvF,MAAM,OAAO,GAAI,IAAI,CAAC,OAAoB,CAAA;IAE1C,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC;QAC5C,OAAM;IACR,CAAC;IAED,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAA;IACpB,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAErC,GAAG,CAAC,IAAI,CAAC;QACP,KAAK,EAAE,kBAAkB,EAAE,OAAO,EAAE,WAAW;QAC/C,IAAI,EAAE,mBAAmB,GAAG,WAAW;KACxC,CAAC,CAAA;IAEF,MAAM,MAAM,CAAC,CAAC,KAAK,EAAE,aAAa,EAAE,WAAW,CAAC,EAAE,UAAU,CAAC,CAAA;AAC/D,CAAC"}
@@ -12,8 +12,9 @@ const GITIGNORE_TOP = `# Local config / secrets
12
12
  *.local.*
13
13
  *.local
14
14
 
15
- # Dependencies
16
- node_modules/
15
+ # Dependencies (no trailing slash: also ignores node_modules SYMLINKS, e.g.
16
+ # ts/node_modules -> shared tree, which a dir-only rule leaves tracked)
17
+ node_modules
17
18
 
18
19
  # Logs
19
20
  *.log
@@ -30,8 +31,9 @@ const GITIGNORE_SDK = `# Local config / secrets
30
31
  *.local.*
31
32
  *.local
32
33
 
33
- # Dependencies
34
- node_modules/
34
+ # Dependencies (no trailing slash: also ignores node_modules SYMLINKS, e.g.
35
+ # .sdk/node_modules -> shared tree, which a dir-only rule leaves tracked)
36
+ node_modules
35
37
 
36
38
  # Build output
37
39
  dist/
@@ -45,6 +47,47 @@ log/
45
47
  # OS
46
48
  .DS_Store
47
49
  `;
50
+ // The guide overlay is the ONE model file the user owns.
51
+ //
52
+ // Everything else the scaffold writes is toolchain-derived and is deliberately
53
+ // OVERWRITTEN (see the `existing.txt.write` rationale in create-sdkgen.ts) so a
54
+ // toolchain fix propagates. `model/guide/guide.aontu` is the exception: apidef
55
+ // unifies it OVER the heuristic classification, and it is where every
56
+ // documented customization lives — entity rename, hide, move, activate,
57
+ // per-path deactivation, method override, param rename, response transform.
58
+ // Copying the stub over it destroyed that work on every re-scaffold, and
59
+ // cedar-regen.sh re-scaffolds on every regen, so the loss was silent and
60
+ // repeated.
61
+ //
62
+ // It is excluded from the bulk Copy and merged instead (see mergeGuide).
63
+ const GUIDE_FILE = 'guide.aontu';
64
+ const GUIDE_REL = ['model', 'guide', GUIDE_FILE];
65
+ // Merge the guide template into an existing guide overlay.
66
+ //
67
+ // A guide is the template's `@`-includes plus whatever the user added. The
68
+ // includes are the only part the template OWNS, so the merge is: keep the
69
+ // user's file verbatim, and restore any include it is missing. When nothing
70
+ // is missing — the normal case — the file is returned byte-identical, so a
71
+ // re-scaffold is a no-op on it.
72
+ //
73
+ // Missing includes are restored at the TOP, not appended: `base-guide.aontu`
74
+ // carries the heuristic classification that the user's overrides unify over,
75
+ // and the overlay reads correctly only when the includes precede it.
76
+ function mergeGuide(existing, template) {
77
+ if (null == existing) {
78
+ return template;
79
+ }
80
+ const isInclude = (line) => line.trim().startsWith('@');
81
+ const have = new Set(existing.split('\n').map((line) => line.trim()));
82
+ const missing = template.split('\n')
83
+ .filter(isInclude)
84
+ .map((line) => line.trim())
85
+ .filter((line) => !have.has(line));
86
+ if (0 === missing.length) {
87
+ return existing;
88
+ }
89
+ return missing.join('\n') + '\n\n' + existing;
90
+ }
48
91
  // TODO: rename to RootSdk
49
92
  const CreateRoot = (0, jostraca_1.cmp)(function CreateRoot(props) {
50
93
  const { ctx$, ctx$: { folder }, spec, model } = props;
@@ -60,9 +103,13 @@ const CreateRoot = (0, jostraca_1.cmp)(function CreateRoot(props) {
60
103
  (0, jostraca_1.Project)({ folder }, () => {
61
104
  const from = node_path_1.default.resolve(node_path_1.default.join(__dirname, '..', '..', '..', 'project', 'standard'));
62
105
  // console.log('FROM', from)
106
+ // Copy `exclude` matches the SOURCE-RELATIVE path exactly, so this names
107
+ // the one guide under the scaffold and nothing else. It is re-emitted,
108
+ // merged, in the model folder below.
109
+ const guideExclude = [spec.sdk_folder, ...GUIDE_REL].join('/');
63
110
  (0, jostraca_1.Copy)({
64
111
  from,
65
- exclude: [/\.fragment\./]
112
+ exclude: [/\.fragment\./, guideExclude]
66
113
  });
67
114
  (0, jostraca_1.File)({ name: '.gitignore' }, () => {
68
115
  (0, jostraca_1.Content)(GITIGNORE_TOP);
@@ -87,6 +134,17 @@ const CreateRoot = (0, jostraca_1.cmp)(function CreateRoot(props) {
87
134
  });
88
135
  (0, jostraca_1.Folder)({ name: 'model' }, () => {
89
136
  (0, ModelSdk_1.ModelSdk)({ spec });
137
+ // Re-emit the guide the Copy skipped, merged over whatever is already
138
+ // there. On a fresh scaffold there is no existing file and this writes
139
+ // the template unchanged; on a re-scaffold the user's overlay survives.
140
+ (0, jostraca_1.Folder)({ name: 'guide' }, () => {
141
+ const guideTemplate = fs.readFileSync(node_path_1.default.join(from, spec.sdk_folder, ...GUIDE_REL), 'utf8');
142
+ const guidePath = node_path_1.default.join(folder, spec.sdk_folder, ...GUIDE_REL);
143
+ const existingGuide = fs.existsSync(guidePath) ? fs.readFileSync(guidePath, 'utf8') : null;
144
+ (0, jostraca_1.File)({ name: GUIDE_FILE }, () => {
145
+ (0, jostraca_1.Content)(mergeGuide(existingGuide, guideTemplate));
146
+ });
147
+ });
90
148
  });
91
149
  });
92
150
  });
@@ -1 +1 @@
1
- {"version":3,"file":"CreateRoot.js","sourceRoot":"","sources":["../../../src/project/standard/CreateRoot.ts"],"names":[],"mappings":";;;;;;AAEA,0DAA4B;AAC5B,gCAAgC;AA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C,CAAA;QAIA,QAAQ"}
@@ -1 +1 @@
1
- {"root":["../src/create-sdkgen.ts","../src/project/standard/CreateRoot.ts","../src/project/standard/ModelSdk.ts"],"version":"6.0.3"}
1
+ {"version":"7.0.2","root":["../src/create-sdkgen.ts","../src/project/standard/CreateRoot.ts","../src/project/standard/ModelSdk.ts"],"packageJsons":["../node_modules/@types/node/package.json","../node_modules/@voxgig/util/package.json","../node_modules/jostraca/package.json","../node_modules/memfs/package.json","../node_modules/pino-pretty/package.json","../node_modules/pino-std-serializers/package.json","../node_modules/pino/package.json","../node_modules/shape/package.json","../node_modules/sonic-boom/package.json","../node_modules/thread-stream/package.json","../node_modules/undici-types/package.json","../package.json"],"missingPackageJsons":["../node_modules/@types/assert/package.json","../node_modules/@types/assert/strict/package.json","../node_modules/@types/async_hooks/package.json","../node_modules/@types/buffer/package.json","../node_modules/@types/child_process/package.json","../node_modules/@types/cluster/package.json","../node_modules/@types/console/package.json","../node_modules/@types/constants/package.json","../node_modules/@types/crypto/package.json","../node_modules/@types/dgram/package.json","../node_modules/@types/diagnostics_channel/package.json","../node_modules/@types/dns/package.json","../node_modules/@types/dns/promises/package.json","../node_modules/@types/domain/package.json","../node_modules/@types/events/package.json","../node_modules/@types/fs/package.json","../node_modules/@types/fs/promises/package.json","../node_modules/@types/http/package.json","../node_modules/@types/http2/package.json","../node_modules/@types/https/package.json","../node_modules/@types/inspector/package.json","../node_modules/@types/inspector/promises/package.json","../node_modules/@types/module/package.json","../node_modules/@types/net/package.json","../node_modules/@types/node/assert/package.json","../node_modules/@types/node/dns/package.json","../node_modules/@types/node/fs/package.json","../node_modules/@types/node/inspector/package.json","../node_modules/@types/node/path/package.json","../node_modules/@types/node/readline/package.json","../node_modules/@types/node/stream/package.json","../node_modules/@types/node/test/package.json","../node_modules/@types/node/timers/package.json","../node_modules/@types/node/util/package.json","../node_modules/@types/node/web-globals/package.json","../node_modules/@types/node/zlib/package.json","../node_modules/@types/os/package.json","../node_modules/@types/path/package.json","../node_modules/@types/path/posix/package.json","../node_modules/@types/path/win32/package.json","../node_modules/@types/perf_hooks/package.json","../node_modules/@types/process/package.json","../node_modules/@types/punycode/package.json","../node_modules/@types/querystring/package.json","../node_modules/@types/readline/package.json","../node_modules/@types/readline/promises/package.json","../node_modules/@types/repl/package.json","../node_modules/@types/stream/consumers/package.json","../node_modules/@types/stream/iter/package.json","../node_modules/@types/stream/package.json","../node_modules/@types/stream/promises/package.json","../node_modules/@types/stream/web/package.json","../node_modules/@types/string_decoder/package.json","../node_modules/@types/timers/package.json","../node_modules/@types/timers/promises/package.json","../node_modules/@types/tls/package.json","../node_modules/@types/trace_events/package.json","../node_modules/@types/tty/package.json","../node_modules/@types/url/package.json","../node_modules/@types/util/package.json","../node_modules/@types/util/types/package.json","../node_modules/@types/v8/package.json","../node_modules/@types/vm/package.json","../node_modules/@types/wasi/package.json","../node_modules/@types/worker_threads/package.json","../node_modules/@types/zlib/package.json","../node_modules/@voxgig/util/dist/package.json","../node_modules/assert/package.json","../node_modules/assert/strict/package.json","../node_modules/async_hooks/package.json","../node_modules/buffer/package.json","../node_modules/child_process/package.json","../node_modules/cluster/package.json","../node_modules/console/package.json","../node_modules/constants/package.json","../node_modules/crypto/package.json","../node_modules/dgram/package.json","../node_modules/diagnostics_channel/package.json","../node_modules/dns/package.json","../node_modules/dns/promises/package.json","../node_modules/domain/package.json","../node_modules/events/package.json","../node_modules/fs/package.json","../node_modules/fs/promises/package.json","../node_modules/http/package.json","../node_modules/http2/package.json","../node_modules/https/package.json","../node_modules/inspector/package.json","../node_modules/inspector/promises/package.json","../node_modules/jostraca/dist/build/package.json","../node_modules/jostraca/dist/cmp/package.json","../node_modules/jostraca/dist/package.json","../node_modules/jostraca/dist/util/package.json","../node_modules/module/package.json","../node_modules/net/package.json","../node_modules/os/package.json","../node_modules/path/package.json","../node_modules/path/posix/package.json","../node_modules/path/win32/package.json","../node_modules/perf_hooks/package.json","../node_modules/process/package.json","../node_modules/punycode/package.json","../node_modules/querystring/package.json","../node_modules/readline/package.json","../node_modules/readline/promises/package.json","../node_modules/repl/package.json","../node_modules/shape/dist/package.json","../node_modules/sonic-boom/types/package.json","../node_modules/stream/consumers/package.json","../node_modules/stream/iter/package.json","../node_modules/stream/package.json","../node_modules/stream/promises/package.json","../node_modules/stream/web/package.json","../node_modules/string_decoder/package.json","../node_modules/thread-stream/node_modules/events/package.json","../node_modules/thread-stream/node_modules/worker_threads/package.json","../node_modules/timers/package.json","../node_modules/timers/promises/package.json","../node_modules/tls/package.json","../node_modules/trace_events/package.json","../node_modules/tty/package.json","../node_modules/url/package.json","../node_modules/util/package.json","../node_modules/util/types/package.json","../node_modules/v8/package.json","../node_modules/vm/package.json","../node_modules/wasi/package.json","../node_modules/worker_threads/package.json","../node_modules/zlib/package.json"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voxgig/create-sdkgen",
3
- "version": "0.16.3",
3
+ "version": "0.16.5",
4
4
  "main": "dist/create-sdkgen.js",
5
5
  "type": "commonjs",
6
6
  "types": "dist/create-sdkgen.d.ts",
@@ -33,8 +33,8 @@
33
33
  "repo-tag-dry": "REPO_VERSION=`node -e \"console.log(require('./package').version)\"` && echo \"[dry-run] TAG: v$REPO_VERSION\" && if git rev-parse -q --verify refs/tags/v$REPO_VERSION >/dev/null; then echo \"[dry-run] WARNING: tag v$REPO_VERSION already exists - bump the version first\"; else echo \"[dry-run] would commit -a, push, tag v$REPO_VERSION and push --tags; nothing done\"; fi && git status --short",
34
34
  "repo-publish": "npm run clean && npm i && npm run repo-publish-quick",
35
35
  "repo-publish-dry": "npm run clean && npm i && npm run repo-publish-quick-dry",
36
- "repo-publish-quick": "npm run build && npm run test && npm publish --registry https://registry.npmjs.org --access=public",
37
- "repo-publish-quick-dry": "npm run build && npm run test && ( npm publish --dry-run --registry https://registry.npmjs.org --access=public || echo \"[dry-run] npm publish refused (see npm error above) - usually the version is already published; bump package.json before a real release\" )",
36
+ "repo-publish-quick": "npm run build && npm run test && npm stage publish --registry https://registry.npmjs.org --access=public",
37
+ "repo-publish-quick-dry": "npm run build && npm run test && ( npm stage publish --dry-run --registry https://registry.npmjs.org --access=public || echo \"[dry-run] npm stage publish refused (see npm error above) - usually the version is already published; bump package.json before a real release\" )",
38
38
  "repo-release": "npm run repo-publish && npm run repo-tag",
39
39
  "repo-release-dry": "npm run repo-publish-quick-dry && npm run repo-tag-dry"
40
40
  },
@@ -47,15 +47,15 @@
47
47
  "LICENSE"
48
48
  ],
49
49
  "devDependencies": {
50
- "@types/node": "26.1.0",
51
- "memfs": "4.62.0",
52
- "typescript": "6.0.3"
50
+ "@types/node": "26.1.2",
51
+ "memfs": "4.64.0",
52
+ "typescript": "7.0.2"
53
53
  },
54
54
  "dependencies": {
55
- "@voxgig/util": "0.5.1",
56
- "aontu": "0.48.1",
55
+ "@voxgig/util": "0.5.4",
56
+ "aontu": "0.48.2",
57
57
  "chokidar": "5.0.0",
58
- "jostraca": "0.31.0",
59
- "shape": "10.1.0"
58
+ "jostraca": "0.31.2",
59
+ "shape": "10.1.3"
60
60
  }
61
61
  }
@@ -8,6 +8,30 @@ name: ci
8
8
  # Live API verification is NOT run here. It happens in the central
9
9
  # rebuild pipeline under controlled conditions, with per-API auth and
10
10
  # rate-limit handling.
11
+ #
12
+ # ---------------------------------------------------------------------------
13
+ # COVERAGE TIERS
14
+ #
15
+ # sdkgen generates 22 language targets; this workflow used to have jobs for
16
+ # eight of them (go, go-cli, go-mcp, ts, py, rb, php, lua). The other
17
+ # fourteen were generated into every SDK repo and never compiled or tested
18
+ # there, so a template regression in, say, rust or swift could only be found
19
+ # by hand.
20
+ #
21
+ # BLOCKING — proven jobs. A failure here fails the build.
22
+ # go, go-cli, go-mcp, ts, py, rb, php, lua
23
+ #
24
+ # ADVISORY — added to close the coverage gap, marked continue-on-error until
25
+ # each has had a green run in a real SDK repo. They report problems without
26
+ # blocking a release; promote a job to blocking (drop continue-on-error) once
27
+ # it has passed. Do not leave one advisory indefinitely — an advisory job that
28
+ # is always red is the same blind spot in a different costume.
29
+ # js, csharp, java, kotlin, scala, swift, dart, rust, c, cpp, zig, perl,
30
+ # clojure, elixir, ocaml, haskell
31
+ #
32
+ # Every target exposes `make -C <lang> test`, so the jobs differ only in
33
+ # toolchain setup.
34
+ # ---------------------------------------------------------------------------
11
35
 
12
36
  on:
13
37
  push:
@@ -138,3 +162,211 @@ jobs:
138
162
  run: luarocks install busted
139
163
  - if: hashFiles('lua/Makefile') != ''
140
164
  run: make -C lua test
165
+
166
+ # ---- ADVISORY (see COVERAGE TIERS above) ---------------------------------
167
+
168
+ js:
169
+ runs-on: ubuntu-latest
170
+ continue-on-error: true
171
+ steps:
172
+ - uses: actions/checkout@v4
173
+ - if: hashFiles('js/Makefile') != ''
174
+ uses: actions/setup-node@v4
175
+ with:
176
+ node-version: '24'
177
+ - if: hashFiles('js/package.json') != ''
178
+ run: cd js && npm install --no-audit --no-fund
179
+ - if: hashFiles('js/Makefile') != ''
180
+ run: make -C js test
181
+
182
+ csharp:
183
+ runs-on: ubuntu-latest
184
+ continue-on-error: true
185
+ steps:
186
+ - uses: actions/checkout@v4
187
+ - if: hashFiles('csharp/Makefile') != ''
188
+ uses: actions/setup-dotnet@v4
189
+ with:
190
+ dotnet-version: '8.0.x'
191
+ - if: hashFiles('csharp/Makefile') != ''
192
+ run: make -C csharp test
193
+
194
+ java:
195
+ runs-on: ubuntu-latest
196
+ continue-on-error: true
197
+ steps:
198
+ - uses: actions/checkout@v4
199
+ - if: hashFiles('java/Makefile') != ''
200
+ uses: actions/setup-java@v4
201
+ with:
202
+ distribution: temurin
203
+ java-version: '21'
204
+ - if: hashFiles('java/Makefile') != ''
205
+ run: make -C java test
206
+
207
+ kotlin:
208
+ runs-on: ubuntu-latest
209
+ continue-on-error: true
210
+ steps:
211
+ - uses: actions/checkout@v4
212
+ - if: hashFiles('kotlin/Makefile') != ''
213
+ uses: actions/setup-java@v4
214
+ with:
215
+ distribution: temurin
216
+ java-version: '21'
217
+ - if: hashFiles('kotlin/Makefile') != ''
218
+ run: make -C kotlin test
219
+
220
+ scala:
221
+ runs-on: ubuntu-latest
222
+ continue-on-error: true
223
+ steps:
224
+ - uses: actions/checkout@v4
225
+ - if: hashFiles('scala/Makefile') != ''
226
+ uses: actions/setup-java@v4
227
+ with:
228
+ distribution: temurin
229
+ java-version: '21'
230
+ # scala-cli, NOT sbt: the generated Makefile runs
231
+ # `scala-cli run . --main-class ...` and there is no build.sbt.
232
+ #
233
+ # Pinned to a release tag, not @main: every generated SDK runs this
234
+ # workflow, so a mutable default branch would let an upstream push change
235
+ # what executes in every consumer's CI with no change or review in their
236
+ # repo. Matches how the other third-party setup actions here are pinned.
237
+ - if: hashFiles('scala/Makefile') != ''
238
+ uses: VirtusLab/scala-cli-setup@v1.5.1
239
+ - if: hashFiles('scala/Makefile') != ''
240
+ run: make -C scala test
241
+
242
+ swift:
243
+ runs-on: ubuntu-latest
244
+ continue-on-error: true
245
+ steps:
246
+ - uses: actions/checkout@v4
247
+ - if: hashFiles('swift/Makefile') != ''
248
+ uses: swift-actions/setup-swift@v2
249
+ with:
250
+ swift-version: '6.0'
251
+ - if: hashFiles('swift/Makefile') != ''
252
+ run: make -C swift test
253
+
254
+ dart:
255
+ runs-on: ubuntu-latest
256
+ continue-on-error: true
257
+ steps:
258
+ - uses: actions/checkout@v4
259
+ - if: hashFiles('dart/Makefile') != ''
260
+ uses: dart-lang/setup-dart@v1
261
+ with:
262
+ sdk: stable
263
+ - if: hashFiles('dart/pubspec.yaml') != ''
264
+ run: cd dart && dart pub get
265
+ - if: hashFiles('dart/Makefile') != ''
266
+ run: make -C dart test
267
+
268
+ rust:
269
+ runs-on: ubuntu-latest
270
+ continue-on-error: true
271
+ steps:
272
+ - uses: actions/checkout@v4
273
+ - if: hashFiles('rust/Makefile') != ''
274
+ uses: dtolnay/rust-toolchain@stable
275
+ - if: hashFiles('rust/Makefile') != ''
276
+ run: make -C rust test
277
+
278
+ c:
279
+ runs-on: ubuntu-latest
280
+ continue-on-error: true
281
+ steps:
282
+ - uses: actions/checkout@v4
283
+ # gcc/make are preinstalled on ubuntu-latest — no setup step needed.
284
+ - if: hashFiles('c/Makefile') != ''
285
+ run: make -C c test
286
+
287
+ cpp:
288
+ runs-on: ubuntu-latest
289
+ continue-on-error: true
290
+ steps:
291
+ - uses: actions/checkout@v4
292
+ - if: hashFiles('cpp/Makefile') != ''
293
+ run: make -C cpp test
294
+
295
+ zig:
296
+ runs-on: ubuntu-latest
297
+ continue-on-error: true
298
+ steps:
299
+ - uses: actions/checkout@v4
300
+ # 0.13, NOT 0.14+: the generated build.zig.zon declares `.name` as a
301
+ # plain string, which 0.14 rejects ("expected enum literal"). Package_zig
302
+ # says the string form matches the target's toolchain pin — keep the two
303
+ # in step, or move both to the enum-literal + fingerprint form together.
304
+ - if: hashFiles('zig/build.zig') != ''
305
+ uses: mlugg/setup-zig@v1
306
+ with:
307
+ version: '0.13.0'
308
+ - if: hashFiles('zig/build.zig') != ''
309
+ run: make -C zig test
310
+
311
+ perl:
312
+ runs-on: ubuntu-latest
313
+ continue-on-error: true
314
+ steps:
315
+ - uses: actions/checkout@v4
316
+ # perl is preinstalled on ubuntu-latest.
317
+ - if: hashFiles('perl/Makefile') != ''
318
+ run: make -C perl test
319
+
320
+ clojure:
321
+ runs-on: ubuntu-latest
322
+ continue-on-error: true
323
+ steps:
324
+ - uses: actions/checkout@v4
325
+ - if: hashFiles('clojure/Makefile') != ''
326
+ uses: actions/setup-java@v4
327
+ with:
328
+ distribution: temurin
329
+ java-version: '21'
330
+ - if: hashFiles('clojure/Makefile') != ''
331
+ uses: DeLaGuardo/setup-clojure@13
332
+ with:
333
+ cli: latest
334
+ - if: hashFiles('clojure/Makefile') != ''
335
+ run: make -C clojure test
336
+
337
+ elixir:
338
+ runs-on: ubuntu-latest
339
+ continue-on-error: true
340
+ steps:
341
+ - uses: actions/checkout@v4
342
+ - if: hashFiles('elixir/Makefile') != ''
343
+ uses: erlef/setup-beam@v1
344
+ with:
345
+ otp-version: '27'
346
+ elixir-version: '1.17'
347
+ - if: hashFiles('elixir/Makefile') != ''
348
+ run: make -C elixir test
349
+
350
+ ocaml:
351
+ runs-on: ubuntu-latest
352
+ continue-on-error: true
353
+ steps:
354
+ - uses: actions/checkout@v4
355
+ - if: hashFiles('ocaml/Makefile') != ''
356
+ uses: ocaml/setup-ocaml@v3
357
+ with:
358
+ ocaml-compiler: '5.2'
359
+ - if: hashFiles('ocaml/Makefile') != ''
360
+ run: make -C ocaml test
361
+
362
+ haskell:
363
+ runs-on: ubuntu-latest
364
+ continue-on-error: true
365
+ steps:
366
+ - uses: actions/checkout@v4
367
+ - if: hashFiles('haskell/Makefile') != ''
368
+ uses: haskell-actions/setup@v2
369
+ with:
370
+ ghc-version: '9.6'
371
+ - if: hashFiles('haskell/Makefile') != ''
372
+ run: make -C haskell test
@@ -5,7 +5,7 @@
5
5
  sys: model: action: {
6
6
  apidef: load: 'build/apidef.js'
7
7
  sdkgen: load: 'build/sdkgen.js'
8
- // docgen: load: 'build/docgen.js'
8
+ # docgen: load: 'build/docgen.js'
9
9
  }
10
10
 
11
11
  sys: model: order: action: 'apidef,sdkgen'
@@ -3,7 +3,7 @@
3
3
  "version": "0.0.1",
4
4
  "description": "$$const.Name$$ SDK Project",
5
5
  "scripts": {
6
- "generate": "tsc --build src && voxgig-model model/sdk.aontu",
6
+ "generate": "tsc --build src && voxgig-model model/sdk.aontu && voxgig-model test/test.aontu",
7
7
  "watch-generate": "voxgig-model -w model/sdk.aontu",
8
8
  "dry-generate": "tsc --build src && voxgig-model -y model/sdk.aontu",
9
9
  "watch-dry-generate": "voxgig-model -w -y model/sdk.aontu",
@@ -1,2 +1,15 @@
1
1
 
2
- basic: set: []
2
+ # clean(ctx, val): redact sensitive values before they reach a log sink.
3
+ #
4
+ # The masking body is currently commented out in every port, so clean is a
5
+ # PASSTHROUGH — and that is exactly what needs pinning across languages: a
6
+ # port that "helpfully" implements masking early, or that clones/reshapes the
7
+ # value on the way through, diverges from the reference without any test
8
+ # noticing (this fixture was an empty `set: []`).
9
+
10
+ basic: set: [
11
+ { mark:10, args: [ {options:{}}, {a:'A'} ], out: {a:'A'} }
12
+ { mark:20, args: [ {options:{}}, {} ], out: {} }
13
+ { mark:30, args: [ {options:{}}, 'plain' ], out: 'plain' }
14
+ { mark:40, args: [ {options:{}}, [1,2] ], out: [1,2] }
15
+ ]
@@ -1,2 +1,11 @@
1
1
 
2
+ # PENDING — this section is deliberately empty.
3
+ #
4
+ # Requires a constructed feature registry on a client instance.
5
+ #
6
+ # An empty `set` runs ZERO cases. Runners must not treat that as a pass by
7
+ # accident: test/parity.test.ts in @voxgig/sdkgen asserts that every empty
8
+ # fixture carries this PENDING marker, so an accidentally-blanked fixture
9
+ # fails the build while a knowingly-deferred one does not.
10
+
2
11
  basic: set: []
@@ -1,2 +1,11 @@
1
1
 
2
+ # PENDING — this section is deliberately empty.
3
+ #
4
+ # Requires a constructed feature registry on a client instance.
5
+ #
6
+ # An empty `set` runs ZERO cases. Runners must not treat that as a pass by
7
+ # accident: test/parity.test.ts in @voxgig/sdkgen asserts that every empty
8
+ # fixture carries this PENDING marker, so an accidentally-blanked fixture
9
+ # fails the build while a knowingly-deferred one does not.
10
+
2
11
  basic: set: []
@@ -1,2 +1,11 @@
1
1
 
2
+ # PENDING — this section is deliberately empty.
3
+ #
4
+ # Requires a constructed feature registry on a client instance.
5
+ #
6
+ # An empty `set` runs ZERO cases. Runners must not treat that as a pass by
7
+ # accident: test/parity.test.ts in @voxgig/sdkgen asserts that every empty
8
+ # fixture carries this PENDING marker, so an accidentally-blanked fixture
9
+ # fails the build while a knowingly-deferred one does not.
10
+
2
11
  basic: set: []
@@ -1,2 +1,13 @@
1
1
 
2
+ # PENDING — this section is deliberately empty.
3
+ #
4
+ # Needs a live/mocked transport and a client instance; the shared
5
+ # runner has no transport-injection hook yet. Covered per-language by the
6
+ # feature/netsim suites until this fixture can express a transport.
7
+ #
8
+ # An empty `set` runs ZERO cases. Runners must not treat that as a pass by
9
+ # accident: test/parity.test.ts in @voxgig/sdkgen asserts that every empty
10
+ # fixture carries this PENDING marker, so an accidentally-blanked fixture
11
+ # fails the build while a knowingly-deferred one does not.
12
+
2
13
  basic: set: []
@@ -1,2 +1,13 @@
1
1
 
2
+ # PENDING — this section is deliberately empty.
3
+ #
4
+ # Depends on a fully built ctx (spec + point + options) that the
5
+ # shared runner cannot assemble from a literal; covered by makeSpec/makeUrl
6
+ # upstream and by the per-language pipeline suites.
7
+ #
8
+ # An empty `set` runs ZERO cases. Runners must not treat that as a pass by
9
+ # accident: test/parity.test.ts in @voxgig/sdkgen asserts that every empty
10
+ # fixture carries this PENDING marker, so an accidentally-blanked fixture
11
+ # fails the build while a knowingly-deferred one does not.
12
+
2
13
  basic: set: []
@@ -1,2 +1,12 @@
1
1
 
2
+ # PENDING — this section is deliberately empty.
3
+ #
4
+ # Requires an op with points plus SDK options.allow.op, i.e. a real
5
+ # client; the runner has no client-construction hook for it yet.
6
+ #
7
+ # An empty `set` runs ZERO cases. Runners must not treat that as a pass by
8
+ # accident: test/parity.test.ts in @voxgig/sdkgen asserts that every empty
9
+ # fixture carries this PENDING marker, so an accidentally-blanked fixture
10
+ # fails the build while a knowingly-deferred one does not.
11
+
2
12
  basic: set: []
@@ -1,2 +1,17 @@
1
1
 
2
+ # PENDING — this section is deliberately empty.
3
+ #
4
+ # makeResult needs a ctx carrying a constructed Spec AND Result (built via the
5
+ # SDK's own NewSpec/NewResult constructors), plus the error path for each being
6
+ # absent. The shared runner builds a ctx from a literal map and has no
7
+ # constructor hook, so the cases cannot be expressed here yet. Covered
8
+ # per-language today (e.g. go's makeResult-basic / -no-spec / -no-result),
9
+ # which is exactly the drift risk this corpus exists to remove — promoting it
10
+ # needs a runner change, not just fixture data.
11
+ #
12
+ # An empty `set` runs ZERO cases. Runners must not treat that as a pass by
13
+ # accident: test/corpus.test.ts here, and the PENDING lists in the language
14
+ # runners, keep a deliberately-deferred section distinct from an accidentally
15
+ # blanked one.
16
+
2
17
  basic: set: []
@@ -1,2 +1,31 @@
1
1
 
2
- basic: set: []
2
+ # preparePath: join ctx.point.parts with '/', dropping empty segments.
3
+ #
4
+ # Path templating is the highest-risk request-shaping step, and this fixture
5
+ # was an empty `set: []` — so every language "passed" it while running zero
6
+ # cases. The cases below were lifted from the per-language hand-written tests
7
+ # (go/py) that had drifted out of the shared corpus, plus the empty/blank
8
+ # segment edges that `join(..., true)` is specifically responsible for.
9
+
10
+ basic: set: [
11
+ # Multi-segment path, placeholder left intact (params are substituted later,
12
+ # by makeUrl — preparePath only assembles the template).
13
+ { mark:10, ctx: {point:{parts:[api,planet,'{id}'],args:{params:[]}}}, out: 'api/planet/{id}' }
14
+
15
+ # Single segment: no separator introduced.
16
+ { mark:20, ctx: {point:{parts:[items],args:{params:[]}}}, out: 'items' }
17
+
18
+ # No parts at all -> empty path (an entity mounted at the prefix root).
19
+ { mark:30, ctx: {point:{parts:[],args:{params:[]}}}, out: '' }
20
+
21
+ # Empty segments are DROPPED, not rendered as '//' — a doubled slash changes
22
+ # the request URL and 404s on strict routers.
23
+ { mark:40, ctx: {point:{parts:[a,'',b],args:{params:[]}}}, out: 'a/b' }
24
+
25
+ # Leading/trailing blanks likewise collapse.
26
+ { mark:50, ctx: {point:{parts:['',a,''],args:{params:[]}}}, out: 'a' }
27
+
28
+ # Several placeholders in one path.
29
+ { mark:60, ctx: {point:{parts:[api,'{a}',sub,'{b}'],args:{params:[]}}},
30
+ out: 'api/{a}/sub/{b}' }
31
+ ]
@@ -16633,7 +16633,58 @@
16633
16633
  },
16634
16634
  "clean": {
16635
16635
  "basic": {
16636
- "set": []
16636
+ "set": [
16637
+ {
16638
+ "args": [
16639
+ {
16640
+ "options": {}
16641
+ },
16642
+ {
16643
+ "a": "A"
16644
+ }
16645
+ ],
16646
+ "mark": 10,
16647
+ "out": {
16648
+ "a": "A"
16649
+ }
16650
+ },
16651
+ {
16652
+ "args": [
16653
+ {
16654
+ "options": {}
16655
+ },
16656
+ {}
16657
+ ],
16658
+ "mark": 20,
16659
+ "out": {}
16660
+ },
16661
+ {
16662
+ "args": [
16663
+ {
16664
+ "options": {}
16665
+ },
16666
+ "plain"
16667
+ ],
16668
+ "mark": 30,
16669
+ "out": "plain"
16670
+ },
16671
+ {
16672
+ "args": [
16673
+ {
16674
+ "options": {}
16675
+ },
16676
+ [
16677
+ 1,
16678
+ 2
16679
+ ]
16680
+ ],
16681
+ "mark": 40,
16682
+ "out": [
16683
+ 1,
16684
+ 2
16685
+ ]
16686
+ }
16687
+ ]
16637
16688
  }
16638
16689
  },
16639
16690
  "done": {
@@ -17227,7 +17278,7 @@
17227
17278
  "ctx": {
17228
17279
  "spec": {
17229
17280
  "headers": {
17230
- "authorization": " APIKEY01"
17281
+ "authorization": "APIKEY01"
17231
17282
  }
17232
17283
  }
17233
17284
  }
@@ -17435,7 +17486,99 @@
17435
17486
  },
17436
17487
  "preparePath": {
17437
17488
  "basic": {
17438
- "set": []
17489
+ "set": [
17490
+ {
17491
+ "ctx": {
17492
+ "point": {
17493
+ "args": {
17494
+ "params": []
17495
+ },
17496
+ "parts": [
17497
+ "api",
17498
+ "planet",
17499
+ "{id}"
17500
+ ]
17501
+ }
17502
+ },
17503
+ "mark": 10,
17504
+ "out": "api/planet/{id}"
17505
+ },
17506
+ {
17507
+ "ctx": {
17508
+ "point": {
17509
+ "args": {
17510
+ "params": []
17511
+ },
17512
+ "parts": [
17513
+ "items"
17514
+ ]
17515
+ }
17516
+ },
17517
+ "mark": 20,
17518
+ "out": "items"
17519
+ },
17520
+ {
17521
+ "ctx": {
17522
+ "point": {
17523
+ "args": {
17524
+ "params": []
17525
+ },
17526
+ "parts": []
17527
+ }
17528
+ },
17529
+ "mark": 30,
17530
+ "out": ""
17531
+ },
17532
+ {
17533
+ "ctx": {
17534
+ "point": {
17535
+ "args": {
17536
+ "params": []
17537
+ },
17538
+ "parts": [
17539
+ "a",
17540
+ "",
17541
+ "b"
17542
+ ]
17543
+ }
17544
+ },
17545
+ "mark": 40,
17546
+ "out": "a/b"
17547
+ },
17548
+ {
17549
+ "ctx": {
17550
+ "point": {
17551
+ "args": {
17552
+ "params": []
17553
+ },
17554
+ "parts": [
17555
+ "",
17556
+ "a",
17557
+ ""
17558
+ ]
17559
+ }
17560
+ },
17561
+ "mark": 50,
17562
+ "out": "a"
17563
+ },
17564
+ {
17565
+ "ctx": {
17566
+ "point": {
17567
+ "args": {
17568
+ "params": []
17569
+ },
17570
+ "parts": [
17571
+ "api",
17572
+ "{a}",
17573
+ "sub",
17574
+ "{b}"
17575
+ ]
17576
+ }
17577
+ },
17578
+ "mark": 60,
17579
+ "out": "api/{a}/sub/{b}"
17580
+ }
17581
+ ]
17439
17582
  }
17440
17583
  },
17441
17584
  "prepareQuery": {
@@ -86,7 +86,12 @@ function CreateSdkGen(opts: FullCreateSdkGenOptions) {
86
86
  Path.isAbsolute(spec.folder) ? spec.folder :
87
87
  Path.join(cwd, spec.folder)
88
88
 
89
- logCreate(folder)
89
+ // A dry run must not touch the filesystem — logCreate() mkdir's
90
+ // <folder>/.sdk/log and appends to create.log, which created a real
91
+ // directory tree for a run that is supposed to write nothing.
92
+ if (!dryrun) {
93
+ logCreate(folder)
94
+ }
90
95
 
91
96
  const jopts = {
92
97
  fs: () => fs,
@@ -262,6 +267,30 @@ async function installNpm(spec: GenerateSpec, opts: any, model: any) {
262
267
  await runNpm(['install'], spawn_opts)
263
268
  }
264
269
 
270
+ // `-t` / `-f` are INDEPENDENT of `--no-install`: the documented contract is
271
+ // that --no-install skips `npm install`, not that it drops the requested
272
+ // targets and features. Adding them is still valid without an install when
273
+ // the project already has its toolchain (re-scaffolding an existing folder
274
+ // is a supported flow — "if run against an existing folder generated files
275
+ // will be overwritten").
276
+ //
277
+ // They ARE npm run scripts that resolve @voxgig/sdkgen from node_modules, so
278
+ // without one they cannot work. Fail with an actionable message rather than
279
+ // the raw module-resolution error — and rather than silently skipping, which
280
+ // reports success while leaving config.aontu without the requested entries.
281
+ const wanted = [
282
+ (spec.target ?? []).length ? '--target' : '',
283
+ (spec.feature ?? []).length ? '--feature' : '',
284
+ ].filter(Boolean)
285
+
286
+ if (0 < wanted.length && !Fs.existsSync(Path.join(cwd, 'node_modules'))) {
287
+ throw new Error(
288
+ `${wanted.join(' / ')} needs the project toolchain, but ` +
289
+ `${Path.join(cwd, 'node_modules')} does not exist ` +
290
+ `(--no-install was given). Re-run without --no-install, or run ` +
291
+ `\`npm install\` then \`npm run add-target\` / \`add-feature\` in ${cwd}.`)
292
+ }
293
+
265
294
  await installTargets(spec, opts, model, spawn_opts)
266
295
  await installFeatures(spec, opts, model, spawn_opts)
267
296
  }
@@ -23,8 +23,9 @@ const GITIGNORE_TOP = `# Local config / secrets
23
23
  *.local.*
24
24
  *.local
25
25
 
26
- # Dependencies
27
- node_modules/
26
+ # Dependencies (no trailing slash: also ignores node_modules SYMLINKS, e.g.
27
+ # ts/node_modules -> shared tree, which a dir-only rule leaves tracked)
28
+ node_modules
28
29
 
29
30
  # Logs
30
31
  *.log
@@ -43,8 +44,9 @@ const GITIGNORE_SDK = `# Local config / secrets
43
44
  *.local.*
44
45
  *.local
45
46
 
46
- # Dependencies
47
- node_modules/
47
+ # Dependencies (no trailing slash: also ignores node_modules SYMLINKS, e.g.
48
+ # .sdk/node_modules -> shared tree, which a dir-only rule leaves tracked)
49
+ node_modules
48
50
 
49
51
  # Build output
50
52
  dist/
@@ -60,6 +62,55 @@ log/
60
62
  `
61
63
 
62
64
 
65
+ // The guide overlay is the ONE model file the user owns.
66
+ //
67
+ // Everything else the scaffold writes is toolchain-derived and is deliberately
68
+ // OVERWRITTEN (see the `existing.txt.write` rationale in create-sdkgen.ts) so a
69
+ // toolchain fix propagates. `model/guide/guide.aontu` is the exception: apidef
70
+ // unifies it OVER the heuristic classification, and it is where every
71
+ // documented customization lives — entity rename, hide, move, activate,
72
+ // per-path deactivation, method override, param rename, response transform.
73
+ // Copying the stub over it destroyed that work on every re-scaffold, and
74
+ // cedar-regen.sh re-scaffolds on every regen, so the loss was silent and
75
+ // repeated.
76
+ //
77
+ // It is excluded from the bulk Copy and merged instead (see mergeGuide).
78
+ const GUIDE_FILE = 'guide.aontu'
79
+ const GUIDE_REL = ['model', 'guide', GUIDE_FILE]
80
+
81
+
82
+ // Merge the guide template into an existing guide overlay.
83
+ //
84
+ // A guide is the template's `@`-includes plus whatever the user added. The
85
+ // includes are the only part the template OWNS, so the merge is: keep the
86
+ // user's file verbatim, and restore any include it is missing. When nothing
87
+ // is missing — the normal case — the file is returned byte-identical, so a
88
+ // re-scaffold is a no-op on it.
89
+ //
90
+ // Missing includes are restored at the TOP, not appended: `base-guide.aontu`
91
+ // carries the heuristic classification that the user's overrides unify over,
92
+ // and the overlay reads correctly only when the includes precede it.
93
+ function mergeGuide(existing: string | null, template: string): string {
94
+ if (null == existing) {
95
+ return template
96
+ }
97
+
98
+ const isInclude = (line: string) => line.trim().startsWith('@')
99
+
100
+ const have = new Set(existing.split('\n').map((line: string) => line.trim()))
101
+ const missing = template.split('\n')
102
+ .filter(isInclude)
103
+ .map((line: string) => line.trim())
104
+ .filter((line: string) => !have.has(line))
105
+
106
+ if (0 === missing.length) {
107
+ return existing
108
+ }
109
+
110
+ return missing.join('\n') + '\n\n' + existing
111
+ }
112
+
113
+
63
114
  // TODO: rename to RootSdk
64
115
  const CreateRoot = cmp(function CreateRoot(props: any) {
65
116
  const { ctx$, ctx$: { folder }, spec, model } = props
@@ -81,9 +132,14 @@ const CreateRoot = cmp(function CreateRoot(props: any) {
81
132
 
82
133
  // console.log('FROM', from)
83
134
 
135
+ // Copy `exclude` matches the SOURCE-RELATIVE path exactly, so this names
136
+ // the one guide under the scaffold and nothing else. It is re-emitted,
137
+ // merged, in the model folder below.
138
+ const guideExclude = [spec.sdk_folder, ...GUIDE_REL].join('/')
139
+
84
140
  Copy({
85
141
  from,
86
- exclude: [/\.fragment\./]
142
+ exclude: [/\.fragment\./, guideExclude]
87
143
  })
88
144
 
89
145
  File({ name: '.gitignore' }, () => {
@@ -113,6 +169,21 @@ const CreateRoot = cmp(function CreateRoot(props: any) {
113
169
 
114
170
  Folder({ name: 'model' }, () => {
115
171
  ModelSdk({ spec })
172
+
173
+ // Re-emit the guide the Copy skipped, merged over whatever is already
174
+ // there. On a fresh scaffold there is no existing file and this writes
175
+ // the template unchanged; on a re-scaffold the user's overlay survives.
176
+ Folder({ name: 'guide' }, () => {
177
+ const guideTemplate =
178
+ fs.readFileSync(Path.join(from, spec.sdk_folder, ...GUIDE_REL), 'utf8')
179
+ const guidePath = Path.join(folder, spec.sdk_folder, ...GUIDE_REL)
180
+ const existingGuide =
181
+ fs.existsSync(guidePath) ? fs.readFileSync(guidePath, 'utf8') : null
182
+
183
+ File({ name: GUIDE_FILE }, () => {
184
+ Content(mergeGuide(existingGuide, guideTemplate))
185
+ })
186
+ })
116
187
  })
117
188
  })
118
189