march-cli 0.1.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/bin/march.mjs +13 -0
- package/package.json +36 -0
- package/src/agent/command-exec-tool.mjs +91 -0
- package/src/agent/context-stats-tool.mjs +57 -0
- package/src/agent/editing/diff-apply.mjs +28 -0
- package/src/agent/editing/diff-format.mjs +57 -0
- package/src/agent/file-edit-tool.mjs +276 -0
- package/src/agent/find-tool.mjs +112 -0
- package/src/agent/model-payload-dumper.mjs +201 -0
- package/src/agent/pi-session/pi-session-sidecar-failure.mjs +10 -0
- package/src/agent/provider/payload-messages.mjs +138 -0
- package/src/agent/read-file-tool.mjs +112 -0
- package/src/agent/runner/fast-model.mjs +36 -0
- package/src/agent/runner/runner-cleanup.mjs +12 -0
- package/src/agent/runner/runner-init.mjs +15 -0
- package/src/agent/runner/runner-session-state.mjs +40 -0
- package/src/agent/runner.mjs +266 -0
- package/src/agent/runtime/runner-runtime-host.mjs +73 -0
- package/src/agent/runtime/runtime-factory.mjs +42 -0
- package/src/agent/runtime/runtime-host.mjs +34 -0
- package/src/agent/session/session-auto-name.mjs +41 -0
- package/src/agent/session/session-binding.mjs +12 -0
- package/src/agent/session/session-options.mjs +46 -0
- package/src/agent/tool-names.mjs +1 -0
- package/src/agent/tool-result.mjs +3 -0
- package/src/agent/tools.mjs +54 -0
- package/src/agent/turn/turn-events.mjs +64 -0
- package/src/agent/turn/turn-runner.mjs +103 -0
- package/src/auth/login-command.mjs +90 -0
- package/src/auth/storage.mjs +33 -0
- package/src/cli/args.mjs +71 -0
- package/src/cli/commands/copy-command.mjs +73 -0
- package/src/cli/commands/export-command.mjs +206 -0
- package/src/cli/commands/extensions-command.mjs +53 -0
- package/src/cli/commands/help-command.mjs +7 -0
- package/src/cli/commands/model-command.mjs +110 -0
- package/src/cli/commands/paste-image-command.mjs +43 -0
- package/src/cli/commands/provider-command.mjs +55 -0
- package/src/cli/commands/status-command.mjs +157 -0
- package/src/cli/commands/thinking-command.mjs +80 -0
- package/src/cli/fallback-ui.mjs +156 -0
- package/src/cli/input/attachment-tokens.mjs +20 -0
- package/src/cli/input/autocomplete.mjs +106 -0
- package/src/cli/input/external-editor.mjs +39 -0
- package/src/cli/input/history-store.mjs +35 -0
- package/src/cli/input/image-clipboard.mjs +55 -0
- package/src/cli/input/keybinding-dispatch.mjs +76 -0
- package/src/cli/input/keybindings.mjs +96 -0
- package/src/cli/input/mode-state.mjs +43 -0
- package/src/cli/input/prompt-templates.mjs +84 -0
- package/src/cli/input/select-with-keyboard.mjs +67 -0
- package/src/cli/permissions.mjs +103 -0
- package/src/cli/repl-commands.mjs +86 -0
- package/src/cli/repl-loop.mjs +157 -0
- package/src/cli/selector-list.mjs +21 -0
- package/src/cli/session/pi-session-switch-command.mjs +41 -0
- package/src/cli/session/session-command.mjs +23 -0
- package/src/cli/session/session-list-command.mjs +68 -0
- package/src/cli/session/session-name-command.mjs +26 -0
- package/src/cli/session/session-source-command.mjs +89 -0
- package/src/cli/session/session-switch-command.mjs +1 -0
- package/src/cli/shell/shell-command.mjs +55 -0
- package/src/cli/shell/shell-drawer-controls.mjs +33 -0
- package/src/cli/shell/shell-drawer.mjs +192 -0
- package/src/cli/shell/shell-split-layout.mjs +70 -0
- package/src/cli/slash-commands.mjs +176 -0
- package/src/cli/startup/startup-banner.mjs +17 -0
- package/src/cli/startup/startup-session.mjs +51 -0
- package/src/cli/status-line-updater.mjs +74 -0
- package/src/cli/tool-output.mjs +9 -0
- package/src/cli/tui/editor/external-editor-runner.mjs +24 -0
- package/src/cli/tui/input/mouse-selection-controller.mjs +89 -0
- package/src/cli/tui/input/mouse-tracking.mjs +20 -0
- package/src/cli/tui/layout/main-pane-layout.mjs +38 -0
- package/src/cli/tui/layout/safe-render-boundary.mjs +46 -0
- package/src/cli/tui/markdown-renderer.mjs +279 -0
- package/src/cli/tui/output/scroll-state.mjs +79 -0
- package/src/cli/tui/output/tool-card-renderer.mjs +59 -0
- package/src/cli/tui/output-buffer.mjs +297 -0
- package/src/cli/tui/permission-request-ui.mjs +18 -0
- package/src/cli/tui/recall-rendering.mjs +25 -0
- package/src/cli/tui/select/editor-select-list.mjs +111 -0
- package/src/cli/tui/selection-screen.mjs +212 -0
- package/src/cli/tui/status/retry-status.mjs +72 -0
- package/src/cli/tui/status/spinner-status.mjs +42 -0
- package/src/cli/tui/status/status-bar.mjs +88 -0
- package/src/cli/tui/syntax/highlighting.mjs +277 -0
- package/src/cli/tui/syntax/languages.mjs +91 -0
- package/src/cli/tui/syntax/tree-sitter/bash.highlights.scm +261 -0
- package/src/cli/tui/syntax/tree-sitter/c.highlights.scm +341 -0
- package/src/cli/tui/syntax/tree-sitter/cpp.highlights.scm +268 -0
- package/src/cli/tui/syntax/tree-sitter/csharp.highlights.scm +577 -0
- package/src/cli/tui/syntax/tree-sitter/css.highlights.scm +109 -0
- package/src/cli/tui/syntax/tree-sitter/diff.highlights.scm +49 -0
- package/src/cli/tui/syntax/tree-sitter/go.highlights.scm +254 -0
- package/src/cli/tui/syntax/tree-sitter/html.highlights.scm +13 -0
- package/src/cli/tui/syntax/tree-sitter/java.highlights.scm +330 -0
- package/src/cli/tui/syntax/tree-sitter/json.highlights.scm +38 -0
- package/src/cli/tui/syntax/tree-sitter/php.highlights.scm +203 -0
- package/src/cli/tui/syntax/tree-sitter/python.highlights.scm +137 -0
- package/src/cli/tui/syntax/tree-sitter/ruby.highlights.scm +309 -0
- package/src/cli/tui/syntax/tree-sitter/rust.highlights.scm +531 -0
- package/src/cli/tui/syntax/tree-sitter/toml.highlights.scm +39 -0
- package/src/cli/tui/syntax/tree-sitter/tree-sitter-bash.wasm +0 -0
- package/src/cli/tui/syntax/tree-sitter/tree-sitter-c-sharp.wasm +0 -0
- package/src/cli/tui/syntax/tree-sitter/tree-sitter-c.wasm +0 -0
- package/src/cli/tui/syntax/tree-sitter/tree-sitter-cpp.wasm +0 -0
- package/src/cli/tui/syntax/tree-sitter/tree-sitter-css.wasm +0 -0
- package/src/cli/tui/syntax/tree-sitter/tree-sitter-diff.wasm +0 -0
- package/src/cli/tui/syntax/tree-sitter/tree-sitter-go.wasm +0 -0
- package/src/cli/tui/syntax/tree-sitter/tree-sitter-html.wasm +0 -0
- package/src/cli/tui/syntax/tree-sitter/tree-sitter-java.wasm +0 -0
- package/src/cli/tui/syntax/tree-sitter/tree-sitter-json.wasm +0 -0
- package/src/cli/tui/syntax/tree-sitter/tree-sitter-php.wasm +0 -0
- package/src/cli/tui/syntax/tree-sitter/tree-sitter-python.wasm +0 -0
- package/src/cli/tui/syntax/tree-sitter/tree-sitter-ruby.wasm +0 -0
- package/src/cli/tui/syntax/tree-sitter/tree-sitter-rust.wasm +0 -0
- package/src/cli/tui/syntax/tree-sitter/tree-sitter-toml.wasm +0 -0
- package/src/cli/tui/syntax/tree-sitter/tree-sitter-tsx.wasm +0 -0
- package/src/cli/tui/syntax/tree-sitter/tree-sitter-typescript.wasm +0 -0
- package/src/cli/tui/syntax/tree-sitter/tree-sitter-yaml.wasm +0 -0
- package/src/cli/tui/syntax/tree-sitter/tsx.highlights.scm +35 -0
- package/src/cli/tui/syntax/tree-sitter/typescript.highlights.scm +35 -0
- package/src/cli/tui/syntax/tree-sitter/yaml.highlights.scm +99 -0
- package/src/cli/tui/tool-rendering.mjs +194 -0
- package/src/cli/tui/tui-diff-rendering.mjs +157 -0
- package/src/cli/tui/tui-handlers.mjs +110 -0
- package/src/cli/tui/tui-input-controller.mjs +61 -0
- package/src/cli/tui/ui-theme.mjs +148 -0
- package/src/cli/ui.mjs +299 -0
- package/src/config/config-json.mjs +73 -0
- package/src/config/dotenv.mjs +20 -0
- package/src/config/features.mjs +75 -0
- package/src/config/loader.mjs +109 -0
- package/src/config/settings-command.mjs +97 -0
- package/src/context/diagnostics.mjs +70 -0
- package/src/context/engine.mjs +148 -0
- package/src/context/injections.mjs +26 -0
- package/src/context/project-context.mjs +20 -0
- package/src/context/session-status.mjs +15 -0
- package/src/context/shell-layers.mjs +23 -0
- package/src/context/system-core/base.md +60 -0
- package/src/context/system-core/prompts/deepseek-v4-pro.md +3 -0
- package/src/context/system-core/prompts/default.md +3 -0
- package/src/context/system-core.mjs +35 -0
- package/src/debug/model-context-dumper.mjs +52 -0
- package/src/extensions/discovery.mjs +40 -0
- package/src/extensions/lifecycle-adapter.mjs +210 -0
- package/src/extensions/lifecycle-manifest.mjs +69 -0
- package/src/image-gen/index.mjs +7 -0
- package/src/image-gen/provider.mjs +231 -0
- package/src/image-gen/tool.mjs +84 -0
- package/src/lsp/client.mjs +204 -0
- package/src/lsp/diagnostic-store.mjs +39 -0
- package/src/lsp/servers.mjs +212 -0
- package/src/lsp/service.mjs +65 -0
- package/src/main.mjs +294 -0
- package/src/mcp/client.mjs +195 -0
- package/src/mcp/config.mjs +130 -0
- package/src/mcp/index.mjs +48 -0
- package/src/mcp/tools.mjs +98 -0
- package/src/memory/database.mjs +219 -0
- package/src/memory/glossary.mjs +124 -0
- package/src/memory/graph/graph-cascades.mjs +109 -0
- package/src/memory/graph/graph-diagnostics.mjs +73 -0
- package/src/memory/graph/graph-path-removal.mjs +50 -0
- package/src/memory/graph/graph-path-utils.mjs +17 -0
- package/src/memory/graph/graph-primitives.mjs +103 -0
- package/src/memory/graph/graph-read.mjs +159 -0
- package/src/memory/graph.mjs +282 -0
- package/src/memory/markdown/markdown-delete.mjs +23 -0
- package/src/memory/markdown/markdown-format.mjs +128 -0
- package/src/memory/markdown/markdown-recall.mjs +28 -0
- package/src/memory/markdown/ripgrep.mjs +16 -0
- package/src/memory/markdown/sqlite-index.mjs +87 -0
- package/src/memory/markdown-store.mjs +286 -0
- package/src/memory/markdown-tools.mjs +103 -0
- package/src/memory/search.mjs +142 -0
- package/src/memory/snapshot.mjs +86 -0
- package/src/memory/system-views.mjs +120 -0
- package/src/memory/tools.mjs +282 -0
- package/src/notification/desktop-notifier.mjs +85 -0
- package/src/platform/open-file.mjs +28 -0
- package/src/provider/config-command.mjs +129 -0
- package/src/provider/presets.mjs +72 -0
- package/src/session/attachment-display.mjs +16 -0
- package/src/session/attachment-references.mjs +65 -0
- package/src/session/attachments.mjs +140 -0
- package/src/session/persist.mjs +1 -0
- package/src/session/pi-manager.mjs +34 -0
- package/src/session/session-utils.mjs +16 -0
- package/src/session/sidecar-sync.mjs +19 -0
- package/src/session/sidecar.mjs +68 -0
- package/src/session/transcript.mjs +83 -0
- package/src/session/tree.mjs +42 -0
- package/src/shell/cli-runtime.mjs +11 -0
- package/src/shell/hints.mjs +12 -0
- package/src/shell/node-pty-adapter.mjs +81 -0
- package/src/shell/runtime-state.mjs +126 -0
- package/src/shell/runtime.mjs +244 -0
- package/src/shell/screen-buffer.mjs +136 -0
- package/src/shell/tool-read.mjs +74 -0
- package/src/shell/tools.mjs +299 -0
- package/src/supergrok/actions/image-generate.mjs +60 -0
- package/src/supergrok/actions/search.mjs +78 -0
- package/src/supergrok/auth.mjs +36 -0
- package/src/supergrok/constants.mjs +18 -0
- package/src/supergrok/oauth-provider.mjs +278 -0
- package/src/supergrok/provider.mjs +36 -0
- package/src/supergrok/response.mjs +76 -0
- package/src/supergrok/tool.mjs +61 -0
- package/src/text/ansi.mjs +3 -0
- package/src/web/config-command.mjs +43 -0
- package/src/web/fetch.mjs +78 -0
- package/src/web/presets.mjs +16 -0
- package/src/web/search.mjs +83 -0
- package/src/web/tools.mjs +107 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { readdirSync } from "node:fs";
|
|
3
|
+
import { CombinedAutocompleteProvider } from "@earendil-works/pi-tui";
|
|
4
|
+
|
|
5
|
+
const MARCH_COMMANDS = [
|
|
6
|
+
{ name: "new", description: "Start a new pi session" },
|
|
7
|
+
{ name: "exit", description: "Exit March" },
|
|
8
|
+
{ name: "quit", description: "Exit March" },
|
|
9
|
+
{ name: "help", description: "Show available commands" },
|
|
10
|
+
{ name: "model", description: "Open model selector" },
|
|
11
|
+
{ name: "models", description: "List available models" },
|
|
12
|
+
{ name: "session", description: "Open previous session selector" },
|
|
13
|
+
{ name: "save", description: "Show auto-save status" },
|
|
14
|
+
{ name: "name", description: "Show or set session name" },
|
|
15
|
+
{ name: "copy", description: "Copy last assistant response to clipboard" },
|
|
16
|
+
{ name: "thinking", description: "Open thinking selector" },
|
|
17
|
+
{ name: "thinking list", description: "List available thinking levels" },
|
|
18
|
+
{ name: "mouse", description: "Toggle mouse wheel and TUI selection copy" },
|
|
19
|
+
{ name: "hotkeys", description: "Show keyboard shortcuts and input prefixes" },
|
|
20
|
+
{ name: "templates", description: "List project prompt templates" },
|
|
21
|
+
{ name: "export jsonl", description: "Export current session turns as JSONL" },
|
|
22
|
+
{ name: "export html", description: "Export current session turns as HTML" },
|
|
23
|
+
{ name: "export gist html", description: "Share current session HTML as a private GitHub Gist" },
|
|
24
|
+
{ name: "export gist jsonl", description: "Share current session JSONL as a private GitHub Gist" },
|
|
25
|
+
{ name: "settings", description: "Show or edit global/project settings" },
|
|
26
|
+
{ name: "shell", description: "List shells or inspect shell output" },
|
|
27
|
+
{ name: "shell spawn", description: "Start a default PTY shell" },
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
export function buildMarchCommands(promptTemplates = []) {
|
|
31
|
+
const templateCommands = promptTemplates
|
|
32
|
+
.map((template) => ({
|
|
33
|
+
name: typeof template === "string" ? template : template.name,
|
|
34
|
+
description: "Expand prompt template",
|
|
35
|
+
}))
|
|
36
|
+
.filter((command) => command.name && !command.name.startsWith("/"));
|
|
37
|
+
return [...MARCH_COMMANDS, ...templateCommands];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export class MarchAutocompleteProvider {
|
|
41
|
+
constructor(commands, cwd) {
|
|
42
|
+
this.base = new CombinedAutocompleteProvider(commands, cwd);
|
|
43
|
+
this.cwd = cwd;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async getSuggestions(lines, cursorLine, cursorCol, options) {
|
|
47
|
+
const suggestions = await this.base.getSuggestions(lines, cursorLine, cursorCol, options);
|
|
48
|
+
if (suggestions) return suggestions;
|
|
49
|
+
return this.getAtFileSuggestions(lines, cursorLine, cursorCol);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
applyCompletion(lines, cursorLine, cursorCol, item, prefix) {
|
|
53
|
+
return this.base.applyCompletion(lines, cursorLine, cursorCol, item, prefix);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
shouldTriggerFileCompletion(lines, cursorLine, cursorCol) {
|
|
57
|
+
return this.base.shouldTriggerFileCompletion(lines, cursorLine, cursorCol);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
getAtFileSuggestions(lines, cursorLine, cursorCol) {
|
|
61
|
+
const currentLine = lines[cursorLine] || "";
|
|
62
|
+
const textBeforeCursor = currentLine.slice(0, cursorCol);
|
|
63
|
+
const match = textBeforeCursor.match(/(?:^|[\s([{])(@[^\s]*)$/);
|
|
64
|
+
if (!match) return null;
|
|
65
|
+
|
|
66
|
+
const prefix = match[1];
|
|
67
|
+
const query = prefix.slice(1);
|
|
68
|
+
const displayDotSlash = query.startsWith("./");
|
|
69
|
+
const normalizedQuery = query.replace(/^[.][/\\]/, "").replace(/\\/g, "/").toLowerCase();
|
|
70
|
+
const items = [];
|
|
71
|
+
const skip = new Set([".git", "node_modules"]);
|
|
72
|
+
|
|
73
|
+
const walk = (dir, relative = "", depth = 0) => {
|
|
74
|
+
if (items.length >= 50 || depth > 5) return;
|
|
75
|
+
let entries;
|
|
76
|
+
try {
|
|
77
|
+
entries = readdirSync(dir, { withFileTypes: true });
|
|
78
|
+
} catch {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
for (const entry of entries) {
|
|
82
|
+
if (items.length >= 50) return;
|
|
83
|
+
if (skip.has(entry.name)) continue;
|
|
84
|
+
const rel = relative ? `${relative}/${entry.name}` : entry.name;
|
|
85
|
+
const isDirectory = entry.isDirectory();
|
|
86
|
+
const relForMatch = rel.toLowerCase();
|
|
87
|
+
if (!normalizedQuery || relForMatch.includes(normalizedQuery)) {
|
|
88
|
+
const displayPath = `${displayDotSlash ? "./" : ""}${rel}${isDirectory ? "/" : ""}`;
|
|
89
|
+
items.push({
|
|
90
|
+
value: `@${displayPath}`,
|
|
91
|
+
label: `${entry.name}${isDirectory ? "/" : ""}`,
|
|
92
|
+
description: displayPath,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
if (isDirectory) {
|
|
96
|
+
walk(join(dir, entry.name), rel, depth + 1);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
walk(this.cwd);
|
|
102
|
+
if (items.length === 0) return null;
|
|
103
|
+
items.sort((a, b) => a.description.localeCompare(b.description));
|
|
104
|
+
return { items, prefix };
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { readFileSync, unlinkSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
|
|
6
|
+
export function openTextInExternalEditor({
|
|
7
|
+
text = "",
|
|
8
|
+
editorCommand = getExternalEditorCommand(),
|
|
9
|
+
now = () => Date.now(),
|
|
10
|
+
spawn = spawnSync,
|
|
11
|
+
tempDir = tmpdir(),
|
|
12
|
+
} = {}) {
|
|
13
|
+
if (!editorCommand) {
|
|
14
|
+
return { ok: false, error: "No editor configured. Set $VISUAL or $EDITOR." };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const tmpFile = join(tempDir, `march-editor-${now()}.md`);
|
|
18
|
+
try {
|
|
19
|
+
writeFileSync(tmpFile, String(text ?? ""), "utf8");
|
|
20
|
+
const [bin, ...args] = editorCommand.split(" ");
|
|
21
|
+
const result = spawn(bin, [...args, tmpFile], {
|
|
22
|
+
stdio: "inherit",
|
|
23
|
+
shell: process.platform === "win32",
|
|
24
|
+
});
|
|
25
|
+
if (result.status !== 0) {
|
|
26
|
+
return { ok: false, error: `Editor exited with status ${result.status ?? "unknown"}` };
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
ok: true,
|
|
30
|
+
text: readFileSync(tmpFile, "utf8").replace(/\n$/, ""),
|
|
31
|
+
};
|
|
32
|
+
} finally {
|
|
33
|
+
try { unlinkSync(tmpFile); } catch {}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function getExternalEditorCommand(env = process.env) {
|
|
38
|
+
return env.VISUAL || env.EDITOR || "";
|
|
39
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { dirname } from "node:path";
|
|
3
|
+
|
|
4
|
+
const HISTORY_VERSION = 1;
|
|
5
|
+
const MAX_HISTORY_ITEMS = 100;
|
|
6
|
+
|
|
7
|
+
export function createInputHistoryStore({ path, maxItems = MAX_HISTORY_ITEMS } = {}) {
|
|
8
|
+
return {
|
|
9
|
+
load() {
|
|
10
|
+
if (!path || !existsSync(path)) return [];
|
|
11
|
+
try {
|
|
12
|
+
const data = JSON.parse(readFileSync(path, "utf8"));
|
|
13
|
+
const items = Array.isArray(data?.items) ? data.items : [];
|
|
14
|
+
return normalizeItems(items, maxItems);
|
|
15
|
+
} catch {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
save(items) {
|
|
21
|
+
if (!path) return;
|
|
22
|
+
const normalized = normalizeItems(items, maxItems);
|
|
23
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
24
|
+
writeFileSync(path, `${JSON.stringify({ version: HISTORY_VERSION, items: normalized }, null, 2)}\n`, "utf8");
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function normalizeItems(items, maxItems) {
|
|
30
|
+
return items
|
|
31
|
+
.filter((item) => typeof item === "string")
|
|
32
|
+
.map((item) => item.trim())
|
|
33
|
+
.filter(Boolean)
|
|
34
|
+
.slice(0, maxItems);
|
|
35
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
|
|
3
|
+
const WINDOWS_CLIPBOARD_IMAGE_SCRIPT = `
|
|
4
|
+
Add-Type -AssemblyName System.Windows.Forms
|
|
5
|
+
Add-Type -AssemblyName System.Drawing
|
|
6
|
+
if (-not [System.Windows.Forms.Clipboard]::ContainsImage()) {
|
|
7
|
+
[Console]::Error.WriteLine("clipboard does not contain an image")
|
|
8
|
+
exit 2
|
|
9
|
+
}
|
|
10
|
+
$image = [System.Windows.Forms.Clipboard]::GetImage()
|
|
11
|
+
$stream = New-Object System.IO.MemoryStream
|
|
12
|
+
$image.Save($stream, [System.Drawing.Imaging.ImageFormat]::Png)
|
|
13
|
+
[Convert]::ToBase64String($stream.ToArray())
|
|
14
|
+
`.trim();
|
|
15
|
+
|
|
16
|
+
export function readClipboardImage({
|
|
17
|
+
platform = process.platform,
|
|
18
|
+
spawnSyncImpl = spawnSync,
|
|
19
|
+
} = {}) {
|
|
20
|
+
if (platform !== "win32") {
|
|
21
|
+
return { ok: false, message: `clipboard image paste is not supported on ${platform}` };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const result = spawnSyncImpl("powershell.exe", [
|
|
25
|
+
"-NoProfile",
|
|
26
|
+
"-Sta",
|
|
27
|
+
"-NonInteractive",
|
|
28
|
+
"-Command",
|
|
29
|
+
WINDOWS_CLIPBOARD_IMAGE_SCRIPT,
|
|
30
|
+
], {
|
|
31
|
+
encoding: "utf8",
|
|
32
|
+
windowsHide: true,
|
|
33
|
+
});
|
|
34
|
+
if (result.error) return { ok: false, message: result.error.message };
|
|
35
|
+
if (result.status !== 0) {
|
|
36
|
+
const stderr = String(result.stderr || "").trim();
|
|
37
|
+
return { ok: false, message: stderr || `powershell.exe exited ${result.status}` };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const data = String(result.stdout || "").trim();
|
|
41
|
+
if (!isBase64(data)) return { ok: false, message: "clipboard image output was not valid base64" };
|
|
42
|
+
return {
|
|
43
|
+
ok: true,
|
|
44
|
+
mimeType: "image/png",
|
|
45
|
+
data,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function getWindowsClipboardImageScript() {
|
|
50
|
+
return WINDOWS_CLIPBOARD_IMAGE_SCRIPT;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function isBase64(value) {
|
|
54
|
+
return value.length > 0 && /^[A-Za-z0-9+/]+={0,2}$/.test(value);
|
|
55
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { matchesKey } from "@earendil-works/pi-tui";
|
|
2
|
+
import { DEFAULT_KEYBINDINGS, KEYBINDING_ACTIONS } from "./keybindings.mjs";
|
|
3
|
+
|
|
4
|
+
export const TERMINAL_KEY_SEQUENCES = Object.freeze({
|
|
5
|
+
Esc: "\x1b",
|
|
6
|
+
Tab: "\t",
|
|
7
|
+
"Shift+Tab": "\x1b[Z",
|
|
8
|
+
...Object.fromEntries(
|
|
9
|
+
Array.from({ length: 26 }, (_, index) => {
|
|
10
|
+
const letter = String.fromCharCode("A".charCodeAt(0) + index);
|
|
11
|
+
return [`Ctrl+${letter}`, String.fromCharCode(index + 1)];
|
|
12
|
+
})
|
|
13
|
+
),
|
|
14
|
+
...Object.fromEntries(
|
|
15
|
+
Array.from({ length: 26 }, (_, index) => {
|
|
16
|
+
const letter = String.fromCharCode("A".charCodeAt(0) + index);
|
|
17
|
+
return [`Alt+${letter}`, `\x1b${letter.toLowerCase()}`];
|
|
18
|
+
})
|
|
19
|
+
),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export function createKeybindingDispatcher({
|
|
23
|
+
keybindings = DEFAULT_KEYBINDINGS,
|
|
24
|
+
handlers = {},
|
|
25
|
+
isAutocompleteOpen = () => false,
|
|
26
|
+
hasOverlay = () => false,
|
|
27
|
+
} = {}) {
|
|
28
|
+
const bindings = buildBindings(keybindings);
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
dispatch(data) {
|
|
32
|
+
const action = findMatchingAction(data, bindings);
|
|
33
|
+
if (!action) return undefined;
|
|
34
|
+
|
|
35
|
+
if (action === "interrupt") return runHandler(handlers[action]);
|
|
36
|
+
if (action === "abort" && isAutocompleteOpen()) return undefined;
|
|
37
|
+
if (action === "toggleMode" && isAutocompleteOpen()) return undefined;
|
|
38
|
+
if (hasOverlay()) return undefined;
|
|
39
|
+
|
|
40
|
+
return runHandler(handlers[action]);
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function runHandler(handler) {
|
|
46
|
+
if (typeof handler !== "function") return undefined;
|
|
47
|
+
handler();
|
|
48
|
+
return { consume: true };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function buildBindings(keybindings) {
|
|
52
|
+
const bindings = [];
|
|
53
|
+
const claimed = new Set();
|
|
54
|
+
for (const action of Object.keys(KEYBINDING_ACTIONS)) {
|
|
55
|
+
const key = keybindings[action] ?? DEFAULT_KEYBINDINGS[action];
|
|
56
|
+
const keyId = toPiTuiKeyId(key);
|
|
57
|
+
const sequence = TERMINAL_KEY_SEQUENCES[key];
|
|
58
|
+
if (!keyId || claimed.has(keyId)) continue;
|
|
59
|
+
claimed.add(keyId);
|
|
60
|
+
bindings.push({ action, keyId, sequence });
|
|
61
|
+
}
|
|
62
|
+
return bindings;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function findMatchingAction(data, bindings) {
|
|
66
|
+
for (const binding of bindings) {
|
|
67
|
+
if (binding.sequence && data === binding.sequence) return binding.action;
|
|
68
|
+
if (matchesKey(data, binding.keyId)) return binding.action;
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function toPiTuiKeyId(key) {
|
|
74
|
+
if (key === "Esc") return "escape";
|
|
75
|
+
return String(key).toLowerCase();
|
|
76
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
|
|
4
|
+
export const DEFAULT_KEYBINDINGS = Object.freeze({
|
|
5
|
+
abort: "Esc",
|
|
6
|
+
interrupt: "Ctrl+C",
|
|
7
|
+
toggleMode: "Tab",
|
|
8
|
+
cycleThinking: "Shift+Tab",
|
|
9
|
+
thinkingSelector: "Ctrl+T",
|
|
10
|
+
modelSelector: "Ctrl+L",
|
|
11
|
+
externalEditor: "Ctrl+G",
|
|
12
|
+
toggleToolOutput: "Ctrl+O",
|
|
13
|
+
toggleShellDrawer: "Alt+S",
|
|
14
|
+
nextShell: "Alt+N",
|
|
15
|
+
shellScrollUp: "Alt+K",
|
|
16
|
+
shellScrollDown: "Alt+J",
|
|
17
|
+
outputScrollUp: "PageUp",
|
|
18
|
+
outputScrollDown: "PageDown",
|
|
19
|
+
pasteImage: "Alt+V",
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const KEYBINDING_ACTIONS = Object.freeze({
|
|
23
|
+
abort: "Abort current turn; cancel retry wait",
|
|
24
|
+
interrupt: "Abort current turn; press twice to exit when idle",
|
|
25
|
+
toggleMode: "Toggle Do/Discuss mode",
|
|
26
|
+
cycleThinking: "Open thinking selector",
|
|
27
|
+
thinkingSelector: "Open thinking selector",
|
|
28
|
+
modelSelector: "Open model selector",
|
|
29
|
+
externalEditor: "Open external editor ($VISUAL or $EDITOR)",
|
|
30
|
+
toggleToolOutput: "Toggle tool output collapsed/expanded",
|
|
31
|
+
toggleShellDrawer: "Toggle right-side shell pane",
|
|
32
|
+
nextShell: "Select next shell in pane",
|
|
33
|
+
shellScrollUp: "Scroll shell pane up",
|
|
34
|
+
shellScrollDown: "Scroll shell pane down",
|
|
35
|
+
outputScrollUp: "Scroll output buffer up",
|
|
36
|
+
outputScrollDown: "Scroll output buffer down",
|
|
37
|
+
pasteImage: "Paste clipboard image as attachment",
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export function loadKeybindings(cwd) {
|
|
41
|
+
return loadKeybindingsFromPath(resolve(cwd, ".march", "keybindings.json"));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function loadKeybindingsFromPath(path) {
|
|
45
|
+
if (!existsSync(path)) {
|
|
46
|
+
return { keybindings: { ...DEFAULT_KEYBINDINGS }, diagnostics: [] };
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
50
|
+
return normalizeKeybindings(parsed, path);
|
|
51
|
+
} catch (err) {
|
|
52
|
+
return {
|
|
53
|
+
keybindings: { ...DEFAULT_KEYBINDINGS },
|
|
54
|
+
diagnostics: [{ type: "warning", message: `Failed to load keybindings.json: ${err.message}`, path }],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function normalizeKeybindings(parsed, path = "keybindings.json") {
|
|
60
|
+
const diagnostics = [];
|
|
61
|
+
const keybindings = { ...DEFAULT_KEYBINDINGS };
|
|
62
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
63
|
+
return {
|
|
64
|
+
keybindings,
|
|
65
|
+
diagnostics: [{ type: "warning", message: "keybindings.json must be an object", path }],
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
for (const [action, key] of Object.entries(parsed)) {
|
|
70
|
+
if (!Object.hasOwn(KEYBINDING_ACTIONS, action)) {
|
|
71
|
+
diagnostics.push({ type: "warning", message: `Unknown keybinding action: ${action}`, path });
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
if (!isSupportedKey(key)) {
|
|
75
|
+
diagnostics.push({ type: "warning", message: `Unsupported keybinding for ${action}: ${String(key)}`, path });
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
keybindings[action] = key;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return { keybindings, diagnostics };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function formatKeybindingLines(keybindings = DEFAULT_KEYBINDINGS) {
|
|
85
|
+
return Object.entries(KEYBINDING_ACTIONS).map(([action, description]) =>
|
|
86
|
+
` ${padKey(keybindings[action] ?? DEFAULT_KEYBINDINGS[action])} ${description}`
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function isSupportedKey(key) {
|
|
91
|
+
return typeof key === "string" && /^(Esc|Tab|Shift\+Tab|Ctrl\+[A-Z]|Alt\+[A-Z]|PageUp|PageDown)$/.test(key);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function padKey(key) {
|
|
95
|
+
return key.padEnd(10, " ");
|
|
96
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export const MODES = Object.freeze({
|
|
2
|
+
DO: "do",
|
|
3
|
+
DISCUSS: "discuss",
|
|
4
|
+
});
|
|
5
|
+
|
|
6
|
+
export function createModeState({ initial = MODES.DO } = {}) {
|
|
7
|
+
let mode = normalizeMode(initial);
|
|
8
|
+
return {
|
|
9
|
+
get: () => mode,
|
|
10
|
+
toggle() {
|
|
11
|
+
mode = mode === MODES.DO ? MODES.DISCUSS : MODES.DO;
|
|
12
|
+
return mode;
|
|
13
|
+
},
|
|
14
|
+
set(nextMode) {
|
|
15
|
+
mode = normalizeMode(nextMode);
|
|
16
|
+
return mode;
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function appendModeReminder(prompt, mode = MODES.DO) {
|
|
22
|
+
return `${prompt}\n\n${formatModeReminder(mode)}`;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function formatModeLabel(mode = MODES.DO) {
|
|
26
|
+
return normalizeMode(mode) === MODES.DISCUSS ? "Discuss" : "Do";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function formatModeReminder(mode = MODES.DO) {
|
|
30
|
+
if (normalizeMode(mode) === MODES.DISCUSS) {
|
|
31
|
+
return "<mode>\n" +
|
|
32
|
+
"You are in discuss mode. Do not edit files, write files, apply patches, commit, or run commands that modify system state. " +
|
|
33
|
+
"You may inspect, analyze, ask clarifying questions, and propose a plan.\n" +
|
|
34
|
+
"</mode>";
|
|
35
|
+
}
|
|
36
|
+
return "<mode>\n" +
|
|
37
|
+
"You are in do mode. You may implement changes when the user asks for execution, following normal permissions and project rules.\n" +
|
|
38
|
+
"</mode>";
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function normalizeMode(mode) {
|
|
42
|
+
return mode === MODES.DISCUSS ? MODES.DISCUSS : MODES.DO;
|
|
43
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
2
|
+
import { basename, extname, join, resolve } from "node:path";
|
|
3
|
+
|
|
4
|
+
const TEMPLATE_EXTENSIONS = new Set([".md", ".txt"]);
|
|
5
|
+
const TEMPLATE_NAME_RE = /^[A-Za-z][A-Za-z0-9_-]*$/;
|
|
6
|
+
|
|
7
|
+
export function loadPromptTemplates(cwd) {
|
|
8
|
+
return loadPromptTemplatesFromDir(resolve(cwd, ".march", "templates"));
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function loadPromptTemplatesFromDir(dir) {
|
|
12
|
+
if (!existsSync(dir)) return { templates: [], diagnostics: [] };
|
|
13
|
+
|
|
14
|
+
const templates = [];
|
|
15
|
+
const diagnostics = [];
|
|
16
|
+
for (const entry of safeReadDir(dir, diagnostics)) {
|
|
17
|
+
if (!entry.isFile()) continue;
|
|
18
|
+
const ext = extname(entry.name);
|
|
19
|
+
if (!TEMPLATE_EXTENSIONS.has(ext)) continue;
|
|
20
|
+
const name = basename(entry.name, ext);
|
|
21
|
+
const path = join(dir, entry.name);
|
|
22
|
+
if (!TEMPLATE_NAME_RE.test(name)) {
|
|
23
|
+
diagnostics.push({ type: "warning", message: `Skipped invalid template name: ${entry.name}`, path });
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
templates.push({ name, path, body: readFileSync(path, "utf8") });
|
|
28
|
+
} catch (err) {
|
|
29
|
+
diagnostics.push({ type: "warning", message: `Failed to read template ${entry.name}: ${err.message}`, path });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
templates.sort((a, b) => a.name.localeCompare(b.name));
|
|
33
|
+
return { templates, diagnostics };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function expandPromptTemplate(input, templates = []) {
|
|
37
|
+
const match = input.match(/^\/([A-Za-z][A-Za-z0-9_-]*)(?:\s+([\s\S]*))?$/);
|
|
38
|
+
if (!match) return { type: "none" };
|
|
39
|
+
const template = templates.find((item) => item.name === match[1]);
|
|
40
|
+
if (!template) return { type: "none" };
|
|
41
|
+
const rawArgs = (match[2] || "").trim();
|
|
42
|
+
return {
|
|
43
|
+
type: "template",
|
|
44
|
+
name: template.name,
|
|
45
|
+
prompt: renderPromptTemplate(template.body, rawArgs),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function renderPromptTemplate(body, rawArgs = "") {
|
|
50
|
+
const args = splitTemplateArgs(rawArgs);
|
|
51
|
+
return body.replace(/\{\{\s*(args|input|\d+)\s*\}\}/g, (_match, token) => {
|
|
52
|
+
if (token === "args" || token === "input") return rawArgs;
|
|
53
|
+
return args[Number(token) - 1] ?? "";
|
|
54
|
+
}).trim();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function formatPromptTemplateLines(templates = [], diagnostics = []) {
|
|
58
|
+
const lines = ["Prompt templates:"];
|
|
59
|
+
if (templates.length === 0) {
|
|
60
|
+
lines.push(" (none)");
|
|
61
|
+
} else {
|
|
62
|
+
for (const template of templates) lines.push(` /${template.name}`);
|
|
63
|
+
}
|
|
64
|
+
if (diagnostics.length > 0) {
|
|
65
|
+
lines.push("Template diagnostics:");
|
|
66
|
+
for (const diagnostic of diagnostics) {
|
|
67
|
+
lines.push(` - ${diagnostic.type ?? "warning"}: ${diagnostic.message}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return lines;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function safeReadDir(dir, diagnostics) {
|
|
74
|
+
try {
|
|
75
|
+
return readdirSync(dir, { withFileTypes: true });
|
|
76
|
+
} catch (err) {
|
|
77
|
+
diagnostics.push({ type: "warning", message: `Failed to read templates directory: ${err.message}`, path: dir });
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function splitTemplateArgs(rawArgs) {
|
|
83
|
+
return rawArgs ? rawArgs.split(/\s+/).filter(Boolean) : [];
|
|
84
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { createInterface } from "node:readline";
|
|
2
|
+
|
|
3
|
+
export async function selectWithKeyboard({ input = process.stdin, output = process.stdout, message, items }) {
|
|
4
|
+
if (!items.length) return null;
|
|
5
|
+
if (!input.isTTY || !output.isTTY || typeof input.setRawMode !== "function") {
|
|
6
|
+
output.write(`${message}:\n`);
|
|
7
|
+
for (let i = 0; i < items.length; i++) output.write(` ${i + 1}. ${items[i].label}\n`);
|
|
8
|
+
const answer = await readLine({ input, output, prompt: `Select (1-${items.length}): ` });
|
|
9
|
+
const index = Number.parseInt(String(answer).trim(), 10) - 1;
|
|
10
|
+
return items[index]?.value ?? null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let selected = 0;
|
|
14
|
+
let renderedLines = 0;
|
|
15
|
+
const render = () => {
|
|
16
|
+
if (renderedLines > 0) output.write(`\x1b[${renderedLines}F`);
|
|
17
|
+
const lines = formatSelectionList({ message, items, selected });
|
|
18
|
+
for (const line of lines) output.write(`\x1b[2K\r${line}\n`);
|
|
19
|
+
renderedLines = lines.length;
|
|
20
|
+
};
|
|
21
|
+
return new Promise((resolve) => {
|
|
22
|
+
let finished = false;
|
|
23
|
+
const onData = (chunk) => {
|
|
24
|
+
const keys = chunk.toString("utf8").match(/\u001b\[[AB]|\r|\n|\u0003|\u001b/g) ?? [];
|
|
25
|
+
for (const key of keys) {
|
|
26
|
+
if (finished) return;
|
|
27
|
+
if (key === "\u0003" || key === "\u001b") finish(null);
|
|
28
|
+
else if (key === "\r" || key === "\n") finish(items[selected].value);
|
|
29
|
+
else if (key === "\u001b[A") { selected = (selected - 1 + items.length) % items.length; render(); }
|
|
30
|
+
else if (key === "\u001b[B") { selected = (selected + 1) % items.length; render(); }
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const finish = (value) => {
|
|
34
|
+
finished = true;
|
|
35
|
+
input.off("data", onData);
|
|
36
|
+
input.setRawMode(false);
|
|
37
|
+
input.pause();
|
|
38
|
+
if (renderedLines > 0) output.write(`\x1b[${renderedLines}F`);
|
|
39
|
+
const lines = formatSelectionList({ message, items, selected, done: value != null });
|
|
40
|
+
for (const line of lines) output.write(`\x1b[2K\r${line}\n`);
|
|
41
|
+
resolve(value);
|
|
42
|
+
};
|
|
43
|
+
input.setRawMode(true);
|
|
44
|
+
input.resume();
|
|
45
|
+
input.on("data", onData);
|
|
46
|
+
render();
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function formatSelectionList({ message, items, selected, done = false }) {
|
|
51
|
+
const hint = done ? "selected" : "↑/↓, Enter";
|
|
52
|
+
const lines = [`${message} (${hint})`];
|
|
53
|
+
for (let i = 0; i < items.length; i++) {
|
|
54
|
+
const marker = i === selected ? "›" : " ";
|
|
55
|
+
const label = `${marker} ${items[i].label}`;
|
|
56
|
+
lines.push(i === selected ? `\x1b[7m${label}\x1b[0m` : label);
|
|
57
|
+
}
|
|
58
|
+
return lines;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function readLine({ input = process.stdin, output = process.stdout, prompt }) {
|
|
62
|
+
const rl = createInterface({ input, output });
|
|
63
|
+
return new Promise((resolve) => rl.question(prompt, (answer) => {
|
|
64
|
+
rl.close();
|
|
65
|
+
resolve(answer);
|
|
66
|
+
}));
|
|
67
|
+
}
|