hive-lite 0.1.1 → 0.1.3

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 CHANGED
@@ -78,8 +78,9 @@ When you pass `next --agent <codex|claude|gemini>` or `next --path <skills-dir>`
78
78
 
79
79
  ### Install Agent Skills
80
80
 
81
- Hive Lite ships three operator skills:
81
+ Hive Lite ships four operator skills:
82
82
 
83
+ - `hive-lite-bootstrap`
83
84
  - `hive-lite-start-prompt`
84
85
  - `hive-lite-finish`
85
86
  - `hive-lite-map-maintainer`
@@ -235,6 +236,8 @@ node bin/hive.js map-dump
235
236
 
236
237
  Hive Lite requires a git repository. If the current directory is not inside a git worktree, `status` and `next` will report `repo_setup_required`, and workflow commands such as `init`, `find`, `check`, `validate`, and `accept` stop. Hive Lite does not initialize git automatically; switch to the correct repo root or manually initialize git and create an initial commit first.
237
238
 
239
+ Inside a git repo, `status` reports `hive_init_required` until the repo has been initialized with `hive-lite init`. `next` recommends `$hive-lite-bootstrap`, which is the first-time setup skill that may run init, build the first Project Map, and prepare the setup/map commit before product work starts.
240
+
238
241
  Committed by default:
239
242
 
240
243
  ```text
@@ -264,6 +267,8 @@ node bin/hive.js next --json
264
267
 
265
268
  Typical `phaseGuess` values:
266
269
 
270
+ - `repo_setup_required`: current directory is not inside a git repo
271
+ - `hive_init_required`: use `$hive-lite-bootstrap` for first-time setup before product work
267
272
  - `preflight`: dirty worktree must be committed, stashed, isolated, or stopped before a new requirement
268
273
  - `finish`: an in-progress or accepted-uncommitted Hive change should be closed with `$hive-lite-finish`
269
274
  - `map`: Project Map needs bootstrap, refresh, or repair via `$hive-lite-map-maintainer`
@@ -287,6 +292,8 @@ node bin/hive.js status --json
287
292
 
288
293
  It classifies the current repo as:
289
294
 
295
+ - `repo_setup_required`: not inside a git worktree
296
+ - `hive_init_required`: git repo exists, but required Hive Lite setup files are missing
290
297
  - `clean`: safe to start a new `find`
291
298
  - `unmanaged_dirty`: dirty files are not tied to a Hive Change Record
292
299
  - `in_progress`: dirty files belong to an unfinished Hive Change Record
@@ -35,6 +35,7 @@ Human output explains the result. JSON output is a stable contract with fields s
35
35
  It reads:
36
36
 
37
37
  - git repo presence
38
+ - Hive Lite initialization state
38
39
  - worktree state
39
40
  - latest Hive Change Record
40
41
  - Project Map health
@@ -51,6 +52,7 @@ Hive Lite cannot detect the currently running agent CLI. If the caller provides
51
52
  | Value | Meaning | What To Do |
52
53
  | --- | --- | --- |
53
54
  | `repo_setup_required` | Current directory is not inside a git repo. | Stop. Switch to the correct repo root, or manually initialize git and create an initial commit before using Hive Lite. |
55
+ | `hive_init_required` | Current git repo does not have required Hive Lite setup files. | Use `$hive-lite-bootstrap` for first-time setup before product work. |
54
56
  | `skill_preflight` | The selected agent target is missing the operator skill needed for the next Hive Lite step. | Run the recommended `skills install` or `skills sync`, then rerun `next`. |
55
57
  | `preflight` | Worktree has unmanaged dirty changes. | Stop before starting new work. Commit, stash, use a separate worktree, or stop. |
56
58
  | `finish` | A Hive change is in progress, or was accepted without commit. | Use `$hive-lite-finish` to check, validate, record evidence, accept, or commit. |
@@ -101,6 +103,7 @@ node bin/hive.js status --json
101
103
  | Value | Meaning | What To Do |
102
104
  | --- | --- | --- |
103
105
  | `repo_setup_required` | Not inside a git worktree. | Stop. Do not auto-run `git init`. |
106
+ | `hive_init_required` | Inside a git worktree, but required Hive Lite setup files are missing. | Stop ordinary start/finish/map-maintainer skills. Use `$hive-lite-bootstrap` for first-time setup, or run `hive-lite init` manually as the low-level fallback. |
104
107
  | `clean` | Worktree is clean. | It is safe to start `find`. |
105
108
  | `unmanaged_dirty` | Dirty files are not tied to a Hive Change Record. | Stop and ask the human to commit, stash, use a worktree, or stop. |
106
109
  | `in_progress` | Dirty files belong to an unfinished Hive Change Record. | Continue finish flow: `check`, `validate`, manual evidence, or `accept`. |
@@ -155,6 +158,7 @@ Hive Lite does not detect which agent CLI is installed or currently running. `sk
155
158
 
156
159
  Bundled skills:
157
160
 
161
+ - `hive-lite-bootstrap`
158
162
  - `hive-lite-start-prompt`
159
163
  - `hive-lite-finish`
160
164
  - `hive-lite-map-maintainer`
