spine-framework 0.3.145 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +76 -0
- package/.framework/.spine-manifest.json +19 -0
- package/.framework/cli/commands/agents.ts +61 -33
- package/.framework/cli/commands/auth.ts +60 -28
- package/.framework/cli/commands/create-app.ts +212 -80
- package/.framework/cli/commands/dev.ts +184 -68
- package/.framework/cli/commands/doctor.ts +324 -152
- package/.framework/cli/commands/generate.ts +119 -68
- package/.framework/cli/commands/init.ts +141 -242
- package/.framework/cli/commands/install-app.ts +1336 -314
- package/.framework/cli/commands/items.ts +31 -29
- package/.framework/cli/commands/migrate.ts +299 -156
- package/.framework/cli/commands/migrations.ts +62 -30
- package/.framework/cli/commands/pipelines.ts +31 -29
- package/.framework/cli/commands/status.ts +105 -45
- package/.framework/cli/commands/system.ts +47 -42
- package/.framework/cli/commands/test.ts +161 -102
- package/.framework/cli/commands/upgrade.ts +260 -0
- package/.framework/cli/commands/validate-app.ts +517 -161
- package/.framework/cli/context.ts +117 -85
- package/.framework/cli/env-loader.ts +74 -43
- package/.framework/cli/index.ts +70 -46
- package/.framework/cli/lib/project-files.ts +404 -0
- package/.framework/docs/guides/testing-guide.md +1 -1
- package/.framework/docs/runtime-types.md +72 -72
- package/.framework/functions/_shared/access.ts +84 -0
- package/.framework/functions/_shared/agent-runner.ts +5051 -1026
- package/.framework/functions/_shared/app-manifest.ts +214 -94
- package/.framework/functions/_shared/ast.ts +214 -0
- package/.framework/functions/_shared/audit.ts +91 -55
- package/.framework/functions/_shared/cil.ts +368 -127
- package/.framework/functions/_shared/db.ts +337 -68
- package/.framework/functions/_shared/funnel.ts +228 -0
- package/.framework/functions/_shared/geo.ts +105 -0
- package/.framework/functions/_shared/hash-api-key.ts +94 -17
- package/.framework/functions/_shared/index.ts +22 -224
- package/.framework/functions/_shared/kb.ts +832 -58
- package/.framework/functions/_shared/llm.ts +118 -18
- package/.framework/functions/_shared/logging.ts +317 -19
- package/.framework/functions/_shared/middleware.ts +701 -131
- package/.framework/functions/_shared/notify.ts +70 -0
- package/.framework/functions/_shared/outcomes.ts +34 -19
- package/.framework/functions/_shared/permissions.ts +501 -315
- package/.framework/functions/_shared/pipeline-runner.ts +704 -155
- package/.framework/functions/_shared/principal.ts +436 -263
- package/.framework/functions/_shared/rate-limit.ts +233 -0
- package/.framework/functions/_shared/resolve-credentials.ts +86 -19
- package/.framework/functions/_shared/resolve-ids.ts +203 -139
- package/.framework/functions/_shared/retry-deliveries.ts +51 -16
- package/.framework/functions/_shared/schema-utils.ts +602 -521
- package/.framework/functions/_shared/security.ts +345 -0
- package/.framework/functions/_shared/testing.ts +197 -172
- package/.framework/functions/_shared/tracing.ts +351 -21
- package/.framework/functions/_shared/trigger-engine.ts +425 -136
- package/.framework/functions/_shared/webhook-registration.ts +71 -70
- package/.framework/functions/_shared/webhook-registry.ts +126 -83
- package/.framework/functions/account-nodes.ts +30 -30
- package/.framework/functions/adapters/generic-webhook-inbound.ts +49 -16
- package/.framework/functions/adapters/generic-webhook-outbound.ts +17 -17
- package/.framework/functions/adapters/openai-outbound.ts +15 -16
- package/.framework/functions/admin-data.ts +596 -173
- package/.framework/functions/admin-funnel.ts +64 -60
- package/.framework/functions/admin-install-funnel.ts +84 -66
- package/.framework/functions/admin-signals.ts +69 -51
- package/.framework/functions/ai-agents.ts +431 -106
- package/.framework/functions/ai-interactions.ts +186 -112
- package/.framework/functions/api-keys.ts +107 -107
- package/.framework/functions/apps.ts +154 -136
- package/.framework/functions/auth.ts +83 -65
- package/.framework/functions/cil-agent-ingest.ts +189 -232
- package/.framework/functions/cil-agent.ts +433 -177
- package/.framework/functions/cil-callmap.ts +642 -430
- package/.framework/functions/cil-config.ts +139 -135
- package/.framework/functions/cil-context.ts +214 -127
- package/.framework/functions/cil-doc.ts +587 -458
- package/.framework/functions/cil-embeddings.ts +453 -364
- package/.framework/functions/cil-graph.ts +427 -142
- package/.framework/functions/cil-ingest.ts +1418 -1154
- package/.framework/functions/cil-pipeline.ts +276 -21
- package/.framework/functions/cil-project.ts +659 -132
- package/.framework/functions/cil-validate.ts +198 -164
- package/.framework/functions/debug-auth.ts +57 -55
- package/.framework/functions/deliveries.ts +80 -21
- package/.framework/functions/embeddings.ts +1023 -318
- package/.framework/functions/eval-harness.ts +146 -108
- package/.framework/functions/integration-outbound.ts +205 -75
- package/.framework/functions/integration-routes.ts +128 -23
- package/.framework/functions/integrations.ts +125 -100
- package/.framework/functions/invites.ts +1095 -460
- package/.framework/functions/item-progress.ts +158 -102
- package/.framework/functions/kb.ts +34 -10
- package/.framework/functions/logs.ts +133 -133
- package/.framework/functions/observability.ts +152 -122
- package/.framework/functions/pipeline-executions.ts +147 -132
- package/.framework/functions/pipelines.ts +134 -119
- package/.framework/functions/prompt-configs.ts +96 -80
- package/.framework/functions/roles.ts +112 -82
- package/.framework/functions/security.ts +450 -0
- package/.framework/functions/system-cron.ts +117 -80
- package/.framework/functions/system.ts +158 -98
- package/.framework/functions/tests.ts +29 -29
- package/.framework/functions/timers.ts +94 -95
- package/.framework/functions/trigger-scheduler.ts +10 -0
- package/.framework/functions/triggers.ts +179 -149
- package/.framework/functions/types.ts +137 -125
- package/.framework/mcp/index.ts +133 -0
- package/.framework/mcp/load-env.ts +60 -0
- package/.framework/mcp/shared/app-manifest.ts +275 -0
- package/.framework/mcp/shared/db.ts +477 -0
- package/.framework/mcp/shared/kb.ts +118 -0
- package/.framework/mcp/tools/architect.ts +431 -0
- package/.framework/mcp/tools/cil/context.ts +345 -0
- package/.framework/mcp/tools/cil/graph.ts +242 -0
- package/.framework/mcp/tools/cil/ingest.ts +1217 -0
- package/.framework/mcp/tools/cil/pipeline-orchestrator.ts +693 -0
- package/.framework/mcp/tools/cil/pipeline.ts +767 -0
- package/.framework/mcp/tools/cil/project.ts +791 -0
- package/.framework/mcp/tools/cil/retrieval.ts +336 -0
- package/.framework/mcp/tools/cil/search-core.ts +454 -0
- package/.framework/mcp/tools/cil/search.ts +97 -0
- package/.framework/mcp/tools/cil/suggest.ts +186 -0
- package/.framework/mcp/tools/cil/validate.ts +1369 -0
- package/.framework/mcp/tools/kb/delete.ts +139 -0
- package/.framework/mcp/tools/kb/index.ts +52 -0
- package/.framework/mcp/tools/kb/ingest.ts +84 -0
- package/.framework/mcp/tools/kb/list-types.ts +102 -0
- package/.framework/mcp/tools/kb/publish.ts +100 -0
- package/.framework/mcp/tools/kb/reindex.ts +86 -0
- package/.framework/mcp/tools/kb/revoke.ts +85 -0
- package/.framework/mcp/tools/kb/search.ts +101 -0
- package/.framework/mcp/tools/kb/upsert.ts +125 -0
- package/.framework/mcp/tools/observability.ts +510 -0
- package/.framework/migrations/001_core_schema.sql +15 -0
- package/.framework/migrations/002_core_rls_and_functions.sql +15 -0
- package/.framework/migrations/003_core_system_data.sql +16 -1
- package/.framework/migrations/004_core_rpc_and_broker.sql +17 -1
- package/.framework/migrations/005_core_observability.sql +17 -1
- package/.framework/migrations/006_security_hardening_rls.sql +15 -0
- package/.framework/migrations/007_kb_article_list.sql +17 -1
- package/.framework/migrations/008_items_target.sql +15 -0
- package/.framework/migrations/009_roles_slug_unique.sql +15 -0
- package/.framework/migrations/010_auth_user_trigger.sql +15 -0
- package/.framework/migrations/011_spine_system_account.sql +16 -0
- package/.framework/migrations/012_service_role_grants.sql +16 -0
- package/.framework/migrations/013_get_account_apps_role_filter.sql +15 -0
- package/.framework/migrations/014_apps_required_roles.sql +16 -0
- package/.framework/migrations/015_types_kind_slug_unique.sql +15 -0
- package/.framework/migrations/016_cil_types.sql +281 -0
- package/.framework/migrations/017_cil_stable_ids.sql +37 -0
- package/.framework/migrations/018_runtime_tables.sql +129 -0
- package/.framework/migrations/019_agent_prompt_columns.sql +56 -0
- package/.framework/migrations/020_schema_reconciliation.sql +67 -0
- package/.framework/migrations/021_kb_embedding_lifecycle.sql +31 -0
- package/.framework/migrations/032_cil_status_migration.sql +73 -0
- package/.framework/migrations/033_cil_versioning.sql +73 -0
- package/.framework/migrations/034_match_embeddings_knn.sql +115 -0
- package/.framework/migrations/035_rate_limits.sql +55 -0
- package/.framework/migrations/036_demo_record_flags.sql +72 -0
- package/.framework/migrations/037_kb_types_canonical.sql +244 -0
- package/.framework/migrations/038_drop_demo_record_flags.sql +38 -0
- package/.framework/migrations/042_registration_hierarchy.sql +309 -0
- package/.framework/migrations/043_policy_actor_cleanup.sql +39 -0
- package/.framework/migrations/044_match_embeddings_filtered_knn.sql +151 -0
- package/.framework/migrations/045_security_critical_rls.sql +139 -0
- package/.framework/migrations/046_security_missing_rls.sql +79 -0
- package/.framework/migrations/047_people_updated_by.sql +27 -0
- package/.framework/migrations/048_watcher_last_seen_at.sql +24 -0
- package/.framework/migrations/049_security_blocklist.sql +148 -0
- package/.framework/migrations/050_notifications.sql +49 -0
- package/.framework/migrations/051_message_agent_fields.sql +74 -0
- package/.framework/migrations/052_registration_security.sql +421 -0
- package/.framework/migrations/053_builtin_action_seeds.sql +66 -0
- package/.framework/migrations/054_kb_ingest_lease.sql +157 -0
- package/.framework/migrations/055_type_id_drift_reconciliation.sql +33 -0
- package/.framework/migrations/056_slug_column_reconciliation.sql +38 -0
- package/.framework/migrations/057_pipelines_slug_identity.sql +14 -0
- package/.framework/migrations/058_account_data_field_declarations.sql +53 -0
- package/.framework/migrations/059_registration_placement_fixes.sql +269 -0
- package/.framework/migrations/060_account_person_record_permissions.sql +38 -0
- package/.framework/migrations/061_fk_dedup.sql +32 -0
- package/.framework/public/spine-logo.svg +10 -3
- package/.framework/scripts/app-install-cli.ts +190 -93
- package/.framework/scripts/assemble-frontend.sh +127 -44
- package/.framework/scripts/assemble-functions.sh +128 -30
- package/.framework/scripts/boundary-check.sh +6 -2
- package/.framework/scripts/build-manifest.sh +24 -68
- package/.framework/scripts/check-core-integrity.sh +15 -76
- package/.framework/scripts/checksum-manifest.mts +343 -0
- package/.framework/scripts/cil-migrate-markers.ts +403 -0
- package/.framework/scripts/fix-cil-markers.mjs +176 -0
- package/.framework/scripts/verify-integrity.sh +21 -57
- package/.framework/scripts/verify-manifest.mts +305 -0
- package/.framework/seeds/types/funnel_signal_use.json +74 -21
- package/.framework/seeds/types/spine_instance.json +73 -21
- package/.framework/src/App.tsx +118 -72
- package/.framework/src/apps/admin/index.tsx +855 -58
- package/.framework/src/components/AppWrapper.tsx +43 -45
- package/.framework/src/components/CustomAppLoader.tsx +160 -116
- package/.framework/src/components/admin/AdminListPage.tsx +46 -44
- package/.framework/src/components/admin/AdminSidebar.tsx +57 -47
- package/.framework/src/components/admin/AdminStatsCard.tsx +46 -44
- package/.framework/src/components/admin/PageInstructions.tsx +98 -2
- package/.framework/src/components/admin/SortableTableHeader.tsx +44 -45
- package/.framework/src/components/app-shell/GenericAppShell.tsx +64 -65
- package/.framework/src/components/app-shell/GenericDetailPage.tsx +44 -47
- package/.framework/src/components/app-shell/GenericListPage.tsx +45 -49
- package/.framework/src/components/app-sidebar.tsx +42 -45
- package/.framework/src/components/auth/ProtectedRoute.tsx +48 -41
- package/.framework/src/components/auth/TurnstileWidget.tsx +27 -0
- package/.framework/src/components/kb/KBArticleEditor.tsx +231 -22
- package/.framework/src/components/kb/KBArticleList.tsx +251 -10
- package/.framework/src/components/layout/AppShell.tsx +51 -45
- package/.framework/src/components/layout/Header.tsx +42 -43
- package/.framework/src/components/layout/Layout.tsx +46 -46
- package/.framework/src/components/layout/Sidebar.tsx +196 -96
- package/.framework/src/components/runtime/DataDetailHeader.tsx +55 -30
- package/.framework/src/components/runtime/DataDetailPage.tsx +31 -269
- package/.framework/src/components/runtime/DataFilters.tsx +49 -74
- package/.framework/src/components/runtime/DataHeader.tsx +53 -32
- package/.framework/src/components/runtime/DataListPage.tsx +51 -155
- package/.framework/src/components/runtime/DataStats.tsx +66 -44
- package/.framework/src/components/runtime/DataTable.tsx +49 -149
- package/.framework/src/components/runtime/SchemaDetailForm.tsx +45 -75
- package/.framework/src/components/runtime/index.ts +119 -16
- package/.framework/src/components/search-form.tsx +46 -29
- package/.framework/src/components/shared/AgentView.tsx +65 -48
- package/.framework/src/components/shared/FieldRenderer.tsx +144 -50
- package/.framework/src/components/shared/InviteManager.tsx +207 -97
- package/.framework/src/components/shared/MemberList.tsx +97 -0
- package/.framework/src/components/shared/SchemaFields.tsx +107 -86
- package/.framework/src/components/ui/DataTable.tsx +80 -68
- package/.framework/src/components/ui/Form.tsx +157 -146
- package/.framework/src/components/ui/ItemCard.tsx +74 -67
- package/.framework/src/components/ui/ItemListView.tsx +73 -68
- package/.framework/src/components/ui/LoadingSpinner.tsx +43 -48
- package/.framework/src/components/ui/Modal.tsx +78 -68
- package/.framework/src/components/ui/RichTextEditor.tsx +89 -69
- package/.framework/src/components/ui/accordion.tsx +85 -86
- package/.framework/src/components/ui/alert-dialog.tsx +197 -184
- package/.framework/src/components/ui/alert.tsx +105 -94
- package/.framework/src/components/ui/aspect-ratio.tsx +57 -43
- package/.framework/src/components/ui/avatar.tsx +122 -107
- package/.framework/src/components/ui/badge.tsx +60 -55
- package/.framework/src/components/ui/breadcrumb.tsx +127 -128
- package/.framework/src/components/ui/button-group.tsx +86 -72
- package/.framework/src/components/ui/button.tsx +71 -50
- package/.framework/src/components/ui/calendar.tsx +72 -57
- package/.framework/src/components/ui/card.tsx +136 -129
- package/.framework/src/components/ui/carousel.tsx +226 -107
- package/.framework/src/components/ui/chart.tsx +252 -147
- package/.framework/src/components/ui/checkbox.tsx +43 -44
- package/.framework/src/components/ui/collapsible.tsx +86 -71
- package/.framework/src/components/ui/combobox.tsx +282 -249
- package/.framework/src/components/ui/command.tsx +158 -146
- package/.framework/src/components/ui/context-menu.tsx +239 -240
- package/.framework/src/components/ui/dialog.tsx +174 -157
- package/.framework/src/components/ui/direction.tsx +72 -56
- package/.framework/src/components/ui/drawer.tsx +168 -169
- package/.framework/src/components/ui/dropdown-menu.tsx +254 -223
- package/.framework/src/components/ui/empty.tsx +131 -120
- package/.framework/src/components/ui/field.tsx +205 -173
- package/.framework/src/components/ui/hover-card.tsx +71 -72
- package/.framework/src/components/ui/input-group.tsx +148 -133
- package/.framework/src/components/ui/input-otp.tsx +99 -86
- package/.framework/src/components/ui/input.tsx +43 -41
- package/.framework/src/components/ui/item.tsx +207 -185
- package/.framework/src/components/ui/kbd.tsx +57 -56
- package/.framework/src/components/ui/label.tsx +45 -41
- package/.framework/src/components/ui/menubar.tsx +268 -236
- package/.framework/src/components/ui/native-select.tsx +85 -86
- package/.framework/src/components/ui/navigation-menu.tsx +166 -156
- package/.framework/src/components/ui/pagination.tsx +131 -141
- package/.framework/src/components/ui/popover.tsx +125 -128
- package/.framework/src/components/ui/progress.tsx +47 -44
- package/.framework/src/components/ui/radio-group.tsx +60 -55
- package/.framework/src/components/ui/resizable.tsx +85 -72
- package/.framework/src/components/ui/scroll-area.tsx +57 -58
- package/.framework/src/components/ui/select.tsx +182 -169
- package/.framework/src/components/ui/separator.tsx +42 -43
- package/.framework/src/components/ui/sheet.tsx +170 -159
- package/.framework/src/components/ui/sidebar.tsx +395 -398
- package/.framework/src/components/ui/skeleton.tsx +42 -43
- package/.framework/src/components/ui/slider.tsx +61 -44
- package/.framework/src/components/ui/sonner.tsx +44 -44
- package/.framework/src/components/ui/spinner.tsx +47 -42
- package/.framework/src/components/ui/switch.tsx +56 -42
- package/.framework/src/components/ui/table-primitives.tsx +272 -132
- package/.framework/src/components/ui/table.tsx +140 -142
- package/.framework/src/components/ui/tabs.tsx +110 -93
- package/.framework/src/components/ui/textarea.tsx +43 -44
- package/.framework/src/components/ui/toggle-group.tsx +87 -71
- package/.framework/src/components/ui/toggle.tsx +56 -56
- package/.framework/src/components/ui/tooltip.tsx +99 -85
- package/.framework/src/contexts/AppContext.tsx +166 -114
- package/.framework/src/contexts/AuthContext.tsx +232 -137
- package/.framework/src/hooks/use-mobile.ts +43 -44
- package/.framework/src/hooks/useApi.ts +185 -172
- package/.framework/src/hooks/useAppPath.ts +31 -29
- package/.framework/src/hooks/useApps.ts +77 -42
- package/.framework/src/hooks/useEntityList.ts +66 -29
- package/.framework/src/hooks/useEntityRecord.ts +76 -32
- package/.framework/src/hooks/useForm.ts +62 -30
- package/.framework/src/hooks/useListSchema.ts +60 -43
- package/.framework/src/hooks/useSchemaRecord.ts +115 -95
- package/.framework/src/lib/api.ts +258 -134
- package/.framework/src/lib/registration.ts +181 -0
- package/.framework/src/lib/supabase.ts +118 -81
- package/.framework/src/lib/utils.ts +266 -266
- package/.framework/src/main.tsx +43 -44
- package/.framework/src/pages/DashboardPage.tsx +44 -43
- package/.framework/src/pages/NoAppPage.tsx +50 -0
- package/.framework/src/pages/NotFoundPage.tsx +32 -29
- package/.framework/src/pages/SetupPage.tsx +34 -33
- package/.framework/src/pages/admin/AIAgentDetailPage.tsx +69 -58
- package/.framework/src/pages/admin/AIAgentsPage.tsx +43 -40
- package/.framework/src/pages/admin/APIKeyDetailPage.tsx +63 -55
- package/.framework/src/pages/admin/APIKeysPage.tsx +44 -42
- package/.framework/src/pages/admin/AlertsConfigPage.tsx +117 -94
- package/.framework/src/pages/admin/AppDetailPage.tsx +48 -42
- package/.framework/src/pages/admin/AppsPage.tsx +45 -42
- package/.framework/src/pages/admin/DeliveriesPage.tsx +49 -17
- package/.framework/src/pages/admin/DesignedPage.tsx +31 -30
- package/.framework/src/pages/admin/EmbeddingDetailPage.tsx +58 -0
- package/.framework/src/pages/admin/EmbeddingsPage.tsx +49 -0
- package/.framework/src/pages/admin/ExtendedShadcnTestPage.tsx +31 -29
- package/.framework/src/pages/admin/IncrementalShadcnTestPage.tsx +46 -29
- package/.framework/src/pages/admin/IntegratedDashboard.tsx +32 -29
- package/.framework/src/pages/admin/IntegrationDetailPage.tsx +68 -55
- package/.framework/src/pages/admin/IntegrationsPage.tsx +45 -42
- package/.framework/src/pages/admin/InvitesPage.tsx +60 -44
- package/.framework/src/pages/admin/LogsPage.tsx +87 -137
- package/.framework/src/pages/admin/MinimalShadcnTestPage.tsx +31 -29
- package/.framework/src/pages/admin/ObservabilityDashboard.tsx +150 -89
- package/.framework/src/pages/admin/PipelineDetailPage.tsx +77 -104
- package/.framework/src/pages/admin/PipelineExecutionsPage.tsx +44 -43
- package/.framework/src/pages/admin/PipelinesPage.tsx +59 -145
- package/.framework/src/pages/admin/PromptConfigDetailPage.tsx +53 -42
- package/.framework/src/pages/admin/PromptConfigsPage.tsx +47 -117
- package/.framework/src/pages/admin/ProperlyDesignedPage.tsx +31 -44
- package/.framework/src/pages/admin/RoleDetailPage.tsx +49 -92
- package/.framework/src/pages/admin/RolesPage.tsx +47 -164
- package/.framework/src/pages/admin/SecurityPage.tsx +310 -0
- package/.framework/src/pages/admin/SelectTestPage.tsx +30 -32
- package/.framework/src/pages/admin/ShadcnTestPage.tsx +37 -44
- package/.framework/src/pages/admin/SimpleDashboard.tsx +32 -44
- package/.framework/src/pages/admin/TestRunDetailPage.tsx +97 -44
- package/.framework/src/pages/admin/TestingDashboard.tsx +126 -71
- package/.framework/src/pages/admin/TimerDetailPage.tsx +67 -55
- package/.framework/src/pages/admin/TimersPage.tsx +44 -42
- package/.framework/src/pages/admin/TriggerDetailPage.tsx +47 -42
- package/.framework/src/pages/admin/TriggersPage.tsx +58 -57
- package/.framework/src/pages/admin/TypeDetailPage.tsx +91 -55
- package/.framework/src/pages/admin/TypesPage.tsx +45 -42
- package/.framework/src/pages/admin/cil/CILAgentPage.tsx +258 -128
- package/.framework/src/pages/admin/cil/CILChunkDetailPage.tsx +127 -123
- package/.framework/src/pages/admin/cil/CILDashboardPage.tsx +308 -235
- package/.framework/src/pages/admin/cil/CILFileListPage.tsx +159 -110
- package/.framework/src/pages/admin/cil/CILFileSelectPage.tsx +432 -0
- package/.framework/src/pages/admin/cil/CILGraphPage.tsx +200 -178
- package/.framework/src/pages/admin/cil/CILIngestionPage.tsx +286 -239
- package/.framework/src/pages/admin/cil/CILProjectsPage.tsx +211 -90
- package/.framework/src/pages/admin/cil/CILSearchPage.tsx +156 -143
- package/.framework/src/pages/admin/cil/CILSuggestionsPage.tsx +379 -0
- package/.framework/src/pages/admin/cil/CILVersionsPage.tsx +337 -0
- package/.framework/src/pages/admin/cil/FlexiblePipelinePage.tsx +219 -214
- package/.framework/src/pages/admin/kb/KBAdminPage.tsx +64 -0
- package/.framework/src/pages/auth/AuthConfirmPage.tsx +135 -65
- package/.framework/src/pages/auth/ForgotPasswordPage.tsx +39 -31
- package/.framework/src/pages/auth/LoginPage.tsx +38 -32
- package/.framework/src/pages/auth/PendingApprovalPage.tsx +31 -28
- package/.framework/src/pages/auth/RegisterPage.tsx +429 -155
- package/.framework/src/pages/spine-framework/APIPage.tsx +33 -30
- package/.framework/src/pages/spine-framework/CLIPage.tsx +32 -30
- package/.framework/src/types/auth.ts +101 -93
- package/.framework/src/types/types.ts +283 -262
- package/.framework/templates/project.json +87 -0
- package/.framework/templates/spine.config.neutral.json +7 -0
- package/.framework/tests/api/api-surface.test.ts +381 -0
- package/.framework/tests/fixtures/seed.ts +427 -0
- package/.framework/tests/fixtures/teardown.ts +228 -0
- package/.framework/tests/reporter.ts +351 -0
- package/.framework/tests/setup.ts +135 -0
- package/.framework/tests/ui/ui-sweep.ts +278 -0
- package/.framework/tests/unit/admin-data-logger.test.ts +310 -0
- package/.framework/tests/unit/agent-runner.test.ts +2389 -0
- package/.framework/tests/unit/ai-interactions.test.ts +81 -0
- package/.framework/tests/unit/app-manifest.test.ts +359 -0
- package/.framework/tests/unit/assembly-scripts.test.ts +172 -0
- package/.framework/tests/unit/cil-determinism.test.ts +85 -0
- package/.framework/tests/unit/core-isolation.test.ts +153 -0
- package/.framework/tests/unit/funnel-signals.test.ts +135 -0
- package/.framework/tests/unit/install-app.test.ts +1759 -0
- package/.framework/tests/unit/invites-security.test.ts +572 -0
- package/.framework/tests/unit/kb-ingest-lease.test.ts +287 -0
- package/.framework/tests/unit/kb-search.test.ts +119 -0
- package/.framework/tests/unit/migrate.test.ts +509 -0
- package/.framework/tests/unit/notify.test.ts +136 -0
- package/.framework/tests/unit/permissions.test.ts +269 -0
- package/.framework/tests/unit/pipeline-runner.test.ts +755 -0
- package/.framework/tests/unit/principal-cache.test.ts +138 -0
- package/.framework/tests/unit/retrieval-golden.test.ts +520 -0
- package/.framework/tests/unit/runtime-isolation.test.ts +642 -0
- package/.framework/tests/unit/schema-utils.test.ts +225 -0
- package/.framework/tests/unit/trigger-engine.test.ts +513 -0
- package/.framework/tests/unit/validate-app.test.ts +527 -0
- package/README.md +34 -3
- package/bin/spine-framework.cjs +1 -0
- package/config/tailwind.config.cjs +7 -0
- package/config/tsconfig.functions.json +42 -0
- package/config/tsconfig.json +37 -9
- package/config/vite.config.ts +31 -2
- package/netlify.toml +31 -3
- package/package.json +46 -29
- package/scripts/assemble-frontend.sh +127 -44
- package/scripts/assemble-functions.sh +127 -29
- package/scripts/boundary-check.sh +6 -2
- package/scripts/build-manifest.sh +24 -68
- package/scripts/checksum-manifest.mts +345 -0
- package/scripts/dev-clean.sh +86 -0
- package/scripts/dev-netlify.sh +49 -0
- package/scripts/netlify-dev-wrapper.sh +2 -0
- package/scripts/verify-install.ts +358 -0
- package/scripts/verify-integrity.sh +21 -57
- package/scripts/verify-manifest.mts +305 -0
- package/templates/project/gitignore +45 -0
- package/{config → templates/project}/package-lock.json +22335 -9366
- package/vitest.config.ts +46 -0
- package/.framework/public/spine.config.json +0 -91
- package/config/deno.lock +0 -108
- package/config/tsconfig.node.tsbuildinfo +0 -1
- package/config/tsconfig.tsbuildinfo +0 -1
- package/config/vite.config.d.ts +0 -2
- package/custom/.devin/AGENT.md +0 -357
- package/custom/.devin/skills/install-app/SKILL.md +0 -39
- package/custom/.devin/skills/spine-workbench-discovery/SKILL.md +0 -39
- package/custom/.devin/skills/spine-workbench-idea/SKILL.md +0 -36
- package/custom/.devin/skills/spine-workbench-implement/SKILL.md +0 -46
- package/custom/.devin/skills/spine-workbench-initiative/SKILL.md +0 -28
- package/custom/.devin/skills/spine-workbench-plan/SKILL.md +0 -38
- package/custom/.devin/workflows/app-install.yaml +0 -83
- package/custom/README.md +0 -79
- package/docs/README.md +0 -15
- package/scripts/app-install-cli.ts +0 -286
- package/scripts/check-core-integrity.sh +0 -82
- package/scripts/ingest-chunks.cjs +0 -202
- package/scripts/kb-chunk-parser.cjs +0 -312
- package/scripts/kb-chunk-parser.ts +0 -330
- package/scripts/kb-ingest-docs.ts +0 -203
- package/scripts/load-test-app-install.ts +0 -484
- package/scripts/test-login.js +0 -33
- package/spine.config.json +0 -91
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
// CIL[BEGIN
|
|
2
|
-
// CIL[DOC-MACRO purpose="Module header
|
|
3
|
-
// CIL[DOC-RESPONSIBILITY responsibility="
|
|
4
|
-
// CIL[DOC-CONTEXT module="
|
|
5
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="
|
|
6
|
-
// CIL[DOC-MICRO logic_summary="Declares
|
|
7
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.
|
|
1
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:module_header:module_header" type="module_header" identity="module_header" parent="~/.framework/functions/cil-doc.ts"]
|
|
2
|
+
// CIL[DOC-MACRO purpose="Module header for the CIL documentation service, defining imports and module constants."]
|
|
3
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Orients readers to the module, its entry points, and key dependencies."]
|
|
4
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="shared-core" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts"]
|
|
5
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="none" errors="none" side_effects="none"]
|
|
6
|
+
// CIL[DOC-MICRO logic_summary="Declares imports and constants used throughout the CIL documentation pipeline." notable_decisions="none"]
|
|
7
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
8
8
|
// CIL[DOC-STABILITY stability="stable"]
|
|
9
|
-
// CIL[DOC-AUDIENCE audience="
|
|
10
|
-
// CIL[DOC-VECTOR type="context" content="Layer: function. Direct callers: 0. Direct calls: 0. Related files: custom/apps/cortex/pages/operations/OperationsDashboard.tsx, custom/apps/portal/pages/ContentPage.tsx, .framework/src/pages/admin/TypeDetailPage.tsx, .framework/functions/_shared/principal.ts, .framework/functions/_shared/schema-utils.ts, \."]
|
|
11
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
12
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
13
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
14
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
15
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
9
|
+
// CIL[DOC-AUDIENCE audience="both"]
|
|
16
10
|
|
|
17
11
|
|
|
18
12
|
|
|
@@ -22,9 +16,16 @@ import { createHandler } from './_shared/middleware'
|
|
|
22
16
|
import { adminDb } from './_shared/db'
|
|
23
17
|
import { update as adminUpdate } from './admin-data'
|
|
24
18
|
import { callOpenAIChat } from './_shared/llm'
|
|
25
|
-
import { FileStatus, FileTreeNode, isSelectedPath, getFileStatus, updateTreeNodeStatus, saveProjectTree } from './_shared/cil'
|
|
19
|
+
import { FileStatus, FileTreeNode, isSelectedPath, getFileStatus, updateTreeNodeStatus, saveProjectTree, parseStableId } from './_shared/cil'
|
|
26
20
|
import * as fs from 'fs'
|
|
27
21
|
import * as path from 'path'
|
|
22
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Module header for the CIL documentation service, defining imports and module constants.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
23
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
24
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
25
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
26
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
27
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
28
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:module_header:module_header"]
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
|
|
@@ -34,22 +35,22 @@ import * as path from 'path'
|
|
|
34
35
|
|
|
35
36
|
|
|
36
37
|
|
|
37
|
-
// CIL[
|
|
38
|
-
// CIL[
|
|
39
|
-
// CIL[DOC-
|
|
40
|
-
// CIL[DOC-
|
|
41
|
-
// CIL[DOC-
|
|
42
|
-
// CIL[DOC-
|
|
43
|
-
// CIL[DOC-
|
|
44
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
38
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:DEFAULT_MODEL:constant" type="constant" identity="DEFAULT_MODEL" parent="~/.framework/functions/cil-doc.ts"]
|
|
39
|
+
// CIL[DOC-MACRO purpose="Declares the d e f a u l t_ m o d e l constant used by the documentation pipeline."]
|
|
40
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Provides the d e f a u l t_ m o d e l value used across documentation operations."]
|
|
41
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
42
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="none" errors="none" side_effects="none"]
|
|
43
|
+
// CIL[DOC-MICRO logic_summary="none" notable_decisions="none"]
|
|
44
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
45
45
|
// CIL[DOC-STABILITY stability="stable"]
|
|
46
|
-
|
|
47
|
-
// CIL[DOC-VECTOR type="
|
|
48
|
-
// CIL[DOC-VECTOR type="
|
|
49
|
-
// CIL[DOC-VECTOR type="
|
|
46
|
+
const DEFAULT_MODEL = 'gpt-4o-mini'
|
|
47
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Declares the d e f a u l t_ m o d e l constant used by the documentation pipeline.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
48
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
49
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
50
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
50
51
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
51
52
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
52
|
-
|
|
53
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:DEFAULT_MODEL:constant"]
|
|
53
54
|
|
|
54
55
|
|
|
55
56
|
|
|
@@ -59,27 +60,27 @@ const DEFAULT_MODEL = 'gpt-4o-mini'
|
|
|
59
60
|
|
|
60
61
|
|
|
61
62
|
|
|
62
|
-
// CIL[
|
|
63
|
-
// CIL[
|
|
64
|
-
// CIL[DOC-
|
|
65
|
-
// CIL[DOC-
|
|
66
|
-
// CIL[DOC-
|
|
67
|
-
// CIL[DOC-
|
|
68
|
-
// CIL[DOC-
|
|
69
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
63
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:MODEL_PRICES:constant" type="constant" identity="MODEL_PRICES" parent="~/.framework/functions/cil-doc.ts"]
|
|
64
|
+
// CIL[DOC-MACRO purpose="Declares the m o d e l_ p r i c e s constant used by the documentation pipeline."]
|
|
65
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Provides the m o d e l_ p r i c e s value used across documentation operations."]
|
|
66
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
67
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="none" errors="none" side_effects="none"]
|
|
68
|
+
// CIL[DOC-MICRO logic_summary="none" notable_decisions="none"]
|
|
69
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
70
70
|
// CIL[DOC-STABILITY stability="stable"]
|
|
71
|
-
// CIL[DOC-VECTOR type="context" content="Layer: function. Direct callers: 0. Direct calls: 0. Related files: custom/apps/cortex/functions/custom_cil-embeddings.ts, .framework/src/pages/admin/TypeDetailPage.tsx, .framework/functions/_shared/principal.ts, .framework/src/pages/admin/IntegrationsPage.tsx, \."]
|
|
72
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
73
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
74
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
75
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
76
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
77
71
|
const MODEL_PRICES: Record<string, { input_per_1m: number; output_per_1m: number }> = {
|
|
78
72
|
'gpt-4o-mini': { input_per_1m: 0.15, output_per_1m: 0.60 },
|
|
79
73
|
'gpt-4o': { input_per_1m: 2.50, output_per_1m: 10.00 },
|
|
80
74
|
'gpt-4-turbo': { input_per_1m: 10.00, output_per_1m: 30.00 },
|
|
81
75
|
'gpt-3.5-turbo': { input_per_1m: 0.50, output_per_1m: 1.50 },
|
|
82
76
|
}
|
|
77
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Declares the m o d e l_ p r i c e s constant used by the documentation pipeline.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
78
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
79
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
80
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
81
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
82
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
83
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:MODEL_PRICES:constant"]
|
|
83
84
|
|
|
84
85
|
|
|
85
86
|
|
|
@@ -88,22 +89,22 @@ const MODEL_PRICES: Record<string, { input_per_1m: number; output_per_1m: number
|
|
|
88
89
|
|
|
89
90
|
|
|
90
91
|
|
|
91
|
-
// CIL[
|
|
92
|
-
// CIL[
|
|
93
|
-
// CIL[DOC-
|
|
94
|
-
// CIL[DOC-
|
|
95
|
-
// CIL[DOC-
|
|
96
|
-
// CIL[DOC-
|
|
97
|
-
// CIL[DOC-
|
|
98
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
92
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:ESTIMATED_OUTPUT_TOKENS_PER_CHUNK:constant" type="constant" identity="ESTIMATED_OUTPUT_TOKENS_PER_CHUNK" parent="~/.framework/functions/cil-doc.ts"]
|
|
93
|
+
// CIL[DOC-MACRO purpose="Declares the e s t i m a t e d_ o u t p u t_ t o k e n s_ p e r_ c h u n k constant used by the documentation pipeline."]
|
|
94
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Provides the e s t i m a t e d_ o u t p u t_ t o k e n s_ p e r_ c h u n k value used across documentation operations."]
|
|
95
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
96
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="none" errors="none" side_effects="none"]
|
|
97
|
+
// CIL[DOC-MICRO logic_summary="none" notable_decisions="none"]
|
|
98
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
99
99
|
// CIL[DOC-STABILITY stability="stable"]
|
|
100
|
-
|
|
101
|
-
// CIL[DOC-VECTOR type="
|
|
102
|
-
// CIL[DOC-VECTOR type="
|
|
103
|
-
// CIL[DOC-VECTOR type="
|
|
100
|
+
const ESTIMATED_OUTPUT_TOKENS_PER_CHUNK = 200
|
|
101
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Declares the e s t i m a t e d_ o u t p u t_ t o k e n s_ p e r_ c h u n k constant used by the documentation pipeline.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
102
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
103
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
104
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
104
105
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
105
106
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
106
|
-
|
|
107
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:ESTIMATED_OUTPUT_TOKENS_PER_CHUNK:constant"]
|
|
107
108
|
|
|
108
109
|
|
|
109
110
|
|
|
@@ -111,22 +112,22 @@ const ESTIMATED_OUTPUT_TOKENS_PER_CHUNK = 200
|
|
|
111
112
|
|
|
112
113
|
|
|
113
114
|
|
|
114
|
-
// CIL[
|
|
115
|
-
// CIL[
|
|
116
|
-
// CIL[DOC-
|
|
117
|
-
// CIL[DOC-
|
|
118
|
-
// CIL[DOC-
|
|
119
|
-
// CIL[DOC-
|
|
120
|
-
// CIL[DOC-
|
|
121
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
115
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:SYSTEM_PROMPT_OVERHEAD_TOKENS:constant" type="constant" identity="SYSTEM_PROMPT_OVERHEAD_TOKENS" parent="~/.framework/functions/cil-doc.ts"]
|
|
116
|
+
// CIL[DOC-MACRO purpose="Declares the s y s t e m_ p r o m p t_ o v e r h e a d_ t o k e n s constant used by the documentation pipeline."]
|
|
117
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Provides the s y s t e m_ p r o m p t_ o v e r h e a d_ t o k e n s value used across documentation operations."]
|
|
118
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
119
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="none" errors="none" side_effects="none"]
|
|
120
|
+
// CIL[DOC-MICRO logic_summary="none" notable_decisions="none"]
|
|
121
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
122
122
|
// CIL[DOC-STABILITY stability="stable"]
|
|
123
|
-
|
|
124
|
-
// CIL[DOC-VECTOR type="
|
|
125
|
-
// CIL[DOC-VECTOR type="
|
|
126
|
-
// CIL[DOC-VECTOR type="
|
|
123
|
+
const SYSTEM_PROMPT_OVERHEAD_TOKENS = 350
|
|
124
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Declares the s y s t e m_ p r o m p t_ o v e r h e a d_ t o k e n s constant used by the documentation pipeline.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
125
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
126
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
127
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
127
128
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
128
129
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
129
|
-
|
|
130
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:SYSTEM_PROMPT_OVERHEAD_TOKENS:constant"]
|
|
130
131
|
|
|
131
132
|
|
|
132
133
|
|
|
@@ -136,24 +137,24 @@ const SYSTEM_PROMPT_OVERHEAD_TOKENS = 350
|
|
|
136
137
|
|
|
137
138
|
|
|
138
139
|
|
|
139
|
-
// CIL[
|
|
140
|
-
// CIL[
|
|
141
|
-
// CIL[DOC-
|
|
142
|
-
// CIL[DOC-
|
|
143
|
-
// CIL[DOC-
|
|
144
|
-
// CIL[DOC-
|
|
145
|
-
// CIL[DOC-
|
|
146
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
140
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:estimateTokens:function" type="function" identity="estimateTokens" parent="~/.framework/functions/cil-doc.ts"]
|
|
141
|
+
// CIL[DOC-MACRO purpose="Implements the estimate tokens behavior for CIL documentation processing."]
|
|
142
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Carries out the estimate tokens responsibility within the documentation workflow."]
|
|
143
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
144
|
+
// CIL[DOC-CONTRACT inputs="text: string" outputs="number" errors="none" side_effects="none"]
|
|
145
|
+
// CIL[DOC-MICRO logic_summary="Computes the estimate tokens result from the provided input parameters." notable_decisions="none"]
|
|
146
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
147
147
|
// CIL[DOC-STABILITY stability="stable"]
|
|
148
|
-
// CIL[DOC-VECTOR type="context" content="Layer: function. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
149
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
150
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
151
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
152
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
153
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
154
148
|
function estimateTokens(text: string): number {
|
|
155
149
|
return Math.ceil(text.length / 4)
|
|
156
150
|
}
|
|
151
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Implements the estimate tokens behavior for CIL documentation processing.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
152
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
153
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
154
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
155
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
156
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
157
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:estimateTokens:function"]
|
|
157
158
|
|
|
158
159
|
|
|
159
160
|
|
|
@@ -161,21 +162,14 @@ function estimateTokens(text: string): number {
|
|
|
161
162
|
|
|
162
163
|
|
|
163
164
|
|
|
164
|
-
// CIL[
|
|
165
|
-
// CIL[
|
|
166
|
-
// CIL[DOC-
|
|
167
|
-
// CIL[DOC-
|
|
168
|
-
// CIL[DOC-
|
|
169
|
-
// CIL[DOC-
|
|
170
|
-
// CIL[DOC-
|
|
171
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
165
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:needsDocumentation:function" type="function" identity="needsDocumentation" parent="~/.framework/functions/cil-doc.ts"]
|
|
166
|
+
// CIL[DOC-MACRO purpose="Implements the needs documentation behavior for CIL documentation processing."]
|
|
167
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Carries out the needs documentation responsibility within the documentation workflow."]
|
|
168
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
169
|
+
// CIL[DOC-CONTRACT inputs="chunk: any" outputs="boolean" errors="none" side_effects="none"]
|
|
170
|
+
// CIL[DOC-MICRO logic_summary="Computes the needs documentation result from the provided input parameters." notable_decisions="none"]
|
|
171
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
172
172
|
// CIL[DOC-STABILITY stability="stable"]
|
|
173
|
-
// CIL[DOC-VECTOR type="context" content="Layer: function. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
174
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
175
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
176
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
177
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
178
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
179
173
|
function needsDocumentation(chunk: any): boolean {
|
|
180
174
|
const d = chunk.data || {}
|
|
181
175
|
|
|
@@ -188,6 +182,13 @@ function needsDocumentation(chunk: any): boolean {
|
|
|
188
182
|
: REQUIRED_CHUNK_FIELDS
|
|
189
183
|
return required.some(f => !d[f] || String(d[f]).trim() === '')
|
|
190
184
|
}
|
|
185
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Implements the needs documentation behavior for CIL documentation processing.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
186
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
187
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
188
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
189
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
190
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
191
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:needsDocumentation:function"]
|
|
191
192
|
|
|
192
193
|
|
|
193
194
|
|
|
@@ -196,21 +197,14 @@ function needsDocumentation(chunk: any): boolean {
|
|
|
196
197
|
|
|
197
198
|
|
|
198
199
|
|
|
199
|
-
// CIL[
|
|
200
|
-
// CIL[
|
|
201
|
-
// CIL[DOC-
|
|
202
|
-
// CIL[DOC-
|
|
203
|
-
// CIL[DOC-
|
|
204
|
-
// CIL[DOC-
|
|
205
|
-
// CIL[DOC-
|
|
206
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
200
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:loadAllChunks:function" type="function" identity="loadAllChunks" parent="~/.framework/functions/cil-doc.ts"]
|
|
201
|
+
// CIL[DOC-MACRO purpose="Implements the load all chunks behavior for CIL documentation processing."]
|
|
202
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Carries out the load all chunks responsibility within the documentation workflow."]
|
|
203
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
204
|
+
// CIL[DOC-CONTRACT inputs="projectId: string, filePath?: string" outputs="Promise<any[]>" errors="Throws Error on invalid input or missing resources" side_effects="none"]
|
|
205
|
+
// CIL[DOC-MICRO logic_summary="Computes the load all chunks result from the provided input parameters." notable_decisions="none"]
|
|
206
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
207
207
|
// CIL[DOC-STABILITY stability="stable"]
|
|
208
|
-
// CIL[DOC-VECTOR type="context" content="Layer: function. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
209
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
210
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
211
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
212
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
213
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
214
208
|
async function loadAllChunks(projectId: string, filePath?: string): Promise<any[]> {
|
|
215
209
|
const PAGE = 1000
|
|
216
210
|
const all: any[] = []
|
|
@@ -232,25 +226,114 @@ async function loadAllChunks(projectId: string, filePath?: string): Promise<any[
|
|
|
232
226
|
}
|
|
233
227
|
return all
|
|
234
228
|
}
|
|
229
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Implements the load all chunks behavior for CIL documentation processing.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
230
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
231
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
232
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
233
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
234
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
235
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:loadAllChunks:function"]
|
|
236
|
+
|
|
235
237
|
|
|
236
238
|
|
|
237
239
|
|
|
238
240
|
|
|
239
|
-
// CIL[
|
|
240
|
-
// CIL[
|
|
241
|
-
// CIL[DOC-
|
|
242
|
-
// CIL[DOC-
|
|
243
|
-
// CIL[DOC-
|
|
244
|
-
// CIL[DOC-
|
|
245
|
-
// CIL[DOC-
|
|
246
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
241
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:resolveChunk:function" type="function" identity="resolveChunk" parent="~/.framework/functions/cil-doc.ts"]
|
|
242
|
+
// CIL[DOC-MACRO purpose="Implements the resolve chunk behavior for CIL documentation processing."]
|
|
243
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Carries out the resolve chunk responsibility within the documentation workflow."]
|
|
244
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
245
|
+
// CIL[DOC-CONTRACT inputs="ctx: any, body: any" outputs="Promise<any>" errors="Throws Error on invalid input or missing resources" side_effects="Supabase database queries and updates"]
|
|
246
|
+
// CIL[DOC-MICRO logic_summary="Computes the resolve chunk result from the provided input parameters." notable_decisions="none"]
|
|
247
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
247
248
|
// CIL[DOC-STABILITY stability="stable"]
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
249
|
+
async function resolveChunk(
|
|
250
|
+
ctx: any,
|
|
251
|
+
body: any
|
|
252
|
+
): Promise<any> {
|
|
253
|
+
const stableId = body?.stable_id || ctx.query?.stable_id
|
|
254
|
+
const versionId = body?.version_id || ctx.query?.version_id
|
|
255
|
+
const chunkId = body?.chunk_id || ctx.query?.chunk_id
|
|
256
|
+
const chunkName = body?.chunk_name || ctx.query?.chunk_name
|
|
257
|
+
const projectId = body?.project_id || ctx.query?.project_id
|
|
258
|
+
|
|
259
|
+
if (stableId) {
|
|
260
|
+
if (parseStableId(stableId) === null) {
|
|
261
|
+
throw new Error(`Invalid stable_id: ${stableId}`)
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
if (versionId) {
|
|
265
|
+
const { data: chunk, error } = await adminDb
|
|
266
|
+
.from('items')
|
|
267
|
+
.select('id, title, data')
|
|
268
|
+
.filter('data->>kb_type', 'eq', 'cil_chunk')
|
|
269
|
+
.filter('data->>stable_id', 'eq', stableId)
|
|
270
|
+
.filter('data->>version_id', 'eq', versionId)
|
|
271
|
+
.eq('is_active', true)
|
|
272
|
+
.maybeSingle()
|
|
273
|
+
if (error || !chunk) throw new Error(`Chunk not found for stable_id: ${stableId}, version_id: ${versionId}`)
|
|
274
|
+
return chunk
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
let activeVersion: string | undefined
|
|
278
|
+
if (projectId) {
|
|
279
|
+
const { data: proj } = await adminDb.from('items').select('data').eq('id', projectId).maybeSingle()
|
|
280
|
+
activeVersion = proj?.data?.active_version_id
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
let q = adminDb
|
|
284
|
+
.from('items')
|
|
285
|
+
.select('id, title, data')
|
|
286
|
+
.filter('data->>kb_type', 'eq', 'cil_chunk')
|
|
287
|
+
.filter('data->>stable_id', 'eq', stableId)
|
|
288
|
+
.eq('is_active', true)
|
|
289
|
+
if (activeVersion) q = q.filter('data->>version_id', 'eq', activeVersion)
|
|
290
|
+
const { data: chunk, error } = await q.maybeSingle()
|
|
291
|
+
if (error || !chunk) {
|
|
292
|
+
throw new Error(`Chunk not found for stable_id: ${stableId}${activeVersion ? ` (active version ${activeVersion})` : ''}`)
|
|
293
|
+
}
|
|
294
|
+
return chunk
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (chunkId) {
|
|
298
|
+
const { data: chunk, error } = await adminDb
|
|
299
|
+
.from('items')
|
|
300
|
+
.select('id, title, data')
|
|
301
|
+
.eq('id', chunkId)
|
|
302
|
+
.maybeSingle()
|
|
303
|
+
if (error || !chunk) throw new Error(`Chunk not found: ${chunkId}`)
|
|
304
|
+
return chunk
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
if (chunkName) {
|
|
308
|
+
const { data: chunk, error } = await adminDb
|
|
309
|
+
.from('items')
|
|
310
|
+
.select('id, title, data')
|
|
311
|
+
.filter('data->>kb_type', 'eq', 'cil_chunk')
|
|
312
|
+
.filter('data->>chunk_name', 'eq', chunkName)
|
|
313
|
+
.eq('is_active', true)
|
|
314
|
+
.maybeSingle()
|
|
315
|
+
if (error || !chunk) throw new Error(`Chunk not found: ${chunkName}`)
|
|
316
|
+
return chunk
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
throw new Error('chunk_id, stable_id, or chunk_name is required')
|
|
320
|
+
}
|
|
321
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Implements the resolve chunk behavior for CIL documentation processing.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
322
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
323
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
324
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
252
325
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
253
326
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
327
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:resolveChunk:function"]
|
|
328
|
+
|
|
329
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:loadPendingChunks:function" type="function" identity="loadPendingChunks" parent="~/.framework/functions/cil-doc.ts"]
|
|
330
|
+
// CIL[DOC-MACRO purpose="Implements the load pending chunks behavior for CIL documentation processing."]
|
|
331
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Carries out the load pending chunks responsibility within the documentation workflow."]
|
|
332
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
333
|
+
// CIL[DOC-CONTRACT inputs="projectId: string, selectedPaths: string[], requiredStatus: FileStatus" outputs="Promise<any[]>" errors="none" side_effects="none"]
|
|
334
|
+
// CIL[DOC-MICRO logic_summary="Computes the load pending chunks result from the provided input parameters." notable_decisions="none"]
|
|
335
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
336
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
254
337
|
async function loadPendingChunks(projectId: string, selectedPaths: string[], requiredStatus: FileStatus): Promise<any[]> {
|
|
255
338
|
const { data: fileItems } = await adminDb
|
|
256
339
|
.from('items')
|
|
@@ -274,25 +357,25 @@ async function loadPendingChunks(projectId: string, selectedPaths: string[], req
|
|
|
274
357
|
|
|
275
358
|
return (allChunks || []).filter((c: any) => selectedFileIds.includes(c.data?.file_id))
|
|
276
359
|
}
|
|
360
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Implements the load pending chunks behavior for CIL documentation processing.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
361
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
362
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
363
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
364
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
365
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
366
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:loadPendingChunks:function"]
|
|
277
367
|
|
|
278
368
|
|
|
279
369
|
|
|
280
370
|
|
|
281
|
-
// CIL[
|
|
282
|
-
// CIL[
|
|
283
|
-
// CIL[DOC-
|
|
284
|
-
// CIL[DOC-
|
|
285
|
-
// CIL[DOC-
|
|
286
|
-
// CIL[DOC-
|
|
287
|
-
// CIL[DOC-
|
|
288
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
371
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:maybeAdvanceFileToPass3:function" type="function" identity="maybeAdvanceFileToPass3" parent="~/.framework/functions/cil-doc.ts"]
|
|
372
|
+
// CIL[DOC-MACRO purpose="Implements the maybe advance file to pass3 behavior for CIL documentation processing."]
|
|
373
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Carries out the maybe advance file to pass3 responsibility within the documentation workflow."]
|
|
374
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
375
|
+
// CIL[DOC-CONTRACT inputs="ctx: any, fileId: string, tree: FileTreeNode | null" outputs="Promise<void>" errors="none" side_effects="Supabase database queries and updates"]
|
|
376
|
+
// CIL[DOC-MICRO logic_summary="Computes the maybe advance file to pass3 result from the provided input parameters." notable_decisions="none"]
|
|
377
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
289
378
|
// CIL[DOC-STABILITY stability="stable"]
|
|
290
|
-
// CIL[DOC-VECTOR type="context" content="Layer: function. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
291
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
292
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
293
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
294
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
295
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
296
379
|
async function maybeAdvanceFileToPass3(ctx: any, fileId: string, tree: FileTreeNode | null): Promise<void> {
|
|
297
380
|
const { data: fileChunks } = await adminDb
|
|
298
381
|
.from('items')
|
|
@@ -316,13 +399,20 @@ async function maybeAdvanceFileToPass3(ctx: any, fileId: string, tree: FileTreeN
|
|
|
316
399
|
await adminUpdate(updateCtx, {
|
|
317
400
|
data: {
|
|
318
401
|
...fileItem.data,
|
|
319
|
-
status: '
|
|
402
|
+
status: '3-documented',
|
|
320
403
|
last_status_at: new Date().toISOString(),
|
|
321
404
|
},
|
|
322
405
|
}).catch((e: any) => console.error('advance to pass3 failed:', e.message))
|
|
323
406
|
|
|
324
|
-
if (tree) updateTreeNodeStatus(tree, fileId, '
|
|
407
|
+
if (tree) updateTreeNodeStatus(tree, fileId, '3-documented')
|
|
325
408
|
}
|
|
409
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Implements the maybe advance file to pass3 behavior for CIL documentation processing.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
410
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
411
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
412
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
413
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
414
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
415
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:maybeAdvanceFileToPass3:function"]
|
|
326
416
|
|
|
327
417
|
|
|
328
418
|
|
|
@@ -377,83 +467,76 @@ async function maybeAdvanceFileToPass3(ctx: any, fileId: string, tree: FileTreeN
|
|
|
377
467
|
|
|
378
468
|
|
|
379
469
|
|
|
380
|
-
// CIL[
|
|
381
|
-
// CIL[
|
|
382
|
-
// CIL[DOC-
|
|
383
|
-
// CIL[DOC-
|
|
384
|
-
// CIL[DOC-
|
|
385
|
-
// CIL[DOC-
|
|
386
|
-
// CIL[DOC-
|
|
387
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
470
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:REQUIRED_MODULE_FIELDS:constant" type="constant" identity="REQUIRED_MODULE_FIELDS" parent="~/.framework/functions/cil-doc.ts"]
|
|
471
|
+
// CIL[DOC-MACRO purpose="Declares the r e q u i r e d_ m o d u l e_ f i e l d s constant used by the documentation pipeline."]
|
|
472
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Provides the r e q u i r e d_ m o d u l e_ f i e l d s value used across documentation operations."]
|
|
473
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
474
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="none" errors="none" side_effects="none"]
|
|
475
|
+
// CIL[DOC-MICRO logic_summary="none" notable_decisions="none"]
|
|
476
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
388
477
|
// CIL[DOC-STABILITY stability="stable"]
|
|
389
|
-
|
|
390
|
-
// CIL[DOC-VECTOR type="
|
|
391
|
-
// CIL[DOC-VECTOR type="
|
|
392
|
-
// CIL[DOC-VECTOR type="
|
|
478
|
+
const REQUIRED_MODULE_FIELDS = ['module', 'audience', 'layer', 'stability', 'description']
|
|
479
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Declares the r e q u i r e d_ m o d u l e_ f i e l d s constant used by the documentation pipeline.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
480
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
481
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
482
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
393
483
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
394
484
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
395
|
-
|
|
485
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:REQUIRED_MODULE_FIELDS:constant"]
|
|
396
486
|
|
|
397
487
|
|
|
398
|
-
// CIL[
|
|
399
|
-
// CIL[
|
|
400
|
-
// CIL[DOC-
|
|
401
|
-
// CIL[DOC-
|
|
402
|
-
// CIL[DOC-
|
|
403
|
-
// CIL[DOC-
|
|
404
|
-
// CIL[DOC-
|
|
405
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
488
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:REQUIRED_CHUNK_FIELDS:constant" type="constant" identity="REQUIRED_CHUNK_FIELDS" parent="~/.framework/functions/cil-doc.ts"]
|
|
489
|
+
// CIL[DOC-MACRO purpose="Declares the r e q u i r e d_ c h u n k_ f i e l d s constant used by the documentation pipeline."]
|
|
490
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Provides the r e q u i r e d_ c h u n k_ f i e l d s value used across documentation operations."]
|
|
491
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
492
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="none" errors="none" side_effects="none"]
|
|
493
|
+
// CIL[DOC-MICRO logic_summary="none" notable_decisions="none"]
|
|
494
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
406
495
|
// CIL[DOC-STABILITY stability="stable"]
|
|
407
|
-
|
|
408
|
-
// CIL[DOC-VECTOR type="
|
|
409
|
-
// CIL[DOC-VECTOR type="
|
|
410
|
-
// CIL[DOC-VECTOR type="
|
|
496
|
+
const REQUIRED_CHUNK_FIELDS = ['description', 'input_spec', 'output_spec', 'side_effects', 'stability']
|
|
497
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Declares the r e q u i r e d_ c h u n k_ f i e l d s constant used by the documentation pipeline.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
498
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
499
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
500
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
411
501
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
412
502
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
413
|
-
|
|
503
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:REQUIRED_CHUNK_FIELDS:constant"]
|
|
414
504
|
|
|
415
505
|
|
|
416
506
|
|
|
417
507
|
|
|
418
|
-
// CIL[
|
|
419
|
-
// CIL[
|
|
420
|
-
// CIL[DOC-
|
|
421
|
-
// CIL[DOC-
|
|
422
|
-
// CIL[DOC-
|
|
423
|
-
// CIL[DOC-
|
|
424
|
-
// CIL[DOC-
|
|
425
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
508
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:moduleNameFromPath:function" type="function" identity="moduleNameFromPath" parent="~/.framework/functions/cil-doc.ts"]
|
|
509
|
+
// CIL[DOC-MACRO purpose="Implements the module name from path behavior for CIL documentation processing."]
|
|
510
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Carries out the module name from path responsibility within the documentation workflow."]
|
|
511
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
512
|
+
// CIL[DOC-CONTRACT inputs="relPath: string" outputs="string" errors="none" side_effects="none"]
|
|
513
|
+
// CIL[DOC-MICRO logic_summary="Computes the module name from path result from the provided input parameters." notable_decisions="none"]
|
|
514
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
426
515
|
// CIL[DOC-STABILITY stability="stable"]
|
|
427
|
-
// CIL[DOC-VECTOR type="context" content="Layer: function. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
428
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
429
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
430
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
431
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
432
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
433
516
|
function moduleNameFromPath(relPath: string): string {
|
|
434
517
|
return path.basename(relPath, path.extname(relPath))
|
|
435
518
|
}
|
|
519
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Implements the module name from path behavior for CIL documentation processing.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
520
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
521
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
522
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
523
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
524
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
525
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:moduleNameFromPath:function"]
|
|
436
526
|
|
|
437
527
|
|
|
438
528
|
|
|
439
529
|
|
|
440
530
|
|
|
441
531
|
|
|
442
|
-
// CIL[
|
|
443
|
-
// CIL[
|
|
444
|
-
// CIL[DOC-
|
|
445
|
-
// CIL[DOC-
|
|
446
|
-
// CIL[DOC-
|
|
447
|
-
// CIL[DOC-
|
|
448
|
-
// CIL[DOC-
|
|
449
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
532
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:buildJsDoc:function" type="function" identity="buildJsDoc" parent="~/.framework/functions/cil-doc.ts"]
|
|
533
|
+
// CIL[DOC-MACRO purpose="Implements the build js doc behavior for CIL documentation processing."]
|
|
534
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Carries out the build js doc responsibility within the documentation workflow."]
|
|
535
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
536
|
+
// CIL[DOC-CONTRACT inputs="chunk: any" outputs="string" errors="none" side_effects="local file system access"]
|
|
537
|
+
// CIL[DOC-MICRO logic_summary="Computes the build js doc result from the provided input parameters." notable_decisions="Skips redundant macro/micro lines and filters trivial calls from the @calls tag."]
|
|
538
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
450
539
|
// CIL[DOC-STABILITY stability="stable"]
|
|
451
|
-
// CIL[DOC-VECTOR type="context" content="Layer: function. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
452
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
453
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
454
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
455
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
456
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
457
540
|
function buildJsDoc(chunk: any): string {
|
|
458
541
|
const d = chunk.data || {}
|
|
459
542
|
const isModuleHeader = d.chunk_type === 'module_header'
|
|
@@ -565,26 +648,83 @@ function buildJsDoc(chunk: any): string {
|
|
|
565
648
|
]
|
|
566
649
|
return docLines.join('\n')
|
|
567
650
|
}
|
|
651
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Implements the build js doc behavior for CIL documentation processing.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
652
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
653
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
654
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
655
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
656
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
657
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:buildJsDoc:function"]
|
|
568
658
|
|
|
569
659
|
|
|
570
660
|
|
|
571
661
|
|
|
572
662
|
|
|
573
|
-
// CIL[
|
|
574
|
-
// CIL[
|
|
575
|
-
// CIL[DOC-
|
|
576
|
-
// CIL[DOC-
|
|
577
|
-
// CIL[DOC-
|
|
578
|
-
// CIL[DOC-
|
|
579
|
-
// CIL[DOC-
|
|
580
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
663
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:validateChunkDocs:function" type="function" identity="validateChunkDocs" parent="~/.framework/functions/cil-doc.ts"]
|
|
664
|
+
// CIL[DOC-MACRO purpose="Implements the validate chunk docs behavior for CIL documentation processing."]
|
|
665
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Carries out the validate chunk docs responsibility within the documentation workflow."]
|
|
666
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
667
|
+
// CIL[DOC-CONTRACT inputs="chunk: any, text: string" outputs="string[]" errors="none" side_effects="none"]
|
|
668
|
+
// CIL[DOC-MICRO logic_summary="Computes the validate chunk docs result from the provided input parameters." notable_decisions="none"]
|
|
669
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
581
670
|
// CIL[DOC-STABILITY stability="stable"]
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
671
|
+
function splitParameterList(text: string): string[] {
|
|
672
|
+
const parts: string[] = []
|
|
673
|
+
let depth = 0
|
|
674
|
+
let inString = false
|
|
675
|
+
let quote = ''
|
|
676
|
+
let current = ''
|
|
677
|
+
for (const ch of text) {
|
|
678
|
+
if (inString) {
|
|
679
|
+
if (ch === quote) inString = false
|
|
680
|
+
current += ch
|
|
681
|
+
continue
|
|
682
|
+
}
|
|
683
|
+
if (ch === '"' || ch === "'" || ch === '`') {
|
|
684
|
+
inString = true
|
|
685
|
+
quote = ch
|
|
686
|
+
current += ch
|
|
687
|
+
continue
|
|
688
|
+
}
|
|
689
|
+
if (ch === '(' || ch === '[' || ch === '<' || ch === '{') depth++
|
|
690
|
+
else if (ch === ')' || ch === ']' || ch === '>' || ch === '}') depth = Math.max(0, depth - 1)
|
|
691
|
+
else if ((ch === ',' || ch === '\n') && depth === 0) {
|
|
692
|
+
parts.push(current)
|
|
693
|
+
current = ''
|
|
694
|
+
continue
|
|
695
|
+
}
|
|
696
|
+
current += ch
|
|
697
|
+
}
|
|
698
|
+
parts.push(current)
|
|
699
|
+
return parts.map(s => s.trim()).filter(Boolean)
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
function expandParamEntries(rawParams: string): Array<{ name: string; type: string; optional: boolean }> {
|
|
703
|
+
const out: Array<{ name: string; type: string; optional: boolean }> = []
|
|
704
|
+
const push = (part: string, depth: number): void => {
|
|
705
|
+
if (depth > 4) return
|
|
706
|
+
const t = part.trim()
|
|
707
|
+
if (!t) return
|
|
708
|
+
const open = t[0]
|
|
709
|
+
if (open === '{' || open === '[') {
|
|
710
|
+
const close = open === '{' ? '}' : ']'
|
|
711
|
+
let d = 0
|
|
712
|
+
let end = -1
|
|
713
|
+
for (let i = 0; i < t.length; i++) {
|
|
714
|
+
if (t[i] === open) d++
|
|
715
|
+
else if (t[i] === close) { d--; if (d === 0) { end = i; break } }
|
|
716
|
+
}
|
|
717
|
+
const inner = end > 0 ? t.slice(1, end) : t.slice(1, -1)
|
|
718
|
+
for (const p of splitParameterList(inner)) push(p, depth + 1)
|
|
719
|
+
return
|
|
720
|
+
}
|
|
721
|
+
const m = t.replace(/^\.\.\./, '').match(/^([A-Za-z_$][A-Za-z0-9_$]*)(\?)?\s*(?::\s*([^=]+?))?(?:\s*=.*)?$/)
|
|
722
|
+
if (m) out.push({ name: m[1], type: (m[3] || 'any').trim(), optional: !!m[2] || t.includes('=') })
|
|
723
|
+
}
|
|
724
|
+
for (const part of splitParameterList(rawParams)) push(part, 0)
|
|
725
|
+
return out
|
|
726
|
+
}
|
|
727
|
+
|
|
588
728
|
function validateChunkDocs(chunk: any): string[] {
|
|
589
729
|
const d = chunk.data || {}
|
|
590
730
|
const errors: string[] = []
|
|
@@ -598,8 +738,7 @@ function validateChunkDocs(chunk: any): string[] {
|
|
|
598
738
|
}
|
|
599
739
|
|
|
600
740
|
if (!isModuleHeader && d.input_spec && d.input_spec !== 'none') {
|
|
601
|
-
const
|
|
602
|
-
const paramNames = params.map(p => {
|
|
741
|
+
const paramNames = splitParameterList(d.input_spec).map(p => {
|
|
603
742
|
const m = p.match(/^[-\s]*([a-zA-Z0-9_]+)/)
|
|
604
743
|
return m ? m[1] : ''
|
|
605
744
|
}).filter(Boolean)
|
|
@@ -608,12 +747,7 @@ function validateChunkDocs(chunk: any): string[] {
|
|
|
608
747
|
const signatureMatch = code.match(/(?:function|const|let|var)\s+\w+\s*\(([^)]*)\)/)
|
|
609
748
|
if (signatureMatch) {
|
|
610
749
|
const rawParams = signatureMatch[1]
|
|
611
|
-
const declaredNames = rawParams
|
|
612
|
-
.split(',')
|
|
613
|
-
.map(s => s.trim())
|
|
614
|
-
.filter(s => s)
|
|
615
|
-
.map(s => s.split(/[:=]/)[0].trim().replace(/\?/, ''))
|
|
616
|
-
.filter(Boolean)
|
|
750
|
+
const declaredNames = expandParamEntries(rawParams).map(p => p.name)
|
|
617
751
|
for (const declared of declaredNames) {
|
|
618
752
|
if (!paramNames.includes(declared)) {
|
|
619
753
|
errors.push(`undocumented parameter: ${declared}`)
|
|
@@ -624,26 +758,22 @@ function validateChunkDocs(chunk: any): string[] {
|
|
|
624
758
|
|
|
625
759
|
return errors
|
|
626
760
|
}
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
// CIL[END chunk_id="custom_apps_cortex_functions_custom_cil_doc_validatechunkdocs_1784235266"]
|
|
633
|
-
// CIL[BEGIN chunk_id="custom_apps_cortex_functions_custom_cil_doc_findexistingciljsdoc_1784235266" type="function" identity="findexistingciljsdoc" parent="none"]
|
|
634
|
-
// CIL[DOC-MACRO purpose="Implements findexistingciljsdoc logic in cortex.functions.custom_cil-doc"]
|
|
635
|
-
// CIL[DOC-RESPONSIBILITY responsibility="Execute findexistingciljsdoc and return its computed result"]
|
|
636
|
-
// CIL[DOC-CONTEXT module="cortex.functions.custom_cil-doc" layer="function" related_files="[]"]
|
|
637
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="return value from function execution" errors="throws on invalid input or runtime failure" side_effects="none"]
|
|
638
|
-
// CIL[DOC-MICRO logic_summary="Provides findexistingciljsdoc with findExistingCilJsDoc(lines: string[], markerIdx: number inputs, handling internal flow and returning a result" notable_decisions="[]"]
|
|
639
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
640
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
641
|
-
// CIL[DOC-VECTOR type="context" content="Layer: function. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
642
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
643
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
644
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
761
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Implements the validate chunk docs behavior for CIL documentation processing.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
762
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
763
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
764
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
645
765
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
646
766
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
767
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:validateChunkDocs:function"]
|
|
768
|
+
|
|
769
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:findExistingCilJsDoc:function" type="function" identity="findExistingCilJsDoc" parent="~/.framework/functions/cil-doc.ts"]
|
|
770
|
+
// CIL[DOC-MACRO purpose="Implements the find existing cil js doc behavior for CIL documentation processing."]
|
|
771
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Carries out the find existing cil js doc responsibility within the documentation workflow."]
|
|
772
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
773
|
+
// CIL[DOC-CONTRACT inputs="lines: string[], markerIdx: number" outputs="void" errors="none" side_effects="none"]
|
|
774
|
+
// CIL[DOC-MICRO logic_summary="Computes the find existing cil js doc result from the provided input parameters." notable_decisions="none"]
|
|
775
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
776
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
647
777
|
function findExistingCilJsDoc(lines: string[], markerIdx: number): { start: number; end: number } | null {
|
|
648
778
|
let startIdx = -1
|
|
649
779
|
for (let i = markerIdx + 1; i < lines.length; i++) {
|
|
@@ -664,26 +794,26 @@ function findExistingCilJsDoc(lines: string[], markerIdx: number): { start: numb
|
|
|
664
794
|
if (endIdx === -1 || !hasCilTag) return null
|
|
665
795
|
return { start: startIdx, end: endIdx }
|
|
666
796
|
}
|
|
797
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Implements the find existing cil js doc behavior for CIL documentation processing.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
798
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
799
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
800
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
801
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
802
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
803
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:findExistingCilJsDoc:function"]
|
|
667
804
|
|
|
668
805
|
|
|
669
806
|
|
|
670
807
|
|
|
671
808
|
|
|
672
|
-
// CIL[
|
|
673
|
-
// CIL[
|
|
674
|
-
// CIL[DOC-
|
|
675
|
-
// CIL[DOC-
|
|
676
|
-
// CIL[DOC-
|
|
677
|
-
// CIL[DOC-
|
|
678
|
-
// CIL[DOC-
|
|
679
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
809
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:findLegacyCilJsDocAbove:function" type="function" identity="findLegacyCilJsDocAbove" parent="~/.framework/functions/cil-doc.ts"]
|
|
810
|
+
// CIL[DOC-MACRO purpose="Implements the find legacy cil js doc above behavior for CIL documentation processing."]
|
|
811
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Carries out the find legacy cil js doc above responsibility within the documentation workflow."]
|
|
812
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
813
|
+
// CIL[DOC-CONTRACT inputs="lines: string[], markerIdx: number" outputs="void" errors="none" side_effects="none"]
|
|
814
|
+
// CIL[DOC-MICRO logic_summary="Computes the find legacy cil js doc above result from the provided input parameters." notable_decisions="none"]
|
|
815
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
680
816
|
// CIL[DOC-STABILITY stability="stable"]
|
|
681
|
-
// CIL[DOC-VECTOR type="context" content="Layer: function. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
682
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
683
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
684
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
685
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
686
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
687
817
|
function findLegacyCilJsDocAbove(lines: string[], markerIdx: number): { start: number; end: number } | null {
|
|
688
818
|
let endIdx = -1
|
|
689
819
|
for (let i = markerIdx - 1; i >= 0; i--) {
|
|
@@ -705,26 +835,26 @@ function findLegacyCilJsDocAbove(lines: string[], markerIdx: number): { start: n
|
|
|
705
835
|
|
|
706
836
|
return { start: startIdx, end: endIdx }
|
|
707
837
|
}
|
|
838
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Implements the find legacy cil js doc above behavior for CIL documentation processing.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
839
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
840
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
841
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
842
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
843
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
844
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:findLegacyCilJsDocAbove:function"]
|
|
708
845
|
|
|
709
846
|
|
|
710
847
|
|
|
711
848
|
|
|
712
849
|
|
|
713
|
-
// CIL[
|
|
714
|
-
// CIL[
|
|
715
|
-
// CIL[DOC-
|
|
716
|
-
// CIL[DOC-
|
|
717
|
-
// CIL[DOC-
|
|
718
|
-
// CIL[DOC-
|
|
719
|
-
// CIL[DOC-
|
|
720
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
850
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:writeJsDocToSource:function" type="function" identity="writeJsDocToSource" parent="~/.framework/functions/cil-doc.ts"]
|
|
851
|
+
// CIL[DOC-MACRO purpose="Implements the write js doc to source behavior for CIL documentation processing."]
|
|
852
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Carries out the write js doc to source responsibility within the documentation workflow."]
|
|
853
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
854
|
+
// CIL[DOC-CONTRACT inputs="chunk: any, repoPath: string" outputs="void" errors="none" side_effects="local file system access"]
|
|
855
|
+
// CIL[DOC-MICRO logic_summary="Computes the write js doc to source result from the provided input parameters." notable_decisions="none"]
|
|
856
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
721
857
|
// CIL[DOC-STABILITY stability="stable"]
|
|
722
|
-
// CIL[DOC-VECTOR type="context" content="Layer: function. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
723
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
724
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
725
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
726
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
727
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
728
858
|
function writeJsDocToSource(chunk: any, repoPath: string): void {
|
|
729
859
|
const d = chunk.data || {}
|
|
730
860
|
const relPath = d.file_path
|
|
@@ -765,27 +895,34 @@ function writeJsDocToSource(chunk: any, repoPath: string): void {
|
|
|
765
895
|
|
|
766
896
|
fs.writeFileSync(absPath, newLines.join('\n'), 'utf-8')
|
|
767
897
|
}
|
|
898
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Implements the write js doc to source behavior for CIL documentation processing.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
899
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
900
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
901
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
902
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
903
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
904
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:writeJsDocToSource:function"]
|
|
768
905
|
|
|
769
906
|
|
|
770
907
|
|
|
771
|
-
// CIL[
|
|
772
|
-
// CIL[
|
|
773
|
-
// CIL[DOC-
|
|
774
|
-
// CIL[DOC-
|
|
775
|
-
// CIL[DOC-
|
|
776
|
-
// CIL[DOC-
|
|
777
|
-
// CIL[DOC-
|
|
778
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
908
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:escapeRegExp:function" type="function" identity="escapeRegExp" parent="~/.framework/functions/cil-doc.ts"]
|
|
909
|
+
// CIL[DOC-MACRO purpose="Implements the escape reg exp behavior for CIL documentation processing."]
|
|
910
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Carries out the escape reg exp responsibility within the documentation workflow."]
|
|
911
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
912
|
+
// CIL[DOC-CONTRACT inputs="s: string" outputs="string" errors="none" side_effects="none"]
|
|
913
|
+
// CIL[DOC-MICRO logic_summary="Computes the escape reg exp result from the provided input parameters." notable_decisions="none"]
|
|
914
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
779
915
|
// CIL[DOC-STABILITY stability="stable"]
|
|
780
|
-
// CIL[DOC-VECTOR type="context" content="Layer: function. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
781
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
782
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
783
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
784
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
785
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
786
916
|
function escapeRegExp(s: string): string {
|
|
787
917
|
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
788
918
|
}
|
|
919
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Implements the escape reg exp behavior for CIL documentation processing.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
920
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
921
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
922
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
923
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
924
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
925
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:escapeRegExp:function"]
|
|
789
926
|
|
|
790
927
|
|
|
791
928
|
|
|
@@ -796,22 +933,22 @@ function escapeRegExp(s: string): string {
|
|
|
796
933
|
|
|
797
934
|
|
|
798
935
|
|
|
799
|
-
// CIL[
|
|
800
|
-
// CIL[
|
|
801
|
-
// CIL[DOC-
|
|
802
|
-
// CIL[DOC-
|
|
803
|
-
// CIL[DOC-
|
|
804
|
-
// CIL[DOC-
|
|
805
|
-
// CIL[DOC-
|
|
806
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
936
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:CHUNK_START_MARKER_RE:constant" type="constant" identity="CHUNK_START_MARKER_RE" parent="~/.framework/functions/cil-doc.ts"]
|
|
937
|
+
// CIL[DOC-MACRO purpose="Declares the c h u n k_ s t a r t_ m a r k e r_ r e constant used by the documentation pipeline."]
|
|
938
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Provides the c h u n k_ s t a r t_ m a r k e r_ r e value used across documentation operations."]
|
|
939
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
940
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="none" errors="none" side_effects="none"]
|
|
941
|
+
// CIL[DOC-MICRO logic_summary="none" notable_decisions="none"]
|
|
942
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
807
943
|
// CIL[DOC-STABILITY stability="stable"]
|
|
808
|
-
|
|
809
|
-
// CIL[DOC-VECTOR type="
|
|
810
|
-
// CIL[DOC-VECTOR type="
|
|
811
|
-
// CIL[DOC-VECTOR type="
|
|
944
|
+
const CHUNK_START_MARKER_RE = /^\s*\/\/\s*CIL\[BEGIN\s+[^\]]*identity="([^"]+)"[^\]]*\]\s*$/
|
|
945
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Declares the c h u n k_ s t a r t_ m a r k e r_ r e constant used by the documentation pipeline.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
946
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
947
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
948
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
812
949
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
813
950
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
814
|
-
|
|
951
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:CHUNK_START_MARKER_RE:constant"]
|
|
815
952
|
|
|
816
953
|
|
|
817
954
|
|
|
@@ -822,21 +959,14 @@ const CHUNK_START_MARKER_RE = /^\s*\/\*\*\s*[─\-]+\s*CHUNK_START:\s*(?:PROPOSA
|
|
|
822
959
|
|
|
823
960
|
|
|
824
961
|
|
|
825
|
-
// CIL[
|
|
826
|
-
// CIL[
|
|
827
|
-
// CIL[DOC-
|
|
828
|
-
// CIL[DOC-
|
|
829
|
-
// CIL[DOC-
|
|
830
|
-
// CIL[DOC-
|
|
831
|
-
// CIL[DOC-
|
|
832
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
962
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:findChunkStartMarkers:function" type="function" identity="findChunkStartMarkers" parent="~/.framework/functions/cil-doc.ts"]
|
|
963
|
+
// CIL[DOC-MACRO purpose="Implements the find chunk start markers behavior for CIL documentation processing."]
|
|
964
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Carries out the find chunk start markers responsibility within the documentation workflow."]
|
|
965
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
966
|
+
// CIL[DOC-CONTRACT inputs="lines: string[]" outputs="Map<string," errors="none" side_effects="none"]
|
|
967
|
+
// CIL[DOC-MICRO logic_summary="Computes the find chunk start markers result from the provided input parameters." notable_decisions="none"]
|
|
968
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
833
969
|
// CIL[DOC-STABILITY stability="stable"]
|
|
834
|
-
// CIL[DOC-VECTOR type="context" content="Layer: function. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
835
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
836
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
837
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
838
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
839
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
840
970
|
function findChunkStartMarkers(lines: string[]): Map<string, number> {
|
|
841
971
|
const map = new Map<string, number>()
|
|
842
972
|
for (let i = 0; i < lines.length; i++) {
|
|
@@ -848,6 +978,13 @@ function findChunkStartMarkers(lines: string[]): Map<string, number> {
|
|
|
848
978
|
}
|
|
849
979
|
return map
|
|
850
980
|
}
|
|
981
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Implements the find chunk start markers behavior for CIL documentation processing.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
982
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
983
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
984
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
985
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
986
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
987
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:findChunkStartMarkers:function"]
|
|
851
988
|
|
|
852
989
|
|
|
853
990
|
|
|
@@ -855,27 +992,27 @@ function findChunkStartMarkers(lines: string[]): Map<string, number> {
|
|
|
855
992
|
|
|
856
993
|
|
|
857
994
|
|
|
858
|
-
// CIL[
|
|
859
|
-
// CIL[
|
|
860
|
-
// CIL[DOC-
|
|
861
|
-
// CIL[DOC-
|
|
862
|
-
// CIL[DOC-
|
|
863
|
-
// CIL[DOC-
|
|
864
|
-
// CIL[DOC-
|
|
865
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
995
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:buildDocPrompt:function" type="function" identity="buildDocPrompt" parent="~/.framework/functions/cil-doc.ts"]
|
|
996
|
+
// CIL[DOC-MACRO purpose="Implements the build doc prompt behavior for CIL documentation processing."]
|
|
997
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Carries out the build doc prompt responsibility within the documentation workflow."]
|
|
998
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
999
|
+
// CIL[DOC-CONTRACT inputs="chunk: any" outputs="string" errors="none" side_effects="none"]
|
|
1000
|
+
// CIL[DOC-MICRO logic_summary="Computes the build doc prompt result from the provided input parameters." notable_decisions="none"]
|
|
1001
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
866
1002
|
// CIL[DOC-STABILITY stability="stable"]
|
|
867
|
-
// CIL[DOC-VECTOR type="context" content="Layer: function. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
868
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
869
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
870
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
871
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
872
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
873
1003
|
function buildDocPrompt(chunk: any): string {
|
|
874
1004
|
const d = chunk.data || {}
|
|
875
1005
|
const code = (d.code_content || '').slice(0, 3000)
|
|
876
1006
|
const isModuleHeader = d.chunk_type === 'module_header'
|
|
877
1007
|
return isModuleHeader ? buildModuleHeaderPrompt(d, code) : buildChunkPrompt(d, code)
|
|
878
1008
|
}
|
|
1009
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Implements the build doc prompt behavior for CIL documentation processing.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
1010
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
1011
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
1012
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
1013
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1014
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1015
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:buildDocPrompt:function"]
|
|
879
1016
|
|
|
880
1017
|
|
|
881
1018
|
|
|
@@ -886,21 +1023,14 @@ function buildDocPrompt(chunk: any): string {
|
|
|
886
1023
|
|
|
887
1024
|
|
|
888
1025
|
|
|
889
|
-
// CIL[
|
|
890
|
-
// CIL[
|
|
891
|
-
// CIL[DOC-
|
|
892
|
-
// CIL[DOC-
|
|
893
|
-
// CIL[DOC-
|
|
894
|
-
// CIL[DOC-
|
|
895
|
-
// CIL[DOC-
|
|
896
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
1026
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:buildModuleHeaderPrompt:function" type="function" identity="buildModuleHeaderPrompt" parent="~/.framework/functions/cil-doc.ts"]
|
|
1027
|
+
// CIL[DOC-MACRO purpose="Implements the build module header prompt behavior for CIL documentation processing."]
|
|
1028
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Carries out the build module header prompt responsibility within the documentation workflow."]
|
|
1029
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
1030
|
+
// CIL[DOC-CONTRACT inputs="d: any, code: string" outputs="string" errors="none" side_effects="none"]
|
|
1031
|
+
// CIL[DOC-MICRO logic_summary="Computes the build module header prompt result from the provided input parameters." notable_decisions="none"]
|
|
1032
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
897
1033
|
// CIL[DOC-STABILITY stability="stable"]
|
|
898
|
-
// CIL[DOC-VECTOR type="context" content="Layer: function. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
899
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
900
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
901
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
902
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
903
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
904
1034
|
function buildModuleHeaderPrompt(d: any, code: string): string {
|
|
905
1035
|
const filePath = d.file_path || 'unknown'
|
|
906
1036
|
return `You are documenting the MODULE HEADER for file: ${filePath}
|
|
@@ -935,6 +1065,13 @@ Respond ONLY with a JSON object (no markdown, no commentary):
|
|
|
935
1065
|
"tags": "<comma-separated relevant tags>"
|
|
936
1066
|
}`
|
|
937
1067
|
}
|
|
1068
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Implements the build module header prompt behavior for CIL documentation processing.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
1069
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
1070
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
1071
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
1072
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1073
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1074
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:buildModuleHeaderPrompt:function"]
|
|
938
1075
|
|
|
939
1076
|
|
|
940
1077
|
|
|
@@ -945,21 +1082,14 @@ Respond ONLY with a JSON object (no markdown, no commentary):
|
|
|
945
1082
|
|
|
946
1083
|
|
|
947
1084
|
|
|
948
|
-
// CIL[
|
|
949
|
-
// CIL[
|
|
950
|
-
// CIL[DOC-
|
|
951
|
-
// CIL[DOC-
|
|
952
|
-
// CIL[DOC-
|
|
953
|
-
// CIL[DOC-
|
|
954
|
-
// CIL[DOC-
|
|
955
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
1085
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:buildChunkPrompt:function" type="function" identity="buildChunkPrompt" parent="~/.framework/functions/cil-doc.ts"]
|
|
1086
|
+
// CIL[DOC-MACRO purpose="Implements the build chunk prompt behavior for CIL documentation processing."]
|
|
1087
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Carries out the build chunk prompt responsibility within the documentation workflow."]
|
|
1088
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
1089
|
+
// CIL[DOC-CONTRACT inputs="d: any, code: string" outputs="string" errors="none" side_effects="Supabase database queries and updates"]
|
|
1090
|
+
// CIL[DOC-MICRO logic_summary="Computes the build chunk prompt result from the provided input parameters." notable_decisions="none"]
|
|
1091
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
956
1092
|
// CIL[DOC-STABILITY stability="stable"]
|
|
957
|
-
// CIL[DOC-VECTOR type="context" content="Layer: function. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
958
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
959
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
960
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
961
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
962
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
963
1093
|
function buildChunkPrompt(d: any, code: string): string {
|
|
964
1094
|
const chunkType = d.chunk_type || 'function'
|
|
965
1095
|
const chunkName = d.chunk_name || 'unknown'
|
|
@@ -1026,6 +1156,13 @@ Respond ONLY with a JSON object (no markdown, no commentary):
|
|
|
1026
1156
|
"tags": "<comma-separated tags>"
|
|
1027
1157
|
}`
|
|
1028
1158
|
}
|
|
1159
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Implements the build chunk prompt behavior for CIL documentation processing.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
1160
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
1161
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
1162
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
1163
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1164
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1165
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:buildChunkPrompt:function"]
|
|
1029
1166
|
|
|
1030
1167
|
|
|
1031
1168
|
|
|
@@ -1035,21 +1172,14 @@ Respond ONLY with a JSON object (no markdown, no commentary):
|
|
|
1035
1172
|
|
|
1036
1173
|
|
|
1037
1174
|
|
|
1038
|
-
// CIL[
|
|
1039
|
-
// CIL[
|
|
1040
|
-
// CIL[DOC-
|
|
1041
|
-
// CIL[DOC-
|
|
1042
|
-
// CIL[DOC-
|
|
1043
|
-
// CIL[DOC-
|
|
1044
|
-
// CIL[DOC-
|
|
1045
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
1175
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:callLLM:function" type="function" identity="callLLM" parent="~/.framework/functions/cil-doc.ts"]
|
|
1176
|
+
// CIL[DOC-MACRO purpose="Implements the call l l m behavior for CIL documentation processing."]
|
|
1177
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Carries out the call l l m responsibility within the documentation workflow."]
|
|
1178
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
1179
|
+
// CIL[DOC-CONTRACT inputs="prompt: string, model: string" outputs="Promise<string>" errors="none" side_effects="OpenAI chat API call"]
|
|
1180
|
+
// CIL[DOC-MICRO logic_summary="Computes the call l l m result from the provided input parameters." notable_decisions="none"]
|
|
1181
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
1046
1182
|
// CIL[DOC-STABILITY stability="stable"]
|
|
1047
|
-
// CIL[DOC-VECTOR type="context" content="Layer: function. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
1048
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
1049
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
1050
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
1051
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1052
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1053
1183
|
async function callLLM(prompt: string, model: string): Promise<string> {
|
|
1054
1184
|
const j = await callOpenAIChat(undefined, [
|
|
1055
1185
|
{
|
|
@@ -1064,26 +1194,26 @@ async function callLLM(prompt: string, model: string): Promise<string> {
|
|
|
1064
1194
|
})
|
|
1065
1195
|
return j.choices?.[0]?.message?.content?.trim() || '{}'
|
|
1066
1196
|
}
|
|
1197
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Implements the call l l m behavior for CIL documentation processing.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
1198
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
1199
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
1200
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
1201
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1202
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1203
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:callLLM:function"]
|
|
1067
1204
|
|
|
1068
1205
|
|
|
1069
1206
|
|
|
1070
1207
|
|
|
1071
1208
|
|
|
1072
|
-
// CIL[
|
|
1073
|
-
// CIL[
|
|
1074
|
-
// CIL[DOC-
|
|
1075
|
-
// CIL[DOC-
|
|
1076
|
-
// CIL[DOC-
|
|
1077
|
-
// CIL[DOC-
|
|
1078
|
-
// CIL[DOC-
|
|
1079
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
1209
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:parseDocResponse:function" type="function" identity="parseDocResponse" parent="~/.framework/functions/cil-doc.ts"]
|
|
1210
|
+
// CIL[DOC-MACRO purpose="Implements the parse doc response behavior for CIL documentation processing."]
|
|
1211
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Carries out the parse doc response responsibility within the documentation workflow."]
|
|
1212
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
1213
|
+
// CIL[DOC-CONTRACT inputs="raw: string" outputs="Record<string," errors="none" side_effects="none"]
|
|
1214
|
+
// CIL[DOC-MICRO logic_summary="Computes the parse doc response result from the provided input parameters." notable_decisions="none"]
|
|
1215
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
1080
1216
|
// CIL[DOC-STABILITY stability="stable"]
|
|
1081
|
-
// CIL[DOC-VECTOR type="context" content="Layer: function. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
1082
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
1083
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
1084
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
1085
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1086
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1087
1217
|
function parseDocResponse(raw: string): Record<string, string> {
|
|
1088
1218
|
try {
|
|
1089
1219
|
|
|
@@ -1119,6 +1249,13 @@ function parseDocResponse(raw: string): Record<string, string> {
|
|
|
1119
1249
|
return {}
|
|
1120
1250
|
}
|
|
1121
1251
|
}
|
|
1252
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Implements the parse doc response behavior for CIL documentation processing.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
1253
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
1254
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
1255
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
1256
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1257
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1258
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:parseDocResponse:function"]
|
|
1122
1259
|
|
|
1123
1260
|
|
|
1124
1261
|
|
|
@@ -1128,25 +1265,25 @@ function parseDocResponse(raw: string): Record<string, string> {
|
|
|
1128
1265
|
|
|
1129
1266
|
|
|
1130
1267
|
|
|
1131
|
-
// CIL[
|
|
1132
|
-
// CIL[
|
|
1133
|
-
// CIL[DOC-
|
|
1134
|
-
// CIL[DOC-
|
|
1135
|
-
// CIL[DOC-
|
|
1136
|
-
// CIL[DOC-
|
|
1137
|
-
// CIL[DOC-
|
|
1138
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
1268
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:hasMeaningfulLlmFields:function" type="function" identity="hasMeaningfulLlmFields" parent="~/.framework/functions/cil-doc.ts"]
|
|
1269
|
+
// CIL[DOC-MACRO purpose="Implements the has meaningful llm fields behavior for CIL documentation processing."]
|
|
1270
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Carries out the has meaningful llm fields responsibility within the documentation workflow."]
|
|
1271
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
1272
|
+
// CIL[DOC-CONTRACT inputs="fields: Record<string, string>" outputs="boolean" errors="none" side_effects="none"]
|
|
1273
|
+
// CIL[DOC-MICRO logic_summary="Computes the has meaningful llm fields result from the provided input parameters." notable_decisions="none"]
|
|
1274
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
1139
1275
|
// CIL[DOC-STABILITY stability="stable"]
|
|
1140
|
-
// CIL[DOC-VECTOR type="context" content="Layer: function. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
1141
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
1142
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
1143
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
1144
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1145
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1146
1276
|
function hasMeaningfulLlmFields(fields: Record<string, string>): boolean {
|
|
1147
1277
|
const meaningfulKeys = ['description', 'macro', 'micro', 'input_spec', 'output_spec']
|
|
1148
1278
|
return meaningfulKeys.some(k => (fields[k] || '').trim() !== '')
|
|
1149
1279
|
}
|
|
1280
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Implements the has meaningful llm fields behavior for CIL documentation processing.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
1281
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
1282
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
1283
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
1284
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1285
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1286
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:hasMeaningfulLlmFields:function"]
|
|
1150
1287
|
|
|
1151
1288
|
|
|
1152
1289
|
|
|
@@ -1154,21 +1291,14 @@ function hasMeaningfulLlmFields(fields: Record<string, string>): boolean {
|
|
|
1154
1291
|
|
|
1155
1292
|
|
|
1156
1293
|
|
|
1157
|
-
// CIL[
|
|
1158
|
-
// CIL[
|
|
1159
|
-
// CIL[DOC-
|
|
1160
|
-
// CIL[DOC-
|
|
1161
|
-
// CIL[DOC-
|
|
1162
|
-
// CIL[DOC-
|
|
1163
|
-
// CIL[DOC-
|
|
1164
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
1294
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:normalizeDocFields:function" type="function" identity="normalizeDocFields" parent="~/.framework/functions/cil-doc.ts"]
|
|
1295
|
+
// CIL[DOC-MACRO purpose="Implements the normalize doc fields behavior for CIL documentation processing."]
|
|
1296
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Carries out the normalize doc fields responsibility within the documentation workflow."]
|
|
1297
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
1298
|
+
// CIL[DOC-CONTRACT inputs="fields: Record<string, string>, chunk: any" outputs="Record<string," errors="none" side_effects="none"]
|
|
1299
|
+
// CIL[DOC-MICRO logic_summary="Computes the normalize doc fields result from the provided input parameters." notable_decisions="none"]
|
|
1300
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
1165
1301
|
// CIL[DOC-STABILITY stability="stable"]
|
|
1166
|
-
// CIL[DOC-VECTOR type="context" content="Layer: function. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
1167
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
1168
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
1169
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
1170
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1171
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1172
1302
|
function normalizeDocFields(fields: Record<string, string>, chunk: any): Record<string, string> {
|
|
1173
1303
|
const d = chunk.data || {}
|
|
1174
1304
|
const isModuleHeader = d.chunk_type === 'module_header'
|
|
@@ -1194,13 +1324,14 @@ function normalizeDocFields(fields: Record<string, string>, chunk: any): Record<
|
|
|
1194
1324
|
|
|
1195
1325
|
|
|
1196
1326
|
|
|
1197
|
-
const macroFromLlm = fields.macro
|
|
1198
|
-
const microFromLlm = fields.micro
|
|
1199
|
-
if (macroFromLlm
|
|
1327
|
+
const macroFromLlm = (fields.macro || '').trim()
|
|
1328
|
+
const microFromLlm = (fields.micro || '').trim()
|
|
1329
|
+
if (!macroFromLlm) {
|
|
1200
1330
|
normalized.macro = normalized.description.split(/(?<=[.!?])\s+/)[0] || normalized.description
|
|
1201
1331
|
}
|
|
1202
|
-
if (microFromLlm
|
|
1203
|
-
|
|
1332
|
+
if (!microFromLlm) {
|
|
1333
|
+
const rest = normalized.description.split(/(?<=[.!?])\s+/).slice(1).join(' ').trim()
|
|
1334
|
+
normalized.micro = rest || normalized.description
|
|
1204
1335
|
}
|
|
1205
1336
|
|
|
1206
1337
|
|
|
@@ -1209,11 +1340,7 @@ function normalizeDocFields(fields: Record<string, string>, chunk: any): Record<
|
|
|
1209
1340
|
if (isCallable) {
|
|
1210
1341
|
const sigMatch = code.match(/(?:function|const|let|var)\s+\w+\s*\(([^)]*)\)|(?:async\s+)?function\s*\(([^)]*)\)/)
|
|
1211
1342
|
const paramStr = sigMatch?.[1] || sigMatch?.[2] || ''
|
|
1212
|
-
const params = paramStr
|
|
1213
|
-
const [name, type] = p.split(/[:=]/).map(s => s.trim())
|
|
1214
|
-
const optional = p.includes('?')
|
|
1215
|
-
return `- ${name.replace(/\?$/, '')}: ${type || 'any'} (${optional ? 'optional' : 'required'})`
|
|
1216
|
-
})
|
|
1343
|
+
const params = expandParamEntries(paramStr).map(p => `- ${p.name}: ${p.type} (${p.optional ? 'optional' : 'required'})`)
|
|
1217
1344
|
normalized.input_spec = params.length ? params.join('\n') : 'none'
|
|
1218
1345
|
} else {
|
|
1219
1346
|
normalized.input_spec = 'none'
|
|
@@ -1242,26 +1369,26 @@ function normalizeDocFields(fields: Record<string, string>, chunk: any): Record<
|
|
|
1242
1369
|
|
|
1243
1370
|
return normalized
|
|
1244
1371
|
}
|
|
1372
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Implements the normalize doc fields behavior for CIL documentation processing.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
1373
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
1374
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
1375
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
1376
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1377
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1378
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:normalizeDocFields:function"]
|
|
1245
1379
|
|
|
1246
1380
|
|
|
1247
1381
|
|
|
1248
1382
|
|
|
1249
1383
|
|
|
1250
|
-
// CIL[
|
|
1251
|
-
// CIL[
|
|
1252
|
-
// CIL[DOC-
|
|
1253
|
-
// CIL[DOC-
|
|
1254
|
-
// CIL[DOC-
|
|
1255
|
-
// CIL[DOC-
|
|
1256
|
-
// CIL[DOC-
|
|
1257
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
1384
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:documentChunk:function" type="function" identity="documentChunk" parent="~/.framework/functions/cil-doc.ts"]
|
|
1385
|
+
// CIL[DOC-MACRO purpose="Implements the document chunk behavior for CIL documentation processing."]
|
|
1386
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Carries out the document chunk responsibility within the documentation workflow."]
|
|
1387
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
1388
|
+
// CIL[DOC-CONTRACT inputs="ctx: any, chunk: any, model: string, force: boolean, repoPath?: string" outputs="Promise<" errors="none" side_effects="Supabase database queries and updates"]
|
|
1389
|
+
// CIL[DOC-MICRO logic_summary="Computes the document chunk result from the provided input parameters." notable_decisions="Writes generated fields to the database and optionally persists JSDoc back to the source file."]
|
|
1390
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
1258
1391
|
// CIL[DOC-STABILITY stability="stable"]
|
|
1259
|
-
// CIL[DOC-VECTOR type="context" content="Layer: function. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
1260
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
1261
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
1262
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
1263
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1264
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1265
1392
|
async function documentChunk(
|
|
1266
1393
|
ctx: any,
|
|
1267
1394
|
chunk: any,
|
|
@@ -1275,7 +1402,8 @@ async function documentChunk(
|
|
|
1275
1402
|
|
|
1276
1403
|
const d = chunk.data || {}
|
|
1277
1404
|
if (!d.code_content && !d.chunk_name) {
|
|
1278
|
-
|
|
1405
|
+
const ref = d.stable_id || d.chunk_name || chunk.id
|
|
1406
|
+
return { success: false, fields_set: [], error: `No code content to document: ${ref}` }
|
|
1279
1407
|
}
|
|
1280
1408
|
|
|
1281
1409
|
const prompt = buildDocPrompt(chunk)
|
|
@@ -1328,26 +1456,26 @@ async function documentChunk(
|
|
|
1328
1456
|
|
|
1329
1457
|
return { success: true, fields_set: Object.keys(toWrite), updatedChunk }
|
|
1330
1458
|
}
|
|
1459
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Implements the document chunk behavior for CIL documentation processing.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
1460
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
1461
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
1462
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
1463
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1464
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1465
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:documentChunk:function"]
|
|
1331
1466
|
|
|
1332
1467
|
|
|
1333
1468
|
|
|
1334
1469
|
|
|
1335
1470
|
|
|
1336
|
-
// CIL[
|
|
1337
|
-
// CIL[
|
|
1338
|
-
// CIL[DOC-
|
|
1339
|
-
// CIL[DOC-
|
|
1340
|
-
// CIL[DOC-
|
|
1341
|
-
// CIL[DOC-
|
|
1342
|
-
// CIL[DOC-
|
|
1343
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
1471
|
+
// CIL[BEGIN stable_id="~/.framework/functions/cil-doc.ts:handler:constant" type="constant" identity="handler" parent="~/.framework/functions/cil-doc.ts"]
|
|
1472
|
+
// CIL[DOC-MACRO purpose="Netlify handler that dispatches documentation-related HTTP actions."]
|
|
1473
|
+
// CIL[DOC-RESPONSIBILITY responsibility="Routes documentation actions to the appropriate sub-handler and returns JSON responses."]
|
|
1474
|
+
// CIL[DOC-CONTEXT module="cil-doc" layer="app-specific" related_files=".framework/functions/_shared/cil.ts,.framework/functions/_shared/db.ts,.framework/functions/_shared/llm.ts,.framework/functions/_shared/middleware.ts,.framework/functions/admin-data.ts,.framework/functions/cil-doc.ts"]
|
|
1475
|
+
// CIL[DOC-CONTRACT inputs="ctx: any, body: any" outputs="Promise<any>" errors="Throws Error on invalid input or missing resources" side_effects="Supabase database queries and updates; local file system access"]
|
|
1476
|
+
// CIL[DOC-MICRO logic_summary="Uses query.action to route to estimate, gap_report, document, doc_chunk, or validate logic." notable_decisions="Supports estimate, gap_report, document, doc_chunk, and validate actions."]
|
|
1477
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
1344
1478
|
// CIL[DOC-STABILITY stability="stable"]
|
|
1345
|
-
// CIL[DOC-VECTOR type="context" content="Layer: function. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
1346
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
1347
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
1348
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
1349
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1350
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1351
1479
|
export const handler = createHandler(async (ctx, body) => {
|
|
1352
1480
|
const action = ctx.query?.action
|
|
1353
1481
|
|
|
@@ -1374,6 +1502,7 @@ export const handler = createHandler(async (ctx, body) => {
|
|
|
1374
1502
|
? Math.round((documented.length / chunks.length) * 100) : 0,
|
|
1375
1503
|
undocumented: undocumented.slice(0, 100).map(c => ({
|
|
1376
1504
|
id: c.id,
|
|
1505
|
+
stable_id: c.data?.stable_id || null,
|
|
1377
1506
|
chunk_name: c.data?.chunk_name || c.title,
|
|
1378
1507
|
file_path: c.data?.file_path || '',
|
|
1379
1508
|
chunk_type: c.data?.chunk_type || '',
|
|
@@ -1403,6 +1532,7 @@ export const handler = createHandler(async (ctx, body) => {
|
|
|
1403
1532
|
const inputTokens = estimateTokens(prompt) + SYSTEM_PROMPT_OVERHEAD_TOKENS
|
|
1404
1533
|
totalInputTokens += inputTokens
|
|
1405
1534
|
breakdown.push({
|
|
1535
|
+
stable_id: chunk.data?.stable_id || null,
|
|
1406
1536
|
chunk_name: chunk.data?.chunk_name || chunk.title,
|
|
1407
1537
|
file_path: chunk.data?.file_path || '',
|
|
1408
1538
|
input_tokens: inputTokens,
|
|
@@ -1441,18 +1571,10 @@ export const handler = createHandler(async (ctx, body) => {
|
|
|
1441
1571
|
|
|
1442
1572
|
|
|
1443
1573
|
if (action === 'doc_chunk') {
|
|
1444
|
-
const chunkId = body?.chunk_id || ctx.query?.chunk_id
|
|
1445
1574
|
const model = body?.model || ctx.query?.model || DEFAULT_MODEL
|
|
1446
1575
|
const force = body?.force ?? false
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
const { data: chunk, error } = await adminDb
|
|
1450
|
-
.from('items')
|
|
1451
|
-
.select('id, title, data')
|
|
1452
|
-
.eq('id', chunkId)
|
|
1453
|
-
.maybeSingle()
|
|
1454
|
-
|
|
1455
|
-
if (error || !chunk) throw new Error(`Chunk not found: ${chunkId}`)
|
|
1576
|
+
const chunk = await resolveChunk(ctx, body)
|
|
1577
|
+
const chunkId = chunk.id
|
|
1456
1578
|
|
|
1457
1579
|
const projectId = chunk.data?.project_id
|
|
1458
1580
|
let repoPath = ''
|
|
@@ -1462,7 +1584,7 @@ export const handler = createHandler(async (ctx, body) => {
|
|
|
1462
1584
|
}
|
|
1463
1585
|
|
|
1464
1586
|
const result = await documentChunk(ctx, chunk, model, force, repoPath)
|
|
1465
|
-
return { chunk_id: chunkId, chunk_name: chunk.data?.chunk_name || chunk.title, ...result }
|
|
1587
|
+
return { chunk_id: chunkId, chunk_name: chunk.data?.chunk_name || chunk.title, stable_id: chunk.data?.stable_id || null, ...result }
|
|
1466
1588
|
}
|
|
1467
1589
|
|
|
1468
1590
|
|
|
@@ -1480,6 +1602,7 @@ export const handler = createHandler(async (ctx, body) => {
|
|
|
1480
1602
|
if (errors.length > 0) {
|
|
1481
1603
|
invalid.push({
|
|
1482
1604
|
chunk_id: chunk.id,
|
|
1605
|
+
stable_id: chunk.data?.stable_id || null,
|
|
1483
1606
|
chunk_name: chunk.data?.chunk_name || chunk.title,
|
|
1484
1607
|
file_path: chunk.data?.file_path || '',
|
|
1485
1608
|
chunk_type: chunk.data?.chunk_type || '',
|
|
@@ -1546,7 +1669,7 @@ export const handler = createHandler(async (ctx, body) => {
|
|
|
1546
1669
|
stableList = data || []
|
|
1547
1670
|
} else if (selectedPaths.length > 0 && !filePath) {
|
|
1548
1671
|
|
|
1549
|
-
stableList = await loadPendingChunks(projectId, selectedPaths, '
|
|
1672
|
+
stableList = await loadPendingChunks(projectId, selectedPaths, '2-chunked')
|
|
1550
1673
|
} else {
|
|
1551
1674
|
stableList = await loadAllChunks(projectId, filePath)
|
|
1552
1675
|
}
|
|
@@ -1583,7 +1706,8 @@ export const handler = createHandler(async (ctx, body) => {
|
|
|
1583
1706
|
const subResults = await Promise.all(subBatch.map(async chunk => {
|
|
1584
1707
|
const d = chunk.data || {}
|
|
1585
1708
|
if (!d.code_content && !d.chunk_name) {
|
|
1586
|
-
|
|
1709
|
+
const ref = d.stable_id || d.chunk_name || chunk.id
|
|
1710
|
+
return { chunk, fields: null, error: `No code content: ${ref}` }
|
|
1587
1711
|
}
|
|
1588
1712
|
const prompt = buildDocPrompt(chunk)
|
|
1589
1713
|
try {
|
|
@@ -1610,7 +1734,7 @@ export const handler = createHandler(async (ctx, body) => {
|
|
|
1610
1734
|
|
|
1611
1735
|
await Promise.all(results.map(async ({ chunk, fields, is_fallback, error: llmError }) => {
|
|
1612
1736
|
if (!fields) {
|
|
1613
|
-
if (llmError) { failed++; errors.push(`${chunk.data?.chunk_name || chunk.id}: ${llmError}`) }
|
|
1737
|
+
if (llmError) { failed++; errors.push(`${chunk.data?.stable_id || chunk.data?.chunk_name || chunk.id}: ${llmError}`) }
|
|
1614
1738
|
else skipped++
|
|
1615
1739
|
return
|
|
1616
1740
|
}
|
|
@@ -1629,7 +1753,7 @@ export const handler = createHandler(async (ctx, body) => {
|
|
|
1629
1753
|
const chunkUpdateCtx = { ...ctx, query: { ...ctx.query, entity: 'items', id: chunk.id } }
|
|
1630
1754
|
if (validationErrors.length > 0) {
|
|
1631
1755
|
failed++
|
|
1632
|
-
errors.push(`${chunk.data?.chunk_name || chunk.id}: ${validationErrors.join(', ')}`)
|
|
1756
|
+
errors.push(`${chunk.data?.stable_id || chunk.data?.chunk_name || chunk.id}: ${validationErrors.join(', ')}`)
|
|
1633
1757
|
await adminUpdate(chunkUpdateCtx, { data: { ...updatedData, doc_validation_errors: validationErrors } })
|
|
1634
1758
|
.catch(() => { /* non-fatal — don't mask original validation error */ })
|
|
1635
1759
|
return
|
|
@@ -1638,7 +1762,7 @@ export const handler = createHandler(async (ctx, body) => {
|
|
|
1638
1762
|
try {
|
|
1639
1763
|
await adminUpdate(chunkUpdateCtx, { data: updatedData })
|
|
1640
1764
|
} catch (updateError: any) {
|
|
1641
|
-
failed++; errors.push(`${chunk.data?.chunk_name || chunk.id}: ${updateError.message}`)
|
|
1765
|
+
failed++; errors.push(`${chunk.data?.stable_id || chunk.data?.chunk_name || chunk.id}: ${updateError.message}`)
|
|
1642
1766
|
return
|
|
1643
1767
|
}
|
|
1644
1768
|
{
|
|
@@ -1677,14 +1801,14 @@ export const handler = createHandler(async (ctx, body) => {
|
|
|
1677
1801
|
.sort((a, b) => b.markerIdx - a.markerIdx)
|
|
1678
1802
|
const missed = chunks
|
|
1679
1803
|
.filter(c => markerMap.get((c.data?.chunk_name || c.title).trim().toLowerCase()) === undefined)
|
|
1680
|
-
.map(c => c.data?.chunk_name || c.title)
|
|
1804
|
+
.map(c => c.data?.stable_id || c.data?.chunk_name || c.title)
|
|
1681
1805
|
if (missed.length > 0) {
|
|
1682
1806
|
errors.push(`Write-back: could not find markers for ${missed.join(', ')} in ${relPath}`)
|
|
1683
1807
|
}
|
|
1684
1808
|
for (const { chunk, markerIdx } of sorted) {
|
|
1685
1809
|
const jsDoc = buildJsDoc(chunk)
|
|
1686
1810
|
if (!jsDoc) {
|
|
1687
|
-
errors.push(`Write-back: no JSDoc built for ${chunk.data?.chunk_name || chunk.title}`)
|
|
1811
|
+
errors.push(`Write-back: no JSDoc built for ${chunk.data?.stable_id || chunk.data?.chunk_name || chunk.title}`)
|
|
1688
1812
|
continue
|
|
1689
1813
|
}
|
|
1690
1814
|
const existing = findExistingCilJsDoc(newLines, markerIdx)
|
|
@@ -1745,8 +1869,13 @@ export const handler = createHandler(async (ctx, body) => {
|
|
|
1745
1869
|
|
|
1746
1870
|
throw new Error(`Unknown action: ${action}. Valid: estimate, gap_report, document, doc_chunk, validate`)
|
|
1747
1871
|
})
|
|
1872
|
+
// CIL[DOC-VECTOR type="context" content="purpose='Netlify handler that dispatches documentation-related HTTP actions.'; No verified external callers; imports: .framework/functions/_shared/middleware.ts,.framework/functions/_shared/db.ts,.framework/functions/admin-data.ts"]
|
|
1873
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
1874
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
1875
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
1876
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1877
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1878
|
+
// CIL[END stable_id="~/.framework/functions/cil-doc.ts:handler:constant"]
|
|
1748
1879
|
|
|
1749
1880
|
|
|
1750
1881
|
|
|
1751
|
-
|
|
1752
|
-
// CIL[END chunk_id="custom_apps_cortex_functions_custom_cil_doc_handler_1784235266"]
|