wordspace 0.0.13 → 0.0.14
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/run.d.ts +1 -0
- package/dist/commands/run.js +17 -9
- package/dist/index.js +7 -2
- package/dist/lib/harness.d.ts +3 -3
- package/dist/lib/harness.js +8 -4
- package/package.json +1 -1
package/dist/commands/run.d.ts
CHANGED
package/dist/commands/run.js
CHANGED
|
@@ -13,20 +13,28 @@ import * as log from "../lib/log.js";
|
|
|
13
13
|
* Skill-native harnesses (Claude Code) get the short `/open-prose run <path>` command.
|
|
14
14
|
* All others receive the .prose file content inline with execution instructions.
|
|
15
15
|
*/
|
|
16
|
-
function buildPrompt(harness, prosePath, cwd) {
|
|
16
|
+
function buildPrompt(harness, prosePath, cwd, params) {
|
|
17
17
|
if (harness.skillNative) {
|
|
18
|
+
if (params && Object.keys(params).length > 0) {
|
|
19
|
+
return `/open-prose run ${prosePath} --params '${JSON.stringify(params)}'`;
|
|
20
|
+
}
|
|
18
21
|
return `/open-prose run ${prosePath}`;
|
|
19
22
|
}
|
|
20
23
|
const fullPath = join(cwd, prosePath);
|
|
21
24
|
const content = readFileSync(fullPath, "utf-8");
|
|
22
|
-
|
|
25
|
+
const lines = [
|
|
23
26
|
`You are executing a wordspace workflow defined in the file "${prosePath}".`,
|
|
24
27
|
`Follow the steps below exactly. Write all output files to the "output/" directory.`,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
];
|
|
29
|
+
if (params && Object.keys(params).length > 0) {
|
|
30
|
+
lines.push("", "The following input parameters have been provided:");
|
|
31
|
+
for (const [key, value] of Object.entries(params)) {
|
|
32
|
+
lines.push(` ${key} = "${value}"`);
|
|
33
|
+
}
|
|
34
|
+
lines.push("Use these values for the corresponding `input` declarations in the workflow.");
|
|
35
|
+
}
|
|
36
|
+
lines.push("", "--- BEGIN WORKFLOW ---", content, "--- END WORKFLOW ---");
|
|
37
|
+
return lines.join("\n");
|
|
30
38
|
}
|
|
31
39
|
/**
|
|
32
40
|
* Build a rich passthrough prompt that tells the calling agent where skills
|
|
@@ -150,7 +158,7 @@ export async function run(target, force, harnessArg, options) {
|
|
|
150
158
|
console.log(passthroughPrompt);
|
|
151
159
|
process.exit(0);
|
|
152
160
|
}
|
|
153
|
-
const prompt = buildPrompt(harness, prosePath, cwd);
|
|
161
|
+
const prompt = buildPrompt(harness, prosePath, cwd, options?.params);
|
|
154
162
|
console.log();
|
|
155
163
|
if (harness.skillNative) {
|
|
156
164
|
log.info(prompt);
|
|
@@ -159,6 +167,6 @@ export async function run(target, force, harnessArg, options) {
|
|
|
159
167
|
log.info(`Running ${prosePath} via ${harness.name}...`);
|
|
160
168
|
}
|
|
161
169
|
console.log();
|
|
162
|
-
const exitCode = spawnHarness(harness, prompt, cwd);
|
|
170
|
+
const exitCode = spawnHarness(harness, prompt, cwd, options?.model);
|
|
163
171
|
process.exit(exitCode);
|
|
164
172
|
}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { search } from "./commands/search.js";
|
|
|
4
4
|
import { add } from "./commands/add.js";
|
|
5
5
|
import { run } from "./commands/run.js";
|
|
6
6
|
import * as log from "./lib/log.js";
|
|
7
|
-
const VERSION = "0.0.
|
|
7
|
+
const VERSION = "0.0.14";
|
|
8
8
|
const HELP = `
|
|
9
9
|
Usage: wordspace <command> [options]
|
|
10
10
|
|
|
@@ -17,6 +17,7 @@ Commands:
|
|
|
17
17
|
Options:
|
|
18
18
|
--force Re-run all steps / overwrite existing files
|
|
19
19
|
--harness <name> Use a specific coding agent (e.g. claude, aider, goose)
|
|
20
|
+
--model <model> Model to pass to the harness (e.g. openrouter/minimax/minimax-m2.5)
|
|
20
21
|
--params <json> Workflow input parameters as JSON (e.g. '{"topic":"x402"}')
|
|
21
22
|
--skills-dir <dir> Custom skills directory (default: auto-discover)
|
|
22
23
|
--help Show this help message
|
|
@@ -33,6 +34,7 @@ async function main() {
|
|
|
33
34
|
process.exit(0);
|
|
34
35
|
}
|
|
35
36
|
let harnessArg;
|
|
37
|
+
let modelArg;
|
|
36
38
|
let params;
|
|
37
39
|
let skillsDir;
|
|
38
40
|
// Filter out flags and their values from positional args
|
|
@@ -41,6 +43,9 @@ async function main() {
|
|
|
41
43
|
if (args[i] === "--harness") {
|
|
42
44
|
harnessArg = args[++i];
|
|
43
45
|
}
|
|
46
|
+
else if (args[i] === "--model") {
|
|
47
|
+
modelArg = args[++i];
|
|
48
|
+
}
|
|
44
49
|
else if (args[i] === "--params") {
|
|
45
50
|
const raw = args[++i];
|
|
46
51
|
try {
|
|
@@ -70,7 +75,7 @@ async function main() {
|
|
|
70
75
|
await add(positional.slice(1), force);
|
|
71
76
|
}
|
|
72
77
|
else if (command === "run") {
|
|
73
|
-
await run(positional[1], force, harnessArg, { params, skillsDir });
|
|
78
|
+
await run(positional[1], force, harnessArg, { params, skillsDir, model: modelArg });
|
|
74
79
|
}
|
|
75
80
|
else if (!command) {
|
|
76
81
|
console.log(HELP);
|
package/dist/lib/harness.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ export interface Harness {
|
|
|
3
3
|
name: string;
|
|
4
4
|
/** Binary name on PATH. */
|
|
5
5
|
bin: string;
|
|
6
|
-
/** Build the CLI args from the prompt string. */
|
|
7
|
-
args: (prompt: string) => string[];
|
|
6
|
+
/** Build the CLI args from the prompt string and optional model. */
|
|
7
|
+
args: (prompt: string, model?: string) => string[];
|
|
8
8
|
/** URL or install command the user can use to install this harness. */
|
|
9
9
|
installUrl: string;
|
|
10
10
|
/** Whether the harness runs interactively, headless, or passthrough (already running). */
|
|
@@ -17,4 +17,4 @@ export declare const HARNESSES: Harness[];
|
|
|
17
17
|
/** Return only the harnesses whose binary is found on PATH. */
|
|
18
18
|
export declare function detectInstalled(): Harness[];
|
|
19
19
|
/** Spawn a harness interactively, handing over the terminal. */
|
|
20
|
-
export declare function spawnHarness(harness: Harness, prompt: string, cwd: string): number;
|
|
20
|
+
export declare function spawnHarness(harness: Harness, prompt: string, cwd: string, model?: string): number;
|
package/dist/lib/harness.js
CHANGED
|
@@ -44,9 +44,13 @@ export const HARNESSES = [
|
|
|
44
44
|
{
|
|
45
45
|
name: "OpenCode",
|
|
46
46
|
bin: "opencode",
|
|
47
|
-
args: (prompt) => [
|
|
47
|
+
args: (prompt, model) => [
|
|
48
|
+
"run",
|
|
49
|
+
"--prompt", prompt,
|
|
50
|
+
...(model ? ["--model", model] : []),
|
|
51
|
+
],
|
|
48
52
|
installUrl: "https://opencode.ai",
|
|
49
|
-
mode: "
|
|
53
|
+
mode: "headless",
|
|
50
54
|
skillNative: false,
|
|
51
55
|
},
|
|
52
56
|
{
|
|
@@ -103,8 +107,8 @@ export function detectInstalled() {
|
|
|
103
107
|
});
|
|
104
108
|
}
|
|
105
109
|
/** Spawn a harness interactively, handing over the terminal. */
|
|
106
|
-
export function spawnHarness(harness, prompt, cwd) {
|
|
107
|
-
const result = spawnSync(harness.bin, harness.args(prompt), {
|
|
110
|
+
export function spawnHarness(harness, prompt, cwd, model) {
|
|
111
|
+
const result = spawnSync(harness.bin, harness.args(prompt, model), {
|
|
108
112
|
cwd,
|
|
109
113
|
stdio: "inherit",
|
|
110
114
|
});
|