android2harmony 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +407 -0
- package/agents/build-fixer.md +385 -0
- package/agents/code-reviewer.md +478 -0
- package/agents/logic-coder.md +212 -0
- package/agents/logic-context-builder.md +199 -0
- package/agents/scripts/hmos-precheck/arkts.mjs +534 -0
- package/agents/scripts/hmos-precheck/codelinter.mjs +362 -0
- package/agents/scripts/hmos-precheck/index.mjs +926 -0
- package/agents/scripts/platform_query.mjs +535 -0
- package/dist/index.js +179 -0
- package/dist/index.js.map +7 -0
- package/package.json +29 -0
- package/skills/hmos-batch-ui-align/SKILL.md +141 -0
- package/skills/hmos-batch-ui-align/references/conversion-procedure.md +217 -0
- package/skills/hmos-batch-ui-align/references/mappings/android-to-harmonyOS-ui-atomic-component-mapping-reference.md +2533 -0
- package/skills/hmos-batch-ui-align/references/mappings/android-to-harmonyOS-ui-interaction-mapping-reference.md +555 -0
- package/skills/hmos-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +117 -0
- package/skills/hmos-batch-ui-align/references/mvvm/@Link/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/217/214/345/220/221/345/220/214/346/255/245.md +648 -0
- package/skills/hmos-batch-ui-align/references/mvvm/@Observed/350/243/205/351/245/260/345/231/250/345/222/214@ObjectLink/350/243/205/351/245/260/345/231/250/357/274/232/345/265/214/345/245/227/347/261/273/345/257/271/350/261/241/345/261/236/346/200/247/345/217/230/345/214/226.md +2089 -0
- package/skills/hmos-batch-ui-align/references/mvvm/@Prop/350/243/205/351/245/260/345/231/250/357/274/232/347/210/266/345/255/220/345/215/225/345/220/221/345/220/214/346/255/245.md +1033 -0
- package/skills/hmos-batch-ui-align/references/mvvm/@Provide/350/243/205/351/245/260/345/231/250/345/222/214@Consume/350/243/205/351/245/260/345/231/250/357/274/232/344/270/216/345/220/216/344/273/243/347/273/204/344/273/266/345/217/214/345/220/221/345/220/214/346/255/245.md +1183 -0
- package/skills/hmos-batch-ui-align/references/mvvm/@State/350/243/205/351/245/260/345/231/250/357/274/232/347/273/204/344/273/266/345/206/205/347/212/266/346/200/201.md +576 -0
- package/skills/hmos-batch-ui-align/references/mvvm/@Track/350/243/205/351/245/260/345/231/250/357/274/232class/345/257/271/350/261/241/345/261/236/346/200/247/347/272/247/346/233/264/346/226/260.md +297 -0
- package/skills/hmos-batch-ui-align/references/mvvm/@Watch/350/243/205/351/245/260/345/231/250/357/274/232/347/212/266/346/200/201/345/217/230/351/207/217/346/233/264/346/224/271/351/200/232/347/237/245.md +395 -0
- package/skills/hmos-batch-ui-align/references/mvvm/AppStorage/357/274/232/345/272/224/347/224/250/345/205/250/345/261/200/347/232/204UI/347/212/266/346/200/201/345/255/230/345/202/250.md +903 -0
- package/skills/hmos-batch-ui-align/references/mvvm/Environment/357/274/232/350/256/276/345/244/207/347/216/257/345/242/203/346/237/245/350/257/242.md +106 -0
- package/skills/hmos-batch-ui-align/references/mvvm/LocalStorage/357/274/232/351/241/265/351/235/242/347/272/247UI/347/212/266/346/200/201/345/255/230/345/202/250.md +1178 -0
- package/skills/hmos-batch-ui-align/references/mvvm/MVVM/346/250/241/345/274/217/357/274/210V1/357/274/211.md +911 -0
- package/skills/hmos-batch-ui-align/references/mvvm/PersistentStorage/357/274/232/346/214/201/344/271/205/345/214/226/345/255/230/345/202/250UI/347/212/266/346/200/201.md +355 -0
- package/skills/hmos-batch-ui-align/references/mvvm//347/256/241/347/220/206/345/272/224/347/224/250/346/213/245/346/234/211/347/232/204/347/212/266/346/200/201/346/246/202/350/277/260.md +11 -0
- package/skills/hmos-batch-ui-align/scripts/android_parse_fast.ts +1750 -0
- package/skills/hmos-convert-pipeline/SKILL.md +446 -0
- package/skills/hmos-fix-build-errors/SKILL.md +281 -0
- package/skills/hmos-fix-build-errors/references/arkts-strict-patterns.md +219 -0
- package/skills/hmos-fix-build-errors/references/known-patterns.md +157 -0
- package/skills/hmos-fix-build-errors/references/rdb-entity-pattern.md +131 -0
- package/skills/hmos-resources-convert/SKILL.md +654 -0
- package/skills/hmos-resources-convert/references/conversion-rules.md +663 -0
- package/skills/hmos-resources-convert/references/dependency-analysis-rules.md +388 -0
- package/skills/hmos-resources-convert/references/resource-mapping-rules.md +457 -0
- package/skills/hmos-resources-convert/references/xml-drawable-to-svg-rules.md +513 -0
- package/skills/hmos-resources-convert/template/AppScope/app.json5 +10 -0
- package/skills/hmos-resources-convert/template/AppScope/resources/base/element/string.json +8 -0
- package/skills/hmos-resources-convert/template/AppScope/resources/base/media/background.png +0 -0
- package/skills/hmos-resources-convert/template/AppScope/resources/base/media/foreground.png +0 -0
- package/skills/hmos-resources-convert/template/AppScope/resources/base/media/layered_image.json +7 -0
- package/skills/hmos-resources-convert/template/build-profile.json5 +42 -0
- package/skills/hmos-resources-convert/template/code-linter.json5 +32 -0
- package/skills/hmos-resources-convert/template/entry/build-profile.json5 +33 -0
- package/skills/hmos-resources-convert/template/entry/hvigorfile.ts +6 -0
- package/skills/hmos-resources-convert/template/entry/obfuscation-rules.txt +23 -0
- package/skills/hmos-resources-convert/template/entry/oh-package.json5 +10 -0
- package/skills/hmos-resources-convert/template/entry/src/main/ets/entryability/EntryAbility.ets +48 -0
- package/skills/hmos-resources-convert/template/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets +16 -0
- package/skills/hmos-resources-convert/template/entry/src/main/ets/pages/Index.ets +23 -0
- package/skills/hmos-resources-convert/template/entry/src/main/module.json5 +55 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/color.json +8 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/float.json +8 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/element/string.json +16 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/background.png +0 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/foreground.png +0 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/layered_image.json +7 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/media/startIcon.png +0 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/profile/backup_config.json +3 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/base/profile/main_pages.json +5 -0
- package/skills/hmos-resources-convert/template/entry/src/main/resources/dark/element/color.json +8 -0
- package/skills/hmos-resources-convert/template/entry/src/mock/mock-config.json5 +2 -0
- package/skills/hmos-resources-convert/template/entry/src/ohosTest/ets/test/Ability.test.ets +35 -0
- package/skills/hmos-resources-convert/template/entry/src/ohosTest/ets/test/List.test.ets +5 -0
- package/skills/hmos-resources-convert/template/entry/src/ohosTest/module.json5 +16 -0
- package/skills/hmos-resources-convert/template/entry/src/test/List.test.ets +5 -0
- package/skills/hmos-resources-convert/template/entry/src/test/LocalUnit.test.ets +33 -0
- package/skills/hmos-resources-convert/template/hvigor/hvigor-config.json5 +23 -0
- package/skills/hmos-resources-convert/template/hvigorfile.ts +6 -0
- package/skills/hmos-resources-convert/template/oh-package-lock.json5 +28 -0
- package/skills/hmos-resources-convert/template/oh-package.json5 +10 -0
- package/skills/hmos-spec-generate/SKILL.md +413 -0
- package/skills/hmos-spec-generate/references/android-platform-tokens.md +105 -0
- package/skills/hmos-spec-generate/references/spec-sample-1.md +78 -0
- package/skills/hmos-spec-generate/references/spec-sample-2.md +58 -0
- package/skills/hmos-spec-generate/references/spec-sample-3.md +116 -0
- package/skills/hmos-spec-generate/references/step4-report-template.md +33 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: logic-coder
|
|
3
|
+
description: "Execute the HarmonyOS ArkTS app contract without reopening design choices."
|
|
4
|
+
color: blue
|
|
5
|
+
min-model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Inputs
|
|
9
|
+
|
|
10
|
+
- `plan_file` = `{output_path}/plan.md`
|
|
11
|
+
- `harmony_project_dir` (abs)
|
|
12
|
+
- `output_path` (abs)
|
|
13
|
+
- `scripts_path` (abs) — shared agent scripts directory
|
|
14
|
+
|
|
15
|
+
## Tools
|
|
16
|
+
|
|
17
|
+
Platform context query:
|
|
18
|
+
|
|
19
|
+
node {scripts_path}/platform_query.mjs \
|
|
20
|
+
--request {output_path}/platform-context-request.json \
|
|
21
|
+
--out-dir {output_path}/coder-platform-context-{N}
|
|
22
|
+
|
|
23
|
+
Unique `{N}` per query; do not reuse out-dir. Request JSON: `stage` ("coder"),
|
|
24
|
+
`focus_point`, `task_excerpt`, `project_evidence`, `platform_surfaces`,
|
|
25
|
+
`extra_constraints`, optional `api_level`. Read
|
|
26
|
+
`{output_path}/coder-platform-context-{N}/platform-context-result.json`, use
|
|
27
|
+
`structured_evidence` first, run once by default, and allow at most one
|
|
28
|
+
follow-up only if the first result's `structured_evidence` cannot answer the
|
|
29
|
+
specific correctness dimension that triggered the query. Never search local
|
|
30
|
+
SDK/DevEco paths.
|
|
31
|
+
|
|
32
|
+
ArkTS diff precheck:
|
|
33
|
+
|
|
34
|
+
node {scripts_path}/hmos-precheck/index.mjs run \
|
|
35
|
+
--project-root {harmony_project_dir} \
|
|
36
|
+
--output-dir {output_path}/precheck
|
|
37
|
+
|
|
38
|
+
## Contract
|
|
39
|
+
|
|
40
|
+
Coder executes the narrowed `plan.md` contract: verify local facts, patch the
|
|
41
|
+
approved path, validate, commit the completed main path or a truthful in-scope
|
|
42
|
+
checkpoint, and write `commit-info.md`.
|
|
43
|
+
|
|
44
|
+
If truthful closure is blocked, keep the gap explicit instead of fake completion.
|
|
45
|
+
|
|
46
|
+
## Procedure
|
|
47
|
+
|
|
48
|
+
1. Read `plan_file` first.
|
|
49
|
+
2. If runtime provides checked constraints, read them after `plan_file`; they
|
|
50
|
+
narrow unsafe choices but do not broaden plan scope.
|
|
51
|
+
3. Verify local facts (per Verification, in stated order).
|
|
52
|
+
4. Patch only plan-required behavior.
|
|
53
|
+
5. Validate (per Validate And Output), including the ArkTS diff precheck when
|
|
54
|
+
`.ets` files changed. Stage only plan-required files; do not use `git add -A`.
|
|
55
|
+
6. Commit with a non-interactive message naming the decision contract. If the
|
|
56
|
+
diff is empty, do not create an empty commit; write `commit_id: none` and
|
|
57
|
+
`summary: no code change required` into `commit-info.md`. Otherwise commit
|
|
58
|
+
the completed main path when it is proven, or the safest truthful in-scope
|
|
59
|
+
checkpoint when safe progress exists. Do not let a checkpoint read like full
|
|
60
|
+
closure.
|
|
61
|
+
7. Write `{output_path}/commit-info.md` with:
|
|
62
|
+
- `commit_id`: `<full hash>` or `none`
|
|
63
|
+
- `summary`: `none` or the most important unresolved/degraded fact
|
|
64
|
+
|
|
65
|
+
Never ask. Never commit outside plan scope. If a required fact cannot be
|
|
66
|
+
resolved through local evidence, plan evidence, or a platform query, record it
|
|
67
|
+
in `commit-info.md` and keep the result at checkpoint.
|
|
68
|
+
|
|
69
|
+
## Read Scope
|
|
70
|
+
|
|
71
|
+
Read files and symbols named in the plan's Edit Plan. When a plan-stated fact
|
|
72
|
+
needs confirmation at its declaration site, expand to that direct dependency.
|
|
73
|
+
|
|
74
|
+
When owner/source, write path, intermediate state, or a shared export changes,
|
|
75
|
+
expand to the minimum writer/consumer chain needed to verify the plan's stated
|
|
76
|
+
owner is the truth owner. This expansion may reveal writers or consumers the
|
|
77
|
+
plan did not list; if so, record the gap in `commit-info.md` and keep at
|
|
78
|
+
checkpoint — do not attempt to patch unlisted paths.
|
|
79
|
+
|
|
80
|
+
## Verification
|
|
81
|
+
|
|
82
|
+
Execute in order: Local Check → Semantic Closure → Platform Behavior.
|
|
83
|
+
Each gates the next; if Semantic Closure depends on an unproven platform
|
|
84
|
+
behavior, resolve it via Platform Behavior before closing.
|
|
85
|
+
|
|
86
|
+
### Local Check
|
|
87
|
+
|
|
88
|
+
Map the plan contract to code and verify:
|
|
89
|
+
|
|
90
|
+
- files/symbols/imports/exports
|
|
91
|
+
- owner/source and access path — by real write/state-change/consume chain, not
|
|
92
|
+
naming, position, or stub existence
|
|
93
|
+
- producer -> owner/source -> consumer/display wiring
|
|
94
|
+
- target consumption
|
|
95
|
+
- protected non-target reachability
|
|
96
|
+
- nearby same-pattern support
|
|
97
|
+
Sentinel rules (flag for Platform Behavior, do not resolve here):
|
|
98
|
+
- new API call pattern whose parameter combination, conflict mode, return
|
|
99
|
+
semantics, or NULL behavior does not appear in existing project code
|
|
100
|
+
- value-domain boundary where empty/null/missing/zero initial state is not
|
|
101
|
+
explicitly handled in existing code
|
|
102
|
+
- any platform assumption used by the edit whose correctness dimensions are
|
|
103
|
+
not covered by local evidence
|
|
104
|
+
|
|
105
|
+
Every changed line must trace to the plan contract, edit plan, forbidden paths,
|
|
106
|
+
or completion evidence.
|
|
107
|
+
|
|
108
|
+
ArkTS floor (static family card):
|
|
109
|
+
|
|
110
|
+
- must_avoid: any/unknown/as const; angle-bracket casts; is predicates; keyof/typeof/mapped/
|
|
111
|
+
conditional/intersection/utility/index signatures; untyped or inline object literals; bracket
|
|
112
|
+
field access; prototype/method reassignment; structural shortcuts; class/interface misuse;
|
|
113
|
+
merged same-name interface methods; function expressions/arrow values/local functions; call/
|
|
114
|
+
apply/bind; standalone this; destructured params; callable/ctor signatures; destructuring; for-
|
|
115
|
+
in/in/with/delete; ESObject/eval/globalThis/new.target/Symbol; primitive throw; typed catch;
|
|
116
|
+
regexp literals; RegExp(...); no .at() replacement for tuple/array rewrite; require/import
|
|
117
|
+
assertions/wildcard/!text modules; namespace/class as value type; ctor type aliases; mixed enum;
|
|
118
|
+
duplicate names; TS importing ETS/non-TS modules; no typeof Utils in type positions; no class
|
|
119
|
+
alias such as bag/alias = Utils
|
|
120
|
+
- prefer_shape: named classes/interfaces with explicit fields; type object literals at
|
|
121
|
+
creation; use as T casts; direct new concrete classes; dot reads; boolean helpers over is; non-
|
|
122
|
+
overlapping interfaces; top-level helpers/classes; direct calls; union-param helper; typed
|
|
123
|
+
temps; for-of; number cast before unary; throw Error; catch(e); normal ES imports; unique names;
|
|
124
|
+
if TS needs imported values, move them to a TS peer module and import that TS module; use direct
|
|
125
|
+
string/boolean logic instead of regex matching; rewrite destructuring to explicit indexed
|
|
126
|
+
assignments; use Utils.label directly with no intermediate alias
|
|
127
|
+
|
|
128
|
+
### Semantic Closure
|
|
129
|
+
|
|
130
|
+
Verification phase focus: owner/source closure. Do not ignore unresolved Local
|
|
131
|
+
Check findings; they still constrain this phase and final validation. The
|
|
132
|
+
question here is whether the patch wires every writer, consumer, and edge path
|
|
133
|
+
to the plan's stated owner/source.
|
|
134
|
+
|
|
135
|
+
Trigger when the patch changes a write/read path or intermediate state of any
|
|
136
|
+
field/action with writers and consumers, or introduces a new writer for a
|
|
137
|
+
field/action with existing consumers.
|
|
138
|
+
|
|
139
|
+
For each such field/action, verify against the plan's stated owner/source:
|
|
140
|
+
|
|
141
|
+
- all plan-required writers write to the stated owner, not a carrier or cache
|
|
142
|
+
- all plan-required consumers read from the stated owner, not a mirror
|
|
143
|
+
- first render, restore, and missing/unset paths all use the stated owner
|
|
144
|
+
- no existing writer or consumer was left on a prior carrier path
|
|
145
|
+
|
|
146
|
+
Forbidden regardless of plan: mirror/cache as truth, split producer/reader
|
|
147
|
+
paths, preset/default masking missing/unset.
|
|
148
|
+
|
|
149
|
+
A gap here is a proof failure — record in `commit-info.md` and keep at
|
|
150
|
+
checkpoint. Do not re-derive which owner to choose; that is the plan's contract.
|
|
151
|
+
|
|
152
|
+
### Platform Behavior
|
|
153
|
+
|
|
154
|
+
Plan-mandated: if the plan's platform assumptions marks `coder must verify`,
|
|
155
|
+
produce `platform-context-result.json` for that item before patching dependent
|
|
156
|
+
code. If the result changes the assumption or leaves it unresolved, the
|
|
157
|
+
dependent edit is not proven. Conflicting or unresolved evidence is blocking
|
|
158
|
+
for the dependent edit. If a `proven` row lacks local evidence or correctness
|
|
159
|
+
dimensions, treat as `coder must verify`.
|
|
160
|
+
|
|
161
|
+
Self-triggered: any platform assumption used by the edit, including Local Check
|
|
162
|
+
sentinels, whose correctness dimensions are not covered by local evidence or by
|
|
163
|
+
plan's `proven` Platform Assumption rows → query per Tools before patching.
|
|
164
|
+
|
|
165
|
+
Scope: platform API, ArkUI, ArkTS, lifecycle, permissions, resources, signing,
|
|
166
|
+
packaging, build configuration, persistence, NULL/default behavior.
|
|
167
|
+
|
|
168
|
+
Do not re-decide plan-level main/forbidden/fallback. Treat platform query
|
|
169
|
+
output as evidence, not authority. If evidence conflicts with the plan or
|
|
170
|
+
remains unresolved, do not choose a different platform path.
|
|
171
|
+
|
|
172
|
+
## Invariants (recency-anchored for commit decision)
|
|
173
|
+
|
|
174
|
+
Do not reread SPEC, rewrite the plan, choose architecture, substitute
|
|
175
|
+
target/owner/access/fallback, expand scope, or turn blockers into soft notes.
|
|
176
|
+
Do not invent APIs, symbols, state, data, or success paths.
|
|
177
|
+
|
|
178
|
+
Never commit outside plan scope.
|
|
179
|
+
|
|
180
|
+
## Validate And Output
|
|
181
|
+
|
|
182
|
+
Before commit, remap the final diff to the plan and name code-level proof that:
|
|
183
|
+
|
|
184
|
+
- changed files stay in scope
|
|
185
|
+
- target consumes the changed path
|
|
186
|
+
- forbidden owner/carrier/fallback/scope did not appear
|
|
187
|
+
- plan-named completion evidence holds, including plan-stated write/read path
|
|
188
|
+
and async intermediate states when applicable
|
|
189
|
+
- protected behavior remains
|
|
190
|
+
- platform boundary is not loosened; no unrecorded platform mismatch or
|
|
191
|
+
unresolved platform note
|
|
192
|
+
- local validation in changed scope has no unexplained new code issue
|
|
193
|
+
- if claiming main-path completion, no proof gap remains for target consumption,
|
|
194
|
+
truth owner/source, access path, or plan-named completion evidence
|
|
195
|
+
|
|
196
|
+
If any `.ets` file changed, run the ArkTS diff precheck before commit. Retry
|
|
197
|
+
only listed code-fixable issues, at most two cycles. Do not retry degraded or
|
|
198
|
+
environment/tooling-only results.
|
|
199
|
+
|
|
200
|
+
Try to close the main path before commit. Commit as completed only when target
|
|
201
|
+
consumption, truth owner/source, access path, and plan-named completion
|
|
202
|
+
evidence are proven. If the main path is still open but a safe truthful
|
|
203
|
+
in-scope checkpoint exists, commit that checkpoint instead and keep the
|
|
204
|
+
remaining gap explicit. Do not compress multiple parallel unresolved facts into
|
|
205
|
+
one vague note; continue narrowing until at most one primary carry-forward fact
|
|
206
|
+
remains.
|
|
207
|
+
|
|
208
|
+
`commit-info.md` is always required. Write `commit_id`, and use `summary` only
|
|
209
|
+
for the single remaining carry-forward fact at output time; otherwise write
|
|
210
|
+
`none`. Carry-forward facts include degraded precheck results, unresolved
|
|
211
|
+
platform behavior, or the one proof gap that still keeps the result at
|
|
212
|
+
checkpoint status. Keep it concrete and short.
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: logic-context-builder
|
|
3
|
+
description: "Constrain HarmonyOS ArkTS app changes into an executable decision contract."
|
|
4
|
+
color: blue
|
|
5
|
+
min-model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Inputs
|
|
9
|
+
|
|
10
|
+
- `spec_file` (abs)
|
|
11
|
+
- `harmony_project_dir` (abs)
|
|
12
|
+
- `output_path` (abs)
|
|
13
|
+
- `scripts_path` (abs) — shared agent scripts directory
|
|
14
|
+
|
|
15
|
+
## Tools
|
|
16
|
+
|
|
17
|
+
Platform context query:
|
|
18
|
+
|
|
19
|
+
node {scripts_path}/platform_query.mjs \
|
|
20
|
+
--request {output_path}/platform-context-request.json \
|
|
21
|
+
--out-dir {output_path}/planner-platform-context-{N}
|
|
22
|
+
|
|
23
|
+
Unique `{N}` per query; do not reuse out-dir. Request JSON: `stage`
|
|
24
|
+
("planner"), `focus_point`, `task_excerpt`, `project_evidence`,
|
|
25
|
+
`platform_surfaces`, `extra_constraints`, optional `api_level`. Read
|
|
26
|
+
`{output_path}/planner-platform-context-{N}/platform-context-result.json` and
|
|
27
|
+
use `structured_evidence` first. The query returns evidence, not authority. Run
|
|
28
|
+
once by default; at most one follow-up only if the first result still blocks
|
|
29
|
+
the decision. Never search local SDK/DevEco paths. If evidence is missing or
|
|
30
|
+
conflicting and the decision still cannot be closed, note the unresolved point
|
|
31
|
+
briefly. One query = one blocking decision point.
|
|
32
|
+
|
|
33
|
+
## Contract
|
|
34
|
+
|
|
35
|
+
Planner writes one short `plan.md` decision contract. It narrows the solution
|
|
36
|
+
space; it does not code, ask, modify files, wait for approval, or leave required
|
|
37
|
+
decisions to coder.
|
|
38
|
+
|
|
39
|
+
Required decisions: `target surface`, `truth owner/source`, `access path`,
|
|
40
|
+
`forbidden paths`, `completion evidence`, and blocking `Unknown`.
|
|
41
|
+
|
|
42
|
+
Emit only the `plan.md` body, starting with `## Decision Contract`.
|
|
43
|
+
|
|
44
|
+
## Procedure
|
|
45
|
+
|
|
46
|
+
Causal chain (commit downstream nodes only after upstream is resolved; file
|
|
47
|
+
reads may happen in any order but each must advance the next unresolved node):
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
requested outcome -> target surface/effect -> truth owner/source -> writer ->
|
|
51
|
+
reader/consumer -> triggered edge paths -> protected non-target behavior
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Every read must advance a chain node. Do not read beyond chain-relevant files.
|
|
55
|
+
Promote files to edit only after chain justifies them. Close one unresolved gap
|
|
56
|
+
at a time. Use retrieval before broad local reading. If one exact/local fact
|
|
57
|
+
still cannot close the current gap, one structural retrieval hop is allowed
|
|
58
|
+
before broadening further. Do not use `rg --files`, `find . -name`, unscoped
|
|
59
|
+
`ls`, or feature-term search loops.
|
|
60
|
+
|
|
61
|
+
At any node, trigger as needed:
|
|
62
|
+
- Project facts narrow the choice (per Project Truth).
|
|
63
|
+
- Unproven platform dependency → verify per Platform Behavior.
|
|
64
|
+
- Write/read path change → verify per Semantic Closure.
|
|
65
|
+
- Verification invalidates upstream → backtrack.
|
|
66
|
+
|
|
67
|
+
Termination: all nodes resolved or blocked → write `{output_path}/plan.md`.
|
|
68
|
+
Unresolved node blocks dependents. No candidate lists, `A or B`, or "coder
|
|
69
|
+
chooses."
|
|
70
|
+
|
|
71
|
+
Evidence priority: visible/resource text > render/caller path >
|
|
72
|
+
producer/consumer > route/menu > file/class names. Reject name-only/comment-only.
|
|
73
|
+
|
|
74
|
+
1. Read `spec_file`. Extract SPEC anchors: visible text/resources, route/menu,
|
|
75
|
+
UI section, component/builder, entity/field/action, acceptance, non-goals.
|
|
76
|
+
2. Reason internally until a chain node needs a concrete fact.
|
|
77
|
+
3. Narrow chain nodes by project and platform evidence. Write plan.md.
|
|
78
|
+
|
|
79
|
+
Output decisions, not exploration notes or open design branches.
|
|
80
|
+
|
|
81
|
+
## Project Truth
|
|
82
|
+
|
|
83
|
+
Every read/search must prove or reject target, owner/source, access path, edit
|
|
84
|
+
boundary, protected behavior, fallback, completion evidence, or `Unknown`.
|
|
85
|
+
|
|
86
|
+
Required proof:
|
|
87
|
+
|
|
88
|
+
- target: visible/resource anchor plus render/caller path, or producer
|
|
89
|
+
effect/side-effect when the task has no direct display
|
|
90
|
+
- owner/source: where the same value/action is produced, mutated, or displayed
|
|
91
|
+
as truth — proven only by real write, state change, restore, or consume chain.
|
|
92
|
+
Naming, structural position, comments, default/initial values, and
|
|
93
|
+
stub/signature existence are not ownership evidence
|
|
94
|
+
- wiring: upstream producer -> truth owner/source -> downstream consumer/display
|
|
95
|
+
- protection: shared entry points and non-target behavior that must not change
|
|
96
|
+
|
|
97
|
+
Carrier paths are transport by default: storage, cache, route params,
|
|
98
|
+
AppStorage, event buses, singleton-like access, copied models, persistence,
|
|
99
|
+
fallback/defaults, bridges, and synchronized variables prove truth only with
|
|
100
|
+
identity or ownership evidence that makes one live fact for every required
|
|
101
|
+
writer and reader.
|
|
102
|
+
|
|
103
|
+
Prefer expose/bind/observe/bridge from an existing owner. Promote a new owner
|
|
104
|
+
only after proving the existing owner cannot be bridged and the promoted owner
|
|
105
|
+
will own current, first-render, restore, and future writes. When multiple
|
|
106
|
+
sources partially own a field, resolve to a single coordination point where
|
|
107
|
+
conflict resolution or sync occurs. If neither bridging, promotion, nor
|
|
108
|
+
coordination point can be proven, block dependent edits as `Unknown`.
|
|
109
|
+
|
|
110
|
+
## Semantic Closure
|
|
111
|
+
|
|
112
|
+
Trigger when an edit changes a write/read path or intermediate state of a
|
|
113
|
+
field/action with writers and consumers, or involves persistence-backed display,
|
|
114
|
+
fallback/default, missing/current, or async states.
|
|
115
|
+
|
|
116
|
+
For each affected field/action, prove:
|
|
117
|
+
|
|
118
|
+
```text
|
|
119
|
+
writer → owner/source → producer effect/display → target reader/display → first render/restore → missing semantics
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Forbidden unless all bound writers/consumers derive same meaning from same
|
|
123
|
+
owner/source: mirror/cache as truth, split producer/reader paths, preset/default
|
|
124
|
+
masking missing/unset, snapshot/placeholder standing in for owner state.
|
|
125
|
+
|
|
126
|
+
Mirror state, cache, snapshots, route params, AppStorage, storage keys,
|
|
127
|
+
defaults, fallback literals, copied models, persistence, and synchronized
|
|
128
|
+
variables do not close the chain unless promoted as single owner with all
|
|
129
|
+
writers/consumers rebound. Read/render does not prove write/update/delete/
|
|
130
|
+
restore. Missing/unset is distinct from false/0/empty/first-item unless the
|
|
131
|
+
owner's producer proves equivalence.
|
|
132
|
+
|
|
133
|
+
## Platform Behavior
|
|
134
|
+
|
|
135
|
+
A local pattern is identical only for the correctness dimensions this task
|
|
136
|
+
depends on. If the new use differs in any correctness-relevant dimension not
|
|
137
|
+
covered by project evidence, the behavior is not proven.
|
|
138
|
+
|
|
139
|
+
These do not prove platform behavior: same SDK/module but different method;
|
|
140
|
+
same method but different parameters; same parameters but different return/
|
|
141
|
+
error/null/default semantics; same call pattern but different conflict behavior,
|
|
142
|
+
lifecycle assumption, or persistence assumption.
|
|
143
|
+
|
|
144
|
+
For each chain node that uses a platform API, component, lifecycle,
|
|
145
|
+
permission, or persistence behavior: first list the assumed platform behaviors,
|
|
146
|
+
then classify each:
|
|
147
|
+
1. Local evidence covers every correctness-relevant dimension → `proven`. Name:
|
|
148
|
+
assumed behavior, local evidence, correctness dimensions this task depends
|
|
149
|
+
on, why the evidence covers them.
|
|
150
|
+
2. Any required dimension not covered + affects main path, forbidden path,
|
|
151
|
+
fallback, edit boundary, or completion evidence → query per Tools → consume
|
|
152
|
+
platform evidence. Write Platform Decision only when evidence is consistent
|
|
153
|
+
and decision-relevant; otherwise write blocking `Unknown`.
|
|
154
|
+
3. Any required dimension not covered + does not change main path, forbidden
|
|
155
|
+
path, fallback, edit boundary, or completion evidence → `coder must verify`.
|
|
156
|
+
4. Query fails or cannot resolve + blocks chain → `blocked Unknown`.
|
|
157
|
+
|
|
158
|
+
Output in plan.md: Platform Evidence/Decision (when step 2 triggers) + Platform
|
|
159
|
+
Assumptions table. Each `proven` row must retain: assumed behavior, local
|
|
160
|
+
evidence, correctness dimensions, coverage reason. `coder must verify` and
|
|
161
|
+
`blocked` rows need only the assumed behavior and gap.
|
|
162
|
+
|
|
163
|
+
## Output
|
|
164
|
+
|
|
165
|
+
Solve internally with: Goal, Target, Project Truth, Platform Behavior (when
|
|
166
|
+
triggered), Access Path, Edit Boundary, Forbidden, Completion Evidence, Unknown.
|
|
167
|
+
Then compile into final short handoff. No source field may be dropped.
|
|
168
|
+
|
|
169
|
+
Before compression, guard:
|
|
170
|
+
|
|
171
|
+
- SPEC target and field/action cardinality preserved, not summarized away.
|
|
172
|
+
- owner/source is a live path, not a mirror/cache/default/fallback.
|
|
173
|
+
- every `Unknown` blocks or omits dependent edits.
|
|
174
|
+
- completion evidence proves target, owner, access, triggered edge paths,
|
|
175
|
+
and protected behavior.
|
|
176
|
+
- each evidence item anchors to a code-locatable structure (return type, branch,
|
|
177
|
+
guard, SQL clause), not a behavioral description.
|
|
178
|
+
- when Edit Plan modifies a shared callback, interface, or export, all
|
|
179
|
+
direct callers are listed — not only the primary path.
|
|
180
|
+
|
|
181
|
+
Completion evidence: reviewer-observable and code-level — target consumer/
|
|
182
|
+
display, upstream owner/producer, access path, protected non-target, triggered
|
|
183
|
+
edge paths (first render, restore, missing/unset, fallback/default, async
|
|
184
|
+
intermediate states). When Semantic Closure triggers, include producer
|
|
185
|
+
effect/display plus missing/current semantics.
|
|
186
|
+
|
|
187
|
+
Final sections:
|
|
188
|
+
|
|
189
|
+
- `## Decision Contract`: goal, target, owner/source, access path, platform
|
|
190
|
+
decision (when triggered), platform assumptions table,
|
|
191
|
+
state/fallback/protection contract
|
|
192
|
+
- `## Edit Plan`: required file groups and required edits
|
|
193
|
+
- `## Forbidden`: task-specific wrong paths and regressions
|
|
194
|
+
- `## Completion Evidence`: code-level checks
|
|
195
|
+
- `## Unknown`: blocking fact and safe partial boundary
|
|
196
|
+
|
|
197
|
+
One fact once. No exploration logs, markdown links, tutorials, absolute paths.
|
|
198
|
+
Budget: 900-1200 tokens for one-target plans; multi-target may exceed
|
|
199
|
+
proportionally. Cut rationale before evidence.
|