@voxgig/sdkgen 1.3.10 → 1.3.11

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.11'
12
12
  const KONSOLE = console
13
13
 
14
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voxgig/sdkgen",
3
- "version": "1.3.10",
3
+ "version": "1.3.11",
4
4
  "main": "dist/sdkgen.js",
5
5
  "type": "commonjs",
6
6
  "types": "dist/sdkgen.d.ts",
@@ -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]>",