prismalens 0.2.0 → 0.4.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 (119) hide show
  1. package/README.md +29 -13
  2. package/dist/bin/prismalens.js +39 -50
  3. package/dist/chunk-2Z7QZSIS.js +20 -0
  4. package/dist/chunk-5BT3XQOG.js +2990 -0
  5. package/dist/chunk-6N4PHBII.js +30 -0
  6. package/dist/chunk-CTKCK7QT.js +387 -0
  7. package/dist/chunk-CVSS5JPC.js +130 -0
  8. package/dist/chunk-HPE5CTO4.js +22 -0
  9. package/dist/chunk-PTBCAI34.js +34 -0
  10. package/dist/chunk-PVQVFRIV.js +452 -0
  11. package/dist/chunk-QDK5PAI3.js +155 -0
  12. package/dist/chunk-SSEIMBQ2.js +204 -0
  13. package/dist/chunk-TGP6QTFO.js +156 -0
  14. package/dist/chunk-V6M6ISKI.js +161 -0
  15. package/dist/chunk-XH6DIKTA.js +83 -0
  16. package/dist/src/cli/auth.js +112 -101
  17. package/dist/src/cli/doctor.js +184 -187
  18. package/dist/src/cli/flags.js +6 -29
  19. package/dist/src/cli/grouping.js +16 -227
  20. package/dist/src/cli/init.js +58 -52
  21. package/dist/src/cli/investigate.js +23 -465
  22. package/dist/src/cli/listen.js +550 -286
  23. package/dist/src/cli/report.js +70 -67
  24. package/dist/src/cli/serve.js +260 -30
  25. package/dist/src/cli/status.js +87 -86
  26. package/package.json +16 -7
  27. package/dist/bin/prismalens.d.ts +0 -3
  28. package/dist/bin/prismalens.d.ts.map +0 -1
  29. package/dist/bin/prismalens.js.map +0 -1
  30. package/dist/src/cli/auth.d.ts +0 -3
  31. package/dist/src/cli/auth.d.ts.map +0 -1
  32. package/dist/src/cli/auth.js.map +0 -1
  33. package/dist/src/cli/doctor.d.ts +0 -18
  34. package/dist/src/cli/doctor.d.ts.map +0 -1
  35. package/dist/src/cli/doctor.js.map +0 -1
  36. package/dist/src/cli/flags.d.ts +0 -2
  37. package/dist/src/cli/flags.d.ts.map +0 -1
  38. package/dist/src/cli/flags.js.map +0 -1
  39. package/dist/src/cli/grouping.d.ts +0 -18
  40. package/dist/src/cli/grouping.d.ts.map +0 -1
  41. package/dist/src/cli/grouping.js.map +0 -1
  42. package/dist/src/cli/init.d.ts +0 -3
  43. package/dist/src/cli/init.d.ts.map +0 -1
  44. package/dist/src/cli/init.js.map +0 -1
  45. package/dist/src/cli/investigate.d.ts +0 -115
  46. package/dist/src/cli/investigate.d.ts.map +0 -1
  47. package/dist/src/cli/investigate.js.map +0 -1
  48. package/dist/src/cli/listen.d.ts +0 -56
  49. package/dist/src/cli/listen.d.ts.map +0 -1
  50. package/dist/src/cli/listen.js.map +0 -1
  51. package/dist/src/cli/report.d.ts +0 -24
  52. package/dist/src/cli/report.d.ts.map +0 -1
  53. package/dist/src/cli/report.js.map +0 -1
  54. package/dist/src/cli/serve.d.ts +0 -3
  55. package/dist/src/cli/serve.d.ts.map +0 -1
  56. package/dist/src/cli/serve.js.map +0 -1
  57. package/dist/src/cli/status.d.ts +0 -19
  58. package/dist/src/cli/status.d.ts.map +0 -1
  59. package/dist/src/cli/status.js.map +0 -1
  60. package/dist/src/config/loader.d.ts +0 -22
  61. package/dist/src/config/loader.d.ts.map +0 -1
  62. package/dist/src/config/loader.js +0 -193
  63. package/dist/src/config/loader.js.map +0 -1
  64. package/dist/src/config/schema.d.ts +0 -463
  65. package/dist/src/config/schema.d.ts.map +0 -1
  66. package/dist/src/config/schema.js +0 -217
  67. package/dist/src/config/schema.js.map +0 -1
  68. package/dist/src/core/caps.d.ts +0 -36
  69. package/dist/src/core/caps.d.ts.map +0 -1
  70. package/dist/src/core/caps.js +0 -36
  71. package/dist/src/core/caps.js.map +0 -1
  72. package/dist/src/core/db.d.ts +0 -3
  73. package/dist/src/core/db.d.ts.map +0 -1
  74. package/dist/src/core/db.js +0 -105
  75. package/dist/src/core/db.js.map +0 -1
  76. package/dist/src/core/detect-repo.d.ts +0 -4
  77. package/dist/src/core/detect-repo.d.ts.map +0 -1
  78. package/dist/src/core/detect-repo.js +0 -28
  79. package/dist/src/core/detect-repo.js.map +0 -1
  80. package/dist/src/core/file-session-store.d.ts +0 -10
  81. package/dist/src/core/file-session-store.d.ts.map +0 -1
  82. package/dist/src/core/file-session-store.js +0 -34
  83. package/dist/src/core/file-session-store.js.map +0 -1
  84. package/dist/src/core/parse-stdin.d.ts +0 -2
  85. package/dist/src/core/parse-stdin.d.ts.map +0 -1
  86. package/dist/src/core/parse-stdin.js +0 -21
  87. package/dist/src/core/parse-stdin.js.map +0 -1
  88. package/dist/src/core/run-investigation.d.ts +0 -54
  89. package/dist/src/core/run-investigation.d.ts.map +0 -1
  90. package/dist/src/core/run-investigation.js +0 -200
  91. package/dist/src/core/run-investigation.js.map +0 -1
  92. package/dist/src/core/session.d.ts +0 -63
  93. package/dist/src/core/session.d.ts.map +0 -1
  94. package/dist/src/core/session.js +0 -45
  95. package/dist/src/core/session.js.map +0 -1
  96. package/dist/src/core/slack-notify.d.ts +0 -9
  97. package/dist/src/core/slack-notify.d.ts.map +0 -1
  98. package/dist/src/core/slack-notify.js +0 -57
  99. package/dist/src/core/slack-notify.js.map +0 -1
  100. package/dist/src/core/sqlite-session-store.d.ts +0 -39
  101. package/dist/src/core/sqlite-session-store.d.ts.map +0 -1
  102. package/dist/src/core/sqlite-session-store.js +0 -239
  103. package/dist/src/core/sqlite-session-store.js.map +0 -1
  104. package/dist/src/http/server.d.ts +0 -31
  105. package/dist/src/http/server.d.ts.map +0 -1
  106. package/dist/src/http/server.js +0 -164
  107. package/dist/src/http/server.js.map +0 -1
  108. package/dist/src/jsonrpc/server.d.ts +0 -15
  109. package/dist/src/jsonrpc/server.d.ts.map +0 -1
  110. package/dist/src/jsonrpc/server.js +0 -244
  111. package/dist/src/jsonrpc/server.js.map +0 -1
  112. package/dist/src/jsonrpc/types.d.ts +0 -12
  113. package/dist/src/jsonrpc/types.d.ts.map +0 -1
  114. package/dist/src/jsonrpc/types.js +0 -4
  115. package/dist/src/jsonrpc/types.js.map +0 -1
  116. package/dist/src/version.d.ts +0 -8
  117. package/dist/src/version.d.ts.map +0 -1
  118. package/dist/src/version.js +0 -27
  119. package/dist/src/version.js.map +0 -1
