@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
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ Acai is an AI-driven command-line tool that assists software developers with cod
|
|
|
19
19
|
|
|
20
20
|
## Prerequisites
|
|
21
21
|
|
|
22
|
-
- Node.js
|
|
22
|
+
- Node.js 24 or higher
|
|
23
23
|
- Git
|
|
24
24
|
- [Ripgrep](https://github.com/BurntSushi/ripgrep) (`rg`) - Fast file content searching
|
|
25
25
|
- [GitHub CLI](https://cli.github.com/) (`gh`) - Git operations and repository management
|
|
@@ -75,13 +75,14 @@ Reference files directly with `@filename`, directories with `@dirname`, or run s
|
|
|
75
75
|
- **Pino** for structured logging
|
|
76
76
|
- **Zod** for schema validation
|
|
77
77
|
- **Biome** for formatting and linting
|
|
78
|
+
- **Fallow** for dead code, duplication, and complexity analysis
|
|
78
79
|
|
|
79
80
|
## Project Structure
|
|
80
81
|
|
|
81
82
|
```
|
|
82
83
|
.
|
|
83
84
|
├── source/ # Main application source code
|
|
84
|
-
│ ├── agent/ # Agent loop
|
|
85
|
+
│ ├── agent/ # Agent loop
|
|
85
86
|
│ ├── cli.ts # CLI entry point
|
|
86
87
|
│ ├── commands/ # REPL command implementations
|
|
87
88
|
│ ├── execution/ # Command execution utilities
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/agent/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EAEhB,MAAM,mBAAmB,CAAC;AAI3B,KAAK,YAAY,GAAG;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,YAAY,CAAC;IAC3B,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF,KAAK,UAAU,GAAG;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,eAAe,CAAC;IACvB,WAAW,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAClC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,SAAS,GACjB;IACE,IAAI,EAAE,iBAAiB,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,M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EAAE,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC;IAqQxD,KAAK;IAML,UAAU;IAmDV,OAAO,CAAC,iBAAiB;IA+FzB,OAAO,CAAC,gBAAgB;IAgDxB,OAAO,CAAC,gBAAgB;YA0BV,sBAAsB;IA4EpC,OAAO,CAAC,kBAAkB;YAuCZ,iBAAiB;IAoG/B,OAAO,CAAC,iBAAiB;CA6B1B"}
|
package/dist/agent/index.js
CHANGED
|
@@ -30,7 +30,7 @@ export class Agent {
|
|
|
30
30
|
const { systemPrompt, input, tools, activeTools, abortSignal } = args;
|
|
31
31
|
this.resetState();
|
|
32
32
|
this._state.timestamps.start = performance.now();
|
|
33
|
-
const { modelManager, sessionManager
|
|
33
|
+
const { modelManager, sessionManager } = this.opts;
|
|
34
34
|
const maxIterations = args.maxIterations ?? this.config.loop.maxIterations ?? 200;
|
|
35
35
|
const maxRetries = args.maxRetries ?? 2;
|
|
36
36
|
const langModel = modelManager.getModel("repl");
|
|
@@ -144,8 +144,6 @@ export class Agent {
|
|
|
144
144
|
// If finishReason is not tool-calls, break
|
|
145
145
|
const finishReason = await result.finishReason;
|
|
146
146
|
if (finishReason !== "tool-calls") {
|
|
147
|
-
// Track aggregate usage before yielding agent-stop so footer can display it
|
|
148
|
-
tokenTracker.trackUsage("repl", this._state.totalUsage);
|
|
149
147
|
yield {
|
|
150
148
|
type: "agent-stop",
|
|
151
149
|
};
|
|
@@ -225,8 +223,6 @@ export class Agent {
|
|
|
225
223
|
}
|
|
226
224
|
// Emit agent-stop if loop ended without emitting a terminal event (maxIterations reached)
|
|
227
225
|
if (!hasEmittedTerminalEvent) {
|
|
228
|
-
// Track aggregate usage before yielding agent-stop so footer can display it
|
|
229
|
-
tokenTracker.trackUsage("repl", this._state.totalUsage);
|
|
230
226
|
yield {
|
|
231
227
|
type: "agent-stop",
|
|
232
228
|
};
|
|
@@ -385,6 +381,7 @@ export class Agent {
|
|
|
385
381
|
this._state.totalUsage.cachedInputTokens += cacheReadTokens;
|
|
386
382
|
this._state.totalUsage.inputTokenDetails.cacheReadTokens += cacheReadTokens;
|
|
387
383
|
this._state.totalUsage.reasoningTokens += reasoningTokens;
|
|
384
|
+
this.opts.tokenTracker.trackUsage("repl", stepUsage);
|
|
388
385
|
sessionManager.recordTurnUsage({
|
|
389
386
|
inputTokens,
|
|
390
387
|
outputTokens,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ModelMessage } from "ai";
|
|
2
|
-
|
|
2
|
+
interface SessionTokenUsage {
|
|
3
3
|
total: {
|
|
4
4
|
inputTokens: number;
|
|
5
5
|
outputTokens: number;
|
|
@@ -17,7 +17,7 @@ export interface SessionTokenUsage {
|
|
|
17
17
|
estimatedCost: number;
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
interface TokenUsageTurn {
|
|
21
21
|
stepIndex: number;
|
|
22
22
|
inputTokens: number;
|
|
23
23
|
outputTokens: number;
|
|
@@ -46,4 +46,5 @@ export interface ConversationHistory {
|
|
|
46
46
|
project: string;
|
|
47
47
|
tokenUsage?: SessionTokenUsage | TokenUsageTurn[];
|
|
48
48
|
}
|
|
49
|
+
export {};
|
|
49
50
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../source/commands/history/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAGvC,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../source/commands/history/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAGvC,UAAU,iBAAiB;IACzB,KAAK,EAAE;QACL,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;QACpB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,eAAe,EAAE,MAAM,CAAC;QACxB,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,QAAQ,EAAE;QACR,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;QACpB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,eAAe,EAAE,MAAM,CAAC;QACxB,aAAa,EAAE,MAAM,CAAC;KACvB,CAAC;CACH;AAGD,UAAU,cAAc;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE;QACjB,aAAa,EAAE,MAAM,CAAC;QACtB,eAAe,EAAE,MAAM,CAAC;QACxB,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,kBAAkB,EAAE;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,iBAAiB,GAAG,cAAc,EAAE,CAAC;CACnD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../source/commands/init-project/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../source/commands/init-project/utils.ts"],"names":[],"mappings":"AAMA,UAAU,oBAAoB;IAC5B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,GACjB,oBAAoB,CAwBtB;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,oBAAoB,CAazE;AAED,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE3D"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { defaultConfig } from "../../config/index.js";
|
|
4
|
-
|
|
4
|
+
const DEVELOPMENT_DIRECTORY = "/Users/travisennis/Github/acai-ts";
|
|
5
5
|
export function ensureProjectDirectory(projectDir) {
|
|
6
6
|
const created = [];
|
|
7
7
|
const existing = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../source/commands/manager.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAEV,SAAS,EACT,MAAM,EACN,YAAY,EACZ,GAAG,EACJ,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../source/commands/manager.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAEV,SAAS,EACT,MAAM,EACN,YAAY,EACZ,GAAG,EACJ,MAAM,iBAAiB,CAAC;AAsBzB,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,YAAY,CAAC;AAE9D,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAA2B;IAC3C,OAAO,CAAC,aAAa,CAAmB;IACxC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,aAAa,CAAW;IAChC,OAAO,CAAC,SAAS,CAAmB;IACpC,OAAO,CAAC,WAAW,CAAU;gBAEjB,EACV,aAAa,EACb,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,aAAa,EACb,SAAS,GACV,EAAE,cAAc;IAaX,mBAAmB;YAkDX,qBAAqB;IA4EnC,OAAO,CAAC,iBAAiB;IAQnB,cAAc,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;IAuB/C,WAAW;IAKL,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAKlD,MAAM,CACV,EAAE,SAAS,EAAE,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,EACpC,OAAO,EAAE;QACP,GAAG,EAAE,GAAG,CAAC;QACT,SAAS,EAAE,SAAS,CAAC;QACrB,cAAc,EAAE,SAAS,CAAC;QAC1B,MAAM,EAAE,MAAM,CAAC;KAChB;;;CAsBJ"}
|
package/dist/commands/manager.js
CHANGED
|
@@ -7,27 +7,18 @@ import { Spacer, Text } from "../tui/index.js";
|
|
|
7
7
|
import { logger } from "../utils/logger.js";
|
|
8
8
|
import { replaceArgumentPlaceholders } from "../utils/templates.js";
|
|
9
9
|
import { parseFrontMatter } from "../utils/yaml.js";
|
|
10
|
-
import { addDirectoryCommand } from "./add-directory/index.js";
|
|
11
|
-
import { clearCommand } from "./clear/index.js";
|
|
12
10
|
import { copyCommand } from "./copy/index.js";
|
|
13
|
-
import { generateRulesCommand } from "./generate-rules/index.js";
|
|
14
|
-
import { handoffCommand } from "./handoff/index.js";
|
|
15
11
|
import { healthCommand } from "./health/index.js";
|
|
16
12
|
import { helpCommand } from "./help/index.js";
|
|
17
13
|
import { historyCommand } from "./history/index.js";
|
|
18
14
|
import { initCommand } from "./init/index.js";
|
|
19
15
|
import { initProjectCommand } from "./init-project/index.js";
|
|
20
|
-
import { listDirectoriesCommand } from "./list-directories/index.js";
|
|
21
16
|
import { listToolsCommand } from "./list-tools/index.js";
|
|
22
17
|
import { modelCommand } from "./model/index.js";
|
|
23
18
|
import { pasteCommand } from "./paste/index.js";
|
|
24
|
-
import { pickupCommand } from "./pickup/index.js";
|
|
25
|
-
import { removeDirectoryCommand } from "./remove-directory/index.js";
|
|
26
19
|
import { resourcesCommand } from "./resources/index.js";
|
|
27
|
-
import { reviewCommand } from "./review/index.js";
|
|
28
20
|
import { sessionCommand } from "./session/index.js";
|
|
29
21
|
import { shareCommand } from "./share/index.js";
|
|
30
|
-
import { shellCommand } from "./shell/index.js";
|
|
31
22
|
import { toolsCommand } from "./tools/index.js";
|
|
32
23
|
export class CommandManager {
|
|
33
24
|
commands;
|
|
@@ -69,26 +60,17 @@ export class CommandManager {
|
|
|
69
60
|
};
|
|
70
61
|
// Register all commands
|
|
71
62
|
const cmds = [
|
|
72
|
-
addDirectoryCommand(options),
|
|
73
|
-
clearCommand(options),
|
|
74
63
|
healthCommand(options),
|
|
75
64
|
historyCommand(options),
|
|
76
65
|
initCommand(options),
|
|
77
66
|
initProjectCommand(options),
|
|
78
|
-
listDirectoriesCommand(options),
|
|
79
67
|
pasteCommand(options),
|
|
80
|
-
pickupCommand(options),
|
|
81
|
-
removeDirectoryCommand(options),
|
|
82
|
-
reviewCommand(options),
|
|
83
68
|
modelCommand(options),
|
|
84
69
|
sessionCommand(options),
|
|
85
|
-
generateRulesCommand(options),
|
|
86
|
-
handoffCommand(options),
|
|
87
70
|
copyCommand(options),
|
|
88
71
|
listToolsCommand(options),
|
|
89
72
|
resourcesCommand(options),
|
|
90
73
|
shareCommand(options),
|
|
91
|
-
shellCommand(options),
|
|
92
74
|
toolsCommand(options),
|
|
93
75
|
];
|
|
94
76
|
// Add help command with access to all commands
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-renderer.d.ts","sourceRoot":"","sources":["../../../source/commands/share/html-renderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAA0C,MAAM,IAAI,CAAC;AAE/E,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC1B;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAO/C;
|
|
1
|
+
{"version":3,"file":"html-renderer.d.ts","sourceRoot":"","sources":["../../../source/commands/share/html-renderer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAA0C,MAAM,IAAI,CAAC;AAE/E,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC1B;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAO/C;AA8ID,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAwO9D;AAED,wBAAgB,cAAc,CAC5B,cAAc,EAAE;IACd,GAAG,EAAE,MAAM,YAAY,EAAE,CAAC;IAC1B,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,YAAY,EAAE,MAAM,IAAI,CAAC;CAC1B,EACD,OAAO,CAAC,EAAE,MAAM,GACf,WAAW,CAUb;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,WAAW,GAAG;IACzD,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAMA"}
|
|
@@ -69,68 +69,74 @@ function renderToolResult(toolResult) {
|
|
|
69
69
|
</div>
|
|
70
70
|
</div>`;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
function extractTextContent(content) {
|
|
73
|
+
if (typeof content === "string") {
|
|
74
|
+
return escapeHtml(content);
|
|
75
|
+
}
|
|
76
|
+
if (Array.isArray(content)) {
|
|
77
|
+
return content
|
|
78
|
+
.filter((p) => typeof p !== "string" && p.type === "text")
|
|
79
|
+
.map((p) => escapeHtml(p.text))
|
|
80
|
+
.join("\n");
|
|
81
|
+
}
|
|
82
|
+
return "";
|
|
83
|
+
}
|
|
84
|
+
function renderSystemMessage(content) {
|
|
85
|
+
const textContent = extractTextContent(content);
|
|
86
|
+
return `
|
|
82
87
|
<div class="message system">
|
|
83
88
|
<div class="role">system</div>
|
|
84
|
-
<div class="content">${
|
|
89
|
+
<div class="content">${textContent}</div>
|
|
85
90
|
</div>`;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
if (typeof content === "string") {
|
|
91
|
-
textContent = escapeHtml(content);
|
|
92
|
-
}
|
|
93
|
-
else if (Array.isArray(content)) {
|
|
94
|
-
textContent = content
|
|
95
|
-
.filter((p) => typeof p !== "string" && p.type === "text")
|
|
96
|
-
.map((p) => escapeHtml(p.text))
|
|
97
|
-
.join("\n");
|
|
98
|
-
}
|
|
99
|
-
return `
|
|
91
|
+
}
|
|
92
|
+
function renderUserMessage(content) {
|
|
93
|
+
const textContent = extractTextContent(content);
|
|
94
|
+
return `
|
|
100
95
|
<div class="message user">
|
|
101
96
|
<div class="role">user</div>
|
|
102
97
|
<div class="content">${textContent}</div>
|
|
103
98
|
</div>`;
|
|
99
|
+
}
|
|
100
|
+
function renderAssistantContent(content) {
|
|
101
|
+
if (typeof content === "string") {
|
|
102
|
+
return `<div class="content">${escapeHtml(content)}</div>`;
|
|
104
103
|
}
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (part.type === "text" && part.text.trim()) {
|
|
114
|
-
html += `<div class="content">${escapeHtml(part.text)}</div>`;
|
|
115
|
-
}
|
|
116
|
-
else if (part.type === "tool-call") {
|
|
117
|
-
html += renderToolCall(part);
|
|
118
|
-
}
|
|
104
|
+
if (Array.isArray(content)) {
|
|
105
|
+
let html = "";
|
|
106
|
+
for (const part of content) {
|
|
107
|
+
if (part.type === "text" && part.text.trim()) {
|
|
108
|
+
html += `<div class="content">${escapeHtml(part.text)}</div>`;
|
|
109
|
+
}
|
|
110
|
+
else if (part.type === "tool-call") {
|
|
111
|
+
html += renderToolCall(part);
|
|
119
112
|
}
|
|
120
113
|
}
|
|
121
|
-
html += "</div>";
|
|
122
114
|
return html;
|
|
123
115
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
116
|
+
return "";
|
|
117
|
+
}
|
|
118
|
+
function renderAssistantMessage(content) {
|
|
119
|
+
return `<div class="message assistant"><div class="role">assistant</div>${renderAssistantContent(content)}</div>`;
|
|
120
|
+
}
|
|
121
|
+
function renderToolMessage(parts) {
|
|
122
|
+
let html = "";
|
|
123
|
+
for (const part of parts) {
|
|
124
|
+
if (part.type === "tool-result") {
|
|
125
|
+
html += renderToolResult(part);
|
|
131
126
|
}
|
|
132
|
-
return html;
|
|
133
127
|
}
|
|
128
|
+
return html;
|
|
129
|
+
}
|
|
130
|
+
function renderMessage(message) {
|
|
131
|
+
const role = message.role;
|
|
132
|
+
if (role === "system")
|
|
133
|
+
return renderSystemMessage(message.content);
|
|
134
|
+
if (role === "user")
|
|
135
|
+
return renderUserMessage(message.content);
|
|
136
|
+
if (role === "assistant")
|
|
137
|
+
return renderAssistantMessage(message.content);
|
|
138
|
+
if (role === "tool")
|
|
139
|
+
return renderToolMessage(message.content);
|
|
134
140
|
return "";
|
|
135
141
|
}
|
|
136
142
|
export function renderSessionHtml(session) {
|
|
@@ -72,25 +72,22 @@ function createToolFiles(toolName, description, toolType, outputDir) {
|
|
|
72
72
|
files.push(...writeToolFile(filePath, config.template(), config.executable));
|
|
73
73
|
return files;
|
|
74
74
|
}
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
const TYPE_FLAGS = {
|
|
76
|
+
"--bash": "bash",
|
|
77
|
+
"--zsh": "zsh",
|
|
78
|
+
"--node": "node",
|
|
79
|
+
"--text": "text",
|
|
80
|
+
};
|
|
81
|
+
function parseToolArgs(args) {
|
|
77
82
|
let toolName = "";
|
|
78
83
|
let toolType = "bash";
|
|
79
84
|
let description = "";
|
|
80
85
|
let customDir = "";
|
|
81
86
|
for (let i = 0; i < args.length; i++) {
|
|
82
87
|
const arg = args[i];
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
else if (arg === "--zsh") {
|
|
87
|
-
toolType = "zsh";
|
|
88
|
-
}
|
|
89
|
-
else if (arg === "--node") {
|
|
90
|
-
toolType = "node";
|
|
91
|
-
}
|
|
92
|
-
else if (arg === "--text") {
|
|
93
|
-
toolType = "text";
|
|
88
|
+
const typeFlag = TYPE_FLAGS[arg];
|
|
89
|
+
if (typeFlag) {
|
|
90
|
+
toolType = typeFlag;
|
|
94
91
|
}
|
|
95
92
|
else if (arg === "--description" || arg === "-d") {
|
|
96
93
|
description = args[++i] || "";
|
|
@@ -102,49 +99,53 @@ function handleToolMake(args, options, container, editor, tui) {
|
|
|
102
99
|
toolName = arg;
|
|
103
100
|
}
|
|
104
101
|
}
|
|
102
|
+
return { toolName, toolType, description, customDir };
|
|
103
|
+
}
|
|
104
|
+
function showToolError(container, editor, tui, message, usage) {
|
|
105
|
+
container.addChild(new Text(style.red(message), 0, 1));
|
|
106
|
+
if (usage) {
|
|
107
|
+
container.addChild(new Text(style.dim(usage), 0, 1));
|
|
108
|
+
}
|
|
109
|
+
tui.requestRender();
|
|
110
|
+
editor.setText("");
|
|
111
|
+
return "continue";
|
|
112
|
+
}
|
|
113
|
+
function showToolSuccess(container, editor, tui, toolName, filePaths) {
|
|
114
|
+
container.addChild(new Text(style.green(`Created tool: ${toolName}`), 0, 1));
|
|
115
|
+
for (const filePath of filePaths) {
|
|
116
|
+
container.addChild(new Text(style.dim(` ${filePath}`), 0, 1));
|
|
117
|
+
}
|
|
118
|
+
container.addChild(new Text(style.dim("Restart acai or reload tools to use the new tool."), 0, 1));
|
|
119
|
+
tui.requestRender();
|
|
120
|
+
editor.setText("");
|
|
121
|
+
return "continue";
|
|
122
|
+
}
|
|
123
|
+
function handleToolMake(args, options, container, editor, tui) {
|
|
124
|
+
const parsed = parseToolArgs(args);
|
|
125
|
+
let { toolName, toolType, description, customDir } = parsed;
|
|
105
126
|
if (!toolName) {
|
|
106
|
-
container
|
|
107
|
-
container.addChild(new Text(style.dim("Usage: /tools make <name> [--bash|--zsh|--node|--text] [--description <desc>] [--dir <path>]"), 0, 1));
|
|
108
|
-
tui.requestRender();
|
|
109
|
-
editor.setText("");
|
|
110
|
-
return "continue";
|
|
127
|
+
return showToolError(container, editor, tui, "Error: Tool name is required", "Usage: /tools make <name> [--bash|--zsh|--node|--text] [--description <desc>] [--dir <path>]");
|
|
111
128
|
}
|
|
112
129
|
if (!TOOL_NAME_REGEX.test(toolName)) {
|
|
113
|
-
container
|
|
114
|
-
tui.requestRender();
|
|
115
|
-
editor.setText("");
|
|
116
|
-
return "continue";
|
|
130
|
+
return showToolError(container, editor, tui, `Error: Tool name must match ${TOOL_NAME_REGEX.source}`);
|
|
117
131
|
}
|
|
118
132
|
if (!description) {
|
|
119
133
|
description = `Dynamic tool: ${toolName}`;
|
|
120
134
|
}
|
|
121
|
-
// Determine output directory
|
|
122
135
|
const outputDir = customDir || path.join(options.workspace.primaryDir, ".acai", "tools");
|
|
123
|
-
// Create directory if it doesn't exist
|
|
124
136
|
if (!fs.existsSync(outputDir)) {
|
|
125
137
|
fs.mkdirSync(outputDir, { recursive: true });
|
|
126
138
|
}
|
|
127
139
|
try {
|
|
128
140
|
const result = createToolFiles(toolName, description, toolType, outputDir);
|
|
129
141
|
if (typeof result === "string") {
|
|
130
|
-
|
|
131
|
-
container.addChild(new Text(style.red(`Error: File already exists: ${result}`), 0, 1));
|
|
132
|
-
tui.requestRender();
|
|
133
|
-
editor.setText("");
|
|
134
|
-
return "continue";
|
|
135
|
-
}
|
|
136
|
-
container.addChild(new Text(style.green(`Created tool: ${toolName}`), 0, 1));
|
|
137
|
-
for (const filePath of result) {
|
|
138
|
-
container.addChild(new Text(style.dim(` ${filePath}`), 0, 1));
|
|
142
|
+
return showToolError(container, editor, tui, `Error: File already exists: ${result}`);
|
|
139
143
|
}
|
|
140
|
-
|
|
144
|
+
return showToolSuccess(container, editor, tui, toolName, result);
|
|
141
145
|
}
|
|
142
146
|
catch (e) {
|
|
143
|
-
container
|
|
147
|
+
return showToolError(container, editor, tui, `Error creating tool: ${e.message}`);
|
|
144
148
|
}
|
|
145
|
-
tui.requestRender();
|
|
146
|
-
editor.setText("");
|
|
147
|
-
return "continue";
|
|
148
149
|
}
|
|
149
150
|
async function handleToolList(options, container, editor, tui) {
|
|
150
151
|
const projectDir = path.join(options.workspace.primaryDir, ".acai", "tools");
|
package/dist/config/index.d.ts
CHANGED
|
@@ -22,7 +22,6 @@ export declare const defaultConfig: {
|
|
|
22
22
|
readonly devtools: {
|
|
23
23
|
readonly enabled: false;
|
|
24
24
|
};
|
|
25
|
-
readonly autoGenerateRules: false;
|
|
26
25
|
readonly allowedDirs: string[];
|
|
27
26
|
readonly env: Record<string, string>;
|
|
28
27
|
};
|
|
@@ -48,7 +47,6 @@ declare const ConfigSchema: z.ZodObject<{
|
|
|
48
47
|
enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
49
48
|
path: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
50
49
|
}, z.core.$strip>>>;
|
|
51
|
-
autoGenerateRules: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
52
50
|
allowedDirs: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
53
51
|
devtools: z.ZodDefault<z.ZodOptional<z.ZodObject<{
|
|
54
52
|
enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/config/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAa5D;AAED,eAAO,MAAM,aAAa;;;;;8BAKI,MAAM,EAAE,GAAG,SAAS;;;;;;;;;4BAS3B,MAAM,EAAE
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/config/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAa5D;AAED,eAAO,MAAM,aAAa;;;;;8BAKI,MAAM,EAAE,GAAG,SAAS;;;;;;;;;4BAS3B,MAAM,EAAE;;;;;;;;0BAQV,MAAM,EAAE;kBAChB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAGX,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAsDhB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AA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O,CAAC,GACjC,OAAO,CAAC,IAAI,CAAC;CAKjB;AAGD,eAAO,MAAM,MAAM,eAAsB,CAAC"}
|
package/dist/config/index.js
CHANGED
|
@@ -42,7 +42,6 @@ export const defaultConfig = {
|
|
|
42
42
|
devtools: {
|
|
43
43
|
enabled: false,
|
|
44
44
|
},
|
|
45
|
-
autoGenerateRules: false,
|
|
46
45
|
allowedDirs: [],
|
|
47
46
|
env: {},
|
|
48
47
|
};
|
|
@@ -90,10 +89,6 @@ const ConfigSchema = z.object({
|
|
|
90
89
|
})
|
|
91
90
|
.optional()
|
|
92
91
|
.default(defaultConfig.skills),
|
|
93
|
-
autoGenerateRules: z
|
|
94
|
-
.boolean()
|
|
95
|
-
.optional()
|
|
96
|
-
.default(defaultConfig.autoGenerateRules),
|
|
97
92
|
allowedDirs: z
|
|
98
93
|
.array(z.string())
|
|
99
94
|
.optional()
|
|
@@ -159,7 +154,8 @@ export class ConfigManager {
|
|
|
159
154
|
return jsonParser(ConfigSchema).parse(data);
|
|
160
155
|
}
|
|
161
156
|
catch (error) {
|
|
162
|
-
|
|
157
|
+
const code = error.code;
|
|
158
|
+
if (code === "ENOENT" || code === "EPERM" || code === "EACCES") {
|
|
163
159
|
return {};
|
|
164
160
|
}
|
|
165
161
|
throw error;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { SessionManager } from "./sessions/manager.ts";
|
|
3
|
+
import { setTerminalTitle } from "./terminal/control.ts";
|
|
4
|
+
import { select } from "./terminal/select-prompt.ts";
|
|
2
5
|
export interface WorkspaceContext {
|
|
3
6
|
primaryDir: string;
|
|
4
7
|
allowedDirs: string[];
|
|
@@ -22,5 +25,16 @@ declare const flags: {
|
|
|
22
25
|
*/
|
|
23
26
|
export declare function handleError(error: Error): void;
|
|
24
27
|
export type Flags = typeof flags;
|
|
28
|
+
export declare function handleConversationHistory(sessionManager: SessionManager, sessionsDir: string, _hasContinueOrResume: boolean, resumeSessionId: string | undefined, continueFlag?: boolean, resumeFlag?: boolean, selectFn?: typeof select, setTitleFn?: typeof setTerminalTitle): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Expands a leading tilde in a path to the user's home directory.
|
|
31
|
+
* If the path does not start with ~, it is returned unchanged.
|
|
32
|
+
*/
|
|
33
|
+
export declare function expandTildePath(dir: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Resolves a path (expanding tilde if present) and adds it to a list
|
|
36
|
+
* of directories if it is not already present.
|
|
37
|
+
*/
|
|
38
|
+
export declare function addUniqueDir(dir: string, dirs: string[]): void;
|
|
25
39
|
export {};
|
|
26
40
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";AAuBA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAYrD,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAGD,wBAAgB,sBAAsB,CACpC,UAAU,GAAE,MAAM,EAAO,GACxB,gBAAgB,CAsBlB;AAoDD,QAAA,MAAM,KAAK;;;;;;;;;;CAAyB,CAAC;AAMrC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAE9C;AAED,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC;AAyOjC,wBAAsB,yBAAyB,CAC7C,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,MAAM,EACnB,oBAAoB,EAAE,OAAO,EAC7B,eAAe,EAAE,MAAM,GAAG,SAAS,EACnC,YAAY,UAAiB,EAC7B,UAAU,UAAe,EACzB,QAAQ,gBAAS,EACjB,UAAU,0BAAmB,GAC5B,OAAO,CAAC,IAAI,CAAC,CAWf;AAgRD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKnD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAK9D"}
|