Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/prompts/new-package.prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
description: "Scaffold a new @plugola/* workspace package with the repo's standard structure (package.json, tsconfigs, src, test, README, LICENSE) and wire it into the root tsconfig and release-please config. Use when adding a new package to the monorepo."
name: 'New Plugola Package'
argument-hint: '<package-name> [one-line description]'
agent: 'agent'
---

Scaffold a new `@plugola/*` package in this monorepo. Follow the conventions in [AGENTS.md](../../AGENTS.md).

## Inputs

- **Package name**: the unscoped name (e.g. `state-machine` → published as `@plugola/state-machine`). If not provided in the arguments, ask for it.
- **Description**: a one-line summary for `package.json` and the README. If not provided, ask.
- **Main entry file**: default `src/index.ts`. Ask only if the package's primary export should be a named file (some packages use e.g. `src/Store.ts` and point `exports` at `./dist/Store.js`).

Model the new package on the smallest existing one, [packages/store](../../packages/store) — read its files first to match structure and current dependency versions exactly.

## Steps

1. Create `packages/<name>/` with these files:
- `package.json` — `"name": "@plugola/<name>"`, `"version": "0.0.0"`, `"type": "module"`, `"sideEffects": false`, `exports` pointing at the built `./dist/<entry>.js`. Copy the `scripts` block (`build`, `clean`, `start`, `test`) and `devDependencies` verbatim from an existing package so versions stay in sync. Keep `dependencies` to `tslib` unless the user needs more.
- `tsconfig.json` — `extends: "../../tsconfig.json"`, `compilerOptions: { "outDir": "dist", "rootDir": "./src" }`, `include: ["src"]`.
- `test/tsconfig.json` — `extends: "../tsconfig.json"`, `compilerOptions: { "noEmit": true, "rootDir": "../" }`, `include: ["../src", "."]`.
- `src/<entry>.ts` — a minimal starting export (default export for a main class, using `#private` fields; named exports otherwise).
- `test/<entry>.test.ts` — a vitest spec importing from `../src/<entry>.js` (note the `.js` extension) with `import { test, expect } from 'vitest'` and one placeholder assertion.
- `README.md` — `# @plugola/<name>`, the description as a `>` blockquote, and a `## Usage` heading.
- `LICENSE` — copy verbatim from [packages/store/LICENSE](../../packages/store/LICENSE).

2. Wire it into the build: add `{ "path": "packages/<name>" }` to `references` in the root [tsconfig.json](../../tsconfig.json), keeping the list alphabetically ordered.

3. Register it for releases: add `"packages/<name>": {}` to the `packages` map in [release-please-config.json](../../release-please-config.json), keeping alphabetical order.

4. Verify: run `npm install` (to link the workspace), then `npm run build` and `npm test --workspace @plugola/<name>`. Fix any errors before finishing.

## Conventions to honor

- **ESM only**: relative imports MUST include the `.js` extension, even in `.ts` files.
- **Prettier**: no semicolons, single quotes — match the surrounding code exactly.
- **Strict TS**: no unused locals/parameters, or the build fails.
- Do NOT hand-write a `CHANGELOG.md` or invent a real version — release-please manages versions and changelogs.

When done, print the list of created/modified files and the exact command to run the new package's tests.
34 changes: 34 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Plugola

TypeScript monorepo of small, independently published `@plugola/*` packages built around a plugin system (message bus, plugin manager, store, streams, logger, etc.). See the [README](README.md) and each package's own `README.md`.

## Layout

- npm workspaces: every package lives in `packages/*` and is published independently.
- Each package: `src/` (source), `test/` (vitest specs), `dist/` (build output, generated), its own `package.json`, `tsconfig.json`, and `CHANGELOG.md`.
- Cross-package deps use published versions (e.g. `@plugola/plugin-manager` depends on `@plugola/graph`), wired via TypeScript project references in the root [tsconfig.json](tsconfig.json).

## Commands (run from repo root)

- `npm ci` — install.
- `npm run build` — `tsc --build` across all project references. Run before tests; packages import each other's compiled `dist/`.
- `npm test` — runs `npm test` in every workspace (each is `vitest --run`).
- `npm start` — `tsc --build --watch`.
- Single package: `npm test --workspace @plugola/<name>` or `cd packages/<name> && npx vitest`.

## Conventions

- **ESM only**: every package is `"type": "module"` with `module`/`moduleResolution: nodenext`. Relative imports MUST include the `.js` extension, even from `.ts` files (e.g. `import Graph from '../src/Graph.js'`).
- **TypeScript is strict**, plus `noUnusedLocals`, `noUnusedParameters`, `noImplicitOverride`, `noImplicitReturns`. Clean up unused code or the build fails.
- **Main class per package** is usually a `default export`; use `#private` class fields for internals.
- **Prettier** (see [prettier.config.js](prettier.config.js)): no semicolons, single quotes. `lint-staged` formats on commit.
- **Tests**: vitest with `import { test, expect, beforeEach } from 'vitest'`. Inline snapshots (`toMatchInlineSnapshot`) are used heavily — regenerate with `npx vitest -u`.

## Commits & releases

- **Conventional Commits** are enforced by commitlint + husky on commit (`feat:`, `fix:`, `chore:`, etc.). Non-conforming messages are rejected.
- Releases are automated via release-please ([release-please-config.json](release-please-config.json)); packages are versioned and tagged independently. Do not hand-edit `CHANGELOG.md` or bump versions manually.

## CI

PRs run `npm ci && npm run build && npm test` on Node 24 and 26 ([pull-request.yml](.github/workflows/pull-request.yml)). Ensure a clean build and passing tests on a current Node version before pushing.
Loading