@cluesmith/codev-core 3.1.3 → 3.1.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.
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Render an area name as a human-readable group-header label.
3
+ *
4
+ * Display-only. The raw `area` value (the wire string from
5
+ * `OverviewBacklogItem.area` / `OverviewBuilder.area`, or the
6
+ * `UNCATEGORIZED_AREA` sentinel) MUST continue to be used for
7
+ * bucketing (`groupByArea`), id stability, and `===` matchers.
8
+ *
9
+ * Rule: uppercase the entire string. Separators (`-`, `_`) are
10
+ * preserved as-is so the header reads as a single visual token
11
+ * matching VSCode's own container-label convention (EXPLORER,
12
+ * SOURCE CONTROL, etc.). Examples:
13
+ * 'vscode' -> 'VSCODE'
14
+ * 'cross-cutting' -> 'CROSS-CUTTING'
15
+ * 'front_end' -> 'FRONT_END'
16
+ * 'Uncategorized' -> 'UNCATEGORIZED'
17
+ *
18
+ * Purely structural: no hardcoded list of "known acronyms". Teams
19
+ * using Codev decide their own labeling semantics; a per-repo
20
+ * override map can be layered on top as a non-breaking extension.
21
+ */
22
+ export declare function uppercaseAreaName(area: string): string;
23
+ /**
24
+ * Bucket items by their resolved area, returning groups in canonical
25
+ * Codev order: alphabetical specific areas first, then `Uncategorized`
26
+ * last. Within each group, the input order is preserved (the caller
27
+ * has already applied any sort policy — display-order for builders,
28
+ * mine-first for backlog).
29
+ *
30
+ * Pure, generic over the item type. Both `views/backlog.ts` and
31
+ * `views/builders.ts` in the VSCode extension consume this directly,
32
+ * keying off each item's resolved `area` (already projected on the
33
+ * server via `parseArea`; see #819). Future consumers (dashboard
34
+ * equivalents, etc.) reuse the same function so the grouping rule
35
+ * stays byte-shared, not merely prose-described.
36
+ */
37
+ export declare function groupByArea<T>(items: T[], getArea: (item: T) => string): Array<{
38
+ area: string;
39
+ items: T[];
40
+ }>;
41
+ //# sourceMappingURL=area-grouping.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"area-grouping.d.ts","sourceRoot":"","sources":["../src/area-grouping.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,KAAK,EAAE,CAAC,EAAE,EACV,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAC3B,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,EAAE,CAAA;CAAE,CAAC,CAwBrC"}
@@ -0,0 +1,65 @@
1
+ import { UNCATEGORIZED_AREA } from './constants.js';
2
+ /**
3
+ * Render an area name as a human-readable group-header label.
4
+ *
5
+ * Display-only. The raw `area` value (the wire string from
6
+ * `OverviewBacklogItem.area` / `OverviewBuilder.area`, or the
7
+ * `UNCATEGORIZED_AREA` sentinel) MUST continue to be used for
8
+ * bucketing (`groupByArea`), id stability, and `===` matchers.
9
+ *
10
+ * Rule: uppercase the entire string. Separators (`-`, `_`) are
11
+ * preserved as-is so the header reads as a single visual token
12
+ * matching VSCode's own container-label convention (EXPLORER,
13
+ * SOURCE CONTROL, etc.). Examples:
14
+ * 'vscode' -> 'VSCODE'
15
+ * 'cross-cutting' -> 'CROSS-CUTTING'
16
+ * 'front_end' -> 'FRONT_END'
17
+ * 'Uncategorized' -> 'UNCATEGORIZED'
18
+ *
19
+ * Purely structural: no hardcoded list of "known acronyms". Teams
20
+ * using Codev decide their own labeling semantics; a per-repo
21
+ * override map can be layered on top as a non-breaking extension.
22
+ */
23
+ export function uppercaseAreaName(area) {
24
+ return area.toUpperCase();
25
+ }
26
+ /**
27
+ * Bucket items by their resolved area, returning groups in canonical
28
+ * Codev order: alphabetical specific areas first, then `Uncategorized`
29
+ * last. Within each group, the input order is preserved (the caller
30
+ * has already applied any sort policy — display-order for builders,
31
+ * mine-first for backlog).
32
+ *
33
+ * Pure, generic over the item type. Both `views/backlog.ts` and
34
+ * `views/builders.ts` in the VSCode extension consume this directly,
35
+ * keying off each item's resolved `area` (already projected on the
36
+ * server via `parseArea`; see #819). Future consumers (dashboard
37
+ * equivalents, etc.) reuse the same function so the grouping rule
38
+ * stays byte-shared, not merely prose-described.
39
+ */
40
+ export function groupByArea(items, getArea) {
41
+ const buckets = new Map();
42
+ for (const item of items) {
43
+ const area = getArea(item);
44
+ const bucket = buckets.get(area);
45
+ if (bucket) {
46
+ bucket.push(item);
47
+ }
48
+ else {
49
+ buckets.set(area, [item]);
50
+ }
51
+ }
52
+ const result = [];
53
+ const uncategorized = buckets.get(UNCATEGORIZED_AREA);
54
+ const specifics = [...buckets.keys()]
55
+ .filter(a => a !== UNCATEGORIZED_AREA)
56
+ .sort();
57
+ for (const area of specifics) {
58
+ result.push({ area, items: buckets.get(area) });
59
+ }
60
+ if (uncategorized) {
61
+ result.push({ area: UNCATEGORIZED_AREA, items: uncategorized });
62
+ }
63
+ return result;
64
+ }
65
+ //# sourceMappingURL=area-grouping.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"area-grouping.js","sourceRoot":"","sources":["../src/area-grouping.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;AAC5B,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,WAAW,CACzB,KAAU,EACV,OAA4B;IAE5B,MAAM,OAAO,GAAG,IAAI,GAAG,EAAe,CAAC;IACvC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3B,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAwC,EAAE,CAAC;IACvD,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IACtD,MAAM,SAAS,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;SAClC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,kBAAkB,CAAC;SACrC,IAAI,EAAE,CAAC;IACV,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;QAC7B,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAE,EAAE,CAAC,CAAC;IACnD,CAAC;IACD,IAAI,aAAa,EAAE,CAAC;QAClB,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,3 +1,11 @@
1
1
  export declare const DEFAULT_TOWER_PORT = 4100;
