heyspex 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 (104) hide show
  1. package/README.md +157 -0
  2. package/bin/hs.mjs +1028 -0
  3. package/bin/postinstall.mjs +88 -0
  4. package/dev-factory/lib/fleet-readiness.mjs +274 -0
  5. package/dev-factory/lib/fleet-state.mjs +250 -0
  6. package/dev-factory/lib/sufficiency-score.mjs +441 -0
  7. package/dist/cli/hs-check.mjs +747 -0
  8. package/dist/cli/hs-claim.mjs +541 -0
  9. package/dist/cli/hs-connect.mjs +3436 -0
  10. package/dist/cli/hs-defer.mjs +8455 -0
  11. package/dist/cli/hs-env.mjs +36845 -0
  12. package/dist/cli/hs-init.mjs +1145 -0
  13. package/dist/cli/hs-install.mjs +1390 -0
  14. package/dist/cli/hs-join.mjs +38553 -0
  15. package/dist/cli/hs-vault-pull.mjs +7782 -0
  16. package/dist/cli/hs-vault.mjs +4166 -0
  17. package/dist/cli/hs-workspace.mjs +2898 -0
  18. package/dist/cli-templates/customer-vault/specs/entity-model.md +1735 -0
  19. package/dist/cli-templates/customer-vault/specs/protocols/canonical-frontmatter-templates.md +531 -0
  20. package/dist/cli-templates/customer-vault/specs/protocols/memory-protocol.md +48 -0
  21. package/dist/cli-templates/customer-vault/specs/protocols/spec-hierarchy.md +548 -0
  22. package/docs/mcp-client-config.md +200 -0
  23. package/package.json +124 -0
  24. package/scripts/check-mcp-freshness.mjs +379 -0
  25. package/scripts/dev-server-status.mjs +722 -0
  26. package/scripts/gateway-skills-lib.mjs +421 -0
  27. package/scripts/lib/console-url-resolver.mjs +152 -0
  28. package/scripts/lib/dev-mode.mjs +369 -0
  29. package/scripts/lib/hs-link.mjs +154 -0
  30. package/scripts/lib/hs-source-commit.mjs +207 -0
  31. package/scripts/lib/hs-source-log.mjs +366 -0
  32. package/scripts/lib/hs-source-preflight.mjs +402 -0
  33. package/scripts/lib/hs-source-push.mjs +307 -0
  34. package/scripts/lib/hs-source-secret-scan.mjs +263 -0
  35. package/scripts/lib/standalone-doctor.mjs +89 -0
  36. package/scripts/vault-id-lib.mjs +173 -0
  37. package/vendor/heyspex-mcp/alignment-gate.mjs +1347 -0
  38. package/vendor/heyspex-mcp/blocker-resolver.mjs +891 -0
  39. package/vendor/heyspex-mcp/breakdown-ladder.mjs +309 -0
  40. package/vendor/heyspex-mcp/breakdown-source.mjs +236 -0
  41. package/vendor/heyspex-mcp/breakdown-writer.mjs +524 -0
  42. package/vendor/heyspex-mcp/brief-observability.mjs +67 -0
  43. package/vendor/heyspex-mcp/canvas-inbox.mjs +130 -0
  44. package/vendor/heyspex-mcp/capture-active-rehydrate.mjs +76 -0
  45. package/vendor/heyspex-mcp/capture-buffer-patches.mjs +147 -0
  46. package/vendor/heyspex-mcp/capture-channel.mjs +577 -0
  47. package/vendor/heyspex-mcp/capture-console-client.mjs +290 -0
  48. package/vendor/heyspex-mcp/capture-focus.mjs +1366 -0
  49. package/vendor/heyspex-mcp/capture-kind-suggest.mjs +121 -0
  50. package/vendor/heyspex-mcp/capture-outbox.mjs +239 -0
  51. package/vendor/heyspex-mcp/capture-stage-gate.mjs +160 -0
  52. package/vendor/heyspex-mcp/cli.mjs +15754 -0
  53. package/vendor/heyspex-mcp/config-settings.mjs +419 -0
  54. package/vendor/heyspex-mcp/console-fetch.mjs +342 -0
  55. package/vendor/heyspex-mcp/defer-spec.mjs +527 -0
  56. package/vendor/heyspex-mcp/deferred-reclaim.mjs +284 -0
  57. package/vendor/heyspex-mcp/design-tools.mjs +449 -0
  58. package/vendor/heyspex-mcp/dev-factory-bridge.mjs +66 -0
  59. package/vendor/heyspex-mcp/diagnose-skeleton.mjs +114 -0
  60. package/vendor/heyspex-mcp/fleet-queue-tools.mjs +241 -0
  61. package/vendor/heyspex-mcp/hooks-engine.mjs +399 -0
  62. package/vendor/heyspex-mcp/login-handoff.mjs +438 -0
  63. package/vendor/heyspex-mcp/mcp-subprocess.mjs +136 -0
  64. package/vendor/heyspex-mcp/mvp-mode.mjs +101 -0
  65. package/vendor/heyspex-mcp/next-resolution.mjs +240 -0
  66. package/vendor/heyspex-mcp/next-review.mjs +548 -0
  67. package/vendor/heyspex-mcp/peer-presence.mjs +430 -0
  68. package/vendor/heyspex-mcp/plan-ground-conflicts.mjs +321 -0
  69. package/vendor/heyspex-mcp/plan-ground.mjs +2001 -0
  70. package/vendor/heyspex-mcp/plan-ingest.mjs +476 -0
  71. package/vendor/heyspex-mcp/plan-push.mjs +1826 -0
  72. package/vendor/heyspex-mcp/plan-review.mjs +1419 -0
  73. package/vendor/heyspex-mcp/preflight-gate.mjs +0 -0
  74. package/vendor/heyspex-mcp/procedure-tools.mjs +970 -0
  75. package/vendor/heyspex-mcp/promote-capture.mjs +1280 -0
  76. package/vendor/heyspex-mcp/promote-diagnose.mjs +187 -0
  77. package/vendor/heyspex-mcp/promote-research-to-diagnose.mjs +338 -0
  78. package/vendor/heyspex-mcp/promote-research.mjs +1553 -0
  79. package/vendor/heyspex-mcp/promotion-helpers.mjs +280 -0
  80. package/vendor/heyspex-mcp/read-path.mjs +138 -0
  81. package/vendor/heyspex-mcp/recipe-tools.mjs +258 -0
  82. package/vendor/heyspex-mcp/regen-tasks.mjs +326 -0
  83. package/vendor/heyspex-mcp/register-spec.mjs +417 -0
  84. package/vendor/heyspex-mcp/research-focus.mjs +476 -0
  85. package/vendor/heyspex-mcp/research-tools.mjs +109 -0
  86. package/vendor/heyspex-mcp/research-type-suggest.mjs +112 -0
  87. package/vendor/heyspex-mcp/resolution-focus.mjs +45 -0
  88. package/vendor/heyspex-mcp/review-focus.mjs +55 -0
  89. package/vendor/heyspex-mcp/review-rollup.mjs +47 -0
  90. package/vendor/heyspex-mcp/run-front.mjs +60 -0
  91. package/vendor/heyspex-mcp/scheduler.mjs +813 -0
  92. package/vendor/heyspex-mcp/seat-identity.mjs +281 -0
  93. package/vendor/heyspex-mcp/settings-tools.mjs +119 -0
  94. package/vendor/heyspex-mcp/spec-id-lib.mjs +790 -0
  95. package/vendor/heyspex-mcp/split-research.mjs +832 -0
  96. package/vendor/heyspex-mcp/submit-for-review.mjs +190 -0
  97. package/vendor/heyspex-mcp/summary-contract.mjs +162 -0
  98. package/vendor/heyspex-mcp/test-helpers.mjs +43 -0
  99. package/vendor/heyspex-mcp/validate-linkage.mjs +574 -0
  100. package/vendor/heyspex-mcp/vault-resolve.mjs +297 -0
  101. package/vendor/heyspex-mcp/vault-settings.mjs +87 -0
  102. package/vendor/heyspex-mcp/verify-reproduction.mjs +314 -0
  103. package/vendor/heyspex-mcp/why-now.mjs +64 -0
  104. package/vendor/heyspex-mcp/yaml-scalar.mjs +34 -0
