connore 0.1.1 → 0.2.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.
- package/README.md +13 -8
- package/bin/ctxkit.js +5 -5
- package/package.json +2 -1
- package/packs/base/planning/START.md +29 -28
- package/packs/base/planning/blueprint-template.md +46 -46
- package/packs/base/planning/plan-template.md +46 -45
- package/packs/base/rules/anti-patterns.md +19 -16
- package/packs/base/rules/code-style.md +19 -16
- package/packs/base/rules/dependency-policy.md +19 -16
- package/packs/base/rules/error-handling.md +19 -16
- package/packs/base/rules/security-audit.md +47 -0
- package/packs/base/rules/security-baseline.md +19 -16
- package/packs/base/templates/bug-report.md +19 -16
- package/packs/base/templates/feature-spec.md +19 -16
- package/packs/base/templates/handoff.md +19 -16
- package/packs/base/templates/project-brief.md +19 -16
- package/packs/base/workflow/code-review.md +19 -16
- package/packs/base/workflow/debugging.md +18 -14
- package/packs/base/workflow/git-and-commits.md +19 -16
- package/packs/base/workflow/idea-to-spec.md +19 -16
- package/packs/base/workflow/session-handoff.md +19 -16
- package/packs/base/workflow/spec-to-plan.md +19 -16
- 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/auth-and-roles.md +19 -16
- package/packs/nextjs-fullstack/backend/background-jobs.md +19 -16
- package/packs/nextjs-fullstack/backend/caching.md +17 -14
- package/packs/nextjs-fullstack/backend/database.md +19 -16
- package/packs/nextjs-fullstack/backend/file-uploads.md +19 -16
- package/packs/nextjs-fullstack/backend/logging.md +17 -14
- package/packs/nextjs-fullstack/backend/migrations.md +17 -14
- package/packs/nextjs-fullstack/backend/rate-limiting.md +19 -16
- package/packs/nextjs-fullstack/backend/secrets-and-env.md +19 -16
- package/packs/nextjs-fullstack/backend/validation.md +19 -16
- package/packs/nextjs-fullstack/blueprints/ai-app.md +1 -1
- package/packs/nextjs-fullstack/blueprints/internal-tool.md +1 -1
- package/packs/nextjs-fullstack/blueprints/saas-app.md +1 -1
- package/packs/nextjs-fullstack/build-deploy/ci.md +18 -16
- package/packs/nextjs-fullstack/build-deploy/deploy.md +19 -16
- package/packs/nextjs-fullstack/build-deploy/monitoring.md +16 -14
- package/packs/nextjs-fullstack/build-deploy/performance.md +17 -14
- package/packs/nextjs-fullstack/build-deploy/project-structure.md +18 -16
- package/packs/nextjs-fullstack/build-deploy/release-checklist.md +20 -16
- package/packs/nextjs-fullstack/build-deploy/testing.md +19 -16
- package/packs/nextjs-fullstack/evals/README.md +18 -15
- package/packs/nextjs-fullstack/examples/golden-app/README.md +18 -16
- package/packs/nextjs-fullstack/frontend/accessibility.md +17 -14
- package/packs/nextjs-fullstack/frontend/components.md +19 -16
- 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 +17 -14
- package/packs/nextjs-fullstack/frontend/layout.md +19 -16
- package/packs/nextjs-fullstack/frontend/loading-empty-error.md +19 -16
- package/packs/nextjs-fullstack/frontend/motion.md +17 -14
- package/packs/nextjs-fullstack/frontend/responsive.md +19 -16
- package/packs/nextjs-fullstack/frontend/seo.md +20 -16
- package/packs/nextjs-fullstack/frontend/tables.md +17 -14
- package/packs/nextjs-fullstack/frontend/tokens.md +18 -16
- package/packs/nextjs-fullstack/integrations/analytics.md +17 -14
- package/packs/nextjs-fullstack/integrations/email.md +17 -14
- package/packs/nextjs-fullstack/integrations/llm-apis.md +19 -16
- package/packs/nextjs-fullstack/integrations/oauth.md +19 -16
- package/packs/nextjs-fullstack/integrations/object-storage.md +19 -16
- package/packs/nextjs-fullstack/integrations/payments.md +17 -14
- package/packs/nextjs-fullstack/integrations/queues.md +17 -14
- package/packs/nextjs-fullstack/integrations/search.md +19 -16
- package/packs/nextjs-fullstack/integrations/webhooks.md +17 -14
- package/packs/nextjs-fullstack/playbooks/add-ai-feature.md +19 -16
- package/packs/nextjs-fullstack/playbooks/add-auth.md +19 -16
- package/packs/nextjs-fullstack/playbooks/add-crud.md +19 -16
- package/packs/nextjs-fullstack/playbooks/add-email.md +19 -16
- package/packs/nextjs-fullstack/playbooks/add-file-upload.md +19 -16
- package/packs/nextjs-fullstack/playbooks/add-webhook.md +19 -16
- package/packs/nextjs-fullstack/playbooks/ship-to-prod.md +20 -16
- 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 +110 -21
- package/src/commands/doctor.js +2 -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/init.js +8 -3
- package/src/commands/lint.js +13 -5
- package/src/commands/log.js +49 -25
- package/src/commands/packs.js +21 -0
- package/src/commands/routes.js +13 -0
- package/src/commands/search.js +7 -2
- package/src/commands/update.js +5 -1
- package/src/lib/config.js +67 -64
- package/src/lib/graph.js +96 -0
- package/src/lib/index.js +88 -72
- package/src/lib/lessons.js +173 -173
- package/src/lib/lint.js +185 -67
- package/src/lib/mutate.js +26 -24
- package/src/lib/packs.js +25 -10
- package/src/lib/paths.js +1 -1
- package/src/lib/prompts.js +66 -0
- package/src/lib/report.js +41 -33
- package/src/lib/routes.js +59 -0
- package/src/lib/run.js +116 -73
- package/src/lib/search.js +24 -0
- package/src/lib/tokens.js +8 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Client store
|
|
3
|
+
type: guide
|
|
4
|
+
tags: [state, store, selectors, client-state]
|
|
5
|
+
updated: 2026-12-06
|
|
6
|
+
description: Load when a dedicated client store holds application state.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Client store
|
|
11
|
+
|
|
12
|
+
Library-specific. Only load this if Zustand is already a dependency. The rules in `frontend/state/state-categories.md` decide whether global state is the right answer at all.
|
|
13
|
+
|
|
14
|
+
## API surface
|
|
15
|
+
|
|
16
|
+
- `create` makes a store bound to React through a hook.
|
|
17
|
+
- `createStore` makes a standalone store with no React dependency, for logic that must run outside components.
|
|
18
|
+
- `useStore` reads from a standalone store inside a component.
|
|
19
|
+
- `createWithEqualityFn` and `useStoreWithEqualityFn` take a custom equality function.
|
|
20
|
+
- `shallow` compares objects and arrays one level deep.
|
|
21
|
+
- `useShallow` wraps a selector so a derived object keeps a stable reference.
|
|
22
|
+
|
|
23
|
+
## Rules
|
|
24
|
+
|
|
25
|
+
- Select the narrowest slice a component needs. Subscribing to the whole store re-renders on every change.
|
|
26
|
+
- When a selector returns a new object or array, wrap it in `useShallow`, or the new reference re-renders on every update.
|
|
27
|
+
- Keep server data out of the store. See `frontend/state/server-cache.md`.
|
|
28
|
+
- Split unrelated concerns into separate stores instead of nesting them in one.
|
|
29
|
+
|
|
30
|
+
## Middleware
|
|
31
|
+
|
|
32
|
+
- `persist` saves and rehydrates state through `localStorage` or a custom storage engine. Never persist tokens or anything from a vault.
|
|
33
|
+
- `devtools` connects a store to Redux DevTools. Keep it out of production builds.
|
|
34
|
+
|
|
35
|
+
## Common mistakes
|
|
36
|
+
|
|
37
|
+
- Returning an inline object from a selector with no shallow comparison, which causes a render loop in effect-heavy trees.
|
|
38
|
+
- Persisting the entire store, including transient flags, so a refresh restores an open modal.
|
|
39
|
+
|
|
40
|
+
## Version note
|
|
41
|
+
|
|
42
|
+
The source is a reference index with no version recorded. Check the installed major version before relying on these names.
|
|
43
|
+
|
|
44
|
+
## Source
|
|
45
|
+
|
|
46
|
+
Zustand reference index. Links were not fetched. See `frontend/SOURCES.md`.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Server cache and mutations
|
|
3
|
+
type: guide
|
|
4
|
+
tags: [server-state, caching, mutations, tanstack-query]
|
|
5
|
+
updated: 2026-12-06
|
|
6
|
+
description: Load when fetching, caching, mutating or invalidating server data.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Server cache and mutations
|
|
11
|
+
|
|
12
|
+
Library-specific: this describes TanStack Query. SWR, RTK Query and urql solve the same problem with different names, so do not quote these APIs in a project that uses one of those.
|
|
13
|
+
|
|
14
|
+
## Queries
|
|
15
|
+
|
|
16
|
+
- Give every query a key that fully describes what it fetches, including the parameters. Two different results must never share a key.
|
|
17
|
+
- Treat the cache as shared state. Any component asking for the same key gets the same data.
|
|
18
|
+
- Prefetch with `queryClient.prefetchQuery` when the next page is predictable, such as on hover or after the current step. This removes the fetch wait on navigation.
|
|
19
|
+
|
|
20
|
+
## Mutations
|
|
21
|
+
|
|
22
|
+
- A mutation changes server data; it does not own UI state.
|
|
23
|
+
- After it succeeds, invalidate the keys whose data is now wrong. Invalidate the narrowest key that covers the change, not the whole cache.
|
|
24
|
+
- Decide deliberately whether to invalidate, write the response into the cache, or do both. Writing avoids a refetch but can leave stale related data.
|
|
25
|
+
|
|
26
|
+
## When to avoid
|
|
27
|
+
|
|
28
|
+
Do not use a server cache library for values that never come from the server. Theme, a selected tab and an open dialog belong in component or application state.
|
|
29
|
+
|
|
30
|
+
## Common mistakes
|
|
31
|
+
|
|
32
|
+
- Copying fetched data into a global store, so there are two sources of truth and one goes stale.
|
|
33
|
+
- Keys built from an object whose property order varies, which silently creates two cache entries.
|
|
34
|
+
- Invalidating everything after each mutation, which turns one write into a wave of refetches.
|
|
35
|
+
|
|
36
|
+
## Version note
|
|
37
|
+
|
|
38
|
+
The raw source names `@tanstack/react-query` and the `prefetchQuery` method but records no version. Confirm the installed major version before relying on any other API name.
|
|
39
|
+
|
|
40
|
+
## Source
|
|
41
|
+
|
|
42
|
+
Bulletproof React `docs/state-management.md` and `docs/performance.md`, MIT. Summarised. See `frontend/SOURCES.md`.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: State categories
|
|
3
|
+
type: rule
|
|
4
|
+
tags: [state, react, architecture, server-state]
|
|
5
|
+
updated: 2026-12-06
|
|
6
|
+
description: Load before adding state, to pick the right kind and the right place.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# State categories
|
|
11
|
+
|
|
12
|
+
Four kinds of state. Keep them separate. Most state bugs come from storing one kind in another kind's container.
|
|
13
|
+
|
|
14
|
+
## Component state
|
|
15
|
+
|
|
16
|
+
Lives in one component and its children. Start here for every piece of state.
|
|
17
|
+
|
|
18
|
+
- `useState` for independent values.
|
|
19
|
+
- `useReducer` when one action has to update several values together.
|
|
20
|
+
|
|
21
|
+
Lift it only when another part of the tree needs it.
|
|
22
|
+
|
|
23
|
+
## Application state
|
|
24
|
+
|
|
25
|
+
Global UI concerns: theme, open modal, notification queue. Keep it as close to its consumers as possible.
|
|
26
|
+
|
|
27
|
+
Options: React context with hooks, Zustand, Jotai, Redux Toolkit, MobX, XState. Context suits low-frequency data such as theme or user. For frequently changing values, use a store with selectors.
|
|
28
|
+
|
|
29
|
+
## Server cache state
|
|
30
|
+
|
|
31
|
+
Data fetched from an API and kept on the client for reuse. This is a cache, not application state. Use a library built for it: TanStack Query, SWR, RTK Query, Apollo or urql.
|
|
32
|
+
|
|
33
|
+
## Form state
|
|
34
|
+
|
|
35
|
+
Field values, dirty and touched flags, validation errors, submission status. Use a form library rather than a global store. See `frontend/forms/form-architecture.md`.
|
|
36
|
+
|
|
37
|
+
## Always
|
|
38
|
+
|
|
39
|
+
1. Keep server state out of the global store.
|
|
40
|
+
2. Keep transient UI state out of the server cache.
|
|
41
|
+
3. Default to local state and promote only on evidence.
|
|
42
|
+
|
|
43
|
+
## Never
|
|
44
|
+
|
|
45
|
+
1. Never put every value in one global store, which re-renders half the tree on each change.
|
|
46
|
+
2. Never globalise state at the start "in case" it is needed.
|
|
47
|
+
|
|
48
|
+
## Source
|
|
49
|
+
|
|
50
|
+
Bulletproof React `docs/state-management.md`, MIT. Summarised. See `frontend/SOURCES.md`.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Component tests
|
|
3
|
+
type: rule
|
|
4
|
+
tags: [testing, components, queries, accessibility]
|
|
5
|
+
updated: 2026-12-06
|
|
6
|
+
description: Load when writing a test that renders a component.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Component tests
|
|
11
|
+
|
|
12
|
+
Test the component the way a user meets it. Assert on what renders, not on how it got there.
|
|
13
|
+
|
|
14
|
+
## Always
|
|
15
|
+
|
|
16
|
+
1. Query the way a user would find the element: by role and accessible name first, then label text, then visible text. Reach for a test id only when nothing else identifies it.
|
|
17
|
+
2. Drive the component with real interactions, typing and clicking, rather than calling handlers directly.
|
|
18
|
+
3. Await anything asynchronous. A missing await produces a test that passes locally and fails in CI.
|
|
19
|
+
4. Assert one behaviour per test, with a name that states it.
|
|
20
|
+
5. Cover the error and empty paths, not only the happy one. See `frontend/state/async-ui-states.md`.
|
|
21
|
+
|
|
22
|
+
## Never
|
|
23
|
+
|
|
24
|
+
1. Never assert on internal state, a hook's return value, or render counts. Refactoring the state library should not break a single test.
|
|
25
|
+
2. Never snapshot a whole component as the only assertion. A diff that nobody reads is not a test.
|
|
26
|
+
3. Never share mutable state between tests. Each test sets up and tears down its own.
|
|
27
|
+
|
|
28
|
+
## A useful side effect
|
|
29
|
+
|
|
30
|
+
Role-based queries only work when the markup is accessible. A test that cannot find a button by its role is telling you the control is a `div`, or the icon button has no name. Treat that failure as a real finding, not as a reason to switch to a test id. See `frontend/accessibility/semantics-and-keyboard.md`.
|
|
31
|
+
|
|
32
|
+
## Setup
|
|
33
|
+
|
|
34
|
+
Render through a helper that wraps the component in the providers it needs: router, query client, theme. Repeating that in every test guarantees they drift apart.
|
|
35
|
+
|
|
36
|
+
## Common mistakes
|
|
37
|
+
|
|
38
|
+
- Testing a presentational component through the container that fetches for it, which makes the test about the request.
|
|
39
|
+
- A query that matches two elements, passing until a second button appears.
|
|
40
|
+
- Asserting a loading spinner disappeared without asserting what replaced it.
|
|
41
|
+
|
|
42
|
+
## Source
|
|
43
|
+
|
|
44
|
+
Bulletproof React `docs/testing.md`, MIT, and the Testing Library philosophy of testing user-visible output. Summarised. See `frontend/SOURCES.md`.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Testing strategy
|
|
3
|
+
type: guide
|
|
4
|
+
tags: [testing, integration, e2e, tooling]
|
|
5
|
+
updated: 2026-12-06
|
|
6
|
+
description: Load before writing tests, to pick the right kind for what you are checking.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Testing strategy
|
|
11
|
+
|
|
12
|
+
Confidence comes mostly from integration tests. Unit tests check that a part works; they cannot tell you the parts are wired together correctly.
|
|
13
|
+
|
|
14
|
+
## Three kinds
|
|
15
|
+
|
|
16
|
+
**Unit tests** cover the smallest pieces in isolation: shared components, utilities, and genuinely complex logic inside one component. Fast to write, fast to run, narrow in what they prove.
|
|
17
|
+
|
|
18
|
+
**Integration tests** cover several parts working together, and this is where most effort belongs. They catch the failures that matter: the request fires with the wrong argument, the form submits but the list never refreshes.
|
|
19
|
+
|
|
20
|
+
**End-to-end tests** drive the whole application, frontend and backend, the way a user would. Expensive, so keep them to the few flows that must never break: sign-in, checkout, the core action.
|
|
21
|
+
|
|
22
|
+
## Tooling
|
|
23
|
+
|
|
24
|
+
- Vitest as the runner.
|
|
25
|
+
- Testing Library for rendering and queries.
|
|
26
|
+
- Playwright for end-to-end, in headed mode locally and headless in CI.
|
|
27
|
+
- Mock Service Worker to intercept HTTP and return defined responses.
|
|
28
|
+
|
|
29
|
+
## Mocking the API
|
|
30
|
+
|
|
31
|
+
Intercepting requests at the network layer beats mocking `fetch`. The application makes real HTTP calls and the handlers answer them, so the code under test is the code that ships. It also unblocks frontend work when an endpoint does not exist yet, without hard-coding response data in components.
|
|
32
|
+
|
|
33
|
+
## What not to test
|
|
34
|
+
|
|
35
|
+
- Implementation details: internal state values, whether a particular hook ran, how many renders happened.
|
|
36
|
+
- Third-party library behaviour. Test your use of it, not it.
|
|
37
|
+
- Styling, beyond what the user can perceive, such as a disabled control.
|
|
38
|
+
|
|
39
|
+
## Common mistakes
|
|
40
|
+
|
|
41
|
+
- A wall of unit tests on a fully passing suite that still ships a broken feature, because nothing tested the join.
|
|
42
|
+
- End-to-end tests for every edge case, until the suite is too slow to run and gets skipped.
|
|
43
|
+
|
|
44
|
+
## Source
|
|
45
|
+
|
|
46
|
+
Bulletproof React `docs/testing.md`, MIT. Summarised. See `frontend/SOURCES.md`.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Inbox
|
|
3
|
+
type: process
|
|
4
|
+
tags: [inbox]
|
|
5
|
+
updated: 2026-11-19
|
|
6
|
+
description: Drop raw screenshots, components, and notes here, then ask an agent to process the inbox.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# Inbox
|
|
11
|
+
|
|
12
|
+
Drop files here. Leave them untouched until you say `Process the .ctx/inbox`.
|
|
13
|
+
|
|
14
|
+
The agent follows `PROCESS.md`: it classifies each file, writes a short markdown note, files the result in the matching folder, and updates `INDEX.md`.
|
|
@@ -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.
|
|
@@ -1,43 +1,46 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: Auth
|
|
2
|
+
title: Auth and roles
|
|
3
3
|
type: doc
|
|
4
|
-
tags: [
|
|
4
|
+
tags: [auth, roles]
|
|
5
5
|
stack: nextjs
|
|
6
|
-
status:
|
|
7
|
-
verified:
|
|
8
|
-
description:
|
|
6
|
+
status: reviewed
|
|
7
|
+
verified: 2026-12-07
|
|
8
|
+
description: Load before a private route, a session, or a role check.
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
# Auth
|
|
11
|
+
# Auth and roles
|
|
12
12
|
|
|
13
13
|
## Use when
|
|
14
|
-
|
|
14
|
+
A page or handler should only work for some people.
|
|
15
15
|
|
|
16
16
|
## Default
|
|
17
|
-
|
|
17
|
+
The server checks the session on every private request. The role is read from the database, not from a hidden form field.
|
|
18
18
|
|
|
19
19
|
## Use instead when
|
|
20
|
-
|
|
20
|
+
A fully public page. Do not add a session check that always passes.
|
|
21
21
|
|
|
22
22
|
## Never
|
|
23
|
-
|
|
23
|
+
Never hide a button and call that authorization. Never trust a role string the client sent.
|
|
24
24
|
|
|
25
25
|
## Why
|
|
26
|
-
|
|
26
|
+
The UI check is skipped by anyone who calls the handler directly.
|
|
27
27
|
|
|
28
28
|
## Steps
|
|
29
|
-
1.
|
|
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.
|
|
30
33
|
|
|
31
34
|
## Done when
|
|
32
|
-
|
|
35
|
+
A signed-out request and a wrong-role request both fail on the server.
|
|
33
36
|
|
|
34
37
|
## Example
|
|
35
|
-
|
|
38
|
+
A member can read the project. Only an owner can delete it, and the delete handler checks the role again.
|
|
36
39
|
|
|
37
40
|
## Common mistakes
|
|
38
|
-
|
|
41
|
+
Checking the role in the component and not in the action. Storing the role in local storage as the source of truth.
|
|
39
42
|
|
|
40
43
|
## Sources
|
|
41
|
-
|
|
44
|
+
Connore pack.
|
|
42
45
|
|
|
43
46
|
License: MIT
|
|
@@ -1,43 +1,46 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
2
|
+
title: Jobs and webhooks
|
|
3
3
|
type: doc
|
|
4
|
-
tags: [
|
|
4
|
+
tags: [jobs, webhooks]
|
|
5
5
|
stack: nextjs
|
|
6
|
-
status:
|
|
7
|
-
verified:
|
|
8
|
-
description:
|
|
6
|
+
status: reviewed
|
|
7
|
+
verified: 2026-12-07
|
|
8
|
+
description: Load before work that must not run inside the request.
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
#
|
|
11
|
+
# Jobs and webhooks
|
|
12
12
|
|
|
13
13
|
## Use when
|
|
14
|
-
|
|
14
|
+
A task is slow, must retry, or is triggered by another service.
|
|
15
15
|
|
|
16
16
|
## Default
|
|
17
|
-
|
|
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
18
|
|
|
19
19
|
## Use instead when
|
|
20
|
-
|
|
20
|
+
A read that finishes in the request. Do not add a queue to look scalable.
|
|
21
21
|
|
|
22
22
|
## Never
|
|
23
|
-
|
|
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
24
|
|
|
25
25
|
## Why
|
|
26
|
-
|
|
26
|
+
The request times out, the retry runs, and the user is billed or emailed twice.
|
|
27
27
|
|
|
28
28
|
## Steps
|
|
29
|
-
1.
|
|
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.
|
|
30
33
|
|
|
31
34
|
## Done when
|
|
32
|
-
|
|
35
|
+
Running the worker twice leaves one result. A bad signature writes nothing.
|
|
33
36
|
|
|
34
37
|
## Example
|
|
35
|
-
|
|
38
|
+
A second delivery of invoice.paid finds the event id and returns 200 without granting access again.
|
|
36
39
|
|
|
37
40
|
## Common mistakes
|
|
38
|
-
|
|
41
|
+
Parsing the webhook JSON first. Sending the email in the request handler.
|
|
39
42
|
|
|
40
43
|
## Sources
|
|
41
|
-
|
|
44
|
+
Connore pack.
|
|
42
45
|
|
|
43
46
|
License: MIT
|
|
@@ -1,43 +1,46 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Caching
|
|
3
3
|
type: doc
|
|
4
|
-
tags: [
|
|
4
|
+
tags: [cache]
|
|
5
5
|
stack: nextjs
|
|
6
|
-
status:
|
|
7
|
-
verified:
|
|
8
|
-
description:
|
|
6
|
+
status: reviewed
|
|
7
|
+
verified: 2026-12-07
|
|
8
|
+
description: Load before caching a response or a query.
|
|
9
9
|
---
|
|
10
10
|
|
|
11
11
|
# Caching
|
|
12
12
|
|
|
13
13
|
## Use when
|
|
14
|
-
|
|
14
|
+
The same read is slow and the data can be a few seconds old.
|
|
15
15
|
|
|
16
16
|
## Default
|
|
17
|
-
|
|
17
|
+
Cache a read that is scoped to the tenant, and name the key so a write can drop it.
|
|
18
18
|
|
|
19
19
|
## Use instead when
|
|
20
|
-
|
|
20
|
+
The data just changed and the next read must show it. Do not cache that path yet.
|
|
21
21
|
|
|
22
22
|
## Never
|
|
23
|
-
|
|
23
|
+
Never cache a response that includes another user's data under a shared key. Never cache a secret.
|
|
24
24
|
|
|
25
25
|
## Why
|
|
26
|
-
|
|
26
|
+
A shared key is a leak with a timeout.
|
|
27
27
|
|
|
28
28
|
## Steps
|
|
29
|
-
1.
|
|
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.
|
|
30
33
|
|
|
31
34
|
## Done when
|
|
32
|
-
|
|
35
|
+
A write is visible on the next read, and org A cannot hit org B's key.
|
|
33
36
|
|
|
34
37
|
## Example
|
|
35
|
-
|
|
38
|
+
The project list key includes the org id and is dropped on create.
|
|
36
39
|
|
|
37
40
|
## Common mistakes
|
|
38
|
-
|
|
41
|
+
A key of only the url. Caching the signed-in user document in a public cache.
|
|
39
42
|
|
|
40
43
|
## Sources
|
|
41
|
-
|
|
44
|
+
Connore pack. Original wording. No vendor text copied.
|
|
42
45
|
|
|
43
46
|
License: MIT
|
|
@@ -1,43 +1,46 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: Database
|
|
2
|
+
title: Database design
|
|
3
3
|
type: doc
|
|
4
|
-
tags: [
|
|
4
|
+
tags: [database, tenancy]
|
|
5
5
|
stack: nextjs
|
|
6
|
-
status:
|
|
7
|
-
verified:
|
|
8
|
-
description:
|
|
6
|
+
status: reviewed
|
|
7
|
+
verified: 2026-12-07
|
|
8
|
+
description: Load before a table, a query, or a tenant boundary.
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
# Database
|
|
11
|
+
# Database design
|
|
12
12
|
|
|
13
13
|
## Use when
|
|
14
|
-
|
|
14
|
+
A new table, or a query that reads another user's data.
|
|
15
15
|
|
|
16
16
|
## Default
|
|
17
|
-
|
|
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
18
|
|
|
19
19
|
## Use instead when
|
|
20
|
-
|
|
20
|
+
A single-user local tool with one operator. Still name the owner column so a second user does not require a rewrite.
|
|
21
21
|
|
|
22
22
|
## Never
|
|
23
|
-
|
|
23
|
+
Never take an id from the client and skip the organization filter. Never edit a migration that has already run in production.
|
|
24
24
|
|
|
25
25
|
## Why
|
|
26
|
-
|
|
26
|
+
A missing tenant filter is a data leak, and it looks like a normal query.
|
|
27
27
|
|
|
28
28
|
## Steps
|
|
29
|
-
1.
|
|
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.
|
|
30
33
|
|
|
31
34
|
## Done when
|
|
32
|
-
|
|
35
|
+
A user in org A cannot read a row from org B by guessing the id.
|
|
33
36
|
|
|
34
37
|
## Example
|
|
35
|
-
|
|
38
|
+
GET /invoices/123 for a member of another org returns 404, not the invoice.
|
|
36
39
|
|
|
37
40
|
## Common mistakes
|
|
38
|
-
|
|
41
|
+
A shared table with no owner column. A query that filters only by the id in the URL.
|
|
39
42
|
|
|
40
43
|
## Sources
|
|
41
|
-
|
|
44
|
+
Connore pack.
|
|
42
45
|
|
|
43
46
|
License: MIT
|
|
@@ -1,43 +1,46 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: File
|
|
2
|
+
title: File uploads
|
|
3
3
|
type: doc
|
|
4
|
-
tags: [
|
|
4
|
+
tags: [files]
|
|
5
5
|
stack: nextjs
|
|
6
|
-
status:
|
|
7
|
-
verified:
|
|
8
|
-
description:
|
|
6
|
+
status: reviewed
|
|
7
|
+
verified: 2026-12-07
|
|
8
|
+
description: Load when a handler accepts multipart data.
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
# File
|
|
11
|
+
# File uploads
|
|
12
12
|
|
|
13
13
|
## Use when
|
|
14
|
-
|
|
14
|
+
A route receives a file.
|
|
15
15
|
|
|
16
16
|
## Default
|
|
17
|
-
|
|
17
|
+
Limit size, check the type on the server, and store via the object storage rule.
|
|
18
18
|
|
|
19
19
|
## Use instead when
|
|
20
|
-
|
|
20
|
+
No file is involved. Do not add a parser.
|
|
21
21
|
|
|
22
22
|
## Never
|
|
23
|
-
|
|
23
|
+
Never write the upload into the source tree. Never use the client filename as a path.
|
|
24
24
|
|
|
25
25
|
## Why
|
|
26
|
-
|
|
26
|
+
Path traversal and stored scripts start here.
|
|
27
27
|
|
|
28
28
|
## Steps
|
|
29
|
-
1.
|
|
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.
|
|
30
33
|
|
|
31
34
|
## Done when
|
|
32
|
-
|
|
35
|
+
A too-large file fails, and the filename cannot escape the storage prefix.
|
|
33
36
|
|
|
34
37
|
## Example
|
|
35
|
-
|
|
38
|
+
image.png is stored under a generated key.
|
|
36
39
|
|
|
37
40
|
## Common mistakes
|
|
38
|
-
|
|
41
|
+
Saving to ./public/<filename>. Trusting the content-type header alone.
|
|
39
42
|
|
|
40
43
|
## Sources
|
|
41
|
-
|
|
44
|
+
Connore pack. Original wording. No vendor text copied.
|
|
42
45
|
|
|
43
46
|
License: MIT
|