@bbcsoftwarefactory/cli 0.1.0 → 1.1.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/audit-ledger.d.ts +2 -0
- package/dist/audit-ledger.js +71 -0
- package/dist/bbc-install.d.ts +2 -0
- package/dist/bbc-install.js +1250 -0
- package/dist/bbc.d.ts +2 -0
- package/dist/bbc.js +124 -0
- package/dist/bigo/complexity.d.ts +18 -0
- package/dist/bigo/complexity.js +139 -0
- package/dist/bigo/functions.d.ts +5 -0
- package/dist/bigo/functions.js +174 -0
- package/dist/bigo/keywords.d.ts +1 -0
- package/dist/bigo/keywords.js +43 -0
- package/dist/bigo/lexical.d.ts +14 -0
- package/dist/bigo/lexical.js +69 -0
- package/dist/bigo/source-files.d.ts +1 -0
- package/dist/bigo/source-files.js +80 -0
- package/dist/change-lane/classification.d.ts +41 -0
- package/dist/change-lane/classification.js +104 -0
- package/dist/change-lane/git.d.ts +8 -0
- package/dist/change-lane/git.js +105 -0
- package/dist/check-issue-claim.d.ts +2 -0
- package/dist/check-issue-claim.js +146 -0
- package/dist/check-worktree-guard.d.ts +2 -0
- package/dist/check-worktree-guard.js +114 -0
- package/dist/classify-change-lane.d.ts +2 -0
- package/dist/classify-change-lane.js +128 -0
- package/dist/diff-scope/git-diff.d.ts +25 -0
- package/dist/diff-scope/git-diff.js +146 -0
- package/dist/error-scan.d.ts +3 -0
- package/dist/error-scan.js +216 -0
- package/dist/export-public.d.ts +9 -0
- package/dist/export-public.js +274 -0
- package/dist/extract-diff-scope.d.ts +2 -0
- package/dist/extract-diff-scope.js +111 -0
- package/dist/fetch-issue-attachments.d.ts +22 -0
- package/dist/fetch-issue-attachments.js +325 -0
- package/dist/issue-claim/evaluation.d.ts +66 -0
- package/dist/issue-claim/evaluation.js +259 -0
- package/dist/issue-claim/loaders.d.ts +5 -0
- package/dist/issue-claim/loaders.js +116 -0
- package/dist/list-zed-commands.d.ts +7 -0
- package/dist/list-zed-commands.js +288 -0
- package/dist/measure-bigo.d.ts +2 -0
- package/dist/measure-bigo.js +84 -0
- package/dist/plan-issue-triage.d.ts +3 -0
- package/dist/plan-issue-triage.js +404 -0
- package/dist/question-gate/ledger.d.ts +5 -0
- package/dist/question-gate/ledger.js +115 -0
- package/dist/question-gate/rules.d.ts +40 -0
- package/dist/question-gate/rules.js +483 -0
- package/dist/recap/board.d.ts +5 -0
- package/dist/recap/board.js +384 -0
- package/dist/recap/git-and-github.d.ts +11 -0
- package/dist/recap/git-and-github.js +620 -0
- package/dist/recap/report-and-hud.d.ts +2 -0
- package/dist/recap/report-and-hud.js +294 -0
- package/dist/recap/time-and-refs.d.ts +27 -0
- package/dist/recap/time-and-refs.js +148 -0
- package/dist/recap.d.ts +2 -0
- package/dist/recap.js +217 -0
- package/dist/render-workflow.d.ts +2 -0
- package/dist/render-workflow.js +142 -0
- package/dist/resolve-containers.d.ts +2 -0
- package/dist/resolve-containers.js +96 -0
- package/dist/review-loop.d.ts +7 -0
- package/dist/review-loop.js +622 -0
- package/dist/save-counts.d.ts +2 -0
- package/dist/save-counts.js +191 -0
- package/dist/summarize-logs.d.ts +2 -0
- package/dist/summarize-logs.js +41 -0
- package/dist/sweep-github.d.ts +10 -0
- package/dist/sweep-github.js +453 -0
- package/dist/sweep-issues.d.ts +56 -0
- package/dist/sweep-issues.js +650 -0
- package/dist/sweep.d.ts +2 -0
- package/dist/sweep.js +301 -0
- package/dist/triage-question.d.ts +2 -0
- package/dist/triage-question.js +189 -0
- package/dist/validate-skills.d.ts +2 -0
- package/dist/validate-skills.js +48 -0
- package/dist/watch-live.d.ts +7 -0
- package/dist/watch-live.js +83 -0
- package/dist/watcher/config.d.ts +11 -0
- package/dist/watcher/config.js +265 -0
- package/dist/watcher/live-classifier.d.ts +52 -0
- package/dist/watcher/live-classifier.js +510 -0
- package/dist/watcher/safe-fs.d.ts +9 -0
- package/dist/watcher/safe-fs.js +159 -0
- package/dist/watcher/stream.d.ts +27 -0
- package/dist/watcher/stream.js +340 -0
- package/dist/watcher/summarizer.d.ts +19 -0
- package/dist/watcher/summarizer.js +121 -0
- package/dist/wave3/process.d.ts +14 -0
- package/dist/wave3/process.js +84 -0
- package/dist/wave4/process.d.ts +14 -0
- package/dist/wave4/process.js +128 -0
- package/dist/workflow/render.d.ts +13 -0
- package/dist/workflow/render.js +31 -0
- package/dist/workflow/schema.d.ts +25 -0
- package/dist/workflow/schema.js +99 -0
- package/dist/workflow-auditor/audit.d.ts +27 -0
- package/dist/workflow-auditor/audit.js +583 -0
- package/dist/workflow-auditor/ledger-io.d.ts +5 -0
- package/dist/workflow-auditor/ledger-io.js +99 -0
- package/dist/workflow-auditor/skills-validator.d.ts +10 -0
- package/dist/workflow-auditor/skills-validator.js +533 -0
- package/dist/worktree-guard/evaluation.d.ts +19 -0
- package/dist/worktree-guard/evaluation.js +84 -0
- package/dist/worktree-guard/git.d.ts +3 -0
- package/dist/worktree-guard/git.js +61 -0
- package/package.json +32 -33
- package/src/bbc.ts +0 -39
- package/src/bigo/complexity.ts +0 -138
- package/src/bigo/functions.ts +0 -183
- package/src/bigo/keywords.ts +0 -41
- package/src/bigo/lexical.ts +0 -68
- package/src/bigo/source-files.ts +0 -80
- package/src/change-lane/classification.ts +0 -128
- package/src/change-lane/git.ts +0 -110
- package/src/classify-change-lane.ts +0 -140
- package/src/diff-scope/git-diff.ts +0 -161
- package/src/extract-diff-scope.ts +0 -130
- package/src/measure-bigo.ts +0 -86
- package/src/render-workflow.ts +0 -144
- package/src/workflow/render.ts +0 -40
- package/src/workflow/schema.ts +0 -141
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LAYER: Infrastructure
|
|
3
|
+
* Contains: Cross-platform executable discovery and subprocess runner for Wave 4 CLI tools.
|
|
4
|
+
* Rules: Avoid shell: true; wrap Windows .cmd/.bat launchers explicitly with cmd.exe /d /c.
|
|
5
|
+
* BigO: O(n^2) score:1
|
|
6
|
+
* keywords: [WhichCommand, RunExecutable, StrictUtf8]
|
|
7
|
+
* GOAL: Locate PATH executables and execute child processes reliably across POSIX and Windows.
|
|
8
|
+
*/
|
|
9
|
+
import { spawnSync } from 'node:child_process';
|
|
10
|
+
import { constants, accessSync, statSync } from 'node:fs';
|
|
11
|
+
import { delimiter, extname, join } from 'node:path';
|
|
12
|
+
const utf8Strict = new TextDecoder('utf-8', { fatal: true });
|
|
13
|
+
export function decodeUtf8Strict(bytes) {
|
|
14
|
+
try {
|
|
15
|
+
return utf8Strict.decode(bytes);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function isExecutableFile(filePath) {
|
|
22
|
+
try {
|
|
23
|
+
const stats = statSync(filePath);
|
|
24
|
+
if (!stats.isFile())
|
|
25
|
+
return false;
|
|
26
|
+
if (process.platform === 'win32')
|
|
27
|
+
return true;
|
|
28
|
+
accessSync(filePath, constants.X_OK);
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export function whichCommand(command, pathEnv = process.env.PATH) {
|
|
36
|
+
if (!command)
|
|
37
|
+
return null;
|
|
38
|
+
if (command.includes('/') || command.includes('\\')) {
|
|
39
|
+
return isExecutableFile(command) ? command : null;
|
|
40
|
+
}
|
|
41
|
+
const pathList = (pathEnv ?? '').split(delimiter).filter(Boolean);
|
|
42
|
+
const winExts = process.platform === 'win32'
|
|
43
|
+
? (process.env.PATHEXT ?? '.COM;.EXE;.BAT;.CMD')
|
|
44
|
+
.split(';')
|
|
45
|
+
.filter(Boolean)
|
|
46
|
+
.map((e) => e.toLowerCase())
|
|
47
|
+
: [''];
|
|
48
|
+
const hasExt = process.platform === 'win32' && extname(command) !== '';
|
|
49
|
+
for (const dir of pathList) {
|
|
50
|
+
if (process.platform !== 'win32' || hasExt) {
|
|
51
|
+
const candidate = join(dir, command);
|
|
52
|
+
if (isExecutableFile(candidate))
|
|
53
|
+
return candidate;
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
for (const ext of winExts) {
|
|
57
|
+
const candidate = join(dir, `${command}${ext}`);
|
|
58
|
+
if (isExecutableFile(candidate))
|
|
59
|
+
return candidate;
|
|
60
|
+
}
|
|
61
|
+
const bare = join(dir, command);
|
|
62
|
+
if (isExecutableFile(bare))
|
|
63
|
+
return bare;
|
|
64
|
+
}
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
export function splitCommandWords(raw) {
|
|
68
|
+
const parts = [];
|
|
69
|
+
let current = '';
|
|
70
|
+
let quote = null;
|
|
71
|
+
for (let i = 0; i < raw.length; i += 1) {
|
|
72
|
+
const ch = raw[i];
|
|
73
|
+
if (quote !== null) {
|
|
74
|
+
if (ch === quote) {
|
|
75
|
+
quote = null;
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
current += ch;
|
|
79
|
+
}
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
if (ch === '"' || ch === "'") {
|
|
83
|
+
quote = ch;
|
|
84
|
+
}
|
|
85
|
+
else if (/\s/.test(ch)) {
|
|
86
|
+
if (current.length > 0) {
|
|
87
|
+
parts.push(current);
|
|
88
|
+
current = '';
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
current += ch;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (current.length > 0)
|
|
96
|
+
parts.push(current);
|
|
97
|
+
return parts;
|
|
98
|
+
}
|
|
99
|
+
export function runExecutable(argv, options = {}) {
|
|
100
|
+
const [cmd, ...args] = argv;
|
|
101
|
+
if (!cmd) {
|
|
102
|
+
return { code: 1, stdout: Buffer.alloc(0), stderr: Buffer.from('Missing command'), error: new Error('Missing command') };
|
|
103
|
+
}
|
|
104
|
+
const isWinCmd = process.platform === 'win32' && /\.(cmd|bat)$/i.test(cmd);
|
|
105
|
+
const spawnCmd = isWinCmd ? process.env.ComSpec || 'cmd.exe' : cmd;
|
|
106
|
+
const spawnArgs = isWinCmd ? ['/d', '/c', cmd, ...args] : [...args];
|
|
107
|
+
const opts = {
|
|
108
|
+
cwd: options.cwd,
|
|
109
|
+
env: options.env,
|
|
110
|
+
timeout: options.timeoutMs,
|
|
111
|
+
windowsHide: true,
|
|
112
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
113
|
+
};
|
|
114
|
+
const res = spawnSync(spawnCmd, spawnArgs, opts);
|
|
115
|
+
if (res.error) {
|
|
116
|
+
return {
|
|
117
|
+
code: 1,
|
|
118
|
+
stdout: res.stdout ?? Buffer.alloc(0),
|
|
119
|
+
stderr: res.stderr ?? Buffer.from(res.error.message),
|
|
120
|
+
error: res.error,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
code: res.status ?? 1,
|
|
125
|
+
stdout: res.stdout ?? Buffer.alloc(0),
|
|
126
|
+
stderr: res.stderr ?? Buffer.alloc(0),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LAYER: Application
|
|
3
|
+
* Contains: Mermaid rendering of a validated workflow document.
|
|
4
|
+
* Rules: Print a node label at its first appearance only.
|
|
5
|
+
* BigO: placeholder
|
|
6
|
+
* keywords: [MermaidRender, MarkerSection]
|
|
7
|
+
* GOAL: Produce the deterministic README block the workflow source describes.
|
|
8
|
+
*/
|
|
9
|
+
import type { WorkflowDocument } from './schema.ts';
|
|
10
|
+
export declare const workflowBegin = "<!-- workflow:begin generated by bbc render-workflow from docs/diagrams/workflow.json; do not edit by hand -->";
|
|
11
|
+
export declare const workflowEnd = "<!-- workflow:end -->";
|
|
12
|
+
export declare function renderFlowchart(document: WorkflowDocument): string;
|
|
13
|
+
export declare function generatedSection(document: WorkflowDocument): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const workflowBegin = '<!-- workflow:begin generated by bbc render-workflow from docs/diagrams/workflow.json; do not edit by hand -->';
|
|
2
|
+
export const workflowEnd = '<!-- workflow:end -->';
|
|
3
|
+
const arrows = { solid: '-->', dotted: '-.->' };
|
|
4
|
+
export function renderFlowchart(document) {
|
|
5
|
+
const declared = new Set();
|
|
6
|
+
const reference = (id) => {
|
|
7
|
+
if (declared.has(id))
|
|
8
|
+
return id;
|
|
9
|
+
declared.add(id);
|
|
10
|
+
return `${id}["${document.nodes[id]?.label ?? ''}"]`;
|
|
11
|
+
};
|
|
12
|
+
const line = (edge, indent) => {
|
|
13
|
+
let arrow = arrows[edge.style ?? 'solid'];
|
|
14
|
+
if (edge.label !== undefined)
|
|
15
|
+
arrow += `|${edge.label}|`;
|
|
16
|
+
return `${indent}${reference(edge.from)} ${arrow} ${reference(edge.to)}`;
|
|
17
|
+
};
|
|
18
|
+
const out = [`flowchart ${document.direction}`];
|
|
19
|
+
for (const group of document.groups) {
|
|
20
|
+
out.push(` subgraph ${group.id}["${group.title}"]`);
|
|
21
|
+
for (const edge of group.edges)
|
|
22
|
+
out.push(line(edge, ' '));
|
|
23
|
+
out.push(' end');
|
|
24
|
+
}
|
|
25
|
+
for (const edge of document.edges)
|
|
26
|
+
out.push(line(edge, ' '));
|
|
27
|
+
return `${out.join('\n')}\n`;
|
|
28
|
+
}
|
|
29
|
+
export function generatedSection(document) {
|
|
30
|
+
return `${workflowBegin}\n\n\`\`\`mermaid\n${renderFlowchart(document)}\`\`\`\n\n${workflowEnd}`;
|
|
31
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare class WorkflowError extends Error {
|
|
2
|
+
}
|
|
3
|
+
export interface WorkflowNode {
|
|
4
|
+
label: string;
|
|
5
|
+
agents: string;
|
|
6
|
+
}
|
|
7
|
+
export interface WorkflowEdge {
|
|
8
|
+
from: string;
|
|
9
|
+
to: string;
|
|
10
|
+
style?: 'solid' | 'dotted';
|
|
11
|
+
label?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface WorkflowGroup {
|
|
14
|
+
id: string;
|
|
15
|
+
title: string;
|
|
16
|
+
edges: WorkflowEdge[];
|
|
17
|
+
}
|
|
18
|
+
export interface WorkflowDocument {
|
|
19
|
+
version: 1;
|
|
20
|
+
direction: 'TD' | 'LR';
|
|
21
|
+
nodes: Record<string, WorkflowNode>;
|
|
22
|
+
groups: WorkflowGroup[];
|
|
23
|
+
edges: WorkflowEdge[];
|
|
24
|
+
}
|
|
25
|
+
export declare function validateWorkflow(value: unknown): WorkflowDocument;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LAYER: Domain
|
|
3
|
+
* Contains: Workflow document model and its invariants.
|
|
4
|
+
* Rules: Reject every shape the legacy renderer rejects, with the same message.
|
|
5
|
+
* BigO: placeholder
|
|
6
|
+
* keywords: [WorkflowDocument, SourceInvariants]
|
|
7
|
+
* GOAL: Validate docs/diagrams/workflow.json before anything renders it.
|
|
8
|
+
*/
|
|
9
|
+
import { compareCodePoints, describeValue, pythonListRepr, pythonRepr } from '@bbcsoftwarefactory/cli-core/python-compat';
|
|
10
|
+
export class WorkflowError extends Error {
|
|
11
|
+
}
|
|
12
|
+
const idPattern = /^[A-Za-z][A-Za-z0-9]{0,39}$/;
|
|
13
|
+
const idSource = '[A-Za-z][A-Za-z0-9]{0,39}';
|
|
14
|
+
const unsafeLabel = /["`[\n\r]/;
|
|
15
|
+
const unsafeEdgeLabel = /[|"`\n\r]/;
|
|
16
|
+
const unsafeAgents = /[\n\r]/;
|
|
17
|
+
function require(condition, message) {
|
|
18
|
+
if (!condition)
|
|
19
|
+
throw new WorkflowError(message);
|
|
20
|
+
}
|
|
21
|
+
function isPlainObject(value) {
|
|
22
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
23
|
+
}
|
|
24
|
+
function exactKeys(value, required, optional, where) {
|
|
25
|
+
require(isPlainObject(value), `${where}: must be an object`);
|
|
26
|
+
const keys = Object.keys(value);
|
|
27
|
+
const missing = required.filter((key) => !keys.includes(key)).sort(compareCodePoints);
|
|
28
|
+
require(missing.length === 0, `${where}: missing ${pythonListRepr(missing)}`);
|
|
29
|
+
const unknown = keys.filter((key) => !required.includes(key) && !optional.includes(key)).sort(compareCodePoints);
|
|
30
|
+
require(unknown.length === 0, `${where}: unknown ${pythonListRepr(unknown)}`);
|
|
31
|
+
return value;
|
|
32
|
+
}
|
|
33
|
+
function text(value, where, unsafe) {
|
|
34
|
+
require(typeof value === 'string' && value.trim() === value && value !== '', `${where}: must be a trimmed, non-empty string`);
|
|
35
|
+
require([...value].length <= 160, `${where}: longer than 160 characters`);
|
|
36
|
+
require(!unsafe.test(value), `${where}: contains a character that would break Mermaid syntax`);
|
|
37
|
+
return value;
|
|
38
|
+
}
|
|
39
|
+
function edge(value, where, nodes, used) {
|
|
40
|
+
const keys = exactKeys(value, ['from', 'to'], ['style', 'label'], where);
|
|
41
|
+
for (const end of ['from', 'to']) {
|
|
42
|
+
const target = keys[end];
|
|
43
|
+
require(typeof target === 'string' && Object.hasOwn(nodes, target), `${where}.${end}: unknown node ${describeValue(target)}`);
|
|
44
|
+
used.add(target);
|
|
45
|
+
}
|
|
46
|
+
const style = keys.style ?? 'solid';
|
|
47
|
+
require(style === 'solid' || style === 'dotted', `${where}.style: must be solid or dotted`);
|
|
48
|
+
const label = 'label' in keys ? text(keys.label, `${where}.label`, unsafeEdgeLabel) : undefined;
|
|
49
|
+
const rendered = { from: keys.from, to: keys.to, style };
|
|
50
|
+
if (label !== undefined)
|
|
51
|
+
rendered.label = label;
|
|
52
|
+
return rendered;
|
|
53
|
+
}
|
|
54
|
+
export function validateWorkflow(value) {
|
|
55
|
+
const top = exactKeys(value, ['version', 'direction', 'nodes', 'groups', 'edges'], [], 'workflow');
|
|
56
|
+
require(top.version === 1, 'workflow.version: must be 1');
|
|
57
|
+
require(top.direction === 'TD' || top.direction === 'LR', 'workflow.direction: must be TD or LR');
|
|
58
|
+
require(isPlainObject(top.nodes) && Object.keys(top.nodes).length > 0, 'workflow.nodes: must be a non-empty object');
|
|
59
|
+
const nodes = {};
|
|
60
|
+
for (const [id, node] of Object.entries(top.nodes)) {
|
|
61
|
+
require(idPattern.test(id), `node id ${pythonRepr(id)}: must match ${idSource}`);
|
|
62
|
+
const keys = exactKeys(node, ['label', 'agents'], [], `nodes.${id}`);
|
|
63
|
+
nodes[id] = {
|
|
64
|
+
label: text(keys.label, `nodes.${id}.label`, unsafeLabel),
|
|
65
|
+
agents: text(keys.agents, `nodes.${id}.agents`, unsafeAgents),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
require(Array.isArray(top.groups), 'workflow.groups: must be a list');
|
|
69
|
+
require(Array.isArray(top.edges), 'workflow.edges: must be a list');
|
|
70
|
+
const seen = new Set();
|
|
71
|
+
const groups = [];
|
|
72
|
+
top.groups.forEach((group, index) => {
|
|
73
|
+
const keys = exactKeys(group, ['id', 'title', 'edges'], [], `groups[${index}]`);
|
|
74
|
+
require(typeof keys.id === 'string' && idPattern.test(keys.id) && !Object.hasOwn(nodes, keys.id), `groups[${index}].id: invalid or reused`);
|
|
75
|
+
require(!seen.has(keys.id), `groups[${index}].id: duplicate ${keys.id}`);
|
|
76
|
+
seen.add(keys.id);
|
|
77
|
+
const title = text(keys.title, `groups[${index}].title`, unsafeLabel);
|
|
78
|
+
require(Array.isArray(keys.edges) && keys.edges.length > 0, `groups[${index}].edges: must be a non-empty list`);
|
|
79
|
+
groups.push({ id: keys.id, title, edges: [] });
|
|
80
|
+
});
|
|
81
|
+
const used = new Set();
|
|
82
|
+
top.groups.forEach((group, index) => {
|
|
83
|
+
const keys = group;
|
|
84
|
+
const target = groups[index];
|
|
85
|
+
if (target === undefined)
|
|
86
|
+
return;
|
|
87
|
+
target.edges = keys.edges.map((item, position) => edge(item, `groups[${index}].edges[${position}]`, nodes, used));
|
|
88
|
+
});
|
|
89
|
+
const edges = top.edges.map((item, position) => edge(item, `edges[${position}]`, nodes, used));
|
|
90
|
+
const unused = Object.keys(nodes).filter((id) => !used.has(id)).sort(compareCodePoints);
|
|
91
|
+
require(unused.length === 0, `nodes not used by any edge: ${pythonListRepr(unused)}`);
|
|
92
|
+
return {
|
|
93
|
+
version: 1,
|
|
94
|
+
direction: top.direction,
|
|
95
|
+
nodes,
|
|
96
|
+
groups,
|
|
97
|
+
edges,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LAYER: Domain
|
|
3
|
+
* Contains: Delivery ledger workflow conformance rules and server-log verification.
|
|
4
|
+
* Rules: Pure offline audit rules; never read files or call external commands.
|
|
5
|
+
* BigO: O(n^2) score:1
|
|
6
|
+
* keywords: [LedgerAudit, ToolDepotRules, ServerLogVerify]
|
|
7
|
+
* GOAL: Evaluate a delivery ledger against workflow stages, authorizations, and Tool Depot catalog.
|
|
8
|
+
*/
|
|
9
|
+
export declare class AuditUnusableError extends Error {
|
|
10
|
+
}
|
|
11
|
+
export interface AuditFinding {
|
|
12
|
+
rule: string;
|
|
13
|
+
detail: string;
|
|
14
|
+
at?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface AuditReport {
|
|
17
|
+
verdict: 'conforms' | 'gaps' | 'violations';
|
|
18
|
+
violations: AuditFinding[];
|
|
19
|
+
gaps: AuditFinding[];
|
|
20
|
+
checked: {
|
|
21
|
+
stages: number;
|
|
22
|
+
tool_requests: number;
|
|
23
|
+
tool_uses: number;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export declare function validateLedgerShape(ledger: unknown): Record<string, unknown>;
|
|
27
|
+
export declare function auditLedgerData(rawLedger: unknown, catalog: ReadonlyMap<string, Set<string>>, serverCommands?: readonly string[] | null): AuditReport;
|