@silvermoon-work/check-task-builder 0.0.0 → 0.1.0-rc.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/LICENSE +21 -0
- package/README.md +125 -5
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +24 -0
- package/dist/bin.js.map +1 -0
- package/dist/cli.d.ts +14 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +304 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +124 -0
- package/dist/index.js.map +1 -0
- package/dist/project.d.ts +7 -0
- package/dist/project.d.ts.map +1 -0
- package/dist/project.js +74 -0
- package/dist/project.js.map +1 -0
- package/package.json +63 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 preset-pnpm-monorepo contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,8 +1,128 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Check Task Builder
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
把 Check 项目只读文件树转换为标准 Task Builder 输入,再复用
|
|
4
|
+
`@silvermoon-work/task-builder@0.1.0`
|
|
5
|
+
编译、绑定、校验和编码 CAR。不复制上游编译器,不生成编辑器类型文件,不保留完整中间项目。
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
the task engine. No usable code is published at version `0.0.0`.
|
|
7
|
+
## CLI
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
```sh
|
|
10
|
+
check-task-builder init text-check
|
|
11
|
+
cd text-check
|
|
12
|
+
pnpm install
|
|
13
|
+
pnpm typecheck
|
|
14
|
+
pnpm build
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
check-task-builder init <directory> [--package-name <name>] [--task-name <name>]
|
|
19
|
+
check-task-builder build [build-file] [--out-dir <directory>] [--no-car]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`init` 创建实际读取 `assets/expected.txt` 并判断输入文本的可编辑项目。输入
|
|
23
|
+
`{"text":"hello"}` 通过,`{"text":"other"}`
|
|
24
|
+
正常不通过。目标目录必须不存在且父目录存在;不交互、不安装、不覆盖。模板固定本包/SDK版本,并显式声明
|
|
25
|
+
`task-builder-cli@0.1.0` 开发依赖; `pnpm car` 调用上游 CLI,本 CLI **没有**
|
|
26
|
+
`car` 命令。
|
|
27
|
+
|
|
28
|
+
```yaml
|
|
29
|
+
# check.build.yaml
|
|
30
|
+
name: Text check
|
|
31
|
+
runtime:
|
|
32
|
+
minVersion: 22.13.0
|
|
33
|
+
source:
|
|
34
|
+
entry: src/main.ts
|
|
35
|
+
contract: src/contract.ts
|
|
36
|
+
include:
|
|
37
|
+
- from: assets/**
|
|
38
|
+
to: resources/
|
|
39
|
+
binary: []
|
|
40
|
+
outDirectory: dist/text-check
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`source.entry` 使用 SDK 的 `runCheck`;`source.contract` 默认导出
|
|
44
|
+
`createCheckContract` 生成的契约。问题码仅来自作者 TypeBox Schema;不接受 YAML
|
|
45
|
+
`problemCodes`,也不接受 source 的
|
|
46
|
+
`mode/sdk/exportName`。契约模块求值是受信任代码执行,不是沙箱。可选 `$schema` 为
|
|
47
|
+
`https://silvermoon-work.github.io/okr-agent/schemas/check-build/v1.json`,是格式标识,不要求联网下载。
|
|
48
|
+
|
|
49
|
+
## 参考标准和资源
|
|
50
|
+
|
|
51
|
+
必需 `references/check.md` 和每个已声明问题码的
|
|
52
|
+
`references/problems/<code>.md`,均为非空有效 UTF-8。这些约定路径严格区分大小写,包括在 Windows 上构建时。未声明的问题 Markdown、缺失/空白/无效编码文档均构建失败;不要求 frontmatter,不抓取全部 Markdown 链接。收录整个有效
|
|
53
|
+
`references/`
|
|
54
|
+
子树,保持图片和相对链接路径,无需逐一列出参考资源。二进制参考附件沿用上游规则,在
|
|
55
|
+
`binary` 中选择输出路径,例如
|
|
56
|
+
`resources/references/**/*.png`。不可交付的路径明确失败,不静默省略。上游资源选择排除点开头的路径及
|
|
57
|
+
`node_modules`;参考目录出现这些路径时明确拒绝,而不是漏掉资源后声称完整构建。
|
|
58
|
+
|
|
59
|
+
## 路径和交付协议
|
|
60
|
+
|
|
61
|
+
默认文件
|
|
62
|
+
`check.build.yaml`。CLI 路径相对 cwd,配置路径相对配置所在目录;输出优先级
|
|
63
|
+
`--out-dir` > `outDirectory` > 配置目录下 `dist`。包名为 `@example/text-check`
|
|
64
|
+
的模板使用 `dist/example-text-check` 及同级 `.car`。
|
|
65
|
+
|
|
66
|
+
先完整读取并用上游 CAR 编码器校验暂存 Bundle,再替换本次选择的文件。dist 仅交付最终目录和同级 CAR;不自动 clean,不删除未选中的旧文件。
|
|
67
|
+
`--no-car` 不删除或更新旧 CAR,并在本次结果中返回
|
|
68
|
+
`car: null`。已有输出不是原子目录交换:部分替换失败会报告
|
|
69
|
+
`DELIVERY_UNCERTAIN`,不声称回滚。模块已验证但 CAR 交付失败时,失败信封的 `data`
|
|
70
|
+
仅包含已验证模块。暂存清理无法确认时报告 `CLEANUP_UNCERTAIN`。
|
|
71
|
+
|
|
72
|
+
成功/失败均向 stdout 写单条换行 JSON:
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{ "ok": true, "data": { "module": {}, "cid": "...", "car": null } }
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{ "ok": false, "error": { "code": "OPERATION_FAILED", "message": "..." } }
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
帮助/版本及无参数帮助为 stdout 文本,诊断保留 stderr;成功退出 0,一般失败 1,取消且清理确认后为 130/143,不确定交付或清理为 1。正常
|
|
83
|
+
`pass:false`
|
|
84
|
+
是运行期业务结果,与构建失败无关。JSON 信封和已公开参数为自动化接口;不应解析帮助文本。
|
|
85
|
+
|
|
86
|
+
## 库 API
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
import {
|
|
90
|
+
createCheckProject,
|
|
91
|
+
transformCheckTree,
|
|
92
|
+
buildCheckBundle,
|
|
93
|
+
} from "@silvermoon-work/check-task-builder";
|
|
94
|
+
import { directoryTree } from "@silvermoon-work/task-builder-cli/node";
|
|
95
|
+
import { encodeTaskBundleCar } from "@silvermoon-work/task-builder/car";
|
|
96
|
+
|
|
97
|
+
const input = await directoryTree(process.cwd());
|
|
98
|
+
const definition = await transformCheckTree(input, "check.build.yaml");
|
|
99
|
+
// definition.tree + definition.options 可交给标准上游 builder
|
|
100
|
+
const bundle = await buildCheckBundle(input, "check.build.yaml");
|
|
101
|
+
const archive = await encodeTaskBundleCar(bundle);
|
|
102
|
+
try {
|
|
103
|
+
// 消费 archive.stream;CID 为 archive.cid
|
|
104
|
+
} finally {
|
|
105
|
+
await archive.close();
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
输入树必须包含源码及真实依赖;不会回退到工具自己的 node_modules。文件树逻辑路径统一使用
|
|
110
|
+
`/`,不是宿主文件系统路径。资源为惰性流,`buildCheckBundle`
|
|
111
|
+
返回不代表全部资源字节已经消费;交付必须完整消费并通过上游验证,例如使用
|
|
112
|
+
`encodeTaskBundleCar`。 `createCheckProject({ name?, taskName? })`
|
|
113
|
+
仅返回模板树,不写盘。
|
|
114
|
+
`runCheckBuilderCli(argv, { cwd?, stdout?, stderr?, signal?, signalExitCode? })`
|
|
115
|
+
位于 `/cli`,不退出进程、不注册信号处理器。
|
|
116
|
+
|
|
117
|
+
开发验证:`pnpm check`。`scripts/smoke.mjs`
|
|
118
|
+
可复制到独立安装目录,使用已发布 Task Engine
|
|
119
|
+
0.1.0 执行 Bundle,验证 pass/fail、真实输出文档和资源回收;第三参数 `fault`
|
|
120
|
+
验证抛错制品。若 Bundle 包含参考附属资源(例如
|
|
121
|
+
`references/assets/standard.txt`),还会验证输出资源的字节与 Bundle 一致。需要显式安装
|
|
122
|
+
`@silvermoon-work/task-engine@0.1.0`、`@silvermoon-work/task-builder@0.1.0`、
|
|
123
|
+
`@silvermoon-work/task-builder-cli@0.1.0` 和 `ipfs-unixfs-exporter@16.2.3`。
|
|
124
|
+
|
|
125
|
+
```sh
|
|
126
|
+
node smoke.mjs path/to/dist/text-check
|
|
127
|
+
node smoke.mjs path/to/fault-bundle fault
|
|
128
|
+
```
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
package/dist/bin.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { runCheckBuilderCli } from "./cli.js";
|
|
3
|
+
const controller = new AbortController();
|
|
4
|
+
let signalExitCode = 130;
|
|
5
|
+
const interrupt = () => {
|
|
6
|
+
controller.abort();
|
|
7
|
+
};
|
|
8
|
+
const terminate = () => {
|
|
9
|
+
signalExitCode = 143;
|
|
10
|
+
controller.abort();
|
|
11
|
+
};
|
|
12
|
+
process.once("SIGINT", interrupt);
|
|
13
|
+
process.once("SIGTERM", terminate);
|
|
14
|
+
try {
|
|
15
|
+
process.exitCode = await runCheckBuilderCli(process.argv.slice(2), {
|
|
16
|
+
signal: controller.signal,
|
|
17
|
+
signalExitCode: () => signalExitCode,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
finally {
|
|
21
|
+
process.removeListener("SIGINT", interrupt);
|
|
22
|
+
process.removeListener("SIGTERM", terminate);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=bin.js.map
|
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;AACzC,IAAI,cAAc,GAAc,GAAG,CAAC;AACpC,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,UAAU,CAAC,KAAK,EAAE,CAAC;AACrB,CAAC,CAAC;AACF,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,cAAc,GAAG,GAAG,CAAC;IACrB,UAAU,CAAC,KAAK,EAAE,CAAC;AACrB,CAAC,CAAC;AACF,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAClC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AACnC,IAAI,CAAC;IACH,OAAO,CAAC,QAAQ,GAAG,MAAM,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;QACjE,MAAM,EAAE,UAAU,CAAC,MAAM;QACzB,cAAc,EAAE,GAAG,EAAE,CAAC,cAAc;KACrC,CAAC,CAAC;AACL,CAAC;QAAS,CAAC;IACT,OAAO,CAAC,cAAc,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC5C,OAAO,CAAC,cAAc,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AAC/C,CAAC"}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ReadOptions } from "@silvermoon-work/task-builder/tree";
|
|
2
|
+
export interface CheckBuilderCliOptions extends ReadOptions {
|
|
3
|
+
readonly cwd?: string;
|
|
4
|
+
readonly stdout?: {
|
|
5
|
+
write(text: string): unknown;
|
|
6
|
+
};
|
|
7
|
+
readonly stderr?: {
|
|
8
|
+
write(text: string): unknown;
|
|
9
|
+
};
|
|
10
|
+
readonly signalExitCode?: () => 130 | 143;
|
|
11
|
+
}
|
|
12
|
+
/** One noninteractive invocation; business envelopes are always written to stdout. */
|
|
13
|
+
export declare function runCheckBuilderCli(argv: readonly string[], options?: CheckBuilderCliOptions): Promise<number>;
|
|
14
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAUA,OAAO,EAAY,KAAK,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAIhF,MAAM,WAAW,sBAAuB,SAAQ,WAAW;IACzD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE;QAAE,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACnD,QAAQ,CAAC,MAAM,CAAC,EAAE;QAAE,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACnD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,GAAG,GAAG,CAAC;CAC3C;AAoPD,sFAAsF;AACtF,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,MAAM,CAAC,CAoIjB"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { lstat, mkdir, rename, rm, stat } from "node:fs/promises";
|
|
3
|
+
import { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
4
|
+
import { Command, CommanderError } from "commander";
|
|
5
|
+
import { encodeTaskBundleCar } from "@silvermoon-work/task-builder/car";
|
|
6
|
+
import { directoryTree, writeDirectory, writeStreamFile, } from "@silvermoon-work/task-builder-cli/node";
|
|
7
|
+
import { fileTree } from "@silvermoon-work/task-builder/tree";
|
|
8
|
+
import { buildCheckBundle, transformCheckTree } from "./index.js";
|
|
9
|
+
import { createCheckProject, version } from "./project.js";
|
|
10
|
+
class DeliveryError extends Error {
|
|
11
|
+
code;
|
|
12
|
+
data;
|
|
13
|
+
constructor(code, message, data) {
|
|
14
|
+
super(message);
|
|
15
|
+
this.code = code;
|
|
16
|
+
this.data = data;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
async function info(path) {
|
|
20
|
+
try {
|
|
21
|
+
return await lstat(path);
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
if (error.code === "ENOENT")
|
|
25
|
+
return undefined;
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function inside(root, path) {
|
|
30
|
+
const distance = relative(root, path);
|
|
31
|
+
return (distance === "" ||
|
|
32
|
+
(!distance.startsWith(`..${sep}`) &&
|
|
33
|
+
distance !== ".." &&
|
|
34
|
+
!distance.includes(":")));
|
|
35
|
+
}
|
|
36
|
+
async function safePath(path) {
|
|
37
|
+
let current = resolve(path);
|
|
38
|
+
for (;;) {
|
|
39
|
+
const entry = await info(current);
|
|
40
|
+
if (entry?.isSymbolicLink())
|
|
41
|
+
throw new Error(`Output must not traverse a symbolic link: ${current}`);
|
|
42
|
+
const parent = dirname(current);
|
|
43
|
+
if (parent === current)
|
|
44
|
+
return;
|
|
45
|
+
current = parent;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function validateOptions(program, argv) {
|
|
49
|
+
let command = program;
|
|
50
|
+
const seen = new Set();
|
|
51
|
+
for (let index = 0; index < argv.length; index++) {
|
|
52
|
+
const token = argv[index];
|
|
53
|
+
if (token === "--")
|
|
54
|
+
break;
|
|
55
|
+
if (token.startsWith("-") && token !== "-") {
|
|
56
|
+
const flag = token.split("=")[0];
|
|
57
|
+
const help = flag === "--help" || flag === "-h";
|
|
58
|
+
const option = command.options.find((item) => item.short === flag || item.long === flag);
|
|
59
|
+
if (!option && !help)
|
|
60
|
+
throw new DeliveryError("INVALID_ARGUMENT", `Unknown option ${flag}.`);
|
|
61
|
+
if (token.includes("=") &&
|
|
62
|
+
(help || (!option.required && !option.optional)))
|
|
63
|
+
throw new DeliveryError("INVALID_ARGUMENT", `${flag} does not accept a value.`);
|
|
64
|
+
const key = `${command.name()}:${help ? "help" : option.name()}`;
|
|
65
|
+
if (seen.has(key))
|
|
66
|
+
throw new DeliveryError("INVALID_ARGUMENT", `Duplicate option ${flag}.`);
|
|
67
|
+
seen.add(key);
|
|
68
|
+
if (flag === "--version" && argv.length !== 1)
|
|
69
|
+
throw new DeliveryError("INVALID_ARGUMENT", "--version is a standalone root option.");
|
|
70
|
+
if (option?.required && !token.includes("="))
|
|
71
|
+
index++;
|
|
72
|
+
}
|
|
73
|
+
else if (command === program) {
|
|
74
|
+
command =
|
|
75
|
+
program.commands.find((item) => item.name() === token) ?? program;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
async function build(config, outDir, car, cwd, options) {
|
|
80
|
+
const file = resolve(cwd, config);
|
|
81
|
+
let root = dirname(file);
|
|
82
|
+
for (let ancestor = root;; ancestor = dirname(ancestor)) {
|
|
83
|
+
if ((await info(join(ancestor, "pnpm-workspace.yaml")))?.isFile()) {
|
|
84
|
+
root = ancestor;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
if (dirname(ancestor) === ancestor)
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
const path = relative(root, file).split(sep).join("/");
|
|
91
|
+
const input = await directoryTree(root);
|
|
92
|
+
const readOptions = {
|
|
93
|
+
...options,
|
|
94
|
+
...(outDir !== undefined ? { outDirectory: resolve(cwd, outDir) } : {}),
|
|
95
|
+
};
|
|
96
|
+
const definition = await transformCheckTree(input, path, readOptions);
|
|
97
|
+
const directory = resolve(root, definition.outDirectory);
|
|
98
|
+
const archivePath = `${directory}.car`;
|
|
99
|
+
await safePath(directory);
|
|
100
|
+
if (car)
|
|
101
|
+
await safePath(archivePath);
|
|
102
|
+
const protect = (path) => {
|
|
103
|
+
if (inside(directory, path) || (car && path === archivePath))
|
|
104
|
+
throw new Error("Output must not contain or replace build inputs.");
|
|
105
|
+
};
|
|
106
|
+
if (typeof definition.options.source.contract !== "string")
|
|
107
|
+
throw new Error("Expected source contract path.");
|
|
108
|
+
for (const path of [
|
|
109
|
+
file,
|
|
110
|
+
resolve(root, definition.options.source.entry),
|
|
111
|
+
resolve(root, definition.options.source.contract),
|
|
112
|
+
])
|
|
113
|
+
protect(path);
|
|
114
|
+
for (const rule of definition.options.include ?? []) {
|
|
115
|
+
const parts = rule.from.split("/");
|
|
116
|
+
const wildcard = parts.findIndex((part) => /[*?]/.test(part));
|
|
117
|
+
const base = resolve(root, ...parts.slice(0, wildcard < 0 ? -1 : wildcard));
|
|
118
|
+
if (inside(base, directory) ||
|
|
119
|
+
inside(directory, base) ||
|
|
120
|
+
(car && inside(base, archivePath)))
|
|
121
|
+
throw new Error("Resources must not traverse output paths.");
|
|
122
|
+
}
|
|
123
|
+
const { realpath } = await import("node:fs/promises");
|
|
124
|
+
const observed = {
|
|
125
|
+
async list(path, readOptions) {
|
|
126
|
+
protect(await realpath(resolve(root, path)));
|
|
127
|
+
return input.list(path, readOptions);
|
|
128
|
+
},
|
|
129
|
+
async read(path, readOptions) {
|
|
130
|
+
protect(await realpath(resolve(root, path)));
|
|
131
|
+
return input.read(path, readOptions);
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
const tree = await buildCheckBundle(observed, path, readOptions);
|
|
135
|
+
const staging = join(dirname(file), `.check-task-builder-${randomUUID()}`);
|
|
136
|
+
let archive;
|
|
137
|
+
let updating = false;
|
|
138
|
+
let data;
|
|
139
|
+
let failure;
|
|
140
|
+
try {
|
|
141
|
+
const files = await writeDirectory(tree, staging, options);
|
|
142
|
+
archive = await encodeTaskBundleCar(await directoryTree(staging), options);
|
|
143
|
+
if (car)
|
|
144
|
+
await writeStreamFile(archive.stream, `${staging}.car`, options);
|
|
145
|
+
options.signal?.throwIfAborted();
|
|
146
|
+
updating = true;
|
|
147
|
+
for (const path of files) {
|
|
148
|
+
options.signal?.throwIfAborted();
|
|
149
|
+
const target = join(directory, ...path.split("/"));
|
|
150
|
+
await safePath(target);
|
|
151
|
+
await mkdir(dirname(target), { recursive: true });
|
|
152
|
+
await rename(join(staging, ...path.split("/")), target);
|
|
153
|
+
}
|
|
154
|
+
const installedDirectory = await directoryTree(directory);
|
|
155
|
+
const installed = await encodeTaskBundleCar(fileTree(new Map(files.map((path) => [
|
|
156
|
+
path,
|
|
157
|
+
(readOptions) => installedDirectory.read(path, readOptions),
|
|
158
|
+
]))), options);
|
|
159
|
+
try {
|
|
160
|
+
if (installed.cid !== archive.cid)
|
|
161
|
+
throw new Error("Delivered Bundle identity changed.");
|
|
162
|
+
}
|
|
163
|
+
finally {
|
|
164
|
+
await installed.close();
|
|
165
|
+
}
|
|
166
|
+
data = {
|
|
167
|
+
module: { directory, declaration: join(directory, "task.yaml"), files },
|
|
168
|
+
cid: archive.cid,
|
|
169
|
+
car: null,
|
|
170
|
+
};
|
|
171
|
+
if (car) {
|
|
172
|
+
await safePath(archivePath);
|
|
173
|
+
await rename(`${staging}.car`, archivePath);
|
|
174
|
+
data.car = { path: archivePath };
|
|
175
|
+
}
|
|
176
|
+
options.signal?.throwIfAborted();
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
failure = error;
|
|
180
|
+
}
|
|
181
|
+
finally {
|
|
182
|
+
try {
|
|
183
|
+
await archive?.close();
|
|
184
|
+
await rm(staging, { recursive: true, force: true });
|
|
185
|
+
await rm(`${staging}.car`, { force: true });
|
|
186
|
+
}
|
|
187
|
+
catch (cause) {
|
|
188
|
+
failure = new DeliveryError("CLEANUP_UNCERTAIN", `Staging cleanup could not be confirmed: ${String(cause)}`, data);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (failure) {
|
|
192
|
+
if (failure instanceof DeliveryError)
|
|
193
|
+
throw failure;
|
|
194
|
+
if (updating && !data)
|
|
195
|
+
throw new DeliveryError("DELIVERY_UNCERTAIN", "Some selected files may have changed; the module is not a verified delivery.");
|
|
196
|
+
if (options.signal?.aborted)
|
|
197
|
+
throw new DeliveryError("INTERRUPTED", "Operation canceled; staging cleanup completed. Only reported deliveries were verified.", data);
|
|
198
|
+
if (data)
|
|
199
|
+
throw new DeliveryError("CAR_WRITE_FAILED", "Module was verified, but CAR delivery failed. Any old CAR is not this invocation's result.", data);
|
|
200
|
+
throw failure instanceof Error
|
|
201
|
+
? failure
|
|
202
|
+
: new Error("Build failed.", { cause: failure });
|
|
203
|
+
}
|
|
204
|
+
return data;
|
|
205
|
+
}
|
|
206
|
+
/** One noninteractive invocation; business envelopes are always written to stdout. */
|
|
207
|
+
export async function runCheckBuilderCli(argv, options = {}) {
|
|
208
|
+
const stdout = options.stdout ?? process.stdout;
|
|
209
|
+
const cwd = resolve(options.cwd ?? process.cwd());
|
|
210
|
+
const readOptions = options.signal
|
|
211
|
+
? { signal: options.signal }
|
|
212
|
+
: {};
|
|
213
|
+
const program = new Command();
|
|
214
|
+
let result;
|
|
215
|
+
try {
|
|
216
|
+
program
|
|
217
|
+
.name("check-task-builder")
|
|
218
|
+
.description("Create Check projects and build standard Task Bundles/CARs.")
|
|
219
|
+
.version(await version())
|
|
220
|
+
.enablePositionalOptions()
|
|
221
|
+
.exitOverride()
|
|
222
|
+
.configureOutput({
|
|
223
|
+
writeOut: (text) => {
|
|
224
|
+
stdout.write(text);
|
|
225
|
+
},
|
|
226
|
+
writeErr: () => undefined,
|
|
227
|
+
})
|
|
228
|
+
.addHelpText("after", "\nExamples:\n check-task-builder init text-check\n check-task-builder build check.build.yaml --no-car\n");
|
|
229
|
+
program
|
|
230
|
+
.command("init")
|
|
231
|
+
.description("Create an editable Check project; never install or overwrite.")
|
|
232
|
+
.argument("<directory>", "New directory; parent must exist")
|
|
233
|
+
.option("--package-name <name>", "npm package name (default: directory basename)")
|
|
234
|
+
.option("--task-name <name>", "Task name (default: unscoped package name)")
|
|
235
|
+
.addHelpText("after", "\nExample: check-task-builder init text-check --task-name text-check\n")
|
|
236
|
+
.action(async (directory, flags) => {
|
|
237
|
+
readOptions.signal?.throwIfAborted();
|
|
238
|
+
const output = resolve(cwd, directory);
|
|
239
|
+
await safePath(output);
|
|
240
|
+
if (await info(output))
|
|
241
|
+
throw new DeliveryError("OUTPUT_EXISTS", "Target already exists; nothing was overwritten.");
|
|
242
|
+
if (!(await stat(dirname(output))).isDirectory())
|
|
243
|
+
throw new Error("Parent must be a directory.");
|
|
244
|
+
const tree = await createCheckProject({
|
|
245
|
+
name: flags.packageName ?? basename(output),
|
|
246
|
+
...(flags.taskName !== undefined
|
|
247
|
+
? { taskName: flags.taskName }
|
|
248
|
+
: {}),
|
|
249
|
+
});
|
|
250
|
+
const files = await writeDirectory(tree, output, readOptions);
|
|
251
|
+
result = {
|
|
252
|
+
directory: output,
|
|
253
|
+
files,
|
|
254
|
+
nextSteps: ["pnpm install", "pnpm typecheck", "pnpm build"],
|
|
255
|
+
};
|
|
256
|
+
});
|
|
257
|
+
program
|
|
258
|
+
.command("build")
|
|
259
|
+
.description("Validate then replace selected Bundle files and sibling CAR; never clean.")
|
|
260
|
+
.argument("[build-file]", "Check build description", "check.build.yaml")
|
|
261
|
+
.option("--out-dir <directory>", "Output directory relative to cwd")
|
|
262
|
+
.option("--no-car", "Do not update or remove any CAR")
|
|
263
|
+
.addHelpText("after", "\nExample: check-task-builder build --out-dir dist/text-check\n")
|
|
264
|
+
.action(async (file, flags) => {
|
|
265
|
+
result = await build(file, flags.outDir, flags.car, cwd, readOptions);
|
|
266
|
+
});
|
|
267
|
+
validateOptions(program, argv);
|
|
268
|
+
if (!argv.length)
|
|
269
|
+
program.outputHelp();
|
|
270
|
+
else
|
|
271
|
+
await program.parseAsync([...argv], { from: "user" });
|
|
272
|
+
if (result !== undefined && options.signal?.aborted)
|
|
273
|
+
throw new DeliveryError("INTERRUPTED", "Operation canceled after confirmed delivery and cleanup; verified results are retained.", result);
|
|
274
|
+
if (result !== undefined)
|
|
275
|
+
stdout.write(`${JSON.stringify({ ok: true, data: result })}\n`);
|
|
276
|
+
return 0;
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
if (error instanceof CommanderError && error.exitCode === 0)
|
|
280
|
+
return 0;
|
|
281
|
+
const uncertain = error instanceof AggregateError ||
|
|
282
|
+
(error instanceof DeliveryError && error.code.endsWith("UNCERTAIN"));
|
|
283
|
+
const canceled = options.signal?.aborted &&
|
|
284
|
+
!uncertain &&
|
|
285
|
+
((error instanceof DeliveryError && error.code === "INTERRUPTED") ||
|
|
286
|
+
error === options.signal.reason ||
|
|
287
|
+
(error instanceof Error && error.name === "AbortError"));
|
|
288
|
+
const code = uncertain
|
|
289
|
+
? error instanceof DeliveryError
|
|
290
|
+
? error.code
|
|
291
|
+
: "CLEANUP_UNCERTAIN"
|
|
292
|
+
: canceled
|
|
293
|
+
? "INTERRUPTED"
|
|
294
|
+
: error instanceof CommanderError
|
|
295
|
+
? "INVALID_ARGUMENT"
|
|
296
|
+
: error instanceof DeliveryError
|
|
297
|
+
? error.code
|
|
298
|
+
: "OPERATION_FAILED";
|
|
299
|
+
const message = error instanceof Error ? error.message : "Operation failed.";
|
|
300
|
+
stdout.write(`${JSON.stringify({ ok: false, ...(error instanceof DeliveryError && error.data ? { data: error.data } : {}), error: { code, message } })}\n`);
|
|
301
|
+
return canceled ? (options.signalExitCode?.() ?? 130) : 1;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EACL,aAAa,EACb,cAAc,EACd,eAAe,GAChB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAoB,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAS3D,MAAM,aAAc,SAAQ,KAAK;IAEpB;IAEA;IAHX,YACW,IAAY,EACrB,OAAe,EACN,IAAc;QAEvB,KAAK,C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AE,KAAK,EAAE,GAAG,CAAC,KAAK,YAAY,aAAa,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,IAAI,CAC9I,CAAC;QACF,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type TaskBuildFile } from "@silvermoon-work/task-builder";
|
|
2
|
+
import { type ReadonlyFileTree, type ReadOptions } from "@silvermoon-work/task-builder/tree";
|
|
3
|
+
export { createCheckProject } from "./project.js";
|
|
4
|
+
export type { CheckProjectOptions } from "./project.js";
|
|
5
|
+
export declare const checkBuildSchemaUri = "https://silvermoon-work.github.io/okr-agent/schemas/check-build/v1.json";
|
|
6
|
+
export interface CheckBuild extends TaskBuildFile {
|
|
7
|
+
readonly tree: ReadonlyFileTree;
|
|
8
|
+
readonly references: string;
|
|
9
|
+
}
|
|
10
|
+
/** Overlay only a standard build description; sources and dependencies stay lazy. */
|
|
11
|
+
export declare function transformCheckTree(input: ReadonlyFileTree, path?: string, options?: ReadOptions & {
|
|
12
|
+
readonly outDirectory?: string;
|
|
13
|
+
}): Promise<CheckBuild>;
|
|
14
|
+
/** Compile and validate the Check-specific contract/docs, leaving Bundle/CAR mechanics upstream. */
|
|
15
|
+
export declare function buildCheckBundle(input: ReadonlyFileTree, path?: string, options?: ReadOptions & {
|
|
16
|
+
readonly outDirectory?: string;
|
|
17
|
+
}): Promise<ReadonlyFileTree>;
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAKL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EACjB,MAAM,oCAAoC,CAAC;AAG5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExD,eAAO,MAAM,mBAAmB,4EAC2C,CAAC;AAE5E,MAAM,WAAW,UAAW,SAAQ,aAAa;IAC/C,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,qFAAqF;AACrF,wBAAsB,kBAAkB,CACtC,KAAK,EAAE,gBAAgB,EACvB,IAAI,SAAqB,EACzB,OAAO,GAAE,WAAW,GAAG;IAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7D,OAAO,CAAC,UAAU,CAAC,CAsErB;AA4ED,oGAAoG;AACpG,wBAAsB,gBAAgB,CACpC,KAAK,EAAE,gBAAgB,EACvB,IAAI,SAAqB,EACzB,OAAO,GAAE,WAAW,GAAG;IAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7D,OAAO,CAAC,gBAAgB,CAAC,CAoB3B"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { posix } from "node:path";
|
|
2
|
+
import { buildTaskBundle, readTaskBuild, } from "@silvermoon-work/task-builder";
|
|
3
|
+
import { checkTreePath, listTree, memoryFile, readBytes, } from "@silvermoon-work/task-builder/tree";
|
|
4
|
+
import { parse, stringify } from "yaml";
|
|
5
|
+
export { createCheckProject } from "./project.js";
|
|
6
|
+
export const checkBuildSchemaUri = "https://silvermoon-work.github.io/okr-agent/schemas/check-build/v1.json";
|
|
7
|
+
/** Overlay only a standard build description; sources and dependencies stay lazy. */
|
|
8
|
+
export async function transformCheckTree(input, path = "check.build.yaml", options = {}) {
|
|
9
|
+
checkTreePath(path);
|
|
10
|
+
const raw = parse(new TextDecoder("utf-8", { fatal: true }).decode(await readBytes(input, path, 65_536, options)));
|
|
11
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw))
|
|
12
|
+
throw new Error("Check build file must contain an object.");
|
|
13
|
+
const config = raw;
|
|
14
|
+
if (config.$schema !== undefined && config.$schema !== checkBuildSchemaUri)
|
|
15
|
+
throw new Error("Invalid Check build schema.");
|
|
16
|
+
if (!config.source ||
|
|
17
|
+
typeof config.source !== "object" ||
|
|
18
|
+
Array.isArray(config.source))
|
|
19
|
+
throw new Error("Check source must contain entry and contract.");
|
|
20
|
+
const source = config.source;
|
|
21
|
+
if (Object.keys(source).some((key) => !["entry", "contract"].includes(key)))
|
|
22
|
+
throw new Error("Check source only accepts entry and contract; runCheck owns the wrapper.");
|
|
23
|
+
const include = config.include ?? [];
|
|
24
|
+
if (!Array.isArray(include))
|
|
25
|
+
throw new Error("Include must be an array.");
|
|
26
|
+
const normalized = {
|
|
27
|
+
...config,
|
|
28
|
+
source: { ...source, mode: "explicit" },
|
|
29
|
+
include: [
|
|
30
|
+
...include,
|
|
31
|
+
{ from: "references/**", to: "resources/references/" },
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
delete normalized.$schema;
|
|
35
|
+
const bytes = Buffer.from(stringify(normalized));
|
|
36
|
+
const tree = {
|
|
37
|
+
list: (name, readOptions) => input.list(name, readOptions),
|
|
38
|
+
read: (name, readOptions) => name === path
|
|
39
|
+
? Promise.resolve(memoryFile(bytes, readOptions))
|
|
40
|
+
: input.read(name, readOptions),
|
|
41
|
+
};
|
|
42
|
+
const definition = await readTaskBuild(tree, path, {
|
|
43
|
+
...options,
|
|
44
|
+
allowContractExecution: true,
|
|
45
|
+
});
|
|
46
|
+
const base = posix.dirname(path);
|
|
47
|
+
const references = base === "." ? "references" : `${base}/references`;
|
|
48
|
+
let visited = 0;
|
|
49
|
+
const inspectReferences = async (directory) => {
|
|
50
|
+
for (const entry of await listTree(input, directory, options)) {
|
|
51
|
+
if (++visited > 16_384)
|
|
52
|
+
throw new Error("Reference subtree exceeds path capacity.");
|
|
53
|
+
const child = `${directory}/${entry.name}`;
|
|
54
|
+
if (entry.name.startsWith(".") ||
|
|
55
|
+
entry.name.toLowerCase() === "node_modules")
|
|
56
|
+
throw new Error(`Unsupported reference path (upstream resource exclusion): ${child}`);
|
|
57
|
+
if (entry.kind === "directory")
|
|
58
|
+
await inspectReferences(child);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
await inspectReferences(references);
|
|
62
|
+
return {
|
|
63
|
+
...definition,
|
|
64
|
+
tree,
|
|
65
|
+
references,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function literalCodes(value) {
|
|
69
|
+
if (!value || typeof value !== "object")
|
|
70
|
+
throw new Error("Missing Check problem code schema.");
|
|
71
|
+
const schema = value;
|
|
72
|
+
if (Array.isArray(schema.anyOf))
|
|
73
|
+
return schema.anyOf.flatMap(literalCodes);
|
|
74
|
+
if (typeof schema.const !== "string" ||
|
|
75
|
+
!/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/.test(schema.const))
|
|
76
|
+
throw new Error("Check codes must be finite portable string literals.");
|
|
77
|
+
return [schema.const];
|
|
78
|
+
}
|
|
79
|
+
async function validateReferences(input, root, codes, options) {
|
|
80
|
+
const rootEntries = await listTree(input, root, options);
|
|
81
|
+
if (!rootEntries.some((entry) => entry.name === "check.md" && entry.kind === "file") ||
|
|
82
|
+
!rootEntries.some((entry) => entry.name === "problems" && entry.kind === "directory"))
|
|
83
|
+
throw new Error("References require exact case-sensitive check.md and problems/ paths.");
|
|
84
|
+
const problemEntries = await listTree(input, `${root}/problems`, options);
|
|
85
|
+
const required = ["check.md", ...codes.map((code) => `problems/${code}.md`)];
|
|
86
|
+
for (const path of required) {
|
|
87
|
+
if (path !== "check.md" &&
|
|
88
|
+
!problemEntries.some((entry) => entry.name === posix.basename(path) && entry.kind === "file"))
|
|
89
|
+
throw new Error(`Missing exact case-sensitive reference: ${root}/${path}`);
|
|
90
|
+
let text;
|
|
91
|
+
try {
|
|
92
|
+
text = new TextDecoder("utf-8", { fatal: true }).decode(await readBytes(input, `${root}/${path}`, 16 * 1024 * 1024, options));
|
|
93
|
+
}
|
|
94
|
+
catch (cause) {
|
|
95
|
+
throw new Error(`Missing or invalid UTF-8 reference: ${root}/${path}`, {
|
|
96
|
+
cause,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
if (!text.trim())
|
|
100
|
+
throw new Error(`Reference must not be empty: ${root}/${path}`);
|
|
101
|
+
}
|
|
102
|
+
let visited = 0;
|
|
103
|
+
const walk = async (directory) => {
|
|
104
|
+
for (const entry of await listTree(input, `${root}/${directory}`, options)) {
|
|
105
|
+
if (++visited > 16_384)
|
|
106
|
+
throw new Error("Problem references exceed path capacity.");
|
|
107
|
+
const path = `${directory}/${entry.name}`;
|
|
108
|
+
if (entry.kind === "directory")
|
|
109
|
+
await walk(path);
|
|
110
|
+
else if (/\.md$/i.test(entry.name) && !required.includes(path))
|
|
111
|
+
throw new Error(`Undeclared problem Markdown: ${root}/${path}`);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
await walk("problems");
|
|
115
|
+
}
|
|
116
|
+
/** Compile and validate the Check-specific contract/docs, leaving Bundle/CAR mechanics upstream. */
|
|
117
|
+
export async function buildCheckBundle(input, path = "check.build.yaml", options = {}) {
|
|
118
|
+
const definition = await transformCheckTree(input, path, options);
|
|
119
|
+
const bundle = await buildTaskBundle(definition.tree, definition.options);
|
|
120
|
+
const codeSchema = JSON.parse(Buffer.from(await readBytes(bundle, "schemas/shared/check-problem-code.json", 65_536, options)).toString());
|
|
121
|
+
await validateReferences(input, definition.references, literalCodes(codeSchema), options);
|
|
122
|
+
return bundle;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=index.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C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAC5D,MAAM,IAAI,KAAK,CAAC,gCAAgC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;QACpE,CAAC;IACH,CAAC,CAAC;IACF,MAAM,IAAI,CAAC,UAAU,CAAC,CAAC;AACzB,CAAC;AAED,oGAAoG;AACpG,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,KAAuB,EACvB,IAAI,GAAG,kBAAkB,EACzB,UAA4D,EAAE;IAE9D,MAAM,UAAU,GAAG,MAAM,kBAAkB,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAClE,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IAC1E,MAAM,UAAU,GAAY,IAAI,CAAC,KAAK,CACpC,MAAM,CAAC,IAAI,CACT,MAAM,SAAS,CACb,MAAM,EACN,wCAAwC,EACxC,MAAM,EACN,OAAO,CACR,CACF,CAAC,QAAQ,EAAE,CACb,CAAC;IACF,MAAM,kBAAkB,CACtB,KAAK,EACL,UAAU,CAAC,UAAU,EACrB,YAAY,CAAC,UAAU,CAAC,EACxB,OAAO,CACR,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface CheckProjectOptions {
|
|
2
|
+
readonly name?: string;
|
|
3
|
+
readonly taskName?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function version(): Promise<string>;
|
|
6
|
+
export declare function createCheckProject(options?: CheckProjectOptions): Promise<import("@silvermoon-work/task-builder/tree").ReadonlyFileTree>;
|
|
7
|
+
//# sourceMappingURL=project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAsB,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,CAK/C;AAED,wBAAsB,kBAAkB,CAAC,OAAO,GAAE,mBAAwB,0EAyFzE"}
|
package/dist/project.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { createTaskProject } from "@silvermoon-work/task-builder/init";
|
|
3
|
+
import { memoryTree, readBytes } from "@silvermoon-work/task-builder/tree";
|
|
4
|
+
import { parse, stringify } from "yaml";
|
|
5
|
+
import { checkBuildSchemaUri } from "./index.js";
|
|
6
|
+
export async function version() {
|
|
7
|
+
const manifest = JSON.parse(await readFile(new URL("../package.json", import.meta.url), "utf8"));
|
|
8
|
+
return manifest.version;
|
|
9
|
+
}
|
|
10
|
+
export async function createCheckProject(options = {}) {
|
|
11
|
+
const base = createTaskProject(options);
|
|
12
|
+
const manifest = JSON.parse(Buffer.from(await readBytes(base, "package.json", 65_536)).toString());
|
|
13
|
+
const config = parse(Buffer.from(await readBytes(base, "task.build.yaml", 65_536)).toString());
|
|
14
|
+
config.$schema = checkBuildSchemaUri;
|
|
15
|
+
config.include = [{ from: "assets/**", to: "resources/" }];
|
|
16
|
+
const release = await version();
|
|
17
|
+
const files = {
|
|
18
|
+
"package.json": `${JSON.stringify({
|
|
19
|
+
...manifest,
|
|
20
|
+
packageManager: "pnpm@11.22.0",
|
|
21
|
+
dependencies: {
|
|
22
|
+
"@silvermoon-work/check-task-sdk": release,
|
|
23
|
+
"@sinclair/typebox": "0.34.52",
|
|
24
|
+
},
|
|
25
|
+
devDependencies: {
|
|
26
|
+
...manifest.devDependencies,
|
|
27
|
+
"@silvermoon-work/check-task-builder": release,
|
|
28
|
+
"@silvermoon-work/task-builder-cli": "0.1.0",
|
|
29
|
+
},
|
|
30
|
+
scripts: {
|
|
31
|
+
typecheck: "tsc --project tsconfig.json",
|
|
32
|
+
build: "check-task-builder build",
|
|
33
|
+
car: `task-builder car ${config.outDirectory}/task.yaml --output ${config.outDirectory}.car`,
|
|
34
|
+
},
|
|
35
|
+
}, null, 2)}\n`,
|
|
36
|
+
"pnpm-workspace.yaml": stringify({
|
|
37
|
+
allowBuilds: { esbuild: true },
|
|
38
|
+
minimumReleaseAgeExclude: ["@silvermoon-work/*"],
|
|
39
|
+
}),
|
|
40
|
+
".gitignore": Buffer.from(await readBytes(base, ".gitignore", 65_536)).toString(),
|
|
41
|
+
"tsconfig.json": Buffer.from(await readBytes(base, "tsconfig.json", 65_536)).toString(),
|
|
42
|
+
"check.build.yaml": stringify({
|
|
43
|
+
...config,
|
|
44
|
+
source: { entry: "src/main.ts", contract: "src/contract.ts" },
|
|
45
|
+
}),
|
|
46
|
+
"src/contract.ts": `import { Type, type Static } from "@sinclair/typebox";
|
|
47
|
+
import { createCheckContract } from "@silvermoon-work/check-task-sdk/contracts";
|
|
48
|
+
|
|
49
|
+
export const Input = Type.Object({ text: Type.String() }, { additionalProperties: false });
|
|
50
|
+
export type Input = Static<typeof Input>;
|
|
51
|
+
export const ProblemCode = Type.Union([Type.Literal("text-mismatch")]);
|
|
52
|
+
export type ProblemCode = Static<typeof ProblemCode>;
|
|
53
|
+
export default createCheckContract(Input, ProblemCode);
|
|
54
|
+
`,
|
|
55
|
+
"src/main.ts": `import { runCheck } from "@silvermoon-work/check-task-sdk";
|
|
56
|
+
import contract from "./contract.js";
|
|
57
|
+
|
|
58
|
+
runCheck(contract, async (input, context, reportProblem) => {
|
|
59
|
+
const node = await context.bundle.root.resolve("resources/expected.txt").read();
|
|
60
|
+
if (node.kind !== "file") throw new Error("Expected standard must be a file.");
|
|
61
|
+
const expected = await new Response(node.content).text();
|
|
62
|
+
if (input.text !== expected.trimEnd()) {
|
|
63
|
+
reportProblem("text-mismatch", \`Text \${JSON.stringify(input.text)} must equal \${JSON.stringify(expected.trimEnd())}.\`);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
`,
|
|
67
|
+
"assets/expected.txt": "hello\n",
|
|
68
|
+
"references/check.md": "# Text standard\n\nThe supplied text must equal the bundled expected text (ignoring its final newline).\n",
|
|
69
|
+
"references/problems/text-mismatch.md": "# Text mismatch\n\nReplace the input text with the exact bundled expected text.\n",
|
|
70
|
+
"README.md": '# Check project\n\nInstall with `pnpm install`, edit `src/contract.ts`, `src/main.ts`, and `references/`, then run `pnpm typecheck` and `pnpm build`.\n\nUse input `{"text":"hello"}` to pass and `{"text":"other"}` for a normal nonpassing result. Missing resources or thrown errors are execution faults, not problems.\n',
|
|
71
|
+
};
|
|
72
|
+
return memoryTree(new Map(Object.entries(files).map(([path, text]) => [path, Buffer.from(text)])));
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project.js","sourceRoot":"","sources":["../src/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAOjD,MAAM,CAAC,KAAK,UAAU,OAAO;IAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CACzB,MAAM,QAAQ,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAC7C,CAAC;IACzB,OAAO,QAAQ,CAAC,OAAO,CAAC;AAC1B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,UAA+B,EAAE;IACxE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C,IAAI,CACvB,MAAM,SAAS,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,CAC5C,CAAC,QAAQ,EAAE;QACZ,eAAe,EAAE,MAAM,CAAC,IAAI,CAC1B,MAAM,SAAS,CAAC,IAAI,EAAE,eAAe,EAAE,MAAM,CAAC,CAC/C,CAAC,QAAQ,EAAE;QACZ,kBAAkB,EAAE,SAAS,CAAC;YAC5B,GAAG,MAAM;YACT,MAAM,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,iBAAiB,EAAE;SAC9D,CAAC;QACF,iBAAiB,EAAE;;;;;;;;CAQtB;QACG,aAAa,EAAE;;;;;;;;;;;CAWlB;QACG,qBAAqB,EAAE,SAAS;QAChC,qBAAqB,EACnB,2GAA2G;QAC7G,sCAAsC,EACpC,mFAAmF;QACrF,WAAW,EACT,+TAA+T;KAClU,CAAC;IACF,OAAO,UAAU,CACf,IAAI,GAAG,CACL,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CACvE,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1 +1,63 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "@silvermoon-work/check-task-builder",
|
|
3
|
+
"version": "0.1.0-rc.0",
|
|
4
|
+
"description": "Build Check projects into standard Task Bundles and CARs.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./cli": {
|
|
15
|
+
"types": "./dist/cli.d.ts",
|
|
16
|
+
"import": "./dist/cli.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"bin": {
|
|
20
|
+
"check-task-builder": "./dist/bin.js"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"README.md",
|
|
25
|
+
"LICENSE"
|
|
26
|
+
],
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=22.13"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@silvermoon-work/task-builder": "0.1.0",
|
|
32
|
+
"@silvermoon-work/task-builder-cli": "0.1.0",
|
|
33
|
+
"commander": "14.0.2",
|
|
34
|
+
"yaml": "2.8.1",
|
|
35
|
+
"@silvermoon-work/check-task-sdk": "0.1.0-rc.0"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@silvermoon-work/task-engine": "0.1.0",
|
|
39
|
+
"@silvermoon-work/task-sdk": "0.1.0",
|
|
40
|
+
"@sinclair/typebox": "0.34.52",
|
|
41
|
+
"ipfs-unixfs-exporter": "16.2.3"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "git+https://github.com/silvermoon-work/okr-agent.git",
|
|
50
|
+
"directory": "packages/check-task-builder"
|
|
51
|
+
},
|
|
52
|
+
"homepage": "https://github.com/silvermoon-work/okr-agent/tree/main/packages/check-task-builder#readme",
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/silvermoon-work/okr-agent/issues"
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"build": "tsc -p tsconfig.build.json",
|
|
58
|
+
"clean": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
59
|
+
"lint": "eslint . --max-warnings=0",
|
|
60
|
+
"test": "vitest run --root . --config ../../vitest.config.ts",
|
|
61
|
+
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
62
|
+
}
|
|
63
|
+
}
|