connore 0.1.0 → 0.2.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/README.md +58 -46
- package/package.json +36 -33
- package/packs/CONTRIBUTING.md +32 -0
- package/packs/base/catalog/README.md +24 -0
- package/packs/base/catalog/api.md +46 -0
- package/packs/base/catalog/auth.md +46 -0
- package/packs/base/catalog/backend.md +46 -0
- package/packs/base/catalog/blueprints.md +46 -0
- package/packs/base/catalog/components.md +46 -0
- package/packs/base/catalog/database.md +46 -0
- package/packs/base/catalog/docs.md +46 -0
- package/packs/base/catalog/github.md +46 -0
- package/packs/base/catalog/golden.md +46 -0
- package/packs/base/catalog/motion.md +46 -0
- package/packs/base/catalog/plan.md +46 -0
- package/packs/base/catalog/screenshots.md +46 -0
- package/packs/base/catalog/skills.md +46 -0
- package/packs/base/catalog/tokens.md +47 -0
- package/packs/base/planning/START.md +29 -0
- package/packs/base/planning/blueprint-template.md +46 -0
- package/packs/base/planning/plan-template.md +46 -0
- package/packs/base/rules/anti-patterns.md +46 -0
- package/packs/base/rules/code-style.md +46 -0
- package/packs/base/rules/definition-of-done.md +47 -0
- package/packs/base/rules/dependency-policy.md +46 -0
- package/packs/base/rules/error-handling.md +46 -0
- package/packs/base/rules/security-audit.md +47 -0
- package/packs/base/rules/security-baseline.md +46 -0
- package/packs/base/templates/bug-report.md +46 -0
- package/packs/base/templates/feature-spec.md +46 -0
- package/packs/base/templates/handoff.md +46 -0
- package/packs/base/templates/project-brief.md +46 -0
- package/packs/base/workflow/build-loop.md +48 -0
- package/packs/base/workflow/code-review.md +46 -0
- package/packs/base/workflow/debugging.md +47 -0
- package/packs/base/workflow/git-and-commits.md +46 -0
- package/packs/base/workflow/idea-to-spec.md +46 -0
- package/packs/base/workflow/session-handoff.md +46 -0
- package/packs/base/workflow/spec-to-plan.md +46 -0
- package/packs/knowledge/backend/api/conventions.md +21 -0
- package/packs/knowledge/backend/architecture/local-sqlite.md +20 -0
- package/packs/knowledge/backend/authentication/session-and-engine.md +24 -0
- package/packs/knowledge/backend/database/schema.md +21 -0
- package/packs/knowledge/components/custom/ambient-background.md +26 -0
- package/packs/knowledge/components/custom/ambient-background.tsx +12 -0
- package/packs/knowledge/components/custom/corner-frame.md +26 -0
- package/packs/knowledge/components/custom/corner-frame.tsx +48 -0
- package/packs/knowledge/components/custom/cta-button.md +26 -0
- package/packs/knowledge/components/custom/cta-button.tsx +10 -0
- package/packs/knowledge/components/custom/page-transition.md +26 -0
- package/packs/knowledge/components/custom/page-transition.tsx +10 -0
- package/packs/knowledge/components/custom/smooth-scroll.md +26 -0
- package/packs/knowledge/components/custom/smooth-scroll.tsx +32 -0
- package/packs/knowledge/components/motion-effects/README.md +30 -0
- package/packs/knowledge/components/ui-primitives/LICENSE +21 -0
- package/packs/knowledge/components/ui-primitives/README.md +22 -0
- package/packs/knowledge/components/ui-primitives/badge.md +26 -0
- package/packs/knowledge/components/ui-primitives/badge.tsx +48 -0
- package/packs/knowledge/components/ui-primitives/button.md +27 -0
- package/packs/knowledge/components/ui-primitives/button.tsx +66 -0
- package/packs/knowledge/components/ui-primitives/card.md +26 -0
- package/packs/knowledge/components/ui-primitives/card.tsx +102 -0
- package/packs/knowledge/components/ui-primitives/checkbox.md +26 -0
- package/packs/knowledge/components/ui-primitives/checkbox.tsx +32 -0
- package/packs/knowledge/components/ui-primitives/dialog.md +26 -0
- package/packs/knowledge/components/ui-primitives/dialog.tsx +168 -0
- package/packs/knowledge/components/ui-primitives/dropdown-menu.md +26 -0
- package/packs/knowledge/components/ui-primitives/dropdown-menu.tsx +268 -0
- package/packs/knowledge/components/ui-primitives/input.md +27 -0
- package/packs/knowledge/components/ui-primitives/input.tsx +18 -0
- package/packs/knowledge/components/ui-primitives/label.md +26 -0
- package/packs/knowledge/components/ui-primitives/label.tsx +23 -0
- package/packs/knowledge/components/ui-primitives/progress.md +26 -0
- package/packs/knowledge/components/ui-primitives/progress.tsx +30 -0
- package/packs/knowledge/components/ui-primitives/scroll-area.md +26 -0
- package/packs/knowledge/components/ui-primitives/scroll-area.tsx +54 -0
- package/packs/knowledge/components/ui-primitives/select.md +26 -0
- package/packs/knowledge/components/ui-primitives/select.tsx +191 -0
- package/packs/knowledge/components/ui-primitives/separator.md +26 -0
- package/packs/knowledge/components/ui-primitives/separator.tsx +27 -0
- package/packs/knowledge/components/ui-primitives/sonner.md +26 -0
- package/packs/knowledge/components/ui-primitives/sonner.tsx +49 -0
- package/packs/knowledge/components/ui-primitives/switch.md +26 -0
- package/packs/knowledge/components/ui-primitives/switch.tsx +32 -0
- package/packs/knowledge/components/ui-primitives/tabs.md +26 -0
- package/packs/knowledge/components/ui-primitives/tabs.tsx +89 -0
- package/packs/knowledge/components/ui-primitives/textarea.md +26 -0
- package/packs/knowledge/components/ui-primitives/textarea.tsx +17 -0
- package/packs/knowledge/components/ui-primitives/tooltip.md +26 -0
- package/packs/knowledge/components/ui-primitives/tooltip.tsx +56 -0
- package/packs/knowledge/design/aesthetics/app-shell.md +41 -0
- package/packs/knowledge/design/aesthetics/code-neutral.md +40 -0
- package/packs/knowledge/design/aesthetics/match.md +46 -0
- package/packs/knowledge/design/aesthetics/ruled-outline.md +40 -0
- package/packs/knowledge/design/aesthetics/solid-accent.md +43 -0
- package/packs/knowledge/design/animations/motion.md +40 -0
- package/packs/knowledge/design/project-style.md +50 -0
- package/packs/knowledge/design/references/benefit-card-grid.md +27 -0
- package/packs/knowledge/design/references/benefit-card-grid.png +0 -0
- package/packs/knowledge/design/references/cta-centered.md +27 -0
- package/packs/knowledge/design/references/cta-centered.png +0 -0
- package/packs/knowledge/design/references/cta-split-media.md +27 -0
- package/packs/knowledge/design/references/cta-split-media.png +0 -0
- package/packs/knowledge/design/references/dashboard-overview.md +31 -0
- package/packs/knowledge/design/references/dashboard-overview.png +0 -0
- package/packs/knowledge/design/references/faq-split-accordion.md +27 -0
- package/packs/knowledge/design/references/faq-split-accordion.png +0 -0
- package/packs/knowledge/design/references/feature-split-checklist.md +27 -0
- package/packs/knowledge/design/references/feature-split-checklist.png +0 -0
- package/packs/knowledge/design/references/footer-four-column.md +27 -0
- package/packs/knowledge/design/references/footer-four-column.png +0 -0
- package/packs/knowledge/design/references/footer-two-column.md +27 -0
- package/packs/knowledge/design/references/footer-two-column.png +0 -0
- package/packs/knowledge/design/references/hero-accent-curtain.md +27 -0
- package/packs/knowledge/design/references/hero-accent-curtain.png +0 -0
- package/packs/knowledge/design/references/hero-split-media.md +27 -0
- package/packs/knowledge/design/references/hero-split-media.png +0 -0
- package/packs/knowledge/design/references/logo-cloud-grid.md +27 -0
- package/packs/knowledge/design/references/logo-cloud-grid.png +0 -0
- package/packs/knowledge/design/references/logo-row-ruled.md +27 -0
- package/packs/knowledge/design/references/logo-row-ruled.png +0 -0
- package/packs/knowledge/design/references/pricing-three-card.md +27 -0
- package/packs/knowledge/design/references/pricing-three-card.png +0 -0
- package/packs/knowledge/design/references/steps-ruled-grid.md +27 -0
- package/packs/knowledge/design/references/steps-ruled-grid.png +0 -0
- package/packs/knowledge/design/rules.md +35 -0
- package/packs/knowledge/design/token-structure.md +46 -0
- package/packs/knowledge/design/tokens.md +55 -0
- package/packs/knowledge/frontend/README.md +50 -0
- package/packs/knowledge/frontend/SOURCES.md +40 -0
- package/packs/knowledge/frontend/accessibility/focus-and-dialogs.md +47 -0
- package/packs/knowledge/frontend/accessibility/semantics-and-keyboard.md +45 -0
- package/packs/knowledge/frontend/accessibility/wcag-targets.md +43 -0
- package/packs/knowledge/frontend/architecture/agent-context-files.md +43 -0
- package/packs/knowledge/frontend/architecture/app-foundations.md +43 -0
- package/packs/knowledge/frontend/architecture/error-handling.md +47 -0
- package/packs/knowledge/frontend/architecture/feature-modules.md +49 -0
- package/packs/knowledge/frontend/architecture/import-boundaries.md +44 -0
- package/packs/knowledge/frontend/architecture/naming.md +43 -0
- package/packs/knowledge/frontend/architecture/project-structure.md +48 -0
- package/packs/knowledge/frontend/architecture/routing.md +45 -0
- package/packs/knowledge/frontend/architecture/security.md +44 -0
- package/packs/knowledge/frontend/architecture/typescript.md +44 -0
- package/packs/knowledge/frontend/components/composition.md +45 -0
- package/packs/knowledge/frontend/components/data-display.md +47 -0
- package/packs/knowledge/frontend/components/library-choice.md +45 -0
- package/packs/knowledge/frontend/components/variants.md +44 -0
- package/packs/knowledge/frontend/forms/form-architecture.md +49 -0
- package/packs/knowledge/frontend/forms/multi-step.md +43 -0
- package/packs/knowledge/frontend/forms/validation.md +47 -0
- package/packs/knowledge/frontend/layout/responsive.md +41 -0
- package/packs/knowledge/frontend/page-blueprints/app-shell.md +16 -0
- package/packs/knowledge/frontend/page-blueprints/faq-footer.md +22 -0
- package/packs/knowledge/frontend/page-blueprints/feature-grid.md +22 -0
- package/packs/knowledge/frontend/page-blueprints/pricing.md +16 -0
- package/packs/knowledge/frontend/page-blueprints/saas-hero.md +24 -0
- package/packs/knowledge/frontend/patterns/dark-marketing.md +18 -0
- package/packs/knowledge/frontend/patterns/status-pill.md +19 -0
- package/packs/knowledge/frontend/performance/code-splitting.md +47 -0
- package/packs/knowledge/frontend/performance/images-and-vitals.md +44 -0
- package/packs/knowledge/frontend/performance/rendering.md +40 -0
- package/packs/knowledge/frontend/rendering/server-and-client.md +50 -0
- package/packs/knowledge/frontend/state/api-layer.md +49 -0
- package/packs/knowledge/frontend/state/async-ui-states.md +43 -0
- package/packs/knowledge/frontend/state/client-store.md +46 -0
- package/packs/knowledge/frontend/state/server-cache.md +42 -0
- package/packs/knowledge/frontend/state/state-categories.md +50 -0
- package/packs/knowledge/frontend/testing/component-tests.md +44 -0
- package/packs/knowledge/frontend/testing/strategy.md +46 -0
- package/packs/knowledge/inbox/README.md +14 -0
- package/packs/knowledge/workflows/authentication.md +18 -0
- package/packs/knowledge/workflows/crud.md +20 -0
- package/packs/knowledge/workflows/dashboard.md +22 -0
- package/packs/nextjs-fullstack/backend/api-conventions.md +48 -0
- package/packs/nextjs-fullstack/backend/auth-and-roles.md +46 -0
- package/packs/nextjs-fullstack/backend/background-jobs.md +46 -0
- package/packs/nextjs-fullstack/backend/caching.md +46 -0
- package/packs/nextjs-fullstack/backend/database.md +46 -0
- package/packs/nextjs-fullstack/backend/file-uploads.md +46 -0
- package/packs/nextjs-fullstack/backend/logging.md +46 -0
- package/packs/nextjs-fullstack/backend/migrations.md +46 -0
- package/packs/nextjs-fullstack/backend/rate-limiting.md +46 -0
- package/packs/nextjs-fullstack/backend/secrets-and-env.md +46 -0
- package/packs/nextjs-fullstack/backend/validation.md +46 -0
- package/packs/nextjs-fullstack/blueprints/ai-app.md +84 -0
- package/packs/nextjs-fullstack/blueprints/internal-tool.md +83 -0
- package/packs/nextjs-fullstack/blueprints/saas-app.md +83 -0
- package/packs/nextjs-fullstack/build-deploy/ci.md +45 -0
- package/packs/nextjs-fullstack/build-deploy/deploy.md +46 -0
- package/packs/nextjs-fullstack/build-deploy/monitoring.md +45 -0
- package/packs/nextjs-fullstack/build-deploy/performance.md +46 -0
- package/packs/nextjs-fullstack/build-deploy/project-structure.md +45 -0
- package/packs/nextjs-fullstack/build-deploy/release-checklist.md +47 -0
- package/packs/nextjs-fullstack/build-deploy/testing.md +46 -0
- package/packs/nextjs-fullstack/evals/README.md +46 -0
- package/packs/nextjs-fullstack/examples/golden-app/README.md +45 -0
- package/packs/nextjs-fullstack/frontend/accessibility.md +46 -0
- package/packs/nextjs-fullstack/frontend/components.md +46 -0
- package/packs/nextjs-fullstack/frontend/copy.md +46 -0
- package/packs/nextjs-fullstack/frontend/data-fetching.md +46 -0
- package/packs/nextjs-fullstack/frontend/forms.md +46 -0
- package/packs/nextjs-fullstack/frontend/layout.md +46 -0
- package/packs/nextjs-fullstack/frontend/loading-empty-error.md +46 -0
- package/packs/nextjs-fullstack/frontend/motion.md +46 -0
- package/packs/nextjs-fullstack/frontend/responsive.md +46 -0
- package/packs/nextjs-fullstack/frontend/seo.md +47 -0
- package/packs/nextjs-fullstack/frontend/tables.md +46 -0
- package/packs/nextjs-fullstack/frontend/tokens.md +45 -0
- package/packs/nextjs-fullstack/integrations/analytics.md +46 -0
- package/packs/nextjs-fullstack/integrations/email.md +46 -0
- package/packs/nextjs-fullstack/integrations/llm-apis.md +46 -0
- package/packs/nextjs-fullstack/integrations/oauth.md +46 -0
- package/packs/nextjs-fullstack/integrations/object-storage.md +46 -0
- package/packs/nextjs-fullstack/integrations/payments.md +46 -0
- package/packs/nextjs-fullstack/integrations/queues.md +46 -0
- package/packs/nextjs-fullstack/integrations/search.md +46 -0
- package/packs/nextjs-fullstack/integrations/webhooks.md +46 -0
- package/packs/nextjs-fullstack/playbooks/add-ai-feature.md +46 -0
- package/packs/nextjs-fullstack/playbooks/add-auth.md +46 -0
- package/packs/nextjs-fullstack/playbooks/add-billing.md +50 -0
- package/packs/nextjs-fullstack/playbooks/add-crud.md +46 -0
- package/packs/nextjs-fullstack/playbooks/add-email.md +46 -0
- package/packs/nextjs-fullstack/playbooks/add-file-upload.md +46 -0
- package/packs/nextjs-fullstack/playbooks/add-webhook.md +46 -0
- package/packs/nextjs-fullstack/playbooks/ship-to-prod.md +47 -0
- package/plugins/connore/.claude-plugin/plugin.json +10 -0
- package/plugins/connore/hooks/hooks.json +16 -0
- package/plugins/connore/skills/connore-backend/SKILL.md +32 -0
- package/plugins/connore/skills/connore-handoff/SKILL.md +15 -0
- package/plugins/connore/skills/connore-routes/SKILL.md +16 -0
- package/plugins/connore/skills/connore-validate/SKILL.md +15 -0
- package/src/cli.js +377 -90
- package/src/commands/add.js +61 -57
- package/src/commands/catalog.js +21 -0
- package/src/commands/doctor.js +44 -0
- package/src/commands/edit.js +88 -0
- package/src/commands/graph.js +20 -0
- package/src/commands/handoff.js +45 -0
- package/src/commands/hook.js +67 -50
- package/src/commands/init.js +74 -55
- package/src/commands/learn.js +39 -0
- package/src/commands/lint.js +13 -0
- package/src/commands/list.js +10 -10
- package/src/commands/log.js +49 -0
- package/src/commands/memory.js +14 -0
- package/src/commands/packs.js +21 -0
- package/src/commands/plan.js +41 -0
- package/src/commands/reindex.js +8 -8
- package/src/commands/review.js +31 -0
- package/src/commands/routes.js +13 -0
- package/src/commands/search.js +26 -0
- package/src/commands/stats.js +35 -0
- package/src/commands/undo.js +7 -0
- package/src/commands/update.js +20 -14
- package/src/lib/catalog.js +32 -0
- package/src/lib/config.js +67 -0
- package/src/lib/fs-safe.js +36 -11
- package/src/lib/gitlog.js +75 -0
- package/src/lib/graph.js +96 -0
- package/src/lib/ignore.js +47 -0
- package/src/lib/index.js +88 -57
- package/src/lib/lessons.js +173 -0
- package/src/lib/lint.js +185 -0
- package/src/lib/lock.js +47 -0
- package/src/lib/memory.js +49 -0
- package/src/lib/mutate.js +26 -0
- package/src/lib/packs.js +25 -0
- package/src/lib/paths.js +6 -2
- package/src/lib/plan.js +156 -0
- package/src/lib/pointers.js +3 -3
- package/src/lib/prompts.js +66 -0
- package/src/lib/provider.js +27 -0
- package/src/lib/report.js +41 -17
- package/src/lib/routes.js +59 -0
- package/src/lib/run.js +116 -0
- package/src/lib/search.js +64 -0
- package/src/lib/secrets.js +25 -0
- package/src/lib/signals.js +55 -0
- package/src/lib/sync.js +20 -12
- package/src/lib/tokens.js +8 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Authentication workflow
|
|
3
|
+
type: workflow
|
|
4
|
+
tags: [auth, login, signup]
|
|
5
|
+
updated: 2026-11-19
|
|
6
|
+
description: Signup, login, and logout as the Context101 routes implement them.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Authentication
|
|
11
|
+
|
|
12
|
+
1. `POST /api/auth/signup` with `{ name, email, password }`. On success, set `context101_session` and return `{ user }`.
|
|
13
|
+
2. `POST /api/auth/login` with `{ email, password }`. Same cookie and `{ user }`. Failure is 400 and a single error string. Do not say which field was wrong.
|
|
14
|
+
3. `GET /api/auth/session` reads the cookie and returns the public user or an empty session.
|
|
15
|
+
4. `POST /api/auth/logout` clears the cookie and deletes the session row.
|
|
16
|
+
5. Agents calling the engine do not use this cookie. They send the engine bearer token. See `backend/authentication/session-and-engine.md`.
|
|
17
|
+
|
|
18
|
+
Passwords stay in the hash columns. Logs and API responses do not include them.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Project CRUD
|
|
3
|
+
type: workflow
|
|
4
|
+
tags: [crud, projects, sqlite]
|
|
5
|
+
updated: 2026-11-19
|
|
6
|
+
description: Create and list projects using the SQLite shape in this pack.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Project CRUD
|
|
11
|
+
|
|
12
|
+
A project is one `projects` row plus ordered child rows.
|
|
13
|
+
|
|
14
|
+
1. Create: insert `projects` with a new id, `owner_id` from the session, `created_at` and `updated_at` as unix ms, and the brief fields (`goal`, `audience`, `tone`, `vibe`, `primary_color`, `font`). Empty text is `""`, not null, except `workspace_path` and `token`.
|
|
15
|
+
2. Add knowledge, rules, skills, or components as child rows with `position` starting at 0. `reference_images.data_url` holds the image. Keep a `note` on each image.
|
|
16
|
+
3. Update: change the row and set `updated_at`. Do not rewrite child ids unless the item was replaced.
|
|
17
|
+
4. Delete: delete the project row. Cascade removes children. Record the id in `removed_projects` if a mirror must not recreate it.
|
|
18
|
+
5. List: `GET /api/projects` returns `{ projects }` and `Cache-Control: no-store`.
|
|
19
|
+
|
|
20
|
+
Rules in the `rules` table use `kind` for always vs never. Do not store both in one undifferentiated blob.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Dashboard
|
|
3
|
+
type: workflow
|
|
4
|
+
tags: [dashboard, sessions, mcp]
|
|
5
|
+
updated: 2026-12-06
|
|
6
|
+
description: What a workspace overview should read, separate from the dashboard reference visual.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Dashboard
|
|
11
|
+
|
|
12
|
+
Visual layout: `frontend/page-blueprints/app-shell.md` and `design/references/dashboard-overview.md`.
|
|
13
|
+
|
|
14
|
+
Data, from Context101 tables:
|
|
15
|
+
|
|
16
|
+
- Projects for the signed-in `owner_id`.
|
|
17
|
+
- `agent_sessions` for recent tool, file, prompt count, edit count, and summary.
|
|
18
|
+
- `mcp_events` for recent tool and resource calls (`at`, `kind`, `name`, `project`).
|
|
19
|
+
|
|
20
|
+
Show an empty state when `agent_sessions` is empty, the way the dashboard reference states plainly that no activity has been recorded yet. Do not invent activity.
|
|
21
|
+
|
|
22
|
+
The warning banner in the reference, announcing that indexing and reviews are paused, has no column in this schema. Leave it out unless a real flag exists. TODO if you need a paused state.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: API conventions
|
|
3
|
+
type: doc
|
|
4
|
+
tags: [api, http]
|
|
5
|
+
stack: nextjs
|
|
6
|
+
status: reviewed
|
|
7
|
+
verified: 2026-11-22
|
|
8
|
+
description: Load before adding or changing a route handler.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# API conventions
|
|
12
|
+
|
|
13
|
+
## Use when
|
|
14
|
+
You are adding a Route Handler under `app/`.
|
|
15
|
+
|
|
16
|
+
## Default
|
|
17
|
+
`route.js` returns JSON. Validate the body on the server. Use 400, 401, 403, 404, and 500 only.
|
|
18
|
+
|
|
19
|
+
## Use instead when
|
|
20
|
+
The response is a file download. Stream the bytes and set `Content-Type`. Still validate the query on the server.
|
|
21
|
+
|
|
22
|
+
## Never
|
|
23
|
+
Never return a stack trace, SQL text, or a service key in the response body.
|
|
24
|
+
|
|
25
|
+
## Why
|
|
26
|
+
The client can send any JSON. Status codes are the contract the caller branches on.
|
|
27
|
+
|
|
28
|
+
## Steps
|
|
29
|
+
1. Put the handler in `app/<path>/route.js` and export the verb: `GET`, `POST`, `PATCH`, or `DELETE`.
|
|
30
|
+
2. Parse the body with `request.json()`. On bad JSON, return 400 `{ "error": "Invalid JSON." }`.
|
|
31
|
+
3. Validate every field on the server. Return 400 `{ "error": "<field> <reason>" }`.
|
|
32
|
+
4. Return 401 when the session is missing, 403 when the role is wrong, 404 when the row is missing.
|
|
33
|
+
5. Return 200 with the resource, or 201 with the created resource and its id.
|
|
34
|
+
6. Log the server error. Return 500 `{ "error": "Something went wrong." }`.
|
|
35
|
+
|
|
36
|
+
## Done when
|
|
37
|
+
A missing field returns 400, a missing session returns 401, and the body has no stack.
|
|
38
|
+
|
|
39
|
+
## Example
|
|
40
|
+
`POST /api/orders` with `{ "quantity": 0 }` returns 400 `{ "error": "quantity must be at least 1" }`.
|
|
41
|
+
|
|
42
|
+
## Common mistakes
|
|
43
|
+
Trusting an id from the client to decide ownership. Returning 200 with `{ "ok": false }`.
|
|
44
|
+
|
|
45
|
+
## Sources
|
|
46
|
+
Next.js Route Handlers docs, read 2026-11-22. No vendor code.
|
|
47
|
+
|
|
48
|
+
License: MIT
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Auth and roles
|
|
3
|
+
type: doc
|
|
4
|
+
tags: [auth, roles]
|
|
5
|
+
stack: nextjs
|
|
6
|
+
status: reviewed
|
|
7
|
+
verified: 2026-12-07
|
|
8
|
+
description: Load before a private route, a session, or a role check.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Auth and roles
|
|
12
|
+
|
|
13
|
+
## Use when
|
|
14
|
+
A page or handler should only work for some people.
|
|
15
|
+
|
|
16
|
+
## Default
|
|
17
|
+
The server checks the session on every private request. The role is read from the database, not from a hidden form field.
|
|
18
|
+
|
|
19
|
+
## Use instead when
|
|
20
|
+
A fully public page. Do not add a session check that always passes.
|
|
21
|
+
|
|
22
|
+
## Never
|
|
23
|
+
Never hide a button and call that authorization. Never trust a role string the client sent.
|
|
24
|
+
|
|
25
|
+
## Why
|
|
26
|
+
The UI check is skipped by anyone who calls the handler directly.
|
|
27
|
+
|
|
28
|
+
## Steps
|
|
29
|
+
1. Reject a missing session with 401.
|
|
30
|
+
2. Load the membership for this user and this organization.
|
|
31
|
+
3. Reject the wrong role with 403.
|
|
32
|
+
4. Apply the same check to the write, not only the page.
|
|
33
|
+
|
|
34
|
+
## Done when
|
|
35
|
+
A signed-out request and a wrong-role request both fail on the server.
|
|
36
|
+
|
|
37
|
+
## Example
|
|
38
|
+
A member can read the project. Only an owner can delete it, and the delete handler checks the role again.
|
|
39
|
+
|
|
40
|
+
## Common mistakes
|
|
41
|
+
Checking the role in the component and not in the action. Storing the role in local storage as the source of truth.
|
|
42
|
+
|
|
43
|
+
## Sources
|
|
44
|
+
Connore pack.
|
|
45
|
+
|
|
46
|
+
License: MIT
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Jobs and webhooks
|
|
3
|
+
type: doc
|
|
4
|
+
tags: [jobs, webhooks]
|
|
5
|
+
stack: nextjs
|
|
6
|
+
status: reviewed
|
|
7
|
+
verified: 2026-12-07
|
|
8
|
+
description: Load before work that must not run inside the request.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Jobs and webhooks
|
|
12
|
+
|
|
13
|
+
## Use when
|
|
14
|
+
A task is slow, must retry, or is triggered by another service.
|
|
15
|
+
|
|
16
|
+
## Default
|
|
17
|
+
The request writes a row and enqueues the work. The worker is idempotent. A webhook verifies a signature before it reads the body as trusted.
|
|
18
|
+
|
|
19
|
+
## Use instead when
|
|
20
|
+
A read that finishes in the request. Do not add a queue to look scalable.
|
|
21
|
+
|
|
22
|
+
## Never
|
|
23
|
+
Never do the slow call inside the request and hope the platform waits. Never trust a webhook body before the signature check. Never let a retry apply a payment twice.
|
|
24
|
+
|
|
25
|
+
## Why
|
|
26
|
+
The request times out, the retry runs, and the user is billed or emailed twice.
|
|
27
|
+
|
|
28
|
+
## Steps
|
|
29
|
+
1. Write the intent row first, with a status.
|
|
30
|
+
2. Enqueue the job with that row id.
|
|
31
|
+
3. In the worker, exit if the row is already done.
|
|
32
|
+
4. For a webhook, verify the signature, then dedupe on the event id.
|
|
33
|
+
|
|
34
|
+
## Done when
|
|
35
|
+
Running the worker twice leaves one result. A bad signature writes nothing.
|
|
36
|
+
|
|
37
|
+
## Example
|
|
38
|
+
A second delivery of invoice.paid finds the event id and returns 200 without granting access again.
|
|
39
|
+
|
|
40
|
+
## Common mistakes
|
|
41
|
+
Parsing the webhook JSON first. Sending the email in the request handler.
|
|
42
|
+
|
|
43
|
+
## Sources
|
|
44
|
+
Connore pack.
|
|
45
|
+
|
|
46
|
+
License: MIT
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Caching
|
|
3
|
+
type: doc
|
|
4
|
+
tags: [cache]
|
|
5
|
+
stack: nextjs
|
|
6
|
+
status: reviewed
|
|
7
|
+
verified: 2026-12-07
|
|
8
|
+
description: Load before caching a response or a query.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Caching
|
|
12
|
+
|
|
13
|
+
## Use when
|
|
14
|
+
The same read is slow and the data can be a few seconds old.
|
|
15
|
+
|
|
16
|
+
## Default
|
|
17
|
+
Cache a read that is scoped to the tenant, and name the key so a write can drop it.
|
|
18
|
+
|
|
19
|
+
## Use instead when
|
|
20
|
+
The data just changed and the next read must show it. Do not cache that path yet.
|
|
21
|
+
|
|
22
|
+
## Never
|
|
23
|
+
Never cache a response that includes another user's data under a shared key. Never cache a secret.
|
|
24
|
+
|
|
25
|
+
## Why
|
|
26
|
+
A shared key is a leak with a timeout.
|
|
27
|
+
|
|
28
|
+
## Steps
|
|
29
|
+
1. Include the organization id in the key.
|
|
30
|
+
2. Set a short lifetime.
|
|
31
|
+
3. Drop the key when the row is written.
|
|
32
|
+
4. Do not cache an error.
|
|
33
|
+
|
|
34
|
+
## Done when
|
|
35
|
+
A write is visible on the next read, and org A cannot hit org B's key.
|
|
36
|
+
|
|
37
|
+
## Example
|
|
38
|
+
The project list key includes the org id and is dropped on create.
|
|
39
|
+
|
|
40
|
+
## Common mistakes
|
|
41
|
+
A key of only the url. Caching the signed-in user document in a public cache.
|
|
42
|
+
|
|
43
|
+
## Sources
|
|
44
|
+
Connore pack. Original wording. No vendor text copied.
|
|
45
|
+
|
|
46
|
+
License: MIT
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Database design
|
|
3
|
+
type: doc
|
|
4
|
+
tags: [database, tenancy]
|
|
5
|
+
stack: nextjs
|
|
6
|
+
status: reviewed
|
|
7
|
+
verified: 2026-12-07
|
|
8
|
+
description: Load before a table, a query, or a tenant boundary.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Database design
|
|
12
|
+
|
|
13
|
+
## Use when
|
|
14
|
+
A new table, or a query that reads another user's data.
|
|
15
|
+
|
|
16
|
+
## Default
|
|
17
|
+
Every tenant-owned row carries the organization id. Every query filters on it. Migrations are forward-only files, run from empty in CI.
|
|
18
|
+
|
|
19
|
+
## Use instead when
|
|
20
|
+
A single-user local tool with one operator. Still name the owner column so a second user does not require a rewrite.
|
|
21
|
+
|
|
22
|
+
## Never
|
|
23
|
+
Never take an id from the client and skip the organization filter. Never edit a migration that has already run in production.
|
|
24
|
+
|
|
25
|
+
## Why
|
|
26
|
+
A missing tenant filter is a data leak, and it looks like a normal query.
|
|
27
|
+
|
|
28
|
+
## Steps
|
|
29
|
+
1. Put organization_id on each tenant table and index it with the columns you filter.
|
|
30
|
+
2. Resolve the organization from the session, then query.
|
|
31
|
+
3. Add a migration file. Do not change the last one after it has shipped.
|
|
32
|
+
4. Add the index the new filter needs in the same change.
|
|
33
|
+
|
|
34
|
+
## Done when
|
|
35
|
+
A user in org A cannot read a row from org B by guessing the id.
|
|
36
|
+
|
|
37
|
+
## Example
|
|
38
|
+
GET /invoices/123 for a member of another org returns 404, not the invoice.
|
|
39
|
+
|
|
40
|
+
## Common mistakes
|
|
41
|
+
A shared table with no owner column. A query that filters only by the id in the URL.
|
|
42
|
+
|
|
43
|
+
## Sources
|
|
44
|
+
Connore pack.
|
|
45
|
+
|
|
46
|
+
License: MIT
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: File uploads
|
|
3
|
+
type: doc
|
|
4
|
+
tags: [files]
|
|
5
|
+
stack: nextjs
|
|
6
|
+
status: reviewed
|
|
7
|
+
verified: 2026-12-07
|
|
8
|
+
description: Load when a handler accepts multipart data.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# File uploads
|
|
12
|
+
|
|
13
|
+
## Use when
|
|
14
|
+
A route receives a file.
|
|
15
|
+
|
|
16
|
+
## Default
|
|
17
|
+
Limit size, check the type on the server, and store via the object storage rule.
|
|
18
|
+
|
|
19
|
+
## Use instead when
|
|
20
|
+
No file is involved. Do not add a parser.
|
|
21
|
+
|
|
22
|
+
## Never
|
|
23
|
+
Never write the upload into the source tree. Never use the client filename as a path.
|
|
24
|
+
|
|
25
|
+
## Why
|
|
26
|
+
Path traversal and stored scripts start here.
|
|
27
|
+
|
|
28
|
+
## Steps
|
|
29
|
+
1. Reject oversize bodies.
|
|
30
|
+
2. Allow only the agreed types.
|
|
31
|
+
3. Generate the storage key.
|
|
32
|
+
4. Save the owner and the key on the row.
|
|
33
|
+
|
|
34
|
+
## Done when
|
|
35
|
+
A too-large file fails, and the filename cannot escape the storage prefix.
|
|
36
|
+
|
|
37
|
+
## Example
|
|
38
|
+
image.png is stored under a generated key.
|
|
39
|
+
|
|
40
|
+
## Common mistakes
|
|
41
|
+
Saving to ./public/<filename>. Trusting the content-type header alone.
|
|
42
|
+
|
|
43
|
+
## Sources
|
|
44
|
+
Connore pack. Original wording. No vendor text copied.
|
|
45
|
+
|
|
46
|
+
License: MIT
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Logging
|
|
3
|
+
type: doc
|
|
4
|
+
tags: [logs]
|
|
5
|
+
stack: nextjs
|
|
6
|
+
status: reviewed
|
|
7
|
+
verified: 2026-12-07
|
|
8
|
+
description: Load before adding a log line.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Logging
|
|
12
|
+
|
|
13
|
+
## Use when
|
|
14
|
+
A failure or a write should be traceable.
|
|
15
|
+
|
|
16
|
+
## Default
|
|
17
|
+
Log the route, the status, a request id, and the ids of the rows you touched.
|
|
18
|
+
|
|
19
|
+
## Use instead when
|
|
20
|
+
A success path that already returns the resource. Do not log the body to be sure.
|
|
21
|
+
|
|
22
|
+
## Never
|
|
23
|
+
Never log secrets, cookies, or the raw body.
|
|
24
|
+
|
|
25
|
+
## Why
|
|
26
|
+
Logs become a second copy of private data.
|
|
27
|
+
|
|
28
|
+
## Steps
|
|
29
|
+
1. Add a request id at the boundary.
|
|
30
|
+
2. Log handled errors with the id.
|
|
31
|
+
3. Keep the line free of credentials.
|
|
32
|
+
4. Use the same shape in the worker.
|
|
33
|
+
|
|
34
|
+
## Done when
|
|
35
|
+
A failed write can be found by the request id, and the line has no secret.
|
|
36
|
+
|
|
37
|
+
## Example
|
|
38
|
+
500 on refund logs the order id and the code.
|
|
39
|
+
|
|
40
|
+
## Common mistakes
|
|
41
|
+
console.log of the session cookie. A log of the full prompt.
|
|
42
|
+
|
|
43
|
+
## Sources
|
|
44
|
+
Connore pack. Original wording. No vendor text copied.
|
|
45
|
+
|
|
46
|
+
License: MIT
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Migrations
|
|
3
|
+
type: doc
|
|
4
|
+
tags: [database, migrations]
|
|
5
|
+
stack: nextjs
|
|
6
|
+
status: reviewed
|
|
7
|
+
verified: 2026-12-07
|
|
8
|
+
description: Load before changing the database shape.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Migrations
|
|
12
|
+
|
|
13
|
+
## Use when
|
|
14
|
+
A table or column must change.
|
|
15
|
+
|
|
16
|
+
## Default
|
|
17
|
+
Add a new migration file. Apply it from an empty database in the check suite. Do not edit a migration that has already shipped.
|
|
18
|
+
|
|
19
|
+
## Use instead when
|
|
20
|
+
A change you can express in the application without a schema change.
|
|
21
|
+
|
|
22
|
+
## Never
|
|
23
|
+
Never edit production by hand and forget the file. Never change a shipped migration to fix a typo.
|
|
24
|
+
|
|
25
|
+
## Why
|
|
26
|
+
The next environment will not match production.
|
|
27
|
+
|
|
28
|
+
## Steps
|
|
29
|
+
1. Add one file with the change.
|
|
30
|
+
2. Run it on empty.
|
|
31
|
+
3. Run it on a copy of the current shape.
|
|
32
|
+
4. Ship the file with the code that needs it.
|
|
33
|
+
|
|
34
|
+
## Done when
|
|
35
|
+
A new database ends on the same shape as production.
|
|
36
|
+
|
|
37
|
+
## Example
|
|
38
|
+
Adding organization_id is a new file, and old rows get a backfill in that file.
|
|
39
|
+
|
|
40
|
+
## Common mistakes
|
|
41
|
+
Editing the first migration after release. A manual ALTER with no file.
|
|
42
|
+
|
|
43
|
+
## Sources
|
|
44
|
+
Connore pack. Original wording. No vendor text copied.
|
|
45
|
+
|
|
46
|
+
License: MIT
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Rate limiting
|
|
3
|
+
type: doc
|
|
4
|
+
tags: [abuse, limits]
|
|
5
|
+
stack: nextjs
|
|
6
|
+
status: reviewed
|
|
7
|
+
verified: 2026-12-07
|
|
8
|
+
description: Load before a public or expensive route.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Rate limiting
|
|
12
|
+
|
|
13
|
+
## Use when
|
|
14
|
+
A route can be called in a loop: sign-in, a model call, or a password reset.
|
|
15
|
+
|
|
16
|
+
## Default
|
|
17
|
+
Limit by the caller and the route. Return 429 when the limit is hit. Keep the limit out of the success path's logic.
|
|
18
|
+
|
|
19
|
+
## Use instead when
|
|
20
|
+
An internal job you control. Limit the worker's concurrency instead.
|
|
21
|
+
|
|
22
|
+
## Never
|
|
23
|
+
Never limit only in the UI. Never use the limit as a substitute for authorization.
|
|
24
|
+
|
|
25
|
+
## Why
|
|
26
|
+
A missing limit is how a key or a mailbox gets burned.
|
|
27
|
+
|
|
28
|
+
## Steps
|
|
29
|
+
1. Name the route and the budget with the user.
|
|
30
|
+
2. Count by user id when signed in, otherwise by address.
|
|
31
|
+
3. Return 429 with a short retry hint.
|
|
32
|
+
4. Do not log the credential that was attempted.
|
|
33
|
+
|
|
34
|
+
## Done when
|
|
35
|
+
The extra call after the budget returns 429, and a normal user is unaffected.
|
|
36
|
+
|
|
37
|
+
## Example
|
|
38
|
+
Sign-in allows a small burst, then 429.
|
|
39
|
+
|
|
40
|
+
## Common mistakes
|
|
41
|
+
A global limit that locks the whole product. Limiting only the button.
|
|
42
|
+
|
|
43
|
+
## Sources
|
|
44
|
+
Connore pack. Original wording. No vendor text copied.
|
|
45
|
+
|
|
46
|
+
License: MIT
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Secrets and environment
|
|
3
|
+
type: doc
|
|
4
|
+
tags: [secrets, env]
|
|
5
|
+
stack: nextjs
|
|
6
|
+
status: reviewed
|
|
7
|
+
verified: 2026-12-07
|
|
8
|
+
description: Load before adding a key, a url, or an example env file.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Secrets and environment
|
|
12
|
+
|
|
13
|
+
## Use when
|
|
14
|
+
The app needs a credential or a per-environment setting.
|
|
15
|
+
|
|
16
|
+
## Default
|
|
17
|
+
Read it from the environment on the server. Commit an example file with obvious placeholders only.
|
|
18
|
+
|
|
19
|
+
## Use instead when
|
|
20
|
+
A public value such as the site name. It can live in the client.
|
|
21
|
+
|
|
22
|
+
## Never
|
|
23
|
+
Never commit a real key. Never prefix a secret so the client bundle includes it.
|
|
24
|
+
|
|
25
|
+
## Why
|
|
26
|
+
The example file is how keys leak, one placeholder that was a real value.
|
|
27
|
+
|
|
28
|
+
## Steps
|
|
29
|
+
1. Add the name to the example file with a placeholder like YOUR_KEY_HERE.
|
|
30
|
+
2. Read it on the server.
|
|
31
|
+
3. Fail the boot or the request with a generic error when it is missing.
|
|
32
|
+
4. Keep production values only on the host.
|
|
33
|
+
|
|
34
|
+
## Done when
|
|
35
|
+
The repo has the name and not the value. The client bundle does not contain it.
|
|
36
|
+
|
|
37
|
+
## Example
|
|
38
|
+
PAYMENT_SECRET is read in the webhook route and the example file says YOUR_KEY_HERE.
|
|
39
|
+
|
|
40
|
+
## Common mistakes
|
|
41
|
+
A real key in .env that was committed. A secret in a NEXT_PUBLIC variable.
|
|
42
|
+
|
|
43
|
+
## Sources
|
|
44
|
+
Connore pack. Original wording. No vendor text copied.
|
|
45
|
+
|
|
46
|
+
License: MIT
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Validation and errors
|
|
3
|
+
type: doc
|
|
4
|
+
tags: [validation, errors]
|
|
5
|
+
stack: nextjs
|
|
6
|
+
status: reviewed
|
|
7
|
+
verified: 2026-12-07
|
|
8
|
+
description: Load before trusting a request body or showing a failure.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Validation and errors
|
|
12
|
+
|
|
13
|
+
## Use when
|
|
14
|
+
A handler accepts input, or a failure must be shown to the caller.
|
|
15
|
+
|
|
16
|
+
## Default
|
|
17
|
+
Validate type, range, and length on the server. Return one error object the client can show. Log the real cause on the server only.
|
|
18
|
+
|
|
19
|
+
## Use instead when
|
|
20
|
+
A generated file download with no user input. Still check the query id belongs to the caller.
|
|
21
|
+
|
|
22
|
+
## Never
|
|
23
|
+
Never return a stack, a query, or a secret in the response. Never accept a string where a number is required and coerce it quietly.
|
|
24
|
+
|
|
25
|
+
## Why
|
|
26
|
+
The client can send any JSON. The response is also what an attacker reads.
|
|
27
|
+
|
|
28
|
+
## Steps
|
|
29
|
+
1. Parse JSON. Bad JSON is 400.
|
|
30
|
+
2. Check each field. Name the field in the error.
|
|
31
|
+
3. Map a known failure to 400, 401, 403, or 404.
|
|
32
|
+
4. On an unexpected failure, log it and return a generic 500.
|
|
33
|
+
|
|
34
|
+
## Done when
|
|
35
|
+
A bad field names itself, and the response body has no stack.
|
|
36
|
+
|
|
37
|
+
## Example
|
|
38
|
+
quantity 0 returns 400 with the field name. A database timeout returns 500 and a generic sentence.
|
|
39
|
+
|
|
40
|
+
## Common mistakes
|
|
41
|
+
200 with an ok false flag. Returning the driver error to the browser.
|
|
42
|
+
|
|
43
|
+
## Sources
|
|
44
|
+
Connore pack. Pairs with the API conventions entry.
|
|
45
|
+
|
|
46
|
+
License: MIT
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: AI-powered app
|
|
3
|
+
type: blueprint
|
|
4
|
+
tags: [blueprint, ai]
|
|
5
|
+
stack: nextjs
|
|
6
|
+
status: reviewed
|
|
7
|
+
verified: 2026-11-22
|
|
8
|
+
description: A product whose core action is a model call with an eval and a cost cap.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# AI-powered app
|
|
12
|
+
|
|
13
|
+
## Summary
|
|
14
|
+
The model does one job the user can name. The call runs on the server. A small eval set decides if a prompt change is safe. The user sets the cost cap before you add a second feature.
|
|
15
|
+
|
|
16
|
+
## Capabilities
|
|
17
|
+
Must: one server-side model call, the prompt stored in the repo, an eval set, auth, a per-user cost cap.
|
|
18
|
+
Should: retrieval over the user's own records, traces, a human review queue for bad outputs.
|
|
19
|
+
Later: a second model, fine-tuning, an agent that writes without a person in the loop.
|
|
20
|
+
|
|
21
|
+
## Reference architecture
|
|
22
|
+
The browser sends the task, not the raw provider key. A Route Handler checks the session, checks the cap, loads the prompt file, and calls the provider. The eval script runs the same prompt against fixed inputs. Outputs and token counts are rows in Postgres. Provider keys stay in env.
|
|
23
|
+
|
|
24
|
+
## Data model starter
|
|
25
|
+
users (id, email). prompts (id, name, body, version). runs (id, user_id, prompt_id, input, output, tokens, cost_cents, created_at). eval_cases (id, prompt_id, input, expected). The cap is a column on users or organizations: monthly_cents.
|
|
26
|
+
|
|
27
|
+
## Integrations
|
|
28
|
+
One model provider, optional object storage for uploads, optional email when a run needs a person. Name the provider only after the user confirms it.
|
|
29
|
+
|
|
30
|
+
## Phases
|
|
31
|
+
|
|
32
|
+
### Phase 0: Scope and decisions
|
|
33
|
+
- Confirm the one decision the model is allowed to make
|
|
34
|
+
- Confirm what data the model may see
|
|
35
|
+
- Confirm the monthly spend cap
|
|
36
|
+
Acceptance: Those three answers are written in Current state.
|
|
37
|
+
Gate: The user approved the scope in writing. No provider key in the repo.
|
|
38
|
+
Entries: .ctx/START.md, base/workflow/idea-to-spec.md
|
|
39
|
+
|
|
40
|
+
### Phase 1: Foundation
|
|
41
|
+
- Create the repo, env sample, CI, database, and sign-in
|
|
42
|
+
- Add a server route that calls the provider with the key from env
|
|
43
|
+
Acceptance: The browser never receives the provider key.
|
|
44
|
+
Gate: CI is green. A missing session returns 401.
|
|
45
|
+
Entries: nextjs-fullstack/backend/api-conventions.md, nextjs-fullstack/backend/secrets-and-env.md
|
|
46
|
+
|
|
47
|
+
### Phase 2: One eval-backed feature
|
|
48
|
+
- Store the prompt in the repo and version it
|
|
49
|
+
- Add at least 10 eval cases and a script that prints pass and fail counts
|
|
50
|
+
Acceptance: The eval script exits 0 on the current prompt.
|
|
51
|
+
Gate: A prompt edit that drops a case is not merged.
|
|
52
|
+
Entries: base/workflow/build-loop.md, nextjs-fullstack/playbooks/add-ai-feature.md
|
|
53
|
+
|
|
54
|
+
### Phase 3: Data and cost
|
|
55
|
+
- Save each run with token count and cost
|
|
56
|
+
- Refuse the call when the user is over the monthly cap
|
|
57
|
+
Acceptance: The 11th call over the cap returns 402 and does not call the provider.
|
|
58
|
+
Gate: Cost is computed on the server from the provider usage field.
|
|
59
|
+
Entries: nextjs-fullstack/backend/database.md, nextjs-fullstack/integrations/llm-apis.md
|
|
60
|
+
|
|
61
|
+
### Phase 4: Hardening
|
|
62
|
+
- Redact secrets from stored inputs
|
|
63
|
+
- Add traces and a way to mark a bad output
|
|
64
|
+
Acceptance: A logged run does not contain an API key or a raw session cookie.
|
|
65
|
+
Gate: doctor and the eval script exit 0.
|
|
66
|
+
Entries: base/rules/security-baseline.md
|
|
67
|
+
|
|
68
|
+
### Phase 5: Launch
|
|
69
|
+
- Add the review step the user asked for and the rollback for a bad prompt
|
|
70
|
+
Acceptance: You can ship the previous prompt version without a deploy of new code.
|
|
71
|
+
Gate: The user approved the production provider and the cap.
|
|
72
|
+
Entries: nextjs-fullstack/playbooks/ship-to-prod.md
|
|
73
|
+
|
|
74
|
+
## Gate
|
|
75
|
+
Do not add a second model call while the eval for the first one is failing.
|
|
76
|
+
|
|
77
|
+
## Pitfalls
|
|
78
|
+
Calling the provider from the client. Changing the prompt with no eval. Saving raw user text that contains secrets. Promising the model is correct because one example looked good.
|
|
79
|
+
|
|
80
|
+
## Confirm with user
|
|
81
|
+
What the model may decide, what data it may see, the monthly cap, and which provider. Do not invent accuracy numbers or a price.
|
|
82
|
+
|
|
83
|
+
## Entries to load
|
|
84
|
+
Each phase lists its files. Open those rows only.
|