@agent-lint/cli 0.2.1 → 0.3.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.
package/dist/index.js CHANGED
@@ -3520,35 +3520,168 @@ var require_gray_matter = __commonJS({
3520
3520
  }
3521
3521
  });
3522
3522
 
3523
- // src/index.ts
3523
+ // src/index.tsx
3524
3524
  import { Command } from "commander";
3525
3525
 
3526
- // src/commands/init.ts
3526
+ // src/commands/init.tsx
3527
+ import { useState, useEffect } from "react";
3527
3528
  import fs from "fs";
3528
3529
  import path from "path";
3530
+ import { Box as Box2, Text as Text2, render } from "ink";
3531
+ import { Spinner } from "@inkjs/ui";
3529
3532
 
3530
- // src/utils.ts
3531
- import util from "util";
3532
- function redirectLogsToStderr() {
3533
- console.log = (...args) => {
3534
- process.stderr.write(`${util.format(...args)}
3535
- `);
3536
- };
3537
- console.info = (...args) => {
3538
- process.stderr.write(`${util.format(...args)}
3539
- `);
3540
- };
3541
- }
3542
- function writeStdout(content) {
3543
- process.stdout.write(content.endsWith("\n") ? content : `${content}
3544
- `);
3533
+ // src/ui/components.tsx
3534
+ import { Box, Text } from "ink";
3535
+
3536
+ // src/ui/theme.ts
3537
+ var colors = {
3538
+ primary: "#6367FF",
3539
+ secondary: "#8494FF",
3540
+ tertiary: "#C9BEFF",
3541
+ accent: "#FFDBFD",
3542
+ dim: "#555555",
3543
+ success: "#22c55e",
3544
+ warning: "#eab308",
3545
+ error: "#ef4444",
3546
+ muted: "#777777",
3547
+ bg: "#1a1a2e"
3548
+ };
3549
+ var gradient = [
3550
+ "#6367FF",
3551
+ "#7078FF",
3552
+ "#8494FF",
3553
+ "#A3A9FF",
3554
+ "#C9BEFF",
3555
+ "#E4CCFE",
3556
+ "#FFDBFD"
3557
+ ];
3558
+ var BANNER_LINES = [
3559
+ " \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557",
3560
+ "\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D",
3561
+ "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551 ",
3562
+ "\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551 ",
3563
+ "\u2588\u2588\u2551 \u2588\u2588\u2551\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2551 ",
3564
+ "\u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D \u255A\u2550\u255D "
3565
+ ];
3566
+ var BANNER_LINES_2 = [
3567
+ "\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557",
3568
+ "\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u255A\u2550\u2550\u2588\u2588\u2554\u2550\u2550\u255D",
3569
+ "\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551 \u2588\u2588\u2551 ",
3570
+ "\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u255A\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2551 ",
3571
+ "\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2551 \u255A\u2588\u2588\u2588\u2588\u2551 \u2588\u2588\u2551 ",
3572
+ "\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u2550\u2550\u255D \u255A\u2550\u255D "
3573
+ ];
3574
+ var TAGLINE = "Meta-agent orchestrator for AI coding agents";
3575
+ var VERSION = "0.3.1";
3576
+
3577
+ // src/ui/components.tsx
3578
+ import { jsx, jsxs } from "react/jsx-runtime";
3579
+ function Banner() {
3580
+ return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [
3581
+ /* @__PURE__ */ jsx(Box, { flexDirection: "column", children: BANNER_LINES.map((line, i) => /* @__PURE__ */ jsxs(Box, { children: [
3582
+ /* @__PURE__ */ jsx(Text, { color: gradient[i] ?? gradient[gradient.length - 1], bold: true, children: line }),
3583
+ /* @__PURE__ */ jsx(Text, { children: " " }),
3584
+ /* @__PURE__ */ jsx(Text, { color: gradient[i] ?? gradient[gradient.length - 1], bold: true, children: BANNER_LINES_2[i] ?? "" })
3585
+ ] }, i)) }),
3586
+ /* @__PURE__ */ jsxs(Box, { marginTop: 0, marginLeft: 1, gap: 1, children: [
3587
+ /* @__PURE__ */ jsx(Text, { color: colors.accent, children: "*" }),
3588
+ /* @__PURE__ */ jsx(Text, { color: colors.tertiary, italic: true, children: TAGLINE }),
3589
+ /* @__PURE__ */ jsxs(Text, { color: colors.dim, children: [
3590
+ "v",
3591
+ VERSION
3592
+ ] })
3593
+ ] })
3594
+ ] });
3595
+ }
3596
+ function Divider() {
3597
+ const left = "\u2500".repeat(3);
3598
+ const mid = " * ";
3599
+ const right = "\u2500".repeat(44);
3600
+ return /* @__PURE__ */ jsxs(Box, { marginY: 0, children: [
3601
+ /* @__PURE__ */ jsx(Text, { color: colors.dim, children: left }),
3602
+ /* @__PURE__ */ jsx(Text, { color: colors.accent, children: mid }),
3603
+ /* @__PURE__ */ jsx(Text, { color: colors.dim, children: right })
3604
+ ] });
3605
+ }
3606
+ function SectionTitle({ children }) {
3607
+ return /* @__PURE__ */ jsxs(Box, { marginTop: 1, marginBottom: 0, gap: 1, children: [
3608
+ /* @__PURE__ */ jsx(Text, { color: colors.primary, bold: true, children: "//" }),
3609
+ /* @__PURE__ */ jsx(Text, { color: colors.secondary, bold: true, children: children.toUpperCase() })
3610
+ ] });
3611
+ }
3612
+ function SuccessItem({ children }) {
3613
+ return /* @__PURE__ */ jsxs(Box, { marginLeft: 3, children: [
3614
+ /* @__PURE__ */ jsx(Text, { color: colors.success, bold: true, children: "+ " }),
3615
+ /* @__PURE__ */ jsx(Text, { children })
3616
+ ] });
3617
+ }
3618
+ function SkipItem({ children }) {
3619
+ return /* @__PURE__ */ jsxs(Box, { marginLeft: 3, children: [
3620
+ /* @__PURE__ */ jsx(Text, { color: colors.warning, children: "~ " }),
3621
+ /* @__PURE__ */ jsx(Text, { color: colors.muted, children })
3622
+ ] });
3623
+ }
3624
+ function InfoItem({ children }) {
3625
+ return /* @__PURE__ */ jsxs(Box, { marginLeft: 3, children: [
3626
+ /* @__PURE__ */ jsx(Text, { color: colors.accent, bold: true, children: "* " }),
3627
+ /* @__PURE__ */ jsx(Text, { children })
3628
+ ] });
3629
+ }
3630
+ function ErrorItem({ children }) {
3631
+ return /* @__PURE__ */ jsxs(Box, { marginLeft: 3, children: [
3632
+ /* @__PURE__ */ jsx(Text, { color: colors.error, bold: true, children: "x " }),
3633
+ /* @__PURE__ */ jsx(Text, { children })
3634
+ ] });
3635
+ }
3636
+ function Hint({ children }) {
3637
+ return /* @__PURE__ */ jsxs(Box, { marginTop: 1, marginLeft: 3, children: [
3638
+ /* @__PURE__ */ jsx(Text, { color: colors.tertiary, children: "? " }),
3639
+ /* @__PURE__ */ jsx(Text, { color: colors.muted, italic: true, children })
3640
+ ] });
3641
+ }
3642
+ function NextStep({ children }) {
3643
+ return /* @__PURE__ */ jsxs(Box, { marginTop: 1, marginLeft: 1, children: [
3644
+ /* @__PURE__ */ jsx(Text, { color: colors.accent, bold: true, children: ">> " }),
3645
+ /* @__PURE__ */ jsx(Text, { color: colors.tertiary, children })
3646
+ ] });
3647
+ }
3648
+ function PromptBox({ children }) {
3649
+ return /* @__PURE__ */ jsx(
3650
+ Box,
3651
+ {
3652
+ borderStyle: "round",
3653
+ borderColor: colors.secondary,
3654
+ paddingX: 2,
3655
+ paddingY: 1,
3656
+ marginY: 1,
3657
+ marginX: 1,
3658
+ children: /* @__PURE__ */ jsx(Text, { color: colors.tertiary, children })
3659
+ }
3660
+ );
3545
3661
  }
