@voxgig/create-sdkgen 0.15.0 → 0.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +48 -1
  2. package/bin/create-sdkgen +4 -0
  3. package/dist/project/standard/CreateRoot.js +0 -1
  4. package/dist/project/standard/CreateRoot.js.map +1 -1
  5. package/dist/project/standard/ModelSdk.js +2 -2
  6. package/dist/project/standard/ModelSdk.js.map +1 -1
  7. package/package.json +15 -9
  8. package/project/standard/.github/workflows/ci.yml +140 -0
  9. package/project/standard/.sdk/model/.model-config/{model-config.jsonic → model-config.aontu} +1 -1
  10. package/project/standard/.sdk/model/config.aontu +16 -0
  11. package/project/standard/.sdk/model/guide/guide.aontu +8 -0
  12. package/project/standard/.sdk/model/sdk.fragment.aontu +35 -0
  13. package/project/standard/.sdk/package.json +6 -6
  14. package/project/standard/.sdk/src/BuildSDK.ts +28 -4
  15. package/project/standard/.sdk/src/Root.ts +38 -11
  16. package/project/standard/.sdk/src/Top.ts +16 -0
  17. package/project/standard/.sdk/src/tsconfig.json +7 -0
  18. package/project/standard/.sdk/test/.model-config/model-config.aontu +4 -0
  19. package/project/standard/.sdk/test/primary/primary-test-index.aontu +30 -0
  20. package/project/standard/.sdk/test/struct/test.aontu +25 -0
  21. package/project/standard/.sdk/test/test.aontu +3 -0
  22. package/src/project/standard/CreateRoot.ts +0 -2
  23. package/src/project/standard/ModelSdk.ts +2 -2
  24. package/src/tsconfig.json +6 -0
  25. package/bin/create-sdkgen~ +0 -261
  26. package/project/standard/.env.local +0 -1
  27. package/project/standard/.sdk/model/config.jsonic +0 -15
  28. package/project/standard/.sdk/model/guide/guide.jsonic +0 -8
  29. package/project/standard/.sdk/model/sdk.fragment.jsonic +0 -35
  30. package/project/standard/.sdk/test/.model-config/model-config.jsonic +0 -4
  31. package/project/standard/.sdk/test/primary/primary-test-index.jsonic +0 -30
  32. package/project/standard/.sdk/test/struct/test.jsonic +0 -25
  33. package/project/standard/.sdk/test/test.jsonic +0 -3
  34. /package/project/standard/.sdk/model/api/{api-info.jsonic → api-info.aontu} +0 -0
  35. /package/project/standard/.sdk/model/entity/{entity-index.jsonic → entity-index.aontu} +0 -0
  36. /package/project/standard/.sdk/model/feature/{feature-index.jsonic → feature-index.aontu} +0 -0
  37. /package/project/standard/.sdk/model/flow/{flow-index.jsonic → flow-index.aontu} +0 -0
  38. /package/project/standard/.sdk/model/target/{target-index.jsonic → target-index.aontu} +0 -0
  39. /package/project/standard/.sdk/test/primary/{clean.jsonic → clean.aontu} +0 -0
  40. /package/project/standard/.sdk/test/primary/{done.jsonic → done.aontu} +0 -0
  41. /package/project/standard/.sdk/test/primary/{featureAdd.jsonic → featureAdd.aontu} +0 -0
  42. /package/project/standard/.sdk/test/primary/{featureHook.jsonic → featureHook.aontu} +0 -0
  43. /package/project/standard/.sdk/test/primary/{featureInit.jsonic → featureInit.aontu} +0 -0
  44. /package/project/standard/.sdk/test/primary/{fetcher.jsonic → fetcher.aontu} +0 -0
  45. /package/project/standard/.sdk/test/primary/{makeContext.jsonic → makeContext.aontu} +0 -0
  46. /package/project/standard/.sdk/test/primary/{makeError.jsonic → makeError.aontu} +0 -0
  47. /package/project/standard/.sdk/test/primary/{makeFetchDef.jsonic → makeFetchDef.aontu} +0 -0
  48. /package/project/standard/.sdk/test/primary/{makeOptions.jsonic → makeOptions.aontu} +0 -0
  49. /package/project/standard/.sdk/test/primary/{makePoint.jsonic → makePoint.aontu} +0 -0
  50. /package/project/standard/.sdk/test/primary/{makeRequest.jsonic → makeRequest.aontu} +0 -0
  51. /package/project/standard/.sdk/test/primary/{makeResponse.jsonic → makeResponse.aontu} +0 -0
  52. /package/project/standard/.sdk/test/primary/{makeResult.jsonic → makeResult.aontu} +0 -0
  53. /package/project/standard/.sdk/test/primary/{makeSpec.jsonic → makeSpec.aontu} +0 -0
  54. /package/project/standard/.sdk/test/primary/{makeUrl.jsonic → makeUrl.aontu} +0 -0
  55. /package/project/standard/.sdk/test/primary/{operator.jsonic → operator.aontu} +0 -0
  56. /package/project/standard/.sdk/test/primary/{param.jsonic → param.aontu} +0 -0
  57. /package/project/standard/.sdk/test/primary/{prepareAuth.jsonic → prepareAuth.aontu} +0 -0
  58. /package/project/standard/.sdk/test/primary/{prepareBody.jsonic → prepareBody.aontu} +0 -0
  59. /package/project/standard/.sdk/test/primary/{prepareHeaders.jsonic → prepareHeaders.aontu} +0 -0
  60. /package/project/standard/.sdk/test/primary/{prepareMethod.jsonic → prepareMethod.aontu} +0 -0
  61. /package/project/standard/.sdk/test/primary/{prepareParams.jsonic → prepareParams.aontu} +0 -0
  62. /package/project/standard/.sdk/test/primary/{preparePath.jsonic → preparePath.aontu} +0 -0
  63. /package/project/standard/.sdk/test/primary/{prepareQuery.jsonic → prepareQuery.aontu} +0 -0
  64. /package/project/standard/.sdk/test/primary/{resultBasic.jsonic → resultBasic.aontu} +0 -0
  65. /package/project/standard/.sdk/test/primary/{resultBody.jsonic → resultBody.aontu} +0 -0
  66. /package/project/standard/.sdk/test/primary/{resultHeaders.jsonic → resultHeaders.aontu} +0 -0
  67. /package/project/standard/.sdk/test/primary/{transformRequest.jsonic → transformRequest.aontu} +0 -0
  68. /package/project/standard/.sdk/test/primary/{transformResponse.jsonic → transformResponse.aontu} +0 -0
  69. /package/project/standard/.sdk/test/struct/{getpath.jsonic → getpath.aontu} +0 -0
  70. /package/project/standard/.sdk/test/struct/{inject.jsonic → inject.aontu} +0 -0
  71. /package/project/standard/.sdk/test/struct/{merge.jsonic → merge.aontu} +0 -0
  72. /package/project/standard/.sdk/test/struct/{minor.jsonic → minor.aontu} +0 -0
  73. /package/project/standard/.sdk/test/struct/{select.jsonic → select.aontu} +0 -0
  74. /package/project/standard/.sdk/test/struct/{transform.jsonic → transform.aontu} +0 -0
  75. /package/project/standard/.sdk/test/struct/{validate.jsonic → validate.aontu} +0 -0
  76. /package/project/standard/.sdk/test/struct/{walk.jsonic → walk.aontu} +0 -0
