@ohos-cpf/3rdloop 0.0.8 → 0.0.9

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.
Files changed (219) hide show
  1. package/README.md +25 -0
  2. package/lib/cli.js +22 -5
  3. package/lib/doctor.js +111 -10
  4. package/lib/mcp.js +498 -0
  5. package/package.json +6 -2
  6. package/vendor/Archive/data/.index/meta.json +7 -0
  7. package/vendor/Archive/data/.index/search.db +0 -0
  8. package/vendor/Archive/data/docs/experiences/arkts-check-tool-pitfalls-baseline-comparison.md +13 -0
  9. package/vendor/Archive/data/docs/experiences/arkts-deep-path-import-recognition.md +31 -0
  10. package/vendor/Archive/data/docs/experiences/arkts-demo-coverage-entry-file-case-mismatch.md +25 -0
  11. package/vendor/Archive/data/docs/experiences/arkts-demo-coverage-import-trailing-slash.md +20 -0
  12. package/vendor/Archive/data/docs/experiences/arkts-library-source-files-may-be-ts.md +18 -0
  13. package/vendor/Archive/data/docs/experiences/arkts-typedarray-buffer-interface-cast-compile-fixes.md +36 -0
  14. package/vendor/Archive/data/docs/experiences/arkts-xts-compile-error-clustering-fix.md +24 -0
  15. package/vendor/Archive/data/docs/experiences/arkts-xts-doc-expected-value-runtime-probe.md +35 -0
  16. package/vendor/Archive/data/docs/experiences/arkts-xts-fixture-rawfile-testability-injection.md +33 -0
  17. package/vendor/Archive/data/docs/experiences/code-linter-chinese-comment-false-positive.md +16 -0
  18. package/vendor/Archive/data/docs/experiences/esobject-new-expression-variable-tracking.md +33 -0
  19. package/vendor/Archive/data/docs/experiences/filesystem-case-sensitivity-module-resolution.md +31 -0
  20. package/vendor/Archive/data/docs/experiences/gitcode-clone-redirect-warning-normal.md +13 -0
  21. package/vendor/Archive/data/docs/experiences/kn_msgvq1w585ec8319.md +77 -0
  22. package/vendor/Archive/data/docs/experiences/kn_msovnm6rd46de72c.md +98 -0
  23. package/vendor/Archive/data/docs/experiences/kn_mspt8vntfe708576.md +87 -0
  24. package/vendor/Archive/data/docs/experiences/kn_mspu1ei77adbbb48.md +133 -0
  25. package/vendor/Archive/data/docs/experiences/kn_mspubgak8d30bfce.md +128 -0
  26. package/vendor/Archive/data/docs/experiences/kn_mspug2de3cb1f7c3.md +115 -0
  27. package/vendor/Archive/data/docs/experiences/kn_skill_opt_001.md +38 -0
  28. package/vendor/Archive/data/docs/experiences/loop-artifacts-verification-evidence-triangle.md +19 -0
  29. package/vendor/Archive/data/docs/experiences/macos-bash-replace-build-ps1.md +19 -0
  30. package/vendor/Archive/data/docs/experiences/macos-bsd-diff-q-illegal-option.md +15 -0
  31. package/vendor/Archive/data/docs/experiences/migrate-cjs-compatible-api-version-map-limit.md +17 -0
  32. package/vendor/Archive/data/docs/experiences/mp3agic-arkts-library-behavior-quirks.md +21 -0
  33. package/vendor/Archive/data/docs/experiences/ohos-face-detection-scan-api-mapping.md +15 -0
  34. package/vendor/Archive/data/docs/experiences/pr-metadata-and-diff-integrity-verification.md +12 -0
  35. package/vendor/Archive/data/docs/experiences/rn-coverage-index-signature-pseudo-member-false-negative.md +32 -0
  36. package/vendor/Archive/data/docs/experiences/rn-memory-check-severity-calibration.md +21 -0
  37. package/vendor/Archive/data/docs/experiences/rn-platform-specific-api-exclusion-evidence.md +24 -0
  38. package/vendor/Archive/data/docs/experiences/rn-upstream-version-diff-pitfalls.md +17 -0
  39. package/vendor/Archive/data/docs/experiences/rn-version-gap-risk-rating-rules.md +13 -0
  40. package/vendor/Archive/data/docs/experiences/rn-view-lib-native-contract-diff-fabric-spec.md +16 -0
  41. package/vendor/Archive/data/docs/experiences/rnoh-adapter-package-version-field-semantics.md +18 -0
  42. package/vendor/Archive/data/docs/experiences/rnoh-arkts-sqlite-rows-array-format.md +18 -0
  43. package/vendor/Archive/data/docs/experiences/rnoh-dependency-residue-scan-strategy.md +18 -0
  44. package/vendor/Archive/data/docs/experiences/rnoh-example-local-lib-dep-use-tgz.md +53 -0
  45. package/vendor/Archive/data/docs/experiences/rnoh-example-prereserve-rntesterlist.md +17 -0
  46. package/vendor/Archive/data/docs/experiences/rnoh-example-template-compatiblesdkversion-upgrade.md +29 -0
  47. package/vendor/Archive/data/docs/experiences/rnoh-example-turbomodule-shell-adaptation-checklist.md +41 -0
  48. package/vendor/Archive/data/docs/experiences/rnoh-mcp-build-project-tool-risk.md +18 -0
  49. package/vendor/Archive/data/docs/experiences/rnoh-npm-devdependencies-version-precheck.md +29 -0
  50. package/vendor/Archive/data/docs/experiences/rnoh-repo-baseline-version-verification.md +13 -0
  51. package/vendor/Archive/data/docs/experiences/rnoh-repo-upstream-directory-mapping.md +18 -0
  52. package/vendor/Archive/data/docs/experiences/rnoh-stateless-library-zero-leak-verification.md +31 -0
  53. package/vendor/Archive/data/docs/experiences/rnoh-template-npmrc-credential-removal.md +15 -0
  54. package/vendor/Archive/data/docs/experiences/rnoh-turbomodule-codegen-wiring-verification.md +19 -0
  55. package/vendor/Archive/data/docs/experiences/rnoh-turbomodule-cpp-methodmap-compatibility-check.md +20 -0
  56. package/vendor/Archive/data/docs/experiences/scenario-doc-vs-source-signature-diff-four-patterns.md +24 -0
  57. package/vendor/Archive/data/docs/experiences/static-analysis-grep-cross-validation.md +29 -0
  58. package/vendor/Archive/demo.js +489 -0
  59. package/vendor/Archive/index.js +43 -0
  60. package/vendor/Archive/package.json +16 -0
  61. package/vendor/Archive/src/constants.js +83 -0
  62. package/vendor/Archive/src/data/stopwords.txt +110 -0
  63. package/vendor/Archive/src/data/synonyms.json +25 -0
  64. package/vendor/Archive/src/data/terms.txt +59 -0
  65. package/vendor/Archive/src/db/sqlite-backend.js +312 -0
  66. package/vendor/Archive/src/db/sqlite-schema.js +64 -0
  67. package/vendor/Archive/src/engine.js +501 -0
  68. package/vendor/Archive/src/index/index-manager.js +203 -0
  69. package/vendor/Archive/src/index/index-state.js +94 -0
  70. package/vendor/Archive/src/index/search-text-builder.js +106 -0
  71. package/vendor/Archive/src/index.js +22 -0
  72. package/vendor/Archive/src/parser/api-identifiers.js +121 -0
  73. package/vendor/Archive/src/parser/api-suffixes.js +48 -0
  74. package/vendor/Archive/src/parser/heading-normalize.js +40 -0
  75. package/vendor/Archive/src/parser/markdown-splitter.js +215 -0
  76. package/vendor/Archive/src/search/catalog-routing.js +87 -0
  77. package/vendor/Archive/src/search/fts-search.js +289 -0
  78. package/vendor/Archive/src/search/query-normalizer.js +159 -0
  79. package/vendor/Archive/src/search/query-rewriter.js +72 -0
  80. package/vendor/Archive/src/search/search-engine.js +72 -0
  81. package/vendor/Archive/src/search/snippet.js +64 -0
  82. package/vendor/Archive/src/store/dir-store.js +103 -0
  83. package/vendor/Archive/src/store/doc-store.js +36 -0
  84. package/vendor/Archive/src/tokenizer/lexicon.js +151 -0
  85. package/vendor/Archive/src/tokenizer/tokenizer.js +167 -0
  86. package/vendor/Archive/src/types.js +86 -0
  87. package/vendor/Archive/src/utils/hash.js +16 -0
  88. package/vendor/Archive/src/utils/lock.js +73 -0
  89. package/vendor/Archive/src/utils/path-safety.js +96 -0
  90. package/vendor/Archive/src/utils/paths.js +39 -0
  91. package/vendor/BadCase/rn/INDEX.md +127 -0
  92. package/vendor/BadCase/rn/cases/KI-001-webview/350/247/206/351/242/221/346/227/240/346/263/225/346/250/252/345/261/217.md +52 -0
  93. package/vendor/BadCase/rn/cases/KI-002-fastImage/347/203/255/346/233/264/346/226/260/345/233/276/347/211/207/345/244/261/350/264/245.md +37 -0
  94. package/vendor/BadCase/rn/cases/KI-003-wechat/347/274/251/347/225/245/345/233/276/346/234/254/345/234/260/345/233/276/347/211/207.md +62 -0
  95. package/vendor/BadCase/rn/cases/KI-004-wechat/345/233/236/350/260/203/346/227/266/345/272/217.md +47 -0
  96. package/vendor/BadCase/rn/cases/KI-005-geolocation/345/257/274/345/205/245/350/267/257/345/276/204/345/220/216/347/274/200.md +31 -0
  97. package/vendor/BadCase/rn/cases/KI-006-SmartRefreshLayout/346/231/272/350/203/275/346/214/207/351/222/210/345/264/251/346/272/203.md +55 -0
  98. package/vendor/BadCase/rn/cases/KI-007-orientation-locker/344/274/240/346/204/237/345/231/250/345/210/235/345/247/213/345/214/226.md +58 -0
  99. package/vendor/BadCase/rn/cases/KI-008-orientation-locker/344/274/240/346/204/237/345/231/250/345/274/225/347/224/250/350/256/241/346/225/260.md +47 -0
  100. package/vendor/BadCase/rn/cases/KI-009-pager-view/345/265/214/345/245/227/346/273/221/345/212/250.md +38 -0
  101. package/vendor/BadCase/rn/cases/KI-010-screens/346/211/213/345/212/277/345/206/262/347/252/201.md +48 -0
  102. package/vendor/BadCase/rn/cases/KI-011-spring-scrollview/346/211/213/345/212/277/351/207/215/345/244/215/347/273/221/345/256/232.md +49 -0
  103. package/vendor/BadCase/rn/cases/KI-012-qr-camera/346/250/252/345/261/217/351/200/202/351/205/215.md +59 -0
  104. package/vendor/BadCase/rn/cases/KI-013-webview/346/267/261/350/211/262/346/250/241/345/274/217/350/203/214/346/231/257/350/211/262.md +37 -0
  105. package/vendor/BadCase/rn/cases/KI-014-amap-geolocation/345/233/236/350/260/203/347/274/272/345/244/261.md +42 -0
  106. package/vendor/BadCase/rn/cases/KI-015-reanimated/350/277/220/350/241/214/346/227/266/346/236/220/346/236/204/345/264/251/346/272/203.md +54 -0
  107. package/vendor/BadCase/rn/cases/KI-016-fs/346/226/207/344/273/266/350/257/273/345/217/226/347/274/226/347/240/201.md +58 -0
  108. package/vendor/BadCase/rn/cases/KI-017-blob-util/345/217/202/346/225/260/347/274/226/347/240/201/351/224/231/350/257/257.md +39 -0
  109. package/vendor/BadCase/rn/cases/KI-018-modal/345/274/271/347/252/227/351/227/252/347/203/201.md +53 -0
  110. package/vendor/BadCase/rn/cases/KI-019-code-push/351/207/215/345/220/257/351/200/273/350/276/221/345/244/261/346/225/210.md +79 -0
  111. package/vendor/BadCase/rn/cases/KI-020-netinfo/346/225/217/346/204/237/344/277/241/346/201/257/346/263/204/351/234/262.md +60 -0
  112. package/vendor/BadCase/rn/cases/KI-021-video/346/234/254/345/234/260/350/247/206/351/242/221/346/222/255/346/224/276/345/274/202/345/270/270.md +79 -0
  113. package/vendor/BadCase/rn/cases/KI-022-audio-recorder-player/346/236/232/344/270/276/347/274/272/345/244/261.md +38 -0
  114. package/vendor/BadCase/rn/cases/KI-023-svg/346/270/220/345/217/230/347/273/247/346/211/277/345/244/261/346/225/210.md +62 -0
  115. package/vendor/BadCase/rn/generalization-log.md +55 -0
  116. package/vendor/BadCase/rn/pr-info/rntpc_react-native-SmartRefreshLayout-32.json +328 -0
  117. package/vendor/BadCase/rn/pr-info/rntpc_react-native-SmartRefreshLayout-32.md +382 -0
  118. package/vendor/BadCase/rn/pr-info/rntpc_react-native-amap-geolocation-27.json +1351 -0
  119. package/vendor/BadCase/rn/pr-info/rntpc_react-native-amap-geolocation-27.md +1176 -0
  120. package/vendor/BadCase/rn/pr-info/rntpc_react-native-audio-recorder-player-22.json +538 -0
  121. package/vendor/BadCase/rn/pr-info/rntpc_react-native-audio-recorder-player-22.md +1488 -0
  122. package/vendor/BadCase/rn/pr-info/rntpc_react-native-blob-util-23.json +211 -0
  123. package/vendor/BadCase/rn/pr-info/rntpc_react-native-blob-util-23.md +35 -0
  124. package/vendor/BadCase/rn/pr-info/rntpc_react-native-code-push-17.json +2048 -0
  125. package/vendor/BadCase/rn/pr-info/rntpc_react-native-code-push-17.md +3866 -0
  126. package/vendor/BadCase/rn/pr-info/rntpc_react-native-fast-image-102.json +198 -0
  127. package/vendor/BadCase/rn/pr-info/rntpc_react-native-fast-image-102.md +40 -0
  128. package/vendor/BadCase/rn/pr-info/rntpc_react-native-fs-38.json +751 -0
  129. package/vendor/BadCase/rn/pr-info/rntpc_react-native-fs-38.md +883 -0
  130. package/vendor/BadCase/rn/pr-info/rntpc_react-native-geolocation-24.json +1544 -0
  131. package/vendor/BadCase/rn/pr-info/rntpc_react-native-geolocation-24.md +2598 -0
  132. package/vendor/BadCase/rn/pr-info/rntpc_react-native-modal-20.json +246 -0
  133. package/vendor/BadCase/rn/pr-info/rntpc_react-native-modal-20.md +554 -0
  134. package/vendor/BadCase/rn/pr-info/rntpc_react-native-netinfo-31.json +211 -0
  135. package/vendor/BadCase/rn/pr-info/rntpc_react-native-netinfo-31.md +54 -0
  136. package/vendor/BadCase/rn/pr-info/rntpc_react-native-orientation-locker-45.json +1626 -0
  137. package/vendor/BadCase/rn/pr-info/rntpc_react-native-orientation-locker-45.md +2213 -0
  138. package/vendor/BadCase/rn/pr-info/rntpc_react-native-orientation-locker-51.json +208 -0
  139. package/vendor/BadCase/rn/pr-info/rntpc_react-native-orientation-locker-51.md +77 -0
  140. package/vendor/BadCase/rn/pr-info/rntpc_react-native-pager-view-32.json +377 -0
  141. package/vendor/BadCase/rn/pr-info/rntpc_react-native-pager-view-32.md +174 -0
  142. package/vendor/BadCase/rn/pr-info/rntpc_react-native-qr-decode-image-camera-37.json +232 -0
  143. package/vendor/BadCase/rn/pr-info/rntpc_react-native-qr-decode-image-camera-37.md +194 -0
  144. package/vendor/BadCase/rn/pr-info/rntpc_react-native-reanimated-82.json +198 -0
  145. package/vendor/BadCase/rn/pr-info/rntpc_react-native-reanimated-82.md +67 -0
  146. package/vendor/BadCase/rn/pr-info/rntpc_react-native-screens-87.json +198 -0
  147. package/vendor/BadCase/rn/pr-info/rntpc_react-native-screens-87.md +38 -0
  148. package/vendor/BadCase/rn/pr-info/rntpc_react-native-screens-93.json +208 -0
  149. package/vendor/BadCase/rn/pr-info/rntpc_react-native-screens-93.md +34 -0
  150. package/vendor/BadCase/rn/pr-info/rntpc_react-native-spring-scrollview-38.json +222 -0
  151. package/vendor/BadCase/rn/pr-info/rntpc_react-native-spring-scrollview-38.md +56 -0
  152. package/vendor/BadCase/rn/pr-info/rntpc_react-native-svg-117.json +463 -0
  153. package/vendor/BadCase/rn/pr-info/rntpc_react-native-svg-117.md +383 -0
  154. package/vendor/BadCase/rn/pr-info/rntpc_react-native-video-66.json +464 -0
  155. package/vendor/BadCase/rn/pr-info/rntpc_react-native-video-66.md +565 -0
  156. package/vendor/BadCase/rn/pr-info/rntpc_react-native-webview-112.json +198 -0
  157. package/vendor/BadCase/rn/pr-info/rntpc_react-native-webview-112.md +47 -0
  158. package/vendor/BadCase/rn/pr-info/rntpc_react-native-webview-121.json +232 -0
  159. package/vendor/BadCase/rn/pr-info/rntpc_react-native-webview-121.md +422 -0
  160. package/vendor/BadCase/rn/pr-info/rntpc_react-native-wechat-lib-15.json +295 -0
  161. package/vendor/BadCase/rn/pr-info/rntpc_react-native-wechat-lib-15.md +1038 -0
  162. package/vendor/BadCase/rn/rules/R-01-/345/205/250/345/261/217/347/252/227/345/217/243/347/212/266/346/200/201/347/256/241/347/220/206/345/256/214/346/225/264/346/200/247.md +20 -0
  163. package/vendor/BadCase/rn/rules/R-02-/350/265/204/346/272/220URI/345/275/242/346/200/201/345/210/206/346/224/257/350/246/206/347/233/226.md +21 -0
  164. package/vendor/BadCase/rn/rules/R-03-/351/231/204/345/261/236/346/223/215/344/275/234/345/244/261/350/264/245/351/230/273/346/226/255/344/270/273/346/265/201/347/250/213.md +20 -0
  165. package/vendor/BadCase/rn/rules/R-04-/345/274/202/346/255/245/345/233/236/350/260/203/346/263/250/345/206/214/346/227/266/345/272/217.md +20 -0
  166. package/vendor/BadCase/rn/rules/R-05-/346/250/241/345/235/227/345/257/274/345/205/245/350/267/257/345/276/204/350/247/204/350/214/203.md +19 -0
  167. package/vendor/BadCase/rn/rules/R-06-/344/274/240/346/204/237/345/231/250/347/241/254/344/273/266/346/235/203/351/231/220/346/214/211/351/234/200/350/216/267/345/217/226.md +21 -0
  168. package/vendor/BadCase/rn/rules/R-07-/346/231/272/350/203/275/346/214/207/351/222/210/347/224/237/345/221/275/345/221/250/346/234/237/347/256/241/347/220/206.md +20 -0
  169. package/vendor/BadCase/rn/rules/R-08-/346/211/213/345/212/277/344/272/213/344/273/266/346/263/250/345/206/214/344/270/216/345/206/262/347/252/201/345/244/204/347/220/206.md +22 -0
  170. package/vendor/BadCase/rn/rules/R-09-/346/250/252/347/253/226/345/261/217/345/244/232/345/275/242/346/200/201/345/270/203/345/261/200/351/200/202/351/205/215.md +20 -0
  171. package/vendor/BadCase/rn/rules/R-10-/346/267/261/350/211/262/346/250/241/345/274/217/344/270/273/351/242/230/351/242/234/350/211/262/351/200/202/351/205/215.md +19 -0
  172. package/vendor/BadCase/rn/rules/R-11-/346/216/245/345/217/243/345/233/236/350/260/203/345/256/236/347/216/260/345/256/214/346/225/264/346/200/247.md +20 -0
  173. package/vendor/BadCase/rn/rules/R-12-/345/216/237/347/224/237/350/277/220/350/241/214/346/227/266/350/265/204/346/272/220/346/236/220/346/236/204/346/227/266/345/272/217.md +20 -0
  174. package/vendor/BadCase/rn/rules/R-13-/346/226/207/344/273/266/346/225/260/346/215/256/347/274/226/347/240/201/344/270/216/346/240/274/345/274/217/345/205/274/345/256/271.md +21 -0
  175. package/vendor/BadCase/rn/rules/R-14-/345/212/250/347/224/273/345/210/235/345/247/213/345/214/226/346/227/266/345/272/217/344/270/216/347/212/266/346/200/201/345/220/214/346/255/245.md +20 -0
  176. package/vendor/BadCase/rn/rules/R-15-/347/212/266/346/200/201/346/214/201/344/271/205/345/214/226/344/270/216/351/207/215/345/220/257/351/200/273/350/276/221/344/270/200/350/207/264/346/200/247.md +20 -0
  177. package/vendor/BadCase/rn/rules/R-16-/346/225/217/346/204/237/344/277/241/346/201/257/346/227/245/345/277/227/346/263/204/351/234/262.md +19 -0
  178. package/vendor/BadCase/rn/rules/R-17-/345/252/222/344/275/223/350/265/204/346/272/220/347/224/237/345/221/275/345/221/250/346/234/237/344/270/216/351/224/231/350/257/257/345/244/204/347/220/206.md +21 -0
  179. package/vendor/BadCase/rn/rules/R-18-/350/203/275/345/212/233/346/236/232/344/270/276/351/205/215/347/275/256/345/256/214/346/225/264/346/200/247.md +19 -0
  180. package/vendor/BadCase/rn/rules/R-19-/345/233/276/345/275/242/346/270/262/346/237/223/345/261/236/346/200/247/347/273/247/346/211/277/344/270/216/351/207/215/347/275/256.md +19 -0
  181. package/vendor/MCP/README.md +490 -0
  182. package/vendor/MCP/config.json +29 -0
  183. package/vendor/MCP/package.json +23 -0
  184. package/vendor/MCP/scripts/analyze-demo-coverage.cjs +1203 -0
  185. package/vendor/MCP/scripts/analyze-xts-coverage.cjs +1245 -0
  186. package/vendor/MCP/scripts/deveco_docs.js +247 -0
  187. package/vendor/MCP/scripts/extract-interfaces.cjs +1487 -0
  188. package/vendor/MCP/scripts/flutter-analyze-demo-coverage.cjs +666 -0
  189. package/vendor/MCP/scripts/flutter-analyze-xts-coverage.cjs +684 -0
  190. package/vendor/MCP/scripts/flutter-extract-interfaces.cjs +1251 -0
  191. package/vendor/MCP/scripts/flutter-render-spec-doc.cjs +351 -0
  192. package/vendor/MCP/scripts/render-spec-doc.cjs +347 -0
  193. package/vendor/MCP/scripts/rn-analyze-demo-coverage.cjs +645 -0
  194. package/vendor/MCP/scripts/rn-analyze-test-coverage.cjs +614 -0
  195. package/vendor/MCP/scripts/rn-extract-interfaces.cjs +1462 -0
  196. package/vendor/MCP/scripts/rn-render-spec-doc.cjs +327 -0
  197. package/vendor/MCP/scripts/rn-scan-exports.cjs +1336 -0
  198. package/vendor/MCP/src/client/MCPClientPool.js +220 -0
  199. package/vendor/MCP/src/config/ConfigLoader.js +189 -0
  200. package/vendor/MCP/src/executor/ScriptExecutor.js +110 -0
  201. package/vendor/MCP/src/gateway/Gateway.js +451 -0
  202. package/vendor/MCP/src/index.js +87 -0
  203. package/vendor/MCP/src/library/KBToolProvider.js +229 -0
  204. package/vendor/MCP/src/library/logger.js +60 -0
  205. package/vendor/MCP/src/registry/ScriptRegistry.js +238 -0
  206. package/vendor/MCP/src/registry/ToolRegistry.js +111 -0
  207. package/vendor/MCP/src/types.js +115 -0
  208. package/vendor/Server/Skills/arkts-library-test-coverage-check/references/MCP_TOOL_USAGE.md +4 -2
  209. package/vendor/Server/Skills/arkts-library-xts-coverage/SKILL.md +3 -3
  210. package/vendor/Server/Skills/knowledge-import/SKILL.md +1 -1
  211. package/vendor/Server/Skills/knowledge-import/references/MCP_TOOL_USAGE.md +12 -4
  212. package/vendor/Server/Skills/ohos-lib-pr-push/SKILL.md +5 -4
  213. package/vendor/Server/Skills/rn-library-issue-generalizer/SKILL.md +2 -2
  214. package/vendor/Server/Skills/rn-library-known-issue-check/SKILL.md +2 -2
  215. package/vendor/Server/Skills/rnoh-lib-demo-coverage/SKILL.md +1 -2
  216. package/vendor/Server/Skills/rnoh-lib-test-align/references/port-test-demo-guide.md +1 -1
  217. package/vendor/Server/Skills/rnoh-lib-xts-coverage/SKILL.md +1 -2
  218. package/vendor/Server/package.json +5 -1
  219. package/vendor/VERSION +3 -3
