@henryqw/pi-add-dir 2.1.1 → 2.1.3

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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Give the current Pi session context, skills, and searchable files from directories outside the workspace. Reuse those resources in place without copying or linking their directories.
4
4
 
5
- ![Pi using added external directories by name](./example.png)
5
+ ![Pi using added external directories by name](https://raw.githubusercontent.com/HenryQW/pi-harness/main/extensions/pi-add-dir/example.png)
6
6
 
7
7
  ## Install
8
8
 
@@ -12,17 +12,19 @@ pi install npm:@henryqw/pi-add-dir
12
12
 
13
13
  ## Use
14
14
 
15
- Run `/dir-add`, enter a directory, then run `/dir-ls`. Pi lists the directory and exposes its supported resources.
15
+ Run `/dir-add`, enter a directory, then run `/dir-ls` to confirm it was added. Pi lists the directory and exposes its supported resources.
16
+
17
+ Use slash commands from the Pi prompt as a human; Pi agents use the tools.
16
18
 
17
19
  | Surface | Type | Purpose |
18
20
  | --- | --- | --- |
19
- | `/dir-add [path]` | command | Add to the current session; no path opens input. Supports `~`. |
20
- | `/dir-add --project [path]` | command | Persist for the current Git repository and all its linked worktrees. |
21
- | `/dir-add --global [path]` | command | Persist for every Pi workspace for this user. |
21
+ | `/dir-add [path]` | command | Add to this session by default; pass `--project` or `--global` before the path to persist for this Git repository's linked worktrees or every workspace. Omit the path to enter it when prompted; supports `~`. |
22
22
  | `/dir-ls` | command | List directories with their scope; select one to remove from that scope. |
23
23
  | `/dir-reload` | command | Reload external directory resources. |
24
- | `add_directory` | tool | Add a directory. |
25
- | `search_external_files` | tool | Glob-search added directories. |
24
+ | `add_directory(path)` | tool | Add a directory to this session and return its context and instructions. |
25
+ | `search_external_files(pattern, maxResults?)` | tool | Glob-search added directories; returns up to 50 results by default, configurable to 1,000. |
26
+ | `@` file autocomplete | ui | Find files in added directories and insert their absolute paths. |
27
+ | External directory widget | ui | Show added directories and point to `/dir-ls` for management. |
26
28
 
27
29
  Added directories give Pi these resources:
28
30
 
@@ -30,7 +32,7 @@ Added directories give Pi these resources:
30
32
  - Skills that Pi loads from `.pi/skills`, `.agents/skills`, and `.claude/skills`.
31
33
  - Files in the editor's `@` autocomplete, with absolute paths.
32
34
 
33
- `/dir-add` reloads when it finds skills. `add_directory` reports when a reload is needed and always remains session-local.
35
+ `/dir-add` reloads only when the discovered external skill paths change, not merely because the directory contains skills. `add_directory` stays session-local; when its result asks for `/reload`, run it to update external skills.
34
36
 
35
37
  ## Config
36
38
 
@@ -44,7 +46,7 @@ A missing file uses the default. Invalid config stops loading and is not overwri
44
46
 
45
47
  ## State and storage
46
48
 
47
- Session directories live in the current session branch. Project directories use the repository's repeatable local Git config key `pi-add-dir.directory`. Local Git config is shared by linked worktrees, cannot be injected by cloning a repository, and remains machine-local. `/dir-add --project` therefore requires a Git repository.
49
+ Session directories live in the current session branch. New session additions reject directories inside or containing the current working directory, or overlapping another active added directory. Restored session entries are not rechecked for overlap when the working directory changes. Project directories use the repository's repeatable local Git config key `pi-add-dir.directory`. Local Git config is shared by linked worktrees, cannot be injected by cloning a repository, and remains machine-local. `/dir-add --project` therefore requires a Git repository.
48
50
 
49
51
  Persistent scopes are explicit because added directories can inject `AGENTS.md`, `CLAUDE.md`, and skills.
50
52
 
@@ -52,4 +54,4 @@ Persistent scopes are explicit because added directories can inject `AGENTS.md`,
52
54
 
53
55
  Search supports basename and relative-path globs. It skips `.git` and `node_modules`. It uses Node filesystem traversal and returns at most 1,000 results per call.
54
56
 
55
- Missing directories and directories that overlap the current workspace remain configured but are skipped with a warning. Fix or remove them through `/dir-ls`.
57
+ Missing or overlapping **project and global** directories remain configured but are skipped with a warning. Restore a missing directory at its original path or resolve the overlap, then run `/dir-reload` to rescan. To change or discard a configured path, use `/dir-ls` to **remove** it from its scope, then `/dir-add` with the corrected path if needed; `/dir-ls` cannot repair paths in place.
@@ -19,7 +19,6 @@ function parseConfig(value: unknown): AddDirConfig {
19
19
  (directory) =>
20
20
  typeof directory !== "string" ||
21
21
  !isAbsolute(directory) ||
22
- directory.length === 0 ||
23
22
  /\p{C}/u.test(directory),
24
23
  )
25
24
  ) {
@@ -107,7 +107,7 @@ function parseAddArgs(args: string | undefined): ParsedAddArgs {
107
107
  function validateStoredPaths(paths: string[], source: DirSource): void {
108
108
  if (
109
109
  paths.some(
110
- (path) => typeof path !== "string" || !isAbsolute(path) || path.length === 0 || /\p{C}/u.test(path),
110
+ (path) => typeof path !== "string" || !isAbsolute(path) || /\p{C}/u.test(path),
111
111
  )
112
112
  ) {
113
113
  throw new Error(`Invalid ${source} pi-add-dir configuration: expected absolute paths.`);
@@ -642,8 +642,8 @@ export default function addDirExtension(pi: ExtensionAPI, options: ExtensionOpti
642
642
  }
643
643
  if (context.skills.size > 0) {
644
644
  response.push(`\nDiscovered skills: ${[...context.skills].join(", ")}`);
645
- response.push("Run /reload to register skills as /skill:name commands.");
646
645
  }
646
+ if (result.resourcesChanged) response.push("Run /reload to update external skills.");
647
647
  response.push(`\nYou can now access files at: ${absolutePath}`);
648
648
 
649
649
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@henryqw/pi-add-dir",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
4
4
  "description": "Add external directories to a Pi session with context, skills, and file search.",
5
5
  "keywords": [
6
6
  "pi-package",