@fnmoa/cli 0.3.0 → 0.4.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 (50) hide show
  1. package/LICENSE +31 -0
  2. package/README.md +273 -70
  3. package/dist/assets/worker.js +216 -0
  4. package/dist/main.js +326 -0
  5. package/package.json +34 -27
  6. package/dist/args.js +0 -33
  7. package/dist/args.js.map +0 -1
  8. package/dist/client.js +0 -103
  9. package/dist/client.js.map +0 -1
  10. package/dist/command.js +0 -2
  11. package/dist/command.js.map +0 -1
  12. package/dist/commands/config.js +0 -129
  13. package/dist/commands/config.js.map +0 -1
  14. package/dist/commands/github.js +0 -19
  15. package/dist/commands/github.js.map +0 -1
  16. package/dist/commands/login.js +0 -128
  17. package/dist/commands/login.js.map +0 -1
  18. package/dist/commands/oracle.js +0 -86
  19. package/dist/commands/oracle.js.map +0 -1
  20. package/dist/commands/repos.js +0 -70
  21. package/dist/commands/repos.js.map +0 -1
  22. package/dist/commands/skills.js +0 -225
  23. package/dist/commands/skills.js.map +0 -1
  24. package/dist/commands/status.js +0 -78
  25. package/dist/commands/status.js.map +0 -1
  26. package/dist/commands/tasks.js +0 -171
  27. package/dist/commands/tasks.js.map +0 -1
  28. package/dist/commands/track.js +0 -31
  29. package/dist/commands/track.js.map +0 -1
  30. package/dist/commands/whoami.js +0 -22
  31. package/dist/commands/whoami.js.map +0 -1
  32. package/dist/commands/workflows.js +0 -304
  33. package/dist/commands/workflows.js.map +0 -1
  34. package/dist/config.js +0 -65
  35. package/dist/config.js.map +0 -1
  36. package/dist/index.js +0 -105
  37. package/dist/index.js.map +0 -1
  38. package/dist/poll.js +0 -24
  39. package/dist/poll.js.map +0 -1
  40. package/dist/registry.js +0 -56
  41. package/dist/registry.js.map +0 -1
  42. package/dist/ui.js +0 -56
  43. package/dist/ui.js.map +0 -1
  44. package/src/skills/moa-oracle/SKILL.md +0 -35
  45. package/src/skills/moa-profiles/SKILL.md +0 -49
  46. package/src/skills/moa-review-pr/SKILL.md +0 -47
  47. package/src/skills/moa-run-task/SKILL.md +0 -44
  48. package/src/skills/moa-setup/SKILL.md +0 -60
  49. package/src/skills/moa-ship-issue/SKILL.md +0 -54
  50. package/src/skills/moa-triage-audit/SKILL.md +0 -47
package/LICENSE ADDED
@@ -0,0 +1,31 @@
1
+ fnMoa — Proprietary Licence
2
+
3
+ Copyright (c) 2026 fnLog0. All rights reserved.
4
+
5
+ This software, including its source code, compiled and minified code,
6
+ container images, documentation and any other files distributed with it
7
+ (the "Software"), is the property of fnLog0.
8
+
9
+ 1. No permission is granted to copy, modify, merge, distribute, publish,
10
+ sublicense, sell, or host the Software for others, in whole or in part,
11
+ except under a written licence or a paid licence key issued by fnLog0.
12
+
13
+ 2. You may use the Software only under the terms of a valid licence from
14
+ fnLog0, only for as long as that licence is valid, and only within the
15
+ limits it sets.
16
+
17
+ 3. Removing, altering or working around any licence check, notice or key in
18
+ the Software is not permitted.
19
+
20
+ 4. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
23
+
24
+ 5. TO THE FULLEST EXTENT PERMITTED BY LAW, IN NO EVENT SHALL fnLog0 BE LIABLE
25
+ FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL OR EXEMPLARY DAMAGES,
26
+ OR FOR ANY LOSS OF DATA, PROFITS OR BUSINESS, ARISING FROM OR IN CONNECTION
27
+ WITH THE SOFTWARE OR ITS USE. fnLog0'S TOTAL LIABILITY UNDER OR IN
28
+ CONNECTION WITH THE SOFTWARE SHALL NOT EXCEED THE FEES PAID TO fnLog0 FOR
29
+ THE LICENCE IN THE TWELVE MONTHS BEFORE THE CLAIM.
30
+
31
+ For a licence, contact fnLog0.
package/README.md CHANGED
@@ -1,99 +1,302 @@
1
- # `@fnmoa/cli` — `moa`
1
+ # @fnmoa/cli
2
2
 
