zam-core 0.15.2 → 0.15.3

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/cli/app.js CHANGED
@@ -2755,6 +2755,9 @@ async function addPrerequisite(db, tokenId, requiresId) {
2755
2755
  "INSERT OR IGNORE INTO prerequisites (token_id, requires_id) VALUES (?, ?)"
2756
2756
  ).run(tokenId, requiresId);
2757
2757
  }
2758
+ async function removePrerequisite(db, tokenId, requiresId) {
2759
+ await db.prepare("DELETE FROM prerequisites WHERE token_id = ? AND requires_id = ?").run(tokenId, requiresId);
2760
+ }
2758
2761
  async function getPrerequisites(db, tokenId) {
2759
2762
  return await db.prepare(
2760
2763
  `SELECT p.token_id, p.requires_id, t.slug, t.title, t.concept, t.domain, t.bloom_level
@@ -7227,6 +7230,7 @@ __export(kernel_exports, {
7227
7230
  readMonitorLog: () => readMonitorLog,
7228
7231
  readUiObservationLog: () => readUiObservationLog,
7229
7232
  removeConfiguredWorkspace: () => removeConfiguredWorkspace,
7233
+ removePrerequisite: () => removePrerequisite,
7230
7234
  resetCardsForToken: () => resetCardsForToken,
7231
7235
  resolveAllBeliefPaths: () => resolveAllBeliefPaths,
7232
7236
  resolveAllGoalPaths: () => resolveAllGoalPaths,
@@ -10741,7 +10745,7 @@ async function readWebLink(url) {
10741
10745
  redirect: "manual",
10742
10746
  signal: controller.signal,
10743
10747
  headers: {
10744
- "User-Agent": "ZAM-Content-Studio/0.15.2"
10748
+ "User-Agent": "ZAM-Content-Studio/0.15.3"
10745
10749
  }
10746
10750
  });
10747
10751
  if (res.status >= 300 && res.status < 400) {
@@ -11800,6 +11804,13 @@ async function importOkfTokens(db, params) {
11800
11804
  (input8.prerequisites ?? []).map((s) => s.trim()).filter(Boolean)
11801
11805
  )
11802
11806
  ];
11807
+ const desiredPrerequisites = new Set(prereqSlugs);
11808
+ const existingPrerequisites = await getPrerequisites(tx, token.id);
11809
+ for (const existing of existingPrerequisites) {
11810
+ if (!desiredPrerequisites.has(existing.slug)) {
11811
+ await removePrerequisite(tx, token.id, existing.requires_id);
11812
+ }
11813
+ }
11803
11814
  for (const prereqSlug of prereqSlugs) {
11804
11815
  const target = inImport.get(prereqSlug) ?? await getTokenBySlug(tx, prereqSlug);
11805
11816
  if (!target) {
@@ -39666,5 +39677,31 @@ program.addCommand(agentCommand);
39666
39677
  program.addCommand(goalCommand);
39667
39678
  program.addCommand(gitSyncCommand);
39668
39679
  program.addCommand(workspaceCommand);
39669
- await program.parseAsync();
39680
+ var isBridgeInvocation = process.argv[2] === "bridge";
39681
+ var bridgeParseOutput = "";
39682
+ if (isBridgeInvocation) {
39683
+ const captureBridgeParseOutput = (value) => {
39684
+ bridgeParseOutput += value;
39685
+ };
39686
+ bridgeCommand.exitOverride();
39687
+ bridgeCommand.configureOutput({ writeErr: captureBridgeParseOutput });
39688
+ for (const command of bridgeCommand.commands) {
39689
+ command.exitOverride();
39690
+ command.configureOutput({ writeErr: captureBridgeParseOutput });
39691
+ }
39692
+ }
39693
+ try {
39694
+ await program.parseAsync();
39695
+ } catch (error) {
39696
+ const commanderCode = error?.code;
39697
+ if (isBridgeInvocation && commanderCode === "commander.helpDisplayed") {
39698
+ } else if (isBridgeInvocation && commanderCode?.startsWith("commander.")) {
39699
+ const message = (bridgeParseOutput.trim() || (error instanceof Error ? error.message : String(error))).replace(/^error:\s*/i, "");
39700
+ process.stdout.write(`${JSON.stringify({ error: message }, null, 2)}
39701
+ `);
39702
+ process.exitCode = 1;
39703
+ } else {
39704
+ throw error;
39705
+ }
39706
+ }
39670
39707
  //# sourceMappingURL=app.js.map