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.
- package/README.md +29 -13
- package/dist/bin/prismalens.js +39 -50
- package/dist/chunk-2Z7QZSIS.js +20 -0
- package/dist/chunk-5BT3XQOG.js +2990 -0
- package/dist/chunk-6N4PHBII.js +30 -0
- package/dist/chunk-CTKCK7QT.js +387 -0
- package/dist/chunk-CVSS5JPC.js +130 -0
- package/dist/chunk-HPE5CTO4.js +22 -0
- package/dist/chunk-PTBCAI34.js +34 -0
- package/dist/chunk-PVQVFRIV.js +452 -0
- package/dist/chunk-QDK5PAI3.js +155 -0
- package/dist/chunk-SSEIMBQ2.js +204 -0
- package/dist/chunk-TGP6QTFO.js +156 -0
- package/dist/chunk-V6M6ISKI.js +161 -0
- package/dist/chunk-XH6DIKTA.js +83 -0
- package/dist/src/cli/auth.js +112 -101
- package/dist/src/cli/doctor.js +184 -187
- package/dist/src/cli/flags.js +6 -29
- package/dist/src/cli/grouping.js +16 -227
- package/dist/src/cli/init.js +58 -52
- package/dist/src/cli/investigate.js +23 -465
- package/dist/src/cli/listen.js +550 -286
- package/dist/src/cli/report.js +70 -67
- package/dist/src/cli/serve.js +260 -30
- package/dist/src/cli/status.js +87 -86
- package/package.json +16 -7
- package/dist/bin/prismalens.d.ts +0 -3
- package/dist/bin/prismalens.d.ts.map +0 -1
- package/dist/bin/prismalens.js.map +0 -1
- package/dist/src/cli/auth.d.ts +0 -3
- package/dist/src/cli/auth.d.ts.map +0 -1
- package/dist/src/cli/auth.js.map +0 -1
- package/dist/src/cli/doctor.d.ts +0 -18
- package/dist/src/cli/doctor.d.ts.map +0 -1
- package/dist/src/cli/doctor.js.map +0 -1
- package/dist/src/cli/flags.d.ts +0 -2
- package/dist/src/cli/flags.d.ts.map +0 -1
- package/dist/src/cli/flags.js.map +0 -1
- package/dist/src/cli/grouping.d.ts +0 -18
- package/dist/src/cli/grouping.d.ts.map +0 -1
- package/dist/src/cli/grouping.js.map +0 -1
- package/dist/src/cli/init.d.ts +0 -3
- package/dist/src/cli/init.d.ts.map +0 -1
- package/dist/src/cli/init.js.map +0 -1
- package/dist/src/cli/investigate.d.ts +0 -115
- package/dist/src/cli/investigate.d.ts.map +0 -1
- package/dist/src/cli/investigate.js.map +0 -1
- package/dist/src/cli/listen.d.ts +0 -56
- package/dist/src/cli/listen.d.ts.map +0 -1
- package/dist/src/cli/listen.js.map +0 -1
- package/dist/src/cli/report.d.ts +0 -24
- package/dist/src/cli/report.d.ts.map +0 -1
- package/dist/src/cli/report.js.map +0 -1
- package/dist/src/cli/serve.d.ts +0 -3
- package/dist/src/cli/serve.d.ts.map +0 -1
- package/dist/src/cli/serve.js.map +0 -1
- package/dist/src/cli/status.d.ts +0 -19
- package/dist/src/cli/status.d.ts.map +0 -1
- package/dist/src/cli/status.js.map +0 -1
- package/dist/src/config/loader.d.ts +0 -22
- package/dist/src/config/loader.d.ts.map +0 -1
- package/dist/src/config/loader.js +0 -193
- package/dist/src/config/loader.js.map +0 -1
- package/dist/src/config/schema.d.ts +0 -463
- package/dist/src/config/schema.d.ts.map +0 -1
- package/dist/src/config/schema.js +0 -217
- package/dist/src/config/schema.js.map +0 -1
- package/dist/src/core/caps.d.ts +0 -36
- package/dist/src/core/caps.d.ts.map +0 -1
- package/dist/src/core/caps.js +0 -36
- package/dist/src/core/caps.js.map +0 -1
- package/dist/src/core/db.d.ts +0 -3
- package/dist/src/core/db.d.ts.map +0 -1
- package/dist/src/core/db.js +0 -105
- package/dist/src/core/db.js.map +0 -1
- package/dist/src/core/detect-repo.d.ts +0 -4
- package/dist/src/core/detect-repo.d.ts.map +0 -1
- package/dist/src/core/detect-repo.js +0 -28
- package/dist/src/core/detect-repo.js.map +0 -1
- package/dist/src/core/file-session-store.d.ts +0 -10
- package/dist/src/core/file-session-store.d.ts.map +0 -1
- package/dist/src/core/file-session-store.js +0 -34
- package/dist/src/core/file-session-store.js.map +0 -1
- package/dist/src/core/parse-stdin.d.ts +0 -2
- package/dist/src/core/parse-stdin.d.ts.map +0 -1
- package/dist/src/core/parse-stdin.js +0 -21
- package/dist/src/core/parse-stdin.js.map +0 -1
- package/dist/src/core/run-investigation.d.ts +0 -54
- package/dist/src/core/run-investigation.d.ts.map +0 -1
- package/dist/src/core/run-investigation.js +0 -200
- package/dist/src/core/run-investigation.js.map +0 -1
- package/dist/src/core/session.d.ts +0 -63
- package/dist/src/core/session.d.ts.map +0 -1
- package/dist/src/core/session.js +0 -45
- package/dist/src/core/session.js.map +0 -1
- package/dist/src/core/slack-notify.d.ts +0 -9
- package/dist/src/core/slack-notify.d.ts.map +0 -1
- package/dist/src/core/slack-notify.js +0 -57
- package/dist/src/core/slack-notify.js.map +0 -1
- package/dist/src/core/sqlite-session-store.d.ts +0 -39
- package/dist/src/core/sqlite-session-store.d.ts.map +0 -1
- package/dist/src/core/sqlite-session-store.js +0 -239
- package/dist/src/core/sqlite-session-store.js.map +0 -1
- package/dist/src/http/server.d.ts +0 -31
- package/dist/src/http/server.d.ts.map +0 -1
- package/dist/src/http/server.js +0 -164
- package/dist/src/http/server.js.map +0 -1
- package/dist/src/jsonrpc/server.d.ts +0 -15
- package/dist/src/jsonrpc/server.d.ts.map +0 -1
- package/dist/src/jsonrpc/server.js +0 -244
- package/dist/src/jsonrpc/server.js.map +0 -1
- package/dist/src/jsonrpc/types.d.ts +0 -12
- package/dist/src/jsonrpc/types.d.ts.map +0 -1
- package/dist/src/jsonrpc/types.js +0 -4
- package/dist/src/jsonrpc/types.js.map +0 -1
- package/dist/src/version.d.ts +0 -8
- package/dist/src/version.d.ts.map +0 -1
- package/dist/src/version.js +0 -27
- package/dist/src/version.js.map +0 -1
package/dist/src/cli/auth.js
CHANGED
|
@@ -1,108 +1,119 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
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
|
-
|
|
117
|
+
export {
|
|
118
|
+
auth_default as default
|
|
119
|
+
};
|
package/dist/src/cli/doctor.js
CHANGED
|
@@ -1,207 +1,204 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
for (const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
49
45
|
}
|
|
50
46
|
function checkHarness(harness) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
|
83
|
-
|
|
84
|
-
|
|
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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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
|
-
|
|
142
|
-
|
|
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
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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
|
-
|
|
200
|
+
export {
|
|
201
|
+
checkCredential,
|
|
202
|
+
checkListenToken,
|
|
203
|
+
doctor_default as default
|
|
204
|
+
};
|
package/dist/src/cli/flags.js
CHANGED
|
@@ -1,29 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
+
};
|