@nseng-ai/ns 0.1.0 → 0.1.1

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/bin/ns.js CHANGED
@@ -4822,7 +4822,7 @@ var init_raw = __esm({
4822
4822
  }
4823
4823
  });
4824
4824
 
4825
- // ../../infra/core/src/primitives/primitives.ts
4825
+ // ../../infra/foundation/src/primitives/primitives.ts
4826
4826
  import { isAbsolute, relative, resolve } from "node:path";
4827
4827
  function isRecord(value) {
4828
4828
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -4872,12 +4872,12 @@ ${content}
4872
4872
  ${fence}`;
4873
4873
  }
4874
4874
  var init_primitives = __esm({
4875
- "../../infra/core/src/primitives/primitives.ts"() {
4875
+ "../../infra/foundation/src/primitives/primitives.ts"() {
4876
4876
  "use strict";
4877
4877
  }
4878
4878
  });
4879
4879
 
4880
- // ../../infra/core/src/cli-runtime/stdin.ts
4880
+ // ../../infra/foundation/src/cli-runtime/stdin.ts
4881
4881
  import process2 from "node:process";
4882
4882
  import { createInterface } from "node:readline";
4883
4883
  async function readStdin() {
@@ -4898,12 +4898,12 @@ async function readStdinLine(input = process2.stdin) {
4898
4898
  }
4899
4899
  }
4900
4900
  var init_stdin = __esm({
4901
- "../../infra/core/src/cli-runtime/stdin.ts"() {
4901
+ "../../infra/foundation/src/cli-runtime/stdin.ts"() {
4902
4902
  "use strict";
4903
4903
  }
4904
4904
  });
4905
4905
 
4906
- // ../../infra/core/src/cli-runtime/index.ts
4906
+ // ../../infra/foundation/src/cli-runtime/index.ts
4907
4907
  import { existsSync, readFileSync, realpathSync } from "node:fs";
4908
4908
  import process3 from "node:process";
4909
4909
  import { basename, dirname, relative as relative2, resolve as resolve2 } from "node:path";
@@ -5066,7 +5066,7 @@ function formatZodIssue2(issue) {
5066
5066
  }
5067
5067
  var packageJsonSchema;
5068
5068
  var init_cli_runtime = __esm({
5069
- "../../infra/core/src/cli-runtime/index.ts"() {
5069
+ "../../infra/foundation/src/cli-runtime/index.ts"() {
5070
5070
  "use strict";
5071
5071
  init_src();
5072
5072
  init_primitives();
@@ -5107,10 +5107,10 @@ var init_completion2 = __esm({
5107
5107
  }
5108
5108
  });
5109
5109
 
5110
- // ../../infra/core/src/time/timers.ts
5110
+ // ../../infra/foundation/src/time/timers.ts
5111
5111
  var TimerScheduler;
5112
5112
  var init_timers = __esm({
5113
- "../../infra/core/src/time/timers.ts"() {
5113
+ "../../infra/foundation/src/time/timers.ts"() {
5114
5114
  "use strict";
5115
5115
  TimerScheduler = class {
5116
5116
  async delay(delayMs) {
@@ -5122,10 +5122,10 @@ var init_timers = __esm({
5122
5122
  }
5123
5123
  });
5124
5124
 
5125
- // ../../infra/core/src/time/index.ts
5125
+ // ../../infra/foundation/src/time/index.ts
5126
5126
  var systemClock, SystemTimerScheduler, systemTimerScheduler;
5127
5127
  var init_time = __esm({
5128
- "../../infra/core/src/time/index.ts"() {
5128
+ "../../infra/foundation/src/time/index.ts"() {
5129
5129
  "use strict";
5130
5130
  init_timers();
5131
5131
  systemClock = {
@@ -5149,19 +5149,19 @@ var init_time = __esm({
5149
5149
  }
5150
5150
  });
5151
5151
 
5152
- // ../../infra/core/src/primitives/terminal-escapes.ts
5152
+ // ../../infra/foundation/src/primitives/terminal-escapes.ts
5153
5153
  function stripTerminalEscapes(value) {
5154
5154
  return value.replace(TERMINAL_ESCAPE_PATTERN, "");
5155
5155
  }
5156
5156
  var TERMINAL_ESCAPE_PATTERN;
5157
5157
  var init_terminal_escapes = __esm({
5158
- "../../infra/core/src/primitives/terminal-escapes.ts"() {
5158
+ "../../infra/foundation/src/primitives/terminal-escapes.ts"() {
5159
5159
  "use strict";
5160
5160
  TERMINAL_ESCAPE_PATTERN = /\x1B(?:\](?:[^\x07\x1B]|\x1B(?!\\))*?(?:\x07|\x1B\\)|[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g;
5161
5161
  }
5162
5162
  });
5163
5163
 
5164
- // ../../infra/core/src/primitives/command.ts
5164
+ // ../../infra/foundation/src/primitives/command.ts
5165
5165
  function execApiToCommandRunner(execApi) {
5166
5166
  return async (command, args, options) => await execApi.exec(command, [...args], options);
5167
5167
  }
@@ -5239,7 +5239,7 @@ function applyLineLimit(text, maxLines) {
5239
5239
  }
5240
5240
  var MAX_ERROR_CHARS;
5241
5241
  var init_command = __esm({
5242
- "../../infra/core/src/primitives/command.ts"() {
5242
+ "../../infra/foundation/src/primitives/command.ts"() {
5243
5243
  "use strict";
5244
5244
  init_primitives();
5245
5245
  init_terminal_escapes();
@@ -5247,7 +5247,7 @@ var init_command = __esm({
5247
5247
  }
5248
5248
  });
5249
5249
 
5250
- // ../../infra/core/src/exec/index.ts
5250
+ // ../../infra/foundation/src/exec/index.ts
5251
5251
  import { spawn } from "node:child_process";
5252
5252
  async function runCommand(command, args, options = {}) {
5253
5253
  return new Promise((resolve14) => {
@@ -5339,7 +5339,7 @@ async function runCommand(command, args, options = {}) {
5339
5339
  }
5340
5340
  var DEFAULT_TIMEOUT_KILL_GRACE_MS, TIMEOUT_EXIT_CODE, STARTUP_FAILURE_EXIT_CODE, NodeCommandExecApi;
5341
5341
  var init_exec = __esm({
5342
- "../../infra/core/src/exec/index.ts"() {
5342
+ "../../infra/foundation/src/exec/index.ts"() {
5343
5343
  "use strict";
5344
5344
  init_primitives();
5345
5345
  init_time();
@@ -5421,7 +5421,7 @@ var init_extension_manifest = __esm({
5421
5421
  }
5422
5422
  });
5423
5423
 
5424
- // ../../infra/core/src/terminal/text-normalization.ts
5424
+ // ../../infra/foundation/src/terminal/text-normalization.ts
5425
5425
  function normalizeTextOutput(output) {
5426
5426
  return stripOuterCodeFence(trimOuterBlankLines(output.replace(/\r\n?/g, "\n")));
5427
5427
  }
@@ -5454,13 +5454,13 @@ function stripOuterCodeFence(text) {
5454
5454
  return trimmed;
5455
5455
  }
5456
5456
  var init_text_normalization = __esm({
5457
- "../../infra/core/src/terminal/text-normalization.ts"() {
5457
+ "../../infra/foundation/src/terminal/text-normalization.ts"() {
5458
5458
  "use strict";
5459
5459
  init_terminal_escapes();
5460
5460
  }
5461
5461
  });
5462
5462
 
5463
- // ../../infra/core/src/terminal/text-truncation.ts
5463
+ // ../../infra/foundation/src/terminal/text-truncation.ts
5464
5464
  function truncateTextHeadTail(input) {
5465
5465
  if (input.value.length <= input.maxChars) return input.value;
5466
5466
  const marker = input.buildMarker(input.markerOmittedChars ?? input.value.length - input.maxChars);
@@ -5505,7 +5505,7 @@ function maybeTrimStart(value, shouldTrim) {
5505
5505
  return shouldTrim ? value.trimStart() : value;
5506
5506
  }
5507
5507
  var init_text_truncation = __esm({
5508
- "../../infra/core/src/terminal/text-truncation.ts"() {
5508
+ "../../infra/foundation/src/terminal/text-truncation.ts"() {
5509
5509
  "use strict";
5510
5510
  }
5511
5511
  });
@@ -5836,7 +5836,7 @@ var init_context = __esm({
5836
5836
  }
5837
5837
  });
5838
5838
 
5839
- // ../../infra/core/src/primitives/managed-region.ts
5839
+ // ../../infra/foundation/src/primitives/managed-region.ts
5840
5840
  function managedRegionBounds(input) {
5841
5841
  const startCount = countOccurrences(input.text, input.startMarker);
5842
5842
  const endCount = countOccurrences(input.text, input.endMarker);
@@ -5864,7 +5864,7 @@ function countOccurrences(content, needle) {
5864
5864
  }
5865
5865
  }
5866
5866
  var init_managed_region = __esm({
5867
- "../../infra/core/src/primitives/managed-region.ts"() {
5867
+ "../../infra/foundation/src/primitives/managed-region.ts"() {
5868
5868
  "use strict";
5869
5869
  }
5870
5870
  });
@@ -7001,7 +7001,7 @@ var init_loader = __esm({
7001
7001
  }
7002
7002
  });
7003
7003
 
7004
- // ../../infra/core/src/primitives/result.ts
7004
+ // ../../infra/foundation/src/primitives/result.ts
7005
7005
  function resultOk(value) {
7006
7006
  return { ok: true, value };
7007
7007
  }
@@ -7009,12 +7009,12 @@ function resultErr(error2) {
7009
7009
  return { ok: false, error: error2 };
7010
7010
  }
7011
7011
  var init_result2 = __esm({
7012
- "../../infra/core/src/primitives/result.ts"() {
7012
+ "../../infra/foundation/src/primitives/result.ts"() {
7013
7013
  "use strict";
7014
7014
  }
7015
7015
  });
7016
7016
 
7017
- // ../../infra/core/src/config/xdg-path.ts
7017
+ // ../../infra/foundation/src/config/xdg-path.ts
7018
7018
  import { isAbsolute as isAbsolute2, join as join3 } from "node:path";
7019
7019
  function resolveXdgHome(kind, env) {
7020
7020
  const xdgValue = env[XDG_ENV_BY_KIND[kind]];
@@ -7082,7 +7082,7 @@ function expandHomeRelativePath(path2, env) {
7082
7082
  }
7083
7083
  var XDG_ENV_BY_KIND, XDG_DEFAULT_SEGMENTS_BY_KIND;
7084
7084
  var init_xdg_path = __esm({
7085
- "../../infra/core/src/config/xdg-path.ts"() {
7085
+ "../../infra/foundation/src/config/xdg-path.ts"() {
7086
7086
  "use strict";
7087
7087
  init_result2();
7088
7088
  XDG_ENV_BY_KIND = {
@@ -8524,7 +8524,7 @@ Error: ${message}`,
8524
8524
  }
8525
8525
  });
8526
8526
 
8527
- // ../../capabilities/objective/src/core/real-storage.ts
8527
+ // ../../capabilities/objectives/src/core/real-storage.ts
8528
8528
  import { lstat, mkdir as mkdir2, readdir, readFile as readFile2, rename } from "node:fs/promises";
8529
8529
  import { dirname as dirname4, resolve as resolve5 } from "node:path";
