@dtt_siye/atool 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +235 -0
- package/VERSION +1 -0
- package/agents/code-reviewer.md +29 -0
- package/bin/atool.js +235 -0
- package/bin/postinstall.js +23 -0
- package/hooks/doc-sync-reminder +155 -0
- package/hooks/hooks-cursor.json +37 -0
- package/hooks/hooks.json +37 -0
- package/hooks/prompt-guard +135 -0
- package/hooks/session-start +286 -0
- package/install.sh +603 -0
- package/lib/analyze-source.sh +1265 -0
- package/lib/common.sh +1041 -0
- package/lib/compute-importance.sh +598 -0
- package/lib/detect-stack.sh +354 -0
- package/lib/generate-visualization.sh +266 -0
- package/lib/install-claude.sh +43 -0
- package/lib/install-cursor.sh +281 -0
- package/lib/install-hooks.sh +285 -0
- package/lib/install-kiro.sh +543 -0
- package/lib/install-mcp.sh +99 -0
- package/lib/install-skills.sh +129 -0
- package/lib/knowledge-graph.sh +1014 -0
- package/lib/multi-dimensional-analysis.sh +413 -0
- package/lib/pre-scan.sh +1045 -0
- package/lib/project-init.sh +552 -0
- package/lib/visualization-template.html +545 -0
- package/mcp/recommended.json +24 -0
- package/package.json +39 -0
- package/skills/_superpowers/.claude-plugin/marketplace.json +20 -0
- package/skills/_superpowers/.claude-plugin/plugin.json +20 -0
- package/skills/_superpowers/.codex/INSTALL.md +67 -0
- package/skills/_superpowers/.cursor-plugin/plugin.json +25 -0
- package/skills/_superpowers/.gitattributes +18 -0
- package/skills/_superpowers/.github/FUNDING.yml +3 -0
- package/skills/_superpowers/.github/ISSUE_TEMPLATE/bug_report.md +52 -0
- package/skills/_superpowers/.github/ISSUE_TEMPLATE/config.yml +5 -0
- package/skills/_superpowers/.github/ISSUE_TEMPLATE/feature_request.md +34 -0
- package/skills/_superpowers/.github/ISSUE_TEMPLATE/platform_support.md +23 -0
- package/skills/_superpowers/.github/PULL_REQUEST_TEMPLATE.md +87 -0
- package/skills/_superpowers/.opencode/INSTALL.md +83 -0
- package/skills/_superpowers/.opencode/plugins/superpowers.js +107 -0
- package/skills/_superpowers/CHANGELOG.md +13 -0
- package/skills/_superpowers/CODE_OF_CONDUCT.md +128 -0
- package/skills/_superpowers/GEMINI.md +2 -0
- package/skills/_superpowers/LICENSE +21 -0
- package/skills/_superpowers/README.md +187 -0
- package/skills/_superpowers/RELEASE-NOTES.md +1083 -0
- package/skills/_superpowers/agents/code-reviewer.md +48 -0
- package/skills/_superpowers/commands/brainstorm.md +5 -0
- package/skills/_superpowers/commands/execute-plan.md +5 -0
- package/skills/_superpowers/commands/write-plan.md +5 -0
- package/skills/_superpowers/docs/README.codex.md +126 -0
- package/skills/_superpowers/docs/README.opencode.md +130 -0
- package/skills/_superpowers/docs/plans/2025-11-22-opencode-support-design.md +294 -0
- package/skills/_superpowers/docs/plans/2025-11-22-opencode-support-implementation.md +1095 -0
- package/skills/_superpowers/docs/plans/2025-11-28-skills-improvements-from-user-feedback.md +711 -0
- package/skills/_superpowers/docs/plans/2026-01-17-visual-brainstorming.md +571 -0
- package/skills/_superpowers/docs/superpowers/plans/2026-01-22-document-review-system.md +301 -0
- package/skills/_superpowers/docs/superpowers/plans/2026-02-19-visual-brainstorming-refactor.md +523 -0
- package/skills/_superpowers/docs/superpowers/plans/2026-03-11-zero-dep-brainstorm-server.md +479 -0
- package/skills/_superpowers/docs/superpowers/plans/2026-03-23-codex-app-compatibility.md +564 -0
- package/skills/_superpowers/docs/superpowers/specs/2026-01-22-document-review-system-design.md +136 -0
- package/skills/_superpowers/docs/superpowers/specs/2026-02-19-visual-brainstorming-refactor-design.md +162 -0
- package/skills/_superpowers/docs/superpowers/specs/2026-03-11-zero-dep-brainstorm-server-design.md +118 -0
- package/skills/_superpowers/docs/superpowers/specs/2026-03-23-codex-app-compatibility-design.md +244 -0
- package/skills/_superpowers/docs/testing.md +303 -0
- package/skills/_superpowers/docs/windows/polyglot-hooks.md +212 -0
- package/skills/_superpowers/gemini-extension.json +6 -0
- package/skills/_superpowers/hooks/hooks-cursor.json +10 -0
- package/skills/_superpowers/hooks/hooks.json +16 -0
- package/skills/_superpowers/hooks/run-hook.cmd +46 -0
- package/skills/_superpowers/hooks/session-start +57 -0
- package/skills/_superpowers/package.json +6 -0
- package/skills/_superpowers/skills/brainstorming/SKILL.md +164 -0
- package/skills/_superpowers/skills/brainstorming/scripts/frame-template.html +214 -0
- package/skills/_superpowers/skills/brainstorming/scripts/helper.js +88 -0
- package/skills/_superpowers/skills/brainstorming/scripts/server.cjs +354 -0
- package/skills/_superpowers/skills/brainstorming/scripts/start-server.sh +148 -0
- package/skills/_superpowers/skills/brainstorming/scripts/stop-server.sh +56 -0
- package/skills/_superpowers/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
- package/skills/_superpowers/skills/brainstorming/visual-companion.md +287 -0
- package/skills/_superpowers/skills/dispatching-parallel-agents/SKILL.md +182 -0
- package/skills/_superpowers/skills/executing-plans/SKILL.md +70 -0
- package/skills/_superpowers/skills/finishing-a-development-branch/SKILL.md +200 -0
- package/skills/_superpowers/skills/receiving-code-review/SKILL.md +213 -0
- package/skills/_superpowers/skills/requesting-code-review/SKILL.md +105 -0
- package/skills/_superpowers/skills/requesting-code-review/code-reviewer.md +146 -0
- package/skills/_superpowers/skills/subagent-driven-development/SKILL.md +277 -0
- package/skills/_superpowers/skills/subagent-driven-development/code-quality-reviewer-prompt.md +26 -0
- package/skills/_superpowers/skills/subagent-driven-development/implementer-prompt.md +113 -0
- package/skills/_superpowers/skills/subagent-driven-development/spec-reviewer-prompt.md +61 -0
- package/skills/_superpowers/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/skills/_superpowers/skills/systematic-debugging/SKILL.md +296 -0
- package/skills/_superpowers/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/_superpowers/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/_superpowers/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/_superpowers/skills/systematic-debugging/find-polluter.sh +63 -0
- package/skills/_superpowers/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/_superpowers/skills/systematic-debugging/test-academic.md +14 -0
- package/skills/_superpowers/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/skills/_superpowers/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/skills/_superpowers/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/skills/_superpowers/skills/test-driven-development/SKILL.md +371 -0
- package/skills/_superpowers/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/skills/_superpowers/skills/using-git-worktrees/SKILL.md +218 -0
- package/skills/_superpowers/skills/using-superpowers/SKILL.md +115 -0
- package/skills/_superpowers/skills/using-superpowers/references/codex-tools.md +100 -0
- package/skills/_superpowers/skills/using-superpowers/references/gemini-tools.md +33 -0
- package/skills/_superpowers/skills/verification-before-completion/SKILL.md +139 -0
- package/skills/_superpowers/skills/writing-plans/SKILL.md +152 -0
- package/skills/_superpowers/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
- package/skills/_superpowers/skills/writing-skills/SKILL.md +655 -0
- package/skills/_superpowers/skills/writing-skills/anthropic-best-practices.md +1150 -0
- package/skills/_superpowers/skills/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
- package/skills/_superpowers/skills/writing-skills/graphviz-conventions.dot +172 -0
- package/skills/_superpowers/skills/writing-skills/persuasion-principles.md +187 -0
- package/skills/_superpowers/skills/writing-skills/render-graphs.js +168 -0
- package/skills/_superpowers/skills/writing-skills/testing-skills-with-subagents.md +384 -0
- package/skills/_superpowers/tests/brainstorm-server/package-lock.json +36 -0
- package/skills/_superpowers/tests/brainstorm-server/package.json +10 -0
- package/skills/_superpowers/tests/brainstorm-server/server.test.js +427 -0
- package/skills/_superpowers/tests/brainstorm-server/windows-lifecycle.test.sh +351 -0
- package/skills/_superpowers/tests/brainstorm-server/ws-protocol.test.js +392 -0
- package/skills/_superpowers/tests/claude-code/README.md +158 -0
- package/skills/_superpowers/tests/claude-code/analyze-token-usage.py +168 -0
- package/skills/_superpowers/tests/claude-code/run-skill-tests.sh +187 -0
- package/skills/_superpowers/tests/claude-code/test-document-review-system.sh +177 -0
- package/skills/_superpowers/tests/claude-code/test-helpers.sh +202 -0
- package/skills/_superpowers/tests/claude-code/test-subagent-driven-development-integration.sh +314 -0
- package/skills/_superpowers/tests/claude-code/test-subagent-driven-development.sh +165 -0
- package/skills/_superpowers/tests/explicit-skill-requests/prompts/action-oriented.txt +3 -0
- package/skills/_superpowers/tests/explicit-skill-requests/prompts/after-planning-flow.txt +17 -0
- package/skills/_superpowers/tests/explicit-skill-requests/prompts/claude-suggested-it.txt +11 -0
- package/skills/_superpowers/tests/explicit-skill-requests/prompts/i-know-what-sdd-means.txt +8 -0
- package/skills/_superpowers/tests/explicit-skill-requests/prompts/mid-conversation-execute-plan.txt +3 -0
- package/skills/_superpowers/tests/explicit-skill-requests/prompts/please-use-brainstorming.txt +1 -0
- package/skills/_superpowers/tests/explicit-skill-requests/prompts/skip-formalities.txt +3 -0
- package/skills/_superpowers/tests/explicit-skill-requests/prompts/subagent-driven-development-please.txt +1 -0
- package/skills/_superpowers/tests/explicit-skill-requests/prompts/use-systematic-debugging.txt +1 -0
- package/skills/_superpowers/tests/explicit-skill-requests/run-all.sh +70 -0
- package/skills/_superpowers/tests/explicit-skill-requests/run-claude-describes-sdd.sh +100 -0
- package/skills/_superpowers/tests/explicit-skill-requests/run-extended-multiturn-test.sh +113 -0
- package/skills/_superpowers/tests/explicit-skill-requests/run-haiku-test.sh +144 -0
- package/skills/_superpowers/tests/explicit-skill-requests/run-multiturn-test.sh +143 -0
- package/skills/_superpowers/tests/explicit-skill-requests/run-test.sh +136 -0
- package/skills/_superpowers/tests/opencode/run-tests.sh +163 -0
- package/skills/_superpowers/tests/opencode/setup.sh +73 -0
- package/skills/_superpowers/tests/opencode/test-plugin-loading.sh +72 -0
- package/skills/_superpowers/tests/opencode/test-priority.sh +198 -0
- package/skills/_superpowers/tests/opencode/test-tools.sh +104 -0
- package/skills/_superpowers/tests/skill-triggering/prompts/dispatching-parallel-agents.txt +8 -0
- package/skills/_superpowers/tests/skill-triggering/prompts/executing-plans.txt +1 -0
- package/skills/_superpowers/tests/skill-triggering/prompts/requesting-code-review.txt +3 -0
- package/skills/_superpowers/tests/skill-triggering/prompts/systematic-debugging.txt +11 -0
- package/skills/_superpowers/tests/skill-triggering/prompts/test-driven-development.txt +7 -0
- package/skills/_superpowers/tests/skill-triggering/prompts/writing-plans.txt +10 -0
- package/skills/_superpowers/tests/skill-triggering/run-all.sh +60 -0
- package/skills/_superpowers/tests/skill-triggering/run-test.sh +88 -0
- package/skills/_superpowers/tests/subagent-driven-dev/go-fractals/design.md +81 -0
- package/skills/_superpowers/tests/subagent-driven-dev/go-fractals/plan.md +172 -0
- package/skills/_superpowers/tests/subagent-driven-dev/go-fractals/scaffold.sh +45 -0
- package/skills/_superpowers/tests/subagent-driven-dev/run-test.sh +106 -0
- package/skills/_superpowers/tests/subagent-driven-dev/svelte-todo/design.md +70 -0
- package/skills/_superpowers/tests/subagent-driven-dev/svelte-todo/plan.md +222 -0
- package/skills/_superpowers/tests/subagent-driven-dev/svelte-todo/scaffold.sh +46 -0
- package/skills/ai-project-architecture/SKILL.md +632 -0
- package/skills/ai-project-architecture/reference/structure-rules.md +406 -0
- package/skills/ai-project-architecture/templates/compliance-report.md +300 -0
- package/skills/ai-project-architecture/templates/migration-plan.md +433 -0
- package/skills/ai-project-architecture/templates/verification-checklist.md +408 -0
- package/skills/android-conventions/SKILL.md +125 -0
- package/skills/atool-init/SKILL.md +141 -0
- package/skills/clarify-before-build/SKILL.md +107 -0
- package/skills/code-review/SKILL.md +406 -0
- package/skills/code-review/rules/architecture.md +285 -0
- package/skills/code-review/rules/coupling-cohesion.md +309 -0
- package/skills/code-review/rules/dead-code.md +115 -0
- package/skills/code-review/rules/deprecation-debt.md +279 -0
- package/skills/code-review/rules/duplication.md +104 -0
- package/skills/code-review/rules/error-security.md +143 -0
- package/skills/code-review/rules/maintainability.md +203 -0
- package/skills/code-review/rules/quality.md +158 -0
- package/skills/devops-conventions/SKILL.md +205 -0
- package/skills/doc-coauthoring/SKILL.md +392 -0
- package/skills/doc-standards-enforcer/SKILL.md +290 -0
- package/skills/doc-standards-enforcer/examples/valid-document-example.md +67 -0
- package/skills/doc-standards-enforcer/references/101-standards-summary.md +318 -0
- package/skills/doc-standards-enforcer/scripts/check_references.py +175 -0
- package/skills/doc-standards-enforcer/scripts/fix_common_issues.py +303 -0
- package/skills/doc-standards-enforcer/scripts/validate_doc_standards.py +332 -0
- package/skills/docx/LICENSE.txt +30 -0
- package/skills/docx/SKILL.md +200 -0
- package/skills/docx/docx-js.md +350 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/docx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/docx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/docx/ooxml/schemas/mce/mc.xsd +75 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/docx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/docx/ooxml/scripts/pack.py +159 -0
- package/skills/docx/ooxml/scripts/unpack.py +29 -0
- package/skills/docx/ooxml/scripts/validate.py +69 -0
- package/skills/docx/ooxml/scripts/validation/__init__.py +15 -0
- package/skills/docx/ooxml/scripts/validation/base.py +951 -0
- package/skills/docx/ooxml/scripts/validation/docx.py +274 -0
- package/skills/docx/ooxml/scripts/validation/pptx.py +315 -0
- package/skills/docx/ooxml/scripts/validation/redlining.py +279 -0
- package/skills/docx/ooxml.md +610 -0
- package/skills/docx/scripts/__init__.py +1 -0
- package/skills/docx/scripts/document.py +1276 -0
- package/skills/docx/scripts/templates/comments.xml +3 -0
- package/skills/docx/scripts/templates/commentsExtended.xml +3 -0
- package/skills/docx/scripts/templates/commentsExtensible.xml +3 -0
- package/skills/docx/scripts/templates/commentsIds.xml +3 -0
- package/skills/docx/scripts/templates/people.xml +3 -0
- package/skills/docx/scripts/utilities.py +374 -0
- package/skills/flutter-conventions/SKILL.md +70 -0
- package/skills/go-conventions/SKILL.md +230 -0
- package/skills/harmony-conventions/SKILL.md +156 -0
- package/skills/java-conventions/SKILL.md +277 -0
- package/skills/pdf/LICENSE.txt +30 -0
- package/skills/pdf/SKILL.md +297 -0
- package/skills/pdf/forms.md +205 -0
- package/skills/pdf/reference.md +612 -0
- package/skills/pdf/scripts/check_bounding_boxes.py +70 -0
- package/skills/pdf/scripts/check_bounding_boxes_test.py +226 -0
- package/skills/pdf/scripts/check_fillable_fields.py +12 -0
- package/skills/pdf/scripts/convert_pdf_to_images.py +35 -0
- package/skills/pdf/scripts/create_validation_image.py +41 -0
- package/skills/pdf/scripts/extract_form_field_info.py +152 -0
- package/skills/pdf/scripts/fill_fillable_fields.py +114 -0
- package/skills/pdf/scripts/fill_pdf_form_with_annotations.py +108 -0
- package/skills/pptx/LICENSE.txt +30 -0
- package/skills/pptx/SKILL.md +487 -0
- package/skills/pptx/html2pptx.md +625 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/pptx/ooxml/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/pptx/ooxml/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/pptx/ooxml/schemas/mce/mc.xsd +75 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/pptx/ooxml/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/pptx/ooxml/scripts/pack.py +159 -0
- package/skills/pptx/ooxml/scripts/unpack.py +29 -0
- package/skills/pptx/ooxml/scripts/validate.py +69 -0
- package/skills/pptx/ooxml/scripts/validation/__init__.py +15 -0
- package/skills/pptx/ooxml/scripts/validation/base.py +951 -0
- package/skills/pptx/ooxml/scripts/validation/docx.py +274 -0
- package/skills/pptx/ooxml/scripts/validation/pptx.py +315 -0
- package/skills/pptx/ooxml/scripts/validation/redlining.py +279 -0
- package/skills/pptx/ooxml.md +427 -0
- package/skills/pptx/scripts/html2pptx.js +979 -0
- package/skills/pptx/scripts/inventory.py +1020 -0
- package/skills/pptx/scripts/rearrange.py +231 -0
- package/skills/pptx/scripts/replace.py +385 -0
- package/skills/pptx/scripts/thumbnail.py +450 -0
- package/skills/project-analyze/SKILL.md +270 -0
- package/skills/project-analyze/phases/phase0-discovery.md +278 -0
- package/skills/project-analyze/phases/phase0.5-prescan.md +139 -0
- package/skills/project-analyze/phases/phase1-inventory.md +94 -0
- package/skills/project-analyze/phases/phase2-deep-analysis.md +249 -0
- package/skills/project-analyze/phases/phase2a-l4-analysis.md +94 -0
- package/skills/project-analyze/phases/phase2b-l5-analysis.md +97 -0
- package/skills/project-analyze/phases/phase3-knowledge-graph.md +120 -0
- package/skills/project-analyze/phases/phase3a-multi-dimensional.md +61 -0
- package/skills/project-analyze/phases/phase4-code-quality.md +81 -0
- package/skills/project-analyze/phases/phase5-synthesis.md +284 -0
- package/skills/project-analyze/phases/phase6-validation.md +179 -0
- package/skills/project-analyze/prompts/code-review-agent.md +122 -0
- package/skills/project-analyze/prompts/deep-analysis-agent.md +107 -0
- package/skills/project-analyze/prompts/inventory-agent.md +67 -0
- package/skills/project-analyze/prompts/l4-analysis-agent.md +98 -0
- package/skills/project-analyze/rules/android.md +282 -0
- package/skills/project-analyze/rules/devops.md +443 -0
- package/skills/project-analyze/rules/generic.md +243 -0
- package/skills/project-analyze/rules/go.md +289 -0
- package/skills/project-analyze/rules/harmony.md +257 -0
- package/skills/project-analyze/rules/java.md +507 -0
- package/skills/project-analyze/rules/mobile-flutter.md +315 -0
- package/skills/project-analyze/rules/mobile-react-native.md +283 -0
- package/skills/project-analyze/rules/mobile-swift.md +323 -0
- package/skills/project-analyze/rules/python.md +317 -0
- package/skills/project-analyze/rules/rust-tauri.md +243 -0
- package/skills/project-analyze/rules/rust.md +296 -0
- package/skills/project-analyze/rules/web-nextjs.md +364 -0
- package/skills/project-analyze/rules/web-react.md +298 -0
- package/skills/project-analyze/rules/web-vue.md +378 -0
- package/skills/project-analyze/rules/web.md +390 -0
- package/skills/project-query/SKILL.md +224 -0
- package/skills/project-query/rules/query-templates.md +212 -0
- package/skills/python-conventions/SKILL.md +169 -0
- package/skills/react-native-conventions/SKILL.md +73 -0
- package/skills/requirements-writer/README.md +153 -0
- package/skills/requirements-writer/SKILL.md +341 -0
- package/skills/requirements-writer/examples/prd-outline-example.md +217 -0
- package/skills/requirements-writer/templates/module-prd-template.md +362 -0
- package/skills/requirements-writer/templates/prd-outline-template.md +185 -0
- package/skills/requirements-writer/templates/user-story-template.md +1125 -0
- package/skills/rust-conventions/SKILL.md +361 -0
- package/skills/smart-dispatch/SKILL.md +296 -0
- package/skills/smart-dispatch/implementer-prompt.md +146 -0
- package/skills/smart-dispatch/reviewer-prompt.md +199 -0
- package/skills/software-architecture/SKILL.md +278 -0
- package/skills/swift-conventions/SKILL.md +72 -0
- package/skills/ui-ux-pro/SKILL.md +140 -0
- package/skills/verification-before-completion/SKILL.md +119 -0
- package/skills/web-conventions/SKILL.md +259 -0
- package/skills/webapp-testing/LICENSE.txt +202 -0
- package/skills/webapp-testing/SKILL.md +97 -0
- package/skills/webapp-testing/examples/console_logging.py +35 -0
- package/skills/webapp-testing/examples/element_discovery.py +40 -0
- package/skills/webapp-testing/examples/static_html_automation.py +33 -0
- package/skills/webapp-testing/scripts/with_server.py +106 -0
- package/skills/writing-plans/SKILL.md +144 -0
- package/skills/xlsx/LICENSE.txt +30 -0
- package/skills/xlsx/SKILL.md +292 -0
- package/skills/xlsx/recalc.py +178 -0
- package/templates/CLAUDE.md.android +57 -0
- package/templates/CLAUDE.md.devops +50 -0
- package/templates/CLAUDE.md.generic +34 -0
- package/templates/CLAUDE.md.go +67 -0
- package/templates/CLAUDE.md.harmony +54 -0
- package/templates/CLAUDE.md.java +56 -0
- package/templates/CLAUDE.md.mobile-flutter +38 -0
- package/templates/CLAUDE.md.mobile-react-native +37 -0
- package/templates/CLAUDE.md.mobile-swift +40 -0
- package/templates/CLAUDE.md.python +65 -0
- package/templates/CLAUDE.md.rust +68 -0
- package/templates/CLAUDE.md.rust-tauri +120 -0
- package/templates/CLAUDE.md.web +63 -0
- package/templates/COMPONENT.md.android +58 -0
- package/templates/COMPONENT.md.devops +54 -0
- package/templates/COMPONENT.md.generic +35 -0
- package/templates/COMPONENT.md.go +59 -0
- package/templates/COMPONENT.md.harmony +63 -0
- package/templates/COMPONENT.md.java +69 -0
- package/templates/COMPONENT.md.mobile-flutter +56 -0
- package/templates/COMPONENT.md.mobile-react-native +55 -0
- package/templates/COMPONENT.md.mobile-swift +56 -0
- package/templates/COMPONENT.md.python +67 -0
- package/templates/COMPONENT.md.rust +57 -0
- package/templates/COMPONENT.md.rust-tauri +66 -0
- package/templates/COMPONENT.md.web +39 -0
- package/templates/README.md.android +71 -0
- package/templates/README.md.devops +68 -0
- package/templates/README.md.generic +39 -0
- package/templates/README.md.go +70 -0
- package/templates/README.md.harmony +72 -0
- package/templates/README.md.java +73 -0
- package/templates/README.md.mobile-flutter +69 -0
- package/templates/README.md.mobile-react-native +65 -0
- package/templates/README.md.mobile-swift +69 -0
- package/templates/README.md.monorepo +59 -0
- package/templates/README.md.python +66 -0
- package/templates/README.md.rust +69 -0
- package/templates/README.md.rust-tauri +149 -0
- package/templates/README.md.web +94 -0
- package/templates/UI_STYLE.md.android +74 -0
- package/templates/UI_STYLE.md.devops +50 -0
- package/templates/UI_STYLE.md.generic +31 -0
- package/templates/UI_STYLE.md.go +49 -0
- package/templates/UI_STYLE.md.harmony +71 -0
- package/templates/UI_STYLE.md.java +61 -0
- package/templates/UI_STYLE.md.mobile-flutter +70 -0
- package/templates/UI_STYLE.md.mobile-react-native +71 -0
- package/templates/UI_STYLE.md.mobile-swift +71 -0
- package/templates/UI_STYLE.md.python +58 -0
- package/templates/UI_STYLE.md.rust +52 -0
- package/templates/UI_STYLE.md.rust-tauri +102 -0
- package/templates/UI_STYLE.md.web +92 -0
- package/templates/cursor-rules.android.mdc +33 -0
- package/templates/cursor-rules.devops.mdc +32 -0
- package/templates/cursor-rules.generic.mdc +25 -0
- package/templates/cursor-rules.go.mdc +34 -0
- package/templates/cursor-rules.harmony.mdc +30 -0
- package/templates/cursor-rules.java.mdc +30 -0
- package/templates/cursor-rules.mobile-flutter.mdc +42 -0
- package/templates/cursor-rules.mobile-react-native.mdc +43 -0
- package/templates/cursor-rules.mobile-swift.mdc +42 -0
- package/templates/cursor-rules.python.mdc +33 -0
- package/templates/cursor-rules.rust-tauri.mdc +67 -0
- package/templates/cursor-rules.rust.mdc +30 -0
- package/templates/cursor-rules.web.mdc +30 -0
- package/templates/kiro-steering.android.md +39 -0
- package/templates/kiro-steering.devops.md +32 -0
- package/templates/kiro-steering.generic.md +28 -0
- package/templates/kiro-steering.go.md +41 -0
- package/templates/kiro-steering.harmony.md +36 -0
- package/templates/kiro-steering.java.md +37 -0
- package/templates/kiro-steering.mobile-flutter.md +73 -0
- package/templates/kiro-steering.mobile-react-native.md +71 -0
- package/templates/kiro-steering.mobile-swift.md +62 -0
- package/templates/kiro-steering.python.md +34 -0
- package/templates/kiro-steering.rust-tauri.md +50 -0
- package/templates/kiro-steering.rust.md +36 -0
- package/templates/kiro-steering.web.md +41 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dead-code-detection
|
|
3
|
+
dimension: dead-code
|
|
4
|
+
weight: 0.20
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
> **栈级规范:** 框架特定的死代码模式(如未使用的 Spring Bean、未注册的组件)参考对应 `{stack}-conventions` skill。
|
|
8
|
+
|
|
9
|
+
# 死代码检测规则
|
|
10
|
+
|
|
11
|
+
## 检测维度
|
|
12
|
+
|
|
13
|
+
### 1. 未使用的函数/方法
|
|
14
|
+
|
|
15
|
+
**严重度定义:**
|
|
16
|
+
- Critical: 私有/内部函数,无任何调用点
|
|
17
|
+
- Warning: 导出函数,仅在定义文件中存在,外部无引用
|
|
18
|
+
- Info: 仅在测试文件中使用的生产代码函数
|
|
19
|
+
|
|
20
|
+
**检测方法:**
|
|
21
|
+
1. 提取所有函数/方法声明及其可见性(public/private/export)
|
|
22
|
+
2. 在项目所有文件中搜索每个函数的调用
|
|
23
|
+
3. 排除:递归调用自身、接口实现(即使未直接调用)、框架入口(main、handler、middleware)
|
|
24
|
+
4. 特殊处理:
|
|
25
|
+
- Rust: `#[cfg(test)]` 中的函数不算死代码
|
|
26
|
+
- Python: 以 `_` 开头的函数视为私有
|
|
27
|
+
- Java: `private` 方法无外部调用即为死代码
|
|
28
|
+
- JavaScript/TypeScript: 仅在 `export` 的函数才算"导出"
|
|
29
|
+
|
|
30
|
+
**框架入口豁免列表(不算死代码):**
|
|
31
|
+
- `main()`, `init()`, `setup()`, `configure()`
|
|
32
|
+
- HTTP handler 函数(路由注解标记的)
|
|
33
|
+
- 事件监听器/订阅者
|
|
34
|
+
- 数据库 migration 函数
|
|
35
|
+
- React/Vue 组件的 `render`/`setup` 生命周期
|
|
36
|
+
|
|
37
|
+
### 2. 未使用的 import/require
|
|
38
|
+
|
|
39
|
+
**严重度:Warning**
|
|
40
|
+
|
|
41
|
+
**检测方法:**
|
|
42
|
+
1. 提取文件顶部所有 `import`/`require`/`use`/`#include` 语句
|
|
43
|
+
2. 在文件剩余部分搜索每个导入符号的使用
|
|
44
|
+
3. 排除:
|
|
45
|
+
- 类型导入(TypeScript `import type`,仅类型上下文中使用)
|
|
46
|
+
- 副作用导入(`import 'side-effect'`,如 CSS、polyfill)
|
|
47
|
+
- re-export(`export { X } from '...'`)
|
|
48
|
+
- 宏导入(Rust `#[macro_use]`)
|
|
49
|
+
|
|
50
|
+
### 3. 不可达代码 (Unreachable Code)
|
|
51
|
+
|
|
52
|
+
**严重度:Critical**
|
|
53
|
+
|
|
54
|
+
**检测模式:**
|
|
55
|
+
- `return`/`throw`/`break`/`continue` 语句后的代码
|
|
56
|
+
- `if (false)` / `if (0)` 条件块
|
|
57
|
+
- `else` 分支在 `if (true)` 之后
|
|
58
|
+
- `unreachable!()` / `throw new Error()` 之后
|
|
59
|
+
- `panic!()` / `assert!(false)` 之后
|
|
60
|
+
- 永假条件:`if (CONST_FALSE)` / `if (DEBUG && !DEBUG)`
|
|
61
|
+
|
|
62
|
+
### 4. 注释掉的代码块
|
|
63
|
+
|
|
64
|
+
**严重度:Info**
|
|
65
|
+
|
|
66
|
+
**检测模式:**
|
|
67
|
+
- 连续 >5 行的注释,其中包含可识别的代码模式(变量声明、函数调用、控制结构)
|
|
68
|
+
- 块注释 `/* ... */` 中包含完整函数或类定义
|
|
69
|
+
- 特殊标记:`// TODO: remove`、`// DEPRECATED`、`// OLD` 后跟代码
|
|
70
|
+
|
|
71
|
+
### 5. 未被引用的导出
|
|
72
|
+
|
|
73
|
+
**严重度:Warning**
|
|
74
|
+
|
|
75
|
+
**检测方法:**
|
|
76
|
+
1. 收集所有 `export`/`pub` 声明的符号
|
|
77
|
+
2. 在项目其他文件中搜索这些符号的引用
|
|
78
|
+
3. 排除:
|
|
79
|
+
- 框架约定的导出(React 组件 default export、Next.js page export)
|
|
80
|
+
- 库项目的公开 API(设计上就是给外部使用的)
|
|
81
|
+
- 插件/钩子注册函数
|
|
82
|
+
|
|
83
|
+
## 评分算法
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
dead_code_score = 0
|
|
87
|
+
|
|
88
|
+
for each issue:
|
|
89
|
+
if Critical: dead_code_score += 20
|
|
90
|
+
if Warning: dead_code_score += 8
|
|
91
|
+
if Info: dead_code_score += 2
|
|
92
|
+
|
|
93
|
+
estimated_dead_lines = sum of affected code ranges
|
|
94
|
+
|
|
95
|
+
normalized = min(dead_code_score / (total_files * 5) * 100, 100)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## 报告章节模板
|
|
99
|
+
|
|
100
|
+
```markdown
|
|
101
|
+
### 死代码检测 (Score: {score}/100)
|
|
102
|
+
|
|
103
|
+
发现 {count} 处死代码,估计约 {lines} 行(占代码库 {percentage}%):
|
|
104
|
+
- 未使用函数:{n} 个
|
|
105
|
+
- 未使用导入:{n} 个
|
|
106
|
+
- 不可达代码:{n} 处
|
|
107
|
+
- 注释掉的代码:{n} 处
|
|
108
|
+
- 未引用的导出:{n} 个
|
|
109
|
+
|
|
110
|
+
{issue_table}
|
|
111
|
+
|
|
112
|
+
**清理建议:**
|
|
113
|
+
1. 可安全删除的死代码:{n} 处(共约 {lines} 行)
|
|
114
|
+
2. 需确认后删除:{n} 处
|
|
115
|
+
```
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deprecation-debt
|
|
3
|
+
dimension: deprecation-debt
|
|
4
|
+
weight: 0.10
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
> **栈级规范:** 已废弃 API 和过时模式因栈而异,参考对应 `{stack}-conventions` skill 的版本迁移指南。
|
|
8
|
+
|
|
9
|
+
# 废弃代码与技术债务分析规则
|
|
10
|
+
|
|
11
|
+
本维度检测已废弃的 API、过时的依赖模式、积累的技术债务,以及应被迁移的旧模式。
|
|
12
|
+
|
|
13
|
+
## 1. 已废弃 API 使用检测
|
|
14
|
+
|
|
15
|
+
### 1.1 Java/Spring 废弃 API
|
|
16
|
+
|
|
17
|
+
| API | 废弃版本 | 替代方案 | 严重度 |
|
|
18
|
+
|-----|---------|---------|--------|
|
|
19
|
+
| `new Date()` | Java 1.1 | `java.time.LocalDate/LocalDateTime` | Warning |
|
|
20
|
+
| `java.util.Calendar` | Java 1.1 | `java.time.*` | Warning |
|
|
21
|
+
| `StringBuffer`(非并发场景) | — | `StringBuilder` | Info |
|
|
22
|
+
| `java.util.Stack` | — | `Deque` / `ArrayDeque` | Info |
|
|
23
|
+
| `javax.*` (部分) | Java 9+ | `jakarta.*` | Warning |
|
|
24
|
+
| `@Deprecated` 注解的方法 | — | 查看 Javadoc 中的替代方案 | Warning |
|
|
25
|
+
| `spring-webmvc` 中废弃的 `WebMvcConfigurerAdapter` | Spring 5.0 | 实现 `WebMvcConfigurer` 接口 | Warning |
|
|
26
|
+
| `spring-security` 中废弃的 `WebSecurityConfigurerAdapter` | Spring 5.7 | 组件化配置 `SecurityFilterChain` | Warning |
|
|
27
|
+
| `JdbcTemplate` 直接 queryForList(String) | — | 使用 `RowMapper` 或 `BeanPropertyRowMapper` | Info |
|
|
28
|
+
| `java.util.Observable` | Java 9 | `java.util.concurrent.Flow` 或 RxJava/Reactor | Warning |
|
|
29
|
+
|
|
30
|
+
### 1.2 JavaScript/TypeScript 废弃 API
|
|
31
|
+
|
|
32
|
+
| API | 废弃版本 | 替代方案 | 严重度 |
|
|
33
|
+
|-----|---------|---------|--------|
|
|
34
|
+
| `componentWillMount` | React 16.3 | `useEffect` / `componentDidMount` | Critical |
|
|
35
|
+
| `componentWillReceiveProps` | React 16.3 | `getDerivedStateFromProps` / `useEffect` | Critical |
|
|
36
|
+
| `componentWillUpdate` | React 16.3 | `getSnapshotBeforeUpdate` / `useEffect` | Critical |
|
|
37
|
+
| `string refs` (`ref="myRef"`) | React 16.3 | `React.createRef()` / `useRef` | Critical |
|
|
38
|
+
| `ReactDOM.render` | React 18 | `createRoot().render()` | Critical |
|
|
39
|
+
| `moment.js` | — | `dayjs` / `date-fns` / `temporal` | Warning |
|
|
40
|
+
| `request` (npm package) | 2020 | `node-fetch` / `axios` / `undici` | Warning |
|
|
41
|
+
| `jQuery.ajax` | — | `fetch` / `axios` | Warning |
|
|
42
|
+
| `var` 声明 | ES6 | `let` / `const` | Info |
|
|
43
|
+
| `arguments` 对象 | ES6 | 剩余参数 `...args` | Info |
|
|
44
|
+
|
|
45
|
+
### 1.3 Vue 废弃 API
|
|
46
|
+
|
|
47
|
+
| API | 废弃版本 | 替代方案 | 严重度 |
|
|
48
|
+
|-----|---------|---------|--------|
|
|
49
|
+
| Vue 2 Options API | Vue 3 | Composition API + `setup()` | Warning |
|
|
50
|
+
| `Vue.filter` | Vue 3 | 计算属性或方法 | Critical |
|
|
51
|
+
| `Vue.mixin` | Vue 3 | Composables (`use*`) | Warning |
|
|
52
|
+
| `Vuex` | — | `Pinia` | Warning |
|
|
53
|
+
| `$on/$off/$once` | Vue 3 | `mitt` / `useEventBus` composable | Critical |
|
|
54
|
+
| `$children` | Vue 3 | `ref` + `defineExpose` | Warning |
|
|
55
|
+
| `$destroy` | Vue 3 | 由框架管理生命周期 | Critical |
|
|
56
|
+
| `Vue.set` / `Vue.delete` | Vue 3 | 直接赋值(Vue 3 响应式代理) | Critical |
|
|
57
|
+
|
|
58
|
+
### 1.4 Python 废弃 API
|
|
59
|
+
|
|
60
|
+
| API | 废弃版本 | 替代方案 | 严重度 |
|
|
61
|
+
|-----|---------|---------|--------|
|
|
62
|
+
| `print` statement (Python 2) | Python 3.0 | `print()` 函数 | Critical |
|
|
63
|
+
| `urllib2` | Python 3.0 | `urllib.request` | Warning |
|
|
64
|
+
| `StringIO` (C implementation) | Python 3.0 | `io.StringIO` | Warning |
|
|
65
|
+
| `ConfigParser` | Python 3.0 | `configparser` | Info |
|
|
66
|
+
| `pickle` in security contexts | — | `json` / `msgpack` / `protobuf` | Warning |
|
|
67
|
+
| `eval()` / `exec()` on user input | — | `ast.literal_eval()` / 安全解析器 | Critical |
|
|
68
|
+
| `datetime.datetime.now()` without tz | — | `datetime.datetime.now(tz=...)` | Info |
|
|
69
|
+
| `os.system()` | — | `subprocess.run()` | Warning |
|
|
70
|
+
|
|
71
|
+
### 1.5 Go 废弃 API
|
|
72
|
+
|
|
73
|
+
| API | 废弃版本 | 替代方案 | 严重度 |
|
|
74
|
+
|-----|---------|---------|--------|
|
|
75
|
+
| `io/ioutil` 包 | Go 1.16 | `io` + `os` 包的对应函数 | Warning |
|
|
76
|
+
| `context.WithDeadline` with zero time | — | 检查 time 是否为零值 | Info |
|
|
77
|
+
| `(*os.File).Readdir` | Go 1.16 | `(*os.File).ReadDir` | Warning |
|
|
78
|
+
|
|
79
|
+
### 1.6 Rust 废弃 API
|
|
80
|
+
|
|
81
|
+
| API | 废弃版本 | 替代方案 | 严重度 |
|
|
82
|
+
|-----|---------|---------|--------|
|
|
83
|
+
| `try!` macro | Rust 1.39 | `?` operator | Warning |
|
|
84
|
+
| `Error::description()` | — | `Display` trait | Info |
|
|
85
|
+
| `std::sync::ONCE_INIT` | Rust 1.63 | `Once::new()` const | Info |
|
|
86
|
+
|
|
87
|
+
### 1.7 检测方法
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
# Java: 扫描 @Deprecated 注解
|
|
91
|
+
grep -rn '@Deprecated' --include='*.java' {path}
|
|
92
|
+
|
|
93
|
+
# React: 扫描废弃生命周期
|
|
94
|
+
grep -rn 'componentWillMount\|componentWillReceiveProps\|componentWillUpdate' --include='*.{js,jsx,ts,tsx}' {path}
|
|
95
|
+
|
|
96
|
+
# Vue: 扫描 Vuex 使用
|
|
97
|
+
grep -rn 'from.*vuex\|import.*vuex\|Vue.use(Vuex)' --include='*.{js,ts,vue}' {path}
|
|
98
|
+
|
|
99
|
+
# Python: 扫描不安全 API
|
|
100
|
+
grep -rn 'eval(\|exec(\|os.system(' --include='*.py' {path}
|
|
101
|
+
|
|
102
|
+
# Go: 扫描 ioutil
|
|
103
|
+
grep -rn 'ioutil\.' --include='*.go' {path}
|
|
104
|
+
|
|
105
|
+
# 通用: 扫描 TODO/FIXME/HACK/XXX
|
|
106
|
+
grep -rn 'TODO\|FIXME\|HACK\|XXX\|DEPRECATED' --include='*.{java,py,js,ts,go,rs,vue,jsx,tsx}' {path}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## 2. TODO/FIXME/HACK 老化分析
|
|
110
|
+
|
|
111
|
+
### 2.1 老化估算方法
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
# 使用 git blame 获取注释添加日期
|
|
115
|
+
git log --format="%ai" -L /TODO/,+1:{file}
|
|
116
|
+
|
|
117
|
+
# 老化分类
|
|
118
|
+
age < 30 days → 新增(可忽略)
|
|
119
|
+
age 30-180 days → 积累中(Info)
|
|
120
|
+
age 180-365 days → 老化(Warning)
|
|
121
|
+
age > 365 days → 严重老化(Critical,可能是永久性技术债务)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### 2.2 分类统计
|
|
125
|
+
|
|
126
|
+
| 标记 | 含义 | 默认严重度 |
|
|
127
|
+
|------|------|-----------|
|
|
128
|
+
| `TODO` | 计划完成的待办 | Info(根据老化升级) |
|
|
129
|
+
| `FIXME` | 需要修复的已知问题 | Warning |
|
|
130
|
+
| `HACK` | 临时解决方案 | Warning |
|
|
131
|
+
| `XXX` | 危险或有问题的代码 | Warning |
|
|
132
|
+
| `DEPRECATED` | 标记为废弃的代码 | Warning |
|
|
133
|
+
| `WORKAROUND` | 绕过问题的临时方案 | Info |
|
|
134
|
+
|
|
135
|
+
### 2.3 输出
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
| 文件 | 行 | 标记 | 内容 | 年龄 | 严重度 |
|
|
139
|
+
|------|-----|------|------|------|--------|
|
|
140
|
+
| auth.ts | 45 | FIXME | null check needed | 245 days | Warning |
|
|
141
|
+
| order.go | 112 | TODO | add retry logic | 45 days | Info |
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## 3. 过时依赖模式检测
|
|
145
|
+
|
|
146
|
+
### 3.1 前端框架迁移
|
|
147
|
+
|
|
148
|
+
| 旧模式 | 新模式 | 检测方法 | 严重度 |
|
|
149
|
+
|--------|--------|----------|--------|
|
|
150
|
+
| Class Components (React) | Function Components + Hooks | `class X extends Component\|class X extends React.Component` | Warning |
|
|
151
|
+
| Vuex Store | Pinia Store | `import.*from.*vuex\|new Vuex.Store` | Warning |
|
|
152
|
+
| Options API (Vue) | Composition API | `export default { data(), methods: {}, computed: {} }` (no `setup`) | Info |
|
|
153
|
+
| moment.js | dayjs/date-fns | `import.*moment\|require('moment')` | Warning |
|
|
154
|
+
| axios (新项目) | fetch/ky | `import.*axios` (检查 package.json 是否有其他 HTTP 库) | Info |
|
|
155
|
+
| CSS-in-JS (styled-components) | Tailwind CSS / CSS Modules | 项目同时使用多种样式方案时标记 | Info |
|
|
156
|
+
| Enzyme | React Testing Library | `import.*enzyme` | Warning |
|
|
157
|
+
|
|
158
|
+
### 3.2 后端框架迁移
|
|
159
|
+
|
|
160
|
+
| 旧模式 | 新模式 | 检测方法 | 严重度 |
|
|
161
|
+
|--------|--------|----------|--------|
|
|
162
|
+
| Spring WebMvcConfigurerAdapter | WebMvcConfigurer | `extends WebMvcConfigurerAdapter` | Warning |
|
|
163
|
+
| Spring WebSecurityConfigurerAdapter | SecurityFilterChain Bean | `extends WebSecurityConfigurerAdapter` | Warning |
|
|
164
|
+
| JPA `findOne()` | `findById()` | `.findOne\(` in Java files | Warning |
|
|
165
|
+
| MyBatis XML Mapper | MyBatis-Plus / JPA | 检查 XML Mapper 文件数量 vs 注解 Mapper | Info |
|
|
166
|
+
| Java EE `javax.*` | Jakarta EE `jakarta.*` | `import javax.\*` in Java 11+ projects | Warning |
|
|
167
|
+
|
|
168
|
+
### 3.3 Python 模式迁移
|
|
169
|
+
|
|
170
|
+
| 旧模式 | 新模式 | 检测方法 | 严重度 |
|
|
171
|
+
|--------|--------|----------|--------|
|
|
172
|
+
| `requirements.txt` | `pyproject.toml` | 项目无 pyproject.toml | Info |
|
|
173
|
+
| `setup.py` | `pyproject.toml` | 存在 setup.py 但无 pyproject.toml | Info |
|
|
174
|
+
| Flask `@app.route` | FastAPI | 新项目仍使用 Flask | Info |
|
|
175
|
+
| unittest | pytest | `import unittest` | Info |
|
|
176
|
+
| `__init__.py` 重导出 | explicit imports | 检查 `__init__.py` 中的 `from . import *` | Info |
|
|
177
|
+
|
|
178
|
+
## 4. 废弃代码段识别
|
|
179
|
+
|
|
180
|
+
### 4.1 检测规则
|
|
181
|
+
|
|
182
|
+
| 模式 | 严重度 | 判定标准 |
|
|
183
|
+
|------|--------|----------|
|
|
184
|
+
| 被注释掉的代码块 | Warning | >5 行连续注释且包含代码特征(变量赋值、函数调用、控制结构) |
|
|
185
|
+
| `@Deprecated` 标注但未删除 | Warning | 类/方法有废弃标记但仍在代码中 |
|
|
186
|
+
| 未被引用的导出 | Warning | export/public 的类/函数/模块无任何引用(结合知识图谱判断) |
|
|
187
|
+
| 死路由 | Critical | 路由定义存在但无对应页面/组件 |
|
|
188
|
+
| 空实现 | Warning | 接口/抽象方法只有 `pass`/`{}`/`throw new UnsupportedOperationException` |
|
|
189
|
+
| 测试中的 `@Ignore`/`skip` | Warning | 被跳过的测试(可能对应废弃功能) |
|
|
190
|
+
|
|
191
|
+
### 4.2 废弃原因推断
|
|
192
|
+
|
|
193
|
+
对检测到的废弃代码,推断废弃原因:
|
|
194
|
+
|
|
195
|
+
| 推断方法 | 废弃原因 |
|
|
196
|
+
|----------|----------|
|
|
197
|
+
| 功能有新版本实现 | 被替代(新旧代码共存,应清理旧代码) |
|
|
198
|
+
| 配置中无引用 | 功能已下线(路由、菜单、权限中均无引用) |
|
|
199
|
+
| 测试被跳过 | 功能损坏(测试被 skip 而非删除) |
|
|
200
|
+
| 仅有入口无完整链路 | 功能未完成(有 API 定义但无实现) |
|
|
201
|
+
| 被条件编译排除 | 平台特定代码(合理的保留) |
|
|
202
|
+
|
|
203
|
+
## 评分算法
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
debt_score = 0
|
|
207
|
+
|
|
208
|
+
# 废弃 API 使用
|
|
209
|
+
for each deprecated API usage:
|
|
210
|
+
if Critical: debt_score += 20
|
|
211
|
+
if Warning: debt_score += 8
|
|
212
|
+
if Info: debt_score += 2
|
|
213
|
+
|
|
214
|
+
# TODO/FIXME 老化
|
|
215
|
+
for each TODO/FIXME:
|
|
216
|
+
if age > 365 days: debt_score += 15 # Critical
|
|
217
|
+
if age > 180 days: debt_score += 8 # Warning
|
|
218
|
+
if age > 30 days: debt_score += 2 # Info
|
|
219
|
+
|
|
220
|
+
# 过时依赖模式
|
|
221
|
+
for each outdated pattern:
|
|
222
|
+
if Critical: debt_score += 15
|
|
223
|
+
if Warning: debt_score += 8
|
|
224
|
+
if Info: debt_score += 2
|
|
225
|
+
|
|
226
|
+
# 废弃代码
|
|
227
|
+
for each deprecated code block:
|
|
228
|
+
if Critical: debt_score += 15
|
|
229
|
+
if Warning: debt_score += 5
|
|
230
|
+
if Info: debt_score += 2
|
|
231
|
+
|
|
232
|
+
# 标准化
|
|
233
|
+
normalized = min(debt_score / max(total_source_files, 1) * 5, 100)
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## 报告章节模板
|
|
237
|
+
|
|
238
|
+
```markdown
|
|
239
|
+
### 废弃代码与技术债务 (Score: {score}/100)
|
|
240
|
+
|
|
241
|
+
**技术债务概况:**
|
|
242
|
+
- 已废弃 API 使用:{count} 处
|
|
243
|
+
- 过时依赖模式:{count} 处
|
|
244
|
+
- TODO/FIXME 积压:{count} 个(其中严重老化 {n} 个)
|
|
245
|
+
- 废弃代码段:{count} 处(估计 {lines} 行)
|
|
246
|
+
|
|
247
|
+
#### 已废弃 API 使用
|
|
248
|
+
|
|
249
|
+
| 严重度 | 文件 | 行 | 废弃 API | 替代方案 | 迁移复杂度 |
|
|
250
|
+
|--------|------|-----|---------|---------|-----------|
|
|
251
|
+
| Critical | App.tsx | 45 | ReactDOM.render | createRoot().render() | 低 |
|
|
252
|
+
| Warning | UserService.java | 78 | WebSecurityConfigurerAdapter | SecurityFilterChain | 中 |
|
|
253
|
+
|
|
254
|
+
#### TODO/FIXME 老化分析
|
|
255
|
+
|
|
256
|
+
| 严重度 | 文件 | 行 | 标记 | 内容 | 年龄 | 处理建议 |
|
|
257
|
+
|--------|------|-----|------|------|------|---------|
|
|
258
|
+
| Warning | auth.go | 89 | FIXME | race condition | 245 days | 优先修复 |
|
|
259
|
+
| Info | utils.ts | 23 | TODO | add caching | 45 days | 计划中 |
|
|
260
|
+
|
|
261
|
+
#### 过时依赖模式
|
|
262
|
+
|
|
263
|
+
| 当前模式 | 推荐替代 | 影响文件数 | 迁移复杂度 | 建议 |
|
|
264
|
+
|----------|---------|-----------|-----------|------|
|
|
265
|
+
| Vuex | Pinia | 12 | 中 | 逐步迁移,新代码用 Pinia |
|
|
266
|
+
| Class Components | Hooks | 8 | 低 | 新组件用函数式 |
|
|
267
|
+
|
|
268
|
+
#### 废弃代码段
|
|
269
|
+
|
|
270
|
+
| 文件 | 行 | 类型 | 推断原因 | 建议 |
|
|
271
|
+
|------|-----|------|---------|------|
|
|
272
|
+
| old-api.ts | 1-45 | 注释代码 | 被替代 | 删除 |
|
|
273
|
+
| LegacyService.java | 全文件 | @Deprecated | 功能下线 | 删除(无引用) |
|
|
274
|
+
|
|
275
|
+
**清理优先级建议:**
|
|
276
|
+
1. {Critical 级别废弃 API 的迁移计划}
|
|
277
|
+
2. {严重老化 TODO 的处理建议}
|
|
278
|
+
3. {无引用废弃代码的删除建议}
|
|
279
|
+
```
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-duplication
|
|
3
|
+
dimension: duplication
|
|
4
|
+
weight: 0.20
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
> **栈级规范:** 框架特定的抽象模式和代码复用约定参考对应 `{stack}-conventions` skill。
|
|
8
|
+
|
|
9
|
+
# 代码重复检测规则
|
|
10
|
+
|
|
11
|
+
## 检测维度
|
|
12
|
+
|
|
13
|
+
### 1. 相同/相似代码块
|
|
14
|
+
|
|
15
|
+
**严重度:**
|
|
16
|
+
- Warning: 相似代码块 >6行,出现 3+ 次或 >10行出现 2+ 次
|
|
17
|
+
- Info: 相似代码块 4-6行,出现 2+ 次
|
|
18
|
+
|
|
19
|
+
**检测方法:**
|
|
20
|
+
1. 逐文件提取连续代码块(以函数/方法为单位)
|
|
21
|
+
2. 比较不同文件、不同函数间的代码块
|
|
22
|
+
3. "相似"定义:结构相同(相同的控制流和操作序列),仅变量名/字面量不同
|
|
23
|
+
4. 排除:
|
|
24
|
+
- 不可避免的样板代码(getter/setter、配置声明)
|
|
25
|
+
- 不同模块中的接口实现(相同签名但不同行为)
|
|
26
|
+
- 测试文件中的重复(测试数据准备代码)
|
|
27
|
+
|
|
28
|
+
**相似度判断标准:**
|
|
29
|
+
```
|
|
30
|
+
similarity = matching_tokens / total_tokens
|
|
31
|
+
- >90%: 几乎完全相同(仅变量名不同)
|
|
32
|
+
- 70-90%: 结构相似(有少量逻辑差异)
|
|
33
|
+
- <70%: 不算重复
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### 2. 相似函数体
|
|
37
|
+
|
|
38
|
+
**严重度:Warning**
|
|
39
|
+
|
|
40
|
+
**检测方法:**
|
|
41
|
+
1. 提取每个函数/方法的"结构签名"——忽略变量名、字面量,只保留:
|
|
42
|
+
- 控制流结构(if/for/while/switch)
|
|
43
|
+
- 函数调用模式(调用哪些函数/API)
|
|
44
|
+
- 操作序列(读→转换→写)
|
|
45
|
+
2. 比较函数间的结构签名
|
|
46
|
+
3. 相同签名的函数体视为可合并候选
|
|
47
|
+
|
|
48
|
+
### 3. 可合并的重复逻辑
|
|
49
|
+
|
|
50
|
+
**严重度:Info**
|
|
51
|
+
|
|
52
|
+
**检测模式:**
|
|
53
|
+
- 多处相同的错误处理逻辑(相同 try-catch 结构)
|
|
54
|
+
- 相同的数据转换/格式化代码
|
|
55
|
+
- 重复的配置/常量定义
|
|
56
|
+
- 相同的 API 调用模式(URL 不同但请求处理相同)
|
|
57
|
+
- 重复的类型/接口定义(字段基本相同)
|
|
58
|
+
|
|
59
|
+
### 4. 抽象不足
|
|
60
|
+
|
|
61
|
+
**严重度:Info**
|
|
62
|
+
|
|
63
|
+
**检测模式:**
|
|
64
|
+
- 同一文件中有 3+ 个函数做类似的事情(仅在输入类型或参数上不同)
|
|
65
|
+
- 大量 switch/case 或 if-else 链处理不同类型但执行类似操作
|
|
66
|
+
- "复制-修改-粘贴"痕迹:函数名相似,体相似,仅个别行不同
|
|
67
|
+
- 相同的业务逻辑散落在不同层(controller、service、repository 都做了相同的数据校验)
|
|
68
|
+
|
|
69
|
+
## 评分算法
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
duplication_score = 0
|
|
73
|
+
|
|
74
|
+
for each duplication:
|
|
75
|
+
lines_affected = sum of duplicated block sizes
|
|
76
|
+
if similarity > 90% and occurrences >= 3:
|
|
77
|
+
duplication_score += occurrences * lines_affected * 0.5
|
|
78
|
+
elif similarity > 90% and occurrences >= 2:
|
|
79
|
+
duplication_score += occurrences * lines_affected * 0.3
|
|
80
|
+
elif similarity > 70% and occurrences >= 3:
|
|
81
|
+
duplication_score += occurrences * lines_affected * 0.2
|
|
82
|
+
else:
|
|
83
|
+
duplication_score += lines_affected * 0.1
|
|
84
|
+
|
|
85
|
+
normalized = min(duplication_score / total_code_lines * 100, 100)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## 报告章节模板
|
|
89
|
+
|
|
90
|
+
```markdown
|
|
91
|
+
### 代码重复 (Score: {score}/100)
|
|
92
|
+
|
|
93
|
+
发现 {count} 处代码重复,涉及约 {lines} 行代码:
|
|
94
|
+
- 高相似度代码块:{n} 处
|
|
95
|
+
- 相似函数:{n} 对
|
|
96
|
+
- 可合并逻辑:{n} 处
|
|
97
|
+
- 抽象不足:{n} 处
|
|
98
|
+
|
|
99
|
+
{issue_table}
|
|
100
|
+
|
|
101
|
+
**重构建议:**
|
|
102
|
+
1. {highest_impact_duplication} → 提取为 {suggested_function_name}()
|
|
103
|
+
2. {second_highest} → 使用 {pattern_name} 模式统一
|
|
104
|
+
```
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: error-security
|
|
3
|
+
dimension: error-security
|
|
4
|
+
weight: 0.30
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
> **栈级规范:** 错误处理模式和安全隐患栈级差异较大,参考对应 `{stack}-conventions` skill 的错误处理和安全章节。
|
|
8
|
+
|
|
9
|
+
# 错误处理与安全分析规则
|
|
10
|
+
|
|
11
|
+
## 检测维度
|
|
12
|
+
|
|
13
|
+
### 1. 硬编码凭证 (Hardcoded Secrets)
|
|
14
|
+
|
|
15
|
+
**严重度:Critical**(最高优先级,每处都必须修复)
|
|
16
|
+
|
|
17
|
+
**检测模式:**
|
|
18
|
+
- 字符串中包含 API key / token / password / secret 字面量
|
|
19
|
+
- URL 中嵌入用户名密码(`user:pass@host`)
|
|
20
|
+
- 代码中的 AWS Access Key / Secret Key
|
|
21
|
+
- 数据库连接字符串中的明文密码
|
|
22
|
+
- JWT secret 硬编码
|
|
23
|
+
- OAuth client_secret 硬编码
|
|
24
|
+
- 加密密钥硬编码
|
|
25
|
+
|
|
26
|
+
**排除(不算问题):**
|
|
27
|
+
- 示例/占位符值(`your-api-key-here`, `REPLACE_ME`, `xxx`)
|
|
28
|
+
- 配置文件中的变量引用(`process.env.API_KEY`, `cfg.get("api_key")`)
|
|
29
|
+
- 测试文件中的 mock key
|
|
30
|
+
- 公开的客户端 ID(如 Google OAuth client_id)
|
|
31
|
+
|
|
32
|
+
### 2. 空 catch/except 块
|
|
33
|
+
|
|
34
|
+
**严重度:Critical**
|
|
35
|
+
|
|
36
|
+
**检测模式:**
|
|
37
|
+
- `catch (e) {}` / `except:` 后无任何语句
|
|
38
|
+
- `catch` 块仅有注释(如 `// ignore`)
|
|
39
|
+
- `catch` 块仅打印日志但不处理错误
|
|
40
|
+
- Rust: `let _ = result;`(显式忽略错误但无注释说明原因)
|
|
41
|
+
|
|
42
|
+
**例外(可接受的静默忽略):**
|
|
43
|
+
- 已有注释说明为什么忽略(如 `// Expected for non-critical optional feature`)
|
|
44
|
+
- `Err(ref e) if e.kind() == ErrorKind::NotFound` 等条件性忽略
|
|
45
|
+
- 并发场景中预期会失败的 try-lock
|
|
46
|
+
|
|
47
|
+
### 3. SQL 注入风险
|
|
48
|
+
|
|
49
|
+
**严重度:Critical**
|
|
50
|
+
|
|
51
|
+
**检测模式:**
|
|
52
|
+
- 字符串拼接构建 SQL:`"SELECT * FROM " + table + " WHERE id = " + id`
|
|
53
|
+
- f-string/format 构建查询:`f"SELECT * FROM users WHERE name = '{name}'"`
|
|
54
|
+
- 未参数化的原始查询:`cursor.execute(sql_string)` 其中 sql_string 含用户输入
|
|
55
|
+
- ORM 中的 `raw()` / `rawQuery()` 使用字符串拼接
|
|
56
|
+
|
|
57
|
+
### 4. 未验证的用户输入
|
|
58
|
+
|
|
59
|
+
**严重度:Critical**
|
|
60
|
+
|
|
61
|
+
**检测模式:**
|
|
62
|
+
- HTTP 请求参数直接用于数据库查询
|
|
63
|
+
- 文件路径来自用户输入但未做路径遍历检查
|
|
64
|
+
- 用户输入直接用于命令执行(`exec()`, `system()`, `spawn()`)
|
|
65
|
+
- 反序列化未验证的外部数据
|
|
66
|
+
- 用户输入直接用于模板渲染(XSS 风险)
|
|
67
|
+
|
|
68
|
+
### 5. 不安全的反序列化
|
|
69
|
+
|
|
70
|
+
**严重度:Critical**
|
|
71
|
+
|
|
72
|
+
**检测模式:**
|
|
73
|
+
- `eval()` / `new Function()` 处理外部数据
|
|
74
|
+
- `pickle.loads()` 处理非信任来源数据
|
|
75
|
+
- `yaml.load()` 而非 `yaml.safe_load()`
|
|
76
|
+
- `JSON.parse()` 后直接信任结构(无 schema 验证)
|
|
77
|
+
- Java `ObjectInputStream.readObject()` 处理网络输入
|
|
78
|
+
|
|
79
|
+
### 6. 错误处理缺陷
|
|
80
|
+
|
|
81
|
+
**严重度:Warning**
|
|
82
|
+
|
|
83
|
+
**检测模式:**
|
|
84
|
+
- 网络/文件/数据库操作无 try-catch 包裹
|
|
85
|
+
- Promise/Future 缺少 `.catch()`/错误处理分支
|
|
86
|
+
- Rust `unwrap()` / `expect()` 在非测试代码中使用
|
|
87
|
+
- Python bare `except:` 捕获所有异常
|
|
88
|
+
- 过于宽泛的异常捕获(catch Error 基类)
|
|
89
|
+
- 错误信息泄露内部实现细节(堆栈跟踪返回给客户端)
|
|
90
|
+
|
|
91
|
+
### 7. 日志中的敏感信息
|
|
92
|
+
|
|
93
|
+
**严重度:Warning**
|
|
94
|
+
|
|
95
|
+
**检测模式:**
|
|
96
|
+
- `console.log(user.password)` / `print(credit_card)`
|
|
97
|
+
- 日志中记录完整请求体(含 Authorization header)
|
|
98
|
+
- 错误日志中包含数据库连接字符串
|
|
99
|
+
- 调试日志中输出 token/session_id
|
|
100
|
+
|
|
101
|
+
### 8. 缺少输入校验
|
|
102
|
+
|
|
103
|
+
**严重度:Info**
|
|
104
|
+
|
|
105
|
+
**检测模式:**
|
|
106
|
+
- 公开 API 端点无参数验证
|
|
107
|
+
- 接受任意类型参数(无 TypeScript type guard / 无 runtime validation)
|
|
108
|
+
- 未限制输入长度/范围(数组大小、字符串长度、数值范围)
|
|
109
|
+
|
|
110
|
+
## 评分算法
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
security_score = 0
|
|
114
|
+
|
|
115
|
+
for each issue:
|
|
116
|
+
if Critical (hardcoded secret): security_score += 30
|
|
117
|
+
if Critical (other security): security_score += 20
|
|
118
|
+
if Warning (error handling): security_score += 8
|
|
119
|
+
if Info (best practice): security_score += 2
|
|
120
|
+
|
|
121
|
+
normalized = min(security_score / (total_files * 10) * 100, 100)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
## 报告章节模板
|
|
125
|
+
|
|
126
|
+
```markdown
|
|
127
|
+
### 错误处理与安全 (Score: {score}/100)
|
|
128
|
+
|
|
129
|
+
发现 {count} 个安全和错误处理问题:
|
|
130
|
+
- 硬编码凭证:{n} 处
|
|
131
|
+
- 空 catch 块:{n} 处
|
|
132
|
+
- SQL 注入风险:{n} 处
|
|
133
|
+
- 未验证输入:{n} 处
|
|
134
|
+
- 不安全反序列化:{n} 处
|
|
135
|
+
- 错误处理缺陷:{n} 处
|
|
136
|
+
- 敏感信息泄露:{n} 处
|
|
137
|
+
|
|
138
|
+
{issue_table}
|
|
139
|
+
|
|
140
|
+
**紧急修复:**
|
|
141
|
+
1. [Critical] {hardcoded_secret_location} → 迁移到环境变量
|
|
142
|
+
2. [Critical] {sql_injection_location} → 使用参数化查询
|
|
143
|
+
```
|