@llman-sdd/cli 0.10.1 → 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 +87 -62
- package/src/commands/archive.ts +4 -19
- package/src/commands/change.ts +132 -172
- package/src/commands/config.ts +1 -29
- package/src/commands/init.ts +39 -11
- package/src/commands/list.ts +0 -2
- package/src/commands/project.ts +25 -115
- 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 +6 -86
- 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 -16
- 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/context.ts +0 -88
- package/src/commands/index.ts +0 -53
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react-dom-client.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @license React
|
|
13
|
+
* react-dom.production.js
|
|
14
|
+
*
|
|
15
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
16
|
+
*
|
|
17
|
+
* This source code is licensed under the MIT license found in the
|
|
18
|
+
* LICENSE file in the root directory of this source tree.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @license React
|
|
23
|
+
* react-jsx-runtime.production.js
|
|
24
|
+
*
|
|
25
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
26
|
+
*
|
|
27
|
+
* This source code is licensed under the MIT license found in the
|
|
28
|
+
* LICENSE file in the root directory of this source tree.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @license React
|
|
33
|
+
* react.production.js
|
|
34
|
+
*
|
|
35
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
36
|
+
*
|
|
37
|
+
* This source code is licensed under the MIT license found in the
|
|
38
|
+
* LICENSE file in the root directory of this source tree.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @license React
|
|
43
|
+
* scheduler.production.js
|
|
44
|
+
*
|
|
45
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
46
|
+
*
|
|
47
|
+
* This source code is licensed under the MIT license found in the
|
|
48
|
+
* LICENSE file in the root directory of this source tree.
|
|
49
|
+
*/
|
package/src/commands/context.ts
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
discoverSpecs,
|
|
6
|
-
loadTreeWithAutoRebuild,
|
|
7
|
-
resolveChatConfig,
|
|
8
|
-
runContextRetrieval,
|
|
9
|
-
unavailableResult,
|
|
10
|
-
} from '@llman-sdd/core';
|
|
11
|
-
import type { Command } from 'commander';
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
CliError,
|
|
15
|
-
addSpecDirOption,
|
|
16
|
-
reRootContext,
|
|
17
|
-
resolveBackend,
|
|
18
|
-
type CliContext,
|
|
19
|
-
} from '../cli-shared.ts';
|
|
20
|
-
import { progressNote } from '../progress.ts';
|
|
21
|
-
|
|
22
|
-
// (err path below converted to CliError; resolveBackend may also throw CliError)
|
|
23
|
-
|
|
24
|
-
export function registerContext(program: Command, ctx: CliContext): void {
|
|
25
|
-
const context = program
|
|
26
|
-
.command('context')
|
|
27
|
-
.description('Get specs relevant to a task (agent-oriented, pageindex agentic retrieval)')
|
|
28
|
-
.option('--task <task>', 'natural language task description')
|
|
29
|
-
.option('--paths <paths>', 'comma-separated file paths')
|
|
30
|
-
.option('--top <n>', 'max entries per tier', '5')
|
|
31
|
-
.option('--backend <name>', 'retrieval backend (pageindex only)')
|
|
32
|
-
.action(
|
|
33
|
-
async (options: {
|
|
34
|
-
task?: string;
|
|
35
|
-
paths?: string;
|
|
36
|
-
top?: string;
|
|
37
|
-
backend?: string;
|
|
38
|
-
directory?: string;
|
|
39
|
-
}) => {
|
|
40
|
-
resolveBackend(options.backend);
|
|
41
|
-
if (!options.task && !options.paths) {
|
|
42
|
-
throw new CliError('at least one of --task or --paths is required');
|
|
43
|
-
}
|
|
44
|
-
const config = resolveChatConfig(process.env as Record<string, string | undefined>);
|
|
45
|
-
// r62: lazy refresh runs BEFORE the chat-model gate (predecessor r97 — the index
|
|
46
|
-
// self-heals even when retrieval subsequently fails with api_error).
|
|
47
|
-
// r115/r116: the resolved instance root decides every read AND write target,
|
|
48
|
-
// so the index store lands in the --directory instance, not the launch dir.
|
|
49
|
-
const rctx = reRootContext(ctx, options.directory);
|
|
50
|
-
const specsDir = join(rctx.root, 'llmanspec', 'specs');
|
|
51
|
-
const refresh = loadTreeWithAutoRebuild(
|
|
52
|
-
rctx.io,
|
|
53
|
-
specsDir,
|
|
54
|
-
discoverSpecs(specsDir, rctx.io),
|
|
55
|
-
{
|
|
56
|
-
chatModel: process.env.LLMAN_SDD_INDEX_CHAT_MODEL ?? '',
|
|
57
|
-
},
|
|
58
|
-
);
|
|
59
|
-
if (refresh.tree === null || refresh.error !== null) {
|
|
60
|
-
const failed = unavailableResult();
|
|
61
|
-
failed.status.errorKind = 'index_rebuild_failed';
|
|
62
|
-
failed.status.qualityNote =
|
|
63
|
-
refresh.error ?? 'index rebuild failed — run `llman-sdd index rebuild`';
|
|
64
|
-
console.log(JSON.stringify(failed, null, 2));
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
const tree = refresh.tree;
|
|
68
|
-
if (config === null) {
|
|
69
|
-
// predecessor parity: unavailable/error JSON on stdout, exit 0.
|
|
70
|
-
console.log(JSON.stringify(unavailableResult(), null, 2));
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
// LLM 链路可能是秒级 — 进度提示防止看上去卡住(B1)
|
|
74
|
-
progressNote('context.retrieve', rctx.root);
|
|
75
|
-
const result = await runContextRetrieval({
|
|
76
|
-
config,
|
|
77
|
-
task: options.task ?? '',
|
|
78
|
-
paths: options.paths,
|
|
79
|
-
top: Number(options.top),
|
|
80
|
-
tree,
|
|
81
|
-
readFile: (p) => readFileSync(p, 'utf8'),
|
|
82
|
-
root: rctx.root,
|
|
83
|
-
});
|
|
84
|
-
console.log(JSON.stringify(result, null, 2));
|
|
85
|
-
},
|
|
86
|
-
);
|
|
87
|
-
addSpecDirOption(context);
|
|
88
|
-
}
|
package/src/commands/index.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { join } from 'node:path';
|
|
2
|
-
|
|
3
|
-
import { checkIndexFreshness, discoverSpecs, rebuildIndex } from '@llman-sdd/core';
|
|
4
|
-
import type { Command } from 'commander';
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
addReportOutputOptions,
|
|
8
|
-
addSpecDirOption,
|
|
9
|
-
emitReport,
|
|
10
|
-
exitWith,
|
|
11
|
-
reRootContext,
|
|
12
|
-
resolveBackend,
|
|
13
|
-
type CliContext,
|
|
14
|
-
} from '../cli-shared.ts';
|
|
15
|
-
|
|
16
|
-
export function registerIndex(program: Command, ctx: CliContext): void {
|
|
17
|
-
const indexCmd = program
|
|
18
|
-
.command('index')
|
|
19
|
-
.description('Index management commands (rebuild, check freshness)');
|
|
20
|
-
|
|
21
|
-
const rebuild = indexCmd
|
|
22
|
-
.command('rebuild')
|
|
23
|
-
.description('Rebuild the pageindex tree from spec IR (no LLM)')
|
|
24
|
-
.option('--backend <name>', 'index backend (pageindex only)')
|
|
25
|
-
.action((options: { backend?: string; directory?: string }) => {
|
|
26
|
-
resolveBackend(options.backend);
|
|
27
|
-
// r115/r116: resolve the instance root once and anchor io at it — the
|
|
28
|
-
// pageindex store is written through root-relative paths, which must land
|
|
29
|
-
// in the --directory instance rather than the launch directory.
|
|
30
|
-
const rctx = reRootContext(ctx, options.directory);
|
|
31
|
-
const specsDir = join(rctx.root, 'llmanspec', 'specs');
|
|
32
|
-
const result = rebuildIndex(rctx.io, specsDir, discoverSpecs(specsDir, rctx.io), {
|
|
33
|
-
chatModel: process.env.LLMAN_SDD_INDEX_CHAT_MODEL ?? '',
|
|
34
|
-
});
|
|
35
|
-
for (const line of result.lines.slice(0, -1)) console.error(line);
|
|
36
|
-
if (result.lines.length > 0) console.log(result.lines.at(-1));
|
|
37
|
-
});
|
|
38
|
-
addSpecDirOption(rebuild);
|
|
39
|
-
|
|
40
|
-
const check = indexCmd.command('check').description('Check index freshness without rebuilding');
|
|
41
|
-
addReportOutputOptions(check);
|
|
42
|
-
addSpecDirOption(check);
|
|
43
|
-
check.action(
|
|
44
|
-
(options: { output?: string; json?: boolean; compactJson?: boolean; directory?: string }) => {
|
|
45
|
-
const rctx = reRootContext(ctx, options.directory);
|
|
46
|
-
const result = checkIndexFreshness(rctx.io, join(rctx.root, 'llmanspec', 'specs'));
|
|
47
|
-
emitReport({ fresh: result.fresh, notes: result.lines }, options, () =>
|
|
48
|
-
result.lines.join('\n'),
|
|
49
|
-
);
|
|
50
|
-
if (!result.fresh) exitWith(1);
|
|
51
|
-
},
|
|
52
|
-
);
|
|
53
|
-
}
|