{"_id":"@datspike/pi-inline-slash-extension","_rev":"2-0ddb787d7a09fa34174a1458f7df5a23","name":"@datspike/pi-inline-slash-extension","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@datspike/pi-inline-slash-extension","version":"0.1.0","keywords":["pi-package","pi","extension","autocomplete","slash-commands"],"license":"MIT","_id":"@datspike/pi-inline-slash-extension@0.1.0","maintainers":[{"name":"datspike","email":"elesin38@gmail.com"}],"homepage":"https://github.com/datspike/pi-inline-slash-extension#readme","bugs":{"url":"https://github.com/datspike/pi-inline-slash-extension/issues"},"pi":{"extensions":["./extensions/inline-slash.ts"]},"dist":{"shasum":"91b7a623cc53373ab725a285996df78d517cf6ca","tarball":"https://registry.npmjs.org/@datspike/pi-inline-slash-extension/-/pi-inline-slash-extension-0.1.0.tgz","fileCount":10,"integrity":"sha512-JdPnueynJKli1jq+KJVvw5S2P8Plcxwa3Ryfp6FHKMnGESLzwrris8SDy4Qnpw2dG37zrQVEXE0N+yxsiiGyjg==","signatures":[{"sig":"MEQCIG5amKsiTxn/oeqUB8TZgWyFwh1el87+fNfAs1mFhEUZAiBRUU5mhqRFPjwzZDgqFirSjJwmvFGh+KdVP4CZS0SUnQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":40676},"type":"module","engines":{"node":">=22"},"gitHead":"2eb5e031bbaa08c746f246b169604540fc96dfcb","private":false,"scripts":{"test":"vitest","verify:s01":"vitest --run tests/inline-slash/classifier.test.ts tests/inline-slash/command-catalog.test.ts tests/inline-slash/provider.test.ts tests/inline-slash/editor-smoke.test.ts","verify:s02":"vitest --run tests/inline-slash/classifier.test.ts tests/inline-slash/submit-routing.test.ts tests/inline-slash/editor-smoke.test.ts && tsc --noEmit","verify:s03":"bash scripts/verify-s03.sh"},"_npmUser":{"name":"datspike","email":"elesin38@gmail.com"},"repository":{"url":"git+https://github.com/datspike/pi-inline-slash-extension.git","type":"git"},"_npmVersion":"10.9.4","description":"Pi extension that adds inline slash autocomplete and absolute-path submit bypass without forking core.","directories":{},"_nodeVersion":"22.21.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^3.2.4","typescript":"^5.9.3","@types/node":"^24.8.1","@mariozechner/pi-coding-agent":"^0.65.0"},"peerDependencies":{"@mariozechner/pi-tui":"*","@mariozechner/pi-coding-agent":"*"},"_npmOperationalInternal":{"tmp":"tmp/pi-inline-slash-extension_0.1.0_1775429677505_0.4584578779602857","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@datspike/pi-inline-slash-extension","version":"0.2.0","description":"Pi extension for inline slash autocomplete, prompt-template expansion, and absolute-path submit bypass.","private":false,"type":"module","license":"MIT","repository":{"type":"git","url":"git+https://github.com/datspike/pi-inline-slash-extension.git"},"homepage":"https://github.com/datspike/pi-inline-slash-extension#readme","bugs":{"url":"https://github.com/datspike/pi-inline-slash-extension/issues"},"keywords":["pi-package","pi","extension","autocomplete","slash-commands","prompt-templates"],"engines":{"node":">=22"},"publishConfig":{"access":"public"},"pi":{"extensions":["./extensions/inline-slash.ts"]},"scripts":{"test":"vitest","verify:s01":"vitest --run tests/inline-slash/classifier.test.ts tests/inline-slash/command-catalog.test.ts tests/inline-slash/provider.test.ts tests/inline-slash/prompt-expansion.test.ts tests/inline-slash/editor-smoke.test.ts","verify:s02":"vitest --run tests/inline-slash/classifier.test.ts tests/inline-slash/submit-routing.test.ts tests/inline-slash/editor-smoke.test.ts && tsc --noEmit","verify:s03":"bash scripts/verify-s03.sh"},"peerDependencies":{"@mariozechner/pi-coding-agent":"*","@mariozechner/pi-tui":"*"},"devDependencies":{"@mariozechner/pi-coding-agent":"^0.65.0","@types/node":"^24.8.1","typescript":"^5.9.3","vitest":"^3.2.4"},"gitHead":"b432cb1e3ce94d6eeb2e46fb73cbe502b60d1ea6","_id":"@datspike/pi-inline-slash-extension@0.2.0","_nodeVersion":"24.20.0","_npmVersion":"11.19.0","dist":{"integrity":"sha512-sx14nlVA5xdgcDKt1WWkUsHJo7GxDYVjBEcETDPk9ndTapqSyp4ulfbH7ei+J4qjN5DMrQIM5B6lNOHv7kPIIA==","shasum":"b0090af996d53eadf356cd34d6ff90fa885fc827","tarball":"https://registry.npmjs.org/@datspike/pi-inline-slash-extension/-/pi-inline-slash-extension-0.2.0.tgz","fileCount":11,"unpackedSize":51886,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@datspike%2fpi-inline-slash-extension@0.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAQ9PYh1p1GmnrN4WIRtqC50cjs9OlS7o8i2Y5W/8rKWAiEA57HFRw+tvzexs23x1inuJ1m7H1ZwBvioGtxYQ9qJaaM="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:9967ec47-66c4-4dc7-a1a1-99088a5609b2"}},"directories":{},"maintainers":[{"name":"datspike","email":"elesin38@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-inline-slash-extension_0.2.0_1788898664681_0.8908321219688617"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-05T22:54:37.423Z","modified":"2026-09-08T20:17:45.154Z","0.1.0":"2026-04-05T22:54:37.655Z","0.2.0":"2026-09-08T20:17:44.824Z"},"bugs":{"url":"https://github.com/datspike/pi-inline-slash-extension/issues"},"license":"MIT","homepage":"https://github.com/datspike/pi-inline-slash-extension#readme","keywords":["pi-package","pi","extension","autocomplete","slash-commands","prompt-templates"],"repository":{"type":"git","url":"git+https://github.com/datspike/pi-inline-slash-extension.git"},"description":"Pi extension for inline slash autocomplete, prompt-template expansion, and absolute-path submit bypass.","maintainers":[{"name":"datspike","email":"elesin38@gmail.com"}],"readme":"# @datspike/pi-inline-slash-extension\n\nInstallable Pi extension that makes slash autocomplete work where people actually type: inside normal text and on the second line. It also expands public prompt templates inside ordinary text and stops leading absolute paths such as `/home/spike/file.ts` from being misrouted as slash commands.\n\nIf you found this repo from GitHub search, the practical summary is simple: install it, run `/reload`, and you get better inline slash UX without forking Pi core.\n\n## Why this exists\n\nPi already handles slash commands well at the start of the first line. This extension covers the two gaps that are most noticeable in day-to-day use:\n\n- inline slash autocomplete inside regular text;\n- slash autocomplete on the second line;\n- inline expansion of loaded public prompt templates such as `/ru-clean`;\n- submit bypass for a leading absolute path such as `/tmp/log.txt`.\n\n## Demo\n\n```text\nBefore:\ntext /gs             -> no useful inline slash completion\n/home/spike/file.ts  -> can be treated as a slash command\n\nAfter:\ntext /gs             -> suggests /gsd\ntext /skill:create   -> suggests /skill:create-skill\ntext /ru-clean       -> expands the public prompt body\n/home/spike/file.ts  -> sent as a normal user message\n```\n\n<!-- verifier:readme/shipped-scope -->\n## Features\n\nWhat is actually shipped:\n\n- inline slash and skill autocomplete works not only at the start of the first line, but also mid-line and on the second line;\n- known public prompt commands expand to their UTF-8 Markdown body inside ordinary text, including multiple tokens and multiline input;\n- leading prompt invocations remain delegated to core so template arguments keep working;\n- fenced code, inline code, escaped tokens, unknown slash tokens, skills, and absolute paths remain safe;\n- a leading absolute path such as `/home/spike/file.ts` or `/tmp/log.txt` is sent as a normal user message instead of being treated as a slash command;\n- the current scope is proven by local tests and shell verifiers, without an upstream patch.\n\n## Quick start\n\n### 1. Install as a Pi package\n\n```bash\npi install npm:@datspike/pi-inline-slash-extension\n```\n\n### 2. Reload Pi\n\n```text\n/reload\n```\n\n### 3. Try these scenarios\n\n- type `text /gs` -> expect `/gsd` autocomplete;\n- type `text /skill:create` -> expect `/skill:create-skill` autocomplete;\n- if a prompt template such as `/ru-clean` is already loaded, submit `text /ru-clean` -> expect its Markdown body inside the user message;\n- type `/home/spike/file.ts` and press Enter -> expect a normal user message, not command routing.\n\nIf these checks pass, the extension is wired correctly.\n\n## Inline prompt segments\n\nThis package expands prompt templates discovered through Pi's public `getCommands()` catalog. It does not ship `/ru-clean` or other prompt content itself; those templates come from your global/project prompt directories or other installed packages.\n\nUse an exact whitespace-delimited prompt command inside ordinary text:\n\n```text\nFix the bug /ru-clean\nImplement and verify /two-sessions /ru-clean\n```\n\nSeveral segments may appear in one multiline message. Inline segments do not accept arguments because their boundary would be ambiguous. A prompt command at the beginning of the message remains delegated to Pi core, so normal template arguments still work.\n\nUse a backslash when the slash command must stay literal:\n\n```text\nShow the token \\/ru-clean without expanding it.\n```\n\n## At a glance\n\n| Capability | Status |\n| --- | --- |\n| Mid-line slash autocomplete | supported |\n| Second-line slash autocomplete | supported |\n| Leading absolute path submit bypass | supported |\n| Inline public prompt-template expansion | supported |\n| Override of core first-line slash behavior | not supported |\n| Synthetic catalog of hidden built-in commands | not supported |\n\n## Who this is for\n\nThis repository is a good fit if you:\n\n- use Pi interactively and often type slash commands inside longer prompts;\n- want `/home/...` or `/tmp/...` inputs to stay normal messages;\n- want an extension-layer solution without maintaining a Pi core fork.\n\nIt is probably not the right fit if you need a full built-in slash catalog or want to change core first-line slash behavior.\n\n<!-- verifier:readme/architecture -->\n## How it works\n\nThe extension is wired through the package entrypoint `extensions/inline-slash.ts`. Prompt expansion works in every input-capable mode; the custom editor is installed only when `ctx.hasUI` is true.\n\nHigh-level flow:\n\n1. registers the `input` handler without calling runtime action methods during extension loading;\n2. after `session_start`, builds the public catalog via `buildCommandCatalog(api.getCommands())`;\n3. expands only exact public `source=\"prompt\"` tokens;\n4. wraps `CustomEditor` via `src/inline-slash/editor.ts`;\n5. attaches submit routing through `createInlineSlashSubmitStrategy`;\n6. registers the editor through `ctx.ui.setEditorComponent(...)`.\n\nCore is not patched. More detail: `docs/ARCHITECTURE.md`.\n\n## Installation options\n\n### Package install\n\nThe package entrypoint is `extensions/inline-slash.ts`, and `package.json` declares the `pi.extensions` manifest.\n\n```bash\npi install npm:@datspike/pi-inline-slash-extension\n```\n\nThis is the recommended setup for normal use after npm publication.\n\n### Direct path wiring\n\nIf you prefer not to install the package, Pi can load the same entrypoint directly from settings:\n\n```json\n{\n  \"extensions\": [\n    \"/absolute/path/to/pi-inline-slash-extension/extensions/inline-slash.ts\"\n  ]\n}\n```\n\nTypical settings file:\n\n```text\n~/.pi/agent/settings.json\n```\n\n### Expected result after wiring\n\n- Pi starts without an import error from `extensions/inline-slash.ts`;\n- after `/reload`, typing `text /gs` shows `/gsd`;\n- submitting `/home/spike/file.ts` no longer goes to `Unknown command` and instead stays a normal user message.\n\n<!-- verifier:readme/runtime-seams -->\n## Implementation notes\n\nMain files:\n\n- `extensions/inline-slash.ts`\n- `src/inline-slash/command-catalog.ts`\n- `src/inline-slash/provider.ts`\n- `src/inline-slash/classifier.ts`\n- `src/inline-slash/editor.ts`\n- `src/inline-slash/prompt-expansion.ts`\n- `docs/UPSTREAM-SEAMS.md`\n\nImportant boundaries:\n\n- the catalog is built from `pi.getCommands()` only;\n- prompt expansion reads only `source=\"prompt\"` entries and uses `sourceInfo.path` as the template path;\n- `sourceInfo` is treated as the canonical provenance contract;\n- `sendUserMessage` is required only for the absolute-path bypass path;\n- `/unknown` stays on the delegated core path.\n\nThe remaining editor seam is isolated in `src/inline-slash/editor.ts`. More detail: `docs/ARCHITECTURE.md` and `docs/UPSTREAM-SEAMS.md`.\n\n<!-- verifier:readme/verified-scenarios -->\n## What is verified\n\nAutomated proof covers the shipped user-facing behavior:\n\n- `text /gs` -> the local inline catalog suggests `/gsd`;\n- `text /skill:create` -> the local inline catalog suggests `/skill:create-skill`;\n- second line `/gs` -> autocomplete works without a first-line restriction;\n- `/home/spike/file.ts` and `/tmp/log.txt` bypass slash dispatch on submit;\n- ordinary text with `/ru-clean` expands the prompt body, including multiple and multiline segments;\n- a message that starts with an absolute path still expands later prompt segments before `sendUserMessage`;\n- leading `/ru-clean args`, code blocks, inline code, `\\\\/ru-clean`, missing files, unknown tokens, and skill tokens follow their safe boundaries;\n- `/gsd auto`, `/skill:create-skill demo`, and `/unknown` remain on the delegated core submit path.\n\nDetailed coverage and command breakdown: `docs/VERIFICATION.md`.\n\n<!-- verifier:readme/verification-commands -->\n## Verification\n\nMain command:\n\n```bash\nnpm run verify:s03\nbash scripts/verify-s03.sh\n```\n\nDrill-down commands:\n\n```bash\nnpm run verify:s01\nbash scripts/verify-s01.sh\nnpm run verify:s02\nbash scripts/verify-s02.sh\n```\n\n`verify:s03` is the main verification entrypoint. It runs the shipped proof surface and validates the README markers used by the repository guards. More detail: `docs/VERIFICATION.md`.\n\n## Manual `/reload` checklist\n\n<!-- verifier:readme/manual-reload-checklist -->\nAfter loading the extension in Pi, run `/reload` and verify the following scenarios:\n\n- `scenario:inline-gsd-mid-line` -> type `text /gs` and confirm that `/gsd` autocomplete appears.\n- `scenario:inline-skill-mid-line` -> type `text /skill:create` and confirm that `/skill:create-skill` appears.\n- `scenario:second-line-gsd` -> on the second line type `/gs` and confirm that `/gsd` appears.\n- `scenario:inline-prompt-expansion` -> submit ordinary text containing `/ru-clean` and confirm the Markdown body is expanded.\n- `scenario:inline-prompt-protection` -> verify leading delegation, code fences, inline code, escapes, missing files, unknown tokens, and skill tokens.\n- `scenario:path-home-submit-bypass` -> type `/home/spike/file.ts` and press Enter; expected result is normal user-message behavior without `Unknown command`.\n- `scenario:path-with-inline-prompt` -> submit an absolute path followed by ordinary text and `/ru-clean`; expect the path to stay literal and the prompt body to expand.\n- `scenario:path-tmp-submit-bypass` -> type `/tmp/log.txt` and press Enter; expected result is the same bypass through a normal message.\n- `scenario:delegate-gsd-submit` -> on the first line type `/gsd auto` and press Enter; expected result is the normal slash command path.\n- `scenario:delegate-skill-submit` -> on the first line type `/skill:create-skill demo` and press Enter; expected result is the normal skill submit path.\n- `scenario:delegate-unknown-submit` -> on the first line type `/unknown` and press Enter; expected result is core unknown-command handling, not a normal user message.\n\n<!-- verifier:readme/proven-limitations -->\n## Current limitations\n\n- the inline catalog is built only from public `pi.getCommands()` output and does not synthesize a full built-in slash catalog;\n- only public sources `extension`, `prompt`, `skill` are accepted;\n- the package does not provide prompt bodies; it expands prompt templates loaded by Pi from other sources;\n- prompt expansion is limited to exact whitespace-delimited tokens with no inline arguments;\n- prompt files that cannot be read remain literal and produce a compact UI warning when available;\n- first-line start-of-message slash autocomplete remains delegated core behavior;\n- non-slash autocomplete contexts such as `@` file references stay delegated to the core provider;\n- submit bypass looks only at the leading token after `trim()`: a leading absolute path is bypassed, everything else goes to core submit;\n- `/unknown` intentionally remains delegated core unknown-command handling;\n- package installability is not the same as full API stability, because inline refresh still depends on a narrow editor runtime seam.\n\nCompatibility baseline:\n\n- working and verified baseline: `@mariozechner/pi-coding-agent` `^0.65.0`.\n\n<!-- verifier:readme/upstream-patch-plan -->\n## Upstream considerations\n\nFor the shipped scope, an upstream patch is not required. The current package and tests prove the needed behavior at the extension layer.\n\nA small upstream patch would still improve long-term package stability: a public editor seam for autocomplete open/refresh/close and a pre-dispatch submit hook. Details are in `docs/UPSTREAM-SEAMS.md`.\n\nReasons to revisit an upstream patch:\n\n- support inline autocomplete for built-in commands that are not present in public `pi.getCommands()`;\n- change core handling for `/unknown`;\n- change the standard first-line slash behavior instead of delegating to core;\n- remove the remaining dependency on editor internals for more reliable compatibility.\n\n## FAQ\n\n### Does this patch Pi core?\n\nNo. The extension stays at the extension layer and keeps the standard first-line slash path delegated to core.\n\n### Does it change how unknown slash commands work?\n\nNo. `/unknown` intentionally stays on the normal core path.\n\n### Does it expose every built-in slash command inline?\n\nNo. The inline catalog is built from public `pi.getCommands()` output only.\n\n## Related docs\n\n- `docs/ARCHITECTURE.md` for runtime wiring and boundaries.\n- `docs/VERIFICATION.md` for automated and manual proof.\n- `docs/UPSTREAM-SEAMS.md` for the remaining editor/runtime seam request.\n","readmeFilename":"README.md"}