@voxgig/sdkgen 4.46.0 → 4.47.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.
Files changed (209) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/action/check.js +58 -4
  3. package/dist/action/check.js.map +1 -1
  4. package/dist/action/doctor.d.ts +5 -0
  5. package/dist/action/doctor.js +44 -4
  6. package/dist/action/doctor.js.map +1 -1
  7. package/dist/action/package.d.ts +1 -1
  8. package/dist/action/package.js +6 -16
  9. package/dist/action/package.js.map +1 -1
  10. package/dist/action/remove.js +15 -4
  11. package/dist/action/remove.js.map +1 -1
  12. package/dist/action/resolve.d.ts +1 -0
  13. package/dist/action/resolve.js +10 -4
  14. package/dist/action/resolve.js.map +1 -1
  15. package/dist/admin/status.d.ts +7 -1
  16. package/dist/admin/status.js +34 -5
  17. package/dist/admin/status.js.map +1 -1
  18. package/dist/cmp/AgentGuide.js +27 -15
  19. package/dist/cmp/AgentGuide.js.map +1 -1
  20. package/dist/cmp/AgentGuideContent.d.ts +3 -3
  21. package/dist/cmp/AgentGuideContent.js +22 -11
  22. package/dist/cmp/AgentGuideContent.js.map +1 -1
  23. package/dist/cmp/AgentGuideFeature.js +14 -6
  24. package/dist/cmp/AgentGuideFeature.js.map +1 -1
  25. package/dist/cmp/AgentGuideTop.js +16 -8
  26. package/dist/cmp/AgentGuideTop.js.map +1 -1
  27. package/dist/cmp/Changelog.js +37 -7
  28. package/dist/cmp/Changelog.js.map +1 -1
  29. package/dist/cmp/Deploy.js +52 -16
  30. package/dist/cmp/Deploy.js.map +1 -1
  31. package/dist/cmp/Entity.js +1 -1
  32. package/dist/cmp/Entity.js.map +1 -1
  33. package/dist/cmp/ExternalTarget.js +5 -0
  34. package/dist/cmp/ExternalTarget.js.map +1 -1
  35. package/dist/cmp/Feature.js +2 -2
  36. package/dist/cmp/Feature.js.map +1 -1
  37. package/dist/cmp/Main.js +1 -1
  38. package/dist/cmp/Main.js.map +1 -1
  39. package/dist/cmp/PublishWorkflow.js +63 -53
  40. package/dist/cmp/PublishWorkflow.js.map +1 -1
  41. package/dist/cmp/ReadmeIntro.js +1 -1
  42. package/dist/cmp/ReadmeIntro.js.map +1 -1
  43. package/dist/cmp/ReadmeModel.js +2 -2
  44. package/dist/cmp/ReadmeModel.js.map +1 -1
  45. package/dist/cmp/ReadmeStation.js +3 -3
  46. package/dist/cmp/ReadmeStation.js.map +1 -1
  47. package/dist/cmp/ReadmeTop.js +57 -59
  48. package/dist/cmp/ReadmeTop.js.map +1 -1
  49. package/dist/cmp/Registered.js +1 -1
  50. package/dist/cmp/Registered.js.map +1 -1
  51. package/dist/cmp/Security.js +23 -3
  52. package/dist/cmp/Security.js.map +1 -1
  53. package/dist/cmp/Test.js +1 -1
  54. package/dist/cmp/Test.js.map +1 -1
  55. package/dist/helpers/alongside.d.ts +2 -3
  56. package/dist/helpers/alongside.js +16 -15
  57. package/dist/helpers/alongside.js.map +1 -1
  58. package/dist/helpers/applicability.d.ts +2 -1
  59. package/dist/helpers/applicability.js +14 -1
  60. package/dist/helpers/applicability.js.map +1 -1
  61. package/dist/helpers/component.js +9 -1
  62. package/dist/helpers/component.js.map +1 -1
  63. package/dist/helpers/definitionPlan.js +0 -1
  64. package/dist/helpers/definitionPlan.js.map +1 -1
  65. package/dist/helpers/doctext.js +1 -0
  66. package/dist/helpers/doctext.js.map +1 -1
  67. package/dist/helpers/facts.js +174 -4
  68. package/dist/helpers/facts.js.map +1 -1
  69. package/dist/helpers/flowGuard.d.ts +1 -1
  70. package/dist/helpers/flowGuard.js +20 -7
  71. package/dist/helpers/flowGuard.js.map +1 -1
  72. package/dist/helpers/generated.d.ts +1 -0
  73. package/dist/helpers/generated.js +1 -1
  74. package/dist/helpers/generated.js.map +1 -1
  75. package/dist/helpers/graphqlPoint.d.ts +2 -1
  76. package/dist/helpers/graphqlPoint.js +17 -0
  77. package/dist/helpers/graphqlPoint.js.map +1 -1
  78. package/dist/helpers/guardModel.d.ts +2 -0
  79. package/dist/helpers/guardModel.js +41 -0
  80. package/dist/helpers/guardModel.js.map +1 -0
  81. package/dist/helpers/manifest.d.ts +2 -1
  82. package/dist/helpers/manifest.js +16 -0
  83. package/dist/helpers/manifest.js.map +1 -1
  84. package/dist/helpers/mcpTools.d.ts +2 -1
  85. package/dist/helpers/mcpTools.js +8 -1
  86. package/dist/helpers/mcpTools.js.map +1 -1
  87. package/dist/helpers/opShape.js +17 -17
  88. package/dist/helpers/opShape.js.map +1 -1
  89. package/dist/helpers/packageMeta.d.ts +6 -4
  90. package/dist/helpers/packageMeta.js +68 -46
  91. package/dist/helpers/packageMeta.js.map +1 -1
  92. package/dist/helpers/placement.d.ts +15 -0
  93. package/dist/helpers/placement.js +76 -0
  94. package/dist/helpers/placement.js.map +1 -0
  95. package/dist/helpers/semver.d.ts +2 -1
  96. package/dist/helpers/semver.js +21 -0
  97. package/dist/helpers/semver.js.map +1 -1
  98. package/dist/helpers/serverVars.js +3 -2
  99. package/dist/helpers/serverVars.js.map +1 -1
  100. package/dist/helpers/shipped.d.ts +2 -1
  101. package/dist/helpers/shipped.js +12 -0
  102. package/dist/helpers/shipped.js.map +1 -1
  103. package/dist/helpers/sourcestring.d.ts +3 -0
  104. package/dist/helpers/sourcestring.js +43 -0
  105. package/dist/helpers/sourcestring.js.map +1 -0
  106. package/dist/helpers/stdrep.d.ts +1 -1
  107. package/dist/helpers/stdrep.js +5 -1
  108. package/dist/helpers/stdrep.js.map +1 -1
  109. package/dist/helpers/surface.d.ts +7 -0
  110. package/dist/helpers/surface.js +69 -0
  111. package/dist/helpers/surface.js.map +1 -0
  112. package/dist/helpers/targetguard.d.ts +13 -0
  113. package/dist/helpers/targetguard.js +65 -0
  114. package/dist/helpers/targetguard.js.map +1 -0
  115. package/dist/helpers/text.d.ts +3 -1
  116. package/dist/helpers/text.js +16 -0
  117. package/dist/helpers/text.js.map +1 -1
  118. package/dist/helpers/textguard.d.ts +31 -0
  119. package/dist/helpers/textguard.js +157 -0
  120. package/dist/helpers/textguard.js.map +1 -0
  121. package/dist/helpers/title.d.ts +4 -0
  122. package/dist/helpers/title.js +52 -0
  123. package/dist/helpers/title.js.map +1 -0
  124. package/dist/sdkgen.d.ts +4 -6
  125. package/dist/sdkgen.js +59 -69
  126. package/dist/sdkgen.js.map +1 -1
  127. package/dist/testkit.d.ts +6 -2
  128. package/dist/testkit.js +4 -1
  129. package/dist/testkit.js.map +1 -1
  130. package/dist/tsconfig.tsbuildinfo +1 -1
  131. package/model/fact.aontu +106 -0
  132. package/model/sdkgen.aontu +9 -1
  133. package/package.json +1 -1
  134. package/project/.sdk/src/cmp/c/ReadmeQuick_c.ts +1 -1
  135. package/project/.sdk/src/cmp/clojure/ReadmeQuick_clojure.ts +1 -1
  136. package/project/.sdk/src/cmp/cpp/ReadmeQuick_cpp.ts +1 -1
  137. package/project/.sdk/src/cmp/csharp/ReadmeQuick_csharp.ts +1 -1
  138. package/project/.sdk/src/cmp/elixir/ReadmeQuick_elixir.ts +1 -1
  139. package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +1 -1
  140. package/project/.sdk/src/cmp/java/ReadmeQuick_java.ts +1 -1
  141. package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +1 -1
  142. package/project/.sdk/src/cmp/kotlin/ReadmeQuick_kotlin.ts +1 -1
  143. package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +1 -1
  144. package/project/.sdk/src/cmp/ocaml/ReadmeQuick_ocaml.ts +1 -1
  145. package/project/.sdk/src/cmp/perl/ReadmeQuick_perl.ts +1 -1
  146. package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +1 -1
  147. package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +1 -1
  148. package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +1 -1
  149. package/project/.sdk/src/cmp/rust/ReadmeQuick_rust.ts +1 -1
  150. package/project/.sdk/src/cmp/scala/ReadmeQuick_scala.ts +1 -1
  151. package/project/.sdk/src/cmp/swift/ReadmeQuick_swift.ts +1 -1
  152. package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +1 -1
  153. package/project/.sdk/src/cmp/ts/TestDefinition_ts.ts +3 -1
  154. package/project/.sdk/src/cmp/zig/ReadmeQuick_zig.ts +1 -1
  155. package/project/.sdk/tm/ocaml/test/feature/secrets/t_secrets.ml +3 -1
  156. package/project/.sdk/tm/php/test/feature/secrets/SecretsTest.php +2 -1
  157. package/project/.sdk/tm/zig/test/feature/secrets/secrets_test.zig +11 -2
  158. package/project/sdkgen-package.json +1 -1
  159. package/src/action/check.ts +78 -4
  160. package/src/action/doctor.ts +62 -4
  161. package/src/action/package.ts +1 -13
  162. package/src/action/remove.ts +19 -5
  163. package/src/action/resolve.ts +11 -4
  164. package/src/admin/status.ts +25 -5
  165. package/src/cmp/AgentGuide.ts +28 -15
  166. package/src/cmp/AgentGuideContent.ts +22 -11
  167. package/src/cmp/AgentGuideFeature.ts +15 -6
  168. package/src/cmp/AgentGuideTop.ts +17 -8
  169. package/src/cmp/Changelog.ts +46 -6
  170. package/src/cmp/Deploy.ts +59 -20
  171. package/src/cmp/Entity.ts +1 -1
  172. package/src/cmp/ExternalTarget.ts +6 -0
  173. package/src/cmp/Feature.ts +3 -3
  174. package/src/cmp/Main.ts +1 -1
  175. package/src/cmp/PublishWorkflow.ts +66 -58
  176. package/src/cmp/ReadmeIntro.ts +1 -1
  177. package/src/cmp/ReadmeModel.ts +2 -2
  178. package/src/cmp/ReadmeStation.ts +4 -5
  179. package/src/cmp/ReadmeTop.ts +60 -60
  180. package/src/cmp/Registered.ts +1 -1
  181. package/src/cmp/Security.ts +32 -5
  182. package/src/cmp/Test.ts +1 -1
  183. package/src/helpers/alongside.ts +16 -19
  184. package/src/helpers/applicability.ts +16 -1
  185. package/src/helpers/component.ts +11 -1
  186. package/src/helpers/definitionPlan.ts +0 -1
  187. package/src/helpers/doctext.ts +3 -1
  188. package/src/helpers/facts.ts +214 -5
  189. package/src/helpers/flowGuard.ts +22 -7
  190. package/src/helpers/generated.ts +3 -1
  191. package/src/helpers/graphqlPoint.ts +20 -1
  192. package/src/helpers/guardModel.ts +50 -0
  193. package/src/helpers/manifest.ts +19 -0
  194. package/src/helpers/mcpTools.ts +11 -1
  195. package/src/helpers/opShape.ts +16 -16
  196. package/src/helpers/packageMeta.ts +67 -43
  197. package/src/helpers/placement.ts +114 -0
  198. package/src/helpers/semver.ts +26 -0
  199. package/src/helpers/serverVars.ts +4 -2
  200. package/src/helpers/shipped.ts +13 -0
  201. package/src/helpers/sourcestring.ts +47 -0
  202. package/src/helpers/stdrep.ts +6 -1
  203. package/src/helpers/surface.ts +82 -0
  204. package/src/helpers/targetguard.ts +91 -0
  205. package/src/helpers/text.ts +22 -0
  206. package/src/helpers/textguard.ts +208 -0
  207. package/src/helpers/title.ts +59 -0
  208. package/src/sdkgen.ts +65 -85
  209. package/src/testkit.ts +12 -0