@@ -1,108 +1,119 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- // Copyright 2026 Sumit Patel
3
- import { removeStoredCredential, setStoredCredential, } from "@prismalens/config/auth";
4
- import { resolveCredentials } from "@prismalens/config/credentials";
5
- import { LLM_PROVIDERS } from "@prismalens/config/llm";
1
+ import {
2
+ removeStoredCredential,
3
+ resolveCredentials,
4
+ setStoredCredential
5
+ } from "../../chunk-CVSS5JPC.js";
6
+ import {
7
+ LLM_PROVIDERS
8
+ } from "../../chunk-XH6DIKTA.js";
9
+ import "../../chunk-2Z7QZSIS.js";
10
+
11
+ // src/cli/auth.ts
6
12
  import { defineCommand } from "citty";
7
13
  import consola from "consola";
8
- const login = defineCommand({
9
- meta: {
10
- name: "login",
11
- description: "Log in to a model provider",
12
- },
13
- args: {
14
- provider: {
15
- type: "positional",
16
- description: "Provider ID (e.g. openai, anthropic)",
17
- required: true,
18
- },
19
- "api-key": {
20
- type: "string",
21
- description: "API key",
22
- },
23
- },
24
- async run({ args }) {
25
- const provider = args.provider;
26
- if (!Object.hasOwn(LLM_PROVIDERS, provider)) {
27
- consola.error(`Unknown provider: ${provider}`);
28
- process.exit(1);
29
- }
30
- let apiKey = args["api-key"];
31
- if (!apiKey) {
32
- if (process.stdin.isTTY) {
33
- apiKey = (await consola.prompt(`Enter API key for ${LLM_PROVIDERS[provider].name}:`, {
34
- // @ts-expect-error type password passes through to clack
35
- type: "password",
36
- }));
37
- }
38
- else {
39
- consola.error("--api-key is required in non-interactive mode");
40
- process.exit(1);
41
- }
42
- }
43
- if (!apiKey || typeof apiKey !== "string" || !apiKey.trim()) {
44
- consola.error("API key is required");
45
- process.exit(1);
46
- }
47
- setStoredCredential(provider, apiKey.trim());
48
- consola.success(`Saved credential for ${LLM_PROVIDERS[provider].name}`);
14
+ var login = defineCommand({
15
+ meta: {
16
+ name: "login",
17
+ description: "Log in to a model provider"
18
+ },
19
+ args: {
20
+ provider: {
21
+ type: "positional",
22
+ description: "Provider ID (e.g. openai, anthropic)",
23
+ required: true
49
24
  },
25
+ "api-key": {
26
+ type: "string",
27
+ description: "API key"
28
+ }
29
+ },
30
+ async run({ args }) {
31
+ const provider = args.provider;
32
+ if (!Object.hasOwn(LLM_PROVIDERS, provider)) {
33
+ consola.error(`Unknown provider: ${provider}`);
34
+ process.exit(1);
35
+ }
36
+ let apiKey = args["api-key"];
37
+ if (!apiKey) {
38
+ if (process.stdin.isTTY) {
39
+ apiKey = await consola.prompt(
40
+ `Enter API key for ${LLM_PROVIDERS[provider].name}:`,
41
+ {
42
+ // @ts-expect-error type password passes through to clack
43
+ type: "password"
44
+ }
45
+ );
46
+ } else {
47
+ consola.error("--api-key is required in non-interactive mode");
48
+ process.exit(1);
49
+ }
50
+ }
51
+ if (!apiKey || typeof apiKey !== "string" || !apiKey.trim()) {
52
+ consola.error("API key is required");
53
+ process.exit(1);
54
+ }
55
+ setStoredCredential(provider, apiKey.trim());
56
+ consola.success(`Saved credential for ${LLM_PROVIDERS[provider].name}`);
57
+ }
50
58
  });
51
- const list = defineCommand({
52
- meta: {
53
- name: "list",
54
- description: "List configured providers",
55
- },
56
- async run() {
57
- for (const provider of Object.values(LLM_PROVIDERS)) {
58
- const creds = resolveCredentials(provider.id);
59
- if (creds.source !== "none") {
60
- const key = creds.apiKey ?? "";
61
- const masked = key.length > 4 ? `...${key.slice(-4)}` : "<set>";
62
- consola.log(`${provider.name} (${provider.id})`);
63
- consola.log(` Source: ${creds.source}`);
64
- consola.log(` Key: ${masked}`);
65
- consola.log("");
66
- }
67
- else {
68
- consola.log(`${provider.name} (${provider.id})`);
69
- consola.log(` Source: none`);
70
- consola.log("");
71
- }
72
- }
73
- },
59
+ var list = defineCommand({
60
+ meta: {
61
+ name: "list",
62
+ description: "List configured providers"
63
+ },
64
+ async run() {
65
+ for (const provider of Object.values(LLM_PROVIDERS)) {
66
+ const creds = resolveCredentials(provider.id);
67
+ if (creds.source !== "none") {
68
+ const key = creds.apiKey ?? "";
69
+ const masked = key.length > 4 ? `...${key.slice(-4)}` : "<set>";
70
+ consola.log(`${provider.name} (${provider.id})`);
71
+ consola.log(` Source: ${creds.source}`);
72
+ consola.log(` Key: ${masked}`);
73
+ consola.log("");
74
+ } else {
75
+ consola.log(`${provider.name} (${provider.id})`);
76
+ consola.log(` Source: none`);
77
+ consola.log("");
78
+ }
79
+ }
80
+ }
74
81
  });
75
- const logout = defineCommand({
76
- meta: {
77
- name: "logout",
78
- description: "Remove stored credential",
79
- },
80
- args: {
81
- provider: {
82
- type: "positional",
83
- description: "Provider ID",
84
- required: true,
85
- },
86
- },
87
- async run({ args }) {
88
- const provider = args.provider;
89
- if (!Object.hasOwn(LLM_PROVIDERS, provider)) {
90
- consola.error(`Unknown provider: ${provider}`);
91
- process.exit(1);
92
- }
93
- removeStoredCredential(provider);
94
- consola.success(`Removed stored credential for ${LLM_PROVIDERS[provider].name}`);
95
- },
82
+ var logout = defineCommand({
83
+ meta: {
84
+ name: "logout",
85
+ description: "Remove stored credential"
86
+ },
87
+ args: {
88
+ provider: {
89
+ type: "positional",
90
+ description: "Provider ID",
91
+ required: true
92
+ }
93
+ },
94
+ async run({ args }) {
95
+ const provider = args.provider;
96
+ if (!Object.hasOwn(LLM_PROVIDERS, provider)) {
97
+ consola.error(`Unknown provider: ${provider}`);
98
+ process.exit(1);
99
+ }
100
+ removeStoredCredential(provider);
101
+ consola.success(
102
+ `Removed stored credential for ${LLM_PROVIDERS[provider].name}`
103
+ );
104
+ }
96
105
  });
97
- export default defineCommand({
98
- meta: {
99
- name: "auth",
100
- description: "Manage provider credentials",
101
- },
102
- subCommands: {
103
- login,
104
- list,
105
- logout,
106
- },
106
+ var auth_default = defineCommand({
107
+ meta: {
108
+ name: "auth",
109
+ description: "Manage provider credentials"
110
+ },
111
+ subCommands: {
112
+ login,
113
+ list,
114
+ logout
115
+ }
107
116
  });
108
- //# sourceMappingURL=auth.js.map
117
+ export {
118
+ auth_default as default
119
+ };
@@ -1,207 +1,204 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- // Copyright 2026 Sumit Patel
3
- /**
4
- * `prismalens doctor` — preflight checklist for the two-tier engine (ADR-0008/0010).
5
- *
6
- * Salvaged in spirit from the retired pl orchestrator's doctor, but pared down to the
7
- * checks that actually gate a run:
8
- * - HARD: the configured harness binary is on PATH
9
- * (deepagents -> "deepagents", claude-code -> "claude", codex -> "codex")
10
- * - HARD: an LLM credential is present
11
- * (any provider credential env var from LLM_PROVIDERS, or, for claude-code,
12
- * a signed-in ~/.claude/.credentials.json)
13
- * - SOFT: workspace.base_dir is writable
14
- *
15
- * Prints pass/fail per check; exits non-zero iff a HARD check fails. No tinyexec /
16
- * check-tool helper here — availability is a dependency-free PATH scan.
17
- */
1
+ import {
2
+ loadConfig
3
+ } from "../../chunk-V6M6ISKI.js";
4
+ import {
5
+ resolveBaseDir
6
+ } from "../../chunk-CTKCK7QT.js";
7
+ import {
8
+ resolveCredentials
9
+ } from "../../chunk-CVSS5JPC.js";
10
+ import "../../chunk-TGP6QTFO.js";
11
+ import {
12
+ assertKnownFlags
13
+ } from "../../chunk-PTBCAI34.js";
14
+ import {
15
+ HARNESS_BINARY,
16
+ pingModel
17
+ } from "../../chunk-5BT3XQOG.js";
18
+ import "../../chunk-6N4PHBII.js";
19
+ import {
20
+ AUTO_SELECT_PROVIDER_IDS,
21
+ LLM_PROVIDERS
22
+ } from "../../chunk-XH6DIKTA.js";
23
+ import "../../chunk-2Z7QZSIS.js";
24
+
25
+ // src/cli/doctor.ts
18
26
  import { accessSync, constants as fsConstants } from "node:fs";
19
27
  import { access, mkdir } from "node:fs/promises";
20
28
  import { delimiter, join } from "node:path";
21
- import { resolveCredentials } from "@prismalens/config/credentials";
22
- import { HARNESS_BINARY } from "@prismalens/config/harness";
23
- import { AUTO_SELECT_PROVIDER_IDS, LLM_PROVIDERS, } from "@prismalens/config/llm";
24
- import { pingModel } from "@prismalens/config/model";
25
29
  import { defineCommand } from "citty";
26
30
  import consola from "consola";
27
- import { loadConfig } from "../config/loader.js";
28
- import { resolveBaseDir } from "../core/session.js";
29
- import { assertKnownFlags } from "./flags.js";
30
31
  function isOnPath(bin) {
31
- const pathEnv = process.env.PATH ?? "";
32
- const exts = process.platform === "win32"
33
- ? (process.env.PATHEXT ?? ".EXE;.CMD;.BAT;.COM").split(";")
34
- : [""];
35
- for (const dir of pathEnv.split(delimiter)) {
36
- if (dir.length === 0)
37
- continue;
38
- for (const ext of exts) {
39
- try {
40
- accessSync(join(dir, bin + ext), fsConstants.X_OK);
41
- return true;
42
- }
43
- catch {
44
- // keep looking
45
- }
46
- }
32
+ const pathEnv = process.env.PATH ?? "";
33
+ const exts = process.platform === "win32" ? (process.env.PATHEXT ?? ".EXE;.CMD;.BAT;.COM").split(";") : [""];
34
+ for (const dir of pathEnv.split(delimiter)) {
35
+ if (dir.length === 0) continue;
36
+ for (const ext of exts) {
37
+ try {
38
+ accessSync(join(dir, bin + ext), fsConstants.X_OK);
39
+ return true;
40
+ } catch {
41
+ }
47
42
  }
48
- return false;
43
+ }
44
+ return false;
49
45
  }
50
46
  function checkHarness(harness) {
51
- const binary = HARNESS_BINARY[harness];
52
- const pass = isOnPath(binary);
53
- return {
54
- name: "Harness binary",
55
- pass,
56
- detail: pass
57
- ? `${binary} found on PATH (harness: ${harness})`
58
- : `${binary} not found on PATH — install the "${harness}" harness`,
59
- hard: true,
60
- };
47
+ const binary = HARNESS_BINARY[harness];
48
+ const pass = isOnPath(binary);
49
+ return {
50
+ name: "Harness binary",
51
+ pass,
52
+ detail: pass ? `${binary} found on PATH (harness: ${harness})` : `${binary} not found on PATH \u2014 install the "${harness}" harness`,
53
+ hard: true
54
+ };
61
55
  }
62
- export async function checkCredential(config, noPing) {
63
- let providerId = config.synth.provider;
64
- let creds;
65
- if (providerId) {
66
- creds = resolveCredentials(providerId, config.synth.base_url);
67
- }
68
- else {
69
- for (const id of AUTO_SELECT_PROVIDER_IDS) {
70
- const candidate = resolveCredentials(id, config.synth.base_url);
71
- if (candidate.source !== "none") {
72
- providerId = id;
73
- creds = candidate;
74
- break;
75
- }
76
- }
77
- if (!creds) {
78
- creds = { providerId: "ollama", source: "none" };
79
- providerId = "ollama";
80
- }
56
+ async function checkCredential(config, noPing) {
57
+ let providerId = config.synth.provider;
58
+ let creds;
59
+ if (providerId) {
60
+ creds = resolveCredentials(providerId, config.synth.base_url);
61
+ } else {
62
+ for (const id of AUTO_SELECT_PROVIDER_IDS) {
63
+ const candidate = resolveCredentials(id, config.synth.base_url);
64
+ if (candidate.source !== "none") {
65
+ providerId = id;
66
+ creds = candidate;
67
+ break;
68
+ }
81
69
  }
82
- if (creds.source === "none") {
83
- return {
84
- name: "LLM credential",
85
- pass: false,
86
- detail: "none (reports will be RAW harness pass-through) — not verified",
87
- hard: false,
88
- };
70
+ if (!creds) {
71
+ creds = { providerId: "ollama", source: "none" };
72
+ providerId = "ollama";
89
73
  }
90
- const providerName = LLM_PROVIDERS[providerId].name;
91
- if (noPing) {
92
- return {
93
- name: "LLM credential",
94
- pass: true,
95
- detail: `${providerName} (source: ${creds.source}) — ping skipped`,
96
- hard: false,
97
- };
98
- }
99
- const ping = await pingModel(providerId, config.synth.model, {
100
- apiKey: creds.apiKey,
101
- baseURL: creds.baseURL,
102
- });
103
- if (ping.success) {
104
- return {
105
- name: "LLM credential",
106
- pass: true,
107
- detail: `${providerName} (source: ${creds.source}) — ping OK`,
108
- hard: false,
109
- };
110
- }
111
- else {
112
- return {
113
- name: "LLM credential",
114
- pass: false,
115
- detail: `${providerName} (source: ${creds.source}) — ping failed: ${ping.error}`,
116
- hard: true,
117
- };
74
+ }
75
+ if (creds.source === "none") {
76
+ return {
77
+ name: "LLM credential",
78
+ pass: false,
79
+ detail: "none (reports will be RAW harness pass-through) \u2014 not verified",
80
+ hard: false
81
+ };
82
+ }
83
+ const providerName = LLM_PROVIDERS[providerId].name;
84
+ if (noPing) {
85
+ return {
86
+ name: "LLM credential",
87
+ pass: true,
88
+ detail: `${providerName} (source: ${creds.source}) \u2014 ping skipped`,
89
+ hard: false
90
+ };
91
+ }
92
+ const ping = await pingModel(
93
+ providerId,
94
+ config.synth.model,
95
+ {
96
+ apiKey: creds.apiKey,
97
+ baseURL: creds.baseURL
118
98
  }
99
+ );
100
+ if (ping.success) {
101
+ return {
102
+ name: "LLM credential",
103
+ pass: true,
104
+ detail: `${providerName} (source: ${creds.source}) \u2014 ping OK`,
105
+ hard: false
106
+ };
107
+ } else {
108
+ return {
109
+ name: "LLM credential",
110
+ pass: false,
111
+ detail: `${providerName} (source: ${creds.source}) \u2014 ping failed: ${ping.error}`,
112
+ hard: true
113
+ };
114
+ }
119
115
  }
120
116
  async function checkWorkspace(config) {
121
- const baseDir = resolveBaseDir(config.workspace.base_dir);
122
- try {
123
- await mkdir(baseDir, { recursive: true });
124
- await access(baseDir, fsConstants.W_OK);
125
- return {
126
- name: "Workspace",
127
- pass: true,
128
- detail: `${baseDir} is writable`,
129
- hard: false,
130
- };
131
- }
132
- catch {
133
- return {
134
- name: "Workspace",
135
- pass: false,
136
- detail: `${baseDir} is not writable — runs cannot persist here`,
137
- hard: false,
138
- };
139
- }
117
+ const baseDir = resolveBaseDir(config.workspace.dir);
118
+ try {
119
+ await mkdir(baseDir, { recursive: true });
120
+ await access(baseDir, fsConstants.W_OK);
121
+ return {
122
+ name: "Workspace",
123
+ pass: true,
124
+ detail: `${baseDir} is writable`,
125
+ hard: false
126
+ };
127
+ } catch {
128
+ return {
129
+ name: "Workspace",
130
+ pass: false,
131
+ detail: `${baseDir} is not writable \u2014 runs cannot persist here`,
132
+ hard: false
133
+ };
134
+ }
140
135
  }
141
- export function checkListenToken(config) {
142
- if (config.listen.token) {
143
- return {
144
- name: "Listen intake",
145
- pass: true,
146
- detail: `token configured; \`pl listen\` will serve on port ${config.listen.port}`,
147
- hard: false,
148
- };
149
- }
136
+ function checkListenToken(config) {
137
+ if (config.listen.token) {
150
138
  return {
151
- name: "Listen intake",
152
- pass: false,
153
- detail: "listen.token is unset — `pl listen` will refuse to start (set listen.token in prismalens.config.yaml)",
154
- hard: false,
139
+ name: "Listen intake",
140
+ pass: true,
141
+ detail: `token configured; \`pl listen\` will serve on port ${config.listen.port}`,
142
+ hard: false
155
143
  };
144
+ }
145
+ return {
146
+ name: "Listen intake",
147
+ pass: false,
148
+ detail: "listen.token is unset \u2014 `pl listen` will refuse to start (set listen.token in prismalens.config.yaml)",
149
+ hard: false
150
+ };
156
151
  }
157
- export default defineCommand({
158
- meta: {
159
- name: "doctor",
160
- description: "Preflight check the investigation environment\n\nExamples:\n $ pl doctor --no-ping",
161
- },
162
- args: {
163
- // citty models `--no-ping` as negation of a `ping` boolean — a literal
164
- // `noPing` arg would never receive it.
165
- ping: {
166
- type: "boolean",
167
- description: "Live-ping the LLM credential (disable with --no-ping)",
168
- default: true,
169
- },
170
- },
171
- async run({ args, cmd }) {
172
- try {
173
- assertKnownFlags(args, cmd);
174
- const config = await loadConfig();
175
- const harness = config.agent.default;
176
- const noPing = !args.ping;
177
- const checks = [
178
- checkHarness(harness),
179
- await checkCredential(config, noPing),
180
- await checkWorkspace(config),
181
- checkListenToken(config),
182
- ];
183
- consola.log("");
184
- for (const check of checks) {
185
- const line = `${check.name}: ${check.detail}`;
186
- if (check.pass)
187
- consola.success(line);
188
- else if (check.hard)
189
- consola.error(line);
190
- else
191
- consola.warn(line);
192
- }
193
- consola.log("");
194
- const hardFailures = checks.filter((c) => c.hard && !c.pass);
195
- if (hardFailures.length > 0) {
196
- consola.error(`${hardFailures.length} required check(s) failed — fix the above before investigating.`);
197
- process.exit(1);
198
- }
199
- consola.success("All required checks passed.");
200
- }
201
- catch (err) {
202
- consola.error(err instanceof Error ? err.message : String(err));
203
- process.exit(1);
204
- }
205
- },
152
+ var doctor_default = defineCommand({
153
+ meta: {
154
+ name: "doctor",
155
+ description: "Preflight check the investigation environment\n\nExamples:\n $ pl doctor --no-ping"
156
+ },
157
+ args: {
158
+ // citty models `--no-ping` as negation of a `ping` boolean — a literal
159
+ // `noPing` arg would never receive it.
160
+ ping: {
161
+ type: "boolean",
162
+ description: "Live-ping the LLM credential (disable with --no-ping)",
163
+ default: true
164
+ }
165
+ },
166
+ async run({ args, cmd }) {
167
+ try {
168
+ assertKnownFlags(args, cmd);
169
+ const config = await loadConfig();
170
+ const harness = config.agent.default;
171
+ const noPing = !args.ping;
172
+ const checks = [
173
+ checkHarness(harness),
174
+ await checkCredential(config, noPing),
175
+ await checkWorkspace(config),
176
+ checkListenToken(config)
177
+ ];
178
+ consola.log("");
179
+ for (const check of checks) {
180
+ const line = `${check.name}: ${check.detail}`;
181
+ if (check.pass) consola.success(line);
182
+ else if (check.hard) consola.error(line);
183
+ else consola.warn(line);
184
+ }
185
+ consola.log("");
186
+ const hardFailures = checks.filter((c) => c.hard && !c.pass);
187
+ if (hardFailures.length > 0) {
188
+ consola.error(
189
+ `${hardFailures.length} required check(s) failed \u2014 fix the above before investigating.`
190
+ );
191
+ process.exit(1);
192
+ }
193
+ consola.success("All required checks passed.");
194
+ } catch (err) {
195
+ consola.error(err instanceof Error ? err.message : String(err));
196
+ process.exit(1);
197
+ }
198
+ }
206
199
  });
207
- //# sourceMappingURL=doctor.js.map
200
+ export {
201
+ checkCredential,
202
+ checkListenToken,
203
+ doctor_default as default
204
+ };
@@ -1,29 +1,6 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- // Copyright 2026 Sumit Patel
3
- import consola from "consola";
4
- function kebabToCamel(str) {
5
- return str.replace(/-([a-z])/g, (_, g) => g.toUpperCase());
6
- }
7
- function camelToKebab(str) {
8
- return str.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
9
- }
10
- export function assertKnownFlags(args, cmd) {
11
- const declaredArgs = cmd?.args || {};
12
- const allowedKeys = new Set(["_"]);
13
- for (const key in declaredArgs) {
14
- if (Object.hasOwn(declaredArgs, key)) {
15
- allowedKeys.add(key);
16
- allowedKeys.add(kebabToCamel(key));
17
- allowedKeys.add(camelToKebab(key));
18
- }
19
- }
20
- for (const key in args) {
21
- if (Object.hasOwn(args, key)) {
22
- if (!allowedKeys.has(key)) {
23
- consola.error(`Unknown option: --${key}`);
24
- process.exit(1);
25
- }
26
- }
27
- }
28
- }
29
- //# sourceMappingURL=flags.js.map
1
+ import {
2
+ assertKnownFlags
3
+ } from "../../chunk-PTBCAI34.js";
4
+ export {
5
+ assertKnownFlags
6
+ };