chati-dev 4.0.5 → 4.0.7

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chati-dev",
3
- "version": "4.0.5",
3
+ "version": "4.0.7",
4
4
  "description": "AI-Powered Multi-Agent Orchestration System — Structured vibe coding for Full Stack Development",
5
5
  "type": "module",
6
6
  "bin": {
@@ -26,7 +26,7 @@ export function getTelemetryConfig(targetDir) {
26
26
  const defaults = {
27
27
  enabled: true,
28
28
  anonymousId: null,
29
- endpoint: process.env.CHATI_TELEMETRY_ENDPOINT || 'https://chati-telemetry.vercel.app/api/events',
29
+ endpoint: process.env.CHATI_TELEMETRY_ENDPOINT || 'https://chati.dev/api/telemetry',
30
30
  apiKey: process.env.CHATI_TELEMETRY_KEY || '10b0b54ba4f392fa46379ba778062ab0af5ca61e79609a7dce4aadd660104b56',
31
31
  };
32
32
 
@@ -5,12 +5,31 @@
5
5
  * Fire-and-forget: never blocks the user workflow, fails silently.
6
6
  */
7
7
 
8
+ import { existsSync, readFileSync } from 'fs';
9
+ import { join } from 'path';
10
+ import { homedir } from 'os';
11
+
8
12
  // ---------------------------------------------------------------------------
9
13
  // Default Endpoint
10
14
  // ---------------------------------------------------------------------------
11
15
 
12
16
  export const DEFAULT_ENDPOINT = 'https://chati.dev/api/telemetry';
13
17
 
18
+ // ---------------------------------------------------------------------------
19
+ // Helpers
20
+ // ---------------------------------------------------------------------------
21
+
22
+ function readGlobalLicenseKey() {
23
+ try {
24
+ const p = join(homedir(), '.chati-dev', 'license.yaml');
25
+ if (!existsSync(p)) return null;
26
+ const content = readFileSync(p, 'utf-8');
27
+ const match = content.match(/^key:\s*(.+)$/m);
28
+ const key = match?.[1]?.trim();
29
+ return key && key !== 'null' ? key : null;
30
+ } catch { return null; }
31
+ }
32
+
14
33
  // ---------------------------------------------------------------------------
15
34
  // Sender
16
35
  // ---------------------------------------------------------------------------
@@ -21,7 +40,7 @@ export const DEFAULT_ENDPOINT = 'https://chati.dev/api/telemetry';
21
40
  * Fire-and-forget with 5s timeout. Never throws, never blocks.
22
41
  *
23
42
  * @param {Array<{ type: string, properties: object, timestamp: string }>} events
24
- * @param {{ anonymousId: string, version: string, endpoint?: string }} config
43
+ * @param {{ anonymousId: string, version: string, endpoint?: string, projectName?: string }} config
25
44
  * @returns {Promise<boolean>} true if sent successfully, false otherwise
26
45
  */
27
46
  export async function sendEvents(events, config) {
@@ -31,6 +50,8 @@ export async function sendEvents(events, config) {
31
50
 
32
51
  const payload = {
33
52
  anonymousId: config.anonymousId,
53
+ license_key: readGlobalLicenseKey(),
54
+ project_name: config.projectName ?? null,
34
55
  chatiVersion: config.version || 'unknown',
35
56
  nodeVersion: process.version,
36
57
  os: process.platform,
@@ -30,11 +30,14 @@ export async function runWizard(targetDir, options = {}) {
30
30
  logoText = 'chati.dev';
31
31
  }
32
32
 
33
- // Step 1: Logo + Language Selection (in English)
33
+ // Step 1: Logo + License Activation (first thing, before anything else)
34
34
  logBanner(logoText, VERSION);
35
35
 
36
36
  p.intro('Setting up chati.dev');
37
37
 
38
+ await runLicenseActivationStep();
39
+
40
+ // Step 2: Language Selection
38
41
  const language = options.language || await stepLanguage();
39
42
 
40
43
  // Step 2: Terms of Use (must accept to continue)
@@ -154,9 +157,6 @@ export async function runWizard(targetDir, options = {}) {
154
157
  console.log();
155
158
  p.outro(t('installer.success'));
156
159
 
157
- // License activation step
158
- await runLicenseActivationStep();
159
-
160
160
  // Show quick start — same experience across all providers
161
161
  const invokeCmdMap = {
162
162
  'codex-cli': '$chati',
@@ -188,7 +188,7 @@ export async function runWizard(targetDir, options = {}) {
188
188
  const installEvents = telemetryFlush();
189
189
  if (installEvents.length > 0) {
190
190
  const tConfig = getTelemetryConfig(targetDir);
191
- sendEvents(installEvents, { ...tConfig, version: VERSION });
191
+ sendEvents(installEvents, { ...tConfig, version: VERSION, projectName: config.projectName });
192
192
  }
193
193
 
194
194
  return { success: true, config, validation };
@@ -202,10 +202,7 @@ export async function runWizard(targetDir, options = {}) {
202
202
 
203
203
  async function runLicenseActivationStep() {
204
204
  const existingKey = getLicenseKey();
205
- if (existingKey) {
206
- console.log(`\n ✓ License already active on this machine (${existingKey.substring(0, 12)}...)\n`);
207
- return;
208
- }
205
+ if (existingKey) return; // already activated, proceed silently
209
206
 
210
207
  console.log('\n ┌─ License Activation ─────────────────────────────────────────┐');
211
208
  console.log(' │ Your license key works across ALL projects on this machine. │');