optimal-cli 1.0.1 → 1.1.0

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.
Files changed (185) hide show
  1. package/.claude-plugin/marketplace.json +18 -0
  2. package/.claude-plugin/plugin.json +10 -0
  3. package/.env.example +17 -0
  4. package/CLAUDE.md +67 -0
  5. package/COMMANDS.md +264 -0
  6. package/PUBLISH.md +70 -0
  7. package/agents/content-ops.md +2 -2
  8. package/agents/financial-ops.md +2 -2
  9. package/agents/infra-ops.md +2 -2
  10. package/apps/.gitkeep +0 -0
  11. package/bin/optimal.ts +1418 -0
  12. package/docs/MIGRATION_NEEDED.md +37 -0
  13. package/docs/plans/.gitkeep +0 -0
  14. package/docs/plans/optimal-cli-config-registry-v1.md +71 -0
  15. package/hooks/.gitkeep +0 -0
  16. package/lib/budget/projections.ts +561 -0
  17. package/lib/budget/scenarios.ts +312 -0
  18. package/lib/cms/publish-blog.ts +129 -0
  19. package/lib/cms/strapi-client.ts +302 -0
  20. package/lib/config/registry.ts +229 -0
  21. package/lib/config/schema.ts +58 -0
  22. package/lib/config.ts +247 -0
  23. package/lib/infra/.gitkeep +0 -0
  24. package/lib/infra/deploy.ts +70 -0
  25. package/lib/infra/migrate.ts +141 -0
  26. package/lib/kanban-obsidian.ts +232 -0
  27. package/lib/kanban-sync.ts +258 -0
  28. package/lib/kanban.ts +239 -0
  29. package/lib/newsletter/.gitkeep +0 -0
  30. package/lib/newsletter/distribute.ts +256 -0
  31. package/{dist/lib/newsletter/generate-insurance.d.ts → lib/newsletter/generate-insurance.ts} +24 -7
  32. package/lib/newsletter/generate.ts +735 -0
  33. package/lib/obsidian-tasks.ts +231 -0
  34. package/lib/returnpro/.gitkeep +0 -0
  35. package/lib/returnpro/anomalies.ts +258 -0
  36. package/lib/returnpro/audit.ts +194 -0
  37. package/lib/returnpro/diagnose.ts +400 -0
  38. package/lib/returnpro/kpis.ts +255 -0
  39. package/lib/returnpro/templates.ts +323 -0
  40. package/lib/returnpro/upload-income.ts +311 -0
  41. package/lib/returnpro/upload-netsuite.ts +696 -0
  42. package/lib/returnpro/upload-r1.ts +563 -0
  43. package/lib/social/post-generator.ts +468 -0
  44. package/lib/social/publish.ts +301 -0
  45. package/lib/social/scraper.ts +503 -0
  46. package/lib/supabase.ts +25 -0
  47. package/lib/transactions/delete-batch.ts +258 -0
  48. package/lib/transactions/ingest.ts +659 -0
  49. package/lib/transactions/stamp.ts +654 -0
  50. package/package.json +5 -18
  51. package/pnpm-workspace.yaml +3 -0
  52. package/scripts/check-table.ts +24 -0
  53. package/scripts/create-tables.ts +94 -0
  54. package/scripts/migrate-kanban.sh +28 -0
  55. package/scripts/migrate-v2.ts +78 -0
  56. package/scripts/migrate.ts +79 -0
  57. package/scripts/run-migration.ts +59 -0
  58. package/scripts/seed-board.ts +203 -0
  59. package/scripts/test-kanban.ts +21 -0
  60. package/skills/audit-financials/SKILL.md +33 -0
  61. package/skills/board-create/SKILL.md +28 -0
  62. package/skills/board-update/SKILL.md +27 -0
  63. package/skills/board-view/SKILL.md +27 -0
  64. package/skills/delete-batch/SKILL.md +77 -0
  65. package/skills/deploy/SKILL.md +40 -0
  66. package/skills/diagnose-months/SKILL.md +68 -0
  67. package/skills/distribute-newsletter/SKILL.md +58 -0
  68. package/skills/export-budget/SKILL.md +44 -0
  69. package/skills/export-kpis/SKILL.md +52 -0
  70. package/skills/generate-netsuite-template/SKILL.md +51 -0
  71. package/skills/generate-newsletter/SKILL.md +53 -0
  72. package/skills/generate-newsletter-insurance/SKILL.md +59 -0
  73. package/skills/generate-social-posts/SKILL.md +67 -0
  74. package/skills/health-check/SKILL.md +42 -0
  75. package/skills/ingest-transactions/SKILL.md +51 -0
  76. package/skills/manage-cms/SKILL.md +50 -0
  77. package/skills/manage-scenarios/SKILL.md +83 -0
  78. package/skills/migrate-db/SKILL.md +79 -0
  79. package/skills/preview-newsletter/SKILL.md +50 -0
  80. package/skills/project-budget/SKILL.md +60 -0
  81. package/skills/publish-blog/SKILL.md +70 -0
  82. package/skills/publish-social-posts/SKILL.md +70 -0
  83. package/skills/rate-anomalies/SKILL.md +62 -0
  84. package/skills/scrape-ads/SKILL.md +49 -0
  85. package/skills/stamp-transactions/SKILL.md +62 -0
  86. package/skills/upload-income-statements/SKILL.md +54 -0
  87. package/skills/upload-netsuite/SKILL.md +56 -0
  88. package/skills/upload-r1/SKILL.md +45 -0
  89. package/supabase/.temp/cli-latest +1 -0
  90. package/supabase/migrations/.gitkeep +0 -0
  91. package/supabase/migrations/20250305000001_create_agent_configs.sql +36 -0
  92. package/supabase/migrations/20260305111300_create_cli_config_registry.sql +22 -0
  93. package/supabase/migrations/20260306195000_create_kanban_tables.sql +97 -0
  94. package/tests/config-command-smoke.test.ts +395 -0
  95. package/tests/config-registry.test.ts +173 -0
  96. package/tsconfig.json +19 -0
  97. package/agents/profiles.json +0 -5
  98. package/dist/bin/optimal.d.ts +0 -2
  99. package/dist/bin/optimal.js +0 -1590
  100. package/dist/lib/assets/index.d.ts +0 -79
  101. package/dist/lib/assets/index.js +0 -153
  102. package/dist/lib/assets.d.ts +0 -20
  103. package/dist/lib/assets.js +0 -112
  104. package/dist/lib/auth/index.d.ts +0 -83
  105. package/dist/lib/auth/index.js +0 -146
  106. package/dist/lib/board/index.d.ts +0 -39
  107. package/dist/lib/board/index.js +0 -285
  108. package/dist/lib/board/types.d.ts +0 -111
  109. package/dist/lib/board/types.js +0 -1
  110. package/dist/lib/bot/claim.d.ts +0 -3
  111. package/dist/lib/bot/claim.js +0 -20
  112. package/dist/lib/bot/coordinator.d.ts +0 -27
  113. package/dist/lib/bot/coordinator.js +0 -178
  114. package/dist/lib/bot/heartbeat.d.ts +0 -6
  115. package/dist/lib/bot/heartbeat.js +0 -30
  116. package/dist/lib/bot/index.d.ts +0 -9
  117. package/dist/lib/bot/index.js +0 -6
  118. package/dist/lib/bot/protocol.d.ts +0 -12
  119. package/dist/lib/bot/protocol.js +0 -74
  120. package/dist/lib/bot/reporter.d.ts +0 -3
  121. package/dist/lib/bot/reporter.js +0 -27
  122. package/dist/lib/bot/skills.d.ts +0 -26
  123. package/dist/lib/bot/skills.js +0 -69
  124. package/dist/lib/budget/projections.d.ts +0 -115
  125. package/dist/lib/budget/projections.js +0 -384
  126. package/dist/lib/budget/scenarios.d.ts +0 -93
  127. package/dist/lib/budget/scenarios.js +0 -214
  128. package/dist/lib/cms/publish-blog.d.ts +0 -62
  129. package/dist/lib/cms/publish-blog.js +0 -74
  130. package/dist/lib/cms/strapi-client.d.ts +0 -123
  131. package/dist/lib/cms/strapi-client.js +0 -213
  132. package/dist/lib/config/registry.d.ts +0 -17
  133. package/dist/lib/config/registry.js +0 -182
  134. package/dist/lib/config/schema.d.ts +0 -31
  135. package/dist/lib/config/schema.js +0 -25
  136. package/dist/lib/config.d.ts +0 -55
  137. package/dist/lib/config.js +0 -206
  138. package/dist/lib/errors.d.ts +0 -25
  139. package/dist/lib/errors.js +0 -91
  140. package/dist/lib/format.d.ts +0 -28
  141. package/dist/lib/format.js +0 -98
  142. package/dist/lib/infra/deploy.d.ts +0 -29
  143. package/dist/lib/infra/deploy.js +0 -58
  144. package/dist/lib/infra/migrate.d.ts +0 -34
  145. package/dist/lib/infra/migrate.js +0 -103
  146. package/dist/lib/newsletter/distribute.d.ts +0 -52
  147. package/dist/lib/newsletter/distribute.js +0 -193
  148. package/dist/lib/newsletter/generate-insurance.js +0 -36
  149. package/dist/lib/newsletter/generate.d.ts +0 -104
  150. package/dist/lib/newsletter/generate.js +0 -571
  151. package/dist/lib/returnpro/anomalies.d.ts +0 -64
  152. package/dist/lib/returnpro/anomalies.js +0 -166
  153. package/dist/lib/returnpro/audit.d.ts +0 -32
  154. package/dist/lib/returnpro/audit.js +0 -147
  155. package/dist/lib/returnpro/diagnose.d.ts +0 -52
  156. package/dist/lib/returnpro/diagnose.js +0 -281
  157. package/dist/lib/returnpro/kpis.d.ts +0 -32
  158. package/dist/lib/returnpro/kpis.js +0 -192
  159. package/dist/lib/returnpro/templates.d.ts +0 -48
  160. package/dist/lib/returnpro/templates.js +0 -229
  161. package/dist/lib/returnpro/upload-income.d.ts +0 -25
  162. package/dist/lib/returnpro/upload-income.js +0 -235
  163. package/dist/lib/returnpro/upload-netsuite.d.ts +0 -37
  164. package/dist/lib/returnpro/upload-netsuite.js +0 -566
  165. package/dist/lib/returnpro/upload-r1.d.ts +0 -48
  166. package/dist/lib/returnpro/upload-r1.js +0 -398
  167. package/dist/lib/returnpro/validate.d.ts +0 -37
  168. package/dist/lib/returnpro/validate.js +0 -124
  169. package/dist/lib/social/meta.d.ts +0 -90
  170. package/dist/lib/social/meta.js +0 -160
  171. package/dist/lib/social/post-generator.d.ts +0 -83
  172. package/dist/lib/social/post-generator.js +0 -333
  173. package/dist/lib/social/publish.d.ts +0 -66
  174. package/dist/lib/social/publish.js +0 -226
  175. package/dist/lib/social/scraper.d.ts +0 -67
  176. package/dist/lib/social/scraper.js +0 -361
  177. package/dist/lib/supabase.d.ts +0 -4
  178. package/dist/lib/supabase.js +0 -20
  179. package/dist/lib/transactions/delete-batch.d.ts +0 -60
  180. package/dist/lib/transactions/delete-batch.js +0 -203
  181. package/dist/lib/transactions/ingest.d.ts +0 -43
  182. package/dist/lib/transactions/ingest.js +0 -555
  183. package/dist/lib/transactions/stamp.d.ts +0 -51
  184. package/dist/lib/transactions/stamp.js +0 -524
  185. package/docs/CLI-REFERENCE.md +0 -361
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
3
+ "name": "optimal-cli",
4
+ "description": "Optimal CLI plugin marketplace — unified skills for financial analytics, content marketing, and infrastructure",
5
+ "owner": {
6
+ "name": "Carlos Lenis",
7
+ "email": "95986651+clenisa@users.noreply.github.com"
8
+ },
9
+ "plugins": [
10
+ {
11
+ "name": "optimal-cli",
12
+ "description": "Unified CLI skills for Optimal's financial analytics, content marketing, and infrastructure operations. 29 skills across finance, CMS, newsletters, social media, transactions, budgets, and infrastructure.",
13
+ "category": "development",
14
+ "source": ".",
15
+ "homepage": "https://github.com/clenisa/optimal-cli"
16
+ }
17
+ ]
18
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "optimal-cli",
3
+ "description": "Unified CLI skills for Optimal's financial analytics, content marketing, and infrastructure operations.",
4
+ "version": "0.1.0",
5
+ "author": {
6
+ "name": "Carlos Lenis",
7
+ "email": "95986651+clenisa@users.noreply.github.com"
8
+ },
9
+ "keywords": ["finance", "fpa", "newsletter", "cms", "kanban", "cli"]
10
+ }
package/.env.example ADDED
@@ -0,0 +1,17 @@
1
+ # Kanban Board (OptimalOS Supabase)
2
+ OPTIMAL_SUPABASE_URL=https://hbfalrpswysryltysonm.supabase.co
3
+ OPTIMAL_SUPABASE_SERVICE_KEY=
4
+
5
+ # ReturnPro Financial Data
6
+ RETURNPRO_SUPABASE_URL=https://vvutttwunexshxkmygik.supabase.co
7
+ RETURNPRO_SUPABASE_SERVICE_KEY=
8
+
9
+ # Strapi CMS
10
+ STRAPI_URL=https://strapi.op-hub.com
11
+ STRAPI_API_TOKEN=
12
+
13
+ # Content Generation
14
+ GROQ_API_KEY=
15
+ GROQ_MODEL=llama-3.3-70b-versatile
16
+ NEWSAPI_KEY=
17
+ NEWSAPI_QUERY=south florida commercial real estate
package/CLAUDE.md ADDED
@@ -0,0 +1,67 @@
1
+ # optimal-cli — Agent Context
2
+
3
+ ## What This Is
4
+ A Claude Code plugin monorepo consolidating 10 Optimal repos into CLI skills.
5
+ All mutations go through skills — frontends in apps/ are read-only dashboards.
6
+
7
+ ## Tech Stack
8
+ - Language: TypeScript (strict, ESM)
9
+ - Package Manager: pnpm workspaces
10
+ - CLI Framework: Commander.js (bin/optimal.ts)
11
+ - Database: Supabase (two instances)
12
+ - ReturnPro: vvutttwunexshxkmygik.supabase.co (financial data)
13
+ - OptimalOS: hbfalrpswysryltysonm.supabase.co (kanban board, transactions)
14
+ - CMS: Strapi v5 at https://strapi.op-hub.com/api
15
+ - AI: Groq (Llama 3.3 70B) for content generation
16
+
17
+ ## Commands
18
+ pnpm build — compile TypeScript
19
+ pnpm lint — type-check
20
+ tsx bin/optimal.ts <command> — run CLI
21
+
22
+ ## Project Structure
23
+ skills/ — .md skill files (agent-facing WHAT)
24
+ lib/ — TypeScript modules (implementation HOW)
25
+ agents/ — subagent definitions
26
+ hooks/ — Claude Code hooks
27
+ bin/optimal.ts — CLI entry point
28
+ apps/ — read-only Next.js frontends
29
+ supabase/ — consolidated migrations
30
+
31
+ ## Conventions
32
+ - Skills in skills/*.md with frontmatter: name, description
33
+ - Every skill logs execution to cli_task_logs via lib/kanban.ts
34
+ - lib/ functions are single source of truth — skills and CLI both call them
35
+ - Never run SQL manually — use migration files + supabase db push --linked
36
+ - Environment variables in .env at repo root
37
+ - Package manager: pnpm (never npm or yarn)
38
+ - Git email: 95986651+clenisa@users.noreply.github.com
39
+
40
+ ## Supabase Tables (Kanban — OptimalOS Instance)
41
+ | Table | Purpose |
42
+ |-------|---------|
43
+ | cli_projects | Project groupings |
44
+ | cli_tasks | Kanban cards with agent assignment, blocking deps, skill refs |
45
+ | cli_task_logs | Audit trail of agent activity |
46
+
47
+ ## Supabase Tables (Financial — ReturnPro Instance)
48
+ | Table | Purpose |
49
+ |-------|---------|
50
+ | stg_financials_raw | Staged financial data (amount is TEXT, CAST before math) |
51
+ | confirmed_income_statements | Confirmed GL accounts |
52
+ | dim_account | Account code → ID lookup |
53
+ | dim_client | Client name → ID lookup |
54
+ | dim_master_program | Master program lookup |
55
+ | dim_program_id | Program ID lookup |
56
+
57
+ ## Environment Variables
58
+ OPTIMAL_SUPABASE_URL=https://hbfalrpswysryltysonm.supabase.co
59
+ OPTIMAL_SUPABASE_SERVICE_KEY=...
60
+ RETURNPRO_SUPABASE_URL=https://vvutttwunexshxkmygik.supabase.co
61
+ RETURNPRO_SUPABASE_SERVICE_KEY=...
62
+ STRAPI_URL=https://strapi.op-hub.com
63
+ STRAPI_API_TOKEN=...
64
+ GROQ_API_KEY=...
65
+ GROQ_MODEL=llama-3.3-70b-versatile
66
+ NEWSAPI_KEY=...
67
+ NEWSAPI_QUERY=south florida commercial real estate
package/COMMANDS.md ADDED
@@ -0,0 +1,264 @@
1
+ # Optimal CLI — Full Command Reference
2
+
3
+ ## Global Options
4
+
5
+ All commands support:
6
+ - `-V, --version` — Show version number
7
+ - `-h, --help` — Show help
8
+
9
+ ---
10
+
11
+ ## Config Commands
12
+
13
+ ### `optimal config push`
14
+ Push local `~/.openclaw/openclaw.json` to cloud storage.
15
+
16
+ ```bash
17
+ optimal config push --agent <name>
18
+ ```
19
+
20
+ **Options:**
21
+ - `--agent <name>` (required) — Agent name (e.g., oracle, opal, kimklaw)
22
+
23
+ **Example:**
24
+ ```bash
25
+ optimal config push --agent oracle
26
+ # ✓ Config pushed for oracle
27
+ # ID: abc-123
28
+ # Version: 2026-03-05T12:00:00Z
29
+ ```
30
+
31
+ ---
32
+
33
+ ### `optimal config pull`
34
+ Pull config from cloud and save to local `~/.openclaw/openclaw.json`.
35
+
36
+ ```bash
37
+ optimal config pull --agent <name>
38
+ ```
39
+
40
+ **Options:**
41
+ - `--agent <name>` (required) — Agent name to pull config for
42
+
43
+ **Example:**
44
+ ```bash
45
+ optimal config pull --agent oracle
46
+ # ✓ Config pulled for oracle
47
+ # Version: 2026-03-05T12:00:00Z
48
+ # Updated: 2026-03-05T12:00:00Z
49
+ #
50
+ # Saved to: ~/.openclaw/openclaw.json
51
+ ```
52
+
53
+ ---
54
+
55
+ ### `optimal config list`
56
+ List all saved agent configs in cloud storage.
57
+
58
+ ```bash
59
+ optimal config list
60
+ ```
61
+
62
+ **Example:**
63
+ ```bash
64
+ optimal config list
65
+ # | Agent | Version | Updated |
66
+ # |---------|----------------------|----------------------|
67
+ # | oracle | 2026-03-05T10:00:00Z | 2026-03-05T10:00:00Z |
68
+ # | opal | 2026-03-04T08:30:00Z | 2026-03-04T08:30:00Z |
69
+ # | kimklaw | 2026-03-05T11:15:00Z | 2026-03-05T11:15:00Z |
70
+ #
71
+ # Total: 3 configs
72
+ ```
73
+
74
+ ---
75
+
76
+ ### `optimal config diff`
77
+ Compare local config with cloud version.
78
+
79
+ ```bash
80
+ optimal config diff --agent <name>
81
+ ```
82
+
83
+ **Options:**
84
+ - `--agent <name>` (required) — Agent name to compare
85
+
86
+ **Example:**
87
+ ```bash
88
+ optimal config diff --agent oracle
89
+ # Differences found:
90
+ # • Top-level keys differ
91
+ # • Version mismatch: local=2026.2.25, cloud=2026.3.1
92
+ #
93
+ # Local updated: 2026-03-05T10:00:00Z
94
+ # Cloud updated: 2026-03-05T12:00:00Z
95
+ ```
96
+
97
+ ---
98
+
99
+ ### `optimal config sync`
100
+ Two-way sync: push if local is newer, pull if cloud is newer.
101
+
102
+ ```bash
103
+ optimal config sync --agent <name>
104
+ ```
105
+
106
+ **Options:**
107
+ - `--agent <name>` (required) — Agent name to sync
108
+
109
+ **Example:**
110
+ ```bash
111
+ optimal config sync --agent oracle
112
+ # ✓ pushed
113
+ # Local is newer - pushed to cloud (version 2026-03-05T12:00:00Z)
114
+ ```
115
+
116
+ ---
117
+
118
+ ## Board Commands
119
+
120
+ ### `optimal board view`
121
+ Display the kanban board.
122
+
123
+ ```bash
124
+ optimal board view [options]
125
+ ```
126
+
127
+ **Options:**
128
+ - `-p, --project <slug>` — Project slug (default: optimal-cli-refactor)
129
+ - `-s, --status <status>` — Filter by status
130
+
131
+ **Example:**
132
+ ```bash
133
+ optimal board view
134
+ # | Status | P | Title | Agent | Skill |
135
+ # |-------------|---|----------------------|---------|-------------|
136
+ # | in_progress | 1 | Build CLI | oracle | config-sync |
137
+ # | ready | 2 | Test migrations | kimklaw | db-migrate |
138
+ ```
139
+
140
+ ---
141
+
142
+ ### `optimal board create`
143
+ Create a new task.
144
+
145
+ ```bash
146
+ optimal board create --title "Task name" [options]
147
+ ```
148
+
149
+ **Options:**
150
+ - `-t, --title <title>` (required) — Task title
151
+ - `-p, --project <slug>` — Project slug (default: optimal-cli-refactor)
152
+ - `-d, --description <desc>` — Task description
153
+ - `--priority <n>` — Priority 1-4 (default: 3)
154
+ - `--skill <ref>` — Skill reference
155
+ - `--labels <labels>` — Comma-separated labels
156
+
157
+ **Example:**
158
+ ```bash
159
+ optimal board create --title "Fix bug" --priority 1 --skill config-sync
160
+ ```
161
+
162
+ ---
163
+
164
+ ### `optimal board update`
165
+ Update a task.
166
+
167
+ ```bash
168
+ optimal board update --id <uuid> [options]
169
+ ```
170
+
171
+ **Options:**
172
+ - `--id <uuid>` (required) — Task UUID
173
+ - `-s, --status <status>` — New status
174
+ - `-a, --agent <name>` — Assign to agent
175
+ - `--priority <n>` — New priority
176
+ - `-m, --message <msg>` — Log message
177
+
178
+ **Example:**
179
+ ```bash
180
+ optimal board update --id abc-123 --status done --agent oracle
181
+ ```
182
+
183
+ ---
184
+
185
+ ## Database Migration Commands
186
+
187
+ ### `optimal migrate push`
188
+ Run Supabase migrations.
189
+
190
+ ```bash
191
+ optimal migrate push --target <returnpro|optimalos> [options]
192
+ ```
193
+
194
+ **Options:**
195
+ - `--target <target>` (required) — Target: returnpro or optimalos
196
+ - `--dry-run` — Preview without applying
197
+
198
+ ---
199
+
200
+ ### `optimal migrate pending`
201
+ List pending migration files.
202
+
203
+ ```bash
204
+ optimal migrate pending --target <returnpro|optimalos>
205
+ ```
206
+
207
+ ---
208
+
209
+ ### `optimal migrate create`
210
+ Create a new migration file.
211
+
212
+ ```bash
213
+ optimal migrate create --target <returnpro|optimalos> --name <name>
214
+ ```
215
+
216
+ ---
217
+
218
+ ## Environment Setup
219
+
220
+ ### Required for Config Sync
221
+
222
+ ```bash
223
+ # ~/.optimal/.env
224
+ OPTIMAL_SUPABASE_URL=https://hbfalrpswysryltysonm.supabase.co
225
+ OPTIMAL_SUPABASE_SERVICE_KEY=eyJhbGciOiJIUzI1NiIs...
226
+ ```
227
+
228
+ ### Required for Financial Commands
229
+
230
+ ```bash
231
+ RETURNPRO_SUPABASE_URL=https://vvutttwunexshxkmygik.supabase.co
232
+ RETURNPRO_SUPABASE_SERVICE_KEY=sb_secret_...
233
+ ```
234
+
235
+ ### Required for CMS Commands
236
+
237
+ ```bash
238
+ STRAPI_URL=https://strapi.op-hub.com
239
+ STRAPI_API_TOKEN=your_token_here
240
+ ```
241
+
242
+ ---
243
+
244
+ ## Exit Codes
245
+
246
+ | Code | Meaning |
247
+ |------|---------|
248
+ | 0 | Success |
249
+ | 1 | General error |
250
+ | 2 | Missing required option |
251
+ | 3 | Authentication failed |
252
+
253
+ ---
254
+
255
+ ## Troubleshooting
256
+
257
+ ### "No config found at ~/.openclaw/openclaw.json"
258
+ Run `optimal config pull --agent <name>` to download a config first.
259
+
260
+ ### "Missing OPTIMAL_SUPABASE_SERVICE_KEY"
261
+ Set the environment variable in `~/.optimal/.env`.
262
+
263
+ ### "Table does not exist"
264
+ Run the migration SQL in Supabase SQL Editor (see README.md).
package/PUBLISH.md ADDED
@@ -0,0 +1,70 @@
1
+ # Publishing @clenisa/optimal-cli to NPM
2
+
3
+ ## Option 1: Login and Publish (Interactive)
4
+
5
+ ```bash
6
+ cd /root/.openclaw/workspace/optimal-cli
7
+ npm login
8
+ # Follow prompts (username, password, 2FA)
9
+ npm publish --access public
10
+ ```
11
+
12
+ ## Option 2: Using Access Token (Automated)
13
+
14
+ 1. Go to https://www.npmjs.com/settings/clenisa/tokens
15
+ 2. Create "Automation" token
16
+ 3. Add to `~/.npmrc`:
17
+
18
+ ```bash
19
+ echo "//registry.npmjs.org/:_authToken=npm_YOUR_TOKEN_HERE" > ~/.npmrc
20
+ ```
21
+
22
+ 4. Then publish:
23
+
24
+ ```bash
25
+ cd /root/.openclaw/workspace/optimal-cli
26
+ npm publish --access public
27
+ ```
28
+
29
+ ## Option 3: GitHub Actions (Recommended)
30
+
31
+ Add this `.github/workflows/publish.yml`:
32
+
33
+ ```yaml
34
+ name: Publish to NPM
35
+ on:
36
+ push:
37
+ tags:
38
+ - 'v*'
39
+ jobs:
40
+ publish:
41
+ runs-on: ubuntu-latest
42
+ steps:
43
+ - uses: actions/checkout@v4
44
+ - uses: pnpm/action-setup@v2
45
+ - uses: actions/setup-node@v4
46
+ with:
47
+ node-version: '20'
48
+ registry-url: 'https://registry.npmjs.org'
49
+ - run: pnpm install
50
+ - run: pnpm build
51
+ - run: npm publish --access public
52
+ env:
53
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
54
+ ```
55
+
56
+ Then add `NPM_TOKEN` secret in GitHub repo settings.
57
+
58
+ ## Post-Publish Verification
59
+
60
+ ```bash
61
+ # Check package
62
+ npm view @clenisa/optimal-cli
63
+
64
+ # Install globally
65
+ npm install -g @clenisa/optimal-cli
66
+
67
+ # Test
68
+ optimal --version
69
+ optimal config list
70
+ ```
@@ -42,7 +42,7 @@ The content-ops agent follows a **generate-review-publish-deploy** pipeline. Con
42
42
  2. Claim task updateTask(taskId, { status: 'in_progress', assigned_agent: 'content-ops' })
43
43
  3. Log start logActivity(taskId, { agent: 'content-ops', action: 'task_claimed', message: 'Starting...' })
44
44
  4. Execute skill Run the skill referenced in task.skill_ref
45
- 5. Log result logActivity({actor, 'content-ops', { success, message, metadata })
45
+ 5. Log result logSkillExecution(skillName, 'content-ops', { success, message, metadata })
46
46
  6. Complete/review updateTask(taskId, { status: 'done' }) or { status: 'review' } if human approval needed
47
47
  7. Repeat Loop back to step 1
48
48
  ```
@@ -150,7 +150,7 @@ while (true) {
150
150
  try {
151
151
  const result = await executeSkill(task.skill_ref, task.metadata)
152
152
 
153
- await logActivity({actor, 'content-ops', {
153
+ await logSkillExecution(task.skill_ref, 'content-ops', {
154
154
  success: true,
155
155
  message: result.message,
156
156
  metadata: result
@@ -43,7 +43,7 @@ The financial-ops agent follows a strict **upload-then-verify** pattern. Every d
43
43
  3. Log start logActivity(taskId, { agent: 'financial-ops', action: 'task_claimed', message: 'Starting...' })
44
44
  4. Execute skill Run the skill referenced in task.skill_ref
45
45
  5. Post-action audit If the skill mutated data, run /audit-financials automatically
46
- 6. Log result logActivity({actor, 'financial-ops', { success, message, metadata })
46
+ 6. Log result logSkillExecution(skillName, 'financial-ops', { success, message, metadata })
47
47
  7. Complete task updateTask(taskId, { status: 'done' })
48
48
  8. Repeat Loop back to step 1
49
49
  ```
@@ -124,7 +124,7 @@ while (true) {
124
124
  })
125
125
  }
126
126
 
127
- await logActivity({actor, 'financial-ops', {
127
+ await logSkillExecution(task.skill_ref, 'financial-ops', {
128
128
  success: true,
129
129
  message: result.message,
130
130
  metadata: result
@@ -33,7 +33,7 @@ The infra-ops agent follows a **check-then-act** pattern. It verifies system hea
33
33
  3. Log start logActivity(taskId, { agent: 'infra-ops', action: 'task_claimed', message: 'Starting...' })
34
34
  4. Execute skill Run the skill referenced in task.skill_ref
35
35
  5. Post-deploy check If the skill was a deploy, run /health-check to verify
36
- 6. Log result logActivity({actor, 'infra-ops', { success, message, metadata })
36
+ 6. Log result logSkillExecution(skillName, 'infra-ops', { success, message, metadata })
37
37
  7. Complete task updateTask(taskId, { status: 'done' })
38
38
  8. Repeat Loop back to step 1
39
39
  ```
@@ -118,7 +118,7 @@ while (true) {
118
118
  // Execute the primary skill
119
119
  const result = await executeSkill(task.skill_ref, task.metadata)
120
120
 
121
- await logActivity({actor, 'infra-ops', {
121
+ await logSkillExecution(task.skill_ref, 'infra-ops', {
122
122
  success: true,
123
123
  message: result.message,
124
124
  metadata: result
package/apps/.gitkeep ADDED
File without changes