3
- A terminal client for the Moa server — drives tasks and workflows over the same
4
- HTTP API the dashboard uses.
3
+ `moa` is the command line for **fnMoa**: a workspace that runs coding agents
4
+ (Claude Code, Codex and others) as a team on your GitHub repository. It
5
+ triages issues, writes the change, reviews it, runs the checks, and merges.
5
6
 
6
- ## Install
7
+ You use the CLI to:
7
8
 
8
- ```sh
9
- npm i -g @fnmoa/cli
9
+ - **install** a fnMoa workspace on this machine, Vercel Sandbox or Cloudflare
10
+ (`moa setup`);
11
+ - **look after it** afterwards: status, logs, updates, stop, remove;
12
+ - **work with it**: give agents work, follow runs, talk to the Manager, ship an
13
+ issue to a merged pull request.
14
+
15
+ ```bash
16
+ npx @fnmoa/cli setup # or: npm install -g @fnmoa/cli, then `moa setup`
17
+ ```
18
+
19
+ Node 22 or newer. fnMoa is proprietary software and needs a licence, which is
20
+ free for one workspace on this machine. See [Licence](#licence).
21
+
22
+ ---
23
+
24
+ ## Quick start
25
+
26
+ 1. **Make an account.** Go to <https://fnmoa.locusgraph.com>, sign in with
27
+ GitHub, and choose **Start free** on Plan and billing.
28
+
29
+ 2. **Let Docker pull the image.** The workspace ships as a private image on
30
+ GitHub's registry. Log in with the image pull token you were given:
31
+
32
+ ```bash
33
+ docker login ghcr.io -u <your GitHub login> --password-stdin # paste the token
34
+ ```
35
+
36
+ 3. **Run setup.**
37
+
38
+ ```bash
39
+ npx @fnmoa/cli setup
40
+ ```
41
+
42
+ Setup is seven screens, and it saves as it goes, so you can quit with `q`
43
+ and pick up later:
44
+
45
+ | Screen | What it does |
46
+ |---|---|
47
+ | Where | This machine, Vercel Sandbox or Cloudflare |
48
+ | 1 Checks & account | tools, Docker, and your licence: press **`c`** to connect your account in the browser |
49
+ | 2 GitHub | your `gh` login and the repository |
50
+ | 3 Memory & database | SQLite or Postgres, and LocusGraph memory if you have it |
51
+ | 4 Agent logins | your Claude or Codex login, or API key |
52
+ | 5 Console access | the GitHub App that signs people in to the web console, and who is on the list |
53
+ | 6 Deploy & done | a review of the plan and its cost, then Enter twice to deploy |
54
+
55
+ Every line on a screen is ✓, ✗ or …. Setup does not move past a ✗: the line
56
+ says how to fix it, and `r` checks again. `Esc` goes back. Secrets show as
57
+ `•••`, and are never written to setup's saved state.
58
+
59
+ 4. **Open the console.** Deploy prints the console's address (on this machine,
60
+ <http://localhost:3100>) and logs `moa` in to the new workspace, so every
61
+ command below talks to it.
62
+
63
+ ### Connecting your account
64
+
65
+ On **Checks**, `c` prints a link and a code and opens your browser:
66
+
67
+ ```
68
+ … licence open https://fnmoa.locusgraph.com/device?code=WXZB-CDFG and check it shows WXZB-CDFG
10
69
  ```
11
70
 
12
- ## Setup
71
+ Sign in, check the page shows the same code, and approve. Setup gets a signed
72
+ licence for this install and carries on. No licence key is copied or stored
73
+ on your machine.
13
74
 
14
- Run `moa login` (it also starts automatically on first run) — an interactive
15
- onboarding that sets your server URL and API key:
75
+ No browser on this machine, or running in CI? Use the key from the Licence key
76
+ page instead:
16
77
 
17
- ```sh
18
- moa login
78
+ ```bash
79
+ moa setup licence --key # asks for it, hidden
80
+ FNMOA_LICENCE_KEY=FNMOA-… moa setup licence # or from the environment
81
+ moa setup update # gives the new licence to the workspace
19
82
  ```
