@prism-d1/cli 1.9.1 → 1.10.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/dist/assets/github-workflows/prism-eval-gate-kiro.yml +57 -5
- package/dist/assets/gitlab-workflows/prism-eval-gate.yml +46 -7
- package/dist/bin/cli.d.ts +2 -0
- package/dist/bin/cli.d.ts.map +1 -0
- package/dist/bin/cli.js +19 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/bin/prism-cli.js +12 -17
- package/dist/bin/prism-cli.js.map +1 -1
- package/dist/src/commands/_top/dashboard.d.ts +2 -0
- package/dist/src/commands/_top/dashboard.d.ts.map +1 -1
- package/dist/src/commands/_top/dashboard.js +43 -15
- package/dist/src/commands/_top/dashboard.js.map +1 -1
- package/dist/src/commands/_top/mcp.d.ts.map +1 -1
- package/dist/src/commands/_top/mcp.js +3 -15
- package/dist/src/commands/_top/mcp.js.map +1 -1
- package/dist/src/commands/_top/statusline.d.ts +13 -0
- package/dist/src/commands/_top/statusline.d.ts.map +1 -0
- package/dist/src/commands/_top/statusline.js +12 -0
- package/dist/src/commands/_top/statusline.js.map +1 -0
- package/dist/src/commands/_top/version.d.ts +2 -0
- package/dist/src/commands/_top/version.d.ts.map +1 -1
- package/dist/src/commands/_top/version.js +4 -0
- package/dist/src/commands/_top/version.js.map +1 -1
- package/dist/src/commands/assessment/deploy-cdk.js +1 -1
- package/dist/src/commands/assessment/deploy-cdk.js.map +1 -1
- package/dist/src/commands/enable/claude-code.d.ts +81 -0
- package/dist/src/commands/enable/claude-code.d.ts.map +1 -0
- package/dist/src/commands/enable/claude-code.js +381 -0
- package/dist/src/commands/enable/claude-code.js.map +1 -0
- package/dist/src/dashboard/page.d.ts +25 -0
- package/dist/src/dashboard/page.d.ts.map +1 -1
- package/dist/src/dashboard/page.js +66 -7
- package/dist/src/dashboard/page.js.map +1 -1
- package/dist/src/dashboard/setup-page.d.ts +1 -1
- package/dist/src/dashboard/setup-page.d.ts.map +1 -1
- package/dist/src/dashboard/setup-page.js +15 -2
- package/dist/src/dashboard/setup-page.js.map +1 -1
- package/dist/src/dashboard/snapshot.d.ts +31 -0
- package/dist/src/dashboard/snapshot.d.ts.map +1 -0
- package/dist/src/dashboard/snapshot.js +65 -0
- package/dist/src/dashboard/snapshot.js.map +1 -0
- package/dist/src/mcp/dashboard-process.d.ts +83 -0
- package/dist/src/mcp/dashboard-process.d.ts.map +1 -0
- package/dist/src/mcp/dashboard-process.js +184 -0
- package/dist/src/mcp/dashboard-process.js.map +1 -0
- package/dist/src/mcp/server.d.ts.map +1 -1
- package/dist/src/mcp/server.js +8 -3
- package/dist/src/mcp/server.js.map +1 -1
- package/dist/src/mcp/tools.d.ts +7 -1
- package/dist/src/mcp/tools.d.ts.map +1 -1
- package/dist/src/mcp/tools.js +100 -2
- package/dist/src/mcp/tools.js.map +1 -1
- package/dist/src/statusline/statusline.d.ts +135 -0
- package/dist/src/statusline/statusline.d.ts.map +1 -0
- package/dist/src/statusline/statusline.js +398 -0
- package/dist/src/statusline/statusline.js.map +1 -0
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ const SHELL = process.platform === 'win32' ? undefined : '/bin/bash';
|
|
|
9
9
|
export default {
|
|
10
10
|
description: 'Deploy the assessment web app to AWS via CDK (ECS + Cognito + ALB)',
|
|
11
11
|
options: [
|
|
12
|
-
{ flags: '--hosted-zone <domain>', description: 'Route53 hosted zone domain (e.g. prism.
|
|
12
|
+
{ flags: '--hosted-zone <domain>', description: 'Route53 hosted zone domain (e.g. prism.example.com)' },
|
|
13
13
|
{ flags: '--subdomain <name>', description: 'Subdomain for the app', default: 'assessment' },
|
|
14
14
|
{ flags: '--certificate-arn <arn>', description: 'ACM certificate ARN (auto-created if omitted)' },
|
|
15
15
|
{ flags: '--profile <name>', description: 'AWS CLI profile' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy-cdk.js","sourceRoot":"","sources":["../../../../src/commands/assessment/deploy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M,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,iCAAiC,CAAC;QAEvF,MAAM,GAAG,GAAG,WAAW,MAAM,IAAI,WAAW,IAAI,UAAU,EAAE,CAAC;QAC7D,OAAO,CAAC,GAAG,CAAC,gBAAgB,GAAG,kBAAkB,MAAM,IAAI,CAAC,CAAC;QAE7D,QAAQ,CAAC,GAAG,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export declare const PLUGIN_ID = "prism@prism-d1-velocity";
|
|
2
|
+
export declare const PLUGIN_HINT: string[];
|
|
3
|
+
export declare const REFRESH_INTERVAL_S = 60;
|
|
4
|
+
export declare const BACKUP_PREFIX = "settings.json.bak-";
|
|
5
|
+
/** The PATH a process started outside a login shell usually has (a desktop launcher, an IDE). */
|
|
6
|
+
export declare const NON_INTERACTIVE_PATH: string;
|
|
7
|
+
export interface ClaudeCodeOptions {
|
|
8
|
+
yes?: boolean;
|
|
9
|
+
dryRun?: boolean;
|
|
10
|
+
status?: boolean;
|
|
11
|
+
uninstall?: boolean;
|
|
12
|
+
replace?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface ClaudeCodeDeps {
|
|
15
|
+
home: string;
|
|
16
|
+
env: NodeJS.ProcessEnv;
|
|
17
|
+
cwd: string;
|
|
18
|
+
/** The status line command to install (statuslineCommand()). */
|
|
19
|
+
command: string;
|
|
20
|
+
isTTY: boolean;
|
|
21
|
+
ask: (question: string) => Promise<string>;
|
|
22
|
+
log: (line?: string) => void;
|
|
23
|
+
error: (line: string) => void;
|
|
24
|
+
now: () => Date;
|
|
25
|
+
}
|
|
26
|
+
export interface StatusLine {
|
|
27
|
+
type?: string;
|
|
28
|
+
command?: string;
|
|
29
|
+
[k: string]: unknown;
|
|
30
|
+
}
|
|
31
|
+
/** Where Claude Code keeps its user settings: CLAUDE_CONFIG_DIR, else ~/.claude. */
|
|
32
|
+
export declare function configDir(env: NodeJS.ProcessEnv, home: string): string;
|
|
33
|
+
/** Claude Code's global state file (MCP servers in user scope): `<CLAUDE_CONFIG_DIR>/.claude.json`, else `~/.claude.json`. */
|
|
34
|
+
export declare function globalConfigFile(env: NodeJS.ProcessEnv, home: string): string;
|
|
35
|
+
/** True for a status line this command wrote (any prism-cli path, any flags). */
|
|
36
|
+
export declare function isPrismStatusLine(s: unknown): boolean;
|
|
37
|
+
export declare function desiredStatusLine(command: string): StatusLine;
|
|
38
|
+
/** Single-quotes a path for the shell Claude Code runs the command with, when it needs it. */
|
|
39
|
+
export declare function shQuote(p: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* `prism-cli statusline` when this prism-cli, and node, are on the PATH a
|
|
42
|
+
* non-interactive process has; else the absolute node and entry script, so an
|
|
43
|
+
* nvm or Volta install still works when Claude Code starts without the shell's PATH.
|
|
44
|
+
*/
|
|
45
|
+
export declare function statuslineCommand(o: {
|
|
46
|
+
ownPackageDir: string;
|
|
47
|
+
execPath: string;
|
|
48
|
+
entry: string;
|
|
49
|
+
systemPath?: string;
|
|
50
|
+
}): string;
|
|
51
|
+
/** `obj` with statusLine set (kept in place when present, else appended) or removed. */
|
|
52
|
+
export declare function withStatusLine(obj: Record<string, unknown>, s: StatusLine | null): Record<string, unknown>;
|
|
53
|
+
export declare const render: (obj: Record<string, unknown>) => string;
|
|
54
|
+
/** A unified-style line diff (LCS); settings files are small. */
|
|
55
|
+
export declare function lineDiff(a: string, b: string, label: string): string[];
|
|
56
|
+
/** The statusLine PRISM replaced: walk backups newest first, skipping ones that hold PRISM's own. */
|
|
57
|
+
export declare function previousStatusLine(dir: string): {
|
|
58
|
+
file: string;
|
|
59
|
+
statusLine: StatusLine | null;
|
|
60
|
+
} | null;
|
|
61
|
+
export interface PluginState {
|
|
62
|
+
installed: boolean;
|
|
63
|
+
enabled: boolean | null;
|
|
64
|
+
version: string | null;
|
|
65
|
+
}
|
|
66
|
+
/** From `<config>/plugins/installed_plugins.json` and `enabledPlugins` in settings.json. */
|
|
67
|
+
export declare function pluginState(dir: string, settings: Record<string, unknown>): PluginState;
|
|
68
|
+
/** Where a `prism-cli mcp` server is configured: user scope in the global config, this repo's .mcp.json. */
|
|
69
|
+
export declare function mcpServers(globalFile: string, cwd: string): string[];
|
|
70
|
+
export declare function enableClaudeCode(opts: ClaudeCodeOptions, d: ClaudeCodeDeps): Promise<number>;
|
|
71
|
+
export declare function defaultDeps(): ClaudeCodeDeps;
|
|
72
|
+
declare const _default: {
|
|
73
|
+
description: string;
|
|
74
|
+
options: {
|
|
75
|
+
flags: string;
|
|
76
|
+
description: string;
|
|
77
|
+
}[];
|
|
78
|
+
action: (opts: ClaudeCodeOptions) => Promise<void>;
|
|
79
|
+
};
|
|
80
|
+
export default _default;
|
|
81
|
+
//# sourceMappingURL=claude-code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../../../src/commands/enable/claude-code.ts"],"names":[],"mappings":"AA2BA,eAAO,MAAM,SAAS,4BAA4B,CAAC;AACnD,eAAO,MAAM,WAAW,UAGvB,CAAC;AACF,eAAO,MAAM,kBAAkB,KAAK,CAAC;AACrC,eAAO,MAAM,aAAa,uBAAuB,CAAC;AAClD,iGAAiG;AACjG,eAAO,MAAM,oBAAoB,QAA8E,CAAC;AAEhH,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM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Claude Code plugin cannot set `statusLine` (plugin settings only apply
|
|
6
|
+
* `agent` and `subagentStatusLine`), so this is the one place that writes the
|
|
7
|
+
* user's Claude Code settings: `$CLAUDE_CONFIG_DIR/settings.json`, else
|
|
8
|
+
* `~/.claude/settings.json`, the same file Claude Code reads.
|
|
9
|
+
*
|
|
10
|
+
* Before a write it prints the plan and a diff, asks (or takes --yes), and
|
|
11
|
+
* copies the file to `settings.json.bak-<timestamp>`. Only the `statusLine`
|
|
12
|
+
* key changes; every other key is kept in order and the file is rewritten
|
|
13
|
+
* as 2-space JSON. A status line that is not PRISM's is shown and left alone
|
|
14
|
+
* unless --replace. --uninstall removes PRISM's status line and puts back the
|
|
15
|
+
* one it replaced, read from the newest backup that holds one.
|
|
16
|
+
*
|
|
17
|
+
* It never installs the plugin; it prints the /plugin commands.
|
|
18
|
+
*/
|
|
19
|
+
import { createInterface } from 'node:readline';
|
|
20
|
+
import { chmodSync, copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, realpathSync, renameSync, statSync, writeFileSync } from 'node:fs';
|
|
21
|
+
import { homedir } from 'node:os';
|
|
22
|
+
import { delimiter, dirname, join, resolve } from 'node:path';
|
|
23
|
+
import { fileURLToPath } from 'node:url';
|
|
24
|
+
import { findPackageDir, installsOnPath } from '../_top/version.js';
|
|
25
|
+
import { findOnPath } from '../../utils/tool-check.js';
|
|
26
|
+
import { runGuarded } from './security.js';
|
|
27
|
+
export const PLUGIN_ID = 'prism@prism-d1-velocity';
|
|
28
|
+
export const PLUGIN_HINT = [
|
|
29
|
+
'/plugin marketplace add aws-samples/sample-prism-d1-velocity',
|
|
30
|
+
'/plugin install prism@prism-d1-velocity',
|
|
31
|
+
];
|
|
32
|
+
export const REFRESH_INTERVAL_S = 60;
|
|
33
|
+
export const BACKUP_PREFIX = 'settings.json.bak-';
|
|
34
|
+
/** The PATH a process started outside a login shell usually has (a desktop launcher, an IDE). */
|
|
35
|
+
export const NON_INTERACTIVE_PATH = ['/usr/local/bin', '/opt/homebrew/bin', '/usr/bin', '/bin'].join(delimiter);
|
|
36
|
+
/** Where Claude Code keeps its user settings: CLAUDE_CONFIG_DIR, else ~/.claude. */
|
|
37
|
+
export function configDir(env, home) {
|
|
38
|
+
return env.CLAUDE_CONFIG_DIR ? resolve(env.CLAUDE_CONFIG_DIR) : join(home, '.claude');
|
|
39
|
+
}
|
|
40
|
+
/** Claude Code's global state file (MCP servers in user scope): `<CLAUDE_CONFIG_DIR>/.claude.json`, else `~/.claude.json`. */
|
|
41
|
+
export function globalConfigFile(env, home) {
|
|
42
|
+
return env.CLAUDE_CONFIG_DIR ? join(resolve(env.CLAUDE_CONFIG_DIR), '.claude.json') : join(home, '.claude.json');
|
|
43
|
+
}
|
|
44
|
+
/** True for a status line this command wrote (any prism-cli path, any flags). */
|
|
45
|
+
export function isPrismStatusLine(s) {
|
|
46
|
+
const c = s && typeof s === 'object' ? s.command : undefined;
|
|
47
|
+
return typeof c === 'string' && /prism-cli(\.js)?['"]?\s+statusline\b/.test(c);
|
|
48
|
+
}
|
|
49
|
+
export function desiredStatusLine(command) {
|
|
50
|
+
return { type: 'command', command, refreshInterval: REFRESH_INTERVAL_S };
|
|
51
|
+
}
|
|
52
|
+
/** Single-quotes a path for the shell Claude Code runs the command with, when it needs it. */
|
|
53
|
+
export function shQuote(p) {
|
|
54
|
+
return /^[A-Za-z0-9_./:@%+=-]+$/.test(p) ? p : `'${p.replace(/'/g, `'\\''`)}'`;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* `prism-cli statusline` when this prism-cli, and node, are on the PATH a
|
|
58
|
+
* non-interactive process has; else the absolute node and entry script, so an
|
|
59
|
+
* nvm or Volta install still works when Claude Code starts without the shell's PATH.
|
|
60
|
+
*/
|
|
61
|
+
export function statuslineCommand(o) {
|
|
62
|
+
const sys = o.systemPath ?? NON_INTERACTIVE_PATH;
|
|
63
|
+
const first = installsOnPath(sys, o.ownPackageDir)[0];
|
|
64
|
+
if (first?.isThis && findOnPath('node', sys))
|
|
65
|
+
return 'prism-cli statusline';
|
|
66
|
+
return `${shQuote(o.execPath)} ${shQuote(o.entry)} statusline`;
|
|
67
|
+
}
|
|
68
|
+
function readSettings(path) {
|
|
69
|
+
if (!existsSync(path))
|
|
70
|
+
return { path, exists: false, text: '', json: {} };
|
|
71
|
+
const text = readFileSync(path, 'utf8');
|
|
72
|
+
let json;
|
|
73
|
+
try {
|
|
74
|
+
json = text.trim() ? JSON.parse(text) : {};
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
throw new UserError(`${path} is not valid JSON (${String(e?.message || e).split('\n')[0]}); fix it first. Nothing was changed.`);
|
|
78
|
+
}
|
|
79
|
+
if (!json || typeof json !== 'object' || Array.isArray(json))
|
|
80
|
+
throw new UserError(`${path} does not hold a JSON object. Nothing was changed.`);
|
|
81
|
+
return { path, exists: true, text, json: json };
|
|
82
|
+
}
|
|
83
|
+
class UserError extends Error {
|
|
84
|
+
}
|
|
85
|
+
/** `obj` with statusLine set (kept in place when present, else appended) or removed. */
|
|
86
|
+
export function withStatusLine(obj, s) {
|
|
87
|
+
const out = {};
|
|
88
|
+
let placed = false;
|
|
89
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
90
|
+
if (k === 'statusLine') {
|
|
91
|
+
if (s)
|
|
92
|
+
out[k] = s;
|
|
93
|
+
placed = true;
|
|
94
|
+
continue;
|
|
95
|
+
}
|
|
96
|
+
out[k] = v;
|
|
97
|
+
}
|
|
98
|
+
if (s && !placed)
|
|
99
|
+
out.statusLine = s;
|
|
100
|
+
return out;
|
|
101
|
+
}
|
|
102
|
+
export const render = (obj) => JSON.stringify(obj, null, 2) + '\n';
|
|
103
|
+
/** A unified-style line diff (LCS); settings files are small. */
|
|
104
|
+
export function lineDiff(a, b, label) {
|
|
105
|
+
const x = a ? a.replace(/\n$/, '').split('\n') : [];
|
|
106
|
+
const y = b.replace(/\n$/, '').split('\n');
|
|
107
|
+
const n = x.length, m = y.length;
|
|
108
|
+
const L = Array.from({ length: n + 1 }, () => new Array(m + 1).fill(0));
|
|
109
|
+
for (let i = n - 1; i >= 0; i--)
|
|
110
|
+
for (let j = m - 1; j >= 0; j--)
|
|
111
|
+
L[i][j] = x[i] === y[j] ? L[i + 1][j + 1] + 1 : Math.max(L[i + 1][j], L[i][j + 1]);
|
|
112
|
+
const out = [`--- ${label}`, `+++ ${label}`];
|
|
113
|
+
let i = 0, j = 0;
|
|
114
|
+
while (i < n || j < m) {
|
|
115
|
+
if (i < n && j < m && x[i] === y[j]) {
|
|
116
|
+
out.push(` ${x[i]}`);
|
|
117
|
+
i++;
|
|
118
|
+
j++;
|
|
119
|
+
}
|
|
120
|
+
else if (i < n && (j === m || L[i + 1][j] >= L[i][j + 1]))
|
|
121
|
+
out.push(`- ${x[i++]}`);
|
|
122
|
+
else
|
|
123
|
+
out.push(`+ ${y[j++]}`);
|
|
124
|
+
}
|
|
125
|
+
return out;
|
|
126
|
+
}
|
|
127
|
+
const stamp = (d) => d.toISOString().replace(/[-:]/g, '').replace(/\.\d+Z$/, 'Z');
|
|
128
|
+
/** Copies settings.json to settings.json.bak-<timestamp> (mode 0600); returns its path. */
|
|
129
|
+
function backup(path, now) {
|
|
130
|
+
let b = join(dirname(path), `${BACKUP_PREFIX}${stamp(now)}`);
|
|
131
|
+
for (let n = 1; existsSync(b); n++)
|
|
132
|
+
b = join(dirname(path), `${BACKUP_PREFIX}${stamp(now)}-${n}`);
|
|
133
|
+
copyFileSync(path, b);
|
|
134
|
+
chmodSync(b, 0o600);
|
|
135
|
+
return b;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Writes beside the file and renames it into place, keeping the file's mode
|
|
139
|
+
* (0600 for a new file). A symlinked settings.json (a dotfiles repo) is
|
|
140
|
+
* written at its target, so the link stays a link.
|
|
141
|
+
*/
|
|
142
|
+
function writeAtomic(link, text) {
|
|
143
|
+
let path = link;
|
|
144
|
+
try {
|
|
145
|
+
path = realpathSync(link);
|
|
146
|
+
}
|
|
147
|
+
catch { /* new file */ }
|
|
148
|
+
mkdirSync(dirname(path), { recursive: true, mode: 0o700 });
|
|
149
|
+
const mode = existsSync(path) ? statSync(path).mode & 0o777 : 0o600;
|
|
150
|
+
const tmp = `${path}.tmp-${process.pid}`;
|
|
151
|
+
writeFileSync(tmp, text, { mode });
|
|
152
|
+
chmodSync(tmp, mode);
|
|
153
|
+
renameSync(tmp, path);
|
|
154
|
+
}
|
|
155
|
+
/** The statusLine PRISM replaced: walk backups newest first, skipping ones that hold PRISM's own. */
|
|
156
|
+
export function previousStatusLine(dir) {
|
|
157
|
+
let names;
|
|
158
|
+
try {
|
|
159
|
+
names = readdirSync(dir).filter((n) => n.startsWith(BACKUP_PREFIX)).sort().reverse();
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
for (const n of names) {
|
|
165
|
+
let j; // any: a backup of a JSON settings file, checked below.
|
|
166
|
+
try {
|
|
167
|
+
j = JSON.parse(readFileSync(join(dir, n), 'utf8'));
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
if (!j || typeof j !== 'object')
|
|
173
|
+
continue;
|
|
174
|
+
const s = j.statusLine;
|
|
175
|
+
if (s && isPrismStatusLine(s))
|
|
176
|
+
continue;
|
|
177
|
+
return { file: join(dir, n), statusLine: s && typeof s === 'object' ? s : null };
|
|
178
|
+
}
|
|
179
|
+
return null;
|
|
180
|
+
}
|
|
181
|
+
// ------------------------------------------------------------ plugin and MCP detection (read-only)
|
|
182
|
+
function readJson(path) {
|
|
183
|
+
try {
|
|
184
|
+
return JSON.parse(readFileSync(path, 'utf8'));
|
|
185
|
+
}
|
|
186
|
+
catch {
|
|
187
|
+
return null;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
/** From `<config>/plugins/installed_plugins.json` and `enabledPlugins` in settings.json. */
|
|
191
|
+
export function pluginState(dir, settings) {
|
|
192
|
+
const j = readJson(join(dir, 'plugins', 'installed_plugins.json'));
|
|
193
|
+
const entries = j?.plugins?.[PLUGIN_ID];
|
|
194
|
+
const list = Array.isArray(entries) ? entries : [];
|
|
195
|
+
const enabledMap = settings.enabledPlugins;
|
|
196
|
+
const enabled = enabledMap && typeof enabledMap === 'object' && PLUGIN_ID in enabledMap ? enabledMap[PLUGIN_ID] === true : null;
|
|
197
|
+
return { installed: list.length > 0, enabled, version: typeof list[0]?.version === 'string' ? list[0].version : null };
|
|
198
|
+
}
|
|
199
|
+
const runsPrismMcp = (s) => s && typeof s === 'object' && /prism-cli/.test(String(s.command ?? '')) && [s.command, ...(Array.isArray(s.args) ? s.args : [])].join(' ').includes('mcp');
|
|
200
|
+
/** Where a `prism-cli mcp` server is configured: user scope in the global config, this repo's .mcp.json. */
|
|
201
|
+
export function mcpServers(globalFile, cwd) {
|
|
202
|
+
const out = [];
|
|
203
|
+
const g = readJson(globalFile);
|
|
204
|
+
for (const [name, s] of Object.entries(g?.mcpServers ?? {}))
|
|
205
|
+
if (runsPrismMcp(s))
|
|
206
|
+
out.push(`user scope: ${name}`);
|
|
207
|
+
const p = readJson(join(cwd, '.mcp.json'));
|
|
208
|
+
for (const [name, s] of Object.entries(p?.mcpServers ?? {}))
|
|
209
|
+
if (runsPrismMcp(s))
|
|
210
|
+
out.push(`project .mcp.json: ${name}`);
|
|
211
|
+
return out;
|
|
212
|
+
}
|
|
213
|
+
// ------------------------------------------------------------ main
|
|
214
|
+
const yes = (a) => ['y', 'yes'].includes(a.trim().toLowerCase());
|
|
215
|
+
async function confirm(question, opts, d) {
|
|
216
|
+
if (opts.yes)
|
|
217
|
+
return true;
|
|
218
|
+
if (!d.isTTY) {
|
|
219
|
+
d.error('Error: no terminal to confirm. Re-run with --yes, or --dry-run to see the plan.');
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
if (yes(await d.ask(question)))
|
|
223
|
+
return true;
|
|
224
|
+
d.error('Nothing changed.');
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
function tilde(p, home) {
|
|
228
|
+
return p === home || p.startsWith(home + '/') ? '~' + p.slice(home.length) : p;
|
|
229
|
+
}
|
|
230
|
+
function pluginHint(state, d) {
|
|
231
|
+
if (state.installed && state.enabled !== false)
|
|
232
|
+
return;
|
|
233
|
+
d.log(state.installed ? '\n The PRISM plugin is installed but disabled: /plugin enable prism@prism-d1-velocity' : '\n The PRISM plugin (slash commands, MCP tools, a findings summary at session start) is not installed. In Claude Code:');
|
|
234
|
+
if (!state.installed)
|
|
235
|
+
for (const l of PLUGIN_HINT)
|
|
236
|
+
d.log(` ${l}`);
|
|
237
|
+
}
|
|
238
|
+
function showStatus(s, dir, d) {
|
|
239
|
+
const sl = s.json.statusLine;
|
|
240
|
+
const plugin = pluginState(dir, s.json);
|
|
241
|
+
const mcp = mcpServers(globalConfigFile(d.env, d.home), d.cwd);
|
|
242
|
+
d.log('\n📊 Claude Code status\n');
|
|
243
|
+
d.log(` Settings: ${tilde(s.path, d.home)}${s.exists ? '' : ' (does not exist yet)'}${d.env.CLAUDE_CONFIG_DIR ? ' (CLAUDE_CONFIG_DIR)' : ''}`);
|
|
244
|
+
d.log(` Status line: ${!sl ? 'not set' : isPrismStatusLine(sl) ? `PRISM: ${String(sl.command)}` : `another one: ${JSON.stringify(sl)}`}`);
|
|
245
|
+
if (sl && isPrismStatusLine(sl) && sl.command !== d.command)
|
|
246
|
+
d.log(` (this prism-cli would write: ${d.command})`);
|
|
247
|
+
d.log(` Plugin: ${plugin.installed ? `${PLUGIN_ID}${plugin.version ? ` ${plugin.version}` : ''}${plugin.enabled === false ? ' (disabled)' : ''}` : 'not installed'}`);
|
|
248
|
+
d.log(` MCP server: ${plugin.installed ? 'from the plugin (plugin:prism:prism)' : ''}${mcp.length ? `${plugin.installed ? '; also ' : ''}${mcp.join(', ')}` : plugin.installed ? '' : 'not configured'}`);
|
|
249
|
+
if (plugin.installed && mcp.length)
|
|
250
|
+
d.log(' The plugin already runs prism-cli mcp; remove the other entry (claude mcp remove <name>) so tools are not listed twice.');
|
|
251
|
+
pluginHint(plugin, d);
|
|
252
|
+
if (!sl || !isPrismStatusLine(sl))
|
|
253
|
+
d.log('\n → prism-cli enable claude-code');
|
|
254
|
+
d.log('');
|
|
255
|
+
return 0;
|
|
256
|
+
}
|
|
257
|
+
async function apply(s, next, title, opts, d) {
|
|
258
|
+
const text = render(next);
|
|
259
|
+
d.log('');
|
|
260
|
+
for (const l of lineDiff(s.text, text, tilde(s.path, d.home)))
|
|
261
|
+
d.log(` ${l}`);
|
|
262
|
+
d.log(`\n ${s.exists ? `A copy of the current file is saved first as ${BACKUP_PREFIX}<timestamp>.` : 'The file is created (mode 0600).'} Other keys are kept; the file is rewritten as 2-space JSON.`);
|
|
263
|
+
if (opts.dryRun) {
|
|
264
|
+
d.log('\n Dry run: nothing was written. Re-run without --dry-run to apply.\n');
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
if (!await confirm(`\n ${title}? [y/N] `, opts, d))
|
|
268
|
+
return false;
|
|
269
|
+
if (s.exists)
|
|
270
|
+
d.log(` ✓ Backup: ${tilde(backup(s.path, d.now()), d.home)}`);
|
|
271
|
+
writeAtomic(s.path, text);
|
|
272
|
+
d.log(` ✓ Wrote ${tilde(s.path, d.home)}`);
|
|
273
|
+
return true;
|
|
274
|
+
}
|
|
275
|
+
async function uninstall(s, dir, opts, d) {
|
|
276
|
+
const sl = s.json.statusLine;
|
|
277
|
+
d.log(opts.dryRun ? '\n🔌 enable claude-code --uninstall: dry run, nothing is changed\n' : '\n🔌 enable claude-code --uninstall\n');
|
|
278
|
+
if (!sl) {
|
|
279
|
+
d.log(' No status line is set. Nothing to remove.\n');
|
|
280
|
+
return 0;
|
|
281
|
+
}
|
|
282
|
+
if (!isPrismStatusLine(sl)) {
|
|
283
|
+
d.log(` The status line is not PRISM's, so it is left alone: ${JSON.stringify(sl)}\n`);
|
|
284
|
+
return 0;
|
|
285
|
+
}
|
|
286
|
+
const prev = previousStatusLine(dir);
|
|
287
|
+
const restore = prev?.statusLine ?? null;
|
|
288
|
+
d.log(restore ? ` Plan: put back the status line PRISM replaced (from ${tilde(prev.file, d.home)}): ${JSON.stringify(restore)}` : ' Plan: remove PRISM\'s status line (there was none before it).');
|
|
289
|
+
if (!await apply(s, withStatusLine(s.json, restore), restore ? 'Restore it' : 'Remove it', opts, d))
|
|
290
|
+
return opts.dryRun ? 0 : 1;
|
|
291
|
+
d.log(' Claude Code picks the change up on its next status line update.\n');
|
|
292
|
+
return 0;
|
|
293
|
+
}
|
|
294
|
+
export async function enableClaudeCode(opts, d) {
|
|
295
|
+
if (opts.replace && (opts.uninstall || opts.status)) {
|
|
296
|
+
d.error('Error: --replace only applies when installing.');
|
|
297
|
+
return 1;
|
|
298
|
+
}
|
|
299
|
+
const dir = configDir(d.env, d.home);
|
|
300
|
+
let s;
|
|
301
|
+
try {
|
|
302
|
+
s = readSettings(join(dir, 'settings.json'));
|
|
303
|
+
}
|
|
304
|
+
catch (e) {
|
|
305
|
+
if (e instanceof UserError) {
|
|
306
|
+
d.error(`Error: ${e.message}`);
|
|
307
|
+
return 1;
|
|
308
|
+
}
|
|
309
|
+
throw e;
|
|
310
|
+
}
|
|
311
|
+
if (opts.status)
|
|
312
|
+
return showStatus(s, dir, d);
|
|
313
|
+
if (opts.uninstall)
|
|
314
|
+
return uninstall(s, dir, opts, d);
|
|
315
|
+
const want = desiredStatusLine(d.command);
|
|
316
|
+
const cur = s.json.statusLine;
|
|
317
|
+
d.log(opts.dryRun ? '\n🔌 enable claude-code: dry run, nothing is changed\n' : '\n🔌 enable claude-code\n');
|
|
318
|
+
d.log(` Settings: ${tilde(s.path, d.home)}${s.exists ? '' : ' (new file)'}`);
|
|
319
|
+
d.log(` Command: ${d.command}${d.command === 'prism-cli statusline' ? '' : '\n (absolute paths: prism-cli is not on the PATH Claude Code may start with, e.g. an nvm or Volta install)'}`);
|
|
320
|
+
const plugin = pluginState(dir, s.json);
|
|
321
|
+
if (cur && JSON.stringify(cur) === JSON.stringify(want)) {
|
|
322
|
+
d.log(' Plan: already set; nothing to do.');
|
|
323
|
+
pluginHint(plugin, d);
|
|
324
|
+
d.log('');
|
|
325
|
+
return 0;
|
|
326
|
+
}
|
|
327
|
+
if (cur && !isPrismStatusLine(cur)) {
|
|
328
|
+
d.log(` Existing status line (not PRISM's): ${JSON.stringify(cur)}`);
|
|
329
|
+
if (!opts.replace) {
|
|
330
|
+
d.error(' Refusing to replace it. Re-run with --replace (it is kept in the backup, and --uninstall puts it back).');
|
|
331
|
+
return 1;
|
|
332
|
+
}
|
|
333
|
+
d.log(' Plan: replace it with PRISM\'s (--replace); --uninstall puts it back.');
|
|
334
|
+
}
|
|
335
|
+
else {
|
|
336
|
+
d.log(` Plan: ${cur ? 'update PRISM\'s status line' : 'add a statusLine entry'}: ${JSON.stringify(want)}`);
|
|
337
|
+
}
|
|
338
|
+
if (!await apply(s, withStatusLine(s.json, want), 'Write it', opts, d))
|
|
339
|
+
return opts.dryRun ? 0 : 1;
|
|
340
|
+
d.log('\n Claude Code shows it on its next status line update (a new session, or after the next message).');
|
|
341
|
+
d.log(' Check: prism-cli enable claude-code --status');
|
|
342
|
+
d.log(' Remove: prism-cli enable claude-code --uninstall');
|
|
343
|
+
pluginHint(plugin, d);
|
|
344
|
+
d.log('');
|
|
345
|
+
return 0;
|
|
346
|
+
}
|
|
347
|
+
export function defaultDeps() {
|
|
348
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
349
|
+
const ownPackageDir = findPackageDir(here) ?? process.cwd();
|
|
350
|
+
let entry = process.argv[1] ? resolve(process.argv[1]) : join(ownPackageDir, 'dist', 'bin', 'prism-cli.js');
|
|
351
|
+
try {
|
|
352
|
+
entry = realpathSync(entry);
|
|
353
|
+
}
|
|
354
|
+
catch { /* keep as is */ }
|
|
355
|
+
return {
|
|
356
|
+
home: homedir(),
|
|
357
|
+
env: process.env,
|
|
358
|
+
cwd: process.cwd(),
|
|
359
|
+
command: statuslineCommand({ ownPackageDir, execPath: process.execPath, entry }),
|
|
360
|
+
isTTY: !!(process.stdin.isTTY && process.stdout.isTTY),
|
|
361
|
+
ask: (q) => new Promise((done) => {
|
|
362
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
363
|
+
rl.question(q, (a) => { rl.close(); done(a.trim()); });
|
|
364
|
+
}),
|
|
365
|
+
log: (line = '') => console.log(line),
|
|
366
|
+
error: (line) => console.error(line),
|
|
367
|
+
now: () => new Date(),
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
export default {
|
|
371
|
+
description: 'Set Claude Code\'s status line to prism-cli statusline in your Claude Code user settings (CLAUDE_CONFIG_DIR respected), after a diff, a backup and your confirmation',
|
|
372
|
+
options: [
|
|
373
|
+
{ flags: '--yes', description: 'Do not ask before writing settings.json' },
|
|
374
|
+
{ flags: '--dry-run', description: 'Print the plan and the diff; write nothing' },
|
|
375
|
+
{ flags: '--replace', description: 'Replace a status line that is not PRISM\'s (it is kept in the backup; --uninstall puts it back)' },
|
|
376
|
+
{ flags: '--status', description: 'Show the status line, the PRISM plugin and the prism-cli MCP server configuration (read-only)' },
|
|
377
|
+
{ flags: '--uninstall', description: 'Remove PRISM\'s status line, putting back the one it replaced' },
|
|
378
|
+
],
|
|
379
|
+
action: (opts) => runGuarded(() => enableClaudeCode(opts, defaultDeps())),
|
|
380
|
+
};
|
|
381
|
+
//# sourceMappingURL=claude-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../../../src/commands/enable/claude-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS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O,EAAE;QACP,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,yCAAyC,EAAE;QAC1E,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,4CAA4C,EAAE;QACjF,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,iGAAiG,EAAE;QACtI,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,+FAA+F,EAAE;QACnI,EAAE,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,+DAA+D,EAAE;KACvG;IACD,MAAM,EAAE,CAAC,IAAuB,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC;CAC7F,CAAC"}
|
|
@@ -7,4 +7,29 @@
|
|
|
7
7
|
* innerHTML is never used for data.
|
|
8
8
|
*/
|
|
9
9
|
export declare function renderPage(nonce: string, csrf?: string): string;
|
|
10
|
+
/** What a static snapshot embeds: the /api/data payload and the /api/setup answer, as the live page would fetch them. */
|
|
11
|
+
export interface SnapshotData {
|
|
12
|
+
data: unknown;
|
|
13
|
+
setup: unknown;
|
|
14
|
+
/** ISO time the snapshot was written. */
|
|
15
|
+
generatedAt: string;
|
|
16
|
+
version: string;
|
|
17
|
+
}
|
|
18
|
+
/** JSON for a <script type="application/json"> block: `<` escaped, so the text can never close the element. */
|
|
19
|
+
export declare function embedJson(v: unknown): string;
|
|
20
|
+
/** The exact element markers renderSnapshotPage writes, so a test can read the file back without parsing HTML. */
|
|
21
|
+
export declare const SNAPSHOT_MARKERS: {
|
|
22
|
+
readonly script: "<script>";
|
|
23
|
+
readonly data: "<script type=\"application/json\" id=\"prism-snapshot\">";
|
|
24
|
+
readonly scriptEnd: "</script>";
|
|
25
|
+
readonly style: "<style>";
|
|
26
|
+
readonly styleEnd: "</style>";
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* The same page as renderPage, as one static file: the data is embedded, the
|
|
30
|
+
* scripts and the style are allowed by hash in a CSP meta tag with
|
|
31
|
+
* default-src 'none' (no fetch, no remote resource), and the Setup page's Run
|
|
32
|
+
* buttons become Copy buttons. No token, no server.
|
|
33
|
+
*/
|
|
34
|
+
export declare function renderSnapshotPage(s: SnapshotData): string;
|
|
10
35
|
//# sourceMappingURL=page.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../src/dashboard/page.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../../src/dashboard/page.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAurBH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,SAAK,GAAG,MAAM,CAgB3D;AAED,yHAAyH;AACzH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,yCAAyC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAID,+GAA+G;AAC/G,wBAAgB,SAAS,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAE5C;AAED,kHAAkH;AAClH,eAAO,MAAM,gBAAgB;;;;;;CAMnB,CAAC;AAIX;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM,CAoB1D"}
|