@optima-chat/dev-skills 0.7.26 → 0.7.27
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/settings.local.json +51 -0
- 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/dist/bin/helpers/generate-test-token.js +0 -0
- package/dist/bin/helpers/query-db.js +0 -0
- package/dist/bin/helpers/show-env.js +0 -0
- 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
|
@@ -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
|
+
}
|
|
@@ -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
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|