2
2
  export declare const AGENT_FARM_DIR: string;
3
+ /**
4
+ * Fallback `area` value emitted by the server when an issue or builder has
5
+ * no `area/*` label (or — for builders — no associated issue). The single
6
+ * source of truth so the parser default, the server-side initializer for
7
+ * builders pending issue-cache enrichment, and any downstream UI filter or
8
+ * matcher all agree on the literal.
9
+ */
10
+ export declare const UNCATEGORIZED_AREA = "Uncategorized";
3
11
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,OAAO,CAAC;AACvC,eAAO,MAAM,cAAc,QAAoC,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,OAAO,CAAC;AACvC,eAAO,MAAM,cAAc,QAAoC,CAAC;AAEhE;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,kBAAkB,CAAC"}
package/dist/constants.js CHANGED
@@ -2,4 +2,12 @@ import { resolve } from 'node:path';
2
2
  import { homedir } from 'node:os';
3
3
  export const DEFAULT_TOWER_PORT = 4100;
4
4
  export const AGENT_FARM_DIR = resolve(homedir(), '.agent-farm');
5
+ /**
6
+ * Fallback `area` value emitted by the server when an issue or builder has
7
+ * no `area/*` label (or — for builders — no associated issue). The single
8
+ * source of truth so the parser default, the server-side initializer for
9
+ * builders pending issue-cache enrichment, and any downstream UI filter or
10
+ * matcher all agree on the literal.
11
+ */
12
+ export const UNCATEGORIZED_AREA = 'Uncategorized';
5
13
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AACvC,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,EAAE,EAAE,aAAa,CAAC,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AACvC,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,EAAE,EAAE,aAAa,CAAC,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,eAAe,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cluesmith/codev-core",
3
- "version": "3.1.3",
3
+ "version": "3.1.6",
4
4
  "description": "Core runtime utilities for Codev — Tower client, auth, workspace helpers, escape buffer",
5
5
  "type": "module",
6
6
  "exports": {
@@ -31,6 +31,10 @@
31
31
  "./builder-helpers": {
32
32
  "types": "./dist/builder-helpers.d.ts",
33
33
  "default": "./dist/builder-helpers.js"
34
+ },
35
+ "./area-grouping": {
36
+ "types": "./dist/area-grouping.d.ts",
37
+ "default": "./dist/area-grouping.js"
34
38
  }
35
39
  },
36
40
  "files": [
@@ -39,7 +43,7 @@
39
43
  "devDependencies": {
40
44
  "@types/node": "22.x",
41
45
  "typescript": "^5.7.0",
42
- "@cluesmith/codev-types": "3.1.3"
46
+ "@cluesmith/codev-types": "3.1.6"
43
47
  },
44
48
  "license": "Apache-2.0",
45
49
  "scripts": {