@voxgig/sdkgen 4.45.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 (276) hide show
  1. package/bin/voxgig-sdkgen +1 -1
  2. package/dist/action/check.js +73 -4
  3. package/dist/action/check.js.map +1 -1
  4. package/dist/action/copies.js +1 -0
  5. package/dist/action/copies.js.map +1 -1
  6. package/dist/action/doctor.d.ts +26 -2
  7. package/dist/action/doctor.js +208 -11
  8. package/dist/action/doctor.js.map +1 -1
  9. package/dist/action/package.d.ts +1 -1
  10. package/dist/action/package.js +15 -16
  11. package/dist/action/package.js.map +1 -1
  12. package/dist/action/remove.js +16 -4
  13. package/dist/action/remove.js.map +1 -1
  14. package/dist/action/resolve.d.ts +1 -0
  15. package/dist/action/resolve.js +10 -4
  16. package/dist/action/resolve.js.map +1 -1
  17. package/dist/action/target.d.ts +2 -1
  18. package/dist/action/target.js +50 -11
  19. package/dist/action/target.js.map +1 -1
  20. package/dist/admin/status.d.ts +7 -1
  21. package/dist/admin/status.js +34 -5
  22. package/dist/admin/status.js.map +1 -1
  23. package/dist/cmp/AgentGuide.js +46 -23
  24. package/dist/cmp/AgentGuide.js.map +1 -1
  25. package/dist/cmp/AgentGuideContent.d.ts +9 -7
  26. package/dist/cmp/AgentGuideContent.js +73 -43
  27. package/dist/cmp/AgentGuideContent.js.map +1 -1
  28. package/dist/cmp/AgentGuideFeature.js +19 -9
  29. package/dist/cmp/AgentGuideFeature.js.map +1 -1
  30. package/dist/cmp/AgentGuideTop.js +95 -49
  31. package/dist/cmp/AgentGuideTop.js.map +1 -1
  32. package/dist/cmp/Changelog.js +45 -4
  33. package/dist/cmp/Changelog.js.map +1 -1
  34. package/dist/cmp/Deploy.js +73 -35
  35. package/dist/cmp/Deploy.js.map +1 -1
  36. package/dist/cmp/Entity.js +1 -1
  37. package/dist/cmp/Entity.js.map +1 -1
  38. package/dist/cmp/ExternalTarget.js +10 -5
  39. package/dist/cmp/ExternalTarget.js.map +1 -1
  40. package/dist/cmp/Feature.js +12 -5
  41. package/dist/cmp/Feature.js.map +1 -1
  42. package/dist/cmp/FeatureDocs.d.ts +6 -4
  43. package/dist/cmp/FeatureDocs.js +14 -39
  44. package/dist/cmp/FeatureDocs.js.map +1 -1
  45. package/dist/cmp/FeatureHook.d.ts +7 -1
  46. package/dist/cmp/FeatureHook.js +34 -1
  47. package/dist/cmp/FeatureHook.js.map +1 -1
  48. package/dist/cmp/Main.js +1 -1
  49. package/dist/cmp/Main.js.map +1 -1
  50. package/dist/cmp/PublishWorkflow.js +89 -55
  51. package/dist/cmp/PublishWorkflow.js.map +1 -1
  52. package/dist/cmp/ReadmeErrors.js +521 -18
  53. package/dist/cmp/ReadmeErrors.js.map +1 -1
  54. package/dist/cmp/ReadmeExplanation.js +280 -44
  55. package/dist/cmp/ReadmeExplanation.js.map +1 -1
  56. package/dist/cmp/ReadmeFeatures.js +16 -7
  57. package/dist/cmp/ReadmeFeatures.js.map +1 -1
  58. package/dist/cmp/ReadmeIntro.js +4 -3
  59. package/dist/cmp/ReadmeIntro.js.map +1 -1
  60. package/dist/cmp/ReadmeModel.js +2 -2
  61. package/dist/cmp/ReadmeModel.js.map +1 -1
  62. package/dist/cmp/ReadmeRefFeatures.js +34 -24
  63. package/dist/cmp/ReadmeRefFeatures.js.map +1 -1
  64. package/dist/cmp/ReadmeStation.js +12 -9
  65. package/dist/cmp/ReadmeStation.js.map +1 -1
  66. package/dist/cmp/ReadmeTop.js +479 -382
  67. package/dist/cmp/ReadmeTop.js.map +1 -1
  68. package/dist/cmp/ReadmeUnions.js +8 -2
  69. package/dist/cmp/ReadmeUnions.js.map +1 -1
  70. package/dist/cmp/Registered.js +1 -1
  71. package/dist/cmp/Registered.js.map +1 -1
  72. package/dist/cmp/Security.js +26 -5
  73. package/dist/cmp/Security.js.map +1 -1
  74. package/dist/cmp/Test.js +1 -1
  75. package/dist/cmp/Test.js.map +1 -1
  76. package/dist/helpers/alongside.d.ts +2 -3
  77. package/dist/helpers/alongside.js +16 -15
  78. package/dist/helpers/alongside.js.map +1 -1
  79. package/dist/helpers/applicability.d.ts +3 -1
  80. package/dist/helpers/applicability.js +40 -1
  81. package/dist/helpers/applicability.js.map +1 -1
  82. package/dist/helpers/component.js +9 -1
  83. package/dist/helpers/component.js.map +1 -1
  84. package/dist/helpers/copymerge.d.ts +3 -0
  85. package/dist/helpers/copymerge.js +43 -10
  86. package/dist/helpers/copymerge.js.map +1 -1
  87. package/dist/helpers/definitionPlan.js +0 -1
  88. package/dist/helpers/definitionPlan.js.map +1 -1
  89. package/dist/helpers/doccheck.d.ts +11 -0
  90. package/dist/helpers/doccheck.js +146 -0
  91. package/dist/helpers/doccheck.js.map +1 -0
  92. package/dist/helpers/doctext.d.ts +11 -0
  93. package/dist/helpers/doctext.js +85 -0
  94. package/dist/helpers/doctext.js.map +1 -0
  95. package/dist/helpers/exampleCall.d.ts +16 -0
  96. package/dist/helpers/exampleCall.js +334 -0
  97. package/dist/helpers/exampleCall.js.map +1 -0
  98. package/dist/helpers/exportnames.d.ts +4 -0
  99. package/dist/helpers/exportnames.js +35 -0
  100. package/dist/helpers/exportnames.js.map +1 -0
  101. package/dist/helpers/facts.d.ts +2 -1
  102. package/dist/helpers/facts.js +210 -5
  103. package/dist/helpers/facts.js.map +1 -1
  104. package/dist/helpers/flowGuard.d.ts +1 -1
  105. package/dist/helpers/flowGuard.js +20 -7
  106. package/dist/helpers/flowGuard.js.map +1 -1
  107. package/dist/helpers/generated.d.ts +1 -0
  108. package/dist/helpers/generated.js +1 -1
  109. package/dist/helpers/generated.js.map +1 -1
  110. package/dist/helpers/graphqlPoint.d.ts +2 -1
  111. package/dist/helpers/graphqlPoint.js +17 -0
  112. package/dist/helpers/graphqlPoint.js.map +1 -1
  113. package/dist/helpers/guardModel.d.ts +2 -0
  114. package/dist/helpers/guardModel.js +41 -0
  115. package/dist/helpers/guardModel.js.map +1 -0
  116. package/dist/helpers/manifest.d.ts +2 -1
  117. package/dist/helpers/manifest.js +16 -0
  118. package/dist/helpers/manifest.js.map +1 -1
  119. package/dist/helpers/mcpTools.d.ts +2 -1
  120. package/dist/helpers/mcpTools.js +8 -1
  121. package/dist/helpers/mcpTools.js.map +1 -1
  122. package/dist/helpers/modelcheck.d.ts +2 -1
  123. package/dist/helpers/modelcheck.js +13 -0
  124. package/dist/helpers/modelcheck.js.map +1 -1
  125. package/dist/helpers/opExample.d.ts +9 -2
  126. package/dist/helpers/opExample.js +22 -2
  127. package/dist/helpers/opExample.js.map +1 -1
  128. package/dist/helpers/opShape.d.ts +2 -1
  129. package/dist/helpers/opShape.js +29 -17
  130. package/dist/helpers/opShape.js.map +1 -1
  131. package/dist/helpers/packageMeta.d.ts +6 -4
  132. package/dist/helpers/packageMeta.js +88 -53
  133. package/dist/helpers/packageMeta.js.map +1 -1
  134. package/dist/helpers/placement.d.ts +15 -0
  135. package/dist/helpers/placement.js +76 -0
  136. package/dist/helpers/placement.js.map +1 -0
  137. package/dist/helpers/semver.d.ts +3 -1
  138. package/dist/helpers/semver.js +28 -0
  139. package/dist/helpers/semver.js.map +1 -1
  140. package/dist/helpers/serverVars.js +3 -2
  141. package/dist/helpers/serverVars.js.map +1 -1
  142. package/dist/helpers/shipped.d.ts +2 -1
  143. package/dist/helpers/shipped.js +12 -0
  144. package/dist/helpers/shipped.js.map +1 -1
  145. package/dist/helpers/sourcestring.d.ts +3 -0
  146. package/dist/helpers/sourcestring.js +43 -0
  147. package/dist/helpers/sourcestring.js.map +1 -0
  148. package/dist/helpers/stdrep.d.ts +1 -1
  149. package/dist/helpers/stdrep.js +5 -1
  150. package/dist/helpers/stdrep.js.map +1 -1
  151. package/dist/helpers/surface.d.ts +7 -0
  152. package/dist/helpers/surface.js +69 -0
  153. package/dist/helpers/surface.js.map +1 -0
  154. package/dist/helpers/targetguard.d.ts +13 -0
  155. package/dist/helpers/targetguard.js +65 -0
  156. package/dist/helpers/targetguard.js.map +1 -0
  157. package/dist/helpers/text.d.ts +3 -1
  158. package/dist/helpers/text.js +16 -0
  159. package/dist/helpers/text.js.map +1 -1
  160. package/dist/helpers/textguard.d.ts +31 -0
  161. package/dist/helpers/textguard.js +157 -0
  162. package/dist/helpers/textguard.js.map +1 -0
  163. package/dist/helpers/title.d.ts +4 -0
  164. package/dist/helpers/title.js +52 -0
  165. package/dist/helpers/title.js.map +1 -0
  166. package/dist/sdkgen.d.ts +4 -6
  167. package/dist/sdkgen.js +72 -63
  168. package/dist/sdkgen.js.map +1 -1
  169. package/dist/testkit.d.ts +7 -2
  170. package/dist/testkit.js +27 -20
  171. package/dist/testkit.js.map +1 -1
  172. package/dist/tsconfig.tsbuildinfo +1 -1
  173. package/dist/utility.js +2 -1
  174. package/dist/utility.js.map +1 -1
  175. package/model/fact.aontu +150 -0
  176. package/model/sdkgen.aontu +15 -3
  177. package/package.json +3 -1
  178. package/project/.sdk/src/cmp/c/ReadmeQuick_c.ts +2 -2
  179. package/project/.sdk/src/cmp/c/ReadmeTopQuick_c.ts +1 -1
  180. package/project/.sdk/src/cmp/clojure/ReadmeEntity_clojure.ts +12 -3
  181. package/project/.sdk/src/cmp/clojure/ReadmeQuick_clojure.ts +1 -1
  182. package/project/.sdk/src/cmp/cpp/ReadmeQuick_cpp.ts +1 -1
  183. package/project/.sdk/src/cmp/csharp/ReadmeQuick_csharp.ts +1 -1
  184. package/project/.sdk/src/cmp/elixir/ReadmeQuick_elixir.ts +1 -1
  185. package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +1 -1
  186. package/project/.sdk/src/cmp/java/ReadmeQuick_java.ts +1 -1
  187. package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +1 -1
  188. package/project/.sdk/src/cmp/kotlin/ReadmeQuick_kotlin.ts +1 -1
  189. package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +1 -1
  190. package/project/.sdk/src/cmp/ocaml/ReadmeQuick_ocaml.ts +1 -1
  191. package/project/.sdk/src/cmp/perl/ReadmeQuick_perl.ts +1 -1
  192. package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +1 -1
  193. package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +1 -1
  194. package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +1 -1
  195. package/project/.sdk/src/cmp/rust/ReadmeQuick_rust.ts +1 -1
  196. package/project/.sdk/src/cmp/scala/ReadmeQuick_scala.ts +1 -1
  197. package/project/.sdk/src/cmp/scala/ReadmeRef_scala.ts +4 -1
  198. package/project/.sdk/src/cmp/swift/ReadmeQuick_swift.ts +2 -1
  199. package/project/.sdk/src/cmp/swift/ReadmeRef_swift.ts +3 -0
  200. package/project/.sdk/src/cmp/swift/ReadmeTopQuick_swift.ts +2 -1
  201. package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +1 -1
  202. package/project/.sdk/src/cmp/ts/TestDefinition_ts.ts +3 -1
  203. package/project/.sdk/src/cmp/zig/ReadmeOptions_zig.ts +1 -1
  204. package/project/.sdk/src/cmp/zig/ReadmeQuick_zig.ts +3 -3
  205. package/project/.sdk/src/cmp/zig/ReadmeTopQuick_zig.ts +2 -2
  206. package/project/.sdk/tm/ocaml/test/feature/secrets/t_secrets.ml +3 -1
  207. package/project/.sdk/tm/php/test/feature/secrets/SecretsTest.php +2 -1
  208. package/project/.sdk/tm/zig/test/feature/secrets/secrets_test.zig +11 -2
  209. package/project/sdkgen-package.json +1 -1
  210. package/src/action/check.ts +99 -4
  211. package/src/action/copies.ts +2 -0
  212. package/src/action/doctor.ts +304 -15
  213. package/src/action/package.ts +11 -13
  214. package/src/action/remove.ts +20 -5
  215. package/src/action/resolve.ts +11 -4
  216. package/src/action/target.ts +66 -15
  217. package/src/admin/status.ts +25 -5
  218. package/src/cmp/AgentGuide.ts +52 -25
  219. package/src/cmp/AgentGuideContent.ts +75 -43
  220. package/src/cmp/AgentGuideFeature.ts +21 -10
  221. package/src/cmp/AgentGuideTop.ts +119 -49
  222. package/src/cmp/Changelog.ts +56 -5
  223. package/src/cmp/Deploy.ts +81 -40
  224. package/src/cmp/Entity.ts +1 -1
  225. package/src/cmp/ExternalTarget.ts +12 -6
  226. package/src/cmp/Feature.ts +13 -6
  227. package/src/cmp/FeatureDocs.ts +21 -40
  228. package/src/cmp/FeatureHook.ts +38 -1
  229. package/src/cmp/Main.ts +1 -1
  230. package/src/cmp/PublishWorkflow.ts +94 -60
  231. package/src/cmp/ReadmeErrors.ts +555 -25
  232. package/src/cmp/ReadmeExplanation.ts +316 -52
  233. package/src/cmp/ReadmeFeatures.ts +18 -8
  234. package/src/cmp/ReadmeIntro.ts +4 -3
  235. package/src/cmp/ReadmeModel.ts +2 -2
  236. package/src/cmp/ReadmeRefFeatures.ts +39 -27
  237. package/src/cmp/ReadmeStation.ts +13 -16
  238. package/src/cmp/ReadmeTop.ts +538 -397
  239. package/src/cmp/ReadmeUnions.ts +10 -2
  240. package/src/cmp/Registered.ts +1 -1
  241. package/src/cmp/Security.ts +35 -7
  242. package/src/cmp/Test.ts +1 -1
  243. package/src/helpers/alongside.ts +16 -19
  244. package/src/helpers/applicability.ts +44 -1
  245. package/src/helpers/component.ts +11 -1
  246. package/src/helpers/copymerge.ts +58 -10
  247. package/src/helpers/definitionPlan.ts +0 -1
  248. package/src/helpers/doccheck.ts +174 -0
  249. package/src/helpers/doctext.ts +115 -0
  250. package/src/helpers/exampleCall.ts +415 -0
  251. package/src/helpers/exportnames.ts +47 -0
  252. package/src/helpers/facts.ts +259 -5
  253. package/src/helpers/flowGuard.ts +22 -7
  254. package/src/helpers/generated.ts +3 -1
  255. package/src/helpers/graphqlPoint.ts +20 -1
  256. package/src/helpers/guardModel.ts +50 -0
  257. package/src/helpers/manifest.ts +19 -0
  258. package/src/helpers/mcpTools.ts +11 -1
  259. package/src/helpers/modelcheck.ts +16 -0
  260. package/src/helpers/opExample.ts +34 -2
  261. package/src/helpers/opShape.ts +29 -16
  262. package/src/helpers/packageMeta.ts +89 -52
  263. package/src/helpers/placement.ts +114 -0
  264. package/src/helpers/semver.ts +35 -0
  265. package/src/helpers/serverVars.ts +4 -2
  266. package/src/helpers/shipped.ts +13 -0
  267. package/src/helpers/sourcestring.ts +47 -0
  268. package/src/helpers/stdrep.ts +6 -1
  269. package/src/helpers/surface.ts +82 -0
  270. package/src/helpers/targetguard.ts +91 -0
  271. package/src/helpers/text.ts +22 -0
  272. package/src/helpers/textguard.ts +208 -0
  273. package/src/helpers/title.ts +59 -0
  274. package/src/sdkgen.ts +82 -78
  275. package/src/testkit.ts +42 -20
  276. package/src/utility.ts +2 -1
