@cortexkit/aft-pi 0.14.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 +143 -0
- package/dist/bridge.d.ts +63 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/commands/aft-status.d.ts +11 -0
- package/dist/commands/aft-status.d.ts.map +1 -0
- package/dist/config.d.ts +33 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/downloader.d.ts +35 -0
- package/dist/downloader.d.ts.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2294 -0
- package/dist/logger.d.ts +5 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/onnx-runtime.d.ts +35 -0
- package/dist/onnx-runtime.d.ts.map +1 -0
- package/dist/platform.d.ts +6 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/pool.d.ts +33 -0
- package/dist/pool.d.ts.map +1 -0
- package/dist/resolver.d.ts +11 -0
- package/dist/resolver.d.ts.map +1 -0
- package/dist/shared/discover-files.d.ts +5 -0
- package/dist/shared/discover-files.d.ts.map +1 -0
- package/dist/shared/status.d.ts +44 -0
- package/dist/shared/status.d.ts.map +1 -0
- package/dist/shutdown-hooks.d.ts +18 -0
- package/dist/shutdown-hooks.d.ts.map +1 -0
- package/dist/tools/_shared.d.ts +27 -0
- package/dist/tools/_shared.d.ts.map +1 -0
- package/dist/tools/ast.d.ts +12 -0
- package/dist/tools/ast.d.ts.map +1 -0
- package/dist/tools/conflicts.d.ts +7 -0
- package/dist/tools/conflicts.d.ts.map +1 -0
- package/dist/tools/fs.d.ts +12 -0
- package/dist/tools/fs.d.ts.map +1 -0
- package/dist/tools/hoisted.d.ts +15 -0
- package/dist/tools/hoisted.d.ts.map +1 -0
- package/dist/tools/imports.d.ts +8 -0
- package/dist/tools/imports.d.ts.map +1 -0
- package/dist/tools/lsp.d.ts +9 -0
- package/dist/tools/lsp.d.ts.map +1 -0
- package/dist/tools/navigate.d.ts +8 -0
- package/dist/tools/navigate.d.ts.map +1 -0
- package/dist/tools/reading.d.ts +12 -0
- package/dist/tools/reading.d.ts.map +1 -0
- package/dist/tools/refactor.d.ts +8 -0
- package/dist/tools/refactor.d.ts.map +1 -0
- package/dist/tools/safety.d.ts +7 -0
- package/dist/tools/safety.d.ts.map +1 -0
- package/dist/tools/semantic.d.ts +9 -0
- package/dist/tools/semantic.d.ts.map +1 -0
- package/dist/tools/structure.d.ts +8 -0
- package/dist/tools/structure.d.ts.map +1 -0
- package/dist/types.d.ts +13 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +53 -0
package/README.md
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# @cortexkit/aft-pi
|
|
2
|
+
|
|
3
|
+
**AFT (Agent File Tools) extension for the [Pi coding agent](https://github.com/badlogic/pi-mono)**
|
|
4
|
+
|
|
5
|
+
AFT is a high-performance file-manipulation toolkit for AI coding agents. It replaces Pi's built-in `read`, `write`, `edit`, and `grep` tools with an indexed Rust backend that adds trigram search, semantic search, fuzzy edits, auto-format, LSP diagnostics, call-graph navigation, and more — all backed by one warm long-running `aft` process per session.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pi install npm:@cortexkit/aft-pi
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
That's it. The extension auto-downloads the right AFT binary for your platform on first run (cached at `~/.cache/aft/bin/v<version>/aft`).
|
|
14
|
+
|
|
15
|
+
Prefer to pin a specific version?
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pi install npm:@cortexkit/aft-pi@0.13.1
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## What you get
|
|
22
|
+
|
|
23
|
+
### Hoisted built-in overrides
|
|
24
|
+
|
|
25
|
+
Pi's default `read`, `write`, `edit`, and `grep` are replaced with AFT-backed versions.
|
|
26
|
+
|
|
27
|
+
| Tool | Pi built-in | AFT replacement |
|
|
28
|
+
| ------- | ------------------------ | -------------------------------------------------------------------------------------------- |
|
|
29
|
+
| `read` | Node `fs.readFile` | Rust reader with line-numbered output, directory listing, binary/image detection |
|
|
30
|
+
| `write` | Node `fs.writeFile` | Atomic write with per-file backup, auto-format (biome/prettier/ruff/rustfmt), LSP diagnostics |
|
|
31
|
+
| `edit` | Plain substring replace | Progressive fuzzy match (handles whitespace/Unicode drift), dry-run, glob-wide edits |
|
|
32
|
+
| `grep` | ripgrep shell-out | Trigram-indexed search in-project, ripgrep fallback outside project root |
|
|
33
|
+
|
|
34
|
+
All four keep the same agent-facing parameters as Pi's built-ins, so your prompts, skills, and muscle memory don't change.
|
|
35
|
+
|
|
36
|
+
### AFT-specific tools
|
|
37
|
+
|
|
38
|
+
| Tool | What it does |
|
|
39
|
+
| ------------------- | --------------------------------------------------------------------------------- |
|
|
40
|
+
| `aft_outline` | Structural outline (functions, classes, headings) for files or directories |
|
|
41
|
+
| `aft_zoom` | Symbol-level inspection with call-graph annotations |
|
|
42
|
+
| `aft_search` | Semantic code search (embeddings, local ONNX or OpenAI-compatible) |
|
|
43
|
+
| `aft_navigate` | Call-graph navigation: callers, call_tree, impact, trace_to, trace_data |
|
|
44
|
+
| `aft_conflicts` | One-call merge-conflict inspection across all conflicted files |
|
|
45
|
+
| `aft_import` | Language-aware import add / remove / organize (TS, JS, Python, Rust, Go) |
|
|
46
|
+
| `aft_safety` | Per-file undo, named checkpoints, restore |
|
|
47
|
+
| `ast_grep_search` | AST-aware pattern search across the filesystem |
|
|
48
|
+
| `ast_grep_replace` | AST-aware pattern rewrite |
|
|
49
|
+
| `lsp_diagnostics` | On-demand LSP diagnostics (edit/write already inline diagnostics automatically) |
|
|
50
|
+
| `aft_delete` | Delete a file with backup (surface: `all`) |
|
|
51
|
+
| `aft_move` | Move/rename a file (surface: `all`) |
|
|
52
|
+
| `aft_transform` | Scope-aware structural transformations (surface: `all`) |
|
|
53
|
+
| `aft_refactor` | Workspace-wide refactor: move symbol, extract function, inline call (surface: `all`) |
|
|
54
|
+
|
|
55
|
+
### Slash command
|
|
56
|
+
|
|
57
|
+
- `/aft-status` — show AFT version, search/semantic index state, LSP servers, storage paths
|
|
58
|
+
|
|
59
|
+
## Configure
|
|
60
|
+
|
|
61
|
+
AFT reads config from two levels, project overrides user:
|
|
62
|
+
|
|
63
|
+
- **User:** `~/.pi/agent/aft.jsonc` (or `.json`)
|
|
64
|
+
- **Project:** `<project>/.pi/aft.jsonc` (or `.json`)
|
|
65
|
+
|
|
66
|
+
All keys are optional. Example:
|
|
67
|
+
|
|
68
|
+
```jsonc
|
|
69
|
+
{
|
|
70
|
+
// "minimal" | "recommended" (default) | "all"
|
|
71
|
+
"tool_surface": "recommended",
|
|
72
|
+
|
|
73
|
+
// Auto-format on write/edit using project formatter config.
|
|
74
|
+
"format_on_edit": true,
|
|
75
|
+
|
|
76
|
+
// "syntax" (tree-sitter parse) | "full" (LSP typecheck)
|
|
77
|
+
"validate_on_edit": "syntax",
|
|
78
|
+
|
|
79
|
+
// When true, write-capable commands reject paths outside project_root.
|
|
80
|
+
// Defaults to false to match Pi's built-in behavior.
|
|
81
|
+
"restrict_to_project_root": false,
|
|
82
|
+
|
|
83
|
+
// Enable the trigram-indexed grep/glob (hoists them when true).
|
|
84
|
+
"experimental_search_index": true,
|
|
85
|
+
|
|
86
|
+
// Enable semantic search (aft_search). Requires ONNX runtime for local
|
|
87
|
+
// embeddings; downloaded automatically on supported platforms.
|
|
88
|
+
"experimental_semantic_search": true,
|
|
89
|
+
|
|
90
|
+
// Disable specific tool names (applied after tool_surface selection).
|
|
91
|
+
"disabled_tools": ["aft_transform", "aft_refactor"],
|
|
92
|
+
|
|
93
|
+
"formatter": {
|
|
94
|
+
"typescript": "biome",
|
|
95
|
+
"python": "ruff",
|
|
96
|
+
"rust": "rustfmt"
|
|
97
|
+
},
|
|
98
|
+
"checker": {
|
|
99
|
+
"typescript": "biome"
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
// Semantic backend (when experimental_semantic_search=true).
|
|
103
|
+
// "fastembed" (default, local ONNX) | "openai_compatible" | "ollama"
|
|
104
|
+
"semantic": {
|
|
105
|
+
"backend": "fastembed",
|
|
106
|
+
"model": "all-MiniLM-L6-v2",
|
|
107
|
+
"timeout_ms": 25000,
|
|
108
|
+
"max_batch_size": 64
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Sensitive semantic backend fields (`backend`, `base_url`, `api_key_env`) are only read from **user-level** config. Project configs that try to set them are ignored with a warning to prevent credential-exfiltration via malicious repos.
|
|
114
|
+
|
|
115
|
+
### Tool surface tiers
|
|
116
|
+
|
|
117
|
+
| Tier | Tools |
|
|
118
|
+
| ----------------- | ----------------------------------------------------------------------------------------------------------------------- |
|
|
119
|
+
| `minimal` | `aft_outline`, `aft_zoom`, `aft_safety` |
|
|
120
|
+
| `recommended` (default) | `minimal` + hoisted `read`/`write`/`edit` + `aft_import` + `ast_grep_*` + `lsp_diagnostics` + `aft_conflicts` + (optional) `grep` + (optional) `aft_search` |
|
|
121
|
+
| `all` | `recommended` + `aft_navigate` + `aft_delete` + `aft_move` + `aft_transform` + `aft_refactor` |
|
|
122
|
+
|
|
123
|
+
## Architecture
|
|
124
|
+
|
|
125
|
+
- **One persistent Rust process per session.** Pi loads the extension once per session; AFT spawns one `aft` binary for the session's working directory and keeps it alive. Trigram index, semantic index, tree-sitter caches, and LSP servers all stay warm.
|
|
126
|
+
- **NDJSON bridge.** The TypeScript extension talks to the Rust binary over stdin/stdout using a versioned JSON-RPC-style protocol.
|
|
127
|
+
- **Session isolation.** Pi's `session_shutdown` event triggers clean bridge shutdown — undo history, checkpoints, and LSP state don't leak across sessions.
|
|
128
|
+
- **Auto-download + version check.** Each plugin version pins a compatible binary version and resolves it in order: versioned cache → platform npm package → `PATH` → `~/.cargo/bin/aft` → GitHub release download. Mismatched binaries hot-swap transparently.
|
|
129
|
+
|
|
130
|
+
## Logs
|
|
131
|
+
|
|
132
|
+
Plugin logs go to `$TMPDIR/aft-pi.log`. Rust backend logs are forwarded into the same file with an `[aft]` tag.
|
|
133
|
+
|
|
134
|
+
Set `AFT_LOG_STDERR=1` to route logs to stderr instead (useful for piping or subprocess tests).
|
|
135
|
+
|
|
136
|
+
## License
|
|
137
|
+
|
|
138
|
+
MIT
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
**Main project:** https://github.com/cortexkit/aft
|
|
143
|
+
**Issues / feature requests:** https://github.com/cortexkit/aft/issues
|
package/dist/bridge.d.ts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export interface BridgeOptions {
|
|
2
|
+
/** Request timeout in milliseconds. Default: 30000 */
|
|
3
|
+
timeoutMs?: number;
|
|
4
|
+
/** Maximum restart attempts before giving up. Default: 3 */
|
|
5
|
+
maxRestarts?: number;
|
|
6
|
+
/** Minimum binary version required (semver). If the binary is older, onVersionMismatch is called. */
|
|
7
|
+
minVersion?: string;
|
|
8
|
+
/** Called when binary version is older than minVersion. Receives (binaryVersion, minVersion). */
|
|
9
|
+
onVersionMismatch?: (binaryVersion: string, minVersion: string) => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Manages a persistent `aft` child process, communicating via NDJSON over
|
|
13
|
+
* stdin/stdout. Lazy-spawns on first `send()` call. Handles crash detection
|
|
14
|
+
* with exponential backoff auto-restart.
|
|
15
|
+
*/
|
|
16
|
+
export declare class BinaryBridge {
|
|
17
|
+
private static readonly RESTART_RESET_MS;
|
|
18
|
+
/** How many recent stderr lines to keep for crash diagnostics. */
|
|
19
|
+
private static readonly STDERR_TAIL_MAX;
|
|
20
|
+
private binaryPath;
|
|
21
|
+
private cwd;
|
|
22
|
+
private process;
|
|
23
|
+
private pending;
|
|
24
|
+
private nextId;
|
|
25
|
+
private stdoutBuffer;
|
|
26
|
+
/** Ring buffer of the last N stderr lines, cleared on every spawn. */
|
|
27
|
+
private stderrTail;
|
|
28
|
+
private _restartCount;
|
|
29
|
+
private _shuttingDown;
|
|
30
|
+
private timeoutMs;
|
|
31
|
+
private maxRestarts;
|
|
32
|
+
private configured;
|
|
33
|
+
private _configurePromise;
|
|
34
|
+
private configOverrides;
|
|
35
|
+
private minVersion;
|
|
36
|
+
private onVersionMismatch;
|
|
37
|
+
private restartResetTimer;
|
|
38
|
+
constructor(binaryPath: string, cwd: string, options?: BridgeOptions, configOverrides?: Record<string, unknown>);
|
|
39
|
+
/** Number of times the binary has been restarted after a crash. */
|
|
40
|
+
get restartCount(): number;
|
|
41
|
+
/** Whether the child process is currently alive. */
|
|
42
|
+
isAlive(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Send a command to the binary and return the parsed response.
|
|
45
|
+
* Lazy-spawns the binary on first call.
|
|
46
|
+
*/
|
|
47
|
+
send(command: string, params?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
48
|
+
/** Kill the child process and reject all pending requests. */
|
|
49
|
+
shutdown(): Promise<void>;
|
|
50
|
+
/** Query binary version and compare against minVersion. Calls onVersionMismatch if outdated. */
|
|
51
|
+
private checkVersion;
|
|
52
|
+
private ensureSpawned;
|
|
53
|
+
private spawnProcess;
|
|
54
|
+
private pushStderrLine;
|
|
55
|
+
private formatStderrTail;
|
|
56
|
+
private onStdoutData;
|
|
57
|
+
private handleTimeout;
|
|
58
|
+
private handleCrash;
|
|
59
|
+
private rejectAllPending;
|
|
60
|
+
private scheduleRestartCountReset;
|
|
61
|
+
private clearRestartResetTimer;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=bridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AA0EA,MAAM,WAAW,aAAa;IAC5B,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qGAAqG;IACrG,UAAU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O,CAAC,CAAC;IAsFnC,8DAA8D;IACxD,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IA4B/B,gGAAgG;YAClF,YAAY;IAoB1B,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,YAAY;IA0GpB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,YAAY;IA4BpB,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,WAAW;IAoCnB,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,yBAAyB;IAQjC,OAAO,CAAC,sBAAsB;CAM/B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* /aft-status — show AFT status (version, indexes, LSP, storage).
|
|
3
|
+
*
|
|
4
|
+
* In interactive mode this opens as an input dialog (read-only preview of
|
|
5
|
+
* a formatted snapshot). When UI is unavailable (print / RPC mode), we fall
|
|
6
|
+
* back to a notification.
|
|
7
|
+
*/
|
|
8
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
9
|
+
import type { PluginContext } from "../types.js";
|
|
10
|
+
export declare function registerStatusCommand(pi: ExtensionAPI, ctx: PluginContext): void;
|
|
11
|
+
//# sourceMappingURL=aft-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aft-status.d.ts","sourceRoot":"","sources":["../../src/commands/aft-status.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,YAAY,EAA2B,MAAM,+BAA+B,CAAC;AAG3F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,GAAG,IAAI,CA4BhF"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export type Formatter = "biome" | "prettier" | "deno" | "ruff" | "black" | "rustfmt" | "goimports" | "gofmt" | "none";
|
|
2
|
+
export type Checker = "tsc" | "biome" | "pyright" | "ruff" | "cargo" | "go" | "staticcheck" | "none";
|
|
3
|
+
export type SemanticBackend = "fastembed" | "openai_compatible" | "ollama";
|
|
4
|
+
export interface SemanticConfig {
|
|
5
|
+
backend?: SemanticBackend;
|
|
6
|
+
model?: string;
|
|
7
|
+
base_url?: string;
|
|
8
|
+
api_key_env?: string;
|
|
9
|
+
timeout_ms?: number;
|
|
10
|
+
max_batch_size?: number;
|
|
11
|
+
}
|
|
12
|
+
export type ToolSurface = "minimal" | "recommended" | "all";
|
|
13
|
+
export interface AftConfig {
|
|
14
|
+
format_on_edit?: boolean;
|
|
15
|
+
validate_on_edit?: "syntax" | "full";
|
|
16
|
+
formatter?: Record<string, Formatter>;
|
|
17
|
+
checker?: Record<string, Checker>;
|
|
18
|
+
tool_surface?: ToolSurface;
|
|
19
|
+
disabled_tools?: string[];
|
|
20
|
+
restrict_to_project_root?: boolean;
|
|
21
|
+
experimental_search_index?: boolean;
|
|
22
|
+
experimental_semantic_search?: boolean;
|
|
23
|
+
semantic?: SemanticConfig;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Load AFT config:
|
|
27
|
+
* 1. User-level: ~/.pi/agent/aft.jsonc (or .json)
|
|
28
|
+
* 2. Project-level: <project>/.pi/aft.jsonc (or .json)
|
|
29
|
+
*
|
|
30
|
+
* Project config merges on top of user config.
|
|
31
|
+
*/
|
|
32
|
+
export declare function loadAftConfig(projectDirectory: string): AftConfig;
|
|
33
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,SAAS,GACjB,OAAO,GACP,UAAU,GACV,MAAM,GACN,MAAM,GACN,OAAO,GACP,SAAS,GACT,WAAW,GACX,OAAO,GACP,MAAM,CAAC;AAEX,MAAM,MAAM,OAA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* 2. npm platform package (@cortexkit/aft-darwin-arm64, etc.)
|
|
7
|
+
* 3. PATH lookup (which aft)
|
|
8
|
+
* 4. ~/.cargo/bin/aft
|
|
9
|
+
* 5. Auto-download from GitHub releases (this module)
|
|
10
|
+
*
|
|
11
|
+
* Cache dir respects XDG_CACHE_HOME on Linux/macOS and LOCALAPPDATA on Windows.
|
|
12
|
+
*/
|
|
13
|
+
/** Get the cache directory, respecting XDG_CACHE_HOME / LOCALAPPDATA. */
|
|
14
|
+
export declare function getCacheDir(): string;
|
|
15
|
+
/** Binary name for the current platform. */
|
|
16
|
+
export declare function getBinaryName(): string;
|
|
17
|
+
/** Return the cached binary path if it exists, otherwise null.
|
|
18
|
+
* Checks the version-specific cache directory only.
|
|
19
|
+
* The legacy flat cache (~/.cache/aft/bin/aft) is intentionally NOT checked
|
|
20
|
+
* because it can be overwritten by other instances, corrupting running processes. */
|
|
21
|
+
export declare function getCachedBinaryPath(version?: string): string | null;
|
|
22
|
+
/**
|
|
23
|
+
* Download the AFT binary for the current platform from GitHub releases.
|
|
24
|
+
*
|
|
25
|
+
* @param version - Git tag to download from (e.g. "v0.1.0"). If omitted,
|
|
26
|
+
* fetches the latest release tag via the GitHub API.
|
|
27
|
+
* @returns Absolute path to the downloaded binary, or null on failure.
|
|
28
|
+
*/
|
|
29
|
+
export declare function downloadBinary(version?: string): Promise<string | null>;
|
|
30
|
+
/**
|
|
31
|
+
* Ensure the AFT binary is available: check cache, then download if needed.
|
|
32
|
+
* This is the main entry point called by the resolver.
|
|
33
|
+
*/
|
|
34
|
+
export declare function ensureBinary(version?: string): Promise<string | null>;
|
|
35
|
+
//# sourceMappingURL=downloader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"downloader.d.ts","sourceRoot":"","sources":["../src/downloader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAUH,yEAAyE;AACzE,wBAAgB,WAAW,IAAI,MAAM,CASpC;AAED,4CAA4C;AAC5C,wBAAgB,aAAa,IAAI,MAAM,CAEtC;AAED;;;sFAGsF;AACtF,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAInE;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAgH7E;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAqB3E"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AFT (Agent File Tools) extension for Pi coding agent.
|
|
3
|
+
*
|
|
4
|
+
* Config is loaded from two levels (project overrides user):
|
|
5
|
+
* - User: ~/.pi/agent/aft.jsonc (or .json)
|
|
6
|
+
* - Project: <project>/.pi/aft.jsonc (or .json)
|
|
7
|
+
*
|
|
8
|
+
* Tools registered:
|
|
9
|
+
*
|
|
10
|
+
* Hoisting (replace Pi's built-in tools):
|
|
11
|
+
* - read → AFT's indexed Rust reader
|
|
12
|
+
* - write → AFT's atomic writer with backup + auto-format + LSP diagnostics
|
|
13
|
+
* - edit → AFT's fuzzy-match edit with backup + diagnostics
|
|
14
|
+
* - grep → AFT's trigram-indexed grep (falls back to ripgrep outside project root)
|
|
15
|
+
*
|
|
16
|
+
* AFT-specific:
|
|
17
|
+
* - aft_outline Structural outline (symbols, headings) for files/URLs
|
|
18
|
+
* - aft_zoom Symbol-level inspection with call-graph annotations
|
|
19
|
+
* - aft_search Semantic search (when experimental_semantic_search=true)
|
|
20
|
+
* - aft_navigate Call-graph navigation (callers, call_tree, impact, trace_to, trace_data)
|
|
21
|
+
* - aft_conflicts One-call merge conflict inspection
|
|
22
|
+
* - aft_import Language-aware import add/remove/organize
|
|
23
|
+
* - aft_safety Per-file undo, checkpoints, restore
|
|
24
|
+
* - aft_delete Delete file with backup
|
|
25
|
+
* - aft_move Move/rename file
|
|
26
|
+
* - ast_grep_search / ast_grep_replace AST-aware pattern search/rewrite
|
|
27
|
+
* - lsp_diagnostics On-demand LSP diagnostics
|
|
28
|
+
*
|
|
29
|
+
* Commands:
|
|
30
|
+
* - /aft-status Status dialog (index states, LSP servers, storage dir)
|
|
31
|
+
*/
|
|
32
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
33
|
+
/**
|
|
34
|
+
* Pi extension default export.
|
|
35
|
+
*
|
|
36
|
+
* Called once per session. Registers tools, commands, and session shutdown hooks.
|
|
37
|
+
*/
|
|
38
|
+
export default function (pi: ExtensionAPI): Promise<void>;
|
|
39
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AA8HlE;;;;GAIG;AACH,yBAA+B,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAiH9D"}
|