@productbrain/cli 0.1.0-beta.4406 → 0.1.0-beta.4415
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/formatters/search.d.ts.map +1 -1
- package/dist/formatters/search.js +17 -1
- package/dist/formatters/search.js.map +1 -1
- package/dist/formatters/search.test.d.ts +2 -0
- package/dist/formatters/search.test.d.ts.map +1 -0
- package/dist/formatters/search.test.js +46 -0
- package/dist/formatters/search.test.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/formatters/search.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/formatters/search.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAgBD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,MAAM,CAgBnE"}
|
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
* Chain: DEC-186 (CLI uses Convex view model with CLI-native formatting).
|
|
4
4
|
*/
|
|
5
5
|
import { stripControlChars } from '../lib/strip.js';
|
|
6
|
+
/**
|
|
7
|
+
* Status column display word. 'active' displays as the canonical 'accepted' word — the two
|
|
8
|
+
* are the same trust level (DEC-1575), so the CLI never shows a fresh accept and a legacy
|
|
9
|
+
* row under different labels. Every other stored word (including 'accepted' itself, and any
|
|
10
|
+
* non-vocabulary word a caller passes) displays as-is. Deliberately NOT
|
|
11
|
+
* kernel/entries/statusStateMachine.ts's foldLegacyTrustState — its deprecated→archived leg
|
|
12
|
+
* would ALSO rewrite display for those words, folding two genuinely distinct stored values
|
|
13
|
+
* into one shown word (a duplicate-name trap this column must not create).
|
|
14
|
+
*/
|
|
15
|
+
function displayStatus(status) {
|
|
16
|
+
if (!status)
|
|
17
|
+
return '';
|
|
18
|
+
return status === 'active' ? 'accepted' : status;
|
|
19
|
+
}
|
|
6
20
|
export function formatSearchResults(results) {
|
|
7
21
|
if (results.length === 0) {
|
|
8
22
|
return 'No results found.';
|
|
@@ -13,7 +27,9 @@ export function formatSearchResults(results) {
|
|
|
13
27
|
for (const r of results) {
|
|
14
28
|
const id = r.entryId ?? r.name;
|
|
15
29
|
const coll = r.collectionSlug ?? '—';
|
|
16
|
-
|
|
30
|
+
const status = displayStatus(r.status);
|
|
31
|
+
const statusSuffix = status ? ` (${s(status)})` : '';
|
|
32
|
+
lines.push(` ${s(id)} [${s(coll)}] ${s(r.name)}${statusSuffix}`);
|
|
17
33
|
}
|
|
18
34
|
return lines.join('\n');
|
|
19
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/formatters/search.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AASpD,MAAM,UAAU,mBAAmB,CAAC,OAAuB;IACzD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAED,sFAAsF;IACtF,MAAM,CAAC,GAAG,iBAAiB,CAAC;IAC5B,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,CAAC,IAAI,OAAO,EAAE,CAAC;QACxB,MAAM,EAAE,GAAG,CAAC,CAAC,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MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,YAAY,EAAE,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.test.d.ts","sourceRoot":"","sources":["../../src/formatters/search.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WP-644 S2 (TASK-74): formatSearchResults gains a status column. 'active' displays as the
|
|
3
|
+
* canonical 'accepted' word (DEC-1575 — the two are the same trust level); every other word
|
|
4
|
+
* (including 'accepted' itself, and any non-vocabulary word a caller passes) displays as
|
|
5
|
+
* stored. A missing status renders nothing, never the literal string "undefined".
|
|
6
|
+
*/
|
|
7
|
+
import { describe, expect, it } from 'vitest';
|
|
8
|
+
import { formatSearchResults } from './search.js';
|
|
9
|
+
describe('formatSearchResults — status column trust-word display (WP-644 S2)', () => {
|
|
10
|
+
it("a legacy 'active' row displays as 'accepted'", () => {
|
|
11
|
+
const output = formatSearchResults([
|
|
12
|
+
{ entryId: 'WP-1', name: 'Legacy row', collectionSlug: 'work-packages', status: 'active' },
|
|
13
|
+
]);
|
|
14
|
+
expect(output).toContain('accepted');
|
|
15
|
+
expect(output).not.toContain('(active)');
|
|
16
|
+
});
|
|
17
|
+
it("a canonical 'accepted' row displays as 'accepted' (unchanged)", () => {
|
|
18
|
+
const output = formatSearchResults([
|
|
19
|
+
{ entryId: 'WP-2', name: 'Canonical row', collectionSlug: 'work-packages', status: 'accepted' },
|
|
20
|
+
]);
|
|
21
|
+
expect(output).toContain('accepted');
|
|
22
|
+
});
|
|
23
|
+
it("a non-vocabulary status word ('published') displays as stored, not remapped", () => {
|
|
24
|
+
const output = formatSearchResults([
|
|
25
|
+
{ entryId: 'DEC-1', name: 'Unrelated word', collectionSlug: 'decisions', status: 'published' },
|
|
26
|
+
]);
|
|
27
|
+
expect(output).toContain('published');
|
|
28
|
+
});
|
|
29
|
+
it('a missing status renders nothing — never the literal "undefined"', () => {
|
|
30
|
+
const output = formatSearchResults([
|
|
31
|
+
{ entryId: 'WP-3', name: 'No status', collectionSlug: 'work-packages' },
|
|
32
|
+
]);
|
|
33
|
+
expect(output).not.toContain('undefined');
|
|
34
|
+
});
|
|
35
|
+
it("a 'draft'/'archived'/'deprecated' row displays as stored, not folded into another word", () => {
|
|
36
|
+
const output = formatSearchResults([
|
|
37
|
+
{ entryId: 'WP-4', name: 'Draft row', collectionSlug: 'work-packages', status: 'draft' },
|
|
38
|
+
{ entryId: 'WP-5', name: 'Deprecated row', collectionSlug: 'work-packages', status: 'deprecated' },
|
|
39
|
+
{ entryId: 'WP-6', name: 'Archived row', collectionSlug: 'work-packages', status: 'archived' },
|
|
40
|
+
]);
|
|
41
|
+
expect(output).toContain('draft');
|
|
42
|
+
expect(output).toContain('deprecated');
|
|
43
|
+
expect(output).toContain('archived');
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=search.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.test.js","sourceRoot":"","sources":["../../src/formatters/search.test.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,QAAQ,CAAC,oEAAoE,EAAE,GAAG,EAAE;IACnF,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACvD,MAAM,MAAM,GAAG,mBAAmB,CAAC;YAClC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE;SAC1F,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,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