@codyswann/lisa 2.20.0 → 2.21.1

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.
Files changed (29) hide show
  1. package/package.json +1 -1
  2. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  3. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  4. package/plugins/lisa/rules/base-rules.md +1 -1
  5. package/plugins/lisa/skills/git-submit-pr/SKILL.md +1 -1
  6. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  7. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  8. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  9. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  10. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  11. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +2 -1
  12. package/plugins/lisa-harper-fabric/skills/harper-build-and-deploy/SKILL.md +101 -0
  13. package/plugins/lisa-harper-fabric/skills/harper-component-model/SKILL.md +87 -0
  14. package/plugins/lisa-harper-fabric/skills/harper-config-yaml/SKILL.md +107 -0
  15. package/plugins/lisa-harper-fabric/skills/harper-resources/SKILL.md +106 -0
  16. package/plugins/lisa-harper-fabric/skills/harper-schema-graphql/SKILL.md +72 -0
  17. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  18. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  19. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  20. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  21. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  22. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  23. package/plugins/src/base/rules/base-rules.md +1 -1
  24. package/plugins/src/base/skills/git-submit-pr/SKILL.md +1 -1
  25. package/plugins/src/harper-fabric/skills/harper-build-and-deploy/SKILL.md +101 -0
  26. package/plugins/src/harper-fabric/skills/harper-component-model/SKILL.md +87 -0
  27. package/plugins/src/harper-fabric/skills/harper-config-yaml/SKILL.md +107 -0
  28. package/plugins/src/harper-fabric/skills/harper-resources/SKILL.md +106 -0
  29. package/plugins/src/harper-fabric/skills/harper-schema-graphql/SKILL.md +72 -0
package/package.json CHANGED
@@ -81,7 +81,7 @@
81
81
  "lodash": ">=4.18.1"
82
82
  },
83
83
  "name": "@codyswann/lisa",
84
- "version": "2.20.0",
84
+ "version": "2.21.1",
85
85
  "description": "Claude Code governance framework that applies guardrails, guidance, and automated enforcement to projects",
86
86
  "main": "dist/index.js",
87
87
  "exports": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "2.20.0",
3
+ "version": "2.21.1",
4
4
  "description": "Universal governance — agents, skills, commands, hooks, and rules for all projects",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa",
3
- "version": "2.20.0",
3
+ "version": "2.21.1",
4
4
  "description": "Universal governance: agents, skills, commands, hooks, and rules for all projects.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -56,7 +56,7 @@ Git Discipline:
56
56
  - When opening a PR, watch the PR. If any status checks fail, fix them. For all bot code reviews, if the feedback is valid, implement it and push the change to the PR. Then resolve the feedback. If the feedback is not valid, reply to the feedback explaining why it's not valid and then resolve the feedback. Do this in a loop until the PR is able to be merged and then merge it.
57
57
  - When merging a PR into an environment branch (dev, staging, main), watch the resultant deploy until it fully succeeds. If it fails for any reason, fix the failure and then open a new PR with the fix.
58
58
  - When referencing a PR in a response, always include the url
59
- - **Promotion PRs (environment branch → environment branch — e.g., `dev` → `staging`, `staging` → `main`) MUST be merged with a regular merge commit (`gh pr merge --merge`), NEVER squash-merged.** Squashing flattens the constituent `chore(release): X.Y.Z [skip ci]` commits into a single commit titled with the PR title, which (a) strips the `[skip ci]` markers so the release workflow re-runs and double-bumps the version on the destination branch, and (b) breaks the release workflow's promotion-detection regex (which inspects the merge-commit subject for `Merge branch 'X' into Y` or `Merge pull request #N from .../<env-branch>`). The merge commit produced by `--merge` keeps the subject clean and the per-commit `[skip ci]` markers attached where they belong. Feature PRs (anything → `dev`) use `--squash` as usual.
59
+ - **Promotion PRs (environment branch → environment branch — e.g., `dev` → `staging`, `staging` → `main`) MUST be merged with a regular merge commit (`gh pr merge --merge`), NEVER squash-merged.** Squashing flattens the constituent `chore(release): X.Y.Z [skip ci]` commits into a single commit titled with the PR title, which (a) strips the `[skip ci]` markers so the release workflow re-runs and double-bumps the version on the destination branch, and (b) breaks the release workflow's promotion-detection regex (which inspects the merge-commit subject for `Merge branch 'X' into Y` or `Merge pull request #N from .../<env-branch>`). The merge commit produced by `--merge` keeps the subject clean and the per-commit `[skip ci]` markers attached where they belong. Feature PRs (anything → `dev`) use a regular merge commit (`gh pr merge --merge`) as well.
60
60
 
61
61
  Testing Discipline:
62
62
  - Never skip or disable any tests or quality checks.
@@ -26,7 +26,7 @@ Push current branch and create or update a pull request. Optional hint: $ARGUMEN
26
26
  - If not: Create PR with comprehensive description (not a draft)
27
27
  5. **Auto-merge**: Choose merge strategy by PR type:
28
28
  - **Promotion PRs** (env → env, e.g. `dev` → `staging`): use `gh pr merge --auto --merge` (never squash). Squashing flattens the constituent `chore(release): X.Y.Z [skip ci]` commits into one commit titled with the PR title, stripping the `[skip ci]` markers and breaking the release workflow's promotion-detection regex — the destination branch then double-bumps its version. `--merge` keeps each `chore(release)` commit (and its `[skip ci]` marker) intact under a clean merge commit subject the workflow can recognize.
29
- - **Feature PRs** (anything → `dev`): use `gh pr merge --auto --squash`.
29
+ - **Feature PRs** (anything → `dev`): use `gh pr merge --auto --merge`.
30
30
 
31
31
  ### PR Description Format
32
32
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "2.20.0",
3
+ "version": "2.21.1",
4
4
  "description": "AWS CDK-specific plugin",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-cdk",
3
- "version": "2.20.0",
3
+ "version": "2.21.1",
4
4
  "description": "AWS CDK-specific Lisa plugin.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-expo",
3
- "version": "2.20.0",
3
+ "version": "2.21.1",
4
4
  "description": "Expo/React Native-specific skills, agents, rules, and MCP servers",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-expo",
3
- "version": "2.20.0",
3
+ "version": "2.21.1",
4
4
  "description": "Expo and React Native-specific skills, agents, rules, and MCP servers.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-harper-fabric",
3
- "version": "2.20.0",
3
+ "version": "2.21.1",
4
4
  "description": "Harper/Fabric-specific rules for TypeScript component apps",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-harper-fabric",
3
- "version": "2.20.0",
3
+ "version": "2.21.1",
4
4
  "description": "Harper/Fabric-specific Lisa rules for TypeScript component apps.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -14,6 +14,7 @@
14
14
  "dependencies": [
15
15
  "lisa-typescript"
16
16
  ],
