@pasko70/pibo 1.2.0 → 1.3.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/dist/apps/chat/static-assets.js +1 -1
- package/dist/apps/chat-vscode-web/assets/index-B5QK07zO.css +2 -0
- package/dist/apps/chat-vscode-web/assets/index-C3GTPyDo.js +41 -0
- package/dist/apps/chat-vscode-web/index.html +14 -0
- package/dist/apps/vscode-artifacts/latest.vsix +0 -0
- package/dist/apps/vscode-artifacts/pibo-vscode-1.3.0.vsix +0 -0
- package/dist/cli.js +17 -0
- package/dist/vscode/cli.js +90 -0
- package/dist/vscode/code-cli.js +119 -0
- package/dist/vscode/install.js +177 -0
- package/dist/vscode/status.js +80 -0
- package/dist/vscode/types.js +14 -0
- package/dist/vscode/uninstall.js +49 -0
- package/dist/vscode/vsix-fetcher.js +131 -0
- package/docs/ops/vscode-extension-release.md +138 -0
- package/package.json +5 -4
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GitHub Releases interaction for the Pibo VS Code extension.
|
|
3
|
+
*
|
|
4
|
+
* `pibo vscode install` defaults to fetching the latest VSIX asset from a
|
|
5
|
+
* GitHub Release. The fetch path is pure-functional so the install command
|
|
6
|
+
* can inject a mocked fetch and a mocked spawn in tests.
|
|
7
|
+
*/
|
|
8
|
+
export class VsixFetchError extends Error {
|
|
9
|
+
cause;
|
|
10
|
+
constructor(message, options) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = "VsixFetchError";
|
|
13
|
+
if (options?.cause !== undefined)
|
|
14
|
+
this.cause = options.cause;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
const VSIX_ASSET_PATTERN = /\.vsix$/i;
|
|
18
|
+
export function isVsixAsset(asset) {
|
|
19
|
+
return VSIX_ASSET_PATTERN.test(asset.name);
|
|
20
|
+
}
|
|
21
|
+
export function findVsixAsset(release) {
|
|
22
|
+
return release.assets.find(isVsixAsset);
|
|
23
|
+
}
|
|
24
|
+
const GITHUB_API_ROOT = "https://api.github.com";
|
|
25
|
+
function buildReleaseUrl(owner, repo, tagName) {
|
|
26
|
+
const base = `${GITHUB_API_ROOT}/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}/releases`;
|
|
27
|
+
if (tagName)
|
|
28
|
+
return `${base}/tags/${encodeURIComponent(tagName)}`;
|
|
29
|
+
return `${base}/latest`;
|
|
30
|
+
}
|
|
31
|
+
function parseRelease(payload) {
|
|
32
|
+
if (typeof payload !== "object" || payload === null) {
|
|
33
|
+
throw new VsixFetchError("GitHub Releases payload is not an object");
|
|
34
|
+
}
|
|
35
|
+
const record = payload;
|
|
36
|
+
const tagName = record.tag_name;
|
|
37
|
+
const name = record.name;
|
|
38
|
+
const publishedAt = record.published_at;
|
|
39
|
+
const htmlUrl = record.html_url;
|
|
40
|
+
const rawAssets = record.assets;
|
|
41
|
+
if (typeof tagName !== "string" || typeof name !== "string" || typeof publishedAt !== "string" || typeof htmlUrl !== "string") {
|
|
42
|
+
throw new VsixFetchError("GitHub Releases payload is missing required string fields");
|
|
43
|
+
}
|
|
44
|
+
if (!Array.isArray(rawAssets)) {
|
|
45
|
+
throw new VsixFetchError("GitHub Releases payload is missing assets array");
|
|
46
|
+
}
|
|
47
|
+
const assets = [];
|
|
48
|
+
for (const raw of rawAssets) {
|
|
49
|
+
if (typeof raw !== "object" || raw === null)
|
|
50
|
+
continue;
|
|
51
|
+
const r = raw;
|
|
52
|
+
if (typeof r.name === "string" &&
|
|
53
|
+
typeof r.browser_download_url === "string" &&
|
|
54
|
+
typeof r.size === "number" &&
|
|
55
|
+
typeof r.content_type === "string") {
|
|
56
|
+
assets.push({
|
|
57
|
+
name: r.name,
|
|
58
|
+
browserDownloadUrl: r.browser_download_url,
|
|
59
|
+
size: r.size,
|
|
60
|
+
contentType: r.content_type,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return { tagName, name, publishedAt, htmlUrl, assets };
|
|
65
|
+
}
|
|
66
|
+
export async function fetchRelease(options) {
|
|
67
|
+
const fetchImpl = options.fetchImpl ?? fetch;
|
|
68
|
+
const url = buildReleaseUrl(options.owner, options.repo, options.tagName);
|
|
69
|
+
let response;
|
|
70
|
+
try {
|
|
71
|
+
response = await fetchImpl(url, {
|
|
72
|
+
headers: { accept: "application/vnd.github+json", "user-agent": "pibo-cli" },
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
throw new VsixFetchError(`Failed to call GitHub Releases API at ${url}`, { cause: error });
|
|
77
|
+
}
|
|
78
|
+
if (response.status === 404) {
|
|
79
|
+
throw new VsixFetchError(options.tagName
|
|
80
|
+
? `GitHub release ${options.owner}/${options.repo}@${options.tagName} not found`
|
|
81
|
+
: `GitHub repository ${options.owner}/${options.repo} has no published releases`);
|
|
82
|
+
}
|
|
83
|
+
if (!response.ok) {
|
|
84
|
+
throw new VsixFetchError(`GitHub Releases API returned HTTP ${response.status}`);
|
|
85
|
+
}
|
|
86
|
+
let payload;
|
|
87
|
+
try {
|
|
88
|
+
payload = await response.json();
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
throw new VsixFetchError("GitHub Releases response was not valid JSON", { cause: error });
|
|
92
|
+
}
|
|
93
|
+
return parseRelease(payload);
|
|
94
|
+
}
|
|
95
|
+
export async function downloadVsixAsset(options) {
|
|
96
|
+
const fetchImpl = options.fetchImpl ?? fetch;
|
|
97
|
+
const maxBytes = options.maxBytes ?? 64 * 1024 * 1024; // 64 MiB
|
|
98
|
+
let response;
|
|
99
|
+
try {
|
|
100
|
+
response = await fetchImpl(options.url, { headers: { "user-agent": "pibo-cli" } });
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
throw new VsixFetchError(`Failed to download VSIX from ${options.url}`, { cause: error });
|
|
104
|
+
}
|
|
105
|
+
if (!response.ok) {
|
|
106
|
+
throw new VsixFetchError(`VSIX download returned HTTP ${response.status}`);
|
|
107
|
+
}
|
|
108
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
109
|
+
if (arrayBuffer.byteLength > maxBytes) {
|
|
110
|
+
throw new VsixFetchError(`VSIX download is ${arrayBuffer.byteLength} bytes, exceeding limit of ${maxBytes} bytes`);
|
|
111
|
+
}
|
|
112
|
+
return Buffer.from(arrayBuffer);
|
|
113
|
+
}
|
|
114
|
+
export async function fetchLatestVsix(options) {
|
|
115
|
+
const release = await fetchRelease({
|
|
116
|
+
owner: options.owner,
|
|
117
|
+
repo: options.repo,
|
|
118
|
+
tagName: options.tagName,
|
|
119
|
+
fetchImpl: options.fetchImpl,
|
|
120
|
+
});
|
|
121
|
+
const asset = findVsixAsset(release);
|
|
122
|
+
if (!asset) {
|
|
123
|
+
throw new VsixFetchError(`Release ${release.tagName} has no .vsix asset`);
|
|
124
|
+
}
|
|
125
|
+
const bytes = await downloadVsixAsset({
|
|
126
|
+
url: asset.browserDownloadUrl,
|
|
127
|
+
maxBytes: options.maxBytes,
|
|
128
|
+
fetchImpl: options.fetchImpl,
|
|
129
|
+
});
|
|
130
|
+
return { tagName: release.tagName, asset, bytes };
|
|
131
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Pibo VS Code Extension Release Runbook
|
|
2
|
+
|
|
3
|
+
The Pibo VS Code extension is shipped as a `.vsix` artifact. This runbook describes the end-to-end release process and the split of responsibilities between the maintainer and the `pibo` release script.
|
|
4
|
+
|
|
5
|
+
## Distribution channels
|
|
6
|
+
|
|
7
|
+
The extension is published through two channels that are intentionally separate:
|
|
8
|
+
|
|
9
|
+
| Channel | Owner | Cadence | What it carries |
|
|
10
|
+
|---|---|---|---|
|
|
11
|
+
| npm `@pasko70/pibo` | automated via `npm publish` (or the release script's `--publish-npm` flag) | every `main` commit that includes a version bump | the `pibo` CLI, the gateway, the WebView bundle at `dist/apps/chat-vscode-web/` |
|
|
12
|
+
| VS Code Marketplace `pibo.pibo-vscode` | **maintainer uploads the VSIX manually** via <https://marketplace.visualstudio.com/manage> | every release that needs the extension UI updated | the `.vsix` produced by `npm run vscode:package` |
|
|
13
|
+
|
|
14
|
+
The npm package and the Marketplace extension are versioned together. The release script bumps both `package.json` (npm) and `src/apps/chat-vscode/package.json` (extension) in one go so the published artifacts stay in lockstep.
|
|
15
|
+
|
|
16
|
+
`pibo vscode install` (new since the distribution rework) downloads the VSIX from the GitHub Release for the configured repo (`Pascapone/pibo` by default). When the maintainer also uploads the same VSIX to the Marketplace, both channels serve identical bytes.
|
|
17
|
+
|
|
18
|
+
## Versioning
|
|
19
|
+
|
|
20
|
+
- The root `package.json#version` is the npm version. It follows [SemVer](https://semver.org/).
|
|
21
|
+
- The extension's `src/apps/chat-vscode/package.json#version` is the Marketplace version. It is kept equal to the npm version (the release script enforces this).
|
|
22
|
+
- A SemVer **minor** bump (e.g., `1.2.0` → `1.3.0`) is appropriate when the change is additive and backward-compatible. The distribution rework itself is a minor bump: existing `pibo` users are unaffected, and the new `pibo vscode install` command is opt-in.
|
|
23
|
+
- A SemVer **major** bump is reserved for breaking changes to either the public CLI surface or the WebView host↔Web postMessage contract.
|
|
24
|
+
|
|
25
|
+
## Release steps
|
|
26
|
+
|
|
27
|
+
The release script does the heavy lifting. The maintainer's job is to review, commit, and push.
|
|
28
|
+
|
|
29
|
+
### 1. Pick the version
|
|
30
|
+
|
|
31
|
+
Decide on the next version. For the distribution rework that introduces `pibo vscode install`, the right bump is `1.2.0` → `1.3.0` (new CLI command, new marketplace-ready extension, no breaking changes).
|
|
32
|
+
|
|
33
|
+
### 2. Bump + build + package (local)
|
|
34
|
+
|
|
35
|
+
From the repo root:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
node scripts/release.mjs --version 1.3.0
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The script:
|
|
42
|
+
|
|
43
|
+
1. Reads the current version from both `package.json` files.
|
|
44
|
+
2. Writes the new version to both files.
|
|
45
|
+
3. Runs `npm run build` (which includes the WebView build).
|
|
46
|
+
4. Runs `npm run vscode:package` to produce `dist/apps/vscode-artifacts/pibo-vscode-1.3.0.vsix` and a stable `latest.vsix` copy.
|
|
47
|
+
5. Prints the VSIX path and size.
|
|
48
|
+
|
|
49
|
+
The script does **not** push to git or create a tag. The maintainer reviews the diff and commits it.
|
|
50
|
+
|
|
51
|
+
### 3. Commit and tag
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
git add package.json src/apps/chat-vscode/package.json
|
|
55
|
+
git commit -m "chore(release): bump @pasko70/pibo and pibo.pibo-vscode to 1.3.0"
|
|
56
|
+
git tag -a v1.3.0 -m "@pasko70/pibo 1.3.0"
|
|
57
|
+
git push origin main
|
|
58
|
+
git push origin v1.3.0
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 4. Create a GitHub Release with the VSIX attached
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
gh release create v1.3.0 \
|
|
65
|
+
dist/apps/vscode-artifacts/pibo-vscode-1.3.0.vsix \
|
|
66
|
+
--title "pibo 1.3.0" \
|
|
67
|
+
--notes "..."
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
This makes the VSIX downloadable from a stable URL (`https://github.com/Pascapone/pibo/releases/download/v1.3.0/pibo-vscode-1.3.0.vsix`). The `pibo vscode install` command uses the GitHub Releases API to discover this URL automatically.
|
|
71
|
+
|
|
72
|
+
The release script can also do this in one step:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
node scripts/release.mjs --version 1.3.0 --create-release
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
…if the tag has already been pushed.
|
|
79
|
+
|
|
80
|
+
### 5. Publish the npm package
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npm publish
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Or, in one go with the release script:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
node scripts/release.mjs --version 1.3.0 --publish-npm --create-release
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
The publish step uploads the `pibo` CLI, the gateway plugins, and the WebView bundle. The Marketplace upload is intentionally **not** automated — see step 6.
|
|
93
|
+
|
|
94
|
+
### 6. Upload the VSIX to the VS Code Marketplace (manual)
|
|
95
|
+
|
|
96
|
+
The Marketplace does not currently accept a Personal Access Token from this account (Azure-side provisioning issue). The release is therefore finished by uploading the VSIX through the Marketplace web UI:
|
|
97
|
+
|
|
98
|
+
1. Open <https://marketplace.visualstudio.com/manage>.
|
|
99
|
+
2. Pick the publisher `pibo` (created during the first marketplace publish).
|
|
100
|
+
3. Click **Upload new extension** and select `dist/apps/vscode-artifacts/pibo-vscode-1.3.0.vsix`.
|
|
101
|
+
4. The Marketplace validates the manifest and publishes the extension. The publisher ID is `pibo.pibo-vscode`.
|
|
102
|
+
|
|
103
|
+
After the upload, `code --install-extension pibo.pibo-vscode` works for end users.
|
|
104
|
+
|
|
105
|
+
### 7. Verify
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
pibo vscode install --vsix dist/apps/vscode-artifacts/pibo-vscode-1.3.0.vsix
|
|
109
|
+
pibo vscode status
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Confirm that `status` reports `pibo.pibo-vscode@1.3.0` installed via the expected `code` binary, and that the WebView loads the gateway at `http://127.0.0.1:4788/apps/chat-vscode/`.
|
|
113
|
+
|
|
114
|
+
## Rollback
|
|
115
|
+
|
|
116
|
+
If a release is broken:
|
|
117
|
+
|
|
118
|
+
- **npm**: `npm unpublish @pasko70/pibo@1.3.0` works only within 72 hours of publish. After that, publish `1.3.1` with a fix.
|
|
119
|
+
- **VSIX via `pibo vscode install`**: delete the GitHub Release and re-create it with a fixed VSIX. Users who have already installed the extension will not auto-update until they run `pibo vscode install` again.
|
|
120
|
+
- **Marketplace**: the Marketplace UI supports un-publishing or un-listing. For a fast fix, upload a corrected `.vsix` with the same version (the Marketplace accepts a re-upload before processing the original).
|
|
121
|
+
|
|
122
|
+
## What ships in the `pibo` npm package
|
|
123
|
+
|
|
124
|
+
The `files` whitelist in `package.json` controls what is published:
|
|
125
|
+
|
|
126
|
+
- `dist/` — the compiled server, the gateway plugins, the WebView bundles (chat-ui, context-files-ui, chat-vscode-web).
|
|
127
|
+
- `context/` — the bundled agent skills.
|
|
128
|
+
- `skills/builtin/**` — built-in user skills.
|
|
129
|
+
- `docs/ops/**` — operator runbooks.
|
|
130
|
+
- `README.md` and `src/mcp/LICENSE.mcp-cli`.
|
|
131
|
+
|
|
132
|
+
The `.vsix` is **not** in the npm package. It lives on the GitHub Release and (after the maintainer uploads it) on the VS Code Marketplace.
|
|
133
|
+
|
|
134
|
+
## Why the WebView bundle is in the npm package
|
|
135
|
+
|
|
136
|
+
The extension's WebView loads from `http://<gateway>/apps/chat-vscode/`, not from the `.vsix`. The gateway serves the bundle out of `dist/apps/chat-vscode-web/`. If the bundle were not in the npm package, the gateway would return 404 for the WebView and the extension would be unusable.
|
|
137
|
+
|
|
138
|
+
Including the bundle in npm costs about 1 MB of disk per `pibo` install and zero runtime cost for users who never open the extension. Users who only use the `pibo` CLI never load the bundle.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pasko70/pibo",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Minimal TypeScript wrapper around Pi Coding Agent.",
|
|
6
6
|
"files": [
|
|
@@ -35,8 +35,9 @@
|
|
|
35
35
|
"vscode:typecheck": "tsc -p src/apps/chat-vscode/extension/tsconfig.json --noEmit && tsc -p src/apps/chat-vscode/extension/webview/tsconfig.json --noEmit",
|
|
36
36
|
"vscode:webview:build": "vite build --config src/apps/chat-vscode/extension/webview/vite.config.ts",
|
|
37
37
|
"vscode:extension:build": "esbuild src/apps/chat-vscode/extension/src/extension.ts --bundle --platform=node --target=node24 --format=cjs --outfile=src/apps/chat-vscode/dist/extension/extension.cjs --external:vscode --sourcemap=inline",
|
|
38
|
-
"vscode:package": "
|
|
39
|
-
"
|
|
38
|
+
"vscode:package": "node scripts/vscode-package.mjs",
|
|
39
|
+
"release": "node scripts/release.mjs",
|
|
40
|
+
"build": "tsc -p tsconfig.json && npm run web-ui:build && npm run vscode:webview:build && node scripts/ensure-bin-executable.mjs",
|
|
40
41
|
"start": "node dist/bin/pibo.js",
|
|
41
42
|
"test": "npm run build && node --test test/*.test.mjs test/chat-vscode/*.test.mjs",
|
|
42
43
|
"check:product-vocab": "node scripts/legacy-product-vocabulary-gate.mjs",
|
|
@@ -85,4 +86,4 @@
|
|
|
85
86
|
"vite": "^8.0.10",
|
|
86
87
|
"vite-tsconfig-paths": "^5.1.4"
|
|
87
88
|
}
|
|
88
|
-
}
|
|
89
|
+
}
|