jiradc-cli 1.0.38 → 1.0.39

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 (2) hide show
  1. package/dist/index.js +22 -1
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -1450,13 +1450,29 @@ function registerComponentCommands(program) {
1450
1450
  issueCount(component);
1451
1451
  }
1452
1452
 
1453
+ // src/utils/field-search.ts
1454
+ function tier(field, keyword) {
1455
+ const id = field.id.toLowerCase();
1456
+ const name = (field.name ?? "").toLowerCase();
1457
+ if (id === keyword) return 0;
1458
+ if (name === keyword) return field.custom === true ? 2 : 1;
1459
+ return field.custom === true ? 4 : 3;
1460
+ }
1461
+ function rankFieldMatches(fields, keyword, limit) {
1462
+ const needle = keyword.toLowerCase();
1463
+ const matches = fields.filter(
1464
+ (f) => f.id.toLowerCase().includes(needle) || (f.name ?? "").toLowerCase().includes(needle)
1465
+ );
1466
+ return matches.sort((a, b) => tier(a, needle) - tier(b, needle)).slice(0, limit);
1467
+ }
1468
+
1453
1469
  // src/commands/field/search.ts
1454
1470
  function search(parent) {
1455
1471
  const cmd = parent.command("search").description("Search for fields by name or ID").argument("<keyword>", "Search keyword", nonEmpty).option("--limit <number>", "Maximum number of results (1-1000)", intInRange(1, 1e3), 25);
1456
1472
  examples(cmd, ["epic", "customfield_10100", "priority --limit 5"]);
1457
1473
  cmd.action(async (keyword, opts) => {
1458
1474
  const client = getClient();
1459
- const result = await client.fields.search(keyword, opts.limit);
1475
+ const result = rankFieldMatches(await client.fields.getAll(), keyword, opts.limit);
1460
1476
  output(result.map(transformField));
1461
1477
  });
1462
1478
  }
@@ -2096,6 +2112,7 @@ var DEFAULT_FIELDS = [...SEARCH_DEFAULT_FIELDS, "description", "comment"];
2096
2112
  // src/utils/field-selectors.ts
2097
2113
  var WILDCARD = "*";
2098
2114
  var NEGATION = "-";
2115
+ var UNPUBLISHED_SELECTORS = ["parent"];
2099
2116
  function buildFieldNameIndex(fields) {
2100
2117
  const ids = /* @__PURE__ */ new Set();
2101
2118
  const idsByLower = /* @__PURE__ */ new Map();
@@ -2115,6 +2132,10 @@ function buildFieldNameIndex(fields) {
2115
2132
  record(field.name, field.id);
2116
2133
  for (const clause of field.clauseNames ?? []) record(clause, field.id);
2117
2134
  }
2135
+ for (const id of UNPUBLISHED_SELECTORS) {
2136
+ ids.add(id);
2137
+ if (!idsByLower.has(id)) idsByLower.set(id, id);
2138
+ }
2118
2139
  return { ids, idsByLower, byName };
2119
2140
  }
2120
2141
  function candidatesFor(token, index) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jiradc-cli",
3
- "version": "1.0.38",
3
+ "version": "1.0.39",
4
4
  "publish": true,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -23,9 +23,9 @@
23
23
  "tsx": "^4.19.2",
24
24
  "typescript": "^5.7.2",
25
25
  "vitest": "^4.0.16",
26
- "config-eslint": "0.0.0",
26
+ "cli-utils": "1.0.0",
27
27
  "config-typescript": "0.0.0",
28
- "cli-utils": "1.0.0"
28
+ "config-eslint": "0.0.0"
29
29
  },
30
30
  "engines": {
31
31
  "node": ">=22.0.0"