clinkx 0.2.3 → 1.0.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/CHANGELOG.md +33 -0
- package/LICENSE +10 -0
- package/README.md +113 -18
- package/clinkx-workflows/dist/allowed-roots.d.ts +1 -0
- package/clinkx-workflows/dist/allowed-roots.js +5 -0
- package/clinkx-workflows/dist/allowed-roots.js.map +1 -0
- package/clinkx-workflows/dist/artifacts.d.ts +20 -1
- package/clinkx-workflows/dist/artifacts.js +38 -9
- package/clinkx-workflows/dist/artifacts.js.map +1 -1
- package/clinkx-workflows/dist/backend.d.ts +4 -0
- package/clinkx-workflows/dist/citation-check.d.ts +40 -0
- package/clinkx-workflows/dist/citation-check.js +348 -0
- package/clinkx-workflows/dist/citation-check.js.map +1 -0
- package/clinkx-workflows/dist/clink-client.d.ts +2 -1
- package/clinkx-workflows/dist/clink-client.js +17 -4
- package/clinkx-workflows/dist/clink-client.js.map +1 -1
- package/clinkx-workflows/dist/config.d.ts +145 -16
- package/clinkx-workflows/dist/config.js +384 -26
- package/clinkx-workflows/dist/config.js.map +1 -1
- package/clinkx-workflows/dist/contained-file.d.ts +172 -0
- package/clinkx-workflows/dist/contained-file.js +483 -0
- package/clinkx-workflows/dist/contained-file.js.map +1 -0
- package/clinkx-workflows/dist/context-builder-lifecycle-contract.d.ts +416 -0
- package/clinkx-workflows/dist/context-builder-lifecycle-contract.js +328 -0
- package/clinkx-workflows/dist/context-builder-lifecycle-contract.js.map +1 -0
- package/clinkx-workflows/dist/context-builder-lifecycle-router.d.ts +24 -0
- package/clinkx-workflows/dist/context-builder-lifecycle-router.js +39 -0
- package/clinkx-workflows/dist/context-builder-lifecycle-router.js.map +1 -0
- package/clinkx-workflows/dist/context-cache-key.d.ts +53 -0
- package/clinkx-workflows/dist/context-cache-key.js +91 -0
- package/clinkx-workflows/dist/context-cache-key.js.map +1 -0
- package/clinkx-workflows/dist/context-mode-resolver.d.ts +27 -0
- package/clinkx-workflows/dist/context-mode-resolver.js +126 -0
- package/clinkx-workflows/dist/context-mode-resolver.js.map +1 -0
- package/clinkx-workflows/dist/context-preflight.d.ts +184 -0
- package/clinkx-workflows/dist/context-preflight.js +91 -0
- package/clinkx-workflows/dist/context-preflight.js.map +1 -0
- package/clinkx-workflows/dist/council-expander.d.ts +1 -1
- package/clinkx-workflows/dist/council-expander.js +2 -1
- package/clinkx-workflows/dist/council-expander.js.map +1 -1
- package/clinkx-workflows/dist/dashboard/activity-contract.d.ts +165 -0
- package/clinkx-workflows/dist/dashboard/activity-contract.js +105 -0
- package/clinkx-workflows/dist/dashboard/activity-contract.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/activity-lease.d.ts +25 -0
- package/clinkx-workflows/dist/dashboard/activity-lease.js +34 -0
- package/clinkx-workflows/dist/dashboard/activity-lease.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/activity-reader.d.ts +86 -0
- package/clinkx-workflows/dist/dashboard/activity-reader.js +480 -0
- package/clinkx-workflows/dist/dashboard/activity-reader.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/api-routes.d.ts +36 -0
- package/clinkx-workflows/dist/dashboard/api-routes.js +1047 -0
- package/clinkx-workflows/dist/dashboard/api-routes.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/artifact-index.d.ts +37 -0
- package/clinkx-workflows/dist/dashboard/artifact-index.js +145 -0
- package/clinkx-workflows/dist/dashboard/artifact-index.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/auth/challenge-store.d.ts +31 -0
- package/clinkx-workflows/dist/dashboard/auth/challenge-store.js +65 -0
- package/clinkx-workflows/dist/dashboard/auth/challenge-store.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/auth/controller.d.ts +26 -0
- package/clinkx-workflows/dist/dashboard/auth/controller.js +596 -0
- package/clinkx-workflows/dist/dashboard/auth/controller.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/auth/credential-store.d.ts +60 -0
- package/clinkx-workflows/dist/dashboard/auth/credential-store.js +776 -0
- package/clinkx-workflows/dist/dashboard/auth/credential-store.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/auth/enrollment-gate.d.ts +9 -0
- package/clinkx-workflows/dist/dashboard/auth/enrollment-gate.js +44 -0
- package/clinkx-workflows/dist/dashboard/auth/enrollment-gate.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/auth/session-store.d.ts +17 -0
- package/clinkx-workflows/dist/dashboard/auth/session-store.js +77 -0
- package/clinkx-workflows/dist/dashboard/auth/session-store.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/auth/webauthn-service.d.ts +25 -0
- package/clinkx-workflows/dist/dashboard/auth/webauthn-service.js +71 -0
- package/clinkx-workflows/dist/dashboard/auth/webauthn-service.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/context-run-liveness.d.ts +37 -0
- package/clinkx-workflows/dist/dashboard/context-run-liveness.js +49 -0
- package/clinkx-workflows/dist/dashboard/context-run-liveness.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/context-run-reader.d.ts +222 -0
- package/clinkx-workflows/dist/dashboard/context-run-reader.js +1178 -0
- package/clinkx-workflows/dist/dashboard/context-run-reader.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/contracts.d.ts +8936 -0
- package/clinkx-workflows/dist/dashboard/contracts.js +1157 -0
- package/clinkx-workflows/dist/dashboard/contracts.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/generation.d.ts +14 -0
- package/clinkx-workflows/dist/dashboard/generation.js +41 -0
- package/clinkx-workflows/dist/dashboard/generation.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/index.d.ts +28 -0
- package/clinkx-workflows/dist/dashboard/index.js +16 -0
- package/clinkx-workflows/dist/dashboard/index.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/lazy-content.d.ts +101 -0
- package/clinkx-workflows/dist/dashboard/lazy-content.js +748 -0
- package/clinkx-workflows/dist/dashboard/lazy-content.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/progress-report-contract.d.ts +303 -0
- package/clinkx-workflows/dist/dashboard/progress-report-contract.js +221 -0
- package/clinkx-workflows/dist/dashboard/progress-report-contract.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/progress-report-reader.d.ts +50 -0
- package/clinkx-workflows/dist/dashboard/progress-report-reader.js +581 -0
- package/clinkx-workflows/dist/dashboard/progress-report-reader.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/progress-report-status-overlay.d.ts +89 -0
- package/clinkx-workflows/dist/dashboard/progress-report-status-overlay.js +71 -0
- package/clinkx-workflows/dist/dashboard/progress-report-status-overlay.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/progress-report-status-store.d.ts +28 -0
- package/clinkx-workflows/dist/dashboard/progress-report-status-store.js +110 -0
- package/clinkx-workflows/dist/dashboard/progress-report-status-store.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/read-model.d.ts +86 -0
- package/clinkx-workflows/dist/dashboard/read-model.js +440 -0
- package/clinkx-workflows/dist/dashboard/read-model.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/request-admission.d.ts +31 -0
- package/clinkx-workflows/dist/dashboard/request-admission.js +126 -0
- package/clinkx-workflows/dist/dashboard/request-admission.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/scanner.d.ts +75 -0
- package/clinkx-workflows/dist/dashboard/scanner.js +1110 -0
- package/clinkx-workflows/dist/dashboard/scanner.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/server-factory.d.ts +50 -0
- package/clinkx-workflows/dist/dashboard/server-factory.js +431 -0
- package/clinkx-workflows/dist/dashboard/server-factory.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/session-log-contract.d.ts +2611 -0
- package/clinkx-workflows/dist/dashboard/session-log-contract.js +480 -0
- package/clinkx-workflows/dist/dashboard/session-log-contract.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/session-log-identity.d.ts +21 -0
- package/clinkx-workflows/dist/dashboard/session-log-identity.js +101 -0
- package/clinkx-workflows/dist/dashboard/session-log-identity.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/session-log-journal.d.ts +43 -0
- package/clinkx-workflows/dist/dashboard/session-log-journal.js +522 -0
- package/clinkx-workflows/dist/dashboard/session-log-journal.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/session-log-reader.d.ts +61 -0
- package/clinkx-workflows/dist/dashboard/session-log-reader.js +378 -0
- package/clinkx-workflows/dist/dashboard/session-log-reader.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/session-log-redaction.d.ts +6 -0
- package/clinkx-workflows/dist/dashboard/session-log-redaction.js +367 -0
- package/clinkx-workflows/dist/dashboard/session-log-redaction.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/session-log-retention.d.ts +23 -0
- package/clinkx-workflows/dist/dashboard/session-log-retention.js +212 -0
- package/clinkx-workflows/dist/dashboard/session-log-retention.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/static-responses.d.ts +10 -0
- package/clinkx-workflows/dist/dashboard/static-responses.js +94 -0
- package/clinkx-workflows/dist/dashboard/static-responses.js.map +1 -0
- package/clinkx-workflows/dist/dashboard/worker-lock-observer.d.ts +28 -0
- package/clinkx-workflows/dist/dashboard/worker-lock-observer.js +241 -0
- package/clinkx-workflows/dist/dashboard/worker-lock-observer.js.map +1 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-400-normal-CDDApCn2.woff2 +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-400-normal-CYLoc0-x.woff +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-500-normal-6ng42L7E.woff2 +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-500-normal-BgVn5rGT.woff +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-600-normal-Cu4Hd6ag.woff +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/ibm-plex-sans-latin-600-normal-CuJfVYMP.woff2 +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/index-DOkMXTfB.js +25 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
- package/clinkx-workflows/dist/dashboard-ui/assets/style-ChJsn0KD.css +1 -0
- package/clinkx-workflows/dist/dashboard-ui/contracts/council-plan-review-input-v1.json +158 -0
- package/clinkx-workflows/dist/dashboard-ui/index.html +15 -0
- package/clinkx-workflows/dist/dashboard-ui/licenses/IBM-Plex-Mono-OFL.txt +93 -0
- package/clinkx-workflows/dist/dashboard-ui/licenses/IBM-Plex-Sans-OFL.txt +93 -0
- package/clinkx-workflows/dist/dashboard-ui/licenses/JetBrains-Mono-OFL.txt +93 -0
- package/clinkx-workflows/dist/dashboard-ui/licenses/NOTICE.md +32 -0
- package/clinkx-workflows/dist/dashboard-ui/theme-init.js +8 -0
- package/clinkx-workflows/dist/definition-normalizer.d.ts +19 -0
- package/clinkx-workflows/dist/definition-normalizer.js.map +1 -1
- package/clinkx-workflows/dist/delegate-validate.d.ts +78 -0
- package/clinkx-workflows/dist/delegate-validate.js +97 -0
- package/clinkx-workflows/dist/delegate-validate.js.map +1 -0
- package/clinkx-workflows/dist/engine.d.ts +141 -0
- package/clinkx-workflows/dist/engine.js +882 -28
- package/clinkx-workflows/dist/engine.js.map +1 -1
- package/clinkx-workflows/dist/errors.d.ts +2 -0
- package/clinkx-workflows/dist/errors.js.map +1 -1
- package/clinkx-workflows/dist/fingerprint.d.ts +1 -1
- package/clinkx-workflows/dist/fingerprint.js +1 -1
- package/clinkx-workflows/dist/index.d.ts +19 -0
- package/clinkx-workflows/dist/index.js +15 -0
- package/clinkx-workflows/dist/index.js.map +1 -1
- package/clinkx-workflows/dist/loader.d.ts +9 -3
- package/clinkx-workflows/dist/loader.js +92 -21
- package/clinkx-workflows/dist/loader.js.map +1 -1
- package/clinkx-workflows/dist/plan-review/admission.d.ts +160 -0
- package/clinkx-workflows/dist/plan-review/admission.js +290 -0
- package/clinkx-workflows/dist/plan-review/admission.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/context-policy.d.ts +55 -0
- package/clinkx-workflows/dist/plan-review/context-policy.js +146 -0
- package/clinkx-workflows/dist/plan-review/context-policy.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/contract.d.ts +763 -0
- package/clinkx-workflows/dist/plan-review/contract.js +289 -0
- package/clinkx-workflows/dist/plan-review/contract.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/digest.d.ts +68 -0
- package/clinkx-workflows/dist/plan-review/digest.js +241 -0
- package/clinkx-workflows/dist/plan-review/digest.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/discovery.d.ts +45 -0
- package/clinkx-workflows/dist/plan-review/discovery.js +36 -0
- package/clinkx-workflows/dist/plan-review/discovery.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/execution-contract.d.ts +298 -0
- package/clinkx-workflows/dist/plan-review/execution-contract.js +194 -0
- package/clinkx-workflows/dist/plan-review/execution-contract.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/expander.d.ts +48 -0
- package/clinkx-workflows/dist/plan-review/expander.js +243 -0
- package/clinkx-workflows/dist/plan-review/expander.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/projector.d.ts +126 -0
- package/clinkx-workflows/dist/plan-review/projector.js +437 -0
- package/clinkx-workflows/dist/plan-review/projector.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/publication.d.ts +95 -0
- package/clinkx-workflows/dist/plan-review/publication.js +182 -0
- package/clinkx-workflows/dist/plan-review/publication.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/ranking-reducer.d.ts +34 -0
- package/clinkx-workflows/dist/plan-review/ranking-reducer.js +139 -0
- package/clinkx-workflows/dist/plan-review/ranking-reducer.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/resume.d.ts +38 -0
- package/clinkx-workflows/dist/plan-review/resume.js +122 -0
- package/clinkx-workflows/dist/plan-review/resume.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/rubric.d.ts +7 -0
- package/clinkx-workflows/dist/plan-review/rubric.js +24 -0
- package/clinkx-workflows/dist/plan-review/rubric.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/run-state.d.ts +398 -0
- package/clinkx-workflows/dist/plan-review/run-state.js +183 -0
- package/clinkx-workflows/dist/plan-review/run-state.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/runtime-policy.d.ts +74 -0
- package/clinkx-workflows/dist/plan-review/runtime-policy.js +186 -0
- package/clinkx-workflows/dist/plan-review/runtime-policy.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/snapshot.d.ts +81 -0
- package/clinkx-workflows/dist/plan-review/snapshot.js +170 -0
- package/clinkx-workflows/dist/plan-review/snapshot.js.map +1 -0
- package/clinkx-workflows/dist/plan-review/stage-error.d.ts +19 -0
- package/clinkx-workflows/dist/plan-review/stage-error.js +20 -0
- package/clinkx-workflows/dist/plan-review/stage-error.js.map +1 -0
- package/clinkx-workflows/dist/post-processors/index.d.ts +20 -0
- package/clinkx-workflows/dist/post-processors/index.js +21 -0
- package/clinkx-workflows/dist/post-processors/index.js.map +1 -0
- package/clinkx-workflows/dist/prompt-budget.d.ts +7 -0
- package/clinkx-workflows/dist/prompt-budget.js +7 -1
- package/clinkx-workflows/dist/prompt-budget.js.map +1 -1
- package/clinkx-workflows/dist/reducers/index.js +2 -0
- package/clinkx-workflows/dist/reducers/index.js.map +1 -1
- package/clinkx-workflows/dist/run-lock-heartbeat.d.ts +2 -0
- package/clinkx-workflows/dist/run-lock-heartbeat.js +3 -0
- package/clinkx-workflows/dist/run-lock-heartbeat.js.map +1 -0
- package/clinkx-workflows/dist/run-summary/cards/council-plan-review.d.ts +34 -0
- package/clinkx-workflows/dist/run-summary/cards/council-plan-review.js +74 -0
- package/clinkx-workflows/dist/run-summary/cards/council-plan-review.js.map +1 -0
- package/clinkx-workflows/dist/run-summary/cards/index.js +5 -0
- package/clinkx-workflows/dist/run-summary/cards/index.js.map +1 -1
- package/clinkx-workflows/dist/run-summary.d.ts +13 -0
- package/clinkx-workflows/dist/run-summary.js +29 -1
- package/clinkx-workflows/dist/run-summary.js.map +1 -1
- package/clinkx-workflows/dist/schema.d.ts +76 -21
- package/clinkx-workflows/dist/schema.js +10 -1
- package/clinkx-workflows/dist/schema.js.map +1 -1
- package/clinkx-workflows/dist/seed-terms.d.ts +30 -0
- package/clinkx-workflows/dist/seed-terms.js +176 -0
- package/clinkx-workflows/dist/seed-terms.js.map +1 -0
- package/clinkx-workflows/dist/server.d.ts +5 -2
- package/clinkx-workflows/dist/server.js +82 -52
- package/clinkx-workflows/dist/server.js.map +1 -1
- package/clinkx-workflows/dist/shutdown.d.ts +18 -20
- package/clinkx-workflows/dist/shutdown.js +43 -61
- package/clinkx-workflows/dist/shutdown.js.map +1 -1
- package/clinkx-workflows/dist/state-schema.d.ts +38 -0
- package/clinkx-workflows/dist/state.d.ts +170 -3
- package/clinkx-workflows/dist/state.js +1275 -28
- package/clinkx-workflows/dist/state.js.map +1 -1
- package/clinkx-workflows/dist/transport.d.ts +15 -0
- package/clinkx-workflows/dist/transport.js +19 -10
- package/clinkx-workflows/dist/transport.js.map +1 -1
- package/clinkx-workflows/dist/types.d.ts +14 -2
- package/clinkx-workflows/dist/validators/council.d.ts +318 -85
- package/clinkx-workflows/dist/validators/council.js +52 -13
- package/clinkx-workflows/dist/validators/council.js.map +1 -1
- package/clinkx-workflows/dist/validators/index.d.ts +1 -0
- package/clinkx-workflows/dist/validators/index.js +3 -0
- package/clinkx-workflows/dist/validators/index.js.map +1 -1
- package/clinkx-workflows/dist/validators/plan-review.d.ts +398 -0
- package/clinkx-workflows/dist/validators/plan-review.js +316 -0
- package/clinkx-workflows/dist/validators/plan-review.js.map +1 -0
- package/clinkx-workflows/dist/workflow-receipt.js +188 -4
- package/clinkx-workflows/dist/workflow-receipt.js.map +1 -1
- package/clinkx-workflows/dist/workflow-tools.d.ts +48 -3
- package/clinkx-workflows/dist/workflow-tools.js +1402 -59
- package/clinkx-workflows/dist/workflow-tools.js.map +1 -1
- package/clinkx-workflows/dist/workspace-signature.d.ts +16 -0
- package/clinkx-workflows/dist/workspace-signature.js +388 -0
- package/clinkx-workflows/dist/workspace-signature.js.map +1 -0
- package/clinkx-workflows/templates/council/answer-specialist.txt +2 -1
- package/clinkx-workflows/templates/council/code-review-chairman.txt +13 -0
- package/clinkx-workflows/templates/council/code-review-cross-reviewer.txt +4 -1
- package/clinkx-workflows/templates/council/code-review-reviewer.txt +19 -3
- package/clinkx-workflows/templates/council/debug-debugger.txt +2 -1
- package/clinkx-workflows/templates/council/discover-analyst.txt +2 -1
- package/clinkx-workflows/templates/council/member.txt +2 -1
- package/clinkx-workflows/templates/council/plan-review-chairman.txt +68 -0
- package/clinkx-workflows/templates/council/plan-review-cross-reviewer.txt +51 -0
- package/clinkx-workflows/templates/council/plan-review-reviewer.txt +60 -0
- package/clinkx-workflows/templates/plan-review/chairman.txt +48 -0
- package/clinkx-workflows/templates/plan-review/cross-review.txt +52 -0
- package/clinkx-workflows/templates/plan-review/ranking.txt +16 -0
- package/clinkx-workflows/templates/plan-review/reviewer.txt +57 -0
- package/clinkx-workflows/workflows/council-answer.yaml +97 -8
- package/clinkx-workflows/workflows/council-code-review.yaml +103 -8
- package/clinkx-workflows/workflows/council-debug.yaml +97 -8
- package/clinkx-workflows/workflows/council-default.yaml +97 -8
- package/clinkx-workflows/workflows/council-discover.yaml +97 -8
- package/clinkx-workflows/workflows/council-plan-review.yaml +250 -0
- package/clinkx-workflows/workflows/plan-review-receipts.yaml +230 -0
- package/conf/adapters/agy.json +49 -0
- package/conf/adapters/claude.json +5 -0
- package/conf/adapters/codex-app-server.json +44 -0
- package/conf/adapters/codex.json +7 -2
- package/conf/adapters/glm.json +5 -0
- package/conf/adapters/grok.json +60 -0
- package/conf/adapters/hapi/agy.json +52 -0
- package/conf/adapters/hapi/claude.json +5 -0
- package/conf/adapters/hapi/codex.json +7 -2
- package/conf/adapters/hapi/glm.json +5 -0
- package/conf/prompts/json-codereviewer.txt +1 -0
- package/conf/prompts/json.txt +1 -0
- package/dist/activity-journal.d.ts +42 -0
- package/dist/activity-journal.js +381 -0
- package/dist/activity-journal.js.map +1 -0
- package/dist/allowed-roots.d.ts +53 -0
- package/dist/allowed-roots.js +216 -0
- package/dist/allowed-roots.js.map +1 -0
- package/dist/codex/activity-session-log.d.ts +14 -0
- package/dist/codex/activity-session-log.js +206 -0
- package/dist/codex/activity-session-log.js.map +1 -0
- package/dist/codex/agent-tools.d.ts +23 -0
- package/dist/codex/agent-tools.js +1270 -0
- package/dist/codex/agent-tools.js.map +1 -0
- package/dist/codex/app-server-client.d.ts +76 -0
- package/dist/codex/app-server-client.js +582 -0
- package/dist/codex/app-server-client.js.map +1 -0
- package/dist/codex/app-server-registry.d.ts +389 -0
- package/dist/codex/app-server-registry.js +1407 -0
- package/dist/codex/app-server-registry.js.map +1 -0
- package/dist/codex/client-types.d.ts +109 -0
- package/dist/codex/client-types.js +2 -0
- package/dist/codex/client-types.js.map +1 -0
- package/dist/codex/protocol.d.ts +5375 -0
- package/dist/codex/protocol.js +614 -0
- package/dist/codex/protocol.js.map +1 -0
- package/dist/codex/session.d.ts +263 -0
- package/dist/codex/session.js +466 -0
- package/dist/codex/session.js.map +1 -0
- package/dist/config.d.ts +185 -19
- package/dist/config.js +82 -16
- package/dist/config.js.map +1 -1
- package/dist/context-builder/anchors.d.ts +12 -0
- package/dist/context-builder/anchors.js +22 -0
- package/dist/context-builder/anchors.js.map +1 -0
- package/dist/context-builder/bundle.d.ts +109 -0
- package/dist/context-builder/bundle.js +1498 -0
- package/dist/context-builder/bundle.js.map +1 -0
- package/dist/context-builder/codemap.d.ts +22 -0
- package/dist/context-builder/codemap.js +675 -0
- package/dist/context-builder/codemap.js.map +1 -0
- package/dist/context-builder/config.d.ts +61 -0
- package/dist/context-builder/config.js +216 -0
- package/dist/context-builder/config.js.map +1 -0
- package/dist/context-builder/context-run-catalog.d.ts +17 -0
- package/dist/context-builder/context-run-catalog.js +99 -0
- package/dist/context-builder/context-run-catalog.js.map +1 -0
- package/dist/context-builder/delegate-packet.d.ts +219 -0
- package/dist/context-builder/delegate-packet.js +1190 -0
- package/dist/context-builder/delegate-packet.js.map +1 -0
- package/dist/context-builder/delegate-reconstruction.d.ts +13 -0
- package/dist/context-builder/delegate-reconstruction.js +220 -0
- package/dist/context-builder/delegate-reconstruction.js.map +1 -0
- package/dist/context-builder/delegate-validation.d.ts +27 -0
- package/dist/context-builder/delegate-validation.js +479 -0
- package/dist/context-builder/delegate-validation.js.map +1 -0
- package/dist/context-builder/delegate.d.ts +26 -0
- package/dist/context-builder/delegate.js +134 -0
- package/dist/context-builder/delegate.js.map +1 -0
- package/dist/context-builder/diagnostics.d.ts +36 -0
- package/dist/context-builder/diagnostics.js +107 -0
- package/dist/context-builder/diagnostics.js.map +1 -0
- package/dist/context-builder/discovery.d.ts +146 -0
- package/dist/context-builder/discovery.js +2129 -0
- package/dist/context-builder/discovery.js.map +1 -0
- package/dist/context-builder/globs.d.ts +14 -0
- package/dist/context-builder/globs.js +175 -0
- package/dist/context-builder/globs.js.map +1 -0
- package/dist/context-builder/handler.d.ts +41 -0
- package/dist/context-builder/handler.js +2590 -0
- package/dist/context-builder/handler.js.map +1 -0
- package/dist/context-builder/lifecycle-contract.d.ts +424 -0
- package/dist/context-builder/lifecycle-contract.js +523 -0
- package/dist/context-builder/lifecycle-contract.js.map +1 -0
- package/dist/context-builder/lifecycle-journal.d.ts +62 -0
- package/dist/context-builder/lifecycle-journal.js +88 -0
- package/dist/context-builder/lifecycle-journal.js.map +1 -0
- package/dist/context-builder/lifecycle-observer.d.ts +102 -0
- package/dist/context-builder/lifecycle-observer.js +258 -0
- package/dist/context-builder/lifecycle-observer.js.map +1 -0
- package/dist/context-builder/lifecycle-reconcile.d.ts +32 -0
- package/dist/context-builder/lifecycle-reconcile.js +191 -0
- package/dist/context-builder/lifecycle-reconcile.js.map +1 -0
- package/dist/context-builder/lifecycle-recovery.d.ts +2 -0
- package/dist/context-builder/lifecycle-recovery.js +14 -0
- package/dist/context-builder/lifecycle-recovery.js.map +1 -0
- package/dist/context-builder/path-signals.d.ts +7 -0
- package/dist/context-builder/path-signals.js +70 -0
- package/dist/context-builder/path-signals.js.map +1 -0
- package/dist/context-builder/paths.d.ts +30 -0
- package/dist/context-builder/paths.js +153 -0
- package/dist/context-builder/paths.js.map +1 -0
- package/dist/context-builder/progress.d.ts +17 -0
- package/dist/context-builder/progress.js +93 -0
- package/dist/context-builder/progress.js.map +1 -0
- package/dist/context-builder/receipt.d.ts +91 -0
- package/dist/context-builder/receipt.js +180 -0
- package/dist/context-builder/receipt.js.map +1 -0
- package/dist/context-builder/refine-handler.d.ts +14 -0
- package/dist/context-builder/refine-handler.js +790 -0
- package/dist/context-builder/refine-handler.js.map +1 -0
- package/dist/context-builder/review-coverage.d.ts +84 -0
- package/dist/context-builder/review-coverage.js +437 -0
- package/dist/context-builder/review-coverage.js.map +1 -0
- package/dist/context-builder/run-id.d.ts +7 -0
- package/dist/context-builder/run-id.js +31 -0
- package/dist/context-builder/run-id.js.map +1 -0
- package/dist/context-builder/schema.d.ts +669 -0
- package/dist/context-builder/schema.js +399 -0
- package/dist/context-builder/schema.js.map +1 -0
- package/dist/context-builder/secrets.d.ts +41 -0
- package/dist/context-builder/secrets.js +1651 -0
- package/dist/context-builder/secrets.js.map +1 -0
- package/dist/context-builder/selection.d.ts +56 -0
- package/dist/context-builder/selection.js +1111 -0
- package/dist/context-builder/selection.js.map +1 -0
- package/dist/context-builder/session-log-identity.d.ts +1 -0
- package/dist/context-builder/session-log-identity.js +66 -0
- package/dist/context-builder/session-log-identity.js.map +1 -0
- package/dist/context-builder/slice-range-math.d.ts +16 -0
- package/dist/context-builder/slice-range-math.js +137 -0
- package/dist/context-builder/slice-range-math.js.map +1 -0
- package/dist/context-builder/status.d.ts +66 -0
- package/dist/context-builder/status.js +160 -0
- package/dist/context-builder/status.js.map +1 -0
- package/dist/context-builder/storage.d.ts +118 -0
- package/dist/context-builder/storage.js +1003 -0
- package/dist/context-builder/storage.js.map +1 -0
- package/dist/context-builder/token-estimate.d.ts +19 -0
- package/dist/context-builder/token-estimate.js +90 -0
- package/dist/context-builder/token-estimate.js.map +1 -0
- package/dist/context-builder/versions.d.ts +29 -0
- package/dist/context-builder/versions.js +30 -0
- package/dist/context-builder/versions.js.map +1 -0
- package/dist/context-builder/workflow-runner.d.ts +69 -0
- package/dist/context-builder/workflow-runner.js +1051 -0
- package/dist/context-builder/workflow-runner.js.map +1 -0
- package/dist/context-builder/write-watchdog.d.ts +14 -0
- package/dist/context-builder/write-watchdog.js +38 -0
- package/dist/context-builder/write-watchdog.js.map +1 -0
- package/dist/dashboard-adapter-catalog.d.ts +9 -0
- package/dist/dashboard-adapter-catalog.js +46 -0
- package/dist/dashboard-adapter-catalog.js.map +1 -0
- package/dist/dashboard-cli.d.ts +79 -0
- package/dist/dashboard-cli.js +585 -0
- package/dist/dashboard-cli.js.map +1 -0
- package/dist/dashboard-companion/client.d.ts +36 -0
- package/dist/dashboard-companion/client.js +210 -0
- package/dist/dashboard-companion/client.js.map +1 -0
- package/dist/dashboard-companion/config.d.ts +8 -0
- package/dist/dashboard-companion/config.js +52 -0
- package/dist/dashboard-companion/config.js.map +1 -0
- package/dist/dashboard-companion/http-proxy.d.ts +10 -0
- package/dist/dashboard-companion/http-proxy.js +234 -0
- package/dist/dashboard-companion/http-proxy.js.map +1 -0
- package/dist/dashboard-companion/protocol.d.ts +80 -0
- package/dist/dashboard-companion/protocol.js +455 -0
- package/dist/dashboard-companion/protocol.js.map +1 -0
- package/dist/dashboard-companion/standalone-assets.d.ts +12 -0
- package/dist/dashboard-companion/standalone-assets.js +72 -0
- package/dist/dashboard-companion/standalone-assets.js.map +1 -0
- package/dist/dashboard-companion/standalone-entry.d.ts +1 -0
- package/dist/dashboard-companion/standalone-entry.js +17 -0
- package/dist/dashboard-companion/standalone-entry.js.map +1 -0
- package/dist/dashboard-gateway/config.d.ts +9 -0
- package/dist/dashboard-gateway/config.js +44 -0
- package/dist/dashboard-gateway/config.js.map +1 -0
- package/dist/dashboard-gateway/index.d.ts +11 -0
- package/dist/dashboard-gateway/index.js +755 -0
- package/dist/dashboard-gateway/index.js.map +1 -0
- package/dist/dashboard-gateway/main.d.ts +1 -0
- package/dist/dashboard-gateway/main.js +25 -0
- package/dist/dashboard-gateway/main.js.map +1 -0
- package/dist/dashboard-pairing-token.d.ts +1 -0
- package/dist/dashboard-pairing-token.js +5 -0
- package/dist/dashboard-pairing-token.js.map +1 -0
- package/dist/elaris/client.d.ts +73 -0
- package/dist/elaris/client.js +825 -0
- package/dist/elaris/client.js.map +1 -0
- package/dist/elaris/config.d.ts +18 -0
- package/dist/elaris/config.js +75 -0
- package/dist/elaris/config.js.map +1 -0
- package/dist/elaris/errors.d.ts +41 -0
- package/dist/elaris/errors.js +205 -0
- package/dist/elaris/errors.js.map +1 -0
- package/dist/elaris/github-repo.d.ts +18 -0
- package/dist/elaris/github-repo.js +89 -0
- package/dist/elaris/github-repo.js.map +1 -0
- package/dist/elaris/index.d.ts +10 -0
- package/dist/elaris/index.js +11 -0
- package/dist/elaris/index.js.map +1 -0
- package/dist/elaris/redact.d.ts +89 -0
- package/dist/elaris/redact.js +423 -0
- package/dist/elaris/redact.js.map +1 -0
- package/dist/elaris/run-id.d.ts +5 -0
- package/dist/elaris/run-id.js +20 -0
- package/dist/elaris/run-id.js.map +1 -0
- package/dist/elaris/status.d.ts +45 -0
- package/dist/elaris/status.js +122 -0
- package/dist/elaris/status.js.map +1 -0
- package/dist/elaris/tool-schemas.d.ts +314 -0
- package/dist/elaris/tool-schemas.js +208 -0
- package/dist/elaris/tool-schemas.js.map +1 -0
- package/dist/elaris/tools.d.ts +73 -0
- package/dist/elaris/tools.js +1065 -0
- package/dist/elaris/tools.js.map +1 -0
- package/dist/elaris/types.d.ts +1541 -0
- package/dist/elaris/types.js +252 -0
- package/dist/elaris/types.js.map +1 -0
- package/dist/errors.d.ts +16 -0
- package/dist/errors.js +19 -0
- package/dist/errors.js.map +1 -1
- package/dist/handler.d.ts +4 -0
- package/dist/handler.js +10 -1
- package/dist/handler.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/dist/local-clink-backend.d.ts +3 -0
- package/dist/local-clink-backend.js +4 -0
- package/dist/local-clink-backend.js.map +1 -1
- package/dist/package-info.d.ts +2 -0
- package/dist/package-info.js +18 -0
- package/dist/package-info.js.map +1 -0
- package/dist/parsers/codex-jsonl.js +48 -3
- package/dist/parsers/codex-jsonl.js.map +1 -1
- package/dist/parsers/extract.d.ts +10 -1
- package/dist/parsers/extract.js +11 -3
- package/dist/parsers/extract.js.map +1 -1
- package/dist/paths.d.ts +8 -0
- package/dist/paths.js +31 -43
- package/dist/paths.js.map +1 -1
- package/dist/pipeline.d.ts +51 -3
- package/dist/pipeline.js +264 -47
- package/dist/pipeline.js.map +1 -1
- package/dist/run-dir.d.ts +24 -0
- package/dist/run-dir.js +201 -2
- package/dist/run-dir.js.map +1 -1
- package/dist/runner.d.ts +13 -0
- package/dist/runner.js +184 -15
- package/dist/runner.js.map +1 -1
- package/dist/safety.d.ts +4 -4
- package/dist/safety.js +4 -4
- package/dist/schema.d.ts +7 -7
- package/dist/server.d.ts +2 -0
- package/dist/server.js +396 -24
- package/dist/server.js.map +1 -1
- package/dist/session-log-stream.d.ts +18 -0
- package/dist/session-log-stream.js +319 -0
- package/dist/session-log-stream.js.map +1 -0
- package/package.json +47 -5
- package/conf/adapters/gemini.json +0 -44
- package/conf/adapters/hapi/gemini.json +0 -47
- package/dist/artifacts.d.ts +0 -9
- package/dist/artifacts.js +0 -24
- package/dist/artifacts.js.map +0 -1
- package/dist/parsers/gemini-json.d.ts +0 -2
- package/dist/parsers/gemini-json.js +0 -72
- package/dist/parsers/gemini-json.js.map +0 -1
|
@@ -0,0 +1,675 @@
|
|
|
1
|
+
export function buildFileCodemap(relPath, content) {
|
|
2
|
+
const language = languageForPath(relPath);
|
|
3
|
+
if (language === "unknown") {
|
|
4
|
+
return { path: relPath, language, symbols: [] };
|
|
5
|
+
}
|
|
6
|
+
// Coordinates are relative to the content passed here. Callers that pass
|
|
7
|
+
// selected slices remap these lines back to source coordinates via
|
|
8
|
+
// remapCodemapToSourceCoordinates (bundle.ts does this using each file's
|
|
9
|
+
// selection ranges).
|
|
10
|
+
const lines = content.split(/\r?\n/);
|
|
11
|
+
return {
|
|
12
|
+
path: relPath,
|
|
13
|
+
language,
|
|
14
|
+
symbols: language === "py"
|
|
15
|
+
? scanPython(lines)
|
|
16
|
+
: scanBraceLanguage(lines, language),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
// Remaps a codemap's content-relative symbol lines back to source-file
|
|
20
|
+
// coordinates. The rendered content at 1-based line i corresponds to source
|
|
21
|
+
// line = expand(ranges)[i-1], where expand flattens each range's
|
|
22
|
+
// start_line..end_line in order. Out-of-bounds indices clamp to the last valid
|
|
23
|
+
// source line. Empty ranges leave the map unchanged. Pure: input is not mutated.
|
|
24
|
+
export function remapCodemapToSourceCoordinates(map, ranges) {
|
|
25
|
+
if (ranges.length === 0) {
|
|
26
|
+
return map;
|
|
27
|
+
}
|
|
28
|
+
const sourceLines = [];
|
|
29
|
+
for (const range of ranges) {
|
|
30
|
+
for (let line = range.start_line; line <= range.end_line; line += 1) {
|
|
31
|
+
sourceLines.push(line);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (sourceLines.length === 0) {
|
|
35
|
+
return map;
|
|
36
|
+
}
|
|
37
|
+
const lastSourceLine = sourceLines[sourceLines.length - 1];
|
|
38
|
+
const toSource = (renderedLine) => {
|
|
39
|
+
const index = renderedLine - 1;
|
|
40
|
+
if (index < 0) {
|
|
41
|
+
return sourceLines[0];
|
|
42
|
+
}
|
|
43
|
+
return sourceLines[index] ?? lastSourceLine;
|
|
44
|
+
};
|
|
45
|
+
return {
|
|
46
|
+
...map,
|
|
47
|
+
symbols: map.symbols.map((symbol) => ({
|
|
48
|
+
...symbol,
|
|
49
|
+
start_line: toSource(symbol.start_line),
|
|
50
|
+
end_line: toSource(symbol.end_line),
|
|
51
|
+
})),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export function renderCodemapJsonl(maps) {
|
|
55
|
+
if (maps.length === 0) {
|
|
56
|
+
return "";
|
|
57
|
+
}
|
|
58
|
+
return `${maps.map((map) => JSON.stringify(map)).join("\n")}\n`;
|
|
59
|
+
}
|
|
60
|
+
function languageForPath(path) {
|
|
61
|
+
const lowerPath = path.toLowerCase();
|
|
62
|
+
if (/\.(ts|tsx|mts|cts)$/.test(lowerPath)) {
|
|
63
|
+
return "ts";
|
|
64
|
+
}
|
|
65
|
+
if (/\.(js|jsx|mjs|cjs)$/.test(lowerPath)) {
|
|
66
|
+
return "js";
|
|
67
|
+
}
|
|
68
|
+
if (lowerPath.endsWith(".py")) {
|
|
69
|
+
return "py";
|
|
70
|
+
}
|
|
71
|
+
if (lowerPath.endsWith(".rs")) {
|
|
72
|
+
return "rust";
|
|
73
|
+
}
|
|
74
|
+
return "unknown";
|
|
75
|
+
}
|
|
76
|
+
function scanBraceLanguage(lines, language) {
|
|
77
|
+
const symbols = [];
|
|
78
|
+
let previousSignificant = "";
|
|
79
|
+
const topLevelDepths = language === "rust" ? [] : braceDepthBeforeLines(lines);
|
|
80
|
+
lines.forEach((line, index) => {
|
|
81
|
+
const lineNumber = index + 1;
|
|
82
|
+
const trimmed = line.trim();
|
|
83
|
+
if (trimmed.length === 0) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (language === "rust") {
|
|
87
|
+
const rustSymbol = rustSymbolForLine(trimmed, previousSignificant);
|
|
88
|
+
if (rustSymbol != null) {
|
|
89
|
+
const endLine = endLineForBraces(lines, index);
|
|
90
|
+
symbols.push({
|
|
91
|
+
kind: rustSymbol.kind,
|
|
92
|
+
name: rustSymbol.name,
|
|
93
|
+
start_line: lineNumber,
|
|
94
|
+
end_line: endLine,
|
|
95
|
+
scanner: "regex",
|
|
96
|
+
confidence: "low",
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
for (const symbol of tsJsSymbolsForLine(trimmed)) {
|
|
102
|
+
const topLevelSignature = topLevelDepths[index] === 0
|
|
103
|
+
? TopLevelScanner.signatureFor(lines, index, symbol)
|
|
104
|
+
: undefined;
|
|
105
|
+
const blockStartIndex = topLevelSignature?.bodyStartLineOffset == null
|
|
106
|
+
? index
|
|
107
|
+
: index + topLevelSignature.bodyStartLineOffset;
|
|
108
|
+
const endLine = symbol.kind === "import" || symbol.kind === "export"
|
|
109
|
+
? lineNumber
|
|
110
|
+
: endLineForBraces(lines, blockStartIndex);
|
|
111
|
+
const scanner = topLevelSignature == null
|
|
112
|
+
? "regex"
|
|
113
|
+
: "toplevel";
|
|
114
|
+
const confidence = topLevelSignature == null
|
|
115
|
+
? "low"
|
|
116
|
+
: "high";
|
|
117
|
+
symbols.push({
|
|
118
|
+
kind: symbol.kind,
|
|
119
|
+
name: symbol.name,
|
|
120
|
+
start_line: lineNumber,
|
|
121
|
+
end_line: endLine,
|
|
122
|
+
scanner,
|
|
123
|
+
confidence,
|
|
124
|
+
...(topLevelSignature?.signature != null
|
|
125
|
+
? { signature: topLevelSignature.signature }
|
|
126
|
+
: {}),
|
|
127
|
+
...(topLevelSignature?.exported === true || symbol.exported === true
|
|
128
|
+
? { exported: true }
|
|
129
|
+
: {}),
|
|
130
|
+
...(symbol.container != null ? { container: symbol.container } : {}),
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
previousSignificant = trimmed;
|
|
135
|
+
});
|
|
136
|
+
return symbols;
|
|
137
|
+
}
|
|
138
|
+
function tsJsSymbolsForLine(line) {
|
|
139
|
+
const symbols = [];
|
|
140
|
+
const importMatch = line.match(/^import(?:\s+type)?(?:\s+[\s\S]*?\s+from)?\s+["']([^"']+)["'];?$/);
|
|
141
|
+
if (importMatch?.[1] != null) {
|
|
142
|
+
symbols.push({ kind: "import", name: importMatch[1] });
|
|
143
|
+
return symbols;
|
|
144
|
+
}
|
|
145
|
+
const namedExportMatch = line.match(/^export\s*\{([^}]+)\}/);
|
|
146
|
+
if (namedExportMatch?.[1] != null) {
|
|
147
|
+
for (const name of splitExportNames(namedExportMatch[1])) {
|
|
148
|
+
symbols.push({ kind: "export", name });
|
|
149
|
+
}
|
|
150
|
+
return symbols;
|
|
151
|
+
}
|
|
152
|
+
const requireMatch = line.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*require\(["'][^"']+["']\)/);
|
|
153
|
+
if (requireMatch?.[1] != null) {
|
|
154
|
+
symbols.push({ kind: "import", name: requireMatch[1] });
|
|
155
|
+
return symbols;
|
|
156
|
+
}
|
|
157
|
+
const testMatch = line.match(/^(?:describe|it|test)\s*\(\s*["'`]([^"'`]+)["'`]/);
|
|
158
|
+
if (testMatch?.[1] != null) {
|
|
159
|
+
symbols.push({ kind: "test", name: testMatch[1] });
|
|
160
|
+
return symbols;
|
|
161
|
+
}
|
|
162
|
+
const functionMatch = line.match(/^(?:export\s+(?:default\s+)?)?(?:async\s+)?function\s+([A-Za-z_$][\w$]*)/);
|
|
163
|
+
if (functionMatch?.[1] != null) {
|
|
164
|
+
symbols.push({
|
|
165
|
+
kind: "function",
|
|
166
|
+
name: functionMatch[1],
|
|
167
|
+
...(isExportedTsJsLine(line) ? { exported: true } : {}),
|
|
168
|
+
});
|
|
169
|
+
return symbols;
|
|
170
|
+
}
|
|
171
|
+
// Recognizes arrow-function value declarations, including TS forms with a
|
|
172
|
+
// return-type annotation between the param list and `=>` (e.g.
|
|
173
|
+
// `const f = (x: T): R => …`, `async (x): Promise<void> =>`, and the simple
|
|
174
|
+
// generic `<T>(x: T): T =>`). The optional return-type segment deliberately
|
|
175
|
+
// EXCLUDES `=` from its char class so it stops before `=>` and never swallows
|
|
176
|
+
// the arrow; an exotic function-type return (e.g. `(): () => void =>`) stays
|
|
177
|
+
// best-effort. It still requires a trailing `=>`, so plain assignments
|
|
178
|
+
// (`const X = 5`) and call expressions (`const c = make()`) do not match here
|
|
179
|
+
// and fall through to exportValueMatch / callExpressionFunctionMatch.
|
|
180
|
+
const arrowFunctionMatch = line.match(/^(?:export\s+)?(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:async\s*)?(?:<[^>]*>\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*(?::\s*[A-Za-z_$0-9.<>,\[\]{}|&'"\s()]+?\s*)?=>/);
|
|
181
|
+
if (arrowFunctionMatch?.[1] != null) {
|
|
182
|
+
symbols.push({
|
|
183
|
+
kind: "function",
|
|
184
|
+
name: arrowFunctionMatch[1],
|
|
185
|
+
...(isExportedTsJsLine(line) ? { exported: true } : {}),
|
|
186
|
+
});
|
|
187
|
+
return symbols;
|
|
188
|
+
}
|
|
189
|
+
const callExpressionFunctionMatch = line.match(/^(?:export\s+)?(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:[A-Za-z_$][\w$]*\.)?[A-Za-z_$][\w$]*\s*\(/);
|
|
190
|
+
if (callExpressionFunctionMatch?.[1] != null) {
|
|
191
|
+
symbols.push({
|
|
192
|
+
kind: "function",
|
|
193
|
+
name: callExpressionFunctionMatch[1],
|
|
194
|
+
...(isExportedTsJsLine(line) ? { exported: true } : {}),
|
|
195
|
+
});
|
|
196
|
+
return symbols;
|
|
197
|
+
}
|
|
198
|
+
const classMatch = line.match(/^(?:export\s+(?:default\s+)?)?class\s+([A-Za-z_$][\w$]*)/);
|
|
199
|
+
if (classMatch?.[1] != null) {
|
|
200
|
+
symbols.push({
|
|
201
|
+
kind: "class",
|
|
202
|
+
name: classMatch[1],
|
|
203
|
+
...(isExportedTsJsLine(line) ? { exported: true } : {}),
|
|
204
|
+
});
|
|
205
|
+
return symbols;
|
|
206
|
+
}
|
|
207
|
+
const interfaceMatch = line.match(/^(?:export\s+)?interface\s+([A-Za-z_$][\w$]*)/);
|
|
208
|
+
if (interfaceMatch?.[1] != null) {
|
|
209
|
+
symbols.push({
|
|
210
|
+
kind: "interface",
|
|
211
|
+
name: interfaceMatch[1],
|
|
212
|
+
...(isExportedTsJsLine(line) ? { exported: true } : {}),
|
|
213
|
+
});
|
|
214
|
+
return symbols;
|
|
215
|
+
}
|
|
216
|
+
const typeMatch = line.match(/^(?:export\s+)?type\s+([A-Za-z_$][\w$]*)/);
|
|
217
|
+
if (typeMatch?.[1] != null) {
|
|
218
|
+
symbols.push({
|
|
219
|
+
kind: "type",
|
|
220
|
+
name: typeMatch[1],
|
|
221
|
+
...(isExportedTsJsLine(line) ? { exported: true } : {}),
|
|
222
|
+
});
|
|
223
|
+
return symbols;
|
|
224
|
+
}
|
|
225
|
+
const exportValueMatch = line.match(/^export\s+(?:default\s+)?(?:const|let|var)\s+([A-Za-z_$][\w$]*)/);
|
|
226
|
+
if (exportValueMatch?.[1] != null) {
|
|
227
|
+
symbols.push({ kind: "export", name: exportValueMatch[1] });
|
|
228
|
+
return symbols;
|
|
229
|
+
}
|
|
230
|
+
const defaultExportMatch = line.match(/^export\s+default\s+([A-Za-z_$][\w$]*)/);
|
|
231
|
+
if (defaultExportMatch?.[1] != null) {
|
|
232
|
+
symbols.push({ kind: "export", name: defaultExportMatch[1] });
|
|
233
|
+
}
|
|
234
|
+
return symbols;
|
|
235
|
+
}
|
|
236
|
+
function rustSymbolForLine(line, previousSignificant) {
|
|
237
|
+
const pubUseMatch = line.match(/^pub\s+use\s+([^;]+);/);
|
|
238
|
+
if (pubUseMatch?.[1] != null) {
|
|
239
|
+
return { kind: "export", name: pubUseMatch[1].trim() };
|
|
240
|
+
}
|
|
241
|
+
const useMatch = line.match(/^use\s+([^;]+);/);
|
|
242
|
+
if (useMatch?.[1] != null) {
|
|
243
|
+
return { kind: "import", name: useMatch[1].trim() };
|
|
244
|
+
}
|
|
245
|
+
const functionMatch = line.match(/^(?:pub(?:\([^)]*\))?\s+)?(?:async\s+)?fn\s+([A-Za-z_]\w*)/);
|
|
246
|
+
if (functionMatch?.[1] != null) {
|
|
247
|
+
return {
|
|
248
|
+
kind: previousSignificant === "#[test]" ? "test" : "function",
|
|
249
|
+
name: functionMatch[1],
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
const typeMatch = line.match(/^(?:pub(?:\([^)]*\))?\s+)?(?:struct|enum|type)\s+([A-Za-z_]\w*)/);
|
|
253
|
+
if (typeMatch?.[1] != null) {
|
|
254
|
+
return { kind: "type", name: typeMatch[1] };
|
|
255
|
+
}
|
|
256
|
+
const traitMatch = line.match(/^(?:pub(?:\([^)]*\))?\s+)?trait\s+([A-Za-z_]\w*)/);
|
|
257
|
+
if (traitMatch?.[1] != null) {
|
|
258
|
+
return { kind: "interface", name: traitMatch[1] };
|
|
259
|
+
}
|
|
260
|
+
return undefined;
|
|
261
|
+
}
|
|
262
|
+
function scanPython(lines) {
|
|
263
|
+
const symbols = [];
|
|
264
|
+
lines.forEach((line, index) => {
|
|
265
|
+
const lineNumber = index + 1;
|
|
266
|
+
const trimmed = line.trim();
|
|
267
|
+
if (trimmed.length === 0) {
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
const importMatch = trimmed.match(/^from\s+([\w.]+)\s+import\s+(.+)$/)
|
|
271
|
+
?? trimmed.match(/^import\s+(.+)$/);
|
|
272
|
+
if (importMatch != null) {
|
|
273
|
+
const moduleName = importMatch[1] ?? "";
|
|
274
|
+
const importedName = importMatch[2];
|
|
275
|
+
symbols.push({
|
|
276
|
+
kind: "import",
|
|
277
|
+
name: importedName == null
|
|
278
|
+
? moduleName.trim()
|
|
279
|
+
: `${moduleName.trim()}:${importedName.trim()}`,
|
|
280
|
+
start_line: lineNumber,
|
|
281
|
+
end_line: lineNumber,
|
|
282
|
+
scanner: "regex",
|
|
283
|
+
confidence: "low",
|
|
284
|
+
});
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
const classMatch = trimmed.match(/^class\s+([A-Za-z_]\w*)/);
|
|
288
|
+
if (classMatch?.[1] != null) {
|
|
289
|
+
symbols.push({
|
|
290
|
+
kind: "class",
|
|
291
|
+
name: classMatch[1],
|
|
292
|
+
start_line: lineNumber,
|
|
293
|
+
end_line: endLineForIndentedBlock(lines, index),
|
|
294
|
+
scanner: "regex",
|
|
295
|
+
confidence: "low",
|
|
296
|
+
});
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
const functionMatch = trimmed.match(/^(?:async\s+)?def\s+([A-Za-z_]\w*)/);
|
|
300
|
+
if (functionMatch?.[1] != null) {
|
|
301
|
+
symbols.push({
|
|
302
|
+
kind: functionMatch[1].startsWith("test_") ? "test" : "function",
|
|
303
|
+
name: functionMatch[1],
|
|
304
|
+
start_line: lineNumber,
|
|
305
|
+
end_line: endLineForIndentedBlock(lines, index),
|
|
306
|
+
scanner: "regex",
|
|
307
|
+
confidence: "low",
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
return symbols;
|
|
312
|
+
}
|
|
313
|
+
function isExportedTsJsLine(line) {
|
|
314
|
+
return /^export\b/.test(line);
|
|
315
|
+
}
|
|
316
|
+
class TopLevelScanner {
|
|
317
|
+
static signatureFor(lines, startIndex, symbol) {
|
|
318
|
+
if (symbol.kind !== "function") {
|
|
319
|
+
return undefined;
|
|
320
|
+
}
|
|
321
|
+
const text = declarationWindow(lines, startIndex);
|
|
322
|
+
return parseFunctionDeclaration(text, symbol.name)
|
|
323
|
+
?? parseArrowDeclaration(text, symbol.name);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
function declarationWindow(lines, startIndex) {
|
|
327
|
+
const maxLines = 80;
|
|
328
|
+
const maxChars = 12_000;
|
|
329
|
+
return lines
|
|
330
|
+
.slice(startIndex, Math.min(lines.length, startIndex + maxLines))
|
|
331
|
+
.join("\n")
|
|
332
|
+
.slice(0, maxChars);
|
|
333
|
+
}
|
|
334
|
+
function parseFunctionDeclaration(text, name) {
|
|
335
|
+
const match = new RegExp(`\\bfunction\\s+${escapeRegExp(name)}\\b`).exec(text);
|
|
336
|
+
if (match == null) {
|
|
337
|
+
return undefined;
|
|
338
|
+
}
|
|
339
|
+
let cursor = match.index + match[0].length;
|
|
340
|
+
const generic = readOptionalBalanced(text, cursor, "<", ">");
|
|
341
|
+
if (generic != null) {
|
|
342
|
+
cursor = generic.end + 1;
|
|
343
|
+
}
|
|
344
|
+
cursor = skipWhitespace(text, cursor);
|
|
345
|
+
if (text[cursor] !== "(") {
|
|
346
|
+
return undefined;
|
|
347
|
+
}
|
|
348
|
+
const parameters = readBalanced(text, cursor, "(", ")");
|
|
349
|
+
if (parameters == null) {
|
|
350
|
+
return undefined;
|
|
351
|
+
}
|
|
352
|
+
cursor = skipWhitespace(text, parameters.end + 1);
|
|
353
|
+
const returnType = text[cursor] === ":"
|
|
354
|
+
? readReturnType(text, cursor, ["{", ";"])
|
|
355
|
+
: undefined;
|
|
356
|
+
const bodyStartIndex = findBodyStartIndex(text, returnType == null ? cursor : cursor + returnType.length);
|
|
357
|
+
const signature = normalizeSignatureText(`${name}${generic?.text ?? ""}${parameters.text}${returnType ?? ""}`);
|
|
358
|
+
return signature.length === 0
|
|
359
|
+
? undefined
|
|
360
|
+
: {
|
|
361
|
+
signature,
|
|
362
|
+
...(bodyStartIndex != null
|
|
363
|
+
? { bodyStartLineOffset: lineOffsetForIndex(text, bodyStartIndex) }
|
|
364
|
+
: {}),
|
|
365
|
+
...(isExportedTsJsLine(text.trimStart()) ? { exported: true } : {}),
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
function parseArrowDeclaration(text, name) {
|
|
369
|
+
const match = new RegExp(`^(?:export\\s+)?(?:const|let|var)\\s+${escapeRegExp(name)}\\b`).exec(text.trimStart());
|
|
370
|
+
if (match == null) {
|
|
371
|
+
return undefined;
|
|
372
|
+
}
|
|
373
|
+
const leadingTrimmed = text.trimStart();
|
|
374
|
+
const equalsIndex = leadingTrimmed.indexOf("=", match[0].length);
|
|
375
|
+
if (equalsIndex < 0) {
|
|
376
|
+
return undefined;
|
|
377
|
+
}
|
|
378
|
+
let cursor = skipWhitespace(leadingTrimmed, equalsIndex + 1);
|
|
379
|
+
if (leadingTrimmed.startsWith("async", cursor)) {
|
|
380
|
+
cursor = skipWhitespace(leadingTrimmed, cursor + "async".length);
|
|
381
|
+
}
|
|
382
|
+
const generic = readOptionalBalanced(leadingTrimmed, cursor, "<", ">");
|
|
383
|
+
if (generic != null) {
|
|
384
|
+
cursor = skipWhitespace(leadingTrimmed, generic.end + 1);
|
|
385
|
+
}
|
|
386
|
+
let parameters;
|
|
387
|
+
if (leadingTrimmed[cursor] === "(") {
|
|
388
|
+
const balancedParameters = readBalanced(leadingTrimmed, cursor, "(", ")");
|
|
389
|
+
if (balancedParameters == null) {
|
|
390
|
+
return undefined;
|
|
391
|
+
}
|
|
392
|
+
parameters = balancedParameters.text;
|
|
393
|
+
cursor = skipWhitespace(leadingTrimmed, balancedParameters.end + 1);
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
const parameterMatch = /^[A-Za-z_$][\w$]*/.exec(leadingTrimmed.slice(cursor));
|
|
397
|
+
if (parameterMatch?.[0] == null) {
|
|
398
|
+
return undefined;
|
|
399
|
+
}
|
|
400
|
+
parameters = `(${parameterMatch[0]})`;
|
|
401
|
+
cursor = skipWhitespace(leadingTrimmed, cursor + parameterMatch[0].length);
|
|
402
|
+
}
|
|
403
|
+
const returnType = leadingTrimmed[cursor] === ":"
|
|
404
|
+
? readReturnType(leadingTrimmed, cursor, ["=>"])
|
|
405
|
+
: undefined;
|
|
406
|
+
const arrowIndex = findTopLevelToken(leadingTrimmed, returnType == null ? cursor : cursor + returnType.length, "=>");
|
|
407
|
+
if (arrowIndex == null) {
|
|
408
|
+
return undefined;
|
|
409
|
+
}
|
|
410
|
+
const bodyStartIndex = findBodyStartIndex(leadingTrimmed, arrowIndex + 2);
|
|
411
|
+
const signature = normalizeSignatureText(`${name}${generic?.text ?? ""}${parameters}${returnType ?? ""}`);
|
|
412
|
+
return signature.length === 0
|
|
413
|
+
? undefined
|
|
414
|
+
: {
|
|
415
|
+
signature,
|
|
416
|
+
...(bodyStartIndex != null
|
|
417
|
+
? { bodyStartLineOffset: lineOffsetForIndex(leadingTrimmed, bodyStartIndex) }
|
|
418
|
+
: {}),
|
|
419
|
+
...(isExportedTsJsLine(leadingTrimmed) ? { exported: true } : {}),
|
|
420
|
+
};
|
|
421
|
+
}
|
|
422
|
+
function readOptionalBalanced(text, cursor, open, close) {
|
|
423
|
+
const start = skipWhitespace(text, cursor);
|
|
424
|
+
if (text[start] !== open) {
|
|
425
|
+
return undefined;
|
|
426
|
+
}
|
|
427
|
+
return readBalanced(text, start, open, close);
|
|
428
|
+
}
|
|
429
|
+
function readBalanced(text, start, open, close) {
|
|
430
|
+
const depths = { paren: 0, square: 0, brace: 0, angle: 0 };
|
|
431
|
+
const openKey = bracketKey(open);
|
|
432
|
+
const closeKey = bracketKey(close);
|
|
433
|
+
depths[openKey] = 1;
|
|
434
|
+
let quote;
|
|
435
|
+
for (let index = start + 1; index < text.length; index += 1) {
|
|
436
|
+
const char = text[index];
|
|
437
|
+
const previous = text[index - 1];
|
|
438
|
+
if (char == null) {
|
|
439
|
+
return undefined;
|
|
440
|
+
}
|
|
441
|
+
if (quote != null) {
|
|
442
|
+
if (char === quote && previous !== "\\") {
|
|
443
|
+
quote = undefined;
|
|
444
|
+
}
|
|
445
|
+
continue;
|
|
446
|
+
}
|
|
447
|
+
if (char === "\"" || char === "'" || char === "`") {
|
|
448
|
+
quote = char;
|
|
449
|
+
continue;
|
|
450
|
+
}
|
|
451
|
+
updateDepths(depths, char, previous);
|
|
452
|
+
if (char === close && depths[closeKey] === 0) {
|
|
453
|
+
return { text: text.slice(start, index + 1), end: index };
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
return undefined;
|
|
457
|
+
}
|
|
458
|
+
function readReturnType(text, colonIndex, terminators) {
|
|
459
|
+
const depths = { paren: 0, square: 0, brace: 0, angle: 0 };
|
|
460
|
+
let quote;
|
|
461
|
+
for (let index = colonIndex + 1; index < text.length; index += 1) {
|
|
462
|
+
const char = text[index];
|
|
463
|
+
const previous = text[index - 1];
|
|
464
|
+
if (char == null) {
|
|
465
|
+
break;
|
|
466
|
+
}
|
|
467
|
+
if (quote != null) {
|
|
468
|
+
if (char === quote && previous !== "\\") {
|
|
469
|
+
quote = undefined;
|
|
470
|
+
}
|
|
471
|
+
continue;
|
|
472
|
+
}
|
|
473
|
+
if (char === "\"" || char === "'" || char === "`") {
|
|
474
|
+
quote = char;
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
477
|
+
if (allDepthsZero(depths) && matchesTerminator(text, index, terminators)) {
|
|
478
|
+
if (char !== "{" || isReturnTypeObjectStart(text, colonIndex, index)) {
|
|
479
|
+
updateDepths(depths, char, previous);
|
|
480
|
+
continue;
|
|
481
|
+
}
|
|
482
|
+
return text.slice(colonIndex, index).trimEnd();
|
|
483
|
+
}
|
|
484
|
+
updateDepths(depths, char, previous);
|
|
485
|
+
}
|
|
486
|
+
const raw = text.slice(colonIndex).trimEnd();
|
|
487
|
+
return raw.length === 0 ? undefined : raw;
|
|
488
|
+
}
|
|
489
|
+
function findTopLevelToken(text, start, token) {
|
|
490
|
+
const depths = { paren: 0, square: 0, brace: 0, angle: 0 };
|
|
491
|
+
let quote;
|
|
492
|
+
for (let index = start; index < text.length; index += 1) {
|
|
493
|
+
const char = text[index];
|
|
494
|
+
const previous = text[index - 1];
|
|
495
|
+
if (char == null) {
|
|
496
|
+
return undefined;
|
|
497
|
+
}
|
|
498
|
+
if (quote != null) {
|
|
499
|
+
if (char === quote && previous !== "\\") {
|
|
500
|
+
quote = undefined;
|
|
501
|
+
}
|
|
502
|
+
continue;
|
|
503
|
+
}
|
|
504
|
+
if (char === "\"" || char === "'" || char === "`") {
|
|
505
|
+
quote = char;
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
if (allDepthsZero(depths) && text.startsWith(token, index)) {
|
|
509
|
+
return index;
|
|
510
|
+
}
|
|
511
|
+
updateDepths(depths, char, previous);
|
|
512
|
+
}
|
|
513
|
+
return undefined;
|
|
514
|
+
}
|
|
515
|
+
function updateDepths(depths, char, previous) {
|
|
516
|
+
if (char === "(") {
|
|
517
|
+
depths.paren += 1;
|
|
518
|
+
}
|
|
519
|
+
else if (char === ")") {
|
|
520
|
+
depths.paren = Math.max(0, depths.paren - 1);
|
|
521
|
+
}
|
|
522
|
+
else if (char === "[") {
|
|
523
|
+
depths.square += 1;
|
|
524
|
+
}
|
|
525
|
+
else if (char === "]") {
|
|
526
|
+
depths.square = Math.max(0, depths.square - 1);
|
|
527
|
+
}
|
|
528
|
+
else if (char === "{") {
|
|
529
|
+
depths.brace += 1;
|
|
530
|
+
}
|
|
531
|
+
else if (char === "}") {
|
|
532
|
+
depths.brace = Math.max(0, depths.brace - 1);
|
|
533
|
+
}
|
|
534
|
+
else if (char === "<") {
|
|
535
|
+
depths.angle += 1;
|
|
536
|
+
}
|
|
537
|
+
else if (char === ">" && previous !== "=") {
|
|
538
|
+
depths.angle = Math.max(0, depths.angle - 1);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
function bracketKey(bracket) {
|
|
542
|
+
return bracket === "<" || bracket === ">" ? "angle" : "paren";
|
|
543
|
+
}
|
|
544
|
+
function allDepthsZero(depths) {
|
|
545
|
+
return depths.paren === 0
|
|
546
|
+
&& depths.square === 0
|
|
547
|
+
&& depths.brace === 0
|
|
548
|
+
&& depths.angle === 0;
|
|
549
|
+
}
|
|
550
|
+
function matchesTerminator(text, index, terminators) {
|
|
551
|
+
return terminators.some((terminator) => text.startsWith(terminator, index));
|
|
552
|
+
}
|
|
553
|
+
function isReturnTypeObjectStart(text, colonIndex, braceIndex) {
|
|
554
|
+
const rawType = text.slice(colonIndex + 1, braceIndex).trim();
|
|
555
|
+
if (rawType.length === 0) {
|
|
556
|
+
return true;
|
|
557
|
+
}
|
|
558
|
+
const previous = previousNonWhitespace(text, braceIndex - 1);
|
|
559
|
+
return previous != null && ":|&=,<([".includes(previous);
|
|
560
|
+
}
|
|
561
|
+
function previousNonWhitespace(text, start) {
|
|
562
|
+
for (let index = start; index >= 0; index -= 1) {
|
|
563
|
+
const char = text[index];
|
|
564
|
+
if (char != null && !/\s/.test(char)) {
|
|
565
|
+
return char;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
return undefined;
|
|
569
|
+
}
|
|
570
|
+
function findBodyStartIndex(text, start) {
|
|
571
|
+
const cursor = skipWhitespace(text, start);
|
|
572
|
+
return text[cursor] === "{" ? cursor : undefined;
|
|
573
|
+
}
|
|
574
|
+
function lineOffsetForIndex(text, targetIndex) {
|
|
575
|
+
let lineOffset = 0;
|
|
576
|
+
for (let index = 0; index < targetIndex; index += 1) {
|
|
577
|
+
if (text[index] === "\n") {
|
|
578
|
+
lineOffset += 1;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
return lineOffset;
|
|
582
|
+
}
|
|
583
|
+
function skipWhitespace(text, start) {
|
|
584
|
+
let cursor = start;
|
|
585
|
+
while (cursor < text.length && /\s/.test(text[cursor] ?? "")) {
|
|
586
|
+
cursor += 1;
|
|
587
|
+
}
|
|
588
|
+
return cursor;
|
|
589
|
+
}
|
|
590
|
+
function normalizeSignatureText(text) {
|
|
591
|
+
return text
|
|
592
|
+
.replace(/\s+/g, " ")
|
|
593
|
+
.replace(/<\s+/g, "<")
|
|
594
|
+
.replace(/\s+>/g, ">")
|
|
595
|
+
.replace(/,\s*\)/g, ")")
|
|
596
|
+
.replace(/\(\s+/g, "(")
|
|
597
|
+
.replace(/\s+\)/g, ")")
|
|
598
|
+
.trim();
|
|
599
|
+
}
|
|
600
|
+
function escapeRegExp(value) {
|
|
601
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
602
|
+
}
|
|
603
|
+
function braceDepthBeforeLines(lines) {
|
|
604
|
+
const depths = [];
|
|
605
|
+
let depth = 0;
|
|
606
|
+
for (const line of lines) {
|
|
607
|
+
depths.push(depth);
|
|
608
|
+
const stripped = stripQuotedText(line);
|
|
609
|
+
for (const char of stripped) {
|
|
610
|
+
if (char === "{") {
|
|
611
|
+
depth += 1;
|
|
612
|
+
}
|
|
613
|
+
else if (char === "}") {
|
|
614
|
+
depth = Math.max(0, depth - 1);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
return depths;
|
|
619
|
+
}
|
|
620
|
+
function splitExportNames(names) {
|
|
621
|
+
return names
|
|
622
|
+
.split(",")
|
|
623
|
+
.map((name) => name.trim())
|
|
624
|
+
.filter((name) => name.length > 0)
|
|
625
|
+
.map((name) => {
|
|
626
|
+
const aliasMatch = name.match(/\s+as\s+([A-Za-z_$][\w$]*)$/);
|
|
627
|
+
return aliasMatch?.[1] ?? name;
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
function endLineForBraces(lines, startIndex) {
|
|
631
|
+
let depth = 0;
|
|
632
|
+
let sawBrace = false;
|
|
633
|
+
for (let index = startIndex; index < lines.length; index += 1) {
|
|
634
|
+
const line = stripQuotedText(lines[index] ?? "");
|
|
635
|
+
for (const char of line) {
|
|
636
|
+
if (char === "{") {
|
|
637
|
+
depth += 1;
|
|
638
|
+
sawBrace = true;
|
|
639
|
+
}
|
|
640
|
+
else if (char === "}") {
|
|
641
|
+
depth -= 1;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
if (sawBrace && depth <= 0) {
|
|
645
|
+
return index + 1;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
return startIndex + 1;
|
|
649
|
+
}
|
|
650
|
+
function endLineForIndentedBlock(lines, startIndex) {
|
|
651
|
+
const startIndent = indentationOf(lines[startIndex] ?? "");
|
|
652
|
+
let lastLine = startIndex + 1;
|
|
653
|
+
for (let index = startIndex + 1; index < lines.length; index += 1) {
|
|
654
|
+
const line = lines[index] ?? "";
|
|
655
|
+
const trimmed = line.trim();
|
|
656
|
+
if (trimmed.length === 0 || trimmed.startsWith("#")) {
|
|
657
|
+
continue;
|
|
658
|
+
}
|
|
659
|
+
if (indentationOf(line) <= startIndent) {
|
|
660
|
+
break;
|
|
661
|
+
}
|
|
662
|
+
lastLine = index + 1;
|
|
663
|
+
}
|
|
664
|
+
return lastLine;
|
|
665
|
+
}
|
|
666
|
+
function indentationOf(line) {
|
|
667
|
+
const match = line.match(/^\s*/);
|
|
668
|
+
return match?.[0].length ?? 0;
|
|
669
|
+
}
|
|
670
|
+
function stripQuotedText(line) {
|
|
671
|
+
return line
|
|
672
|
+
.replace(/(["'`])(?:\\.|(?!\1).)*\1/g, "")
|
|
673
|
+
.replace(/\/\/.*$/, "");
|
|
674
|
+
}
|
|
675
|
+
//# sourceMappingURL=codemap.js.map
|