@youdie006/prodex 0.31.1 → 0.32.0
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/tui-run.js +8 -1
- package/dist/tui.js +15 -0
- package/package.json +1 -1
package/dist/tui-run.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import readline from "node:readline";
|
|
10
10
|
import { renderBanner } from "./banner.js";
|
|
11
11
|
import { destinationChoices, effortChoices, SEND_KINDS } from "./tui-flow.js";
|
|
12
|
-
import { consultArgsFromChoices, conversationsInProject, conversationThreadUrl, moveCursor, progressLabel, renderContextPanel, renderProgressBar, renderSelectList } from "./tui.js";
|
|
12
|
+
import { consultArgsFromChoices, conversationsInProject, conversationThreadUrl, moveCursor, parseAttachmentLine, progressLabel, renderContextPanel, renderProgressBar, renderSelectList } from "./tui.js";
|
|
13
13
|
const ESC = "";
|
|
14
14
|
const CLEAR = `${ESC}[2J${ESC}[H`;
|
|
15
15
|
// The alternate screen buffer: the terminal comes back exactly as it was, so a
|
|
@@ -258,12 +258,19 @@ export async function runInteractiveConsult(io, deps) {
|
|
|
258
258
|
io.write("Nothing to ask.\n");
|
|
259
259
|
return 1;
|
|
260
260
|
}
|
|
261
|
+
// Uploading a file is the only way ChatGPT can open a pdf, pptx, xlsx or
|
|
262
|
+
// image, and the picker had no way to say so. Asked after the prompt, and
|
|
263
|
+
// skipped by pressing enter, so the common case costs one keystroke.
|
|
264
|
+
io.write(SHOW_CURSOR);
|
|
265
|
+
const attachments = parseAttachmentLine(await askLine(io, "\n attach files? repo-relative paths, space separated, enter to skip\n files: "));
|
|
266
|
+
io.write(HIDE_CURSOR);
|
|
261
267
|
const choices = {
|
|
262
268
|
prompt,
|
|
263
269
|
projectMode,
|
|
264
270
|
...(projectName ? { projectName } : {}),
|
|
265
271
|
...(targetUrl ? { targetUrl } : {}),
|
|
266
272
|
...(effort ? { effort } : {}),
|
|
273
|
+
...(attachments.length > 0 ? { attachments } : {}),
|
|
267
274
|
tools,
|
|
268
275
|
newChat: !targetUrl
|
|
269
276
|
};
|
package/dist/tui.js
CHANGED
|
@@ -57,6 +57,21 @@ export function consultArgsFromChoices(choices) {
|
|
|
57
57
|
args.push("--", prompt);
|
|
58
58
|
return args;
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Split the one line a person types into the paths the send wants one flag at
|
|
62
|
+
* a time. Quotes are honoured because file names have spaces in them.
|
|
63
|
+
*/
|
|
64
|
+
export function parseAttachmentLine(line) {
|
|
65
|
+
const out = [];
|
|
66
|
+
const pattern = /"([^"]*)"|'([^']*)'|(\S+)/g;
|
|
67
|
+
let match;
|
|
68
|
+
while ((match = pattern.exec(line)) !== null) {
|
|
69
|
+
const value = (match[1] ?? match[2] ?? match[3] ?? "").trim();
|
|
70
|
+
if (value.length > 0)
|
|
71
|
+
out.push(value);
|
|
72
|
+
}
|
|
73
|
+
return out;
|
|
74
|
+
}
|
|
60
75
|
/**
|
|
61
76
|
* Projects with the id their conversations are tagged with.
|
|
62
77
|
*
|