@@ -0,0 +1,96 @@
1
+ /**
2
+ * path-safety.js — 路径安全防护
3
+ *
4
+ * 职责:
5
+ * 1. 验证数据目录可访问且为目录。
6
+ * 2. 防止 documentId 路径穿越(禁止 .. 和绝对路径)。
7
+ * 3. 校验文件在沙箱内、非常规符号链接。
8
+ *
9
+ * 与存储层配合,确保所有文件操作限制在 dataRoot 之内。
10
+ */
11
+
12
+ import fs from 'node:fs';
13
+ import path from 'node:path';
14
+
15
+ /**
16
+ * 路径安全异常。
17
+ */
18
+ export class PathSafetyError extends Error {
19
+ constructor(message) {
20
+ super(message);
21
+ this.name = 'PathSafetyError';
22
+ }
23
+ }
24
+
25
+ export default class PathSafety {
26
+ /**
27
+ * @param {string} dataRoot 数据根目录
28
+ */
29
+ constructor(dataRoot) {
30
+ this.dataRoot = dataRoot;
31
+ }
32
+
33
+ /**
34
+ * 确保数据目录存在且为目录。
35
+ * @returns {Promise<void>}
36
+ */
37
+ async assertDataDirSafe() {
38
+ const realRoot = fs.realpathSync(this.dataRoot);
39
+ const stat = await fs.promises.stat(realRoot);
40
+ if (!stat.isDirectory()) {
41
+ throw new PathSafetyError('Data directory is not a directory.');
42
+ }
43
+ }
44
+
45
+ /**
46
+ * 确保目标路径位于数据目录内,返回规范化后的绝对路径。
47
+ * @param {string} target 相对 dataRoot 的路径
48
+ * @param {string} label 诊断标签
49
+ * @returns {string}
50
+ */
51
+ assertPathInside(target, label) {
52
+ const realTarget = path.resolve(this.dataRoot, target);
53
+ if (
54
+ realTarget !== this.dataRoot &&
55
+ !realTarget.startsWith(this.dataRoot + path.sep)
56
+ ) {
57
+ throw new PathSafetyError(`${label} resolves outside data directory.`);
58
+ }
59
+ return realTarget;
60
+ }
61
+
62
+ /**
63
+ * 校验文件存在且为常规文件(非符号链接越界)。
64
+ * 不存在时静默通过(交由调用方处理 ENOENT)。
65
+ * @param {string} filePath
66
+ */
67
+ assertRegularFile(filePath) {
68
+ try {
69
+ const stat = fs.statSync(filePath);
70
+ if (!stat.isFile()) {
71
+ throw new PathSafetyError('Path must be a regular file.');
72
+ }
73
+ const realPath = fs.realpathSync(filePath);
74
+ this.assertPathInside(realPath, 'file');
75
+ } catch (error) {
76
+ if (error instanceof PathSafetyError) throw error;
77
+ if (/** @type {NodeJS.ErrnoException} */ (error).code !== 'ENOENT') throw error;
78
+ }
79
+ }
80
+
81
+ /**
82
+ * 校验 documentId 合法性(防路径穿越)。
83
+ * @param {string} documentId
84
+ * @returns {string} 规范化后的 documentId
85
+ */
86
+ validateDocumentId(documentId) {
87
+ const normalized = documentId.replace(/\\/g, '/');
88
+ if (normalized.split('/').includes('..')) {
89
+ throw new PathSafetyError('Invalid document ID: path traversal detected.');
90
+ }
91
+ if (normalized.startsWith('/')) {
92
+ throw new PathSafetyError('Invalid document ID: absolute path not allowed.');
93
+ }
94
+ return normalized;
95
+ }
96
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * paths.js — 路径管理工具
3
+ *
4
+ * 集中计算 docs / .index / lock / meta 等运行时子路径,
5
+ * 保证全模块路径拼接一致。
6
+ */
7
+
8
+ import path from 'node:path';
9
+
10
+ /**
11
+ * 计算运行时各子目录/文件路径。
12
+ * @param {string} dataDir 数据根目录
13
+ * @returns {{
14
+ * dataDir: string,
15
+ * docsDir: string,
16
+ * indexDir: string,
17
+ * dbPath: string,
18
+ * metaPath: string,
19
+ * lockPath: string,
20
+ * termsPath: string,
21
+ * synonymsPath: string,
22
+ * stopwordsPath: string,
23
+ * }}
24
+ */
25
+ export function resolveRuntimePaths(dataDir) {
26
+ const docsDir = path.join(dataDir, 'docs');
27
+ const indexDir = path.join(dataDir, '.index');
28
+ return {
29
+ dataDir,
30
+ docsDir,
31
+ indexDir,
32
+ dbPath: path.join(indexDir, 'search.db'),
33
+ metaPath: path.join(indexDir, 'meta.json'),
34
+ lockPath: path.join(indexDir, 'write.lock'),
35
+ termsPath: path.join(indexDir, 'terms.txt'),
36
+ synonymsPath: path.join(indexDir, 'synonyms.json'),
37
+ stopwordsPath: path.join(indexDir, 'stopwords.txt'),
38
+ };
39
+ }
@@ -0,0 +1,127 @@
1
+ # RN 三方库鸿蒙化已知问题知识库 — 一级索引
2
+
3
+ > **分级结构**:本文件为一级索引(分类 + 索引),具体知识在二级文件中。
4
+ > **维护方式**:由 rn-library-issue-generalizer SKILL 产出草稿,人工审核后合入。
5
+ > **消费方式**:rn-library-known-issue-check SKILL 先读本索引预筛适用规则,再按需读取规则/案例文件。
6
+
7
+ ```
8
+ BadCase/rn/
9
+ ├── INDEX.md ← 一级:分类 + 索引(本文件)
10
+ ├── rules/ ← 二级:规则知识(检查的执行单元)
11
+ ├── cases/ ← 二级:案例知识(few-shot 参考 + 修复指引)
12
+ └── pr-info/ ← 案例原始 PR diff 证据材料
13
+ ```
14
+
15
+ **使用流程**(检视 Agent):
16
+ 1. 读本索引 → 按"预筛特征"筛选与当前库相关的规则
17
+ 2. 读 `rules/R-XX-*.md` → 获取检查点、错误/正确特征、案例索引
18
+ 3. 需要代码级 few-shot 参考时 → 读 `cases/KI-XXX-*.md`
19
+
20
+ ---
21
+
22
+ ## 一、规则分类索引
23
+
24
+ ### 媒体与窗口类
25
+
26
+ | 编号 | 规则名 | 严重级别 | 案例数 | 规则文件 |
27
+ |------|--------|----------|--------|----------|
28
+ | R-01 | 全屏/窗口状态管理完整性类 | high | 1 | [rules/R-01-全屏窗口状态管理完整性.md](rules/R-01-全屏窗口状态管理完整性.md) |
29
+ | R-09 | 横竖屏/多形态布局适配类 | medium | 1 | [rules/R-09-横竖屏多形态布局适配.md](rules/R-09-横竖屏多形态布局适配.md) |
30
+ | R-10 | 深色模式/主题颜色适配类 | medium | 1 | [rules/R-10-深色模式主题颜色适配.md](rules/R-10-深色模式主题颜色适配.md) |
31
+
32
+ ### 资源加载类
33
+
34
+ | 编号 | 规则名 | 严重级别 | 案例数 | 规则文件 |
35
+ |------|--------|----------|--------|----------|
36
+ | R-02 | 资源 URI 形态分支覆盖类 | high | 2 | [rules/R-02-资源URI形态分支覆盖.md](rules/R-02-资源URI形态分支覆盖.md) |
37
+ | R-13 | 文件/数据编码与格式兼容类 | high | 2 | [rules/R-13-文件数据编码与格式兼容.md](rules/R-13-文件数据编码与格式兼容.md) |
38
+ | R-17 | 媒体资源生命周期与错误处理类 | high | 1 | [rules/R-17-媒体资源生命周期与错误处理.md](rules/R-17-媒体资源生命周期与错误处理.md) |
39
+
40
+ ### 流程健壮性类
41
+
42
+ | 编号 | 规则名 | 严重级别 | 案例数 | 规则文件 |
43
+ |------|--------|----------|--------|----------|
44
+ | R-03 | 附属操作失败阻断主流程类 | high | 1 | [rules/R-03-附属操作失败阻断主流程.md](rules/R-03-附属操作失败阻断主流程.md) |
45
+ | R-15 | 状态持久化与重启逻辑一致性类 | high | 1 | [rules/R-15-状态持久化与重启逻辑一致性.md](rules/R-15-状态持久化与重启逻辑一致性.md) |
46
+
47
+ ### 异步与回调类
48
+
49
+ | 编号 | 规则名 | 严重级别 | 案例数 | 规则文件 |
50
+ |------|--------|----------|--------|----------|
51
+ | R-04 | 异步回调注册时序类 | high | 1 | [rules/R-04-异步回调注册时序.md](rules/R-04-异步回调注册时序.md) |
52
+ | R-11 | 接口/回调实现完整性类 | high | 1 | [rules/R-11-接口回调实现完整性.md](rules/R-11-接口回调实现完整性.md) |
53
+
54
+ ### 工程规范类
55
+
56
+ | 编号 | 规则名 | 严重级别 | 案例数 | 规则文件 |
57
+ |------|--------|----------|--------|----------|
58
+ | R-05 | 模块导入路径规范类 | low | 1 | [rules/R-05-模块导入路径规范.md](rules/R-05-模块导入路径规范.md) |
59
+ | R-16 | 敏感信息日志泄露类 | high | 1 | [rules/R-16-敏感信息日志泄露.md](rules/R-16-敏感信息日志泄露.md) |
60
+ | R-18 | 能力枚举/配置完整性类 | medium | 1 | [rules/R-18-能力枚举配置完整性.md](rules/R-18-能力枚举配置完整性.md) |
61
+
62
+ ### 手势与交互类
63
+
64
+ | 编号 | 规则名 | 严重级别 | 案例数 | 规则文件 |
65
+ |------|--------|----------|--------|----------|
66
+ | R-08 | 手势/事件注册与冲突处理类 | high | 3 | [rules/R-08-手势事件注册与冲突处理.md](rules/R-08-手势事件注册与冲突处理.md) |
67
+
68
+ ### 动画与渲染类
69
+
70
+ | 编号 | 规则名 | 严重级别 | 案例数 | 规则文件 |
71
+ |------|--------|----------|--------|----------|
72
+ | R-14 | 动画初始化时序与状态同步类 | medium | 1 | [rules/R-14-动画初始化时序与状态同步.md](rules/R-14-动画初始化时序与状态同步.md) |
73
+ | R-19 | 图形渲染属性继承与重置类 | medium | 1 | [rules/R-19-图形渲染属性继承与重置.md](rules/R-19-图形渲染属性继承与重置.md) |
74
+
75
+ ### C++ 内存与生命周期类
76
+
77
+ | 编号 | 规则名 | 严重级别 | 案例数 | 规则文件 |
78
+ |------|--------|----------|--------|----------|
79
+ | R-07 | C++ 智能指针生命周期管理类 | high | 1 | [rules/R-07-智能指针生命周期管理.md](rules/R-07-智能指针生命周期管理.md) |
80
+ | R-12 | 原生运行时资源析构时序类 | high | 1 | [rules/R-12-原生运行时资源析构时序.md](rules/R-12-原生运行时资源析构时序.md) |
81
+
82
+ ### 隐私合规类
83
+
84
+ | 编号 | 规则名 | 严重级别 | 案例数 | 规则文件 |
85
+ |------|--------|----------|--------|----------|
86
+ | R-06 | 传感器/硬件权限按需获取类 | high | 2 | [rules/R-06-传感器硬件权限按需获取.md](rules/R-06-传感器硬件权限按需获取.md) |
87
+
88
+ ---
89
+
90
+ ## 二、案例索引
91
+
92
+ | 编号 | 库 | 现象简述 | 所属规则 | 验证方式 | 案例文件 |
93
+ |------|-----|----------|----------|----------|----------|
94
+ | KI-001 | react-native-webview | 视频无法横屏 | R-01 | diff | [cases/KI-001-webview视频无法横屏.md](cases/KI-001-webview视频无法横屏.md) |
95
+ | KI-002 | react-native-fast-image | 热更新图片加载失败 | R-02 | diff | [cases/KI-002-fastImage热更新图片失败.md](cases/KI-002-fastImage热更新图片失败.md) |
96
+ | KI-003 | react-native-wechat-lib | 缩略图不支持本地图片 | R-02, R-03 | diff | [cases/KI-003-wechat缩略图本地图片.md](cases/KI-003-wechat缩略图本地图片.md) |
97
+ | KI-004 | react-native-wechat-lib | shareWebpage 回调时序问题 | R-04 | diff | [cases/KI-004-wechat回调时序.md](cases/KI-004-wechat回调时序.md) |
98
+ | KI-005 | react-native-geolocation | 3.1.1 接入报错(IDE 爆红) | R-05 | diff | [cases/KI-005-geolocation导入路径后缀.md](cases/KI-005-geolocation导入路径后缀.md) |
99
+ | KI-006 | react-native-SmartRefreshLayout | bad_weak_ptr 崩溃 | R-07 | diff | [cases/KI-006-SmartRefreshLayout智能指针崩溃.md](cases/KI-006-SmartRefreshLayout智能指针崩溃.md) |
100
+ | KI-007 | react-native-orientation-locker | 加速度传感器初始化即打开 | R-06 | diff | [cases/KI-007-orientation-locker传感器初始化.md](cases/KI-007-orientation-locker传感器初始化.md) |
101
+ | KI-008 | react-native-orientation-locker | 传感器频繁 open/close 优化 | R-06 | diff | [cases/KI-008-orientation-locker传感器引用计数.md](cases/KI-008-orientation-locker传感器引用计数.md) |
102
+ | KI-009 | react-native-pager-view | 嵌套滑动父子组件无法联动 | R-08 | diff | [cases/KI-009-pager-view嵌套滑动.md](cases/KI-009-pager-view嵌套滑动.md) |
103
+ | KI-010 | react-native-screens | 手势冲突与默认值错误 | R-08 | diff | [cases/KI-010-screens手势冲突.md](cases/KI-010-screens手势冲突.md) |
104
+ | KI-011 | react-native-spring-scrollview | 手势重复绑定崩溃 | R-08 | diff | [cases/KI-011-spring-scrollview手势重复绑定.md](cases/KI-011-spring-scrollview手势重复绑定.md) |
105
+ | KI-012 | react-native-qr-decode-image-camera | Pura X Max 横屏展示不正确 | R-09 | diff | [cases/KI-012-qr-camera横屏适配.md](cases/KI-012-qr-camera横屏适配.md) |
106
+ | KI-013 | react-native-webview | 深色模式先闪白再变黑 | R-10 | diff | [cases/KI-013-webview深色模式背景色.md](cases/KI-013-webview深色模式背景色.md) |
107
+ | KI-014 | react-native-amap-geolocation | onLocationError 未实现 | R-11 | diff | [cases/KI-014-amap-geolocation回调缺失.md](cases/KI-014-amap-geolocation回调缺失.md) |
108
+ | KI-015 | react-native-reanimated | 动画 crash(滴滴线上 0.01%) | R-12 | diff | [cases/KI-015-reanimated运行时析构崩溃.md](cases/KI-015-reanimated运行时析构崩溃.md) |
109
+ | KI-016 | react-native-fs | read 接口无法读取非文本文件 | R-13 | diff | [cases/KI-016-fs文件读取编码.md](cases/KI-016-fs文件读取编码.md) |
110
+ | KI-017 | react-native-blob-util | 字符串参数被错误转为文件流 | R-13 | diff | [cases/KI-017-blob-util参数编码错误.md](cases/KI-017-blob-util参数编码错误.md) |
111
+ | KI-018 | react-native-modal | 弹窗先闪一下 | R-14 | diff | [cases/KI-018-modal弹窗闪烁.md](cases/KI-018-modal弹窗闪烁.md) |
112
+ | KI-019 | react-native-code-push | restartApp 在 ON_NEXT_RESTART 模式下失效 | R-15 | diff | [cases/KI-019-code-push重启逻辑失效.md](cases/KI-019-code-push重启逻辑失效.md) |
113
+ | KI-020 | react-native-netinfo | 打印 MAC 地址和 IP 地址 | R-16 | diff | [cases/KI-020-netinfo敏感信息泄露.md](cases/KI-020-netinfo敏感信息泄露.md) |
114
+ | KI-021 | react-native-video | 播放本地视频异常 | R-17 | diff | [cases/KI-021-video本地视频播放异常.md](cases/KI-021-video本地视频播放异常.md) |
115
+ | KI-022 | react-native-audio-recorder-player | AAC 格式无法录制 | R-18 | diff | [cases/KI-022-audio-recorder-player枚举缺失.md](cases/KI-022-audio-recorder-player枚举缺失.md) |
116
+ | KI-023 | react-native-svg | Text 组件渐变色失效 | R-19 | diff | [cases/KI-023-svg渐变继承失效.md](cases/KI-023-svg渐变继承失效.md) |
117
+
118
+ > `验证方式`:diff = 基于实际 PR patch 验证(含错误/正确代码对照);description-only = 仅基于问题描述。
119
+
120
+ ---
121
+
122
+ ## 三、变更记录
123
+
124
+ | 日期 | 变更 | 说明 |
125
+ |------|------|------|
126
+ | 2026-08-24 | 初始创建 | 4 案例 → 5 规则(KI-003 复合问题拆 3 规则);由单文件结构整改为分级结构 |
127
+ | 2026-08-24 | 批量泛化(19 新案例) | 18 新案例 → 14 新规则(R-06~R-19);新增手势与交互类、动画与渲染类、C++ 内存与生命周期类、隐私合规类四大分类 |
@@ -0,0 +1,52 @@
1
+ # KI-001 react-native-webview:视频无法横屏
2
+
3
+ - **元数据**: `rule: R-01` · `verified: diff` · `source: dtse` · `severity: high`
4
+ - **PR**: https://gitcode.com/CPF-RN/rntpc_react-native-webview/pull/121(merged,+199/-7,2 文件)
5
+ - **diff 材料**: [../pr-info/rntpc_react-native-webview-121.md](../pr-info/rntpc_react-native-webview-121.md)
6
+
7
+ ## 现象
8
+
9
+ WebView 内视频点击全屏后无法横屏播放。
10
+
11
+ ## 根因
12
+
13
+ 鸿蒙侧实现完全缺失全屏事件处理链路——未监听 onFullScreenEnter/Exit、未保存初始方向、无窗口 API 调用、销毁无恢复。
14
+
15
+ ## 错误代码(修复前,ArkTS 层无任何全屏处理,仅布局尺寸绑定)
16
+
17
+ ```typescript
18
+ // RNCWebView.ets — 声明了 allowsFullscreenVideo prop,但 ArkTS 层无对应实现
19
+ .width(this.webviewWidth)
20
+ .height(this.webviewHeight)
21
+ // 无 onFullScreenEnter / onFullScreenExit 监听
22
+ // 无窗口方向 / 沉浸式调用
23
+ ```
24
+
25
+ ## 正确代码(修复后关键片段)
26
+
27
+ ```typescript
28
+ // ① 保存初始方向(aboutToAppear 时)
29
+ private async saveInitialOrientation() {
30
+ const win = await window.getLastWindow(getContext(this));
31
+ this.initialOrientation = win.getPreferredOrientation();
32
+ this.isOrientationSaved = true;
33
+ }
34
+ // ② 监听全屏事件,串行执行且每步校验、失败回滚
35
+ .onFullScreenEnter(async () => {
36
+ if (this.allowsFullscreenVideo) { await this.handleFullScreenEnter(); }
37
+ })
38
+ .onFullScreenExit(async () => { await this.handleFullScreenExit(); })
39
+ // ③ 组件销毁时无条件恢复窗口状态(防异步竞态残留)
40
+ aboutToDisappear() {
41
+ if (this.cachedWindow) {
42
+ this.cachedWindow.setPreferredOrientation(this.initialOrientation);
43
+ this.cachedWindow.setWindowLayoutFullScreen(false);
44
+ this.cachedWindow.setWindowSystemBarEnable(['status', 'navigation']);
45
+ }
46
+ this.isFullScreen = false;
47
+ }
48
+ ```
49
+
50
+ ## 修复方式
51
+
52
+ 补全完整链路:新增 allowsFullscreenVideo prop → aboutToAppear 时 saveInitialOrientation → 监听 onFullScreenEnter/Exit → handleFullScreenEnter 串行执行(设方向→设沉浸式,任一步失败回滚全部)→ handleFullScreenExit 恢复 → aboutToDisappear 无条件恢复窗口状态(防异步竞态残留)→ isFullScreen 状态守卫防重入。
@@ -0,0 +1,37 @@
1
+ # KI-002 react-native-fast-image:加载热更新图片失败
2
+
3
+ - **元数据**: `rule: R-02` · `verified: diff` · `source: community-issue` · `severity: high`
4
+ - **PR**: https://gitcode.com/CPF-RN/rntpc_react-native-fast-image/pull/102(merged,+7/-1,1 文件)
5
+ - **diff 材料**: [../pr-info/rntpc_react-native-fast-image-102.md](../pr-info/rntpc_react-native-fast-image-102.md)
6
+
7
+ ## 现象
8
+
9
+ fastImage 加载热更新 bundle 中的图片失败。
10
+
11
+ ## 根因
12
+
13
+ C++ 层 asset:// 前缀分支未区分 rawfile 资源与沙箱文件路径,一律按 rawfile 资源方式(SetResource)加载,热更新图片实际位于沙箱文件路径,加载必然失败。
14
+
15
+ ## 错误代码(修复前)
16
+
17
+ ```cpp
18
+ if (props->source.uri.rfind(ASSET_PREFIX, 0) == 0) {
19
+ m_imageKnifeOption->loadSrc.SetResource({.id = -1, .param = newUri.c_str()});
20
+ }
21
+ ```
22
+
23
+ ## 正确代码(修复后)
24
+
25
+ ```cpp
26
+ if (props->source.uri.rfind(ASSET_PREFIX, 0) == 0) {
27
+ if (newUri.find(RAWFILE_PREFIX, 0) == 0) {
28
+ m_imageKnifeOption->loadSrc.SetResource({.id = -1, .param = newUri.c_str()});
29
+ } else {
30
+ m_imageKnifeOption->loadSrc.SetString(newUri.c_str());
31
+ }
32
+ }
33
+ ```
34
+
35
+ ## 修复方式
36
+
37
+ 在 asset:// 分支内二次判断:若路径以 RAWFILE_PREFIX 开头走 SetResource,否则走 SetString(文件路径加载)。
@@ -0,0 +1,62 @@
1
+ # KI-003 react-native-wechat-lib:shareWebpage 缩略图不支持本地图片
2
+
3
+ - **元数据**: `rule: R-02, R-03` · `verified: diff` · `source: community-issue` · `severity: high`
4
+ - **PR**: https://gitcode.com/CPF-RN/rntpc_react-native-wechat-lib/pull/15(merged,核心 3 文件)
5
+ - **diff 材料**: [../pr-info/rntpc_react-native-wechat-lib-15.md](../pr-info/rntpc_react-native-wechat-lib-15.md)
6
+
7
+ > **复合问题**:本案例同时命中 R-02(URI 形态缺失)与 R-03(附属操作失败阻断主流程),是同一处代码的两个缺陷面。
8
+
9
+ ## 现象
10
+
11
+ 分享网页时 thumbImageUrl 传本地图片报错,无法跳转微信(用户原报告聚焦"下载报错",实际 patch 证实根因是本地 URI 形态缺失)。
12
+
13
+ ## 根因
14
+
15
+ 缩略图加载只实现了 http 下载一种形态,data:/asset://rawfile 等本地 URI 形态直接走下载逻辑必然失败;且下载失败直接 callback 错误阻断分享主流程。
16
+
17
+ ## 错误代码(修复前,仅 http 下载一种形态)
18
+
19
+ ```typescript
20
+ let thumbImageUrl = (message.thumbImageUrl ? message.thumbImageUrl : null);
21
+ if (thumbImageUrl != null && !(thumbImageUrl === "")) {
22
+ await new Promise<void>((resolve) => {
23
+ this.downloadImageWithUrl(thumbImageUrl!, async (imageData: ArrayBuffer) => {
24
+ if (!imageData) {
25
+ callback("shareWebpage Failed to retrieve imageData", null); // ← 本地 URI 走下载必然失败,且阻断主流程
26
+ return;
27
+ }
28
+ // ... 压缩后 resolve
29
+ }, callback);
30
+ })
31
+ }
32
+ ```
33
+
34
+ ## 正确代码(修复后,按前缀分支覆盖多形态)
35
+
36
+ ```typescript
37
+ async loadThumbImage(thumbImageUrl: string, mediaMessage: wxopensdk.WXMediaMessage): Promise<void> {
38
+ const getBytes = (): Promise<ArrayBuffer> => {
39
+ return new Promise<ArrayBuffer>((resolve, reject) => {
40
+ if (thumbImageUrl.startsWith('http://') || thumbImageUrl.startsWith('https://')) {
41
+ this.downloadImageWithUrl(thumbImageUrl, resolve, reject); // ① 远程:下载
42
+ } else if (thumbImageUrl.startsWith('data:')) {
43
+ const decoded = new util.Base64Helper().decodeSync(/* base64 部分 */);
44
+ resolve(decoded.buffer); // ② data: base64 解码
45
+ } else {
46
+ let rawFilePath = thumbImageUrl; // ③ asset:// / RAWFILE
47
+ if (rawFilePath.startsWith(ASSET_PREFIX)) { rawFilePath = 'assets/' + rawFilePath.substring(ASSET_PREFIX.length); }
48
+ else if (rawFilePath.startsWith(RAWFILE_PREFIX)) { rawFilePath = rawFilePath.substring(RAWFILE_PREFIX.length); }
49
+ resolve(getContext(this).resourceManager.getRawFileContentSync(rawFilePath).buffer);
50
+ }
51
+ });
52
+ };
53
+ const imageData = await getBytes();
54
+ // ... 压缩 + imageSource.release() / thumbPixel.release() 资源释放
55
+ }
56
+ ```
57
+
58
+ ## 修复方式
59
+
60
+ 抽取统一 loadThumbImage 方法,按前缀分支:http(s) 走下载、data: 走 base64 解码、asset://RAWFILE 走 resourceManager,各形态独立处理后统一压缩;同时补资源释放(imageSource.release/thumbPixel.release)。
61
+
62
+ > **R-03 视角注**:本 PR 将多形态加载收敛进 loadThumbImage,但远程下载失败仍会 reject(未完全降级)。理想模式应为 try-catch 包裹附属操作、失败置空 thumbData 继续分享——R-03 规则"正确特征"描述的是理想模式。
@@ -0,0 +1,47 @@
1
+ # KI-004 react-native-wechat-lib:shareWebpage 回调时序问题
2
+
3
+ - **元数据**: `rule: R-04` · `verified: diff` · `source: community-issue` · `severity: high`
4
+ - **PR**: https://gitcode.com/CPF-RN/rntpc_react-native-wechat-lib/pull/15(merged,与 KI-003 同 PR 复合问题)
5
+ - **diff 材料**: [../pr-info/rntpc_react-native-wechat-lib-15.md](../pr-info/rntpc_react-native-wechat-lib-15.md)
6
+
7
+ ## 现象
8
+
9
+ shareWebpage 调用偶发无响应/结果异常(用户报告为下载报错无法跳转,实际 patch 证实含回调时序缺陷)。
10
+
11
+ ## 根因
12
+
13
+ src/index.ts 中先调 nativeShareWebpage(data) 后注册 emitter.once 监听,原生响应可能先于监听到达而丢失;固定 transaction="webpage" 标识在重入场景混淆响应。
14
+
15
+ ## 错误代码(修复前,先调用后注册 + 固定标识)
16
+
17
+ ```typescript
18
+ return new Promise((resolve, reject) => {
19
+ nativeShareWebpage?.(data); // ← 先调 native,响应可能先于监听到达
20
+ emitter.once("SendMessageToWX.Resp", (resp) => {
21
+ if (resp.errCode === 0) { resolve(resp); }
22
+ else { reject(new WechatError(resp)); }
23
+ });
24
+ });
25
+ // ArkTS 侧:req.transaction = "webpage"; // ← 固定字符串,重入场景混淆响应
26
+ ```
27
+
28
+ ## 正确代码(修复后,先注册后调用 + 唯一标识 + 无效响应过滤)
29
+
30
+ ```typescript
31
+ return new Promise((resolve, reject) => {
32
+ WechatLib.unregisterCallback("SendMessageToWX.Resp"); // ① 清理旧监听
33
+ WechatLib.registerCallback("SendMessageToWX.Resp", (result) => {
34
+ if (!result) { return; } // ② 过滤空响应
35
+ const resp = result as WechatResponse & { code?: string; returnKey?: string };
36
+ if (resp.code !== undefined || resp.returnKey !== undefined) { return; } // 过滤错误码响应
37
+ WechatLib.unregisterCallback("SendMessageToWX.Resp");
38
+ if (resp.errCode === 0) { resolve(resp); } else { reject(new WechatError(resp)); }
39
+ });
40
+ nativeShareWebpage?.(data); // ③ 最后才调 native
41
+ });
42
+ // ArkTS 侧:req.transaction = util.generateRandomUUID().toString(); // 唯一标识
43
+ ```
44
+
45
+ ## 修复方式
46
+
47
+ 调整为先 unregisterCallback 清旧 → registerCallback 注册(含空结果/错误码过滤)→ 最后调 native;transaction 改为 generateRandomUUID。
@@ -0,0 +1,31 @@
1
+ # KI-005 react-native-geolocation:3.1.1 接入报错(IDE 爆红)
2
+
3
+ - **元数据**: `rule: R-05` · `verified: diff` · `source: community-issue` · `severity: low`
4
+ - **PR**: https://gitcode.com/CPF-RN/rntpc_react-native-geolocation/pull/24(merged,55 文件,核心修复 2 文件 4 行)
5
+ - **diff 材料**: [../pr-info/rntpc_react-native-geolocation-24.md](../pr-info/rntpc_react-native-geolocation-24.md)
6
+
7
+ ## 现象
8
+
9
+ 用户报告"3.1.1 版本的文件不对,按官方文档接入后直接报错"(用户以为是版本/产物问题)。
10
+
11
+ ## 根因
12
+
13
+ 实际 patch 证实是 index.ets/ts.ets 导入路径带 .ets 后缀导致 IDE 爆红,非版本/产物不一致问题——用户描述与实际根因偏差大,凸显必须看实际 diff。
14
+
15
+ ## 错误代码(修复前,index.ets / ts.ets)
16
+
17
+ ```typescript
18
+ import { GeoLocationPackage } from './src/main/ets/GeoLocationPackage.ets'; // ← 带 .ets 后缀
19
+ export * from './ts.ets';
20
+ ```
21
+
22
+ ## 正确代码(修复后)
23
+
24
+ ```typescript
25
+ import { GeoLocationPackage } from './src/main/ets/GeoLocationPackage'; // ← 无后缀
26
+ export * from './ts';
27
+ ```
28
+
29
+ ## 修复方式
30
+
31
+ 去除 index.ets/ts.ets 中导入路径的 .ets 后缀(核心修复 2 文件 4 行);同 PR 附带补齐 example 工程、README、OAT.xml 等配套。
@@ -0,0 +1,55 @@
1
+ # KI-006 react-native-SmartRefreshLayout:bad_weak_ptr 崩溃
2
+
3
+ - **元数据**: `rule: R-07` · `verified: diff` · `source: dtse` · `severity: high` · `status: draft`
4
+ - **PR**: https://gitcode.com/CPF-RN/rntpc_react-native-SmartRefreshLayout/pull/32(merged,6 文件)
5
+ - **diff 材料**: [../pr-info/rntpc_react-native-SmartRefreshLayout-32.md](../pr-info/rntpc_react-native-SmartRefreshLayout-32.md)
6
+
7
+ ## 现象
8
+
9
+ 红圈云应用闪退,bad_weak_ptr 崩溃。
10
+
11
+ ## 根因
12
+
13
+ 多线程下 shared_ptr 并发访问未加锁——getPullToRefreshConfigurator() 无锁保护,直接 CHECK 断言非空;析构函数中 reset refreshConfigurator 也无锁,多线程并发访问时触发 bad_weak_ptr。
14
+
15
+ ## 错误代码(修复前)
16
+
17
+ ```cpp
18
+ // PullToRefreshNode.h — getter 无锁,断言失败直接 abort
19
+ std::shared_ptr<PullToRefreshConfigurator> getPullToRefreshConfigurator() {
20
+ CHECK(refreshConfigurator != nullptr) // ← 断言失败直接 abort,无锁保护
21
+ << "[PullToRefreshNode] refreshConfigurator is null!";
22
+ return refreshConfigurator;
23
+ }
24
+
25
+ // PullToRefreshNode.cpp — 析构函数无锁 reset
26
+ PullToRefreshNode::~PullToRefreshNode() {
27
+ refreshConfigurator = nullptr; // ← 无锁,多线程并发访问
28
+ }
29
+ ```
30
+
31
+ ## 正确代码(修复后)
32
+
33
+ ```cpp
34
+ // PullToRefreshNode.h — ① 添加 shared_mutex 成员
35
+ std::shared_mutex config_mutex_;
36
+
37
+ // ② getter 使用 shared_lock 保护读取,判空记录日志而非 abort
38
+ std::shared_ptr<PullToRefreshConfigurator> getPullToRefreshConfigurator() {
39
+ std::shared_lock<std::shared_mutex> lock(config_mutex_);
40
+ if (!refreshConfigurator) {
41
+ LOG(ERROR)<<"[PullToRefreshNode] getPullToRefreshConfigurator refreshConfigurator is null!";
42
+ }
43
+ return refreshConfigurator;
44
+ }
45
+
46
+ // PullToRefreshNode.cpp — ③ 析构函数加 unique_lock 后 reset
47
+ PullToRefreshNode::~PullToRefreshNode() {
48
+ std::unique_lock<std::shared_mutex> lock(config_mutex_);
49
+ refreshConfigurator = nullptr;
50
+ }
51
+ ```
52
+
53
+ ## 修复方式
54
+
55
+ shared_ptr 成员添加 shared_mutex 保护:getter 使用 shared_lock 读取(允许多读),析构函数使用 unique_lock 后 reset(独占写);getter 将 CHECK 断言改为判空 + LOG 日志,避免断言失败直接 abort。
@@ -0,0 +1,58 @@
1
+ # KI-007 react-native-orientation-locker:加速度传感器初始化即打开
2
+
3
+ - **元数据**: `rule: R-06` · `verified: diff` · `source: community-issue` · `severity: high` · `status: draft`
4
+ - **PR**: https://gitcode.com/CPF-RN/rntpc_react-native-orientation-locker/pull/45(merged,58 文件)
5
+ - **diff 材料**: [../pr-info/rntpc_react-native-orientation-locker-45.md](../pr-info/rntpc_react-native-orientation-locker-45.md)
6
+
7
+ ## 现象
8
+
9
+ 使用 react-native-orientation-locker 库后,上架审核被拒——应用获取了用户的个人信息(加速度传感器),不符合相关法律法规要求。
10
+
11
+ ## 根因
12
+
13
+ 加速度传感器在模块初始化时即打开,而非在业务实际调用 addDeviceOrientationListener 时才按需开启——隐私合规要求"使用时才获取",初始化即获取违反法规。
14
+
15
+ ## 错误代码(修复前)
16
+
17
+ ```typescript
18
+ // 模块顶层或初始化时直接调用 openSensor
19
+ // 每次 addListener 都 openSensor,removeListener 都 closeSensor
20
+ static addDeviceOrientationListener = cb => {
21
+ OrientationNative.openSensor(); // ← 初始化即打开,每次添加都重复打开
22
+ // ...
23
+ };
24
+ static removeDeviceOrientationListener = cb => {
25
+ // ...
26
+ OrientationNative.closeSensor(); // ← 每次移除都关闭,可能影响其他 listener
27
+ };
28
+ ```
29
+
30
+ ## 正确代码(修复后)
31
+
32
+ ```typescript
33
+ // ① 引用计数变量
34
+ var deviceOrientationListenerCount = 0;
35
+
36
+ static addDeviceOrientationListener = cb => {
37
+ var key = getKey(cb);
38
+ if (!listeners[key]) { // ② 去重:同一 cb 不重复 openSensor
39
+ if (deviceOrientationListenerCount === 0) {
40
+ OrientationNative.openSensor(); // ③ 计数为 0 时才打开
41
+ }
42
+ deviceOrientationListenerCount++;
43
+ }
44
+ // ...
45
+ };
46
+
47
+ static removeDeviceOrientationListener = cb => {
48
+ // ...
49
+ deviceOrientationListenerCount--;
50
+ if (deviceOrientationListenerCount === 0) {
51
+ OrientationNative.closeSensor(); // ④ 计数归 0 时才关闭
52
+ }
53
+ };
54
+ ```
55
+
56
+ ## 修复方式
57
+
58
+ 将传感器从"初始化即打开"改为"按需获取":引入引用计数,首次 addListener 且 count===0 时才 openSensor;removeListener 时 count--,count===0 时才 closeSensor;同一 cb 重复添加不重复计数和 openSensor。
@@ -0,0 +1,47 @@
1
+ # KI-008 react-native-orientation-locker:传感器频繁 open/close 性能优化
2
+
3
+ - **元数据**: `rule: R-06` · `verified: diff` · `source: community-issue` · `severity: medium` · `status: draft`
4
+ - **PR**: https://gitcode.com/CPF-RN/rntpc_react-native-orientation-locker/pull/51(merged,1 文件)
5
+ - **diff 材料**: [../pr-info/rntpc_react-native-orientation-locker-51.md](../pr-info/rntpc_react-native-orientation-locker-51.md)
6
+
7
+ ## 现象
8
+
9
+ 优化加速度传感器的打开和关闭——PR 45 修复后,每次 addListener/removeListener 都调用 openSensor/closeSensor,频繁操作导致性能问题。
10
+
11
+ ## 根因
12
+
13
+ 虽有引用计数,但去重逻辑不完善——同一 cb 重复添加时未判断是否已存在,导致计数重复增加;removeAllListeners 时未复位计数和补 closeSensor。
14
+
15
+ ## 错误代码(修复前,PR 45 版本)
16
+
17
+ ```javascript
18
+ // removeAllListeners 未处理传感器关闭
19
+ static removeAllListeners = () => {
20
+ // 清空 listeners 但未复位计数、未 closeSensor ← 传感器泄漏
21
+ };
22
+ ```
23
+
24
+ ## 正确代码(修复后)
25
+
26
+ ```javascript
27
+ // ① addDeviceOrientationListener 中增加去重判断
28
+ if (!listeners[key]) {
29
+ if (deviceOrientationListenerCount === 0) {
30
+ OrientationNative.openSensor(); // ② 整个生命周期只调用一次
31
+ }
32
+ deviceOrientationListenerCount++;
33
+ }
34
+
35
+ // ③ removeAllListeners 中复位计数并补 closeSensor
36
+ static removeAllListeners = () => {
37
+ // ...
38
+ if (deviceOrientationListenerCount > 0) {
39
+ deviceOrientationListenerCount = 0;
40
+ OrientationNative.closeSensor();
41
+ }
42
+ };
43
+ ```
44
+
45
+ ## 修复方式
46
+
47
+ 完善引用计数管理的边界:addListener 时去重判断(同一 cb 不重复计数);removeAllListeners 时复位计数并补一次 closeSensor,防止传感器泄漏。