@applica-software-guru/sdd 1.8.2 → 1.8.3
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/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +9 -6
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/remote.d.ts.map +1 -1
- package/dist/commands/remote.js +46 -0
- package/dist/commands/remote.js.map +1 -1
- package/package.json +1 -1
- package/skills/sdd-remote/SKILL.md +51 -33
- package/src/commands/init.ts +9 -6
- package/src/commands/remote.ts +51 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqDpC,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA2InD"}
|
package/dist/commands/init.js
CHANGED
|
@@ -14,10 +14,10 @@ const sdd_core_1 = require("@applica-software-guru/sdd-core");
|
|
|
14
14
|
const banner_js_1 = require("../ui/banner.js");
|
|
15
15
|
const format_js_1 = require("../ui/format.js");
|
|
16
16
|
const markdown_js_1 = require("../ui/markdown.js");
|
|
17
|
-
const START_PROMPT = `
|
|
17
|
+
const START_PROMPT = `Use the \`sdd\` skill and the documentation in product/ and system/, then run \`sdd sync\` to start working.`;
|
|
18
18
|
function buildBootstrapPrompt(description, auto) {
|
|
19
19
|
if (auto) {
|
|
20
|
-
return `
|
|
20
|
+
return `Use the \`sdd\` skill. This is a new SDD project.
|
|
21
21
|
|
|
22
22
|
Project goal: "${description}"
|
|
23
23
|
|
|
@@ -31,9 +31,12 @@ Your task: generate the initial documentation for this project based on the desc
|
|
|
31
31
|
- system/tech-stack.md — Technologies and frameworks
|
|
32
32
|
- system/interfaces.md — API contracts
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
Set status: new on every file. Do NOT write any code, only documentation.
|
|
35
|
+
|
|
36
|
+
When done, commit with: git add -A && git commit -m "bootstrap: initial documentation"
|
|
37
|
+
Do NOT run \`sdd mark-synced\` — files must stay status: new so they can be implemented later.`;
|
|
35
38
|
}
|
|
36
|
-
return `
|
|
39
|
+
return `Use the \`sdd\` skill. This is a new SDD project.
|
|
37
40
|
|
|
38
41
|
Project goal: "${description}"
|
|
39
42
|
|
|
@@ -47,7 +50,7 @@ Your task: generate the initial documentation for this project. Ask me a few que
|
|
|
47
50
|
- system/tech-stack.md — Technologies and frameworks
|
|
48
51
|
- system/interfaces.md — API contracts
|
|
49
52
|
|
|
50
|
-
|
|
53
|
+
Set status: new on every file. Do NOT write any code, only documentation. Do NOT run \`sdd mark-synced\` — files must stay status: new so they can be implemented later.`;
|
|
51
54
|
}
|
|
52
55
|
function registerInit(program) {
|
|
53
56
|
program
|
|
@@ -151,7 +154,7 @@ function registerInit(program) {
|
|
|
151
154
|
console.log(` ${chalk_1.default.white("1.")} Enter the project folder:\n`);
|
|
152
155
|
console.log(` ${chalk_1.default.green(`cd ${projectName}`)}\n`);
|
|
153
156
|
console.log(` ${chalk_1.default.white("2.")} Start writing your documentation in ${chalk_1.default.cyan("product/")} and ${chalk_1.default.cyan("system/")}.`);
|
|
154
|
-
console.log(`
|
|
157
|
+
console.log(` Your agent will use the ${chalk_1.default.cyan("sdd")} skill automatically.\n`);
|
|
155
158
|
console.log(` ${chalk_1.default.white("3.")} When ready, let your AI agent run:\n`);
|
|
156
159
|
console.log(` ${chalk_1.default.green("sdd sync")}\n`);
|
|
157
160
|
const prompt = START_PROMPT;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":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C,MAAM,CAAC,CAAC;YAC/B,OAAO,CAAC,GAAG,CAAC,IAAA,mBAAO,EAAC,mDAAmD,CAAC,CAAC,CAAC;QAC5E,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,CAAC,GAAG,CAAC,IAAA,gBAAI,EAAC,0CAA0C,CAAC,CAAC,CAAC;QAChE,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../src/commands/remote.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../src/commands/remote.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAsKrD"}
|
package/dist/commands/remote.js
CHANGED
|
@@ -4,10 +4,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.registerRemote = registerRemote;
|
|
7
|
+
const node_os_1 = require("node:os");
|
|
7
8
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
9
|
const prompts_1 = require("@inquirer/prompts");
|
|
9
10
|
const sdd_core_1 = require("@applica-software-guru/sdd-core");
|
|
10
11
|
const format_js_1 = require("../ui/format.js");
|
|
12
|
+
const markdown_js_1 = require("../ui/markdown.js");
|
|
11
13
|
function registerRemote(program) {
|
|
12
14
|
const remote = program
|
|
13
15
|
.command('remote')
|
|
@@ -109,5 +111,49 @@ function registerRemote(program) {
|
|
|
109
111
|
}
|
|
110
112
|
console.log('');
|
|
111
113
|
});
|
|
114
|
+
remote
|
|
115
|
+
.command('worker')
|
|
116
|
+
.description('Start a persistent worker that receives and executes jobs from SDD Flow')
|
|
117
|
+
.option('--name <name>', 'Worker name (default: hostname)')
|
|
118
|
+
.option('--agent <agent>', 'Agent to use for executing jobs (default: from config or "claude")')
|
|
119
|
+
.option('--timeout <seconds>', 'Remote request timeout in seconds (default: 300)', parseInt)
|
|
120
|
+
.action(async (options) => {
|
|
121
|
+
const root = process.cwd();
|
|
122
|
+
const config = await (0, sdd_core_1.readConfig)(root);
|
|
123
|
+
console.log((0, format_js_1.heading)('SDD Remote Worker'));
|
|
124
|
+
try {
|
|
125
|
+
const apiConfig = (0, sdd_core_1.buildApiConfig)(config, options.timeout);
|
|
126
|
+
const agentName = options.agent ?? config.agent ?? 'claude';
|
|
127
|
+
console.log((0, format_js_1.info)(`Starting worker "${options.name ?? (0, node_os_1.hostname)()}" with agent "${agentName}"...`));
|
|
128
|
+
console.log((0, format_js_1.info)(`Connected to ${apiConfig.baseUrl}`));
|
|
129
|
+
console.log('');
|
|
130
|
+
await (0, sdd_core_1.startWorkerDaemon)({
|
|
131
|
+
root,
|
|
132
|
+
name: options.name,
|
|
133
|
+
agent: agentName,
|
|
134
|
+
agents: config.agents,
|
|
135
|
+
apiConfig,
|
|
136
|
+
onLog: (msg) => {
|
|
137
|
+
const timestamp = new Date().toISOString().slice(11, 19);
|
|
138
|
+
const isError = /error|warning/i.test(msg);
|
|
139
|
+
const isJob = msg.startsWith('┌') || msg.startsWith('│') || msg.startsWith('└');
|
|
140
|
+
const isJobDone = msg.includes('done —');
|
|
141
|
+
const formatted = isError
|
|
142
|
+
? chalk_1.default.yellow(msg)
|
|
143
|
+
: isJobDone
|
|
144
|
+
? chalk_1.default.green(msg)
|
|
145
|
+
: isJob
|
|
146
|
+
? chalk_1.default.cyan(msg)
|
|
147
|
+
: msg;
|
|
148
|
+
console.log(`${chalk_1.default.dim(timestamp)} ${formatted}`);
|
|
149
|
+
},
|
|
150
|
+
renderPrompt: markdown_js_1.renderMarkdown,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
catch (err) {
|
|
154
|
+
console.log((0, format_js_1.error)(err.message));
|
|
155
|
+
process.exit(1);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
112
158
|
}
|
|
113
159
|
//# sourceMappingURL=remote.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../../src/commands/remote.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../../src/commands/remote.ts"],"names":[],"mappings":";;;;;AAQA,wCAsKC;AA9KD,qCAAmC;AAEnC,kDAA0B;AAC1B,+CAAoD;AACpD,8DAAkH;AAClH,+CAAqF;AACrF,mDAAmD;AAEnD,SAAgB,cAAc,CAAC,OAAgB;IAC7C,MAAM,MAAM,GAAG,OAAO;SACnB,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,kCAAkC,CAAC,CAAC;IAEnD,MAAM;SACH,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,iCAAiC,CAAC;SAC9C,MAAM,CAAC,aAAa,EAAE,uBAAuB,CAAC;SAC9C,MAAM,CAAC,iBAAiB,EAAE,sCAAsC,CAAC;SACjE,MAAM,CAAC,qBAAqB,EAAE,kDAAkD,EAAE,QAAQ,CAAC;SAC3F,MAAM,CAAC,KAAK,EAAE,OAA4D,EAAE,EAAE;QAC7E,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAC;QAEtC,MAAM,GAAG,GACP,OAAO,CAAC,GAAG;YACX,CAAC,MAAM,IAAA,eAAK,EAAC;gBACX,OAAO,EAAE,kBAAkB;gBAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,iCAAiC;aACjE,CAAC,CAAC,CAAC;QAEN,MAAM,MAAM,GACV,OAAO,CAAC,MAAM;YACd,CAAC,MAAM,IAAA,kBAAQ,EAAC;gBACd,OAAO,EAAE,kDAAkD;aAC5D,CAAC,CAAC,CAAC;QAEN,MAAM,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AC,MAAM,CAAC,GAAG,CAAC;wBACnB,CAAC,CAAC,SAAS;4BACX,CAAC,CAAC,eAAK,CAAC,KAAK,CAAC,GAAG,CAAC;4BAClB,CAAC,CAAC,KAAK;gCACP,CAAC,CAAC,eAAK,CAAC,IAAI,CAAC,GAAG,CAAC;gCACjB,CAAC,CAAC,GAAG,CAAC;oBACR,OAAO,CAAC,GAAG,CAAC,GAAG,eAAK,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC;gBACtD,CAAC;gBACD,YAAY,EAAE,4BAAc;aAC7B,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,CAAC,GAAG,CAAC,IAAA,iBAAQ,EAAE,GAAa,CAAC,OAAO,CAAC,CAAC,CAAC;YAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/package.json
CHANGED
|
@@ -3,13 +3,14 @@ name: sdd-remote
|
|
|
3
3
|
description: >
|
|
4
4
|
Remote sync workflow for Story Driven Development. Use when the user asks
|
|
5
5
|
to update local state from remote changes, process remote drafts, and push
|
|
6
|
-
enriched items back.
|
|
6
|
+
enriched items back. Also applies when running a remote worker job (enrich
|
|
7
|
+
or sync).
|
|
7
8
|
license: MIT
|
|
8
9
|
compatibility: Requires sdd CLI (npm i -g @applica-software-guru/sdd)
|
|
9
10
|
allowed-tools: Bash(sdd:*) Read Glob Grep
|
|
10
11
|
metadata:
|
|
11
12
|
author: applica-software-guru
|
|
12
|
-
version: "1.
|
|
13
|
+
version: "1.1"
|
|
13
14
|
---
|
|
14
15
|
|
|
15
16
|
# SDD Remote - Pull, Enrich, Push
|
|
@@ -19,6 +20,9 @@ metadata:
|
|
|
19
20
|
Use this skill to synchronize local SDD docs with remote updates, enrich draft content,
|
|
20
21
|
and publish the enriched result to remote in active states.
|
|
21
22
|
|
|
23
|
+
This skill also applies when a **remote worker job** is dispatched from SDD Flow, as the
|
|
24
|
+
worker runs these same workflows on behalf of the user.
|
|
25
|
+
|
|
22
26
|
## Detection
|
|
23
27
|
|
|
24
28
|
This workflow applies when:
|
|
@@ -26,79 +30,91 @@ This workflow applies when:
|
|
|
26
30
|
- `.sdd/config.yaml` exists in the project root
|
|
27
31
|
- The user asks to update local state from remote, pull pending CRs/bugs/docs,
|
|
28
32
|
enrich drafts, or push pending remote updates
|
|
33
|
+
- A remote worker job prompt instructs you to follow this workflow
|
|
34
|
+
|
|
35
|
+
## Workflows
|
|
29
36
|
|
|
30
|
-
|
|
37
|
+
### Enrich Workflow (CR)
|
|
31
38
|
|
|
32
|
-
Follow this sequence
|
|
39
|
+
Follow this sequence to enrich a draft Change Request:
|
|
33
40
|
|
|
34
|
-
1.
|
|
41
|
+
1. Pull remote updates:
|
|
35
42
|
|
|
36
43
|
```bash
|
|
37
|
-
|
|
44
|
+
sdd pull --crs-only
|
|
38
45
|
```
|
|
39
46
|
|
|
40
|
-
|
|
47
|
+
3. Generate draft TODO list:
|
|
41
48
|
|
|
42
49
|
```bash
|
|
43
|
-
sdd
|
|
50
|
+
sdd drafts
|
|
44
51
|
```
|
|
45
52
|
|
|
46
|
-
|
|
53
|
+
4. Enrich the draft with technical details, acceptance criteria, edge cases, and
|
|
54
|
+
any relevant information from the project documentation and comments.
|
|
47
55
|
|
|
48
|
-
|
|
56
|
+
5. Transition the enriched CR to pending:
|
|
49
57
|
|
|
50
58
|
```bash
|
|
51
|
-
sdd
|
|
59
|
+
sdd mark-drafts-enriched
|
|
52
60
|
```
|
|
53
61
|
|
|
54
|
-
|
|
62
|
+
This performs: `draft → pending`
|
|
63
|
+
|
|
64
|
+
6. Push the enriched content:
|
|
55
65
|
|
|
56
66
|
```bash
|
|
57
|
-
sdd
|
|
58
|
-
sdd pull --crs-only
|
|
59
|
-
sdd pull --bugs-only
|
|
67
|
+
sdd push
|
|
60
68
|
```
|
|
61
69
|
|
|
62
|
-
|
|
70
|
+
### Enrich Workflow (Document)
|
|
71
|
+
|
|
72
|
+
Follow this sequence to enrich a document:
|
|
73
|
+
|
|
74
|
+
1. Pull remote updates:
|
|
63
75
|
|
|
64
76
|
```bash
|
|
65
|
-
sdd
|
|
77
|
+
sdd pull --docs-only
|
|
66
78
|
```
|
|
67
79
|
|
|
68
|
-
|
|
69
|
-
|
|
80
|
+
3. Locate the document file in `product/` or `system/` and update its content
|
|
81
|
+
with the enriched version.
|
|
70
82
|
|
|
71
|
-
4.
|
|
83
|
+
4. Push the enriched content:
|
|
72
84
|
|
|
73
85
|
```bash
|
|
74
|
-
sdd
|
|
86
|
+
sdd push
|
|
75
87
|
```
|
|
76
88
|
|
|
77
|
-
|
|
89
|
+
If the document was in `draft` status, it will transition to `new` on the server.
|
|
78
90
|
|
|
79
|
-
|
|
80
|
-
- Change Request: `draft -> pending`
|
|
81
|
-
- Bug: `draft -> open`
|
|
91
|
+
### Sync Workflow (Project-level)
|
|
82
92
|
|
|
83
|
-
|
|
93
|
+
Follow this sequence for a full project sync (all pending items):
|
|
94
|
+
|
|
95
|
+
1. Pull the latest specs:
|
|
84
96
|
|
|
85
97
|
```bash
|
|
86
|
-
sdd
|
|
98
|
+
sdd pull
|
|
87
99
|
```
|
|
88
100
|
|
|
89
|
-
|
|
101
|
+
3. Run the `sdd` skill — it handles the full loop: open bugs, pending CRs,
|
|
102
|
+
documentation sync, code implementation, mark-synced, and commit.
|
|
103
|
+
|
|
104
|
+
4. Push:
|
|
90
105
|
|
|
91
106
|
```bash
|
|
92
|
-
sdd
|
|
107
|
+
sdd push
|
|
93
108
|
```
|
|
94
109
|
|
|
95
110
|
## Rules
|
|
96
111
|
|
|
97
112
|
1. Always check remote configuration before pull/push (`sdd remote status`)
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
113
|
+
3. Do not use `sdd push --all` unless the user explicitly asks for a full reseed
|
|
114
|
+
4. If pull reports conflicts, do not overwrite local files blindly; report conflicts and ask how to proceed
|
|
115
|
+
5. Do not edit files inside `.sdd/` manually
|
|
116
|
+
6. Keep status transitions explicit: enrich first, then `sdd mark-drafts-enriched`, then push
|
|
117
|
+
7. **Always commit before pushing** when the sync workflow makes code changes
|
|
102
118
|
|
|
103
119
|
## Related commands
|
|
104
120
|
|
|
@@ -107,4 +123,6 @@ sdd remote status
|
|
|
107
123
|
- `sdd pull`
|
|
108
124
|
- `sdd drafts`
|
|
109
125
|
- `sdd mark-drafts-enriched`
|
|
126
|
+
- `sdd sync`
|
|
127
|
+
- `sdd mark-synced`
|
|
110
128
|
- `sdd push`
|
package/src/commands/init.ts
CHANGED
|
@@ -10,11 +10,11 @@ import { printBanner } from "../ui/banner.js";
|
|
|
10
10
|
import { success, info, heading } from "../ui/format.js";
|
|
11
11
|
import { renderMarkdown } from "../ui/markdown.js";
|
|
12
12
|
|
|
13
|
-
const START_PROMPT = `
|
|
13
|
+
const START_PROMPT = `Use the \`sdd\` skill and the documentation in product/ and system/, then run \`sdd sync\` to start working.`;
|
|
14
14
|
|
|
15
15
|
function buildBootstrapPrompt(description: string, auto: boolean): string {
|
|
16
16
|
if (auto) {
|
|
17
|
-
return `
|
|
17
|
+
return `Use the \`sdd\` skill. This is a new SDD project.
|
|
18
18
|
|
|
19
19
|
Project goal: "${description}"
|
|
20
20
|
|
|
@@ -28,10 +28,13 @@ Your task: generate the initial documentation for this project based on the desc
|
|
|
28
28
|
- system/tech-stack.md — Technologies and frameworks
|
|
29
29
|
- system/interfaces.md — API contracts
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
Set status: new on every file. Do NOT write any code, only documentation.
|
|
32
|
+
|
|
33
|
+
When done, commit with: git add -A && git commit -m "bootstrap: initial documentation"
|
|
34
|
+
Do NOT run \`sdd mark-synced\` — files must stay status: new so they can be implemented later.`;
|
|
32
35
|
}
|
|
33
36
|
|
|
34
|
-
return `
|
|
37
|
+
return `Use the \`sdd\` skill. This is a new SDD project.
|
|
35
38
|
|
|
36
39
|
Project goal: "${description}"
|
|
37
40
|
|
|
@@ -45,7 +48,7 @@ Your task: generate the initial documentation for this project. Ask me a few que
|
|
|
45
48
|
- system/tech-stack.md — Technologies and frameworks
|
|
46
49
|
- system/interfaces.md — API contracts
|
|
47
50
|
|
|
48
|
-
|
|
51
|
+
Set status: new on every file. Do NOT write any code, only documentation. Do NOT run \`sdd mark-synced\` — files must stay status: new so they can be implemented later.`;
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
export function registerInit(program: Command): void {
|
|
@@ -174,7 +177,7 @@ export function registerInit(program: Command): void {
|
|
|
174
177
|
console.log(
|
|
175
178
|
` ${chalk.white("2.")} Start writing your documentation in ${chalk.cyan("product/")} and ${chalk.cyan("system/")}.`,
|
|
176
179
|
);
|
|
177
|
-
console.log(`
|
|
180
|
+
console.log(` Your agent will use the ${chalk.cyan("sdd")} skill automatically.\n`);
|
|
178
181
|
console.log(` ${chalk.white("3.")} When ready, let your AI agent run:\n`);
|
|
179
182
|
console.log(` ${chalk.green("sdd sync")}\n`);
|
|
180
183
|
|
package/src/commands/remote.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { hostname } from 'node:os';
|
|
1
2
|
import { Command } from 'commander';
|
|
2
3
|
import chalk from 'chalk';
|
|
3
4
|
import { input, password } from '@inquirer/prompts';
|
|
4
|
-
import { SDD, readConfig, writeConfig } from '@applica-software-guru/sdd-core';
|
|
5
|
+
import { SDD, readConfig, writeConfig, buildApiConfig, startWorkerDaemon } from '@applica-software-guru/sdd-core';
|
|
5
6
|
import { heading, success, info, warning, error as errorFmt } from '../ui/format.js';
|
|
7
|
+
import { renderMarkdown } from '../ui/markdown.js';
|
|
6
8
|
|
|
7
9
|
export function registerRemote(program: Command): void {
|
|
8
10
|
const remote = program
|
|
@@ -122,4 +124,52 @@ export function registerRemote(program: Command): void {
|
|
|
122
124
|
}
|
|
123
125
|
console.log('');
|
|
124
126
|
});
|
|
127
|
+
|
|
128
|
+
remote
|
|
129
|
+
.command('worker')
|
|
130
|
+
.description('Start a persistent worker that receives and executes jobs from SDD Flow')
|
|
131
|
+
.option('--name <name>', 'Worker name (default: hostname)')
|
|
132
|
+
.option('--agent <agent>', 'Agent to use for executing jobs (default: from config or "claude")')
|
|
133
|
+
.option('--timeout <seconds>', 'Remote request timeout in seconds (default: 300)', parseInt)
|
|
134
|
+
.action(async (options: { name?: string; agent?: string; timeout?: number }) => {
|
|
135
|
+
const root = process.cwd();
|
|
136
|
+
const config = await readConfig(root);
|
|
137
|
+
|
|
138
|
+
console.log(heading('SDD Remote Worker'));
|
|
139
|
+
|
|
140
|
+
try {
|
|
141
|
+
const apiConfig = buildApiConfig(config, options.timeout);
|
|
142
|
+
const agentName = options.agent ?? config.agent ?? 'claude';
|
|
143
|
+
|
|
144
|
+
console.log(info(`Starting worker "${options.name ?? hostname()}" with agent "${agentName}"...`));
|
|
145
|
+
console.log(info(`Connected to ${apiConfig.baseUrl}`));
|
|
146
|
+
console.log('');
|
|
147
|
+
|
|
148
|
+
await startWorkerDaemon({
|
|
149
|
+
root,
|
|
150
|
+
name: options.name,
|
|
151
|
+
agent: agentName,
|
|
152
|
+
agents: config.agents,
|
|
153
|
+
apiConfig,
|
|
154
|
+
onLog: (msg: string) => {
|
|
155
|
+
const timestamp = new Date().toISOString().slice(11, 19);
|
|
156
|
+
const isError = /error|warning/i.test(msg);
|
|
157
|
+
const isJob = msg.startsWith('┌') || msg.startsWith('│') || msg.startsWith('└');
|
|
158
|
+
const isJobDone = msg.includes('done —');
|
|
159
|
+
const formatted = isError
|
|
160
|
+
? chalk.yellow(msg)
|
|
161
|
+
: isJobDone
|
|
162
|
+
? chalk.green(msg)
|
|
163
|
+
: isJob
|
|
164
|
+
? chalk.cyan(msg)
|
|
165
|
+
: msg;
|
|
166
|
+
console.log(`${chalk.dim(timestamp)} ${formatted}`);
|
|
167
|
+
},
|
|
168
|
+
renderPrompt: renderMarkdown,
|
|
169
|
+
});
|
|
170
|
+
} catch (err) {
|
|
171
|
+
console.log(errorFmt((err as Error).message));
|
|
172
|
+
process.exit(1);
|
|
173
|
+
}
|
|
174
|
+
});
|
|
125
175
|
}
|