@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,78 @@
|
|
|
1
|
+
# 壳层适配必查清单(库依赖接入)
|
|
2
|
+
|
|
3
|
+
> 模板拷贝与改名完成后,将目标库接入 example 工程的必查清单。所有类名/路径/链接目标均由库 `package.json` 的元数据派生,禁止手抄猜测。
|
|
4
|
+
|
|
5
|
+
## 一、库元数据读取
|
|
6
|
+
|
|
7
|
+
从库根 `package.json` 读取以下字段,作为后续所有适配的输入:
|
|
8
|
+
|
|
9
|
+
| 字段 | 用途 |
|
|
10
|
+
|------|------|
|
|
11
|
+
| `name` / `version` | npm 依赖名与 tgz 版本号 |
|
|
12
|
+
| `harmony.alias` | metro/tsconfig 别名 |
|
|
13
|
+
| `harmony.autolinking.ohPackageName` | ohpm 包名 |
|
|
14
|
+
| `harmony.autolinking.etsPackageClassName` | `RNPackagesFactory.ets` import 的类名 |
|
|
15
|
+
| `harmony.autolinking.cppPackageClassName` | `PackageProvider.cpp` 的类名 |
|
|
16
|
+
| `harmony.autolinking.cmakeLibraryTargetName` | `CMakeLists.txt` link 目标 |
|
|
17
|
+
| 源码模块路径(`harmony/{module}/`) | `build-profile.template.json5` 的 `modules[]` 与 CMake 路径 |
|
|
18
|
+
|
|
19
|
+
## 二、库依赖接入(⚠️ 必须用 tgz)
|
|
20
|
+
|
|
21
|
+
1. 库根 `.npmignore` 追加 `example`(否则 npm pack 会把整个 example 工程打进库包)
|
|
22
|
+
2. 库根执行 `npm pack` 生成 `{包名去scope横线}-{版本}.tgz`
|
|
23
|
+
3. `example/package.json` 依赖写 `"file:../{tgz文件名}"`
|
|
24
|
+
4. 重装后确认 `node_modules/{ohPackageName}` 为**实体目录**而非符号链接
|
|
25
|
+
|
|
26
|
+
> ⚠️ **禁止 `file:../目录` 形式**:npm 对目录型 `file:` 依赖默认以 symlink 安装,Metro/watchman 不跟随工程目录外的链接,`npm run dev` 报 `Unable to resolve module`。CPF-RN 系列仓库(netinfo、async-storage 等)均采用 tgz 方式,这是既定惯例。
|
|
27
|
+
|
|
28
|
+
## 三、壳层适配必查文件
|
|
29
|
+
|
|
30
|
+
| 文件 | 适配内容 |
|
|
31
|
+
|------|----------|
|
|
32
|
+
| `harmony/entry/oh-package.json5` | 追加库 HAR:`"{ohPackageName}": "file:../../node_modules/{ohPackageName}/harmony/{module}.har"` |
|
|
33
|
+
| `harmony/entry/src/main/cpp/CMakeLists.txt` | `add_subdirectory` 指向 **node_modules**:`${NODE_MODULES}/{ohPackageName}/{sourceModulePath}/src/main/cpp`。⚠️ 严禁 oh_modules(HAR 内无 cpp 源码)。纯 ETS 库(无 cpp)跳过 |
|
|
34
|
+
| `harmony/entry/src/main/cpp/PackageProvider.cpp` | `#include "{cppPackageClassName}.h"` + `std::make_shared<{cppPackageClassName}>(ctx)` |
|
|
35
|
+
| `harmony/entry/src/main/ets/RNPackagesFactory.ets` | `import { {etsPackageClassName} } from '{ohPackageName}/ts'`,并在返回数组中 `new {etsPackageClassName}(ctx)` |
|
|
36
|
+
| `harmony/entry/src/main/ets/pages/Index.ets` | 纯 TurboModule 库:`buildCustomRNComponent` 保持空、`arkTsComponentNames` 为空数组;有 Fabric 组件的库在此注册 |
|
|
37
|
+
| `harmony/build-profile.template.json5` | `modules` 追加库源码模块 `{name: '{harmonyModuleName}', srcPath: '../../harmony/{module}'}`;删除 `useNormalizedOHMUrl`。⚠️ 改 template 而非 build-profile.json5(postinstall 会用 template 覆盖生成) |
|
|
38
|
+
| `harmony/entry/src/main/module.json5` | 权限最小化:仅保留库所需权限(如 sqlite 仅 INTERNET),模板默认已只有 INTERNET,勿盲目添加 |
|
|
39
|
+
| `metro.config.js` / `tsconfig.json` | `{alias}` → `node_modules/{ohPackageName}` 映射 |
|
|
40
|
+
|
|
41
|
+
## 四、模板残留清理
|
|
42
|
+
|
|
43
|
+
- `module.json5` 的 `querySchemes`(脚本已自动移除;库需要时再按需添加)
|
|
44
|
+
- `src/` 下模板旧 demo 目录(当前模板仅 `src/index.tsx`,无旧 demo;若模板升级后带旧 demo 须删除)
|
|
45
|
+
- 全局 `grep -rn "wechat\|weixin\|camera" example/` 确认无残留
|
|
46
|
+
- 确认 `example/.npmrc` 已删除(含凭据文件严禁带入交付物)
|
|
47
|
+
|
|
48
|
+
## 五、RNTesterList 注册入口预置
|
|
49
|
+
|
|
50
|
+
下游技能(rnoh-lib-demo-create / rnoh-cptf-api-test)探查 Demo 注册入口的**第一优先级是 `{projectRoot}/**/RNTesterList.ts`**。模板原生只有 `App.tsx + src/index.tsx` 模式,必须**预置模式 A 注册入口**,否则后续 Demo 生成步骤找不到注册入口。
|
|
51
|
+
|
|
52
|
+
### 5.1 创建 `example/src/RNTesterList.ts`
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
export interface RNTesterModule {
|
|
56
|
+
key: string;
|
|
57
|
+
category: string;
|
|
58
|
+
module: any;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const RNTesterList: RNTesterModule[] = [
|
|
62
|
+
{
|
|
63
|
+
key: '{libName}',
|
|
64
|
+
category: '{category}',
|
|
65
|
+
module: require('./{libName}'),
|
|
66
|
+
},
|
|
67
|
+
];
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
首项指向 `{exampleDir}/{libName}/index.tsx`(后续由 Demo 生成技能创建)。同时预置 1 个**冒烟 Demo**(`{exampleDir}/{libName}/index.tsx` + 一个最小可用页面,如 sqlite 库的 openDatabase→executeSql→close 全链路)验证注册链路与原生桥通,保证不是空壳。
|
|
71
|
+
|
|
72
|
+
### 5.2 `App.tsx` 消费 RNTesterList 渲染页面
|
|
73
|
+
|
|
74
|
+
将 `src/index.tsx`(或 App 组件)改为消费 `RNTesterList` 渲染 Navigation 列表页,点击进入各 Demo 页面。
|
|
75
|
+
|
|
76
|
+
### 5.3 衔接约定
|
|
77
|
+
|
|
78
|
+
后续 Demo 生成步骤只需向 `RNTesterList` 数组追加 `{key, category, module}` 条目即完成注册,无需再改 App.tsx。
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# RN3rdTemplate 模板仓库指南
|
|
2
|
+
|
|
3
|
+
> 模板仓库地址:https://gitcode.com/lalhanOrz/RN3rdTemplate(git clone 默认分支 main)
|
|
4
|
+
|
|
5
|
+
## 仓库结构
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
RN3rdTemplate/
|
|
9
|
+
├── 0.77/ # RNOH 0.77 完整模板工程
|
|
10
|
+
├── 0.82/ # RNOH 0.82 完整模板工程
|
|
11
|
+
├── 0.84/ # RNOH 0.84 完整模板工程
|
|
12
|
+
├── scripts/ # 仓库自带集成脚本(auto-integrate.sh / add-library.sh / parse-library.py 等)
|
|
13
|
+
├── skills/ # 相关技能目录
|
|
14
|
+
├── README.md
|
|
15
|
+
└── update-harmony-lib.md
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 版本对照表
|
|
19
|
+
|
|
20
|
+
| 属性 | 0.77 模板 | 0.82 模板 | 0.84 模板 |
|
|
21
|
+
|------|-----------|-----------|-----------|
|
|
22
|
+
| React Native | 0.77.1 | 0.82.1 | 0.84.1 |
|
|
23
|
+
| React | 18.3.1 | 19.1.1 | 19.2.3 |
|
|
24
|
+
| RNOH 核心(react-native-harmony) | 0.77.18-1 | 0.82.30 | 0.84.2 |
|
|
25
|
+
| compatibleSdkVersion | 5.0.0(12) | 5.0.0(12) | 5.0.0(12) |
|
|
26
|
+
|
|
27
|
+
**版本选择规则**:读取目标库 `package.json` 的 `dependencies`(或 devDependencies/peerDependencies)中 `@react-native-oh/react-native-harmony` / `react-native-harmony` / `react-native` 的版本号,取 `major.minor`(如 `0.82.30` → `0.82`)对应模板目录。无法推断时必须询问用户,禁止猜测。
|
|
28
|
+
|
|
29
|
+
**版本注意**:
|
|
30
|
+
- 不同版本的 HAR 不通用,必须使用对应版本的模板
|
|
31
|
+
- RNOH 0.82 的 `compatibleSdkVersion: '5.0.0(12)'` 可直接使用;**0.84 的 HAR 元数据要求最低 API 17**,使用 0.84 模板时需按知识库经验(`experiences/rnoh-example-template-compatiblesdkversion-upgrade`)升级 compatibleSdkVersion
|
|
32
|
+
|
|
33
|
+
## 模板目录内容(以 0.82 为例)
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
0.82/
|
|
37
|
+
├── app.json # RN 应用名(name/displayName)
|
|
38
|
+
├── package.json # name: react-native-harmony-tester
|
|
39
|
+
├── index.js # AppRegistry 入口(读 app.json 的 name)
|
|
40
|
+
├── metro.config.js / tsconfig.json # RN 构建配置
|
|
41
|
+
├── src/index.tsx # App 根组件(Hello RNOH 占位)
|
|
42
|
+
├── scripts/create-build-profile.js # postinstall:由 template 生成 build-profile.json5
|
|
43
|
+
└── harmony/
|
|
44
|
+
├── AppScope/app.json5 # bundleName / label($string:app_name)
|
|
45
|
+
├── build-profile.template.json5 # 应用级构建配置模板(signingConfigs 为空)
|
|
46
|
+
├── entry/
|
|
47
|
+
│ ├── oh-package.json5 # @rnoh/react-native-openharmony HAR(file:../../node_modules/...)
|
|
48
|
+
│ ├── build-profile.json5 # entry 模块 native 编译配置
|
|
49
|
+
│ └── src/main/
|
|
50
|
+
│ ├── cpp/ # CMakeLists.txt + PackageProvider.cpp
|
|
51
|
+
│ ├── ets/
|
|
52
|
+
│ │ ├── RNPackagesFactory.ets # 三方库 ArkTS Package 注册(默认空)
|
|
53
|
+
│ │ └── pages/Index.ets # RN 页面加载(buildCustomRNComponent 默认空)
|
|
54
|
+
│ ├── resources/base/element/string.json # EntryAbility_label
|
|
55
|
+
│ └── module.json5 # 权限(默认仅 INTERNET)、querySchemes(模板残留 weixin)
|
|
56
|
+
└── oh-package.json5
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## 手动拷贝步骤(脚本不可用时的替代流程)
|
|
60
|
+
|
|
61
|
+
1. `git clone --depth 1 https://gitcode.com/lalhanOrz/RN3rdTemplate.git <tmpDir>`
|
|
62
|
+
2. 复制 `<tmpDir>/<版本>/` 全部内容到 `<libRoot>/example/`(排除 `.git`、`.DS_Store`、`.npmrc`)
|
|
63
|
+
3. 删除 `<tmpDir>`,然后按 [APP_RENAME_GUIDE.md](APP_RENAME_GUIDE.md) 逐项修改 app 名称
|
|
64
|
+
|
|
65
|
+
## 模板 README 自带注意事项
|
|
66
|
+
|
|
67
|
+
1. `build-profile.template.json5` 中 `signingConfigs` 为空,未配置签名时产出 unsigned HAP 属预期,真机部署前需在 DevEco Studio 配置签名
|
|
68
|
+
2. 每次新增/修改三方库后需运行 `npm run codegen` 重新生成代码
|
|
69
|
+
3. 运行 Metro 前需执行 `hdc rport tcp:8081 tcp:8081` 端口转发
|
|
70
|
+
4. 仓库根 `scripts/` 提供库集成辅助脚本(auto-integrate.sh 等,Bash 脚本,仅类 Unix 环境可用),本 SKILL 优先使用自带跨平台脚本 `scripts/create-example.cjs`
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# 渐进式验证指南
|
|
2
|
+
|
|
3
|
+
> example 工程创建完成后的标准验证链。按顺序执行,前一步失败先修复再继续——每一步暴露的问题层次不同,越早暴露成本越低。
|
|
4
|
+
|
|
5
|
+
## 验证链(全部通过的标准动作)
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
1. cd example && npm install --legacy-peer-deps # postinstall 生成 build-profile.json5
|
|
9
|
+
2. npm run dev # codegen + bundle-harmony → rawfile/bundle.harmony.js
|
|
10
|
+
3. cd harmony && ohpm install --all # HAR 从 node_modules 经 file: 解析
|
|
11
|
+
4. hvigorw assembleHap --no-daemon # CMake/Ninja + HAP 打包
|
|
12
|
+
5. nm -gU .../librnoh_app.so | grep <cppPackageClassName> # 确认库 C++ 包符号已链入(纯 ETS 库跳过)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 各步骤要点
|
|
16
|
+
|
|
17
|
+
| 步骤 | 验证内容 | 要点 |
|
|
18
|
+
|------|----------|------|
|
|
19
|
+
| 1. npm install | 依赖解析 | 若依赖是本地库 tgz,确认 node_modules 中为实体目录非符号链接 |
|
|
20
|
+
| 2. npm run dev | JS 依赖/alias/bundle | **成本最低,能暴露 alias/依赖问题,不要跳过直接做鸿蒙编译**。产物 `rawfile/bundle.harmony.js` 可 grep 校验:应含 Demo 特征字符串(如 `smoke_test.db`),不应含模板残留(如 `camera`) |
|
|
21
|
+
| 3. ohpm install | HAR 解析 | `--all` 会同时在库源码模块内产生 oh_modules(库根 .gitignore 需覆盖) |
|
|
22
|
+
| 4. hvigorw assembleHap | 原生编译 + 打包 | 未配置 signingConfigs 时产出 **unsigned HAP 属预期**,不是构建失败 |
|
|
23
|
+
| 5. nm 符号检查 | C++ 链接 | `nm -gU {example}/harmony/entry/build/default/intermediates/libs/default/arm64-v8a/librnoh_app.so \| grep {cppPackageClassName}` |
|
|
24
|
+
|
|
25
|
+
**hvigor 调用方式**(用 DevEco 自带 node):
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
/Applications/DevEco-Studio.app/Contents/tools/node/bin/node \
|
|
29
|
+
/Applications/DevEco-Studio.app/Contents/tools/hvigor/bin/hvigorw.js assembleHap --no-daemon
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
**SDK 版本注意**:
|
|
33
|
+
- RNOH **0.82** 模板的 `compatibleSdkVersion: '5.0.0(12)'` 可直接使用
|
|
34
|
+
- RNOH **0.84** 的 HAR 要求最低 API 17,需升级 compatibleSdkVersion(详见知识库 `experiences/rnoh-example-template-compatiblesdkversion-upgrade`)
|
|
35
|
+
|
|
36
|
+
**真机部署**:模板不携带签名证书,部署前在 `build-profile.json5` 补 signingConfigs(postinstall 保留已有签名配置)。运行 Metro 前需 `hdc rport tcp:8081 tcp:8081`。
|
|
37
|
+
|
|
38
|
+
## 常见故障排查
|
|
39
|
+
|
|
40
|
+
| 现象 | 根因 | 解决 |
|
|
41
|
+
|------|------|------|
|
|
42
|
+
| `Unable to resolve module @react-native-ohos/...` | 库依赖用了 `file:../目录`,node_modules 中为符号链接 | 改用 `npm pack` tgz + `file:../xxx.tgz`,删旧链接重装 |
|
|
43
|
+
| `TreeFS: Could not add directory node_modules/... already exists in the file map as a file` | node_modules 布局变更后 Metro/watchman 缓存污染 | `rm -rf node_modules/.cache && watchman watch-del-all` 后重跑 |
|
|
44
|
+
| `add_subdirectory given source ".../oh_modules/.../src/main/cpp" which is not an existing directory` | CMake 路径误用 oh_modules(HAR 内无 cpp 源码) | 改为 `${NODE_MODULES}/{ohPackageName}/{sourceModulePath}/src/main/cpp` |
|
|
45
|
+
| hvigor 报 entry 模块缺 build-profile | `harmony/entry/build-profile.json5` 缺失 | postinstall 会从 template 恢复;确认 `npm install` 已执行 |
|
|
46
|
+
| 构建产物含模板残留字符串 | 旧 demo/依赖未清理 | 清理 src 下旧目录、移除模板库依赖后重跑 `npm run dev` |
|
|
47
|
+
| bundle 中找不到库代码 | metro alias 未配置 | `metro.config.js` / `tsconfig.json` 补 `{alias}` → `node_modules/{ohPackageName}` 映射 |
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @tool create-example
|
|
4
|
+
* @description 从 RN3rdTemplate 模板仓库浅拷贝对应 RNOH 框架版本的 example 模板到目标三方库,修改 app 名称与工程标识,并清理安全残留(.npmrc)与模板残留(querySchemes)。跨平台(Windows/macOS/Linux),仅需 Node.js + git。
|
|
5
|
+
* @param libPath: string - 目标库根目录(绝对路径,含 package.json)
|
|
6
|
+
* @param version: string - RNOH 框架版本(0.77/0.82/0.84),缺省从库 package.json 自动推断
|
|
7
|
+
* @param appName: string - 应用显示名(缺省从库名派生,如 SqliteStorageExample)
|
|
8
|
+
* @param bundleName: string - 鸿蒙应用包名(缺省派生为 com.rnoh.{lib_name})
|
|
9
|
+
* @param templateUrl: string - 模板仓库地址(默认 https://gitcode.com/lalhanOrz/RN3rdTemplate.git)
|
|
10
|
+
* @param force: boolean - example/ 已存在时是否删除重建
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
const fs = require('node:fs');
|
|
16
|
+
const os = require('node:os');
|
|
17
|
+
const path = require('node:path');
|
|
18
|
+
const { execFileSync } = require('node:child_process');
|
|
19
|
+
|
|
20
|
+
const DEFAULT_TEMPLATE_URL = 'https://gitcode.com/lalhanOrz/RN3rdTemplate.git';
|
|
21
|
+
const KNOWN_VERSIONS = ['0.77', '0.82', '0.84'];
|
|
22
|
+
const EXCLUDED_ENTRIES = new Set(['.git', '.DS_Store', '.npmrc']);
|
|
23
|
+
|
|
24
|
+
function info(msg) { console.log(`[INFO] ${msg}`); }
|
|
25
|
+
function warn(msg) { console.log(`[WARN] ${msg}`); }
|
|
26
|
+
function fail(msg) { console.error(`[ERROR] ${msg}`); process.exit(1); }
|
|
27
|
+
|
|
28
|
+
function parseArgs(argv) {
|
|
29
|
+
const args = { _: [] };
|
|
30
|
+
for (let i = 0; i < argv.length; i++) {
|
|
31
|
+
const a = argv[i];
|
|
32
|
+
if (a === '--force') { args.force = true; continue; }
|
|
33
|
+
if (a.startsWith('--')) {
|
|
34
|
+
const key = a.slice(2).replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
35
|
+
const val = argv[i + 1];
|
|
36
|
+
if (val === undefined || val.startsWith('--')) { args[key] = true; continue; }
|
|
37
|
+
args[key] = val;
|
|
38
|
+
i++;
|
|
39
|
+
} else {
|
|
40
|
+
args._.push(a);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return args;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function readJson(p) { return JSON.parse(fs.readFileSync(p, 'utf8')); }
|
|
47
|
+
function writeJson(p, obj) { fs.writeFileSync(p, JSON.stringify(obj, null, 2) + '\n'); }
|
|
48
|
+
|
|
49
|
+
function detectVersion(libPkg) {
|
|
50
|
+
const sections = ['dependencies', 'devDependencies', 'peerDependencies'];
|
|
51
|
+
const keys = ['@react-native-oh/react-native-harmony', 'react-native-harmony', 'react-native'];
|
|
52
|
+
for (const section of sections) {
|
|
53
|
+
const deps = libPkg[section] || {};
|
|
54
|
+
for (const key of keys) {
|
|
55
|
+
if (deps[key]) {
|
|
56
|
+
const m = String(deps[key]).match(/(\d+)\.(\d+)/);
|
|
57
|
+
if (m) return `${m[1]}.${m[2]}`;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function deriveNames(libName, explicitAppName, explicitBundleName) {
|
|
65
|
+
const unscoped = libName.startsWith('@') ? libName.split('/').pop() : libName;
|
|
66
|
+
const short = (unscoped.replace(/^react-native-/, '') || unscoped);
|
|
67
|
+
const pascalBase = short
|
|
68
|
+
.split(/[^a-zA-Z0-9]+/)
|
|
69
|
+
.filter(Boolean)
|
|
70
|
+
.map((s) => s.charAt(0).toUpperCase() + s.slice(1))
|
|
71
|
+
.join('');
|
|
72
|
+
return {
|
|
73
|
+
appName: explicitAppName || `${pascalBase}Example`,
|
|
74
|
+
bundleName: explicitBundleName || `com.rnoh.${short.toLowerCase().replace(/[^a-z0-9]+/g, '_')}`,
|
|
75
|
+
rnAppName: `${short.replace(/[^a-zA-Z0-9]/g, '_')}_example`,
|
|
76
|
+
pkgName: `${unscoped}-example`,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function copyDirFiltered(src, dest) {
|
|
81
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
82
|
+
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
|
|
83
|
+
if (EXCLUDED_ENTRIES.has(entry.name)) {
|
|
84
|
+
if (entry.name === '.npmrc') {
|
|
85
|
+
warn(`已排除含潜在凭据的文件: ${path.join(dest, entry.name)}(严禁带入交付物)`);
|
|
86
|
+
}
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
const s = path.join(src, entry.name);
|
|
90
|
+
const d = path.join(dest, entry.name);
|
|
91
|
+
if (entry.isDirectory()) {
|
|
92
|
+
copyDirFiltered(s, d);
|
|
93
|
+
} else {
|
|
94
|
+
fs.copyFileSync(s, d);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function setStringValue(json, name, value) {
|
|
100
|
+
const item = (json.string || []).find((s) => s.name === name);
|
|
101
|
+
if (item) item.value = value;
|
|
102
|
+
return Boolean(item);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function renameApp(exampleDir, names) {
|
|
106
|
+
const changes = [];
|
|
107
|
+
|
|
108
|
+
const appJsonPath = path.join(exampleDir, 'app.json');
|
|
109
|
+
if (fs.existsSync(appJsonPath)) {
|
|
110
|
+
const appJson = readJson(appJsonPath);
|
|
111
|
+
appJson.name = names.rnAppName;
|
|
112
|
+
appJson.displayName = names.appName;
|
|
113
|
+
writeJson(appJsonPath, appJson);
|
|
114
|
+
changes.push(`app.json: name=${names.rnAppName}, displayName=${names.appName}`);
|
|
115
|
+
} else {
|
|
116
|
+
warn('未找到 app.json,跳过 RN 应用名修改');
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const pkgPath = path.join(exampleDir, 'package.json');
|
|
120
|
+
if (fs.existsSync(pkgPath)) {
|
|
121
|
+
const pkg = readJson(pkgPath);
|
|
122
|
+
pkg.name = names.pkgName;
|
|
123
|
+
writeJson(pkgPath, pkg);
|
|
124
|
+
changes.push(`package.json: name=${names.pkgName}`);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const appJson5Path = path.join(exampleDir, 'harmony', 'AppScope', 'app.json5');
|
|
128
|
+
if (fs.existsSync(appJson5Path)) {
|
|
129
|
+
let content = fs.readFileSync(appJson5Path, 'utf8');
|
|
130
|
+
const updated = content.replace(
|
|
131
|
+
/("bundleName"\s*:\s*")[^"]*(")/,
|
|
132
|
+
`$1${names.bundleName}$2`
|
|
133
|
+
);
|
|
134
|
+
if (updated !== content) {
|
|
135
|
+
fs.writeFileSync(appJson5Path, updated);
|
|
136
|
+
changes.push(`harmony/AppScope/app.json5: bundleName=${names.bundleName}`);
|
|
137
|
+
}
|
|
138
|
+
} else {
|
|
139
|
+
warn('未找到 harmony/AppScope/app.json5,跳过 bundleName 修改');
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const scopeStrPath = path.join(
|
|
143
|
+
exampleDir, 'harmony', 'AppScope', 'resources', 'base', 'element', 'string.json'
|
|
144
|
+
);
|
|
145
|
+
if (fs.existsSync(scopeStrPath)) {
|
|
146
|
+
const scopeStr = readJson(scopeStrPath);
|
|
147
|
+
if (setStringValue(scopeStr, 'app_name', names.appName)) {
|
|
148
|
+
writeJson(scopeStrPath, scopeStr);
|
|
149
|
+
changes.push(`harmony/AppScope/.../string.json: app_name=${names.appName}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const entryStrPath = path.join(
|
|
154
|
+
exampleDir, 'harmony', 'entry', 'src', 'main', 'resources', 'base', 'element', 'string.json'
|
|
155
|
+
);
|
|
156
|
+
if (fs.existsSync(entryStrPath)) {
|
|
157
|
+
const entryStr = readJson(entryStrPath);
|
|
158
|
+
if (setStringValue(entryStr, 'EntryAbility_label', names.appName)) {
|
|
159
|
+
writeJson(entryStrPath, entryStr);
|
|
160
|
+
changes.push(`harmony/entry/.../string.json: EntryAbility_label=${names.appName}`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const moduleJson5Path = path.join(exampleDir, 'harmony', 'entry', 'src', 'main', 'module.json5');
|
|
165
|
+
if (fs.existsSync(moduleJson5Path)) {
|
|
166
|
+
let content = fs.readFileSync(moduleJson5Path, 'utf8');
|
|
167
|
+
const updated = content.replace(
|
|
168
|
+
/[ \t]*"querySchemes"\s*:\s*\[[\s\S]*?\][ \t]*,?\s*\r?\n/,
|
|
169
|
+
''
|
|
170
|
+
);
|
|
171
|
+
if (updated !== content) {
|
|
172
|
+
fs.writeFileSync(moduleJson5Path, updated);
|
|
173
|
+
changes.push('harmony/entry/src/main/module.json5: 已移除模板残留 querySchemes(库需要时请重新添加)');
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return changes;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function main() {
|
|
181
|
+
const args = parseArgs(process.argv.slice(2));
|
|
182
|
+
const libPath = path.resolve(args.libPath || args._[0] || '');
|
|
183
|
+
if (!args.libPath && args._.length === 0) {
|
|
184
|
+
fail('缺少参数:--lib-path <目标库根目录>');
|
|
185
|
+
}
|
|
186
|
+
if (!fs.existsSync(libPath)) fail(`库目录不存在: ${libPath}`);
|
|
187
|
+
const libPkgPath = path.join(libPath, 'package.json');
|
|
188
|
+
if (!fs.existsSync(libPkgPath)) fail(`未找到库 package.json: ${libPkgPath}`);
|
|
189
|
+
const libPkg = readJson(libPkgPath);
|
|
190
|
+
|
|
191
|
+
const exampleDir = path.join(libPath, 'example');
|
|
192
|
+
if (fs.existsSync(exampleDir)) {
|
|
193
|
+
if (!args.force) {
|
|
194
|
+
fail(`example/ 已存在: ${exampleDir}。如需重建请加 --force(将删除现有目录后重建)`);
|
|
195
|
+
}
|
|
196
|
+
warn('--force 生效:删除已有 example/ 目录');
|
|
197
|
+
fs.rmSync(exampleDir, { recursive: true, force: true });
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const version = args.version || detectVersion(libPkg);
|
|
201
|
+
if (!version) {
|
|
202
|
+
fail(`无法从库 package.json 推断 RNOH 框架版本,请显式指定 --version(可选:${KNOWN_VERSIONS.join(' / ')})`);
|
|
203
|
+
}
|
|
204
|
+
if (!KNOWN_VERSIONS.includes(version)) {
|
|
205
|
+
fail(`不支持的版本 ${version},模板仓库可选版本:${KNOWN_VERSIONS.join(' / ')}`);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const templateUrl = args.templateUrl || DEFAULT_TEMPLATE_URL;
|
|
209
|
+
const names = deriveNames(libPkg.name || 'rn-lib', args.appName, args.bundleName);
|
|
210
|
+
|
|
211
|
+
info(`目标库: ${libPath}(${libPkg.name}@${libPkg.version || 'unknown'})`);
|
|
212
|
+
info(`框架版本: ${version} → 模板 ${templateUrl}#${version}`);
|
|
213
|
+
|
|
214
|
+
const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'rn3rd-template-'));
|
|
215
|
+
try {
|
|
216
|
+
info(`浅拷贝模板仓库(git clone --depth 1)...`);
|
|
217
|
+
try {
|
|
218
|
+
execFileSync('git', ['clone', '--depth', '1', templateUrl, tmpDir], { stdio: 'inherit' });
|
|
219
|
+
} catch (e) {
|
|
220
|
+
fail(`git clone 失败: ${e.message}`);
|
|
221
|
+
}
|
|
222
|
+
const versionDir = path.join(tmpDir, version);
|
|
223
|
+
if (!fs.existsSync(versionDir)) {
|
|
224
|
+
fail(`模板仓库中不存在版本目录 ${version}/(可选:${KNOWN_VERSIONS.join(' / ')})`);
|
|
225
|
+
}
|
|
226
|
+
info(`复制模板 ${version}/ → ${exampleDir}`);
|
|
227
|
+
copyDirFiltered(versionDir, exampleDir);
|
|
228
|
+
} finally {
|
|
229
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
info('修改 app 名称与工程标识...');
|
|
233
|
+
const changes = renameApp(exampleDir, names);
|
|
234
|
+
for (const c of changes) info(` - ${c}`);
|
|
235
|
+
|
|
236
|
+
console.log('');
|
|
237
|
+
console.log('=== example 工程创建完成 ===');
|
|
238
|
+
console.log(` 目录: ${exampleDir}`);
|
|
239
|
+
console.log(` 应用名: ${names.appName}`);
|
|
240
|
+
console.log(` RN 注册名: ${names.rnAppName}`);
|
|
241
|
+
console.log(` 鸿蒙包名: ${names.bundleName}`);
|
|
242
|
+
console.log(` npm 包名: ${names.pkgName}`);
|
|
243
|
+
console.log('');
|
|
244
|
+
console.log('后续步骤:');
|
|
245
|
+
console.log(` 1. cd "${libPath}" && npm pack(先确认 .npmignore 已排除 example)`);
|
|
246
|
+
console.log(` 2. 修改 ${path.join('example', 'package.json')} 依赖为 file:../{tgz文件名}(禁止 file:../ 目录)`);
|
|
247
|
+
console.log(' 3. 预置 example/src/RNTesterList.ts(模式 A)注册入口');
|
|
248
|
+
console.log(' 4. cd example && npm install --legacy-peer-deps && npm run dev');
|
|
249
|
+
console.log(' 5. cd harmony && ohpm install --all && hvigorw assembleHap --no-daemon');
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
main();
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rn-lib-update-doc
|
|
3
|
+
description: 将 RN 鸿蒙三方库文档与元数据按模板(默认 v0.4.2)迁移/升级:README 中英文、package.json 链接与 keywords、harmony oh-package.json5、CHANGELOG 格式;必要时从 usage-docs 拉正文并结合库实现改写;链接统一 CPF-RN 组织。Use when the user mentions 更新 README、readme 模板、0.4.2 文档、usage-docs 迁移、README_EN、文档模板升级、rn-lib-update-doc、更新文档、CHANGELOG 规范、package.json 链接.
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
compatibility: 需要 Node.js(脚本)与 curl(链接可达性校验),需对目标库与 usage-docs(可选)的文件读写权限
|
|
6
|
+
metadata:
|
|
7
|
+
author: LoopEngine
|
|
8
|
+
version: "1.1.0"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 路径约定
|
|
12
|
+
|
|
13
|
+
`{SKILL_DIR}` = 本技能根目录,命令在 `{SKILL_DIR}` 下执行(即下文 `node scripts/...` 均为相对于 `{SKILL_DIR}` 的路径);`$LIB` = 目标库根目录。
|
|
14
|
+
|
|
15
|
+
# RN 三方库文档与元数据升级(rn-lib-update-doc)
|
|
16
|
+
|
|
17
|
+
将目标库 **README / 包元数据 / CHANGELOG** 升级到规范:文档模板(默认 **v0.4.2**,见 [`references/model-0.4.2.md`](references/model-0.4.2.md))、[CPF-RN](https://gitcode.com/CPF-RN) 组织链接、npm/harmony 包描述一致;内容必须与**当前库版本实际实现**一致;若本地有 usage-docs,再按 overview 模板覆盖回写该库中英文档。
|
|
18
|
+
|
|
19
|
+
## 任务参数
|
|
20
|
+
|
|
21
|
+
| 参数 | 必填 | 说明 |
|
|
22
|
+
|------|------|------|
|
|
23
|
+
| `libPath` | ✅ | 目标库根目录(含 package.json / README.md) |
|
|
24
|
+
| `templateVersion` | ❌ | 文档模板版本,默认 0.4.2 |
|
|
25
|
+
| `usageDocsPath` | ❌ | 本地 usage-docs 仓路径(config.json 无效时需提供) |
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 工作流程概览
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
Phase 1 确认模板版本 → Phase 2 判定格式/获取正文 → Phase 3 改写 README(含链接规范化)
|
|
33
|
+
→ Phase 4 回写 usage-docs(可选) → Phase 5 规范包元数据 → Phase 6 规范 CHANGELOG
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## 执行步骤
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
Task Progress:
|
|
40
|
+
- [ ] Step 1: 确认文档模板版本(默认 0.4.2)
|
|
41
|
+
- [ ] Step 2: 判定本库 README 格式;必要时从 usage-docs 迁移正文
|
|
42
|
+
- [ ] Step 3: 按模板 + 库实际实现改写 README.md / README_EN.md
|
|
43
|
+
- [ ] Step 3.5: 链接规范化(CPF-RN:Issue/PR/LICENSE/Autolink 等)
|
|
44
|
+
- [ ] Step 4: 若有本地 usage-docs,按 overview 覆盖回写中英文
|
|
45
|
+
- [ ] Step 5: 规范 package.json 与 harmony oh-package.json5
|
|
46
|
+
- [ ] Step 6: 规范 CHANGELOG.md(Keep a Changelog)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Step 1 — 确认文档模板
|
|
50
|
+
|
|
51
|
+
**必须先问用户**:是否要更换文档模板版本?
|
|
52
|
+
|
|
53
|
+
- **不更换** → 使用 [`references/model-0.4.2.md`](references/model-0.4.2.md) 与 [`references/model-0.4.2-overview.md`](references/model-0.4.2-overview.md)
|
|
54
|
+
- **要更换** → 用户提供新模板路径,复制到 `references/` 后按新模板执行
|
|
55
|
+
|
|
56
|
+
### Step 2 — 判定格式并获取正文来源
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
node scripts/detect-readme-format.cjs <lib-root> [--expect 0.4.2]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
| 检测结果 | 动作 |
|
|
63
|
+
|----------|------|
|
|
64
|
+
| 已是目标模板(如 0.4.2) | 进入 Step 3 校对/补全 |
|
|
65
|
+
| 已是 **0.4.1** 结构 | 以本库现有 README 为素材,直接 Step 3 升级 |
|
|
66
|
+
| 非目标模板 / 仅外链 README | 从 usage-docs 迁正文(见下方) |
|
|
67
|
+
|
|
68
|
+
**usage-docs:**
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
node scripts/resolve-usage-docs.cjs [--set <local-path>] [--print]
|
|
72
|
+
node scripts/find-usage-doc.cjs --lib-path <lib-root> [--usage-docs <path>]
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
远端 fallback:`https://gitcode.com/CPF-RN/usage-docs`(raw:`.../raw/master/zh-cn/<alias>.md` 与 `en/<alias>.md`)
|
|
76
|
+
|
|
77
|
+
### Step 3 — 按模板改造 README(必须贴合当前库)
|
|
78
|
+
|
|
79
|
+
以 `model-0.4.2.md` 为骨架,结合 `package.json`、源码、`harmony/`、example、当前分支 Autolink 事实改写 `README.md` / `README_EN.md`。
|
|
80
|
+
|
|
81
|
+
**硬性要求:**
|
|
82
|
+
|
|
83
|
+
- 版本关系表、安装、Link、约束、示例、接口说明与**当前实现**一致
|
|
84
|
+
- **贡献代码**:Issue / PR 链接必须指向 **CPF-RN 本库**(`https://gitcode.com/CPF-RN/rntpc_<alias>/issues` 与 `.../pulls`)
|
|
85
|
+
- **开源协议**:LICENSE 链接指向 **CPF-RN 本库** `.../blob/master/LICENSE`(勿仅指向上游 GitHub LICENSE,除非协议章节明确说明上游协议且本库 LICENSE 文件不同)
|
|
86
|
+
- 对照 [format-diff.md](references/format-diff.md) 完成章节与表头调整,并按其中 [ManualLink 章节规则](references/format-diff.md#manuallink-章节autolink-全支持时删除) 判断 Autolink 全支持时删除该章节(**必判**)
|
|
87
|
+
|
|
88
|
+
### Step 3.5 — 链接规范化与可达性校验(**必做**)
|
|
89
|
+
|
|
90
|
+
**禁止**仅做字符串级组织替换。所有写入 README / `package.json` 的链接,替换后必须 **HTTP 可达**(2xx/3xx)方可 `--write`。
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
node scripts/normalize-readme-links.cjs --lib-path "$LIB"
|
|
94
|
+
node scripts/normalize-readme-links.cjs --lib-path "$LIB" --write
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**校验规则(`scripts/link-verify.cjs`):**
|
|
98
|
+
|
|
99
|
+
1. 解析本库 GitCode:对 `git remote` / `repository` / `rntpc_<alias>` 等候选执行 `curl -L`,选用首个可达的 CPF-RN 仓库根 URL
|
|
100
|
+
2. 组织迁移:含 `openharmony-sig` 的 URL 仅当 CPF-RN 目标**探测可达**才替换;不可达则保留原链并报告 `unverified-org-migration`
|
|
101
|
+
3. Issue / PR / LICENSE:仅在仓库根 URL 已验证时,才改写到 `{libRepoBase}/issues`、`/pulls`、`/blob/master/LICENSE`
|
|
102
|
+
4. 对 README 终稿中全部 `http(s)` 链接汇总校验(报告 `linkVerification.failures`)
|
|
103
|
+
|
|
104
|
+
离线调试可加 `--skip-verify`;**交付前必须去掉**重新校验。
|
|
105
|
+
|
|
106
|
+
**必须确认:**
|
|
107
|
+
|
|
108
|
+
- 本库 Gitcode 在 [CPF-RN](https://gitcode.com/CPF-RN) 且仓库页可访问
|
|
109
|
+
- README 中 **Issue / PR / LICENSE** 链接均可打开
|
|
110
|
+
- Autolinking → `CPF-RN/ohos_react_native`;link-source-code → `CPF-RN/usage-docs`
|
|
111
|
+
|
|
112
|
+
退出码 `2` 表示链接不可达或仓库未验证,修复后再 `--write`。
|
|
113
|
+
|
|
114
|
+
### Step 4 — 回写 usage-docs(仅本地仓)
|
|
115
|
+
|
|
116
|
+
有本地 usage-docs 时,用 `model-0.4.2-overview.md` 覆盖 `{usageDocs}/zh-cn/<alias>.md` 与 `en/<alias>.md`。无本地仓则跳过。
|
|
117
|
+
|
|
118
|
+
### Step 5 — 规范 package.json 与 harmony oh-package.json5(**必做**)
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
node scripts/normalize-package-meta.cjs --lib-path "$LIB"
|
|
122
|
+
node scripts/normalize-package-meta.cjs --lib-path "$LIB" --write
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**package.json 检查项:**
|
|
126
|
+
|
|
127
|
+
| 字段 | 要求 |
|
|
128
|
+
|------|------|
|
|
129
|
+
| `repository.url` | `https://gitcode.com/CPF-RN/rntpc_<alias>.git` |
|
|
130
|
+
| `homepage` | `https://gitcode.com/CPF-RN/rntpc_<alias>` |
|
|
131
|
+
| `bugs.url` | `https://gitcode.com/CPF-RN/rntpc_<alias>/issues` |
|
|
132
|
+
| `license` | `"MIT"`(与库根 LICENSE 一致;若非 MIT 以 LICENSE 文件为准并告知用户) |
|
|
133
|
+
| `publishConfig` | `{ "registry": "https://registry.npmjs.org/", "access": "public" }` |
|
|
134
|
+
| `keywords` | 在现有基础上**补全**(去重):`rnoh`、`harmonyos`、`openharmony`、`ohos` |
|
|
135
|
+
|
|
136
|
+
**harmony 模块 `oh-package.json5`(每个 `harmony/**/oh-package.json5`,不含 example 内三方依赖副本时可跳过 example):**
|
|
137
|
+
|
|
138
|
+
| 字段 | 要求 |
|
|
139
|
+
|------|------|
|
|
140
|
+
| `license` | `"MIT"` |
|
|
141
|
+
| `description` | 简短说明,与 `package.json` 的 `description` 一致或同义(如 `React Native Blur OpenHarmony module`) |
|
|
142
|
+
|
|
143
|
+
脚本在写回 `homepage` / `bugs.url` / `repository` 前会调用 `link-verify.cjs` 校验可达性;验证失败时**拒绝 `--write`**(除非 `--skip-verify`)。
|
|
144
|
+
|
|
145
|
+
### Step 6 — 规范 CHANGELOG.md(**必做**)
|
|
146
|
+
|
|
147
|
+
按 [Keep a Changelog](https://keepachangelog.com/) 重组,参考 [`references/changelog-template.md`](references/changelog-template.md)。
|
|
148
|
+
|
|
149
|
+
**结构要求:**
|
|
150
|
+
|
|
151
|
+
1. 文首说明基于 Keep a Changelog
|
|
152
|
+
2. `## [Unreleased]` 节(可为空)
|
|
153
|
+
3. 鸿蒙化版本:`## [x.y.z] - YYYY-MM-DD`,下含 `### Added` / `Changed` / `Fixed` / `Deprecated` 等(无内容可省略该分类,但**禁止**仅用无序列表无分类)
|
|
154
|
+
4. 上游 Release 可单独放在 `## Upstream Release Notes`,勿与鸿蒙版本混用 `## 鸿蒙化Log`、`### v4.x.x` 等旧标题
|
|
155
|
+
|
|
156
|
+
**校验:**
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
node scripts/normalize-changelog.cjs --lib-path "$LIB"
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
退出码 `2` 表示格式不合规,需人工重组后再提交。
|
|
163
|
+
|
|
164
|
+
## 需向用户确认
|
|
165
|
+
|
|
166
|
+
1. 是否更换文档模板(Step 1;默认 0.4.2)
|
|
167
|
+
2. 目标库根目录(若工作区不明确)
|
|
168
|
+
3. usage-docs 本地路径(需拉取且 config 无效时)
|
|
169
|
+
4. `license` 非 MIT 时是否仍强制写 MIT(以 LICENSE 文件为准)
|
|
170
|
+
5. Step 4 回写前展示将覆盖的 usage-docs 路径
|
|
171
|
+
|
|
172
|
+
## 不在范围内
|
|
173
|
+
|
|
174
|
+
- 不修改库业务源码(仅文档与元数据;`package.json` / `CHANGELOG.md` / `OAT.xml` 等交付相关除外)
|
|
175
|
+
- 不自动 git commit / push
|
|
176
|
+
- 不替代 OAT / 交付件生成技能
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [x.y.z] - YYYY-MM-DD
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- new features
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- changes in existing functionality
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- bug fixes
|
|
22
|
+
|
|
23
|
+
### Deprecated
|
|
24
|
+
|
|
25
|
+
- soon-to-be removed features
|
|
26
|
+
|
|
27
|
+
## Upstream Release Notes
|
|
28
|
+
|
|
29
|
+
> 可选:社区上游 Release 记录单独分区,避免与鸿蒙化版本混用旧式标题。
|
|
30
|
+
|
|
31
|
+
### Release x.y.z
|
|
32
|
+
|
|
33
|
+
#### Features
|
|
34
|
+
|
|
35
|
+
- upstream changes
|