@oh-my-pi/pi-coding-agent 14.5.7 → 14.5.9
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/CHANGELOG.md +43 -0
- package/package.json +7 -7
- package/src/config/model-registry.ts +23 -1
- package/src/config/settings-schema.ts +23 -0
- package/src/edit/modes/atom.lark +7 -5
- package/src/edit/modes/atom.ts +462 -56
- package/src/edit/modes/hashline.ts +21 -1
- package/src/lsp/index.ts +2 -4
- package/src/lsp/render.ts +0 -3
- package/src/lsp/types.ts +1 -4
- package/src/lsp/utils.ts +18 -14
- package/src/modes/components/settings-defs.ts +10 -0
- package/src/modes/controllers/command-controller.ts +17 -0
- package/src/modes/controllers/event-controller.ts +14 -9
- package/src/modes/controllers/input-controller.ts +13 -1
- package/src/modes/interactive-mode.ts +44 -23
- package/src/modes/types.ts +5 -2
- package/src/modes/utils/context-usage.ts +294 -0
- package/src/prompts/tools/atom.md +99 -44
- package/src/prompts/tools/exit-plan-mode.md +5 -39
- package/src/prompts/tools/lsp.md +2 -3
- package/src/prompts/tools/recipe.md +16 -0
- package/src/prompts/tools/task.md +34 -147
- package/src/prompts/tools/todo-write.md +22 -64
- package/src/session/compaction/compaction.ts +35 -22
- package/src/session/session-dump-format.ts +1 -0
- package/src/slash-commands/builtin-registry.ts +12 -5
- package/src/tools/bash.ts +149 -115
- package/src/tools/debug.ts +57 -70
- package/src/tools/index.ts +11 -0
- package/src/tools/recipe/index.ts +80 -0
- package/src/tools/recipe/render.ts +19 -0
- package/src/tools/recipe/runner.ts +219 -0
- package/src/tools/recipe/runners/cargo.ts +131 -0
- package/src/tools/recipe/runners/index.ts +8 -0
- package/src/tools/recipe/runners/just.ts +73 -0
- package/src/tools/recipe/runners/make.ts +101 -0
- package/src/tools/recipe/runners/pkg.ts +165 -0
- package/src/tools/recipe/runners/task.ts +72 -0
- package/src/tools/renderers.ts +2 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as fs from "node:fs/promises";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { $which, isEnoent, logger } from "@oh-my-pi/pi-utils";
|
|
4
|
+
import type { DetectedRunner, RunnerTask, TaskRunner } from "../runner";
|
|
5
|
+
|
|
6
|
+
interface TaskListEntry {
|
|
7
|
+
name?: string;
|
|
8
|
+
desc?: string;
|
|
9
|
+
summary?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
interface TaskListJson {
|
|
13
|
+
tasks?: TaskListEntry[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const TASKFILE_NAMES = ["Taskfile.yml", "Taskfile.yaml"] as const;
|
|
17
|
+
|
|
18
|
+
async function hasTaskfile(cwd: string): Promise<boolean> {
|
|
19
|
+
for (const name of TASKFILE_NAMES) {
|
|
20
|
+
try {
|
|
21
|
+
const stat = await fs.stat(path.join(cwd, name));
|
|
22
|
+
if (stat.isFile()) return true;
|
|
23
|
+
} catch (err) {
|
|
24
|
+
if (!isEnoent(err)) throw err;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function listTaskfileTasks(cwd: string): Promise<RunnerTask[] | null> {
|
|
31
|
+
try {
|
|
32
|
+
const proc = Bun.spawn(["task", "--list-all", "--json"], {
|
|
33
|
+
cwd,
|
|
34
|
+
stdin: "ignore",
|
|
35
|
+
stdout: "pipe",
|
|
36
|
+
stderr: "pipe",
|
|
37
|
+
});
|
|
38
|
+
const [stdout, exit] = await Promise.all([new Response(proc.stdout).text(), proc.exited]);
|
|
39
|
+
if (exit !== 0) return null;
|
|
40
|
+
const list = JSON.parse(stdout) as TaskListJson;
|
|
41
|
+
const tasks = (list.tasks ?? [])
|
|
42
|
+
.filter(
|
|
43
|
+
(task): task is TaskListEntry & { name: string } => typeof task.name === "string" && task.name.length > 0,
|
|
44
|
+
)
|
|
45
|
+
.map(task => {
|
|
46
|
+
const desc = typeof task.desc === "string" && task.desc.length > 0 ? task.desc : undefined;
|
|
47
|
+
const summary = typeof task.summary === "string" && task.summary.length > 0 ? task.summary : undefined;
|
|
48
|
+
return { name: task.name, doc: desc ?? summary, parameters: [] };
|
|
49
|
+
});
|
|
50
|
+
return tasks.length > 0 ? tasks : null;
|
|
51
|
+
} catch (err) {
|
|
52
|
+
logger.debug("task runner list failed", { error: err instanceof Error ? err.message : String(err) });
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const taskRunner: TaskRunner = {
|
|
58
|
+
id: "task",
|
|
59
|
+
label: "Task",
|
|
60
|
+
async detect(cwd: string): Promise<DetectedRunner | null> {
|
|
61
|
+
try {
|
|
62
|
+
if (!$which("task")) return null;
|
|
63
|
+
if (!(await hasTaskfile(cwd))) return null;
|
|
64
|
+
const tasks = await listTaskfileTasks(cwd);
|
|
65
|
+
if (!tasks || tasks.length === 0) return null;
|
|
66
|
+
return { id: "task", label: "Task", commandPrefix: "task", tasks };
|
|
67
|
+
} catch (err) {
|
|
68
|
+
logger.debug("task runner probe failed", { error: err instanceof Error ? err.message : String(err) });
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
};
|
package/src/tools/renderers.ts
CHANGED
|
@@ -23,6 +23,7 @@ import { jobToolRenderer } from "./job";
|
|
|
23
23
|
import { notebookToolRenderer } from "./notebook";
|
|
24
24
|
import { pythonToolRenderer } from "./python";
|
|
25
25
|
import { readToolRenderer } from "./read";
|
|
26
|
+
import { recipeToolRenderer } from "./recipe/render";
|
|
26
27
|
import { resolveToolRenderer } from "./resolve";
|
|
27
28
|
import { searchToolRenderer } from "./search";
|
|
28
29
|
import { searchToolBm25Renderer } from "./search-tool-bm25";
|
|
@@ -48,6 +49,7 @@ export const toolRenderers: Record<string, ToolRenderer> = {
|
|
|
48
49
|
ast_grep: astGrepToolRenderer as ToolRenderer,
|
|
49
50
|
ast_edit: astEditToolRenderer as ToolRenderer,
|
|
50
51
|
bash: bashToolRenderer as ToolRenderer,
|
|
52
|
+
recipe: recipeToolRenderer as ToolRenderer,
|
|
51
53
|
debug: debugToolRenderer as ToolRenderer,
|
|
52
54
|
python: pythonToolRenderer as ToolRenderer,
|
|
53
55
|
calc: calculatorToolRenderer as ToolRenderer,
|