@keel_flow/core 0.2.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 +15 -0
- package/dist/agent.d.ts +15 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +9 -0
- package/dist/agent.js.map +1 -0
- package/dist/architecture.d.ts +10 -0
- package/dist/architecture.d.ts.map +1 -0
- package/dist/architecture.js +23 -0
- package/dist/architecture.js.map +1 -0
- package/dist/command-rules.d.ts +20 -0
- package/dist/command-rules.d.ts.map +1 -0
- package/dist/command-rules.js +52 -0
- package/dist/command-rules.js.map +1 -0
- package/dist/corpus/fixtures.d.ts +13 -0
- package/dist/corpus/fixtures.d.ts.map +1 -0
- package/dist/corpus/fixtures.js +208 -0
- package/dist/corpus/fixtures.js.map +1 -0
- package/dist/corpus/run.d.ts +12 -0
- package/dist/corpus/run.d.ts.map +1 -0
- package/dist/corpus/run.js +45 -0
- package/dist/corpus/run.js.map +1 -0
- package/dist/corpus/score.d.ts +6 -0
- package/dist/corpus/score.d.ts.map +1 -0
- package/dist/corpus/score.js +19 -0
- package/dist/corpus/score.js.map +1 -0
- package/dist/diff.d.ts +17 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +61 -0
- package/dist/diff.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/knowledge-base.d.ts +25 -0
- package/dist/knowledge-base.d.ts.map +1 -0
- package/dist/knowledge-base.js +7 -0
- package/dist/knowledge-base.js.map +1 -0
- package/dist/principles.d.ts +11 -0
- package/dist/principles.d.ts.map +1 -0
- package/dist/principles.js +26 -0
- package/dist/principles.js.map +1 -0
- package/dist/seam-contracts.d.ts +3 -0
- package/dist/seam-contracts.d.ts.map +1 -0
- package/dist/seam-contracts.js +63 -0
- package/dist/seam-contracts.js.map +1 -0
- package/dist/tool.d.ts +13 -0
- package/dist/tool.d.ts.map +1 -0
- package/dist/tool.js +10 -0
- package/dist/tool.js.map +1 -0
- package/dist/verify.d.ts +41 -0
- package/dist/verify.d.ts.map +1 -0
- package/dist/verify.js +196 -0
- package/dist/verify.js.map +1 -0
- package/package.json +39 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 jglasskatz
|
|
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
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# @keel_flow/core
|
|
2
|
+
|
|
3
|
+
Framework primitives: architecture registry (`createArchitecture`), principle registry (`createPrincipleRegistry`), agent and tool definitions (`defineAgent`, `defineTool`), knowledge-base interface (`defineKnowledgeBase`), git diff parser (`parseDiff`), the four-check verify gate (`verify`), and the built-in seam-contracts principle (`seamContractsPrinciple`).
|
|
4
|
+
|
|
5
|
+
Part of the [Keel](https://github.com/jglasskatz/keel) framework.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
npm install @keel_flow/core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## License
|
|
14
|
+
|
|
15
|
+
MIT
|
package/dist/agent.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ZodType } from "zod";
|
|
2
|
+
export interface AgentConfig {
|
|
3
|
+
id: string;
|
|
4
|
+
description: string;
|
|
5
|
+
tools: string[];
|
|
6
|
+
prompt: string;
|
|
7
|
+
model?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface Agent {
|
|
10
|
+
config: AgentConfig;
|
|
11
|
+
invoke(): never;
|
|
12
|
+
}
|
|
13
|
+
export declare function defineAgent(config: AgentConfig): Agent;
|
|
14
|
+
export type { ZodType };
|
|
15
|
+
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEnC,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,IAAI,KAAK,CAAC;CACjB;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,KAAK,CAStD;AAED,YAAY,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/agent.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAeA,MAAM,UAAU,WAAW,CAAC,MAAmB;IAC7C,OAAO;QACL,MAAM;QACN,MAAM;YACJ,MAAM,IAAI,KAAK,CACb,uEAAuE,CACxE,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ArchitectureMap, ArchitectureNode, Connection } from "@keel_flow/schema";
|
|
2
|
+
export interface ArchitectureRegistry {
|
|
3
|
+
findNode(id: string): ArchitectureNode | undefined;
|
|
4
|
+
connectionsFrom(id: string): Connection[];
|
|
5
|
+
connectionsTo(id: string): Connection[];
|
|
6
|
+
nodesInContext(ctxId: string): ArchitectureNode[];
|
|
7
|
+
map: ArchitectureMap;
|
|
8
|
+
}
|
|
9
|
+
export declare function createArchitecture(input: unknown): ArchitectureRegistry;
|
|
10
|
+
//# sourceMappingURL=architecture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"architecture.d.ts","sourceRoot":"","sources":["../src/architecture.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEvF,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAAC;IACnD,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,EAAE,CAAC;IAC1C,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,EAAE,CAAC;IACxC,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAAC;IAClD,GAAG,EAAE,eAAe,CAAC;CACtB;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,CAoBvE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ArchitectureMapSchema } from "@keel_flow/schema";
|
|
2
|
+
export function createArchitecture(input) {
|
|
3
|
+
const map = ArchitectureMapSchema.parse(input);
|
|
4
|
+
return {
|
|
5
|
+
map,
|
|
6
|
+
findNode(id) {
|
|
7
|
+
return map.nodes.find((n) => n.id === id);
|
|
8
|
+
},
|
|
9
|
+
connectionsFrom(id) {
|
|
10
|
+
return map.connections.filter((c) => c.from === id);
|
|
11
|
+
},
|
|
12
|
+
connectionsTo(id) {
|
|
13
|
+
return map.connections.filter((c) => c.to === id);
|
|
14
|
+
},
|
|
15
|
+
nodesInContext(ctxId) {
|
|
16
|
+
const ctx = map.contexts.find((c) => c.id === ctxId);
|
|
17
|
+
if (!ctx)
|
|
18
|
+
return [];
|
|
19
|
+
return map.nodes.filter((n) => ctx.nodeIds.includes(n.id));
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=architecture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"architecture.js","sourceRoot":"","sources":["../src/architecture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAW1D,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,MAAM,GAAG,GAAG,qBAAqB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAE/C,OAAO;QACL,GAAG;QACH,QAAQ,CAAC,EAAU;YACjB,OAAO,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QAC5C,CAAC;QACD,eAAe,CAAC,EAAU;YACxB,OAAO,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;QACtD,CAAC;QACD,aAAa,CAAC,EAAU;YACtB,OAAO,GAAG,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;QACpD,CAAC;QACD,cAAc,CAAC,KAAa;YAC1B,MAAM,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC;YACrD,IAAI,CAAC,GAAG;gBAAE,OAAO,EAAE,CAAC;YACpB,OAAO,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC7D,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export type RuleDecision = "forbidden" | "discouraged";
|
|
2
|
+
export interface PrefixRule {
|
|
3
|
+
pattern: string[][];
|
|
4
|
+
decision: RuleDecision;
|
|
5
|
+
justification: string;
|
|
6
|
+
}
|
|
7
|
+
export interface CommandRuleSet {
|
|
8
|
+
rules: PrefixRule[];
|
|
9
|
+
}
|
|
10
|
+
export interface RuleVerdict {
|
|
11
|
+
decision: RuleDecision;
|
|
12
|
+
justification: string;
|
|
13
|
+
pattern: string[][];
|
|
14
|
+
}
|
|
15
|
+
export declare function prefixRule(rule: PrefixRule): PrefixRule;
|
|
16
|
+
export declare function defineCommandRules(...rules: PrefixRule[]): CommandRuleSet;
|
|
17
|
+
export declare function matchesPrefixRule(rule: PrefixRule, commandLine: string): boolean;
|
|
18
|
+
export declare function coerceCommandRuleSet(mod: unknown): CommandRuleSet;
|
|
19
|
+
export declare function evaluateCommand(ruleSet: CommandRuleSet, commandLine: string): RuleVerdict | null;
|
|
20
|
+
//# sourceMappingURL=command-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-rules.d.ts","sourceRoot":"","sources":["../src/command-rules.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,aAAa,CAAC;AAEvD,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC;IACpB,QAAQ,EAAE,YAAY,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,UAAU,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,YAAY,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC;CACrB;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAoBvD;AAED,wBAAgB,kBAAkB,CAAC,GAAG,KAAK,EAAE,UAAU,EAAE,GAAG,cAAc,CAEzE;AAMD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAOhF;AAED,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,cAAc,CAOjE;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAOhG"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export function prefixRule(rule) {
|
|
2
|
+
if (!Array.isArray(rule.pattern) || rule.pattern.length === 0) {
|
|
3
|
+
throw new Error("prefixRule: pattern must be a non-empty array of token positions");
|
|
4
|
+
}
|
|
5
|
+
for (const position of rule.pattern) {
|
|
6
|
+
if (!Array.isArray(position) ||
|
|
7
|
+
position.length === 0 ||
|
|
8
|
+
position.some((t) => typeof t !== "string" || t.length === 0)) {
|
|
9
|
+
throw new Error("prefixRule: each pattern position must be a non-empty array of non-empty strings");
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
if (rule.decision !== "forbidden" && rule.decision !== "discouraged") {
|
|
13
|
+
throw new Error(`prefixRule: decision must be "forbidden" or "discouraged", got "${String(rule.decision)}"`);
|
|
14
|
+
}
|
|
15
|
+
if (typeof rule.justification !== "string" || rule.justification.trim().length === 0) {
|
|
16
|
+
throw new Error("prefixRule: justification is required");
|
|
17
|
+
}
|
|
18
|
+
return rule;
|
|
19
|
+
}
|
|
20
|
+
export function defineCommandRules(...rules) {
|
|
21
|
+
return { rules };
|
|
22
|
+
}
|
|
23
|
+
function tokenize(commandLine) {
|
|
24
|
+
return commandLine.trim().split(/\s+/).filter((t) => t.length > 0);
|
|
25
|
+
}
|
|
26
|
+
export function matchesPrefixRule(rule, commandLine) {
|
|
27
|
+
const tokens = tokenize(commandLine).filter((t) => !t.startsWith("-"));
|
|
28
|
+
if (tokens.length < rule.pattern.length)
|
|
29
|
+
return false;
|
|
30
|
+
for (let i = 0; i < rule.pattern.length; i++) {
|
|
31
|
+
if (!rule.pattern[i].includes(tokens[i]))
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
export function coerceCommandRuleSet(mod) {
|
|
37
|
+
const m = (mod ?? {});
|
|
38
|
+
const set = (m["default"] ?? m["keelCommandRules"]);
|
|
39
|
+
if (!set || !Array.isArray(set.rules)) {
|
|
40
|
+
throw new Error("command rules module must default-export a CommandRuleSet (defineCommandRules(...))");
|
|
41
|
+
}
|
|
42
|
+
return { rules: set.rules.map((r) => prefixRule(r)) };
|
|
43
|
+
}
|
|
44
|
+
export function evaluateCommand(ruleSet, commandLine) {
|
|
45
|
+
for (const rule of ruleSet.rules) {
|
|
46
|
+
if (matchesPrefixRule(rule, commandLine)) {
|
|
47
|
+
return { decision: rule.decision, justification: rule.justification, pattern: rule.pattern };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
//# sour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,UAAU,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,OAAuB,EAAE,WAAmB;IAC1E,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QACjC,IAAI,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,CAAC;YACzC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,aAAa,EAAE,IAAI,CAAC,aAAa,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;QAC/F,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface CorpusCase {
|
|
2
|
+
id: string;
|
|
3
|
+
principleId: string;
|
|
4
|
+
expect: "flag" | "clean";
|
|
5
|
+
files: Array<{
|
|
6
|
+
path: string;
|
|
7
|
+
status: "added" | "modified" | "removed";
|
|
8
|
+
content?: string;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
export type CorpusFile = CorpusCase["files"][number];
|
|
12
|
+
export declare const corpus: CorpusCase[];
|
|
13
|
+
//# sourceMappingURL=fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/corpus/fixtures.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,KAAK,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC5F;AAED,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,eAAO,MAAM,MAAM,EAAE,UAAU,EAoN9B,CAAC"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// @keel-ignore-file: naming-is-design
|
|
2
|
+
// @keel-ignore-file: no-todo-comments
|
|
3
|
+
export const corpus = [
|
|
4
|
+
{
|
|
5
|
+
id: "tac-flag",
|
|
6
|
+
principleId: "tests-as-contracts",
|
|
7
|
+
expect: "flag",
|
|
8
|
+
files: [{ path: "packages/p/src/widget.ts", status: "added" }],
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
id: "tac-clean",
|
|
12
|
+
principleId: "tests-as-contracts",
|
|
13
|
+
expect: "clean",
|
|
14
|
+
files: [
|
|
15
|
+
{ path: "packages/p/src/gadget.ts", status: "added", content: "export const gadget = 1;\n" },
|
|
16
|
+
{ path: "packages/p/src/gadget.test.ts", status: "added", content: "export {};\n" },
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: "wwi-flag",
|
|
21
|
+
principleId: "wrong-way-impossible",
|
|
22
|
+
expect: "flag",
|
|
23
|
+
files: [
|
|
24
|
+
{ path: "src/loose.ts", status: "added", content: "export function f(x: any) { return x; }\n" },
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "wwi-clean-justified",
|
|
29
|
+
principleId: "wrong-way-impossible",
|
|
30
|
+
expect: "clean",
|
|
31
|
+
files: [
|
|
32
|
+
{
|
|
33
|
+
path: "src/justified.ts",
|
|
34
|
+
status: "added",
|
|
35
|
+
content: "// eslint-disable-next-line @typescript-eslint/no-explicit-any -- SDK boundary, shape unknown\nexport function g(x: any) { return x; }\n",
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: "wwi-clean-typed",
|
|
41
|
+
principleId: "wrong-way-impossible",
|
|
42
|
+
expect: "clean",
|
|
43
|
+
files: [
|
|
44
|
+
{
|
|
45
|
+
path: "src/typed.ts",
|
|
46
|
+
status: "added",
|
|
47
|
+
content: "export function h(x: unknown) { return x; }\n",
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "nid-flag",
|
|
53
|
+
principleId: "naming-is-design",
|
|
54
|
+
expect: "flag",
|
|
55
|
+
files: [
|
|
56
|
+
{
|
|
57
|
+
path: "src/vague.ts",
|
|
58
|
+
status: "added",
|
|
59
|
+
content: "const data = 1; const info = 2; const temp = 3; const obj = 4;\n",
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "nid-clean",
|
|
65
|
+
principleId: "naming-is-design",
|
|
66
|
+
expect: "clean",
|
|
67
|
+
files: [
|
|
68
|
+
{
|
|
69
|
+
path: "src/precise.ts",
|
|
70
|
+
status: "added",
|
|
71
|
+
content: "const userCount = 1; const retryBudget = 2;\n",
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: "todo-flag",
|
|
77
|
+
principleId: "no-todo-comments",
|
|
78
|
+
expect: "flag",
|
|
79
|
+
files: [
|
|
80
|
+
{
|
|
81
|
+
path: "src/todo.ts",
|
|
82
|
+
status: "modified",
|
|
83
|
+
content: "export const x = 1; // TODO: fix later\n",
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
id: "todo-clean-string",
|
|
89
|
+
principleId: "no-todo-comments",
|
|
90
|
+
expect: "clean",
|
|
91
|
+
files: [
|
|
92
|
+
{
|
|
93
|
+
path: "src/todo-clean.ts",
|
|
94
|
+
status: "added",
|
|
95
|
+
content: 'export const label = "TODO list page";\n',
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
id: "todo-clean-ignore",
|
|
101
|
+
principleId: "no-todo-comments",
|
|
102
|
+
expect: "clean",
|
|
103
|
+
files: [
|
|
104
|
+
{
|
|
105
|
+
path: "src/todo-ignore.ts",
|
|
106
|
+
status: "modified",
|
|
107
|
+
content: "// @keel-ignore-next-line: no-todo-comments\n// TODO: justified in commit\nexport const y = 1;\n",
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
id: "tsl-flag",
|
|
113
|
+
principleId: "tool-schemas-are-load-bearing",
|
|
114
|
+
expect: "flag",
|
|
115
|
+
files: [
|
|
116
|
+
{
|
|
117
|
+
path: "src/tools/bare.ts",
|
|
118
|
+
status: "added",
|
|
119
|
+
content: 'export const bareTool = { name: "bare", run: () => 1 };\n',
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
id: "tsl-clean",
|
|
125
|
+
principleId: "tool-schemas-are-load-bearing",
|
|
126
|
+
expect: "clean",
|
|
127
|
+
files: [
|
|
128
|
+
{
|
|
129
|
+
path: "src/tools/typed.ts",
|
|
130
|
+
status: "added",
|
|
131
|
+
content: 'import { z } from "zod";\nexport const inputSchema = z.object({ q: z.string() });\n',
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: "tft-flag",
|
|
137
|
+
principleId: "tool-failures-are-typed",
|
|
138
|
+
expect: "flag",
|
|
139
|
+
files: [
|
|
140
|
+
{
|
|
141
|
+
path: "src/tools/throws.ts",
|
|
142
|
+
status: "added",
|
|
143
|
+
content: 'import { z } from "zod";\nexport const inputSchema = z.object({});\nexport function run() { throw new Error("boom"); }\n',
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
id: "tft-clean",
|
|
149
|
+
principleId: "tool-failures-are-typed",
|
|
150
|
+
expect: "clean",
|
|
151
|
+
files: [
|
|
152
|
+
{
|
|
153
|
+
path: "src/tools/typed-err.ts",
|
|
154
|
+
status: "added",
|
|
155
|
+
content: 'import { z } from "zod";\nexport const inputSchema = z.object({});\nexport type ToolError = { kind: string };\nexport function run(): ToolError { return { kind: "bad" }; }\n',
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
id: "csb-flag",
|
|
161
|
+
principleId: "chunk-size-bounded",
|
|
162
|
+
expect: "flag",
|
|
163
|
+
files: [
|
|
164
|
+
{
|
|
165
|
+
path: "src/kb/chunk-unbounded.ts",
|
|
166
|
+
status: "added",
|
|
167
|
+
content: "export function chunk(text: string) { const out: string[] = []; let start = 0; while (start < text.length) { out.push(text.slice(start, start + 100)); start += 100; } return out; }\n",
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
id: "csb-clean",
|
|
173
|
+
principleId: "chunk-size-bounded",
|
|
174
|
+
expect: "clean",
|
|
175
|
+
files: [
|
|
176
|
+
{
|
|
177
|
+
path: "src/kb/chunk-bounded.ts",
|
|
178
|
+
status: "added",
|
|
179
|
+
content: "export function chunk(text: string, maxChunkSize = 100) { const out: string[] = []; let start = 0; while (start < text.length) { out.push(text.slice(start, start + maxChunkSize)); start += maxChunkSize; } return out; }\n",
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
id: "rcf-flag",
|
|
185
|
+
principleId: "retrieval-confidence-floor",
|
|
186
|
+
expect: "flag",
|
|
187
|
+
files: [
|
|
188
|
+
{
|
|
189
|
+
path: "src/kb/retrieve-loose.ts",
|
|
190
|
+
status: "added",
|
|
191
|
+
content: "declare function retrieve(q: string): string[];\nexport function search(q: string) { return retrieve(q); }\n",
|
|
192
|
+
},
|
|
193
|
+
],
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
id: "rcf-clean",
|
|
197
|
+
principleId: "retrieval-confidence-floor",
|
|
198
|
+
expect: "clean",
|
|
199
|
+
files: [
|
|
200
|
+
{
|
|
201
|
+
path: "src/kb/retrieve-floored.ts",
|
|
202
|
+
status: "added",
|
|
203
|
+
content: "declare function retrieve(opts: { q: string; minScore: number }): { score: number }[];\nconst minScore = 0.7;\nexport function search(q: string) { return retrieve({ q, minScore }); }\n",
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
},
|
|
207
|
+
];
|
|
208
|
+
//# sourceMappingURL=fixtures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../../src/corpus/fixtures.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,sCAAsC;AAWtC,MAAM,CAAC,MAAM,MAAM,GAAiB;IAClC;QACE,EAAE,EAAE,UAAU;QACd,WAAW,EAAE,oBAAoB;QACjC,MAAM,EAAE,MAAM;QACd,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,0BAA0B,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;KAC/D;IACD;QACE,EAAE,EAAE,WAAW;QACf,WAAW,EAAE,oBAAoB;QACjC,MAAM,EAAE,OAAO;QACf,KAAK,EAAE;YACL,EAAE,IAAI,EAAE,0BAA0B,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,4BAA4B,EAAE;YAC5F,EAAE,IAAI,EAAE,+BAA+B,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE;SACpF;KACF;IACD;QACE,EAAE,EAAE,UAAU;QACd,WAAW,EAAE,sBAAsB;QACnC,MAAM,EAAE,MAAM;QACd,KAAK,EAAE;YACL,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,2CAA2C,EAAE;SAChG;KACF;IACD;QACE,EAAE,EAAE,qBAAqB;QACzB,WAAW,EAAE,sBAAsB;QACnC,MAAM,EAAE,OAAO;QACf,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,kBAAkB;gBACxB,MAAM,EAAE,OAAO;gBACf,OAAO,EACL,0IAA0I;aAC7I;SACF;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C,MAAM,EAAE,OAAO;gBACf,OAAO,EACL,8GAA8G;aACjH;SACF;KACF;IACD;QACE,EAAE,EAAE,WAAW;QACf,WAAW,EAAE,4BAA4B;QACzC,MAAM,EAAE,OAAO;QACf,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,4BAA4B;gBAClC,MAAM,EAAE,OAAO;gBACf,OAAO,EACL,0LAA0L;aAC7L;SACF;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ArchitectureMap } from "@keel_flow/schema";
|
|
2
|
+
import type { PrincipleRegistry } from "../principles.js";
|
|
3
|
+
import type { CorpusCase } from "./fixtures.js";
|
|
4
|
+
export interface CorpusResult {
|
|
5
|
+
id: string;
|
|
6
|
+
principleId: string;
|
|
7
|
+
expect: "flag" | "clean";
|
|
8
|
+
fired: boolean;
|
|
9
|
+
correct: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function runCorpus(registry: PrincipleRegistry, cases: CorpusCase[], emptyArchitecture: ArchitectureMap): CorpusResult[];
|
|
12
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/corpus/run.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAG1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,SAAS,CACvB,QAAQ,EAAE,iBAAiB,EAC3B,KAAK,EAAE,UAAU,EAAE,EACnB,iBAAiB,EAAE,eAAe,GACjC,YAAY,EAAE,CA0ChB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { mkdtempSync, mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { join, dirname } from "node:path";
|
|
4
|
+
import { checkPrinciplesCompliance } from "../verify.js";
|
|
5
|
+
export function runCorpus(registry, cases, emptyArchitecture) {
|
|
6
|
+
const results = [];
|
|
7
|
+
for (const corpusCase of cases) {
|
|
8
|
+
const root = mkdtempSync(join(tmpdir(), "keel-corpus-"));
|
|
9
|
+
for (const file of corpusCase.files) {
|
|
10
|
+
if (file.content === undefined)
|
|
11
|
+
continue;
|
|
12
|
+
const absPath = join(root, file.path);
|
|
13
|
+
mkdirSync(dirname(absPath), { recursive: true });
|
|
14
|
+
writeFileSync(absPath, file.content);
|
|
15
|
+
}
|
|
16
|
+
const diff = {
|
|
17
|
+
files: corpusCase.files.map((file) => ({
|
|
18
|
+
path: file.path,
|
|
19
|
+
status: file.status,
|
|
20
|
+
linesAdded: 0,
|
|
21
|
+
linesRemoved: 0,
|
|
22
|
+
})),
|
|
23
|
+
};
|
|
24
|
+
const prev = process.cwd();
|
|
25
|
+
process.chdir(root);
|
|
26
|
+
let violations;
|
|
27
|
+
try {
|
|
28
|
+
({ violations } = checkPrinciplesCompliance(diff, registry, emptyArchitecture));
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
process.chdir(prev);
|
|
32
|
+
}
|
|
33
|
+
const fired = violations.some((v) => v.principleId === corpusCase.principleId);
|
|
34
|
+
const correct = corpusCase.expect === "flag" ? fired : !fired;
|
|
35
|
+
results.push({
|
|
36
|
+
id: corpusCase.id,
|
|
37
|
+
principleId: corpusCase.principleId,
|
|
38
|
+
expect: corpusCase.expect,
|
|
39
|
+
fired,
|
|
40
|
+
correct,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return results;
|
|
44
|
+
}
|
|
45
|
+
//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AI,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;QAC3B,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACpB,IAAI,UAAU,CAAC;QACf,IAAI,CAAC;YACH,CAAC,EAAE,UAAU,EAAE,GAAG,yBAAyB,CAAC,IAAI,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC;QAClF,CAAC;gBAAS,CAAC;YACT,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;QAED,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,KAAK,UAAU,CAAC,WAAW,CAAC,CAAC;QAC/E,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAC9D,OAAO,CAAC,IAAI,CAAC;YACX,EAAE,EAAE,UAAU,CAAC,EAAE;YACjB,WAAW,EAAE,UAAU,CAAC,WAAW;YACnC,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,KAAK;YACL,OAAO;SACR,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CorpusResult } from "./run.js";
|
|
2
|
+
export declare function sensitivity(results: CorpusResult[]): number;
|
|
3
|
+
export declare function specificity(results: CorpusResult[]): number;
|
|
4
|
+
export declare function balancedAccuracy(results: CorpusResult[]): number;
|
|
5
|
+
export declare function youdenJ(results: CorpusResult[]): number;
|
|
6
|
+
//# sourceMappingURL=score.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"score.d.ts","sourceRoot":"","sources":["../../src/corpus/score.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE7C,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,CAI3D;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,CAI3D;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,CAEhE;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,CAEvD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export function sensitivity(results) {
|
|
2
|
+
const positives = results.filter((r) => r.expect === "flag");
|
|
3
|
+
if (positives.length === 0)
|
|
4
|
+
return 1;
|
|
5
|
+
return positives.filter((r) => r.fired).length / positives.length;
|
|
6
|
+
}
|
|
7
|
+
export function specificity(results) {
|
|
8
|
+
const negatives = results.filter((r) => r.expect === "clean");
|
|
9
|
+
if (negatives.length === 0)
|
|
10
|
+
return 1;
|
|
11
|
+
return negatives.filter((r) => !r.fired).length / negatives.length;
|
|
12
|
+
}
|
|
13
|
+
export function balancedAccuracy(results) {
|
|
14
|
+
return (sensitivity(results) + specificity(results)) / 2;
|
|
15
|
+
}
|
|
16
|
+
export function youdenJ(results) {
|
|
17
|
+
return sensitivity(results) + specificity(results) - 1;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=score.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"score.js","sourceRoot":"","sources":["../../src/corpus/score.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,WAAW,CAAC,OAAuB;IACjD,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC;IAC7D,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IACrC,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAuB;IACjD,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC;IAC9D,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IACrC,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAuB;IACtD,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,OAAO,CAAC,OAAuB;IAC7C,OAAO,WAAW,CAAC,OAAO,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;AACzD,CAAC"}
|
package/dist/diff.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface DiffHunk {
|
|
2
|
+
newStart: number;
|
|
3
|
+
newLines: number;
|
|
4
|
+
}
|
|
5
|
+
export interface DiffFile {
|
|
6
|
+
path: string;
|
|
7
|
+
status: "added" | "modified" | "removed";
|
|
8
|
+
linesAdded: number;
|
|
9
|
+
linesRemoved: number;
|
|
10
|
+
hunks?: DiffHunk[];
|
|
11
|
+
addedText?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface Diff {
|
|
14
|
+
files: DiffFile[];
|
|
15
|
+
}
|
|
16
|
+
export declare function parseDiff(rawDiff: string): Diff;
|
|
17
|
+
//# sourceMappingURL=diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../src/diff.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,QAAQ,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CA8E/C"}
|
package/dist/diff.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export function parseDiff(rawDiff) {
|
|
2
|
+
const files = [];
|
|
3
|
+
const lines = rawDiff.split("\n");
|
|
4
|
+
let current = null;
|
|
5
|
+
const flush = () => {
|
|
6
|
+
if (current !== null) {
|
|
7
|
+
files.push({
|
|
8
|
+
path: current.path ?? "",
|
|
9
|
+
status: current.status ?? "modified",
|
|
10
|
+
linesAdded: current.linesAdded,
|
|
11
|
+
linesRemoved: current.linesRemoved,
|
|
12
|
+
hunks: current.hunks,
|
|
13
|
+
addedText: current.addedLines.join("\n"),
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
for (const line of lines) {
|
|
18
|
+
if (line.startsWith("diff --git ")) {
|
|
19
|
+
flush();
|
|
20
|
+
const match = /^diff --git a\/.+ b\/(.+)$/.exec(line);
|
|
21
|
+
current = {
|
|
22
|
+
...(match?.[1] !== undefined ? { path: match[1] } : {}),
|
|
23
|
+
linesAdded: 0,
|
|
24
|
+
linesRemoved: 0,
|
|
25
|
+
hunks: [],
|
|
26
|
+
addedLines: [],
|
|
27
|
+
};
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
if (!current)
|
|
31
|
+
continue;
|
|
32
|
+
if (line.startsWith("new file mode")) {
|
|
33
|
+
current.status = "added";
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (line.startsWith("deleted file mode")) {
|
|
37
|
+
current.status = "removed";
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const hunkHeader = /^@@ -\d+(?:,\d+)? \+(\d+)(?:,(\d+))? @@/.exec(line);
|
|
41
|
+
if (hunkHeader) {
|
|
42
|
+
current.hunks.push({
|
|
43
|
+
newStart: parseInt(hunkHeader[1] ?? "0", 10),
|
|
44
|
+
newLines: hunkHeader[2] !== undefined ? parseInt(hunkHeader[2], 10) : 1,
|
|
45
|
+
});
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (line.startsWith("+") && !line.startsWith("+++")) {
|
|
49
|
+
current.linesAdded += 1;
|
|
50
|
+
current.addedLines.push(line.slice(1));
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (line.startsWith("-") && !line.startsWith("---")) {
|
|
54
|
+
current.linesRemoved += 1;
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
flush();
|
|
59
|
+
return { files };
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=diff.js.map
|
package/dist/diff.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../src/diff.ts"],"names":[],"mappings":"AAkBA,MAAM,UAAU,SAAS,CAAC,OAAe;IACvC,MAAM,KAAK,GAAe,EAAE,CAAC;IAC7B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAElC,IAAI,OAAO,GASA,IAAI,CAAC;IAEhB,MAAM,KAAK,GAAG,GAAG,EAAE;QACjB,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;YACrB,KAAK,CAAC,IAAI,CAA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,KAAK,CAAC,IAAI,CAAC;gBACjB,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,EAAE,CAAC;gBAC5C,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;aACxE,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QAED,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YACpD,OAAO,CAAC,UAAU,IAAI,CAAC,CAAC;YACxB,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YACvC,SAAS;QACX,CAAC;QAED,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YACpD,OAAO,CAAC,YAAY,IAAI,CAAC,CAAC;YAC1B,SAAS;QACX,CAAC;IACH,CAAC;IAED,KAAK,EAAE,CAAC;IAER,OAAO,EAAE,KAAK,EAAE,CAAC;AACnB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { createArchitecture } from "./architecture.js";
|
|
2
|
+
export { createPrincipleRegistry } from "./principles.js";
|
|
3
|
+
export type { PrincipleRegistry } from "./principles.js";
|
|
4
|
+
export { defineAgent } from "./agent.js";
|
|
5
|
+
export type { AgentConfig, Agent } from "./agent.js";
|
|
6
|
+
export { defineTool } from "./tool.js";
|
|
7
|
+
export type { ToolConfig, Tool } from "./tool.js";
|
|
8
|
+
export { defineKnowledgeBase } from "./knowledge-base.js";
|
|
9
|
+
export type { KnowledgeBase, KBChunk, KBDocument, KBAdapter, KBRetrieveOpts } from "./knowledge-base.js";
|
|
10
|
+
export { parseDiff } from "./diff.js";
|
|
11
|
+
export type { Diff, DiffFile, DiffHunk } from "./diff.js";
|
|
12
|
+
export { verify, detectPackageManager, resolveLintCommands } from "./verify.js";
|
|
13
|
+
export type { VerifyOptions, SpecChecker, PackageManager } from "./verify.js";
|
|
14
|
+
export { seamContractsPrinciple } from "./seam-contracts.js";
|
|
15
|
+
export { prefixRule, defineCommandRules, matchesPrefixRule, evaluateCommand, coerceCommandRuleSet, } from "./command-rules.js";
|
|
16
|
+
export type { PrefixRule, CommandRuleSet, RuleDecision, RuleVerdict, } from "./command-rules.js";
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,YAAY,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,YAAY,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACzG,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAChF,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,UAAU,EACV,cAAc,EACd,YAAY,EACZ,WAAW,GACZ,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { createArchitecture } from "./architecture.js";
|
|
2
|
+
export { createPrincipleRegistry } from "./principles.js";
|
|
3
|
+
export { defineAgent } from "./agent.js";
|
|
4
|
+
export { defineTool } from "./tool.js";
|
|
5
|
+
export { defineKnowledgeBase } from "./knowledge-base.js";
|
|
6
|
+
export { parseDiff } from "./diff.js";
|
|
7
|
+
export { verify, detectPackageManager, resolveLintCommands } from "./verify.js";
|
|
8
|
+
export { seamContractsPrinciple } from "./seam-contracts.js";
|
|
9
|
+
export { prefixRule, defineCommandRules, matchesPrefixRule, evaluateCommand, coerceCommandRuleSet, } from "./command-rules.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEhF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,oBAAoB,GACrB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface KBChunk {
|
|
2
|
+
id: string;
|
|
3
|
+
content: string;
|
|
4
|
+
source: string;
|
|
5
|
+
score: number;
|
|
6
|
+
}
|
|
7
|
+
export interface KBDocument {
|
|
8
|
+
id: string;
|
|
9
|
+
content: string;
|
|
10
|
+
source: string;
|
|
11
|
+
metadata?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
export interface KBRetrieveOpts {
|
|
14
|
+
minScore?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface KnowledgeBase {
|
|
17
|
+
retrieve(query: string, k: number, opts?: KBRetrieveOpts): Promise<KBChunk[]>;
|
|
18
|
+
ingest(doc: KBDocument): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export interface KBAdapter {
|
|
21
|
+
retrieve(query: string, k: number, opts?: KBRetrieveOpts): Promise<KBChunk[]>;
|
|
22
|
+
ingest(doc: KBDocument): Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
export declare function defineKnowledgeBase(adapter: KBAdapter): KnowledgeBase;
|
|
25
|
+
//# sourceMappingURL=knowledge-base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledge-base.d.ts","sourceRoot":"","sources":["../src/knowledge-base.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9E,MAAM,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAC9E,MAAM,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,SAAS,GAAG,aAAa,CAKrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"knowledge-base.js","sourceRoot":"","sources":["../src/knowledge-base.ts"],"names":[],"mappings":"AA4BA,MAAM,UAAU,mBAAmB,CAAC,OAAkB;IACpD,OAAO;QACL,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,CAAC;QAC9D,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC;KACrC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PrincipleWithCheck, PrinciplePack } from "@keel_flow/schema";
|
|
2
|
+
import type { ArchitectureNode } from "@keel_flow/schema";
|
|
3
|
+
export interface PrincipleRegistry {
|
|
4
|
+
get(id: string): PrincipleWithCheck | undefined;
|
|
5
|
+
all(): PrincipleWithCheck[];
|
|
6
|
+
applicable(node: ArchitectureNode): PrincipleWithCheck[];
|
|
7
|
+
}
|
|
8
|
+
export declare function createPrincipleRegistry(packs: Array<{
|
|
9
|
+
principles: PrincipleWithCheck[];
|
|
10
|
+
} | PrinciplePack>): PrincipleRegistry;
|
|
11
|
+
//# sourceMappingURL=principles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"principles.d.ts","sourceRoot":"","sources":["../src/principles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAAC;IAChD,GAAG,IAAI,kBAAkB,EAAE,CAAC;IAC5B,UAAU,CAAC,IAAI,EAAE,gBAAgB,GAAG,kBAAkB,EAAE,CAAC;CAC1D;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,KAAK,CAAC;IAAE,UAAU,EAAE,kBAAkB,EAAE,CAAA;CAAE,GAAG,aAAa,CAAC,GACjE,iBAAiB,CA0BnB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export function createPrincipleRegistry(packs) {
|
|
2
|
+
// Last-wins deduplication: if two packs define the same principle id,
|
|
3
|
+
// the pack that appears later in the array overrides the earlier one.
|
|
4
|
+
// This lets downstream consumers refine upstream principles without forking.
|
|
5
|
+
const byId = new Map();
|
|
6
|
+
for (const pack of packs) {
|
|
7
|
+
for (const principle of pack.principles) {
|
|
8
|
+
byId.set(principle.id, principle);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
const principles = Array.from(byId.values());
|
|
12
|
+
return {
|
|
13
|
+
get(id) {
|
|
14
|
+
return byId.get(id);
|
|
15
|
+
},
|
|
16
|
+
all() {
|
|
17
|
+
return principles;
|
|
18
|
+
},
|
|
19
|
+
// All principles are considered applicable to all nodes for now.
|
|
20
|
+
// Future refinement: match by layer, tech stack, or explicit node tagging.
|
|
21
|
+
applicable(_node) {
|
|
22
|
+
return principles;
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=principles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"principles.js","sourceRoot":"","sources":["../src/principles.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,uBAAuB,CACrC,KAAkE;IAElE,sEAAsE;IACtE,sEAAsE;IACtE,6EAA6E;IAC7E,MAAM,IAAI,GAAG,IAAI,GAAG,EAA8B,CAAC;IACnD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACxC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;IAED,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAE7C,OAAO;QACL,GAAG,CAAC,EAAU;YACZ,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACtB,CAAC;QACD,GAAG;YACD,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,iEAAiE;QACjE,2EAA2E;QAC3E,UAAU,CAAC,KAAuB;YAChC,OAAO,UAAU,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seam-contracts.d.ts","sourceRoot":"","sources":["../src/seam-contracts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAa,MAAM,mBAAmB,CAAC;AAoBvE,eAAO,MAAM,sBAAsB,EAAE,kBAmDpC,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { readdirSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
function contractTestFiles(absDir) {
|
|
4
|
+
try {
|
|
5
|
+
return readdirSync(absDir)
|
|
6
|
+
.filter((f) => f.endsWith(".contract.test.ts"))
|
|
7
|
+
.map((f) => join(absDir, f));
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function fileReferencesSeam(file, seamId) {
|
|
14
|
+
try {
|
|
15
|
+
return readFileSync(file, "utf8").includes(seamId);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export const seamContractsPrinciple = {
|
|
22
|
+
id: "seam-contracts",
|
|
23
|
+
description: "Every cross-process seam (a type:http connection to an internal node, tagged seam=) must have a *.contract.test.ts in a node key-file directory that boots the real router and references the seam id",
|
|
24
|
+
rationale: "An uncontracted seam compiles but cannot be verified to speak the protocol the other side expects. A filename-only check passes empty or unrelated tests, so the contract test must actually reference the seam id — and an http edge to an internal node may not silently skip the contract by omitting the seam tag",
|
|
25
|
+
severity: "critical",
|
|
26
|
+
check({ architecture, cwd }) {
|
|
27
|
+
const violations = [];
|
|
28
|
+
const dirOf = (kf) => kf.replace(/\/[^/]+$/, "");
|
|
29
|
+
for (const conn of architecture.connections) {
|
|
30
|
+
const fromNode = architecture.nodes.find((n) => n.id === conn.from);
|
|
31
|
+
const toNode = architecture.nodes.find((n) => n.id === conn.to);
|
|
32
|
+
if (!conn.seam) {
|
|
33
|
+
if (conn.type === "http" && toNode) {
|
|
34
|
+
violations.push({
|
|
35
|
+
principleId: "seam-contracts",
|
|
36
|
+
severity: "critical",
|
|
37
|
+
message: `Connection from "${conn.from}" to "${conn.to}" is type="http" (a cross-process seam to an internal node) but carries no seam= tag, so it escapes contract enforcement. ` +
|
|
38
|
+
`Tag it seam="<procedure>" and add a *.contract.test.ts that boots the real router and exercises that procedure.`,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const seamId = conn.seam;
|
|
44
|
+
const dirs = [
|
|
45
|
+
...new Set([...(fromNode?.keyFiles ?? []), ...(toNode?.keyFiles ?? [])].map(dirOf)),
|
|
46
|
+
];
|
|
47
|
+
const root = cwd ?? process.cwd();
|
|
48
|
+
const referenced = dirs
|
|
49
|
+
.flatMap((dir) => contractTestFiles(join(root, dir)))
|
|
50
|
+
.some((file) => fileReferencesSeam(file, seamId));
|
|
51
|
+
if (!referenced) {
|
|
52
|
+
violations.push({
|
|
53
|
+
principleId: "seam-contracts",
|
|
54
|
+
severity: "critical",
|
|
55
|
+
message: `Connection from "${conn.from}" to "${conn.to}" is tagged seam="${seamId}" but no *.contract.test.ts in the key-file directories of either node references "${seamId}". ` +
|
|
56
|
+
`A file that merely exists is not enough — add or extend a contract test that boots the real router and exercises the "${seamId}" call path so the seam id appears in the test.`,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return violations;
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=seam-contracts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seam-contracts.js","sourceRoot":"","sources":["../src/seam-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,SAAS,iBAAiB,CAAC,MAAc;IACvC,IAAI,CAAC;QACH,OAAO,WAAW,CAAC,MAAM,CAAC;aACvB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,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od";
|
|
2
|
+
export interface ToolConfig<TInput extends ZodType> {
|
|
3
|
+
id: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: TInput;
|
|
6
|
+
handler: (input: z.infer<TInput>) => unknown | Promise<unknown>;
|
|
7
|
+
}
|
|
8
|
+
export interface Tool<TInput extends ZodType> {
|
|
9
|
+
config: ToolConfig<TInput>;
|
|
10
|
+
call(input: z.infer<TInput>): Promise<unknown>;
|
|
11
|
+
}
|
|
12
|
+
export declare function defineTool<TInput extends ZodType>(config: ToolConfig<TInput>): Tool<TInput>;
|
|
13
|
+
//# sourceMappingURL=tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAEtC,MAAM,WAAW,UAAU,CAAC,MAAM,SAAS,OAAO;IAChD,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjE;AAED,MAAM,WAAW,IAAI,CAAC,MAAM,SAAS,OAAO;IAC1C,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAC3B,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAChD;AAED,wBAAgB,UAAU,CAAC,MAAM,SAAS,OAAO,EAC/C,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,GACzB,IAAI,CAAC,MAAM,CAAC,CAQd"}
|
package/dist/tool.js
ADDED
package/dist/tool.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.js","sourceRoot":"","sources":["../src/tool.ts"],"names":[],"mappings":"AAcA,MAAM,UAAU,UAAU,CACxB,MAA0B;IAE1B,OAAO;QACL,MAAM;QACN,KAAK,CAAC,IAAI,CAAC,KAAsB;YAC/B,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC/C,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/verify.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ArchitectureMap, Violation, VerifyResult } from "@keel_flow/schema";
|
|
2
|
+
import type { Diff } from "./diff.js";
|
|
3
|
+
import type { PrincipleRegistry } from "./principles.js";
|
|
4
|
+
export type PackageManager = "pnpm" | "npm" | "yarn" | "bun";
|
|
5
|
+
export declare function detectPackageManager(cwd: string): PackageManager;
|
|
6
|
+
export declare function resolveLintCommands(cwd: string): string[];
|
|
7
|
+
export type SpecChecker = (args: {
|
|
8
|
+
diff: Diff;
|
|
9
|
+
architecture: ArchitectureMap;
|
|
10
|
+
specSummary: string;
|
|
11
|
+
}) => Promise<{
|
|
12
|
+
passed: boolean;
|
|
13
|
+
violations: Violation[];
|
|
14
|
+
pending?: false;
|
|
15
|
+
}>;
|
|
16
|
+
export interface VerifyOptions {
|
|
17
|
+
diff: Diff;
|
|
18
|
+
architecture: ArchitectureMap;
|
|
19
|
+
architectureSource: string;
|
|
20
|
+
principles: PrincipleRegistry;
|
|
21
|
+
specChecker?: SpecChecker | undefined;
|
|
22
|
+
specSummary?: string | undefined;
|
|
23
|
+
options?: {
|
|
24
|
+
lintCommands?: string[] | undefined;
|
|
25
|
+
cwd?: string | undefined;
|
|
26
|
+
} | undefined;
|
|
27
|
+
}
|
|
28
|
+
export declare function verify({ diff, architecture, architectureSource, principles, specChecker, specSummary, options, }: VerifyOptions): Promise<VerifyResult>;
|
|
29
|
+
export declare function checkArchitectureCompliance(diff: Diff, architecture: ArchitectureMap, architectureSource: string): {
|
|
30
|
+
passed: boolean;
|
|
31
|
+
violations: Violation[];
|
|
32
|
+
};
|
|
33
|
+
export declare function checkPrinciplesCompliance(diff: Diff, registry: PrincipleRegistry, architecture: ArchitectureMap, cwd?: string): {
|
|
34
|
+
passed: boolean;
|
|
35
|
+
violations: Violation[];
|
|
36
|
+
};
|
|
37
|
+
export declare function checkTestsAndLint(options?: VerifyOptions["options"]): {
|
|
38
|
+
passed: boolean;
|
|
39
|
+
violations: Violation[];
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=verify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../src/verify.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAClF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEzD,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;AAK7D,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CAMhE;AASD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAYzD;AAID,MAAM,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE;IAC/B,IAAI,EAAE,IAAI,CAAC;IACX,YAAY,EAAE,eAAe,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;CACrB,KAAK,OAAO,CAAC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,SAAS,EAAE,CAAC;IAAC,OAAO,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC;AAE7E,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,IAAI,CAAC;IACX,YAAY,EAAE,eAAe,CAAC;IAC9B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,WAAW,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,OAAO,CAAC,EAAE;QACR,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;QACpC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAC1B,GAAG,SAAS,CAAC;CACf;AAED,wBAAsB,MAAM,CAAC,EAC3B,IAAI,EACJ,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,WAAW,EACX,OAAO,GACR,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CA2BvC;AAoED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,eAAe,EAC7B,kBAAkB,EAAE,MAAM,GACzB;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,SAAS,EAAE,CAAA;CAAE,CA+B9C;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,iBAAiB,EAC3B,YAAY,EAAE,eAAe,EAC7B,GAAG,CAAC,EAAE,MAAM,GACX;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,SAAS,EAAE,CAAA;CAAE,CAqB9C;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,GACjC;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,UAAU,EAAE,SAAS,EAAE,CAAA;CAAE,CAuC9C"}
|
package/dist/verify.js
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { execSync } from "child_process";
|
|
2
|
+
import { existsSync, readFileSync } from "fs";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
// Detect a repo's package manager from its lockfile so the verify gate works on
|
|
5
|
+
// any TS repo, not just the pnpm-based Keel monorepo. Defaults to pnpm (Keel's
|
|
6
|
+
// own choice) when no lockfile is present, preserving Keel-on-Keel behavior.
|
|
7
|
+
export function detectPackageManager(cwd) {
|
|
8
|
+
if (existsSync(join(cwd, "pnpm-lock.yaml")))
|
|
9
|
+
return "pnpm";
|
|
10
|
+
if (existsSync(join(cwd, "yarn.lock")))
|
|
11
|
+
return "yarn";
|
|
12
|
+
if (existsSync(join(cwd, "bun.lockb")))
|
|
13
|
+
return "bun";
|
|
14
|
+
if (existsSync(join(cwd, "package-lock.json")))
|
|
15
|
+
return "npm";
|
|
16
|
+
return "pnpm";
|
|
17
|
+
}
|
|
18
|
+
// The default tests+lint commands for a repo: run only the {typecheck, test,
|
|
19
|
+
// lint} scripts it actually defines, via its detected package manager. This makes
|
|
20
|
+
// the gate (a) package-manager-agnostic and (b) tolerant of a repo that
|
|
21
|
+
// legitimately has no `typecheck` script (e.g. a Vite app) — it no longer hard-
|
|
22
|
+
// fails by shelling out to a non-existent `pnpm typecheck`. Keel's own root has
|
|
23
|
+
// all three scripts under pnpm, so its gate is unchanged (`pnpm run <s>` ≡
|
|
24
|
+
// `pnpm <s>`). Returns [] when no package.json / matching scripts exist.
|
|
25
|
+
export function resolveLintCommands(cwd) {
|
|
26
|
+
const pm = detectPackageManager(cwd);
|
|
27
|
+
let scripts = {};
|
|
28
|
+
try {
|
|
29
|
+
const pkg = JSON.parse(readFileSync(join(cwd, "package.json"), "utf-8"));
|
|
30
|
+
scripts = pkg.scripts ?? {};
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
return ["typecheck", "test", "lint"].filter((s) => s in scripts).map((s) => `${pm} run ${s}`);
|
|
36
|
+
}
|
|
37
|
+
const ARCHITECTURE_DATA_PATH = "architecture/data.ts";
|
|
38
|
+
export async function verify({ diff, architecture, architectureSource, principles, specChecker, specSummary, options, }) {
|
|
39
|
+
const specResult = await checkSpecCompliance(diff, architecture, specChecker, specSummary);
|
|
40
|
+
const archResult = checkArchitectureCompliance(diff, architecture, architectureSource);
|
|
41
|
+
const principlesResult = checkPrinciplesCompliance(diff, principles, architecture, options?.cwd);
|
|
42
|
+
const testsResult = checkTestsAndLint(options);
|
|
43
|
+
const allViolations = [
|
|
44
|
+
...specResult.violations,
|
|
45
|
+
...archResult.violations,
|
|
46
|
+
...principlesResult.violations,
|
|
47
|
+
...testsResult.violations,
|
|
48
|
+
];
|
|
49
|
+
const hasCritical = allViolations.some((v) => v.severity === "critical");
|
|
50
|
+
const hasWarning = allViolations.some((v) => v.severity === "warning");
|
|
51
|
+
const exitCode = hasCritical ? 2 : hasWarning ? 1 : 0;
|
|
52
|
+
return {
|
|
53
|
+
checks: {
|
|
54
|
+
spec: specResult,
|
|
55
|
+
architecture: archResult,
|
|
56
|
+
principles: principlesResult,
|
|
57
|
+
"tests-lint": testsResult,
|
|
58
|
+
},
|
|
59
|
+
exitCode,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
// pending: true means no specChecker was injected — spec compliance is not yet evaluated.
|
|
63
|
+
// pending is absent when a checker ran and produced a real result.
|
|
64
|
+
async function checkSpecCompliance(diff, architecture, specChecker, specSummary) {
|
|
65
|
+
if (!specChecker) {
|
|
66
|
+
return { passed: true, violations: [], pending: true };
|
|
67
|
+
}
|
|
68
|
+
const result = await specChecker({ diff, architecture, specSummary: specSummary ?? "" });
|
|
69
|
+
return { passed: result.passed, violations: result.violations };
|
|
70
|
+
}
|
|
71
|
+
function keyFileMatchesPath(keyFile, path) {
|
|
72
|
+
if (path === keyFile)
|
|
73
|
+
return true;
|
|
74
|
+
if (path.startsWith(keyFile + "/"))
|
|
75
|
+
return true;
|
|
76
|
+
if (keyFile.startsWith(path + "/"))
|
|
77
|
+
return true;
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
function changedDataLineRanges(diff) {
|
|
81
|
+
const dataFile = diff.files.find((f) => f.path === ARCHITECTURE_DATA_PATH);
|
|
82
|
+
if (!dataFile?.hunks)
|
|
83
|
+
return [];
|
|
84
|
+
return dataFile.hunks.map((h) => h.newLines > 0
|
|
85
|
+
? [h.newStart, h.newStart + h.newLines - 1]
|
|
86
|
+
: [h.newStart, h.newStart]);
|
|
87
|
+
}
|
|
88
|
+
function nodeBlockRanges(architectureSource, nodeIds) {
|
|
89
|
+
const lines = architectureSource.split("\n");
|
|
90
|
+
const idLineForNode = new Map();
|
|
91
|
+
const ids = new Set(nodeIds);
|
|
92
|
+
let inNodes = false;
|
|
93
|
+
for (let i = 0; i < lines.length; i++) {
|
|
94
|
+
const line = lines[i] ?? "";
|
|
95
|
+
if (line.includes("nodes: ["))
|
|
96
|
+
inNodes = true;
|
|
97
|
+
if (line.includes("connections: ["))
|
|
98
|
+
inNodes = false;
|
|
99
|
+
if (!inNodes)
|
|
100
|
+
continue;
|
|
101
|
+
const match = /^ id: "([^"]+)"/.exec(line);
|
|
102
|
+
if (match && match[1] !== undefined && ids.has(match[1]) && !idLineForNode.has(match[1])) {
|
|
103
|
+
idLineForNode.set(match[1], i + 1);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const ordered = [...idLineForNode.entries()].sort((a, b) => a[1] - b[1]);
|
|
107
|
+
const connectionsLine = lines.findIndex((l) => l.includes("connections: [")) + 1 || lines.length + 1;
|
|
108
|
+
const ranges = new Map();
|
|
109
|
+
for (let i = 0; i < ordered.length; i++) {
|
|
110
|
+
const [id, start] = ordered[i];
|
|
111
|
+
const next = ordered[i + 1];
|
|
112
|
+
const end = next ? next[1] - 1 : connectionsLine - 1;
|
|
113
|
+
ranges.set(id, [start, end]);
|
|
114
|
+
}
|
|
115
|
+
return ranges;
|
|
116
|
+
}
|
|
117
|
+
export function checkArchitectureCompliance(diff, architecture, architectureSource) {
|
|
118
|
+
const violations = [];
|
|
119
|
+
const changedRanges = changedDataLineRanges(diff);
|
|
120
|
+
const blockRanges = nodeBlockRanges(architectureSource, architecture.nodes.map((n) => n.id));
|
|
121
|
+
const nodeBlockChanged = (nodeId) => {
|
|
122
|
+
const block = blockRanges.get(nodeId);
|
|
123
|
+
if (!block)
|
|
124
|
+
return false;
|
|
125
|
+
const [blockStart, blockEnd] = block;
|
|
126
|
+
return changedRanges.some(([start, end]) => !(end < blockStart || start > blockEnd));
|
|
127
|
+
};
|
|
128
|
+
for (const node of architecture.nodes) {
|
|
129
|
+
const nodeKeyFileTouched = node.keyFiles.some((kf) => diff.files.some((f) => keyFileMatchesPath(kf, f.path)));
|
|
130
|
+
if (nodeKeyFileTouched && !nodeBlockChanged(node.id)) {
|
|
131
|
+
violations.push({
|
|
132
|
+
principleId: "architecture-map-in-sync",
|
|
133
|
+
nodeId: node.id,
|
|
134
|
+
severity: "warning",
|
|
135
|
+
message: `Node "${node.id}" has key files touched in this diff, but its own block in architecture/data.ts was not updated. Update this node's entry (description / keyFiles / keyFunctionality) in the same change.`,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return { passed: violations.length === 0, violations };
|
|
140
|
+
}
|
|
141
|
+
export function checkPrinciplesCompliance(diff, registry, architecture, cwd) {
|
|
142
|
+
const violations = [];
|
|
143
|
+
for (const principle of registry.all()) {
|
|
144
|
+
if (principle.check) {
|
|
145
|
+
try {
|
|
146
|
+
const ctx = cwd !== undefined ? { diff, architecture, cwd } : { diff, architecture };
|
|
147
|
+
const found = principle.check(ctx);
|
|
148
|
+
violations.push(...found);
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
const reason = err instanceof Error ? err.message : String(err);
|
|
152
|
+
violations.push({
|
|
153
|
+
principleId: principle.id,
|
|
154
|
+
severity: "critical",
|
|
155
|
+
message: `Principle check "${principle.id}" threw and was isolated: ${reason}`,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return { passed: violations.length === 0, violations };
|
|
161
|
+
}
|
|
162
|
+
export function checkTestsAndLint(options) {
|
|
163
|
+
const cwd = options?.cwd ?? process.cwd();
|
|
164
|
+
// Explicit lintCommands win; otherwise auto-resolve from the repo's package
|
|
165
|
+
// manager + the scripts it actually defines (works on npm/yarn/bun, not just
|
|
166
|
+
// the pnpm monorepo).
|
|
167
|
+
const commands = options?.lintCommands ?? resolveLintCommands(cwd);
|
|
168
|
+
const violations = [];
|
|
169
|
+
for (const cmd of commands) {
|
|
170
|
+
try {
|
|
171
|
+
execSync(cmd, {
|
|
172
|
+
cwd,
|
|
173
|
+
stdio: "pipe",
|
|
174
|
+
env: { ...process.env, TURBO_FORCE: "1" },
|
|
175
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
catch (err) {
|
|
179
|
+
const e = err;
|
|
180
|
+
const stdout = e.stdout != null ? String(e.stdout).trim() : "";
|
|
181
|
+
const stderr = e.stderr != null ? String(e.stderr).trim() : "";
|
|
182
|
+
const exit = typeof e.status === "number" ? e.status : "unknown";
|
|
183
|
+
const sections = [stdout, stderr].filter((s) => s.length > 0);
|
|
184
|
+
const detail = sections.length > 0
|
|
185
|
+
? sections.join("\n")
|
|
186
|
+
: "(no output captured on stdout or stderr)";
|
|
187
|
+
violations.push({
|
|
188
|
+
principleId: "tests-as-contracts",
|
|
189
|
+
severity: "critical",
|
|
190
|
+
message: `Command "${cmd}" failed (exit ${exit}):\n${detail}`,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return { passed: violations.length === 0, violations };
|
|
195
|
+
}
|
|
196
|
+
//# sourceMappingURL=verify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../src/verify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAA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@@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@keel_flow/core",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"README.md"
|
|
12
|
+
],
|
|
13
|
+
"main": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./dist/index.js",
|
|
18
|
+
"types": "./dist/index.d.ts"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"zod": "^3.23.0",
|
|
23
|
+
"@keel_flow/schema": "0.2.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "^25.9.1",
|
|
27
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
28
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
29
|
+
"eslint": "^9.0.0",
|
|
30
|
+
"typescript": "^5.5.0",
|
|
31
|
+
"vitest": "^2.0.0"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsc",
|
|
35
|
+
"typecheck": "tsc --noEmit",
|
|
36
|
+
"test": "vitest run",
|
|
37
|
+
"lint": "eslint src"
|
|
38
|
+
}
|
|
39
|
+
}
|