archer-wizard 0.1.1 → 0.2.1

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.
Files changed (61) hide show
  1. package/dist/daemon/client.d.ts +4 -0
  2. package/dist/daemon/client.d.ts.map +1 -0
  3. package/dist/daemon/client.js +44 -0
  4. package/dist/daemon/client.js.map +1 -0
  5. package/dist/daemon/lifecycle.d.ts +9 -0
  6. package/dist/daemon/lifecycle.d.ts.map +1 -0
  7. package/dist/daemon/lifecycle.js +118 -0
  8. package/dist/daemon/lifecycle.js.map +1 -0
  9. package/dist/daemon/process.d.ts +2 -0
  10. package/dist/daemon/process.d.ts.map +1 -0
  11. package/dist/daemon/process.js +171 -0
  12. package/dist/daemon/process.js.map +1 -0
  13. package/dist/daemon/run.d.ts +2 -0
  14. package/dist/daemon/run.d.ts.map +1 -0
  15. package/dist/daemon/run.js +5 -0
  16. package/dist/daemon/run.js.map +1 -0
  17. package/dist/daemon/store.d.ts +9 -0
  18. package/dist/daemon/store.d.ts.map +1 -0
  19. package/dist/daemon/store.js +53 -0
  20. package/dist/daemon/store.js.map +1 -0
  21. package/dist/daemon/types.d.ts +47 -0
  22. package/dist/daemon/types.d.ts.map +1 -0
  23. package/dist/daemon/types.js +10 -0
  24. package/dist/daemon/types.js.map +1 -0
  25. package/dist/index.js +105 -21
  26. package/dist/index.js.map +1 -1
  27. package/dist/lib/ascii.d.ts.map +1 -1
  28. package/dist/lib/ascii.js +9 -41
  29. package/dist/lib/ascii.js.map +1 -1
  30. package/dist/tools/unwatch.d.ts +7 -0
  31. package/dist/tools/unwatch.d.ts.map +1 -0
  32. package/dist/tools/unwatch.js +20 -0
  33. package/dist/tools/unwatch.js.map +1 -0
  34. package/dist/tools/watch.d.ts +14 -34
  35. package/dist/tools/watch.d.ts.map +1 -1
  36. package/dist/tools/watch.js +36 -170
  37. package/dist/tools/watch.js.map +1 -1
  38. package/dist/tools/watches.d.ts +2 -0
  39. package/dist/tools/watches.d.ts.map +1 -0
  40. package/dist/tools/watches.js +33 -0
  41. package/dist/tools/watches.js.map +1 -0
  42. package/dist/wizard/index.d.ts.map +1 -1
  43. package/dist/wizard/index.js +57 -23
  44. package/dist/wizard/index.js.map +1 -1
  45. package/dist/wizard/scanner.d.ts.map +1 -1
  46. package/dist/wizard/scanner.js +0 -23
  47. package/dist/wizard/scanner.js.map +1 -1
  48. package/package.json +2 -1
  49. package/src/daemon/client.ts +50 -0
  50. package/src/daemon/lifecycle.ts +126 -0
  51. package/src/daemon/process.ts +207 -0
  52. package/src/daemon/run.ts +6 -0
  53. package/src/daemon/store.ts +60 -0
  54. package/src/daemon/types.ts +41 -0
  55. package/src/index.ts +111 -22
  56. package/src/lib/ascii.ts +9 -44
  57. package/src/tools/unwatch.ts +26 -0
  58. package/src/tools/watch.ts +46 -212
  59. package/src/tools/watches.ts +37 -0
  60. package/src/wizard/index.ts +54 -24
  61. package/src/wizard/scanner.ts +0 -23
@@ -1,11 +1,15 @@
1
1
  import * as clack from '@clack/prompts';
2
2
  import pc from 'picocolors';
3
- import { showAsciiArt, logAction, logSuccess, showSuccessBox } from '../lib/ascii.js';
3
+ import { showAsciiArt, showSuccessBox } from '../lib/ascii.js';
4
4
  import { scanProject, promptForMissing } from './scanner.js';
5
5
  import { detectAgents } from './detector.js';
6
6
  import { injectIntoAgents } from './injector.js';
7
7
  import { injectRules } from './rules.js';
8
8
 
9
+ // ─── Helpers ─────────────────────────────────────────────────
10
+
11
+ const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
12
+
9
13
  // ─── Wizard Sequence ────────────────────────────────────────
10
14
 
