@arcteninc/core 0.0.129 ā 0.0.131
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/package.json +1 -1
- package/scripts/arcten-cli.cjs +13 -8
- package/scripts/cli-init-wizard.ts +87 -33
package/package.json
CHANGED
package/scripts/arcten-cli.cjs
CHANGED
|
@@ -38,6 +38,10 @@ Commands:
|
|
|
38
38
|
- Optional AI analysis (billable)
|
|
39
39
|
- Syncs configuration to dashboard
|
|
40
40
|
|
|
41
|
+
Options:
|
|
42
|
+
--allow-all Enable all functions without analysis
|
|
43
|
+
(useful for testing or when API is unreachable)
|
|
44
|
+
|
|
41
45
|
sync Re-sync tools to dashboard without analysis
|
|
42
46
|
- Scans for functions
|
|
43
47
|
- Updates tool definitions
|
|
@@ -57,14 +61,15 @@ Commands:
|
|
|
57
61
|
help Show this help message
|
|
58
62
|
|
|
59
63
|
Examples:
|
|
60
|
-
arcten init
|
|
61
|
-
arcten
|
|
62
|
-
arcten tools
|
|
63
|
-
arcten
|
|
64
|
-
arcten
|
|
65
|
-
arcten
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
arcten init Run the setup wizard (recommended for new projects)
|
|
65
|
+
arcten init --allow-all Setup and enable all functions (no AI analysis)
|
|
66
|
+
arcten sync Re-sync tools after code changes
|
|
67
|
+
arcten tools Extract tool types (same as arcten extract-types)
|
|
68
|
+
arcten update Update @arcteninc/core to latest version
|
|
69
|
+
arcten uninstall Remove Arcten configuration files
|
|
70
|
+
arcten help Show help
|
|
71
|
+
|
|
72
|
+
For more information, visit https://arcten.com/docs
|
|
68
73
|
`);
|
|
69
74
|
process.exit(0);
|
|
70
75
|
}
|
|
@@ -125,23 +125,30 @@ async function confirm(rl: readline.Interface, question: string): Promise<boolea
|
|
|
125
125
|
async function checkApiKey(rl: readline.Interface): Promise<{ apiKey: string; projectId: string }> {
|
|
126
126
|
console.log('\nš Step 1: Authentication\n');
|
|
127
127
|
|
|
128
|
-
const envPath = path.join(process.cwd(), '.env');
|
|
129
128
|
let apiKey: string | undefined;
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
129
|
+
let foundInFile: string | undefined;
|
|
130
|
+
|
|
131
|
+
// Check multiple env files in order of preference
|
|
132
|
+
const envFiles = ['.env.local', '.env'];
|
|
133
|
+
|
|
134
|
+
for (const envFile of envFiles) {
|
|
135
|
+
const envPath = path.join(process.cwd(), envFile);
|
|
136
|
+
if (fs.existsSync(envPath)) {
|
|
137
|
+
const envContent = fs.readFileSync(envPath, 'utf-8');
|
|
138
|
+
const match = envContent.match(/ARCTEN_API_KEY=([^\s\n]+)/);
|
|
139
|
+
if (match) {
|
|
140
|
+
apiKey = match[1];
|
|
141
|
+
foundInFile = envFile;
|
|
142
|
+
console.log(`ā Found API key in ${envFile}`);
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
138
145
|
}
|
|
139
146
|
}
|
|
140
147
|
|
|
141
148
|
// If not found, prompt
|
|
142
149
|
if (!apiKey) {
|
|
143
|
-
console.log('No API key found in .env
|
|
144
|
-
console.log('\nš Get your API key from: https://arcten.
|
|
150
|
+
console.log('No API key found in .env or .env.local files.');
|
|
151
|
+
console.log('\nš Get your API key from: https://arcten.com/dashboard');
|
|
145
152
|
apiKey = await ask(rl, '\nEnter your API key: ');
|
|
146
153
|
|
|
147
154
|
if (!apiKey) {
|
|
@@ -149,10 +156,11 @@ async function checkApiKey(rl: readline.Interface): Promise<{ apiKey: string; pr
|
|
|
149
156
|
process.exit(1);
|
|
150
157
|
}
|
|
151
158
|
|
|
152
|
-
// Save to .env
|
|
159
|
+
// Save to .env.local (preferred for local development)
|
|
160
|
+
const envPath = path.join(process.cwd(), '.env.local');
|
|
153
161
|
const envEntry = `\nARCTEN_API_KEY=${apiKey}\n`;
|
|
154
162
|
fs.appendFileSync(envPath, envEntry);
|
|
155
|
-
console.log('ā Saved API key to .env');
|
|
163
|
+
console.log('ā Saved API key to .env.local');
|
|
156
164
|
}
|
|
157
165
|
|
|
158
166
|
// Extract project ID from API key (format: sk_proj_xxxxx_yyyyy)
|
|
@@ -346,20 +354,34 @@ async function getUserIntent(rl: readline.Interface): Promise<string> {
|
|
|
346
354
|
async function estimateCost(apiKey: string, serverUrl: string, context: CodebaseContext): Promise<AnalysisEstimate> {
|
|
347
355
|
console.log('\nš° Estimating analysis cost...\n');
|
|
348
356
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
357
|
+
try {
|
|
358
|
+
const url = `${serverUrl}/tools/analyze/estimate`;
|
|
359
|
+
const response = await fetch(url, {
|
|
360
|
+
method: 'POST',
|
|
361
|
+
headers: {
|
|
362
|
+
'Content-Type': 'application/json',
|
|
363
|
+
},
|
|
364
|
+
body: JSON.stringify({ context }),
|
|
365
|
+
});
|
|
356
366
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
367
|
+
if (!response.ok) {
|
|
368
|
+
const error = await response.json();
|
|
369
|
+
throw new Error(error.error || 'Failed to estimate cost');
|
|
370
|
+
}
|
|
361
371
|
|
|
362
|
-
|
|
372
|
+
return await response.json();
|
|
373
|
+
} catch (error: any) {
|
|
374
|
+
if (error.cause?.code === 'ENOTFOUND' || error.cause?.code === 'ECONNREFUSED' || error.message.includes('fetch')) {
|
|
375
|
+
console.error(`\nā Unable to connect to: ${serverUrl}`);
|
|
376
|
+
console.error('\nPossible issues:');
|
|
377
|
+
console.error(' ⢠No internet connection');
|
|
378
|
+
console.error(' ⢠API server is down');
|
|
379
|
+
console.error(' ⢠Firewall blocking the request');
|
|
380
|
+
console.error('\nš” Tip: Use --allow-all flag to skip analysis and enable all tools');
|
|
381
|
+
throw new Error('Connection failed');
|
|
382
|
+
}
|
|
383
|
+
throw error;
|
|
384
|
+
}
|
|
363
385
|
}
|
|
364
386
|
|
|
365
387
|
// Step 5: Confirm analysis
|
|
@@ -521,7 +543,7 @@ async function displayPlacementSuggestions(
|
|
|
521
543
|
console.log('');
|
|
522
544
|
console.log(' 3. For pre-built UI, use <ArctenAgent /> component');
|
|
523
545
|
console.log('');
|
|
524
|
-
console.log(' For more info: https://arcten.
|
|
546
|
+
console.log(' For more info: https://arcten.com/docs/integration');
|
|
525
547
|
console.log('');
|
|
526
548
|
}
|
|
527
549
|
|
|
@@ -595,7 +617,7 @@ function MyComponent() {
|
|
|
595
617
|
}
|
|
596
618
|
\`\`\`
|
|
597
619
|
|
|
598
|
-
For more information, visit https://arcten.
|
|
620
|
+
For more information, visit https://arcten.com/docs
|
|
599
621
|
`;
|
|
600
622
|
|
|
601
623
|
const readmePath = path.join(arctenDir, 'README.md');
|
|
@@ -610,11 +632,20 @@ For more information, visit https://arcten.ai/docs
|
|
|
610
632
|
|
|
611
633
|
// Main wizard
|
|
612
634
|
async function main() {
|
|
613
|
-
// Check for
|
|
635
|
+
// Check for flags
|
|
614
636
|
const args = process.argv.slice(2);
|
|
615
637
|
const skipAnalysis = args.includes('--skip-analysis');
|
|
638
|
+
const allowAll = args.includes('--allow-all');
|
|
616
639
|
|
|
617
|
-
if (
|
|
640
|
+
if (allowAll) {
|
|
641
|
+
console.log('');
|
|
642
|
+
console.log('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā');
|
|
643
|
+
console.log('ā ā');
|
|
644
|
+
console.log('ā š Arcten Setup (Allow All) š ā');
|
|
645
|
+
console.log('ā ā');
|
|
646
|
+
console.log('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā');
|
|
647
|
+
console.log('');
|
|
648
|
+
} else if (skipAnalysis) {
|
|
618
649
|
console.log('');
|
|
619
650
|
console.log('āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā');
|
|
620
651
|
console.log('ā ā');
|
|
@@ -641,7 +672,7 @@ async function main() {
|
|
|
641
672
|
const arctenDir = path.join(process.cwd(), '.arcten');
|
|
642
673
|
const hasExistingSetup = fs.existsSync(arctenDir);
|
|
643
674
|
|
|
644
|
-
if (hasExistingSetup && !skipAnalysis) {
|
|
675
|
+
if (hasExistingSetup && !skipAnalysis && !allowAll) {
|
|
645
676
|
console.log('ā ļø Arcten is already configured in this project!\n');
|
|
646
677
|
console.log('š Found existing .arcten/ directory\n');
|
|
647
678
|
console.log('Running init again will:');
|
|
@@ -668,7 +699,30 @@ async function main() {
|
|
|
668
699
|
|
|
669
700
|
let analysis: AnalysisResult | null = null;
|
|
670
701
|
|
|
671
|
-
if (
|
|
702
|
+
if (allowAll) {
|
|
703
|
+
// Allow-all mode - enable all tools without analysis
|
|
704
|
+
console.log('\nš Enabling all discovered functions...\n');
|
|
705
|
+
console.log('ā ļø WARNING: All functions will be enabled without analysis.');
|
|
706
|
+
console.log(' The agent will be able to call any discovered function.\n');
|
|
707
|
+
|
|
708
|
+
// Create tool recommendations with all tools enabled
|
|
709
|
+
const allTools: ToolRecommendation[] = context.functions.map(fn => ({
|
|
710
|
+
name: fn.name,
|
|
711
|
+
category: 'query' as const,
|
|
712
|
+
description: fn.jsDoc || `Function: ${fn.name}`,
|
|
713
|
+
shouldEnable: true, // Enable all tools in allow-all mode
|
|
714
|
+
requiresApproval: false,
|
|
715
|
+
sensitiveParams: [],
|
|
716
|
+
}));
|
|
717
|
+
|
|
718
|
+
await syncToDashboard(apiKey, convexUrl, projectId, allTools);
|
|
719
|
+
await generateLocalConfig(projectId, 'default');
|
|
720
|
+
|
|
721
|
+
console.log('\nā
Setup complete!\n');
|
|
722
|
+
console.log(`š Dashboard: https://arcten.com/dashboard/projects/${projectId}`);
|
|
723
|
+
console.log(` All ${context.functions.length} functions are now enabled.`);
|
|
724
|
+
console.log('\nā ļø Remember: You can always disable specific tools in the dashboard.');
|
|
725
|
+
} else if (skipAnalysis) {
|
|
672
726
|
// Sync mode - just sync tools without analysis
|
|
673
727
|
console.log('\nāļø Syncing tools to dashboard...\n');
|
|
674
728
|
|
|
@@ -686,7 +740,7 @@ async function main() {
|
|
|
686
740
|
await generateLocalConfig(projectId, 'default');
|
|
687
741
|
|
|
688
742
|
console.log('\nā
Sync complete!\n');
|
|
689
|
-
console.log(`š Dashboard: https://arcten.
|
|
743
|
+
console.log(`š Dashboard: https://arcten.com/dashboard/projects/${projectId}`);
|
|
690
744
|
console.log(' Configure tools and agents in the dashboard.');
|
|
691
745
|
} else {
|
|
692
746
|
// Full wizard mode with AI analysis option
|
|
@@ -733,7 +787,7 @@ async function main() {
|
|
|
733
787
|
}
|
|
734
788
|
|
|
735
789
|
console.log('\nā
Setup complete!\n');
|
|
736
|
-
console.log(`š Dashboard: https://arcten.
|
|
790
|
+
console.log(`š Dashboard: https://arcten.com/dashboard/projects/${projectId}`);
|
|
737
791
|
console.log('');
|
|
738
792
|
}
|
|
739
793
|
|