3546
- function writeStderr(content) {
3547
- process.stderr.write(content.endsWith("\n") ? content : `${content}
3548
- `);
3662
+ function StatusBar({
3663
+ items
3664
+ }) {
3665
+ return /* @__PURE__ */ jsx(
3666
+ Box,
3667
+ {
3668
+ marginLeft: 1,
3669
+ marginTop: 1,
3670
+ borderStyle: "single",
3671
+ borderColor: colors.dim,
3672
+ paddingX: 2,
3673
+ paddingY: 0,
3674
+ gap: 3,
3675
+ children: items.map((item, i) => /* @__PURE__ */ jsxs(Box, { gap: 1, children: [
3676
+ /* @__PURE__ */ jsx(Text, { color: colors.muted, children: item.label }),
3677
+ /* @__PURE__ */ jsx(Text, { color: item.color, bold: true, children: String(item.value) })
3678
+ ] }, i))
3679
+ }
3680
+ );
3549
3681
  }
3550
3682
 
3551
- // src/commands/init.ts
3683
+ // src/commands/init.tsx
3684
+ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
3552
3685
  function mcpStdioEntry() {
3553
3686
  return {
3554
3687
  command: "npx",
@@ -3616,9 +3749,7 @@ var CLIENT_CONFIGS = [
3616
3749
  function detectClients(rootPath) {
3617
3750
  const detected = [];
3618
3751
  for (const client of CLIENT_CONFIGS) {
3619
- if (client.detectDir === null) {
3620
- continue;
3621
- }
3752
+ if (client.detectDir === null) continue;
3622
3753
  const dirPath = path.join(rootPath, client.detectDir);
3623
3754
  if (fs.existsSync(dirPath)) {
3624
3755
  detected.push(client);
@@ -3632,75 +3763,90 @@ function ensureDir(filePath) {
3632
3763
  fs.mkdirSync(dir, { recursive: true });
3633
3764
  }
3634
3765
  }
3635
- function registerInitCommand(program) {
3636
- program.command("init").description("Set up Agent Lint MCP config for detected IDE clients").option("-y, --yes", "Skip confirmation prompts").option("--all", "Generate configs for all supported clients, not just detected ones").action(async (options2) => {
3637
- const rootPath = process.cwd();
3638
- writeStderr("Agent Lint init \u2014 detecting IDE clients...\n");
3639
- const detected = options2.all ? CLIENT_CONFIGS : detectClients(rootPath);
3640
- const created = [];
3641
- const notes = [];
3642
- if (detected.length === 0 && !options2.all) {
3643
- writeStderr(
3644
- "No IDE client directories detected (.cursor/, .windsurf/, .vscode/, .claude/).\nUse --all to generate configs for all supported clients.\n"
3645
- );
3646
- return;
3647
- }
3648
- for (const client of detected) {
3649
- if (!client.configPath) {
3650
- if (client.note) {
3651
- notes.push(`${client.name}: ${client.note}`);
3652
- }
3653
- continue;
3654
- }
3655
- const fullPath = path.join(rootPath, client.configPath);
3656
- if (fs.existsSync(fullPath) && !options2.yes) {
3657
- writeStderr(` [skip] ${client.configPath} already exists.
3658
- `);
3659
- continue;
3660
- }
3661
- const config2 = client.buildConfig();
3662
- if (!config2) {
3663
- if (client.note) {
3664
- notes.push(`${client.name}: ${client.note}`);
3665
- }
3666
- continue;
3667
- }
3668
- ensureDir(fullPath);
3669
- fs.writeFileSync(fullPath, config2, "utf-8");
3670
- created.push(client.configPath);
3671
- writeStderr(` [created] ${client.configPath} (${client.name})
3672
- `);
3766
+ function runInit(options2) {
3767
+ const rootPath = process.cwd();
3768
+ const detected = options2.all ? CLIENT_CONFIGS : detectClients(rootPath);
3769
+ const created = [];
3770
+ const skipped = [];
3771
+ const notes = [];
3772
+ if (detected.length === 0 && !options2.all) {
3773
+ return { created, skipped, notes, noClients: true };
3774
+ }
3775
+ for (const client of detected) {
3776
+ if (!client.configPath) {
3673
3777
  if (client.note) {
3674
- notes.push(`${client.name}: ${client.note}`);
3778
+ notes.push({ client: client.name, note: client.note });
3675
3779
  }
3780
+ continue;
3676
3781
  }
3677
- writeStderr("\n");
3678
- if (created.length > 0) {
3679
- writeStdout(`Created ${created.length} MCP config file(s):
3680
- `);
3681
- for (const p of created) {
3682
- writeStdout(` - ${p}
3683
- `);
3684
- }
3685
- } else {
3686
- writeStdout("No new config files created.\n");
3782
+ const fullPath = path.join(rootPath, client.configPath);
3783
+ if (fs.existsSync(fullPath) && !options2.yes) {
3784
+ skipped.push(`${client.configPath} (${client.name}) \u2014 already exists`);
3785
+ continue;
3687
3786
  }
3688
- if (notes.length > 0) {
3689
- writeStdout("\nManual steps:\n");
3690
- for (const note of notes) {
3691
- writeStdout(` ${note}
3692
- `);
3787
+ const config2 = client.buildConfig();
3788
+ if (!config2) {
3789
+ if (client.note) {
3790
+ notes.push({ client: client.name, note: client.note });
3693
3791
  }
3792
+ continue;
3694
3793
  }
3695
- writeStdout(
3696
- "\nNext: Run `agent-lint doctor` to scan your workspace and generate a fix report.\n"
3697
- );
3698
- });
3794
+ ensureDir(fullPath);
3795
+ fs.writeFileSync(fullPath, config2, "utf-8");
3796
+ created.push(`${client.configPath} (${client.name})`);
3797
+ if (client.note) {
3798
+ notes.push({ client: client.name, note: client.note });
3799
+ }
3800
+ }
3801
+ return { created, skipped, notes, noClients: false };
3802
+ }
3803
+ function InitApp({ options: options2 }) {
3804
+ const [phase, setPhase] = useState("scanning");
3805
+ const [result, setResult] = useState(null);
3806
+ useEffect(() => {
3807
+ const timer = setTimeout(() => {
3808
+ const r = runInit(options2);
3809
+ setResult(r);
3810
+ setPhase("done");
3811
+ }, 300);
3812
+ return () => clearTimeout(timer);
3813
+ }, []);
3814
+ return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", children: [
3815
+ /* @__PURE__ */ jsx2(Banner, {}),
3816
+ /* @__PURE__ */ jsx2(Divider, {}),
3817
+ phase === "scanning" && /* @__PURE__ */ jsx2(Box2, { marginTop: 1, marginLeft: 2, children: /* @__PURE__ */ jsx2(Spinner, { label: "Detecting IDE clients..." }) }),
3818
+ phase === "done" && result && /* @__PURE__ */ jsx2(Fragment, { children: result.noClients ? /* @__PURE__ */ jsxs2(Fragment, { children: [
3819
+ /* @__PURE__ */ jsx2(SectionTitle, { children: "No IDE clients detected" }),
3820
+ /* @__PURE__ */ jsx2(Box2, { marginLeft: 2, marginTop: 0, children: /* @__PURE__ */ jsx2(Text2, { color: colors.muted, children: "No .cursor/, .windsurf/, .vscode/, or .claude/ directories found." }) }),
3821
+ /* @__PURE__ */ jsx2(NextStep, { children: "Use --all to generate configs for all supported clients." })
3822
+ ] }) : /* @__PURE__ */ jsxs2(Fragment, { children: [
3823
+ result.created.length > 0 && /* @__PURE__ */ jsxs2(Fragment, { children: [
3824
+ /* @__PURE__ */ jsx2(SectionTitle, { children: "Created" }),
3825
+ result.created.map((item, i) => /* @__PURE__ */ jsx2(SuccessItem, { children: item }, i))
3826
+ ] }),
3827
+ result.skipped.length > 0 && /* @__PURE__ */ jsxs2(Fragment, { children: [
3828
+ /* @__PURE__ */ jsx2(SectionTitle, { children: "Skipped" }),
3829
+ result.skipped.map((item, i) => /* @__PURE__ */ jsx2(SkipItem, { children: item }, i))
3830
+ ] }),
3831
+ result.notes.length > 0 && /* @__PURE__ */ jsxs2(Fragment, { children: [
3832
+ /* @__PURE__ */ jsx2(SectionTitle, { children: "Manual steps" }),
3833
+ result.notes.map((n, i) => /* @__PURE__ */ jsx2(InfoItem, { children: `${n.client}: ${n.note}` }, i))
3834
+ ] }),
3835
+ result.created.length === 0 && result.skipped.length > 0 && /* @__PURE__ */ jsx2(Box2, { marginLeft: 2, marginTop: 1, children: /* @__PURE__ */ jsx2(Text2, { color: colors.muted, children: "No new config files created." }) }),
3836
+ /* @__PURE__ */ jsx2(NextStep, { children: `Run ${"`"}agent-lint doctor${"`"} to scan your workspace.` })
3837
+ ] }) })
3838
+ ] });
3839
+ }
3840
+ function runInitCommand(options2) {
3841
+ render(/* @__PURE__ */ jsx2(InitApp, { options: options2 }));
3699
3842
  }
3700
3843
 
3701
- // src/commands/doctor.ts
3844
+ // src/commands/doctor.tsx
3845
+ import { useState as useState2, useEffect as useEffect2 } from "react";
3702
3846
  import fs3 from "fs";
3703
3847
  import path3 from "path";
3848
+ import { Box as Box3, render as render2 } from "ink";
3849
+ import { Spinner as Spinner2 } from "@inkjs/ui";
3704
3850
 
3705
3851
  // ../../node_modules/.bun/zod@4.3.6/node_modules/zod/v4/classic/external.js
3706
3852
  var external_exports = {};
@@ -18060,61 +18206,138 @@ function buildWorkspaceAutofixPlan(rootPath) {
18060
18206
  };
18061
18207
  }
18062
18208
 
18063
- // src/commands/doctor.ts
18209
+ // src/commands/doctor.tsx
18210
+ import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
18064
18211
  var REPORT_FILENAME = ".agentlint-report.md";
18065
- function registerDoctorCommand(program) {
18066
- program.command("doctor").description("Scan workspace for context artifacts and generate a fix report").option("--stdout", "Print report to stdout instead of writing a file").option("--json", "Output discovery results as JSON").action(async (options2) => {
18212
+ function runDoctor() {
18213
+ const rootPath = process.cwd();
18214
+ const plan = buildWorkspaceAutofixPlan(rootPath);
18215
+ const { discoveryResult } = plan;
18216
+ return {
18217
+ discoveredCount: discoveryResult.discovered.length,
18218
+ missingCount: discoveryResult.missing.length,
18219
+ discovered: discoveryResult.discovered.map(
18220
+ (d) => `${d.relativePath} (${d.type})`
18221
+ ),
18222
+ missing: discoveryResult.missing.map((m) => String(m)),
18223
+ markdown: plan.markdown
18224
+ };
18225
+ }
18226
+ function DoctorApp() {
18227
+ const [phase, setPhase] = useState2("scanning");
18228
+ const [result, setResult] = useState2(null);
18229
+ useEffect2(() => {
18230
+ const timer = setTimeout(() => {
18231
+ const r = runDoctor();
18232
+ const reportPath = path3.join(process.cwd(), REPORT_FILENAME);
18233
+ fs3.writeFileSync(reportPath, r.markdown, "utf-8");
18234
+ setResult(r);
18235
+ setPhase("done");
18236
+ }, 400);
18237
+ return () => clearTimeout(timer);
18238
+ }, []);
18239
+ return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
18240
+ /* @__PURE__ */ jsx3(Banner, {}),
18241
+ /* @__PURE__ */ jsx3(Divider, {}),
18242
+ phase === "scanning" && /* @__PURE__ */ jsx3(Box3, { marginTop: 1, marginLeft: 2, children: /* @__PURE__ */ jsx3(Spinner2, { label: "Scanning workspace for context artifacts..." }) }),
18243
+ phase === "done" && result && /* @__PURE__ */ jsxs3(Fragment2, { children: [
18244
+ /* @__PURE__ */ jsx3(
18245
+ StatusBar,
18246
+ {
18247
+ items: [
18248
+ {
18249
+ label: "Found",
18250
+ value: result.discoveredCount,
18251
+ color: result.discoveredCount > 0 ? colors.success : colors.warning
18252
+ },
18253
+ {
18254
+ label: "Missing",
18255
+ value: result.missingCount,
18256
+ color: result.missingCount > 0 ? colors.warning : colors.success
18257
+ }
18258
+ ]
18259
+ }
18260
+ ),
18261
+ result.discovered.length > 0 && /* @__PURE__ */ jsxs3(Fragment2, { children: [
18262
+ /* @__PURE__ */ jsx3(SectionTitle, { children: "Discovered artifacts" }),
18263
+ result.discovered.map((item, i) => /* @__PURE__ */ jsx3(SuccessItem, { children: item }, i))
18264
+ ] }),
18265
+ result.missing.length > 0 && /* @__PURE__ */ jsxs3(Fragment2, { children: [
18266
+ /* @__PURE__ */ jsx3(SectionTitle, { children: "Missing artifact types" }),
18267
+ result.missing.map((item, i) => /* @__PURE__ */ jsx3(ErrorItem, { children: item }, i))
18268
+ ] }),
18269
+ /* @__PURE__ */ jsx3(SectionTitle, { children: "Report saved" }),
18270
+ /* @__PURE__ */ jsx3(InfoItem, { children: REPORT_FILENAME }),
18271
+ /* @__PURE__ */ jsx3(NextStep, { children: `Run ${"agent-lint prompt"} to get a copy-paste prompt for your IDE.` })
18272
+ ] })
18273
+ ] });
18274
+ }
18275
+ function runDoctorCommand(options2) {
18276
+ if (options2.json) {
18067
18277
  const rootPath = process.cwd();
18068
- writeStderr("Agent Lint doctor \u2014 scanning workspace...\n");
18069
18278
  const plan = buildWorkspaceAutofixPlan(rootPath);
18070
- const { discoveryResult } = plan;
18071
- writeStderr(
18072
- ` Found ${discoveryResult.discovered.length} artifact(s), ${discoveryResult.missing.length} type(s) missing.
18073
-
18074
- `
18075
- );
18076
- if (options2.json) {
18077
- writeStdout(JSON.stringify(discoveryResult, null, 2));
18078
- return;
18079
- }
18080
- if (options2.stdout) {
18081
- writeStdout(plan.markdown);
18082
- return;
18083
- }
18084
- const reportPath = path3.join(rootPath, REPORT_FILENAME);
18085
- fs3.writeFileSync(reportPath, plan.markdown, "utf-8");
18086
- writeStdout(`Report written to ${REPORT_FILENAME}
18087
- `);
18088
- writeStdout(
18089
- `
18090
- Next: Run \`agent-lint prompt\` to get a copy-paste prompt for your IDE.
18091
- `
18092
- );
18093
- });
18279
+ process.stdout.write(JSON.stringify(plan.discoveryResult, null, 2) + "\n");
18280
+ return;
18281
+ }
18282
+ if (options2.stdout) {
18283
+ const result = runDoctor();
18284
+ process.stdout.write(result.markdown + "\n");
18285
+ return;
18286
+ }
18287
+ render2(/* @__PURE__ */ jsx3(DoctorApp, {}));
18094
18288
  }
18095
18289
 
18096
- // src/commands/prompt.ts
18290
+ // src/commands/prompt.tsx
18291
+ import { useState as useState3, useEffect as useEffect3 } from "react";
18097
18292
  import fs4 from "fs";
18098
18293
  import path4 from "path";
18294
+ import { Box as Box4, Text as Text4, render as render3 } from "ink";
18295
+ import clipboardy from "clipboardy";
18296
+ import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
18099
18297
  var REPORT_FILENAME2 = ".agentlint-report.md";
18100
18298
  var PROMPT_WITH_REPORT = "Read the file .agentlint-report.md in this project and execute all recommended fixes. Use the agentlint MCP tools (agentlint_get_guidelines, agentlint_plan_workspace_autofix) for detailed guidelines on each artifact type. Apply all changes directly.";
18101
18299
  var PROMPT_WITHOUT_REPORT = "Run agentlint_plan_workspace_autofix to scan this project for AI agent context artifacts (AGENTS.md, skills, rules, workflows, plans). Then execute the fix plan step by step. Use agentlint_get_guidelines for each artifact type before editing. Apply all changes directly.";
18102
- function registerPromptCommand(program) {
18103
- program.command("prompt").description("Print a copy-paste prompt for your IDE chat to trigger autofix").action(async () => {
18104
- const rootPath = process.cwd();
18105
- const reportPath = path4.join(rootPath, REPORT_FILENAME2);
18106
- const hasReport = fs4.existsSync(reportPath);
18107
- const prompt = hasReport ? PROMPT_WITH_REPORT : PROMPT_WITHOUT_REPORT;
18108
- writeStdout(prompt);
18109
- if (!hasReport) {
18110
- writeStdout(
18111
- "\n\nTip: Run `agent-lint doctor` first to generate a detailed report for better results."
18112
- );
18113
- }
18114
- });
18300
+ function PromptApp() {
18301
+ const rootPath = process.cwd();
18302
+ const reportPath = path4.join(rootPath, REPORT_FILENAME2);
18303
+ const hasReport = fs4.existsSync(reportPath);
18304
+ const prompt = hasReport ? PROMPT_WITH_REPORT : PROMPT_WITHOUT_REPORT;
18305
+ const [copied, setCopied] = useState3(false);
18306
+ const [copyError, setCopyError] = useState3(false);
18307
+ useEffect3(() => {
18308
+ clipboardy.write(prompt).then(() => setCopied(true)).catch(() => setCopyError(true));
18309
+ }, []);
18310
+ return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
18311
+ /* @__PURE__ */ jsx4(Banner, {}),
18312
+ /* @__PURE__ */ jsx4(Divider, {}),
18313
+ /* @__PURE__ */ jsxs4(Box4, { marginTop: 1, marginLeft: 1, gap: 1, children: [
18314
+ copied && /* @__PURE__ */ jsxs4(Fragment3, { children: [
18315
+ /* @__PURE__ */ jsx4(Text4, { color: colors.success, bold: true, children: "+" }),
18316
+ /* @__PURE__ */ jsx4(Text4, { color: colors.success, bold: true, children: "Copied to clipboard!" }),
18317
+ /* @__PURE__ */ jsx4(Text4, { color: colors.muted, children: "Paste it into your IDE chat." })
18318
+ ] }),
18319
+ copyError && /* @__PURE__ */ jsxs4(Fragment3, { children: [
18320
+ /* @__PURE__ */ jsx4(Text4, { color: colors.warning, children: "~" }),
18321
+ /* @__PURE__ */ jsx4(Text4, { color: colors.warning, children: "Could not copy to clipboard." }),
18322
+ /* @__PURE__ */ jsx4(Text4, { color: colors.muted, children: "Copy the prompt below manually." })
18323
+ ] }),
18324
+ !copied && !copyError && /* @__PURE__ */ jsx4(Text4, { color: colors.muted, children: "Copying to clipboard..." })
18325
+ ] }),
18326
+ /* @__PURE__ */ jsx4(PromptBox, { children: prompt }),
18327
+ hasReport ? /* @__PURE__ */ jsxs4(Box4, { marginLeft: 3, children: [
18328
+ /* @__PURE__ */ jsx4(Text4, { color: colors.success, bold: true, children: "+ " }),
18329
+ /* @__PURE__ */ jsxs4(Text4, { color: colors.muted, children: [
18330
+ "Using report from ",
18331
+ REPORT_FILENAME2
18332
+ ] })
18333
+ ] }) : /* @__PURE__ */ jsx4(Hint, { children: "Run agent-lint doctor first to generate a detailed report for better results." })
18334
+ ] });
18335
+ }
18336
+ function runPromptCommand() {
18337
+ render3(/* @__PURE__ */ jsx4(PromptApp, {}));
18115
18338
  }
18116
18339
 
18117
- // src/index.ts
18340
+ // src/index.tsx
18118
18341
  var nodeVersion = parseInt(process.versions.node.split(".")[0], 10);
18119
18342
  if (nodeVersion < 18) {
18120
18343
  process.stderr.write(
@@ -18123,25 +18346,27 @@ if (nodeVersion < 18) {
18123
18346
  );
18124
18347
  process.exit(1);
18125
18348
  }
18126
- async function main() {
18127
- redirectLogsToStderr();
18128
- const program = new Command();
18129
- program.name("agent-lint").description("Meta-agent orchestrator for AI coding agent context artifacts").version("0.2.0").showHelpAfterError();
18130
- registerInitCommand(program);
18131
- registerDoctorCommand(program);
18132
- registerPromptCommand(program);
18133
- const argv = process.argv.slice(2);
18134
- const normalizedArgv = argv[0] === "--" ? argv.slice(1) : argv;
18135
- try {
18136
- await program.parseAsync([process.argv[0], process.argv[1], ...normalizedArgv]);
18137
- } catch (error48) {
18138
- const message = error48 instanceof Error ? error48.message : "Unknown CLI error";
18139
- process.stderr.write(`${message}
18349
+ var program = new Command();
18350
+ program.name("agent-lint").description("Meta-agent orchestrator for AI coding agent context artifacts").version("0.3.1").showHelpAfterError();
18351
+ program.command("init").description("Set up Agent Lint MCP config for detected IDE clients").option("-y, --yes", "Skip confirmation prompts").option("--all", "Generate configs for all supported clients, not just detected ones").action((options2) => {
18352
+ runInitCommand(options2);
18353
+ });
18354
+ program.command("doctor").description("Scan workspace for context artifacts and generate a fix report").option("--stdout", "Print report to stdout instead of writing a file").option("--json", "Output discovery results as JSON").action((options2) => {
18355
+ runDoctorCommand(options2);
18356
+ });
18357
+ program.command("prompt").description("Print a copy-paste prompt for your IDE chat to trigger autofix").action(() => {
18358
+ runPromptCommand();
18359
+ });
18360
+ var argv = process.argv.slice(2);
18361
+ var normalizedArgv = argv[0] === "--" ? argv.slice(1) : argv;
18362
+ try {
18363
+ program.parse([process.argv[0], process.argv[1], ...normalizedArgv]);
18364
+ } catch (error48) {
18365
+ const message = error48 instanceof Error ? error48.message : "Unknown CLI error";
18366
+ process.stderr.write(`${message}
18140
18367
  `);
18141
- process.exitCode = 2;
18142
- }
18368
+ process.exitCode = 2;
18143
18369
  }
18144
- void main();
18145
18370
  /*! Bundled license information:
18146
18371
 
18147
18372
  is-extendable/index.js: