cawdev-cli 1.0.8-beta → 1.0.10-beta
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 +6 -1
- package/lib/roadmap-format.mjs +101 -2
- package/lib/runner-config.mjs +1 -1
- package/mcp/README.md +11 -2
- package/mcp/server.mjs +189 -13
- package/package.json +1 -1
- package/runner/README.md +31 -0
- package/runner/attach.mjs +192 -17
- package/runner/runner.mjs +214 -10
- package/runner/split.mjs +32 -0
package/runner/split.mjs
CHANGED
|
@@ -168,6 +168,38 @@ export function tailOf(lines, width, rows) {
|
|
|
168
168
|
return out.reverse();
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
/**
|
|
172
|
+
* The reader — `/view` on a session waiting for an answer or a permission.
|
|
173
|
+
*
|
|
174
|
+
* A window's body is the TAIL of what was said and a question's banner fits
|
|
175
|
+
* the prompt's rows, so a long plan or a long question was cut and could not
|
|
176
|
+
* be scrolled. The reader is one window over the whole screen, showing
|
|
177
|
+
* `lines` from row `top` (wrapped to its width), with where it is in the
|
|
178
|
+
* title. `top` null means "start where the request starts" (`requestAt`);
|
|
179
|
+
* whatever is asked for is clamped, and the answer says what was used so the
|
|
180
|
+
* keys can page from it.
|
|
181
|
+
*/
|
|
182
|
+
export function readerFrame(width, height, { title = '', lines = [], requestAt = 0, top = null, footer = '' }, ink) {
|
|
183
|
+
const inner = Math.max(1, width - 2);
|
|
184
|
+
const rows = [];
|
|
185
|
+
let requestRow = 0;
|
|
186
|
+
lines.forEach((line, i) => {
|
|
187
|
+
if (i === requestAt) requestRow = rows.length;
|
|
188
|
+
rows.push(...wrap(String(line ?? ''), inner));
|
|
189
|
+
});
|
|
190
|
+
const room = Math.max(1, height - 2 - (footer ? 1 : 0));
|
|
191
|
+
const max = Math.max(0, rows.length - room);
|
|
192
|
+
const at = Math.min(Math.max(0, top ?? requestRow), max);
|
|
193
|
+
const shown = rows.slice(at, at + room);
|
|
194
|
+
const where = rows.length > room ? ` · ${at + 1}–${at + shown.length} of ${rows.length}` : '';
|
|
195
|
+
return {
|
|
196
|
+
lines: windowLines({ width, height }, { title: `${title}${where}`, body: shown, footer, focused: true }, ink),
|
|
197
|
+
top: at,
|
|
198
|
+
max,
|
|
199
|
+
room,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
|
|
171
203
|
/**
|
|
172
204
|
* The whole screen, from placed pieces: `height` rows, each the pieces that
|
|
173
205
|
* cross it laid left to right, and blank where nothing is.
|