@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,358 @@
|
|
|
1
|
+
# Demo 生成指南
|
|
2
|
+
|
|
3
|
+
> Phase 2-3 的详细操作手册。核心是平台兼容性分析、可测试性设计、Demo 代码生成规范。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. 平台兼容性分析
|
|
8
|
+
|
|
9
|
+
### 1.1 Platform.OS 分支分析
|
|
10
|
+
|
|
11
|
+
搜索入口文件中的平台分支:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
grep -n "Platform.OS" {projectRoot}/node_modules/{harmonyPkgName}/index.js
|
|
15
|
+
grep -n "Platform.OS" {projectRoot}/node_modules/{harmonyPkgName}/src/**/*.ts
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
分析结果分类:
|
|
19
|
+
|
|
20
|
+
| 分类 | 特征 | 处理 |
|
|
21
|
+
|------|------|------|
|
|
22
|
+
| harmony 可用 | `Platform.OS === 'harmony'` 分支内定义 | 生成 Demo + Test |
|
|
23
|
+
| iOS/Android 专属 | 仅在其他分支定义 | 跳过,不生成 |
|
|
24
|
+
| 无平台分支 | TurboModule 原生适配,全部可用 | 全部生成 |
|
|
25
|
+
| 条件导出 | `if (Platform.OS === 'harmony')` 包裹整个导出 | 按实际导出处理 |
|
|
26
|
+
|
|
27
|
+
### 1.2 方法实现状态确认
|
|
28
|
+
|
|
29
|
+
探查 ArkTS 实现文件,排除未实现方法:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
grep -r "throw new Error('not implemented')" {projectRoot}/harmony/
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
| 状态 | 处理 |
|
|
36
|
+
|------|------|
|
|
37
|
+
| 已实现 | 正常生成 Demo + Test |
|
|
38
|
+
| `throw new Error('not implemented')` | 跳过,不生成 |
|
|
39
|
+
| 部分实现 | 标注,生成但测试中放宽断言 |
|
|
40
|
+
|
|
41
|
+
### 1.3 权限需求分析
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
cat {projectRoot}/harmony/entry/src/main/module.json5 | grep -A5 "requestPermissions"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
常见权限映射:
|
|
48
|
+
|
|
49
|
+
| 功能 | 权限 | Demo 处理 |
|
|
50
|
+
|------|------|-----------|
|
|
51
|
+
| 麦克风 | ohos.permission.MICROPHONE | 调用前请求权限 |
|
|
52
|
+
| 相机 | ohos.permission.CAMERA | 调用前请求权限 |
|
|
53
|
+
| 定位 | ohos.permission.LOCATION | 调用前请求权限 |
|
|
54
|
+
| 文件读写 | ohos.permission.FILE_READ/WRITE | 调用前请求权限 |
|
|
55
|
+
| 网络 | ohos.permission.INTERNET | 通常自动授予 |
|
|
56
|
+
|
|
57
|
+
### 1.4 MCP 工具辅助
|
|
58
|
+
|
|
59
|
+
调用 `script_rn_scan_exports` 交叉验证:
|
|
60
|
+
|
|
61
|
+
- `dir`:`{projectRoot}/node_modules/{harmonyPkgName}`
|
|
62
|
+
- `compare`:false
|
|
63
|
+
- 单目录扫描模式,提取 exports/interface/TurboModule 方法签名
|
|
64
|
+
|
|
65
|
+
调用 `kb_search` 查询鸿蒙平台特定约束:
|
|
66
|
+
- `HarmonyOS 权限 {功能}`
|
|
67
|
+
- `RNOH TurboModule 适配`
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 2. 可测试性设计规则
|
|
72
|
+
|
|
73
|
+
> ⚠️ 这是本技能与 `rnoh-lib-demo-create` 的核心差异。Demo 必须为 CPTF 自动化测试而设计。
|
|
74
|
+
|
|
75
|
+
### 2.1 testID 规则
|
|
76
|
+
|
|
77
|
+
| 元素 | testID 格式 | 示例 |
|
|
78
|
+
|------|------------|------|
|
|
79
|
+
| 触发按钮 | `{apiName}-btn` | `methodA-btn` |
|
|
80
|
+
| 结果文本 | `{apiName}-result` | `methodA-result` |
|
|
81
|
+
| 状态指示 | `{apiName}-status` | `recording-status` |
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
<Button testID="methodA-btn" title="调用 methodA" onPress={...} />
|
|
85
|
+
<Text testID="methodA-result">methodA结果:{result}</Text>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### 2.2 固定文本前缀规则
|
|
89
|
+
|
|
90
|
+
所有动态值必须附加固定前缀,格式:`{API名}结果:{值}`
|
|
91
|
+
|
|
92
|
+
| 场景 | 前缀格式 | 示例 |
|
|
93
|
+
|------|----------|------|
|
|
94
|
+
| 正常结果 | `{API名}结果:{值}` | `methodA结果:success` |
|
|
95
|
+
| 错误信息 | `错误信息:{error}` | `错误信息:TypeError` |
|
|
96
|
+
| 状态值 | `{API名}状态:{值}` | `录音状态:recording` |
|
|
97
|
+
| 数组结果 | `{API名}结果:{JSON}` | `getList结果:[1,2,3]` |
|
|
98
|
+
| 布尔值 | `{API名}结果:{true/false}` | `isEnabled结果:true` |
|
|
99
|
+
|
|
100
|
+
> ⚠️ 冒号统一使用**全角** `:`(中文冒号),与 testerino demo 常见风格一致。CPTF 的 `waitForText` 是子串精确匹配,断言时可省略冒号(如 `methodA结果`)以兼容两种冒号。
|
|
101
|
+
|
|
102
|
+
### 2.3 确定性输出规则
|
|
103
|
+
|
|
104
|
+
| 数据类型 | 处理方式 | 示例 |
|
|
105
|
+
|----------|----------|------|
|
|
106
|
+
| 随机数 | 附加范围标注 | `随机数结果:{value}(范围:0-100)` |
|
|
107
|
+
| 时间戳 | 转为可读格式 | `时间结果:{HH:MM:SS}` |
|
|
108
|
+
| UUID | 仅验证格式 | `UUID结果:{uuid}(格式校验)` |
|
|
109
|
+
| 大数据 | 截断显示 | `数据结果:{前100字符}...` |
|
|
110
|
+
| null/undefined | 显示字面量 | `结果:null` |
|
|
111
|
+
|
|
112
|
+
### 2.4 按钮唯一标识规则
|
|
113
|
+
|
|
114
|
+
每个按钮 title 必须包含 API 名,保证 `textContains` 全局唯一:
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
// 正确:title 含 API 名,唯一
|
|
118
|
+
<Button title="调用 methodA(参数1)" />
|
|
119
|
+
<Button title="调用 methodB" />
|
|
120
|
+
|
|
121
|
+
// 错误:title 重复或不唯一
|
|
122
|
+
<Button title="执行" />
|
|
123
|
+
<Button title="测试" />
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## 3. Demo 页面代码规范
|
|
129
|
+
|
|
130
|
+
### 3.1 目录结构
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
{exampleDir}/cptf/
|
|
134
|
+
├── index.tsx # 主入口
|
|
135
|
+
└── demo/
|
|
136
|
+
├── 001_{apiCategory1}Page.tsx # 按 API 分类拆分页面
|
|
137
|
+
├── 002_{apiCategory2}Page.tsx
|
|
138
|
+
└── ...
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
文件命名规则:
|
|
142
|
+
- 前缀序号:`001_`、`002_`,按 API 分类顺序
|
|
143
|
+
- 分类名:kebab-case,如 `turbo-module-methods`、`component-props`、`events`
|
|
144
|
+
- 示例:`001_turbo-module-methods.tsx`、`002_component-props.tsx`、`003_events.tsx`
|
|
145
|
+
|
|
146
|
+
### 3.2 页面代码核心规则
|
|
147
|
+
|
|
148
|
+
| 规则 | 说明 | 原因 |
|
|
149
|
+
|------|------|------|
|
|
150
|
+
| 根组件用 `View` | 禁止 `ScrollView` 作为根 | Tester 已有 ScrollView,嵌套导致高度塌陷 |
|
|
151
|
+
| 不用 `SafeAreaView`/`StatusBar` | Tester 框架不需要 | 避免冗余 |
|
|
152
|
+
| 不用 `Slider` | HarmonyOS 不支持 | 用按钮组替代 |
|
|
153
|
+
| 不用 `console.error()` | 会触发系统弹窗 | 用 `console.warn()` 替代 |
|
|
154
|
+
| 每个按钮设 `testID` | CPTF 优先 testID 定位 | 可测试性设计核心 |
|
|
155
|
+
| 结果 Text 固定前缀 | CPTF `waitForText` 可靠匹配 | 可测试性设计核心 |
|
|
156
|
+
| 无裸值渲染 | 所有动态值附加固定前缀 | 消除快照差集需求 |
|
|
157
|
+
| 平台兼容性 | 只用 harmony 分支 API | 基于 Phase 2.1 |
|
|
158
|
+
| 权限请求 | 敏感操作前请求权限 | HarmonyOS 权限模型 |
|
|
159
|
+
| 异步处理 | `async/await` + `try/catch` | 不用 `.then()/.catch()` 链 |
|
|
160
|
+
| 无注释 | 代码中不使用 `//` 或 `/* */` | 代码规范 |
|
|
161
|
+
| Hook 顶层调用 | 不在事件回调中调用 Hook | React Hooks 规则 |
|
|
162
|
+
| type 导入 | `import { type Xxx }` inline 语法 | 避免类型进入打包 |
|
|
163
|
+
| Provider 子组件拆分 | 依赖 Context 的 Hook/组件拆分 | 确保 Context 有值 |
|
|
164
|
+
| 废弃接口验证 | 使用 `===` 引用相等性比较 | 比功能对比更可靠 |
|
|
165
|
+
|
|
166
|
+
### 3.3 各 API 类型的 Demo 页面设计
|
|
167
|
+
|
|
168
|
+
#### 3.3.1 TurboModule 同步方法
|
|
169
|
+
|
|
170
|
+
```tsx
|
|
171
|
+
<View>
|
|
172
|
+
<Button testID="syncMethod-btn" title="调用 syncMethod(param)" onPress={() => {
|
|
173
|
+
try {
|
|
174
|
+
const result = NativeModule.syncMethod('param');
|
|
175
|
+
setResult(`syncMethod结果:${result}`);
|
|
176
|
+
} catch (e) {
|
|
177
|
+
setResult(`错误信息:${e}`);
|
|
178
|
+
}
|
|
179
|
+
}} />
|
|
180
|
+
<Text testID="syncMethod-result">{result}</Text>
|
|
181
|
+
</View>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
#### 3.3.2 TurboModule 异步方法
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
<View>
|
|
188
|
+
<Button testID="asyncMethod-btn" title="调用 asyncMethod(param)" onPress={async () => {
|
|
189
|
+
setLoading(true);
|
|
190
|
+
try {
|
|
191
|
+
const result = await NativeModule.asyncMethod('param');
|
|
192
|
+
setResult(`asyncMethod结果:${JSON.stringify(result)}`);
|
|
193
|
+
} catch (e) {
|
|
194
|
+
setResult(`错误信息:${e}`);
|
|
195
|
+
} finally {
|
|
196
|
+
setLoading(false);
|
|
197
|
+
}
|
|
198
|
+
}} />
|
|
199
|
+
<Text testID="asyncMethod-result">{loading ? '加载中...' : result}</Text>
|
|
200
|
+
</View>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
#### 3.3.3 事件回调
|
|
204
|
+
|
|
205
|
+
```tsx
|
|
206
|
+
<View>
|
|
207
|
+
<Button testID="startListen-btn" title="开始监听 onEvent" onPress={() => {
|
|
208
|
+
const sub = DeviceEventEmitter.addListener('onEvent', (data) => {
|
|
209
|
+
setEventResult(`onEvent结果:${JSON.stringify(data)}`);
|
|
210
|
+
});
|
|
211
|
+
setSubscription(sub);
|
|
212
|
+
}} />
|
|
213
|
+
<Button testID="stopListen-btn" title="停止监听 onEvent" onPress={() => {
|
|
214
|
+
subscription?.remove();
|
|
215
|
+
setEventResult('onEvent状态:已停止');
|
|
216
|
+
}} />
|
|
217
|
+
<Text testID="onEvent-result">{eventResult}</Text>
|
|
218
|
+
</View>
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
#### 3.3.4 组件属性
|
|
222
|
+
|
|
223
|
+
```tsx
|
|
224
|
+
<View>
|
|
225
|
+
<Button testID="toggleProp-btn" title="切换 prop1 值" onPress={() => setProp1(!prop1)} />
|
|
226
|
+
<Text testID="componentProp-result">组件属性prop1:{String(prop1)}</Text>
|
|
227
|
+
<ComponentA prop1={prop1} />
|
|
228
|
+
</View>
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
#### 3.3.5 常量/枚举
|
|
232
|
+
|
|
233
|
+
```tsx
|
|
234
|
+
<View>
|
|
235
|
+
<Text testID="constant-result">常量CONSTANT_A:{NativeModule.CONSTANT_A}</Text>
|
|
236
|
+
</View>
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### 3.4 权限请求模板
|
|
240
|
+
|
|
241
|
+
```tsx
|
|
242
|
+
import { Permissions } from 'react-native';
|
|
243
|
+
|
|
244
|
+
const requestPermission = async (permission: string): Promise<boolean> => {
|
|
245
|
+
try {
|
|
246
|
+
const granted = await Permissions.request(permission);
|
|
247
|
+
return granted === 'granted';
|
|
248
|
+
} catch (e) {
|
|
249
|
+
console.warn(`权限请求失败: ${e}`);
|
|
250
|
+
return false;
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## 4. 主入口文件与注册
|
|
258
|
+
|
|
259
|
+
### 4.1 index.tsx 结构
|
|
260
|
+
|
|
261
|
+
```tsx
|
|
262
|
+
import { Tester, TestSuite, TestCase } from '@rnoh/testerino';
|
|
263
|
+
import React from 'react';
|
|
264
|
+
import { TurboModuleMethodsPage } from './demo/001_turbo-module-methods';
|
|
265
|
+
import { ComponentPropsPage } from './demo/002_component-props';
|
|
266
|
+
import { EventsPage } from './demo/003_events';
|
|
267
|
+
|
|
268
|
+
function {LibName}Tester() {
|
|
269
|
+
return (
|
|
270
|
+
<Tester>
|
|
271
|
+
<TestSuite name="{libName}">
|
|
272
|
+
<TestCase itShould="TurboModule 方法测试" tags={['C_API']}>
|
|
273
|
+
<TurboModuleMethodsPage />
|
|
274
|
+
</TestCase>
|
|
275
|
+
<TestCase itShould="组件属性测试" tags={['C_API']}>
|
|
276
|
+
<ComponentPropsPage />
|
|
277
|
+
</TestCase>
|
|
278
|
+
<TestCase itShould="事件回调测试" tags={['C_API']}>
|
|
279
|
+
<EventsPage />
|
|
280
|
+
</TestCase>
|
|
281
|
+
</TestSuite>
|
|
282
|
+
</Tester>
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export default {LibName}Tester;
|
|
287
|
+
export const displayName = '{libName}';
|
|
288
|
+
export const framework = 'react';
|
|
289
|
+
export const category = '{category}';
|
|
290
|
+
export const title = '{libName}';
|
|
291
|
+
export const description = '{libName} 接口规格驱动 Demo';
|
|
292
|
+
export const examples = [
|
|
293
|
+
{ title: 'TurboModule 方法', description: '...' },
|
|
294
|
+
{ title: '组件属性', description: '...' },
|
|
295
|
+
{ title: '事件回调', description: '...' },
|
|
296
|
+
];
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### 4.2 Demo 入口切换
|
|
300
|
+
|
|
301
|
+
> 本技能不修改现有 `registerFile`(如 `RNTesterList.ts`),而是直接修改 `{exampleDir}/index.js`,将 App 入口指向 CPTF Demo:
|
|
302
|
+
|
|
303
|
+
```js
|
|
304
|
+
// {exampleDir}/index.js — 修改前
|
|
305
|
+
import App from './src/index';
|
|
306
|
+
// 修改后
|
|
307
|
+
import App from './cptf/index';
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
这样 CPTF 测试运行时 App 直接加载 CPTF Demo 页面,无需在现有 Demo 注册体系中追加。
|
|
311
|
+
|
|
312
|
+
### 4.3 入口切换说明
|
|
313
|
+
|
|
314
|
+
本技能采用**直接修改 `index.js`** 的方式切换 Demo 入口,而非在现有 `registerFile`(如 `RNTesterList.ts`)中追加注册。原因:
|
|
315
|
+
|
|
316
|
+
1. CPTF 测试需要 App 启动即加载 CPTF Demo 页面(含 testerino Tester 框架),不经过现有 Demo 选择器
|
|
317
|
+
2. 不污染现有 Demo 注册体系,交付后可轻松恢复(将 `index.js` 改回 `./src/index`)
|
|
318
|
+
3. 无需识别 registerFile 的注册模式(A/B/C)
|
|
319
|
+
|
|
320
|
+
> ⚠️ 修改 `index.js` 后必须重新构建 HAP(`npm run dev` + `devecocli build`),否则设备上的 `bundle.harmony.js` 不含新入口。
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## 5. 常见陷阱
|
|
325
|
+
|
|
326
|
+
### 5.1 全角/半角冒号
|
|
327
|
+
|
|
328
|
+
Demo 代码中结果文本的冒号必须统一使用全角 `:`,CPTF 测试的 `waitForText` 参数也必须逐字符匹配。
|
|
329
|
+
|
|
330
|
+
如果 Demo 代码中混用了半角 `:`,CPTF 测试将无法匹配,导致步骤超时。
|
|
331
|
+
|
|
332
|
+
### 5.2 异步渲染时序
|
|
333
|
+
|
|
334
|
+
异步方法调用后,结果 Text 可能需要一段时间才渲染。Demo 代码应:
|
|
335
|
+
- 异步执行期间显示 `加载中...` 文本
|
|
336
|
+
- CPTF 测试的 `waitForText` 应轮询等待(timeout 8000ms)
|
|
337
|
+
|
|
338
|
+
### 5.3 事件监听清理
|
|
339
|
+
|
|
340
|
+
Demo 中注册的事件监听器必须在组件卸载时清理:
|
|
341
|
+
|
|
342
|
+
```tsx
|
|
343
|
+
useEffect(() => {
|
|
344
|
+
return () => {
|
|
345
|
+
subscription?.remove();
|
|
346
|
+
};
|
|
347
|
+
}, [subscription]);
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
否则 CPTF 测试重复进入页面时可能出现内存泄漏。
|
|
351
|
+
|
|
352
|
+
### 5.4 无平台分支库
|
|
353
|
+
|
|
354
|
+
部分库(如 `react-native-safe-area-context`)没有 `Platform.OS === 'harmony'` 分支,而是通过 TurboModule 原生适配。探查时需区分此类库,无需过滤 iOS/Android 专属属性,JS 层所有导出在 HarmonyOS 上全部可用。
|
|
355
|
+
|
|
356
|
+
### 5.5 废弃接口
|
|
357
|
+
|
|
358
|
+
部分库包含 `@deprecated` 废弃别名接口。废弃接口在 HarmonyOS 平台仍正常可用,需生成 Demo 验证其兼容性,并使用引用相等性比较(`===`)验证别名关系。
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# 质量检查清单
|
|
2
|
+
|
|
3
|
+
> Phase 6 的完整校验清单。生成完成后逐项检查。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. 接口规格解析检查
|
|
8
|
+
|
|
9
|
+
| # | 检查项 | 规则 | 通过条件 |
|
|
10
|
+
|---|--------|------|----------|
|
|
11
|
+
| 1.1 | 规格文档已读取 | specDoc 文件存在且可解析 | ✅ |
|
|
12
|
+
| 1.2 | API 清单完整 | 所有 API 类别(方法/组件/事件/常量)已提取 | ✅ |
|
|
13
|
+
| 1.3 | API 信息完整 | 每个 API 含名称、类型、参数、返回值、平台 | ✅ |
|
|
14
|
+
| 1.4 | 工程目录已探查 | exampleDir 已确定 | ✅ |
|
|
15
|
+
| 1.5 | 注册入口已探查 | registerFile 已确定,注册模式已识别 | ✅ |
|
|
16
|
+
| 1.6 | 构建信息已提取 | bundleId、hapPath 已提取 | ✅ 或标注缺失 |
|
|
17
|
+
| 1.7 | 依赖已确认 | package.json 含 harmonyPkgName | ✅ |
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 2. 平台兼容性检查
|
|
22
|
+
|
|
23
|
+
| # | 检查项 | 规则 | 通过条件 |
|
|
24
|
+
|---|--------|------|----------|
|
|
25
|
+
| 2.1 | Platform.OS 分支已分析 | 已识别 harmony 可用/不可用 API | ✅ |
|
|
26
|
+
| 2.2 | 无平台分支库已识别 | TurboModule 适配库全部可用 | ✅ 或标注不适用 |
|
|
27
|
+
| 2.3 | 未实现方法已排除 | `throw new Error('not implemented')` 方法已跳过 | ✅ |
|
|
28
|
+
| 2.4 | 权限需求已标注 | 敏感权限 API 已标注 | ✅ |
|
|
29
|
+
| 2.5 | 映射表已构建 | 每个 API 有 Demo 步骤和 Test 步骤对应 | ✅ |
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 3. Demo 代码检查
|
|
34
|
+
|
|
35
|
+
| # | 检查项 | 规则 | 通过条件 |
|
|
36
|
+
|---|--------|------|----------|
|
|
37
|
+
| 3.1 | 目录结构 | `{exampleDir}/cptf/demo/00X_*.tsx` | ✅ |
|
|
38
|
+
| 3.2 | 根组件 | 用 `View`,非 `ScrollView` | ✅ |
|
|
39
|
+
| 3.3 | testID 设置 | 每个可交互按钮设 `testID="{apiName}-btn"` | ✅ |
|
|
40
|
+
| 3.4 | 固定文本前缀 | 结果 Text 用 `{API名}结果:{值}` 格式 | ✅ |
|
|
41
|
+
| 3.5 | 无裸值渲染 | 所有动态值附加固定前缀 | ✅ |
|
|
42
|
+
| 3.6 | 全角冒号 | 结果文本冒号统一全角 `:` | ✅ |
|
|
43
|
+
| 3.7 | 按钮唯一标识 | title 含 API 名,全局唯一 | ✅ |
|
|
44
|
+
| 3.8 | 无 Slider | 未使用 `Slider` 组件 | ✅ |
|
|
45
|
+
| 3.9 | 无 console.error | 未使用 `console.error()` | ✅ |
|
|
46
|
+
| 3.10 | 无注释 | 代码中无 `//` 或 `/* */` | ✅ |
|
|
47
|
+
| 3.11 | 异步处理 | 用 `async/await` + `try/catch` | ✅ |
|
|
48
|
+
| 3.12 | 权限请求 | 敏感操作前有权限请求 | ✅ 或标注不适用 |
|
|
49
|
+
| 3.13 | 平台兼容性 | 未使用 iOS/Android 专属属性 | ✅ |
|
|
50
|
+
| 3.14 | Hook 顶层调用 | Hook 不在事件回调中调用 | ✅ 或标注不适用 |
|
|
51
|
+
| 3.15 | 入口文件 | `{exampleDir}/cptf/index.tsx` 含 Tester 集成 + 元数据导出 | ✅ |
|
|
52
|
+
| 3.16 | Demo 入口切换 | `{exampleDir}/index.js` 已修改指向 `./cptf/index` | ✅ |
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 4. CPTF 测试工程检查
|
|
57
|
+
|
|
58
|
+
| # | 检查项 | 规则 | 通过条件 |
|
|
59
|
+
|---|--------|------|----------|
|
|
60
|
+
| 4.1 | cptf.config.json | 存在且含 bundleId / casesDir / timezone / platforms.harmony.appPath / devices | ✅ |
|
|
61
|
+
| 4.2 | appPath 绝对路径 | platforms.harmony.appPath 以 `/` 开头 | ✅ |
|
|
62
|
+
| 4.3 | tsconfig.json | 存在且**不含** `experimentalDecorators` / `emitDecoratorMetadata` | ✅ |
|
|
63
|
+
| 4.4 | package.json link | 声明 `@cptf/framework` link + `reflect-metadata` link | ✅ |
|
|
64
|
+
| 4.5 | node_modules | @cptf/framework + reflect-metadata 已建立 | ✅ |
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 5. CPTF 测试文件检查
|
|
69
|
+
|
|
70
|
+
| # | 检查项 | 规则 | 通过条件 |
|
|
71
|
+
|---|--------|------|----------|
|
|
72
|
+
| 5.1 | 首行 import | `import 'reflect-metadata'` | ✅ |
|
|
73
|
+
| 5.2 | stepTimeout | 每个 @Step 显式设置 `stepTimeout: 30000` | ✅ |
|
|
74
|
+
| 5.3 | testCaseExecutor | 文件末尾导出 `testCaseExecutor` | ✅ |
|
|
75
|
+
| 5.4 | 多文件拆分 | 按 API 分类拆分,每个文件一个 `@Test`(非全部放一个文件) | ✅ |
|
|
76
|
+
| 5.5 | 导航策略 | 注册 `single-page` 导航策略 | ✅ |
|
|
77
|
+
| 5.6 | @Test 装饰器 | 含 id / name / module / platform / navigationStrategy | ✅ |
|
|
78
|
+
| 5.7 | 辅助方法 | 含 scrollAndClick / waitForText / report | ✅ |
|
|
79
|
+
| 5.8 | testID 定位 | 优先用 testID 定位(Demo 已设置) | ✅ |
|
|
80
|
+
| 5.9 | 回调类 API 容错 | `(Module as any)` 调用的 API 使用容错断言 | ✅ 或标注不适用 |
|
|
81
|
+
| 5.10 | 全角冒号风险 | waitForText 参数含半角冒号的行(警告) | ⚠️ 或 ✅ |
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## 6. Demo-Test 对齐检查
|
|
86
|
+
|
|
87
|
+
| # | 检查项 | 规则 | 通过条件 |
|
|
88
|
+
|---|--------|------|----------|
|
|
89
|
+
| 6.1 | API 覆盖一致 | Demo 中的 API 数量 = Test 中的 @Step 数量 | ✅ |
|
|
90
|
+
| 6.2 | testID 一致 | Demo 的 testID = Test 的 scrollAndClickByTestId 参数 | ✅ |
|
|
91
|
+
| 6.3 | 断言文本前缀匹配 | Demo 的 Text 前缀 = Test 的 waitForText 参数 | ✅ |
|
|
92
|
+
| 6.4 | 按钮定位一致 | Demo 的按钮 title = Test 的 textContains 关键字 | ✅ |
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## 7. 渐进式披露检查
|
|
97
|
+
|
|
98
|
+
| # | 检查项 | 规则 | 通过条件 |
|
|
99
|
+
|---|--------|------|----------|
|
|
100
|
+
| 7.1 | SKILL.md body 行数 | < 500 行 | ✅ |
|
|
101
|
+
| 7.2 | references 一层深度 | 无嵌套子目录 | ✅ |
|
|
102
|
+
| 7.3 | 文件引用相对路径 | 无绝对路径引用 | ✅ |
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 8. 自动化校验
|
|
107
|
+
|
|
108
|
+
运行校验脚本执行上述检查:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
bash {skillDir}/scripts/validate-rnoh-cptf-api-test.sh '{"workspaceDir":"<绝对路径>","demoDir":"<绝对路径>"}'
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
脚本输出 `ALL CHECKS PASSED` 表示全部通过,否则列出失败项。
|