Files
aitbc/dev/env/node_modules/enquirer/lib/prompts/editable.js
aitbc 816e258d4c refactor: move brother_node development artifact to dev/test-nodes subdirectory
Development Artifact Cleanup:
 BROTHER_NODE REORGANIZATION: Moved development test node to appropriate location
- dev/test-nodes/brother_node/: Moved from root directory for better organization
- Contains development configuration, test logs, and test chain data
- No impact on production systems - purely development/testing artifact

 DEVELOPMENT ARTIFACTS IDENTIFIED:
- Chain ID: aitbc-brother-chain (test/development chain)
- Ports: 8010 (P2P) and 8011 (RPC) - different from production
- Environment: .env file with test configuration
- Logs: rpc.log and node.log from development testing session (March 15, 2026)

 ROOT DIRECTORY CLEANUP: Removed development clutter from production directory
- brother_node/ moved to dev/test-nodes/brother_node/
- Root directory now contains only production-ready components
- Development artifacts properly organized in dev/ subdirectory

DIRECTORY STRUCTURE IMPROVEMENT:
📁 dev/test-nodes/: Development and testing node configurations
🏗️ Root Directory: Clean production structure with only essential components
🧪 Development Isolation: Test environments separated from production

BENEFITS:
 Clean Production Directory: No development artifacts in root
 Better Organization: Development nodes grouped in dev/ subdirectory
 Clear Separation: Production vs development environments clearly distinguished
 Maintainability: Easier to identify and manage development components

RESULT: Successfully moved brother_node development artifact to dev/test-nodes/ subdirectory, cleaning up the root directory while preserving development testing environment for future use.
2026-03-30 17:09:06 +02:00

137 lines
3.1 KiB
JavaScript
Executable File

'use strict';
const Select = require('./select');
const Form = require('./form');
const form = Form.prototype;
class Editable extends Select {
constructor(options) {
super({ ...options, multiple: true });
this.align = [this.options.align, 'left'].find(v => v != null);
this.emptyError = '';
this.values = {};
}
dispatch(char, key) {
let choice = this.focused;
let parent = choice.parent || {};
if (!choice.editable && !parent.editable) {
if (char === 'a' || char === 'i') return super[char]();
}
return form.dispatch.call(this, char, key);
}
append(char, key) {
return form.append.call(this, char, key);
}
delete(char, key) {
return form.delete.call(this, char, key);
}
space(char) {
return this.focused.editable ? this.append(char) : super.space();
}
number(char) {
return this.focused.editable ? this.append(char) : super.number(char);
}
next() {
return this.focused.editable ? form.next.call(this) : super.next();
}
prev() {
return this.focused.editable ? form.prev.call(this) : super.prev();
}
async indicator(choice, i) {
let symbol = choice.indicator || '';
let value = choice.editable ? symbol : super.indicator(choice, i);
return await this.resolve(value, this.state, choice, i) || '';
}
indent(choice) {
return choice.role === 'heading' ? '' : (choice.editable ? ' ' : ' ');
}
async renderChoice(choice, i) {
choice.indent = '';
if (choice.editable) return form.renderChoice.call(this, choice, i);
return super.renderChoice(choice, i);
}
error() {
return '';
}
footer() {
return this.state.error;
}
async validate() {
let result = true;
for (let choice of this.choices) {
if (typeof choice.validate !== 'function') {
continue;
}
if (choice.role === 'heading') {
continue;
}
let val = choice.parent ? this.value[choice.parent.name] : this.value;
if (choice.editable) {
val = choice.value === choice.name ? choice.initial || '' : choice.value;
} else if (!this.isDisabled(choice)) {
val = choice.enabled === true;
}
result = await choice.validate(val, this.state);
if (result !== true) {
break;
}
}
if (result !== true) {
this.state.error = typeof result === 'string' ? result : 'Invalid Input';
}
return result;
}
submit() {
if (this.focused.newChoice === true) return super.submit();
if (this.choices.some(ch => ch.newChoice)) {
return this.alert();
}
this.value = {};
for (let choice of this.choices) {
let val = choice.parent ? this.value[choice.parent.name] : this.value;
if (choice.role === 'heading') {
this.value[choice.name] = {};
continue;
}
if (choice.editable) {
val[choice.name] = choice.value === choice.name
? (choice.initial || '')
: choice.value;
} else if (!this.isDisabled(choice)) {
val[choice.name] = choice.enabled === true;
}
}
return this.base.submit.call(this);
}
}
module.exports = Editable;