@@ -1,24 +1,64 @@
1
1
  import { Content, File, each } from 'jostraca'
2
2
  import { cmp } from '../helpers/component'
3
+ import { fact } from '../helpers/facts'
3
4
  import { packageVersion } from '../helpers/packageMeta'
5
+ import { SURFACE_WORD, documentOrder, surfaceOf } from '../helpers/surface'
6
+ import { definitionName, seriesList } from '../helpers/text'
4
7
  import { KIT, getModelPath } from '../types'
5
8
 
6
9
 
10
+ // "TypeScript and Python, plus CLI and MCP surfaces": the SDK languages, then
11
+ // every other surface the project generates.
12
+ function releaseScope(targets: any[]): string {
13
+ const langs = targets.filter((t: any) => 'sdk' === surfaceOf(t))
14
+ .map((t: any) => fact(t, 'title'))
15
+ const others = [...new Set(targets.map((t: any) => surfaceOf(t))
16
+ .filter((surface: string) => '' !== surface && 'sdk' !== surface))]
17
+ .map((surface: string) => SURFACE_WORD[surface])
18
+
19
+ const surfaces = 0 === others.length ? '' : 1 === others.length ?
20
+ 'the ' + others[0] + ' surface' : seriesList(others) + ' surfaces'
21
+
22
+ return 0 === langs.length ? surfaces :
23
+ seriesList(langs) + ('' === surfaces ? '' : ', plus ' + surfaces)
24
+ }
25
+
26
+
27
+ // Breaks a list item at the width of the rest of the file.
28
+ function listItem(text: string, width = 76): string {
29
+ const lines: string[] = []
30
+ let line = '-'
31
+ for (const word of text.split(' ')) {
32
+ if (2 < line.length && width < line.length + 1 + word.length) {
33
+ lines.push(line)
34
+ line = ' '
35
+ }
36
+ line += ' ' + word
37
+ }
38
+ return [...lines, line].join('\n')
39
+ }
40
+
41
+
7
42
  const Changelog = cmp(function Changelog(props: any) {
8
43
  const { ctx$ } = props
9
44
  const { model } = ctx$
10
45
 
11
46
  const name = model.Name || model.name
12
47
 
48
+ const targets = documentOrder(model,
49
+ each(getModelPath(model, `main.${KIT}.target`, { required: false }) || {})
50
+ .filter((t: any) => false !== t.active))
51
+
13
52
  // Written once, so the first entry is the version the targets start at; a
14
53
  // heading with no number when they start at different ones.
15
54
  const versions = new Set<string>()
16
- each(getModelPath(model, `main.${KIT}.target`) || {}, (t: any) => {
17
- if (false !== t.active) versions.add(packageVersion(model, t.name))
18
- })
55
+ targets.forEach((t: any) => versions.add(packageVersion(model, t.name)))
19
56
  const first = 1 < versions.size ? 'Initial release' :
20
57
  `[${[...versions][0] || packageVersion(model, '')}]`
21
58
 
59
+ const scope = releaseScope(targets)
60
+ const definition = definitionName(fact(model.main[KIT], 'definitionKind'), true)
61
+
22
62
  File({ name: 'CHANGELOG.md', exclude: true }, () => {
23
63
  Content(`# Changelog
24
64
 
@@ -30,9 +70,9 @@ This project follows [Keep a Changelog](https://keepachangelog.com) and
30
70
 
31
71
  ## ${first}
32
72
 
33
- - Initial generated release of the ${name} SDK (TypeScript, Python, PHP, Go,
34
- Ruby, and Lua, plus CLI and MCP surfaces), generated from the upstream
35
- OpenAPI specification by @voxgig/sdkgen.
73
+ ${listItem('Initial generated release of the ' + name + ' SDK' +
74
+ ('' === scope ? '' : ' (' + scope + ')') +
75
+ ', generated from the upstream ' + definition + ' by @voxgig/sdkgen.')}
36
76
  `)
37
77
  })
38
78
  })
