@cr8rcho/alkahest 0.1.59 → 0.1.61

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.
@@ -1,6 +0,0 @@
1
- /**
2
- * Serve the `.alkahest/` dashboard over a local server to explore the
3
- * screen-flow / call graph (ALKAHEST.md §5). Regenerates index.html from
4
- * map.json each time so the latest template is applied.
5
- */
6
- export declare function view(path: string): Promise<void>;
@@ -1,21 +0,0 @@
1
- import { existsSync, readFileSync } from "node:fs";
2
- import { join, resolve } from "node:path";
3
- import { emitDashboard, OUTPUT_DIR } from "../core/emit.js";
4
- import { serveDashboard } from "../core/serve.js";
5
- /**
6
- * Serve the `.alkahest/` dashboard over a local server to explore the
7
- * screen-flow / call graph (ALKAHEST.md §5). Regenerates index.html from
8
- * map.json each time so the latest template is applied.
9
- */
10
- export async function view(path) {
11
- const projectRoot = resolve(path);
12
- const mapPath = join(projectRoot, OUTPUT_DIR, "map.json");
13
- if (!existsSync(mapPath)) {
14
- console.log(`[alkahest] ${mapPath} not found — run 'alkahest scan' first.`);
15
- return;
16
- }
17
- const map = JSON.parse(readFileSync(mapPath, "utf8"));
18
- emitDashboard(projectRoot, map);
19
- await serveDashboard(projectRoot);
20
- }
21
- //# sourceMappingURL=view.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"view.js","sourceRoot":"","sources":["../../src/commands/view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,IAAY;IACrC,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IAC1D,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,cAAc,OAAO,yCAAyC,CAAC,CAAC;QAC5E,OAAO;IACT,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAe,CAAC;IACpE,aAAa,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IAChC,MAAM,cAAc,CAAC,WAAW,CAAC,CAAC;AACpC,CAAC"}
@@ -1,9 +0,0 @@
1
- import type { ProductMap } from "./types.js";
2
- /** Self-contained HTML string with the ProductMap inlined. No external dependencies/network. */
3
- export declare function renderDashboard(map: ProductMap): string;
4
- /**
5
- * Dashboard shell with no data inlined — for the hosted viewer (Vercel).
6
- * At runtime it fetches the map from a sibling `map.json` or `?src=<url>`,
7
- * so the same HTML serves any project. See dashboard.html's loadMap().
8
- */
9
- export declare function renderShell(): string;
@@ -1,20 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- import { fileURLToPath } from "node:url";
3
- import { dirname, join } from "node:path";
4
- /** Self-contained dashboard template (asset). Copied to dist/assets at build time (scripts/copy-assets.mjs). */
5
- const TEMPLATE = readFileSync(join(dirname(fileURLToPath(import.meta.url)), "..", "assets", "dashboard.html"), "utf8");
6
- const PLACEHOLDER = "/*__ALKAHEST_MAP__*/";
7
- /** Self-contained HTML string with the ProductMap inlined. No external dependencies/network. */
8
- export function renderDashboard(map) {
9
- const json = JSON.stringify(map).replace(/</g, "\\u003c"); // prevent </script> injection
10
- return TEMPLATE.replace(PLACEHOLDER, () => json);
11
- }
12
- /**
13
- * Dashboard shell with no data inlined — for the hosted viewer (Vercel).
14
- * At runtime it fetches the map from a sibling `map.json` or `?src=<url>`,
15
- * so the same HTML serves any project. See dashboard.html's loadMap().
16
- */
17
- export function renderShell() {
18
- return TEMPLATE.replace(PLACEHOLDER, "");
19
- }
20
- //# sourceMappingURL=dashboard.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dashboard.js","sourceRoot":"","sources":["../../src/core/dashboard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAG1C,gHAAgH;AAChH,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,gBAAgB,CAAC,EAAE,MAAM,CAAC,CAAC;AAEvH,MAAM,WAAW,GAAG,sBAAsB,CAAC;AAE3C,gGAAgG;AAChG,MAAM,UAAU,eAAe,CAAC,GAAe;IAC7C,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,8BAA8B;IACzF,OAAO,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AACnD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AAC3C,CAAC"}
@@ -1,5 +0,0 @@
1
- /**
2
- * Serves `<projectRoot>/.alkahest` as a local static server and opens the browser.
3
- * The server keeps the event loop alive, so the process stays up until Ctrl+C.
4
- */
5
- export declare function serveDashboard(projectRoot: string): Promise<void>;
@@ -1,52 +0,0 @@
1
- import { createServer } from "node:http";
2
- import { readFile } from "node:fs/promises";
3
- import { extname, resolve } from "node:path";
4
- import { spawn } from "node:child_process";
5
- import { platform } from "node:os";
6
- import { OUTPUT_DIR } from "./emit.js";
7
- const MIME = {
8
- ".html": "text/html; charset=utf-8",
9
- ".json": "application/json; charset=utf-8",
10
- ".js": "text/javascript; charset=utf-8",
11
- ".css": "text/css; charset=utf-8",
12
- };
13
- /**
14
- * Serves `<projectRoot>/.alkahest` as a local static server and opens the browser.
15
- * The server keeps the event loop alive, so the process stays up until Ctrl+C.
16
- */
17
- export async function serveDashboard(projectRoot) {
18
- const root = resolve(projectRoot, OUTPUT_DIR);
19
- const server = createServer(async (req, res) => {
20
- try {
21
- const urlPath = decodeURIComponent((req.url || "/").split("?")[0]);
22
- const filePath = resolve(root, "." + (urlPath === "/" ? "/index.html" : urlPath));
23
- if (filePath !== root && !filePath.startsWith(root + "/")) {
24
- res.writeHead(403).end("Forbidden");
25
- return;
26
- }
27
- const data = await readFile(filePath);
28
- res.writeHead(200, { "content-type": MIME[extname(filePath)] ?? "application/octet-stream" });
29
- res.end(data);
30
- }
31
- catch {
32
- res.writeHead(404).end("Not found");
33
- }
34
- });
35
- await new Promise((res) => server.listen(0, "127.0.0.1", res));
36
- const addr = server.address();
37
- const port = typeof addr === "object" && addr ? addr.port : 0;
38
- const url = `http://127.0.0.1:${port}/`;
39
- console.log(`[alkahest] dashboard: ${url} (Ctrl+C to stop)`);
40
- openBrowser(url);
41
- }
42
- function openBrowser(url) {
43
- const isWin = platform() === "win32";
44
- const cmd = platform() === "darwin" ? "open" : isWin ? "start" : "xdg-open";
45
- try {
46
- spawn(cmd, [url], { stdio: "ignore", detached: true, shell: isWin }).unref();
47
- }
48
- catch {
49
- /* ignore browser auto-open failures — the URL is printed above */
50
- }
51
- }
52
- //# sourceMappingURL=serve.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"serve.js","sourceRoot":"","sources":["../../src/core/serve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,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