@farmslot/agent-runtime 0.9.0 → 0.11.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/CHANGELOG.md +20 -1
- package/README.md +1 -1
- package/bin/farmslot-agent.mjs +1 -1
- package/dist/execution-template/create.d.ts.map +1 -1
- package/dist/execution-template/create.js +4 -9
- package/dist/execution-template/create.js.map +1 -1
- package/dist/execution-template/execution-template.test.js +85 -34
- package/dist/execution-template/execution-template.test.js.map +1 -1
- package/dist/execution-template/frontmatter.d.ts +6 -3
- package/dist/execution-template/frontmatter.d.ts.map +1 -1
- package/dist/execution-template/frontmatter.js +8 -10
- package/dist/execution-template/frontmatter.js.map +1 -1
- package/dist/execution-template/index.d.ts +2 -2
- package/dist/execution-template/index.d.ts.map +1 -1
- package/dist/execution-template/index.js +2 -2
- package/dist/execution-template/index.js.map +1 -1
- package/dist/execution-template/infer.d.ts +2 -3
- package/dist/execution-template/infer.d.ts.map +1 -1
- package/dist/execution-template/infer.js +2 -19
- package/dist/execution-template/infer.js.map +1 -1
- package/dist/execution-template/lint.d.ts.map +1 -1
- package/dist/execution-template/lint.js +12 -14
- package/dist/execution-template/lint.js.map +1 -1
- package/dist/execution-template/resolve.d.ts.map +1 -1
- package/dist/execution-template/resolve.js +0 -2
- package/dist/execution-template/resolve.js.map +1 -1
- package/dist/execution-template/select.d.ts.map +1 -1
- package/dist/execution-template/select.js +4 -8
- package/dist/execution-template/select.js.map +1 -1
- package/dist/execution-template/snapshot.d.ts.map +1 -1
- package/dist/execution-template/snapshot.js +0 -1
- package/dist/execution-template/snapshot.js.map +1 -1
- package/dist/execution-template/types.d.ts +10 -5
- package/dist/execution-template/types.d.ts.map +1 -1
- package/dist/execution-template/types.js.map +1 -1
- package/dist/native/account-claude.d.ts +5 -0
- package/dist/native/account-claude.d.ts.map +1 -0
- package/dist/native/account-claude.js +42 -0
- package/dist/native/account-claude.js.map +1 -0
- package/dist/native/account-codex.d.ts +4 -0
- package/dist/native/account-codex.d.ts.map +1 -0
- package/dist/native/account-codex.js +51 -0
- package/dist/native/account-codex.js.map +1 -0
- package/dist/native/account-common.d.ts +30 -0
- package/dist/native/account-common.d.ts.map +1 -0
- package/dist/native/account-common.js +155 -0
- package/dist/native/account-common.js.map +1 -0
- package/dist/native/account-cursor.d.ts +5 -0
- package/dist/native/account-cursor.d.ts.map +1 -0
- package/dist/native/account-cursor.js +48 -0
- package/dist/native/account-cursor.js.map +1 -0
- package/dist/native/account-grok.d.ts +4 -0
- package/dist/native/account-grok.d.ts.map +1 -0
- package/dist/native/account-grok.js +55 -0
- package/dist/native/account-grok.js.map +1 -0
- package/dist/native/account-observation.test.d.ts +2 -0
- package/dist/native/account-observation.test.d.ts.map +1 -0
- package/dist/native/account-observation.test.js +256 -0
- package/dist/native/account-observation.test.js.map +1 -0
- package/dist/native/account-profiles.d.ts +11 -0
- package/dist/native/account-profiles.d.ts.map +1 -0
- package/dist/native/account-profiles.js +172 -0
- package/dist/native/account-profiles.js.map +1 -0
- package/dist/native/account-profiles.test.d.ts +2 -0
- package/dist/native/account-profiles.test.d.ts.map +1 -0
- package/dist/native/account-profiles.test.js +172 -0
- package/dist/native/account-profiles.test.js.map +1 -0
- package/dist/native/account-types.d.ts +11 -0
- package/dist/native/account-types.d.ts.map +1 -0
- package/dist/native/account-types.js +2 -0
- package/dist/native/account-types.js.map +1 -0
- package/dist/native/acp-requests.d.ts +11 -0
- package/dist/native/acp-requests.d.ts.map +1 -0
- package/dist/native/acp-requests.js +109 -0
- package/dist/native/acp-requests.js.map +1 -0
- package/dist/native/acp-rpc.d.ts +15 -0
- package/dist/native/acp-rpc.d.ts.map +1 -0
- package/dist/native/acp-rpc.js +73 -0
- package/dist/native/acp-rpc.js.map +1 -0
- package/dist/native/acp.d.ts +15 -0
- package/dist/native/acp.d.ts.map +1 -0
- package/dist/native/acp.js +285 -0
- package/dist/native/acp.js.map +1 -0
- package/dist/native/acp.test.d.ts +2 -0
- package/dist/native/acp.test.d.ts.map +1 -0
- package/dist/native/acp.test.js +257 -0
- package/dist/native/acp.test.js.map +1 -0
- package/dist/native/claude.d.ts.map +1 -1
- package/dist/native/claude.js +14 -0
- package/dist/native/claude.js.map +1 -1
- package/dist/native/client.d.ts +13 -0
- package/dist/native/client.d.ts.map +1 -1
- package/dist/native/client.js +112 -1
- package/dist/native/client.js.map +1 -1
- package/dist/native/codex.d.ts.map +1 -1
- package/dist/native/codex.js +61 -3
- package/dist/native/codex.js.map +1 -1
- package/dist/native/cursor-model.d.ts +6 -0
- package/dist/native/cursor-model.d.ts.map +1 -0
- package/dist/native/cursor-model.js +74 -0
- package/dist/native/cursor-model.js.map +1 -0
- package/dist/native/cursor-model.test.d.ts +2 -0
- package/dist/native/cursor-model.test.d.ts.map +1 -0
- package/dist/native/cursor-model.test.js +40 -0
- package/dist/native/cursor-model.test.js.map +1 -0
- package/dist/native/cursor.d.ts +2 -0
- package/dist/native/cursor.d.ts.map +1 -0
- package/dist/native/cursor.js +30 -0
- package/dist/native/cursor.js.map +1 -0
- package/dist/native/durability.test.js +461 -1
- package/dist/native/durability.test.js.map +1 -1
- package/dist/native/filesystem-policy.test.d.ts +2 -0
- package/dist/native/filesystem-policy.test.d.ts.map +1 -0
- package/dist/native/filesystem-policy.test.js +136 -0
- package/dist/native/filesystem-policy.test.js.map +1 -0
- package/dist/native/grok.d.ts +2 -0
- package/dist/native/grok.d.ts.map +1 -0
- package/dist/native/grok.js +17 -0
- package/dist/native/grok.js.map +1 -0
- package/dist/native/host.js +39 -0
- package/dist/native/host.js.map +1 -1
- package/dist/native/index.d.ts +3 -0
- package/dist/native/index.d.ts.map +1 -1
- package/dist/native/index.js +3 -0
- package/dist/native/index.js.map +1 -1
- package/dist/native/ipc.d.ts +59 -0
- package/dist/native/ipc.d.ts.map +1 -1
- package/dist/native/ipc.js +76 -4
- package/dist/native/ipc.js.map +1 -1
- package/dist/native/manager.d.ts +22 -4
- package/dist/native/manager.d.ts.map +1 -1
- package/dist/native/manager.js +386 -46
- package/dist/native/manager.js.map +1 -1
- package/dist/native/process-tree.d.ts +11 -0
- package/dist/native/process-tree.d.ts.map +1 -1
- package/dist/native/process-tree.js +123 -20
- package/dist/native/process-tree.js.map +1 -1
- package/dist/native/process-tree.test.js +126 -1
- package/dist/native/process-tree.test.js.map +1 -1
- package/dist/native/process.d.ts +5 -1
- package/dist/native/process.d.ts.map +1 -1
- package/dist/native/process.js +36 -13
- package/dist/native/process.js.map +1 -1
- package/dist/native/process.test.d.ts +2 -0
- package/dist/native/process.test.d.ts.map +1 -0
- package/dist/native/process.test.js +56 -0
- package/dist/native/process.test.js.map +1 -0
- package/dist/native/profile-service.d.ts +5 -0
- package/dist/native/profile-service.d.ts.map +1 -0
- package/dist/native/profile-service.js +76 -0
- package/dist/native/profile-service.js.map +1 -0
- package/dist/native/registry.d.ts +20 -0
- package/dist/native/registry.d.ts.map +1 -0
- package/dist/native/registry.js +89 -0
- package/dist/native/registry.js.map +1 -0
- package/dist/native/registry.test.d.ts +2 -0
- package/dist/native/registry.test.d.ts.map +1 -0
- package/dist/native/registry.test.js +13 -0
- package/dist/native/registry.test.js.map +1 -0
- package/dist/native/review-sandbox.d.ts +12 -0
- package/dist/native/review-sandbox.d.ts.map +1 -0
- package/dist/native/review-sandbox.js +6 -0
- package/dist/native/review-sandbox.js.map +1 -0
- package/dist/native/review-sandbox.test.d.ts +2 -0
- package/dist/native/review-sandbox.test.d.ts.map +1 -0
- package/dist/native/review-sandbox.test.js +40 -0
- package/dist/native/review-sandbox.test.js.map +1 -0
- package/dist/native/service.d.ts.map +1 -1
- package/dist/native/service.js +42 -8
- package/dist/native/service.js.map +1 -1
- package/dist/native/supervisor.js +121 -33
- package/dist/native/supervisor.js.map +1 -1
- package/dist/native/types.d.ts +11 -1
- package/dist/native/types.d.ts.map +1 -1
- package/dist/native/worker-history.d.ts +16 -0
- package/dist/native/worker-history.d.ts.map +1 -0
- package/dist/native/worker-history.js +77 -0
- package/dist/native/worker-history.js.map +1 -0
- package/dist/native/worker-history.test.d.ts +2 -0
- package/dist/native/worker-history.test.d.ts.map +1 -0
- package/dist/native/worker-history.test.js +195 -0
- package/dist/native/worker-history.test.js.map +1 -0
- package/dist/native/worker-launch.d.ts +72 -0
- package/dist/native/worker-launch.d.ts.map +1 -0
- package/dist/native/worker-launch.js +134 -0
- package/dist/native/worker-launch.js.map +1 -0
- package/dist/native/worker-launch.test.d.ts +2 -0
- package/dist/native/worker-launch.test.d.ts.map +1 -0
- package/dist/native/worker-launch.test.js +61 -0
- package/dist/native/worker-launch.test.js.map +1 -0
- package/dist/native/worker-relocation.test.d.ts +2 -0
- package/dist/native/worker-relocation.test.d.ts.map +1 -0
- package/dist/native/worker-relocation.test.js +110 -0
- package/dist/native/worker-relocation.test.js.map +1 -0
- package/dist/native/worker-service.d.ts +4 -0
- package/dist/native/worker-service.d.ts.map +1 -0
- package/dist/native/worker-service.js +85 -0
- package/dist/native/worker-service.js.map +1 -0
- package/dist/task-init/discover.d.ts +26 -0
- package/dist/task-init/discover.d.ts.map +1 -0
- package/dist/task-init/discover.js +64 -0
- package/dist/task-init/discover.js.map +1 -0
- package/dist/task-init/discover.test.d.ts +2 -0
- package/dist/task-init/discover.test.d.ts.map +1 -0
- package/dist/task-init/discover.test.js +58 -0
- package/dist/task-init/discover.test.js.map +1 -0
- package/dist/task-init/index.d.ts +6 -1
- package/dist/task-init/index.d.ts.map +1 -1
- package/dist/task-init/index.js +8 -3
- package/dist/task-init/index.js.map +1 -1
- package/dist/task-init/task-document.d.ts.map +1 -1
- package/dist/task-init/task-document.js +2 -2
- package/dist/task-init/task-document.js.map +1 -1
- package/dist/task-init/write.d.ts +0 -6
- package/dist/task-init/write.d.ts.map +1 -1
- package/dist/task-init/write.js +1 -8
- package/dist/task-init/write.js.map +1 -1
- package/package.json +3 -3
- package/scripts/cursor-session-discovery.cjs +48 -0
- package/scripts/execution-template-cli.mjs +8 -11
- package/scripts/review-filesystem.cjs +39 -0
- package/scripts/review-session.cjs +45 -0
- package/scripts/review-terminal.cjs +134 -0
- package/scripts/task-init-cli.mjs +3 -3
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Persist a runner-owned chat identity before launching a managed review terminal.
|
|
2
|
+
const fs = require('node:fs');
|
|
3
|
+
const path = require('node:path');
|
|
4
|
+
const cp = require('node:child_process');
|
|
5
|
+
const input = JSON.parse(process.argv[2]);
|
|
6
|
+
const file = path.join(input.task, '.runner-session.json');
|
|
7
|
+
const identity = { runId: input.runId, workspaceId: input.workspaceId, runner: input.runner };
|
|
8
|
+
if (!path.isAbsolute(input.task) || !path.isAbsolute(input.cwd))
|
|
9
|
+
throw Error('Invalid session workspace');
|
|
10
|
+
if (fs.existsSync(file)) {
|
|
11
|
+
const saved = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
12
|
+
for (const key of Object.keys(identity))
|
|
13
|
+
if (saved[key] !== identity[key]) throw Error('Runner session identity changed');
|
|
14
|
+
if (input.resumeSessionId && saved.sessionId !== input.resumeSessionId)
|
|
15
|
+
throw Error('Retained session changed');
|
|
16
|
+
process.stdout.write(JSON.stringify(saved));
|
|
17
|
+
} else {
|
|
18
|
+
let sessionId = input.resumeSessionId;
|
|
19
|
+
if (!sessionId) {
|
|
20
|
+
const env = { ...process.env, ...input.environment.set };
|
|
21
|
+
for (const key of [
|
|
22
|
+
...input.environment.unset,
|
|
23
|
+
'FARMSLOT_NODE_TOKEN',
|
|
24
|
+
'FARMSLOT_GATEWAY_TOKEN',
|
|
25
|
+
'FARMSLOT_GATEWAY_PASSWORD',
|
|
26
|
+
'CLAUDECODE',
|
|
27
|
+
])
|
|
28
|
+
delete env[key];
|
|
29
|
+
const result = cp.spawnSync(input.argv[0], input.argv.slice(1), {
|
|
30
|
+
cwd: input.cwd,
|
|
31
|
+
env,
|
|
32
|
+
encoding: 'utf8',
|
|
33
|
+
timeout: 20000,
|
|
34
|
+
});
|
|
35
|
+
if (result.error) throw result.error;
|
|
36
|
+
if (result.status !== 0) throw Error(result.stderr || 'Could not reserve runner session');
|
|
37
|
+
sessionId = result.stdout.trim();
|
|
38
|
+
}
|
|
39
|
+
// create-chat documents a UUID result. Never infer identity from terminal text.
|
|
40
|
+
if (!/^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/i.test(sessionId))
|
|
41
|
+
throw Error('Runner returned an invalid chat ID');
|
|
42
|
+
const saved = { ...identity, sessionId };
|
|
43
|
+
fs.writeFileSync(file, JSON.stringify(saved), { flag: 'wx', mode: 0o600 });
|
|
44
|
+
process.stdout.write(JSON.stringify(saved));
|
|
45
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// Runner-neutral terminal lifecycle. Inputs come from the owning gateway, never PR content.
|
|
2
|
+
const fs = require('node:fs'),
|
|
3
|
+
path = require('node:path'),
|
|
4
|
+
cp = require('node:child_process');
|
|
5
|
+
const { sandbox } = require('./review-filesystem.cjs');
|
|
6
|
+
const input = JSON.parse(process.argv[2]);
|
|
7
|
+
const quote = (s) => "'" + s.replaceAll("'", "'\\''") + "'";
|
|
8
|
+
const tmux = (args) => cp.spawnSync('tmux', args, { encoding: 'utf8' });
|
|
9
|
+
const check = (result) => {
|
|
10
|
+
if (result.status !== 0)
|
|
11
|
+
throw Error(result.stderr || result.error?.message || 'Terminal operation failed');
|
|
12
|
+
return result.stdout.trim();
|
|
13
|
+
};
|
|
14
|
+
const target = input.session;
|
|
15
|
+
async function main() {
|
|
16
|
+
if (
|
|
17
|
+
!/^[a-zA-Z0-9_-]+$/.test(input.session) ||
|
|
18
|
+
!path.isAbsolute(input.task) ||
|
|
19
|
+
!path.isAbsolute(input.cwd)
|
|
20
|
+
)
|
|
21
|
+
throw Error('Invalid review terminal identity');
|
|
22
|
+
const marker = path.join(input.task, '.terminal-launch.json');
|
|
23
|
+
const cancelled = path.join(input.task, '.terminal-cancelled');
|
|
24
|
+
const existing = fs.existsSync(marker) ? JSON.parse(fs.readFileSync(marker, 'utf8')) : undefined;
|
|
25
|
+
if (
|
|
26
|
+
existing &&
|
|
27
|
+
(existing.runId !== input.runId ||
|
|
28
|
+
existing.workspaceId !== input.workspaceId ||
|
|
29
|
+
existing.session !== input.session)
|
|
30
|
+
)
|
|
31
|
+
throw Error('Review terminal identity changed');
|
|
32
|
+
const has = tmux(['has-session', '-t', '=' + target]);
|
|
33
|
+
if (![0, 1].includes(has.status)) check(has);
|
|
34
|
+
if (
|
|
35
|
+
has.status === 0 &&
|
|
36
|
+
check(tmux(['show-option', '-v', '-t', target, '@farmslot-review-workspace'])) !==
|
|
37
|
+
input.workspaceId
|
|
38
|
+
)
|
|
39
|
+
throw Error('Review terminal belongs to another workspace');
|
|
40
|
+
if (input.action === 'stop') {
|
|
41
|
+
fs.writeFileSync(cancelled, input.runId, { mode: 0o600 });
|
|
42
|
+
if (has.status === 0) check(tmux(['kill-session', '-t', target]));
|
|
43
|
+
process.stdout.write(JSON.stringify({ stopped: true }));
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (input.action === 'inspect') {
|
|
47
|
+
process.stdout.write(JSON.stringify({ exists: has.status === 0, launch: existing }));
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (fs.existsSync(cancelled)) throw new Error('Review terminal launch was cancelled');
|
|
51
|
+
if (existing) {
|
|
52
|
+
if (has.status !== 0) throw Error('Review terminal exited; explicit retry required');
|
|
53
|
+
process.stdout.write(JSON.stringify(existing));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (has.status === 0) throw Error('Review terminal exists without a launch record');
|
|
57
|
+
const cwd = fs.realpathSync(input.cwd),
|
|
58
|
+
task = fs.realpathSync(input.task);
|
|
59
|
+
const gitRoot = check(
|
|
60
|
+
cp.spawnSync('git', ['-C', cwd, 'rev-parse', '--path-format=absolute', '--git-common-dir'], {
|
|
61
|
+
encoding: 'utf8',
|
|
62
|
+
}),
|
|
63
|
+
);
|
|
64
|
+
const policy = {
|
|
65
|
+
readOnlyRoots: [
|
|
66
|
+
cwd,
|
|
67
|
+
fs.realpathSync(gitRoot),
|
|
68
|
+
...(input.support ? [fs.realpathSync(input.support)] : []),
|
|
69
|
+
],
|
|
70
|
+
writableRoots: [task],
|
|
71
|
+
};
|
|
72
|
+
const runtimeRoots = input.runtimeRoots.map((root) =>
|
|
73
|
+
root.replace(/^~(?=\/|$)/, process.env.HOME),
|
|
74
|
+
);
|
|
75
|
+
const guard = await sandbox(policy, runtimeRoots);
|
|
76
|
+
const promptFile = path.join(task, '.terminal-prompt.txt');
|
|
77
|
+
fs.writeFileSync(promptFile, input.prompt, { mode: 0o600 });
|
|
78
|
+
if (input.setup) check(cp.spawnSync('/bin/sh', ['-c', input.setup], { cwd, encoding: 'utf8' }));
|
|
79
|
+
const environment = {
|
|
80
|
+
...process.env,
|
|
81
|
+
...input.environment.set,
|
|
82
|
+
TMPDIR: guard.temporaryDirectory,
|
|
83
|
+
DISABLE_OMX: '1',
|
|
84
|
+
DISABLE_OMC: '1',
|
|
85
|
+
};
|
|
86
|
+
for (const key of [
|
|
87
|
+
...input.environment.unset,
|
|
88
|
+
'CLAUDECODE',
|
|
89
|
+
'FARMSLOT_NODE_TOKEN',
|
|
90
|
+
'FARMSLOT_GATEWAY_TOKEN',
|
|
91
|
+
'FARMSLOT_GATEWAY_PASSWORD',
|
|
92
|
+
])
|
|
93
|
+
delete environment[key];
|
|
94
|
+
const commandFile = path.join(task, '.terminal-start.cjs');
|
|
95
|
+
const record = {
|
|
96
|
+
runId: input.runId,
|
|
97
|
+
workspaceId: input.workspaceId,
|
|
98
|
+
session: input.session,
|
|
99
|
+
startedAt: new Date().toISOString(),
|
|
100
|
+
};
|
|
101
|
+
const launch = `const cp=require('node:child_process');const env={...process.env};for(const key of ['FARMSLOT_NODE_TOKEN','FARMSLOT_GATEWAY_TOKEN','FARMSLOT_GATEWAY_PASSWORD','CLAUDECODE'])delete env[key];const r=cp.spawnSync(${JSON.stringify(guard.sandbox.executable)},${JSON.stringify([...guard.sandbox.args, '/bin/sh', '-c', input.command])},{cwd:${JSON.stringify(cwd)},env,stdio:'inherit'});process.exit(r.status??1);`;
|
|
102
|
+
fs.writeFileSync(commandFile, launch, { mode: 0o600 });
|
|
103
|
+
const envArgs = Object.entries(environment)
|
|
104
|
+
.filter(([, value]) => typeof value === 'string')
|
|
105
|
+
.flatMap(([name, value]) => ['-e', name + '=' + value]);
|
|
106
|
+
fs.writeFileSync(marker, JSON.stringify(record), { mode: 0o600, flag: 'wx' });
|
|
107
|
+
check(
|
|
108
|
+
tmux([
|
|
109
|
+
'new-session',
|
|
110
|
+
'-d',
|
|
111
|
+
...envArgs,
|
|
112
|
+
'-s',
|
|
113
|
+
input.session,
|
|
114
|
+
'-c',
|
|
115
|
+
cwd,
|
|
116
|
+
`${quote(process.execPath)} ${quote(commandFile)}`,
|
|
117
|
+
';',
|
|
118
|
+
'set-option',
|
|
119
|
+
'-t',
|
|
120
|
+
target,
|
|
121
|
+
'@farmslot-review-workspace',
|
|
122
|
+
input.workspaceId,
|
|
123
|
+
]),
|
|
124
|
+
);
|
|
125
|
+
if (fs.existsSync(cancelled)) {
|
|
126
|
+
check(tmux(['kill-session', '-t', target]));
|
|
127
|
+
throw new Error('Review terminal launch was cancelled');
|
|
128
|
+
}
|
|
129
|
+
process.stdout.write(JSON.stringify(record));
|
|
130
|
+
}
|
|
131
|
+
main().catch((error) => {
|
|
132
|
+
process.stderr.write(String(error));
|
|
133
|
+
process.exitCode = 1;
|
|
134
|
+
});
|
|
@@ -12,10 +12,11 @@ import { buildSources, loadRuntime, parseCatalogArgs } from './execution-templat
|
|
|
12
12
|
|
|
13
13
|
function usage(exitCode = 0) {
|
|
14
14
|
const text = [
|
|
15
|
-
'Usage: task init <task-dir> --flow f --
|
|
15
|
+
'Usage: task init <task-dir> --flow f --platform p --template id --title t [options]',
|
|
16
16
|
'',
|
|
17
17
|
' Template sources: --dir <path> --domain-dir <domain=path> --project-worker <path>',
|
|
18
18
|
' --package-templates <path> [--package-id id] [--project-name name] [--domain d]',
|
|
19
|
+
' Run: [--run-mode m] — run mode used to match project default rules',
|
|
19
20
|
' Task: --title t [--task-text s | --task-file path] [--ticket key] [--source-ref url]',
|
|
20
21
|
' Identity: [--surface s] [--project name] [--repo owner/name] [--attempt-id id]',
|
|
21
22
|
' Rendering: [--var KEY=VALUE]... [--task-dir-label label] [--mode-preamble text]',
|
|
@@ -88,7 +89,6 @@ function parseArgs(args) {
|
|
|
88
89
|
if (!opts.title) throw new Error('task init requires --title');
|
|
89
90
|
const catalog = parseCatalogArgs([...catalogArgs, '--id', opts.template]);
|
|
90
91
|
if (!catalog.flow) throw new Error('task init requires --flow');
|
|
91
|
-
if (!catalog.runMode) throw new Error('task init requires --run-mode');
|
|
92
92
|
if (!catalog.platform) throw new Error('task init requires --platform');
|
|
93
93
|
return { opts, catalog };
|
|
94
94
|
}
|
|
@@ -128,7 +128,7 @@ async function main() {
|
|
|
128
128
|
taskDir: path.resolve(opts.taskDir),
|
|
129
129
|
taskDirLabel: opts.taskDirLabel ?? opts.taskDir,
|
|
130
130
|
flow: catalog.flow,
|
|
131
|
-
runMode: catalog.runMode,
|
|
131
|
+
...(catalog.runMode ? { runMode: catalog.runMode } : {}),
|
|
132
132
|
platform: catalog.platform,
|
|
133
133
|
...(catalog.domain ? { domain: catalog.domain } : {}),
|
|
134
134
|
template: { sources: buildSources(catalog, runtime), explicitId: opts.template },
|