vigthoria-cli 1.10.49 → 1.10.50
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/commands/agent-session-menu.js +101 -90
- package/package.json +1 -1
|
@@ -41,6 +41,40 @@ export function shouldShowAgentSessionMenu(options = {}) {
|
|
|
41
41
|
}
|
|
42
42
|
return Boolean(process.stdout.isTTY && process.stdin.isTTY);
|
|
43
43
|
}
|
|
44
|
+
async function promptSessionSettings(session) {
|
|
45
|
+
const settings = await inquirer.prompt([
|
|
46
|
+
{
|
|
47
|
+
type: 'confirm',
|
|
48
|
+
name: 'debugMode',
|
|
49
|
+
message: 'Enable debug mode (verbose logging)?',
|
|
50
|
+
default: session.debugMode,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
type: 'confirm',
|
|
54
|
+
name: 'autoSave',
|
|
55
|
+
message: 'Auto-save session on exit?',
|
|
56
|
+
default: session.autoSave,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
type: 'confirm',
|
|
60
|
+
name: 'autoApprove',
|
|
61
|
+
message: 'Auto-approve tool actions (dangerous)?',
|
|
62
|
+
default: session.autoApprove,
|
|
63
|
+
},
|
|
64
|
+
]);
|
|
65
|
+
Object.assign(session, settings);
|
|
66
|
+
}
|
|
67
|
+
async function confirmSettingsStep() {
|
|
68
|
+
const { configureSettings } = await inquirer.prompt([
|
|
69
|
+
{
|
|
70
|
+
type: 'confirm',
|
|
71
|
+
name: 'configureSettings',
|
|
72
|
+
message: 'Configure debug, auto-save and auto-approve now?',
|
|
73
|
+
default: false,
|
|
74
|
+
},
|
|
75
|
+
]);
|
|
76
|
+
return configureSettings;
|
|
77
|
+
}
|
|
44
78
|
export async function runAgentSessionMenu(defaults = {}) {
|
|
45
79
|
const session = {
|
|
46
80
|
workspacePath: path.resolve(String(defaults.workspacePath || process.cwd())),
|
|
@@ -48,102 +82,79 @@ export async function runAgentSessionMenu(defaults = {}) {
|
|
|
48
82
|
autoApprove: defaults.autoApprove === true,
|
|
49
83
|
autoSave: defaults.autoSave !== false,
|
|
50
84
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
85
|
+
console.log();
|
|
86
|
+
console.log(chalk.cyan('═══ Agent Session Setup ═══'));
|
|
87
|
+
console.log(chalk.gray(`Workspace: ${session.workspacePath}`));
|
|
88
|
+
console.log(chalk.gray(`Debug: ${session.debugMode ? 'on' : 'off'} | Auto-approve: ${session.autoApprove ? 'on' : 'off'} | Auto-save: ${session.autoSave ? 'on' : 'off'}`));
|
|
89
|
+
console.log();
|
|
90
|
+
const { action } = await inquirer.prompt([
|
|
91
|
+
{
|
|
92
|
+
type: 'list',
|
|
93
|
+
name: 'action',
|
|
94
|
+
message: 'Configure your session',
|
|
95
|
+
choices: [
|
|
96
|
+
{ name: 'Start session with current settings', value: 'start' },
|
|
97
|
+
{ name: 'Set workspace path (existing directory)', value: 'set-workspace' },
|
|
98
|
+
{ name: 'Create new directory and set as workspace', value: 'create-workspace' },
|
|
99
|
+
{ name: 'Session settings (debug, auto-save, auto-approve)', value: 'settings' },
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
]);
|
|
103
|
+
if (action === 'set-workspace') {
|
|
104
|
+
const { workspacePath } = await inquirer.prompt([
|
|
67
105
|
{
|
|
68
|
-
type: '
|
|
69
|
-
name: '
|
|
70
|
-
message: '
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
{ name: 'Create new directory and set as workspace', value: 'create-workspace' },
|
|
74
|
-
{ name: 'Session settings (debug, auto-save, auto-approve)', value: 'settings' },
|
|
75
|
-
{ name: 'Start session with current settings', value: 'start' },
|
|
76
|
-
],
|
|
106
|
+
type: 'input',
|
|
107
|
+
name: 'workspacePath',
|
|
108
|
+
message: 'Workspace directory path:',
|
|
109
|
+
default: session.workspacePath,
|
|
110
|
+
validate: validateExistingDirectory,
|
|
77
111
|
},
|
|
78
112
|
]);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
type: 'input',
|
|
83
|
-
name: 'workspacePath',
|
|
84
|
-
message: 'Workspace directory path:',
|
|
85
|
-
default: session.workspacePath,
|
|
86
|
-
validate: validateExistingDirectory,
|
|
87
|
-
},
|
|
88
|
-
]);
|
|
89
|
-
session.workspacePath = path.resolve(workspacePath);
|
|
113
|
+
session.workspacePath = path.resolve(workspacePath);
|
|
114
|
+
if (await confirmSettingsStep()) {
|
|
115
|
+
await promptSessionSettings(session);
|
|
90
116
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
},
|
|
115
|
-
]);
|
|
116
|
-
const target = path.join(path.resolve(basePath), String(folderName).trim());
|
|
117
|
-
fs.mkdirSync(target, { recursive: true });
|
|
118
|
-
session.workspacePath = target;
|
|
119
|
-
console.log(chalk.green(`Created workspace: ${target}`));
|
|
120
|
-
}
|
|
121
|
-
else if (action === 'settings') {
|
|
122
|
-
const settings = await inquirer.prompt([
|
|
123
|
-
{
|
|
124
|
-
type: 'confirm',
|
|
125
|
-
name: 'debugMode',
|
|
126
|
-
message: 'Enable debug mode (verbose logging)?',
|
|
127
|
-
default: session.debugMode,
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
type: 'confirm',
|
|
131
|
-
name: 'autoSave',
|
|
132
|
-
message: 'Auto-save session on exit?',
|
|
133
|
-
default: session.autoSave,
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
type: 'confirm',
|
|
137
|
-
name: 'autoApprove',
|
|
138
|
-
message: 'Auto-approve tool actions (dangerous)?',
|
|
139
|
-
default: session.autoApprove,
|
|
117
|
+
}
|
|
118
|
+
else if (action === 'create-workspace') {
|
|
119
|
+
const { basePath, folderName } = await inquirer.prompt([
|
|
120
|
+
{
|
|
121
|
+
type: 'input',
|
|
122
|
+
name: 'basePath',
|
|
123
|
+
message: 'Base directory:',
|
|
124
|
+
default: os.homedir(),
|
|
125
|
+
validate: validateExistingDirectory,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
type: 'input',
|
|
129
|
+
name: 'folderName',
|
|
130
|
+
message: 'New folder name:',
|
|
131
|
+
validate: (value) => {
|
|
132
|
+
const trimmed = String(value || '').trim();
|
|
133
|
+
if (!trimmed) {
|
|
134
|
+
return 'Folder name is required.';
|
|
135
|
+
}
|
|
136
|
+
if (/[<>:"|?*\x00]/.test(trimmed)) {
|
|
137
|
+
return 'Folder name contains invalid characters.';
|
|
138
|
+
}
|
|
139
|
+
return true;
|
|
140
140
|
},
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
141
|
+
},
|
|
142
|
+
]);
|
|
143
|
+
const target = path.join(path.resolve(basePath), String(folderName).trim());
|
|
144
|
+
fs.mkdirSync(target, { recursive: true });
|
|
145
|
+
session.workspacePath = target;
|
|
146
|
+
console.log(chalk.green(`Created workspace: ${target}`));
|
|
147
|
+
if (await confirmSettingsStep()) {
|
|
148
|
+
await promptSessionSettings(session);
|
|
146
149
|
}
|
|
147
150
|
}
|
|
151
|
+
else if (action === 'settings') {
|
|
152
|
+
await promptSessionSettings(session);
|
|
153
|
+
}
|
|
154
|
+
console.log();
|
|
155
|
+
console.log(chalk.cyan('── Session ready ──'));
|
|
156
|
+
console.log(chalk.gray(`Workspace: ${session.workspacePath}`));
|
|
157
|
+
console.log(chalk.gray(`Debug: ${session.debugMode ? 'on' : 'off'} | Auto-approve: ${session.autoApprove ? 'on' : 'off'} | Auto-save: ${session.autoSave ? 'on' : 'off'}`));
|
|
158
|
+
console.log();
|
|
148
159
|
return session;
|
|
149
160
|
}
|