@@ -0,0 +1,153 @@
1
+ ---
2
+ name: hive-lite-bootstrap
3
+ description: Use this skill when a git repository is adopting Hive Lite for the first time. It checks first-time setup state, may run `hive-lite init`, builds the first Project Map without changing product code, verifies readiness, and prepares a user-approved commit for Hive Lite setup and map files before any product requirement starts.
4
+ ---
5
+
6
+ # Hive Lite Bootstrap
7
+
8
+ ## Purpose
9
+
10
+ Onboard a git repository to Hive Lite for the first time:
11
+
12
+ ```text
13
+ check repo -> run hive-lite init when needed -> build first Project Map -> verify -> commit setup/map after approval
14
+ ```
15
+
16
+ This skill is the only Hive Lite operator skill that may run `hive-lite init`. Use it for first-time project setup, not for ordinary coding work.
17
+
18
+ ## Boundaries
19
+
20
+ - Do not edit application source, tests, product docs, package files, secrets, CI, or generated artifacts.
21
+ - You may run `hive-lite init` only when the target is already a git repo and the worktree was clean before init.
22
+ - You may directly edit only:
23
+ - `.hive/map/project.yaml`
24
+ - `.hive/map/areas.yaml`
25
+ - `.hive/map/rules.yaml`
26
+ - `.hive/map/validation.yaml`
27
+ - Preserve setup artifacts created by `hive-lite init`, including `.hive/config.yaml` and Hive Lite `.gitignore` runtime/evidence rules. Do not manually curate or remove them.
28
+ - Do not start a product requirement, run `hive-lite find`, create a Change Record, accept risk, push, merge, deploy, or run app tests.
29
+ - Commit only after explicit human approval, or when the user's request already explicitly asked you to commit the Hive Lite bootstrap.
30
+ - If committing, include only Hive Lite setup/map files and the Hive Lite `.gitignore` change. Never include product-code changes.
31
+
32
+ ## Find The CLI
33
+
34
+ Run Hive Lite from the target repo root. Prefer:
35
+
36
+ ```bash
37
+ hive-lite <args>
38
+ ```
39
+
40
+ If unavailable, use an explicit path already given by the user or conversation context, such as `node /path/to/hive-lite/bin/hive.js <args>`. Ask for the CLI path if it is not obvious.
41
+
42
+ ## Workflow
43
+
44
+ ### 1. Preflight
45
+
46
+ Run:
47
+
48
+ ```bash
49
+ hive-lite status --json
50
+ git status --short
51
+ ```
52
+
53
+ Stop if the directory is not a git repo. Tell the user to switch to the repo root, or initialize git and create an initial commit before using Hive Lite.
54
+
55
+ Stop if `git status --short` shows pre-existing non-Hive changes. Ask the user to commit, stash, or use another worktree first. Do not run `hive-lite init` into a dirty product worktree.
56
+
57
+ If Hive Lite is already initialized, do not rerun init. Continue only if the user asked to build or repair the first Project Map; otherwise explain that setup already exists and recommend `$hive-lite-map-maintainer` or `$hive-lite-start-prompt`.
58
+
59
+ ### 2. Initialize
60
+
61
+ If status reports `hive.state = hive_init_required` or `hive.initialized = false`, run:
62
+
63
+ ```bash
64
+ hive-lite init
65
+ ```
66
+
67
+ Then continue in the same turn. Do not ask the user to commit yet; first build the initial Project Map.
68
+
69
+ ### 3. Build First Map
70
+
71
+ Run:
72
+
73
+ ```bash
74
+ hive-lite map verify --json
75
+ hive-lite map prompt --focus "highest value product and workflow areas" --max-areas 8
76
+ ```
77
+
78
+ Inspect the repo with deterministic commands such as:
79
+
80
+ ```bash
81
+ rg --files
82
+ rg "<routing term>"
83
+ ```
84
+
85
+ Edit only `.hive/map/*.yaml`. Build 3-8 high-value, narrow areas that make near-term product requests routable. Do not try to map the whole project.
86
+
87
+ ### 4. Verify
88
+
89
+ Run:
90
+
91
+ ```bash
92
+ hive-lite map verify --json
93
+ hive-lite map health --json
94
+ ```
95
+
96
+ If areas were created, spot-check important areas with:
97
+
98
+ ```bash
99
+ hive-lite map health --area <area_id> --json
100
+ ```
101
+
102
+ Success means:
103
+
104
+ - map verify is ok
105
+ - the first useful areas have no critical health findings
106
+ - the map is not empty
107
+ - no product files were changed
108
+
109
+ ### 5. Commit Boundary
110
+
111
+ Before any product requirement starts, the Hive Lite setup and initial Project Map should have a git commit boundary.
112
+
113
+ If the user already explicitly asked to commit, and `git status --short` contains only Hive Lite setup/map files plus the Hive Lite `.gitignore` update, run:
114
+
115
+ ```bash
116
+ git add .hive/config.yaml .hive/map/project.yaml .hive/map/areas.yaml .hive/map/rules.yaml .hive/map/validation.yaml .gitignore
117
+ git commit -m "Initialize Hive Lite Project Map"
118
+ ```
119
+
120
+ If the user did not explicitly approve committing, stop and ask for approval. Provide the exact command above and say that the user can reply with:
121
+
122
+ ```text
123
+ 可以提交。commit message 用:Initialize Hive Lite Project Map
124
+ ```
125
+
126
+ Do not start `$hive-lite-start-prompt` until the setup/map files are committed or otherwise isolated.
127
+
128
+ ## Return Summary
129
+
130
+ Return:
131
+
132
+ ```text
133
+ Hive Lite bootstrap complete.
134
+
135
+ Setup:
136
+ - hive-lite init: <run / already initialized>
137
+
138
+ Project Map:
139
+ - changed files: <files>
140
+ - areas created or updated: <area ids>
141
+
142
+ Verification:
143
+ - hive-lite map verify --json: <ok/fail>
144
+ - hive-lite map health --json: <status and finding counts>
145
+
146
+ Commit:
147
+ - <committed / waiting for approval>
148
+ - command or commit sha if applicable
149
+
150
+ Next:
151
+ - After the setup/map commit exists, start the first requirement with `$hive-lite-start-prompt`.
152
+ ```
153
+
@@ -0,0 +1,7 @@
1
+ interface:
2
+ display_name: "Hive Lite Bootstrap"
3
+ short_description: "Initialize Hive Lite for a repo"
4
+ default_prompt: "Use $hive-lite-bootstrap when this repository is adopting Hive Lite for the first time. Initialize Hive Lite, build the first Project Map, and prepare the setup/map commit before product work starts."
5
+
6
+ policy:
7
+ allow_implicit_invocation: true
@@ -61,6 +61,8 @@ In command examples below, replace `hive-lite` with the resolved command.
61
61
 
