@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,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: arkts-library-interface-spec
|
|
3
|
+
description: 扫描提取鸿蒙ArkTs原生库源码中对外公开的方法级接口与接口签名,解析 Index.ets 导出链,生成接口规格文档,涵盖导出类、方法和函数。只分析对外公开导出项,输出完整接口签名(含参数、返回值、JSDoc)。当需要对鸿蒙原生库进行方法级接口规格提取、接口签名清单生成、Index.ets 导出链分析时调用。
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
compatibility: 适用于鸿蒙原生库工程(含 library 模块和 Index.ets 入口文件)。需要 git 命令行工具(用于克隆源码)和 Node.js(运行提取脚本)。
|
|
6
|
+
metadata:
|
|
7
|
+
version: "1.1.0"
|
|
8
|
+
category: harmonyos-development
|
|
9
|
+
language: ArkTS/ETS
|
|
10
|
+
useWhen: 从鸿蒙原生库源码提取方法级接口规格时
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# 鸿蒙ArkTs原生库方法级接口规格提取
|
|
14
|
+
|
|
15
|
+
通过源码静态分析提取鸿蒙原生库所有对外公开导出的方法级接口,自动生成标准化的接口规格说明文档。
|
|
16
|
+
|
|
17
|
+
> ⚠️ **核心原则:只分析对外公开导出的接口,不关注内部实现细节。所有输出内容必须来自实际源码,禁止推断或捏造任何接口、参数、类型或功能描述。**
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 任务参数
|
|
22
|
+
|
|
23
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
24
|
+
|------|------|------|------|
|
|
25
|
+
| `outputDir` | string | ✅ | 工作目录(仓库源码克隆/复用位置,也是所有产物的输出根目录) |
|
|
26
|
+
| `reportPath` | string | ✅ | 报告输出路径(必须位于 `outputDir` 下,禁止指向 `repoDir` 内部,避免污染源码) |
|
|
27
|
+
| `repoUrl` | string | ✅ | 仓库 Git 地址 |
|
|
28
|
+
| `repoDir` | string | ❌ | 仓库源码目录(**显式覆盖**)。前置源码下载步骤已将源码克隆到固定路径时传入(如 `outputDir/source`),此时跳过步骤 0 的克隆,直接复用 |
|
|
29
|
+
|
|
30
|
+
**派生变量**:
|
|
31
|
+
- `repoName`:从 `repoUrl` 提取仓库名(取 URL 最后一段,去掉 `.git` 后缀)
|
|
32
|
+
- `repoDir`:仓库源码目录 = 任务参数显式指定的值(优先);否则 = `outputDir/repoName`
|
|
33
|
+
- `mcpScriptsDir`:MCP 脚本目录 = `3rdLibraryLoop/MCP/scripts`(相对于 workspace 根目录)
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 输入依赖
|
|
38
|
+
|
|
39
|
+
- **前置 SKILL**:无(可独立执行;若编排中存在前置源码下载步骤,则通过 `repoDir` 参数复用已克隆源码,跳过克隆)
|
|
40
|
+
- **输入文件**:无(通过 `repoUrl` 克隆源码,或复用 `repoDir` 指定的已有源码)
|
|
41
|
+
- **下游消费者**:`ArkTsLibraryDemoCoverageSkill`(`parse-spec.cjs` 解析本 Skill 生成的报告)、`ArkTsLibraryDemoScenarioSkill`、`ArkTsLibraryXTSDocSkill`、ArkTS 仓库检视流程的各检视 SKILL(稳定性/内存泄露/文档质量/用例覆盖度)
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 工作流程
|
|
46
|
+
|
|
47
|
+
### 步骤 0:准备仓库源码(复用或克隆)
|
|
48
|
+
|
|
49
|
+
**目标:** 确保 `repoDir` 下存在仓库源码。优先复用已存在的仓库源码,避免重复克隆。
|
|
50
|
+
|
|
51
|
+
> ⚠️ **前置源码已就位时直接复用**:若任务参数显式提供了 `repoDir`(如源码已由前置源码下载 SKILL 克隆到 `outputDir/source`),先用 `list_dir` 验证该目录下存在源码(`.git` 子目录、`library/index.ets`(大小写不敏感,`Index.ets`/`index.ets` 皆可)、`oh-package.json5` 任一即可),验证通过后**跳过本步骤的全部克隆操作**,直接以该 `repoDir` 进入步骤 1。
|
|
52
|
+
|
|
53
|
+
1. **提取仓库名**:从 `repoUrl` 末尾取仓库名,去掉 `.git` 后缀,确定 `repoDir = outputDir/repoName`
|
|
54
|
+
|
|
55
|
+
2. **扫描工作目录**:用 `list_dir` 列出 `outputDir` 下所有条目,判定是否为可复用的仓库源码(满足其一即可):
|
|
56
|
+
- 目录名与 `repoName` 一致;或
|
|
57
|
+
- 目录内含 `.git` 子目录;或
|
|
58
|
+
- 目录内含 `library/index.ets` 或 `library/src/main/ets/index.ets`(**大小写不敏感**,`Index.ets`/`index.ets` 皆可;部分移植库入口为小写,属正常结构)
|
|
59
|
+
|
|
60
|
+
3. **条件克隆**:若不存在可用仓库:
|
|
61
|
+
```bash
|
|
62
|
+
git clone --depth=1 {{repoUrl}} {{outputDir}}/{{repoName}}
|
|
63
|
+
```
|
|
64
|
+
失败时去掉 `--depth=1` 改为完整克隆。克隆后用 `list_dir` 确认 `repoDir/library` 存在。
|
|
65
|
+
|
|
66
|
+
> ⚠️ 若所有克隆方式均失败,在报告中说明原因并标注 `状态: 失败`,终止后续步骤。
|
|
67
|
+
> ⚠️ 克隆目标为 `outputDir/repoName`(仓库名目录),**不要**克隆到 `outputDir/source`。
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
### 步骤 1:运行脚本生成接口规格文档
|
|
72
|
+
|
|
73
|
+
> ⚠️ **本步骤严格使用本地脚本实现,禁止 AI 手工解析源码。** `render-spec-doc.cjs` 一条命令完成全部工作:TypeScript Compiler API 语义分析 → Index.ets 导出链追踪 → Native `.so` 检测 → 接口成员提取 → JSDoc 提取 → Markdown 文档渲染。无中间 JSON 文件。
|
|
74
|
+
>
|
|
75
|
+
> ⚠️ **输出路径约束**:`--output` 必须指向 `outputDir` 下的路径(如 `outputDir/interface-spec.md`),**禁止**写入 `repoDir`(clone 代码目录)内部,避免污染源码目录。
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
node "{{mcpScriptsDir}}/render-spec-doc.cjs" --libroot "{{repoDir}}" --output "{{reportPath}}"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
脚本自动输出包含基本信息、接口统计、按类/接口分节(方法/属性/字段/枚举值/函数/变量/类型别名/事件方法汇总)、源文件列表的完整 Markdown 报告。
|
|
82
|
+
|
|
83
|
+
**验证**:确认脚本退出码为 0、报告文件已生成。若脚本报错(如无法定位 index.ets),检查 `repoDir` 路径是否正确、仓库是否含 `library/index.ets` 或 `library/src/main/ets/index.ets`(**大小写不敏感**,`Index.ets`/`index.ets` 皆可,可用 `ls | grep -i index` 探测实际入口文件名)。
|
|
84
|
+
|
|
85
|
+
> ⚠️ **移植库结构说明**:部分 Java 移植库(如 CPF-ApplicationTPC 系列的 mp3agic)入口为小写 `library/index.ets`,实现源码为 `.ts` 扩展名且位于 `library/src/main/ets/components/<libname>/` 下——这是移植工程的常见模式,属正常结构,`render-spec-doc.cjs` 可直接解析,无需人工干预。切勿因入口文件大小写差异误判"仓库缺少入口文件"(Linux 等大小写敏感文件系统上尤其注意)。
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 输出产物
|
|
90
|
+
|
|
91
|
+
| 产物 | 文件名 | 说明 |
|
|
92
|
+
|------|--------|------|
|
|
93
|
+
| 接口规格说明文档 | `{reportPath}`(约定为 `{outputDir}/接口规格说明.md`) | 对外公开导出项的完整接口签名清单 |
|
|
94
|
+
|
|
95
|
+
> ⚠️ **输出文件自检**:写入结果文件前,先确认 `reportPath` 指定的接口规格说明文档已存在且内容完整(**独立文件,禁止只写入 result 执行结果文件**)。若文档内容仅在草稿中,必须先将其保存为该独立文件。
|
|
96
|
+
|
|
97
|
+
本 SKILL 无评分,无需输出结构化指标文件。
|
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: arkts-library-memory-leak-check
|
|
3
|
+
description: 对 ArkTS 鸿蒙化库进行内存泄露检视,聚焦 ArkTS/ETS 与 C/C++ NAPI 绑定代码中的生命周期管理、系统资源释放、NAPI 引用管理、事件订阅管理、闭包与上下文泄露等维度,识别潜在内存泄露风险,生成严苛评分报告(0-100分)。作为 ArkTS 仓库检视流程的第四阶段。
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
compatibility: 需要访问 Git 仓库、分析 ArkTS/ETS 及 C/C++ NAPI 绑定源码
|
|
6
|
+
metadata:
|
|
7
|
+
author: CPPAgent
|
|
8
|
+
version: "1.0.0"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# ArktsLibraryMemoryLeakCheckSkill
|
|
12
|
+
|
|
13
|
+
对**已鸿蒙化的 ArkTS 库**进行内存泄露风险检视,识别 ArkTS/ETS 层与 C/C++ NAPI 绑定层代码中的潜在内存泄露问题,评估资源管理安全性。
|
|
14
|
+
|
|
15
|
+
> ⚠️ **核心定位**:ArkTS 鸿蒙化库的内存泄露检视,**覆盖 ArkTS/ETS 层与 C/C++ NAPI 绑定层**,重点关注生命周期管理、系统资源释放、NAPI 引用管理、闭包上下文泄露、跨语言资源释放一致性等问题。
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 任务参数
|
|
20
|
+
|
|
21
|
+
| 参数 | 必需 | 说明 |
|
|
22
|
+
|------|------|------|
|
|
23
|
+
| `repoUrl` | ✅ | Git 仓库地址,支持分支参数 `?branch=xxx` |
|
|
24
|
+
| `outputDir` | ✅ | 输出目录绝对路径,存放检视报告 |
|
|
25
|
+
| `interfaceDocPath` | ✅ | 接口规格说明文档路径(由 library-interface-analyzer 生成) |
|
|
26
|
+
| `repoName` | ✅ | 仓库名称(用于报告标识) |
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 输入依赖
|
|
31
|
+
|
|
32
|
+
本 SKILL 是 ArkTS 仓库检视流程的**第四阶段**,依赖:
|
|
33
|
+
|
|
34
|
+
- **前置 SKILL**: `arkts-library-interface-spec`(接口规格说明已生成)
|
|
35
|
+
- **输入文件**: `接口规格说明.md`(位于 outputDir);`编码质量检视报告.md` 为**可选参考**(若本地流程无编码质量检视 SKILL,跳过该参考,独立完成检视)
|
|
36
|
+
- **仓库源码**: 已克隆到 `{outputDir}/source/`
|
|
37
|
+
|
|
38
|
+
> 💡 **利用前置报告**:参考编码质量检视报告中标记的架构问题和代码规范问题,重点关注其中涉及的资源管理相关代码段。
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 工作流程
|
|
43
|
+
|
|
44
|
+
### Phase 1:源码范围识别
|
|
45
|
+
|
|
46
|
+
**分层扫描**仓库中的鸿蒙化代码文件:
|
|
47
|
+
|
|
48
|
+
1. **ArkTS/ETS 层**:扫描 `.ets`、`.ts`、`.json5` 文件
|
|
49
|
+
2. **C/C++ NAPI 绑定层**:扫描 `.cpp`、`.c`、`.h`、`.hpp` 文件(重点关注 NAPI 绑定入口)
|
|
50
|
+
|
|
51
|
+
**⚠️ 排除范围规则**:仅检视库的**核心源码**,以下目录和文件必须排除,不纳入内存泄露分析:
|
|
52
|
+
|
|
53
|
+
| 排除类别 | 目录/文件特征 | 说明 |
|
|
54
|
+
|----------|--------------|------|
|
|
55
|
+
| Demo/示例用例 | `demo/`、`example/`、`examples/`、`sample/`、`samples/` 目录,文件名含 `demo`、`example`、`sample` | 示例代码仅用于演示库用法,不属于库的核心实现 |
|
|
56
|
+
| 单元测试 | `test/`、`tests/`、`__tests__/`、`spec/`、`unittest/` 目录,文件名含 `test`、`spec`、`unittest` | 测试代码验证库功能而非生产运行,其资源管理模式与核心源码不同 |
|
|
57
|
+
| 集成测试 | `integration-test/`、`e2e/`、`itest/` 目录 | 同上,非核心源码 |
|
|
58
|
+
| 测试工具/辅助 | `mock/`、`fixture/`、`stub/`、`fuzz/` 目录 | 测试辅助代码不属于库运行时逻辑 |
|
|
59
|
+
|
|
60
|
+
> **原则**:核心源码指库在**生产运行时**实际执行的代码,即被外部应用调用的公开 API 实现、内部模块逻辑、NAPI 绑定层。Demo 和测试代码中即使存在资源管理问题,也不影响库的实际运行安全性,因此不应纳入检视和评分。
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# ArkTS/ETS 层(排除 demo 与测试)
|
|
64
|
+
find {{outputDir}}/source -type f \( -name "*.ets" -o -name "*.ts" -o -name "*.json5" \) \
|
|
65
|
+
-not -path "*/demo/*" -not -path "*/example/*" -not -path "*/examples/*" \
|
|
66
|
+
-not -path "*/sample/*" -not -path "*/samples/*" \
|
|
67
|
+
-not -path "*/test/*" -not -path "*/tests/*" -not -path "*/__tests__/*" \
|
|
68
|
+
-not -path "*/spec/*" -not -path "*/unittest/*" \
|
|
69
|
+
-not -path "*/integration-test/*" -not -path "*/e2e/*" \
|
|
70
|
+
-not -path "*/mock/*" -not -path "*/fixture/*" \
|
|
71
|
+
-not -path "*/fuzz/*" -not -path "*/stub/*" \
|
|
72
|
+
-not -name "*demo*" -not -name "*example*" -not -name "*sample*" \
|
|
73
|
+
-not -name "*test*" -not -name "*spec*" -not -name "*unittest*"
|
|
74
|
+
|
|
75
|
+
# C/C++ NAPI 绑定层(排除 demo 与测试)
|
|
76
|
+
find {{outputDir}}/source -type f \( -name "*.cpp" -o -name "*.c" -o -name "*.h" -o -name "*.hpp" \) \
|
|
77
|
+
-not -path "*/demo/*" -not -path "*/example/*" -not -path "*/examples/*" \
|
|
78
|
+
-not -path "*/sample/*" -not -path "*/samples/*" \
|
|
79
|
+
-not -path "*/test/*" -not -path "*/tests/*" -not -path "*/unittest/*" \
|
|
80
|
+
-not -path "*/integration-test/*" -not -path "*/e2e/*" \
|
|
81
|
+
-not -path "*/mock/*" -not -path "*/fixture/*" \
|
|
82
|
+
-not -path "*/fuzz/*" -not -path "*/stub/*" \
|
|
83
|
+
-not -name "*demo*" -not -name "*example*" -not -name "*sample*" \
|
|
84
|
+
-not -name "*test*" -not -name "*unittest*" \
|
|
85
|
+
| xargs grep -l "napi_" 2>/dev/null || true
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
> `workdir: "{{outputDir}}"`
|
|
89
|
+
|
|
90
|
+
### Phase 2:逐文件内存泄露分析
|
|
91
|
+
|
|
92
|
+
对每个源码文件进行内存泄露检视,重点关注以下 7 个维度:
|
|
93
|
+
|
|
94
|
+
#### 2.1 ArkTS 生命周期管理
|
|
95
|
+
|
|
96
|
+
| 检查项 | 严重度 | 说明 |
|
|
97
|
+
|--------|--------|------|
|
|
98
|
+
| aboutToDisappear 未清理 | Critical | 组件销毁时未释放资源/移除监听/断开连接 |
|
|
99
|
+
| @State 大对象泄露 | Major | @State 变量持有大对象引用(如大数组/Map),组件销毁后未主动置空 |
|
|
100
|
+
| @Link/@Prop 双向绑定泄露 | Major | 双向绑定在组件销毁后未断开,父组件仍持有子组件引用 |
|
|
101
|
+
| 页面栈泄露 | Major | router.pushUrl 后未调用 router.back,页面未正确弹出 |
|
|
102
|
+
| PersistentStorage 泄露 | Minor | 持久化存储键未在组件销毁时清理 |
|
|
103
|
+
| CustomComponent 引用泄露 | Major | 父组件通过引用持有已销毁子组件实例 |
|
|
104
|
+
|
|
105
|
+
#### 2.2 系统资源释放
|
|
106
|
+
|
|
107
|
+
| 检查项 | 严重度 | 说明 |
|
|
108
|
+
|--------|--------|------|
|
|
109
|
+
| Sensor 未注销 | Critical | sensor.on() 后无对应 sensor.off() |
|
|
110
|
+
| Location 未关闭 | Critical | geoLocationManager 开启后未关闭 |
|
|
111
|
+
| Network 连接未断开 | Major | HTTP/WebSocket 连接未调用 disconnect/close |
|
|
112
|
+
| Timer 未清除 | Major | setInterval/setTimeout 未在生命周期结束时 clearInterval/clearTimeout |
|
|
113
|
+
| Worker 未终止 | Major | Worker 创建后未调用 terminate |
|
|
114
|
+
| Bitmap/Image 未释放 | Major | 图片资源未调用 recycle/release |
|
|
115
|
+
| media.AVPlayer 未释放 | Major | AVPlayer 创建后未调用 release |
|
|
116
|
+
| webview.WebView 未销毁 | Major | WebView 未正确销毁,可能持有 JS 上下文引用 |
|
|
117
|
+
| XMLParser/JSONParser 未释放 | Minor | 解析器资源未释放 |
|
|
118
|
+
| 数据库连接未关闭 | Critical | rdb 关闭未调用 close |
|
|
119
|
+
|
|
120
|
+
#### 2.3 事件订阅管理
|
|
121
|
+
|
|
122
|
+
| 检查项 | 严重度 | 说明 |
|
|
123
|
+
|--------|--------|------|
|
|
124
|
+
| CommonEvent 未取消订阅 | Critical | emitter.subscribe/on() 后无 unsubscribe/off() |
|
|
125
|
+
| Callback 未移除 | Major | 注册的回调在组件销毁时未移除 |
|
|
126
|
+
| Listener on/off 不匹配 | Major | on/off 注册与移除次数不匹配 |
|
|
127
|
+
| 全局事件泄露 | Critical | 全局事件订阅未在组件生命周期中管理 |
|
|
128
|
+
| emitter 持久订阅泄露 | Major | emitter.on() 使用 Persistent 选项但无取消机制 |
|
|
129
|
+
|
|
130
|
+
#### 2.4 闭包与上下文泄露
|
|
131
|
+
|
|
132
|
+
| 检查项 | 严重度 | 说明 |
|
|
133
|
+
|--------|--------|------|
|
|
134
|
+
| 闭包持有组件引用 | Major | 闭包捕获 this/组件引用,组件销毁后闭包仍存活 |
|
|
135
|
+
| 全局回调持有组件上下文 | Critical | 全局注册的回调函数持有组件实例引用 |
|
|
136
|
+
| 异步回调持有 stale context | Major | setTimeout/Promise 回调中引用已销毁组件上下文 |
|
|
137
|
+
| 静态大对象缓存泄露 | Minor | 全局 Map/Array/缓存未在适当时机清理 |
|
|
138
|
+
|
|
139
|
+
#### 2.5 NAPI 引用管理(ArkTS 层视角)
|
|
140
|
+
|
|
141
|
+
| 检查项 | 严重度 | 说明 |
|
|
142
|
+
|--------|--------|------|
|
|
143
|
+
| napi_create_reference 未释放 | Critical | napi_create_reference 后无 napi_delete_reference |
|
|
144
|
+
| napi_handle_scope 泄露 | Major | napi_open_handle_scope 后无 napi_close_handle_scope |
|
|
145
|
+
| napi_callback_info 泄露 | Minor | 回调信息未正确处理释放 |
|
|
146
|
+
| ArrayBuffer 外部资源泄露 | Major | napi_create_external ArrayBuffer 的 finalize 回调缺失或未正确释放 |
|
|
147
|
+
|
|
148
|
+
#### 2.6 C/C++ 层内存泄露
|
|
149
|
+
|
|
150
|
+
| 检查项 | 严重度 | 说明 |
|
|
151
|
+
|--------|--------|------|
|
|
152
|
+
| malloc/free 不匹配 | Critical | malloc 后无 free,或 calloc/realloc 后未释放 |
|
|
153
|
+
| new/delete 不匹配 | Critical | new 后无 delete,new[] 后用 delete(而非 delete[]) |
|
|
154
|
+
| 智能指针循环引用 | Critical | shared_ptr 循环引用导致引用计数永不为零 |
|
|
155
|
+
| NAPI Native 对象泄露 | Critical | napi_wrap 包装的 Native 对象在 finalize 中未释放 |
|
|
156
|
+
| 智能指针误用 | Major | unique_ptr 被 raw pointer 接管后未管理 |
|
|
157
|
+
| 全局/静态缓冲区无限增长 | Major | 全局 vector/map 无上限增长,缺少清理机制 |
|
|
158
|
+
| RAII 覆盖不全 | Major | 未使用 RAII 管理 C++ 资源(如文件句柄、锁) |
|
|
159
|
+
| 内存池未释放 | Minor | 自定义内存池/allocator 未在析构时释放 |
|
|
160
|
+
|
|
161
|
+
#### 2.7 跨语言资源释放一致性
|
|
162
|
+
|
|
163
|
+
| 检查项 | 严重度 | 说明 |
|
|
164
|
+
|--------|--------|------|
|
|
165
|
+
| ArkTS on/C++ resource 不对称释放 | Critical | ArkTS 层调用 off() 但 C++ 层未释放对应资源,或反过来 |
|
|
166
|
+
| Native 对象生命周期不一致 | Critical | C++ Native 对象与 ArkTS 包装对象生命周期不一致 |
|
|
167
|
+
| finalize 回调缺失 | Critical | napi_wrap 未提供 finalize 回调,Native 对象无法被回收 |
|
|
168
|
+
| 跨语言回调链泄露 | Major | C++ 层回调引用 ArkTS 函数,双向引用未正确断开 |
|
|
169
|
+
|
|
170
|
+
### Phase 3:内存泄露评分计算
|
|
171
|
+
|
|
172
|
+
基于检视结果进行**严苛评分**(0-100分),采用维度加权扣分与零容忍规则:
|
|
173
|
+
|
|
174
|
+
#### 3.1 扣分规则
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
基础分 = 100
|
|
178
|
+
|
|
179
|
+
标准扣分(按问题数量叠加):
|
|
180
|
+
- Critical 级别问题:每项 -20 分(上限 -60)
|
|
181
|
+
- Major 级别问题:每项 -10 分(上限 -40)
|
|
182
|
+
- Minor 级别问题:每项 -4 分(上限 -16)
|
|
183
|
+
|
|
184
|
+
零容忍加重扣分(叠加于标准扣分之上):
|
|
185
|
+
- napi_ref/NAPI finalize 缺失:每项额外 -5 分(上限 -15)
|
|
186
|
+
- malloc/free 或 new/delete 不匹配:每项额外 -5 分(上限 -15)
|
|
187
|
+
- 闭包持有组件引用 + 全局事件泄露组合:额外 -10 分(上限 -10)
|
|
188
|
+
|
|
189
|
+
最终分 = max(0, 基础分 - 标准扣分 - 零容忍加重扣分)
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
#### 3.2 维度子评分计算
|
|
193
|
+
|
|
194
|
+
每个维度独立计算子评分(用于报告中明细展示):
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
维度基础分 = 100
|
|
198
|
+
维度扣分:
|
|
199
|
+
- 该维度 Critical 问题:每项 -20(上限 -60)
|
|
200
|
+
- 该维度 Major 问题:每项 -10(上限 -40)
|
|
201
|
+
- 该维度 Minor 问题:每项 -4(上限 -16)
|
|
202
|
+
维度分 = max(0, 维度基础分 - 维度扣分)
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
#### 3.3 综合评分 = 各维度子评分加权平均
|
|
206
|
+
|
|
207
|
+
```
|
|
208
|
+
综合评分 = (
|
|
209
|
+
生命周期管理分 × 0.15 +
|
|
210
|
+
系统资源释放分 × 0.20 +
|
|
211
|
+
事件订阅管理分 × 0.15 +
|
|
212
|
+
闭包与上下文泄露分 × 0.10 +
|
|
213
|
+
NAPI 引用管理分 × 0.15 +
|
|
214
|
+
C/C++ 层内存泄露分 × 0.20 +
|
|
215
|
+
跨语言一致性分 × 0.05
|
|
216
|
+
)
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
> **重要**:当综合评分与"基础分 - 总扣分"不一致时,取两者中的**较低值**作为最终综合评分。这确保了零容忍加重扣分和维度加权不会导致评分偏高。
|
|
220
|
+
|
|
221
|
+
#### 3.4 评分标准说明
|
|
222
|
+
|
|
223
|
+
| 分数区间 | 等级 | 说明 |
|
|
224
|
+
|----------|------|------|
|
|
225
|
+
| 95-100 分 | 优秀 | 资源管理完善,无任何泄露风险 |
|
|
226
|
+
| 85-94 分 | 良好 | 仅存在少量 Minor 级别风险,无 Major/Critical 问题 |
|
|
227
|
+
| 70-84 分 | 一般 | 存在 Major 级别泄露,需针对性修复 |
|
|
228
|
+
| 55-69 分 | 较差 | 存在 Critical 级别泄露风险,内存安全受威胁 |
|
|
229
|
+
| <55 分 | 严重不足 | 多个 Critical 泄露问题,内存风险极高,不可发布 |
|
|
230
|
+
|
|
231
|
+
> ⚠️ **严苛标准**:内存泄露不同于一般代码质量问题,一旦发生即造成持续损害。因此 85 分以下即不建议发布,55 分以下视为严重不可用。
|
|
232
|
+
|
|
233
|
+
### Phase 4:报告生成
|
|
234
|
+
|
|
235
|
+
在 `{outputDir}` 下生成 `内存泄露检视报告.md`,格式如下:
|
|
236
|
+
|
|
237
|
+
```markdown
|
|
238
|
+
# {repoName} 内存泄露检视报告
|
|
239
|
+
|
|
240
|
+
## 一、检视概览
|
|
241
|
+
|
|
242
|
+
| 字段 | 内容 |
|
|
243
|
+
|------|------|
|
|
244
|
+
| **仓库名称** | {repoName} |
|
|
245
|
+
| **检视类型** | ArkTS 内存泄露检视 |
|
|
246
|
+
| **检视时间** | {timestamp} |
|
|
247
|
+
| **分析文件数(ArkTS层)** | {etsFileCount} |
|
|
248
|
+
| **分析文件数(C/C++层)** | {cppFileCount} |
|
|
249
|
+
|
|
250
|
+
## 二、综合评分
|
|
251
|
+
|
|
252
|
+
**综合评分:{score}/100**
|
|
253
|
+
|
|
254
|
+
> 评分等级:{level}。{levelDescription}
|
|
255
|
+
|
|
256
|
+
### 扣分明细
|
|
257
|
+
|
|
258
|
+
| 扣分项 | 数量 | 单项扣分 | 小计 | 上限 |
|
|
259
|
+
|--------|------|----------|------|------|
|
|
260
|
+
| Critical 标准扣分 | {criticalCount} | -20 | {criticalTotal} | -60 |
|
|
261
|
+
| Major 标准扣分 | {majorCount} | -10 | {majorTotal} | -40 |
|
|
262
|
+
| Minor 标准扣分 | {minorCount} | -4 | {minorTotal} | -16 |
|
|
263
|
+
| napi_ref/finalize 零容忍加重 | {napiCriticalCount} | -5 | {napiExtraTotal} | -15 |
|
|
264
|
+
| malloc/new 零容忍加重 | {memCriticalCount} | -5 | {memExtraTotal} | -15 |
|
|
265
|
+
| 闭包+全局事件组合加重 | {comboCount} | -10 | {comboExtraTotal} | -10 |
|
|
266
|
+
|
|
267
|
+
## 三、检视维度明细
|
|
268
|
+
|
|
269
|
+
### 3.1 ArkTS 生命周期管理
|
|
270
|
+
|
|
271
|
+
**维度评分:{dim1Score}/100**
|
|
272
|
+
|
|
273
|
+
| 检查项 | 严重度 | 发现数量 | 详情 |
|
|
274
|
+
|--------|--------|----------|------|
|
|
275
|
+
| …… | …… | …… | …… |
|
|
276
|
+
|
|
277
|
+
### 3.2 系统资源释放
|
|
278
|
+
|
|
279
|
+
**维度评分:{dim2Score}/100**
|
|
280
|
+
|
|
281
|
+
| 检查项 | 严重度 | 发现数量 | 详情 |
|
|
282
|
+
|--------|--------|----------|------|
|
|
283
|
+
| …… | …… | …… | …… |
|
|
284
|
+
|
|
285
|
+
### 3.3 事件订阅管理
|
|
286
|
+
|
|
287
|
+
**维度评分:{dim3Score}/100**
|
|
288
|
+
|
|
289
|
+
| 检查项 | 严重度 | 发现数量 | 详情 |
|
|
290
|
+
|--------|--------|----------|------|
|
|
291
|
+
| …… | …… | …… | …… |
|
|
292
|
+
|
|
293
|
+
### 3.4 闭包与上下文泄露
|
|
294
|
+
|
|
295
|
+
**维度评分:{dim4Score}/100**
|
|
296
|
+
|
|
297
|
+
| 检查项 | 严重度 | 发现数量 | 详情 |
|
|
298
|
+
|--------|--------|----------|------|
|
|
299
|
+
| …… | …… | …… | …… |
|
|
300
|
+
|
|
301
|
+
### 3.5 NAPI 引用管理
|
|
302
|
+
|
|
303
|
+
**维度评分:{dim5Score}/100**
|
|
304
|
+
|
|
305
|
+
| 检查项 | 严重度 | 发现数量 | 详情 |
|
|
306
|
+
|--------|--------|----------|------|
|
|
307
|
+
| …… | …… | …… | …… |
|
|
308
|
+
|
|
309
|
+
### 3.6 C/C++ 层内存泄露
|
|
310
|
+
|
|
311
|
+
**维度评分:{dim6Score}/100**
|
|
312
|
+
|
|
313
|
+
| 检查项 | 严重度 | 发现数量 | 详情 |
|
|
314
|
+
|--------|--------|----------|------|
|
|
315
|
+
| …… | …… | …… | …… |
|
|
316
|
+
|
|
317
|
+
### 3.7 跨语言资源释放一致性
|
|
318
|
+
|
|
319
|
+
**维度评分:{dim7Score}/100**
|
|
320
|
+
|
|
321
|
+
| 检查项 | 严重度 | 发现数量 | 详情 |
|
|
322
|
+
|--------|--------|----------|------|
|
|
323
|
+
| …… | …… | …… | …… |
|
|
324
|
+
|
|
325
|
+
## 四、泄露风险清单
|
|
326
|
+
|
|
327
|
+
| # | 文件 | 行号 | 语言层 | 严重度 | 泄露类型 | 泄露描述 | 影响范围 | 修复建议 |
|
|
328
|
+
|---|------|------|--------|--------|----------|----------|----------|----------|
|
|
329
|
+
| …… | …… | …… | ArkTS/C++ | …… | …… | …… | …… | …… |
|
|
330
|
+
|
|
331
|
+
> **语言层**列标注问题所在的代码层:`ArkTS`(ETS/TS 层)或 `C++`(Native 层)或 `跨语言`(涉及两层交互)。
|
|
332
|
+
|
|
333
|
+
## 五、改进建议
|
|
334
|
+
|
|
335
|
+
### 5.1 Critical 级别修复优先级
|
|
336
|
+
|
|
337
|
+
(列出所有 Critical 问题的修复建议,按影响排序)
|
|
338
|
+
|
|
339
|
+
### 5.2 Major 级别修复建议
|
|
340
|
+
|
|
341
|
+
……
|
|
342
|
+
|
|
343
|
+
### 5.3 通用改进方案
|
|
344
|
+
|
|
345
|
+
……
|
|
346
|
+
|
|
347
|
+
---
|
|
348
|
+
|
|
349
|
+
**报告生成时间**:{timestamp}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
> **重要**:
|
|
353
|
+
> 1. 报告必须包含 `**综合评分:XX/100**` 格式,以便后端 `_parseArktsLibraryScore` 函数自动解析评分。
|
|
354
|
+
> 2. 每个维度必须包含 `**维度评分:XX/100**` 格式。
|
|
355
|
+
> 3. 泄露风险清单必须标注 **语言层**(ArkTS/C++/跨语言)。
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
## 输出产物
|
|
360
|
+
|
|
361
|
+
| 产物 | 文件名 | 说明 |
|
|
362
|
+
|------|--------|------|
|
|
363
|
+
| 内存泄露检视报告 | `内存泄露检视报告.md` | 综合评分 + 扣分明细 + 7维度评分 + 泄露清单 + 修复建议 |
|
|
364
|
+
|
|
365
|
+
所有产物写入 `{outputDir}` 目录。
|
|
366
|
+
|
|
367
|
+
> ⚠️ **输出文件自检**:写入结果文件前,先确认 `内存泄露检视报告.md` 已存在且内容完整(**独立文件,禁止只写入 result 执行结果文件**)。若报告内容仅在草稿中,必须先将其保存为上述独立文件。
|
|
368
|
+
|
|
369
|
+
### 结构化指标输出(必须执行)
|
|
370
|
+
|
|
371
|
+
执行环境会在任务 prompt 中下发一个**结构化指标文件输出路径**(`stepId{X}_loop{L}_meta_{N}.json`)。
|
|
372
|
+
检视完成后,**必须**将最终评分以下述 JSON 对象写入该路径:
|
|
373
|
+
|
|
374
|
+
```json
|
|
375
|
+
{
|
|
376
|
+
"memoryLeakScore": 85,
|
|
377
|
+
"scoreReason": "Critical泄露1处-20等(一句话判定依据,≤50字;触发零容忍规则时必须注明)"
|
|
378
|
+
}
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
| 字段 | 类型 | 说明 |
|
|
382
|
+
|------|------|------|
|
|
383
|
+
| `memoryLeakScore` | number | 内存泄露评分(0-100 整数,与报告中 `**综合评分:XX/100**` 的数值一致) |
|
|
384
|
+
| `scoreReason` | string | 评分判定依据摘要(可选,前端悬浮提示展示;0 分时强烈建议写明触发的扣分/零容忍规则) |
|
|
385
|
+
|
|
386
|
+
**说明**:该文件由执行框架自动收割入库(前端/历史列表直接读取评分,无需解析报告文本)。若 prompt 未下发该路径则跳过本节。
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
## 评分权重
|
|
391
|
+
|
|
392
|
+
本 SKILL 在 ArkTS 仓库检视综合评分中权重为 **25%**。
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: arkts-library-source-clone
|
|
3
|
+
description: 克隆鸿蒙 ArkTS 三方库 Git 仓库源码到工作目录的固定路径 source/ 目录下(git clone,支持分支/子路径),并记录克隆元信息。作为 ArkTS 仓库检视流程的第一阶段(源码准备),供后续接口分析与各维度检视 SKILL 复用。当需要下载/克隆 ArkTS 三方库源码到固定路径时调用。
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
compatibility: 需要 git 命令行工具和网络访问(Gitee/GitCode/GitHub)。
|
|
6
|
+
metadata:
|
|
7
|
+
version: "1.1.0"
|
|
8
|
+
category: harmonyos-development
|
|
9
|
+
language: ArkTS/ETS
|
|
10
|
+
useWhen: ArkTS 仓库检视流程第一步,克隆仓库源码到 {outputDir}/source/ 固定路径
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# ArkTS 三方库源码下载(固定路径克隆)
|
|
14
|
+
|
|
15
|
+
将 ArkTS 三方库仓库源码克隆到工作目录的**固定路径** `{outputDir}/source/`,供后续接口分析(arkts-library-interface-spec)与各维度检视 SKILL 直接复用。
|
|
16
|
+
|
|
17
|
+
> ⚠️ **核心原则**:源码必须克隆到 `{outputDir}/source/` 固定路径(后续所有检视 SKILL 均从该路径读取源码)。**不要**克隆到 `{outputDir}/{仓库名}` 等其他目录。
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 任务参数
|
|
22
|
+
|
|
23
|
+
| 参数 | 类型 | 必填 | 说明 |
|
|
24
|
+
|------|------|------|------|
|
|
25
|
+
| `outputDir` | string | ✅ | 工作目录(即任务下发的"工作目录",绝对路径),源码克隆到 `outputDir/source/` |
|
|
26
|
+
| `repoUrl` | string | ✅ | 仓库 Git 地址,支持分支参数 `?branch=xxx` 或 `/tree/xxx` 路径形式 |
|
|
27
|
+
|
|
28
|
+
**派生变量**:
|
|
29
|
+
- `repoName`:从 `repoUrl` 提取仓库名(取 URL 最后一段,去掉 `.git` 后缀,用于报告标识)
|
|
30
|
+
- `sourceDir`:源码目录 = `outputDir/source`(**固定路径,禁止变更**)
|
|
31
|
+
- `baseUrl`:去掉分支参数后的仓库基础地址
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 输入依赖
|
|
36
|
+
|
|
37
|
+
- **前置 SKILL**:无(本 SKILL 是 ArkTS 仓库检视流程的第一阶段)
|
|
38
|
+
- **输入文件**:无(通过 `repoUrl` 克隆源码)
|
|
39
|
+
- **下游消费者**:`arkts-library-interface-spec`(接口分析)、`arkts-library-stability-check`、`arkts-library-memory-leak-check`、`arkts-library-documentation-quality-check`、`arkts-library-test-coverage-check`(均从 `{outputDir}/source/` 读取源码)
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 工作流程
|
|
44
|
+
|
|
45
|
+
### 步骤 1:解析仓库地址
|
|
46
|
+
|
|
47
|
+
从 `repoUrl` 解析出 `baseUrl` 与 `branch`:
|
|
48
|
+
|
|
49
|
+
| URL 形式 | baseUrl | branch |
|
|
50
|
+
|----------|---------|--------|
|
|
51
|
+
| `https://gitee.com/openharmony-sig/lottie` | 同原 URL | 默认分支 |
|
|
52
|
+
| `https://gitcode.com/xxx/repo/tree/dev_ohos` | `https://gitcode.com/xxx/repo` | `dev_ohos` |
|
|
53
|
+
| `https://github.com/xxx/repo.git#branch=develop` | `https://github.com/xxx/repo.git` | `develop` |
|
|
54
|
+
| `https://gitee.com/xxx/repo?branch=master` | `https://gitee.com/xxx/repo` | `master` |
|
|
55
|
+
|
|
56
|
+
### 步骤 2:克隆源码到固定路径
|
|
57
|
+
|
|
58
|
+
若 `sourceDir`(`outputDir/source`)已存在且含有效仓库源码(存在 `.git` 目录或 `oh-package.json5` / 入口文件,入口文件名大小写不敏感),直接复用,跳过克隆。
|
|
59
|
+
|
|
60
|
+
否则执行克隆:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# 指定分支
|
|
64
|
+
git clone --depth=1 -b {branch} {baseUrl} {outputDir}/source
|
|
65
|
+
|
|
66
|
+
# 未指定分支(默认分支)
|
|
67
|
+
git clone --depth=1 {baseUrl} {outputDir}/source
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
克隆失败时按序降级重试:
|
|
71
|
+
1. 去掉 `--depth=1` 改为完整克隆
|
|
72
|
+
2. 去掉 `-b {branch}`(克隆默认分支后 `git checkout {branch}`,失败则使用默认分支)
|
|
73
|
+
|
|
74
|
+
> ⚠️ 判定克隆失败以**命令退出码非 0 或目标目录无仓库内容**为准。GitCode 仓库克隆时输出"警告:重定向到 .../xxx.git/"属**正常行为**(GitCode 自动补全 `.git` 后缀重定向),不代表克隆失败,**不应**因此触发降级重试。
|
|
75
|
+
|
|
76
|
+
> ⚠️ 克隆目标必须是 `{outputDir}/source`(目录本身即仓库根),**不要**克隆成 `{outputDir}/source/{repoName}`。
|
|
77
|
+
|
|
78
|
+
### 步骤 3:验证与记录元信息
|
|
79
|
+
|
|
80
|
+
1. **验证**:用 `list_dir` 确认 `sourceDir` 下存在源码文件(`.ets` / `.ts` / `oh-package.json5` / 入口文件 / `module.json5` 任一即可)
|
|
81
|
+
|
|
82
|
+
> ⚠️ **验证注意事项**:
|
|
83
|
+
> - **入口文件大小写不敏感**:ArkTS 库入口文件可能是 `index.ets`(小写,如 mp3agic)或 `Index.ets`(大写),两者均视为有效。macOS(大小写不敏感文件系统)上按字面匹配可偶然命中,但在 Linux(大小写敏感文件系统)上按字面匹配会漏判,匹配时必须显式做大小写不敏感处理。
|
|
84
|
+
> - **源码文件可能是 `.ts` 扩展名**:部分 ArkTS 库(如 mp3agic,`src/main/ets/` 下 48 个源文件全部为 `.ts`)的实现源码是 `.ts` 文件,`library/` 下仅入口 `index.ets` 一个 `.ets` 文件。**禁止以 `.ets` 文件数量作为源码存在的唯一判据**,应以 `oh-package.json5` / `module.json5` / 入口文件的存在为准。
|
|
85
|
+
|
|
86
|
+
2. **记录元信息**:将克隆信息写入 `{outputDir}/clone-info.json`:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"repoUrl": "{原始 repoUrl}",
|
|
91
|
+
"baseUrl": "{baseUrl}",
|
|
92
|
+
"branch": "{branch 或 null}",
|
|
93
|
+
"commit": "{git rev-parse HEAD 结果}",
|
|
94
|
+
"repoName": "{repoName}",
|
|
95
|
+
"sourceDir": "{outputDir}/source",
|
|
96
|
+
"cloneTime": "{timestamp}"
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
3. **失败处理**:若所有克隆方式均失败,在结果文件中说明失败原因并标注 `状态: 失败`,终止后续步骤。
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## 输出产物
|
|
105
|
+
|
|
106
|
+
| 产物 | 文件名 | 说明 |
|
|
107
|
+
|------|--------|------|
|
|
108
|
+
| 仓库源码 | `{outputDir}/source/` | 固定路径,后续所有检视 SKILL 的源码输入 |
|
|
109
|
+
| 克隆元信息 | `{outputDir}/clone-info.json` | baseUrl / branch / commit / repoName |
|
|
110
|
+
|
|
111
|
+
> ⚠️ **下游消费提示**:库实现源码文件可能为 `.ts` 扩展名(如 mp3agic),下游 SKILL 扫描源码时应同时包含 `*.ets` 与 `*.ts`(路径限定在 `src/main/ets/` 下),入口统一从 `index.ets` 解析导出。
|
|
112
|
+
|
|
113
|
+
所有产物写入 `{outputDir}` 目录。本 SKILL 无评分,无需输出结构化指标文件。
|