@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.
- package/bin/voxgig-sdkgen +1 -1
- package/dist/action/check.js +58 -4
- package/dist/action/check.js.map +1 -1
- package/dist/action/doctor.d.ts +5 -0
- package/dist/action/doctor.js +44 -4
- package/dist/action/doctor.js.map +1 -1
- package/dist/action/package.d.ts +1 -1
- package/dist/action/package.js +6 -16
- package/dist/action/package.js.map +1 -1
- package/dist/action/remove.js +15 -4
- package/dist/action/remove.js.map +1 -1
- package/dist/action/resolve.d.ts +1 -0
- package/dist/action/resolve.js +10 -4
- package/dist/action/resolve.js.map +1 -1
- package/dist/admin/status.d.ts +7 -1
- package/dist/admin/status.js +34 -5
- package/dist/admin/status.js.map +1 -1
- package/dist/cmp/AgentGuide.js +27 -15
- package/dist/cmp/AgentGuide.js.map +1 -1
- package/dist/cmp/AgentGuideContent.d.ts +3 -3
- package/dist/cmp/AgentGuideContent.js +22 -11
- package/dist/cmp/AgentGuideContent.js.map +1 -1
- package/dist/cmp/AgentGuideFeature.js +14 -6
- package/dist/cmp/AgentGuideFeature.js.map +1 -1
- package/dist/cmp/AgentGuideTop.js +16 -8
- package/dist/cmp/AgentGuideTop.js.map +1 -1
- package/dist/cmp/Changelog.js +37 -7
- package/dist/cmp/Changelog.js.map +1 -1
- package/dist/cmp/Deploy.js +52 -16
- package/dist/cmp/Deploy.js.map +1 -1
- package/dist/cmp/Entity.js +1 -1
- package/dist/cmp/Entity.js.map +1 -1
- package/dist/cmp/ExternalTarget.js +5 -0
- package/dist/cmp/ExternalTarget.js.map +1 -1
- package/dist/cmp/Feature.js +2 -2
- package/dist/cmp/Feature.js.map +1 -1
- package/dist/cmp/Main.js +1 -1
- package/dist/cmp/Main.js.map +1 -1
- package/dist/cmp/PublishWorkflow.js +63 -53
- package/dist/cmp/PublishWorkflow.js.map +1 -1
- package/dist/cmp/ReadmeIntro.js +1 -1
- package/dist/cmp/ReadmeIntro.js.map +1 -1
- package/dist/cmp/ReadmeModel.js +2 -2
- package/dist/cmp/ReadmeModel.js.map +1 -1
- package/dist/cmp/ReadmeStation.js +3 -3
- package/dist/cmp/ReadmeStation.js.map +1 -1
- package/dist/cmp/ReadmeTop.js +57 -59
- package/dist/cmp/ReadmeTop.js.map +1 -1
- package/dist/cmp/Registered.js +1 -1
- package/dist/cmp/Registered.js.map +1 -1
- package/dist/cmp/Security.js +23 -3
- package/dist/cmp/Security.js.map +1 -1
- package/dist/cmp/Test.js +1 -1
- package/dist/cmp/Test.js.map +1 -1
- package/dist/helpers/alongside.d.ts +2 -3
- package/dist/helpers/alongside.js +16 -15
- package/dist/helpers/alongside.js.map +1 -1
- package/dist/helpers/applicability.d.ts +2 -1
- package/dist/helpers/applicability.js +14 -1
- package/dist/helpers/applicability.js.map +1 -1
- package/dist/helpers/component.js +9 -1
- package/dist/helpers/component.js.map +1 -1
- package/dist/helpers/definitionPlan.js +0 -1
- package/dist/helpers/definitionPlan.js.map +1 -1
- package/dist/helpers/doctext.js +1 -0
- package/dist/helpers/doctext.js.map +1 -1
- package/dist/helpers/facts.js +174 -4
- package/dist/helpers/facts.js.map +1 -1
- package/dist/helpers/flowGuard.d.ts +1 -1
- package/dist/helpers/flowGuard.js +20 -7
- package/dist/helpers/flowGuard.js.map +1 -1
- package/dist/helpers/generated.d.ts +1 -0
- package/dist/helpers/generated.js +1 -1
- package/dist/helpers/generated.js.map +1 -1
- package/dist/helpers/graphqlPoint.d.ts +2 -1
- package/dist/helpers/graphqlPoint.js +17 -0
- package/dist/helpers/graphqlPoint.js.map +1 -1
- package/dist/helpers/guardModel.d.ts +2 -0
- package/dist/helpers/guardModel.js +41 -0
- package/dist/helpers/guardModel.js.map +1 -0
- package/dist/helpers/manifest.d.ts +2 -1
- package/dist/helpers/manifest.js +16 -0
- package/dist/helpers/manifest.js.map +1 -1
- package/dist/helpers/mcpTools.d.ts +2 -1
- package/dist/helpers/mcpTools.js +8 -1
- package/dist/helpers/mcpTools.js.map +1 -1
- package/dist/helpers/opShape.js +17 -17
- package/dist/helpers/opShape.js.map +1 -1
- package/dist/helpers/packageMeta.d.ts +6 -4
- package/dist/helpers/packageMeta.js +68 -46
- package/dist/helpers/packageMeta.js.map +1 -1
- package/dist/helpers/placement.d.ts +15 -0
- package/dist/helpers/placement.js +76 -0
- package/dist/helpers/placement.js.map +1 -0
- package/dist/helpers/semver.d.ts +2 -1
- package/dist/helpers/semver.js +21 -0
- package/dist/helpers/semver.js.map +1 -1
- package/dist/helpers/serverVars.js +3 -2
- package/dist/helpers/serverVars.js.map +1 -1
- package/dist/helpers/shipped.d.ts +2 -1
- package/dist/helpers/shipped.js +12 -0
- package/dist/helpers/shipped.js.map +1 -1
- package/dist/helpers/sourcestring.d.ts +3 -0
- package/dist/helpers/sourcestring.js +43 -0
- package/dist/helpers/sourcestring.js.map +1 -0
- package/dist/helpers/stdrep.d.ts +1 -1
- package/dist/helpers/stdrep.js +5 -1
- package/dist/helpers/stdrep.js.map +1 -1
- package/dist/helpers/surface.d.ts +7 -0
- package/dist/helpers/surface.js +69 -0
- package/dist/helpers/surface.js.map +1 -0
- package/dist/helpers/targetguard.d.ts +13 -0
- package/dist/helpers/targetguard.js +65 -0
- package/dist/helpers/targetguard.js.map +1 -0
- package/dist/helpers/text.d.ts +3 -1
- package/dist/helpers/text.js +16 -0
- package/dist/helpers/text.js.map +1 -1
- package/dist/helpers/textguard.d.ts +31 -0
- package/dist/helpers/textguard.js +157 -0
- package/dist/helpers/textguard.js.map +1 -0
- package/dist/helpers/title.d.ts +4 -0
- package/dist/helpers/title.js +52 -0
- package/dist/helpers/title.js.map +1 -0
- package/dist/sdkgen.d.ts +4 -6
- package/dist/sdkgen.js +59 -69
- package/dist/sdkgen.js.map +1 -1
- package/dist/testkit.d.ts +6 -2
- package/dist/testkit.js +4 -1
- package/dist/testkit.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/model/fact.aontu +106 -0
- package/model/sdkgen.aontu +9 -1
- package/package.json +1 -1
- package/project/.sdk/src/cmp/c/ReadmeQuick_c.ts +1 -1
- package/project/.sdk/src/cmp/clojure/ReadmeQuick_clojure.ts +1 -1
- package/project/.sdk/src/cmp/cpp/ReadmeQuick_cpp.ts +1 -1
- package/project/.sdk/src/cmp/csharp/ReadmeQuick_csharp.ts +1 -1
- package/project/.sdk/src/cmp/elixir/ReadmeQuick_elixir.ts +1 -1
- package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +1 -1
- package/project/.sdk/src/cmp/java/ReadmeQuick_java.ts +1 -1
- package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +1 -1
- package/project/.sdk/src/cmp/kotlin/ReadmeQuick_kotlin.ts +1 -1
- package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +1 -1
- package/project/.sdk/src/cmp/ocaml/ReadmeQuick_ocaml.ts +1 -1
- package/project/.sdk/src/cmp/perl/ReadmeQuick_perl.ts +1 -1
- package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +1 -1
- package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +1 -1
- package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +1 -1
- package/project/.sdk/src/cmp/rust/ReadmeQuick_rust.ts +1 -1
- package/project/.sdk/src/cmp/scala/ReadmeQuick_scala.ts +1 -1
- package/project/.sdk/src/cmp/swift/ReadmeQuick_swift.ts +1 -1
- package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +1 -1
- package/project/.sdk/src/cmp/ts/TestDefinition_ts.ts +3 -1
- package/project/.sdk/src/cmp/zig/ReadmeQuick_zig.ts +1 -1
- package/project/.sdk/tm/ocaml/test/feature/secrets/t_secrets.ml +3 -1
- package/project/.sdk/tm/php/test/feature/secrets/SecretsTest.php +2 -1
- package/project/.sdk/tm/zig/test/feature/secrets/secrets_test.zig +11 -2
- package/project/sdkgen-package.json +1 -1
- package/src/action/check.ts +78 -4
- package/src/action/doctor.ts +62 -4
- package/src/action/package.ts +1 -13
- package/src/action/remove.ts +19 -5
- package/src/action/resolve.ts +11 -4
- package/src/admin/status.ts +25 -5
- package/src/cmp/AgentGuide.ts +28 -15
- package/src/cmp/AgentGuideContent.ts +22 -11
- package/src/cmp/AgentGuideFeature.ts +15 -6
- package/src/cmp/AgentGuideTop.ts +17 -8
- package/src/cmp/Changelog.ts +46 -6
- package/src/cmp/Deploy.ts +59 -20
- package/src/cmp/Entity.ts +1 -1
- package/src/cmp/ExternalTarget.ts +6 -0
- package/src/cmp/Feature.ts +3 -3
- package/src/cmp/Main.ts +1 -1
- package/src/cmp/PublishWorkflow.ts +66 -58
- package/src/cmp/ReadmeIntro.ts +1 -1
- package/src/cmp/ReadmeModel.ts +2 -2
- package/src/cmp/ReadmeStation.ts +4 -5
- package/src/cmp/ReadmeTop.ts +60 -60
- package/src/cmp/Registered.ts +1 -1
- package/src/cmp/Security.ts +32 -5
- package/src/cmp/Test.ts +1 -1
- package/src/helpers/alongside.ts +16 -19
- package/src/helpers/applicability.ts +16 -1
- package/src/helpers/component.ts +11 -1
- package/src/helpers/definitionPlan.ts +0 -1
- package/src/helpers/doctext.ts +3 -1
- package/src/helpers/facts.ts +214 -5
- package/src/helpers/flowGuard.ts +22 -7
- package/src/helpers/generated.ts +3 -1
- package/src/helpers/graphqlPoint.ts +20 -1
- package/src/helpers/guardModel.ts +50 -0
- package/src/helpers/manifest.ts +19 -0
- package/src/helpers/mcpTools.ts +11 -1
- package/src/helpers/opShape.ts +16 -16
- package/src/helpers/packageMeta.ts +67 -43
- package/src/helpers/placement.ts +114 -0
- package/src/helpers/semver.ts +26 -0
- package/src/helpers/serverVars.ts +4 -2
- package/src/helpers/shipped.ts +13 -0
- package/src/helpers/sourcestring.ts +47 -0
- package/src/helpers/stdrep.ts +6 -1
- package/src/helpers/surface.ts +82 -0
- package/src/helpers/targetguard.ts +91 -0
- package/src/helpers/text.ts +22 -0
- package/src/helpers/textguard.ts +208 -0
- package/src/helpers/title.ts +59 -0
- package/src/sdkgen.ts +65 -85
- package/src/testkit.ts +12 -0
package/src/cmp/ReadmeTop.ts
CHANGED
|
@@ -21,9 +21,9 @@ import { mcpTools, MCP_WRITE_OPS } from '../helpers/mcpTools'
|
|
|
21
21
|
import type { ExampleLang, PrimaryCall } from '../helpers/opExample'
|
|
22
22
|
import { canonScalarKey } from '../helpers/canonType'
|
|
23
23
|
import { safeVarName, exampleVarName, jsKey } from '../helpers/naming'
|
|
24
|
-
import { modelText } from '../helpers/text'
|
|
24
|
+
import { definitionName, modelText } from '../helpers/text'
|
|
25
25
|
import { fact } from '../helpers/facts'
|
|
26
|
-
import {
|
|
26
|
+
import { documentOrder, surfaceOf } from '../helpers/surface'
|
|
27
27
|
import { copyMode, MERGE } from '../helpers/copymerge'
|
|
28
28
|
|
|
29
29
|
import {
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
vendorCommand,
|
|
35
35
|
apiName,
|
|
36
36
|
nonAffiliation,
|
|
37
|
+
publisherInfo,
|
|
37
38
|
docsSiteUrl,
|
|
38
39
|
originName,
|
|
39
40
|
isDefaultPublisher,
|
|
@@ -147,18 +148,18 @@ ${tagline}
|
|
|
147
148
|
|
|
148
149
|
|
|
149
150
|
const ReadmeTopSurfaceLine = cmp(function ReadmeTopSurfaceLine(props: any) {
|
|
150
|
-
const { hasCli, hasMcp, sdkTargets, consumerTargets, langList } = props.s
|
|
151
|
+
const { hasCli, hasMcp, sdkTargets, consumerTargets, langList, definition } = props.s
|
|
151
152
|
|
|
152
153
|
if (sdkTargets.length > 1) {
|
|
153
154
|
const surfaces = []
|
|
154
155
|
surfaces.push(`${langList} SDKs`)
|
|
155
156
|
if (hasCli) surfaces.push('a CLI with an interactive REPL')
|
|
156
157
|
if (hasMcp) surfaces.push('an MCP server for AI agents')
|
|
157
|
-
consumerTargets.forEach((t: any) => surfaces.push(`the ${t
|
|
158
|
+
consumerTargets.forEach((t: any) => surfaces.push(`the ${fact(t, 'title')} package`))
|
|
158
159
|
const surfaceList = surfaces.length > 1
|
|
159
160
|
? surfaces.slice(0, -1).join(', ') + ', and ' + surfaces[surfaces.length - 1]
|
|
160
161
|
: surfaces[0]
|
|
161
|
-
Content(`> ${surfaceList} — all generated from one
|
|
162
|
+
Content(`> ${surfaceList} — all generated from one ${definition} by [@voxgig/sdkgen](${SDKGEN_REPO}).
|
|
162
163
|
|
|
163
164
|
`)
|
|
164
165
|
}
|
|
@@ -309,7 +310,7 @@ network, and no credentials:
|
|
|
309
310
|
const Test =
|
|
310
311
|
optionalComponent(ctx$, tgt, 'ReadmeTopTest')
|
|
311
312
|
if (Test) {
|
|
312
|
-
Content(`### ${tgt
|
|
313
|
+
Content(`### ${fact(tgt, 'title')}
|
|
313
314
|
|
|
314
315
|
`)
|
|
315
316
|
Test['ReadmeTopTest']({ target: tgt })
|
|
@@ -337,23 +338,25 @@ const ReadmeTopPackages = cmp(function ReadmeTopPackages(props: any) {
|
|
|
337
338
|
`)
|
|
338
339
|
pkgTargets.forEach((tgt: any) => {
|
|
339
340
|
const state = registryState(model, tgt.name)
|
|
341
|
+
const readme = fact(tgt, 'docs').readme
|
|
340
342
|
let cell: string
|
|
341
343
|
if ('active' === state) {
|
|
342
344
|
const cmd = installCommand(tgt, model)
|
|
343
345
|
cell = cmd
|
|
344
346
|
? '`' + cmd + '`'
|
|
345
|
-
: `see [${tgt.name}/README.md](${tgt.name}/README.md#install)`
|
|
347
|
+
: readme ? `see [${tgt.name}/README.md](${tgt.name}/README.md#install)` : `see \`${tgt.name}/\``
|
|
346
348
|
} else if ('tag' === state) {
|
|
347
349
|
const cmd = vendorCommand(model, tgt.name)
|
|
348
350
|
cell = cmd
|
|
349
351
|
? '`' + cmd + '`'
|
|
350
|
-
:
|
|
352
|
+
: 'build from source — ' + (readme ? `[${tgt.name}/README.md](${tgt.name}/README.md)` : `\`${tgt.name}/\``)
|
|
351
353
|
} else {
|
|
352
354
|
// The target README always gives a route that works without a
|
|
353
355
|
// tag, which a repository may not have.
|
|
354
|
-
cell = `publish pending — [install from source](${tgt.name}/README.md#install)`
|
|
356
|
+
cell = readme ? `publish pending — [install from source](${tgt.name}/README.md#install)` :
|
|
357
|
+
`publish pending — install from source in \`${tgt.name}/\``
|
|
355
358
|
}
|
|
356
|
-
Content(`| ${tgt
|
|
359
|
+
Content(`| ${fact(tgt, 'title')} | \`${packageName(model, tgt.name)}\` | ${cell} |
|
|
357
360
|
`)
|
|
358
361
|
})
|
|
359
362
|
Content(`
|
|
@@ -368,7 +371,7 @@ const ReadmeTopQuickstart = cmp(function ReadmeTopQuickstart(props: any) {
|
|
|
368
371
|
if (leadTarget) {
|
|
369
372
|
Content(`## Quickstart
|
|
370
373
|
|
|
371
|
-
### ${leadTarget
|
|
374
|
+
### ${fact(leadTarget, 'title')}
|
|
372
375
|
|
|
373
376
|
`)
|
|
374
377
|
const LeadQuick =
|
|
@@ -378,7 +381,8 @@ const ReadmeTopQuickstart = cmp(function ReadmeTopQuickstart(props: any) {
|
|
|
378
381
|
}
|
|
379
382
|
const placement = credentialPlacement(model)
|
|
380
383
|
Content(`
|
|
381
|
-
${'' === placement ? '' : placement + '\n\n'}
|
|
384
|
+
${'' === placement ? '' : placement + '\n\n'}${fact(leadTarget, 'docs').readme ?
|
|
385
|
+
`See the [${fact(leadTarget, 'title')} README](${leadTarget.name}/README.md) for the full guide.` : ''}
|
|
382
386
|
|
|
383
387
|
`)
|
|
384
388
|
}
|
|
@@ -386,7 +390,8 @@ ${'' === placement ? '' : placement + '\n\n'}See the [${leadTarget.title} README
|
|
|
386
390
|
|
|
387
391
|
|
|
388
392
|
const ReadmeTopSurfaces = cmp(function ReadmeTopSurfaces(props: any) {
|
|
389
|
-
const { hasCli, hasMcp, sdkTargets, consumerTargets, langList } = props.s
|
|
393
|
+
const { hasCli, hasMcp, cliTargets, mcpTargets, sdkTargets, consumerTargets, langList } = props.s
|
|
394
|
+
const paths = (targets: any[]) => targets.map((t: any) => `\`${t.name}/\``).join(' ')
|
|
390
395
|
|
|
391
396
|
if (sdkTargets.length > 0 || hasCli || hasMcp || consumerTargets.length > 0) {
|
|
392
397
|
Content(`## Surfaces
|
|
@@ -395,20 +400,19 @@ const ReadmeTopSurfaces = cmp(function ReadmeTopSurfaces(props: any) {
|
|
|
395
400
|
| --- | --- |
|
|
396
401
|
`)
|
|
397
402
|
if (sdkTargets.length > 0) {
|
|
398
|
-
|
|
399
|
-
Content(`| **SDK** (${langList}) | ${paths} |
|
|
403
|
+
Content(`| **SDK** (${langList}) | ${paths(sdkTargets)} |
|
|
400
404
|
`)
|
|
401
405
|
}
|
|
402
406
|
if (hasCli) {
|
|
403
|
-
Content(`| **CLI** |
|
|
407
|
+
Content(`| **CLI** | ${paths(cliTargets)} |
|
|
404
408
|
`)
|
|
405
409
|
}
|
|
406
410
|
if (hasMcp) {
|
|
407
|
-
Content(`| **MCP server** |
|
|
411
|
+
Content(`| **MCP server** | ${paths(mcpTargets)} |
|
|
408
412
|
`)
|
|
409
413
|
}
|
|
410
414
|
consumerTargets.forEach((t: any) => {
|
|
411
|
-
Content(`| **${t
|
|
415
|
+
Content(`| **${fact(t, 'title')}** | \`${t.name}/\` |
|
|
412
416
|
`)
|
|
413
417
|
})
|
|
414
418
|
Content(`
|
|
@@ -418,12 +422,13 @@ const ReadmeTopSurfaces = cmp(function ReadmeTopSurfaces(props: any) {
|
|
|
418
422
|
|
|
419
423
|
|
|
420
424
|
const ReadmeTopMcp = cmp(function ReadmeTopMcp(props: any) {
|
|
421
|
-
const { model, hasMcp } = props.s
|
|
425
|
+
const { model, hasMcp, mcpTargets } = props.s
|
|
422
426
|
|
|
423
427
|
if (hasMcp) {
|
|
424
|
-
const
|
|
425
|
-
const
|
|
426
|
-
const
|
|
428
|
+
const mcp = mcpTargets[0].name
|
|
429
|
+
const mcpOps = mcpTools(model, mcp).map((tool) => tool.op)
|
|
430
|
+
const mcpWrite = true === mcpTargets[0].tool?.write
|
|
431
|
+
const toggle = `\`main: kit: target: '${mcp}': tool: write: true\``
|
|
427
432
|
const opText = mcpOps.length < 2 ? mcpOps.join('') :
|
|
428
433
|
mcpOps.slice(0, -1).join(', ') + ' and ' + mcpOps[mcpOps.length - 1]
|
|
429
434
|
// What the server reads and writes is what it registers, not the flag.
|
|
@@ -445,7 +450,7 @@ The generated MCP server exposes this SDK's ${opText} operations as
|
|
|
445
450
|
can call directly.${reads} Build and register it:
|
|
446
451
|
|
|
447
452
|
\`\`\`bash
|
|
448
|
-
cd
|
|
453
|
+
cd ${mcp} && go build -o ${model.name}-mcp .
|
|
449
454
|
\`\`\`
|
|
450
455
|
|
|
451
456
|
Then add it to your agent's MCP config (Claude Desktop, Cursor, etc.):
|
|
@@ -513,7 +518,7 @@ const ReadmeTopOtherLanguages = cmp(function ReadmeTopOtherLanguages(props: any)
|
|
|
513
518
|
const Quick =
|
|
514
519
|
optionalComponent(ctx$, tgt, 'ReadmeTopQuick')
|
|
515
520
|
if (Quick) {
|
|
516
|
-
Content(`### ${tgt
|
|
521
|
+
Content(`### ${fact(tgt, 'title')}
|
|
517
522
|
|
|
518
523
|
`)
|
|
519
524
|
Quick['ReadmeTopQuick']({ target: tgt })
|
|
@@ -602,7 +607,7 @@ forking the SDK.
|
|
|
602
607
|
|
|
603
608
|
|
|
604
609
|
const ReadmeTopCustomizing = cmp(function ReadmeTopCustomizing(props: any) {
|
|
605
|
-
const { model, sdkTargets, docTargets } = props.s
|
|
610
|
+
const { model, sdkTargets, docTargets, definition } = props.s
|
|
606
611
|
|
|
607
612
|
// 11c. Customization: model-driven declarations, in-repo templates and
|
|
608
613
|
// components, regeneration that overwrites, customising in `.sdk`, and a
|
|
@@ -657,7 +662,7 @@ customizable without forking any upstream tool:
|
|
|
657
662
|
| \`.sdk/model/text.aontu\` | The README wording, in \`main.kit.text\`: the tagline, the summary and the entity descriptions | Yes. The scaffold writes it once and never again. |
|
|
658
663
|
| \`.sdk/model/guide/guide.aontu\` | How the spec's paths map onto entities and operations | Yes. The scaffold writes it once and never again. |
|
|
659
664
|
| \`.sdk/model/\`, the rest | The API model built from the spec, and the target and feature definitions | Not by hand. Generation, \`target add\` and a new scaffold run rewrite it, apart from a feature or target this project defines itself. |
|
|
660
|
-
| \`.sdk/def/\` | The
|
|
665
|
+
| \`.sdk/def/\` | The ${definition} | Replace it when the API changes. Generation rebuilds the model from it. |
|
|
661
666
|
| \`.sdk/src/cmp/<target>/\`, \`.sdk/tm/<target>/\` | The components and templates that generate each target | ${copiesRow} |
|
|
662
667
|
| \`.sdk/test/\` | The shared test cases the generated tests run | No. |
|
|
663
668
|
| ${targetDir} | One generated SDK per target, with its own tests | No. Generation overwrites it. |
|
|
@@ -690,8 +695,8 @@ const ReadmeTopPerLanguage = cmp(function ReadmeTopPerLanguage(props: any) {
|
|
|
690
695
|
Content(`## Per-language documentation
|
|
691
696
|
|
|
692
697
|
`)
|
|
693
|
-
docTargets.forEach((tgt: any) => {
|
|
694
|
-
Content(`- [${tgt
|
|
698
|
+
docTargets.filter((tgt: any) => fact(tgt, 'docs').readme).forEach((tgt: any) => {
|
|
699
|
+
Content(`- [${fact(tgt, 'title')}](${tgt.name}/README.md)
|
|
695
700
|
`)
|
|
696
701
|
})
|
|
697
702
|
Content(`
|
|
@@ -701,15 +706,15 @@ const ReadmeTopPerLanguage = cmp(function ReadmeTopPerLanguage(props: any) {
|
|
|
701
706
|
|
|
702
707
|
|
|
703
708
|
const ReadmeTopUpstream = cmp(function ReadmeTopUpstream(props: any) {
|
|
704
|
-
const { text } = props.s
|
|
709
|
+
const { text, definition, definitionFull, model } = props.s
|
|
705
710
|
const upstream = text.upstream
|
|
706
711
|
const docs = text.docs_url
|
|
707
712
|
Content(`## Upstream API
|
|
708
713
|
|
|
709
|
-
This SDK is generated from the upstream
|
|
710
|
-
unofficial client and is not affiliated with the API provider
|
|
714
|
+
This SDK is generated from the upstream ${definitionFull}.${publisherInfo(model).official ? '' : ` It is an
|
|
715
|
+
unofficial client and is not affiliated with the API provider.`}
|
|
711
716
|
|
|
712
|
-
The
|
|
717
|
+
The ${definition}(s) this SDK was generated from are kept in the
|
|
713
718
|
[\`.sdk/def/\`](.sdk/def/) folder.
|
|
714
719
|
|
|
715
720
|
`)
|
|
@@ -748,11 +753,11 @@ Do not open public issues for suspected vulnerabilities.
|
|
|
748
753
|
|
|
749
754
|
|
|
750
755
|
const ReadmeTopFooter = cmp(function ReadmeTopFooter(props: any) {
|
|
751
|
-
const { productName } = props.s
|
|
756
|
+
const { productName, definition } = props.s
|
|
752
757
|
|
|
753
758
|
Content(`---
|
|
754
759
|
|
|
755
|
-
Generated from the ${productName}
|
|
760
|
+
Generated from the ${productName} ${definition} by [@voxgig/sdkgen](${SDKGEN_REPO}).
|
|
756
761
|
`)
|
|
757
762
|
})
|
|
758
763
|
|
|
@@ -768,10 +773,14 @@ const ReadmeTop = cmp(function ReadmeTop(props: any) {
|
|
|
768
773
|
|
|
769
774
|
const text = fact(model.main[KIT], 'text')
|
|
770
775
|
|
|
771
|
-
const productName =
|
|
776
|
+
const productName = fact(model.main[KIT], 'apiName').inline
|
|
777
|
+
|
|
778
|
+
const kind = fact(model.main[KIT], 'definitionKind')
|
|
779
|
+
const definition = definitionName(kind)
|
|
780
|
+
const definitionFull = definitionName(kind, true)
|
|
772
781
|
|
|
773
782
|
const tagline = text.tagline.inline
|
|
774
|
-
|| `${productName} client, generated from the
|
|
783
|
+
|| `${productName} client, generated from the ${definition}.`
|
|
775
784
|
|
|
776
785
|
const aboutMd = text.about_md.text
|
|
777
786
|
|
|
@@ -796,41 +805,28 @@ const ReadmeTop = cmp(function ReadmeTop(props: any) {
|
|
|
796
805
|
each(feature, (feat: any) => { if (!feat.Name) names(feat, feat.name) })
|
|
797
806
|
|
|
798
807
|
const activeEntities = each(entity).filter((e: any) => e.active !== false)
|
|
799
|
-
const activeTargets =
|
|
800
|
-
|
|
801
|
-
const hasCli = activeTargets.some((t: any) => t.name === 'go-cli')
|
|
802
|
-
const hasMcp = activeTargets.some((t: any) => t.name === 'go-mcp')
|
|
808
|
+
const activeTargets = fact(model.main[KIT], 'active').map((name: string) => target[name])
|
|
803
809
|
|
|
810
|
+
const cliTargets = activeTargets.filter((t: any) => 'cli' === surfaceOf(t))
|
|
811
|
+
const mcpTargets = activeTargets.filter((t: any) => 'mcp' === surfaceOf(t))
|
|
812
|
+
const hasCli = 0 < cliTargets.length
|
|
813
|
+
const hasMcp = 0 < mcpTargets.length
|
|
804
814
|
|
|
805
|
-
const docsOrder: string[] = (getModelPath(model, `main.${KIT}.config.docs_order`,
|
|
806
|
-
{ only_active: false, required: false }) as any) || []
|
|
807
|
-
|
|
808
|
-
const orderOf = (name: string): number => {
|
|
809
|
-
const i = docsOrder.indexOf(name)
|
|
810
|
-
if (i !== -1) return i
|
|
811
|
-
if (name === 'go-cli') return docsOrder.length + 1
|
|
812
|
-
if (name === 'go-mcp') return docsOrder.length + 2
|
|
813
|
-
return docsOrder.length
|
|
814
|
-
}
|
|
815
815
|
|
|
816
|
-
const ordered = activeTargets
|
|
817
|
-
.slice()
|
|
818
|
-
.sort((a: any, b: any) => orderOf(a.name) - orderOf(b.name))
|
|
816
|
+
const ordered = documentOrder(model, activeTargets)
|
|
819
817
|
|
|
820
|
-
const isCliOrMcp = (t: any) =>
|
|
818
|
+
const isCliOrMcp = (t: any) => ['cli', 'mcp'].includes(surfaceOf(t))
|
|
821
819
|
|
|
822
|
-
const sdkTargets = ordered.filter((t: any) =>
|
|
820
|
+
const sdkTargets = ordered.filter((t: any) => 'sdk' === surfaceOf(t))
|
|
823
821
|
|
|
824
822
|
// The CLI and the MCP server have surfaces of their own below.
|
|
825
|
-
const consumerTargets = ordered.filter((t: any) =>
|
|
823
|
+
const consumerTargets = ordered.filter((t: any) => 'sdk' !== surfaceOf(t) && !isCliOrMcp(t))
|
|
826
824
|
|
|
827
825
|
const docTargets = ordered.filter((t: any) => !isCliOrMcp(t))
|
|
828
826
|
|
|
829
|
-
const pkgTargets =
|
|
830
|
-
.filter((t: any) => hasPackageName(model, t.name))
|
|
831
|
-
.sort((a: any, b: any) => orderOf(a.name) - orderOf(b.name))
|
|
827
|
+
const pkgTargets = ordered.filter((t: any) => hasPackageName(model, t.name))
|
|
832
828
|
|
|
833
|
-
const langList = sdkTargets.map((t: any) => t
|
|
829
|
+
const langList = sdkTargets.map((t: any) => fact(t, 'title')).join(', ')
|
|
834
830
|
const leadTarget = pickLeadTarget(sdkTargets)
|
|
835
831
|
|
|
836
832
|
const s = {
|
|
@@ -840,6 +836,8 @@ const ReadmeTop = cmp(function ReadmeTop(props: any) {
|
|
|
840
836
|
def,
|
|
841
837
|
text,
|
|
842
838
|
productName,
|
|
839
|
+
definition,
|
|
840
|
+
definitionFull,
|
|
843
841
|
tagline,
|
|
844
842
|
aboutMd,
|
|
845
843
|
apiSummary,
|
|
@@ -849,6 +847,8 @@ const ReadmeTop = cmp(function ReadmeTop(props: any) {
|
|
|
849
847
|
activeEntities,
|
|
850
848
|
hasCli,
|
|
851
849
|
hasMcp,
|
|
850
|
+
cliTargets,
|
|
851
|
+
mcpTargets,
|
|
852
852
|
sdkTargets,
|
|
853
853
|
consumerTargets,
|
|
854
854
|
docTargets,
|
package/src/cmp/Registered.ts
CHANGED
|
@@ -25,7 +25,7 @@ function registerComponent(name: string, options: RegisterOptions = {}) {
|
|
|
25
25
|
const { target, ctx$ } = props
|
|
26
26
|
const { model, log } = ctx$
|
|
27
27
|
|
|
28
|
-
const stdrep = ensureStdrep(ctx
|
|
28
|
+
const stdrep = ensureStdrep(ctx$, target)
|
|
29
29
|
|
|
30
30
|
const path = `./cmp/${target.name}/${name}_${target.name}`
|
|
31
31
|
const mod: any = optional ? loadOptional(ctx$, path) : requirePath(ctx$, path)
|
package/src/cmp/Security.ts
CHANGED
|
@@ -1,11 +1,34 @@
|
|
|
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 { documentOrder, surfaceOf } from '../helpers/surface'
|
|
5
|
+
import { seriesList } from '../helpers/text'
|
|
6
|
+
import { KIT, getModelPath } from '../types'
|
|
3
7
|
|
|
4
8
|
import {
|
|
5
|
-
apiName, isDefaultPublisher, publisherInfo,
|
|
9
|
+
apiName, isDefaultPublisher, publisherInfo, registryLabel, registryName, repoInfo,
|
|
10
|
+
securityContact,
|
|
6
11
|
} from '../helpers/packageMeta'
|
|
7
12
|
|
|
8
13
|
|
|
14
|
+
// Where the SDK packages are published: each registry, then the Go module,
|
|
15
|
+
// then the git tags a port with no registry releases by.
|
|
16
|
+
function publishedTo(model: any): string[] {
|
|
17
|
+
const sdks = documentOrder(model,
|
|
18
|
+
each(getModelPath(model, `main.${KIT}.target`, { required: false }) || {})
|
|
19
|
+
.filter((t: any) => false !== t.active && 'sdk' === surfaceOf(t)))
|
|
20
|
+
|
|
21
|
+
const registries = sdks.filter((t: any) => 'go' !== fact(t, 'origin'))
|
|
22
|
+
.map((t: any) => registryName(model, t.name))
|
|
23
|
+
|
|
24
|
+
return [
|
|
25
|
+
...new Set(registries.filter((name: string) => '' !== name).map(registryLabel)),
|
|
26
|
+
...(sdks.some((t: any) => 'go' === fact(t, 'origin')) ? ['the Go module'] : []),
|
|
27
|
+
...(registries.includes('') ? ['git tags'] : []),
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
9
32
|
const Security = cmp(function Security(props: any) {
|
|
10
33
|
const { ctx$ } = props
|
|
11
34
|
const { model } = ctx$
|
|
@@ -18,6 +41,8 @@ const Security = cmp(function Security(props: any) {
|
|
|
18
41
|
const promise = isDefaultPublisher(model) ?
|
|
19
42
|
' We aim to\nacknowledge reports within 3 business days.' : ''
|
|
20
43
|
|
|
44
|
+
const places = publishedTo(model)
|
|
45
|
+
|
|
21
46
|
File({ name: 'SECURITY.md' }, () => {
|
|
22
47
|
Content(`# Security Policy
|
|
23
48
|
|
|
@@ -32,11 +57,13 @@ For non-security bugs, use the issue tracker: ${issuesUrl}
|
|
|
32
57
|
## Scope
|
|
33
58
|
|
|
34
59
|
This policy applies to the generated ${publisher.name} SDK packages published from this
|
|
35
|
-
repository
|
|
60
|
+
repository${0 === places.length ? '' : ' (' + seriesList(places) + ')'}.
|
|
36
61
|
|
|
37
|
-
|
|
62
|
+
${publisher.official ?
|
|
63
|
+
`This SDK for the ${apiName(model)} API is generated by ${publisher.name}.` :
|
|
64
|
+
`This is an unofficial SDK for the ${apiName(model)} public API, generated by
|
|
38
65
|
${publisher.name}. It is not affiliated with, endorsed by, or sponsored by the upstream
|
|
39
|
-
API provider
|
|
66
|
+
API provider.`}
|
|
40
67
|
`)
|
|
41
68
|
})
|
|
42
69
|
})
|
package/src/cmp/Test.ts
CHANGED
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
const Test = cmp(function Test(props: any) {
|
|
21
21
|
const { target, ctx$ } = props
|
|
22
22
|
const { model, log } = ctx$
|
|
23
|
-
const stdrep = ensureStdrep(ctx
|
|
23
|
+
const stdrep = ensureStdrep(ctx$, target)
|
|
24
24
|
|
|
25
25
|
const points = Object.values(model.main.kit.entity || {}).flatMap((entity: any) =>
|
|
26
26
|
Object.values(entity.op || {}).flatMap((op: any) => op.points || [])) as any[]
|
package/src/helpers/alongside.ts
CHANGED
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
import { KIT } from '@voxgig/apidef'
|
|
2
2
|
|
|
3
|
+
import { fact } from './facts'
|
|
4
|
+
import { surfaceOf } from './surface'
|
|
3
5
|
|
|
4
|
-
const PHASES = ['entity', 'feature', 'readme', 'agentguide', 'test']
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
// Names only the active surfaces, so a project with go-mcp off is not promised one.
|
|
14
|
-
function alongsideNote(model: any, self: string): string {
|
|
7
|
+
// Names only the active surfaces, so a project with go-mcp off is not promised
|
|
8
|
+
// one. `link` is the root README from this target's folder, and without one
|
|
9
|
+
// there is no note.
|
|
10
|
+
function alongsideNote(model: any, self: string, link?: string): string {
|
|
15
11
|
const target = model?.main?.[KIT]?.target || {}
|
|
16
|
-
const
|
|
17
|
-
|
|
12
|
+
const readme = link ?? (null == target[self] ? '' : fact(target[self], 'link').readme)
|
|
13
|
+
if ('' === readme) return ''
|
|
14
|
+
|
|
15
|
+
const others = fact(model.main[KIT], 'active')
|
|
16
|
+
.filter((name: string) => name !== self)
|
|
17
|
+
.map((name: string) => surfaceOf(target[name]))
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
const langs = others.some(([name, t]: [string, any]) =>
|
|
23
|
-
'go-cli' !== name && 'go-mcp' !== name && !isConsumer(t))
|
|
19
|
+
const cli = others.includes('cli')
|
|
20
|
+
const mcp = others.includes('mcp')
|
|
21
|
+
const langs = others.includes('sdk')
|
|
24
22
|
|
|
25
23
|
const parts: string[] = []
|
|
26
24
|
if (langs) parts.push('Other languages')
|
|
@@ -34,13 +32,12 @@ function alongsideNote(model: any, self: string): string {
|
|
|
34
32
|
const verb = 1 === parts.length && !langs ? 'lives' : 'live'
|
|
35
33
|
|
|
36
34
|
return `> ${list[0].toUpperCase() + list.slice(1)} ${verb} alongside this one — see
|
|
37
|
-
> the [top-level README](
|
|
35
|
+
> the [top-level README](${readme}).
|
|
38
36
|
|
|
39
37
|
`
|
|
40
38
|
}
|
|
41
39
|
|
|
42
40
|
|
|
43
41
|
export {
|
|
44
|
-
isConsumer,
|
|
45
42
|
alongsideNote,
|
|
46
43
|
}
|
|
@@ -6,6 +6,7 @@ import { KIT, getModelPath } from '@voxgig/apidef'
|
|
|
6
6
|
|
|
7
7
|
import { definitionPathAny, migrateIncludes } from './definition'
|
|
8
8
|
import { scaffoldFolder } from './shipped'
|
|
9
|
+
import { resolvesBundled } from '../action/resolve'
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
function tags(val: any): string[] {
|
|
@@ -29,12 +30,25 @@ function featureApplies(feature: any, target: any): boolean {
|
|
|
29
30
|
return true
|
|
30
31
|
}
|
|
31
32
|
|
|
32
|
-
const provides =
|
|
33
|
+
const provides = providedBy(target)
|
|
33
34
|
|
|
34
35
|
return needs.every((need: string) => provides.includes(need))
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
|
|
39
|
+
// An add keeps an alias's own model file, so one that declares no `provides`
|
|
40
|
+
// takes its origin's.
|
|
41
|
+
function providedBy(target: any): string[] {
|
|
42
|
+
const own = target?.provides
|
|
43
|
+
const origin = target?.origname
|
|
44
|
+
if ((null != own && 0 < Object.keys(own).length) || 'string' !== typeof origin ||
|
|
45
|
+
'' === origin || origin === target.name || !resolvesBundled(target, target.name)) {
|
|
46
|
+
return tags(own)
|
|
47
|
+
}
|
|
48
|
+
return shippedProvides(origin)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
38
52
|
function targetFeatures(model: any, target: any): Record<string, any> {
|
|
39
53
|
const feature = getModelPath(model, `main.${KIT}.feature`, { required: false }) || {}
|
|
40
54
|
|
|
@@ -96,6 +110,7 @@ function unknownTags(val: any): string[] {
|
|
|
96
110
|
|
|
97
111
|
export {
|
|
98
112
|
featureApplies,
|
|
113
|
+
providedBy,
|
|
99
114
|
shippedProvides,
|
|
100
115
|
targetFeatures,
|
|
101
116
|
tags as featureTags,
|
package/src/helpers/component.ts
CHANGED
|
@@ -6,12 +6,22 @@ import * as Jostraca from 'jostraca'
|
|
|
6
6
|
const COMPONENT = 'cmp'
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
//
|
|
9
|
+
// The components that write one target's own files, a project's registered
|
|
10
|
+
// ones included.
|
|
11
|
+
const PER_TARGET = ['Main', 'Entity', 'Feature', 'Readme', 'Test', 'AgentGuide', 'Registered']
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
// jostraca's cmp, labelling each node it makes with the component's name. A
|
|
15
|
+
// target a run override relocates writes nothing in the in-tree pass.
|
|
10
16
|
const cmp: typeof Jostraca.cmp = ((component: any) => {
|
|
11
17
|
const labelled = (props: any, children?: any) => {
|
|
12
18
|
if (null != props?.ctx$?.node?.meta) {
|
|
13
19
|
props.ctx$.node.meta[COMPONENT] = component.name
|
|
14
20
|
}
|
|
21
|
+
if (PER_TARGET.includes(component.name) &&
|
|
22
|
+
true === props?.ctx$?.meta?.relocated?.includes(props?.target?.name)) {
|
|
23
|
+
return
|
|
24
|
+
}
|
|
15
25
|
return component(props, children)
|
|
16
26
|
}
|
|
17
27
|
Object.defineProperty(labelled, 'name', { value: component.name })
|
|
@@ -73,7 +73,6 @@ function definitionPlan(ctx$: any): DefinitionPoint[] {
|
|
|
73
73
|
if (false === entity.active) continue
|
|
74
74
|
|
|
75
75
|
for (const [op, operation] of Object.entries(entity.op || {}) as any[]) {
|
|
76
|
-
// An inactive operation stays in the model but gets no method.
|
|
77
76
|
if (false === operation?.active || !GENERATED_OPS.includes(op)) continue
|
|
78
77
|
|
|
79
78
|
const points = (operation?.points || []).filter((p: any) => false !== p.a)
|
package/src/helpers/doctext.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { KIT } from '@voxgig/apidef'
|
|
1
|
+
import { KIT, nom } from '@voxgig/apidef'
|
|
2
2
|
|
|
3
3
|
import { modelText } from './text'
|
|
4
4
|
|
|
@@ -73,6 +73,8 @@ function docTexts(model: any): DocText[] {
|
|
|
73
73
|
add(kit, ['text', name], raw, !given(own[name]))
|
|
74
74
|
|
|
75
75
|
slot('title', str(info.title))
|
|
76
|
+
add(kit, ['apiName'], str(info.title) || nom(model, 'Name') + ' API',
|
|
77
|
+
given(info.title) && !given(own.title))
|
|
76
78
|
slot('tagline', str(info.tagline) || str(def.tagline))
|
|
77
79
|
slot('summary', str(info.summary, true))
|
|
78
80
|
slot('about_md', str(info.about_md, true))
|