@kenkaiiii/ggcoder 4.3.217 → 4.3.219
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/command-routing.d.ts +28 -0
- package/dist/cli/command-routing.d.ts.map +1 -0
- package/dist/cli/command-routing.js +51 -0
- package/dist/cli/command-routing.js.map +1 -0
- package/dist/cli/command-routing.test.d.ts +2 -0
- package/dist/cli/command-routing.test.d.ts.map +1 -0
- package/dist/cli/command-routing.test.js +59 -0
- package/dist/cli/command-routing.test.js.map +1 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +48 -104
- package/dist/cli.js.map +1 -1
- package/dist/core/agent-session-compaction.test.d.ts +2 -0
- package/dist/core/agent-session-compaction.test.d.ts.map +1 -0
- package/dist/core/agent-session-compaction.test.js +121 -0
- package/dist/core/agent-session-compaction.test.js.map +1 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +6 -7
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/goal-store.d.ts +11 -0
- package/dist/core/goal-store.d.ts.map +1 -1
- package/dist/core/goal-store.js +45 -0
- package/dist/core/goal-store.js.map +1 -1
- package/dist/core/goal-worker.d.ts +7 -0
- package/dist/core/goal-worker.d.ts.map +1 -1
- package/dist/core/goal-worker.js +62 -20
- package/dist/core/goal-worker.js.map +1 -1
- package/dist/core/goal-worker.test.js +92 -2
- package/dist/core/goal-worker.test.js.map +1 -1
- package/dist/core/goal-worktree.d.ts +33 -0
- package/dist/core/goal-worktree.d.ts.map +1 -0
- package/dist/core/goal-worktree.js +67 -0
- package/dist/core/goal-worktree.js.map +1 -0
- package/dist/core/goal-worktree.test.d.ts +2 -0
- package/dist/core/goal-worktree.test.d.ts.map +1 -0
- package/dist/core/goal-worktree.test.js +101 -0
- package/dist/core/goal-worktree.test.js.map +1 -0
- package/dist/core/repomap-budget.d.ts +7 -0
- package/dist/core/repomap-budget.d.ts.map +1 -0
- package/dist/core/repomap-budget.js +10 -0
- package/dist/core/repomap-budget.js.map +1 -0
- package/dist/core/repomap-budget.test.d.ts +2 -0
- package/dist/core/repomap-budget.test.d.ts.map +1 -0
- package/dist/core/repomap-budget.test.js +26 -0
- package/dist/core/repomap-budget.test.js.map +1 -0
- package/dist/core/tasks-store.d.ts +24 -0
- package/dist/core/tasks-store.d.ts.map +1 -0
- package/dist/core/tasks-store.js +81 -0
- package/dist/core/tasks-store.js.map +1 -0
- package/dist/system-prompt.js +2 -2
- package/dist/system-prompt.js.map +1 -1
- package/dist/system-prompt.test.js +2 -2
- package/dist/system-prompt.test.js.map +1 -1
- package/dist/tools/goals.d.ts.map +1 -1
- package/dist/tools/goals.js +30 -26
- package/dist/tools/goals.js.map +1 -1
- package/dist/tools/goals.test.js +47 -1
- package/dist/tools/goals.test.js.map +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +3 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/tasks.d.ts +16 -0
- package/dist/tools/tasks.d.ts.map +1 -0
- package/dist/tools/tasks.js +93 -0
- package/dist/tools/tasks.js.map +1 -0
- package/dist/ui/App.d.ts +12 -381
- package/dist/ui/App.d.ts.map +1 -1
- package/dist/ui/App.js +212 -679
- package/dist/ui/App.js.map +1 -1
- package/dist/ui/app-items.d.ts +212 -0
- package/dist/ui/app-items.d.ts.map +1 -0
- package/dist/ui/app-items.js +2 -0
- package/dist/ui/app-items.js.map +1 -0
- package/dist/ui/app-state-persistence.test.js +22 -1
- package/dist/ui/app-state-persistence.test.js.map +1 -1
- package/dist/ui/chat-layout-pinning.test.js +12 -1
- package/dist/ui/chat-layout-pinning.test.js.map +1 -1
- package/dist/ui/components/Banner.js +2 -2
- package/dist/ui/components/Banner.js.map +1 -1
- package/dist/ui/components/GoalPickerMenu.d.ts +9 -0
- package/dist/ui/components/GoalPickerMenu.d.ts.map +1 -0
- package/dist/ui/components/GoalPickerMenu.js +37 -0
- package/dist/ui/components/GoalPickerMenu.js.map +1 -0
- package/dist/ui/components/InputArea.d.ts +16 -1
- package/dist/ui/components/InputArea.d.ts.map +1 -1
- package/dist/ui/components/InputArea.js +91 -3
- package/dist/ui/components/InputArea.js.map +1 -1
- package/dist/ui/components/TaskPickerMenu.d.ts +9 -0
- package/dist/ui/components/TaskPickerMenu.d.ts.map +1 -0
- package/dist/ui/components/TaskPickerMenu.js +33 -0
- package/dist/ui/components/TaskPickerMenu.js.map +1 -0
- package/dist/ui/components/ToolUseLoader.d.ts +3 -1
- package/dist/ui/components/ToolUseLoader.d.ts.map +1 -1
- package/dist/ui/components/ToolUseLoader.js +2 -2
- package/dist/ui/components/ToolUseLoader.js.map +1 -1
- package/dist/ui/goal-events.test.js +2 -1
- package/dist/ui/goal-events.test.js.map +1 -1
- package/dist/ui/goal-lifecycle-orchestration.test.js +20 -1
- package/dist/ui/goal-lifecycle-orchestration.test.js.map +1 -1
- package/dist/ui/goal-progress.d.ts +31 -0
- package/dist/ui/goal-progress.d.ts.map +1 -0
- package/dist/ui/goal-progress.js +152 -0
- package/dist/ui/goal-progress.js.map +1 -0
- package/dist/ui/item-helpers.d.ts +26 -0
- package/dist/ui/item-helpers.d.ts.map +1 -0
- package/dist/ui/item-helpers.js +112 -0
- package/dist/ui/item-helpers.js.map +1 -0
- package/dist/ui/layout-decisions.d.ts +113 -0
- package/dist/ui/layout-decisions.d.ts.map +1 -0
- package/dist/ui/layout-decisions.js +174 -0
- package/dist/ui/layout-decisions.js.map +1 -0
- package/dist/ui/prompt-routing.d.ts +29 -0
- package/dist/ui/prompt-routing.d.ts.map +1 -0
- package/dist/ui/prompt-routing.js +105 -0
- package/dist/ui/prompt-routing.js.map +1 -0
- package/dist/ui/queued-message.test.js +1 -1
- package/dist/ui/queued-message.test.js.map +1 -1
- package/dist/ui/render.d.ts +1 -0
- package/dist/ui/render.d.ts.map +1 -1
- package/dist/ui/render.js +1 -0
- package/dist/ui/render.js.map +1 -1
- package/dist/ui/scroll-stabilization.test.js +1 -1
- package/dist/ui/scroll-stabilization.test.js.map +1 -1
- package/dist/ui/slash-command-images.test.js +1 -1
- package/dist/ui/slash-command-images.test.js.map +1 -1
- package/dist/ui/terminal-history-format.d.ts +41 -0
- package/dist/ui/terminal-history-format.d.ts.map +1 -0
- package/dist/ui/terminal-history-format.js +131 -0
- package/dist/ui/terminal-history-format.js.map +1 -0
- package/dist/ui/terminal-history-spacing.d.ts +3 -0
- package/dist/ui/terminal-history-spacing.d.ts.map +1 -0
- package/dist/ui/terminal-history-spacing.js +29 -0
- package/dist/ui/terminal-history-spacing.js.map +1 -0
- package/dist/ui/terminal-history-status-renderers.d.ts +16 -0
- package/dist/ui/terminal-history-status-renderers.d.ts.map +1 -0
- package/dist/ui/terminal-history-status-renderers.js +83 -0
- package/dist/ui/terminal-history-status-renderers.js.map +1 -0
- package/dist/ui/terminal-history.d.ts.map +1 -1
- package/dist/ui/terminal-history.js +23 -236
- package/dist/ui/terminal-history.js.map +1 -1
- package/dist/ui/terminal-history.test.js +2 -1
- package/dist/ui/terminal-history.test.js.map +1 -1
- package/dist/ui/thinking-level-cycle.test.js +7 -1
- package/dist/ui/thinking-level-cycle.test.js.map +1 -1
- package/dist/ui/thinking-level.d.ts +5 -0
- package/dist/ui/thinking-level.d.ts.map +1 -0
- package/dist/ui/thinking-level.js +30 -0
- package/dist/ui/thinking-level.js.map +1 -0
- package/dist/ui/tui-history-parity.test.js +7 -3
- package/dist/ui/tui-history-parity.test.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type CliSubcommandName = "pixel" | "login" | "logout" | "sessions" | "telegram" | "serve" | "doctor" | "agent-home-login" | "agent-home";
|
|
2
|
+
export type CliCommandRouteResult = {
|
|
3
|
+
kind: "handled";
|
|
4
|
+
subcommand: CliSubcommandName;
|
|
5
|
+
} | {
|
|
6
|
+
kind: "continue";
|
|
7
|
+
} | {
|
|
8
|
+
kind: "main";
|
|
9
|
+
subcommand: string | undefined;
|
|
10
|
+
};
|
|
11
|
+
type SubcommandHandler = () => void;
|
|
12
|
+
export interface CliCommandRoutingOptions {
|
|
13
|
+
argv: string[];
|
|
14
|
+
printHelp: () => void;
|
|
15
|
+
exit: (code: number) => never;
|
|
16
|
+
handlers: Record<CliSubcommandName, SubcommandHandler>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Routes the early CLI command layer before parseArgs handles normal flags.
|
|
20
|
+
*
|
|
21
|
+
* This intentionally preserves the legacy startup contract:
|
|
22
|
+
* - any -h/--help anywhere prints top-level help and exits before subcommands;
|
|
23
|
+
* - selected subcommands remove their command token before their mode parser runs;
|
|
24
|
+
* - `continue` is not a standalone handler, it only toggles the later TUI resume path.
|
|
25
|
+
*/
|
|
26
|
+
export declare function routeCliCommandInput(options: CliCommandRoutingOptions): CliCommandRouteResult;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=command-routing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-routing.d.ts","sourceRoot":"","sources":["../../src/cli/command-routing.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GACzB,OAAO,GACP,OAAO,GACP,QAAQ,GACR,UAAU,GACV,UAAU,GACV,OAAO,GACP,QAAQ,GACR,kBAAkB,GAClB,YAAY,CAAC;AAEjB,MAAM,MAAM,qBAAqB,GAC7B;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,iBAAiB,CAAA;CAAE,GAClD;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAErD,KAAK,iBAAiB,GAAG,MAAM,IAAI,CAAC;AAEpC,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAC;CACxD;AA6BD;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,wBAAwB,GAAG,qBAAqB,CAwB7F"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const SUBCOMMANDS_THAT_KEEP_ARGV = new Set([
|
|
2
|
+
"pixel",
|
|
3
|
+
"login",
|
|
4
|
+
"logout",
|
|
5
|
+
"telegram",
|
|
6
|
+
"doctor",
|
|
7
|
+
"agent-home-login",
|
|
8
|
+
]);
|
|
9
|
+
function isCliSubcommandName(value) {
|
|
10
|
+
return (value === "pixel" ||
|
|
11
|
+
value === "login" ||
|
|
12
|
+
value === "logout" ||
|
|
13
|
+
value === "sessions" ||
|
|
14
|
+
value === "telegram" ||
|
|
15
|
+
value === "serve" ||
|
|
16
|
+
value === "doctor" ||
|
|
17
|
+
value === "agent-home-login" ||
|
|
18
|
+
value === "agent-home");
|
|
19
|
+
}
|
|
20
|
+
function stripSubcommandArg(argv) {
|
|
21
|
+
argv.splice(2, 1);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Routes the early CLI command layer before parseArgs handles normal flags.
|
|
25
|
+
*
|
|
26
|
+
* This intentionally preserves the legacy startup contract:
|
|
27
|
+
* - any -h/--help anywhere prints top-level help and exits before subcommands;
|
|
28
|
+
* - selected subcommands remove their command token before their mode parser runs;
|
|
29
|
+
* - `continue` is not a standalone handler, it only toggles the later TUI resume path.
|
|
30
|
+
*/
|
|
31
|
+
export function routeCliCommandInput(options) {
|
|
32
|
+
const { argv, printHelp, exit, handlers } = options;
|
|
33
|
+
if (argv.includes("--help") || argv.includes("-h")) {
|
|
34
|
+
printHelp();
|
|
35
|
+
exit(0);
|
|
36
|
+
}
|
|
37
|
+
const subcommand = argv[2];
|
|
38
|
+
if (isCliSubcommandName(subcommand)) {
|
|
39
|
+
if (!SUBCOMMANDS_THAT_KEEP_ARGV.has(subcommand)) {
|
|
40
|
+
stripSubcommandArg(argv);
|
|
41
|
+
}
|
|
42
|
+
handlers[subcommand]();
|
|
43
|
+
return { kind: "handled", subcommand };
|
|
44
|
+
}
|
|
45
|
+
if (subcommand === "continue") {
|
|
46
|
+
stripSubcommandArg(argv);
|
|
47
|
+
return { kind: "continue" };
|
|
48
|
+
}
|
|
49
|
+
return { kind: "main", subcommand };
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=command-routing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-routing.js","sourceRoot":"","sources":["../../src/cli/command-routing.ts"],"names":[],"mappings":"AAyBA,MAAM,0BAA0B,GAAmC,IAAI,GAAG,CAAC;IACzE,OAAO;IACP,OAAO;IACP,QAAQ;IACR,UAAU;IACV,QAAQ;IACR,kBAAkB;CACnB,CAAC,CAAC;AAEH,SAAS,mBAAmB,CAAC,KAAyB;IACpD,OAAO,CACL,KAAK,KAAK,OAAO;QACjB,KAAK,KAAK,OAAO;QACjB,KAAK,KAAK,QAAQ;QAClB,KAAK,KAAK,UAAU;QACpB,KAAK,KAAK,UAAU;QACpB,KAAK,KAAK,OAAO;QACjB,KAAK,KAAK,QAAQ;QAClB,KAAK,KAAK,kBAAkB;QAC5B,KAAK,KAAK,YAAY,CACvB,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,IAAc;IACxC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACpB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAiC;IACpE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAEpD,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACnD,SAAS,EAAE,CAAC;QACZ,IAAI,CAAC,CAAC,CAAC,CAAC;IACV,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAE3B,IAAI,mBAAmB,CAAC,UAAU,CAAC,EAAE,CAAC;QACpC,IAAI,CAAC,0BAA0B,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;YAChD,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC;QACD,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;IACzC,CAAC;IAED,IAAI,UAAU,KAAK,UAAU,EAAE,CAAC;QAC9B,kBAAkB,CAAC,IAAI,CAAC,CAAC;QACzB,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;IAC9B,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AACtC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-routing.test.d.ts","sourceRoot":"","sources":["../../src/cli/command-routing.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { routeCliCommandInput } from "./command-routing.js";
|
|
3
|
+
function handlers(calls) {
|
|
4
|
+
return {
|
|
5
|
+
pixel: () => calls.push("pixel"),
|
|
6
|
+
login: () => calls.push("login"),
|
|
7
|
+
logout: () => calls.push("logout"),
|
|
8
|
+
sessions: () => calls.push("sessions"),
|
|
9
|
+
telegram: () => calls.push("telegram"),
|
|
10
|
+
serve: () => calls.push("serve"),
|
|
11
|
+
doctor: () => calls.push("doctor"),
|
|
12
|
+
"agent-home-login": () => calls.push("agent-home-login"),
|
|
13
|
+
"agent-home": () => calls.push("agent-home"),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
describe("routeCliCommandInput", () => {
|
|
17
|
+
it("prints top-level help before dispatching subcommands", () => {
|
|
18
|
+
const argv = ["node", "ggcoder", "login", "--help"];
|
|
19
|
+
const printHelp = vi.fn();
|
|
20
|
+
const exit = vi.fn((code) => {
|
|
21
|
+
throw new Error(`exit:${code}`);
|
|
22
|
+
});
|
|
23
|
+
expect(() => routeCliCommandInput({ argv, printHelp, exit, handlers: handlers([]) })).toThrow("exit:0");
|
|
24
|
+
expect(printHelp).toHaveBeenCalledOnce();
|
|
25
|
+
});
|
|
26
|
+
it("dispatches subcommands and strips command tokens only for modes that parse their own flags", () => {
|
|
27
|
+
const calls = [];
|
|
28
|
+
const sessionsArgv = ["node", "ggcoder", "sessions", "--foo"];
|
|
29
|
+
const loginArgv = ["node", "ggcoder", "login", "--foo"];
|
|
30
|
+
expect(routeCliCommandInput({
|
|
31
|
+
argv: sessionsArgv,
|
|
32
|
+
printHelp: vi.fn(),
|
|
33
|
+
exit: vi.fn(),
|
|
34
|
+
handlers: handlers(calls),
|
|
35
|
+
})).toEqual({ kind: "handled", subcommand: "sessions" });
|
|
36
|
+
expect(sessionsArgv).toEqual(["node", "ggcoder", "--foo"]);
|
|
37
|
+
expect(routeCliCommandInput({
|
|
38
|
+
argv: loginArgv,
|
|
39
|
+
printHelp: vi.fn(),
|
|
40
|
+
exit: vi.fn(),
|
|
41
|
+
handlers: handlers(calls),
|
|
42
|
+
})).toEqual({ kind: "handled", subcommand: "login" });
|
|
43
|
+
expect(loginArgv).toEqual(["node", "ggcoder", "login", "--foo"]);
|
|
44
|
+
expect(calls).toEqual(["sessions", "login"]);
|
|
45
|
+
});
|
|
46
|
+
it("converts continue into a later TUI resume route without handling it as a subcommand", () => {
|
|
47
|
+
const argv = ["node", "ggcoder", "continue", "--model", "x"];
|
|
48
|
+
const calls = [];
|
|
49
|
+
expect(routeCliCommandInput({
|
|
50
|
+
argv,
|
|
51
|
+
printHelp: vi.fn(),
|
|
52
|
+
exit: vi.fn(),
|
|
53
|
+
handlers: handlers(calls),
|
|
54
|
+
})).toEqual({ kind: "continue" });
|
|
55
|
+
expect(argv).toEqual(["node", "ggcoder", "--model", "x"]);
|
|
56
|
+
expect(calls).toEqual([]);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=command-routing.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-routing.test.js","sourceRoot":"","sources":["../../src/cli/command-routing.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAA0B,MAAM,sBAAsB,CAAC;AAEpF,SAAS,QAAQ,CAAC,KAAe;IAC/B,OAAO;QACL,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;QAChC,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;QAChC,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;QAClC,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC;QACtC,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC;QACtC,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;QAChC,MAAM,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;QAClC,kBAAkB,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC;QACxD,YAAY,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC;KAC7C,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,sBAAsB,EAAE,GAAG,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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env -S node --max-old-space-size=8192 --expose-gc
|
|
2
|
-
import type { CompletedItem } from "./ui/
|
|
2
|
+
import type { CompletedItem } from "./ui/app-items.js";
|
|
3
3
|
import type { Message, ThinkingLevel } from "@kenkaiiii/gg-ai";
|
|
4
4
|
export declare function parseThinkingLevel(value: string | undefined): ThinkingLevel | undefined;
|
|
5
5
|
export declare function messagesToHistoryItems(msgs: Message[]): CompletedItem[];
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AA6DA,OAAO,KAAK,EAAE,aAAa,EAAqB,MAAM,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AA6DA,OAAO,KAAK,EAAE,aAAa,EAAqB,MAAM,mBAAmB,CAAC;AAI1E,OAAO,KAAK,EAAE,OAAO,EAAY,aAAa,EAAE,MAAM,kBAAkB,CAAC;AA0CzE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,aAAa,GAAG,SAAS,CAIvF;AAitDD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,aAAa,EAAE,CAgJvE"}
|
package/dist/cli.js
CHANGED
|
@@ -78,6 +78,7 @@ import { loginGemini } from "./core/oauth/gemini.js";
|
|
|
78
78
|
import chalk from "chalk";
|
|
79
79
|
import { checkAndAutoUpdate } from "./core/auto-update.js";
|
|
80
80
|
import { parseGoalSyntheticEvent } from "./ui/goal-events.js";
|
|
81
|
+
import { routeCliCommandInput } from "./cli/command-routing.js";
|
|
81
82
|
const _require = createRequire(import.meta.url);
|
|
82
83
|
const CLI_VERSION = _require("../package.json").version;
|
|
83
84
|
const THINKING_LEVELS = new Set(["low", "medium", "high", "xhigh"]);
|
|
@@ -214,108 +215,48 @@ function printHelp() {
|
|
|
214
215
|
}
|
|
215
216
|
console.log();
|
|
216
217
|
}
|
|
218
|
+
function createCliSubcommandHandlers() {
|
|
219
|
+
const runWithStandardErrorHandling = (operation, logStack = false) => {
|
|
220
|
+
operation().catch((err) => {
|
|
221
|
+
log("ERROR", "fatal", err instanceof Error ? (logStack ? (err.stack ?? err.message) : err.message) : String(err));
|
|
222
|
+
closeLogger();
|
|
223
|
+
process.stderr.write(formatUserError(err) + "\n");
|
|
224
|
+
process.exit(1);
|
|
225
|
+
});
|
|
226
|
+
};
|
|
227
|
+
return {
|
|
228
|
+
pixel: () => runWithStandardErrorHandling(runPixel, true),
|
|
229
|
+
login: () => runWithStandardErrorHandling(runLogin),
|
|
230
|
+
logout: () => runWithStandardErrorHandling(runLogout),
|
|
231
|
+
sessions: () => runWithStandardErrorHandling(runSessions),
|
|
232
|
+
telegram: () => runWithStandardErrorHandling(runTelegramSetup),
|
|
233
|
+
serve: () => runWithStandardErrorHandling(runServe),
|
|
234
|
+
doctor: () => {
|
|
235
|
+
runDoctor().catch((err) => {
|
|
236
|
+
process.stderr.write(formatUserError(err) + "\n");
|
|
237
|
+
process.exit(1);
|
|
238
|
+
});
|
|
239
|
+
},
|
|
240
|
+
"agent-home-login": () => runWithStandardErrorHandling(runAgentHomeLogin),
|
|
241
|
+
"agent-home": () => runWithStandardErrorHandling(runAgentHome),
|
|
242
|
+
};
|
|
243
|
+
}
|
|
217
244
|
function main() {
|
|
218
245
|
// Silent auto-update check (throttled, non-blocking on failure)
|
|
219
246
|
const updateMessage = checkAndAutoUpdate(CLI_VERSION);
|
|
220
247
|
if (updateMessage) {
|
|
221
248
|
console.error(chalk.bold.hex("#4ade80")(`✨ ${updateMessage}`));
|
|
222
249
|
}
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
const subcommand = process.argv[2];
|
|
231
|
-
if (subcommand === "pixel") {
|
|
232
|
-
runPixel().catch((err) => {
|
|
233
|
-
// Log the full stack — `pixel install` failures are usually bugs in our
|
|
234
|
-
// own AST/wiring code, and the stack is the only useful diagnostic.
|
|
235
|
-
log("ERROR", "fatal", err instanceof Error ? (err.stack ?? err.message) : String(err));
|
|
236
|
-
closeLogger();
|
|
237
|
-
process.stderr.write(formatUserError(err) + "\n");
|
|
238
|
-
process.exit(1);
|
|
239
|
-
});
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
if (subcommand === "login") {
|
|
243
|
-
runLogin().catch((err) => {
|
|
244
|
-
log("ERROR", "fatal", err instanceof Error ? err.message : String(err));
|
|
245
|
-
closeLogger();
|
|
246
|
-
process.stderr.write(formatUserError(err) + "\n");
|
|
247
|
-
process.exit(1);
|
|
248
|
-
});
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
if (subcommand === "logout") {
|
|
252
|
-
runLogout().catch((err) => {
|
|
253
|
-
log("ERROR", "fatal", err instanceof Error ? err.message : String(err));
|
|
254
|
-
closeLogger();
|
|
255
|
-
process.stderr.write(formatUserError(err) + "\n");
|
|
256
|
-
process.exit(1);
|
|
257
|
-
});
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
if (subcommand === "sessions") {
|
|
261
|
-
process.argv.splice(2, 1);
|
|
262
|
-
runSessions().catch((err) => {
|
|
263
|
-
log("ERROR", "fatal", err instanceof Error ? err.message : String(err));
|
|
264
|
-
closeLogger();
|
|
265
|
-
process.stderr.write(formatUserError(err) + "\n");
|
|
266
|
-
process.exit(1);
|
|
267
|
-
});
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
if (subcommand === "telegram") {
|
|
271
|
-
runTelegramSetup().catch((err) => {
|
|
272
|
-
log("ERROR", "fatal", err instanceof Error ? err.message : String(err));
|
|
273
|
-
closeLogger();
|
|
274
|
-
process.stderr.write(formatUserError(err) + "\n");
|
|
275
|
-
process.exit(1);
|
|
276
|
-
});
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
if (subcommand === "serve") {
|
|
280
|
-
process.argv.splice(2, 1);
|
|
281
|
-
runServe().catch((err) => {
|
|
282
|
-
log("ERROR", "fatal", err instanceof Error ? err.message : String(err));
|
|
283
|
-
closeLogger();
|
|
284
|
-
process.stderr.write(formatUserError(err) + "\n");
|
|
285
|
-
process.exit(1);
|
|
286
|
-
});
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
if (subcommand === "doctor") {
|
|
290
|
-
runDoctor().catch((err) => {
|
|
291
|
-
process.stderr.write(formatUserError(err) + "\n");
|
|
292
|
-
process.exit(1);
|
|
293
|
-
});
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
if (subcommand === "agent-home-login") {
|
|
297
|
-
runAgentHomeLogin().catch((err) => {
|
|
298
|
-
log("ERROR", "fatal", err instanceof Error ? err.message : String(err));
|
|
299
|
-
closeLogger();
|
|
300
|
-
process.stderr.write(formatUserError(err) + "\n");
|
|
301
|
-
process.exit(1);
|
|
302
|
-
});
|
|
303
|
-
return;
|
|
304
|
-
}
|
|
305
|
-
if (subcommand === "agent-home") {
|
|
306
|
-
process.argv.splice(2, 1);
|
|
307
|
-
runAgentHome().catch((err) => {
|
|
308
|
-
log("ERROR", "fatal", err instanceof Error ? err.message : String(err));
|
|
309
|
-
closeLogger();
|
|
310
|
-
process.stderr.write(formatUserError(err) + "\n");
|
|
311
|
-
process.exit(1);
|
|
312
|
-
});
|
|
250
|
+
const commandRoute = routeCliCommandInput({
|
|
251
|
+
argv: process.argv,
|
|
252
|
+
printHelp,
|
|
253
|
+
exit: process.exit,
|
|
254
|
+
handlers: createCliSubcommandHandlers(),
|
|
255
|
+
});
|
|
256
|
+
if (commandRoute.kind === "handled") {
|
|
313
257
|
return;
|
|
314
258
|
}
|
|
315
|
-
|
|
316
|
-
// Remove "continue" so parseArgs handles remaining flags
|
|
317
|
-
process.argv.splice(2, 1);
|
|
318
|
-
}
|
|
259
|
+
const subcommand = commandRoute.kind === "continue" ? "continue" : commandRoute.subcommand;
|
|
319
260
|
const { values, positionals } = parseArgs({
|
|
320
261
|
options: {
|
|
321
262
|
help: { type: "boolean", short: "h" },
|
|
@@ -570,16 +511,17 @@ async function runInkTUI(opts) {
|
|
|
570
511
|
});
|
|
571
512
|
return rebuilt;
|
|
572
513
|
};
|
|
573
|
-
//
|
|
514
|
+
// MCP startup can involve `npx` installing/booting servers. Do it after the
|
|
515
|
+
// TUI paints so a slow network or npm cache never looks like "nothing happens".
|
|
574
516
|
const mcpManager = new MCPClientManager();
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
}
|
|
517
|
+
let initialMcpConnectPromise;
|
|
518
|
+
const connectInitialMcpTools = async () => {
|
|
519
|
+
initialMcpConnectPromise ??= (async () => {
|
|
520
|
+
const providerApiKey = provider === "glm" ? credentialsByProvider["glm"]?.accessToken : undefined;
|
|
521
|
+
return mcpManager.connectAll(getMCPServers(provider, providerApiKey));
|
|
522
|
+
})();
|
|
523
|
+
return initialMcpConnectPromise;
|
|
524
|
+
};
|
|
583
525
|
const systemPrompt = await buildSystemPrompt(cwd, skills, false, undefined, tools.map((tool) => tool.name), undefined, goalModeRef.current);
|
|
584
526
|
// Kill all background processes on exit (synchronous — catches all exit paths)
|
|
585
527
|
process.on("exit", () => {
|
|
@@ -696,6 +638,7 @@ async function runInkTUI(opts) {
|
|
|
696
638
|
rebuildToolsForCwd,
|
|
697
639
|
repoMapChangedFilesRef,
|
|
698
640
|
repoMapReadFilesRef,
|
|
641
|
+
connectInitialMcpTools,
|
|
699
642
|
});
|
|
700
643
|
closeLogger();
|
|
701
644
|
}
|
|
@@ -1775,7 +1718,8 @@ function openBrowser(url) {
|
|
|
1775
1718
|
// Ignore errors — user can copy URL manually
|
|
1776
1719
|
});
|
|
1777
1720
|
}
|
|
1778
|
-
if (process.argv[1] &&
|
|
1721
|
+
if (process.argv[1] &&
|
|
1722
|
+
fileURLToPath(import.meta.url) === fs.realpathSync(path.resolve(process.argv[1]))) {
|
|
1779
1723
|
main();
|
|
1780
1724
|
}
|
|
1781
1725
|
//# sourceMappingURL=cli.js.map
|