@zew1me/pi-skills-patch 0.1.0-alpha.0 → 0.1.1-alpha.183

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.
@@ -1,5 +1,17 @@
1
1
  # Attribution
2
2
 
3
+ ## Patch builder Git isolation
4
+
5
+ - Source: [`nigel-upstart/pi-buildout`](https://github.com/nigel-upstart/pi-buildout)
6
+ - Revisions reviewed:
7
+ [`6b9d053`](https://github.com/nigel-upstart/pi-buildout/commit/6b9d053d2d16d3c1a68d52054b4498e80af137f1) and
8
+ [`83ef752`](https://github.com/nigel-upstart/pi-buildout/commit/83ef752ab224574b01b780ebfe9c30dff867e4f3)
9
+ - License: MIT (Copyright 2026 Nigel Stuke); the root `LICENSE` preserves the notice.
10
+
11
+ Adapted the fork's empty hook directory and explicit `a/` and `b/` diff prefixes in `scripts/build-pi-patch.mjs`. The
12
+ regression test reuses the fork's Git-serialized hook path containing `#`, with a separate fixture process. The fork's
13
+ patch artifacts, version selection, and release tooling were not adopted.
14
+
3
15
  ## Subagent context modes from `nigel-upstart/pi-buildout`
4
16
 
5
17
  - Source: `nigel-upstart/pi-buildout`
@@ -135,7 +147,7 @@ upstream's bundle output; Pi's published `dist/bundle/cli.js` compile-cache load
135
147
  checksum. Source inputs are fetched from the 1.0.3 release archive and npm tarball with committed checksums; no complete
136
148
  Pi source checkout is committed.
137
149
 
138
- ## Pi 1.0.4 `/skills` runtime patch
150
+ ## Pi 1.0.4 `/skills` runtime patch (retired)
139
151
 
140
152
  - Source: `@earendil-works/pi-coding-agent@1.0.4`
141
153
  - Canonical repository: <https://github.com/earendil-works/pi> (`packages/coding-agent`)
@@ -143,11 +155,10 @@ Pi source checkout is committed.
143
155
  - Source archive: `pi-1.0.4-source.tar.gz`, verified against the release's published `SHA256SUMS`
144
156
  - License declared by the package: MIT
145
157
 
146
- [`pi-overlay/versions/1.0.4/integration.patch`](pi-overlay/versions/1.0.4/integration.patch) adapts the opt-in skills
147
- integration seam to the MIT-licensed 1.0.4 TypeScript sources and documentation. The generated
148
- [`skills.patch`](patches/pi-1.0.4/skills.patch) modifies Pi's published resource loader, slash-command list, CLI and
149
- interactive entry points, and skill documentation. It adds this repository's original skill-management modules and
150
- reuses Pi's package/resource discovery, project-trust, and `proper-lockfile` APIs. It preserves explicit `--skill` with
158
+ The retired 1.0.4 integration patch adapted the opt-in skills seam to the MIT-licensed TypeScript sources and
159
+ documentation. Its generated patch modified Pi's published resource loader, slash-command list, CLI and interactive
160
+ entry points, and skill documentation. It adds this repository's original skill-management modules and reuses Pi's
161
+ package/resource discovery, project-trust, and `proper-lockfile` APIs. It preserves explicit `--skill` with
151
162
  `--no-skills`, makes discovered skills catalog-only until activated, and leaves unrelated extensions, prompts, themes,
152
163
  packages, providers, trust behavior, and bundled chunks unchanged. Pi's automatic loading of all discovered skills and
153
164
  its skill implementation were not copied into the overlay. The original `cli-runtime.js` and `rpc-entry.js` wrappers are
@@ -194,6 +205,17 @@ are reused byte-for-byte from 1.1.0 because Pi 1.3.0's `src/cli.ts`, `src/rpc-en
194
205
  unchanged. The published `dist/bundle/cli.js` loader remains unchanged and checksum-pinned. Upstream changes elsewhere
195
206
  in 1.3.0, including those near the seams, were not adopted. No complete Pi source checkout is committed.
196
207
 
208
+ ## Pi 1.6.0 `/skills` runtime patch
209
+
210
+ - Source: `@earendil-works/pi-coding-agent@1.6.0` (MIT)
211
+ - Canonical repository: <https://github.com/earendil-works/pi> (`packages/coding-agent`)
212
+ - Upstream revision reviewed: `faac585884ae2c013a6b1400f3e9e77f10b34bac` (`v1.6.0`)
213
+
214
+ The [1.6.0 integration patch](pi-overlay/versions/1.6.0/integration.patch) adapts the existing seam to Pi's 1.6.0
215
+ TypeScript sources and skill documentation, including the changed model-resolver import context in `main.ts`. It reuses
216
+ this repository's shared skill management and CLI/RPC wrappers. The generated patch contains edits to upstream runtime
217
+ files and docs; it does not vendor the upstream tree, adopt Pi's auto-loading policy, or rebuild its bundled chunks.
218
+
197
219
  ## Pi 1.5.2 `/skills` runtime patch
198
220
 
199
221
  - Source: [nigel-upstart/pi-buildout](https://github.com/nigel-upstart/pi-buildout), commit
@@ -0,0 +1,8 @@
1
+ 86a7f4c1112f11a198ce2f23b4abfd1fb534a003ce0afa226b2b6de655a32295 dist/core/resource-loader.js
2
+ 093860b01a21d07ee53457e566f46f238d80f51634092713fae832184e7dbb88 dist/core/slash-commands.js
3
+ b63583f13649b79a9057f92e615c4ed098666a65deb362ed64eabab775eef253 dist/main.js
4
+ 8c98aa79a90070c5df772b308fcfe3643656ebcd6fc909b52c25a6aa98153129 dist/modes/interactive/interactive-mode.js
5
+ 5b9805525b194474ef1fe5455a0917ef15ed7f710aa9bec2eee11879556469e5 docs/skills.md
6
+ f21d61c909b0398f3b153f68044d7e6125bc9eea73bb26128e16f7b77245667b dist/bundle/cli-runtime.js
7
+ c247f32381c9daf6df70f204be62f49555e18e3013780e36ebfbb86e8ed0de4d dist/bundle/rpc-entry.js
8
+ e79626f2dd6f94aa45d30f3fa63cd84319a6eefcd150b353cfaf274366926774 dist/bundle/cli.js
@@ -1,10 +1,10 @@
1
- 353afa95ba9b317a042571e92dd093d3bfd31fa7089311730a46346635ea32ff dist/core/resource-loader.js
2
- 6b212fda1510fcbb86fc9c53fc63335b1e8c6a03710223b53862d93e221afa73 dist/core/slash-commands.js
3
- 02325568295034ef970414e4298ca4927373e96d715ce68213c82b31ea207d3e dist/main.js
4
- 556bf3a093f8f3c8cf320fd9be13476d861b2fda8804d7228f4405cc07948ae7 dist/modes/interactive/interactive-mode.js
1
+ 657cae5277f7b9537bf30eb50502eb85bafa45cc494551c71f036555ac03f150 dist/core/resource-loader.js
2
+ 252b7195eae2225527c2ea77908bb7b3ddbc202cf25e2bf5bea9d3ce8990e63d dist/core/slash-commands.js
3
+ 1763b278a30e772bf8ee2da004bf368d479b2bc679515ab83afca161e6d69ae6 dist/main.js
4
+ 9f4153ba4c0b60441e372d96ff1970c1b300ff4a4bd506741d311229771f7315 dist/modes/interactive/interactive-mode.js
5
5
  dce32d936de2732cac1bf9dbd0257fc2734cc530bb90e38c496cc25b6eec8f09 dist/core/skill-management.js
6
6
  afb5dac60cf8791d8d12888ea083173e978de5f0c04b7205fec6a834c2c46b57 dist/core/skill-management-core.js
7
7
  9ed8e6da4be22f62f99a444d306abc20a5e0d8ba76ecab13de6e7460be2584d2 docs/skills.md
8
8
  e1ff73f68c6668278fe8dc0c12645cef032ad2c8d4c13536c223a33382fc02df dist/bundle/cli-runtime.js
9
- bec9d85dfd59bac034fcef8c3951a8d7927dc82a3282ba271bf0214cf29f3bdc dist/bundle/rpc-entry.js
9
+ a3e0c75e3d4c074cf3839d0660cdc866541a20b013f1da6221d7036f0f12c4e1 dist/bundle/rpc-entry.js
10
10
  e79626f2dd6f94aa45d30f3fa63cd84319a6eefcd150b353cfaf274366926774 dist/bundle/cli.js
@@ -1,42 +1,48 @@
1
1
  diff --git a/dist/bundle/cli-runtime.js b/dist/bundle/cli-runtime.js
2
- index 64a996f..99f5492 100755
2
+ index 91c449d..99f5492 100755
3
3
  --- a/dist/bundle/cli-runtime.js
4
4
  +++ b/dist/bundle/cli-runtime.js
5
5
  @@ -1,3 +1,5 @@
6
6
  #!/usr/bin/env node
7
7
  -import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
8
- -import{configureHttpDispatcher,main}from"./chunks/chunk-H33F2TZD.js";import"./chunks/chunk-FKGBRPJC.js";import"./chunks/chunk-XXKX4I4Z.js";import"./chunks/chunk-VLMAON6X.js";import"./chunks/chunk-USJZMAIR.js";import"./chunks/chunk-YKYP4C4A.js";import"./chunks/chunk-F4TCZWQO.js";import{APP_NAME}from"./chunks/chunk-64GOPQSC.js";import"./chunks/chunk-S3GGRYIO.js";import"./chunks/chunk-22CYIUS4.js";import"./chunks/chunk-ZBURYEWF.js";import"./chunks/chunk-DRQDKNXA.js";import"./chunks/chunk-TRDNDS6A.js";import"./chunks/chunk-KJUDFE6Y.js";import"./chunks/chunk-A3JYRWB6.js";import"./chunks/chunk-4L3WN2XY.js";function setupCli(){process.title=APP_NAME,process.env.PI_CODING_AGENT="true",process.env.AI_AGENT="pi",process.emitWarning=(()=>{}),configureHttpDispatcher()}setupCli();main(process.argv.slice(2));
8
+ -import{configureHttpDispatcher,main}from"./chunks/chunk-KSDI5FD4.js";import"./chunks/chunk-XGGZYFNG.js";import"./chunks/chunk-NRLRGOCX.js";import"./chunks/chunk-X26YOAEH.js";import"./chunks/chunk-P5VHIEWH.js";import"./chunks/chunk-I6HYYNH6.js";import"./chunks/chunk-NV3NPOPF.js";import"./chunks/chunk-Y55SJART.js";import"./chunks/chunk-6QGV3IWD.js";import{APP_NAME}from"./chunks/chunk-36QC74V4.js";import"./chunks/chunk-IEBK4HQA.js";import"./chunks/chunk-5AGIVGSV.js";import"./chunks/chunk-INODY4DR.js";import"./chunks/chunk-ZG74NES2.js";import"./chunks/chunk-TMTOQ7H7.js";import"./chunks/chunk-FFMDRXC4.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-NRY4NBZW.js";import"./chunks/chunk-LPXNMA2W.js";import"./chunks/chunk-ILDLA2JW.js";import"./chunks/chunk-JXWJOIH4.js";function setupCli(){process.title=APP_NAME,process.env.PI_CODING_AGENT="true",process.env.AI_AGENT="pi",process.emitWarning=(()=>{}),configureHttpDispatcher()}setupCli();main(process.argv.slice(2));
9
9
  +import { setupCli } from "../cli/setup.js";
10
10
  +import { main } from "../main.js";
11
11
  +setupCli();
12
12
  +main(process.argv.slice(2));
13
13
  diff --git a/dist/bundle/rpc-entry.js b/dist/bundle/rpc-entry.js
14
- index 2eae698..1ccec33 100755
14
+ index 5e5de39..b571534 100755
15
15
  --- a/dist/bundle/rpc-entry.js
16
16
  +++ b/dist/bundle/rpc-entry.js
17
- @@ -1,3 +1,7 @@
17
+ @@ -1,3 +1,13 @@
18
18
  #!/usr/bin/env node
19
19
  -import { createRequire as __piCreateRequire } from "node:module"; const require = __piCreateRequire(import.meta.url);
20
- -import{configureHttpDispatcher,main}from"./chunks/chunk-H33F2TZD.js";import"./chunks/chunk-FKGBRPJC.js";import"./chunks/chunk-XXKX4I4Z.js";import"./chunks/chunk-VLMAON6X.js";import"./chunks/chunk-USJZMAIR.js";import"./chunks/chunk-YKYP4C4A.js";import"./chunks/chunk-F4TCZWQO.js";import{APP_NAME}from"./chunks/chunk-64GOPQSC.js";import"./chunks/chunk-S3GGRYIO.js";import"./chunks/chunk-22CYIUS4.js";import"./chunks/chunk-ZBURYEWF.js";import"./chunks/chunk-DRQDKNXA.js";import"./chunks/chunk-TRDNDS6A.js";import"./chunks/chunk-KJUDFE6Y.js";import"./chunks/chunk-A3JYRWB6.js";import"./chunks/chunk-4L3WN2XY.js";process.title=`${APP_NAME}-rpc`;process.env.PI_CODING_AGENT="true";process.env.AI_AGENT="pi";process.emitWarning=(()=>{});configureHttpDispatcher();main(["--mode","rpc",...process.argv.slice(2)]);
21
- +import { setupCli } from "../cli/setup.js";
20
+ -import{configureHttpDispatcher,main}from"./chunks/chunk-KSDI5FD4.js";import"./chunks/chunk-XGGZYFNG.js";import"./chunks/chunk-NRLRGOCX.js";import"./chunks/chunk-X26YOAEH.js";import"./chunks/chunk-P5VHIEWH.js";import"./chunks/chunk-I6HYYNH6.js";import"./chunks/chunk-NV3NPOPF.js";import"./chunks/chunk-Y55SJART.js";import"./chunks/chunk-6QGV3IWD.js";import{APP_NAME}from"./chunks/chunk-36QC74V4.js";import"./chunks/chunk-IEBK4HQA.js";import"./chunks/chunk-5AGIVGSV.js";import"./chunks/chunk-INODY4DR.js";import"./chunks/chunk-ZG74NES2.js";import"./chunks/chunk-TMTOQ7H7.js";import"./chunks/chunk-FFMDRXC4.js";import"./chunks/chunk-7DDKXS2Q.js";import"./chunks/chunk-NRY4NBZW.js";import"./chunks/chunk-LPXNMA2W.js";import"./chunks/chunk-ILDLA2JW.js";import"./chunks/chunk-JXWJOIH4.js";process.title=`${APP_NAME}-rpc`;process.env.PI_CODING_AGENT="true";process.env.AI_AGENT="pi";process.emitWarning=(()=>{});configureHttpDispatcher();main(["--mode","rpc",...process.argv.slice(2)]);
22
21
  +import { APP_NAME } from "../config.js";
22
+ +import { configureHttpDispatcher } from "../core/http-dispatcher.js";
23
23
  +import { main } from "../main.js";
24
- +setupCli();
24
+ +
25
25
  +process.title = `${APP_NAME}-rpc`;
26
+ +process.env.PI_CODING_AGENT = "true";
27
+ +process.env.AI_AGENT = "pi";
28
+ +process.emitWarning = () => {};
29
+ +
30
+ +configureHttpDispatcher();
31
+ +
26
32
  +main(["--mode", "rpc", ...process.argv.slice(2)]);
27
33
  diff --git a/dist/core/resource-loader.js b/dist/core/resource-loader.js
28
- index 35ba09c..9d1e088 100644
34
+ index 379db9e..7fb431e 100644
29
35
  --- a/dist/core/resource-loader.js
30
36
  +++ b/dist/core/resource-loader.js
31
37
  @@ -12,6 +12,7 @@ import { findGitPaths } from "./footer-data-provider.js";
32
- import { DefaultPackageManager } from "./package-manager.js";
38
+ import { DefaultPackageManager, } from "./package-manager.js";
33
39
  import { loadPromptTemplates } from "./prompt-templates.js";
34
40
  import { SettingsManager } from "./settings-manager.js";
35
41
  +import { resolveActiveSkillPaths } from "./skill-management.js";
36
42
  import { loadSkills } from "./skills.js";
37
- import { BUILTIN_PATH_PREFIX, createSourceInfo, getSyntheticPathSource, isSyntheticPath, } from "./source-info.js";
43
+ import { BUILTIN_PATH_PREFIX, createSourceInfo, getResourcePathKey, getSyntheticPathSource, isSyntheticPath, } from "./source-info.js";
38
44
  import { resetTimings } from "./timings.js";
39
- @@ -417,11 +418,20 @@ export class DefaultResourceLoader {
45
+ @@ -438,11 +439,20 @@ export class DefaultResourceLoader {
40
46
  }
41
47
  this.extensionsResult = this.extensionsOverride ? this.extensionsOverride(extensionsResult) : extensionsResult;
42
48
  this.applyExtensionSourceInfo(this.extensionsResult.extensions, metadataByPath);
@@ -926,12 +932,12 @@ index 0000000..8b712ef
926
932
  +//# sourceMappingURL=skill-management.js.map
927
933
 
928
934
  diff --git a/dist/core/slash-commands.js b/dist/core/slash-commands.js
929
- index 170a066..11b18fa 100644
935
+ index 6ca9ad3..3c4d430 100644
930
936
  --- a/dist/core/slash-commands.js
931
937
  +++ b/dist/core/slash-commands.js
932
938
  @@ -23,6 +23,7 @@ export const BUILTIN_SLASH_COMMANDS = [
933
939
  { name: "compact", description: "Manually compact the session context" },
934
- { name: "resume", description: "Resume a different session" },
940
+ { name: "resume", description: "Resume another session" },
935
941
  { name: "reload", description: "Reload keybindings, extensions, skills, prompts, themes, and context files" },
936
942
  + { name: "skills", description: "List and manage active skills", argumentHint: "<active|list|search|add|remove|reload>" },
937
943
  { name: "quit", description: `Quit ${APP_NAME}` },
@@ -939,18 +945,18 @@ index 170a066..11b18fa 100644
939
945
  //# sourceMappingURL=slash-commands.js.map
940
946
 
941
947
  diff --git a/dist/main.js b/dist/main.js
942
- index ac397ec..ac68822 100644
948
+ index cb4ffba..9bb77fe 100644
943
949
  --- a/dist/main.js
944
950
  +++ b/dist/main.js
945
- @@ -26,6 +26,7 @@ import { AuthStorage, ReadOnlyAuthStorage } from "./core/auth-storage.js";
951
+ @@ -29,6 +29,7 @@ import { AuthStorage, ReadOnlyAuthStorage } from "./core/auth-storage.js";
946
952
  import { exportFromFile } from "./core/export-html/index.js";
947
953
  import { applyHttpProxySettings, configureHttpDispatcher } from "./core/http-dispatcher.js";
948
- import { resolveCliModel, resolveModelScope } from "./core/model-resolver.js";
954
+ import { resolveCliModel, resolveModelScopeWithDiagnostics } from "./core/model-resolver.js";
949
955
  +import { handleSkillsCli } from "./core/skill-management.js";
950
956
  import { ModelRuntime } from "./core/model-runtime.js";
951
957
  import { restoreStdout, takeOverStdout } from "./core/output-guard.js";
952
958
  import { resolveProjectTrusted } from "./core/project-trust.js";
953
- @@ -486,6 +487,10 @@ export async function main(args, options) {
959
+ @@ -531,6 +532,10 @@ export async function main(args, options) {
954
960
  process.exitCode = await runMcpCommand(args.slice(1), { cwd, agentDir });
955
961
  return;
956
962
  }
@@ -962,27 +968,27 @@ index ac397ec..ac68822 100644
962
968
  if (parsed.diagnostics.length > 0) {
963
969
  for (const d of parsed.diagnostics) {
964
970
  diff --git a/dist/modes/interactive/interactive-mode.js b/dist/modes/interactive/interactive-mode.js
965
- index 7827bce..5df7c45 100644
971
+ index cbd9365..6291a2b 100644
966
972
  --- a/dist/modes/interactive/interactive-mode.js
967
973
  +++ b/dist/modes/interactive/interactive-mode.js
968
- @@ -28,6 +28,7 @@ import { DefaultPackageManager } from "../../core/package-manager.js";
969
- import { RADIUS_MCP_URL, RADIUS_PROVIDER_ID } from "../../core/radius.js";
970
- import { formatMissingSessionCwdPrompt, MissingSessionCwdError } from "../../core/session-cwd.js";
974
+ @@ -31,6 +31,7 @@ import { RADIUS_PROVIDER_ID } from "../../core/radius.js";
975
+ import { planRadiusMcpServer } from "../../core/radius-mcp.js";
976
+ import { formatMissingSessionCwdPrompt, getMissingSessionCwdOptions, MissingSessionCwdError, } from "../../core/session-cwd.js";
971
977
  import { SessionManager, sessionEntryToContextMessages, } from "../../core/session-manager.js";
972
978
  +import { handleSkillsInteractive } from "../../core/skill-management.js";
973
979
  import { BUILTIN_SLASH_COMMANDS } from "../../core/slash-commands.js";
980
+ import { getSourcePackageKey } from "../../core/source-info.js";
974
981
  import { isInstallTelemetryEnabled } from "../../core/telemetry.js";
975
- import { withBuiltInRenderers } from "../../core/tools/renderers/index.js";
976
- @@ -39,7 +40,7 @@ import { copyToClipboard, readClipboardFilePaths, readClipboardText } from "../.
977
- import { extensionForImageMimeType, readClipboardImage } from "../../utils/clipboard-image.js";
982
+ @@ -44,7 +45,7 @@ import { extensionForImageMimeType, readClipboardImage } from "../../utils/clipb
983
+ import { flushStdout } from "../../utils/flush-stdout.js";
978
984
  import { parseGitUrl } from "../../utils/git.js";
979
985
  import { ensurePngTranscoder } from "../../utils/image-convert.js";
980
- -import { getCwdRelativePath } from "../../utils/paths.js";
981
- +import { getCwdRelativePath, resolvePath } from "../../utils/paths.js";
986
+ -import { getCwdRelativePath, shortenHomePath } from "../../utils/paths.js";
987
+ +import { getCwdRelativePath, resolvePath, shortenHomePath } from "../../utils/paths.js";
982
988
  import { getPiUserAgent } from "../../utils/pi-user-agent.js";
983
989
  import { killTrackedDetachedChildren } from "../../utils/shell.js";
984
990
  import { loadAllHighlightLanguages } from "../../utils/syntax-highlight.js";
985
- @@ -2643,6 +2644,11 @@ export class InteractiveMode {
991
+ @@ -2809,6 +2810,11 @@ export class InteractiveMode {
986
992
  await this.handleReloadCommand();
987
993
  return;
988
994
  }
@@ -994,7 +1000,7 @@ index 7827bce..5df7c45 100644
994
1000
  if (text === "/debug") {
995
1001
  this.handleDebugCommand();
996
1002
  this.editor.setText("");
997
- @@ -5333,6 +5339,24 @@ export class InteractiveMode {
1003
+ @@ -5533,6 +5539,24 @@ export class InteractiveMode {
998
1004
  // =========================================================================
999
1005
  // Command handlers
1000
1006
  // =========================================================================
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zew1me/pi-skills-patch",
3
- "version": "0.1.0-alpha.0",
3
+ "version": "0.1.1-alpha.183",
4
4
  "type": "module",
5
5
  "description": "Version-checked /skills runtime patch installer for supported Pi versions",
6
6
  "license": "SEE LICENSE IN dist/LICENSE",
@@ -1,8 +0,0 @@
1
- 0d2ed0d85c39d05d611cd5904c6e696f7e2d16b2316e35d19f9b1f747ee62444 dist/core/resource-loader.js
2
- 3c4b7576c59d81e39e7dff4a847fdb51021fbea544a7880746018866a599f1e6 dist/core/slash-commands.js
3
- 866d65f2d42f74d2bb72ed4a755c8ace1b8a2c497a32cb57cc4db594a4fcb2bf dist/main.js
4
- 89ad3129807c036820c746ef4e0e930292b4ea7ab8150c085e75148a581793c4 dist/modes/interactive/interactive-mode.js
5
- 5b9805525b194474ef1fe5455a0917ef15ed7f710aa9bec2eee11879556469e5 docs/skills.md
6
- 3a772f29855c0016855c0a7836b0db675c36acfdac928315f2f7002f1e9fcd83 dist/bundle/cli-runtime.js
7
- 9a45262b4667f6cfb3d601a21a82dab2e8807f9c2d481f10778e37cf99fd492c dist/bundle/rpc-entry.js
8
- e79626f2dd6f94aa45d30f3fa63cd84319a6eefcd150b353cfaf274366926774 dist/bundle/cli.js
@@ -1,10 +0,0 @@
1
- 353afa95ba9b317a042571e92dd093d3bfd31fa7089311730a46346635ea32ff dist/core/resource-loader.js
2
- 6b212fda1510fcbb86fc9c53fc63335b1e8c6a03710223b53862d93e221afa73 dist/core/slash-commands.js
3
- 02325568295034ef970414e4298ca4927373e96d715ce68213c82b31ea207d3e dist/main.js
4
- 556bf3a093f8f3c8cf320fd9be13476d861b2fda8804d7228f4405cc07948ae7 dist/modes/interactive/interactive-mode.js
5
- 2ca309a974c2a2e8235ed80fbbf54f471ce973f81cebd963a1ffd406614ac351 dist/core/skill-management.js
6
- f0b3a3de117b9fef957850569127de1c07e863457b440417552e2809e21aa291 dist/core/skill-management-core.js
7
- aadc130ac066e9129d910935fdfe9fcd06e2333e3889b86b11f62b155643fe56 docs/skills.md
8
- e1ff73f68c6668278fe8dc0c12645cef032ad2c8d4c13536c223a33382fc02df dist/bundle/cli-runtime.js
9
- bec9d85dfd59bac034fcef8c3951a8d7927dc82a3282ba271bf0214cf29f3bdc dist/bundle/rpc-entry.js
10
- e79626f2dd6f94aa45d30f3fa63cd84319a6eefcd150b353cfaf274366926774 dist/bundle/cli.js
@@ -1,339 +0,0 @@
1
- diff --git a/dist/core/skill-management-core.js b/dist/core/skill-management-core.js
2
- index 2fd4257..0b4ae56 100644
3
- --- a/dist/core/skill-management-core.js
4
- +++ b/dist/core/skill-management-core.js
5
- @@ -160,7 +160,118 @@ export function configLocation(env, scope, cwd, agentDir) {
6
- return {};
7
- }
8
- export function looksLikePath(value) {
9
- - return value.includes("/") || value.includes("\\") || value.startsWith(".") || value.startsWith("~");
10
- + return (value.includes("/") ||
11
- + value.includes("\\") ||
12
- + value.startsWith(".") ||
13
- + value.startsWith("~") ||
14
- + value.startsWith("$"));
15
- +}
16
- +const environmentVariableReference = /\$(?:\{([A-Za-z_]\w*)\}|([A-Za-z_]\w*))/g;
17
- +/**
18
- + * Expands `$NAME` and `${NAME}` references in a skill path.
19
- + *
20
- + * `/skills` arguments never pass through a shell, so without this a path such as `$HOME/skills/x` would be
21
- + * resolved against the working directory. An unset variable is left as written rather than removed: a path
22
- + * that genuinely contains `$` still resolves, and callers can name the variable when the path does not exist.
23
- + */
24
- +export function expandEnvironmentVariables(env, input) {
25
- + const unset = [];
26
- + const value = input.replace(environmentVariableReference, (reference, braced, bare) => {
27
- + const name = braced ?? bare ?? "";
28
- + const expanded = env.environmentVariable(name);
29
- + if (expanded !== undefined)
30
- + return expanded;
31
- + if (!unset.includes(name))
32
- + unset.push(name);
33
- + return reference;
34
- + });
35
- + return { value, unset };
36
- +}
37
- +/** Resolves a path-like skill source to the absolute path it names, expanding variables and `~`. */
38
- +function resolveSkillPath(env, source, cwd) {
39
- + return env.resolvePath(expandEnvironmentVariables(env, source).value, cwd, { trim: true });
40
- +}
41
- +/** True for a path that does not depend on the directory it is read from: absolute, `~`, or a `file:` URL. */
42
- +function isAnchoredPath(env, value) {
43
- + return env.path.isAbsolute(value) || value === "~" || value.startsWith("~/") || value.startsWith("file:");
44
- +}
45
- +/** The checkout root for `cwd`; relative repository entries resolve against it. */
46
- +function findRepoRoot(env, cwd) {
47
- + return git(env, cwd, ["rev-parse", "--show-toplevel"]);
48
- +}
49
- +/** `path` relative to `root` with `/` separators, comparing real paths, or undefined when it lies outside. */
50
- +function pathInside(env, root, path) {
51
- + const real = (value) => (env.fs.existsSync(value) ? env.fs.realpathSync(value) : value);
52
- + const relative = env.path.relative(real(root), real(path));
53
- + if (relative === ".." || relative.startsWith(`..${env.path.sep}`) || env.path.isAbsolute(relative))
54
- + return undefined;
55
- + return relative.split(env.path.sep).join("/");
56
- +}
57
- +/**
58
- + * Chooses how an added path is written to configuration.
59
- + *
60
- + * Repository entries are shared by every checkout with the same remote, so a path inside the current checkout
61
- + * is stored relative to its root. Otherwise a `~` or `$NAME` spelling that resolves now is kept as typed, so it
62
- + * is expanded each time skills load rather than frozen at add time, and any other path is stored absolute,
63
- + * under `~` when it is in the home directory.
64
- + */
65
- +function persistedForm(env, source, resolvedPath, context) {
66
- + const repoRelative = context.scope === "repo" && context.repoRoot !== undefined
67
- + ? pathInside(env, context.repoRoot, resolvedPath)
68
- + : undefined;
69
- + if (repoRelative !== undefined) {
70
- + return repoRelative === "" ? "." : looksLikePath(repoRelative) ? repoRelative : `./${repoRelative}`;
71
- + }
72
- + const typed = source.trim();
73
- + if (isPortableSpelling(env, typed))
74
- + return typed;
75
- + const home = pathInside(env, env.homedir(), resolvedPath);
76
- + return home === undefined ? resolvedPath : home === "" ? "~" : `~/${home}`;
77
- +}
78
- +/** Variables naming a working directory: a path spelled with them means the directory it named at add time. */
79
- +const directoryVariables = new Set(["PWD", "OLDPWD"]);
80
- +function referencesDirectoryVariable(typed) {
81
- + return [...typed.matchAll(environmentVariableReference)].some((match) => directoryVariables.has(match[1] ?? match[2] ?? ""));
82
- +}
83
- +/** True for a `~` or `$NAME` path that resolves the same way from any directory in the current environment. */
84
- +function isPortableSpelling(env, typed) {
85
- + const spelled = typed === "~" || typed.startsWith("~/") || typed.search(environmentVariableReference) !== -1;
86
- + if (!spelled || !looksLikePath(typed) || referencesDirectoryVariable(typed))
87
- + return false;
88
- + const { value, unset } = expandEnvironmentVariables(env, typed);
89
- + return unset.length === 0 && isAnchoredPath(env, value.trim());
90
- +}
91
- +function unsetVariableHint(env, source) {
92
- + const { unset } = expandEnvironmentVariables(env, source);
93
- + if (unset.length === 0)
94
- + return undefined;
95
- + const names = unset.map((name) => `$${name}`).join(", ");
96
- + return `environment variable ${names} ${unset.length === 1 ? "is" : "are"} not set`;
97
- +}
98
- +function skillNotFoundMessage(env, source) {
99
- + const hint = looksLikePath(source) ? unsetVariableHint(env, source) : undefined;
100
- + return `Skill not found in the catalog or at an existing path: ${source}${hint ? ` (${hint})` : ""}`;
101
- +}
102
- +/** Explains why a persisted path entry could not be found, beyond its simply not existing. */
103
- +function unresolvedEntryHint(env, source, scope) {
104
- + if (!looksLikePath(source))
105
- + return undefined;
106
- + const unset = unsetVariableHint(env, source);
107
- + if (unset !== undefined)
108
- + return unset;
109
- + if (isAnchoredPath(env, expandEnvironmentVariables(env, source).value.trim()))
110
- + return undefined;
111
- + return scope === "repo"
112
- + ? "relative repository paths resolve against the root of the current checkout"
113
- + : "relative paths resolve against the working directory; remove it, then add it again to store its absolute path";
114
- +}
115
- +function unresolvedSkillDiagnostic(env, entry) {
116
- + const hint = unresolvedEntryHint(env, entry.source, entry.scope);
117
- + return {
118
- + type: "warning",
119
- + message: `Active skill could not be resolved${hint ? `: ${hint}` : ""}`,
120
- + path: entry.source,
121
- + };
122
- }
123
- /** True when `path` exists and Pi's own loader finds at least one skill in it. */
124
- function containsSkills(env, path, options) {
125
- @@ -175,36 +286,46 @@ function containsSkills(env, path, options) {
126
- return skills.length > 0;
127
- }
128
- /**
129
- - * Normalizes an entry already persisted in a configuration file.
130
- + * Normalizes an entry already persisted in a configuration file, for comparison.
131
- *
132
- * User input is normalized before it is stored, so a stored bare value is a catalog name and is compared
133
- * literally. Resolving it against whatever happens to exist in the current directory would let an unrelated
134
- - * local folder make a catalog-name entry match, or block, a path entry.
135
- + * local folder make a catalog-name entry match, or block, a path entry. A path entry compares by the real path
136
- + * it names, so `~/x`, `$HOME/x`, and a repository-relative `x` all match the same absolute path.
137
- */
138
- -function normalizePersistedSource(env, source, options) {
139
- +function normalizePersistedSource(env, source, context) {
140
- if (!source)
141
- return undefined;
142
- - return looksLikePath(source) ? env.resolvePath(source, options.cwd, { trim: true }) : source;
143
- + if (!looksLikePath(source))
144
- + return source;
145
- + const value = expandEnvironmentVariables(env, source).value.trim();
146
- + const path = context.scope === "repo" && context.repoRoot !== undefined && !isAnchoredPath(env, value)
147
- + ? env.path.resolve(context.repoRoot, value)
148
- + : env.resolvePath(value, context.cwd, { trim: true });
149
- + return env.fs.existsSync(path) ? env.fs.realpathSync(path) : path;
150
- }
151
- export function updatePersistedSkill(env, action, source, scope, options) {
152
- const location = configLocation(env, scope, options.cwd, options.agentDir);
153
- const path = location.path;
154
- if (path === undefined)
155
- throw new Error(`Scope ${scope} has no persisted configuration.`);
156
- + const context = {
157
- + cwd: options.cwd,
158
- + scope,
159
- + repoRoot: scope === "repo" ? findRepoRoot(env, options.cwd) : undefined,
160
- + };
161
- + const key = normalizePersistedSource(env, source, context);
162
- + const matches = (entry) => normalizePersistedSource(env, sourceOf(entry), context) === key;
163
- return withSkillConfigLock(env, path, () => {
164
- const config = readJson(env, path);
165
- const existing = location.key === undefined ? config : config[location.key];
166
- const target = location.key === undefined ? config : isObjectRecord(existing) ? existing : {};
167
- const enabled = enabledEntries(target);
168
- - const matched = enabled.some((entry) => normalizePersistedSource(env, sourceOf(entry), options) === source);
169
- + const matched = enabled.some(matches);
170
- if (action === "remove" && !matched)
171
- return false;
172
- target.enabled =
173
- - action === "add"
174
- - ? matched
175
- - ? enabled
176
- - : [...enabled, source]
177
- - : enabled.filter((entry) => normalizePersistedSource(env, sourceOf(entry), options) !== source);
178
- + action === "add" ? (matched ? enabled : [...enabled, source]) : enabled.filter((entry) => !matches(entry));
179
- if (location.key !== undefined)
180
- config[location.key] = target;
181
- writeJson(env, path, config);
182
- @@ -307,10 +428,11 @@ export async function getSkillCatalog(env, { cwd, agentDir, settingsManager, res
183
- return [...found.values()].sort((a, b) => a.name.localeCompare(b.name));
184
- }
185
- async function resolveSkillSource(env, source, options) {
186
- - const resolvedPath = env.resolvePath(source, options.cwd, { trim: true });
187
- if (looksLikePath(source)) {
188
- + const resolvedPath = resolveSkillPath(env, source, options.cwd);
189
- return { normalized: resolvedPath, resolved: env.fs.existsSync(resolvedPath) ? resolvedPath : undefined };
190
- }
191
- + const resolvedPath = env.resolvePath(source, options.cwd, { trim: true });
192
- // Build the catalog once, then use it both to prefer catalog names over same-named local folders and to
193
- // resolve the selected skill. A bare local folder is retained as a path only when no catalog entry wins.
194
- const catalog = await getSkillCatalog(env, options);
195
- @@ -360,6 +482,16 @@ async function runCatalogCommand(env, command, rest, surface, options) {
196
- : [query ? "No matching skills." : "No catalog skills found."],
197
- };
198
- }
199
- +/** What `add` writes for a resolved source: a catalog name as is, a path in its {@link persistedForm}. */
200
- +function persistedAddForm(env, source, target, scope, cwd) {
201
- + if (!looksLikePath(source) && target === source)
202
- + return source;
203
- + return persistedForm(env, source, target, {
204
- + cwd,
205
- + scope,
206
- + repoRoot: scope === "repo" ? findRepoRoot(env, cwd) : undefined,
207
- + });
208
- +}
209
- async function runMutationCommand(env, command, rest, surface, options) {
210
- const scopeList = `--global|--repo${options.allowSession ? "|--session" : ""}`;
211
- const source = rest.find((arg) => !arg.startsWith("--"));
212
- @@ -374,18 +506,18 @@ async function runMutationCommand(env, command, rest, surface, options) {
213
- const resolution = command === "add" ? await resolveSkillSource(env, source, options) : undefined;
214
- const target = command === "remove"
215
- ? looksLikePath(source)
216
- - ? env.resolvePath(source, options.cwd, { trim: true })
217
- + ? resolveSkillPath(env, source, options.cwd)
218
- : source
219
- : resolution?.normalized;
220
- if (!target)
221
- throw new Error(`Skill source is invalid: ${source}`);
222
- if (command === "add" && !resolution?.resolved) {
223
- - throw new Error(`Skill not found in the catalog or at an existing path: ${source}`);
224
- + throw new Error(skillNotFoundMessage(env, source));
225
- }
226
- if (scope === "session")
227
- return { exitCode: 0, lines: [], session: { action: command, source: target } };
228
- const updated = command === "add"
229
- - ? updatePersistedSkill(env, command, target, scope, options)
230
- + ? updatePersistedSkill(env, command, persistedAddForm(env, source, target, scope, options.cwd), scope, options)
231
- : removePersistedSkill(env, source, target, scope, options);
232
- if (!updated)
233
- throw new Error(`Skill is not enabled for ${scope} scope: ${source}`);
234
- @@ -412,9 +544,13 @@ export async function runSkillsCommand(env, args, options) {
235
- /**
236
- * Resolves the skills that are explicitly active for this session into concrete paths.
237
- *
238
- - * Entries are either paths, which must exist, or catalog names, which are looked up by name. The catalog is
239
- - * built at most once per call: every caller resolves a whole entry list in one pass, so a longer-lived cache
240
- - * would only need invalidating without ever being reused.
241
- + * Entries are either paths, which must exist, or catalog names, which are looked up by name. Path entries
242
- + * are expanded here, each time skills load, rather than when they are added: `~` and `$NAME` take the current
243
- + * environment, and a relative repository entry resolves against the root of the current checkout. The loader
244
- + * keeps the result until its next reload (`/reload`, `/skills reload`, or the reload `/skills add` and
245
- + * `/skills remove` trigger), which is what makes this a once-per-session expansion. The catalog is built at
246
- + * most once per call: every caller resolves a whole entry list in one pass, so a longer-lived cache would only
247
- + * need invalidating without ever being reused.
248
- */
249
- export async function resolveActiveSkillPaths(env, context) {
250
- const { cwd, agentDir, settingsManager, resolvedSkillResources, resolveResourcePath } = context;
251
- @@ -435,22 +571,30 @@ export async function resolveActiveSkillPaths(env, context) {
252
- })).map((skill) => [skill.name, skill.filePath]));
253
- return catalogPathsByName.get(name);
254
- };
255
- + let repoRoot;
256
- + const entryPath = (entry) => {
257
- + const value = expandEnvironmentVariables(env, entry.source).value.trim();
258
- + if (entry.scope === "repo" && !isAnchoredPath(env, value)) {
259
- + repoRoot ??= { value: findRepoRoot(env, cwd) };
260
- + if (repoRoot.value !== undefined)
261
- + return env.path.resolve(repoRoot.value, value);
262
- + }
263
- + return resolveResourcePath(value);
264
- + };
265
- for (const entry of entries) {
266
- - const source = sourceOf(entry);
267
- - if (!source)
268
- + if (!looksLikePath(entry.source)) {
269
- + const resolved = await findCatalogSkillPath(entry.source);
270
- + if (resolved)
271
- + paths.push(resolved);
272
- + else
273
- + diagnostics.push(unresolvedSkillDiagnostic(env, entry));
274
- continue;
275
- - const normalized = looksLikePath(source) ? resolveResourcePath(source) : source;
276
- - const resolved = looksLikePath(source)
277
- - ? env.fs.existsSync(normalized)
278
- - ? normalized
279
- - : undefined
280
- - : await findCatalogSkillPath(normalized);
281
- - if (resolved) {
282
- - paths.push(resolved);
283
- - }
284
- - else {
285
- - diagnostics.push({ type: "warning", message: "Active skill could not be resolved", path: source });
286
- }
287
- + const path = entryPath(entry);
288
- + if (env.fs.existsSync(path))
289
- + paths.push(path);
290
- + else
291
- + diagnostics.push(unresolvedSkillDiagnostic(env, entry));
292
- }
293
- return { paths, diagnostics };
294
- }
295
- @@ -464,7 +608,7 @@ export async function resolveActiveSkillPaths(env, context) {
296
- export async function resolveSkillEntryPath(env, context, source) {
297
- const { cwd, agentDir, settingsManager, resolvedSkillResources, resolveResourcePath } = context;
298
- if (looksLikePath(source)) {
299
- - const normalized = resolveResourcePath(source);
300
- + const normalized = resolveResourcePath(expandEnvironmentVariables(env, source).value);
301
- return { normalized, resolved: env.fs.existsSync(normalized) ? normalized : undefined };
302
- }
303
- const catalog = await getSkillCatalog(env, {
304
- @@ -500,7 +644,9 @@ async function applySessionSkillChange(env, session, context) {
305
- }
306
- // Removal must not resolve packages. Recover bare names from the already-enabled paths, and compare explicit
307
- // paths after applying the same resolution used by the resource loader.
308
- - const normalized = looksLikePath(session.source) ? resolveResourcePath(session.source) : session.source;
309
- + const normalized = looksLikePath(session.source)
310
- + ? resolveResourcePath(expandEnvironmentVariables(env, session.source).value)
311
- + : session.source;
312
- const skillPaths = looksLikePath(session.source)
313
- ? []
314
- : env
315
- diff --git a/dist/core/skill-management.js b/dist/core/skill-management.js
316
- index 3d18e7d..8b712ef 100644
317
- --- a/dist/core/skill-management.js
318
- +++ b/dist/core/skill-management.js
319
- @@ -28,6 +28,7 @@ const env = {
320
- fs: { existsSync, mkdirSync, readFileSync, realpathSync, renameSync, writeFileSync },
321
- path: { dirname, isAbsolute, join, relative, resolve, sep },
322
- homedir,
323
- + environmentVariable: (name) => process.env[name],
324
- execFileSync,
325
- processId: () => process.pid,
326
- lockSync: (directory, options) => lockfile.lockSync(directory, options),
327
- diff --git a/docs/skills.md b/docs/skills.md
328
- index a6adcc6..2a17b24 100644
329
- --- a/docs/skills.md
330
- +++ b/docs/skills.md
331
- @@ -130,6 +130,8 @@ pi skills remove browser-testing-with-devtools --repo
332
-
333
- `--session` is interactive-only and lasts until the session ends. `--global` and `--repo` persist to their respective JSON configuration. `list` and `search` show catalog skills. `pi skills active` shows the configured global and repository entries; `/skills active` also shows session entries.
334
-
335
- +Path arguments may use `~`, `$NAME`, or `${NAME}`; `/skills` expands them itself because its arguments never pass through a shell. With `--repo`, a path inside the current checkout is stored relative to the repository root, so the entry works in every clone and worktree with the same remote. Otherwise `add` keeps a `~` or `$NAME` spelling as typed and stores any other path as an absolute path, under `~` when it is in your home directory. Stored paths are expanded whenever Pi loads skills: at startup, after `/skills add` or `/skills remove`, and on `/reload` or `/skills reload`. Other relative entries resolve against the repository root in `repo-skills.json` and against the working directory in `skills.json`, so prefer absolute, `~`, or `$NAME` paths in `skills.json`.
336
- +
337
- Use `--no-skills` to suppress global and repository active skills; explicit `--skill` paths still load.
338
-
339
- ## Write portable frontmatter