workspai 0.43.0 → 0.43.1
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/README.md +3 -3
- package/contracts/extension-cli-compatibility.v1.json +1 -1
- package/dist/{artifact-remediation-plan-5GJWPPRS.js → artifact-remediation-plan-244S5K6I.js} +3 -3
- package/dist/autopilot-release-45YVOBQO.js +1 -0
- package/dist/chunk-3QVTWKUI.js +4 -0
- package/dist/{chunk-T6OR6YOI.js → chunk-7UZVOYF5.js} +1 -1
- package/dist/{chunk-CVTCPPEF.js → chunk-AMDKXXLP.js} +1 -1
- package/dist/{chunk-EWYYLJQY.js → chunk-CDE4Q77U.js} +1 -1
- package/dist/{chunk-AFSZHLQT.js → chunk-DOCPUNWS.js} +1 -1
- package/dist/{chunk-OJEWQO3Z.js → chunk-EMTQ6OKI.js} +17 -17
- package/dist/{chunk-RE773WOX.js → chunk-FDDDQMJ2.js} +5 -5
- package/dist/{chunk-5SWNSJGW.js → chunk-FHSMY75W.js} +1 -1
- package/dist/chunk-FM7GMFZA.js +2 -0
- package/dist/{chunk-54XJNLYC.js → chunk-HV5ZFXAZ.js} +1 -1
- package/dist/{chunk-LO4C4VXR.js → chunk-LRW2SAGL.js} +1 -1
- package/dist/{chunk-PI5KUXDA.js → chunk-LTWYYP6E.js} +1 -1
- package/dist/{chunk-VRDF2J46.js → chunk-ONU457VN.js} +17 -17
- package/dist/{chunk-LUP4U6EE.js → chunk-P424XYHP.js} +1 -1
- package/dist/{chunk-LPZFK3Y6.js → chunk-PPHTYJ7G.js} +61 -61
- package/dist/{chunk-XEJD4KCV.js → chunk-TH5Y3EMA.js} +1 -1
- package/dist/chunk-TQEMLBAG.js +1 -0
- package/dist/{chunk-3KXW53QI.js → chunk-U6AXYUQY.js} +1 -1
- package/dist/{chunk-AAKUNWPR.js → chunk-UQKCCWUL.js} +43 -43
- package/dist/{chunk-VZKSNUEE.js → chunk-XNGANEXM.js} +1 -1
- package/dist/{create-WRZO4HK2.js → create-42RTNLH2.js} +1 -1
- package/dist/demo-kit-DZ7TPG7K.js +149 -0
- package/dist/doctor-DK4BON3N.js +1 -0
- package/dist/{dotnet-webapi-clean-IPY3MCGQ.js → dotnet-webapi-clean-BYUUHX5Y.js} +20 -20
- package/dist/{gofiber-standard-N5N3QGH3.js → gofiber-standard-B6UK5GR7.js} +31 -31
- package/dist/{gogin-standard-LAWQTBWL.js → gogin-standard-BXU44VEM.js} +31 -31
- package/dist/index.js +222 -185
- package/dist/pipeline-HQ57V6OZ.js +5 -0
- package/dist/{pythonRapidkitExec-3L3XJBSY.js → pythonRapidkitExec-GCQ3M46E.js} +1 -1
- package/dist/{springboot-standard-OZYF7ZM7.js → springboot-standard-PEHDKH2L.js} +27 -27
- package/dist/{workspace-PR6VZRBG.js → workspace-DZHWB7BV.js} +1 -1
- package/dist/{workspace-agent-sync-KTYF3HQR.js → workspace-agent-sync-5ADIQS7B.js} +1 -1
- package/dist/{workspace-context-QUTOP2XV.js → workspace-context-GEXDHA7A.js} +1 -1
- package/dist/{workspace-contract-XUGMCUSQ.js → workspace-contract-2TA27LGT.js} +1 -1
- package/dist/workspace-explain-D5NNL3NG.js +1 -0
- package/dist/{workspace-foundation-KGSV4E6D.js → workspace-foundation-FQWHPQGX.js} +1 -1
- package/dist/{workspace-intelligence-QJGVL37U.js → workspace-intelligence-BEM6WGCZ.js} +1 -1
- package/dist/{workspace-mcp-serve-AK4MYEHQ.js → workspace-mcp-serve-OMBA5V3C.js} +1 -1
- package/dist/{workspace-model-PNXXOGPO.js → workspace-model-F3B75TYT.js} +1 -1
- package/dist/workspace-registry-summary-6MFBRWDS.js +1 -0
- package/dist/workspace-run-3WJXIQKR.js +1 -0
- package/dist/{workspace-verify-WSDUUTR5.js → workspace-verify-OAATQV5T.js} +1 -1
- package/dist/{workspace-watch-AGPOJ74Q.js → workspace-watch-HU2OTQ52.js} +1 -1
- package/package.json +12 -2
- package/templates/kits/fastapi-ddd/.gitignore.j2 +11 -0
- package/templates/kits/fastapi-ddd/README.md.j2 +23 -18
- package/templates/kits/fastapi-ddd/common/env.example.j2 +2 -2
- package/templates/kits/fastapi-ddd/pyproject.toml.j2 +7 -7
- package/templates/kits/fastapi-ddd/src/app/config/__init__.py.j2 +1 -1
- package/templates/kits/fastapi-ddd/src/cli.py.j2 +6 -9
- package/templates/kits/fastapi-ddd/src/main.py.j2 +1 -1
- package/templates/kits/fastapi-standard/.gitignore.j2 +11 -0
- package/templates/kits/fastapi-standard/README.md.j2 +35 -30
- package/templates/kits/fastapi-standard/common/env.example.j2 +2 -2
- package/templates/kits/fastapi-standard/pyproject.toml.j2 +7 -7
- package/templates/kits/fastapi-standard/src/cli.py.j2 +7 -10
- package/templates/kits/fastapi-standard/src/main.py.j2 +1 -1
- package/templates/kits/fastapi-standard/src/routing/examples.py.j2 +1 -1
- package/templates/kits/fastapi-standard/tests/test_examples.py.j2 +1 -1
- package/templates/kits/nestjs-standard/.dockerignore.j2 +11 -0
- package/templates/kits/nestjs-standard/.eslintrc.js.j2 +25 -0
- package/templates/kits/nestjs-standard/.gitignore.j2 +22 -0
- package/templates/kits/nestjs-standard/.node-version.j2 +1 -0
- package/templates/kits/nestjs-standard/.nvmrc.j2 +1 -0
- package/templates/kits/nestjs-standard/.prettierrc.j2 +7 -0
- package/templates/kits/nestjs-standard/README.md.j2 +23 -18
- package/templates/kits/nestjs-standard/docs/README.md.j2 +2 -2
- package/templates/kits/nestjs-standard/jest.config.ts.j2 +1 -7
- package/templates/kits/nestjs-standard/package.json.j2 +1 -1
- package/templates/kits/nestjs-standard/src/config/configuration.ts.j2 +4 -4
- package/templates/kits/nestjs-standard/src/main.ts.j2 +1 -1
- package/templates/kits/nestjs-standard/src/modules/index.ts.j2 +1 -1
- package/templates/kits/nestjs-standard/tsconfig.build.json.j2 +1 -1
- package/templates/kits/nestjs-standard/tsconfig.json.j2 +1 -1
- package/dist/autopilot-release-QYUOVB26.js +0 -1
- package/dist/chunk-LYC6AIF2.js +0 -2
- package/dist/chunk-WU4ZRRA5.js +0 -4
- package/dist/demo-kit-AJ5LIM5G.js +0 -149
- package/dist/doctor-MF3M3FS3.js +0 -1
- package/dist/pipeline-QCUHFWDY.js +0 -5
- package/dist/workspace-explain-JEONEGZZ.js +0 -1
- package/dist/workspace-registry-summary-RUJE6RPH.js +0 -1
- package/dist/workspace-run-Y7YMUIHX.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {c as c$1,b
|
|
1
|
+
import {c as c$1,b as b$1,d,e,f,a as a$1}from'./chunk-IBJEQHJR.js';import {c}from'./chunk-Y45WZR5N.js';import {b,a}from'./chunk-TQEMLBAG.js';import {promises}from'fs';import p from'path';import o from'chalk';import T from'ora';import {execa}from'execa';function q(e){return `package main
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
4
|
"fmt"
|
|
@@ -52,7 +52,7 @@ func main() {
|
|
|
52
52
|
}
|
|
53
53
|
slog.Info("server stopped")
|
|
54
54
|
}
|
|
55
|
-
`}function
|
|
55
|
+
`}function O(e){return `module ${e.module_path}
|
|
56
56
|
|
|
57
57
|
go ${e.go_version}
|
|
58
58
|
|
|
@@ -61,7 +61,7 @@ require (
|
|
|
61
61
|
github.com/swaggo/fiber-swagger v1.3.0
|
|
62
62
|
github.com/swaggo/swag v1.16.3
|
|
63
63
|
)
|
|
64
|
-
`}function
|
|
64
|
+
`}function y(e){return `package config
|
|
65
65
|
|
|
66
66
|
import (
|
|
67
67
|
"log/slog"
|
|
@@ -114,7 +114,7 @@ func getEnv(key, fallback string) string {
|
|
|
114
114
|
}
|
|
115
115
|
return fallback
|
|
116
116
|
}
|
|
117
|
-
`}function
|
|
117
|
+
`}function C(e){return `package server
|
|
118
118
|
|
|
119
119
|
import (
|
|
120
120
|
"net/http"
|
|
@@ -180,7 +180,7 @@ func NewApp(cfg *config.Config) *fiber.App {
|
|
|
180
180
|
|
|
181
181
|
return app
|
|
182
182
|
}
|
|
183
|
-
`}function
|
|
183
|
+
`}function N(){return `package handlers
|
|
184
184
|
|
|
185
185
|
import (
|
|
186
186
|
"time"
|
|
@@ -218,7 +218,7 @@ func Readiness(c *fiber.Ctx) error {
|
|
|
218
218
|
"time": time.Now().UTC().Format(time.RFC3339),
|
|
219
219
|
})
|
|
220
220
|
}
|
|
221
|
-
`}function
|
|
221
|
+
`}function E(e){return `package handlers_test
|
|
222
222
|
|
|
223
223
|
import (
|
|
224
224
|
"encoding/json"
|
|
@@ -267,7 +267,7 @@ func TestReadiness(t *testing.T) {
|
|
|
267
267
|
t.Fatalf("expected 200, got %d: %s", resp.StatusCode, resp.Status)
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
|
-
`}function
|
|
270
|
+
`}function L(){return `# \u2500\u2500 Build stage \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
271
271
|
FROM golang:1.24-alpine AS builder
|
|
272
272
|
|
|
273
273
|
# Build-time version injection
|
|
@@ -296,7 +296,7 @@ EXPOSE 3000
|
|
|
296
296
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \\
|
|
297
297
|
CMD wget -qO- http://localhost:3000/api/v1/health/live || exit 1
|
|
298
298
|
ENTRYPOINT ["/server"]
|
|
299
|
-
`}function
|
|
299
|
+
`}function G(e){return `version: "3.9"
|
|
300
300
|
|
|
301
301
|
services:
|
|
302
302
|
api:
|
|
@@ -311,7 +311,7 @@ services:
|
|
|
311
311
|
CORS_ALLOW_ORIGINS: "*"
|
|
312
312
|
RATE_LIMIT_RPS: "100"
|
|
313
313
|
restart: unless-stopped
|
|
314
|
-
`}function
|
|
314
|
+
`}function A(e){return d({projectName:e.project_name,devCommand:"$(GOBIN)/air",runCommand:"go run $(LDFLAGS) ./cmd/server",testCommand:"go test ./... -v -race",includeLintAndFmt:true})}function I(e){return `# Application
|
|
315
315
|
PORT=${e.port}
|
|
316
316
|
APP_ENV=development
|
|
317
317
|
LOG_LEVEL=debug
|
|
@@ -321,7 +321,7 @@ CORS_ALLOW_ORIGINS=*
|
|
|
321
321
|
|
|
322
322
|
# Rate limiting \u2014 max requests per IP per second
|
|
323
323
|
RATE_LIMIT_RPS=100
|
|
324
|
-
`}function
|
|
324
|
+
`}function k(){return `# Binaries
|
|
325
325
|
bin/
|
|
326
326
|
*.exe
|
|
327
327
|
*.exe~
|
|
@@ -361,7 +361,7 @@ docs/docs.go
|
|
|
361
361
|
# OS
|
|
362
362
|
.DS_Store
|
|
363
363
|
Thumbs.db
|
|
364
|
-
`}function
|
|
364
|
+
`}function F(e){return `name: CI
|
|
365
365
|
|
|
366
366
|
on:
|
|
367
367
|
push:
|
|
@@ -415,7 +415,7 @@ jobs:
|
|
|
415
415
|
uses: golangci/golangci-lint-action@v6
|
|
416
416
|
with:
|
|
417
417
|
version: latest
|
|
418
|
-
`}function
|
|
418
|
+
`}function x(e){return `# ${b$1(e.project_name)}
|
|
419
419
|
|
|
420
420
|
> ${e.description}
|
|
421
421
|
|
|
@@ -530,7 +530,7 @@ ${e.project_name}/
|
|
|
530
530
|
## License
|
|
531
531
|
|
|
532
532
|
${e.app_version} \xB7 ${e.author}
|
|
533
|
-
`}function
|
|
533
|
+
`}function P(){return `package middleware
|
|
534
534
|
|
|
535
535
|
import (
|
|
536
536
|
"crypto/rand"
|
|
@@ -583,7 +583,7 @@ func newID() string {
|
|
|
583
583
|
}
|
|
584
584
|
return hex.EncodeToString(b)
|
|
585
585
|
}
|
|
586
|
-
`}function
|
|
586
|
+
`}function D(e){return `package middleware_test
|
|
587
587
|
|
|
588
588
|
import (
|
|
589
589
|
"net/http"
|
|
@@ -636,7 +636,7 @@ func TestRequestID_IsReused(t *testing.T) {
|
|
|
636
636
|
t.Fatalf("expected X-Request-ID to be reused, got %q", id)
|
|
637
637
|
}
|
|
638
638
|
}
|
|
639
|
-
`}function
|
|
639
|
+
`}function M(){return `// Package apierr provides a consistent JSON error envelope for all API responses.
|
|
640
640
|
//
|
|
641
641
|
// Every error response looks like:
|
|
642
642
|
//
|
|
@@ -700,7 +700,7 @@ func InternalError(c *fiber.Ctx, _ error) error {
|
|
|
700
700
|
func TooManyRequests(c *fiber.Ctx, msg string) error {
|
|
701
701
|
return reply(c, http.StatusTooManyRequests, msg, "TOO_MANY_REQUESTS")
|
|
702
702
|
}
|
|
703
|
-
`}function
|
|
703
|
+
`}function B(e){return `package apierr_test
|
|
704
704
|
|
|
705
705
|
import (
|
|
706
706
|
"encoding/json"
|
|
@@ -832,11 +832,11 @@ func TestTooManyRequests(t *testing.T) {
|
|
|
832
832
|
t.Fatalf("expected TOO_MANY_REQUESTS, got %q", body.Code)
|
|
833
833
|
}
|
|
834
834
|
}
|
|
835
|
-
`}function
|
|
835
|
+
`}function $(e){return `// Package docs provides the swaggo-generated OpenAPI specification.
|
|
836
836
|
//
|
|
837
837
|
// Run \`make docs\` to regenerate after changing handler annotations.
|
|
838
838
|
//
|
|
839
|
-
// @title ${b(e.project_name)} API
|
|
839
|
+
// @title ${b$1(e.project_name)} API
|
|
840
840
|
// @version ${e.app_version}
|
|
841
841
|
// @description ${e.description}
|
|
842
842
|
// @host localhost:${e.port}
|
|
@@ -846,7 +846,7 @@ func TestTooManyRequests(t *testing.T) {
|
|
|
846
846
|
// @contact.name ${e.author}
|
|
847
847
|
// @license.name MIT
|
|
848
848
|
package docs
|
|
849
|
-
`}function
|
|
849
|
+
`}function j(e){return `package handlers
|
|
850
850
|
|
|
851
851
|
import (
|
|
852
852
|
"net/http"
|
|
@@ -888,7 +888,7 @@ func EchoParams(c *fiber.Ctx) error {
|
|
|
888
888
|
RequestID: rid,
|
|
889
889
|
})
|
|
890
890
|
}
|
|
891
|
-
`}function
|
|
891
|
+
`}function H(e){return `package handlers_test
|
|
892
892
|
|
|
893
893
|
import (
|
|
894
894
|
"encoding/json"
|
|
@@ -956,7 +956,7 @@ func TestEchoParams_EmptyName(t *testing.T) {
|
|
|
956
956
|
t.Fatalf("expected code=BAD_REQUEST, got %v", body["code"])
|
|
957
957
|
}
|
|
958
958
|
}
|
|
959
|
-
`}function
|
|
959
|
+
`}function U(e){return `package config_test
|
|
960
960
|
|
|
961
961
|
import (
|
|
962
962
|
"log/slog"
|
|
@@ -1024,7 +1024,7 @@ func TestLoad_Defaults(t *testing.T) {
|
|
|
1024
1024
|
t.Errorf("expected default LogLevel=debug (development env), got %q", cfg.LogLevel)
|
|
1025
1025
|
}
|
|
1026
1026
|
}
|
|
1027
|
-
`}function
|
|
1027
|
+
`}function V(){return `package middleware
|
|
1028
1028
|
|
|
1029
1029
|
import (
|
|
1030
1030
|
"os"
|
|
@@ -1052,7 +1052,7 @@ func CORS() fiber.Handler {
|
|
|
1052
1052
|
MaxAge: 600,
|
|
1053
1053
|
})
|
|
1054
1054
|
}
|
|
1055
|
-
`}function
|
|
1055
|
+
`}function J(e){return `package middleware_test
|
|
1056
1056
|
|
|
1057
1057
|
import (
|
|
1058
1058
|
"net/http"
|
|
@@ -1124,7 +1124,7 @@ func TestCORS_Default_Origin(t *testing.T) {
|
|
|
1124
1124
|
t.Fatal("expected CORS header when origins defaulting to *")
|
|
1125
1125
|
}
|
|
1126
1126
|
}
|
|
1127
|
-
`}function
|
|
1127
|
+
`}function W(e){return `package server_test
|
|
1128
1128
|
|
|
1129
1129
|
import (
|
|
1130
1130
|
"encoding/json"
|
|
@@ -1213,7 +1213,7 @@ func TestServer_Docs_Redirect(t *testing.T) {
|
|
|
1213
1213
|
t.Fatalf("expected Location=/docs/index.html, got %q", loc)
|
|
1214
1214
|
}
|
|
1215
1215
|
}
|
|
1216
|
-
`}function
|
|
1216
|
+
`}function K(e){return `package middleware
|
|
1217
1217
|
|
|
1218
1218
|
import (
|
|
1219
1219
|
"os"
|
|
@@ -1246,7 +1246,7 @@ func RateLimit() fiber.Handler {
|
|
|
1246
1246
|
},
|
|
1247
1247
|
})
|
|
1248
1248
|
}
|
|
1249
|
-
`}function
|
|
1249
|
+
`}function X(e){return `package middleware_test
|
|
1250
1250
|
|
|
1251
1251
|
import (
|
|
1252
1252
|
"net/http"
|
|
@@ -1322,7 +1322,7 @@ func TestRateLimit_InvalidRPS(t *testing.T) {
|
|
|
1322
1322
|
t.Fatalf("expected 200 with invalid RPS env, got %d", resp.StatusCode)
|
|
1323
1323
|
}
|
|
1324
1324
|
}
|
|
1325
|
-
`}function
|
|
1325
|
+
`}function Q(e){return `# Air \u2014 live reload for Go projects
|
|
1326
1326
|
# https://github.com/air-verse/air
|
|
1327
1327
|
root = "."
|
|
1328
1328
|
tmp_dir = "tmp"
|
|
@@ -1346,7 +1346,7 @@ tmp_dir = "tmp"
|
|
|
1346
1346
|
|
|
1347
1347
|
[log]
|
|
1348
1348
|
time = false
|
|
1349
|
-
`}function
|
|
1349
|
+
`}function Y(e){return `run:
|
|
1350
1350
|
timeout: 5m
|
|
1351
1351
|
|
|
1352
1352
|
linters:
|
|
@@ -1392,6 +1392,6 @@ issues:
|
|
|
1392
1392
|
linters:
|
|
1393
1393
|
- errcheck
|
|
1394
1394
|
- wrapcheck
|
|
1395
|
-
`}function
|
|
1396
|
-
`));}let n=
|
|
1397
|
-
export{
|
|
1395
|
+
`}function z(){return JSON.stringify({engine:"npm",runtime:"go"},null,2)}function Z(e$1){return e({runtimeLabel:"Go/Fiber",projectName:e$1.project_name,fallbackDevCommand:'exec go run ./cmd/server "$@"'})}function ee(e){return f({runtimeLabel:"Go/Fiber",projectName:e.project_name})}function te(e,i){return JSON.stringify({kit_name:"gofiber.standard",runtime:"go",module_support:false,project_name:e.project_name,module_path:e.module_path,app_version:e.app_version,created_by:"workspai",workspai_version:i,rapidkit_version:i,created_at:new Date().toISOString()},null,2)}async function ce(e,i){let r={project_name:i.project_name,module_path:i.module_path||i.project_name,author:i.author||"Workspai User",description:i.description||`Go/Fiber REST API \u2014 ${i.project_name}`,go_version:i.go_version||a$1,app_version:i.app_version||"0.1.0",port:i.port||"3000",skipGit:i.skipGit??false,skipInstall:i.skipInstall??false},v=c();try{await execa("go",["version"],{timeout:3e3});}catch{console.log(o.yellow("\n\u26A0 Go not found in PATH \u2014 project will be scaffolded, but `go mod tidy` requires Go 1.21+")),console.log(o.gray(` Install: https://go.dev/dl/
|
|
1396
|
+
`));}let n=T(`Generating Go/Fiber project: ${r.project_name}\u2026`).start();try{let t=(S,_)=>c$1(p.join(e,S),_),w=p.join(e,"rapidkit"),R=p.join(e,"rapidkit.cmd");if(await Promise.all([t("cmd/server/main.go",q(r)),t("go.mod",O(r)),t("internal/config/config.go",y(r)),t("internal/server/server.go",C(r)),t("internal/middleware/requestid.go",P()),t("internal/middleware/requestid_test.go",D(r)),t("internal/apierr/apierr.go",M()),t("internal/apierr/apierr_test.go",B(r)),t("internal/handlers/health.go",N()),t("internal/handlers/health_test.go",E(r)),t("internal/handlers/example.go",j(r)),t("internal/handlers/example_test.go",H(r)),t("internal/config/config_test.go",U(r)),t("internal/middleware/cors.go",V()),t("internal/middleware/cors_test.go",J(r)),t("internal/middleware/ratelimit.go",K(r)),t("internal/middleware/ratelimit_test.go",X(r)),t("internal/server/server_test.go",W(r)),t("docs/doc.go",$(r)),t(".air.toml",Q(r)),t("Dockerfile",L()),t("docker-compose.yml",G(r)),t("Makefile",A(r)),t(".golangci.yml",Y(r.module_path)),t(".env.example",I(r)),t(".gitignore",k()),t(".github/workflows/ci.yml",F(r)),t("README.md",x(r)),t(".workspai/project.json",te(r,v)),t(".workspai/context.json",z()),t("rapidkit",Z(r)),t("rapidkit.cmd",ee(r))]),await promises.chmod(w,493),await promises.chmod(R,493),n.succeed(o.green(`Project created at ${e}`)),r.skipInstall)n.info(o.gray("Skipped Go dependency warm-up (--skip-install)."));else try{n.start("Fetching Go dependencies\u2026"),await execa("go",["mod","tidy"],{cwd:e,timeout:12e4}),n.succeed(o.gray("\u2713 go mod tidy completed"));}catch{n.warn(o.yellow("\u26A0 go mod tidy failed \u2014 run manually: go mod tidy"));}if(!r.skipGit)try{await b(e)?console.log(o.gray("\u26A0 git init skipped (target is inside an existing git worktree)")):(await execa("git",["init"],{cwd:e,env:a()}),await execa("git",["add","-A"],{cwd:e,env:a()}),await execa("git",["commit","-m","chore: initial scaffold (rapidkit gofiber.standard)"],{cwd:e,env:a()}),console.log(o.gray("\u2713 git repository initialized")));}catch{console.log(o.gray("\u26A0 git init skipped (git not found or error)"));}console.log(""),console.log(o.bold("\u2705 Go/Fiber project ready!")),console.log(""),console.log(o.cyan("Next steps:")),console.log(o.white(` cd ${r.project_name}`)),console.log(o.white(" make run # start dev server")),console.log(o.white(" make test # run tests")),console.log(""),console.log(o.gray("Server will listen on port "+r.port)),console.log(o.gray(" http://localhost:"+r.port+"/api/v1/health/live")),console.log(o.gray(" http://localhost:"+r.port+"/api/v1/health/ready")),console.log(""),console.log(o.yellow("\u2139 RapidKit Core modules are not available for Go projects (module system uses Python/pip).")),console.log("");}catch(t){throw n.fail(o.red("Failed to generate Go/Fiber project")),t}}
|
|
1397
|
+
export{ce as generateGoFiberKit};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {c as c$
|
|
1
|
+
import {c as c$2,b as b$2,d,e,f,a as a$1}from'./chunk-IBJEQHJR.js';import {c}from'./chunk-Y45WZR5N.js';import {b as b$1,a}from'./chunk-TQEMLBAG.js';import {promises}from'fs';import c$1 from'path';import o from'chalk';import O from'ora';import {execa}from'execa';function N(e){return `package main
|
|
2
2
|
|
|
3
3
|
import (
|
|
4
4
|
"context"
|
|
@@ -65,7 +65,7 @@ func main() {
|
|
|
65
65
|
}
|
|
66
66
|
slog.Info("server stopped")
|
|
67
67
|
}
|
|
68
|
-
`}function
|
|
68
|
+
`}function b(e){return `module ${e.module_path}
|
|
69
69
|
|
|
70
70
|
go ${e.go_version}
|
|
71
71
|
|
|
@@ -75,7 +75,7 @@ require (
|
|
|
75
75
|
github.com/swaggo/gin-swagger v1.6.0
|
|
76
76
|
github.com/swaggo/swag v1.16.3
|
|
77
77
|
)
|
|
78
|
-
`}function
|
|
78
|
+
`}function G(e){return `package config
|
|
79
79
|
|
|
80
80
|
import (
|
|
81
81
|
"log/slog"
|
|
@@ -130,7 +130,7 @@ func getEnv(key, fallback string) string {
|
|
|
130
130
|
}
|
|
131
131
|
return fallback
|
|
132
132
|
}
|
|
133
|
-
`}function
|
|
133
|
+
`}function q(e){return `package server
|
|
134
134
|
|
|
135
135
|
import (
|
|
136
136
|
"net/http"
|
|
@@ -182,7 +182,7 @@ func NewRouter(cfg *config.Config) *gin.Engine {
|
|
|
182
182
|
|
|
183
183
|
return r
|
|
184
184
|
}
|
|
185
|
-
`}function
|
|
185
|
+
`}function E(){return `package handlers
|
|
186
186
|
|
|
187
187
|
import (
|
|
188
188
|
"net/http"
|
|
@@ -221,7 +221,7 @@ func Readiness(c *gin.Context) {
|
|
|
221
221
|
"time": time.Now().UTC().Format(time.RFC3339),
|
|
222
222
|
})
|
|
223
223
|
}
|
|
224
|
-
`}function
|
|
224
|
+
`}function C(e){return `package handlers_test
|
|
225
225
|
|
|
226
226
|
import (
|
|
227
227
|
"encoding/json"
|
|
@@ -266,7 +266,7 @@ func TestReadiness(t *testing.T) {
|
|
|
266
266
|
t.Fatalf("expected 200, got %d: %s", w.Code, w.Body.String())
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
|
-
`}function
|
|
269
|
+
`}function L(){return `# \u2500\u2500 Build stage \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
|
|
270
270
|
FROM golang:1.24-alpine AS builder
|
|
271
271
|
|
|
272
272
|
# Build-time version injection
|
|
@@ -295,7 +295,7 @@ EXPOSE 8080
|
|
|
295
295
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \\
|
|
296
296
|
CMD wget -qO- http://localhost:8080/api/v1/health/live || exit 1
|
|
297
297
|
ENTRYPOINT ["/server"]
|
|
298
|
-
`}function
|
|
298
|
+
`}function y(e){return `version: "3.9"
|
|
299
299
|
|
|
300
300
|
services:
|
|
301
301
|
api:
|
|
@@ -311,7 +311,7 @@ services:
|
|
|
311
311
|
CORS_ALLOW_ORIGINS: "*"
|
|
312
312
|
RATE_LIMIT_RPS: "100"
|
|
313
313
|
restart: unless-stopped
|
|
314
|
-
`}function
|
|
314
|
+
`}function I(e){return d({projectName:e.project_name,devCommand:"GIN_MODE=debug $(GOBIN)/air",runCommand:"GIN_MODE=debug go run $(LDFLAGS) ./cmd/server",testCommand:"GIN_MODE=test go test ./... -v -race",includeLintAndFmt:true})}function k(e){return `# Application
|
|
315
315
|
PORT=${e.port}
|
|
316
316
|
APP_ENV=development
|
|
317
317
|
GIN_MODE=debug
|
|
@@ -322,7 +322,7 @@ CORS_ALLOW_ORIGINS=*
|
|
|
322
322
|
|
|
323
323
|
# Rate limiting \u2014 max requests per IP per second
|
|
324
324
|
RATE_LIMIT_RPS=100
|
|
325
|
-
`}function
|
|
325
|
+
`}function x(){return `# Binaries
|
|
326
326
|
bin/
|
|
327
327
|
*.exe
|
|
328
328
|
*.exe~
|
|
@@ -362,7 +362,7 @@ docs/docs.go
|
|
|
362
362
|
# OS
|
|
363
363
|
.DS_Store
|
|
364
364
|
Thumbs.db
|
|
365
|
-
`}function
|
|
365
|
+
`}function M(e){return `name: CI
|
|
366
366
|
|
|
367
367
|
on:
|
|
368
368
|
push:
|
|
@@ -416,7 +416,7 @@ jobs:
|
|
|
416
416
|
uses: golangci/golangci-lint-action@v6
|
|
417
417
|
with:
|
|
418
418
|
version: latest
|
|
419
|
-
`}function
|
|
419
|
+
`}function A(e){return `# ${b$2(e.project_name)}
|
|
420
420
|
|
|
421
421
|
> ${e.description}
|
|
422
422
|
|
|
@@ -532,7 +532,7 @@ ${e.project_name}/
|
|
|
532
532
|
## License
|
|
533
533
|
|
|
534
534
|
${e.app_version} \xB7 ${e.author}
|
|
535
|
-
`}function
|
|
535
|
+
`}function P(){return `package middleware
|
|
536
536
|
|
|
537
537
|
import (
|
|
538
538
|
"crypto/rand"
|
|
@@ -584,7 +584,7 @@ func newID() string {
|
|
|
584
584
|
}
|
|
585
585
|
return hex.EncodeToString(b)
|
|
586
586
|
}
|
|
587
|
-
`}function
|
|
587
|
+
`}function D(e){return `package middleware_test
|
|
588
588
|
|
|
589
589
|
import (
|
|
590
590
|
"net/http"
|
|
@@ -633,7 +633,7 @@ func TestRequestID_IsReused(t *testing.T) {
|
|
|
633
633
|
t.Fatalf("expected X-Request-ID to be reused, got %q", id)
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
|
-
`}function
|
|
636
|
+
`}function H(){return `// Package apierr provides a consistent JSON error envelope for all API responses.
|
|
637
637
|
//
|
|
638
638
|
// Every error response looks like:
|
|
639
639
|
//
|
|
@@ -696,7 +696,7 @@ func InternalError(c *gin.Context, _ error) {
|
|
|
696
696
|
func TooManyRequests(c *gin.Context) {
|
|
697
697
|
reply(c, http.StatusTooManyRequests, "rate limit exceeded", "TOO_MANY_REQUESTS")
|
|
698
698
|
}
|
|
699
|
-
`}function
|
|
699
|
+
`}function F(e){return `package apierr_test
|
|
700
700
|
|
|
701
701
|
import (
|
|
702
702
|
"encoding/json"
|
|
@@ -822,11 +822,11 @@ func TestTooManyRequests(t *testing.T) {
|
|
|
822
822
|
t.Fatalf("expected TOO_MANY_REQUESTS, got %q", body.Code)
|
|
823
823
|
}
|
|
824
824
|
}
|
|
825
|
-
`}function
|
|
825
|
+
`}function $(e){return `// Package docs provides the swaggo-generated OpenAPI specification.
|
|
826
826
|
//
|
|
827
827
|
// Run \`make docs\` to regenerate after changing handler annotations.
|
|
828
828
|
//
|
|
829
|
-
// @title ${b$
|
|
829
|
+
// @title ${b$2(e.project_name)} API
|
|
830
830
|
// @version ${e.app_version}
|
|
831
831
|
// @description ${e.description}
|
|
832
832
|
// @host localhost:${e.port}
|
|
@@ -836,7 +836,7 @@ func TestTooManyRequests(t *testing.T) {
|
|
|
836
836
|
// @contact.name ${e.author}
|
|
837
837
|
// @license.name MIT
|
|
838
838
|
package docs
|
|
839
|
-
`}function
|
|
839
|
+
`}function j(e){return `package handlers
|
|
840
840
|
|
|
841
841
|
import (
|
|
842
842
|
"net/http"
|
|
@@ -878,7 +878,7 @@ func EchoParams(c *gin.Context) {
|
|
|
878
878
|
RequestID: c.GetString("X-Request-ID"),
|
|
879
879
|
})
|
|
880
880
|
}
|
|
881
|
-
`}function
|
|
881
|
+
`}function U(e){return `package handlers_test
|
|
882
882
|
|
|
883
883
|
import (
|
|
884
884
|
"encoding/json"
|
|
@@ -943,7 +943,7 @@ func TestEchoParams_EmptyName(t *testing.T) {
|
|
|
943
943
|
t.Fatalf("expected code=BAD_REQUEST, got %v", body["code"])
|
|
944
944
|
}
|
|
945
945
|
}
|
|
946
|
-
`}function
|
|
946
|
+
`}function B(e){return `package config_test
|
|
947
947
|
|
|
948
948
|
import (
|
|
949
949
|
"log/slog"
|
|
@@ -1019,7 +1019,7 @@ func TestLoad_Defaults(t *testing.T) {
|
|
|
1019
1019
|
t.Errorf("expected default GinMode=debug, got %q", cfg.GinMode)
|
|
1020
1020
|
}
|
|
1021
1021
|
}
|
|
1022
|
-
`}function
|
|
1022
|
+
`}function V(){return `package middleware
|
|
1023
1023
|
|
|
1024
1024
|
import (
|
|
1025
1025
|
"net/http"
|
|
@@ -1067,7 +1067,7 @@ func CORS() gin.HandlerFunc {
|
|
|
1067
1067
|
c.Next()
|
|
1068
1068
|
}
|
|
1069
1069
|
}
|
|
1070
|
-
`}function
|
|
1070
|
+
`}function W(e){return `package middleware_test
|
|
1071
1071
|
|
|
1072
1072
|
import (
|
|
1073
1073
|
"net/http"
|
|
@@ -1153,7 +1153,7 @@ func TestCORS_Default_Origin(t *testing.T) {
|
|
|
1153
1153
|
t.Fatal("expected CORS header when CORS_ALLOW_ORIGINS defaults to *")
|
|
1154
1154
|
}
|
|
1155
1155
|
}
|
|
1156
|
-
`}function
|
|
1156
|
+
`}function J(e){return `package server_test
|
|
1157
1157
|
|
|
1158
1158
|
import (
|
|
1159
1159
|
"encoding/json"
|
|
@@ -1263,7 +1263,7 @@ func TestServer_ReleaseMode(t *testing.T) {
|
|
|
1263
1263
|
t.Fatalf("expected 200 in release mode, got %d", w.Code)
|
|
1264
1264
|
}
|
|
1265
1265
|
}
|
|
1266
|
-
`}function
|
|
1266
|
+
`}function K(e){return `package middleware
|
|
1267
1267
|
|
|
1268
1268
|
import (
|
|
1269
1269
|
"os"
|
|
@@ -1314,7 +1314,7 @@ func RateLimit() gin.HandlerFunc {
|
|
|
1314
1314
|
c.Next()
|
|
1315
1315
|
}
|
|
1316
1316
|
}
|
|
1317
|
-
`}function
|
|
1317
|
+
`}function X(e){return `package middleware_test
|
|
1318
1318
|
|
|
1319
1319
|
import (
|
|
1320
1320
|
"net/http"
|
|
@@ -1383,7 +1383,7 @@ func TestRateLimit_InvalidRPS(t *testing.T) {
|
|
|
1383
1383
|
t.Fatalf("expected 200 with invalid RPS env, got %d", w.Code)
|
|
1384
1384
|
}
|
|
1385
1385
|
}
|
|
1386
|
-
`}function
|
|
1386
|
+
`}function Q(e){return `# Air \u2014 live reload for Go projects
|
|
1387
1387
|
# https://github.com/air-verse/air
|
|
1388
1388
|
root = "."
|
|
1389
1389
|
tmp_dir = "tmp"
|
|
@@ -1408,7 +1408,7 @@ tmp_dir = "tmp"
|
|
|
1408
1408
|
|
|
1409
1409
|
[log]
|
|
1410
1410
|
time = false
|
|
1411
|
-
`}function
|
|
1411
|
+
`}function z(e){return `run:
|
|
1412
1412
|
timeout: 5m
|
|
1413
1413
|
|
|
1414
1414
|
linters:
|
|
@@ -1454,6 +1454,6 @@ issues:
|
|
|
1454
1454
|
linters:
|
|
1455
1455
|
- errcheck
|
|
1456
1456
|
- wrapcheck
|
|
1457
|
-
`}function
|
|
1458
|
-
`));}let i=
|
|
1459
|
-
export{
|
|
1457
|
+
`}function Y(){return JSON.stringify({engine:"npm",runtime:"go"},null,2)}function Z(e,n){return JSON.stringify({kit_name:"gogin.standard",runtime:"go",module_support:false,project_name:e.project_name,module_path:e.module_path,app_version:e.app_version,created_by:"workspai",workspai_version:n,rapidkit_version:n,created_at:new Date().toISOString()},null,2)}function ee(e$1){return e({runtimeLabel:"Go/Gin",projectName:e$1.project_name,fallbackDevCommand:'cd "$SCRIPT_DIR" && GIN_MODE=debug exec go run ./cmd/server "$@"'})}function te(e){return f({runtimeLabel:"Go/Gin",projectName:e.project_name})}async function ge(e,n){let r={project_name:n.project_name,module_path:n.module_path||n.project_name,author:n.author||"Workspai User",description:n.description||`Go/Gin REST API \u2014 ${n.project_name}`,go_version:n.go_version||a$1,app_version:n.app_version||"0.1.0",port:n.port||"8080",skipGit:n.skipGit??false,skipInstall:n.skipInstall??false},R=c();try{await execa("go",["version"],{timeout:3e3});}catch{console.log(o.yellow("\n\u26A0 Go not found in PATH \u2014 project will be scaffolded, but `go mod tidy` requires Go 1.21+")),console.log(o.gray(` Install: https://go.dev/dl/
|
|
1458
|
+
`));}let i=O(`Generating Go/Gin project: ${r.project_name}\u2026`).start();try{let t=(_,T)=>c$2(c$1.join(e,_),T),v=c$1.join(e,"rapidkit"),S=c$1.join(e,"rapidkit.cmd");if(await Promise.all([t("cmd/server/main.go",N(r)),t("go.mod",b(r)),t("internal/config/config.go",G(r)),t("internal/server/server.go",q(r)),t("internal/middleware/requestid.go",P()),t("internal/middleware/requestid_test.go",D(r)),t("internal/apierr/apierr.go",H()),t("internal/apierr/apierr_test.go",F(r)),t("internal/handlers/health.go",E()),t("internal/handlers/health_test.go",C(r)),t("internal/handlers/example.go",j(r)),t("internal/handlers/example_test.go",U(r)),t("internal/config/config_test.go",B(r)),t("internal/middleware/cors.go",V()),t("internal/middleware/cors_test.go",W(r)),t("internal/middleware/ratelimit.go",K(r)),t("internal/middleware/ratelimit_test.go",X(r)),t("internal/server/server_test.go",J(r)),t("docs/doc.go",$(r)),t(".air.toml",Q(r)),t("Dockerfile",L()),t("docker-compose.yml",y(r)),t("Makefile",I(r)),t(".golangci.yml",z(r.module_path)),t(".env.example",k(r)),t(".gitignore",x()),t(".github/workflows/ci.yml",M(r)),t("README.md",A(r)),t(".workspai/project.json",Z(r,R)),t(".workspai/context.json",Y()),t("rapidkit",ee(r)),t("rapidkit.cmd",te(r))]),await promises.chmod(v,493),await promises.chmod(S,493),i.succeed(o.green(`Project created at ${e}`)),r.skipInstall)i.info(o.gray("Skipped Go dependency warm-up (--skip-install)."));else try{i.start("Fetching Go dependencies\u2026"),await execa("go",["mod","tidy"],{cwd:e,timeout:12e4}),i.succeed(o.gray("\u2713 go mod tidy completed"));}catch{i.warn(o.yellow("\u26A0 go mod tidy failed \u2014 run manually: go mod tidy"));}if(!r.skipGit)try{await b$1(e)?console.log(o.gray("\u26A0 git init skipped (target is inside an existing git worktree)")):(await execa("git",["init"],{cwd:e,env:a()}),await execa("git",["add","-A"],{cwd:e,env:a()}),await execa("git",["commit","-m","chore: initial scaffold (rapidkit gogin.standard)"],{cwd:e,env:a()}),console.log(o.gray("\u2713 git repository initialized")));}catch{console.log(o.gray("\u26A0 git init skipped (git not found or error)"));}console.log(""),console.log(o.bold("\u2705 Go/Gin project ready!")),console.log(""),console.log(o.cyan("Next steps:")),console.log(o.white(` cd ${r.project_name}`)),console.log(o.white(" make run # start dev server")),console.log(o.white(" make test # run tests")),console.log(""),console.log(o.gray("Server will listen on port "+r.port)),console.log(o.gray(" http://localhost:"+r.port+"/api/v1/health/live")),console.log(o.gray(" http://localhost:"+r.port+"/api/v1/health/ready")),console.log(""),console.log(o.yellow("\u2139 RapidKit Core modules are not available for Go projects (module system uses Python/pip).")),console.log("");}catch(t){throw i.fail(o.red("Failed to generate Go/Gin project")),t}}
|
|
1459
|
+
export{ge as generateGoGinKit};
|