get-tbd 0.1.27 → 0.1.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { S as IssueTitle, b as IssueSchema, g as ISSUE_TITLE_MAX_LENGTH, n as AtticEntrySchema, t as ATTIC_ENTRY_FIELD_ORDER, x as IssueStatus, y as IssueKind } from "./schemas-C8mOQykE.mjs";
2
- import { a as insertAfterFrontmatter, c as noopLogger, i as serializeIssue, n as parseIssue, o as parseMarkdown, r as parseMarkdownWithFrontmatter, s as stripFrontmatter, t as VERSION$1 } from "./src-BIE27KDA.mjs";
2
+ import { a as insertAfterFrontmatter, c as noopLogger, i as serializeIssue, n as parseIssue, o as parseMarkdown, r as parseMarkdownWithFrontmatter, s as stripFrontmatter, t as VERSION$1 } from "./src-D2xEmH4L.mjs";
3
3
  import { a as parseYamlWithConflictDetection, d as PAGINATION_LINE_THRESHOLD, f as PARENT_CONTEXT_MAX_LINES, l as comparisonChain, n as detectDuplicateYamlKeys, o as sortKeys, s as stringifyYaml, u as ordering } from "./yaml-utils-BPy991by.mjs";
4
4
  import { A as isValidWorkspaceName, C as TBD_SHORTCUTS_STANDARD, D as WORKTREE_DIR, E as WORKSPACES_DIR, M as resolveDataSyncDir, O as WORKTREE_DIR_NAME, S as TBD_GUIDELINES_DIR, T as TBD_TEMPLATES_DIR, _ as DEFAULT_SHORTCUT_PATHS, a as isInitialized, b as TBD_DIR, c as readConfigWithMigration, d as writeConfig, g as DEFAULT_GUIDELINES_PATHS, h as DATA_SYNC_DIR_NAME, i as initConfig, j as resolveAtticDir, k as getWorkspaceDir, l as readLocalState, m as DATA_SYNC_DIR, n as findTbdRoot, o as markWelcomeSeen, p as CHARS_PER_TOKEN, r as hasSeenWelcome, s as readConfig, u as updateLocalState, v as DEFAULT_TEMPLATE_PATHS, w as TBD_SHORTCUTS_SYSTEM, x as TBD_DOCS_DIR, y as SYNC_BRANCH } from "./config-B38rbI9u.mjs";
5
5
  import { _ as formatDisplayId, a as hasShortId, b as normalizeIssueId, c as parseIdMappingFromYaml, d as resolveToInternalId, f as saveIdMapping, g as formatDebugId, h as extractUlidFromInternalId, i as generateUniqueShortId, l as reconcileMappings, m as extractShortId, o as loadIdMapping, p as extractPrefix, s as mergeIdMappings, t as addIdMapping, u as resolveIdMappingConflicts, v as generateInternalId, x as validateIssueId, y as makeInternalId } from "./id-mapping-CqrrLgeX.mjs";
@@ -2924,6 +2924,30 @@ const listCommand = new Command("list").description("List issues").option("--sta
2924
2924
  await new ListHandler(command).run(options);
2925
2925
  });
2926
2926
 
2927
+ //#endregion
2928
+ //#region src/cli/lib/dependency-format.ts
2929
+ /**
2930
+ * Compute display-ready dependency directions for an issue.
2931
+ */
2932
+ function getDependencyDirections(issue, allIssues, displayId) {
2933
+ const blocks = issue.dependencies.filter((dep) => dep.type === "blocks").map((dep) => displayId(dep.target));
2934
+ const blockedBy = [];
2935
+ for (const other of allIssues) for (const dep of other.dependencies) if (dep.type === "blocks" && dep.target === issue.id) blockedBy.push(displayId(other.id));
2936
+ return {
2937
+ blocks,
2938
+ blockedBy
2939
+ };
2940
+ }
2941
+ /**
2942
+ * Render dependency directions as YAML comments for round-trippable show output.
2943
+ */
2944
+ function formatDependencyDirectionComments(directions) {
2945
+ const lines = [];
2946
+ if (directions.blocks.length > 0) lines.push(`# Blocks: ${directions.blocks.join(", ")}`);
2947
+ if (directions.blockedBy.length > 0) lines.push(`# Blocked by: ${directions.blockedBy.join(", ")}`);
2948
+ return lines;
2949
+ }
2950
+
2927
2951
  //#endregion
2928
2952
  //#region src/cli/commands/show.ts
2929
2953
  /**
@@ -2936,14 +2960,18 @@ const listCommand = new Command("list").description("List issues").option("--sta
2936
2960
  *
2937
2961
  * @param issue - The issue to render
2938
2962
  * @param colors - Color functions
2939
- * @param maxLines - If set, truncate output to this many lines with an omission notice
2963
+ * @param dependencyDirections - Optional human-facing dependency direction comments
2940
2964
  * @returns Array of formatted lines
2941
2965
  */
