@voxgig/sdkgen 1.3.10 → 1.3.12

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 CHANGED
@@ -8,7 +8,7 @@ const { Shape, One } = require('shape')
8
8
 
9
9
  const { SdkGen } = require('../dist/sdkgen.js')
10
10
 
11
- const VERSION = '1.3.10'
11
+ const VERSION = '1.3.12'
12
12
  const KONSOLE = console
13
13
 
14
14
 
@@ -1 +1 @@
1
- {"root":["../src/sdkgen.ts","../src/types.ts","../src/utility.ts","../src/action/action.ts","../src/action/feature.ts","../src/action/target.ts","../src/cmp/agentguide.ts","../src/cmp/agentguidecontent.ts","../src/cmp/agentguidefeature.ts","../src/cmp/agentguidetop.ts","../src/cmp/changelog.ts","../src/cmp/deploy.ts","../src/cmp/entity.ts","../src/cmp/feature.ts","../src/cmp/featurehook.ts","../src/cmp/license.ts","../src/cmp/main.ts","../src/cmp/readme.ts","../src/cmp/readmeentity.ts","../src/cmp/readmeerrors.ts","../src/cmp/readmeexplanation.ts","../src/cmp/readmehowto.ts","../src/cmp/readmeinstall.ts","../src/cmp/readmeintro.ts","../src/cmp/readmemodel.ts","../src/cmp/readmeoptions.ts","../src/cmp/readmequick.ts","../src/cmp/readmeref.ts","../src/cmp/readmetop.ts","../src/cmp/security.ts","../src/cmp/test.ts","../src/helpers/buildidnames.ts","../src/helpers/canontype.ts","../src/helpers/collectdeps.ts","../src/helpers/getmatchentries.ts","../src/helpers/naming.ts","../src/helpers/opexample.ts","../src/helpers/opshape.ts","../src/helpers/packagemeta.ts"],"version":"6.0.3"}
1
+ {"root":["../src/sdkgen.ts","../src/types.ts","../src/utility.ts","../src/action/action.ts","../src/action/feature.ts","../src/action/target.ts","../src/cmp/AgentGuide.ts","../src/cmp/AgentGuideContent.ts","../src/cmp/AgentGuideFeature.ts","../src/cmp/AgentGuideTop.ts","../src/cmp/Changelog.ts","../src/cmp/Deploy.ts","../src/cmp/Entity.ts","../src/cmp/Feature.ts","../src/cmp/FeatureHook.ts","../src/cmp/License.ts","../src/cmp/Main.ts","../src/cmp/Readme.ts","../src/cmp/ReadmeEntity.ts","../src/cmp/ReadmeErrors.ts","../src/cmp/ReadmeExplanation.ts","../src/cmp/ReadmeHowto.ts","../src/cmp/ReadmeInstall.ts","../src/cmp/ReadmeIntro.ts","../src/cmp/ReadmeModel.ts","../src/cmp/ReadmeOptions.ts","../src/cmp/ReadmeQuick.ts","../src/cmp/ReadmeRef.ts","../src/cmp/ReadmeTop.ts","../src/cmp/Security.ts","../src/cmp/Test.ts","../src/helpers/buildIdNames.ts","../src/helpers/canonType.ts","../src/helpers/collectDeps.ts","../src/helpers/getMatchEntries.ts","../src/helpers/naming.ts","../src/helpers/opExample.ts","../src/helpers/opShape.ts","../src/helpers/packageMeta.ts"],"version":"6.0.3"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voxgig/sdkgen",
3
- "version": "1.3.10",
3
+ "version": "1.3.12",
4
4
  "main": "dist/sdkgen.js",
5
5
  "type": "commonjs",
6
6
  "types": "dist/sdkgen.d.ts",
@@ -19,7 +19,7 @@
19
19
  // <Name>RemoveMatch.
20
20
 
21
21
  import {
22
- cmp, each,
22
+ cmp, each, names,
23
23
  File, Content,
24
24
  } from '@voxgig/sdkgen'
25
25
 
@@ -139,6 +139,10 @@ const EntityTypes = cmp(function EntityTypes(props: any) {
139
139
 
140
140
  const entity = getModelPath(model, `main.${KIT}.entity`)
141
141
  const entityList = each(entity).filter((e: any) => e.active !== false)
142
+ // Derive the PascalCase Name up-front — it is set LAZILY by names(), so an
143
+ // entity not yet named (e.g. a fieldless placeholder) would otherwise read
144
+ // `Name = undefined` below. Parity with the go emitter's fix.
145
+ entityList.forEach((e: any) => { if (null == e.Name) names(e, e.name) })
142
146
 
143
147
  File({ name: model.const.Name + 'Types.' + target.ext }, () => {
144
148
 
@@ -27,7 +27,7 @@
27
27
  // with every field optional (Go's analog of TS `Partial<Name>`).
28
28
 
29
29
  import {
30
- cmp, each,
30
+ cmp, each, names,
31
31
  File, Content, Folder,
32
32
  } from '@voxgig/sdkgen'
33
33
 
@@ -77,10 +77,17 @@ const EntityTypes = cmp(function EntityTypes(props: any) {
77
77
  const { model } = props.ctx$
78
78
 
79
79
  const entity = getModelPath(model, `main.${KIT}.entity`)
80
- // Emit for every entity that gets an entity file. Main_go.ts iterates
81
- // entities WITHOUT an `active` filter, so a struct is required for each so
82
- // the typed accessors in every *_entity.go resolve at compile time.
83
- const entityList = each(entity).filter((e: any) => e && null != e.Name)
80
+ // Emit for every entity that gets an entity file. Main_go.ts / Entity_go.ts
81
+ // iterate entities WITHOUT an `active` filter and reference the typed data
82
+ // type `<Name>` in every *_entity.go, so a struct is required for each or the
83
+ // package won't compile. Filter on `name` (always present), NOT `Name`:
84
+ // `Name` is the PascalCase variant derived LAZILY by `names()`, so filtering
85
+ // on it silently drops any entity whose `Name` hasn't been derived yet by an
86
+ // earlier component (order-dependent — e.g. fieldless placeholder entities),
87
+ // producing `undefined: <Name>` in the generated Go. Derive `Name` here so
88
+ // the struct set is deterministic and matches the *_entity.go set.
89
+ const entityList = each(entity).filter((e: any) => e && null != e.name)
90
+ entityList.forEach((e: any) => { if (null == e.Name) names(e, e.name) })
84
91
 
85
92
  Folder({ name: 'entity' }, () => {
86
93
 
@@ -44,8 +44,10 @@ const Main = cmp(function Main(props: any) {
44
44
 
45
45
  const FRAGMENT = Path.normalize(__dirname + '/../../../src/cmp/go-cli/fragment')
46
46
 
47
- // .gitignore — the compiled binary lands at /<modulename>-cli; ignore it.
48
- File({ name: '.gitignore' }, () => Content(`/${model.name}-cli
47
+ // .gitignore — build output (dist/) and any stray top-level binaries.
48
+ File({ name: '.gitignore' }, () => Content(`/dist/
49
+ /${model.name}-cli
50
+ /go-cli
49
51
  `))
50
52
 
51
53
  // README.md — usage guide for the AQL-driven CLI.
@@ -163,6 +165,37 @@ replace ${sdkModule} => ../go
163
165
  // AQL_ENG_VERSION above.
164
166
  File({ name: 'go.sum' }, () => Content(AQL_ENG_GOSUM))
165
167
 
168
+ // Makefile — `make build` for the current machine, `make build-all` to
169
+ // cross-compile for the three desktop OSes (linux, darwin, windows) on
170
+ // amd64 + arm64. Every binary is named ${model.name}-cli (+ .exe on windows)
171
+ // inside its own dist/<os>-<arch>/ folder — no loose top-level binary.
172
+ File({ name: 'Makefile' }, () => Content(`# ${model.name}-cli build. GENERATED by @voxgig/sdkgen go-cli target.
173
+ BINARY := ${model.name}-cli
174
+ DIST := dist
175
+ GOOS := $(shell go env GOOS)
176
+ GOARCH := $(shell go env GOARCH)
177
+ EXT := $(if $(filter windows,$(GOOS)),.exe,)
178
+
179
+ .PHONY: build build-all clean
180
+
181
+ # Native build for the current machine -> dist/<os>-<arch>/${model.name}-cli.
182
+ build:
183
+ \tgo build -o $(DIST)/$(GOOS)-$(GOARCH)/$(BINARY)$(EXT) .
184
+
185
+ # Cross-compiled release binaries: three desktop OSes x amd64/arm64, each named
186
+ # ${model.name}-cli (+ .exe on windows) inside its own dist/<os>-<arch>/ folder.
187
+ build-all: clean
188
+ \tGOOS=linux GOARCH=amd64 go build -o $(DIST)/linux-amd64/$(BINARY) .
189
+ \tGOOS=linux GOARCH=arm64 go build -o $(DIST)/linux-arm64/$(BINARY) .
190
+ \tGOOS=darwin GOARCH=amd64 go build -o $(DIST)/darwin-amd64/$(BINARY) .
191
+ \tGOOS=darwin GOARCH=arm64 go build -o $(DIST)/darwin-arm64/$(BINARY) .
192
+ \tGOOS=windows GOARCH=amd64 go build -o $(DIST)/windows-amd64/$(BINARY).exe .
193
+ \tGOOS=windows GOARCH=arm64 go build -o $(DIST)/windows-arm64/$(BINARY).exe .
194
+
195
+ clean:
196
+ \trm -rf $(DIST) $(BINARY) go-cli
197
+ `))
198
+
166
199
  // main.go — produced from fragment/main.fragment.go with two Slots
167
200
  // for the prompt label and the entity help line.
168
201
  File({ name: 'main.go' }, () => {
@@ -172,6 +205,10 @@ replace ${sdkModule} => ../go
172
205
  replace: {
173
206
  ...props.ctx$.stdrep,
174
207
  GOMODULE: sdkModule,
208
+ // Env vars the CLI reads: <PROJ>_APIKEY for the key and <PROJ>_BASE
209
+ // to override the API base URL (both injectable by a secrets vault).
210
+ APIKEYENVVAR: String(model.name).toUpperCase().replace(/[^A-Z0-9]/g, '_') + '_APIKEY',
211
+ BASEENVVAR: String(model.name).toUpperCase().replace(/[^A-Z0-9]/g, '_') + '_BASE',
175
212
  },
176
213
  },
177
214
  () => {
@@ -27,7 +27,20 @@ func main() {
27
27
  }
28
28
 
29
29
  func run(args []string, in io.Reader, out, errOut io.Writer) int {
30
- client := sdk.NewProjectNameSDK(nil)
30
+ // Configure from the environment: APIKEYENVVAR carries the API key and
31
+ // BASEENVVAR optionally overrides the API base URL (e.g. production).
32
+ // Both injectable by a secrets vault. Unset -> nil config defaults.
33
+ var opts map[string]any
34
+ if apikey := os.Getenv("APIKEYENVVAR"); apikey != "" {
35
+ opts = map[string]any{"apikey": apikey}
36
+ }
37
+ if base := os.Getenv("BASEENVVAR"); base != "" {
38
+ if opts == nil {
39
+ opts = map[string]any{}
40
+ }
41
+ opts["base"] = base
42
+ }
43
+ client := sdk.NewProjectNameSDK(opts)
31
44
 
32
45
  r, err := eng.NewRegistry()
33
46
  if err != nil {
@@ -64,8 +64,10 @@ const Main = cmp(function Main(props: any) {
64
64
 
65
65
  const FRAGMENT = Path.normalize(__dirname + '/../../../src/cmp/go-mcp/fragment')
66
66
 
67
- // .gitignore — the compiled binary lands at /<modulename>-mcp; ignore it.
68
- File({ name: '.gitignore' }, () => Content(`/${model.name}-mcp
67
+ // .gitignore — build output (dist/) and any stray top-level binaries.
68
+ File({ name: '.gitignore' }, () => Content(`/dist/
69
+ /${model.name}-mcp
70
+ /go-mcp
69
71
  `))
70
72
 
71
73
  // README.md — usage guide for the MCP server.
@@ -170,6 +172,37 @@ replace ${sdkModule} => ../go
170
172
  // MCP_GO_SDK_VERSION above.
171
173
  File({ name: 'go.sum' }, () => Content(MCP_GO_SDK_GOSUM))
172
174
 
175
+ // Makefile — `make build` for the current machine, `make build-all` to
176
+ // cross-compile for the three desktop OSes (linux, darwin, windows) on
177
+ // amd64 + arm64. Every binary is named ${model.name}-mcp (+ .exe on windows)
178
+ // inside its own dist/<os>-<arch>/ folder — no loose top-level binary.
179
+ File({ name: 'Makefile' }, () => Content(`# ${model.name}-mcp build. GENERATED by @voxgig/sdkgen go-mcp target.
180
+ BINARY := ${model.name}-mcp
181
+ DIST := dist
182
+ GOOS := $(shell go env GOOS)
183
+ GOARCH := $(shell go env GOARCH)
184
+ EXT := $(if $(filter windows,$(GOOS)),.exe,)
185
+
186
+ .PHONY: build build-all clean
187
+
188
+ # Native build for the current machine -> dist/<os>-<arch>/${model.name}-mcp.
189
+ build:
190
+ \tgo build -o $(DIST)/$(GOOS)-$(GOARCH)/$(BINARY)$(EXT) .
191
+
192
+ # Cross-compiled release binaries: three desktop OSes x amd64/arm64, each named
193
+ # ${model.name}-mcp (+ .exe on windows) inside its own dist/<os>-<arch>/ folder.
194
+ build-all: clean
195
+ \tGOOS=linux GOARCH=amd64 go build -o $(DIST)/linux-amd64/$(BINARY) .
196
+ \tGOOS=linux GOARCH=arm64 go build -o $(DIST)/linux-arm64/$(BINARY) .
197
+ \tGOOS=darwin GOARCH=amd64 go build -o $(DIST)/darwin-amd64/$(BINARY) .
198
+ \tGOOS=darwin GOARCH=arm64 go build -o $(DIST)/darwin-arm64/$(BINARY) .
199
+ \tGOOS=windows GOARCH=amd64 go build -o $(DIST)/windows-amd64/$(BINARY).exe .
200
+ \tGOOS=windows GOARCH=arm64 go build -o $(DIST)/windows-arm64/$(BINARY).exe .
201
+
202
+ clean:
203
+ \trm -rf $(DIST) $(BINARY) go-mcp
204
+ `))
205
+
173
206
  // main.go — produced from fragment/main.fragment.go with one Slot
174
207
  // for the MCP server's announced name.
175
208
  File({ name: 'main.go' }, () => {
@@ -179,6 +212,10 @@ replace ${sdkModule} => ../go
179
212
  replace: {
180
213
  ...props.ctx$.stdrep,
181
214
  GOMODULE: sdkModule,
215
+ // Env vars the server reads: <PROJ>_APIKEY for the key and <PROJ>_BASE
216
+ // to override the API base URL (both injectable by a secrets vault).
217
+ APIKEYENVVAR: String(model.name).toUpperCase().replace(/[^A-Z0-9]/g, '_') + '_APIKEY',
218
+ BASEENVVAR: String(model.name).toUpperCase().replace(/[^A-Z0-9]/g, '_') + '_BASE',
182
219
  },
183
220
  },
184
221
  () => {
@@ -37,7 +37,20 @@ func main() {
37
37
  addr := flag.String("addr", ":8080", "listen address for http transport")
38
38
  flag.Parse()
39
39
 
40
- client := sdk.NewProjectNameSDK(nil)
40
+ // Configure from the environment: APIKEYENVVAR carries the API key and
41
+ // BASEENVVAR optionally overrides the API base URL (e.g. production).
42
+ // Both injectable by a secrets vault. Unset -> nil config defaults.
43
+ var opts map[string]any
44
+ if apikey := os.Getenv("APIKEYENVVAR"); apikey != "" {
45
+ opts = map[string]any{"apikey": apikey}
46
+ }
47
+ if base := os.Getenv("BASEENVVAR"); base != "" {
48
+ if opts == nil {
49
+ opts = map[string]any{}
50
+ }
51
+ opts["base"] = base
52
+ }
53
+ client := sdk.NewProjectNameSDK(opts)
41
54
  server := mcp.NewServer(
42
55
  &mcp.Implementation{
43
56
  Name: "// <[SLOT:serverName]>",
@@ -19,7 +19,7 @@
19
19
  // <Name>ListMatch, <Name>CreateData, <Name>UpdateData, <Name>RemoveMatch).
20
20
 
21
21
  import {
22
- cmp, each,
22
+ cmp, each, names,
23
23
  File, Content,
24
24
  } from '@voxgig/sdkgen'
25
25
 
@@ -46,6 +46,10 @@ const EntityTypes = cmp(function EntityTypes(props: any) {
46
46
 
47
47
  const entity = getModelPath(model, `main.${KIT}.entity`)
48
48
  const entityList = each(entity).filter((e: any) => e.active !== false)
49
+ // Derive the PascalCase Name up-front — it is set LAZILY by names(), so an
50
+ // entity not yet named (e.g. a fieldless placeholder) would otherwise read
51
+ // `Name = undefined` below. Parity with the go emitter's fix.
52
+ entityList.forEach((e: any) => { if (null == e.Name) names(e, e.name) })
49
53
 
50
54
  File({ name: model.const.Name + 'Types.' + LANG }, () => {
51
55
 
@@ -17,7 +17,7 @@
17
17
  // ---@param / ---@return.
18
18
 
19
19
  import {
20
- cmp, each,
20
+ cmp, each, names,
21
21
  File, Content,
22
22
  } from '@voxgig/sdkgen'
23
23
 
@@ -45,6 +45,10 @@ const EntityTypes = cmp(function EntityTypes(props: any) {
45
45
 
46
46
  const entity = getModelPath(model, `main.${KIT}.entity`)
47
47
  const entityList = each(entity).filter((e: any) => e.active !== false)
48
+ // Derive the PascalCase Name up-front — it is set LAZILY by names(), so an
49
+ // entity not yet named (e.g. a fieldless placeholder) would otherwise read
50
+ // `Name = undefined` below. Parity with the go emitter's fix.
51
+ entityList.forEach((e: any) => { if (null == e.Name) names(e, e.name) })
48
52
 
49
53
  File({ name: model.name + '_types.' + (target.ext || LANG) }, () => {
50
54
 
@@ -25,7 +25,7 @@
25
25
  // Package_php.ts) so `new <Name>()` / type references resolve globally.
26
26
 
27
27
  import {
28
- cmp, each,
28
+ cmp, each, names,
29
29
  File, Content, Folder,
30
30
  } from '@voxgig/sdkgen'
31
31
 
@@ -68,6 +68,10 @@ const EntityTypes = cmp(function EntityTypes(props: any) {
68
68
 
69
69
  const entity = getModelPath(model, `main.${KIT}.entity`)
70
70
  const entityList = each(entity).filter((e: any) => e.active !== false)
71
+ // Derive the PascalCase Name up-front — it is set LAZILY by names(), so an
72
+ // entity not yet named (e.g. a fieldless placeholder) would otherwise read
73
+ // `Name = undefined` below. Parity with the go emitter's fix.
74
+ entityList.forEach((e: any) => { if (null == e.Name) names(e, e.name) })
71
75
 
72
76
  Folder({ name: 'types' }, () => {
73
77
 
@@ -32,7 +32,7 @@
32
32
  // <Name>RemoveMatch.
33
33
 
34
34
  import {
35
- cmp, each,
35
+ cmp, each, names,
36
36
  File, Content,
37
37
  } from '@voxgig/sdkgen'
38
38
 
@@ -123,6 +123,10 @@ const EntityTypes = cmp(function EntityTypes(props: any) {
123
123
 
124
124
  const entity = getModelPath(model, `main.${KIT}.entity`)
125
125
  const entityList = each(entity).filter((e: any) => e.active !== false)
126
+ // Derive the PascalCase Name up-front — it is set LAZILY by names(), so an
127
+ // entity not yet named (e.g. a fieldless placeholder) would otherwise read
128
+ // `Name = undefined` below. Parity with the go emitter's fix.
129
+ entityList.forEach((e: any) => { if (null == e.Name) names(e, e.name) })
126
130
 
127
131
  File({ name: model.const.Name.toLowerCase() + '_types.' + ext }, () => {
128
132
 
@@ -23,7 +23,7 @@
23
23
  // The file is required by the main SDK module so these constants are always loaded.
24
24
 
25
25
  import {
26
- cmp, each,
26
+ cmp, each, names,
27
27
  File, Content,
28
28
  } from '@voxgig/sdkgen'
29
29
 
@@ -81,6 +81,10 @@ const EntityTypes = cmp(function EntityTypes(props: any) {
81
81
 
82
82
  const entity = getModelPath(model, `main.${KIT}.entity`)
83
83
  const entityList = each(entity).filter((e: any) => e.active !== false)
84
+ // Derive the PascalCase Name up-front — it is set LAZILY by names(), so an
85
+ // entity not yet named (e.g. a fieldless placeholder) would otherwise read
86
+ // `Name = undefined` below. Parity with the go emitter's fix.
87
+ entityList.forEach((e: any) => { if (null == e.Name) names(e, e.name) })
84
88
 
85
89
  File({ name: model.const.Name + '_types.' + LANG }, () => {
86
90
 
@@ -17,7 +17,7 @@
17
17
  // <X> op fragments + entity accessor.
18
18
 
19
19
  import {
20
- cmp, each,
20
+ cmp, each, names,
21
21
  File, Content,
22
22
  } from '@voxgig/sdkgen'
23
23
 
@@ -43,6 +43,10 @@ const EntityTypes = cmp(function EntityTypes(props: any) {
43
43
 
44
44
  const entity = getModelPath(model, `main.${KIT}.entity`)
45
45
  const entityList = each(entity).filter((e: any) => e.active !== false)
46
+ // Derive the PascalCase Name up-front — it is set LAZILY by names(), so an
47
+ // entity not yet named (e.g. a fieldless placeholder) would otherwise read
48
+ // `Name = undefined` below. Parity with the go emitter's fix.
49
+ entityList.forEach((e: any) => { if (null == e.Name) names(e, e.name) })
46
50
 
47
51
  File({ name: model.const.Name + 'Types.' + LANG }, () => {
48
52