@travisennis/acai 0.0.12 → 0.0.13
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 +3 -2
- package/dist/agent/index.d.ts.map +1 -1
- package/dist/agent/index.js +2 -5
- package/dist/commands/history/types.d.ts +3 -2
- package/dist/commands/history/types.d.ts.map +1 -1
- package/dist/commands/init-project/utils.d.ts +0 -1
- package/dist/commands/init-project/utils.d.ts.map +1 -1
- package/dist/commands/init-project/utils.js +1 -1
- package/dist/commands/manager.d.ts.map +1 -1
- package/dist/commands/manager.js +0 -18
- package/dist/commands/share/html-renderer.d.ts.map +1 -1
- package/dist/commands/share/html-renderer.js +54 -48
- package/dist/commands/tools/index.js +39 -38
- package/dist/config/index.d.ts +0 -2
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +2 -6
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +94 -76
- package/dist/models/manager.d.ts +1 -10
- package/dist/models/manager.d.ts.map +1 -1
- package/dist/models/manager.js +2 -2
- package/dist/models/opencode-go-provider.d.ts +4 -4
- package/dist/models/opencode-go-provider.d.ts.map +1 -1
- package/dist/models/opencode-go-provider.js +29 -35
- package/dist/models/providers.d.ts +1 -1
- package/dist/models/providers.d.ts.map +1 -1
- package/dist/prompts/system-prompt.d.ts +0 -2
- package/dist/prompts/system-prompt.d.ts.map +1 -1
- package/dist/prompts/system-prompt.js +6 -10
- package/dist/repl/index.d.ts +27 -11
- package/dist/repl/index.d.ts.map +1 -1
- package/dist/repl/index.js +238 -254
- package/dist/skills/index.d.ts +12 -2
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +123 -73
- package/dist/terminal/control.d.ts +1 -21
- package/dist/terminal/control.d.ts.map +1 -1
- package/dist/terminal/control.js +1 -32
- package/dist/terminal/formatting.d.ts +0 -33
- package/dist/terminal/formatting.d.ts.map +1 -1
- package/dist/terminal/formatting.js +0 -91
- package/dist/terminal/highlight/theme.d.ts +0 -37
- package/dist/terminal/highlight/theme.d.ts.map +1 -1
- package/dist/terminal/highlight/theme.js +1 -79
- package/dist/terminal/keys.d.ts +0 -97
- package/dist/terminal/keys.d.ts.map +1 -1
- package/dist/terminal/keys.js +0 -194
- package/dist/terminal/select-prompt.d.ts.map +1 -1
- package/dist/terminal/select-prompt.js +65 -51
- package/dist/terminal/style.d.ts +1 -1
- package/dist/terminal/style.d.ts.map +1 -1
- package/dist/terminal/supports-color.d.ts.map +1 -1
- package/dist/terminal/supports-color.js +38 -20
- package/dist/terminal/supports-hyperlinks.d.ts +3 -0
- package/dist/terminal/supports-hyperlinks.d.ts.map +1 -1
- package/dist/terminal/supports-hyperlinks.js +72 -31
- package/dist/terminal/table/layout-manager.d.ts +0 -20
- package/dist/terminal/table/layout-manager.d.ts.map +1 -1
- package/dist/terminal/table/layout-manager.js +68 -44
- package/dist/terminal/table/utils.d.ts +0 -1
- package/dist/terminal/table/utils.d.ts.map +1 -1
- package/dist/terminal/table/utils.js +2 -4
- package/dist/tools/apply-patch.d.ts +5 -3
- package/dist/tools/apply-patch.d.ts.map +1 -1
- package/dist/tools/apply-patch.js +154 -123
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +11 -8
- package/dist/tools/dynamic-tool-loader.d.ts +6 -1
- package/dist/tools/dynamic-tool-loader.d.ts.map +1 -1
- package/dist/tools/dynamic-tool-loader.js +154 -135
- package/dist/tools/index.d.ts +3 -133
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +0 -20
- package/dist/tools/read-file.d.ts.map +1 -1
- package/dist/tools/read-file.js +32 -13
- package/dist/tools/skill.d.ts.map +1 -1
- package/dist/tools/skill.js +20 -13
- package/dist/tools/web-fetch.d.ts +2 -6
- package/dist/tools/web-fetch.d.ts.map +1 -1
- package/dist/tools/web-fetch.js +59 -36
- package/dist/tools/web-search.d.ts +0 -4
- package/dist/tools/web-search.d.ts.map +1 -1
- package/dist/tools/web-search.js +40 -32
- package/dist/tui/autocomplete/utils.d.ts +0 -15
- package/dist/tui/autocomplete/utils.d.ts.map +1 -1
- package/dist/tui/autocomplete/utils.js +0 -85
- package/dist/tui/autocomplete.d.ts +1 -1
- package/dist/tui/autocomplete.d.ts.map +1 -1
- package/dist/tui/autocomplete.js +1 -1
- package/dist/tui/components/editor.d.ts +12 -0
- package/dist/tui/components/editor.d.ts.map +1 -1
- package/dist/tui/components/editor.js +181 -195
- package/dist/tui/components/input.d.ts +4 -0
- package/dist/tui/components/input.d.ts.map +1 -1
- package/dist/tui/components/input.js +33 -31
- package/dist/tui/components/markdown.d.ts +30 -0
- package/dist/tui/components/markdown.d.ts.map +1 -1
- package/dist/tui/components/markdown.js +274 -242
- package/dist/tui/components/modal.d.ts.map +1 -1
- package/dist/tui/components/modal.js +11 -11
- package/dist/tui/components/select-list.d.ts +5 -0
- package/dist/tui/components/select-list.d.ts.map +1 -1
- package/dist/tui/components/select-list.js +69 -98
- package/dist/tui/components/table.d.ts +6 -0
- package/dist/tui/components/table.d.ts.map +1 -1
- package/dist/tui/components/table.js +61 -52
- package/dist/tui/index.d.ts +1 -8
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +0 -8
- package/dist/tui/tui.d.ts +9 -0
- package/dist/tui/tui.d.ts.map +1 -1
- package/dist/tui/tui.js +78 -48
- package/dist/tui/utils.d.ts +7 -0
- package/dist/tui/utils.d.ts.map +1 -1
- package/dist/tui/utils.js +117 -53
- package/dist/utils/bash.d.ts.map +1 -1
- package/dist/utils/bash.js +121 -104
- package/dist/utils/command-protection.d.ts +3 -2
- package/dist/utils/command-protection.d.ts.map +1 -1
- package/dist/utils/command-protection.js +42 -33
- package/dist/utils/filesystem/operations.d.ts +0 -15
- package/dist/utils/filesystem/operations.d.ts.map +1 -1
- package/dist/utils/filesystem/operations.js +1 -38
- package/dist/utils/filesystem/security.d.ts.map +1 -1
- package/dist/utils/filesystem/security.js +22 -15
- package/dist/utils/filetype-detection.d.ts +0 -1
- package/dist/utils/filetype-detection.d.ts.map +1 -1
- package/dist/utils/filetype-detection.js +0 -12
- package/dist/utils/formatting.d.ts +0 -30
- package/dist/utils/formatting.d.ts.map +1 -1
- package/dist/utils/formatting.js +0 -44
- package/dist/utils/git.d.ts +4 -6
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +36 -46
- package/dist/utils/ignore.d.ts +1 -1
- package/dist/utils/ignore.d.ts.map +1 -1
- package/dist/utils/ignore.js +1 -1
- package/dist/utils/process.d.ts.map +1 -1
- package/dist/utils/process.js +77 -79
- package/dist/utils/yaml.d.ts +0 -1
- package/dist/utils/yaml.d.ts.map +1 -1
- package/dist/utils/yaml.js +80 -89
- package/dist/utils/zod.d.ts +0 -3
- package/dist/utils/zod.d.ts.map +1 -1
- package/dist/utils/zod.js +0 -7
- package/package.json +25 -24
- package/dist/agent/sub-agent.d.ts +0 -23
- package/dist/agent/sub-agent.d.ts.map +0 -1
- package/dist/agent/sub-agent.js +0 -109
- package/dist/commands/add-directory/index.d.ts +0 -3
- package/dist/commands/add-directory/index.d.ts.map +0 -1
- package/dist/commands/add-directory/index.js +0 -50
- package/dist/commands/add-directory/utils.d.ts +0 -3
- package/dist/commands/add-directory/utils.d.ts.map +0 -1
- package/dist/commands/add-directory/utils.js +0 -15
- package/dist/commands/clear/index.d.ts +0 -3
- package/dist/commands/clear/index.d.ts.map +0 -1
- package/dist/commands/clear/index.js +0 -13
- package/dist/commands/generate-rules/index.d.ts +0 -3
- package/dist/commands/generate-rules/index.d.ts.map +0 -1
- package/dist/commands/generate-rules/index.js +0 -206
- package/dist/commands/generate-rules/service.d.ts +0 -22
- package/dist/commands/generate-rules/service.d.ts.map +0 -1
- package/dist/commands/generate-rules/service.js +0 -103
- package/dist/commands/generate-rules/utils.d.ts +0 -5
- package/dist/commands/generate-rules/utils.d.ts.map +0 -1
- package/dist/commands/generate-rules/utils.js +0 -25
- package/dist/commands/handoff/index.d.ts +0 -3
- package/dist/commands/handoff/index.d.ts.map +0 -1
- package/dist/commands/handoff/index.js +0 -97
- package/dist/commands/handoff/utils.d.ts +0 -4
- package/dist/commands/handoff/utils.d.ts.map +0 -1
- package/dist/commands/handoff/utils.js +0 -123
- package/dist/commands/list-directories/index.d.ts +0 -3
- package/dist/commands/list-directories/index.d.ts.map +0 -1
- package/dist/commands/list-directories/index.js +0 -35
- package/dist/commands/pickup/index.d.ts +0 -3
- package/dist/commands/pickup/index.d.ts.map +0 -1
- package/dist/commands/pickup/index.js +0 -141
- package/dist/commands/pickup/types.d.ts +0 -6
- package/dist/commands/pickup/types.d.ts.map +0 -1
- package/dist/commands/pickup/types.js +0 -1
- package/dist/commands/pickup/utils.d.ts +0 -7
- package/dist/commands/pickup/utils.d.ts.map +0 -1
- package/dist/commands/pickup/utils.js +0 -56
- package/dist/commands/remove-directory/index.d.ts +0 -3
- package/dist/commands/remove-directory/index.d.ts.map +0 -1
- package/dist/commands/remove-directory/index.js +0 -55
- package/dist/commands/review/index.d.ts +0 -3
- package/dist/commands/review/index.d.ts.map +0 -1
- package/dist/commands/review/index.js +0 -12
- package/dist/commands/review/review-panel.d.ts +0 -3
- package/dist/commands/review/review-panel.d.ts.map +0 -1
- package/dist/commands/review/review-panel.js +0 -186
- package/dist/commands/review/utils.d.ts +0 -18
- package/dist/commands/review/utils.d.ts.map +0 -1
- package/dist/commands/review/utils.js +0 -146
- package/dist/commands/shell/index.d.ts +0 -3
- package/dist/commands/shell/index.d.ts.map +0 -1
- package/dist/commands/shell/index.js +0 -96
- package/dist/subagents/index.d.ts +0 -16
- package/dist/subagents/index.d.ts.map +0 -1
- package/dist/subagents/index.js +0 -231
- package/dist/terminal/index.d.ts +0 -9
- package/dist/terminal/index.d.ts.map +0 -1
- package/dist/terminal/index.js +0 -8
- package/dist/tools/agent.d.ts +0 -27
- package/dist/tools/agent.d.ts.map +0 -1
- package/dist/tools/agent.js +0 -81
- package/dist/tools/directory-tree.d.ts +0 -28
- package/dist/tools/directory-tree.d.ts.map +0 -1
- package/dist/tools/directory-tree.js +0 -154
- package/dist/tools/glob.d.ts +0 -35
- package/dist/tools/glob.d.ts.map +0 -1
- package/dist/tools/glob.js +0 -167
- package/dist/tools/grep.d.ts +0 -100
- package/dist/tools/grep.d.ts.map +0 -1
- package/dist/tools/grep.js +0 -608
- package/dist/tools/ls.d.ts +0 -26
- package/dist/tools/ls.d.ts.map +0 -1
- package/dist/tools/ls.js +0 -83
- package/dist/tui/components/header.d.ts +0 -21
- package/dist/tui/components/header.d.ts.map +0 -1
- package/dist/tui/components/header.js +0 -63
- package/dist/utils/bash/parse.d.ts +0 -19
- package/dist/utils/bash/parse.d.ts.map +0 -1
- package/dist/utils/bash/parse.js +0 -223
- package/dist/utils/bash/quote.d.ts +0 -6
- package/dist/utils/bash/quote.d.ts.map +0 -1
- package/dist/utils/bash/quote.js +0 -23
- package/dist/utils/generators.d.ts +0 -3
- package/dist/utils/generators.d.ts.map +0 -1
- package/dist/utils/generators.js +0 -25
- package/dist/utils/glob.d.ts +0 -52
- package/dist/utils/glob.d.ts.map +0 -1
- package/dist/utils/glob.js +0 -376
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { getTerminalSize, isArrowDown, isArrowUp, isEnter, isEscape, isShiftTab, isTab, } from "../../terminal/control.js";
|
|
2
|
-
import style from "../../terminal/style.js";
|
|
3
|
-
import { Input, Spacer, Text, Container as TuiContainer, } from "../../tui/index.js";
|
|
4
|
-
import { getAvailableHandoffFiles, hidePickupSelector, loadHandoff, } from "./utils.js";
|
|
5
|
-
export const pickupCommand = (options) => {
|
|
6
|
-
return {
|
|
7
|
-
command: "/pickup",
|
|
8
|
-
description: "Loads a handoff file into a new session to continue previous work. Usage: /pickup",
|
|
9
|
-
getSubCommands: () => Promise.resolve([]),
|
|
10
|
-
async handle(_args, { tui, container, inputContainer, editor, }) {
|
|
11
|
-
const handoffs = await getAvailableHandoffFiles();
|
|
12
|
-
if (handoffs.length === 0) {
|
|
13
|
-
container.addChild(new Text(style.yellow("No handoff files found."), 0, 1));
|
|
14
|
-
container.addChild(new Text("Create a handoff file first using /handoff <purpose>", 1, 0));
|
|
15
|
-
tui.requestRender();
|
|
16
|
-
editor.setText("");
|
|
17
|
-
return "continue";
|
|
18
|
-
}
|
|
19
|
-
const handoffSelector = new HandoffSelectorComponent(handoffs, async (handoff) => {
|
|
20
|
-
await loadHandoff(handoff, options, container, tui, editor);
|
|
21
|
-
hidePickupSelector(inputContainer, editor, tui);
|
|
22
|
-
}, () => {
|
|
23
|
-
hidePickupSelector(inputContainer, editor, tui);
|
|
24
|
-
});
|
|
25
|
-
inputContainer.clear();
|
|
26
|
-
inputContainer.addChild(handoffSelector);
|
|
27
|
-
tui.setFocus(handoffSelector);
|
|
28
|
-
tui.requestRender();
|
|
29
|
-
return "continue";
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
class HandoffSelectorComponent extends TuiContainer {
|
|
34
|
-
searchInput;
|
|
35
|
-
listContainer;
|
|
36
|
-
allHandoffs = [];
|
|
37
|
-
filteredHandoffs = [];
|
|
38
|
-
selectedIndex = 0;
|
|
39
|
-
onSelectCallback;
|
|
40
|
-
onCancelCallback;
|
|
41
|
-
constructor(handoffs, onSelect, onCancel) {
|
|
42
|
-
super();
|
|
43
|
-
this.onSelectCallback = onSelect;
|
|
44
|
-
this.onCancelCallback = onCancel;
|
|
45
|
-
this.allHandoffs = handoffs;
|
|
46
|
-
this.filteredHandoffs = handoffs;
|
|
47
|
-
const { columns } = getTerminalSize();
|
|
48
|
-
this.addChild(new Text(style.blue("─".repeat(columns)), 0, 0));
|
|
49
|
-
this.addChild(new Spacer(1));
|
|
50
|
-
this.searchInput = new Input();
|
|
51
|
-
this.searchInput.onSubmit = () => {
|
|
52
|
-
const handoff = this.filteredHandoffs[this.selectedIndex];
|
|
53
|
-
if (handoff !== undefined) {
|
|
54
|
-
this.handleSelect(handoff);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
this.addChild(this.searchInput);
|
|
58
|
-
this.addChild(new Spacer(1));
|
|
59
|
-
this.listContainer = new TuiContainer();
|
|
60
|
-
this.addChild(this.listContainer);
|
|
61
|
-
this.addChild(new Spacer(1));
|
|
62
|
-
this.addChild(new Text(style.blue("─".repeat(columns)), 0, 0));
|
|
63
|
-
this.updateList();
|
|
64
|
-
}
|
|
65
|
-
filterHandoffs(query) {
|
|
66
|
-
if (!query.trim()) {
|
|
67
|
-
this.filteredHandoffs = this.allHandoffs;
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
const searchTokens = query
|
|
71
|
-
.toLowerCase()
|
|
72
|
-
.split(/\s+/)
|
|
73
|
-
.filter((t) => t);
|
|
74
|
-
this.filteredHandoffs = this.allHandoffs.filter((handoff) => {
|
|
75
|
-
const searchText = handoff.name.toLowerCase();
|
|
76
|
-
return searchTokens.every((token) => searchText.includes(token));
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
this.selectedIndex = Math.min(this.selectedIndex, Math.max(0, this.filteredHandoffs.length - 1));
|
|
80
|
-
this.updateList();
|
|
81
|
-
}
|
|
82
|
-
updateList() {
|
|
83
|
-
this.listContainer.clear();
|
|
84
|
-
const maxVisible = 10;
|
|
85
|
-
const startIndex = Math.max(0, Math.min(this.selectedIndex - Math.floor(maxVisible / 2), this.filteredHandoffs.length - maxVisible));
|
|
86
|
-
const endIndex = Math.min(startIndex + maxVisible, this.filteredHandoffs.length);
|
|
87
|
-
for (let i = startIndex; i < endIndex; i++) {
|
|
88
|
-
const handoff = this.filteredHandoffs[i];
|
|
89
|
-
if (handoff === undefined)
|
|
90
|
-
continue;
|
|
91
|
-
const isSelected = i === this.selectedIndex;
|
|
92
|
-
let line = "";
|
|
93
|
-
if (isSelected) {
|
|
94
|
-
const prefix = style.blue("→ ");
|
|
95
|
-
const date = handoff.createdAt.toLocaleString();
|
|
96
|
-
line = `${prefix + style.blue(handoff.name)} ${style.gray(`(${date})`)}`;
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
const date = handoff.createdAt.toLocaleString();
|
|
100
|
-
line = ` ${handoff.name} ${style.gray(`(${date})`)}`;
|
|
101
|
-
}
|
|
102
|
-
this.listContainer.addChild(new Text(line, 0, 0));
|
|
103
|
-
}
|
|
104
|
-
if (startIndex > 0 || endIndex < this.filteredHandoffs.length) {
|
|
105
|
-
const scrollInfo = style.gray(` (${this.selectedIndex + 1}/${this.filteredHandoffs.length})`);
|
|
106
|
-
this.listContainer.addChild(new Text(scrollInfo, 0, 0));
|
|
107
|
-
}
|
|
108
|
-
if (this.filteredHandoffs.length === 0) {
|
|
109
|
-
this.listContainer.addChild(new Text(style.gray(" No matching handoffs"), 0, 0));
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
wantsNavigationKeys() {
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
handleInput(keyData) {
|
|
116
|
-
if (isArrowUp(keyData) || isShiftTab(keyData)) {
|
|
117
|
-
this.selectedIndex = Math.max(0, this.selectedIndex - 1);
|
|
118
|
-
this.updateList();
|
|
119
|
-
}
|
|
120
|
-
else if (isArrowDown(keyData) || isTab(keyData)) {
|
|
121
|
-
this.selectedIndex = Math.min(this.filteredHandoffs.length - 1, this.selectedIndex + 1);
|
|
122
|
-
this.updateList();
|
|
123
|
-
}
|
|
124
|
-
else if (isEnter(keyData)) {
|
|
125
|
-
const selectedHandoff = this.filteredHandoffs[this.selectedIndex];
|
|
126
|
-
if (selectedHandoff !== undefined) {
|
|
127
|
-
this.handleSelect(selectedHandoff);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
else if (isEscape(keyData)) {
|
|
131
|
-
this.onCancelCallback();
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
this.searchInput.handleInput(keyData);
|
|
135
|
-
this.filterHandoffs(this.searchInput.getValue());
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
handleSelect(handoff) {
|
|
139
|
-
this.onSelectCallback(handoff);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../source/commands/pickup/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,IAAI,CAAC;CACjB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Container, Editor, TUI } from "../../tui/index.ts";
|
|
2
|
-
import type { CommandOptions } from "../types.ts";
|
|
3
|
-
import type { HandoffFile } from "./types.ts";
|
|
4
|
-
export declare function hidePickupSelector(editorContainer: Container, editor: Editor, tui: TUI): void;
|
|
5
|
-
export declare function getAvailableHandoffFiles(): Promise<HandoffFile[]>;
|
|
6
|
-
export declare function loadHandoff(handoff: HandoffFile, options: CommandOptions, container: Container, tui: TUI, editor: Editor): Promise<void>;
|
|
7
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../source/commands/pickup/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,wBAAgB,kBAAkB,CAChC,eAAe,EAAE,SAAS,EAC1B,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,GAAG,GACP,IAAI,CAIN;AAED,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CA4BvE;AAED,wBAAsB,WAAW,CAC/B,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CA8Cf"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
-
import { basename } from "node:path";
|
|
3
|
-
import { createUserMessage } from "../../sessions/manager.js";
|
|
4
|
-
export function hidePickupSelector(editorContainer, editor, tui) {
|
|
5
|
-
editorContainer.clear();
|
|
6
|
-
editorContainer.addChild(editor);
|
|
7
|
-
tui.setFocus(editor);
|
|
8
|
-
}
|
|
9
|
-
export async function getAvailableHandoffFiles() {
|
|
10
|
-
const handoffsDir = ".acai/handoffs";
|
|
11
|
-
try {
|
|
12
|
-
const { readdir, stat } = await import("node:fs/promises");
|
|
13
|
-
const dirents = await readdir(handoffsDir, {
|
|
14
|
-
withFileTypes: true,
|
|
15
|
-
});
|
|
16
|
-
const files = [];
|
|
17
|
-
for (const dirent of dirents) {
|
|
18
|
-
if (dirent.isFile() && dirent.name.match(/^handoff-.*\.md$/)) {
|
|
19
|
-
const filepath = `${handoffsDir}/${dirent.name}`;
|
|
20
|
-
const stats = await stat(filepath);
|
|
21
|
-
files.push({
|
|
22
|
-
name: basename(dirent.name, ".md"),
|
|
23
|
-
filename: dirent.name,
|
|
24
|
-
createdAt: stats.mtime,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
files.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
|
|
29
|
-
return files;
|
|
30
|
-
}
|
|
31
|
-
catch (error) {
|
|
32
|
-
if (error.code === "ENOENT") {
|
|
33
|
-
return [];
|
|
34
|
-
}
|
|
35
|
-
return [];
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
export async function loadHandoff(handoff, options, container, tui, editor) {
|
|
39
|
-
const { sessionManager, modelManager } = options;
|
|
40
|
-
const filepath = `.acai/handoffs/${handoff.filename}`;
|
|
41
|
-
try {
|
|
42
|
-
const handoffContent = await readFile(filepath, "utf8");
|
|
43
|
-
container.addChild(new (await import("../../tui/index.js")).Text(`Loading handoff: ${(await import("../../terminal/style.js")).default.blue(handoff.name)}`, 0, 1));
|
|
44
|
-
sessionManager.create(modelManager.getModel("repl").modelId);
|
|
45
|
-
sessionManager.appendUserMessage(createUserMessage([], handoffContent));
|
|
46
|
-
container.addChild(new (await import("../../tui/index.js")).Text("Handoff loaded successfully.", 1, 0));
|
|
47
|
-
container.addChild(new (await import("../../tui/index.js")).Text("You can now continue with your previous work.", 2, 0));
|
|
48
|
-
tui.requestRender();
|
|
49
|
-
editor.setText("");
|
|
50
|
-
}
|
|
51
|
-
catch (error) {
|
|
52
|
-
container.addChild(new (await import("../../tui/index.js")).Text(`Error loading handoff: ${error}`, 0, 1));
|
|
53
|
-
tui.requestRender();
|
|
54
|
-
editor.setText("");
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/remove-directory/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/D,eAAO,MAAM,sBAAsB,GAAI,gBAEpC,cAAc,KAAG,WAkGnB,CAAC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import style from "../../terminal/style.js";
|
|
3
|
-
import { Text } from "../../tui/index.js";
|
|
4
|
-
export const removeDirectoryCommand = ({ workspace, }) => {
|
|
5
|
-
return {
|
|
6
|
-
command: "/remove-directory",
|
|
7
|
-
description: "Remove a directory from the list of allowed working directories",
|
|
8
|
-
getSubCommands: async () => {
|
|
9
|
-
// Return only non-primary directories for tab completion
|
|
10
|
-
return workspace.allowedDirs.filter((dir) => dir !== workspace.primaryDir);
|
|
11
|
-
},
|
|
12
|
-
async handle(args, { tui, container, editor, }) {
|
|
13
|
-
const directoryPath = args?.[0];
|
|
14
|
-
if (!directoryPath) {
|
|
15
|
-
container.addChild(new Text(style.red("Usage: /remove-directory <path>"), 0, 1));
|
|
16
|
-
tui.requestRender();
|
|
17
|
-
editor.setText("");
|
|
18
|
-
return "continue";
|
|
19
|
-
}
|
|
20
|
-
try {
|
|
21
|
-
// Resolve the directory path
|
|
22
|
-
const resolvedPath = path.resolve(directoryPath);
|
|
23
|
-
// Check if it's the primary directory
|
|
24
|
-
if (resolvedPath === workspace.primaryDir) {
|
|
25
|
-
container.addChild(new Text(style.red("Cannot remove the primary working directory"), 1, 0));
|
|
26
|
-
tui.requestRender();
|
|
27
|
-
editor.setText("");
|
|
28
|
-
return "continue";
|
|
29
|
-
}
|
|
30
|
-
// Find the directory in the list
|
|
31
|
-
const index = workspace.allowedDirs.indexOf(resolvedPath);
|
|
32
|
-
if (index === -1) {
|
|
33
|
-
container.addChild(new Text(style.red(`Directory not found in allowed list: ${resolvedPath}`), 1, 0));
|
|
34
|
-
tui.requestRender();
|
|
35
|
-
editor.setText("");
|
|
36
|
-
return "continue";
|
|
37
|
-
}
|
|
38
|
-
// Remove the directory
|
|
39
|
-
workspace.allowedDirs.splice(index, 1);
|
|
40
|
-
container.addChild(new Text(`Removed directory from allowed list: ${style.blue(resolvedPath)}`, 1, 0));
|
|
41
|
-
container.addChild(new Text(`Current allowed directories: ${style.blue(workspace.allowedDirs.join(", "))}`, 2, 0));
|
|
42
|
-
tui.requestRender();
|
|
43
|
-
editor.setText("");
|
|
44
|
-
return "continue";
|
|
45
|
-
}
|
|
46
|
-
catch (error) {
|
|
47
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
48
|
-
container.addChild(new Text(style.red(`Failed to remove directory: ${errorMessage}`), 1, 0));
|
|
49
|
-
tui.requestRender();
|
|
50
|
-
editor.setText("");
|
|
51
|
-
return "continue";
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/commands/review/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/D,eAAO,MAAM,aAAa,GAAI,UAAU,cAAc,KAAG,WAuBxD,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { showReviewPanel } from "./review-panel.js";
|
|
2
|
-
export const reviewCommand = (_options) => {
|
|
3
|
-
return {
|
|
4
|
-
command: "/review",
|
|
5
|
-
description: "Shows a diff of all changes in the current directory.",
|
|
6
|
-
getSubCommands: () => Promise.resolve([]),
|
|
7
|
-
async handle(_args, { tui, container, editor, inputContainer, }) {
|
|
8
|
-
await showReviewPanel(tui, container, inputContainer, editor);
|
|
9
|
-
return "continue";
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"review-panel.d.ts","sourceRoot":"","sources":["../../../source/commands/review/review-panel.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,SAAS,EACT,KAAK,MAAM,EAGX,KAAK,GAAG,EACT,MAAM,oBAAoB,CAAC;AAQ5B,wBAAsB,eAAe,CACnC,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,SAAS,EACzB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CA8Of"}
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { join } from "node:path";
|
|
2
|
-
import { initExecutionEnvironment } from "../../execution/index.js";
|
|
3
|
-
import { getTerminalSize } from "../../terminal/control.js";
|
|
4
|
-
import style from "../../terminal/style.js";
|
|
5
|
-
import { Markdown } from "../../tui/components/markdown.js";
|
|
6
|
-
import { Spacer } from "../../tui/components/spacer.js";
|
|
7
|
-
import { Container, SelectList, Text, } from "../../tui/index.js";
|
|
8
|
-
import { formatFileDiffForDisplay, getUntrackedFiles, openFileInEditor, parseGitDiffFiles, } from "./utils.js";
|
|
9
|
-
export async function showReviewPanel(tui, container, inputContainer, editor) {
|
|
10
|
-
try {
|
|
11
|
-
const execEnv = await initExecutionEnvironment();
|
|
12
|
-
const stagedResult = await execEnv.executeCommand("git diff --cached", {
|
|
13
|
-
cwd: process.cwd(),
|
|
14
|
-
timeout: 5000,
|
|
15
|
-
preserveOutputOnError: true,
|
|
16
|
-
captureStderr: true,
|
|
17
|
-
throwOnError: false,
|
|
18
|
-
});
|
|
19
|
-
const unstagedResult = await execEnv.executeCommand("git diff", {
|
|
20
|
-
cwd: process.cwd(),
|
|
21
|
-
timeout: 5000,
|
|
22
|
-
preserveOutputOnError: true,
|
|
23
|
-
captureStderr: true,
|
|
24
|
-
throwOnError: false,
|
|
25
|
-
});
|
|
26
|
-
const untrackedResult = await execEnv.executeCommand("git ls-files --others --exclude-standard", {
|
|
27
|
-
cwd: process.cwd(),
|
|
28
|
-
timeout: 5000,
|
|
29
|
-
preserveOutputOnError: true,
|
|
30
|
-
captureStderr: true,
|
|
31
|
-
throwOnError: false,
|
|
32
|
-
});
|
|
33
|
-
const stagedOutput = stagedResult.exitCode === 0 ? stagedResult.output : "";
|
|
34
|
-
const unstagedOutput = unstagedResult.exitCode === 0 ? unstagedResult.output : "";
|
|
35
|
-
const untrackedOutput = untrackedResult.exitCode === 0 ? untrackedResult.output : "";
|
|
36
|
-
const combinedOutput = stagedOutput +
|
|
37
|
-
(stagedOutput && unstagedOutput ? "\n" : "") +
|
|
38
|
-
unstagedOutput;
|
|
39
|
-
if (!combinedOutput.trim()) {
|
|
40
|
-
container.addChild(new Spacer(1));
|
|
41
|
-
container.addChild(new Markdown("No changes detected in the current directory.", {
|
|
42
|
-
customBgRgb: {
|
|
43
|
-
r: 52,
|
|
44
|
-
g: 53,
|
|
45
|
-
b: 65,
|
|
46
|
-
},
|
|
47
|
-
paddingX: 1,
|
|
48
|
-
paddingY: 1,
|
|
49
|
-
}));
|
|
50
|
-
tui.requestRender();
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
const fileChanges = parseGitDiffFiles(combinedOutput);
|
|
54
|
-
const untrackedFiles = await getUntrackedFiles(untrackedOutput, process.cwd());
|
|
55
|
-
fileChanges.push(...untrackedFiles);
|
|
56
|
-
if (fileChanges.length === 0) {
|
|
57
|
-
container.addChild(new Spacer(1));
|
|
58
|
-
container.addChild(new Markdown("No file changes could be parsed.", {
|
|
59
|
-
customBgRgb: {
|
|
60
|
-
r: 52,
|
|
61
|
-
g: 53,
|
|
62
|
-
b: 65,
|
|
63
|
-
},
|
|
64
|
-
paddingX: 1,
|
|
65
|
-
paddingY: 1,
|
|
66
|
-
}));
|
|
67
|
-
tui.requestRender();
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
const selectItems = fileChanges.map((file) => ({
|
|
71
|
-
value: file.fileName,
|
|
72
|
-
label: file.fileName,
|
|
73
|
-
description: file.stats,
|
|
74
|
-
}));
|
|
75
|
-
const selectList = new SelectList(selectItems, 10);
|
|
76
|
-
const selectContainer = new Container();
|
|
77
|
-
const { columns } = getTerminalSize();
|
|
78
|
-
selectContainer.addChild(new Text(style.blue("─".repeat(columns)), 0, 0));
|
|
79
|
-
selectContainer.addChild(new Spacer(1));
|
|
80
|
-
selectContainer.addChild(selectList);
|
|
81
|
-
selectContainer.addChild(new Spacer(1));
|
|
82
|
-
selectContainer.addChild(new Text(style.blue("─".repeat(columns)), 0, 0));
|
|
83
|
-
const originalEditor = editor;
|
|
84
|
-
inputContainer.clear();
|
|
85
|
-
inputContainer.addChild(selectContainer);
|
|
86
|
-
tui.setFocus(selectList);
|
|
87
|
-
selectList.onSelect = (selectedItem) => {
|
|
88
|
-
const selectedFile = fileChanges.find((file) => file.fileName === selectedItem.value);
|
|
89
|
-
if (!selectedFile) {
|
|
90
|
-
container.addChild(new Spacer(1));
|
|
91
|
-
container.addChild(new Markdown(style.red("Error: Selected file not found."), {
|
|
92
|
-
customBgRgb: {
|
|
93
|
-
r: 52,
|
|
94
|
-
g: 53,
|
|
95
|
-
b: 65,
|
|
96
|
-
},
|
|
97
|
-
paddingX: 1,
|
|
98
|
-
paddingY: 1,
|
|
99
|
-
}));
|
|
100
|
-
tui.requestRender();
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
const actionItems = [
|
|
104
|
-
{ value: "diff", label: "View diff", description: "Show changes" },
|
|
105
|
-
{
|
|
106
|
-
value: "edit",
|
|
107
|
-
label: "Open in editor",
|
|
108
|
-
description: `Open in ${process.env["EDITOR"] || process.env["VISUAL"] || "vi"}`,
|
|
109
|
-
},
|
|
110
|
-
];
|
|
111
|
-
const actionSelectList = new SelectList(actionItems, 5);
|
|
112
|
-
const actionContainer = new Container();
|
|
113
|
-
actionContainer.addChild(new Spacer(1));
|
|
114
|
-
actionContainer.addChild(new Text(style.blue(`Selected: ${selectedFile.fileName}`), 0, 0));
|
|
115
|
-
actionContainer.addChild(new Spacer(1));
|
|
116
|
-
actionContainer.addChild(actionSelectList);
|
|
117
|
-
actionContainer.addChild(new Spacer(1));
|
|
118
|
-
actionContainer.addChild(new Text(style.blue("─".repeat(columns)), 0, 0));
|
|
119
|
-
inputContainer.clear();
|
|
120
|
-
inputContainer.addChild(actionContainer);
|
|
121
|
-
tui.setFocus(actionSelectList);
|
|
122
|
-
tui.requestRender();
|
|
123
|
-
actionSelectList.onSelect = (actionItem) => {
|
|
124
|
-
if (actionItem.value === "diff") {
|
|
125
|
-
container.addChild(new Spacer(1));
|
|
126
|
-
container.addChild(new Markdown(formatFileDiffForDisplay(selectedFile.fileName, selectedFile.diff), {
|
|
127
|
-
customBgRgb: {
|
|
128
|
-
r: 52,
|
|
129
|
-
g: 53,
|
|
130
|
-
b: 65,
|
|
131
|
-
},
|
|
132
|
-
paddingX: 1,
|
|
133
|
-
paddingY: 1,
|
|
134
|
-
}));
|
|
135
|
-
}
|
|
136
|
-
else if (actionItem.value === "edit") {
|
|
137
|
-
const filePath = join(process.cwd(), selectedFile.fileName);
|
|
138
|
-
const result = openFileInEditor(filePath, tui.getTerminal());
|
|
139
|
-
if (!result.success) {
|
|
140
|
-
container.addChild(new Spacer(1));
|
|
141
|
-
container.addChild(new Markdown(`Failed to open file in editor: ${result.error || "Unknown error"}`, {
|
|
142
|
-
customBgRgb: {
|
|
143
|
-
r: 52,
|
|
144
|
-
g: 53,
|
|
145
|
-
b: 65,
|
|
146
|
-
},
|
|
147
|
-
paddingX: 1,
|
|
148
|
-
paddingY: 1,
|
|
149
|
-
}));
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
inputContainer.clear();
|
|
153
|
-
inputContainer.addChild(originalEditor);
|
|
154
|
-
tui.setFocus(originalEditor);
|
|
155
|
-
tui.requestRender();
|
|
156
|
-
};
|
|
157
|
-
actionSelectList.onCancel = () => {
|
|
158
|
-
inputContainer.clear();
|
|
159
|
-
inputContainer.addChild(selectContainer);
|
|
160
|
-
tui.setFocus(selectList);
|
|
161
|
-
tui.requestRender();
|
|
162
|
-
};
|
|
163
|
-
};
|
|
164
|
-
selectList.onCancel = () => {
|
|
165
|
-
inputContainer.clear();
|
|
166
|
-
inputContainer.addChild(originalEditor);
|
|
167
|
-
tui.setFocus(originalEditor);
|
|
168
|
-
tui.requestRender();
|
|
169
|
-
};
|
|
170
|
-
tui.requestRender();
|
|
171
|
-
}
|
|
172
|
-
catch (error) {
|
|
173
|
-
console.error("Error executing git diff:", error);
|
|
174
|
-
container.addChild(new Spacer(1));
|
|
175
|
-
container.addChild(new Markdown("Failed to retrieve git changes. Ensure git is installed and initialized.", {
|
|
176
|
-
customBgRgb: {
|
|
177
|
-
r: 52,
|
|
178
|
-
g: 53,
|
|
179
|
-
b: 65,
|
|
180
|
-
},
|
|
181
|
-
paddingX: 1,
|
|
182
|
-
paddingY: 1,
|
|
183
|
-
}));
|
|
184
|
-
tui.requestRender();
|
|
185
|
-
}
|
|
186
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Terminal } from "../../tui/terminal.ts";
|
|
2
|
-
interface FileChange {
|
|
3
|
-
fileName: string;
|
|
4
|
-
diff: string;
|
|
5
|
-
stats: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function parseGitDiffFiles(diffOutput: string): FileChange[];
|
|
8
|
-
export declare function formatFileDiffForDisplay(fileName: string, diff: string): string;
|
|
9
|
-
export declare function getUntrackedFiles(untrackedOutput: string, cwd: string): Promise<FileChange[]>;
|
|
10
|
-
/**
|
|
11
|
-
* Open a file in the user's preferred editor ($EDITOR or $VISUAL)
|
|
12
|
-
*/
|
|
13
|
-
export declare function openFileInEditor(filePath: string, terminal: Terminal): {
|
|
14
|
-
success: boolean;
|
|
15
|
-
error?: string;
|
|
16
|
-
};
|
|
17
|
-
export {};
|
|
18
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../source/commands/review/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,UAAU,UAAU;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AA6CD,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,EAAE,CAwBlE;AAgBD,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GACX,MAAM,CAaR;AAED,wBAAsB,iBAAiB,CACrC,eAAe,EAAE,MAAM,EACvB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,UAAU,EAAE,CAAC,CAsCvB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,GACjB;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAyBtC"}
|