crg-dev-kit 1.0.0 → 2.0.0

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/bin/tutorial.js DELETED
@@ -1,198 +0,0 @@
1
- #!/usr/bin/env node
2
- const readline = require('readline');
3
-
4
- const colors = {
5
- reset: '\x1b[0m',
6
- bright: '\x1b[1m',
7
- dim: '\x1b[2m',
8
- cyan: '\x1b[36m',
9
- yellow: '\x1b[33m',
10
- green: '\x1b[32m',
11
- red: '\x1b[31m',
12
- gray: '\x1b[90m'
13
- };
14
-
15
- function c(color, text) {
16
- return colors[color] + text + colors.reset;
17
- }
18
-
19
- const rl = readline.createInterface({
20
- input: process.stdin,
21
- output: process.stdout
22
- });
23
-
24
- const menu = `
25
- ${c('cyan','╔════════════════════════════════════════════════════════════╗')}
26
- ${c('cyan','║')} ${c('bright','🎯 CODE SCOPE INTERACTIVE TUTORIAL')} ${c('cyan','║')}
27
- ${c('cyan','╚════════════════════════════════════════════════════════════╝')}
28
-
29
- ${c('cyan','1.')} What is Code Scope?
30
- ${c('cyan','2.')} See how it works (before/after)
31
- ${c('cyan','3.')} Try a demo query
32
- ${c('cyan','4.')} Your project stats
33
- ${c('cyan','5.')} FAQ
34
- ${c('cyan','6.')} Exit
35
-
36
- `;
37
-
38
- const whatIsCodeScope = `
39
- ${c('yellow','🔍 WHAT IS CODE SCOPE?')}
40
-
41
- Code Scope gives your AI coding assistant (Claude Code, Cursor, etc.)
42
- a ${c('bright','knowledge graph')} of your codebase.
43
-
44
- Instead of reading every file, Claude can query:
45
- • Who calls this function?
46
- • What tests cover this file?
47
- • What's affected by this change?
48
-
49
- Think of it like a ${c('bright','GPS for your code')} — instead of
50
- reading every road sign, you ask "how do I get there?"
51
-
52
- ${c('gray','─'.repeat(60))}
53
- ${c('gray','Press Enter to go back...')}
54
- `;
55
-
56
- const beforeAfter = `
57
- ${c('yellow','⚡ BEFORE VS AFTER')}
58
-
59
- ${c('red','BEFORE:')}
60
- You ask: "Who calls auth_user()?"
61
- Claude: Reads 542 JavaScript files...
62
- Tokens: ~50,000
63
- Time: 30 seconds
64
-
65
- ${c('green','AFTER:')}
66
- You ask: "Who calls auth_user()?"
67
- Claude: Queries knowledge graph
68
- Tokens: ~400 (structured JSON)
69
- Time: 1 second
70
-
71
- ${c('bright','Result: ~100x fewer tokens, 30x faster')}
72
-
73
- ${c('gray','─'.repeat(60))}
74
- ${c('gray','Press Enter to go back...')}
75
- `;
76
-
77
- const demoQuery = `
78
- ${c('yellow','🎮 DEMO: TRY A QUERY')}
79
-
80
- In your project, Claude can answer questions like:
81
-
82
- ${c('cyan','▸ "Find callers of login()"')}
83
- → Shows all functions that call login()
84
-
85
- ${c('cyan','▸ "Find tests for auth.ts"')}
86
- → Shows test files for auth module
87
-
88
- ${c('cyan','▸ "Use detect_changes"')}
89
- → Risk-scoped code review
90
-
91
- ${c('cyan','▸ "Show me architecture"')}
92
- → Get community structure
93
-
94
- ${c('gray','After restarting Claude Code, try one of these!')}
95
- ${c('gray','─'.repeat(60))}
96
- ${c('gray','Press Enter to go back...')}
97
- `;
98
-
99
- const projectStats = () => {
100
- const { execSync } = require('child_process');
101
- try {
102
- const stats = execSync('code-review-graph status 2>/dev/null', { encoding: 'utf8' });
103
- return `${c('yellow','📊 YOUR PROJECT STATS')}
104
-
105
- ${stats}
106
- ${c('gray','─'.repeat(60))}
107
- ${c('gray','Press Enter to go back...')}`;
108
- } catch {
109
- return `${c('yellow','📊 YOUR PROJECT STATS')}
110
-
111
- Run ${c('cyan','code-review-graph status')} in your project first!
112
-
113
- ${c('gray','─'.repeat(60))}
114
- ${c('gray','Press Enter to go back...')}`;
115
- }
116
- };
117
-
118
- const faq = `
119
- ${c('yellow','❓ FAQ')}
120
-
121
- ${c('cyan','Q: Does this slow down my workflow?')}
122
- A: No. Graph builds once, updates incrementally.
123
-
124
- ${c('cyan','Q: Does it read my code?')}
125
- A: Only once to build. After that, queries the graph.
126
-
127
- ${c('cyan','Q: Is my data safe?')}
128
- A: 100% local. No cloud. No telemetry.
129
-
130
- ${c('cyan','Q: What if I don\'t want ROI tracking?')}
131
- A: Use ${c('cyan','--no-roi')} flag:
132
- npx crg-dev-kit install --no-roi
133
-
134
- ${c('gray','─'.repeat(60))}
135
- ${c('gray','Press Enter to go back...')}
136
- `;
137
-
138
- function showScreen(screenName) {
139
- console.clear();
140
-
141
- if (screenName === 'main') {
142
- console.log(menu);
143
- rl.question(c('gray','Choose: '), (answer) => {
144
- handleChoice(answer.trim());
145
- });
146
- } else if (screenName === 'stats') {
147
- console.log(projectStats());
148
- rl.question('', () => {
149
- showScreen('main');
150
- });
151
- } else {
152
- const screens = {
153
- '1': whatIsCodeScope,
154
- '2': beforeAfter,
155
- '3': demoQuery,
156
- '4': 'stats',
157
- '5': faq
158
- };
159
- const content = screens[screenName];
160
- if (content === 'stats') {
161
- showScreen('stats');
162
- } else {
163
- console.log(content);
164
- rl.question('', () => {
165
- showScreen('main');
166
- });
167
- }
168
- }
169
- }
170
-
171
- function handleChoice(choice) {
172
- if (choice === '6' || choice === 'exit' || choice === 'q') {
173
- console.clear();
174
- console.log(c('green','\n🎉 Thanks for trying Code Scope!'));
175
- console.log(c('gray',' Run ') + c('cyan','npx crg-dev-kit') + c('gray',' anytime for dashboard'));
176
- console.log(c('gray',' Run ') + c('cyan','npx crg-dev-kit roi') + c('gray',' for ROI report\n'));
177
- rl.close();
178
- process.exit(0);
179
- }
180
-
181
- const validChoices = ['1', '2', '3', '4', '5'];
182
- if (validChoices.includes(choice)) {
183
- showScreen(choice);
184
- } else {
185
- console.log(c('red','Invalid choice. Try 1-6.'));
186
- showScreen('main');
187
- }
188
- }
189
-
190
- console.clear();
191
- console.log(`
192
- ${c('cyan','╔════════════════════════════════════════════════════════════╗')}
193
- ${c('cyan','║')} ${c('bright','🎯 Welcome to Code Scope Interactive Tutorial!')} ${c('cyan','║')}
194
- ${c('cyan','║')} ${c('cyan','║')}
195
- ${c('cyan','║')} Learn how to use the knowledge graph in 2 minutes ${c('cyan','║')}
196
- ${c('cyan','╚════════════════════════════════════════════════════════════╝')}
197
- `);
198
- setTimeout(() => showScreen('main'), 500);