17
+ "skills": "./skills/",
17
18
  "interface": {
18
19
  "displayName": "Lisa Harper/Fabric",
19
20
  "shortDescription": "Harper/Fabric workflow guidance",
@@ -0,0 +1,101 @@
1
+ ---
2
+ name: harper-build-and-deploy
3
+ description: This skill should be used when building, running locally, or deploying a Harper (HarperDB/Fabric) component — running harper dev/run, producing the generated resources.js and web/** from TypeScript via the project build, packaging the harper-app component, deploying to Harper Fabric, or handling deploy-time secrets. Use it for any change that affects the deployable surface or the dev loop. Pairs with harper-component-model, harper-config-yaml, and harper-resources.
4
+ ---
5
+
6
+ # Harper Build and Deploy
7
+
8
+ ## Overview
9
+
10
+ The Harper lifecycle is: **develop locally → build TypeScript into the deployable
11
+ component → run/iterate → deploy to Fabric**. This skill covers the CLI, the
12
+ project's build step, and the deploy surface so a change is provably finished, not
13
+ just compiling.
14
+
15
+ ## Local dev and run (the CLI)
16
+
17
+ The CLI binary is `harper` (v5; older installs use `harperdb`). Key commands:
18
+
19
+ | Command | What it does |
20
+ | --- | --- |
21
+ | `harper dev <path/to/app>` | Dev mode: **watches files, single-threaded, auto-restarts worker threads** on change, with console logging. The fast iteration loop. Does **not** restart the main thread. |
22
+ | `harper run <path/to/app>` | Run an app from any directory. Use when you need the main thread to (re)start; manage start/stop yourself. |
23
+ | `harper start` / `stop` / `restart` | Background (daemon) lifecycle. |
24
+ | `harper status` | Harper and clustering status. |
25
+ | `harper get_components` | List installed components. |
26
+
27
+ In this project, dev typically runs against the component dir, e.g.
28
+ `harper dev harper-app` (use the project's documented run command if it wraps this).
29
+
30
+ ## The build step (TypeScript → generated artifacts)
31
+
32
+ Harper loads JavaScript (`resources.js`) and serves static files (`web/**`). In this
33
+ project those are **generated**, not authored:
34
+
35
+ - **TypeScript under `src/` is source.** `bun run build` compiles it into
36
+ `harper-app/resources.js` and `harper-app/web/**`.
37
+ - **Never edit `resources.js` or `web/**` directly** — change the TypeScript and
38
+ rebuild. See [[harper-resources]] and [[harper-component-model]].
39
+ - **Build before symlinking, packaging, or deploying `harper-app/`.** Deploying
40
+ stale artifacts ships code that does not match `src/`.
41
+
42
+ ## The deployable surface
43
+
44
+ A deployable Harper component must keep these at the component root Fabric packages:
45
+
46
+ - `config.yaml` — active extensions ([[harper-config-yaml]])
47
+ - `schema.graphql` — data model ([[harper-schema-graphql]])
48
+ - `resources.js` — generated custom logic
49
+ - `web/**` — generated static assets
50
+
51
+ If a change touches this surface, it is not done until the local build and the
52
+ relevant deployed or smoke path agree.
53
+
54
+ ## Deploying to Fabric
55
+
56
+ Fabric is Harper's distributed deploy network. Deploy packages the component and
57
+ sends it to a target instance:
58
+
59
+ ```bash
60
+ harper deploy_component \
61
+ project=<app-name> \
62
+ package=<path-or-git-url> \
63
+ target=https://<instance>:9925 \
64
+ username=<user> \
65
+ password=<pass> \
66
+ restart=true \
67
+ replicated=true
68
+ ```
69
+
70
+ - Omitting `package` deploys the current directory.
71
+ - `restart=true` restarts threads after deploy so new code loads.
72
+ - `replicated=true` replicates the deploy across all nodes in a cluster — include it
73
+ when targeting Fabric/a cluster.
74
+ - Credentials can come from `CLI_TARGET_USERNAME` / `CLI_TARGET_PASSWORD` instead of
75
+ inline flags — prefer that so secrets never land in shell history or tracked files.
76
+
77
+ ## Secrets
78
+
79
+ Keep runtime secrets out of tracked files. Use environment variables, the
80
+ `loadEnv` extension, or an OS keychain helper. Document *where* secrets live (which
81
+ env var, which store) without recording their values.
82
+
83
+ ## Verification (required before reporting done)
84
+
85
+ 1. `bun run build` — produces fresh `resources.js` / `web/**`.
86
+ 2. `bun run typecheck`.
87
+ 3. The smallest relevant test command.
88
+ 4. For deploy-affecting changes, the project **smoke command** against the local or
89
+ deployed Harper endpoint.
90
+
91
+ If a verification command cannot run, report the exact command and the blocker —
92
+ do not claim completion. When you hit a Harper/Fabric limitation or workaround,
93
+ record the symptom, root cause, fix, and the tempting-but-broken alternatives in
94
+ the project's Fabric runbook.
95
+
96
+ ## Sources
97
+
98
+ - [Harper CLI overview](https://docs.harperdb.io/reference/v4/cli/overview)
99
+ - [Harper CLI](https://docs.harperdb.io/docs/deployments/harper-cli)
100
+ - [Plugin API](https://docs.harperdb.io/reference/v5/components/plugin-api)
101
+ - [Harper Fabric](https://www.harper.fast/)
@@ -0,0 +1,87 @@
1
+ ---
2
+ name: harper-component-model
3
+ description: This skill should be used when reasoning about how a Harper (formerly HarperDB) Fabric application is structured — what a component, application, extension, or plugin is, where code and assets belong, and how the pieces depend on each other. Use it before adding a new capability, wiring an extension, deciding where a file should live, or explaining the runtime to someone. Pairs with harper-config-yaml, harper-resources, harper-schema-graphql, and harper-build-and-deploy.
4
+ ---
5
+
6
+ # Harper Component Model
7
+
8
+ ## Overview
9
+
10
+ Harper (formerly HarperDB; the product and company now at harper.fast) is an
11
+ open-source Node.js platform that fuses **database, cache, application logic, and
12
+ messaging into a single in-memory process**. **Fabric** is Harper's distributed
13
+ deploy network: you develop locally, then deploy the same component to Fabric.
14
+
15
+ Everything you build is a **component**. Understanding the component hierarchy is
16
+ the prerequisite for every other Harper decision — config, resources, schema, and
17
+ deploy all hang off it.
18
+
19
+ ## The three tiers
20
+
21
+ Harper organizes functionality into three tiers, top to bottom:
22
+
23
+ 1. **Applications** — the user-facing product. An application *is* a type of
24
+ component. It implements business logic (REST/GraphQL endpoints, web UI,
25
+ real-time) by depending on extensions/plugins. This is what this project is.
26
+ 2. **Plugins** (v5) / **Extensions** (deprecated) — the building blocks an
27
+ application depends on. A plugin exports a single `handleApplication(scope)`
28
+ method and always runs on worker threads. The deprecated Extension API used
29
+ `start`, `handleFile`, `handleDirectory`, and `setupDirectory` instead.
30
+ `handleApplication()` cannot coexist with Extension API methods — defining
31
+ both throws. Prefer the Plugin API for any custom building block.
32
+ 3. **Core services** — the high-performance database, networking middleware, and
33
+ the component manager. You configure these; you don't reimplement them.
34
+
35
+ > An *application* is the component you ship. *Extensions/plugins* are the
36
+ > capabilities it consumes. Built-in extensions (`graphqlSchema`, `jsResource`,
37
+ > `rest`, `static`, …) are provided by core; you only *enable* them in
38
+ > `config.yaml`. See [[harper-config-yaml]].
39
+
40
+ ## Built-in extensions an application typically uses
41
+
42
+ These ship with Harper and are enabled (not installed) via `config.yaml`:
43
+
44
+ - `graphqlSchema` — define database tables/types from GraphQL schema files. See [[harper-schema-graphql]].
45
+ - `jsResource` — load custom JavaScript resources (`resources.js`). See [[harper-resources]].
46
+ - `rest` — auto-generate REST endpoints for exported resources/tables.
47
+ - `static` — serve static files (the `web/**` directory) over HTTP.
48
+ - `roles` — role-based access control from `roles.yaml`.
49
+ - `loadEnv` — load environment variables from `.env`.
50
+ - `dataLoader` — seed Harper tables from JSON/YAML.
51
+ - `fastifyRoutes` — custom Fastify route handlers.
52
+
53
+ ## Where things live in this project
54
+
55
+ This project wraps Harper's native model with a fixed layout under `harper-app/`:
56
+
57
+ | Path | Role | Source or generated |
58
+ | --- | --- | --- |
59
+ | `harper-app/config.yaml` | Component config — which extensions are active | **Source** |
60
+ | `harper-app/schema.graphql` | Table/type definitions | **Source** |
61
+ | `src/**` (TypeScript) | Resources, browser modules, shared libs, scripts | **Source** |
62
+ | `harper-app/resources.js` | Loaded by `jsResource` | **Generated** — never edit; build from TS |
63
+ | `harper-app/web/**` | Served by `static` | **Generated** — never edit; build from TS |
64
+
65
+ The TypeScript under `src/` is the source of truth. `resources.js` and `web/**`
66
+ are deploy artifacts produced by `bun run build`. Never hand-edit them — change
67
+ the matching TypeScript and rebuild. See [[harper-build-and-deploy]].
68
+
69
+ ## Decision guide
70
+
71
+ - **Adding a backend behavior?** It's almost always a *resource* (custom logic) or
72
+ a *schema* change (new table/field), enabled through `config.yaml`. Don't ship a
73
+ client-side workaround for missing backend behavior — make the Harper change.
74
+ - **Adding a reusable building block / npm-publishable capability?** That's a
75
+ *plugin* (`pluginModule`), not application code.
76
+ - **Adding static UI?** It belongs in `web/**` (generated from `src/` UI code), served
77
+ by the `static` extension.
78
+ - **Not sure if it deploys?** A deployable Harper app must keep `config.yaml`,
79
+ `schema.graphql`, `resources.js`, and `web/**` at the component root that Fabric
80
+ packages. If your change touches that surface, build before packaging.
81
+
82
+ ## Sources
83
+
84
+ - [Components overview](https://docs.harperdb.io/reference/v5/components/overview)
85
+ - [Plugin API](https://docs.harperdb.io/reference/v5/components/plugin-api)
86
+ - [Applications](https://docs.harperdb.io/docs/developers/applications)
87
+ - [Harper platform](https://www.harper.fast/)
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: harper-config-yaml
3
+ description: This skill should be used when creating or editing a Harper (HarperDB/Fabric) component's config.yaml — enabling a built-in extension (graphqlSchema, jsResource, rest, static, roles, loadEnv, dataLoader, fastifyRoutes), wiring an external component, or troubleshooting why an extension is not loading. Critical: it documents the no-merge footgun where a custom config.yaml replaces Harper's default config entirely. Pairs with harper-component-model, harper-resources, and harper-schema-graphql.
4
+ ---
5
+
6
+ # Harper config.yaml
7
+
8
+ ## Overview
9
+
10
+ A Harper component is configured by a single `config.yaml` at the component root
11
+ (`harper-app/config.yaml` in this project). It declares **which extensions are
12
+ active** and which files each extension reads. Extensions are *enabled* here, not
13
+ installed — the built-ins ship with Harper.
14
+
15
+ The structure is a map of extension name to its options:
16
+
17
+ ```yaml
18
+ extensionName:
19
+ option-1: value
20
+ option-2: value
21
+ ```
22
+
23
+ ## ⚠️ The no-merge footgun
24
+
25
+ If a component has **no** `config.yaml`, Harper applies this default automatically:
26
+
27
+ ```yaml
28
+ rest: true
29
+ graphqlSchema:
30
+ files: '*.graphql'
31
+ roles:
32
+ files: 'roles.yaml'
33
+ jsResource:
34
+ files: 'resources.js'
35
+ fastifyRoutes:
36
+ files: 'routes/*.js'
37
+ urlPath: '.'
38
+ static:
39
+ files: 'web/**'
40
+ ```
41
+
42
+ The moment you add a **custom `config.yaml`, it replaces this default entirely —
43
+ Harper does not merge your file with the defaults.** If you write a `config.yaml`
44
+ that only enables `static`, you have silently turned off `rest`, `graphqlSchema`,
45
+ `jsResource`, and `roles`. This is the most common Harper config mistake.
46
+
47
+ **Rule:** when you add or edit `config.yaml`, re-declare every extension the app
48
+ actually needs — start from the default block above and add to it. Do not assume
49
+ unmentioned extensions stay on.
50
+
51
+ ## Built-in extensions
52
+
53
+ | Key | Purpose | Common options |
54
+ | --- | --- | --- |
55
+ | `rest` | Auto REST endpoints for exported resources/tables | `true`, or an object with options |
56
+ | `graphqlSchema` | Define tables/types from GraphQL files | `files: '*.graphql'` — see [[harper-schema-graphql]] |
57
+ | `jsResource` | Load custom JS resources | `files: 'resources.js'` — see [[harper-resources]] |
58
+ | `static` | Serve static files over HTTP | `files: 'web/**'`, `urlPath` |
59
+ | `roles` | Role-based access control | `files: 'roles.yaml'` |
60
+ | `loadEnv` | Load env vars from `.env` | `files` |
61
+ | `dataLoader` | Seed tables from JSON/YAML | `files` |
62
+ | `fastifyRoutes` | Custom Fastify routes | `files: 'routes/*.js'`, `urlPath` |
63
+
64
+ ## External components and custom plugins
65
+
66
+ A component you depend on from npm needs a `package:` directive matching a
67
+ `package.json` dependency:
68
+
69
+ ```yaml
70
+ '@harperdb/nextjs':
71
+ package: '@harperdb/nextjs'
72
+ files: './'
73
+ ```
74
+
75
+ A custom plugin you author is wired with `pluginModule` (point at the built JS, not
76
+ TypeScript source):
77
+
78
+ ```yaml
79
+ pluginModule: ./dist/index.js
80
+ ```
81
+
82
+ The deprecated Extension API used `extensionModule` instead. Prefer `pluginModule`.
83
+ See [[harper-component-model]] for the plugin-vs-extension distinction.
84
+
85
+ ## Project conventions
86
+
87
+ - `config.yaml` is **source** and lives at `harper-app/config.yaml`. It is part of
88
+ the deployable surface Fabric packages — keep it at the component root.
89
+ - The files `config.yaml` points to (`resources.js`, `web/**`) are **generated** by
90
+ `bun run build` from TypeScript under `src/`. Editing `config.yaml` to point at a
91
+ new file means the build must produce that file. See [[harper-build-and-deploy]].
92
+ - A `config.yaml` change is a deploy-shape change: update the matching project doc
93
+ (the Fabric runbook) in the same change, and re-run the smoke command.
94
+ - Keep secrets out of `config.yaml`. Use `loadEnv` / environment variables and
95
+ document *where* secrets live without recording their values.
96
+
97
+ ## Verification
98
+
99
+ After editing `config.yaml`, confirm the app still boots and the expected surface
100
+ is live: run `harper dev harper-app` (or the project's run command) and check that
101
+ the REST/GraphQL/static endpoints you rely on respond. A config that silently
102
+ dropped an extension often fails only at runtime, not at build time.
103
+
104
+ ## Sources
105
+
106
+ - [Components overview](https://docs.harperdb.io/reference/v5/components/overview)
107
+ - [Built-in extensions](https://docs.harperdb.io/docs/reference/components/built-in-extensions)
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: harper-resources
3
+ description: This skill should be used when writing or editing Harper (HarperDB/Fabric) resources — the classes in resources.js (built from TypeScript under src/) that expose custom data logic over REST and GraphQL. Use it when adding an endpoint, overriding table behavior, wrapping an external API, or wiring real-time subscriptions. Covers the Resource method-to-HTTP mapping and the TS-is-source build convention. Pairs with harper-schema-graphql, harper-config-yaml, and harper-build-and-deploy.
4
+ ---
5
+
6
+ # Harper Resources
7
+
8
+ ## Overview
9
+
10
+ A **Resource** is a class that provides a unified interface for a set of records or
11
+ entities. Resources are how you add custom server-side behavior to a Harper app.
12
+ They are loaded by the `jsResource` extension (default file `resources.js`) and,
13
+ when **exported**, become live REST and GraphQL endpoints.
14
+
15
+ A resource either **extends a database table** (to customize an existing table's
16
+ behavior) or **extends the base `Resource` class** (to expose data from anywhere —
17
+ an external API, a computed view, an in-memory source).
18
+
19
+ ## Method → HTTP verb mapping
20
+
21
+ The Resource API mirrors REST. Override the method matching the operation you want
22
+ to customize:
23
+
24
+ | Method | HTTP | Use |
25
+ | --- | --- | --- |
26
+ | `get(target)` | GET | Retrieve a record/collection |
27
+ | `post(data)` | POST | Create |
28
+ | `put(target, data)` | PUT | Replace |
29
+ | `patch(target, data)` | PATCH | Partial update |
30
+ | `delete(target)` | DELETE | Remove |
31
+ | `search(query)` | GET (query) | Query with conditions |
32
+ | `subscribe` / `publish` | MQTT/WebSocket | Real-time |
33
+
34
+ ## Extending a table
35
+
36
+ Add computed fields or guard logic while keeping the table's built-in behavior via
37
+ `super`:
38
+
39
+ ```javascript
40
+ export class MyTable extends tables.MyTable {
41
+ static async get(target) {
42
+ const record = await super.get(target);
43
+ return { ...record, computedField: 'value' };
44
+ }
45
+ }
46
+ ```
47
+
48
+ ## Wrapping an external source
49
+
50
+ ```javascript
51
+ export class MyExternalData extends Resource {
52
+ static async get(target) {
53
+ const response = await fetch(`https://api.example.com/${target.id}`);
54
+ return response.json();
55
+ }
56
+ }
57
+ ```
58
+
59
+ ## Making a resource an endpoint
60
+
61
+ A resource becomes an endpoint when it is **exported** and `rest: true` (and/or
62
+ `graphqlSchema`) is enabled in `config.yaml`:
63
+
64
+ ```yaml
65
+ rest: true
66
+ graphqlSchema:
67
+ files: schema.graphql
68
+ jsResource:
69
+ files: resources.js
70
+ ```
71
+
72
+ Resources can also be registered programmatically with `server.resources.set()`.
73
+ See [[harper-config-yaml]] for the extension wiring and [[harper-schema-graphql]]
74
+ for how the schema defines the tables resources extend.
75
+
76
+ ## Project conventions (TS is source)
77
+
78
+ - **Write resources in TypeScript under `src/`. `harper-app/resources.js` is a
79
+ generated artifact** produced by `bun run build`. Never edit `resources.js` by
80
+ hand — change the TypeScript and rebuild. See [[harper-build-and-deploy]].
81
+ - Operational scripts that touch resources (seed, smoke, verify, ingest, crawl,
82
+ extraction) must run from compiled JavaScript or generated Harper assets, not
83
+ stale checked-in JS.
84
+ - Prefer immutable data flow: `readonly` types, pure transformations, copies, and
85
+ explicit returns. Do not mutate parameters, records, arrays, or config objects
86
+ unless an API forces it, and document the exception locally.
87
+ - Avoid `any`, broad casts, and `ts-ignore`. If an external API forces an escape
88
+ hatch, isolate it behind a typed adapter.
89
+
90
+ ## Build the real thing
91
+
92
+ If an endpoint needs a schema change, a seed path, or a deploy script change, make
93
+ that change — do not ship a client-side workaround or silently downgrade to a stub
94
+ or mock. A change is unfinished until the local build and the relevant deployed or
95
+ smoke path agree.
96
+
97
+ ## Verification
98
+
99
+ Run `bun run build`, `bun run typecheck`, and the smallest relevant test. For an
100
+ endpoint change, also hit the actual REST/GraphQL route against a local or deployed
101
+ Harper instance (the project smoke command) and confirm the response shape.
102
+
103
+ ## Sources
104
+
105
+ - [Resources overview](https://docs.harperdb.io/reference/v5/resources/overview)
106
+ - [Applications](https://docs.harperdb.io/docs/developers/applications)
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: harper-schema-graphql
3
+ description: This skill should be used when editing a Harper (HarperDB/Fabric) schema.graphql — defining or changing database tables, types, fields, relationships, or indexes that the graphqlSchema extension turns into Harper tables and API surface. Use it when adding a table, changing the data model, or when a resource/verify path depends on schema shape. Pairs with harper-resources, harper-config-yaml, and harper-component-model.
4
+ ---
5
+
6
+ # Harper schema.graphql
7
+
8
+ ## Overview
9
+
10
+ Harper defines its database tables and types from **GraphQL schema files**, loaded
11
+ by the `graphqlSchema` extension (default `*.graphql`; this project uses
12
+ `harper-app/schema.graphql`). The schema is the source of truth for the data model:
13
+ the tables it declares are what resources extend ([[harper-resources]]) and what
14
+ the REST/GraphQL surface exposes.
15
+
16
+ ## Defining tables
17
+
18
+ A table is a GraphQL type. Harper-specific directives mark a type as a persisted
19
+ table and control exposure, primary keys, and indexes. The exact directive set
20
+ depends on the Harper version in use — confirm against the live `schema.graphql`
21
+ in this project and the Harper schema docs before adding new syntax. Common shape:
22
+
23
+ ```graphql
24
+ type Dog @table {
25
+ id: ID @primaryKey
26
+ name: String @indexed
27
+ breed: String
28
+ owner: String
29
+ }
30
+ ```
31
+
32
+ - `@table` marks the type as a persisted Harper table.
33
+ - `@primaryKey` marks the primary key field.
34
+ - `@indexed` adds a secondary index for query/`search`.
35
+ - Exposure of a type as an API endpoint is controlled by the schema/`rest`
36
+ configuration — see [[harper-config-yaml]].
37
+
38
+ > Treat the directive names above as a starting point, not gospel — verify against
39
+ > the project's existing schema and current Harper docs, since directive syntax has
40
+ > evolved across versions.
41
+
42
+ ## How the schema drives the app
43
+
44
+ - The `graphqlSchema` extension creates/migrates tables from the schema on load.
45
+ - `rest: true` exposes exported tables/resources as REST endpoints; the GraphQL
46
+ surface is generated from the same schema.
47
+ - Resources that `extends tables.X` depend on `X` existing in the schema. A rename
48
+ or removal in the schema is a breaking change for every resource and verify path
49
+ that references it.
50
+
51
+ ## Project conventions
52
+
53
+ - `schema.graphql` is **source** and lives at the component root that Fabric
54
+ packages (`harper-app/schema.graphql`). Keep it there.
55
+ - A schema change is a data-model change. In the **same change**:
56
+ - Update the conceptual schema docs.
57
+ - Update any verify/smoke paths that assert joins, relationships, or row counts —
58
+ those assertions encode the data model and must track it.
59
+ - Update resources and seed/data-loader paths that reference changed tables.
60
+ - Document deploy-affecting consequences (new tables, migrations) in the Fabric
61
+ runbook. See [[harper-build-and-deploy]].
62
+
63
+ ## Verification
64
+
65
+ After a schema change, boot the app (`harper dev harper-app` or the project run
66
+ command) and confirm tables migrate cleanly and the dependent endpoints respond.
67
+ Run any verify path that asserts row counts or joins against the changed model.
68
+
69
+ ## Sources
70
+
71
+ - [Components overview](https://docs.harperdb.io/reference/v5/components/overview)
72
+ - [Applications](https://docs.harperdb.io/docs/developers/applications)
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-nestjs",
3
- "version": "2.20.0",
3
+ "version": "2.21.1",
4
4
  "description": "NestJS-specific skills (GraphQL, TypeORM) and hooks (migration write-protection)",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-nestjs",
3
- "version": "2.20.0",
3
+ "version": "2.21.1",
4
4
  "description": "NestJS-specific skills and migration write-protection hooks.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-rails",
3
- "version": "2.20.0",
3
+ "version": "2.21.1",
4
4
  "description": "Ruby on Rails-specific hooks — RuboCop linting/formatting and ast-grep scanning on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-rails",
3
- "version": "2.20.0",
3
+ "version": "2.21.1",
4
4
  "description": "Ruby on Rails-specific skills and hooks for RuboCop and ast-grep scanning on edit.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-typescript",
3
- "version": "2.20.0",
3
+ "version": "2.21.1",
4
4
  "description": "TypeScript-specific hooks — Prettier formatting, ESLint linting, and ast-grep scanning on edit",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lisa-typescript",
3
- "version": "2.20.0",
3
+ "version": "2.21.1",
4
4
  "description": "TypeScript-specific hooks for formatting, linting, and ast-grep scanning on edit.",
5
5
  "author": {
6
6
  "name": "Cody Swann"
@@ -56,7 +56,7 @@ Git Discipline:
56
56
  - When opening a PR, watch the PR. If any status checks fail, fix them. For all bot code reviews, if the feedback is valid, implement it and push the change to the PR. Then resolve the feedback. If the feedback is not valid, reply to the feedback explaining why it's not valid and then resolve the feedback. Do this in a loop until the PR is able to be merged and then merge it.
57
57
  - When merging a PR into an environment branch (dev, staging, main), watch the resultant deploy until it fully succeeds. If it fails for any reason, fix the failure and then open a new PR with the fix.
58
58
  - When referencing a PR in a response, always include the url
59
- - **Promotion PRs (environment branch → environment branch — e.g., `dev` → `staging`, `staging` → `main`) MUST be merged with a regular merge commit (`gh pr merge --merge`), NEVER squash-merged.** Squashing flattens the constituent `chore(release): X.Y.Z [skip ci]` commits into a single commit titled with the PR title, which (a) strips the `[skip ci]` markers so the release workflow re-runs and double-bumps the version on the destination branch, and (b) breaks the release workflow's promotion-detection regex (which inspects the merge-commit subject for `Merge branch 'X' into Y` or `Merge pull request #N from .../<env-branch>`). The merge commit produced by `--merge` keeps the subject clean and the per-commit `[skip ci]` markers attached where they belong. Feature PRs (anything → `dev`) use `--squash` as usual.
59
+ - **Promotion PRs (environment branch → environment branch — e.g., `dev` → `staging`, `staging` → `main`) MUST be merged with a regular merge commit (`gh pr merge --merge`), NEVER squash-merged.** Squashing flattens the constituent `chore(release): X.Y.Z [skip ci]` commits into a single commit titled with the PR title, which (a) strips the `[skip ci]` markers so the release workflow re-runs and double-bumps the version on the destination branch, and (b) breaks the release workflow's promotion-detection regex (which inspects the merge-commit subject for `Merge branch 'X' into Y` or `Merge pull request #N from .../<env-branch>`). The merge commit produced by `--merge` keeps the subject clean and the per-commit `[skip ci]` markers attached where they belong. Feature PRs (anything → `dev`) use a regular merge commit (`gh pr merge --merge`) as well.
60
60
 
61
61
  Testing Discipline:
62
62
  - Never skip or disable any tests or quality checks.
@@ -26,7 +26,7 @@ Push current branch and create or update a pull request. Optional hint: $ARGUMEN
26
26
  - If not: Create PR with comprehensive description (not a draft)
27
27
  5. **Auto-merge**: Choose merge strategy by PR type:
28
28
  - **Promotion PRs** (env → env, e.g. `dev` → `staging`): use `gh pr merge --auto --merge` (never squash). Squashing flattens the constituent `chore(release): X.Y.Z [skip ci]` commits into one commit titled with the PR title, stripping the `[skip ci]` markers and breaking the release workflow's promotion-detection regex — the destination branch then double-bumps its version. `--merge` keeps each `chore(release)` commit (and its `[skip ci]` marker) intact under a clean merge commit subject the workflow can recognize.
29
- - **Feature PRs** (anything → `dev`): use `gh pr merge --auto --squash`.
29
+ - **Feature PRs** (anything → `dev`): use `gh pr merge --auto --merge`.
30
30
 
31
31
  ### PR Description Format
32
32
 
@@ -0,0 +1,101 @@
1
+ ---
2
+ name: harper-build-and-deploy
3
+ description: This skill should be used when building, running locally, or deploying a Harper (HarperDB/Fabric) component — running harper dev/run, producing the generated resources.js and web/** from TypeScript via the project build, packaging the harper-app component, deploying to Harper Fabric, or handling deploy-time secrets. Use it for any change that affects the deployable surface or the dev loop. Pairs with harper-component-model, harper-config-yaml, and harper-resources.
4
+ ---
5
+
6
+ # Harper Build and Deploy
7
+
8
+ ## Overview
9
+
10
+ The Harper lifecycle is: **develop locally → build TypeScript into the deployable
11
+ component → run/iterate → deploy to Fabric**. This skill covers the CLI, the
12
+ project's build step, and the deploy surface so a change is provably finished, not
13
+ just compiling.
14
+
15
+ ## Local dev and run (the CLI)
16
+
17
+ The CLI binary is `harper` (v5; older installs use `harperdb`). Key commands:
18
+
19
+ | Command | What it does |
20
+ | --- | --- |
21
+ | `harper dev <path/to/app>` | Dev mode: **watches files, single-threaded, auto-restarts worker threads** on change, with console logging. The fast iteration loop. Does **not** restart the main thread. |
22
+ | `harper run <path/to/app>` | Run an app from any directory. Use when you need the main thread to (re)start; manage start/stop yourself. |
23
+ | `harper start` / `stop` / `restart` | Background (daemon) lifecycle. |
24
+ | `harper status` | Harper and clustering status. |
25
+ | `harper get_components` | List installed components. |
26
+
27
+ In this project, dev typically runs against the component dir, e.g.
28
+ `harper dev harper-app` (use the project's documented run command if it wraps this).
29
+
30
+ ## The build step (TypeScript → generated artifacts)
31
+
32
+ Harper loads JavaScript (`resources.js`) and serves static files (`web/**`). In this
33
+ project those are **generated**, not authored:
34
+
35
+ - **TypeScript under `src/` is source.** `bun run build` compiles it into
36
+ `harper-app/resources.js` and `harper-app/web/**`.
37
+ - **Never edit `resources.js` or `web/**` directly** — change the TypeScript and
38
+ rebuild. See [[harper-resources]] and [[harper-component-model]].
39
+ - **Build before symlinking, packaging, or deploying `harper-app/`.** Deploying
40
+ stale artifacts ships code that does not match `src/`.
41
+
42
+ ## The deployable surface
43
+
44
+ A deployable Harper component must keep these at the component root Fabric packages:
45
+
46
+ - `config.yaml` — active extensions ([[harper-config-yaml]])
47
+ - `schema.graphql` — data model ([[harper-schema-graphql]])
48
+ - `resources.js` — generated custom logic
49
+ - `web/**` — generated static assets
50
+
51
+ If a change touches this surface, it is not done until the local build and the
52
+ relevant deployed or smoke path agree.
53
+
54
+ ## Deploying to Fabric
55
+
56
+ Fabric is Harper's distributed deploy network. Deploy packages the component and
57
+ sends it to a target instance:
58
+
59
+ ```bash
60
+ harper deploy_component \
61
+ project=<app-name> \
62
+ package=<path-or-git-url> \
63
+ target=https://<instance>:9925 \
64
+ username=<user> \
65
+ password=<pass> \
66
+ restart=true \
67
+ replicated=true
68
+ ```
69
+
70
+ - Omitting `package` deploys the current directory.
71
+ - `restart=true` restarts threads after deploy so new code loads.
72
+ - `replicated=true` replicates the deploy across all nodes in a cluster — include it
73
+ when targeting Fabric/a cluster.
74
+ - Credentials can come from `CLI_TARGET_USERNAME` / `CLI_TARGET_PASSWORD` instead of
75
+ inline flags — prefer that so secrets never land in shell history or tracked files.
76
+
77
+ ## Secrets
78
+
79
+ Keep runtime secrets out of tracked files. Use environment variables, the
80
+ `loadEnv` extension, or an OS keychain helper. Document *where* secrets live (which
81
+ env var, which store) without recording their values.
82
+
83
+ ## Verification (required before reporting done)
84
+
85
+ 1. `bun run build` — produces fresh `resources.js` / `web/**`.
86
+ 2. `bun run typecheck`.
87
+ 3. The smallest relevant test command.
88
+ 4. For deploy-affecting changes, the project **smoke command** against the local or
89
+ deployed Harper endpoint.
90
+
91
+ If a verification command cannot run, report the exact command and the blocker —
92
+ do not claim completion. When you hit a Harper/Fabric limitation or workaround,
93
+ record the symptom, root cause, fix, and the tempting-but-broken alternatives in
94
+ the project's Fabric runbook.
95
+
96
+ ## Sources
97
+
98
+ - [Harper CLI overview](https://docs.harperdb.io/reference/v4/cli/overview)
99
+ - [Harper CLI](https://docs.harperdb.io/docs/deployments/harper-cli)
100
+ - [Plugin API](https://docs.harperdb.io/reference/v5/components/plugin-api)
101
+ - [Harper Fabric](https://www.harper.fast/)
@@ -0,0 +1,87 @@
1
+ ---
2
+ name: harper-component-model
3
+ description: This skill should be used when reasoning about how a Harper (formerly HarperDB) Fabric application is structured — what a component, application, extension, or plugin is, where code and assets belong, and how the pieces depend on each other. Use it before adding a new capability, wiring an extension, deciding where a file should live, or explaining the runtime to someone. Pairs with harper-config-yaml, harper-resources, harper-schema-graphql, and harper-build-and-deploy.
4
+ ---
5
+
6
+ # Harper Component Model
7
+
8
+ ## Overview
9
+
10
+ Harper (formerly HarperDB; the product and company now at harper.fast) is an
11
+ open-source Node.js platform that fuses **database, cache, application logic, and
12
+ messaging into a single in-memory process**. **Fabric** is Harper's distributed
13
+ deploy network: you develop locally, then deploy the same component to Fabric.
14
+
15
+ Everything you build is a **component**. Understanding the component hierarchy is
16
+ the prerequisite for every other Harper decision — config, resources, schema, and
17
+ deploy all hang off it.
18
+
19
+ ## The three tiers
20
+
21
+ Harper organizes functionality into three tiers, top to bottom:
22
+
23
+ 1. **Applications** — the user-facing product. An application *is* a type of
24
+ component. It implements business logic (REST/GraphQL endpoints, web UI,
25
+ real-time) by depending on extensions/plugins. This is what this project is.
26
+ 2. **Plugins** (v5) / **Extensions** (deprecated) — the building blocks an
27
+ application depends on. A plugin exports a single `handleApplication(scope)`
28
+ method and always runs on worker threads. The deprecated Extension API used
29
+ `start`, `handleFile`, `handleDirectory`, and `setupDirectory` instead.
30
+ `handleApplication()` cannot coexist with Extension API methods — defining
31
+ both throws. Prefer the Plugin API for any custom building block.
32
+ 3. **Core services** — the high-performance database, networking middleware, and
33
+ the component manager. You configure these; you don't reimplement them.
34
+
35
+ > An *application* is the component you ship. *Extensions/plugins* are the
36
+ > capabilities it consumes. Built-in extensions (`graphqlSchema`, `jsResource`,
37
+ > `rest`, `static`, …) are provided by core; you only *enable* them in
38
+ > `config.yaml`. See [[harper-config-yaml]].
39
+
40
+ ## Built-in extensions an application typically uses
41
+
42
+ These ship with Harper and are enabled (not installed) via `config.yaml`:
43
+
44
+ - `graphqlSchema` — define database tables/types from GraphQL schema files. See [[harper-schema-graphql]].
45
+ - `jsResource` — load custom JavaScript resources (`resources.js`). See [[harper-resources]].
46
+ - `rest` — auto-generate REST endpoints for exported resources/tables.
47
+ - `static` — serve static files (the `web/**` directory) over HTTP.
48
+ - `roles` — role-based access control from `roles.yaml`.
49
+ - `loadEnv` — load environment variables from `.env`.
50
+ - `dataLoader` — seed Harper tables from JSON/YAML.
51
+ - `fastifyRoutes` — custom Fastify route handlers.
52
+
53
+ ## Where things live in this project
54
+
55
+ This project wraps Harper's native model with a fixed layout under `harper-app/`:
56
+
57
+ | Path | Role | Source or generated |
58
+ | --- | --- | --- |
59
+ | `harper-app/config.yaml` | Component config — which extensions are active | **Source** |
60
+ | `harper-app/schema.graphql` | Table/type definitions | **Source** |
61
+ | `src/**` (TypeScript) | Resources, browser modules, shared libs, scripts | **Source** |
62
+ | `harper-app/resources.js` | Loaded by `jsResource` | **Generated** — never edit; build from TS |
63
+ | `harper-app/web/**` | Served by `static` | **Generated** — never edit; build from TS |
64
+
65
+ The TypeScript under `src/` is the source of truth. `resources.js` and `web/**`
66
+ are deploy artifacts produced by `bun run build`. Never hand-edit them — change
67
+ the matching TypeScript and rebuild. See [[harper-build-and-deploy]].
68
+
69
+ ## Decision guide
70
+
71
+ - **Adding a backend behavior?** It's almost always a *resource* (custom logic) or
72
+ a *schema* change (new table/field), enabled through `config.yaml`. Don't ship a
73
+ client-side workaround for missing backend behavior — make the Harper change.
74
+ - **Adding a reusable building block / npm-publishable capability?** That's a
75
+ *plugin* (`pluginModule`), not application code.
76
+ - **Adding static UI?** It belongs in `web/**` (generated from `src/` UI code), served
77
+ by the `static` extension.
78
+ - **Not sure if it deploys?** A deployable Harper app must keep `config.yaml`,
79
+ `schema.graphql`, `resources.js`, and `web/**` at the component root that Fabric
80
+ packages. If your change touches that surface, build before packaging.
81
+
82
+ ## Sources
83
+
84
+ - [Components overview](https://docs.harperdb.io/reference/v5/components/overview)
85
+ - [Plugin API](https://docs.harperdb.io/reference/v5/components/plugin-api)
86
+ - [Applications](https://docs.harperdb.io/docs/developers/applications)
87
+ - [Harper platform](https://www.harper.fast/)
@@ -0,0 +1,107 @@
1
+ ---
2
+ name: harper-config-yaml
3
+ description: This skill should be used when creating or editing a Harper (HarperDB/Fabric) component's config.yaml — enabling a built-in extension (graphqlSchema, jsResource, rest, static, roles, loadEnv, dataLoader, fastifyRoutes), wiring an external component, or troubleshooting why an extension is not loading. Critical: it documents the no-merge footgun where a custom config.yaml replaces Harper's default config entirely. Pairs with harper-component-model, harper-resources, and harper-schema-graphql.
4
+ ---
5
+
6
+ # Harper config.yaml
7
+
8
+ ## Overview
9
+
10
+ A Harper component is configured by a single `config.yaml` at the component root
11
+ (`harper-app/config.yaml` in this project). It declares **which extensions are
12
+ active** and which files each extension reads. Extensions are *enabled* here, not
13
+ installed — the built-ins ship with Harper.
14
+
15
+ The structure is a map of extension name to its options:
16
+
17
+ ```yaml
18
+ extensionName:
19
+ option-1: value
20
+ option-2: value
21
+ ```
22
+
23
+ ## ⚠️ The no-merge footgun
24
+
25
+ If a component has **no** `config.yaml`, Harper applies this default automatically:
26
+
27
+ ```yaml
28
+ rest: true
29
+ graphqlSchema:
30
+ files: '*.graphql'
31
+ roles:
32
+ files: 'roles.yaml'
33
+ jsResource:
34
+ files: 'resources.js'
35
+ fastifyRoutes:
36
+ files: 'routes/*.js'
37
+ urlPath: '.'
38
+ static:
39
+ files: 'web/**'
40
+ ```
41
+
42
+ The moment you add a **custom `config.yaml`, it replaces this default entirely —
43
+ Harper does not merge your file with the defaults.** If you write a `config.yaml`
44
+ that only enables `static`, you have silently turned off `rest`, `graphqlSchema`,
45
+ `jsResource`, and `roles`. This is the most common Harper config mistake.
46
+
47
+ **Rule:** when you add or edit `config.yaml`, re-declare every extension the app
48
+ actually needs — start from the default block above and add to it. Do not assume
49
+ unmentioned extensions stay on.
50
+
51
+ ## Built-in extensions
52
+
53
+ | Key | Purpose | Common options |
54
+ | --- | --- | --- |
55
+ | `rest` | Auto REST endpoints for exported resources/tables | `true`, or an object with options |
56
+ | `graphqlSchema` | Define tables/types from GraphQL files | `files: '*.graphql'` — see [[harper-schema-graphql]] |
57
+ | `jsResource` | Load custom JS resources | `files: 'resources.js'` — see [[harper-resources]] |
58
+ | `static` | Serve static files over HTTP | `files: 'web/**'`, `urlPath` |
59
+ | `roles` | Role-based access control | `files: 'roles.yaml'` |
60
+ | `loadEnv` | Load env vars from `.env` | `files` |
61
+ | `dataLoader` | Seed tables from JSON/YAML | `files` |
62
+ | `fastifyRoutes` | Custom Fastify routes | `files: 'routes/*.js'`, `urlPath` |
63
+
64
+ ## External components and custom plugins
65
+
66
+ A component you depend on from npm needs a `package:` directive matching a
67
+ `package.json` dependency:
68
+
69
+ ```yaml
70
+ '@harperdb/nextjs':
71
+ package: '@harperdb/nextjs'
72
+ files: './'
73
+ ```
74
+
75
+ A custom plugin you author is wired with `pluginModule` (point at the built JS, not
76
+ TypeScript source):
77
+
78
+ ```yaml
79
+ pluginModule: ./dist/index.js
80
+ ```
81
+
82
+ The deprecated Extension API used `extensionModule` instead. Prefer `pluginModule`.
83
+ See [[harper-component-model]] for the plugin-vs-extension distinction.
84
+
85
+ ## Project conventions
86
+
87
+ - `config.yaml` is **source** and lives at `harper-app/config.yaml`. It is part of
88
+ the deployable surface Fabric packages — keep it at the component root.
89
+ - The files `config.yaml` points to (`resources.js`, `web/**`) are **generated** by
90
+ `bun run build` from TypeScript under `src/`. Editing `config.yaml` to point at a
91
+ new file means the build must produce that file. See [[harper-build-and-deploy]].
92
+ - A `config.yaml` change is a deploy-shape change: update the matching project doc
93
+ (the Fabric runbook) in the same change, and re-run the smoke command.
94
+ - Keep secrets out of `config.yaml`. Use `loadEnv` / environment variables and
95
+ document *where* secrets live without recording their values.
96
+
97
+ ## Verification
98
+
99
+ After editing `config.yaml`, confirm the app still boots and the expected surface
100
+ is live: run `harper dev harper-app` (or the project's run command) and check that
101
+ the REST/GraphQL/static endpoints you rely on respond. A config that silently
102
+ dropped an extension often fails only at runtime, not at build time.
103
+
104
+ ## Sources
105
+
106
+ - [Components overview](https://docs.harperdb.io/reference/v5/components/overview)
107
+ - [Built-in extensions](https://docs.harperdb.io/docs/reference/components/built-in-extensions)
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: harper-resources
3
+ description: This skill should be used when writing or editing Harper (HarperDB/Fabric) resources — the classes in resources.js (built from TypeScript under src/) that expose custom data logic over REST and GraphQL. Use it when adding an endpoint, overriding table behavior, wrapping an external API, or wiring real-time subscriptions. Covers the Resource method-to-HTTP mapping and the TS-is-source build convention. Pairs with harper-schema-graphql, harper-config-yaml, and harper-build-and-deploy.
4
+ ---
5
+
6
+ # Harper Resources
7
+
8
+ ## Overview
9
+
10
+ A **Resource** is a class that provides a unified interface for a set of records or
11
+ entities. Resources are how you add custom server-side behavior to a Harper app.
12
+ They are loaded by the `jsResource` extension (default file `resources.js`) and,
13
+ when **exported**, become live REST and GraphQL endpoints.
14
+
15
+ A resource either **extends a database table** (to customize an existing table's
16
+ behavior) or **extends the base `Resource` class** (to expose data from anywhere —
17
+ an external API, a computed view, an in-memory source).
18
+
19
+ ## Method → HTTP verb mapping
20
+
21
+ The Resource API mirrors REST. Override the method matching the operation you want
22
+ to customize:
23
+
24
+ | Method | HTTP | Use |
25
+ | --- | --- | --- |
26
+ | `get(target)` | GET | Retrieve a record/collection |
27
+ | `post(data)` | POST | Create |
28
+ | `put(target, data)` | PUT | Replace |
29
+ | `patch(target, data)` | PATCH | Partial update |
30
+ | `delete(target)` | DELETE | Remove |
31
+ | `search(query)` | GET (query) | Query with conditions |
32
+ | `subscribe` / `publish` | MQTT/WebSocket | Real-time |
33
+
34
+ ## Extending a table
35
+
36
+ Add computed fields or guard logic while keeping the table's built-in behavior via
37
+ `super`:
38
+
39
+ ```javascript
40
+ export class MyTable extends tables.MyTable {
41
+ static async get(target) {
42
+ const record = await super.get(target);
43
+ return { ...record, computedField: 'value' };
44
+ }
45
+ }
46
+ ```
47
+
48
+ ## Wrapping an external source
49
+
50
+ ```javascript
51
+ export class MyExternalData extends Resource {
52
+ static async get(target) {
53
+ const response = await fetch(`https://api.example.com/${target.id}`);
54
+ return response.json();
55
+ }
56
+ }
57
+ ```
58
+
59
+ ## Making a resource an endpoint
60
+
61
+ A resource becomes an endpoint when it is **exported** and `rest: true` (and/or
62
+ `graphqlSchema`) is enabled in `config.yaml`:
63
+
64
+ ```yaml
65
+ rest: true
66
+ graphqlSchema:
67
+ files: schema.graphql
68
+ jsResource:
69
+ files: resources.js
70
+ ```
71
+
72
+ Resources can also be registered programmatically with `server.resources.set()`.
73
+ See [[harper-config-yaml]] for the extension wiring and [[harper-schema-graphql]]
74
+ for how the schema defines the tables resources extend.
75
+
76
+ ## Project conventions (TS is source)
77
+
78
+ - **Write resources in TypeScript under `src/`. `harper-app/resources.js` is a
79
+ generated artifact** produced by `bun run build`. Never edit `resources.js` by
80
+ hand — change the TypeScript and rebuild. See [[harper-build-and-deploy]].
81
+ - Operational scripts that touch resources (seed, smoke, verify, ingest, crawl,
82
+ extraction) must run from compiled JavaScript or generated Harper assets, not
83
+ stale checked-in JS.
84
+ - Prefer immutable data flow: `readonly` types, pure transformations, copies, and
85
+ explicit returns. Do not mutate parameters, records, arrays, or config objects
86
+ unless an API forces it, and document the exception locally.
87
+ - Avoid `any`, broad casts, and `ts-ignore`. If an external API forces an escape
88
+ hatch, isolate it behind a typed adapter.
89
+
90
+ ## Build the real thing
91
+
92
+ If an endpoint needs a schema change, a seed path, or a deploy script change, make
93
+ that change — do not ship a client-side workaround or silently downgrade to a stub
94
+ or mock. A change is unfinished until the local build and the relevant deployed or
95
+ smoke path agree.
96
+
97
+ ## Verification
98
+
99
+ Run `bun run build`, `bun run typecheck`, and the smallest relevant test. For an
100
+ endpoint change, also hit the actual REST/GraphQL route against a local or deployed
101
+ Harper instance (the project smoke command) and confirm the response shape.
102
+
103
+ ## Sources
104
+
105
+ - [Resources overview](https://docs.harperdb.io/reference/v5/resources/overview)
106
+ - [Applications](https://docs.harperdb.io/docs/developers/applications)
@@ -0,0 +1,72 @@
1
+ ---
2
+ name: harper-schema-graphql
3
+ description: This skill should be used when editing a Harper (HarperDB/Fabric) schema.graphql — defining or changing database tables, types, fields, relationships, or indexes that the graphqlSchema extension turns into Harper tables and API surface. Use it when adding a table, changing the data model, or when a resource/verify path depends on schema shape. Pairs with harper-resources, harper-config-yaml, and harper-component-model.
4
+ ---
5
+
6
+ # Harper schema.graphql
7
+
8
+ ## Overview
9
+
10
+ Harper defines its database tables and types from **GraphQL schema files**, loaded
11
+ by the `graphqlSchema` extension (default `*.graphql`; this project uses
12
+ `harper-app/schema.graphql`). The schema is the source of truth for the data model:
13
+ the tables it declares are what resources extend ([[harper-resources]]) and what
14
+ the REST/GraphQL surface exposes.
15
+
16
+ ## Defining tables
17
+
18
+ A table is a GraphQL type. Harper-specific directives mark a type as a persisted
19
+ table and control exposure, primary keys, and indexes. The exact directive set
20
+ depends on the Harper version in use — confirm against the live `schema.graphql`
21
+ in this project and the Harper schema docs before adding new syntax. Common shape:
22
+
23
+ ```graphql
24
+ type Dog @table {
25
+ id: ID @primaryKey
26
+ name: String @indexed
27
+ breed: String
28
+ owner: String
29
+ }
30
+ ```
31
+
32
+ - `@table` marks the type as a persisted Harper table.
33
+ - `@primaryKey` marks the primary key field.
34
+ - `@indexed` adds a secondary index for query/`search`.
35
+ - Exposure of a type as an API endpoint is controlled by the schema/`rest`
36
+ configuration — see [[harper-config-yaml]].
37
+
38
+ > Treat the directive names above as a starting point, not gospel — verify against
39
+ > the project's existing schema and current Harper docs, since directive syntax has
40
+ > evolved across versions.
41
+
42
+ ## How the schema drives the app
43
+
44
+ - The `graphqlSchema` extension creates/migrates tables from the schema on load.
45
+ - `rest: true` exposes exported tables/resources as REST endpoints; the GraphQL
46
+ surface is generated from the same schema.
47
+ - Resources that `extends tables.X` depend on `X` existing in the schema. A rename
48
+ or removal in the schema is a breaking change for every resource and verify path
49
+ that references it.
50
+
51
+ ## Project conventions
52
+
53
+ - `schema.graphql` is **source** and lives at the component root that Fabric
54
+ packages (`harper-app/schema.graphql`). Keep it there.
55
+ - A schema change is a data-model change. In the **same change**:
56
+ - Update the conceptual schema docs.
57
+ - Update any verify/smoke paths that assert joins, relationships, or row counts —
58
+ those assertions encode the data model and must track it.
59
+ - Update resources and seed/data-loader paths that reference changed tables.
60
+ - Document deploy-affecting consequences (new tables, migrations) in the Fabric
61
+ runbook. See [[harper-build-and-deploy]].
62
+
63
+ ## Verification
64
+
65
+ After a schema change, boot the app (`harper dev harper-app` or the project run
66
+ command) and confirm tables migrate cleanly and the dependent endpoints respond.
67
+ Run any verify path that asserts row counts or joins against the changed model.
68
+
69
+ ## Sources
70
+
71
+ - [Components overview](https://docs.harperdb.io/reference/v5/components/overview)
72
+ - [Applications](https://docs.harperdb.io/docs/developers/applications)