@ohos-cpf/3rdloop 0.0.2 → 0.0.3
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 +244 -244
- package/bin/3rdloop.mjs +46 -46
- package/lib/cli.js +781 -781
- package/lib/config-cmd.js +451 -451
- package/lib/config.js +318 -318
- package/lib/doctor.js +113 -113
- package/lib/exit-codes.js +30 -30
- package/lib/opencode.js +155 -155
- package/lib/orch.js +426 -426
- package/lib/queries.js +263 -263
- package/lib/step.js +325 -325
- package/lib/ui.js +222 -222
- package/lib/update.js +279 -279
- package/lib/workflow.js +308 -308
- package/lib/workflows.js +131 -131
- package/package.json +50 -50
- package/vendor/Server/Agent/SkillSelector/README.md +343 -343
- package/vendor/Server/Agent/SkillSelector/core/Agent.js +207 -207
- package/vendor/Server/Agent/SkillSelector/index.js +14 -14
- package/vendor/Server/Agent/SkillSelector/llm/llmClient.js +313 -313
- package/vendor/Server/Agent/SkillSelector/llm/prompts.js +161 -161
- package/vendor/Server/Agent/SkillSelector/llm/reactSteps.js +144 -144
- package/vendor/Server/Agent/SkillSelector/matcher/fuzzyMatcher.js +433 -433
- package/vendor/Server/Agent/SkillSelector/scanner/skillScanner.js +382 -382
- package/vendor/Server/Agent/SkillSelector/utils/actionWords.js +59 -59
- package/vendor/Server/Brain/AnalysisStrategies.js +422 -422
- package/vendor/Server/Brain/Brain.js +686 -686
- package/vendor/Server/Brain/DecompositionStrategies.js +621 -621
- package/vendor/Server/Brain/PlanPersistence.js +196 -196
- package/vendor/Server/Brain/SkillExecutor.js +251 -251
- package/vendor/Server/Brain/index.js +11 -11
- package/vendor/Server/CLI/cli.js +275 -275
- package/vendor/Server/CLI/deveco-code/index.js +71 -71
- package/vendor/Server/CLI/deveco-code.js +5 -5
- package/vendor/Server/CLI/opencode/index.js +817 -818
- package/vendor/Server/CLI/opencode.js +5 -5
- package/vendor/Server/DbUse/MessageArchive.js +61 -61
- package/vendor/Server/DbUse/StorageManager.js +107 -107
- package/vendor/Server/DbUse/adapters/BaseAdapter.js +94 -94
- package/vendor/Server/DbUse/adapters/FileAdapter.js +138 -138
- package/vendor/Server/DbUse/adapters/JsonAdapter.js +138 -138
- package/vendor/Server/DbUse/adapters/JsonlAdapter.js +114 -114
- package/vendor/Server/DbUse/adapters/SqliteAdapter.js +157 -157
- package/vendor/Server/DbUse/index.js +160 -160
- package/vendor/Server/DbUse/stores/SessionStore.js +279 -279
- package/vendor/Server/DbUse/stores/TaskExecutionStore.js +133 -133
- package/vendor/Server/DbUse/stores/TaskRegistryStore.js +262 -262
- package/vendor/Server/DbUse/stores/TaskStepStore.js +279 -279
- package/vendor/Server/FlexRunner/FlexRunner.js +1759 -1759
- package/vendor/Server/FlexRunner/index.js +12 -12
- package/vendor/Server/Knowledge/KnowledgeImporter.js +523 -523
- package/vendor/Server/Knowledge/KnowledgeManager.js +341 -341
- package/vendor/Server/Knowledge/index.js +33 -33
- package/vendor/Server/LoopEngine/LoopEngine.js +1133 -1133
- package/vendor/Server/LoopEngine/index.js +11 -11
- package/vendor/Server/Orchestrator/Orchestrator.js +0 -3
- package/vendor/Server/Orchestrator/StepNode.js +312 -312
- package/vendor/Server/Orchestrator/index.js +13 -13
- package/vendor/Server/Routes/controllers/BrainController.js +241 -241
- package/vendor/Server/Routes/controllers/FlexRunnerController.js +1125 -1125
- package/vendor/Server/Routes/controllers/HealthController.js +44 -44
- package/vendor/Server/Routes/controllers/KnowledgeImportController.js +355 -355
- package/vendor/Server/Routes/controllers/LoopEngineController.js +788 -788
- package/vendor/Server/Routes/controllers/StatsController.js +57 -57
- package/vendor/Server/Routes/controllers/StreamController.js +67 -67
- package/vendor/Server/Routes/library/logger.js +179 -179
- package/vendor/Server/Routes/library/zipArchive.js +172 -172
- package/vendor/Server/Routes/router/Router.js +204 -204
- package/vendor/Server/Routes/routes/brain.js +47 -47
- package/vendor/Server/Routes/routes/flexrunner.js +72 -72
- package/vendor/Server/Routes/routes/health.js +28 -28
- package/vendor/Server/Routes/routes/index.js +57 -57
- package/vendor/Server/Routes/routes/knowledge.js +55 -55
- package/vendor/Server/Routes/routes/loopengine.js +58 -58
- package/vendor/Server/Routes/routes/orchestrator.js +61 -61
- package/vendor/Server/Routes/routes/registry.js +97 -97
- package/vendor/Server/Routes/routes/stats.js +23 -23
- package/vendor/Server/Routes/routes/stream.js +30 -30
- package/vendor/Server/Routes/server.js +203 -203
- package/vendor/Server/Routes/sse/SseHub.js +308 -308
- package/vendor/Server/Skills/acceptance-check/SKILL.md +191 -191
- package/vendor/Server/Skills/acceptance-check/references/PHASE1_ARTIFACT_COLLECTION.md +52 -52
- package/vendor/Server/Skills/acceptance-check/references/PHASE2_CRITERIA_EVALUATION.md +77 -77
- package/vendor/Server/Skills/acceptance-check/references/PHASE2_EVIDENCE_VERIFICATION.md +70 -70
- package/vendor/Server/Skills/arkts-code-check/SKILL.md +320 -320
- package/vendor/Server/Skills/arkts-code-check/references/CODE_CHECK_GUIDE.md +210 -210
- package/vendor/Server/Skills/arkts-code-check/references/FILE_TYPE_GUIDE.md +28 -28
- package/vendor/Server/Skills/arkts-code-check/references/PHASE1_INFO_COLLECTION.md +233 -233
- package/vendor/Server/Skills/arkts-code-check/references/REPORT_TEMPLATE.md +219 -219
- package/vendor/Server/Skills/arkts-library-compile-validate/SKILL.md +328 -328
- package/vendor/Server/Skills/arkts-library-compile-validate/scripts/build.ps1 +93 -93
- package/vendor/Server/Skills/arkts-library-compile-validate/scripts/code-linter.cjs +432 -432
- package/vendor/Server/Skills/arkts-library-compile-validate/scripts/migrate.cjs +851 -851
- package/vendor/Server/Skills/arkts-library-compile-validate/scripts/ohpm-switch.cjs +788 -788
- package/vendor/Server/Skills/arkts-library-demo-code/SKILL.md +291 -291
- package/vendor/Server/Skills/arkts-library-demo-code/references/API_SIGNATURE_CHECKS.md +68 -68
- package/vendor/Server/Skills/arkts-library-demo-code/references/BUILD_VALIDATION.md +184 -184
- package/vendor/Server/Skills/arkts-library-demo-code/references/CODE_STANDARDS.md +337 -337
- package/vendor/Server/Skills/arkts-library-demo-code/references/EXAMPLES.md +400 -400
- package/vendor/Server/Skills/arkts-library-demo-code/references/SYSTEM_API_LOOKUP.md +98 -98
- package/vendor/Server/Skills/arkts-library-demo-code/references/TEMPLATE.md +544 -544
- package/vendor/Server/Skills/arkts-library-demo-code/scripts/build.ps1 +93 -93
- package/vendor/Server/Skills/arkts-library-demo-code/scripts/code-linter.cjs +432 -432
- package/vendor/Server/Skills/arkts-library-demo-code/scripts/migrate.cjs +851 -851
- package/vendor/Server/Skills/arkts-library-demo-code/scripts/ohpm-switch.cjs +788 -788
- package/vendor/Server/Skills/arkts-library-demo-coverage/SKILL.md +174 -174
- package/vendor/Server/Skills/arkts-library-demo-scenario/SKILL.md +321 -321
- package/vendor/Server/Skills/arkts-library-demo-scenario/references/EXAMPLES.md +100 -100
- package/vendor/Server/Skills/arkts-library-demo-scenario/references/TEMPLATE.md +185 -185
- package/vendor/Server/Skills/arkts-library-documentation-quality-check/SKILL.md +233 -233
- package/vendor/Server/Skills/arkts-library-documentation-quality-check/assets/REPORT_TEMPLATE.md +102 -102
- package/vendor/Server/Skills/arkts-library-documentation-quality-check/references/CHECK_DIMENSIONS.md +89 -89
- package/vendor/Server/Skills/arkts-library-documentation-quality-check/references/COMPLIANCE_CHECKLIST.md +62 -62
- package/vendor/Server/Skills/arkts-library-documentation-quality-check/references/KB_QUERY_GUIDE.md +107 -107
- package/vendor/Server/Skills/arkts-library-documentation-quality-check/references/MCP_TOOL_DISCOVERY.md +124 -124
- package/vendor/Server/Skills/arkts-library-documentation-quality-check/references/REPORT_TEMPLATE.md +90 -90
- package/vendor/Server/Skills/arkts-library-documentation-quality-check/references/SCORING_FORMULA.md +57 -57
- package/vendor/Server/Skills/arkts-library-documentation-quality-check/scripts/validate-skill.cjs +259 -259
- package/vendor/Server/Skills/arkts-library-interface-spec/SKILL.md +97 -97
- package/vendor/Server/Skills/arkts-library-memory-leak-check/SKILL.md +391 -391
- package/vendor/Server/Skills/arkts-library-source-clone/SKILL.md +113 -113
- package/vendor/Server/Skills/arkts-library-stability-check/SKILL.md +312 -312
- package/vendor/Server/Skills/arkts-library-stability-check/assets/REPORT_TEMPLATE.md +154 -154
- package/vendor/Server/Skills/arkts-library-stability-check/references/CHECKLIST.md +165 -165
- package/vendor/Server/Skills/arkts-library-stability-check/references/CODE_EXAMPLES.md +308 -308
- package/vendor/Server/Skills/arkts-library-stability-check/references/SCORING_RULES.md +90 -90
- package/vendor/Server/Skills/arkts-library-stability-check/scripts/validate-skill.cjs +282 -282
- package/vendor/Server/Skills/arkts-library-test-coverage-check/SKILL.md +360 -360
- package/vendor/Server/Skills/arkts-library-test-coverage-check/assets/REPORT_TEMPLATE.md +145 -145
- package/vendor/Server/Skills/arkts-library-test-coverage-check/references/CHECKLIST.md +252 -252
- package/vendor/Server/Skills/arkts-library-test-coverage-check/references/MCP_TOOL_USAGE.md +114 -114
- package/vendor/Server/Skills/arkts-library-test-coverage-check/scripts/validate-skill.cjs +262 -262
- package/vendor/Server/Skills/arkts-library-xts-code/SKILL.md +455 -455
- package/vendor/Server/Skills/arkts-library-xts-code/assets/report-template.md +60 -60
- package/vendor/Server/Skills/arkts-library-xts-code/references/ACCESS_MODIFIER_PRECHECK.md +76 -76
- package/vendor/Server/Skills/arkts-library-xts-code/references/BUILD_VERIFICATION.md +200 -200
- package/vendor/Server/Skills/arkts-library-xts-code/references/CODE_STANDARDS.md +518 -518
- package/vendor/Server/Skills/arkts-library-xts-code/references/SUBAGENT_PROMPT_TEMPLATE.md +276 -276
- package/vendor/Server/Skills/arkts-library-xts-code/references/SYSTEM_API_LOOKUP.md +92 -92
- package/vendor/Server/Skills/arkts-library-xts-code/references/XTS_TEMPLATE.md +767 -767
- package/vendor/Server/Skills/arkts-library-xts-code/scripts/build.ps1 +93 -93
- package/vendor/Server/Skills/arkts-library-xts-code/scripts/code-linter.cjs +432 -432
- package/vendor/Server/Skills/arkts-library-xts-code/scripts/migrate.cjs +851 -851
- package/vendor/Server/Skills/arkts-library-xts-code/scripts/ohpm-switch.cjs +788 -788
- package/vendor/Server/Skills/arkts-library-xts-code/scripts/precheck-access-modifiers.cjs +221 -221
- package/vendor/Server/Skills/arkts-library-xts-code-fix/SKILL.md +228 -228
- package/vendor/Server/Skills/arkts-library-xts-coverage/SKILL.md +97 -97
- package/vendor/Server/Skills/arkts-library-xts-doc/SKILL.md +194 -194
- package/vendor/Server/Skills/arkts-library-xts-doc/references/EXAMPLES.md +575 -575
- package/vendor/Server/Skills/arkts-library-xts-doc/references/TEMPLATE.md +574 -574
- package/vendor/Server/Skills/arkts-library-xts-doc/references/TESTABILITY_GUIDE.md +182 -182
- package/vendor/Server/Skills/arkts-library-xts-execution/SKILL.md +490 -490
- package/vendor/Server/Skills/arkts-library-xts-execution/references/error-fixing-examples.md +217 -217
- package/vendor/Server/Skills/arkts-library-xts-execution/scripts/build.ps1 +93 -93
- package/vendor/Server/Skills/arkts-library-xts-execution/scripts/code-linter.cjs +432 -432
- package/vendor/Server/Skills/arkts-library-xts-execution/scripts/migrate.cjs +851 -851
- package/vendor/Server/Skills/arkts-library-xts-execution/scripts/ohpm-switch.cjs +788 -788
- package/vendor/Server/Skills/flutter-code-check/SKILL.md +299 -299
- package/vendor/Server/Skills/flutter-code-check/assets/OUTPUT_TEMPLATE.md +311 -311
- package/vendor/Server/Skills/flutter-code-check/references/CHECKLIST.md +190 -190
- package/vendor/Server/Skills/flutter-code-check/references/PLATFORMS.md +133 -133
- package/vendor/Server/Skills/flutter-code-check/scripts/validate-skill.cjs +259 -259
- package/vendor/Server/Skills/flutter-interface/README.md +75 -75
- package/vendor/Server/Skills/flutter-interface/SKILL.md +291 -291
- package/vendor/Server/Skills/flutter-interface/references/EXAMPLES.md +336 -336
- package/vendor/Server/Skills/flutter-interface/references/GIT_CLONE_GUIDE.md +190 -190
- package/vendor/Server/Skills/flutter-interface/references/SCRIPT_REFERENCE.md +258 -258
- package/vendor/Server/Skills/flutter-interface/references/TEMPLATE.md +254 -254
- package/vendor/Server/Skills/flutter-library-consistency-check/SKILL.md +517 -517
- package/vendor/Server/Skills/flutter-library-consistency-check/references/CHECKLIST.md +381 -381
- package/vendor/Server/Skills/flutter-library-consistency-check/references/FUNCTION_COMPARISON_GUIDE.md +341 -341
- package/vendor/Server/Skills/flutter-library-consistency-check/references/PLATFORM_LIMITATION_GUIDE.md +71 -71
- package/vendor/Server/Skills/flutter-library-documentation-quality-check/SKILL.md +518 -518
- package/vendor/Server/Skills/flutter-library-documentation-quality-check/references/CHECKLIST.md +406 -406
- package/vendor/Server/Skills/flutter-library-memory-leak-check/SKILL.md +652 -652
- package/vendor/Server/Skills/flutter-library-memory-leak-check/references/CHECKLIST.md +396 -396
- package/vendor/Server/Skills/flutter-library-stability-check/SKILL.md +744 -744
- package/vendor/Server/Skills/flutter-library-stability-check/references/CHECKLIST.md +720 -720
- package/vendor/Server/Skills/flutter-library-test-coverage-check/SKILL.md +414 -414
- package/vendor/Server/Skills/flutter-library-test-coverage-check/assets/REPORT_TEMPLATE.md +150 -150
- package/vendor/Server/Skills/flutter-library-test-coverage-check/references/CHECKLIST.md +304 -304
- package/vendor/Server/Skills/flutter-library-test-coverage-check/references/SCORING_RULES.md +265 -265
- package/vendor/Server/Skills/flutter-library-test-coverage-check/references/SCRIPT_USAGE.md +286 -286
- package/vendor/Server/Skills/knowledge-import/SKILL.md +383 -383
- package/vendor/Server/Skills/knowledge-import/references/MCP_TOOL_USAGE.md +165 -165
- package/vendor/Server/Skills/knowledge-import/references/SKILL_LOCATOR_GUIDE.md +91 -91
- package/vendor/Server/Skills/knowledge-import/references/SKILL_OPTIMIZATION_GUIDE.md +127 -127
- package/vendor/Server/Skills/ohos-lib-pr-push/SKILL.md +453 -301
- package/vendor/Server/Skills/ohos-lib-pr-push/assets/PR_CHECKLIST.md +151 -0
- package/vendor/Server/Skills/ohos-lib-pr-push/assets/PR_ISSUE_TEMPLATE.md +257 -105
- package/vendor/Server/Skills/ohos-lib-pr-push/references/GITCODE_API.md +191 -127
- package/vendor/Server/Skills/ohos-lib-pr-push/scripts/gitcode-api.cjs +317 -208
- package/vendor/Server/Skills/rn-code-check/SKILL.md +320 -320
- package/vendor/Server/Skills/rn-code-check/references/API-GUIDE.md +234 -234
- package/vendor/Server/Skills/rn-code-check/references/CHECKLIST.md +188 -188
- package/vendor/Server/Skills/rn-code-check/references/REPORT-TEMPLATE.md +246 -246
- package/vendor/Server/Skills/rn-lib-add-example/SKILL.md +198 -198
- package/vendor/Server/Skills/rn-lib-add-example/references/APP_RENAME_GUIDE.md +40 -40
- package/vendor/Server/Skills/rn-lib-add-example/references/SHELL_ADAPTATION_CHECKLIST.md +78 -78
- package/vendor/Server/Skills/rn-lib-add-example/references/TEMPLATE_REPO_GUIDE.md +70 -70
- package/vendor/Server/Skills/rn-lib-add-example/references/VERIFICATION_GUIDE.md +47 -47
- package/vendor/Server/Skills/rn-lib-add-example/scripts/create-example.cjs +252 -252
- package/vendor/Server/Skills/rn-lib-update-doc/SKILL.md +176 -176
- package/vendor/Server/Skills/rn-lib-update-doc/config.json +5 -5
- package/vendor/Server/Skills/rn-lib-update-doc/references/changelog-template.md +35 -35
- package/vendor/Server/Skills/rn-lib-update-doc/references/format-diff.md +137 -137
- package/vendor/Server/Skills/rn-lib-update-doc/references/link-registry.json +33 -33
- package/vendor/Server/Skills/rn-lib-update-doc/references/model-0.4.2-overview.md +40 -40
- package/vendor/Server/Skills/rn-lib-update-doc/references/model-0.4.2.md +429 -429
- package/vendor/Server/Skills/rn-lib-update-doc/scripts/detect-readme-format.cjs +105 -105
- package/vendor/Server/Skills/rn-lib-update-doc/scripts/find-usage-doc.cjs +90 -90
- package/vendor/Server/Skills/rn-lib-update-doc/scripts/link-verify.cjs +213 -213
- package/vendor/Server/Skills/rn-lib-update-doc/scripts/normalize-changelog.cjs +73 -73
- package/vendor/Server/Skills/rn-lib-update-doc/scripts/normalize-package-meta.cjs +258 -258
- package/vendor/Server/Skills/rn-lib-update-doc/scripts/normalize-readme-links.cjs +341 -341
- package/vendor/Server/Skills/rn-lib-update-doc/scripts/resolve-usage-docs.cjs +67 -67
- package/vendor/Server/Skills/rn-library-consistency-check/SKILL.md +299 -299
- package/vendor/Server/Skills/rn-library-consistency-check/assets/REPORT_TEMPLATE.md +293 -293
- package/vendor/Server/Skills/rn-library-consistency-check/references/ARKTS_COMPONENT_CHECK_GUIDE.md +857 -857
- package/vendor/Server/Skills/rn-library-consistency-check/references/ARKTS_TURBOMODULE_CHECK_GUIDE.md +856 -856
- package/vendor/Server/Skills/rn-library-consistency-check/references/CHECKLIST.md +157 -157
- package/vendor/Server/Skills/rn-library-consistency-check/references/CPP_COMPONENT_CHECK_GUIDE.md +801 -801
- package/vendor/Server/Skills/rn-library-consistency-check/references/CPP_TURBOMODULE_CHECK_GUIDE.md +683 -683
- package/vendor/Server/Skills/rn-library-consistency-check/references/FUNCTION_COMPARISON_GUIDE.md +233 -233
- package/vendor/Server/Skills/rn-library-consistency-check/references/NATIVE_COMPONENT_IDENTIFICATION.md +1373 -1373
- package/vendor/Server/Skills/rn-library-consistency-check/references/SCORING_STANDARD.md +220 -220
- package/vendor/Server/Skills/rn-library-consistency-check/scripts/validate-skill.py +245 -245
- package/vendor/Server/Skills/rn-library-documentation-quality-check/SKILL.md +263 -263
- package/vendor/Server/Skills/rn-library-documentation-quality-check/assets/MODEL.md +414 -414
- package/vendor/Server/Skills/rn-library-documentation-quality-check/assets/MODEL_en.md +413 -413
- package/vendor/Server/Skills/rn-library-documentation-quality-check/assets/REPORT_TEMPLATE.md +311 -311
- package/vendor/Server/Skills/rn-library-documentation-quality-check/references/CHECK_CHECKLIST.md +355 -355
- package/vendor/Server/Skills/rn-library-documentation-quality-check/references/CROSS_VALIDATION_GUIDE.md +115 -115
- package/vendor/Server/Skills/rn-library-documentation-quality-check/references/DOC_COLLECTION_GUIDE.md +139 -139
- package/vendor/Server/Skills/rn-library-documentation-quality-check/references/EXAMPLES.md +586 -586
- package/vendor/Server/Skills/rn-library-documentation-quality-check/references/GOTCHAS.md +57 -57
- package/vendor/Server/Skills/rn-library-documentation-quality-check/scripts/validate-skill.py +259 -259
- package/vendor/Server/Skills/rn-library-interface-analyzer/SKILL.md +301 -301
- package/vendor/Server/Skills/rn-library-interface-analyzer/assets/REPORT_TEMPLATE.md +148 -148
- package/vendor/Server/Skills/rn-library-interface-analyzer/references/DOC_ANNOTATION_GUIDE.md +118 -118
- package/vendor/Server/Skills/rn-library-interface-analyzer/references/SCRIPT_USAGE_GUIDE.md +168 -168
- package/vendor/Server/Skills/rn-library-interface-analyzer/references/URL_PARSING_RULES.md +176 -176
- package/vendor/Server/Skills/rn-library-issue-generalizer/SKILL.md +274 -274
- package/vendor/Server/Skills/rn-library-issue-generalizer/assets/case-template.md +45 -45
- package/vendor/Server/Skills/rn-library-issue-generalizer/assets/rule-template.md +25 -25
- package/vendor/Server/Skills/rn-library-issue-generalizer/references/PR_FETCH_GUIDE.md +61 -61
- package/vendor/Server/Skills/rn-library-issue-generalizer/references/RULE_TEMPLATE_GUIDE.md +165 -165
- package/vendor/Server/Skills/rn-library-issue-generalizer/scripts/fetch-pr-info.py +239 -239
- package/vendor/Server/Skills/rn-library-known-issue-check/SKILL.md +263 -263
- package/vendor/Server/Skills/rn-library-known-issue-check/assets/REPORT_TEMPLATE.md +96 -96
- package/vendor/Server/Skills/rn-library-known-issue-check/references/COMPLIANCE_CHECKLIST.md +57 -57
- package/vendor/Server/Skills/rn-library-known-issue-check/references/INSPECTION_GUIDE.md +99 -99
- package/vendor/Server/Skills/rn-library-known-issue-check/references/PRESCREEN_GUIDE.md +64 -64
- package/vendor/Server/Skills/rn-library-known-issue-check/references/SOURCE_PREP_GUIDE.md +74 -74
- package/vendor/Server/Skills/rn-library-known-issue-check/scripts/validate-known-issue-report.py +164 -164
- package/vendor/Server/Skills/rn-library-memory-leak-check/SKILL.md +356 -339
- package/vendor/Server/Skills/rn-library-memory-leak-check/assets/REPORT_TEMPLATE.md +85 -83
- package/vendor/Server/Skills/rn-library-memory-leak-check/references/CHECKLIST.md +905 -859
- package/vendor/Server/Skills/rn-library-memory-leak-check/references/HARMONY_CODE_PATTERNS.md +124 -122
- package/vendor/Server/Skills/rn-library-memory-leak-check/scripts/scan_harmony_code.py +287 -279
- package/vendor/Server/Skills/rn-library-stability-check/SKILL.md +273 -273
- package/vendor/Server/Skills/rn-library-stability-check/assets/REPORT_TEMPLATE.md +129 -129
- package/vendor/Server/Skills/rn-library-stability-check/references/CHECKLIST.md +581 -581
- package/vendor/Server/Skills/rn-library-stability-check/references/SCORING_RULES.md +138 -138
- package/vendor/Server/Skills/rn-library-stability-check/scripts/scan-harmony-code.py +168 -168
- package/vendor/Server/Skills/rn-library-test-coverage-check/SKILL.md +526 -506
- package/vendor/Server/Skills/rn-library-test-coverage-check/references/CHECKLIST.md +321 -280
- package/vendor/Server/Skills/rn-library-test-coverage-check/references/DEMO_LOCATION.md +221 -221
- package/vendor/Server/Skills/rn-library-test-coverage-check/references/REPORT_TEMPLATE.md +220 -209
- package/vendor/Server/Skills/rn-library-test-coverage-check/references/SCRIPT_USAGE.md +325 -325
- package/vendor/Server/Skills/rn-ohos-xts-generator/SKILL.md +279 -279
- package/vendor/Server/Skills/rn-ohos-xts-generator/assets/TEST_FILE_TEMPLATES.md +404 -404
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/BUILD_TROUBLESHOOTING.md +185 -185
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/BUILD_WORKFLOW.md +265 -265
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/COMMON_CONFIG.md +189 -189
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/CONFIG_GUIDE.md +203 -203
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/COVERAGE_ANALYZER.md +147 -147
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/DESIGN_DOC_GUIDE.md +148 -148
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/GENERATION_FLOW.md +165 -165
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/GENERATION_STRATEGY.md +195 -195
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/HARMONY_SCANNER.md +249 -249
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/JEST_FRAMEWORK.md +235 -235
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/PLATFORM_COMPAT.md +161 -161
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/RN_TEST_PATTERNS.md +413 -413
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/SOURCE_PARSER.md +235 -235
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/TEST_CONVENTIONS.md +245 -245
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/TROUBLESHOOTING.md +282 -282
- package/vendor/Server/Skills/rn-ohos-xts-generator/references/USAGE_GUIDE.md +251 -251
- package/vendor/Server/Skills/rnoh-cptf-api-test/SKILL.md +469 -469
- package/vendor/Server/Skills/rnoh-cptf-api-test/assets/CPTF_TEST_TEMPLATE.md +310 -310
- package/vendor/Server/Skills/rnoh-cptf-api-test/assets/DEMO_PAGE_TEMPLATE.md +303 -303
- package/vendor/Server/Skills/rnoh-cptf-api-test/references/CPTF_TEST_GENERATION_GUIDE.md +421 -421
- package/vendor/Server/Skills/rnoh-cptf-api-test/references/DEMO_GENERATION_GUIDE.md +358 -358
- package/vendor/Server/Skills/rnoh-cptf-api-test/references/QUALITY_CHECKLIST.md +114 -114
- package/vendor/Server/Skills/rnoh-cptf-api-test/references/SPEC_PARSING_GUIDE.md +274 -274
- package/vendor/Server/Skills/rnoh-cptf-api-test/scripts/validate-rnoh-cptf-api-test.sh +185 -185
- package/vendor/Server/Skills/rnoh-cptf-demo-test/SKILL.md +191 -191
- package/vendor/Server/Skills/rnoh-cptf-demo-test/assets/TEST_TEMPLATE.md +216 -216
- package/vendor/Server/Skills/rnoh-cptf-demo-test/references/CPTF_SETUP.md +107 -107
- package/vendor/Server/Skills/rnoh-cptf-demo-test/references/DEMO_ANALYSIS.md +120 -120
- package/vendor/Server/Skills/rnoh-cptf-demo-test/scripts/validate-rnoh-cptf-test.sh +108 -108
- package/vendor/Server/Skills/rnoh-cptf-test-run/SKILL.md +237 -237
- package/vendor/Server/Skills/rnoh-cptf-test-run/references/DEBUG_PLAYBOOK.md +261 -261
- package/vendor/Server/Skills/rnoh-cptf-test-run/scripts/validate-run-env.sh +112 -112
- package/vendor/Server/Skills/rnoh-lib-code-adapt/SKILL.md +497 -497
- package/vendor/Server/Skills/rnoh-lib-code-adapt/references/adapt-checklist.md +270 -270
- package/vendor/Server/Skills/rnoh-lib-code-adapt/references/api-migration-checklist.md +164 -164
- package/vendor/Server/Skills/rnoh-lib-code-adapt/references/common-compile-errors.md +556 -556
- package/vendor/Server/Skills/rnoh-lib-code-adapt/references/deveco-cli-tools.md +459 -459
- package/vendor/Server/Skills/rnoh-lib-code-adapt/references/edge-cases.md +65 -65
- package/vendor/Server/Skills/rnoh-lib-code-adapt/references/har-tgz-build.md +512 -512
- package/vendor/Server/Skills/rnoh-lib-code-adapt/references/version-compat-matrix.md +132 -132
- package/vendor/Server/Skills/rnoh-lib-code-adapt/scripts/auto-integrate.sh +424 -424
- package/vendor/Server/Skills/rnoh-lib-demo-coverage/SKILL.md +137 -137
- package/vendor/Server/Skills/rnoh-lib-demo-create/SKILL.md +306 -306
- package/vendor/Server/Skills/rnoh-lib-demo-create/assets/DEMO_PAGE_TEMPLATE.md +485 -485
- package/vendor/Server/Skills/rnoh-lib-demo-create/assets/INDEX_TEMPLATE.md +172 -172
- package/vendor/Server/Skills/rnoh-lib-demo-create/references/DEMO_CODE_RULES.md +422 -422
- package/vendor/Server/Skills/rnoh-lib-demo-create/references/QUALITY_CHECKLIST.md +95 -95
- package/vendor/Server/Skills/rnoh-lib-demo-create/references/SOURCE_EXPLORATION.md +169 -169
- package/vendor/Server/Skills/rnoh-lib-demo-doc/SKILL.md +554 -554
- package/vendor/Server/Skills/rnoh-lib-demo-doc/assets/DEMO_DOC_TEMPLATE.md +106 -106
- package/vendor/Server/Skills/rnoh-lib-demo-doc/references/COVERAGE_INCREMENTAL.md +216 -216
- package/vendor/Server/Skills/rnoh-lib-demo-doc/references/DEMO_DESIGN_RULES.md +413 -413
- package/vendor/Server/Skills/rnoh-lib-demo-doc/references/OUTPUT_FORMAT.md +269 -269
- package/vendor/Server/Skills/rnoh-lib-demo-doc/references/QUALITY_CHECKLIST.md +98 -98
- package/vendor/Server/Skills/rnoh-lib-func-test/SKILL.md +337 -337
- package/vendor/Server/Skills/rnoh-lib-rnt-search/SKILL.md +722 -722
- package/vendor/Server/Skills/rnoh-lib-rnt-search/assets/PORT_REPORT_TEMPLATE.md +219 -219
- package/vendor/Server/Skills/rnoh-lib-rnt-search/references/DEMO_PORTING_GUIDE.md +345 -345
- package/vendor/Server/Skills/rnoh-lib-rnt-search/references/PORT_VERIFICATION.md +269 -269
- package/vendor/Server/Skills/rnoh-lib-rnt-search/references/RNT_PROJECT_STRUCTURE.md +173 -173
- package/vendor/Server/Skills/rnoh-lib-rnt-search/scripts/analyze-demo-deps.cjs +267 -267
- package/vendor/Server/Skills/rnoh-lib-rnt-search/scripts/detect-rnoh-version.cjs +174 -174
- package/vendor/Server/Skills/rnoh-lib-rnt-search/scripts/find-rnt-demo.sh +111 -111
- package/vendor/Server/Skills/rnoh-lib-rnt-search/scripts/port-demo.sh +186 -186
- package/vendor/Server/Skills/rnoh-lib-rnt-search/scripts/read-lib-meta.cjs +150 -150
- package/vendor/Server/Skills/rnoh-lib-test-align/SKILL.md +296 -296
- package/vendor/Server/Skills/rnoh-lib-test-align/references/jest-troubleshooting.md +371 -371
- package/vendor/Server/Skills/rnoh-lib-test-align/references/port-test-demo-guide.md +212 -212
- package/vendor/Server/Skills/rnoh-lib-test-align/references/runtime-troubleshooting.md +345 -345
- package/vendor/Server/Skills/rnoh-lib-test-align/references/unit-test-template.md +223 -223
- package/vendor/Server/Skills/rnoh-lib-test-align/scripts/port-test-demo.sh +1053 -1053
- package/vendor/Server/Skills/rnoh-lib-version-diff/SKILL.md +295 -255
- package/vendor/Server/Skills/rnoh-lib-version-diff/references/OHOS_ADAPTATION.md +82 -77
- package/vendor/Server/Skills/rnoh-lib-version-diff/references/OHOS_API_LOOKUP.md +224 -224
- package/vendor/Server/Skills/rnoh-lib-version-diff/references/script-reference.md +175 -174
- package/vendor/Server/Skills/rnoh-lib-version-diff/scripts/detect-upstream-version.js +967 -967
- package/vendor/Server/Skills/rnoh-lib-version-diff/scripts/generate-diff.js +1798 -1798
- package/vendor/Server/Skills/rnoh-lib-version-diff/scripts/package.json +5 -5
- package/vendor/Server/Skills/rnoh-lib-version-diff/templates/report-template.md +180 -137
- package/vendor/Server/Skills/rnoh-lib-xts-coverage/SKILL.md +145 -145
- package/vendor/Server/Skills/skill-generator/SKILL.md +365 -365
- package/vendor/Server/Skills/skill-generator/assets/SKILL_TEMPLATE.md +183 -183
- package/vendor/Server/Skills/skill-generator/references/COMPLIANCE_CHECKLIST.md +82 -82
- package/vendor/Server/Skills/skill-generator/references/KB_QUERY_GUIDE.md +110 -110
- package/vendor/Server/Skills/skill-generator/references/MCP_TOOL_DISCOVERY.md +122 -122
- package/vendor/Server/Skills/skill-generator/references/SKILL_SPEC.md +121 -121
- package/vendor/Server/Skills/skill-generator/scripts/validate-skill.cjs +259 -259
- package/vendor/Server/Skills/task-analysis/SKILL.md +234 -234
- package/vendor/Server/Skills/task-analysis/assets/OUTPUT_EXAMPLES.md +160 -160
- package/vendor/Server/Skills/task-analysis/references/ACCEPTANCE_CRITERIA_GUIDE.md +190 -190
- package/vendor/Server/Skills/task-analysis/references/ANALYSIS_SCHEMA.md +224 -224
- package/vendor/Server/Skills/task-analysis/references/INTEGRATION_CONTEXT.md +162 -162
- package/vendor/Server/Skills/task-analysis/references/LESSONS_LEARNED.md +55 -55
- package/vendor/Server/Skills/task-analysis/references/REPLAN_CONTEXT_GUIDE.md +126 -126
- package/vendor/Server/Skills/task-analysis/scripts/validate-analysis-output.sh +256 -256
- package/vendor/Server/Skills/task-decomposition/SKILL.md +528 -528
- package/vendor/Server/Skills/task-decomposition/assets/OUTPUT_EXAMPLES.md +451 -451
- package/vendor/Server/Skills/task-decomposition/references/ACCEPTANCE_CRITERIA_GUIDE.md +179 -179
- package/vendor/Server/Skills/task-decomposition/references/DEPENDENCY_GRAPH_GUIDE.md +152 -152
- package/vendor/Server/Skills/task-decomposition/references/INTEGRATION_CONTEXT.md +175 -175
- package/vendor/Server/Skills/task-decomposition/references/REPLAN_CONTEXT_GUIDE.md +195 -195
- package/vendor/Server/Skills/task-decomposition/references/TASK_DECOMPOSITION_TEMPLATES.md +226 -226
- package/vendor/Server/Skills/task-decomposition/scripts/list-available-skills.cjs +263 -263
- package/vendor/Server/Skills/task-decomposition/scripts/skill-blacklist.json +29 -29
- package/vendor/Server/Skills/task-decomposition/scripts/validate-decomposition-output.cjs +376 -376
- package/vendor/Server/Skills/task-decomposition/scripts/validate-param-consistency.cjs +259 -259
- package/vendor/Server/Skills/task-decomposition/scripts/validate-specified-skills.cjs +216 -216
- package/vendor/Server/Skills/task-decomposition/scripts/validate-step-graph.cjs +424 -424
- package/vendor/Server/Skills/tpc-cpp-check/SKILL.md +427 -427
- package/vendor/Server/Skills/tpc-cpp-check/references/CHECKLIST.md +214 -214
- package/vendor/Server/Skills/tpc-cpp-check/references/HPKBUILD_GUIDE.md +235 -235
- package/vendor/Server/Skills/tpc-cpp-check/references/REPORT_TEMPLATE.md +250 -250
- package/vendor/Server/TestCheck/TestCheck.js +775 -775
- package/vendor/Server/TestCheck/index.js +11 -11
- package/vendor/Server/library/McpToolGuide.js +280 -280
- package/vendor/Server/library/StatsService.js +126 -126
- package/vendor/Server/library/cstTime.js +16 -16
- package/vendor/VERSION +3 -3
- package/workflows/pr-check.mjs +105 -105
- package/workflows/pr-push.mjs +192 -192
- package/vendor/Server/Agent/SkillSelector/types.js +0 -63
|
@@ -1,345 +1,345 @@
|
|
|
1
|
-
# Demo 迁移详细指南
|
|
2
|
-
|
|
3
|
-
> 本文档说明 demo 迁移的完整流程、库元数据字段、依赖分析规则、路径修正检查清单。
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. 库元数据字段
|
|
8
|
-
|
|
9
|
-
`scripts/read-lib-meta.cjs` 输出 JSON,各字段用途:
|
|
10
|
-
|
|
11
|
-
| 字段 | 类型 | 来源 | 用途 |
|
|
12
|
-
|------|------|------|------|
|
|
13
|
-
| `packageName` | string | `package.json.name` | npm 包名,写入 example `dependencies` |
|
|
14
|
-
| `version` | string | `package.json.version` | tgz 版本号 |
|
|
15
|
-
| `alias` | string | `harmony.alias` 或 scoped | metro 别名,候选搜索名 |
|
|
16
|
-
| `scoped` | string | packageName 去 scope | 候选搜索名 |
|
|
17
|
-
| `dirBase` | string | 目录 basename | 候选搜索名 |
|
|
18
|
-
| `searchNames` | string[] | 上述去重 | demo 扫描候选名列表 |
|
|
19
|
-
| `autolinking` | object \| null | `harmony.autolinking` | 鸿蒙化链接配置(供下游壳层适配) |
|
|
20
|
-
| `autolinkingResolved` | object | 脚本推断 | 源码模块路径、CMake 路径等(供下游使用) |
|
|
21
|
-
| `codegenConfig` | object \| null | `package.json.codegenConfig` | codegen 配置 |
|
|
22
|
-
|
|
23
|
-
### 1.1 autolinkingResolved 字段
|
|
24
|
-
|
|
25
|
-
| 字段 | 说明 | 下游用途 |
|
|
26
|
-
|------|------|---------|
|
|
27
|
-
| `ohPackageName` | ohpm 包名 | `RNPackagesFactory.ets` import |
|
|
28
|
-
| `sourceModulePath` | `harmony/{module}/` 路径 | CMake `add_subdirectory`、`build-profile.template.json5` 的 `srcPath` |
|
|
29
|
-
| `harmonyModuleName` | 源码模块目录名 | `build-profile.template.json5` 的 `modules[].name` |
|
|
30
|
-
| `hasCpp` | 是否有 C++ 源码 | 决定是否写 CMake |
|
|
31
|
-
| `cmakeCppPath` | C++ 源码路径(node_modules 下) | CMake `add_subdirectory` |
|
|
32
|
-
| `cmakeShortName` | CMake 短名 | `add_subdirectory` 第二参数 |
|
|
33
|
-
| `etsPackageClassName` | ETS Package 类名 | `RNPackagesFactory.ets` |
|
|
34
|
-
| `cppPackageClassName` | C++ Package 类名 | `PackageProvider.cpp` |
|
|
35
|
-
| `cmakeLibraryTargetName` | CMake link target | `target_link_libraries` |
|
|
36
|
-
|
|
37
|
-
> ⚠️ `sourceModulePath` **不要**写入 `package.json` 的 `harmony.autolinking.mainHarPath`(会导致 RNOH CLI 扫不到 `.har`)。
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
## 2. 依赖分析与写入
|
|
42
|
-
|
|
43
|
-
### 2.1 依赖分类
|
|
44
|
-
|
|
45
|
-
`scripts/analyze-demo-deps.cjs` 扫描 demo 源码的 `import` / `require` 语句,按以下规则分类:
|
|
46
|
-
|
|
47
|
-
| 类别 | 判定规则 | 处理方式 |
|
|
48
|
-
|------|---------|---------|
|
|
49
|
-
| **相对路径** | `import './xxx'` / `import '../xxx'` | 忽略(demo 内部引用) |
|
|
50
|
-
| **Node 内置** | `fs` / `path` / `util` / `os` 等 | 忽略 |
|
|
51
|
-
| **React 核心** | `react` / `react-native` | 忽略(example 模板已内置) |
|
|
52
|
-
| **目标库本身** | `module === alias` 或 `packageName` | 标注,由 `rn-lib-add-example` 改为 `file:../<tgz>` |
|
|
53
|
-
| **RNOH 框架** | `@react-native-oh/*` / `@rnoh/*` / `react-native-harmony` | 列入 example `dependencies`,版本对齐 RNOH |
|
|
54
|
-
| **RN 通用包** | `react-native-*` / `@react-native-*` / `@react-native-community/*` | 列入 example `dependencies` |
|
|
55
|
-
| **其他第三方** | 不属于以上类别 | 列入「待人工确认」清单 |
|
|
56
|
-
|
|
57
|
-
### 2.2 依赖版本对齐
|
|
58
|
-
|
|
59
|
-
迁移报告产出依赖增量时,**不自动指定版本号**,由 `rn-lib-add-example` 按以下规则对齐:
|
|
60
|
-
|
|
61
|
-
| 依赖类型 | 版本来源 |
|
|
62
|
-
|----------|---------|
|
|
63
|
-
| 目标库本身 | `libPath/package.json` 的 `version`,引用方式 `file:../<name>-<version>.tgz` |
|
|
64
|
-
| RNOH 框架 | example 模板默认版本,或用户指定的 RNOH 版本 |
|
|
65
|
-
| 通用 RN 包 | example 模板已有版本优先;模板无则取 rnt 工程的版本 |
|
|
66
|
-
| 其他第三方 | 询问用户,或取 rnt 工程版本 |
|
|
67
|
-
|
|
68
|
-
### 2.3 依赖写入职责
|
|
69
|
-
|
|
70
|
-
> ⚠️ 本 SKILL **不**自动写入 `example/package.json`。只产出依赖增量清单,由下游 `rn-lib-add-example` 统一写入。
|
|
71
|
-
|
|
72
|
-
理由:
|
|
73
|
-
1. 版本对齐需要 example 模板上下文,本 SKILL 不感知模板版本
|
|
74
|
-
2. 避免多次写入冲突(`rn-lib-add-example` 也会写依赖)
|
|
75
|
-
3. 保持职责单一:本 SKILL 只做「分析」,不做「写入」
|
|
76
|
-
|
|
77
|
-
### 2.4 外部依赖存在性检查(必执行)
|
|
78
|
-
|
|
79
|
-
`analyze-demo-deps.cjs` 输出的 `externalDeps` 中每个包,**必须逐一检查**是否已在 `example/package.json` 中声明。缺失依赖会导致运行时崩溃。
|
|
80
|
-
|
|
81
|
-
**典型缺失场景**:
|
|
82
|
-
|
|
83
|
-
| 缺失依赖 | 原因 | 影响 | 补齐方式 |
|
|
84
|
-
|---------|------|------|---------|
|
|
85
|
-
| `@rnoh/testerino` | rnt demo 使用 testerino 测试框架,example 未声明 | 所有 `Tester`/`TestCase`/`TestSuite` 组件无法渲染 | 从 rnt 工程复制 `rnoh-testerino-<version>.tgz` 到 example 目录,以 `file:` 方式写入 dependencies |
|
|
86
|
-
| `@react-native-ohos/<pkg>` | demo 引用了其他鸿蒙化库但 example 未安装 | 引用该库的组件崩溃 | 从 rnt 工程或 npm registry 获取版本,写入 dependencies |
|
|
87
|
-
| 其他第三方包 | demo 引用了 example 未安装的包 | 引用该包的组件崩溃 | 询问用户或从 rnt 工程获取版本 |
|
|
88
|
-
|
|
89
|
-
**检查方法**:
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
# 读取 example/package.json 已声明的依赖
|
|
93
|
-
node -e "const p=require('<libPath>/example/package.json'); const all={...p.dependencies,...p.devDependencies}; console.log(JSON.stringify(Object.keys(all)))"
|
|
94
|
-
|
|
95
|
-
# 对比 analyze-demo-deps.cjs 的 externalDeps 输出,找出未声明的包
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### 2.5 从 rnt 工程提取缺失依赖版本
|
|
99
|
-
|
|
100
|
-
当发现缺失依赖时,从 rnt 工程的 `package.json` 中提取版本与引用方式:
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
# 在 rnt 子工程的 package.json 中搜索缺失依赖
|
|
104
|
-
grep -r "<missingDep>" <rntPath>/*/package.json
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
常见模式:
|
|
108
|
-
- `@rnoh/testerino` → `"file:./rnoh_package/testerino/rnoh-testerino-0.0.12.tgz"` → 复制 tgz 到 example,以 `file:./rnoh-testerino-0.0.12.tgz` 引用
|
|
109
|
-
- `@react-native-ohos/*` → `"http://<registry>/<pkg>/-/<pkg>-<version>.tgz"` 或 `"file:../<xxx>.har"` → 按相同方式写入
|
|
110
|
-
|
|
111
|
-
---
|
|
112
|
-
|
|
113
|
-
## 3. 迁移流程细节
|
|
114
|
-
|
|
115
|
-
### 3.1 迁移前检查
|
|
116
|
-
|
|
117
|
-
| 检查项 | 通过条件 | 失败处理 |
|
|
118
|
-
|--------|---------|---------|
|
|
119
|
-
| `demoPath` 存在 | 目录可访问 | 报错终止,提示用户重新提供 |
|
|
120
|
-
| `targetExampleSrc` 存在 | 目录可访问 | 引导用户先执行 `rn-lib-add-example` 创建模板 |
|
|
121
|
-
| `targetExampleSrc` 可写 | 有写权限 | 报错并终止 |
|
|
122
|
-
| 目标已有同名文件 | 列出冲突文件 | **保留目标版本**,demo 版本不写入(`--ignore-existing`),报告中标注冲突项供人工确认 |
|
|
123
|
-
|
|
124
|
-
### 3.2 --clean 选项
|
|
125
|
-
|
|
126
|
-
`--clean` 启用时,迁移前清空 `targetExampleSrc`:
|
|
127
|
-
|
|
128
|
-
```bash
|
|
129
|
-
# 脚本行为
|
|
130
|
-
rm -rf <targetExampleSrc>/*
|
|
131
|
-
# 然后复制 demo 内容
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
> ⚠️ `--clean` **必须**由用户明确同意。Agent 不得自动启用。**默认模式为增量添加(`--ignore-existing`),不覆盖已有文件**。建议保留通用组件 `Navigation.tsx`(若 demo 仍使用)——脚本默认不清除 `components/Navigation.tsx`,可通过 `--clean-all` 强制全清。
|
|
135
|
-
|
|
136
|
-
### 3.3 默认排除项
|
|
137
|
-
|
|
138
|
-
`port-demo.sh` 默认排除以下目录/文件:
|
|
139
|
-
|
|
140
|
-
| 排除项 | 原因 |
|
|
141
|
-
|--------|------|
|
|
142
|
-
| `node_modules/` | demo 自身的依赖,example 会重新 install |
|
|
143
|
-
| `build/` | 构建产物 |
|
|
144
|
-
| `__tests__/` | demo 自带的测试,example 有自己的 testerino 注册 |
|
|
145
|
-
| `.cxx/` / `oh_modules/` | 鸿蒙构建产物 |
|
|
146
|
-
| `.DS_Store` | macOS 垃圾文件 |
|
|
147
|
-
| `*.log` | 日志文件 |
|
|
148
|
-
|
|
149
|
-
可通过 `--exclude` 参数追加自定义排除项。
|
|
150
|
-
|
|
151
|
-
### 3.4 rsync 复制
|
|
152
|
-
|
|
153
|
-
使用 `rsync -a --ignore-existing` 保留文件元数据(mtime、权限),**仅添加目标不存在的文件,不覆盖已有文件**:
|
|
154
|
-
|
|
155
|
-
```bash
|
|
156
|
-
rsync -a --ignore-existing \
|
|
157
|
-
--exclude 'node_modules/' \
|
|
158
|
-
--exclude 'build/' \
|
|
159
|
-
--exclude '__tests__/' \
|
|
160
|
-
--exclude '.cxx/' \
|
|
161
|
-
--exclude 'oh_modules/' \
|
|
162
|
-
--exclude '.DS_Store' \
|
|
163
|
-
--exclude '*.log' \
|
|
164
|
-
"<demoPath>/" "<targetExampleSrc>/"
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
> 注意末尾 `/`:`<demoPath>/` 表示复制目录内容,`<demoPath>`(无 `/`)会复制目录本身。
|
|
168
|
-
>
|
|
169
|
-
> `--ignore-existing` 确保目标已有文件保留不动,冲突文件在脚本输出中列出供 Agent 写入报告。
|
|
170
|
-
|
|
171
|
-
---
|
|
172
|
-
|
|
173
|
-
## 4. 路径修正检查清单
|
|
174
|
-
|
|
175
|
-
迁移完成后,**逐文件**检查以下内容(使用 `Edit` 工具)。
|
|
176
|
-
|
|
177
|
-
> ⚠️ **仅修正本次新增的文件**:如果某文件是目标已有的(冲突保留项),**不修改它**,仅在报告中标注需人工处理。
|
|
178
|
-
|
|
179
|
-
### 4.1 相对路径修正
|
|
180
|
-
|
|
181
|
-
| 文件 | 检查内容 | 修正规则 |
|
|
182
|
-
|------|---------|---------|
|
|
183
|
-
| `tests/index.tsx` | 引用 demo 子目录的路径 | `./xxx` → `../xxx`(tests/ 在 src/tests/ 下,引用上级) |
|
|
184
|
-
| `tests/*.tsx` | 同上 | 同上 |
|
|
185
|
-
| 任何子目录文件 | 引用其他子目录 | 确保相对路径从 `example/src/` 起算 |
|
|
186
|
-
|
|
187
|
-
**示例**:
|
|
188
|
-
|
|
189
|
-
```tsx
|
|
190
|
-
// ❌ 迁移前(rnt demo 内 tests/index.tsx)
|
|
191
|
-
import { CameraDemo } from './camera/CameraDemo';
|
|
192
|
-
import { Navigation } from './components/Navigation';
|
|
193
|
-
|
|
194
|
-
// ✅ 迁移后(example/src/tests/index.tsx)
|
|
195
|
-
import { CameraDemo } from '../camera/CameraDemo';
|
|
196
|
-
import { Navigation } from '../components/Navigation';
|
|
197
|
-
```
|
|
198
|
-
|
|
199
|
-
### 4.2 入口文件对齐与接入
|
|
200
|
-
|
|
201
|
-
| 文件 | 检查内容 |
|
|
202
|
-
|------|---------|
|
|
203
|
-
| `App.tsx`(可在嵌套子目录如 `testCase/App.tsx`) | `displayName` / `title` 与 demo 名称一致 |
|
|
204
|
-
| `index.tsx`(根级) | 是否已引用 demo 入口;若未引用,re-export demo 入口 |
|
|
205
|
-
| `Test/index.tsx` 或 `tests/index.tsx` | testerino 注册的组件名与 `App.displayName` 一致 |
|
|
206
|
-
|
|
207
|
-
**入口接入检查**:
|
|
208
|
-
|
|
209
|
-
```bash
|
|
210
|
-
# 确认 index.tsx 是否引用了 demo 入口(testCase/App, demo/App, ./App 等)
|
|
211
|
-
grep -l "testCase/App\|demo/App\|./App" example/src/index.tsx
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
若未引用,**仅在 `index.tsx` 是本次新增文件时**才更新为 re-export;若 `index.tsx` 是目标已有文件,不覆盖,在报告中标注「入口未接入,需人工处理」:
|
|
215
|
-
|
|
216
|
-
```tsx
|
|
217
|
-
// index.tsx — 更新为 re-export demo 入口(仅当 index.tsx 是本次新增文件时)
|
|
218
|
-
export {
|
|
219
|
-
default,
|
|
220
|
-
displayName,
|
|
221
|
-
framework,
|
|
222
|
-
category,
|
|
223
|
-
title,
|
|
224
|
-
documentationURL,
|
|
225
|
-
description,
|
|
226
|
-
examples,
|
|
227
|
-
} from './testCase/App';
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
### 4.3 Navigation.tsx 硬编码标题修正
|
|
231
|
-
|
|
232
|
-
`Navigation.tsx`(或类似共享组件)从 rnt 复制后可能包含**其他库的硬编码标题**。
|
|
233
|
-
|
|
234
|
-
**检测**:`analyze-demo-deps.cjs` 的 `hardcodedTitles` 字段列出所有匹配 `RN <Xxx> (Capi )?Tester` 的文本。
|
|
235
|
-
|
|
236
|
-
**修正**(**仅针对本次新增的文件**,目标已有文件不修改,在报告中标注):
|
|
237
|
-
|
|
238
|
-
```tsx
|
|
239
|
-
// ❌ 迁移前(遗留的 Svg 库标题)
|
|
240
|
-
<Text>RN Svg Capi Tester</Text>
|
|
241
|
-
|
|
242
|
-
// ✅ 迁移后(替换为目标库 alias,如 react-native-pdf → Pdf)
|
|
243
|
-
<Text>RN Pdf Tester</Text>
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
### 4.4 目标库引用对齐
|
|
247
|
-
|
|
248
|
-
确认 demo 中目标库的引用方式与 example 配置一致:
|
|
249
|
-
|
|
250
|
-
| demo 引用方式 | example 需配置 |
|
|
251
|
-
|--------------|---------------|
|
|
252
|
-
| `import { X } from '<alias>'` | `metro.config.js` 的 `extraNodeModules['<alias>']` 指向 `node_modules/<ohPackageName>` |
|
|
253
|
-
| `import { X } from '<packageName>'` | `tsconfig.json` 的 `paths['<packageName>']` 指向 `./node_modules/<ohPackageName>` |
|
|
254
|
-
| `import { X } from '<packageName>/src/internal'` | 列入「待人工确认」,不自动改写 |
|
|
255
|
-
|
|
256
|
-
> 引用方式对齐的最终写入由 `rn-lib-add-example` 完成。本 SKILL 只检查并在报告中标注不一致项。
|
|
257
|
-
|
|
258
|
-
---
|
|
259
|
-
|
|
260
|
-
## 5. 迁移后自检
|
|
261
|
-
|
|
262
|
-
迁移完成后,执行以下自检(不需运行 `npm install`,仅静态检查):
|
|
263
|
-
|
|
264
|
-
| 检查项 | 方法 | 通过标准 |
|
|
265
|
-
|--------|------|---------|
|
|
266
|
-
| 文件完整性 | 对比 `demoPath` 与 `targetExampleSrc` 文件清单 | **本次新增文件**全部迁移到位(冲突文件保留目标版本,不计入缺失) |
|
|
267
|
-
| 入口文件存在 | `find example/src -name "App.tsx" -o -name "index.tsx"` | 两个文件都存在(可嵌套) |
|
|
268
|
-
| index.tsx 接入 | `grep "testCase/App\|demo/App\|./App" example/src/index.tsx` | index.tsx 引用 demo 入口(若 index.tsx 为已有文件未接入,标注为待人工确认) |
|
|
269
|
-
| 相对路径有效 | grep `from '\./` 在子目录下 | 无错误的同级引用(仅检查本次新增文件) |
|
|
270
|
-
| 目标库引用一致 | grep `import.*from.*'<alias>\|<packageName>'` | 引用方式与 example 配置一致(仅检查本次新增文件) |
|
|
271
|
-
| 无硬编码标题 | grep `RN.*Tester` 在 Navigation.tsx 等 | 无其他库的遗留标题(仅本次新增文件已修正;已有文件标注待人工处理) |
|
|
272
|
-
| 无残留排除项 | `ls example/src/node_modules` 等 | 不存在(应被排除) |
|
|
273
|
-
| **外部依赖已声明** | 对比 `externalDeps` 与 `example/package.json` | 所有外部依赖已在 dependencies/devDependencies 中声明(Phase 4.1) |
|
|
274
|
-
| **无孤立文件** | 对比迁移文件列表与 index.tsx demos 数组 | 所有有 export 的组件都被入口直接/间接引用(Phase 6.6) |
|
|
275
|
-
| **菜单可滚动** | 检查 demos 条目数与菜单容器类型 | 条目 > 5 时菜单容器为 ScrollView(Phase 6.7) |
|
|
276
|
-
| **原有 App.tsx 可访问** | 检查 index.tsx 是否包含 OriginalApp 菜单项 | 原有 demo 入口未丢失(Phase 6.8) |
|
|
277
|
-
| **入口链路完整** | index.js → src/index.tsx → demos → 各组件 → ./demo/ | 全链路可导入(Phase 6.9) |
|
|
278
|
-
| **build-profile 无越界** | 检查 modules[].srcPath 是否以 ../ 开头 | 所有路径在工程内(Phase 5.1) |
|
|
279
|
-
| **.har 路径有效** | 逐一 ls 验证 oh-package.json5 中的 file: 引用 | 所有 .har 文件存在(Phase 5.2) |
|
|
280
|
-
|
|
281
|
-
> 自检脚本由 Agent 串联执行,结果写入迁移报告。
|
|
282
|
-
|
|
283
|
-
---
|
|
284
|
-
|
|
285
|
-
## 6. 构建前置检查
|
|
286
|
-
|
|
287
|
-
迁移完成后、执行编译前,必须确认以下构建前置条件已满足:
|
|
288
|
-
|
|
289
|
-
### 6.1 build-profile.json5 模块路径越界
|
|
290
|
-
|
|
291
|
-
`example/harmony/build-profile.json5` 与 `build-profile.template.json5` 中的 `modules[].srcPath` **不可**以 `../` 开头(越出工程根目录)。
|
|
292
|
-
|
|
293
|
-
**典型问题**:库的源码模块在 `libPath/harmony/safe_area/`,build-profile 引用为 `../../harmony/safe_area` → hvigor 报错。
|
|
294
|
-
|
|
295
|
-
**修正**:
|
|
296
|
-
1. `cp -R <libPath>/harmony/<module> example/harmony/<module>`
|
|
297
|
-
2. 修改 `srcPath` 为 `./<module>`
|
|
298
|
-
3. 修正被复制模块的 `oh-package.json5` 中 `.har` 路径
|
|
299
|
-
|
|
300
|
-
> 符号链接不可行:hvigor 不跟随 symlink。
|
|
301
|
-
|
|
302
|
-
### 6.2 .har 文件路径验证
|
|
303
|
-
|
|
304
|
-
被复制模块的 `oh-package.json5` 中 `file:` 引用的 `.har` 文件路径可能因目录层级变化而失效。
|
|
305
|
-
|
|
306
|
-
**典型问题**:原始路径 `file:../../node_modules/@react-native-oh/react-native-harmony/harmony/react_native_openharmony.har`(多一层 `harmony/`),复制后应为 `file:../../node_modules/@react-native-oh/react-native-harmony/react_native_openharmony.har`。
|
|
307
|
-
|
|
308
|
-
**验证方法**:逐一 `ls -la` 检查每个 `file:` 引用的文件是否存在。
|
|
309
|
-
|
|
310
|
-
### 6.3 编译验证步骤
|
|
311
|
-
|
|
312
|
-
确认前置检查通过后,按以下顺序执行编译:
|
|
313
|
-
|
|
314
|
-
```bash
|
|
315
|
-
# 1. 安装 JS 依赖
|
|
316
|
-
cd example && npm i --legacy-peer-deps
|
|
317
|
-
|
|
318
|
-
# 2. 安装鸿蒙原生依赖
|
|
319
|
-
cd harmony && ohpm install
|
|
320
|
-
|
|
321
|
-
# 3. 生成 JS bundle
|
|
322
|
-
cd .. && npm run dev
|
|
323
|
-
|
|
324
|
-
# 4. 编译鸿蒙工程
|
|
325
|
-
cd harmony && devecocli build
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
> `npm i` 只装 JS 依赖,`ohpm install` 才装原生 .har 依赖,两者都不可省略。
|
|
329
|
-
|
|
330
|
-
---
|
|
331
|
-
|
|
332
|
-
## 7. 与 rn-lib-add-example 的衔接
|
|
333
|
-
|
|
334
|
-
本 SKILL 完成后,迁移报告中的以下内容会被 `rn-lib-add-example` 消费:
|
|
335
|
-
|
|
336
|
-
| 报告章节 | 下游用途 |
|
|
337
|
-
|----------|---------|
|
|
338
|
-
| 依赖增量清单 | 写入 `example/package.json` 的 `dependencies` |
|
|
339
|
-
| 目标库引用方式 | 配置 `metro.config.js` 的 `extraNodeModules` |
|
|
340
|
-
| 入口文件 displayName | 配置 `App.tsx` 与 `Test/index.tsx` 注册 |
|
|
341
|
-
| 版本一致性检测结果 | 决定是否需要更新 example/package.json 的 react-native / react-native-harmony 版本 |
|
|
342
|
-
| 待人工确认项 | 由用户或 Agent 在壳层适配阶段决策 |
|
|
343
|
-
| 原生代码标注 | 决定是否需要 CMake / RNPackagesFactory 适配 |
|
|
344
|
-
|
|
345
|
-
> 迁移报告是本 SKILL 的**唯一交付物**,下游 SKILL 通过读取报告获取所需信息。
|
|
1
|
+
# Demo 迁移详细指南
|
|
2
|
+
|
|
3
|
+
> 本文档说明 demo 迁移的完整流程、库元数据字段、依赖分析规则、路径修正检查清单。
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. 库元数据字段
|
|
8
|
+
|
|
9
|
+
`scripts/read-lib-meta.cjs` 输出 JSON,各字段用途:
|
|
10
|
+
|
|
11
|
+
| 字段 | 类型 | 来源 | 用途 |
|
|
12
|
+
|------|------|------|------|
|
|
13
|
+
| `packageName` | string | `package.json.name` | npm 包名,写入 example `dependencies` |
|
|
14
|
+
| `version` | string | `package.json.version` | tgz 版本号 |
|
|
15
|
+
| `alias` | string | `harmony.alias` 或 scoped | metro 别名,候选搜索名 |
|
|
16
|
+
| `scoped` | string | packageName 去 scope | 候选搜索名 |
|
|
17
|
+
| `dirBase` | string | 目录 basename | 候选搜索名 |
|
|
18
|
+
| `searchNames` | string[] | 上述去重 | demo 扫描候选名列表 |
|
|
19
|
+
| `autolinking` | object \| null | `harmony.autolinking` | 鸿蒙化链接配置(供下游壳层适配) |
|
|
20
|
+
| `autolinkingResolved` | object | 脚本推断 | 源码模块路径、CMake 路径等(供下游使用) |
|
|
21
|
+
| `codegenConfig` | object \| null | `package.json.codegenConfig` | codegen 配置 |
|
|
22
|
+
|
|
23
|
+
### 1.1 autolinkingResolved 字段
|
|
24
|
+
|
|
25
|
+
| 字段 | 说明 | 下游用途 |
|
|
26
|
+
|------|------|---------|
|
|
27
|
+
| `ohPackageName` | ohpm 包名 | `RNPackagesFactory.ets` import |
|
|
28
|
+
| `sourceModulePath` | `harmony/{module}/` 路径 | CMake `add_subdirectory`、`build-profile.template.json5` 的 `srcPath` |
|
|
29
|
+
| `harmonyModuleName` | 源码模块目录名 | `build-profile.template.json5` 的 `modules[].name` |
|
|
30
|
+
| `hasCpp` | 是否有 C++ 源码 | 决定是否写 CMake |
|
|
31
|
+
| `cmakeCppPath` | C++ 源码路径(node_modules 下) | CMake `add_subdirectory` |
|
|
32
|
+
| `cmakeShortName` | CMake 短名 | `add_subdirectory` 第二参数 |
|
|
33
|
+
| `etsPackageClassName` | ETS Package 类名 | `RNPackagesFactory.ets` |
|
|
34
|
+
| `cppPackageClassName` | C++ Package 类名 | `PackageProvider.cpp` |
|
|
35
|
+
| `cmakeLibraryTargetName` | CMake link target | `target_link_libraries` |
|
|
36
|
+
|
|
37
|
+
> ⚠️ `sourceModulePath` **不要**写入 `package.json` 的 `harmony.autolinking.mainHarPath`(会导致 RNOH CLI 扫不到 `.har`)。
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 2. 依赖分析与写入
|
|
42
|
+
|
|
43
|
+
### 2.1 依赖分类
|
|
44
|
+
|
|
45
|
+
`scripts/analyze-demo-deps.cjs` 扫描 demo 源码的 `import` / `require` 语句,按以下规则分类:
|
|
46
|
+
|
|
47
|
+
| 类别 | 判定规则 | 处理方式 |
|
|
48
|
+
|------|---------|---------|
|
|
49
|
+
| **相对路径** | `import './xxx'` / `import '../xxx'` | 忽略(demo 内部引用) |
|
|
50
|
+
| **Node 内置** | `fs` / `path` / `util` / `os` 等 | 忽略 |
|
|
51
|
+
| **React 核心** | `react` / `react-native` | 忽略(example 模板已内置) |
|
|
52
|
+
| **目标库本身** | `module === alias` 或 `packageName` | 标注,由 `rn-lib-add-example` 改为 `file:../<tgz>` |
|
|
53
|
+
| **RNOH 框架** | `@react-native-oh/*` / `@rnoh/*` / `react-native-harmony` | 列入 example `dependencies`,版本对齐 RNOH |
|
|
54
|
+
| **RN 通用包** | `react-native-*` / `@react-native-*` / `@react-native-community/*` | 列入 example `dependencies` |
|
|
55
|
+
| **其他第三方** | 不属于以上类别 | 列入「待人工确认」清单 |
|
|
56
|
+
|
|
57
|
+
### 2.2 依赖版本对齐
|
|
58
|
+
|
|
59
|
+
迁移报告产出依赖增量时,**不自动指定版本号**,由 `rn-lib-add-example` 按以下规则对齐:
|
|
60
|
+
|
|
61
|
+
| 依赖类型 | 版本来源 |
|
|
62
|
+
|----------|---------|
|
|
63
|
+
| 目标库本身 | `libPath/package.json` 的 `version`,引用方式 `file:../<name>-<version>.tgz` |
|
|
64
|
+
| RNOH 框架 | example 模板默认版本,或用户指定的 RNOH 版本 |
|
|
65
|
+
| 通用 RN 包 | example 模板已有版本优先;模板无则取 rnt 工程的版本 |
|
|
66
|
+
| 其他第三方 | 询问用户,或取 rnt 工程版本 |
|
|
67
|
+
|
|
68
|
+
### 2.3 依赖写入职责
|
|
69
|
+
|
|
70
|
+
> ⚠️ 本 SKILL **不**自动写入 `example/package.json`。只产出依赖增量清单,由下游 `rn-lib-add-example` 统一写入。
|
|
71
|
+
|
|
72
|
+
理由:
|
|
73
|
+
1. 版本对齐需要 example 模板上下文,本 SKILL 不感知模板版本
|
|
74
|
+
2. 避免多次写入冲突(`rn-lib-add-example` 也会写依赖)
|
|
75
|
+
3. 保持职责单一:本 SKILL 只做「分析」,不做「写入」
|
|
76
|
+
|
|
77
|
+
### 2.4 外部依赖存在性检查(必执行)
|
|
78
|
+
|
|
79
|
+
`analyze-demo-deps.cjs` 输出的 `externalDeps` 中每个包,**必须逐一检查**是否已在 `example/package.json` 中声明。缺失依赖会导致运行时崩溃。
|
|
80
|
+
|
|
81
|
+
**典型缺失场景**:
|
|
82
|
+
|
|
83
|
+
| 缺失依赖 | 原因 | 影响 | 补齐方式 |
|
|
84
|
+
|---------|------|------|---------|
|
|
85
|
+
| `@rnoh/testerino` | rnt demo 使用 testerino 测试框架,example 未声明 | 所有 `Tester`/`TestCase`/`TestSuite` 组件无法渲染 | 从 rnt 工程复制 `rnoh-testerino-<version>.tgz` 到 example 目录,以 `file:` 方式写入 dependencies |
|
|
86
|
+
| `@react-native-ohos/<pkg>` | demo 引用了其他鸿蒙化库但 example 未安装 | 引用该库的组件崩溃 | 从 rnt 工程或 npm registry 获取版本,写入 dependencies |
|
|
87
|
+
| 其他第三方包 | demo 引用了 example 未安装的包 | 引用该包的组件崩溃 | 询问用户或从 rnt 工程获取版本 |
|
|
88
|
+
|
|
89
|
+
**检查方法**:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# 读取 example/package.json 已声明的依赖
|
|
93
|
+
node -e "const p=require('<libPath>/example/package.json'); const all={...p.dependencies,...p.devDependencies}; console.log(JSON.stringify(Object.keys(all)))"
|
|
94
|
+
|
|
95
|
+
# 对比 analyze-demo-deps.cjs 的 externalDeps 输出,找出未声明的包
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### 2.5 从 rnt 工程提取缺失依赖版本
|
|
99
|
+
|
|
100
|
+
当发现缺失依赖时,从 rnt 工程的 `package.json` 中提取版本与引用方式:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# 在 rnt 子工程的 package.json 中搜索缺失依赖
|
|
104
|
+
grep -r "<missingDep>" <rntPath>/*/package.json
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
常见模式:
|
|
108
|
+
- `@rnoh/testerino` → `"file:./rnoh_package/testerino/rnoh-testerino-0.0.12.tgz"` → 复制 tgz 到 example,以 `file:./rnoh-testerino-0.0.12.tgz` 引用
|
|
109
|
+
- `@react-native-ohos/*` → `"http://<registry>/<pkg>/-/<pkg>-<version>.tgz"` 或 `"file:../<xxx>.har"` → 按相同方式写入
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 3. 迁移流程细节
|
|
114
|
+
|
|
115
|
+
### 3.1 迁移前检查
|
|
116
|
+
|
|
117
|
+
| 检查项 | 通过条件 | 失败处理 |
|
|
118
|
+
|--------|---------|---------|
|
|
119
|
+
| `demoPath` 存在 | 目录可访问 | 报错终止,提示用户重新提供 |
|
|
120
|
+
| `targetExampleSrc` 存在 | 目录可访问 | 引导用户先执行 `rn-lib-add-example` 创建模板 |
|
|
121
|
+
| `targetExampleSrc` 可写 | 有写权限 | 报错并终止 |
|
|
122
|
+
| 目标已有同名文件 | 列出冲突文件 | **保留目标版本**,demo 版本不写入(`--ignore-existing`),报告中标注冲突项供人工确认 |
|
|
123
|
+
|
|
124
|
+
### 3.2 --clean 选项
|
|
125
|
+
|
|
126
|
+
`--clean` 启用时,迁移前清空 `targetExampleSrc`:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# 脚本行为
|
|
130
|
+
rm -rf <targetExampleSrc>/*
|
|
131
|
+
# 然后复制 demo 内容
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
> ⚠️ `--clean` **必须**由用户明确同意。Agent 不得自动启用。**默认模式为增量添加(`--ignore-existing`),不覆盖已有文件**。建议保留通用组件 `Navigation.tsx`(若 demo 仍使用)——脚本默认不清除 `components/Navigation.tsx`,可通过 `--clean-all` 强制全清。
|
|
135
|
+
|
|
136
|
+
### 3.3 默认排除项
|
|
137
|
+
|
|
138
|
+
`port-demo.sh` 默认排除以下目录/文件:
|
|
139
|
+
|
|
140
|
+
| 排除项 | 原因 |
|
|
141
|
+
|--------|------|
|
|
142
|
+
| `node_modules/` | demo 自身的依赖,example 会重新 install |
|
|
143
|
+
| `build/` | 构建产物 |
|
|
144
|
+
| `__tests__/` | demo 自带的测试,example 有自己的 testerino 注册 |
|
|
145
|
+
| `.cxx/` / `oh_modules/` | 鸿蒙构建产物 |
|
|
146
|
+
| `.DS_Store` | macOS 垃圾文件 |
|
|
147
|
+
| `*.log` | 日志文件 |
|
|
148
|
+
|
|
149
|
+
可通过 `--exclude` 参数追加自定义排除项。
|
|
150
|
+
|
|
151
|
+
### 3.4 rsync 复制
|
|
152
|
+
|
|
153
|
+
使用 `rsync -a --ignore-existing` 保留文件元数据(mtime、权限),**仅添加目标不存在的文件,不覆盖已有文件**:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
rsync -a --ignore-existing \
|
|
157
|
+
--exclude 'node_modules/' \
|
|
158
|
+
--exclude 'build/' \
|
|
159
|
+
--exclude '__tests__/' \
|
|
160
|
+
--exclude '.cxx/' \
|
|
161
|
+
--exclude 'oh_modules/' \
|
|
162
|
+
--exclude '.DS_Store' \
|
|
163
|
+
--exclude '*.log' \
|
|
164
|
+
"<demoPath>/" "<targetExampleSrc>/"
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
> 注意末尾 `/`:`<demoPath>/` 表示复制目录内容,`<demoPath>`(无 `/`)会复制目录本身。
|
|
168
|
+
>
|
|
169
|
+
> `--ignore-existing` 确保目标已有文件保留不动,冲突文件在脚本输出中列出供 Agent 写入报告。
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## 4. 路径修正检查清单
|
|
174
|
+
|
|
175
|
+
迁移完成后,**逐文件**检查以下内容(使用 `Edit` 工具)。
|
|
176
|
+
|
|
177
|
+
> ⚠️ **仅修正本次新增的文件**:如果某文件是目标已有的(冲突保留项),**不修改它**,仅在报告中标注需人工处理。
|
|
178
|
+
|
|
179
|
+
### 4.1 相对路径修正
|
|
180
|
+
|
|
181
|
+
| 文件 | 检查内容 | 修正规则 |
|
|
182
|
+
|------|---------|---------|
|
|
183
|
+
| `tests/index.tsx` | 引用 demo 子目录的路径 | `./xxx` → `../xxx`(tests/ 在 src/tests/ 下,引用上级) |
|
|
184
|
+
| `tests/*.tsx` | 同上 | 同上 |
|
|
185
|
+
| 任何子目录文件 | 引用其他子目录 | 确保相对路径从 `example/src/` 起算 |
|
|
186
|
+
|
|
187
|
+
**示例**:
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
// ❌ 迁移前(rnt demo 内 tests/index.tsx)
|
|
191
|
+
import { CameraDemo } from './camera/CameraDemo';
|
|
192
|
+
import { Navigation } from './components/Navigation';
|
|
193
|
+
|
|
194
|
+
// ✅ 迁移后(example/src/tests/index.tsx)
|
|
195
|
+
import { CameraDemo } from '../camera/CameraDemo';
|
|
196
|
+
import { Navigation } from '../components/Navigation';
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### 4.2 入口文件对齐与接入
|
|
200
|
+
|
|
201
|
+
| 文件 | 检查内容 |
|
|
202
|
+
|------|---------|
|
|
203
|
+
| `App.tsx`(可在嵌套子目录如 `testCase/App.tsx`) | `displayName` / `title` 与 demo 名称一致 |
|
|
204
|
+
| `index.tsx`(根级) | 是否已引用 demo 入口;若未引用,re-export demo 入口 |
|
|
205
|
+
| `Test/index.tsx` 或 `tests/index.tsx` | testerino 注册的组件名与 `App.displayName` 一致 |
|
|
206
|
+
|
|
207
|
+
**入口接入检查**:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# 确认 index.tsx 是否引用了 demo 入口(testCase/App, demo/App, ./App 等)
|
|
211
|
+
grep -l "testCase/App\|demo/App\|./App" example/src/index.tsx
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
若未引用,**仅在 `index.tsx` 是本次新增文件时**才更新为 re-export;若 `index.tsx` 是目标已有文件,不覆盖,在报告中标注「入口未接入,需人工处理」:
|
|
215
|
+
|
|
216
|
+
```tsx
|
|
217
|
+
// index.tsx — 更新为 re-export demo 入口(仅当 index.tsx 是本次新增文件时)
|
|
218
|
+
export {
|
|
219
|
+
default,
|
|
220
|
+
displayName,
|
|
221
|
+
framework,
|
|
222
|
+
category,
|
|
223
|
+
title,
|
|
224
|
+
documentationURL,
|
|
225
|
+
description,
|
|
226
|
+
examples,
|
|
227
|
+
} from './testCase/App';
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### 4.3 Navigation.tsx 硬编码标题修正
|
|
231
|
+
|
|
232
|
+
`Navigation.tsx`(或类似共享组件)从 rnt 复制后可能包含**其他库的硬编码标题**。
|
|
233
|
+
|
|
234
|
+
**检测**:`analyze-demo-deps.cjs` 的 `hardcodedTitles` 字段列出所有匹配 `RN <Xxx> (Capi )?Tester` 的文本。
|
|
235
|
+
|
|
236
|
+
**修正**(**仅针对本次新增的文件**,目标已有文件不修改,在报告中标注):
|
|
237
|
+
|
|
238
|
+
```tsx
|
|
239
|
+
// ❌ 迁移前(遗留的 Svg 库标题)
|
|
240
|
+
<Text>RN Svg Capi Tester</Text>
|
|
241
|
+
|
|
242
|
+
// ✅ 迁移后(替换为目标库 alias,如 react-native-pdf → Pdf)
|
|
243
|
+
<Text>RN Pdf Tester</Text>
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### 4.4 目标库引用对齐
|
|
247
|
+
|
|
248
|
+
确认 demo 中目标库的引用方式与 example 配置一致:
|
|
249
|
+
|
|
250
|
+
| demo 引用方式 | example 需配置 |
|
|
251
|
+
|--------------|---------------|
|
|
252
|
+
| `import { X } from '<alias>'` | `metro.config.js` 的 `extraNodeModules['<alias>']` 指向 `node_modules/<ohPackageName>` |
|
|
253
|
+
| `import { X } from '<packageName>'` | `tsconfig.json` 的 `paths['<packageName>']` 指向 `./node_modules/<ohPackageName>` |
|
|
254
|
+
| `import { X } from '<packageName>/src/internal'` | 列入「待人工确认」,不自动改写 |
|
|
255
|
+
|
|
256
|
+
> 引用方式对齐的最终写入由 `rn-lib-add-example` 完成。本 SKILL 只检查并在报告中标注不一致项。
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## 5. 迁移后自检
|
|
261
|
+
|
|
262
|
+
迁移完成后,执行以下自检(不需运行 `npm install`,仅静态检查):
|
|
263
|
+
|
|
264
|
+
| 检查项 | 方法 | 通过标准 |
|
|
265
|
+
|--------|------|---------|
|
|
266
|
+
| 文件完整性 | 对比 `demoPath` 与 `targetExampleSrc` 文件清单 | **本次新增文件**全部迁移到位(冲突文件保留目标版本,不计入缺失) |
|
|
267
|
+
| 入口文件存在 | `find example/src -name "App.tsx" -o -name "index.tsx"` | 两个文件都存在(可嵌套) |
|
|
268
|
+
| index.tsx 接入 | `grep "testCase/App\|demo/App\|./App" example/src/index.tsx` | index.tsx 引用 demo 入口(若 index.tsx 为已有文件未接入,标注为待人工确认) |
|
|
269
|
+
| 相对路径有效 | grep `from '\./` 在子目录下 | 无错误的同级引用(仅检查本次新增文件) |
|
|
270
|
+
| 目标库引用一致 | grep `import.*from.*'<alias>\|<packageName>'` | 引用方式与 example 配置一致(仅检查本次新增文件) |
|
|
271
|
+
| 无硬编码标题 | grep `RN.*Tester` 在 Navigation.tsx 等 | 无其他库的遗留标题(仅本次新增文件已修正;已有文件标注待人工处理) |
|
|
272
|
+
| 无残留排除项 | `ls example/src/node_modules` 等 | 不存在(应被排除) |
|
|
273
|
+
| **外部依赖已声明** | 对比 `externalDeps` 与 `example/package.json` | 所有外部依赖已在 dependencies/devDependencies 中声明(Phase 4.1) |
|
|
274
|
+
| **无孤立文件** | 对比迁移文件列表与 index.tsx demos 数组 | 所有有 export 的组件都被入口直接/间接引用(Phase 6.6) |
|
|
275
|
+
| **菜单可滚动** | 检查 demos 条目数与菜单容器类型 | 条目 > 5 时菜单容器为 ScrollView(Phase 6.7) |
|
|
276
|
+
| **原有 App.tsx 可访问** | 检查 index.tsx 是否包含 OriginalApp 菜单项 | 原有 demo 入口未丢失(Phase 6.8) |
|
|
277
|
+
| **入口链路完整** | index.js → src/index.tsx → demos → 各组件 → ./demo/ | 全链路可导入(Phase 6.9) |
|
|
278
|
+
| **build-profile 无越界** | 检查 modules[].srcPath 是否以 ../ 开头 | 所有路径在工程内(Phase 5.1) |
|
|
279
|
+
| **.har 路径有效** | 逐一 ls 验证 oh-package.json5 中的 file: 引用 | 所有 .har 文件存在(Phase 5.2) |
|
|
280
|
+
|
|
281
|
+
> 自检脚本由 Agent 串联执行,结果写入迁移报告。
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## 6. 构建前置检查
|
|
286
|
+
|
|
287
|
+
迁移完成后、执行编译前,必须确认以下构建前置条件已满足:
|
|
288
|
+
|
|
289
|
+
### 6.1 build-profile.json5 模块路径越界
|
|
290
|
+
|
|
291
|
+
`example/harmony/build-profile.json5` 与 `build-profile.template.json5` 中的 `modules[].srcPath` **不可**以 `../` 开头(越出工程根目录)。
|
|
292
|
+
|
|
293
|
+
**典型问题**:库的源码模块在 `libPath/harmony/safe_area/`,build-profile 引用为 `../../harmony/safe_area` → hvigor 报错。
|
|
294
|
+
|
|
295
|
+
**修正**:
|
|
296
|
+
1. `cp -R <libPath>/harmony/<module> example/harmony/<module>`
|
|
297
|
+
2. 修改 `srcPath` 为 `./<module>`
|
|
298
|
+
3. 修正被复制模块的 `oh-package.json5` 中 `.har` 路径
|
|
299
|
+
|
|
300
|
+
> 符号链接不可行:hvigor 不跟随 symlink。
|
|
301
|
+
|
|
302
|
+
### 6.2 .har 文件路径验证
|
|
303
|
+
|
|
304
|
+
被复制模块的 `oh-package.json5` 中 `file:` 引用的 `.har` 文件路径可能因目录层级变化而失效。
|
|
305
|
+
|
|
306
|
+
**典型问题**:原始路径 `file:../../node_modules/@react-native-oh/react-native-harmony/harmony/react_native_openharmony.har`(多一层 `harmony/`),复制后应为 `file:../../node_modules/@react-native-oh/react-native-harmony/react_native_openharmony.har`。
|
|
307
|
+
|
|
308
|
+
**验证方法**:逐一 `ls -la` 检查每个 `file:` 引用的文件是否存在。
|
|
309
|
+
|
|
310
|
+
### 6.3 编译验证步骤
|
|
311
|
+
|
|
312
|
+
确认前置检查通过后,按以下顺序执行编译:
|
|
313
|
+
|
|
314
|
+
```bash
|
|
315
|
+
# 1. 安装 JS 依赖
|
|
316
|
+
cd example && npm i --legacy-peer-deps
|
|
317
|
+
|
|
318
|
+
# 2. 安装鸿蒙原生依赖
|
|
319
|
+
cd harmony && ohpm install
|
|
320
|
+
|
|
321
|
+
# 3. 生成 JS bundle
|
|
322
|
+
cd .. && npm run dev
|
|
323
|
+
|
|
324
|
+
# 4. 编译鸿蒙工程
|
|
325
|
+
cd harmony && devecocli build
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
> `npm i` 只装 JS 依赖,`ohpm install` 才装原生 .har 依赖,两者都不可省略。
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
## 7. 与 rn-lib-add-example 的衔接
|
|
333
|
+
|
|
334
|
+
本 SKILL 完成后,迁移报告中的以下内容会被 `rn-lib-add-example` 消费:
|
|
335
|
+
|
|
336
|
+
| 报告章节 | 下游用途 |
|
|
337
|
+
|----------|---------|
|
|
338
|
+
| 依赖增量清单 | 写入 `example/package.json` 的 `dependencies` |
|
|
339
|
+
| 目标库引用方式 | 配置 `metro.config.js` 的 `extraNodeModules` |
|
|
340
|
+
| 入口文件 displayName | 配置 `App.tsx` 与 `Test/index.tsx` 注册 |
|
|
341
|
+
| 版本一致性检测结果 | 决定是否需要更新 example/package.json 的 react-native / react-native-harmony 版本 |
|
|
342
|
+
| 待人工确认项 | 由用户或 Agent 在壳层适配阶段决策 |
|
|
343
|
+
| 原生代码标注 | 决定是否需要 CMake / RNPackagesFactory 适配 |
|
|
344
|
+
|
|
345
|
+
> 迁移报告是本 SKILL 的**唯一交付物**,下游 SKILL 通过读取报告获取所需信息。
|