@controllerai/cli 0.2.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.
- package/README.md +180 -0
- package/dist/api/client.js +330 -0
- package/dist/api/client.js.map +1 -0
- package/dist/appLinks.js +99 -0
- package/dist/appLinks.js.map +1 -0
- package/dist/argv.js +124 -0
- package/dist/argv.js.map +1 -0
- package/dist/commands/agent.js +813 -0
- package/dist/commands/agent.js.map +1 -0
- package/dist/commands/auth.js +327 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/branch.js +441 -0
- package/dist/commands/branch.js.map +1 -0
- package/dist/commands/connect.js +148 -0
- package/dist/commands/connect.js.map +1 -0
- package/dist/commands/connection.js +148 -0
- package/dist/commands/connection.js.map +1 -0
- package/dist/commands/data.js +441 -0
- package/dist/commands/data.js.map +1 -0
- package/dist/commands/deps.js +63 -0
- package/dist/commands/deps.js.map +1 -0
- package/dist/commands/doctor.js +102 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/events.js +72 -0
- package/dist/commands/events.js.map +1 -0
- package/dist/commands/exec.js +306 -0
- package/dist/commands/exec.js.map +1 -0
- package/dist/commands/expr.js +346 -0
- package/dist/commands/expr.js.map +1 -0
- package/dist/commands/flow.js +447 -0
- package/dist/commands/flow.js.map +1 -0
- package/dist/commands/integration.js +102 -0
- package/dist/commands/integration.js.map +1 -0
- package/dist/commands/node.js +885 -0
- package/dist/commands/node.js.map +1 -0
- package/dist/commands/organize.js +234 -0
- package/dist/commands/organize.js.map +1 -0
- package/dist/commands/run.js +437 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/schema.js +269 -0
- package/dist/commands/schema.js.map +1 -0
- package/dist/commands/skills.js +1156 -0
- package/dist/commands/skills.js.map +1 -0
- package/dist/commands/trigger.js +992 -0
- package/dist/commands/trigger.js.map +1 -0
- package/dist/commands/workflow.js +503 -0
- package/dist/commands/workflow.js.map +1 -0
- package/dist/config.js +74 -0
- package/dist/config.js.map +1 -0
- package/dist/context.js +39 -0
- package/dist/context.js.map +1 -0
- package/dist/errors.js +59 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.js +125 -0
- package/dist/index.js.map +1 -0
- package/dist/jsSource.js +32 -0
- package/dist/jsSource.js.map +1 -0
- package/dist/nodeProps.js +177 -0
- package/dist/nodeProps.js.map +1 -0
- package/dist/output.js +85 -0
- package/dist/output.js.map +1 -0
- package/dist/version.js +7 -0
- package/dist/version.js.map +1 -0
- package/package.json +41 -0
- package/skills/controllerai-agents/SKILL.md +169 -0
- package/skills/controllerai-agents/agents/openai.yaml +4 -0
- package/skills/controllerai-agents/references/instructions-and-versioning.md +76 -0
- package/skills/controllerai-ai-nodes/SKILL.md +83 -0
- package/skills/controllerai-ai-nodes/agents/openai.yaml +4 -0
- package/skills/controllerai-ai-nodes/references/selection-and-testing.md +46 -0
- package/skills/controllerai-data/SKILL.md +121 -0
- package/skills/controllerai-data/agents/openai.yaml +4 -0
- package/skills/controllerai-data/references/data-rails.md +46 -0
- package/skills/controllerai-expressions/SKILL.md +115 -0
- package/skills/controllerai-expressions/agents/openai.yaml +4 -0
- package/skills/controllerai-expressions/references/dsl-and-recipes.md +120 -0
- package/skills/controllerai-flow-control/SKILL.md +132 -0
- package/skills/controllerai-flow-control/agents/openai.yaml +4 -0
- package/skills/controllerai-flow-control/references/patterns.md +61 -0
- package/skills/controllerai-integration-actions/SKILL.md +95 -0
- package/skills/controllerai-integration-actions/agents/openai.yaml +4 -0
- package/skills/controllerai-node-config/SKILL.md +138 -0
- package/skills/controllerai-node-config/agents/openai.yaml +4 -0
- package/skills/controllerai-node-config/references/prop-and-readiness.md +72 -0
- package/skills/controllerai-runs/SKILL.md +109 -0
- package/skills/controllerai-runs/agents/openai.yaml +4 -0
- package/skills/controllerai-runs/references/debugging.md +53 -0
- package/skills/controllerai-start/SKILL.md +44 -0
- package/skills/controllerai-start/agents/openai.yaml +4 -0
- package/skills/controllerai-triggers/SKILL.md +174 -0
- package/skills/controllerai-triggers/agents/openai.yaml +4 -0
- package/skills/controllerai-triggers/references/lifecycle.md +54 -0
- package/skills/controllerai-workflows/SKILL.md +86 -0
- package/skills/controllerai-workflows/agents/openai.yaml +4 -0
- package/skills/controllerai-workflows/references/command-map.md +64 -0
- package/skills/manifest.json +248 -0
package/dist/argv.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ids are 12 characters from a URL-safe 64-symbol alphabet that includes `-`,
|
|
3
|
+
* so roughly one id in 64 begins with a hyphen — `-4xdQMkNx5I`, `-2h39vCLrwYj`.
|
|
4
|
+
* Passed as a positional, commander reads it as an option and fails with
|
|
5
|
+
* "unknown option", which looks like a caller mistake but is ours.
|
|
6
|
+
*
|
|
7
|
+
* Two defences, both applied before commander ever sees the arguments:
|
|
8
|
+
*
|
|
9
|
+
* 1. `--id <value>` works on every command that takes a positional id. The
|
|
10
|
+
* pair is lifted out here and re-appended after a `--` terminator, so the
|
|
11
|
+
* value reaches the action as the positional it always was and no command
|
|
12
|
+
* has to be rewritten to accept it.
|
|
13
|
+
* 2. A bare single-dash token that is not a declared flag and has the shape of
|
|
14
|
+
* an id is rescued the same way, so the obvious spelling just works.
|
|
15
|
+
*
|
|
16
|
+
* Double-dash tokens are deliberately NOT rescued: `--jsonn` is a typo, not an
|
|
17
|
+
* id, and silently turning it into an operand would trade a clear error for a
|
|
18
|
+
* confusing one. Those get a pointed message instead (see `unknownOptionHint`).
|
|
19
|
+
*/
|
|
20
|
+
/** `-` followed by at least six id characters — never a real short flag. */
|
|
21
|
+
const ID_SHAPED = /^-[A-Za-z0-9_-]{6,}$/;
|
|
22
|
+
/** Every long and short flag declared anywhere in the command tree. */
|
|
23
|
+
export const collectFlags = (command, into = new Set()) => {
|
|
24
|
+
for (const option of command.options) {
|
|
25
|
+
if (option.long)
|
|
26
|
+
into.add(option.long);
|
|
27
|
+
if (option.short)
|
|
28
|
+
into.add(option.short);
|
|
29
|
+
}
|
|
30
|
+
for (const sub of command.commands)
|
|
31
|
+
collectFlags(sub, into);
|
|
32
|
+
return into;
|
|
33
|
+
};
|
|
34
|
+
export const normalizeArgv = (argv, knownFlags) => {
|
|
35
|
+
const kept = [];
|
|
36
|
+
const rescued = [];
|
|
37
|
+
let index = 0;
|
|
38
|
+
while (index < argv.length) {
|
|
39
|
+
const token = argv[index];
|
|
40
|
+
// Everything after an explicit `--` is already operands; leave it alone.
|
|
41
|
+
if (token === '--') {
|
|
42
|
+
kept.push(...argv.slice(index));
|
|
43
|
+
return kept;
|
|
44
|
+
}
|
|
45
|
+
if (token === '--id') {
|
|
46
|
+
const value = argv[index + 1];
|
|
47
|
+
if (value === undefined) {
|
|
48
|
+
// Let commander produce its own "argument missing" error.
|
|
49
|
+
kept.push(token);
|
|
50
|
+
index += 1;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
rescued.push(value);
|
|
54
|
+
index += 2;
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (token.startsWith('--id=')) {
|
|
58
|
+
rescued.push(token.slice('--id='.length));
|
|
59
|
+
index += 1;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (!token.startsWith('--') && ID_SHAPED.test(token) && !knownFlags.has(token)) {
|
|
63
|
+
rescued.push(token);
|
|
64
|
+
index += 1;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
kept.push(token);
|
|
68
|
+
index += 1;
|
|
69
|
+
}
|
|
70
|
+
return rescued.length ? [...kept, '--', ...rescued] : kept;
|
|
71
|
+
};
|
|
72
|
+
export const unknownOptionHint = (flag) => `If "${flag}" is an id beginning with "-", pass it as \`--id ${flag.replace(/^-+/, '-')}\`.\n` +
|
|
73
|
+
'Every command that takes a positional id also accepts `--id <value>`, which is the ' +
|
|
74
|
+
'reliable spelling for hyphen-leading ids (they are common: the id alphabet includes "-").';
|
|
75
|
+
/**
|
|
76
|
+
* Commander writes `error: unknown option '--x'` and then the whole help block,
|
|
77
|
+
* so a hint appended at exit time lands below the help and is easy to miss.
|
|
78
|
+
* Splice it onto the error line itself instead, on every command in the tree —
|
|
79
|
+
* `configureOutput` is per-command and is not inherited by subcommands that were
|
|
80
|
+
* created before it was set.
|
|
81
|
+
*/
|
|
82
|
+
export const explainUnknownOptions = (command) => {
|
|
83
|
+
const write = (chunk) => {
|
|
84
|
+
const match = /unknown option '(-[^']+)'/.exec(chunk);
|
|
85
|
+
// When commander already offers a near-miss suggestion the token is a typo,
|
|
86
|
+
// not an id; adding the id hint on top would be noise.
|
|
87
|
+
const isTypo = /Did you mean/.test(chunk);
|
|
88
|
+
process.stderr.write(match && !isTypo ? `${chunk}${unknownOptionHint(match[1])}\n\n` : chunk);
|
|
89
|
+
};
|
|
90
|
+
command.configureOutput({ writeErr: write });
|
|
91
|
+
for (const sub of command.commands)
|
|
92
|
+
explainUnknownOptions(sub);
|
|
93
|
+
};
|
|
94
|
+
/** `exitOverride` is only inherited by subcommands created after it is set. */
|
|
95
|
+
export const applyExitOverride = (command, handler) => {
|
|
96
|
+
command.exitOverride(handler);
|
|
97
|
+
for (const sub of command.commands)
|
|
98
|
+
applyExitOverride(sub, handler);
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* `--json`, `--workflow` and `--api-url` are documented as global, and an agent
|
|
102
|
+
* reasonably writes them AFTER the subcommand (`cai flow list --json`).
|
|
103
|
+
* Commander only parses an option on the command that declares it, so they are
|
|
104
|
+
* declared on every command in the tree rather than the root alone.
|
|
105
|
+
*
|
|
106
|
+
* No defaults are attached: an absent flag must read as `undefined` so that
|
|
107
|
+
* `globalOpt()` keeps walking up to an ancestor that did set it. A `false`
|
|
108
|
+
* default on a leaf would shadow a `--json` given before the subcommand.
|
|
109
|
+
*/
|
|
110
|
+
export const addGlobalOptions = (command) => {
|
|
111
|
+
for (const sub of command.commands) {
|
|
112
|
+
const declared = new Set(sub.options.map(o => o.long));
|
|
113
|
+
if (!declared.has('--json'))
|
|
114
|
+
sub.option('--json', 'machine-readable output on stdout');
|
|
115
|
+
if (!declared.has('--workflow')) {
|
|
116
|
+
sub.option('--workflow <id>', 'workflow id (overrides `cai use` and CAI_WORKFLOW)');
|
|
117
|
+
}
|
|
118
|
+
if (!declared.has('--api-url')) {
|
|
119
|
+
sub.option('--api-url <url>', 'backend base URL (overrides CAI_API_URL)');
|
|
120
|
+
}
|
|
121
|
+
addGlobalOptions(sub);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
//# sourceMappingURL=argv.js.map
|
package/dist/argv.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"argv.js","sourceRoot":"","sources":["../src/argv.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,4EAA4E;AAC5E,MAAM,SAAS,GAAG,sBAAsB,CAAA;AAExC,uEAAuE;AACvE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAgB,EAAE,OAAO,IAAI,GAAG,EAAU,EAAe,EAAE;IACtF,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACrC,IAAI,MAAM,CAAC,IAAI;YAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QACtC,IAAI,MAAM,CAAC,KAAK;YAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAC1C,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,QAAQ;QAAE,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAC3D,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAc,EAAE,UAAuB,EAAY,EAAE;IACjF,MAAM,IAAI,GAAa,EAAE,CAAA;IACzB,MAAM,OAAO,GAAa,EAAE,CAAA;IAC5B,IAAI,KAAK,GAAG,CAAC,CAAA;IAEb,OAAO,KAAK,GAAG,IAAI,C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