@oh-my-pi/pi-coding-agent 4.2.0 → 4.2.2
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 +46 -0
- package/docs/sdk.md +5 -5
- package/examples/sdk/10-settings.ts +2 -2
- package/package.json +5 -5
- package/src/capability/fs.ts +90 -0
- package/src/capability/index.ts +41 -227
- package/src/capability/types.ts +1 -11
- package/src/cli/args.ts +4 -0
- package/src/core/agent-session.ts +7 -7
- package/src/core/agent-storage.ts +50 -0
- package/src/core/auth-storage.ts +102 -3
- package/src/core/bash-executor.ts +1 -1
- package/src/core/custom-tools/loader.ts +2 -2
- package/src/core/export-html/index.ts +1 -33
- package/src/core/extensions/loader.ts +2 -2
- package/src/core/extensions/types.ts +1 -1
- package/src/core/hooks/loader.ts +2 -2
- package/src/core/mcp/config.ts +2 -2
- package/src/core/model-registry.ts +46 -0
- package/src/core/sdk.ts +37 -29
- package/src/core/settings-manager.ts +152 -135
- package/src/core/skills.ts +72 -51
- package/src/core/slash-commands.ts +3 -3
- package/src/core/system-prompt.ts +52 -10
- package/src/core/tools/complete.ts +5 -2
- package/src/core/tools/edit.ts +7 -4
- package/src/core/tools/index.test.ts +16 -0
- package/src/core/tools/index.ts +21 -8
- package/src/core/tools/lsp/index.ts +4 -1
- package/src/core/tools/ssh.ts +6 -6
- package/src/core/tools/task/commands.ts +3 -9
- package/src/core/tools/task/executor.ts +88 -3
- package/src/core/tools/task/index.ts +4 -0
- package/src/core/tools/task/model-resolver.ts +10 -7
- package/src/core/tools/task/worker-protocol.ts +48 -2
- package/src/core/tools/task/worker.ts +152 -7
- package/src/core/tools/write.ts +7 -4
- package/src/discovery/agents-md.ts +13 -19
- package/src/discovery/builtin.ts +368 -293
- package/src/discovery/claude.ts +183 -345
- package/src/discovery/cline.ts +30 -10
- package/src/discovery/codex.ts +188 -272
- package/src/discovery/cursor.ts +106 -121
- package/src/discovery/gemini.ts +72 -97
- package/src/discovery/github.ts +7 -10
- package/src/discovery/helpers.ts +114 -57
- package/src/discovery/index.ts +1 -2
- package/src/discovery/mcp-json.ts +15 -18
- package/src/discovery/ssh.ts +9 -17
- package/src/discovery/vscode.ts +10 -5
- package/src/discovery/windsurf.ts +52 -86
- package/src/main.ts +5 -1
- package/src/modes/interactive/components/extensions/extension-dashboard.ts +24 -11
- package/src/modes/interactive/components/extensions/state-manager.ts +19 -15
- package/src/modes/interactive/controllers/selector-controller.ts +9 -5
- package/src/modes/interactive/interactive-mode.ts +22 -15
- package/src/prompts/agents/plan.md +107 -30
- package/src/prompts/agents/task.md +5 -4
- package/src/prompts/system/system-prompt.md +5 -0
- package/src/prompts/tools/task.md +25 -19
- package/src/utils/shell.ts +2 -2
- package/src/prompts/agents/architect-plan.md +0 -10
- package/src/prompts/agents/implement-with-critic.md +0 -11
- package/src/prompts/agents/implement.md +0 -11
package/src/discovery/cline.ts
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* Project-only (no user-level config).
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import { dirname, resolve } from "node:path";
|
|
9
|
+
import { readDirEntries, readFile } from "../capability/fs";
|
|
8
10
|
import { registerProvider } from "../capability/index";
|
|
9
11
|
import type { Rule } from "../capability/rule";
|
|
10
12
|
import { ruleCapability } from "../capability/rule";
|
|
@@ -15,23 +17,41 @@ const PROVIDER_ID = "cline";
|
|
|
15
17
|
const DISPLAY_NAME = "Cline";
|
|
16
18
|
const PRIORITY = 40;
|
|
17
19
|
|
|
20
|
+
async function findClinerules(startDir: string): Promise<{ path: string; isDir: boolean } | null> {
|
|
21
|
+
let current = resolve(startDir);
|
|
22
|
+
|
|
23
|
+
while (true) {
|
|
24
|
+
const entries = await readDirEntries(current);
|
|
25
|
+
const entry = entries.find((e) => e.name === ".clinerules");
|
|
26
|
+
if (entry) {
|
|
27
|
+
return {
|
|
28
|
+
path: resolve(current, ".clinerules"),
|
|
29
|
+
isDir: entry.isDirectory(),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const parent = dirname(current);
|
|
33
|
+
if (parent === current) return null;
|
|
34
|
+
current = parent;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
18
38
|
/**
|
|
19
39
|
* Load rules from .clinerules
|
|
20
40
|
*/
|
|
21
|
-
function loadRules(ctx: LoadContext): LoadResult<Rule
|
|
41
|
+
async function loadRules(ctx: LoadContext): Promise<LoadResult<Rule>> {
|
|
22
42
|
const items: Rule[] = [];
|
|
23
43
|
const warnings: string[] = [];
|
|
24
44
|
|
|
25
45
|
// Project-level only (Cline uses root-level .clinerules)
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
46
|
+
const found = await findClinerules(ctx.cwd);
|
|
47
|
+
if (!found) {
|
|
28
48
|
return { items, warnings };
|
|
29
49
|
}
|
|
30
50
|
|
|
31
51
|
// Check if .clinerules is a directory or file
|
|
32
|
-
if (
|
|
52
|
+
if (found.isDir) {
|
|
33
53
|
// Directory format: load all *.md files
|
|
34
|
-
const result = loadFilesFromDir(ctx,
|
|
54
|
+
const result = await loadFilesFromDir(ctx, found.path, PROVIDER_ID, "project", {
|
|
35
55
|
extensions: ["md"],
|
|
36
56
|
transform: (name, content, path, source) => {
|
|
37
57
|
const { frontmatter, body } = parseFrontmatter(content);
|
|
@@ -60,16 +80,16 @@ function loadRules(ctx: LoadContext): LoadResult<Rule> {
|
|
|
60
80
|
|
|
61
81
|
items.push(...result.items);
|
|
62
82
|
if (result.warnings) warnings.push(...result.warnings);
|
|
63
|
-
} else
|
|
83
|
+
} else {
|
|
64
84
|
// Single file format
|
|
65
|
-
const content =
|
|
85
|
+
const content = await readFile(found.path);
|
|
66
86
|
if (content === null) {
|
|
67
|
-
warnings.push(`Failed to read .clinerules at ${
|
|
87
|
+
warnings.push(`Failed to read .clinerules at ${found.path}`);
|
|
68
88
|
return { items, warnings };
|
|
69
89
|
}
|
|
70
90
|
|
|
71
91
|
const { frontmatter, body } = parseFrontmatter(content);
|
|
72
|
-
const source = createSourceMeta(PROVIDER_ID,
|
|
92
|
+
const source = createSourceMeta(PROVIDER_ID, found.path, "project");
|
|
73
93
|
|
|
74
94
|
// Parse globs (can be array or single string)
|
|
75
95
|
let globs: string[] | undefined;
|
|
@@ -81,7 +101,7 @@ function loadRules(ctx: LoadContext): LoadResult<Rule> {
|
|
|
81
101
|
|
|
82
102
|
items.push({
|
|
83
103
|
name: "clinerules",
|
|
84
|
-
path:
|
|
104
|
+
path: found.path,
|
|
85
105
|
content: body,
|
|
86
106
|
globs,
|
|
87
107
|
alwaysApply: typeof frontmatter.alwaysApply === "boolean" ? frontmatter.alwaysApply : undefined,
|