gorig-cli 1.0.24 → 1.0.26
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/LICENSE +21 -0
- package/README.md +129 -40
- 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/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 jom
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,58 +1,134 @@
|
|
|
1
|
-
# Gorig CLI
|
|
1
|
+
# Gorig CLI: Project Generator and AI Skill Installer
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`gorig-cli` is the command-line entry point for Gorig backend development. It creates runnable Gorig projects, generates feature modules, builds persistence-backed CRUD services, produces API documentation, and installs the `gorig-backend` skill for Codex and Claude.
|
|
4
|
+
|
|
5
|
+
Use it when you want generated code to follow the same Gorig structure and framework conventions instead of starting from ad hoc scaffolding.
|
|
6
|
+
|
|
7
|
+
Main Gorig framework repository: [https://github.com/jom-io/gorig](https://github.com/jom-io/gorig)
|
|
8
|
+
|
|
9
|
+
## What It Does
|
|
10
|
+
|
|
11
|
+
| Capability | Description |
|
|
12
|
+
|---|---|
|
|
13
|
+
| Project bootstrap | Create a locally runnable Gorig service with `_cmd`, environment configs, domain registration, example routes, and tests. |
|
|
14
|
+
| Module generation | Add flat feature modules under `domain/<module>/` using Router -> Controller -> Service -> Model boundaries. |
|
|
15
|
+
| Persistent CRUD | Generate MySQL or MongoDB CRUD modules backed by Gorig `domainx/dx`, with tests, docs, and non-secret config skeletons. |
|
|
16
|
+
| API documentation | Generate OpenAPI/Redoc documentation for generated HTTP modules. |
|
|
17
|
+
| AI skill installation | Install the bundled `gorig-backend` skill so Codex or Claude can work with Gorig projects using framework-aware rules. |
|
|
18
|
+
| Framework development | Generate projects against a local Gorig checkout with `--gorig-replace` when developing the framework itself. |
|
|
4
19
|
|
|
5
20
|
## Installation
|
|
6
21
|
|
|
7
|
-
|
|
22
|
+
Run without installing globally:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
npx gorig-cli@latest <command>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Or install globally:
|
|
8
29
|
|
|
9
30
|
```sh
|
|
10
31
|
npm install -g gorig-cli
|
|
32
|
+
gorig-cli <command>
|
|
11
33
|
```
|
|
12
34
|
|
|
13
|
-
|
|
35
|
+
## Create a New Backend
|
|
14
36
|
|
|
15
37
|
```sh
|
|
16
|
-
npx gorig-cli@latest
|
|
38
|
+
npx gorig-cli@latest init my-new-project --no-start
|
|
17
39
|
```
|
|
18
40
|
|
|
19
|
-
|
|
41
|
+
Or with a global install:
|
|
20
42
|
|
|
21
|
-
|
|
43
|
+
```sh
|
|
44
|
+
gorig-cli init my-new-project --no-start
|
|
45
|
+
```
|
|
22
46
|
|
|
23
|
-
|
|
47
|
+
The generated project includes:
|
|
48
|
+
|
|
49
|
+
- one `_cmd` entry point
|
|
50
|
+
- `local`, `dev`, and `prod` configuration
|
|
51
|
+
- `domain/init.go` registration
|
|
52
|
+
- an example `domain/hello` module
|
|
53
|
+
- tests under `test/`
|
|
54
|
+
- no required MySQL, MongoDB, or Redis dependency in the basic profile
|
|
55
|
+
|
|
56
|
+
Useful automation options:
|
|
24
57
|
|
|
25
58
|
```sh
|
|
26
|
-
gorig-cli init my-new-project
|
|
59
|
+
gorig-cli init my-new-project \
|
|
60
|
+
--module example.com/my-new-project \
|
|
61
|
+
--gorig-version latest \
|
|
62
|
+
--port 9527 \
|
|
63
|
+
--no-start
|
|
27
64
|
```
|
|
28
65
|
|
|
29
|
-
|
|
66
|
+
For framework development against a local checkout:
|
|
30
67
|
|
|
31
68
|
```sh
|
|
32
|
-
|
|
69
|
+
gorig-cli init my-new-project \
|
|
70
|
+
--gorig-replace ../gorig \
|
|
71
|
+
--no-start \
|
|
72
|
+
--no-git
|
|
33
73
|
```
|
|
34
74
|
|
|
35
|
-
|
|
75
|
+
Use `--force` only when an existing non-empty destination may be replaced. Use `--start` to start immediately; otherwise initialization is non-interactive and does not start the service.
|
|
36
76
|
|
|
37
|
-
|
|
77
|
+
## Add a Module
|
|
38
78
|
|
|
39
|
-
|
|
79
|
+
Run from the generated project root:
|
|
80
|
+
|
|
81
|
+
```sh
|
|
82
|
+
npx gorig-cli@latest create user
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Or with a global install:
|
|
40
86
|
|
|
41
87
|
```sh
|
|
42
88
|
gorig-cli create user
|
|
43
89
|
```
|
|
44
90
|
|
|
45
|
-
|
|
91
|
+
This creates:
|
|
92
|
+
|
|
93
|
+
```text
|
|
94
|
+
domain/user/
|
|
95
|
+
├── router.go
|
|
96
|
+
├── controller.go
|
|
97
|
+
├── service.go
|
|
98
|
+
├── dto.go
|
|
99
|
+
└── model/
|
|
100
|
+
└── user.go
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The generated basic routes are `GET /user/info` and `POST /user/echo`.
|
|
104
|
+
|
|
105
|
+
## Generate Persistent CRUD
|
|
106
|
+
|
|
107
|
+
Choose the storage backend explicitly:
|
|
46
108
|
|
|
47
109
|
```sh
|
|
48
|
-
|
|
110
|
+
# MySQL CRUD module, with HTTP routes enabled by default
|
|
111
|
+
gorig-cli create order --crud --db mysql --db-name Main
|
|
112
|
+
|
|
113
|
+
# MongoDB CRUD module
|
|
114
|
+
gorig-cli create order --crud --db mongo --db-name main
|
|
115
|
+
|
|
116
|
+
# Service/model CRUD only, without router/controller/doc HTTP adapter
|
|
117
|
+
gorig-cli create order --crud --db mysql --no-http
|
|
49
118
|
```
|
|
50
119
|
|
|
51
|
-
|
|
120
|
+
Persistent CRUD generation currently supports MySQL and MongoDB. The generated code compiles without a live database, but effect-level create/list/page/update/delete verification requires a matching development database configuration.
|
|
52
121
|
|
|
53
|
-
|
|
122
|
+
The CRUD generator preserves existing named connections and adds non-secret configuration skeletons to `_bin/local.yaml`, `_bin/dev.yaml`, `_bin/prod.yaml`, and `test/_bin/local.yaml`.
|
|
54
123
|
|
|
55
|
-
|
|
124
|
+
After filling local values or exporting the documented `GORIG_...` variables, run:
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
go test -tags=integration,mysql ./test/... -v
|
|
128
|
+
go test -tags=integration,mongo ./test/... -v
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Generate API Documentation
|
|
56
132
|
|
|
57
133
|
```sh
|
|
58
134
|
# Generate documentation for all modules
|
|
@@ -69,47 +145,60 @@ npx gorig-cli@latest doc
|
|
|
69
145
|
npx gorig-cli@latest doc user
|
|
70
146
|
```
|
|
71
147
|
|
|
72
|
-
After generating
|
|
148
|
+
After generating documentation, access it through:
|
|
149
|
+
|
|
150
|
+
```text
|
|
73
151
|
http://127.0.0.1:8080/redoc.html
|
|
152
|
+
```
|
|
74
153
|
|
|
75
|
-
|
|
154
|
+
## Install Gorig Backend Skill
|
|
76
155
|
|
|
77
|
-
|
|
156
|
+
The CLI bundles the `gorig-backend` skill for Codex and Claude. Install it when you want AI agents to implement, review, test, or troubleshoot Gorig projects with framework-aware rules.
|
|
78
157
|
|
|
79
158
|
```sh
|
|
80
|
-
#
|
|
81
|
-
gorig-cli skill install all
|
|
82
|
-
|
|
83
|
-
# Install only the Codex skill
|
|
159
|
+
# Codex global skill
|
|
84
160
|
gorig-cli skill install codex
|
|
85
161
|
|
|
86
|
-
#
|
|
87
|
-
gorig-cli skill install
|
|
162
|
+
# Codex and Claude global skills
|
|
163
|
+
gorig-cli skill install all
|
|
88
164
|
|
|
89
|
-
#
|
|
90
|
-
gorig-cli skill install
|
|
165
|
+
# Codex skill stored in the current repository
|
|
166
|
+
gorig-cli skill install codex project
|
|
91
167
|
```
|
|
92
168
|
|
|
93
|
-
|
|
169
|
+
The install scope defaults to `user`. Use `project` only when the skill should be stored in the current repository.
|
|
94
170
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
npx gorig-cli@latest skill install claude project
|
|
171
|
+
Example prompts:
|
|
172
|
+
|
|
173
|
+
```text
|
|
174
|
+
Use the gorig-backend skill to add a MySQL order CRUD module with tests and API docs.
|
|
100
175
|
```
|
|
101
176
|
|
|
102
|
-
|
|
177
|
+
```text
|
|
178
|
+
Use the gorig-backend skill to review startup, routing, config, and middleware usage.
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
```text
|
|
182
|
+
Use the gorig-backend skill to add login, protected routes, logout, and security tests.
|
|
183
|
+
```
|
|
103
184
|
|
|
104
|
-
|
|
185
|
+
## Run the Project
|
|
105
186
|
|
|
106
187
|
```sh
|
|
107
188
|
cd my-new-project
|
|
108
|
-
go run _cmd
|
|
189
|
+
GORIG_SYS_MODE=local go run ./_cmd
|
|
109
190
|
```
|
|
110
191
|
|
|
111
192
|
Or run it after building:
|
|
112
193
|
|
|
113
194
|
```sh
|
|
114
|
-
go build -o my-new-project _cmd/main.go
|
|
195
|
+
go build -o my-new-project _cmd/main.go
|
|
196
|
+
GORIG_SYS_MODE=local ./my-new-project
|
|
115
197
|
```
|
|
198
|
+
|
|
199
|
+
## Verification Notes
|
|
200
|
+
|
|
201
|
+
- Basic project generation is dependency-light and should build without MySQL, MongoDB, or Redis.
|
|
202
|
+
- Persistent CRUD is generated for MySQL and MongoDB.
|
|
203
|
+
- Database and Redis behavior should be verified against configured development infrastructure.
|
|
204
|
+
- Remote deployment or production mutation should be performed only after explicit authorization.
|