@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,437 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
import { resolveContext } from './resolveContext.js';
|
|
5
|
+
|
|
6
|
+
const RISKY_SKILL_IDS = new Set(['discover-security', 'repo-maintenance']);
|
|
7
|
+
const TRACKED_VERIFICATION_FILES = [
|
|
8
|
+
'package.json',
|
|
9
|
+
'package-lock.json',
|
|
10
|
+
'pnpm-lock.yaml',
|
|
11
|
+
'yarn.lock',
|
|
12
|
+
'bun.lockb',
|
|
13
|
+
'bun.lock',
|
|
14
|
+
];
|
|
15
|
+
const MAX_VERIFICATION_ENV_CACHE_ENTRIES = 16;
|
|
16
|
+
const MAX_VERIFICATION_PLAN_CACHE_ENTRIES = 32;
|
|
17
|
+
const PROJECT_VERIFICATION_ENV_CACHE = new Map();
|
|
18
|
+
const VERIFICATION_PLAN_CACHE = new Map();
|
|
19
|
+
|
|
20
|
+
export async function deriveVerificationPlan({
|
|
21
|
+
rootDir = process.cwd(),
|
|
22
|
+
intent = '',
|
|
23
|
+
targetFile = null,
|
|
24
|
+
taskType = null,
|
|
25
|
+
contextResult = null,
|
|
26
|
+
skillIds = [],
|
|
27
|
+
} = {}) {
|
|
28
|
+
const absoluteRoot = path.resolve(rootDir);
|
|
29
|
+
const resolvedContext = contextResult ?? await resolveContext({
|
|
30
|
+
rootDir: absoluteRoot,
|
|
31
|
+
intent,
|
|
32
|
+
targetFile,
|
|
33
|
+
taskType,
|
|
34
|
+
});
|
|
35
|
+
const context = summarizeContext(resolvedContext);
|
|
36
|
+
const effectiveTaskType = resolvedContext?.taskType ?? taskType ?? 'simple';
|
|
37
|
+
const projectVerification = await readProjectVerificationFingerprint(absoluteRoot);
|
|
38
|
+
const verificationPlanCacheKey = buildVerificationPlanCacheKey({
|
|
39
|
+
rootDir: absoluteRoot,
|
|
40
|
+
projectFingerprint: projectVerification.fingerprint,
|
|
41
|
+
targetFile,
|
|
42
|
+
taskType: effectiveTaskType,
|
|
43
|
+
skillIds,
|
|
44
|
+
context,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const cachedPlan = getRecentCacheEntry(VERIFICATION_PLAN_CACHE, verificationPlanCacheKey);
|
|
48
|
+
if (cachedPlan) {
|
|
49
|
+
return cachedPlan;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const planPromise = (async () => {
|
|
53
|
+
const projectEnvironment = await loadProjectVerificationEnvironment({
|
|
54
|
+
rootDir: absoluteRoot,
|
|
55
|
+
projectFingerprint: projectVerification.fingerprint,
|
|
56
|
+
fingerprintEntries: projectVerification.entries,
|
|
57
|
+
pkg: projectVerification.pkg,
|
|
58
|
+
});
|
|
59
|
+
const scripts = projectEnvironment.scripts;
|
|
60
|
+
const packageManager = projectEnvironment.packageManager;
|
|
61
|
+
const primaryTargets = unique([
|
|
62
|
+
...(context.primaryTargets ?? []),
|
|
63
|
+
...(targetFile ? [targetFile] : []),
|
|
64
|
+
]);
|
|
65
|
+
const relatedTests = unique([
|
|
66
|
+
...(context.relatedTests ?? []),
|
|
67
|
+
...(targetFile && isTestLikeFile(targetFile) ? [targetFile] : []),
|
|
68
|
+
]);
|
|
69
|
+
const commands = [];
|
|
70
|
+
const fallbackCommands = [];
|
|
71
|
+
const reasons = [];
|
|
72
|
+
const notes = [];
|
|
73
|
+
const docsOnly = primaryTargets.length > 0
|
|
74
|
+
&& primaryTargets.every((filePath) => filePath.startsWith('docs/'));
|
|
75
|
+
const risky = effectiveTaskType === 'non-trivial'
|
|
76
|
+
|| skillIds.some((skillId) => RISKY_SKILL_IDS.has(skillId));
|
|
77
|
+
|
|
78
|
+
let mode = 'minimal';
|
|
79
|
+
|
|
80
|
+
if (docsOnly) {
|
|
81
|
+
mode = 'docs-only';
|
|
82
|
+
reasons.push('docsOnly');
|
|
83
|
+
if (scripts.lint) {
|
|
84
|
+
fallbackCommands.push(buildScriptCommand(packageManager, 'lint'));
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
notes.push('Docs-focused change: prefer docs syntax/format verification if available; broad test runs are not the default.');
|
|
88
|
+
} else {
|
|
89
|
+
if (relatedTests.length > 0) {
|
|
90
|
+
mode = 'targeted-tests-first';
|
|
91
|
+
reasons.push('relatedTests');
|
|
92
|
+
if (scripts.test) {
|
|
93
|
+
for (const testFile of relatedTests.slice(0, 2)) {
|
|
94
|
+
commands.push(buildScriptCommand(packageManager, 'test', [testFile]));
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
notes.push(`Run related tests first: ${relatedTests.slice(0, 2).join(', ')}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (risky) {
|
|
102
|
+
reasons.push('riskySkillOrTask');
|
|
103
|
+
if (scripts.test) {
|
|
104
|
+
fallbackCommands.push(buildScriptCommand(packageManager, 'test'));
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (scripts.lint) {
|
|
109
|
+
fallbackCommands.push(buildScriptCommand(packageManager, 'lint'));
|
|
110
|
+
}
|
|
111
|
+
if (scripts.typecheck) {
|
|
112
|
+
fallbackCommands.push(buildScriptCommand(packageManager, 'typecheck'));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (commands.length === 0 && scripts.test && risky) {
|
|
116
|
+
mode = 'broader-verification';
|
|
117
|
+
reasons.push('highRiskFallback');
|
|
118
|
+
commands.push(buildScriptCommand(packageManager, 'test'));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (commands.length === 0 && fallbackCommands.length === 0) {
|
|
123
|
+
notes.push('Match verification effort to scope; no project test/lint/typecheck scripts were detected.');
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const primaryCommandList = unique(commands);
|
|
127
|
+
const fallbackCommandList = unique(fallbackCommands.filter((command) => !primaryCommandList.includes(command)));
|
|
128
|
+
const reasonList = unique(reasons);
|
|
129
|
+
const noteList = unique(notes);
|
|
130
|
+
|
|
131
|
+
return {
|
|
132
|
+
taskType: effectiveTaskType,
|
|
133
|
+
packageManager,
|
|
134
|
+
mode,
|
|
135
|
+
commands: primaryCommandList,
|
|
136
|
+
fallbackCommands: fallbackCommandList,
|
|
137
|
+
reasons: reasonList,
|
|
138
|
+
notes: noteList,
|
|
139
|
+
executionPolicy: deriveExecutionPolicy({
|
|
140
|
+
taskType: effectiveTaskType,
|
|
141
|
+
mode,
|
|
142
|
+
commands: primaryCommandList,
|
|
143
|
+
fallbackCommands: fallbackCommandList,
|
|
144
|
+
reasons: reasonList,
|
|
145
|
+
context,
|
|
146
|
+
}),
|
|
147
|
+
context,
|
|
148
|
+
};
|
|
149
|
+
})().catch((error) => {
|
|
150
|
+
VERIFICATION_PLAN_CACHE.delete(verificationPlanCacheKey);
|
|
151
|
+
throw error;
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
setRecentCacheEntry(
|
|
155
|
+
VERIFICATION_PLAN_CACHE,
|
|
156
|
+
verificationPlanCacheKey,
|
|
157
|
+
planPromise,
|
|
158
|
+
MAX_VERIFICATION_PLAN_CACHE_ENTRIES,
|
|
159
|
+
);
|
|
160
|
+
return planPromise;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function summarizeContext(contextResult) {
|
|
164
|
+
const primaryTargets = unique(contextResult?.primaryTargets ?? []);
|
|
165
|
+
const relatedTests = unique([
|
|
166
|
+
...(contextResult?.relatedTests ?? []),
|
|
167
|
+
...primaryTargets.filter(isTestLikeFile),
|
|
168
|
+
]);
|
|
169
|
+
|
|
170
|
+
return {
|
|
171
|
+
primaryTargets,
|
|
172
|
+
analogFiles: contextResult?.analogFiles ?? [],
|
|
173
|
+
sharedAbstractions: contextResult?.sharedAbstractions ?? [],
|
|
174
|
+
relatedTests,
|
|
175
|
+
styleFiles: contextResult?.styleFiles ?? [],
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
async function readPackageJson(rootDir) {
|
|
180
|
+
try {
|
|
181
|
+
const raw = await fs.readFile(path.join(rootDir, 'package.json'), 'utf8');
|
|
182
|
+
return JSON.parse(raw);
|
|
183
|
+
} catch {
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
async function readProjectVerificationFingerprint(rootDir) {
|
|
189
|
+
const entries = [];
|
|
190
|
+
let pkg = null;
|
|
191
|
+
|
|
192
|
+
try {
|
|
193
|
+
const packageJsonPath = path.join(rootDir, 'package.json');
|
|
194
|
+
const [raw, stat] = await Promise.all([
|
|
195
|
+
fs.readFile(packageJsonPath, 'utf8'),
|
|
196
|
+
fs.stat(packageJsonPath),
|
|
197
|
+
]);
|
|
198
|
+
pkg = JSON.parse(raw);
|
|
199
|
+
entries.push({
|
|
200
|
+
filePath: 'package.json',
|
|
201
|
+
size: stat.size,
|
|
202
|
+
mtimeMs: stat.mtimeMs,
|
|
203
|
+
});
|
|
204
|
+
} catch {
|
|
205
|
+
entries.push({
|
|
206
|
+
filePath: 'package.json',
|
|
207
|
+
size: null,
|
|
208
|
+
mtimeMs: null,
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const trackedFiles = getDeclaredPackageManager(pkg)
|
|
213
|
+
? []
|
|
214
|
+
: TRACKED_VERIFICATION_FILES.slice(1);
|
|
215
|
+
|
|
216
|
+
for (const relativePath of trackedFiles) {
|
|
217
|
+
const absolutePath = path.join(rootDir, relativePath);
|
|
218
|
+
try {
|
|
219
|
+
const stat = await fs.stat(absolutePath);
|
|
220
|
+
entries.push({
|
|
221
|
+
filePath: relativePath,
|
|
222
|
+
size: stat.size,
|
|
223
|
+
mtimeMs: stat.mtimeMs,
|
|
224
|
+
});
|
|
225
|
+
} catch {
|
|
226
|
+
entries.push({
|
|
227
|
+
filePath: relativePath,
|
|
228
|
+
size: null,
|
|
229
|
+
mtimeMs: null,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return {
|
|
235
|
+
pkg,
|
|
236
|
+
entries,
|
|
237
|
+
fingerprint: JSON.stringify(entries),
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
async function loadProjectVerificationEnvironment({
|
|
242
|
+
rootDir,
|
|
243
|
+
projectFingerprint,
|
|
244
|
+
fingerprintEntries = [],
|
|
245
|
+
pkg = null,
|
|
246
|
+
}) {
|
|
247
|
+
const cacheKey = JSON.stringify({
|
|
248
|
+
rootDir,
|
|
249
|
+
projectFingerprint,
|
|
250
|
+
});
|
|
251
|
+
const cachedEnvironment = getRecentCacheEntry(PROJECT_VERIFICATION_ENV_CACHE, cacheKey);
|
|
252
|
+
if (cachedEnvironment) {
|
|
253
|
+
return cachedEnvironment;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const environmentPromise = Promise.resolve(pkg ?? readPackageJson(rootDir))
|
|
257
|
+
.then((resolvedPkg) => ({
|
|
258
|
+
pkg: resolvedPkg,
|
|
259
|
+
scripts: extractScripts(resolvedPkg),
|
|
260
|
+
packageManager: detectPackageManager({ fingerprintEntries, pkg: resolvedPkg }),
|
|
261
|
+
}))
|
|
262
|
+
.catch((error) => {
|
|
263
|
+
PROJECT_VERIFICATION_ENV_CACHE.delete(cacheKey);
|
|
264
|
+
throw error;
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
setRecentCacheEntry(
|
|
268
|
+
PROJECT_VERIFICATION_ENV_CACHE,
|
|
269
|
+
cacheKey,
|
|
270
|
+
environmentPromise,
|
|
271
|
+
MAX_VERIFICATION_ENV_CACHE_ENTRIES,
|
|
272
|
+
);
|
|
273
|
+
return environmentPromise;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
function extractScripts(pkg = null) {
|
|
277
|
+
return pkg?.scripts && typeof pkg.scripts === 'object' ? pkg.scripts : {};
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
function detectPackageManager({ fingerprintEntries = [], pkg = null } = {}) {
|
|
281
|
+
const declaredPackageManager = getDeclaredPackageManager(pkg);
|
|
282
|
+
if (declaredPackageManager) return declaredPackageManager;
|
|
283
|
+
|
|
284
|
+
const existingFiles = new Set(
|
|
285
|
+
fingerprintEntries
|
|
286
|
+
.filter((entry) => entry && entry.mtimeMs !== null)
|
|
287
|
+
.map((entry) => entry.filePath),
|
|
288
|
+
);
|
|
289
|
+
const checks = [
|
|
290
|
+
['pnpm-lock.yaml', 'pnpm'],
|
|
291
|
+
['yarn.lock', 'yarn'],
|
|
292
|
+
['bun.lockb', 'bun'],
|
|
293
|
+
['bun.lock', 'bun'],
|
|
294
|
+
['package-lock.json', 'npm'],
|
|
295
|
+
];
|
|
296
|
+
|
|
297
|
+
for (const [lockFile, pm] of checks) {
|
|
298
|
+
if (existingFiles.has(lockFile)) {
|
|
299
|
+
return pm;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
return 'npm';
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function getDeclaredPackageManager(pkg = null) {
|
|
307
|
+
const declared = String(pkg?.packageManager ?? '').toLowerCase();
|
|
308
|
+
if (declared.startsWith('pnpm')) return 'pnpm';
|
|
309
|
+
if (declared.startsWith('yarn')) return 'yarn';
|
|
310
|
+
if (declared.startsWith('bun')) return 'bun';
|
|
311
|
+
if (declared.startsWith('npm')) return 'npm';
|
|
312
|
+
return null;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
function buildScriptCommand(packageManager, scriptName, args = []) {
|
|
316
|
+
const filteredArgs = args.filter(Boolean);
|
|
317
|
+
|
|
318
|
+
if (packageManager === 'npm') {
|
|
319
|
+
if (scriptName === 'test') {
|
|
320
|
+
return ['npm', 'test', filteredArgs.length > 0 ? '--' : '', ...filteredArgs]
|
|
321
|
+
.filter(Boolean)
|
|
322
|
+
.join(' ');
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
return ['npm', 'run', scriptName, filteredArgs.length > 0 ? '--' : '', ...filteredArgs]
|
|
326
|
+
.filter(Boolean)
|
|
327
|
+
.join(' ');
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
return [packageManager, scriptName, ...filteredArgs].join(' ');
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
function deriveExecutionPolicy({
|
|
334
|
+
taskType = 'simple',
|
|
335
|
+
mode = 'minimal',
|
|
336
|
+
commands = [],
|
|
337
|
+
fallbackCommands = [],
|
|
338
|
+
reasons = [],
|
|
339
|
+
context = {},
|
|
340
|
+
} = {}) {
|
|
341
|
+
const relatedTests = context.relatedTests ?? [];
|
|
342
|
+
const sharedAbstractions = context.sharedAbstractions ?? [];
|
|
343
|
+
const docsOnly = mode === 'docs-only' || reasons.includes('docsOnly');
|
|
344
|
+
const risky = taskType === 'non-trivial'
|
|
345
|
+
|| reasons.includes('riskySkillOrTask')
|
|
346
|
+
|| reasons.includes('highRiskFallback');
|
|
347
|
+
const hasPrimaryCommands = commands.length > 0;
|
|
348
|
+
const hasTargetedPrimaryCommands = mode === 'targeted-tests-first' && hasPrimaryCommands;
|
|
349
|
+
const sharedScope = sharedAbstractions.length > 0;
|
|
350
|
+
const noRelatedTests = relatedTests.length === 0;
|
|
351
|
+
const broadOnlyPrimary = hasPrimaryCommands && !hasTargetedPrimaryCommands && noRelatedTests;
|
|
352
|
+
const requiresHumanConfirmationForBroadOrRisky = risky && broadOnlyPrimary;
|
|
353
|
+
const shouldAutoRunPrimaryCommands = hasPrimaryCommands && !docsOnly && !requiresHumanConfirmationForBroadOrRisky;
|
|
354
|
+
const shouldEscalateToFallbacks = !docsOnly && fallbackCommands.length > 0 && (risky || sharedScope);
|
|
355
|
+
const shouldAutoRunFallbacks = shouldEscalateToFallbacks && !requiresHumanConfirmationForBroadOrRisky;
|
|
356
|
+
|
|
357
|
+
let policyMode = 'recommend-only';
|
|
358
|
+
if (docsOnly) {
|
|
359
|
+
policyMode = 'docs-light';
|
|
360
|
+
} else if (hasTargetedPrimaryCommands && shouldEscalateToFallbacks) {
|
|
361
|
+
policyMode = 'auto-run-targeted-then-fallback';
|
|
362
|
+
} else if (hasTargetedPrimaryCommands) {
|
|
363
|
+
policyMode = 'auto-run-targeted';
|
|
364
|
+
} else if (requiresHumanConfirmationForBroadOrRisky) {
|
|
365
|
+
policyMode = 'confirm-then-broad';
|
|
366
|
+
} else if (shouldAutoRunPrimaryCommands) {
|
|
367
|
+
policyMode = 'auto-run-primary';
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
const policyReasons = unique([
|
|
371
|
+
...reasons,
|
|
372
|
+
sharedScope ? 'sharedScope' : null,
|
|
373
|
+
noRelatedTests ? 'noRelatedTests' : null,
|
|
374
|
+
]);
|
|
375
|
+
|
|
376
|
+
return {
|
|
377
|
+
policyMode,
|
|
378
|
+
shouldAutoRunPrimaryCommands,
|
|
379
|
+
shouldAutoRunTargetedVerification: hasTargetedPrimaryCommands && shouldAutoRunPrimaryCommands,
|
|
380
|
+
shouldEscalateToFallbacks,
|
|
381
|
+
shouldAutoRunFallbacks,
|
|
382
|
+
requiresHumanConfirmationForBroadOrRisky,
|
|
383
|
+
preferredOrder: [...commands, ...fallbackCommands],
|
|
384
|
+
reasons: policyReasons,
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function buildVerificationPlanCacheKey({
|
|
389
|
+
rootDir,
|
|
390
|
+
projectFingerprint,
|
|
391
|
+
targetFile,
|
|
392
|
+
taskType,
|
|
393
|
+
skillIds = [],
|
|
394
|
+
context = {},
|
|
395
|
+
} = {}) {
|
|
396
|
+
return JSON.stringify({
|
|
397
|
+
rootDir,
|
|
398
|
+
projectFingerprint,
|
|
399
|
+
targetFile: String(targetFile || '').trim(),
|
|
400
|
+
taskType: String(taskType || '').trim(),
|
|
401
|
+
skillIds: unique(skillIds).sort(),
|
|
402
|
+
context,
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
function getRecentCacheEntry(cache, key) {
|
|
407
|
+
if (!cache.has(key)) {
|
|
408
|
+
return null;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
const value = cache.get(key);
|
|
412
|
+
cache.delete(key);
|
|
413
|
+
cache.set(key, value);
|
|
414
|
+
return value;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
function setRecentCacheEntry(cache, key, value, maxEntries) {
|
|
418
|
+
if (cache.has(key)) {
|
|
419
|
+
cache.delete(key);
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
cache.set(key, value);
|
|
423
|
+
|
|
424
|
+
while (cache.size > maxEntries) {
|
|
425
|
+
const oldestKey = cache.keys().next().value;
|
|
426
|
+
cache.delete(oldestKey);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function unique(values) {
|
|
431
|
+
return [...new Set(values.filter(Boolean))];
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
function isTestLikeFile(filePath) {
|
|
435
|
+
return /\.(test|spec)\.[a-z0-9]+$/i.test(filePath)
|
|
436
|
+
|| /(^|\/)(?:__tests__|tests?|specs?)\//i.test(filePath);
|
|
437
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import YAML from 'yaml';
|
|
3
|
+
import { validateManifest } from './validateManifest.js';
|
|
4
|
+
|
|
5
|
+
export async function loadManifest(manifestPath) {
|
|
6
|
+
const raw = await fs.readFile(manifestPath, 'utf8');
|
|
7
|
+
|
|
8
|
+
let parsed;
|
|
9
|
+
try {
|
|
10
|
+
parsed = YAML.parse(raw);
|
|
11
|
+
} catch (error) {
|
|
12
|
+
throw new Error(`Failed to parse manifest YAML: ${error.message}`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const validation = validateManifest(parsed);
|
|
16
|
+
if (!validation.valid) {
|
|
17
|
+
const issues = validation.errors.map((error) => `- ${error}`).join('\n');
|
|
18
|
+
throw new Error(`Manifest validation failed:\n${issues}`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return parsed;
|
|
22
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export const OPTIONAL_ADAPTER_ITEM_IDS = new Set([
|
|
2
|
+
'multi-antigravity-skills-link',
|
|
3
|
+
'multi-antigravity-ukit-link',
|
|
4
|
+
'multi-antigravity-rules',
|
|
5
|
+
'multi-antigravity-readme',
|
|
6
|
+
'multi-codex-skills-link',
|
|
7
|
+
'multi-codex-ukit-link',
|
|
8
|
+
'multi-codex-readme',
|
|
9
|
+
'multi-codex-settings-json',
|
|
10
|
+
'multi-codex-settings-local',
|
|
11
|
+
'multi-opencode-config',
|
|
12
|
+
]);
|
|
13
|
+
|
|
14
|
+
function resolveItemOrder(items) {
|
|
15
|
+
const itemById = new Map(items.map((item) => [item.id, item]));
|
|
16
|
+
const visiting = new Set();
|
|
17
|
+
const visited = new Set();
|
|
18
|
+
const ordered = [];
|
|
19
|
+
|
|
20
|
+
function visit(item) {
|
|
21
|
+
if (visited.has(item.id)) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (visiting.has(item.id)) {
|
|
26
|
+
throw new Error(`Manifest dependency cycle detected at item: ${item.id}`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
visiting.add(item.id);
|
|
30
|
+
|
|
31
|
+
for (const dependencyId of item.requires ?? []) {
|
|
32
|
+
const dependencyItem = itemById.get(dependencyId);
|
|
33
|
+
if (!dependencyItem) {
|
|
34
|
+
throw new Error(`Manifest item ${item.id} requires missing item: ${dependencyId}`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
visit(dependencyItem);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
visiting.delete(item.id);
|
|
41
|
+
visited.add(item.id);
|
|
42
|
+
ordered.push(item);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
for (const item of items) {
|
|
46
|
+
visit(item);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return ordered;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function selectManifestItems({ items, detectedPacks, selectedAdapterItemIds }) {
|
|
53
|
+
const packSet = detectedPacks ? new Set(detectedPacks) : null;
|
|
54
|
+
const selectedAdapterSet = selectedAdapterItemIds
|
|
55
|
+
? new Set(selectedAdapterItemIds)
|
|
56
|
+
: null;
|
|
57
|
+
|
|
58
|
+
const selected = items.filter((item) => {
|
|
59
|
+
if (item.enabledByDefault === false) return false;
|
|
60
|
+
if (packSet && Array.isArray(item.packs) && item.packs.length > 0) {
|
|
61
|
+
if (!item.packs.some((pack) => packSet.has(pack))) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (
|
|
67
|
+
selectedAdapterSet &&
|
|
68
|
+
OPTIONAL_ADAPTER_ITEM_IDS.has(item.id) &&
|
|
69
|
+
!selectedAdapterSet.has(item.id)
|
|
70
|
+
) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return true;
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
return resolveItemOrder(selected);
|
|
78
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
|
|
3
|
+
const VALID_ITEM_TYPES = new Set(['command', 'skill', 'agent', 'hook', 'config', 'link']);
|
|
4
|
+
const VALID_MERGE_STRATEGIES = new Set(['overwrite_with_backup', 'skip', 'append', 'prepend']);
|
|
5
|
+
|
|
6
|
+
function isPlainObject(value) {
|
|
7
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function isStringArray(value) {
|
|
11
|
+
return Array.isArray(value) && value.every((item) => typeof item === 'string');
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
function containsPathTraversal(rawPath) {
|
|
15
|
+
const normalized = path.posix.normalize(rawPath.replaceAll('\\', '/'));
|
|
16
|
+
// Also check for bare '..' — path.posix.normalize('..') returns '..' (no
|
|
17
|
+
// trailing slash), so the startsWith('../') check misses it.
|
|
18
|
+
return normalized === '..' || normalized.startsWith('../') || normalized.includes('/../');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function validateManifest(manifest) {
|
|
22
|
+
const errors = [];
|
|
23
|
+
|
|
24
|
+
if (!isPlainObject(manifest)) {
|
|
25
|
+
return { valid: false, errors: ['Manifest root must be an object.'] };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (typeof manifest.version !== 'number' && typeof manifest.version !== 'string') {
|
|
29
|
+
errors.push('Manifest `version` must be a number or string.');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (typeof manifest.name !== 'string' || manifest.name.trim() === '') {
|
|
33
|
+
errors.push('Manifest `name` must be a non-empty string.');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!Array.isArray(manifest.items) || manifest.items.length === 0) {
|
|
37
|
+
errors.push('Manifest `items` must be a non-empty array.');
|
|
38
|
+
return { valid: errors.length === 0, errors };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const seenIds = new Set();
|
|
42
|
+
|
|
43
|
+
for (let index = 0; index < manifest.items.length; index += 1) {
|
|
44
|
+
const item = manifest.items[index];
|
|
45
|
+
const prefix = `items[${index}]`;
|
|
46
|
+
|
|
47
|
+
if (!isPlainObject(item)) {
|
|
48
|
+
errors.push(`${prefix} must be an object.`);
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (typeof item.id !== 'string' || item.id.trim() === '') {
|
|
53
|
+
errors.push(`${prefix}.id must be a non-empty string.`);
|
|
54
|
+
} else if (seenIds.has(item.id)) {
|
|
55
|
+
errors.push(`${prefix}.id must be unique. Duplicate: ${item.id}`);
|
|
56
|
+
} else {
|
|
57
|
+
seenIds.add(item.id);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!VALID_ITEM_TYPES.has(item.type)) {
|
|
61
|
+
errors.push(`${prefix}.type must be one of: ${Array.from(VALID_ITEM_TYPES).join(', ')}`);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
if (typeof item.sourceTemplate !== 'string' || item.sourceTemplate.trim() === '') {
|
|
65
|
+
errors.push(`${prefix}.sourceTemplate must be a non-empty string.`);
|
|
66
|
+
} else {
|
|
67
|
+
if (path.isAbsolute(item.sourceTemplate)) {
|
|
68
|
+
errors.push(`${prefix}.sourceTemplate must be a relative path.`);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (containsPathTraversal(item.sourceTemplate)) {
|
|
72
|
+
errors.push(`${prefix}.sourceTemplate must not contain path traversal segments.`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (typeof item.targetPath !== 'string' || item.targetPath.trim() === '') {
|
|
77
|
+
errors.push(`${prefix}.targetPath must be a non-empty string.`);
|
|
78
|
+
} else {
|
|
79
|
+
if (path.isAbsolute(item.targetPath)) {
|
|
80
|
+
errors.push(`${prefix}.targetPath must be a relative path.`);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (containsPathTraversal(item.targetPath)) {
|
|
84
|
+
errors.push(`${prefix}.targetPath must not contain path traversal segments.`);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (item.type !== 'link' && !VALID_MERGE_STRATEGIES.has(item.mergeStrategy)) {
|
|
89
|
+
errors.push(
|
|
90
|
+
`${prefix}.mergeStrategy must be one of: ${Array.from(VALID_MERGE_STRATEGIES).join(', ')}`,
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (typeof item.enabledByDefault !== 'boolean') {
|
|
95
|
+
errors.push(`${prefix}.enabledByDefault must be a boolean.`);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (item.requires !== undefined && !isStringArray(item.requires)) {
|
|
99
|
+
errors.push(`${prefix}.requires must be an array of strings when provided.`);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (item.variables !== undefined && !isStringArray(item.variables)) {
|
|
103
|
+
errors.push(`${prefix}.variables must be an array of strings when provided.`);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (item.packs !== undefined && !isStringArray(item.packs)) {
|
|
107
|
+
errors.push(`${prefix}.packs must be an array of strings when provided.`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
valid: errors.length === 0,
|
|
113
|
+
errors,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export function buildTemplateVariables({ projectContext, stackContext, packageVersion, providerContext }) {
|
|
2
|
+
return {
|
|
3
|
+
project: {
|
|
4
|
+
name: projectContext.project.name,
|
|
5
|
+
root: projectContext.project.root,
|
|
6
|
+
stack: stackContext.detectedPacks.join(','),
|
|
7
|
+
},
|
|
8
|
+
runtime: {
|
|
9
|
+
packageManager: projectContext.runtime.packageManager,
|
|
10
|
+
os: projectContext.runtime.os,
|
|
11
|
+
nodeVersion: projectContext.runtime.nodeVersion,
|
|
12
|
+
},
|
|
13
|
+
stack: {
|
|
14
|
+
// original flags
|
|
15
|
+
frontend: stackContext.flags.frontend,
|
|
16
|
+
backendApi: stackContext.flags.backendApi,
|
|
17
|
+
postgres: stackContext.flags.postgres,
|
|
18
|
+
// new context flags
|
|
19
|
+
typescript: stackContext.flags.typescript ?? false,
|
|
20
|
+
testing: stackContext.flags.testing ?? false,
|
|
21
|
+
nuxt: stackContext.flags.nuxt ?? false,
|
|
22
|
+
next: stackContext.flags.next ?? false,
|
|
23
|
+
flutter: stackContext.flags.flutter ?? false,
|
|
24
|
+
reactNative: stackContext.flags.reactNative ?? false,
|
|
25
|
+
docker: stackContext.flags.docker ?? false,
|
|
26
|
+
monorepo: stackContext.flags.monorepo ?? false,
|
|
27
|
+
git: stackContext.flags.git ?? false,
|
|
28
|
+
},
|
|
29
|
+
providers: {
|
|
30
|
+
unic: providerContext.providers?.unic?.supported ?? false,
|
|
31
|
+
},
|
|
32
|
+
ukit: {
|
|
33
|
+
version: packageVersion,
|
|
34
|
+
},
|
|
35
|
+
user: {
|
|
36
|
+
profile: 'default',
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}
|