@llman-sdd/cli 0.11.0 → 0.12.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/package.json +13 -5
- package/src/cli-shared.ts +85 -43
- package/src/commands/archive.ts +0 -9
- package/src/commands/change.ts +71 -33
- package/src/commands/init.ts +9 -11
- package/src/commands/list.ts +0 -2
- package/src/commands/project.ts +0 -6
- package/src/commands/review.ts +0 -1
- package/src/commands/self.ts +3 -1
- package/src/commands/show.ts +8 -46
- package/src/commands/spec.ts +4 -6
- package/src/commands/studio.ts +1315 -0
- package/src/commands/studioMcp.ts +862 -0
- package/src/commands/studioShared.ts +87 -0
- package/src/commands/theorem-write.ts +608 -0
- package/src/commands/theorem.ts +479 -0
- package/src/commands/validate.ts +108 -47
- package/src/io.ts +0 -1
- package/src/main.ts +3 -18
- package/src/program.ts +16 -12
- package/src/progress.ts +1 -3
- package/src/studio-server/changeScope.ts +295 -0
- package/src/studio-server/hub.ts +98 -0
- package/src/studio-server/negotiate.ts +60 -0
- package/src/studio-server/security.ts +71 -0
- package/src/studio-server/server.ts +1694 -0
- package/src/studio-server/static.ts +184 -0
- package/src/studio-server/syncDisk.ts +116 -0
- package/src/theorems/base.ts +53 -0
- package/src/theorems/diagnose.ts +90 -0
- package/src/theorems/draft.ts +252 -0
- package/src/theorems/os-lock.ts +364 -0
- package/src/theorems/paths.ts +11 -0
- package/src/theorems/prompts.ts +79 -0
- package/src/theorems/quiet.ts +21 -0
- package/src/theorems/runner.ts +48 -0
- package/src/theorems/transaction.ts +272 -0
- package/src/theorems/workspace.ts +103 -0
- package/studio-dist/index.html +14 -0
- package/studio-dist/static/css/index.00cf48cf.css +1 -0
- package/studio-dist/static/js/610.51883f69.js +218 -0
- package/studio-dist/static/js/610.51883f69.js.LICENSE.txt +26 -0
- package/studio-dist/static/js/index.c5f7c530.js +13 -0
- package/studio-dist/static/js/lib-react.a4b07007.js +2 -0
- package/studio-dist/static/js/lib-react.a4b07007.js.LICENSE.txt +49 -0
package/src/commands/show.ts
CHANGED
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
addSpecDirOption,
|
|
18
18
|
CliError,
|
|
19
19
|
cliMaxScanDepth,
|
|
20
|
+
formatNotFound,
|
|
20
21
|
loadRootSpecEntries,
|
|
21
22
|
reRootContext,
|
|
22
23
|
specsPrefixFor,
|
|
@@ -125,8 +126,6 @@ export function registerShow(program: Command, ctx: CliContext): void {
|
|
|
125
126
|
directory?: string;
|
|
126
127
|
},
|
|
127
128
|
) => {
|
|
128
|
-
// D4 shared surface: the registered --json/--compact-json aliases feed
|
|
129
|
-
// the same token set as --output so show honors them uniformly.
|
|
130
129
|
const outTokens = new Set(
|
|
131
130
|
[
|
|
132
131
|
...(options.output ?? '').split(','),
|
|
@@ -154,20 +153,11 @@ export function registerShow(program: Command, ctx: CliContext): void {
|
|
|
154
153
|
);
|
|
155
154
|
}
|
|
156
155
|
}
|
|
157
|
-
// B10/Q1: `compact-json` is a real machine mode (single-line JSON), not a
|
|
158
|
-
// text fallback; legacy `compact` token aliases it.
|
|
159
156
|
const asCompact = outTokens.has('compact') || outTokens.has('compact-json');
|
|
160
157
|
const metaOnly = outTokens.has('meta-only');
|
|
161
158
|
const noScenarios = outTokens.has('no-scenarios');
|
|
162
159
|
const reqsOnly = outTokens.has('reqs-only');
|
|
163
|
-
// toon-default-output: no --output → toon; machine modes share the json
|
|
164
|
-
// gates (Why/What validation) and suppress the prefix hint; `human` is the
|
|
165
|
-
// sole predecessor text form. Legacy modifiers (meta-only/no-scenarios/reqs-only/
|
|
166
|
-
// -r) belong to the text face — they route to human (predecessor no-op render
|
|
167
|
-
// semantics preserved). The predecessor delta modifier was removed: unknown
|
|
168
|
-
// tokens are rejected like other report commands.
|
|
169
160
|
const wantsMachine = outTokens.has('json') || outTokens.has('toon') || asCompact;
|
|
170
|
-
// no --output at all → toon; explicit legacy-only modifiers → human text
|
|
171
161
|
const isHuman = options.output !== undefined && (outTokens.has('human') || !wantsMachine);
|
|
172
162
|
const asJson = !isHuman;
|
|
173
163
|
const showMode: 'json' | 'compact-json' | 'toon' = asCompact
|
|
@@ -175,27 +165,11 @@ export function registerShow(program: Command, ctx: CliContext): void {
|
|
|
175
165
|
: outTokens.has('json')
|
|
176
166
|
? 'json'
|
|
177
167
|
: 'toon';
|
|
178
|
-
// predecessor: unknown output tokens are rejected by clap; script consumers rely on
|
|
179
|
-
// the deprecation being a no-op render rather than an error.
|
|
180
|
-
// Spec 判定与 collectSpecs/discoverSpecs 同口径:扁平文件与目录式
|
|
181
|
-
// `specs/<cap>/<cap>.feature` 均按 entry 精确 id(specIdOf:capability ?? 去
|
|
182
|
-
// `.feature` 后缀的 fileName)命中;r25 spec id 精确匹配优先于 change 前缀,
|
|
183
|
-
// 不做模糊解析。
|
|
184
|
-
// Discover once per run — the spec lookup, summary and JSON render below
|
|
185
|
-
// all share these entries. Lazy: a bare changes-only workspace has no
|
|
186
|
-
// resolvable instance root for the specs half, and the change path below
|
|
187
|
-
// must not require one (r109 root discovery gates specs, not changes).
|
|
188
168
|
type SpecEntries = ReturnType<typeof loadRootSpecEntries>;
|
|
189
169
|
let entriesCache: SpecEntries | null = null;
|
|
190
170
|
const specEntries = (): SpecEntries =>
|
|
191
171
|
(entriesCache ??= loadRootSpecEntries(undefined, ctx.io));
|
|
192
|
-
// spec discovery is attempted but a root-less workspace must not fail
|
|
193
|
-
// here — the change path below is root-independent until the spec half.
|
|
194
172
|
let specEntry: SpecEntries[number] | undefined;
|
|
195
|
-
// r115: the instance root resolved from `--directory` decides where the
|
|
196
|
-
// flat-spec probe, the spec source read and the change face below look —
|
|
197
|
-
// never the launch directory. Absent an instance the change face stays
|
|
198
|
-
// root-independent (changes-only workspace, r109).
|
|
199
173
|
let specRoot = ctx.root;
|
|
200
174
|
try {
|
|
201
175
|
specRoot = resolveCommandRoot(ctx, options.directory);
|
|
@@ -208,12 +182,16 @@ export function registerShow(program: Command, ctx: CliContext): void {
|
|
|
208
182
|
const isSpec = options.type === 'spec' || existsSync(flatSpecPath) || specEntry !== undefined;
|
|
209
183
|
|
|
210
184
|
if (isSpec) {
|
|
211
|
-
// discoverSpecs 的 fileName 已是含 specs 目录前缀的相对路径
|
|
212
|
-
// (如 `llmanspec/specs/<cap>/<cap>.feature`),直接使用。
|
|
213
185
|
const specPath =
|
|
214
186
|
specEntry !== undefined && !existsSync(flatSpecPath) ? specEntry.fileName : flatSpecPath;
|
|
215
187
|
if (!existsSync(specPath)) {
|
|
216
|
-
throw new CliError(
|
|
188
|
+
throw new CliError(
|
|
189
|
+
formatNotFound(
|
|
190
|
+
'spec',
|
|
191
|
+
item,
|
|
192
|
+
specEntries().map((e) => specIdOf(e)),
|
|
193
|
+
),
|
|
194
|
+
);
|
|
217
195
|
}
|
|
218
196
|
if (asJson) {
|
|
219
197
|
console.log(
|
|
@@ -227,8 +205,6 @@ export function registerShow(program: Command, ctx: CliContext): void {
|
|
|
227
205
|
);
|
|
228
206
|
return;
|
|
229
207
|
}
|
|
230
|
-
// text mode: predecessor ignores all output modifiers (meta-only/no-scenarios/-r)
|
|
231
|
-
// and renders the full source + morphology.
|
|
232
208
|
const raw = readFileSync(specPath, 'utf8').trimEnd();
|
|
233
209
|
const summary = collectSpecs(specEntries()).find((x) => x.id === item);
|
|
234
210
|
const morphology = summary
|
|
@@ -238,17 +214,10 @@ export function registerShow(program: Command, ctx: CliContext): void {
|
|
|
238
214
|
return;
|
|
239
215
|
}
|
|
240
216
|
|
|
241
|
-
// ---- change ----
|
|
242
|
-
// r61: predecessor r112 prefix chain — exact > unique prefix > multiple > not found.
|
|
243
|
-
// r115: id resolution, the proposal read and the phase collection all use
|
|
244
|
-
// the resolved instance root; git stays repo-level (r118: branch is a
|
|
245
|
-
// git-level notion, not an instance-root one).
|
|
246
217
|
let rctx = ctx;
|
|
247
218
|
try {
|
|
248
219
|
rctx = reRootContext(ctx, options.directory);
|
|
249
220
|
} catch (error) {
|
|
250
|
-
// changes-only workspace (no config.yaml / specs/): the change path is
|
|
251
|
-
// root-independent, but an explicitly named root must resolve (r109).
|
|
252
221
|
if (options.directory !== undefined) throw error;
|
|
253
222
|
}
|
|
254
223
|
const resolved = resolveChangeIdOrExit(rctx, program, item, { suppressHint: asJson });
|
|
@@ -258,20 +227,14 @@ export function registerShow(program: Command, ctx: CliContext): void {
|
|
|
258
227
|
join(rctx.root, 'llmanspec', 'changes', changeId, 'proposal.md'),
|
|
259
228
|
'utf8',
|
|
260
229
|
);
|
|
261
|
-
// r115: ONE dependency set for the change path, built from the resolved
|
|
262
|
-
// instance root — io/git/root are the re-rooted ones and the spec gate
|
|
263
|
-
// reads THAT instance's registry (derived from this very io). Both
|
|
264
|
-
// output faces share it, so they can never disagree on a gate.
|
|
265
230
|
const deps = {
|
|
266
231
|
io: rctx.io,
|
|
267
232
|
git: rctx.git,
|
|
268
233
|
root: rctx.root,
|
|
269
234
|
specsDir: resolveRootSpecsDirTolerant(rctx),
|
|
270
|
-
// r119: the specs-landed gate judges under this instance's prefix.
|
|
271
235
|
specsPrefix: specsPrefixFor(rctx),
|
|
272
236
|
};
|
|
273
237
|
if (asJson) {
|
|
274
|
-
// predecessor parse_change gates: Why first, then What Changes (json only).
|
|
275
238
|
if (!hasSection(proposal, 'Why')) {
|
|
276
239
|
throw new CliError('Change must have a Why section');
|
|
277
240
|
}
|
|
@@ -282,7 +245,6 @@ export function registerShow(program: Command, ctx: CliContext): void {
|
|
|
282
245
|
console.log(renderMachine(result, showMode));
|
|
283
246
|
return;
|
|
284
247
|
}
|
|
285
|
-
// text: Stage / path / content / Gates trailer (no section gates).
|
|
286
248
|
const changes = collectChanges(rctx.io, rctx.root, new Date(), {
|
|
287
249
|
maxScanDepth: cliMaxScanDepth(program),
|
|
288
250
|
});
|
package/src/commands/spec.ts
CHANGED
|
@@ -36,7 +36,6 @@ export function registerSpec(program: Command, ctx: CliContext): void {
|
|
|
36
36
|
.option('--force', 'overwrite an existing spec file');
|
|
37
37
|
addSpecDirOption(skeleton);
|
|
38
38
|
skeleton.action((capability: string, options: { force?: boolean; directory?: string }) => {
|
|
39
|
-
// r109/r115: locale 属命中实例根的配置,`--directory` 指向子根时不得读启动根
|
|
40
39
|
const locale =
|
|
41
40
|
loadCliConfig(resolveCommandRoot(ctx, options.directory))?.locale ?? DEFAULT_LOCALE;
|
|
42
41
|
const specsDir = resolveRootSpecsDir(options.directory, ctx.io);
|
|
@@ -154,14 +153,13 @@ export function registerSpec(program: Command, ctx: CliContext): void {
|
|
|
154
153
|
.description('Show transition-table validation rules: alias families, tags, gates');
|
|
155
154
|
addSpecDirOption(transitions);
|
|
156
155
|
transitions.action((options: { directory?: string }) => {
|
|
157
|
-
// r109: 本命令输出为静态内省,无实例根语义;仍按「豁免外全部命令声明并接受
|
|
158
|
-
// --directory」声明该选项,并仅在显式给出时经同一根发现算子校验(无实例报域错误)。
|
|
159
156
|
if (options.directory !== undefined) resolveCommandRoot(ctx, options.directory);
|
|
160
157
|
const info = TRANSITIONS_INTROSPECTION;
|
|
158
|
+
console.log(info.note);
|
|
161
159
|
console.log('columns:');
|
|
162
|
-
for (const fam of info.columnFamilies) {
|
|
163
|
-
|
|
164
|
-
console.log(`
|
|
160
|
+
for (const [role, fam] of Object.entries(info.columnFamilies)) {
|
|
161
|
+
console.log(` ${role}: ${fam.required.join(' | ')}`);
|
|
162
|
+
if (fam.optional.length > 0) console.log(` optional: ${fam.optional.join(' | ')}`);
|
|
165
163
|
}
|
|
166
164
|
console.log(`discovery: ${info.discovery}`);
|
|
167
165
|
console.log('tags:');
|