@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,689 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import crypto from 'node:crypto';
|
|
5
|
+
import * as indexCore from './lib/index-core.mjs';
|
|
6
|
+
import {
|
|
7
|
+
DEFAULT_RECENT_CACHE_MAX_ENTRIES,
|
|
8
|
+
readRecentCacheEntry,
|
|
9
|
+
writeRecentCacheEntry,
|
|
10
|
+
} from './cache-utils.mjs';
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
resolveContext,
|
|
14
|
+
buildCodeIndex,
|
|
15
|
+
DEFAULT_INDEX_CACHE_MAX_AGE_MS,
|
|
16
|
+
getIndexArtifactGeneratedAt,
|
|
17
|
+
} = indexCore;
|
|
18
|
+
const VERIFY_COMMAND_DISPLAY_LIMIT = 2;
|
|
19
|
+
const VERIFY_REASON_DISPLAY_LIMIT = 2;
|
|
20
|
+
const VERIFY_NOTE_DISPLAY_LIMIT = 1;
|
|
21
|
+
|
|
22
|
+
const args = process.argv.slice(2);
|
|
23
|
+
const rootDir = getRootDir(args);
|
|
24
|
+
const targetFile = readFlagValue(args, '--target');
|
|
25
|
+
const taskType = readFlagValue(args, '--type');
|
|
26
|
+
const intent = collectPositionalArgs(args, ['--root', '--target', '--type']);
|
|
27
|
+
const effectiveIntent = deriveHelperIntent({ intent, targetFile });
|
|
28
|
+
|
|
29
|
+
if (!intent && !targetFile) {
|
|
30
|
+
console.error('Usage: node .claude/ukit/index/verify-context.mjs "<intent>" [--target <file>] [--type trivial|simple|non-trivial]');
|
|
31
|
+
process.exitCode = 1;
|
|
32
|
+
} else {
|
|
33
|
+
const indexGeneratedAtMs = await ensureFreshIndex({
|
|
34
|
+
rootDir,
|
|
35
|
+
logPrefix: 'verify',
|
|
36
|
+
});
|
|
37
|
+
const projectVerification = await readProjectVerificationFingerprint(rootDir);
|
|
38
|
+
const cachePath = path.join(rootDir, '.claude', 'ukit', 'verify-context-cache.json');
|
|
39
|
+
const requestKey = buildRequestKey({
|
|
40
|
+
indexGeneratedAtMs,
|
|
41
|
+
projectFingerprint: projectVerification.fingerprint,
|
|
42
|
+
intent: effectiveIntent,
|
|
43
|
+
targetFile,
|
|
44
|
+
taskType,
|
|
45
|
+
});
|
|
46
|
+
const cached = await readRecentCacheEntry(cachePath, requestKey, {
|
|
47
|
+
maxEntries: DEFAULT_RECENT_CACHE_MAX_ENTRIES,
|
|
48
|
+
touch: true,
|
|
49
|
+
});
|
|
50
|
+
const resolveContextCachePath = path.join(rootDir, '.claude', 'ukit', 'resolve-context-cache.json');
|
|
51
|
+
const cachedContext = cached
|
|
52
|
+
? null
|
|
53
|
+
: await readRecentCacheEntry(
|
|
54
|
+
resolveContextCachePath,
|
|
55
|
+
buildResolveContextRequestKey({
|
|
56
|
+
indexGeneratedAtMs,
|
|
57
|
+
intent: effectiveIntent,
|
|
58
|
+
targetFile,
|
|
59
|
+
taskType,
|
|
60
|
+
}),
|
|
61
|
+
{
|
|
62
|
+
maxEntries: DEFAULT_RECENT_CACHE_MAX_ENTRIES,
|
|
63
|
+
},
|
|
64
|
+
);
|
|
65
|
+
const plan = cached?.result
|
|
66
|
+
?? await deriveVerificationPlan({
|
|
67
|
+
rootDir,
|
|
68
|
+
intent: effectiveIntent,
|
|
69
|
+
targetFile,
|
|
70
|
+
taskType,
|
|
71
|
+
contextResult: expandHelperContext(cachedContext?.result ?? null),
|
|
72
|
+
fingerprintEntries: projectVerification.entries,
|
|
73
|
+
pkg: projectVerification.pkg,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
if (!cached) {
|
|
77
|
+
await writeRecentCacheEntry(cachePath, {
|
|
78
|
+
requestKey,
|
|
79
|
+
updatedAt: Date.now(),
|
|
80
|
+
result: plan,
|
|
81
|
+
}, {
|
|
82
|
+
maxEntries: DEFAULT_RECENT_CACHE_MAX_ENTRIES,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
printVerificationPlan(plan);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async function ensureFreshIndex({ rootDir, logPrefix }) {
|
|
90
|
+
const lastRefreshMs = await getIndexArtifactGeneratedAt({ rootDir });
|
|
91
|
+
const stale = lastRefreshMs === null
|
|
92
|
+
? true
|
|
93
|
+
: typeof indexCore.isIndexStale === 'function'
|
|
94
|
+
? await indexCore.isIndexStale({
|
|
95
|
+
rootDir,
|
|
96
|
+
maxAgeMs: DEFAULT_INDEX_CACHE_MAX_AGE_MS,
|
|
97
|
+
now: Date.now(),
|
|
98
|
+
generatedAtMs: lastRefreshMs,
|
|
99
|
+
})
|
|
100
|
+
: (Date.now() - lastRefreshMs) > DEFAULT_INDEX_CACHE_MAX_AGE_MS;
|
|
101
|
+
|
|
102
|
+
if (!stale) {
|
|
103
|
+
return lastRefreshMs;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const summary = await buildCodeIndex({ rootDir });
|
|
107
|
+
if (lastRefreshMs !== null) {
|
|
108
|
+
console.log(`[ukit:${logPrefix}] stale index refreshed (last=${new Date(lastRefreshMs).toISOString()})`);
|
|
109
|
+
} else {
|
|
110
|
+
console.log(`[ukit:${logPrefix}] stale index refreshed (no previous cache timestamp)`);
|
|
111
|
+
}
|
|
112
|
+
return Number.isFinite(summary?.generatedAtMs)
|
|
113
|
+
? summary.generatedAtMs
|
|
114
|
+
: getIndexArtifactGeneratedAt({ rootDir });
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async function deriveVerificationPlan({
|
|
118
|
+
rootDir = process.cwd(),
|
|
119
|
+
intent = '',
|
|
120
|
+
targetFile = null,
|
|
121
|
+
taskType = null,
|
|
122
|
+
contextResult = null,
|
|
123
|
+
fingerprintEntries = [],
|
|
124
|
+
pkg = null,
|
|
125
|
+
} = {}) {
|
|
126
|
+
const absoluteRoot = path.resolve(rootDir);
|
|
127
|
+
const context = expandHelperContext(contextResult ?? await resolveContext({
|
|
128
|
+
rootDir: absoluteRoot,
|
|
129
|
+
intent,
|
|
130
|
+
targetFile,
|
|
131
|
+
taskType,
|
|
132
|
+
}));
|
|
133
|
+
|
|
134
|
+
const resolvedPkg = pkg ?? await readPackageJson(absoluteRoot);
|
|
135
|
+
const scripts = resolvedPkg?.scripts && typeof resolvedPkg.scripts === 'object' ? resolvedPkg.scripts : {};
|
|
136
|
+
const packageManager = detectPackageManager({ fingerprintEntries, pkg: resolvedPkg });
|
|
137
|
+
const primaryTargets = unique([
|
|
138
|
+
...(context?.primaryTargets ?? []),
|
|
139
|
+
...(targetFile ? [targetFile] : []),
|
|
140
|
+
]);
|
|
141
|
+
const relatedTests = unique([
|
|
142
|
+
...(context?.relatedTests ?? []),
|
|
143
|
+
...(targetFile && /\.(test|spec)\./.test(targetFile) ? [targetFile] : []),
|
|
144
|
+
]);
|
|
145
|
+
const commands = [];
|
|
146
|
+
const fallbackCommands = [];
|
|
147
|
+
const reasons = [];
|
|
148
|
+
const notes = [];
|
|
149
|
+
const docsOnly = primaryTargets.length > 0
|
|
150
|
+
&& primaryTargets.every((filePath) => filePath.startsWith('docs/'));
|
|
151
|
+
const risky = context?.taskType === 'non-trivial';
|
|
152
|
+
|
|
153
|
+
let mode = 'minimal';
|
|
154
|
+
|
|
155
|
+
if (docsOnly) {
|
|
156
|
+
mode = 'docs-only';
|
|
157
|
+
reasons.push('docsOnly');
|
|
158
|
+
if (scripts.lint) {
|
|
159
|
+
fallbackCommands.push(buildScriptCommand(packageManager, 'lint'));
|
|
160
|
+
}
|
|
161
|
+
notes.push('Docs-focused change: prefer docs syntax/format verification if available; broad test runs are not the default.');
|
|
162
|
+
} else {
|
|
163
|
+
if (relatedTests.length > 0) {
|
|
164
|
+
mode = 'targeted-tests-first';
|
|
165
|
+
reasons.push('relatedTests');
|
|
166
|
+
if (scripts.test) {
|
|
167
|
+
for (const testFile of relatedTests.slice(0, 2)) {
|
|
168
|
+
commands.push(buildScriptCommand(packageManager, 'test', [testFile]));
|
|
169
|
+
}
|
|
170
|
+
} else {
|
|
171
|
+
notes.push(`Run related tests first: ${relatedTests.slice(0, 2).join(', ')}`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (risky) {
|
|
176
|
+
reasons.push('riskySkillOrTask');
|
|
177
|
+
if (scripts.test) {
|
|
178
|
+
fallbackCommands.push(buildScriptCommand(packageManager, 'test'));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (scripts.lint) {
|
|
183
|
+
fallbackCommands.push(buildScriptCommand(packageManager, 'lint'));
|
|
184
|
+
}
|
|
185
|
+
if (scripts.typecheck) {
|
|
186
|
+
fallbackCommands.push(buildScriptCommand(packageManager, 'typecheck'));
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (commands.length === 0 && scripts.test && risky) {
|
|
190
|
+
mode = 'broader-verification';
|
|
191
|
+
reasons.push('highRiskFallback');
|
|
192
|
+
commands.push(buildScriptCommand(packageManager, 'test'));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (commands.length === 0 && fallbackCommands.length === 0) {
|
|
197
|
+
notes.push('Match verification effort to scope; no project test/lint/typecheck scripts were detected.');
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const summarizedContext = {
|
|
201
|
+
primaryTargets: context?.primaryTargets ?? [],
|
|
202
|
+
analogFiles: context?.analogFiles ?? [],
|
|
203
|
+
sharedAbstractions: context?.sharedAbstractions ?? [],
|
|
204
|
+
relatedTests: context?.relatedTests ?? [],
|
|
205
|
+
styleFiles: context?.styleFiles ?? [],
|
|
206
|
+
};
|
|
207
|
+
const primaryCommandList = unique(commands);
|
|
208
|
+
const fallbackCommandList = unique(fallbackCommands.filter((command) => !primaryCommandList.includes(command)));
|
|
209
|
+
const reasonList = unique(reasons);
|
|
210
|
+
|
|
211
|
+
return {
|
|
212
|
+
taskType: context?.taskType ?? taskType ?? 'simple',
|
|
213
|
+
packageManager,
|
|
214
|
+
mode,
|
|
215
|
+
commands: primaryCommandList,
|
|
216
|
+
fallbackCommands: fallbackCommandList,
|
|
217
|
+
reasons: reasonList,
|
|
218
|
+
notes: unique(notes),
|
|
219
|
+
executionPolicy: deriveExecutionPolicy({
|
|
220
|
+
taskType: context?.taskType ?? taskType ?? 'simple',
|
|
221
|
+
mode,
|
|
222
|
+
commands: primaryCommandList,
|
|
223
|
+
fallbackCommands: fallbackCommandList,
|
|
224
|
+
reasons: reasonList,
|
|
225
|
+
context: summarizedContext,
|
|
226
|
+
}),
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
async function readPackageJson(rootDir) {
|
|
231
|
+
try {
|
|
232
|
+
const raw = await fs.readFile(path.join(rootDir, 'package.json'), 'utf8');
|
|
233
|
+
return JSON.parse(raw);
|
|
234
|
+
} catch {
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function detectPackageManager({ fingerprintEntries = [], pkg = null } = {}) {
|
|
240
|
+
const declaredPackageManager = getDeclaredPackageManager(pkg);
|
|
241
|
+
if (declaredPackageManager) return declaredPackageManager;
|
|
242
|
+
|
|
243
|
+
const existingFiles = new Set(
|
|
244
|
+
fingerprintEntries
|
|
245
|
+
.filter((entry) => entry && entry.mtimeMs !== null)
|
|
246
|
+
.map((entry) => entry.filePath),
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
const checks = [
|
|
250
|
+
['pnpm-lock.yaml', 'pnpm'],
|
|
251
|
+
['yarn.lock', 'yarn'],
|
|
252
|
+
['bun.lockb', 'bun'],
|
|
253
|
+
['bun.lock', 'bun'],
|
|
254
|
+
['package-lock.json', 'npm'],
|
|
255
|
+
];
|
|
256
|
+
|
|
257
|
+
for (const [lockFile, pm] of checks) {
|
|
258
|
+
if (existingFiles.has(lockFile)) {
|
|
259
|
+
return pm;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return 'npm';
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
async function readProjectVerificationFingerprint(rootDir) {
|
|
267
|
+
const entries = [];
|
|
268
|
+
let pkg = null;
|
|
269
|
+
|
|
270
|
+
try {
|
|
271
|
+
const packageJsonPath = path.join(rootDir, 'package.json');
|
|
272
|
+
const [raw, stat] = await Promise.all([
|
|
273
|
+
fs.readFile(packageJsonPath, 'utf8'),
|
|
274
|
+
fs.stat(packageJsonPath),
|
|
275
|
+
]);
|
|
276
|
+
pkg = JSON.parse(raw);
|
|
277
|
+
entries.push({
|
|
278
|
+
filePath: 'package.json',
|
|
279
|
+
size: stat.size,
|
|
280
|
+
mtimeMs: stat.mtimeMs,
|
|
281
|
+
});
|
|
282
|
+
} catch {
|
|
283
|
+
entries.push({
|
|
284
|
+
filePath: 'package.json',
|
|
285
|
+
size: null,
|
|
286
|
+
mtimeMs: null,
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const trackedFiles = getDeclaredPackageManager(pkg)
|
|
291
|
+
? []
|
|
292
|
+
: [
|
|
293
|
+
'package-lock.json',
|
|
294
|
+
'pnpm-lock.yaml',
|
|
295
|
+
'yarn.lock',
|
|
296
|
+
'bun.lockb',
|
|
297
|
+
'bun.lock',
|
|
298
|
+
];
|
|
299
|
+
|
|
300
|
+
for (const relativePath of trackedFiles) {
|
|
301
|
+
const absolutePath = path.join(rootDir, relativePath);
|
|
302
|
+
try {
|
|
303
|
+
const stat = await fs.stat(absolutePath);
|
|
304
|
+
entries.push({
|
|
305
|
+
filePath: relativePath,
|
|
306
|
+
size: stat.size,
|
|
307
|
+
mtimeMs: stat.mtimeMs,
|
|
308
|
+
});
|
|
309
|
+
} catch {
|
|
310
|
+
entries.push({
|
|
311
|
+
filePath: relativePath,
|
|
312
|
+
size: null,
|
|
313
|
+
mtimeMs: null,
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
return {
|
|
319
|
+
pkg,
|
|
320
|
+
entries,
|
|
321
|
+
fingerprint: JSON.stringify(entries),
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function getDeclaredPackageManager(pkg = null) {
|
|
326
|
+
const declared = String(pkg?.packageManager ?? '').toLowerCase();
|
|
327
|
+
if (declared.startsWith('pnpm')) return 'pnpm';
|
|
328
|
+
if (declared.startsWith('yarn')) return 'yarn';
|
|
329
|
+
if (declared.startsWith('bun')) return 'bun';
|
|
330
|
+
if (declared.startsWith('npm')) return 'npm';
|
|
331
|
+
return null;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
function buildRequestKey({
|
|
335
|
+
indexGeneratedAtMs = null,
|
|
336
|
+
projectFingerprint = '',
|
|
337
|
+
intent = '',
|
|
338
|
+
targetFile = null,
|
|
339
|
+
taskType = null,
|
|
340
|
+
} = {}) {
|
|
341
|
+
return buildCompactMachineKey('verify-v1', {
|
|
342
|
+
indexGeneratedAtMs,
|
|
343
|
+
projectFingerprint,
|
|
344
|
+
intent: String(intent || '').trim(),
|
|
345
|
+
targetFile: String(targetFile || '').trim(),
|
|
346
|
+
taskType: String(taskType || '').trim(),
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
function buildResolveContextRequestKey({
|
|
351
|
+
indexGeneratedAtMs = null,
|
|
352
|
+
intent = '',
|
|
353
|
+
targetFile = null,
|
|
354
|
+
taskType = null,
|
|
355
|
+
} = {}) {
|
|
356
|
+
return buildCompactMachineKey('resolve-v1', {
|
|
357
|
+
indexGeneratedAtMs,
|
|
358
|
+
intent: String(intent || '').trim(),
|
|
359
|
+
targetFile: String(targetFile || '').trim(),
|
|
360
|
+
taskType: String(taskType || '').trim(),
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
function buildCompactMachineKey(prefix, payload) {
|
|
365
|
+
return `${prefix}:${stableMachineDigest(payload)}`;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
function stableMachineDigest(payload) {
|
|
369
|
+
return crypto
|
|
370
|
+
.createHash('sha256')
|
|
371
|
+
.update(JSON.stringify(payload))
|
|
372
|
+
.digest('base64url');
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
function deriveHelperIntent({ intent = '', targetFile = null } = {}) {
|
|
376
|
+
const normalizedIntent = String(intent || '').trim();
|
|
377
|
+
if (normalizedIntent) {
|
|
378
|
+
return normalizedIntent;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
const normalizedTarget = String(targetFile || '').trim();
|
|
382
|
+
if (!normalizedTarget) {
|
|
383
|
+
return '';
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
if (/^docs\//i.test(normalizedTarget)) {
|
|
387
|
+
return `update docs for ${normalizedTarget}`;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
return `work on ${normalizedTarget}`;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
function expandHelperContext(contextResult) {
|
|
394
|
+
if (!contextResult) {
|
|
395
|
+
return contextResult;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
const directTests = (contextResult.primaryTargets ?? []).filter(isTestLikeFile);
|
|
399
|
+
if (directTests.length === 0) {
|
|
400
|
+
return contextResult;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
const relatedTests = unique([
|
|
404
|
+
...(contextResult.relatedTests ?? []),
|
|
405
|
+
...directTests,
|
|
406
|
+
]);
|
|
407
|
+
const relatedTestExplanations = mergeRelatedTestExplanations(
|
|
408
|
+
contextResult.explanations?.relatedTests ?? [],
|
|
409
|
+
directTests,
|
|
410
|
+
);
|
|
411
|
+
|
|
412
|
+
return {
|
|
413
|
+
...contextResult,
|
|
414
|
+
relatedTests,
|
|
415
|
+
explanations: {
|
|
416
|
+
...(contextResult.explanations ?? {}),
|
|
417
|
+
relatedTests: relatedTestExplanations,
|
|
418
|
+
},
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
function mergeRelatedTestExplanations(existingExplanations = [], directTests = []) {
|
|
423
|
+
const next = [...existingExplanations];
|
|
424
|
+
|
|
425
|
+
for (const filePath of directTests) {
|
|
426
|
+
const existing = next.find((entry) => entry.filePath === filePath);
|
|
427
|
+
const reason = `direct test target ${filePath}`;
|
|
428
|
+
if (!existing) {
|
|
429
|
+
next.push({ filePath, reason });
|
|
430
|
+
continue;
|
|
431
|
+
}
|
|
432
|
+
if (!String(existing.reason || '').includes(reason)) {
|
|
433
|
+
existing.reason = existing.reason
|
|
434
|
+
? `${existing.reason}; ${reason}`
|
|
435
|
+
: reason;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
return next;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
function isTestLikeFile(filePath) {
|
|
443
|
+
return /\.(test|spec)\.[a-z0-9]+$/i.test(filePath)
|
|
444
|
+
|| /(^|\/)(?:__tests__|tests?|specs?)\//i.test(filePath);
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
function unique(values = []) {
|
|
448
|
+
return [...new Set(values.filter(Boolean))];
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
function printVerificationPlan(plan) {
|
|
452
|
+
console.log('[ukit:verify]');
|
|
453
|
+
console.log(`taskType: ${plan.taskType}`);
|
|
454
|
+
console.log(`mode: ${plan.mode}`);
|
|
455
|
+
console.log(`commands: ${formatCompactCommandDisplayList(plan.commands, VERIFY_COMMAND_DISPLAY_LIMIT)}`);
|
|
456
|
+
console.log(`fallback: ${formatCompactCommandDisplayList(plan.fallbackCommands, VERIFY_COMMAND_DISPLAY_LIMIT)}`);
|
|
457
|
+
console.log(`reasons: ${formatCompactDisplayList(plan.reasons, VERIFY_REASON_DISPLAY_LIMIT)}`);
|
|
458
|
+
if (plan.executionPolicy) {
|
|
459
|
+
console.log(`policy: ${plan.executionPolicy.policyMode}`);
|
|
460
|
+
console.log(`autoRunPrimary: ${plan.executionPolicy.shouldAutoRunPrimaryCommands ? 'yes' : 'no'}`);
|
|
461
|
+
console.log(`autoRunFallbacks: ${plan.executionPolicy.shouldAutoRunFallbacks ? 'yes' : 'no'}`);
|
|
462
|
+
console.log(`confirmBroad: ${plan.executionPolicy.requiresHumanConfirmationForBroadOrRisky ? 'yes' : 'no'}`);
|
|
463
|
+
}
|
|
464
|
+
if ((plan.notes ?? []).length > 0) {
|
|
465
|
+
console.log(`notes: ${formatCompactNoteDisplayList(plan.notes, VERIFY_NOTE_DISPLAY_LIMIT)}`);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function formatCompactDisplayList(values = [], limit = VERIFY_COMMAND_DISPLAY_LIMIT, separator = ', ') {
|
|
470
|
+
const normalized = unique(values);
|
|
471
|
+
if (normalized.length === 0) {
|
|
472
|
+
return 'none';
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
const shown = normalized.slice(0, limit);
|
|
476
|
+
const remaining = normalized.length - shown.length;
|
|
477
|
+
return remaining > 0
|
|
478
|
+
? `${shown.join(separator)}${separator}+${remaining} more`
|
|
479
|
+
: shown.join(separator);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
function formatCompactNoteDisplayList(values = [], limit = VERIFY_NOTE_DISPLAY_LIMIT) {
|
|
483
|
+
const normalized = unique(values)
|
|
484
|
+
.map(compactVerificationDisplayNote)
|
|
485
|
+
.filter(Boolean);
|
|
486
|
+
|
|
487
|
+
return formatCompactDisplayList(normalized, limit, ' | ');
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
function formatCompactCommandDisplayList(values = [], limit = VERIFY_COMMAND_DISPLAY_LIMIT) {
|
|
491
|
+
const normalized = unique(values);
|
|
492
|
+
if (normalized.length === 0) {
|
|
493
|
+
return 'none';
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
const sharedTargetFamily = deriveSharedTargetCommandFamily(normalized);
|
|
497
|
+
if (!sharedTargetFamily) {
|
|
498
|
+
return formatCompactDisplayList(normalized, limit);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
const [firstTarget, ...remainingTargets] = sharedTargetFamily.targets;
|
|
502
|
+
const firstCommand = `${sharedTargetFamily.prefix} ${firstTarget}`;
|
|
503
|
+
const shownSiblingCount = Math.max(0, Math.min(remainingTargets.length, limit - 1));
|
|
504
|
+
const shownSiblings = remainingTargets.slice(0, shownSiblingCount);
|
|
505
|
+
const hiddenSiblingCount = remainingTargets.length - shownSiblings.length;
|
|
506
|
+
|
|
507
|
+
if (shownSiblings.length === 0) {
|
|
508
|
+
return hiddenSiblingCount > 0
|
|
509
|
+
? `${firstCommand} | same-command: +${hiddenSiblingCount} more`
|
|
510
|
+
: firstCommand;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
const siblingSummary = shownSiblings.join(', ');
|
|
514
|
+
return hiddenSiblingCount > 0
|
|
515
|
+
? `${firstCommand} | same-command: ${siblingSummary}, +${hiddenSiblingCount} more`
|
|
516
|
+
: `${firstCommand} | same-command: ${siblingSummary}`;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
function deriveSharedTargetCommandFamily(commands = []) {
|
|
520
|
+
if (commands.length < 2) {
|
|
521
|
+
return null;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
const parsed = commands.map(parseSharedTargetCommand);
|
|
525
|
+
if (parsed.some((entry) => !entry)) {
|
|
526
|
+
return null;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
const prefix = parsed[0].prefix;
|
|
530
|
+
if (!prefix || parsed.some((entry) => entry.prefix !== prefix)) {
|
|
531
|
+
return null;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
return {
|
|
535
|
+
prefix,
|
|
536
|
+
targets: parsed.map((entry) => entry.target),
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
function parseSharedTargetCommand(command) {
|
|
541
|
+
const normalized = String(command || '').trim();
|
|
542
|
+
if (!normalized) {
|
|
543
|
+
return null;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
const parts = normalized.split(/\s+/);
|
|
547
|
+
if (parts.length < 3) {
|
|
548
|
+
return null;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
const target = parts.at(-1);
|
|
552
|
+
if (!isLikelyCommandTarget(target)) {
|
|
553
|
+
return null;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
const prefix = parts.slice(0, -1).join(' ').trim();
|
|
557
|
+
return prefix
|
|
558
|
+
? { prefix, target }
|
|
559
|
+
: null;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
function isLikelyCommandTarget(value) {
|
|
563
|
+
if (!value) {
|
|
564
|
+
return false;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
return value.startsWith('./')
|
|
568
|
+
|| value.startsWith('../')
|
|
569
|
+
|| value.startsWith('/')
|
|
570
|
+
|| value.includes('/')
|
|
571
|
+
|| /\.[a-z0-9]+$/i.test(value);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
function compactVerificationDisplayNote(note) {
|
|
575
|
+
const normalized = String(note || '').trim();
|
|
576
|
+
if (!normalized) {
|
|
577
|
+
return '';
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
if (normalized.startsWith('Run related tests first:')) {
|
|
581
|
+
return `related-tests-first: ${normalized.slice('Run related tests first:'.length).trim()}`;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
if (normalized.startsWith('Docs-focused change:')) {
|
|
585
|
+
return 'docs-only: prefer docs syntax/format checks; broad tests not default';
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
if (normalized === 'Match verification effort to scope; no project test/lint/typecheck scripts were detected.') {
|
|
589
|
+
return 'no test/lint/typecheck scripts detected; match verification effort to scope';
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
return normalized;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
function buildScriptCommand(packageManager, scriptName, args = []) {
|
|
596
|
+
const filteredArgs = args.filter(Boolean);
|
|
597
|
+
if (packageManager === 'npm') {
|
|
598
|
+
if (scriptName === 'test') {
|
|
599
|
+
return ['npm', 'test', filteredArgs.length > 0 ? '--' : '', ...filteredArgs]
|
|
600
|
+
.filter(Boolean)
|
|
601
|
+
.join(' ');
|
|
602
|
+
}
|
|
603
|
+
return ['npm', 'run', scriptName, filteredArgs.length > 0 ? '--' : '', ...filteredArgs]
|
|
604
|
+
.filter(Boolean)
|
|
605
|
+
.join(' ');
|
|
606
|
+
}
|
|
607
|
+
return [packageManager, scriptName, ...filteredArgs].join(' ');
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
function deriveExecutionPolicy({
|
|
611
|
+
taskType = 'simple',
|
|
612
|
+
mode = 'minimal',
|
|
613
|
+
commands = [],
|
|
614
|
+
fallbackCommands = [],
|
|
615
|
+
reasons = [],
|
|
616
|
+
context = {},
|
|
617
|
+
} = {}) {
|
|
618
|
+
const relatedTests = context.relatedTests ?? [];
|
|
619
|
+
const sharedAbstractions = context.sharedAbstractions ?? [];
|
|
620
|
+
const docsOnly = mode === 'docs-only' || reasons.includes('docsOnly');
|
|
621
|
+
const risky = taskType === 'non-trivial'
|
|
622
|
+
|| reasons.includes('riskySkillOrTask')
|
|
623
|
+
|| reasons.includes('highRiskFallback');
|
|
624
|
+
const hasPrimaryCommands = commands.length > 0;
|
|
625
|
+
const hasTargetedPrimaryCommands = mode === 'targeted-tests-first' && hasPrimaryCommands;
|
|
626
|
+
const sharedScope = sharedAbstractions.length > 0;
|
|
627
|
+
const noRelatedTests = relatedTests.length === 0;
|
|
628
|
+
const broadOnlyPrimary = hasPrimaryCommands && !hasTargetedPrimaryCommands && noRelatedTests;
|
|
629
|
+
const requiresHumanConfirmationForBroadOrRisky = risky && broadOnlyPrimary;
|
|
630
|
+
const shouldAutoRunPrimaryCommands = hasPrimaryCommands && !docsOnly && !requiresHumanConfirmationForBroadOrRisky;
|
|
631
|
+
const shouldEscalateToFallbacks = !docsOnly && fallbackCommands.length > 0 && (risky || sharedScope);
|
|
632
|
+
const shouldAutoRunFallbacks = shouldEscalateToFallbacks && !requiresHumanConfirmationForBroadOrRisky;
|
|
633
|
+
|
|
634
|
+
let policyMode = 'recommend-only';
|
|
635
|
+
if (docsOnly) {
|
|
636
|
+
policyMode = 'docs-light';
|
|
637
|
+
} else if (hasTargetedPrimaryCommands && shouldEscalateToFallbacks) {
|
|
638
|
+
policyMode = 'auto-run-targeted-then-fallback';
|
|
639
|
+
} else if (hasTargetedPrimaryCommands) {
|
|
640
|
+
policyMode = 'auto-run-targeted';
|
|
641
|
+
} else if (requiresHumanConfirmationForBroadOrRisky) {
|
|
642
|
+
policyMode = 'confirm-then-broad';
|
|
643
|
+
} else if (shouldAutoRunPrimaryCommands) {
|
|
644
|
+
policyMode = 'auto-run-primary';
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
return {
|
|
648
|
+
policyMode,
|
|
649
|
+
shouldAutoRunPrimaryCommands,
|
|
650
|
+
shouldAutoRunTargetedVerification: hasTargetedPrimaryCommands && shouldAutoRunPrimaryCommands,
|
|
651
|
+
shouldEscalateToFallbacks,
|
|
652
|
+
shouldAutoRunFallbacks,
|
|
653
|
+
requiresHumanConfirmationForBroadOrRisky,
|
|
654
|
+
preferredOrder: [...commands, ...fallbackCommands],
|
|
655
|
+
reasons: unique([
|
|
656
|
+
...reasons,
|
|
657
|
+
sharedScope ? 'sharedScope' : null,
|
|
658
|
+
noRelatedTests ? 'noRelatedTests' : null,
|
|
659
|
+
]),
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
function getRootDir(argv) {
|
|
664
|
+
const value = readFlagValue(argv, '--root');
|
|
665
|
+
return value ? path.resolve(value) : process.cwd();
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
function readFlagValue(argv, flag) {
|
|
669
|
+
const exact = argv.indexOf(flag);
|
|
670
|
+
if (exact >= 0 && argv[exact + 1]) return argv[exact + 1];
|
|
671
|
+
const withEquals = argv.find((item) => item.startsWith(`${flag}=`));
|
|
672
|
+
return withEquals ? withEquals.slice(flag.length + 1) : null;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
function collectPositionalArgs(argv, flagsWithValues = []) {
|
|
676
|
+
return argv
|
|
677
|
+
.filter((arg, index) => !isFlagOrValue(argv, index, flagsWithValues))
|
|
678
|
+
.join(' ')
|
|
679
|
+
.trim();
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
function isFlagOrValue(argv, index, flagsWithValues = []) {
|
|
683
|
+
const arg = argv[index];
|
|
684
|
+
if (!arg.startsWith('--')) {
|
|
685
|
+
const prev = argv[index - 1];
|
|
686
|
+
return Boolean(prev && flagsWithValues.includes(prev));
|
|
687
|
+
}
|
|
688
|
+
return true;
|
|
689
|
+
}
|