pi-short-links 0.1.0 → 0.2.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/CHANGELOG.md +6 -0
- package/README.md +96 -22
- package/docs/release.md +21 -93
- package/package.json +57 -56
- package/docs/examples.md +0 -134
- package/docs/github-template.md +0 -63
- package/docs/publish-rerun-rollout.md +0 -26
- package/docs/repository-settings.md +0 -43
- package/docs/template-checklist.md +0 -164
- package/docs/template-sync-checklist.md +0 -69
- package/docs/template-sync.md +0 -42
- package/docs/typescript.md +0 -97
- package/extensions/hello.ts +0 -128
- package/extensions/index.ts +0 -90
- package/extensions/package-layout/index.ts +0 -49
- package/extensions/package-layout/lib/config.ts +0 -9
- package/extensions/package-layout/lib/stats.ts +0 -35
- package/extensions/skill-bridge/SKILL.md +0 -19
- package/extensions/skill-bridge/index.ts +0 -25
- package/extensions/tui-dashboard.ts +0 -97
- package/lib/config-contract.ts +0 -46
- package/lib/error-contract.ts +0 -72
- package/lib/format-table.ts +0 -46
- package/lib/greeting.ts +0 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
- Align repo with the pi-extension-template generated-package shape: canonical README, sibling-matching CI/publish/auto-release workflows, and docs cleanup.
|
|
6
|
+
- Remove template placeholders: `example-skill`, `example` prompt, `example-theme`, greeting/dashboard/bridge/layout extensions, the `create-pi-extension` workspace, and bootstrap docs.
|
|
7
|
+
- CI now publishes to npm via Trusted Publishing on version bump (version push to main -> tag -> GitHub Release -> publish workflow).
|
|
8
|
+
|
|
3
9
|
## 0.1.0
|
|
4
10
|
|
|
5
11
|
- Initial release: force OSC 8 for Orca/`FORCE_HYPERLINK`, shorten long assistant URLs and paths to pane-fitting markdown links.
|
package/README.md
CHANGED
|
@@ -1,46 +1,120 @@
|
|
|
1
1
|
# Pi Short Links
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://discord.gg/4945dXZVW5)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://github.com/eiei114/pi-short-links/actions/workflows/ci.yml)
|
|
6
|
+
[](https://github.com/eiei114/pi-short-links/actions/workflows/publish.yml)
|
|
7
|
+
[](https://www.npmjs.com/package/pi-short-links)
|
|
8
|
+
[](https://www.npmjs.com/package/pi-short-links)
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
[](https://pi.dev/packages)
|
|
11
|
+
[](docs/release.md)
|
|
12
|
+
<a href="https://buymeacoffee.com/ekawano114m"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" width="217" height="60"></a>
|
|
6
13
|
|
|
7
|
-
|
|
14
|
+
> Shorten long URLs and file paths in Pi assistant output so links fit the pane and stay clickable.
|
|
8
15
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
16
|
+
## What this is
|
|
17
|
+
|
|
18
|
+
Pi Short Links is a TypeScript Pi package that rewrites long bare `http(s)` URLs and absolute/`~/` paths in assistant text into short markdown links (`[host/…tail](full-url)`, `[~/dir/…/file](file://…)`). When `FORCE_HYPERLINK=1` or `TERM_PROGRAM=Orca`, it also forces Pi TUI OSC 8 hyperlinks on. Fenced code blocks are left untouched.
|
|
19
|
+
|
|
20
|
+
## Features
|
|
21
|
+
|
|
22
|
+
- Pane-width-aware shortening for bare `http(s)` URLs.
|
|
23
|
+
- Absolute / `~/` path shortening with `file://` targets.
|
|
24
|
+
- Forces OSC 8 hyperlinks when `FORCE_HYPERLINK=1` or `TERM_PROGRAM=Orca`.
|
|
25
|
+
- Skips content inside fenced code blocks.
|
|
26
|
+
- Does not rewrite existing markdown links' destinations.
|
|
12
27
|
|
|
13
28
|
## Install
|
|
14
29
|
|
|
30
|
+
Install the published npm package with Pi:
|
|
31
|
+
|
|
15
32
|
```bash
|
|
16
33
|
pi install npm:pi-short-links
|
|
17
|
-
# or local dogfood
|
|
18
|
-
pi install /path/to/pi-short-links
|
|
19
34
|
```
|
|
20
35
|
|
|
21
|
-
|
|
36
|
+
Pin a specific version when you want reproducible installs:
|
|
22
37
|
|
|
23
|
-
```
|
|
24
|
-
|
|
38
|
+
```bash
|
|
39
|
+
pi install npm:pi-short-links@0.2.0
|
|
25
40
|
```
|
|
26
41
|
|
|
27
|
-
|
|
42
|
+
Install into the current project instead of your user Pi settings:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pi install npm:pi-short-links -l
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Or install from GitHub:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pi install git:github.com/eiei114/pi-short-links
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Try it without permanently installing:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pi -e npm:pi-short-links
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Quick start
|
|
28
61
|
|
|
29
|
-
|
|
30
|
-
- Absolute / `~/` path shortening with `file://` targets
|
|
31
|
-
- Skips content inside ` ``` ` fences
|
|
32
|
-
- Does not rewrite existing markdown links' destinations
|
|
62
|
+
Try the local checkout without permanently installing it:
|
|
33
63
|
|
|
34
|
-
|
|
64
|
+
```bash
|
|
65
|
+
FORCE_HYPERLINK=1 pi -e .
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Then send a message containing a long URL or absolute file path and confirm it renders as a short clickable link.
|
|
35
69
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
70
|
+
## Package contents
|
|
71
|
+
|
|
72
|
+
| Path | Purpose |
|
|
73
|
+
|---|---|
|
|
74
|
+
| `extensions/short-links.ts` | Assistant-text shortening hook and OSC 8 force |
|
|
75
|
+
| `lib/shorten.ts` | URL/path shortening logic |
|
|
76
|
+
| `docs/release.md` | Trusted Publishing and release flow |
|
|
77
|
+
| `README.md` | GitHub and npm package entrypoint |
|
|
78
|
+
| `CHANGELOG.md` | Versioned release notes |
|
|
79
|
+
| `LICENSE` | MIT license |
|
|
39
80
|
|
|
40
81
|
## Development
|
|
41
82
|
|
|
42
83
|
```bash
|
|
43
84
|
npm install
|
|
44
|
-
npm
|
|
45
|
-
npm run
|
|
85
|
+
npm run ci
|
|
86
|
+
npm pack --dry-run
|
|
87
|
+
FORCE_HYPERLINK=1 pi -e .
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Release
|
|
91
|
+
|
|
92
|
+
This package is set up for npm Trusted Publishing, so no `NPM_TOKEN` is required.
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
npm version minor
|
|
96
|
+
git push
|
|
46
97
|
```
|
|
98
|
+
|
|
99
|
+
See [`docs/release.md`](docs/release.md) for setup details.
|
|
100
|
+
|
|
101
|
+
## Docs
|
|
102
|
+
|
|
103
|
+
- [`docs/release.md`](docs/release.md) — Trusted Publishing and automated release details
|
|
104
|
+
- [`ROADMAP.md`](ROADMAP.md) — current status and planned work
|
|
105
|
+
|
|
106
|
+
## Security
|
|
107
|
+
|
|
108
|
+
Pi packages can execute code with your local permissions. Review extensions before installing third-party packages.
|
|
109
|
+
|
|
110
|
+
For vulnerability reporting, see [`SECURITY.md`](SECURITY.md).
|
|
111
|
+
|
|
112
|
+
## Links
|
|
113
|
+
|
|
114
|
+
- npm: https://www.npmjs.com/package/pi-short-links
|
|
115
|
+
- GitHub: https://github.com/eiei114/pi-short-links
|
|
116
|
+
- Issues: https://github.com/eiei114/pi-short-links/issues
|
|
117
|
+
|
|
118
|
+
## License
|
|
119
|
+
|
|
120
|
+
MIT
|
package/docs/release.md
CHANGED
|
@@ -1,108 +1,36 @@
|
|
|
1
1
|
# Release
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`pi-short-links` publishes to npm through GitHub Actions Trusted Publishing.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Initial bootstrap publish
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
## One-time npm setup
|
|
10
|
-
|
|
11
|
-
On npmjs.com, configure Trusted Publishing for **`create-pi-extension`**:
|
|
12
|
-
|
|
13
|
-
- Publisher: GitHub Actions
|
|
14
|
-
- Repository: `eiei114/pi-extension-template`
|
|
15
|
-
- Workflow filename: `publish.yml`
|
|
16
|
-
- Permissions: publish (and stage publish if used)
|
|
17
|
-
|
|
18
|
-
Remove or update any Trusted Publisher entry that still targets the legacy root package name `pi-extension-template`.
|
|
19
|
-
|
|
20
|
-
## Publish
|
|
7
|
+
npm only allows Trusted Publisher configuration after the package exists. Publish `0.1.0` once from a maintainer machine using interactive `npm login`:
|
|
21
8
|
|
|
22
9
|
```bash
|
|
23
|
-
npm
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
On `main`, `.github/workflows/auto-release.yml` checks the root `package.json` **repository version**. If `v<version>` does not exist yet, it creates the tag, creates the GitHub Release, then explicitly dispatches `.github/workflows/publish.yml` for that tag.
|
|
28
|
-
|
|
29
|
-
The `v*.*.*` tag also triggers `.github/workflows/publish.yml`, which syncs the bundled template, runs CI, and publishes `create-pi-extension@<version>` to npm when tags are pushed manually.
|
|
30
|
-
|
|
31
|
-
Publishing also runs when a GitHub Release is published, and can be run manually from GitHub Actions with `workflow_dispatch`.
|
|
32
|
-
|
|
33
|
-
`publish.yml` runs `npm run sync:template` before publish so the tarball includes the current **Bundled template** under `packages/create-pi-extension/template/`.
|
|
34
|
-
|
|
35
|
-
The workflow skips `create-pi-extension@<version>` if that exact package version already exists on npm.
|
|
36
|
-
|
|
37
|
-
### Rerun and manual dispatch
|
|
38
|
-
|
|
39
|
-
`publish.yml` checks the public npm registry API before `setup-node` configures OIDC auth. That keeps already-published reruns green:
|
|
40
|
-
|
|
41
|
-
- `workflow_dispatch` on an existing tag/ref
|
|
42
|
-
- duplicate `publish.yml` runs for the same `v<version>`
|
|
43
|
-
- auto-release handoff retries after a successful publish
|
|
44
|
-
|
|
45
|
-
When the version already exists, the job still runs validation but logs `publish intentionally skipped` and exits without calling `npm publish`.
|
|
46
|
-
|
|
47
|
-
Do not use `npm view` after `setup-node` with `registry-url` for this guard. Trusted Publishing OIDC can make authenticated metadata reads look like `404`, which leads to duplicate `E403` publish failures.
|
|
48
|
-
|
|
49
|
-
See also `docs/publish-rerun-rollout.md` for downstream rollout notes.
|
|
50
|
-
|
|
51
|
-
### First publish / Trusted Publisher not configured
|
|
52
|
-
|
|
53
|
-
`publish.yml` logs two different situations before `npm publish`:
|
|
54
|
-
|
|
55
|
-
| Registry check | Meaning | Workflow behavior |
|
|
56
|
-
| --- | --- | --- |
|
|
57
|
-
| `GET /create-pi-extension` returns **404** | Package name is **not registered** on npm yet | Continues to publish; logs Trusted Publisher setup guidance |
|
|
58
|
-
| `GET /create-pi-extension/<version>` returns **200** | That exact version is **already published** | Logs `publish intentionally skipped` and exits green without `npm publish` |
|
|
59
|
-
| Package exists, version returns **404** | New version for an existing package | Continues to publish |
|
|
60
|
-
|
|
61
|
-
If Trusted Publisher is missing or still targets the legacy `pi-extension-template` package, `npm publish` fails with:
|
|
62
|
-
|
|
63
|
-
```text
|
|
64
|
-
npm error code E404
|
|
65
|
-
npm error 404 Not Found - PUT https://registry.npmjs.org/create-pi-extension - Not found
|
|
10
|
+
npm ci
|
|
11
|
+
npm run ci
|
|
12
|
+
npm publish --access public
|
|
66
13
|
```
|
|
67
14
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
Fix (human-owned, one-time on npmjs.com):
|
|
71
|
-
|
|
72
|
-
1. Open **create-pi-extension** on npm (or create the package name under your npm org/user if npm allows pre-registration).
|
|
73
|
-
2. Add **Trusted Publisher**: GitHub Actions, repository `eiei114/pi-extension-template`, workflow filename `publish.yml`, permissions **publish** (and stage publish if used).
|
|
74
|
-
3. Remove or update any Trusted Publisher entry that still targets the legacy root package `pi-extension-template`.
|
|
75
|
-
4. Re-run `publish.yml` via `workflow_dispatch` on the release tag/ref (for example `v0.1.7`).
|
|
76
|
-
|
|
77
|
-
Do not add `NPM_TOKEN` to GitHub Secrets; this repository uses OIDC Trusted Publishing only.
|
|
78
|
-
|
|
79
|
-
## Workflow guardrail
|
|
15
|
+
Immediately after the package exists, configure Trusted Publishing below. Do not store the interactive login token in GitHub Secrets. Revoke the local token after setup when it is no longer needed.
|
|
80
16
|
|
|
81
|
-
|
|
82
|
-
The repository must include the release workflow pair:
|
|
17
|
+
## One-time Trusted Publishing setup
|
|
83
18
|
|
|
84
|
-
|
|
85
|
-
- `.github/workflows/publish.yml` syncs the template and publishes `create-pi-extension` through Trusted Publishing.
|
|
19
|
+
Configure npm Trusted Publishing for:
|
|
86
20
|
|
|
87
|
-
|
|
21
|
+
- Package: `pi-short-links`
|
|
22
|
+
- Provider: GitHub Actions
|
|
23
|
+
- Owner: `eiei114`
|
|
24
|
+
- Repository: `pi-short-links`
|
|
25
|
+
- Workflow: `publish.yml`
|
|
88
26
|
|
|
89
|
-
|
|
27
|
+
Do not add `NPM_TOKEN` or `NODE_AUTH_TOKEN` to repository workflows or secrets.
|
|
90
28
|
|
|
91
|
-
|
|
92
|
-
- `permissions: actions: write` on auto-release so it can dispatch `publish.yml`
|
|
93
|
-
- `auto-release.yml` must call `gh workflow run publish.yml --ref "$TAG" -f ref="$TAG"`, or `publish.yml` must have an equivalent explicit handoff trigger such as `workflow_run`
|
|
94
|
-
- GitHub-hosted runner
|
|
95
|
-
- Node.js 24, so the release job uses a current npm CLI for Trusted Publishing
|
|
96
|
-
- Bun (for `sync:template` before publish)
|
|
97
|
-
- No `NPM_TOKEN`
|
|
98
|
-
- `npm publish` from `packages/create-pi-extension` in the configured workflow file
|
|
29
|
+
## Automated release flow
|
|
99
30
|
|
|
100
|
-
|
|
31
|
+
1. Update `package.json` and `CHANGELOG.md` in the same PR.
|
|
32
|
+
2. Merge the PR to `main`.
|
|
33
|
+
3. `auto-release.yml` detects the version change, creates `v<version>` and a GitHub Release, then dispatches `publish.yml`.
|
|
34
|
+
4. `publish.yml` validates and publishes the root package with provenance.
|
|
101
35
|
|
|
102
|
-
|
|
103
|
-
- [ ] `packages/create-pi-extension/package.json` name is `create-pi-extension`
|
|
104
|
-
- [ ] `repository.url` points to the real GitHub repository
|
|
105
|
-
- [ ] npm Trusted Publisher targets `create-pi-extension` + `publish.yml`
|
|
106
|
-
- [ ] `npm run ci` passes
|
|
107
|
-
- [ ] `npm pack --dry-run` in `packages/create-pi-extension` contains `template/`
|
|
108
|
-
- [ ] CHANGELOG.md has the release date
|
|
36
|
+
Reruns skip versions already present on npm.
|
package/package.json
CHANGED
|
@@ -1,56 +1,57 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "pi-short-links",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Shorten long URLs and file paths in Pi assistant output so OSC 8 / click targets fit the pane width.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"author": "eiei114",
|
|
8
|
-
"keywords": [
|
|
9
|
-
"pi-package",
|
|
10
|
-
"pi",
|
|
11
|
-
"pi-extension",
|
|
12
|
-
"osc8",
|
|
13
|
-
"hyperlink",
|
|
14
|
-
"typescript"
|
|
15
|
-
],
|
|
16
|
-
"repository": {
|
|
17
|
-
"type": "git",
|
|
18
|
-
"url": "git+https://github.com/eiei114/pi-short-links.git"
|
|
19
|
-
},
|
|
20
|
-
"bugs": {
|
|
21
|
-
"url": "https://github.com/eiei114/pi-short-links/issues"
|
|
22
|
-
},
|
|
23
|
-
"homepage": "https://github.com/eiei114/pi-short-links#readme",
|
|
24
|
-
"files": [
|
|
25
|
-
"extensions/",
|
|
26
|
-
"lib/",
|
|
27
|
-
"docs/",
|
|
28
|
-
"README.md",
|
|
29
|
-
"LICENSE",
|
|
30
|
-
"CHANGELOG.md"
|
|
31
|
-
],
|
|
32
|
-
"scripts": {
|
|
33
|
-
"typecheck": "tsc --noEmit",
|
|
34
|
-
"test": "node --test tests
|
|
35
|
-
"pack:check": "npm pack --dry-run",
|
|
36
|
-
"ci": "npm run typecheck && npm test && npm run pack:check"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"@earendil-works/pi-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"@earendil-works/pi-
|
|
53
|
-
"@
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "pi-short-links",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Shorten long URLs and file paths in Pi assistant output so OSC 8 / click targets fit the pane width.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "eiei114",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"pi-package",
|
|
10
|
+
"pi",
|
|
11
|
+
"pi-extension",
|
|
12
|
+
"osc8",
|
|
13
|
+
"hyperlink",
|
|
14
|
+
"typescript"
|
|
15
|
+
],
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/eiei114/pi-short-links.git"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/eiei114/pi-short-links/issues"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/eiei114/pi-short-links#readme",
|
|
24
|
+
"files": [
|
|
25
|
+
"extensions/",
|
|
26
|
+
"lib/",
|
|
27
|
+
"docs/",
|
|
28
|
+
"README.md",
|
|
29
|
+
"LICENSE",
|
|
30
|
+
"CHANGELOG.md"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"typecheck": "tsc --noEmit",
|
|
34
|
+
"test": "node --test tests/*.test.mjs",
|
|
35
|
+
"pack:check": "npm pack --dry-run",
|
|
36
|
+
"ci": "npm run typecheck && npm test && npm run publish:guard && npm run pack:check",
|
|
37
|
+
"publish:guard": "node scripts/check-no-npm-token.mjs"
|
|
38
|
+
},
|
|
39
|
+
"pi": {
|
|
40
|
+
"extensions": [
|
|
41
|
+
"./extensions/short-links.ts"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
49
|
+
"@earendil-works/pi-tui": "*"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@earendil-works/pi-coding-agent": "^0.84.1",
|
|
53
|
+
"@earendil-works/pi-tui": "^0.84.1",
|
|
54
|
+
"@types/node": "^26.0.0",
|
|
55
|
+
"typescript": "^7.0.2"
|
|
56
|
+
}
|
|
57
|
+
}
|
package/docs/examples.md
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
# Examples
|
|
2
|
-
|
|
3
|
-
This template ships examples for each Pi package resource type and several extension API patterns.
|
|
4
|
-
|
|
5
|
-
These source files (`extensions/`, `skills/`, `prompts/`, `themes/`) are the **single source of truth**:
|
|
6
|
-
the `sync:template` script copies them into the `create-pi-extension` CLI bundle before publish.
|
|
7
|
-
To update what the CLI generates, edit these files and re-run `bun run sync:template`.
|
|
8
|
-
Scaffold a new project to get a copy of the latest examples:
|
|
9
|
-
|
|
10
|
-
```bash
|
|
11
|
-
bunx create-pi-extension my-pi-package
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
Then try the examples in your scaffolded project with `pi -e .`.
|
|
15
|
-
|
|
16
|
-
For a full walkthrough, see the [README](../README.md).
|
|
17
|
-
|
|
18
|
-
For maintainers, see [`docs/template-sync-checklist.md`](template-sync-checklist.md) for the sync procedure before publish.
|
|
19
|
-
|
|
20
|
-
## Extension
|
|
21
|
-
|
|
22
|
-
`extensions/hello.ts` registers:
|
|
23
|
-
|
|
24
|
-
- `/template-hello`
|
|
25
|
-
- `/template-status` (TUI-only custom entry via `appendEntry` + `registerEntryRenderer`)
|
|
26
|
-
- session, turn, and tool lifecycle event handlers
|
|
27
|
-
- a small session status indicator
|
|
28
|
-
|
|
29
|
-
Try it with:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
pi -e .
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Then run:
|
|
36
|
-
|
|
37
|
-
```txt
|
|
38
|
-
/template-hello YourName
|
|
39
|
-
/template-status Package ready
|
|
40
|
-
?template
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Agent Skill (package manifest)
|
|
44
|
-
|
|
45
|
-
`skills/example-skill/SKILL.md` demonstrates a minimal Agent Skill. Its
|
|
46
|
-
frontmatter uses the required `name` and `description` fields plus the optional
|
|
47
|
-
`license` field, following the Agent Skills spec that Pi validates against
|
|
48
|
-
(see `docs/skills.md`).
|
|
49
|
-
|
|
50
|
-
Replace it with your real workflow instructions.
|
|
51
|
-
|
|
52
|
-
## Agent Skill (extension `resources_discover`)
|
|
53
|
-
|
|
54
|
-
`extensions/skill-bridge/` contributes `template-skill-bridge` at runtime:
|
|
55
|
-
|
|
56
|
-
- `index.ts` returns `skillPaths` from the `resources_discover` event
|
|
57
|
-
- `SKILL.md` lives beside the extension entrypoint
|
|
58
|
-
|
|
59
|
-
Commands:
|
|
60
|
-
|
|
61
|
-
```txt
|
|
62
|
-
/template-skill-info
|
|
63
|
-
/skill:template-skill-bridge
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
Use this pattern when a skill should ship with an extension instead of the top-level `skills/` directory.
|
|
67
|
-
|
|
68
|
-
## Typed custom tool
|
|
69
|
-
|
|
70
|
-
`extensions/index.ts` registers:
|
|
71
|
-
|
|
72
|
-
- `/template-info`
|
|
73
|
-
- `template_greet` custom tool
|
|
74
|
-
|
|
75
|
-
The tool demonstrates:
|
|
76
|
-
|
|
77
|
-
- `pi.registerTool()` with TypeBox object parameters
|
|
78
|
-
- a string enum schema via `StringEnum`
|
|
79
|
-
- `prepareArguments()` for legacy argument compatibility before schema validation
|
|
80
|
-
- custom `renderCall` / `renderResult` rendering
|
|
81
|
-
- shared logic imported from `lib/greeting.ts`
|
|
82
|
-
- TUI `renderCall` / `renderResult` via `Text`
|
|
83
|
-
|
|
84
|
-
## TUI component composition
|
|
85
|
-
|
|
86
|
-
`extensions/tui-dashboard.ts` demonstrates composing `@earendil-works/pi-tui` primitives:
|
|
87
|
-
|
|
88
|
-
- `Box` for padded, themed containers
|
|
89
|
-
- `Loader` for spinner-style progress feedback
|
|
90
|
-
- column-aligned tables built with shared `lib/format-table.ts` and rendered via `Text`
|
|
91
|
-
|
|
92
|
-
Command:
|
|
93
|
-
|
|
94
|
-
```txt
|
|
95
|
-
/template-dashboard
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
`pi-tui` does not ship a dedicated `Table` or `Spinner` component; this example uses `Loader` for spinners and a small table formatter for aligned columns.
|
|
99
|
-
|
|
100
|
-
## Multi-file extension layout
|
|
101
|
-
|
|
102
|
-
`extensions/package-layout/` demonstrates a subdirectory extension with local modules:
|
|
103
|
-
|
|
104
|
-
- `lib/config.ts` — typed configuration defaults
|
|
105
|
-
- `lib/stats.ts` — resource metadata helpers
|
|
106
|
-
- imports from package-wide `lib/format-table.ts`
|
|
107
|
-
|
|
108
|
-
Commands:
|
|
109
|
-
|
|
110
|
-
```txt
|
|
111
|
-
/template-layout
|
|
112
|
-
/template-layout-clear
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
## Prompt template
|
|
116
|
-
|
|
117
|
-
`prompts/example.md` demonstrates a tiny prompt template with one positional
|
|
118
|
-
argument (`/example <topic>`). Pi expands templates with `$1`, `$@`, and
|
|
119
|
-
`${1:-default}` — it does not support Mustache-style `{{var}}` placeholders.
|
|
120
|
-
|
|
121
|
-
## Theme
|
|
122
|
-
|
|
123
|
-
`themes/example-theme.json` ships a complete, loadable dark theme as a starting
|
|
124
|
-
point. Pi requires every theme to define all 51 color tokens, so edit the
|
|
125
|
-
palette in place rather than trimming tokens. Remove `themes/` (and the
|
|
126
|
-
`pi.themes` manifest entry) if your package does not ship themes.
|
|
127
|
-
|
|
128
|
-
## Shared library helpers
|
|
129
|
-
|
|
130
|
-
| File | Purpose |
|
|
131
|
-
|---|---|
|
|
132
|
-
| `lib/greeting.ts` | Greeting helpers used by `template_greet` |
|
|
133
|
-
| `lib/format-table.ts` | Monospace table formatter for widgets and TUI examples |
|
|
134
|
-
| `lib/config-contract.ts` | Schema-derived runtime config validation with valid/invalid contract tests |
|
package/docs/github-template.md
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# GitHub Template Repository
|
|
2
|
-
|
|
3
|
-
> **Template bootstrap doc.** Use while setting up a new repo from this template. Delete this file or merge any project-specific steps into README / Vault notes once setup is done, unless it still adds maintainer value.
|
|
4
|
-
|
|
5
|
-
## Recommended development flow
|
|
6
|
-
|
|
7
|
-
After generating a repo from this template, use this default order:
|
|
8
|
-
|
|
9
|
-
```txt
|
|
10
|
-
Vault notes -> PRD -> Issues -> implement -> ci/check -> release -> save learnings
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
In practice:
|
|
14
|
-
|
|
15
|
-
1. Create Vault notes under `4_Project/<ProjectName>/`.
|
|
16
|
-
2. Add `CONTEXT.md`, `README.md`, `ROADMAP.md`, `Docs/`, `Issues/`, and `Progress/`.
|
|
17
|
-
3. Write the PRD in `Docs/`.
|
|
18
|
-
4. Split approved issue files into `Issues/`.
|
|
19
|
-
5. Implement in the OSS repo created from this template.
|
|
20
|
-
6. Run CI and package checks before release.
|
|
21
|
-
7. Save release notes and follow-up decisions back to the Vault project.
|
|
22
|
-
|
|
23
|
-
Enable template mode on the source repository:
|
|
24
|
-
|
|
25
|
-
```txt
|
|
26
|
-
GitHub repo → Settings → General → Template repository
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Create a public repository from the template:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
gh repo create OWNER/new-pi-extension \
|
|
33
|
-
--public \
|
|
34
|
-
--template OWNER/pi-extension-template \
|
|
35
|
-
--clone
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Create a private repository from the template:
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
gh repo create OWNER/new-pi-extension \
|
|
42
|
-
--private \
|
|
43
|
-
--template OWNER/pi-extension-template \
|
|
44
|
-
--clone
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Include all branches if needed:
|
|
48
|
-
|
|
49
|
-
```bash
|
|
50
|
-
gh repo create OWNER/new-pi-extension \
|
|
51
|
-
--public \
|
|
52
|
-
--template OWNER/pi-extension-template \
|
|
53
|
-
--include-all-branches \
|
|
54
|
-
--clone
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
After creation:
|
|
58
|
-
|
|
59
|
-
```bash
|
|
60
|
-
cd new-pi-extension
|
|
61
|
-
npm install
|
|
62
|
-
npm run ci
|
|
63
|
-
```\n
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# Publish rerun guard rollout
|
|
2
|
-
|
|
3
|
-
Template fix: `publish.yml` now checks `https://registry.npmjs.org/<package>/<version>` before `setup-node` configures OIDC auth. Reruns for an already-published version exit green and log `publish intentionally skipped`.
|
|
4
|
-
|
|
5
|
-
## Why downstream repos need this
|
|
6
|
-
|
|
7
|
-
Older template copies used `npm view` after `setup-node` with `registry-url`. With npm Trusted Publishing, authenticated metadata reads can return `404` even when the version exists, so the guard misses and `npm publish` fails with `403 Forbidden - You cannot publish over the previously published versions`.
|
|
8
|
-
|
|
9
|
-
## Rollout list
|
|
10
|
-
|
|
11
|
-
Apply the updated `publish.yml` skip step (or merge the latest `pi-extension-template` workflow) in:
|
|
12
|
-
|
|
13
|
-
- [ ] `pi-startup-picker` — failed run `28704558891` on `v0.2.2`
|
|
14
|
-
- [ ] `pi-git-delegate` — failed run `28704535034` on `0.2.2`
|
|
15
|
-
- [ ] `pi-baton` — failed run `28704529442` on `0.7.2`
|
|
16
|
-
- [ ] `pi-widget-host` — failed run `28704568448` on `0.3.3`
|
|
17
|
-
- [ ] `pi-widget-core` — failed run `28704566953` on `0.1.2`
|
|
18
|
-
- [ ] `pi-handoff-clipboard` — failed run `28704536299`
|
|
19
|
-
- [ ] `pi-scheduled-router` — failed run `28704552385`
|
|
20
|
-
|
|
21
|
-
## Verification after rollout
|
|
22
|
-
|
|
23
|
-
1. Open Actions → `Publish to npm`.
|
|
24
|
-
2. Run `workflow_dispatch` on the tag for a version that is already on npm.
|
|
25
|
-
3. Confirm logs contain `publish intentionally skipped`.
|
|
26
|
-
4. Confirm the run is green and `npm publish` did not run.
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# Repository Settings
|
|
2
|
-
|
|
3
|
-
> **Template bootstrap doc.** Use while configuring GitHub About, topics, and branch protection after generating a repo. Delete this file or merge needed settings into README once setup is done, unless it still adds maintainer value.
|
|
4
|
-
|
|
5
|
-
Use this file after creating a real repository from the template.
|
|
6
|
-
|
|
7
|
-
## GitHub About
|
|
8
|
-
|
|
9
|
-
Suggested fields:
|
|
10
|
-
|
|
11
|
-
- Description: one-line pitch for the Pi package
|
|
12
|
-
- Website: npm package URL or project docs URL
|
|
13
|
-
- Topics:
|
|
14
|
-
- `pi`
|
|
15
|
-
- `pi-package`
|
|
16
|
-
- `agent-skill`
|
|
17
|
-
- `typescript`
|
|
18
|
-
|
|
19
|
-
## Template mode
|
|
20
|
-
|
|
21
|
-
If this repository itself should be reusable as a template:
|
|
22
|
-
|
|
23
|
-
```txt
|
|
24
|
-
Settings → General → Template repository
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Branch protection
|
|
28
|
-
|
|
29
|
-
Recommended for public packages:
|
|
30
|
-
|
|
31
|
-
- Require pull request before merging
|
|
32
|
-
- Require status checks to pass
|
|
33
|
-
- Require `CI` workflow
|
|
34
|
-
- Block force pushes on the default branch
|
|
35
|
-
|
|
36
|
-
## npm package page
|
|
37
|
-
|
|
38
|
-
After first publish:
|
|
39
|
-
|
|
40
|
-
- Confirm README renders correctly
|
|
41
|
-
- Confirm package provenance appears
|
|
42
|
-
- Confirm package contents are intentional
|
|
43
|
-
- Add npm URL to GitHub About and README
|