filegrc 0.3.4 → 0.5.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/README.md +24 -6
- package/model/index.js +41 -3
- package/model/v1.json +81 -47
- package/model/v2.json +8022 -0
- package/model/v3.json +9391 -0
- package/package.json +2 -2
- package/src/agent.js +89 -8
- package/src/appointments.js +19 -0
- package/src/audit-preparation.js +109 -65
- package/src/audit-transition.js +96 -0
- package/src/batch-review.js +109 -0
- package/src/cli.js +563 -148
- package/src/collection-review.js +185 -0
- package/src/coverage.js +50 -0
- package/src/evidence-packet.js +149 -77
- package/src/external-reviewer.js +165 -0
- package/src/files.js +267 -29
- package/src/git.js +239 -41
- package/src/index.js +41 -7
- package/src/model-docs.js +103 -7
- package/src/model-migration.js +1958 -0
- package/src/mutation.js +42 -0
- package/src/obligations.js +502 -95
- package/src/parties.js +17 -2
- package/src/program-lifecycle.js +1 -0
- package/src/program-path.js +70 -60
- package/src/program-readiness.js +470 -130
- package/src/reconciliation.js +277 -0
- package/src/resource-status.js +17 -0
- package/src/server.js +347 -48
- package/src/setup.js +57 -26
- package/src/source-coverage.js +61 -0
- package/src/state.js +122 -25
- package/src/timing.js +41 -0
- package/src/validate.js +707 -44
- package/src/web.js +1440 -304
- package/src/workflow.js +1595 -0
- package/src/workspace.js +15 -7
- package/src/evidence-tests.js +0 -69
package/src/workspace.js
CHANGED
|
@@ -36,17 +36,25 @@ export async function loadWorkspace(input = process.cwd()) {
|
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
let model;
|
|
40
|
-
|
|
41
|
-
model = loadModel(String(workspaceEntry?.record?.dataModelVersion ?? "1"));
|
|
42
|
-
} catch (error) {
|
|
39
|
+
let model = loadModel();
|
|
40
|
+
if (workspaceEntry && !Object.hasOwn(workspaceEntry.record, "dataModelVersion")) {
|
|
43
41
|
diagnostics.push({
|
|
44
42
|
severity: "error",
|
|
45
|
-
code: "
|
|
43
|
+
code: "missing-model-version",
|
|
46
44
|
path: "data/workspace.json",
|
|
47
|
-
message:
|
|
45
|
+
message: "The Workspace record must declare dataModelVersion."
|
|
48
46
|
});
|
|
49
|
-
|
|
47
|
+
} else if (workspaceEntry) {
|
|
48
|
+
try {
|
|
49
|
+
model = loadModel(String(workspaceEntry.record.dataModelVersion));
|
|
50
|
+
} catch (error) {
|
|
51
|
+
diagnostics.push({
|
|
52
|
+
severity: "error",
|
|
53
|
+
code: "unsupported-model",
|
|
54
|
+
path: "data/workspace.json",
|
|
55
|
+
message: error.message
|
|
56
|
+
});
|
|
57
|
+
}
|
|
50
58
|
}
|
|
51
59
|
|
|
52
60
|
return {
|
package/src/evidence-tests.js
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { createResources } from "./files.js";
|
|
2
|
-
import { createResourceId } from "./id.js";
|
|
3
|
-
import { selectedControlFamilies } from "./program-readiness.js";
|
|
4
|
-
import { loadWorkspace } from "./workspace.js";
|
|
5
|
-
|
|
6
|
-
const TEST_EVIDENCE_KINDS = new Set(["test-export", "test-capture"]);
|
|
7
|
-
|
|
8
|
-
export function planEvidenceTestDrafts(loaded) {
|
|
9
|
-
const workspace = loaded.workspace;
|
|
10
|
-
const selectedIds = new Set(workspace.controlIds || []);
|
|
11
|
-
const controls = loaded.resources.filter((record) => (
|
|
12
|
-
record.type === "control"
|
|
13
|
-
&& (!selectedIds.size || selectedIds.has(record.id))
|
|
14
|
-
&& !["not-applicable", "retired"].includes(record.status)
|
|
15
|
-
));
|
|
16
|
-
const families = selectedControlFamilies(controls, loaded.model)
|
|
17
|
-
.filter((family) => family.collectionTestRequired !== false);
|
|
18
|
-
const evidence = loaded.resources.filter((record) => (
|
|
19
|
-
record.type === "evidence" && TEST_EVIDENCE_KINDS.has(record.evidenceKind)
|
|
20
|
-
));
|
|
21
|
-
return families.map((family) => {
|
|
22
|
-
const familyControlIds = new Set(family.controls.map((control) => control.id));
|
|
23
|
-
const existing = evidence.find((record) => record.collectionTestFamilyId === family.id)
|
|
24
|
-
|| evidence.find((record) => (
|
|
25
|
-
(record.controlIds || []).some((id) => familyControlIds.has(id))
|
|
26
|
-
));
|
|
27
|
-
return {
|
|
28
|
-
familyId: family.id,
|
|
29
|
-
title: family.title,
|
|
30
|
-
testEvidenceKind: family.testEvidenceKind,
|
|
31
|
-
testPrompt: family.testPrompt,
|
|
32
|
-
controlIds: [...familyControlIds],
|
|
33
|
-
existing
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export async function ensureEvidenceTestDrafts(input = process.cwd()) {
|
|
39
|
-
const loaded = await loadWorkspace(input);
|
|
40
|
-
const plan = planEvidenceTestDrafts(loaded);
|
|
41
|
-
const created = [];
|
|
42
|
-
const usedIds = loaded.resources.map((record) => record.id);
|
|
43
|
-
for (const item of plan.filter(({ existing }) => !existing)) {
|
|
44
|
-
const id = createResourceId(
|
|
45
|
-
"evidence",
|
|
46
|
-
`${item.title} Collection Test`,
|
|
47
|
-
usedIds
|
|
48
|
-
);
|
|
49
|
-
usedIds.push(id);
|
|
50
|
-
const record = {
|
|
51
|
-
schemaVersion: 1,
|
|
52
|
-
id,
|
|
53
|
-
type: "evidence",
|
|
54
|
-
title: `${item.title} Evidence Collection Test`,
|
|
55
|
-
status: "draft",
|
|
56
|
-
evidenceKind: item.testEvidenceKind,
|
|
57
|
-
collectionTestFamilyId: item.familyId,
|
|
58
|
-
collectionTestPrompt: item.testPrompt,
|
|
59
|
-
controlIds: item.controlIds
|
|
60
|
-
};
|
|
61
|
-
created.push(record);
|
|
62
|
-
}
|
|
63
|
-
if (created.length) await createResources(loaded.root, created);
|
|
64
|
-
return {
|
|
65
|
-
created,
|
|
66
|
-
existing: plan.filter(({ existing }) => existing).map(({ existing }) => existing),
|
|
67
|
-
total: plan.length
|
|
68
|
-
};
|
|
69
|
-
}
|