azdo-cli 0.2.0-develop.104 → 0.2.0-develop.107

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/README.md CHANGED
@@ -107,7 +107,7 @@ azdo set-field 12345 System.Title "Updated title"
107
107
  ### List Fields
108
108
 
109
109
  ```bash
110
- # List all fields of a work item
110
+ # List all fields with values (rich text fields preview first 5 lines)
111
111
  azdo list-fields 12345
112
112
 
113
113
  # JSON output
package/dist/index.js CHANGED
@@ -64,9 +64,20 @@ function stringifyFieldValue(value) {
64
64
  function buildExtraFields(fields, requested) {
65
65
  const result = {};
66
66
  for (const name of requested) {
67
- const val = fields[name];
67
+ let val = fields[name];
68
+ let resolvedName = name;
69
+ if (val === void 0) {
70
+ const nameSuffix = name.split(".").pop().toLowerCase();
71
+ const match = Object.keys(fields).find(
72
+ (k) => k.split(".").pop().toLowerCase() === nameSuffix
73
+ );
74
+ if (match !== void 0) {
75
+ val = fields[match];
76
+ resolvedName = match;
77
+ }
78
+ }
68
79
  if (val !== void 0 && val !== null) {
69
- result[name] = stringifyFieldValue(val);
80
+ result[resolvedName] = stringifyFieldValue(val);
70
81
  }
71
82
  }
72
83
  return Object.keys(result).length > 0 ? result : null;
@@ -1477,6 +1488,14 @@ function stringifyValue(value) {
1477
1488
  if (typeof value === "object") return JSON.stringify(value);
1478
1489
  return String(value);
1479
1490
  }
1491
+ function formatRichValue(raw) {
1492
+ const md = htmlToMarkdown(raw);
1493
+ const lines = md.split("\n").filter((l) => l.trim() !== "");
1494
+ const preview = lines.slice(0, 5);
1495
+ const suffix = lines.length > 5 ? `
1496
+ \u2026 (${lines.length - 5} more lines)` : "";
1497
+ return preview.join("\n ") + suffix;
1498
+ }
1480
1499
  function formatFieldList(fields) {
1481
1500
  const entries = Object.entries(fields).sort(([a], [b]) => a.localeCompare(b));
1482
1501
  const maxKeyLen = Math.min(
@@ -1484,9 +1503,14 @@ function formatFieldList(fields) {
1484
1503
  50
1485
1504
  );
1486
1505
  return entries.map(([key, value]) => {
1487
- const display = stringifyValue(value);
1488
- const truncated = display.length > 120 ? display.slice(0, 117) + "..." : display;
1489
- return `${key.padEnd(maxKeyLen + 2)}${truncated}`;
1506
+ const raw = stringifyValue(value);
1507
+ if (raw === "") return `${key.padEnd(maxKeyLen + 2)}(empty)`;
1508
+ if (typeof value === "string" && isHtml(value)) {
1509
+ const preview = formatRichValue(value);
1510
+ return `${key.padEnd(maxKeyLen + 2)}[rich text]
1511
+ ${preview}`;
1512
+ }
1513
+ return `${key.padEnd(maxKeyLen + 2)}${raw}`;
1490
1514
  }).join("\n");
1491
1515
  }
1492
1516
  function createListFieldsCommand() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "azdo-cli",
3
- "version": "0.2.0-develop.104",
3
+ "version": "0.2.0-develop.107",
4
4
  "description": "Azure DevOps CLI tool",
5
5
  "type": "module",
6
6
  "bin": {