@klaudworks/rmr 1.0.1 → 1.1.2
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 +8 -0
- package/dist/index.js +116 -109
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,14 @@
|
|
|
8
8
|
|
|
9
9
|
Inspired by [snarktank/antfarm](https://github.com/snarktank/antfarm).
|
|
10
10
|
|
|
11
|
+
## Why rmr?
|
|
12
|
+
|
|
13
|
+
Coding agents produce slop. Not because they're bad, but because "go make it work" is a bad prompt, the same way it's a bad brief for a human developer. You wouldn't hand someone a one-liner and expect clean, well-structured code back. Yet that's how most people use coding agents today.
|
|
14
|
+
|
|
15
|
+
The fix is simple: break the work into steps. Plan first, then implement, then review. Loop back if the review finds problems. This is how good teams already work. rmr just lets you encode that process in a YAML file and run it automatically.
|
|
16
|
+
|
|
17
|
+
It doesn't care how you plan (markdown files, Beads, Linear, whatever) or which agent you use (Claude Code, Codex, OpenCode). You can mix and match harnesses within a single workflow too, like using Claude for planning and Codex for implementation. It just makes sure each step gets the right context, the output flows to the next step, and you can pause and pick up where you left off.
|
|
18
|
+
|
|
11
19
|
## Quick Start
|
|
12
20
|
|
|
13
21
|
**Instructions for humans**
|
package/dist/index.js
CHANGED
|
@@ -1114,17 +1114,17 @@ var require_visit = __commonJS((exports) => {
|
|
|
1114
1114
|
visit.BREAK = BREAK;
|
|
1115
1115
|
visit.SKIP = SKIP;
|
|
1116
1116
|
visit.REMOVE = REMOVE;
|
|
1117
|
-
function visit_(key, node, visitor,
|
|
1118
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
1117
|
+
function visit_(key, node, visitor, path2) {
|
|
1118
|
+
const ctrl = callVisitor(key, node, visitor, path2);
|
|
1119
1119
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
1120
|
-
replaceNode(key,
|
|
1121
|
-
return visit_(key, ctrl, visitor,
|
|
1120
|
+
replaceNode(key, path2, ctrl);
|
|
1121
|
+
return visit_(key, ctrl, visitor, path2);
|
|
1122
1122
|
}
|
|
1123
1123
|
if (typeof ctrl !== "symbol") {
|
|
1124
1124
|
if (identity.isCollection(node)) {
|
|
1125
|
-
|
|
1125
|
+
path2 = Object.freeze(path2.concat(node));
|
|
1126
1126
|
for (let i = 0;i < node.items.length; ++i) {
|
|
1127
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
1127
|
+
const ci = visit_(i, node.items[i], visitor, path2);
|
|
1128
1128
|
if (typeof ci === "number")
|
|
1129
1129
|
i = ci - 1;
|
|
1130
1130
|
else if (ci === BREAK)
|
|
@@ -1135,13 +1135,13 @@ var require_visit = __commonJS((exports) => {
|
|
|
1135
1135
|
}
|
|
1136
1136
|
}
|
|
1137
1137
|
} else if (identity.isPair(node)) {
|
|
1138
|
-
|
|
1139
|
-
const ck = visit_("key", node.key, visitor,
|
|
1138
|
+
path2 = Object.freeze(path2.concat(node));
|
|
1139
|
+
const ck = visit_("key", node.key, visitor, path2);
|
|
1140
1140
|
if (ck === BREAK)
|
|
1141
1141
|
return BREAK;
|
|
1142
1142
|
else if (ck === REMOVE)
|
|
1143
1143
|
node.key = null;
|
|
1144
|
-
const cv = visit_("value", node.value, visitor,
|
|
1144
|
+
const cv = visit_("value", node.value, visitor, path2);
|
|
1145
1145
|
if (cv === BREAK)
|
|
1146
1146
|
return BREAK;
|
|
1147
1147
|
else if (cv === REMOVE)
|
|
@@ -1162,17 +1162,17 @@ var require_visit = __commonJS((exports) => {
|
|
|
1162
1162
|
visitAsync.BREAK = BREAK;
|
|
1163
1163
|
visitAsync.SKIP = SKIP;
|
|
1164
1164
|
visitAsync.REMOVE = REMOVE;
|
|
1165
|
-
async function visitAsync_(key, node, visitor,
|
|
1166
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
1165
|
+
async function visitAsync_(key, node, visitor, path2) {
|
|
1166
|
+
const ctrl = await callVisitor(key, node, visitor, path2);
|
|
1167
1167
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
1168
|
-
replaceNode(key,
|
|
1169
|
-
return visitAsync_(key, ctrl, visitor,
|
|
1168
|
+
replaceNode(key, path2, ctrl);
|
|
1169
|
+
return visitAsync_(key, ctrl, visitor, path2);
|
|
1170
1170
|
}
|
|
1171
1171
|
if (typeof ctrl !== "symbol") {
|
|
1172
1172
|
if (identity.isCollection(node)) {
|
|
1173
|
-
|
|
1173
|
+
path2 = Object.freeze(path2.concat(node));
|
|
1174
1174
|
for (let i = 0;i < node.items.length; ++i) {
|
|
1175
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
1175
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path2);
|
|
1176
1176
|
if (typeof ci === "number")
|
|
1177
1177
|
i = ci - 1;
|
|
1178
1178
|
else if (ci === BREAK)
|
|
@@ -1183,13 +1183,13 @@ var require_visit = __commonJS((exports) => {
|
|
|
1183
1183
|
}
|
|
1184
1184
|
}
|
|
1185
1185
|
} else if (identity.isPair(node)) {
|
|
1186
|
-
|
|
1187
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
1186
|
+
path2 = Object.freeze(path2.concat(node));
|
|
1187
|
+
const ck = await visitAsync_("key", node.key, visitor, path2);
|
|
1188
1188
|
if (ck === BREAK)
|
|
1189
1189
|
return BREAK;
|
|
1190
1190
|
else if (ck === REMOVE)
|
|
1191
1191
|
node.key = null;
|
|
1192
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
1192
|
+
const cv = await visitAsync_("value", node.value, visitor, path2);
|
|
1193
1193
|
if (cv === BREAK)
|
|
1194
1194
|
return BREAK;
|
|
1195
1195
|
else if (cv === REMOVE)
|
|
@@ -1216,23 +1216,23 @@ var require_visit = __commonJS((exports) => {
|
|
|
1216
1216
|
}
|
|
1217
1217
|
return visitor;
|
|
1218
1218
|
}
|
|
1219
|
-
function callVisitor(key, node, visitor,
|
|
1219
|
+
function callVisitor(key, node, visitor, path2) {
|
|
1220
1220
|
if (typeof visitor === "function")
|
|
1221
|
-
return visitor(key, node,
|
|
1221
|
+
return visitor(key, node, path2);
|
|
1222
1222
|
if (identity.isMap(node))
|
|
1223
|
-
return visitor.Map?.(key, node,
|
|
1223
|
+
return visitor.Map?.(key, node, path2);
|
|
1224
1224
|
if (identity.isSeq(node))
|
|
1225
|
-
return visitor.Seq?.(key, node,
|
|
1225
|
+
return visitor.Seq?.(key, node, path2);
|
|
1226
1226
|
if (identity.isPair(node))
|
|
1227
|
-
return visitor.Pair?.(key, node,
|
|
1227
|
+
return visitor.Pair?.(key, node, path2);
|
|
1228
1228
|
if (identity.isScalar(node))
|
|
1229
|
-
return visitor.Scalar?.(key, node,
|
|
1229
|
+
return visitor.Scalar?.(key, node, path2);
|
|
1230
1230
|
if (identity.isAlias(node))
|
|
1231
|
-
return visitor.Alias?.(key, node,
|
|
1231
|
+
return visitor.Alias?.(key, node, path2);
|
|
1232
1232
|
return;
|
|
1233
1233
|
}
|
|
1234
|
-
function replaceNode(key,
|
|
1235
|
-
const parent =
|
|
1234
|
+
function replaceNode(key, path2, node) {
|
|
1235
|
+
const parent = path2[path2.length - 1];
|
|
1236
1236
|
if (identity.isCollection(parent)) {
|
|
1237
1237
|
parent.items[key] = node;
|
|
1238
1238
|
} else if (identity.isPair(parent)) {
|
|
@@ -1789,10 +1789,10 @@ var require_Collection = __commonJS((exports) => {
|
|
|
1789
1789
|
var createNode = require_createNode();
|
|
1790
1790
|
var identity = require_identity();
|
|
1791
1791
|
var Node = require_Node();
|
|
1792
|
-
function collectionFromPath(schema,
|
|
1792
|
+
function collectionFromPath(schema, path2, value) {
|
|
1793
1793
|
let v = value;
|
|
1794
|
-
for (let i =
|
|
1795
|
-
const k =
|
|
1794
|
+
for (let i = path2.length - 1;i >= 0; --i) {
|
|
1795
|
+
const k = path2[i];
|
|
1796
1796
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
1797
1797
|
const a = [];
|
|
1798
1798
|
a[k] = v;
|
|
@@ -1811,7 +1811,7 @@ var require_Collection = __commonJS((exports) => {
|
|
|
1811
1811
|
sourceObjects: new Map
|
|
1812
1812
|
});
|
|
1813
1813
|
}
|
|
1814
|
-
var isEmptyPath = (
|
|
1814
|
+
var isEmptyPath = (path2) => path2 == null || typeof path2 === "object" && !!path2[Symbol.iterator]().next().done;
|
|
1815
1815
|
|
|
1816
1816
|
class Collection extends Node.NodeBase {
|
|
1817
1817
|
constructor(type, schema) {
|
|
@@ -1832,11 +1832,11 @@ var require_Collection = __commonJS((exports) => {
|
|
|
1832
1832
|
copy.range = this.range.slice();
|
|
1833
1833
|
return copy;
|
|
1834
1834
|
}
|
|
1835
|
-
addIn(
|
|
1836
|
-
if (isEmptyPath(
|
|
1835
|
+
addIn(path2, value) {
|
|
1836
|
+
if (isEmptyPath(path2))
|
|
1837
1837
|
this.add(value);
|
|
1838
1838
|
else {
|
|
1839
|
-
const [key, ...rest] =
|
|
1839
|
+
const [key, ...rest] = path2;
|
|
1840
1840
|
const node = this.get(key, true);
|
|
1841
1841
|
if (identity.isCollection(node))
|
|
1842
1842
|
node.addIn(rest, value);
|
|
@@ -1846,8 +1846,8 @@ var require_Collection = __commonJS((exports) => {
|
|
|
1846
1846
|
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
1847
1847
|
}
|
|
1848
1848
|
}
|
|
1849
|
-
deleteIn(
|
|
1850
|
-
const [key, ...rest] =
|
|
1849
|
+
deleteIn(path2) {
|
|
1850
|
+
const [key, ...rest] = path2;
|
|
1851
1851
|
if (rest.length === 0)
|
|
1852
1852
|
return this.delete(key);
|
|
1853
1853
|
const node = this.get(key, true);
|
|
@@ -1856,8 +1856,8 @@ var require_Collection = __commonJS((exports) => {
|
|
|
1856
1856
|
else
|
|
1857
1857
|
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
1858
1858
|
}
|
|
1859
|
-
getIn(
|
|
1860
|
-
const [key, ...rest] =
|
|
1859
|
+
getIn(path2, keepScalar) {
|
|
1860
|
+
const [key, ...rest] = path2;
|
|
1861
1861
|
const node = this.get(key, true);
|
|
1862
1862
|
if (rest.length === 0)
|
|
1863
1863
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -1872,15 +1872,15 @@ var require_Collection = __commonJS((exports) => {
|
|
|
1872
1872
|
return n == null || allowScalar && identity.isScalar(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
|
|
1873
1873
|
});
|
|
1874
1874
|
}
|
|
1875
|
-
hasIn(
|
|
1876
|
-
const [key, ...rest] =
|
|
1875
|
+
hasIn(path2) {
|
|
1876
|
+
const [key, ...rest] = path2;
|
|
1877
1877
|
if (rest.length === 0)
|
|
1878
1878
|
return this.has(key);
|
|
1879
1879
|
const node = this.get(key, true);
|
|
1880
1880
|
return identity.isCollection(node) ? node.hasIn(rest) : false;
|
|
1881
1881
|
}
|
|
1882
|
-
setIn(
|
|
1883
|
-
const [key, ...rest] =
|
|
1882
|
+
setIn(path2, value) {
|
|
1883
|
+
const [key, ...rest] = path2;
|
|
1884
1884
|
if (rest.length === 0) {
|
|
1885
1885
|
this.set(key, value);
|
|
1886
1886
|
} else {
|
|
@@ -4262,9 +4262,9 @@ var require_Document = __commonJS((exports) => {
|
|
|
4262
4262
|
if (assertCollection(this.contents))
|
|
4263
4263
|
this.contents.add(value);
|
|
4264
4264
|
}
|
|
4265
|
-
addIn(
|
|
4265
|
+
addIn(path2, value) {
|
|
4266
4266
|
if (assertCollection(this.contents))
|
|
4267
|
-
this.contents.addIn(
|
|
4267
|
+
this.contents.addIn(path2, value);
|
|
4268
4268
|
}
|
|
4269
4269
|
createAlias(node, name) {
|
|
4270
4270
|
if (!node.anchor) {
|
|
@@ -4313,30 +4313,30 @@ var require_Document = __commonJS((exports) => {
|
|
|
4313
4313
|
delete(key) {
|
|
4314
4314
|
return assertCollection(this.contents) ? this.contents.delete(key) : false;
|
|
4315
4315
|
}
|
|
4316
|
-
deleteIn(
|
|
4317
|
-
if (Collection.isEmptyPath(
|
|
4316
|
+
deleteIn(path2) {
|
|
4317
|
+
if (Collection.isEmptyPath(path2)) {
|
|
4318
4318
|
if (this.contents == null)
|
|
4319
4319
|
return false;
|
|
4320
4320
|
this.contents = null;
|
|
4321
4321
|
return true;
|
|
4322
4322
|
}
|
|
4323
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
4323
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path2) : false;
|
|
4324
4324
|
}
|
|
4325
4325
|
get(key, keepScalar) {
|
|
4326
4326
|
return identity.isCollection(this.contents) ? this.contents.get(key, keepScalar) : undefined;
|
|
4327
4327
|
}
|
|
4328
|
-
getIn(
|
|
4329
|
-
if (Collection.isEmptyPath(
|
|
4328
|
+
getIn(path2, keepScalar) {
|
|
4329
|
+
if (Collection.isEmptyPath(path2))
|
|
4330
4330
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
4331
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
4331
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path2, keepScalar) : undefined;
|
|
4332
4332
|
}
|
|
4333
4333
|
has(key) {
|
|
4334
4334
|
return identity.isCollection(this.contents) ? this.contents.has(key) : false;
|
|
4335
4335
|
}
|
|
4336
|
-
hasIn(
|
|
4337
|
-
if (Collection.isEmptyPath(
|
|
4336
|
+
hasIn(path2) {
|
|
4337
|
+
if (Collection.isEmptyPath(path2))
|
|
4338
4338
|
return this.contents !== undefined;
|
|
4339
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
4339
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path2) : false;
|
|
4340
4340
|
}
|
|
4341
4341
|
set(key, value) {
|
|
4342
4342
|
if (this.contents == null) {
|
|
@@ -4345,13 +4345,13 @@ var require_Document = __commonJS((exports) => {
|
|
|
4345
4345
|
this.contents.set(key, value);
|
|
4346
4346
|
}
|
|
4347
4347
|
}
|
|
4348
|
-
setIn(
|
|
4349
|
-
if (Collection.isEmptyPath(
|
|
4348
|
+
setIn(path2, value) {
|
|
4349
|
+
if (Collection.isEmptyPath(path2)) {
|
|
4350
4350
|
this.contents = value;
|
|
4351
4351
|
} else if (this.contents == null) {
|
|
4352
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
4352
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path2), value);
|
|
4353
4353
|
} else if (assertCollection(this.contents)) {
|
|
4354
|
-
this.contents.setIn(
|
|
4354
|
+
this.contents.setIn(path2, value);
|
|
4355
4355
|
}
|
|
4356
4356
|
}
|
|
4357
4357
|
setSchema(version, options = {}) {
|
|
@@ -6240,9 +6240,9 @@ var require_cst_visit = __commonJS((exports) => {
|
|
|
6240
6240
|
visit.BREAK = BREAK;
|
|
6241
6241
|
visit.SKIP = SKIP;
|
|
6242
6242
|
visit.REMOVE = REMOVE;
|
|
6243
|
-
visit.itemAtPath = (cst,
|
|
6243
|
+
visit.itemAtPath = (cst, path2) => {
|
|
6244
6244
|
let item = cst;
|
|
6245
|
-
for (const [field, index] of
|
|
6245
|
+
for (const [field, index] of path2) {
|
|
6246
6246
|
const tok = item?.[field];
|
|
6247
6247
|
if (tok && "items" in tok) {
|
|
6248
6248
|
item = tok.items[index];
|
|
@@ -6251,23 +6251,23 @@ var require_cst_visit = __commonJS((exports) => {
|
|
|
6251
6251
|
}
|
|
6252
6252
|
return item;
|
|
6253
6253
|
};
|
|
6254
|
-
visit.parentCollection = (cst,
|
|
6255
|
-
const parent = visit.itemAtPath(cst,
|
|
6256
|
-
const field =
|
|
6254
|
+
visit.parentCollection = (cst, path2) => {
|
|
6255
|
+
const parent = visit.itemAtPath(cst, path2.slice(0, -1));
|
|
6256
|
+
const field = path2[path2.length - 1][0];
|
|
6257
6257
|
const coll = parent?.[field];
|
|
6258
6258
|
if (coll && "items" in coll)
|
|
6259
6259
|
return coll;
|
|
6260
6260
|
throw new Error("Parent collection not found");
|
|
6261
6261
|
};
|
|
6262
|
-
function _visit(
|
|
6263
|
-
let ctrl = visitor(item,
|
|
6262
|
+
function _visit(path2, item, visitor) {
|
|
6263
|
+
let ctrl = visitor(item, path2);
|
|
6264
6264
|
if (typeof ctrl === "symbol")
|
|
6265
6265
|
return ctrl;
|
|
6266
6266
|
for (const field of ["key", "value"]) {
|
|
6267
6267
|
const token = item[field];
|
|
6268
6268
|
if (token && "items" in token) {
|
|
6269
6269
|
for (let i = 0;i < token.items.length; ++i) {
|
|
6270
|
-
const ci = _visit(Object.freeze(
|
|
6270
|
+
const ci = _visit(Object.freeze(path2.concat([[field, i]])), token.items[i], visitor);
|
|
6271
6271
|
if (typeof ci === "number")
|
|
6272
6272
|
i = ci - 1;
|
|
6273
6273
|
else if (ci === BREAK)
|
|
@@ -6278,10 +6278,10 @@ var require_cst_visit = __commonJS((exports) => {
|
|
|
6278
6278
|
}
|
|
6279
6279
|
}
|
|
6280
6280
|
if (typeof ctrl === "function" && field === "key")
|
|
6281
|
-
ctrl = ctrl(item,
|
|
6281
|
+
ctrl = ctrl(item, path2);
|
|
6282
6282
|
}
|
|
6283
6283
|
}
|
|
6284
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
6284
|
+
return typeof ctrl === "function" ? ctrl(item, path2) : ctrl;
|
|
6285
6285
|
}
|
|
6286
6286
|
exports.visit = visit;
|
|
6287
6287
|
});
|
|
@@ -11255,7 +11255,8 @@ var adapters = {
|
|
|
11255
11255
|
return { binary: "copilot", args: withModelArgs(options.model, args) };
|
|
11256
11256
|
},
|
|
11257
11257
|
buildResumeCommand(_sessionId, prompt, options) {
|
|
11258
|
-
const
|
|
11258
|
+
const auto = options.allowAll ? ["--allow-all", "--no-ask-user"] : [];
|
|
11259
|
+
const args = [...auto, "-p", prompt];
|
|
11259
11260
|
return { binary: "copilot", args: withModelArgs(options.model, args) };
|
|
11260
11261
|
},
|
|
11261
11262
|
createStreamParser: createPassthroughParser,
|
|
@@ -11274,6 +11275,41 @@ function getHarnessAdapter(name) {
|
|
|
11274
11275
|
|
|
11275
11276
|
// src/lib/process-runner.ts
|
|
11276
11277
|
import { spawn } from "node:child_process";
|
|
11278
|
+
import path from "node:path";
|
|
11279
|
+
var PATH_PARAMETER_KEYS = new Set(["file_path", "filepath", "path", "notebook_path"]);
|
|
11280
|
+
var PARAMETER_MAX_LENGTH = 60;
|
|
11281
|
+
var RAW_INPUT_MAX_LENGTH = 100;
|
|
11282
|
+
function truncateFromEnd(value, maxLength) {
|
|
11283
|
+
if (value.length <= maxLength) {
|
|
11284
|
+
return value;
|
|
11285
|
+
}
|
|
11286
|
+
return value.slice(0, maxLength - 3) + "...";
|
|
11287
|
+
}
|
|
11288
|
+
function truncateFromBeginning(value, maxLength) {
|
|
11289
|
+
if (value.length <= maxLength) {
|
|
11290
|
+
return value;
|
|
11291
|
+
}
|
|
11292
|
+
return "..." + value.slice(-(maxLength - 3));
|
|
11293
|
+
}
|
|
11294
|
+
function isPathParameterKey(key) {
|
|
11295
|
+
return PATH_PARAMETER_KEYS.has(key.toLowerCase());
|
|
11296
|
+
}
|
|
11297
|
+
function looksLikeFilePath(value) {
|
|
11298
|
+
return path.isAbsolute(value) || value.includes("/") || value.includes("\\") || value.startsWith("./") || value.startsWith("../") || value.startsWith("~/");
|
|
11299
|
+
}
|
|
11300
|
+
function stripWorkspacePrefix(filePath, workspaceRoot) {
|
|
11301
|
+
if (!path.isAbsolute(filePath)) {
|
|
11302
|
+
return filePath;
|
|
11303
|
+
}
|
|
11304
|
+
const relativePath = path.relative(workspaceRoot, filePath);
|
|
11305
|
+
if (relativePath && !relativePath.startsWith("..") && !path.isAbsolute(relativePath)) {
|
|
11306
|
+
return relativePath;
|
|
11307
|
+
}
|
|
11308
|
+
if (relativePath === "") {
|
|
11309
|
+
return ".";
|
|
11310
|
+
}
|
|
11311
|
+
return filePath;
|
|
11312
|
+
}
|
|
11277
11313
|
function formatToolInput(toolInput) {
|
|
11278
11314
|
try {
|
|
11279
11315
|
const parsed = JSON.parse(toolInput);
|
|
@@ -11281,14 +11317,17 @@ function formatToolInput(toolInput) {
|
|
|
11281
11317
|
if (entries.length === 0) {
|
|
11282
11318
|
return "";
|
|
11283
11319
|
}
|
|
11320
|
+
const workspaceRoot = process.cwd();
|
|
11284
11321
|
const parts = entries.map(([key, value]) => {
|
|
11285
11322
|
const strValue = typeof value === "string" ? value : JSON.stringify(value);
|
|
11286
|
-
const
|
|
11323
|
+
const isPathLike = typeof value === "string" && isPathParameterKey(key) && looksLikeFilePath(value);
|
|
11324
|
+
const formatted = isPathLike ? stripWorkspacePrefix(strValue, workspaceRoot) : strValue;
|
|
11325
|
+
const truncated = isPathLike ? truncateFromBeginning(formatted, PARAMETER_MAX_LENGTH) : truncateFromEnd(formatted, PARAMETER_MAX_LENGTH);
|
|
11287
11326
|
return `${key}=${truncated}`;
|
|
11288
11327
|
});
|
|
11289
11328
|
return parts.join(" ");
|
|
11290
11329
|
} catch {
|
|
11291
|
-
return toolInput
|
|
11330
|
+
return truncateFromEnd(toolInput, RAW_INPUT_MAX_LENGTH);
|
|
11292
11331
|
}
|
|
11293
11332
|
}
|
|
11294
11333
|
async function runHarnessCommand(command, parseStreamLine) {
|
|
@@ -12218,41 +12257,6 @@ class RootCommand extends BaseCommand {
|
|
|
12218
12257
|
}
|
|
12219
12258
|
}
|
|
12220
12259
|
|
|
12221
|
-
// src/lib/logger.ts
|
|
12222
|
-
var colors = {
|
|
12223
|
-
reset: "\x1B[0m",
|
|
12224
|
-
bold: "\x1B[1m",
|
|
12225
|
-
red: "\x1B[31m",
|
|
12226
|
-
yellow: "\x1B[33m",
|
|
12227
|
-
cyan: "\x1B[36m",
|
|
12228
|
-
green: "\x1B[32m"
|
|
12229
|
-
};
|
|
12230
|
-
function wrap(color, text) {
|
|
12231
|
-
return `${color}${text}${colors.reset}`;
|
|
12232
|
-
}
|
|
12233
|
-
var logger = {
|
|
12234
|
-
header(text) {
|
|
12235
|
-
process.stdout.write(`${wrap(colors.bold + colors.cyan, text)}
|
|
12236
|
-
`);
|
|
12237
|
-
},
|
|
12238
|
-
info(text) {
|
|
12239
|
-
process.stdout.write(`${text}
|
|
12240
|
-
`);
|
|
12241
|
-
},
|
|
12242
|
-
success(text) {
|
|
12243
|
-
process.stdout.write(`${wrap(colors.green, text)}
|
|
12244
|
-
`);
|
|
12245
|
-
},
|
|
12246
|
-
warn(text) {
|
|
12247
|
-
process.stderr.write(`${wrap(colors.yellow, text)}
|
|
12248
|
-
`);
|
|
12249
|
-
},
|
|
12250
|
-
error(text) {
|
|
12251
|
-
process.stderr.write(`${wrap(colors.red, text)}
|
|
12252
|
-
`);
|
|
12253
|
-
}
|
|
12254
|
-
};
|
|
12255
|
-
|
|
12256
12260
|
// src/commands/run.ts
|
|
12257
12261
|
import { readFile as readFile4, stat } from "node:fs/promises";
|
|
12258
12262
|
import { resolve as resolve9 } from "node:path";
|
|
@@ -12315,6 +12319,9 @@ async function resolveWorkflowPath(inputPath) {
|
|
|
12315
12319
|
throw new UserInputError(`Failed to access workflow path "${absolutePath}": ${getErrorMessage(error)}`);
|
|
12316
12320
|
}
|
|
12317
12321
|
}
|
|
12322
|
+
function workflowRequiresTask(workflow) {
|
|
12323
|
+
return workflow.steps.some((step) => step.requires.inputs.includes("task"));
|
|
12324
|
+
}
|
|
12318
12325
|
|
|
12319
12326
|
class RunCommand extends BaseCommand {
|
|
12320
12327
|
static paths = [["run"]];
|
|
@@ -12402,7 +12409,7 @@ class RunCommand extends BaseCommand {
|
|
|
12402
12409
|
}
|
|
12403
12410
|
throw new UserInputError(`Failed to load workflow "${workflowPath}": ${getErrorMessage(error)}`);
|
|
12404
12411
|
}
|
|
12405
|
-
const { task, displayTask } = await this.resolveTask();
|
|
12412
|
+
const { task, displayTask } = workflowRequiresTask(workflow) ? await this.resolveTask() : { task: "", displayTask: "(none)" };
|
|
12406
12413
|
const runId = generateRunId();
|
|
12407
12414
|
const runState = createInitialRunState({
|
|
12408
12415
|
runId,
|
|
@@ -12451,13 +12458,13 @@ try {
|
|
|
12451
12458
|
process.exitCode = Math.max(process.exitCode ?? 0, exitCode);
|
|
12452
12459
|
} catch (error) {
|
|
12453
12460
|
if (error instanceof RmrError) {
|
|
12454
|
-
|
|
12461
|
+
ui.error(`${error.code}: ${error.message}`);
|
|
12455
12462
|
process.exitCode = 1;
|
|
12456
12463
|
} else if (error instanceof Error) {
|
|
12457
|
-
|
|
12464
|
+
ui.error(error.message);
|
|
12458
12465
|
process.exitCode = 1;
|
|
12459
12466
|
} else {
|
|
12460
|
-
|
|
12467
|
+
ui.error("Unknown error");
|
|
12461
12468
|
process.exitCode = 1;
|
|
12462
12469
|
}
|
|
12463
12470
|
}
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@klaudworks/rex",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@klaudworks/rex",
|
|
9
|
-
"version": "1.
|
|
9
|
+
"version": "1.1.2",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"clipanion": "^4.0.0-rc.4",
|
|
12
12
|
"yaml": "^2.8.2"
|