pi-short-links 0.1.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 +5 -0
- package/LICENSE +21 -0
- package/README.md +46 -0
- package/docs/examples.md +134 -0
- package/docs/github-template.md +63 -0
- package/docs/publish-rerun-rollout.md +26 -0
- package/docs/release.md +108 -0
- package/docs/repository-settings.md +43 -0
- package/docs/template-checklist.md +164 -0
- package/docs/template-sync-checklist.md +69 -0
- package/docs/template-sync.md +42 -0
- package/docs/typescript.md +97 -0
- package/extensions/hello.ts +128 -0
- package/extensions/index.ts +90 -0
- package/extensions/package-layout/index.ts +49 -0
- package/extensions/package-layout/lib/config.ts +9 -0
- package/extensions/package-layout/lib/stats.ts +35 -0
- package/extensions/short-links.ts +64 -0
- package/extensions/skill-bridge/SKILL.md +19 -0
- package/extensions/skill-bridge/index.ts +25 -0
- package/extensions/tui-dashboard.ts +97 -0
- package/lib/config-contract.ts +46 -0
- package/lib/error-contract.ts +72 -0
- package/lib/format-table.ts +46 -0
- package/lib/greeting.ts +16 -0
- package/lib/shorten.ts +177 -0
- package/package.json +56 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 YOUR_NAME
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Pi Short Links
|
|
2
|
+
|
|
3
|
+
Shorten long URLs and absolute file paths in Pi assistant output so clickable links fit the terminal pane.
|
|
4
|
+
|
|
5
|
+
## Why
|
|
6
|
+
|
|
7
|
+
Long bare URLs wrap across lines. Terminals that only detect text URLs (or terminals Pi does not yet mark as OSC 8-capable) open only the first wrapped line. This package:
|
|
8
|
+
|
|
9
|
+
1. Forces OSC 8 hyperlinks when `FORCE_HYPERLINK=1` or `TERM_PROGRAM=Orca`
|
|
10
|
+
2. Rewrites assistant text that exceeds the pane width into short markdown links (`[host/…tail](full-url)`, `[~/dir/…/file](file://…)`)
|
|
11
|
+
3. Leaves fenced code blocks untouched
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pi install npm:pi-short-links
|
|
17
|
+
# or local dogfood
|
|
18
|
+
pi install /path/to/pi-short-links
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Add to project `.pi/settings.json` `packages`:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
"../../OSS/pi-short-links"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
- Pane-width-aware shortening for bare `http(s)` URLs
|
|
30
|
+
- Absolute / `~/` path shortening with `file://` targets
|
|
31
|
+
- Skips content inside ` ``` ` fences
|
|
32
|
+
- Does not rewrite existing markdown links' destinations
|
|
33
|
+
|
|
34
|
+
## Non-goals
|
|
35
|
+
|
|
36
|
+
- Orca-specific wrap-join fixes
|
|
37
|
+
- Public URL shorteners
|
|
38
|
+
- Rewriting tool-result bodies (assistant text only in v0.1)
|
|
39
|
+
|
|
40
|
+
## Development
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install
|
|
44
|
+
npm test
|
|
45
|
+
npm run typecheck
|
|
46
|
+
```
|
package/docs/examples.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
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 |
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
|
@@ -0,0 +1,26 @@
|
|
|
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.
|
package/docs/release.md
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Release
|
|
2
|
+
|
|
3
|
+
This repository publishes **`create-pi-extension`** to npm using Trusted Publishing with GitHub Actions OIDC.
|
|
4
|
+
|
|
5
|
+
The root `pi-extension-template` package is the **template source** and is not published to npm. Only `packages/create-pi-extension` is published.
|
|
6
|
+
|
|
7
|
+
Do not add `NPM_TOKEN` or long-lived npm tokens to GitHub Secrets.
|
|
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
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm version patch
|
|
24
|
+
git push
|
|
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
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
That `E404` is **not** the rerun skip path. It means npm rejected the publish because the package name is not registered under your account yet, or OIDC Trusted Publishing is not authorized for `create-pi-extension` + `publish.yml`.
|
|
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
|
|
80
|
+
|
|
81
|
+
Do not ship a new Pi OSS package or version bump with only `package.json` changes.
|
|
82
|
+
The repository must include the release workflow pair:
|
|
83
|
+
|
|
84
|
+
- `.github/workflows/auto-release.yml` creates `v<version>` tags and GitHub Releases from `main` version bumps.
|
|
85
|
+
- `.github/workflows/publish.yml` syncs the template and publishes `create-pi-extension` through Trusted Publishing.
|
|
86
|
+
|
|
87
|
+
Important: tags or releases created by `GITHUB_TOKEN` do not reliably fan out into another workflow through normal `push.tags` or `release.published` triggers. The template keeps publishing reliable by having `auto-release.yml` explicitly dispatch `publish.yml` after creating the tag/release. If you change the release flow, keep one explicit handoff path: `workflow_dispatch` from auto-release, `repository_dispatch`, or `workflow_run` on the auto-release workflow.
|
|
88
|
+
|
|
89
|
+
## GitHub Actions requirements
|
|
90
|
+
|
|
91
|
+
- `permissions: id-token: write`
|
|
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
|
|
99
|
+
|
|
100
|
+
## First release checklist
|
|
101
|
+
|
|
102
|
+
- [ ] Root `package.json` version is final (synced into `create-pi-extension` on publish)
|
|
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
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# Template Setup Checklist
|
|
2
|
+
|
|
3
|
+
このテンプレートから新しい Pi 拡張OSSを作った後に埋めること。
|
|
4
|
+
|
|
5
|
+
## Start paths
|
|
6
|
+
|
|
7
|
+
### Primary path: `create-pi-extension` (recommended)
|
|
8
|
+
|
|
9
|
+
CLI が placeholder 置換・bootstrap doc 削除・`git init` / `bun install` を担当する。手動作業は最小限でよい。
|
|
10
|
+
|
|
11
|
+
- [ ] `bunx create-pi-extension@latest <package-name>` でプロジェクトを生成する
|
|
12
|
+
- [ ] CLI の next steps(`npm run ci` など)に従う
|
|
13
|
+
- [ ] 下記 **Recommended flow** の Vault / PRD / Issues フローに入る
|
|
14
|
+
- [ ] README / feature list / quick start をプロジェクト向けに更新する
|
|
15
|
+
- [ ] `npm run ci` と `npm pack --dry-run` を通す
|
|
16
|
+
|
|
17
|
+
Primary path では **Repository** / **README placeholders** / **GitHub Template repo** の多くは CLI が済ませる。残タスクはカスタマイズと release 準備。
|
|
18
|
+
|
|
19
|
+
### Secondary path: GitHub Template
|
|
20
|
+
|
|
21
|
+
`gh repo create --template eiei114/pi-extension-template --clone` で repo を作った場合は、以下の manual checklist を順に埋める。
|
|
22
|
+
|
|
23
|
+
- [ ] `gh repo create OWNER/my-pi-package --template eiei114/pi-extension-template --clone` で作成する
|
|
24
|
+
- [ ] clone先へ移動してpackage向けの標準READMEを配置する: macOS/Linuxは `cd my-pi-package && cp scaffold/package-readme.md README.md`、Windows PowerShellは `Set-Location my-pi-package; Copy-Item scaffold/package-readme.md README.md -Force`
|
|
25
|
+
- [ ] 下記 **Repository** 以降のセクションをすべて確認する
|
|
26
|
+
- [ ] post-generation cleanup(bootstrap docs 削除)を実施する
|
|
27
|
+
|
|
28
|
+
## Recommended flow
|
|
29
|
+
|
|
30
|
+
- [ ] Vault project notes を `4_Project/<ProjectName>/` に作る
|
|
31
|
+
- [ ] `CONTEXT.md` / `README.md` / `ROADMAP.md` / `Docs/` / `Issues/` / `Progress/` を揃える
|
|
32
|
+
- [ ] PRD を `4_Project/<ProjectName>/Docs/` に置く
|
|
33
|
+
- [ ] approved issue を `4_Project/<ProjectName>/Issues/` に切る
|
|
34
|
+
- [ ] OSS repo 側で実装する
|
|
35
|
+
- [ ] `npm run ci` / `npm test` / `npm pack --dry-run` を通す
|
|
36
|
+
- [ ] release 後に Vault へ learnings / release notes を戻す
|
|
37
|
+
|
|
38
|
+
## Repository
|
|
39
|
+
|
|
40
|
+
- [ ] GitHub repository name を決める
|
|
41
|
+
- [ ] GitHub About 欄を書く
|
|
42
|
+
- [ ] GitHub topics を設定する
|
|
43
|
+
- [ ] `pi`
|
|
44
|
+
- [ ] `pi-package`
|
|
45
|
+
- [ ] `agent-skill`
|
|
46
|
+
- [ ] `typescript`
|
|
47
|
+
- [ ] GitHub Settingsで `Template repository` をONにする
|
|
48
|
+
- [ ] Repository URL を `package.json` に反映する
|
|
49
|
+
- [ ] 生成先 repo では `package.json` / README 内の `OWNER/REPO` を実リポジトリに置き換える
|
|
50
|
+
|
|
51
|
+
## Package metadata
|
|
52
|
+
|
|
53
|
+
- [ ] `package.json` の `name` を変更する
|
|
54
|
+
- [ ] `description` を書く
|
|
55
|
+
- [ ] `author` を入れる
|
|
56
|
+
- [ ] `repository.url` を `https://github.com/OWNER/REPO` 形式の実リポジトリ URL に置き換える
|
|
57
|
+
- [ ] `bugs.url` を `https://github.com/OWNER/REPO/issues` 形式に置き換える
|
|
58
|
+
- [ ] `homepage` を `https://github.com/OWNER/REPO#readme` 形式に置き換える
|
|
59
|
+
- [ ] `keywords` を見直す
|
|
60
|
+
- [ ] `LICENSE` の年・名前を更新する
|
|
61
|
+
|
|
62
|
+
## README placeholders
|
|
63
|
+
|
|
64
|
+
- [ ] `PACKAGE_DISPLAY_NAME` を置き換える
|
|
65
|
+
- [ ] `PACKAGE_NAME` を置き換える
|
|
66
|
+
- [ ] `OWNER/REPO` を置き換える
|
|
67
|
+
- [ ] one-line pitch を書く
|
|
68
|
+
- [ ] feature list を書く
|
|
69
|
+
- [ ] quick start command を実コマンドにする
|
|
70
|
+
- [ ] npm URL を確認する
|
|
71
|
+
- [ ] GitHub URL を確認する
|
|
72
|
+
|
|
73
|
+
## Pi package manifest
|
|
74
|
+
|
|
75
|
+
- [ ] `pi.extensions` に公開する拡張だけを残す
|
|
76
|
+
- [ ] `pi.skills` に公開する skill だけを残す
|
|
77
|
+
- [ ] 不要なら `prompts/` を消す
|
|
78
|
+
- [ ] 不要なら `themes/` を消す
|
|
79
|
+
- [ ] サンプル名を実名に変える
|
|
80
|
+
|
|
81
|
+
## Documentation
|
|
82
|
+
|
|
83
|
+
`docs/` は固定6ファイル必須ではない。README を正とし、価値がある doc だけ残す。
|
|
84
|
+
|
|
85
|
+
### Required root files (public)
|
|
86
|
+
|
|
87
|
+
- [ ] `README.md` — GitHub/npm の入口。Install / Quick start / Release / Security を含める
|
|
88
|
+
- [ ] `LICENSE`
|
|
89
|
+
- [ ] `SECURITY.md`
|
|
90
|
+
- [ ] `CHANGELOG.md`
|
|
91
|
+
- [ ] Release 手順が README と workflow で明確(Trusted Publishing 設定含む)
|
|
92
|
+
|
|
93
|
+
### Recommended public docs (keep when useful)
|
|
94
|
+
|
|
95
|
+
- [ ] `docs/examples.md` — 例が README に載り切らないとき
|
|
96
|
+
- [ ] `docs/release.md` — Trusted Publishing や release 手順の詳細が README だけでは足りないとき
|
|
97
|
+
- [ ] `docs/usage.md` — 使い方が README に載り切らないとき(必要なら新規作成)
|
|
98
|
+
|
|
99
|
+
### Optional maintainer docs
|
|
100
|
+
|
|
101
|
+
- [ ] `docs/template-checklist.md` — このファイル。成熟 repo では README からの主ナビにしない。不要なら削除可
|
|
102
|
+
|
|
103
|
+
### Post-generation cleanup (delete or merge template setup docs)
|
|
104
|
+
|
|
105
|
+
テンプレート生成直後の bootstrap 用。プロジェクト固有の価値がなければ削除し、必要な内容は README / `docs/release.md` / `docs/examples.md` に統合する。
|
|
106
|
+
|
|
107
|
+
- [ ] `docs/github-template.md` を削除するか、固有の手順だけ README / Vault に移す
|
|
108
|
+
- [ ] `docs/repository-settings.md` を削除するか、About/topics など必要分だけ README に移す
|
|
109
|
+
- [ ] `docs/typescript.md` を削除するか、TypeScript 方針は README Development に要約する
|
|
110
|
+
- [ ] README の Docs 節から、削除したファイルへのリンクを外す
|
|
111
|
+
- [ ] `package.json` の `files` から、削除した `docs/` パスを外す(残す doc だけ明示する)
|
|
112
|
+
|
|
113
|
+
## TypeScript
|
|
114
|
+
|
|
115
|
+
- [ ] `extensions/index.ts` を実装に合わせて更新する
|
|
116
|
+
- [ ] `extensions/hello.ts` が不要なら削除する
|
|
117
|
+
- [ ] 共通ロジックを `lib/` に切り出す
|
|
118
|
+
- [ ] `strict: true` を維持する
|
|
119
|
+
- [ ] custom tool parameters は TypeBox schema で定義する
|
|
120
|
+
- [ ] string choices は `StringEnum` helper を使う
|
|
121
|
+
- [ ] runtime dependency は `dependencies`、Pi提供packageは `peerDependencies` に置く
|
|
122
|
+
- [ ] `package.json.files` に公開対象だけを入れる
|
|
123
|
+
- [ ] 詳細はセットアップ中だけ `docs/typescript.md` を参照し、不要なら post-generation cleanup で削除
|
|
124
|
+
|
|
125
|
+
## GitHub Template repo
|
|
126
|
+
|
|
127
|
+
- [ ] `gh repo create --template OWNER/pi-extension-template` で作成できることを確認する
|
|
128
|
+
- [ ] public/privateどちらの作成例もdocsに載せる(`docs/github-template.md` を残す場合)
|
|
129
|
+
|
|
130
|
+
## CI / Release
|
|
131
|
+
|
|
132
|
+
- [ ] `npm run ci` が通る
|
|
133
|
+
- [ ] `packages/create-pi-extension` で `npm pack --dry-run` が通り、`template/` が含まれる
|
|
134
|
+
- [ ] npm Trusted Publishing を **`create-pi-extension`** に設定する(ルート `pi-extension-template` は公開しない)
|
|
135
|
+
- [ ] npm Trusted Publisher の workflow filename が `publish.yml` になっている
|
|
136
|
+
- [ ] `NPM_TOKEN` を使っていないことを確認する
|
|
137
|
+
- [ ] `auto-release.yml` が `main` の version bump から tag/release を作ることを確認する
|
|
138
|
+
- [ ] `publish.yml` が `workflow_dispatch` と `release.published` に対応していることを確認する
|
|
139
|
+
- [ ] 初回リリースで npm provenance が付いているか確認する
|
|
140
|
+
|
|
141
|
+
### Workflow handoff guard
|
|
142
|
+
|
|
143
|
+
- [ ] `.github/workflows/auto-release.yml` exists before first release
|
|
144
|
+
- [ ] `.github/workflows/publish.yml` exists before first release
|
|
145
|
+
- [ ] `auto-release.yml` has `permissions: actions: write` and `contents: write`
|
|
146
|
+
- [ ] `publish.yml` has `permissions: id-token: write` for npm Trusted Publishing
|
|
147
|
+
- [ ] `publish.yml` skips already-published versions via the public npm registry API and logs `publish intentionally skipped` on reruns
|
|
148
|
+
- [ ] Auto release explicitly hands off to publish: `gh workflow run publish.yml --ref "$TAG" -f ref="$TAG"`, or `publish.yml` has an equivalent `workflow_run` / `repository_dispatch` trigger
|
|
149
|
+
- [ ] Do not rely only on `push.tags` or `release.published` when the tag/release is created by `GITHUB_TOKEN`; that can leave npm unchanged after merge
|
|
150
|
+
|
|
151
|
+
## npm page
|
|
152
|
+
|
|
153
|
+
- [ ] npm package URL を README に追加する
|
|
154
|
+
- [ ] npm description が適切に表示されるか確認する
|
|
155
|
+
- [ ] provenance が付いているか確認する
|
|
156
|
+
- [ ] 不要なファイルが package に含まれていないか確認する(`npm pack --dry-run` で `docs/` の残し方も確認)
|
|
157
|
+
|
|
158
|
+
## Before first release
|
|
159
|
+
|
|
160
|
+
- [ ] サンプルコードを実機 Pi でロードする
|
|
161
|
+
- [ ] `pi install git:github.com/OWNER/REPO` を試す
|
|
162
|
+
- [ ] `pi -e .` を試す
|
|
163
|
+
- [ ] README のコマンドがコピペで動くか確認する
|
|
164
|
+
- [ ] CHANGELOG に `0.1.0` を書く
|