@unbrained/pm-cli 2026.5.2 → 2026.5.3-6

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.
Files changed (115) hide show
  1. package/AGENTS.md +8 -1
  2. package/CHANGELOG.md +58 -0
  3. package/README.md +9 -1
  4. package/dist/cli/bootstrap-args.d.ts +18 -0
  5. package/dist/cli/bootstrap-args.js +242 -0
  6. package/dist/cli/bootstrap-args.js.map +1 -0
  7. package/dist/cli/commander-usage.d.ts +17 -0
  8. package/dist/cli/commander-usage.js +178 -0
  9. package/dist/cli/commander-usage.js.map +1 -0
  10. package/dist/cli/commands/activity.js +1 -9
  11. package/dist/cli/commands/activity.js.map +1 -1
  12. package/dist/cli/commands/calendar.js +3 -29
  13. package/dist/cli/commands/calendar.js.map +1 -1
  14. package/dist/cli/commands/comments.js +1 -9
  15. package/dist/cli/commands/comments.js.map +1 -1
  16. package/dist/cli/commands/config.d.ts +21 -3
  17. package/dist/cli/commands/config.js +118 -2
  18. package/dist/cli/commands/config.js.map +1 -1
  19. package/dist/cli/commands/context.d.ts +90 -1
  20. package/dist/cli/commands/context.js +485 -23
  21. package/dist/cli/commands/context.js.map +1 -1
  22. package/dist/cli/commands/dedupe-audit.js +2 -11
  23. package/dist/cli/commands/dedupe-audit.js.map +1 -1
  24. package/dist/cli/commands/history.js +1 -9
  25. package/dist/cli/commands/history.js.map +1 -1
  26. package/dist/cli/commands/learnings.js +1 -9
  27. package/dist/cli/commands/learnings.js.map +1 -1
  28. package/dist/cli/commands/list.js +3 -29
  29. package/dist/cli/commands/list.js.map +1 -1
  30. package/dist/cli/commands/normalize.js +9 -6
  31. package/dist/cli/commands/normalize.js.map +1 -1
  32. package/dist/cli/commands/notes.js +1 -9
  33. package/dist/cli/commands/notes.js.map +1 -1
  34. package/dist/cli/commands/reindex.js +2 -7
  35. package/dist/cli/commands/reindex.js.map +1 -1
  36. package/dist/cli/commands/search.js +4 -35
  37. package/dist/cli/commands/search.js.map +1 -1
  38. package/dist/cli/commands/test-runs.js +1 -11
  39. package/dist/cli/commands/test-runs.js.map +1 -1
  40. package/dist/cli/error-guidance.d.ts +13 -0
  41. package/dist/cli/error-guidance.js +43 -4
  42. package/dist/cli/error-guidance.js.map +1 -1
  43. package/dist/cli/extension-command-help.d.ts +48 -0
  44. package/dist/cli/extension-command-help.js +389 -0
  45. package/dist/cli/extension-command-help.js.map +1 -0
  46. package/dist/cli/help-content.js +9 -3
  47. package/dist/cli/help-content.js.map +1 -1
  48. package/dist/cli/help-json-payload.d.ts +25 -0
  49. package/dist/cli/help-json-payload.js +265 -0
  50. package/dist/cli/help-json-payload.js.map +1 -0
  51. package/dist/cli/main.js +996 -4468
  52. package/dist/cli/main.js.map +1 -1
  53. package/dist/cli/migration-gates.d.ts +22 -0
  54. package/dist/cli/migration-gates.js +146 -0
  55. package/dist/cli/migration-gates.js.map +1 -0
  56. package/dist/cli/register-list-query.d.ts +2 -0
  57. package/dist/cli/register-list-query.js +317 -0
  58. package/dist/cli/register-list-query.js.map +1 -0
  59. package/dist/cli/register-mutation.d.ts +2 -0
  60. package/dist/cli/register-mutation.js +795 -0
  61. package/dist/cli/register-mutation.js.map +1 -0
  62. package/dist/cli/register-operations.d.ts +2 -0
  63. package/dist/cli/register-operations.js +610 -0
  64. package/dist/cli/register-operations.js.map +1 -0
  65. package/dist/cli/register-setup.d.ts +2 -0
  66. package/dist/cli/register-setup.js +334 -0
  67. package/dist/cli/register-setup.js.map +1 -0
  68. package/dist/cli/registration-helpers.d.ts +53 -0
  69. package/dist/cli/registration-helpers.js +669 -0
  70. package/dist/cli/registration-helpers.js.map +1 -0
  71. package/dist/cli/shared-parsers.d.ts +6 -0
  72. package/dist/cli/shared-parsers.js +40 -0
  73. package/dist/cli/shared-parsers.js.map +1 -0
  74. package/dist/core/search/http-client.d.ts +29 -0
  75. package/dist/core/search/http-client.js +64 -0
  76. package/dist/core/search/http-client.js.map +1 -0
  77. package/dist/core/search/providers.d.ts +3 -13
  78. package/dist/core/search/providers.js +19 -69
  79. package/dist/core/search/providers.js.map +1 -1
  80. package/dist/core/search/semantic-defaults.js +2 -7
  81. package/dist/core/search/semantic-defaults.js.map +1 -1
  82. package/dist/core/search/vector-stores.d.ts +3 -13
  83. package/dist/core/search/vector-stores.js +17 -66
  84. package/dist/core/search/vector-stores.js.map +1 -1
  85. package/dist/core/sentry/helpers.d.ts +23 -2
  86. package/dist/core/sentry/helpers.js +101 -3
  87. package/dist/core/sentry/helpers.js.map +1 -1
  88. package/dist/core/sentry/instrument.d.ts +21 -0
  89. package/dist/core/sentry/instrument.js +34 -3
  90. package/dist/core/sentry/instrument.js.map +1 -1
  91. package/dist/core/shared/constants.d.ts +3 -0
  92. package/dist/core/shared/constants.js +58 -1
  93. package/dist/core/shared/constants.js.map +1 -1
  94. package/dist/core/store/front-matter-cache.d.ts +6 -0
  95. package/dist/core/store/front-matter-cache.js +150 -0
  96. package/dist/core/store/front-matter-cache.js.map +1 -0
  97. package/dist/core/store/item-store.js +2 -1
  98. package/dist/core/store/item-store.js.map +1 -1
  99. package/dist/core/store/settings.js +36 -0
  100. package/dist/core/store/settings.js.map +1 -1
  101. package/dist/core/telemetry/observability.d.ts +24 -0
  102. package/dist/core/telemetry/observability.js +185 -0
  103. package/dist/core/telemetry/observability.js.map +1 -0
  104. package/dist/core/telemetry/runtime.d.ts +27 -3
  105. package/dist/core/telemetry/runtime.js +298 -13
  106. package/dist/core/telemetry/runtime.js.map +1 -1
  107. package/dist/sdk/cli-contracts.js +28 -0
  108. package/dist/sdk/cli-contracts.js.map +1 -1
  109. package/dist/types.d.ts +21 -0
  110. package/dist/types.js +11 -0
  111. package/dist/types.js.map +1 -1
  112. package/docs/ARCHITECTURE.md +7 -1
  113. package/docs/COMMANDS.md +11 -1
  114. package/docs/RELEASING.md +56 -29
  115. package/package.json +8 -3
