decorated-pi 0.7.0 → 0.7.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/README.md +38 -12
- package/hooks/inject-agents-md.ts +20 -12
- package/hooks/mcp.ts +61 -64
- package/hooks/pi-tool-filter.ts +2 -1
- package/hooks/rtk.ts +3 -2
- package/hooks/skeleton.ts +46 -18
- package/hooks/smart-at.ts +122 -264
- package/hooks/wakatime.ts +3 -2
- package/index.ts +117 -3
- package/package.json +9 -4
- package/settings.ts +5 -3
- package/skills/pi-docs/SKILL.md +13 -0
- package/tools/lsp/tools.ts +0 -1
- package/tools/mcp/builtin/codegraph.ts +1 -1
- package/tools/mcp/client.ts +1 -1
- package/tools/patch/core.ts +17 -1
- package/tools/patch/index.ts +338 -225
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "decorated-pi",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "decorated-pi is a practical enhancement pack for pi coding agent — token-efficient workflow, cache-friendly design, and smarter tools.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi",
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
"lsp",
|
|
13
13
|
"lsp-client",
|
|
14
14
|
"secret-redaction",
|
|
15
|
-
"codegraph"
|
|
15
|
+
"codegraph",
|
|
16
|
+
"fff",
|
|
17
|
+
"fuzzy-search"
|
|
16
18
|
],
|
|
17
19
|
"license": "MIT",
|
|
18
20
|
"repository": {
|
|
@@ -22,6 +24,7 @@
|
|
|
22
24
|
"homepage": "https://github.com/lcwecker/decorated-pi#readme",
|
|
23
25
|
"bugs": "https://github.com/lcwecker/decorated-pi/issues",
|
|
24
26
|
"dependencies": {
|
|
27
|
+
"@ff-labs/fff-node": "^0.9.4",
|
|
25
28
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
26
29
|
"file-type": "^21.3.4",
|
|
27
30
|
"openai": "^6.37.0"
|
|
@@ -39,13 +42,15 @@
|
|
|
39
42
|
},
|
|
40
43
|
"devDependencies": {
|
|
41
44
|
"@types/node": "^22.15.3",
|
|
45
|
+
"@vitest/coverage-v8": "4.1.8",
|
|
42
46
|
"depcheck": "^1.4.7",
|
|
43
47
|
"publint": "^0.3.21",
|
|
44
|
-
"vitest": "
|
|
48
|
+
"vitest": "4.1.8"
|
|
45
49
|
},
|
|
46
50
|
"scripts": {
|
|
47
51
|
"prepack": "depcheck --fail-on-missing",
|
|
48
|
-
"test": "vitest run",
|
|
52
|
+
"test": "vitest run --coverage",
|
|
53
|
+
"bench": "vitest bench --run",
|
|
49
54
|
"typecheck": "tsc --noEmit",
|
|
50
55
|
"prepublishOnly": "npm install --no-audit --no-fund && npm test && npm run typecheck && depcheck --fail-on-missing && publint"
|
|
51
56
|
}
|
package/settings.ts
CHANGED
|
@@ -82,9 +82,11 @@ export function loadConfig(): DecoratedPiConfig {
|
|
|
82
82
|
try {
|
|
83
83
|
if (fs.existsSync(CONFIG_FILE)) {
|
|
84
84
|
const config = JSON.parse(fs.readFileSync(CONFIG_FILE, "utf-8")) as DecoratedPiConfig;
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
// Mutate in place. Do NOT call saveConfig here — saveConfig calls
|
|
86
|
+
// loadConfig first, which would re-trigger the migration (and the
|
|
87
|
+
// file on disk hasn't been written yet), causing deep recursion.
|
|
88
|
+
// The migrated shape is persisted on the next explicit saveConfig.
|
|
89
|
+
migrateModuleSettings(config);
|
|
88
90
|
return config;
|
|
89
91
|
}
|
|
90
92
|
} catch {}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pi-docs
|
|
3
|
+
description: pi docs resources
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Pi documentation (read only when the user asks about pi itself, its SDK, extensions, themes, skills, or TUI):
|
|
7
|
+
- Main documentation: /home/liuchang/.local/share/fnm/node-versions/v24.14.0/installation/lib/node_modules/@earendil-works/pi-coding-agent/README.md
|
|
8
|
+
- Additional docs: /home/liuchang/.local/share/fnm/node-versions/v24.14.0/installation/lib/node_modules/@earendil-works/pi-coding-agent/docs
|
|
9
|
+
- Examples: /home/liuchang/.local/share/fnm/node-versions/v24.14.0/installation/lib/node_modules/@earendil-works/pi-coding-agent/examples (extensions, custom tools, SDK)
|
|
10
|
+
- When reading pi docs or examples, resolve docs/... under Additional docs and examples/... under Examples, not the current working directory
|
|
11
|
+
- When asked about: extensions (docs/extensions.md, examples/extensions/), themes (docs/themes.md), skills (docs/skills.md), prompt templates (docs/prompt-templates.md), TUI components (docs/tui.md), keybindings (docs/keybindings.md), SDK integrations (docs/sdk.md), custom providers (docs/custom-provider.md), adding models (docs/models.md), pi packages (docs/packages.md)
|
|
12
|
+
- When working on pi topics, read the docs and examples, and follow .md cross-references before implementing
|
|
13
|
+
- Always read pi .md files completely and follow links to related docs (e.g., tui.md for TUI API details)
|
package/tools/lsp/tools.ts
CHANGED
|
@@ -69,7 +69,6 @@ function severityLabel(s: number): string {
|
|
|
69
69
|
// ─── Register tools ───────────────────────────────────────────────────────
|
|
70
70
|
|
|
71
71
|
export function registerLspTools(pi: ExtensionAPI, manager: LspServerManager) {
|
|
72
|
-
|
|
73
72
|
// ── lsp_diagnostics ────────────────────────────────────────────────────
|
|
74
73
|
pi.registerTool({
|
|
75
74
|
name: "lsp_diagnostics",
|
|
@@ -14,7 +14,7 @@ export const CODEGRAPH_BUILTIN: Omit<McpServerConfig, "source"> = {
|
|
|
14
14
|
name: "codegraph",
|
|
15
15
|
command: "codegraph",
|
|
16
16
|
args: ["serve", "--mcp"],
|
|
17
|
-
enabled:
|
|
17
|
+
enabled: true,
|
|
18
18
|
description:
|
|
19
19
|
"Local code knowledge graph (colbymchenry/codegraph). Enable via /mcp.",
|
|
20
20
|
canUseInProject: (cwd: string) => fs.existsSync(path.join(cwd, ".codegraph")),
|
package/tools/mcp/client.ts
CHANGED
|
@@ -16,7 +16,7 @@ export class McpConnection {
|
|
|
16
16
|
client: Client;
|
|
17
17
|
transport: StreamableHTTPClientTransport | SSEClientTransport | StdioClientTransport | undefined;
|
|
18
18
|
tools: McpToolSpec[] = [];
|
|
19
|
-
|
|
19
|
+
connected = false;
|
|
20
20
|
|
|
21
21
|
source: string = "unknown";
|
|
22
22
|
|
package/tools/patch/core.ts
CHANGED
|
@@ -1076,12 +1076,18 @@ interface LineRange {
|
|
|
1076
1076
|
endLine: number;
|
|
1077
1077
|
}
|
|
1078
1078
|
|
|
1079
|
-
/** Build line offset table: offsets[i] = character offset of line i+1 (1-based)
|
|
1079
|
+
/** Build line offset table: offsets[i] = character offset of line i+1 (1-based).
|
|
1080
|
+
* If the content does not end with a newline, the final line has no
|
|
1081
|
+
* trailing marker; push an extra offset at content.length so callers
|
|
1082
|
+
* like lineAtOffset / extractLineRange handle the last line correctly. */
|
|
1080
1083
|
function buildLineOffsets(content: string): number[] {
|
|
1081
1084
|
const offsets = [0];
|
|
1082
1085
|
for (let i = 0; i < content.length; i++) {
|
|
1083
1086
|
if (content[i] === "\n") offsets.push(i + 1);
|
|
1084
1087
|
}
|
|
1088
|
+
if (content.length > 0 && content[content.length - 1] !== "\n") {
|
|
1089
|
+
offsets.push(content.length);
|
|
1090
|
+
}
|
|
1085
1091
|
return offsets;
|
|
1086
1092
|
}
|
|
1087
1093
|
|
|
@@ -1515,3 +1521,13 @@ function truncate(s: string, maxLen = 60): string {
|
|
|
1515
1521
|
if (firstLine.length <= maxLen) return firstLine;
|
|
1516
1522
|
return firstLine.slice(0, maxLen - 3) + "...";
|
|
1517
1523
|
}
|
|
1524
|
+
|
|
1525
|
+
// Test exports
|
|
1526
|
+
export const __patchCoreTest = {
|
|
1527
|
+
charOffsetToLine,
|
|
1528
|
+
detectTabWidth,
|
|
1529
|
+
normalizeIndentForFuzzy,
|
|
1530
|
+
truncate,
|
|
1531
|
+
collapseSequentialReplacements,
|
|
1532
|
+
generateReplacementDiff,
|
|
1533
|
+
};
|