@ted-galago/wave-cli 0.1.14 → 0.1.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ted-galago/wave-cli",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "wave": "dist/index.js"
@@ -312,6 +312,27 @@ function summarizeStatus(result) {
312
312
  return `status=${status},err=${err}`;
313
313
  }
314
314
 
315
+ function firstArrayValue(input, paths) {
316
+ for (const path of paths) {
317
+ const value = readPath(input, path);
318
+ if (Array.isArray(value)) {
319
+ return value;
320
+ }
321
+ }
322
+ return [];
323
+ }
324
+
325
+ function recordExactCheck({ lines, label, result, ok, reason }) {
326
+ const status = result?.parsed?.status ?? "n/a";
327
+ const errCode = result?.parsed?.error?.code ?? "none";
328
+ lines.push(
329
+ `${ok ? "PASS" : "FAIL"} | status=${status} | err=${errCode} | reason=${
330
+ reason || (ok ? "ok" : "assertion_failed")
331
+ } | ${label} (${result?.args?.join(" ") ?? "n/a"})`
332
+ );
333
+ return ok ? 0 : 1;
334
+ }
335
+
315
336
  function resolveAnnualStrategicObjectiveId(result) {
316
337
  return firstDefinedValue(result?.parsed, [
317
338
  ["data", "annual_objective", "attributes", "strategicObjectiveId"],
@@ -962,6 +983,8 @@ if (issueId) {
962
983
 
963
984
  const postUpdateVerificationLines = [];
964
985
  let postUpdateVerificationFailures = 0;
986
+ const osmdVerificationLines = [];
987
+ let osmdVerificationFailures = 0;
965
988
 
966
989
  function hasSuccessfulCommand(commandPrefix) {
967
990
  return results.some((res) => {
@@ -1106,6 +1129,150 @@ verifyFieldWrite({
1106
1129
  candidatePaths: [["data", "responsibility", "attributes", "name"]]
1107
1130
  });
1108
1131
 
1132
+ function resolveOsmdAgentParentRef() {
1133
+ const queries = ["Wave Tools", "Ted Martinez", "Ted"];
1134
+ for (const query of queries) {
1135
+ const findRes = runWave(["find", query, "--limit", "10"], env);
1136
+ results.push(findRes);
1137
+ const candidates = firstArrayValue(findRes.parsed, [["data", "candidates"]]);
1138
+ for (const candidate of candidates) {
1139
+ const canonicalPath =
1140
+ candidate && typeof candidate === "object" && typeof candidate.canonicalPath === "string"
1141
+ ? candidate.canonicalPath
1142
+ : "";
1143
+ if (!canonicalPath) continue;
1144
+
1145
+ const statusRes = runWave(["osmd", "status", canonicalPath], env);
1146
+ results.push(statusRes);
1147
+ if (
1148
+ statusRes.parsed?.ok === true &&
1149
+ statusRes.parsed?.data?.source === "canonical_osmd" &&
1150
+ statusRes.parsed?.data?.exists === true &&
1151
+ statusRes.parsed?.data?.agentChildrenAllowed === true
1152
+ ) {
1153
+ return String(statusRes.parsed.data.path || canonicalPath);
1154
+ }
1155
+ }
1156
+ }
1157
+ return null;
1158
+ }
1159
+
1160
+ function runOsmdLiveVerification() {
1161
+ const treeDepthZero = runWave(["osmd", "tree", "--depth", "0"], env);
1162
+ results.push(treeDepthZero);
1163
+ osmdVerificationFailures += recordExactCheck({
1164
+ lines: osmdVerificationLines,
1165
+ label: "osmd.tree depth 0 returns metadata and normalized empty children",
1166
+ result: treeDepthZero,
1167
+ ok:
1168
+ treeDepthZero.parsed?.ok === true &&
1169
+ treeDepthZero.parsed?.data?.source === "canonical_osmd" &&
1170
+ Array.isArray(treeDepthZero.parsed?.data?.children) &&
1171
+ treeDepthZero.parsed.data.children.length === 0,
1172
+ reason: "depth_zero_contract"
1173
+ });
1174
+
1175
+ const wikiRootRead = runWave(["osmd", "wiki", "read", "Agent Wiki"], env);
1176
+ results.push(wikiRootRead);
1177
+ osmdVerificationFailures += recordExactCheck({
1178
+ lines: osmdVerificationLines,
1179
+ label: "osmd.wiki read root",
1180
+ result: wikiRootRead,
1181
+ ok:
1182
+ wikiRootRead.parsed?.ok === true &&
1183
+ wikiRootRead.parsed?.data?.path === "Agent Wiki" &&
1184
+ wikiRootRead.parsed?.data?.source === "agent_wiki",
1185
+ reason: "agent_wiki_root_read"
1186
+ });
1187
+
1188
+ const wikiChildren = runWave(["osmd", "wiki", "children"], env);
1189
+ results.push(wikiChildren);
1190
+ osmdVerificationFailures += recordExactCheck({
1191
+ lines: osmdVerificationLines,
1192
+ label: "osmd.wiki children returns an array",
1193
+ result: wikiChildren,
1194
+ ok: wikiChildren.parsed?.ok === true && Array.isArray(wikiChildren.parsed?.data),
1195
+ reason: "agent_wiki_children"
1196
+ });
1197
+
1198
+ const missingWikiPath = `missing-${verifyStamp}.md`;
1199
+ const missingWikiUpdate = runWave(
1200
+ ["osmd", "wiki", "update", missingWikiPath, "--content", "verify missing update"],
1201
+ env
1202
+ );
1203
+ results.push(missingWikiUpdate);
1204
+ osmdVerificationFailures += recordExactCheck({
1205
+ lines: osmdVerificationLines,
1206
+ label: "osmd.wiki update missing file returns 404 metadata",
1207
+ result: missingWikiUpdate,
1208
+ ok:
1209
+ missingWikiUpdate.code === 5 &&
1210
+ missingWikiUpdate.parsed?.ok === false &&
1211
+ missingWikiUpdate.parsed?.status === 404 &&
1212
+ missingWikiUpdate.parsed?.error?.code === "agent_file_not_found" &&
1213
+ missingWikiUpdate.parsed?.error?.suggestedAction === "create" &&
1214
+ missingWikiUpdate.parsed?.data?.exists === false &&
1215
+ missingWikiUpdate.parsed?.data?.canCreate === true,
1216
+ reason: "missing_file_404"
1217
+ });
1218
+
1219
+ const parentRef = resolveOsmdAgentParentRef();
1220
+ if (!parentRef) {
1221
+ osmdVerificationLines.push(
1222
+ "FAIL | status=n/a | err=osmd_parent_not_found | reason=no_agent_children_allowed_parent | osmd agent parent resolution"
1223
+ );
1224
+ osmdVerificationFailures += 1;
1225
+ return;
1226
+ }
1227
+
1228
+ const agentStatus = runWave(["osmd", "agent", "status", parentRef, "notes.md"], env);
1229
+ results.push(agentStatus);
1230
+ osmdVerificationFailures += recordExactCheck({
1231
+ lines: osmdVerificationLines,
1232
+ label: `osmd.agent status notes parent=${parentRef}`,
1233
+ result: agentStatus,
1234
+ ok:
1235
+ agentStatus.parsed?.ok === true &&
1236
+ agentStatus.parsed?.data?.source === "agent_overlay" &&
1237
+ agentStatus.parsed?.data?.parentRef === parentRef,
1238
+ reason: "agent_overlay_status"
1239
+ });
1240
+
1241
+ const agentInit = runWave(["osmd", "agent", "init", parentRef], env);
1242
+ results.push(agentInit);
1243
+ const initFiles = firstArrayValue(agentInit.parsed, [["data", "files"]]);
1244
+ osmdVerificationFailures += recordExactCheck({
1245
+ lines: osmdVerificationLines,
1246
+ label: `osmd.agent init parent=${parentRef}`,
1247
+ result: agentInit,
1248
+ ok:
1249
+ agentInit.parsed?.ok === true &&
1250
+ initFiles.some((file) => file?.path?.endsWith("/.agent/notes.md")) &&
1251
+ initFiles.some((file) => file?.path?.endsWith("/.agent/log.md")),
1252
+ reason: "agent_overlay_init"
1253
+ });
1254
+
1255
+ const notesContent = `CLI live verify notes ${verifyStamp}`;
1256
+ const agentUpdate = runWave(
1257
+ ["osmd", "agent", "update", parentRef, "notes.md", "--content", notesContent],
1258
+ env
1259
+ );
1260
+ results.push(agentUpdate);
1261
+ osmdVerificationFailures += recordExactCheck({
1262
+ lines: osmdVerificationLines,
1263
+ label: `osmd.agent update notes parent=${parentRef}`,
1264
+ result: agentUpdate,
1265
+ ok:
1266
+ agentUpdate.parsed?.ok === true &&
1267
+ agentUpdate.parsed?.data?.access === "read_write" &&
1268
+ agentUpdate.parsed?.data?.content === notesContent,
1269
+ reason: "agent_overlay_update"
1270
+ });
1271
+
1272
+ }
1273
+
1274
+ runOsmdLiveVerification();
1275
+
1109
1276
  const lines = [];
1110
1277
  let failures = 0;
1111
1278
  for (const res of results) {
@@ -1128,6 +1295,10 @@ if (postUpdateVerificationLines.length > 0) {
1128
1295
  lines.push(...postUpdateVerificationLines);
1129
1296
  }
1130
1297
  failures += postUpdateVerificationFailures;
1298
+ if (osmdVerificationLines.length > 0) {
1299
+ lines.push(...osmdVerificationLines);
1300
+ }
1301
+ failures += osmdVerificationFailures;
1131
1302
  failures += validationRemediationFailures;
1132
1303
 
1133
1304
  if (validationRemediationEntries.length > 0) {