gorig-cli 1.0.25 → 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
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,61 +1,71 @@
|
|
|
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
4
|
|
|
5
|
-
|
|
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
6
|
|
|
7
|
-
|
|
7
|
+
Main Gorig framework repository: [https://github.com/jom-io/gorig](https://github.com/jom-io/gorig)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## What It Does
|
|
10
|
+
|
|
11
|
+
| Capability | Description |
|
|
10
12
|
|---|---|
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
|
|
|
14
|
-
|
|
|
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. |
|
|
15
19
|
|
|
16
20
|
## Installation
|
|
17
21
|
|
|
18
|
-
|
|
22
|
+
Run without installing globally:
|
|
19
23
|
|
|
20
24
|
```sh
|
|
21
|
-
|
|
25
|
+
npx gorig-cli@latest <command>
|
|
22
26
|
```
|
|
23
27
|
|
|
24
|
-
Or
|
|
28
|
+
Or install globally:
|
|
25
29
|
|
|
26
30
|
```sh
|
|
27
|
-
|
|
31
|
+
npm install -g gorig-cli
|
|
32
|
+
gorig-cli <command>
|
|
28
33
|
```
|
|
29
34
|
|
|
30
|
-
##
|
|
31
|
-
|
|
32
|
-
### Initialize a Runnable Project
|
|
33
|
-
|
|
34
|
-
Use the `init` command to create a new project:
|
|
35
|
+
## Create a New Backend
|
|
35
36
|
|
|
36
37
|
```sh
|
|
37
|
-
gorig-cli init my-new-project --
|
|
38
|
+
npx gorig-cli@latest init my-new-project --no-start
|
|
38
39
|
```
|
|
39
40
|
|
|
40
|
-
Or
|
|
41
|
+
Or with a global install:
|
|
41
42
|
|
|
42
43
|
```sh
|
|
43
|
-
|
|
44
|
+
gorig-cli init my-new-project --no-start
|
|
44
45
|
```
|
|
45
46
|
|
|
46
|
-
|
|
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
|
|
47
55
|
|
|
48
56
|
Useful automation options:
|
|
49
57
|
|
|
50
58
|
```sh
|
|
51
|
-
# Use a custom Go module and base port
|
|
52
59
|
gorig-cli init my-new-project \
|
|
53
60
|
--module example.com/my-new-project \
|
|
54
|
-
--gorig-version
|
|
61
|
+
--gorig-version latest \
|
|
55
62
|
--port 9527 \
|
|
56
63
|
--no-start
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
For framework development against a local checkout:
|
|
57
67
|
|
|
58
|
-
|
|
68
|
+
```sh
|
|
59
69
|
gorig-cli init my-new-project \
|
|
60
70
|
--gorig-replace ../gorig \
|
|
61
71
|
--no-start \
|
|
@@ -64,21 +74,21 @@ gorig-cli init my-new-project \
|
|
|
64
74
|
|
|
65
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.
|
|
66
76
|
|
|
67
|
-
|
|
77
|
+
## Add a Module
|
|
68
78
|
|
|
69
|
-
|
|
79
|
+
Run from the generated project root:
|
|
70
80
|
|
|
71
81
|
```sh
|
|
72
|
-
gorig-cli create user
|
|
82
|
+
npx gorig-cli@latest create user
|
|
73
83
|
```
|
|
74
84
|
|
|
75
|
-
Or
|
|
85
|
+
Or with a global install:
|
|
76
86
|
|
|
77
87
|
```sh
|
|
78
|
-
|
|
88
|
+
gorig-cli create user
|
|
79
89
|
```
|
|
80
90
|
|
|
81
|
-
This creates
|
|
91
|
+
This creates:
|
|
82
92
|
|
|
83
93
|
```text
|
|
84
94
|
domain/user/
|
|
@@ -90,11 +100,11 @@ domain/user/
|
|
|
90
100
|
└── user.go
|
|
91
101
|
```
|
|
92
102
|
|
|
93
|
-
The generated routes are `GET /user/info` and `POST /user/echo`.
|
|
103
|
+
The generated basic routes are `GET /user/info` and `POST /user/echo`.
|
|
94
104
|
|
|
95
|
-
|
|
105
|
+
## Generate Persistent CRUD
|
|
96
106
|
|
|
97
|
-
|
|
107
|
+
Choose the storage backend explicitly:
|
|
98
108
|
|
|
99
109
|
```sh
|
|
100
110
|
# MySQL CRUD module, with HTTP routes enabled by default
|
|
@@ -109,11 +119,16 @@ gorig-cli create order --crud --db mysql --no-http
|
|
|
109
119
|
|
|
110
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.
|
|
111
121
|
|
|
112
|
-
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`.
|
|
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`.
|
|
113
123
|
|
|
114
|
-
|
|
124
|
+
After filling local values or exporting the documented `GORIG_...` variables, run:
|
|
115
125
|
|
|
116
|
-
|
|
126
|
+
```sh
|
|
127
|
+
go test -tags=integration,mysql ./test/... -v
|
|
128
|
+
go test -tags=integration,mongo ./test/... -v
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Generate API Documentation
|
|
117
132
|
|
|
118
133
|
```sh
|
|
119
134
|
# Generate documentation for all modules
|
|
@@ -130,36 +145,30 @@ npx gorig-cli@latest doc
|
|
|
130
145
|
npx gorig-cli@latest doc user
|
|
131
146
|
```
|
|
132
147
|
|
|
133
|
-
After generating
|
|
134
|
-
http://127.0.0.1:8080/redoc.html
|
|
148
|
+
After generating documentation, access it through:
|
|
135
149
|
|
|
136
|
-
|
|
150
|
+
```text
|
|
151
|
+
http://127.0.0.1:8080/redoc.html
|
|
152
|
+
```
|
|
137
153
|
|
|
138
|
-
|
|
154
|
+
## Install Gorig Backend Skill
|
|
139
155
|
|
|
140
|
-
|
|
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.
|
|
141
157
|
|
|
142
158
|
```sh
|
|
159
|
+
# Codex global skill
|
|
143
160
|
gorig-cli skill install codex
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
Install both Codex and Claude skills globally:
|
|
147
161
|
|
|
148
|
-
|
|
162
|
+
# Codex and Claude global skills
|
|
149
163
|
gorig-cli skill install all
|
|
150
|
-
```
|
|
151
164
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
```sh
|
|
165
|
+
# Codex skill stored in the current repository
|
|
155
166
|
gorig-cli skill install codex project
|
|
156
167
|
```
|
|
157
168
|
|
|
158
169
|
The install scope defaults to `user`. Use `project` only when the skill should be stored in the current repository.
|
|
159
170
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
After installing the skill, open a Gorig project in Codex or Claude and ask for framework-specific backend work:
|
|
171
|
+
Example prompts:
|
|
163
172
|
|
|
164
173
|
```text
|
|
165
174
|
Use the gorig-backend skill to add a MySQL order CRUD module with tests and API docs.
|
|
@@ -173,9 +182,7 @@ Use the gorig-backend skill to review startup, routing, config, and middleware u
|
|
|
173
182
|
Use the gorig-backend skill to add login, protected routes, logout, and security tests.
|
|
174
183
|
```
|
|
175
184
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
After entering the project directory, you can run the project using the following commands:
|
|
185
|
+
## Run the Project
|
|
179
186
|
|
|
180
187
|
```sh
|
|
181
188
|
cd my-new-project
|
|
@@ -185,21 +192,13 @@ GORIG_SYS_MODE=local go run ./_cmd
|
|
|
185
192
|
Or run it after building:
|
|
186
193
|
|
|
187
194
|
```sh
|
|
188
|
-
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
|
|
189
197
|
```
|
|
190
198
|
|
|
191
|
-
##
|
|
192
|
-
|
|
193
|
-
- Dependency-free project bootstrap with `local`, `dev`, and `prod` configuration.
|
|
194
|
-
- Flat feature-first module generation under `domain/<module>/`.
|
|
195
|
-
- MySQL and MongoDB CRUD generation through Gorig `domainx/dx`.
|
|
196
|
-
- API documentation generation for generated HTTP modules.
|
|
197
|
-
- Skill installation for Codex and Claude from one canonical bundled source.
|
|
198
|
-
- Skill references and fixtures for cache, scheduled tasks, messaging, SSE, authentication, security, and outbound networking.
|
|
199
|
-
|
|
200
|
-
## Current Boundaries
|
|
199
|
+
## Verification Notes
|
|
201
200
|
|
|
202
|
-
-
|
|
203
|
-
-
|
|
204
|
-
-
|
|
205
|
-
-
|
|
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.
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@ Use this workflow when creating a new locally runnable Gorig backend.
|
|
|
7
7
|
Confirm or infer safely:
|
|
8
8
|
|
|
9
9
|
- Project directory and Go module name.
|
|
10
|
-
- Gorig version: preserve a requested version; otherwise use
|
|
10
|
+
- Gorig version: preserve a requested version; otherwise use `latest` and report the resolution.
|
|
11
11
|
- Whether an existing non-empty directory may be replaced. Never pass `--force` without explicit authorization.
|
|
12
12
|
- Local base port.
|
|
13
13
|
- Git initialization is a post-generation skill step. Ask after generation and verification; do not let the CLI initialize Git implicitly.
|
|
@@ -27,7 +27,7 @@ When `gorig-cli` is installed:
|
|
|
27
27
|
```sh
|
|
28
28
|
gorig-cli init demo-api \
|
|
29
29
|
--module example.com/demo-api \
|
|
30
|
-
--gorig-version
|
|
30
|
+
--gorig-version latest \
|
|
31
31
|
--port 9527 \
|
|
32
32
|
--no-start \
|
|
33
33
|
--no-git
|
|
@@ -38,7 +38,7 @@ Unreleased sibling-checkout validation:
|
|
|
38
38
|
```sh
|
|
39
39
|
node ../gorig-cli/bin/cli.js init demo-api \
|
|
40
40
|
--module example.com/demo-api \
|
|
41
|
-
--gorig-version
|
|
41
|
+
--gorig-version latest \
|
|
42
42
|
--port 9527 \
|
|
43
43
|
--no-start \
|
|
44
44
|
--no-git
|