gorig-cli 1.0.24 → 1.0.25
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 +112 -22
- package/commands/create.js +267 -112
- package/commands/doc.js +21 -8
- package/commands/init.js +316 -255
- package/commands/skill.js +55 -17
- package/package.json +1 -1
- package/templates/config.go.ejs +6 -5
- package/templates/config.yaml.ejs +3 -38
- package/templates/controller.go.ejs +11 -42
- package/templates/crud.controller.go.ejs +71 -0
- package/templates/crud.doc.md.ejs +60 -0
- package/templates/crud.dto.go.ejs +103 -0
- package/templates/crud.integration.init_test.go.ejs +17 -0
- package/templates/crud.integration_test.go.ejs +66 -0
- package/templates/crud.model.go.ejs +25 -0
- package/templates/crud.module.README.md.ejs +70 -0
- package/templates/crud.mongo.config.yaml.ejs +19 -0
- package/templates/crud.mysql.config.yaml.ejs +14 -0
- package/templates/crud.router.go.ejs +18 -0
- package/templates/crud.service.go.ejs +179 -0
- package/templates/crud.test.go.ejs +52 -0
- package/templates/dto.go.ejs +16 -0
- package/templates/gitignore.ejs +18 -49
- package/templates/hello.controller.go.ejs +19 -0
- package/templates/hello.router.go.ejs +12 -0
- package/templates/hello.service.go.ejs +31 -0
- package/templates/hello.test.go.ejs +34 -0
- package/templates/init.go.ejs +1 -27
- package/templates/main.go.ejs +2 -5
- package/templates/model.go.ejs +3 -4
- package/templates/project.README.md.ejs +35 -0
- package/templates/router.go.ejs +4 -8
- package/templates/service.go.ejs +25 -77
- package/templates/skills/gorig-backend/SKILL.md +89 -0
- package/templates/skills/gorig-backend/agents/openai.yaml +4 -0
- package/templates/skills/gorig-backend/assets/api-doc-template.md +59 -0
- package/templates/skills/gorig-backend/assets/gorig.gitignore +65 -0
- package/templates/skills/gorig-backend/assets/module-readme-template.md +58 -0
- package/templates/skills/gorig-backend/references/advanced-data-access.md +275 -0
- package/templates/skills/gorig-backend/references/auth-security.md +194 -0
- package/templates/skills/gorig-backend/references/business-scenarios.md +155 -0
- package/templates/skills/gorig-backend/references/cache.md +301 -0
- package/templates/skills/gorig-backend/references/capability-matrix.md +37 -0
- package/templates/skills/gorig-backend/references/configuration.md +48 -0
- package/templates/skills/gorig-backend/references/framework-api.md +190 -0
- package/templates/skills/gorig-backend/references/messaging.md +143 -0
- package/templates/skills/gorig-backend/references/onboarding-files.md +46 -0
- package/templates/skills/gorig-backend/references/outbound-http.md +162 -0
- package/templates/skills/gorig-backend/references/persistent-crud.md +332 -0
- package/templates/skills/gorig-backend/references/project-bootstrap.md +128 -0
- package/templates/skills/gorig-backend/references/scheduled-tasks.md +231 -0
- package/templates/skills/gorig-backend/references/service-lifecycle.md +51 -0
- package/templates/skills/gorig-backend/references/source-map.md +43 -0
- package/templates/skills/gorig-backend/references/source-policy.md +58 -0
- package/templates/skills/gorig-backend/references/sse.md +121 -0
- package/templates/skills/gorig-backend/references/testing.md +171 -0
- package/templates/skills/gorig-backend/scripts/check-source-links.sh +48 -0
- package/templates/skills/gorig-backend/scripts/detect-gorig-context.sh +67 -0
- package/templates/skills/gorig-backend/scripts/verify-basic-project.sh +108 -0
- package/npm_publish copy.sh +0 -65
- package/templates/internal.go.ejs +0 -49
- package/templates/req.go.ejs +0 -8
- package/templates/resp.go.ejs +0 -8
- package/templates/service.pub.go.ejs +0 -22
- package/templates/skills/claude/gorig-backend/SKILL.md +0 -766
- package/templates/skills/claude/gorig-backend/assets/api-doc-template.md +0 -50
- package/templates/skills/claude/gorig-backend/assets/module-readme-template.md +0 -46
- package/templates/skills/claude/gorig-backend/references/onboarding-files.md +0 -44
- package/templates/skills/codex/gorig-backend/SKILL.md +0 -766
- package/templates/skills/codex/gorig-backend/agents/openai.yaml +0 -4
- package/templates/skills/codex/gorig-backend/assets/api-doc-template.md +0 -50
- package/templates/skills/codex/gorig-backend/assets/module-readme-template.md +0 -46
- package/templates/skills/codex/gorig-backend/references/onboarding-files.md +0 -44
package/npm_publish copy.sh
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# 确保脚本有执行权限
|
|
4
|
-
# chmod +x npm_publish.sh
|
|
5
|
-
|
|
6
|
-
# 设置官方源地址和原仓库源地址
|
|
7
|
-
NPM_OFFICIAL_REGISTRY="https://registry.npmjs.org/"
|
|
8
|
-
CUSTOM_REGISTRY=$(npm config get registry)
|
|
9
|
-
|
|
10
|
-
# 检查原始仓库源是否为官方源
|
|
11
|
-
if [ "$CUSTOM_REGISTRY" = "$NPM_OFFICIAL_REGISTRY" ]; then
|
|
12
|
-
echo "当前已经是官方源,不需要切换。"
|
|
13
|
-
else
|
|
14
|
-
echo "当前仓库源为: $CUSTOM_REGISTRY"
|
|
15
|
-
echo "正在切换为官方源: $NPM_OFFICIAL_REGISTRY"
|
|
16
|
-
npm config set registry $NPM_OFFICIAL_REGISTRY
|
|
17
|
-
fi
|
|
18
|
-
|
|
19
|
-
# 验证是否成功切换到官方源
|
|
20
|
-
CURRENT_REGISTRY=$(npm config get registry)
|
|
21
|
-
if [ "$CURRENT_REGISTRY" = "$NPM_OFFICIAL_REGISTRY" ]; then
|
|
22
|
-
echo "仓库源已成功切换为官方源。"
|
|
23
|
-
else
|
|
24
|
-
echo "切换仓库源失败,请检查。"
|
|
25
|
-
exit 1
|
|
26
|
-
fi
|
|
27
|
-
|
|
28
|
-
# 登录 npm 账户
|
|
29
|
-
echo "开始登录 npm,请根据提示输入用户名、密码和邮箱地址。"
|
|
30
|
-
npm login
|
|
31
|
-
if [ $? -ne 0 ]; then
|
|
32
|
-
echo "npm 登录失败,请检查用户名、密码和邮箱是否正确。"
|
|
33
|
-
exit 1
|
|
34
|
-
fi
|
|
35
|
-
|
|
36
|
-
# 执行 yarn publish 或 npm publish
|
|
37
|
-
echo "请选择使用 yarn 还是 npm 发布包(输入 y 表示使用 yarn,输入 n 表示使用 npm):"
|
|
38
|
-
read -p "[y/n]: " CHOICE
|
|
39
|
-
|
|
40
|
-
if [ "$CHOICE" = "y" ]; then
|
|
41
|
-
yarn publish
|
|
42
|
-
elif [ "$CHOICE" = "n" ]; then
|
|
43
|
-
npm publish
|
|
44
|
-
else
|
|
45
|
-
echo "无效输入,请重新运行脚本并选择 y 或 n。"
|
|
46
|
-
exit 1
|
|
47
|
-
fi
|
|
48
|
-
|
|
49
|
-
if [ $? -ne 0 ]; then
|
|
50
|
-
echo "发布失败,请检查日志。"
|
|
51
|
-
exit 1
|
|
52
|
-
else
|
|
53
|
-
echo "发布成功!"
|
|
54
|
-
fi
|
|
55
|
-
|
|
56
|
-
# 恢复原始仓库源
|
|
57
|
-
if [ "$CUSTOM_REGISTRY" != "$NPM_OFFICIAL_REGISTRY" ]; then
|
|
58
|
-
echo "正在恢复原始仓库源: $CUSTOM_REGISTRY"
|
|
59
|
-
npm config set registry $CUSTOM_REGISTRY
|
|
60
|
-
echo "仓库源已恢复为: $(npm config get registry)"
|
|
61
|
-
else
|
|
62
|
-
echo "仓库源保持为官方源,无需恢复。"
|
|
63
|
-
fi
|
|
64
|
-
|
|
65
|
-
echo "脚本执行完成。"
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
package internal
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"github.com/jom-io/gorig/domainx"
|
|
5
|
-
"github.com/jom-io/gorig/global/variable"
|
|
6
|
-
"<%= projectName %>/domain/<%= moduleName %>/api/req"
|
|
7
|
-
"<%= projectName %>/domain/<%= moduleName %>/model"
|
|
8
|
-
"<%= projectName %>/global"
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
func <%= ModuleName %>() *<%= ModuleName %>M {
|
|
12
|
-
return &<%= ModuleName %>M{Complex: domainx.UseComplex[model.<%= ModuleName %>D](domainx.Mysql, global.DBDef, "<%= moduleName %>")}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
type <%= ModuleName %>M struct {
|
|
16
|
-
*domainx.Complex[model.<%= ModuleName %>D]
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
func (u *<%= ModuleName %>M) TableName() string {
|
|
20
|
-
return variable.TBPrefix +"<%= moduleName %>"
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
func init() {
|
|
24
|
-
domainx.AutoMigrate(func() (value domainx.ConTable) {
|
|
25
|
-
return <%= ModuleName %>()
|
|
26
|
-
})
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
func (u *<%= ModuleName %>M) ParseReq(req *req.<%= ModuleName %>Req) {
|
|
30
|
-
u.Data = &req.<%= ModuleName %>D
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
func (u *<%= ModuleName %>M) ToResp() *req.<%= ModuleName %>Resp {
|
|
34
|
-
if u.Data == nil {
|
|
35
|
-
return nil
|
|
36
|
-
}
|
|
37
|
-
return &req.<%= ModuleName %>Resp{
|
|
38
|
-
ID: u.ID,
|
|
39
|
-
<%= ModuleName %>D: *u.Data,
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
func (u *<%= ModuleName %>M) ToRespList(list *[]<%= ModuleName %>M) []*req.<%= ModuleName %>Resp {
|
|
44
|
-
respList := make([]*req.<%= ModuleName %>Resp, 0)
|
|
45
|
-
for _, v := range *list {
|
|
46
|
-
respList = append(respList, v.ToResp())
|
|
47
|
-
}
|
|
48
|
-
return respList
|
|
49
|
-
}
|
package/templates/req.go.ejs
DELETED
package/templates/resp.go.ejs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
package <%= moduleName %>
|
|
2
|
-
|
|
3
|
-
import (
|
|
4
|
-
"github.com/gin-gonic/gin"
|
|
5
|
-
"github.com/jom-io/gorig/apix/load"
|
|
6
|
-
"github.com/jom-io/gorig/utils/errors"
|
|
7
|
-
"<%= projectName %>/domain/<%= moduleName %>/api/req"
|
|
8
|
-
)
|
|
9
|
-
|
|
10
|
-
var GService <%= moduleName %>Service
|
|
11
|
-
|
|
12
|
-
func setService(s <%= moduleName %>Service) {
|
|
13
|
-
GService = s
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
type <%= moduleName %>Service interface {
|
|
17
|
-
Save<%= moduleName.charAt(0).toUpperCase() + moduleName.slice(1) %>(ctx *gin.Context, req *req.<%= moduleName.charAt(0).toUpperCase() + moduleName.slice(1) %>Req) *errors.Error
|
|
18
|
-
Page<%= moduleName.charAt(0).toUpperCase() + moduleName.slice(1) %>(ctx *gin.Context, pageReq *load.Page, filter *req.<%= moduleName.charAt(0).toUpperCase() + moduleName.slice(1) %>Req) (*load.PageResp, *errors.Error)
|
|
19
|
-
List<%= moduleName.charAt(0).toUpperCase() + moduleName.slice(1) %>(ctx *gin.Context, filter *req.<%= moduleName.charAt(0).toUpperCase() + moduleName.slice(1) %>Req) ([]*req.<%= moduleName.charAt(0).toUpperCase() + moduleName.slice(1) %>Resp, *errors.Error)
|
|
20
|
-
Get<%= moduleName.charAt(0).toUpperCase() + moduleName.slice(1) %>(ctx *gin.Context, id int64) (*req.<%= moduleName.charAt(0).toUpperCase() + moduleName.slice(1) %>Resp, *errors.Error)
|
|
21
|
-
Delete<%= moduleName.charAt(0).toUpperCase() + moduleName.slice(1) %>(ctx *gin.Context, id int64) *errors.Error
|
|
22
|
-
}
|