8530
8530
  function kindFromTypeChecks(value) {
@@ -8540,7 +8540,7 @@ function storageError(code, message) {
8540
8540
  }
8541
8541
  var RealObjectiveStorageGateway;
8542
8542
  var init_real_storage = __esm({
8543
- "../../capabilities/objective/src/core/real-storage.ts"() {
8543
+ "../../capabilities/objectives/src/core/real-storage.ts"() {
8544
8544
  "use strict";
8545
8545
  init_primitives();
8546
8546
  RealObjectiveStorageGateway = class {
@@ -8610,7 +8610,7 @@ var init_real_storage = __esm({
8610
8610
  }
8611
8611
  });
8612
8612
 
8613
- // ../../infra/core/src/primitives/markdown-frontmatter.ts
8613
+ // ../../infra/foundation/src/primitives/markdown-frontmatter.ts
8614
8614
  function splitMarkdownFrontmatter(text) {
8615
8615
  const linesWithEndings = splitLinesKeepEndings(text);
8616
8616
  if (linesWithEndings.length === 0) return { type: "not_found" };
@@ -8646,7 +8646,7 @@ function firstLineEnding(text) {
8646
8646
  return match[0] === "\r\n" ? "\r\n" : "\n";
8647
8647
  }
8648
8648
  var init_markdown_frontmatter = __esm({
8649
- "../../infra/core/src/primitives/markdown-frontmatter.ts"() {
8649
+ "../../infra/foundation/src/primitives/markdown-frontmatter.ts"() {
8650
8650
  "use strict";
8651
8651
  }
8652
8652
  });
@@ -15978,7 +15978,7 @@ var require_dist = __commonJS({
15978
15978
  }
15979
15979
  });
15980
15980
 
15981
- // ../../capabilities/objective/src/core/record-frontmatter.ts
15981
+ // ../../capabilities/objectives/src/core/record-frontmatter.ts
15982
15982
  import { z as z12 } from "zod";
15983
15983
  function splitObjectiveRecordDocument(content) {
15984
15984
  const split = splitMarkdownFrontmatter(content);
@@ -16016,7 +16016,7 @@ function malformedFrontmatterDocument(message, body) {
16016
16016
  }
16017
16017
  var import_yaml, objectiveRecordEdgeSchema, objectiveRecordFrontmatterSchema, objectiveRecordFrontmatterParseSchema;
16018
16018
  var init_record_frontmatter = __esm({
16019
- "../../capabilities/objective/src/core/record-frontmatter.ts"() {
16019
+ "../../capabilities/objectives/src/core/record-frontmatter.ts"() {
16020
16020
  "use strict";
16021
16021
  init_markdown_frontmatter();
16022
16022
  init_primitives();
@@ -16036,7 +16036,7 @@ var init_record_frontmatter = __esm({
16036
16036
  }
16037
16037
  });
16038
16038
 
16039
- // ../../capabilities/objective/src/core/storage.ts
16039
+ // ../../capabilities/objectives/src/core/storage.ts
16040
16040
  import { basename as basename4, join as join5 } from "node:path";
16041
16041
  import { z as z13 } from "zod";
16042
16042
  function isValidObjectiveSlug(slug) {
@@ -16096,7 +16096,7 @@ function posixJoin(...parts) {
16096
16096
  }
16097
16097
  var ACTIVE_OBJECTIVE_ROOT, OBJECTIVE_ARCHIVE_ROOT, objectiveFilesSchema, objectiveUpdateFileSchema, objectiveMarkdownReadResultSchema, ObjectiveStorage, objectiveArchivePathRules;
16098
16098
  var init_storage = __esm({
16099
- "../../capabilities/objective/src/core/storage.ts"() {
16099
+ "../../capabilities/objectives/src/core/storage.ts"() {
16100
16100
  "use strict";
16101
16101
  init_record_frontmatter();
16102
16102
  ACTIVE_OBJECTIVE_ROOT = ".ns/objectives";
@@ -16278,7 +16278,7 @@ var init_storage = __esm({
16278
16278
  }
16279
16279
  });
16280
16280
 
16281
- // ../../capabilities/objective/src/ns/context.ts
16281
+ // ../../capabilities/objectives/src/ns/context.ts
16282
16282
  async function createNsObjectiveContext(ctx, options = {}) {
16283
16283
  const git = options.git ?? createNsGitGateway(ctx);
16284
16284
  const repoRootResult = await git.optionalRepoRoot({ cwd: ctx.cwd });
@@ -16295,7 +16295,7 @@ async function createNsObjectiveContext(ctx, options = {}) {
16295
16295
  };
16296
16296
  }
16297
16297
  var init_context2 = __esm({
16298
- "../../capabilities/objective/src/ns/context.ts"() {
16298
+ "../../capabilities/objectives/src/ns/context.ts"() {
16299
16299
  "use strict";
16300
16300
  init_git();
16301
16301
  init_real_storage();
@@ -16303,7 +16303,7 @@ var init_context2 = __esm({
16303
16303
  }
16304
16304
  });
16305
16305
 
16306
- // ../../capabilities/objective/src/ns/command.ts
16306
+ // ../../capabilities/objectives/src/ns/command.ts
16307
16307
  function objectiveNsCommand(options) {
16308
16308
  return createNsDomainCommand({
16309
16309
  ...options,
@@ -16311,14 +16311,14 @@ function objectiveNsCommand(options) {
16311
16311
  });
16312
16312
  }
16313
16313
  var init_command3 = __esm({
16314
- "../../capabilities/objective/src/ns/command.ts"() {
16314
+ "../../capabilities/objectives/src/ns/command.ts"() {
16315
16315
  "use strict";
16316
16316
  init_ns_command();
16317
16317
  init_context2();
16318
16318
  }
16319
16319
  });
16320
16320
 
16321
- // ../../infra/core/src/cli-theme/glyphs.ts
16321
+ // ../../infra/foundation/src/cli-theme/glyphs.ts
16322
16322
  function glyph(caps, name) {
16323
16323
  const g = GLYPHS[name];
16324
16324
  return caps.canRenderUnicode ? g.unicode : g.ascii;
@@ -16331,7 +16331,7 @@ function ellipsisFor(caps) {
16331
16331
  }
16332
16332
  var GLYPHS;
16333
16333
  var init_glyphs = __esm({
16334
- "../../infra/core/src/cli-theme/glyphs.ts"() {
16334
+ "../../infra/foundation/src/cli-theme/glyphs.ts"() {
16335
16335
  "use strict";
16336
16336
  GLYPHS = {
16337
16337
  done: { unicode: "\u2713", ascii: "v" },
@@ -16344,7 +16344,7 @@ var init_glyphs = __esm({
16344
16344
  }
16345
16345
  });
16346
16346
 
16347
- // ../../infra/core/src/cli-theme/palette.ts
16347
+ // ../../infra/foundation/src/cli-theme/palette.ts
16348
16348
  function swatchSgr(caps, swatch) {
16349
16349
  switch (caps.colorDepth) {
16350
16350
  case "truecolor":
@@ -16375,7 +16375,7 @@ function bold(text) {
16375
16375
  }
16376
16376
  var RESET, DIM, BOLD, PALETTE;
16377
16377
  var init_palette = __esm({
16378
- "../../infra/core/src/cli-theme/palette.ts"() {
16378
+ "../../infra/foundation/src/cli-theme/palette.ts"() {
16379
16379
  "use strict";
16380
16380
  RESET = "\x1B[0m";
16381
16381
  DIM = "\x1B[2m";
@@ -16395,7 +16395,7 @@ var init_palette = __esm({
16395
16395
  }
16396
16396
  });
16397
16397
 
16398
- // ../../infra/core/src/cli-theme/result-block.ts
16398
+ // ../../infra/foundation/src/cli-theme/result-block.ts
16399
16399
  function resultBlockHeadline(caps, input) {
16400
16400
  const style = resultBlockHeadlineStyle(input.kind);
16401
16401
  return bold(paint(caps, style.intent, `${glyph(caps, style.glyphName)} ${input.headline}`));
@@ -16427,7 +16427,7 @@ function normalDetail(value) {
16427
16427
  return normalized === "" ? void 0 : normalized;
16428
16428
  }
16429
16429
  var init_result_block = __esm({
16430
- "../../infra/core/src/cli-theme/result-block.ts"() {
16430
+ "../../infra/foundation/src/cli-theme/result-block.ts"() {
16431
16431
  "use strict";
16432
16432
  init_src();
16433
16433
  init_glyphs();
@@ -16435,9 +16435,25 @@ var init_result_block = __esm({
16435
16435
  }
16436
16436
  });
16437
16437
 
16438
- // ../../infra/core/src/cli-theme/report.ts
16438
+ // ../../infra/foundation/src/cli-theme/report.ts
16439
+ function stripAnsiWhenDisabled(output, caps) {
16440
+ return caps.canEmitAnsi ? output : stripTerminalEscapes(output);
16441
+ }
16442
+ function renderBufferedReport(options) {
16443
+ const resolvedCaps = resolveRenderCapabilities(options.caps);
16444
+ const title = options.titleStyle === "plain" ? options.title : paint(resolvedCaps, "accent", options.title);
16445
+ const lines = [title];
16446
+ for (const section of options.sections) {
16447
+ if (section.title === "") {
16448
+ lines.push("", ...section.lines);
16449
+ continue;
16450
+ }
16451
+ lines.push("", section.title, ...section.lines);
16452
+ }
16453
+ return stripAnsiWhenDisabled(lines.join("\n"), options.caps);
16454
+ }
16439
16455
  var init_report = __esm({
16440
- "../../infra/core/src/cli-theme/report.ts"() {
16456
+ "../../infra/foundation/src/cli-theme/report.ts"() {
16441
16457
  "use strict";
16442
16458
  init_src();
16443
16459
  init_terminal_escapes();
@@ -16445,7 +16461,7 @@ var init_report = __esm({
16445
16461
  }
16446
16462
  });
16447
16463
 
16448
- // ../../infra/core/src/cli-theme/text.ts
16464
+ // ../../infra/foundation/src/cli-theme/text.ts
16449
16465
  function truncatePlain(text, width, ellipsis = "\u2026") {
16450
16466
  if (width <= 0) return "";
16451
16467
  if (text.length <= width) return text;
@@ -16459,16 +16475,34 @@ function padCell(colored, plain, width) {
16459
16475
  const gap = width - plain.length;
16460
16476
  return gap > 0 ? colored + " ".repeat(gap) : colored;
16461
16477
  }
16478
+ function wrapPlain(text, width) {
16479
+ const floor = Math.max(1, width);
16480
+ const words = text.trim().split(/\s+/u).filter((word) => word.length > 0);
16481
+ const lines = [];
16482
+ let current = "";
16483
+ for (const word of words) {
16484
+ if (current === "") {
16485
+ current = word;
16486
+ } else if (current.length + 1 + word.length <= floor) {
16487
+ current = `${current} ${word}`;
16488
+ } else {
16489
+ lines.push(current);
16490
+ current = word;
16491
+ }
16492
+ }
16493
+ if (current !== "") lines.push(current);
16494
+ return lines;
16495
+ }
16462
16496
  var init_text = __esm({
16463
- "../../infra/core/src/cli-theme/text.ts"() {
16497
+ "../../infra/foundation/src/cli-theme/text.ts"() {
16464
16498
  "use strict";
16465
16499
  init_terminal_escapes();
16466
16500
  }
16467
16501
  });
16468
16502
 
16469
- // ../../infra/core/src/cli-theme/status-line.ts
16503
+ // ../../infra/foundation/src/cli-theme/status-line.ts
16470
16504
  var init_status_line = __esm({
16471
- "../../infra/core/src/cli-theme/status-line.ts"() {
16505
+ "../../infra/foundation/src/cli-theme/status-line.ts"() {
16472
16506
  "use strict";
16473
16507
  init_glyphs();
16474
16508
  init_palette();
@@ -16476,7 +16510,7 @@ var init_status_line = __esm({
16476
16510
  }
16477
16511
  });
16478
16512
 
16479
- // ../../infra/core/src/cli-theme/table.ts
16513
+ // ../../infra/foundation/src/cli-theme/table.ts
16480
16514
  function cell(styled2, plain) {
16481
16515
  return { styled: styled2, plain: plain ?? stripTerminalEscapes(styled2) };
16482
16516
  }
@@ -16562,7 +16596,7 @@ function padLeftStyled(styled2, plain, width) {
16562
16596
  }
16563
16597
  var DEFAULT_GAP;
16564
16598
  var init_table = __esm({
16565
- "../../infra/core/src/cli-theme/table.ts"() {
16599
+ "../../infra/foundation/src/cli-theme/table.ts"() {
16566
16600
  "use strict";
16567
16601
  init_terminal_escapes();
16568
16602
  init_glyphs();
@@ -16572,9 +16606,9 @@ var init_table = __esm({
16572
16606
  }
16573
16607
  });
16574
16608
 
16575
- // ../../infra/core/src/cli-theme/index.ts
16609
+ // ../../infra/foundation/src/cli-theme/index.ts
16576
16610
  var init_cli_theme = __esm({
16577
- "../../infra/core/src/cli-theme/index.ts"() {
16611
+ "../../infra/foundation/src/cli-theme/index.ts"() {
16578
16612
  "use strict";
16579
16613
  init_glyphs();
16580
16614
  init_palette();
@@ -16586,7 +16620,7 @@ var init_cli_theme = __esm({
16586
16620
  }
16587
16621
  });
16588
16622
 
16589
- // ../../capabilities/objective/src/core/operations/format.ts
16623
+ // ../../capabilities/objectives/src/core/operations/format.ts
16590
16624
  function pythonStringRepr(value) {
16591
16625
  return `'${value.replaceAll("\\", "\\\\").replaceAll("'", "\\'")}'`;
16592
16626
  }
@@ -16594,12 +16628,12 @@ function removeOneTrailingNewline(value) {
16594
16628
  return value.endsWith("\n") ? value.slice(0, -1) : value;
16595
16629
  }
16596
16630
  var init_format2 = __esm({
16597
- "../../capabilities/objective/src/core/operations/format.ts"() {
16631
+ "../../capabilities/objectives/src/core/operations/format.ts"() {
16598
16632
  "use strict";
16599
16633
  }
16600
16634
  });
16601
16635
 
16602
- // ../../capabilities/objective/src/core/operations/slug-validation-errors.ts
16636
+ // ../../capabilities/objectives/src/core/operations/slug-validation-errors.ts
16603
16637
  function handleObjectiveSlugValidationErrors(result, slug) {
16604
16638
  if (result.status === "missing-slug") {
16605
16639
  return negative("Missing Objective slug. Pass an explicit slug.", { data: result });
@@ -16613,14 +16647,14 @@ function handleObjectiveSlugValidationErrors(result, slug) {
16613
16647
  return null;
16614
16648
  }
16615
16649
  var init_slug_validation_errors = __esm({
16616
- "../../capabilities/objective/src/core/operations/slug-validation-errors.ts"() {
16650
+ "../../capabilities/objectives/src/core/operations/slug-validation-errors.ts"() {
16617
16651
  "use strict";
16618
16652
  init_src();
16619
16653
  init_format2();
16620
16654
  }
16621
16655
  });
16622
16656
 
16623
- // ../../capabilities/objective/src/core/operations/archive-objective.ts
16657
+ // ../../capabilities/objectives/src/core/operations/archive-objective.ts
16624
16658
  import { z as z14 } from "zod";
16625
16659
  async function runArchiveObjective(ctx, request) {
16626
16660
  const result = await archiveObjective(ctx.storage, request);
@@ -16807,7 +16841,7 @@ function sourceNotFoundMessage(slug, direction, sourcePath) {
16807
16841
  }
16808
16842
  var archiveObjectiveRequestSchema, archiveObjectiveResultSchema;
16809
16843
  var init_archive_objective = __esm({
16810
- "../../capabilities/objective/src/core/operations/archive-objective.ts"() {
16844
+ "../../capabilities/objectives/src/core/operations/archive-objective.ts"() {
16811
16845
  "use strict";
16812
16846
  init_src();
16813
16847
  init_cli_theme();
@@ -16840,10 +16874,10 @@ var init_archive_objective = __esm({
16840
16874
  }
16841
16875
  });
16842
16876
 
16843
- // ../../capabilities/objective/src/ns/commands/archive.ts
16877
+ // ../../capabilities/objectives/src/ns/commands/archive.ts
16844
16878
  var objectiveArchiveNsCommand, archive_default;
16845
16879
  var init_archive = __esm({
16846
- "../../capabilities/objective/src/ns/commands/archive.ts"() {
16880
+ "../../capabilities/objectives/src/ns/commands/archive.ts"() {
16847
16881
  "use strict";
16848
16882
  init_sdk();
16849
16883
  init_command3();
@@ -16865,7 +16899,7 @@ var init_archive = __esm({
16865
16899
  }
16866
16900
  });
16867
16901
 
16868
- // ../../capabilities/objective/src/core/operations/check-items.ts
16902
+ // ../../capabilities/objectives/src/core/operations/check-items.ts
16869
16903
  import { z as z15 } from "zod";
16870
16904
  function checkItem(options) {
16871
16905
  return {
@@ -16901,7 +16935,7 @@ function countIssues(checks, severity) {
16901
16935
  }
16902
16936
  var objectiveCheckItemSchema;
16903
16937
  var init_check_items = __esm({
16904
- "../../capabilities/objective/src/core/operations/check-items.ts"() {
16938
+ "../../capabilities/objectives/src/core/operations/check-items.ts"() {
16905
16939
  "use strict";
16906
16940
  objectiveCheckItemSchema = z15.object({
16907
16941
  path: z15.string(),
@@ -16913,7 +16947,7 @@ var init_check_items = __esm({
16913
16947
  }
16914
16948
  });
16915
16949
 
16916
- // ../../capabilities/objective/src/core/operations/edge-lint.ts
16950
+ // ../../capabilities/objectives/src/core/operations/edge-lint.ts
16917
16951
  async function objectiveEdgeLintChecks(options) {
16918
16952
  return await lintObjectiveRecordFrontmatterState({
16919
16953
  storage: options.storage,
@@ -17158,7 +17192,7 @@ async function mirrorViolation(options) {
17158
17192
  value: violation(path2, label, "counterpart Record Frontmatter is malformed")
17159
17193
  };
17160
17194
  }
17161
- const hasMirror = counterpart.value.frontmatter.edges.some((edge) => edge.objective === slug);
17195
+ const hasMirror = findObjectiveEdgeAnnotation(counterpart.value.frontmatter, slug) !== null;
17162
17196
  if (!hasMirror) {
17163
17197
  return {
17164
17198
  ok: true,
@@ -17167,6 +17201,9 @@ async function mirrorViolation(options) {
17167
17201
  }
17168
17202
  return { ok: true, value: null };
17169
17203
  }
17204
+ function findObjectiveEdgeAnnotation(frontmatter, slug) {
17205
+ return frontmatter.edges.find((edge) => edge.objective === slug)?.annotation ?? null;
17206
+ }
17170
17207
  function classifyRecordFrontmatter(document) {
17171
17208
  const parse2 = document.frontmatter;
17172
17209
  if (parse2 === void 0) return { type: "absent" };
@@ -17177,14 +17214,14 @@ function violation(path2, label, detail) {
17177
17214
  return { path: path2, label, isPassed: false, severity: "error", detail };
17178
17215
  }
17179
17216
  var init_edge_lint = __esm({
17180
- "../../capabilities/objective/src/core/operations/edge-lint.ts"() {
17217
+ "../../capabilities/objectives/src/core/operations/edge-lint.ts"() {
17181
17218
  "use strict";
17182
17219
  init_storage();
17183
17220
  init_check_items();
17184
17221
  }
17185
17222
  });
17186
17223
 
17187
- // ../../capabilities/objective/src/core/operations/objective-target.ts
17224
+ // ../../capabilities/objectives/src/core/operations/objective-target.ts
17188
17225
  function targetToEmptyResultFields(target) {
17189
17226
  return {
17190
17227
  rootPath: target.rootPath,
@@ -17225,13 +17262,13 @@ async function resolveObjectiveRecordTarget(storage, slug) {
17225
17262
  };
17226
17263
  }
17227
17264
  var init_objective_target = __esm({
17228
- "../../capabilities/objective/src/core/operations/objective-target.ts"() {
17265
+ "../../capabilities/objectives/src/core/operations/objective-target.ts"() {
17229
17266
  "use strict";
17230
17267
  init_storage();
17231
17268
  }
17232
17269
  });
17233
17270
 
17234
- // ../../capabilities/objective/src/core/operations/check-objective.ts
17271
+ // ../../capabilities/objectives/src/core/operations/check-objective.ts
17235
17272
  import { z as z16 } from "zod";
17236
17273
  async function runCheckObjective(ctx, request) {
17237
17274
  const result = await checkObjective(ctx.storage, request.slug);
@@ -17527,7 +17564,7 @@ function hasTitleHeading(content) {
17527
17564
  }
17528
17565
  var requiredObjectiveHeadings, requiredRoadmapHeadings, requiredUpdateHeadings, checkObjectiveRequestSchema, checkObjectiveBaseResultSchema, checkObjectiveMissingSlugResultSchema, checkObjectiveInvalidSlugResultSchema, checkObjectiveNotFoundResultSchema, checkObjectiveNonSelectedResultSchema, checkObjectiveEvaluatedBaseResultSchema, checkObjectiveOkResultSchema, checkObjectiveFailedResultSchema, checkObjectiveResultSchema;
17529
17566
  var init_check_objective = __esm({
17530
- "../../capabilities/objective/src/core/operations/check-objective.ts"() {
17567
+ "../../capabilities/objectives/src/core/operations/check-objective.ts"() {
17531
17568
  "use strict";
17532
17569
  init_src();
17533
17570
  init_cli_theme();
@@ -17602,7 +17639,7 @@ var init_check_objective = __esm({
17602
17639
  }
17603
17640
  });
17604
17641
 
17605
- // ../../capabilities/objective/src/core/operations/edge-sweep.ts
17642
+ // ../../capabilities/objectives/src/core/operations/edge-sweep.ts
17606
17643
  import { z as z17 } from "zod";
17607
17644
  async function runEdgeSweep(storage) {
17608
17645
  const rootPresence2 = await storage.activeRootExists();
@@ -17661,7 +17698,7 @@ function renderEdgeSweep(result, caps = { canEmitAnsi: false }) {
17661
17698
  }
17662
17699
  var objectiveEdgeSweepBaseResultSchema, objectiveEdgeSweepOkResultSchema, objectiveEdgeSweepFailedResultSchema, objectiveEdgeSweepResultSchema;
17663
17700
  var init_edge_sweep = __esm({
17664
- "../../capabilities/objective/src/core/operations/edge-sweep.ts"() {
17701
+ "../../capabilities/objectives/src/core/operations/edge-sweep.ts"() {
17665
17702
  "use strict";
17666
17703
  init_src();
17667
17704
  init_cli_theme();
@@ -17693,7 +17730,7 @@ var init_edge_sweep = __esm({
17693
17730
  }
17694
17731
  });
17695
17732
 
17696
- // ../../capabilities/objective/src/ns/commands/check.ts
17733
+ // ../../capabilities/objectives/src/ns/commands/check.ts
17697
17734
  import { z as z18 } from "zod";
17698
17735
  async function runObjectiveCheckCommand(ctx, request) {
17699
17736
  if (request.all === true) {
@@ -17712,7 +17749,7 @@ function renderObjectiveCheckCommand(result, caps = { canEmitAnsi: false }) {
17712
17749
  }
17713
17750
  var objectiveCheckCommandRequestSchema, objectiveCheckCommandResultSchema, objectiveCheckNsCommand, check_default;
17714
17751
  var init_check = __esm({
17715
- "../../capabilities/objective/src/ns/commands/check.ts"() {
17752
+ "../../capabilities/objectives/src/ns/commands/check.ts"() {
17716
17753
  "use strict";
17717
17754
  init_src();
17718
17755
  init_sdk();
@@ -17745,7 +17782,7 @@ var init_check = __esm({
17745
17782
  }
17746
17783
  });
17747
17784
 
17748
- // ../../infra/core/src/terminal/text-table.ts
17785
+ // ../../infra/foundation/src/terminal/text-table.ts
17749
17786
  function renderTextTable(options) {
17750
17787
  const gap = options.gap ?? DEFAULT_GAP2;
17751
17788
  const canEmitAnsi = options.canEmitAnsi === true;
@@ -17845,7 +17882,7 @@ function isWide(codePoint) {
17845
17882
  }
17846
17883
  var DEFAULT_GAP2, ESC, RESET2, STYLE_CODES;
17847
17884
  var init_text_table = __esm({
17848
- "../../infra/core/src/terminal/text-table.ts"() {
17885
+ "../../infra/foundation/src/terminal/text-table.ts"() {
17849
17886
  "use strict";
17850
17887
  init_terminal_escapes();
17851
17888
  DEFAULT_GAP2 = " ";
@@ -17863,7 +17900,14 @@ var init_text_table = __esm({
17863
17900
  }
17864
17901
  });
17865
17902
 
17866
- // ../../capabilities/objective/src/core/operations/list-branch-attribution.ts
17903
+ // ../../capabilities/objectives/src/core/operations/list-branch-attribution.ts
17904
+ async function buildObjectiveBranchAttributionForContext(ctx, slugs) {
17905
+ return await buildObjectiveBranchAttribution(ctx.git, {
17906
+ repoRoot: ctx.repoRoot,
17907
+ trunkBranch: ctx.trunkBranch,
17908
+ slugs
17909
+ });
17910
+ }
17867
17911
  async function buildObjectiveBranchAttribution(git, params) {
17868
17912
  if (params.slugs.size === 0) return { type: "ok", value: emptyAttribution(params.slugs) };
17869
17913
  const tips = await git.listLocalBranchTips({ cwd: params.repoRoot });
@@ -17936,14 +17980,28 @@ function freezeAttributionMap(bySlug) {
17936
17980
  }
17937
17981
  var MAX_UPDATED_BRANCH_ATTRIBUTION_WALKS;
17938
17982
  var init_list_branch_attribution = __esm({
17939
- "../../capabilities/objective/src/core/operations/list-branch-attribution.ts"() {
17983
+ "../../capabilities/objectives/src/core/operations/list-branch-attribution.ts"() {
17940
17984
  "use strict";
17941
17985
  init_storage();
17942
17986
  MAX_UPDATED_BRANCH_ATTRIBUTION_WALKS = 50;
17943
17987
  }
17944
17988
  });
17945
17989
 
17946
- // ../../capabilities/objective/src/core/operations/list-objectives.ts
17990
+ // ../../capabilities/objectives/src/core/operations/record-frontmatter-read.ts
17991
+ function readParsedObjectiveFrontmatter(read) {
17992
+ if (read.type !== "ok") return { frontmatter: null };
17993
+ const parse2 = read.document.frontmatter;
17994
+ if (parse2 === void 0) return { frontmatter: null };
17995
+ if (parse2.type === "malformed") return { frontmatter: null, malformed: parse2.message };
17996
+ return { frontmatter: parse2.frontmatter };
17997
+ }
17998
+ var init_record_frontmatter_read = __esm({
17999
+ "../../capabilities/objectives/src/core/operations/record-frontmatter-read.ts"() {
18000
+ "use strict";
18001
+ }
18002
+ });
18003
+
18004
+ // ../../capabilities/objectives/src/core/operations/list-objectives.ts
17947
18005
  import { z as z19 } from "zod";
17948
18006
  async function runListObjectives(ctx, request) {
17949
18007
  const result = await buildObjectiveListResult(ctx, request);
@@ -17957,19 +18015,6 @@ async function buildObjectiveListResult(ctx, request) {
17957
18015
  const filtered = inventory.value.records.filter(
17958
18016
  (record) => matchesStatusFilter(record.status, request.status)
17959
18017
  );
17960
- const includeBranchAttribution = shouldIncludeBranchAttribution(request);
17961
- let updatedBranchesBySlug = /* @__PURE__ */ new Map();
17962
- let isUpdatedBranchesTruncated = false;
17963
- if (includeBranchAttribution) {
17964
- const attribution = await buildObjectiveBranchAttribution(ctx.git, {
17965
- repoRoot: ctx.repoRoot,
17966
- trunkBranch: ctx.trunkBranch,
17967
- slugs: new Set(filtered.map((record) => record.slug))
17968
- });
17969
- if (attribution.type === "git-error") return attribution;
17970
- updatedBranchesBySlug = attribution.value.updatedBranchesBySlug;
17971
- isUpdatedBranchesTruncated = attribution.value.isTruncated;
17972
- }
17973
18018
  const builtRecords = await Promise.all(
17974
18019
  filtered.map(
17975
18020
  (record) => buildObjectiveListRecord({
@@ -17977,17 +18022,28 @@ async function buildObjectiveListResult(ctx, request) {
17977
18022
  git: ctx.git,
17978
18023
  repoRoot: ctx.repoRoot,
17979
18024
  slug: record.slug,
17980
- status: record.status,
17981
- updatedBranches: updatedBranchesBySlug.get(record.slug)
18025
+ status: record.status
17982
18026
  })
17983
18027
  )
17984
18028
  );
17985
- const records = [];
18029
+ const baseRecords = [];
17986
18030
  for (const built of builtRecords) {
17987
18031
  if (built.type === "storage-error") return built;
17988
18032
  if (built.type === "git-error") return built;
17989
- records.push(built.value);
18033
+ baseRecords.push(built.value);
17990
18034
  }
18035
+ const attribution = await buildObjectiveBranchAttributionForContext(
18036
+ ctx,
18037
+ new Set(baseRecords.map((record) => record.slug))
18038
+ );
18039
+ if (attribution.type === "git-error") return attribution;
18040
+ const records = baseRecords.map((record) => {
18041
+ const updatedBranchCount = attribution.value.updatedBranchesBySlug.get(record.slug)?.length ?? 0;
18042
+ return {
18043
+ ...record,
18044
+ ...updatedBranchCount > 0 ? { updatedBranchCount } : {}
18045
+ };
18046
+ });
17991
18047
  return {
17992
18048
  type: "ok",
17993
18049
  value: {
@@ -17995,8 +18051,6 @@ async function buildObjectiveListResult(ctx, request) {
17995
18051
  rootPath: activeRootRelativePath(),
17996
18052
  statusFilter: request.status,
17997
18053
  namesOnly: request.names,
17998
- ...includeBranchAttribution ? { updatedBranchesIncluded: true } : {},
17999
- ...isUpdatedBranchesTruncated ? { updatedBranchesTruncated: true } : {},
18000
18054
  records
18001
18055
  }
18002
18056
  };
@@ -18016,17 +18070,14 @@ function renderObjectiveListMarkdown(result) {
18016
18070
  `);
18017
18071
  return removeOneTrailingNewline(parts.join(""));
18018
18072
  }
18019
- parts.push("\n", markdownTableHeader(result), markdownTableSeparator(result));
18073
+ parts.push(
18074
+ "\n",
18075
+ "| objective | status | latest update | branches | edges |\n",
18076
+ "| --- | --- | --- | --- | --- |\n"
18077
+ );
18020
18078
  const markdownCaps = resolveSettledNonInteractiveCaps();
18021
18079
  for (const record of result.records) {
18022
- parts.push(markdownRecordRow(record, result.updatedBranchesIncluded === true, markdownCaps));
18023
- }
18024
- if (result.updatedBranchesTruncated === true) {
18025
- parts.push(
18026
- "\n",
18027
- `_Updated branch attribution limited to newest ${MAX_UPDATED_BRANCH_ATTRIBUTION_WALKS} changed local branches; older updated branches may be omitted._
18028
- `
18029
- );
18080
+ parts.push(markdownRecordRow(record, markdownCaps));
18030
18081
  }
18031
18082
  return removeOneTrailingNewline(parts.join(""));
18032
18083
  }
@@ -18063,48 +18114,70 @@ async function buildObjectiveListRecord(options) {
18063
18114
  ...facts.isBlocked ? { isBlocked: true } : {},
18064
18115
  latestUpdateIso: latestUpdateIsoFromUpdateNames(updates.value.map((update) => update.name)),
18065
18116
  ...facts.edgeCount > 0 ? { edgeCount: facts.edgeCount } : {},
18066
- ...options.updatedBranches === void 0 ? {} : { updatedBranches: [...options.updatedBranches] },
18067
18117
  hasOutstandingChanges: dirty.value
18068
18118
  }
18069
18119
  };
18070
18120
  }
18071
18121
  async function readListFrontmatterFacts(storage, recordRelativePath) {
18072
18122
  const read = await storage.readObjectiveRecordDocument(recordRelativePath);
18073
- if (read.type !== "ok") return { edgeCount: 0, isBlocked: false };
18074
- const parse2 = read.document.frontmatter;
18075
- if (parse2 === void 0 || parse2.type === "malformed") return { edgeCount: 0, isBlocked: false };
18123
+ const parsed = readParsedObjectiveFrontmatter(read);
18124
+ if (parsed.frontmatter === null) return { edgeCount: 0, isBlocked: false };
18076
18125
  return {
18077
- edgeCount: parse2.frontmatter.edges.length,
18078
- isBlocked: parse2.frontmatter.blocked !== null
18126
+ edgeCount: parsed.frontmatter.edges.length,
18127
+ isBlocked: parsed.frontmatter.blocked !== null
18079
18128
  };
18080
18129
  }
18081
18130
  function updateNameIso(name) {
18131
+ const fullyCompact = /^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z(?:-|\.md$)/u.exec(name);
18132
+ if (fullyCompact !== null) {
18133
+ return timestampPartsIso(
18134
+ `${fullyCompact[1]}-${fullyCompact[2]}-${fullyCompact[3]}`,
18135
+ fullyCompact[4] ?? "00",
18136
+ fullyCompact[5] ?? "00",
18137
+ fullyCompact[6] ?? "00"
18138
+ );
18139
+ }
18082
18140
  const compact = /^(\d{4}-\d{2}-\d{2})T(\d{2})(\d{2})(\d{2})Z(?:-|\.md$)/u.exec(name);
18083
- if (compact !== null) return `${compact[1]}T${compact[2]}:${compact[3]}:${compact[4]}Z`;
18141
+ if (compact !== null)
18142
+ return timestampPartsIso(
18143
+ compact[1] ?? "",
18144
+ compact[2] ?? "00",
18145
+ compact[3] ?? "00",
18146
+ compact[4] ?? "00"
18147
+ );
18084
18148
  const minute = /^(\d{4}-\d{2}-\d{2})-(\d{2})(\d{2})(?:-|\.md$)/u.exec(name);
18085
- if (minute !== null) return `${minute[1]}T${minute[2]}:${minute[3]}:00Z`;
18149
+ if (minute !== null)
18150
+ return timestampPartsIso(minute[1] ?? "", minute[2] ?? "00", minute[3] ?? "00", "00");
18086
18151
  const extended = /^(\d{4}-\d{2}-\d{2})T(\d{2}):(\d{2}):(\d{2})Z(?:-|\.md$)/u.exec(name);
18087
- if (extended !== null) return `${extended[1]}T${extended[2]}:${extended[3]}:${extended[4]}Z`;
18152
+ if (extended !== null)
18153
+ return timestampPartsIso(
18154
+ extended[1] ?? "",
18155
+ extended[2] ?? "00",
18156
+ extended[3] ?? "00",
18157
+ extended[4] ?? "00"
18158
+ );
18088
18159
  return null;
18089
18160
  }
18090
- function shouldIncludeBranchAttribution(request) {
18091
- return !request.names && !request.minimal;
18161
+ function timestampPartsIso(date, hour, minute, second) {
18162
+ return `${date}T${hour}:${minute}:${second}Z`;
18092
18163
  }
18093
18164
  function renderSlugs(records) {
18094
18165
  return records.map((record) => record.slug).join("\n");
18095
18166
  }
18096
18167
  function objectiveStatusPresentation(record) {
18097
18168
  if (record.status === "closed") {
18098
- return { glyphName: "done", intent: "success", word: "closed", qualifier: "" };
18169
+ return { glyphName: "done", intent: "success", word: "closed" };
18099
18170
  }
18100
18171
  if (record.isBlocked === true) {
18101
- return { glyphName: "blocked", intent: "warn", word: "open", qualifier: " (blocked)" };
18172
+ return { glyphName: "blocked", intent: "warn", word: "blocked" };
18102
18173
  }
18103
- return { glyphName: "open", intent: "accent", word: "open", qualifier: "" };
18174
+ return { glyphName: "open", intent: "accent", word: "open" };
18104
18175
  }
18105
18176
  function recordStatusCell(record, caps) {
18106
- const presentation = objectiveStatusPresentation(record);
18107
- return `${glyph(caps, presentation.glyphName)} ${presentation.word}${presentation.qualifier}`;
18177
+ return formatStatusPlain(caps, objectiveStatusPresentation(record));
18178
+ }
18179
+ function formatStatusPlain(caps, presentation) {
18180
+ return `${glyph(caps, presentation.glyphName)} ${presentation.word}`;
18108
18181
  }
18109
18182
  function edgeCountCell(record) {
18110
18183
  if (record.edgeCount === void 0) return "";
@@ -18121,37 +18194,26 @@ function formatLatestUpdate(record) {
18121
18194
  if (record.hasOutstandingChanges) return `(x) ${formatted}`;
18122
18195
  return formatted;
18123
18196
  }
18197
+ function updatedBranchCountCell(record) {
18198
+ return String(record.updatedBranchCount ?? 0);
18199
+ }
18124
18200
  function baseRecordCells(record, caps) {
18125
18201
  return [
18126
18202
  record.slug,
18127
18203
  recordStatusCell(record, caps),
18128
18204
  formatLatestUpdate(record),
18205
+ updatedBranchCountCell(record),
18129
18206
  edgeCountCell(record)
18130
18207
  ];
18131
18208
  }
18132
- function markdownTableHeader(result) {
18133
- if (result.updatedBranchesIncluded === true)
18134
- return "| objective | status | latest update | edges | updated branches |\n";
18135
- return "| objective | status | latest update | edges |\n";
18136
- }
18137
- function markdownTableSeparator(result) {
18138
- if (result.updatedBranchesIncluded === true) return "| --- | --- | --- | --- | --- |\n";
18139
- return "| --- | --- | --- | --- |\n";
18140
- }
18141
- function markdownRecordRow(record, shouldIncludeUpdatedBranches, caps) {
18209
+ function markdownRecordRow(record, caps) {
18142
18210
  const cells = baseRecordCells(record, caps);
18143
- if (shouldIncludeUpdatedBranches) cells.push(formatUpdatedBranches(record));
18144
18211
  return `| ${cells.join(" | ")} |
18145
18212
  `;
18146
18213
  }
18147
- function formatUpdatedBranches(record) {
18148
- const branches = record.updatedBranches ?? [];
18149
- if (branches.length === 0) return "\u2014";
18150
- return branches.join(", ");
18151
- }
18152
18214
  var objectiveStatusFilterSchema, listObjectivesRequestSchema, objectiveListRecordSchema, objectiveListResultSchema;
18153
18215
  var init_list_objectives = __esm({
18154
- "../../capabilities/objective/src/core/operations/list-objectives.ts"() {
18216
+ "../../capabilities/objectives/src/core/operations/list-objectives.ts"() {
18155
18217
  "use strict";
18156
18218
  init_src();
18157
18219
  init_cli_theme();
@@ -18159,24 +18221,25 @@ var init_list_objectives = __esm({
18159
18221
  init_storage();
18160
18222
  init_format2();
18161
18223
  init_list_branch_attribution();
18224
+ init_record_frontmatter_read();
18162
18225
  objectiveStatusFilterSchema = z19.enum(["all", "active", "open", "closed"]);
18163
18226
  listObjectivesRequestSchema = z19.object({
18164
18227
  names: z19.boolean().default(false).describe("Output Objective slugs only, one per line."),
18165
- status: objectiveStatusFilterSchema.default("active").describe("Filter Objective records by checkout-local status."),
18166
- minimal: z19.boolean().default(false).describe("Hide local branch attribution and show the compact Objective list.")
18228
+ status: objectiveStatusFilterSchema.default("active").describe("Filter Objective records by checkout-local status.")
18167
18229
  });
18168
18230
  objectiveListRecordSchema = z19.object({
18169
18231
  slug: z19.string(),
18170
18232
  status: z19.enum(["open", "closed"]),
18171
18233
  /**
18172
- * Present (true) only when Record Frontmatter carries a `blocked:` sentence. Blocked is a
18173
- * sub-state of open, never a third lifecycle status; `status` stays "open" for blocked records.
18234
+ * Present (true) only when Record Frontmatter carries a `blocked:` sentence. Blocked renders as
18235
+ * human-facing state text, while `status` stays "open" for lifecycle/filtering semantics.
18174
18236
  */
18175
18237
  isBlocked: z19.boolean().optional(),
18176
18238
  latestUpdateIso: z19.string().nullable(),
18177
18239
  /** Present only when Record Frontmatter declares at least one Objective Edge. */
18178
18240
  edgeCount: z19.number().int().positive().optional(),
18179
- updatedBranches: z19.array(z19.string()).optional(),
18241
+ /** Present only when at least one local non-trunk branch touches this Objective record. */
18242
+ updatedBranchCount: z19.number().int().positive().optional(),
18180
18243
  hasOutstandingChanges: z19.boolean()
18181
18244
  });
18182
18245
  objectiveListResultSchema = z19.object({
@@ -18184,14 +18247,12 @@ var init_list_objectives = __esm({
18184
18247
  rootPath: z19.string(),
18185
18248
  statusFilter: objectiveStatusFilterSchema,
18186
18249
  namesOnly: z19.boolean(),
18187
- updatedBranchesIncluded: z19.boolean().optional(),
18188
- updatedBranchesTruncated: z19.boolean().optional(),
18189
18250
  records: z19.array(objectiveListRecordSchema)
18190
18251
  });
18191
18252
  }
18192
18253
  });
18193
18254
 
18194
- // ../../capabilities/objective/src/core/operations/list-candidates.ts
18255
+ // ../../capabilities/objectives/src/core/operations/list-candidates.ts
18195
18256
  import { z as z20 } from "zod";
18196
18257
  async function runListCandidates(ctx, request) {
18197
18258
  void request;
@@ -18206,7 +18267,7 @@ function renderListCandidates(result) {
18206
18267
  }
18207
18268
  var listCandidatesRequestSchema, objectiveCandidateRecordSchema, listCandidatesResultSchema;
18208
18269
  var init_list_candidates = __esm({
18209
- "../../capabilities/objective/src/core/operations/list-candidates.ts"() {
18270
+ "../../capabilities/objectives/src/core/operations/list-candidates.ts"() {
18210
18271
  "use strict";
18211
18272
  init_src();
18212
18273
  init_list_objectives();
@@ -18221,10 +18282,10 @@ var init_list_candidates = __esm({
18221
18282
  }
18222
18283
  });
18223
18284
 
18224
- // ../../capabilities/objective/src/ns/commands/exec-list-candidates.ts
18285
+ // ../../capabilities/objectives/src/ns/commands/exec-list-candidates.ts
18225
18286
  var objectiveExecListCandidatesNsCommand, exec_list_candidates_default;
18226
18287
  var init_exec_list_candidates = __esm({
18227
- "../../capabilities/objective/src/ns/commands/exec-list-candidates.ts"() {
18288
+ "../../capabilities/objectives/src/ns/commands/exec-list-candidates.ts"() {
18228
18289
  "use strict";
18229
18290
  init_sdk();
18230
18291
  init_command3();
@@ -18244,7 +18305,7 @@ var init_exec_list_candidates = __esm({
18244
18305
  }
18245
18306
  });
18246
18307
 
18247
- // ../../capabilities/objective/src/core/operations/load-orientations.ts
18308
+ // ../../capabilities/objectives/src/core/operations/load-orientations.ts
18248
18309
  import { z as z21 } from "zod";
18249
18310
  async function runLoadOrientations(ctx, request) {
18250
18311
  void request;
@@ -18278,7 +18339,7 @@ function normalizeOneTrailingNewline(content) {
18278
18339
  }
18279
18340
  var loadOrientationsRequestSchema, objectiveOrientationRecordSchema, loadOrientationsResultSchema;
18280
18341
  var init_load_orientations = __esm({
18281
- "../../capabilities/objective/src/core/operations/load-orientations.ts"() {
18342
+ "../../capabilities/objectives/src/core/operations/load-orientations.ts"() {
18282
18343
  "use strict";
18283
18344
  init_src();
18284
18345
  init_storage();
@@ -18298,10 +18359,10 @@ var init_load_orientations = __esm({
18298
18359
  }
18299
18360
  });
18300
18361
 
18301
- // ../../capabilities/objective/src/ns/commands/exec-load-orientations.ts
18362
+ // ../../capabilities/objectives/src/ns/commands/exec-load-orientations.ts
18302
18363
  var objectiveExecLoadOrientationsNsCommand, exec_load_orientations_default;
18303
18364
  var init_exec_load_orientations = __esm({
18304
- "../../capabilities/objective/src/ns/commands/exec-load-orientations.ts"() {
18365
+ "../../capabilities/objectives/src/ns/commands/exec-load-orientations.ts"() {
18305
18366
  "use strict";
18306
18367
  init_sdk();
18307
18368
  init_command3();
@@ -18322,7 +18383,7 @@ var init_exec_load_orientations = __esm({
18322
18383
  }
18323
18384
  });
18324
18385
 
18325
- // ../../capabilities/objective/src/core/operations/read-objective.ts
18386
+ // ../../capabilities/objectives/src/core/operations/read-objective.ts
18326
18387
  import { z as z22 } from "zod";
18327
18388
  async function runReadObjective(ctx, request) {
18328
18389
  const result = await readObjectiveRecord(ctx.storage, request.slug);
@@ -18460,7 +18521,7 @@ function appendMarkdownFile(parts, displayPath, read) {
18460
18521
  }
18461
18522
  var readObjectiveRequestSchema, readObjectiveBaseResultSchema, readObjectiveNonOkResultSchema, readObjectiveOkResultSchema, readObjectiveResultSchema;
18462
18523
  var init_read_objective = __esm({
18463
- "../../capabilities/objective/src/core/operations/read-objective.ts"() {
18524
+ "../../capabilities/objectives/src/core/operations/read-objective.ts"() {
18464
18525
  "use strict";
18465
18526
  init_src();
18466
18527
  init_primitives();
@@ -18515,10 +18576,10 @@ var init_read_objective = __esm({
18515
18576
  }
18516
18577
  });
18517
18578
 
18518
- // ../../capabilities/objective/src/ns/commands/exec-read-objective.ts
18579
+ // ../../capabilities/objectives/src/ns/commands/exec-read-objective.ts
18519
18580
  var objectiveExecReadObjectiveNsCommand, exec_read_objective_default;
18520
18581
  var init_exec_read_objective = __esm({
18521
- "../../capabilities/objective/src/ns/commands/exec-read-objective.ts"() {
18582
+ "../../capabilities/objectives/src/ns/commands/exec-read-objective.ts"() {
18522
18583
  "use strict";
18523
18584
  init_sdk();
18524
18585
  init_command3();
@@ -18540,7 +18601,7 @@ var init_exec_read_objective = __esm({
18540
18601
  }
18541
18602
  });
18542
18603
 
18543
- // ../../capabilities/objective/src/runner/at-prefixed-value.ts
18604
+ // ../../capabilities/objectives/src/runner/at-prefixed-value.ts
18544
18605
  import { resolve as resolve6 } from "node:path";
18545
18606
  function parseAtPrefixedValue(options) {
18546
18607
  if (!options.value.startsWith("@")) return { type: "inline", content: options.value };
@@ -18558,12 +18619,12 @@ async function resolveAtPrefixedValue(options) {
18558
18619
  return readAtPrefixedValue(parseAtPrefixedValue(options), options.readTextFile);
18559
18620
  }
18560
18621
  var init_at_prefixed_value = __esm({
18561
- "../../capabilities/objective/src/runner/at-prefixed-value.ts"() {
18622
+ "../../capabilities/objectives/src/runner/at-prefixed-value.ts"() {
18562
18623
  "use strict";
18563
18624
  }
18564
18625
  });
18565
18626
 
18566
- // ../../capabilities/objective/src/runner/guidance.ts
18627
+ // ../../capabilities/objectives/src/runner/guidance.ts
18567
18628
  async function resolveGuidance(options) {
18568
18629
  if (options.guidance === void 0) return { type: "ok" };
18569
18630
  const resolved = await resolveAtPrefixedValue({
@@ -18581,13 +18642,13 @@ function guidanceUsageProblem(result) {
18581
18642
  };
18582
18643
  }
18583
18644
  var init_guidance = __esm({
18584
- "../../capabilities/objective/src/runner/guidance.ts"() {
18645
+ "../../capabilities/objectives/src/runner/guidance.ts"() {
18585
18646
  "use strict";
18586
18647
  init_at_prefixed_value();
18587
18648
  }
18588
18649
  });
18589
18650
 
18590
- // ../../capabilities/objective/src/runner/preconditions.ts
18651
+ // ../../capabilities/objectives/src/runner/preconditions.ts
18591
18652
  function resolveRunnerStepIdentity(options) {
18592
18653
  if (options.slug === void 0) {
18593
18654
  return { type: "usage-error", message: "Objective slug is required.", argument: "slug" };
@@ -18663,7 +18724,7 @@ async function checkRunnerPreconditions(ctx, options) {
18663
18724
  };
18664
18725
  }
18665
18726
  var init_preconditions = __esm({
18666
- "../../capabilities/objective/src/runner/preconditions.ts"() {
18727
+ "../../capabilities/objectives/src/runner/preconditions.ts"() {
18667
18728
  "use strict";
18668
18729
  init_src();
18669
18730
  init_storage();
@@ -19586,10 +19647,10 @@ var init_cli2 = __esm({
19586
19647
  }
19587
19648
  });
19588
19649
 
19589
- // ../../infra/core/src/primitives/model-slug.ts
19650
+ // ../../infra/foundation/src/primitives/model-slug.ts
19590
19651
  var DEFAULT_FAST_MODEL, DEFAULT_FAST_MODEL_REF;
19591
19652
  var init_model_slug = __esm({
19592
- "../../infra/core/src/primitives/model-slug.ts"() {
19653
+ "../../infra/foundation/src/primitives/model-slug.ts"() {
19593
19654
  "use strict";
19594
19655
  DEFAULT_FAST_MODEL = {
19595
19656
  provider: "openai-codex",
@@ -22971,7 +23032,7 @@ var init_api = __esm({
22971
23032
  }
22972
23033
  });
22973
23034
 
22974
- // ../../capabilities/objective/src/runner/report.ts
23035
+ // ../../capabilities/objectives/src/runner/report.ts
22975
23036
  function renderRunnerReportNarrative(report) {
22976
23037
  const bodies = {
22977
23038
  Summary: report.sections.summary,
@@ -23005,7 +23066,7 @@ function buildRunnerReport(options) {
23005
23066
  }
23006
23067
  var RUNNER_REPORT_STATUSES, RUNNER_REPORT_SECTION_TITLES, RUNNER_REPORT_COMMIT_SUBJECT_REQUIRED_REASON;
23007
23068
  var init_report2 = __esm({
23008
- "../../capabilities/objective/src/runner/report.ts"() {
23069
+ "../../capabilities/objectives/src/runner/report.ts"() {
23009
23070
  "use strict";
23010
23071
  RUNNER_REPORT_STATUSES = ["ready-for-parent-commit", "stop", "blocked"];
23011
23072
  RUNNER_REPORT_SECTION_TITLES = [
@@ -23019,7 +23080,7 @@ var init_report2 = __esm({
23019
23080
  }
23020
23081
  });
23021
23082
 
23022
- // ../../capabilities/objective/src/runner/report-marker.ts
23083
+ // ../../capabilities/objectives/src/runner/report-marker.ts
23023
23084
  function parseRunnerReport(finalText) {
23024
23085
  const start = finalText.indexOf(OBJECTIVE_RUNNER_REPORT_BEGIN);
23025
23086
  const end = finalText.indexOf(OBJECTIVE_RUNNER_REPORT_END);
@@ -23154,7 +23215,7 @@ function isHeaderTextField(key) {
23154
23215
  }
23155
23216
  var OBJECTIVE_RUNNER_REPORT_BEGIN, OBJECTIVE_RUNNER_REPORT_END, HEADER_LIST_FIELDS, HEADER_TEXT_FIELDS;
23156
23217
  var init_report_marker = __esm({
23157
- "../../capabilities/objective/src/runner/report-marker.ts"() {
23218
+ "../../capabilities/objectives/src/runner/report-marker.ts"() {
23158
23219
  "use strict";
23159
23220
  init_report2();
23160
23221
  OBJECTIVE_RUNNER_REPORT_BEGIN = "OBJECTIVE_RUNNER_REPORT_BEGIN";
@@ -23164,7 +23225,7 @@ var init_report_marker = __esm({
23164
23225
  }
23165
23226
  });
23166
23227
 
23167
- // ../../capabilities/objective/src/runner/prompt.ts
23228
+ // ../../capabilities/objectives/src/runner/prompt.ts
23168
23229
  function buildRunnerChildPrompt(options) {
23169
23230
  const reportDescriptor = reportChannelDescriptor(options.reportChannel);
23170
23231
  const parts = [
@@ -23340,7 +23401,7 @@ function jsonReportContract(mode, reportPath) {
23340
23401
  }
23341
23402
  var RUNNER_GRAPHITE_STACK_NAVIGATION_RULE, OBJECTIVE_RUNNER_FORBIDDEN_ACTIONS_RULE, REPORT_SECTION_DESCRIPTORS;
23342
23403
  var init_prompt = __esm({
23343
- async "../../capabilities/objective/src/runner/prompt.ts"() {
23404
+ async "../../capabilities/objectives/src/runner/prompt.ts"() {
23344
23405
  "use strict";
23345
23406
  await init_api();
23346
23407
  init_primitives();
@@ -23369,7 +23430,7 @@ var init_prompt = __esm({
23369
23430
  }
23370
23431
  });
23371
23432
 
23372
- // ../../capabilities/objective/src/runner/begin.ts
23433
+ // ../../capabilities/objectives/src/runner/begin.ts
23373
23434
  import { resolve as resolve13 } from "node:path";
23374
23435
  import { z as z36 } from "zod";
23375
23436
  async function runRunnerBegin(ctx, request) {
@@ -23456,7 +23517,7 @@ function renderRunnerBegin(result) {
23456
23517
  }
23457
23518
  var runnerBeginRequestSchema, runnerBeginResultSchema;
23458
23519
  var init_begin = __esm({
23459
- async "../../capabilities/objective/src/runner/begin.ts"() {
23520
+ async "../../capabilities/objectives/src/runner/begin.ts"() {
23460
23521
  "use strict";
23461
23522
  init_src();
23462
23523
  init_primitives();
@@ -23486,7 +23547,7 @@ var init_begin = __esm({
23486
23547
  }
23487
23548
  });
23488
23549
 
23489
- // ../../capabilities/objective/src/ns/runner-context.ts
23550
+ // ../../capabilities/objectives/src/ns/runner-context.ts
23490
23551
  import { readFile as readFile5, stat as stat3 } from "node:fs/promises";
23491
23552
  async function createNsObjectiveRunnerCoreContext(ctx, overrides = readObjectiveRunnerOverrides(ctx)) {
23492
23553
  const base = await createNsObjectiveContext(
@@ -23550,7 +23611,7 @@ async function runnerFilePresence(path2) {
23550
23611
  }
23551
23612
  }
23552
23613
  var init_runner_context = __esm({
23553
- "../../capabilities/objective/src/ns/runner-context.ts"() {
23614
+ "../../capabilities/objectives/src/ns/runner-context.ts"() {
23554
23615
  "use strict";
23555
23616
  init_command_runner();
23556
23617
  init_branch();
@@ -23559,10 +23620,10 @@ var init_runner_context = __esm({
23559
23620
  }
23560
23621
  });
23561
23622
 
23562
- // ../../capabilities/objective/src/ns/commands/exec-runner-begin.ts
23623
+ // ../../capabilities/objectives/src/ns/commands/exec-runner-begin.ts
23563
23624
  var RUNNER_BEGIN_DESCRIPTION, objectiveExecRunnerBeginNsCommand, exec_runner_begin_default;
23564
23625
  var init_exec_runner_begin = __esm({
23565
- async "../../capabilities/objective/src/ns/commands/exec-runner-begin.ts"() {
23626
+ async "../../capabilities/objectives/src/ns/commands/exec-runner-begin.ts"() {
23566
23627
  "use strict";
23567
23628
  init_ns_command();
23568
23629
  init_sdk();
@@ -23587,7 +23648,7 @@ var init_exec_runner_begin = __esm({
23587
23648
  }
23588
23649
  });
23589
23650
 
23590
- // ../../capabilities/objective/src/runner/checkpoint.ts
23651
+ // ../../capabilities/objectives/src/runner/checkpoint.ts
23591
23652
  function renderRunnerCheckpoint(facts, narrative) {
23592
23653
  const lines = [
23593
23654
  `# Runner Checkpoint: ${facts.slug} (${facts.status})`,
@@ -23654,12 +23715,12 @@ function indentDiagnostic(diagnostic3) {
23654
23715
  return [` - ${first ?? ""}`, ...rest.map((line) => ` ${line}`)];
23655
23716
  }
23656
23717
  var init_checkpoint = __esm({
23657
- "../../capabilities/objective/src/runner/checkpoint.ts"() {
23718
+ "../../capabilities/objectives/src/runner/checkpoint.ts"() {
23658
23719
  "use strict";
23659
23720
  }
23660
23721
  });
23661
23722
 
23662
- // ../../capabilities/objective/src/runner/commit.ts
23723
+ // ../../capabilities/objectives/src/runner/commit.ts
23663
23724
  function composeRunnerCommitMessage(options) {
23664
23725
  const trailers = [`Objective-Runner-Step: ${options.slug}`];
23665
23726
  if (options.mode === "recover") trailers.push("Objective-Runner-Mode: recover");
@@ -23682,13 +23743,13 @@ async function commitRunnerStep(ctx, options) {
23682
23743
  return { type: "ok", commitSha: committed.value, message };
23683
23744
  }
23684
23745
  var init_commit = __esm({
23685
- "../../capabilities/objective/src/runner/commit.ts"() {
23746
+ "../../capabilities/objectives/src/runner/commit.ts"() {
23686
23747
  "use strict";
23687
23748
  init_primitives();
23688
23749
  }
23689
23750
  });
23690
23751
 
23691
- // ../../capabilities/objective/src/runner/gate.ts
23752
+ // ../../capabilities/objectives/src/runner/gate.ts
23692
23753
  import { z as z37 } from "zod";
23693
23754
  async function verifyRunnerStep(ctx, options) {
23694
23755
  const { mode, report, baseBranch, headAtDispatch } = options;
@@ -23877,7 +23938,7 @@ async function headUnchangedCheck(ctx, headAtDispatch) {
23877
23938
  }
23878
23939
  var GATE_CHECK_IDS, GATE_CHECK_STATUSES, gateCheckResultSchema;
23879
23940
  var init_gate = __esm({
23880
- "../../capabilities/objective/src/runner/gate.ts"() {
23941
+ "../../capabilities/objectives/src/runner/gate.ts"() {
23881
23942
  "use strict";
23882
23943
  init_exec();
23883
23944
  GATE_CHECK_IDS = [
@@ -23901,7 +23962,7 @@ var init_gate = __esm({
23901
23962
  }
23902
23963
  });
23903
23964
 
23904
- // ../../capabilities/objective/src/runner/report-file.ts
23965
+ // ../../capabilities/objectives/src/runner/report-file.ts
23905
23966
  import { z as z38 } from "zod";
23906
23967
  function parseRunnerReportJson(text) {
23907
23968
  let parsed;
@@ -23936,7 +23997,7 @@ function buildRunnerReportFromJson(data) {
23936
23997
  }
23937
23998
  var runnerReportJsonSchema;
23938
23999
  var init_report_file = __esm({
23939
- "../../capabilities/objective/src/runner/report-file.ts"() {
24000
+ "../../capabilities/objectives/src/runner/report-file.ts"() {
23940
24001
  "use strict";
23941
24002
  init_primitives();
23942
24003
  init_report2();
@@ -23966,7 +24027,7 @@ var init_report_file = __esm({
23966
24027
  }
23967
24028
  });
23968
24029
 
23969
- // ../../capabilities/objective/src/runner/finish.ts
24030
+ // ../../capabilities/objectives/src/runner/finish.ts
23970
24031
  import { z as z39 } from "zod";
23971
24032
  async function runRunnerFinish(ctx, request) {
23972
24033
  if (request.slug === void 0) {
@@ -24157,7 +24218,7 @@ function emitCheckpointStdout(ctx, result) {
24157
24218
  }
24158
24219
  var runnerFinishRequestSchema, runnerStepFactsSchema, factsInputSchema, runnerFinishStatusSchema, runnerFinishResultSchema;
24159
24220
  var init_finish = __esm({
24160
- async "../../capabilities/objective/src/runner/finish.ts"() {
24221
+ async "../../capabilities/objectives/src/runner/finish.ts"() {
24161
24222
  "use strict";
24162
24223
  init_src();
24163
24224
  init_primitives();
@@ -24211,10 +24272,10 @@ var init_finish = __esm({
24211
24272
  }
24212
24273
  });
24213
24274
 
24214
- // ../../capabilities/objective/src/ns/commands/exec-runner-finish.ts
24275
+ // ../../capabilities/objectives/src/ns/commands/exec-runner-finish.ts
24215
24276
  var RUNNER_FINISH_DESCRIPTION, objectiveExecRunnerFinishNsCommand, exec_runner_finish_default;
24216
24277
  var init_exec_runner_finish = __esm({
24217
- async "../../capabilities/objective/src/ns/commands/exec-runner-finish.ts"() {
24278
+ async "../../capabilities/objectives/src/ns/commands/exec-runner-finish.ts"() {
24218
24279
  "use strict";
24219
24280
  init_ns_command();
24220
24281
  init_sdk();
@@ -24239,10 +24300,10 @@ var init_exec_runner_finish = __esm({
24239
24300
  }
24240
24301
  });
24241
24302
 
24242
- // ../../infra/core/src/terminal/text-tail-buffer.ts
24303
+ // ../../infra/foundation/src/terminal/text-tail-buffer.ts
24243
24304
  var BoundedTextTailBuffer;
24244
24305
  var init_text_tail_buffer = __esm({
24245
- "../../infra/core/src/terminal/text-tail-buffer.ts"() {
24306
+ "../../infra/foundation/src/terminal/text-tail-buffer.ts"() {
24246
24307
  "use strict";
24247
24308
  BoundedTextTailBuffer = class {
24248
24309
  maxBytes;
@@ -24271,7 +24332,7 @@ ${this.value}`;
24271
24332
  }
24272
24333
  });
24273
24334
 
24274
- // ../../capabilities/objective/src/runner/event-channel.ts
24335
+ // ../../capabilities/objectives/src/runner/event-channel.ts
24275
24336
  function createEventChannel() {
24276
24337
  const buffered = [];
24277
24338
  let pendingPull = null;
@@ -24315,12 +24376,12 @@ function createEventChannel() {
24315
24376
  return { push, close, iterable };
24316
24377
  }
24317
24378
  var init_event_channel = __esm({
24318
- "../../capabilities/objective/src/runner/event-channel.ts"() {
24379
+ "../../capabilities/objectives/src/runner/event-channel.ts"() {
24319
24380
  "use strict";
24320
24381
  }
24321
24382
  });
24322
24383
 
24323
- // ../../capabilities/objective/src/pi/child-session/pi-child-session-gateway.ts
24384
+ // ../../capabilities/objectives/src/pi/child-session/pi-child-session-gateway.ts
24324
24385
  import { spawn as spawn2 } from "node:child_process";
24325
24386
  import { mkdtemp } from "node:fs/promises";
24326
24387
  import { tmpdir as tmpdir3 } from "node:os";
@@ -24725,7 +24786,7 @@ function chunkToString(chunk) {
24725
24786
  }
24726
24787
  var NS_RUNNER_PI_BIN_ENV, DEFAULT_STDERR_TAIL_LIMIT_BYTES, DEFAULT_SIGKILL_GRACE_MS, DEFAULT_HEARTBEAT_INTERVAL_MS, ACTIVITY_PREVIEW_CHARS;
24727
24788
  var init_pi_child_session_gateway = __esm({
24728
- "../../capabilities/objective/src/pi/child-session/pi-child-session-gateway.ts"() {
24789
+ "../../capabilities/objectives/src/pi/child-session/pi-child-session-gateway.ts"() {
24729
24790
  "use strict";
24730
24791
  init_primitives();
24731
24792
  init_text_tail_buffer();
@@ -24739,7 +24800,7 @@ var init_pi_child_session_gateway = __esm({
24739
24800
  }
24740
24801
  });
24741
24802
 
24742
- // ../../infra/core/src/terminal/runner-usage.ts
24803
+ // ../../infra/foundation/src/terminal/runner-usage.ts
24743
24804
  function parseRunnerSubagentUsageJsonl(jsonl) {
24744
24805
  const records = [];
24745
24806
  const lines = jsonl.split(/\r?\n/u);
@@ -24857,14 +24918,14 @@ function jsonParseErrorMessage(error2) {
24857
24918
  }
24858
24919
  var TOKEN_FIELDS;
24859
24920
  var init_runner_usage = __esm({
24860
- "../../infra/core/src/terminal/runner-usage.ts"() {
24921
+ "../../infra/foundation/src/terminal/runner-usage.ts"() {
24861
24922
  "use strict";
24862
24923
  init_primitives();
24863
24924
  TOKEN_FIELDS = ["input", "output", "cacheRead", "cacheWrite", "totalTokens"];
24864
24925
  }
24865
24926
  });
24866
24927
 
24867
- // ../../capabilities/objective/src/core/operations/runner-subagent-usage.ts
24928
+ // ../../capabilities/objectives/src/core/operations/runner-subagent-usage.ts
24868
24929
  import { readFile as readFile6, stat as stat4 } from "node:fs/promises";
24869
24930
  import { z as z40 } from "zod";
24870
24931
  async function runRunnerSubagentUsage(_ctx, request) {
@@ -25134,7 +25195,7 @@ function errorMessage2(error2) {
25134
25195
  }
25135
25196
  var runnerSubagentUsageStatusSchema, runnerSubagentCostTotalsSchema, runnerSubagentTokenTotalsSchema, runnerSubagentModelRefSchema, runnerSubagentUsageSummarySchema, runnerSubagentUsageAggregateSchema, runnerSubagentUsageResultSchema, runnerSubagentUsageRequestSchema;
25136
25197
  var init_runner_subagent_usage = __esm({
25137
- "../../capabilities/objective/src/core/operations/runner-subagent-usage.ts"() {
25198
+ "../../capabilities/objectives/src/core/operations/runner-subagent-usage.ts"() {
25138
25199
  "use strict";
25139
25200
  init_src();
25140
25201
  init_runner_usage();
@@ -25198,7 +25259,7 @@ var init_runner_subagent_usage = __esm({
25198
25259
  }
25199
25260
  });
25200
25261
 
25201
- // ../../capabilities/objective/src/runner/step.ts
25262
+ // ../../capabilities/objectives/src/runner/step.ts
25202
25263
  import { z as z41 } from "zod";
25203
25264
  async function runRunnerStep(ctx, request) {
25204
25265
  const identity = resolveRunnerStepIdentity({
@@ -25406,7 +25467,7 @@ ${trimmed}`];
25406
25467
  }
25407
25468
  var runnerStepRequestSchema, runnerStepStatusSchema, runnerStepResultSchema;
25408
25469
  var init_step = __esm({
25409
- async "../../capabilities/objective/src/runner/step.ts"() {
25470
+ async "../../capabilities/objectives/src/runner/step.ts"() {
25410
25471
  "use strict";
25411
25472
  init_src();
25412
25473
  init_primitives();
@@ -25451,7 +25512,7 @@ var init_step = __esm({
25451
25512
  }
25452
25513
  });
25453
25514
 
25454
- // ../../capabilities/objective/src/ns/commands/exec-runner-step.ts
25515
+ // ../../capabilities/objectives/src/ns/commands/exec-runner-step.ts
25455
25516
  function createObjectiveExecRunnerStepNsCommand(composition) {
25456
25517
  return createNsDomainCommand({
25457
25518
  name: "exec-runner-step",
@@ -25480,7 +25541,7 @@ function createObjectiveExecRunnerStepNsCommand(composition) {
25480
25541
  }
25481
25542
  var RUNNER_STEP_DESCRIPTION, objectiveExecRunnerStepNsCommand, exec_runner_step_default;
25482
25543
  var init_exec_runner_step = __esm({
25483
- async "../../capabilities/objective/src/ns/commands/exec-runner-step.ts"() {
25544
+ async "../../capabilities/objectives/src/ns/commands/exec-runner-step.ts"() {
25484
25545
  "use strict";
25485
25546
  init_ns_command();
25486
25547
  init_src();
@@ -25501,10 +25562,10 @@ var init_exec_runner_step = __esm({
25501
25562
  }
25502
25563
  });
25503
25564
 
25504
- // ../../capabilities/objective/src/ns/commands/exec-runner-subagent-usage.ts
25565
+ // ../../capabilities/objectives/src/ns/commands/exec-runner-subagent-usage.ts
25505
25566
  var objectiveExecRunnerSubagentUsageNsCommand, exec_runner_subagent_usage_default;
25506
25567
  var init_exec_runner_subagent_usage = __esm({
25507
- "../../capabilities/objective/src/ns/commands/exec-runner-subagent-usage.ts"() {
25568
+ "../../capabilities/objectives/src/ns/commands/exec-runner-subagent-usage.ts"() {
25508
25569
  "use strict";
25509
25570
  init_sdk();
25510
25571
  init_command3();
@@ -25526,7 +25587,7 @@ var init_exec_runner_subagent_usage = __esm({
25526
25587
  }
25527
25588
  });
25528
25589
 
25529
- // ../../capabilities/objective/src/core/operations/tracking-gate.ts
25590
+ // ../../capabilities/objectives/src/core/operations/tracking-gate.ts
25530
25591
  import { z as z42 } from "zod";
25531
25592
  async function runTrackingGate(ctx, request) {
25532
25593
  if (request.slug === void 0) {
@@ -25698,7 +25759,7 @@ function appendPathList(parts, title, paths) {
25698
25759
  }
25699
25760
  var trackingGateRequestSchema, gitFailureSchema, trackingGateGitProbeSchema, trackingGateResultSchema;
25700
25761
  var init_tracking_gate = __esm({
25701
- "../../capabilities/objective/src/core/operations/tracking-gate.ts"() {
25762
+ "../../capabilities/objectives/src/core/operations/tracking-gate.ts"() {
25702
25763
  "use strict";
25703
25764
  init_src();
25704
25765
  init_storage();
@@ -25756,10 +25817,10 @@ var init_tracking_gate = __esm({
25756
25817
  }
25757
25818
  });
25758
25819
 
25759
- // ../../capabilities/objective/src/ns/commands/exec-tracking-gate.ts
25820
+ // ../../capabilities/objectives/src/ns/commands/exec-tracking-gate.ts
25760
25821
  var objectiveExecTrackingGateNsCommand, exec_tracking_gate_default;
25761
25822
  var init_exec_tracking_gate = __esm({
25762
- "../../capabilities/objective/src/ns/commands/exec-tracking-gate.ts"() {
25823
+ "../../capabilities/objectives/src/ns/commands/exec-tracking-gate.ts"() {
25763
25824
  "use strict";
25764
25825
  init_sdk();
25765
25826
  init_command3();
@@ -25781,7 +25842,7 @@ var init_exec_tracking_gate = __esm({
25781
25842
  }
25782
25843
  });
25783
25844
 
25784
- // ../../capabilities/objective/src/core/operations/list-objectives-pretty.ts
25845
+ // ../../capabilities/objectives/src/core/operations/list-objectives-pretty.ts
25785
25846
  function clip(caps, text, width) {
25786
25847
  return truncatePlain(text, width, ellipsisFor(caps));
25787
25848
  }
@@ -25815,17 +25876,20 @@ function renderObjectiveListPretty(result, caps, nowMs) {
25815
25876
  lines.push("", emptyMessage(result.statusFilter));
25816
25877
  return lines.join("\n");
25817
25878
  }
25818
- const includeBranches = result.updatedBranchesIncluded === true;
25819
25879
  const maxSlug = Math.max(...result.records.map((r) => r.slug.length), "OBJECTIVE".length);
25820
- const statusW = "X closed".length;
25880
+ const statusW = "X blocked".length;
25821
25881
  const flagW = "x".length;
25882
+ const branchesW = "BRANCHES".length;
25822
25883
  const edgesW = "EDGES".length;
25823
- const slugW = Math.max(12, Math.min(maxSlug, caps.columns - statusW - flagW - edgesW - 21));
25884
+ const slugW = Math.max(
25885
+ 12,
25886
+ Math.min(maxSlug, caps.columns - statusW - flagW - branchesW - edgesW - 23)
25887
+ );
25824
25888
  const dateW = "LATEST UPDATE".length;
25825
25889
  lines.push("");
25826
25890
  lines.push(
25827
25891
  dim(
25828
- `${padPlain("OBJECTIVE", slugW)} ${padPlain("STATUS", statusW)} ${" ".repeat(flagW)} ${padPlain("LATEST UPDATE", dateW)} EDGES`
25892
+ `${padPlain("OBJECTIVE", slugW)} ${padPlain("STATUS", statusW)} ${" ".repeat(flagW)} ${padPlain("LATEST UPDATE", dateW)} ${padPlain("BRANCHES", branchesW)} EDGES`
25829
25893
  )
25830
25894
  );
25831
25895
  for (const record of result.records) {
@@ -25833,55 +25897,36 @@ function renderObjectiveListPretty(result, caps, nowMs) {
25833
25897
  const status = objectiveStatusPresentation(record);
25834
25898
  const statusGlyph = glyph(caps, status.glyphName);
25835
25899
  const statusColored = `${paint(caps, status.intent, statusGlyph)} ${status.word}`;
25836
- const statusPlain = `${statusGlyph} ${status.word}`;
25900
+ const statusPlain = formatStatusPlain(caps, status);
25837
25901
  const statusCell = padCell(statusColored, statusPlain, statusW);
25838
25902
  const stamp = record.latestUpdateIso === null ? "\u2014" : relativeTime(record.latestUpdateIso, nowMs);
25839
25903
  const flagCell = record.hasOutstandingChanges ? paint(caps, "warn", "x") : " ".repeat(flagW);
25840
25904
  const dateCell = dim(padPlain(clip(caps, stamp, dateW), dateW));
25905
+ const branchesCell = padPlain(updatedBranchCountCell(record), branchesW);
25841
25906
  const edgesCell = edgeCountCell(record);
25842
- lines.push(`${slugCell} ${statusCell} ${flagCell} ${dateCell} ${edgesCell}`.trimEnd());
25843
- if (includeBranches) {
25844
- const branches = record.updatedBranches ?? [];
25845
- const markers = treeMarkers(caps);
25846
- branches.forEach((branch, index) => {
25847
- const marker = index === branches.length - 1 ? markers.last : markers.tee;
25848
- lines.push(` ${dim(clip(caps, `${marker} ${branch}`, caps.columns - 2))}`);
25849
- });
25850
- }
25907
+ lines.push(
25908
+ `${slugCell} ${statusCell} ${flagCell} ${dateCell} ${branchesCell} ${edgesCell}`.trimEnd()
25909
+ );
25851
25910
  }
25852
25911
  const legends = [];
25853
25912
  if (result.records.some((record) => record.hasOutstandingChanges)) {
25854
25913
  legends.push(dim("x = uncommitted changes not yet recorded in an update"));
25855
25914
  }
25856
- if (result.records.some((record) => record.isBlocked === true)) {
25857
- legends.push(
25858
- dim(`${glyph(caps, "blocked")} = blocked (a sub-state of open; the record says why)`)
25859
- );
25860
- }
25861
25915
  if (legends.length > 0) lines.push("", ...legends);
25862
- if (result.updatedBranchesTruncated === true) {
25863
- lines.push(
25864
- "",
25865
- dim(
25866
- `Updated branch attribution limited to newest ${MAX_UPDATED_BRANCH_ATTRIBUTION_WALKS} changed local branches.`
25867
- )
25868
- );
25869
- }
25870
25916
  return lines.join("\n");
25871
25917
  }
25872
25918
  var init_list_objectives_pretty = __esm({
25873
- "../../capabilities/objective/src/core/operations/list-objectives-pretty.ts"() {
25919
+ "../../capabilities/objectives/src/core/operations/list-objectives-pretty.ts"() {
25874
25920
  "use strict";
25875
25921
  init_cli_theme();
25876
- init_list_branch_attribution();
25877
25922
  init_list_objectives();
25878
25923
  }
25879
25924
  });
25880
25925
 
25881
- // ../../capabilities/objective/src/ns/commands/list.ts
25926
+ // ../../capabilities/objectives/src/ns/commands/list.ts
25882
25927
  var objectiveListNsCommand, list_default;
25883
25928
  var init_list2 = __esm({
25884
- "../../capabilities/objective/src/ns/commands/list.ts"() {
25929
+ "../../capabilities/objectives/src/ns/commands/list.ts"() {
25885
25930
  "use strict";
25886
25931
  init_src();
25887
25932
  init_sdk();
@@ -25893,7 +25938,7 @@ var init_list2 = __esm({
25893
25938
  summary: "List Objective records in the current checkout.",
25894
25939
  description: "List Objective records in the current checkout.",
25895
25940
  schema: listObjectivesRequestSchema,
25896
- options: { names: { short: "-n" }, status: { short: "-s" }, minimal: { short: "-m" } },
25941
+ options: { names: { short: "-n" }, status: { short: "-s" } },
25897
25942
  resultSchema: objectiveListResultSchema,
25898
25943
  handler: runListObjectives,
25899
25944
  renderHuman: (data, caps) => renderObjectiveListPretty(data, resolveRenderCapabilities(caps), Date.now()),
@@ -25905,10 +25950,360 @@ var init_list2 = __esm({
25905
25950
  }
25906
25951
  });
25907
25952
 
25908
- // ../../capabilities/objective/src/ns/repo-local-ns-extension.ts
25953
+ // ../../capabilities/objectives/src/core/operations/show-objective.ts
25954
+ import { z as z43 } from "zod";
25955
+ async function runShowObjective(ctx, request) {
25956
+ const result = await buildShowObjectiveResult(ctx, request.slug);
25957
+ if (result.type === "storage-error") return failure(result.error.code, result.error.message);
25958
+ if (result.type === "git-error") return failure(result.error.code, result.error.message);
25959
+ const value = result.value;
25960
+ const slugValidationError = handleObjectiveSlugValidationErrors(value, request.slug);
25961
+ if (slugValidationError !== null) return slugValidationError;
25962
+ if (value.status === "not-found") {
25963
+ return negative(`No Objective record found for slug ${pythonStringRepr(value.slug ?? "")}.`, {
25964
+ data: value
25965
+ });
25966
+ }
25967
+ return ok(value);
25968
+ }
25969
+ async function buildShowObjectiveResult(ctx, slug) {
25970
+ const targetResult = await resolveObjectiveRecordTarget(ctx.storage, slug);
25971
+ if (targetResult.type === "storage-error") return targetResult;
25972
+ const target = targetResult.value;
25973
+ if (target.status !== "found") {
25974
+ return {
25975
+ type: "ok",
25976
+ value: {
25977
+ status: target.status,
25978
+ ...targetToEmptyResultFields(target)
25979
+ }
25980
+ };
25981
+ }
25982
+ const relativePath = target.path;
25983
+ const files = await ctx.storage.filePresence(relativePath);
25984
+ if (!files.ok) return { type: "storage-error", error: files.error };
25985
+ const updates = await ctx.storage.listUpdateFiles(relativePath);
25986
+ if (!updates.ok) return { type: "storage-error", error: updates.error };
25987
+ const dirty = await ctx.git.hasUncommittedChangesUnder({ cwd: ctx.repoRoot, relativePath });
25988
+ if (!dirty.ok) return { type: "git-error", error: dirty.error };
25989
+ const attribution = await buildObjectiveBranchAttributionForContext(ctx, /* @__PURE__ */ new Set([target.slug]));
25990
+ if (attribution.type === "git-error") return attribution;
25991
+ const document = await ctx.storage.readObjectiveRecordDocument(relativePath);
25992
+ const facts = frontmatterFacts(document);
25993
+ const edges = [];
25994
+ for (const edge of facts.edges) {
25995
+ const counterpart = await resolveEdgeCounterpart(ctx.storage, target.slug, edge.objective);
25996
+ if (counterpart.type === "storage-error") return counterpart;
25997
+ edges.push({
25998
+ objective: edge.objective,
25999
+ annotation: edge.annotation,
26000
+ counterpart: counterpart.value
26001
+ });
26002
+ }
26003
+ return {
26004
+ type: "ok",
26005
+ value: {
26006
+ status: "ok",
26007
+ slug: target.slug,
26008
+ path: relativePath,
26009
+ rootPath: target.rootPath,
26010
+ isClosed: files.value.closedMd,
26011
+ blockedSentence: facts.blockedSentence,
26012
+ ...facts.malformed === void 0 ? {} : { frontmatterMalformed: facts.malformed },
26013
+ latestUpdateIso: latestUpdateIsoFromUpdateNames(updates.value.map((update) => update.name)),
26014
+ updateCount: updates.value.length,
26015
+ hasOutstandingChanges: dirty.value,
26016
+ updatedBranches: [...attribution.value.updatedBranchesBySlug.get(target.slug) ?? []],
26017
+ isUpdatedBranchesTruncated: attribution.value.isTruncated,
26018
+ edges
26019
+ }
26020
+ };
26021
+ }
26022
+ function frontmatterFacts(read) {
26023
+ const parsed = readParsedObjectiveFrontmatter(read);
26024
+ if (parsed.frontmatter === null) {
26025
+ return {
26026
+ blockedSentence: null,
26027
+ edges: [],
26028
+ ...parsed.malformed === void 0 ? {} : { malformed: parsed.malformed }
26029
+ };
26030
+ }
26031
+ return { blockedSentence: parsed.frontmatter.blocked, edges: parsed.frontmatter.edges };
26032
+ }
26033
+ async function resolveEdgeCounterpart(storage, ownSlug, endpoint) {
26034
+ const resolved = await storage.resolveRecordRelativePath(endpoint);
26035
+ if (!resolved.ok) return { type: "storage-error", error: resolved.error };
26036
+ if (resolved.value === null) {
26037
+ return { type: "ok", value: { state: "missing", annotation: null } };
26038
+ }
26039
+ const state = resolved.value === activeRecordRelativePath(endpoint) ? "active" : "archived";
26040
+ const read = await storage.readObjectiveRecordDocument(resolved.value);
26041
+ return { type: "ok", value: { state, annotation: backEdgeAnnotation(read, ownSlug) } };
26042
+ }
26043
+ function backEdgeAnnotation(read, ownSlug) {
26044
+ const parsed = readParsedObjectiveFrontmatter(read);
26045
+ if (parsed.frontmatter === null) return null;
26046
+ return findObjectiveEdgeAnnotation(parsed.frontmatter, ownSlug);
26047
+ }
26048
+ function renderShowObjectiveHuman(result, caps, nowMs) {
26049
+ if (result.status !== "ok") return "No Objective record selected.";
26050
+ const presentation = objectiveStatusPresentation(statusPresentationInput(result));
26051
+ const statusStyled = `${paint(caps, presentation.intent, glyph(caps, presentation.glyphName))} ${paint(
26052
+ caps,
26053
+ presentation.intent,
26054
+ presentation.word
26055
+ )}`;
26056
+ return renderBufferedReport({
26057
+ caps: { canEmitAnsi: caps.colorDepth !== "none", caps },
26058
+ title: `${bold("Objective")} ${bold(paint(caps, "accent", result.slug))} ${statusStyled}`,
26059
+ titleStyle: "plain",
26060
+ sections: [
26061
+ { title: "", lines: summaryLines(result, caps, nowMs) },
26062
+ { title: bold("Branches"), lines: renderBranchLines(result, caps) },
26063
+ { title: bold("Edges"), lines: renderHumanEdgeSections(result.edges, caps) }
26064
+ ]
26065
+ });
26066
+ }
26067
+ function summaryLines(result, caps, nowMs) {
26068
+ const lines = [dim(subtitleLine(result, caps, nowMs))];
26069
+ if (result.hasOutstandingChanges) {
26070
+ lines.push(paint(caps, "warn", "Uncommitted changes not yet recorded in an update."));
26071
+ }
26072
+ if (result.blockedSentence !== null) {
26073
+ lines.push(
26074
+ ...labeledWrappedBlock({
26075
+ caps,
26076
+ label: "Blocked",
26077
+ labelStyled: paint(caps, "warn", bold("Blocked")),
26078
+ text: result.blockedSentence
26079
+ })
26080
+ );
26081
+ }
26082
+ if (result.frontmatterMalformed !== void 0) {
26083
+ lines.push(...dimWrappedLines(caps, `Frontmatter malformed: ${result.frontmatterMalformed}`));
26084
+ }
26085
+ return lines;
26086
+ }
26087
+ function renderBranchLines(result, caps) {
26088
+ const lines = [];
26089
+ if (result.updatedBranches.length === 0) {
26090
+ lines.push(dim("No local branches touch this record."));
26091
+ } else {
26092
+ const markers = treeMarkers(caps);
26093
+ result.updatedBranches.forEach((branch, index) => {
26094
+ const marker = index === result.updatedBranches.length - 1 ? markers.last : markers.tee;
26095
+ lines.push(`${dim(marker)} ${branch}`);
26096
+ });
26097
+ }
26098
+ if (result.isUpdatedBranchesTruncated) {
26099
+ lines.push(
26100
+ ...dimWrappedLines(
26101
+ caps,
26102
+ "Branch attribution truncated; older updated branches may be omitted."
26103
+ )
26104
+ );
26105
+ }
26106
+ return lines;
26107
+ }
26108
+ function renderHumanEdgeSections(edges, caps) {
26109
+ if (edges.length === 0) return [dim("No Objective Edges declared.")];
26110
+ return edges.flatMap((edge) => renderEdgeLines(edge, caps));
26111
+ }
26112
+ function contentWidth2(caps, reserved = 0) {
26113
+ return Math.max(20, caps.columns) - reserved;
26114
+ }
26115
+ function dimWrappedLines(caps, text) {
26116
+ return wrapPlain(text, contentWidth2(caps)).map((line) => dim(line));
26117
+ }
26118
+ function subtitleLine(result, caps, nowMs) {
26119
+ const separator = caps.canRenderUnicode ? " \xB7 " : " - ";
26120
+ const updatesFact = result.updateCount === 0 ? "no updates" : `${result.updateCount} update${result.updateCount === 1 ? "" : "s"}`;
26121
+ const parts = [result.path, updatesFact];
26122
+ if (result.latestUpdateIso !== null) {
26123
+ parts.push(`latest ${relativeTime(result.latestUpdateIso, nowMs)}`);
26124
+ }
26125
+ return parts.join(separator);
26126
+ }
26127
+ function labeledWrappedBlock(options) {
26128
+ const indent = options.label.length + 2;
26129
+ const width = contentWidth2(options.caps, indent);
26130
+ return wrapPlain(options.text, width).map(
26131
+ (line, index) => index === 0 ? `${options.labelStyled} ${line}` : `${" ".repeat(indent)}${line}`
26132
+ );
26133
+ }
26134
+ function edgeStateIntent(state) {
26135
+ if (state === "active") return "muted";
26136
+ if (state === "archived") return "warn";
26137
+ return "error";
26138
+ }
26139
+ function renderEdgeLines(edge, caps) {
26140
+ const intent = edgeStateIntent(edge.counterpart.state);
26141
+ const lines = [
26142
+ `${paint(caps, intent, glyph(caps, "open"))} ${bold(paint(caps, "accent", edge.objective))} ${paint(
26143
+ caps,
26144
+ intent,
26145
+ edge.counterpart.state
26146
+ )}`
26147
+ ];
26148
+ const width = contentWidth2(caps, 4);
26149
+ for (const line of wrapPlain(edge.annotation, width)) lines.push(` ${dim(line)}`);
26150
+ return lines;
26151
+ }
26152
+ function renderShowObjectiveMarkdown(result) {
26153
+ if (result.status !== "ok") return "_No Objective record selected._";
26154
+ const presentation = objectiveStatusPresentation(statusPresentationInput(result));
26155
+ const stamp = result.latestUpdateIso ?? "\u2014";
26156
+ const parts = [`# Objective \`${result.slug}\`
26157
+
26158
+ `, `Status: ${presentation.word}
26159
+ `];
26160
+ if (result.blockedSentence !== null) parts.push(`Blocked: ${result.blockedSentence}
26161
+ `);
26162
+ if (result.frontmatterMalformed !== void 0) {
26163
+ parts.push(`Frontmatter malformed: ${result.frontmatterMalformed}
26164
+ `);
26165
+ }
26166
+ parts.push(
26167
+ `Root: \`${result.rootPath}\`
26168
+ `,
26169
+ `Path: \`${result.path}\`
26170
+ `,
26171
+ `Latest update: ${stamp} (updates: ${result.updateCount})
26172
+ `,
26173
+ `Outstanding changes: ${result.hasOutstandingChanges ? "yes" : "no"}
26174
+
26175
+ `
26176
+ );
26177
+ parts.push("## Branches\n\n");
26178
+ if (result.updatedBranches.length === 0) {
26179
+ parts.push("_No local branches touch this record._\n\n");
26180
+ } else {
26181
+ for (const branch of result.updatedBranches) parts.push(`- \`${branch}\`
26182
+ `);
26183
+ parts.push("\n");
26184
+ }
26185
+ if (result.isUpdatedBranchesTruncated) {
26186
+ parts.push("_Branch attribution truncated; older updated branches may be omitted._\n\n");
26187
+ }
26188
+ parts.push("## Edges\n\n");
26189
+ if (result.edges.length === 0) {
26190
+ parts.push("_No Objective Edges declared._\n");
26191
+ } else {
26192
+ for (const edge of result.edges) {
26193
+ parts.push(`### \`${edge.objective}\` (${edge.counterpart.state})
26194
+
26195
+ `);
26196
+ parts.push(`- this record: ${edge.annotation}
26197
+ `);
26198
+ parts.push(`- \`${edge.objective}\`: ${counterpartAnnotationText(edge.counterpart)}
26199
+
26200
+ `);
26201
+ }
26202
+ }
26203
+ return removeOneTrailingNewline(parts.join(""));
26204
+ }
26205
+ function counterpartAnnotationText(counterpart) {
26206
+ return counterpart.annotation ?? "(no recorded back-edge annotation)";
26207
+ }
26208
+ function statusPresentationInput(result) {
26209
+ return {
26210
+ status: result.isClosed ? "closed" : "open",
26211
+ ...result.blockedSentence === null ? {} : { isBlocked: true }
26212
+ };
26213
+ }
26214
+ var showObjectiveRequestSchema, showObjectiveEdgeCounterpartSchema, showObjectiveEdgeSchema, showObjectiveOkResultSchema, showObjectiveNonOkBaseSchema, showObjectiveResultSchema;
26215
+ var init_show_objective = __esm({
26216
+ "../../capabilities/objectives/src/core/operations/show-objective.ts"() {
26217
+ "use strict";
26218
+ init_src();
26219
+ init_cli_theme();
26220
+ init_storage();
26221
+ init_format2();
26222
+ init_slug_validation_errors();
26223
+ init_edge_lint();
26224
+ init_list_branch_attribution();
26225
+ init_list_objectives();
26226
+ init_list_objectives_pretty();
26227
+ init_objective_target();
26228
+ init_record_frontmatter_read();
26229
+ showObjectiveRequestSchema = z43.object({
26230
+ slug: z43.string().optional().describe("Objective slug to show.")
26231
+ });
26232
+ showObjectiveEdgeCounterpartSchema = z43.object({
26233
+ // active/archived/missing follows the same active-then-archive record resolution the edge linter uses.
26234
+ state: z43.enum(["active", "archived", "missing"]),
26235
+ // Back-edge annotation naming this record in the counterpart's frontmatter; null when the
26236
+ // counterpart record or its back-edge is missing, unreadable, or malformed.
26237
+ annotation: z43.string().nullable()
26238
+ });
26239
+ showObjectiveEdgeSchema = z43.object({
26240
+ objective: z43.string(),
26241
+ annotation: z43.string(),
26242
+ counterpart: showObjectiveEdgeCounterpartSchema
26243
+ });
26244
+ showObjectiveOkResultSchema = z43.object({
26245
+ status: z43.literal("ok"),
26246
+ slug: z43.string(),
26247
+ path: z43.string(),
26248
+ rootPath: z43.string(),
26249
+ isClosed: z43.boolean(),
26250
+ // Blocked Sentence from this record's own frontmatter parse; null when unblocked or without frontmatter.
26251
+ blockedSentence: z43.string().nullable(),
26252
+ // Present only when this record's frontmatter is malformed; edge/blocked facts then read as empty,
26253
+ // exactly like a record with no frontmatter (reporting it is `ns objective check`'s job).
26254
+ frontmatterMalformed: z43.string().optional(),
26255
+ latestUpdateIso: z43.string().nullable(),
26256
+ updateCount: z43.number().int(),
26257
+ hasOutstandingChanges: z43.boolean(),
26258
+ updatedBranches: z43.array(z43.string()),
26259
+ isUpdatedBranchesTruncated: z43.boolean(),
26260
+ edges: z43.array(showObjectiveEdgeSchema)
26261
+ });
26262
+ showObjectiveNonOkBaseSchema = z43.object({
26263
+ rootPath: z43.string(),
26264
+ hasRoot: z43.boolean(),
26265
+ slug: z43.string().nullable(),
26266
+ path: z43.string().nullable()
26267
+ });
26268
+ showObjectiveResultSchema = z43.discriminatedUnion("status", [
26269
+ showObjectiveOkResultSchema,
26270
+ showObjectiveNonOkBaseSchema.extend({ status: z43.literal("missing-slug") }),
26271
+ showObjectiveNonOkBaseSchema.extend({ status: z43.literal("invalid-slug") }),
26272
+ showObjectiveNonOkBaseSchema.extend({ status: z43.literal("not-found") })
26273
+ ]);
26274
+ }
26275
+ });
26276
+
26277
+ // ../../capabilities/objectives/src/ns/commands/show.ts
26278
+ var objectiveShowNsCommand, show_default;
26279
+ var init_show = __esm({
26280
+ "../../capabilities/objectives/src/ns/commands/show.ts"() {
26281
+ "use strict";
26282
+ init_src();
26283
+ init_sdk();
26284
+ init_command3();
26285
+ init_show_objective();
26286
+ objectiveShowNsCommand = objectiveNsCommand({
26287
+ name: "show",
26288
+ summary: "Show one Objective record with branches and edge annotations.",
26289
+ description: "Show one Objective record with branches and edge annotations.",
26290
+ schema: showObjectiveRequestSchema,
26291
+ resultSchema: showObjectiveResultSchema,
26292
+ positionals: { slug: { position: 0 } },
26293
+ handler: runShowObjective,
26294
+ renderHuman: (data, caps) => renderShowObjectiveHuman(data, resolveRenderCapabilities(caps), Date.now()),
26295
+ renderMarkdown: renderShowObjectiveMarkdown
26296
+ });
26297
+ show_default = defineExtension({
26298
+ commands: [objectiveShowNsCommand]
26299
+ });
26300
+ }
26301
+ });
26302
+
26303
+ // ../../capabilities/objectives/src/ns/repo-local-ns-extension.ts
25909
26304
  var objectiveRepoLocalNsExtension;
25910
26305
  var init_repo_local_ns_extension2 = __esm({
25911
- async "../../capabilities/objective/src/ns/repo-local-ns-extension.ts"() {
26306
+ async "../../capabilities/objectives/src/ns/repo-local-ns-extension.ts"() {
25912
26307
  "use strict";
25913
26308
  init_sdk();
25914
26309
  init_archive();
@@ -25922,11 +26317,13 @@ var init_repo_local_ns_extension2 = __esm({
25922
26317
  init_exec_runner_subagent_usage();
25923
26318
  init_exec_tracking_gate();
25924
26319
  init_list2();
26320
+ init_show();
25925
26321
  objectiveRepoLocalNsExtension = defineRepoLocalNsExtensionDescriptor({
25926
26322
  group: "objective",
25927
26323
  description: "Inspect and maintain ns Objective records.",
25928
26324
  commands: [
25929
26325
  objectiveListNsCommand,
26326
+ objectiveShowNsCommand,
25930
26327
  objectiveCheckNsCommand,
25931
26328
  objectiveArchiveNsCommand,
25932
26329
  objectiveExecListCandidatesNsCommand,
@@ -25941,20 +26338,20 @@ var init_repo_local_ns_extension2 = __esm({
25941
26338
  ].map(
25942
26339
  (command) => repoLocalNsCommandDescriptor({
25943
26340
  command,
25944
- packageExportPrefix: "@nseng-ai/objective/ns/commands"
26341
+ packageExportPrefix: "@nseng-ai/objectives/ns/commands"
25945
26342
  })
25946
26343
  )
25947
26344
  });
25948
26345
  }
25949
26346
  });
25950
26347
 
25951
- // ../../capabilities/objective/src/ns/preinstalled-catalog.ts
26348
+ // ../../capabilities/objectives/src/ns/preinstalled-catalog.ts
25952
26349
  function listObjectivePreinstalledNsCommandCatalogEntries() {
25953
26350
  return objectivePreinstalledNsCommandCatalog;
25954
26351
  }
25955
26352
  var objectivePreinstalledNsCommandCatalog;
25956
26353
  var init_preinstalled_catalog = __esm({
25957
- async "../../capabilities/objective/src/ns/preinstalled-catalog.ts"() {
26354
+ async "../../capabilities/objectives/src/ns/preinstalled-catalog.ts"() {
25958
26355
  "use strict";
25959
26356
  init_primitives();
25960
26357
  init_sdk();