Files
aitbc/dev/env/node_modules/enquirer/lib/prompts/toggle.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

110 lines
2.2 KiB
JavaScript
Executable File

'use strict';
const BooleanPrompt = require('../types/boolean');
class TogglePrompt extends BooleanPrompt {
async initialize() {
await super.initialize();
this.value = this.initial = this.resolve(this.options.initial);
this.disabled = this.options.disabled || 'no';
this.enabled = this.options.enabled || 'yes';
await this.render();
}
reset() {
this.value = this.initial;
this.render();
}
delete() {
this.alert();
}
toggle() {
this.value = !this.value;
this.render();
}
enable() {
if (this.value === true) return this.alert();
this.value = true;
this.render();
}
disable() {
if (this.value === false) return this.alert();
this.value = false;
this.render();
}
up() {
this.toggle();
}
down() {
this.toggle();
}
right() {
this.toggle();
}
left() {
this.toggle();
}
next() {
this.toggle();
}
prev() {
this.toggle();
}
dispatch(ch = '', key) {
switch (ch.toLowerCase()) {
case ' ':
return this.toggle();
case '1':
case 'y':
case 't':
return this.enable();
case '0':
case 'n':
case 'f':
return this.disable();
default: {
return this.alert();
}
}
}
format() {
let active = str => this.styles.primary.underline(str);
let value = [
this.value ? this.disabled : active(this.disabled),
this.value ? active(this.enabled) : this.enabled
];
return value.join(this.styles.muted(' / '));
}
async render() {
let { size } = this.state;
let header = await this.header();
let prefix = await this.prefix();
let separator = await this.separator();
let message = await this.message();
let output = await this.format();
let help = (await this.error()) || (await this.hint());
let footer = await this.footer();
let prompt = [prefix, message, separator, output].join(' ');
this.state.prompt = prompt;
if (help && !prompt.includes(help)) prompt += ' ' + help;
this.clear(size);
this.write([header, prompt, footer].filter(Boolean).join('\n'));
this.write(this.margin[2]);
this.restore();
}
}
module.exports = TogglePrompt;