@@ -8,6 +8,7 @@ import { PmCliError } from "../../core/shared/errors.js";
8
8
  import { migrateItemFilesToFormat } from "../../core/store/item-format-migration.js";
9
9
  import { getSettingsPath, resolveGlobalPmRoot, resolvePmRoot, } from "../../core/store/paths.js";
10
10
  import { readSettingsWithMetadata, writeSettings } from "../../core/store/settings.js";
11
+ import { CONTEXT_DEPTH_VALUES } from "../../types/index.js";
11
12
  const CONFIG_SCOPE_VALUES = ["project", "global"];
12
13
  const CONFIG_KEY_VALUES = [
13
14
  "definition-of-done",
@@ -50,6 +51,7 @@ const CONFIG_KEY_VALUES = [
50
51
  "test_result_tracking",
51
52
  "telemetry-tracking",
52
53
  "telemetry_tracking",
54
+ "context",
53
55
  ];
54
56
  const CONFIG_KEY_ALIASES = {
55
57
  definition_of_done: ["definition-of-done", "definition_of_done"],
@@ -93,6 +95,7 @@ const CONFIG_KEY_ALIASES = {
93
95
  ],
94
96
  test_result_tracking: ["test-result-tracking", "test_result_tracking"],
95
97
  telemetry_tracking: ["telemetry-tracking", "telemetry_tracking"],
98
+ context: ["context"],
96
99
  };
97
100
  const CONFIG_KEY_SUMMARIES = {
98
101
  definition_of_done: "Definition of Done criteria list.",
@@ -115,6 +118,7 @@ const CONFIG_KEY_SUMMARIES = {
115
118
  governance_force_required_for_stale_lock: "Governance stale-lock force policy (enabled|disabled).",
116
119
  test_result_tracking: "Item-level linked test result persistence policy.",
117
120
  telemetry_tracking: "Telemetry usage reporting policy.",
121
+ context: "Context command settings (depth, section toggles, limits).",
118
122
  };
119
123
  const LIFECYCLE_PATTERN_CONFIG_KEYS = [
120
124
  "lifecycle_stale_blocker_reason_patterns",
@@ -202,6 +206,9 @@ function normalizeKey(value) {
202
206
  if (value === "telemetry-tracking" || value === "telemetry_tracking") {
203
207
  return "telemetry_tracking";
204
208
  }
209
+ if (value === "context") {
210
+ return "context";
211
+ }
205
212
  return "definition_of_done";
206
213
  }
207
214
  throw new PmCliError(`Invalid config key "${value}". Supported: ${CONFIG_KEY_VALUES.join(", ")}`, EXIT_CODE.USAGE);
@@ -423,6 +430,14 @@ function readConfigValue(settings, key) {
423
430
  if (key === "telemetry_tracking") {
424
431
  return settings.telemetry.enabled ? "enabled" : "disabled";
425
432
  }
433
+ if (key === "context") {
434
+ return {
435
+ default_depth: settings.context.default_depth,
436
+ activity_limit: settings.context.activity_limit,
437
+ stale_threshold_days: settings.context.stale_threshold_days,
438
+ sections: { ...settings.context.sections },
439
+ };
440
+ }
426
441
  return [...settings.workflow.definition_of_done];
427
442
  }
428
443
  function withWarnings(result, warnings) {
@@ -443,6 +458,85 @@ async function resolveSettingsTarget(scope, global) {
443
458
  }
444
459
  return { pmRoot, settingsPath };
445
460
  }
461
+ function parseSectionToggle(raw) {
462
+ if (raw === undefined)
463
+ return undefined;
464
+ const normalized = raw.trim().toLowerCase();
465
+ if (normalized === "true" || normalized === "enabled" || normalized === "on" || normalized === "1")
466
+ return true;
467
+ if (normalized === "false" || normalized === "disabled" || normalized === "off" || normalized === "0")
468
+ return false;
469
+ throw new PmCliError(`Context section toggle must be true|false|enabled|disabled, got "${raw}"`, EXIT_CODE.USAGE);
470
+ }
471
+ async function applyContextConfig(settings, options, target, scope, warnings) {
472
+ let changed = false;
473
+ const ctx = settings.context;
474
+ if (options.defaultDepth !== undefined) {
475
+ const normalized = options.defaultDepth.trim().toLowerCase();
476
+ if (!CONTEXT_DEPTH_VALUES.includes(normalized)) {
477
+ throw new PmCliError(`Context --default-depth must be one of ${CONTEXT_DEPTH_VALUES.join("|")}`, EXIT_CODE.USAGE);
478
+ }
479
+ if (ctx.default_depth !== normalized) {
480
+ ctx.default_depth = normalized;
481
+ changed = true;
482
+ }
483
+ }
484
+ if (options.activityLimit !== undefined) {
485
+ const parsed = parseInt(options.activityLimit.trim(), 10);
486
+ if (isNaN(parsed) || parsed <= 0) {
487
+ throw new PmCliError("Context --activity-limit must be a positive integer", EXIT_CODE.USAGE);
488
+ }
489
+ if (ctx.activity_limit !== parsed) {
490
+ ctx.activity_limit = parsed;
491
+ changed = true;
492
+ }
493
+ }
494
+ if (options.staleThresholdDays !== undefined) {
495
+ const parsed = parseInt(options.staleThresholdDays.trim(), 10);
496
+ if (isNaN(parsed) || parsed <= 0) {
497
+ throw new PmCliError("Context --stale-threshold-days must be a positive integer", EXIT_CODE.USAGE);
498
+ }
499
+ if (ctx.stale_threshold_days !== parsed) {
500
+ ctx.stale_threshold_days = parsed;
501
+ changed = true;
502
+ }
503
+ }
504
+ const sectionToggles = [
505
+ ["hierarchy", options.sectionHierarchy],
506
+ ["activity", options.sectionActivity],
507
+ ["progress", options.sectionProgress],
508
+ ["blockers", options.sectionBlockers],
509
+ ["files", options.sectionFiles],
510
+ ["workload", options.sectionWorkload],
511
+ ["staleness", options.sectionStaleness],
512
+ ["tests", options.sectionTests],
513
+ ];
514
+ for (const [sectionName, rawValue] of sectionToggles) {
515
+ const toggle = parseSectionToggle(rawValue);
516
+ if (toggle !== undefined) {
517
+ const key = sectionName;
518
+ if (ctx.sections[key] !== toggle) {
519
+ ctx.sections[key] = toggle;
520
+ changed = true;
521
+ }
522
+ }
523
+ }
524
+ if (changed) {
525
+ await writeSettings(target.pmRoot, settings, "config:set:context");
526
+ }
527
+ return withWarnings({
528
+ scope,
529
+ key: "context",
530
+ context_settings: {
531
+ default_depth: ctx.default_depth,
532
+ activity_limit: ctx.activity_limit,
533
+ stale_threshold_days: ctx.stale_threshold_days,
534
+ sections: { ...ctx.sections },
535
+ },
536
+ settings_path: target.settingsPath,
537
+ changed,
538
+ }, warnings);
539
+ }
446
540
  export async function runConfig(scopeValue, actionValue, keyValue, options, global) {
447
541
  const scope = normalizeScope(scopeValue);
448
542
  const action = normalizeAction(actionValue);
@@ -454,8 +548,12 @@ export async function runConfig(scopeValue, actionValue, keyValue, options, glob
454
548
  const keys = Object.keys(CONFIG_KEY_ALIASES).map((candidate) => ({
455
549
  key: candidate,
456
550
  aliases: CONFIG_KEY_ALIASES[candidate],
457
- value_kind: isCriteriaConfigKey(candidate) ? "string_array" : "enum",
458
- set_flags: isCriteriaConfigKey(candidate) ? ["--criterion", "--clear-criteria"] : candidate === "item_format" ? ["--format"] : ["--policy"],
551
+ value_kind: candidate === "context"
552
+ ? "object"
553
+ : isCriteriaConfigKey(candidate) ? "string_array" : "enum",
554
+ set_flags: candidate === "context"
555
+ ? ["--default-depth", "--activity-limit", "--stale-threshold-days", "--section-<name>"]
556
+ : isCriteriaConfigKey(candidate) ? ["--criterion", "--clear-criteria"] : candidate === "item_format" ? ["--format"] : ["--policy"],
459
557
  summary: CONFIG_KEY_SUMMARIES[candidate],
460
558
  value: readConfigValue(settings, candidate),
461
559
  }));
@@ -489,6 +587,7 @@ export async function runConfig(scopeValue, actionValue, keyValue, options, glob
489
587
  governance_force_required_for_stale_lock: readConfigValue(settings, "governance_force_required_for_stale_lock"),
490
588
  test_result_tracking: readConfigValue(settings, "test_result_tracking"),
491
589
  telemetry_tracking: readConfigValue(settings, "telemetry_tracking"),
590
+ context: readConfigValue(settings, "context"),
492
591
  };
493
592
  return withWarnings({
494
593
  scope,
@@ -673,6 +772,20 @@ export async function runConfig(scopeValue, actionValue, keyValue, options, glob
673
772
  changed: false,
674
773
  }, warnings);
675
774
  }
775
+ if (key === "context") {
776
+ return withWarnings({
777
+ scope,
778
+ key,
779
+ context_settings: {
780
+ default_depth: settings.context.default_depth,
781
+ activity_limit: settings.context.activity_limit,
782
+ stale_threshold_days: settings.context.stale_threshold_days,
783
+ sections: { ...settings.context.sections },
784
+ },
785
+ settings_path: target.settingsPath,
786
+ changed: false,
787
+ }, warnings);
788
+ }
676
789
  return withWarnings({
677
790
  scope,
678
791
  key,
@@ -1009,6 +1122,9 @@ export async function runConfig(scopeValue, actionValue, keyValue, options, glob
1009
1122
  changed,
1010
1123
  }, warnings);
1011
1124
  }
1125
+ if (key === "context") {
1126
+ return applyContextConfig(settings, options, target, scope, warnings);
1127
+ }
1012
1128
  const nextCriteria = normalizeCriteria(options.criterion, options.clearCriteria);
1013
1129
  const changed = nextCriteria.length !== settings.workflow.definition_of_done.length ||
1014
1130
  nextCriteria.some((value, index) => value !== settings.workflow.definition_of_done[index]);