@t0.labs/daxta 0.4.17 → 0.4.18

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/main.js CHANGED
@@ -11,35 +11,31 @@ const test_1 = require("./test");
11
11
  const tree_1 = require("./tree");
12
12
  const titles_1 = require("./titles");
13
13
  const uninstall_1 = require("./uninstall");
14
+ const ui_1 = require("./ui");
14
15
  function usage() {
15
- console.log(`DAxTA CLI (@t0.labs/daxta)
16
-
17
- Usage:
18
- daxta install [--dry-run] [--skip-dep] [--skip-main] [--yes] [--main <path>] [--fast]
19
- daxta init (alias of install)
20
- daxta uninstall [--yes] [--dry-run] [--keep-dep] [--fast]
21
- daxta migrate [--yes] (force upgrade + sidebar prompts)
22
- daxta titles [--check] [--yes] [--strict]
23
- daxta test [--script <name>] [--config <jest.json>] [--serve] [--port <n>] [--yes] [--strict]
24
- daxta build
25
- daxta serve [--port <n>]
26
- daxta tree [PATH] [--layout resource-first|url-order]
27
- daxta fields [METHOD] [PATH] [--out <file>]
28
- daxta call [METHOD] [PATH] [--fields <file>] [--header k:v ...]
29
- daxta call --file <values.json> [--header k:v ...]
30
-
31
- One-shot setup:
32
- pnpm dlx @t0.labs/daxta install
33
- npx @t0.labs/daxta install
34
-
35
- Remove completely:
36
- pnpm dlx @t0.labs/daxta uninstall
37
- npx @t0.labs/daxta uninstall
38
-
39
- daxta titles = check TEST_TITLE + it() format before tests; suggests names from method/path/section
40
- daxta test = forwards to your package script (Jest stays parent; DAxTA is a plugin)
41
- daxta tree = choose how paths appear in the /docs sidebar
42
- `);
16
+ const cmd = (name) => ui_1.c.bold(ui_1.c.ice(name));
17
+ console.log('');
18
+ console.log(` ${ui_1.c.bold(ui_1.c.ice('DAxTA'))} ${ui_1.c.dim('docs from Nest traffic · @t0.labs/daxta')}`);
19
+ console.log('');
20
+ console.log(` ${ui_1.c.gold('Setup')}`);
21
+ console.log(` ${cmd('daxta install')} ${ui_1.c.dim('[--yes] [--dry-run] [--skip-dep] [--skip-main] [--fast]')}`);
22
+ console.log(` ${cmd('daxta init')} ${ui_1.c.dim('alias of install')}`);
23
+ console.log(` ${cmd('daxta uninstall')} ${ui_1.c.dim('[--yes] [--dry-run] [--keep-dep]')}`);
24
+ console.log(` ${cmd('daxta migrate')} ${ui_1.c.dim('[--yes]')}`);
25
+ console.log('');
26
+ console.log(` ${ui_1.c.gold('Docs & tests')}`);
27
+ console.log(` ${cmd('daxta titles')} ${ui_1.c.dim('[--check] [--yes] [--strict]')}`);
28
+ console.log(` ${cmd('daxta test')} ${ui_1.c.dim('your Jest script + plugin')}`);
29
+ console.log(` ${cmd('daxta build')} ${ui_1.c.dim('OpenAPI + viewer from hits')}`);
30
+ console.log(` ${cmd('daxta serve')} ${ui_1.c.dim('[--port]')}`);
31
+ console.log(` ${cmd('daxta tree')} ${ui_1.c.dim('sidebar layout')}`);
32
+ console.log('');
33
+ console.log(` ${ui_1.c.gold('Try-it')}`);
34
+ console.log(` ${cmd('daxta fields')} ${ui_1.c.dim('[METHOD] [PATH]')}`);
35
+ console.log(` ${cmd('daxta call')} ${ui_1.c.dim('[METHOD] [PATH] | --file')}`);
36
+ console.log('');
37
+ console.log(` ${ui_1.c.mint('First time')} ${ui_1.c.ice('pnpm dlx @t0.labs/daxta install')}`);
38
+ console.log('');
43
39
  }
