hive-lite 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.
Files changed (33) hide show
  1. package/README.md +443 -0
  2. package/bin/hive.js +6 -0
  3. package/docs/cli-semantics.md +386 -0
  4. package/docs/skills/hive-lite-finish/SKILL.md +282 -0
  5. package/docs/skills/hive-lite-finish/agents/openai.yaml +4 -0
  6. package/docs/skills/hive-lite-finish/references/safety.md +95 -0
  7. package/docs/skills/hive-lite-finish/references/verdicts.md +123 -0
  8. package/docs/skills/hive-lite-map-maintainer/SKILL.md +203 -0
  9. package/docs/skills/hive-lite-map-maintainer/agents/openai.yaml +7 -0
  10. package/docs/skills/hive-lite-map-maintainer/references/lifecycle.md +114 -0
  11. package/docs/skills/hive-lite-map-maintainer/references/repair-rules.md +201 -0
  12. package/docs/skills/hive-lite-start-prompt/SKILL.md +283 -0
  13. package/docs/skills/hive-lite-start-prompt/agents/openai.yaml +4 -0
  14. package/docs/skills/hive-lite-start-prompt/references/input-calibration.md +82 -0
  15. package/docs/skills/hive-lite-start-prompt/references/preflight.md +116 -0
  16. package/package.json +40 -0
  17. package/src/cli.js +910 -0
  18. package/src/lib/change.js +642 -0
  19. package/src/lib/context.js +1104 -0
  20. package/src/lib/evidence.js +230 -0
  21. package/src/lib/fsx.js +54 -0
  22. package/src/lib/git.js +128 -0
  23. package/src/lib/glob.js +47 -0
  24. package/src/lib/health.js +1012 -0
  25. package/src/lib/id.js +13 -0
  26. package/src/lib/map.js +713 -0
  27. package/src/lib/next.js +341 -0
  28. package/src/lib/risk.js +122 -0
  29. package/src/lib/roles.js +109 -0
  30. package/src/lib/scope.js +168 -0
  31. package/src/lib/skills.js +349 -0
  32. package/src/lib/status.js +344 -0
  33. package/src/lib/yaml.js +223 -0
