@harmonyos-arkts/opencode-plugin 0.0.14 → 0.0.15
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/dist/index.js +78 -20
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31600,11 +31600,57 @@ var HM_BUILD = `
|
|
|
31600
31600
|
5. If still failing after 3 attempts, report the remaining errors to the user and ask for guidance
|
|
31601
31601
|
- Only after a successful build should the development cycle be considered complete
|
|
31602
31602
|
`;
|
|
31603
|
-
var
|
|
31604
|
-
|
|
31605
|
-
|
|
31606
|
-
-
|
|
31607
|
-
|
|
31603
|
+
var HM_MULTI_DEVICE = `
|
|
31604
|
+
## Role
|
|
31605
|
+
|
|
31606
|
+
You are an expert in HarmonyOS "Deploy Once, Run Everywhere" (\u4E00\u591A) multi-device adaptation. Your job is to help developers adapt phone-first ArkTS applications to work correctly across phones, tablets, foldables, and PCs \u2014 and to diagnose and fix adaptation-related bugs in existing code.
|
|
31607
|
+
|
|
31608
|
+
You are **not** a general HarmonyOS assistant. Decline requests outside your domain (e.g., backend services, non-UI logic, Ability lifecycle unrelated to window management) and suggest the developer seek a broader assistant for those.
|
|
31609
|
+
|
|
31610
|
+
---
|
|
31611
|
+
|
|
31612
|
+
## Execution Workflow
|
|
31613
|
+
|
|
31614
|
+
At the start of every task, load and follow:
|
|
31615
|
+
|
|
31616
|
+
\`\`\`
|
|
31617
|
+
harmonyos-multi-device-adaptation/harmonyos-adaptation-workflow/SKILL.md
|
|
31618
|
+
\`\`\`
|
|
31619
|
+
|
|
31620
|
+
That skill defines the full execution flow for both new adaptation (Path A) and bug fixing (Path B), including project scanning, domain routing, build verification, and the mandatory implementation checklist. Do not proceed without loading it.
|
|
31621
|
+
|
|
31622
|
+
---
|
|
31623
|
+
|
|
31624
|
+
## Skill Files
|
|
31625
|
+
|
|
31626
|
+
Domain knowledge lives in skill files under \`harmonyos-multi-device-adaptation/\`. Each file's **Agent Interface** section contains:
|
|
31627
|
+
|
|
31628
|
+
- \`symptom_keywords\` \u2014 match against user-reported symptoms to identify the relevant domain
|
|
31629
|
+
- \`hard_constraints\` \u2014 verify every item before generating any code for that domain
|
|
31630
|
+
- \`diagnostic_checklist\` \u2014 walk through item-by-item when diagnosing a bug
|
|
31631
|
+
|
|
31632
|
+
When a new skill is added to the folder, it is automatically available \u2014 no changes to this prompt are needed.
|
|
31633
|
+
|
|
31634
|
+
---
|
|
31635
|
+
|
|
31636
|
+
## Universal Hard Constraints
|
|
31637
|
+
|
|
31638
|
+
These rules apply across all domains and all phases. Never deviate.
|
|
31639
|
+
|
|
31640
|
+
1. **ArkTS only.** Never output Java, JavaScript, or Kotlin.
|
|
31641
|
+
2. **No invented APIs.** If you are not certain an API exists, say so explicitly rather than guessing.
|
|
31642
|
+
3. **Window object.** Always obtain the window via \`AppStorage.get<window.WindowStage>('windowStage')!.getMainWindowSync()\`. Never use \`window.getLastWindow()\`.
|
|
31643
|
+
4. **avoidAreaChange callback.** Always read \`opts.area\` directly. Never call \`getWindowAvoidArea()\` inside the callback.
|
|
31644
|
+
|
|
31645
|
+
---
|
|
31646
|
+
|
|
31647
|
+
## Output Format
|
|
31648
|
+
|
|
31649
|
+
- **Lead with domain identification** \u2014 always name the domain(s) before proposing code.
|
|
31650
|
+
- **Use \u274C/\u2705 comparisons** for all code changes, with a one-line reason for each change.
|
|
31651
|
+
- **If uncertain about an API**, say: *"I'm not certain this API exists at the required level \u2014 please verify in the official HarmonyOS documentation."*
|
|
31652
|
+
- **If a request is outside your domains**, say: *"This falls outside multi-device adaptation. You may want to consult a general HarmonyOS assistant for this."*
|
|
31653
|
+
- **Never output a wall of code** without explaining what changed and why.
|
|
31608
31654
|
`;
|
|
31609
31655
|
var HM_PLAN = `
|
|
31610
31656
|
### Plan Phase
|
|
@@ -31720,8 +31766,8 @@ function buildPlanPrompt(type) {
|
|
|
31720
31766
|
return HM_DESIGN;
|
|
31721
31767
|
case "build":
|
|
31722
31768
|
return HM_BUILD;
|
|
31723
|
-
case "
|
|
31724
|
-
return
|
|
31769
|
+
case "multi-device":
|
|
31770
|
+
return HM_MULTI_DEVICE;
|
|
31725
31771
|
case "plan":
|
|
31726
31772
|
return HM_PLAN;
|
|
31727
31773
|
case "all":
|
|
@@ -31866,6 +31912,13 @@ function createHmAgent() {
|
|
|
31866
31912
|
doom_loop: "ask",
|
|
31867
31913
|
external_directory: {
|
|
31868
31914
|
"*": "ask"
|
|
31915
|
+
},
|
|
31916
|
+
"skillSearch": "allow",
|
|
31917
|
+
skill: {
|
|
31918
|
+
"*": "deny",
|
|
31919
|
+
"harmonyos-atomic-dev": "allow",
|
|
31920
|
+
"harmonyos-hvigor": "allow",
|
|
31921
|
+
"harmonyos-prd-design": "allow"
|
|
31869
31922
|
}
|
|
31870
31923
|
},
|
|
31871
31924
|
metadata: void 0
|
|
@@ -31914,30 +31967,34 @@ function createHmDevelopmentAgent() {
|
|
|
31914
31967
|
prompt: buildHmAgentPrompt("dev"),
|
|
31915
31968
|
temperature: 0.3,
|
|
31916
31969
|
permission: {
|
|
31917
|
-
"skillSearch": "allow"
|
|
31970
|
+
"skillSearch": "allow",
|
|
31971
|
+
skill: {
|
|
31972
|
+
"*": "deny",
|
|
31973
|
+
"harmonyos-atomic-dev": "allow",
|
|
31974
|
+
"harmonyos-hvigor": "allow",
|
|
31975
|
+
"harmonyos-prd-design": "allow"
|
|
31976
|
+
}
|
|
31918
31977
|
},
|
|
31919
31978
|
metadata: void 0
|
|
31920
31979
|
};
|
|
31921
31980
|
return agent;
|
|
31922
31981
|
}
|
|
31923
31982
|
|
|
31924
|
-
// src/agents/
|
|
31925
|
-
function
|
|
31983
|
+
// src/agents/multi-device-agent.ts
|
|
31984
|
+
function getHmMultiDeviceDescription() {
|
|
31926
31985
|
return `
|
|
31927
31986
|
HarmonyOS One-to-Many Adaptation \u2014 adapts applications for multiple device types (phone, tablet, foldable, 2-in-1, wearable, TV)
|
|
31928
31987
|
`;
|
|
31929
31988
|
}
|
|
31930
|
-
function
|
|
31989
|
+
function createMultiDeviceAgent() {
|
|
31931
31990
|
const agent = {
|
|
31932
|
-
id: "harmonyos-
|
|
31933
|
-
name: "harmonyos-
|
|
31934
|
-
description:
|
|
31991
|
+
id: "harmonyos-multi-device",
|
|
31992
|
+
name: "harmonyos-multi-device",
|
|
31993
|
+
description: getHmMultiDeviceDescription(),
|
|
31935
31994
|
mode: "primary",
|
|
31936
|
-
prompt: buildHmAgentPrompt("
|
|
31995
|
+
prompt: buildHmAgentPrompt("multi-device"),
|
|
31937
31996
|
temperature: 0.3,
|
|
31938
|
-
permission: {
|
|
31939
|
-
"skillSearch": "deny"
|
|
31940
|
-
},
|
|
31997
|
+
permission: {},
|
|
31941
31998
|
metadata: void 0
|
|
31942
31999
|
};
|
|
31943
32000
|
return agent;
|
|
@@ -31950,7 +32007,7 @@ var AgentRegistry = class {
|
|
|
31950
32007
|
this.register(createHmAgent());
|
|
31951
32008
|
this.register(createDesignAgent());
|
|
31952
32009
|
this.register(createHmDevelopmentAgent());
|
|
31953
|
-
this.register(
|
|
32010
|
+
this.register(createMultiDeviceAgent());
|
|
31954
32011
|
}
|
|
31955
32012
|
register(agent) {
|
|
31956
32013
|
this.agents.set(agent.id, agent);
|
|
@@ -47577,7 +47634,8 @@ function runEnvCheck() {
|
|
|
47577
47634
|
try {
|
|
47578
47635
|
const output = execSync(`${check3.cmd} 2>&1`, { timeout: 1e4, encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
|
|
47579
47636
|
const firstLine = output.split(/\r?\n/)[0]?.trim() || "";
|
|
47580
|
-
|
|
47637
|
+
const suffix = check3.name === "Java" ? " (requires >= 17)" : "";
|
|
47638
|
+
lines.push(`[${check3.name}] ${firstLine}${suffix}`);
|
|
47581
47639
|
} catch (err) {
|
|
47582
47640
|
lines.push(`[${check3.name}] NOT FOUND`);
|
|
47583
47641
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@harmonyos-arkts/opencode-plugin",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.15",
|
|
5
5
|
"description": "HarmonyOS Full-Lifecycle Development Assistant. Specialized in the complete development lifecycle of HarmonyOS applications, including project creation, UI development, state management, network requests, data storage, permission requests, performance optimization, testing, and release.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"license": "MIT",
|