@klaudworks/rmr 1.2.0 → 1.2.1
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/index.js
CHANGED
|
@@ -12028,8 +12028,18 @@ class ContinueCommand extends BaseCommand {
|
|
|
12028
12028
|
// src/commands/install.ts
|
|
12029
12029
|
import { cp, readdir as readdir2 } from "node:fs/promises";
|
|
12030
12030
|
import { existsSync } from "node:fs";
|
|
12031
|
-
import { dirname as dirname3, resolve as resolve7 } from "node:path";
|
|
12031
|
+
import { basename as basename2, dirname as dirname3, resolve as resolve7 } from "node:path";
|
|
12032
12032
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
12033
|
+
|
|
12034
|
+
// src/lib/workflow-utils.ts
|
|
12035
|
+
function workflowRequiresTask(workflow) {
|
|
12036
|
+
return workflow.steps.some((step) => step.requires.inputs.includes("task"));
|
|
12037
|
+
}
|
|
12038
|
+
function getWorkflowDefaultHarness(workflow) {
|
|
12039
|
+
return workflow.harness ?? "(none - step-level harnesses only)";
|
|
12040
|
+
}
|
|
12041
|
+
|
|
12042
|
+
// src/commands/install.ts
|
|
12033
12043
|
function getExamplesWorkflowsDir() {
|
|
12034
12044
|
const thisDir = dirname3(fileURLToPath2(import.meta.url));
|
|
12035
12045
|
const fromDist = resolve7(thisDir, "..", "examples", "workflows");
|
|
@@ -12040,6 +12050,17 @@ function getExamplesWorkflowsDir() {
|
|
|
12040
12050
|
return fromSrc;
|
|
12041
12051
|
return fromSrc;
|
|
12042
12052
|
}
|
|
12053
|
+
function resolveWorkflowFilePath(workflowDir) {
|
|
12054
|
+
const yamlPath = resolve7(workflowDir, "workflow.yaml");
|
|
12055
|
+
if (existsSync(yamlPath)) {
|
|
12056
|
+
return yamlPath;
|
|
12057
|
+
}
|
|
12058
|
+
const ymlPath = resolve7(workflowDir, "workflow.yml");
|
|
12059
|
+
if (existsSync(ymlPath)) {
|
|
12060
|
+
return ymlPath;
|
|
12061
|
+
}
|
|
12062
|
+
throw new UserInputError(`Workflow directory does not contain workflow.yaml or workflow.yml: ${workflowDir}`);
|
|
12063
|
+
}
|
|
12043
12064
|
|
|
12044
12065
|
class InstallCommand extends BaseCommand {
|
|
12045
12066
|
static paths = [["install"]];
|
|
@@ -12065,14 +12086,28 @@ class InstallCommand extends BaseCommand {
|
|
|
12065
12086
|
const hint = available.length > 0 ? ` Available: ${available.join(", ")}.` : " No bundled workflows found.";
|
|
12066
12087
|
throw new UserInputError(`Unknown workflow "${this.workflowName}".${hint}`);
|
|
12067
12088
|
}
|
|
12089
|
+
const sourceWorkflowPath = resolveWorkflowFilePath(sourceDir);
|
|
12090
|
+
const sourceWorkflow = await loadWorkflowDefinition(sourceWorkflowPath).catch((error) => {
|
|
12091
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
12092
|
+
throw new UserInputError(`Bundled workflow "${this.workflowName}" is invalid: ${message}`);
|
|
12093
|
+
});
|
|
12094
|
+
const workflowFileName = basename2(sourceWorkflowPath);
|
|
12095
|
+
const installedWorkflowPath = `.rmr/workflows/${this.workflowName}/${workflowFileName}`;
|
|
12096
|
+
const runHint = workflowRequiresTask(sourceWorkflow) ? `${binaryName} run ${installedWorkflowPath} --task "Describe your task"` : `${binaryName} run ${installedWorkflowPath}`;
|
|
12097
|
+
const defaultHarness = getWorkflowDefaultHarness(sourceWorkflow);
|
|
12098
|
+
const harnessHint = `To use codex or opencode, edit ${installedWorkflowPath} and change "harness:"` + ` (optionally "model:").`;
|
|
12068
12099
|
if (existsSync(destinationDir)) {
|
|
12069
12100
|
ui.info(`Workflow already installed at .rmr/workflows/${this.workflowName}/`);
|
|
12070
|
-
ui.info(`Run it with: ${
|
|
12101
|
+
ui.info(`Run it with: ${runHint}`);
|
|
12102
|
+
ui.info(`Default harness: ${defaultHarness}`);
|
|
12103
|
+
ui.info(harnessHint);
|
|
12071
12104
|
return 0;
|
|
12072
12105
|
}
|
|
12073
12106
|
await cp(sourceDir, destinationDir, { recursive: true, force: false, errorOnExist: true });
|
|
12074
12107
|
ui.success(`installed .rmr/workflows/${this.workflowName}/`);
|
|
12075
|
-
ui.info(`Run it with: ${
|
|
12108
|
+
ui.info(`Run it with: ${runHint}`);
|
|
12109
|
+
ui.info(`Default harness: ${defaultHarness}`);
|
|
12110
|
+
ui.info(harnessHint);
|
|
12076
12111
|
return 0;
|
|
12077
12112
|
}
|
|
12078
12113
|
}
|
|
@@ -12193,13 +12228,13 @@ class ListCommand extends BaseCommand {
|
|
|
12193
12228
|
}
|
|
12194
12229
|
|
|
12195
12230
|
// src/commands/root.ts
|
|
12196
|
-
import { basename as
|
|
12231
|
+
import { basename as basename3 } from "node:path";
|
|
12197
12232
|
function detectShell() {
|
|
12198
12233
|
const raw = process.env.SHELL;
|
|
12199
12234
|
if (!raw) {
|
|
12200
12235
|
return null;
|
|
12201
12236
|
}
|
|
12202
|
-
const shell =
|
|
12237
|
+
const shell = basename3(raw);
|
|
12203
12238
|
if (shell === "bash" || shell === "zsh" || shell === "fish") {
|
|
12204
12239
|
return shell;
|
|
12205
12240
|
}
|
|
@@ -12319,9 +12354,6 @@ async function resolveWorkflowPath(inputPath) {
|
|
|
12319
12354
|
throw new UserInputError(`Failed to access workflow path "${absolutePath}": ${getErrorMessage(error)}`);
|
|
12320
12355
|
}
|
|
12321
12356
|
}
|
|
12322
|
-
function workflowRequiresTask(workflow) {
|
|
12323
|
-
return workflow.steps.some((step) => step.requires.inputs.includes("task"));
|
|
12324
|
-
}
|
|
12325
12357
|
|
|
12326
12358
|
class RunCommand extends BaseCommand {
|
|
12327
12359
|
static paths = [["run"]];
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@klaudworks/rex",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@klaudworks/rex",
|
|
9
|
-
"version": "1.2.
|
|
9
|
+
"version": "1.2.1",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"clipanion": "^4.0.0-rc.4",
|
|
12
12
|
"yaml": "^2.8.2"
|