20
83
 
21
- It defaults to `https://api.fnmoa.com`; grab your API key from the Moa dashboard.
22
- Prefer non-interactive? `moa config set url <url>` and `moa config set key <key>`.
84
+ ### What each target needs
23
85
 
24
- Then use it:
86
+ | Target | Needs | Notes |
87
+ |---|---|---|
88
+ | **This machine** | Docker | The workspace on :8787 and the console on :3100. Data stays in Docker volumes. |
89
+ | **Vercel Sandbox** | a Vercel login (`vercel login`, or `VERCEL_TOKEN`) | One persistent sandbox per tenant. Checks shows the size and a cost estimate first. |
90
+ | **Cloudflare** | a Cloudflare login (`wrangler login`), a domain on Cloudflare, Workers Paid | A Worker, D1 and a container on your own domain. |
25
91
 
26
- ```sh
27
- moa status
28
- moa wf pending
29
- moa wf solve owner/repo 42 --watch
92
+ The Free plan covers **This machine**. Vercel and Cloudflare need a paid plan
93
+ (coming soon).
94
+
95
+ ---
96
+
97
+ ## After setup
98
+
99
+ The same commands work for every target. With more than one deployed, add
100
+ `--target local|vercel|cloudflare`.
101
+
102
+ ```bash
103
+ moa setup status # each piece ✓/✗, live; starts a stopped sandbox or container
104
+ moa setup logs # the workspace's and console's last lines [--lines n]
105
+ moa setup update # move to this CLI's version of fnMoa; data kept
106
+ moa setup licence # connect the account again, or replace the licence
107
+ moa setup login # add or replace the agent logins (owner only), then deploy
108
+ moa setup rotate # new owner token and secrets, then deploy
109
+ moa setup stop # stop it; data kept
110
+ moa setup down # delete everything setup made; asks first [--yes]
30
111
  ```
31
112
 
32
- ## Commands
113
+ `down` only deletes what setup recorded making, by id. A database, bucket or
114
+ image that was there before is left alone.
115
+
116
+ To update fnMoa, update the CLI, then run `update`:
33
117
 
118
+ ```bash
119
+ npx @fnmoa/cli@latest setup update
34
120
  ```
35
- moa login connect: set server URL + API key (interactive)
36
- moa status overview snapshot
37
- moa setup connector (Claude/GitHub) status
38
- moa tasks | task <id> list / show tasks
39
- moa run "<prompt>" [--dir D] [--autonomous] [--watch]
40
- moa cancel <taskId>
41
121
 
42
- moa wf list runs
43
- moa wf pending available issues/PRs
44
- moa wf get <id> [--watch] one run + step timeline
45
- moa wf cancel <id>
46
- moa wf solve <repo> <issue#> [--base B] [--watch]
47
- moa wf triage <repo> <issue#> [--watch]
48
- moa wf review <repo> <pr#> [--watch]
49
- moa wf address <repo> <pr#> [--watch]
50
- moa wf fix-ci <repo> <pr#> [--watch]
51
- moa wf merge <repo> <pr#> [--watch]
122
+ ---
123
+
124
+ ## Using a workspace
125
+
126
+ ### Log in to one
127
+
128
+ `moa setup` logs you in to the workspace it deploys. To use one someone else
129
+ runs:
130
+
131
+ ```bash
132
+ moa login https://workspace.example.com --token <token> # a token the owner gave you
133
+ moa login https://workspace.example.com --github # sign in with GitHub
134
+ moa whoami # which workspace, which tenant
135
+ moa use <profile> # switch between saved workspaces
136
+ ```
52
137
 
53
- moa oracle list list oracle domains
54
- moa oracle consult <domain> "<question>" [--watch]
55
- moa oracle history
138
+ `--github` is for someone the owner has added on Console access. It prints a
139
+ GitHub device code, waits while you approve it, and saves a token of your own,
140
+ with your role and your daily spending cap. Removing you on Console access
141
+ stops it at once.
56
142
 
57
- moa gh pulls | issues
143
+ ### Check it is ready
58
144
 
59
- moa config show effective URL/key + file path
60
- moa config set url <url> persist the API URL (~/.moa/cli.json)
61
- moa config set key <key> persist an API key
62
- moa config clear
145
+ ```bash
146
+ moa doctor
147
+ ```
63
148
 
64
- moa skills list the bundled Moa skills
65
- moa skills show <name> print a skill's SKILL.md
66
- moa skills install [name] [--tool claude|cursor|codex|all] [--dir D] [--force]
149
+ ```
150
+ ok runs agents sqlite, v0.4.0
151
+ ok agent CLIs claude, codex
152
+ NO repository none configured — pipelines need MOA_REPO
153
+ NO github login gh has no token there — run `gh auth login` where the workspace runs
67
154
  ```
68
155
 
69
- `moa help --json` emits the full command catalog (every command + sub-action,
70
- with `usage` and documented `args`) as JSON, so an agent can discover
71
- capabilities programmatically. `moa help` (text) is rendered from the same
72
- registry, so docs never drift.
156
+ Exit 0 when it is ready, 2 when it is not.
73
157
 
74
- ## Skills
158
+ ### Ship an issue
159
+
160
+ ```bash
161
+ moa ship 41 # issue #41 → pull request → reviewed → merged
162
+ ```
75
163
 
76
- The CLI bundles ready-to-use agent skills (setup, ship-issue, review-pr,
77
- triage-audit, run-task, oracle, profiles). Install them into your coding agent —
78
- each tool gets the right format:
164
+ ### Declare a team and give it work
79
165
 
80
- ```sh
81
- moa skills # list them
82
- moa skills install --tool claude # → ~/.claude/skills/<name>/SKILL.md
83
- moa skills install --tool cursor # → ./.cursor/rules/<name>.mdc
84
- moa skills install --tool codex # → ~/.codex/prompts/<name>.md (use as /<name>)
85
- moa skills install --tool all # all three
86
- moa skills install moa-setup --tool cursor # just one skill
166
+ ```bash
167
+ moa agent create planner --cli claude --role "You scope the work. You never write code." --peers builder
168
+ moa agent create builder --cli claude --role "You write the code and its tests." --peers reviewer
169
+ moa agent create reviewer --cli codex --role "You read diffs and name defects."
170
+
171
+ moa run builder "fix the retry bug in src/http.ts" --watch
172
+ moa team work planner,builder,reviewer --watch
173
+ moa ask planner builder "which retry flag?" # and wait for the answer
174
+ moa delegate planner builder "implement the retry fix"
87
175
  ```