2942
- function renderIssueLines(issue, colors) {
2966
+ function renderIssueLines(issue, colors, dependencyDirections) {
2943
2967
  const serialized = serializeIssue(issue);
2944
2968
  const output = [];
2969
+ const dependencyDirectionComments = dependencyDirections ? formatDependencyDirectionComments(dependencyDirections) : [];
2945
2970
  for (const line of serialized.split("\n")) if (line === "---") output.push(colors.dim(line));
2946
- else if (line.startsWith("id:")) output.push(`${colors.dim("id:")} ${colors.id(line.slice(4))}`);
2971
+ else if (line.startsWith("dependencies:")) {
2972
+ for (const comment of dependencyDirectionComments) output.push(colors.dim(comment));
2973
+ output.push(line);
2974
+ } else if (line.startsWith("id:")) output.push(`${colors.dim("id:")} ${colors.id(line.slice(4))}`);
2947
2975
  else if (line.startsWith("status:")) {
2948
2976
  const status = line.slice(8).trim();
2949
2977
  const statusColor = getStatusColor(status, colors);
@@ -2986,6 +3014,10 @@ var ShowHandler = class extends BaseCommand {
2986
3014
  } catch {}
2987
3015
  const maxLines = options.maxLines ? parseInt(options.maxLines, 10) : void 0;
2988
3016
  const displayId = ctx.displayId(issue.id);
3017
+ const allIssues = ctx.cli.json ? void 0 : await listIssues(ctx.dataSyncDir);
3018
+ const displayDependencyId = (dependencyId) => ctx.displayId(dependencyId);
3019
+ const dependencyDirections = allIssues ? getDependencyDirections(issue, allIssues, displayDependencyId) : void 0;
3020
+ const parentDependencyDirections = allIssues && parentIssue ? getDependencyDirections(parentIssue, allIssues, displayDependencyId) : void 0;
2989
3021
  const displayIssue = {
2990
3022
  ...issue,
2991
3023
  displayId,
@@ -2996,11 +3028,11 @@ var ShowHandler = class extends BaseCommand {
2996
3028
  };
2997
3029
  this.output.data(displayIssue, () => {
2998
3030
  const colors = this.output.getColors();
2999
- printWithTruncation(renderIssueLines(issue, colors), colors, maxLines);
3031
+ printWithTruncation(renderIssueLines(issue, colors, dependencyDirections), colors, maxLines);
3000
3032
  if (parentIssue) {
3001
3033
  console.log("");
3002
3034
  console.log(colors.dim("The parent of this bead is:"));
3003
- printWithTruncation(renderIssueLines(parentIssue, colors), colors, PARENT_CONTEXT_MAX_LINES);
3035
+ printWithTruncation(renderIssueLines(parentIssue, colors, parentDependencyDirections), colors, PARENT_CONTEXT_MAX_LINES);
3004
3036
  }
3005
3037
  if (options.showOrder) {
3006
3038
  console.log("");
@@ -3841,13 +3873,7 @@ var DependsListHandler = class extends BaseCommand {
3841
3873
  }
3842
3874
  const showDebug = this.ctx.debug;
3843
3875
  const prefix = (await readConfig(tbdRoot)).display.id_prefix;
3844
- const blocks = issue.dependencies.filter((dep) => dep.type === "blocks").map((dep) => showDebug ? formatDebugId(dep.target, mapping, prefix) : formatDisplayId(dep.target, mapping, prefix));
3845
- const blockedBy = [];
3846
- for (const other of allIssues) for (const dep of other.dependencies) if (dep.type === "blocks" && dep.target === internalId) blockedBy.push(showDebug ? formatDebugId(other.id, mapping, prefix) : formatDisplayId(other.id, mapping, prefix));
3847
- const deps = {
3848
- blocks,
3849
- blockedBy
3850
- };
3876
+ const deps = getDependencyDirections(issue, allIssues, (dependencyId) => showDebug ? formatDebugId(dependencyId, mapping, prefix) : formatDisplayId(dependencyId, mapping, prefix));
3851
3877
  this.output.data(deps, () => {
3852
3878
  const colors = this.output.getColors();
3853
3879
  if (deps.blocks.length > 0) console.log(`${colors.bold("Blocks:")} ${deps.blocks.join(", ")}`);
@@ -6709,11 +6735,11 @@ var DoctorHandler = class extends BaseCommand {
6709
6735
  };
6710
6736
  }
6711
6737
  async checkTempFiles(fix) {
6712
- const issuesPath = join(CONFIG_DIR, "issues");
6713
6738
  const issuesDir = join(this.dataSyncDir, "issues");
6739
+ const issuesPath = join(DATA_SYNC_DIR, "issues");
6714
6740
  let tempFiles = [];
6715
6741
  try {
6716
- tempFiles = (await readdir(issuesDir)).filter((f) => f.endsWith(".tmp"));
6742
+ tempFiles = (await readdir(issuesDir)).filter((f) => f.endsWith(".tmp") || /\.tmp-\d+$/.test(f));
6717
6743
  } catch {
6718
6744
  return {
6719
6745
  name: "Temp files",