44
40
  function parseArgs(argv) {
45
41
  const args = argv.slice(2);
@@ -1,44 +1,37 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runTitleCheck = runTitleCheck;
4
- const readline_1 = require("readline");
5
4
  const test_title_1 = require("../catalog/test-title");
6
5
  const it_case_1 = require("../catalog/it-case");
7
6
  const scan_1 = require("../titles/scan");
8
7
  const ui_1 = require("./ui");
9
- function prompt(question) {
10
- const rl = (0, readline_1.createInterface)({ input: process.stdin, output: process.stdout });
11
- return new Promise((resolve) => {
12
- rl.question(question, (answer) => {
13
- rl.close();
14
- resolve(answer.trim());
15
- });
16
- });
17
- }
18
8
  async function pickFromSuggestions(finding, extra, validate) {
19
9
  const suggestions = finding.suggestions;
20
10
  console.log('');
21
- console.log(` ${ui_1.c.cyan(finding.file)}${ui_1.c.dim(`:${finding.line}:${finding.column}`)}`);
11
+ console.log(` ${ui_1.c.ice(finding.file)}${ui_1.c.dim(`:${finding.line}:${finding.column}`)}`);
22
12
  console.log(` ${ui_1.c.dim(finding.raw)}`);
23
13
  if (extra)
24
14
  console.log(` ${ui_1.c.dim(extra)}`);
15
+ if (!suggestions.length) {
16
+ console.log(` ${ui_1.c.gold('no auto suggestion')} ${ui_1.c.dim('— type a custom title (c). --yes will not skip this.')}`);
17
+ }
25
18
  suggestions.forEach((name, index) => {
26
19
  const mark = index === 0 ? ui_1.c.dim(' (recommended)') : '';
27
- console.log(` ${ui_1.c.cyan(String(index + 1))} ${name}${mark}`);
20
+ console.log(` ${ui_1.c.ice(String(index + 1))} ${name}${mark}`);
28
21
  });
29
- console.log(` ${ui_1.c.cyan('1–3')} pick ${ui_1.c.cyan('y')} this recommended ${ui_1.c.cyan('a')} all remaining recommended ${ui_1.c.cyan('s')} skip ${ui_1.c.cyan('c')} custom`);
30
- const answer = (await prompt(` ${ui_1.c.cyan('›')} `)).trim();
22
+ console.log(` ${ui_1.c.ice('1–3')} pick ${ui_1.c.ice('y')} this recommended ${ui_1.c.ice('a')} all remaining recommended ${ui_1.c.ice('s')} skip ${ui_1.c.ice('c')} custom`);
23
+ const answer = (await (0, ui_1.readlineAsk)(` ${ui_1.c.ice('›')} `)).trim();
31
24
  const lower = answer.toLowerCase();
32
25
  if (!answer || lower === 's')
33
26
  return 'skip';
34
27
  if (lower === 'a' || lower === 'all')
35
28
  return 'all';
36
29
  if (lower === 'y' || lower === 'yes')
37
- return suggestions[0] ?? 'skip';
30
+ return suggestions[0] ? suggestions[0] : 'skip';
38
31
  if (lower === 'c') {
39
- const custom = await prompt(` ${ui_1.c.dim('text')} ${ui_1.c.cyan('›')} `);
32
+ const custom = await (0, ui_1.readlineAsk)(` ${ui_1.c.dim('text')} ${ui_1.c.ice('›')} `);
40
33
  if (!validate(custom)) {
41
- console.log(` ${ui_1.c.yellow('!')} does not match the format — skipped`);
34
+ console.log(` ${ui_1.c.gold('!')} does not match the format — skipped`);
42
35
  return 'skip';
43
36
  }
44
37
  return custom;
@@ -51,6 +44,8 @@ async function pickFromSuggestions(finding, extra, validate) {
51
44
  return 'skip';
52
45
  }
53
46
  function writeTitle(cwd, finding) {
47
+ if (!finding.auto)
48
+ return false;
54
49
  const name = finding.suggestions[0];
55
50
  if (!name || !(0, test_title_1.isHumanOperationTitle)(name))
56
51
  return false;
@@ -65,9 +60,14 @@ function writeIt(cwd, finding) {
65
60
  function applyAllRecommended(cwd, titles, cases, fromTitleIndex, fromCaseIndex) {
66
61
  let written = 0;
67
62
  let skipped = 0;
63
+ const pending = [];
68
64
  for (let i = fromTitleIndex; i < titles.length; i += 1) {
65
+ if (!titles[i].auto || !titles[i].suggestions[0]) {
66
+ pending.push(titles[i]);
67
+ continue;
68
+ }
69
69
  if (writeTitle(cwd, titles[i])) {
70
- console.log(` ${ui_1.c.green('✔')} ${titles[i].suggestions[0]} ${ui_1.c.dim(titles[i].file + ':' + titles[i].line)}`);
70
+ console.log(` ${ui_1.c.mint('✔')} ${titles[i].suggestions[0]} ${ui_1.c.dim(titles[i].file + ':' + titles[i].line)}`);
71
71
  written += 1;
72
72
  }
73
73
  else
@@ -76,13 +76,13 @@ function applyAllRecommended(cwd, titles, cases, fromTitleIndex, fromCaseIndex)
76
76
  const caseStart = fromTitleIndex < titles.length ? 0 : fromCaseIndex;
77
77
  for (let i = caseStart; i < cases.length; i += 1) {
78
78
  if (writeIt(cwd, cases[i])) {
79
- console.log(` ${ui_1.c.green('✔')} ${cases[i].suggestions[0]} ${ui_1.c.dim(cases[i].file + ':' + cases[i].line)}`);
79
+ console.log(` ${ui_1.c.mint('✔')} ${cases[i].suggestions[0]} ${ui_1.c.dim(cases[i].file + ':' + cases[i].line)}`);
80
80
  written += 1;
81
81
  }
82
82
  else
83
83
  skipped += 1;
84
84
  }
85
- return { written, skipped };
85
+ return { written, skipped, pending };
86
86
  }
87
87
  async function runTitleCheck(options) {
88
88
  const cwd = options.cwd ?? process.cwd();
@@ -91,7 +91,7 @@ async function runTitleCheck(options) {
91
91
  if (!total) {
92
92
  if (!options.checkOnly) {
93
93
  (0, ui_1.banner)('Test naming', 'titles + it() cases');
94
- console.log(` ${ui_1.c.green('✔')} nothing to fix`);
94
+ console.log(` ${ui_1.c.mint('✔')} nothing to fix`);
95
95
  console.log('');
96
96
  }
97
97
  return 0;
@@ -101,18 +101,27 @@ async function runTitleCheck(options) {
101
101
  (0, ui_1.banner)('Test naming', 'applying recommended titles + it() names');
102
102
  const result = applyAllRecommended(cwd, report.titles, report.cases, 0, 0);
103
103
  console.log('');
104
- console.log(` ${ui_1.c.green('✔')} ${result.written} updated ${ui_1.c.dim(`${result.skipped} skipped`)}`);
105
- console.log('');
106
- return options.strict && result.skipped > 0 ? 1 : 0;
104
+ console.log(` ${ui_1.c.mint('✔')} ${result.written} updated ${ui_1.c.dim(`${result.skipped} skipped`)}`);
105
+ if (result.pending.length) {
106
+ console.log('');
107
+ console.log(` ${ui_1.c.gold('!')} ${ui_1.c.bold(`${result.pending.length} title(s) have no auto suggestion`)} ${ui_1.c.dim('--yes does not invent names')}`);
108
+ for (const item of result.pending) {
109
+ console.log(` ${ui_1.c.ice(item.file)}${ui_1.c.dim(`:${item.line}`)} ${ui_1.c.dim(item.path + ' [' + item.method + ']')}`);
110
+ }
111
+ console.log(` ${ui_1.c.dim('Set those with')} ${ui_1.c.ice('daxta titles')} ${ui_1.c.dim('→ c (custom)')}`);
112
+ console.log('');
113
+ }
114
+ const leftover = result.skipped + result.pending.length;
115
+ return leftover > 0 && options.strict ? 1 : leftover > 0 ? 1 : 0;
107
116
  }
108
117
  if (options.checkOnly || options.yes || !process.stdin.isTTY) {
109
118
  (0, scan_1.printNamingFindings)(report, ui_1.c);
110
119
  return options.strict ? 1 : 0;
111
120
  }
112
121
  (0, ui_1.banner)('Test naming', 'runs before Jest — docs / Postman labels');
113
- console.log(` ${ui_1.c.dim('Title')} Create Mock Tbs /v1/admin/mock-tbs [POST] (integration)`);
122
+ console.log(` ${ui_1.c.dim('Title')} Create Mock Tbs — POST /v1/admin/mock-tbs`);
114
123
  console.log(` ${ui_1.c.dim('it()')} creates mock tbs when payload is valid`);
115
- console.log(` ${ui_1.c.yellow(String(total))} to review — ${ui_1.c.cyan('y')} one recommended, ${ui_1.c.cyan('a')} all remaining, ${ui_1.c.cyan('s')} skip.`);
124
+ console.log(` ${ui_1.c.gold(String(total))} to review — ${ui_1.c.ice('y')} one recommended, ${ui_1.c.ice('a')} all remaining, ${ui_1.c.ice('s')} skip.`);
116
125
  let written = 0;
117
126
  let skipped = 0;
118
127
  for (let i = 0; i < report.titles.length; i += 1) {
@@ -122,8 +131,21 @@ async function runTitleCheck(options) {
122
131
  const rest = applyAllRecommended(cwd, report.titles, report.cases, i, 0);
123
132
  written += rest.written;
124
133
  skipped += rest.skipped;
134
+ for (const pending of rest.pending) {
135
+ const customChoice = await pickFromSuggestions(pending, `docs would show ${pending.path} — custom title required`, test_title_1.isHumanOperationTitle);
136
+ if (!customChoice || customChoice === 'skip' || customChoice === 'all') {
137
+ skipped += 1;
138
+ continue;
139
+ }
140
+ if ((0, scan_1.applyTitle)(cwd, pending, customChoice)) {
141
+ console.log(` ${ui_1.c.mint('✔')} ${customChoice}`);
142
+ written += 1;
143
+ }
144
+ else
145
+ skipped += 1;
146
+ }
125
147
  console.log('');
126
- console.log(` ${ui_1.c.green('✔')} ${written} updated ${ui_1.c.dim(`${skipped} skipped`)}`);
148
+ console.log(` ${ui_1.c.mint('✔')} ${written} updated ${ui_1.c.dim(`${skipped} skipped`)}`);
127
149
  console.log('');
128
150
  return options.strict && skipped > 0 ? 1 : 0;
129
151
  }
@@ -132,11 +154,11 @@ async function runTitleCheck(options) {
132
154
  continue;
133
155
  }
134
156
  if ((0, scan_1.applyTitle)(cwd, finding, choice)) {
135
- console.log(` ${ui_1.c.green('✔')} ${choice}`);
157
+ console.log(` ${ui_1.c.mint('✔')} ${choice}`);
136
158
  written += 1;
137
159
  }
138
160
  else {
139
- console.log(` ${ui_1.c.yellow('!')} could not rewrite that line — skipped`);
161
+ console.log(` ${ui_1.c.gold('!')} could not rewrite that line — skipped`);
140
162
  skipped += 1;
141
163
  }
142
164
  }
@@ -154,16 +176,16 @@ async function runTitleCheck(options) {
154
176
  continue;
155
177
  }
156
178
  if ((0, scan_1.applyItCase)(cwd, finding, choice)) {
157
- console.log(` ${ui_1.c.green('✔')} ${choice}`);
179
+ console.log(` ${ui_1.c.mint('✔')} ${choice}`);
158
180
  written += 1;
159
181
  }
160
182
  else {
161
- console.log(` ${ui_1.c.yellow('!')} could not rewrite that line — skipped`);
183
+ console.log(` ${ui_1.c.gold('!')} could not rewrite that line — skipped`);
162
184
  skipped += 1;
163
185
  }
164
186
  }
165
187
  console.log('');
166
- console.log(` ${ui_1.c.green('✔')} ${written} updated ${ui_1.c.dim(`${skipped} skipped`)}`);
188
+ console.log(` ${ui_1.c.mint('✔')} ${written} updated ${ui_1.c.dim(`${skipped} skipped`)}`);
167
189
  console.log('');
168
190
  return options.strict && skipped > 0 ? 1 : 0;
169
191
  }
package/dist/cli/tree.js CHANGED
@@ -1,22 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.runTreeWizard = runTreeWizard;
4
- const readline_1 = require("readline");
5
4
  const fs_1 = require("fs");
6
5
  const config_1 = require("../config");
7
6
  const dto_fields_1 = require("../fields/dto-fields");
8
7
  const paths_1 = require("../serve/paths");
9
8
  const config_edit_1 = require("./config-edit");
10
9
  const ui_1 = require("./ui");
11
- function prompt(question) {
12
- const rl = (0, readline_1.createInterface)({ input: process.stdin, output: process.stdout });
13
- return new Promise((resolve) => {
14
- rl.question(question, (answer) => {
15
- rl.close();
16
- resolve(answer.trim());
17
- });
18
- });
19
- }
20
10
  function normalizePathInput(raw) {
21
11
  const trimmed = raw.trim();
22
12
  if (!trimmed)
@@ -59,12 +49,12 @@ function listKnownPaths() {
59
49
  }
60
50
  function printPathChoices(paths, limit = 12) {
61
51
  if (!paths.length) {
62
- console.log(` ${ui_1.c.dim('tip')} type a path like ${ui_1.c.cyan('/v1/admin/baskets')}`);
52
+ console.log(` ${ui_1.c.dim('tip')} type a path like ${ui_1.c.ice('/v1/admin/baskets')}`);
63
53
  return;
64
54
  }
65
55
  console.log(` ${ui_1.c.dim('known paths')}`);
66
56
  paths.slice(0, limit).forEach((item, index) => {
67
- console.log(` ${ui_1.c.dim(String(index + 1).padStart(2, ' '))} ${ui_1.c.cyan(item)}`);
57
+ console.log(` ${ui_1.c.dim(String(index + 1).padStart(2, ' '))} ${ui_1.c.ice(item)}`);
68
58
  });
69
59
  if (paths.length > limit)
70
60
  console.log(` ${ui_1.c.dim(`… +${paths.length - limit} more`)}`);
@@ -74,7 +64,7 @@ async function pickPath(flagPath) {
74
64
  return normalizePathInput(flagPath);
75
65
  const known = listKnownPaths();
76
66
  printPathChoices(known);
77
- const answer = await prompt(` ${ui_1.c.yellow('?')} ${ui_1.c.bold('Path')} override ${ui_1.c.dim('(number · path · n skip)')}\n ${ui_1.c.cyan('›')} `);
67
+ const answer = await (0, ui_1.readlineAsk)(` ${ui_1.c.gold('?')} ${ui_1.c.bold('Path')} override ${ui_1.c.dim('(number · path · n skip)')}\n ${ui_1.c.ice('›')} `);
78
68
  if (!answer || /^n(o)?$/i.test(answer))
79
69
  return null;
80
70
  if (/^\d+$/.test(answer)) {
@@ -89,18 +79,18 @@ async function pickLayout(current) {
89
79
  const sample = '/v1/admin/baskets/{id}/lock';
90
80
  console.log('');
91
81
  console.log(` ${ui_1.c.bold('Folder order')} ${ui_1.c.dim('(company default)')}`);
92
- console.log(` ${ui_1.c.dim('sample')} ${ui_1.c.cyan(sample)}`);
82
+ console.log(` ${ui_1.c.dim('sample')} ${ui_1.c.ice(sample)}`);
93
83
  console.log('');
94
- console.log(` ${ui_1.c.cyan('1')} role → resource ${ui_1.c.dim('recommended')}`);
84
+ console.log(` ${ui_1.c.ice('1')} role → resource ${ui_1.c.dim('recommended')}`);
95
85
  console.log(` ${(0, config_edit_1.previewTree)(layoutSegments(sample, 'role-resource', true))}`);
96
86
  console.log(` ${ui_1.c.dim('v1 › admin › baskets (ops under baskets, not under {id})')}`);
97
87
  console.log('');
98
- console.log(` ${ui_1.c.cyan('2')} resource → role`);
88
+ console.log(` ${ui_1.c.ice('2')} resource → role`);
99
89
  console.log(` ${(0, config_edit_1.previewTree)(layoutSegments(sample, 'resource-role', true))}`);
100
90
  console.log(` ${ui_1.c.dim('v1 › baskets › admin')}`);
101
91
  console.log('');
102
- console.log(` ${ui_1.c.cyan('3')} keep ${ui_1.c.dim(`(${current})`)}`);
103
- const answer = await prompt(` ${ui_1.c.yellow('?')} Choose\n ${ui_1.c.cyan('›')} `);
92
+ console.log(` ${ui_1.c.ice('3')} keep ${ui_1.c.dim(`(${current})`)}`);
93
+ const answer = await (0, ui_1.readlineAsk)(` ${ui_1.c.gold('?')} Choose\n ${ui_1.c.ice('›')} `);
104
94
  if (!answer || answer === '3' || /^k(eep)?$/i.test(answer))
105
95
  return current;
106
96
  if (answer === '1' || /^role/i.test(answer))
@@ -112,11 +102,11 @@ async function pickLayout(current) {
112
102
  async function pickSkipParams(current) {
113
103
  console.log('');
114
104
  console.log(` ${ui_1.c.bold('Stop folders at path params')}`);
115
- console.log(` ${ui_1.c.dim('Avoid')} ${ui_1.c.cyan('{id}')} ${ui_1.c.dim('→ complete / lock / pay as nested folders')}`);
116
- console.log(` ${ui_1.c.cyan('1')} yes — fold under resource ${ui_1.c.dim('(recommended)')}`);
117
- console.log(` ${ui_1.c.cyan('2')} no — nest full path`);
118
- console.log(` ${ui_1.c.cyan('3')} keep ${ui_1.c.dim(`(${current ? 'yes' : 'no'})`)}`);
119
- const answer = await prompt(` ${ui_1.c.yellow('?')} Choose\n ${ui_1.c.cyan('›')} `);
105
+ console.log(` ${ui_1.c.dim('Avoid')} ${ui_1.c.ice('{id}')} ${ui_1.c.dim('→ complete / lock / pay as nested folders')}`);
106
+ console.log(` ${ui_1.c.ice('1')} yes — fold under resource ${ui_1.c.dim('(recommended)')}`);
107
+ console.log(` ${ui_1.c.ice('2')} no — nest full path`);
108
+ console.log(` ${ui_1.c.ice('3')} keep ${ui_1.c.dim(`(${current ? 'yes' : 'no'})`)}`);
109
+ const answer = await (0, ui_1.readlineAsk)(` ${ui_1.c.gold('?')} Choose\n ${ui_1.c.ice('›')} `);
120
110
  if (!answer || answer === '3' || /^k(eep)?$/i.test(answer))
121
111
  return current;
122
112
  if (answer === '1' || /^y/i.test(answer))
@@ -128,14 +118,14 @@ async function pickSkipParams(current) {
128
118
  async function pickExampleStyle(current) {
129
119
  console.log('');
130
120
  console.log(` ${ui_1.c.bold('Example / scenario labels')}`);
131
- console.log(` ${ui_1.c.cyan('1')} status-title-case`);
121
+ console.log(` ${ui_1.c.ice('1')} status-title-case`);
132
122
  console.log(` ${ui_1.c.dim('200 — Admin Find One Basket By Id API — returns basket when found')}`);
133
- console.log(` ${ui_1.c.cyan('2')} status-case`);
123
+ console.log(` ${ui_1.c.ice('2')} status-case`);
134
124
  console.log(` ${ui_1.c.dim('200 — returns basket when found')}`);
135
- console.log(` ${ui_1.c.cyan('3')} full`);
125
+ console.log(` ${ui_1.c.ice('3')} full`);
136
126
  console.log(` ${ui_1.c.dim('200 — Admin Find… API - GET /v1/admin/baskets/{id} POSITIVE CASES returns…')}`);
137
- console.log(` ${ui_1.c.cyan('4')} keep ${ui_1.c.dim(`(${current})`)}`);
138
- const answer = await prompt(` ${ui_1.c.yellow('?')} Choose\n ${ui_1.c.cyan('›')} `);
127
+ console.log(` ${ui_1.c.ice('4')} keep ${ui_1.c.dim(`(${current})`)}`);
128
+ const answer = await (0, ui_1.readlineAsk)(` ${ui_1.c.gold('?')} Choose\n ${ui_1.c.ice('›')} `);
139
129
  if (!answer || answer === '4' || /^k(eep)?$/i.test(answer))
140
130
  return current;
141
131
  if (answer === '1' || /title/i.test(answer))
@@ -159,12 +149,12 @@ function layoutChoicesFor(pathTemplate, layout, skipParams) {
159
149
  async function pickSegments(pathTemplate, layout, skipParams) {
160
150
  const choices = layoutChoicesFor(pathTemplate, layout, skipParams);
161
151
  console.log('');
162
- console.log(` ${ui_1.c.bold('Override')} ${ui_1.c.cyan(pathTemplate)}`);
152
+ console.log(` ${ui_1.c.bold('Override')} ${ui_1.c.ice(pathTemplate)}`);
163
153
  choices.forEach((choice, index) => {
164
- console.log(` ${ui_1.c.cyan(String(index + 1))} ${ui_1.c.bold(choice.label)}`);
154
+ console.log(` ${ui_1.c.ice(String(index + 1))} ${ui_1.c.bold(choice.label)}`);
165
155
  console.log(` ${(0, config_edit_1.previewTree)(choice.segments)}`);
166
156
  });
167
- const answer = await prompt(` ${ui_1.c.yellow('?')} Choose\n ${ui_1.c.cyan('›')} `);
157
+ const answer = await (0, ui_1.readlineAsk)(` ${ui_1.c.gold('?')} Choose\n ${ui_1.c.ice('›')} `);
168
158
  if (!answer || /^n(o)?$/i.test(answer))
169
159
  return null;
170
160
  const index = /^\d+$/.test(answer) ? Number(answer) - 1 : -1;
@@ -173,7 +163,7 @@ async function pickSegments(pathTemplate, layout, skipParams) {
173
163
  throw new Error(`Unknown choice: ${answer}`);
174
164
  if (selected.id !== 'custom')
175
165
  return selected.segments;
176
- const typed = await prompt(` ${ui_1.c.yellow('?')} Segments ${ui_1.c.dim('(space separated)')}\n ${ui_1.c.cyan('›')} `);
166
+ const typed = await (0, ui_1.readlineAsk)(` ${ui_1.c.gold('?')} Segments ${ui_1.c.dim('(space separated)')}\n ${ui_1.c.ice('›')} `);
177
167
  if (!typed)
178
168
  return null;
179
169
  return typed.split(/›|>|,|\s+/).map((part) => part.trim()).filter(Boolean);
@@ -195,7 +185,7 @@ async function runTreeWizard(options = {}) {
195
185
  (0, config_1.resetConfig)();
196
186
  const config = (0, config_1.getConfig)(true);
197
187
  console.log('');
198
- console.log(` ${ui_1.c.yellow(ui_1.c.bold('?'))} ${ui_1.c.bold('Docs presentation')} ${ui_1.c.dim('— sidebar + OpenAPI export')}`);
188
+ console.log(` ${ui_1.c.gold(ui_1.c.bold('?'))} ${ui_1.c.bold('Docs presentation')} ${ui_1.c.dim('— sidebar + OpenAPI export')}`);
199
189
  let layout = (0, config_1.normalizeTreeLayout)(options.layout === 'resource-first' || options.layout === 'resource-role'
200
190
  ? 'resource-role'
201
191
  : options.layout === 'url-order' || options.layout === 'role-resource'
@@ -204,17 +194,17 @@ async function runTreeWizard(options = {}) {
204
194
  if (!options.layout)
205
195
  layout = await pickLayout(layout);
206
196
  (0, config_edit_1.upsertConfigValue)(configPath, 'treeLayout', (0, config_edit_1.formatTsString)(layout));
207
- console.log(` ${ui_1.c.green('✔')} treeLayout → ${ui_1.c.cyan(layout)}`);
197
+ console.log(` ${ui_1.c.mint('✔')} treeLayout → ${ui_1.c.ice(layout)}`);
208
198
  const skipParams = await pickSkipParams(config.treeSkipParams !== false);
209
199
  (0, config_edit_1.upsertConfigValue)(configPath, 'treeSkipParams', skipParams ? 'true' : 'false');
210
- console.log(` ${ui_1.c.green('✔')} treeSkipParams → ${ui_1.c.cyan(String(skipParams))}`);
200
+ console.log(` ${ui_1.c.mint('✔')} treeSkipParams → ${ui_1.c.ice(String(skipParams))}`);
211
201
  const exampleStyle = await pickExampleStyle(config.exampleLabelStyle ?? 'status-title-case');
212
202
  (0, config_edit_1.upsertConfigValue)(configPath, 'exampleLabelStyle', (0, config_edit_1.formatTsString)(exampleStyle));
213
- console.log(` ${ui_1.c.green('✔')} exampleLabelStyle → ${ui_1.c.cyan(exampleStyle)}`);
203
+ console.log(` ${ui_1.c.mint('✔')} exampleLabelStyle → ${ui_1.c.ice(exampleStyle)}`);
214
204
  const customize = options.path
215
205
  ? 'y'
216
- : await prompt(` ${ui_1.c.yellow('?')} Per-path override now?\n` +
217
- ` ${ui_1.c.dim('Y')} yes · ${ui_1.c.dim('n')} later\n ${ui_1.c.cyan('›')} `);
206
+ : await (0, ui_1.readlineAsk)(` ${ui_1.c.gold('?')} Per-path override now?\n` +
207
+ ` ${ui_1.c.dim('Y')} yes · ${ui_1.c.dim('n')} later\n ${ui_1.c.ice('›')} `);
218
208
  if (customize && !/^n(o)?$/i.test(customize)) {
219
209
  const pathTemplate = await pickPath(options.path);
220
210
  if (pathTemplate) {
@@ -223,13 +213,13 @@ async function runTreeWizard(options = {}) {
223
213
  const overrides = (0, config_edit_1.readTreePathOverrides)();
224
214
  overrides[pathTemplate] = segments;
225
215
  (0, config_edit_1.upsertConfigValue)(configPath, 'treePathOverrides', (0, config_edit_1.formatTsStringRecord)(overrides));
226
- console.log(` ${ui_1.c.green('✔')} ${ui_1.c.cyan(pathTemplate)} → ${(0, config_edit_1.previewTree)(segments)}`);
216
+ console.log(` ${ui_1.c.mint('✔')} ${ui_1.c.ice(pathTemplate)} → ${(0, config_edit_1.previewTree)(segments)}`);
227
217
  }
228
218
  }
229
219
  }
230
220
  if (!options.embedded) {
231
221
  console.log(` ${ui_1.c.dim('saved')} ${configPath}`);
232
- console.log(` ${ui_1.c.dim('refresh')} ${ui_1.c.cyan('daxta build')}`);
222
+ console.log(` ${ui_1.c.dim('refresh')} ${ui_1.c.ice('daxta build')}`);
233
223
  console.log('');
234
224
  }
235
225
  }
package/dist/cli/ui.d.ts CHANGED
@@ -1,3 +1,12 @@
1
+ /** Viewer-adjacent palette: ice, gold, mint, stone. */
2
+ export declare const tone: {
3
+ ice: (t: string) => string;
4
+ gold: (t: string) => string;
5
+ mint: (t: string) => string;
6
+ rose: (t: string) => string;
7
+ mist: (t: string) => string;
8
+ paper: (t: string) => string;
9
+ };
1
10
  export declare const c: {
2
11
  bold: (t: string) => string;
3
12
  dim: (t: string) => string;
@@ -6,19 +15,30 @@ export declare const c: {
6
15
  yellow: (t: string) => string;
7
16
  magenta: (t: string) => string;
8
17
  red: (t: string) => string;
18
+ ice: (t: string) => string;
19
+ gold: (t: string) => string;
20
+ mint: (t: string) => string;
9
21
  };
10
22
  export declare function sleep(ms: number): Promise<void>;
23
+ export declare function divider(width?: number): void;
24
+ export declare function splash(options: {
25
+ version: string;
26
+ project: string;
27
+ dryRun?: boolean;
28
+ }): void;
11
29
  export declare function banner(title: string, subtitle?: string): void;
30
+ export declare function phase(index: number, total: number, label: string, hint?: string): void;
31
+ export declare function askLine(label: string, hint?: string): string;
32
+ export declare function readlineAsk(question: string): Promise<string>;
12
33
  export type StepResult = string | {
13
34
  summary: string;
14
35
  details?: string[];
15
36
  } | void;
16
- /**
17
- * Spinner while work runs → ✔ / ✖, optional detail lines, then a short pause to read.
18
- */
19
37
  export declare function step(label: string, work: () => StepResult | Promise<StepResult>, options?: {
20
38
  paceMs?: number;
21
39
  spinner?: boolean;
40
+ n?: number;
41
+ of?: number;
22
42
  }): Promise<void>;
23
43
  export declare function box(title: string, lines: string[]): void;
24
44
  export declare function nextSteps(lines: Array<{