spine-framework 0.4.3 → 0.5.0-rc.4
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/.env.example +13 -3
- package/.framework/cli/commands/bootstrap.ts +392 -0
- package/.framework/cli/commands/dev.ts +91 -218
- package/.framework/cli/commands/doctor.ts +132 -26
- package/.framework/cli/commands/generate.ts +38 -298
- package/.framework/cli/commands/init.ts +20 -1
- package/.framework/cli/commands/migrate.ts +36 -30
- package/.framework/cli/commands/migrations.ts +16 -56
- package/.framework/cli/commands/upgrade.ts +35 -0
- package/.framework/cli/commands/validate-schema.ts +147 -0
- package/.framework/cli/context.ts +223 -110
- package/.framework/cli/index.ts +6 -0
- package/.framework/cli/lib/project-files.ts +241 -1
- package/.framework/functions/_shared/agent-runner.ts +1000 -81
- package/.framework/functions/_shared/cil.ts +2 -1
- package/.framework/functions/_shared/db.ts +3 -6
- package/.framework/functions/_shared/hash-api-key.ts +183 -79
- package/.framework/functions/_shared/kb.ts +61 -7
- package/.framework/functions/_shared/logging.ts +562 -224
- package/.framework/functions/_shared/message-sequence.ts +53 -0
- package/.framework/functions/_shared/middleware.ts +47 -44
- package/.framework/functions/_shared/pipeline-runner.ts +150 -37
- package/.framework/functions/_shared/principal.ts +9 -6
- package/.framework/functions/_shared/trigger-engine.ts +149 -40
- package/.framework/functions/admin-data.ts +48 -31
- package/.framework/functions/ai-agents.ts +103 -33
- package/.framework/functions/api-keys.ts +301 -122
- package/.framework/functions/apps.ts +43 -26
- package/.framework/functions/cil-ingest.ts +48 -15
- package/.framework/functions/debug-auth.ts +14 -8
- package/.framework/functions/deliveries.ts +39 -12
- package/.framework/functions/embeddings.ts +145 -76
- package/.framework/functions/integration-outbound.ts +67 -27
- package/.framework/functions/integrations.ts +254 -127
- package/.framework/functions/logs.ts +273 -133
- package/.framework/functions/observability.ts +277 -147
- package/.framework/functions/pipeline-executions.ts +1 -1
- package/.framework/functions/pipeline-runner-background.ts +120 -0
- package/.framework/functions/pipelines.ts +14 -9
- package/.framework/functions/prompt-configs.ts +7 -4
- package/.framework/functions/roles.ts +8 -5
- package/.framework/functions/security.ts +30 -17
- package/.framework/functions/system-cron.ts +250 -128
- package/.framework/functions/tests.ts +7 -6
- package/.framework/functions/timers.ts +310 -107
- package/.framework/functions/trigger-scheduler.ts +65 -5
- package/.framework/functions/triggers.ts +28 -13
- package/.framework/functions/types.ts +13 -10
- package/.framework/migrations/064_episode_leases.sql +196 -0
- package/.framework/migrations/065_execution_tables_updated_at.sql +20 -0
- package/.framework/migrations/066_episode_steal_thread_merge.sql +148 -0
- package/.framework/migrations/067_episode_lease_stale_steal.sql +93 -0
- package/.framework/migrations/068_cron_schedule_timer_rpcs.sql +251 -0
- package/.framework/migrations/069_log_stats_window.sql +54 -0
- package/.framework/migrations/070_app_type_schema_rpcs.sql +166 -0
- package/.framework/migrations/071_timer_interval_keys.sql +96 -0
- package/.framework/migrations/072_slug_autofill.sql +77 -0
- package/.framework/migrations/073_seed_member_roles.sql +26 -0
- package/.framework/schemas/spine.config.schema.json +62 -0
- package/.framework/src/App.tsx +3 -1
- package/.framework/src/apps/admin/index.tsx +1141 -775
- package/.framework/src/components/ErrorBoundary.tsx +136 -0
- package/.framework/src/components/admin/AdminListPage.tsx +81 -73
- package/.framework/src/components/admin/AdminSidebar.tsx +92 -81
- package/.framework/src/components/admin/EntitySelect.tsx +181 -0
- package/.framework/src/components/admin/PageInstructions.tsx +86 -127
- package/.framework/src/components/app-shell/GenericAppShell.tsx +3 -1
- package/.framework/src/components/app-shell/GenericDetailPage.tsx +37 -13
- package/.framework/src/components/app-shell/GenericListPage.tsx +28 -32
- package/.framework/src/components/auth/TurnstileWidget.tsx +9 -6
- package/.framework/src/components/kb/KBArticleEditor.tsx +49 -6
- package/.framework/src/components/layout/Layout.tsx +4 -2
- package/.framework/src/components/layout/Sidebar.tsx +304 -179
- package/.framework/src/components/runtime/DataDetailPage.tsx +67 -35
- package/.framework/src/components/runtime/DataHeader.tsx +96 -48
- package/.framework/src/components/runtime/DataListPage.tsx +3 -26
- package/.framework/src/components/runtime/DataStats.tsx +10 -10
- package/.framework/src/components/runtime/DataTable.tsx +12 -10
- package/.framework/src/components/ui/sheet.tsx +24 -26
- package/.framework/src/components/ui/textarea.tsx +74 -48
- package/.framework/src/hooks/useBranding.ts +47 -0
- package/.framework/src/hooks/useEntityList.ts +12 -9
- package/.framework/src/hooks/useListSchema.ts +108 -58
- package/.framework/src/instructions/README.md +57 -0
- package/.framework/src/instructions/ai-agents.md +69 -0
- package/.framework/src/instructions/alerts.md +80 -0
- package/.framework/src/instructions/api-keys.md +87 -0
- package/.framework/src/instructions/apps.md +77 -0
- package/.framework/src/instructions/concepts/ai-and-prompts.md +150 -0
- package/.framework/src/instructions/concepts/apps-and-renderers.md +162 -0
- package/.framework/src/instructions/concepts/auth-and-api-keys.md +133 -0
- package/.framework/src/instructions/concepts/automation.md +186 -0
- package/.framework/src/instructions/concepts/concurrency-and-idempotency.md +125 -0
- package/.framework/src/instructions/concepts/core-vs-custom.md +124 -0
- package/.framework/src/instructions/concepts/design-schema.md +152 -0
- package/.framework/src/instructions/concepts/integrations-and-webhooks.md +127 -0
- package/.framework/src/instructions/concepts/observability.md +116 -0
- package/.framework/src/instructions/concepts/permissions.md +150 -0
- package/.framework/src/instructions/concepts/runtime-records.md +111 -0
- package/.framework/src/instructions/concepts/scope-and-accounts.md +112 -0
- package/.framework/src/instructions/concepts/spine-way.md +172 -0
- package/.framework/src/instructions/deliveries.md +59 -0
- package/.framework/src/instructions/guide/00-orientation.md +106 -0
- package/.framework/src/instructions/guide/01-install-and-first-run.md +253 -0
- package/.framework/src/instructions/guide/02-project-map.md +147 -0
- package/.framework/src/instructions/guide/03-domain-model.md +223 -0
- package/.framework/src/instructions/guide/04-first-app.md +227 -0
- package/.framework/src/instructions/guide/05-glossary.md +183 -0
- package/.framework/src/instructions/integrations.md +96 -0
- package/.framework/src/instructions/internal/cil-markers.md +83 -0
- package/.framework/src/instructions/invites.md +60 -0
- package/.framework/src/instructions/kb.md +80 -0
- package/.framework/src/instructions/logs.md +77 -0
- package/.framework/src/instructions/observability.md +61 -0
- package/.framework/src/instructions/operations/deployment.md +115 -0
- package/.framework/src/instructions/operations/migrations.md +125 -0
- package/.framework/src/instructions/operations/security-checklist.md +148 -0
- package/.framework/src/instructions/operations/troubleshooting.md +170 -0
- package/.framework/src/instructions/operations/upgrade.md +116 -0
- package/.framework/src/instructions/pipeline-executions.md +62 -0
- package/.framework/src/instructions/pipelines.md +78 -0
- package/.framework/src/instructions/prompts.md +95 -0
- package/.framework/src/instructions/reference/api/admin-data.md +162 -0
- package/.framework/src/instructions/reference/api/auth.md +113 -0
- package/.framework/src/instructions/reference/api/errors-and-envelopes.md +113 -0
- package/.framework/src/instructions/reference/app-manifest.md +150 -0
- package/.framework/src/instructions/reference/cli.md +124 -0
- package/.framework/src/instructions/reference/database.md +132 -0
- package/.framework/src/instructions/reference/design-schema.md +280 -0
- package/.framework/src/instructions/reference/env-vars.md +133 -0
- package/.framework/src/instructions/reference/functions/account-nodes.md +75 -0
- package/.framework/src/instructions/reference/functions/admin-data.md +195 -0
- package/.framework/src/instructions/reference/functions/admin-funnel.md +90 -0
- package/.framework/src/instructions/reference/functions/admin-install-funnel.md +107 -0
- package/.framework/src/instructions/reference/functions/admin-signals.md +102 -0
- package/.framework/src/instructions/reference/functions/ai-agents.md +148 -0
- package/.framework/src/instructions/reference/functions/ai-interactions.md +156 -0
- package/.framework/src/instructions/reference/functions/api-keys.md +130 -0
- package/.framework/src/instructions/reference/functions/apps.md +140 -0
- package/.framework/src/instructions/reference/functions/auth.md +99 -0
- package/.framework/src/instructions/reference/functions/debug-auth.md +91 -0
- package/.framework/src/instructions/reference/functions/deliveries.md +110 -0
- package/.framework/src/instructions/reference/functions/embeddings.md +166 -0
- package/.framework/src/instructions/reference/functions/eval-harness.md +149 -0
- package/.framework/src/instructions/reference/functions/index.md +103 -0
- package/.framework/src/instructions/reference/functions/integration-outbound.md +200 -0
- package/.framework/src/instructions/reference/functions/integration-routes.md +151 -0
- package/.framework/src/instructions/reference/functions/integrations.md +130 -0
- package/.framework/src/instructions/reference/functions/invites.md +182 -0
- package/.framework/src/instructions/reference/functions/item-progress.md +107 -0
- package/.framework/src/instructions/reference/functions/kb.md +166 -0
- package/.framework/src/instructions/reference/functions/logs.md +141 -0
- package/.framework/src/instructions/reference/functions/observability.md +105 -0
- package/.framework/src/instructions/reference/functions/pipeline-executions.md +132 -0
- package/.framework/src/instructions/reference/functions/pipeline-runner-background.md +121 -0
- package/.framework/src/instructions/reference/functions/pipelines.md +136 -0
- package/.framework/src/instructions/reference/functions/prompt-configs.md +121 -0
- package/.framework/src/instructions/reference/functions/roles.md +121 -0
- package/.framework/src/instructions/reference/functions/security.md +140 -0
- package/.framework/src/instructions/reference/functions/system-cron.md +136 -0
- package/.framework/src/instructions/reference/functions/system.md +106 -0
- package/.framework/src/instructions/reference/functions/tests.md +97 -0
- package/.framework/src/instructions/reference/functions/timers.md +117 -0
- package/.framework/src/instructions/reference/functions/trigger-scheduler.md +102 -0
- package/.framework/src/instructions/reference/functions/triggers.md +140 -0
- package/.framework/src/instructions/reference/functions/types.md +146 -0
- package/.framework/src/instructions/reference/seeds.md +126 -0
- package/.framework/src/instructions/reference/shared-modules.md +127 -0
- package/.framework/src/instructions/reference/spine-config.md +114 -0
- package/.framework/src/instructions/roles.md +80 -0
- package/.framework/src/instructions/runtime-detail.md +70 -0
- package/.framework/src/instructions/runtime-list.md +77 -0
- package/.framework/src/instructions/security.md +67 -0
- package/.framework/src/instructions/tasks/add-a-pipeline.md +110 -0
- package/.framework/src/instructions/tasks/add-a-role.md +96 -0
- package/.framework/src/instructions/tasks/add-a-timer.md +114 -0
- package/.framework/src/instructions/tasks/add-a-trigger.md +106 -0
- package/.framework/src/instructions/tasks/add-a-type.md +151 -0
- package/.framework/src/instructions/tasks/add-a-webhook.md +108 -0
- package/.framework/src/instructions/tasks/add-an-ai-agent.md +108 -0
- package/.framework/src/instructions/tasks/add-an-integration.md +124 -0
- package/.framework/src/instructions/tasks/build-a-custom-page.md +118 -0
- package/.framework/src/instructions/tasks/package-and-install-an-app.md +127 -0
- package/.framework/src/instructions/tasks/test-your-code.md +108 -0
- package/.framework/src/instructions/tasks/write-a-function.md +132 -0
- package/.framework/src/instructions/tasks/write-a-migration.md +110 -0
- package/.framework/src/instructions/testing.md +59 -0
- package/.framework/src/instructions/timers.md +82 -0
- package/.framework/src/instructions/triggers.md +69 -0
- package/.framework/src/instructions/types.md +93 -0
- package/.framework/src/lib/branding.ts +128 -0
- package/.framework/src/pages/NoAppPage.tsx +3 -1
- package/.framework/src/pages/NotFoundPage.tsx +62 -31
- package/.framework/src/pages/SetupPage.tsx +5 -2
- package/.framework/src/pages/admin/AIAgentDetailPage.tsx +117 -106
- package/.framework/src/pages/admin/AIAgentsPage.tsx +86 -48
- package/.framework/src/pages/admin/APIKeyDetailPage.tsx +153 -152
- package/.framework/src/pages/admin/APIKeysPage.tsx +91 -90
- package/.framework/src/pages/admin/AlertsConfigPage.tsx +29 -18
- package/.framework/src/pages/admin/AppDetailPage.tsx +6 -60
- package/.framework/src/pages/admin/AppsPage.tsx +104 -66
- package/.framework/src/pages/admin/DeliveriesPage.tsx +5 -5
- package/.framework/src/pages/admin/EmbeddingDetailPage.tsx +5 -23
- package/.framework/src/pages/admin/EmbeddingsPage.tsx +5 -26
- package/.framework/src/pages/admin/IntegrationDetailPage.tsx +7 -7
- package/.framework/src/pages/admin/IntegrationsPage.tsx +85 -43
- package/.framework/src/pages/admin/LogsPage.tsx +144 -76
- package/.framework/src/pages/admin/ObservabilityDashboard.tsx +223 -140
- package/.framework/src/pages/admin/PipelineDetailPage.tsx +134 -113
- package/.framework/src/pages/admin/PipelineExecutionsPage.tsx +108 -45
- package/.framework/src/pages/admin/PipelinesPage.tsx +160 -115
- package/.framework/src/pages/admin/PromptConfigDetailPage.tsx +96 -98
- package/.framework/src/pages/admin/PromptConfigsPage.tsx +101 -59
- package/.framework/src/pages/admin/RoleDetailPage.tsx +90 -79
- package/.framework/src/pages/admin/RolesPage.tsx +86 -43
- package/.framework/src/pages/admin/SecurityPage.tsx +1 -1
- package/.framework/src/pages/admin/TestingDashboard.tsx +16 -28
- package/.framework/src/pages/admin/TimerDetailPage.tsx +117 -100
- package/.framework/src/pages/admin/TimersPage.tsx +90 -62
- package/.framework/src/pages/admin/TriggerDetailPage.tsx +90 -83
- package/.framework/src/pages/admin/TriggersPage.tsx +124 -99
- package/.framework/src/pages/admin/TypeDetailPage.tsx +152 -138
- package/.framework/src/pages/admin/TypesPage.tsx +90 -48
- package/.framework/src/pages/admin/cil/CILAgentPage.tsx +17 -25
- package/.framework/src/pages/admin/cil/CILChunkDetailPage.tsx +17 -27
- package/.framework/src/pages/admin/cil/CILDashboardPage.tsx +72 -40
- package/.framework/src/pages/admin/cil/CILFileListPage.tsx +321 -129
- package/.framework/src/pages/admin/cil/CILFileSelectPage.tsx +18 -29
- package/.framework/src/pages/admin/cil/CILGraphPage.tsx +26 -38
- package/.framework/src/pages/admin/cil/CILIngestionPage.tsx +34 -46
- package/.framework/src/pages/admin/cil/CILProjectsPage.tsx +189 -103
- package/.framework/src/pages/admin/cil/CILSearchPage.tsx +246 -136
- package/.framework/src/pages/admin/cil/CILSuggestionsPage.tsx +11 -22
- package/.framework/src/pages/admin/cil/CILVersionsPage.tsx +9 -20
- package/.framework/src/pages/admin/cil/FlexiblePipelinePage.tsx +26 -38
- package/.framework/src/pages/admin/kb/KBAdminPage.tsx +7 -26
- package/.framework/src/pages/auth/AuthConfirmPage.tsx +3 -1
- package/.framework/src/pages/auth/ForgotPasswordPage.tsx +3 -1
- package/.framework/src/pages/auth/LoginPage.tsx +4 -2
- package/.framework/src/pages/auth/RegisterPage.tsx +3 -1
- package/.framework/templates/agent/AGENTS.md +150 -0
- package/.framework/templates/agent/skills/spine-add-ai-agent/SKILL.md +58 -0
- package/.framework/templates/agent/skills/spine-add-automation/SKILL.md +62 -0
- package/.framework/templates/agent/skills/spine-add-integration/SKILL.md +63 -0
- package/.framework/templates/agent/skills/spine-architect/SKILL.md +86 -0
- package/.framework/templates/agent/skills/spine-install-app/SKILL.md +72 -0
- package/.framework/templates/agent/skills/spine-migration/SKILL.md +75 -0
- package/.framework/templates/agent/skills/spine-new-app/SKILL.md +67 -0
- package/.framework/templates/agent/skills/spine-new-function/SKILL.md +65 -0
- package/.framework/templates/agent/skills/spine-new-type/SKILL.md +65 -0
- package/.framework/templates/agent/skills/spine-schema/SKILL.md +77 -0
- package/.framework/templates/agent/skills/spine-test/SKILL.md +67 -0
- package/.framework/templates/agent/skills/spine-troubleshoot/SKILL.md +74 -0
- package/.framework/templates/agent/skills/spine-upgrade/SKILL.md +69 -0
- package/.framework/templates/project.json +5 -1
- package/.framework/tests/unit/account-scoping-gates.test.ts +392 -0
- package/.framework/tests/unit/agent-files.test.ts +355 -0
- package/.framework/tests/unit/agent-runner.test.ts +496 -47
- package/.framework/tests/unit/api-keys-create-scope-gate.test.ts +160 -0
- package/.framework/tests/unit/api-keys-omit-secret-fields.test.ts +38 -0
- package/.framework/tests/unit/bootstrap.test.ts +242 -0
- package/.framework/tests/unit/cli-context-api-key.test.ts +114 -0
- package/.framework/tests/unit/debug-auth.test.ts +38 -0
- package/.framework/tests/unit/deliveries-account-scoping.test.ts +185 -0
- package/.framework/tests/unit/episode-lease.test.ts +695 -0
- package/.framework/tests/unit/integration-outbound-credentials.test.ts +167 -0
- package/.framework/tests/unit/integrations-audit-redaction.test.ts +130 -0
- package/.framework/tests/unit/kb-ingest-lease.test.ts +19 -0
- package/.framework/tests/unit/logging-app-id.test.ts +75 -0
- package/.framework/tests/unit/pipeline-runner-background.test.ts +120 -0
- package/.framework/tests/unit/pipeline-runner.test.ts +153 -1
- package/.framework/tests/unit/principal-cache.test.ts +15 -0
- package/.framework/tests/unit/system-context-denial.test.ts +145 -0
- package/.framework/tests/unit/system-cron.test.ts +240 -0
- package/.framework/tests/unit/timers.test.ts +159 -0
- package/.framework/tests/unit/trigger-engine.test.ts +278 -91
- package/.framework/tests/unit/trigger-scheduler.test.ts +78 -0
- package/README.md +125 -166
- package/config/tsconfig.cli.json +2 -2
- package/netlify.toml +5 -0
- package/package.json +15 -4
- package/templates/project/package-lock.json +2 -2
- package/.framework/docs/admin-routes.md +0 -76
- package/.framework/docs/api-docs-progress.md +0 -38
- package/.framework/docs/api-governance.md +0 -146
- package/.framework/docs/api-testing-results.md +0 -212
- package/.framework/docs/assembly-launch-guide.md +0 -138
- package/.framework/docs/audit-results.md +0 -590
- package/.framework/docs/db-api-inventory.md +0 -95
- package/.framework/docs/gap-remediation-backlog.md +0 -103
- package/.framework/docs/ui-adoption-verification.md +0 -111
- package/.framework/docs/ui-api-coverage.md +0 -84
- package/.framework/docs/v2-compatibility-audit.md +0 -228
- package/.framework/mcp/index.ts +0 -133
- package/.framework/mcp/load-env.ts +0 -60
- package/.framework/mcp/shared/app-manifest.ts +0 -275
- package/.framework/mcp/shared/db.ts +0 -477
- package/.framework/mcp/shared/kb.ts +0 -118
- package/.framework/mcp/tools/architect.ts +0 -431
- package/.framework/mcp/tools/cil/context.ts +0 -345
- package/.framework/mcp/tools/cil/graph.ts +0 -242
- package/.framework/mcp/tools/cil/ingest.ts +0 -1217
- package/.framework/mcp/tools/cil/pipeline-orchestrator.ts +0 -693
- package/.framework/mcp/tools/cil/pipeline.ts +0 -767
- package/.framework/mcp/tools/cil/project.ts +0 -791
- package/.framework/mcp/tools/cil/retrieval.ts +0 -336
- package/.framework/mcp/tools/cil/search-core.ts +0 -454
- package/.framework/mcp/tools/cil/search.ts +0 -97
- package/.framework/mcp/tools/cil/suggest.ts +0 -186
- package/.framework/mcp/tools/cil/validate.ts +0 -1369
- package/.framework/mcp/tools/kb/delete.ts +0 -139
- package/.framework/mcp/tools/kb/index.ts +0 -52
- package/.framework/mcp/tools/kb/ingest.ts +0 -84
- package/.framework/mcp/tools/kb/list-types.ts +0 -102
- package/.framework/mcp/tools/kb/publish.ts +0 -100
- package/.framework/mcp/tools/kb/reindex.ts +0 -86
- package/.framework/mcp/tools/kb/revoke.ts +0 -85
- package/.framework/mcp/tools/kb/search.ts +0 -101
- package/.framework/mcp/tools/kb/upsert.ts +0 -125
- package/.framework/mcp/tools/observability.ts +0 -510
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<!-- spine-framework:begin version={{SPINE_VERSION}} -->
|
|
2
|
+
<!--
|
|
3
|
+
Framework-owned block. `spine-framework upgrade` replaces everything between
|
|
4
|
+
the begin/end markers above and below. Keep your own notes outside the markers.
|
|
5
|
+
-->
|
|
6
|
+
|
|
7
|
+
# Spine Framework — agent rules
|
|
8
|
+
|
|
9
|
+
You are working in a Spine Framework project. Spine is a multi-tenant, modular
|
|
10
|
+
application platform: framework primitives live under `.framework/` (shipped by
|
|
11
|
+
the `spine-framework` npm package), and everything the project owns lives
|
|
12
|
+
outside it (`custom/`, app packages, project config).
|
|
13
|
+
|
|
14
|
+
## Core vs. custom boundary
|
|
15
|
+
|
|
16
|
+
- **Never edit `.framework/`.** It is sealed and overwritten verbatim by
|
|
17
|
+
`spine-framework upgrade`. Local edits there break the integrity check and
|
|
18
|
+
are lost on upgrade.
|
|
19
|
+
- Project code lives in `custom/` (`custom/apps/<slug>/`, `custom/functions/`,
|
|
20
|
+
`custom/migrations/`, `custom/tests/`).
|
|
21
|
+
- Framework code never imports from `custom/`. From custom apps, import core
|
|
22
|
+
through the `@core/*` alias; from custom functions (post-assembly), import
|
|
23
|
+
`./_shared/*`.
|
|
24
|
+
- If a change could serve more than one app it may be a framework concern —
|
|
25
|
+
flag it to the maintainer instead of patching `.framework/` locally.
|
|
26
|
+
|
|
27
|
+
## Runtime record CRUD — admin-data only
|
|
28
|
+
|
|
29
|
+
Use the generic `/api/admin-data` endpoint for all runtime record CRUD
|
|
30
|
+
(`items`, `threads`, `messages`, `links`, `attachments`, `watchers`, etc.).
|
|
31
|
+
Do **not** write custom Netlify function wrappers for creating, updating,
|
|
32
|
+
listing, or deleting runtime records — wrappers bypass shared permission,
|
|
33
|
+
type-resolution, audit, and trigger logic. Find-or-create flows call
|
|
34
|
+
`/api/admin-data` directly from the client or a hook. See
|
|
35
|
+
`.framework/src/instructions/reference/api/admin-data.md`.
|
|
36
|
+
|
|
37
|
+
- **Access:** runtime APIs authenticate with `x-api-key: $SPINE_API_KEY`;
|
|
38
|
+
ask the user to create a scoped key in Admin → Configs → API Keys if unset.
|
|
39
|
+
|
|
40
|
+
## design_schema authoring checklist
|
|
41
|
+
|
|
42
|
+
Every new or changed type needs a valid `design_schema` on its `public.types`
|
|
43
|
+
row; `validation_schema` is generated from it. Spine stamps
|
|
44
|
+
`type.design_schema` into each runtime record at creation, so a missing or
|
|
45
|
+
stale schema breaks permissions, validation, and UI rendering.
|
|
46
|
+
|
|
47
|
+
**Absolute minimum `design_schema`:**
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"scope": "account",
|
|
52
|
+
"fields": {
|
|
53
|
+
"title": { "data_type": "text", "label": "Title", "required": true, "system": true }
|
|
54
|
+
},
|
|
55
|
+
"views": {
|
|
56
|
+
"default_list": {
|
|
57
|
+
"type": "list",
|
|
58
|
+
"display": "table",
|
|
59
|
+
"label": "List",
|
|
60
|
+
"fields": {
|
|
61
|
+
"title": { "sortable": true, "display_type": "text" },
|
|
62
|
+
"created_at": { "sortable": true, "display_type": "timestamp" }
|
|
63
|
+
},
|
|
64
|
+
"default_sort": { "field": "created_at", "direction": "desc" }
|
|
65
|
+
},
|
|
66
|
+
"default_detail": {
|
|
67
|
+
"type": "detail",
|
|
68
|
+
"label": "Detail",
|
|
69
|
+
"sections": [
|
|
70
|
+
{ "title": "Details", "fields": { "title": { "display_type": "input" } } }
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"record_permissions": {
|
|
75
|
+
"system-admin": ["create", "read", "update", "delete"]
|
|
76
|
+
},
|
|
77
|
+
"functionality": null
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
- `scope`: `"account"` (default) or `"platform"`. Omitted defaults to account.
|
|
82
|
+
- `fields`: required. Every field needs `data_type`, `label`, `required`.
|
|
83
|
+
- `views`: required for generic apps (`apps.renderer = "generic"`) — at least
|
|
84
|
+
`default_list` and `default_detail`, referencing real fields with known
|
|
85
|
+
`display_type` values. Custom apps may omit views if they render everything
|
|
86
|
+
themselves, but keeping them preserves the generic admin/runtime fallback.
|
|
87
|
+
- `record_permissions`: required. The **base, most restrictive** grant per
|
|
88
|
+
role; at minimum grant `system-admin`.
|
|
89
|
+
- `functionality`: `null` until automation bindings are confirmed active.
|
|
90
|
+
|
|
91
|
+
**Permission design rule:** `record_permissions` is the base grant — if a role
|
|
92
|
+
can `read`/`update` a record, every field defaults to read/write.
|
|
93
|
+
`fields.*.permissions` is for **overrides only**: loosen a specific field
|
|
94
|
+
beyond the record grant, or restrict a `system: true` field. Field-level
|
|
95
|
+
actions are `read` and `write` only; `create`/`delete` are record-level.
|
|
96
|
+
|
|
97
|
+
**Known `data_type` values:** `text`, `textarea`, `rich_text`, `email`,
|
|
98
|
+
`phone`, `url`, `number`, `currency`, `range`, `date`, `datetime`, `boolean`/
|
|
99
|
+
`checkbox`, `select`, `multiselect`, `radio`, `color`, `file`, `image`,
|
|
100
|
+
`json`, `reference`, `address`. `select`/`multiselect`/`radio` require
|
|
101
|
+
`options`; `reference` should set `validation.reference_kind` and
|
|
102
|
+
`validation.reference_type`.
|
|
103
|
+
|
|
104
|
+
**Known `display_type` values:** `text`, `input`, `textarea`, `rich_text`,
|
|
105
|
+
`select`, `multiselect`, `radio`, `checkbox`/`switch`, `date_picker`,
|
|
106
|
+
`datetime_picker`, `color_picker`, `file_upload`, `image_upload`,
|
|
107
|
+
`range_slider`, `badge`, `timestamp`, `currency`, `number`.
|
|
108
|
+
|
|
109
|
+
**Before finishing a type change:**
|
|
110
|
+
|
|
111
|
+
- `slug` is unique per `kind` — duplicates break `resolveTypeId`/`.single()`
|
|
112
|
+
lookups. Type seeds use `conflict: "kind,slug"` with `inject_app_id: false`.
|
|
113
|
+
- `kind` matches the runtime table (`item`, `thread`, `message`, `link`,
|
|
114
|
+
`attachment`, `watcher`, `person`, `account`).
|
|
115
|
+
- `system: true` fields live at `record.<field>`; non-system fields at
|
|
116
|
+
`record.data.<field>`. `system: true` fields restrict `write` to
|
|
117
|
+
`system-admin` when the record-level grant would allow writes.
|
|
118
|
+
- `ownership`, `is_active`, `icon`, `color` are set on the `types` row.
|
|
119
|
+
- Validate the JSON before saving: `npx spine-framework validate-schema <file>`.
|
|
120
|
+
|
|
121
|
+
## Where to look — the instruction book
|
|
122
|
+
|
|
123
|
+
The package ships a markdown instruction book at
|
|
124
|
+
`.framework/src/instructions/`:
|
|
125
|
+
|
|
126
|
+
- `README.md` — structure, reading order, entity doc template.
|
|
127
|
+
- `guide/` — walkthroughs (`00-orientation.md` → `05-glossary.md`;
|
|
128
|
+
`03-domain-model.md` covers types/records/apps).
|
|
129
|
+
- `concepts/` — `spine-way.md` (the rules), `core-vs-custom.md`,
|
|
130
|
+
`design-schema.md`, `permissions.md`, `runtime-records.md`.
|
|
131
|
+
- `reference/` — `design-schema.md`, `cli.md`, `api/admin-data.md`,
|
|
132
|
+
`env-vars.md`, `app-manifest.md`, `functions/`.
|
|
133
|
+
- `tasks/` — single-goal procedures. `operations/` — admin-UI runbooks.
|
|
134
|
+
- Entity pages: `types.md`, `apps.md`, `roles.md`, `pipelines.md`,
|
|
135
|
+
`triggers.md`, `timers.md`, `ai-agents.md`, `prompts.md`,
|
|
136
|
+
`integrations.md`, `api-keys.md`, `deliveries.md`.
|
|
137
|
+
|
|
138
|
+
Project-level skills for common jobs live in `.devin/skills/spine-*/`.
|
|
139
|
+
|
|
140
|
+
## Verify before finishing
|
|
141
|
+
|
|
142
|
+
- `npm run typecheck` — compile the frontend + assembled sources.
|
|
143
|
+
- `npm run test` — vitest unit/API suite.
|
|
144
|
+
- `npm run verify` — integrity check against `.spine-manifest.json`.
|
|
145
|
+
- `npx spine-framework validate-schema <file>` — check a `design_schema` JSON.
|
|
146
|
+
- `npx spine-framework validate-app <dir>` — check an app package.
|
|
147
|
+
- `npx spine-framework doctor` — health + wiring checks.
|
|
148
|
+
<!-- spine-framework:end -->
|
|
149
|
+
|
|
150
|
+
<!-- Your project rules below this line are never overwritten by spine-framework upgrade -->
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spine-add-ai-agent
|
|
3
|
+
description: "Configure a Spine AI agent — model, tools, guardrails — plus the prompt configs it invokes at runtime."
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- read
|
|
6
|
+
- write
|
|
7
|
+
- edit
|
|
8
|
+
- exec
|
|
9
|
+
- grep
|
|
10
|
+
- find_file_by_name
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
You configure Spine AI agents and their prompt configs.
|
|
14
|
+
|
|
15
|
+
## When to invoke
|
|
16
|
+
|
|
17
|
+
- A pipeline, trigger, or chat surface needs an LLM step.
|
|
18
|
+
- An existing agent needs a new prompt config, tools, or model settings.
|
|
19
|
+
|
|
20
|
+
## Model
|
|
21
|
+
|
|
22
|
+
- **AI agent** — reusable model + prompt + tool configuration with guardrails;
|
|
23
|
+
invoked by pipelines, triggers, and chat interfaces.
|
|
24
|
+
- **Prompt config** — the prompt body, model settings, escalation rules,
|
|
25
|
+
knowledge sources, available tools, and metadata, selected by slug.
|
|
26
|
+
|
|
27
|
+
Read the entity docs first: `.framework/src/instructions/ai-agents.md` and
|
|
28
|
+
`.framework/src/instructions/prompts.md`, plus the mental model in
|
|
29
|
+
`.framework/src/instructions/concepts/ai-and-prompts.md`. Procedures live under
|
|
30
|
+
`.framework/src/instructions/tasks/`; observability under
|
|
31
|
+
`.framework/src/instructions/concepts/observability.md` and
|
|
32
|
+
`.framework/src/instructions/operations/`.
|
|
33
|
+
|
|
34
|
+
## Steps
|
|
35
|
+
|
|
36
|
+
1. **Design the prompt config.** Write the prompt body and set model,
|
|
37
|
+
temperature, escalation rules, and which knowledge sources and tools the
|
|
38
|
+
config exposes. Give it a stable slug — callers select configs by slug.
|
|
39
|
+
2. **Create the agent record** via `/api/admin-data` or app seed. Attach the
|
|
40
|
+
prompt config slug, the model, the tool allowlist, and guardrails
|
|
41
|
+
(max tokens, escalation, refusal behavior).
|
|
42
|
+
3. **Wire invocation.** Agents run from pipeline stages (`stage_type` =
|
|
43
|
+
agent/action slug) or chat surfaces — wire the pipeline with the
|
|
44
|
+
`spine-add-automation` skill.
|
|
45
|
+
4. **Credentials stay server-side.** Agent API keys live in integrations /
|
|
46
|
+
env — never in prompt text, frontend code, or committed files. See
|
|
47
|
+
`.framework/src/instructions/api-keys.md`.
|
|
48
|
+
5. **Verify:** invoke the agent once end-to-end; inspect the interaction log
|
|
49
|
+
via the observability pages in `.framework/src/instructions/operations/`.
|
|
50
|
+
|
|
51
|
+
## Rules
|
|
52
|
+
|
|
53
|
+
- Prompt configs are data, not code — keep them in the DB/seed, not in files.
|
|
54
|
+
- Escalation rules must name a reachable target (role/person) — dead-end
|
|
55
|
+
escalation silently drops conversations.
|
|
56
|
+
- Guardrail settings belong on the agent record, not inline in prompt text.
|
|
57
|
+
- Verification: one real invocation + doctor `runtime_wiring` pass for the
|
|
58
|
+
owning pipeline.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spine-add-automation
|
|
3
|
+
description: "Add Spine automation — a pipeline with stages, wired to a trigger (event), timer (schedule), or webhook."
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- read
|
|
6
|
+
- write
|
|
7
|
+
- edit
|
|
8
|
+
- exec
|
|
9
|
+
- grep
|
|
10
|
+
- find_file_by_name
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
You add automation to a Spine project: pipelines (the workflow), triggers
|
|
14
|
+
(the event listener), and timers (the schedule).
|
|
15
|
+
|
|
16
|
+
## When to invoke
|
|
17
|
+
|
|
18
|
+
- React to a platform event (`item.created`, `message.sent`, ...).
|
|
19
|
+
- Run a job on an interval, cron schedule, or one-off.
|
|
20
|
+
- Wire an existing pipeline to a new event source.
|
|
21
|
+
|
|
22
|
+
## Model
|
|
23
|
+
|
|
24
|
+
- **Pipeline** — multi-step workflow; `stages` is a JSON array the runner
|
|
25
|
+
executes in order. Each stage's `stage_type` names an `actions` slug.
|
|
26
|
+
- **Trigger** — listens for an event and hands the payload to a pipeline.
|
|
27
|
+
Config references `type_slug`, `pipeline_slug`/`pipeline_id`, and optionally
|
|
28
|
+
a `kind`/`entity` scope.
|
|
29
|
+
- **Timer** — invokes a pipeline on `interval`, `cron`, or `once`.
|
|
30
|
+
|
|
31
|
+
Read the entity docs first: `.framework/src/instructions/pipelines.md`,
|
|
32
|
+
`.framework/src/instructions/triggers.md`, and
|
|
33
|
+
`.framework/src/instructions/timers.md`. The automation model is
|
|
34
|
+
`.framework/src/instructions/concepts/automation.md`; procedures live under
|
|
35
|
+
`.framework/src/instructions/tasks/`.
|
|
36
|
+
|
|
37
|
+
## Steps
|
|
38
|
+
|
|
39
|
+
1. **Design the stages.** Each stage = `{ stage_type, config }` where
|
|
40
|
+
`stage_type` is an existing, active `actions` slug. Check the actions
|
|
41
|
+
registry before inventing one — a stage referencing a missing action fails
|
|
42
|
+
the `runtime_wiring` doctor check.
|
|
43
|
+
2. **Create the pipeline row** via `/api/admin-data` or app seed
|
|
44
|
+
(`seed/pipelines.json`). Keep `is_active` false until stages are verified.
|
|
45
|
+
3. **Wire the source:**
|
|
46
|
+
- Event → `triggers` row (`event_type`, `pipeline_slug` or `pipeline_id`,
|
|
47
|
+
`config.filters.type_slug` to scope to a type).
|
|
48
|
+
- Schedule → `timers` row (`pipeline_id`, interval/cron/once config).
|
|
49
|
+
- Webhook → the `spine-add-integration` skill.
|
|
50
|
+
4. **Verify wiring:** `npx spine-framework doctor` — the `runtime_wiring`
|
|
51
|
+
check reports dangling `type_slug`, `pipeline_slug`/`pipeline_id`, and
|
|
52
|
+
`stage_type` references, plus active pipelines with no stages.
|
|
53
|
+
5. **Watch the run:** deliveries and executions are observable — see the
|
|
54
|
+
`spine-troubleshoot` skill and `.framework/src/instructions/deliveries.md`.
|
|
55
|
+
|
|
56
|
+
## Rules
|
|
57
|
+
|
|
58
|
+
- An active pipeline with no stages completes successfully while doing
|
|
59
|
+
nothing — always verify `stages` is non-empty.
|
|
60
|
+
- Trigger `config` names entities by table name (`items`); types by slug.
|
|
61
|
+
- Prefer `pipeline_slug` in config so the binding survives ID regeneration.
|
|
62
|
+
- Verification: doctor `runtime_wiring` pass + one real event run observed.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spine-add-integration
|
|
3
|
+
description: "Connect Spine to an external service — integration record, credentials, and inbound webhook wiring to a pipeline."
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- read
|
|
6
|
+
- write
|
|
7
|
+
- edit
|
|
8
|
+
- exec
|
|
9
|
+
- grep
|
|
10
|
+
- find_file_by_name
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
You connect a Spine project to external services: outbound integrations
|
|
14
|
+
(OpenAI, SendGrid, generic HTTP) and inbound webhooks.
|
|
15
|
+
|
|
16
|
+
## When to invoke
|
|
17
|
+
|
|
18
|
+
- A pipeline stage or app needs to call an external service.
|
|
19
|
+
- An external service needs to push events into Spine (webhook).
|
|
20
|
+
- Credentials for an existing integration need to rotate or move scope.
|
|
21
|
+
|
|
22
|
+
## Model
|
|
23
|
+
|
|
24
|
+
- **Integration** — a record naming the adapter (`openai`, `sendgrid`,
|
|
25
|
+
`http`, ...), runtime config, and credentials; callers invoke it by slug.
|
|
26
|
+
- **Deliveries** — the outbound delivery log: every attempt, status, retries,
|
|
27
|
+
and response; the primary debugging surface.
|
|
28
|
+
|
|
29
|
+
Read `.framework/src/instructions/integrations.md`,
|
|
30
|
+
`.framework/src/instructions/deliveries.md`,
|
|
31
|
+
`.framework/src/instructions/api-keys.md`, and the model in
|
|
32
|
+
`.framework/src/instructions/concepts/integrations-and-webhooks.md` before
|
|
33
|
+
configuring anything. Route-level details live under
|
|
34
|
+
`.framework/src/instructions/reference/functions/integration-routes.md` and
|
|
35
|
+
`.framework/src/instructions/reference/functions/integration-outbound.md`.
|
|
36
|
+
|
|
37
|
+
## Steps
|
|
38
|
+
|
|
39
|
+
1. **Choose the adapter.** Check the integrations entity doc for supported
|
|
40
|
+
adapters and their config keys — a generic `http` adapter covers services
|
|
41
|
+
without a named one.
|
|
42
|
+
2. **Create the integration record** via `/api/admin-data` or app seed. Store
|
|
43
|
+
credentials on the record's credential fields — service keys never appear
|
|
44
|
+
in frontend code, prompt text, or committed env files.
|
|
45
|
+
3. **Outbound calls:** pipelines and functions resolve the integration by
|
|
46
|
+
slug and send; attempts land in `deliveries` with status and response.
|
|
47
|
+
4. **Inbound webhooks:** expose the endpoint, verify signatures/secrets, then
|
|
48
|
+
hand the normalized payload to a pipeline — wire it with the
|
|
49
|
+
`spine-add-automation` skill.
|
|
50
|
+
5. **Verify:**
|
|
51
|
+
- Outbound — trigger one call and confirm a `deliveries` row shows
|
|
52
|
+
`status` success; inspect response body on failure.
|
|
53
|
+
- Inbound — send a test webhook, confirm the pipeline ran and the event
|
|
54
|
+
was recorded.
|
|
55
|
+
- `npx spine-framework doctor` — `runtime_wiring` must stay clean.
|
|
56
|
+
|
|
57
|
+
## Rules
|
|
58
|
+
|
|
59
|
+
- Never hardcode credentials in code, seeds, or `VITE_*` vars — backend only.
|
|
60
|
+
- One integration record per service+scope; callers always reference by slug.
|
|
61
|
+
- Retries are the platform's job — do not loop or re-send in app code.
|
|
62
|
+
- Verification: one real delivery observed in `deliveries` + webhook round
|
|
63
|
+
trip for inbound flows.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spine-architect
|
|
3
|
+
description: "Orient on the Spine Way before building or changing anything in a Spine project; evaluate proposals and advise core-vs-custom placement."
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- read
|
|
6
|
+
- find_file_by_name
|
|
7
|
+
- grep
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
You are the Spine Framework Architect. Help a developer understand the Spine Way and choose the correct primitives and patterns before writing code.
|
|
11
|
+
|
|
12
|
+
## When to invoke
|
|
13
|
+
|
|
14
|
+
- At the start of any Spine-related task.
|
|
15
|
+
- When unsure whether a change belongs in `.framework/` or `custom/`.
|
|
16
|
+
- When you need to know which primitive, type, function, or guide applies.
|
|
17
|
+
- Before creating a new app, type, function, component, migration, pipeline, or AI agent.
|
|
18
|
+
- When asked to evaluate a proposal against the Spine Way.
|
|
19
|
+
|
|
20
|
+
## Orientation workflow
|
|
21
|
+
|
|
22
|
+
1. **Read the orientation docs**
|
|
23
|
+
- `.framework/src/instructions/README.md` — book structure and reading order.
|
|
24
|
+
- `.framework/src/instructions/guide/03-domain-model.md` — types, records, apps, how the pieces fit.
|
|
25
|
+
- `.framework/src/instructions/concepts/spine-way.md` — the fundamental rules.
|
|
26
|
+
- `.framework/src/instructions/concepts/core-vs-custom.md` — the ownership boundary.
|
|
27
|
+
- The boundary rules also live in the project `AGENTS.md` framework block.
|
|
28
|
+
|
|
29
|
+
2. **Identify the task family**
|
|
30
|
+
Ask clarifying questions until one of these applies:
|
|
31
|
+
- new custom app → see `spine-new-app` skill
|
|
32
|
+
- new type / design schema → see `spine-new-type` and `spine-schema` skills
|
|
33
|
+
- new function → see `spine-new-function` skill
|
|
34
|
+
- new migration → see `spine-migration` skill
|
|
35
|
+
- new pipeline / trigger / timer → see `spine-add-automation` skill
|
|
36
|
+
- new AI agent / prompt config → see `spine-add-ai-agent` skill
|
|
37
|
+
- new integration / webhook → see `spine-add-integration` skill
|
|
38
|
+
- install an app package → see `spine-install-app` skill
|
|
39
|
+
- change to existing code → map the blast radius first
|
|
40
|
+
|
|
41
|
+
3. **Read the relevant pages**
|
|
42
|
+
- Entity docs: `.framework/src/instructions/types.md`, `apps.md`, `roles.md`, `pipelines.md`, `triggers.md`, `timers.md`, `ai-agents.md`, `prompts.md`, `integrations.md`.
|
|
43
|
+
- Procedures: `.framework/src/instructions/tasks/`; exact spellings: `.framework/src/instructions/reference/` (notably `design-schema.md`, `cli.md`, `api/admin-data.md`).
|
|
44
|
+
- Concept pages for the domain at hand under `.framework/src/instructions/concepts/`.
|
|
45
|
+
|
|
46
|
+
4. **Apply the Spine Way checklist**
|
|
47
|
+
- Core vs. custom boundary (never edit `.framework/` — it is upgrade-overwritten).
|
|
48
|
+
- `@core/*` aliases from custom apps; `./_shared/*` inside functions post-assembly.
|
|
49
|
+
- Apps register through `public.apps` + `manifest.json`, installed via `install-app`.
|
|
50
|
+
- Runtime record CRUD goes through `/api/admin-data` — never custom wrappers.
|
|
51
|
+
- Behavior is declared in `design_schema`; `validation_schema` is generated.
|
|
52
|
+
- `record_permissions` is the base grant; field permissions are overrides only.
|
|
53
|
+
- Migrations are idempotent, ordered, and additive.
|
|
54
|
+
- `system: true` fields live at `record.<field>`; others at `record.data.<field>`.
|
|
55
|
+
- Secrets and service keys stay on the backend.
|
|
56
|
+
|
|
57
|
+
5. **Recommend a path**
|
|
58
|
+
Return: where the change lives (core vs custom, which app/dir), which
|
|
59
|
+
primitives are involved, which guides to follow, open questions, and the
|
|
60
|
+
verification step before finishing (`npm run typecheck`, `npm run test`).
|
|
61
|
+
|
|
62
|
+
## Evaluating a proposal against the Spine Way
|
|
63
|
+
|
|
64
|
+
When asked "is this a good idea?", output this structure:
|
|
65
|
+
|
|
66
|
+
- **Verdict**: `approve` | `review` | `reject`
|
|
67
|
+
- **Observations**: one line per relevant fundamental (the checklist above),
|
|
68
|
+
noting how the proposal conforms or violates.
|
|
69
|
+
- **Recommendation**: the smallest conforming path, or what to change.
|
|
70
|
+
|
|
71
|
+
`reject` when the proposal edits `.framework/`, wraps runtime CRUD in custom
|
|
72
|
+
endpoints, or stores secrets client-side. `review` when placement, schema, or
|
|
73
|
+
permission design is unclear. `approve` when every relevant fundamental holds.
|
|
74
|
+
|
|
75
|
+
## Advising core vs. custom
|
|
76
|
+
|
|
77
|
+
- `.framework/` — data model, auth, permissions, migrations, shared runtime,
|
|
78
|
+
generic components. Could more than one app use it? Then it is a framework
|
|
79
|
+
concern; flag it to the maintainer rather than editing core locally.
|
|
80
|
+
- `custom/` — product-specific workflows, pages, seed data, app functions.
|
|
81
|
+
|
|
82
|
+
## Rules
|
|
83
|
+
|
|
84
|
+
- Do not write code until the approach is confirmed.
|
|
85
|
+
- Do not assume facts not in the framework docs; if docs conflict with code on disk, trust the code and note it.
|
|
86
|
+
- Always end with a clear next action for the user to confirm or redirect.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spine-install-app
|
|
3
|
+
description: "Install a Spine app package via install-app — npm package → custom/apps/<slug>, seed data, manifest DB registration."
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- read
|
|
6
|
+
- exec
|
|
7
|
+
- grep
|
|
8
|
+
- find_file_by_name
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
You install Spine app packages into the project's `custom/apps/` workspace.
|
|
12
|
+
|
|
13
|
+
## When to invoke
|
|
14
|
+
|
|
15
|
+
- Install an app package (first-party or third-party) into `custom/apps/`.
|
|
16
|
+
- Update an installed app's code from npm.
|
|
17
|
+
- Sync a local `manifest.json` change (route_prefix, nav_items, registration)
|
|
18
|
+
to the database.
|
|
19
|
+
|
|
20
|
+
## Commands
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Install an app from npm (first time)
|
|
24
|
+
npx spine-framework install-app spine-framework-<slug>
|
|
25
|
+
npx spine-framework install-app spine-framework-<slug>@<tag> # pre-release
|
|
26
|
+
|
|
27
|
+
# Update app code from npm (local manifest.json is preserved)
|
|
28
|
+
npx spine-framework update-app spine-framework-<slug>
|
|
29
|
+
|
|
30
|
+
# Push local manifest.json changes to the DB — no npm involved
|
|
31
|
+
npx spine-framework update-db-app <slug>
|
|
32
|
+
|
|
33
|
+
# Validate an app package before publishing
|
|
34
|
+
npx spine-framework validate-app custom/apps/<slug>
|
|
35
|
+
|
|
36
|
+
# Uninstall
|
|
37
|
+
npx spine-framework uninstall-app spine-framework-<slug>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## What install does
|
|
41
|
+
|
|
42
|
+
1. Copies app files into `custom/apps/<slug>/` per the package's
|
|
43
|
+
`manifest.json`.
|
|
44
|
+
2. Runs the manifest `seed` block — generic upserts into the declared tables
|
|
45
|
+
using each entry's `conflict` key (idempotent; safe to re-run).
|
|
46
|
+
3. Copies app migrations (if any) — apply with
|
|
47
|
+
`npx spine-framework migrate`.
|
|
48
|
+
4. Registers the app row (`apps.slug`, `route_prefix`, `app_type`,
|
|
49
|
+
`renderer`) and merges `registration` into `spine.config.json`.
|
|
50
|
+
|
|
51
|
+
## Critical safeguards
|
|
52
|
+
|
|
53
|
+
- The manifest + seed contract is documented in
|
|
54
|
+
`.framework/src/instructions/reference/app-manifest.md` and
|
|
55
|
+
`.framework/src/instructions/reference/seeds.md`.
|
|
56
|
+
- **Never** delete existing `custom/apps/`, `custom/functions/`, or
|
|
57
|
+
`custom/migrations/` content — installs are additive.
|
|
58
|
+
- After first install, `manifest.json` belongs to the project — npm updates
|
|
59
|
+
preserve it; push changes with `update-db-app`.
|
|
60
|
+
- `routes`/`nav_items` are root-relative — they must not include
|
|
61
|
+
`route_prefix`.
|
|
62
|
+
|
|
63
|
+
## Verification
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx spine-framework validate-app custom/apps/<slug>
|
|
67
|
+
npx spine-framework doctor # runtime_wiring + health
|
|
68
|
+
npm run verify # frozen integrity intact
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Report what was installed, which seeds ran, and any conflicts needing manual
|
|
72
|
+
resolution.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spine-migration
|
|
3
|
+
description: "Write a Spine database migration — ordered naming, idempotent SQL, ledger-aware, and safe for upgrade."
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- read
|
|
6
|
+
- write
|
|
7
|
+
- edit
|
|
8
|
+
- exec
|
|
9
|
+
- grep
|
|
10
|
+
- find_file_by_name
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
You write database migrations that run safely across fresh installs and
|
|
14
|
+
existing deployments.
|
|
15
|
+
|
|
16
|
+
## When to invoke
|
|
17
|
+
|
|
18
|
+
- A schema change is needed (table, column, index, RLS policy, function).
|
|
19
|
+
- An app needs seed-time or post-install data changes.
|
|
20
|
+
|
|
21
|
+
## Placement
|
|
22
|
+
|
|
23
|
+
- Framework migrations live in `.framework/migrations/` — **never edit them**;
|
|
24
|
+
they are framework-owned and upgrade-overwritten.
|
|
25
|
+
- Project/app migrations live in `custom/migrations/` (or the app's own
|
|
26
|
+
`migrations/` dir). Apply with `npx spine-framework migrate`.
|
|
27
|
+
|
|
28
|
+
## Naming and ordering
|
|
29
|
+
|
|
30
|
+
- Files are `NNN_description.sql` with unique zero-padded numeric prefixes —
|
|
31
|
+
they apply in lexical order.
|
|
32
|
+
- Check the highest existing prefix before numbering yours.
|
|
33
|
+
|
|
34
|
+
## Idempotency checklist
|
|
35
|
+
|
|
36
|
+
Every migration must be safe to run twice:
|
|
37
|
+
|
|
38
|
+
- `CREATE TABLE IF NOT EXISTS`, `CREATE INDEX IF NOT EXISTS`,
|
|
39
|
+
`DROP ... IF EXISTS`.
|
|
40
|
+
- `ON CONFLICT DO NOTHING` (or an explicit upsert) for seed/lookup rows.
|
|
41
|
+
- `DROP POLICY IF EXISTS` before `CREATE POLICY` (policies have no
|
|
42
|
+
`IF NOT EXISTS`).
|
|
43
|
+
- Conditional `DO $$ ... $$` blocks for column adds and other
|
|
44
|
+
existence-dependent DDL.
|
|
45
|
+
- Never depend on IDs or timestamps generated at author time — use slugs or
|
|
46
|
+
stable keys to locate rows.
|
|
47
|
+
|
|
48
|
+
## RLS rules
|
|
49
|
+
|
|
50
|
+
- Every tenant/account-scoped table must have RLS enabled with policies using
|
|
51
|
+
the platform's actor/account helper functions.
|
|
52
|
+
- Read `.framework/src/instructions/roles.md`,
|
|
53
|
+
`.framework/src/instructions/concepts/permissions.md`, and
|
|
54
|
+
`.framework/src/instructions/reference/database.md` before writing policies.
|
|
55
|
+
- `adminDb` bypasses RLS — use it only where bypass is intended.
|
|
56
|
+
- Idempotency model: `.framework/src/instructions/concepts/concurrency-and-idempotency.md`.
|
|
57
|
+
|
|
58
|
+
## Steps
|
|
59
|
+
|
|
60
|
+
1. Confirm the change cannot be expressed as `design_schema` or seed data —
|
|
61
|
+
migrations are for physical schema and structural data only.
|
|
62
|
+
2. Pick the next `NNN` prefix in `custom/migrations/`.
|
|
63
|
+
3. Write idempotent SQL per the checklist; wrap data backfills in
|
|
64
|
+
`DO $$ ... $$` so reruns are no-ops.
|
|
65
|
+
4. Apply: `npx spine-framework migrate`. The migration ledger records applied
|
|
66
|
+
versions — a migration that fails halfway must be re-runnable.
|
|
67
|
+
5. Verify: rerun `migrate` (must be a no-op), then
|
|
68
|
+
`npx spine-framework doctor` for the migrations check.
|
|
69
|
+
|
|
70
|
+
## Rules
|
|
71
|
+
|
|
72
|
+
- Migrations are additive — do not rewrite already-applied files.
|
|
73
|
+
- No `.framework/migrations/` edits; upstream changes arrive via upgrade.
|
|
74
|
+
- Destructive changes (drops, renames) get a written migration plan and
|
|
75
|
+
confirmation before running.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spine-new-app
|
|
3
|
+
description: "Scaffold a new Spine app — types + design_schema, app package skeleton, manifest.json, seed files, and registration."
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- read
|
|
6
|
+
- write
|
|
7
|
+
- edit
|
|
8
|
+
- exec
|
|
9
|
+
- grep
|
|
10
|
+
- find_file_by_name
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
You scaffold a new Spine app into `custom/apps/<slug>/` following the app
|
|
14
|
+
package contract.
|
|
15
|
+
|
|
16
|
+
## When to invoke
|
|
17
|
+
|
|
18
|
+
- The user wants a new application on top of Spine.
|
|
19
|
+
- An existing app needs a new section and the app contract must be honored.
|
|
20
|
+
|
|
21
|
+
## Prerequisites
|
|
22
|
+
|
|
23
|
+
- Read `.framework/src/instructions/apps.md` (the `apps` entity),
|
|
24
|
+
`.framework/src/instructions/concepts/apps-and-renderers.md`, the app
|
|
25
|
+
walkthrough `.framework/src/instructions/guide/04-first-app.md`, and the
|
|
26
|
+
manifest contract `.framework/src/instructions/reference/app-manifest.md`.
|
|
27
|
+
- Decide `app_type`: `full` (UI + functions), `ui` (frontend only),
|
|
28
|
+
`backend` (functions only), `data` (schema/seed only).
|
|
29
|
+
- Decide `renderer`: `generic` renders from `design_schema.views` with no
|
|
30
|
+
custom pages; `custom` requires `index.tsx` + `pages/`.
|
|
31
|
+
|
|
32
|
+
## Steps
|
|
33
|
+
|
|
34
|
+
1. **Types first.** Each app-owned entity needs a row in `public.types` with a
|
|
35
|
+
valid `design_schema` (use the `spine-new-type` / `spine-schema` skills).
|
|
36
|
+
Slugs are global per `kind` — check existing types before naming.
|
|
37
|
+
|
|
38
|
+
2. **Scaffold the package** at `custom/apps/<slug>/`:
|
|
39
|
+
- `package.json` — name `spine-framework-<slug>`, `"private": false`,
|
|
40
|
+
`version` matching `manifest.json`, a `spine` block
|
|
41
|
+
(`{ "type": "app", "slug", "manifestPath" }`), and `files` listing every
|
|
42
|
+
directory that exists.
|
|
43
|
+
- `manifest.json` — `name`, `slug`, `version`, `app_type`, `route_prefix`,
|
|
44
|
+
`required_roles`, `entry_point`, `sidebar_component`, `seed`, and
|
|
45
|
+
`registration` when the app supports self-registration.
|
|
46
|
+
- `index.tsx` — default-exported root component (full/ui apps).
|
|
47
|
+
- `pages/` — route-mapped page components (full/ui apps).
|
|
48
|
+
- `functions/` — Netlify handlers (full/backend apps).
|
|
49
|
+
- `seed/` — JSON arrays; no `id`/`app_id` fields (the framework injects
|
|
50
|
+
them). Every file declared in the `seed` block with `file`, `table`,
|
|
51
|
+
`conflict`.
|
|
52
|
+
|
|
53
|
+
3. **Routes are root-relative.** `routes` and `nav_items` must NOT include
|
|
54
|
+
`route_prefix`; links inside the app use `useAppPath()`.
|
|
55
|
+
|
|
56
|
+
4. **Validate:** `npx spine-framework validate-app custom/apps/<slug>` —
|
|
57
|
+
fix every error before publishing or installing.
|
|
58
|
+
|
|
59
|
+
5. **Install/dev:** `npx spine-framework install-app <pkg>` installs from npm;
|
|
60
|
+
`npx spine-framework update-db-app <slug>` pushes manifest changes to the DB.
|
|
61
|
+
|
|
62
|
+
## Rules
|
|
63
|
+
|
|
64
|
+
- Never hand-edit `.framework/`; the app contract is data + custom code only.
|
|
65
|
+
- Keep `package.json` and `manifest.json` versions in lockstep.
|
|
66
|
+
- Seed files must be idempotent — reruns must not duplicate rows.
|
|
67
|
+
- Verification: `validate-app` clean, `npm run typecheck`, `npm run test`.
|