@optima-chat/dev-skills 0.7.26 → 0.7.28
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/.claude/commands/logs.md +27 -0
- package/.claude/commands/query-db.md +17 -1
- package/.claude/settings.local.json +51 -0
- package/.claude/skills/query-db/SKILL.md +16 -1
- package/.claude/skills/show-env/SKILL.md +30 -3
- package/.codex/skills/generate-test-token/SKILL.md +33 -0
- package/.codex/skills/grant-credits/SKILL.md +28 -0
- package/.codex/skills/grant-subscription/SKILL.md +29 -0
- package/.codex/skills/logs/SKILL.md +40 -0
- package/.codex/skills/query-db/SKILL.md +39 -0
- package/.codex/skills/read-code/SKILL.md +35 -0
- package/.codex/skills/restart-ecs/SKILL.md +22 -0
- package/.codex/skills/show-env/SKILL.md +27 -0
- package/.codex/skills/use-commerce-cli/SKILL.md +29 -0
- package/AGENTS.md +58 -0
- package/README.md +12 -2
- package/bin/helpers/query-db.ts +21 -1
- package/bin/helpers/show-env.ts +18 -6
- package/dist/bin/helpers/generate-test-token.js +0 -0
- package/dist/bin/helpers/query-db.js +21 -1
- package/dist/bin/helpers/show-env.js +18 -6
- package/docs/COMMANDS_DESIGN.md +394 -0
- package/docs/TECHNICAL_DESIGN.md +613 -0
- package/docs/codex-migration.md +44 -0
- package/package.json +10 -7
- package/scripts/install.js +23 -0
package/.claude/commands/logs.md
CHANGED
|
@@ -29,13 +29,22 @@
|
|
|
29
29
|
- `ai-shell-web-ui` - Shell Web UI
|
|
30
30
|
- `optima-scout` - 产品研究工具
|
|
31
31
|
- `optima-store` - 商城前端(仅 Stage)
|
|
32
|
+
- `ads-backend` - Google Ads API 代理服务
|
|
33
|
+
- `ads-worker` - Ads 对账后台任务
|
|
34
|
+
- `amazon-backend` - Amazon SP-API 集成服务
|
|
35
|
+
- `shopify-backend` - Shopify 店铺管理服务
|
|
32
36
|
- `commerce-rq-worker` - RQ 后台任务
|
|
33
37
|
- `commerce-rq-scheduler` - RQ 定时调度
|
|
38
|
+
- `gateway-core` - Gateway 核心服务
|
|
39
|
+
- `gw-admin` - Gateway 管理后台
|
|
40
|
+
- `optima-channels` - Channels 服务
|
|
34
41
|
- `optima-logistics` - 物流服务(仅 Stage/Prod)
|
|
35
42
|
- `billing` - 计费服务(仅 Stage/Prod)
|
|
36
43
|
- `browser-backend` - 浏览器自动化服务(仅 Stage/Prod)
|
|
37
44
|
- `optima-generation` - 内容生成服务(仅 Stage/Prod)
|
|
38
45
|
- `optima-generation-worker` - 内容生成 Worker(仅 Stage/Prod)
|
|
46
|
+
- `optima-sentinel` - Sentinel API(仅 Stage/Prod)
|
|
47
|
+
- `optima-sentinel-worker` - Sentinel 后台任务(仅 Stage/Prod)
|
|
39
48
|
- `lines` (可选): 显示行数,默认 50
|
|
40
49
|
- `environment` (可选): 环境,默认 ci
|
|
41
50
|
- `ci` - CI 持续集成环境(开发环境,默认)
|
|
@@ -129,13 +138,22 @@ aws logs get-log-events --log-group-name /ecs/commerce-backend-stage --log-strea
|
|
|
129
138
|
- `ai-shell-web-ui` → `/ecs/ai-shell-web-ui-stage`
|
|
130
139
|
- `optima-scout` → `/ecs/optima-scout-stage`
|
|
131
140
|
- `optima-store` → `/ecs/optima-store-stage`
|
|
141
|
+
- `ads-backend` → `/ecs/ads-backend-stage`
|
|
142
|
+
- `ads-worker` → `/ecs/ads-worker-stage`
|
|
143
|
+
- `amazon-backend` → `/ecs/amazon-backend-stage`
|
|
144
|
+
- `shopify-backend` → `/ecs/shopify-backend-stage`
|
|
132
145
|
- `commerce-rq-worker` → `/ecs/commerce-rq-worker-stage`
|
|
133
146
|
- `commerce-rq-scheduler` → `/ecs/commerce-rq-scheduler-stage`
|
|
147
|
+
- `gateway-core` → `/ecs/gateway-core-stage`
|
|
148
|
+
- `gw-admin` → `/ecs/gw-admin-stage`
|
|
149
|
+
- `optima-channels` → `/ecs/optima-channels-stage`
|
|
134
150
|
- `optima-logistics` → `/ecs/optima-logistics-stage`
|
|
135
151
|
- `billing` → `/ecs/billing-stage`
|
|
136
152
|
- `browser-backend` → `/ecs/browser-backend-stage`
|
|
137
153
|
- `optima-generation` → `/ecs/optima-generation-stage`
|
|
138
154
|
- `optima-generation-worker` → `/ecs/optima-generation-worker-stage`
|
|
155
|
+
- `optima-sentinel` → `/ecs/optima-sentinel-stage`
|
|
156
|
+
- `optima-sentinel-worker` → `/ecs/optima-sentinel-worker-stage`
|
|
139
157
|
|
|
140
158
|
### 2. Prod 环境(environment = "prod")
|
|
141
159
|
|
|
@@ -172,13 +190,22 @@ aws logs get-log-events --log-group-name /ecs/commerce-backend-prod --log-stream
|
|
|
172
190
|
- `session-gateway` → `/ecs/session-gateway-prod`
|
|
173
191
|
- `ai-shell-web-ui` → `/ecs/ai-shell-web-ui-prod`
|
|
174
192
|
- `optima-scout` → `/ecs/optima-scout-prod`
|
|
193
|
+
- `ads-backend` → `/ecs/ads-backend-prod`
|
|
194
|
+
- `ads-worker` → `/ecs/ads-worker-prod`
|
|
195
|
+
- `amazon-backend` → `/ecs/amazon-backend-prod`
|
|
196
|
+
- `shopify-backend` → `/ecs/shopify-backend-prod`
|
|
175
197
|
- `commerce-rq-worker` → `/ecs/commerce-rq-worker-prod`
|
|
176
198
|
- `commerce-rq-scheduler` → `/ecs/commerce-rq-scheduler-prod`
|
|
199
|
+
- `gateway-core` → `/ecs/gateway-core-prod`
|
|
200
|
+
- `gw-admin` → `/ecs/gw-admin-prod`
|
|
201
|
+
- `optima-channels` → `/ecs/optima-channels-prod`
|
|
177
202
|
- `optima-logistics` → `/ecs/optima-logistics-prod`
|
|
178
203
|
- `billing` → `/ecs/billing-prod`
|
|
179
204
|
- `browser-backend` → `/ecs/browser-backend-prod`
|
|
180
205
|
- `optima-generation` → `/ecs/optima-generation-prod`
|
|
181
206
|
- `optima-generation-worker` → `/ecs/optima-generation-worker-prod`
|
|
207
|
+
- `optima-sentinel` → `/ecs/optima-sentinel-prod`
|
|
208
|
+
- `optima-sentinel-worker` → `/ecs/optima-sentinel-worker-prod`
|
|
182
209
|
|
|
183
210
|
**注意**: `optima-store` 仅在 Stage 环境部署
|
|
184
211
|
|
|
@@ -49,8 +49,12 @@ optima-query-db commerce-backend "SELECT * FROM products LIMIT 5" prod
|
|
|
49
49
|
- `session-gateway` - AI Shell 网关数据库
|
|
50
50
|
- `optima-logistics` - 物流服务数据库
|
|
51
51
|
- `billing` - 计费服务数据库
|
|
52
|
+
- `ads-backend` - Google Ads API 代理服务数据库
|
|
53
|
+
- `amazon-backend` - Amazon SP-API 集成服务数据库
|
|
52
54
|
- `browser-backend` - 浏览器自动化服务数据库
|
|
55
|
+
- `shopify-backend` - Shopify 店铺管理服务数据库
|
|
53
56
|
- `optima-generation` - 内容生成服务数据库
|
|
57
|
+
- `optima-sentinel` - Sentinel 自动化监控数据库
|
|
54
58
|
- `sql` (必需): SQL 查询语句(用引号包裹)
|
|
55
59
|
- `environment` (可选): 环境,默认 ci
|
|
56
60
|
- `ci` - CI 持续集成环境(开发环境,默认)
|
|
@@ -253,18 +257,30 @@ pkill -f "ssh.*15432:${DATABASE_HOST}:5432"
|
|
|
253
257
|
- 数据库: `optima_billing_stage`
|
|
254
258
|
- 凭证: Infisical `/services/billing` → `DATABASE_URL`
|
|
255
259
|
|
|
260
|
+
- `ads-backend`:
|
|
261
|
+
- 凭证: Infisical `/services/optima-ads` → `DATABASE_URL`
|
|
262
|
+
|
|
263
|
+
- `amazon-backend`:
|
|
264
|
+
- 凭证: Infisical `/services/optima-amazon` → `DATABASE_URL`
|
|
265
|
+
|
|
256
266
|
- `browser-backend`:
|
|
257
267
|
- 数据库: `optima_stage_browser`
|
|
258
268
|
- 凭证: Infisical `/services/browser-backend` → `DATABASE_URL`
|
|
259
269
|
|
|
270
|
+
- `shopify-backend`:
|
|
271
|
+
- 凭证: Infisical `/services/shopify-backend` → `DATABASE_URL`
|
|
272
|
+
|
|
260
273
|
- `optima-generation`:
|
|
261
274
|
- 数据库: `optima_generation_stage`
|
|
262
275
|
- 凭证: Infisical `/services/optima-generation` → `DATABASE_URL`
|
|
263
276
|
|
|
277
|
+
- `optima-sentinel`:
|
|
278
|
+
- 凭证: Infisical `/services/optima-sentinel` → `DATABASE_URL`
|
|
279
|
+
|
|
264
280
|
**说明**:
|
|
265
281
|
- Infisical 配置从 GitHub Variables 获取
|
|
266
282
|
- 数据库密钥从 Infisical 动态获取(项目: optima-secrets-v2, 环境: staging, 路径: /shared-secrets/database-users)
|
|
267
|
-
- billing、browser-backend、optima-generation 的凭证存在各自服务路径的 DATABASE_URL 中
|
|
283
|
+
- billing、ads-backend、amazon-backend、browser-backend、shopify-backend、optima-generation、optima-sentinel 的凭证存在各自服务路径的 `DATABASE_URL` 中
|
|
268
284
|
- Stage RDS: `optima-stage-postgres.ctg866o0ehac.ap-southeast-1.rds.amazonaws.com`
|
|
269
285
|
- Shared EC2 IP: `3.0.210.113`
|
|
270
286
|
- SSH 隧道: 本地端口 `15432` → Shared EC2 → Stage RDS `5432`
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"WebSearch",
|
|
5
|
+
"WebFetch(domain:code.claude.com)",
|
|
6
|
+
"WebFetch(domain:platform.claude.com)",
|
|
7
|
+
"WebFetch(domain:github.com)",
|
|
8
|
+
"Bash(gh repo view:*)",
|
|
9
|
+
"Bash(gh repo clone:*)",
|
|
10
|
+
"Bash(gh repo list:*)",
|
|
11
|
+
"Read(//private/tmp/optima-docs/**)",
|
|
12
|
+
"Read(//tmp/optima-docs/**)",
|
|
13
|
+
"Bash(git init:*)",
|
|
14
|
+
"Bash(gh repo create:*)",
|
|
15
|
+
"Read(//private/tmp/optima-workspace/**)",
|
|
16
|
+
"Read(//tmp/optima-workspace/**)",
|
|
17
|
+
"Read(//tmp/optima-workspace/.claude/commands/**)",
|
|
18
|
+
"Bash(git add:*)",
|
|
19
|
+
"Bash(git push:*)",
|
|
20
|
+
"Bash(find:*)",
|
|
21
|
+
"Bash(git commit:*)",
|
|
22
|
+
"Bash(aws logs get-log-events:*)",
|
|
23
|
+
"Bash(npm install:*)",
|
|
24
|
+
"Bash(optima-dev-skills:*)",
|
|
25
|
+
"Bash(optima-generate-test-token:*)",
|
|
26
|
+
"Bash(optima-query-db:*)",
|
|
27
|
+
"Bash(gh variable set:*)",
|
|
28
|
+
"Bash(npm publish:*)",
|
|
29
|
+
"Bash(python3:*)",
|
|
30
|
+
"Bash(gh api:*)",
|
|
31
|
+
"Bash(curl -s http://auth.optima.chat/openapi.json)",
|
|
32
|
+
"Bash(curl -s https://auth.optima.chat/openapi.json)",
|
|
33
|
+
"Bash(cat:*)",
|
|
34
|
+
"Bash(node /Users/verypro/optima-dev-skills/scripts/install.js:*)",
|
|
35
|
+
"Bash(aws logs tail:*)",
|
|
36
|
+
"Bash(grep:*)",
|
|
37
|
+
"Bash(npm view:*)",
|
|
38
|
+
"Bash(npm version:*)",
|
|
39
|
+
"Bash(git checkout:*)",
|
|
40
|
+
"Bash(git pull:*)",
|
|
41
|
+
"Bash(node scripts/install.js:*)",
|
|
42
|
+
"Bash(gh issue:*)",
|
|
43
|
+
"Bash(npm run:*)",
|
|
44
|
+
"Bash(gh pr:*)",
|
|
45
|
+
"Bash(node:*)",
|
|
46
|
+
"Bash(echo \"exit: $?\")"
|
|
47
|
+
],
|
|
48
|
+
"deny": [],
|
|
49
|
+
"ask": []
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "query-db"
|
|
3
|
-
description: "当用户请求查询数据库、执行SQL、查看数据、统计数据、检查数据库、查询表、数据库查询时,使用此技能。支持 CI、Stage、Prod 三个环境的 commerce-backend、user-auth、agentic-chat、bi-backend、session-gateway
|
|
3
|
+
description: "当用户请求查询数据库、执行SQL、查看数据、统计数据、检查数据库、查询表、数据库查询时,使用此技能。支持 CI、Stage、Prod 三个环境的 commerce-backend、user-auth、agentic-chat、bi-backend、session-gateway、ads-backend、amazon-backend、shopify-backend、optima-sentinel 等服务的数据库查询。优先使用 optima-query-db CLI 工具。"
|
|
4
4
|
allowed-tools: ["Bash", "SlashCommand"]
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -77,6 +77,10 @@ optima-query-db commerce-backend "SELECT status, COUNT(*) FROM orders GROUP BY s
|
|
|
77
77
|
- `bi-backend` - BI 后端数据库
|
|
78
78
|
- `session-gateway` - AI Shell 网关数据库
|
|
79
79
|
- `optima-logistics` - 物流服务数据库
|
|
80
|
+
- `ads-backend` - Ads 数据库
|
|
81
|
+
- `amazon-backend` - Amazon 数据库
|
|
82
|
+
- `shopify-backend` - Shopify 数据库
|
|
83
|
+
- `optima-sentinel` - Sentinel 数据库
|
|
80
84
|
|
|
81
85
|
### 常用查询示例
|
|
82
86
|
|
|
@@ -198,6 +202,17 @@ optima-query-db commerce-backend "SELECT status, COUNT(*) FROM orders GROUP BY s
|
|
|
198
202
|
| session-gateway | `AI_SHELL_DB_USER` | `AI_SHELL_DB_PASSWORD` |
|
|
199
203
|
| optima-logistics | `LOGISTICS_DB_USER` | `LOGISTICS_DB_PASSWORD` |
|
|
200
204
|
|
|
205
|
+
**服务路径 `DATABASE_URL` 映射**:
|
|
206
|
+
| 服务 | Infisical 路径 |
|
|
207
|
+
|------|----------------|
|
|
208
|
+
| billing | `/services/billing` |
|
|
209
|
+
| ads-backend | `/services/optima-ads` |
|
|
210
|
+
| amazon-backend | `/services/optima-amazon` |
|
|
211
|
+
| browser-backend | `/services/browser-backend` |
|
|
212
|
+
| shopify-backend | `/services/shopify-backend` |
|
|
213
|
+
| optima-generation | `/services/optima-generation` |
|
|
214
|
+
| optima-sentinel | `/services/optima-sentinel` |
|
|
215
|
+
|
|
201
216
|
### RDS 连接
|
|
202
217
|
|
|
203
218
|
| 环境 | RDS Host | 本地端口 |
|
|
@@ -50,15 +50,31 @@ optima-show-env agentic-chat stage
|
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
**支持的服务**:
|
|
53
|
+
- `ads-backend` - Google Ads API 代理服务
|
|
54
|
+
- `ads-worker` - Ads 对账后台任务
|
|
55
|
+
- `ai-shell-web-ui` - Shell Web UI
|
|
56
|
+
- `amazon-backend` - Amazon SP-API 集成服务
|
|
57
|
+
- `bi-backend` - BI 后端
|
|
58
|
+
- `bi-dashboard` - BI 仪表板
|
|
59
|
+
- `billing` - 计费服务
|
|
60
|
+
- `browser-backend` - 浏览器自动化服务
|
|
53
61
|
- `commerce-backend` - 电商后端 API
|
|
62
|
+
- `commerce-rq-scheduler` - Commerce 定时任务
|
|
63
|
+
- `commerce-rq-worker` - Commerce 后台任务
|
|
64
|
+
- `gateway-core` - Gateway 核心服务
|
|
65
|
+
- `gw-admin` - Gateway 管理后台
|
|
54
66
|
- `user-auth` - 用户认证服务
|
|
67
|
+
- `user-auth-admin` - 用户认证管理后台
|
|
55
68
|
- `agentic-chat` - AI 聊天服务
|
|
56
|
-
- `bi` - BI 后端
|
|
57
69
|
- `session-gateway` - AI Shell 网关
|
|
70
|
+
- `optima-channels` - Channels 服务
|
|
71
|
+
- `optima-generation` - 内容生成服务
|
|
72
|
+
- `optima-logistics` - 物流服务
|
|
58
73
|
- `optima-store` - 商城前端
|
|
59
74
|
- `optima-scout` - 产品研究工具
|
|
60
|
-
- `
|
|
61
|
-
- `optima-
|
|
75
|
+
- `optima-sentinel` - Sentinel API
|
|
76
|
+
- `optima-sentinel-worker` - Sentinel 后台任务
|
|
77
|
+
- `shopify-backend` - Shopify 店铺管理服务
|
|
62
78
|
|
|
63
79
|
**支持的环境**:
|
|
64
80
|
- `stage` - Stage 预发布环境
|
|
@@ -130,6 +146,17 @@ optima-show-env commerce-backend stage --filter STRIPE
|
|
|
130
146
|
optima-show-env commerce-backend prod --filter STRIPE
|
|
131
147
|
```
|
|
132
148
|
|
|
149
|
+
### 场景 5:查看新 ECS 服务配置
|
|
150
|
+
|
|
151
|
+
**用户请求**:"帮我看一下 ads-backend / gateway-core / optima-sentinel 的配置"
|
|
152
|
+
|
|
153
|
+
**步骤**:
|
|
154
|
+
```bash
|
|
155
|
+
optima-show-env ads-backend stage --keys-only
|
|
156
|
+
optima-show-env gateway-core prod --filter REDIS
|
|
157
|
+
optima-show-env optima-sentinel prod --filter DATABASE
|
|
158
|
+
```
|
|
159
|
+
|
|
133
160
|
## 环境变量分类
|
|
134
161
|
|
|
135
162
|
### 常见环境变量类型
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "generate-test-token"
|
|
3
|
+
description: "Use when the user needs a test merchant account, an access token for API testing, or a temporary account for CI, Stage, or Prod verification."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Generate Test Access Tokens
|
|
7
|
+
|
|
8
|
+
Use this skill when the user needs a usable Optima merchant token for API testing.
|
|
9
|
+
|
|
10
|
+
## Preferred Command
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
optima-generate-test-token [options]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Examples
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
optima-generate-test-token
|
|
20
|
+
optima-generate-test-token --env stage
|
|
21
|
+
optima-generate-test-token --business-name "Demo Shop" --env prod
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Guidance
|
|
25
|
+
|
|
26
|
+
- Default to `ci`.
|
|
27
|
+
- The command handles merchant registration, OAuth token creation, and merchant profile setup.
|
|
28
|
+
- The command writes the token to a temporary file; report that path back to the user.
|
|
29
|
+
- For `prod`, remind the user that the created account will exist in the production system.
|
|
30
|
+
|
|
31
|
+
## Follow-up
|
|
32
|
+
|
|
33
|
+
Use the generated token with `commerce` CLI commands or `curl` requests.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "grant-credits"
|
|
3
|
+
description: "Use when the user wants to add bonus or referral credits to an Optima user without changing their subscription."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Grant Credits
|
|
7
|
+
|
|
8
|
+
Use this skill when the user asks to add credits directly.
|
|
9
|
+
|
|
10
|
+
## Preferred Command
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
optima-grant-credits <email> --amount <n> [options]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Examples
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
optima-grant-credits user@example.com --amount 100
|
|
20
|
+
optima-grant-credits user@example.com --amount 500 --env prod
|
|
21
|
+
optima-grant-credits user@example.com --amount 300 --type referral --env prod
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Guidance
|
|
25
|
+
|
|
26
|
+
- Default to `stage`.
|
|
27
|
+
- Confirm the email and amount before using `prod`.
|
|
28
|
+
- This operation appends credits and does not replace the user's subscription.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "grant-subscription"
|
|
3
|
+
description: "Use when the user wants to grant or change a subscription plan such as trial, starter, pro, or enterprise for an Optima user."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Grant Subscriptions
|
|
7
|
+
|
|
8
|
+
Use this skill when the user asks to open or change a subscription plan.
|
|
9
|
+
|
|
10
|
+
## Preferred Command
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
optima-grant-subscription <email> [options]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Examples
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
optima-grant-subscription user@example.com
|
|
20
|
+
optima-grant-subscription user@example.com --plan starter --months 3
|
|
21
|
+
optima-grant-subscription user@example.com --plan enterprise --env prod
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Guidance
|
|
25
|
+
|
|
26
|
+
- Default to `stage`.
|
|
27
|
+
- Confirm the user email before running on `prod`.
|
|
28
|
+
- This operation replaces existing subscription state and resets credits according to the selected plan.
|
|
29
|
+
- Use `optima-query-db` afterward if the user asks for verification.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "logs"
|
|
3
|
+
description: "Use when the user asks to inspect service logs, debug runtime failures, or compare CI, Stage, and Prod logs for Optima services."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Inspect Service Logs
|
|
7
|
+
|
|
8
|
+
Use this skill when the user needs service logs for debugging or operational checks.
|
|
9
|
+
|
|
10
|
+
## Preferred Flow
|
|
11
|
+
|
|
12
|
+
Use the local shell and follow the environment-specific workflow:
|
|
13
|
+
|
|
14
|
+
- `ci`: SSH to the shared CI host and read Docker Compose logs
|
|
15
|
+
- `stage`: read AWS CloudWatch logs from `/ecs/<service>-stage`
|
|
16
|
+
- `prod`: read AWS CloudWatch logs from `/ecs/<service>-prod` with `--region ap-southeast-1`
|
|
17
|
+
|
|
18
|
+
## Common Services
|
|
19
|
+
|
|
20
|
+
- `commerce-backend`
|
|
21
|
+
- `user-auth`
|
|
22
|
+
- `agentic-chat`
|
|
23
|
+
- `bi-backend`
|
|
24
|
+
- `session-gateway`
|
|
25
|
+
- `optima-scout`
|
|
26
|
+
- `billing`
|
|
27
|
+
- `browser-backend`
|
|
28
|
+
- `optima-generation`
|
|
29
|
+
|
|
30
|
+
## Guidance
|
|
31
|
+
|
|
32
|
+
- Default to `ci` unless the user clearly requests `stage` or `prod`.
|
|
33
|
+
- For `prod`, keep the query narrow and use the exact service the user asked for.
|
|
34
|
+
- When investigating an error, read enough context around the failure instead of only grepping a single line.
|
|
35
|
+
|
|
36
|
+
## Related Skills
|
|
37
|
+
|
|
38
|
+
- `query-db` for data verification after log analysis
|
|
39
|
+
- `show-env` for configuration-related failures
|
|
40
|
+
- `restart-ecs` for controlled service restarts
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "query-db"
|
|
3
|
+
description: "Use when the user asks to query Optima databases, inspect rows, validate data, or run SQL in CI, Stage, or Prod."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Query Databases
|
|
7
|
+
|
|
8
|
+
Use this skill for SQL queries against Optima service databases.
|
|
9
|
+
|
|
10
|
+
## Preferred Command
|
|
11
|
+
|
|
12
|
+
Always prefer:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
optima-query-db <service> "<sql>" [environment]
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Services
|
|
19
|
+
|
|
20
|
+
- `commerce-backend`
|
|
21
|
+
- `user-auth`
|
|
22
|
+
- `agentic-chat`
|
|
23
|
+
- `bi-backend`
|
|
24
|
+
- `session-gateway`
|
|
25
|
+
- `optima-logistics`
|
|
26
|
+
- `billing`
|
|
27
|
+
- `browser-backend`
|
|
28
|
+
- `optima-generation`
|
|
29
|
+
|
|
30
|
+
## Guidance
|
|
31
|
+
|
|
32
|
+
- Default to `ci` when the user does not specify an environment.
|
|
33
|
+
- For `prod`, restrict usage to focused `SELECT` queries.
|
|
34
|
+
- Prefer explicit columns and `LIMIT` over `SELECT *`.
|
|
35
|
+
- Use the CLI instead of rebuilding Infisical and SSH tunnel steps manually.
|
|
36
|
+
|
|
37
|
+
## Fallback
|
|
38
|
+
|
|
39
|
+
If the CLI is unavailable, fall back to the documented manual SSH/Infisical workflow from the repository docs or Claude skill content.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "read-code"
|
|
3
|
+
description: "Use when the user wants to inspect code, repository structure, implementation details, or compare repositories under the Optima-Chat GitHub organization."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Read Optima Repositories
|
|
7
|
+
|
|
8
|
+
Use this skill when the user asks to inspect code from another Optima repository.
|
|
9
|
+
|
|
10
|
+
## Preferred Tools
|
|
11
|
+
|
|
12
|
+
Use GitHub CLI against `Optima-Chat/<repo>`:
|
|
13
|
+
|
|
14
|
+
- `gh repo view`
|
|
15
|
+
- `gh api repos/Optima-Chat/<repo>/contents/...`
|
|
16
|
+
- `gh search code ... --repo Optima-Chat/<repo>`
|
|
17
|
+
|
|
18
|
+
## Common Repositories
|
|
19
|
+
|
|
20
|
+
- `commerce-backend`
|
|
21
|
+
- `user-auth`
|
|
22
|
+
- `mcp-host`
|
|
23
|
+
- `agentic-chat`
|
|
24
|
+
- `commerce-mcp`
|
|
25
|
+
- `shopify-mcp`
|
|
26
|
+
- `google-ads-mcp`
|
|
27
|
+
- `optima-store`
|
|
28
|
+
- `commerce-cli`
|
|
29
|
+
- `optima-terraform`
|
|
30
|
+
|
|
31
|
+
## Guidance
|
|
32
|
+
|
|
33
|
+
- Read `README.md` or `CLAUDE.md` first when present.
|
|
34
|
+
- For large files, use the GitHub `download_url` or raw content endpoint.
|
|
35
|
+
- Prefer targeted code search before opening many files.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "restart-ecs"
|
|
3
|
+
description: "Use when the user asks to restart or redeploy an ECS service in Stage or Prod."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Restart ECS Services
|
|
7
|
+
|
|
8
|
+
Use this skill when the user needs an ECS service restart.
|
|
9
|
+
|
|
10
|
+
## Preferred Workflow
|
|
11
|
+
|
|
12
|
+
Use AWS ECS `update-service --force-new-deployment` against the correct cluster:
|
|
13
|
+
|
|
14
|
+
- `optima-stage-cluster`
|
|
15
|
+
- `optima-prod-cluster`
|
|
16
|
+
|
|
17
|
+
## Guidance
|
|
18
|
+
|
|
19
|
+
- Default to `stage`.
|
|
20
|
+
- Confirm before restarting `prod`.
|
|
21
|
+
- Treat this as an operational change, not a debugging shortcut; read logs first when possible.
|
|
22
|
+
- After triggering the restart, check service deployment status if the user asks for confirmation.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "show-env"
|
|
3
|
+
description: "Use when the user asks to inspect environment variables, service configuration, or Infisical-backed settings for Stage or Prod."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Inspect Environment Configuration
|
|
7
|
+
|
|
8
|
+
Use this skill to inspect current shell environment variables or service configuration stored in Infisical.
|
|
9
|
+
|
|
10
|
+
## Preferred Command
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
optima-show-env <service> <stage|prod> [options]
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Common Options
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
optima-show-env commerce-backend stage --filter DATABASE
|
|
20
|
+
optima-show-env user-auth prod --keys-only
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Guidance
|
|
24
|
+
|
|
25
|
+
- For local shell variables, simple shell commands like `env` or `echo $VAR` are enough.
|
|
26
|
+
- For service configuration, prefer `optima-show-env` over raw Infisical API calls.
|
|
27
|
+
- If the user only needs key names, use `--keys-only` to avoid exposing values unnecessarily.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "use-commerce-cli"
|
|
3
|
+
description: "Use when the user wants to manage Optima commerce resources such as products, orders, inventory, collections, storefront content, or localization through the commerce CLI."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Use Commerce CLI
|
|
7
|
+
|
|
8
|
+
Use this skill when the user wants to manage store resources through the `commerce` CLI.
|
|
9
|
+
|
|
10
|
+
## Requirements
|
|
11
|
+
|
|
12
|
+
Set both:
|
|
13
|
+
|
|
14
|
+
- `OPTIMA_TOKEN`
|
|
15
|
+
- `OPTIMA_ENV`
|
|
16
|
+
|
|
17
|
+
## Example
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
OPTIMA_TOKEN=$(cat /tmp/optima-test-token-xxx.txt) \
|
|
21
|
+
OPTIMA_ENV=ci \
|
|
22
|
+
commerce product list
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Guidance
|
|
26
|
+
|
|
27
|
+
- If the user does not already have a token, use the `generate-test-token` skill first.
|
|
28
|
+
- Match `OPTIMA_ENV` to the token environment.
|
|
29
|
+
- Prefer explicit commands over broad destructive bulk actions.
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Optima Dev Skills For Codex
|
|
2
|
+
|
|
3
|
+
This repository provides shared development skills and CLI helpers for Optima engineers across `ci`, `stage`, and `prod`.
|
|
4
|
+
|
|
5
|
+
## Primary Entry Points
|
|
6
|
+
|
|
7
|
+
Prefer the installed CLI tools over reimplementing long shell workflows:
|
|
8
|
+
|
|
9
|
+
- `optima-query-db <service> "<sql>" [environment]`
|
|
10
|
+
- `optima-show-env <service> <stage|prod> [options]`
|
|
11
|
+
- `optima-generate-test-token [options]`
|
|
12
|
+
- `optima-grant-subscription <email> [options]`
|
|
13
|
+
- `optima-grant-credits <email> --amount <n> [options]`
|
|
14
|
+
|
|
15
|
+
For code-reading tasks across Optima repositories, use `gh` commands against `Optima-Chat/<repo>`.
|
|
16
|
+
|
|
17
|
+
## Installed Codex Skills
|
|
18
|
+
|
|
19
|
+
After `npm install -g @optima-chat/dev-skills`, this package installs skills under `~/.codex/skills/optima-dev/`:
|
|
20
|
+
|
|
21
|
+
- `logs`
|
|
22
|
+
- `query-db`
|
|
23
|
+
- `show-env`
|
|
24
|
+
- `generate-test-token`
|
|
25
|
+
- `read-code`
|
|
26
|
+
- `grant-subscription`
|
|
27
|
+
- `grant-credits`
|
|
28
|
+
- `restart-ecs`
|
|
29
|
+
- `use-commerce-cli`
|
|
30
|
+
|
|
31
|
+
## Tooling Assumptions
|
|
32
|
+
|
|
33
|
+
Most operational commands depend on local access to:
|
|
34
|
+
|
|
35
|
+
- `gh`
|
|
36
|
+
- `curl`
|
|
37
|
+
- `ssh` / `sshpass`
|
|
38
|
+
- `aws`
|
|
39
|
+
- `psql`
|
|
40
|
+
|
|
41
|
+
Some flows also require:
|
|
42
|
+
|
|
43
|
+
- GitHub Variables on `Optima-Chat/optima-dev-skills`
|
|
44
|
+
- Infisical access
|
|
45
|
+
- `~/.ssh/optima-ec2-key` for Stage/Prod database access
|
|
46
|
+
|
|
47
|
+
## Safety Rules
|
|
48
|
+
|
|
49
|
+
- Default to `ci` or `stage` when possible.
|
|
50
|
+
- Treat `prod` as read-only unless the user explicitly asks for a write action.
|
|
51
|
+
- For `prod`, prefer limited queries and targeted operational commands.
|
|
52
|
+
- Do not expose secrets unless the user explicitly asks to inspect them.
|
|
53
|
+
|
|
54
|
+
## Platform Notes
|
|
55
|
+
|
|
56
|
+
- Claude Code uses `.claude/commands` and `.claude/skills`.
|
|
57
|
+
- Codex uses the installed skills plus this repository guidance.
|
|
58
|
+
- The shared source of truth for actual behavior is the CLI/helper implementation under `bin/helpers/`.
|
package/README.md
CHANGED
|
@@ -10,9 +10,18 @@
|
|
|
10
10
|
npm install -g @optima-chat/dev-skills@latest
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
安装后会自动将 skills 复制到 `~/.
|
|
13
|
+
安装后会自动将 Claude 资源复制到 `~/.claude/`,并将 Codex skills 复制到 `~/.codex/skills/optima-dev/`。
|
|
14
14
|
|
|
15
|
-
安装后,`/logs` 命令和 `logs` skill
|
|
15
|
+
安装后,`/logs` 命令和 `logs` skill 会在 Claude Code 中可用;Codex 会同时获得对应的本地 skills。
|
|
16
|
+
|
|
17
|
+
## 🤖 Codex 支持
|
|
18
|
+
|
|
19
|
+
本仓库现在同时支持 **Claude Code** 和 **Codex**:
|
|
20
|
+
|
|
21
|
+
- **Claude Code** 使用 `.claude/commands` 和 `.claude/skills`
|
|
22
|
+
- **Codex** 使用安装到 `~/.codex/skills/optima-dev/` 的 skills,以及仓库内的 `AGENTS.md`
|
|
23
|
+
|
|
24
|
+
如果你设置了 `CODEX_HOME`,安装器会改为写入 `$CODEX_HOME/skills/optima-dev/`。
|
|
16
25
|
|
|
17
26
|
## 🎯 核心理念
|
|
18
27
|
|
|
@@ -102,6 +111,7 @@ Claude:
|
|
|
102
111
|
- ✅ 可在任何终端直接使用
|
|
103
112
|
- ✅ 自动注册账户、获取 token、设置 merchant profile(generate-test-token)
|
|
104
113
|
- ✅ Claude Code 的命令内部也使用这些工具
|
|
114
|
+
- ✅ Codex skills 也优先调用这些工具
|
|
105
115
|
|
|
106
116
|
## 🏗️ 项目结构
|
|
107
117
|
|