pi-better-goal 0.1.22 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.ts +15 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import type { AutocompleteItem } from "@earendil-works/pi-tui";
|
|
2
3
|
import { Type } from "typebox";
|
|
3
4
|
|
|
4
5
|
import {
|
|
@@ -59,6 +60,19 @@ const MAX_NO_PROGRESS_RETRIES = parseRetryLimit(
|
|
|
59
60
|
DEFAULT_MAX_NO_PROGRESS_RETRIES,
|
|
60
61
|
);
|
|
61
62
|
|
|
63
|
+
const GOAL_ACTIONS: readonly AutocompleteItem[] = [
|
|
64
|
+
{ value: "pause", label: "pause", description: "Pause the active goal" },
|
|
65
|
+
{ value: "resume", label: "resume", description: "Resume the paused goal" },
|
|
66
|
+
{ value: "clear", label: "clear", description: "Remove the current goal" },
|
|
67
|
+
{ value: "complete", label: "complete", description: "Mark the current goal complete" },
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
export function goalArgumentCompletions(argumentPrefix: string): AutocompleteItem[] | null {
|
|
71
|
+
const prefix = argumentPrefix.trimStart().toLowerCase();
|
|
72
|
+
const matches = GOAL_ACTIONS.filter((action) => action.value.startsWith(prefix));
|
|
73
|
+
return matches.length > 0 ? [...matches] : null;
|
|
74
|
+
}
|
|
75
|
+
|
|
62
76
|
function parseDurationEnv(raw: string | undefined, fallback: number): number {
|
|
63
77
|
if (raw === undefined || raw.trim() === "") {
|
|
64
78
|
return fallback;
|
|
@@ -486,6 +500,7 @@ export default function (pi: ExtensionAPI): void {
|
|
|
486
500
|
|
|
487
501
|
pi.registerCommand("goal", {
|
|
488
502
|
description: "Create, inspect, pause, resume, clear, or complete the active goal",
|
|
503
|
+
getArgumentCompletions: goalArgumentCompletions,
|
|
489
504
|
handler: async (args, ctx) => {
|
|
490
505
|
currentCtx = ctx;
|
|
491
506
|
const trimmed = args.trim();
|