@@ -0,0 +1,201 @@
1
+ # Project Map Repair Rules
2
+
3
+ Project Map is not a wiki. It is a safe edit permit and evidence-policy source.
4
+
5
+ Only add fields that help:
6
+
7
+ - `find` answer where to read, what to edit, what not to touch, validation, and risk.
8
+ - `check` answer what evidence is needed to accept a change.
9
+
10
+ ## Area Shape
11
+
12
+ Prefer focused product/work areas:
13
+
14
+ ```text
15
+ dashboard.action_inbox
16
+ change.evidence_policy
17
+ cli.map_health
18
+ project_map.delta_review
19
+ ```
20
+
21
+ Avoid generic one-part areas:
22
+
23
+ ```text
24
+ dashboard
25
+ frontend
26
+ server
27
+ components
28
+ src
29
+ utils
30
+ ```
31
+
32
+ ## Scope Tiers
33
+
34
+ Use tiered scope:
35
+
36
+ ```yaml
37
+ scope:
38
+ readable:
39
+ - apps/dashboard/src/**
40
+ writable_direct:
41
+ - apps/dashboard/src/pages/InboxPage.vue
42
+ writable_conditional:
43
+ - pattern: apps/dashboard/src/api/client.ts
44
+ reason: only if API shape changes
45
+ requires_review: true
46
+ writable_broad_fallback:
47
+ - pattern: apps/dashboard/src/**
48
+ reason: fallback only when direct files are insufficient
49
+ requires_review: true
50
+ forbidden:
51
+ - apps/dashboard/dist/**
52
+ ```
53
+
54
+ Rules:
55
+
56
+ - `readable` may be broad.
57
+ - `writable_direct` should be exact existing files, usually 2-8 files.
58
+ - Broad patterns such as `apps/*/src/**`, `packages/**`, `server/**`, and `**` must not be in `writable_direct`.
59
+ - Every conditional/fallback item needs `reason` and `requires_review: true`.
60
+
61
+ ## Entrypoint Roles
62
+
63
+ Use only these roles:
64
+
65
+ ```text
66
+ page
67
+ ui_component
68
+ styles
69
+ state_store
70
+ grouping_logic
71
+ data_transform
72
+ api_contract
73
+ schema_logic
74
+ cli_behavior
75
+ error_handling
76
+ cache_logic
77
+ config
78
+ docs
79
+ test
80
+ unknown
81
+ ```
82
+
83
+ Example:
84
+
85
+ ```yaml
86
+ entrypoints:
87
+ - path: apps/dashboard/src/pages/InboxPage.vue
88
+ role: page
89
+ label: Dashboard Action Inbox page
90
+ source: manual
91
+ confidence: high
92
+ ```
93
+
94
+ If uncertain:
95
+
96
+ ```yaml
97
+ role: unknown
98
+ source: agent_draft
99
+ confidence: low
100
+ todo: Confirm this file's durable role before using it as a strong evidence signal.
101
+ ```
102
+
103
+ Do not invent role names.
104
+
105
+ ## Verification Policy
106
+
107
+ Add a minimal area verification policy:
108
+
109
+ ```yaml
110
+ verification:
111
+ direct_manual_allowed: true
112
+ manual_profiles:
113
+ - manual-verification
114
+ focused_test_recommended_for_roles:
115
+ - grouping_logic
116
+ - data_transform
117
+ - error_handling
118
+ - cli_behavior
119
+ focused_test_required_for_roles: []
120
+ review_with_reason_allowed: true
121
+ risk_acceptance_allowed: false
122
+ ```
123
+
124
+ Guidance:
125
+
126
+ - UI/page/styles/docs areas usually allow direct manual verification.
127
+ - Internal logic/data/schema/cache/error/CLI behavior usually recommends focused tests or a review reason.
128
+ - Keep `focused_test_required_for_roles` empty unless the area is clearly high risk.
129
+ - Do not make risk acceptance a normal path.
130
+
131
+ ## Validation Profiles
132
+
133
+ Reference only profiles that exist in `.hive/map/validation.yaml`.
134
+
135
+ Command profile example:
136
+
137
+ ```yaml
138
+ profiles:
139
+ - id: dashboard-build
140
+ type: command
141
+ command: bun --cwd apps/dashboard build
142
+ evidence_type: build
143
+ covers_roles:
144
+ - page
145
+ - ui_component
146
+ - styles
147
+ safety: safe_auto
148
+ ```
149
+
150
+ Manual profile example:
151
+
152
+ ```yaml
153
+ profiles:
154
+ - id: generic-ui-visual
155
+ type: manual
156
+ evidence_type: manual_visual
157
+ instructions:
158
+ - Open the affected UI.
159
+ - Confirm the requested visible behavior is correct.
160
+ - Confirm no obvious visual regression.
161
+ covers_roles:
162
+ - page
163
+ - ui_component
164
+ - styles
165
+ safety: manual_only
166
+ ```
167
+
168
+ If a profile is plausible but unconfirmed, leave a TODO instead of referencing it as active.
169
+
170
+ ## What Not To Add
171
+
172
+ Do not add:
173
+
174
+ - full code graph
175
+ - endpoint catalog
176
+ - function-level documentation
177
+ - every component
178
+ - test coverage analysis
179
+ - agent summaries as facts
180
+ - validation commands not backed by repo scripts or explicit files
181
+ - broad writable permits for convenience
182
+
183
+ ## Git Ignore Boundary
184
+
185
+ Hive Lite Project Map files are durable and should be versioned:
186
+
187
+ ```text
188
+ .hive/config.yaml
189
+ .hive/map/**
190
+ ```
191
+
192
+ Runtime evidence should be ignored:
193
+
194
+ ```text
195
+ .hive/context/
196
+ .hive/changes/
197
+ .hive/patches/
198
+ .hive/state/
199
+ ```
200
+
201
+ Do not blanket-ignore `.hive/`. If `.hive/map/*.yaml` is ignored by `.gitignore` or `.git/info/exclude`, tell the user because map refresh changes may not show in `git status` or be committed.
@@ -0,0 +1,283 @@
1
+ ---
2
+ name: hive-lite-start-prompt
3
+ description: Use this skill when a user gives a coding requirement, screenshot, or rough product request and wants Hive Lite to produce a safe, high-quality start prompt for a coding agent. It calibrates user input into a textual find intent, runs Hive Lite status/find/map-health/map-prompt loops, repairs only Project Map YAML when needed, and stops after returning an edit-ready Context Packet prompt rather than changing application code.
4
+ ---
5
+
6
+ # Hive Lite Start Prompt
7
+
8
+ ## Purpose
9
+
10
+ Turn a natural-language or visual requirement into an edit-ready Hive Lite Context Packet and a concise prompt for a separate coding agent.
11
+
12
+ This is a pre-work skill. It may refine `.hive/map/*.yaml` so Hive Lite can route the requirement safely, but it must not implement the requested product/code change.
13
+
14
+ ## References
15
+
16
+ - For screenshots, rough wording, `findIntent`, and `mapRepairFocus`, read [input-calibration.md](references/input-calibration.md).
17
+ - When `hive-lite status --json` is not clean, read [preflight.md](references/preflight.md) and stop for user confirmation.
18
+ - For standalone map lifecycle work, large map refreshes, or repeated find-gap repair failures, hand off to `$hive-lite-map-maintainer` instead of expanding this start flow. Do not assume this skill can invoke another skill automatically; output a clear handoff prompt for the user.
19
+
20
+ ## Skill Handoffs
21
+
22
+ Do not assume this skill can invoke another skill automatically. Handoffs are text for the user to run explicitly.
23
+
24
+ - To map maintenance: output a `$hive-lite-map-maintainer` prompt and stop.
25
+ - To finish work after coding: include `$hive-lite-finish` in the final instructions, but do not run finish actions here.
26
+
27
+ If the target handoff skill is unavailable in the active agent CLI, tell the user to install or sync Hive Lite skills for their agent first. Hive Lite cannot detect the running agent by itself; use the user's agent target such as `codex`, `claude`, or `gemini`:
28
+
29
+ ```bash
30
+ hive-lite skills doctor --agent <codex|claude|gemini>
31
+ hive-lite skills install --agent <codex|claude|gemini>
32
+ ```
33
+
34
+ ## Boundaries
35
+
36
+ - Do not edit application source, tests, docs, `.gitignore`, generated artifacts, `.hive/context`, `.hive/changes`, or `.hive/deltas`.
37
+ - Only edit these Project Map files when map repair is needed: `.hive/map/project.yaml`, `.hive/map/areas.yaml`, `.hive/map/rules.yaml`, `.hive/map/validation.yaml`.
38
+ - Do not run `hive check`, `hive validate`, `hive accept`, commits, formatters, or app tests for the new requirement. Those belong after the coding agent changes code.
39
+ - During preflight, you may help finish or isolate pre-existing work only after explicit user confirmation.
40
+ - Never discard changes with destructive commands such as `git reset --hard`, `git checkout --`, or forced branch switches.
41
+ - Do not call an LLM API from Hive Lite. If a map gap exists, use `hive map prompt --from-find` as the repair brief and edit the map directly as the current agent.
42
+
43
+ ## Find The CLI
44
+
45
+ Run Hive Lite from the target repo root. Prefer the package command:
46
+
47
+ ```bash
48
+ hive-lite <args>
49
+ ```
50
+
51
+ If `hive-lite` is not available, try an explicit path already given by the user or conversation context, such as `node /path/to/hive-lite/bin/hive.js <args>`. Do not spend a long time searching the target repo; ask for the Hive Lite CLI path if it is not obvious.
52
+
53
+ In command examples below, replace `hive-lite` with the resolved command.
54
+
55
+ ## Workflow
56
+
57
+ ### 1. Establish Target And Calibrate Input
58
+
59
+ Identify the target repo root, original user requirement, and any screenshot/visual evidence.
60
+
61
+ Read [input-calibration.md](references/input-calibration.md). Produce:
62
+
63
+ - `originalRequirement`: the user's request preserved for the final prompt.
64
+ - `findIntent`: clear text to pass to `hive-lite find`.
65
+ - `mapRepairFocus`: map-oriented focus to use only if map repair is needed.
66
+
67
+ ### 2. Preflight The Worktree
68
+
69
+ If `.hive/map/project.yaml`, `.hive/map/areas.yaml`, `.hive/map/rules.yaml`, or `.hive/map/validation.yaml` is missing, run:
70
+
71
+ ```bash
72
+ hive-lite init
73
+ ```
74
+
75
+ Do this automatically; do not ask the user whether to initialize Hive Lite. Initialization is setup work, not the requested product change.
76
+
77
+ Run:
78
+
79
+ ```bash
80
+ hive-lite status --json
81
+ ```
82
+
83
+ If status reports `hive.state = repo_setup_required`, stop immediately. Do not run `hive-lite init` and do not initialize git automatically. Tell the user to switch to the correct git repo root, or manually initialize git and create an initial commit before using Hive Lite.
84
+
85
+ If the command is unavailable in an older Hive Lite, fall back to `git status --porcelain`.
86
+
87
+ Continue only when `canStartNewRequirement` is true or fallback git status is clean. If not clean, read [preflight.md](references/preflight.md), present options, and stop immediately unless the user had already explicitly chosen an option before this step.
88
+
89
+ After any preflight action, rerun `hive-lite status --json`; continue only when the target worktree is clean.
90
+
91
+ ### 3. Verify The Existing Map
92
+
93
+ Run:
94
+
95
+ ```bash
96
+ hive-lite map verify
97
+ ```
98
+
99
+ If YAML is invalid or required map files are missing, repair only `.hive/map/*.yaml` if the fix is obvious. Otherwise stop and report the blocker.
100
+
101
+ ### 4. Run Find As Data
102
+
103
+ Run:
104
+
105
+ ```bash
106
+ hive-lite find "<findIntent>" --json
107
+ ```
108
+
109
+ Use JSON for decisions. Important fields: `id`, `mode`, `area.id`, `writableScope`, `scope`, `doNotTouch`, `validationPlan`, `warnings`, `reviewGated`, `recommendedActions`, and `explain`.
110
+
111
+ Use `--explain` only when human-readable debugging is useful.
112
+
113
+ ### 5. Decide Whether The Packet Is Ready
114
+
115
+ If `mode` is `needs_decomposition`, stop immediately. Do not output a `Coding Agent Prompt`.
116
+
117
+ Explain that the requirement cannot safely become one Context Packet / one Change Record. Use `decompositionSignals` and `candidatePhaseSeeds` from the JSON to present a split plan:
118
+
119
+ ```text
120
+ This requirement is too broad for one Hive Lite change.
121
+
122
+ Why:
123
+ - <decomposition signal>
124
+
125
+ Suggested phases:
126
+ 1. <area id / phase hint>
127
+ Continue with:
128
+ $hive-lite-start-prompt
129
+ Continue split <split_id> with phase <phase_id>.
130
+ Use this find intent: "<candidatePhaseSeeds[n].findIntent>"
131
+ Evidence: <candidatePhaseSeeds[n].evidenceClasses / validationProfiles>
132
+ 2. ...
133
+
134
+ Please choose one phase to start, then rerun this skill with that phase.
135
+ ```
136
+
137
+ Do not create durable Feature/Task objects. Do not edit code. Do not merge candidate areas into a wider prompt.
138
+
139
+ If the JSON includes `splitNote`, mention its markdown path. Treat it as a local context artifact, not a task list. When the user explicitly invokes this skill for a chosen phase, rerun find with the phase source:
140
+
141
+ ```bash
142
+ hive-lite find "<phase.findIntent>" --from-split <split_id> --phase <phase_id> --area <phase.primaryAreaId> --json
143
+ ```
144
+
145
+ Continue only if that phase-specific find returns `edit_context`.
146
+
147
+ If the phase-specific JSON includes `phaseDependencyStatus.canStartNormally: false`, do not output a coding prompt. If `splitFound` or `phaseFound` is false, explain that the copied split command is not an edit permit and recommend finding the current split note with `hive-lite status --json` or rerunning the original broad find command. Otherwise explain the missing required phases and recommend the next dependency phase. If the user says "continue split" or "resume the large requirement", use `hive-lite status --json` and its `recentSplitNotes` to find ready phases, then output a phase-specific `$hive-lite-start-prompt` handoff or continue only if the user explicitly asked this active skill to proceed with that phase.
148
+
149
+ Accept the packet only when all are true:
150
+
151
+ - `mode` is `edit_context`.
152
+ - `area.id` is present.
153
+ - `writableScope` contains at least one narrow direct file.
154
+ - `validationPlan` is not empty.
155
+ - `warnings` has no map-gap warning such as `NO_CONFIDENT_AREA`, `MISSING_DIRECT_WRITABLE_SCOPE`, `MISSING_ENTRYPOINT`, or `MISSING_VALIDATION`.
156
+ - `hive-lite map health --area <areaId> --json` reports no critical findings.
157
+
158
+ Review-gated conditional or broad fallback scope is allowed. Include it in the final prompt as a boundary, not as a failure.
159
+
160
+ ### 6. Repair Map Gaps
161
+
162
+ If the packet is not ready, run:
163
+
164
+ ```bash
165
+ hive-lite map prompt --focus "<mapRepairFocus>" --from-find <ctx_id>
166
+ ```
167
+
168
+ Use the generated prompt as the map repair brief. Edit only the allowed `.hive/map/*.yaml` files.
169
+
170
+ Repair principles:
171
+
172
+ - Prefer focused product/work area ids such as `dashboard.action_inbox`, not one-part ids such as `dashboard`.
173
+ - Preserve unrelated areas exactly unless a change is needed for the reported map gap.
174
+ - Use `scope.writable_direct` for exact files the coding agent may edit.
175
+ - Put conditional files under `scope.writable_conditional` with `reason` and `requires_review: true`.
176
+ - Put broad patterns only under `scope.writable_broad_fallback` with `reason` and `requires_review: true`.
177
+ - Never put broad patterns such as `apps/*/src/**`, `packages/**`, `server/**`, or `**` in `writable_direct`.
178
+ - Do not invent paths. Verify paths with `rg --files` or `git ls-files`.
179
+ - Use only validation profile ids that exist in `.hive/map/validation.yaml`, or update `validation.yaml` to define profiles from confirmed repo scripts.
180
+ - Mark uncertainty with TODO comments rather than guessing.
181
+
182
+ After each repair, run:
183
+
184
+ ```bash
185
+ hive-lite map verify
186
+ hive-lite map health --area <area_id> --json
187
+ hive-lite find "<findIntent>" --json
188
+ ```
189
+
190
+ Repeat at most two repair cycles. If the packet still is not edit-ready, stop and return the blocker, current context id, findings, and recommended next command.
191
+
192
+ If map files were changed during repair, stop before producing a coding prompt unless the worktree has been returned to clean. Ask the user to commit the map refinement, stash it, or use a separate worktree; then rerun this skill.
193
+
194
+ If the repair requires broad map refresh beyond the selected area, stop and hand off to `$hive-lite-map-maintainer`:
195
+
196
+ ```text
197
+ This map repair is broader than the start flow should handle.
198
+
199
+ Run:
200
+
201
+ $hive-lite-map-maintainer
202
+ Repair the Hive Lite Project Map for this start-flow gap.
203
+ Context packet: <ctx_id>
204
+ Find intent: "<findIntent>"
205
+ Map repair focus: "<mapRepairFocus>"
206
+ Current blocker: <warnings or health findings>
207
+ Only edit .hive/map/*.yaml. Do not edit application code.
208
+ ```
209
+
210
+ Do not continue to generate a Coding Agent Prompt until the map maintainer flow has completed and the user reruns this start skill.
211
+
212
+ If `needs_decomposition` persists after the user selects a smaller phase, ask the user to narrow the phase goal further instead of generating a coding prompt.
213
+
214
+ ### 7. Return The Start Prompt
215
+
216
+ When ready, return two clearly separated sections:
217
+
218
+ - `Preparation Summary`: for the human only. Include preflight actions, commits made before start, whether `.hive/map/*.yaml` changed, and the Context Packet id.
219
+ - `Coding Agent Prompt`: the only text the user should pass to the coding agent.
220
+
221
+ Do not include preparation/provenance notes inside `Coding Agent Prompt`.
222
+
223
+ ```text
224
+ Ready to start.
225
+
226
+ Preparation Summary:
227
+ - Preflight: clean
228
+ - Pre-existing work handled: <none or commit/stash/worktree summary>
229
+ - Map files changed while preparing this prompt: <none or list>
230
+ - Context Packet: <relative .hive/context/ctx_xxx.md>
231
+
232
+ Coding Agent Prompt:
233
+ Context Packet:
234
+ <relative .hive/context/ctx_xxx.md>
235
+
236
+ Requirement:
237
+ <originalRequirement>
238
+
239
+ Use this context packet as your source of truth. Edit only Direct Writable files.
240
+
241
+ Direct Writable:
242
+ - <file>
243
+
244
+ Review-Gated:
245
+ - <conditional/broad item and reason>
246
+
247
+ Do Not Touch:
248
+ - <forbidden item>
249
+
250
+ Validation To Expect:
251
+ - <command or manual check>
252
+
253
+ Verification Guidance:
254
+ - If the change is directly manually verifiable, provide exact manual verification steps.
255
+ - If the change is not directly manually verifiable and changes behavior, provide focused automated verification when practical.
256
+ - Prefer a small existing or new focused test over broad unrelated tests.
257
+ - Do not add broad, brittle, or low-value tests only for process.
258
+ - If focused automated verification is impractical, explain why and provide a concise review rationale.
259
+ - Do not weaken or delete validation, CI, or existing tests.
260
+
261
+ Hive Check After Editing:
262
+ - <resolved hive command> check --context <ctx_id>
263
+
264
+ Read <relative .hive/context/ctx_xxx.md>.
265
+ Modify only the Direct Writable files listed there.
266
+ If the fix requires a Review-Gated file, stop and explain why it is needed before editing it.
267
+ Do not touch Do Not Touch paths.
268
+ After editing, summarize changed files and tell the human to run:
269
+ <resolved hive command> check --context <ctx_id>
270
+
271
+ Then the human can use `$hive-lite-finish` to drive check, validation, manual evidence, and acceptance.
272
+
273
+ If the human later reports that business/manual verification failed, revise under this same Context Packet instead of expanding scope or treating it as a new requirement. Use the human's failure observation as the repair target, keep the same Direct Writable / Review-Gated / Do Not Touch boundaries, and again tell the human to rerun:
274
+ <resolved hive command> check --context <ctx_id>
275
+ ```
276
+
277
+ Preparation details such as commits made, stashes created, worktree setup, map files changed, or "no map files changed" are for `Preparation Summary` only. Do not list `hive-lite check --context ...` under validation commands; it is the change-control step after the coding agent edits files.
278
+
279
+ ## Failure Output
280
+
281
+ If no edit-ready prompt can be produced, return the context packet id, current mode, selected area if any, blocking warnings or health critical findings, exact next command, and whether `.hive/map/*.yaml` files were changed.
282
+
283
+ Do not pretend the agent can safely start coding when the packet is `discovery_context` or `needs_map`.
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "Hive Lite Start Prompt"
3
+ short_description: "Prepare safe Hive Lite coding prompts"
4
+ default_prompt: "Use $hive-lite-start-prompt to prepare a safe coding-agent start prompt for this requirement."
@@ -0,0 +1,82 @@
1
+ # Input Calibration
2
+
3
+ Use this reference before running `hive-lite find`.
4
+
5
+ Hive Lite only receives text. The agent using this skill is responsible for converting user intent, screenshots, UI observations, and rough wording into precise text.
6
+
7
+ ## Build Three Texts
8
+
9
+ Keep these separate:
10
+
11
+ - `originalRequirement`: the user's actual request, preserved for the final coding prompt.
12
+ - `findIntent`: a concise requirement for `hive-lite find`.
13
+ - `mapRepairFocus`: a Project Map repair focus for `hive-lite map prompt --focus` if `find` reports a gap.
14
+
15
+ ## Find Intent
16
+
17
+ `findIntent` should describe what needs to change in product/work terms.
18
+
19
+ Good:
20
+
21
+ ```text
22
+ Dashboard Action Inbox should display Feature as the parent item and expandable Tasks underneath, instead of showing Feature and Task as peer categories.
23
+ ```
24
+
25
+ Avoid:
26
+
27
+ ```text
28
+ Fix the thing in the screenshot.
29
+ ```
30
+
31
+ Include stable nouns users and map areas may know:
32
+
33
+ - product surface or page,
34
+ - workflow,
35
+ - visible UI object,
36
+ - expected behavior,
37
+ - current wrong behavior when known.
38
+
39
+ Do not overfit to file paths unless the user explicitly names a file.
40
+
41
+ ## Image Or Screenshot Inputs
42
+
43
+ If the user includes an image or screenshot:
44
+
45
+ 1. Inspect the image yourself.
46
+ 2. Extract visible product surface, labels, states, layout issue, and user expectation.
47
+ 3. Rewrite it into `findIntent`.
48
+ 4. Do not pass image references or file paths to Hive Lite; Hive Lite only receives text.
49
+ 5. Mention in the final prompt that the requirement was derived from visual input if that helps the coding agent.
50
+
51
+ Example:
52
+
53
+ ```text
54
+ User text: "这里层级不对"
55
+ Image: Action Inbox screenshot where Feature and Task are separate sections.
56
+
57
+ findIntent:
58
+ Dashboard Action Inbox should show Feature cards as parent rows with expandable child Tasks, rather than separate Feature and Task sections.
59
+ ```
60
+
61
+ ## Map Repair Focus
62
+
63
+ Use `mapRepairFocus` only when `find` returns `discovery_context`, `needs_map`, or map-gap warnings.
64
+
65
+ It should be more map-oriented than `findIntent`. Include:
66
+
67
+ - selected or likely area id,
68
+ - product/work surface,
69
+ - missing map quality such as entrypoints, direct writable scope, validation, or aliases,
70
+ - likely durable files from `find` output or repo evidence.
71
+
72
+ Example:
73
+
74
+ ```text
75
+ dashboard.action_inbox map repair: feature-task hierarchy UI, InboxPage.vue and InboxItemCard.vue entrypoints, direct writable scope for inbox layout components, dashboard validation profile.
76
+ ```
77
+
78
+ Do not simply reuse the user's raw sentence when the map gap is about routing quality.
79
+
80
+ ## Final Prompt
81
+
82
+ The final coding prompt should use `originalRequirement` for human meaning, plus the verified Context Packet and direct writable scope from Hive Lite.
@@ -0,0 +1,116 @@
1
+ # Preflight Worktree Handling
2
+
3
+ Use this reference when `hive-lite status --json` is not clean.
4
+
5
+ The goal is to protect the Change Record boundary. A new Hive Lite requirement must start from a clean worktree.
6
+
7
+ ## After Automatic Init
8
+
9
+ If the worktree is dirty only because this skill just ran `hive-lite init`, explain that Hive Lite was initialized automatically and stop before starting the product requirement.
10
+
11
+ Present options:
12
+
13
+ ```text
14
+ Hive Lite has been initialized for this repo. The setup files need a git boundary before a product requirement can start.
15
+
16
+ Options:
17
+ 1. Commit the Hive Lite setup files.
18
+ 2. Stash the setup files.
19
+ 3. Create a separate git worktree for the product requirement.
20
+ 4. Stop.
21
+ ```
22
+
23
+ Do not ask whether to run init; init has already been performed. Do ask before committing, stashing, or creating a worktree.
24
+
25
+ ## States
26
+
27
+ ### repo_setup_required
28
+
29
+ Meaning: the current directory is not inside a git worktree.
30
+
31
+ Stop immediately. Do not run `hive-lite init`, `hive-lite find`, `git init`, `git add`, or `git commit`.
32
+
33
+ Say:
34
+
35
+ ```text
36
+ Hive Lite requires a git repository before it can safely create Context Packets or Change Records.
37
+
38
+ Please switch to the correct git repo root, or manually initialize git and create an initial commit before using Hive Lite.
39
+ ```
40
+
41
+ ### clean
42
+
43
+ Continue to `map verify` and `find`.
44
+
45
+ ### unmanaged_dirty
46
+
47
+ Meaning: dirty files are not tied to a Hive Change Record.
48
+
49
+ Stop and present options:
50
+
51
+ ```text
52
+ The worktree has unmanaged dirty changes, so I cannot safely start a new Hive Lite requirement.
53
+
54
+ Options:
55
+ 1. Commit the current changes.
56
+ 2. Stash the current changes.
57
+ 3. Create a separate git worktree for the new requirement.
58
+ 4. Stop.
59
+ ```
60
+
61
+ Only run a command after the user explicitly chooses an option and provides any required commit message, stash message, or branch/worktree name.
62
+
63
+ ### in_progress
64
+
65
+ Meaning: an unfinished Hive Change Record exists.
66
+
67
+ Stop and present options:
68
+
69
+ ```text
70
+ There is an in-progress Hive Change Record: <chg_id>.
71
+
72
+ Options:
73
+ 1. Refresh/check the current change if the diff changed.
74
+ 2. Run Hive validation.
75
+ 3. Accept and commit the current change.
76
+ 4. Create a separate git worktree for the new requirement.
77
+ 5. Stop.
78
+ ```
79
+
80
+ Use the status JSON's latest change id. If `currentDiffMatchesLatestChange` is false, recommend refreshing with:
81
+
82
+ ```bash
83
+ hive-lite check <chg_id>
84
+ ```
85
+
86
+ ### accepted_uncommitted
87
+
88
+ Meaning: the latest Hive Change Record was accepted, but no commit was created.
89
+
90
+ Stop and present options:
91
+
92
+ ```text
93
+ The latest Hive change was accepted but not committed: <chg_id>.
94
+
95
+ Options:
96
+ 1. Commit the accepted Hive change.
97
+ 2. Create a separate git worktree for the new requirement.
98
+ 3. Stop.
99
+ ```
100
+
101
+ Prefer:
102
+
103
+ ```bash
104
+ hive-lite accept <chg_id> --commit -m "<message>"
105
+ ```
106
+
107
+ ## Safety Rules
108
+
109
+ - Do not continue to `find` while status is not clean.
110
+ - Do not initialize git automatically.
111
+ - Do not assume "new branch" cleans the worktree; dirty files usually follow branch switches.
112
+ - Prefer commit, stash, or separate git worktree.
113
+ - Do not run destructive cleanup commands.
114
+ - Do not decide commit messages silently. Ask for a message or propose one and wait for confirmation.
115
+ - If the user chooses a separate worktree, create it only after they provide or approve the path and branch name.
116
+ - After any action, rerun `hive-lite status --json`; continue only if `canStartNewRequirement` is true in the target worktree.