@ohos-cpf/3rdloop 0.0.1
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/README.md +425 -0
- package/bin/3rdloop.mjs +48 -0
- package/lib/cli.js +741 -0
- package/lib/config.js +318 -0
- package/lib/doctor.js +114 -0
- package/lib/exit-codes.js +31 -0
- package/lib/opencode.js +156 -0
- package/lib/orch.js +427 -0
- package/lib/queries.js +264 -0
- package/lib/runner.js +979 -0
- package/lib/step.js +326 -0
- package/lib/ui.js +223 -0
- package/lib/workflow.js +291 -0
- package/lib/workflows.js +132 -0
- package/package.json +50 -0
- package/vendor/Server/Agent/SkillSelector/README.md +344 -0
- package/vendor/Server/Agent/SkillSelector/core/Agent.js +207 -0
- package/vendor/Server/Agent/SkillSelector/index.js +14 -0
- package/vendor/Server/Agent/SkillSelector/llm/llmClient.js +313 -0
- package/vendor/Server/Agent/SkillSelector/llm/prompts.js +161 -0
- package/vendor/Server/Agent/SkillSelector/llm/reactSteps.js +144 -0
- package/vendor/Server/Agent/SkillSelector/matcher/fuzzyMatcher.js +433 -0
- package/vendor/Server/Agent/SkillSelector/scanner/skillScanner.js +382 -0
- package/vendor/Server/Agent/SkillSelector/types.js +63 -0
- package/vendor/Server/Agent/SkillSelector/utils/actionWords.js +60 -0
- package/vendor/Server/Brain/AnalysisStrategies.js +422 -0
- package/vendor/Server/Brain/Brain.js +686 -0
- package/vendor/Server/Brain/DecompositionStrategies.js +621 -0
- package/vendor/Server/Brain/PlanPersistence.js +196 -0
- package/vendor/Server/Brain/SkillExecutor.js +251 -0
- package/vendor/Server/Brain/index.js +11 -0
- package/vendor/Server/CLI/cli.js +243 -0
- package/vendor/Server/CLI/opencode/index.js +804 -0
- package/vendor/Server/CLI/opencode.js +5 -0
- package/vendor/Server/DbUse/MessageArchive.js +61 -0
- package/vendor/Server/DbUse/StorageManager.js +107 -0
- package/vendor/Server/DbUse/adapters/BaseAdapter.js +94 -0
- package/vendor/Server/DbUse/adapters/FileAdapter.js +138 -0
- package/vendor/Server/DbUse/adapters/JsonAdapter.js +138 -0
- package/vendor/Server/DbUse/adapters/JsonlAdapter.js +114 -0
- package/vendor/Server/DbUse/adapters/SqliteAdapter.js +157 -0
- package/vendor/Server/DbUse/index.js +160 -0
- package/vendor/Server/DbUse/stores/SessionStore.js +279 -0
- package/vendor/Server/DbUse/stores/TaskExecutionStore.js +133 -0
- package/vendor/Server/DbUse/stores/TaskRegistryStore.js +262 -0
- package/vendor/Server/DbUse/stores/TaskStepStore.js +279 -0
- package/vendor/Server/FlexRunner/FlexRunner.js +1759 -0
- package/vendor/Server/FlexRunner/index.js +12 -0
- package/vendor/Server/Knowledge/KnowledgeImporter.js +523 -0
- package/vendor/Server/Knowledge/KnowledgeManager.js +341 -0
- package/vendor/Server/Knowledge/index.js +33 -0
- package/vendor/Server/LoopEngine/LoopEngine.js +1133 -0
- package/vendor/Server/LoopEngine/index.js +11 -0
- package/vendor/Server/Orchestrator/Orchestrator.js +1425 -0
- package/vendor/Server/Orchestrator/StepNode.js +312 -0
- package/vendor/Server/Orchestrator/index.js +13 -0
- package/vendor/Server/Routes/controllers/BrainController.js +241 -0
- package/vendor/Server/Routes/controllers/FlexRunnerController.js +1125 -0
- package/vendor/Server/Routes/controllers/HealthController.js +44 -0
- package/vendor/Server/Routes/controllers/KnowledgeImportController.js +355 -0
- package/vendor/Server/Routes/controllers/LoopEngineController.js +788 -0
- package/vendor/Server/Routes/controllers/OrchestratorController.js +911 -0
- package/vendor/Server/Routes/controllers/StatsController.js +57 -0
- package/vendor/Server/Routes/controllers/StreamController.js +67 -0
- package/vendor/Server/Routes/library/logger.js +179 -0
- package/vendor/Server/Routes/library/zipArchive.js +172 -0
- package/vendor/Server/Routes/router/Router.js +204 -0
- package/vendor/Server/Routes/routes/brain.js +47 -0
- package/vendor/Server/Routes/routes/flexrunner.js +72 -0
- package/vendor/Server/Routes/routes/health.js +28 -0
- package/vendor/Server/Routes/routes/index.js +57 -0
- package/vendor/Server/Routes/routes/knowledge.js +55 -0
- package/vendor/Server/Routes/routes/loopengine.js +58 -0
- package/vendor/Server/Routes/routes/orchestrator.js +61 -0
- package/vendor/Server/Routes/routes/registry.js +98 -0
- package/vendor/Server/Routes/routes/stats.js +23 -0
- package/vendor/Server/Routes/routes/stream.js +30 -0
- package/vendor/Server/Routes/server.js +202 -0
- package/vendor/Server/Routes/sse/SseHub.js +308 -0
- package/vendor/Server/Skills/acceptance-check/SKILL.md +174 -0
- package/vendor/Server/Skills/acceptance-check/references/PHASE1_ARTIFACT_COLLECTION.md +52 -0
- package/vendor/Server/Skills/acceptance-check/references/PHASE2_CRITERIA_EVALUATION.md +77 -0
- package/vendor/Server/Skills/arkts-code-check/SKILL.md +314 -0
- package/vendor/Server/Skills/arkts-code-check/references/CODE_CHECK_GUIDE.md +160 -0
- package/vendor/Server/Skills/arkts-code-check/references/FILE_TYPE_GUIDE.md +29 -0
- package/vendor/Server/Skills/arkts-code-check/references/PHASE1_INFO_COLLECTION.md +222 -0
- package/vendor/Server/Skills/arkts-code-check/references/REPORT_TEMPLATE.md +220 -0
- package/vendor/Server/Skills/arkts-library-compile-validate/SKILL.md +329 -0
- package/vendor/Server/Skills/arkts-library-compile-validate/scripts/build.ps1 +93 -0
- package/vendor/Server/Skills/arkts-library-compile-validate/scripts/code-linter.cjs +433 -0
- package/vendor/Server/Skills/arkts-library-compile-validate/scripts/migrate.cjs +851 -0
- package/vendor/Server/Skills/arkts-library-compile-validate/scripts/ohpm-switch.cjs +789 -0
- package/vendor/Server/Skills/arkts-library-demo-code/SKILL.md +291 -0
- package/vendor/Server/Skills/arkts-library-demo-code/references/API_SIGNATURE_CHECKS.md +68 -0
- package/vendor/Server/Skills/arkts-library-demo-code/references/BUILD_VALIDATION.md +184 -0
- package/vendor/Server/Skills/arkts-library-demo-code/references/CODE_STANDARDS.md +337 -0
- package/vendor/Server/Skills/arkts-library-demo-code/references/EXAMPLES.md +400 -0
- package/vendor/Server/Skills/arkts-library-demo-code/references/SYSTEM_API_LOOKUP.md +99 -0
- package/vendor/Server/Skills/arkts-library-demo-code/references/TEMPLATE.md +544 -0
- package/vendor/Server/Skills/arkts-library-demo-code/scripts/build.ps1 +93 -0
- package/vendor/Server/Skills/arkts-library-demo-code/scripts/code-linter.cjs +433 -0
- package/vendor/Server/Skills/arkts-library-demo-code/scripts/migrate.cjs +851 -0
- package/vendor/Server/Skills/arkts-library-demo-code/scripts/ohpm-switch.cjs +789 -0
- package/vendor/Server/Skills/arkts-library-demo-coverage/SKILL.md +174 -0
- package/vendor/Server/Skills/arkts-library-demo-scenario/SKILL.md +321 -0
- package/vendor/Server/Skills/arkts-library-demo-scenario/references/EXAMPLES.md +100 -0
- package/vendor/Server/Skills/arkts-library-demo-scenario/references/TEMPLATE.md +185 -0
- package/vendor/Server/Skills/arkts-library-documentation-quality-check/SKILL.md +234 -0
- package/vendor/Server/Skills/arkts-library-documentation-quality-check/assets/REPORT_TEMPLATE.md +103 -0
- package/vendor/Server/Skills/arkts-library-documentation-quality-check/references/CHECK_DIMENSIONS.md +89 -0
- package/vendor/Server/Skills/arkts-library-documentation-quality-check/references/COMPLIANCE_CHECKLIST.md +62 -0
- package/vendor/Server/Skills/arkts-library-documentation-quality-check/references/KB_QUERY_GUIDE.md +108 -0
- package/vendor/Server/Skills/arkts-library-documentation-quality-check/references/MCP_TOOL_DISCOVERY.md +124 -0
- package/vendor/Server/Skills/arkts-library-documentation-quality-check/references/REPORT_TEMPLATE.md +90 -0
- package/vendor/Server/Skills/arkts-library-documentation-quality-check/references/SCORING_FORMULA.md +57 -0
- package/vendor/Server/Skills/arkts-library-documentation-quality-check/scripts/validate-skill.cjs +259 -0
- package/vendor/Server/Skills/arkts-library-interface-spec/SKILL.md +97 -0
- package/vendor/Server/Skills/arkts-library-memory-leak-check/SKILL.md +392 -0
- package/vendor/Server/Skills/arkts-library-source-clone/SKILL.md +113 -0
- package/vendor/Server/Skills/arkts-library-stability-check/SKILL.md +313 -0
- package/vendor/Server/Skills/arkts-library-stability-check/assets/REPORT_TEMPLATE.md +154 -0
- package/vendor/Server/Skills/arkts-library-stability-check/references/CHECKLIST.md +166 -0
- package/vendor/Server/Skills/arkts-library-stability-check/references/CODE_EXAMPLES.md +309 -0
- package/vendor/Server/Skills/arkts-library-stability-check/references/SCORING_RULES.md +90 -0
- package/vendor/Server/Skills/arkts-library-stability-check/scripts/validate-skill.cjs +282 -0
- package/vendor/Server/Skills/arkts-library-test-coverage-check/SKILL.md +361 -0
- package/vendor/Server/Skills/arkts-library-test-coverage-check/assets/REPORT_TEMPLATE.md +146 -0
- package/vendor/Server/Skills/arkts-library-test-coverage-check/references/CHECKLIST.md +253 -0
- package/vendor/Server/Skills/arkts-library-test-coverage-check/references/MCP_TOOL_USAGE.md +115 -0
- package/vendor/Server/Skills/arkts-library-test-coverage-check/scripts/validate-skill.cjs +263 -0
- package/vendor/Server/Skills/arkts-library-xts-code/SKILL.md +455 -0
- package/vendor/Server/Skills/arkts-library-xts-code/assets/report-template.md +60 -0
- package/vendor/Server/Skills/arkts-library-xts-code/references/ACCESS_MODIFIER_PRECHECK.md +76 -0
- package/vendor/Server/Skills/arkts-library-xts-code/references/BUILD_VERIFICATION.md +200 -0
- package/vendor/Server/Skills/arkts-library-xts-code/references/CODE_STANDARDS.md +519 -0
- package/vendor/Server/Skills/arkts-library-xts-code/references/SUBAGENT_PROMPT_TEMPLATE.md +276 -0
- package/vendor/Server/Skills/arkts-library-xts-code/references/SYSTEM_API_LOOKUP.md +93 -0
- package/vendor/Server/Skills/arkts-library-xts-code/references/XTS_TEMPLATE.md +767 -0
- package/vendor/Server/Skills/arkts-library-xts-code/scripts/build.ps1 +93 -0
- package/vendor/Server/Skills/arkts-library-xts-code/scripts/code-linter.cjs +433 -0
- package/vendor/Server/Skills/arkts-library-xts-code/scripts/migrate.cjs +851 -0
- package/vendor/Server/Skills/arkts-library-xts-code/scripts/ohpm-switch.cjs +789 -0
- package/vendor/Server/Skills/arkts-library-xts-code/scripts/precheck-access-modifiers.cjs +221 -0
- package/vendor/Server/Skills/arkts-library-xts-code-fix/SKILL.md +229 -0
- package/vendor/Server/Skills/arkts-library-xts-coverage/SKILL.md +97 -0
- package/vendor/Server/Skills/arkts-library-xts-doc/SKILL.md +194 -0
- package/vendor/Server/Skills/arkts-library-xts-doc/references/EXAMPLES.md +576 -0
- package/vendor/Server/Skills/arkts-library-xts-doc/references/TEMPLATE.md +575 -0
- package/vendor/Server/Skills/arkts-library-xts-doc/references/TESTABILITY_GUIDE.md +182 -0
- package/vendor/Server/Skills/arkts-library-xts-execution/SKILL.md +491 -0
- package/vendor/Server/Skills/arkts-library-xts-execution/references/error-fixing-examples.md +217 -0
- package/vendor/Server/Skills/arkts-library-xts-execution/scripts/build.ps1 +93 -0
- package/vendor/Server/Skills/arkts-library-xts-execution/scripts/code-linter.cjs +433 -0
- package/vendor/Server/Skills/arkts-library-xts-execution/scripts/migrate.cjs +851 -0
- package/vendor/Server/Skills/arkts-library-xts-execution/scripts/ohpm-switch.cjs +789 -0
- package/vendor/Server/Skills/flutter-code-check/SKILL.md +299 -0
- package/vendor/Server/Skills/flutter-code-check/assets/OUTPUT_TEMPLATE.md +312 -0
- package/vendor/Server/Skills/flutter-code-check/references/CHECKLIST.md +190 -0
- package/vendor/Server/Skills/flutter-code-check/references/PLATFORMS.md +134 -0
- package/vendor/Server/Skills/flutter-code-check/scripts/validate-skill.cjs +259 -0
- package/vendor/Server/Skills/flutter-interface/README.md +75 -0
- package/vendor/Server/Skills/flutter-interface/SKILL.md +291 -0
- package/vendor/Server/Skills/flutter-interface/references/EXAMPLES.md +336 -0
- package/vendor/Server/Skills/flutter-interface/references/GIT_CLONE_GUIDE.md +190 -0
- package/vendor/Server/Skills/flutter-interface/references/SCRIPT_REFERENCE.md +258 -0
- package/vendor/Server/Skills/flutter-interface/references/TEMPLATE.md +254 -0
- package/vendor/Server/Skills/flutter-library-consistency-check/SKILL.md +518 -0
- package/vendor/Server/Skills/flutter-library-consistency-check/references/CHECKLIST.md +382 -0
- package/vendor/Server/Skills/flutter-library-consistency-check/references/FUNCTION_COMPARISON_GUIDE.md +342 -0
- package/vendor/Server/Skills/flutter-library-consistency-check/references/PLATFORM_LIMITATION_GUIDE.md +71 -0
- package/vendor/Server/Skills/flutter-library-documentation-quality-check/SKILL.md +519 -0
- package/vendor/Server/Skills/flutter-library-documentation-quality-check/references/CHECKLIST.md +407 -0
- package/vendor/Server/Skills/flutter-library-memory-leak-check/SKILL.md +653 -0
- package/vendor/Server/Skills/flutter-library-memory-leak-check/references/CHECKLIST.md +397 -0
- package/vendor/Server/Skills/flutter-library-stability-check/SKILL.md +745 -0
- package/vendor/Server/Skills/flutter-library-stability-check/references/CHECKLIST.md +721 -0
- package/vendor/Server/Skills/flutter-library-test-coverage-check/SKILL.md +414 -0
- package/vendor/Server/Skills/flutter-library-test-coverage-check/assets/REPORT_TEMPLATE.md +150 -0
- package/vendor/Server/Skills/flutter-library-test-coverage-check/references/CHECKLIST.md +304 -0
- package/vendor/Server/Skills/flutter-library-test-coverage-check/references/SCORING_RULES.md +265 -0
- package/vendor/Server/Skills/flutter-library-test-coverage-check/references/SCRIPT_USAGE.md +286 -0
- package/vendor/Server/Skills/knowledge-import/SKILL.md +383 -0
- package/vendor/Server/Skills/knowledge-import/references/MCP_TOOL_USAGE.md +165 -0
- package/vendor/Server/Skills/knowledge-import/references/SKILL_LOCATOR_GUIDE.md +91 -0
- package/vendor/Server/Skills/knowledge-import/references/SKILL_OPTIMIZATION_GUIDE.md +127 -0
- package/vendor/Server/Skills/ohos-lib-pr-push/SKILL.md +301 -0
- package/vendor/Server/Skills/ohos-lib-pr-push/assets/PR_ISSUE_TEMPLATE.md +105 -0
- package/vendor/Server/Skills/ohos-lib-pr-push/references/GITCODE_API.md +127 -0
- package/vendor/Server/Skills/ohos-lib-pr-push/scripts/gitcode-api.cjs +208 -0
- package/vendor/Server/Skills/rn-code-check/SKILL.md +321 -0
- package/vendor/Server/Skills/rn-code-check/references/API-GUIDE.md +235 -0
- package/vendor/Server/Skills/rn-code-check/references/CHECKLIST.md +189 -0
- package/vendor/Server/Skills/rn-code-check/references/REPORT-TEMPLATE.md +247 -0
- package/vendor/Server/Skills/rn-lib-add-example/SKILL.md +198 -0
- package/vendor/Server/Skills/rn-lib-add-example/references/APP_RENAME_GUIDE.md +40 -0
- package/vendor/Server/Skills/rn-lib-add-example/references/SHELL_ADAPTATION_CHECKLIST.md +78 -0
- package/vendor/Server/Skills/rn-lib-add-example/references/TEMPLATE_REPO_GUIDE.md +70 -0
- package/vendor/Server/Skills/rn-lib-add-example/references/VERIFICATION_GUIDE.md +47 -0
- package/vendor/Server/Skills/rn-lib-add-example/scripts/create-example.cjs +252 -0
- package/vendor/Server/Skills/rn-lib-update-doc/SKILL.md +176 -0
- package/vendor/Server/Skills/rn-lib-update-doc/config.json +5 -0
- package/vendor/Server/Skills/rn-lib-update-doc/references/changelog-template.md +35 -0
- package/vendor/Server/Skills/rn-lib-update-doc/references/format-diff.md +137 -0
- package/vendor/Server/Skills/rn-lib-update-doc/references/link-registry.json +33 -0
- package/vendor/Server/Skills/rn-lib-update-doc/references/model-0.4.2-overview.md +40 -0
- package/vendor/Server/Skills/rn-lib-update-doc/references/model-0.4.2.md +429 -0
- package/vendor/Server/Skills/rn-lib-update-doc/scripts/detect-readme-format.cjs +105 -0
- package/vendor/Server/Skills/rn-lib-update-doc/scripts/find-usage-doc.cjs +90 -0
- package/vendor/Server/Skills/rn-lib-update-doc/scripts/link-verify.cjs +213 -0
- package/vendor/Server/Skills/rn-lib-update-doc/scripts/normalize-changelog.cjs +73 -0
- package/vendor/Server/Skills/rn-lib-update-doc/scripts/normalize-package-meta.cjs +258 -0
- package/vendor/Server/Skills/rn-lib-update-doc/scripts/normalize-readme-links.cjs +341 -0
- package/vendor/Server/Skills/rn-lib-update-doc/scripts/resolve-usage-docs.cjs +67 -0
- package/vendor/Server/Skills/rn-library-consistency-check/SKILL.md +299 -0
- package/vendor/Server/Skills/rn-library-consistency-check/assets/REPORT_TEMPLATE.md +293 -0
- package/vendor/Server/Skills/rn-library-consistency-check/references/ARKTS_COMPONENT_CHECK_GUIDE.md +857 -0
- package/vendor/Server/Skills/rn-library-consistency-check/references/ARKTS_TURBOMODULE_CHECK_GUIDE.md +856 -0
- package/vendor/Server/Skills/rn-library-consistency-check/references/CHECKLIST.md +157 -0
- package/vendor/Server/Skills/rn-library-consistency-check/references/CPP_COMPONENT_CHECK_GUIDE.md +801 -0
- package/vendor/Server/Skills/rn-library-consistency-check/references/CPP_TURBOMODULE_CHECK_GUIDE.md +684 -0
- package/vendor/Server/Skills/rn-library-consistency-check/references/FUNCTION_COMPARISON_GUIDE.md +233 -0
- package/vendor/Server/Skills/rn-library-consistency-check/references/NATIVE_COMPONENT_IDENTIFICATION.md +1373 -0
- package/vendor/Server/Skills/rn-library-consistency-check/references/SCORING_STANDARD.md +220 -0
- package/vendor/Server/Skills/rn-library-consistency-check/scripts/validate-skill.py +245 -0
- package/vendor/Server/Skills/rn-library-documentation-quality-check/SKILL.md +263 -0
- package/vendor/Server/Skills/rn-library-documentation-quality-check/assets/MODEL.md +414 -0
- package/vendor/Server/Skills/rn-library-documentation-quality-check/assets/MODEL_en.md +413 -0
- package/vendor/Server/Skills/rn-library-documentation-quality-check/assets/REPORT_TEMPLATE.md +311 -0
- package/vendor/Server/Skills/rn-library-documentation-quality-check/references/CHECK_CHECKLIST.md +355 -0
- package/vendor/Server/Skills/rn-library-documentation-quality-check/references/CROSS_VALIDATION_GUIDE.md +115 -0
- package/vendor/Server/Skills/rn-library-documentation-quality-check/references/DOC_COLLECTION_GUIDE.md +139 -0
- package/vendor/Server/Skills/rn-library-documentation-quality-check/references/EXAMPLES.md +586 -0
- package/vendor/Server/Skills/rn-library-documentation-quality-check/references/GOTCHAS.md +57 -0
- package/vendor/Server/Skills/rn-library-documentation-quality-check/scripts/validate-skill.py +259 -0
- package/vendor/Server/Skills/rn-library-interface-analyzer/SKILL.md +301 -0
- package/vendor/Server/Skills/rn-library-interface-analyzer/assets/REPORT_TEMPLATE.md +148 -0
- package/vendor/Server/Skills/rn-library-interface-analyzer/references/DOC_ANNOTATION_GUIDE.md +118 -0
- package/vendor/Server/Skills/rn-library-interface-analyzer/references/SCRIPT_USAGE_GUIDE.md +168 -0
- package/vendor/Server/Skills/rn-library-interface-analyzer/references/URL_PARSING_RULES.md +176 -0
- package/vendor/Server/Skills/rn-library-issue-generalizer/SKILL.md +274 -0
- package/vendor/Server/Skills/rn-library-issue-generalizer/assets/case-template.md +45 -0
- package/vendor/Server/Skills/rn-library-issue-generalizer/assets/rule-template.md +25 -0
- package/vendor/Server/Skills/rn-library-issue-generalizer/references/PR_FETCH_GUIDE.md +61 -0
- package/vendor/Server/Skills/rn-library-issue-generalizer/references/RULE_TEMPLATE_GUIDE.md +165 -0
- package/vendor/Server/Skills/rn-library-issue-generalizer/scripts/fetch-pr-info.py +239 -0
- package/vendor/Server/Skills/rn-library-known-issue-check/SKILL.md +263 -0
- package/vendor/Server/Skills/rn-library-known-issue-check/assets/REPORT_TEMPLATE.md +96 -0
- package/vendor/Server/Skills/rn-library-known-issue-check/references/COMPLIANCE_CHECKLIST.md +58 -0
- package/vendor/Server/Skills/rn-library-known-issue-check/references/INSPECTION_GUIDE.md +99 -0
- package/vendor/Server/Skills/rn-library-known-issue-check/references/PRESCREEN_GUIDE.md +64 -0
- package/vendor/Server/Skills/rn-library-known-issue-check/references/SOURCE_PREP_GUIDE.md +75 -0
- package/vendor/Server/Skills/rn-library-known-issue-check/scripts/validate-known-issue-report.py +164 -0
- package/vendor/Server/Skills/rn-library-memory-leak-check/SKILL.md +339 -0
- package/vendor/Server/Skills/rn-library-memory-leak-check/assets/REPORT_TEMPLATE.md +83 -0
- package/vendor/Server/Skills/rn-library-memory-leak-check/references/CHECKLIST.md +859 -0
- package/vendor/Server/Skills/rn-library-memory-leak-check/references/HARMONY_CODE_PATTERNS.md +122 -0
- package/vendor/Server/Skills/rn-library-memory-leak-check/scripts/scan_harmony_code.py +279 -0
- package/vendor/Server/Skills/rn-library-stability-check/SKILL.md +273 -0
- package/vendor/Server/Skills/rn-library-stability-check/assets/REPORT_TEMPLATE.md +129 -0
- package/vendor/Server/Skills/rn-library-stability-check/references/CHECKLIST.md +581 -0
- package/vendor/Server/Skills/rn-library-stability-check/references/SCORING_RULES.md +138 -0
- package/vendor/Server/Skills/rn-library-stability-check/scripts/scan-harmony-code.py +168 -0
- package/vendor/Server/Skills/rn-library-test-coverage-check/SKILL.md +506 -0
- package/vendor/Server/Skills/rn-library-test-coverage-check/references/CHECKLIST.md +280 -0
- package/vendor/Server/Skills/rn-library-test-coverage-check/references/DEMO_LOCATION.md +221 -0
- package/vendor/Server/Skills/rn-library-test-coverage-check/references/REPORT_TEMPLATE.md +209 -0
- package/vendor/Server/Skills/rn-library-test-coverage-check/references/SCRIPT_USAGE.md +325 -0
- package/vendor/Server/Skills/rn-ohos-xts-generator/SKILL.md +279 -0
- package/vendor/Server/Skills/rn-ohos-xts-generator/assets/TEST_FILE_TEMPLATES.md +404 -0
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/BUILD_TROUBLESHOOTING.md +185 -0
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/BUILD_WORKFLOW.md +265 -0
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/COMMON_CONFIG.md +189 -0
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/CONFIG_GUIDE.md +203 -0
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/COVERAGE_ANALYZER.md +147 -0
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/DESIGN_DOC_GUIDE.md +148 -0
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/GENERATION_FLOW.md +165 -0
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/GENERATION_STRATEGY.md +195 -0
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/HARMONY_SCANNER.md +249 -0
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/JEST_FRAMEWORK.md +235 -0
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/PLATFORM_COMPAT.md +161 -0
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/RN_TEST_PATTERNS.md +413 -0
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/SOURCE_PARSER.md +235 -0
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/TEST_CONVENTIONS.md +245 -0
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/TROUBLESHOOTING.md +282 -0
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/USAGE_GUIDE.md +251 -0
- package/vendor/Server/Skills/rnoh-cptf-api-test/SKILL.md +469 -0
- package/vendor/Server/Skills/rnoh-cptf-api-test/assets/CPTF_TEST_TEMPLATE.md +310 -0
- package/vendor/Server/Skills/rnoh-cptf-api-test/assets/DEMO_PAGE_TEMPLATE.md +303 -0
- package/vendor/Server/Skills/rnoh-cptf-api-test/references/CPTF_TEST_GENERATION_GUIDE.md +421 -0
- package/vendor/Server/Skills/rnoh-cptf-api-test/references/DEMO_GENERATION_GUIDE.md +358 -0
- package/vendor/Server/Skills/rnoh-cptf-api-test/references/QUALITY_CHECKLIST.md +114 -0
- package/vendor/Server/Skills/rnoh-cptf-api-test/references/SPEC_PARSING_GUIDE.md +274 -0
- package/vendor/Server/Skills/rnoh-cptf-api-test/scripts/validate-rnoh-cptf-api-test.sh +185 -0
- package/vendor/Server/Skills/rnoh-cptf-demo-test/SKILL.md +191 -0
- package/vendor/Server/Skills/rnoh-cptf-demo-test/assets/TEST_TEMPLATE.md +216 -0
- package/vendor/Server/Skills/rnoh-cptf-demo-test/references/CPTF_SETUP.md +107 -0
- package/vendor/Server/Skills/rnoh-cptf-demo-test/references/DEMO_ANALYSIS.md +120 -0
- package/vendor/Server/Skills/rnoh-cptf-demo-test/scripts/validate-rnoh-cptf-test.sh +108 -0
- package/vendor/Server/Skills/rnoh-cptf-test-run/SKILL.md +237 -0
- package/vendor/Server/Skills/rnoh-cptf-test-run/references/DEBUG_PLAYBOOK.md +261 -0
- package/vendor/Server/Skills/rnoh-cptf-test-run/scripts/validate-run-env.sh +112 -0
- package/vendor/Server/Skills/rnoh-lib-code-adapt/SKILL.md +498 -0
- package/vendor/Server/Skills/rnoh-lib-code-adapt/references/adapt-checklist.md +270 -0
- package/vendor/Server/Skills/rnoh-lib-code-adapt/references/api-migration-checklist.md +164 -0
- package/vendor/Server/Skills/rnoh-lib-code-adapt/references/common-compile-errors.md +556 -0
- package/vendor/Server/Skills/rnoh-lib-code-adapt/references/deveco-cli-tools.md +459 -0
- package/vendor/Server/Skills/rnoh-lib-code-adapt/references/edge-cases.md +65 -0
- package/vendor/Server/Skills/rnoh-lib-code-adapt/references/har-tgz-build.md +512 -0
- package/vendor/Server/Skills/rnoh-lib-code-adapt/references/version-compat-matrix.md +132 -0
- package/vendor/Server/Skills/rnoh-lib-code-adapt/scripts/auto-integrate.sh +424 -0
- package/vendor/Server/Skills/rnoh-lib-demo-coverage/SKILL.md +137 -0
- package/vendor/Server/Skills/rnoh-lib-demo-create/SKILL.md +306 -0
- package/vendor/Server/Skills/rnoh-lib-demo-create/assets/DEMO_PAGE_TEMPLATE.md +485 -0
- package/vendor/Server/Skills/rnoh-lib-demo-create/assets/INDEX_TEMPLATE.md +172 -0
- package/vendor/Server/Skills/rnoh-lib-demo-create/references/DEMO_CODE_RULES.md +422 -0
- package/vendor/Server/Skills/rnoh-lib-demo-create/references/QUALITY_CHECKLIST.md +95 -0
- package/vendor/Server/Skills/rnoh-lib-demo-create/references/SOURCE_EXPLORATION.md +169 -0
- package/vendor/Server/Skills/rnoh-lib-demo-doc/SKILL.md +554 -0
- package/vendor/Server/Skills/rnoh-lib-demo-doc/assets/DEMO_DOC_TEMPLATE.md +106 -0
- package/vendor/Server/Skills/rnoh-lib-demo-doc/references/COVERAGE_INCREMENTAL.md +216 -0
- package/vendor/Server/Skills/rnoh-lib-demo-doc/references/DEMO_DESIGN_RULES.md +413 -0
- package/vendor/Server/Skills/rnoh-lib-demo-doc/references/OUTPUT_FORMAT.md +269 -0
- package/vendor/Server/Skills/rnoh-lib-demo-doc/references/QUALITY_CHECKLIST.md +98 -0
- package/vendor/Server/Skills/rnoh-lib-func-test/SKILL.md +337 -0
- package/vendor/Server/Skills/rnoh-lib-rnt-search/SKILL.md +722 -0
- package/vendor/Server/Skills/rnoh-lib-rnt-search/assets/PORT_REPORT_TEMPLATE.md +219 -0
- package/vendor/Server/Skills/rnoh-lib-rnt-search/references/DEMO_PORTING_GUIDE.md +345 -0
- package/vendor/Server/Skills/rnoh-lib-rnt-search/references/PORT_VERIFICATION.md +269 -0
- package/vendor/Server/Skills/rnoh-lib-rnt-search/references/RNT_PROJECT_STRUCTURE.md +173 -0
- package/vendor/Server/Skills/rnoh-lib-rnt-search/scripts/analyze-demo-deps.cjs +267 -0
- package/vendor/Server/Skills/rnoh-lib-rnt-search/scripts/detect-rnoh-version.cjs +174 -0
- package/vendor/Server/Skills/rnoh-lib-rnt-search/scripts/find-rnt-demo.sh +111 -0
- package/vendor/Server/Skills/rnoh-lib-rnt-search/scripts/port-demo.sh +186 -0
- package/vendor/Server/Skills/rnoh-lib-rnt-search/scripts/read-lib-meta.cjs +150 -0
- package/vendor/Server/Skills/rnoh-lib-test-align/SKILL.md +296 -0
- package/vendor/Server/Skills/rnoh-lib-test-align/references/jest-troubleshooting.md +371 -0
- package/vendor/Server/Skills/rnoh-lib-test-align/references/port-test-demo-guide.md +212 -0
- package/vendor/Server/Skills/rnoh-lib-test-align/references/runtime-troubleshooting.md +345 -0
- package/vendor/Server/Skills/rnoh-lib-test-align/references/unit-test-template.md +223 -0
- package/vendor/Server/Skills/rnoh-lib-test-align/scripts/port-test-demo.sh +1053 -0
- package/vendor/Server/Skills/rnoh-lib-version-diff/SKILL.md +255 -0
- package/vendor/Server/Skills/rnoh-lib-version-diff/references/OHOS_ADAPTATION.md +77 -0
- package/vendor/Server/Skills/rnoh-lib-version-diff/references/OHOS_API_LOOKUP.md +224 -0
- package/vendor/Server/Skills/rnoh-lib-version-diff/references/script-reference.md +174 -0
- package/vendor/Server/Skills/rnoh-lib-version-diff/scripts/detect-upstream-version.js +967 -0
- package/vendor/Server/Skills/rnoh-lib-version-diff/scripts/generate-diff.js +1798 -0
- package/vendor/Server/Skills/rnoh-lib-version-diff/scripts/package.json +5 -0
- package/vendor/Server/Skills/rnoh-lib-version-diff/templates/report-template.md +137 -0
- package/vendor/Server/Skills/rnoh-lib-xts-coverage/SKILL.md +145 -0
- package/vendor/Server/Skills/skill-generator/SKILL.md +365 -0
- package/vendor/Server/Skills/skill-generator/assets/SKILL_TEMPLATE.md +183 -0
- package/vendor/Server/Skills/skill-generator/references/COMPLIANCE_CHECKLIST.md +82 -0
- package/vendor/Server/Skills/skill-generator/references/KB_QUERY_GUIDE.md +110 -0
- package/vendor/Server/Skills/skill-generator/references/MCP_TOOL_DISCOVERY.md +122 -0
- package/vendor/Server/Skills/skill-generator/references/SKILL_SPEC.md +121 -0
- package/vendor/Server/Skills/skill-generator/scripts/validate-skill.cjs +259 -0
- package/vendor/Server/Skills/task-analysis/SKILL.md +234 -0
- package/vendor/Server/Skills/task-analysis/assets/OUTPUT_EXAMPLES.md +160 -0
- package/vendor/Server/Skills/task-analysis/references/ACCEPTANCE_CRITERIA_GUIDE.md +190 -0
- package/vendor/Server/Skills/task-analysis/references/ANALYSIS_SCHEMA.md +224 -0
- package/vendor/Server/Skills/task-analysis/references/INTEGRATION_CONTEXT.md +162 -0
- package/vendor/Server/Skills/task-analysis/references/LESSONS_LEARNED.md +55 -0
- package/vendor/Server/Skills/task-analysis/references/REPLAN_CONTEXT_GUIDE.md +126 -0
- package/vendor/Server/Skills/task-analysis/scripts/validate-analysis-output.sh +256 -0
- package/vendor/Server/Skills/task-decomposition/SKILL.md +529 -0
- package/vendor/Server/Skills/task-decomposition/assets/OUTPUT_EXAMPLES.md +451 -0
- package/vendor/Server/Skills/task-decomposition/references/ACCEPTANCE_CRITERIA_GUIDE.md +179 -0
- package/vendor/Server/Skills/task-decomposition/references/DEPENDENCY_GRAPH_GUIDE.md +152 -0
- package/vendor/Server/Skills/task-decomposition/references/INTEGRATION_CONTEXT.md +175 -0
- package/vendor/Server/Skills/task-decomposition/references/REPLAN_CONTEXT_GUIDE.md +195 -0
- package/vendor/Server/Skills/task-decomposition/references/TASK_DECOMPOSITION_TEMPLATES.md +226 -0
- package/vendor/Server/Skills/task-decomposition/scripts/list-available-skills.cjs +263 -0
- package/vendor/Server/Skills/task-decomposition/scripts/skill-blacklist.json +29 -0
- package/vendor/Server/Skills/task-decomposition/scripts/validate-decomposition-output.cjs +376 -0
- package/vendor/Server/Skills/task-decomposition/scripts/validate-param-consistency.cjs +259 -0
- package/vendor/Server/Skills/task-decomposition/scripts/validate-specified-skills.cjs +216 -0
- package/vendor/Server/Skills/task-decomposition/scripts/validate-step-graph.cjs +425 -0
- package/vendor/Server/Skills/tpc-cpp-check/SKILL.md +427 -0
- package/vendor/Server/Skills/tpc-cpp-check/references/CHECKLIST.md +214 -0
- package/vendor/Server/Skills/tpc-cpp-check/references/HPKBUILD_GUIDE.md +235 -0
- package/vendor/Server/Skills/tpc-cpp-check/references/REPORT_TEMPLATE.md +250 -0
- package/vendor/Server/TestCheck/TestCheck.js +775 -0
- package/vendor/Server/TestCheck/index.js +11 -0
- package/vendor/Server/library/McpToolGuide.js +280 -0
- package/vendor/Server/library/StatsService.js +127 -0
- package/vendor/Server/library/cstTime.js +16 -0
- package/vendor/Server/package.json +17 -0
- package/vendor/VERSION +3 -0
- package/workflows/pr-check.mjs +106 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# 稳定性检视报告模板
|
|
2
|
+
|
|
3
|
+
> 生成报告时复制此模板,替换 `{占位符}` 内容。报告文件名:`稳定性检视报告.md`。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
```markdown
|
|
8
|
+
# {repoName} 稳定性检视报告
|
|
9
|
+
|
|
10
|
+
## 一、检视概览
|
|
11
|
+
|
|
12
|
+
| 字段 | 内容 |
|
|
13
|
+
|------|------|
|
|
14
|
+
| **仓库名称** | {repoName} |
|
|
15
|
+
| **检视类型** | RN 稳定性检视 |
|
|
16
|
+
| **检视时间** | {timestamp} |
|
|
17
|
+
| **分析文件数** | {fileCount} |
|
|
18
|
+
| **检视范围** | {鸿蒙代码定位结果摘要} |
|
|
19
|
+
|
|
20
|
+
## 二、综合评分
|
|
21
|
+
|
|
22
|
+
**综合评分:{score}/100**
|
|
23
|
+
|
|
24
|
+
> 评分说明:采用严苛扣分制,6 个维度独立评分后汇总,最低 0 分
|
|
25
|
+
|
|
26
|
+
| 维度 | 基础分 | 扣分 | 得分 |
|
|
27
|
+
|------|--------|------|------|
|
|
28
|
+
| 异常处理完整性 | 25 | {扣分} | {得分}/25 |
|
|
29
|
+
| 资源释放安全性 | 20 | {扣分} | {得分}/20 |
|
|
30
|
+
| 并发安全 | 20 | {扣分} | {得分}/20 |
|
|
31
|
+
| ArkTS 生命周期管理 | 10 | {扣分} | {得分}/10 |
|
|
32
|
+
| NAPI 跨语言调用 | 15 | {扣分} | {得分}/15 |
|
|
33
|
+
| C++ 内存管理 | 10 | {扣分} | {得分}/10 |
|
|
34
|
+
|
|
35
|
+
**调用链完整性扣分**:-{扣分} 分(CH-01~CH-03)
|
|
36
|
+
|
|
37
|
+
**扣分明细**:
|
|
38
|
+
- {检查项编号}:{问题描述}({严重度}):-{扣分值} 分
|
|
39
|
+
- ……
|
|
40
|
+
|
|
41
|
+
{归零规则触发时追加:}
|
|
42
|
+
> ⚠️ 触发归零规则:{规则描述},综合评分直接为 0 分
|
|
43
|
+
|
|
44
|
+
## 三、检视范围
|
|
45
|
+
|
|
46
|
+
### 鸿蒙代码定位结果
|
|
47
|
+
|
|
48
|
+
**扫描策略**:通过文件类型 + API 特征 + 配置文件智能识别
|
|
49
|
+
|
|
50
|
+
| 扫描维度 | 发现文件数 | 检视状态 |
|
|
51
|
+
|----------|------------|----------|
|
|
52
|
+
| `.ets` 文件 | {count} | ✅ 已检视(核心) |
|
|
53
|
+
| `module.json5` | {count} | ✅ 已检视 |
|
|
54
|
+
| NAPI C++ 文件 | {count} | ✅ 已检视 |
|
|
55
|
+
| TurboModule 注册 | {count} 处 | ✅ 已检视 |
|
|
56
|
+
| `@ohos` API 导入 | {count} 处 | ✅ 已检视 |
|
|
57
|
+
|
|
58
|
+
**实际检视文件列表**:
|
|
59
|
+
- `{文件路径}` ✅
|
|
60
|
+
- ……
|
|
61
|
+
|
|
62
|
+
## 四、检视维度明细
|
|
63
|
+
|
|
64
|
+
### 4.1 异常处理完整性
|
|
65
|
+
|
|
66
|
+
| 检查项编号 | 检查项 | 严重度 | 发现数量 | 扣分 | 详情 |
|
|
67
|
+
|------------|--------|--------|----------|------|------|
|
|
68
|
+
| E-01 | …… | …… | …… | …… | …… |
|
|
69
|
+
| …… | …… | …… | …… | …… | …… |
|
|
70
|
+
|
|
71
|
+
### 4.2 资源释放安全性
|
|
72
|
+
……
|
|
73
|
+
|
|
74
|
+
### 4.3 并发安全
|
|
75
|
+
……
|
|
76
|
+
|
|
77
|
+
### 4.4 ArkTS 生命周期管理
|
|
78
|
+
……
|
|
79
|
+
|
|
80
|
+
### 4.5 NAPI 跨语言调用
|
|
81
|
+
……
|
|
82
|
+
|
|
83
|
+
### 4.6 C++ 内存管理
|
|
84
|
+
……
|
|
85
|
+
|
|
86
|
+
## 五、调用链完整性分析
|
|
87
|
+
|
|
88
|
+
### 5.1 关键功能调用链图
|
|
89
|
+
|
|
90
|
+
**关键功能 1**:{功能名称}
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
调用链:{jsMethod} → {turboModuleMethod} → {nativeMethod}
|
|
94
|
+
异常处理:✅ / ❌(标注每个节点)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 5.2 异常传播链检查
|
|
98
|
+
|
|
99
|
+
| 检查项编号 | 检查项 | 扣分 | 详情 |
|
|
100
|
+
|------------|--------|------|------|
|
|
101
|
+
| CH-01 | …… | …… | …… |
|
|
102
|
+
|
|
103
|
+
## 六、问题清单
|
|
104
|
+
|
|
105
|
+
| # | 文件 | 行号 | 检查项编号 | 严重度 | 描述 | 修复建议 |
|
|
106
|
+
|---|------|------|------------|--------|------|----------|
|
|
107
|
+
| …… | …… | …… | …… | …… | …… | …… |
|
|
108
|
+
|
|
109
|
+
## 七、改进建议
|
|
110
|
+
|
|
111
|
+
### 优先级 P0(Critical,必须修复)
|
|
112
|
+
……
|
|
113
|
+
|
|
114
|
+
### 优先级 P1(Major,强烈建议修复)
|
|
115
|
+
……
|
|
116
|
+
|
|
117
|
+
### 优先级 P2(Minor,建议改进)
|
|
118
|
+
……
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
**报告生成时间**:{timestamp}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## 报告格式约束
|
|
128
|
+
|
|
129
|
+
> **重要**:报告必须包含 `**综合评分:XX/100**` 格式(粗体标记、中文冒号),且评分值位于"二、综合评分"章节,确保可被 `_parseRNLibraryScore` 函数正确解析。评分正则匹配优先级为 `综合评分` > `总体评分/评分` > `得分`。
|
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
# RN 稳定性检视完整检查清单
|
|
2
|
+
|
|
3
|
+
本文件包含所有检查项的详细说明、判定标准和代码示例。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 一、异常处理完整性(维度总分 25 分)
|
|
8
|
+
|
|
9
|
+
### E-01:关键 API 调用无 try-catch(-10 分)
|
|
10
|
+
|
|
11
|
+
**判定标准**:涉及 `@ohos.*` 系统模块调用、网络请求、文件 I/O、蓝牙/传感器等系统资源操作的公共方法入口,若无 try-catch 包裹则触发。
|
|
12
|
+
|
|
13
|
+
**RN 鸿蒙化典型场景**:
|
|
14
|
+
- TurboModule 注册方法中对 `@ohos.*` API 的调用
|
|
15
|
+
- Native Module 桥接方法中涉及系统资源操作
|
|
16
|
+
- `source/ohos/` 下所有对外暴露的 ArkTS 方法
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
// ❌ 触发 E-01(扣 10 分)
|
|
20
|
+
async startTracking(options: TrackingOptions): Promise<void> {
|
|
21
|
+
await geoLocationManager.on('locationChange', this.request, this.callback);
|
|
22
|
+
// @ohos.geoLocationManager 调用无异常捕获
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// ✅ 正确实现
|
|
26
|
+
async startTracking(options: TrackingOptions): Promise<void> {
|
|
27
|
+
try {
|
|
28
|
+
await geoLocationManager.on('locationChange', this.request, this.callback);
|
|
29
|
+
} catch (e) {
|
|
30
|
+
throw new Error(`startTracking failed: ${(e as Error).message}`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### E-02:Promise rejection 未处理(-8 分)
|
|
36
|
+
|
|
37
|
+
**判定标准**:
|
|
38
|
+
- `.then()` 链无 `.catch()` 或 `.then(null, handler)`
|
|
39
|
+
- `await` 调用未在 try-catch 中
|
|
40
|
+
- TurboModule 返回 Promise 的方法未处理 rejection
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
// ❌ 触发 E-02(扣 8 分)
|
|
44
|
+
fetchData(): void {
|
|
45
|
+
this.httpClient.request(url) // Promise 未 await 也未 catch
|
|
46
|
+
.then(data => this.processData(data));
|
|
47
|
+
// 缺少 .catch()
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// ✅ 正确实现
|
|
51
|
+
async fetchData(): Promise<void> {
|
|
52
|
+
try {
|
|
53
|
+
const data = await this.httpClient.request(url);
|
|
54
|
+
this.processData(data);
|
|
55
|
+
} catch (e) {
|
|
56
|
+
logger.error('fetchData failed', e);
|
|
57
|
+
throw new Error(`fetchData failed: ${(e as Error).message}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### E-03:异常吞没(-7 分)
|
|
63
|
+
|
|
64
|
+
**判定标准**:catch 块为空、仅 `console.log`/`console.error`,既不恢复状态、不重新抛出、也不通过回调/TurboModule 向 JS 层上报。
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
// ❌ 触发 E-03(扣 7 分)
|
|
68
|
+
async connect(url: string): Promise<void> {
|
|
69
|
+
try {
|
|
70
|
+
await this.socket.connect(url);
|
|
71
|
+
} catch (e) {
|
|
72
|
+
console.log('connect error'); // 仅打印,无处理
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// ✅ 正确实现 - 重新抛出
|
|
77
|
+
async connect(url: string): Promise<void> {
|
|
78
|
+
try {
|
|
79
|
+
await this.socket.connect(url);
|
|
80
|
+
} catch (e) {
|
|
81
|
+
throw new Error(`Socket connect failed: ${(e as Error).message}`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// ✅ 正确实现 - 状态恢复 + 上报
|
|
86
|
+
async connect(url: string): Promise<void> {
|
|
87
|
+
try {
|
|
88
|
+
await this.socket.connect(url);
|
|
89
|
+
} catch (e) {
|
|
90
|
+
this.connectionState = ConnectionState.DISCONNECTED;
|
|
91
|
+
this.emit('error', { message: (e as Error).message });
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### E-04:参数验证缺失(-5 分)
|
|
97
|
+
|
|
98
|
+
**判定标准**:TurboModule 注册方法或公共 API 入口,对外部传入参数无类型检查、空值判断或边界验证。
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
// ❌ 触发 E-04(扣 5 分)
|
|
102
|
+
setItem(key: string, value: string): void {
|
|
103
|
+
this.storage.put(key, value); // 无参数验证
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// ✅ 正确实现
|
|
107
|
+
setItem(key: string, value: string): void {
|
|
108
|
+
if (!key || key.length === 0) {
|
|
109
|
+
throw new Error('key must not be empty');
|
|
110
|
+
}
|
|
111
|
+
if (typeof value !== 'string') {
|
|
112
|
+
throw new Error('value must be a string');
|
|
113
|
+
}
|
|
114
|
+
this.storage.put(key, value);
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### E-05:异常类型窄化(-3 分)
|
|
119
|
+
|
|
120
|
+
**判定标准**:仅捕获特定异常类型(如仅 catch BusinessError),遗漏其他可能的异常类型。
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
// ❌ 触发 E-05(扣 3 分)
|
|
124
|
+
try {
|
|
125
|
+
await bluetooth.connect(deviceId);
|
|
126
|
+
} catch (e) {
|
|
127
|
+
if ((e as BusinessError).code === 12345) {
|
|
128
|
+
// 仅处理特定业务错误,遗漏其他异常
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// ✅ 正确实现
|
|
133
|
+
try {
|
|
134
|
+
await bluetooth.connect(deviceId);
|
|
135
|
+
} catch (e) {
|
|
136
|
+
if ((e as BusinessError).code === 12345) {
|
|
137
|
+
// 处理特定业务错误
|
|
138
|
+
} else {
|
|
139
|
+
// 处理其他异常
|
|
140
|
+
throw new Error(`Bluetooth connect failed: ${(e as Error).message}`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### E-06:finally 缺失(-2 分)
|
|
146
|
+
|
|
147
|
+
**判定标准**:涉及资源操作(文件/网络/传感器)的方法,无 finally 块确保清理路径。
|
|
148
|
+
|
|
149
|
+
```typescript
|
|
150
|
+
// ❌ 触发 E-06(扣 2 分)
|
|
151
|
+
async readFile(path: string): Promise<string> {
|
|
152
|
+
const file = fs.openSync(path);
|
|
153
|
+
try {
|
|
154
|
+
return fs.readTextSync(file.fd);
|
|
155
|
+
} catch (e) {
|
|
156
|
+
throw new Error(`Read failed: ${(e as Error).message}`);
|
|
157
|
+
// 异常路径未关闭文件
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// ✅ 正确实现
|
|
162
|
+
async readFile(path: string): Promise<string> {
|
|
163
|
+
let file: fs.File | null = null;
|
|
164
|
+
try {
|
|
165
|
+
file = fs.openSync(path);
|
|
166
|
+
return fs.readTextSync(file.fd);
|
|
167
|
+
} catch (e) {
|
|
168
|
+
throw new Error(`Read failed: ${(e as Error).message}`);
|
|
169
|
+
} finally {
|
|
170
|
+
if (file) {
|
|
171
|
+
fs.closeSync(file);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## 二、资源释放安全性(维度总分 20 分)
|
|
180
|
+
|
|
181
|
+
### R-01:系统资源未释放(-10 分)
|
|
182
|
+
|
|
183
|
+
**判定标准**:使用 `@ohos.*` 模块申请的系统资源(sensor/location/network/bluetooth/ble),在组件销毁或功能停止时未调用对应的 `unregister`/`disable`/`off` 释放。
|
|
184
|
+
|
|
185
|
+
**RN 鸿蒙化关键关注点**:
|
|
186
|
+
- TurboModule 中注册的系统资源监听
|
|
187
|
+
- NativeEventEmitter 绑定的系统事件
|
|
188
|
+
|
|
189
|
+
```typescript
|
|
190
|
+
// ❌ 触发 R-01(扣 10 分)
|
|
191
|
+
export class SensorModule extends TurboModule {
|
|
192
|
+
startAccelerometer(callback: Function): void {
|
|
193
|
+
sensor.on(sensor.SensorType.ACCELEROMETER, (data) => {
|
|
194
|
+
callback(data);
|
|
195
|
+
});
|
|
196
|
+
// 缺少 off() 释放!
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// ✅ 正确实现
|
|
201
|
+
export class SensorModule extends TurboModule {
|
|
202
|
+
private subscribed: boolean = false;
|
|
203
|
+
|
|
204
|
+
startAccelerometer(callback: Function): void {
|
|
205
|
+
sensor.on(sensor.SensorType.ACCELEROMETER, (data) => {
|
|
206
|
+
callback(data);
|
|
207
|
+
});
|
|
208
|
+
this.subscribed = true;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
stopAccelerometer(): void {
|
|
212
|
+
if (this.subscribed) {
|
|
213
|
+
sensor.off(sensor.SensorType.ACCELEROMETER);
|
|
214
|
+
this.subscribed = false;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
destroy(): void {
|
|
219
|
+
this.stopAccelerometer();
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### R-02:事件订阅未取消(-8 分)
|
|
225
|
+
|
|
226
|
+
**判定标准**:通过 `on()` 注册的事件监听器(包括 `@ohos.*` 模块事件和 emitter 事件),未在组件销毁或模块卸载时通过 `off()` 移除。
|
|
227
|
+
|
|
228
|
+
```typescript
|
|
229
|
+
// ❌ 触发 R-02(扣 8 分)
|
|
230
|
+
export class NetworkModule extends TurboModule {
|
|
231
|
+
addListener(eventName: string): void {
|
|
232
|
+
connection.on('netChange', (data) => {
|
|
233
|
+
this.sendEvent(eventName, data);
|
|
234
|
+
});
|
|
235
|
+
// 未保存订阅引用,无法取消
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// ✅ 正确实现
|
|
240
|
+
export class NetworkModule extends TurboModule {
|
|
241
|
+
private netChangeListener: Function | null = null;
|
|
242
|
+
|
|
243
|
+
addListener(eventName: string): void {
|
|
244
|
+
this.netChangeListener = (data) => {
|
|
245
|
+
this.sendEvent(eventName, data);
|
|
246
|
+
};
|
|
247
|
+
connection.on('netChange', this.netChangeListener);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
removeListeners(): void {
|
|
251
|
+
if (this.netChangeListener) {
|
|
252
|
+
connection.off('netChange', this.netChangeListener);
|
|
253
|
+
this.netChangeListener = null;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### R-03:Stream/Connection 泄露(-5 分)
|
|
260
|
+
|
|
261
|
+
**判定标准**:打开的 I/O 流(`fs.open`/`socket`/`http` 连接)未在正确路径关闭。
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
// ❌ 触发 R-03(扣 5 分)
|
|
265
|
+
async fetchData(url: string): Promise<string> {
|
|
266
|
+
const httpClient = http.createHttp();
|
|
267
|
+
const response = await httpClient.request(url);
|
|
268
|
+
return response.result as string;
|
|
269
|
+
// httpClient 未 destroy()
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// ✅ 正确实现
|
|
273
|
+
async fetchData(url: string): Promise<string> {
|
|
274
|
+
const httpClient = http.createHttp();
|
|
275
|
+
try {
|
|
276
|
+
const response = await httpClient.request(url);
|
|
277
|
+
return response.result as string;
|
|
278
|
+
} finally {
|
|
279
|
+
httpClient.destroy();
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
### R-04:Timer 未清理(-3 分)
|
|
285
|
+
|
|
286
|
+
**判定标准**:`setInterval`/`setTimeout` 创建的定时器,未在组件/模块销毁时通过 `clearInterval`/`clearTimeout` 清除。
|
|
287
|
+
|
|
288
|
+
### R-05:Worker 未终止(-3 分)
|
|
289
|
+
|
|
290
|
+
**判定标准**:通过 `worker.ThreadWorker` 创建的 Worker 线程,未在适当时机调用 `terminate()`。
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
## 三、并发安全(维度总分 20 分)
|
|
295
|
+
|
|
296
|
+
### C-01:主线程阻塞操作(-10 分)
|
|
297
|
+
|
|
298
|
+
**判定标准**:在 UI 主线程执行耗时同步操作,包括:
|
|
299
|
+
- 大循环计算(>100ms 可感知)
|
|
300
|
+
- 同步文件 I/O(`fs.openSync`/`fs.readSync` 在主线程调用)
|
|
301
|
+
- 同步网络请求
|
|
302
|
+
- 同步数据库操作
|
|
303
|
+
|
|
304
|
+
```typescript
|
|
305
|
+
// ❌ 触发 C-01(扣 10 分)
|
|
306
|
+
processLargeData(data: string): Result {
|
|
307
|
+
// 在主线程执行大量计算
|
|
308
|
+
const parsed = JSON.parse(data); // 大 JSON 可能阻塞
|
|
309
|
+
for (let i = 0; i < parsed.items.length; i++) {
|
|
310
|
+
// 耗时循环
|
|
311
|
+
}
|
|
312
|
+
return result;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// ✅ 正确实现 - 使用 Worker
|
|
316
|
+
async processLargeData(data: string): Promise<Result> {
|
|
317
|
+
const worker = new worker.ThreadWorker('workers/processor.ets');
|
|
318
|
+
return new Promise((resolve, reject) => {
|
|
319
|
+
worker.onmessage = (e) => {
|
|
320
|
+
worker.terminate();
|
|
321
|
+
resolve(e.data);
|
|
322
|
+
};
|
|
323
|
+
worker.onerror = (e) => {
|
|
324
|
+
worker.terminate();
|
|
325
|
+
reject(new Error(e.message));
|
|
326
|
+
};
|
|
327
|
+
worker.postMessage(data);
|
|
328
|
+
});
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### C-02:共享状态无同步保护(-7 分)
|
|
333
|
+
|
|
334
|
+
**判定标准**:多个异步回调/Promise 修改同一状态变量,无锁机制、队列串行化或原子操作保护。
|
|
335
|
+
|
|
336
|
+
```typescript
|
|
337
|
+
// ❌ 触发 C-02(扣 7 分)
|
|
338
|
+
export class DataModule extends TurboModule {
|
|
339
|
+
private cache: Map<string, string> = new Map();
|
|
340
|
+
|
|
341
|
+
async getValue(key: string): Promise<string | null> {
|
|
342
|
+
if (this.cache.has(key)) {
|
|
343
|
+
return this.cache.get(key)!;
|
|
344
|
+
}
|
|
345
|
+
const value = await this.fetchFromNetwork(key);
|
|
346
|
+
this.cache.set(key, value); // 多个并发调用可能同时写入
|
|
347
|
+
return value;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
// ✅ 正确实现 - 使用队列串行化
|
|
352
|
+
export class DataModule extends TurboModule {
|
|
353
|
+
private cache: Map<string, string> = new Map();
|
|
354
|
+
private pendingRequests: Map<string, Promise<string>> = new Map();
|
|
355
|
+
|
|
356
|
+
async getValue(key: string): Promise<string | null> {
|
|
357
|
+
if (this.cache.has(key)) {
|
|
358
|
+
return this.cache.get(key)!;
|
|
359
|
+
}
|
|
360
|
+
if (this.pendingRequests.has(key)) {
|
|
361
|
+
return this.pendingRequests.get(key)!;
|
|
362
|
+
}
|
|
363
|
+
const promise = this.fetchFromNetwork(key).then(value => {
|
|
364
|
+
this.cache.set(key, value);
|
|
365
|
+
this.pendingRequests.delete(key);
|
|
366
|
+
return value;
|
|
367
|
+
});
|
|
368
|
+
this.pendingRequests.set(key, promise);
|
|
369
|
+
return promise;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
### C-03:回调重入无防护(-3 分)
|
|
375
|
+
|
|
376
|
+
**判定标准**:异步回调可能重入导致状态混乱,缺少重入标志或互斥机制。
|
|
377
|
+
|
|
378
|
+
```typescript
|
|
379
|
+
// ❌ 触发 C-03(扣 3 分)
|
|
380
|
+
async refreshData(): Promise<void> {
|
|
381
|
+
const data = await this.fetchData();
|
|
382
|
+
this.state = data; // 多次调用 refreshData 可能导致状态不一致
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// ✅ 正确实现
|
|
386
|
+
private refreshing: boolean = false;
|
|
387
|
+
async refreshData(): Promise<void> {
|
|
388
|
+
if (this.refreshing) return;
|
|
389
|
+
this.refreshing = true;
|
|
390
|
+
try {
|
|
391
|
+
const data = await this.fetchData();
|
|
392
|
+
this.state = data;
|
|
393
|
+
} finally {
|
|
394
|
+
this.refreshing = false;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
## 四、ArkTS 生命周期管理(维度总分 10 分)
|
|
402
|
+
|
|
403
|
+
### L-01:aboutToDisappear/onDestroy 未清理(-8 分)
|
|
404
|
+
|
|
405
|
+
**判定标准**:自定义组件的 `aboutToDisappear()` 或 Ability 的 `onDestroy()` 未释放资源、移除监听、取消订阅。
|
|
406
|
+
|
|
407
|
+
**RN 鸿蒙化关注点**:
|
|
408
|
+
- TurboModule 的 `destroy()`/`invalidate()` 方法是否清理所有资源
|
|
409
|
+
- RN Component 的鸿蒙化实现是否在 `aboutToDisappear` 中释放系统资源
|
|
410
|
+
|
|
411
|
+
```typescript
|
|
412
|
+
// ❌ 触发 L-01(扣 8 分)
|
|
413
|
+
@Component
|
|
414
|
+
export struct RNMapView {
|
|
415
|
+
private mapController: map.MapComponentController | null = null;
|
|
416
|
+
|
|
417
|
+
aboutToAppear(): void {
|
|
418
|
+
this.mapController = new map.MapComponentController();
|
|
419
|
+
}
|
|
420
|
+
// 缺少 aboutToDisappear 清理!
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// ✅ 正确实现
|
|
424
|
+
@Component
|
|
425
|
+
export struct RNMapView {
|
|
426
|
+
private mapController: map.MapComponentController | null = null;
|
|
427
|
+
|
|
428
|
+
aboutToAppear(): void {
|
|
429
|
+
this.mapController = new map.MapComponentController();
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
aboutToDisappear(): void {
|
|
433
|
+
if (this.mapController) {
|
|
434
|
+
// 释放地图资源
|
|
435
|
+
this.mapController = null;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### L-02:@State/@Link 对象持有大引用未释放(-2 分)
|
|
442
|
+
|
|
443
|
+
**判定标准**:`@State`/`@Link` 装饰的变量持有大对象(图片/音频/大数据缓存),在组件销毁后未释放引用。
|
|
444
|
+
|
|
445
|
+
---
|
|
446
|
+
|
|
447
|
+
## 五、NAPI 跨语言调用安全(维度总分 15 分)
|
|
448
|
+
|
|
449
|
+
### N-01:napi_ref 创建/释放不匹配(-10 分)
|
|
450
|
+
|
|
451
|
+
**判定标准**:`napi_create_reference` 和 `napi_delete_reference` 数量不匹配,或释放路径不对称(如异常分支未释放)。
|
|
452
|
+
|
|
453
|
+
```cpp
|
|
454
|
+
// ❌ 触发 N-01(扣 10 分)
|
|
455
|
+
static napi_value RegisterCallback(napi_env env, napi_callback_info info) {
|
|
456
|
+
napi_ref callbackRef;
|
|
457
|
+
napi_create_reference(env, argv[0], 1, &callbackRef);
|
|
458
|
+
// ... 使用 callbackRef ...
|
|
459
|
+
// 缺少 napi_delete_reference!
|
|
460
|
+
return nullptr;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// ✅ 正确实现
|
|
464
|
+
static napi_value RegisterCallback(napi_env env, napi_callback_info info) {
|
|
465
|
+
napi_ref callbackRef;
|
|
466
|
+
napi_create_reference(env, argv[0], 1, &callbackRef);
|
|
467
|
+
// ... 使用 callbackRef ...
|
|
468
|
+
napi_delete_reference(env, callbackRef); // 必须释放
|
|
469
|
+
return nullptr;
|
|
470
|
+
}
|
|
471
|
+
```
|
|
472
|
+
|
|
473
|
+
### N-02:napi_handle_scope 未清理(-8 分)
|
|
474
|
+
|
|
475
|
+
**判定标准**:`napi_open_handle_scope` 无对应 `napi_close_handle_scope`,或异常路径遗漏关闭。
|
|
476
|
+
|
|
477
|
+
```cpp
|
|
478
|
+
// ❌ 触发 N-02(扣 8 分)
|
|
479
|
+
static napi_value ProcessData(napi_env env, napi_callback_info info) {
|
|
480
|
+
napi_handle_scope scope;
|
|
481
|
+
napi_open_handle_scope(env, &scope);
|
|
482
|
+
// ... 业务逻辑,可能提前返回 ...
|
|
483
|
+
if (error) {
|
|
484
|
+
return nullptr; // 未关闭 scope!
|
|
485
|
+
}
|
|
486
|
+
napi_close_handle_scope(env, scope);
|
|
487
|
+
return result;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
// ✅ 正确实现
|
|
491
|
+
static napi_value ProcessData(napi_env env, napi_callback_info info) {
|
|
492
|
+
napi_handle_scope scope;
|
|
493
|
+
napi_open_handle_scope(env, &scope);
|
|
494
|
+
napi_value result = nullptr;
|
|
495
|
+
// ... 业务逻辑 ...
|
|
496
|
+
napi_close_handle_scope(env, scope); // 始终关闭
|
|
497
|
+
return result;
|
|
498
|
+
}
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
### N-03:napi_value 类型转换无边界检查(-5 分)
|
|
502
|
+
|
|
503
|
+
**判定标准**:`napi_get_value_int32`/`napi_get_value_string_utf8` 等类型转换函数,调用前未使用 `napi_typeof` 验证类型。
|
|
504
|
+
|
|
505
|
+
### N-04:napi_create_async_work 缺少异常处理(-5 分)
|
|
506
|
+
|
|
507
|
+
**判定标准**:异步 work 的 execute/complete 回调未检查 `napi_status` 返回值。
|
|
508
|
+
|
|
509
|
+
### N-05:Native 对象与 JS 对象生命周期不一致(-3 分)
|
|
510
|
+
|
|
511
|
+
**判定标准**:C++ 侧对象未绑定 JS 侧 GC 回调(`napi_wrap` + finalize callback),导致 Native 对象泄露。
|
|
512
|
+
|
|
513
|
+
---
|
|
514
|
+
|
|
515
|
+
## 六、C++ 内存管理安全(维度总分 10 分)
|
|
516
|
+
|
|
517
|
+
### M-01:malloc/new 与 free/delete 不匹配(-8 分)
|
|
518
|
+
|
|
519
|
+
**判定标准**:
|
|
520
|
+
- `malloc` 配 `delete` 或 `new` 配 `free`
|
|
521
|
+
- 分配/释放数量不对称
|
|
522
|
+
- 双重释放风险
|
|
523
|
+
|
|
524
|
+
```cpp
|
|
525
|
+
// ❌ 触发 M-01(扣 8 分)
|
|
526
|
+
char* buffer = (char*)malloc(1024);
|
|
527
|
+
// ...
|
|
528
|
+
delete buffer; // malloc 应配 free!
|
|
529
|
+
|
|
530
|
+
// ✅ 正确实现
|
|
531
|
+
char* buffer = (char*)malloc(1024);
|
|
532
|
+
// ...
|
|
533
|
+
free(buffer);
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
### M-02:异常路径资源未释放(-5 分)
|
|
537
|
+
|
|
538
|
+
**判定标准**:try/catch 中分配的资源在异常分支未释放。
|
|
539
|
+
|
|
540
|
+
```cpp
|
|
541
|
+
// ❌ 触发 M-02(扣 5 分)
|
|
542
|
+
void process() {
|
|
543
|
+
char* buffer = new char[1024];
|
|
544
|
+
someOperation(); // 可能抛出异常
|
|
545
|
+
delete[] buffer; // 异常路径未执行
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
// ✅ 正确实现
|
|
549
|
+
void process() {
|
|
550
|
+
char* buffer = new char[1024];
|
|
551
|
+
try {
|
|
552
|
+
someOperation();
|
|
553
|
+
delete[] buffer;
|
|
554
|
+
} catch (...) {
|
|
555
|
+
delete[] buffer;
|
|
556
|
+
throw;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
### M-03:未使用 RAII 管理资源(-3 分)
|
|
562
|
+
|
|
563
|
+
**判定标准**:裸指针管理资源,可改用智能指针(`std::unique_ptr`/`std::shared_ptr`)但未使用。
|
|
564
|
+
|
|
565
|
+
---
|
|
566
|
+
|
|
567
|
+
## 七、调用链完整性(维度总分 5 分,独立于维度外额外扣分)
|
|
568
|
+
|
|
569
|
+
### CH-01:ArkTS → Native 异常传播断裂(-10 分)
|
|
570
|
+
|
|
571
|
+
**判定标准**:Native C++ 层异常未通过 `napi_throw_error`/`napi_throw_type_error` 传播到 ArkTS 层,导致上层调用者无法感知错误。
|
|
572
|
+
|
|
573
|
+
### CH-02:跨模块调用异常未传播(-5 分)
|
|
574
|
+
|
|
575
|
+
**判定标准**:TurboModule 间调用或模块间调用时,异常被吞没而非向调用者传播。
|
|
576
|
+
|
|
577
|
+
### CH-03:关键功能调用链缺失异常处理节点(-3 分)
|
|
578
|
+
|
|
579
|
+
**判定标准**:关键功能的完整调用链中,至少一个节点无异常处理。
|
|
580
|
+
|
|
581
|
+
**必须追踪至少 3 个关键功能的完整调用链**,标注每个节点的异常处理状态。
|