@ngockhoale/ukit 1.1.6
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 +179 -0
- package/LICENSE +21 -0
- package/README.md +189 -0
- package/bin/ukit +30 -0
- package/manifests/platform.full.yaml +1194 -0
- package/package.json +71 -0
- package/scripts/bug/triage.mjs +37 -0
- package/scripts/index/build-index.mjs +35 -0
- package/scripts/index/query-index.mjs +92 -0
- package/scripts/index/refresh-index.mjs +85 -0
- package/scripts/release/verify-release.mjs +56 -0
- package/src/bug/triageBug.js +123 -0
- package/src/cli/adapters.js +148 -0
- package/src/cli/commands/diff.js +51 -0
- package/src/cli/commands/doctor.js +125 -0
- package/src/cli/commands/indexArgs.js +73 -0
- package/src/cli/commands/indexTools.js +509 -0
- package/src/cli/commands/install.js +293 -0
- package/src/cli/commands/memory.js +126 -0
- package/src/cli/commands/status.js +8 -0
- package/src/cli/commands/uninstall.js +51 -0
- package/src/cli/index.js +109 -0
- package/src/context/detectProjectContext.js +49 -0
- package/src/context/detectProviders.js +12 -0
- package/src/core/applyPlan.js +89 -0
- package/src/core/buildPlan.js +228 -0
- package/src/core/compact/index.js +294 -0
- package/src/core/compact/threshold.js +936 -0
- package/src/core/diffPlan.js +73 -0
- package/src/core/ensureGitignore.js +117 -0
- package/src/core/fileOps.js +188 -0
- package/src/core/memory/hygiene.js +160 -0
- package/src/core/memory/index.js +2 -0
- package/src/core/memory/retrieval.js +476 -0
- package/src/core/memory/store.js +202 -0
- package/src/core/metadata.js +132 -0
- package/src/core/migrateLegacy.js +139 -0
- package/src/core/output/index.js +1309 -0
- package/src/core/paths.js +13 -0
- package/src/core/report.js +17 -0
- package/src/core/router/advisor.js +42 -0
- package/src/core/router/index.js +2 -0
- package/src/core/router/router.js +164 -0
- package/src/core/runInstallPipeline.js +365 -0
- package/src/core/runtimeConfig.js +190 -0
- package/src/core/runtimePaths.js +24 -0
- package/src/core/status.js +186 -0
- package/src/core/token/index.js +328 -0
- package/src/core/uninstall.js +246 -0
- package/src/core/validation/confidence.js +89 -0
- package/src/core/validation/index.js +2 -0
- package/src/core/validation/validator.js +165 -0
- package/src/index/buildIndex.js +1392 -0
- package/src/index/gitHooks.js +109 -0
- package/src/index/importResolution.js +377 -0
- package/src/index/languageTools.js +127 -0
- package/src/index/paths.js +27 -0
- package/src/index/queryIndex.js +637 -0
- package/src/index/relatedTests.js +237 -0
- package/src/index/resolveContext.js +345 -0
- package/src/index/routeCatalog.js +258 -0
- package/src/index/taskRouting.js +677 -0
- package/src/index/verificationPlan.js +437 -0
- package/src/manifest/loadManifest.js +22 -0
- package/src/manifest/selectItems.js +78 -0
- package/src/manifest/validateManifest.js +115 -0
- package/src/render/buildVariables.js +39 -0
- package/src/render/renderTemplate.js +44 -0
- package/src/stack/detectStack.js +213 -0
- package/templates/.claude/agents/bug-debugger.md +57 -0
- package/templates/.claude/agents/feature-implementer.md +55 -0
- package/templates/.claude/config/providers.md +25 -0
- package/templates/.claude/hooks/auto-allow-bash.sh +155 -0
- package/templates/.claude/hooks/auto-prune-bash.sh +75 -0
- package/templates/.claude/hooks/block-dangerous.sh +54 -0
- package/templates/.claude/hooks/compress-output.sh +17 -0
- package/templates/.claude/hooks/protect-files.sh +37 -0
- package/templates/.claude/hooks/reinject-context.sh +28 -0
- package/templates/.claude/hooks/session-start.md +13 -0
- package/templates/.claude/hooks/skill-router.sh +1681 -0
- package/templates/.claude/hooks/verification-guard.sh +271 -0
- package/templates/.claude/settings.json +144 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/mce/mc.xsd +75 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/templates/.claude/skills/_shared/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/templates/.claude/skills/_shared/ooxml/scripts/pack.py +159 -0
- package/templates/.claude/skills/_shared/ooxml/scripts/unpack.py +29 -0
- package/templates/.claude/skills/_shared/ooxml/scripts/validate.py +69 -0
- package/templates/.claude/skills/_shared/ooxml/scripts/validation/__init__.py +15 -0
- package/templates/.claude/skills/_shared/ooxml/scripts/validation/base.py +951 -0
- package/templates/.claude/skills/_shared/ooxml/scripts/validation/docx.py +274 -0
- package/templates/.claude/skills/_shared/ooxml/scripts/validation/pptx.py +315 -0
- package/templates/.claude/skills/_shared/ooxml/scripts/validation/redlining.py +279 -0
- package/templates/.claude/skills/backend-api/SKILL.md +26 -0
- package/templates/.claude/skills/canvas-design/LICENSE.txt +202 -0
- package/templates/.claude/skills/canvas-design/SKILL.md +130 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/BricolageGrotesque-Bold.ttf +0 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/BricolageGrotesque-OFL.txt +93 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/BricolageGrotesque-Regular.ttf +0 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/InstrumentSans-Bold.ttf +0 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/InstrumentSans-BoldItalic.ttf +0 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/InstrumentSans-Italic.ttf +0 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/InstrumentSans-OFL.txt +93 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/InstrumentSans-Regular.ttf +0 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/InstrumentSerif-Italic.ttf +0 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/InstrumentSerif-Regular.ttf +0 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/JetBrainsMono-Bold.ttf +0 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/JetBrainsMono-OFL.txt +93 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/JetBrainsMono-Regular.ttf +0 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/Lora-Bold.ttf +0 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/Lora-BoldItalic.ttf +0 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/Lora-Italic.ttf +0 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/Lora-OFL.txt +93 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/Lora-Regular.ttf +0 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/NothingYouCouldDo-OFL.txt +93 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/NothingYouCouldDo-Regular.ttf +0 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/Outfit-Bold.ttf +0 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/Outfit-OFL.txt +93 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/Outfit-Regular.ttf +0 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/Tektur-Medium.ttf +0 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/Tektur-OFL.txt +93 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/Tektur-Regular.ttf +0 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/YoungSerif-OFL.txt +93 -0
- package/templates/.claude/skills/canvas-design/canvas-fonts/YoungSerif-Regular.ttf +0 -0
- package/templates/.claude/skills/code-review/SKILL.md +97 -0
- package/templates/.claude/skills/debugging-toolkit/SKILL.md +156 -0
- package/templates/.claude/skills/delivery/SKILL.md +92 -0
- package/templates/.claude/skills/discover-security/SKILL.md +86 -0
- package/templates/.claude/skills/docker-packaging/SKILL.md +60 -0
- package/templates/.claude/skills/docs-manager/SKILL.md +465 -0
- package/templates/.claude/skills/docs-manager/init-project-docs.sh +70 -0
- package/templates/.claude/skills/docs-manager/templates/README.md.template +50 -0
- package/templates/.claude/skills/docs-manager/templates/agent-roles.md.template +24 -0
- package/templates/.claude/skills/docs-manager/templates/coding-conventions.md.template +28 -0
- package/templates/.claude/skills/docs-manager/templates/memory.md.template +30 -0
- package/templates/.claude/skills/docs-manager/templates/onboarding.md.template +20 -0
- package/templates/.claude/skills/docs-manager/templates/project.md.template +26 -0
- package/templates/.claude/skills/docs-quality/SKILL.md +148 -0
- package/templates/.claude/skills/docx/LICENSE.txt +30 -0
- package/templates/.claude/skills/docx/SKILL.md +197 -0
- package/templates/.claude/skills/docx/docx-js.md +350 -0
- package/templates/.claude/skills/docx/ooxml.md +610 -0
- package/templates/.claude/skills/docx/scripts/__init__.py +1 -0
- package/templates/.claude/skills/docx/scripts/document.py +1276 -0
- package/templates/.claude/skills/docx/scripts/templates/comments.xml +3 -0
- package/templates/.claude/skills/docx/scripts/templates/commentsExtended.xml +3 -0
- package/templates/.claude/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
- package/templates/.claude/skills/docx/scripts/templates/commentsIds.xml +3 -0
- package/templates/.claude/skills/docx/scripts/templates/people.xml +3 -0
- package/templates/.claude/skills/docx/scripts/utilities.py +374 -0
- package/templates/.claude/skills/duraone/SKILL.md +204 -0
- package/templates/.claude/skills/duraone/references/backend.md +636 -0
- package/templates/.claude/skills/duraone/references/frontend.md +1506 -0
- package/templates/.claude/skills/duraone/references/sql.md +631 -0
- package/templates/.claude/skills/duraone/references/workflow.md +520 -0
- package/templates/.claude/skills/executing-plans/SKILL.md +76 -0
- package/templates/.claude/skills/file-organizer/SKILL.md +433 -0
- package/templates/.claude/skills/frontend/SKILL.md +26 -0
- package/templates/.claude/skills/frontend-design/LICENSE.txt +177 -0
- package/templates/.claude/skills/frontend-design/SKILL.md +42 -0
- package/templates/.claude/skills/frontend-vue/SKILL.md +127 -0
- package/templates/.claude/skills/frontend-vue/components/Control/Box.vue +137 -0
- package/templates/.claude/skills/frontend-vue/components/Control/Button.vue +93 -0
- package/templates/.claude/skills/frontend-vue/components/Control/ButtonBar.vue +29 -0
- package/templates/.claude/skills/frontend-vue/components/Control/ButtonFloat.vue +62 -0
- package/templates/.claude/skills/frontend-vue/components/Control/CheckButton.vue +75 -0
- package/templates/.claude/skills/frontend-vue/components/Control/Checkbox.vue +58 -0
- package/templates/.claude/skills/frontend-vue/components/Control/Datetime.vue +148 -0
- package/templates/.claude/skills/frontend-vue/components/Control/Dropdownlist.vue +156 -0
- package/templates/.claude/skills/frontend-vue/components/Control/Input.vue +106 -0
- package/templates/.claude/skills/frontend-vue/components/Control/Label.vue +38 -0
- package/templates/.claude/skills/frontend-vue/components/Control/Master/BoxColumn.vue +24 -0
- package/templates/.claude/skills/frontend-vue/components/Control/Popup/Confirm.vue +33 -0
- package/templates/.claude/skills/frontend-vue/components/Control/Popup/Info.vue +32 -0
- package/templates/.claude/skills/frontend-vue/components/Control/Popup/ModalInfo.vue +39 -0
- package/templates/.claude/skills/frontend-vue/components/Control/Popup/Reject.vue +64 -0
- package/templates/.claude/skills/frontend-vue/components/Control/Tag.vue +82 -0
- package/templates/.claude/skills/frontend-vue/components/Control/Upload.vue +61 -0
- package/templates/.claude/skills/frontend-vue/components/ControlMobile/Dropdownlist.vue +103 -0
- package/templates/.claude/skills/frontend-vue/components/ControlMobile/PagingBar.vue +108 -0
- package/templates/.claude/skills/frontend-vue/components/ControlMobile/UploadImage.vue +137 -0
- package/templates/.claude/skills/frontend-vue/components/Grid/AG.vue +806 -0
- package/templates/.claude/skills/frontend-vue/components/Grid/AntTable.vue +253 -0
- package/templates/.claude/skills/frontend-vue/components/Grid/CustomDropdownEditor.vue +43 -0
- package/templates/.claude/skills/frontend-vue/components/Grid/CustomDropdownEditorEnable.vue +55 -0
- package/templates/.claude/skills/frontend-vue/components/Grid/HtmlTable.vue +40 -0
- package/templates/.claude/skills/frontend-vue/components/PDFViewer.vue +25 -0
- package/templates/.claude/skills/frontend-vue/components/Panel/FormView.vue +309 -0
- package/templates/.claude/skills/frontend-vue/components/Partial/Footer.vue +23 -0
- package/templates/.claude/skills/frontend-vue/components/Partial/Header.vue +265 -0
- package/templates/.claude/skills/frontend-vue/components/Partial/Sidebar.vue +122 -0
- package/templates/.claude/skills/frontend-vue/components/Template.vue +16 -0
- package/templates/.claude/skills/frontend-vue/components/View/Form.vue +89 -0
- package/templates/.claude/skills/frontend-vue/composables/indexDBStore.js +140 -0
- package/templates/.claude/skills/frontend-vue/composables/masterApi.js +362 -0
- package/templates/.claude/skills/frontend-vue/composables/state.js +578 -0
- package/templates/.claude/skills/frontend-vue/composables/useRequest.js +221 -0
- package/templates/.claude/skills/frontend-vue/composables/useSession.js +179 -0
- package/templates/.claude/skills/frontend-vue/composables/useTranslation.js +54 -0
- package/templates/.claude/skills/frontend-vue/composables/useWebSocket.js +257 -0
- package/templates/.claude/skills/frontend-vue/composables/userObj.js +111 -0
- package/templates/.claude/skills/frontend-vue/composables/utils.js +322 -0
- package/templates/.claude/skills/frontend-vue/reference/composables-example.vue +320 -0
- package/templates/.claude/skills/frontend-vue/reference/form-example.vue +183 -0
- package/templates/.claude/skills/frontend-vue/reference/grid-example.vue +147 -0
- package/templates/.claude/skills/frontend-vue/reference/masterdata-example/[id].vue +106 -0
- package/templates/.claude/skills/frontend-vue/reference/masterdata-example/index.vue +58 -0
- package/templates/.claude/skills/frontend-vue/reference/popup-example.vue +159 -0
- package/templates/.claude/skills/pdf/LICENSE.txt +30 -0
- package/templates/.claude/skills/pdf/SKILL.md +294 -0
- package/templates/.claude/skills/pdf/forms.md +205 -0
- package/templates/.claude/skills/pdf/reference.md +612 -0
- package/templates/.claude/skills/pdf/scripts/check_bounding_boxes.py +70 -0
- package/templates/.claude/skills/pdf/scripts/check_bounding_boxes_test.py +226 -0
- package/templates/.claude/skills/pdf/scripts/check_fillable_fields.py +12 -0
- package/templates/.claude/skills/pdf/scripts/convert_pdf_to_images.py +35 -0
- package/templates/.claude/skills/pdf/scripts/create_validation_image.py +41 -0
- package/templates/.claude/skills/pdf/scripts/extract_form_field_info.py +152 -0
- package/templates/.claude/skills/pdf/scripts/fill_fillable_fields.py +114 -0
- package/templates/.claude/skills/pdf/scripts/fill_pdf_form_with_annotations.py +108 -0
- package/templates/.claude/skills/pdf-processing/SKILL.md +107 -0
- package/templates/.claude/skills/pdf-processing-pro/FORMS.md +610 -0
- package/templates/.claude/skills/pdf-processing-pro/OCR.md +137 -0
- package/templates/.claude/skills/pdf-processing-pro/SKILL.md +296 -0
- package/templates/.claude/skills/pdf-processing-pro/TABLES.md +626 -0
- package/templates/.claude/skills/pdf-processing-pro/scripts/analyze_form.py +307 -0
- package/templates/.claude/skills/postgres/SKILL.md +69 -0
- package/templates/.claude/skills/postgres/reference/fn_get_examples.sql +208 -0
- package/templates/.claude/skills/postgres/reference/fn_rpt_examples.sql +239 -0
- package/templates/.claude/skills/postgres/reference/utility_functions.sql +94 -0
- package/templates/.claude/skills/pptx/LICENSE.txt +30 -0
- package/templates/.claude/skills/pptx/SKILL.md +484 -0
- package/templates/.claude/skills/pptx/html2pptx.md +625 -0
- package/templates/.claude/skills/pptx/ooxml.md +427 -0
- package/templates/.claude/skills/pptx/scripts/html2pptx.js +979 -0
- package/templates/.claude/skills/pptx/scripts/inventory.py +1020 -0
- package/templates/.claude/skills/pptx/scripts/rearrange.py +231 -0
- package/templates/.claude/skills/pptx/scripts/replace.py +385 -0
- package/templates/.claude/skills/pptx/scripts/thumbnail.py +450 -0
- package/templates/.claude/skills/repo-maintenance/SKILL.md +97 -0
- package/templates/.claude/skills/research/EXAMPLES.md +434 -0
- package/templates/.claude/skills/research/REFERENCE.md +399 -0
- package/templates/.claude/skills/research/SKILL.md +136 -0
- package/templates/.claude/skills/root-cause-tracing/SKILL.md +174 -0
- package/templates/.claude/skills/root-cause-tracing/find-polluter.sh +63 -0
- package/templates/.claude/skills/sharing-skills/SKILL.md +194 -0
- package/templates/.claude/skills/sql-optimization-patterns/SKILL.md +493 -0
- package/templates/.claude/skills/subagent-driven-development/SKILL.md +189 -0
- package/templates/.claude/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/templates/.claude/skills/systematic-debugging/SKILL.md +295 -0
- package/templates/.claude/skills/systematic-debugging/test-academic.md +14 -0
- package/templates/.claude/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/templates/.claude/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/templates/.claude/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/templates/.claude/skills/test-driven-development/SKILL.md +364 -0
- package/templates/.claude/skills/testing-anti-patterns/SKILL.md +302 -0
- package/templates/.claude/skills/testing-quality/SKILL.md +97 -0
- package/templates/.claude/skills/verification-before-completion/SKILL.md +139 -0
- package/templates/.claude/skills/webapp-testing/LICENSE.txt +202 -0
- package/templates/.claude/skills/webapp-testing/SKILL.md +96 -0
- package/templates/.claude/skills/webapp-testing/examples/console_logging.py +35 -0
- package/templates/.claude/skills/webapp-testing/examples/element_discovery.py +40 -0
- package/templates/.claude/skills/webapp-testing/examples/static_html_automation.py +33 -0
- package/templates/.claude/skills/webapp-testing/scripts/with_server.py +106 -0
- package/templates/.claude/ukit/index/build-index.mjs +28 -0
- package/templates/.claude/ukit/index/cache-utils.mjs +140 -0
- package/templates/.claude/ukit/index/lib/index-core.mjs +2800 -0
- package/templates/.claude/ukit/index/query-index.mjs +150 -0
- package/templates/.claude/ukit/index/refresh-index.mjs +57 -0
- package/templates/.claude/ukit/index/reset-auto-permissions.mjs +76 -0
- package/templates/.claude/ukit/index/resolve-context.mjs +279 -0
- package/templates/.claude/ukit/index/route-catalog.mjs +258 -0
- package/templates/.claude/ukit/index/route-task.mjs +1994 -0
- package/templates/.claude/ukit/index/triage.mjs +133 -0
- package/templates/.claude/ukit/index/verify-context.mjs +689 -0
- package/templates/.claude/ukit/runtime/compact-threshold.mjs +1013 -0
- package/templates/.claude/ukit/runtime/output-compression.mjs +1340 -0
- package/templates/.claude/ukit/runtime/reinject-context.mjs +874 -0
- package/templates/.claude/ukit/runtime/token-utils.mjs +500 -0
- package/templates/.codex/README.md +83 -0
- package/templates/.codex/settings.json +187 -0
- package/templates/.gitignore +75 -0
- package/templates/AGENTS.md +116 -0
- package/templates/CLAUDE.md +93 -0
- package/templates/adapter-presets/antigravity/README.md +22 -0
- package/templates/adapter-presets/antigravity/rules.md +49 -0
- package/templates/adapter-presets/claude/settings.local.json +42 -0
- package/templates/adapter-presets/codex/settings.local.json +6 -0
- package/templates/adapter-presets/opencode/opencode.template.json +1 -0
- package/templates/docs/BUGFIX.md +20 -0
- package/templates/docs/BUG_INDEX.md +12 -0
- package/templates/docs/BUG_METRICS.md +7 -0
- package/templates/docs/BUG_TEMPLATE.md +13 -0
- package/templates/docs/CODE_MAP.md +35 -0
- package/templates/docs/INSTALL.md +113 -0
- package/templates/docs/MEMORY.md +49 -0
- package/templates/docs/PROJECT.md +50 -0
- package/templates/docs/UKIT_USAGE_GUIDE.md +147 -0
- package/templates/docs/WORKLOG.md +10 -0
- package/templates/ukit/README.md +14 -0
- package/templates/ukit/storage/cache/compact-history.json +3 -0
- package/templates/ukit/storage/cache/compact-pressure.json +1 -0
- package/templates/ukit/storage/cache/output-history.json +3 -0
- package/templates/ukit/storage/cache/prompt-cache.json +3 -0
- package/templates/ukit/storage/config.json +37 -0
- package/templates/ukit/storage/memory/projects/.gitkeep +2 -0
- package/templates/ukit/storage/memory/sessions/.gitkeep +0 -0
- package/templates/ukit/storage/memory/user.json +5 -0
|
@@ -0,0 +1,677 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
import { ROUTE_CATALOG } from './routeCatalog.js';
|
|
5
|
+
import { buildRouteSignalText } from './languageTools.js';
|
|
6
|
+
import { resolveContext } from './resolveContext.js';
|
|
7
|
+
import { deriveVerificationPlan } from './verificationPlan.js';
|
|
8
|
+
|
|
9
|
+
const MAX_ACTIVE_ROUTE_SKILLS = 2;
|
|
10
|
+
|
|
11
|
+
export async function deriveTaskRoute({
|
|
12
|
+
rootDir = process.cwd(),
|
|
13
|
+
promptText = '',
|
|
14
|
+
commandText = '',
|
|
15
|
+
targetFile = null,
|
|
16
|
+
taskType = null,
|
|
17
|
+
lastExplicitUserPromptText = '',
|
|
18
|
+
commandNamespace = '.claude',
|
|
19
|
+
} = {}) {
|
|
20
|
+
const absoluteRoot = path.resolve(rootDir);
|
|
21
|
+
const normalizedPrompt = String(promptText || '').trim();
|
|
22
|
+
const normalizedCommand = String(commandText || '').trim();
|
|
23
|
+
const normalizedTarget = normalizeRelativeFile(absoluteRoot, targetFile);
|
|
24
|
+
const activeSkills = await selectActiveSkills({
|
|
25
|
+
rootDir: absoluteRoot,
|
|
26
|
+
promptText: normalizedPrompt,
|
|
27
|
+
commandText: normalizedCommand,
|
|
28
|
+
targetFile: normalizedTarget,
|
|
29
|
+
});
|
|
30
|
+
const useIndexedContext = shouldUseIndexedContext({
|
|
31
|
+
activeSkills,
|
|
32
|
+
targetFile: normalizedTarget,
|
|
33
|
+
});
|
|
34
|
+
const selectedIds = activeSkills.map((entry) => entry.id);
|
|
35
|
+
const contextIntent = deriveContextIntent({
|
|
36
|
+
promptText: normalizedPrompt,
|
|
37
|
+
commandText: normalizedCommand,
|
|
38
|
+
targetFile: normalizedTarget,
|
|
39
|
+
selectedIds,
|
|
40
|
+
});
|
|
41
|
+
const inferredTaskType = taskType ?? inferTaskType({
|
|
42
|
+
promptText: normalizedPrompt,
|
|
43
|
+
commandText: normalizedCommand,
|
|
44
|
+
selectedIds,
|
|
45
|
+
});
|
|
46
|
+
const preservedPrompt = normalizedPrompt || String(lastExplicitUserPromptText || '').trim();
|
|
47
|
+
const contextResult = useIndexedContext && (contextIntent || normalizedTarget)
|
|
48
|
+
? await resolveContext({
|
|
49
|
+
rootDir: absoluteRoot,
|
|
50
|
+
intent: contextIntent,
|
|
51
|
+
targetFile: normalizedTarget,
|
|
52
|
+
taskType: inferredTaskType,
|
|
53
|
+
})
|
|
54
|
+
: null;
|
|
55
|
+
const enrichedContextResult = expandRouteContext(contextResult);
|
|
56
|
+
|
|
57
|
+
const contextRecommendation = useIndexedContext
|
|
58
|
+
? buildContextRecommendation({
|
|
59
|
+
commandNamespace,
|
|
60
|
+
contextIntent,
|
|
61
|
+
targetFile: normalizedTarget,
|
|
62
|
+
taskType: inferredTaskType,
|
|
63
|
+
contextResult: enrichedContextResult,
|
|
64
|
+
})
|
|
65
|
+
: null;
|
|
66
|
+
const verificationPlan = useIndexedContext
|
|
67
|
+
? await deriveVerificationPlan({
|
|
68
|
+
rootDir: absoluteRoot,
|
|
69
|
+
intent: contextIntent,
|
|
70
|
+
targetFile: normalizedTarget,
|
|
71
|
+
taskType: inferredTaskType,
|
|
72
|
+
contextResult: enrichedContextResult,
|
|
73
|
+
skillIds: selectedIds,
|
|
74
|
+
})
|
|
75
|
+
: null;
|
|
76
|
+
|
|
77
|
+
const verificationRecommendation = verificationPlan
|
|
78
|
+
? {
|
|
79
|
+
...verificationPlan,
|
|
80
|
+
helperCommand: buildHelperCommand({
|
|
81
|
+
commandNamespace,
|
|
82
|
+
scriptName: 'verify-context.mjs',
|
|
83
|
+
intent: contextIntent,
|
|
84
|
+
targetFile: normalizedTarget,
|
|
85
|
+
taskType: inferredTaskType,
|
|
86
|
+
}),
|
|
87
|
+
}
|
|
88
|
+
: null;
|
|
89
|
+
const nextAction = deriveNextAction({
|
|
90
|
+
activeSkills,
|
|
91
|
+
contextRecommendation,
|
|
92
|
+
verificationRecommendation,
|
|
93
|
+
});
|
|
94
|
+
const routeSummary = buildRouteSummary({
|
|
95
|
+
activeSkills,
|
|
96
|
+
routingContext: {
|
|
97
|
+
promptText: normalizedPrompt,
|
|
98
|
+
lastExplicitUserPromptText: preservedPrompt,
|
|
99
|
+
commandText: normalizedCommand,
|
|
100
|
+
targetFile: normalizedTarget,
|
|
101
|
+
contextIntent,
|
|
102
|
+
taskType: inferredTaskType,
|
|
103
|
+
},
|
|
104
|
+
contextRecommendation,
|
|
105
|
+
verificationRecommendation,
|
|
106
|
+
nextAction,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
return {
|
|
110
|
+
activeSkills,
|
|
111
|
+
routingContext: {
|
|
112
|
+
promptText: normalizedPrompt,
|
|
113
|
+
lastExplicitUserPromptText: preservedPrompt,
|
|
114
|
+
commandText: normalizedCommand,
|
|
115
|
+
targetFile: normalizedTarget,
|
|
116
|
+
contextIntent,
|
|
117
|
+
taskType: inferredTaskType,
|
|
118
|
+
},
|
|
119
|
+
contextRecommendation,
|
|
120
|
+
verificationRecommendation,
|
|
121
|
+
nextAction,
|
|
122
|
+
routeSummary,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function buildRouteSummary({
|
|
127
|
+
activeSkills = [],
|
|
128
|
+
routingContext = {},
|
|
129
|
+
contextRecommendation = null,
|
|
130
|
+
verificationRecommendation = null,
|
|
131
|
+
nextAction = null,
|
|
132
|
+
} = {}) {
|
|
133
|
+
const delegationRecommendation = deriveDelegationRecommendation({
|
|
134
|
+
activeSkills,
|
|
135
|
+
routingContext,
|
|
136
|
+
contextRecommendation,
|
|
137
|
+
verificationRecommendation,
|
|
138
|
+
});
|
|
139
|
+
const preview = contextRecommendation?.preview ?? {};
|
|
140
|
+
const primaryTargets = summarizeCompactList(preview.primaryTargets ?? [], 2);
|
|
141
|
+
const relatedTests = summarizeCompactList(preview.relatedTests ?? [], 2);
|
|
142
|
+
const styleFiles = summarizeCompactList(preview.styleFiles ?? [], 1);
|
|
143
|
+
const primaryCommands = unique(verificationRecommendation?.commands ?? []);
|
|
144
|
+
const fallbackCommands = unique(verificationRecommendation?.fallbackCommands ?? []);
|
|
145
|
+
const preferredOrder = unique(
|
|
146
|
+
verificationRecommendation?.executionPolicy?.preferredOrder
|
|
147
|
+
?? [...primaryCommands, ...fallbackCommands],
|
|
148
|
+
);
|
|
149
|
+
const policyMode = verificationRecommendation?.executionPolicy?.policyMode ?? null;
|
|
150
|
+
const compactHelperLane = nextAction?.type === 'pull-indexed-context'
|
|
151
|
+
&& typeof contextRecommendation?.command === 'string'
|
|
152
|
+
&& contextRecommendation.command.trim();
|
|
153
|
+
const helperHint = compactHelperHint(
|
|
154
|
+
compactHelperLane
|
|
155
|
+
? contextRecommendation?.command
|
|
156
|
+
: (
|
|
157
|
+
nextAction?.command
|
|
158
|
+
? null
|
|
159
|
+
: verificationRecommendation?.helperCommand
|
|
160
|
+
),
|
|
161
|
+
);
|
|
162
|
+
const nextActionCommand = compactHelperLane ? null : nextAction?.command ?? null;
|
|
163
|
+
const summaryLine = [
|
|
164
|
+
routingContext.taskType ? `task=${routingContext.taskType}` : null,
|
|
165
|
+
formatCompactSegment('targets', primaryTargets),
|
|
166
|
+
formatCompactSegment('tests', relatedTests),
|
|
167
|
+
formatCompactSegment('styles', styleFiles),
|
|
168
|
+
policyMode ? `policy=${policyMode}` : null,
|
|
169
|
+
].filter(Boolean).join(' | ');
|
|
170
|
+
|
|
171
|
+
return {
|
|
172
|
+
primaryCommands,
|
|
173
|
+
fallbackCommands,
|
|
174
|
+
preferredOrder,
|
|
175
|
+
policyMode,
|
|
176
|
+
delegateHint: delegationRecommendation?.hint ?? null,
|
|
177
|
+
nextActionType: nextAction?.type ?? null,
|
|
178
|
+
nextActionCommand,
|
|
179
|
+
helperHint,
|
|
180
|
+
line: summaryLine || 'task=unknown',
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
async function selectActiveSkills({ rootDir, promptText, commandText, targetFile }) {
|
|
185
|
+
const routeSignals = {
|
|
186
|
+
promptRawText: String(promptText || '').toLowerCase(),
|
|
187
|
+
promptNormalizedText: buildRouteSignalText(promptText),
|
|
188
|
+
commandRawText: String(commandText || '').toLowerCase(),
|
|
189
|
+
commandNormalizedText: buildRouteSignalText(commandText),
|
|
190
|
+
fileText: String(targetFile || '').toLowerCase(),
|
|
191
|
+
};
|
|
192
|
+
const scoredEntries = ROUTE_CATALOG
|
|
193
|
+
.map((entry) => scoreSkillRouteEntry(entry, routeSignals))
|
|
194
|
+
.filter((entry) => entry.score > 0)
|
|
195
|
+
.sort((a, b) => b.score - a.score || a.order - b.order);
|
|
196
|
+
const active = [];
|
|
197
|
+
|
|
198
|
+
for (const entry of scoredEntries) {
|
|
199
|
+
if (await pathExists(path.join(rootDir, entry.path))) {
|
|
200
|
+
active.push(entry);
|
|
201
|
+
if (active.length >= MAX_ACTIVE_ROUTE_SKILLS) {
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return active.map(({ order, ...rest }) => rest);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function scoreSkillRouteEntry(entry, routeSignals = {}) {
|
|
211
|
+
let score = 0;
|
|
212
|
+
const reasons = [];
|
|
213
|
+
|
|
214
|
+
for (const signal of entry.signals) {
|
|
215
|
+
const {
|
|
216
|
+
directText,
|
|
217
|
+
normalizedText,
|
|
218
|
+
} = getSignalTexts(signal.type, routeSignals);
|
|
219
|
+
signal.regex.lastIndex = 0;
|
|
220
|
+
const directMatch = signal.regex.test(directText);
|
|
221
|
+
signal.regex.lastIndex = 0;
|
|
222
|
+
const normalizedMatch = !directMatch && Boolean(normalizedText) && signal.regex.test(normalizedText);
|
|
223
|
+
if (!directMatch && !normalizedMatch) {
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
score += directMatch
|
|
227
|
+
? signal.score
|
|
228
|
+
: Math.max(1, signal.score - 1);
|
|
229
|
+
reasons.push(signal.type);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
score += deriveSkillPriorityBoost(entry.id, routeSignals);
|
|
233
|
+
|
|
234
|
+
return {
|
|
235
|
+
id: entry.id,
|
|
236
|
+
path: entry.path,
|
|
237
|
+
contextMode: entry.contextMode ?? 'indexed',
|
|
238
|
+
reasons: [...new Set(reasons)],
|
|
239
|
+
score,
|
|
240
|
+
order: entry.order,
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function deriveSkillPriorityBoost(skillId, routeSignals = {}) {
|
|
245
|
+
const combinedPromptSignals = [
|
|
246
|
+
routeSignals.promptRawText ?? '',
|
|
247
|
+
routeSignals.promptNormalizedText ?? '',
|
|
248
|
+
routeSignals.commandRawText ?? '',
|
|
249
|
+
routeSignals.commandNormalizedText ?? '',
|
|
250
|
+
].join('\n');
|
|
251
|
+
|
|
252
|
+
if (
|
|
253
|
+
skillId === 'testing-quality'
|
|
254
|
+
&& /\b(test|tests|spec|coverage|mock|fixture|assert|vitest|jest|playwright)\b/.test(combinedPromptSignals)
|
|
255
|
+
) {
|
|
256
|
+
return 1;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return 0;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function getSignalTexts(signalType, routeSignals = {}) {
|
|
263
|
+
if (signalType === 'command') {
|
|
264
|
+
return {
|
|
265
|
+
directText: routeSignals.commandRawText ?? '',
|
|
266
|
+
normalizedText: routeSignals.commandNormalizedText ?? '',
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (signalType === 'file') {
|
|
271
|
+
return {
|
|
272
|
+
directText: routeSignals.fileText ?? '',
|
|
273
|
+
normalizedText: '',
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return {
|
|
278
|
+
directText: routeSignals.promptRawText ?? '',
|
|
279
|
+
normalizedText: routeSignals.promptNormalizedText ?? '',
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function shouldUseIndexedContext({ activeSkills = [], targetFile = null } = {}) {
|
|
284
|
+
if (activeSkills.length === 0) {
|
|
285
|
+
return Boolean(targetFile);
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const primarySkill = activeSkills[0] ?? null;
|
|
289
|
+
const primaryIsStandalone = primarySkill?.contextMode === 'standalone';
|
|
290
|
+
if (!primaryIsStandalone) {
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (isStandaloneNonIndexedTarget(primarySkill, targetFile)) {
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (activeSkills.some((skill) => skill?.contextMode !== 'standalone')) {
|
|
299
|
+
return true;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
return isCodeIndexedTarget(targetFile);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function isStandaloneNonIndexedTarget(primarySkill, targetFile) {
|
|
306
|
+
if (typeof targetFile !== 'string' || !targetFile.trim()) {
|
|
307
|
+
return false;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
const normalized = targetFile.replaceAll('\\', '/');
|
|
311
|
+
if (primarySkill?.id === 'docker-packaging') {
|
|
312
|
+
return /(?:^|\/)(?:Dockerfile|docker-compose(?:\.ya?ml)?|compose\.ya?ml|\.dockerignore)$/i.test(normalized);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
function isCodeIndexedTarget(filePath) {
|
|
319
|
+
if (typeof filePath !== 'string' || !filePath.trim()) {
|
|
320
|
+
return false;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
const normalized = filePath.replaceAll('\\', '/');
|
|
324
|
+
if (/\.(?:[cm]?js|jsx|tsx?|vue|py|rb|go|rs|java|kt|swift|php|cs|c|cc|cpp|cxx|h|hpp|m|mm|scala|sh|bash|zsh|sql|psql|css|scss|sass|less|html|xml|json|ya?ml|toml)$/i.test(normalized)) {
|
|
325
|
+
return true;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
return /(?:^|\/)(?:src|test|tests|app|lib|components|pages|screens|layouts|composables|api|routes?|controllers?|services?|db|database|migrations?|prisma|SQL)\//i.test(normalized);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
function buildContextRecommendation({
|
|
332
|
+
commandNamespace,
|
|
333
|
+
contextIntent,
|
|
334
|
+
targetFile,
|
|
335
|
+
taskType,
|
|
336
|
+
contextResult,
|
|
337
|
+
}) {
|
|
338
|
+
if (!contextIntent && !targetFile) {
|
|
339
|
+
return null;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
return {
|
|
343
|
+
command: buildHelperCommand({
|
|
344
|
+
commandNamespace,
|
|
345
|
+
scriptName: 'resolve-context.mjs',
|
|
346
|
+
intent: contextIntent,
|
|
347
|
+
targetFile,
|
|
348
|
+
taskType,
|
|
349
|
+
}),
|
|
350
|
+
preview: contextResult
|
|
351
|
+
? {
|
|
352
|
+
taskType: contextResult.taskType,
|
|
353
|
+
primaryTargets: contextResult.primaryTargets ?? [],
|
|
354
|
+
analogFiles: contextResult.analogFiles ?? [],
|
|
355
|
+
sharedAbstractions: contextResult.sharedAbstractions ?? [],
|
|
356
|
+
relatedTests: contextResult.relatedTests ?? [],
|
|
357
|
+
styleFiles: contextResult.styleFiles ?? [],
|
|
358
|
+
}
|
|
359
|
+
: null,
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
function expandRouteContext(contextResult) {
|
|
364
|
+
if (!contextResult) {
|
|
365
|
+
return contextResult;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
const directTestTargets = (contextResult.primaryTargets ?? []).filter(isTestLikeFile);
|
|
369
|
+
if (directTestTargets.length === 0) {
|
|
370
|
+
return contextResult;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
return {
|
|
374
|
+
...contextResult,
|
|
375
|
+
relatedTests: unique([
|
|
376
|
+
...(contextResult.relatedTests ?? []),
|
|
377
|
+
...directTestTargets,
|
|
378
|
+
]),
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
function deriveNextAction({
|
|
383
|
+
activeSkills = [],
|
|
384
|
+
contextRecommendation = null,
|
|
385
|
+
verificationRecommendation = null,
|
|
386
|
+
}) {
|
|
387
|
+
const policy = verificationRecommendation?.executionPolicy ?? null;
|
|
388
|
+
const primaryCommands = verificationRecommendation?.commands ?? [];
|
|
389
|
+
const fallbackCommands = verificationRecommendation?.fallbackCommands ?? [];
|
|
390
|
+
|
|
391
|
+
if (policy?.requiresHumanConfirmationForBroadOrRisky) {
|
|
392
|
+
return {
|
|
393
|
+
type: 'ask-user-confirmation',
|
|
394
|
+
reason: 'Ask before broad verification because index evidence could not localize a safe targeted lane.',
|
|
395
|
+
followUpCommands: [...primaryCommands, ...fallbackCommands],
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
if (policy?.shouldAutoRunPrimaryCommands && primaryCommands.length > 0) {
|
|
400
|
+
return {
|
|
401
|
+
type: 'run-primary-verification',
|
|
402
|
+
command: primaryCommands[0],
|
|
403
|
+
reason: 'Targeted related verification is available from indexed context.',
|
|
404
|
+
followUpCommands: fallbackCommands,
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
if (policy?.shouldAutoRunFallbacks && fallbackCommands.length > 0) {
|
|
409
|
+
return {
|
|
410
|
+
type: 'run-fallback-verification',
|
|
411
|
+
command: fallbackCommands[0],
|
|
412
|
+
reason: 'No primary verification command was auto-runnable, but routed fallbacks are allowed.',
|
|
413
|
+
followUpCommands: fallbackCommands.slice(1),
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
if (contextRecommendation?.command) {
|
|
418
|
+
return {
|
|
419
|
+
type: 'pull-indexed-context',
|
|
420
|
+
command: contextRecommendation.command,
|
|
421
|
+
reason: 'Resolve the minimal indexed file bundle before widening reads.',
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
if (activeSkills.length > 0) {
|
|
426
|
+
return {
|
|
427
|
+
type: 'read-skill-instructions',
|
|
428
|
+
skillPaths: activeSkills.map((item) => item.path),
|
|
429
|
+
reason: 'Open the matching project-local skill before acting.',
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
return {
|
|
434
|
+
type: 'inspect-structure',
|
|
435
|
+
reason: 'No strong route found; inspect repository structure and indexed files first.',
|
|
436
|
+
};
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
function deriveDelegationRecommendation({
|
|
440
|
+
activeSkills = [],
|
|
441
|
+
routingContext = {},
|
|
442
|
+
contextRecommendation = null,
|
|
443
|
+
verificationRecommendation = null,
|
|
444
|
+
} = {}) {
|
|
445
|
+
const skillIds = activeSkills.map((item) => item.id);
|
|
446
|
+
const lower = `${routingContext.promptText ?? ''}\n${routingContext.commandText ?? ''}`.toLowerCase();
|
|
447
|
+
const preview = contextRecommendation?.preview ?? {};
|
|
448
|
+
const contextBreadth = countDelegationContextBreadth(preview);
|
|
449
|
+
const hasExplicitTarget = Boolean(routingContext.targetFile);
|
|
450
|
+
const localizedIndexedLane = hasExplicitTarget && contextBreadth > 0 && contextBreadth <= 3;
|
|
451
|
+
const hasRelatedTests = (preview.relatedTests ?? []).length > 0;
|
|
452
|
+
const when = contextRecommendation?.command ? 'after-context' : 'now';
|
|
453
|
+
|
|
454
|
+
if (routingContext.taskType === 'trivial') {
|
|
455
|
+
return null;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
if (
|
|
459
|
+
skillIds.includes('executing-plans')
|
|
460
|
+
|| /\b(execute this plan|follow this plan|implementation plan|rollout plan|controlled batches?|review checkpoints?|batch execution|execute in batches)\b/.test(lower)
|
|
461
|
+
) {
|
|
462
|
+
return {
|
|
463
|
+
hint: 'subagent-driven-development',
|
|
464
|
+
when,
|
|
465
|
+
reason: 'Explicit plan/batch execution is separable enough for deliberate subagent passes.',
|
|
466
|
+
};
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
const noisyDebugLane = skillIds.includes('debugging-toolkit') && (
|
|
470
|
+
Boolean(String(routingContext.commandText ?? '').trim())
|
|
471
|
+
|| /\b(debug|error|crash|stack(?: trace)?|failing|flake|flaky|timeout|triage|root cause)\b/.test(lower)
|
|
472
|
+
|| verificationRecommendation?.executionPolicy?.policyMode === 'confirm-then-broad'
|
|
473
|
+
);
|
|
474
|
+
if (noisyDebugLane && (!localizedIndexedLane || !hasRelatedTests || contextBreadth >= 4)) {
|
|
475
|
+
return {
|
|
476
|
+
hint: 'bug-debugger',
|
|
477
|
+
when,
|
|
478
|
+
reason: 'A noisy reproduce/trace/fix loop benefits from isolated debugging context.',
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
const hasImplementationSkill = skillIds.some((id) => DELEGATABLE_IMPLEMENTATION_SKILL_IDS.has(id));
|
|
483
|
+
const clearImplementationSignal = /\b(implement|build|create|add|ship|deliver|refactor|integrat(?:e|ion)|scaffold|feature)\b/.test(lower);
|
|
484
|
+
const multiLaneSignal = /\b(multiple|several|parallel|independent|across files|across modules|batch)\b/.test(lower);
|
|
485
|
+
if (
|
|
486
|
+
hasImplementationSkill
|
|
487
|
+
&& clearImplementationSignal
|
|
488
|
+
&& routingContext.taskType === 'non-trivial'
|
|
489
|
+
&& (!localizedIndexedLane || !hasExplicitTarget || contextBreadth >= 4 || multiLaneSignal)
|
|
490
|
+
) {
|
|
491
|
+
return {
|
|
492
|
+
hint: 'feature-implementer',
|
|
493
|
+
when,
|
|
494
|
+
reason: 'A broader implementation lane can be delegated without dragging all details through the main context.',
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
return null;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
function deriveContextIntent({ promptText, commandText, targetFile, selectedIds }) {
|
|
502
|
+
if (promptText.trim()) {
|
|
503
|
+
return promptText.trim();
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
if (commandText.includes('triage.mjs')) {
|
|
507
|
+
return `debug ${commandText.trim()}`.trim();
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
if (commandText.includes('query-index.mjs')) {
|
|
511
|
+
return `investigate ${commandText.trim()}`.trim();
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
if (/\b(test|vitest|jest|playwright|cypress)\b/i.test(commandText)) {
|
|
515
|
+
return targetFile ? `fix failing test around ${targetFile}` : 'fix failing test';
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
if (targetFile) {
|
|
519
|
+
if (/^docs\//i.test(targetFile)) {
|
|
520
|
+
return `update docs for ${targetFile}`;
|
|
521
|
+
}
|
|
522
|
+
return `work on ${targetFile}`;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
if (selectedIds.includes('docs-quality')) return 'update documentation';
|
|
526
|
+
if (selectedIds.includes('debugging-toolkit')) return 'debug failing issue';
|
|
527
|
+
if (selectedIds.includes('testing-quality')) return 'write targeted test';
|
|
528
|
+
if (selectedIds.includes('code-review')) return 'review change for regressions';
|
|
529
|
+
if (selectedIds.includes('repo-maintenance')) return 'refresh stale workspace';
|
|
530
|
+
if (selectedIds.includes('discover-security')) return 'review security-sensitive change';
|
|
531
|
+
return '';
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
function inferTaskType({ promptText, commandText, selectedIds }) {
|
|
535
|
+
const lower = buildRouteSignalText(promptText, commandText);
|
|
536
|
+
|
|
537
|
+
if (
|
|
538
|
+
selectedIds.includes('discover-security')
|
|
539
|
+
|| selectedIds.includes('repo-maintenance')
|
|
540
|
+
|| /\b(auth|security|token|permission|secret|migration|uninstall|delete all|drop table|race|flaky|timeout)\b/.test(lower)
|
|
541
|
+
) {
|
|
542
|
+
return 'non-trivial';
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
if (/\b(typo|label|text|rename|color|spacing|toggle|comment)\b/.test(lower)) {
|
|
546
|
+
return 'trivial';
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
return 'simple';
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
function shellEscape(str) {
|
|
553
|
+
if (typeof str !== 'string') return '';
|
|
554
|
+
return "'" + str.replace(/'/g, "'\''") + "'";
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
function buildHelperCommand({
|
|
558
|
+
commandNamespace = '.claude',
|
|
559
|
+
scriptName,
|
|
560
|
+
intent = '',
|
|
561
|
+
targetFile = null,
|
|
562
|
+
taskType = null,
|
|
563
|
+
}) {
|
|
564
|
+
const parts = ['node', `${commandNamespace}/ukit/index/${scriptName}`];
|
|
565
|
+
if (intent) {
|
|
566
|
+
parts.push(shellEscape(intent));
|
|
567
|
+
}
|
|
568
|
+
if (targetFile) {
|
|
569
|
+
parts.push('--target', shellEscape(targetFile));
|
|
570
|
+
}
|
|
571
|
+
if (taskType) {
|
|
572
|
+
parts.push('--type', taskType);
|
|
573
|
+
}
|
|
574
|
+
return parts.join(' ');
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
function isTestLikeFile(filePath) {
|
|
578
|
+
return /\.(test|spec)\.[a-z0-9]+$/i.test(filePath)
|
|
579
|
+
|| /(^|\/)(?:__tests__|tests?|specs?)\//i.test(filePath);
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
function summarizeCompactList(values, limit = 2) {
|
|
583
|
+
const normalized = unique(values);
|
|
584
|
+
return {
|
|
585
|
+
items: normalized.slice(0, limit),
|
|
586
|
+
total: normalized.length,
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
function countDelegationContextBreadth(preview = {}) {
|
|
591
|
+
return unique([
|
|
592
|
+
...(preview.primaryTargets ?? []),
|
|
593
|
+
...(preview.analogFiles ?? []),
|
|
594
|
+
...(preview.sharedAbstractions ?? []),
|
|
595
|
+
...(preview.relatedTests ?? []),
|
|
596
|
+
]).length;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
function formatCompactSegment(label, summary) {
|
|
600
|
+
const items = summary?.items ?? [];
|
|
601
|
+
if (items.length === 0) {
|
|
602
|
+
return null;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
const extraCount = Math.max((summary?.total ?? items.length) - items.length, 0);
|
|
606
|
+
return `${label}=${items.join(',')}${extraCount > 0 ? `,+${extraCount}` : ''}`;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
function compactHelperHint(command) {
|
|
610
|
+
if (typeof command !== 'string' || !command.trim()) {
|
|
611
|
+
return null;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
const normalized = command.trim().replace(/\s+/g, ' ');
|
|
615
|
+
const scriptMatch = normalized.match(/^node\s+([^\s]+)(?:\s+(.*))?$/i);
|
|
616
|
+
if (!scriptMatch) {
|
|
617
|
+
return normalized.length > 96 ? `${normalized.slice(0, 93)}...` : normalized;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
const scriptName = scriptMatch[1].split('/').pop() ?? scriptMatch[1];
|
|
621
|
+
const rest = scriptMatch[2] ?? '';
|
|
622
|
+
const targetMatch = rest.match(/--target\s+("[^"]+"|'[^']+'|\S+)/);
|
|
623
|
+
const typeMatch = rest.match(/--type\s+(\S+)/);
|
|
624
|
+
const parts = [scriptName];
|
|
625
|
+
|
|
626
|
+
if (targetMatch) {
|
|
627
|
+
parts.push(`target=${stripShellQuotes(targetMatch[1])}`);
|
|
628
|
+
}
|
|
629
|
+
if (typeMatch) {
|
|
630
|
+
parts.push(`type=${typeMatch[1]}`);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
return parts.join(' ');
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
function stripShellQuotes(value) {
|
|
637
|
+
return String(value ?? '').replace(/^['"]|['"]$/g, '');
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
function normalizeRelativeFile(rootDir, rawFilePath) {
|
|
641
|
+
if (typeof rawFilePath !== 'string' || !rawFilePath.trim()) {
|
|
642
|
+
return null;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
const trimmed = rawFilePath.trim();
|
|
646
|
+
if (path.isAbsolute(trimmed)) {
|
|
647
|
+
const relative = path.relative(rootDir, trimmed);
|
|
648
|
+
if (relative && !relative.startsWith('..') && !path.isAbsolute(relative)) {
|
|
649
|
+
return relative.replaceAll('\\', '/');
|
|
650
|
+
}
|
|
651
|
+
return trimmed.replaceAll('\\', '/');
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
return trimmed.replace(/^\.\/+/, '').replaceAll('\\', '/');
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
async function pathExists(filePath) {
|
|
658
|
+
try {
|
|
659
|
+
await fs.access(filePath);
|
|
660
|
+
return true;
|
|
661
|
+
} catch {
|
|
662
|
+
return false;
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
function unique(values) {
|
|
667
|
+
return [...new Set(values.filter(Boolean))];
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
const DELEGATABLE_IMPLEMENTATION_SKILL_IDS = new Set([
|
|
671
|
+
'delivery',
|
|
672
|
+
'frontend',
|
|
673
|
+
'frontend-vue',
|
|
674
|
+
'backend-api',
|
|
675
|
+
'postgres',
|
|
676
|
+
'sql-optimization-patterns',
|
|
677
|
+
]);
|