paperlint 18.7.0 → 18.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/.claude-plugin/marketplace.json +11 -0
  2. package/.claude-plugin/plugin.json +7 -0
  3. package/CLAUDE.md +2 -2
  4. package/README.md +2 -2
  5. package/dist/adapters/claude-code/claude.io.d.ts +13 -0
  6. package/dist/adapters/claude-code/claude.io.d.ts.map +1 -0
  7. package/dist/adapters/claude-code/claude.io.js +68 -0
  8. package/dist/adapters/claude-code/claude.io.js.map +1 -0
  9. package/dist/adapters/claude-code/index.d.ts +4 -0
  10. package/dist/adapters/claude-code/index.d.ts.map +1 -0
  11. package/dist/adapters/claude-code/index.js +4 -0
  12. package/dist/adapters/claude-code/index.js.map +1 -0
  13. package/dist/adapters/claude-code/plugin.d.ts +19 -0
  14. package/dist/adapters/claude-code/plugin.d.ts.map +1 -0
  15. package/dist/adapters/claude-code/plugin.js +66 -0
  16. package/dist/adapters/claude-code/plugin.js.map +1 -0
  17. package/dist/cli.d.ts +6 -1
  18. package/dist/cli.d.ts.map +1 -1
  19. package/dist/cli.js +34 -10
  20. package/dist/cli.js.map +1 -1
  21. package/dist/doctor-plugin.d.ts +23 -0
  22. package/dist/doctor-plugin.d.ts.map +1 -0
  23. package/dist/doctor-plugin.js +56 -0
  24. package/dist/doctor-plugin.js.map +1 -0
  25. package/dist/doctor.d.ts +6 -1
  26. package/dist/doctor.d.ts.map +1 -1
  27. package/dist/doctor.js +69 -26
  28. package/dist/doctor.js.map +1 -1
  29. package/dist/hooks-settings.d.ts +18 -0
  30. package/dist/hooks-settings.d.ts.map +1 -1
  31. package/dist/hooks-settings.js +25 -0
  32. package/dist/hooks-settings.js.map +1 -1
  33. package/dist/init.d.ts +9 -1
  34. package/dist/init.d.ts.map +1 -1
  35. package/dist/init.js +144 -59
  36. package/dist/init.js.map +1 -1
  37. package/dist/link-skills.d.ts +15 -0
  38. package/dist/link-skills.d.ts.map +1 -1
  39. package/dist/link-skills.js +18 -1
  40. package/dist/link-skills.js.map +1 -1
  41. package/dist/plugin-offer.d.ts +73 -0
  42. package/dist/plugin-offer.d.ts.map +1 -0
  43. package/dist/plugin-offer.js +96 -0
  44. package/dist/plugin-offer.js.map +1 -0
  45. package/dist/ports/claude-code.d.ts +31 -0
  46. package/dist/ports/claude-code.d.ts.map +1 -0
  47. package/dist/ports/claude-code.js +2 -0
  48. package/dist/ports/claude-code.js.map +1 -0
  49. package/dist/types.d.ts +4 -0
  50. package/dist/types.d.ts.map +1 -1
  51. package/docs/install.md +62 -14
  52. package/hooks/CLAUDE.md +2 -2
  53. package/hooks/CLAUDE.md.spec.ts +1 -1
  54. package/lib/skill-checks.mjs +6 -7
  55. package/package.json +4 -1
  56. package/plugin/CLAUDE.md +22 -14
  57. package/plugin/CLAUDE.md.spec.ts +20 -12
  58. package/scripts/plugin-version.test.ts +80 -0
  59. package/scripts/plugin-version.ts +58 -0
  60. package/skills/CLAUDE.md +2 -2
  61. package/skills/CLAUDE.md.spec.ts +1 -1
  62. package/skills/paper-pipeline/references/anonymization.md +4 -3
  63. package/skills/submit-paper/SKILL.md +5 -4
  64. package/skills/submit-paper/SKILL.md.spec.ts +4 -3
  65. package/skills/submit-paper/check-deanon.sh +17 -2
  66. package/skills/submit-paper/check-deanon.test.ts +141 -0
  67. package/src/adapters/claude-code/claude.io.ts +103 -0
  68. package/src/adapters/claude-code/index.test.ts +233 -0
  69. package/src/adapters/claude-code/index.ts +11 -0
  70. package/src/adapters/claude-code/plugin.ts +82 -0
  71. package/src/cli.harness.mjs +6 -0
  72. package/src/cli.test.ts +87 -1
  73. package/src/cli.ts +56 -7
  74. package/src/doctor-plugin.test.ts +103 -0
  75. package/src/doctor-plugin.ts +83 -0
  76. package/src/doctor.test.ts +111 -2
  77. package/src/doctor.ts +83 -32
  78. package/src/hooks-notice.test.ts +82 -0
  79. package/src/hooks-settings.ts +49 -0
  80. package/src/init-plugin.test.ts +178 -0
  81. package/src/init.ts +225 -64
  82. package/src/link-skills.test.ts +34 -1
  83. package/src/link-skills.ts +34 -0
  84. package/src/parse-args.test.ts +2 -0
  85. package/src/plugin-offer.test.ts +276 -0
  86. package/src/plugin-offer.ts +160 -0
  87. package/src/ports/claude-code.ts +30 -0
  88. package/src/types.ts +4 -0