@@ -0,0 +1,200 @@
1
+ # Connecting an MCP client to HeySpex
2
+
3
+ There are two ways to get the `hs` / `heyspex` / `heyspex-mcp` commands onto a
4
+ machine, and they are **not** interchangeable:
5
+
6
+ | You are… | Use |
7
+ |---|---|
8
+ | a customer, no clone | [§1a — install the package](#1a-install-the-package-customers) |
9
+ | working from a clone of the HeySpex source repo | [§1b — clone + `npm link`](#1b-clone--npm-link-working-from-source) |
10
+
11
+ Either way, this replaces the repo-only wiring in this repository's `.mcp.json`, which
12
+ points at `node ${CLAUDE_PROJECT_DIR}/vendor/heyspex-mcp/cli.mjs` — a path that **only
13
+ exists inside a clone of the HeySpex source repository** and is therefore useless to
14
+ anyone who installed the package.
15
+
16
+ ## 1a. Install the package (customers)
17
+
18
+ ```sh
19
+ npm install -g heyspex
20
+ ```
21
+
22
+ The package installs three executables: `hs`, `heyspex` (an alias of `hs`), and
23
+ `heyspex-mcp` (the MCP server itself).
24
+
25
+ > **Not published yet.** `heyspex` is not on the public npm registry today, so this
26
+ > command 404s. Until it ships, §1b is the only path that works.
27
+
28
+ > Do **not** run `npx hs`. `hs` is an unrelated package on the public registry and
29
+ > `npx hs` will install *that* instead — it does not error, it just silently runs
30
+ > somebody else's tool. Use `heyspex` or `heyspex-mcp`, which are ours.
31
+
32
+ To avoid a global install entirely, run the server through `npx` with the **package**
33
+ name, which is unambiguous:
34
+
35
+ ```sh
36
+ npx --yes --package heyspex heyspex-mcp
37
+ ```
38
+
39
+ ## 1b. Clone + `npm link` (working from source)
40
+
41
+ `npm install` in a clone does **not** put `hs` on your PATH. Nothing does, except
42
+ `npm link` — run once per machine, from the repo root:
43
+
44
+ ```sh
45
+ git clone https://github.com/pwhermanson/workflow-protocol.git
46
+ cd workflow-protocol
47
+ npm install
48
+ npm link # the step that actually creates hs / heyspex / heyspex-mcp
49
+ npm run doctor # confirms `hs` resolves to THIS checkout
50
+ ```
51
+
52
+ `npm link` writes the three shims into npm's global bin directory (`npm prefix -g`)
53
+ and points them at this clone. It is machine-global: linking a second clone repoints
54
+ `hs` at that one instead. `npm run doctor`'s **`hs` on PATH → this checkout** check
55
+ is what catches all of that — a missing link, an unrelated `hs`, or an `hs` that is
56
+ live but aimed at a different clone.
57
+
58
+ If `hs` still does not resolve after linking, npm's global bin directory is not on
59
+ your PATH — add the directory `npm prefix -g` prints (the shims sit in it directly)
60
+ and reopen your terminal.
61
+
62
+ Until you have linked, every command in this document works as
63
+ `node bin/hs.mjs <args>` from the repo root. That form always works and is the right
64
+ fallback — `npx hs` is not.
65
+
66
+ ## 2. Point your MCP client at it
67
+
68
+ ### Claude Code
69
+
70
+ Project scope — `.mcp.json` in the root of the repository you want HeySpex to track:
71
+
72
+ ```json
73
+ {
74
+ "mcpServers": {
75
+ "heyspex": {
76
+ "type": "stdio",
77
+ "command": "heyspex-mcp",
78
+ "args": [],
79
+ "env": {
80
+ "HEYSPEX_VAULT_ROOT": "."
81
+ }
82
+ }
83
+ }
84
+ }
85
+ ```
86
+
87
+ If you did not install globally, use the no-install form instead:
88
+
89
+ ```json
90
+ {
91
+ "mcpServers": {
92
+ "heyspex": {
93
+ "type": "stdio",
94
+ "command": "npx",
95
+ "args": ["--yes", "--package", "heyspex", "heyspex-mcp"],
96
+ "env": {
97
+ "HEYSPEX_VAULT_ROOT": "."
98
+ }
99
+ }
100
+ }
101
+ }
102
+ ```
103
+
104
+ User scope, from any directory:
105
+
106
+ ```sh
107
+ claude mcp add --scope user heyspex heyspex-mcp
108
+ ```
109
+
110
+ ### Cursor
111
+
112
+ `~/.cursor/mcp.json` (user scope) or `.cursor/mcp.json` (project scope) takes the
113
+ same object:
114
+
115
+ ```json
116
+ {
117
+ "mcpServers": {
118
+ "heyspex": {
119
+ "command": "heyspex-mcp",
120
+ "args": [],
121
+ "env": {
122
+ "HEYSPEX_VAULT_ROOT": "."
123
+ }
124
+ }
125
+ }
126
+ }
127
+ ```
128
+
129
+ ### Any other MCP client
130
+
131
+ The server speaks JSON-RPC over stdin/stdout. Anything that can launch a command and
132
+ talk MCP to it works — launch `heyspex-mcp` with no arguments.
133
+
134
+ **After adding the server, restart the client.** MCP servers are read once at client
135
+ startup; a mid-session install will not surface the tools.
136
+
137
+ ## 3. Sign in
138
+
139
+ ```sh
140
+ heyspex login # or `hs login`, or `node bin/hs.mjs login` from a clone
141
+ ```
142
+
143
+ That opens the console, mints a pairing code, and writes a lasting token to
144
+ `~/.heyspex/credentials.yaml`. On a machine with no browser — or when the code was
145
+ minted elsewhere — redeem it directly:
146
+
147
+ ```sh
148
+ heyspex mcp pair <code>
149
+ ```
150
+
151
+ > If `credentials.yaml` never appears, the command you ran was probably not ours.
152
+ > `npx hs login` runs the unrelated registry package and writes nothing; an unlinked
153
+ > clone has no `hs` at all. Run `npm run doctor` — its **`hs` on PATH → this
154
+ > checkout** check names the cause.
155
+
156
+ ## Which vault the server reads
157
+
158
+ Resolution order, highest first:
159
+
160
+ | # | Source | Notes |
161
+ |---|---|---|
162
+ | 1 | An explicit vault id | `hs vault use <id>` |
163
+ | 2 | `active_vault_id` in `~/.heyspex/registry.json` | the offline active-vault pointer |
164
+ | 3 | `HEYSPEX_VAULT_ROOT` | the repository root; what the config above sets |
165
+ | 4 | `HEYSPEX_VAULT_DIR` | the `specs/` directory itself |
166
+ | 5 | The working directory | used when it contains a `specs/` directory |
167
+
168
+ ## Which console the server calls
169
+
170
+ Resolution order, highest first:
171
+
172
+ | # | Source | Written by |
173
+ |---|---|---|
174
+ | 1 | `HEYSPEX_CONSOLE_URL` | you, in the client config or your shell |
175
+ | 2 | `console_url:` in `~/.heyspex/credentials.yaml` | `heyspex login` / `heyspex mcp pair` |
176
+ | 3 | `.heyspex/console-url` in the vault | a local development server |
177
+ | 4 | `http://localhost:3000` | the fallback |
178
+
179
+ A customer install normally uses row 2 and needs no environment variable at all. Set
180
+ `HEYSPEX_CONSOLE_URL` only to override a paired console for one session.
181
+
182
+ ## Verifying it works
183
+
184
+ From a clone, one command covers every install surface, including whether `hs`
185
+ resolves to this checkout:
186
+
187
+ ```sh
188
+ npm run doctor
189
+ ```
190
+
191
+ Otherwise:
192
+
193
+ ```sh
194
+ heyspex-mcp --version 2>/dev/null || echo "server starts"
195
+ ```
196
+
197
+ The real check is in the client: after restarting it, the `heyspex_*` tools should be
198
+ listed. If they are not, the client did not restart, or the command is not on your
199
+ `PATH` — from a clone run `npm link` (§1b); from an install, try the
200
+ `npx --package heyspex heyspex-mcp` form.
package/package.json ADDED
@@ -0,0 +1,124 @@
1
+ {
2
+ "name": "heyspex",
3
+ "version": "0.1.0",
4
+ "description": "HeySpex CLI + MCP server — connect Claude Code, Cursor, and any MCP client to your HeySpex spec vault",
5
+ "keywords": [
6
+ "heyspex",
7
+ "mcp",
8
+ "model-context-protocol",
9
+ "claude-code",
10
+ "cursor",
11
+ "spec-driven-development",
12
+ "agents"
13
+ ],
14
+ "type": "module",
15
+ "license": "MIT",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/pwhermanson/workflow-protocol.git"
19
+ },
20
+ "engines": {
21
+ "node": ">=20.0.0 <25.0.0"
22
+ },
23
+ "workspaces": [
24
+ "spex-console",
25
+ "pm-control-center",
26
+ "companion/extension"
27
+ ],
28
+ "bin": {
29
+ "hs": "bin/hs.mjs",
30
+ "heyspex": "bin/hs.mjs",
31
+ "heyspex-mcp": "vendor/heyspex-mcp/cli.mjs"
32
+ },
33
+ "exports": {
34
+ "./package.json": "./package.json",
35
+ "./console-url-resolver": "./scripts/lib/console-url-resolver.mjs"
36
+ },
37
+ "files": [
38
+ "bin/hs.mjs",
39
+ "bin/postinstall.mjs",
40
+ "vendor/heyspex-mcp/**/*.mjs",
41
+ "!vendor/heyspex-mcp/**/*.test.mjs",
42
+ "scripts/check-mcp-freshness.mjs",
43
+ "scripts/gateway-skills-lib.mjs",
44
+ "scripts/vault-id-lib.mjs",
45
+ "scripts/lib/console-url-resolver.mjs",
46
+ "scripts/lib/hs-link.mjs",
47
+ "scripts/lib/dev-mode.mjs",
48
+ "scripts/dev-server-status.mjs",
49
+ "scripts/lib/hs-source-*.mjs",
50
+ "!scripts/lib/hs-source-*.test.mjs",
51
+ "scripts/lib/standalone-doctor.mjs",
52
+ "dev-factory/lib/fleet-readiness.mjs",
53
+ "dev-factory/lib/fleet-state.mjs",
54
+ "dev-factory/lib/sufficiency-score.mjs",
55
+ "docs/mcp-client-config.md",
56
+ "dist/cli/*.mjs",
57
+ "dist/cli-templates/**",
58
+ "LICENSE"
59
+ ],
60
+ "dependencies": {
61
+ "js-yaml": ">=3.13.0 <5.0.0"
62
+ },
63
+ "devDependencies": {
64
+ "esbuild": "^0.24.2"
65
+ },
66
+ "scripts": {
67
+ "prepack": "node scripts/build-cli-bundle.mjs",
68
+ "build:cli": "node scripts/build-cli-bundle.mjs",
69
+ "postinstall": "node bin/postinstall.mjs",
70
+ "setup": "node scripts/heyspex-doctor.mjs --fix",
71
+ "doctor": "node scripts/heyspex-doctor.mjs",
72
+ "heyspex:on": "node scripts/hs-mode.mjs on",
73
+ "heyspex:off": "node scripts/hs-mode.mjs off",
74
+ "heyspex:status": "node scripts/hs-mode.mjs status",
75
+ "commandcode:install": "node scripts/install-commandcode.mjs",
76
+ "commandcode:check": "node scripts/install-commandcode.mjs --check",
77
+ "commandcode:uninstall": "node scripts/install-commandcode.mjs --uninstall",
78
+ "seats:sync": "node scripts/sync-seat-context.mjs",
79
+ "seats:check": "node scripts/sync-seat-context.mjs --check",
80
+ "skills:sync": "node scripts/sync-skills.mjs",
81
+ "skills:check": "node scripts/sync-skills.mjs --check",
82
+ "pm:dashboard": "node bin/cli.mjs dashboard",
83
+ "pm:control-center": "node bin/cli.mjs control-center",
84
+ "pm:parallel-check": "node bin/cli.mjs parallel-check",
85
+ "validate:vault-ids": "node scripts/validate-vault-ids.mjs",
86
+ "validate:vault-naming": "node scripts/validate-vault-naming.mjs",
87
+ "validate:vault-blockers": "node scripts/validate-vault-blockers.mjs",
88
+ "validate:vault-frontmatter": "node scripts/validate-vault-frontmatter.mjs",
89
+ "validate:vault-encoding": "node scripts/fix-mojibake.mjs --check",
90
+ "fix:vault-encoding": "node scripts/fix-mojibake.mjs --apply",
91
+ "validate:review-backlinks": "node scripts/validate-review-backlinks.mjs",
92
+ "build:procedure-catalog": "node scripts/build-procedure-catalog.mjs",
93
+ "validate:procedure-catalog": "node scripts/build-procedure-catalog.mjs --check",
94
+ "build:guardrails": "node scripts/build-guardrails.mjs",
95
+ "validate:guardrails": "node scripts/build-guardrails.mjs --check",
96
+ "compile:agents": "node scripts/compile-agents.mjs",
97
+ "validate:agents": "node scripts/compile-agents.mjs --check",
98
+ "build:vault-index": "node scripts/build-vault-index.mjs",
99
+ "validate:vault-index": "node scripts/build-vault-index.mjs --check",
100
+ "check:no-cockpit": "node scripts/check-no-cockpit.mjs",
101
+ "commit": "node scripts/human-commit.mjs",
102
+ "commit:owner": "node scripts/owner-commit.mjs",
103
+ "hooks:install": "node scripts/install-git-hooks.mjs",
104
+ "hooks:install-claude": "node scripts/install-claude-code-hooks.mjs",
105
+ "hooks:check-claude": "node scripts/install-claude-code-hooks.mjs --check",
106
+ "hooks:install-cursor": "node scripts/install-cursor-hooks.mjs",
107
+ "hooks:check-cursor": "node scripts/install-cursor-hooks.mjs --check",
108
+ "hooks:smoke-cursor": "node scripts/cursor-hooks/_run.smoke.mjs",
109
+ "companion": "pwsh -NoProfile -ExecutionPolicy Bypass -File companion/start.ps1 -Action start",
110
+ "companion:stop": "pwsh -NoProfile -ExecutionPolicy Bypass -File companion/start.ps1 -Action stop",
111
+ "companion:status": "pwsh -NoProfile -ExecutionPolicy Bypass -File companion/start.ps1 -Action status",
112
+ "spexcompanion": "pwsh -NoProfile -ExecutionPolicy Bypass -File companion/start.ps1 -Action start",
113
+ "spexcompanion:stop": "pwsh -NoProfile -ExecutionPolicy Bypass -File companion/start.ps1 -Action stop",
114
+ "spexcompanion:status": "pwsh -NoProfile -ExecutionPolicy Bypass -File companion/start.ps1 -Action status",
115
+ "console": "npm run dev -w spex-console",
116
+ "console:log": "pwsh -NoProfile -ExecutionPolicy Bypass -File scripts/run-console-devlog.ps1",
117
+ "console:log:lan": "pwsh -NoProfile -ExecutionPolicy Bypass -File scripts/run-console-devlog.ps1 -Lan",
118
+ "console:stop": "node scripts/dev-server-stop.mjs",
119
+ "console:status": "node scripts/dev-server-status.mjs",
120
+ "test:mcp": "node --test vendor/heyspex-mcp/*.test.mjs scripts/lib/*.test.mjs",
121
+ "verify:package": "node scripts/verify-mcp-package.mjs"
122
+ },
123
+ "//files": "PUBLISHED SURFACE - every entry is verified by `node scripts/verify-mcp-package.mjs`. It must cover the STATIC import closure of vendor/heyspex-mcp/cli.mjs and nothing else. SpexFleet internals (dev-factory/router.mjs, cloud-clients.mjs, cost-tracker.mjs, dream-research/) are deliberately absent - research-tools.mjs reaches them through the lazy dev-factory-bridge.mjs. Do not add a path here without re-running the verifier; npm publish is a one-way door ([[HS-ZJSP-0JNK-TASK-ship-the-heyspex-mcp-server-as-an]] / [[HS-8DET-0JNK-TASK-confirm-the-open-core-boundary-and]]). `dist/cli/*.mjs` + `dist/cli-templates/**` are a SEPARATE published surface (`hs init` / `hs install` bundled by `scripts/build-cli-bundle.mjs`, regenerated fresh every `prepack` - `dist/` itself stays git-ignored) - see that script's doc comment for the entry scope decision and [[HS-JOQX-0JNK-TASK-published-package-runs-hs-init-and-hs]]."
124
+ }