package/src/cmp/Deploy.ts CHANGED
@@ -1,23 +1,18 @@
1
- import { each, Content, File } from 'jostraca'
1
+ import { Content, File } from 'jostraca'
2
2
  import { cmp } from '../helpers/component'
3
3
 
4
4
  import { packageVersion, registryState } from '../helpers/packageMeta'
5
+ import { fact } from '../helpers/facts'
5
6
 
6
- import {
7
- KIT,
8
- getModelPath
9
- } from '../types'
7
+ import { KIT } from '../types'
10
8
 
11
9
 
12
10
  const Deploy = cmp(function Deploy(props: any) {
13
11
  const { ctx$ } = props
14
12
  const { model } = ctx$
15
13
 
16
- const targetMap = getModelPath(model, `main.${KIT}.target`) || {}
17
- const targets: any[] = []
18
- each(targetMap, (t: any) => {
19
- if (false !== t.active) targets.push(t)
20
- })
14
+ const kit = model.main[KIT]
15
+ const targets: any[] = fact(kit, 'active').map((name: string) => kit.target[name])
21
16
 
22
17
  if (0 === targets.length) {
23
18
  return
@@ -111,7 +106,20 @@ function makeDeployMakefile(model: any, targets: any[]): string {
111
106
  const args = vaultExecArgs(t)
112
107
 
113
108
  const via = t.publish?.tag?.via || 'port'
109
+ const dir = fact(t, 'dir')
114
110
  const rs = registryState(model, t.name)
111
+ const tag = fact(t, 'tag')
112
+
113
+ if (('tag' === rs && (reg || 'root' === via)) || ('tag' !== rs && 'active' !== rs)) {
114
+ if ('' === tag) {
115
+ return `
116
+ deploy-${t.name}:
117
+ \t@echo "deploy-${t.name}: nothing to deploy — the model cuts no release tag for ${t.name} (publish.tag.active is false)."
118
+
119
+ deploy-dry-${t.name}: deploy-${t.name}
120
+ `
121
+ }
122
+ }
115
123
 
116
124
  if ('tag' === rs && (reg || 'root' === via)) {
117
125
  return `
@@ -121,7 +129,7 @@ deploy-${t.name}:
121
129
 
122
130
  deploy-dry-${t.name}:
123
131
  \tboru vault exec --dry-run ${ghArgs} -- $(MAKE) tag-push-${t.name}
124
- ${tagPushRecipe(t.name, packageVersion(model, t.name), 'tag-only port')}
132
+ ${tagPushRecipe(t.name, tag, packageVersion(model, t.name), 'tag-only port')}
125
133
  `
126
134
  }
127
135
 
@@ -134,16 +142,16 @@ deploy-${t.name}:
134
142
 
135
143
  deploy-dry-${t.name}:
136
144
  \tboru vault exec --dry-run ${ghArgs} -- $(MAKE) tag-push-${t.name}
137
- ${tagPushRecipe(t.name, packageVersion(model, t.name), reg.name + ' publication ' + word + ' — tag-only deploy')}
145
+ ${tagPushRecipe(t.name, tag, packageVersion(model, t.name), reg.name + ' publication ' + word + ' — tag-only deploy')}
138
146
  `
139
147
  }
140
148
 
141
149
  return `
142
150
  deploy-${t.name}:
143
- \tboru vault exec ${args} -- $(MAKE) -C ${t.name} publish
151
+ \tboru vault exec ${args} -- $(MAKE) -C ${dir} publish
144
152
 
145
153
  deploy-dry-${t.name}:
146
- \tboru vault exec --dry-run ${args} -- $(MAKE) -C ${t.name} publish
154
+ \tboru vault exec --dry-run ${args} -- $(MAKE) -C ${dir} publish
147
155
  `
148
156
  }).join('')
149
157
 
@@ -154,10 +162,9 @@ deploy-dry-${t.name}:
154
162
  # on every \`npm run generate\` in .sdk/; publication details live in the
155
163
  # model (.sdk/model/target/<target>.aontu, \`publish\` section).
156
164
  #
157
- # Every port gets a git release tag <target>/vX.Y.Z. Ports with an ACTIVE
158
- # registry also publish a package there. Credentials are injected at exec
159
- # time by the boru key vault (https://github.com/boru-lang/boru) — never
160
- # stored on disk or passed on the command line.
165
+ ${commentBlock(tagSentence(targets) + ' Ports with an ACTIVE registry also publish a package there.' +
166
+ ' Credentials are injected at exec time by the boru key vault' +
167
+ ' (https://github.com/boru-lang/boru) — never stored on disk or passed on the command line.', 72)}
161
168
  #
162
169
  # Publication state (from the model):
163
170
  ${summary}
@@ -206,10 +213,42 @@ ${deployRules}`
206
213
 
207
214
 
208
215
 
216
+ // The Makefile header's sentence on release tags, read from the tag facts: a
217
+ // port whose tag is not `<target>/vX.Y.Z` is named with its own.
218
+ function tagSentence(targets: any[]): string {
219
+ const odd = targets.filter((t: any) => t.name + '/v' !== fact(t, 'tag'))
220
+ if (0 === odd.length) {
221
+ return 'Every port gets a git release tag <target>/vX.Y.Z.'
222
+ }
223
+ return 'Every port gets a git release tag <target>/vX.Y.Z, except ' +
224
+ odd.map((t: any) => '' === fact(t, 'tag') ? t.name + ', which gets none' :
225
+ t.name + ', tagged ' + fact(t, 'tag') + 'X.Y.Z').join(', and ') + '.'
226
+ }
227
+
228
+
229
+ // A paragraph as Makefile comment lines of at most `width` characters after
230
+ // the `# `.
231
+ function commentBlock(text: string, width: number): string {
232
+ const lines: string[] = []
233
+ let line = ''
234
+ for (const word of text.split(' ')) {
235
+ if ('' !== line && width < line.length + 1 + word.length) {
236
+ lines.push(line)
237
+ line = word
238
+ }
239
+ else {
240
+ line = '' === line ? word : line + ' ' + word
241
+ }
242
+ }
243
+ lines.push(line)
244
+ return lines.map((l: string) => '# ' + l).join('\n')
245
+ }
246
+
247
+
209
248
  // The root-level tag creation + push recipe for a target: boru --dry-run
210
249
  // filler cooperation, idempotent tag creation, token-authenticated https
211
250
  // push (works from an ssh-remote clone without ssh keys).
212
- function tagPushRecipe(name: string, version: string, note: string): string {
251
+ function tagPushRecipe(name: string, tagPrefix: string, version: string, note: string): string {
213
252
  // The version is embedded in both Make and shell syntax.
214
253
  if (!/^[0-9A-Za-z][0-9A-Za-z.+-]*$/.test(version)) {
215
254
  throw new Error('Deploy: invalid publish.version for target "' + name + '": ' + JSON.stringify(version))
@@ -217,7 +256,7 @@ function tagPushRecipe(name: string, version: string, note: string): string {
217
256
 
218
257
  return `
219
258
  tag-push-${name}:
220
- \t@set -e; tag="${name}/v${version}"; \\
259
+ \t@set -e; tag="${tagPrefix}${version}"; \\
221
260
  \ttoken="\$\${GITHUB_TOKEN:-$$GH_TOKEN}"; \\
222
261
  \tif [ "$$token" = "$(BORU_DRY_RUN_FILLER)" ]; then \\
223
262
  \t echo "[dry-run] boru filler token detected: would create (if missing) and push tag $$tag; nothing pushed."; exit 0; fi; \\
package/src/cmp/Entity.ts CHANGED
@@ -19,7 +19,7 @@ const Entity = cmp(function Entity(props: any) {
19
19
  // Entity_<lang> components pull stdrep off ctx$ for their fragments, and
20
20
  // Entity is the FIRST phase Root runs — so the generator-owned keys have to
21
21
  // exist by here, not just by Main.
22
- ensureStdrep(ctx$)
22
+ ensureStdrep(ctx$, target)
23
23
 
24
24
  const entitySDK = getModelPath(ctx$.model, `main.${KIT}.entity.${entity.name}`)
25
25
 
@@ -7,6 +7,7 @@ import { Project } from 'jostraca'
7
7
  import { KIT } from '@voxgig/apidef'
8
8
 
9
9
  import { fact } from '../helpers/facts'
10
+ import { repoInfo } from '../helpers/packageMeta'
10
11
 
11
12
  import { Main } from './Main'
12
13
  import { Entity } from './Entity'
@@ -41,6 +42,11 @@ const ExternalTarget = cmp(function ExternalTarget(props: any) {
41
42
  ctx$.stdrep = ctx$.stdrep || {}
42
43
  names(ctx$.stdrep, model.Name, 'Project' + 'Name')
43
44
 
45
+ if ('' !== (target.output?.repo || '')) {
46
+ const { host, path } = repoInfo(model, target.name)
47
+ ctx$.model = { ...model, main: { ...model.main, [KIT]: { ...model.main[KIT], repo: { host, path } } } }
48
+ }
49
+
44
50
  const entity = model.main[KIT].entity || {}
45
51
  const feature = model.main[KIT].feature || {}
46
52
 
@@ -3,7 +3,7 @@ import { Copy, Folder } from 'jostraca'
3
3
  import { cmp } from '../helpers/component'
4
4
 
5
5
  import { ensureStdrep } from '../helpers/stdrep'
6
- import { featureApplies, featureTags, shippedProvides } from '../helpers/applicability'
6
+ import { featureApplies, featureTags, providedBy, shippedProvides } from '../helpers/applicability'
7
7
  import { pluginExcludesFor } from '../helpers/featureSource'
8
8
  import { originName } from '../helpers/packageMeta'
9
9
  import { resolvesBundled } from '../action/resolve'
@@ -18,7 +18,7 @@ const Feature = cmp(function Feature(props: any) {
18
18
  // missing template folder and abort the whole run, taking every other
19
19
  // target with it. See helpers/applicability and docs/design/feature-tags.
20
20
  if (!featureApplies(feature, target)) {
21
- const provided = featureTags(target.provides)
21
+ const provided = providedBy(target)
22
22
  const unmet = featureTags(feature.needs).filter((n) => !provided.includes(n))
23
23
  const origin = originName(ctx$.model, target.name)
24
24
  const stale = resolvesBundled(target, target.name) &&
@@ -44,7 +44,7 @@ const Feature = cmp(function Feature(props: any) {
44
44
  // files, because this Copy has already written them.
45
45
  exclude: pluginExcludesFor(ctx$.model, feature.name),
46
46
  replace: {
47
- ...ensureStdrep(ctx$),
47
+ ...ensureStdrep(ctx$, target),
48
48
  FEATURE_VERSION: feature.version,
49
49
  FEATURE_Name: feature.Name,
50
50
  }
package/src/cmp/Main.ts CHANGED
@@ -18,7 +18,7 @@ const Main = cmp(function Main(props: any) {
18
18
 
19
19
  // Generator-owned placeholders (PROJECTENV) that the project's frozen
20
20
  // Root.ts cannot know about.
21
- const stdrep = ensureStdrep(ctx$)
21
+ const stdrep = ensureStdrep(ctx$, target)
22
22
 
23
23
  // Per target, as `plain` names the target's own release; each Main_<lang>
24
24
  // copies its templates with this map before the next target sets it.
@@ -1,6 +1,6 @@
1
1
  /* Copyright (c) 2024-2026 Voxgig Ltd, MIT License */
2
2
 
3
- import { each, Content, File, Folder } from 'jostraca'
3
+ import { Content, File, Folder } from 'jostraca'
4
4
  import { cmp } from '../helpers/component'
5
5
 
6
6
  import {
@@ -8,9 +8,10 @@ import {
8
8
  getModelPath
9
9
  } from '../types'
10
10
 
11
- import { hasPackageName, packageName, packageVersion, registryState, repoInfo } from '../helpers/packageMeta'
11
+ import { hasPackageName, packageName, packageVersion, registryState, releaseBranch, repoInfo } from '../helpers/packageMeta'
12
12
 
13
13
  import { npmTrustScript } from '../admin/npm-trust'
14
+ import { fact } from '../helpers/facts'
14
15
 
15
16
 
16
17
  const PublishWorkflow = cmp(function PublishWorkflow(props: any) {
@@ -23,16 +24,10 @@ const PublishWorkflow = cmp(function PublishWorkflow(props: any) {
23
24
  // npm's OIDC exchange — and a PyPI or RubyGems target needs a different
24
25
  // workflow rather than this one with a word changed. Emitting nothing for
25
26
  // them is the honest answer until those exist.
26
- const npmTargets: any[] = []
27
- each(targetMap, (t: any) => {
28
- if (false === t.active) {
29
- return
30
- }
31
- if ('npm' === (t.publish?.registry?.name || '') && hasPackageName(model, t.name) &&
32
- 'inactive' !== registryState(model, t.name)) {
33
- npmTargets.push(t)
34
- }
35
- })
27
+ const npmTargets: any[] = fact(model.main[KIT], 'active')
28
+ .map((name: string) => targetMap[name])
29
+ .filter((t: any) => 'npm' === (t.publish?.registry?.name || '') && hasPackageName(model, t.name) &&
30
+ 'inactive' !== registryState(model, t.name))
36
31
 
37
32
  if (0 === npmTargets.length) {
38
33
  return
@@ -77,25 +72,14 @@ function workflowFile(target: any): string {
77
72
  }
78
73
 
79
74
 
80
- function isPrimaryNpm(model: any, target: any, npmTargets: any[]): boolean {
81
- if (1 === npmTargets.length) {
82
- return true
83
- }
84
- return packageName(model, target.name) === packageName(model, 'npm')
85
- }
86
-
87
-
88
- function releaseTag(model: any, target: any, npmTargets: any[]): string {
89
- return isPrimaryNpm(model, target, npmTargets) ?
90
- 'v$VERSION' : `${target.name}/v$VERSION`
91
- }
92
-
93
-
94
75
  function publishWorkflow(
95
76
  model: any, target: any, npmTargets: any[], repository: string | null,
96
77
  ): string {
97
78
  const name = target.name
98
- const tag = releaseTag(model, target, npmTargets)
79
+ const dir = fact(target, 'dir')
80
+ const tag = fact(target, 'tag') + '$VERSION'
81
+ const tagged = '' !== fact(target, 'tag')
82
+ const branch = releaseBranch(model)
99
83
  const pkg = packageName(model, name)
100
84
  const setup = null == repository ? '' : `
101
85
  # .sdk/admin/setup-npm-trust.sh registers exactly this, and with --check
@@ -104,7 +88,7 @@ function publishWorkflow(
104
88
 
105
89
  return `# Generated by @voxgig/sdkgen. Do not edit.
106
90
  #
107
- # Publishes ${pkg} (the \`${name}/\` target) to npm, via GitHub OIDC Trusted
91
+ # Publishes ${pkg} (the \`${dir}/\` target) to npm, via GitHub OIDC Trusted
108
92
  # Publishing — no NPM_TOKEN. npm exchanges a short-lived OIDC token minted
109
93
  # for THIS job in THIS repository for a publish credential, and attaches SLSA
110
94
  # provenance automatically.
@@ -121,12 +105,13 @@ function publishWorkflow(
121
105
  #
122
106
  ${'active' === registryState(model, name) ? `# BY DISPATCH, deliberately. The deploy Makefile publishes with a
123
107
  # vault-injected token; a tag-triggered workflow racing it would publish one
124
- # version by two mechanisms.` : `# BY DISPATCH, deliberately. While the registry is pending, the deploy
108
+ # version by two mechanisms.` : tagged ? `# BY DISPATCH, deliberately. While the registry is pending, the deploy
125
109
  # Makefile only cuts the git tag, and a tag-triggered workflow would turn
126
- # every tag it cuts into a publish.`} Releasing is an act someone performs and
110
+ # every tag it cuts into a publish.` : `# BY DISPATCH, deliberately. While the registry is pending, the deploy
111
+ # Makefile publishes nothing.`} Releasing is an act someone performs and
127
112
  # watches.
128
113
  #
129
- # THREE JOBS, BECAUSE THEY NEED DIFFERENT PRIVILEGES. A dependency lifecycle
114
+ # ${tagged ? 'THREE' : 'TWO'} JOBS, BECAUSE THEY NEED DIFFERENT PRIVILEGES. A dependency lifecycle
130
115
  # script can ask the runner for any OIDC token its job is permitted to mint,
131
116
  # so a job that both installs dependencies and holds \`id-token: write\` can be
132
117
  # made to publish before its own gates finish. The same reasoning keeps
@@ -135,7 +120,7 @@ ${'active' === registryState(model, name) ? `# BY DISPATCH, deliberately. The de
135
120
  #
136
121
  # verify contents: read, nothing else. Installs, builds and tests.
137
122
  # publish id-token: write. Installs no dependencies and runs no project
138
- # code; it packs what is already in the tree.
123
+ # code; it packs what is already in the tree.${tagged ? `
139
124
  # tag contents: write. Runs git and nothing else.
140
125
  #
141
126
  # THE TAG IS CUT HERE BECAUSE IT CANNOT BE CUT ANYWHERE ELSE. npm binds the
@@ -144,7 +129,11 @@ ${'active' === registryState(model, name) ? `# BY DISPATCH, deliberately. The de
144
129
  # workflow run, so "tag, and let a tag-triggered publisher fire" does not
145
130
  # work. A release that publishes but leaves no ref cannot be answered later:
146
131
  # nothing in git says which tree the tarball came from, and nothing
147
- # downstream can pin this SDK by tag.
132
+ # downstream can pin this SDK by tag.` : `
133
+ #
134
+ # NO TAG IS CUT. The model switches this target's release tag off
135
+ # (publish.tag.active is false), so nothing in git names the tree a
136
+ # version was published from.`}
148
137
 
149
138
  name: publish-${name}
150
139
 
@@ -152,7 +141,7 @@ on:
152
141
  workflow_dispatch:
153
142
  inputs:
154
143
  expect_sha:
155
- description: 'Optional: refuse unless main is still at this commit'
144
+ description: 'Optional: refuse unless ${branch} is still at this commit'
156
145
  type: string
157
146
  default: ''
158
147
 
@@ -176,40 +165,40 @@ jobs:
176
165
  with:
177
166
  node-version: 24.x
178
167
 
179
- # RELEASES COME FROM main, INCLUDING FROM THE BUTTON. workflow_dispatch
168
+ # RELEASES COME FROM ${branch}, INCLUDING FROM THE BUTTON. workflow_dispatch
180
169
  # accepts any ref, so without this the Actions UI can release a branch.
181
- - name: This ref is main, and is where the caller thinks it is
170
+ - name: This ref is ${branch}, and is where the caller thinks it is
182
171
  env:
183
172
  EXPECT: \${{ inputs.expect_sha }}
184
173
  run: |
185
174
  set -euo pipefail
186
- if [ "\${GITHUB_REF_NAME}" != "main" ]; then
187
- echo "::error::releases come from main, not \${GITHUB_REF_NAME}"
175
+ if [ "\${GITHUB_REF_NAME}" != "${branch}" ]; then
176
+ echo "::error::releases come from ${branch}, not \${GITHUB_REF_NAME}"
188
177
  exit 1
189
178
  fi
190
179
  if [ -n "\$EXPECT" ] && [ "\$EXPECT" != "\$GITHUB_SHA" ]; then
191
- echo "::error::main is at \$GITHUB_SHA, not \$EXPECT"
180
+ echo "::error::${branch} is at \$GITHUB_SHA, not \$EXPECT"
192
181
  exit 1
193
182
  fi
194
183
 
195
184
  - name: Resolve the version
196
185
  id: version
197
- working-directory: ${name}
186
+ working-directory: ${dir}
198
187
  run: |
199
188
  set -euo pipefail
200
189
  VERSION="\$(node -p "require('./package.json').version")"
201
- test -n "\$VERSION" || { echo "::error::no version in ${name}/package.json"; exit 1; }
190
+ test -n "\$VERSION" || { echo "::error::no version in ${dir}/package.json"; exit 1; }
202
191
  echo "version=\$VERSION" >> "\$GITHUB_OUTPUT"
203
192
  echo "${pkg} \$VERSION"
204
193
 
205
194
  - run: npm install
206
- working-directory: ${name}
195
+ working-directory: ${dir}
207
196
 
208
197
  - run: npm run build
209
- working-directory: ${name}
198
+ working-directory: ${dir}
210
199
 
211
200
  - run: npm test
212
- working-directory: ${name}
201
+ working-directory: ${dir}
213
202
 
214
203
  publish:
215
204
  name: npm publish
@@ -254,9 +243,15 @@ jobs:
254
243
 
255
244
  - name: Publish to npm
256
245
  if: steps.registry.outputs.published == 'false'
257
- working-directory: ${name}
246
+ working-directory: ${dir}
258
247
  run: npm publish --access public
248
+ ` + (tagged ? tagJob(tag) : '')
249
+ }
250
+
259
251
 
252
+ // The job that cuts the release tag, once the package is published.
253
+ function tagJob(tag: string): string {
254
+ return `
260
255
  # Runs git and nothing else. No install, no project code — so the
261
256
  # repository-write credential is never in scope while third-party code runs.
262
257
  #
@@ -310,6 +305,7 @@ jobs:
310
305
 
311
306
 
312
307
  function publishingDoc(model: any, targets: any[], repository: string | null): string {
308
+ const branch = releaseBranch(model)
313
309
  const pkg = packageName(model, targets[0].name)
314
310
  const first = workflowFile(targets[0])
315
311
 
@@ -335,9 +331,11 @@ An npm with no \`npm trust\` command is bypassed for \`npx npm@latest\`.
335
331
  // primary npm target owns the bare `v<version>` and every other one is
336
332
  // prefixed, so with more than one npm target the answer differs per row.
337
333
  const tagRows = '| target | tag |\n|---|---|\n' + targets.map((t: any) =>
338
- `| \`${t.name}/\` | \`` +
339
- releaseTag(model, t, targets).replace('$VERSION', '<version>') +
340
- '\` |').join('\n')
334
+ `| \`${t.name}/\` | ` +
335
+ ('' === fact(t, 'tag') ? 'none' : '`' + fact(t, 'tag') + '<version>`') +
336
+ ' |').join('\n')
337
+ const untagged = targets.filter((t: any) => '' === fact(t, 'tag')).length
338
+ const tagged = untagged < targets.length
341
339
 
342
340
  return `# Publishing
343
341
 
@@ -364,24 +362,27 @@ publish credential, and attaches SLSA provenance as it goes.
364
362
 
365
363
  main: kit: target: ${targets[0].name}: publish: version: '<x.y.z>'
366
364
 
367
- 2. Commit and push to \`main\`, and let CI go green.
365
+ 2. Commit and push to \`${branch}\`, and let CI go green.
368
366
  3. Run the workflow from the Actions tab, or:
369
367
 
370
- gh workflow run ${first} --ref main -f expect_sha=$(git rev-parse HEAD)
368
+ gh workflow run ${first} --ref ${branch} -f expect_sha=$(git rev-parse HEAD)
371
369
 
372
- \`expect_sha\` is optional and worth using: it refuses if \`main\` moved between
370
+ \`expect_sha\` is optional and worth using: it refuses if \`${branch}\` moved between
373
371
  the commit you checked and the run resolving.
374
372
 
375
373
  ${dispatchReason(model, targets)}
376
374
 
377
- ## The release is tagged for you
375
+ ${tagged ? `## The release is tagged for you
378
376
 
379
377
  The workflow cuts the git tag itself, after a successful publish, so a
380
378
  released version always has a ref naming the tree it came from. Nothing to
381
379
  do by hand.
382
380
 
383
381
  ${tagRows}
384
-
382
+ ${0 < untagged ? `
383
+ A target whose tag reads none cuts no tag: its model sets
384
+ \`publish.tag.active: false\`, so its workflow has no tag job.
385
+ ` : ''}
385
386
  Re-dispatching a version that is already on the registry skips the publish
386
387
  and still cuts a missing tag, so a partial release is finished by running it
387
388
  again rather than repaired by hand. If the tag already exists on a DIFFERENT
@@ -392,7 +393,13 @@ which is wrong.
392
393
  The tag job is the only one that may write to the repository, and it runs
393
394
  git and nothing else. \`contents: write\` never shares a job with project
394
395
  code, for the same reason \`id-token: write\` does not — \`checkout\` persists
395
- its token into the git config for the whole job.
396
+ its token into the git config for the whole job.` : `## No release tag
397
+
398
+ The model switches the release tag off (\`publish.tag.active: false\`), so
399
+ the workflow publishes without cutting a git tag, and nothing in git names
400
+ the tree a version came from.
401
+
402
+ ${tagRows}`}
396
403
 
397
404
  ## One-time set-up
398
405
 
@@ -415,11 +422,11 @@ ${setupCheck}
415
422
  trusted-publisher settings once a version exists, so the FIRST release of a
416
423
  package goes out by hand from an authenticated machine:
417
424
 
418
- cd ts && npm publish --access public
425
+ ${'.' === fact(targets[0], 'dir') ? '' : 'cd ' + fact(targets[0], 'dir') + ' && '}npm publish --access public
419
426
 
420
427
  After that, register the publisher and every later release is a dispatch.
421
428
 
422
- ## Why the workflow has three jobs
429
+ ## Why the workflow has ${tagged ? 'three' : 'two'} jobs
423
430
 
424
431
  A dependency lifecycle script can ask the runner for any OIDC token the job
425
432
  it runs in is permitted to mint. A job that both installs dependencies and
@@ -427,14 +434,15 @@ holds \`id-token: write\` can therefore be made to publish as this package
427
434
  before its own gates finish.
428
435
 
429
436
  So \`verify\` installs, builds and tests under \`contents: read\` and holds no
430
- credential; \`publish\` holds \`id-token: write\` while installing nothing and
437
+ credential${tagged ? `; \`publish\` holds \`id-token: write\` while installing nothing and
431
438
  running no project code; and \`tag\` holds \`contents: write\` while running
432
439
  git and nothing else.
433
440
 
434
441
  The tag cannot be moved out into its own workflow: npm binds the trusted
435
442
  publisher to ONE workflow filename, so anything that must accompany a publish
436
443
  has to live inside this file. Nor can it be left to a tag-triggered
437
- publisher — a ref pushed with \`GITHUB_TOKEN\` starts no further workflow run.
444
+ publisher — a ref pushed with \`GITHUB_TOKEN\` starts no further workflow run.` : `, and \`publish\` holds \`id-token: write\` while installing nothing and
445
+ running no project code.`}
438
446
  `
439
447
  }
440
448
 
@@ -24,7 +24,7 @@ const ReadmeIntro = cmp(function ReadmeIntro(props: any) {
24
24
  return
25
25
  }
26
26
 
27
- Content(`# ${model.Name} ${target.title} SDK
27
+ Content(`# ${model.Name} ${fact(target, 'title')} SDK
28
28
 
29
29
  ${fact(model.main[KIT], 'text').tagline.inline}
30
30
 
@@ -7,7 +7,7 @@ import {
7
7
  getModelPath
8
8
  } from '../types'
9
9
 
10
- import { isAuthActive } from '../utility'
10
+ import { fact } from '../helpers/facts'
11
11
  import { optionalComponent } from '../helpers/optional'
12
12
 
13
13
 
@@ -36,7 +36,7 @@ const ReadmeModel = cmp(function ReadmeModel(props: any) {
36
36
  }
37
37
  else {
38
38
  // Fallback: generic reference summary
39
- ReadmeModelGeneric({ target, model, entityList, authActive: isAuthActive(model) })
39
+ ReadmeModelGeneric({ target, model, entityList, authActive: fact(model.main[KIT], 'auth').apikey })
40
40
  }
41
41
  })
42
42
 
@@ -2,11 +2,10 @@
2
2
  import { Content } from 'jostraca'
3
3
  import { cmp } from '../helpers/component'
4
4
 
5
- import { envName, originName, packageName } from '../helpers/packageMeta'
5
+ import { originName, packageName } from '../helpers/packageMeta'
6
6
  import { targetFeatures } from '../helpers/applicability'
7
7
  import { fact } from '../helpers/facts'
8
- import { isAuthActive } from '../utility'
9
-
8
+ import { KIT } from '../types'
10
9
 
11
10
 
12
11
  // Targets where station.connect(SDK) is the idiomatic binding; everything
@@ -31,7 +30,7 @@ const ReadmeStation = cmp(function ReadmeStation(props: any) {
31
30
  // main.slug in the embedded config); an untagged instance ref IS the
32
31
  // slug, so this is also the default instance name.
33
32
  const slug = model.name
34
- const env = envName(model)
33
+ const env = fact(model.main[KIT], 'env').prefix
35
34
  const secretbase = env.toLowerCase()
36
35
  const secretname = secretbase + '.apikey'
37
36
  const origin = originName(model, target.name)
@@ -84,7 +83,7 @@ SDK features are configured in the same file too: fleet-wide, per api,
84
83
  or per instance. \`station.check()\` resolves and constructs every
85
84
  active instance without sending a request — run it in CI.
86
85
 
87
- ${isAuthActive(model) ? `### The secret name derives from the instance
86
+ ${fact(model.main[KIT], 'auth').apikey ? `### The secret name derives from the instance
88
87
 
89
88
  The credential comes from [sekreto](https://github.com/voxgig/sekreto)
90
89
  under a name derived from the **instance** name — the instance token