@litfamily/litclaude 1.0.53 → 1.0.55
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/CHANGELOG.md +68 -0
- package/README.md +15 -9
- package/README_ko-KR.md +15 -9
- package/bin/litclaude-ai.js +1 -1
- package/docs/assets/readme/badge-version.svg +1 -1
- package/docs/assets/skills/ultra-brainstorm.webp +0 -0
- package/docs/hooks.md +42 -23
- package/docs/migration.md +8 -8
- package/package.json +1 -1
- package/plugins/litclaude/.claude-plugin/plugin.json +1 -1
- package/plugins/litclaude/bin/litclaude-hook.js +190 -35
- package/plugins/litclaude/bin/litclaude-hud.js +4 -1
- package/plugins/litclaude/bin/litclaude-mcp.js +1 -1
- package/plugins/litclaude/commands/lit-adhd.md +13 -15
- package/plugins/litclaude/commands/lit-comprehend.md +1 -1
- package/plugins/litclaude/commands/lit-loop.md +3 -5
- package/plugins/litclaude/commands/lit-plan.md +5 -4
- package/plugins/litclaude/commands/lit-recap.md +17 -30
- package/plugins/litclaude/commands/lit-rewind.md +13 -15
- package/plugins/litclaude/commands/litgoal.md +3 -5
- package/plugins/litclaude/commands/start-work.md +2 -2
- package/plugins/litclaude/commands/ultra-brainstorm.md +96 -0
- package/plugins/litclaude/commands/wikify.md +1 -1
- package/plugins/litclaude/hooks/lit-mod.mjs +76 -3
- package/plugins/litclaude/lib/canonical-runtime-commitments.mjs +6 -6
- package/plugins/litclaude/lib/canonical-skill-catalog.mjs +1 -1
- package/plugins/litclaude/lib/canonical-skill-resources.mjs +18 -14
- package/plugins/litclaude/lib/goal-pipeline.mjs +112 -0
- package/plugins/litclaude/lib/hud-ignition.mjs +3 -1
- package/plugins/litclaude/lib/mod/frame.mjs +32 -7
- package/plugins/litclaude/lib/mod/goal.mjs +92 -0
- package/plugins/litclaude/lib/mod/motion.mjs +24 -3
- package/plugins/litclaude/lib/mod/skills.mjs +1 -1
- package/plugins/litclaude/lib/mod/state.mjs +2 -1
- package/plugins/litclaude/lib/mod/timeline.mjs +38 -1
- package/plugins/litclaude/lib/mod/view.mjs +18 -7
- package/plugins/litclaude/lib/mod/workflow.mjs +1 -0
- package/plugins/litclaude/lib/native-goal-binding.mjs +1 -1
- package/plugins/litclaude/lib/rewind/collect.mjs +100 -13
- package/plugins/litclaude/lib/rewind/verdict.mjs +268 -0
- package/plugins/litclaude/lib/skill-plan.mjs +234 -0
- package/plugins/litclaude/lib/start-work-lifecycle.mjs +2 -1
- package/plugins/litclaude/lib/workflow-check.mjs +1 -1
- package/plugins/litclaude/lib/workflow-stack.mjs +8 -1
- package/plugins/litclaude/scripts/goal-propose.mjs +57 -0
- package/plugins/litclaude/scripts/scaffold-plan.mjs +4 -0
- package/plugins/litclaude/skills/autoconference/SKILL.md +1 -1
- package/plugins/litclaude/skills/browser-drive/SKILL.md +4 -0
- package/plugins/litclaude/skills/browser-drive/scripts/capability-probe.mjs +189 -42
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/interface-probe-page.mjs +3 -1
- package/plugins/litclaude/skills/frontend-ui-ux/scripts/interface-probe.mjs +5 -2
- package/plugins/litclaude/skills/lit-adhd/SKILL.md +47 -16
- package/plugins/litclaude/skills/lit-brainstorm/SKILL.md +1 -0
- package/plugins/litclaude/skills/lit-code/SKILL.md +3 -3
- package/plugins/litclaude/skills/lit-comprehend/SKILL.md +3 -2
- package/plugins/litclaude/skills/lit-handoff/SKILL.md +1 -0
- package/plugins/litclaude/skills/lit-loop/SKILL.md +2 -5
- package/plugins/litclaude/skills/lit-plan/SKILL.md +16 -8
- package/plugins/litclaude/skills/lit-team/SKILL.md +94 -56
- package/plugins/litclaude/skills/litgoal/SKILL.md +3 -8
- package/plugins/litclaude/skills/litresearch/SKILL.md +1 -0
- package/plugins/litclaude/skills/litwork/SKILL.md +1 -4
- package/plugins/litclaude/skills/review-work/SKILL.md +3 -2
- package/plugins/litclaude/skills/start-work/SKILL.md +7 -9
- package/plugins/litclaude/skills/ultra-brainstorm/SKILL.md +180 -0
- package/plugins/litclaude/skills/ultra-brainstorm/references/lenses.md +38 -0
- package/plugins/litclaude/skills/ultra-brainstorm/references/workflow-script.md +78 -0
- package/plugins/litclaude/skills/ultra-brainstorm/scripts/estimate.mjs +39 -0
- package/plugins/litclaude/skills/wikify/SKILL.md +3 -3
- package/docs/assets/skills/lit-recap.webp +0 -0
- package/plugins/litclaude/skills/lit-recap/SKILL.md +0 -175
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
// The skill plan of a bare-lit prompt (S1). The prompt hook's cascade still picks ONE primary route, first
|
|
2
|
+
// match wins, exactly as before. This module adds the companions: every other content route the same prompt
|
|
3
|
+
// matched, in the cascade's priority order, deduplicated and capped, plus lit-crucible when the ask is a large
|
|
4
|
+
// or risky design. The model confirms or drops each companion against a short catalog of the skills that are
|
|
5
|
+
// installed here and states the final plan before it works. `lit +viz +ui <task>` names the plan outright.
|
|
6
|
+
//
|
|
7
|
+
// An extension skill (the nine that moved to the wjgoarxiv-skills marketplace) is offered under its plugin's
|
|
8
|
+
// name only when that plugin is installed for this project; otherwise the plan names it once with its install
|
|
9
|
+
// line. Read-only primaries (lit-adhd, review-work, litresearch, the brainstorms) never gain a companion that
|
|
10
|
+
// can write. Pure apart from `installedExtensionPlugins`, which reads Claude Code's own plugin records.
|
|
11
|
+
import { lstatSync, readFileSync, realpathSync } from "node:fs";
|
|
12
|
+
import { homedir } from "node:os";
|
|
13
|
+
import { join, sep } from "node:path";
|
|
14
|
+
import { EXTENSION_SKILLS } from "./extensions-notice.mjs";
|
|
15
|
+
|
|
16
|
+
export const PLAN_CAP = 3;
|
|
17
|
+
const FORCED_CAP = 3;
|
|
18
|
+
|
|
19
|
+
// `lit +<alias>` names. Short words a user can type without looking anything up.
|
|
20
|
+
export const SKILL_ALIASES = Object.freeze({
|
|
21
|
+
viz: "lit-scientific-visualization",
|
|
22
|
+
plot: "lit-scientific-visualization",
|
|
23
|
+
ui: "frontend-ui-ux",
|
|
24
|
+
design: "frontend-ui-ux",
|
|
25
|
+
qa: "visual-qa",
|
|
26
|
+
crucible: "lit-crucible",
|
|
27
|
+
plan: "lit-plan",
|
|
28
|
+
research: "litresearch",
|
|
29
|
+
review: "review-work",
|
|
30
|
+
debug: "debugging",
|
|
31
|
+
deck: "lit-pptx",
|
|
32
|
+
slides: "lit-pptx",
|
|
33
|
+
pptx: "lit-pptx",
|
|
34
|
+
doc: "lit-docx",
|
|
35
|
+
docx: "lit-docx",
|
|
36
|
+
diagram: "lit-diagram-drawer",
|
|
37
|
+
schematic: "lit-schematic",
|
|
38
|
+
motion: "lit-typographic-motion",
|
|
39
|
+
video: "lit-typographic-motion",
|
|
40
|
+
readme: "readme-studio",
|
|
41
|
+
ast: "structural-search",
|
|
42
|
+
refactor: "refactor",
|
|
43
|
+
brainstorm: "lit-brainstorm",
|
|
44
|
+
ultra: "ultra-brainstorm",
|
|
45
|
+
humanize: "lit-humanizer",
|
|
46
|
+
commit: "lit-commit",
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Routes that only read. A plan led by one of these keeps only companions from this set.
|
|
50
|
+
export const READ_ONLY_SKILLS = Object.freeze(new Set(["lit-adhd", "lit-rewind", "review-work", "litresearch", "lit-brainstorm", "ultra-brainstorm", "lit-crucible"]));
|
|
51
|
+
const READ_ONLY_PRIMARIES = new Set(["lit-adhd", "lit-rewind", "review-work", "litresearch", "lit-brainstorm", "ultra-brainstorm"]);
|
|
52
|
+
|
|
53
|
+
// The moved figures skill is user-invoked (disable-model-invocation): the model cannot load it.
|
|
54
|
+
const USER_INVOKED = new Set(["lit-scientific-visualization"]);
|
|
55
|
+
|
|
56
|
+
// One "use when" line per skill the catalog may offer. Extension skills appear only when installed.
|
|
57
|
+
export const CATALOG = Object.freeze({
|
|
58
|
+
"lit-plan": "a decision-complete plan before code",
|
|
59
|
+
"lit-crucible": "pressure-test a large or risky design before planning",
|
|
60
|
+
"lit-brainstorm": "options for an open question, scored to a short list",
|
|
61
|
+
"ultra-brainstorm": "hundreds of cheap idea agents, then a judged top list",
|
|
62
|
+
litresearch: "prior work and primary sources, with references",
|
|
63
|
+
"review-work": "findings-first review of a diff or branch",
|
|
64
|
+
debugging: "reproduce, localize and fix a failure",
|
|
65
|
+
refactor: "behaviour-preserving restructure",
|
|
66
|
+
"structural-search": "syntax-shaped search or codemod",
|
|
67
|
+
"lit-humanizer": "rewrite prose in the writer's own voice",
|
|
68
|
+
"lit-commit": "commits and git history work",
|
|
69
|
+
"browser-drive": "act in a real browser page",
|
|
70
|
+
"lit-pptx": "a finished .pptx deck",
|
|
71
|
+
"lit-docx": "a finished .docx document",
|
|
72
|
+
"lit-diagram-drawer": "a conceptual diagram (architecture, flow, timeline)",
|
|
73
|
+
"lit-schematic": "a physical schematic (P&ID, PFD, apparatus, cutaway)",
|
|
74
|
+
"lit-scientific-visualization": "a publication figure of measured data",
|
|
75
|
+
"frontend-ui-ux": "build or restyle an interface",
|
|
76
|
+
"visual-qa": "check a built interface at several sizes",
|
|
77
|
+
"lit-typographic-motion": "a short kinetic-type film or README cover loop",
|
|
78
|
+
"readme-studio": "a factual README with an inspected cover",
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const realpath = (path) => {
|
|
82
|
+
try {
|
|
83
|
+
return realpathSync(path);
|
|
84
|
+
} catch {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const readJson = (path) => {
|
|
90
|
+
try {
|
|
91
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
92
|
+
} catch {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const appliesHere = (entry, cwd) => {
|
|
98
|
+
if (!entry || typeof entry !== "object") return false;
|
|
99
|
+
if (entry.scope === "user" || !entry.projectPath) return true;
|
|
100
|
+
const project = realpath(entry.projectPath);
|
|
101
|
+
const here = realpath(cwd);
|
|
102
|
+
return Boolean(project && here && (here === project || here.startsWith(`${project}${sep}`)));
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
const present = (path) => {
|
|
106
|
+
try {
|
|
107
|
+
return lstatSync(path).isDirectory();
|
|
108
|
+
} catch {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The wjgoarxiv-skills plugins Claude Code has installed and not disabled for `cwd`, from its own
|
|
115
|
+
* `plugins/installed_plugins.json` and `settings.json` records. Any unreadable record reads as none.
|
|
116
|
+
*/
|
|
117
|
+
export const installedExtensionPlugins = ({ configDir, cwd }) => {
|
|
118
|
+
const root = configDir || join(homedir(), ".claude");
|
|
119
|
+
const registry = readJson(join(root, "plugins", "installed_plugins.json"))?.plugins ?? {};
|
|
120
|
+
const enabled = readJson(join(root, "settings.json"))?.enabledPlugins ?? {};
|
|
121
|
+
const found = new Set();
|
|
122
|
+
for (const plugin of new Set(Object.values(EXTENSION_SKILLS))) {
|
|
123
|
+
const key = `${plugin}@wjgoarxiv-skills`;
|
|
124
|
+
if (enabled[key] === false) continue;
|
|
125
|
+
const entries = Array.isArray(registry[key]) ? registry[key] : [];
|
|
126
|
+
if (entries.some((entry) => appliesHere(entry, cwd) && (typeof entry.installPath !== "string" || present(entry.installPath)))) found.add(plugin);
|
|
127
|
+
}
|
|
128
|
+
return found;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const HATCH = /(?:^|\s)lit(?:work)?((?:\s+\+[a-z][a-z-]{0,30})+)(?=\s|$)/u;
|
|
132
|
+
|
|
133
|
+
/** `lit +viz +ui <task>`: the forced skills in the user's order, unknown names, and the prompt without them. */
|
|
134
|
+
export const parseSkillHatch = (text, prompt = text) => {
|
|
135
|
+
const match = HATCH.exec(typeof text === "string" ? text : "");
|
|
136
|
+
if (!match) return null;
|
|
137
|
+
const names = match[1].trim().split(/\s+/u).map((token) => token.slice(1));
|
|
138
|
+
const skills = [];
|
|
139
|
+
const unknown = [];
|
|
140
|
+
for (const name of names) {
|
|
141
|
+
const id = SKILL_ALIASES[name] ?? (Object.hasOwn(CATALOG, name) ? name : null);
|
|
142
|
+
if (!id) unknown.push(name);
|
|
143
|
+
else if (!skills.includes(id)) skills.push(id);
|
|
144
|
+
}
|
|
145
|
+
const rest = typeof prompt === "string" ? prompt.replace(/((?:^|\s)lit(?:work)?)(?:\s+\+[A-Za-z][A-Za-z-]{0,30})+(?=\s|$)/u, "$1") : prompt;
|
|
146
|
+
return { skills: skills.slice(0, FORCED_CAP), extra: skills.slice(FORCED_CAP), unknown, rest };
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
// Large or risky design asks: lit-crucible joins as the first companion. A request to explain or describe stays out.
|
|
150
|
+
const riskyDesignAsk = /\b(?:redesign(?:ing)?|re-?architect(?:ure|ing)?|architecture|migrat(?:e|ion|ing)|overhaul(?:ing)?)\b|설계|아키텍처|마이그레이션|전면\s?개편/u;
|
|
151
|
+
const explainAsk = /\b(?:explain|describe|summari[sz]e|what\s+is)\b|설명|요약/u;
|
|
152
|
+
const DELIVERABLES = new Set(["lit-pptx", "lit-docx", "frontend-ui-ux", "lit-scientific-visualization", "lit-diagram-drawer", "lit-schematic", "lit-typographic-motion", "readme-studio"]);
|
|
153
|
+
|
|
154
|
+
export const wantsCrucible = (normalized, ids) => {
|
|
155
|
+
if (explainAsk.test(normalized)) return false;
|
|
156
|
+
return riskyDesignAsk.test(normalized) || ids.filter((id) => DELIVERABLES.has(id)).length >= 3;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* The ordered plan. `primary` is the cascade's skill id; `companions` are the other matched route ids in
|
|
161
|
+
* priority order; `forced` (from parseSkillHatch) replaces the companions. Returns null when the plan is the
|
|
162
|
+
* primary alone, so an ordinary prompt's context stays exactly as it was.
|
|
163
|
+
*/
|
|
164
|
+
export const buildSkillPlan = ({ primary, companions = [], forced = null, normalized = "", installed = new Set() }) => {
|
|
165
|
+
if (typeof primary !== "string" || !primary) return null;
|
|
166
|
+
const readOnly = READ_ONLY_PRIMARIES.has(primary);
|
|
167
|
+
const dropped = [];
|
|
168
|
+
let picked;
|
|
169
|
+
if (forced) {
|
|
170
|
+
picked = forced.skills.filter((id) => id !== primary);
|
|
171
|
+
} else {
|
|
172
|
+
picked = companions.filter((id) => id !== primary);
|
|
173
|
+
if (!readOnly && primary !== "lit-crucible" && !picked.includes("lit-crucible") && wantsCrucible(normalized, [primary, ...picked])) picked.unshift("lit-crucible");
|
|
174
|
+
}
|
|
175
|
+
picked = [...new Set(picked)].filter((id) => {
|
|
176
|
+
if (readOnly && !READ_ONLY_SKILLS.has(id)) {
|
|
177
|
+
dropped.push({ id, why: `${primary} is read-only` });
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
return true;
|
|
181
|
+
});
|
|
182
|
+
const cap = forced ? FORCED_CAP : PLAN_CAP - 1;
|
|
183
|
+
for (const id of picked.slice(cap)) dropped.push({ id, why: "over the cap" });
|
|
184
|
+
picked = picked.slice(0, cap);
|
|
185
|
+
if (picked.length === 0 && !forced) return null;
|
|
186
|
+
const entries = [primary, ...picked].map((id) => {
|
|
187
|
+
const plugin = EXTENSION_SKILLS[id] ?? null;
|
|
188
|
+
return { id, plugin, installed: plugin ? installed.has(plugin) : true, userInvoked: USER_INVOKED.has(id) };
|
|
189
|
+
});
|
|
190
|
+
return { entries, dropped, forced: Boolean(forced), unknown: forced?.unknown ?? [], readOnly };
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
const entryLabel = (entry, named, primary) => {
|
|
194
|
+
const lead = primary ? " (primary)" : "";
|
|
195
|
+
if (!entry.plugin) return `${entry.id}${lead}`;
|
|
196
|
+
if (entry.installed) return `${entry.plugin}:${entry.id}${lead}${entry.userInvoked ? ` (user types /${entry.plugin}:${entry.id})` : ""}`;
|
|
197
|
+
if (named.has(entry.plugin)) return `${entry.id}${lead} (not installed)`;
|
|
198
|
+
named.add(entry.plugin);
|
|
199
|
+
return `${entry.id}${lead} (not installed: npx @litfamily/litclaude extensions install ${entry.plugin})`;
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
/** The plan line, e.g. `Skill plan: 1 lit-loop (primary) → 2 figures:lit-scientific-visualization`. */
|
|
203
|
+
export const skillPlanLine = (plan) => {
|
|
204
|
+
const named = new Set();
|
|
205
|
+
return `Skill plan: ${plan.entries.map((entry, index) => `${index + 1} ${entryLabel(entry, named, index === 0)}`).join(" → ")}`;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
/** The skill ids of a plan, bare, for the LIT card's chips. */
|
|
209
|
+
export const skillPlanIds = (plan) => (plan ? plan.entries.map(({ id }) => id) : []);
|
|
210
|
+
|
|
211
|
+
const catalogLines = (plan, installed) => {
|
|
212
|
+
const inPlan = new Set(plan.entries.map(({ id }) => id));
|
|
213
|
+
return Object.entries(CATALOG)
|
|
214
|
+
.filter(([id]) => !inPlan.has(id))
|
|
215
|
+
.filter(([id]) => !plan.readOnly || READ_ONLY_SKILLS.has(id))
|
|
216
|
+
.filter(([id]) => !EXTENSION_SKILLS[id] || installed.has(EXTENSION_SKILLS[id]))
|
|
217
|
+
.map(([id, use]) => `${EXTENSION_SKILLS[id] ? `${EXTENSION_SKILLS[id]}:${id}` : id} — ${use}`);
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
/** The model-facing block. Fixed text around the plan; nothing from the prompt is echoed. */
|
|
221
|
+
export const skillPlanContext = (plan, installed = new Set()) => {
|
|
222
|
+
const lines = [skillPlanLine(plan)];
|
|
223
|
+
if (plan.forced) {
|
|
224
|
+
lines.push("The user named this plan with `lit +…`: keep it exactly, add nothing and drop nothing.");
|
|
225
|
+
if (plan.unknown.length > 0) lines.push(`Ignored unknown plan names: ${plan.unknown.map((name) => `+${name}`).join(" ")}.`);
|
|
226
|
+
} else {
|
|
227
|
+
lines.push("The companions after the primary are candidates the hook matched, not orders: confirm or drop each one for this request, and add at most one skill from the catalog below when the work clearly needs it.");
|
|
228
|
+
}
|
|
229
|
+
for (const { id, why } of plan.dropped) lines.push(`Left out: ${id} (${why}).`);
|
|
230
|
+
lines.push("State the final plan on the line right after the probe line, in the same `Skill plan: 1 … → 2 …` form. The primary is already active; load each companion with the Skill tool when its part of the work starts, never all up front. A skill marked not installed is not loaded: give its install line once and carry on without it. A skill the user types is never loaded by you: tell the user its command when its part starts.");
|
|
231
|
+
const catalog = plan.forced ? [] : catalogLines(plan, installed);
|
|
232
|
+
if (catalog.length > 0) lines.push(`Catalog (installed here): ${catalog.join("; ")}.`);
|
|
233
|
+
return `<litclaude-skill-plan>\n${lines.join("\n")}\n</litclaude-skill-plan>`;
|
|
234
|
+
};
|
|
@@ -2407,7 +2407,8 @@ export const startWorkFromInvocation = (root, { sessionId, promptId, plan = null
|
|
|
2407
2407
|
originPromptId: promptId,
|
|
2408
2408
|
});
|
|
2409
2409
|
const work = response.state.works[workId];
|
|
2410
|
-
|
|
2410
|
+
const inside = relative(canonicalRoot, planPath);
|
|
2411
|
+
return { started: { workId, plan: work.plan_name, next: work.progress.next_task, ...(inside && !inside.startsWith("..") && !isAbsolute(inside) ? { ref: inside.split(/[\\/]/u).join("/") } : {}) } };
|
|
2411
2412
|
};
|
|
2412
2413
|
|
|
2413
2414
|
const pendingFor = (state, sessionId) => {
|
|
@@ -120,7 +120,7 @@ export const createWorkflowCheckReport = (root, version, env = process.env) => {
|
|
|
120
120
|
hostWorkflowsEnabled: workflowsEnabled,
|
|
121
121
|
backgroundTasksEnabled,
|
|
122
122
|
toolConcurrencyAboveOne: toolConcurrency.status !== "unavailable",
|
|
123
|
-
goalGuidance: includesAll(`${hookContext}\n${commandText}`, ["
|
|
123
|
+
goalGuidance: includesAll(`${hookContext}\n${commandText}`, ["/goal", "yes / edit / no"]),
|
|
124
124
|
dynamicWorkflowGuidance: includesAll(`${hookContext}\n${commandText}`, ["Workflow", "EnterWorktree", "claude --worktree"]),
|
|
125
125
|
subagentDelegation: includesAll(`${hookContext}\n${commandText}\n${agentsText}`, [
|
|
126
126
|
"lit-planner",
|
|
@@ -21,12 +21,13 @@ export const MAX_FRAMES = 3;
|
|
|
21
21
|
export const MAX_HISTORY = 20;
|
|
22
22
|
export const MAX_STACK_BYTES = 64 * 1024;
|
|
23
23
|
export const STACK_DROP_MS = 24 * 60 * 60 * 1000;
|
|
24
|
-
export const READ_ONLY_DISCIPLINES = Object.freeze(["lit-
|
|
24
|
+
export const READ_ONLY_DISCIPLINES = Object.freeze(["lit-comprehend", "lit-handoff", "lit-adhd", "lit-rewind"]);
|
|
25
25
|
|
|
26
26
|
// Order in the main chain; a newcomer of a higher rank succeeds the frame below it.
|
|
27
27
|
const CHAIN_RANK = Object.freeze({
|
|
28
28
|
"deep-interview": 0,
|
|
29
29
|
"lit-brainstorm": 0,
|
|
30
|
+
"ultra-brainstorm": 0,
|
|
30
31
|
"lit-crucible": 1,
|
|
31
32
|
"lit-plan": 1,
|
|
32
33
|
"start-work": 2,
|
|
@@ -188,6 +189,12 @@ export const applyStackEvent = (stack, event, now = new Date()) => {
|
|
|
188
189
|
? frames.findLast((frame) => frame.family === event.family && frame.stage === event.stage)
|
|
189
190
|
: frames.at(-1);
|
|
190
191
|
if (target && target.family === event.family && (event.scope === "nearest" || target.status === "active")) update(target, event);
|
|
192
|
+
// A side skill that finished hands the session back: the frame under it resumes by itself
|
|
193
|
+
// instead of staying paused until the user types `lit continue` (card scenario D1-2).
|
|
194
|
+
if (target && target === frames.at(-1) && target.role === "side" && isFinished(target) && frames.length > 1) {
|
|
195
|
+
closeAbove(frames.length - 2, "side.done");
|
|
196
|
+
activate(frames.at(-1));
|
|
197
|
+
}
|
|
191
198
|
break;
|
|
192
199
|
}
|
|
193
200
|
case "record":
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// `node <plugin>/scripts/goal-propose.mjs plans/<slug>.md`: lit-plan runs this once, after the plan is
|
|
3
|
+
// written, and adds the line it prints to the approval question. It compiles the plan's `## Done when`
|
|
4
|
+
// block into one `/goal` condition, lints it, runs the check once to prove the condition is false
|
|
5
|
+
// now, and records the question in `.litclaude/goal/consent.json`. It prints the consent question
|
|
6
|
+
// (yes starts the work and arms the goal), or, when no goal can be set for a readable plan, the
|
|
7
|
+
// start-only question and the `No goal set: <reason>` line. It never sets a goal or starts work
|
|
8
|
+
// itself; only the user's exact `yes` on the next prompt does, through the prompt hook.
|
|
9
|
+
import { mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
|
|
10
|
+
import { isAbsolute, join, relative, resolve } from "node:path";
|
|
11
|
+
import { pathToFileURL } from "node:url";
|
|
12
|
+
|
|
13
|
+
import { GOAL_DIR, GOAL_STATUS, compileCondition, conditionHash, falsify, lintCondition, parseDoneWhen, startOnlyHash } from "../lib/goal-pipeline.mjs";
|
|
14
|
+
|
|
15
|
+
const record = (cwd, consent) => {
|
|
16
|
+
const dir = join(cwd, GOAL_DIR);
|
|
17
|
+
mkdirSync(dir, { recursive: true });
|
|
18
|
+
const staging = join(dir, `consent.json.${process.pid}.tmp`);
|
|
19
|
+
writeFileSync(staging, `${JSON.stringify(consent)}\n`);
|
|
20
|
+
renameSync(staging, join(dir, "consent.json"));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const proposeGoal = ({ cwd, planArg, now = Date.now(), timeoutMs, run } = {}) => {
|
|
24
|
+
const planPath = resolve(cwd, String(planArg ?? ""));
|
|
25
|
+
const plan = relative(cwd, planPath);
|
|
26
|
+
if (!planArg || isAbsolute(plan) || plan.startsWith("..") || !/^plans\/[\w.-]+\.md$/u.test(plan)) return { line: GOAL_STATUS.skipped("give the plan as plans/<slug>.md inside this project") };
|
|
27
|
+
let planText;
|
|
28
|
+
try {
|
|
29
|
+
planText = readFileSync(planPath, "utf8");
|
|
30
|
+
} catch {
|
|
31
|
+
return { line: GOAL_STATUS.skipped(`${plan} cannot be read`) };
|
|
32
|
+
}
|
|
33
|
+
const askedAt = new Date(now).toISOString();
|
|
34
|
+
// A readable plan with no settable goal still gets the start question; yes then starts the work only.
|
|
35
|
+
const startOnly = (reason) => {
|
|
36
|
+
const consent = { version: 1, condition: null, hash: startOnlyHash(plan), id: null, plan, reason, askedAt };
|
|
37
|
+
record(cwd, consent);
|
|
38
|
+
return { line: `${GOAL_STATUS.startOnly}\n${GOAL_STATUS.skipped(reason)}`, consent };
|
|
39
|
+
};
|
|
40
|
+
if (/^goal:\s*never\s*$/mu.test(planText)) return startOnly("this plan is marked goal: never");
|
|
41
|
+
const done = parseDoneWhen(planText);
|
|
42
|
+
if (!done.ok) return startOnly(done.reason);
|
|
43
|
+
const built = compileCondition({ plan, check: done.check });
|
|
44
|
+
if (!built.ok) return startOnly(built.reason);
|
|
45
|
+
const lint = lintCondition(built.condition, done.check);
|
|
46
|
+
if (!lint.ok) return startOnly(lint.reasons.join("; "));
|
|
47
|
+
const dry = falsify({ cwd, plan, planText, check: done.check, ...(timeoutMs ? { timeoutMs } : {}), ...(run ? { run } : {}) });
|
|
48
|
+
if (!dry.ok) return startOnly(dry.reason);
|
|
49
|
+
const consent = { version: 1, condition: built.condition, hash: conditionHash(built.condition), id: built.id, plan, askedAt };
|
|
50
|
+
record(cwd, consent);
|
|
51
|
+
return { line: GOAL_STATUS.asked(built.condition), consent };
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
55
|
+
const { line } = proposeGoal({ cwd: process.cwd(), planArg: process.argv[2] });
|
|
56
|
+
process.stdout.write(`${line}\n`);
|
|
57
|
+
}
|
|
@@ -64,7 +64,7 @@ verdicts: [PASS, FAIL, BLOCKED, BLOCKED_MULTI_AGENT_UNAVAILABLE]
|
|
|
64
64
|
incomplete lanes. Never hard-reset or truncate user work from source instructions.
|
|
65
65
|
8. Stop at approved success, exhausted budget, cancellation, all-lane blocker, or capability loss. Synthesize validated
|
|
66
66
|
and dissenting findings; never elevate self-assessment, unverified performance claims, or missing child output.
|
|
67
|
-
9. Finish through `review-work`, then offer `lit
|
|
67
|
+
9. Finish through `review-work`, then offer `lit adhd recap` or `handoff` for continuity. Ship mode writes local draft
|
|
68
68
|
artifacts only until a separate explicit irreversible-action approval is received.
|
|
69
69
|
|
|
70
70
|
## #contract.outputs
|
|
@@ -115,6 +115,10 @@ interruption terminates that group and its descendants. On Windows, the fallback
|
|
|
115
115
|
direct child. It cannot guarantee cleanup for descendant processes. A cleanup failure is
|
|
116
116
|
`BLOCKED_BROWSER_DRIVER_CLEANUP_FAILED`, never an available result.
|
|
117
117
|
|
|
118
|
+
On Windows, the probe looks `agent-browser` up through `PATH` and `PATHEXT` the way `cmd.exe` does,
|
|
119
|
+
follows an npm `.cmd` shim to the native `agent-browser-win32-*.exe` it starts, and reports that
|
|
120
|
+
executable as `command`.
|
|
121
|
+
|
|
118
122
|
If the driver is missing or below the floor, the user can install it with:
|
|
119
123
|
|
|
120
124
|
```bash
|