@yandy0725/pi-coding-tools 0.1.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/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # pi-coding-tools
2
+
3
+ Pi package providing the `apply_patch` tool and enabling `ls`/`find`/`grep` built-in tools.
4
+
5
+ ## Features
6
+
7
+ - **apply_patch**: Apply Codex-style patches to files (add/update/delete/move) using a freeform grammar — no JSON wrapping needed.
8
+ - **ls/find/grep**: Enables these built-in tools that are off by default.
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ pi install npm:@yandy0725/pi-coding-tools
14
+ ```
15
+
16
+ ## Configuration
17
+
18
+ Configuration files control which tools are enabled. All default to `true`.
19
+
20
+ ### Global config
21
+
22
+ `~/.pi/agent/coding-tools.json`:
23
+
24
+ ```json
25
+ {
26
+ "applyPatch": true,
27
+ "ls": true,
28
+ "find": true,
29
+ "grep": true
30
+ }
31
+ ```
32
+
33
+ ### Project config
34
+
35
+ `<project>/.pi/coding-tools.json` (overrides global):
36
+
37
+ ```json
38
+ {
39
+ "grep": false
40
+ }
41
+ ```
42
+
43
+ ### Fields
44
+
45
+ | Field | Default | Description |
46
+ |-------|---------|-------------|
47
+ | `applyPatch` | `true` | Register the `apply_patch` tool |
48
+ | `ls` | `true` | Enable the `ls` built-in tool |
49
+ | `find` | `true` | Enable the `find` built-in tool |
50
+ | `grep` | `true` | Enable the `grep` built-in tool |
51
+
52
+ ## Patch Format
53
+
54
+ The `apply_patch` tool uses Codex text format:
55
+
56
+ ```
57
+ *** Begin Patch
58
+ *** Add File: new.txt
59
+ +Hello, World!
60
+ *** Update File: existing.ts
61
+ @@ function foo() {
62
+ -old line
63
+ +new line
64
+ *** Delete File: old.txt
65
+ *** End Patch
66
+ ```
67
+
68
+ See the [Codex apply_patch documentation](https://github.com/code-yeongyu/pi-apply-patch) for full syntax details.
package/index.ts ADDED
@@ -0,0 +1,16 @@
1
+ import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+ import { createApplyPatchTool } from "./src/apply-patch-tool";
3
+ import { loadConfig } from "./src/config";
4
+ import { enableSearchTools } from "./src/search-tools";
5
+
6
+ export default function (pi: ExtensionAPI) {
7
+ const config = loadConfig();
8
+
9
+ if (config.applyPatch) {
10
+ pi.registerTool(createApplyPatchTool());
11
+ }
12
+
13
+ pi.on("session_start", async (_event, _ctx) => {
14
+ enableSearchTools(pi, config);
15
+ });
16
+ }
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@yandy0725/pi-coding-tools",
3
+ "publishConfig": {
4
+ "access": "public"
5
+ },
6
+ "version": "0.1.0",
7
+ "description": "pi package providing apply_patch tool and enabling ls/find/grep built-in tools",
8
+ "license": "MIT",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/yandy/pi-packages",
12
+ "directory": "pi-coding-tools"
13
+ },
14
+ "type": "module",
15
+ "keywords": [
16
+ "pi-package"
17
+ ],
18
+ "files": [
19
+ "index.ts",
20
+ "src/"
21
+ ],
22
+ "scripts": {
23
+ "test": "vitest run",
24
+ "test:watch": "vitest",
25
+ "typecheck": "tsc --noEmit",
26
+ "lint": "biome lint .",
27
+ "format": "biome format --write .",
28
+ "check": "biome check ."
29
+ },
30
+ "pi": {
31
+ "extensions": [
32
+ "./index.ts"
33
+ ]
34
+ },
35
+ "peerDependencies": {
36
+ "@earendil-works/pi-coding-agent": ">=0.74.0"
37
+ },
38
+ "dependencies": {
39
+ "@earendil-works/pi-tui": "^0.79.9",
40
+ "diff": "^9.0.0",
41
+ "typebox": "^1.1.0"
42
+ },
43
+ "devDependencies": {
44
+ "@biomejs/biome": "^2.5.0",
45
+ "@types/diff": "^8.0.0",
46
+ "@types/node": "^22.0.0",
47
+ "typescript": "~5.7.0",
48
+ "vitest": "^3.0.0"
49
+ }
50
+ }