wayform 0.1.7 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -49
- package/dist/cli.js +17 -5
- package/dist/cli.js.map +1 -1
- package/dist/config.js +6 -6
- package/dist/config.js.map +1 -1
- package/dist/credential-store.js +77 -0
- package/dist/credential-store.js.map +1 -0
- package/dist/doctor.js +30 -22
- package/dist/doctor.js.map +1 -1
- package/dist/hook-clients.js +16 -13
- package/dist/hook-clients.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/init-configs.js +75 -32
- package/dist/init-configs.js.map +1 -1
- package/dist/init-env.js +13 -6
- package/dist/init-env.js.map +1 -1
- package/dist/init-remote.js +159 -95
- package/dist/init-remote.js.map +1 -1
- package/dist/init.js +7 -3
- package/dist/init.js.map +1 -1
- package/dist/keychain.js +31 -0
- package/dist/keychain.js.map +1 -0
- package/dist/oauth-login.js +149 -0
- package/dist/oauth-login.js.map +1 -0
- package/dist/oauth-session.js +122 -0
- package/dist/oauth-session.js.map +1 -0
- package/dist/prompt-hook.js +53 -0
- package/dist/prompt-hook.js.map +1 -0
- package/dist/remote-read.js +29 -9
- package/dist/remote-read.js.map +1 -1
- package/dist/session-prompt.js +13 -10
- package/dist/session-prompt.js.map +1 -1
- package/dist/space-create.js +17 -201
- package/dist/space-create.js.map +1 -1
- package/dist/stop-hook.js +20 -139
- package/dist/stop-hook.js.map +1 -1
- package/package.json +9 -6
package/README.md
CHANGED
|
@@ -75,21 +75,21 @@ or SSH. No accounts, no separate auth.
|
|
|
75
75
|
From your project repo:
|
|
76
76
|
|
|
77
77
|
```bash
|
|
78
|
-
|
|
78
|
+
wayform init
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
`init` writes, idempotently and without clobbering existing config:
|
|
82
82
|
|
|
83
83
|
- **Session-start read hooks + MCP registration** for Claude Code
|
|
84
84
|
(`.claude/settings.json`, `.mcp.json`), Cursor (`.cursor/hooks.json`,
|
|
85
|
-
`.cursor/mcp.json`), and Codex (`.codex/hooks.json
|
|
86
|
-
|
|
85
|
+
`.cursor/mcp.json`), and Codex (`.codex/hooks.json` and project
|
|
86
|
+
`.codex/config.toml`)
|
|
87
87
|
- **End-of-turn write-review hooks** (the Stop hook — see
|
|
88
88
|
[The loop](#the-loop-how-reads-and-writes-actually-happen))
|
|
89
89
|
- Your per-user, **gitignored** `.memorylayer-hook.env` (identity + repo URL —
|
|
90
90
|
secrets never enter git)
|
|
91
91
|
|
|
92
|
-
One person commits the project configs; each teammate runs `
|
|
92
|
+
One person commits the project configs; each teammate runs `wayform init`
|
|
93
93
|
once to set their own identity. Done — the next coding session in that project
|
|
94
94
|
starts with the team's context already loaded.
|
|
95
95
|
|
|
@@ -100,32 +100,66 @@ anyone pasting it. That round-trip is the product.
|
|
|
100
100
|
|
|
101
101
|
---
|
|
102
102
|
|
|
103
|
-
## Hosted gateway
|
|
103
|
+
## Hosted gateway
|
|
104
104
|
|
|
105
105
|
The local mode above needs each member to hold a git token. The **hosted
|
|
106
|
-
gateway** removes even that: a stateless Cloudflare Worker exposes the same
|
|
107
|
-
tools over MCP Streamable HTTP
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
106
|
+
gateway** removes even that: a stateless Cloudflare Worker exposes the same
|
|
107
|
+
tools over **MCP Streamable HTTP**. Identity is **GitHub OAuth** (the same App
|
|
108
|
+
that writes the memory repo). Members never copy, paste, or store a Wayform
|
|
109
|
+
credential.
|
|
110
|
+
|
|
111
|
+
Wayform is **vendor-neutral**. The same URL works in Cursor, Claude Code,
|
|
112
|
+
Codex, Devin, Antigravity, or any MCP client that speaks Streamable HTTP +
|
|
113
|
+
OAuth. Configure it in **this product repo** (the codebase you work in) — never
|
|
114
|
+
as a user-global MCP, or it will follow you into unrelated folders.
|
|
115
|
+
|
|
116
|
+
Every customer is a new team. The operator allowlists their GitHub user or org;
|
|
117
|
+
they create their own private memory repo, initialize project-scoped config,
|
|
118
|
+
and select that memory repo in the guided App installation. Teammates are
|
|
119
|
+
invited in-agent by GitHub username.
|
|
120
|
+
|
|
121
|
+
**Operator (once per client):** add their GitHub login or org to the allowlist,
|
|
122
|
+
then send the MCP URL. Never send a token.
|
|
123
|
+
|
|
124
|
+
**They do:**
|
|
125
|
+
|
|
126
|
+
1. On GitHub, create a **private** team-memory repo and give it a first commit
|
|
127
|
+
(for example, initialize it with a README).
|
|
128
|
+
2. In the product repo, run
|
|
129
|
+
`wayform init --remote --clients cursor,claude` with the clients the team
|
|
130
|
+
actually uses. This writes URL-only, project-scoped configuration.
|
|
131
|
+
3. Connect the `wayform` MCP server. Sign in with GitHub, follow the guided App
|
|
132
|
+
installation, and select only the private memory repo from step 1.
|
|
133
|
+
4. Run `wayform login` once on the machine so session hooks can authenticate.
|
|
134
|
+
5. Run `wayform doctor`; resolve every failed hosted check before continuing.
|
|
135
|
+
6. Ask the agent to record a test decision, then open a new session and confirm
|
|
136
|
+
that decision is already present.
|
|
137
|
+
7. Commit the URL-only project configuration. Teammates run remote init and
|
|
138
|
+
authenticate; nobody copies a credential.
|
|
139
|
+
|
|
140
|
+
### Client setup (project-scoped, OAuth)
|
|
141
|
+
|
|
142
|
+
Same URL everywhere. OAuth credentials are managed internally by each MCP
|
|
143
|
+
client or the native OS credential store; users never copy or configure them.
|
|
144
|
+
|
|
145
|
+
| Client | Project file (commit this) | Do **not** use (global) | Authenticate |
|
|
146
|
+
|---|---|---|---|
|
|
147
|
+
| **Cursor** | `.cursor/mcp.json` → `{ "mcpServers": { "wayform": { "url": "…" } } }` | `~/.cursor/mcp.json` | Connect |
|
|
148
|
+
| **Claude Code** | `.mcp.json` (same JSON), or `claude mcp add --transport http --scope project wayform <url>` | `--scope user` | `claude mcp login wayform` |
|
|
149
|
+
| **Codex** | `.codex/config.toml` → `url` + `auth = "oauth"` | `~/.codex/config.toml` | `codex mcp login wayform` |
|
|
150
|
+
| **Devin CLI** | `.devin/mcp_config.json` → `{ "url": "…", "transport": "http" }` | `--scope user` / `~/.config/devin/mcp_config.json` | `devin mcp login wayform` |
|
|
151
|
+
| **Antigravity** | `.agents/mcp_config.json` → `{ "serverUrl": "…" }` | `~/.gemini/config/mcp_config.json` | Authenticate in MCP settings (DCR) |
|
|
152
|
+
|
|
153
|
+
`wayform init --remote --clients cursor,claude` writes **only** those
|
|
154
|
+
clients' files. With `--yes` and no `--clients`, it updates folders
|
|
155
|
+
already in the repo and does not create the rest. `wayform doctor` says
|
|
156
|
+
"run wayform login" when the hook session is missing — never "paste a token".
|
|
157
|
+
|
|
158
|
+
Do **not** add Wayform as a Devin Cloud **organization-wide** MCP if you only
|
|
159
|
+
want it in this repo — that surface is shared across the org, not one folder.
|
|
160
|
+
|
|
161
|
+
Endpoints, allowlist, and the deploy runbook live in
|
|
162
|
+
[gateway/README.md](gateway/README.md).
|
|
129
163
|
|
|
130
164
|
---
|
|
131
165
|
|
|
@@ -170,8 +204,9 @@ coding session. (The flip side: failures are quiet — that's what `doctor` is
|
|
|
170
204
|
for.)
|
|
171
205
|
|
|
172
206
|
**Claude Desktop** has no hook system, so it's MCP-pull-only: register
|
|
173
|
-
`
|
|
174
|
-
reads when the model chooses to — path 1 is your write path
|
|
207
|
+
`wayform` as a stdio server (or point Desktop at the hosted gateway URL and
|
|
208
|
+
Connect) and it reads when the model chooses to — path 1 is your write path
|
|
209
|
+
there.
|
|
175
210
|
|
|
176
211
|
## Configuration (`.memorylayer-hook.env`)
|
|
177
212
|
|
|
@@ -181,18 +216,22 @@ into hook subprocesses:
|
|
|
181
216
|
|
|
182
217
|
| Var | Required | Meaning |
|
|
183
218
|
|-----|----------|---------|
|
|
184
|
-
| `CONTEXT_REPO_URL` |
|
|
185
|
-
| `
|
|
186
|
-
| `
|
|
219
|
+
| `CONTEXT_REPO_URL` | local mode | Shared context repo URL (may embed a git token). |
|
|
220
|
+
| `MEMORYLAYER_GATEWAY_URL` | hosted mode | Gateway base URL. Presence selects hosted (no clone). |
|
|
221
|
+
| `MEMORYLAYER_AUTHOR` | local mode | Your name — local commit author / attribution. Hosted attribution comes from GitHub OAuth. |
|
|
222
|
+
| `MEMORYLAYER_AUTHOR_EMAIL` | no | Local commit email. Defaults from author name. |
|
|
187
223
|
| `MEMORYLAYER_PROJECT` | no | Project/space name. Default: repo directory name. |
|
|
188
224
|
| `CONTEXT_REPO_PATH` | no | Local clone path. Default: keyed per repo URL under `$XDG_DATA_HOME/memorylayer/clones/<repo-slug>-<hash>` (falls back to `~/.local/share/...`), so two spaces can never share a clone. |
|
|
189
225
|
| `MEMORYLAYER_READ_BUDGET_TOKENS` | no | Read token budget. Default 4000; `<=0` = unlimited. |
|
|
190
226
|
| `MEMORYLAYER_AUTO_PUSH` | no | `false` to skip pushing (local smoke tests). |
|
|
191
227
|
|
|
228
|
+
Hosted hook env contains only project settings and the gateway URL. The OAuth
|
|
229
|
+
session is held by the native OS credential store after `wayform login`.
|
|
230
|
+
|
|
192
231
|
## Diagnostics
|
|
193
232
|
|
|
194
233
|
```bash
|
|
195
|
-
|
|
234
|
+
wayform doctor
|
|
196
235
|
```
|
|
197
236
|
|
|
198
237
|
Read-only. Checks the env file, resolved config, clone health and origin,
|
|
@@ -208,9 +247,11 @@ write "silently" does nothing — fail-open means problems hide here first.
|
|
|
208
247
|
`context/`; error output redacts embedded tokens.
|
|
209
248
|
- **Hosted mode:** the gateway is a stateless proxy — the source of truth stays
|
|
210
249
|
a private GitHub repo in *your* account. The App holds Contents-only
|
|
211
|
-
permission on exactly one repo per space;
|
|
212
|
-
|
|
213
|
-
store, never in code or git.
|
|
250
|
+
permission on exactly one repo per space; members are keyed by GitHub user
|
|
251
|
+
id after OAuth. The Worker holds operator secrets in Cloudflare's secret
|
|
252
|
+
store, never in code or git. Members never see a Wayform API key. For now,
|
|
253
|
+
one GitHub user can belong to one Wayform space; multi-space membership is a
|
|
254
|
+
deferred product decision.
|
|
214
255
|
- **Trust boundary to know about:** everything a space member writes is
|
|
215
256
|
injected into every member's sessions. You trust the people in your space —
|
|
216
257
|
that's the model, stated plainly.
|
|
@@ -219,24 +260,19 @@ write "silently" does nothing — fail-open means problems hide here first.
|
|
|
219
260
|
|
|
220
261
|
| Symptom | Cause & fix |
|
|
221
262
|
|---|---|
|
|
222
|
-
| `
|
|
263
|
+
| `wayform: command not found` right after `npm install -g github:...` | npm 10 git-global-install bug: the global bin points at an ephemeral cache clone with no files. Fix: the clone-then-install path from the Quickstart, or `npm pack` + `npm install -g ./wayform-*.tgz`. |
|
|
223
264
|
| `ENOTDIR` reinstalling over a previous failed install | Same bug, stale symlink. Remove the target dir shown in the error, then clone-then-install. |
|
|
224
|
-
| Reads/writes silently do nothing | `
|
|
265
|
+
| Reads/writes silently do nothing | `wayform doctor`. Hosted: usually `wayform login`. Local: missing `.memorylayer-hook.env`, no repo access, or unpushed local commits (self-heals on next read). |
|
|
225
266
|
| Teammates still see old behavior after an upgrade | The fix lives in the **global binary** — each teammate must reinstall it (committed project configs aren't enough), and a running MCP server needs a restart to pick it up. |
|
|
226
267
|
| macOS `curl` fails TLS against the hosted gateway (`workers.dev`) | LibreSSL negotiation quirk — add `--tlsv1.2`. Client-side only; SDK-based MCP clients are unaffected. |
|
|
227
268
|
|
|
228
269
|
## Project status
|
|
229
270
|
|
|
230
|
-
Working and in daily two-person dogfood
|
|
231
|
-
|
|
232
|
-
byte-intact by the local tool). Currently running a multi-week reliance pilot —
|
|
233
|
-
the success signal is a collaborator who **stops re-explaining decisions**
|
|
234
|
-
because they trust the shared space.
|
|
271
|
+
Working and in daily two-person dogfood on GitHub OAuth (no member API keys).
|
|
272
|
+
Hosted onboarding is Connect + GitHub App install on your private memory repo.
|
|
235
273
|
|
|
236
|
-
**Deliberately not built yet
|
|
237
|
-
|
|
238
|
-
engine (git *is* the merge engine). Next increments: gateway client shims
|
|
239
|
-
(`init --remote`), space-provisioning CLI.
|
|
274
|
+
**Deliberately not built yet:** Stripe/paid plans, per-space extract caps,
|
|
275
|
+
dashboard UI, custom merge engine (git *is* the merge engine).
|
|
240
276
|
|
|
241
277
|
## Repo layout
|
|
242
278
|
|
|
@@ -254,7 +290,7 @@ test/ node:test suites (gateway has its own under gateway/test/)
|
|
|
254
290
|
```bash
|
|
255
291
|
npm test # build + full local suite, lint: npm run lint
|
|
256
292
|
npm run test:gateway # gateway suite (Node >= 20)
|
|
257
|
-
|
|
293
|
+
wayform --help # subcommands: init, login, hook, doctor, space
|
|
258
294
|
```
|
|
259
295
|
|
|
260
296
|
Both planes share the entry format modules (`src/frontmatter.ts`,
|
package/dist/cli.js
CHANGED
|
@@ -5,21 +5,25 @@
|
|
|
5
5
|
*
|
|
6
6
|
* wayform -> MCP server (default)
|
|
7
7
|
* wayform hook <client> -> read hook
|
|
8
|
-
* wayform
|
|
8
|
+
* wayform prompt-hook <client> -> Claude UserPromptSubmit → /hook/prompt
|
|
9
|
+
* wayform stop-review <client> -> Stop no-op (legacy; re-engagement removed)
|
|
10
|
+
* wayform login -> GitHub OAuth; tokens go to the OS keychain
|
|
9
11
|
* wayform init [flags] -> installer (add --remote for hosted members)
|
|
10
12
|
* wayform doctor -> local diagnostics
|
|
11
|
-
* wayform space create [flags] ->
|
|
13
|
+
* wayform space create [flags] -> print App install URL + allowlist reminder
|
|
12
14
|
*
|
|
13
|
-
* `hook`/`stop-review` set MEMORYLAYER_HOOK_CLIENT from the positional arg, then
|
|
15
|
+
* `hook`/`prompt-hook`/`stop-review` set MEMORYLAYER_HOOK_CLIENT from the positional arg, then
|
|
14
16
|
* delegate to the neutral run functions (which self-load .memorylayer-hook.env).
|
|
15
17
|
*/
|
|
16
18
|
import { loadHookEnv } from "./config.js";
|
|
17
19
|
import { runServer } from "./index.js";
|
|
18
20
|
import { runHook } from "./hook.js";
|
|
21
|
+
import { runPromptHook } from "./prompt-hook.js";
|
|
19
22
|
import { runStopHook } from "./stop-hook.js";
|
|
20
23
|
import { runInit } from "./init.js";
|
|
21
24
|
import { runDoctor } from "./doctor.js";
|
|
22
25
|
import { runSpaceCreate } from "./space-create.js";
|
|
26
|
+
import { runLogin } from "./oauth-login.js";
|
|
23
27
|
async function main() {
|
|
24
28
|
// Self-load .memorylayer-hook.env from the project cwd for every subcommand,
|
|
25
29
|
// so the command is self-contained (no bash launcher). loadConfig stays pure.
|
|
@@ -31,6 +35,11 @@ async function main() {
|
|
|
31
35
|
process.env.MEMORYLAYER_HOOK_CLIENT = rest[0];
|
|
32
36
|
await runHook();
|
|
33
37
|
return;
|
|
38
|
+
case "prompt-hook":
|
|
39
|
+
if (rest[0])
|
|
40
|
+
process.env.MEMORYLAYER_HOOK_CLIENT = rest[0];
|
|
41
|
+
await runPromptHook();
|
|
42
|
+
return;
|
|
34
43
|
case "stop-review":
|
|
35
44
|
if (rest[0])
|
|
36
45
|
process.env.MEMORYLAYER_HOOK_CLIENT = rest[0];
|
|
@@ -42,19 +51,22 @@ async function main() {
|
|
|
42
51
|
case "doctor":
|
|
43
52
|
await runDoctor();
|
|
44
53
|
return;
|
|
54
|
+
case "login":
|
|
55
|
+
await runLogin(rest);
|
|
56
|
+
return;
|
|
45
57
|
case "space":
|
|
46
58
|
if (rest[0] === "create") {
|
|
47
59
|
await runSpaceCreate(rest.slice(1));
|
|
48
60
|
return;
|
|
49
61
|
}
|
|
50
|
-
console.error(`Unknown "space" subcommand "${rest[0]}". Use: wayform space create --
|
|
62
|
+
console.error(`Unknown "space" subcommand "${rest[0]}". Use: wayform space create --owner <github-login>`);
|
|
51
63
|
process.exit(1);
|
|
52
64
|
return;
|
|
53
65
|
case undefined:
|
|
54
66
|
await runServer();
|
|
55
67
|
return;
|
|
56
68
|
default:
|
|
57
|
-
console.error(`Unknown command "${sub}". Use: wayform [hook|stop-review|init|doctor|space] …`);
|
|
69
|
+
console.error(`Unknown command "${sub}". Use: wayform [hook|prompt-hook|stop-review|init|doctor|login|space] …`);
|
|
58
70
|
process.exit(1);
|
|
59
71
|
}
|
|
60
72
|
}
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,KAAK,UAAU,IAAI;IACjB,6EAA6E;IAC7E,8EAA8E;IAC9E,WAAW,EAAE,CAAC;IAEd,MAAM,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAE7C,QAAQ,GAAG,EAAE,CAAC;QACZ,KAAK,MAAM;YACT,IAAI,IAAI,CAAC,CAAC,CAAC;gBAAE,OAAO,CAAC,GAAG,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YAC3D,MAAM,OAAO,EAAE,CAAC;YAChB,OAAO;QACT,KAAK,aAAa;YAChB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AChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/config.js
CHANGED
|
@@ -29,7 +29,6 @@ const HOOK_ENV_ALLOWLIST = new Set([
|
|
|
29
29
|
"MEMORYLAYER_HOOK_CLIENT",
|
|
30
30
|
"MEMORYLAYER_READ_BUDGET_TOKENS",
|
|
31
31
|
"MEMORYLAYER_GATEWAY_URL",
|
|
32
|
-
"MEMORYLAYER_GATEWAY_TOKEN",
|
|
33
32
|
]);
|
|
34
33
|
/**
|
|
35
34
|
* Load `.memorylayer-hook.env` (KEY=VALUE lines) from `cwd` into process.env,
|
|
@@ -137,11 +136,9 @@ export function defaultProject(cwd = process.cwd()) {
|
|
|
137
136
|
return path.basename(cwd) || "unknown";
|
|
138
137
|
}
|
|
139
138
|
export function loadConfig() {
|
|
140
|
-
const author = required("MEMORYLAYER_AUTHOR");
|
|
141
139
|
const gatewayUrl = process.env.MEMORYLAYER_GATEWAY_URL?.trim().replace(/\/+$/, "") ||
|
|
142
140
|
undefined;
|
|
143
|
-
const
|
|
144
|
-
const hasGateway = Boolean(gatewayUrl && gatewayToken);
|
|
141
|
+
const hasGateway = Boolean(gatewayUrl);
|
|
145
142
|
// Gateway-only members have no local clone. CONTEXT_REPO_URL is optional when a
|
|
146
143
|
// gateway is configured; without a gateway it stays required (local-only mode).
|
|
147
144
|
// We use "" as a clear "no clone" sentinel rather than making repoUrl/repoPath
|
|
@@ -155,6 +152,8 @@ export function loadConfig() {
|
|
|
155
152
|
? process.env.CONTEXT_REPO_PATH?.trim() ||
|
|
156
153
|
path.join(dataHome(), "clones", cloneKey(repoUrl))
|
|
157
154
|
: "";
|
|
155
|
+
const author = process.env.MEMORYLAYER_AUTHOR?.trim() ||
|
|
156
|
+
(repoUrl ? required("MEMORYLAYER_AUTHOR") : "GitHub");
|
|
158
157
|
const rawBudget = Number(process.env.MEMORYLAYER_READ_BUDGET_TOKENS);
|
|
159
158
|
const readBudgetTokens = Number.isFinite(rawBudget) && rawBudget > 0
|
|
160
159
|
? rawBudget
|
|
@@ -164,11 +163,12 @@ export function loadConfig() {
|
|
|
164
163
|
repoPath,
|
|
165
164
|
author,
|
|
166
165
|
authorEmail: process.env.MEMORYLAYER_AUTHOR_EMAIL?.trim() ||
|
|
167
|
-
|
|
166
|
+
(repoUrl
|
|
167
|
+
? `${author.replace(/\s+/g, ".").toLowerCase()}@memorylayer.local`
|
|
168
|
+
: "github@users.noreply.github.com"),
|
|
168
169
|
autoPush: (process.env.MEMORYLAYER_AUTO_PUSH?.trim() || "true") !== "false",
|
|
169
170
|
readBudgetTokens,
|
|
170
171
|
gatewayUrl,
|
|
171
|
-
gatewayToken,
|
|
172
172
|
};
|
|
173
173
|
}
|
|
174
174
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AA0B1D,SAAS,QAAQ,CAAC,IAAY;IAC5B,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,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|
+
import { Entry } from "@napi-rs/keyring";
|
|
4
|
+
const SERVICE = "wayform-oauth";
|
|
5
|
+
const BACKEND_ERROR = "Wayform could not access this operating system's credential store. " +
|
|
6
|
+
"Configure Keychain, Secret Service, or Credential Manager and run `wayform login` again.";
|
|
7
|
+
function readFile(file) {
|
|
8
|
+
try {
|
|
9
|
+
return JSON.parse(fs.readFileSync(file, "utf8"));
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function writeFile(file, values) {
|
|
16
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
17
|
+
fs.writeFileSync(file, JSON.stringify(values), { mode: 0o600 });
|
|
18
|
+
try {
|
|
19
|
+
fs.chmodSync(file, 0o600);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
// Windows does not expose POSIX permission bits.
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function testFileCredentialStore(file) {
|
|
26
|
+
return {
|
|
27
|
+
get(account) {
|
|
28
|
+
return readFile(file)[account] ?? null;
|
|
29
|
+
},
|
|
30
|
+
set(account, secret) {
|
|
31
|
+
const values = readFile(file);
|
|
32
|
+
values[account] = secret;
|
|
33
|
+
writeFile(file, values);
|
|
34
|
+
},
|
|
35
|
+
delete(account) {
|
|
36
|
+
const values = readFile(file);
|
|
37
|
+
delete values[account];
|
|
38
|
+
writeFile(file, values);
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function credentialError(error) {
|
|
43
|
+
return new Error(BACKEND_ERROR, { cause: error });
|
|
44
|
+
}
|
|
45
|
+
export function createCredentialStore(env = process.env, entryFactory = (service, account) => new Entry(service, account)) {
|
|
46
|
+
const testFile = env.WAYFORM_KEYCHAIN_FILE?.trim();
|
|
47
|
+
if (env.NODE_ENV === "test" && testFile) {
|
|
48
|
+
return testFileCredentialStore(testFile);
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
get(account) {
|
|
52
|
+
try {
|
|
53
|
+
return entryFactory(SERVICE, account).getPassword();
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
throw credentialError(error);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
set(account, secret) {
|
|
60
|
+
try {
|
|
61
|
+
entryFactory(SERVICE, account).setPassword(secret);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
throw credentialError(error);
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
delete(account) {
|
|
68
|
+
try {
|
|
69
|
+
entryFactory(SERVICE, account).deletePassword();
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
throw credentialError(error);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=credential-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-store.js","sourceRoot":"","sources":["../src/credential-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,MAAM,OAAO,GAAG,eAAe,CAAC;AAChC,MAAM,aAAa,GACjB,qEAAqE;IACrE,0FAA0F,CAAC;AAgB7F,SAAS,QAAQ,CAAC,IAAY;IAC5B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAA2B,CAAC;IAC7E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED,SAAS,SAAS,CAAC,IAAY,EAAE,MAA8B;IAC7D,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE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AM,IAAI,QAAQ,EAAE,CAAC;QACxC,OAAO,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO;QACL,GAAG,CAAC,OAAO;YACT,IAAI,CAAC;gBACH,OAAO,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;YACtD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,eAAe,CAAC,KAAK,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;QACD,GAAG,CAAC,OAAO,EAAE,MAAM;YACjB,IAAI,CAAC;gBACH,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YACrD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,eAAe,CAAC,KAAK,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;QACD,MAAM,CAAC,OAAO;YACZ,IAAI,CAAC;gBACH,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,cAAc,EAAE,CAAC;YAClD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,eAAe,CAAC,KAAK,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/doctor.js
CHANGED
|
@@ -2,15 +2,12 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { execFile } from "node:child_process";
|
|
4
4
|
import { promisify } from "node:util";
|
|
5
|
+
import { oauthFetch } from "./oauth-session.js";
|
|
5
6
|
import { defaultProject, loadConfig, normalizeRepoUrl, } from "./config.js";
|
|
6
7
|
const execFileAsync = promisify(execFile);
|
|
7
8
|
const GATEWAY_PROBE_TIMEOUT_MS = 4000;
|
|
8
|
-
/** Files
|
|
9
|
-
const SECRET_FILES = [
|
|
10
|
-
".memorylayer-hook.env",
|
|
11
|
-
".cursor/mcp.json",
|
|
12
|
-
".codex/config.toml",
|
|
13
|
-
];
|
|
9
|
+
/** Files that used to carry a member credential. Hook env is URL-only now. */
|
|
10
|
+
const SECRET_FILES = [".memorylayer-hook.env"];
|
|
14
11
|
export async function runDoctor(options = {}) {
|
|
15
12
|
const cwd = options.cwd ?? process.cwd();
|
|
16
13
|
const setExitCode = options.setExitCode ?? true;
|
|
@@ -42,8 +39,8 @@ export async function runDoctor(options = {}) {
|
|
|
42
39
|
// Hosted (gateway) members have repoUrl="" — the git checks would run
|
|
43
40
|
// against an empty URL and fail a perfectly healthy setup. Probe the
|
|
44
41
|
// gateway instead; run the git checks only when a clone is configured.
|
|
45
|
-
if (cfg.gatewayUrl
|
|
46
|
-
results.push(await checkGateway(cfg, cwd, options.fetchImpl ?? fetch));
|
|
42
|
+
if (cfg.gatewayUrl) {
|
|
43
|
+
results.push(await checkGateway(cfg, cwd, options.fetchImpl ?? fetch, options.credentialStore));
|
|
47
44
|
}
|
|
48
45
|
if (cfg.repoUrl) {
|
|
49
46
|
results.push(await checkClone(cfg, gitRunner));
|
|
@@ -76,9 +73,9 @@ export function checkEnvFile(cwd, env) {
|
|
|
76
73
|
const has = (key) => keys.has(key) || Boolean(env[key]?.trim());
|
|
77
74
|
// Hosted members get a gateway-only env (init --remote writes no
|
|
78
75
|
// CONTEXT_REPO_URL); local members need the repo URL instead.
|
|
79
|
-
const hosted = has("MEMORYLAYER_GATEWAY_URL")
|
|
76
|
+
const hosted = has("MEMORYLAYER_GATEWAY_URL");
|
|
80
77
|
const required = hosted
|
|
81
|
-
? ["MEMORYLAYER_GATEWAY_URL"
|
|
78
|
+
? ["MEMORYLAYER_GATEWAY_URL"]
|
|
82
79
|
: ["CONTEXT_REPO_URL", "MEMORYLAYER_AUTHOR"];
|
|
83
80
|
const missing = required.filter((key) => !has(key));
|
|
84
81
|
if (missing.length > 0) {
|
|
@@ -124,31 +121,34 @@ export function checkSecretPerms(cwd) {
|
|
|
124
121
|
];
|
|
125
122
|
}
|
|
126
123
|
/**
|
|
127
|
-
* One authed GET /hook/read proves reachability AND that the
|
|
128
|
-
* accepted — the same call the session hook makes
|
|
129
|
-
*
|
|
124
|
+
* One authed GET /hook/read proves reachability AND that the OAuth session is
|
|
125
|
+
* accepted — the same call the session hook makes. Missing/expired session
|
|
126
|
+
* tells the user to run `wayform login`, never to paste a token.
|
|
130
127
|
*/
|
|
131
|
-
export async function checkGateway(cfg, cwd, fetchImpl) {
|
|
132
|
-
|
|
128
|
+
export async function checkGateway(cfg, cwd, fetchImpl, credentialStore) {
|
|
129
|
+
if (!cfg.gatewayUrl)
|
|
130
|
+
return {
|
|
131
|
+
status: "fail",
|
|
132
|
+
name: "gateway",
|
|
133
|
+
message: "gateway URL is not configured",
|
|
134
|
+
};
|
|
135
|
+
const url = new URL(`${cfg.gatewayUrl}/mcp/hook/read`);
|
|
133
136
|
url.searchParams.set("project", defaultProject(cwd));
|
|
134
137
|
url.searchParams.set("budget", "1");
|
|
135
138
|
try {
|
|
136
|
-
const res = await
|
|
137
|
-
headers: { authorization: `Bearer ${cfg.gatewayToken}` },
|
|
138
|
-
signal: AbortSignal.timeout(GATEWAY_PROBE_TIMEOUT_MS),
|
|
139
|
-
});
|
|
139
|
+
const res = await oauthFetch(cfg.gatewayUrl, url.toString(), { signal: AbortSignal.timeout(GATEWAY_PROBE_TIMEOUT_MS) }, { fetchImpl, store: credentialStore });
|
|
140
140
|
if (res.ok) {
|
|
141
141
|
return {
|
|
142
142
|
status: "ok",
|
|
143
143
|
name: "gateway",
|
|
144
|
-
message: `reachable
|
|
144
|
+
message: `reachable (${cfg.gatewayUrl})`,
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
147
|
if (res.status === 401 || res.status === 403) {
|
|
148
148
|
return {
|
|
149
149
|
status: "fail",
|
|
150
150
|
name: "gateway",
|
|
151
|
-
message: "
|
|
151
|
+
message: "logged-out or expired — run: wayform login",
|
|
152
152
|
};
|
|
153
153
|
}
|
|
154
154
|
return {
|
|
@@ -158,10 +158,18 @@ export async function checkGateway(cfg, cwd, fetchImpl) {
|
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
160
|
catch (err) {
|
|
161
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
162
|
+
if (/run: wayform login/i.test(message)) {
|
|
163
|
+
return {
|
|
164
|
+
status: "fail",
|
|
165
|
+
name: "gateway",
|
|
166
|
+
message: "not logged in — run: wayform login",
|
|
167
|
+
};
|
|
168
|
+
}
|
|
161
169
|
return {
|
|
162
170
|
status: "fail",
|
|
163
171
|
name: "gateway",
|
|
164
|
-
message: `unreachable: ${redactSecrets(
|
|
172
|
+
message: `unreachable: ${redactSecrets(message)}`,
|
|
165
173
|
};
|
|
166
174
|
}
|
|
167
175
|
}
|
package/dist/doctor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"doctor.js","sourceRoot":"","sources":["../src/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EACL,cAAc,EACd,UAAU,EACV,gBAAgB,GAEjB,MAAM,aAAa,CAAC;AAErB,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAC1C,MAAM,wBAAwB,GAAG,IAAI,CAAC;AACtC,8EAA8E;AAC9E,MAAM,YAAY,GAAG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