nubos-pilot 0.2.0 → 0.2.2

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/bin/install.js CHANGED
@@ -192,9 +192,10 @@ async function _runInitQuestions(detectedRuntime, askUser, flags) {
192
192
  runtimes = [f.agent];
193
193
  } else {
194
194
  const labels = _runtimeSelectLabels();
195
+ const detectedIdx = Math.max(0, VALID_AGENTS.indexOf(detectedRuntime || 'claude'));
195
196
  const picked = (await askUser({ type: 'multiselect',
196
- question: yellow + 'Which runtime(s) would you like to install for?' + reset,
197
- options: labels, default: [(detectedRuntime || 'claude')] })).value;
197
+ question: 'Which runtime(s) would you like to install for?',
198
+ options: labels, default: [labels[detectedIdx]] })).value;
198
199
  runtimes = Array.isArray(picked) && picked.length && typeof picked[0] === 'string'
199
200
  && picked[0].includes('(')
200
201
  ? picked.map((label) => {
@@ -51,7 +51,7 @@ function _parseAnswer(type, rawLine, options, def) {
51
51
  }
52
52
  if (type === 'multiselect') {
53
53
  if (line === '' && def != null) return def;
54
- const parts = line.split(',').map((s) => s.trim()).filter(Boolean);
54
+ const parts = line.split(/[\s,]+/).map((s) => s.trim()).filter(Boolean);
55
55
  const picks = [];
56
56
  for (const p of parts) {
57
57
  const n = Number(p);
@@ -88,6 +88,41 @@ function _parseAnswer(type, rawLine, options, def) {
88
88
  );
89
89
  }
90
90
 
91
+ const NUBOS_BLUE = '\x1b[38;5;33m';
92
+ const ANSI_YELLOW = '\x1b[33m';
93
+ const ANSI_RESET = '\x1b[0m';
94
+
95
+ function _stripAnsi(s) {
96
+ return String(s).replace(/\x1b\[[0-9;]*m/g, '');
97
+ }
98
+
99
+ function _defaultDisplay(type, options, def) {
100
+ if (def == null) {
101
+ if (type === 'confirm') return '[y/n]';
102
+ return '';
103
+ }
104
+ if (type === 'confirm') {
105
+ if (def === true) return '[Y/n]';
106
+ if (def === false) return '[y/N]';
107
+ return '[y/n]';
108
+ }
109
+ if (type === 'select') {
110
+ if (options) {
111
+ const idx = options.indexOf(def);
112
+ if (idx >= 0) return '[' + (idx + 1) + ']';
113
+ }
114
+ return '[' + String(def) + ']';
115
+ }
116
+ if (type === 'multiselect') {
117
+ if (Array.isArray(def) && options) {
118
+ const idxs = def.map((v) => options.indexOf(v));
119
+ if (idxs.every((i) => i >= 0)) return '[' + idxs.map((i) => i + 1).join(',') + ']';
120
+ }
121
+ return '[' + (Array.isArray(def) ? def.join(',') : String(def)) + ']';
122
+ }
123
+ return '[' + String(def) + ']';
124
+ }
125
+
91
126
  async function askUserReadline({ type, question, options, def }) {
92
127
  const hasTTY = !!process.stdin.isTTY;
93
128
  if (!hasTTY && !_readlineImpl) {
@@ -98,20 +133,25 @@ async function askUserReadline({ type, question, options, def }) {
98
133
  { question },
99
134
  );
100
135
  }
101
- process.stderr.write(question + '\n');
136
+ process.stderr.write('\n');
137
+ process.stderr.write(' ' + ANSI_YELLOW + _stripAnsi(question) + ANSI_RESET + '\n');
138
+ process.stderr.write('\n');
102
139
  if (type === 'select' || type === 'multiselect') {
103
140
  if (options) {
104
141
  for (let i = 0; i < options.length; i++) {
105
- process.stderr.write(' ' + (i + 1) + ') ' + String(options[i]) + '\n');
142
+ process.stderr.write(
143
+ ' ' + NUBOS_BLUE + (i + 1) + ')' + ANSI_RESET + ' ' + String(options[i]) + '\n',
144
+ );
106
145
  }
107
146
  }
108
- if (type === 'multiselect') process.stderr.write('(comma-separated indices) ');
109
- else process.stderr.write('> ');
110
- } else if (type === 'confirm') {
111
- process.stderr.write('[y/n] ');
112
- } else {
113
- process.stderr.write('> ');
147
+ process.stderr.write('\n');
148
+ if (type === 'multiselect') {
149
+ process.stderr.write(' Select multiple: 1,2,6 or 1 2 6\n');
150
+ process.stderr.write('\n');
151
+ }
114
152
  }
153
+ const marker = _defaultDisplay(type, options, def);
154
+ process.stderr.write(' Choice' + (marker ? ' ' + marker : '') + ': ');
115
155
  const line = await _readOneLine();
116
156
  return { value: _parseAnswer(type, line, options, def), source: 'readline' };
117
157
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nubos-pilot",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "AI-driven planning and execution tool for code projects",
5
5
  "homepage": "https://github.com/Nubos-AI/nubos-pilot",
6
6
  "repository": {