@oalo-ai/cli 0.0.0-stage → 0.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 (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +392 -2
  3. package/man/oalo.1 +1530 -0
  4. package/package.json +44 -4
  5. package/plugin/.claude-plugin/plugin.json +12 -0
  6. package/plugin/skills/oalo/SKILL.md +414 -0
  7. package/src/api.js +132 -0
  8. package/src/app-ref.js +11 -0
  9. package/src/args.js +67 -0
  10. package/src/bot-settings.json +468 -0
  11. package/src/channel.js +162 -0
  12. package/src/commands/apps.js +64 -0
  13. package/src/commands/bots.js +278 -0
  14. package/src/commands/call.js +179 -0
  15. package/src/commands/channels.js +110 -0
  16. package/src/commands/data.js +446 -0
  17. package/src/commands/db.js +58 -0
  18. package/src/commands/deploy.js +431 -0
  19. package/src/commands/dockerfile.js +81 -0
  20. package/src/commands/docs.js +70 -0
  21. package/src/commands/emit.js +124 -0
  22. package/src/commands/env.js +223 -0
  23. package/src/commands/graphs.js +570 -0
  24. package/src/commands/incidents.js +44 -0
  25. package/src/commands/link.js +150 -0
  26. package/src/commands/login.js +180 -0
  27. package/src/commands/logs.js +69 -0
  28. package/src/commands/mcp.js +125 -0
  29. package/src/commands/metrics.js +168 -0
  30. package/src/commands/products.js +169 -0
  31. package/src/commands/qa.js +98 -0
  32. package/src/commands/rehearse.js +100 -0
  33. package/src/commands/run.js +152 -0
  34. package/src/commands/secrets.js +68 -0
  35. package/src/commands/setup.js +96 -0
  36. package/src/commands/skill.js +142 -0
  37. package/src/commands/sources.js +377 -0
  38. package/src/commands/switches.js +156 -0
  39. package/src/commands/tail.js +84 -0
  40. package/src/commands/tokens.js +85 -0
  41. package/src/commands/typegen.js +505 -0
  42. package/src/commands/whoami.js +112 -0
  43. package/src/config.js +157 -0
  44. package/src/data.js +392 -0
  45. package/src/envfile.js +71 -0
  46. package/src/events.js +63 -0
  47. package/src/graphfiles.js +273 -0
  48. package/src/help.js +920 -0
  49. package/src/index.js +216 -0
  50. package/src/mcp/tools.js +773 -0
  51. package/src/server.js +73 -0
  52. package/src/workspace.js +44 -0
package/src/index.js ADDED
@@ -0,0 +1,216 @@
1
+ #!/usr/bin/env node
2
+ import { link } from "./commands/link.js";
3
+ import { login, logout } from "./commands/login.js";
4
+ import { typegen } from "./commands/typegen.js";
5
+ import { mcp } from "./commands/mcp.js";
6
+ import { tail } from "./commands/tail.js";
7
+ import { call } from "./commands/call.js";
8
+ import { run } from "./commands/run.js";
9
+ import { pull, push, status, lint } from "./commands/graphs.js";
10
+ import { qa } from "./commands/qa.js";
11
+ import { rehearse } from "./commands/rehearse.js";
12
+ import { skill, skillNotice } from "./commands/skill.js";
13
+ import { dim } from "./events.js";
14
+ import { CLI_VERSION } from "./server.js";
15
+ import { whoami } from "./commands/whoami.js";
16
+ import { emit } from "./commands/emit.js";
17
+ import { data } from "./commands/data.js";
18
+ import { tokens } from "./commands/tokens.js";
19
+ import { docs } from "./commands/docs.js";
20
+ import { deploy } from "./commands/deploy.js";
21
+ import { apps } from "./commands/apps.js";
22
+ import { env } from "./commands/env.js";
23
+ import { loops, flows } from "./commands/switches.js";
24
+ import { logs } from "./commands/logs.js";
25
+ import { secrets } from "./commands/secrets.js";
26
+ import { dockerfile } from "./commands/dockerfile.js";
27
+ import { bots } from "./commands/bots.js";
28
+ import { sources } from "./commands/sources.js";
29
+ import { setup } from "./commands/setup.js";
30
+ import { incidents } from "./commands/incidents.js";
31
+ import { channels } from "./commands/channels.js";
32
+ import { products } from "./commands/products.js";
33
+ import { metrics, dashboards } from "./commands/metrics.js";
34
+ import { db } from "./commands/db.js";
35
+ import { overview, commandHelp, helpJson, COMMANDS } from "./help.js";
36
+ import { parse } from "./args.js";
37
+
38
+ const { flags, rest } = parse(process.argv.slice(2));
39
+ const cmd = rest[0];
40
+
41
+ /**
42
+ * Print, then exit once the text has been flushed. `console.log` then
43
+ * `process.exit()` truncates piped output at the 8 KB pipe buffer: Node writes
44
+ * to a pipe asynchronously and exit drops what is still queued, so
45
+ * `oalo help --json | jq` broke as soon as the help grew past 8 KB.
46
+ */
47
+ function finish(text, code, stream = process.stdout) {
48
+ stream.write(text + "\n", () => process.exit(code));
49
+ }
50
+
51
+ // Help is a first-class command, not an error path.
52
+ //
53
+ // `oalo --help` used to exit 1, which breaks `oalo --help && ...` and tells a
54
+ // script the tool failed when it did exactly what was asked. An explicit help
55
+ // request exits 0; only an INVALID invocation is non-zero.
56
+ if ((flags.version || cmd === "version") && !flags.help) {
57
+ finish(CLI_VERSION, 0);
58
+ } else if (cmd === "help" || flags.help) {
59
+ const topic = cmd === "help" ? rest[1] : cmd;
60
+
61
+ if (flags.json) {
62
+ finish(helpJson(), 0);
63
+ } else if (topic) {
64
+ const detail = commandHelp(topic);
65
+ if (detail) finish(detail, 0);
66
+ else finish(`unknown command: ${topic}\n\n${overview()}`, 2, process.stderr);
67
+ } else {
68
+ finish(overview(), 0);
69
+ }
70
+ } else if (!cmd) {
71
+ // No command at all is a usage error, so it stays non-zero, on stderr so it
72
+ // cannot be mistaken for output.
73
+ finish(overview(), 1, process.stderr);
74
+ } else if (!COMMANDS.some((c) => c.name === cmd)) {
75
+ finish(`unknown command: ${cmd}\n\n${overview()}`, 2, process.stderr);
76
+ } else {
77
+ // A project whose installed skill is from another CLI version hears about
78
+ // it once (stderr, so piped output and --json stay clean). Not under mcp,
79
+ // whose stdio is the protocol, nor where the skill is being written.
80
+ if (cmd && !["mcp", "skill", "link", "help"].includes(cmd)) {
81
+ try {
82
+ const notice = skillNotice();
83
+ if (notice) console.error(dim(notice));
84
+ } catch {
85
+ /* never in the way of the command */
86
+ }
87
+ }
88
+
89
+ await dispatch(cmd);
90
+ }
91
+
92
+ async function dispatch(cmd) {
93
+ switch (cmd) {
94
+ case "login":
95
+ await login(flags, rest);
96
+ break;
97
+ case "logout":
98
+ await logout(flags);
99
+ break;
100
+ case "whoami":
101
+ await whoami(flags);
102
+ break;
103
+ case "link":
104
+ await link(flags);
105
+ break;
106
+ case "typegen":
107
+ await typegen(flags);
108
+ break;
109
+ case "tail":
110
+ await tail(flags);
111
+ break;
112
+ case "call":
113
+ await call(flags, rest);
114
+ break;
115
+ case "run":
116
+ await run(flags, rest);
117
+ break;
118
+ case "emit":
119
+ await emit(flags, rest);
120
+ break;
121
+ case "data":
122
+ await data(flags, rest);
123
+ break;
124
+ case "tokens":
125
+ await tokens(flags, rest);
126
+ break;
127
+ case "docs":
128
+ await docs(flags, rest);
129
+ break;
130
+ case "deploy":
131
+ await deploy(flags);
132
+ break;
133
+ case "apps":
134
+ await apps(flags);
135
+ break;
136
+ case "env":
137
+ await env(flags, rest);
138
+ break;
139
+ case "logs":
140
+ await logs(flags, rest);
141
+ break;
142
+ case "dockerfile":
143
+ await dockerfile(flags, rest);
144
+ break;
145
+ case "bots":
146
+ await bots(flags, rest);
147
+ break;
148
+ case "sources":
149
+ await sources(flags, rest);
150
+ break;
151
+ case "setup":
152
+ await setup(flags, rest);
153
+ break;
154
+ case "incidents":
155
+ await incidents(flags, rest);
156
+ break;
157
+ case "channels":
158
+ await channels(flags, rest);
159
+ break;
160
+ case "products":
161
+ await products(flags, rest);
162
+ break;
163
+ case "metrics":
164
+ await metrics(flags, rest);
165
+ break;
166
+ case "dashboards":
167
+ await dashboards(flags, rest);
168
+ break;
169
+ case "db":
170
+ await db(flags, rest);
171
+ break;
172
+ case "secrets":
173
+ await secrets(flags, rest);
174
+ break;
175
+ case "loops":
176
+ await loops(flags, rest);
177
+ break;
178
+ case "flows":
179
+ await flows(flags, rest);
180
+ break;
181
+ case "pull":
182
+ await pull(flags, rest);
183
+ break;
184
+ case "push":
185
+ await push(flags, rest);
186
+ break;
187
+ case "status":
188
+ await status(flags, rest);
189
+ break;
190
+ case "lint":
191
+ await lint(flags, rest);
192
+ break;
193
+ case "qa":
194
+ await qa(flags, rest);
195
+ break;
196
+ case "rehearse":
197
+ await rehearse(flags);
198
+ break;
199
+ case "skill":
200
+ await skill(flags);
201
+ break;
202
+ case "mcp":
203
+ await mcp(flags);
204
+ break;
205
+ case "coord": {
206
+ // coord uses bun:sqlite and is TypeScript; the shipped binary is Bun-compiled.
207
+ if (typeof Bun === "undefined") {
208
+ console.error("oalo coord needs the oalo binary (Bun runtime). Run it with `bun src/index.js coord ...` in development.");
209
+ process.exit(1);
210
+ }
211
+ const { coord } = await import("./commands/coord.ts");
212
+ await coord(flags, rest);
213
+ break;
214
+ }
215
+ }
216
+ }