@yinsen/deveco-cli-common 0.0.0-stage → 1.4.0-Test.912
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/LICENSE +21 -0
- package/NOTICE +12464 -0
- package/README.md +3225 -2
- package/dist/arkts-check.cjs +42 -0
- package/dist/cli.js +1891 -0
- package/dist/design2arkts-engine/LICENSE +21 -0
- package/dist/design2arkts-engine/dist/index.d.ts +2739 -0
- package/dist/design2arkts-engine/dist/index.js +6207 -0
- package/dist/design2arkts-engine/package.json +40 -0
- package/dist/design2arkts-engine/pixso-arkts.mjs +98 -0
- package/dist/design2arkts-engine/resources/skill/LICENSE +21 -0
- package/dist/design2arkts-engine/resources/skill/SKILL.md +249 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/INSTRUCTIONS.md +310 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/evals/evals.json +249 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/references/basics-and-display.md +146 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/references/containers-and-navigation.md +527 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/references/feedback-and-overlay.md +275 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/references/hds-components.md +667 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/references/input-and-selection.md +382 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/references/patterns/data-and-form.md +440 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkts-logic-completer/references/patterns/state-management.md +213 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkui-scoring-workflow/INSTRUCTIONS.md +189 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkui2hds/INSTRUCTIONS.md +138 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkui2hds/references/components.md +777 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-arkui2hds/references/migration-patterns.md +187 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/INSTRUCTIONS.md +352 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-basic-mapping.md +455 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-common-issues.md +516 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/button.md +104 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/flex.md +115 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/grid.md +121 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/image.md +118 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/list.md +152 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/location.md +160 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/richeditor.md +132 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/row-column.md +118 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/stack.md +106 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/swiper.md +117 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/tabs.md +163 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/text-input.md +147 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/text.md +145 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/api-cards/waterflow.md +116 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/index.md +23 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/arkui-knowledge-base/matching.md +127 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-react-to-arkui/references/clarification-template.md +53 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/INSTRUCTIONS.md +163 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/architecture-patterns/api-architecture.md +17 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/architecture-patterns/data-architecture.md +17 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/architecture-patterns/logic-architecture.md +17 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/architecture-patterns/ui-architecture.md +23 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/methodology/behavior-audit.md +143 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/methodology/diff-analysis.md +115 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/methodology/dimension-identification.md +86 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/methodology/output-format.md +347 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-repo-understand/references/methodology/understanding-modes.md +214 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-responsive-layout-generator/INSTRUCTIONS.md +86 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-responsive-layout-generator/references/breakpoints.md +86 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-responsive-layout-generator/references/chunks.md +48 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-responsive-layout-generator/references/dsl-schema.md +151 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-responsive-layout-generator/references/patterns.md +147 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-responsive-layout-generator/references/rules.md +115 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-solution-design/INSTRUCTIONS.md +572 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-solution-design/assets/template-ui-page.md +293 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-solution-design/references/animation-design.md +84 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-ui-reconstruction-score/INSTRUCTIONS.md +195 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-ui-reconstruction-score/references/analysis_workflow.md +119 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-ui-reconstruction-score/references/scoring_schema.md +83 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-ui-reconstruction-score/references/vlm_prompt.md +61 -0
- package/dist/design2arkts-engine/resources/skill/references/capabilities/hmos-d2a-ui-reconstruction-score/scripts/ui_score.py +691 -0
- package/dist/design2arkts-engine/resources/skill/references/cli-integration.md +119 -0
- package/dist/design2arkts-engine/resources/skill/references/design-doc-auto-recovery.md +91 -0
- package/dist/design2arkts-engine/resources/skill/references/figma/fast/stages/01-acquire-figma-react-source.md +96 -0
- package/dist/design2arkts-engine/resources/skill/references/figma/fast/stages/02-convert-react-to-arkui.md +94 -0
- package/dist/design2arkts-engine/resources/skill/references/figma/fast/stages/03-complete-interaction-logic.md +26 -0
- package/dist/design2arkts-engine/resources/skill/references/figma/fast/stages/04-quality-and-build.md +45 -0
- package/dist/design2arkts-engine/resources/skill/references/figma/fast/stages/05-summary.md +44 -0
- package/dist/design2arkts-engine/resources/skill/references/figma/full/stages/01-acquire-figma-react-source.md +161 -0
- package/dist/design2arkts-engine/resources/skill/references/figma/full/stages/02-convert-react-to-arkui.md +221 -0
- package/dist/design2arkts-engine/resources/skill/references/figma/full/stages/03-complete-interaction-logic.md +31 -0
- package/dist/design2arkts-engine/resources/skill/references/figma/full/stages/04-quality-and-build.md +30 -0
- package/dist/design2arkts-engine/resources/skill/references/figma/full/stages/05-visual-calibration.md +193 -0
- package/dist/design2arkts-engine/resources/skill/references/figma/full/stages/06-summary.md +41 -0
- package/dist/design2arkts-engine/resources/skill/references/figma/stage-catalog-fast.json +40 -0
- package/dist/design2arkts-engine/resources/skill/references/figma/stage-catalog-full.json +47 -0
- package/dist/design2arkts-engine/resources/skill/references/host-vision.md +56 -0
- package/dist/design2arkts-engine/resources/skill/references/mcp-dependency.md +62 -0
- package/dist/design2arkts-engine/resources/skill/references/page-revisions.md +42 -0
- package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/01-acquire-pixso-dsl.md +287 -0
- package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/02-generate-skeleton-and-assets.md +247 -0
- package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/03-understand-repository.md +133 -0
- package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/05-design-component-tree.md +222 -0
- package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/06-implement-static-layout.md +143 -0
- package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/07-complete-interaction-logic.md +131 -0
- package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/08-quality-build-and-audits.md +345 -0
- package/dist/design2arkts-engine/resources/skill/references/pixso/fast/stages/09-summary.md +113 -0
- package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/01-acquire-pixso-dsl.md +287 -0
- package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/02-generate-skeleton-and-assets.md +247 -0
- package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/03-understand-repository.md +133 -0
- package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/05-design-and-confirm-component-tree.md +282 -0
- package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/06-implement-static-layout.md +143 -0
- package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/07-complete-interaction-logic.md +131 -0
- package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/08-quality-build-and-audits.md +345 -0
- package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/09-visual-calibration.md +193 -0
- package/dist/design2arkts-engine/resources/skill/references/pixso/full/stages/10-summary.md +125 -0
- package/dist/design2arkts-engine/resources/skill/references/pixso/stage-catalog-fast.json +58 -0
- package/dist/design2arkts-engine/resources/skill/references/pixso/stage-catalog-full.json +64 -0
- package/dist/design2arkts-engine/resources/skill/references/requirement-clarification.md +131 -0
- package/dist/design2arkts-engine/resources/skill/references/resource-revisions.md +13 -0
- package/dist/design2arkts-engine/resources/skill/references/runtime-contract.md +444 -0
- package/dist/design2arkts-engine/resources/skill/references/score-engine.json +5 -0
- package/dist/design2arkts-engine/resources/skill/references/source-tools.md +17 -0
- package/dist/design2arkts-engine/resources/skill/references/standalone-capabilities.md +63 -0
- package/dist/design2arkts-engine/resources/skill/references/workflow-origin.json +96 -0
- package/dist/design2arkts-engine/resources/skill/scripts/file-lock.mjs +131 -0
- package/dist/design2arkts-engine/resources/skill/scripts/workflow.mjs +4129 -0
- package/dist/design2arkts-engine/runner.mjs +44 -0
- package/dist/internal/plugin-hook-runner.js +1 -0
- package/dist/internal/telemetry-upload-background.js +46 -0
- package/package.json +91 -4
- package/skills/deveco-cli/SKILL.md +582 -0
- package/skills/deveco-cli/docs/arkts-rules.md +33 -0
- package/skills/deveco-cli/docs/design2arkts.md +276 -0
- package/skills/hmos-arkui-develop-skill/SKILL.md +77 -0
- package/skills/hmos-arkui-develop-skill/references/quick-apis/01-layout.md +634 -0
- package/skills/hmos-arkui-develop-skill/references/quick-apis/02-basic-components.md +649 -0
- package/skills/hmos-arkui-develop-skill/references/quick-apis/03-data-display.md +81 -0
- package/skills/hmos-arkui-develop-skill/references/quick-apis/04-selectors.md +109 -0
- package/skills/hmos-arkui-develop-skill/references/quick-apis/05-media.md +90 -0
- package/skills/hmos-arkui-develop-skill/references/quick-apis/06-advanced.md +32 -0
- package/skills/hmos-arkui-develop-skill/references/quick-apis/07-security.md +30 -0
- package/skills/hmos-arkui-develop-skill/references/quick-apis/08-state-decorators.md +120 -0
- package/skills/hmos-arkui-develop-skill/references/quick-apis/09-animation.md +118 -0
- package/skills/hmos-arkui-develop-skill/references/quick-apis/10-gesture.md +89 -0
- package/skills/hmos-arkui-develop-skill/references/quick-apis/11-dialog-menu.md +152 -0
- package/skills/hmos-arkui-develop-skill/references/quick-apis/12-navigation.md +127 -0
- package/skills/hmos-arkui-develop-skill/references/quick-apis/13-rendering.md +52 -0
- package/skills/hmos-arkui-develop-skill/references/quick-apis/14-extension.md +22 -0
- package/skills/hmos-arkui-develop-skill/references/quick-apis/15-theme-style.md +10 -0
- package/skills/hmos-arkui-develop-skill/references/quick-apis/16-enums.md +128 -0
- package/skills/hmos-arkui-develop-skill/references/quick-apis/17-resources.md +401 -0
- package/skills/hmos-arkui-develop-skill/references/quick-apis/18-error-code.md +24 -0
- package/skills/hmos-arkui-develop-skill/references/quick-apis/_index.md +76 -0
- package/skills/hmos-arkui-develop-skill/references/quick-rules/00-arkts-syntax.md +229 -0
- package/skills/hmos-arkui-develop-skill/references/quick-rules/01-import.md +116 -0
- package/skills/hmos-arkui-develop-skill/references/quick-rules/02-uicontext.md +56 -0
- package/skills/hmos-arkui-develop-skill/references/quick-rules/03-component.md +105 -0
- package/skills/hmos-arkui-develop-skill/references/quick-rules/04-build.md +41 -0
- package/skills/hmos-arkui-develop-skill/references/quick-rules/05-state.md +300 -0
- package/skills/hmos-arkui-develop-skill/references/quick-rules/06-rendering.md +67 -0
- package/skills/hmos-arkui-develop-skill/references/quick-rules/07-attribute-params.md +219 -0
- package/skills/hmos-arkui-develop-skill/references/quick-rules/08-navigation.md +102 -0
- package/skills/hmos-arkui-develop-skill/references/quick-rules/09-dialog.md +72 -0
- package/skills/hmos-arkui-develop-skill/references/quick-rules/10-style.md +90 -0
- package/skills/hmos-arkui-develop-skill/references/quick-rules/11-extension.md +54 -0
- package/skills/hmos-arkui-develop-skill/references/quick-rules/12-layout.md +69 -0
- package/skills/hmos-arkui-develop-skill/references/quick-rules/13-performance.md +27 -0
- package/skills/hmos-arkui-develop-skill/references/quick-rules/14-deprecated.md +28 -0
- package/skills/hmos-arkui-develop-skill/references/quick-rules/_index.md +79 -0
- package/skills/hmos-arkui-develop-skill/references/style-guide.md +491 -0
- package/skills/hmos-arkui-develop-skill/test-cases/code_gen_cases.json +292 -0
- package/skills/hmos-dfx-analyzer/SKILL.md +717 -0
- package/skills/hmos-dfx-analyzer/changelog/CHANGELOG.md +17 -0
- package/skills/hmos-dfx-analyzer/evals/evals.json +119 -0
- package/skills/hmos-dfx-analyzer/references/appfreeze/analyzer.md +471 -0
- package/skills/hmos-dfx-analyzer/references/appfreeze/references/fault-mode-library.md +94 -0
- package/skills/hmos-dfx-analyzer/references/appfreeze/references/ffrt-freeze-analysis.md +132 -0
- package/skills/hmos-dfx-analyzer/references/appfreeze/references/libuv-freeze-analysis.md +116 -0
- package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/__init__.py +40 -0
- package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/binder.py +343 -0
- package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/collector.py +84 -0
- package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/common.py +132 -0
- package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/faultlog.py +212 -0
- package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/main.py +81 -0
- package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/report.py +675 -0
- package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/sections.py +377 -0
- package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/freeze/stack.py +165 -0
- package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/llvm_addr2line.py +123 -0
- package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/match_so.py +120 -0
- package/skills/hmos-dfx-analyzer/references/appfreeze/scripts/sample_stack_analyzer.py +209 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/analyzer.md +470 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/references/arkdata.md +325 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/references/arkui.md +266 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/references/arkweb.md +144 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/references/fault_mode.md +178 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/references/gwp_asan.md +300 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/references/jsruntime.md +339 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/references/jsvm.md +203 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/references/libuv.md +166 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/references/memory_corruption.md +348 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/references/memory_corruption_second_scene.md +74 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/references/multithreading.md +284 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/references/render_service.md +300 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/references/rosen_text.md +41 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/__init__.py +36 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/collector.py +93 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/common.py +68 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/crash_log.py +275 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/extract_hilog.py +69 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/hints.py +251 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/main.py +82 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/match_so.py +120 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/ohos_llvm_tools.py +279 -0
- package/skills/hmos-dfx-analyzer/references/cppcrash/scripts/report.py +226 -0
- package/skills/hmos-dfx-analyzer/references/jscrash/analyzer.md +174 -0
- package/skills/hmos-dfx-analyzer/references/jscrash/references/fault-mode-library.md +107 -0
- package/skills/hmos-dfx-analyzer/references/jscrash/references/jscrash-patterns.md +92 -0
- package/skills/hmos-dfx-analyzer/references/jscrash/references/sourcemap-symbolication.md +67 -0
- package/skills/hmos-dfx-analyzer/references/jscrash/scripts/hstack/bin/hstack +25 -0
- package/skills/hmos-dfx-analyzer/references/jscrash/scripts/hstack/bin/hstack.bat +26 -0
- package/skills/hmos-dfx-analyzer/references/jscrash/scripts/hstack/lib/index.js +2 -0
- package/skills/hmos-dfx-analyzer/references/jscrash/scripts/hstack/lib/index.js.LICENSE.txt +1 -0
- package/skills/hmos-dfx-analyzer/references/jscrash/scripts/hstack/lib/mappings.wasm +0 -0
- package/skills/hmos-dfx-analyzer/references/report-encoding-pitfalls.md +41 -0
- package/skills/hmos-dfx-analyzer/references/white-screen/analyzer.md +129 -0
- package/skills/hmos-dfx-analyzer/scripts/collect/collect-hilog.mjs +120 -0
- package/skills/hmos-dfx-analyzer/scripts/collect/jscrash-report.mjs +138 -0
- package/skills/hmos-dfx-analyzer/scripts/collect/parse-jscrash-log.mjs +126 -0
- package/skills/hmos-dfx-analyzer/scripts/collect/shared/deveco-cli.mjs +79 -0
- package/skills/hmos-dfx-analyzer/scripts/collect/shared/jscrash-parse.mjs +389 -0
- package/skills/hmos-dfx-analyzer/scripts/collect/shared/utils.mjs +27 -0
- package/skills/hmos-dfx-analyzer/scripts/export_report.py +379 -0
- package/skills/hmos-dfx-analyzer/scripts/identify_fault_log.py +500 -0
- package/skills/hmos-dfx-analyzer/scripts/report_template.html +103 -0
- package/skills/hmos-dfx-analyzer/test-cases/functional.md +160 -0
- package/skills/hmos-dfx-analyzer/test-cases/smoke.md +123 -0
- package/skills/hmos-dfx-analyzer/test-cases/test-prompts.md +35 -0
- package/skills/hmos-dfx-analyzer/test-cases/trigger.md +140 -0
- package/skills/index.json +17 -0
- package/src/resources/aclPermission/aclPermissionsInfo.json +311 -0
- package/src/resources/agents/arkts-architect.yaml +14 -0
- package/src/resources/agents/arkts-developer.yaml +18 -0
- package/src/resources/agents/arkts-judge.yaml +12 -0
- package/src/resources/agents/arkts-reviewer.yaml +14 -0
- package/src/resources/agents/code-hunter.yaml +14 -0
- package/src/resources/agents/code-judge.yaml +13 -0
- package/src/resources/agents/developer.yaml +15 -0
- package/src/resources/agents/documentation-writer.yaml +14 -0
- package/src/resources/agents/workflow-decider.yaml +14 -0
- package/src/resources/engines/claude.yaml +43 -0
- package/src/resources/engines/codex.yaml +38 -0
- package/src/resources/engines/opencode.yaml +54 -0
- package/src/resources/workflows/.gitkeep +0 -0
- package/templates/application/AppScope/app.json5 +10 -0
- package/templates/application/AppScope/resources/base/element/string.json +8 -0
- package/templates/application/AppScope/resources/base/media/layered_image.json +7 -0
- package/templates/application/build-profile.json5 +42 -0
- package/templates/application/code-linter.json5 +32 -0
- package/templates/application/entry/build-profile.json5 +33 -0
- package/templates/application/entry/gitignore.txt +6 -0
- package/templates/application/entry/hvigorfile.ts +7 -0
- package/templates/application/entry/obfuscation-rules.txt +20 -0
- package/templates/application/entry/oh-package.json5 +10 -0
- package/templates/application/entry/src/main/ets/entryability/EntryAbility.ets +63 -0
- package/templates/application/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +31 -0
- package/templates/application/entry/src/main/ets/pages/Index.ets +38 -0
- package/templates/application/entry/src/main/module.json5 +50 -0
- package/templates/application/entry/src/main/resources/base/element/color.json +8 -0
- package/templates/application/entry/src/main/resources/base/element/float.json +8 -0
- package/templates/application/entry/src/main/resources/base/element/string.json +16 -0
- package/templates/application/entry/src/main/resources/base/media/layered_image.json +7 -0
- package/templates/application/entry/src/main/resources/base/profile/backup_config.json +3 -0
- package/templates/application/entry/src/main/resources/base/profile/main_pages.json +5 -0
- package/templates/application/entry/src/main/resources/dark/element/color.json +8 -0
- package/templates/application/gitignore.txt +13 -0
- package/templates/application/hvigor/hvigor-config.json5 +23 -0
- package/templates/application/hvigorfile.ts +7 -0
- package/templates/application/oh-package.json5 +10 -0
- package/templates/application/template.json +8 -0
- package/templates/native-cpp/AppScope/app.json5 +10 -0
- package/templates/native-cpp/AppScope/resources/base/element/string.json +8 -0
- package/templates/native-cpp/AppScope/resources/base/media/layered_image.json +7 -0
- package/templates/native-cpp/build-profile.json5 +43 -0
- package/templates/native-cpp/code-linter.json5 +32 -0
- package/templates/native-cpp/entry/build-profile.json5 +48 -0
- package/templates/native-cpp/entry/gitignore.txt +6 -0
- package/templates/native-cpp/entry/hvigorfile.ts +6 -0
- package/templates/native-cpp/entry/obfuscation-rules.txt +20 -0
- package/templates/native-cpp/entry/oh-package.json5 +11 -0
- package/templates/native-cpp/entry/src/main/cpp/CMakeLists.txt +15 -0
- package/templates/native-cpp/entry/src/main/cpp/napi_init.cpp +67 -0
- package/templates/native-cpp/entry/src/main/cpp/types/libentry/Index.d.ts +16 -0
- package/templates/native-cpp/entry/src/main/cpp/types/libentry/oh-package.json5 +6 -0
- package/templates/native-cpp/entry/src/main/ets/entryability/EntryAbility.ets +63 -0
- package/templates/native-cpp/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +31 -0
- package/templates/native-cpp/entry/src/main/ets/pages/Index.ets +26 -0
- package/templates/native-cpp/entry/src/main/module.json5 +50 -0
- package/templates/native-cpp/entry/src/main/resources/base/element/color.json +8 -0
- package/templates/native-cpp/entry/src/main/resources/base/element/float.json +8 -0
- package/templates/native-cpp/entry/src/main/resources/base/element/string.json +16 -0
- package/templates/native-cpp/entry/src/main/resources/base/media/layered_image.json +7 -0
- package/templates/native-cpp/entry/src/main/resources/base/profile/backup_config.json +3 -0
- package/templates/native-cpp/entry/src/main/resources/base/profile/main_pages.json +5 -0
- package/templates/native-cpp/entry/src/main/resources/dark/element/color.json +8 -0
- package/templates/native-cpp/gitignore.txt +13 -0
- package/templates/native-cpp/hvigor/hvigor-config.json5 +23 -0
- package/templates/native-cpp/hvigorfile.ts +6 -0
- package/templates/native-cpp/oh-package.json5 +10 -0
- package/templates/native-cpp/template.json +8 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2026 Huawei Device Co., Ltd.
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
import { pixsoToArkTs, pixsoToRawNewRoot } from './pixso-arkts.mjs';
|
|
6
|
+
const chunks = [];
|
|
7
|
+
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
8
|
+
try {
|
|
9
|
+
const request = JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
10
|
+
const result =
|
|
11
|
+
request.operation === 'layout'
|
|
12
|
+
? describeLayout(pixsoToRawNewRoot(request.input))
|
|
13
|
+
: {
|
|
14
|
+
...pixsoToArkTs(request.input, { structName: request.pageName }),
|
|
15
|
+
raw: pixsoToRawNewRoot(request.input),
|
|
16
|
+
};
|
|
17
|
+
process.stdout.write(JSON.stringify(result));
|
|
18
|
+
} catch (error) {
|
|
19
|
+
process.stderr.write(String(error?.stack || error));
|
|
20
|
+
process.exitCode = 1;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function describeLayout(root) {
|
|
24
|
+
const pending = [...root.content];
|
|
25
|
+
const types = {};
|
|
26
|
+
const zeroSize = [];
|
|
27
|
+
let count = 0;
|
|
28
|
+
while (pending.length) {
|
|
29
|
+
const node = pending.pop();
|
|
30
|
+
if (++count > 50000) throw new Error('Layout exceeds 50000 nodes.');
|
|
31
|
+
types[node.type ?? 'unknown'] = (types[node.type ?? 'unknown'] ?? 0) + 1;
|
|
32
|
+
if (node.box?.width === 0 || node.box?.height === 0)
|
|
33
|
+
zeroSize.push(node.key);
|
|
34
|
+
if (Array.isArray(node.children)) pending.push(...node.children);
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
status: 'bounds-only',
|
|
38
|
+
nodeCount: count,
|
|
39
|
+
types,
|
|
40
|
+
roots: root.content.map((node) => ({ id: node.key, box: node.box })),
|
|
41
|
+
zeroSizeNodes: zeroSize,
|
|
42
|
+
visualComparisonPerformed: false,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import g from"path";import{pathToFileURL as l}from"url";function t(n){return new Promise(o=>{let e=process.send;if(!e){o();return}try{e.call(process,n,()=>o())}catch{o()}})}function d(n){let o=n;return{message:n instanceof Error?n.message:String(n),name:o?.name,code:o?.code}}async function f(){let n=process.argv[2];if(!n)throw new Error("missing hook payload");let o=JSON.parse(n),e=g.join(o.pluginDir,"index.js"),a=await import(l(e).href),i=a.plugin??a.default?.plugin;if(!i||typeof i!="object")throw new Error("plugin export not found");let s=i[o.hookName];if(typeof s!="function")throw new Error(`plugin hook ${o.hookName} is not a function`);let u={...o.ctx,log:p=>{t({type:"log",message:String(p)})}};await s(u)}var c=!1;async function r(n){c||(c=!0,await t({type:"error",...d(n)})),process.exit(1)}process.on("uncaughtException",n=>{r(n)});process.on("unhandledRejection",n=>{r(n)});try{await f(),await t({type:"done"}),process.exit(0)}catch(n){await r(n)}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import rn from"path";import*as _ from"fs";import*as Le from"path";import{homedir as Dt}from"os";var w=class extends Error{traceMessage;constructor(e,t,n){super(e,n),this.name="TraceError",this.traceMessage=t??e}};function Q(r){if(r instanceof w)return r.traceMessage;if(r instanceof Error){let e=r.code;return typeof e=="string"&&e!==""?e:r.name}return"UnknownError"}function ee(r,e){return`${r}:${e}`}var h=class extends w{category;constructor(e,t,n,o){super(t,n,o),this.name="CategorizedTraceError",this.category=e}};function A(...r){return e=>r.includes(e.name)}function F(r,...e){return t=>{let n=t.code;return t.name===r&&typeof n=="string"&&e.includes(n)}}function xt(r){let e=r.code;return e==="ETIMEDOUT"||e==="RPC_TIMEOUT"||/timeout/i.test(r.name)}function wt(r){let e=r.code;return r.name==="ScreenRecordError"&&typeof e=="string"&&e.endsWith("_TIMEOUT")}var Rt=[{category:"Timeout",match:xt},{category:"Internal",match:A("ExecaError")},{category:"RuntimeCondition",match:A("CacheDirError","DocPathSafetyError")},{category:"InvalidArgument",match:A("SelectorParseError")},{category:"InvalidArgument",match:A("InvalidApiLevelError")},{category:"InvalidArgument",match:A("TemplateNotFoundError")},{category:"InvalidArgument",match:A("InvalidArgumentError")},{category:"InvalidArgument",match:F("ScreenRecordError","INVALID_ARGUMENT","INVALID_RECORDING_PATH")},{category:"Timeout",match:wt},{category:"InvalidArgument",match:F("FaultLogError","INVALID_ARGUMENTS","INVALID_INPUT","INPUT_OVERSIZED")},{category:"RuntimeCondition",match:F("FaultLogError","FILE_NOT_FOUND","UNRECOGNIZED_LOG")},{category:"Internal",match:F("FaultLogError","INTERNAL_ERROR")},{category:"RuntimeCondition",match:A("GrsError")}];function Pt(r){return Rt.find(t=>t.match(r))?.category??"Other"}function te(r){if(r instanceof h)return ee(r.category,r.traceMessage);let e=r instanceof Error?Pt(r):"Other";return ee(e,Q(r))}import*as Re from"fs";import*as v from"path";function re(r){let e=v.resolve(r),t=[],n=e;for(;;)try{let o=Re.realpathSync(n);return t.length===0?o:v.join(o,...t.reverse())}catch(o){if(o.code!=="ENOENT")throw o;let i=v.dirname(n);if(i===n)return e;t.push(v.basename(n)),n=i}}function ne(r){let e=r.trim();return(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))&&(e=e.slice(1,-1).trim()),e}function Pe(r){let e=ne(r);if(!e)throw new h("InvalidArgument","Path must not be empty.","Path must not be empty.");return re(e)}var Lt="deveco-cli",De,oe=class extends Error{constructor(e){super(e),this.name="CliDataDirError"}};function It(){let r=process.env.DEVECO_CLI_DATA_DIR,t=(r===void 0||r===""?"":ne(r))||Le.join(Dt(),".local","share",Lt);try{return Pe(t)}catch(n){throw new oe(n instanceof Error?n.message:String(n))}}function R(){if(De!==void 0)return De;let r=It();try{if(_.existsSync(r))return _.realpathSync(r)}catch{}return r}import Et from"crypto";import f from"fs";import Z from"os";import E from"path";import Nt from"https";var Ie={devecoApiTraceUpload:"https://cn.devecostudio.huawei.com/codeGenie/cli/trace/upload"};var $=class r{static ENDPOINT=Ie.devecoApiTraceUpload;static SENDER="deveco-cli";async upload(e,t){let n={"Content-Type":"application/json",sender:r.SENDER,deviceid:t.replace(/-/g,""),"Content-Length":String(Buffer.byteLength(e,"utf8"))};try{let{body:o}=await this.httpPost(r.ENDPOINT,n,Buffer.from(e,"utf8"),6e4);return r.isSuccess(o)}catch{return!1}}static isSuccess(e){try{let t=JSON.parse(e),n=t?.code??t?.errorCode;return String(n)==="200"}catch{return!1}}async httpPost(e,t,n,o){let i=new URL(e);return new Promise((s,a)=>{let c=Nt.request({protocol:i.protocol,hostname:i.hostname,port:i.port||(i.protocol==="https:"?443:80),path:i.pathname+i.search,method:"POST",headers:t,timeout:o},g=>{let S=[];g.on("data",I=>S.push(I)),g.on("end",()=>{s({code:g.statusCode??0,body:Buffer.concat(S).toString("utf8")})})});c.on("timeout",()=>{c.destroy(new Error("request timeout"))}),c.on("error",a),c.write(n),c.end()})}};var _e={identity:r=>r,camelCase:r=>r,snakeCase:r=>r.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").toLowerCase()},ie=class{constructor(e={}){this.config=e}serialize(e){let t=this.transform(e);return this.config.pretty?JSON.stringify(t,null,2):JSON.stringify(t)}toObject(e){return this.transform(e)}transform(e){if(e==null)return e;if(Array.isArray(e))return e.map(i=>this.transform(i));if(typeof e!="object")return e;let t=this.config.namingStrategy??_e.identity,n=this.config.fieldNames??{},o={};for(let[i,s]of Object.entries(e)){let a=n[i]??t(i);o[a]=this.transform(s)}return o}},Ne=new ie({namingStrategy:_e.snakeCase,fieldNames:{}});import N from"crypto";import U from"fs";import kt from"path";var G="aes-256-gcm",Ot=12,Mt="deveco-cli-trace-file",Ft="trace-file-secret",Oe=32;function ke(r){try{let e=U.readFileSync(r,"utf8").trim();return e&&Buffer.from(e,"base64").length===Oe?e:null}catch{return null}}function Me(r){let e=kt.join(r,Ft),t=ke(e);if(t)return se(t);let n=N.randomBytes(Oe).toString("base64");try{U.mkdirSync(r,{recursive:!0});try{U.writeFileSync(e,n,{flag:"wx"})}catch{let o=ke(e);if(o)return se(o);U.writeFileSync(e,n)}}catch{}return se(n)}function se(r){return N.createHash("sha256").update(Mt).update(r).digest()}function Fe(r,e){let t=N.randomBytes(Ot),n=N.createCipheriv(G,e,t),o=Buffer.concat([n.update(r,"utf8"),n.final()]),i={version:1,algorithm:G,ciphertext:o.toString("base64"),iv:t.toString("base64"),authTag:n.getAuthTag().toString("base64")};return JSON.stringify(i)}function Be(r,e){let t;try{t=JSON.parse(r)}catch{return null}if(!Bt(t))return r;try{let n=N.createDecipheriv(G,e,Buffer.from(t.iv,"base64"));return n.setAuthTag(Buffer.from(t.authTag,"base64")),Buffer.concat([n.update(Buffer.from(t.ciphertext,"base64")),n.final()]).toString("utf8")}catch{return null}}function Bt(r){if(!r||typeof r!="object")return!1;let e=r;return e.version===1&&e.algorithm===G&&typeof e.ciphertext=="string"&&typeof e.iv=="string"&&typeof e.authTag=="string"}import*as m from"fs";import*as j from"path";import*as k from"os";import*as b from"path";import Mn from"json5";var Un=64*1024;function $e(){if(process.platform==="win32"){let r=process.env.LOCALAPPDATA??b.join(k.homedir(),"AppData","Local");return b.join(r,"devecocli-mcp-server","logs")}return process.platform==="darwin"?b.join(k.homedir(),"Library","Logs","devecocli-mcp-server"):b.join(k.homedir(),".local","share","devecocli-mcp-server","logs")}var Ue="mcp-server.log",$t="mcp-server",Ut={maxSize:10*1024*1024,maxFiles:4},ae=class r{fd=null;logDir=null;currentLogFile=null;mode;rotationOptions;currentFileSize=0;currentDate="";isRotating=!1;minLevel;static LEVEL_ORDER={debug:0,info:1,warn:2,error:3};constructor(e,t){this.rotationOptions={...Ut,...t},this.minLevel=e?"debug":"info",e?(this.mode="console",this.logDir=null,this.currentLogFile=null):(this.mode="file",this.logDir=$e(),this.currentLogFile=j.join(this.logDir,Ue),m.existsSync(this.logDir)||m.mkdirSync(this.logDir,{recursive:!0}),this.cleanupOrphanLogFiles(),this.openLogFile())}getCurrentDateString(){let e=new Date,t=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0");return`${t}-${n}-${o}`}getRotatedFileName(e,t){return j.join(this.logDir,`${$t}-${e}.log.${t}`)}fileExists(e){try{return m.accessSync(e,m.constants.F_OK),!0}catch{return!1}}cleanupOrphanLogFiles(){if(this.logDir)try{let e=m.readdirSync(this.logDir),t=[];for(let o of e)if(o===Ue||/^mcp-server-\d{4}-\d{2}-\d{2}\.log\.\d+$/.test(o)){let i=j.join(this.logDir,o),s=m.statSync(i);t.push({name:o,mtime:s.mtime,path:i})}t.sort((o,i)=>i.mtime.getTime()-o.mtime.getTime());let n=1+this.rotationOptions.maxFiles;for(let o=n;o<t.length;o++)try{m.unlinkSync(t[o].path)}catch{}}catch{}}rotateLog(){if(!(this.isRotating||!this.logDir||!this.currentLogFile)){this.isRotating=!0;try{if(this.closeLogFile(),!this.fileExists(this.currentLogFile)){this.isRotating=!1,this.openLogFile();return}let e=this.getCurrentDateString(),t=this.getRotatedFileName(e,this.rotationOptions.maxFiles);this.fileExists(t)&&m.unlinkSync(t);for(let o=this.rotationOptions.maxFiles-1;o>=1;o--){let i=this.getRotatedFileName(e,o),s=this.getRotatedFileName(e,o+1);this.fileExists(i)&&m.renameSync(i,s)}let n=this.getRotatedFileName(e,1);m.renameSync(this.currentLogFile,n),this.cleanupOrphanLogFiles(),this.openLogFile()}catch{this.openLogFile()}finally{this.isRotating=!1}}}openLogFile(){if(this.currentLogFile){this.currentDate=this.getCurrentDateString();try{if(this.fileExists(this.currentLogFile)){let e=m.statSync(this.currentLogFile);this.currentFileSize=e.size}else this.currentFileSize=0}catch{this.currentFileSize=0}try{this.fd=m.openSync(this.currentLogFile,"a")}catch{this.fd=null}}}closeLogFile(){if(this.fd!==null){try{m.closeSync(this.fd)}catch{}this.fd=null}}checkRotation(e){let t=this.getCurrentDateString();this.currentDate&&this.currentDate!==t&&(this.rotateLog(),this.currentDate=t),this.currentFileSize+=e,this.currentFileSize>=this.rotationOptions.maxSize&&this.rotateLog()}write(e,t,...n){if(this.mode==="silent"||r.LEVEL_ORDER[e]<r.LEVEL_ORDER[this.minLevel])return;let o=n.map(c=>c instanceof Error?`${c.name}: ${c.message}`:typeof c=="object"?JSON.stringify(c,null,2):String(c)).join(" "),i=o?`${t} ${o}`:t,a=`[${new Date().toLocaleString("sv-SE",{timeZone:"Asia/Shanghai",hour12:!1})+"."+String(new Date().getMilliseconds()).padStart(3,"0")}] [MCP/${e.toUpperCase()}] [pid=${process.pid}] ${i}
|
|
2
|
+
`;if(this.mode==="file"&&this.currentLogFile){if(this.fd===null&&this.openLogFile(),this.fd!==null)try{let c=Buffer.from(a);m.writeSync(this.fd,c),this.checkRotation(c.byteLength)}catch{this.closeLogFile(),this.openLogFile()}}else this.mode==="console"&&process.stderr.write(a)}debug(e,...t){this.write("debug",e,...t)}info(e,...t){this.write("info",e,...t)}warn(e,...t){this.write("warn",e,...t)}error(e,...t){this.write("error",e,...t)}dispose(){this.closeLogFile()}flush(){if(!(this.mode!=="file"||this.fd===null))try{m.fsyncSync(this.fd)}catch{}}getLogFilePath(){return this.currentLogFile}getLogDirectory(){return this.logDir}},O=null;function Gt(r=!1){O&&O.dispose(),O=new ae(r)}function H(){return O||Gt(!1),O}var d={debug:(r,...e)=>H().debug(r,...e),info:(r,...e)=>H().info(r,...e),warn:(r,...e)=>H().warn(r,...e),error:(r,...e)=>H().error(r,...e)};import He from"fs";import Ht from"path";var V=300*1e3,z=3600*1e3,je=10080*60*1e3,P=8*1024*1024,Ve=3600*1e3,Ge=".pending",jt=/\.reclaim-\d+-\d+$/;function W(){let r=process.env.DEVECO_CLI_DISABLE_TELEMETRY;return r==="1"||r==="true"}var Vt="upload-state.json";function ze(r){return Ht.join(r,Vt)}function zt(){return{firstEventAt:null,lastUploadAt:null,lastRetryAt:null}}function ce(r){try{let e=He.readFileSync(ze(r),"utf8"),t=JSON.parse(e);return{firstEventAt:typeof t.firstEventAt=="number"?t.firstEventAt:null,lastUploadAt:typeof t.lastUploadAt=="number"?t.lastUploadAt:null,lastRetryAt:typeof t.lastRetryAt=="number"?t.lastRetryAt:null}}catch{return zt()}}function ue(r,e){try{He.writeFileSync(ze(r),JSON.stringify(e),"utf8")}catch{}}function We(r){let e=ce(r);e.firstEventAt===null&&(e.firstEventAt=Date.now(),ue(r,e))}function qe(r){let e=ce(r);e.lastUploadAt=Date.now(),e.firstEventAt=null,ue(r,e)}function Ke(r){let e=ce(r);e.lastRetryAt=Date.now(),ue(r,e)}function Xe(r){let e=r.match(/^telemetry-(\d{4})-(\d{2})-(\d{2})\.txt$/);if(!e)return null;let t=Date.parse(`${e[1]}-${e[2]}-${e[3]}T00:00:00`);return Number.isFinite(t)?t:null}function le(r){if(!r.startsWith("telemetry-"))return null;let e=jt.exec(r),t=e?r.slice(0,e.index):r;if(!t.endsWith(Ge))return null;let n=t.slice(0,-Ge.length);return n.endsWith(".txt")?n:null}function q(r){return le(r)!==null}import Wt from"crypto";import K from"fs";import qt from"path";var Kt="install-id";function Xt(r){return qt.join(r,Kt)}function Ye(r){try{let e=K.readFileSync(r,"utf8").trim();return Yt(e)?e:null}catch{return null}}function Yt(r){return/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(r)}function Je(r){let e=Xt(r),t=Ye(e);if(t)return t;let n=Wt.randomUUID();try{K.mkdirSync(r,{recursive:!0});try{K.writeFileSync(e,n,{flag:"wx"})}catch{let o=Ye(e);if(o)return o;K.writeFileSync(e,n)}}catch{}return n}import y from"fs";import T from"path";var Jt="install-id",Zt="trace-file-secret",pe="upload-state.json",Ze="failed";function et(r){return r.startsWith("telemetry-")&&r.endsWith(".txt")||q(r)}function Qt(r){try{return y.readdirSync(r).filter(et)}catch{return[]}}function er(r,e,t){try{return y.existsSync(e)?t?(y.appendFileSync(e,y.readFileSync(r)),y.rmSync(r),!0):!1:(y.renameSync(r,e),!0)}catch{return!1}}function Qe(r,e,t){let n=0;for(let o of r)er(T.join(e,o),T.join(t,o),!0)&&n++;return n}function tt(r){let e=T.dirname(r);e!==r&&(tr(e,r),rr(e,r))}function tr(r,e){for(let t of[Jt,Zt]){let n=T.join(e,t),o=T.join(r,t);if(y.existsSync(n)&&y.existsSync(o))try{y.rmSync(n)}catch{}}}function rr(r,e){let t;try{t=y.readdirSync(r)}catch{return}let n=t.filter(et),o=T.join(r,Ze),i=Qt(o),s=t.includes(pe);if(n.length===0&&i.length===0&&!s)return;let a=T.join(e,Ze);try{y.mkdirSync(e,{recursive:!0}),y.mkdirSync(a,{recursive:!0})}catch{return}let c=Qe(n,r,e)+Qe(i,o,a);nr(r,e,s);try{y.rmdirSync(o)}catch{}c>0&&d.debug(`[telemetry] migrated ${c} legacy trace files into region dir`)}function nr(r,e,t){if(!t)return;let n=T.join(r,pe),o=T.join(e,pe);try{y.existsSync(o)?y.rmSync(n):y.renameSync(n,o)}catch{}}import pr from"axios";var rt={LOGIN_TIMEOUT_MS:6e5,HTTP_TIMEOUT_MS:2e4,TOKEN_VALIDITY_DAYS:30},de={USER_AGENT:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",ACCEPT_LANGUAGE:"zh-CN"};import{getProxyForUrl as dr}from"proxy-from-env";function X(r){try{let e=new URL(r);return`${e.protocol}//${e.host}`}catch{return"<redacted>"}}import{spawn as it}from"child_process";import*as x from"fs";import*as st from"os";import*as Y from"path";var at=6e4;async function or(){if(process.platform!=="win32")return null;let r="HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",e=await nt(r,"ProxyServer");if(!e)return null;let t=await nt(r,"ProxyEnable");return t!=="1"&&t!=="0x1"?null:e.trim()}function nt(r,e){return new Promise(t=>{let n=it("reg.exe",["query",r,"/v",e],{windowsHide:!0,stdio:["ignore","pipe","pipe"]}),o="";n.stdout.on("data",i=>{o+=i.toString()}),n.on("error",()=>t(null)),n.on("close",i=>{if(i!==0){t(null);return}let s=/REG_\w+\s+(\S+)/.exec(o);t(s?s[1]:null)})})}function ir(){let r=process.env.HTTPS_PROXY??process.env.HTTP_PROXY??"";if(!r)return null;try{return new URL(r).host}catch{return r}}function sr(){return`${process.env.SystemRoot??"C:\\Windows"}\\System32\\curl.exe`}function ot(r){let e={},t=0,n="";for(let o of r.split(/\r?\n/)){let i=o.trim();if(!i)continue;let s=/^HTTP\/\d(?:\.\d)?\s+(\d{3})\s*(.*)$/.exec(i);if(s){t=parseInt(s[1],10),n=s[2]??"";continue}let a=/^([^:]+):\s*(.*)$/.exec(i);a&&(e[a[1].toLowerCase()]=a[2])}return{statusCode:t,statusText:n,headers:e}}function ar(r,e,t,n){let o=["--silent","--show-error","--location","--ssl-no-revoke","--insecure","-x",`http://${e}`,"--proxy-ntlm","--proxy-user",":","--max-time",String(Math.max(1,Math.floor((r.timeoutMs??at)/1e3)))];return r.method&&r.method!=="GET"&&o.push("-X",r.method),r.data!==void 0&&o.push("--data-binary",r.data),o.push(...cr(r.headers,r.data!==void 0)),n?(o.push("--dump-header",t),o.push("--output",n)):o.push("--include"),o.push(r.url),o}function cr(r,e){let t=new Set(["content-length","host","connection","proxy-authorization","proxy-connection","accept-encoding"]),n=[],o=!1;for(let[i,s]of Object.entries(r??{})){let a=i.toLowerCase();a==="content-type"&&(o=!0),t.has(a)||n.push("-H",`${i}: ${s}`)}return e&&!o&&n.push("-H","Content-Type: application/json"),n}function ur(r,e,t){if(t){let g=x.readFileSync(e,"utf8"),S=x.readFileSync(t),I=ot(g);return{statusCode:I.statusCode,statusText:I.statusText,body:S.toString("base64"),headers:I.headers,bodyBuffer:S}}let n=r.lastIndexOf("HTTP/");if(n===-1)return null;let o=r.slice(n),i=o.indexOf(`\r
|
|
3
|
+
\r
|
|
4
|
+
`);if(i===-1)return null;let s=o.slice(0,i),a=o.slice(i+4),c=ot(s);return{statusCode:c.statusCode,statusText:c.statusText,body:a,headers:c.headers}}async function ct(r){if(process.platform!=="win32")return null;let e=ir()??await or();if(!e)return null;let t;r.binary&&(t=x.mkdtempSync(Y.join(st.tmpdir(),"curl-")));let n=t?Y.join(t,"header.tmp"):void 0,o=t?Y.join(t,"body.tmp"):void 0;try{let i=ar(r,e,n,o),s=await lr(i,r.timeoutMs);return!s||s.code!==0?null:ur(s.stdout,n,o)}catch{return null}finally{t&&x.rmSync(t,{recursive:!0,force:!0})}}function lr(r,e){let t=sr();return new Promise(n=>{let o=it(t,r,{windowsHide:!0,stdio:["ignore","pipe","pipe"]}),i="",s=!1,a=setTimeout(()=>{s||(s=!0,o.kill())},e??at);o.stdout.on("data",c=>{i+=c.toString()}),o.on("error",()=>{s||(s=!0,clearTimeout(a),n(null))}),o.on("close",c=>{if(clearTimeout(a),s){n(null);return}s=!0,n({code:c??-1,stdout:i})})})}function fe(r){let e=new URL(r),t=ut(e.username,r),n=ut(e.password,r);return{protocol:e.protocol,host:e.hostname,port:e.port?Number.parseInt(e.port,10):e.protocol==="https:"?443:80,...t||n?{auth:{username:t,password:n}}:{}}}function ut(r,e){try{return decodeURIComponent(r)}catch{throw new h("InvalidArgument",`Invalid proxy URL ${JSON.stringify(X(e))}: malformed percent-encoding in credentials. Percent-encode special characters (e.g. '@' as '%40') in the proxy URL.`,"Invalid proxy URL.")}}function mr(r,e){return r==="ETIMEDOUT"||r==="ECONNABORTED"&&/timeout/i.test(e)}function fr(r){let e=`Network connection failed (${r.code}). Please check your proxy configuration or network settings`,t=new h(mr(r.code,r.message)?"Timeout":"RuntimeCondition",`${r.message}
|
|
5
|
+
${e}`,r.code??"Unknown",{cause:r});return t.code=r.code,t.response=r.response,t}var me=class{client;constructor(){let e={timeout:rt.HTTP_TIMEOUT_MS,headers:{"User-Agent":de.USER_AGENT,"accept-language":de.ACCEPT_LANGUAGE},transformResponse:[t=>t]};this.client=pr.create(e),this.client.interceptors.request.use(t=>{if(t.httpsAgent)return t.proxy=!1,t;let n=dr(t.url??"");return t.proxy=n?fe(n):!1,t}),this.client.interceptors.response.use(t=>t,t=>{throw fr(t)})}async get(e,t){try{let n=await this.client.request({method:"GET",url:e,params:t?.params,headers:t?.headers,timeout:t?.timeout,httpsAgent:t?.httpsAgent});return this.convertResponse(n)}catch(n){return this.withCurlFallback(n,e,"GET",t)}}async post(e,t){try{let n=await this.client.request({method:"POST",url:e,data:t?.params,signal:t?.signal,maxContentLength:t?.maxContentLength,maxBodyLength:t?.maxBodyLength,headers:t?.headers,timeout:t?.timeout,httpsAgent:t?.httpsAgent});return this.convertResponse(n)}catch(n){return this.withCurlFallback(n,e,"POST",t)}}convertResponse(e){return{data:typeof e.data=="string"?e.data:JSON.stringify(e.data),statusCode:e.status,statusText:e.statusText??"",headers:e.headers}}parseJson(e){try{return JSON.parse(e.data)}catch(t){throw new h("Internal",`Failed to parse JSON response: ${t instanceof Error?t.message:String(t)}`,"Failed to parse JSON response.",{cause:t})}}async getBinary(e,t){try{let n=await this.client.request({method:"GET",url:e,responseType:"arraybuffer",headers:t?.headers,timeout:t?.timeout,httpsAgent:t?.httpsAgent});if(n.status!==200)throw new h("Internal",`HTTP ${n.status}`,"HTTP request failed.");return Buffer.from(n.data)}catch(n){let o=await this.tryCurlFallback(n,e,"GET",t,!0);if(o?.bodyBuffer){if(o.statusCode!==200)throw new h("Internal",`HTTP ${o.statusCode}`,"HTTP request failed.");return o.bodyBuffer}throw n}}async postAllowFailure(e,t){try{let n=await this.client.request({method:"POST",url:e,data:t?.params,headers:t?.headers,timeout:t?.timeout,httpsAgent:t?.httpsAgent,validateStatus:()=>!0});if(n.status===407)throw Object.assign(new Error("407 Proxy Authentication Required"),{response:{status:407}});return this.convertResponse(n)}catch(n){return this.withCurlFallback(n,e,"POST",t)}}async deleteAllowFailure(e,t){try{let n=await this.client.request({method:"DELETE",url:e,data:t?.params,headers:t?.headers,timeout:t?.timeout,httpsAgent:t?.httpsAgent,validateStatus:()=>!0});if(n.status===407)throw Object.assign(new Error("407 Proxy Authentication Required"),{response:{status:407}});return this.convertResponse(n)}catch(n){return this.withCurlFallback(n,e,"DELETE",t)}}async getBinaryAllowFailure(e,t){try{return await this.requestBinary(e,t)}catch(n){let o=await this.tryCurlFallback(n,e,"GET",t,!0);if(o?.bodyBuffer)return{statusCode:o.statusCode,statusText:o.statusText,buffer:o.bodyBuffer,body:o.bodyBuffer.toString("utf8")};throw n}}async requestBinary(e,t){let n=await this.client.request({method:"GET",url:e,responseType:"arraybuffer",headers:t?.headers,timeout:t?.timeout,httpsAgent:t?.httpsAgent,validateStatus:()=>!0});if(n.status===407)throw Object.assign(new Error("407 Proxy Authentication Required"),{response:{status:407}});let o=Buffer.from(n.data);return{statusCode:n.status,statusText:n.statusText??"",buffer:o,body:o.toString("utf8")}}async withCurlFallback(e,t,n,o){let i=await this.tryCurlFallback(e,t,n,o,!1);if(i)return{data:i.body,statusCode:i.statusCode,statusText:i.statusText,headers:i.headers};throw e}async tryCurlFallback(e,t,n,o,i=!1){if(gr(o)||process.platform!=="win32"||!(e instanceof Error)||!hr(e))return null;let s,a=t;return n==="GET"?o?.params&&(a=yr(t,o.params)):o?.params!==void 0&&o.params!==null&&(s=typeof o.params=="string"?o.params:JSON.stringify(o.params)),ct({url:a,method:n,data:s,headers:o?.headers,timeoutMs:o?.timeout,binary:i})}},ge=new me;function gr(r){return!!r?.signal||(r?.maxBodyLength??-1)>=0||(r?.maxContentLength??-1)>=0}function hr(r){if(r.response?.status===407)return!0;let e=r.message??"";return/proxy auth(?:oriz|entic)/i.test(e)?!0:r.code==="SELF_SIGNED_CERT_IN_CHAIN"||r.code==="DEPTH_ZERO_SELF_SIGNED_CERT"||r.code==="UNABLE_TO_VERIFY_LEAF_SIGNATURE"||r.code==="CERT_HAS_EXPIRED"||r.code==="ERR_TLS_CERT_ALTNAME_INVALID"}function yr(r,e){if(!e||typeof e!="object")return r;let t=new URLSearchParams;for(let[i,s]of Object.entries(e))if(s!=null)if(Array.isArray(s))for(let a of s)t.append(`${i}[]`,String(a));else t.append(i,String(s));let n=t.toString();if(!n)return r;let o=r.includes("?")?"&":"?";return`${r}${o}${n}`}function p(r){if(process.env.DEVECO_CLI_DEBUG){let e=typeof r=="function"?r():r;console.error(`[DEBUG] ${e}`)}}import Er from"fs";import Sr from"http";import vr from"https";import Cr from"path";import lt from"tls";import Ee from"crypto";import{getProxyForUrl as Tr}from"proxy-from-env";import{yellow as br}from"colorette";var Ar=`-----BEGIN CERTIFICATE-----
|
|
6
|
+
MIIF/TCCA+WgAwIBAgIIIQV1CU5bvEMwDQYJKoZIhvcNAQELBQAwUDELMAkGA1UE
|
|
7
|
+
BhMCQ04xDzANBgNVBAoMBkh1YXdlaTETMBEGA1UECwwKSHVhd2VpIENCRzEbMBkG
|
|
8
|
+
A1UEAwwSSHVhd2VpIENCRyBSb290IENBMB4XDTE4MDEzMDA3NDI1OVoXDTM4MDEy
|
|
9
|
+
NTA3NDI1OVowYzELMAkGA1UEBhMCQ04xDzANBgNVBAoMBkh1YXdlaTETMBEGA1UE
|
|
10
|
+
CwwKSHVhd2VpIENCRzEuMCwGA1UEAwwlSHVhd2VpIENCRyBBcHBsaWNhdGlvbiBJ
|
|
11
|
+
bnRlZ3JhdGlvbiBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMCC
|
|
12
|
+
UUvjL5oXThUxFklLXbLNkfHtjs8rlOT3hRE3VmicI7LFJXGMCByB7ORucGDStwIM
|
|
13
|
+
H1ac1pnBsV2dabuQj0WiXbYtRD44IxCN879RJBFry9AV7PypYrxucFqgeqt19PpS
|
|
14
|
+
pSMa4ROBxAyVRq9F6m6HWlBTtlLXvH9yAbPOp+rvaEd5LD7MNsVFOXeMVBoRuhox
|
|
15
|
+
ohrAIB3pzwAjX8fWSoe8Vrz6F3LAIVHE1CzEn0sFUtKIuWVm1l1cGNlsMeUwSMwj
|
|
16
|
+
8PBtTNb9IQaNTsA2qguQgkdPaDda0ENg/FIZ2zHzV9l4k7SrpFvqSde0sEDR9mSf
|
|
17
|
+
IeJ3x5pATJp25X5K1+ZoFZRa7sQHMWA6HOYwfqBXxQmK0pETzjB5zVfXQLnDP0Tq
|
|
18
|
+
K1xcS8X6jJuvkm5F691nu7ypfmZx0RNPTnFZiNOz+Qdzklm1BJHlmNIVbFke6qHU
|
|
19
|
+
HOBX57EAsu2HumkWWyqQ0MaXcpuuLMdU3OZ6vtoSsYevNhN4Ypm2v0Zr3FCSjgnW
|
|
20
|
+
AwU02MNROMCBCRazt4txJ1tEYnmu0Bd5qLJXFWc1zweP52XS6BqeFRYb50M5O/AQ
|
|
21
|
+
I5sXsO10fWN05jezS7jDzqjar7PYNGHuuY6cO5QVo8/t9t/sZ8vHN++Et2BzMKm5
|
|
22
|
+
n11YM6tPJZKKpL0F+ZBa3qgEMFoNxwckvnmT79D5AgMBAAGjgccwgcQwHwYDVR0j
|
|
23
|
+
BBgwFoAUqsTTeUfobiNr7/CpbCJzPXoZaaEwHQYDVR0OBBYEFOHI/wFzBqHgXhMO
|
|
24
|
+
Wqee63/XnhuIMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMGEGA1Ud
|
|
25
|
+
HwRaMFgwVqBUoFKGUGh0dHA6Ly9jcGtpLWNhd2ViLmh1YXdlaS5jb20vY3BraS9z
|
|
26
|
+
ZXJ2bGV0L2NybEZpbGVEb3duLmNybD9jZXJ0eXBlPTEmL3Jvb3RjcmwuY3JsMA0G
|
|
27
|
+
CSqGSIb3DQEBCwUAA4ICAQDPxMXcr1lLbdPHfoncb/QzQpRCQx/EYd7c/7VUKaTX
|
|
28
|
+
V8k4JQ2Z0hHNPPHyjU8MkPg764d+UCcOMkI+PB+zXYKeumQsWks2YRHQQa93bLAO
|
|
29
|
+
NPo0Z8b/r9fjrklCExJT3kA2qThRA4BEfl4WydFS4J2kpdTFxtSbMI77DEllyF8L
|
|
30
|
+
1Nn5mqKCXgZGA3g6vgkxBM/gLaApV9/Mg2QEhTV9WA78+fCbgGVLCYELrvuc+MKl
|
|
31
|
+
jbBnOIoj49tz8VUbjoFJD6AcCBe00qbecDjvx31ERskziWMs+PZ4oNp2zMdsa3Br
|
|
32
|
+
E/vANlEbtTigmTHMora36tEL1JX1cKu+So7I6fykmsPZA3keDHp8treLb4KcbDpL
|
|
33
|
+
cqAu4V8vMqJ8tFU6ilh65HOATWz+g/jEpMPZuiN+qjSYnDFxzts9mWERsSG003S6
|
|
34
|
+
yg9ZnehcA3iRVNPZZ8hSZZH0YKNqxpda/TR6P5qXiHRA6A+MdoBOE4HmuUy3QFV7
|
|
35
|
+
zYl5snR6SmrDfVmtsyz8aMqifx4gsVV2M5/owv8H3bUdOd5RbkKhzOS2Pmep0bbw
|
|
36
|
+
WRFUrWuQ+5ci2LLkZyIt9ffNR8W9gbmZOZZTrwSFRIT1Q433NOzCQNDjKwnekGAx
|
|
37
|
+
8o746tqqZxGCXgy2MaIIqvajhNw9Dr3NBQ8ziWyqaQBk2RrCWh6Q++Sd0b5L3RwH
|
|
38
|
+
rQ==
|
|
39
|
+
-----END CERTIFICATE-----`,xr=new Ee.X509Certificate(Ar),pt=[{cert:xr}];function wr(r){let e=[],t=r.match(/-----BEGIN CERTIFICATE-----[\s\S]*?-----END CERTIFICATE-----/g)??[];for(let n of t)try{e.push({cert:new Ee.X509Certificate(n)})}catch{}return e}var dt=new Set,J;function Rr(){let r=process.env.NODE_EXTRA_CA_CERTS;if(J&&J.envValue===r)return J.anchors;let e=r?Pr(r):[],t=e.length?[...pt,...e]:pt;return J={envValue:r,anchors:t},t}function Pr(r){try{let e=wr(Er.readFileSync(r,"utf8"));return e.length===0&&mt(r,"no parseable certificate found"),e}catch(e){return mt(r,e instanceof Error?e.message:String(e)),[]}}function mt(r,e){dt.has(r)||(dt.add(r),console.warn(br(`[devecocli] GRS TLS: failed to load NODE_EXTRA_CA_CERTS (${Cr.basename(r)}): ${e} \u2014 falling back to the built-in CA only.`)))}function Dr(r){let e=[],t=new Set,n=r;for(;n&&n.raw;){let o=n.fingerprint256||n.fingerprint||"";if(!o||t.has(o))break;t.add(o);try{e.push(new Ee.X509Certificate(n.raw))}catch{break}let i=n.issuerCertificate??null;if(i===r)break;n=i}return e}function Lr(r,e,t){if(r.length===0)return new Error("[GRS TLS] Server did not provide a certificate");if(!Ir(r,t))return p(()=>"[GRS TLS] No trusted anchor (built-in intermediate CA or NODE_EXTRA_CA_CERTS) matched the presented chain"),new Error("[GRS TLS] Server certificate chain is not trusted by the built-in CA or NODE_EXTRA_CA_CERTS");let n=_r(r[0],e);if(n)return n;p(()=>"[GRS TLS] Verification passed: certificate chain anchored on a trusted CA")}function Ir(r,e){for(let n of e){let o=r.findIndex(i=>i.fingerprint256===n.cert.fingerprint256);if(o>=0&&ft(r,o))return!0}let t=r[r.length-1];for(let n of e)if(n.cert.subject===t.issuer)try{if(t.verify(n.cert.publicKey)&&ft(r,r.length-1))return!0}catch{}return!1}function ft(r,e){try{for(let t=e;t>0;t--)if(!r[t-1].verify(r[t].publicKey))return!1;return!0}catch{return!1}}function _r(r,e){let t=Date.now();if(new Date(r.validFrom).getTime()>t||new Date(r.validTo).getTime()<t)return new Error("[GRS TLS] Server certificate is expired or not yet valid");if(!kr(r,e))return new Error(`[GRS TLS] Server certificate does not match host ${e}`)}function Nr(r,e){let t=r.getPeerCertificate(!0);if(!t||!t.raw)return new Error("[GRS TLS] Server did not provide a certificate");let n=Dr(t);return n.length===0?new Error("[GRS TLS] Server certificate could not be parsed"):Lr(n,e,Rr())}function kr(r,e){let t=r.subjectAltName??"",n=e.toLowerCase();for(let o of t.split(",")){let i=o.trim();if(!i.startsWith("DNS:"))continue;let s=i.slice(4).toLowerCase();if(s===n)return!0;if(s.startsWith("*.")){let a=s.slice(1),c=n.slice(0,-a.length);if(n.endsWith(a)&&c.length>0&&!c.includes("."))return!0}}return!1}var Or=8e3,he=class{constructor(e,t){this.callback=e;this.timeoutMs=t}settled=!1;timer;destroyers=[];onDestroy(e){this.destroyers.push(e)}start(){this.timer=setTimeout(()=>{this.settle(new Error(`[GRS] Connection deadline (${this.timeoutMs}ms) exceeded during CONNECT/TLS handshake`))},this.timeoutMs)}settle(e,t){if(!this.settled){if(this.settled=!0,this.timer&&clearTimeout(this.timer),e)for(let n of this.destroyers)try{n()}catch{}this.callback(e,t)}}},ye=class extends vr.Agent{connectTimeoutMs;constructor(e){super(e),this.connectTimeoutMs=e?.connectTimeoutMs??Or}createConnection(e,t){let n=e.host||e.servername||"",o=e.port||443,i=`https://${n}:${o}`,s=Tr(i),a=new he(t,this.connectTimeoutMs);if(a.start(),s){this.createConnectionViaProxy(e,s,n,o,a);return}return this.createDirectConnection(e,a,n)}createDirectConnection(e,t,n){let o=lt.connect({...e,rejectUnauthorized:!1});return t.onDestroy(()=>o.destroy()),this.attachTlsVerification(o,t,n),o}parseProxyOrSettle(e,t){try{return fe(e)}catch(n){return t.settle(new Error(`[GRS] ${n.message}`)),null}}createConnectionViaProxy(e,t,n,o,i){let s=this.parseProxyOrSettle(t,i);if(!s)return;let a=this.buildProxyHeaders(s,n,o);p(()=>`[GRS] Connecting via proxy ${s.host}:${s.port} to ${n}:${o}`);let c=Sr.request({host:s.host,port:s.port,method:"CONNECT",path:`${n}:${o}`,headers:a});i.onDestroy(()=>c.destroy()),c.on("connect",(g,S)=>{if(g.statusCode!==200){S.destroy(),i.settle(new Error(`[GRS] Proxy CONNECT failed: ${g.statusCode} ${g.statusMessage||""}`));return}i.onDestroy(()=>S.destroy()),this.startTlsOverTunnel(e,S,i,n)}),c.on("error",g=>{i.settle(new Error(`[GRS] Proxy connection failed: ${g.message}`))}),c.end()}startTlsOverTunnel(e,t,n,o){p(()=>"[GRS] Proxy tunnel established, starting TLS handshake");let i=lt.connect({...e,socket:t,rejectUnauthorized:!1});n.onDestroy(()=>i.destroy()),this.attachTlsVerification(i,n,o)}buildProxyHeaders(e,t,n){let o={Host:`${t}:${n}`},i=e.auth;if(i&&(i.username||i.password)){let s=`${i.username}:${i.password}`;o["Proxy-Authorization"]=`Basic ${Buffer.from(s).toString("base64")}`}return o}attachTlsVerification(e,t,n){e.once("secureConnect",()=>{let o=Nr(e,n);o?(e.destroy(o),t.settle(o)):t.settle(null,e)}),e.once("error",o=>{t.settle(o)})}},Se=new ye({keepAlive:!0});var ve=[{group:"com.huawei.devecostudio.region",key:"spaceintroduce"},{group:"com.huawei.devecostudio.region",key:"userinfo"},{group:"com.huawei.devecostudio.region",key:"agcsign"},{group:"com.huawei.devecostudio.region",key:"agcups"},{group:"com.huawei.devecostudio.region",key:"agreementservice"}],D=class extends Error{kind;constructor(e,t){super(t),this.name="GrsError",this.kind=e}};var Mr=["https://grs.dbankcloud.com/grs/2.0/router","https://grs.dbankcloud.cn/grs/2.0/router","https://grs.dbankcloud.asia/grs/2.0/router","https://grs.platform.dbankcloud.ru/grs/2.0/router"],Fr="com.huawei.deveco.common-grs/0.1 (Windows;Linux;Mac) Deveco-grs/-1",Br="devecostudio",$r=8e3;async function Ce(r){let e=[],t="";for(let i of Mr){let s=await Ur(i,r);if(s.outcome==="ok")return s.services;e.push(s.outcome),s.detail&&(t=s.detail)}if(e.some(i=>i==="incomplete"))throw new D("no-config",`GRS returned no valid configuration for country code ${r} (this region may not be supported)`);let n=process.env.HTTPS_PROXY||process.env.HTTP_PROXY,o=n?`Current proxy: ${X(n)}. Verify the proxy is running and allows CONNECT to grs.dbankcloud.com:443. If the proxy inspects TLS, set NODE_EXTRA_CA_CERTS to a PEM file with your corporate CA \u2014 untrusted GRS certificates are rejected.`:"No proxy configured (HTTP_PROXY/HTTPS_PROXY). If you are behind a corporate firewall, set HTTPS_PROXY=http://your-proxy:port.";throw new D("network",`GRS endpoints unreachable (grs.dbankcloud.com is globally reachable). ${o}${t?` Last endpoint error: ${t}`:""}`)}async function Ur(r,e){let t=`${r}?issue_country=${encodeURIComponent(e)}&app_name=${Br}`;p(()=>`[GRS] POST ${t}`);try{let n=await ge.post(t,{headers:{"User-Agent":Fr},httpsAgent:Se,timeout:$r}),o=ge.parseJson(n);return o.resultCode!==0?(p(()=>`[GRS] ${r} resultCode=${o.resultCode}, skipping`),{outcome:"incomplete",detail:`resultCode=${o.resultCode}`}):Gr(o.services)?(p(()=>`[GRS] hit ${r}, received ${Object.keys(o.services).length} service groups`),{outcome:"ok",services:o.services}):(p(()=>`[GRS] ${r} returned incomplete config (missing required service keys), skipping`),{outcome:"incomplete",detail:"missing required service keys"})}catch(n){let o=n instanceof Error?n.message:String(n);return p(()=>`[GRS] ${r} request failed: ${o}`),{outcome:"network",detail:o}}}function Gr(r){return ve.every(({group:e,key:t})=>typeof r[e]?.[t]=="string")}import gt from"fs";import Hr from"path";var jr="com.huawei.devecostudio.region",Vr={[jr]:{spaceintroduce:"https://cn.devecostudio.huawei.com",userinfo:"https://gopenuser-drcn.platform.dbankcloud.cn",agcsign:"https://connect-api.cloud.huawei.com",agcups:"https://connect-api.cloud.huawei.com",agreementservice:"https://terms-drcn.platform.dbankcloud.cn",agcdeveloper:"https://developer.huawei.com"}},zr=1440*60*1e3,ht=new Set(["CN","HK","MO"]),Te=class{countryCode="";services={};resolved=!1;isCN(){return this.countryCode==="CN"}isOnlineAllowed(){return ht.has(this.countryCode)}getService(e,t){let n=this.services[e]?.[t];if(!n)throw new h("RuntimeCondition",`GRS service ${e}.${t} not available`,"GRS service not available.");return n}setCountryCode(e){this.countryCode=e}async resolve(){if(!this.countryCode)throw new h("RuntimeCondition","Country code not set, cannot resolve GRS","Country code not set.");if(this.countryCode==="CN"){this.services=Vr,this.resolved=!0,p(()=>"[GRS] CN uses hardcoded services, skipping GRS request");return}let e=await Wr(this.countryCode);if(e){this.services=e.services,this.resolved=!0,p(()=>`[GRS] cache hit country=${this.countryCode}, skipping request`);return}p(()=>`[GRS] cache miss or expired, requesting GRS country=${this.countryCode}`);let t=await Ce(this.countryCode);this.services=t,this.resolved=!0,await qr(this.countryCode,t)}},C=new Te;function yt(r){return Hr.join(R(),`grs_${r}.json`)}async function Wr(r){try{let e=await gt.promises.readFile(yt(r),"utf8"),t=JSON.parse(e);return t.countryCode!==r||Date.now()-t.fetchedAt>zr?null:t}catch{return null}}async function qr(r,e){let t={services:e,fetchedAt:Date.now(),countryCode:r};try{await gt.promises.writeFile(yt(r),JSON.stringify(t),"utf8")}catch{}}function St(){return!W()&&C.isCN()}var M=class r{static MAX_BATCH=200;static MAX_PAYLOAD_BYTES=Math.floor(1.7*1024*1024);static TRACE_OS_VERSION="1.0";static COUNTRY_CODE="CN";static EVENT_PREFIX="devecocli_";uploader=new $;storageDir="";failedDir="";installId="";get disabled(){return!St()}traceFileKey=Buffer.alloc(0);sessionId=Et.randomUUID();cliVersion="";devecoStudioVersion=null;sourceType="";cltVersion=null;nodeVersion="";initialTimer=null;intervalTimer=null;retryInitialTimer=null;retryTimer=null;flushChain=Promise.resolve();constructor(){d.debug(`[telemetry] instance created, sessionId=${this.sessionId}`)}init(e){this.storageDir=e,this.failedDir=E.join(e,"failed"),this.cliVersion="1.4.0-Test.912",this.nodeVersion=process.version,f.mkdirSync(e,{recursive:!0}),f.mkdirSync(this.failedDir,{recursive:!0});let t=E.dirname(e);this.installId=Je(t).replace(/-/g,""),this.traceFileKey=Me(t),tt(e),d.debug(`[telemetry] init: dir=${e}, failedDir=${this.failedDir}, cliVersion=${this.cliVersion}, os=${this.resolveOsName()}, arch=${this.resolveOsArch()}, node=${this.nodeVersion}`)}setStudioVersion(e){this.devecoStudioVersion=e,d.debug(`[telemetry] studio version set: ${e}`)}setSourceType(e){this.sourceType=e,d.debug(`[telemetry] sourceType set: ${e}`)}setCltVersion(e){this.cltVersion=e,d.debug(`[telemetry] CLT version set: ${e}`)}async track(e,t){if(this.disabled)return typeof t=="function"?t():void 0;if(!this.storageDir)return d.debug("[telemetry] track skipped: telemetry not initialized"),typeof t=="function"?t():void 0;if(!t){await this.record(e,0,!0,null);return}if(typeof t!="function"){let i=t;await this.record(e,i.duration_ms,i.success,i.error_code);return}let n=t,o=Date.now();try{let i=await n(),s=Date.now()-o;return await this.record(e,s,!0,null),i}catch(i){let s=Date.now()-o,a=this.resolveErrorCode(i);throw await this.record(e,s,!1,a),i}}resolveErrorCode(e){try{return te(e)}catch{return null}}async record(e,t,n,o){try{let i=this.buildTraceEvent(e,t,n,o),s=Fe(JSON.stringify(i),this.traceFileKey);await f.promises.appendFile(this.currentFile(),s+`
|
|
40
|
+
`,"utf8"),We(this.storageDir)}catch{}}buildTraceEvent(e,t,n,o){let i=`${r.EVENT_PREFIX}${e.event}`,s=Ne.toObject(e);return s&&typeof s=="object"&&delete s.event,{countryCode:r.COUNTRY_CODE,event:i,eventtime:String(Date.now()),properties:{uid:this.installId,trace_uuid:Et.randomUUID(),trace_os_version:r.TRACE_OS_VERSION,os_arch:this.resolveOsArch(),action:i,trace_os_name:this.resolveOsName(),version:`${this.cliVersion}_${this.resolveOsSuffix()}`,deveco_studio_version:this.formatVersion(this.devecoStudioVersion),command_line_version:this.formatVersion(this.cltVersion),source_type:this.sourceType,session_id:this.sessionId,node_version:this.nodeVersion,ram:this.resolveTotalRam(),duration_ms:t,success:n,error_code:o,event_detail:s}}}resolveOsArch(){let e=Z.arch();return e==="x64"?"amd64":e}resolveOsName(){switch(process.platform){case"win32":{let e=Z.release().split(".");return(parseInt(e[e.length-1],10)||0)>=22e3?"Windows 11":"Windows 10"}case"darwin":return"macOS";case"linux":return"Linux";default:return process.platform}}resolveOsSuffix(){switch(process.platform){case"win32":return"windows";case"darwin":return Z.arch()==="arm64"?"mac_arm":"mac";default:return"linux"}}resolveTotalRam(){return`${Math.round(Z.totalmem()/1024)}KB`}formatVersion(e){return e?`${e}_${this.resolveOsSuffix()}`:""}dateString(){let e=new Date,t=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${e.getFullYear()}-${t}-${n}`}currentFile(){return E.join(this.storageDir,`telemetry-${this.dateString()}.txt`)}startScheduler(){if(this.stopScheduler(),this.disabled){d.debug("[telemetry] scheduler not started (telemetry disabled)");return}d.debug(`[telemetry] scheduler started (flush every ${V/1e3}s, retry failed every ${z/1e3}s)`),this.initialTimer=setTimeout(()=>{this.flush().catch(()=>{}),this.intervalTimer=setInterval(()=>{this.flush().catch(()=>{})},V)},V),this.retryInitialTimer=setTimeout(()=>{this.retryFailed().catch(()=>{}),this.retryTimer=setInterval(()=>{this.retryFailed().catch(()=>{})},z)},z)}stopScheduler(){this.initialTimer&&(clearTimeout(this.initialTimer),this.initialTimer=null),this.intervalTimer&&(clearInterval(this.intervalTimer),this.intervalTimer=null),this.retryInitialTimer&&(clearTimeout(this.retryInitialTimer),this.retryInitialTimer=null),this.retryTimer&&(clearInterval(this.retryTimer),this.retryTimer=null),d.debug("[telemetry] scheduler stopped")}async flush(){return this.disabled?!0:this.runExclusive(()=>this.performFlush())}async performFlush(){if(!this.storageDir)return d.debug("[telemetry] flush skipped: telemetry not initialized"),!0;let e=await this.listPendingFiles(),t=!0;for(let n of e)await this.flushFile(n)||(t=!1);return qe(this.storageDir),t}async retryFailed(){return this.disabled?!0:this.runExclusive(()=>this.performRetryFailed())}async performRetryFailed(){if(!this.storageDir)return d.debug("[telemetry] retryFailed skipped: telemetry not initialized"),!0;await this.reclaimStalePending();let e=Date.now(),t;try{t=await f.promises.readdir(this.failedDir)}catch{return!0}let n=t.filter(i=>i.startsWith("telemetry-")&&i.endsWith(".txt")).map(i=>E.join(this.failedDir,i)),o=!0;for(let i of n){let s=E.basename(i),a=Xe(s);if(a!==null){if(e-a>je){try{await f.promises.unlink(i)}catch{}continue}await this.flushFile(i)||(o=!1)}}return o||d.warn("[telemetry] retry failed"),Ke(this.storageDir),o}async reclaimStalePending(){let e=Date.now();for(let t of[this.storageDir,this.failedDir]){let n;try{n=await f.promises.readdir(t)}catch{continue}for(let o of n)q(o)&&await this.reclaimOrphan(E.join(t,o),e)}}async reclaimOrphan(e,t){let n;try{let g=await f.promises.stat(e);if(t-g.mtimeMs<Ve)return;n=g.size}catch{return}let o=E.dirname(e),i=le(E.basename(e));if(i===null)return;let s=await this.claimOrphan(e,o,i);if(s===null)return;let a=E.join(o,i),c=P-await this.fileSize(a);if(n>c){try{await f.promises.unlink(s)}catch{}d.warn(`[telemetry] dropped stale orphan pending: ${s} (${n} bytes > budget ${c})`);return}if(await this.mergeOrphanInto(s,a)){d.warn(`[telemetry] reclaimed orphan pending: ${s} (${n} bytes)`);return}d.warn(`[telemetry] merge failed, kept orphan pending for retry: ${s} (${n} bytes)`)}async claimOrphan(e,t,n){let o=E.join(t,`${n}.pending.reclaim-${process.pid}-${Date.now()}`);try{await f.promises.rename(e,o)}catch{return null}return await this.touch(o),o}async mergeOrphanInto(e,t){try{await f.promises.appendFile(t,await f.promises.readFile(e))}catch(n){return d.warn(`[telemetry] merge orphan pending failed: ${e} -> ${t}: ${n instanceof Error?n.message:String(n)}`),!1}try{await f.promises.unlink(e)}catch(n){d.warn(`[telemetry] merged but failed to remove orphan pending: ${e}: ${n instanceof Error?n.message:String(n)}`)}return!0}async fileSize(e){try{return(await f.promises.stat(e)).size}catch{return 0}}async touch(e){let t=new Date;try{await f.promises.utimes(e,t,t)}catch{}}runExclusive(e){let t=()=>e(),n=this.flushChain.then(t,t);return this.flushChain=n.then(()=>{},()=>{}),n}async listPendingFiles(){let e;try{e=await f.promises.readdir(this.storageDir)}catch{return[]}return e.filter(t=>t.startsWith("telemetry-")&&t.endsWith(".txt")).map(t=>E.join(this.storageDir,t)).sort()}async flushFile(e){let t=await this.fileSize(e);if(t>P){d.warn(`[telemetry] ${E.basename(e)} is ${t} bytes (> ${P}), dropped without uploading`);try{await f.promises.unlink(e)}catch{}return!0}let n=e+".pending";try{await f.promises.rename(e,n)}catch{return!1}await this.touch(n);let o;try{o=await f.promises.readFile(n,"utf8")}catch{return!1}let i=o.split(`
|
|
41
|
+
`).map(s=>s.trim()).filter(Boolean);if(i.length===0){try{await f.promises.unlink(n)}catch{}return!0}return this.uploadInBatches(n,i)}collectDecryptBatch(e,t){let n=[],o=16,i=t;for(;i<e.length&&n.length<r.MAX_BATCH;){let s=Be(e[i],this.traceFileKey);if(s===null){i++;continue}let a=Buffer.byteLength(s,"utf8")+1;if(n.length>0&&o+a>r.MAX_PAYLOAD_BYTES)break;n.push(s),o+=a,i++}return{batch:n,next:i}}async uploadInBatches(e,t){let n=0;for(;n<t.length;){let o=n,{batch:i,next:s}=this.collectDecryptBatch(t,n);n=s;let a=this.buildPayloadItems(i);if(a.length===0)continue;let c=JSON.stringify(a),g=!1;try{g=await this.uploader.upload(c,this.installId)}catch{}if(!g){d.warn("[telemetry] upload failed");let S=t.slice(o).join(`
|
|
42
|
+
`)+`
|
|
43
|
+
`;return await this.moveToFailed(e,S),!1}}try{await f.promises.unlink(e)}catch{}return!0}buildPayloadItems(e){let t=[];for(let n of e)try{let o=JSON.parse(n);t.push({action:o.event,detail:JSON.stringify(o.properties),timestamp:Number(o.eventtime)||Date.now()})}catch{}return t}async moveToFailed(e,t){let n=E.basename(e,".pending"),o=E.join(this.failedDir,n),i=t.split(`
|
|
44
|
+
`).filter(Boolean),s=P-await this.fileSize(o),a=this.takeNewestWithinBudget(i,s);a.length<i.length&&d.warn(`[telemetry] failed file capped at ${P} bytes, dropped ${i.length-a.length} older events`);try{a.length>0&&await f.promises.appendFile(o,a.join(`
|
|
45
|
+
`)+`
|
|
46
|
+
`,"utf8")}catch{return}try{await f.promises.unlink(e)}catch{}}takeNewestWithinBudget(e,t){if(t<=0)return[];let n=[],o=0;for(let i=e.length-1;i>=0;i--){let s=Buffer.byteLength(e[i],"utf8")+1;if(o+s>t)break;o+=s,n.push(e[i])}return n.reverse(),n}};var L=new M;import{execFile as Ki,spawn as Xi}from"child_process";import{existsSync as Ji,readdirSync as Zi,readFileSync as Qi}from"fs";import{spawn as ds}from"child_process";import{existsSync as fs}from"fs";import{dirname as hs,join as ys}from"path";import{fileURLToPath as Ss}from"url";var Xr=new Set(["C","POSIX"]);function be(){let r=Yr();if(!r)return p("[region] locale \u65E0\u4FE1\u53F7"),null;if(p(()=>`[region] locale=${r}`),Xr.has(r))return p("[region] locale=C/POSIX\uFF0C\u89C6\u4E3A\u65E0\u4FE1\u53F7\uFF0C\u4EA4\u7531\u65F6\u533A\u515C\u5E95"),null;let e=r.split(".")[0],t=Jr(e);return t?(p(()=>`[region] locale region=${t}`),t):(p(()=>`[region] locale=${r} \u65E0 region \u5B50\u6807\u7B7E`),null)}function Yr(){let r=process.env.LC_ALL||process.env.LC_MESSAGES||process.env.LANG;if(r)return r.trim();try{return Intl.DateTimeFormat().resolvedOptions().locale||null}catch{return null}}function Jr(r){let e=r.split(/[-_]/);if(e.length<2)return null;for(let t=e.length-1;t>=0;t--){let n=e[t];if(/^[A-Za-z]{2}$/.test(n))return n.toUpperCase()}return null}var Ae={"Asia/Shanghai":"CN","Asia/Urumqi":"CN","Asia/Hong_Kong":"HK","Asia/Macau":"MO","Asia/Taipei":"TW","Asia/Tokyo":"JP","Asia/Seoul":"KR","Asia/Pyongyang":"KP","Asia/Ulaanbaatar":"MN","Asia/Singapore":"SG","Asia/Bangkok":"TH","Asia/Jakarta":"ID","Asia/Makassar":"ID","Asia/Jayapura":"ID","Asia/Manila":"PH","Asia/Kuala_Lumpur":"MY","Asia/Kuching":"MY","Asia/Ho_Chi_Minh":"VN","Asia/Phnom_Penh":"KH","Asia/Vientiane":"LA","Asia/Yangon":"MM","Asia/Brunei":"BN","Asia/Dili":"TL","Asia/Kolkata":"IN","Asia/Calcutta":"IN","Asia/Mumbai":"IN","Asia/Delhi":"IN","Asia/Karachi":"PK","Asia/Dhaka":"BD","Asia/Colombo":"LK","Asia/Kathmandu":"NP","Asia/Thimphu":"BT","Asia/Male":"MV","Asia/Almaty":"KZ","Asia/Aqtobe":"KZ","Asia/Qyzylorda":"KZ","Asia/Tashkent":"UZ","Asia/Dushanbe":"TJ","Asia/Bishkek":"KG","Asia/Ashgabat":"TM","Asia/Dubai":"AE","Asia/Riyadh":"SA","Asia/Qatar":"QA","Asia/Bahrain":"BH","Asia/Kuwait":"KW","Asia/Muscat":"OM","Asia/Aden":"YE","Asia/Baghdad":"IQ","Asia/Tehran":"IR","Asia/Jerusalem":"IL","Asia/Tel_Aviv":"IL","Asia/Beirut":"LB","Asia/Damascus":"SY","Asia/Amman":"JO","Asia/Kabul":"AF","Asia/Baku":"AZ","Asia/Yerevan":"AM","Asia/Tbilisi":"GE","Asia/Nicosia":"CY","Europe/London":"GB","Europe/Dublin":"IE","Europe/Paris":"FR","Europe/Berlin":"DE","Europe/Madrid":"ES","Europe/Rome":"IT","Europe/Amsterdam":"NL","Europe/Brussels":"BE","Europe/Vienna":"AT","Europe/Zurich":"CH","Europe/Stockholm":"SE","Europe/Oslo":"NO","Europe/Copenhagen":"DK","Europe/Helsinki":"FI","Europe/Warsaw":"PL","Europe/Prague":"CZ","Europe/Budapest":"HU","Europe/Moscow":"RU","Europe/Kaliningrad":"RU","Europe/Lisbon":"PT","Europe/Athens":"GR","Europe/Istanbul":"TR","Europe/Kyiv":"UA","Europe/Kiev":"UA","Europe/Minsk":"BY","Europe/Bucharest":"RO","Europe/Sofia":"BG","Europe/Belgrade":"RS","Europe/Zagreb":"HR","Europe/Ljubljana":"SI","Europe/Sarajevo":"BA","Europe/Skopje":"MK","Europe/Tirane":"AL","Europe/Riga":"LV","Europe/Tallinn":"EE","Europe/Vilnius":"LT","Europe/Chisinau":"MD","America/New_York":"US","America/Chicago":"US","America/Denver":"US","America/Los_Angeles":"US","America/Phoenix":"US","America/Anchorage":"US","America/Juneau":"US","America/Honolulu":"US","America/Toronto":"CA","America/Vancouver":"CA","America/Halifax":"CA","America/Edmonton":"CA","America/Winnipeg":"CA","America/Mexico_City":"MX","America/Sao_Paulo":"BR","America/Argentina/Buenos_Aires":"AR","America/Buenos_Aires":"AR","America/Santiago":"CL","America/Lima":"PE","America/Bogota":"CO","America/Caracas":"VE","America/Guayaquil":"EC","America/La_Paz":"BO","America/Asuncion":"PY","America/Montevideo":"UY","America/Havana":"CU","America/Santo_Domingo":"DO","America/Jamaica":"JM","America/Port-au-Prince":"HT","Australia/Sydney":"AU","Australia/Melbourne":"AU","Australia/Brisbane":"AU","Australia/Perth":"AU","Australia/Adelaide":"AU","Australia/Hobart":"AU","Pacific/Auckland":"NZ","Pacific/Fiji":"FJ","Pacific/Guam":"GU","Africa/Cairo":"EG","Africa/Lagos":"NG","Africa/Johannesburg":"ZA","Africa/Nairobi":"KE","Africa/Casablanca":"MA","Africa/Algiers":"DZ","Africa/Tunis":"TN","Africa/Accra":"GH","Africa/Addis_Ababa":"ET","Africa/Dar_es_Salaam":"TZ","Africa/Khartoum":"SD","Africa/Tripoli":"LY"};function xe(){let r=be();if(r)return{code:r,source:"locale"};let e=vt();return e?{code:e,source:"timezone"}:(p("[region] Country code detection failed (no signal from locale or timezone)"),null)}function vt(){let r;try{r=Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return null}if(!r)return null;let e=Ae[r];return e?(p(()=>`[region] timezone ${r} -> ${e}`),e):(p(()=>`[region] timezone ${r} has no country mapping`),null)}import Ct from"fs";import Tt from"path";import{homedir as Zr}from"os";var Qr="country.region.xml",en=".config",tn="deveco-cli";function bt(){let r=process.env.DEVECO_CLI_DATA_DIR?R():Tt.join(Zr(),en,tn);return Tt.join(r,Qr)}function we(){let r=bt();try{if(!Ct.existsSync(r))return null;let t=Ct.readFileSync(r,"utf8").match(/<countryregion\s+name="([A-Za-z]{2})"/);return t?t[1].toUpperCase():(p(()=>`[region] country.region.xml malformed: ${r}`),null)}catch(e){return p(()=>`[region] failed to read country.region.xml: ${e.message}`),null}}var At=we();if(At)C.setCountryCode(At);else{let r=xe();r&&C.setCountryCode(r.code)}if(!C.isCN())d.info("[telemetry] background upload skipped (non-CN region)");else{let r=rn.join(R(),"TraceLogData",C.countryCode);L.init(r),(async()=>{try{await L.flush(),await L.retryFailed()}catch(e){d.warn("[telemetry] background upload error:",e),process.exit(1)}})()}
|
package/package.json
CHANGED
|
@@ -1,6 +1,93 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yinsen/deveco-cli-common",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.4.0-Test.912",
|
|
4
|
+
"description": "HarmonyOS application development command line tool",
|
|
5
|
+
"supportedDocsApi": 1,
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"templates",
|
|
11
|
+
"src/resources",
|
|
12
|
+
"!src/resources/**/*.test.ts",
|
|
13
|
+
"NOTICE",
|
|
14
|
+
"skills"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"prebuild": "node ../../scripts/sync-cli-docs.mjs",
|
|
18
|
+
"build": "npm run build -w design2arkts-engine && tsup",
|
|
19
|
+
"dev": "tsx watch src/cli.ts",
|
|
20
|
+
"start": "tsx src/cli.ts",
|
|
21
|
+
"prebundle:skills": "node ../../scripts/sync-cli-docs.mjs",
|
|
22
|
+
"bundle:skills": "tsx scripts/bundle-skills.ts",
|
|
23
|
+
"precheck:skills": "node ../../scripts/sync-cli-docs.mjs",
|
|
24
|
+
"check:skills": "tsx scripts/bundle-skills.ts --check",
|
|
25
|
+
"check:pack": "node ../../scripts/check-pack.mjs",
|
|
26
|
+
"test": "vitest run",
|
|
27
|
+
"lint": "eslint \"src/**/*.ts\"",
|
|
28
|
+
"lint:fix": "eslint src --fix",
|
|
29
|
+
"format": "prettier --write src",
|
|
30
|
+
"prepack": "node ../../scripts/sync-cli-docs.mjs",
|
|
31
|
+
"prepublishOnly": "npm run lint && npm run build && npm run check:skills && npm run check:pack"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=22"
|
|
35
|
+
},
|
|
36
|
+
"os": [
|
|
37
|
+
"darwin",
|
|
38
|
+
"linux",
|
|
39
|
+
"win32"
|
|
40
|
+
],
|
|
41
|
+
"cpu": [
|
|
42
|
+
"x64",
|
|
43
|
+
"arm64"
|
|
44
|
+
],
|
|
45
|
+
"keywords": [
|
|
46
|
+
"harmonyos",
|
|
47
|
+
"deveco",
|
|
48
|
+
"cli"
|
|
49
|
+
],
|
|
50
|
+
"dependencies": {
|
|
51
|
+
"@agentclientprotocol/sdk": "^2.4.0",
|
|
52
|
+
"@ai-sdk/anthropic": "^4.0.99",
|
|
53
|
+
"@ai-sdk/openai": "^4.0.111",
|
|
54
|
+
"@ai-sdk/openai-compatible": "^3.0.87",
|
|
55
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
56
|
+
"@xmldom/xmldom": "^0.8.15",
|
|
57
|
+
"adm-zip": "0.6.1",
|
|
58
|
+
"ai": "^7.0.166",
|
|
59
|
+
"axios": "1.20.0",
|
|
60
|
+
"colorette": "^2.0.20",
|
|
61
|
+
"commander": "^13.1.0",
|
|
62
|
+
"execa": "^9.6.1",
|
|
63
|
+
"fs-extra": "^11.3.4",
|
|
64
|
+
"global-agent": "^4.1.3",
|
|
65
|
+
"hypium-driver": "6.1.210",
|
|
66
|
+
"json5": "^2.2.3",
|
|
67
|
+
"mp4box": "^2.4.1",
|
|
68
|
+
"node-forge": "^1.4.0",
|
|
69
|
+
"ora": "^9.4.0",
|
|
70
|
+
"p-limit": "^5.0.0",
|
|
71
|
+
"proper-lockfile": "^4.1.2",
|
|
72
|
+
"proxy-from-env": "^2.1.0",
|
|
73
|
+
"semver": "^7.8.5",
|
|
74
|
+
"smol-toml": "^1.6.1",
|
|
75
|
+
"socket.io-client": "^4.7.5",
|
|
76
|
+
"ui-verification-mcp": "0.0.21",
|
|
77
|
+
"ws": "^8.21.1",
|
|
78
|
+
"xpath": "^0.0.35",
|
|
79
|
+
"yaml": "^2.9.1",
|
|
80
|
+
"zod": "^4.4.3",
|
|
81
|
+
"@yinsen/deveco-cli-knowledgebase": "1.4.0-Test.912"
|
|
82
|
+
},
|
|
83
|
+
"devDependencies": {
|
|
84
|
+
"@types/adm-zip": "^0.5.8",
|
|
85
|
+
"@types/fs-extra": "^11.0.4",
|
|
86
|
+
"@types/global-agent": "^3.0.0",
|
|
87
|
+
"@types/node-forge": "^1.3.14",
|
|
88
|
+
"@types/proper-lockfile": "^4.1.4",
|
|
89
|
+
"@types/semver": "^7.7.1",
|
|
90
|
+
"@types/ws": "^8.18.2",
|
|
91
|
+
"design2arkts-engine": "0.1.0"
|
|
92
|
+
}
|
|
93
|
+
}
|