11
15
  export async function runWizard(): Promise<void> {
@@ -17,52 +21,78 @@ export async function runWizard(): Promise<void> {
17
21
  // ─ Step 2: Start clack ─
18
22
  clack.intro(pc.bgGreen(pc.black(' archer setup ')));
19
23
 
20
- // ─ Step 3: Scanning
21
- logAction('scanning project for Supabase credentials...');
22
- console.log();
23
-
24
- // ─ Step 4-6: Scan env files ─
24
+ // ─ Step 3: Scan for Supabase credentials
25
+ const s = clack.spinner();
26
+ s.start('scanning project for supabase credentials');
27
+ await sleep(600);
25
28
  const scan = await scanProject(cwd);
26
- console.log();
29
+ await sleep(300);
30
+
31
+ // Build scan summary lines
32
+ const scanNotes: string[] = [];
33
+ if (scan.supabaseUrl) scanNotes.push('SUPABASE_URL');
34
+ if (scan.serviceRoleKey) scanNotes.push('SERVICE_ROLE_KEY');
35
+ if (scan.anonKey) scanNotes.push('ANON_KEY');
36
+ if (scan.foundInFile) scanNotes.push(`from ${scan.foundInFile}`);
27
37
 
28
- // Step 7: Framework detection ─
29
- if (scan.framework !== 'unknown') {
30
- logSuccess(`detected ${pc.bold(scan.framework)} project`);
38
+ if (scanNotes.length > 0) {
39
+ s.stop(`found ${pc.green(scanNotes.join(pc.dim(' · ')))}`);
40
+ } else {
41
+ s.stop(pc.yellow('no credentials found — will prompt'));
31
42
  }
32
- if (scan.hasSupabaseInstalled) {
33
- logSuccess('found @supabase/supabase-js');
43
+
44
+ // ─ Step 4: Framework detection ─
45
+ if (scan.framework !== 'unknown' || scan.hasSupabaseInstalled) {
46
+ const s2 = clack.spinner();
47
+ s2.start('detecting project framework');
48
+ await sleep(400);
49
+ const parts: string[] = [];
50
+ if (scan.framework !== 'unknown') parts.push(pc.bold(scan.framework));
51
+ if (scan.hasSupabaseInstalled) parts.push(pc.dim('@supabase/supabase-js'));
52
+ s2.stop(`detected ${parts.join(pc.dim(' + '))}`);
34
53
  }
35
54
 
36
- // ─ Step 8: Prompt for missing credentials ─
55
+ // ─ Step 5: Prompt for missing credentials ─
37
56
  const credentials = await promptForMissing(scan);
38
- console.log();
39
57
 
40
- // ─ Step 9: Detect agents ─
41
- logAction('detecting AI agents...');
58
+ // ─ Step 6: Detect agents ─
59
+ const s3 = clack.spinner();
60
+ s3.start('scanning for AI agents');
61
+ await sleep(500);
42
62
  const agents = detectAgents();
43
- console.log();
63
+ await sleep(200);
64
+
65
+ if (agents.length > 0) {
66
+ const names = agents.map((a) => pc.bold(a.name)).join(pc.dim(', '));
67
+ s3.stop(`found ${pc.green(String(agents.length))} agent${agents.length !== 1 ? 's' : ''} — ${names}`);
68
+ } else {
69
+ s3.stop(pc.yellow('no agents found'));
70
+ }
44
71
 
45
- // ─ Step 10-11: Inject into agents ─
72
+ // ─ Step 7: Inject into agents ─
46
73
  const injectionResults = await injectIntoAgents(
47
74
  agents,
48
75
  credentials.supabaseUrl,
49
76
  credentials.serviceRoleKey,
50
77
  );
51
- console.log();
52
78
 
53
- // ─ Step 12: Filter successful injections ─
79
+ // ─ Step 8: Filter successful injections ─
54
80
  const successfulAgents = agents.filter((a) =>
55
81
  injectionResults.some((r) => r.agent === a.name && r.success),
56
82
  );
57
83
 
58
- // ─ Step 13: Inject rules ─
84
+ // ─ Step 9: Inject rules ─
59
85
  if (successfulAgents.length > 0) {
60
- logAction('writing agent rules...');
86
+ const s4 = clack.spinner();
87
+ s4.start('writing agent rules');
88
+ await sleep(400);
61
89
  injectRules(successfulAgents);
62
- console.log();
90
+ await sleep(200);
91
+ s4.stop(`rules injected into ${pc.green(String(successfulAgents.length))} agent${successfulAgents.length !== 1 ? 's' : ''}`);
63
92
  }
64
93
 
65
- // ─ Step 14: Success ─
94
+ // ─ Step 10: Success ─
95
+ console.log();
66
96
  showSuccessBox(successfulAgents.length);
67
97
 
68
98
  clack.outro(pc.dim('docs → github.com/archer-mcp'));
@@ -2,7 +2,6 @@ import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import * as clack from '@clack/prompts';
4
4
  import { z } from 'zod';
5
- import { logSuccess, logError, maskCredential } from '../lib/ascii.js';
6
5
  import type { ScanResult, Framework } from '../types/index.js';
7
6
 
8
7
  // Helper to search for keys in files
@@ -236,28 +235,6 @@ export async function scanProject(cwd: string): Promise<ScanResult> {
236
235
 
237
236
  const { framework, hasSupabaseInstalled } = detectFramework(cwd);
238
237
 
239
- // Log found credentials
240
- if (supabaseUrl) {
241
- logSuccess(`SUPABASE_URL = ${maskCredential(supabaseUrl)}`);
242
- } else {
243
- logError('missing SUPABASE_URL');
244
- }
245
-
246
- if (serviceRoleKey) {
247
- logSuccess(`SUPABASE_SERVICE_ROLE_KEY = ${maskCredential(serviceRoleKey)}`);
248
- } else {
249
- logError('missing SUPABASE_SERVICE_ROLE_KEY');
250
- }
251
-
252
- if (anonKey) {
253
- logSuccess(`SUPABASE_ANON_KEY = ${maskCredential(anonKey)}`);
254
- }
255
-
256
- if (foundInFile) {
257
- logSuccess(`found credentials in ${foundInFile}`);
258
- } else if (codebaseResults.size > 0) {
259
- logSuccess(`found credentials in codebase`);
260
- }
261
238
 
262
239
  return {
263
240
  supabaseUrl,