@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/action/doctor.ts
CHANGED
|
@@ -55,6 +55,9 @@ import { compareVersions } from '../helpers/semver'
|
|
|
55
55
|
|
|
56
56
|
import { isTypeScript, missingExports } from '../helpers/exportnames'
|
|
57
57
|
|
|
58
|
+
import { untestedTargets } from '../helpers/targetguard'
|
|
59
|
+
import type { BrokenTarget } from '../helpers/targetguard'
|
|
60
|
+
|
|
58
61
|
|
|
59
62
|
const IGNORED_RE = /(~|-jostraca-off)$/
|
|
60
63
|
|
|
@@ -115,6 +118,10 @@ type DoctorReport = {
|
|
|
115
118
|
// it is what an alias is FOR.
|
|
116
119
|
aliasedDiff: string[]
|
|
117
120
|
|
|
121
|
+
// Of those, a file lacking slots its origin's file declares. An add keeps
|
|
122
|
+
// the file, so a slot added since never reaches it. Informational.
|
|
123
|
+
aliasedBehind: { file: string, slots: string[] }[]
|
|
124
|
+
|
|
118
125
|
// Differs from its source, but the copy record shows it untouched since an
|
|
119
126
|
// add wrote it: the source moved on, so refreshing it discards nothing.
|
|
120
127
|
outdated: string[]
|
|
@@ -151,6 +158,10 @@ type DoctorReport = {
|
|
|
151
158
|
// `.sdk/.gitignore` hides the copy record from git. Informational.
|
|
152
159
|
ignoredLog: boolean
|
|
153
160
|
|
|
161
|
+
// Active SDK targets the model gives no active `test` feature, which
|
|
162
|
+
// generate refuses.
|
|
163
|
+
untested: string[]
|
|
164
|
+
|
|
154
165
|
ok: boolean
|
|
155
166
|
}
|
|
156
167
|
|
|
@@ -349,13 +360,14 @@ async function doctor(
|
|
|
349
360
|
const report: DoctorReport = {
|
|
350
361
|
forked: [], edited: [], stale: [], missing: [], additive: [],
|
|
351
362
|
superseded: [], unwired: [], orphanModel: [],
|
|
352
|
-
resyncPending: [], aliasedDiff: [],
|
|
363
|
+
resyncPending: [], aliasedDiff: [], aliasedBehind: [],
|
|
353
364
|
outdated: [], ahead: [], unrecorded: [], customized: [], unfolded: [],
|
|
354
365
|
belowFloor: [], unreadable: [], unresolved: [], byItem: {},
|
|
355
|
-
ignoredLog: false, ok: true,
|
|
366
|
+
ignoredLog: false, untested: [], ok: true,
|
|
356
367
|
}
|
|
357
368
|
|
|
358
369
|
const copies = readCopies(fs, root)
|
|
370
|
+
const untested: BrokenTarget[] = []
|
|
359
371
|
|
|
360
372
|
report.ignoredLog = ignoredLog(fs, root)
|
|
361
373
|
if (report.ignoredLog) {
|
|
@@ -436,6 +448,13 @@ async function doctor(
|
|
|
436
448
|
|
|
437
449
|
if (null == scope) {
|
|
438
450
|
checkWiring(actx, report)
|
|
451
|
+
|
|
452
|
+
// Only a prepared model has the facts to judge by; resolveModel prepares
|
|
453
|
+
// every action's.
|
|
454
|
+
if (null != (model as any)?.main?.[KIT]?.fact) {
|
|
455
|
+
untested.push(...untestedTargets(model))
|
|
456
|
+
report.untested = untested.map((b: BrokenTarget) => b.target)
|
|
457
|
+
}
|
|
439
458
|
}
|
|
440
459
|
|
|
441
460
|
// orphanModel counts, and `unwired` does not. Not skipping a root
|
|
@@ -447,7 +466,7 @@ async function doctor(
|
|
|
447
466
|
report.customized.length + report.stale.length + report.missing.length + report.superseded.length +
|
|
448
467
|
report.orphanModel.length + report.outdated.length + report.ahead.length +
|
|
449
468
|
report.unfolded.length + report.belowFloor.length +
|
|
450
|
-
report.unreadable.length + report.unresolved.length
|
|
469
|
+
report.unreadable.length + report.unresolved.length + report.untested.length
|
|
451
470
|
|
|
452
471
|
const customized = new Set(report.customized)
|
|
453
472
|
const unmergeable = MERGE === projectCopyMode(actx) ? new Set(report.unrecorded) : new Set()
|
|
@@ -479,6 +498,10 @@ async function doctor(
|
|
|
479
498
|
}
|
|
480
499
|
}
|
|
481
500
|
|
|
501
|
+
for (const b of untested) {
|
|
502
|
+
log.info({ point: 'doctor-finding', kind: 'untested', target: b.target, note: 'UNTESTED: ' + b.note })
|
|
503
|
+
}
|
|
504
|
+
|
|
482
505
|
for (const { file, item, error, oldSyntax } of report.unreadable) {
|
|
483
506
|
log.info({
|
|
484
507
|
point: 'doctor-finding', kind: 'unreadable', file, error,
|
|
@@ -487,6 +510,14 @@ async function doctor(
|
|
|
487
510
|
})
|
|
488
511
|
}
|
|
489
512
|
|
|
513
|
+
for (const { file, slots } of report.aliasedBehind) {
|
|
514
|
+
log.info({
|
|
515
|
+
point: 'doctor-finding', kind: 'aliasedBehind', file, slots,
|
|
516
|
+
note: 'ALIASED BEHIND (lacks ' + slots.join(', ') + ', which its origin declares; ' +
|
|
517
|
+
'an add keeps this file, so copy them in by hand): ' + file
|
|
518
|
+
})
|
|
519
|
+
}
|
|
520
|
+
|
|
490
521
|
for (const { file, names } of report.unfolded) {
|
|
491
522
|
log.info({
|
|
492
523
|
point: 'doctor-finding', kind: 'unfolded', file, names,
|
|
@@ -543,12 +574,14 @@ async function doctor(
|
|
|
543
574
|
orphanModel: report.orphanModel.length,
|
|
544
575
|
resyncPending: report.resyncPending.length,
|
|
545
576
|
aliasedDiff: report.aliasedDiff.length,
|
|
577
|
+
aliasedBehind: report.aliasedBehind.length,
|
|
546
578
|
outdated: report.outdated.length,
|
|
547
579
|
ahead: report.ahead.length,
|
|
548
580
|
unfolded: report.unfolded.length,
|
|
549
581
|
belowFloor: report.belowFloor.length,
|
|
550
582
|
unreadable: report.unreadable.length,
|
|
551
583
|
unresolved: report.unresolved.length,
|
|
584
|
+
untested: report.untested.length,
|
|
552
585
|
customized: report.customized.length,
|
|
553
586
|
note: report.ok ?
|
|
554
587
|
('.sdk matches the scaffold (' + report.additive.length + ' additive, ' +
|
|
@@ -559,7 +592,7 @@ async function doctor(
|
|
|
559
592
|
' outdated, ' + report.ahead.length + ' ahead, ' +
|
|
560
593
|
report.unfolded.length + ' unfolded, ' + report.belowFloor.length +
|
|
561
594
|
' below the floor, ' + report.unreadable.length + ' unreadable, ' +
|
|
562
|
-
report.unresolved.length + ' unresolved')
|
|
595
|
+
report.unresolved.length + ' unresolved, ' + report.untested.length + ' untested')
|
|
563
596
|
})
|
|
564
597
|
|
|
565
598
|
return { report }
|
|
@@ -997,6 +1030,10 @@ function checkItemModel(
|
|
|
997
1030
|
|
|
998
1031
|
if (aliased) {
|
|
999
1032
|
report.aliasedDiff.push(label)
|
|
1033
|
+
const slots = slotsBehind(fs, kind, scaffold, origname, project, name)
|
|
1034
|
+
if (0 < slots.length) {
|
|
1035
|
+
report.aliasedBehind.push({ file: label, slots })
|
|
1036
|
+
}
|
|
1000
1037
|
return
|
|
1001
1038
|
}
|
|
1002
1039
|
|
|
@@ -1009,6 +1046,27 @@ function checkItemModel(
|
|
|
1009
1046
|
}
|
|
1010
1047
|
|
|
1011
1048
|
|
|
1049
|
+
const PROVENANCE_SLOTS = ['base', 'origname', 'package']
|
|
1050
|
+
|
|
1051
|
+
// The slots the origin's model file declares that the alias's own file lacks.
|
|
1052
|
+
function slotsBehind(
|
|
1053
|
+
fs: any, kind: string, scaffold: string, origname: string, project: string, name: string,
|
|
1054
|
+
): string[] {
|
|
1055
|
+
const block = (path: string, key: string): Record<string, any> | undefined => {
|
|
1056
|
+
const text = migrateIncludes(String(fs.readFileSync(path, 'utf8')))
|
|
1057
|
+
const compiled = compileModel(text, path, { strict: false })
|
|
1058
|
+
return 0 === compiled.errors.length ? kindCollection(compiled.model, kind)[key] : undefined
|
|
1059
|
+
}
|
|
1060
|
+
const origin = block(scaffold, origname)
|
|
1061
|
+
const alias = block(project, name)
|
|
1062
|
+
if (null == origin || null == alias) {
|
|
1063
|
+
return []
|
|
1064
|
+
}
|
|
1065
|
+
return Object.keys(origin)
|
|
1066
|
+
.filter((slot: string) => !PROVENANCE_SLOTS.includes(slot) && !(slot in alias)).sort()
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
|
|
1012
1070
|
// Files every finding through one place: a forked or edited copy the record
|
|
1013
1071
|
// shows untouched is outdated instead, and every item keeps a tally.
|
|
1014
1072
|
function noteDrift(
|
package/src/action/package.ts
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
import type { Manifest, Finding } from '../helpers/manifest'
|
|
23
23
|
|
|
24
24
|
import { satisfies } from '../helpers/semver'
|
|
25
|
+
import { SDKGEN_VERSION } from '../helpers/shipped'
|
|
25
26
|
|
|
26
27
|
import { npmCommand } from '../helpers/npm'
|
|
27
28
|
import type { NpmCommand, NpmHost } from '../helpers/npm'
|
|
@@ -152,19 +153,6 @@ function checkEngine(src: PackageSource, actx: ActionContext) {
|
|
|
152
153
|
}
|
|
153
154
|
|
|
154
155
|
|
|
155
|
-
// This generator's own version, read from the package.json beside `dist`.
|
|
156
|
-
// Not from the consumer's model: `engines.sdkgen` is about the GENERATOR
|
|
157
|
-
// doing the installing, and the model describes the SDK being generated.
|
|
158
|
-
const SDKGEN_VERSION: string = (() => {
|
|
159
|
-
try {
|
|
160
|
-
return require('../../package.json').version
|
|
161
|
-
}
|
|
162
|
-
catch (err: any) {
|
|
163
|
-
return '0.0.0'
|
|
164
|
-
}
|
|
165
|
-
})()
|
|
166
|
-
|
|
167
|
-
|
|
168
156
|
function selectItems(
|
|
169
157
|
src: PackageSource, only: string | undefined, log: any,
|
|
170
158
|
): Record<string, string[]> {
|
package/src/action/remove.ts
CHANGED
|
@@ -31,6 +31,8 @@ import { doctor } from './doctor'
|
|
|
31
31
|
|
|
32
32
|
import { forgetCopies } from './copies'
|
|
33
33
|
|
|
34
|
+
import { readOverride, runOutput } from '../helpers/placement'
|
|
35
|
+
|
|
34
36
|
|
|
35
37
|
// Everything one `remove` would touch, decided before anything is written.
|
|
36
38
|
type RemovePlan = {
|
|
@@ -289,16 +291,28 @@ function planOutput(
|
|
|
289
291
|
) {
|
|
290
292
|
const fs = actx.fs()
|
|
291
293
|
const root = actx.folder
|
|
294
|
+
const output = Path.join(root, '..', plan.name)
|
|
295
|
+
|
|
296
|
+
// Where a generate run here would write, the run override included.
|
|
297
|
+
const targets = Object.keys((actx.model as any)?.main?.[KIT]?.target ?? {})
|
|
298
|
+
const { override, named } = readOverride(
|
|
299
|
+
actx.opts?.external, process.env.SDKGEN_EXTERNAL, targets)
|
|
300
|
+
const run = runOutput(declared?.output, override[plan.name])
|
|
292
301
|
|
|
293
302
|
// The base schema defaults the path to '', which declares no output.
|
|
294
|
-
if ('' !== (
|
|
295
|
-
|
|
296
|
-
|
|
303
|
+
if ('' !== (run.path ?? '') || true === run.root) {
|
|
304
|
+
const where = true === run.root ? 'at the project root' :
|
|
305
|
+
'out of tree (' + run.path +
|
|
306
|
+
(named.includes(plan.name) ? ', from SDKGEN_EXTERNAL' : '') + ')'
|
|
307
|
+
plan.notes.push(plan.name + ': generates ' + where + '; that output is not touched')
|
|
308
|
+
|
|
309
|
+
if (fs.existsSync(output)) {
|
|
310
|
+
plan.notes.push(plan.name + ': ' + rel(root, output) + ' is not where ' +
|
|
311
|
+
'it is generated, and is kept; remove it yourself if it is stale')
|
|
312
|
+
}
|
|
297
313
|
return
|
|
298
314
|
}
|
|
299
315
|
|
|
300
|
-
const output = Path.join(root, '..', plan.name)
|
|
301
|
-
|
|
302
316
|
if (!fs.existsSync(output)) {
|
|
303
317
|
return
|
|
304
318
|
}
|
package/src/action/resolve.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { kindCollection } from '../helpers/kindCollection'
|
|
2
2
|
|
|
3
|
+
import Fs from 'node:fs'
|
|
3
4
|
import Path from 'node:path'
|
|
4
5
|
|
|
5
6
|
import { getelem } from '@voxgig/struct'
|
|
@@ -9,6 +10,7 @@ import { KIT } from '../types'
|
|
|
9
10
|
import { SdkGenError } from '../utility'
|
|
10
11
|
|
|
11
12
|
import { definitionPathAny } from '../helpers/definition'
|
|
13
|
+
import { scaffoldFolder } from '../helpers/shipped'
|
|
12
14
|
import { readManifest, checkShape, ITEM_NAME_RE } from '../helpers/manifest'
|
|
13
15
|
|
|
14
16
|
|
|
@@ -364,12 +366,14 @@ function resolvesBundled(declared: any, name: string): boolean {
|
|
|
364
366
|
type TargetOrigins = {
|
|
365
367
|
bundled: string[]
|
|
366
368
|
external: { name: string, from: string }[]
|
|
369
|
+
owned: string[]
|
|
367
370
|
}
|
|
368
371
|
|
|
369
372
|
|
|
373
|
+
// A bare name the shipped scaffold lacks is the project's own.
|
|
370
374
|
function targetOrigins(model: any): TargetOrigins {
|
|
371
375
|
const targets = kindCollection(model, 'target')
|
|
372
|
-
const origins: TargetOrigins = { bundled: [], external: [] }
|
|
376
|
+
const origins: TargetOrigins = { bundled: [], external: [], owned: [] }
|
|
373
377
|
|
|
374
378
|
for (const name of Object.keys(targets).sort()) {
|
|
375
379
|
const target = targets[name]
|
|
@@ -377,11 +381,14 @@ function targetOrigins(model: any): TargetOrigins {
|
|
|
377
381
|
continue
|
|
378
382
|
}
|
|
379
383
|
|
|
380
|
-
if (resolvesBundled(target, name)) {
|
|
381
|
-
origins.
|
|
384
|
+
if (!resolvesBundled(target, name)) {
|
|
385
|
+
origins.external.push({ name, from: normaliseBase(target.base) })
|
|
386
|
+
}
|
|
387
|
+
else if (!Fs.existsSync(definitionPathAny(Fs, scaffoldFolder(), 'target', target.origname || name))) {
|
|
388
|
+
origins.owned.push(name)
|
|
382
389
|
}
|
|
383
390
|
else {
|
|
384
|
-
origins.
|
|
391
|
+
origins.bundled.push(name)
|
|
385
392
|
}
|
|
386
393
|
}
|
|
387
394
|
|
package/src/admin/status.ts
CHANGED
|
@@ -2,6 +2,10 @@ import Fs from 'node:fs'
|
|
|
2
2
|
import Path from 'node:path'
|
|
3
3
|
import { spawnSync } from 'node:child_process'
|
|
4
4
|
|
|
5
|
+
import { applyFacts } from '../helpers/facts'
|
|
6
|
+
import { guardModel } from '../helpers/guardModel'
|
|
7
|
+
import { readOverride, runFolder, runPlace } from '../helpers/placement'
|
|
8
|
+
|
|
5
9
|
function command(cwd: string, bin: string, args: string[]) {
|
|
6
10
|
return spawnSync(bin, args, { cwd, encoding: 'utf8', timeout: 15000, windowsHide: true, env: { ...process.env, GIT_OPTIONAL_LOCKS: '0' } })
|
|
7
11
|
}
|
|
@@ -21,8 +25,14 @@ function workingTree(folder: string) {
|
|
|
21
25
|
return state === null ? 'not a git repository' : state ? 'modified' : 'clean'
|
|
22
26
|
}
|
|
23
27
|
|
|
28
|
+
// The model a generate reads, which `sdk.json` is written before.
|
|
29
|
+
function prepare(model: any): string | undefined {
|
|
30
|
+
try { applyFacts(guardModel(model)) }
|
|
31
|
+
catch (err: any) { return 'Cannot prepare the compiled model: ' + err.message }
|
|
32
|
+
}
|
|
33
|
+
|
|
24
34
|
// Read the compiled model and working trees. Never fetch, build, test, or publish.
|
|
25
|
-
export function repositoryStatus(root: string) {
|
|
35
|
+
export function repositoryStatus(root: string, env: Record<string, string | undefined> = process.env) {
|
|
26
36
|
root = Path.resolve(root)
|
|
27
37
|
const sdk = Path.join(root, '.sdk')
|
|
28
38
|
if (!directory(sdk)) throw new Error('Expected an SDK repository containing .sdk: ' + root)
|
|
@@ -34,7 +44,11 @@ export function repositoryStatus(root: string) {
|
|
|
34
44
|
if (!model?.main?.kit) throw new Error('missing main.kit')
|
|
35
45
|
} catch (err: any) { modelError = 'Invalid compiled model: ' + err.message }
|
|
36
46
|
}
|
|
47
|
+
if (model && !modelError) modelError = prepare(model)
|
|
37
48
|
const kit = model?.main?.kit || {}
|
|
49
|
+
let override: any = {}, overridden: string[] = [], overrideError: string | undefined
|
|
50
|
+
try { ({ override, named: overridden } = readOverride(undefined, env.SDKGEN_EXTERNAL, Object.keys(kit.target || {}))) }
|
|
51
|
+
catch (err: any) { overrideError = err.message }
|
|
38
52
|
const upstream = git(root, ['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{upstream}'])
|
|
39
53
|
const counts = upstream && git(root, ['rev-list', '--left-right', '--count', 'HEAD...@{upstream}'])
|
|
40
54
|
const [ahead, behind] = counts ? counts.split(/\s+/).map(Number) : [null, null]
|
|
@@ -51,11 +65,15 @@ export function repositoryStatus(root: string) {
|
|
|
51
65
|
},
|
|
52
66
|
model: { path: file, compiled: !!model && !modelError, error: modelError,
|
|
53
67
|
generatedAt: Fs.existsSync(file) ? Fs.statSync(file).mtime.toISOString() : null },
|
|
68
|
+
override: { targets: overridden, error: overrideError },
|
|
54
69
|
toolchain: { node: process.version, packages },
|
|
55
70
|
targets: entries(kit.target).map(([name, target]) => {
|
|
56
|
-
const
|
|
71
|
+
const place = runPlace(target, override[name])
|
|
72
|
+
const folder = runFolder(target, name, root, override[name])
|
|
57
73
|
const present = directory(folder)
|
|
58
|
-
|
|
74
|
+
const intree = Path.resolve(root, name)
|
|
75
|
+
const stale = 'external' === place && intree !== folder && directory(intree) ? intree : null
|
|
76
|
+
return { name, active: target.active !== false, place, path: folder, present, stale,
|
|
59
77
|
state: workingTree(folder), readme: Fs.existsSync(Path.join(folder, 'README.md')),
|
|
60
78
|
version: target.publish?.version || null,
|
|
61
79
|
publication: target.publish?.registry?.state || 'not recorded',
|
|
@@ -95,7 +113,7 @@ export function main(args = process.argv.slice(2)): number {
|
|
|
95
113
|
}
|
|
96
114
|
if (!root || args.some(arg => !['--json', '--github'].includes(arg))) throw new Error('Usage: status.sh [--json] [--github]')
|
|
97
115
|
const report: any = repositoryStatus(root)
|
|
98
|
-
let failed = !!report.model.error
|
|
116
|
+
let failed = !!report.model.error || !!report.override.error
|
|
99
117
|
if (args.includes('--github')) {
|
|
100
118
|
try { report.github = githubStatus(report.root) }
|
|
101
119
|
catch (err: any) { report.github = { error: err.message }; failed = true }
|
|
@@ -107,8 +125,10 @@ export function main(args = process.argv.slice(2)): number {
|
|
|
107
125
|
console.log('Upstream: ' + (report.repository.upstream ? report.repository.upstream + ' | ahead ' + report.repository.ahead + ', behind ' + report.repository.behind + ' (local tracking refs)' : 'not configured'))
|
|
108
126
|
console.log('Model: ' + (report.model.error || (report.model.compiled ? 'compiled ' + report.model.generatedAt : 'not generated; run npm run generate from .sdk')))
|
|
109
127
|
console.log('Toolchain: Node ' + report.toolchain.node + '; ' + report.toolchain.packages.map((p: any) => p.name + ' ' + p.version).join('; '))
|
|
128
|
+
if (report.override.error) console.log('Override: ' + report.override.error)
|
|
129
|
+
else if (report.override.targets.length) console.log('Override: SDKGEN_EXTERNAL places ' + report.override.targets.join(', ') + ' for this run')
|
|
110
130
|
console.log('\nSDKs and tools (publication state comes from the model):')
|
|
111
|
-
for (const t of report.targets) console.log(' ' + t.name + ' | ' + (t.active ? 'active' : 'inactive') + ' | ' + t.state + ' | version ' + (t.version || 'not recorded') + ' | ' + t.publication + ' | ' + t.path)
|
|
131
|
+
for (const t of report.targets) console.log(' ' + t.name + ' | ' + (t.active ? 'active' : 'inactive') + ' | ' + t.state + ' | version ' + (t.version || 'not recorded') + ' | ' + t.publication + ' | ' + t.path + (t.stale ? ' | stale in-tree folder ' + t.stale : ''))
|
|
112
132
|
if (!report.targets.length) console.log(' No targets in the compiled model.')
|
|
113
133
|
console.log('\nDocumentation:')
|
|
114
134
|
for (const e of report.editions) console.log(' ' + e.name + ' | ' + (e.active ? 'active' : 'inactive') + ' | ' + (e.present ? 'present' : 'missing') + ' | ' + (e.path || 'no output path'))
|
package/src/cmp/AgentGuide.ts
CHANGED
|
@@ -3,6 +3,8 @@ import { Content, File } from 'jostraca'
|
|
|
3
3
|
import { cmp } from '../helpers/component'
|
|
4
4
|
|
|
5
5
|
import { optionalComponent } from '../helpers/optional'
|
|
6
|
+
import { fact } from '../helpers/facts'
|
|
7
|
+
import { apiName } from '../helpers/packageMeta'
|
|
6
8
|
|
|
7
9
|
import {
|
|
8
10
|
activeFeatures,
|
|
@@ -32,36 +34,47 @@ const AgentGuide = cmp(function AgentGuide(props: any) {
|
|
|
32
34
|
|
|
33
35
|
const Name = projectName(model)
|
|
34
36
|
const lang = target.name
|
|
35
|
-
const title = target
|
|
36
|
-
const surface = langCmd(lang).note
|
|
37
|
+
const title = fact(target, 'title')
|
|
38
|
+
const surface = langCmd(lang, model).note
|
|
37
39
|
|
|
38
40
|
const features = activeFeatures(model, target)
|
|
39
41
|
const featuresOn = featuresEnabled(target)
|
|
40
42
|
const dirLayout = isDirLayout(target)
|
|
41
43
|
|
|
44
|
+
const place = fact(target, 'place')
|
|
45
|
+
const guide = fact(target, 'link').agents
|
|
46
|
+
const sdk = 'folder' === place ? '../.sdk' : 'root' === place ? '.sdk' :
|
|
47
|
+
null == ctx$.sdkrelpath ? '' : ctx$.sdkrelpath + '/.sdk'
|
|
48
|
+
const pathNote = 'folder' === place ?
|
|
49
|
+
`> Paths below (\`.sdk/…\`) are relative to the **project root** — one level up
|
|
50
|
+
> from this \`${lang}/\` directory.
|
|
51
|
+
|
|
52
|
+
` : 'external' === place ? `> Paths below (\`.sdk/…\`) are relative to the SDK project that generates
|
|
53
|
+
> this package.
|
|
54
|
+
|
|
55
|
+
` : ''
|
|
56
|
+
|
|
42
57
|
File({ name: 'AGENTS.md' }, () => {
|
|
43
58
|
Content(`# ${Name} ${title} — Agent Guide
|
|
44
59
|
|
|
45
60
|
${surface
|
|
46
|
-
? surface + '\n\nGenerated from the shared model
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
> from this \`${lang}/\` directory.
|
|
61
|
+
? surface + '\n\nGenerated from the shared model' +
|
|
62
|
+
('' === guide ? '.' : `; see the [project guide](${guide}) for the full workflow.`)
|
|
63
|
+
: `The ${title} client for the ${apiName(model)} API. This directory is **generated** — do not edit it by hand; change the model/template/component in \`.sdk/\` and regenerate.` +
|
|
64
|
+
('' === guide ? '' : ` See the [project guide](${guide}) for the full workflow and the aontu model language.`)}
|
|
51
65
|
|
|
52
|
-
## Regenerate this target
|
|
66
|
+
${pathNote}## Regenerate this target
|
|
53
67
|
|
|
54
|
-
\`\`\`bash
|
|
55
|
-
cd
|
|
56
|
-
npm run
|
|
57
|
-
npm run generate # refreshes this ${lang}/ directory
|
|
68
|
+
${'' === sdk ? 'From the SDK project\'s `.sdk/` directory:\n\n' : ''}\`\`\`bash
|
|
69
|
+
${'' === sdk ? '' : 'cd ' + sdk + '\n'}npm run build # only if you changed a component
|
|
70
|
+
npm run generate # refreshes this ${'folder' === place ? lang + '/ directory' : 'target'}
|
|
58
71
|
\`\`\`
|
|
59
72
|
|
|
60
73
|
${regenerationStatement()}
|
|
61
74
|
|
|
62
75
|
Then build and test the generated output:
|
|
63
76
|
|
|
64
|
-
${langCommandsBlock(lang)}
|
|
77
|
+
${langCommandsBlock(lang, model)}
|
|
65
78
|
|
|
66
79
|
## What generates this target
|
|
67
80
|
|
|
@@ -130,8 +143,8 @@ listed here: customise that and regenerate.`}
|
|
|
130
143
|
|
|
131
144
|
Content(`---
|
|
132
145
|
|
|
133
|
-
Generated by [@voxgig/sdkgen](https://github.com/voxgig/sdkgen)
|
|
134
|
-
[project guide](
|
|
146
|
+
Generated by [@voxgig/sdkgen](https://github.com/voxgig/sdkgen).${'' === guide ? '' : ` See the
|
|
147
|
+
[project guide](${guide}).`}
|
|
135
148
|
`)
|
|
136
149
|
})
|
|
137
150
|
|
|
@@ -3,6 +3,8 @@ import { featureApplies } from '../helpers/applicability'
|
|
|
3
3
|
import { fact } from '../helpers/facts'
|
|
4
4
|
import { findFeatureSources } from '../helpers/featureSource'
|
|
5
5
|
import { copyMode, MERGE } from '../helpers/copymerge'
|
|
6
|
+
import { originName } from '../helpers/packageMeta'
|
|
7
|
+
import { definitionName } from '../helpers/text'
|
|
6
8
|
|
|
7
9
|
import { each } from 'jostraca'
|
|
8
10
|
|
|
@@ -36,16 +38,17 @@ const LANG_CMD: Record<string, LangCmd> = {
|
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
// Keyed by origin, so an alias reads its origin's row.
|
|
42
|
+
function langCmd(name: string, model?: any): LangCmd {
|
|
43
|
+
return LANG_CMD[null == model ? name : originName(model, name)] || { viaMake: true }
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
|
|
44
47
|
// A fenced shell block of the per-target build/test commands, run **in the
|
|
45
48
|
// target directory** (the per-language guide already lives there). Prefers the
|
|
46
49
|
// target's Makefile recipes (`make build` / `make test`).
|
|
47
|
-
function langCommandsBlock(name: string): string {
|
|
48
|
-
const c = langCmd(name)
|
|
50
|
+
function langCommandsBlock(name: string, model?: any): string {
|
|
51
|
+
const c = langCmd(name, model)
|
|
49
52
|
const lines: string[] = []
|
|
50
53
|
if (c.install) lines.push(c.install)
|
|
51
54
|
if (c.viaMake) {
|
|
@@ -59,7 +62,10 @@ function langCommandsBlock(name: string): string {
|
|
|
59
62
|
if (0 === lines.length) {
|
|
60
63
|
return `Build and test with \`${name}\`'s standard toolchain.\n`
|
|
61
64
|
}
|
|
62
|
-
|
|
65
|
+
const node = model?.main?.[KIT]?.target?.[name]
|
|
66
|
+
const place = null == node ? 'folder' : fact(node, 'place')
|
|
67
|
+
const dir = 'folder' === place ? name + '/' : 'root' === place ? 'the project root' : "this package's root"
|
|
68
|
+
return '```bash\n# in this target directory (' + dir + '):\n' + lines.join('\n') + '\n```\n'
|
|
63
69
|
}
|
|
64
70
|
|
|
65
71
|
|
|
@@ -103,8 +109,8 @@ function featureHooks(feature: any): string[] {
|
|
|
103
109
|
|
|
104
110
|
|
|
105
111
|
function activeTargets(model: any): any[] {
|
|
106
|
-
const
|
|
107
|
-
return
|
|
112
|
+
const kit = model.main[KIT]
|
|
113
|
+
return fact(kit, 'active').map((name: string) => kit.target[name])
|
|
108
114
|
}
|
|
109
115
|
|
|
110
116
|
// With a target, also drops features that do not APPLY to it — a guide
|
|
@@ -148,10 +154,15 @@ into the edited copies.`
|
|
|
148
154
|
|
|
149
155
|
|
|
150
156
|
function workflowSection(model: any): string {
|
|
157
|
+
const dirs = activeTargets(model).filter((t: any) => 'folder' === fact(t, 'place'))
|
|
158
|
+
.map((t: any) => '\`' + t.name + '/\`')
|
|
159
|
+
const output = 0 === dirs.length ? 'The generated output is **build output** — never edit it by' :
|
|
160
|
+
1 === dirs.length ? 'The generated\ndirectory (' + dirs[0] + ') is **build output** — never edit it by' :
|
|
161
|
+
'The generated language\ndirectories (' + dirs.slice(0, 2).join(', ') + (2 < dirs.length ? ', …' : '') +
|
|
162
|
+
') are **build output** — never edit them by'
|
|
151
163
|
return `## Generating and updating the SDK
|
|
152
164
|
|
|
153
|
-
All generation is driven from the \`.sdk/\` directory.
|
|
154
|
-
directories (\`ts/\`, \`go/\`, …) are **build output** — never edit them by
|
|
165
|
+
All generation is driven from the \`.sdk/\` directory. ${output}
|
|
155
166
|
hand; fix the model, a template, or a component and regenerate.
|
|
156
167
|
|
|
157
168
|
\`\`\`bash
|
|
@@ -260,12 +271,12 @@ deps live in \`.sdk/model/target/<lang>.aontu\`; features in
|
|
|
260
271
|
}
|
|
261
272
|
|
|
262
273
|
|
|
263
|
-
function aontuSection(): string {
|
|
274
|
+
function aontuSection(model: any): string {
|
|
264
275
|
return `## The model language (aontu, \`.aontu\` files)
|
|
265
276
|
|
|
266
277
|
The model is one structured object assembled by **aontu** (a unification
|
|
267
278
|
engine) from three sources: the API model (entities/operations, from the
|
|
268
|
-
|
|
279
|
+
${definitionName(fact(model.main[KIT], 'definitionKind'))} via \`@voxgig/apidef\`), the base schema, and the target/feature
|
|
269
280
|
definitions in \`.sdk/model/\`. An \`.aontu\` file is a relaxed JSON (jsonic
|
|
270
281
|
syntax) with unification semantics:
|
|
271
282
|
|
|
@@ -33,6 +33,14 @@ const AgentGuideFeature = cmp(function AgentGuideFeature(props: any) {
|
|
|
33
33
|
const defaultOn = fact(feature, 'on')
|
|
34
34
|
const ops = generatedOps(ctx$.model)
|
|
35
35
|
|
|
36
|
+
const place = fact(target, 'place')
|
|
37
|
+
const guide = fact(target, 'link').agents
|
|
38
|
+
const root = 'folder' === place ? '../../../../' : 'root' === place ? '../../../' :
|
|
39
|
+
null == ctx$.sdkrelpath ? null : '../../../' + ctx$.sdkrelpath + '/'
|
|
40
|
+
const where = 'folder' === place ? 'the **project root** — four levels up from here' :
|
|
41
|
+
'root' === place ? 'the **project root** — three levels up from here' :
|
|
42
|
+
'the SDK project that generates this package'
|
|
43
|
+
|
|
36
44
|
Folder({ name: 'src/feature/' + name }, () => {
|
|
37
45
|
|
|
38
46
|
File({ name: 'AGENTS.md' }, () => {
|
|
@@ -44,7 +52,7 @@ A **feature** is a pipeline extension: an object of hooks that fire at named
|
|
|
44
52
|
stages of every entity operation${0 < ops.length ? ' (' + ops.join(', ') + ')' : ''} and of
|
|
45
53
|
the SDK/entity lifecycle. Features are how you inspect or modify the request
|
|
46
54
|
pipeline without forking the SDK. This directory holds the **generated**
|
|
47
|
-
runtime for the \`${name}\` feature in the ${target
|
|
55
|
+
runtime for the \`${name}\` feature in the ${fact(target, 'title')} target — do
|
|
48
56
|
not edit it by hand; change its template/model in \`.sdk/\` and regenerate.
|
|
49
57
|
|
|
50
58
|
Active by default: **${defaultOn ? 'yes' : 'no'}** (\`config.options.active\`
|
|
@@ -73,7 +81,7 @@ later feature can override an earlier one.
|
|
|
73
81
|
| Registered in | \`.sdk/model/feature/feature-index.aontu\` (\`@"${name}.aontu"\`) |
|
|
74
82
|
| Runtime template | \`.sdk/tm/${lang}/src/feature/${name}/\` (copied here on \`generate\`; \`FEATURE_Name\`/\`FEATURE_VERSION\` substituted) |
|
|
75
83
|
|
|
76
|
-
(Paths are relative to
|
|
84
|
+
(Paths are relative to ${where}.)
|
|
77
85
|
|
|
78
86
|
## Customising this feature
|
|
79
87
|
|
|
@@ -84,13 +92,14 @@ later feature can override an earlier one.
|
|
|
84
92
|
- **Behaviour**: edit the runtime template under
|
|
85
93
|
\`.sdk/tm/${lang}/src/feature/${name}/\`, then regenerate.
|
|
86
94
|
|
|
87
|
-
After any change:
|
|
95
|
+
After any change: \`${null == root ? '' : 'cd ' + root + '.sdk && '}npm run generate\`${null == root ?
|
|
96
|
+
' in the SDK project\'s `.sdk/`' : ''} (add
|
|
88
97
|
\`npm run build\` first if you changed a component).
|
|
89
98
|
${regenerationStatement()}
|
|
90
99
|
|
|
91
|
-
To author a **new** feature, copy this one's model + template shape — see
|
|
92
|
-
[project guide](
|
|
93
|
-
[${target
|
|
100
|
+
To author a **new** feature, copy this one's model + template shape — see ${'' === guide ? '' :
|
|
101
|
+
`the\n[project guide](../../../${guide}) and `}the
|
|
102
|
+
[${fact(target, 'title')} guide](../../../AGENTS.md).
|
|
94
103
|
`)
|
|
95
104
|
})
|
|
96
105
|
|
package/src/cmp/AgentGuideTop.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { names, Content, File } from 'jostraca'
|
|
3
3
|
import { cmp } from '../helpers/component'
|
|
4
4
|
import { fact } from '../helpers/facts'
|
|
5
|
+
import { surfaceOf } from '../helpers/surface'
|
|
5
6
|
|
|
6
7
|
import {
|
|
7
8
|
activeTargets,
|
|
@@ -24,12 +25,18 @@ const AgentGuideTopIntro = cmp(function AgentGuideTopIntro(props: any) {
|
|
|
24
25
|
const featureGuides = targets.some((t: any) =>
|
|
25
26
|
fact(t, 'phase').agentguide && writesFeatureGuides(model, t))
|
|
26
27
|
|
|
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'
|
|
34
|
+
|
|
27
35
|
Content(`# ${Name} SDK — Agent Guide
|
|
28
36
|
|
|
29
|
-
This is a **generated**
|
|
30
|
-
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)
|
|
31
38
|
from an API model; the generator, model, templates, and components all live in
|
|
32
|
-
\`.sdk/\`. Treat
|
|
39
|
+
\`.sdk/\`. Treat ${output} as build output — change the model,
|
|
33
40
|
a template, or a component and regenerate.
|
|
34
41
|
|
|
35
42
|
There are companion guides deeper in the tree: one per language
|
|
@@ -43,7 +50,7 @@ feature in its own directory (\`<lang>/src/feature/<name>/AGENTS.md\`)` : ''}.
|
|
|
43
50
|
|
|
44
51
|
|
|
45
52
|
const AgentGuideTopTargets = cmp(function AgentGuideTopTargets(props: any) {
|
|
46
|
-
const { targets } = props.s
|
|
53
|
+
const { model, targets } = props.s
|
|
47
54
|
|
|
48
55
|
if (0 < targets.length) {
|
|
49
56
|
Content(`**Targets** (${targets.length}):
|
|
@@ -52,8 +59,10 @@ const AgentGuideTopTargets = cmp(function AgentGuideTopTargets(props: any) {
|
|
|
52
59
|
| --- | --- | --- |
|
|
53
60
|
`)
|
|
54
61
|
targets.forEach((t: any) => {
|
|
55
|
-
const note = langCmd(t.name).note ? ' — ' + langCmd(t.name).note : ''
|
|
56
|
-
|
|
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} |
|
|
57
66
|
`)
|
|
58
67
|
})
|
|
59
68
|
Content(`
|
|
@@ -136,8 +145,8 @@ const AgentGuideTopCustomise = cmp(function AgentGuideTopCustomise() {
|
|
|
136
145
|
})
|
|
137
146
|
|
|
138
147
|
|
|
139
|
-
const AgentGuideTopAontu = cmp(function AgentGuideTopAontu() {
|
|
140
|
-
Content(aontuSection())
|
|
148
|
+
const AgentGuideTopAontu = cmp(function AgentGuideTopAontu(props: any) {
|
|
149
|
+
Content(aontuSection(props.s.model))
|
|
141
150
|
})
|
|
142
151
|
|
|
143
152
|
|