@cleocode/adapters 2026.5.111 → 2026.5.113
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/index.js +1010 -251
- package/dist/index.js.map +3 -3
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -830,6 +830,63 @@ var init_cli_category = __esm({
|
|
|
830
830
|
}
|
|
831
831
|
});
|
|
832
832
|
|
|
833
|
+
// packages/contracts/src/config/manifest.ts
|
|
834
|
+
import { z as z4 } from "zod";
|
|
835
|
+
var PROJECT_INFO_MANIFEST, PROJECT_CONTEXT_MANIFEST, CLEO_CONFIG_MANIFEST, GLOBAL_CLEO_CONFIG_MANIFEST, CONFIG_MANIFEST_ENTRIES, configManifestEntrySchema;
|
|
836
|
+
var init_manifest = __esm({
|
|
837
|
+
"packages/contracts/src/config/manifest.ts"() {
|
|
838
|
+
"use strict";
|
|
839
|
+
PROJECT_INFO_MANIFEST = {
|
|
840
|
+
id: "project-info",
|
|
841
|
+
scope: "metadata",
|
|
842
|
+
path: ".cleo/project-info.json",
|
|
843
|
+
mergePrecedence: 0,
|
|
844
|
+
driftDetection: "schema-validate"
|
|
845
|
+
};
|
|
846
|
+
PROJECT_CONTEXT_MANIFEST = {
|
|
847
|
+
id: "project-context",
|
|
848
|
+
scope: "metadata",
|
|
849
|
+
path: ".cleo/project-context.json",
|
|
850
|
+
mergePrecedence: 0,
|
|
851
|
+
driftDetection: "staleness-gate"
|
|
852
|
+
};
|
|
853
|
+
CLEO_CONFIG_MANIFEST = {
|
|
854
|
+
id: "cleo-config-project",
|
|
855
|
+
scope: "project",
|
|
856
|
+
path: ".cleo/config.json",
|
|
857
|
+
mergePrecedence: 20,
|
|
858
|
+
driftDetection: "schema-validate"
|
|
859
|
+
};
|
|
860
|
+
GLOBAL_CLEO_CONFIG_MANIFEST = {
|
|
861
|
+
id: "cleo-config-global",
|
|
862
|
+
scope: "global",
|
|
863
|
+
path: "~/.cleo/config.json",
|
|
864
|
+
mergePrecedence: 10,
|
|
865
|
+
driftDetection: "schema-validate"
|
|
866
|
+
};
|
|
867
|
+
CONFIG_MANIFEST_ENTRIES = Object.freeze([
|
|
868
|
+
PROJECT_INFO_MANIFEST,
|
|
869
|
+
PROJECT_CONTEXT_MANIFEST,
|
|
870
|
+
GLOBAL_CLEO_CONFIG_MANIFEST,
|
|
871
|
+
CLEO_CONFIG_MANIFEST
|
|
872
|
+
]);
|
|
873
|
+
configManifestEntrySchema = z4.object({
|
|
874
|
+
id: z4.string().min(1),
|
|
875
|
+
scope: z4.union([z4.literal("global"), z4.literal("project"), z4.literal("metadata")]),
|
|
876
|
+
path: z4.string().min(1),
|
|
877
|
+
schema: z4.unknown().optional(),
|
|
878
|
+
mergePrecedence: z4.number().int().nonnegative(),
|
|
879
|
+
driftDetection: z4.union([
|
|
880
|
+
z4.literal("schema-validate"),
|
|
881
|
+
z4.literal("staleness-gate"),
|
|
882
|
+
z4.literal("value-diff"),
|
|
883
|
+
z4.literal("none")
|
|
884
|
+
]),
|
|
885
|
+
defaults: z4.record(z4.string(), z4.unknown()).optional()
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
});
|
|
889
|
+
|
|
833
890
|
// packages/contracts/src/credentials.ts
|
|
834
891
|
function parseClaudeCodeCredentials(buf) {
|
|
835
892
|
try {
|
|
@@ -1058,6 +1115,100 @@ var init_operations_registry = __esm({
|
|
|
1058
1115
|
}
|
|
1059
1116
|
});
|
|
1060
1117
|
|
|
1118
|
+
// packages/contracts/src/docs/provenance.ts
|
|
1119
|
+
import { z as z5 } from "zod";
|
|
1120
|
+
var PROVENANCE_NODE_KINDS, PROVENANCE_EDGE_RELATIONS, DOC_LIFECYCLE_STATUSES, provenanceNodeKindSchema, provenanceEdgeRelationSchema, docLifecycleStatusSchema, provenanceNodeBaseFields, provenanceDocNodeSchema, provenanceTaskNodeSchema, provenanceDecisionNodeSchema, provenanceSessionNodeSchema, provenanceMemoryNodeSchema, provenanceNodeSchema, provenanceEdgeSchema, docProvenanceResponseSchema;
|
|
1121
|
+
var init_provenance = __esm({
|
|
1122
|
+
"packages/contracts/src/docs/provenance.ts"() {
|
|
1123
|
+
"use strict";
|
|
1124
|
+
PROVENANCE_NODE_KINDS = [
|
|
1125
|
+
"doc",
|
|
1126
|
+
"task",
|
|
1127
|
+
"decision",
|
|
1128
|
+
"session",
|
|
1129
|
+
"memory"
|
|
1130
|
+
];
|
|
1131
|
+
PROVENANCE_EDGE_RELATIONS = [
|
|
1132
|
+
"attached-to",
|
|
1133
|
+
"supersedes",
|
|
1134
|
+
"superseded-by",
|
|
1135
|
+
"related-task",
|
|
1136
|
+
"linked-decision",
|
|
1137
|
+
"derived-from"
|
|
1138
|
+
];
|
|
1139
|
+
DOC_LIFECYCLE_STATUSES = [
|
|
1140
|
+
"active",
|
|
1141
|
+
"superseded",
|
|
1142
|
+
"archived",
|
|
1143
|
+
"draft"
|
|
1144
|
+
];
|
|
1145
|
+
provenanceNodeKindSchema = z5.enum(PROVENANCE_NODE_KINDS);
|
|
1146
|
+
provenanceEdgeRelationSchema = z5.enum(PROVENANCE_EDGE_RELATIONS);
|
|
1147
|
+
docLifecycleStatusSchema = z5.enum(DOC_LIFECYCLE_STATUSES);
|
|
1148
|
+
provenanceNodeBaseFields = {
|
|
1149
|
+
id: z5.string().min(1),
|
|
1150
|
+
title: z5.string().min(1),
|
|
1151
|
+
metadata: z5.record(z5.string(), z5.unknown()).optional()
|
|
1152
|
+
};
|
|
1153
|
+
provenanceDocNodeSchema = z5.object({
|
|
1154
|
+
...provenanceNodeBaseFields,
|
|
1155
|
+
kind: z5.literal("doc"),
|
|
1156
|
+
slug: z5.string().min(1),
|
|
1157
|
+
docKind: z5.string().min(1),
|
|
1158
|
+
lifecycleStatus: docLifecycleStatusSchema,
|
|
1159
|
+
publishedAt: z5.string().min(1),
|
|
1160
|
+
supersededAt: z5.string().min(1).optional(),
|
|
1161
|
+
summary: z5.string().optional()
|
|
1162
|
+
});
|
|
1163
|
+
provenanceTaskNodeSchema = z5.object({
|
|
1164
|
+
...provenanceNodeBaseFields,
|
|
1165
|
+
kind: z5.literal("task"),
|
|
1166
|
+
taskType: z5.enum(["saga", "epic", "task", "subtask"]),
|
|
1167
|
+
status: z5.enum(["pending", "in_progress", "done", "blocked", "cancelled", "archived"])
|
|
1168
|
+
});
|
|
1169
|
+
provenanceDecisionNodeSchema = z5.object({
|
|
1170
|
+
...provenanceNodeBaseFields,
|
|
1171
|
+
kind: z5.literal("decision"),
|
|
1172
|
+
outcome: z5.enum(["proposed", "accepted", "rejected", "superseded"]),
|
|
1173
|
+
decidedAt: z5.string().min(1)
|
|
1174
|
+
});
|
|
1175
|
+
provenanceSessionNodeSchema = z5.object({
|
|
1176
|
+
...provenanceNodeBaseFields,
|
|
1177
|
+
kind: z5.literal("session"),
|
|
1178
|
+
startedAt: z5.string().min(1),
|
|
1179
|
+
endedAt: z5.string().min(1).optional()
|
|
1180
|
+
});
|
|
1181
|
+
provenanceMemoryNodeSchema = z5.object({
|
|
1182
|
+
...provenanceNodeBaseFields,
|
|
1183
|
+
kind: z5.literal("memory"),
|
|
1184
|
+
memoryType: z5.enum(["observation", "pattern", "decision", "diary"]),
|
|
1185
|
+
recordedAt: z5.string().min(1)
|
|
1186
|
+
});
|
|
1187
|
+
provenanceNodeSchema = z5.discriminatedUnion("kind", [
|
|
1188
|
+
provenanceDocNodeSchema,
|
|
1189
|
+
provenanceTaskNodeSchema,
|
|
1190
|
+
provenanceDecisionNodeSchema,
|
|
1191
|
+
provenanceSessionNodeSchema,
|
|
1192
|
+
provenanceMemoryNodeSchema
|
|
1193
|
+
]);
|
|
1194
|
+
provenanceEdgeSchema = z5.object({
|
|
1195
|
+
relation: provenanceEdgeRelationSchema,
|
|
1196
|
+
from: z5.string().min(1),
|
|
1197
|
+
fromKind: provenanceNodeKindSchema,
|
|
1198
|
+
to: z5.string().min(1),
|
|
1199
|
+
toKind: provenanceNodeKindSchema,
|
|
1200
|
+
addedAt: z5.string().min(1),
|
|
1201
|
+
summary: z5.string().optional()
|
|
1202
|
+
});
|
|
1203
|
+
docProvenanceResponseSchema = z5.object({
|
|
1204
|
+
nodes: z5.array(provenanceNodeSchema).readonly(),
|
|
1205
|
+
edges: z5.array(provenanceEdgeSchema).readonly(),
|
|
1206
|
+
totalNodes: z5.number().int().nonnegative(),
|
|
1207
|
+
totalEdges: z5.number().int().nonnegative()
|
|
1208
|
+
});
|
|
1209
|
+
}
|
|
1210
|
+
});
|
|
1211
|
+
|
|
1061
1212
|
// packages/contracts/src/docs-taxonomy.ts
|
|
1062
1213
|
var BUILTIN_DOC_KINDS, BUILTIN_DOC_KIND_VALUES;
|
|
1063
1214
|
var init_docs_taxonomy = __esm({
|
|
@@ -1071,7 +1222,8 @@ var init_docs_taxonomy = __esm({
|
|
|
1071
1222
|
defaultOwnerKind: "task",
|
|
1072
1223
|
publishDir: "docs/adr",
|
|
1073
1224
|
requiresEntityId: true,
|
|
1074
|
-
entityIdPattern: /^adr-\d{3,4}-[a-z0-9-]
|
|
1225
|
+
entityIdPattern: /^adr-\d{3,4}-[a-z0-9-]+$/,
|
|
1226
|
+
requiredSections: ["Status", "Date", "Context", "Decision", "Consequences"]
|
|
1075
1227
|
},
|
|
1076
1228
|
{
|
|
1077
1229
|
kind: "spec",
|
|
@@ -1079,7 +1231,8 @@ var init_docs_taxonomy = __esm({
|
|
|
1079
1231
|
description: "Technical specification",
|
|
1080
1232
|
defaultOwnerKind: "task",
|
|
1081
1233
|
publishDir: "docs/spec",
|
|
1082
|
-
requiresEntityId: false
|
|
1234
|
+
requiresEntityId: false,
|
|
1235
|
+
requiredSections: ["Goal", "Non-Goals", "Requirements", "Out-of-Scope"]
|
|
1083
1236
|
},
|
|
1084
1237
|
{
|
|
1085
1238
|
kind: "research",
|
|
@@ -1087,7 +1240,8 @@ var init_docs_taxonomy = __esm({
|
|
|
1087
1240
|
description: "Investigation / research note",
|
|
1088
1241
|
defaultOwnerKind: "task",
|
|
1089
1242
|
publishDir: "docs/research",
|
|
1090
|
-
requiresEntityId: false
|
|
1243
|
+
requiresEntityId: false,
|
|
1244
|
+
requiredSections: ["Question", "Findings", "Sources"]
|
|
1091
1245
|
},
|
|
1092
1246
|
{
|
|
1093
1247
|
kind: "handoff",
|
|
@@ -1095,7 +1249,8 @@ var init_docs_taxonomy = __esm({
|
|
|
1095
1249
|
description: "Session / agent handoff",
|
|
1096
1250
|
defaultOwnerKind: "session",
|
|
1097
1251
|
publishDir: "docs/handoff",
|
|
1098
|
-
requiresEntityId: false
|
|
1252
|
+
requiresEntityId: false,
|
|
1253
|
+
requiredSections: ["Context", "State", "Next-Steps"]
|
|
1099
1254
|
},
|
|
1100
1255
|
{
|
|
1101
1256
|
kind: "note",
|
|
@@ -1103,7 +1258,8 @@ var init_docs_taxonomy = __esm({
|
|
|
1103
1258
|
description: "Agent observation / informal note",
|
|
1104
1259
|
defaultOwnerKind: "observation",
|
|
1105
1260
|
publishDir: "docs/note",
|
|
1106
|
-
requiresEntityId: false
|
|
1261
|
+
requiresEntityId: false,
|
|
1262
|
+
requiredSections: []
|
|
1107
1263
|
},
|
|
1108
1264
|
{
|
|
1109
1265
|
kind: "llm-readme",
|
|
@@ -1111,7 +1267,8 @@ var init_docs_taxonomy = __esm({
|
|
|
1111
1267
|
description: "Machine-readable README (llms.txt)",
|
|
1112
1268
|
defaultOwnerKind: "project",
|
|
1113
1269
|
publishDir: ".",
|
|
1114
|
-
requiresEntityId: false
|
|
1270
|
+
requiresEntityId: false,
|
|
1271
|
+
requiredSections: []
|
|
1115
1272
|
},
|
|
1116
1273
|
{
|
|
1117
1274
|
kind: "changeset",
|
|
@@ -1120,7 +1277,8 @@ var init_docs_taxonomy = __esm({
|
|
|
1120
1277
|
defaultOwnerKind: "task",
|
|
1121
1278
|
publishDir: ".changeset",
|
|
1122
1279
|
requiresEntityId: true,
|
|
1123
|
-
entityIdPattern: /^t\d+-[a-z0-9-]
|
|
1280
|
+
entityIdPattern: /^t\d+-[a-z0-9-]+$/,
|
|
1281
|
+
requiredSections: []
|
|
1124
1282
|
},
|
|
1125
1283
|
{
|
|
1126
1284
|
kind: "release-note",
|
|
@@ -1129,7 +1287,8 @@ var init_docs_taxonomy = __esm({
|
|
|
1129
1287
|
defaultOwnerKind: "project",
|
|
1130
1288
|
publishDir: "docs/release",
|
|
1131
1289
|
requiresEntityId: true,
|
|
1132
|
-
entityIdPattern: /^v\d{4}\.\d+\.\d+(-[a-z0-9-]+)
|
|
1290
|
+
entityIdPattern: /^v\d{4}\.\d+\.\d+(-[a-z0-9-]+)?$/,
|
|
1291
|
+
requiredSections: ["Changes", "Migration"]
|
|
1133
1292
|
},
|
|
1134
1293
|
{
|
|
1135
1294
|
kind: "plan",
|
|
@@ -1137,7 +1296,8 @@ var init_docs_taxonomy = __esm({
|
|
|
1137
1296
|
description: "Epic / saga decomposition plan",
|
|
1138
1297
|
defaultOwnerKind: "task",
|
|
1139
1298
|
publishDir: "docs/plan",
|
|
1140
|
-
requiresEntityId: false
|
|
1299
|
+
requiresEntityId: false,
|
|
1300
|
+
requiredSections: ["Goal", "Steps", "Owners"]
|
|
1141
1301
|
},
|
|
1142
1302
|
{
|
|
1143
1303
|
kind: "rcasd",
|
|
@@ -1146,7 +1306,8 @@ var init_docs_taxonomy = __esm({
|
|
|
1146
1306
|
defaultOwnerKind: "task",
|
|
1147
1307
|
publishDir: ".cleo/rcasd",
|
|
1148
1308
|
requiresEntityId: true,
|
|
1149
|
-
entityIdPattern: /^t\d+(-.+)
|
|
1309
|
+
entityIdPattern: /^t\d+(-.+)?$/,
|
|
1310
|
+
requiredSections: ["Root-Cause", "Action", "Schedule", "Detection"]
|
|
1150
1311
|
}
|
|
1151
1312
|
];
|
|
1152
1313
|
BUILTIN_DOC_KIND_VALUES = Object.freeze(
|
|
@@ -1196,59 +1357,139 @@ var init_errors = __esm({
|
|
|
1196
1357
|
}
|
|
1197
1358
|
});
|
|
1198
1359
|
|
|
1360
|
+
// packages/contracts/src/evidence-atom-schema.ts
|
|
1361
|
+
import { z as z6 } from "zod";
|
|
1362
|
+
var commitAtomSchema, filesAtomSchema, testRunAtomSchema, toolAtomSchema, urlAtomSchema, noteAtomSchema, decisionAtomSchema, prAtomSchema, locDropAtomSchema, callsiteCoverageAtomSchema, EvidenceAtomSchema, GATE_EVIDENCE_REQUIREMENTS;
|
|
1363
|
+
var init_evidence_atom_schema = __esm({
|
|
1364
|
+
"packages/contracts/src/evidence-atom-schema.ts"() {
|
|
1365
|
+
"use strict";
|
|
1366
|
+
commitAtomSchema = z6.object({
|
|
1367
|
+
kind: z6.literal("commit"),
|
|
1368
|
+
sha: z6.string().regex(/^[0-9a-f]{7,40}$/i, "commit sha must be 7-40 hex characters")
|
|
1369
|
+
});
|
|
1370
|
+
filesAtomSchema = z6.object({
|
|
1371
|
+
kind: z6.literal("files"),
|
|
1372
|
+
paths: z6.array(z6.string().min(1)).min(1, "files atom requires at least one path")
|
|
1373
|
+
});
|
|
1374
|
+
testRunAtomSchema = z6.object({
|
|
1375
|
+
kind: z6.literal("test-run"),
|
|
1376
|
+
path: z6.string().min(1, "test-run atom requires a non-empty path")
|
|
1377
|
+
});
|
|
1378
|
+
toolAtomSchema = z6.object({
|
|
1379
|
+
kind: z6.literal("tool"),
|
|
1380
|
+
tool: z6.string().min(1, "tool atom requires a non-empty tool name")
|
|
1381
|
+
});
|
|
1382
|
+
urlAtomSchema = z6.object({
|
|
1383
|
+
kind: z6.literal("url"),
|
|
1384
|
+
url: z6.string().min(1).regex(/^https?:\/\//, "url atom must start with http:// or https://")
|
|
1385
|
+
});
|
|
1386
|
+
noteAtomSchema = z6.object({
|
|
1387
|
+
kind: z6.literal("note"),
|
|
1388
|
+
note: z6.string().min(1, "note atom must be non-empty").max(512, "note atom is too long (max 512 chars)")
|
|
1389
|
+
});
|
|
1390
|
+
decisionAtomSchema = z6.object({
|
|
1391
|
+
kind: z6.literal("decision"),
|
|
1392
|
+
decisionId: z6.string().min(1, "decision atom requires a non-empty decision ID")
|
|
1393
|
+
});
|
|
1394
|
+
prAtomSchema = z6.object({
|
|
1395
|
+
kind: z6.literal("pr"),
|
|
1396
|
+
prNumber: z6.number().int().positive("pr atom requires a positive integer PR number")
|
|
1397
|
+
});
|
|
1398
|
+
locDropAtomSchema = z6.object({
|
|
1399
|
+
kind: z6.literal("loc-drop"),
|
|
1400
|
+
fromLines: z6.number().int().nonnegative("loc-drop fromLines must be \u2265 0"),
|
|
1401
|
+
toLines: z6.number().int().nonnegative("loc-drop toLines must be \u2265 0")
|
|
1402
|
+
});
|
|
1403
|
+
callsiteCoverageAtomSchema = z6.object({
|
|
1404
|
+
kind: z6.literal("callsite-coverage"),
|
|
1405
|
+
symbolName: z6.string().min(1, "callsite-coverage atom requires a non-empty symbolName"),
|
|
1406
|
+
relativeSourcePath: z6.string().min(1, "callsite-coverage atom requires a non-empty relativeSourcePath")
|
|
1407
|
+
});
|
|
1408
|
+
EvidenceAtomSchema = z6.discriminatedUnion("kind", [
|
|
1409
|
+
commitAtomSchema,
|
|
1410
|
+
filesAtomSchema,
|
|
1411
|
+
testRunAtomSchema,
|
|
1412
|
+
toolAtomSchema,
|
|
1413
|
+
urlAtomSchema,
|
|
1414
|
+
noteAtomSchema,
|
|
1415
|
+
decisionAtomSchema,
|
|
1416
|
+
prAtomSchema,
|
|
1417
|
+
locDropAtomSchema,
|
|
1418
|
+
callsiteCoverageAtomSchema
|
|
1419
|
+
]);
|
|
1420
|
+
GATE_EVIDENCE_REQUIREMENTS = Object.freeze({
|
|
1421
|
+
implemented: {
|
|
1422
|
+
oneOf: [
|
|
1423
|
+
["commit", "files"],
|
|
1424
|
+
["commit", "note"],
|
|
1425
|
+
["decision", "files"],
|
|
1426
|
+
["decision", "note"],
|
|
1427
|
+
["pr"]
|
|
1428
|
+
]
|
|
1429
|
+
},
|
|
1430
|
+
testsPassed: { oneOf: [["test-run"], ["tool"], ["pr"]] },
|
|
1431
|
+
qaPassed: { oneOf: [["tool"], ["pr"]] },
|
|
1432
|
+
documented: { oneOf: [["files"], ["url"]] },
|
|
1433
|
+
securityPassed: { oneOf: [["tool"], ["note"]] },
|
|
1434
|
+
cleanupDone: { oneOf: [["note"]] },
|
|
1435
|
+
nexusImpact: { oneOf: [["tool"], ["note"]] }
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1438
|
+
});
|
|
1439
|
+
|
|
1199
1440
|
// packages/contracts/src/evidence-record-schema.ts
|
|
1200
|
-
import { z as
|
|
1441
|
+
import { z as z7 } from "zod";
|
|
1201
1442
|
var evidenceBaseSchema, implDiffRecordSchema, validateSpecCheckRecordSchema, testOutputRecordSchema, lintReportRecordSchema, commandOutputRecordSchema, evidenceRecordSchema;
|
|
1202
1443
|
var init_evidence_record_schema = __esm({
|
|
1203
1444
|
"packages/contracts/src/evidence-record-schema.ts"() {
|
|
1204
1445
|
"use strict";
|
|
1205
|
-
evidenceBaseSchema =
|
|
1446
|
+
evidenceBaseSchema = z7.object({
|
|
1206
1447
|
/** Identity string of the agent that produced this record. */
|
|
1207
|
-
agentIdentity:
|
|
1448
|
+
agentIdentity: z7.string().min(1),
|
|
1208
1449
|
/** SHA-256 hex digest (64 chars) of the attached artifact. */
|
|
1209
|
-
attachmentSha256:
|
|
1450
|
+
attachmentSha256: z7.string().length(64),
|
|
1210
1451
|
/** ISO 8601 timestamp at which the action ran. */
|
|
1211
|
-
ranAt:
|
|
1452
|
+
ranAt: z7.string().datetime(),
|
|
1212
1453
|
/** Wall-clock duration of the action in milliseconds. */
|
|
1213
|
-
durationMs:
|
|
1454
|
+
durationMs: z7.number().nonnegative()
|
|
1214
1455
|
});
|
|
1215
1456
|
implDiffRecordSchema = evidenceBaseSchema.extend({
|
|
1216
|
-
kind:
|
|
1217
|
-
phase:
|
|
1218
|
-
filesChanged:
|
|
1219
|
-
linesAdded:
|
|
1220
|
-
linesRemoved:
|
|
1457
|
+
kind: z7.literal("impl-diff"),
|
|
1458
|
+
phase: z7.literal("implement"),
|
|
1459
|
+
filesChanged: z7.array(z7.string().min(1)).min(1),
|
|
1460
|
+
linesAdded: z7.number().int().nonnegative(),
|
|
1461
|
+
linesRemoved: z7.number().int().nonnegative()
|
|
1221
1462
|
});
|
|
1222
1463
|
validateSpecCheckRecordSchema = evidenceBaseSchema.extend({
|
|
1223
|
-
kind:
|
|
1224
|
-
phase:
|
|
1225
|
-
reqIdsChecked:
|
|
1226
|
-
passed:
|
|
1227
|
-
details:
|
|
1464
|
+
kind: z7.literal("validate-spec-check"),
|
|
1465
|
+
phase: z7.literal("validate"),
|
|
1466
|
+
reqIdsChecked: z7.array(z7.string().min(1)).min(1),
|
|
1467
|
+
passed: z7.boolean(),
|
|
1468
|
+
details: z7.string().min(1)
|
|
1228
1469
|
});
|
|
1229
1470
|
testOutputRecordSchema = evidenceBaseSchema.extend({
|
|
1230
|
-
kind:
|
|
1231
|
-
phase:
|
|
1232
|
-
command:
|
|
1233
|
-
exitCode:
|
|
1234
|
-
testsPassed:
|
|
1235
|
-
testsFailed:
|
|
1471
|
+
kind: z7.literal("test-output"),
|
|
1472
|
+
phase: z7.literal("test"),
|
|
1473
|
+
command: z7.string().min(1),
|
|
1474
|
+
exitCode: z7.number().int(),
|
|
1475
|
+
testsPassed: z7.number().int().nonnegative(),
|
|
1476
|
+
testsFailed: z7.number().int().nonnegative()
|
|
1236
1477
|
});
|
|
1237
1478
|
lintReportRecordSchema = evidenceBaseSchema.extend({
|
|
1238
|
-
kind:
|
|
1239
|
-
phase:
|
|
1240
|
-
tool:
|
|
1241
|
-
passed:
|
|
1242
|
-
warnings:
|
|
1243
|
-
errors:
|
|
1479
|
+
kind: z7.literal("lint-report"),
|
|
1480
|
+
phase: z7.enum(["implement", "test"]),
|
|
1481
|
+
tool: z7.string().min(1),
|
|
1482
|
+
passed: z7.boolean(),
|
|
1483
|
+
warnings: z7.number().int().nonnegative(),
|
|
1484
|
+
errors: z7.number().int().nonnegative()
|
|
1244
1485
|
});
|
|
1245
1486
|
commandOutputRecordSchema = evidenceBaseSchema.extend({
|
|
1246
|
-
kind:
|
|
1247
|
-
phase:
|
|
1248
|
-
cmd:
|
|
1249
|
-
exitCode:
|
|
1487
|
+
kind: z7.literal("command-output"),
|
|
1488
|
+
phase: z7.enum(["implement", "validate", "test"]),
|
|
1489
|
+
cmd: z7.string().min(1),
|
|
1490
|
+
exitCode: z7.number().int()
|
|
1250
1491
|
});
|
|
1251
|
-
evidenceRecordSchema =
|
|
1492
|
+
evidenceRecordSchema = z7.discriminatedUnion("kind", [
|
|
1252
1493
|
implDiffRecordSchema,
|
|
1253
1494
|
validateSpecCheckRecordSchema,
|
|
1254
1495
|
testOutputRecordSchema,
|
|
@@ -1272,6 +1513,458 @@ var init_graph = __esm({
|
|
|
1272
1513
|
}
|
|
1273
1514
|
});
|
|
1274
1515
|
|
|
1516
|
+
// packages/contracts/src/invariants/adr-056-release.ts
|
|
1517
|
+
var ARCHIVE_REASON_MODULE, RELEASE_INVARIANTS_REGISTRY_MODULE, RELEASE_COMMIT_MSG_HOOK, ADR_056_INVARIANTS;
|
|
1518
|
+
var init_adr_056_release = __esm({
|
|
1519
|
+
"packages/contracts/src/invariants/adr-056-release.ts"() {
|
|
1520
|
+
"use strict";
|
|
1521
|
+
ARCHIVE_REASON_MODULE = "packages/contracts/src/tasks/archive.ts";
|
|
1522
|
+
RELEASE_INVARIANTS_REGISTRY_MODULE = "packages/core/src/release/invariants/registry.ts";
|
|
1523
|
+
RELEASE_COMMIT_MSG_HOOK = "scripts/hooks/commit-msg-release-lint.mjs";
|
|
1524
|
+
ADR_056_INVARIANTS = Object.freeze([
|
|
1525
|
+
{
|
|
1526
|
+
adr: "ADR-056",
|
|
1527
|
+
code: "D1",
|
|
1528
|
+
name: "Database topology: keep per-domain split",
|
|
1529
|
+
description: "CLEO retains the six per-domain SQLite databases (tasks, brain, conduit, nexus, signaldock, telemetry) documented in DATABASE-ERDS.md. Consolidation is rejected to preserve per-DB WAL throughput, per-DB rollback granularity, and avoid single-writer contention during multi-agent waves.",
|
|
1530
|
+
severity: "info",
|
|
1531
|
+
// D1 is a topology decision; the absence of consolidation is its only
|
|
1532
|
+
// enforcement surface. No runtime guard, no lint script.
|
|
1533
|
+
runtimeGate: null,
|
|
1534
|
+
lintRule: null,
|
|
1535
|
+
doctorAudit: null,
|
|
1536
|
+
tests: []
|
|
1537
|
+
},
|
|
1538
|
+
{
|
|
1539
|
+
adr: "ADR-056",
|
|
1540
|
+
code: "D2",
|
|
1541
|
+
name: "Store-layer naming convention",
|
|
1542
|
+
description: "New always-on store-layer domains MUST use the kebab-case pair `packages/core/src/store/<domain>-schema.ts` (Drizzle defs) + `packages/core/src/store/<domain>-sqlite.ts` (open/init/CRUD). Opt-in / isolated domains MAY use the folder variant `packages/core/src/<domain>/{schema,sqlite}.ts` (currently telemetry only).",
|
|
1543
|
+
severity: "info",
|
|
1544
|
+
// D2 is a naming-convention decision; enforced by code review and the
|
|
1545
|
+
// ADR-073/ADR-056 doctor audit. No runtime guard.
|
|
1546
|
+
runtimeGate: null,
|
|
1547
|
+
lintRule: null,
|
|
1548
|
+
doctorAudit: null,
|
|
1549
|
+
tests: []
|
|
1550
|
+
},
|
|
1551
|
+
{
|
|
1552
|
+
adr: "ADR-056",
|
|
1553
|
+
code: "D3",
|
|
1554
|
+
name: "Migration runner SSoT under migration-manager.ts",
|
|
1555
|
+
description: "All six SQLite databases MUST be initialized via `packages/core/src/migration/migration-manager.ts` (`migrateWithRetry()` + `reconcileJournal()`). Per-DB bespoke runners are prohibited for new domains. Rust Diesel migrations for cloud signaldock-storage MUST NOT touch the local SQLite signaldock.db at runtime.",
|
|
1556
|
+
severity: "info",
|
|
1557
|
+
// D3 is enforced by the absence of bespoke runners — every domain's
|
|
1558
|
+
// `<domain>-sqlite.ts` open path delegates to migration-manager. No
|
|
1559
|
+
// single runtime guard; per-DB chokepoints are the enforcement surface.
|
|
1560
|
+
runtimeGate: null,
|
|
1561
|
+
lintRule: null,
|
|
1562
|
+
doctorAudit: null,
|
|
1563
|
+
tests: []
|
|
1564
|
+
},
|
|
1565
|
+
{
|
|
1566
|
+
adr: "ADR-056",
|
|
1567
|
+
code: "D4",
|
|
1568
|
+
name: "archiveReason 6-value enum with tombstone semantics",
|
|
1569
|
+
description: "The tasks.archive_reason column is constrained to exactly six values (verified, reconciled, superseded, shadowed, cancelled, completed-unverified) via SQLite CHECK constraint AND Zod z.enum validation. Writing 'completed-unverified' from non-migration code MUST throw E_ARCHIVE_REASON_TOMBSTONE \u2014 the tombstone is reserved for the T1408 backfill migration only.",
|
|
1570
|
+
severity: "error",
|
|
1571
|
+
runtimeGate: {
|
|
1572
|
+
module: ARCHIVE_REASON_MODULE,
|
|
1573
|
+
functionName: "assertArchiveReason"
|
|
1574
|
+
},
|
|
1575
|
+
lintRule: null,
|
|
1576
|
+
doctorAudit: null,
|
|
1577
|
+
tests: ["packages/contracts/src/tasks/__tests__/archive.test.ts"]
|
|
1578
|
+
},
|
|
1579
|
+
{
|
|
1580
|
+
adr: "ADR-056",
|
|
1581
|
+
code: "D5",
|
|
1582
|
+
name: "Post-release reconciliation: registry-driven cleo verify --release",
|
|
1583
|
+
description: "Post-release reconciliation flows through the executable invariants registry at packages/core/src/release/invariants/registry.ts. Customers register via registerInvariant() and the CLI runs every entry on `cleo verify --release <tag>`. First customer: archive-reason-invariant.ts (stamps verified tasks done; creates follow-up tasks for unverified references).",
|
|
1584
|
+
severity: "warning",
|
|
1585
|
+
runtimeGate: {
|
|
1586
|
+
module: RELEASE_INVARIANTS_REGISTRY_MODULE,
|
|
1587
|
+
functionName: "runInvariants"
|
|
1588
|
+
},
|
|
1589
|
+
lintRule: null,
|
|
1590
|
+
doctorAudit: null,
|
|
1591
|
+
tests: ["packages/core/src/release/invariants/__tests__/archive-reason-invariant.test.ts"]
|
|
1592
|
+
},
|
|
1593
|
+
{
|
|
1594
|
+
adr: "ADR-056",
|
|
1595
|
+
code: "D6",
|
|
1596
|
+
name: "Commit-message lint for release commits",
|
|
1597
|
+
description: "Every commit whose subject matches `^(chore|feat)\\(release\\):` MUST contain at least one `T\\d+` task reference in the commit body. Enforced by scripts/hooks/commit-msg-release-lint.mjs (T1410). Bypass via CLEO_OWNER_OVERRIDE=1 with audited justification.",
|
|
1598
|
+
severity: "info",
|
|
1599
|
+
// D6 is a CI-hook concern. The hook itself is the enforcement surface
|
|
1600
|
+
// — represented here via lintRule for cross-reference rendering.
|
|
1601
|
+
runtimeGate: null,
|
|
1602
|
+
lintRule: {
|
|
1603
|
+
lintScript: RELEASE_COMMIT_MSG_HOOK
|
|
1604
|
+
},
|
|
1605
|
+
doctorAudit: null,
|
|
1606
|
+
tests: []
|
|
1607
|
+
}
|
|
1608
|
+
]);
|
|
1609
|
+
}
|
|
1610
|
+
});
|
|
1611
|
+
|
|
1612
|
+
// packages/contracts/src/invariants/adr-070-orchestration.ts
|
|
1613
|
+
var THIN_AGENT_MODULE, SESSIONS_MODULE, WORKTREE_CREATE_MODULE, CT_ORCHESTRATOR_SKILL, VALIDATE_SPAWN_MODULE, SKILL_VALIDATOR_TESTS, ADR_070_INVARIANTS, ADR_070_INVARIANT_COUNT;
|
|
1614
|
+
var init_adr_070_orchestration = __esm({
|
|
1615
|
+
"packages/contracts/src/invariants/adr-070-orchestration.ts"() {
|
|
1616
|
+
"use strict";
|
|
1617
|
+
THIN_AGENT_MODULE = "packages/core/src/orchestration/thin-agent.ts";
|
|
1618
|
+
SESSIONS_MODULE = "packages/core/src/sessions/index.ts";
|
|
1619
|
+
WORKTREE_CREATE_MODULE = "packages/worktree/src/worktree-create.ts";
|
|
1620
|
+
CT_ORCHESTRATOR_SKILL = "packages/skills/skills/ct-orchestrator/SKILL.md";
|
|
1621
|
+
VALIDATE_SPAWN_MODULE = "packages/core/src/orchestration/validate-spawn.ts";
|
|
1622
|
+
SKILL_VALIDATOR_TESTS = "packages/core/src/skills/orchestrator/__tests__/validator.test.ts";
|
|
1623
|
+
ADR_070_INVARIANTS = Object.freeze([
|
|
1624
|
+
{
|
|
1625
|
+
adr: "ADR-070",
|
|
1626
|
+
code: "ORC-001",
|
|
1627
|
+
name: "Orchestrator is the HITL interface",
|
|
1628
|
+
description: "The Orchestrator (Cleo) is the single subagent that talks to the human operator. It plans, decomposes, and delegates \u2014 it never produces line-level implementation. Source-of-truth lives in ct-orchestrator/SKILL.md row ORC-001 and is injected into the Orchestrator prompt at spawn time. UNENFORCED at the dispatch layer: this is a prompt-time invariant with no runtime guard today.",
|
|
1629
|
+
severity: "warning",
|
|
1630
|
+
runtimeGate: null,
|
|
1631
|
+
lintRule: null,
|
|
1632
|
+
doctorAudit: null,
|
|
1633
|
+
tests: [CT_ORCHESTRATOR_SKILL]
|
|
1634
|
+
},
|
|
1635
|
+
{
|
|
1636
|
+
adr: "ADR-070",
|
|
1637
|
+
code: "ORC-002",
|
|
1638
|
+
name: "Orchestrator MUST NOT write or edit code",
|
|
1639
|
+
description: "Every line of code is written by a spawned subagent. The Orchestrator delegates implementation work via cleo orchestrate spawn / delegate_task. UNENFORCED at the dispatch layer: this is a prompt-time invariant \u2014 there is no runtime gate that blocks the Orchestrator from calling Edit/Write, so the contract is held by the ct-orchestrator skill text.",
|
|
1640
|
+
severity: "warning",
|
|
1641
|
+
runtimeGate: null,
|
|
1642
|
+
lintRule: null,
|
|
1643
|
+
doctorAudit: null,
|
|
1644
|
+
tests: [CT_ORCHESTRATOR_SKILL]
|
|
1645
|
+
},
|
|
1646
|
+
{
|
|
1647
|
+
adr: "ADR-070",
|
|
1648
|
+
code: "ORC-003",
|
|
1649
|
+
name: "Orchestrator MUST NOT read full source files",
|
|
1650
|
+
description: "Orchestrator reads only pipeline manifests, task envelopes, and rolled-up phase summaries returned by Phase Leads. Workers read code; the Orchestrator reads summaries. UNENFORCED at the dispatch layer \u2014 held by the ct-orchestrator skill text and reinforced by ORC-005 budget pressure.",
|
|
1651
|
+
severity: "warning",
|
|
1652
|
+
runtimeGate: null,
|
|
1653
|
+
lintRule: null,
|
|
1654
|
+
doctorAudit: null,
|
|
1655
|
+
tests: [CT_ORCHESTRATOR_SKILL]
|
|
1656
|
+
},
|
|
1657
|
+
{
|
|
1658
|
+
adr: "ADR-070",
|
|
1659
|
+
code: "ORC-004",
|
|
1660
|
+
name: "Dependency-ordered spawning",
|
|
1661
|
+
description: "Spawns within a wave are ordered by task.depends \u2014 a Worker MUST NOT be dispatched until its declared dependencies are status=done. Surfaced by validateSpawnReadiness via V_MISSING_DEP / V_UNMET_DEP codes; surfaced by the skill-orchestrator validator via the ORC-004_DEPENDENCY_ORDER warning emitted from packages/core/src/skills/orchestrator/validator.ts. Tier: warning because the validator surfaces ordering issues but does not throw \u2014 workers can still proceed if the operator overrides.",
|
|
1662
|
+
severity: "warning",
|
|
1663
|
+
runtimeGate: {
|
|
1664
|
+
module: VALIDATE_SPAWN_MODULE,
|
|
1665
|
+
functionName: "validateSpawnReadiness"
|
|
1666
|
+
},
|
|
1667
|
+
lintRule: null,
|
|
1668
|
+
doctorAudit: null,
|
|
1669
|
+
tests: [
|
|
1670
|
+
"packages/core/src/orchestration/__tests__/validate-spawn.test.ts",
|
|
1671
|
+
SKILL_VALIDATOR_TESTS
|
|
1672
|
+
]
|
|
1673
|
+
},
|
|
1674
|
+
{
|
|
1675
|
+
adr: "ADR-070",
|
|
1676
|
+
code: "ORC-005",
|
|
1677
|
+
name: "Orchestrator context budget \u2248 10 K tokens",
|
|
1678
|
+
description: "The Orchestrator MUST keep its working context under ~10 K tokens; delegate at 80 %. Surfaced by cleo orchestrate context (estimateContext) and by the skill-orchestrator validator (ORC-005_NO_MANIFEST / ORC-005_EMPTY_MANIFEST). UNENFORCED as a hard gate \u2014 the budget is advisory, surfaced to the Orchestrator as a warning so the human operator can intervene.",
|
|
1679
|
+
severity: "warning",
|
|
1680
|
+
runtimeGate: {
|
|
1681
|
+
module: "packages/core/src/orchestration/context.ts",
|
|
1682
|
+
functionName: "estimateContext"
|
|
1683
|
+
},
|
|
1684
|
+
lintRule: null,
|
|
1685
|
+
doctorAudit: null,
|
|
1686
|
+
tests: ["packages/core/src/orchestration/__tests__/"]
|
|
1687
|
+
},
|
|
1688
|
+
{
|
|
1689
|
+
adr: "ADR-070",
|
|
1690
|
+
code: "ORC-006",
|
|
1691
|
+
name: "Worker scope \u2264 3 files per spawn",
|
|
1692
|
+
description: "Cross-file reasoning quality degrades beyond ~3 files for a single Worker. Enforced at spawn-time by validateSpawnReadiness \u2014 V_ATOMIC_SCOPE_MISSING when task.files is empty, V_ATOMIC_SCOPE_TOO_LARGE when files.length > MAX_WORKER_FILES (currently 3). Spawn-prompt builder injects a Worker Budget Constraints section so the Worker sees the budget inline. Tier: error because the gate refuses to spawn an over-scoped Worker.",
|
|
1693
|
+
severity: "error",
|
|
1694
|
+
runtimeGate: {
|
|
1695
|
+
module: VALIDATE_SPAWN_MODULE,
|
|
1696
|
+
functionName: "validateSpawnReadiness"
|
|
1697
|
+
},
|
|
1698
|
+
lintRule: null,
|
|
1699
|
+
doctorAudit: null,
|
|
1700
|
+
tests: [
|
|
1701
|
+
"packages/core/src/orchestration/__tests__/validate-spawn.test.ts",
|
|
1702
|
+
"packages/core/src/orchestration/__tests__/spawn-prompt.test.ts"
|
|
1703
|
+
]
|
|
1704
|
+
},
|
|
1705
|
+
{
|
|
1706
|
+
adr: "ADR-070",
|
|
1707
|
+
code: "ORC-007",
|
|
1708
|
+
name: "All work traced to an Epic",
|
|
1709
|
+
description: "Every Task and Subtask MUST attach to a parent Epic (directly or transitively). No orphan work \u2014 orphans are filed against the ADR-066 acceptance-criteria gate and surface via cleo find. UNENFORCED at the dispatch layer; the parent-id requirement is materialised through cleo add validation rather than a single ORC-named guard. R6 doctor audit should walk the task graph to surface orphans.",
|
|
1710
|
+
severity: "warning",
|
|
1711
|
+
runtimeGate: null,
|
|
1712
|
+
lintRule: null,
|
|
1713
|
+
doctorAudit: null,
|
|
1714
|
+
tests: [CT_ORCHESTRATOR_SKILL]
|
|
1715
|
+
},
|
|
1716
|
+
{
|
|
1717
|
+
adr: "ADR-070",
|
|
1718
|
+
code: "ORC-008",
|
|
1719
|
+
name: "Zero architectural decisions during execution",
|
|
1720
|
+
description: "Architectural choices MUST be pre-decided via RCASD consensus or HITL \u2014 never inside a worker session. UNENFORCED at the dispatch layer: this is a behavioural invariant held by the ct-orchestrator skill text plus the ADR-066 acceptance criterion that every task must declare its architecture-relevant decisions before spawn.",
|
|
1721
|
+
severity: "warning",
|
|
1722
|
+
runtimeGate: null,
|
|
1723
|
+
lintRule: null,
|
|
1724
|
+
doctorAudit: null,
|
|
1725
|
+
tests: [CT_ORCHESTRATOR_SKILL]
|
|
1726
|
+
},
|
|
1727
|
+
{
|
|
1728
|
+
adr: "ADR-070",
|
|
1729
|
+
code: "ORC-009",
|
|
1730
|
+
name: "Manifest-mediated handoffs",
|
|
1731
|
+
description: "Orchestrator reads only the key_findings field of pipeline_manifest rows when reconciling worker output. Subagents read the full task description and supporting files. UNENFORCED at the dispatch layer: the contract is held by the ct-orchestrator skill text and reinforced by ORC-003 + ORC-005 budget pressure.",
|
|
1732
|
+
severity: "warning",
|
|
1733
|
+
runtimeGate: null,
|
|
1734
|
+
lintRule: null,
|
|
1735
|
+
doctorAudit: null,
|
|
1736
|
+
tests: [CT_ORCHESTRATOR_SKILL]
|
|
1737
|
+
},
|
|
1738
|
+
{
|
|
1739
|
+
adr: "ADR-070",
|
|
1740
|
+
code: "ORC-010",
|
|
1741
|
+
name: "Lead-interposition required for Epic-child Workers",
|
|
1742
|
+
description: "A Worker spawn against a Task whose parent is type=epic MUST be preceded by a Lead spawn for the same Task (ADR-083 \xA72.4 / \xA76). The intended runtime gate (composeSpawnPayload throwing E_LEAD_REQUIRED_FOR_EPIC_CHILD) is FILED but UNSHIPPED \u2014 tracked under T10278. Registered here as a warning + runtimeGate:null so the gap is visible in the R6 doctor audit.",
|
|
1743
|
+
severity: "warning",
|
|
1744
|
+
runtimeGate: null,
|
|
1745
|
+
lintRule: null,
|
|
1746
|
+
doctorAudit: null,
|
|
1747
|
+
tests: []
|
|
1748
|
+
},
|
|
1749
|
+
{
|
|
1750
|
+
adr: "ADR-070",
|
|
1751
|
+
code: "ORC-011",
|
|
1752
|
+
name: "Orchestrator-depth cap at 3",
|
|
1753
|
+
description: "Recursive Orchestrator spawns (Cleo \u2192 sub-Orchestrator \u2192 sub-Orchestrator \u2192 \u2026) MUST stop at depth 3 (ADR-083 \xA72.2 + \xA72.4). The intended runtime gate (composeSpawnPayload throwing E_ORCHESTRATOR_DEPTH_EXCEEDED) is FILED but UNSHIPPED \u2014 tracked under T10279. Registered here as a warning + runtimeGate:null so the gap is visible in the R6 doctor audit.",
|
|
1754
|
+
severity: "warning",
|
|
1755
|
+
runtimeGate: null,
|
|
1756
|
+
lintRule: null,
|
|
1757
|
+
doctorAudit: null,
|
|
1758
|
+
tests: []
|
|
1759
|
+
},
|
|
1760
|
+
{
|
|
1761
|
+
adr: "ADR-070",
|
|
1762
|
+
code: "ORC-012",
|
|
1763
|
+
name: "Thin-agent inversion-of-control",
|
|
1764
|
+
description: "Workers MUST NOT spawn other subagents. The spawn-capable tools (Agent / Task / TaskCreate) are stripped from the Worker tool list at .cant compile time, and any survivor at spawn time triggers ThinAgentViolationError \u2192 E_THIN_AGENT_VIOLATION (exit 68). The only ORC rule with a hard-enforced dispatch-time gate today.",
|
|
1765
|
+
severity: "error",
|
|
1766
|
+
runtimeGate: {
|
|
1767
|
+
module: THIN_AGENT_MODULE,
|
|
1768
|
+
functionName: "enforceThinAgent"
|
|
1769
|
+
},
|
|
1770
|
+
lintRule: null,
|
|
1771
|
+
doctorAudit: null,
|
|
1772
|
+
tests: [
|
|
1773
|
+
"packages/core/src/orchestration/__tests__/thin-agent.test.ts",
|
|
1774
|
+
"packages/cant/src/__tests__/hierarchy.test.ts"
|
|
1775
|
+
]
|
|
1776
|
+
},
|
|
1777
|
+
{
|
|
1778
|
+
adr: "ADR-070",
|
|
1779
|
+
code: "ORC-013",
|
|
1780
|
+
name: "Worktree provisioning at canonical XDG location",
|
|
1781
|
+
description: "Every agent worktree MUST be created under <cleoHome>/worktrees/<projectHash>/<taskId>/ (ADR-055 + Council D009). createWorktree throws E_WT_LOCATION_FORBIDDEN before any git worktree add call when the computed path falls outside the canonical root. CI gate lint-worktree-location.mjs enforces the same invariant on every PR. The single-most-load-bearing orchestration guard after ORC-012.",
|
|
1782
|
+
severity: "error",
|
|
1783
|
+
runtimeGate: {
|
|
1784
|
+
module: WORKTREE_CREATE_MODULE,
|
|
1785
|
+
functionName: "assertCanonicalWorktreeLocation"
|
|
1786
|
+
},
|
|
1787
|
+
lintRule: {
|
|
1788
|
+
lintScript: "scripts/lint-worktree-location.mjs"
|
|
1789
|
+
},
|
|
1790
|
+
doctorAudit: null,
|
|
1791
|
+
tests: ["packages/worktree/src/__tests__/"]
|
|
1792
|
+
},
|
|
1793
|
+
{
|
|
1794
|
+
adr: "ADR-070",
|
|
1795
|
+
code: "ORC-014",
|
|
1796
|
+
name: "Lead-bypass detection at session end",
|
|
1797
|
+
description: "A Lead session (CLEO_AGENT_ROLE=lead) that ends with tasks_completed > 0 AND delegate_task_count = 0 is rejected with LeadBypassDetectedError \u2192 E_LEAD_BYPASS_DETECTED (exit 107). Leads MUST fan out work to Workers; a Lead that did the work itself defeats the three-tier topology. Override via CLEO_OWNER_OVERRIDE=1 (audited to force-bypass.jsonl).",
|
|
1798
|
+
severity: "error",
|
|
1799
|
+
runtimeGate: {
|
|
1800
|
+
module: SESSIONS_MODULE,
|
|
1801
|
+
functionName: "endSession"
|
|
1802
|
+
},
|
|
1803
|
+
lintRule: null,
|
|
1804
|
+
doctorAudit: null,
|
|
1805
|
+
tests: ["packages/core/src/sessions/__tests__/"]
|
|
1806
|
+
}
|
|
1807
|
+
]);
|
|
1808
|
+
ADR_070_INVARIANT_COUNT = ADR_070_INVARIANTS.length;
|
|
1809
|
+
}
|
|
1810
|
+
});
|
|
1811
|
+
|
|
1812
|
+
// packages/contracts/src/invariants/adr-073-saga.ts
|
|
1813
|
+
var SAGA_ENFORCEMENT_MODULE, SAGA_ENFORCEMENT_TESTS, ADR_073_INVARIANTS;
|
|
1814
|
+
var init_adr_073_saga = __esm({
|
|
1815
|
+
"packages/contracts/src/invariants/adr-073-saga.ts"() {
|
|
1816
|
+
"use strict";
|
|
1817
|
+
SAGA_ENFORCEMENT_MODULE = "packages/core/src/sagas/enforcement.ts";
|
|
1818
|
+
SAGA_ENFORCEMENT_TESTS = "packages/core/src/sagas/__tests__/enforcement.test.ts";
|
|
1819
|
+
ADR_073_INVARIANTS = Object.freeze([
|
|
1820
|
+
{
|
|
1821
|
+
adr: "ADR-073",
|
|
1822
|
+
code: "I1",
|
|
1823
|
+
name: "Storage uniformity",
|
|
1824
|
+
description: 'All task IDs are stored as T#### and the type column is the canonical tier discriminator. There is no separate ID space for Sagas, Epics, Tasks, or Subtasks; label="saga" elevates a type="epic" row to Saga semantics.',
|
|
1825
|
+
severity: "info",
|
|
1826
|
+
// I1 is enforced by the DB CHECK constraints introduced in W1.B (T10329)
|
|
1827
|
+
// and by TASK_ID_PATTERN in packages/core/src/tasks/id-generator.ts —
|
|
1828
|
+
// not by a single runtime function.
|
|
1829
|
+
runtimeGate: null,
|
|
1830
|
+
lintRule: null,
|
|
1831
|
+
doctorAudit: null,
|
|
1832
|
+
tests: ["packages/core/src/tasks/__tests__/id-generator.test.ts"]
|
|
1833
|
+
},
|
|
1834
|
+
{
|
|
1835
|
+
adr: "ADR-073",
|
|
1836
|
+
code: "I2",
|
|
1837
|
+
name: "Conceptual prefixes are display + import only",
|
|
1838
|
+
description: "SG-, E-, T- (and Subtask's implicit absence) are documentation, CLI display, and import-mapping conventions only. They MUST NOT be used as DB primary keys \u2014 display-only with no runtime enforcement.",
|
|
1839
|
+
severity: "info",
|
|
1840
|
+
// I2 is a display convention; the SG- prefix preservation snapshot
|
|
1841
|
+
// (T10333) protects the display contract but there is no runtime guard.
|
|
1842
|
+
runtimeGate: null,
|
|
1843
|
+
lintRule: null,
|
|
1844
|
+
doctorAudit: null,
|
|
1845
|
+
tests: []
|
|
1846
|
+
},
|
|
1847
|
+
{
|
|
1848
|
+
adr: "ADR-073",
|
|
1849
|
+
code: "I3",
|
|
1850
|
+
name: "Tier promotion mandatory when scope outgrows the tier",
|
|
1851
|
+
description: "A Subtask whose change exceeds 2 files or crosses a module boundary MUST be split or promoted to a sibling Task. A Task that requires more than one PR or wave MUST be split. An Epic that spans more than one release MUST be regrouped under a Saga.",
|
|
1852
|
+
severity: "error",
|
|
1853
|
+
runtimeGate: {
|
|
1854
|
+
module: SAGA_ENFORCEMENT_MODULE,
|
|
1855
|
+
functionName: "assertSagaInvariantI3"
|
|
1856
|
+
},
|
|
1857
|
+
lintRule: null,
|
|
1858
|
+
doctorAudit: null,
|
|
1859
|
+
tests: [SAGA_ENFORCEMENT_TESTS]
|
|
1860
|
+
},
|
|
1861
|
+
{
|
|
1862
|
+
adr: "ADR-073",
|
|
1863
|
+
code: "I4",
|
|
1864
|
+
name: "Ownership non-overlapping",
|
|
1865
|
+
description: "A single tier maps to a single orchestration role (per ADR-070). Workers MUST NOT spawn other Workers. Phase Leads MUST NOT own multiple Epics simultaneously. The Orchestrator MUST NOT spawn Workers directly when fan-out exceeds the ADR-070 migration threshold.",
|
|
1866
|
+
severity: "warning",
|
|
1867
|
+
// I4 is partially covered by ADR-070 spawn guards but the unification
|
|
1868
|
+
// with the registry happens in R2 (T10336 — ORC codes). For now this
|
|
1869
|
+
// entry stays warning + runtimeGate:null to mark the gap explicitly.
|
|
1870
|
+
runtimeGate: null,
|
|
1871
|
+
lintRule: null,
|
|
1872
|
+
doctorAudit: null,
|
|
1873
|
+
tests: []
|
|
1874
|
+
},
|
|
1875
|
+
{
|
|
1876
|
+
adr: "ADR-073",
|
|
1877
|
+
code: "I5",
|
|
1878
|
+
name: "Sagas link via groups, not parent",
|
|
1879
|
+
description: `task_relations.type="groups" is the ONLY relation type that links a Saga to its member Epics. The Saga row's parent_id MUST be NULL. Enforced at runtime by assertSagaInvariantI5 AND by the DB CHECK constraint from W1.B (T10329) on label="saga" rows.`,
|
|
1880
|
+
severity: "error",
|
|
1881
|
+
runtimeGate: {
|
|
1882
|
+
module: SAGA_ENFORCEMENT_MODULE,
|
|
1883
|
+
functionName: "assertSagaInvariantI5"
|
|
1884
|
+
},
|
|
1885
|
+
lintRule: null,
|
|
1886
|
+
doctorAudit: null,
|
|
1887
|
+
tests: [SAGA_ENFORCEMENT_TESTS]
|
|
1888
|
+
},
|
|
1889
|
+
{
|
|
1890
|
+
adr: "ADR-073",
|
|
1891
|
+
code: "I6",
|
|
1892
|
+
name: "Acceptance criteria required at every tier",
|
|
1893
|
+
description: 'Per ADR-066 \xA7"Ownership Matrix" invariant #5, all tasks regardless of type or kind MUST have --acceptance set at creation time. No tier exemption exists. Delegated to the ADR-066 --acceptance requirement on cleo add/add-batch.',
|
|
1894
|
+
severity: "warning",
|
|
1895
|
+
// I6 is enforced by ADR-066's CLI requirement, not by a saga runtime
|
|
1896
|
+
// function. UNENFORCED in the saga module — left as a warning so R6
|
|
1897
|
+
// doctor audit reminds operators of the upstream guard's location.
|
|
1898
|
+
runtimeGate: null,
|
|
1899
|
+
lintRule: null,
|
|
1900
|
+
doctorAudit: null,
|
|
1901
|
+
tests: []
|
|
1902
|
+
},
|
|
1903
|
+
{
|
|
1904
|
+
adr: "ADR-073",
|
|
1905
|
+
code: "I7",
|
|
1906
|
+
name: "Maximum parent depth is 3",
|
|
1907
|
+
description: "The parent ladder Subtask \u2192 Task \u2192 Epic is fixed at depth 3 (hierarchy.maxDepth=3). Sagas do NOT consume depth \u2014 they attach via groups relations, not parent edges. Enforced at runtime by assertSagaInvariantI7.",
|
|
1908
|
+
severity: "error",
|
|
1909
|
+
runtimeGate: {
|
|
1910
|
+
module: SAGA_ENFORCEMENT_MODULE,
|
|
1911
|
+
functionName: "assertSagaInvariantI7"
|
|
1912
|
+
},
|
|
1913
|
+
lintRule: null,
|
|
1914
|
+
doctorAudit: null,
|
|
1915
|
+
tests: [SAGA_ENFORCEMENT_TESTS]
|
|
1916
|
+
},
|
|
1917
|
+
{
|
|
1918
|
+
adr: "ADR-073",
|
|
1919
|
+
code: "I8",
|
|
1920
|
+
name: "Subtask-to-PR aggregation rule",
|
|
1921
|
+
description: "A Task ships as exactly one PR. The PR's commit history is the union of the Task's Subtask commits. A Subtask never produces its own PR; if a unit of work warrants its own PR, it is a Task, not a Subtask. UNENFORCED at runtime today \u2014 load-bearing convention enforced via code review and the lifecycle decision table.",
|
|
1922
|
+
severity: "warning",
|
|
1923
|
+
// I8 is explicitly "UNENFORCED, load-bearing" — there is no automated
|
|
1924
|
+
// gate. R6 doctor audit surfaces this entry so it stays visible.
|
|
1925
|
+
runtimeGate: null,
|
|
1926
|
+
lintRule: null,
|
|
1927
|
+
doctorAudit: null,
|
|
1928
|
+
tests: []
|
|
1929
|
+
}
|
|
1930
|
+
]);
|
|
1931
|
+
}
|
|
1932
|
+
});
|
|
1933
|
+
|
|
1934
|
+
// packages/contracts/src/invariants/index.ts
|
|
1935
|
+
function buildKey(invariant) {
|
|
1936
|
+
return `${invariant.adr}.${invariant.code}`;
|
|
1937
|
+
}
|
|
1938
|
+
function buildRegistry() {
|
|
1939
|
+
const entries = [
|
|
1940
|
+
...ADR_073_INVARIANTS,
|
|
1941
|
+
...ADR_056_INVARIANTS,
|
|
1942
|
+
...ADR_070_INVARIANTS
|
|
1943
|
+
];
|
|
1944
|
+
const record2 = {};
|
|
1945
|
+
for (const entry of entries) {
|
|
1946
|
+
const key = buildKey(entry);
|
|
1947
|
+
if (record2[key] !== void 0) {
|
|
1948
|
+
throw new Error(`Duplicate invariant key registered: ${key}`);
|
|
1949
|
+
}
|
|
1950
|
+
record2[key] = entry;
|
|
1951
|
+
}
|
|
1952
|
+
return Object.freeze(record2);
|
|
1953
|
+
}
|
|
1954
|
+
var INVARIANTS_REGISTRY;
|
|
1955
|
+
var init_invariants = __esm({
|
|
1956
|
+
"packages/contracts/src/invariants/index.ts"() {
|
|
1957
|
+
"use strict";
|
|
1958
|
+
init_adr_056_release();
|
|
1959
|
+
init_adr_070_orchestration();
|
|
1960
|
+
init_adr_073_saga();
|
|
1961
|
+
init_adr_056_release();
|
|
1962
|
+
init_adr_070_orchestration();
|
|
1963
|
+
init_adr_073_saga();
|
|
1964
|
+
INVARIANTS_REGISTRY = buildRegistry();
|
|
1965
|
+
}
|
|
1966
|
+
});
|
|
1967
|
+
|
|
1275
1968
|
// packages/contracts/src/lafs.ts
|
|
1276
1969
|
var init_lafs = __esm({
|
|
1277
1970
|
"packages/contracts/src/lafs.ts"() {
|
|
@@ -1540,31 +2233,31 @@ var init_peer = __esm({
|
|
|
1540
2233
|
});
|
|
1541
2234
|
|
|
1542
2235
|
// packages/contracts/src/release/evidence-atoms.ts
|
|
1543
|
-
import { z as
|
|
2236
|
+
import { z as z8 } from "zod";
|
|
1544
2237
|
var parsedPrEvidenceAtomSchema, prEvidenceStateModifierSchema, ghPrViewSchema, PR_REQUIRED_WORKFLOWS;
|
|
1545
2238
|
var init_evidence_atoms = __esm({
|
|
1546
2239
|
"packages/contracts/src/release/evidence-atoms.ts"() {
|
|
1547
2240
|
"use strict";
|
|
1548
|
-
parsedPrEvidenceAtomSchema =
|
|
1549
|
-
kind:
|
|
1550
|
-
prNumber:
|
|
1551
|
-
});
|
|
1552
|
-
prEvidenceStateModifierSchema =
|
|
1553
|
-
kind:
|
|
1554
|
-
value:
|
|
1555
|
-
});
|
|
1556
|
-
ghPrViewSchema =
|
|
1557
|
-
state:
|
|
1558
|
-
mergedAt:
|
|
1559
|
-
headRefOid:
|
|
1560
|
-
mergeable:
|
|
1561
|
-
statusCheckRollup:
|
|
1562
|
-
|
|
1563
|
-
__typename:
|
|
1564
|
-
name:
|
|
1565
|
-
workflowName:
|
|
1566
|
-
conclusion:
|
|
1567
|
-
status:
|
|
2241
|
+
parsedPrEvidenceAtomSchema = z8.object({
|
|
2242
|
+
kind: z8.literal("pr"),
|
|
2243
|
+
prNumber: z8.number().int().positive()
|
|
2244
|
+
});
|
|
2245
|
+
prEvidenceStateModifierSchema = z8.object({
|
|
2246
|
+
kind: z8.literal("state"),
|
|
2247
|
+
value: z8.literal("MERGED")
|
|
2248
|
+
});
|
|
2249
|
+
ghPrViewSchema = z8.object({
|
|
2250
|
+
state: z8.enum(["OPEN", "CLOSED", "MERGED"]),
|
|
2251
|
+
mergedAt: z8.string().nullable(),
|
|
2252
|
+
headRefOid: z8.string().optional(),
|
|
2253
|
+
mergeable: z8.string().optional(),
|
|
2254
|
+
statusCheckRollup: z8.array(
|
|
2255
|
+
z8.object({
|
|
2256
|
+
__typename: z8.string().optional(),
|
|
2257
|
+
name: z8.string().optional(),
|
|
2258
|
+
workflowName: z8.string().optional(),
|
|
2259
|
+
conclusion: z8.string().nullable().optional(),
|
|
2260
|
+
status: z8.string().optional()
|
|
1568
2261
|
}).passthrough()
|
|
1569
2262
|
).optional().default([])
|
|
1570
2263
|
}).passthrough();
|
|
@@ -1577,7 +2270,7 @@ var init_evidence_atoms = __esm({
|
|
|
1577
2270
|
});
|
|
1578
2271
|
|
|
1579
2272
|
// packages/contracts/src/release/plan.ts
|
|
1580
|
-
import { z as
|
|
2273
|
+
import { z as z9 } from "zod";
|
|
1581
2274
|
var RELEASE_CHANNEL, RELEASE_SCHEME, RELEASE_KIND, RELEASE_STATUS, GATE_STATUS, GATE_NAME, PLATFORM_TUPLE, PUBLISHER, TASK_KIND, IMPACT, RESOLVED_SOURCE, ReleaseChannelSchema, ReleaseSchemeSchema, ReleaseKindSchema, ReleaseStatusSchema, GateStatusSchema, GateNameSchema, PlatformTupleSchema, PublisherSchema, TaskKindSchema, ImpactSchema, ResolvedSourceSchema, Iso8601, NonEmptyString, ReleasePlanTaskSchema, ReleaseGateSchema, ReleasePlatformMatrixEntrySchema, ReleasePreflightSummarySchema, ReleasePlanChangelogSchema, ReleasePlanMetaSchema, ReleasePlanSchema;
|
|
1582
2275
|
var init_plan = __esm({
|
|
1583
2276
|
"packages/contracts/src/release/plan.ts"() {
|
|
@@ -1620,20 +2313,20 @@ var init_plan = __esm({
|
|
|
1620
2313
|
];
|
|
1621
2314
|
IMPACT = ["major", "minor", "patch"];
|
|
1622
2315
|
RESOLVED_SOURCE = ["project-context", "language-default", "legacy-alias"];
|
|
1623
|
-
ReleaseChannelSchema =
|
|
1624
|
-
ReleaseSchemeSchema =
|
|
1625
|
-
ReleaseKindSchema =
|
|
1626
|
-
ReleaseStatusSchema =
|
|
1627
|
-
GateStatusSchema =
|
|
1628
|
-
GateNameSchema =
|
|
1629
|
-
PlatformTupleSchema =
|
|
1630
|
-
PublisherSchema =
|
|
1631
|
-
TaskKindSchema =
|
|
1632
|
-
ImpactSchema =
|
|
1633
|
-
ResolvedSourceSchema =
|
|
1634
|
-
Iso8601 =
|
|
1635
|
-
NonEmptyString =
|
|
1636
|
-
ReleasePlanTaskSchema =
|
|
2316
|
+
ReleaseChannelSchema = z9.enum(RELEASE_CHANNEL);
|
|
2317
|
+
ReleaseSchemeSchema = z9.enum(RELEASE_SCHEME);
|
|
2318
|
+
ReleaseKindSchema = z9.enum(RELEASE_KIND);
|
|
2319
|
+
ReleaseStatusSchema = z9.enum(RELEASE_STATUS);
|
|
2320
|
+
GateStatusSchema = z9.enum(GATE_STATUS);
|
|
2321
|
+
GateNameSchema = z9.enum(GATE_NAME);
|
|
2322
|
+
PlatformTupleSchema = z9.enum(PLATFORM_TUPLE);
|
|
2323
|
+
PublisherSchema = z9.enum(PUBLISHER);
|
|
2324
|
+
TaskKindSchema = z9.enum(TASK_KIND);
|
|
2325
|
+
ImpactSchema = z9.enum(IMPACT);
|
|
2326
|
+
ResolvedSourceSchema = z9.enum(RESOLVED_SOURCE);
|
|
2327
|
+
Iso8601 = z9.iso.datetime({ offset: true });
|
|
2328
|
+
NonEmptyString = z9.string().min(1);
|
|
2329
|
+
ReleasePlanTaskSchema = z9.object({
|
|
1637
2330
|
/** Task ID (e.g. "T10001"). Format intentionally loose so historical IDs validate. */
|
|
1638
2331
|
id: NonEmptyString,
|
|
1639
2332
|
/** Conventional-commit-aligned task classification. */
|
|
@@ -1641,20 +2334,20 @@ var init_plan = __esm({
|
|
|
1641
2334
|
/** SemVer impact classification. */
|
|
1642
2335
|
impact: ImpactSchema,
|
|
1643
2336
|
/** Human-readable changelog line for this task. */
|
|
1644
|
-
userFacingSummary:
|
|
2337
|
+
userFacingSummary: z9.string(),
|
|
1645
2338
|
/**
|
|
1646
2339
|
* ADR-051 evidence atoms attesting the task's gate results. Format is
|
|
1647
2340
|
* `kind:value` (e.g. `commit:abc123`, `test-run:vitest.json`). The contract
|
|
1648
2341
|
* accepts empty arrays so legacy plans validate; `cleo release plan`
|
|
1649
2342
|
* enforces non-empty via R-301.
|
|
1650
2343
|
*/
|
|
1651
|
-
evidenceAtoms:
|
|
2344
|
+
evidenceAtoms: z9.array(NonEmptyString),
|
|
1652
2345
|
/** IVTR phase at plan time — informational only per R-316. */
|
|
1653
|
-
ivtrPhaseAtPlan:
|
|
2346
|
+
ivtrPhaseAtPlan: z9.string().optional(),
|
|
1654
2347
|
/** Epic this task rolls up to, locked at plan time per R-303. */
|
|
1655
2348
|
epicAncestor: NonEmptyString
|
|
1656
2349
|
});
|
|
1657
|
-
ReleaseGateSchema =
|
|
2350
|
+
ReleaseGateSchema = z9.object({
|
|
1658
2351
|
/** Canonical gate name. */
|
|
1659
2352
|
name: GateNameSchema,
|
|
1660
2353
|
/** ADR-051 atom string identifying the resolved tool (e.g. `tool:test`). */
|
|
@@ -1664,11 +2357,11 @@ var init_plan = __esm({
|
|
|
1664
2357
|
/** ISO-8601 timestamp the gate was last verified. */
|
|
1665
2358
|
lastVerifiedAt: Iso8601,
|
|
1666
2359
|
/** Resolved shell command (e.g. `pnpm run test`). Optional for unresolved gates. */
|
|
1667
|
-
resolvedCommand:
|
|
2360
|
+
resolvedCommand: z9.string().optional(),
|
|
1668
2361
|
/** Provenance of the resolved command. Optional for unresolved gates. */
|
|
1669
2362
|
resolvedSource: ResolvedSourceSchema.optional()
|
|
1670
2363
|
});
|
|
1671
|
-
ReleasePlatformMatrixEntrySchema =
|
|
2364
|
+
ReleasePlatformMatrixEntrySchema = z9.object({
|
|
1672
2365
|
/** Target platform tuple. */
|
|
1673
2366
|
platform: PlatformTupleSchema,
|
|
1674
2367
|
/** Distribution backend. */
|
|
@@ -1676,47 +2369,47 @@ var init_plan = __esm({
|
|
|
1676
2369
|
/** Package identifier on the target backend (e.g. `@cleocode/cleo`). */
|
|
1677
2370
|
package: NonEmptyString,
|
|
1678
2371
|
/** Whether to run the GHA smoke job for this matrix entry. */
|
|
1679
|
-
smoke:
|
|
2372
|
+
smoke: z9.boolean().default(true).optional()
|
|
1680
2373
|
});
|
|
1681
|
-
ReleasePreflightSummarySchema =
|
|
2374
|
+
ReleasePreflightSummarySchema = z9.object({
|
|
1682
2375
|
/** True if esbuild externals are out of sync with package.json. */
|
|
1683
|
-
esbuildExternalsDrift:
|
|
2376
|
+
esbuildExternalsDrift: z9.boolean(),
|
|
1684
2377
|
/** True if `pnpm-lock.yaml` diverges from the workspace manifest. */
|
|
1685
|
-
lockfileDrift:
|
|
2378
|
+
lockfileDrift: z9.boolean(),
|
|
1686
2379
|
/** True if all epic children are in terminal lifecycle states. */
|
|
1687
|
-
epicCompletenessClean:
|
|
2380
|
+
epicCompletenessClean: z9.boolean(),
|
|
1688
2381
|
/** True if no task appears in multiple in-flight release plans. */
|
|
1689
|
-
doubleListingClean:
|
|
2382
|
+
doubleListingClean: z9.boolean(),
|
|
1690
2383
|
/** Non-fatal preflight warnings (e.g. unresolved tools per R-024). */
|
|
1691
|
-
preflightWarnings:
|
|
2384
|
+
preflightWarnings: z9.array(z9.string()).default([]).optional()
|
|
1692
2385
|
});
|
|
1693
|
-
ReleasePlanChangelogSchema =
|
|
2386
|
+
ReleasePlanChangelogSchema = z9.object({
|
|
1694
2387
|
/** `kind=feat` tasks. */
|
|
1695
|
-
features:
|
|
2388
|
+
features: z9.array(NonEmptyString).default([]),
|
|
1696
2389
|
/** `kind=fix` or `kind=hotfix` tasks. */
|
|
1697
|
-
fixes:
|
|
2390
|
+
fixes: z9.array(NonEmptyString).default([]),
|
|
1698
2391
|
/** `kind=chore`, `docs`, `refactor`, `test`, `perf` tasks. */
|
|
1699
|
-
chores:
|
|
2392
|
+
chores: z9.array(NonEmptyString).default([]),
|
|
1700
2393
|
/** `kind=breaking` or `kind=revert` tasks. */
|
|
1701
|
-
breaking:
|
|
2394
|
+
breaking: z9.array(NonEmptyString).default([])
|
|
1702
2395
|
});
|
|
1703
|
-
ReleasePlanMetaSchema =
|
|
2396
|
+
ReleasePlanMetaSchema = z9.object({
|
|
1704
2397
|
/** True if this is the project's first ever release. */
|
|
1705
|
-
firstEverRelease:
|
|
2398
|
+
firstEverRelease: z9.boolean().optional(),
|
|
1706
2399
|
/** Canonical tool names that could not be resolved at plan time. */
|
|
1707
|
-
unresolvedTools:
|
|
2400
|
+
unresolvedTools: z9.array(z9.string()).optional(),
|
|
1708
2401
|
/** Project archetype detected at plan time. */
|
|
1709
|
-
archetype:
|
|
1710
|
-
}).catchall(
|
|
1711
|
-
ReleasePlanSchema =
|
|
2402
|
+
archetype: z9.string().optional()
|
|
2403
|
+
}).catchall(z9.unknown());
|
|
2404
|
+
ReleasePlanSchema = z9.object({
|
|
1712
2405
|
/** Schema URL for this plan version. */
|
|
1713
|
-
$schema:
|
|
2406
|
+
$schema: z9.string().optional(),
|
|
1714
2407
|
/** Requested version string (e.g. "v2026.6.0"). Includes the leading `v`. */
|
|
1715
2408
|
version: NonEmptyString,
|
|
1716
2409
|
/** Resolved version string after suffix application (e.g. "v2026.6.0.2"). */
|
|
1717
2410
|
resolvedVersion: NonEmptyString,
|
|
1718
2411
|
/** True if a `calver-suffix` was applied to disambiguate a same-day hotfix. */
|
|
1719
|
-
suffixApplied:
|
|
2412
|
+
suffixApplied: z9.boolean(),
|
|
1720
2413
|
/** Versioning scheme governing `version` / `resolvedVersion`. */
|
|
1721
2414
|
scheme: ReleaseSchemeSchema,
|
|
1722
2415
|
/** npm dist-tag channel for this release. */
|
|
@@ -1733,27 +2426,27 @@ var init_plan = __esm({
|
|
|
1733
2426
|
* Version of the previous release on the same channel. MUST be `null` only
|
|
1734
2427
|
* for first-ever releases (R-300, enforced at the verb layer).
|
|
1735
2428
|
*/
|
|
1736
|
-
previousVersion:
|
|
2429
|
+
previousVersion: z9.string().nullable(),
|
|
1737
2430
|
/** Git tag of the previous release (typically `previousVersion` prefixed). */
|
|
1738
|
-
previousTag:
|
|
2431
|
+
previousTag: z9.string().nullable(),
|
|
1739
2432
|
/** ISO-8601 timestamp the previous release was published. */
|
|
1740
2433
|
previousShippedAt: Iso8601.nullable(),
|
|
1741
2434
|
/** Tasks rolled into this release. */
|
|
1742
|
-
tasks:
|
|
2435
|
+
tasks: z9.array(ReleasePlanTaskSchema),
|
|
1743
2436
|
/** Bucketed changelog. */
|
|
1744
2437
|
changelog: ReleasePlanChangelogSchema,
|
|
1745
2438
|
/** Per-gate verification status. */
|
|
1746
|
-
gates:
|
|
2439
|
+
gates: z9.array(ReleaseGateSchema),
|
|
1747
2440
|
/** Platform / publisher matrix. */
|
|
1748
|
-
platformMatrix:
|
|
2441
|
+
platformMatrix: z9.array(ReleasePlatformMatrixEntrySchema),
|
|
1749
2442
|
/** Preflight summary from `cleo release plan`. */
|
|
1750
2443
|
preflightSummary: ReleasePreflightSummarySchema,
|
|
1751
2444
|
/** URL of the GHA workflow run (populated by `release-prepare.yml`). */
|
|
1752
|
-
workflowRunUrl:
|
|
2445
|
+
workflowRunUrl: z9.string().nullable(),
|
|
1753
2446
|
/** URL of the bump PR (populated by `cleo release open`). */
|
|
1754
|
-
prUrl:
|
|
2447
|
+
prUrl: z9.string().nullable(),
|
|
1755
2448
|
/** Merge commit SHA on `main` (populated by `release-publish.yml`). */
|
|
1756
|
-
mergeCommitSha:
|
|
2449
|
+
mergeCommitSha: z9.string().nullable(),
|
|
1757
2450
|
/** Current FSM state per R-302. */
|
|
1758
2451
|
status: ReleaseStatusSchema,
|
|
1759
2452
|
/** Informational / forward-compat metadata. */
|
|
@@ -1809,52 +2502,52 @@ var init_session2 = __esm({
|
|
|
1809
2502
|
});
|
|
1810
2503
|
|
|
1811
2504
|
// packages/contracts/src/session-journal.ts
|
|
1812
|
-
import { z as
|
|
2505
|
+
import { z as z10 } from "zod";
|
|
1813
2506
|
var SESSION_JOURNAL_SCHEMA_VERSION, sessionJournalDoctorSummarySchema, sessionJournalDebriefSummarySchema, sessionJournalEntrySchema;
|
|
1814
2507
|
var init_session_journal = __esm({
|
|
1815
2508
|
"packages/contracts/src/session-journal.ts"() {
|
|
1816
2509
|
"use strict";
|
|
1817
2510
|
SESSION_JOURNAL_SCHEMA_VERSION = "1.0";
|
|
1818
|
-
sessionJournalDoctorSummarySchema =
|
|
2511
|
+
sessionJournalDoctorSummarySchema = z10.object({
|
|
1819
2512
|
/** `true` when zero noise patterns were detected. */
|
|
1820
|
-
isClean:
|
|
2513
|
+
isClean: z10.boolean(),
|
|
1821
2514
|
/** Total number of noise findings across all patterns. */
|
|
1822
|
-
findingsCount:
|
|
2515
|
+
findingsCount: z10.number().int().nonnegative(),
|
|
1823
2516
|
/** Pattern names that were detected (empty when isClean). */
|
|
1824
|
-
patterns:
|
|
2517
|
+
patterns: z10.array(z10.string()),
|
|
1825
2518
|
/** Total brain entries scanned. `0` = empty or unavailable. */
|
|
1826
|
-
totalScanned:
|
|
2519
|
+
totalScanned: z10.number().int().nonnegative()
|
|
1827
2520
|
});
|
|
1828
|
-
sessionJournalDebriefSummarySchema =
|
|
2521
|
+
sessionJournalDebriefSummarySchema = z10.object({
|
|
1829
2522
|
/** First 200 characters of the session end note (if provided). */
|
|
1830
|
-
noteExcerpt:
|
|
2523
|
+
noteExcerpt: z10.string().max(200).optional(),
|
|
1831
2524
|
/** Number of tasks completed during the session. */
|
|
1832
|
-
tasksCompletedCount:
|
|
2525
|
+
tasksCompletedCount: z10.number().int().nonnegative(),
|
|
1833
2526
|
/** Up to 5 task IDs (not titles) that were the focus of the session. */
|
|
1834
|
-
tasksFocused:
|
|
2527
|
+
tasksFocused: z10.array(z10.string()).max(5).optional()
|
|
1835
2528
|
});
|
|
1836
|
-
sessionJournalEntrySchema =
|
|
2529
|
+
sessionJournalEntrySchema = z10.object({
|
|
1837
2530
|
// Identity
|
|
1838
2531
|
/** Schema version for forward-compatibility. Always `'1.0'` in this release. */
|
|
1839
|
-
schemaVersion:
|
|
2532
|
+
schemaVersion: z10.literal(SESSION_JOURNAL_SCHEMA_VERSION),
|
|
1840
2533
|
/** ISO 8601 timestamp when the entry was written. */
|
|
1841
|
-
timestamp:
|
|
2534
|
+
timestamp: z10.string(),
|
|
1842
2535
|
/** CLEO session ID (e.g. `ses_20260424055456_ede571`). */
|
|
1843
|
-
sessionId:
|
|
2536
|
+
sessionId: z10.string(),
|
|
1844
2537
|
/** Event type that triggered this journal entry. */
|
|
1845
|
-
eventType:
|
|
2538
|
+
eventType: z10.enum(["session_start", "session_end", "observation", "decision", "error"]),
|
|
1846
2539
|
// Session metadata (set on session_start / session_end)
|
|
1847
2540
|
/** Agent identifier (e.g. `cleo-prime`, `claude-code`). */
|
|
1848
|
-
agentIdentifier:
|
|
2541
|
+
agentIdentifier: z10.string().optional(),
|
|
1849
2542
|
/** Provider adapter ID active for this session. */
|
|
1850
|
-
providerId:
|
|
2543
|
+
providerId: z10.string().optional(),
|
|
1851
2544
|
/** Session scope string (e.g. `'global'` or `'epic:T1263'`). */
|
|
1852
|
-
scope:
|
|
2545
|
+
scope: z10.string().optional(),
|
|
1853
2546
|
// Session-end fields
|
|
1854
2547
|
/** Duration of the session in seconds (session_end only). */
|
|
1855
|
-
duration:
|
|
2548
|
+
duration: z10.number().int().nonnegative().optional(),
|
|
1856
2549
|
/** Task IDs (not titles) completed during the session. */
|
|
1857
|
-
tasksCompleted:
|
|
2550
|
+
tasksCompleted: z10.array(z10.string()).optional(),
|
|
1858
2551
|
// Doctor summary (T1262 absorbed)
|
|
1859
2552
|
/** Compact result of `scanBrainNoise` run at session-end. */
|
|
1860
2553
|
doctorSummary: sessionJournalDoctorSummarySchema.optional(),
|
|
@@ -1863,7 +2556,7 @@ var init_session_journal = __esm({
|
|
|
1863
2556
|
debriefSummary: sessionJournalDebriefSummarySchema.optional(),
|
|
1864
2557
|
// Optional hash chain
|
|
1865
2558
|
/** SHA-256 hex of the previous entry's raw JSON string (for integrity chain). */
|
|
1866
|
-
prevEntryHash:
|
|
2559
|
+
prevEntryHash: z10.string().optional()
|
|
1867
2560
|
});
|
|
1868
2561
|
}
|
|
1869
2562
|
});
|
|
@@ -1883,52 +2576,52 @@ var init_task = __esm({
|
|
|
1883
2576
|
});
|
|
1884
2577
|
|
|
1885
2578
|
// packages/contracts/src/task-evidence.ts
|
|
1886
|
-
import { z as
|
|
2579
|
+
import { z as z11 } from "zod";
|
|
1887
2580
|
var fileEvidenceSchema, logEvidenceSchema, screenshotEvidenceSchema, testOutputEvidenceSchema, commandOutputEvidenceSchema, taskEvidenceSchema;
|
|
1888
2581
|
var init_task_evidence = __esm({
|
|
1889
2582
|
"packages/contracts/src/task-evidence.ts"() {
|
|
1890
2583
|
"use strict";
|
|
1891
|
-
fileEvidenceSchema =
|
|
1892
|
-
kind:
|
|
1893
|
-
sha256:
|
|
1894
|
-
timestamp:
|
|
1895
|
-
path:
|
|
1896
|
-
mime:
|
|
1897
|
-
description:
|
|
1898
|
-
});
|
|
1899
|
-
logEvidenceSchema =
|
|
1900
|
-
kind:
|
|
1901
|
-
sha256:
|
|
1902
|
-
timestamp:
|
|
1903
|
-
source:
|
|
1904
|
-
description:
|
|
1905
|
-
});
|
|
1906
|
-
screenshotEvidenceSchema =
|
|
1907
|
-
kind:
|
|
1908
|
-
sha256:
|
|
1909
|
-
timestamp:
|
|
1910
|
-
mime:
|
|
1911
|
-
description:
|
|
1912
|
-
});
|
|
1913
|
-
testOutputEvidenceSchema =
|
|
1914
|
-
kind:
|
|
1915
|
-
sha256:
|
|
1916
|
-
timestamp:
|
|
1917
|
-
passed:
|
|
1918
|
-
failed:
|
|
1919
|
-
skipped:
|
|
1920
|
-
exitCode:
|
|
1921
|
-
description:
|
|
1922
|
-
});
|
|
1923
|
-
commandOutputEvidenceSchema =
|
|
1924
|
-
kind:
|
|
1925
|
-
sha256:
|
|
1926
|
-
timestamp:
|
|
1927
|
-
cmd:
|
|
1928
|
-
exitCode:
|
|
1929
|
-
description:
|
|
1930
|
-
});
|
|
1931
|
-
taskEvidenceSchema =
|
|
2584
|
+
fileEvidenceSchema = z11.object({
|
|
2585
|
+
kind: z11.literal("file"),
|
|
2586
|
+
sha256: z11.string().length(64),
|
|
2587
|
+
timestamp: z11.string().datetime(),
|
|
2588
|
+
path: z11.string().min(1),
|
|
2589
|
+
mime: z11.string().optional(),
|
|
2590
|
+
description: z11.string().optional()
|
|
2591
|
+
});
|
|
2592
|
+
logEvidenceSchema = z11.object({
|
|
2593
|
+
kind: z11.literal("log"),
|
|
2594
|
+
sha256: z11.string().length(64),
|
|
2595
|
+
timestamp: z11.string().datetime(),
|
|
2596
|
+
source: z11.string().min(1),
|
|
2597
|
+
description: z11.string().optional()
|
|
2598
|
+
});
|
|
2599
|
+
screenshotEvidenceSchema = z11.object({
|
|
2600
|
+
kind: z11.literal("screenshot"),
|
|
2601
|
+
sha256: z11.string().length(64),
|
|
2602
|
+
timestamp: z11.string().datetime(),
|
|
2603
|
+
mime: z11.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
|
|
2604
|
+
description: z11.string().optional()
|
|
2605
|
+
});
|
|
2606
|
+
testOutputEvidenceSchema = z11.object({
|
|
2607
|
+
kind: z11.literal("test-output"),
|
|
2608
|
+
sha256: z11.string().length(64),
|
|
2609
|
+
timestamp: z11.string().datetime(),
|
|
2610
|
+
passed: z11.number().int().nonnegative(),
|
|
2611
|
+
failed: z11.number().int().nonnegative(),
|
|
2612
|
+
skipped: z11.number().int().nonnegative(),
|
|
2613
|
+
exitCode: z11.number().int(),
|
|
2614
|
+
description: z11.string().optional()
|
|
2615
|
+
});
|
|
2616
|
+
commandOutputEvidenceSchema = z11.object({
|
|
2617
|
+
kind: z11.literal("command-output"),
|
|
2618
|
+
sha256: z11.string().length(64),
|
|
2619
|
+
timestamp: z11.string().datetime(),
|
|
2620
|
+
cmd: z11.string().min(1),
|
|
2621
|
+
exitCode: z11.number().int(),
|
|
2622
|
+
description: z11.string().optional()
|
|
2623
|
+
});
|
|
2624
|
+
taskEvidenceSchema = z11.discriminatedUnion("kind", [
|
|
1932
2625
|
fileEvidenceSchema,
|
|
1933
2626
|
logEvidenceSchema,
|
|
1934
2627
|
screenshotEvidenceSchema,
|
|
@@ -1939,12 +2632,12 @@ var init_task_evidence = __esm({
|
|
|
1939
2632
|
});
|
|
1940
2633
|
|
|
1941
2634
|
// packages/contracts/src/tasks/archive.ts
|
|
1942
|
-
import { z as
|
|
2635
|
+
import { z as z12 } from "zod";
|
|
1943
2636
|
var ArchiveReason, ARCHIVE_REASON_VALUES;
|
|
1944
2637
|
var init_archive = __esm({
|
|
1945
2638
|
"packages/contracts/src/tasks/archive.ts"() {
|
|
1946
2639
|
"use strict";
|
|
1947
|
-
ArchiveReason =
|
|
2640
|
+
ArchiveReason = z12.enum([
|
|
1948
2641
|
"verified",
|
|
1949
2642
|
"reconciled",
|
|
1950
2643
|
"superseded",
|
|
@@ -1956,6 +2649,67 @@ var init_archive = __esm({
|
|
|
1956
2649
|
}
|
|
1957
2650
|
});
|
|
1958
2651
|
|
|
2652
|
+
// packages/contracts/src/templates/manifest.ts
|
|
2653
|
+
import { z as z13 } from "zod";
|
|
2654
|
+
var TEMPLATE_KINDS, TEMPLATE_SUBSTITUTIONS, TEMPLATE_UPDATE_STRATEGIES, PLACEHOLDER_SOURCES, PlaceholderSpecSchema, TemplateManifestEntrySchema;
|
|
2655
|
+
var init_manifest2 = __esm({
|
|
2656
|
+
"packages/contracts/src/templates/manifest.ts"() {
|
|
2657
|
+
"use strict";
|
|
2658
|
+
TEMPLATE_KINDS = ["workflow", "config", "agent", "skill", "provider", "doc"];
|
|
2659
|
+
TEMPLATE_SUBSTITUTIONS = ["regex-tmpl", "static", "json-merge"];
|
|
2660
|
+
TEMPLATE_UPDATE_STRATEGIES = [
|
|
2661
|
+
"overwrite-on-bump",
|
|
2662
|
+
"diff-prompt",
|
|
2663
|
+
"immutable",
|
|
2664
|
+
"manifest-merge"
|
|
2665
|
+
];
|
|
2666
|
+
PLACEHOLDER_SOURCES = [
|
|
2667
|
+
"project-context",
|
|
2668
|
+
"project-info",
|
|
2669
|
+
".cleo/config",
|
|
2670
|
+
"~/.cleo/config",
|
|
2671
|
+
"tool-resolver",
|
|
2672
|
+
"literal"
|
|
2673
|
+
];
|
|
2674
|
+
PlaceholderSpecSchema = z13.object({
|
|
2675
|
+
/**
|
|
2676
|
+
* Placeholder identifier as it appears in the template body
|
|
2677
|
+
* (e.g. `NODE_VERSION` matches `{{NODE_VERSION}}`).
|
|
2678
|
+
*/
|
|
2679
|
+
name: z13.string().min(1, "placeholder name must be non-empty"),
|
|
2680
|
+
/** Resolver source the installer consults for this placeholder. */
|
|
2681
|
+
source: z13.enum(PLACEHOLDER_SOURCES),
|
|
2682
|
+
/**
|
|
2683
|
+
* Path expression evaluated against `source` (e.g. `engines.node` against
|
|
2684
|
+
* `project-context`, `defaults.branchModel` against `.cleo/config`).
|
|
2685
|
+
* For `literal` source, this MAY be the literal value's identifier.
|
|
2686
|
+
*/
|
|
2687
|
+
sourcePath: z13.string().min(1, "placeholder sourcePath must be non-empty"),
|
|
2688
|
+
/**
|
|
2689
|
+
* Fallback value used when `source[sourcePath]` resolves to `undefined`.
|
|
2690
|
+
* `null` is permitted to explicitly mark "no default — failure required".
|
|
2691
|
+
*/
|
|
2692
|
+
defaultValue: z13.union([z13.string(), z13.number(), z13.boolean(), z13.null()]).optional()
|
|
2693
|
+
});
|
|
2694
|
+
TemplateManifestEntrySchema = z13.object({
|
|
2695
|
+
/** Stable identifier for this template entry. */
|
|
2696
|
+
id: z13.string().min(1, "id must be non-empty"),
|
|
2697
|
+
/** Category of file this template represents. */
|
|
2698
|
+
kind: z13.enum(TEMPLATE_KINDS),
|
|
2699
|
+
/** Repo-relative path of the template source file. */
|
|
2700
|
+
sourcePath: z13.string().min(1, "sourcePath must be non-empty"),
|
|
2701
|
+
/** Project-relative path where the rendered template installs. */
|
|
2702
|
+
installPath: z13.string().min(1, "installPath must be non-empty"),
|
|
2703
|
+
/** Substitution strategy the installer applies to `sourcePath`. */
|
|
2704
|
+
substitution: z13.enum(TEMPLATE_SUBSTITUTIONS),
|
|
2705
|
+
/** Declared placeholders this template requires. May be empty. */
|
|
2706
|
+
placeholders: z13.array(PlaceholderSpecSchema),
|
|
2707
|
+
/** Reconciliation policy on upgrade. */
|
|
2708
|
+
updateStrategy: z13.enum(TEMPLATE_UPDATE_STRATEGIES)
|
|
2709
|
+
});
|
|
2710
|
+
}
|
|
2711
|
+
});
|
|
2712
|
+
|
|
1959
2713
|
// packages/contracts/src/index.ts
|
|
1960
2714
|
var init_src = __esm({
|
|
1961
2715
|
"packages/contracts/src/index.ts"() {
|
|
@@ -1965,18 +2719,22 @@ var init_src = __esm({
|
|
|
1965
2719
|
init_branch_lock();
|
|
1966
2720
|
init_changesets();
|
|
1967
2721
|
init_cli_category();
|
|
2722
|
+
init_manifest();
|
|
1968
2723
|
init_credentials();
|
|
1969
2724
|
init_db_inventory2();
|
|
1970
2725
|
init_identity();
|
|
1971
2726
|
init_operations_registry();
|
|
2727
|
+
init_provenance();
|
|
1972
2728
|
init_docs_taxonomy();
|
|
1973
2729
|
init_engine_result();
|
|
1974
2730
|
init_enums();
|
|
1975
2731
|
init_errors();
|
|
2732
|
+
init_evidence_atom_schema();
|
|
1976
2733
|
init_evidence_record_schema();
|
|
1977
2734
|
init_exit_codes();
|
|
1978
2735
|
init_facade();
|
|
1979
2736
|
init_graph();
|
|
2737
|
+
init_invariants();
|
|
1980
2738
|
init_lafs();
|
|
1981
2739
|
init_plugin_llm();
|
|
1982
2740
|
init_observe();
|
|
@@ -1993,6 +2751,7 @@ var init_src = __esm({
|
|
|
1993
2751
|
init_task();
|
|
1994
2752
|
init_task_evidence();
|
|
1995
2753
|
init_archive();
|
|
2754
|
+
init_manifest2();
|
|
1996
2755
|
}
|
|
1997
2756
|
});
|
|
1998
2757
|
|
|
@@ -16012,7 +16771,7 @@ function resolveRef(ref, ctx) {
|
|
|
16012
16771
|
function convertBaseSchema(schema, ctx) {
|
|
16013
16772
|
if (schema.not !== void 0) {
|
|
16014
16773
|
if (typeof schema.not === "object" && Object.keys(schema.not).length === 0) {
|
|
16015
|
-
return
|
|
16774
|
+
return z14.never();
|
|
16016
16775
|
}
|
|
16017
16776
|
throw new Error("not is not supported in Zod (except { not: {} } for never)");
|
|
16018
16777
|
}
|
|
@@ -16034,7 +16793,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
16034
16793
|
return ctx.refs.get(refPath);
|
|
16035
16794
|
}
|
|
16036
16795
|
if (ctx.processing.has(refPath)) {
|
|
16037
|
-
return
|
|
16796
|
+
return z14.lazy(() => {
|
|
16038
16797
|
if (!ctx.refs.has(refPath)) {
|
|
16039
16798
|
throw new Error(`Circular reference not resolved: ${refPath}`);
|
|
16040
16799
|
}
|
|
@@ -16051,25 +16810,25 @@ function convertBaseSchema(schema, ctx) {
|
|
|
16051
16810
|
if (schema.enum !== void 0) {
|
|
16052
16811
|
const enumValues = schema.enum;
|
|
16053
16812
|
if (ctx.version === "openapi-3.0" && schema.nullable === true && enumValues.length === 1 && enumValues[0] === null) {
|
|
16054
|
-
return
|
|
16813
|
+
return z14.null();
|
|
16055
16814
|
}
|
|
16056
16815
|
if (enumValues.length === 0) {
|
|
16057
|
-
return
|
|
16816
|
+
return z14.never();
|
|
16058
16817
|
}
|
|
16059
16818
|
if (enumValues.length === 1) {
|
|
16060
|
-
return
|
|
16819
|
+
return z14.literal(enumValues[0]);
|
|
16061
16820
|
}
|
|
16062
16821
|
if (enumValues.every((v) => typeof v === "string")) {
|
|
16063
|
-
return
|
|
16822
|
+
return z14.enum(enumValues);
|
|
16064
16823
|
}
|
|
16065
|
-
const literalSchemas = enumValues.map((v) =>
|
|
16824
|
+
const literalSchemas = enumValues.map((v) => z14.literal(v));
|
|
16066
16825
|
if (literalSchemas.length < 2) {
|
|
16067
16826
|
return literalSchemas[0];
|
|
16068
16827
|
}
|
|
16069
|
-
return
|
|
16828
|
+
return z14.union([literalSchemas[0], literalSchemas[1], ...literalSchemas.slice(2)]);
|
|
16070
16829
|
}
|
|
16071
16830
|
if (schema.const !== void 0) {
|
|
16072
|
-
return
|
|
16831
|
+
return z14.literal(schema.const);
|
|
16073
16832
|
}
|
|
16074
16833
|
const type = schema.type;
|
|
16075
16834
|
if (Array.isArray(type)) {
|
|
@@ -16078,68 +16837,68 @@ function convertBaseSchema(schema, ctx) {
|
|
|
16078
16837
|
return convertBaseSchema(typeSchema, ctx);
|
|
16079
16838
|
});
|
|
16080
16839
|
if (typeSchemas.length === 0) {
|
|
16081
|
-
return
|
|
16840
|
+
return z14.never();
|
|
16082
16841
|
}
|
|
16083
16842
|
if (typeSchemas.length === 1) {
|
|
16084
16843
|
return typeSchemas[0];
|
|
16085
16844
|
}
|
|
16086
|
-
return
|
|
16845
|
+
return z14.union(typeSchemas);
|
|
16087
16846
|
}
|
|
16088
16847
|
if (!type) {
|
|
16089
|
-
return
|
|
16848
|
+
return z14.any();
|
|
16090
16849
|
}
|
|
16091
16850
|
let zodSchema2;
|
|
16092
16851
|
switch (type) {
|
|
16093
16852
|
case "string": {
|
|
16094
|
-
let stringSchema =
|
|
16853
|
+
let stringSchema = z14.string();
|
|
16095
16854
|
if (schema.format) {
|
|
16096
16855
|
const format = schema.format;
|
|
16097
16856
|
if (format === "email") {
|
|
16098
|
-
stringSchema = stringSchema.check(
|
|
16857
|
+
stringSchema = stringSchema.check(z14.email());
|
|
16099
16858
|
} else if (format === "uri" || format === "uri-reference") {
|
|
16100
|
-
stringSchema = stringSchema.check(
|
|
16859
|
+
stringSchema = stringSchema.check(z14.url());
|
|
16101
16860
|
} else if (format === "uuid" || format === "guid") {
|
|
16102
|
-
stringSchema = stringSchema.check(
|
|
16861
|
+
stringSchema = stringSchema.check(z14.uuid());
|
|
16103
16862
|
} else if (format === "date-time") {
|
|
16104
|
-
stringSchema = stringSchema.check(
|
|
16863
|
+
stringSchema = stringSchema.check(z14.iso.datetime());
|
|
16105
16864
|
} else if (format === "date") {
|
|
16106
|
-
stringSchema = stringSchema.check(
|
|
16865
|
+
stringSchema = stringSchema.check(z14.iso.date());
|
|
16107
16866
|
} else if (format === "time") {
|
|
16108
|
-
stringSchema = stringSchema.check(
|
|
16867
|
+
stringSchema = stringSchema.check(z14.iso.time());
|
|
16109
16868
|
} else if (format === "duration") {
|
|
16110
|
-
stringSchema = stringSchema.check(
|
|
16869
|
+
stringSchema = stringSchema.check(z14.iso.duration());
|
|
16111
16870
|
} else if (format === "ipv4") {
|
|
16112
|
-
stringSchema = stringSchema.check(
|
|
16871
|
+
stringSchema = stringSchema.check(z14.ipv4());
|
|
16113
16872
|
} else if (format === "ipv6") {
|
|
16114
|
-
stringSchema = stringSchema.check(
|
|
16873
|
+
stringSchema = stringSchema.check(z14.ipv6());
|
|
16115
16874
|
} else if (format === "mac") {
|
|
16116
|
-
stringSchema = stringSchema.check(
|
|
16875
|
+
stringSchema = stringSchema.check(z14.mac());
|
|
16117
16876
|
} else if (format === "cidr") {
|
|
16118
|
-
stringSchema = stringSchema.check(
|
|
16877
|
+
stringSchema = stringSchema.check(z14.cidrv4());
|
|
16119
16878
|
} else if (format === "cidr-v6") {
|
|
16120
|
-
stringSchema = stringSchema.check(
|
|
16879
|
+
stringSchema = stringSchema.check(z14.cidrv6());
|
|
16121
16880
|
} else if (format === "base64") {
|
|
16122
|
-
stringSchema = stringSchema.check(
|
|
16881
|
+
stringSchema = stringSchema.check(z14.base64());
|
|
16123
16882
|
} else if (format === "base64url") {
|
|
16124
|
-
stringSchema = stringSchema.check(
|
|
16883
|
+
stringSchema = stringSchema.check(z14.base64url());
|
|
16125
16884
|
} else if (format === "e164") {
|
|
16126
|
-
stringSchema = stringSchema.check(
|
|
16885
|
+
stringSchema = stringSchema.check(z14.e164());
|
|
16127
16886
|
} else if (format === "jwt") {
|
|
16128
|
-
stringSchema = stringSchema.check(
|
|
16887
|
+
stringSchema = stringSchema.check(z14.jwt());
|
|
16129
16888
|
} else if (format === "emoji") {
|
|
16130
|
-
stringSchema = stringSchema.check(
|
|
16889
|
+
stringSchema = stringSchema.check(z14.emoji());
|
|
16131
16890
|
} else if (format === "nanoid") {
|
|
16132
|
-
stringSchema = stringSchema.check(
|
|
16891
|
+
stringSchema = stringSchema.check(z14.nanoid());
|
|
16133
16892
|
} else if (format === "cuid") {
|
|
16134
|
-
stringSchema = stringSchema.check(
|
|
16893
|
+
stringSchema = stringSchema.check(z14.cuid());
|
|
16135
16894
|
} else if (format === "cuid2") {
|
|
16136
|
-
stringSchema = stringSchema.check(
|
|
16895
|
+
stringSchema = stringSchema.check(z14.cuid2());
|
|
16137
16896
|
} else if (format === "ulid") {
|
|
16138
|
-
stringSchema = stringSchema.check(
|
|
16897
|
+
stringSchema = stringSchema.check(z14.ulid());
|
|
16139
16898
|
} else if (format === "xid") {
|
|
16140
|
-
stringSchema = stringSchema.check(
|
|
16899
|
+
stringSchema = stringSchema.check(z14.xid());
|
|
16141
16900
|
} else if (format === "ksuid") {
|
|
16142
|
-
stringSchema = stringSchema.check(
|
|
16901
|
+
stringSchema = stringSchema.check(z14.ksuid());
|
|
16143
16902
|
}
|
|
16144
16903
|
}
|
|
16145
16904
|
if (typeof schema.minLength === "number") {
|
|
@@ -16156,7 +16915,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
16156
16915
|
}
|
|
16157
16916
|
case "number":
|
|
16158
16917
|
case "integer": {
|
|
16159
|
-
let numberSchema = type === "integer" ?
|
|
16918
|
+
let numberSchema = type === "integer" ? z14.number().int() : z14.number();
|
|
16160
16919
|
if (typeof schema.minimum === "number") {
|
|
16161
16920
|
numberSchema = numberSchema.min(schema.minimum);
|
|
16162
16921
|
}
|
|
@@ -16180,11 +16939,11 @@ function convertBaseSchema(schema, ctx) {
|
|
|
16180
16939
|
break;
|
|
16181
16940
|
}
|
|
16182
16941
|
case "boolean": {
|
|
16183
|
-
zodSchema2 =
|
|
16942
|
+
zodSchema2 = z14.boolean();
|
|
16184
16943
|
break;
|
|
16185
16944
|
}
|
|
16186
16945
|
case "null": {
|
|
16187
|
-
zodSchema2 =
|
|
16946
|
+
zodSchema2 = z14.null();
|
|
16188
16947
|
break;
|
|
16189
16948
|
}
|
|
16190
16949
|
case "object": {
|
|
@@ -16197,14 +16956,14 @@ function convertBaseSchema(schema, ctx) {
|
|
|
16197
16956
|
}
|
|
16198
16957
|
if (schema.propertyNames) {
|
|
16199
16958
|
const keySchema = convertSchema(schema.propertyNames, ctx);
|
|
16200
|
-
const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) :
|
|
16959
|
+
const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object" ? convertSchema(schema.additionalProperties, ctx) : z14.any();
|
|
16201
16960
|
if (Object.keys(shape).length === 0) {
|
|
16202
|
-
zodSchema2 =
|
|
16961
|
+
zodSchema2 = z14.record(keySchema, valueSchema);
|
|
16203
16962
|
break;
|
|
16204
16963
|
}
|
|
16205
|
-
const objectSchema2 =
|
|
16206
|
-
const recordSchema =
|
|
16207
|
-
zodSchema2 =
|
|
16964
|
+
const objectSchema2 = z14.object(shape).passthrough();
|
|
16965
|
+
const recordSchema = z14.looseRecord(keySchema, valueSchema);
|
|
16966
|
+
zodSchema2 = z14.intersection(objectSchema2, recordSchema);
|
|
16208
16967
|
break;
|
|
16209
16968
|
}
|
|
16210
16969
|
if (schema.patternProperties) {
|
|
@@ -16213,28 +16972,28 @@ function convertBaseSchema(schema, ctx) {
|
|
|
16213
16972
|
const looseRecords = [];
|
|
16214
16973
|
for (const pattern of patternKeys) {
|
|
16215
16974
|
const patternValue = convertSchema(patternProps[pattern], ctx);
|
|
16216
|
-
const keySchema =
|
|
16217
|
-
looseRecords.push(
|
|
16975
|
+
const keySchema = z14.string().regex(new RegExp(pattern));
|
|
16976
|
+
looseRecords.push(z14.looseRecord(keySchema, patternValue));
|
|
16218
16977
|
}
|
|
16219
16978
|
const schemasToIntersect = [];
|
|
16220
16979
|
if (Object.keys(shape).length > 0) {
|
|
16221
|
-
schemasToIntersect.push(
|
|
16980
|
+
schemasToIntersect.push(z14.object(shape).passthrough());
|
|
16222
16981
|
}
|
|
16223
16982
|
schemasToIntersect.push(...looseRecords);
|
|
16224
16983
|
if (schemasToIntersect.length === 0) {
|
|
16225
|
-
zodSchema2 =
|
|
16984
|
+
zodSchema2 = z14.object({}).passthrough();
|
|
16226
16985
|
} else if (schemasToIntersect.length === 1) {
|
|
16227
16986
|
zodSchema2 = schemasToIntersect[0];
|
|
16228
16987
|
} else {
|
|
16229
|
-
let result =
|
|
16988
|
+
let result = z14.intersection(schemasToIntersect[0], schemasToIntersect[1]);
|
|
16230
16989
|
for (let i = 2; i < schemasToIntersect.length; i++) {
|
|
16231
|
-
result =
|
|
16990
|
+
result = z14.intersection(result, schemasToIntersect[i]);
|
|
16232
16991
|
}
|
|
16233
16992
|
zodSchema2 = result;
|
|
16234
16993
|
}
|
|
16235
16994
|
break;
|
|
16236
16995
|
}
|
|
16237
|
-
const objectSchema =
|
|
16996
|
+
const objectSchema = z14.object(shape);
|
|
16238
16997
|
if (schema.additionalProperties === false) {
|
|
16239
16998
|
zodSchema2 = objectSchema.strict();
|
|
16240
16999
|
} else if (typeof schema.additionalProperties === "object") {
|
|
@@ -16251,33 +17010,33 @@ function convertBaseSchema(schema, ctx) {
|
|
|
16251
17010
|
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
16252
17011
|
const rest = items && typeof items === "object" && !Array.isArray(items) ? convertSchema(items, ctx) : void 0;
|
|
16253
17012
|
if (rest) {
|
|
16254
|
-
zodSchema2 =
|
|
17013
|
+
zodSchema2 = z14.tuple(tupleItems).rest(rest);
|
|
16255
17014
|
} else {
|
|
16256
|
-
zodSchema2 =
|
|
17015
|
+
zodSchema2 = z14.tuple(tupleItems);
|
|
16257
17016
|
}
|
|
16258
17017
|
if (typeof schema.minItems === "number") {
|
|
16259
|
-
zodSchema2 = zodSchema2.check(
|
|
17018
|
+
zodSchema2 = zodSchema2.check(z14.minLength(schema.minItems));
|
|
16260
17019
|
}
|
|
16261
17020
|
if (typeof schema.maxItems === "number") {
|
|
16262
|
-
zodSchema2 = zodSchema2.check(
|
|
17021
|
+
zodSchema2 = zodSchema2.check(z14.maxLength(schema.maxItems));
|
|
16263
17022
|
}
|
|
16264
17023
|
} else if (Array.isArray(items)) {
|
|
16265
17024
|
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
16266
17025
|
const rest = schema.additionalItems && typeof schema.additionalItems === "object" ? convertSchema(schema.additionalItems, ctx) : void 0;
|
|
16267
17026
|
if (rest) {
|
|
16268
|
-
zodSchema2 =
|
|
17027
|
+
zodSchema2 = z14.tuple(tupleItems).rest(rest);
|
|
16269
17028
|
} else {
|
|
16270
|
-
zodSchema2 =
|
|
17029
|
+
zodSchema2 = z14.tuple(tupleItems);
|
|
16271
17030
|
}
|
|
16272
17031
|
if (typeof schema.minItems === "number") {
|
|
16273
|
-
zodSchema2 = zodSchema2.check(
|
|
17032
|
+
zodSchema2 = zodSchema2.check(z14.minLength(schema.minItems));
|
|
16274
17033
|
}
|
|
16275
17034
|
if (typeof schema.maxItems === "number") {
|
|
16276
|
-
zodSchema2 = zodSchema2.check(
|
|
17035
|
+
zodSchema2 = zodSchema2.check(z14.maxLength(schema.maxItems));
|
|
16277
17036
|
}
|
|
16278
17037
|
} else if (items !== void 0) {
|
|
16279
17038
|
const element = convertSchema(items, ctx);
|
|
16280
|
-
let arraySchema =
|
|
17039
|
+
let arraySchema = z14.array(element);
|
|
16281
17040
|
if (typeof schema.minItems === "number") {
|
|
16282
17041
|
arraySchema = arraySchema.min(schema.minItems);
|
|
16283
17042
|
}
|
|
@@ -16286,7 +17045,7 @@ function convertBaseSchema(schema, ctx) {
|
|
|
16286
17045
|
}
|
|
16287
17046
|
zodSchema2 = arraySchema;
|
|
16288
17047
|
} else {
|
|
16289
|
-
zodSchema2 =
|
|
17048
|
+
zodSchema2 = z14.array(z14.any());
|
|
16290
17049
|
}
|
|
16291
17050
|
break;
|
|
16292
17051
|
}
|
|
@@ -16303,37 +17062,37 @@ function convertBaseSchema(schema, ctx) {
|
|
|
16303
17062
|
}
|
|
16304
17063
|
function convertSchema(schema, ctx) {
|
|
16305
17064
|
if (typeof schema === "boolean") {
|
|
16306
|
-
return schema ?
|
|
17065
|
+
return schema ? z14.any() : z14.never();
|
|
16307
17066
|
}
|
|
16308
17067
|
let baseSchema = convertBaseSchema(schema, ctx);
|
|
16309
17068
|
const hasExplicitType = schema.type || schema.enum !== void 0 || schema.const !== void 0;
|
|
16310
17069
|
if (schema.anyOf && Array.isArray(schema.anyOf)) {
|
|
16311
17070
|
const options = schema.anyOf.map((s) => convertSchema(s, ctx));
|
|
16312
|
-
const anyOfUnion =
|
|
16313
|
-
baseSchema = hasExplicitType ?
|
|
17071
|
+
const anyOfUnion = z14.union(options);
|
|
17072
|
+
baseSchema = hasExplicitType ? z14.intersection(baseSchema, anyOfUnion) : anyOfUnion;
|
|
16314
17073
|
}
|
|
16315
17074
|
if (schema.oneOf && Array.isArray(schema.oneOf)) {
|
|
16316
17075
|
const options = schema.oneOf.map((s) => convertSchema(s, ctx));
|
|
16317
|
-
const oneOfUnion =
|
|
16318
|
-
baseSchema = hasExplicitType ?
|
|
17076
|
+
const oneOfUnion = z14.xor(options);
|
|
17077
|
+
baseSchema = hasExplicitType ? z14.intersection(baseSchema, oneOfUnion) : oneOfUnion;
|
|
16319
17078
|
}
|
|
16320
17079
|
if (schema.allOf && Array.isArray(schema.allOf)) {
|
|
16321
17080
|
if (schema.allOf.length === 0) {
|
|
16322
|
-
baseSchema = hasExplicitType ? baseSchema :
|
|
17081
|
+
baseSchema = hasExplicitType ? baseSchema : z14.any();
|
|
16323
17082
|
} else {
|
|
16324
17083
|
let result = hasExplicitType ? baseSchema : convertSchema(schema.allOf[0], ctx);
|
|
16325
17084
|
const startIdx = hasExplicitType ? 0 : 1;
|
|
16326
17085
|
for (let i = startIdx; i < schema.allOf.length; i++) {
|
|
16327
|
-
result =
|
|
17086
|
+
result = z14.intersection(result, convertSchema(schema.allOf[i], ctx));
|
|
16328
17087
|
}
|
|
16329
17088
|
baseSchema = result;
|
|
16330
17089
|
}
|
|
16331
17090
|
}
|
|
16332
17091
|
if (schema.nullable === true && ctx.version === "openapi-3.0") {
|
|
16333
|
-
baseSchema =
|
|
17092
|
+
baseSchema = z14.nullable(baseSchema);
|
|
16334
17093
|
}
|
|
16335
17094
|
if (schema.readOnly === true) {
|
|
16336
|
-
baseSchema =
|
|
17095
|
+
baseSchema = z14.readonly(baseSchema);
|
|
16337
17096
|
}
|
|
16338
17097
|
const extraMeta = {};
|
|
16339
17098
|
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
@@ -16360,7 +17119,7 @@ function convertSchema(schema, ctx) {
|
|
|
16360
17119
|
}
|
|
16361
17120
|
function fromJSONSchema(schema, params) {
|
|
16362
17121
|
if (typeof schema === "boolean") {
|
|
16363
|
-
return schema ?
|
|
17122
|
+
return schema ? z14.any() : z14.never();
|
|
16364
17123
|
}
|
|
16365
17124
|
const version2 = detectVersion(schema, params?.defaultTarget);
|
|
16366
17125
|
const defs = schema.$defs || schema.definitions || {};
|
|
@@ -16374,14 +17133,14 @@ function fromJSONSchema(schema, params) {
|
|
|
16374
17133
|
};
|
|
16375
17134
|
return convertSchema(schema, ctx);
|
|
16376
17135
|
}
|
|
16377
|
-
var
|
|
17136
|
+
var z14, RECOGNIZED_KEYS;
|
|
16378
17137
|
var init_from_json_schema = __esm({
|
|
16379
17138
|
"node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/from-json-schema.js"() {
|
|
16380
17139
|
init_registries();
|
|
16381
17140
|
init_checks2();
|
|
16382
17141
|
init_iso();
|
|
16383
17142
|
init_schemas2();
|
|
16384
|
-
|
|
17143
|
+
z14 = {
|
|
16385
17144
|
...schemas_exports2,
|
|
16386
17145
|
...checks_exports2,
|
|
16387
17146
|
iso: iso_exports
|