@h1veframework/cli 0.13.0 → 0.14.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 (4) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +81 -81
  3. package/dist/index.js +27 -3
  4. package/package.json +61 -61
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 H1VE Framework
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 H1VE Framework
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,81 +1,81 @@
1
- # @h1veframework/cli · `h1ve`
2
-
3
- **The command-line companion for [H1VE](https://h1ve.org) — the governance & memory layer for teams building with AI.**
4
-
5
- Your team ships with AI (Claude Code, Cursor, Copilot). As the codebase grows, the AI and your teammates start
6
- **losing context and drifting from decisions you already made**. H1VE keeps every feature aligned — a shared,
7
- **eternal project memory** plus an **anti-drift engine** that checks each change against what's been decided.
8
- `h1ve` drives that workflow straight from your terminal.
9
-
10
- Part of the H1VE toolchain, alongside the **[MCP server](https://www.npmjs.com/package/@h1veframework/mcp)** for
11
- Claude Code / Cursor.
12
-
13
- → **[h1ve.org](https://h1ve.org)** · **[app.h1ve.org](https://app.h1ve.org)**
14
-
15
- ## Quickstart (zero paste)
16
-
17
- ```bash
18
- npm i -g @h1veframework/cli
19
- h1ve login # opens your browser → you click Authorize → done
20
- h1ve status # state of the current branch's feature
21
- ```
22
-
23
- `h1ve login` stores the credential locally (`~/.config/h1ve/credentials.json`, `600`) — the MCP server reads the
24
- same one, so **one login sets up both**. The project **auto-resolves from your git remote**, so there's nothing
25
- to paste and no `H1VE_PROJECT_ID` to set. `h1ve logout` removes it.
26
-
27
- > The legacy `nf` command still works as an alias — every `h1ve <cmd>` below can be run as `nf <cmd>`.
28
-
29
- > `h1ve health` saying "no snapshots yet" is **success** (you're connected; the project just has no metrics yet).
30
-
31
- ## Commands
32
-
33
- | Command | What it does |
34
- |---|---|
35
- | `h1ve login` / `h1ve logout` | Authorize in the browser and store the credential locally / remove it |
36
- | `h1ve status` | State of the current branch's feature (stage, days active, blockers, sign-offs) |
37
- | `h1ve start [<#\|id>] [--slug <s>]` | Start an assigned feature: create the `feat/{you}/{slug}` branch and record the slug |
38
- | `h1ve spec` | Print the feature's spec (markdown) |
39
- | `h1ve move <stage> [--note]` | Move the feature to another stage |
40
- | `h1ve done [--from <file>] [--no-move]` | Submit the AI declaration (JSON) and move `dev → pr` |
41
- | `h1ve blocker "<desc>"` | Open a blocker on the feature (you become its owner) |
42
- | `h1ve health` | Latest technical-health snapshots for the project |
43
- | `h1ve connect --kind <k> --label <l> --env KEY=VAL` | Write a credential to your **local** `.env.local` and register the inventory (never sent to the server) |
44
- | `h1ve serve [--port 7391]` | Run the local agent (`127.0.0.1`) so the dashboard can apply credentials from the browser |
45
-
46
- Flags: `--json` (raw output for scripts) · `--project <name\|id>` (if you belong to more than one project) · `-h`.
47
-
48
- ## Example
49
-
50
- ```bash
51
- h1ve start # start your assigned feature (creates the branch)
52
- # ... work: git, code, commits ...
53
- h1ve status # check state anytime
54
- h1ve blocker "waiting on the Neon credential" # blocked? open a blocker
55
- h1ve done --from ai-declaration.json # submit the AI declaration + move dev → pr
56
- ```
57
-
58
- ## CI / headless (env vars)
59
-
60
- No browser? Configure by env (takes **precedence** over `h1ve login`):
61
-
62
- ```bash
63
- export H1VE_API_URL="https://app.h1ve.org" # optional (this is the default)
64
- export H1VE_API_KEY="nf_pat_..." # a PAT from app.h1ve.org/api-tokens
65
- # export H1VE_PROJECT_ID="..." # OPTIONAL — the CLI resolves the project from the repo
66
- ```
67
-
68
- ## Troubleshooting
69
-
70
- | Symptom | Fix |
71
- |---|---|
72
- | `h1ve: command not found` | Node missing or wrong terminal. Check `node --version`. On Windows, reopen the shell or use the VS Code terminal. |
73
- | `404` on install | npm propagation right after a publish — wait a few minutes. |
74
- | `NO_PROJECT` | You belong to more than one project — pass `--project <name\|id>`. |
75
- | `401` / `403` | Wrong/missing token. Make sure `H1VE_API_KEY` is a PAT (`nf_pat_…`). `403 SERVICE_CANNOT_WRITE` = a read-only service key used on a write → use a PAT. |
76
-
77
- Requires **Node.js 18.18+**. The legacy `nf` command and env names `NEXUS_FLOW_API_URL` / `NEXUS_FLOW_API_KEY` are still accepted.
78
-
79
- ---
80
-
81
- MIT · built with H1VE, by [H1VE](https://h1ve.org) 🐝
1
+ # @h1veframework/cli · `h1ve`
2
+
3
+ **The command-line companion for [H1VE](https://h1ve.org) — the governance & memory layer for teams building with AI.**
4
+
5
+ Your team ships with AI (Claude Code, Cursor, Copilot). As the codebase grows, the AI and your teammates start
6
+ **losing context and drifting from decisions you already made**. H1VE keeps every feature aligned — a shared,
7
+ **eternal project memory** plus an **anti-drift engine** that checks each change against what's been decided.
8
+ `h1ve` drives that workflow straight from your terminal.
9
+
10
+ Part of the H1VE toolchain, alongside the **[MCP server](https://www.npmjs.com/package/@h1veframework/mcp)** for
11
+ Claude Code / Cursor.
12
+
13
+ → **[h1ve.org](https://h1ve.org)** · **[app.h1ve.org](https://app.h1ve.org)**
14
+
15
+ ## Quickstart (zero paste)
16
+
17
+ ```bash
18
+ npm i -g @h1veframework/cli
19
+ h1ve login # opens your browser → you click Authorize → done
20
+ h1ve status # state of the current branch's feature
21
+ ```
22
+
23
+ `h1ve login` stores the credential locally (`~/.config/h1ve/credentials.json`, `600`) — the MCP server reads the
24
+ same one, so **one login sets up both**. The project **auto-resolves from your git remote**, so there's nothing
25
+ to paste and no `H1VE_PROJECT_ID` to set. `h1ve logout` removes it.
26
+
27
+ > The legacy `nf` command still works as an alias — every `h1ve <cmd>` below can be run as `nf <cmd>`.
28
+
29
+ > `h1ve health` saying "no snapshots yet" is **success** (you're connected; the project just has no metrics yet).
30
+
31
+ ## Commands
32
+
33
+ | Command | What it does |
34
+ |---|---|
35
+ | `h1ve login` / `h1ve logout` | Authorize in the browser and store the credential locally / remove it |
36
+ | `h1ve status` | State of the current branch's feature (stage, days active, blockers, sign-offs) |
37
+ | `h1ve start [<#\|id>] [--slug <s>]` | Start an assigned feature: create the `feat/{you}/{slug}` branch and record the slug |
38
+ | `h1ve spec` | Print the feature's spec (markdown) |
39
+ | `h1ve move <stage> [--note]` | Move the feature to another stage |
40
+ | `h1ve done [--from <file>] [--no-move]` | Submit the AI declaration (JSON) and move `dev → pr` |
41
+ | `h1ve blocker "<desc>"` | Open a blocker on the feature (you become its owner) |
42
+ | `h1ve health` | Latest technical-health snapshots for the project |
43
+ | `h1ve connect --kind <k> --label <l> --env KEY=VAL` | Write a credential to your **local** `.env.local` and register the inventory (never sent to the server) |
44
+ | `h1ve serve [--port 7391]` | Run the local agent (`127.0.0.1`) so the dashboard can apply credentials from the browser |
45
+
46
+ Flags: `--json` (raw output for scripts) · `--project <name\|id>` (if you belong to more than one project) · `-h`.
47
+
48
+ ## Example
49
+
50
+ ```bash
51
+ h1ve start # start your assigned feature (creates the branch)
52
+ # ... work: git, code, commits ...
53
+ h1ve status # check state anytime
54
+ h1ve blocker "waiting on the Neon credential" # blocked? open a blocker
55
+ h1ve done --from ai-declaration.json # submit the AI declaration + move dev → pr
56
+ ```
57
+
58
+ ## CI / headless (env vars)
59
+
60
+ No browser? Configure by env (takes **precedence** over `h1ve login`):
61
+
62
+ ```bash
63
+ export H1VE_API_URL="https://app.h1ve.org" # optional (this is the default)
64
+ export H1VE_API_KEY="nf_pat_..." # a PAT from app.h1ve.org/api-tokens
65
+ # export H1VE_PROJECT_ID="..." # OPTIONAL — the CLI resolves the project from the repo
66
+ ```
67
+
68
+ ## Troubleshooting
69
+
70
+ | Symptom | Fix |
71
+ |---|---|
72
+ | `h1ve: command not found` | Node missing or wrong terminal. Check `node --version`. On Windows, reopen the shell or use the VS Code terminal. |
73
+ | `404` on install | npm propagation right after a publish — wait a few minutes. |
74
+ | `NO_PROJECT` | You belong to more than one project — pass `--project <name\|id>`. |
75
+ | `401` / `403` | Wrong/missing token. Make sure `H1VE_API_KEY` is a PAT (`nf_pat_…`). `403 SERVICE_CANNOT_WRITE` = a read-only service key used on a write → use a PAT. |
76
+
77
+ Requires **Node.js 18.18+**. The legacy `nf` command and env names `NEXUS_FLOW_API_URL` / `NEXUS_FLOW_API_KEY` are still accepted.
78
+
79
+ ---
80
+
81
+ MIT · built with H1VE, by [H1VE](https://h1ve.org) 🐝
package/dist/index.js CHANGED
@@ -212,6 +212,9 @@ function createClient(config) {
212
212
  setDone(featureId, doneContent) {
213
213
  return writeAction("PATCH", featureId, "done", { done_content: doneContent });
214
214
  },
215
+ addDependency(featureId, dependsOnId) {
216
+ return postAction(featureId, "dependencies", { depends_on_id: dependsOnId });
217
+ },
215
218
  // SPEC-100 (B2): best-effort — o juiz de drift é ADVISORY; qualquer falha → {checked:false}
216
219
  // (nunca lança, pra não estragar o fluxo de gravar a SPEC no `set_spec` do MCP).
217
220
  async checkSpecAlignment(featureId) {
@@ -554,10 +557,30 @@ function formatStartList(list) {
554
557
  const header = "Features para iniciar ou retomar \u2014 escolha: h1ve start <n\xBA>";
555
558
  const rows = list.map((f, i) => {
556
559
  const tag = f.branch_slug !== null ? " (retomar)" : "";
557
- return ` ${String(i + 1).padStart(2)}. ${f.name} [${stageLabel(f.stage)}]${tag}`;
560
+ const dep = f.depends_on && f.depends_on.length > 0 ? ` \u26A0 depende de ${f.depends_on.map((d) => d.name).join(", ")}` : "";
561
+ return ` ${String(i + 1).padStart(2)}. ${f.name} [${stageLabel(f.stage)}]${tag}${dep}`;
558
562
  });
559
563
  return [header, ...rows].join("\n");
560
564
  }
565
+ var PRIORITY_RANK = { HIGH: 0, MEDIUM: 1, LOW: 2 };
566
+ function rankStartable(list) {
567
+ return [...list].sort((a, b) => {
568
+ const resume = (a.branch_slug !== null ? 0 : 1) - (b.branch_slug !== null ? 0 : 1);
569
+ if (resume !== 0) return resume;
570
+ const blocked = (a.blocked_by_dep ? 1 : 0) - (b.blocked_by_dep ? 1 : 0);
571
+ if (blocked !== 0) return blocked;
572
+ const prio = PRIORITY_RANK[a.priority] - PRIORITY_RANK[b.priority];
573
+ if (prio !== 0) return prio;
574
+ return (a.appetite ?? 0) - (b.appetite ?? 0);
575
+ });
576
+ }
577
+ function formatDepWarning(f) {
578
+ if (!f.depends_on || f.depends_on.length === 0) return "";
579
+ const names = f.depends_on.map((d) => d.name).join(", ");
580
+ return `\u26A0 "${f.name}" depende de ${names} (ainda n\xE3o conclu\xEDdo) \u2014 considere fazer isso primeiro.
581
+
582
+ `;
583
+ }
561
584
  var PRE_DEV_STAGES = /* @__PURE__ */ new Set(["backlog", "spec", "blocked"]);
562
585
  function startFlowLines(r) {
563
586
  const stage = r.landed_stage ?? r.feature.stage;
@@ -781,7 +804,7 @@ function pick(list, arg) {
781
804
  }
782
805
  async function start(io, args) {
783
806
  const [features, localBranches] = await Promise.all([io.client.listFeatures(), io.listBranches()]);
784
- const list = startable(features, localBranches);
807
+ const list = rankStartable(startable(features, localBranches));
785
808
  if (list.length === 0) {
786
809
  throw new CliError("Nenhuma feature para iniciar ou retomar (sem branch local e fora de main).");
787
810
  }
@@ -799,7 +822,8 @@ async function start(io, args) {
799
822
  if (code === "BRANCH_EXISTS") await io.switchBranch(result.branch_name);
800
823
  else throw err;
801
824
  }
802
- return { human: `${warning}${formatStart(result, { resumed: resuming })}`, data: result };
825
+ const depWarn = formatDepWarning(selected);
826
+ return { human: `${warning}${depWarn}${formatStart(result, { resumed: resuming })}`, data: result };
803
827
  }
804
828
 
805
829
  // src/commands/connect.ts
package/package.json CHANGED
@@ -1,61 +1,61 @@
1
- {
2
- "name": "@h1veframework/cli",
3
- "version": "0.13.0",
4
- "description": "The CLI for H1VE — the governance & memory layer for teams building with AI. Drive your feature flow (start, status, move, spec, done) from the terminal. Works with Claude Code, Cursor and Copilot.",
5
- "license": "MIT",
6
- "type": "module",
7
- "bin": {
8
- "h1ve": "dist/index.js",
9
- "nf": "dist/index.js"
10
- },
11
- "files": [
12
- "dist",
13
- "README.md"
14
- ],
15
- "engines": {
16
- "node": ">=18.18"
17
- },
18
- "repository": {
19
- "type": "git",
20
- "url": "git+https://github.com/GusHartz/nexus-flow.git",
21
- "directory": "packages/cli"
22
- },
23
- "homepage": "https://h1ve.org",
24
- "bugs": {
25
- "url": "https://github.com/GusHartz/nexus-flow/issues"
26
- },
27
- "keywords": [
28
- "h1ve",
29
- "cli",
30
- "nf",
31
- "ai",
32
- "claude-code",
33
- "cursor",
34
- "copilot",
35
- "ai-coding",
36
- "ai-agents",
37
- "memory",
38
- "anti-drift",
39
- "context",
40
- "governance",
41
- "developer-tools",
42
- "dev-workflow",
43
- "mcp"
44
- ],
45
- "publishConfig": {
46
- "access": "public"
47
- },
48
- "scripts": {
49
- "build": "tsup",
50
- "typecheck": "tsc --noEmit",
51
- "test": "vitest run",
52
- "prepublishOnly": "npm run build"
53
- },
54
- "devDependencies": {
55
- "@nexus-flow/core": "*",
56
- "@types/node": "^20.19.43",
57
- "tsup": "^8.3.0",
58
- "typescript": "^5.6.0",
59
- "vitest": "^2.1.0"
60
- }
61
- }
1
+ {
2
+ "name": "@h1veframework/cli",
3
+ "version": "0.14.0",
4
+ "description": "The CLI for H1VE — the governance & memory layer for teams building with AI. Drive your feature flow (start, status, move, spec, done) from the terminal. Works with Claude Code, Cursor and Copilot.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "bin": {
8
+ "h1ve": "dist/index.js",
9
+ "nf": "dist/index.js"
10
+ },
11
+ "files": [
12
+ "dist",
13
+ "README.md"
14
+ ],
15
+ "engines": {
16
+ "node": ">=18.18"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git+https://github.com/GusHartz/nexus-flow.git",
21
+ "directory": "packages/cli"
22
+ },
23
+ "homepage": "https://h1ve.org",
24
+ "bugs": {
25
+ "url": "https://github.com/GusHartz/nexus-flow/issues"
26
+ },
27
+ "keywords": [
28
+ "h1ve",
29
+ "cli",
30
+ "nf",
31
+ "ai",
32
+ "claude-code",
33
+ "cursor",
34
+ "copilot",
35
+ "ai-coding",
36
+ "ai-agents",
37
+ "memory",
38
+ "anti-drift",
39
+ "context",
40
+ "governance",
41
+ "developer-tools",
42
+ "dev-workflow",
43
+ "mcp"
44
+ ],
45
+ "publishConfig": {
46
+ "access": "public"
47
+ },
48
+ "scripts": {
49
+ "build": "tsup",
50
+ "typecheck": "tsc --noEmit",
51
+ "test": "vitest run",
52
+ "prepublishOnly": "npm run build"
53
+ },
54
+ "devDependencies": {
55
+ "@nexus-flow/core": "*",
56
+ "@types/node": "^20.19.43",
57
+ "tsup": "^8.3.0",
58
+ "typescript": "^5.6.0",
59
+ "vitest": "^2.1.0"
60
+ }
61
+ }