@arcteninc/core 0.0.175 → 0.0.177
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/README.md +73 -78
- package/dist/index.cjs +3 -16
- package/dist/index.d.ts +1 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +856 -8408
- package/dist/lib/useAgent.d.ts +1 -2
- package/dist/lib/useAgent.d.ts.map +1 -1
- package/dist/types/use-agent.d.ts +3 -44
- package/dist/types/use-agent.d.ts.map +1 -1
- package/dist/utils/extract-tool-metadata.d.ts.map +1 -1
- package/package.json +7 -46
- package/scripts/arcten-cli.cjs +14 -108
- package/scripts/cli-extract-types-auto.ts +22 -4
- package/scripts/update-core.cjs +124 -0
- package/dist/components/ArctenAgent.d.ts +0 -52
- package/dist/components/ArctenAgent.d.ts.map +0 -1
- package/dist/components/ai-elements/prompt-input.d.ts +0 -187
- package/dist/components/ai-elements/prompt-input.d.ts.map +0 -1
- package/dist/components/ai-elements/reasoning.d.ts +0 -17
- package/dist/components/ai-elements/reasoning.d.ts.map +0 -1
- package/dist/components/ai-elements/response.d.ts +0 -8
- package/dist/components/ai-elements/response.d.ts.map +0 -1
- package/dist/components/ai-elements/shimmer.d.ts +0 -10
- package/dist/components/ai-elements/shimmer.d.ts.map +0 -1
- package/dist/components/citation-button.d.ts +0 -14
- package/dist/components/citation-button.d.ts.map +0 -1
- package/dist/components/citation-text-renderer.d.ts +0 -31
- package/dist/components/citation-text-renderer.d.ts.map +0 -1
- package/dist/components/secure-modals/EmailModal.d.ts +0 -10
- package/dist/components/secure-modals/EmailModal.d.ts.map +0 -1
- package/dist/components/secure-modals/FormModal.d.ts +0 -20
- package/dist/components/secure-modals/FormModal.d.ts.map +0 -1
- package/dist/components/secure-modals/PasswordModal.d.ts +0 -10
- package/dist/components/secure-modals/PasswordModal.d.ts.map +0 -1
- package/dist/components/secure-modals/PhoneModal.d.ts +0 -10
- package/dist/components/secure-modals/PhoneModal.d.ts.map +0 -1
- package/dist/components/secure-modals/PinModal.d.ts +0 -11
- package/dist/components/secure-modals/PinModal.d.ts.map +0 -1
- package/dist/components/secure-modals/SecureModalProvider.d.ts +0 -13
- package/dist/components/secure-modals/SecureModalProvider.d.ts.map +0 -1
- package/dist/components/secure-modals/TextModal.d.ts +0 -11
- package/dist/components/secure-modals/TextModal.d.ts.map +0 -1
- package/dist/components/secure-modals/index.d.ts +0 -10
- package/dist/components/secure-modals/index.d.ts.map +0 -1
- package/dist/components/secure-modals/types.d.ts +0 -34
- package/dist/components/secure-modals/types.d.ts.map +0 -1
- package/dist/components/tool-call-approval.d.ts +0 -9
- package/dist/components/tool-call-approval.d.ts.map +0 -1
- package/dist/components/tool-call-result.d.ts +0 -8
- package/dist/components/tool-call-result.d.ts.map +0 -1
- package/dist/components/ui/autotextarea.d.ts +0 -19
- package/dist/components/ui/autotextarea.d.ts.map +0 -1
- package/dist/components/ui/badge.d.ts +0 -10
- package/dist/components/ui/badge.d.ts.map +0 -1
- package/dist/components/ui/button.d.ts +0 -14
- package/dist/components/ui/button.d.ts.map +0 -1
- package/dist/components/ui/collapsible.d.ts +0 -6
- package/dist/components/ui/collapsible.d.ts.map +0 -1
- package/dist/components/ui/command.d.ts +0 -19
- package/dist/components/ui/command.d.ts.map +0 -1
- package/dist/components/ui/dialog.d.ts +0 -16
- package/dist/components/ui/dialog.d.ts.map +0 -1
- package/dist/components/ui/dropdown-menu.d.ts +0 -26
- package/dist/components/ui/dropdown-menu.d.ts.map +0 -1
- package/dist/components/ui/hover-card.d.ts +0 -7
- package/dist/components/ui/hover-card.d.ts.map +0 -1
- package/dist/components/ui/input-group.d.ts +0 -17
- package/dist/components/ui/input-group.d.ts.map +0 -1
- package/dist/components/ui/input.d.ts +0 -4
- package/dist/components/ui/input.d.ts.map +0 -1
- package/dist/components/ui/kbd.d.ts +0 -4
- package/dist/components/ui/kbd.d.ts.map +0 -1
- package/dist/components/ui/select.d.ts +0 -16
- package/dist/components/ui/select.d.ts.map +0 -1
- package/dist/components/ui/textarea.d.ts +0 -4
- package/dist/components/ui/textarea.d.ts.map +0 -1
- package/dist/components/ui/tooltip.d.ts +0 -8
- package/dist/components/ui/tooltip.d.ts.map +0 -1
- package/dist/core.css +0 -1
- package/dist/utils/form-generator.d.ts +0 -29
- package/dist/utils/form-generator.d.ts.map +0 -1
- package/dist/utils/secure-param-detector.d.ts +0 -26
- package/dist/utils/secure-param-detector.d.ts.map +0 -1
- package/scripts/cli-agent-inject.ts +0 -205
- package/scripts/cli-agent-wrapper.cjs +0 -51
- package/scripts/cli-agent.ts +0 -483
- package/scripts/cli-create-project.ts +0 -608
- package/scripts/cli-create-wrapper.cjs +0 -60
- package/scripts/cli-init-wizard-wrapper.cjs +0 -58
- package/scripts/cli-init-wizard.ts +0 -646
- package/scripts/cli-prompt-wrapper.cjs +0 -51
- package/scripts/cli-prompt.ts +0 -306
- package/scripts/cli-sync-wrapper.cjs +0 -69
- package/scripts/cli-sync.ts +0 -915
- package/scripts/cli-tools-wrapper.cjs +0 -51
- package/scripts/cli-tools.ts +0 -320
- package/scripts/cli-uninstall-wrapper.cjs +0 -66
- package/scripts/cli-uninstall.ts +0 -173
- package/scripts/config-parser.ts +0 -432
- package/scripts/dashboard-sync.ts +0 -454
- package/scripts/tree-sitter-discover.ts +0 -526
- package/scripts/wasm/tree-sitter-tsx.wasm +0 -0
- package/scripts/wasm/tree-sitter-typescript.wasm +0 -0
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Wrapper script for cli-tools.ts
|
|
4
|
-
* Handles TypeScript execution via tsx or ts-node
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
const { spawn, execSync } = require('child_process');
|
|
8
|
-
const path = require('path');
|
|
9
|
-
const fs = require('fs');
|
|
10
|
-
|
|
11
|
-
const scriptPath = path.join(__dirname, 'cli-tools.ts');
|
|
12
|
-
|
|
13
|
-
// Check if script exists
|
|
14
|
-
if (!fs.existsSync(scriptPath)) {
|
|
15
|
-
console.error(`❌ Script not found: ${scriptPath}`);
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Try tsx first (faster), then ts-node, then bun
|
|
20
|
-
const runners = [
|
|
21
|
-
{ cmd: 'tsx', args: [scriptPath, ...process.argv.slice(2)] },
|
|
22
|
-
{ cmd: 'npx', args: ['tsx', scriptPath, ...process.argv.slice(2)] },
|
|
23
|
-
{ cmd: 'bun', args: ['run', scriptPath, ...process.argv.slice(2)] },
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
function tryRunner(index) {
|
|
27
|
-
if (index >= runners.length) {
|
|
28
|
-
console.error('❌ Could not find a TypeScript runner (tsx, ts-node, or bun)');
|
|
29
|
-
console.error(' Install tsx: npm install -g tsx');
|
|
30
|
-
process.exit(1);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const { cmd, args } = runners[index];
|
|
34
|
-
|
|
35
|
-
const child = spawn(cmd, args, {
|
|
36
|
-
stdio: 'inherit',
|
|
37
|
-
cwd: process.cwd(),
|
|
38
|
-
shell: process.platform === 'win32',
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
child.on('error', () => {
|
|
42
|
-
// Try next runner
|
|
43
|
-
tryRunner(index + 1);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
child.on('exit', (code) => {
|
|
47
|
-
process.exit(code || 0);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
tryRunner(0);
|
package/scripts/cli-tools.ts
DELETED
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env tsx
|
|
2
|
-
/**
|
|
3
|
-
* arcten tools - Interactive tool classification
|
|
4
|
-
*
|
|
5
|
-
* Usage:
|
|
6
|
-
* arcten tools # Interactive AI chat for reclassification
|
|
7
|
-
* arcten tools --list # Show current safe/sensitive classification
|
|
8
|
-
* arcten tools --reset # Re-run pattern-based classification
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import * as fs from "fs";
|
|
12
|
-
import * as path from "path";
|
|
13
|
-
import * as readline from "readline";
|
|
14
|
-
|
|
15
|
-
// Classification patterns (fallback when no AI)
|
|
16
|
-
const safePatterns = /^(get|list|search|find|fetch|load|calculate|count|query|read)/i;
|
|
17
|
-
const sensitivePatterns = /^(create|update|delete|remove|set|add|modify|insert|patch|put|post|reset|regenerate|change|batch)/i;
|
|
18
|
-
const sensitiveReads = /^(get|fetch).*(api.?key|credential|secret|password|token|auth)/i;
|
|
19
|
-
|
|
20
|
-
interface SyncState {
|
|
21
|
-
lastSync: string;
|
|
22
|
-
toolsFile: string;
|
|
23
|
-
functions: Record<string, { classification: "safe" | "sensitive" }>;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function findProjectRoot(): string {
|
|
27
|
-
let dir = process.cwd();
|
|
28
|
-
while (dir !== path.dirname(dir)) {
|
|
29
|
-
if (fs.existsSync(path.join(dir, "package.json"))) {
|
|
30
|
-
return dir;
|
|
31
|
-
}
|
|
32
|
-
dir = path.dirname(dir);
|
|
33
|
-
}
|
|
34
|
-
return process.cwd();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function readSyncState(projectRoot: string): SyncState | null {
|
|
38
|
-
const syncStatePath = path.join(projectRoot, ".arcten", "sync-state.json");
|
|
39
|
-
if (!fs.existsSync(syncStatePath)) {
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
try {
|
|
43
|
-
const content = fs.readFileSync(syncStatePath, "utf-8");
|
|
44
|
-
const parsed = JSON.parse(content);
|
|
45
|
-
if (!parsed.functions || typeof parsed.functions !== "object") {
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
return parsed;
|
|
49
|
-
} catch {
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function writeSyncState(projectRoot: string, state: SyncState): void {
|
|
55
|
-
const arctenDir = path.join(projectRoot, ".arcten");
|
|
56
|
-
if (!fs.existsSync(arctenDir)) {
|
|
57
|
-
fs.mkdirSync(arctenDir, { recursive: true });
|
|
58
|
-
}
|
|
59
|
-
const syncStatePath = path.join(arctenDir, "sync-state.json");
|
|
60
|
-
fs.writeFileSync(syncStatePath, JSON.stringify(state, null, 2));
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function classifyByPattern(name: string): "safe" | "sensitive" {
|
|
64
|
-
// Sensitive reads take priority
|
|
65
|
-
if (sensitiveReads.test(name)) return "sensitive";
|
|
66
|
-
// Then check for sensitive action patterns
|
|
67
|
-
if (sensitivePatterns.test(name)) return "sensitive";
|
|
68
|
-
// Then check for safe read patterns
|
|
69
|
-
if (safePatterns.test(name)) return "safe";
|
|
70
|
-
// Default to sensitive (fail-safe)
|
|
71
|
-
return "sensitive";
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function listClassifications(state: SyncState): void {
|
|
75
|
-
const safeTools: string[] = [];
|
|
76
|
-
const sensitiveTools: string[] = [];
|
|
77
|
-
|
|
78
|
-
for (const [name, data] of Object.entries(state.functions)) {
|
|
79
|
-
if (data.classification === "safe") {
|
|
80
|
-
safeTools.push(name);
|
|
81
|
-
} else {
|
|
82
|
-
sensitiveTools.push(name);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
console.log("\n📋 Tool Classifications\n");
|
|
87
|
-
console.log(`Source: ${state.toolsFile}`);
|
|
88
|
-
console.log(`Last sync: ${state.lastSync}\n`);
|
|
89
|
-
|
|
90
|
-
console.log(`✅ Safe (${safeTools.length}) - auto-execute without approval:`);
|
|
91
|
-
if (safeTools.length === 0) {
|
|
92
|
-
console.log(" (none)");
|
|
93
|
-
} else {
|
|
94
|
-
safeTools.sort().forEach((name) => console.log(` • ${name}`));
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
console.log(`\n⚠️ Sensitive (${sensitiveTools.length}) - require user approval:`);
|
|
98
|
-
if (sensitiveTools.length === 0) {
|
|
99
|
-
console.log(" (none)");
|
|
100
|
-
} else {
|
|
101
|
-
sensitiveTools.sort().forEach((name) => console.log(` • ${name}`));
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
console.log(`\nTotal: ${safeTools.length + sensitiveTools.length} tools`);
|
|
105
|
-
console.log("\nTo change classifications, run: arcten tools");
|
|
106
|
-
console.log("After changes, run: arcten sync");
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
function resetClassifications(state: SyncState): SyncState {
|
|
110
|
-
console.log("\n🔄 Resetting classifications using pattern matching...\n");
|
|
111
|
-
|
|
112
|
-
const newFunctions: Record<string, { classification: "safe" | "sensitive" }> = {};
|
|
113
|
-
let safeCount = 0;
|
|
114
|
-
let sensitiveCount = 0;
|
|
115
|
-
|
|
116
|
-
for (const name of Object.keys(state.functions)) {
|
|
117
|
-
const classification = classifyByPattern(name);
|
|
118
|
-
newFunctions[name] = { classification };
|
|
119
|
-
if (classification === "safe") {
|
|
120
|
-
safeCount++;
|
|
121
|
-
} else {
|
|
122
|
-
sensitiveCount++;
|
|
123
|
-
}
|
|
124
|
-
console.log(` ${classification === "safe" ? "✅" : "⚠️"} ${name} → ${classification}`);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
console.log(`\nReset complete: ${safeCount} safe, ${sensitiveCount} sensitive`);
|
|
128
|
-
|
|
129
|
-
return {
|
|
130
|
-
...state,
|
|
131
|
-
functions: newFunctions,
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
async function interactiveClassification(projectRoot: string, state: SyncState): Promise<void> {
|
|
136
|
-
const rl = readline.createInterface({
|
|
137
|
-
input: process.stdin,
|
|
138
|
-
output: process.stdout,
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
const ask = (question: string): Promise<string> => {
|
|
142
|
-
return new Promise((resolve) => {
|
|
143
|
-
rl.question(question, (answer) => {
|
|
144
|
-
resolve(answer.trim());
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
console.log("\n🔧 Interactive Tool Classification\n");
|
|
150
|
-
console.log("Commands:");
|
|
151
|
-
console.log(" list Show all classifications");
|
|
152
|
-
console.log(" safe <tool> Mark tool as safe (auto-execute)");
|
|
153
|
-
console.log(" sensitive <tool> Mark tool as sensitive (requires approval)");
|
|
154
|
-
console.log(" safe <tool1> <tool2> Mark multiple tools as safe");
|
|
155
|
-
console.log(" find <pattern> Find tools matching pattern");
|
|
156
|
-
console.log(" reset Reset all to pattern-based classification");
|
|
157
|
-
console.log(" save Save changes and exit");
|
|
158
|
-
console.log(" quit Exit without saving");
|
|
159
|
-
console.log("");
|
|
160
|
-
|
|
161
|
-
let modified = false;
|
|
162
|
-
let currentState = { ...state };
|
|
163
|
-
|
|
164
|
-
while (true) {
|
|
165
|
-
const input = await ask("\n> ");
|
|
166
|
-
const parts = input.split(/\s+/);
|
|
167
|
-
const command = parts[0]?.toLowerCase();
|
|
168
|
-
|
|
169
|
-
if (!command) continue;
|
|
170
|
-
|
|
171
|
-
if (command === "quit" || command === "exit" || command === "q") {
|
|
172
|
-
if (modified) {
|
|
173
|
-
const confirm = await ask("You have unsaved changes. Quit anyway? (y/n): ");
|
|
174
|
-
if (confirm.toLowerCase() !== "y") continue;
|
|
175
|
-
}
|
|
176
|
-
console.log("Exiting without saving.");
|
|
177
|
-
rl.close();
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
if (command === "save") {
|
|
182
|
-
if (!modified) {
|
|
183
|
-
console.log("No changes to save.");
|
|
184
|
-
} else {
|
|
185
|
-
writeSyncState(projectRoot, currentState);
|
|
186
|
-
console.log("✅ Changes saved to .arcten/sync-state.json");
|
|
187
|
-
console.log(" Run 'arcten sync' to regenerate arcten.tools.ts and sync to dashboard.");
|
|
188
|
-
}
|
|
189
|
-
rl.close();
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
if (command === "list" || command === "ls") {
|
|
194
|
-
listClassifications(currentState);
|
|
195
|
-
continue;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
if (command === "reset") {
|
|
199
|
-
currentState = resetClassifications(currentState);
|
|
200
|
-
modified = true;
|
|
201
|
-
continue;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
if (command === "find" || command === "search") {
|
|
205
|
-
const pattern = parts.slice(1).join(" ").toLowerCase();
|
|
206
|
-
if (!pattern) {
|
|
207
|
-
console.log("Usage: find <pattern>");
|
|
208
|
-
continue;
|
|
209
|
-
}
|
|
210
|
-
const matches = Object.entries(currentState.functions)
|
|
211
|
-
.filter(([name]) => name.toLowerCase().includes(pattern))
|
|
212
|
-
.map(([name, data]) => ` ${data.classification === "safe" ? "✅" : "⚠️"} ${name}`);
|
|
213
|
-
if (matches.length === 0) {
|
|
214
|
-
console.log(`No tools matching "${pattern}"`);
|
|
215
|
-
} else {
|
|
216
|
-
console.log(`Found ${matches.length} tools:`);
|
|
217
|
-
matches.forEach((m) => console.log(m));
|
|
218
|
-
}
|
|
219
|
-
continue;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
if (command === "safe" || command === "sensitive") {
|
|
223
|
-
const toolNames = parts.slice(1);
|
|
224
|
-
if (toolNames.length === 0) {
|
|
225
|
-
console.log(`Usage: ${command} <tool1> [tool2] ...`);
|
|
226
|
-
continue;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
const classification = command as "safe" | "sensitive";
|
|
230
|
-
let changed = 0;
|
|
231
|
-
|
|
232
|
-
for (const toolName of toolNames) {
|
|
233
|
-
// Find exact match or partial match
|
|
234
|
-
const exactMatch = Object.keys(currentState.functions).find(
|
|
235
|
-
(name) => name.toLowerCase() === toolName.toLowerCase()
|
|
236
|
-
);
|
|
237
|
-
const partialMatches = Object.keys(currentState.functions).filter(
|
|
238
|
-
(name) => name.toLowerCase().includes(toolName.toLowerCase())
|
|
239
|
-
);
|
|
240
|
-
|
|
241
|
-
if (exactMatch) {
|
|
242
|
-
if (currentState.functions[exactMatch].classification !== classification) {
|
|
243
|
-
currentState.functions[exactMatch].classification = classification;
|
|
244
|
-
console.log(` ${classification === "safe" ? "✅" : "⚠️"} ${exactMatch} → ${classification}`);
|
|
245
|
-
changed++;
|
|
246
|
-
modified = true;
|
|
247
|
-
} else {
|
|
248
|
-
console.log(` ⏭️ ${exactMatch} already ${classification}`);
|
|
249
|
-
}
|
|
250
|
-
} else if (partialMatches.length === 1) {
|
|
251
|
-
const match = partialMatches[0];
|
|
252
|
-
if (currentState.functions[match].classification !== classification) {
|
|
253
|
-
currentState.functions[match].classification = classification;
|
|
254
|
-
console.log(` ${classification === "safe" ? "✅" : "⚠️"} ${match} → ${classification}`);
|
|
255
|
-
changed++;
|
|
256
|
-
modified = true;
|
|
257
|
-
} else {
|
|
258
|
-
console.log(` ⏭️ ${match} already ${classification}`);
|
|
259
|
-
}
|
|
260
|
-
} else if (partialMatches.length > 1) {
|
|
261
|
-
console.log(` ❓ "${toolName}" matches multiple tools:`);
|
|
262
|
-
partialMatches.slice(0, 5).forEach((m) => console.log(` • ${m}`));
|
|
263
|
-
if (partialMatches.length > 5) {
|
|
264
|
-
console.log(` ... and ${partialMatches.length - 5} more`);
|
|
265
|
-
}
|
|
266
|
-
} else {
|
|
267
|
-
console.log(` ❌ Tool not found: ${toolName}`);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
if (changed > 0) {
|
|
272
|
-
console.log(`\nChanged ${changed} tool(s). Use 'save' to persist changes.`);
|
|
273
|
-
}
|
|
274
|
-
continue;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
console.log(`Unknown command: ${command}`);
|
|
278
|
-
console.log("Type 'list', 'safe <tool>', 'sensitive <tool>', 'save', or 'quit'");
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
async function main(): Promise<void> {
|
|
283
|
-
const args = process.argv.slice(2);
|
|
284
|
-
const showList = args.includes("--list") || args.includes("-l");
|
|
285
|
-
const doReset = args.includes("--reset") || args.includes("-r");
|
|
286
|
-
|
|
287
|
-
const projectRoot = findProjectRoot();
|
|
288
|
-
const state = readSyncState(projectRoot);
|
|
289
|
-
|
|
290
|
-
if (!state) {
|
|
291
|
-
console.error("❌ No sync state found. Run 'arcten init' or 'arcten sync' first.");
|
|
292
|
-
process.exit(1);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
if (Object.keys(state.functions).length === 0) {
|
|
296
|
-
console.error("❌ No tools found in sync state. Run 'arcten sync' to discover tools.");
|
|
297
|
-
process.exit(1);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
if (showList) {
|
|
301
|
-
listClassifications(state);
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
if (doReset) {
|
|
306
|
-
const newState = resetClassifications(state);
|
|
307
|
-
writeSyncState(projectRoot, newState);
|
|
308
|
-
console.log("\n✅ Classifications saved to .arcten/sync-state.json");
|
|
309
|
-
console.log(" Run 'arcten sync' to regenerate arcten.tools.ts and sync to dashboard.");
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
// Interactive mode
|
|
314
|
-
await interactiveClassification(projectRoot, state);
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
main().catch((error) => {
|
|
318
|
-
console.error("❌ Error:", error.message);
|
|
319
|
-
process.exit(1);
|
|
320
|
-
});
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Wrapper script for cli-uninstall.ts
|
|
4
|
-
* Handles TypeScript execution using available runtime
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
const { spawn } = require('child_process');
|
|
8
|
-
const path = require('path');
|
|
9
|
-
const fs = require('fs');
|
|
10
|
-
|
|
11
|
-
function main() {
|
|
12
|
-
const scriptPath = path.join(__dirname, 'cli-uninstall.ts');
|
|
13
|
-
|
|
14
|
-
if (!fs.existsSync(scriptPath)) {
|
|
15
|
-
console.error(`❌ Script not found: ${scriptPath}`);
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
// Try bun first (fastest), then tsx, then ts-node
|
|
20
|
-
const runtimes = [
|
|
21
|
-
{ cmd: 'bun', args: ['run', scriptPath] },
|
|
22
|
-
{ cmd: 'tsx', args: [scriptPath] },
|
|
23
|
-
{ cmd: 'ts-node', args: [scriptPath] },
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
function tryRuntime(index) {
|
|
27
|
-
if (index >= runtimes.length) {
|
|
28
|
-
console.error('❌ No TypeScript runtime found.');
|
|
29
|
-
console.error('\nPlease install one of:');
|
|
30
|
-
console.error(' • bun: https://bun.sh (recommended)');
|
|
31
|
-
console.error(' • tsx: npm install -g tsx');
|
|
32
|
-
console.error(' • ts-node: npm install -g ts-node');
|
|
33
|
-
process.exit(1);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const { cmd, args } = runtimes[index];
|
|
37
|
-
|
|
38
|
-
const child = spawn(cmd, args, {
|
|
39
|
-
stdio: 'inherit',
|
|
40
|
-
cwd: process.cwd(),
|
|
41
|
-
shell: true,
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
child.on('error', (error) => {
|
|
45
|
-
// Try next runtime
|
|
46
|
-
if (error.code === 'ENOENT') {
|
|
47
|
-
tryRuntime(index + 1);
|
|
48
|
-
} else {
|
|
49
|
-
console.error(`❌ Failed to run uninstaller:`, error.message);
|
|
50
|
-
process.exit(1);
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
child.on('exit', (code) => {
|
|
55
|
-
process.exit(code || 0);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
tryRuntime(0);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (require.main === module) {
|
|
63
|
-
main();
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
module.exports = { main };
|
package/scripts/cli-uninstall.ts
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Arcten Uninstall - Remove Arcten configuration and files
|
|
4
|
-
*
|
|
5
|
-
* This script removes:
|
|
6
|
-
* - .arcten/ directory (config files)
|
|
7
|
-
* - ARCTEN_API_KEY from .env
|
|
8
|
-
* - Optionally prompts to uninstall the package
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import * as fs from 'fs';
|
|
12
|
-
import * as path from 'path';
|
|
13
|
-
import * as readline from 'readline';
|
|
14
|
-
|
|
15
|
-
// Helper: Create readline interface
|
|
16
|
-
function createPrompt() {
|
|
17
|
-
return readline.createInterface({
|
|
18
|
-
input: process.stdin,
|
|
19
|
-
output: process.stdout,
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Helper: Ask a question
|
|
24
|
-
function ask(rl: readline.Interface, question: string): Promise<string> {
|
|
25
|
-
return new Promise((resolve) => {
|
|
26
|
-
rl.question(question, (answer) => {
|
|
27
|
-
resolve(answer.trim());
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Helper: Confirm action
|
|
33
|
-
async function confirm(rl: readline.Interface, question: string): Promise<boolean> {
|
|
34
|
-
const answer = await ask(rl, `${question} (y/n): `);
|
|
35
|
-
return answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes';
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Remove .arcten directory
|
|
39
|
-
function removeArctenDirectory(): boolean {
|
|
40
|
-
const arctenDir = path.join(process.cwd(), '.arcten');
|
|
41
|
-
|
|
42
|
-
if (!fs.existsSync(arctenDir)) {
|
|
43
|
-
console.log('⚠️ .arcten directory not found (already removed?)');
|
|
44
|
-
return false;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
fs.rmSync(arctenDir, { recursive: true, force: true });
|
|
49
|
-
console.log('✅ Removed .arcten/ directory');
|
|
50
|
-
return true;
|
|
51
|
-
} catch (error: any) {
|
|
52
|
-
console.error(`❌ Failed to remove .arcten/ directory: ${error.message}`);
|
|
53
|
-
return false;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Remove ARCTEN_API_KEY from .env
|
|
58
|
-
function removeApiKeyFromEnv(): boolean {
|
|
59
|
-
const envPath = path.join(process.cwd(), '.env');
|
|
60
|
-
|
|
61
|
-
if (!fs.existsSync(envPath)) {
|
|
62
|
-
console.log('⚠️ .env file not found');
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
try {
|
|
67
|
-
let envContent = fs.readFileSync(envPath, 'utf-8');
|
|
68
|
-
const originalContent = envContent;
|
|
69
|
-
|
|
70
|
-
// Remove ARCTEN_API_KEY line(s)
|
|
71
|
-
envContent = envContent
|
|
72
|
-
.split('\n')
|
|
73
|
-
.filter(line => !line.trim().startsWith('ARCTEN_API_KEY='))
|
|
74
|
-
.join('\n');
|
|
75
|
-
|
|
76
|
-
if (envContent === originalContent) {
|
|
77
|
-
console.log('⚠️ ARCTEN_API_KEY not found in .env');
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
fs.writeFileSync(envPath, envContent, 'utf-8');
|
|
82
|
-
console.log('✅ Removed ARCTEN_API_KEY from .env');
|
|
83
|
-
return true;
|
|
84
|
-
} catch (error: any) {
|
|
85
|
-
console.error(`❌ Failed to update .env: ${error.message}`);
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// Main uninstall function
|
|
91
|
-
async function main() {
|
|
92
|
-
console.log('');
|
|
93
|
-
console.log('╔═══════════════════════════════════════════════╗');
|
|
94
|
-
console.log('║ ║');
|
|
95
|
-
console.log('║ 🗑️ Arcten Uninstaller 🗑️ ║');
|
|
96
|
-
console.log('║ ║');
|
|
97
|
-
console.log('╚═══════════════════════════════════════════════╝');
|
|
98
|
-
console.log('');
|
|
99
|
-
|
|
100
|
-
const rl = createPrompt();
|
|
101
|
-
|
|
102
|
-
try {
|
|
103
|
-
console.log('This will remove:');
|
|
104
|
-
console.log(' • .arcten/ directory and all config files');
|
|
105
|
-
console.log(' • ARCTEN_API_KEY from .env file');
|
|
106
|
-
console.log('');
|
|
107
|
-
console.log('⚠️ Note: This will NOT remove:');
|
|
108
|
-
console.log(' • The @arcteninc/core package (use npm/bun uninstall)');
|
|
109
|
-
console.log(' • ArctenAgent components from your code');
|
|
110
|
-
console.log('');
|
|
111
|
-
|
|
112
|
-
const shouldProceed = await confirm(rl, 'Do you want to proceed?');
|
|
113
|
-
|
|
114
|
-
if (!shouldProceed) {
|
|
115
|
-
console.log('\n❌ Uninstall cancelled');
|
|
116
|
-
rl.close();
|
|
117
|
-
process.exit(0);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
console.log('');
|
|
121
|
-
console.log('🗑️ Removing Arcten files...\n');
|
|
122
|
-
|
|
123
|
-
// Remove .arcten directory
|
|
124
|
-
const removedDir = removeArctenDirectory();
|
|
125
|
-
|
|
126
|
-
// Remove API key from .env
|
|
127
|
-
const removedKey = removeApiKeyFromEnv();
|
|
128
|
-
|
|
129
|
-
console.log('');
|
|
130
|
-
|
|
131
|
-
if (removedDir || removedKey) {
|
|
132
|
-
console.log('✅ Arcten configuration removed successfully!\n');
|
|
133
|
-
|
|
134
|
-
console.log('📋 Next steps:');
|
|
135
|
-
console.log('');
|
|
136
|
-
console.log('1. Remove ArctenAgent components from your code');
|
|
137
|
-
console.log(' (Search for <ArctenAgent in your codebase)');
|
|
138
|
-
console.log('');
|
|
139
|
-
console.log('2. Uninstall the package:');
|
|
140
|
-
console.log(' npm uninstall @arcteninc/core');
|
|
141
|
-
console.log(' or');
|
|
142
|
-
console.log(' bun remove @arcteninc/core');
|
|
143
|
-
console.log('');
|
|
144
|
-
console.log('3. Clean up unused dependencies:');
|
|
145
|
-
console.log(' npm uninstall @arcteninc/ui (if installed)');
|
|
146
|
-
console.log('');
|
|
147
|
-
} else {
|
|
148
|
-
console.log('⚠️ No Arcten configuration found to remove');
|
|
149
|
-
console.log('');
|
|
150
|
-
console.log('If you want to uninstall the package, run:');
|
|
151
|
-
console.log(' npm uninstall @arcteninc/core');
|
|
152
|
-
console.log(' or');
|
|
153
|
-
console.log(' bun remove @arcteninc/core');
|
|
154
|
-
console.log('');
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
} catch (error: any) {
|
|
158
|
-
console.error(`\n❌ Uninstall failed: ${error.message}`);
|
|
159
|
-
process.exit(1);
|
|
160
|
-
} finally {
|
|
161
|
-
rl.close();
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// Run if called directly
|
|
166
|
-
if (require.main === module) {
|
|
167
|
-
main().catch((error) => {
|
|
168
|
-
console.error('Fatal error:', error);
|
|
169
|
-
process.exit(1);
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export { main };
|