package/README.md CHANGED
@@ -1,4 +1,51 @@
1
1
  # create-sdkgen
2
- Create a Voxgig SDK Generator project
3
2
 
3
+ Scaffold a new **Voxgig SDK Generator** project — turn an OpenAPI spec into
4
+ idiomatic, tested, multi-language client SDKs (TypeScript, Python, Go, PHP,
5
+ Ruby, Lua, plus a CLI and MCP server).
4
6
 
7
+ ## Quickstart
8
+
9
+ ```sh
10
+ # 1. Scaffold a project from your OpenAPI 3 spec
11
+ create-sdkgen my-api -d ./openapi.yaml -o ./my-api-sdk
12
+
13
+ # 2. Add the languages you want + offline test mode
14
+ cd my-api-sdk/.sdk
15
+ npx voxgig-sdkgen target add ts py go
16
+ npx voxgig-sdkgen feature add test
17
+
18
+ # 3. Generate the SDKs (builds the .sdk sources, then runs the generator)
19
+ npm run generate
20
+
21
+ # 4. Verify
22
+ cd ../ts && npm install && npm run build && npm test
23
+ ```
24
+
25
+ You shape the SDK by editing the **model** in `.sdk/model/` (entities, ops,
26
+ fields); everything under the language directories (`ts/`, `py/`, …) is
27
+ generated output and is overwritten on each regenerate.
28
+
29
+ ## Options
30
+
31
+ | Flag | Meaning |
32
+ | --- | --- |
33
+ | `<name>` | SDK name (kebab-case), the package base name |
34
+ | `-d, --def <spec>` | OpenAPI 3 spec file (`.yaml`/`.json`) |
35
+ | `-o, --folder <dir>` | output directory |
36
+ | `-t, --target <langs>` | targets to add during scaffold (e.g. `ts,py,go`) |
37
+ | `-f, --feature <feats>` | features to add (e.g. `test`) |
38
+ | `--no-install` | skip `npm install` |
39
+ | `-h`, `-v` | help, version |
40
+
41
+ ## Building an SDK with an AI agent?
42
+
43
+ Point your agent at **[`AGENTS.md`](./AGENTS.md)** — the full end-to-end guide
44
+ (spec → scaffold → generate → test → publish), what to edit vs. what is
45
+ generated, the doc-example test guarantee, and the real-world shape gotchas.
46
+
47
+ ## The toolchain
48
+
49
+ - **create-sdkgen** (this package) — scaffolds the project.
50
+ - **[@voxgig/apidef](https://github.com/voxgig/apidef)** — parses your OpenAPI spec into the model.
51
+ - **[@voxgig/sdkgen](https://github.com/voxgig/sdkgen)** — generates the SDKs from the model.
package/bin/create-sdkgen CHANGED
@@ -249,6 +249,10 @@ Usage: npm create @voxgig/sdkgen@latest <name> <args>
249
249
  --folder Target output folder. Default: ./<name>-sdk.
250
250
  -o
251
251
 
252
+ --target Language targets to add (e.g. ts, py, go, rb). Can be
253
+ -t specified multiple times; extra positional arguments
254
+ after <name> are also treated as targets.
255
+
252
256
  --feature Features to add. Can be specified multiple times.
253
257
  -f
254
258
 
@@ -77,7 +77,6 @@ const CreateRoot = (0, jostraca_1.cmp)(function CreateRoot(props) {
77
77
  (0, jostraca_1.Copy)({ from: origdef, to: projdef });
78
78
  }
79
79
  else {
80
- console.log('DEF NOT FOUND: ', origdef);
81
80
  (0, jostraca_1.File)({ name: projdef }, () => {
82
81
  (0, jostraca_1.Content)('# OpenAPI Definition');
83
82
  });
@@ -1 +1 @@
1
- {"version":3,"file":"CreateRoot.js","sourceRoot":"","sources":["../../../src/project/standard/CreateRoot.ts"],"names":[],"mappings":";;;;;;AAEA,0DAA4B;AAC5B,gCAAgC;AAEhC,uCAUiB;AAGjB,yCAAqC;AAGrC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;CAiBrB,CAAA;AAGD,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;CAkBrB,CAAA;AAGD,0BAA0B;AAC1B,MAAM,UAAU,GAAG,IAAA,cAAG,EAAC,SAAS,UAAU,CAAC,KAAU;IACnD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,CAAA;IACrD,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAEpB,2CAA2C;IAC3C,KAAK,CAAC,KAAK,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAA;IAClC,IAAA,gBAAK,EAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC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BACtC,CAAC;qBACI,CAAC;oBACJ,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE;wBAC3B,IAAA,kBAAO,EAAC,sBAAsB,CAAC,CAAA;oBACjC,CAAC,CAAC,CAAA;gBACJ,CAAC;YACH,CAAC,CAAC,CAAA;YAEF,IAAA,iBAAM,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE;gBAC7B,IAAA,mBAAQ,EAAC,EAAE,IAAI,EAAE,CAAC,CAAA;YACpB,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IAEJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAIA,gCAAU"}
@@ -9,9 +9,9 @@ const jostraca_1 = require("jostraca");
9
9
  const ModelSdk = (0, jostraca_1.cmp)(function ModelSdk(props) {
10
10
  const { spec } = props;
11
11
  const from = node_path_1.default.resolve(node_path_1.default.join(__dirname + '..', '..', '..', '..', 'project', 'standard'));
12
- (0, jostraca_1.File)({ name: 'sdk.jsonic' }, () => {
12
+ (0, jostraca_1.File)({ name: 'sdk.aontu' }, () => {
13
13
  (0, jostraca_1.Fragment)({
14
- from: node_path_1.default.join(from, spec.sdk_folder, 'model', 'sdk.fragment.jsonic'),
14
+ from: node_path_1.default.join(from, spec.sdk_folder, 'model', 'sdk.fragment.aontu'),
15
15
  replace: {
16
16
  ProjectName: spec.name,
17
17
  NAME: spec.name,
@@ -1 +1 @@
1
- {"version":3,"file":"ModelSdk.js","sourceRoot":"","sources":["../../../src/project/standard/ModelSdk.ts"],"names":[],"mappings":";;;;;;AACA,0DAA4B;AAG5B,uCAKiB;AAIjB,MAAM,QAAQ,GAAG,IAAA,cAAG,EAAC,SAAS,QAAQ,CAAC,KAAU;IAC/C,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAA;IAEtB,MAAM,IAAI,GACR,mBAAI,CAAC,OAAO,CAAC,mBAAI,CAAC,IAAI,CAAC,SA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AE,IAAI,CAAC,GAAG;aACd;SACF,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AAEJ,CAAC,CAAC,CAAA;AAIA,4BAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voxgig/create-sdkgen",
3
- "version": "0.15.0",
3
+ "version": "0.16.1",
4
4
  "main": "dist/create-sdkgen.js",
5
5
  "type": "commonjs",
6
6
  "types": "dist/create-sdkgen.d.ts",
@@ -24,13 +24,19 @@
24
24
  "test-some": "node --enable-source-maps --test-name-pattern=\"$npm_config_pattern\" --test dist-test/**/*.test.js",
25
25
  "watch": "tsc --build src test -w",
26
26
  "build": "tsc --build src test",
27
- "test-model": "voxgig-model project/.sdk/test/test.jsonic",
28
- "test-model-watch": "voxgig-model -w project/.sdk/test/test.jsonic",
27
+ "test-model": "voxgig-model project/.sdk/test/test.aontu",
28
+ "test-model-watch": "voxgig-model -w project/.sdk/test/test.aontu",
29
29
  "clean": "rm -rf dist dist-test node_modules yarn.lock package-lock.json",
30
30
  "reset": "npm run clean && npm i && npm run build && npm test",
31
+ "repo-bump": "npm version patch --no-git-tag-version && node -e \"console.log('bumped to v' + require('./package.json').version + ' (package.json only - commit via repo-tag / repo-release)')\"",
31
32
  "repo-tag": "REPO_VERSION=`node -e \"console.log(require('./package').version)\"` && echo TAG: v$REPO_VERSION && git commit -a -m v$REPO_VERSION && git push && git tag v$REPO_VERSION && git push --tags;",
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",
32
34
  "repo-publish": "npm run clean && npm i && npm run repo-publish-quick",
33
- "repo-publish-quick": "npm run build && npm run test && npm run repo-tag && npm publish --registry https://registry.npmjs.org --access=public"
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\" )",
38
+ "repo-release": "npm run repo-publish && npm run repo-tag",
39
+ "repo-release-dry": "npm run repo-publish-quick-dry && npm run repo-tag-dry"
34
40
  },
35
41
  "license": "MIT",
36
42
  "files": [
@@ -41,15 +47,15 @@
41
47
  "LICENSE"
42
48
  ],
43
49
  "devDependencies": {
44
- "@types/node": "25.8.0",
45
- "memfs": "4.57.2",
50
+ "@types/node": "26.1.0",
51
+ "memfs": "4.62.0",
46
52
  "typescript": "6.0.3"
47
53
  },
48
54
  "dependencies": {
49
- "@voxgig/util": "0.4.0",
50
- "aontu": "0.44.0",
55
+ "@voxgig/util": "0.5.1",
56
+ "aontu": "0.48.1",
51
57
  "chokidar": "5.0.0",
52
- "jostraca": "0.30.1",
58
+ "jostraca": "0.31.0",
53
59
  "shape": "10.1.0"
54
60
  }
55
61
  }
@@ -0,0 +1,140 @@
1
+ name: ci
2
+
3
+ # Unit tests only — strictly offline. No live API calls.
4
+ # Each per-language job runs the mocked unit-test suite for that target.
5
+ # Each step after checkout is gated by hashFiles() so a job auto-skips
6
+ # all its work when the target directory is absent.
7
+ #
8
+ # Live API verification is NOT run here. It happens in the central
9
+ # rebuild pipeline under controlled conditions, with per-API auth and
10
+ # rate-limit handling.
11
+
12
+ on:
13
+ push:
14
+ branches: [main]
15
+ pull_request:
16
+ branches: [main]
17
+
18
+ permissions:
19
+ contents: read
20
+
21
+ jobs:
22
+ go:
23
+ runs-on: ubuntu-latest
24
+ steps:
25
+ - uses: actions/checkout@v4
26
+ - if: hashFiles('go/go.mod') != ''
27
+ uses: actions/setup-go@v5
28
+ with:
29
+ go-version: '1.24'
30
+ - if: hashFiles('go/go.mod') != ''
31
+ run: make -C go test
32
+
33
+ go-cli:
34
+ runs-on: ubuntu-latest
35
+ # aql/eng/go is served via proxy.golang.org but its source repo
36
+ # (aql-lang/aql) is currently private, so sum.golang.org can't
37
+ # checksum-verify it. GOSUMDB=off lets `go mod tidy` use the
38
+ # committed go.sum without re-checking the public sum DB. Once
39
+ # aql-lang/aql goes public this env can be removed.
40
+ env:
41
+ GOSUMDB: 'off'
42
+ steps:
43
+ - uses: actions/checkout@v4
44
+ - if: hashFiles('go-cli/go.mod') != ''
45
+ uses: actions/setup-go@v5
46
+ with:
47
+ go-version: '1.24'
48
+ - if: hashFiles('go-cli/go.mod') != ''
49
+ run: |
50
+ cd go-cli
51
+ go mod tidy
52
+ go vet ./...
53
+ go build ./...
54
+ go test ./...
55
+
56
+ go-mcp:
57
+ runs-on: ubuntu-latest
58
+ steps:
59
+ - uses: actions/checkout@v4
60
+ - if: hashFiles('go-mcp/go.mod') != ''
61
+ uses: actions/setup-go@v5
62
+ with:
63
+ go-version: '1.24'
64
+ - if: hashFiles('go-mcp/go.mod') != ''
65
+ run: |
66
+ cd go-mcp
67
+ go mod tidy
68
+ go vet ./...
69
+ go build ./...
70
+ go test ./...
71
+
72
+ ts:
73
+ runs-on: ubuntu-latest
74
+ steps:
75
+ - uses: actions/checkout@v4
76
+ - if: hashFiles('ts/package.json') != ''
77
+ uses: actions/setup-node@v4
78
+ with:
79
+ node-version: '24'
80
+ - if: hashFiles('ts/package.json') != ''
81
+ run: cd ts && npm install --no-audit --no-fund
82
+ # npm test runs the compiled dist-test/ suite, which is gitignored —
83
+ # without a build first, node --test matches zero files and exits 0,
84
+ # leaving CI green while testing nothing.
85
+ - if: hashFiles('ts/package.json') != ''
86
+ run: cd ts && npm run build
87
+ - if: hashFiles('ts/package.json') != ''
88
+ run: cd ts && npm test
89
+
90
+ py:
91
+ runs-on: ubuntu-latest
92
+ steps:
93
+ - uses: actions/checkout@v4
94
+ - if: hashFiles('py/Makefile') != ''
95
+ uses: actions/setup-python@v5
96
+ with:
97
+ python-version: '3.13'
98
+ - if: hashFiles('py/Makefile') != ''
99
+ run: pip install pytest
100
+ - if: hashFiles('py/Makefile') != ''
101
+ run: make -C py test
102
+
103
+ rb:
104
+ runs-on: ubuntu-latest
105
+ steps:
106
+ - uses: actions/checkout@v4
107
+ - if: hashFiles('rb/Makefile') != ''
108
+ uses: ruby/setup-ruby@v1
109
+ with:
110
+ ruby-version: '3.3'
111
+ - if: hashFiles('rb/Makefile') != ''
112
+ run: make -C rb test
113
+
114
+ php:
115
+ runs-on: ubuntu-latest
116
+ steps:
117
+ - uses: actions/checkout@v4
118
+ - if: hashFiles('php/composer.json') != ''
119
+ uses: shivammathur/setup-php@v2
120
+ with:
121
+ php-version: '8.3'
122
+ - if: hashFiles('php/composer.json') != ''
123
+ run: cd php && composer install --no-interaction --no-progress
124
+ - if: hashFiles('php/composer.json') != ''
125
+ run: make -C php test
126
+
127
+ lua:
128
+ runs-on: ubuntu-latest
129
+ steps:
130
+ - uses: actions/checkout@v4
131
+ - if: hashFiles('lua/Makefile') != ''
132
+ uses: leafo/gh-actions-lua@v10
133
+ with:
134
+ luaVersion: '5.4'
135
+ - if: hashFiles('lua/Makefile') != ''
136
+ uses: leafo/gh-actions-luarocks@v4
137
+ - if: hashFiles('lua/Makefile') != ''
138
+ run: luarocks install busted
139
+ - if: hashFiles('lua/Makefile') != ''
140
+ run: make -C lua test
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- @'@voxgig/model/model/.model-config/model-config.jsonic'
3
+ @'@voxgig/model/model/.model-config/model-config.aontu'
4
4
 
5
5
  sys: model: action: {
6
6
  apidef: load: 'build/apidef.js'
@@ -0,0 +1,16 @@
1
+ # SDK Configuration
2
+
3
+ main: kit: config: {
4
+
5
+ # The Authorization credential prefix is derived from the OpenAPI
6
+ # security scheme (see api/api-info.aontu: main.kit.info.security,
7
+ # set by apidef) and defaults to 'Bearer' when the spec gives no
8
+ # signal. Uncomment to override per-SDK:
9
+ # auth: prefix: 'Bearer'
10
+
11
+
12
+ headers: {
13
+ 'content-type': 'application/json'
14
+ }
15
+
16
+ }
@@ -0,0 +1,8 @@
1
+ # Guide
2
+
3
+ @"@voxgig/apidef/model/guide.aontu"
4
+
5
+ @"base-guide.aontu"
6
+
7
+
8
+
@@ -0,0 +1,35 @@
1
+
2
+ # Model definitions.
3
+ @"@voxgig/apidef/model/apidef.aontu"
4
+ @"@voxgig/sdkgen/model/sdkgen.aontu"
5
+
6
+
7
+ # SDK Details.
8
+ name: 'NAME'
9
+ origin: 'voxgig-sdk'
10
+ def: 'DEF'
11
+
12
+
13
+ # API Information
14
+ @"api/api-info.aontu"
15
+
16
+
17
+ # SDK Configuration.
18
+ @"config.aontu"
19
+
20
+
21
+ # SDK Entities
22
+ @"entity/entity-index.aontu"
23
+
24
+
25
+ # SDK Features.
26
+ @"feature/feature-index.aontu"
27
+
28
+
29
+ # SDK Targets.
30
+ @"target/target-index.aontu"
31
+
32
+
33
+ # Operation workflows.
34
+ @"flow/flow-index.aontu"
35
+
@@ -3,12 +3,12 @@
3
3
  "version": "0.0.1",
4
4
  "description": "$$const.Name$$ SDK Project",
5
5
  "scripts": {
6
- "generate": "voxgig-model model/sdk.jsonic",
7
- "watch-generate": "voxgig-model -w model/sdk.jsonic",
8
- "dry-generate": "voxgig-model -y model/sdk.jsonic",
9
- "watch-dry-generate": "voxgig-model -w -y model/sdk.jsonic",
10
- "test-model": "voxgig-model test/test.jsonic",
11
- "watch-test-model": "voxgig-model -w test/test.jsonic",
6
+ "generate": "tsc --build src && voxgig-model model/sdk.aontu",
7
+ "watch-generate": "voxgig-model -w model/sdk.aontu",
8
+ "dry-generate": "tsc --build src && voxgig-model -y model/sdk.aontu",
9
+ "watch-dry-generate": "voxgig-model -w -y model/sdk.aontu",
10
+ "test-model": "voxgig-model test/test.aontu",
11
+ "watch-test-model": "voxgig-model -w test/test.aontu",
12
12
  "watch": "tsc --build src -w",
13
13
  "build": "tsc --build src",
14
14
  "test": "echo no-test",
@@ -77,6 +77,14 @@ function makeEntityTestData(_model: Model, entity: ModelEntity) {
77
77
  const pathParams = collectEntityPathParams(entity)
78
78
 
79
79
  const hasEntId = null != (entity as any).id
80
+ // Some entities don't declare a top-level `id` field but still need an
81
+ // `id` value in their fixture: any entity that has a non-list op (remove,
82
+ // update, load) will hit `data["id"]` in the generated test code. The
83
+ // test mock is lenient about extra/missing path params, so synthesising
84
+ // an `id` here keeps tests green for entities like
85
+ // `/{namespace}/{key}` (no `id` in URL) or `/{resource}/{id}`
86
+ // alongside the simple `{id}`-only case.
87
+ const needsFixtureId = hasEntId || entityHasMutatingOp(entity)
80
88
 
81
89
  let i = 1
82
90
 
@@ -91,10 +99,11 @@ function makeEntityTestData(_model: Model, entity: ModelEntity) {
91
99
  ent[paramName] = paramValue
92
100
  }
93
101
  }
94
- // Only inject a fixture id when the spec actually models one for this
95
- // entity. Public APIs (e.g. read-only feeds) without ids leave fixtures
96
- // bare so test generators don't synthesise bogus id assertions.
97
- if (hasEntId) {
102
+ // Inject a fixture id when the spec models one for this entity (either
103
+ // as a top-level field or as a path param). Read-only feeds with no id
104
+ // at all leave fixtures bare so test generators don't synthesise bogus
105
+ // id assertions.
106
+ if (needsFixtureId) {
98
107
  ent.id = id
99
108
  }
100
109
  })
@@ -108,6 +117,21 @@ function makeEntityTestData(_model: Model, entity: ModelEntity) {
108
117
  }
109
118
 
110
119
 
120
+ // Detect whether the entity has any op other than `list` (which doesn't
121
+ // take a per-item id). Used to decide whether the fixture needs a
122
+ // synthesised `id` — the test code for load/update/remove ops references
123
+ // `data["id"]` unconditionally in Python (and similarly in other strict
124
+ // languages), so the fixture must provide one even when the URL path
125
+ // params are named differently (e.g. `/{namespace}/{key}`).
126
+ function entityHasMutatingOp(entity: any): boolean {
127
+ const ops = entity?.op || {}
128
+ for (const opname of Object.keys(ops)) {
129
+ if (opname !== 'list') return true
130
+ }
131
+ return false
132
+ }
133
+
134
+
111
135
  // Walk every op point on the entity, collect the names of path params, and
112
136
  // pair each with its canonical idmap value. The canonical value mirrors the
113
137
  // flow generator's path-param defaulting in apidef:
@@ -83,21 +83,48 @@ const Root = cmp(function Root(props: any) {
83
83
 
84
84
  Folder({ name: target.name }, () => {
85
85
 
86
- each(entity, (entity: any) => {
87
- names(entity, entity.name)
88
- Entity({ target, entity })
89
- })
90
-
91
- each(feature).filter((feature: any) => feature.active).map((feature: any) => {
92
- names(feature, feature.name)
93
- Feature({ target, feature })
94
- })
86
+ // Per-generation-phase activation. A target's aontu model carries
87
+ // a `phase` map mirroring the feature pattern:
88
+ //
89
+ // phase: {
90
+ // entity: { active: false }
91
+ // feature: { active: false }
92
+ // readme: { active: false }
93
+ // test: { active: false }
94
+ // }
95
+ //
96
+ // Defaults are inclusive — when a phase entry is absent (or
97
+ // active is not explicitly false), the phase runs. Existing
98
+ // standard targets don't declare `phase` and keep current
99
+ // behaviour. A CLI-style target switches all four off and
100
+ // only emits Main.
101
+ const phase = target.phase || {}
102
+ const phaseActive = (name: string): boolean =>
103
+ false !== (phase[name] && phase[name].active)
104
+
105
+ if (phaseActive('entity')) {
106
+ each(entity, (entity: any) => {
107
+ names(entity, entity.name)
108
+ Entity({ target, entity })
109
+ })
110
+ }
111
+
112
+ if (phaseActive('feature')) {
113
+ each(feature).filter((feature: any) => feature.active).map((feature: any) => {
114
+ names(feature, feature.name)
115
+ Feature({ target, feature })
116
+ })
117
+ }
95
118
 
96
119
  Main({ target })
97
120
 
98
- Readme({ target })
121
+ if (phaseActive('readme')) {
122
+ Readme({ target })
123
+ }
99
124
 
100
- Test({ target })
125
+ if (phaseActive('test')) {
126
+ Test({ target })
127
+ }
101
128
  })
102
129
  })
103
130
 
@@ -2,12 +2,28 @@
2
2
 
3
3
  import {
4
4
  cmp,
5
+ Deploy,
5
6
  ReadmeTop,
7
+ License,
8
+ Security,
9
+ Changelog,
6
10
  } from '@voxgig/sdkgen'
7
11
 
8
12
 
9
13
  const Top = cmp(function Top(props: any) {
10
14
  ReadmeTop({})
15
+
16
+ // Root governance files for a publishable, unofficial generated SDK:
17
+ // an MIT LICENSE (held by Voxgig), a SECURITY.md disclosure policy, and a
18
+ // seed CHANGELOG. Emitted at repo root, before the per-target folders.
19
+ License({})
20
+ Security({})
21
+ Changelog({})
22
+
23
+ // Root deployment Makefile: per-target `make deploy-<t>` (publish with
24
+ // credentials injected by the aql key vault) plus an all-targets
25
+ // `make deploy-dry` rehearsal.
26
+ Deploy({})
11
27
  })
12
28
 
13
29
 
@@ -10,6 +10,13 @@
10
10
  "strict": true,
11
11
  "target": "es2021",
12
12
  "types": ["node"],
13
+
14
+ // A generated project must not fail on a *dependency's* own .d.ts: e.g.
15
+ // thread-stream (via @voxgig/apidef -> pino) references
16
+ // worker_threads.TransferListItem, dropped in @types/node >=26. Only src
17
+ // is our code, so skip lib checking of node_modules type declarations.
18
+ "skipLibCheck": true,
19
+
13
20
  "declaration": true,
14
21
  "declarationDir": "../dist"
15
22
  },
@@ -0,0 +1,4 @@
1
+
2
+ @"@voxgig/model/model/.model-config/model-config.aontu"
3
+
4
+ sys: model: builders: {}
@@ -0,0 +1,30 @@
1
+ primary: clean: @"clean.aontu"
2
+ primary: done: @"done.aontu"
3
+ primary: featureAdd: @"featureAdd.aontu"
4
+ primary: featureHook: @"featureHook.aontu"
5
+ primary: featureInit: @"featureInit.aontu"
6
+ primary: fetcher: @"fetcher.aontu"
7
+ primary: makeContext: @"makeContext.aontu"
8
+ primary: makeError: @"makeError.aontu"
9
+ primary: makeFetchDef: @"makeFetchDef.aontu"
10
+ primary: makeOptions: @"makeOptions.aontu"
11
+ primary: makeRequest: @"makeRequest.aontu"
12
+ primary: makeResponse: @"makeResponse.aontu"
13
+ primary: makeResult: @"makeResult.aontu"
14
+ primary: makeSpec: @"makeSpec.aontu"
15
+ primary: makePoint: @"makePoint.aontu"
16
+ primary: makeUrl: @"makeUrl.aontu"
17
+ primary: operator: @"operator.aontu"
18
+ primary: param: @"param.aontu"
19
+ primary: prepareAuth: @"prepareAuth.aontu"
20
+ primary: prepareBody: @"prepareBody.aontu"
21
+ primary: prepareHeaders: @"prepareHeaders.aontu"
22
+ primary: prepareMethod: @"prepareMethod.aontu"
23
+ primary: prepareParams: @"prepareParams.aontu"
24
+ primary: preparePath: @"preparePath.aontu"
25
+ primary: prepareQuery: @"prepareQuery.aontu"
26
+ primary: resultBasic: @"resultBasic.aontu"
27
+ primary: resultBody: @"resultBody.aontu"
28
+ primary: resultHeaders: @"resultHeaders.aontu"
29
+ primary: transformRequest: @"transformRequest.aontu"
30
+ primary: transformResponse: @"transformResponse.aontu"
@@ -0,0 +1,25 @@
1
+
2
+ struct: &: {
3
+ name: .$KEY
4
+ set: []
5
+ }
6
+
7
+ struct: minor: @"minor.aontu"
8
+ struct: getpath: @"getpath.aontu"
9
+ struct: inject: @"inject.aontu"
10
+ struct: merge: @"merge.aontu"
11
+ struct: transform: @"transform.aontu"
12
+ struct: walk: @"walk.aontu"
13
+ struct: validate: @"validate.aontu"
14
+ struct: select: @"select.aontu"
15
+
16
+ primary: check: {
17
+ DEF: {
18
+ client:a:test:options:foo:1
19
+ }
20
+ basic: set: [
21
+ { ctx:meta:bar:BAR0, out:zed:ZED_BAR0 }
22
+ { ctx:meta:bar:BAR1, client:a, out:zed:ZED1_BAR1 }
23
+ ]
24
+ }
25
+
@@ -0,0 +1,3 @@
1
+
2
+ @"struct/test.aontu"
3
+ @"primary/primary-test-index.aontu"
@@ -102,8 +102,6 @@ const CreateRoot = cmp(function CreateRoot(props: any) {
102
102
  Copy({ from: origdef, to: projdef })
103
103
  }
104
104
  else {
105
- console.log('DEF NOT FOUND: ', origdef)
106
-
107
105
  File({ name: projdef }, () => {
108
106
  Content('# OpenAPI Definition')
109
107
  })
@@ -17,9 +17,9 @@ const ModelSdk = cmp(function ModelSdk(props: any) {
17
17
  const from =
18
18
  Path.resolve(Path.join(__dirname + '..', '..', '..', '..', 'project', 'standard'))
19
19
 
20
- File({ name: 'sdk.jsonic' }, () => {
20
+ File({ name: 'sdk.aontu' }, () => {
21
21
  Fragment({
22
- from: Path.join(from, spec.sdk_folder, 'model', 'sdk.fragment.jsonic'),
22
+ from: Path.join(from, spec.sdk_folder, 'model', 'sdk.fragment.aontu'),
23
23
  replace: {
24
24
  ProjectName: spec.name,
25
25
  NAME: spec.name,
package/src/tsconfig.json CHANGED
@@ -9,6 +9,12 @@
9
9
  "sourceMap": true,
10
10
  "strict": true,
11
11
  "target": "es2021",
12
+
13
+ // @types/node >=26 dropped worker_threads.TransferListItem, which a
14
+ // dependency's own .d.ts (thread-stream via pino) still references. Only
15
+ // src is our code, so skip lib checking of node_modules type declarations.
16
+ "skipLibCheck": true,
17
+
12
18
  "declaration": true,
13
19
  "declarationDir": "../dist"
14
20
  }
@@ -1,261 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const Path = require('node:path')
4
- const { statSync } = require('node:fs')
5
- const { parseArgs } = require('node:util')
6
-
7
- const { Gubu, Fault, One } = require('gubu')
8
-
9
- const Pkg = require('../package.json')
10
-
11
- const { CreateSdkGen } = require('../dist/create-sdkgen.js')
12
-
13
- const rootpath = require.resolve('../dist/standard/Root')
14
-
15
- let KONSOLE = global['con'+'sole']
16
-
17
-
18
- run()
19
-
20
-
21
- async function run() {
22
- try {
23
- let options = resolveOptions()
24
-
25
- if(options.debug) {
26
- DEBUG = true
27
- }
28
-
29
- if(options.version) {
30
- version()
31
- }
32
-
33
- if(options.help) {
34
- help()
35
- }
36
-
37
- if(options.version || options.help) {
38
- exit()
39
- }
40
-
41
- options = validateOptions(options)
42
-
43
- generate(options)
44
- }
45
- catch(err) {
46
- handleError(err)
47
- }
48
- }
49
-
50
-
51
- function exit(err) {
52
- let code = 0
53
- if(err) {
54
- code = 1
55
- }
56
- process.exit(code)
57
- }
58
-
59
-
60
- function generate(options) {
61
- const createSdkGen = CreateSdkGen({
62
- debug: options.debug
63
- })
64
-
65
-
66
- const spec = {
67
- root: 'Root',
68
-
69
- name: options.name,
70
- def: options.def,
71
- dryrun: options.dryrun,
72
- project: options.project,
73
- install: options.install,
74
- target: options.target,
75
- feature: options.feature,
76
- }
77
-
78
- createSdkGen.generate(spec)
79
- }
80
-
81
-
82
-
83
- function resolveOptions() {
84
-
85
- let args
86
-
87
- try {
88
- args = parseArgs({
89
- allowPositionals: true,
90
- allowNegative: true,
91
- options: {
92
- def: {
93
- type: 'string',
94
- short: 'd',
95
- default: ''
96
- },
97
-
98
- project: {
99
- type: 'string',
100
- short: 'p',
101
- default: 'standard'
102
- },
103
-
104
- dryrun: {
105
- type: 'boolean',
106
- short: 'y',
107
- },
108
-
109
- install: {
110
- type: 'boolean',
111
- short: 'y',
112
- default: true,
113
- },
114
-
115
- target: {
116
- type: 'string',
117
- short: 't',
118
- multiple: true
119
- },
120
-
121
- feature: {
122
- type: 'string',
123
- short: 'f',
124
- multiple: true
125
- },
126
-
127
- debug: {
128
- type: 'string',
129
- short: 'g',
130
- default: 'info'
131
- },
132
-
133
- help: {
134
- type: 'boolean',
135
- short: 'h',
136
- },
137
-
138
- version: {
139
- type: 'boolean',
140
- short: 'v',
141
- },
142
-
143
- }
144
- })
145
- }
146
- catch(err) {
147
- if('ERR_PARSE_ARGS_UNKNOWN_OPTION' === err.code) {
148
- handleError(err.message.replace(/\. .+$/,'.'))
149
- }
150
- throw err
151
- }
152
-
153
- // Set fake name if -v or -h used.
154
- let name = args.positionals[0]
155
- name = null == name ? '' : name
156
- name = '' === name && (args.values.help || args.values.version) ? '__none__' : name
157
-
158
- targets = args.values.target || []
159
- if( 1 < args.positionals.length ) {
160
- targets.push(args.positionals.slice(1))
161
- }
162
-
163
- features = args.values.feature || []
164
-
165
- const options = {
166
- name,
167
- def: args.values.def,
168
- project: args.values.project,
169
- dryrun: !!args.values.dryrun,
170
- install: !!args.values.install,
171
- target: targets,
172
- feature: features,
173
- debug: args.values.debug,
174
- help: !!args.values.help,
175
- version: !!args.values.version,
176
- }
177
-
178
- // console.log('ARGS', args, options)
179
-
180
- return options
181
- }
182
-
183
-
184
- function validateOptions(rawOptions) {
185
- const optShape = Gubu({
186
- name: Fault('The first argument must be the project name.', String),
187
- def: '',
188
- project: String,
189
- dryrun: Boolean,
190
- install: Boolean,
191
- target: [String],
192
- feature: [String],
193
- debug: String,
194
- help: Boolean,
195
- version: Boolean,
196
- })
197
-
198
- const err = []
199
- const options = optShape(rawOptions,{err})
200
-
201
- if(err[0]) {
202
- handleError(err[0].text)
203
- }
204
-
205
- return options
206
- }
207
-
208
-
209
- function handleError(err) {
210
- KONSOLE.log('Voxgig Create SDK Error: '+err)
211
- exit(err)
212
- }
213
-
214
-
215
- function version() {
216
- KONSOLE.log(Pkg.version)
217
- }
218
-
219
-
220
- function help() {
221
- let s = `
222
- Create a Voxgig SDK Generator project.
223
-
224
- Usage: npm create @voxgig/sdkgen@latest <name> <args>
225
-
226
- <name> is the name of the SDK project. This is also used to
227
- create a project folder. If run against an existing folder
228
- generated files will be overwritten.
229
-
230
- <args> are the command arguments:
231
-
232
- --def Path to the OpenAPI definition file (optional).
233
- -d
234
-
235
- --project Project template (folder or package reference). Default: standard.
236
- -p
237
-
238
- --dryrun Perform a dry run, where no files are modified.
239
- -y
240
-
241
- --debug Set log level (default: info): trace, error, debug, info, warn, fatal.
242
- -g
243
-
244
- --help Print this help message.
245
- -h
246
-
247
- --version Print version number.
248
- -v
249
-
250
-
251
- Examples:
252
-
253
- # Basic usage
254
- > npm create @voxgig/sdkgen@latest foo
255
- # Creates the SDK Project in the folder ./foo
256
-
257
- See also: https://voxgig.com/sdkgen
258
- `
259
-
260
- KONSOLE.log(s)
261
- }
@@ -1 +0,0 @@
1
- PROJECTNAME_APIKEY=<apikey>
@@ -1,15 +0,0 @@
1
- # SDK Configuration
2
-
3
- main: kit: config: {
4
-
5
- ## TODO: crate in apidef and put servers here
6
-
7
- # Authorization header token value prefix
8
- auth: prefix: 'Bearer'
9
-
10
-
11
- headers: {
12
- 'content-type': 'application/json'
13
- }
14
-
15
- }
@@ -1,8 +0,0 @@
1
- # Guide
2
-
3
- @"@voxgig/apidef/model/guide.jsonic"
4
-
5
- @"base-guide.jsonic"
6
-
7
-
8
-
@@ -1,35 +0,0 @@
1
-
2
- # Model definitions.
3
- @"@voxgig/apidef/model/apidef.jsonic"
4
- @"@voxgig/sdkgen/model/sdkgen.jsonic"
5
-
6
-
7
- # SDK Details.
8
- name: 'NAME'
9
- origin: 'voxgig-sdk'
10
- def: 'DEF'
11
-
12
-
13
- # API Information
14
- @"api/api-info.jsonic"
15
-
16
-
17
- # SDK Configuration.
18
- @"config.jsonic"
19
-
20
-
21
- # SDK Entities
22
- @"entity/entity-index.jsonic"
23
-
24
-
25
- # SDK Features.
26
- @"feature/feature-index.jsonic"
27
-
28
-
29
- # SDK Targets.
30
- @"target/target-index.jsonic"
31
-
32
-
33
- # Operation workflows.
34
- @"flow/flow-index.jsonic"
35
-
@@ -1,4 +0,0 @@
1
-
2
- @"@voxgig/model/model/.model-config/model-config.jsonic"
3
-
4
- sys: model: builders: {}
@@ -1,30 +0,0 @@
1
- primary: clean: @"clean.jsonic"
2
- primary: done: @"done.jsonic"
3
- primary: featureAdd: @"featureAdd.jsonic"
4
- primary: featureHook: @"featureHook.jsonic"
5
- primary: featureInit: @"featureInit.jsonic"
6
- primary: fetcher: @"fetcher.jsonic"
7
- primary: makeContext: @"makeContext.jsonic"
8
- primary: makeError: @"makeError.jsonic"
9
- primary: makeFetchDef: @"makeFetchDef.jsonic"
10
- primary: makeOptions: @"makeOptions.jsonic"
11
- primary: makeRequest: @"makeRequest.jsonic"
12
- primary: makeResponse: @"makeResponse.jsonic"
13
- primary: makeResult: @"makeResult.jsonic"
14
- primary: makeSpec: @"makeSpec.jsonic"
15
- primary: makePoint: @"makePoint.jsonic"
16
- primary: makeUrl: @"makeUrl.jsonic"
17
- primary: operator: @"operator.jsonic"
18
- primary: param: @"param.jsonic"
19
- primary: prepareAuth: @"prepareAuth.jsonic"
20
- primary: prepareBody: @"prepareBody.jsonic"
21
- primary: prepareHeaders: @"prepareHeaders.jsonic"
22
- primary: prepareMethod: @"prepareMethod.jsonic"
23
- primary: prepareParams: @"prepareParams.jsonic"
24
- primary: preparePath: @"preparePath.jsonic"
25
- primary: prepareQuery: @"prepareQuery.jsonic"
26
- primary: resultBasic: @"resultBasic.jsonic"
27
- primary: resultBody: @"resultBody.jsonic"
28
- primary: resultHeaders: @"resultHeaders.jsonic"
29
- primary: transformRequest: @"transformRequest.jsonic"
30
- primary: transformResponse: @"transformResponse.jsonic"
@@ -1,25 +0,0 @@
1
-
2
- struct: &: {
3
- name: .$KEY
4
- set: []
5
- }
6
-
7
- struct: minor: @"minor.jsonic"
8
- struct: getpath: @"getpath.jsonic"
9
- struct: inject: @"inject.jsonic"
10
- struct: merge: @"merge.jsonic"
11
- struct: transform: @"transform.jsonic"
12
- struct: walk: @"walk.jsonic"
13
- struct: validate: @"validate.jsonic"
14
- struct: select: @"select.jsonic"
15
-
16
- primary: check: {
17
- DEF: {
18
- client:a:test:options:foo:1
19
- }
20
- basic: set: [
21
- { ctx:meta:bar:BAR0, out:zed:ZED_BAR0 }
22
- { ctx:meta:bar:BAR1, client:a, out:zed:ZED1_BAR1 }
23
- ]
24
- }
25
-
@@ -1,3 +0,0 @@
1
-
2
- @"struct/test.jsonic"
3
- @"primary/primary-test-index.jsonic"