@@ -1,6 +1,8 @@
1
1
 
2
2
  import { names, Content, File } from 'jostraca'
3
3
  import { cmp } from '../helpers/component'
4
+ import { fact } from '../helpers/facts'
5
+ import { surfaceOf } from '../helpers/surface'
4
6
 
5
7
  import {
6
8
  activeTargets,
@@ -13,79 +15,102 @@ import {
13
15
  aontuSection,
14
16
  claudePointer,
15
17
  langCmd,
18
+ writesFeatureGuides,
16
19
  } from './AgentGuideContent'
17
20
 
18
21
 
19
- const AgentGuideTop = cmp(function AgentGuideTop(props: any) {
20
- const { ctx$ } = props
21
- const { model } = ctx$
22
+ const AgentGuideTopIntro = cmp(function AgentGuideTopIntro(props: any) {
23
+ const { Name, model, targets } = props.s
22
24
 
23
- if (model.name && !model.Name) names(model, model.name)
25
+ const featureGuides = targets.some((t: any) =>
26
+ fact(t, 'phase').agentguide && writesFeatureGuides(model, t))
24
27
 
25
- const Name = projectName(model)
26
- const targets = activeTargets(model)
27
- const features = activeFeatures(model)
28
- const entities = activeEntities(model)
28
+ // One SDK is named by its title; only several make a multi-language project.
29
+ const sdks = targets.filter((t: any) => 'sdk' === surfaceOf(t))
30
+ const project = 1 < sdks.length ? `multi-language SDK project. The client libraries in
31
+ each language directory are` : 1 === sdks.length ? `${fact(sdks[0], 'title')} SDK project. The client library
32
+ is` : `project. Its targets are`
33
+ const output = 1 < sdks.length ? 'the language directories' : 'the generated code'
29
34
 
30
- File({ name: 'AGENTS.md' }, () => {
31
- Content(`# ${Name} SDK — Agent Guide
35
+ Content(`# ${Name} SDK — Agent Guide
32
36
 
33
- This is a **generated** multi-language SDK project. The client libraries in
34
- each language directory are produced by [@voxgig/sdkgen](https://github.com/voxgig/sdkgen)
37
+ This is a **generated** ${project} produced by [@voxgig/sdkgen](https://github.com/voxgig/sdkgen)
35
38
  from an API model; the generator, model, templates, and components all live in
36
- \`.sdk/\`. Treat the language directories as build output — change the model,
39
+ \`.sdk/\`. Treat ${output} as build output — change the model,
37
40
  a template, or a component and regenerate.
38
41
 
39
42
  There are companion guides deeper in the tree: one per language
40
- (\`<lang>/AGENTS.md\`) and one per feature
41
- (\`<lang>/src/feature/<name>/AGENTS.md\`).
43
+ (\`<lang>/AGENTS.md\`)${featureGuides ? `, and one per feature in a target that keeps each
44
+ feature in its own directory (\`<lang>/src/feature/<name>/AGENTS.md\`)` : ''}.
42
45
 
43
46
  ## Project map
44
47
 
45
48
  `)
49
+ })
46
50
 
47
- if (0 < targets.length) {
48
- Content(`**Targets** (${targets.length}):
51
+
52
+ const AgentGuideTopTargets = cmp(function AgentGuideTopTargets(props: any) {
53
+ const { model, targets } = props.s
54
+
55
+ if (0 < targets.length) {
56
+ Content(`**Targets** (${targets.length}):
49
57
 
50
58
  | Target | Directory | Build guide |
51
59
  | --- | --- | --- |
52
60
  `)
53
- targets.forEach((t: any) => {
54
- const note = langCmd(t.name).note ? ' — ' + langCmd(t.name).note : ''
55
- Content(`| \`${t.name}\` | \`${t.name}/\`${note} | [\`${t.name}/AGENTS.md\`](./${t.name}/AGENTS.md) |
61
+ targets.forEach((t: any) => {
62
+ const note = langCmd(t.name, model).note ? ' — ' + langCmd(t.name, model).note : ''
63
+ const dir = 'folder' === fact(t, 'place') ? `\`${t.name}/\`` : '—'
64
+ const guide = fact(t, 'docs').agents ? `[\`${t.name}/AGENTS.md\`](./${t.name}/AGENTS.md)` : '—'
65
+ Content(`| \`${t.name}\` | ${dir}${note} | ${guide} |
56
66
  `)
57
- })
58
- Content(`
67
+ })
68
+ Content(`
59
69
  `)
60
- }
70
+ }
71
+ })
61
72
 
62
- if (0 < features.length) {
63
- Content(`**Features** (${features.length}): `)
64
- Content(features.map((f: any) => `\`${f.name}\``).join(', ') + `.
65
73
 
66
- Each feature is generated into every SDK target — as a directory
67
- \`<lang>/src/feature/<name>/\` (ts/js) or a flat file in the \`<lang>/feature/\`
68
- package (other languages). Each target's guide documents its features.
74
+ const AgentGuideTopFeatures = cmp(function AgentGuideTopFeatures(props: any) {
75
+ const { features } = props.s
76
+
77
+ if (0 < features.length) {
78
+ Content(`**Features** (${features.length}): `)
79
+ Content(features.map((f: any) => `\`${f.name}\``).join(', ') + `.
80
+
81
+ Each feature is generated into each SDK target that supports it, and each
82
+ target's guide documents where that target keeps its features.
69
83
 
70
84
  `)
71
- }
85
+ }
86
+ })
87
+
72
88
 
73
- if (0 < entities.length) {
74
- Content(`**Entities** (${entities.length}): `)
75
- Content(entities.map((e: any) => `\`${e.Name || e.name}\``).join(', ') + `.
89
+ const AgentGuideTopEntities = cmp(function AgentGuideTopEntities(props: any) {
90
+ const { entities } = props.s
91
+
92
+ if (0 < entities.length) {
93
+ Content(`**Entities** (${entities.length}): `)
94
+ Content(entities.map((e: any) => `\`${e.Name || e.name}\``).join(', ') + `.
76
95
 
77
96
  `)
78
- }
79
-
80
- // Station paragraph (station design §9.4; declarative design §11
81
- // item 4), only when the model carries the feature: an agent working
82
- // on this repo should know the runtime story without leaving
83
- // AGENTS.md — and, first, that the application's integrations are
84
- // DECLARED in station.json, so that file is where to look.
85
- if (features.some((f: any) => 'station' === f.name)) {
86
- Content(`**Station**: this SDK is a
97
+ }
98
+ })
99
+
100
+
101
+ const AgentGuideTopStation = cmp(function AgentGuideTopStation(props: any) {
102
+ const { features } = props.s
103
+
104
+ // Station paragraph (station design §9.4; declarative design §11
105
+ // item 4), only when the model carries the feature: an agent working
106
+ // on this repo should know the runtime story without leaving
107
+ // AGENTS.md — and, first, that the application's integrations are
108
+ // DECLARED in station.json, so that file is where to look.
109
+ const station = features.find((f: any) => 'station' === f.name)
110
+ if (null != station) {
111
+ Content(`**Station**: this SDK is a
87
112
  [voxgig/station](https://github.com/voxgig/station) plugin (the
88
- \`station\` feature, off by default). An application's outbound
113
+ \`station\` feature, ${fact(station, 'on') ? 'on' : 'off'} by default). An application's outbound
89
114
  integrations are **declared in \`station.json\`** at its repo root —
90
115
  to learn what the application talks to, read that file: every SDK
91
116
  instance (\`sdk\`), per-api default (\`api\`), feature setting, and
@@ -101,14 +126,32 @@ with Station" README section and \`src/feature/station/\` (or the
101
126
  target's feature container) for the generated adapter.
102
127
 
103
128
  `)
104
- }
129
+ }
130
+ })
105
131
 
106
- Content(workflowSection())
107
- Content(featureSection())
108
- Content(customiseSection())
109
- Content(aontuSection())
110
132
 
111
- Content(`## Where things live
133
+ const AgentGuideTopWorkflow = cmp(function AgentGuideTopWorkflow(props: any) {
134
+ Content(workflowSection(props.s.model))
135
+ })
136
+
137
+
138
+ const AgentGuideTopFeatureGuide = cmp(function AgentGuideTopFeatureGuide() {
139
+ Content(featureSection())
140
+ })
141
+
142
+
143
+ const AgentGuideTopCustomise = cmp(function AgentGuideTopCustomise() {
144
+ Content(customiseSection())
145
+ })
146
+
147
+
148
+ const AgentGuideTopAontu = cmp(function AgentGuideTopAontu(props: any) {
149
+ Content(aontuSection(props.s.model))
150
+ })
151
+
152
+
153
+ const AgentGuideTopLayout = cmp(function AgentGuideTopLayout() {
154
+ Content(`## Where things live
112
155
 
113
156
  \`\`\`
114
157
  .sdk/
@@ -126,6 +169,33 @@ Makefile per-target deploy recipes
126
169
  Generated by [@voxgig/sdkgen](https://github.com/voxgig/sdkgen). Regenerate
127
170
  with \`cd .sdk && npm run generate\`.
128
171
  `)
172
+ })
173
+
174
+
175
+ const AgentGuideTop = cmp(function AgentGuideTop(props: any) {
176
+ const { ctx$ } = props
177
+ const { model } = ctx$
178
+
179
+ if (model.name && !model.Name) names(model, model.name)
180
+
181
+ const Name = projectName(model)
182
+ const targets = activeTargets(model)
183
+ const features = activeFeatures(model)
184
+ const entities = activeEntities(model)
185
+
186
+ const s = { Name, model, targets, features, entities }
187
+
188
+ File({ name: 'AGENTS.md' }, () => {
189
+ AgentGuideTopIntro({ s })
190
+ AgentGuideTopTargets({ s })
191
+ AgentGuideTopFeatures({ s })
192
+ AgentGuideTopEntities({ s })
193
+ AgentGuideTopStation({ s })
194
+ AgentGuideTopWorkflow({ s })
195
+ AgentGuideTopFeatureGuide({ s })
196
+ AgentGuideTopCustomise({ s })
197
+ AgentGuideTopAontu({ s })
198
+ AgentGuideTopLayout({ s })
129
199
  })
130
200
 
131
201
  File({ name: 'CLAUDE.md' }, () => {
@@ -1,5 +1,42 @@
1
- import { Content, File } from 'jostraca'
1
+ import { Content, File, each } from 'jostraca'
2
2
  import { cmp } from '../helpers/component'
3
+ import { fact } from '../helpers/facts'
4
+ import { packageVersion } from '../helpers/packageMeta'
5
+ import { SURFACE_WORD, documentOrder, surfaceOf } from '../helpers/surface'
6
+ import { definitionName, seriesList } from '../helpers/text'
7
+ import { KIT, getModelPath } from '../types'
8
+
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
+ }
3
40
 
4
41
 
5
42
  const Changelog = cmp(function Changelog(props: any) {
@@ -8,6 +45,20 @@ const Changelog = cmp(function Changelog(props: any) {
8
45
 
9
46
  const name = model.Name || model.name
10
47
 
48
+ const targets = documentOrder(model,
49
+ each(getModelPath(model, `main.${KIT}.target`, { required: false }) || {})
50
+ .filter((t: any) => false !== t.active))
51
+
52
+ // Written once, so the first entry is the version the targets start at; a
53
+ // heading with no number when they start at different ones.
54
+ const versions = new Set<string>()
55
+ targets.forEach((t: any) => versions.add(packageVersion(model, t.name)))
56
+ const first = 1 < versions.size ? 'Initial release' :
57
+ `[${[...versions][0] || packageVersion(model, '')}]`
58
+
59
+ const scope = releaseScope(targets)
60
+ const definition = definitionName(fact(model.main[KIT], 'definitionKind'), true)
61
+
11
62
  File({ name: 'CHANGELOG.md', exclude: true }, () => {
12
63
  Content(`# Changelog
13
64
 
@@ -17,11 +68,11 @@ This project follows [Keep a Changelog](https://keepachangelog.com) and
17
68
 
18
69
  ## [Unreleased]
19
70
 
20
- ## [0.0.1]
71
+ ## ${first}
21
72
 
22
- - Initial generated release of the ${name} SDK (TypeScript, Python, PHP, Go,
23
- Ruby, and Lua, plus CLI and MCP surfaces), generated from the upstream
24
- 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.')}
25
76
  `)
26
77
  })
27
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
- import { packageVersion } from '../helpers/packageMeta'
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
@@ -29,27 +24,25 @@ const Deploy = cmp(function Deploy(props: any) {
29
24
 
30
25
  ctx$.log.info({
31
26
  point: 'generate-deploy',
32
- note: 'targets: ' + targets.map((t: any) =>
33
- t.name + (registryOf(t) ? (':' + registryOf(t).name + (regIsActive(registryOf(t)) ? '' : '(publish pending)')) : ':tag-only')
34
- ).join(',')
27
+ note: 'targets: ' + targets.map((t: any) => {
28
+ const state = registryState(model, t.name)
29
+ return t.name + ('tag' === state ? ':tag-only' :
30
+ ':' + registryOf(t).name + ('active' === state ? '' : '(publish ' + pendingWord(state) + ')'))
31
+ }).join(',')
35
32
  })
36
33
  })
37
34
 
38
35
 
36
+ // The declared registry block, `none` included: a port that declares one
37
+ // has its release tag cut at the root, whatever registryState calls it.
39
38
  function registryOf(t: any): any | undefined {
40
39
  const reg = t.publish?.registry
41
40
  return (reg && '' !== (reg.name || '')) ? reg : undefined
42
41
  }
43
42
 
44
43
 
45
- // A registry is active (package really uploaded) when its tri-state
46
- // `state === 'active'`. The legacy boolean `active: true` is honoured as a
47
- // back-compat alias. Anything else — 'pending' (the default), 'inactive' —
48
- // means a deploy publishes the git tag only.
49
- function regIsActive(reg: any): boolean {
50
- if (null == reg) return false
51
- if (true === reg.active) return true
52
- return 'active' === reg.state
44
+ function pendingWord(state: string): string {
45
+ return 'inactive' === state ? 'inactive' : 'pending'
53
46
  }
54
47
 
55
48
 
@@ -92,16 +85,16 @@ function makeDeployMakefile(model: any, targets: any[]): string {
92
85
  aliasVars.set(aliasVarName(ghRecipe), tagVault.alias || ghRecipe)
93
86
  }
94
87
  const reg = registryOf(t)
95
- if (reg && !aliasVars.has(aliasVarName(reg.name))) {
88
+ if (reg && 'tag' !== registryState(model, t.name) && !aliasVars.has(aliasVarName(reg.name))) {
96
89
  aliasVars.set(aliasVarName(reg.name), reg.vault?.alias || reg.name)
97
90
  }
98
91
  }
99
92
 
100
93
  const summary = targets.map((t: any) => {
101
94
  const reg = registryOf(t)
102
- const state = reg
103
- ? `${reg.name} (${regIsActive(reg) ? 'ACTIVE' : 'publish pending: deploy publishes the git tag only'}) ${reg.url || ''}`.trim()
104
- : 'tag-only'
95
+ const rs = registryState(model, t.name)
96
+ const state = 'tag' === rs ? 'tag-only' :
97
+ `${reg.name} (${'active' === rs ? 'ACTIVE' : 'publish ' + pendingWord(rs) + ': deploy publishes the git tag only'}) ${reg.url || ''}`.trim()
105
98
  return `# ${t.name.padEnd(8)} ${state}`
106
99
  }).join('\n')
107
100
 
@@ -113,8 +106,22 @@ function makeDeployMakefile(model: any, targets: any[]): string {
113
106
  const args = vaultExecArgs(t)
114
107
 
115
108
  const via = t.publish?.tag?.via || 'port'
109
+ const dir = fact(t, 'dir')
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
+ }
116
123
 
117
- if (!reg && 'root' === via) {
124
+ if ('tag' === rs && (reg || 'root' === via)) {
118
125
  return `
119
126
  deploy-${t.name}:
120
127
  \t@echo "deploy-${t.name}: tag-only port — publishing the git tag."
@@ -122,28 +129,29 @@ deploy-${t.name}:
122
129
 
123
130
  deploy-dry-${t.name}:
124
131
  \tboru vault exec --dry-run ${ghArgs} -- $(MAKE) tag-push-${t.name}
125
- ${tagPushRecipe(t.name, packageVersion(model, t.name), 'tag-only port')}
132
+ ${tagPushRecipe(t.name, tag, packageVersion(model, t.name), 'tag-only port')}
126
133
  `
127
134
  }
128
135
 
129
- if (reg && !regIsActive(reg)) {
136
+ if ('tag' !== rs && 'active' !== rs) {
137
+ const word = pendingWord(rs)
130
138
  return `
131
139
  deploy-${t.name}:
132
- \t@echo "deploy-${t.name}: ${reg.name} publication is pending — publishing the git tag only."
140
+ \t@echo "deploy-${t.name}: ${reg.name} publication is ${word} — publishing the git tag only."
133
141
  \tboru vault exec ${ghArgs} -- $(MAKE) tag-push-${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 pending — 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}
@@ -192,7 +199,9 @@ deploy:
192
199
  \t@echo "Registry state is set in the model (.sdk/model/target/<t>.aontu):"
193
200
  ${targets.map((t: any) => {
194
201
  const reg = registryOf(t)
195
- const state = reg ? `${reg.name} ${regIsActive(reg) ? 'ACTIVE' : 'publish pending (deploy = git tag only)'}` : 'tag-only'
202
+ const rs = registryState(model, t.name)
203
+ const state = 'tag' === rs ? 'tag-only' :
204
+ `${reg.name} ${'active' === rs ? 'ACTIVE' : 'publish ' + pendingWord(rs) + ' (deploy = git tag only)'}`
196
205
  return `\t@echo " deploy-${t.name.padEnd(8)} ${state}"`
197
206
  }).join('\n')}
198
207
  \t@echo "Rehearse everything safely first: make deploy-dry"
@@ -204,10 +213,42 @@ ${deployRules}`
204
213
 
205
214
 
206
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
+
207
248
  // The root-level tag creation + push recipe for a target: boru --dry-run
208
249
  // filler cooperation, idempotent tag creation, token-authenticated https
209
250
  // push (works from an ssh-remote clone without ssh keys).
210
- function tagPushRecipe(name: string, version: string, note: string): string {
251
+ function tagPushRecipe(name: string, tagPrefix: string, version: string, note: string): string {
211
252
  // The version is embedded in both Make and shell syntax.
212
253
  if (!/^[0-9A-Za-z][0-9A-Za-z.+-]*$/.test(version)) {
213
254
  throw new Error('Deploy: invalid publish.version for target "' + name + '": ' + JSON.stringify(version))
@@ -215,7 +256,7 @@ function tagPushRecipe(name: string, version: string, note: string): string {
215
256
 
216
257
  return `
217
258
  tag-push-${name}:
218
- \t@set -e; tag="${name}/v${version}"; \\
259
+ \t@set -e; tag="${tagPrefix}${version}"; \\
219
260
  \ttoken="\$\${GITHUB_TOKEN:-$$GH_TOKEN}"; \\
220
261
  \tif [ "$$token" = "$(BORU_DRY_RUN_FILLER)" ]; then \\
221
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
 
@@ -6,6 +6,9 @@ import { Project } from 'jostraca'
6
6
 
7
7
  import { KIT } from '@voxgig/apidef'
8
8
 
9
+ import { fact } from '../helpers/facts'
10
+ import { repoInfo } from '../helpers/packageMeta'
11
+
9
12
  import { Main } from './Main'
10
13
  import { Entity } from './Entity'
11
14
  import { Feature } from './Feature'
@@ -39,15 +42,18 @@ const ExternalTarget = cmp(function ExternalTarget(props: any) {
39
42
  ctx$.stdrep = ctx$.stdrep || {}
40
43
  names(ctx$.stdrep, model.Name, 'Project' + 'Name')
41
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
+
42
50
  const entity = model.main[KIT].entity || {}
43
51
  const feature = model.main[KIT].feature || {}
44
52
 
45
- // Defaults are inclusive: a phase runs unless the target's model turns it
46
- // off. Consumer targets (go-cli, go-mcp, py-data, seneca-provider) switch
47
- // every phase off and emit everything from Main.
48
- const phase = target.phase || {}
49
- const phaseActive = (name: string): boolean =>
50
- false !== (phase[name] && phase[name].active)
53
+ // Consumer targets (go-cli, go-mcp, py-data, seneca-provider) switch every
54
+ // phase off and emit everything from Main.
55
+ const phase = fact(target, 'phase')
56
+ const phaseActive = (name: string): boolean => true === phase[name]
51
57
 
52
58
  Project({}, () => {
53
59
  names(target, target.name)
@@ -3,8 +3,10 @@ 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 } from '../helpers/applicability'
6
+ import { featureApplies, featureTags, providedBy, shippedProvides } from '../helpers/applicability'
7
7
  import { pluginExcludesFor } from '../helpers/featureSource'
8
+ import { originName } from '../helpers/packageMeta'
9
+ import { resolvesBundled } from '../action/resolve'
8
10
 
9
11
  const Feature = cmp(function Feature(props: any) {
10
12
  const { target, feature, ctx$ } = props
@@ -16,14 +18,19 @@ const Feature = cmp(function Feature(props: any) {
16
18
  // missing template folder and abort the whole run, taking every other
17
19
  // target with it. See helpers/applicability and docs/design/feature-tags.
18
20
  if (!featureApplies(feature, target)) {
19
- const provided = featureTags(target.provides)
21
+ const provided = providedBy(target)
20
22
  const unmet = featureTags(feature.needs).filter((n) => !provided.includes(n))
23
+ const origin = originName(ctx$.model, target.name)
24
+ const stale = resolvesBundled(target, target.name) &&
25
+ unmet.every((n) => shippedProvides(origin).includes(n))
21
26
 
22
- log.info({
27
+ log.warn({
23
28
  point: 'feature-not-applicable', target: target.name, feature: feature.name,
24
29
  needs: feature.needs, provides: target.provides, unmet,
25
- note: feature.name + ': target ' + target.name +
26
- ' does not provide ' + unmet.join(', ')
30
+ note: feature.name + ' is active but not generated for ' + target.name +
31
+ ', which does not provide ' + unmet.join(', ') + (stale ? '; the installed ' +
32
+ origin + ' target does: `voxgig-sdkgen package update @voxgig/sdkgen --no-fetch`' +
33
+ ' or `voxgig-sdkgen target add ' + target.name + '` refreshes the copy' : ''),
27
34
  })
28
35
  return
29
36
  }
@@ -37,7 +44,7 @@ const Feature = cmp(function Feature(props: any) {
37
44
  // files, because this Copy has already written them.
38
45
  exclude: pluginExcludesFor(ctx$.model, feature.name),
39
46
  replace: {
40
- ...ensureStdrep(ctx$),
47
+ ...ensureStdrep(ctx$, target),
41
48
  FEATURE_VERSION: feature.version,
42
49
  FEATURE_Name: feature.Name,
43
50
  }