@cr8rcho/alkahest 0.1.110 → 0.1.112
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.ko.md +16 -8
- package/README.md +19 -10
- package/dist/cli.js +22 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/comments.js +1 -1
- package/dist/commands/comments.js.map +1 -1
- package/dist/commands/history.js +1 -1
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/issues.js +1 -1
- package/dist/commands/issues.js.map +1 -1
- package/dist/commands/maps.js +1 -1
- package/dist/commands/maps.js.map +1 -1
- package/dist/commands/notes.js +1 -1
- package/dist/commands/notes.js.map +1 -1
- package/dist/commands/presets.js +1 -1
- package/dist/commands/presets.js.map +1 -1
- package/dist/commands/setup.d.ts +22 -0
- package/dist/commands/setup.js +186 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/status.js +18 -2
- package/dist/commands/status.js.map +1 -1
- package/dist/core/link.d.ts +78 -0
- package/dist/core/link.js +171 -0
- package/dist/core/link.js.map +1 -0
- package/dist/core/project.d.ts +3 -0
- package/dist/core/project.js +9 -7
- package/dist/core/project.js.map +1 -1
- package/dist/core/status.d.ts +7 -0
- package/dist/core/status.js +5 -3
- package/dist/core/status.js.map +1 -1
- package/dist/mcp/server.js +18 -18
- package/dist/mcp/server.js.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { accessSync, constants, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { homedir, tmpdir } from "node:os";
|
|
4
|
+
import { delimiter, dirname, join, resolve } from "node:path";
|
|
5
|
+
import { loadCredentials, saveCredentials } from "./credentials.js";
|
|
6
|
+
import { OUTPUT_DIR } from "./emit.js";
|
|
7
|
+
import { findProjectRoot, localMapSlug, localSlug } from "./project.js";
|
|
8
|
+
/**
|
|
9
|
+
* Bind a folder to a project WITHOUT publishing — the piece `publish` used to be the only
|
|
10
|
+
* writer of (`.alkahest/project.json`). Backs `alkahest link` / `alkahest setup`.
|
|
11
|
+
*
|
|
12
|
+
* Why it exists: a repo with no code map (or one not published yet) had no way to remember its
|
|
13
|
+
* project, so people copied `.mcp.json` between repos and hand-edited `ALKAHEST_PROJECT` into its
|
|
14
|
+
* env. With the binding in the checkout, one user-scope MCP registration (`claude mcp add -s user`)
|
|
15
|
+
* serves every repo: the server resolves the project from its cwd (`resolveProject`).
|
|
16
|
+
*
|
|
17
|
+
* Like the other core modules this never writes to stdout/stderr.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* The folder a link belongs to: an existing project root (walk-up for `.alkahest/`), else the git
|
|
21
|
+
* top-level (walk-up for `.git`), else the path itself. Linking from a subdirectory of a fresh repo
|
|
22
|
+
* should bind the repo, not the subdirectory.
|
|
23
|
+
*/
|
|
24
|
+
export function linkRoot(path) {
|
|
25
|
+
const start = resolve(path || ".");
|
|
26
|
+
const projectRoot = findProjectRoot(start);
|
|
27
|
+
// Same markers as project.ts — a bare `.alkahest/` may be the HOME config dir, not a project.
|
|
28
|
+
if (["map.json", "project.json", "comments.json"].some((f) => existsSync(join(projectRoot, OUTPUT_DIR, f)))) {
|
|
29
|
+
return projectRoot;
|
|
30
|
+
}
|
|
31
|
+
// Stop at $HOME: a dotfiles repo there must not swallow every non-git folder under it.
|
|
32
|
+
const home = homedir();
|
|
33
|
+
let dir = start;
|
|
34
|
+
for (;;) {
|
|
35
|
+
if (dir === home)
|
|
36
|
+
return start;
|
|
37
|
+
if (existsSync(join(dir, ".git")))
|
|
38
|
+
return dir;
|
|
39
|
+
const parent = dirname(dir);
|
|
40
|
+
if (parent === dir)
|
|
41
|
+
return start;
|
|
42
|
+
dir = parent;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// ── matching what the user typed to a reachable project ─────────────────────────────────────────
|
|
46
|
+
const slugify = (s) => String(s).toLowerCase().trim().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
47
|
+
const stripDna = (slug) => slug.replace(/-[0-9a-f]{6}$/i, "");
|
|
48
|
+
/**
|
|
49
|
+
* Exact slug first; otherwise a project whose name or dna-less slug equals the input
|
|
50
|
+
* ("hooves" → hooves-bd129a), but only when exactly one does.
|
|
51
|
+
*/
|
|
52
|
+
export function matchProject(input, projects) {
|
|
53
|
+
const want = input.trim();
|
|
54
|
+
const exact = projects.find((p) => p.slug === want);
|
|
55
|
+
if (exact)
|
|
56
|
+
return { project: exact, exact: true, candidates: [] };
|
|
57
|
+
const base = slugify(want);
|
|
58
|
+
if (!base)
|
|
59
|
+
return { exact: false, candidates: [] };
|
|
60
|
+
const hits = projects.filter((p) => stripDna(p.slug) === base || slugify(p.name ?? "") === base);
|
|
61
|
+
if (hits.length === 1)
|
|
62
|
+
return { project: hits[0], exact: false, candidates: [] };
|
|
63
|
+
return { exact: false, candidates: hits };
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Write `.alkahest/project.json` (and the path-keyed creds entry, as publish does). A re-link to
|
|
67
|
+
* the same project keeps the remembered code map; a link to a different project drops it — that
|
|
68
|
+
* map belongs to the old project.
|
|
69
|
+
*/
|
|
70
|
+
export function writeLink(root, slug) {
|
|
71
|
+
const file = join(root, OUTPUT_DIR, "project.json");
|
|
72
|
+
const previous = localSlug(root);
|
|
73
|
+
const mapSlug = previous === slug ? localMapSlug(root) : undefined;
|
|
74
|
+
const entry = { slug, ...(mapSlug ? { mapSlug } : {}) };
|
|
75
|
+
const changed = previous !== slug;
|
|
76
|
+
if (changed || !existsSync(file)) {
|
|
77
|
+
mkdirSync(join(root, OUTPUT_DIR), { recursive: true });
|
|
78
|
+
writeFileSync(file, JSON.stringify(entry, null, 2) + "\n");
|
|
79
|
+
}
|
|
80
|
+
const creds = loadCredentials();
|
|
81
|
+
const prior = creds.projects?.[root];
|
|
82
|
+
if (!prior || prior.slug !== entry.slug || prior.mapSlug !== entry.mapSlug) {
|
|
83
|
+
creds.projects = { ...(creds.projects ?? {}), [root]: entry };
|
|
84
|
+
saveCredentials(creds);
|
|
85
|
+
}
|
|
86
|
+
return { previous, changed, file };
|
|
87
|
+
}
|
|
88
|
+
/** The `alkahest` entry of `<root>/.mcp.json`, if there is one. */
|
|
89
|
+
export function readMcpJson(root) {
|
|
90
|
+
const file = join(root, ".mcp.json");
|
|
91
|
+
try {
|
|
92
|
+
const json = JSON.parse(readFileSync(file, "utf8"));
|
|
93
|
+
const entry = json?.mcpServers?.alkahest;
|
|
94
|
+
if (!entry)
|
|
95
|
+
return null;
|
|
96
|
+
const env = entry.env && typeof entry.env === "object" ? entry.env : {};
|
|
97
|
+
return { file, env };
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Env keys in that entry that no longer do anything:
|
|
105
|
+
* - ALKAHEST_TOKEN when a login is saved (resolveToken: saved login wins over the env);
|
|
106
|
+
* - ALKAHEST_PROJECT when the folder has its own binding (resolveProject: project.json wins).
|
|
107
|
+
*/
|
|
108
|
+
export function shadowedMcpEnv(root) {
|
|
109
|
+
const entry = readMcpJson(root);
|
|
110
|
+
if (!entry)
|
|
111
|
+
return [];
|
|
112
|
+
const out = [];
|
|
113
|
+
if (entry.env.ALKAHEST_TOKEN && loadCredentials().token)
|
|
114
|
+
out.push("ALKAHEST_TOKEN");
|
|
115
|
+
if (entry.env.ALKAHEST_PROJECT && localSlug(root))
|
|
116
|
+
out.push("ALKAHEST_PROJECT");
|
|
117
|
+
return out;
|
|
118
|
+
}
|
|
119
|
+
/** Remove `keys` from the alkahest entry's env (drops an emptied env). Rewrites the file as 2-space JSON. */
|
|
120
|
+
export function removeMcpEnv(root, keys) {
|
|
121
|
+
const file = join(root, ".mcp.json");
|
|
122
|
+
const json = JSON.parse(readFileSync(file, "utf8"));
|
|
123
|
+
const entry = json?.mcpServers?.alkahest;
|
|
124
|
+
if (!entry?.env)
|
|
125
|
+
return [];
|
|
126
|
+
const removed = keys.filter((k) => k in entry.env);
|
|
127
|
+
for (const k of removed)
|
|
128
|
+
delete entry.env[k];
|
|
129
|
+
if (Object.keys(entry.env).length === 0)
|
|
130
|
+
delete entry.env;
|
|
131
|
+
if (removed.length)
|
|
132
|
+
writeFileSync(file, JSON.stringify(json, null, 2) + "\n");
|
|
133
|
+
return removed;
|
|
134
|
+
}
|
|
135
|
+
// ── Claude Code user-scope registration ─────────────────────────────────────────────────────────
|
|
136
|
+
/** Is an executable named `cmd` on PATH? (No spawn — `alkahest --version` would recurse into us.) */
|
|
137
|
+
export function onPath(cmd) {
|
|
138
|
+
const exts = process.platform === "win32" ? (process.env.PATHEXT ?? ".EXE;.CMD").split(";") : [""];
|
|
139
|
+
for (const dir of (process.env.PATH ?? "").split(delimiter)) {
|
|
140
|
+
if (!dir)
|
|
141
|
+
continue;
|
|
142
|
+
for (const ext of exts) {
|
|
143
|
+
try {
|
|
144
|
+
accessSync(join(dir, cmd + ext), constants.X_OK);
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
catch { /* keep looking */ }
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Ask Claude Code itself. Run from the temp dir so a project-scope `.mcp.json` in the caller's
|
|
154
|
+
* folder can't answer for the user scope — that one only covers this repo, not the next.
|
|
155
|
+
*/
|
|
156
|
+
export function userMcpState() {
|
|
157
|
+
if (!onPath("claude"))
|
|
158
|
+
return "no_claude";
|
|
159
|
+
const res = spawnSync("claude", ["mcp", "get", "alkahest"], { cwd: tmpdir(), encoding: "utf8", timeout: 20_000 });
|
|
160
|
+
const out = `${res.stdout ?? ""}${res.stderr ?? ""}`;
|
|
161
|
+
return /Scope:\s*User/i.test(out) ? "registered" : "absent";
|
|
162
|
+
}
|
|
163
|
+
/** `claude mcp add -s user alkahest -- alkahest mcp` — no token, no project: both resolve per folder. */
|
|
164
|
+
export function registerUserMcp() {
|
|
165
|
+
const res = spawnSync("claude", ["mcp", "add", "-s", "user", "alkahest", "--", "alkahest", "mcp"], {
|
|
166
|
+
cwd: tmpdir(), encoding: "utf8", timeout: 20_000,
|
|
167
|
+
});
|
|
168
|
+
const message = `${res.stdout ?? ""}${res.stderr ?? ""}`.trim();
|
|
169
|
+
return { ok: res.status === 0, message };
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.js","sourceRoot":"","sources":["../../src/core/link.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACpG,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAExE;;;;;;;;;;GAUG;AAEH;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC;IACnC,MAAM,WAAW,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IAC3C,8FAA8F;IAC9F,IAAI,CAAC,UAAU,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE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I,EAAE,EAAE,CAAC;IACrD,OAAO,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC9D,CAAC;AAED,yGAAyG;AACzG,MAAM,UAAU,eAAe;IAC7B,MAAM,GAAG,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE;QACjG,GAAG,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;KACjD,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,GAAG,GAAG,CAAC,MAAM,IAAI,EAAE,GAAG,GAAG,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;IAChE,OAAO,EAAE,EAAE,EAAE,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,OAAO,EAAE,CAAC;AAC3C,CAAC"}
|
package/dist/core/project.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export declare function findProjectRoot(start: string): string;
|
|
|
4
4
|
export declare function localSlug(root: string): string | undefined;
|
|
5
5
|
/** Code map this checkout publishes to, stored alongside the slug in .alkahest/project.json. */
|
|
6
6
|
export declare function localMapSlug(root: string): string | undefined;
|
|
7
|
+
/** Where `resolveProject` found the slug — `status` says so, since an env slug is easy to forget. */
|
|
8
|
+
export type SlugSource = "explicit" | "checkout" | "credentials" | "env";
|
|
7
9
|
/**
|
|
8
10
|
* Resolve { root, slug, mapSlug } from any path:
|
|
9
11
|
* explicit → local file → saved creds (by root/path) → ALKAHEST_PROJECT.
|
|
@@ -16,4 +18,5 @@ export declare function resolveProject(path: string, explicitSlug?: string): {
|
|
|
16
18
|
root: string;
|
|
17
19
|
slug?: string;
|
|
18
20
|
mapSlug?: string;
|
|
21
|
+
slugSource?: SlugSource;
|
|
19
22
|
};
|
package/dist/core/project.js
CHANGED
|
@@ -65,15 +65,17 @@ export function localMapSlug(root) {
|
|
|
65
65
|
export function resolveProject(path, explicitSlug) {
|
|
66
66
|
const root = findProjectRoot(path);
|
|
67
67
|
const creds = loadCredentials();
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
68
|
+
const local = localSlug(root);
|
|
69
|
+
const saved = creds.projects?.[root]?.slug || creds.projects?.[resolve(path || ".")]?.slug;
|
|
70
|
+
const env = process.env.ALKAHEST_PROJECT?.trim();
|
|
71
|
+
const [slug, slugSource] = explicitSlug ? [explicitSlug, "explicit"]
|
|
72
|
+
: local ? [local, "checkout"]
|
|
73
|
+
: saved ? [saved, "credentials"]
|
|
74
|
+
: env ? [env, "env"]
|
|
75
|
+
: [undefined, undefined];
|
|
74
76
|
const mapSlug = localMapSlug(root) ||
|
|
75
77
|
creds.projects?.[root]?.mapSlug ||
|
|
76
78
|
creds.projects?.[resolve(path || ".")]?.mapSlug;
|
|
77
|
-
return { root, slug, mapSlug };
|
|
79
|
+
return { root, slug, mapSlug, slugSource };
|
|
78
80
|
}
|
|
79
81
|
//# sourceMappingURL=project.js.map
|
package/dist/core/project.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/core/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;;;;;;GASG;AAEH,qFAAqF;AACrF,8FAA8F;AAC9F,qEAAqE;AACrE,MAAM,eAAe,GAAG,CAAC,UAAU,EAAE,cAAc,EAAE,eAAe,CAAC,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AAG,CAAC,CAAC,EAAE,IAAI,CAAC;IAC3F,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,IAAI,EAAE,CAAC;IACjD,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,GACtB,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,UAAU,CAAC;QACzC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,UAAU,CAAC;YAC7B,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,aAAa,CAAC;gBAChC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC;oBACpB,CAAC,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAC3B,MAAM,OAAO,GACX,YAAY,CAAC,IAAI,CAAC;QAClB,KAAK,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO;QAC/B,KAAK,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC;IAClD,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AAC7C,CAAC"}
|
package/dist/core/status.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type CodeMapFingerprint, type ProjectInfo, type WorkspaceInfo } from "./listProjects.js";
|
|
2
|
+
import { type SlugSource } from "./project.js";
|
|
2
3
|
/**
|
|
3
4
|
* "Where am I signed in, and where does this folder publish?" — the state behind
|
|
4
5
|
* `alkahest status` and behind a bare `alkahest login`.
|
|
@@ -60,6 +61,12 @@ export interface CheckoutStatus {
|
|
|
60
61
|
map?: CodeMapFingerprint;
|
|
61
62
|
/** Linked locally, but the account cannot see that project — moved, deleted, or another account's. */
|
|
62
63
|
unreachable: boolean;
|
|
64
|
+
/** Where the slug came from (project.json, the path-keyed creds, ALKAHEST_PROJECT). */
|
|
65
|
+
slugSource?: SlugSource;
|
|
66
|
+
/** `.mcp.json` env keys here that nothing reads any more (see core/link.ts shadowedMcpEnv). */
|
|
67
|
+
deadMcpEnv: string[];
|
|
68
|
+
/** ALKAHEST_PROJECT in this folder's `.mcp.json` — what `setup` with no argument would link. */
|
|
69
|
+
mcpProject?: string;
|
|
63
70
|
}
|
|
64
71
|
/** Join the local link (`.alkahest/project.json`) to what the account can actually see. */
|
|
65
72
|
export declare function checkoutStatus(path: string, auth: AuthStatus): CheckoutStatus;
|
package/dist/core/status.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_API_URL, loadCredentials, resolveApiUrl, resolveToken } from "./credentials.js";
|
|
2
2
|
import { listProjects } from "./listProjects.js";
|
|
3
|
+
import { readMcpJson, shadowedMcpEnv } from "./link.js";
|
|
3
4
|
import { resolveProject } from "./project.js";
|
|
4
5
|
/** alk_1234…cdef — enough to tell two tokens apart, not enough to use. */
|
|
5
6
|
function mask(token) {
|
|
@@ -36,15 +37,16 @@ export async function authStatus(params = {}) {
|
|
|
36
37
|
}
|
|
37
38
|
/** Join the local link (`.alkahest/project.json`) to what the account can actually see. */
|
|
38
39
|
export function checkoutStatus(path, auth) {
|
|
39
|
-
const { root, slug, mapSlug } = resolveProject(path);
|
|
40
|
+
const { root, slug, mapSlug, slugSource } = resolveProject(path);
|
|
41
|
+
const deadMcpEnv = shadowedMcpEnv(root);
|
|
40
42
|
if (!slug)
|
|
41
|
-
return { root, unreachable: false };
|
|
43
|
+
return { root, unreachable: false, deadMcpEnv, mcpProject: readMcpJson(root)?.env.ALKAHEST_PROJECT };
|
|
42
44
|
const project = auth.projects?.find((p) => p.slug === slug);
|
|
43
45
|
const map = project
|
|
44
46
|
? project.codeMaps.find((m) => m.mapSlug === mapSlug) ??
|
|
45
47
|
(mapSlug ? undefined : project.codeMaps[0])
|
|
46
48
|
: undefined;
|
|
47
49
|
// Only call it unreachable when we actually had a list to miss in.
|
|
48
|
-
return { root, slug, mapSlug, project, map, unreachable: Boolean(auth.projects && !project) };
|
|
50
|
+
return { root, slug, mapSlug, project, map, unreachable: Boolean(auth.projects && !project), slugSource, deadMcpEnv };
|
|
49
51
|
}
|
|
50
52
|
//# sourceMappingURL=status.js.map
|
package/dist/core/status.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/core/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjG,OAAO,EAAE,YAAY,EAAiE,MAAM,mBAAmB,CAAC;AAChH,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/core/status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjG,OAAO,EAAE,YAAY,EAAiE,MAAM,mBAAmB,CAAC;AAChH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,cAAc,EAAmB,MAAM,cAAc,CAAC;AA8C/D,0EAA0E;AAC1E,SAAS,IAAI,CAAC,KAAa;IACzB,OAAO,KAAK,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAClF,CAAC;AAED,MAAM,aAAa,GAA8B;IAC/C,QAAQ,EAAE,WAAW;IACrB,eAAe,EAAE,WAAW;IAC5B,aAAa,EAAE,SAAS;IACxB,aAAa,EAAE,SAAS;IACxB,kBAAkB,EAAE,QAAQ;IAC5B,OAAO,EAAE,a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|
|
176
176
|
no_map: "Run the scan tool first to build .alkahest/map.json.",
|
|
177
|
-
no_token: "
|
|
177
|
+
no_token: "Not signed in — run `alkahest login --token alk_…` in a shell (token from alkahest.app → API tokens); every agent on this machine picks it up.",
|
|
178
178
|
no_api: "Set ALKAHEST_API_URL in this MCP server's config.",
|
|
179
179
|
plan_limit: "Free plan project limit reached — upgrade to Pro for more.",
|
|
180
180
|
invalid_token: "The API token is invalid or revoked — create a new one at alkahest.app → Account.",
|
|
@@ -265,9 +265,9 @@ export function buildServer(remote) {
|
|
|
265
265
|
const res = await pullComments(root, withAuth({ open, slug: project }));
|
|
266
266
|
if (!res.ok) {
|
|
267
267
|
const hints = hinted({
|
|
268
|
-
no_token: "
|
|
268
|
+
no_token: "Not signed in — run `alkahest login --token alk_…` in a shell (token from alkahest.app → API tokens); every agent on this machine picks it up.",
|
|
269
269
|
no_api: "Set ALKAHEST_API_URL in this MCP server's config.",
|
|
270
|
-
no_slug: "Pass `project` — a slug from list_projects
|
|
270
|
+
no_slug: "Pass `project` — a slug from list_projects. To bind this folder for good, run `alkahest setup <slug>` in it (shell).",
|
|
271
271
|
invalid_token: "The API token is invalid or revoked — create a new one at alkahest.app → Account.",
|
|
272
272
|
not_found: "No accessible project for this slug.",
|
|
273
273
|
});
|
|
@@ -292,7 +292,7 @@ export function buildServer(remote) {
|
|
|
292
292
|
const res = await resolveComment(rootOf(path), id, resolved === undefined ? true : resolved, withAuth({}));
|
|
293
293
|
if (!res.ok) {
|
|
294
294
|
const hints = hinted({
|
|
295
|
-
no_token: "
|
|
295
|
+
no_token: "Not signed in — run `alkahest login --token alk_…` in a shell (token from alkahest.app → API tokens); every agent on this machine picks it up.",
|
|
296
296
|
forbidden: "Only the comment author, an editor of the map, or a workspace owner/admin can resolve it.",
|
|
297
297
|
not_found: "No comment with that id.",
|
|
298
298
|
});
|
|
@@ -327,8 +327,8 @@ export function buildServer(remote) {
|
|
|
327
327
|
const res = await postComment(root, withAuth({ node_key: n.node_key, anchor_kind: n.anchor_kind, anchor_label: n.anchor_label, body, slug: project, kind: question ? "question" : "note", mention }));
|
|
328
328
|
if (!res.ok) {
|
|
329
329
|
const hints = hinted({
|
|
330
|
-
no_token: "
|
|
331
|
-
no_slug: "Pass `project` — a slug from list_projects
|
|
330
|
+
no_token: "Not signed in — run `alkahest login --token alk_…` in a shell (token from alkahest.app → API tokens); every agent on this machine picks it up.",
|
|
331
|
+
no_slug: "Pass `project` — a slug from list_projects. To bind this folder for good, run `alkahest setup <slug>` in it (shell).",
|
|
332
332
|
forbidden: "Only the project owner or a collaborator can comment.",
|
|
333
333
|
});
|
|
334
334
|
return text(`Add comment failed (${res.code}): ${res.message}.${hints[res.code ?? ""] ? " " + hints[res.code ?? ""] : ""}`);
|
|
@@ -349,7 +349,7 @@ export function buildServer(remote) {
|
|
|
349
349
|
const res = await postComment(rootOf(path), withAuth({ parent_id: id, body, mention }));
|
|
350
350
|
if (!res.ok) {
|
|
351
351
|
const hints = hinted({
|
|
352
|
-
no_token: "
|
|
352
|
+
no_token: "Not signed in — run `alkahest login --token alk_…` in a shell (token from alkahest.app → API tokens); every agent on this machine picks it up.",
|
|
353
353
|
not_found: "No comment with that id (parent).",
|
|
354
354
|
forbidden: "Only the project owner or a collaborator can comment.",
|
|
355
355
|
});
|
|
@@ -380,8 +380,8 @@ export function buildServer(remote) {
|
|
|
380
380
|
const res = await promoteComments(rootOf(path), ids, withAuth({ title, mapSlug: map, type, status, force, slug: project }));
|
|
381
381
|
if (!res.ok) {
|
|
382
382
|
const hints = hinted({
|
|
383
|
-
no_token: "
|
|
384
|
-
no_slug: "Pass `project` — a slug from list_projects
|
|
383
|
+
no_token: "Not signed in — run `alkahest login --token alk_…` in a shell (token from alkahest.app → API tokens); every agent on this machine picks it up.",
|
|
384
|
+
no_slug: "Pass `project` — a slug from list_projects. To bind this folder for good, run `alkahest setup <slug>` in it (shell).",
|
|
385
385
|
already_tracked: "Some comments already have an issue — pass force:true to promote again.",
|
|
386
386
|
ambiguous_map: "This project has several issue maps — pass `map` (list them with the maps tool).",
|
|
387
387
|
forbidden: "You need editor access to promote comments.",
|
|
@@ -393,9 +393,9 @@ export function buildServer(remote) {
|
|
|
393
393
|
});
|
|
394
394
|
// ---- issues: the Issue Map — a map-shaped issue tracker on the hosted viewer ----
|
|
395
395
|
const issueHints = hinted({
|
|
396
|
-
no_token: "
|
|
396
|
+
no_token: "Not signed in — run `alkahest login --token alk_…` in a shell (token from alkahest.app → API tokens); every agent on this machine picks it up.",
|
|
397
397
|
no_api: "Set ALKAHEST_API_URL in this MCP server's config.",
|
|
398
|
-
no_slug: "Pass `project` — a slug from list_projects
|
|
398
|
+
no_slug: "Pass `project` — a slug from list_projects. To bind this folder for good, run `alkahest setup <slug>` in it (shell).",
|
|
399
399
|
invalid_token: "The API token is invalid or revoked — create a new one at alkahest.app → Account.",
|
|
400
400
|
forbidden: "Only the project owner or a collaborator can write issues.",
|
|
401
401
|
not_found: "Not found — list ids with the issues tool, or the project's issue maps with the maps tool.",
|
|
@@ -471,7 +471,7 @@ export function buildServer(remote) {
|
|
|
471
471
|
priority: z.enum(["none", "low", "medium", "high", "urgent"]).optional().describe("Priority (default: none)"),
|
|
472
472
|
due_on: z.string().optional().describe("Due date as YYYY-MM-DD"),
|
|
473
473
|
assignee_id: z.string().optional().describe("Assign to a project member (user id)"),
|
|
474
|
-
props: z.record(z.any()).optional().describe("Issue properties (ADR-079, flat key→value): reserved key `tags` = string array; other keys should match the issue map's schema (see prop_defs in the issues tool) — unknown keys are kept but show as unregistered"),
|
|
474
|
+
props: z.record(z.string(), z.any()).optional().describe("Issue properties (ADR-079, flat key→value): reserved key `tags` = string array; other keys should match the issue map's schema (see prop_defs in the issues tool) — unknown keys are kept but show as unregistered"),
|
|
475
475
|
parent_id: z.string().optional().describe("Parent issue id — creates a contains edge (epic → task)"),
|
|
476
476
|
target: z.string().optional().describe("Code-map target: 's:…'/'r:…' node key, '/route' (planned screen), or a resource label"),
|
|
477
477
|
external_key: z.string().optional().describe("The source tracker's id (e.g. Jira 'ABC-123'). Unique per project: if an issue already carries it, that issue is UPDATED with the fields you pass instead of a duplicate being created (the result says created:false) — always set it when importing"),
|
|
@@ -922,7 +922,7 @@ export function buildServer(remote) {
|
|
|
922
922
|
body: z.string().optional().describe("Note body as a markdown document (details, context)"),
|
|
923
923
|
note_slug: z.string().optional().describe("Explicit note address (default: derived from the title)"),
|
|
924
924
|
folder: z.string().optional().describe("Tree-sidebar path like 'raw/articles' (omit = unfiled) — the web viewer's Obsidian-style tree groups by it"),
|
|
925
|
-
props: z.record(z.any()).optional().describe("Notebook properties (flat key→value): reserved key `tags` = string array; other keys should match the map's schema (see prop_defs in the notes tool) — unknown keys are kept but show as unregistered"),
|
|
925
|
+
props: z.record(z.string(), z.any()).optional().describe("Notebook properties (flat key→value): reserved key `tags` = string array; other keys should match the map's schema (see prop_defs in the notes tool) — unknown keys are kept but show as unregistered"),
|
|
926
926
|
map: z.string().optional().describe("Which note map to add to (a project can hold several; omit when there's one). List them with the maps tool, or create one with create_map."),
|
|
927
927
|
project: z.string().optional().describe("Which project (slug) — say it explicitly when the folder isn't a linked checkout. List them with list_projects."),
|
|
928
928
|
path: z.string().optional().describe("Project root (default: cwd)"),
|
|
@@ -988,7 +988,7 @@ export function buildServer(remote) {
|
|
|
988
988
|
body: z.string().optional().describe("New body as markdown (replaces the old one)"),
|
|
989
989
|
new_slug: z.string().optional().describe("New note address (slug)"),
|
|
990
990
|
folder: z.string().nullable().optional().describe("Tree-sidebar path like 'raw/articles'; null unfiles the note; omit = untouched"),
|
|
991
|
-
props: z.record(z.any()).optional().describe("Notebook properties, SHALLOW-MERGED onto the note's current values — pass only the keys to change; a null value deletes that key; reserved key `tags` = string array"),
|
|
991
|
+
props: z.record(z.string(), z.any()).optional().describe("Notebook properties, SHALLOW-MERGED onto the note's current values — pass only the keys to change; a null value deletes that key; reserved key `tags` = string array"),
|
|
992
992
|
delete: z.boolean().optional().describe("true → soft-delete the note to the project Trash (restorable for 30 days) instead of editing; requires `reason`"),
|
|
993
993
|
reason: z.string().optional().describe("REQUIRED with delete (≤200 chars): a one-line reason the user sees in the Trash and the activity journal — say WHY the note should go, not just 'cleanup'"),
|
|
994
994
|
restore: z.boolean().optional().describe("true → restore the note from the Trash (undoes a soft delete)"),
|
|
@@ -1148,7 +1148,7 @@ export function buildServer(remote) {
|
|
|
1148
1148
|
}, async () => {
|
|
1149
1149
|
const res = await listProjects(withAuth({}));
|
|
1150
1150
|
if (!res.ok || !res.projects) {
|
|
1151
|
-
const h = hinted({ no_token: "
|
|
1151
|
+
const h = hinted({ no_token: "Not signed in — run `alkahest login --token alk_…` in a shell (token from alkahest.app → API tokens); every agent on this machine picks it up." })[res.code ?? ""];
|
|
1152
1152
|
return text(`List projects failed (${res.code}): ${res.message}.${h ? ` ${h}` : ""}`);
|
|
1153
1153
|
}
|
|
1154
1154
|
return json({
|
|
@@ -1251,8 +1251,8 @@ export function buildServer(remote) {
|
|
|
1251
1251
|
is_default: z.boolean().optional().describe("The type new issues get (exactly one)"),
|
|
1252
1252
|
})).nullable().optional().describe("The project's own types (1–8); null = inherit the workspace again"),
|
|
1253
1253
|
reassign: z.object({
|
|
1254
|
-
statuses: z.record(z.string()).optional().describe("old status id → new status id"),
|
|
1255
|
-
types: z.record(z.string()).optional().describe("old type id → new type id"),
|
|
1254
|
+
statuses: z.record(z.string(), z.string()).optional().describe("old status id → new status id"),
|
|
1255
|
+
types: z.record(z.string(), z.string()).optional().describe("old type id → new type id"),
|
|
1256
1256
|
}).optional().describe("Where existing issues go when their status/type id disappears"),
|
|
1257
1257
|
auto_reassign: z.boolean().optional().describe("Fill reassign gaps by meaning (same category / default type)"),
|
|
1258
1258
|
project: z.string().optional().describe("Which project (slug) — say it explicitly when the folder isn't a linked checkout. List them with list_projects."),
|
|
@@ -1282,7 +1282,7 @@ export function buildServer(remote) {
|
|
|
1282
1282
|
due_on: z.string().optional().describe("New due date YYYY-MM-DD; pass '' to clear"),
|
|
1283
1283
|
assignee_id: z.string().optional().describe("Assign to a project member (user id); pass '' to unassign"),
|
|
1284
1284
|
target: z.string().optional().describe("New code-map target ('s:…'/'r:…'/'/route'/resource label); pass '' to clear"),
|
|
1285
|
-
props: z.record(z.any()).optional().describe("Properties patch (ADR-079), SHALLOW-merged: a null value deletes that key; other keys are untouched. See prop_defs in the issues tool."),
|
|
1285
|
+
props: z.record(z.string(), z.any()).optional().describe("Properties patch (ADR-079), SHALLOW-merged: a null value deletes that key; other keys are untouched. See prop_defs in the issues tool."),
|
|
1286
1286
|
archived: z.boolean().optional().describe("true archives the issue (put away: hidden from the issues tool unless archived:true, never actionable, not deleted); false restores it (archived_at → null)"),
|
|
1287
1287
|
parent_id: z.string().optional().describe("Move the issue under another epic (replaces its contains parent); pass '' to detach it from any epic"),
|
|
1288
1288
|
delete: z.boolean().optional().describe("Delete the issue instead of updating it"),
|