@fenglimg/fabric-shared 1.7.0 → 1.8.0-rc.2
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/dist/chunk-3SZRB42B.js +90 -0
- package/dist/{chunk-5H2PVNB2.js → chunk-BLXHC5HA.js} +30 -10
- package/dist/chunk-GI6L6VTT.js +176 -0
- package/dist/chunk-KV27CZH3.js +223 -0
- package/dist/errors/index.d.ts +65 -0
- package/dist/errors/index.js +30 -0
- package/dist/i18n/index.js +1 -1
- package/dist/index.d.ts +718 -254
- package/dist/index.js +354 -309
- package/dist/node/atomic-write.d.ts +14 -0
- package/dist/node/atomic-write.js +60 -0
- package/dist/node/bootstrap-guide.d.ts +12 -0
- package/dist/node/bootstrap-guide.js +52 -0
- package/dist/node/mcp-payload-guard.d.ts +16 -0
- package/dist/node/mcp-payload-guard.js +40 -0
- package/dist/node.js +3 -172
- package/dist/schemas/api-contracts.d.ts +883 -0
- package/dist/schemas/api-contracts.js +36 -0
- package/dist/types/index.d.ts +6 -4
- package/package.json +28 -4
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// src/errors/fabric-error.ts
|
|
2
|
+
var FabricError = class extends Error {
|
|
3
|
+
actionHint;
|
|
4
|
+
fixable;
|
|
5
|
+
details;
|
|
6
|
+
constructor(message, opts) {
|
|
7
|
+
super(message);
|
|
8
|
+
if (!opts.actionHint || opts.actionHint.length === 0) {
|
|
9
|
+
throw new Error("FabricError: actionHint is required and must be non-empty");
|
|
10
|
+
}
|
|
11
|
+
this.name = this.constructor.name;
|
|
12
|
+
this.actionHint = opts.actionHint;
|
|
13
|
+
this.fixable = opts.fixable ?? false;
|
|
14
|
+
this.details = opts.details;
|
|
15
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
16
|
+
}
|
|
17
|
+
toJSON() {
|
|
18
|
+
return {
|
|
19
|
+
name: this.name,
|
|
20
|
+
code: this.code,
|
|
21
|
+
message: this.message,
|
|
22
|
+
actionHint: this.actionHint,
|
|
23
|
+
fixable: this.fixable,
|
|
24
|
+
...this.details !== void 0 ? { details: this.details } : {}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// src/errors/config-error.ts
|
|
30
|
+
var ConfigError = class extends FabricError {
|
|
31
|
+
httpStatus = 400;
|
|
32
|
+
};
|
|
33
|
+
var ConfigPathInvalidError = class extends ConfigError {
|
|
34
|
+
code = "config_path_invalid";
|
|
35
|
+
};
|
|
36
|
+
var GenericConfigError = class extends ConfigError {
|
|
37
|
+
code = "config_error";
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// src/errors/rule-error.ts
|
|
41
|
+
var RuleError = class extends FabricError {
|
|
42
|
+
httpStatus = 422;
|
|
43
|
+
};
|
|
44
|
+
var RuleValidationError = class extends RuleError {
|
|
45
|
+
code = "rule_validation_error";
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// src/errors/io-error.ts
|
|
49
|
+
var IOFabricError = class extends FabricError {
|
|
50
|
+
httpStatus = 500;
|
|
51
|
+
};
|
|
52
|
+
var PathEscapeError = class extends IOFabricError {
|
|
53
|
+
code = "PATH_OUTSIDE_PROJECT_ROOT";
|
|
54
|
+
httpStatus = 403;
|
|
55
|
+
};
|
|
56
|
+
var GenericIOError = class extends IOFabricError {
|
|
57
|
+
code = "io_error";
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// src/errors/mcp-error.ts
|
|
61
|
+
var MCPError = class extends FabricError {
|
|
62
|
+
};
|
|
63
|
+
var McpToolError = class extends MCPError {
|
|
64
|
+
code = "mcp_tool_error";
|
|
65
|
+
httpStatus = 500;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// src/errors/init-error.ts
|
|
69
|
+
var InitError = class extends FabricError {
|
|
70
|
+
httpStatus = 500;
|
|
71
|
+
};
|
|
72
|
+
var InitFrameworkUnknownError = class extends InitError {
|
|
73
|
+
code = "init_framework_unknown";
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
FabricError,
|
|
78
|
+
ConfigError,
|
|
79
|
+
ConfigPathInvalidError,
|
|
80
|
+
GenericConfigError,
|
|
81
|
+
RuleError,
|
|
82
|
+
RuleValidationError,
|
|
83
|
+
IOFabricError,
|
|
84
|
+
PathEscapeError,
|
|
85
|
+
GenericIOError,
|
|
86
|
+
MCPError,
|
|
87
|
+
McpToolError,
|
|
88
|
+
InitError,
|
|
89
|
+
InitFrameworkUnknownError
|
|
90
|
+
};
|
|
@@ -32,7 +32,7 @@ var enMessages = {
|
|
|
32
32
|
"cli.bootstrap.description": "Install Fabric bootstrap prompts for supported AI clients.",
|
|
33
33
|
"cli.bootstrap.install.description": "Copy Fabric bootstrap templates into native client locations.",
|
|
34
34
|
"cli.bootstrap.install.args.clients.description": "Optional comma-separated client filter, for example claude,cursor,codex.",
|
|
35
|
-
"cli.bootstrap.install.no-targets": "No bootstrap targets detected. Pass --clients claude,cursor,
|
|
35
|
+
"cli.bootstrap.install.no-targets": "No bootstrap targets detected. Pass --clients claude,cursor,codex to install explicitly.",
|
|
36
36
|
"cli.bootstrap.install.installed": "Installed {path}",
|
|
37
37
|
"cli.bootstrap.install.skipped-header": "Skipped {path}: Fabric Bootstrap header already present.",
|
|
38
38
|
"cli.bootstrap.install.prepended": "Prepended {path}",
|
|
@@ -40,19 +40,23 @@ var enMessages = {
|
|
|
40
40
|
"cli.config.description": "Manage Fabric MCP client configuration.",
|
|
41
41
|
"cli.config.clients.claude": "Claude Code CLI",
|
|
42
42
|
"cli.config.install.description": "Install Fabric MCP server entries into detected client configs.",
|
|
43
|
-
"cli.config.install.args.clients.description": "Optional comma-separated client filter, for example cursor,codex
|
|
43
|
+
"cli.config.install.args.clients.description": "Optional comma-separated client filter, for example cursor,codex.",
|
|
44
44
|
"cli.config.install.args.dry-run.description": "Preview detected write operations without modifying files.",
|
|
45
|
-
"cli.config.errors.unknown-client": 'Unknown client "{client}". Use a comma-separated list such as cursor,codex
|
|
45
|
+
"cli.config.errors.unknown-client": 'Unknown client "{client}". Use a comma-separated list such as cursor,codex.',
|
|
46
46
|
"cli.config.errors.expected-object": "Expected object in {path}",
|
|
47
47
|
"cli.config.install.no-configs": "No Fabric MCP client config detected. Create the client directory or set clientPaths in fabric.config.json.",
|
|
48
48
|
"cli.config.install.no-config-path": "Skipping {client}: no config path detected.",
|
|
49
49
|
"cli.config.install.dry-run": "[dry-run] {client}: would write {path}",
|
|
50
50
|
"cli.config.install.wrote": "{client}: wrote {path}",
|
|
51
51
|
"cli.doctor.description": "Run Fabric target-state diagnostics.",
|
|
52
|
+
"doctor.section.fixable": "Fixable errors:",
|
|
53
|
+
"doctor.section.manual": "Manual errors:",
|
|
54
|
+
"doctor.section.warnings": "Warnings:",
|
|
52
55
|
"cli.doctor.args.target.description": "Target project path. Defaults to CLI arg, EXTERNAL_FIXTURE_PATH, fabric.config.json, then cwd.",
|
|
53
56
|
"cli.doctor.args.fix.description": "Repair deterministic derived Fabric state, including meta, rule-test index, bootstrap, and events ledger.",
|
|
54
57
|
"cli.doctor.args.json.description": "Print the doctor report as JSON.",
|
|
55
58
|
"cli.doctor.args.strict.description": "Treat warnings as failures.",
|
|
59
|
+
"cli.doctor.args.force.description": "Run even if a serve process appears to hold the lock.",
|
|
56
60
|
"cli.hooks.description": "Manage Fabric Git hook templates.",
|
|
57
61
|
"cli.hooks.install.description": "Install the Fabric Husky pre-commit hook template.",
|
|
58
62
|
"cli.hooks.install.args.target.description": "Target project path, default is the current working directory.",
|
|
@@ -85,6 +89,11 @@ var enMessages = {
|
|
|
85
89
|
"cli.init.mcp.install.invalid": 'Invalid --mcp-install value "{value}" \u2014 falling back to global',
|
|
86
90
|
"cli.init.mcp.local.installing": "Running {manager} add -D @fenglimg/fabric-server...",
|
|
87
91
|
"cli.init.mcp.local.installed": "Installed to devDependencies",
|
|
92
|
+
"cli.init.mcp.scope.description": "Claude MCP config scope: project (writes .mcp.json) or user (writes ~/.claude.json)",
|
|
93
|
+
"cli.init.mcp.scope.invalid": 'Invalid --scope value "{value}" \u2014 falling back to project',
|
|
94
|
+
"cli.init.mcp.scope.project": "Writes .mcp.json in project root (per Claude Code spec)",
|
|
95
|
+
"cli.init.mcp.scope.user": "Writes ~/.claude.json (user-scoped, applies to all projects)",
|
|
96
|
+
"cli.init.wizard.mcp-scope": "Claude MCP config scope (project/.mcp.json or user/~/.claude.json) [{defaultValue}]",
|
|
88
97
|
"cli.init.created-path": "{label} {path}",
|
|
89
98
|
"cli.init.skipped-existing-path": "{label} {path}: already exists.",
|
|
90
99
|
"cli.init.force.overwritten": "Overwritten",
|
|
@@ -156,9 +165,9 @@ var enMessages = {
|
|
|
156
165
|
"cli.init.capabilities.follow-up.install": "install client assets",
|
|
157
166
|
"cli.init.capabilities.follow-up.manual": "manual step required",
|
|
158
167
|
"cli.init.next-step.message": "run fab hooks install to add the Day 4 pre-commit pipeline.",
|
|
159
|
-
"cli.init.reason-message.claude-body": ".fabric/forensic.json is ready; use the
|
|
168
|
+
"cli.init.reason-message.claude-body": ".fabric/forensic.json is ready; use the fabric-init skill to finish internal Fabric initialization.",
|
|
160
169
|
"cli.init.reason-message.codex-body": ".fabric/forensic.json is ready; continue with the repo skill at .agents/skills/fabric-init/SKILL.md and enable features.codex_hooks = true for Codex hooks.",
|
|
161
|
-
"cli.init.reason-message.multi-body": ".fabric/forensic.json is ready; continue in your installed client flow: Claude can use
|
|
170
|
+
"cli.init.reason-message.multi-body": ".fabric/forensic.json is ready; continue in your installed client flow: Claude can use fabric-init, and Codex can use .agents/skills/fabric-init/SKILL.md with features.codex_hooks = true.",
|
|
162
171
|
"cli.init.reason-message.installable-body": ".fabric/forensic.json is ready; some detected clients support Fabric follow-up but still need client assets installed.",
|
|
163
172
|
"cli.init.reason-message.manual-body": ".fabric/forensic.json is ready; some detected clients still need manual follow-up because no Fabric skill is installed for them yet.",
|
|
164
173
|
"cli.init.codex-hooks.created": "{label} {path} with Codex hooks config (requires features.codex_hooks = true).",
|
|
@@ -208,6 +217,7 @@ var enMessages = {
|
|
|
208
217
|
"cli.serve.args.host.description": "Listen host, default 127.0.0.1. Set FABRIC_AUTH_TOKEN to enable Bearer auth for non-localhost binding.",
|
|
209
218
|
"cli.serve.args.target.description": "Target project path. Defaults to CLI arg, EXTERNAL_FIXTURE_PATH, fabric.config.json, then cwd.",
|
|
210
219
|
"cli.serve.args.debug.description": "Print target resolution details to stderr.",
|
|
220
|
+
"cli.serve.args.force.description": "Force-acquire the serve lock even if another serve process appears to be running.",
|
|
211
221
|
"cli.serve.ready.title": "Fabric Dashboard",
|
|
212
222
|
"cli.serve.warning.host-fallback": "--host {host} requires FABRIC_AUTH_TOKEN; falling back to 127.0.0.1 for safety",
|
|
213
223
|
"cli.serve.error.port-in-use": "Port {port} in use - try --port {nextPort}",
|
|
@@ -457,7 +467,7 @@ var zhCNMessages = {
|
|
|
457
467
|
"cli.bootstrap.description": "\u4E3A\u652F\u6301\u7684 AI \u5BA2\u6237\u7AEF\u5B89\u88C5 Fabric \u5F15\u5BFC\u63D0\u793A\u6A21\u677F\u3002",
|
|
458
468
|
"cli.bootstrap.install.description": "\u5C06 Fabric \u5F15\u5BFC\u6A21\u677F\u590D\u5236\u5230\u5404\u5BA2\u6237\u7AEF\u7684\u539F\u751F\u4F4D\u7F6E\u3002",
|
|
459
469
|
"cli.bootstrap.install.args.clients.description": "\u53EF\u9009\u7684\u9017\u53F7\u5206\u9694\u5BA2\u6237\u7AEF\u8FC7\u6EE4\u5668\uFF0C\u4F8B\u5982 claude,cursor,codex\u3002",
|
|
460
|
-
"cli.bootstrap.install.no-targets": "\u672A\u68C0\u6D4B\u5230\u53EF\u5B89\u88C5\u7684 bootstrap \u76EE\u6807\u3002\u53EF\u663E\u5F0F\u4F20\u5165 --clients claude,cursor,
|
|
470
|
+
"cli.bootstrap.install.no-targets": "\u672A\u68C0\u6D4B\u5230\u53EF\u5B89\u88C5\u7684 bootstrap \u76EE\u6807\u3002\u53EF\u663E\u5F0F\u4F20\u5165 --clients claude,cursor,codex\u3002",
|
|
461
471
|
"cli.bootstrap.install.installed": "\u5DF2\u5B89\u88C5 {path}",
|
|
462
472
|
"cli.bootstrap.install.skipped-header": "\u5DF2\u8DF3\u8FC7 {path}\uFF1AFabric Bootstrap \u5934\u90E8\u5DF2\u5B58\u5728\u3002",
|
|
463
473
|
"cli.bootstrap.install.prepended": "\u5DF2\u524D\u7F6E\u5199\u5165 {path}",
|
|
@@ -465,19 +475,23 @@ var zhCNMessages = {
|
|
|
465
475
|
"cli.config.description": "\u7BA1\u7406 Fabric MCP \u5BA2\u6237\u7AEF\u914D\u7F6E\u3002",
|
|
466
476
|
"cli.config.clients.claude": "Claude Code CLI",
|
|
467
477
|
"cli.config.install.description": "\u5C06 Fabric MCP \u670D\u52A1\u7AEF\u6761\u76EE\u5B89\u88C5\u5230\u68C0\u6D4B\u5230\u7684\u5BA2\u6237\u7AEF\u914D\u7F6E\u4E2D\u3002",
|
|
468
|
-
"cli.config.install.args.clients.description": "\u53EF\u9009\u7684\u9017\u53F7\u5206\u9694\u5BA2\u6237\u7AEF\u8FC7\u6EE4\u5668\uFF0C\u4F8B\u5982 cursor,codex
|
|
478
|
+
"cli.config.install.args.clients.description": "\u53EF\u9009\u7684\u9017\u53F7\u5206\u9694\u5BA2\u6237\u7AEF\u8FC7\u6EE4\u5668\uFF0C\u4F8B\u5982 cursor,codex\u3002",
|
|
469
479
|
"cli.config.install.args.dry-run.description": "\u4EC5\u9884\u89C8\u5C06\u8981\u53D1\u751F\u7684\u5199\u5165\u64CD\u4F5C\uFF0C\u4E0D\u4FEE\u6539\u6587\u4EF6\u3002",
|
|
470
|
-
"cli.config.errors.unknown-client": "\u672A\u77E5\u5BA2\u6237\u7AEF\u201C{client}\u201D\u3002\u8BF7\u4F7F\u7528\u9017\u53F7\u5206\u9694\u5217\u8868\uFF0C\u4F8B\u5982 cursor,codex
|
|
480
|
+
"cli.config.errors.unknown-client": "\u672A\u77E5\u5BA2\u6237\u7AEF\u201C{client}\u201D\u3002\u8BF7\u4F7F\u7528\u9017\u53F7\u5206\u9694\u5217\u8868\uFF0C\u4F8B\u5982 cursor,codex\u3002",
|
|
471
481
|
"cli.config.errors.expected-object": "{path} \u4E2D\u5E94\u4E3A\u5BF9\u8C61\u3002",
|
|
472
482
|
"cli.config.install.no-configs": "\u672A\u68C0\u6D4B\u5230 Fabric MCP \u5BA2\u6237\u7AEF\u914D\u7F6E\u3002\u8BF7\u521B\u5EFA\u5BA2\u6237\u7AEF\u76EE\u5F55\uFF0C\u6216\u5728 fabric.config.json \u4E2D\u8BBE\u7F6E clientPaths\u3002",
|
|
473
483
|
"cli.config.install.no-config-path": "\u8DF3\u8FC7 {client}\uFF1A\u672A\u68C0\u6D4B\u5230\u914D\u7F6E\u8DEF\u5F84\u3002",
|
|
474
484
|
"cli.config.install.dry-run": "[dry-run] {client}\uFF1A\u5C06\u5199\u5165 {path}",
|
|
475
485
|
"cli.config.install.wrote": "{client}\uFF1A\u5DF2\u5199\u5165 {path}",
|
|
476
486
|
"cli.doctor.description": "\u8FD0\u884C Fabric \u76EE\u6807\u6001\u8BCA\u65AD\u3002",
|
|
487
|
+
"doctor.section.fixable": "\u53EF\u4FEE\u590D\u9519\u8BEF\uFF1A",
|
|
488
|
+
"doctor.section.manual": "\u9700\u624B\u52A8\u4FEE\u590D\uFF1A",
|
|
489
|
+
"doctor.section.warnings": "\u8B66\u544A\uFF1A",
|
|
477
490
|
"cli.doctor.args.target.description": "\u76EE\u6807\u9879\u76EE\u8DEF\u5F84\u3002\u9ED8\u8BA4\u4F9D\u6B21\u4F7F\u7528 CLI \u53C2\u6570\u3001EXTERNAL_FIXTURE_PATH\u3001fabric.config.json\u3001\u5F53\u524D\u76EE\u5F55\u3002",
|
|
478
491
|
"cli.doctor.args.fix.description": "\u4FEE\u590D\u786E\u5B9A\u6027\u6D3E\u751F\u7684 Fabric \u72B6\u6001\uFF0C\u5305\u62EC meta\u3001rule-test index\u3001bootstrap \u548C events ledger\u3002",
|
|
479
492
|
"cli.doctor.args.json.description": "\u4EE5 JSON \u8F93\u51FA doctor \u62A5\u544A\u3002",
|
|
480
493
|
"cli.doctor.args.strict.description": "\u5C06 warning \u4E5F\u89C6\u4E3A\u5931\u8D25\u3002",
|
|
494
|
+
"cli.doctor.args.force.description": "\u5373\u4F7F serve \u8FDB\u7A0B\u6301\u6709\u9501\uFF0C\u4E5F\u5F3A\u5236\u8FD0\u884C\u3002",
|
|
481
495
|
"cli.hooks.description": "\u7BA1\u7406 Fabric Git \u94A9\u5B50\u6A21\u677F\u3002",
|
|
482
496
|
"cli.hooks.install.description": "\u5B89\u88C5 Fabric Husky pre-commit \u94A9\u5B50\u6A21\u677F\u3002",
|
|
483
497
|
"cli.hooks.install.args.target.description": "\u76EE\u6807\u9879\u76EE\u8DEF\u5F84\uFF0C\u9ED8\u8BA4\u4E3A\u5F53\u524D\u5DE5\u4F5C\u76EE\u5F55\u3002",
|
|
@@ -510,6 +524,11 @@ var zhCNMessages = {
|
|
|
510
524
|
"cli.init.mcp.install.invalid": "\u65E0\u6548\u7684 --mcp-install \u503C\u201C{value}\u201D\uFF0C\u5C06\u56DE\u9000\u5230 global",
|
|
511
525
|
"cli.init.mcp.local.installing": "\u6B63\u5728\u8FD0\u884C {manager} add -D @fenglimg/fabric-server...",
|
|
512
526
|
"cli.init.mcp.local.installed": "\u5DF2\u5B89\u88C5\u5230 devDependencies",
|
|
527
|
+
"cli.init.mcp.scope.description": "Claude MCP \u914D\u7F6E\u8303\u56F4\uFF1Aproject\uFF08\u5199\u5165 .mcp.json\uFF09\u6216 user\uFF08\u5199\u5165 ~/.claude.json\uFF09",
|
|
528
|
+
"cli.init.mcp.scope.invalid": "\u65E0\u6548\u7684 --scope \u503C\u201C{value}\u201D\uFF0C\u5C06\u56DE\u9000\u5230 project",
|
|
529
|
+
"cli.init.mcp.scope.project": "\u5199\u5165\u9879\u76EE\u6839\u76EE\u5F55\u7684 .mcp.json\uFF08\u7B26\u5408 Claude Code \u89C4\u8303\uFF09",
|
|
530
|
+
"cli.init.mcp.scope.user": "\u5199\u5165 ~/.claude.json\uFF08\u7528\u6237\u8303\u56F4\uFF0C\u9002\u7528\u4E8E\u6240\u6709\u9879\u76EE\uFF09",
|
|
531
|
+
"cli.init.wizard.mcp-scope": "Claude MCP \u914D\u7F6E\u8303\u56F4\uFF08project/.mcp.json \u6216 user/~/.claude.json\uFF09[{defaultValue}]",
|
|
513
532
|
"cli.init.created-path": "{label} {path}",
|
|
514
533
|
"cli.init.skipped-existing-path": "{label} {path}\uFF1A\u5DF2\u5B58\u5728\u3002",
|
|
515
534
|
"cli.init.force.overwritten": "\u5DF2\u8986\u76D6",
|
|
@@ -581,9 +600,9 @@ var zhCNMessages = {
|
|
|
581
600
|
"cli.init.capabilities.follow-up.install": "\u5B89\u88C5\u5BA2\u6237\u7AEF\u8D44\u4EA7",
|
|
582
601
|
"cli.init.capabilities.follow-up.manual": "\u9700\u8981\u624B\u52A8\u540E\u7EED\u5904\u7406",
|
|
583
602
|
"cli.init.next-step.message": "\u8FD0\u884C fab hooks install \u4EE5\u6DFB\u52A0\u7B2C 4 \u5929\u7684 pre-commit \u6D41\u6C34\u7EBF\u3002",
|
|
584
|
-
"cli.init.reason-message.claude-body": ".fabric/forensic.json \u5DF2\u5C31\u7EEA\uFF1B\u8BF7\u4F7F\u7528
|
|
603
|
+
"cli.init.reason-message.claude-body": ".fabric/forensic.json \u5DF2\u5C31\u7EEA\uFF1B\u8BF7\u4F7F\u7528 fabric-init skill \u5B8C\u6210 Fabric \u5185\u90E8\u521D\u59CB\u5316\u3002",
|
|
585
604
|
"cli.init.reason-message.codex-body": ".fabric/forensic.json \u5DF2\u5C31\u7EEA\uFF1B\u8BF7\u7EE7\u7EED\u4F7F\u7528\u4ED3\u5E93\u5185\u7684 .agents/skills/fabric-init/SKILL.md\uFF0C\u5E76\u4E3A Codex hooks \u542F\u7528 features.codex_hooks = true\u3002",
|
|
586
|
-
"cli.init.reason-message.multi-body": ".fabric/forensic.json \u5DF2\u5C31\u7EEA\uFF1B\u8BF7\u6309\u5DF2\u5B89\u88C5\u5BA2\u6237\u7AEF\u7EE7\u7EED\u540E\u7EED\u6D41\u7A0B\uFF1AClaude \u4F7F\u7528
|
|
605
|
+
"cli.init.reason-message.multi-body": ".fabric/forensic.json \u5DF2\u5C31\u7EEA\uFF1B\u8BF7\u6309\u5DF2\u5B89\u88C5\u5BA2\u6237\u7AEF\u7EE7\u7EED\u540E\u7EED\u6D41\u7A0B\uFF1AClaude \u4F7F\u7528 fabric-init\uFF0CCodex \u4F7F\u7528 .agents/skills/fabric-init/SKILL.md\uFF0C\u5E76\u542F\u7528 features.codex_hooks = true\u3002",
|
|
587
606
|
"cli.init.reason-message.installable-body": ".fabric/forensic.json \u5DF2\u5C31\u7EEA\uFF1B\u90E8\u5206\u5DF2\u68C0\u6D4B\u5230\u7684\u5BA2\u6237\u7AEF\u5DF2\u652F\u6301 Fabric \u540E\u7EED\u63A5\u529B\uFF0C\u4F46\u4ECD\u9700\u5B89\u88C5\u5BA2\u6237\u7AEF\u8D44\u4EA7\u3002",
|
|
588
607
|
"cli.init.reason-message.manual-body": ".fabric/forensic.json \u5DF2\u5C31\u7EEA\uFF1B\u90E8\u5206\u5DF2\u68C0\u6D4B\u5230\u7684\u5BA2\u6237\u7AEF\u5C1A\u672A\u5B89\u88C5 Fabric skill\uFF0C\u9700\u8981\u624B\u52A8\u5B8C\u6210\u540E\u7EED\u521D\u59CB\u5316\u3002",
|
|
589
608
|
"cli.init.codex-hooks.created": "{label} {path}\uFF0C\u5E76\u5199\u5165 Codex hooks \u914D\u7F6E\uFF08\u9700\u542F\u7528 features.codex_hooks = true\uFF09\u3002",
|
|
@@ -633,6 +652,7 @@ var zhCNMessages = {
|
|
|
633
652
|
"cli.serve.args.host.description": "\u76D1\u542C\u4E3B\u673A\uFF0C\u9ED8\u8BA4 127.0.0.1\u3002\u82E5\u9700\u7ED1\u5B9A\u5230\u975E localhost\uFF0C\u8BF7\u8BBE\u7F6E FABRIC_AUTH_TOKEN \u4EE5\u542F\u7528 Bearer \u9274\u6743\u3002",
|
|
634
653
|
"cli.serve.args.target.description": "\u76EE\u6807\u9879\u76EE\u8DEF\u5F84\u3002\u9ED8\u8BA4\u4F9D\u6B21\u4F7F\u7528 CLI \u53C2\u6570\u3001EXTERNAL_FIXTURE_PATH\u3001fabric.config.json\u3001\u5F53\u524D\u76EE\u5F55\u3002",
|
|
635
654
|
"cli.serve.args.debug.description": "\u5C06\u76EE\u6807\u89E3\u6790\u7EC6\u8282\u8F93\u51FA\u5230 stderr\u3002",
|
|
655
|
+
"cli.serve.args.force.description": "\u5373\u4F7F\u53E6\u4E00\u4E2A serve \u8FDB\u7A0B\u6B63\u5728\u8FD0\u884C\uFF0C\u4E5F\u5F3A\u5236\u83B7\u53D6 serve \u9501\u3002",
|
|
636
656
|
"cli.serve.ready.title": "Fabric \u4EEA\u8868\u76D8",
|
|
637
657
|
"cli.serve.warning.host-fallback": "--host {host} \u9700\u8981 FABRIC_AUTH_TOKEN\uFF1B\u4E3A\u5B89\u5168\u8D77\u89C1\u5DF2\u56DE\u9000\u5230 127.0.0.1",
|
|
638
658
|
"cli.serve.error.port-in-use": "\u7AEF\u53E3 {port} \u5DF2\u88AB\u5360\u7528\uFF0C\u53EF\u5C1D\u8BD5 --port {nextPort}",
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// src/detector.ts
|
|
2
|
+
import { existsSync, readFileSync } from "fs";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
function detectFramework(root) {
|
|
5
|
+
const evidence = [];
|
|
6
|
+
const creatorConfigPath = join(root, "project.config.json");
|
|
7
|
+
if (existsSync(creatorConfigPath)) {
|
|
8
|
+
const version = readCreatorVersion(creatorConfigPath);
|
|
9
|
+
return {
|
|
10
|
+
kind: "cocos-creator",
|
|
11
|
+
version,
|
|
12
|
+
subkind: inferCocosSubkind(root, version),
|
|
13
|
+
evidence: version === "unknown" ? ["project.config.json"] : [`project.config.json: creator.version=${version}`],
|
|
14
|
+
framework: "cocos-creator",
|
|
15
|
+
confidence: "HIGH",
|
|
16
|
+
ast_evidence: [],
|
|
17
|
+
co_packages: collectProjectFileEvidence(root, ["package.json", "tsconfig.json"])
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const packageJsonPath = join(root, "package.json");
|
|
21
|
+
if (existsSync(packageJsonPath)) {
|
|
22
|
+
const packageJson = readPackageJson(packageJsonPath);
|
|
23
|
+
const creatorVersion = packageJson.creator?.version;
|
|
24
|
+
if (typeof creatorVersion === "string" && creatorVersion.trim().length > 0) {
|
|
25
|
+
const deps2 = collectDependencyVersions(packageJson);
|
|
26
|
+
return {
|
|
27
|
+
kind: "cocos-creator",
|
|
28
|
+
version: creatorVersion,
|
|
29
|
+
subkind: inferCocosSubkind(root, creatorVersion),
|
|
30
|
+
evidence: [`package.json: creator.version=${creatorVersion}`],
|
|
31
|
+
framework: "cocos-creator",
|
|
32
|
+
confidence: "HIGH",
|
|
33
|
+
ast_evidence: [],
|
|
34
|
+
co_packages: collectCoPackages(deps2, "cocos-creator", root)
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const deps = collectDependencyVersions(packageJson);
|
|
38
|
+
for (const [dependencyName, kind] of [
|
|
39
|
+
["next", "next"],
|
|
40
|
+
["vite", "vite"],
|
|
41
|
+
["react", "react"],
|
|
42
|
+
["vue", "vue"]
|
|
43
|
+
]) {
|
|
44
|
+
if (deps.has(dependencyName)) {
|
|
45
|
+
const version = deps.get(dependencyName) ?? "unknown";
|
|
46
|
+
evidence.push(`package.json dependency: ${dependencyName}@${version}`);
|
|
47
|
+
return {
|
|
48
|
+
kind,
|
|
49
|
+
version,
|
|
50
|
+
subkind: inferPackageSubkind(kind),
|
|
51
|
+
evidence,
|
|
52
|
+
framework: kind,
|
|
53
|
+
confidence: determinePackageConfidence(kind, deps, root),
|
|
54
|
+
ast_evidence: [],
|
|
55
|
+
co_packages: collectCoPackages(deps, kind, root)
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
evidence.push("package.json");
|
|
60
|
+
}
|
|
61
|
+
if (existsSync(join(root, "Cargo.toml"))) {
|
|
62
|
+
return {
|
|
63
|
+
kind: "rust",
|
|
64
|
+
version: "unknown",
|
|
65
|
+
subkind: "cargo-project",
|
|
66
|
+
evidence: ["Cargo.toml"],
|
|
67
|
+
framework: "rust",
|
|
68
|
+
confidence: "HIGH",
|
|
69
|
+
ast_evidence: [],
|
|
70
|
+
co_packages: collectProjectFileEvidence(root, ["Cargo.lock"])
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
if (existsSync(join(root, "pyproject.toml"))) {
|
|
74
|
+
return {
|
|
75
|
+
kind: "python",
|
|
76
|
+
version: "unknown",
|
|
77
|
+
subkind: "pyproject",
|
|
78
|
+
evidence: ["pyproject.toml"],
|
|
79
|
+
framework: "python",
|
|
80
|
+
confidence: "HIGH",
|
|
81
|
+
ast_evidence: [],
|
|
82
|
+
co_packages: collectProjectFileEvidence(root, ["uv.lock", "poetry.lock", "requirements.txt"])
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
kind: "unknown",
|
|
87
|
+
version: "unknown",
|
|
88
|
+
subkind: "unknown",
|
|
89
|
+
evidence,
|
|
90
|
+
framework: "unknown",
|
|
91
|
+
confidence: "LOW",
|
|
92
|
+
ast_evidence: [],
|
|
93
|
+
co_packages: []
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function readPackageJson(packageJsonPath) {
|
|
97
|
+
try {
|
|
98
|
+
return JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
99
|
+
} catch {
|
|
100
|
+
return {};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function readCreatorVersion(creatorConfigPath) {
|
|
104
|
+
try {
|
|
105
|
+
const creatorConfig = JSON.parse(readFileSync(creatorConfigPath, "utf8"));
|
|
106
|
+
return creatorConfig.creator?.version ?? "unknown";
|
|
107
|
+
} catch {
|
|
108
|
+
return "unknown";
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function collectDependencyVersions(packageJson) {
|
|
112
|
+
return new Map([
|
|
113
|
+
...Object.entries(packageJson.dependencies ?? {}),
|
|
114
|
+
...Object.entries(packageJson.devDependencies ?? {}),
|
|
115
|
+
...Object.entries(packageJson.peerDependencies ?? {}),
|
|
116
|
+
...Object.entries(packageJson.optionalDependencies ?? {})
|
|
117
|
+
]);
|
|
118
|
+
}
|
|
119
|
+
function inferCocosSubkind(root, version) {
|
|
120
|
+
const majorVersion = Number.parseInt(version.split(".")[0] ?? "", 10);
|
|
121
|
+
if (majorVersion === 2) {
|
|
122
|
+
return "javascript-traditional";
|
|
123
|
+
}
|
|
124
|
+
if (majorVersion >= 3) {
|
|
125
|
+
return "typescript-component";
|
|
126
|
+
}
|
|
127
|
+
return existsSync(join(root, "tsconfig.json")) ? "typescript-component" : "javascript-traditional";
|
|
128
|
+
}
|
|
129
|
+
function inferPackageSubkind(kind) {
|
|
130
|
+
switch (kind) {
|
|
131
|
+
case "next":
|
|
132
|
+
return "next-application";
|
|
133
|
+
case "vite":
|
|
134
|
+
return "vite-application";
|
|
135
|
+
case "react":
|
|
136
|
+
return "react-application";
|
|
137
|
+
case "vue":
|
|
138
|
+
return "vue-application";
|
|
139
|
+
default:
|
|
140
|
+
return "unknown";
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function determinePackageConfidence(kind, deps, root) {
|
|
144
|
+
const coPackages = collectCoPackages(deps, kind, root);
|
|
145
|
+
return coPackages.length > 0 ? "HIGH" : "MEDIUM";
|
|
146
|
+
}
|
|
147
|
+
function collectCoPackages(deps, kind, root) {
|
|
148
|
+
const expectedPackagesByFramework = {
|
|
149
|
+
next: ["react", "react-dom", "typescript"],
|
|
150
|
+
vite: ["@vitejs/plugin-react", "@vitejs/plugin-vue", "typescript", "react", "vue"],
|
|
151
|
+
react: ["react-dom", "@types/react", "@types/react-dom"],
|
|
152
|
+
vue: ["@vitejs/plugin-vue", "typescript"],
|
|
153
|
+
"cocos-creator": ["typescript"]
|
|
154
|
+
};
|
|
155
|
+
const expectedProjectFilesByFramework = {
|
|
156
|
+
next: ["next.config.js", "next.config.mjs", "next.config.ts", "tsconfig.json"],
|
|
157
|
+
vite: ["vite.config.js", "vite.config.mjs", "vite.config.ts", "tsconfig.json"],
|
|
158
|
+
react: ["tsconfig.json"],
|
|
159
|
+
vue: ["vue.config.js", "vite.config.ts", "tsconfig.json"],
|
|
160
|
+
"cocos-creator": ["project.config.json", "tsconfig.json"]
|
|
161
|
+
};
|
|
162
|
+
return [
|
|
163
|
+
...compactStrings((expectedPackagesByFramework[kind] ?? []).map((packageName) => deps.has(packageName) ? packageName : null)),
|
|
164
|
+
...collectProjectFileEvidence(root, expectedProjectFilesByFramework[kind] ?? [])
|
|
165
|
+
];
|
|
166
|
+
}
|
|
167
|
+
function collectProjectFileEvidence(root, relativePaths) {
|
|
168
|
+
return relativePaths.filter((relativePath) => existsSync(join(root, relativePath)));
|
|
169
|
+
}
|
|
170
|
+
function compactStrings(values) {
|
|
171
|
+
return [...new Set(values.filter((value) => value !== null && value !== void 0 && value.length > 0))];
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export {
|
|
175
|
+
detectFramework
|
|
176
|
+
};
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
// src/schemas/api-contracts.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var structuredWarningSchema = z.object({
|
|
4
|
+
code: z.string(),
|
|
5
|
+
file: z.string(),
|
|
6
|
+
line: z.number().optional(),
|
|
7
|
+
action_hint: z.string()
|
|
8
|
+
});
|
|
9
|
+
var _ruleDescriptionSchema = z.object({
|
|
10
|
+
summary: z.string(),
|
|
11
|
+
intent_clues: z.array(z.string()),
|
|
12
|
+
tech_stack: z.array(z.string()),
|
|
13
|
+
impact: z.array(z.string()),
|
|
14
|
+
must_read_if: z.string(),
|
|
15
|
+
entities: z.array(z.string()).optional()
|
|
16
|
+
});
|
|
17
|
+
var _descriptionIndexItemSchema = z.object({
|
|
18
|
+
stable_id: z.string(),
|
|
19
|
+
level: z.enum(["L0", "L1", "L2"]),
|
|
20
|
+
required: z.boolean(),
|
|
21
|
+
selectable: z.boolean(),
|
|
22
|
+
description: _ruleDescriptionSchema
|
|
23
|
+
});
|
|
24
|
+
var _requirementProfileSchema = z.object({
|
|
25
|
+
target_path: z.string(),
|
|
26
|
+
path_segments: z.array(z.string()),
|
|
27
|
+
extension: z.string(),
|
|
28
|
+
inferred_domain: z.array(z.string()),
|
|
29
|
+
known_tech: z.array(z.string()),
|
|
30
|
+
user_intent: z.string(),
|
|
31
|
+
intent_tokens: z.array(z.string()),
|
|
32
|
+
impact_hints: z.array(z.string()),
|
|
33
|
+
detected_entities: z.array(z.string())
|
|
34
|
+
});
|
|
35
|
+
var _selectionPolicySchema = z.object({
|
|
36
|
+
required_levels: z.tuple([z.literal("L0"), z.literal("L2")]),
|
|
37
|
+
ai_selectable_levels: z.tuple([z.literal("L1")]),
|
|
38
|
+
final_fetch_rule: z.literal("required_stable_ids + ai_selected_l1_stable_ids")
|
|
39
|
+
});
|
|
40
|
+
var planContextInputSchema = z.object({
|
|
41
|
+
paths: z.array(z.string()).min(1).describe("Candidate file paths to build neutral rule selection context for"),
|
|
42
|
+
intent: z.string().optional().describe("User-stated requirement or implementation intent; used only to build a neutral requirement profile"),
|
|
43
|
+
known_tech: z.array(z.string()).optional().describe("Known technologies involved in the requirement profile"),
|
|
44
|
+
detected_entities: z.record(z.array(z.string())).optional().describe("Optional path-keyed detected entities for the requirement profile"),
|
|
45
|
+
client_hash: z.string().optional().describe("Revision hash from a prior fab_plan_context response; enables stale detection"),
|
|
46
|
+
correlation_id: z.string().optional().describe("Optional caller-provided correlation id for Event Ledger records"),
|
|
47
|
+
session_id: z.string().optional().describe("Optional caller-provided session id for Event Ledger records")
|
|
48
|
+
});
|
|
49
|
+
var planContextOutputSchema = z.object({
|
|
50
|
+
revision_hash: z.string(),
|
|
51
|
+
stale: z.boolean(),
|
|
52
|
+
selection_token: z.string(),
|
|
53
|
+
entries: z.array(
|
|
54
|
+
z.object({
|
|
55
|
+
path: z.string(),
|
|
56
|
+
requirement_profile: _requirementProfileSchema,
|
|
57
|
+
description_index: z.array(_descriptionIndexItemSchema),
|
|
58
|
+
required_stable_ids: z.array(z.string()),
|
|
59
|
+
ai_selectable_stable_ids: z.array(z.string()),
|
|
60
|
+
initial_selected_stable_ids: z.array(z.string()),
|
|
61
|
+
selection_policy: _selectionPolicySchema
|
|
62
|
+
})
|
|
63
|
+
),
|
|
64
|
+
shared: z.object({
|
|
65
|
+
required_stable_ids: z.array(z.string()),
|
|
66
|
+
ai_selectable_stable_ids: z.array(z.string()),
|
|
67
|
+
description_index: z.array(_descriptionIndexItemSchema),
|
|
68
|
+
preflight_diagnostics: z.array(
|
|
69
|
+
z.object({
|
|
70
|
+
code: z.literal("missing_description"),
|
|
71
|
+
severity: z.literal("warn"),
|
|
72
|
+
message: z.string(),
|
|
73
|
+
stable_ids: z.array(z.string()).optional(),
|
|
74
|
+
path: z.string().optional()
|
|
75
|
+
})
|
|
76
|
+
)
|
|
77
|
+
}),
|
|
78
|
+
warnings: z.array(structuredWarningSchema).optional()
|
|
79
|
+
});
|
|
80
|
+
var planContextAnnotations = {
|
|
81
|
+
readOnlyHint: true,
|
|
82
|
+
idempotentHint: true,
|
|
83
|
+
destructiveHint: false,
|
|
84
|
+
openWorldHint: false,
|
|
85
|
+
title: "Plan rule context"
|
|
86
|
+
};
|
|
87
|
+
var _rulesEntrySchema = z.object({ path: z.string(), content: z.string() });
|
|
88
|
+
var _humanLockedSchema = z.object({ file: z.string(), excerpt: z.string() });
|
|
89
|
+
var _descriptionStubSchema = z.object({ path: z.string(), description: z.string() });
|
|
90
|
+
var getRulesInputSchema = z.object({
|
|
91
|
+
path: z.string().describe("Target file path to query rules for"),
|
|
92
|
+
client_hash: z.string().optional().describe("Revision hash from prior fab_get_rules response; enables stale detection"),
|
|
93
|
+
correlation_id: z.string().optional().describe("Optional caller-provided correlation id for Event Ledger records"),
|
|
94
|
+
session_id: z.string().optional().describe("Optional caller-provided session id for Event Ledger records")
|
|
95
|
+
});
|
|
96
|
+
var getRulesOutputSchema = z.object({
|
|
97
|
+
revision_hash: z.string(),
|
|
98
|
+
stale: z.boolean(),
|
|
99
|
+
rules: z.object({
|
|
100
|
+
L0: z.string(),
|
|
101
|
+
L1: z.array(_rulesEntrySchema),
|
|
102
|
+
L2: z.array(_rulesEntrySchema),
|
|
103
|
+
human_locked_nearby: z.array(_humanLockedSchema),
|
|
104
|
+
description_stubs: z.array(_descriptionStubSchema).optional()
|
|
105
|
+
}),
|
|
106
|
+
warnings: z.array(structuredWarningSchema).optional()
|
|
107
|
+
});
|
|
108
|
+
var getRulesAnnotations = {
|
|
109
|
+
readOnlyHint: true,
|
|
110
|
+
idempotentHint: true,
|
|
111
|
+
destructiveHint: false,
|
|
112
|
+
openWorldHint: false,
|
|
113
|
+
title: "Get rule content"
|
|
114
|
+
};
|
|
115
|
+
var RULE_SECTION_NAMES_TUPLE = ["MISSION_STATEMENT", "MANDATORY_INJECTION", "BUSINESS_LOGIC_CHUNKS", "CONTEXT_INFO"];
|
|
116
|
+
var ruleSectionsInputSchema = z.object({
|
|
117
|
+
selection_token: z.string().min(1).describe("Selection token returned by fab_plan_context"),
|
|
118
|
+
sections: z.array(z.enum(RULE_SECTION_NAMES_TUPLE)).min(1).describe("Structured rule sections to fetch"),
|
|
119
|
+
ai_selected_stable_ids: z.array(z.string()).describe("AI-selected L1 stable_ids chosen from fab_plan_context ai_selectable_stable_ids"),
|
|
120
|
+
ai_selection_reasons: z.record(z.string().min(1)).describe("Reason for each AI-selected L1 stable_id"),
|
|
121
|
+
correlation_id: z.string().optional().describe("Optional caller-provided correlation id for Event Ledger records"),
|
|
122
|
+
session_id: z.string().optional().describe("Optional caller-provided session id for Event Ledger records")
|
|
123
|
+
});
|
|
124
|
+
var ruleSectionsOutputSchema = z.object({
|
|
125
|
+
revision_hash: z.string(),
|
|
126
|
+
precedence: z.tuple([z.literal("L2"), z.literal("L1"), z.literal("L0")]),
|
|
127
|
+
selected_stable_ids: z.array(z.string()),
|
|
128
|
+
rules: z.array(
|
|
129
|
+
z.object({
|
|
130
|
+
stable_id: z.string(),
|
|
131
|
+
level: z.enum(["L0", "L1", "L2"]),
|
|
132
|
+
path: z.string(),
|
|
133
|
+
sections: z.record(z.string())
|
|
134
|
+
})
|
|
135
|
+
),
|
|
136
|
+
diagnostics: z.array(
|
|
137
|
+
z.object({
|
|
138
|
+
code: z.literal("missing_section"),
|
|
139
|
+
severity: z.literal("warn"),
|
|
140
|
+
stable_id: z.string(),
|
|
141
|
+
section: z.enum(RULE_SECTION_NAMES_TUPLE),
|
|
142
|
+
message: z.string()
|
|
143
|
+
})
|
|
144
|
+
),
|
|
145
|
+
warnings: z.array(structuredWarningSchema).optional()
|
|
146
|
+
});
|
|
147
|
+
var ruleSectionsAnnotations = {
|
|
148
|
+
readOnlyHint: true,
|
|
149
|
+
idempotentHint: true,
|
|
150
|
+
destructiveHint: false,
|
|
151
|
+
openWorldHint: false,
|
|
152
|
+
title: "Filter rule sections"
|
|
153
|
+
};
|
|
154
|
+
var ledgerSourceSchema = z.enum(["ai", "human"]);
|
|
155
|
+
var timestampFilterSchema = z.preprocess((value) => {
|
|
156
|
+
if (value === void 0 || value === null || value === "") {
|
|
157
|
+
return void 0;
|
|
158
|
+
}
|
|
159
|
+
if (typeof value === "number") {
|
|
160
|
+
return value;
|
|
161
|
+
}
|
|
162
|
+
if (typeof value === "string") {
|
|
163
|
+
const trimmed = value.trim();
|
|
164
|
+
if (trimmed.length === 0) {
|
|
165
|
+
return void 0;
|
|
166
|
+
}
|
|
167
|
+
if (/^\d+$/.test(trimmed)) {
|
|
168
|
+
return Number.parseInt(trimmed, 10);
|
|
169
|
+
}
|
|
170
|
+
const parsed = Date.parse(trimmed);
|
|
171
|
+
return Number.isNaN(parsed) ? value : parsed;
|
|
172
|
+
}
|
|
173
|
+
return value;
|
|
174
|
+
}, z.number().int().nonnegative());
|
|
175
|
+
var ledgerQuerySchema = z.object({
|
|
176
|
+
source: ledgerSourceSchema.optional(),
|
|
177
|
+
since: timestampFilterSchema.optional()
|
|
178
|
+
});
|
|
179
|
+
var historyStateQuerySchema = z.object({
|
|
180
|
+
ledger_id: z.string().trim().min(1).optional(),
|
|
181
|
+
ts: timestampFilterSchema.optional()
|
|
182
|
+
}).superRefine((value, ctx) => {
|
|
183
|
+
const provided = [value.ledger_id, value.ts].filter((entry) => entry !== void 0);
|
|
184
|
+
if (provided.length !== 1) {
|
|
185
|
+
ctx.addIssue({
|
|
186
|
+
code: z.ZodIssueCode.custom,
|
|
187
|
+
message: "Provide exactly one of ledger_id or ts.",
|
|
188
|
+
path: ["ledger_id"]
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
var humanLockApproveRequestSchema = z.object({
|
|
193
|
+
file: z.string().min(1),
|
|
194
|
+
start_line: z.number().int().positive(),
|
|
195
|
+
end_line: z.number().int().positive(),
|
|
196
|
+
new_hash: z.string().min(1)
|
|
197
|
+
});
|
|
198
|
+
var humanLockFileParamsSchema = z.object({
|
|
199
|
+
file: z.string().min(1)
|
|
200
|
+
});
|
|
201
|
+
var annotateIntentRequestSchema = z.object({
|
|
202
|
+
ledger_entry_id: z.string().min(1),
|
|
203
|
+
annotation: z.string().trim().min(1)
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
export {
|
|
207
|
+
structuredWarningSchema,
|
|
208
|
+
planContextInputSchema,
|
|
209
|
+
planContextOutputSchema,
|
|
210
|
+
planContextAnnotations,
|
|
211
|
+
getRulesInputSchema,
|
|
212
|
+
getRulesOutputSchema,
|
|
213
|
+
getRulesAnnotations,
|
|
214
|
+
ruleSectionsInputSchema,
|
|
215
|
+
ruleSectionsOutputSchema,
|
|
216
|
+
ruleSectionsAnnotations,
|
|
217
|
+
ledgerSourceSchema,
|
|
218
|
+
ledgerQuerySchema,
|
|
219
|
+
historyStateQuerySchema,
|
|
220
|
+
humanLockApproveRequestSchema,
|
|
221
|
+
humanLockFileParamsSchema,
|
|
222
|
+
annotateIntentRequestSchema
|
|
223
|
+
};
|