spine-framework 0.3.124 → 0.3.126
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/.framework/cli/commands/agents.ts +35 -37
- package/.framework/cli/commands/auth.ts +35 -34
- package/.framework/cli/commands/create-app.ts +104 -40
- package/.framework/cli/commands/dev.ts +104 -69
- package/.framework/cli/commands/doctor.ts +179 -69
- package/.framework/cli/commands/generate.ts +83 -143
- package/.framework/cli/commands/init.ts +72 -34
- package/.framework/cli/commands/install-app.ts +260 -125
- package/.framework/cli/commands/items.ts +33 -44
- package/.framework/cli/commands/migrate.ts +122 -40
- package/.framework/cli/commands/migrations.ts +33 -40
- package/.framework/cli/commands/pipelines.ts +31 -39
- package/.framework/cli/commands/status.ts +47 -23
- package/.framework/cli/commands/system.ts +47 -37
- package/.framework/cli/commands/test.ts +112 -68
- package/.framework/cli/commands/validate-app.ts +215 -121
- package/.framework/cli/context.ts +112 -130
- package/.framework/cli/env-loader.ts +47 -18
- package/.framework/cli/index.ts +81 -42
- package/.framework/docs/runtime-types.md +1024 -0
- package/.framework/functions/_shared/agent-runner.ts +1296 -961
- package/.framework/functions/_shared/app-manifest.ts +82 -68
- package/.framework/functions/_shared/audit.ts +135 -83
- package/.framework/functions/_shared/{cil-state.ts → cil.ts} +158 -56
- package/.framework/functions/_shared/db.ts +80 -126
- package/.framework/functions/_shared/hash-api-key.ts +63 -0
- package/.framework/functions/_shared/index.ts +224 -335
- package/.framework/functions/_shared/kb.ts +319 -0
- package/.framework/functions/_shared/llm.ts +92 -0
- package/.framework/functions/_shared/logging.ts +288 -0
- package/.framework/functions/_shared/middleware.ts +329 -365
- package/.framework/functions/_shared/outcomes.ts +36 -0
- package/.framework/functions/_shared/permissions.ts +359 -643
- package/.framework/functions/_shared/pipeline-runner.ts +243 -316
- package/.framework/functions/_shared/principal.ts +376 -468
- package/.framework/functions/_shared/resolve-credentials.ts +102 -0
- package/.framework/functions/_shared/resolve-ids.ts +188 -16
- package/.framework/functions/_shared/retry-deliveries.ts +104 -0
- package/.framework/functions/_shared/schema-utils.ts +611 -373
- package/.framework/functions/_shared/testing.ts +207 -137
- package/.framework/functions/_shared/tracing.ts +276 -0
- package/.framework/functions/_shared/trigger-engine.ts +159 -211
- package/.framework/functions/_shared/webhook-registration.ts +95 -81
- package/.framework/functions/_shared/webhook-registry.ts +153 -75
- package/.framework/functions/account-nodes.ts +31 -53
- package/.framework/functions/adapters/generic-webhook-inbound.ts +56 -0
- package/.framework/functions/adapters/generic-webhook-outbound.ts +43 -0
- package/.framework/functions/adapters/openai-outbound.ts +40 -0
- package/.framework/functions/admin-data.ts +685 -537
- package/.framework/functions/admin-funnel.ts +31 -20
- package/.framework/functions/admin-install-funnel.ts +47 -28
- package/.framework/functions/admin-signals.ts +47 -29
- package/.framework/functions/ai-agents.ts +122 -147
- package/.framework/functions/ai-interactions.ts +180 -90
- package/.framework/functions/api-keys.ts +250 -192
- package/.framework/functions/apps.ts +203 -197
- package/.framework/functions/auth.ts +98 -91
- package/.framework/functions/cil-agent-ingest.ts +773 -0
- package/.framework/functions/cil-agent.ts +592 -0
- package/.framework/functions/cil-callmap.ts +1227 -0
- package/.framework/functions/cil-config.ts +583 -0
- package/.framework/functions/cil-context.ts +445 -0
- package/.framework/functions/cil-doc.ts +1752 -0
- package/.framework/functions/cil-embeddings.ts +1202 -0
- package/.framework/functions/cil-graph.ts +585 -0
- package/.framework/functions/cil-ingest.ts +2416 -0
- package/.framework/functions/cil-pipeline.ts +318 -0
- package/.framework/functions/cil-project.ts +499 -0
- package/.framework/functions/cil-validate.ts +469 -0
- package/.framework/functions/debug-auth.ts +73 -53
- package/.framework/functions/deliveries.ts +117 -0
- package/.framework/functions/embeddings.ts +528 -516
- package/.framework/functions/eval-harness.ts +158 -106
- package/.framework/functions/integration-outbound.ts +311 -0
- package/.framework/functions/integration-routes.ts +240 -466
- package/.framework/functions/integrations.ts +132 -140
- package/.framework/functions/invites.ts +401 -201
- package/.framework/functions/item-progress.ts +113 -53
- package/.framework/functions/kb.ts +28 -0
- package/.framework/functions/logs.ts +239 -222
- package/.framework/functions/observability.ts +308 -259
- package/.framework/functions/pipeline-executions.ts +179 -235
- package/.framework/functions/pipelines.ts +163 -205
- package/.framework/functions/prompt-configs.ts +109 -156
- package/.framework/functions/roles.ts +97 -147
- package/.framework/functions/system-cron.ts +132 -218
- package/.framework/functions/system.ts +112 -52
- package/.framework/functions/tests.ts +32 -28
- package/.framework/functions/timers.ts +162 -210
- package/.framework/functions/triggers.ts +282 -346
- package/.framework/functions/types.ts +283 -400
- package/.framework/migrations/001_core_schema.sql +630 -0
- package/.framework/migrations/002_core_rls_and_functions.sql +532 -0
- package/.framework/migrations/{003_system_data.sql → 003_core_system_data.sql} +26 -153
- package/.framework/migrations/004_core_rpc_and_broker.sql +421 -0
- package/.framework/migrations/005_core_observability.sql +598 -0
- package/.framework/migrations/006_security_hardening_rls.sql +97 -0
- package/.framework/migrations/007_kb_article_list.sql +237 -0
- package/.framework/migrations/008_items_target.sql +8 -0
- package/.framework/migrations/009_roles_slug_unique.sql +11 -0
- package/.framework/public/spine.config.json +91 -0
- package/.framework/scripts/app-install-cli.ts +112 -98
- package/.framework/src/App.tsx +67 -20
- package/.framework/src/apps/admin/index.tsx +97 -27
- package/.framework/src/components/AppWrapper.tsx +50 -11
- package/.framework/src/components/CustomAppLoader.tsx +131 -22
- package/.framework/src/components/admin/AdminListPage.tsx +75 -8
- package/.framework/src/components/admin/AdminSidebar.tsx +148 -36
- package/.framework/src/components/admin/AdminStatsCard.tsx +48 -29
- package/.framework/src/components/admin/PageInstructions.tsx +49 -0
- package/.framework/src/components/admin/SortableTableHeader.tsx +49 -2
- package/.framework/src/components/app-shell/GenericAppShell.tsx +69 -11
- package/.framework/src/components/app-shell/GenericDetailPage.tsx +55 -10
- package/.framework/src/components/app-shell/GenericListPage.tsx +76 -9
- package/.framework/src/components/app-sidebar.tsx +50 -3
- package/.framework/src/components/auth/ProtectedRoute.tsx +53 -45
- package/.framework/src/components/kb/KBArticleEditor.tsx +409 -0
- package/.framework/src/components/kb/KBArticleList.tsx +557 -0
- package/.framework/src/components/layout/AppShell.tsx +54 -16
- package/.framework/src/components/layout/Header.tsx +50 -38
- package/.framework/src/components/layout/Layout.tsx +48 -32
- package/.framework/src/components/layout/Sidebar.tsx +167 -16
- package/.framework/src/components/runtime/DataDetailHeader.tsx +33 -1
- package/.framework/src/components/runtime/DataDetailPage.tsx +289 -4
- package/.framework/src/components/runtime/DataFilters.tsx +78 -1
- package/.framework/src/components/runtime/DataHeader.tsx +32 -29
- package/.framework/src/components/runtime/DataListPage.tsx +161 -2
- package/.framework/src/components/runtime/DataStats.tsx +48 -1
- package/.framework/src/components/runtime/DataTable.tsx +153 -1
- package/.framework/src/components/runtime/SchemaDetailForm.tsx +77 -46
- package/.framework/src/components/runtime/index.ts +16 -9
- package/.framework/src/components/search-form.tsx +33 -1
- package/.framework/src/components/shared/AgentView.tsx +48 -51
- package/.framework/src/components/shared/FieldRenderer.tsx +84 -67
- package/.framework/src/components/shared/InviteManager.tsx +113 -52
- package/.framework/src/components/shared/MemberList.tsx +182 -0
- package/.framework/src/components/shared/SchemaFields.tsx +96 -78
- package/.framework/src/components/ui/DataTable.tsx +86 -56
- package/.framework/src/components/ui/Form.tsx +188 -109
- package/.framework/src/components/ui/ItemCard.tsx +86 -58
- package/.framework/src/components/ui/ItemListView.tsx +88 -61
- package/.framework/src/components/ui/LoadingSpinner.tsx +52 -27
- package/.framework/src/components/ui/Modal.tsx +81 -4
- package/.framework/src/components/ui/RichTextEditor.tsx +101 -9
- package/.framework/src/components/ui/accordion.tsx +97 -5
- package/.framework/src/components/ui/alert-dialog.tsx +225 -13
- package/.framework/src/components/ui/alert.tsx +113 -6
- package/.framework/src/components/ui/aspect-ratio.tsx +49 -2
- package/.framework/src/components/ui/avatar.tsx +129 -7
- package/.framework/src/components/ui/badge.tsx +65 -3
- package/.framework/src/components/ui/breadcrumb.tsx +145 -8
- package/.framework/src/components/ui/button-group.tsx +81 -4
- package/.framework/src/components/ui/button.tsx +49 -2
- package/.framework/src/components/ui/calendar.tsx +65 -3
- package/.framework/src/components/ui/card.tsx +145 -8
- package/.framework/src/components/ui/carousel.tsx +129 -7
- package/.framework/src/components/ui/chart.tsx +161 -10
- package/.framework/src/components/ui/checkbox.tsx +49 -2
- package/.framework/src/components/ui/collapsible.tsx +81 -5
- package/.framework/src/components/ui/combobox.tsx +305 -20
- package/.framework/src/components/ui/command.tsx +177 -11
- package/.framework/src/components/ui/context-menu.tsx +273 -17
- package/.framework/src/components/ui/dialog.tsx +209 -27
- package/.framework/src/components/ui/direction.tsx +64 -4
- package/.framework/src/components/ui/drawer.tsx +193 -12
- package/.framework/src/components/ui/dropdown-menu.tsx +273 -18
- package/.framework/src/components/ui/empty.tsx +145 -9
- package/.framework/src/components/ui/field.tsx +209 -14
- package/.framework/src/components/ui/hover-card.tsx +81 -4
- package/.framework/src/components/ui/input-group.tsx +162 -10
- package/.framework/src/components/ui/input-otp.tsx +98 -5
- package/.framework/src/components/ui/input.tsx +49 -2
- package/.framework/src/components/ui/item.tsx +225 -13
- package/.framework/src/components/ui/kbd.tsx +65 -3
- package/.framework/src/components/ui/label.tsx +49 -2
- package/.framework/src/components/ui/menubar.tsx +289 -17
- package/.framework/src/components/ui/native-select.tsx +97 -5
- package/.framework/src/components/ui/navigation-menu.tsx +177 -10
- package/.framework/src/components/ui/pagination.tsx +161 -9
- package/.framework/src/components/ui/popover.tsx +145 -8
- package/.framework/src/components/ui/progress.tsx +49 -2
- package/.framework/src/components/ui/radio-group.tsx +65 -3
- package/.framework/src/components/ui/resizable.tsx +82 -4
- package/.framework/src/components/ui/scroll-area.tsx +65 -3
- package/.framework/src/components/ui/select.tsx +193 -11
- package/.framework/src/components/ui/separator.tsx +49 -2
- package/.framework/src/components/ui/sheet.tsx +193 -11
- package/.framework/src/components/ui/sidebar.tsx +481 -38
- package/.framework/src/components/ui/skeleton.tsx +49 -2
- package/.framework/src/components/ui/slider.tsx +49 -2
- package/.framework/src/components/ui/sonner.tsx +49 -2
- package/.framework/src/components/ui/spinner.tsx +49 -2
- package/.framework/src/components/ui/switch.tsx +49 -2
- package/.framework/src/components/ui/table-primitives.tsx +160 -33
- package/.framework/src/components/ui/table.tsx +161 -9
- package/.framework/src/components/ui/tabs.tsx +113 -6
- package/.framework/src/components/ui/textarea.tsx +49 -2
- package/.framework/src/components/ui/toggle-group.tsx +81 -4
- package/.framework/src/components/ui/toggle.tsx +65 -3
- package/.framework/src/components/ui/tooltip.tsx +97 -5
- package/.framework/src/contexts/AppContext.tsx +129 -45
- package/.framework/src/contexts/AuthContext.tsx +187 -144
- package/.framework/src/hooks/use-mobile.ts +48 -2
- package/.framework/src/hooks/useApi.ts +208 -159
- package/.framework/src/hooks/useAppPath.ts +32 -23
- package/.framework/src/hooks/useApps.ts +51 -20
- package/.framework/src/hooks/useEntityList.ts +32 -78
- package/.framework/src/hooks/useEntityRecord.ts +35 -96
- package/.framework/src/hooks/useForm.ts +32 -92
- package/.framework/src/hooks/useListSchema.ts +49 -78
- package/.framework/src/hooks/useSchemaRecord.ts +114 -105
- package/.framework/src/lib/api.ts +195 -116
- package/.framework/src/lib/supabase.ts +98 -64
- package/.framework/src/lib/utils.ts +287 -151
- package/.framework/src/main.tsx +49 -3
- package/.framework/src/pages/DashboardPage.tsx +52 -29
- package/.framework/src/pages/NotFoundPage.tsx +32 -10
- package/.framework/src/pages/SetupPage.tsx +32 -12
- package/.framework/src/pages/admin/AIAgentDetailPage.tsx +119 -10
- package/.framework/src/pages/admin/AIAgentsPage.tsx +48 -19
- package/.framework/src/pages/admin/APIKeyDetailPage.tsx +187 -17
- package/.framework/src/pages/admin/APIKeysPage.tsx +98 -22
- package/.framework/src/pages/admin/AlertsConfigPage.tsx +113 -26
- package/.framework/src/pages/admin/AppDetailPage.tsx +125 -8
- package/.framework/src/pages/admin/AppsPage.tsx +49 -2
- package/.framework/src/pages/admin/DeliveriesPage.tsx +196 -0
- package/.framework/src/pages/admin/DesignedPage.tsx +32 -18
- package/.framework/src/pages/admin/EmbeddingDetailPage.tsx +215 -484
- package/.framework/src/pages/admin/EmbeddingsPage.tsx +116 -319
- package/.framework/src/pages/admin/ExtendedShadcnTestPage.tsx +34 -9
- package/.framework/src/pages/admin/IncrementalShadcnTestPage.tsx +34 -9
- package/.framework/src/pages/admin/IntegratedDashboard.tsx +32 -16
- package/.framework/src/pages/admin/IntegrationDetailPage.tsx +183 -26
- package/.framework/src/pages/admin/IntegrationsPage.tsx +48 -19
- package/.framework/src/pages/admin/InvitesPage.tsx +48 -14
- package/.framework/src/pages/admin/LogsPage.tsx +422 -75
- package/.framework/src/pages/admin/MinimalShadcnTestPage.tsx +34 -9
- package/.framework/src/pages/admin/ObservabilityDashboard.tsx +113 -24
- package/.framework/src/pages/admin/PipelineDetailPage.tsx +206 -34
- package/.framework/src/pages/admin/PipelineExecutionsPage.tsx +50 -17
- package/.framework/src/pages/admin/PipelinesPage.tsx +160 -21
- package/.framework/src/pages/admin/PromptConfigDetailPage.tsx +378 -88
- package/.framework/src/pages/admin/PromptConfigsPage.tsx +125 -16
- package/.framework/src/pages/admin/ProperlyDesignedPage.tsx +49 -10
- package/.framework/src/pages/admin/RoleDetailPage.tsx +130 -10
- package/.framework/src/pages/admin/RolesPage.tsx +171 -18
- package/.framework/src/pages/admin/SelectTestPage.tsx +34 -9
- package/.framework/src/pages/admin/ShadcnTestPage.tsx +49 -11
- package/.framework/src/pages/admin/SimpleDashboard.tsx +49 -10
- package/.framework/src/pages/admin/TestRunDetailPage.tsx +49 -4
- package/.framework/src/pages/admin/TestingDashboard.tsx +98 -28
- package/.framework/src/pages/admin/TimerDetailPage.tsx +143 -33
- package/.framework/src/pages/admin/TimersPage.tsx +48 -20
- package/.framework/src/pages/admin/TriggerDetailPage.tsx +118 -30
- package/.framework/src/pages/admin/TriggersPage.tsx +64 -19
- package/.framework/src/pages/admin/TypeDetailPage.tsx +138 -15
- package/.framework/src/pages/admin/TypesPage.tsx +48 -20
- package/.framework/src/pages/admin/cil/CILAgentPage.tsx +465 -0
- package/.framework/src/pages/admin/cil/CILChunkDetailPage.tsx +787 -0
- package/.framework/src/pages/admin/cil/CILDashboardPage.tsx +699 -0
- package/.framework/src/pages/admin/cil/CILFileListPage.tsx +647 -0
- package/.framework/src/pages/admin/cil/CILGraphPage.tsx +616 -0
- package/.framework/src/pages/admin/cil/CILIngestionPage.tsx +1402 -0
- package/.framework/src/pages/admin/cil/CILProjectsPage.tsx +614 -0
- package/.framework/src/pages/admin/cil/CILSearchPage.tsx +571 -0
- package/.framework/src/pages/admin/cil/FlexiblePipelinePage.tsx +731 -0
- package/.framework/src/pages/admin/kb/KBAdminPage.tsx +64 -0
- package/.framework/src/pages/auth/AuthConfirmPage.tsx +52 -51
- package/.framework/src/pages/auth/ForgotPasswordPage.tsx +31 -22
- package/.framework/src/pages/auth/LoginPage.tsx +50 -23
- package/.framework/src/pages/auth/PendingApprovalPage.tsx +31 -15
- package/.framework/src/pages/auth/RegisterPage.tsx +281 -317
- package/.framework/src/pages/spine-framework/APIPage.tsx +33 -0
- package/.framework/src/pages/spine-framework/CLIPage.tsx +33 -0
- package/.framework/src/types/auth.ts +128 -71
- package/.framework/src/types/types.ts +373 -157
- package/custom/.devin/skills/spine-workbench-discovery/SKILL.md +39 -0
- package/custom/.devin/skills/spine-workbench-idea/SKILL.md +36 -0
- package/custom/.devin/skills/spine-workbench-implement/SKILL.md +46 -0
- package/custom/.devin/skills/spine-workbench-initiative/SKILL.md +28 -0
- package/custom/.devin/skills/spine-workbench-plan/SKILL.md +38 -0
- package/docs/README.md +9 -130
- package/netlify.toml +5 -2
- package/package.json +13 -25
- package/scripts/kb-ingest-docs.ts +203 -0
- package/spine.config.json +65 -4
- package/.framework/migrations/001_schema.sql +0 -425
- package/.framework/migrations/002_rls_and_functions.sql +0 -763
- package/.framework/migrations/004_enhancements.sql +0 -43
- package/.framework/migrations/005_auth_user_trigger.sql +0 -105
- package/.framework/migrations/006_fix_current_actor_id.sql +0 -21
- package/.framework/migrations/016_invites.sql +0 -27
- package/.framework/migrations/017_fix_get_account_apps.sql +0 -78
- package/.framework/migrations/018_apps_required_roles.sql +0 -17
- package/.framework/migrations/019_triggers_unique_constraint.sql +0 -13
- package/.framework/migrations/020_get_account_apps_role_filter.sql +0 -117
- package/.framework/migrations/021_app_domains.sql +0 -112
- package/.framework/migrations/022_route_prefix_domain_unique.sql +0 -21
- package/.framework/migrations/023_match_embeddings_rpc.sql +0 -78
- package/.framework/migrations/024_messages_account_id.sql +0 -9
- package/.framework/migrations/025_retype_threads_messages.sql +0 -240
- package/.framework/migrations/026_fix_rls_policies.sql +0 -47
- package/.framework/migrations/027_embedding_lifecycle.sql +0 -176
- package/.framework/migrations/028_fix_message_data_permissions.sql +0 -49
- package/.framework/migrations/029_tighten_support_triage_prompt.sql +0 -41
- package/.framework/migrations/030_messages_updated_by.sql +0 -6
- package/.framework/migrations/031_seed_upsert_constraints.sql +0 -35
- package/docs/APPS.md +0 -232
- package/docs/ARCHITECTURE.md +0 -246
- package/docs/INSTALL.md +0 -155
- package/docs/design-schema-spec.md +0 -1837
- package/docs/dev-guides/01-create-an-app.md +0 -183
- package/docs/dev-guides/02-create-a-function.md +0 -178
- package/docs/dev-guides/03-create-a-component.md +0 -178
- package/docs/dev-guides/04-webhook-handlers.md +0 -129
- package/docs/dev-guides/05-testing.md +0 -168
- package/docs/dev-guides/README.md +0 -40
- package/docs/npm-packages-plan.md +0 -288
- package/docs/spine-core--api-reference.md +0 -822
|
@@ -1,51 +1,39 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/**
|
|
3
|
-
* @module cli/commands/items
|
|
4
|
-
* @audience installer
|
|
5
|
-
* @layer cli
|
|
6
|
-
* @stability stable
|
|
7
|
-
*
|
|
8
|
-
* `spine items` command group. Direct CRUD access to the `items` table via
|
|
9
|
-
* `adminDb` (service-role, bypasses RLS). Use only in controlled environments;
|
|
10
|
-
* does NOT enforce field-level permissions or RLS for the principal.
|
|
11
|
-
*
|
|
12
|
-
* **Commands:**
|
|
13
|
-
* | Subcommand | Description |
|
|
14
|
-
* |------------------------------------------------|--------------------------------|
|
|
15
|
-
* | `items list [--type <slug>] [--account <id>]` | List items, filtered by type |
|
|
16
|
-
* | `items get <id>` | Fetch a single item by UUID |
|
|
17
|
-
* | `items create --type <slug> --data <json>` | Insert a new item |
|
|
18
|
-
* | `items update <id> --data <json>` | Patch item data fields |
|
|
19
|
-
* | `items delete <id> [--hard]` | Soft-delete or hard-delete |
|
|
20
|
-
*
|
|
21
|
-
* **Authorization note:** All commands use `adminDb` — no RLS enforcement.
|
|
22
|
-
* Account scoping is applied as a filter only; it does not restrict access.
|
|
23
|
-
*
|
|
24
|
-
* **Usage:**
|
|
25
|
-
* ```bash
|
|
26
|
-
* spine items list --type support_ticket --account <id> --limit 50
|
|
27
|
-
* spine items get <uuid>
|
|
28
|
-
* spine items create --type support_ticket --title "Bug report" --data '{"priority":"high"}'
|
|
29
|
-
* spine items update <uuid> --data '{"status":"resolved"}'
|
|
30
|
-
* spine items delete <uuid>
|
|
31
|
-
* spine items delete <uuid> --hard
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* @seeAlso cli/context.ts (buildCliContext)
|
|
35
|
-
* @seeAlso functions/admin-data.ts (API equivalent with RLS)
|
|
36
|
-
*/
|
|
37
1
|
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// CIL[BEGIN chunk_id="items_moduleheader_1784069813" type="module_header" identity="module_header" parent="none"]
|
|
5
|
+
// CIL[DOC-MACRO purpose="Module imports for item management CLI"]
|
|
6
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Provide CLI context and database access"]
|
|
7
|
+
// CIL[DOC-CONTEXT module="cli.commands.items" layer="cli" related_files="[\"custom/apps/cortex/pages/operations/OperationsDashboard.tsx\",\".framework/migrations/015_simplify_apps_table.sql\",\".framework/src/pages/admin/TypeDetailPage.tsx\",\".framework/functions/_shared/principal.ts\",\".framework/functions/_shared/schema-utils.ts\",\"\\\"]"]
|
|
8
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="imports" errors="none" side_effects="none"]
|
|
9
|
+
// CIL[DOC-MICRO logic_summary="Imports Commander types, CLI context utilities, and admin database" notable_decisions="[]"]
|
|
10
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
11
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
12
|
+
// CIL[DOC-AUDIENCE audience="developer"]
|
|
13
|
+
// CIL[DOC-VECTOR type="context" content="Layer: cli. Direct callers: 0. Direct calls: 0. Related files: custom/apps/cortex/pages/operations/OperationsDashboard.tsx, .framework/migrations/015_simplify_apps_table.sql, .framework/src/pages/admin/TypeDetailPage.tsx, .framework/functions/_shared/principal.ts, .framework/functions/_shared/schema-utils.ts, \."]
|
|
14
|
+
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
15
|
+
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
16
|
+
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
17
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
18
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
38
19
|
import type { Command } from 'commander'
|
|
39
20
|
import { buildCliContext, printResult, handleError } from '../context.ts'
|
|
40
21
|
import { adminDb } from '../../functions/_shared/index.ts'
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
22
|
+
// CIL[END chunk_id="items_moduleheader_1784069813"]
|
|
23
|
+
// CIL[BEGIN chunk_id="items_registeritemcommands_1784069813" type="function" identity="registerItemCommands" parent="none"]
|
|
24
|
+
// CIL[DOC-MACRO purpose="Register item management CLI commands"]
|
|
25
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Provide CRUD operations for item records"]
|
|
26
|
+
// CIL[DOC-CONTEXT module="cli.commands.items" layer="cli" related_files="[\".framework/src/pages/admin/TypeDetailPage.tsx\",\"\\\"]"]
|
|
27
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="CLI commands" errors="database errors" side_effects="database operations"]
|
|
28
|
+
// CIL[DOC-MICRO logic_summary="Registers list, get, create, update, delete commands for items table" notable_decisions="[]"]
|
|
29
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
30
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
31
|
+
// CIL[DOC-VECTOR type="context" content="Layer: cli. Direct callers: 0. Direct calls: 0. Related files: .framework/src/pages/admin/TypeDetailPage.tsx, \."]
|
|
32
|
+
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
33
|
+
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
34
|
+
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
35
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
36
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
49
37
|
export function registerItemCommands(program: Command) {
|
|
50
38
|
const items = program
|
|
51
39
|
.command('items')
|
|
@@ -251,3 +239,4 @@ export function registerItemCommands(program: Command) {
|
|
|
251
239
|
}
|
|
252
240
|
})
|
|
253
241
|
}
|
|
242
|
+
// CIL[END chunk_id="items_registeritemcommands_1784069813"]
|
|
@@ -1,24 +1,28 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/**
|
|
3
|
-
* @module cli/commands/migrate
|
|
4
|
-
* @audience installer
|
|
5
|
-
* @layer cli
|
|
6
|
-
* @stability stable
|
|
7
|
-
*
|
|
8
|
-
* `spine-framework migrate` — Apply SQL migrations to a Supabase project
|
|
9
|
-
* via a direct Postgres connection.
|
|
10
|
-
*
|
|
11
|
-
* Requires SUPABASE_DB_PASSWORD in .env (or --db-password flag).
|
|
12
|
-
* Get it from: https://supabase.com/dashboard/project/_/settings/database
|
|
13
|
-
*
|
|
14
|
-
* **Usage:**
|
|
15
|
-
* ```bash
|
|
16
|
-
* npx spine-framework migrate
|
|
17
|
-
* npx spine-framework migrate --dry-run
|
|
18
|
-
* npx spine-framework migrate --db-password <password>
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
1
|
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
// CIL[BEGIN chunk_id="migrate_moduleheader_1784069813" type="module_header" identity="module_header" parent="none"]
|
|
12
|
+
// CIL[DOC-MACRO purpose="Module imports and types for migration CLI"]
|
|
13
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Provide filesystem utilities and migration interfaces"]
|
|
14
|
+
// CIL[DOC-CONTEXT module="cli.commands.migrate" layer="cli" related_files="[\".framework/migrations/015_simplify_apps_table.sql\",\"custom/apps/cortex/pages/operations/OperationsDashboard.tsx\",\"custom/apps/portal/pages/ContentPage.tsx\",\".framework/src/pages/admin/TypeDetailPage.tsx\",\".framework/functions/_shared/principal.ts\",\"\\\"]"]
|
|
15
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="imports and types" errors="none" side_effects="none"]
|
|
16
|
+
// CIL[DOC-MICRO logic_summary="Imports Node.js modules and defines MigrateOptions interface" notable_decisions="[]"]
|
|
17
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
18
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
19
|
+
// CIL[DOC-AUDIENCE audience="developer"]
|
|
20
|
+
// CIL[DOC-VECTOR type="context" content="Layer: cli. Direct callers: 0. Direct calls: 0. Related files: .framework/migrations/015_simplify_apps_table.sql, custom/apps/cortex/pages/operations/OperationsDashboard.tsx, custom/apps/portal/pages/ContentPage.tsx, .framework/src/pages/admin/TypeDetailPage.tsx, .framework/functions/_shared/principal.ts, \."]
|
|
21
|
+
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
22
|
+
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
23
|
+
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
24
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
25
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
22
26
|
import type { Command } from 'commander'
|
|
23
27
|
import { existsSync, readdirSync, readFileSync } from 'fs'
|
|
24
28
|
import { resolve, dirname, join } from 'path'
|
|
@@ -34,12 +38,21 @@ interface MigrateOptions {
|
|
|
34
38
|
dryRun: boolean
|
|
35
39
|
frameworkOnly: boolean
|
|
36
40
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
// CIL[END chunk_id="migrate_moduleheader_1784069813"]
|
|
42
|
+
// CIL[BEGIN chunk_id="migrate_runmigrations_1784069813" type="function" identity="runMigrations" parent="none"]
|
|
43
|
+
// CIL[DOC-MACRO purpose="Execute database migrations via direct PostgreSQL connection"]
|
|
44
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Apply pending SQL migrations to database"]
|
|
45
|
+
// CIL[DOC-CONTEXT module="cli.commands.migrate" layer="cli" related_files="[\".framework/migrations/015_simplify_apps_table.sql\",\".framework/src/pages/admin/RolesPage.tsx\",\"\\\"]"]
|
|
46
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="migration results" errors="database errors" side_effects="database writes"]
|
|
47
|
+
// CIL[DOC-MICRO logic_summary="Connects to PostgreSQL, creates migration tracking table, applies SQL files" notable_decisions="[]"]
|
|
48
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
49
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
50
|
+
// CIL[DOC-VECTOR type="context" content="Layer: cli. Direct callers: 0. Direct calls: 0. Related files: .framework/migrations/015_simplify_apps_table.sql, .framework/src/pages/admin/RolesPage.tsx, \."]
|
|
51
|
+
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
52
|
+
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
53
|
+
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
54
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
55
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
43
56
|
export async function runMigrations(opts: { frameworkOnly?: boolean } = {}): Promise<{ applied: number; skipped: number; failed: number } | null> {
|
|
44
57
|
const supabaseUrl = process.env.SUPABASE_URL
|
|
45
58
|
if (!supabaseUrl || supabaseUrl.includes('placeholder') || supabaseUrl.includes('your-project')) {
|
|
@@ -107,11 +120,25 @@ export async function runMigrations(opts: { frameworkOnly?: boolean } = {}): Pro
|
|
|
107
120
|
await client.end()
|
|
108
121
|
return { applied, skipped, failed }
|
|
109
122
|
}
|
|
110
|
-
|
|
123
|
+
// CIL[END chunk_id="migrate_runmigrations_1784069813"]
|
|
124
|
+
// CIL[BEGIN chunk_id="migrate_migratecommand_1784069813" type="function" identity="migrateCommand" parent="none"]
|
|
125
|
+
// CIL[DOC-MACRO purpose="Handle migration command execution with validation"]
|
|
126
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Validate environment and orchestrate migration process"]
|
|
127
|
+
// CIL[DOC-CONTEXT module="cli.commands.migrate" layer="cli" related_files="[\".framework/functions/_shared/schema-utils.ts\",\".framework/migrations/015_simplify_apps_table.sql\",\".framework/src/pages/admin/TypeDetailPage.tsx\",\"\\\"]"]
|
|
128
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="migration execution" errors="validation errors" side_effects="process exit"]
|
|
129
|
+
// CIL[DOC-MICRO logic_summary="Validates env vars, loads migrations, handles dry-run and execution" notable_decisions="[]"]
|
|
130
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
131
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
132
|
+
// CIL[DOC-VECTOR type="context" content="Layer: cli. Direct callers: 0. Direct calls: 0. Related files: .framework/functions/_shared/schema-utils.ts, .framework/migrations/015_simplify_apps_table.sql, .framework/src/pages/admin/TypeDetailPage.tsx, \."]
|
|
133
|
+
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
134
|
+
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
135
|
+
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
136
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
137
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
111
138
|
async function migrateCommand(options: MigrateOptions): Promise<void> {
|
|
112
139
|
console.log('\nRunning Spine Framework migrations...\n')
|
|
113
140
|
|
|
114
|
-
|
|
141
|
+
|
|
115
142
|
loadEnv()
|
|
116
143
|
|
|
117
144
|
const envPath = join(PROJECT_ROOT, '.env')
|
|
@@ -144,7 +171,7 @@ async function migrateCommand(options: MigrateOptions): Promise<void> {
|
|
|
144
171
|
process.exit(1)
|
|
145
172
|
}
|
|
146
173
|
|
|
147
|
-
|
|
174
|
+
|
|
148
175
|
if (options.dbPassword) process.env.SUPABASE_DB_PASSWORD = options.dbPassword
|
|
149
176
|
|
|
150
177
|
const migrationFiles = collectMigrations(options.frameworkOnly)
|
|
@@ -183,7 +210,21 @@ async function migrateCommand(options: MigrateOptions): Promise<void> {
|
|
|
183
210
|
console.log(' npx spine-framework install-app spine-framework-portal@latest')
|
|
184
211
|
console.log(' npm install && npm run assemble && netlify dev\n')
|
|
185
212
|
}
|
|
186
|
-
|
|
213
|
+
// CIL[END chunk_id="migrate_migratecommand_1784069813"]
|
|
214
|
+
// CIL[BEGIN chunk_id="migrate_registermigratecommands_1784069813" type="function" identity="registerMigrateCommands" parent="none"]
|
|
215
|
+
// CIL[DOC-MACRO purpose="Register migrate command with CLI program"]
|
|
216
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Provide CLI interface for database migrations"]
|
|
217
|
+
// CIL[DOC-CONTEXT module="cli.commands.migrate" layer="cli" related_files="[\".framework/functions/_shared/schema-utils.ts\",\".framework/src/components/ui/dialog.tsx\",\".framework/functions/_shared/principal.ts\",\".framework/src/components/ui/table-primitives.tsx\",\".framework/src/pages/admin/TypeDetailPage.tsx\",\"\\\"]"]
|
|
218
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="CLI command registration" errors="command errors" side_effects="none"]
|
|
219
|
+
// CIL[DOC-MICRO logic_summary="Registers migrate command with db-password, dry-run, and framework-only options" notable_decisions="[]"]
|
|
220
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
221
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
222
|
+
// CIL[DOC-VECTOR type="context" content="Layer: cli. Direct callers: 0. Direct calls: 0. Related files: .framework/functions/_shared/schema-utils.ts, .framework/src/components/ui/dialog.tsx, .framework/functions/_shared/principal.ts, .framework/src/components/ui/table-primitives.tsx, .framework/src/pages/admin/TypeDetailPage.tsx, \."]
|
|
223
|
+
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
224
|
+
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
225
|
+
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
226
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
227
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
187
228
|
export function registerMigrateCommands(program: Command) {
|
|
188
229
|
program
|
|
189
230
|
.command('migrate')
|
|
@@ -201,9 +242,21 @@ export function registerMigrateCommands(program: Command) {
|
|
|
201
242
|
}
|
|
202
243
|
})
|
|
203
244
|
}
|
|
204
|
-
|
|
205
|
-
//
|
|
206
|
-
|
|
245
|
+
// CIL[END chunk_id="migrate_registermigratecommands_1784069813"]
|
|
246
|
+
// CIL[BEGIN chunk_id="migrate_loadenv_1784069813" type="function" identity="loadEnv" parent="none"]
|
|
247
|
+
// CIL[DOC-MACRO purpose="Load environment variables from .env file"]
|
|
248
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Parse and set environment variables"]
|
|
249
|
+
// CIL[DOC-CONTEXT module="cli.commands.migrate" layer="cli" related_files="[\"\\\"]"]
|
|
250
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="process.env updates" errors="file read errors" side_effects="process.env mutation"]
|
|
251
|
+
// CIL[DOC-MICRO logic_summary="Reads .env file, parses key=value pairs, sets process.env" notable_decisions="[]"]
|
|
252
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
253
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
254
|
+
// CIL[DOC-VECTOR type="context" content="Layer: cli. Direct callers: 0. Direct calls: 0. Related files: \."]
|
|
255
|
+
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
256
|
+
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
257
|
+
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
258
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
259
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
207
260
|
function loadEnv() {
|
|
208
261
|
const envPath = join(PROJECT_ROOT, '.env')
|
|
209
262
|
if (!existsSync(envPath)) return
|
|
@@ -218,11 +271,25 @@ function loadEnv() {
|
|
|
218
271
|
if (key && !(key in process.env)) process.env[key] = val
|
|
219
272
|
}
|
|
220
273
|
}
|
|
221
|
-
|
|
274
|
+
// CIL[END chunk_id="migrate_loadenv_1784069813"]
|
|
275
|
+
// CIL[BEGIN chunk_id="migrate_collectmigrations_1784069813" type="function" identity="collectMigrations" parent="none"]
|
|
276
|
+
// CIL[DOC-MACRO purpose="Collect migration files from framework and custom directories"]
|
|
277
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Find and sort SQL migration files"]
|
|
278
|
+
// CIL[DOC-CONTEXT module="cli.commands.migrate" layer="cli" related_files="[]"]
|
|
279
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="migration file list" errors="filesystem errors" side_effects="none"]
|
|
280
|
+
// CIL[DOC-MICRO logic_summary="Scans .framework/migrations and custom/migrations for .sql files" notable_decisions="[]"]
|
|
281
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
282
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
283
|
+
// CIL[DOC-VECTOR type="context" content="Layer: cli. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
284
|
+
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
285
|
+
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
286
|
+
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
287
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
288
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
222
289
|
function collectMigrations(frameworkOnly: boolean): { name: string; path: string }[] {
|
|
223
290
|
const files: { name: string; path: string }[] = []
|
|
224
291
|
|
|
225
|
-
|
|
292
|
+
|
|
226
293
|
const fwMigrationsDir = existsSync(join(PROJECT_ROOT, '.framework/migrations'))
|
|
227
294
|
? join(PROJECT_ROOT, '.framework/migrations')
|
|
228
295
|
: join(PACKAGE_ROOT, '.framework/migrations')
|
|
@@ -234,7 +301,7 @@ function collectMigrations(frameworkOnly: boolean): { name: string; path: string
|
|
|
234
301
|
.forEach(f => files.push({ name: f, path: join(fwMigrationsDir, f) }))
|
|
235
302
|
}
|
|
236
303
|
|
|
237
|
-
|
|
304
|
+
|
|
238
305
|
if (!frameworkOnly) {
|
|
239
306
|
const customMigrationsDir = join(PROJECT_ROOT, 'custom/migrations')
|
|
240
307
|
if (existsSync(customMigrationsDir)) {
|
|
@@ -247,12 +314,26 @@ function collectMigrations(frameworkOnly: boolean): { name: string; path: string
|
|
|
247
314
|
|
|
248
315
|
return files
|
|
249
316
|
}
|
|
250
|
-
|
|
317
|
+
// CIL[END chunk_id="migrate_collectmigrations_1784069813"]
|
|
318
|
+
// CIL[BEGIN chunk_id="migrate_splitsqlstatements_1784069813" type="function" identity="splitSqlStatements" parent="none"]
|
|
319
|
+
// CIL[DOC-MACRO purpose="Split SQL string into individual statements"]
|
|
320
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Parse SQL migration files into executable statements"]
|
|
321
|
+
// CIL[DOC-CONTEXT module="cli.commands.migrate" layer="cli" related_files="[]"]
|
|
322
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="statement array" errors="parsing errors" side_effects="none"]
|
|
323
|
+
// CIL[DOC-MICRO logic_summary="Handles dollar-quoted blocks, removes comments, splits on semicolons" notable_decisions="[]"]
|
|
324
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="complex_sql_parsing"]
|
|
325
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
326
|
+
// CIL[DOC-VECTOR type="context" content="Layer: cli. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
327
|
+
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
328
|
+
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
329
|
+
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
330
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
331
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
251
332
|
function splitSqlStatements(sql: string): string[] {
|
|
252
333
|
const dollarBlocks: string[] = []
|
|
253
334
|
let blockIndex = 0
|
|
254
335
|
|
|
255
|
-
|
|
336
|
+
|
|
256
337
|
const protectedSql = sql.replace(/\$[A-Za-z_]*\$[\s\S]*?\$[A-Za-z_]*\$/g, (match) => {
|
|
257
338
|
const placeholder = `__DOLLAR_BLOCK_${blockIndex}__`
|
|
258
339
|
dollarBlocks[blockIndex] = match
|
|
@@ -260,10 +341,10 @@ function splitSqlStatements(sql: string): string[] {
|
|
|
260
341
|
return placeholder
|
|
261
342
|
})
|
|
262
343
|
|
|
263
|
-
|
|
344
|
+
|
|
264
345
|
const noComments = protectedSql.replace(/--[^\n]*/g, '')
|
|
265
346
|
|
|
266
|
-
|
|
347
|
+
|
|
267
348
|
return noComments
|
|
268
349
|
.split(';')
|
|
269
350
|
.map(s => {
|
|
@@ -276,3 +357,4 @@ function splitSqlStatements(sql: string): string[] {
|
|
|
276
357
|
.filter(s => s.length > 0)
|
|
277
358
|
.map(s => s + ';')
|
|
278
359
|
}
|
|
360
|
+
// CIL[END chunk_id="migrate_splitsqlstatements_1784069813"]
|
|
@@ -1,36 +1,21 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/**
|
|
3
|
-
* @module cli/commands/migrations
|
|
4
|
-
* @audience installer
|
|
5
|
-
* @layer cli
|
|
6
|
-
* @stability stable
|
|
7
|
-
*
|
|
8
|
-
* `spine migrations` command group. Read-only inspection of the migration
|
|
9
|
-
* state. Does NOT apply or roll back migrations — use the Supabase CLI for
|
|
10
|
-
* that. These commands are intended for verifying the state of a deployed
|
|
11
|
-
* instance during setup or debugging.
|
|
12
|
-
*
|
|
13
|
-
* **Commands:**
|
|
14
|
-
* | Subcommand | Description |
|
|
15
|
-
* |-----------------------|-----------------------------------------------------|
|
|
16
|
-
* | `migrations list` | Show all applied migrations from `schema_migrations`|
|
|
17
|
-
* | `migrations status` | Diff local `.sql` files against applied migrations |
|
|
18
|
-
*
|
|
19
|
-
* **Authorization:** Uses `adminDb` (service-role) with an explicit
|
|
20
|
-
* `.schema('public')` override to reach `schema_migrations`. Requires
|
|
21
|
-
* `SUPABASE_SERVICE_ROLE_KEY` with public schema access.
|
|
22
|
-
*
|
|
23
|
-
* **Usage:**
|
|
24
|
-
* ```bash
|
|
25
|
-
* spine migrations list
|
|
26
|
-
* spine migrations status
|
|
27
|
-
* spine migrations status --json
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* @seeAlso v2-core/migrations/ (local .sql migration files)
|
|
31
|
-
* @seeAlso cli/context.ts (buildCliContext)
|
|
32
|
-
*/
|
|
33
1
|
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// CIL[BEGIN chunk_id="migrations_moduleheader_1784069813" type="module_header" identity="module_header" parent="none"]
|
|
5
|
+
// CIL[DOC-MACRO purpose="Module imports for migration inspection CLI"]
|
|
6
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Provide CLI context and database access"]
|
|
7
|
+
// CIL[DOC-CONTEXT module="cli.commands.migrations" layer="cli" related_files="[\".framework/migrations/015_simplify_apps_table.sql\",\"custom/apps/cortex/pages/operations/OperationsDashboard.tsx\",\".framework/src/pages/admin/TypeDetailPage.tsx\",\".framework/functions/_shared/principal.ts\",\"\\\"]"]
|
|
8
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="imports" errors="none" side_effects="none"]
|
|
9
|
+
// CIL[DOC-MICRO logic_summary="Imports Commander, CLI context utilities, and admin database" notable_decisions="[]"]
|
|
10
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
11
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
12
|
+
// CIL[DOC-AUDIENCE audience="developer"]
|
|
13
|
+
// CIL[DOC-VECTOR type="context" content="Layer: cli. Direct callers: 0. Direct calls: 0. Related files: .framework/migrations/015_simplify_apps_table.sql, custom/apps/cortex/pages/operations/OperationsDashboard.tsx, .framework/src/pages/admin/TypeDetailPage.tsx, .framework/functions/_shared/principal.ts, \."]
|
|
14
|
+
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
15
|
+
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
16
|
+
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
17
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
18
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
34
19
|
import type { Command } from 'commander'
|
|
35
20
|
import { readdirSync, existsSync } from 'fs'
|
|
36
21
|
import { resolve, dirname } from 'path'
|
|
@@ -40,14 +25,21 @@ import { adminDb } from '../../functions/_shared/index.ts'
|
|
|
40
25
|
|
|
41
26
|
const __filename = fileURLToPath(import.meta.url)
|
|
42
27
|
const __dirname = dirname(__filename)
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
28
|
+
// CIL[END chunk_id="migrations_moduleheader_1784069813"]
|
|
29
|
+
// CIL[BEGIN chunk_id="migrations_registermigrationcommands_1784069813" type="function" identity="registerMigrationCommands" parent="none"]
|
|
30
|
+
// CIL[DOC-MACRO purpose="Register migration inspection commands"]
|
|
31
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Provide CLI commands for migration status and listing"]
|
|
32
|
+
// CIL[DOC-CONTEXT module="cli.commands.migrations" layer="cli" related_files="[\".framework/migrations/015_simplify_apps_table.sql\",\"\\\"]"]
|
|
33
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="CLI commands" errors="database errors" side_effects="none"]
|
|
34
|
+
// CIL[DOC-MICRO logic_summary="Registers list and status commands for migration inspection" notable_decisions="[]"]
|
|
35
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
36
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
37
|
+
// CIL[DOC-VECTOR type="context" content="Layer: cli. Direct callers: 0. Direct calls: 0. Related files: .framework/migrations/015_simplify_apps_table.sql, \."]
|
|
38
|
+
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
39
|
+
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
40
|
+
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
41
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
42
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
51
43
|
export function registerMigrationCommands(program: Command) {
|
|
52
44
|
const migrations = program
|
|
53
45
|
.command('migrations')
|
|
@@ -139,3 +131,4 @@ export function registerMigrationCommands(program: Command) {
|
|
|
139
131
|
}
|
|
140
132
|
})
|
|
141
133
|
}
|
|
134
|
+
// CIL[END chunk_id="migrations_registermigrationcommands_1784069813"]
|
|
@@ -1,46 +1,37 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/**
|
|
3
|
-
* @module cli/commands/pipelines
|
|
4
|
-
* @audience installer
|
|
5
|
-
* @layer cli
|
|
6
|
-
* @stability stable
|
|
7
|
-
*
|
|
8
|
-
* `spine pipelines` command group. Lists, inspects, and triggers pipeline
|
|
9
|
-
* execution directly from the terminal or an agentic IDE. `pipelines run`
|
|
10
|
-
* calls `runPipeline` — the same function used by API handlers and timers —
|
|
11
|
-
* so CLI executions are fully recorded in `pipeline_executions`.
|
|
12
|
-
*
|
|
13
|
-
* **Commands:**
|
|
14
|
-
* | Subcommand | Description |
|
|
15
|
-
* |---------------------------------------|------------------------------------------|
|
|
16
|
-
* | `pipelines list [--account] [--all]` | List active (or all) pipelines |
|
|
17
|
-
* | `pipelines get <id>` | Show pipeline details |
|
|
18
|
-
* | `pipelines run <id> [--data <json>]` | Execute a pipeline and show stage output |
|
|
19
|
-
* | `pipelines executions <id>` | List recent executions for a pipeline |
|
|
20
|
-
*
|
|
21
|
-
* **Usage:**
|
|
22
|
-
* ```bash
|
|
23
|
-
* spine pipelines list --account <id>
|
|
24
|
-
* spine pipelines run <uuid> --data '{"key":"value"}' --json
|
|
25
|
-
* spine pipelines executions <uuid> --limit 20
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @seeAlso cli/context.ts (buildCliContext)
|
|
29
|
-
* @seeAlso functions/_shared/pipeline-runner.ts (runPipeline)
|
|
30
|
-
* @seeAlso functions/pipeline-executions.ts (API query endpoint)
|
|
31
|
-
*/
|
|
32
1
|
|
|
2
|
+
// CIL[BEGIN chunk_id="pipelines_moduleheader_1784068794" type="module_header" identity="imports" parent="none"]
|
|
3
|
+
// CIL[DOC-MACRO purpose="Import CLI dependencies and pipeline utilities"]
|
|
4
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Load required modules for pipeline commands"]
|
|
5
|
+
// CIL[DOC-CONTEXT module="cli" layer="commands" related_files="[\"custom/apps/portal/pages/ContentPage.tsx\",\"custom/apps/cortex/pages/operations/OperationsDashboard.tsx\",\".framework/src/components/ui/dialog.tsx\",\".framework/src/pages/admin/RolesPage.tsx\",\".framework/functions/_shared/principal.ts\",\"\\\"]"]
|
|
6
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="loaded_modules" errors="none" side_effects="none"]
|
|
7
|
+
// CIL[DOC-MICRO logic_summary="Imports Commander, context utilities, and pipeline functions" notable_decisions="[]"]
|
|
8
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
9
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
10
|
+
// CIL[DOC-AUDIENCE audience="developer"]
|
|
11
|
+
// CIL[DOC-VECTOR type="context" content="Layer: commands. Direct callers: 0. Direct calls: 0. Related files: custom/apps/portal/pages/ContentPage.tsx, custom/apps/cortex/pages/operations/OperationsDashboard.tsx, .framework/src/components/ui/dialog.tsx, .framework/src/pages/admin/RolesPage.tsx, .framework/functions/_shared/principal.ts, \."]
|
|
12
|
+
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
13
|
+
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
14
|
+
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
15
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
16
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
33
17
|
import type { Command } from 'commander'
|
|
34
18
|
import { buildCliContext, printResult, handleError } from '../context.ts'
|
|
35
19
|
import { runPipeline, adminDb } from '../../functions/_shared/index.ts'
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
20
|
+
// CIL[END chunk_id="pipelines_moduleheader_1784068794"]
|
|
21
|
+
// CIL[BEGIN chunk_id="pipelines_registerpipelinecommands_1784068794" type="function" identity="registerPipelineCommands" parent="none"]
|
|
22
|
+
// CIL[DOC-MACRO purpose="Register pipeline management commands"]
|
|
23
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Configure pipeline list, get, run, and executions commands"]
|
|
24
|
+
// CIL[DOC-CONTEXT module="cli" layer="commands" related_files="[\".framework/src/pages/admin/TypeDetailPage.tsx\",\"\\\"]"]
|
|
25
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="pipeline_commands" errors="command_errors" side_effects="database_operations"]
|
|
26
|
+
// CIL[DOC-MICRO logic_summary="Registers subcommands for pipeline CRUD and execution operations" notable_decisions="[]"]
|
|
27
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="complex_dependencies"]
|
|
28
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
29
|
+
// CIL[DOC-VECTOR type="context" content="Layer: commands. Direct callers: 0. Direct calls: 0. Related files: .framework/src/pages/admin/TypeDetailPage.tsx, \."]
|
|
30
|
+
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
31
|
+
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
32
|
+
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
33
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
34
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
44
35
|
export function registerPipelineCommands(program: Command) {
|
|
45
36
|
const pipelines = program
|
|
46
37
|
.command('pipelines')
|
|
@@ -164,3 +155,4 @@ export function registerPipelineCommands(program: Command) {
|
|
|
164
155
|
}
|
|
165
156
|
})
|
|
166
157
|
}
|
|
158
|
+
// CIL[END chunk_id="pipelines_registerpipelinecommands_1784068794"]
|