@shrkcrft/cli 0.1.0-alpha.10 → 0.1.0-alpha.11

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 +1 @@
1
- {"version":3,"file":"dashboard-api-server.d.ts","sourceRoot":"","sources":["../../src/dashboard/dashboard-api-server.ts"],"names":[],"mappings":"AA4DA,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjE,+FAA+F;IAC/F,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,UAAU,aAAa;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AA2BD,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAqC1F;AAgiBD,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"dashboard-api-server.d.ts","sourceRoot":"","sources":["../../src/dashboard/dashboard-api-server.ts"],"names":[],"mappings":"AA4DA,UAAU,cAAc;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACjE,+FAA+F;IAC/F,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,UAAU,aAAa;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B;AA2BD,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAqC1F;AA2jBD,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC"}
@@ -249,6 +249,12 @@ async function handle(req, res, ctx) {
249
249
  if (!path.startsWith('/api/') && opts.staticDir) {
250
250
  return serveStatic(res, opts.staticDir, path);
251
251
  }
252
+ // Non-API request with no static UI installed. Common when @shrkcrft/cli
253
+ // is consumed without @shrkcrft/dashboard present. Return a helpful page
254
+ // instead of falling through to the cryptic "Unknown route: /".
255
+ if (!path.startsWith('/api/') && !opts.staticDir) {
256
+ return serveNoUiHint(res, path);
257
+ }
252
258
  // Session live events (SSE). Subscribe via EventSource on the session detail page.
253
259
  const sseMatch = path.match(/^\/api\/sessions\/([^/]+)\/events$/);
254
260
  if (sseMatch) {
@@ -505,6 +511,25 @@ function serveSessionReportHtml(res, cwd, sessionId) {
505
511
  }
506
512
  res.end(html);
507
513
  }
514
+ function serveNoUiHint(res, urlPath) {
515
+ const accept = (res.req?.headers['accept'] ?? '');
516
+ const wantsHtml = accept.includes('text/html');
517
+ if (wantsHtml) {
518
+ const html = `<!doctype html><html lang="en"><head><meta charset="utf-8"><title>SharkCraft dashboard — UI not installed</title><meta name="viewport" content="width=device-width,initial-scale=1"><style>body{font-family:ui-sans-serif,system-ui,-apple-system,sans-serif;max-width:680px;margin:48px auto;padding:0 16px;color:#1f2937;line-height:1.55}code,pre{background:#f3f4f6;padding:2px 6px;border-radius:4px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px}pre{padding:12px;overflow:auto}h1{font-size:20px;margin-top:0}a{color:#2563eb}</style></head><body><h1>SharkCraft dashboard</h1><p>The API is running, but the web UI bundle (<code>@shrkcrft/dashboard</code>) was not found next to <code>@shrkcrft/cli</code>.</p><p>Install or upgrade it alongside the CLI:</p><pre>npm i -D @shrkcrft/dashboard@alpha</pre><p>Or point the server at a local build:</p><pre>shrk dashboard --dev-assets path/to/dashboard/dist</pre><p>The API itself is available — try <a href="/api/health">/api/health</a> or <a href="/api/overview">/api/overview</a>.</p></body></html>`;
519
+ res.statusCode = 200;
520
+ res.setHeader('content-type', 'text/html; charset=utf-8');
521
+ res.setHeader('cache-control', 'no-store');
522
+ res.setHeader('x-content-type-options', 'nosniff');
523
+ res.setHeader('referrer-policy', 'no-referrer');
524
+ if ((res.req?.method ?? 'GET') === 'HEAD') {
525
+ res.end();
526
+ return;
527
+ }
528
+ res.end(html);
529
+ return;
530
+ }
531
+ respondError(res, 404, 'not-found', `No UI assets installed; ${urlPath} cannot be served. Install @shrkcrft/dashboard or pass --dev-assets.`);
532
+ }
508
533
  function serveStatic(res, staticDir, urlPath) {
509
534
  // Strip leading / and resolve against staticDir. Reject traversal.
510
535
  const rel = urlPath.replace(/^\/+/, '');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shrkcrft/cli",
3
- "version": "0.1.0-alpha.10",
3
+ "version": "0.1.0-alpha.11",
4
4
  "description": "SharkCraft CLI (`shrk`): structured project intelligence for AI coding agents.",
5
5
  "license": "MIT",
6
6
  "author": "SharkCraft contributors",
@@ -47,35 +47,36 @@
47
47
  "typecheck": "tsc --noEmit -p tsconfig.json"
48
48
  },
49
49
  "dependencies": {
50
- "@shrkcrft/core": "^0.1.0-alpha.10",
51
- "@shrkcrft/config": "^0.1.0-alpha.10",
52
- "@shrkcrft/workspace": "^0.1.0-alpha.10",
53
- "@shrkcrft/knowledge": "^0.1.0-alpha.10",
54
- "@shrkcrft/context": "^0.1.0-alpha.10",
55
- "@shrkcrft/rules": "^0.1.0-alpha.10",
56
- "@shrkcrft/paths": "^0.1.0-alpha.10",
57
- "@shrkcrft/templates": "^0.1.0-alpha.10",
58
- "@shrkcrft/plugin-api": "^0.1.0-alpha.10",
59
- "@shrkcrft/dashboard-api": "^0.1.0-alpha.10",
60
- "@shrkcrft/pipelines": "^0.1.0-alpha.10",
61
- "@shrkcrft/presets": "^0.1.0-alpha.10",
62
- "@shrkcrft/boundaries": "^0.1.0-alpha.10",
63
- "@shrkcrft/graph": "^0.1.0-alpha.10",
64
- "@shrkcrft/rule-graph": "^0.1.0-alpha.10",
65
- "@shrkcrft/structural-search": "^0.1.0-alpha.10",
66
- "@shrkcrft/impact-engine": "^0.1.0-alpha.10",
67
- "@shrkcrft/context-planner": "^0.1.0-alpha.10",
68
- "@shrkcrft/architecture-guard": "^0.1.0-alpha.10",
69
- "@shrkcrft/framework-scanners": "^0.1.0-alpha.10",
70
- "@shrkcrft/api-surface-diff": "^0.1.0-alpha.10",
71
- "@shrkcrft/quality-gates": "^0.1.0-alpha.10",
72
- "@shrkcrft/migrate": "^0.1.0-alpha.10",
73
- "@shrkcrft/generator": "^0.1.0-alpha.10",
74
- "@shrkcrft/importer": "^0.1.0-alpha.10",
75
- "@shrkcrft/inspector": "^0.1.0-alpha.10",
76
- "@shrkcrft/ai": "^0.1.0-alpha.10",
77
- "@shrkcrft/shared": "^0.1.0-alpha.10",
78
- "@shrkcrft/mcp-server": "^0.1.0-alpha.10"
50
+ "@shrkcrft/core": "^0.1.0-alpha.11",
51
+ "@shrkcrft/config": "^0.1.0-alpha.11",
52
+ "@shrkcrft/workspace": "^0.1.0-alpha.11",
53
+ "@shrkcrft/knowledge": "^0.1.0-alpha.11",
54
+ "@shrkcrft/context": "^0.1.0-alpha.11",
55
+ "@shrkcrft/rules": "^0.1.0-alpha.11",
56
+ "@shrkcrft/paths": "^0.1.0-alpha.11",
57
+ "@shrkcrft/templates": "^0.1.0-alpha.11",
58
+ "@shrkcrft/plugin-api": "^0.1.0-alpha.11",
59
+ "@shrkcrft/dashboard": "^0.1.0-alpha.11",
60
+ "@shrkcrft/dashboard-api": "^0.1.0-alpha.11",
61
+ "@shrkcrft/pipelines": "^0.1.0-alpha.11",
62
+ "@shrkcrft/presets": "^0.1.0-alpha.11",
63
+ "@shrkcrft/boundaries": "^0.1.0-alpha.11",
64
+ "@shrkcrft/graph": "^0.1.0-alpha.11",
65
+ "@shrkcrft/rule-graph": "^0.1.0-alpha.11",
66
+ "@shrkcrft/structural-search": "^0.1.0-alpha.11",
67
+ "@shrkcrft/impact-engine": "^0.1.0-alpha.11",
68
+ "@shrkcrft/context-planner": "^0.1.0-alpha.11",
69
+ "@shrkcrft/architecture-guard": "^0.1.0-alpha.11",
70
+ "@shrkcrft/framework-scanners": "^0.1.0-alpha.11",
71
+ "@shrkcrft/api-surface-diff": "^0.1.0-alpha.11",
72
+ "@shrkcrft/quality-gates": "^0.1.0-alpha.11",
73
+ "@shrkcrft/migrate": "^0.1.0-alpha.11",
74
+ "@shrkcrft/generator": "^0.1.0-alpha.11",
75
+ "@shrkcrft/importer": "^0.1.0-alpha.11",
76
+ "@shrkcrft/inspector": "^0.1.0-alpha.11",
77
+ "@shrkcrft/ai": "^0.1.0-alpha.11",
78
+ "@shrkcrft/shared": "^0.1.0-alpha.11",
79
+ "@shrkcrft/mcp-server": "^0.1.0-alpha.11"
79
80
  },
80
81
  "publishConfig": {
81
82
  "access": "public"