62
62
  Run `hive-lite status --json` first. If it reports `hive.state = repo_setup_required`, stop immediately. Do not run check/validate/accept 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.
63
63
 
64
+ If it reports `hive.state = hive_init_required`, or `hive.initialized = false`, stop immediately. Do not run `hive-lite init` yourself, and do not run check/validate/accept. Recommend `$hive-lite-bootstrap` for first-time setup. If the user expected an existing Hive Lite change, they may be in the wrong directory.
65
+
64
66
  Find one of:
65
67
 
66
68
  - context id from the coding agent output, such as `ctx_xxx`,
@@ -273,6 +275,20 @@ Accepted and committed.
273
275
  - Split next phase: <handoff prompt or none>
274
276
  ```
275
277
 
278
+ If `Map Delta Candidate` is not `none`, do not apply it from this skill. Explain that the accepted change suggests a possible Project Map improvement and output this handoff:
279
+
280
+ ```text
281
+ $hive-lite-map-maintainer
282
+ 请 review 这个 Map Delta Candidate:
283
+ <delta_id>
284
+
285
+ 只判断是否 apply 或 reject 这个 map delta。
286
+ 不要改应用代码。
287
+ 不要开始新需求。
288
+ ```
289
+
290
+ Tell the user that map delta review can happen before or after the next requirement, but reviewing it before similar future requests may improve routing.
291
+
276
292
  If no commit was created because the user explicitly asked not to commit, warn that a new Hive Lite requirement should not start until the worktree is clean.
277
293
 
278
294
  ## Response Style
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: hive-lite-map-maintainer
3
- description: Use this skill when maintaining a Hive Lite Project Map instead of implementing product code. It handles first-time map bootstrap, existing-map refresh after drift, intent-triggered map repair from find/context gaps, map health cleanup, and map delta review/apply workflows while editing only `.hive/map/*.yaml`.
3
+ description: Use this skill when maintaining a Hive Lite Project Map instead of implementing product code. It handles first map creation after explicit Hive Lite init, existing-map refresh after drift, intent-triggered map repair from find/context gaps, map health cleanup, and map delta review/apply workflows while directly editing only `.hive/map/*.yaml`.
4
4
  ---
5
5
 
6
6
  # Hive Lite Map Maintainer
@@ -32,18 +32,15 @@ hive-lite skills install --agent <codex|claude|gemini>
32
32
 
33
33
  ## Authority Boundary
34
34
 
35
- This skill has lifecycle-scoped authority.
35
+ Setup precondition:
36
36
 
37
- Bootstrap / repair exception:
37
+ - This skill must not run `hive-lite init`.
38
+ - If Hive Lite is not initialized or is partially initialized, stop immediately and recommend `$hive-lite-bootstrap` for first-time setup.
39
+ - Do not create `.hive/map` manually, do not edit `.hive/config.yaml`, and do not edit `.gitignore`.
38
40
 
39
- - If Hive Lite is not initialized, partially initialized, or explicitly being initialized, this skill may run the approved bootstrap command, normally `hive-lite init`.
40
- - Preserve setup side effects produced by the bootstrap command, including `.hive/config.yaml`, `.hive/map/*.yaml`, Hive Lite runtime/evidence directories, and `.gitignore` entries for those runtime/evidence directories.
41
- - These bootstrap side effects are authorized setup artifacts. Do not delete, revert, or "clean up" them merely because they are outside `.hive/map/`.
42
- - Do not hand-edit setup files as ordinary map maintenance. If setup files are missing or inconsistent after bootstrap, report a setup/repair condition or rerun an approved bootstrap/repair command when the task allows it.
41
+ Map-maintenance authority:
43
42
 
44
- Normal map-maintenance mode:
45
-
46
- - After Hive Lite is initialized, directly edit only:
43
+ - Directly edit only:
47
44
  - `.hive/map/project.yaml`
48
45
  - `.hive/map/areas.yaml`
49
46
  - `.hive/map/rules.yaml`
@@ -53,7 +50,7 @@ Normal map-maintenance mode:
53
50
  - Do not run `hive check`, `hive validate`, `hive accept`, app formatters, app tests, commits, pushes, merges, deploys, or destructive git commands.
54
51
  - Do not call an LLM API from Hive Lite. Use Hive Lite CLI facts plus repo inspection.
55
52
  - Do not turn the map into a wiki. Only add information that improves `find` or `check`.
56
- - Durable setup and map changes require human awareness. Summarize setup effects separately from map edits and tell the user to run/approve commit separately.
53
+ - Durable map changes require human awareness. Summarize map edits and tell the user to run/approve commit separately.
57
54
  - Apply Map Delta Candidates only when the user explicitly asked for or confirmed that action. Otherwise list/summarize them and stop.
58
55
 
59
56
  ## Find The CLI
@@ -80,6 +77,34 @@ hive-lite status --json
80
77
 
81
78
  If it reports `hive.state = repo_setup_required`, stop immediately. Do not run `hive-lite init`, do not create `.hive/map`, 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.
82
79
 
80
+ If it reports `hive.state = hive_init_required`, or `hive.initialized = false`, stop immediately. Do not run `hive-lite init` yourself. Tell the user:
81
+
82
+ ```text
83
+ Hive Lite is not initialized in this repo yet.
84
+
85
+ Recommended next step:
86
+ $hive-lite-bootstrap
87
+ 这是已有项目第一次接入 Hive Lite。请完成初始化,建立第一版 Project Map,不要改应用代码。
88
+
89
+ If the bootstrap skill is not available, run `hive-lite init` from the repo root, then rerun:
90
+ $hive-lite-map-maintainer
91
+ 这是已有项目第一次接入 Hive Lite。请建立第一版 Project Map,不要改应用代码。
92
+
93
+ Do not commit immediately after init. Build the first Project Map first, then commit Hive Lite setup and map files together before starting the first product requirement.
94
+ ```
95
+
96
+ For older Hive Lite versions that do not report `hive.initialized`, check for required setup files before continuing:
97
+
98
+ ```text
99
+ .hive/config.yaml
100
+ .hive/map/project.yaml
101
+ .hive/map/areas.yaml
102
+ .hive/map/rules.yaml
103
+ .hive/map/validation.yaml
104
+ ```
105
+
106
+ If any are missing, stop with the same message. Do not run init automatically.
107
+
83
108
  ### 1. Establish Mode
84
109
 
85
110
  Read [lifecycle.md](references/lifecycle.md), then classify the task as one of:
@@ -103,16 +128,7 @@ Before any mode-specific work, check whether the target repo has the required Hi
103
128
  .hive/map/validation.yaml
104
129
  ```
105
130
 
106
- If any required map file is missing, run:
107
-
108
- ```bash
109
- hive-lite init
110
- ```
111
-
112
- This is setup work. Do it automatically; do not ask the user whether to initialize Hive Lite. Then continue with bootstrap or recovery.
113
- Preserve all setup artifacts created by `hive-lite init`; do not remove `.hive/config.yaml` or Hive Lite `.gitignore` entries as part of cleanup.
114
-
115
- If the target directory is not a git repo or Hive Lite init fails, stop and report the blocker instead of inventing map files manually.
131
+ If any required map file is missing, stop immediately and recommend `$hive-lite-bootstrap`. Do not create missing map files manually.
116
132
 
117
133
  ### 3. Verify Current Map
118
134
 
@@ -195,8 +211,8 @@ Mode:
195
211
  - <bootstrap|refresh|intent_repair|continuous_delta|recovery>
196
212
 
197
213
  Hive Lite setup:
198
- - <initialized with hive-lite init / no setup changes / setup repair needed>
199
- - Setup artifacts preserved: <.hive/config.yaml, .gitignore runtime rules, runtime directories, or none>
214
+ - initialized: yes
215
+ - setup changes made by this skill: none
200
216
 
201
217
  Changed map files:
202
218
  - <file or none>
@@ -6,6 +6,11 @@ Choose one mode before editing the map.
6
6
 
7
7
  Use when an existing project is adopting Hive Lite for the first time.
8
8
 
9
+ Precondition:
10
+
11
+ - Hive Lite setup already exists, normally because `$hive-lite-bootstrap` ran first.
12
+ - If Hive Lite setup files are missing, stop and recommend `$hive-lite-bootstrap`; do not run `hive-lite init` from this skill.
13
+
9
14
  Goal:
10
15
 
11
16
  - Create the first 3-8 high-value product/work areas.
@@ -15,11 +20,10 @@ Goal:
15
20
  Suggested flow:
16
21
 
17
22
  ```bash
18
- hive-lite init
19
23
  hive-lite map prompt --focus "highest value product and workflow areas" --max-areas 8
20
24
  ```
21
25
 
22
- Preserve setup artifacts created by `hive-lite init`, including `.hive/config.yaml`, Hive Lite runtime/evidence directories, and `.gitignore` runtime/evidence rules. Then inspect repo files and edit `.hive/map/*.yaml` directly.
26
+ Inspect repo files and edit `.hive/map/*.yaml` directly.
23
27
 
24
28
  Success:
25
29
 
@@ -97,7 +101,7 @@ Only apply a delta when the user explicitly asks or confirms. Reject stale or lo
97
101
 
98
102
  ## recovery
99
103
 
100
- Use when map files are missing, invalid YAML, or structurally broken.
104
+ Use when initialized map files are invalid YAML or structurally broken. If required Hive Lite setup or map files are missing, stop and recommend `$hive-lite-bootstrap`.
101
105
 
102
106
  Goal:
103
107
 
@@ -107,8 +111,7 @@ Goal:
107
111
  Suggested flow:
108
112
 
109
113
  ```bash
110
- hive-lite init
111
- hive-lite map verify
114
+ hive-lite map verify --json
112
115
  ```
113
116
 
114
117
  If invalid YAML cannot be repaired safely, stop and report the exact error.
@@ -35,7 +35,7 @@ hive-lite skills install --agent <codex|claude|gemini>
35
35
 
36
36
  - Do not directly edit application source, tests, docs, `.gitignore`, generated artifacts, `.hive/context`, `.hive/changes`, or `.hive/deltas`.
37
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
- - Bootstrap exception: when Hive Lite map files are missing, this skill may run `hive-lite init` and must preserve setup artifacts created by that command, including `.hive/config.yaml`, runtime/evidence directories, and Hive Lite `.gitignore` entries. Do not delete or revert those artifacts merely because they are outside `.hive/map/`.
38
+ - Do not run `hive-lite init`. If Hive Lite is not initialized or is partially initialized, stop and recommend `$hive-lite-bootstrap` before using this skill.
39
39
  - 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.
40
40
  - During preflight, you may help finish or isolate pre-existing work only after explicit user confirmation.
41
41
  - Never discard changes with destructive commands such as `git reset --hard`, `git checkout --`, or forced branch switches.
@@ -67,21 +67,37 @@ Read [input-calibration.md](references/input-calibration.md). Produce:
67
67
 
68
68
  ### 2. Preflight The Worktree
69
69
 
70
- If `.hive/map/project.yaml`, `.hive/map/areas.yaml`, `.hive/map/rules.yaml`, or `.hive/map/validation.yaml` is missing, run:
70
+ Run:
71
71
 
72
72
  ```bash
73
- hive-lite init
73
+ hive-lite status --json
74
74
  ```
75
75
 
76
- Do this automatically; do not ask the user whether to initialize Hive Lite. Initialization is setup work, not the requested product change. Preserve all setup artifacts created by `hive-lite init`; do not remove `.hive/config.yaml` or Hive Lite `.gitignore` entries as cleanup.
76
+ 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.
77
77
 
78
- Run:
78
+ If status reports `hive.state = hive_init_required`, or `hive.initialized = false`, stop immediately. Do not run `hive-lite init` yourself. Tell the user:
79
79
 
80
- ```bash
81
- hive-lite status --json
80
+ ```text
81
+ Hive Lite is not initialized in this repo yet.
82
+
83
+ Recommended next step:
84
+ $hive-lite-bootstrap
85
+ 这是已有项目第一次接入 Hive Lite。请完成初始化,建立第一版 Project Map,不要改应用代码。
86
+
87
+ Do not start the product requirement yet. After bootstrap builds the first map, commit the Hive Lite setup and map files together, then rerun this start skill with the original requirement.
82
88
  ```
83
89
 
84
- 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.
90
+ For older Hive Lite versions that do not report `hive.initialized`, check whether these files exist before continuing:
91
+
92
+ ```text
93
+ .hive/config.yaml
94
+ .hive/map/project.yaml
95
+ .hive/map/areas.yaml
96
+ .hive/map/rules.yaml
97
+ .hive/map/validation.yaml
98
+ ```
99
+
100
+ If any are missing, stop with the same message. Do not run init automatically and do not create missing map files manually.
85
101
 
86
102
  If the command is unavailable in an older Hive Lite, fall back to `git status --porcelain`.
87
103
 
@@ -4,23 +4,23 @@ Use this reference when `hive-lite status --json` is not clean.
4
4
 
5
5
  The goal is to protect the Change Record boundary. A new Hive Lite requirement must start from a clean worktree.
6
6
 
7
- ## After Automatic Init
7
+ ## Hive Lite Not Initialized
8
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.
9
+ If `hive-lite status --json` reports `hive.state = hive_init_required` or `hive.initialized = false`, stop immediately. Do not run `hive-lite init` from this skill.
10
10
 
11
- Present options:
11
+ Say:
12
12
 
13
13
  ```text
14
- Hive Lite has been initialized for this repo. The setup files need a git boundary before a product requirement can start.
14
+ Hive Lite is not initialized in this repo yet.
15
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.
16
+ Recommended next step:
17
+ $hive-lite-bootstrap
18
+ 这是已有项目第一次接入 Hive Lite。请完成初始化,建立第一版 Project Map,不要改应用代码。
19
+
20
+ After bootstrap builds the first map, commit the Hive Lite setup and map files together before starting the product requirement.
21
21
  ```
22
22
 
23
- Do not ask whether to run init; init has already been performed. Do ask before committing, stashing, or creating a worktree.
23
+ Do not continue to find/map repair/start prompt until Hive Lite setup exists.
24
24
 
25
25
  ## States
26
26
 
@@ -107,6 +107,7 @@ hive-lite accept <chg_id> --commit -m "<message>"
107
107
  ## Safety Rules
108
108
 
109
109
  - Do not continue to `find` while status is not clean.
110
+ - Do not run `hive-lite init` from this start skill; first-time setup belongs to `$hive-lite-bootstrap`.
110
111
  - Do not initialize git automatically.
111
112
  - Do not assume "new branch" cleans the worktree; dirty files usually follow branch switches.
112
113
  - Prefer commit, stash, or separate git worktree.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hive-lite",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Local Project Map + Change Control for coding agents.",
5
5
  "keywords": [
6
6
  "codex",
@@ -37,4 +37,4 @@
37
37
  "engines": {
38
38
  "node": ">=16"
39
39
  }
40
- }
40
+ }
package/src/cli.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const path = require('path');
2
+ const { version: packageVersion } = require('../package.json');
2
3
  const { requireGitRepo } = require('./lib/git');
3
4
  const { evaluateMapHealth } = require('./lib/health');
4
5
  const { createMapPrompt, initProject, loadProjectMap, suggestMap, verifyProjectMap } = require('./lib/map');
@@ -51,11 +52,20 @@ function isHelpFlag(arg) {
51
52
  return arg === '--help' || arg === '-h';
52
53
  }
53
54
 
55
+ function isVersionArg(arg) {
56
+ return arg === 'version' || arg === '--version' || arg === '-v';
57
+ }
58
+
59
+ function printVersion() {
60
+ console.log(packageVersion);
61
+ }
62
+
54
63
  function printHelp() {
55
64
  console.log(`
56
65
  Hive Lite - local Project Map + Change Control
57
66
 
58
67
  Usage:
68
+ hive-lite version
59
69
  hive-lite init
60
70
  hive-lite doctor
61
71
  hive-lite status [--json] [--all]
@@ -87,6 +97,16 @@ function currentCliCommandArgv() {
87
97
  return [process.execPath, path.resolve(process.argv[1])];
88
98
  }
89
99
 
100
+ function requireHiveInitialized(cwd, commandName) {
101
+ const status = evaluateWorkspaceStatus(cwd);
102
+ if (status.hive.initialized === false) {
103
+ const missing = status.hive.missingSetupFiles && status.hive.missingSetupFiles.length > 0
104
+ ? ` Missing: ${status.hive.missingSetupFiles.join(', ')}.`
105
+ : '';
106
+ throw new Error(`${commandName} requires Hive Lite initialization. Use $hive-lite-bootstrap first, or run hive-lite init from the repo root as the low-level fallback.${missing}`);
107
+ }
108
+ }
109
+
90
110
  function printInit(result) {
91
111
  console.log('Hive Lite initialized.');
92
112
  console.log(`Repo: ${result.root}`);
@@ -531,6 +551,11 @@ function printWorkspaceStatus(result) {
531
551
  console.log(`Hive State: ${result.hive.state}`);
532
552
  console.log(`Can Start New Requirement: ${result.canStartNewRequirement ? 'yes' : 'no'}`);
533
553
  console.log(`Reason: ${result.hive.reason}`);
554
+ if (result.hive.initialized === false && result.hive.missingSetupFiles && result.hive.missingSetupFiles.length > 0) {
555
+ console.log('');
556
+ console.log('Missing Hive Lite Setup Files:');
557
+ for (const file of result.hive.missingSetupFiles) console.log(` - ${file}`);
558
+ }
534
559
  if (result.hive.latestChange) {
535
560
  console.log('');
536
561
  console.log('Latest Change:');
@@ -732,6 +757,11 @@ async function main(argv) {
732
757
  return;
733
758
  }
734
759
 
760
+ if (isVersionArg(command)) {
761
+ printVersion();
762
+ return;
763
+ }
764
+
735
765
  if (subcommand === 'help' || isHelpFlag(subcommand) || isHelpFlag(subsubcommand) || rest.some(isHelpFlag)) {
736
766
  printHelp();
737
767
  return;
@@ -795,6 +825,7 @@ async function main(argv) {
795
825
  const intent = parsed.positional.join(' ').trim();
796
826
  if (!intent) throw new Error('find requires an intent string');
797
827
  const root = requireGitRepo(process.cwd(), 'hive-lite find');
828
+ requireHiveInitialized(root, 'hive-lite find');
798
829
  const result = createContextPacket(root, intent, {
799
830
  ...parsed.flags,
800
831
  cliCommandArgv: currentCliCommandArgv(),
@@ -808,7 +839,8 @@ async function main(argv) {
808
839
  }
809
840
 
810
841
  if (command === 'check') {
811
- requireGitRepo(process.cwd(), 'hive-lite check');
842
+ const root = requireGitRepo(process.cwd(), 'hive-lite check');
843
+ requireHiveInitialized(root, 'hive-lite check');
812
844
  const parsed = parseArgs([subcommand, subsubcommand, ...rest].filter((item) => item !== undefined));
813
845
  const changeId = parsed.positional[0] || null;
814
846
  const result = createOrUpdateChange(process.cwd(), {
@@ -821,7 +853,8 @@ async function main(argv) {
821
853
  }
822
854
 
823
855
  if (command === 'validate') {
824
- requireGitRepo(process.cwd(), 'hive-lite validate');
856
+ const root = requireGitRepo(process.cwd(), 'hive-lite validate');
857
+ requireHiveInitialized(root, 'hive-lite validate');
825
858
  const parsed = parseArgs([subcommand, subsubcommand, ...rest].filter((item) => item !== undefined));
826
859
  if (!parsed.flags.json && !parsed.flags.manual) {
827
860
  parsed.flags.onStart = (item) => {
@@ -837,7 +870,8 @@ async function main(argv) {
837
870
  }
838
871
 
839
872
  if (command === 'accept') {
840
- requireGitRepo(process.cwd(), 'hive-lite accept');
873
+ const root = requireGitRepo(process.cwd(), 'hive-lite accept');
874
+ requireHiveInitialized(root, 'hive-lite accept');
841
875
  const parsed = parseArgs([subcommand, subsubcommand, ...rest].filter((item) => item !== undefined));
842
876
  const result = acceptChange(process.cwd(), parsed.positional[0] || null, parsed.flags);
843
877
  if (parsed.flags.json) console.log(JSON.stringify(result, null, 2));
@@ -868,6 +902,7 @@ async function main(argv) {
868
902
  return;
869
903
  }
870
904
  if (subcommand === 'prompt') {
905
+ requireHiveInitialized(root, 'hive-lite map prompt');
871
906
  const parsed = parseArgs([subsubcommand, ...rest].filter((item) => item !== undefined));
872
907
  const result = createMapPrompt(root, parsed.flags);
873
908
  if (parsed.flags.json) console.log(JSON.stringify(result, null, 2));
@@ -876,10 +911,12 @@ async function main(argv) {
876
911
  }
877
912
  if (subcommand === 'delta') {
878
913
  if (subsubcommand === 'list') {
914
+ requireHiveInitialized(root, 'hive-lite map delta list');
879
915
  printDeltas(allDeltas(root));
880
916
  return;
881
917
  }
882
918
  if (subsubcommand === 'apply') {
919
+ requireHiveInitialized(root, 'hive-lite map delta apply');
883
920
  const parsed = parseArgs(rest);
884
921
  const id = parsed.positional[0];
885
922
  if (!id) throw new Error('map delta apply requires a delta id');
@@ -890,6 +927,7 @@ async function main(argv) {
890
927
  return;
891
928
  }
892
929
  if (subsubcommand === 'reject') {
930
+ requireHiveInitialized(root, 'hive-lite map delta reject');
893
931
  const parsed = parseArgs(rest);
894
932
  const id = parsed.positional[0];
895
933
  if (!id) throw new Error('map delta reject requires a delta id');
package/src/lib/next.js CHANGED
@@ -94,6 +94,13 @@ function startPrompt() {
94
94
  ].join('\n');
95
95
  }
96
96
 
97
+ function bootstrapPrompt() {
98
+ return [
99
+ '$hive-lite-bootstrap',
100
+ '这是已有项目第一次接入 Hive Lite。请完成初始化,建立第一版 Project Map,不要改应用代码。完成后在开始第一个需求前准备 Hive Lite setup/map 提交。',
101
+ ].join('\n');
102
+ }
103
+
97
104
  function finishPrompt(changeId) {
98
105
  return [
99
106
  '$hive-lite-finish',
@@ -105,7 +112,7 @@ function mapMaintainerPrompt(mode) {
105
112
  if (mode === 'bootstrap') {
106
113
  return [
107
114
  '$hive-lite-map-maintainer',
108
- '这个项目第一次使用 Hive Lite,请初始化并建立第一版 3-8 个高价值 areas。保留 hive-lite init 创建的 setup 产物,例如 .hive/config.yaml 和 .gitignore runtime 规则;初始化后只直接编辑 .hive/map/*.yaml。',
115
+ '这是已有项目第一次接入 Hive Lite。请建立第一版 Project Map,不要改应用代码。',
109
116
  ].join('\n');
110
117
  }
111
118
  if (mode === 'delta') {
@@ -137,6 +144,7 @@ function chooseSplit(status) {
137
144
 
138
145
  function requiredSkillForAction(actionItem) {
139
146
  if (!actionItem) return null;
147
+ if (actionItem.kind === 'run_bootstrap_skill') return 'hive-lite-bootstrap';
140
148
  if (actionItem.kind === 'run_start_skill' || actionItem.kind === 'continue_split') return 'hive-lite-start-prompt';
141
149
  if (actionItem.kind === 'run_finish_skill' || actionItem.kind === 'commit_accepted_change') return 'hive-lite-finish';
142
150
  if (actionItem.kind === 'run_map_maintainer') return 'hive-lite-map-maintainer';
@@ -177,11 +185,13 @@ function evaluateNextAction(cwd, options = {}) {
177
185
  const root = repoRoot(cwd);
178
186
  const workspace = evaluateWorkspaceStatus(root);
179
187
  const repoSetupRequired = workspace.hive.state === 'repo_setup_required';
180
- const mapHealth = repoSetupRequired
188
+ const hiveInitRequired = workspace.hive.state === 'hive_init_required';
189
+ const setupRequired = repoSetupRequired || hiveInitRequired;
190
+ const mapHealth = setupRequired
181
191
  ? { status: 'not_checked', critical: 0, warnings: 0, info: 0, areasChecked: 0, topFindings: [] }
182
192
  : mapHealthSummary(root);
183
- const latestChange = repoSetupRequired ? null : latestChangeSummary(root);
184
- const deltas = repoSetupRequired ? [] : pendingDeltas(root);
193
+ const latestChange = setupRequired ? null : latestChangeSummary(root);
194
+ const deltas = setupRequired ? [] : pendingDeltas(root);
185
195
  const warnings = [];
186
196
  const secondaryActions = [];
187
197
 
@@ -222,6 +232,16 @@ function evaluateNextAction(cwd, options = {}) {
222
232
  });
223
233
  summaryForHuman = '当前目录不是 git repo。Hive Lite 不能安全开始;请切到正确的 repo 根目录,或你自己先完成 git 初始化和初始提交。';
224
234
  summaryForAgent = 'No git repository detected. Stop. Do not run find/check/accept or initialize git automatically.';
235
+ } else if (workspace.hive.state === 'hive_init_required') {
236
+ phaseGuess = 'hive_init_required';
237
+ primaryAction = action({
238
+ kind: 'run_bootstrap_skill',
239
+ label: 'Use hive-lite-bootstrap',
240
+ prompt: bootstrapPrompt(),
241
+ explanation: 'This git repository has not been initialized for Hive Lite. Use the bootstrap skill to initialize, build the first Project Map, and prepare the setup/map commit before product work starts.',
242
+ });
243
+ summaryForHuman = '当前项目还没有初始化 Hive Lite。建议使用 hive-lite-bootstrap 完成首次接入:初始化、建立第一版 Project Map,并在开始第一个需求前准备 setup/map 提交。';
244
+ summaryForAgent = 'Hive Lite is not initialized. Stop ordinary start/finish/map-maintainer workflows and hand off to hive-lite-bootstrap.';
225
245
  } else if (!workspace.canStartNewRequirement) {
226
246
  if (workspace.hive.state === 'in_progress') {
227
247
  phaseGuess = 'finish';
package/src/lib/skills.js CHANGED
@@ -4,6 +4,7 @@ const os = require('os');
4
4
  const path = require('path');
5
5
 
6
6
  const SKILL_NAMES = [
7
+ 'hive-lite-bootstrap',
7
8
  'hive-lite-start-prompt',
8
9
  'hive-lite-finish',
9
10
  'hive-lite-map-maintainer',
package/src/lib/status.js CHANGED
@@ -6,6 +6,14 @@ const { latestChangeId, loadChange } = require('./change');
6
6
  const { exists, readJson } = require('./fsx');
7
7
  const { hiveDir } = require('./map');
8
8
 
9
+ const REQUIRED_HIVE_SETUP_FILES = [
10
+ '.hive/config.yaml',
11
+ '.hive/map/project.yaml',
12
+ '.hive/map/areas.yaml',
13
+ '.hive/map/rules.yaml',
14
+ '.hive/map/validation.yaml',
15
+ ];
16
+
9
17
  function sha256(value) {
10
18
  return createHash('sha256').update(value || '').digest('hex');
11
19
  }
@@ -204,6 +212,10 @@ function action(kind, label, command, description) {
204
212
  return { kind, label, command, description };
205
213
  }
206
214
 
215
+ function missingHiveSetupFiles(root) {
216
+ return REQUIRED_HIVE_SETUP_FILES.filter((file) => !exists(path.join(root, file)));
217
+ }
218
+
207
219
  function actionsFor(state, latestId, diffMatches) {
208
220
  if (state === 'repo_setup_required') {
209
221
  return [
@@ -212,6 +224,12 @@ function actionsFor(state, latestId, diffMatches) {
212
224
  action('manual_git_setup', 'Set up git manually', null, 'If this is a new project, review .gitignore, initialize git, and create an initial commit yourself before running Hive Lite.'),
213
225
  ];
214
226
  }
227
+ if (state === 'hive_init_required') {
228
+ return [
229
+ action('run_hive_init', 'Run Hive Lite init', 'hive-lite init', 'Initialize Hive Lite setup files before using Hive Lite skills.'),
230
+ action('stop', 'Stop', null, 'Do not run start, finish, or map-maintainer skills until Hive Lite has been initialized.'),
231
+ ];
232
+ }
215
233
  if (state === 'clean') {
216
234
  return [
217
235
  action('start_requirement', 'Start a Hive Lite requirement', 'hive-lite find "<intent>" --json', 'The worktree is clean enough to generate a new Context Packet.'),
@@ -281,6 +299,8 @@ function evaluateWorkspaceStatus(cwd, options = {}) {
281
299
  const root = repoRoot(cwd);
282
300
  const files = changedFiles(root);
283
301
  const dirty = files.length > 0;
302
+ const missingSetupFiles = missingHiveSetupFiles(root);
303
+ const initialized = missingSetupFiles.length === 0;
284
304
  const currentDiff = dirty ? diffFromHead(root) : '';
285
305
  const currentDiffHash = dirty ? diffHash(currentDiff) : null;
286
306
  const latest = latestChange(root);
@@ -292,7 +312,10 @@ function evaluateWorkspaceStatus(cwd, options = {}) {
292
312
  ? 'Working tree has dirty files that are not known to be an accepted or in-progress Hive change.'
293
313
  : 'Working tree is clean.';
294
314
 
295
- if (dirty && latest.change) {
315
+ if (!initialized) {
316
+ state = 'hive_init_required';
317
+ reason = 'Hive Lite is not initialized in this git repository. Use $hive-lite-bootstrap for first-time setup, or run hive-lite init as the low-level fallback.';
318
+ } else if (dirty && latest.change) {
296
319
  if (accepted(latest.change) && !committed(latest.change) && diffMatches) {
297
320
  state = 'accepted_uncommitted';
298
321
  reason = 'The dirty diff matches the latest accepted Hive change, but no commit was created.';
@@ -330,6 +353,8 @@ function evaluateWorkspaceStatus(cwd, options = {}) {
330
353
  hive: {
331
354
  state,
332
355
  reason,
356
+ initialized,
357
+ missingSetupFiles,
333
358
  latestChange: latestSummary,
334
359
  },
335
360
  canStartNewRequirement: state === 'clean',