spine-framework 0.4.4 → 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/hash-api-key.ts +183 -79
- package/.framework/functions/_shared/logging.ts +562 -224
- package/.framework/functions/_shared/middleware.ts +47 -44
- package/.framework/functions/admin-data.ts +39 -28
- package/.framework/functions/ai-agents.ts +10 -6
- 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/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 +240 -127
- package/.framework/functions/tests.ts +7 -6
- package/.framework/functions/timers.ts +310 -107
- package/.framework/functions/triggers.ts +28 -13
- package/.framework/functions/types.ts +13 -10
- 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/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 +88 -79
- package/.framework/src/components/admin/EntitySelect.tsx +181 -0
- package/.framework/src/components/admin/PageInstructions.tsx +86 -127
- package/.framework/src/components/app-shell/GenericDetailPage.tsx +37 -13
- package/.framework/src/components/app-shell/GenericListPage.tsx +28 -32
- package/.framework/src/components/layout/Sidebar.tsx +300 -177
- 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/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/pages/NotFoundPage.tsx +62 -31
- 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/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 +4 -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 +479 -44
- 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/integration-outbound-credentials.test.ts +167 -0
- package/.framework/tests/unit/integrations-audit-redaction.test.ts +130 -0
- package/.framework/tests/unit/logging-app-id.test.ts +75 -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/README.md +125 -166
- package/config/tsconfig.cli.json +2 -2
- 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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// CIL[BEGIN stable_id="~/.framework/cli/commands/dev.ts:module_header:module_header" type="module_header" identity="module_header" parent="~/.framework/cli/commands/dev.ts"]
|
|
2
|
-
// CIL[DOC-MACRO purpose="Provides CLI
|
|
2
|
+
// CIL[DOC-MACRO purpose="Provides the 'dev' CLI command: assemble the project, optionally verify integrity, then run the real dev server flow."]
|
|
3
3
|
// CIL[DOC-RESPONSIBILITY responsibility="Expose dev command utilities for developers to streamline application development workflow."]
|
|
4
|
-
// CIL[DOC-CONTEXT module="dev" layer="app-specific" related_files=".framework/cli/commands/dev.ts"]
|
|
4
|
+
// CIL[DOC-CONTEXT module="dev" layer="app-specific" related_files=".framework/cli/commands/dev.ts,scripts/assemble.sh,scripts/dev-netlify.sh,config/vite.config.ts"]
|
|
5
5
|
// CIL[DOC-CONTRACT inputs="[]" outputs="[]" errors="[]" side_effects="[]"]
|
|
6
|
-
// CIL[DOC-MICRO logic_summary="
|
|
6
|
+
// CIL[DOC-MICRO logic_summary="Runs scripts/assemble.sh, optional scripts/verify-integrity.sh, then spawns Vite (config/vite.config.ts) or scripts/dev-netlify.sh; watches custom/ for changes with debounced reassembly." notable_decisions="Commands should only be executed in a valid development environment."]
|
|
7
7
|
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
8
8
|
// CIL[DOC-STABILITY stability="stable"]
|
|
9
9
|
// CIL[DOC-AUDIENCE audience="internal"]
|
|
@@ -11,23 +11,12 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
14
|
import type { Command } from 'commander'
|
|
27
|
-
import { spawn
|
|
15
|
+
import { spawn } from 'child_process'
|
|
28
16
|
import { resolve, dirname } from 'path'
|
|
29
17
|
import { fileURLToPath } from 'url'
|
|
30
|
-
import { watch, existsSync
|
|
18
|
+
import { watch, existsSync } from 'fs'
|
|
19
|
+
// CIL[END stable_id="~/.framework/cli/commands/dev.ts:module_header:module_header"]
|
|
31
20
|
|
|
32
21
|
// CIL[DOC-VECTOR type="context" content="purpose='Provides CLI commands for the development environment, facilitating process spawning and file watching.'; No verified external callers; imports: none"]
|
|
33
22
|
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
@@ -35,8 +24,6 @@ import { watch, existsSync, statSync, readdirSync } from 'fs'
|
|
|
35
24
|
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
36
25
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
37
26
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
38
|
-
// CIL[END stable_id="~/.framework/cli/commands/dev.ts:module_header:module_header"]
|
|
39
|
-
// CIL[BEGIN stable_id="~/.framework/cli/commands/dev.ts:__filename:constant" type="constant" identity="__filename" parent="~/.framework/cli/commands/dev.ts"]
|
|
40
27
|
// CIL[DOC-MACRO purpose="Resolves the current module's file URL to a filesystem path."]
|
|
41
28
|
// CIL[DOC-RESPONSIBILITY responsibility="Provide a stable __filename reference for the module."]
|
|
42
29
|
// CIL[DOC-CONTEXT module="dev" layer="app-specific" related_files=".framework/cli/commands/dev.ts"]
|
|
@@ -46,15 +33,15 @@ import { watch, existsSync, statSync, readdirSync } from 'fs'
|
|
|
46
33
|
// CIL[DOC-STABILITY stability="stable"]
|
|
47
34
|
|
|
48
35
|
|
|
36
|
+
// CIL[BEGIN stable_id="~/.framework/cli/commands/dev.ts:__filename:constant" type="constant" identity="__filename" parent="~/.framework/cli/commands/dev.ts"]
|
|
49
37
|
const __filename = fileURLToPath(import.meta.url)
|
|
38
|
+
// CIL[END stable_id="~/.framework/cli/commands/dev.ts:__filename:constant"]
|
|
50
39
|
// CIL[DOC-VECTOR type="context" content="purpose='Resolves the current module's file URL to a filesystem path.'; No verified external callers; imports: none"]
|
|
51
40
|
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
52
41
|
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
53
42
|
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
54
43
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
55
44
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
56
|
-
// CIL[END stable_id="~/.framework/cli/commands/dev.ts:__filename:constant"]
|
|
57
|
-
// CIL[BEGIN stable_id="~/.framework/cli/commands/dev.ts:__dirname:constant" type="constant" identity="__dirname" parent="~/.framework/cli/commands/dev.ts"]
|
|
58
45
|
// CIL[DOC-MACRO purpose="Provides the directory name of the current module for relative path resolution."]
|
|
59
46
|
// CIL[DOC-RESPONSIBILITY responsibility="Derive the current module's directory from __filename."]
|
|
60
47
|
// CIL[DOC-CONTEXT module="dev" layer="app-specific" related_files=".framework/cli/commands/dev.ts"]
|
|
@@ -64,15 +51,15 @@ const __filename = fileURLToPath(import.meta.url)
|
|
|
64
51
|
// CIL[DOC-STABILITY stability="stable"]
|
|
65
52
|
|
|
66
53
|
|
|
54
|
+
// CIL[BEGIN stable_id="~/.framework/cli/commands/dev.ts:__dirname:constant" type="constant" identity="__dirname" parent="~/.framework/cli/commands/dev.ts"]
|
|
67
55
|
const __dirname = dirname(__filename)
|
|
56
|
+
// CIL[END stable_id="~/.framework/cli/commands/dev.ts:__dirname:constant"]
|
|
68
57
|
// CIL[DOC-VECTOR type="context" content="purpose='Provides the directory name of the current module for relative path resolution.'; No verified external callers; imports: none"]
|
|
69
58
|
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
70
59
|
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
71
60
|
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
72
61
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
73
62
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
74
|
-
// CIL[END stable_id="~/.framework/cli/commands/dev.ts:__dirname:constant"]
|
|
75
|
-
// CIL[BEGIN stable_id="~/.framework/cli/commands/dev.ts:PROJECT_ROOT:constant" type="constant" identity="PROJECT_ROOT" parent="~/.framework/cli/commands/dev.ts"]
|
|
76
63
|
// CIL[DOC-MACRO purpose="Defines the project root directory for relative path resolution."]
|
|
77
64
|
// CIL[DOC-RESPONSIBILITY responsibility="Provide a resolved project root path for file operations."]
|
|
78
65
|
// CIL[DOC-CONTEXT module="dev" layer="app-specific" related_files=".framework/cli/commands/dev.ts"]
|
|
@@ -80,6 +67,7 @@ const __dirname = dirname(__filename)
|
|
|
80
67
|
// CIL[DOC-MICRO logic_summary="Resolve __dirname joined with '../../../' to produce PROJECT_ROOT." notable_decisions=""]
|
|
81
68
|
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
82
69
|
// CIL[DOC-STABILITY stability="stable"]
|
|
70
|
+
// CIL[BEGIN stable_id="~/.framework/cli/commands/dev.ts:PROJECT_ROOT:constant" type="constant" identity="PROJECT_ROOT" parent="~/.framework/cli/commands/dev.ts"]
|
|
83
71
|
/**
|
|
84
72
|
* PROJECT_ROOT defines the root directory of the project, allowing for relative path resolution. It exists to facilitate file operations within the project structure.
|
|
85
73
|
*
|
|
@@ -89,31 +77,35 @@ const __dirname = dirname(__filename)
|
|
|
89
77
|
* @cil-generated
|
|
90
78
|
*/
|
|
91
79
|
const PROJECT_ROOT = resolve(__dirname, '../../../')
|
|
80
|
+
// CIL[END stable_id="~/.framework/cli/commands/dev.ts:PROJECT_ROOT:constant"]
|
|
92
81
|
// CIL[DOC-VECTOR type="context" content="purpose='Defines the project root directory for relative path resolution.'; No verified external callers; imports: none"]
|
|
93
82
|
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
94
83
|
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
95
84
|
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
96
85
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
97
86
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
98
|
-
// CIL[END stable_id="~/.framework/cli/commands/dev.ts:PROJECT_ROOT:constant"]
|
|
99
87
|
|
|
100
|
-
// CIL[BEGIN stable_id="~/.framework/cli/commands/dev.ts:registerDevCommands:function" type="function" identity="registerDevCommands" parent="~/.framework/cli/commands/dev.ts"]
|
|
101
88
|
// CIL[DOC-MACRO purpose="Registers the 'dev' command for starting the Spine development server with options."]
|
|
102
|
-
// CIL[DOC-RESPONSIBILITY responsibility="Configure and launch the dev server with integrity verification and file watching."]
|
|
103
|
-
// CIL[DOC-CONTEXT module="dev" layer="app-specific" related_files=".framework/cli/commands/dev.ts"]
|
|
89
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Configure and launch the dev server with assembly, integrity verification, and file watching."]
|
|
90
|
+
// CIL[DOC-CONTEXT module="dev" layer="app-specific" related_files=".framework/cli/commands/dev.ts,scripts/assemble.sh,scripts/dev-netlify.sh,config/vite.config.ts"]
|
|
104
91
|
// CIL[DOC-CONTRACT inputs="program: Command" outputs="Promise<void>" errors="Process exits on failure" side_effects="Executes shell commands, spawns a child process, and watches for file changes."]
|
|
105
|
-
// CIL[DOC-MICRO logic_summary="
|
|
92
|
+
// CIL[DOC-MICRO logic_summary="Run scripts/assemble.sh, verify integrity unless skipped, then spawn Vite with config/vite.config.ts (npm run dev equivalent) or scripts/dev-netlify.sh with --netlify (npm run dev:netlify equivalent); watch custom/ for changes with debounced reassembly." notable_decisions="Honors --netlify, --no-verify, --port, --host, --no-watch, and --watch-delay options; ignores changes in node_modules and dotfiles; sets SPINE_DEV=true for the spawned process. --port/--host only apply to the Vite path — netlify dev pins 8888/3001 via netlify.toml."]
|
|
106
93
|
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
107
94
|
// CIL[DOC-STABILITY stability="stable"]
|
|
95
|
+
// CIL[BEGIN stable_id="~/.framework/cli/commands/dev.ts:registerDevCommands:function" type="function" identity="registerDevCommands" parent="~/.framework/cli/commands/dev.ts"]
|
|
108
96
|
/**
|
|
109
97
|
* Registers development commands for starting the Spine development server with various options. It facilitates the assembly and verification of core components before launching the server.
|
|
110
98
|
*
|
|
111
99
|
* @macro Command registration function for a CLI tool.
|
|
112
|
-
* @micro
|
|
100
|
+
* @micro Runs the real shipped dev flow: scripts/assemble.sh, optional
|
|
101
|
+
* scripts/verify-integrity.sh, then Vite with
|
|
102
|
+
* config/vite.config.ts (equivalent to `npm run dev`) or
|
|
103
|
+
* scripts/dev-netlify.sh when --netlify is passed (equivalent to
|
|
104
|
+
* `npm run dev:netlify`).
|
|
113
105
|
* @inputSpec
|
|
114
106
|
* program: Command (required) — The command program to register the dev commands with.
|
|
115
107
|
* @outputSpec Promise<void>
|
|
116
|
-
* @sideEffects Executes shell commands, spawns a child process, and
|
|
108
|
+
* @sideEffects Executes shell commands, spawns a child process, and watches custom/ for changes.
|
|
117
109
|
* @stability stable
|
|
118
110
|
* @calls runCommand, spawn, watch, existsSync, resolve
|
|
119
111
|
* @errorHandling none
|
|
@@ -122,21 +114,22 @@ const PROJECT_ROOT = resolve(__dirname, '../../../')
|
|
|
122
114
|
export function registerDevCommands(program: Command) {
|
|
123
115
|
program
|
|
124
116
|
.command('dev')
|
|
125
|
-
.description('Start Spine development server')
|
|
117
|
+
.description('Start Spine development server (Vite by default; --netlify for functions + UI on :8888)')
|
|
118
|
+
.option('--netlify', 'Run the full Netlify dev stack via scripts/dev-netlify.sh (equivalent to npm run dev:netlify)', false)
|
|
126
119
|
.option('--no-verify', 'Skip integrity verification')
|
|
127
|
-
.option('--port <port>', 'Dev server port', '3001')
|
|
128
|
-
.option('--host', 'Expose to network', false)
|
|
129
|
-
.option('--no-watch', 'Disable file watching')
|
|
120
|
+
.option('--port <port>', 'Dev server port (Vite mode only — netlify dev pins 8888/3001 via netlify.toml)', '3001')
|
|
121
|
+
.option('--host', 'Expose Vite to network (Vite mode only)', false)
|
|
122
|
+
.option('--no-watch', 'Disable custom/ file watching')
|
|
130
123
|
.option('--watch-delay <ms>', 'Debounce delay for reassembly', '500')
|
|
131
124
|
.action(async (opts) => {
|
|
132
125
|
console.log('\n🚀 Starting Spine dev server...\n')
|
|
133
126
|
|
|
134
127
|
try {
|
|
135
|
-
|
|
136
|
-
console.log('📦 Step 1: Assembling
|
|
128
|
+
// Step 1: assemble .framework/ + custom/ → .assembled/ (the vite root).
|
|
129
|
+
console.log('📦 Step 1: Assembling .framework + custom → .assembled/...')
|
|
137
130
|
const assemblyExitCode = await runCommand(
|
|
138
131
|
'bash',
|
|
139
|
-
[resolve(PROJECT_ROOT, 'scripts/assemble
|
|
132
|
+
[resolve(PROJECT_ROOT, 'scripts/assemble.sh')],
|
|
140
133
|
PROJECT_ROOT
|
|
141
134
|
)
|
|
142
135
|
|
|
@@ -146,7 +139,7 @@ export function registerDevCommands(program: Command) {
|
|
|
146
139
|
}
|
|
147
140
|
console.log('✓ Assembly complete\n')
|
|
148
141
|
|
|
149
|
-
|
|
142
|
+
// Step 2: optional integrity verification.
|
|
150
143
|
if (opts.verify !== false) {
|
|
151
144
|
console.log('🔒 Step 2: Verifying core integrity...')
|
|
152
145
|
const verifyExitCode = await runCommand(
|
|
@@ -164,54 +157,85 @@ export function registerDevCommands(program: Command) {
|
|
|
164
157
|
console.log('⏭️ Step 2: Skipping integrity verification (--no-verify)\n')
|
|
165
158
|
}
|
|
166
159
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
160
|
+
// Step 3: spawn the dev server.
|
|
161
|
+
// default: vite --config config/vite.config.ts (≡ npm run dev)
|
|
162
|
+
// --netlify: scripts/dev-netlify.sh (≡ npm run dev:netlify)
|
|
163
|
+
let server: ReturnType<typeof spawn>
|
|
164
|
+
if (opts.netlify) {
|
|
165
|
+
if (opts.port !== '3001' || opts.host) {
|
|
166
|
+
console.warn('⚠️ --port/--host are ignored with --netlify (netlify.toml pins 8888 → 3001)\n')
|
|
167
|
+
}
|
|
168
|
+
const script = resolve(PROJECT_ROOT, 'scripts/dev-netlify.sh')
|
|
169
|
+
if (!existsSync(script)) {
|
|
170
|
+
console.error(`\n❌ Missing ${script} — this project does not have the shipped dev scripts.`)
|
|
171
|
+
process.exit(1)
|
|
172
|
+
}
|
|
173
|
+
console.log('🌐 Step 3: Starting Netlify dev (functions + UI on http://localhost:8888)...')
|
|
174
|
+
console.log(' (Press Ctrl+C to stop)\n')
|
|
175
|
+
server = spawn('bash', [script], {
|
|
179
176
|
cwd: PROJECT_ROOT,
|
|
180
177
|
stdio: 'inherit',
|
|
181
178
|
env: { ...process.env, SPINE_DEV: 'true' }
|
|
179
|
+
})
|
|
180
|
+
} else {
|
|
181
|
+
const viteBin = resolve(PROJECT_ROOT, 'node_modules/.bin/vite')
|
|
182
|
+
if (!existsSync(viteBin)) {
|
|
183
|
+
console.error(`\n❌ vite not found at ${viteBin}. Run 'npm install' first.`)
|
|
184
|
+
process.exit(1)
|
|
182
185
|
}
|
|
183
|
-
|
|
186
|
+
console.log(`🌐 Step 3: Starting Vite dev server on port ${opts.port}...`)
|
|
187
|
+
console.log(' (Press Ctrl+C to stop)\n')
|
|
188
|
+
server = spawn(
|
|
189
|
+
viteBin,
|
|
190
|
+
[
|
|
191
|
+
'--config', resolve(PROJECT_ROOT, 'config/vite.config.ts'),
|
|
192
|
+
'--port', opts.port,
|
|
193
|
+
...(opts.host ? ['--host'] : [])
|
|
194
|
+
],
|
|
195
|
+
{
|
|
196
|
+
cwd: PROJECT_ROOT,
|
|
197
|
+
stdio: 'inherit',
|
|
198
|
+
env: { ...process.env, SPINE_DEV: 'true' }
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
}
|
|
184
202
|
|
|
185
|
-
|
|
203
|
+
// Step 4: watch custom/ and re-assemble so Vite/Netlify pick up changes.
|
|
186
204
|
let watcher: ReturnType<typeof watch> | null = null
|
|
187
205
|
if (opts.watch !== false) {
|
|
188
206
|
const watchDelay = parseInt(opts.watchDelay) || 500
|
|
189
|
-
const customDir = resolve(PROJECT_ROOT, '
|
|
207
|
+
const customDir = resolve(PROJECT_ROOT, 'custom')
|
|
190
208
|
|
|
191
209
|
if (existsSync(customDir)) {
|
|
192
|
-
console.log(`👁️ Step 4: Watching
|
|
193
|
-
console.log(` (Changes trigger
|
|
210
|
+
console.log(`👁️ Step 4: Watching custom/ for changes...`)
|
|
211
|
+
console.log(` (Changes trigger reassembly after ${watchDelay}ms debounce)\n`)
|
|
194
212
|
|
|
195
213
|
let reassemblyTimeout: NodeJS.Timeout | null = null
|
|
196
214
|
|
|
197
215
|
watcher = watch(customDir, { recursive: true }, (eventType, filename) => {
|
|
198
|
-
|
|
199
216
|
if (!filename || filename.includes('node_modules') || filename.startsWith('.')) {
|
|
200
217
|
return
|
|
201
218
|
}
|
|
202
219
|
|
|
203
|
-
console.log(`\n📝 Change detected in
|
|
220
|
+
console.log(`\n📝 Change detected in custom/${filename}`)
|
|
204
221
|
|
|
205
|
-
|
|
206
222
|
if (reassemblyTimeout) {
|
|
207
223
|
clearTimeout(reassemblyTimeout)
|
|
208
224
|
}
|
|
209
225
|
|
|
210
226
|
reassemblyTimeout = setTimeout(async () => {
|
|
211
|
-
console.log('🔧 Running
|
|
227
|
+
console.log('🔧 Running reassembly...')
|
|
212
228
|
try {
|
|
213
229
|
const start = Date.now()
|
|
214
|
-
await
|
|
230
|
+
const code = await runCommand(
|
|
231
|
+
'bash',
|
|
232
|
+
[resolve(PROJECT_ROOT, 'scripts/assemble.sh')],
|
|
233
|
+
PROJECT_ROOT
|
|
234
|
+
)
|
|
235
|
+
if (code !== 0) {
|
|
236
|
+
console.error('✗ Reassembly failed (see errors above)\n')
|
|
237
|
+
return
|
|
238
|
+
}
|
|
215
239
|
const duration = Date.now() - start
|
|
216
240
|
console.log(`✓ Reassembly complete (${duration}ms)\n`)
|
|
217
241
|
} catch (err: any) {
|
|
@@ -220,33 +244,32 @@ export function registerDevCommands(program: Command) {
|
|
|
220
244
|
}, watchDelay)
|
|
221
245
|
})
|
|
222
246
|
} else {
|
|
223
|
-
console.log('⏭️ Step 4:
|
|
247
|
+
console.log('⏭️ Step 4: custom/ not found, skipping watch mode\n')
|
|
224
248
|
}
|
|
225
249
|
} else {
|
|
226
250
|
console.log('⏭️ Step 4: File watching disabled (--no-watch)\n')
|
|
227
251
|
}
|
|
228
252
|
|
|
229
|
-
|
|
253
|
+
server.on('exit', (code) => {
|
|
230
254
|
if (watcher) {
|
|
231
255
|
watcher.close()
|
|
232
256
|
}
|
|
233
257
|
process.exit(code || 0)
|
|
234
258
|
})
|
|
235
259
|
|
|
236
|
-
|
|
237
260
|
process.on('SIGINT', () => {
|
|
238
261
|
console.log('\n\n🛑 Shutting down dev server...')
|
|
239
262
|
if (watcher) {
|
|
240
263
|
watcher.close()
|
|
241
264
|
}
|
|
242
|
-
|
|
265
|
+
server.kill('SIGTERM')
|
|
243
266
|
})
|
|
244
267
|
|
|
245
268
|
process.on('SIGTERM', () => {
|
|
246
269
|
if (watcher) {
|
|
247
270
|
watcher.close()
|
|
248
271
|
}
|
|
249
|
-
|
|
272
|
+
server.kill('SIGTERM')
|
|
250
273
|
})
|
|
251
274
|
|
|
252
275
|
} catch (err: any) {
|
|
@@ -258,15 +281,14 @@ export function registerDevCommands(program: Command) {
|
|
|
258
281
|
}
|
|
259
282
|
})
|
|
260
283
|
}
|
|
284
|
+
// CIL[END stable_id="~/.framework/cli/commands/dev.ts:registerDevCommands:function"]
|
|
261
285
|
// CIL[DOC-VECTOR type="context" content="purpose='Registers the 'dev' command for starting the Spine development server with options.'; No verified external callers; imports: none"]
|
|
262
286
|
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
263
287
|
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
264
288
|
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
265
289
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
266
290
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
267
|
-
// CIL[END stable_id="~/.framework/cli/commands/dev.ts:registerDevCommands:function"]
|
|
268
291
|
|
|
269
|
-
// CIL[BEGIN stable_id="~/.framework/cli/commands/dev.ts:runCommand:function" type="function" identity="runCommand" parent="~/.framework/cli/commands/dev.ts"]
|
|
270
292
|
// CIL[DOC-MACRO purpose="Executes a shell command in a given working directory and returns its exit code."]
|
|
271
293
|
// CIL[DOC-RESPONSIBILITY responsibility="Run a command as a child process and report its exit code."]
|
|
272
294
|
// CIL[DOC-CONTEXT module="dev" layer="app-specific" related_files=".framework/cli/commands/dev.ts"]
|
|
@@ -274,6 +296,7 @@ export function registerDevCommands(program: Command) {
|
|
|
274
296
|
// CIL[DOC-MICRO logic_summary="Spawn the command with inherited stdio and environment, resolve with the exit code, reject on spawn error." notable_decisions=""]
|
|
275
297
|
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
276
298
|
// CIL[DOC-STABILITY stability="stable"]
|
|
299
|
+
// CIL[BEGIN stable_id="~/.framework/cli/commands/dev.ts:runCommand:function" type="function" identity="runCommand" parent="~/.framework/cli/commands/dev.ts"]
|
|
277
300
|
/**
|
|
278
301
|
* Executes a command in a specified directory and returns the exit code. This function is useful for running shell commands programmatically within the application.
|
|
279
302
|
*
|
|
@@ -306,160 +329,10 @@ function runCommand(command: string, args: string[], cwd: string): Promise<numbe
|
|
|
306
329
|
})
|
|
307
330
|
})
|
|
308
331
|
}
|
|
309
|
-
// CIL[DOC-VECTOR type="context" content="purpose='Executes a shell command in a given working directory and returns its exit code.'; No verified external callers; imports: none"]
|
|
310
|
-
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
311
|
-
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
312
|
-
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
313
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
314
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
315
332
|
// CIL[END stable_id="~/.framework/cli/commands/dev.ts:runCommand:function"]
|
|
316
|
-
|
|
317
|
-
// CIL[BEGIN stable_id="~/.framework/cli/commands/dev.ts:fastReassemble:function" type="function" identity="fastReassemble" parent="~/.framework/cli/commands/dev.ts"]
|
|
318
|
-
// CIL[DOC-MACRO purpose="Synchronizes custom source and configuration files into assembled destinations."]
|
|
319
|
-
// CIL[DOC-RESPONSIBILITY responsibility="Copy changed files from v2-custom to src/v2-assembled and functions, and update public spine.config.json."]
|
|
320
|
-
// CIL[DOC-CONTEXT module="dev" layer="app-specific" related_files=".framework/cli/commands/dev.ts"]
|
|
321
|
-
// CIL[DOC-CONTRACT inputs="projectRoot: string" outputs="Promise<void>" errors="Throws on command or file system failure" side_effects="File I/O: copying, synchronizing, creating directories."]
|
|
322
|
-
// CIL[DOC-MICRO logic_summary="Check for rsync; rsync or manually copy changed custom src and functions; conditionally copy spine.config.json if newer." notable_decisions="Prefers rsync when available; filters to changed files via mtime when rsync is absent; conditionally copies spine.config.json to src/v2-assembled/public."]
|
|
323
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
324
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
325
|
-
/**
|
|
326
|
-
* The fastReassemble function synchronizes custom source files and configuration from a specified project root to designated destination directories. It ensures that the latest changes are reflected in the assembled output, using rsync if available for efficiency.
|
|
327
|
-
*
|
|
328
|
-
* @inputSpec
|
|
329
|
-
* projectRoot: string (required) — the root directory of the project to reassemble.
|
|
330
|
-
* @outputSpec Promise<void>
|
|
331
|
-
* @sideEffects file I/O operations including copying and synchronizing files, creating directories.
|
|
332
|
-
* @stability stable
|
|
333
|
-
* @calls execSync, existsSync, mkdirSync, statSync, copyFileSync, copyChangedFiles
|
|
334
|
-
* @cil-generated
|
|
335
|
-
*/
|
|
336
|
-
async function fastReassemble(projectRoot: string): Promise<void> {
|
|
337
|
-
const customDir = resolve(projectRoot, 'v2-custom')
|
|
338
|
-
const srcDest = resolve(projectRoot, 'src/v2-assembled')
|
|
339
|
-
const funcsDest = resolve(projectRoot, 'functions')
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
let hasRsync = false
|
|
343
|
-
try {
|
|
344
|
-
execSync('which rsync', { stdio: 'pipe' })
|
|
345
|
-
hasRsync = true
|
|
346
|
-
} catch {
|
|
347
|
-
hasRsync = false
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
const customSrcDir = resolve(customDir, 'src')
|
|
352
|
-
if (existsSync(customSrcDir)) {
|
|
353
|
-
const destDir = srcDest
|
|
354
|
-
|
|
355
|
-
if (hasRsync) {
|
|
356
|
-
|
|
357
|
-
execSync(
|
|
358
|
-
`rsync -av --delete "${customSrcDir}/" "${destDir}/"`,
|
|
359
|
-
{ stdio: 'pipe', cwd: projectRoot }
|
|
360
|
-
)
|
|
361
|
-
} else {
|
|
362
|
-
|
|
363
|
-
copyChangedFiles(customSrcDir, destDir)
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
const customFuncsDir = resolve(customDir, 'functions')
|
|
369
|
-
if (existsSync(customFuncsDir)) {
|
|
370
|
-
if (hasRsync) {
|
|
371
|
-
execSync(
|
|
372
|
-
`rsync -av --delete "${customFuncsDir}/" "${funcsDest}/"`,
|
|
373
|
-
{ stdio: 'pipe', cwd: projectRoot }
|
|
374
|
-
)
|
|
375
|
-
} else {
|
|
376
|
-
copyChangedFiles(customFuncsDir, funcsDest)
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
const spineConfigSrc = resolve(projectRoot, 'spine.config.json')
|
|
382
|
-
const publicDest = resolve(srcDest, 'public')
|
|
383
|
-
if (existsSync(spineConfigSrc)) {
|
|
384
|
-
if (!existsSync(publicDest)) {
|
|
385
|
-
mkdirSync(publicDest, { recursive: true })
|
|
386
|
-
}
|
|
387
|
-
const spineConfigDest = resolve(publicDest, 'spine.config.json')
|
|
388
|
-
const srcStat = statSync(spineConfigSrc)
|
|
389
|
-
let needsCopy = true
|
|
390
|
-
if (existsSync(spineConfigDest)) {
|
|
391
|
-
const destStat = statSync(spineConfigDest)
|
|
392
|
-
needsCopy = srcStat.mtimeMs > destStat.mtimeMs
|
|
393
|
-
}
|
|
394
|
-
if (needsCopy) {
|
|
395
|
-
copyFileSync(spineConfigSrc, spineConfigDest)
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
// CIL[DOC-VECTOR type="context" content="purpose='Synchronizes custom source and configuration files into assembled destinations.'; No verified external callers; imports: none"]
|
|
400
|
-
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
401
|
-
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
402
|
-
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
403
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
404
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
405
|
-
// CIL[END stable_id="~/.framework/cli/commands/dev.ts:fastReassemble:function"]
|
|
406
|
-
|
|
407
|
-
// CIL[BEGIN stable_id="~/.framework/cli/commands/dev.ts:copyChangedFiles:function" type="function" identity="copyChangedFiles" parent="~/.framework/cli/commands/dev.ts"]
|
|
408
|
-
// CIL[DOC-MACRO purpose="Copies files from source to destination only when modified."]
|
|
409
|
-
// CIL[DOC-RESPONSIBILITY responsibility="Recursively mirror changed files while creating missing directories."]
|
|
410
|
-
// CIL[DOC-CONTEXT module="dev" layer="app-specific" related_files=".framework/cli/commands/dev.ts"]
|
|
411
|
-
// CIL[DOC-CONTRACT inputs="src: string, dest: string" outputs="void" errors="Throws on file system errors" side_effects="File I/O"]
|
|
412
|
-
// CIL[DOC-MICRO logic_summary="Read source entries; for directories ensure destination and recurse; for files compare mtime and copy if newer." notable_decisions="Uses require('fs') for mkdirSync and copyFileSync inside the function; compares mtime to decide whether to copy."]
|
|
413
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
414
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
415
|
-
/**
|
|
416
|
-
* Copies files from the source directory to the destination directory only if they have changed. This function ensures that only modified files are copied, optimizing the file transfer process.
|
|
417
|
-
*
|
|
418
|
-
* @inputSpec
|
|
419
|
-
* src: string (required) — the source directory path.
|
|
420
|
-
* dest: string (required) — the destination directory path.
|
|
421
|
-
* @outputSpec void
|
|
422
|
-
* @sideEffects file I/O
|
|
423
|
-
* @stability stable
|
|
424
|
-
* @calls readdirSync, existsSync, mkdirSync, statSync, copyFileSync
|
|
425
|
-
* @cil-generated
|
|
426
|
-
*/
|
|
427
|
-
function copyChangedFiles(src: string, dest: string): void {
|
|
428
|
-
const files = readdirSync(src, { withFileTypes: true })
|
|
429
|
-
|
|
430
|
-
for (const entry of files) {
|
|
431
|
-
const srcPath = resolve(src, entry.name)
|
|
432
|
-
const destPath = resolve(dest, entry.name)
|
|
433
|
-
|
|
434
|
-
if (entry.isDirectory()) {
|
|
435
|
-
if (!existsSync(destPath)) {
|
|
436
|
-
|
|
437
|
-
const { mkdirSync } = require('fs')
|
|
438
|
-
mkdirSync(destPath, { recursive: true })
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
copyChangedFiles(srcPath, destPath)
|
|
442
|
-
} else {
|
|
443
|
-
|
|
444
|
-
const srcStat = statSync(srcPath)
|
|
445
|
-
let needsCopy = true
|
|
446
|
-
|
|
447
|
-
if (existsSync(destPath)) {
|
|
448
|
-
const destStat = statSync(destPath)
|
|
449
|
-
needsCopy = srcStat.mtime > destStat.mtime
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
if (needsCopy) {
|
|
453
|
-
const { copyFileSync } = require('fs')
|
|
454
|
-
copyFileSync(srcPath, destPath)
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
// CIL[DOC-VECTOR type="context" content="purpose='Copies files from source to destination only when modified.'; No verified external callers; imports: none"]
|
|
333
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Executes a shell command in a given working directory and returns its exit code.'; No verified external callers; imports: none"]
|
|
460
334
|
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
461
335
|
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
462
336
|
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
463
337
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
464
338
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
465
|
-
// CIL[END stable_id="~/.framework/cli/commands/dev.ts:copyChangedFiles:function"]
|