@fnmoa/cli 0.1.0 → 0.1.1
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/README.md +23 -49
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
|
-
# `@
|
|
1
|
+
# `@fnmoa/cli` — `moa`
|
|
2
2
|
|
|
3
3
|
A terminal client for the Moa server — drives tasks and workflows over the same
|
|
4
|
-
HTTP API the dashboard uses.
|
|
5
|
-
**operator** (on the host) manage everything without the UI.
|
|
4
|
+
HTTP API the dashboard uses.
|
|
6
5
|
|
|
7
|
-
##
|
|
6
|
+
## Install
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
```sh
|
|
9
|
+
npm i -g @fnmoa/cli
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Setup
|
|
13
|
+
|
|
14
|
+
Point it at your Moa server and authenticate once:
|
|
11
15
|
|
|
12
16
|
```sh
|
|
13
|
-
moa
|
|
14
|
-
moa
|
|
15
|
-
moa wf solve mhbspot/repo 42 --watch
|
|
17
|
+
moa config set url https://cp.fnmoa.com
|
|
18
|
+
moa config set key <your-api-key>
|
|
16
19
|
```
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
`docker-compose.override.yml`, default `127.0.0.1:3030`):
|
|
21
|
+
Then use it:
|
|
20
22
|
|
|
21
23
|
```sh
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
moa status
|
|
25
|
+
moa wf pending
|
|
26
|
+
moa wf solve owner/repo 42 --watch
|
|
25
27
|
```
|
|
26
28
|
|
|
27
29
|
## Commands
|
|
@@ -56,47 +58,19 @@ moa config set key <key> persist an API key
|
|
|
56
58
|
moa config clear
|
|
57
59
|
```
|
|
58
60
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
as JSON, so an agent can discover capabilities programmatically:
|
|
64
|
-
|
|
65
|
-
```sh
|
|
66
|
-
moa help --json
|
|
67
|
-
# { "api": "...", "commands": [ { "name": "wf solve", "usage": "...", "args": [...] }, ... ] }
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
`moa help` (text) is rendered from the same registry, so docs never drift.
|
|
71
|
-
|
|
72
|
-
## Structure (modular)
|
|
73
|
-
|
|
74
|
-
```
|
|
75
|
-
src/
|
|
76
|
-
index.ts entry: parse argv → dispatch → help/--json
|
|
77
|
-
registry.ts COMMANDS list + catalog() (the KB)
|
|
78
|
-
command.ts Command / CommandMeta types
|
|
79
|
-
args.ts argv parser
|
|
80
|
-
ui.ts color + status formatting
|
|
81
|
-
client.ts HTTP API client
|
|
82
|
-
commands/ one module per group: status, tasks, workflows, github
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Add a command by writing a `Command` in `commands/` and listing it in
|
|
86
|
-
`registry.ts` — it appears in help, the JSON catalog, and dispatch automatically.
|
|
61
|
+
`moa help --json` emits the full command catalog (every command + sub-action,
|
|
62
|
+
with `usage` and documented `args`) as JSON, so an agent can discover
|
|
63
|
+
capabilities programmatically. `moa help` (text) is rendered from the same
|
|
64
|
+
registry, so docs never drift.
|
|
87
65
|
|
|
88
66
|
## Config
|
|
89
67
|
|
|
90
68
|
URL/key resolve **env var → `~/.moa/cli.json` (`moa config`) → default**, so you
|
|
91
|
-
can persist them once instead of exporting env vars
|
|
92
|
-
|
|
93
|
-
```sh
|
|
94
|
-
moa config set url http://localhost:3030
|
|
95
|
-
```
|
|
69
|
+
can persist them once instead of exporting env vars.
|
|
96
70
|
|
|
97
71
|
| Env | Default | |
|
|
98
72
|
| --- | --- | --- |
|
|
99
|
-
| `MOA_API_URL` | `
|
|
100
|
-
| `MOA_API_KEY` | — | API key
|
|
73
|
+
| `MOA_API_URL` | `https://cp.fnmoa.com` | Server base URL |
|
|
74
|
+
| `MOA_API_KEY` | — | API key |
|
|
101
75
|
| `MOA_CONFIG` | `~/.moa/cli.json` | Config file path |
|
|
102
76
|
| `NO_COLOR` | — | Disable ANSI colors |
|
package/dist/config.js
CHANGED
|
@@ -4,7 +4,7 @@ import { join, dirname } from 'node:path';
|
|
|
4
4
|
import { parse } from './args.js';
|
|
5
5
|
/** Persisted CLI config (overridden by env vars). */
|
|
6
6
|
export const CONFIG_PATH = process.env.MOA_CONFIG || join(homedir(), '.moa', 'cli.json');
|
|
7
|
-
export const DEFAULT_URL = '
|
|
7
|
+
export const DEFAULT_URL = 'https://cp.fnmoa.com';
|
|
8
8
|
export function readConfig() {
|
|
9
9
|
try {
|
|
10
10
|
return JSON.parse(readFileSync(CONFIG_PATH, 'utf8'));
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAElC,qDAAqD;AACrD,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC;AAEzF,MAAM,CAAC,MAAM,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC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