@misconfig/cli 0.0.0-stage → 1.0.1

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.
@@ -0,0 +1,237 @@
1
+ // Finds the files that control AI agents: in the project folder, in the home
2
+ // folder and app settings, and in risky folders an agent has been started in.
3
+ // Everything is read and checked on this computer.
4
+
5
+ import { promises as fs } from "node:fs";
6
+ import os from "node:os";
7
+ import path from "node:path";
8
+ import { maskSecrets } from "../engine/mask.js";
9
+ import { parseTOML } from "../engine/parse.js";
10
+ import { classifyPath, isSkippedDir, LIMITS, HOME_MARKERS, DOWNLOADS_LIKE } from "../engine/paths.js";
11
+ import { LOCATIONS, userPaths } from "../engine/locations.js";
12
+ import { riskyPlace } from "../engine/index.js";
13
+
14
+ export const PLATFORM = process.platform === "win32" ? "windows" : process.platform === "darwin" ? "mac" : "linux";
15
+ const LOOSE_NAMES = /\.(md|mdc|txt)$/i;
16
+
17
+ export async function discover({ dir = process.cwd(), includeUser = true, home = os.homedir(), env = process.env } = {}) {
18
+ const projectDir = path.resolve(dir);
19
+ const files = [];
20
+ const seen = new Set();
21
+ const lineMaps = {};
22
+ let masked = 0;
23
+
24
+ const tilde = (abs) => {
25
+ const rel = path.relative(home, abs);
26
+ if (!rel) return "~";
27
+ if (!rel.startsWith("..") && !path.isAbsolute(rel)) return "~/" + rel.split(path.sep).join("/");
28
+ return abs.split(path.sep).join("/");
29
+ };
30
+ const add = (enginePath, raw, size, extra = {}) => {
31
+ if (seen.has(enginePath)) return;
32
+ seen.add(enginePath);
33
+ if (raw === null) return files.push({ path: enginePath, size, ...extra });
34
+ const m = maskSecrets(raw);
35
+ masked += m.count;
36
+ files.push({ path: enginePath, size, content: m.text, ...extra });
37
+ };
38
+
39
+ // --- The project folder -------------------------------------------------------
40
+ const top = await readdir(projectDir);
41
+ const topLevel = top.map((d) => d.name);
42
+ const homeLike = topLevel.filter((n) => HOME_MARKERS.has(n)).length >= 3;
43
+ const shape = { entries: 0, topLevel: topLevel.slice(0, 200), rootGit: topLevel.includes(".git"), gitRepos: 0, truncated: false };
44
+ const scanningHome = samePath(projectDir, home);
45
+
46
+ if (!scanningHome) {
47
+ const looseMarkdown = DOWNLOADS_LIKE.test(path.basename(projectDir)) || homeLike;
48
+ const gitRepos = new Set();
49
+ const stack = [[projectDir, 0]];
50
+ while (stack.length) {
51
+ const [current, depth] = stack.pop();
52
+ for (const entry of await readdir(current)) {
53
+ if (shape.entries >= LIMITS.maxEntries) {
54
+ shape.truncated = true;
55
+ break;
56
+ }
57
+ shape.entries++;
58
+ const abs = path.join(current, entry.name);
59
+ const rel = path.relative(projectDir, abs).split(path.sep).join("/");
60
+ if (entry.isDirectory()) {
61
+ if (entry.name === ".git") gitRepos.add(path.relative(projectDir, current));
62
+ if (!isSkippedDir(entry.name) && depth < 12) stack.push([abs, depth + 1]);
63
+ continue;
64
+ }
65
+ if (!entry.isFile()) continue;
66
+ const kind = classifyPath(rel, { looseMarkdown });
67
+ if (!kind) continue;
68
+ await addFile(abs, rel, kind);
69
+ }
70
+ }
71
+ shape.gitRepos = gitRepos.size;
72
+ }
73
+
74
+ async function addFile(abs, enginePath, kind) {
75
+ const stat = await fs.stat(abs).catch(() => null);
76
+ if (!stat) return;
77
+ if (kind === "sensitive") return add(enginePath, null, stat.size, { sensitive: true });
78
+ if (stat.size > LIMITS.maxFileBytes) return add(enginePath, null, stat.size, { tooLarge: true });
79
+ const raw = await fs.readFile(abs, "utf8").catch(() => null);
80
+ if (raw !== null) add(enginePath, raw, stat.size, kind === "loose" ? { loose: true } : {});
81
+ }
82
+
83
+ // --- The home folder and app settings -------------------------------------------
84
+ // Each file keeps its usual name (~/.claude/settings.json) even when an
85
+ // environment variable moved it, so the checks still recognise it.
86
+ const userFiles = [];
87
+ if (includeUser) {
88
+ for (const entry of LOCATIONS) {
89
+ for (const p of userPaths(entry, PLATFORM)) {
90
+ const abs = resolveUserPath(p, { home, env });
91
+ if (!p.endsWith("/")) userFiles.push({ abs, enginePath: p.startsWith("~") ? p : tilde(abs) });
92
+ else for (const f of await listFiles(abs, 3)) userFiles.push({ abs: f, enginePath: p + path.relative(abs, f).split(path.sep).join("/") });
93
+ }
94
+ }
95
+ for (const { abs, enginePath } of userFiles) {
96
+ if (seen.has(enginePath)) continue;
97
+ // Credential files belong in the home folder; only report them inside projects.
98
+ if (classifyPath(enginePath) === "sensitive") continue;
99
+ const stat = await fs.stat(abs).catch(() => null);
100
+ if (!stat?.isFile()) continue;
101
+ if (/(^|[\\/])\.claude\.json$/.test(abs)) {
102
+ const raw = await fs.readFile(abs, "utf8").catch(() => null);
103
+ if (raw === null) continue;
104
+ const reduced = reduceClaudeJson(raw, tilde);
105
+ add(enginePath, reduced.text, stat.size);
106
+ if (reduced.lineMap) lineMaps[enginePath] = reduced.lineMap;
107
+ continue;
108
+ }
109
+ if (stat.size > Math.max(LIMITS.maxFileBytes, 1024 * 1024)) {
110
+ add(enginePath, null, stat.size, { tooLarge: true });
111
+ continue;
112
+ }
113
+ const raw = await fs.readFile(abs, "utf8").catch(() => null);
114
+ if (raw !== null) add(enginePath, raw, stat.size);
115
+ }
116
+ }
117
+
118
+ // --- Risky folders an agent has been started in -----------------------------------
119
+ // If Claude Code or Codex has run in Downloads or the home folder, check the
120
+ // loose instruction files sitting there too.
121
+ const risky = new Set();
122
+ for (const f of files) {
123
+ if (/(^|\/)\.claude\.json$/.test(f.path)) {
124
+ try {
125
+ for (const d of Object.keys(JSON.parse(f.content).projects ?? {})) if (riskyPlace(d)) risky.add(d);
126
+ } catch {}
127
+ }
128
+ if (/(^|\/)\.codex\/config\.toml$/.test(f.path)) {
129
+ const projects = parseTOML(f.content)?.projects ?? {};
130
+ for (const [d, s] of Object.entries(projects)) if (s?.trust_level === "trusted" && riskyPlace(d)) risky.add(tilde(path.resolve(d)));
131
+ }
132
+ }
133
+ for (const d of risky) {
134
+ const abs = d === "~" ? home : d.startsWith("~/") ? path.join(home, ...d.slice(2).split("/")) : d;
135
+ if (samePath(abs, projectDir)) continue;
136
+ let count = 0;
137
+ for (const entry of await readdir(abs)) {
138
+ if (!entry.isFile() || !LOOSE_NAMES.test(entry.name) || ++count > LIMITS.maxLooseMarkdown) continue;
139
+ const full = path.join(abs, entry.name);
140
+ const stat = await fs.stat(full).catch(() => null);
141
+ if (!stat || stat.size > 200 * 1024) continue;
142
+ const raw = await fs.readFile(full, "utf8").catch(() => null);
143
+ if (raw !== null) add(tilde(full), raw, stat.size, { loose: true });
144
+ }
145
+ }
146
+
147
+ return {
148
+ root: path.basename(projectDir) || projectDir,
149
+ home: "~",
150
+ shape,
151
+ files,
152
+ masked: { count: masked },
153
+ lineMaps,
154
+ scanned: { project: tilde(projectDir), projectSkipped: scanningHome, user: includeUser },
155
+ };
156
+ }
157
+
158
+ // "~/..." and "{config}" style paths from locations.js, honouring the
159
+ // environment variables agents use to move their settings.
160
+ export function resolveUserPath(p, { home, env }) {
161
+ let rel = p;
162
+ if (env.CLAUDE_CONFIG_DIR && rel.startsWith("~/.claude/")) return path.join(env.CLAUDE_CONFIG_DIR, rel.slice("~/.claude/".length));
163
+ if (env.CODEX_HOME && rel.startsWith("~/.codex/")) return path.join(env.CODEX_HOME, rel.slice("~/.codex/".length));
164
+ if (PLATFORM === "windows" && env.APPDATA && rel.startsWith("~/AppData/Roaming/")) return path.join(env.APPDATA, rel.slice("~/AppData/Roaming/".length));
165
+ if (PLATFORM === "linux" && env.XDG_CONFIG_HOME && rel.startsWith("~/.config/")) return path.join(env.XDG_CONFIG_HOME, rel.slice("~/.config/".length));
166
+ if (rel.startsWith("~/")) return path.join(home, ...rel.slice(2).split("/"));
167
+ return path.normalize(rel);
168
+ }
169
+
170
+ function reduceClaudeJson(raw, tilde) {
171
+ // ~/.claude.json can be large and holds account data. Keep only what the
172
+ // checks need, in the original order: MCP servers, the folders Claude Code
173
+ // has been started in and their tool approvals. lineMap[i] is the line in
174
+ // the real file that reduced line i + 1 came from, so findings point at
175
+ // lines people can open.
176
+ let json;
177
+ try {
178
+ json = JSON.parse(raw);
179
+ } catch {
180
+ return { text: raw.slice(0, 400_000), lineMap: null };
181
+ }
182
+ if (!json || typeof json !== "object") return { text: "{}", lineMap: null };
183
+ const keys = new Map(); // reduced key, as JSON, -> key in the real file, as JSON
184
+ const out = {};
185
+ for (const [k, v] of Object.entries(json)) {
186
+ if (k === "mcpServers" || (k === "primaryApiKey" && typeof v === "string")) out[k] = v;
187
+ if (k !== "projects" || !v || typeof v !== "object") continue;
188
+ out.projects = {};
189
+ for (const [dir, p] of Object.entries(v)) {
190
+ const key = tilde(path.resolve(dir));
191
+ keys.set(JSON.stringify(key), JSON.stringify(dir));
192
+ out.projects[key] = Object.fromEntries(Object.entries(p && typeof p === "object" ? p : {}).filter(([name]) => name === "allowedTools" || name === "mcpServers"));
193
+ }
194
+ }
195
+ const text = JSON.stringify(out, null, 2);
196
+ const rawLines = raw.split(/\r?\n/);
197
+ const norm = (line) => line.trim().replace(/,$/, "");
198
+ let cursor = 0;
199
+ const lineMap = text.split("\n").map((line) => {
200
+ let want = norm(line);
201
+ const colon = want.indexOf('": ');
202
+ if (colon > 0 && keys.has(want.slice(0, colon + 1))) want = keys.get(want.slice(0, colon + 1)) + want.slice(colon + 1);
203
+ for (let i = cursor; i < rawLines.length; i++) {
204
+ const have = norm(rawLines[i]);
205
+ if (have === want || (want.endsWith("{}") && have === want.slice(0, -1))) {
206
+ cursor = i + 1;
207
+ return i + 1;
208
+ }
209
+ }
210
+ return null;
211
+ });
212
+ return { text, lineMap };
213
+ }
214
+
215
+ async function readdir(dir) {
216
+ try {
217
+ return await fs.readdir(dir, { withFileTypes: true });
218
+ } catch {
219
+ return [];
220
+ }
221
+ }
222
+
223
+ async function listFiles(dir, depth) {
224
+ const out = [];
225
+ for (const entry of await readdir(dir)) {
226
+ const abs = path.join(dir, entry.name);
227
+ if (entry.isDirectory() && depth > 0 && !isSkippedDir(entry.name)) out.push(...(await listFiles(abs, depth - 1)));
228
+ else if (entry.isFile()) out.push(abs);
229
+ if (out.length > 300) break;
230
+ }
231
+ return out;
232
+ }
233
+
234
+ function samePath(a, b) {
235
+ const norm = (p) => path.resolve(p).replace(/[\\/]+$/, "");
236
+ return PLATFORM === "linux" ? norm(a) === norm(b) : norm(a).toLowerCase() === norm(b).toLowerCase();
237
+ }
package/lib/main.js ADDED
@@ -0,0 +1,112 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { createInterface } from "node:readline/promises";
3
+ import { analyze, toShareable } from "../engine/index.js";
4
+ import { discover } from "./discover.js";
5
+ import { printReport, printSharePreview, printShareResult } from "./print.js";
6
+
7
+ const HELP = `Usage: npx @misconfig/cli [folder] [options]
8
+
9
+ Finds every file that controls your AI coding agents, on this computer and in
10
+ the folder (the current folder by default), and checks them for risky
11
+ settings. Everything runs here. Nothing is sent anywhere unless you use --share.
12
+
13
+ Options
14
+ --share Publish this project's findings and print a link. Shows
15
+ what will be sent and asks first. No file contents are
16
+ sent, and nothing from outside the project.
17
+ --yes Share without asking, for scripts and CI
18
+ --json Print the full result as JSON
19
+ --project-only Skip the agent settings on this computer
20
+ --fail-on <level> Exit with code 1 if anything at this level or worse is
21
+ found: critical, high, medium or low. Useful in CI.
22
+ -v, --version Print the version
23
+ -h, --help Show this help
24
+ `;
25
+
26
+ const LEVELS = ["critical", "high", "medium", "low"];
27
+
28
+ export async function main(argv) {
29
+ const opts = { dir: process.cwd(), share: false, yes: false, json: false, projectOnly: false, failOn: null };
30
+ for (let i = 0; i < argv.length; i++) {
31
+ const a = argv[i];
32
+ if (a === "-h" || a === "--help") {
33
+ process.stdout.write(HELP);
34
+ return 0;
35
+ }
36
+ if (a === "-v" || a === "--version") {
37
+ console.log(await version());
38
+ return 0;
39
+ }
40
+ if (a === "--share") opts.share = true;
41
+ else if (a === "--yes" || a === "-y") opts.yes = true;
42
+ else if (a === "--json") opts.json = true;
43
+ else if (a === "--project-only") opts.projectOnly = true;
44
+ else if (a === "--fail-on" || a.startsWith("--fail-on=")) {
45
+ opts.failOn = (a.includes("=") ? a.split("=")[1] : argv[++i] ?? "").toLowerCase();
46
+ if (!LEVELS.includes(opts.failOn)) throw new Error(`--fail-on needs one of: ${LEVELS.join(", ")}.`);
47
+ } else if (a.startsWith("-")) throw new Error(`Unknown option ${a}. Run npx @misconfig/cli --help for the options.`);
48
+ else opts.dir = a;
49
+ }
50
+
51
+ const input = await discover({ dir: opts.dir, includeUser: !opts.projectOnly });
52
+ const result = check(input);
53
+
54
+ if (opts.json) process.stdout.write(JSON.stringify(result, null, 2) + "\n");
55
+ else printReport(result, { version: await version(), scanned: input.scanned });
56
+
57
+ if (opts.share) await share(opts, input, result);
58
+
59
+ if (opts.failOn) {
60
+ const worst = LEVELS.slice(0, LEVELS.indexOf(opts.failOn) + 1);
61
+ if (result.findings.some((f) => worst.includes(f.severity))) return 1;
62
+ }
63
+ return 0;
64
+ }
65
+
66
+ // Runs the checks, then points findings in reduced files back at real lines.
67
+ function check(input) {
68
+ const result = analyze(input);
69
+ for (const f of result.findings) {
70
+ const map = f.file && input.lineMaps?.[f.file];
71
+ if (map && f.line) f.line = map[f.line - 1] ?? null;
72
+ }
73
+ return result;
74
+ }
75
+
76
+ async function share(opts, input, result) {
77
+ // A share link covers the project only. Settings on this computer stay here.
78
+ const out = opts.json ? process.stderr : process.stdout;
79
+ if (input.scanned.projectSkipped) {
80
+ throw new Error("There's no project to share here. Run npx @misconfig/cli --share inside a project folder. Settings on your computer are never shared.");
81
+ }
82
+ const project = input.scanned.user ? check(await discover({ dir: opts.dir, includeUser: false })) : result;
83
+ const payload = toShareable(project);
84
+ printSharePreview(out, payload, project, { includesUser: input.scanned.user });
85
+
86
+ if (!opts.yes) {
87
+ if (!process.stdin.isTTY) throw new Error("Nothing was sent. Add --yes to share without a prompt, for example in CI.");
88
+ const rl = createInterface({ input: process.stdin, output: out });
89
+ const answer = (await rl.question("Publish this report? [y/N] ")).trim().toLowerCase();
90
+ rl.close();
91
+ if (answer !== "y" && answer !== "yes") {
92
+ out.write("Nothing was sent.\n");
93
+ return;
94
+ }
95
+ }
96
+
97
+ const base = (process.env.MISCONFIG_URL || "https://misconfig.ai").replace(/\/+$/, "");
98
+ const res = await fetch(`${base}/api/share`, {
99
+ method: "POST",
100
+ headers: { "content-type": "application/json", "user-agent": `misconfig-cli/${await version()}` },
101
+ body: JSON.stringify(payload),
102
+ });
103
+ const data = await res.json().catch(() => ({}));
104
+ if (!res.ok) throw new Error(data.error || `Sharing didn't work (error ${res.status}). Your report wasn't published.`);
105
+ printShareResult(out, data);
106
+ }
107
+
108
+ let cachedVersion = null;
109
+ async function version() {
110
+ cachedVersion ??= JSON.parse(await readFile(new URL("../package.json", import.meta.url), "utf8")).version;
111
+ return cachedVersion;
112
+ }
package/lib/print.js ADDED
@@ -0,0 +1,138 @@
1
+ // Terminal output.
2
+
3
+ const env = process.env;
4
+ const color = Boolean(env.FORCE_COLOR) || (process.stdout.isTTY && !env.NO_COLOR && env.TERM !== "dumb");
5
+ const paint = (code) => (s) => (color ? `\x1b[${code}m${s}\x1b[0m` : String(s));
6
+ export const bold = paint("1");
7
+ export const dim = paint("2");
8
+ const SEV = {
9
+ critical: { label: "Critical", paint: paint("1;31") },
10
+ high: { label: "High", paint: paint("1;38;5;208") },
11
+ medium: { label: "Medium", paint: paint("1;33") },
12
+ low: { label: "Low", paint: paint("1;34") },
13
+ info: { label: "Info", paint: paint("2") },
14
+ };
15
+ const MARK = process.platform === "win32" && !env.WT_SESSION ? "*" : "■";
16
+
17
+ const width = () => Math.min(Math.max(process.stdout.columns || 100, 60), 110);
18
+
19
+ function wrap(text, indent) {
20
+ const max = width() - indent;
21
+ const words = String(text).split(/\s+/);
22
+ const lines = [];
23
+ let line = "";
24
+ for (const w of words) {
25
+ if (line && line.length + 1 + w.length > max) {
26
+ lines.push(line);
27
+ line = w;
28
+ } else line = line ? `${line} ${w}` : w;
29
+ }
30
+ if (line) lines.push(line);
31
+ return lines.map((l) => " ".repeat(indent) + l).join("\n");
32
+ }
33
+
34
+ const listText = (items) => (items.length <= 1 ? items.join("") : `${items.slice(0, -1).join(", ")} and ${items[items.length - 1]}`);
35
+
36
+ export function printReport(result, { version, scanned }) {
37
+ const out = [];
38
+ const where = scanned.projectSkipped ? "your home folder" : scanned.project;
39
+ out.push(`${bold("misconfig")} ${dim(version)}`);
40
+ out.push(
41
+ wrap(
42
+ `Checked ${where}${scanned.user ? " and the agent settings on this computer" : ""}. Everything ran here; nothing was uploaded.`,
43
+ 0,
44
+ ),
45
+ );
46
+ out.push("");
47
+
48
+ // The grade, printed on the brand's chartreuse square.
49
+ const badge = color ? `\x1b[1;38;5;16;48;5;191m ${result.grade} \x1b[0m` : `[${result.grade}]`;
50
+ const score = typeof result.score === "number" ? `${result.score} out of 100` : "no agent setup files found";
51
+ out.push(` ${badge} ${bold(score)}`);
52
+ const counts = ["critical", "high", "medium", "low"].filter((s) => result.counts[s]).map((s) => SEV[s].paint(`${result.counts[s]} ${s}`));
53
+ out.push(` ${counts.length ? counts.join(dim(", ")) : "No issues found"}`);
54
+ out.push("");
55
+
56
+ // Which files control which agent.
57
+ if (result.controlMap.length) {
58
+ out.push(bold("Files that control your agents"));
59
+ // One file per line under each agent. Loose instruction files aren't tied to
60
+ // one agent: they steer any agent started in their folder.
61
+ const byAgent = new Map();
62
+ for (const f of result.controlMap) for (const t of f.tools) {
63
+ const name = t === "Any agent started there" ? "Loose files" : t;
64
+ byAgent.set(name, [...(byAgent.get(name) ?? []), f.path]);
65
+ }
66
+ const pad = Math.max(...[...byAgent.keys()].map((k) => k.length)) + 2;
67
+ for (const [agent, paths] of byAgent) {
68
+ const shown = paths.slice(0, 8);
69
+ shown.forEach((p, i) => out.push(` ${(i ? "" : agent).padEnd(pad)}${p}`));
70
+ if (paths.length > shown.length) out.push(` ${"".padEnd(pad)}${dim(`and ${paths.length - shown.length} more`)}`);
71
+ }
72
+ out.push("");
73
+ }
74
+
75
+ for (const sev of ["critical", "high", "medium", "low", "info"]) {
76
+ const group = result.findings.filter((f) => f.severity === sev);
77
+ if (!group.length) continue;
78
+ out.push(SEV[sev].paint(`${SEV[sev].label} (${group.length})`));
79
+ for (const f of group) {
80
+ out.push(` ${SEV[sev].paint(MARK)} ${bold(f.title)}`);
81
+ if (f.file) out.push(` ${dim(f.file + (f.line ? `:${f.line}` : ""))}`);
82
+ if (sev === "critical" || sev === "high") out.push(wrap(f.why, 4));
83
+ out.push(wrap(`Fix: ${f.fix}`, 4));
84
+ out.push("");
85
+ }
86
+ }
87
+
88
+ if (!result.findings.length) out.push(result.controlMap.length ? "No issues found in these files." : "No files that control AI agents were found.", "");
89
+ out.push(dim("Share this project's report: npx @misconfig/cli --share"));
90
+ out.push(dim("Full details as JSON: npx @misconfig/cli --json"));
91
+ process.stdout.write(out.join("\n") + "\n");
92
+ }
93
+
94
+ // Everything a share sends, listed before anything is sent.
95
+ export function printSharePreview(out, payload, project, { includesUser }) {
96
+ const lines = ["", bold("Share this project's report")];
97
+ const score = typeof project.score === "number" ? `grade ${project.grade}, ${project.score} out of 100` : "no grade";
98
+ lines.push(
99
+ wrap(
100
+ includesUser
101
+ ? `The link covers this project only (${score}). The settings on this computer aren't included.`
102
+ : `The link shows ${score}.`,
103
+ 2,
104
+ ),
105
+ "",
106
+ " This is everything that will be sent:",
107
+ );
108
+ if (!payload.findings.length) lines.push(` ${dim("No findings")}`);
109
+ for (const f of payload.findings) {
110
+ const where = f.file ? `${f.file}${f.line ? `:${f.line}` : ""}` : "";
111
+ const vars = Object.entries(f.vars).map(([k, v]) => `${k}=${v}`).join(", ");
112
+ lines.push(` ${f.id}${where ? ` ${where}` : ""}${vars ? dim(` ${vars}`) : ""}`);
113
+ }
114
+ lines.push(
115
+ ` File names: ${payload.controlMap.length ? payload.controlMap.join(", ") : "none"}`,
116
+ ` Totals: ${payload.stats.filesChecked} files checked, ${payload.stats.mcpServers} MCP servers`,
117
+ "",
118
+ wrap(dim("Not sent: file contents, quoted lines, this folder's name and anything outside it."), 2),
119
+ "",
120
+ );
121
+ out.write(lines.join("\n") + "\n");
122
+ }
123
+
124
+ export function printShareResult(out, data) {
125
+ out.write(
126
+ [
127
+ "",
128
+ bold("Share link created"),
129
+ ` Link: ${data.url}`,
130
+ ` README badge: [![AI setup](${data.badgeUrl})](${data.url})`,
131
+ ` Delete link: ${data.url}#delete=${data.deleteToken}`,
132
+ dim(" Save the delete link now. It isn't shown again. The report expires in 30 days."),
133
+ "",
134
+ ].join("\n"),
135
+ );
136
+ }
137
+
138
+ export { listText };
package/package.json CHANGED
@@ -1,6 +1,38 @@
1
1
  {
2
- "name": "@misconfig/cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@misconfig/cli",
3
+ "version": "1.0.1",
4
+ "description": "Finds every file that controls your AI coding agents and checks it for risky settings. Runs on your computer; nothing is uploaded unless you add --share.",
5
+ "type": "module",
6
+ "bin": {
7
+ "misconfig": "bin/misconfig.js"
8
+ },
9
+ "files": [
10
+ "bin",
11
+ "lib",
12
+ "engine",
13
+ "README.md"
14
+ ],
15
+ "scripts": {
16
+ "prepublishOnly": "node ../scripts/build-cli.mjs"
17
+ },
18
+ "engines": {
19
+ "node": ">=18"
20
+ },
21
+ "keywords": [
22
+ "claude-code",
23
+ "codex",
24
+ "cursor",
25
+ "copilot",
26
+ "gemini-cli",
27
+ "mcp",
28
+ "ai-agents",
29
+ "security",
30
+ "misconfiguration"
31
+ ],
32
+ "homepage": "https://misconfig.ai",
33
+ "author": "GK Data LLC",
34
+ "license": "UNLICENSED",
35
+ "publishConfig": {
36
+ "access": "public"
37
+ }
38
+ }