Wire the vision extension into package.json (manifest + test globs) #261

Closed
opened 2026-09-17 03:34:45 +00:00 by david · 1 comment
Owner

Summary

Wire the finished vision extension into the repo's package.json manifest so pi loads it and the repo's test suite exercises it: confirm the image-size dependency, add the extension to pi.extensions, and append the vision test globs to scripts.test.

Background

Depends on: #255, #260

pi discovers this repo's extensions through the pi.extensions array in package.json (pinned pi docs, docs/packages.md), and the repo runs its whole suite through a single npm test script. Until this step, the vision tests only pass when run file-by-file by their own milestone; after it, npm test from the repo root is the source of truth and the "definition of done" acceptance ("npm test green from the root") is achievable.

extensions/vision/src/images.ts already added image-size to dependencies when it was implemented; this step verifies that entry rather than re-adding it, and finishes the manifest work.

Existing manifest entries to follow: extensions/mongodb/index.ts (last entry in pi.extensions today), and the current scripts.test chain (which ends with extensions/penpot/src/tools/*.test.ts).

Documentation Required

A separate process downloads these into the listed folders before this issue is implemented. Check the folder for the actual reference material before starting.

docs/reference/pi-coding-agent/

  • Local package docs: node_modules/@earendil-works/pi-coding-agent/docs/packages.md — the pi.extensions / pi.skills manifest keys and the paths they take.
  • Same docs folder, extensions.md — how an extension file is loaded from the manifest.

docs/reference/npm/

docs/reference/nodejs/

Implementation Details

Edit the repo-root package.json only:

  1. dependencies: confirm "image-size": "^2" is present (it should have been added by the images step). If missing, add it and run npm install. Do not add any other dependency — the HTTP client uses the built-in fetch.
  2. pi.extensions: append "extensions/vision/index.ts" after the existing last entry.
  3. scripts.test: append the two vision globs so the whole extension is covered:
    extensions/vision/index.test.ts extensions/vision/src/*.test.ts
    
    Keep the existing chain and its && separators intact — this is a pure append, not a rewrite. Do not remove or reorder existing entries.

Then run the full suite from the repo root.

Notes:

  • engines already requires Node ≥ 20.19; leave it as is. The extension uses AbortSignal.any/AbortSignal.timeout, which is why that floor matters.
  • Do not add a per-extension package.json.
  • If any vision test fails under the repo-root suite but passed standalone, fix the test or the code — do not weaken the script.

Acceptance Criteria

  • package.json dependencies contains "image-size": "^2" and npm install still resolves cleanly.
  • package.json pi.extensions includes "extensions/vision/index.ts".
  • package.json scripts.test includes extensions/vision/index.test.ts and extensions/vision/src/*.test.ts, appended without altering existing entries.
  • npm test from the repo root passes, including every vision test.
  • No unrelated manifest change is introduced.

Test Plan

cd /Users/david/Projects/pi-extensions-and-skills
npm install
npm test

Expected: install succeeds and the whole suite (existing extensions plus vision) is green.

Confirm the manifest additions:

node -e "const p=require('./package.json'); console.log(p.dependencies['image-size'], p.pi.extensions.includes('extensions/vision/index.ts'), p.scripts.test.includes('extensions/vision/src/*.test.ts'))"

Expected: ^2 true true.

## Summary Wire the finished `vision` extension into the repo's `package.json` manifest so pi loads it and the repo's test suite exercises it: confirm the `image-size` dependency, add the extension to `pi.extensions`, and append the vision test globs to `scripts.test`. ## Background **Depends on:** #255, #260 pi discovers this repo's extensions through the `pi.extensions` array in `package.json` (pinned pi docs, `docs/packages.md`), and the repo runs its whole suite through a single `npm test` script. Until this step, the vision tests only pass when run file-by-file by their own milestone; after it, `npm test` from the repo root is the source of truth and the "definition of done" acceptance ("`npm test` green from the root") is achievable. `extensions/vision/src/images.ts` already added `image-size` to `dependencies` when it was implemented; this step verifies that entry rather than re-adding it, and finishes the manifest work. Existing manifest entries to follow: `extensions/mongodb/index.ts` (last entry in `pi.extensions` today), and the current `scripts.test` chain (which ends with `extensions/penpot/src/tools/*.test.ts`). ## Documentation Required A separate process downloads these into the listed folders before this issue is implemented. Check the folder for the actual reference material before starting. **`docs/reference/pi-coding-agent/`** - Local package docs: `node_modules/@earendil-works/pi-coding-agent/docs/packages.md` — the `pi.extensions` / `pi.skills` manifest keys and the paths they take. - Same docs folder, `extensions.md` — how an extension file is loaded from the manifest. **`docs/reference/npm/`** - https://docs.npmjs.com/cli/v10/configuring-npm/package-json — `dependencies`, `scripts`, and `engines` fields. **`docs/reference/nodejs/`** - https://nodejs.org/api/test.html#running-tests-from-the-command-line — how `node --test` treats multiple file/glob arguments, which is the form `scripts.test` uses. ## Implementation Details Edit the repo-root `package.json` only: 1. `dependencies`: confirm `"image-size": "^2"` is present (it should have been added by the images step). If missing, add it and run `npm install`. Do not add any other dependency — the HTTP client uses the built-in `fetch`. 2. `pi.extensions`: append `"extensions/vision/index.ts"` after the existing last entry. 3. `scripts.test`: append the two vision globs so the whole extension is covered: ``` extensions/vision/index.test.ts extensions/vision/src/*.test.ts ``` Keep the existing chain and its `&&` separators intact — this is a pure append, not a rewrite. Do not remove or reorder existing entries. Then run the full suite from the repo root. Notes: - `engines` already requires Node ≥ 20.19; leave it as is. The extension uses `AbortSignal.any`/`AbortSignal.timeout`, which is why that floor matters. - Do not add a per-extension `package.json`. - If any vision test fails under the repo-root suite but passed standalone, fix the test or the code — do not weaken the script. ## Acceptance Criteria - [ ] `package.json` `dependencies` contains `"image-size": "^2"` and `npm install` still resolves cleanly. - [ ] `package.json` `pi.extensions` includes `"extensions/vision/index.ts"`. - [ ] `package.json` `scripts.test` includes `extensions/vision/index.test.ts` and `extensions/vision/src/*.test.ts`, appended without altering existing entries. - [ ] `npm test` from the repo root passes, including every vision test. - [ ] No unrelated manifest change is introduced. ## Test Plan ```bash cd /Users/david/Projects/pi-extensions-and-skills npm install npm test ``` Expected: install succeeds and the whole suite (existing extensions plus vision) is green. Confirm the manifest additions: ```bash node -e "const p=require('./package.json'); console.log(p.dependencies['image-size'], p.pi.extensions.includes('extensions/vision/index.ts'), p.scripts.test.includes('extensions/vision/src/*.test.ts'))" ``` Expected: `^2 true true`.
david self-assigned this 2026-09-17 03:34:45 +00:00
david closed this issue 2026-09-17 11:38:00 +00:00
Author
Owner

pi-loop opened and merged a pull request for this issue: #274

pi-loop opened and merged a pull request for this issue: https://git.excelera.net/david/pi-extensions-and-skills/pulls/274
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
david/pi-extensions-and-skills#261
No description provided.