pi-spotify-widget 0.1.0 → 0.1.7
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 +65 -19
- package/README.md +35 -11
- package/docs/release.md +26 -5
- package/package.json +62 -62
- package/docs/github-template.md +0 -43
- package/docs/repository-settings.md +0 -41
- package/docs/typescript.md +0 -75
package/CHANGELOG.md
CHANGED
|
@@ -1,19 +1,65 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
|
|
17
|
-
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## [0.1.7] - 2026-07-04
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Move the npm publish workflow to Node 24, print runtime versions for diagnosis, and publish with `--provenance --access public` so npm Trusted Publishing has a fully compatible environment.
|
|
10
|
+
|
|
11
|
+
## [0.1.6] - 2026-07-04
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- Trigger a fresh release after npm Trusted Publishing was reconfigured so the hardened publish workflow can publish the package successfully.
|
|
16
|
+
|
|
17
|
+
## [0.1.5] - 2026-07-04
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Harden npm publish workflow: support release-trigger fallback, skip already-published versions, publish with explicit public access, and print a direct Trusted Publishing hint on npm 404 failures.
|
|
22
|
+
- Clarify release docs and contributor release steps around `npm version patch --no-git-tag-version` and Trusted Publishing troubleshooting.
|
|
23
|
+
|
|
24
|
+
## [0.1.4] - 2026-07-04
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- Add Buy Me a Coffee sponsor button to README and native GitHub funding link via `.github/FUNDING.yml`.
|
|
29
|
+
|
|
30
|
+
All notable changes to this project will be documented in this file.
|
|
31
|
+
|
|
32
|
+
This project follows semantic versioning.
|
|
33
|
+
|
|
34
|
+
## [0.1.3] - 2026-06-27
|
|
35
|
+
|
|
36
|
+
### Changed
|
|
37
|
+
|
|
38
|
+
- README aligned with the current Pi OSS template baseline: expanded install paths (project-local, version pin, `pi -e npm:`), accurate package contents (`skills/`), and explicit `npm run ci` / `npm pack --dry-run` guidance in Development and Release.
|
|
39
|
+
|
|
40
|
+
## [0.1.2] - 2026-06-06
|
|
41
|
+
|
|
42
|
+
### Fixed
|
|
43
|
+
|
|
44
|
+
- Auto-release workflow was added in 0.1.1 but version never changed in that commit, preventing npm publish. This release bumps the version so auto-release triggers and publishes to npm.
|
|
45
|
+
|
|
46
|
+
## [0.1.1] - 2026-06-05
|
|
47
|
+
|
|
48
|
+
### Changed
|
|
49
|
+
|
|
50
|
+
- Removed template-maintenance docs (`github-template.md`, `repository-settings.md`, `typescript.md`) from the published package.
|
|
51
|
+
- Updated README doc links to match remaining docs.
|
|
52
|
+
|
|
53
|
+
## [0.1.0] - 2026-06-03
|
|
54
|
+
|
|
55
|
+
### Added
|
|
56
|
+
|
|
57
|
+
- Now Playing widget in Pi prompt editor (track, artist, playing/paused, progress seek bar).
|
|
58
|
+
- OAuth 2.0 + PKCE login via `/spotify:login` with localhost callback on port 8888.
|
|
59
|
+
- Interactive Client ID setup (Dashboard opens in browser; optional `PI_SPOTIFY_CLIENT_ID` env override).
|
|
60
|
+
- Secret-safe `/spotify:status`, `/spotify:logout`, and `/spotify:refresh`.
|
|
61
|
+
- Playback controls (`/spotify:prev`, `/spotify:next`, `/spotify:pause`, `/spotify:play`) and `/spotify:play-uri`.
|
|
62
|
+
- `/spotify:share` for X compose (intent URL; optional API credentials via env).
|
|
63
|
+
- `spotify-playback` Agent Skill for playback and share workflows.
|
|
64
|
+
- Token refresh lifecycle and adaptive polling with stale snapshot fallback.
|
|
65
|
+
- CI workflow and npm Trusted Publishing setup.
|
package/README.md
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
[](LICENSE)
|
|
8
8
|
[](https://pi.dev/packages)
|
|
9
9
|
[](docs/release.md)
|
|
10
|
+
<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>
|
|
10
11
|
|
|
11
12
|
> Show Spotify playback status in Pi's prompt editor widget.
|
|
12
13
|
|
|
@@ -26,16 +27,36 @@ TypeScript-first Pi package that displays **Now Playing** (track, artist, playin
|
|
|
26
27
|
|
|
27
28
|
## Install
|
|
28
29
|
|
|
30
|
+
Install the published npm package with Pi:
|
|
31
|
+
|
|
29
32
|
```bash
|
|
30
33
|
pi install npm:pi-spotify-widget
|
|
31
34
|
```
|
|
32
35
|
|
|
36
|
+
Pin a specific version when you want reproducible installs:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pi install npm:pi-spotify-widget@0.1.3
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Install into the current project instead of your user Pi settings:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pi install npm:pi-spotify-widget -l
|
|
46
|
+
```
|
|
47
|
+
|
|
33
48
|
Or install from GitHub:
|
|
34
49
|
|
|
35
50
|
```bash
|
|
36
51
|
pi install git:github.com/eiei114/pi-spotify-widget
|
|
37
52
|
```
|
|
38
53
|
|
|
54
|
+
Try it without permanently installing:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pi -e npm:pi-spotify-widget
|
|
58
|
+
```
|
|
59
|
+
|
|
39
60
|
## Spotify Developer setup (required)
|
|
40
61
|
|
|
41
62
|
Each user creates their own Spotify app (v1 **BYO Client ID** policy). Client Secret is not needed for PKCE.
|
|
@@ -106,38 +127,41 @@ Then run:
|
|
|
106
127
|
|
|
107
128
|
| Path | Purpose |
|
|
108
129
|
|---|---|
|
|
109
|
-
| `extensions/` | Pi TypeScript extension entrypoints |
|
|
130
|
+
| `extensions/` | Pi TypeScript extension entrypoints (`index.ts`) |
|
|
110
131
|
| `lib/` | Spotify auth, API client, widget render |
|
|
111
|
-
| `
|
|
132
|
+
| `skills/` | `spotify-playback` Agent Skill |
|
|
133
|
+
| `docs/` | Release, examples, and maintainer checklist |
|
|
112
134
|
|
|
113
135
|
## Development
|
|
114
136
|
|
|
115
137
|
```bash
|
|
116
138
|
npm install
|
|
117
139
|
npm run ci
|
|
140
|
+
npm run pack:check # equivalent to: npm pack --dry-run
|
|
118
141
|
```
|
|
119
142
|
|
|
143
|
+
`npm run ci` runs typecheck, tests, and the pack check. Run `npm pack --dry-run` directly when you only want to verify tarball contents.
|
|
144
|
+
|
|
120
145
|
## Release
|
|
121
146
|
|
|
147
|
+
Before tagging, confirm `npm run ci` and `npm pack --dry-run` pass locally.
|
|
148
|
+
|
|
122
149
|
This package is set up for npm Trusted Publishing, so no `NPM_TOKEN` is required.
|
|
123
150
|
|
|
124
151
|
```bash
|
|
125
152
|
npm version patch
|
|
126
|
-
git push
|
|
153
|
+
git push
|
|
127
154
|
```
|
|
128
155
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
## Template checklist
|
|
156
|
+
On `main`, `.github/workflows/auto-release.yml` checks `package.json` 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.
|
|
132
157
|
|
|
133
|
-
|
|
158
|
+
See [`docs/release.md`](docs/release.md) for setup details.
|
|
134
159
|
|
|
135
|
-
|
|
160
|
+
## Docs
|
|
136
161
|
|
|
137
|
-
- [`docs/typescript.md`](docs/typescript.md)
|
|
138
162
|
- [`docs/examples.md`](docs/examples.md)
|
|
139
|
-
- [`docs/
|
|
140
|
-
- [`docs/
|
|
163
|
+
- [`docs/release.md`](docs/release.md)
|
|
164
|
+
- [`docs/template-checklist.md`](docs/template-checklist.md) — maintainer setup checklist
|
|
141
165
|
|
|
142
166
|
## Security
|
|
143
167
|
|
package/docs/release.md
CHANGED
|
@@ -15,18 +15,39 @@ On npmjs.com, configure Trusted Publishing for this package:
|
|
|
15
15
|
## Publish
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
npm version patch
|
|
19
|
-
git push
|
|
18
|
+
npm version patch --no-git-tag-version
|
|
19
|
+
git push
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
On `main`, `.github/workflows/auto-release.yml` checks `package.json` 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.
|
|
23
|
+
|
|
24
|
+
`publish.yml` also listens for `release.published` and manual `v*.*.*` tag pushes, but the explicit dispatch from `auto-release.yml` remains the primary path because `GITHUB_TOKEN` tag pushes do not reliably fan out into a second workflow on their own.
|
|
25
|
+
|
|
26
|
+
## Workflow guardrail
|
|
27
|
+
|
|
28
|
+
Tags or releases created by `GITHUB_TOKEN` do not reliably fan out into another workflow through normal `push.tags` or `release.published` triggers. This repository keeps publishing reliable by having `auto-release.yml` explicitly dispatch `publish.yml` after creating the tag/release.
|
|
23
29
|
|
|
24
30
|
## GitHub Actions requirements
|
|
25
31
|
|
|
26
32
|
- `permissions: id-token: write`
|
|
33
|
+
- `permissions: actions: write` on auto-release so it can dispatch `publish.yml`
|
|
34
|
+
- `auto-release.yml` calls `gh workflow run publish.yml --ref "$TAG" -f ref="$TAG"`
|
|
35
|
+
- publish runner uses Node `24` so npm Trusted Publishing has a compatible Node/npm pair
|
|
27
36
|
- GitHub-hosted runner
|
|
28
37
|
- No `NPM_TOKEN`
|
|
29
|
-
- `npm publish` from the configured workflow file
|
|
38
|
+
- `npm publish --provenance --access public` from the configured workflow file
|
|
39
|
+
|
|
40
|
+
## Troubleshooting
|
|
41
|
+
|
|
42
|
+
If `publish.yml` fails at `npm publish` with `E404` / `404 Not Found`, the most likely cause is npm Trusted Publishing configuration, not the GitHub workflow logic.
|
|
43
|
+
|
|
44
|
+
Check npm package settings for:
|
|
45
|
+
|
|
46
|
+
- package: `pi-spotify-widget`
|
|
47
|
+
- repository: `eiei114/pi-spotify-widget`
|
|
48
|
+
- workflow filename: `publish.yml`
|
|
49
|
+
|
|
50
|
+
The workflow now prints that hint directly when npm returns 404.
|
|
30
51
|
|
|
31
52
|
## First release checklist
|
|
32
53
|
|
|
@@ -35,4 +56,4 @@ The `v*` tag triggers `.github/workflows/publish.yml`, which runs CI and publish
|
|
|
35
56
|
- [ ] npm Trusted Publisher is configured
|
|
36
57
|
- [ ] `npm run ci` passes
|
|
37
58
|
- [ ] `npm pack --dry-run` contains only intended files
|
|
38
|
-
- [ ] `CHANGELOG.md` has the release date
|
|
59
|
+
- [ ] `CHANGELOG.md` has the release date
|
package/package.json
CHANGED
|
@@ -1,62 +1,62 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "pi-spotify-widget",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Lightweight Spotify Now Playing widget for Pi Coding Agent.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"author": "eiei114",
|
|
8
|
-
"keywords": [
|
|
9
|
-
"pi-package",
|
|
10
|
-
"pi",
|
|
11
|
-
"agent-skill",
|
|
12
|
-
"typescript"
|
|
13
|
-
],
|
|
14
|
-
"repository": {
|
|
15
|
-
"type": "git",
|
|
16
|
-
"url": "git+https://github.com/eiei114/pi-spotify-widget.git"
|
|
17
|
-
},
|
|
18
|
-
"bugs": {
|
|
19
|
-
"url": "https://github.com/eiei114/pi-spotify-widget/issues"
|
|
20
|
-
},
|
|
21
|
-
"homepage": "https://github.com/eiei114/pi-spotify-widget#readme",
|
|
22
|
-
"files": [
|
|
23
|
-
"extensions/",
|
|
24
|
-
"lib/",
|
|
25
|
-
"docs/",
|
|
26
|
-
"README.md",
|
|
27
|
-
"LICENSE",
|
|
28
|
-
"CHANGELOG.md",
|
|
29
|
-
"skills/"
|
|
30
|
-
],
|
|
31
|
-
"scripts": {
|
|
32
|
-
"typecheck": "tsc --noEmit",
|
|
33
|
-
"test": "node --test tests/*.test.mjs",
|
|
34
|
-
"ci": "npm run typecheck && npm test && npm run pack:check",
|
|
35
|
-
"pack:check": "npm pack --dry-run"
|
|
36
|
-
},
|
|
37
|
-
"pi": {
|
|
38
|
-
"extensions": [
|
|
39
|
-
"./extensions"
|
|
40
|
-
],
|
|
41
|
-
"skills": [
|
|
42
|
-
"./skills/spotify-playback"
|
|
43
|
-
]
|
|
44
|
-
},
|
|
45
|
-
"publishConfig": {
|
|
46
|
-
"access": "public"
|
|
47
|
-
},
|
|
48
|
-
"peerDependencies": {
|
|
49
|
-
"@earendil-works/pi-ai": "*",
|
|
50
|
-
"@earendil-works/pi-coding-agent": "*",
|
|
51
|
-
"@earendil-works/pi-tui": "*",
|
|
52
|
-
"typebox": "*"
|
|
53
|
-
},
|
|
54
|
-
"devDependencies": {
|
|
55
|
-
"@earendil-works/pi-ai": "latest",
|
|
56
|
-
"@earendil-works/pi-coding-agent": "latest",
|
|
57
|
-
"@earendil-works/pi-tui": "latest",
|
|
58
|
-
"typebox": "latest",
|
|
59
|
-
"@types/node": "^
|
|
60
|
-
"typescript": "^6.0.3"
|
|
61
|
-
}
|
|
62
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "pi-spotify-widget",
|
|
3
|
+
"version": "0.1.7",
|
|
4
|
+
"description": "Lightweight Spotify Now Playing widget for Pi Coding Agent.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "eiei114",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"pi-package",
|
|
10
|
+
"pi",
|
|
11
|
+
"agent-skill",
|
|
12
|
+
"typescript"
|
|
13
|
+
],
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/eiei114/pi-spotify-widget.git"
|
|
17
|
+
},
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/eiei114/pi-spotify-widget/issues"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/eiei114/pi-spotify-widget#readme",
|
|
22
|
+
"files": [
|
|
23
|
+
"extensions/",
|
|
24
|
+
"lib/",
|
|
25
|
+
"docs/",
|
|
26
|
+
"README.md",
|
|
27
|
+
"LICENSE",
|
|
28
|
+
"CHANGELOG.md",
|
|
29
|
+
"skills/"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"typecheck": "tsc --noEmit",
|
|
33
|
+
"test": "node --test tests/*.test.mjs",
|
|
34
|
+
"ci": "npm run typecheck && npm test && npm run pack:check",
|
|
35
|
+
"pack:check": "npm pack --dry-run"
|
|
36
|
+
},
|
|
37
|
+
"pi": {
|
|
38
|
+
"extensions": [
|
|
39
|
+
"./extensions"
|
|
40
|
+
],
|
|
41
|
+
"skills": [
|
|
42
|
+
"./skills/spotify-playback"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@earendil-works/pi-ai": "*",
|
|
50
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
51
|
+
"@earendil-works/pi-tui": "*",
|
|
52
|
+
"typebox": "*"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@earendil-works/pi-ai": "latest",
|
|
56
|
+
"@earendil-works/pi-coding-agent": "latest",
|
|
57
|
+
"@earendil-works/pi-tui": "latest",
|
|
58
|
+
"typebox": "latest",
|
|
59
|
+
"@types/node": "^25.9.1",
|
|
60
|
+
"typescript": "^6.0.3"
|
|
61
|
+
}
|
|
62
|
+
}
|
package/docs/github-template.md
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# GitHub Template Repository
|
|
2
|
-
|
|
3
|
-
Enable template mode on the source repository:
|
|
4
|
-
|
|
5
|
-
```txt
|
|
6
|
-
GitHub repo → Settings → General → Template repository
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
Create a public repository from the template:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
gh repo create OWNER/new-pi-extension \
|
|
13
|
-
--public \
|
|
14
|
-
--template OWNER/pi-extension-template \
|
|
15
|
-
--clone
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Create a private repository from the template:
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
gh repo create OWNER/new-pi-extension \
|
|
22
|
-
--private \
|
|
23
|
-
--template OWNER/pi-extension-template \
|
|
24
|
-
--clone
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Include all branches if needed:
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
gh repo create OWNER/new-pi-extension \
|
|
31
|
-
--public \
|
|
32
|
-
--template OWNER/pi-extension-template \
|
|
33
|
-
--include-all-branches \
|
|
34
|
-
--clone
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
After creation:
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
cd new-pi-extension
|
|
41
|
-
npm install
|
|
42
|
-
npm run ci
|
|
43
|
-
```
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Repository Settings
|
|
2
|
-
|
|
3
|
-
Use this file after creating a real repository from the template.
|
|
4
|
-
|
|
5
|
-
## GitHub About
|
|
6
|
-
|
|
7
|
-
Suggested fields:
|
|
8
|
-
|
|
9
|
-
- Description: one-line pitch for the Pi package
|
|
10
|
-
- Website: npm package URL or project docs URL
|
|
11
|
-
- Topics:
|
|
12
|
-
- `pi`
|
|
13
|
-
- `pi-package`
|
|
14
|
-
- `agent-skill`
|
|
15
|
-
- `typescript`
|
|
16
|
-
|
|
17
|
-
## Template mode
|
|
18
|
-
|
|
19
|
-
If this repository itself should be reusable as a template:
|
|
20
|
-
|
|
21
|
-
```txt
|
|
22
|
-
Settings → General → Template repository
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Branch protection
|
|
26
|
-
|
|
27
|
-
Recommended for public packages:
|
|
28
|
-
|
|
29
|
-
- Require pull request before merging
|
|
30
|
-
- Require status checks to pass
|
|
31
|
-
- Require `CI` workflow
|
|
32
|
-
- Block force pushes on the default branch
|
|
33
|
-
|
|
34
|
-
## npm package page
|
|
35
|
-
|
|
36
|
-
After first publish:
|
|
37
|
-
|
|
38
|
-
- Confirm README renders correctly
|
|
39
|
-
- Confirm package provenance appears
|
|
40
|
-
- Confirm package contents are intentional
|
|
41
|
-
- Add npm URL to GitHub About and README
|
package/docs/typescript.md
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
# TypeScript Guide
|
|
2
|
-
|
|
3
|
-
This is a TypeScript-first Pi package template.
|
|
4
|
-
|
|
5
|
-
## Layout
|
|
6
|
-
|
|
7
|
-
```txt
|
|
8
|
-
extensions/*.ts Pi extension entrypoints
|
|
9
|
-
lib/*.ts Shared TypeScript helpers
|
|
10
|
-
skills/*/SKILL.md Agent Skills
|
|
11
|
-
prompts/*.md Prompt templates
|
|
12
|
-
themes/*.json Themes
|
|
13
|
-
tests/*.test.mjs Smoke tests
|
|
14
|
-
tests/*.test.ts Optional TypeScript tests if you add a TS test runner
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Pi loads TypeScript extensions directly, so no build step is required for normal use.
|
|
18
|
-
|
|
19
|
-
## Strict mode
|
|
20
|
-
|
|
21
|
-
`tsconfig.json` keeps `strict: true`. Prefer fixing types over loosening compiler options.
|
|
22
|
-
|
|
23
|
-
## Extension entrypoints
|
|
24
|
-
|
|
25
|
-
Two entrypoint styles are shown:
|
|
26
|
-
|
|
27
|
-
- `extensions/hello.ts`: single-file extension
|
|
28
|
-
- `extensions/index.ts`: index-style extension that imports shared code from `lib/`
|
|
29
|
-
|
|
30
|
-
For larger packages, keep entrypoints thin and put reusable logic in `lib/`.
|
|
31
|
-
|
|
32
|
-
## TypeBox schemas
|
|
33
|
-
|
|
34
|
-
Use TypeBox schemas for custom tool parameters.
|
|
35
|
-
|
|
36
|
-
```ts
|
|
37
|
-
import { Type } from "typebox";
|
|
38
|
-
|
|
39
|
-
const parameters = Type.Object({
|
|
40
|
-
name: Type.String({ description: "Name to greet" }),
|
|
41
|
-
});
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## String enums
|
|
45
|
-
|
|
46
|
-
For string choices, use the local `StringEnum` helper from `lib/schema.ts`.
|
|
47
|
-
|
|
48
|
-
```ts
|
|
49
|
-
import { StringEnum } from "../lib/schema.ts";
|
|
50
|
-
|
|
51
|
-
const mode = StringEnum(["short", "friendly"], {
|
|
52
|
-
description: "Greeting style",
|
|
53
|
-
});
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
This emits a JSON Schema `enum`, which is friendlier to model providers than a union of string literals.
|
|
57
|
-
|
|
58
|
-
## Runtime dependencies vs peer dependencies
|
|
59
|
-
|
|
60
|
-
Pi bundles core packages for extension authors. Keep Pi-provided packages as `peerDependencies` and also install them as `devDependencies` for local typechecking.
|
|
61
|
-
|
|
62
|
-
Use `peerDependencies` for:
|
|
63
|
-
|
|
64
|
-
- `@earendil-works/pi-coding-agent`
|
|
65
|
-
- `@earendil-works/pi-ai`
|
|
66
|
-
- `@earendil-works/pi-tui`
|
|
67
|
-
- `typebox`
|
|
68
|
-
|
|
69
|
-
Use `dependencies` for runtime packages your extension imports that Pi does not provide.
|
|
70
|
-
|
|
71
|
-
Use `devDependencies` for local-only tools such as TypeScript, test runners, and linters.
|
|
72
|
-
|
|
73
|
-
## Package contents
|
|
74
|
-
|
|
75
|
-
Control npm package contents with `package.json` `files`. Prefer this over `.npmignore` so the published package stays explicit.
|