@harmonyos-arkts/d2h 0.1.10 → 0.1.12
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/.claude-plugin/marketplace.json +15 -13
- package/.claude-plugin/plugin.json +13 -7
- package/AGENTS.md +5 -5
- package/README.md +212 -212
- package/agents/android-to-hmos-00-orchestrator.md +318 -318
- package/agents/d2h.md +157 -157
- package/dist/bin/install-opencode.js +30 -30
- package/docs/environment-check.md +86 -86
- package/install-opencode.sh +160 -160
- package/opencode/agents.json +16 -16
- package/opencode/vscode-d2h-package.json +7 -7
- package/opencode/vscode-d2h-plugin.mjs +29 -29
- package/package.json +54 -54
- package/schemas/android-source-manifest.schema.json +25 -25
- package/schemas/checkpoint-provenance.schema.json +67 -67
- package/schemas/final-acceptance.schema.json +29 -29
- package/schemas/managed-evidence-index.schema.json +15 -15
- package/schemas/managed-evidence.schema.json +114 -114
- package/schemas/migration-config.schema.json +51 -51
- package/schemas/migration-report-index.schema.json +39 -39
- package/schemas/migration-report-item.schema.json +51 -51
- package/schemas/migration-report-summary.schema.json +25 -25
- package/schemas/migration-status.schema.json +202 -202
- package/schemas/preflight.schema.json +60 -60
- package/schemas/source-order-audit.schema.json +16 -16
- package/schemas/source-provenance-event.schema.json +19 -19
- package/schemas/spec-app-shard.schema.json +45 -45
- package/schemas/spec-fact-corrections-shard.schema.json +13 -13
- package/schemas/spec-features-shard.schema.json +43 -43
- package/schemas/spec-index.schema.json +26 -26
- package/schemas/spec-interactions-shard.schema.json +40 -40
- package/schemas/spec-page.schema.json +98 -98
- package/schemas/spec-pages-index.schema.json +1 -1
- package/schemas/spec-unresolved-shard.schema.json +1 -1
- package/schemas/task-envelope.schema.json +109 -109
- package/schemas/task-plan.schema.json +341 -341
- package/scripts/check-environment.mjs +320 -320
- package/skills/android2hmos_resources_convert/SKILL.md +180 -180
- package/skills/android2hmos_resources_convert/references/image-conversion-rules.md +230 -230
- package/skills/android2hmos_resources_convert/references/svg-fix-patterns.md +175 -175
- package/skills/android2hmos_resources_convert/references/xml-drawable-to-svg-rules.md +513 -513
- package/skills/arkts-app-identity/SKILL.md +238 -238
- package/skills/arkts-i18n/SKILL.md +496 -496
- package/skills/arkts-i18n/evals/evals.json +84 -84
- package/skills/arkts-i18n/references/code-examples.md +302 -302
- package/skills/arkts-i18n/references/common-pitfalls.md +391 -391
- package/skills/arkts-i18n/references/dynamic-language-switch.md +604 -604
- package/skills/arkts-i18n/references/hardcoded-string-scanner.md +348 -348
- package/skills/arkts-i18n/references/language-codes.md +104 -104
- package/skills/arkts-i18n/references/resource-file-structure.md +775 -775
- package/skills/arkts-i18n/references/static-vs-dynamic.md +242 -242
- package/skills/arkts-i18n/references/v1-compat.md +244 -244
- package/skills/arkts-i18n/scripts/audit_i18n_completeness.sh +174 -174
- package/skills/arkts-icon-sizing/SKILL.md +211 -211
- package/skills/arkts-icon-sizing/scripts/icon_audit.py +131 -131
- package/skills/arkts-icon-sizing/scripts/icon_autofix.py +88 -88
- package/skills/arkts-icon-sizing/scripts/icon_dims.py +179 -179
- package/skills/arkts-icon-sizing/scripts/icon_fix.py +119 -119
- package/skills/arkts-mvvm-architecture/SKILL.md +613 -613
- package/skills/d2h-hypium-forge/SKILL.md +309 -309
- package/skills/d2h-hypium-forge/references/functional-spec-template.md +140 -140
- package/skills/d2h-hypium-forge/references/official-api.md +135 -135
- package/skills/d2h-hypium-forge/references/pitfalls.md +98 -98
- package/skills/d2h-hypium-forge/references/testability-template.md +71 -71
- package/skills/d2h-hypium-forge/scripts/_common_template.py +659 -659
- package/skills/d2h-hypium-forge/scripts/analyze_results.py +165 -165
- package/skills/d2h-hypium-forge/scripts/assert_audit.py +107 -107
- package/skills/d2h-hypium-forge/scripts/collect_runtime_pages.py +169 -169
- package/skills/d2h-hypium-forge/scripts/forge_report.py +325 -325
- package/skills/d2h-hypium-forge/scripts/inject_resource_ids.py +114 -114
- package/skills/d2h-hypium-forge/scripts/lint_asserts.py +80 -80
- package/skills/d2h-hypium-forge/scripts/lint_locate.py +60 -60
- package/skills/d2h-hypium-forge/scripts/merge_appgraph.py +249 -249
- package/skills/d2h-hypium-forge/scripts/precondition.py +140 -140
- package/skills/d2h-hypium-forge/scripts/preinject_ids.py +232 -232
- package/skills/d2h-hypium-forge/scripts/probe.py +197 -197
- package/skills/d2h-hypium-forge/scripts/run_direct.py +823 -823
- package/skills/d2h-hypium-forge/scripts/run_parallel.py +121 -121
- package/skills/d2h-hypium-forge/scripts/scan_features.py +255 -255
- package/skills/d2h-hypium-forge/scripts/upgrade_asserts.py +66 -66
- package/skills/d2h-hypium-forge/scripts/validate_scenarios.py +84 -84
- package/skills/d2h-page-develop/SKILL.md +112 -112
- package/skills/d2h-page-develop/agents/openai.yaml +7 -7
- package/skills/d2h-page-spec-generate/SKILL.md +206 -206
- package/skills/d2h-page-spec-generate/scripts/build_batch_report.py +227 -227
- package/skills/d2h-utg-ai-generate/SKILL.md +128 -128
- package/skills/d2h-utg-ai-generate/references/click-paths-schema.json +76 -76
- package/skills/d2h-utg-ai-generate/references/extraction-guide.md +34 -34
- package/skills/d2h-utg-ai-generate/references/facts-contract.md +96 -96
- package/skills/d2h-utg-ai-generate/references/page-schema.json +61 -61
- package/skills/d2h-utg-ai-generate/references/utg-schema.json +89 -89
- package/skills/d2h-utg-ai-generate/scripts/build_page_json.py +314 -314
- package/skills/d2h-utg-ai-generate/scripts/build_utg.py +123 -123
- package/skills/d2h-utg-ai-generate/scripts/capture_from_page_json.ts +280 -280
- package/skills/d2h-utg-ai-generate/scripts/utg_common.py +524 -524
- package/skills/d2h-utg-ai-generate/scripts/utg_html.py +489 -489
- package/skills/d2h-utg-ai-generate/scripts/validate_utg.py +69 -69
- package/skills/d2h-utg-ai-generate/scripts/vendor/D3-LICENSE +13 -13
- package/skills/d2h-utg-ai-generate/scripts/vendor/d3-7.9.0.min.js +2 -2
- package/skills/d2h-utg-ai-generate/tests/test_pipeline.py +369 -369
- package/skills/d2h-utg-static-generate/SKILL.md +73 -73
- package/skills/d2h-utg-static-generate/references/discoveries.md +38 -38
- package/skills/d2h-utg-static-generate/scripts/generate.py +499 -499
- package/skills/d2h-utg-static-generate/tests/test_static.py +335 -335
- package/skills/d2h-utg-static-generate/tests/verify-offline-html.py +60 -60
- package/skills/d2h-utg-static-generate/tests/verify-produced-fixture.py +131 -131
- package/skills/harmonyos-migration-playbook/SKILL.md +83 -83
- package/skills/harmonyos-migration-playbook/agents/openai.yaml +7 -7
- package/skills/harmonyos-migration-playbook/references/arkts-compile.md +24 -24
- package/skills/harmonyos-migration-playbook/references/harmony-runtime.md +53 -53
- package/skills/harmonyos-migration-playbook/references/lesson-lifecycle.md +45 -45
- package/skills/harmonyos-migration-playbook/references/protocol-e2e.md +23 -23
- package/skills/harmonyos-migration-playbook/references/ui-automation.md +53 -53
- package/skills/harmonyos-migration-playbook/references/windows-environment.md +38 -38
- package/skills/maintaining-migration-report/SKILL.md +144 -144
- package/skills/maintaining-migration-report/references/final-acceptance.md +48 -48
- package/skills/maintaining-migration-report/references/source-provenance.md +66 -66
- package/skills/managing-d2h-toolchain/SKILL.md +24 -24
- package/skills/managing-d2h-toolchain/environment-requirements.json +16 -16
- package/skills/managing-d2h-toolchain/scripts/manage-toolchain.mjs +98 -98
- package/skills/managing-d2h-toolchain/toolchain.json +16 -16
- package/skills/native-library-substitution/SKILL.md +384 -384
- package/skills/native-library-substitution/references/native-library-substitution.json +56905 -56905
- package/skills/native-library-substitution/references/native-library-substitution.md +163 -163
- package/skills/preparing-migration-workspace/SKILL.md +131 -131
- package/skills/reviewing-migration-process/SKILL.md +62 -62
package/install-opencode.sh
CHANGED
|
@@ -1,160 +1,160 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
|
|
3
|
-
set -eu
|
|
4
|
-
|
|
5
|
-
usage() {
|
|
6
|
-
cat <<'EOF'
|
|
7
|
-
Install this repository's skills and agents into the user-level OpenCode config.
|
|
8
|
-
|
|
9
|
-
Usage:
|
|
10
|
-
sh install-opencode.sh [options]
|
|
11
|
-
|
|
12
|
-
Options:
|
|
13
|
-
--source-dir <path> Repository root. Defaults to the script directory.
|
|
14
|
-
--config-dir <path> OpenCode config root. Defaults to
|
|
15
|
-
$OPENCODE_CONFIG_DIR, or
|
|
16
|
-
${XDG_CONFIG_HOME:-$HOME/.config}/opencode.
|
|
17
|
-
--link Create absolute symbolic links for local development.
|
|
18
|
-
--force Replace conflicting installed skills and agents.
|
|
19
|
-
--dry-run Print planned operations without changing files.
|
|
20
|
-
-h, --help Show this help.
|
|
21
|
-
|
|
22
|
-
The installer does not edit opencode.json or copy AGENTS.md. It installs only
|
|
23
|
-
skills/*/SKILL.md trees and agents/*.md into OpenCode's global discovery paths.
|
|
24
|
-
EOF
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
fail() {
|
|
28
|
-
printf 'install-opencode: %s\n' "$*" >&2
|
|
29
|
-
exit 1
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
script_dir=$(CDPATH= cd "$(dirname "$0")" && pwd -P)
|
|
33
|
-
source_dir=$script_dir
|
|
34
|
-
config_dir=${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-${HOME}/.config}/opencode}
|
|
35
|
-
install_mode=copy
|
|
36
|
-
force_install=0
|
|
37
|
-
dry_run=0
|
|
38
|
-
|
|
39
|
-
while [ "$#" -gt 0 ]; do
|
|
40
|
-
case $1 in
|
|
41
|
-
--source-dir)
|
|
42
|
-
[ "$#" -ge 2 ] || fail "--source-dir requires a path"
|
|
43
|
-
source_dir=$2
|
|
44
|
-
shift 2
|
|
45
|
-
;;
|
|
46
|
-
--config-dir)
|
|
47
|
-
[ "$#" -ge 2 ] || fail "--config-dir requires a path"
|
|
48
|
-
config_dir=$2
|
|
49
|
-
shift 2
|
|
50
|
-
;;
|
|
51
|
-
--link)
|
|
52
|
-
install_mode=link
|
|
53
|
-
shift
|
|
54
|
-
;;
|
|
55
|
-
--force)
|
|
56
|
-
force_install=1
|
|
57
|
-
shift
|
|
58
|
-
;;
|
|
59
|
-
--dry-run)
|
|
60
|
-
dry_run=1
|
|
61
|
-
shift
|
|
62
|
-
;;
|
|
63
|
-
-h|--help)
|
|
64
|
-
usage
|
|
65
|
-
exit 0
|
|
66
|
-
;;
|
|
67
|
-
*)
|
|
68
|
-
fail "unknown option: $1"
|
|
69
|
-
;;
|
|
70
|
-
esac
|
|
71
|
-
done
|
|
72
|
-
|
|
73
|
-
[ -d "$source_dir" ] || fail "source directory not found: $source_dir"
|
|
74
|
-
source_dir=$(CDPATH= cd "$source_dir" && pwd -P)
|
|
75
|
-
skills_source=$source_dir/skills
|
|
76
|
-
agents_source=$source_dir/agents
|
|
77
|
-
|
|
78
|
-
[ -d "$skills_source" ] || fail "skills directory not found: $skills_source"
|
|
79
|
-
[ -d "$agents_source" ] || fail "agents directory not found: $agents_source"
|
|
80
|
-
|
|
81
|
-
case $config_dir in
|
|
82
|
-
""|/|.|..|"${HOME}"|"${HOME}/")
|
|
83
|
-
fail "refusing unsafe OpenCode config directory: $config_dir"
|
|
84
|
-
;;
|
|
85
|
-
esac
|
|
86
|
-
|
|
87
|
-
if [ "$dry_run" -eq 0 ]; then
|
|
88
|
-
mkdir -p "$config_dir"
|
|
89
|
-
config_dir=$(CDPATH= cd "$config_dir" && pwd -P)
|
|
90
|
-
mkdir -p "$config_dir/skills" "$config_dir/agents"
|
|
91
|
-
installer_tmp_root=$(mktemp -d "${TMPDIR:-/tmp}/install-opencode.XXXXXX")
|
|
92
|
-
trap 'rm -rf "$installer_tmp_root"' EXIT HUP INT TERM
|
|
93
|
-
else
|
|
94
|
-
installer_tmp_root=
|
|
95
|
-
fi
|
|
96
|
-
|
|
97
|
-
installed_skills=0
|
|
98
|
-
installed_agents=0
|
|
99
|
-
|
|
100
|
-
install_entry() {
|
|
101
|
-
entry_source=$1
|
|
102
|
-
entry_destination=$2
|
|
103
|
-
entry_kind=$3
|
|
104
|
-
entry_name=$4
|
|
105
|
-
|
|
106
|
-
if [ "$install_mode" = link ] && [ -L "$entry_destination" ] && [ "$(readlink "$entry_destination")" = "$entry_source" ]; then
|
|
107
|
-
printf 'unchanged %s: %s\n' "$entry_kind" "$entry_name"
|
|
108
|
-
return
|
|
109
|
-
fi
|
|
110
|
-
|
|
111
|
-
if [ "$install_mode" = copy ] && [ -e "$entry_destination" ] && diff -qr "$entry_source" "$entry_destination" >/dev/null 2>&1; then
|
|
112
|
-
printf 'unchanged %s: %s\n' "$entry_kind" "$entry_name"
|
|
113
|
-
return
|
|
114
|
-
fi
|
|
115
|
-
|
|
116
|
-
if { [ -e "$entry_destination" ] || [ -L "$entry_destination" ]; } && [ "$force_install" -ne 1 ]; then
|
|
117
|
-
fail "$entry_kind '$entry_name' already exists at $entry_destination; rerun with --force to replace it"
|
|
118
|
-
fi
|
|
119
|
-
|
|
120
|
-
if [ "$dry_run" -eq 1 ]; then
|
|
121
|
-
printf 'would install %s: %s -> %s (%s)\n' "$entry_kind" "$entry_source" "$entry_destination" "$install_mode"
|
|
122
|
-
return
|
|
123
|
-
fi
|
|
124
|
-
|
|
125
|
-
if [ -e "$entry_destination" ] || [ -L "$entry_destination" ]; then
|
|
126
|
-
rm -rf "$entry_destination"
|
|
127
|
-
fi
|
|
128
|
-
|
|
129
|
-
if [ "$install_mode" = link ]; then
|
|
130
|
-
ln -s "$entry_source" "$entry_destination"
|
|
131
|
-
else
|
|
132
|
-
entry_stage=$installer_tmp_root/$entry_kind-$entry_name
|
|
133
|
-
cp -R "$entry_source" "$entry_stage"
|
|
134
|
-
mv "$entry_stage" "$entry_destination"
|
|
135
|
-
fi
|
|
136
|
-
|
|
137
|
-
printf 'installed %s: %s\n' "$entry_kind" "$entry_destination"
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
for skill_file in "$skills_source"/*/SKILL.md; do
|
|
141
|
-
[ -f "$skill_file" ] || continue
|
|
142
|
-
skill_directory=$(dirname "$skill_file")
|
|
143
|
-
skill_name=$(basename "$skill_directory")
|
|
144
|
-
install_entry "$skill_directory" "$config_dir/skills/$skill_name" skill "$skill_name"
|
|
145
|
-
installed_skills=$((installed_skills + 1))
|
|
146
|
-
done
|
|
147
|
-
|
|
148
|
-
for agent_file in "$agents_source"/*.md; do
|
|
149
|
-
[ -f "$agent_file" ] || continue
|
|
150
|
-
agent_name=$(basename "$agent_file")
|
|
151
|
-
install_entry "$agent_file" "$config_dir/agents/$agent_name" agent "$agent_name"
|
|
152
|
-
installed_agents=$((installed_agents + 1))
|
|
153
|
-
done
|
|
154
|
-
|
|
155
|
-
[ "$installed_skills" -gt 0 ] || fail "no skills found under $skills_source"
|
|
156
|
-
[ "$installed_agents" -gt 0 ] || fail "no agents found under $agents_source"
|
|
157
|
-
|
|
158
|
-
printf 'OpenCode installation complete: %s skill(s), %s agent(s).\n' "$installed_skills" "$installed_agents"
|
|
159
|
-
printf 'Config directory: %s\n' "$config_dir"
|
|
160
|
-
printf 'Quit and restart OpenCode to load the installed definitions.\n'
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
set -eu
|
|
4
|
+
|
|
5
|
+
usage() {
|
|
6
|
+
cat <<'EOF'
|
|
7
|
+
Install this repository's skills and agents into the user-level OpenCode config.
|
|
8
|
+
|
|
9
|
+
Usage:
|
|
10
|
+
sh install-opencode.sh [options]
|
|
11
|
+
|
|
12
|
+
Options:
|
|
13
|
+
--source-dir <path> Repository root. Defaults to the script directory.
|
|
14
|
+
--config-dir <path> OpenCode config root. Defaults to
|
|
15
|
+
$OPENCODE_CONFIG_DIR, or
|
|
16
|
+
${XDG_CONFIG_HOME:-$HOME/.config}/opencode.
|
|
17
|
+
--link Create absolute symbolic links for local development.
|
|
18
|
+
--force Replace conflicting installed skills and agents.
|
|
19
|
+
--dry-run Print planned operations without changing files.
|
|
20
|
+
-h, --help Show this help.
|
|
21
|
+
|
|
22
|
+
The installer does not edit opencode.json or copy AGENTS.md. It installs only
|
|
23
|
+
skills/*/SKILL.md trees and agents/*.md into OpenCode's global discovery paths.
|
|
24
|
+
EOF
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
fail() {
|
|
28
|
+
printf 'install-opencode: %s\n' "$*" >&2
|
|
29
|
+
exit 1
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
script_dir=$(CDPATH= cd "$(dirname "$0")" && pwd -P)
|
|
33
|
+
source_dir=$script_dir
|
|
34
|
+
config_dir=${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-${HOME}/.config}/opencode}
|
|
35
|
+
install_mode=copy
|
|
36
|
+
force_install=0
|
|
37
|
+
dry_run=0
|
|
38
|
+
|
|
39
|
+
while [ "$#" -gt 0 ]; do
|
|
40
|
+
case $1 in
|
|
41
|
+
--source-dir)
|
|
42
|
+
[ "$#" -ge 2 ] || fail "--source-dir requires a path"
|
|
43
|
+
source_dir=$2
|
|
44
|
+
shift 2
|
|
45
|
+
;;
|
|
46
|
+
--config-dir)
|
|
47
|
+
[ "$#" -ge 2 ] || fail "--config-dir requires a path"
|
|
48
|
+
config_dir=$2
|
|
49
|
+
shift 2
|
|
50
|
+
;;
|
|
51
|
+
--link)
|
|
52
|
+
install_mode=link
|
|
53
|
+
shift
|
|
54
|
+
;;
|
|
55
|
+
--force)
|
|
56
|
+
force_install=1
|
|
57
|
+
shift
|
|
58
|
+
;;
|
|
59
|
+
--dry-run)
|
|
60
|
+
dry_run=1
|
|
61
|
+
shift
|
|
62
|
+
;;
|
|
63
|
+
-h|--help)
|
|
64
|
+
usage
|
|
65
|
+
exit 0
|
|
66
|
+
;;
|
|
67
|
+
*)
|
|
68
|
+
fail "unknown option: $1"
|
|
69
|
+
;;
|
|
70
|
+
esac
|
|
71
|
+
done
|
|
72
|
+
|
|
73
|
+
[ -d "$source_dir" ] || fail "source directory not found: $source_dir"
|
|
74
|
+
source_dir=$(CDPATH= cd "$source_dir" && pwd -P)
|
|
75
|
+
skills_source=$source_dir/skills
|
|
76
|
+
agents_source=$source_dir/agents
|
|
77
|
+
|
|
78
|
+
[ -d "$skills_source" ] || fail "skills directory not found: $skills_source"
|
|
79
|
+
[ -d "$agents_source" ] || fail "agents directory not found: $agents_source"
|
|
80
|
+
|
|
81
|
+
case $config_dir in
|
|
82
|
+
""|/|.|..|"${HOME}"|"${HOME}/")
|
|
83
|
+
fail "refusing unsafe OpenCode config directory: $config_dir"
|
|
84
|
+
;;
|
|
85
|
+
esac
|
|
86
|
+
|
|
87
|
+
if [ "$dry_run" -eq 0 ]; then
|
|
88
|
+
mkdir -p "$config_dir"
|
|
89
|
+
config_dir=$(CDPATH= cd "$config_dir" && pwd -P)
|
|
90
|
+
mkdir -p "$config_dir/skills" "$config_dir/agents"
|
|
91
|
+
installer_tmp_root=$(mktemp -d "${TMPDIR:-/tmp}/install-opencode.XXXXXX")
|
|
92
|
+
trap 'rm -rf "$installer_tmp_root"' EXIT HUP INT TERM
|
|
93
|
+
else
|
|
94
|
+
installer_tmp_root=
|
|
95
|
+
fi
|
|
96
|
+
|
|
97
|
+
installed_skills=0
|
|
98
|
+
installed_agents=0
|
|
99
|
+
|
|
100
|
+
install_entry() {
|
|
101
|
+
entry_source=$1
|
|
102
|
+
entry_destination=$2
|
|
103
|
+
entry_kind=$3
|
|
104
|
+
entry_name=$4
|
|
105
|
+
|
|
106
|
+
if [ "$install_mode" = link ] && [ -L "$entry_destination" ] && [ "$(readlink "$entry_destination")" = "$entry_source" ]; then
|
|
107
|
+
printf 'unchanged %s: %s\n' "$entry_kind" "$entry_name"
|
|
108
|
+
return
|
|
109
|
+
fi
|
|
110
|
+
|
|
111
|
+
if [ "$install_mode" = copy ] && [ -e "$entry_destination" ] && diff -qr "$entry_source" "$entry_destination" >/dev/null 2>&1; then
|
|
112
|
+
printf 'unchanged %s: %s\n' "$entry_kind" "$entry_name"
|
|
113
|
+
return
|
|
114
|
+
fi
|
|
115
|
+
|
|
116
|
+
if { [ -e "$entry_destination" ] || [ -L "$entry_destination" ]; } && [ "$force_install" -ne 1 ]; then
|
|
117
|
+
fail "$entry_kind '$entry_name' already exists at $entry_destination; rerun with --force to replace it"
|
|
118
|
+
fi
|
|
119
|
+
|
|
120
|
+
if [ "$dry_run" -eq 1 ]; then
|
|
121
|
+
printf 'would install %s: %s -> %s (%s)\n' "$entry_kind" "$entry_source" "$entry_destination" "$install_mode"
|
|
122
|
+
return
|
|
123
|
+
fi
|
|
124
|
+
|
|
125
|
+
if [ -e "$entry_destination" ] || [ -L "$entry_destination" ]; then
|
|
126
|
+
rm -rf "$entry_destination"
|
|
127
|
+
fi
|
|
128
|
+
|
|
129
|
+
if [ "$install_mode" = link ]; then
|
|
130
|
+
ln -s "$entry_source" "$entry_destination"
|
|
131
|
+
else
|
|
132
|
+
entry_stage=$installer_tmp_root/$entry_kind-$entry_name
|
|
133
|
+
cp -R "$entry_source" "$entry_stage"
|
|
134
|
+
mv "$entry_stage" "$entry_destination"
|
|
135
|
+
fi
|
|
136
|
+
|
|
137
|
+
printf 'installed %s: %s\n' "$entry_kind" "$entry_destination"
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
for skill_file in "$skills_source"/*/SKILL.md; do
|
|
141
|
+
[ -f "$skill_file" ] || continue
|
|
142
|
+
skill_directory=$(dirname "$skill_file")
|
|
143
|
+
skill_name=$(basename "$skill_directory")
|
|
144
|
+
install_entry "$skill_directory" "$config_dir/skills/$skill_name" skill "$skill_name"
|
|
145
|
+
installed_skills=$((installed_skills + 1))
|
|
146
|
+
done
|
|
147
|
+
|
|
148
|
+
for agent_file in "$agents_source"/*.md; do
|
|
149
|
+
[ -f "$agent_file" ] || continue
|
|
150
|
+
agent_name=$(basename "$agent_file")
|
|
151
|
+
install_entry "$agent_file" "$config_dir/agents/$agent_name" agent "$agent_name"
|
|
152
|
+
installed_agents=$((installed_agents + 1))
|
|
153
|
+
done
|
|
154
|
+
|
|
155
|
+
[ "$installed_skills" -gt 0 ] || fail "no skills found under $skills_source"
|
|
156
|
+
[ "$installed_agents" -gt 0 ] || fail "no agents found under $agents_source"
|
|
157
|
+
|
|
158
|
+
printf 'OpenCode installation complete: %s skill(s), %s agent(s).\n' "$installed_skills" "$installed_agents"
|
|
159
|
+
printf 'Config directory: %s\n' "$config_dir"
|
|
160
|
+
printf 'Quit and restart OpenCode to load the installed definitions.\n'
|
package/opencode/agents.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
{
|
|
2
|
-
"d2h_v2": {
|
|
3
|
-
"mode": "all",
|
|
4
|
-
"hidden": false,
|
|
5
|
-
"permissions": {
|
|
6
|
-
"read": "allow",
|
|
7
|
-
"write": "allow",
|
|
8
|
-
"edit": "allow",
|
|
9
|
-
"glob": "allow",
|
|
10
|
-
"grep": "allow",
|
|
11
|
-
"bash": "allow",
|
|
12
|
-
"skill": "allow",
|
|
13
|
-
"task": "allow"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"d2h_v2": {
|
|
3
|
+
"mode": "all",
|
|
4
|
+
"hidden": false,
|
|
5
|
+
"permissions": {
|
|
6
|
+
"read": "allow",
|
|
7
|
+
"write": "allow",
|
|
8
|
+
"edit": "allow",
|
|
9
|
+
"glob": "allow",
|
|
10
|
+
"grep": "allow",
|
|
11
|
+
"bash": "allow",
|
|
12
|
+
"skill": "allow",
|
|
13
|
+
"task": "allow"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@harmonyos-arkts/d2h-vscode-plugin",
|
|
3
|
-
"version": "0.1.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "src/index.js"
|
|
7
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@harmonyos-arkts/d2h-vscode-plugin",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.js"
|
|
7
|
+
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
|
|
5
|
-
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
6
|
-
const agentFile = path.join(packageRoot, 'agents', 'd2h.md');
|
|
7
|
-
const skillsDirectory = path.join(packageRoot, 'skills');
|
|
8
|
-
|
|
9
|
-
export const plugin = async () => ({
|
|
10
|
-
config(config) {
|
|
11
|
-
config.agent ??= {};
|
|
12
|
-
const previous = config.agent.d2h ?? {};
|
|
13
|
-
config.agent.d2h = {
|
|
14
|
-
...previous,
|
|
15
|
-
description: '安卓转鸿蒙',
|
|
16
|
-
mode: 'primary',
|
|
17
|
-
hidden: false,
|
|
18
|
-
prompt: fs.readFileSync(agentFile, 'utf8'),
|
|
19
|
-
tools: { ...previous.tools, question: true, task: true, read: true, write: true, edit: true },
|
|
20
|
-
permission: { ...previous.permission, read: 'allow', edit: 'allow' },
|
|
21
|
-
};
|
|
22
|
-
config.skills ??= {};
|
|
23
|
-
const paths = Array.isArray(config.skills.paths) ? config.skills.paths : [];
|
|
24
|
-
if (!paths.includes(skillsDirectory)) paths.push(skillsDirectory);
|
|
25
|
-
config.skills.paths = paths;
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
export default plugin;
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
6
|
+
const agentFile = path.join(packageRoot, 'agents', 'd2h.md');
|
|
7
|
+
const skillsDirectory = path.join(packageRoot, 'skills');
|
|
8
|
+
|
|
9
|
+
export const plugin = async () => ({
|
|
10
|
+
config(config) {
|
|
11
|
+
config.agent ??= {};
|
|
12
|
+
const previous = config.agent.d2h ?? {};
|
|
13
|
+
config.agent.d2h = {
|
|
14
|
+
...previous,
|
|
15
|
+
description: '安卓转鸿蒙',
|
|
16
|
+
mode: 'primary',
|
|
17
|
+
hidden: false,
|
|
18
|
+
prompt: fs.readFileSync(agentFile, 'utf8'),
|
|
19
|
+
tools: { ...previous.tools, question: true, task: true, read: true, write: true, edit: true },
|
|
20
|
+
permission: { ...previous.permission, read: 'allow', edit: 'allow' },
|
|
21
|
+
};
|
|
22
|
+
config.skills ??= {};
|
|
23
|
+
const paths = Array.isArray(config.skills.paths) ? config.skills.paths : [];
|
|
24
|
+
if (!paths.includes(skillsDirectory)) paths.push(skillsDirectory);
|
|
25
|
+
config.skills.paths = paths;
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export default plugin;
|
package/package.json
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@harmonyos-arkts/d2h",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Install Android-to-HarmonyOS migration agents and skills into OpenCode or DevEco Code",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"d2h": "dist/bin/install-opencode.js"
|
|
8
|
-
},
|
|
9
|
-
"files": [
|
|
10
|
-
"dist/bin/",
|
|
11
|
-
"dist/src/",
|
|
12
|
-
"skills/",
|
|
13
|
-
"agents/",
|
|
14
|
-
"AGENTS.md",
|
|
15
|
-
"schemas/",
|
|
16
|
-
"opencode/",
|
|
17
|
-
".claude-plugin/",
|
|
18
|
-
"install-opencode.sh",
|
|
19
|
-
"scripts/check-environment.mjs",
|
|
20
|
-
"docs/environment-check.md",
|
|
21
|
-
"README.md",
|
|
22
|
-
"LICENSE"
|
|
23
|
-
],
|
|
24
|
-
"scripts": {
|
|
25
|
-
"build": "tsc -p tsconfig.json",
|
|
26
|
-
"check": "tsc --noEmit && npm run build && node dist/scripts/check-skill-refs.js && node dist/scripts/check-toolchain.js",
|
|
27
|
-
"test": "npm run build && node --test dist/test/*.test.js scripts/tests/*.test.mjs",
|
|
28
|
-
"prepack": "npm run build",
|
|
29
|
-
"prepublishOnly": "npm run check && npm test"
|
|
30
|
-
},
|
|
31
|
-
"engines": {
|
|
32
|
-
"node": ">=22.5.0 <25.0.0"
|
|
33
|
-
},
|
|
34
|
-
"repository": {
|
|
35
|
-
"type": "git",
|
|
36
|
-
"url": "git+https://github.com/Harmony-Ai-Tool/android-to-hmos-migration.git"
|
|
37
|
-
},
|
|
38
|
-
"license": "MIT",
|
|
39
|
-
"publishConfig": {
|
|
40
|
-
"access": "public",
|
|
41
|
-
"registry": "https://registry.npmjs.org/"
|
|
42
|
-
},
|
|
43
|
-
"keywords": [
|
|
44
|
-
"android",
|
|
45
|
-
"harmonyos",
|
|
46
|
-
"arkts",
|
|
47
|
-
"migration",
|
|
48
|
-
"opencode"
|
|
49
|
-
],
|
|
50
|
-
"devDependencies": {
|
|
51
|
-
"@types/node": "^22.20.5",
|
|
52
|
-
"typescript": "^5.9.3"
|
|
53
|
-
}
|
|
54
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@harmonyos-arkts/d2h",
|
|
3
|
+
"version": "0.1.12",
|
|
4
|
+
"description": "Install Android-to-HarmonyOS migration agents and skills into OpenCode or DevEco Code",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"d2h": "dist/bin/install-opencode.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist/bin/",
|
|
11
|
+
"dist/src/",
|
|
12
|
+
"skills/",
|
|
13
|
+
"agents/",
|
|
14
|
+
"AGENTS.md",
|
|
15
|
+
"schemas/",
|
|
16
|
+
"opencode/",
|
|
17
|
+
".claude-plugin/",
|
|
18
|
+
"install-opencode.sh",
|
|
19
|
+
"scripts/check-environment.mjs",
|
|
20
|
+
"docs/environment-check.md",
|
|
21
|
+
"README.md",
|
|
22
|
+
"LICENSE"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsc -p tsconfig.json",
|
|
26
|
+
"check": "tsc --noEmit && npm run build && node dist/scripts/check-skill-refs.js && node dist/scripts/check-toolchain.js",
|
|
27
|
+
"test": "npm run build && node --test dist/test/*.test.js scripts/tests/*.test.mjs",
|
|
28
|
+
"prepack": "npm run build",
|
|
29
|
+
"prepublishOnly": "npm run check && npm test"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=22.5.0 <25.0.0"
|
|
33
|
+
},
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/Harmony-Ai-Tool/android-to-hmos-migration.git"
|
|
37
|
+
},
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public",
|
|
41
|
+
"registry": "https://registry.npmjs.org/"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"android",
|
|
45
|
+
"harmonyos",
|
|
46
|
+
"arkts",
|
|
47
|
+
"migration",
|
|
48
|
+
"opencode"
|
|
49
|
+
],
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/node": "^22.20.5",
|
|
52
|
+
"typescript": "^5.9.3"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://harmonyos-ai.dev/schemas/android-source-manifest.schema.json",
|
|
4
|
-
"title": "Managed Android source member manifest",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"required": ["manifestVersion", "androidRoot", "members", "manifestSha256"],
|
|
7
|
-
"properties": {
|
|
8
|
-
"manifestVersion": { "const": "1.0.0" },
|
|
9
|
-
"androidRoot": { "type": "string", "minLength": 1 },
|
|
10
|
-
"members": {
|
|
11
|
-
"type": "array",
|
|
12
|
-
"items": {
|
|
13
|
-
"type": "object",
|
|
14
|
-
"required": ["androidFile", "fileSha256"],
|
|
15
|
-
"properties": {
|
|
16
|
-
"androidFile": { "type": "string", "pattern": "^(?![/\\\\])(?!.*(?:^|[/\\\\])\\.\\.(?:[/\\\\]|$)).+" },
|
|
17
|
-
"fileSha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
|
|
18
|
-
},
|
|
19
|
-
"additionalProperties": false
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
"manifestSha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
|
|
23
|
-
},
|
|
24
|
-
"additionalProperties": false
|
|
25
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://harmonyos-ai.dev/schemas/android-source-manifest.schema.json",
|
|
4
|
+
"title": "Managed Android source member manifest",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["manifestVersion", "androidRoot", "members", "manifestSha256"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"manifestVersion": { "const": "1.0.0" },
|
|
9
|
+
"androidRoot": { "type": "string", "minLength": 1 },
|
|
10
|
+
"members": {
|
|
11
|
+
"type": "array",
|
|
12
|
+
"items": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"required": ["androidFile", "fileSha256"],
|
|
15
|
+
"properties": {
|
|
16
|
+
"androidFile": { "type": "string", "pattern": "^(?![/\\\\])(?!.*(?:^|[/\\\\])\\.\\.(?:[/\\\\]|$)).+" },
|
|
17
|
+
"fileSha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
|
|
18
|
+
},
|
|
19
|
+
"additionalProperties": false
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"manifestSha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
|
|
23
|
+
},
|
|
24
|
+
"additionalProperties": false
|
|
25
|
+
}
|