88
176
 
89
- ## Config
177
+ `--peers` is who an agent may open a thread with. Replying inside a thread it is
178
+ already part of needs no permission.
179
+
180
+ ### Follow what is happening
181
+
182
+ ```bash
183
+ moa watch # every job in the workspace, as it changes
184
+ moa jobs # what is running now
185
+ moa runs # what ran, newest first [--failed] [--state running]
186
+ moa logs <runId> --watch # every line a run produced, live
187
+ moa spend --since 24h # what it cost, and what asked for it
188
+ moa inbox # who is waiting on an answer
189
+ moa delegations --blocked # what is stuck, and the command to unstick it
190
+ ```
191
+
192
+ Ctrl-C stops the work the command started and waits for it to stop. Press it
193
+ twice to leave the work running; `moa jobs` finds it again.
194
+
195
+ ### Talk to the Manager
196
+
197
+ The Manager is the agent that plans and starts work for you, the same one as on
198
+ the console's chat page.
199
+
200
+ ```bash
201
+ moa manager say "start #41 with the core team" # and wait for its answer
202
+ moa manager proposals # what it proposes, each with its id
203
+ moa manager approve <id> # say yes, and run it now
204
+ moa manager dismiss <id> # say no
205
+ moa manager watch # what is running, and how it is going
206
+ ```
207
+
208
+ `say` waits up to `--timeout <s>` (default 600). Past that it exits 2, and the
209
+ Manager's answer is in the chat when it has one.
210
+
211
+ ---
212
+
213
+ ## For scripts
214
+
215
+ ### Exit codes
216
+
217
+ ```
218
+ 0 it did what it was asked
219
+ 1 it ran and failed — a red build, a CLI that would not start
220
+ 2 a rule stopped it — a budget, a policy, a bounced message, a timeout
221
+ 3 the command was typed wrong, or the token was refused
222
+ ```
223
+
224
+ ### JSON
225
+
226
+ `--json` writes the answer to stdout and nothing else. Warnings go to stderr.
227
+
228
+ ```bash
229
+ moa agent list --json | jq -r '.agents[] | "\(.name)\t\(.cli)\t\(.status)"'
230
+ moa run builder "say ok" --json | jq '{result: .result.result, cost: .result.costUsd}'
231
+ moa jobs --json | jq -r '.jobs[] | select(.state == "running") | .kind'
232
+ moa ship 41 --json | jq -r '.result.outcome'
233
+ moa doctor --json | jq -e '[.checks[] | select(.ok == false)] | length == 0'
234
+ ```
235
+
236
+ The shapes those depend on are pinned by a test, so a script built on them
237
+ does not break quietly:
238
+
239
+ ```
240
+ agent list .agents[].name .agents[].cli .agents[].status .agents[].role
241
+ inbox .waiting[].to .waiting[].unread .waiting[].oldest
242
+ .waiting[].from
243
+ run .result.runId .result.result .result.isError .result.costUsd
244
+ ask .result.answered .result.answer .result.chain
245
+ runs .runs[].id .runs[].cause .runs[].costUsd
246
+ delegations .delegations[].from .delegations[].to .delegations[].task
247
+ .delegations[].blockedBy.body
248
+ seats .seats[].cli .seats[].used .seats[].hasCredential
249
+ .seats[].installed
250
+ spend .costUsd .byAgent[].agent .byCause[].cause
251
+ jobs .jobs[].kind .jobs[].state .jobs[].subject .jobs[].agent
252
+ .jobs[].progress.step
253
+ doctor .tenant .checks[].name .checks[].ok .checks[].detail
254
+ ship .result.outcome .result.reason .result.steps .result.costUsd
255
+ ```
256
+
257
+ Exit codes still apply with `--json`: a bounced `moa send` exits 2 and prints
258
+ the bounce.
259
+
260
+ ### Common flags
261
+
262
+ ```
263
+ --watch print what the agent does, as it does it
264
+ --detach start the work and return at once
265
+ --json machine-readable output only
266
+ --profile <name> a saved workspace other than the current one
267
+ --timeout <s> stop waiting; the work carries on
268
+ ```
269
+
270
+ Tab completion: `eval "$(moa completion zsh)"` (or `bash`) in your shell's rc file.
271
+
272
+ ---
273
+
274
+ ## Where it keeps things
275
+
276
+ ```
277
+ ~/.moa/config.json saved workspaces and their tokens (mode 0600)
278
+ ~/.moa/setup.json setup's answers and what it deployed; never a secret
279
+ ~/.moa/licence-<target>.json this install's id and signed licence (mode 0600)
280
+ ~/.moa/local/ logs and state of what setup started
281
+ MOA_HOME use another folder than ~/.moa
282
+ MOA_URL, MOA_TOKEN talk to this workspace, ignoring the saved ones (CI)
283
+ ```
284
+
285
+ ---
286
+
287
+ ## Licence
288
+
289
+ fnMoa is proprietary: Copyright (c) 2026 fnLog0, all rights reserved. See
290
+ `LICENSE` in this package. Using it needs a licence from
291
+ <https://fnmoa.locusgraph.com>:
292
+
293
+ - **Free**: one workspace on This machine.
294
+ - **Team** and **Business**: more workspaces, on Vercel and Cloudflare too.
295
+ Coming soon.
90
296
 
91
- URL/key resolve **env var → `~/.moa/cli.json` (`moa config`) → default**, so you
92
- can persist them once instead of exporting env vars.
297
+ The workspace checks its licence once a day. If the plan lapses, there is a
298
+ grace period. After that the workspace is read-only until the plan is paid
299
+ again, and no data is deleted.
93
300
 
94
- | Env | Default | |
95
- | --- | --- | --- |
96
- | `MOA_API_URL` | `https://api.fnmoa.com` | Server base URL |
97
- | `MOA_API_KEY` | — | API key |
98
- | `MOA_CONFIG` | `~/.moa/cli.json` | Config file path |
99
- | `NO_COLOR` | — | Disable ANSI colors |
301
+ Versions 0.1.0 to 0.3.0 of this package are an older, unrelated CLI and are
302
+ deprecated.