Initialize the extensions/mongodb package (package.json, deps, bun.lock) #133

Closed
opened 2026-08-31 22:02:43 +00:00 by david · 1 comment
Owner

Summary

Create the extensions/mongodb/ npm package skeleton: a package.json declaring the extension manifest, its dependencies, and a test script, then run bun install to produce a committed bun.lock. This is the foundation every other module of the extension builds on.

Background

This is the first step of building a new pi extension called mongodb-extension — a TypeScript extension that exposes read-only MongoDB query tools (mongo_find, mongo_count, mongo_list_collections). It lives at extensions/mongodb/ inside this repo (pi-extensions-and-skills), alongside sibling extensions extensions/postgres/ and extensions/victorialogs/ that follow the same conventions — mirror them where applicable.

This step only creates the package manifest and installs dependencies; no source code yet. index.ts (created in a later milestone) is referenced by the manifest but does not exist yet — that is expected. Everything else in this plan depends on this package existing with a working bun test runner.

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/mongodb-driver/ — for the mongodb driver dependency (version floor and API surface):

docs/reference/dotenv/ — for the dotenv dependency:

Implementation Details

Create extensions/mongodb/package.json with:

  • "name": "mongodb-extension"
  • "pi": { "extensions": ["./index.ts"] } — the entry point pi loads; the file itself comes in a later milestone.
  • "scripts": { "test": "bun test" } (repo convention — matches the sibling extensions).
  • "dependencies": { "mongodb": "...", "dotenv": "..." }mongodb at ^6.10 as the floor, or ^7.x (the current major; pick the latest stable at implementation time — check the npm page in the reference folder). The driver is a pure-JS package with no native deps, so it runs under bun.
  • "devDependencies": { "@types/bun": "..." } plus @earendil-works/pi-coding-agent (as a dev/peer dependency for extension types — mirror exactly how extensions/postgres/package.json declares it).

Then run bun install inside extensions/mongodb/ so bun.lock is produced and committed. Do not create any source files in this step.

Acceptance Criteria

  • extensions/mongodb/package.json exists with name: "mongodb-extension", pi.extensions: ["./index.ts"], and test: "bun test".
  • mongodb and dotenv are in dependencies; @types/bun (and @earendil-works/pi-coding-agent per the postgres sibling) are in devDependencies.
  • bun install succeeds and bun.lock is committed.
  • bun test runs from extensions/mongodb/ and exits 0 (trivially, with zero tests).

Test Plan

cd extensions/mongodb
bun install
bun test   # exits 0 with "0 tests" (or similar) — proves the runner works
ls bun.lock
## Summary Create the `extensions/mongodb/` npm package skeleton: a `package.json` declaring the extension manifest, its dependencies, and a `test` script, then run `bun install` to produce a committed `bun.lock`. This is the foundation every other module of the extension builds on. ## Background This is the first step of building a new pi extension called **mongodb-extension** — a TypeScript extension that exposes read-only MongoDB query tools (`mongo_find`, `mongo_count`, `mongo_list_collections`). It lives at `extensions/mongodb/` inside this repo (`pi-extensions-and-skills`), alongside sibling extensions `extensions/postgres/` and `extensions/victorialogs/` that follow the same conventions — mirror them where applicable. This step only creates the package manifest and installs dependencies; no source code yet. `index.ts` (created in a later milestone) is referenced by the manifest but does not exist yet — that is expected. Everything else in this plan depends on this package existing with a working `bun test` runner. ## 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/mongodb-driver/`** — for the `mongodb` driver dependency (version floor and API surface): - https://www.npmjs.com/package/mongodb — npm package page; current published version (7.6.0 as of writing) and install instructions. - https://mongodb.github.io/node-mongodb-native/7.6/ — TypeDoc API reference index for the driver (class pages: MongoClient, Db, Collection, Cursor, error classes). - https://github.com/mongodb/node-mongodb-native/blob/master/etc/notes/errors.md — driver error class tree and guidance to use `instanceof` checks rather than parsing error messages. **`docs/reference/dotenv/`** — for the `dotenv` dependency: - https://github.com/motdotla/dotenv — official README: `config()`, `parse()`, `populate()`, options (`path`, `debug`, `override`, `processEnv`), and the .env parsing rules. - https://www.npmjs.com/package/dotenv — npm package page (mirror of the README; version info). ## Implementation Details Create `extensions/mongodb/package.json` with: - `"name": "mongodb-extension"` - `"pi": { "extensions": ["./index.ts"] }` — the entry point pi loads; the file itself comes in a later milestone. - `"scripts": { "test": "bun test" }` (repo convention — matches the sibling extensions). - `"dependencies": { "mongodb": "...", "dotenv": "..." }` — `mongodb` at ^6.10 as the floor, or ^7.x (the current major; pick the latest stable at implementation time — check the npm page in the reference folder). The driver is a pure-JS package with no native deps, so it runs under bun. - `"devDependencies": { "@types/bun": "..." }` plus `@earendil-works/pi-coding-agent` (as a dev/peer dependency for extension types — mirror exactly how `extensions/postgres/package.json` declares it). Then run `bun install` inside `extensions/mongodb/` so `bun.lock` is produced and committed. Do not create any source files in this step. ## Acceptance Criteria - [ ] `extensions/mongodb/package.json` exists with `name: "mongodb-extension"`, `pi.extensions: ["./index.ts"]`, and `test: "bun test"`. - [ ] `mongodb` and `dotenv` are in `dependencies`; `@types/bun` (and `@earendil-works/pi-coding-agent` per the postgres sibling) are in `devDependencies`. - [ ] `bun install` succeeds and `bun.lock` is committed. - [ ] `bun test` runs from `extensions/mongodb/` and exits 0 (trivially, with zero tests). ## Test Plan ```bash cd extensions/mongodb bun install bun test # exits 0 with "0 tests" (or similar) — proves the runner works ls bun.lock ```
david closed this issue 2026-08-31 23:24:08 +00:00
Author
Owner

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

pi-loop opened and merged a pull request for this issue: https://git.excelera.net/david/pi-extensions-and-skills/pulls/152
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#133
No description provided.