@majeanson/lac 1.0.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/lac-mcp.js +2 -0
- package/dist/index.mjs +72 -0
- package/dist/index.mjs.map +1 -1
- package/dist/lsp.mjs +10180 -0
- package/dist/mcp.mjs +4157 -0
- package/package.json +8 -4
package/bin/lac-mcp.js
ADDED
package/dist/index.mjs
CHANGED
|
@@ -3,6 +3,7 @@ import { mkdir, readFile, readdir, writeFile } from "node:fs/promises";
|
|
|
3
3
|
import process$1 from "node:process";
|
|
4
4
|
import { FEATURE_KEY_PATTERN, generateFeatureKey, validateFeature } from "@life-as-code/feature-schema";
|
|
5
5
|
import path, { dirname, join, resolve } from "node:path";
|
|
6
|
+
import { fillFeature, genFromFeature } from "@life-as-code/lac-claude";
|
|
6
7
|
import fs, { chmodSync, existsSync, mkdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
7
8
|
import { spawn, spawnSync } from "node:child_process";
|
|
8
9
|
import prompts from "prompts";
|
|
@@ -138,6 +139,75 @@ function findLacConfig(startDir) {
|
|
|
138
139
|
}
|
|
139
140
|
}
|
|
140
141
|
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region src/commands/fill.ts
|
|
144
|
+
const fillCommand = new Command("fill").description("Fill missing feature.json fields using AI analysis of your code").argument("[dir]", "Feature folder to fill (default: nearest feature.json from cwd)").option("--field <fields>", "Comma-separated fields to fill (default: all missing)").option("--dry-run", "Preview proposed changes without writing").option("--all", "Fill all features in the workspace below the completeness threshold").option("--threshold <n>", "Skip features above this completeness % (used with --all)", parseInt).option("--model <model>", "Claude model to use (default: claude-sonnet-4-6)").action(async (dir, options) => {
|
|
145
|
+
const fields = options.field ? options.field.split(",").map((f) => f.trim()).filter(Boolean) : void 0;
|
|
146
|
+
if (options.all) {
|
|
147
|
+
process$1.stderr.write("--all flag coming soon. Run \"lac fill <dir>\" for a specific feature.\n");
|
|
148
|
+
process$1.exit(1);
|
|
149
|
+
}
|
|
150
|
+
let featureDir;
|
|
151
|
+
if (dir) featureDir = resolve(dir);
|
|
152
|
+
else {
|
|
153
|
+
const found = findNearestFeatureJson$1(process$1.cwd());
|
|
154
|
+
if (!found) {
|
|
155
|
+
process$1.stderr.write("No feature.json found from current directory.\nRun \"lac init\" to create one, or pass a path: lac fill src/auth/\n");
|
|
156
|
+
process$1.exit(1);
|
|
157
|
+
}
|
|
158
|
+
featureDir = dirname(found);
|
|
159
|
+
}
|
|
160
|
+
try {
|
|
161
|
+
await fillFeature({
|
|
162
|
+
featureDir,
|
|
163
|
+
fields,
|
|
164
|
+
dryRun: options.dryRun ?? false,
|
|
165
|
+
model: options.model
|
|
166
|
+
});
|
|
167
|
+
} catch (err) {
|
|
168
|
+
process$1.stderr.write(`Error: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
169
|
+
process$1.exit(1);
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/commands/gen.ts
|
|
175
|
+
const GEN_TYPES = [
|
|
176
|
+
"component",
|
|
177
|
+
"test",
|
|
178
|
+
"migration",
|
|
179
|
+
"docs"
|
|
180
|
+
];
|
|
181
|
+
const genCommand = new Command("gen").description("Generate code artifacts from a feature.json (component, test, migration, docs)").argument("[dir]", "Feature folder (default: nearest feature.json from cwd)").option(`--type <type>`, `What to generate: ${GEN_TYPES.join(", ")}`).option("--dry-run", "Print generated content without writing to disk").option("--out <file>", "Output file path (default: auto-named next to feature.json)").option("--model <model>", "Claude model to use (default: claude-sonnet-4-6)").action(async (dir, options) => {
|
|
182
|
+
const type = options.type ?? "component";
|
|
183
|
+
if (!GEN_TYPES.includes(type)) {
|
|
184
|
+
process$1.stderr.write(`Unknown type "${type}". Available: ${GEN_TYPES.join(", ")}\n`);
|
|
185
|
+
process$1.exit(1);
|
|
186
|
+
}
|
|
187
|
+
let featureDir;
|
|
188
|
+
if (dir) featureDir = resolve(dir);
|
|
189
|
+
else {
|
|
190
|
+
const found = findNearestFeatureJson$1(process$1.cwd());
|
|
191
|
+
if (!found) {
|
|
192
|
+
process$1.stderr.write("No feature.json found from current directory.\nRun \"lac init\" to create one, or pass a path: lac gen src/auth/ --type test\n");
|
|
193
|
+
process$1.exit(1);
|
|
194
|
+
}
|
|
195
|
+
featureDir = dirname(found);
|
|
196
|
+
}
|
|
197
|
+
try {
|
|
198
|
+
await genFromFeature({
|
|
199
|
+
featureDir,
|
|
200
|
+
type,
|
|
201
|
+
dryRun: options.dryRun ?? false,
|
|
202
|
+
outFile: options.out,
|
|
203
|
+
model: options.model
|
|
204
|
+
});
|
|
205
|
+
} catch (err) {
|
|
206
|
+
process$1.stderr.write(`Error: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
207
|
+
process$1.exit(1);
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
|
|
141
211
|
//#endregion
|
|
142
212
|
//#region src/lib/config.ts
|
|
143
213
|
const DEFAULTS = {
|
|
@@ -2458,6 +2528,8 @@ program.addCommand(lineageCommand);
|
|
|
2458
2528
|
program.addCommand(diffCommand);
|
|
2459
2529
|
program.addCommand(renameCommand);
|
|
2460
2530
|
program.addCommand(importCommand);
|
|
2531
|
+
program.addCommand(fillCommand);
|
|
2532
|
+
program.addCommand(genCommand);
|
|
2461
2533
|
program.parse();
|
|
2462
2534
|
|
|
2463
2535
|
//#endregion
|