@@ -0,0 +1,276 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { scriptedPrompts, type Reply } from "../test/support.ts";
3
+ import { absolutePath } from "./domain/paths.ts";
4
+ import {
5
+ offerPlugin,
6
+ PLUGIN_QUESTION,
7
+ pluginOn,
8
+ reportPlugin,
9
+ STILL_OFF,
10
+ type PluginAsking,
11
+ type PluginOutcome,
12
+ } from "./plugin-offer.ts";
13
+ import type {
14
+ ClaudeCode,
15
+ EnableResult,
16
+ PluginState,
17
+ } from "./ports/claude-code.ts";
18
+
19
+ const ROOT = absolutePath("/project");
20
+ const RAN: EnableResult = { ok: true, ran: ["claude a", "claude b"] };
21
+
22
+ /** A Claude Code that records every `enable`, with the state and answer a test gives it. */
23
+ /** Installed, as Claude Code reads it once both commands ran. */
24
+ const INSTALLED: PluginState = { enabled: true, version: "1.0.0" };
25
+
26
+ /**
27
+ * A Claude Code whose state is `state` until `enable` runs, then `after` (installed, unless the
28
+ * test says what Claude Code reads instead, such as a local setting that keeps it off).
29
+ */
30
+ function fakeClaude({
31
+ present = true,
32
+ state = { enabled: false, version: null },
33
+ enables = RAN,
34
+ after = INSTALLED,
35
+ }: {
36
+ readonly present?: boolean;
37
+ readonly state?: PluginState;
38
+ readonly enables?: EnableResult;
39
+ readonly after?: PluginState;
40
+ } = {}): ClaudeCode & { readonly enabled: string[] } {
41
+ const enabled: string[] = [];
42
+ return {
43
+ enabled,
44
+ present: () => present,
45
+ plugin: () => (enabled.length > 0 ? after : state),
46
+ enable: (root) => (enabled.push(root), enables),
47
+ };
48
+ }
49
+
50
+ const asking = (
51
+ over: Partial<PluginAsking> & { readonly reply?: Reply } = {},
52
+ ): PluginAsking & { readonly asked: string[] } => {
53
+ const prompts = scriptedPrompts(() => over.reply);
54
+ return {
55
+ flag: null,
56
+ interactive: true,
57
+ why: "a terminal on both ends",
58
+ prompts,
59
+ asked: prompts.asked,
60
+ ...over,
61
+ };
62
+ };
63
+
64
+ describe("offerPlugin — the four paths the author named", () => {
65
+ it("a human, Yes (Enter takes the preselected Yes): asked once, turned on", async () => {
66
+ const claude = fakeClaude();
67
+ const a = asking();
68
+ expect([
69
+ await offerPlugin(ROOT, claude, a),
70
+ a.asked,
71
+ claude.enabled,
72
+ ]).toEqual([{ kind: "enabled", how: RAN }, [PLUGIN_QUESTION], [ROOT]]);
73
+ });
74
+
75
+ it("both commands ran, yet a more specific setting keeps it off: not turned on, and said why", async () => {
76
+ // `--scope project` writes .claude/settings.json; .claude/settings.local.json outranks it.
77
+ const claude = fakeClaude({ after: { enabled: false, version: "1.0.0" } });
78
+ const out = await offerPlugin(ROOT, claude, asking({ flag: "plugin" }));
79
+ expect([out, pluginOn(out), claude.enabled]).toEqual([
80
+ { kind: "failed", reason: STILL_OFF },
81
+ false,
82
+ [ROOT],
83
+ ]);
84
+ });
85
+
86
+ it("a human, No: asked once, nothing turned on", async () => {
87
+ const claude = fakeClaude();
88
+ const a = asking({ reply: false });
89
+ expect([
90
+ await offerPlugin(ROOT, claude, a),
91
+ a.asked,
92
+ claude.enabled,
93
+ ]).toEqual([{ kind: "declined" }, [PLUGIN_QUESTION], []]);
94
+ });
95
+
96
+ it("no human, --plugin: nothing asked, turned on", async () => {
97
+ const claude = fakeClaude();
98
+ const a = asking({ interactive: false, flag: "plugin" });
99
+ expect([
100
+ await offerPlugin(ROOT, claude, a),
101
+ a.asked,
102
+ claude.enabled,
103
+ ]).toEqual([{ kind: "enabled", how: RAN }, [], [ROOT]]);
104
+ });
105
+
106
+ it("no human, no flag: nothing asked, nothing turned on, the reason kept", async () => {
107
+ const claude = fakeClaude();
108
+ const a = asking({ interactive: false, why: "stdout is not a terminal" });
109
+ expect([
110
+ await offerPlugin(ROOT, claude, a),
111
+ a.asked,
112
+ claude.enabled,
113
+ ]).toEqual([
114
+ { kind: "not-asked", why: "stdout is not a terminal" },
115
+ [],
116
+ [],
117
+ ]);
118
+ });
119
+ });
120
+
121
+ describe("offerPlugin — --no-plugin", () => {
122
+ it("--no-plugin: nothing asked, nothing turned on; an installed plugin stays on", async () => {
123
+ const off = fakeClaude();
124
+ const installed = fakeClaude({
125
+ state: { enabled: true, version: "1.2.3" },
126
+ });
127
+ const a = asking({ flag: "no-plugin" });
128
+ // Skipping the offer is not turning the plugin off: init must not re-create links beside it.
129
+ expect([
130
+ await offerPlugin(ROOT, off, a),
131
+ await offerPlugin(ROOT, installed, a),
132
+ a.asked,
133
+ off.enabled,
134
+ installed.enabled,
135
+ ]).toEqual([
136
+ { kind: "no-plugin-flag" },
137
+ { kind: "already", version: "1.2.3" },
138
+ [],
139
+ [],
140
+ [],
141
+ ]);
142
+ });
143
+ });
144
+
145
+ describe("offerPlugin — the other ways it ends", () => {
146
+ it("no Claude Code: silence; --plugin turns it on all the same", async () => {
147
+ const absent = fakeClaude({ present: false });
148
+ expect([
149
+ await offerPlugin(ROOT, absent, asking()),
150
+ await offerPlugin(ROOT, undefined, asking({ flag: "plugin" })),
151
+ await offerPlugin(ROOT, absent, asking({ flag: "plugin" })),
152
+ ]).toEqual([
153
+ { kind: "no-claude" },
154
+ { kind: "no-claude" },
155
+ { kind: "enabled", how: RAN },
156
+ ]);
157
+ });
158
+
159
+ it("already on: nothing asked, its version kept", async () => {
160
+ const claude = fakeClaude({ state: { enabled: true, version: "1.2.3" } });
161
+ const a = asking();
162
+ expect([
163
+ await offerPlugin(ROOT, claude, a),
164
+ a.asked,
165
+ claude.enabled,
166
+ ]).toEqual([{ kind: "already", version: "1.2.3" }, [], []]);
167
+ });
168
+
169
+ it("Ctrl+C at the question, a prompt that fails, a missing prompts port, an enable that fails", async () => {
170
+ const failing = fakeClaude({ enables: { ok: false, reason: "boom" } });
171
+ expect([
172
+ await offerPlugin(ROOT, fakeClaude(), asking({ reply: "cancel" })),
173
+ await offerPlugin(
174
+ ROOT,
175
+ fakeClaude(),
176
+ asking({ reply: new Error("tty") }),
177
+ ),
178
+ await offerPlugin(ROOT, fakeClaude(), asking({ prompts: undefined })),
179
+ await offerPlugin(ROOT, failing, asking({ flag: "plugin" })),
180
+ ]).toEqual([
181
+ { kind: "cancelled" },
182
+ { kind: "enabled", how: RAN },
183
+ { kind: "not-asked", why: "a terminal on both ends" },
184
+ { kind: "failed", reason: "boom" },
185
+ ]);
186
+ });
187
+ });
188
+
189
+ describe("offerPlugin — declared, not installed", () => {
190
+ it("declared in settings but not installed: nothing asked, the install runs again", async () => {
191
+ // The keys say yes, but Claude Code has no install on record: the settings alone load nothing.
192
+ const declared = { enabled: true, version: null } as const;
193
+ const human = fakeClaude({ state: declared });
194
+ const noHuman = fakeClaude({ state: declared });
195
+ const a = asking({ reply: false });
196
+ expect([
197
+ await offerPlugin(ROOT, human, a),
198
+ a.asked,
199
+ human.enabled,
200
+ await offerPlugin(ROOT, noHuman, asking({ interactive: false })),
201
+ noHuman.enabled,
202
+ ]).toEqual([
203
+ { kind: "enabled", how: RAN },
204
+ [],
205
+ ["/project"],
206
+ { kind: "enabled", how: RAN },
207
+ ["/project"],
208
+ ]);
209
+ });
210
+ });
211
+
212
+ const HEAD = [
213
+ "",
214
+ "Claude Code plugin (the skills and hooks, updated with paperlint)",
215
+ ];
216
+ const outcomes: readonly PluginOutcome[] = [
217
+ { kind: "no-claude" },
218
+ { kind: "cancelled" },
219
+ { kind: "not-asked", why: "CI is set" },
220
+ { kind: "no-plugin-flag" },
221
+ { kind: "declined" },
222
+ { kind: "failed", reason: "boom" },
223
+ { kind: "already", version: "1.2.3" },
224
+ { kind: "enabled", how: RAN },
225
+ {
226
+ kind: "enabled",
227
+ how: {
228
+ ok: true,
229
+ wrote: "/project/.claude/settings.json",
230
+ owed: ["c1", "c2"],
231
+ },
232
+ },
233
+ ];
234
+
235
+ describe("pluginOn and reportPlugin", () => {
236
+ it("on only once installed: already on, or turned on by running claude — written keys are not on", () => {
237
+ expect(outcomes.map(pluginOn)).toEqual([
238
+ false,
239
+ false,
240
+ false,
241
+ false,
242
+ false,
243
+ false,
244
+ true,
245
+ true,
246
+ false,
247
+ ]);
248
+ });
249
+
250
+ it("each outcome's lines; without a human, exactly one line after the blank", () => {
251
+ expect(outcomes.map(reportPlugin)).toEqual([
252
+ [],
253
+ [],
254
+ [
255
+ "",
256
+ "Claude Code plugin: not turned on — CI is set, so nothing was asked. To turn it on: npx paperlint init --plugin",
257
+ ],
258
+ [...HEAD, " · --no-plugin — nothing asked, nothing turned on"],
259
+ [
260
+ ...HEAD,
261
+ " · declined — `npx paperlint init --plugin` turns it on later",
262
+ ],
263
+ [
264
+ ...HEAD,
265
+ " ✗ not turned on — boom. `npx paperlint init --plugin` tries again",
266
+ ],
267
+ [...HEAD, " ✓ already on for this project, version 1.2.3"],
268
+ [...HEAD, " ✓ ran claude a", " ✓ ran claude b"],
269
+ [
270
+ ...HEAD,
271
+ " ✓ declared in /project/.claude/settings.json — `claude` is not on PATH, and these keys alone load nothing.",
272
+ " once, where `claude` runs: c1 && c2",
273
+ ],
274
+ ]);
275
+ });
276
+ });
@@ -0,0 +1,160 @@
1
+ /**
2
+ * `paperlint init` offers the Claude Code plugin, which carries the skills and the hooks and is
3
+ * updated with paperlint (decided 2026-11-22; replaces "link no skills unless asked", #510).
4
+ *
5
+ * ── THE DECISIONS ─────────────────────────────────────────────────────────────
6
+ * who is offered only a project where Claude Code is: a `.claude/` folder, or `claude` on PATH.
7
+ * Anywhere else, silence.
8
+ * a human asked once, Yes preselected; No is respected.
9
+ * no human (--yes, CI, stdin or stdout not a terminal — Claude Code running init is this
10
+ * case) nothing is turned on, and ONE line names why and `--plugin`, so an
11
+ * agent can ask its user.
12
+ * --plugin on, without asking, with or without a terminal.
13
+ * --no-plugin never asked, never on.
14
+ * once it is on init removes the skill links and hook entries IT made: kept beside the
15
+ * plugin, every skill would be listed twice and every hook would run twice.
16
+ * "On" means installed. Keys written without `claude` are only declared: the
17
+ * old wiring stays, and the next init completes the install without asking.
18
+ */
19
+ import type { AbsolutePath } from "./domain/paths.ts";
20
+ import type {
21
+ ClaudeCode,
22
+ EnableResult,
23
+ PluginState,
24
+ } from "./ports/claude-code.ts";
25
+ import type { Answer, Prompts } from "./ports/prompts.ts";
26
+
27
+ /** `--plugin`, `--no-plugin`, or neither. */
28
+ export type PluginFlag = "plugin" | "no-plugin" | null;
29
+
30
+ export type PluginOutcome =
31
+ | { readonly kind: "no-claude" }
32
+ | { readonly kind: "no-plugin-flag" }
33
+ /** Declared AND installed: Claude Code has an install of this version on record. */
34
+ | { readonly kind: "already"; readonly version: string }
35
+ | {
36
+ readonly kind: "enabled";
37
+ readonly how: Exclude<EnableResult, { readonly ok: false }>;
38
+ }
39
+ | { readonly kind: "failed"; readonly reason: string }
40
+ | { readonly kind: "declined" }
41
+ | { readonly kind: "not-asked"; readonly why: string }
42
+ | { readonly kind: "cancelled" };
43
+
44
+ export interface PluginAsking {
45
+ readonly flag: PluginFlag;
46
+ readonly interactive: boolean;
47
+ /** Why nothing is asked, as `interactivity()` says it. */
48
+ readonly why: string;
49
+ readonly prompts?: Prompts | undefined;
50
+ }
51
+
52
+ export const PLUGIN_QUESTION =
53
+ "Turn on the paperlint plugin for Claude Code? (the skills and hooks, updated with paperlint)";
54
+
55
+ const ask = async (prompts: Prompts): Promise<Answer<boolean>> => {
56
+ try {
57
+ return await prompts.confirm({ message: PLUGIN_QUESTION, initial: true });
58
+ } catch {
59
+ return { kind: "answer", value: true };
60
+ }
61
+ };
62
+
63
+ /** Whether to go ahead: the flag, else a human's answer; an outcome when it stops here. */
64
+ async function decided(asking: PluginAsking): Promise<PluginOutcome | null> {
65
+ if (asking.flag === "plugin") return null;
66
+ if (!asking.interactive || !asking.prompts)
67
+ return { kind: "not-asked", why: asking.why };
68
+ const answer = await ask(asking.prompts);
69
+ if (answer.kind === "cancel") return { kind: "cancelled" };
70
+ return answer.value ? null : { kind: "declined" };
71
+ }
72
+
73
+ /**
74
+ * The plugin's version once Claude Code has installed it, else null. The settings keys alone load
75
+ * nothing (they are written where `claude` is not on PATH too), so every reader that drops the old
76
+ * wiring asks this, never `enabled` by itself.
77
+ */
78
+ export const installedPluginVersion = (
79
+ state: PluginState | null,
80
+ ): string | null => (state?.enabled ? state.version : null);
81
+
82
+ /** The plugin's state where Claude Code runs in this project, else null. */
83
+ const stateIn = (
84
+ root: AbsolutePath,
85
+ claude: ClaudeCode | undefined,
86
+ ): PluginState | null => (claude?.present(root) ? claude.plugin(root) : null);
87
+
88
+ export async function offerPlugin(
89
+ root: AbsolutePath,
90
+ claude: ClaudeCode | undefined,
91
+ asking: PluginAsking,
92
+ ): Promise<PluginOutcome> {
93
+ // `--no-plugin` skips the offer; it does not turn an installed plugin off, so that is read first.
94
+ const state = stateIn(root, claude);
95
+ const version = installedPluginVersion(state);
96
+ if (version !== null) return { kind: "already", version };
97
+ if (asking.flag === "no-plugin") return { kind: "no-plugin-flag" };
98
+ if (!claude || (!state && asking.flag !== "plugin"))
99
+ return { kind: "no-claude" };
100
+ // Declared but not installed (the keys were written where `claude` was not on PATH): the project
101
+ // already said yes, so nothing is asked again; enabling now completes the install.
102
+ const stop = state?.enabled ? null : await decided(asking);
103
+ if (stop !== null) return stop;
104
+ return enableNow(root, claude);
105
+ }
106
+
107
+ /** Why the plugin is off although both commands ran. */
108
+ export const STILL_OFF =
109
+ "both commands ran, but Claude Code still reads it as off here: a more specific settings file, such as .claude/settings.local.json, turns paperlint@paperlint off. Remove that entry";
110
+
111
+ /**
112
+ * Runs the commands, then reads what Claude Code reads: they write the project's settings, and a
113
+ * more specific file can still say off. Only an install that reads as on counts as on.
114
+ */
115
+ function enableNow(root: AbsolutePath, claude: ClaudeCode): PluginOutcome {
116
+ const how = claude.enable(root);
117
+ if (!how.ok) return { kind: "failed", reason: how.reason };
118
+ if ("ran" in how && installedPluginVersion(claude.plugin(root)) === null)
119
+ return { kind: "failed", reason: STILL_OFF };
120
+ return { kind: "enabled", how };
121
+ }
122
+
123
+ /**
124
+ * The plugin is on once Claude Code has installed it: the old links and hook entries then go. Keys
125
+ * written without `claude` load nothing, so until the owed commands run the old wiring stays.
126
+ */
127
+ export const pluginOn = (o: PluginOutcome): boolean =>
128
+ o.kind === "already" || (o.kind === "enabled" && "ran" in o.how);
129
+
130
+ const AGAIN = "`npx paperlint init --plugin`";
131
+
132
+ /** The plugin section of init's report: a header and its lines, or nothing at all. */
133
+ export function reportPlugin(o: PluginOutcome): readonly string[] {
134
+ if (o.kind === "no-claude" || o.kind === "cancelled") return [];
135
+ // ONE line without a human: an agent that ran init reads it and can ask its user.
136
+ if (o.kind === "not-asked")
137
+ return [
138
+ ``,
139
+ `Claude Code plugin: not turned on — ${o.why}, so nothing was asked. To turn it on: npx paperlint init --plugin`,
140
+ ];
141
+ const head = [
142
+ ``,
143
+ `Claude Code plugin (the skills and hooks, updated with paperlint)`,
144
+ ];
145
+ if (o.kind === "no-plugin-flag")
146
+ return [...head, ` · --no-plugin — nothing asked, nothing turned on`];
147
+ if (o.kind === "declined")
148
+ return [...head, ` · declined — ${AGAIN} turns it on later`];
149
+ if (o.kind === "failed")
150
+ return [...head, ` ✗ not turned on — ${o.reason}. ${AGAIN} tries again`];
151
+ if (o.kind === "already")
152
+ return [...head, ` ✓ already on for this project, version ${o.version}`];
153
+ return "ran" in o.how
154
+ ? [...head, ...o.how.ran.map((c) => ` ✓ ran ${c}`)]
155
+ : [
156
+ ...head,
157
+ ` ✓ declared in ${o.how.wrote} — \`claude\` is not on PATH, and these keys alone load nothing.`,
158
+ ` once, where \`claude\` runs: ${o.how.owed.join(" && ")}`,
159
+ ];
160
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Claude Code, as `paperlint init`, `doctor` and the in-session notice need it: is it here, is the
3
+ * paperlint plugin turned on for this project (and at which version), and turning it on.
4
+ */
5
+ import type { AbsolutePath } from "../domain/paths.ts";
6
+
7
+ export interface PluginState {
8
+ /** Turned on for the project, by the most specific settings file that names it. */
9
+ readonly enabled: boolean;
10
+ /** The version Claude Code installed for this project, or null when it has none on record. */
11
+ readonly version: string | null;
12
+ }
13
+
14
+ /** How the plugin was turned on, in the commands or files that did it. */
15
+ export type EnableResult =
16
+ | { readonly ok: true; readonly ran: readonly string[] }
17
+ | {
18
+ readonly ok: true;
19
+ readonly wrote: string;
20
+ /** The commands still owed where `claude` runs: the keys alone load nothing. */
21
+ readonly owed: readonly string[];
22
+ }
23
+ | { readonly ok: false; readonly reason: string };
24
+
25
+ export interface ClaudeCode {
26
+ /** A `.claude/` folder in the project, or `claude` on PATH. */
27
+ readonly present: (root: AbsolutePath) => boolean;
28
+ readonly plugin: (root: AbsolutePath) => PluginState;
29
+ readonly enable: (root: AbsolutePath) => EnableResult;
30
+ }
package/src/types.ts CHANGED
@@ -60,6 +60,10 @@ export interface Args {
60
60
  yes: boolean;
61
61
  /** `--no-hooks`: `init` does not touch `.claude/settings.json`. */
62
62
  noHooks: boolean;
63
+ /** `--plugin`: `init` turns the Claude Code plugin on without asking. */
64
+ plugin: boolean;
65
+ /** `--no-plugin`: `init` neither asks about the plugin nor turns it on. */
66
+ noPlugin: boolean;
63
67
  /** `--paper <name>`: `init` creates this paper. */
64
68
  paper: string | null;
65
69
  /** `--venue <preset>` for `new`: a shipped preset name, or a path to the project's own. */