@gurulu/cli 1.0.1 → 1.0.4

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/dist/bin.js CHANGED
@@ -25241,36 +25241,43 @@ function sdkFor(framework) {
25241
25241
  }
25242
25242
  }
25243
25243
  function snippetWeb(workspaceKey) {
25244
- return `import { createGurulu } from '@gurulu/web';
25244
+ return `import gurulu from '@gurulu/web';
25245
25245
 
25246
- const gurulu = createGurulu();
25247
- gurulu.init({ workspace: '${workspaceKey}' });`;
25246
+ gurulu.init({
25247
+ workspaceKey: process.env.NEXT_PUBLIC_GURULU_WORKSPACE ?? '${workspaceKey}',
25248
+ endpoint: process.env.NEXT_PUBLIC_GURULU_ENDPOINT, // optional, defaults to https://ingest.gurulu.io
25249
+ });`;
25248
25250
  }
25249
25251
  function snippetNext(workspaceKey) {
25250
- return `// app/layout.tsx (or pages/_app.tsx)
25252
+ return `// src/app/gurulu-provider.tsx
25251
25253
  'use client';
25252
25254
  import { useEffect } from 'react';
25253
- import { createGurulu } from '@gurulu/web';
25254
-
25255
- const gurulu = createGurulu();
25255
+ import gurulu from '@gurulu/web';
25256
25256
 
25257
25257
  export function GuruluProvider({ children }: { children: React.ReactNode }) {
25258
25258
  useEffect(() => {
25259
- gurulu.init({ workspace: '${workspaceKey}' });
25259
+ gurulu.init({
25260
+ workspaceKey: process.env.NEXT_PUBLIC_GURULU_WORKSPACE ?? '${workspaceKey}',
25261
+ endpoint: process.env.NEXT_PUBLIC_GURULU_ENDPOINT,
25262
+ });
25260
25263
  }, []);
25261
25264
  return <>{children}</>;
25262
- }`;
25265
+ }
25266
+
25267
+ // Then wrap your root in app/layout.tsx:
25268
+ // <GuruluProvider>{children}</GuruluProvider>`;
25263
25269
  }
25264
25270
  function snippetNode(workspaceKey) {
25265
25271
  return `import { createGurulu } from '@gurulu/node';
25266
25272
 
25267
25273
  const gurulu = createGurulu({
25268
- workspace: '${workspaceKey}',
25274
+ workspaceKey: process.env.GURULU_WORKSPACE ?? '${workspaceKey}',
25269
25275
  apiKey: process.env.GURULU_API_KEY,
25276
+ endpoint: process.env.GURULU_ENDPOINT, // optional, defaults to https://ingest.gurulu.io
25270
25277
  });
25271
25278
 
25272
25279
  // In your handler:
25273
- await gurulu.track('purchase.completed', {
25280
+ await gurulu.track('purchase_completed', {
25274
25281
  user_id: 'u_42',
25275
25282
  order_id: 'o_123',
25276
25283
  total: 49.99,
@@ -25282,8 +25289,9 @@ import { guruluMiddleware } from '@gurulu/node/middleware/express';
25282
25289
 
25283
25290
  const app = express();
25284
25291
  app.use(guruluMiddleware({
25285
- workspace: '${workspaceKey}',
25292
+ workspaceKey: process.env.GURULU_WORKSPACE ?? '${workspaceKey}',
25286
25293
  apiKey: process.env.GURULU_API_KEY,
25294
+ endpoint: process.env.GURULU_ENDPOINT,
25287
25295
  }));`;
25288
25296
  }
25289
25297
  function snippetHono(workspaceKey) {
@@ -25291,13 +25299,14 @@ function snippetHono(workspaceKey) {
25291
25299
  import { createGurulu } from '@gurulu/node';
25292
25300
 
25293
25301
  const gurulu = createGurulu({
25294
- workspace: '${workspaceKey}',
25302
+ workspaceKey: process.env.GURULU_WORKSPACE ?? '${workspaceKey}',
25295
25303
  apiKey: process.env.GURULU_API_KEY,
25304
+ endpoint: process.env.GURULU_ENDPOINT,
25296
25305
  });
25297
25306
 
25298
25307
  const app = new Hono();
25299
25308
  app.post('/checkout/complete', async (c) => {
25300
- await gurulu.track('purchase.completed', await c.req.json());
25309
+ await gurulu.track('purchase_completed', await c.req.json());
25301
25310
  return c.json({ ok: true });
25302
25311
  });`;
25303
25312
  }
@@ -25344,20 +25353,19 @@ function initSnippetFor(framework, sdk, workspaceKey) {
25344
25353
  function envKeysFor(sdk, framework) {
25345
25354
  if (sdk === "@gurulu/node") {
25346
25355
  return [
25356
+ { key: "GURULU_WORKSPACE", example: "pk_live_xxxxxxxxxxxx", required: true },
25357
+ { key: "GURULU_API_KEY", example: "sk_live_xxxxxxxxxxxx", required: true },
25347
25358
  {
25348
- key: "GURULU_API_KEY",
25349
- example: "sk_live_xxxxxxxxxxxx",
25350
- required: true
25359
+ key: "GURULU_ENDPOINT",
25360
+ example: "https://ingest.gurulu.io",
25361
+ required: false
25351
25362
  }
25352
25363
  ];
25353
25364
  }
25354
- const envKey = framework === "next" ? "NEXT_PUBLIC_GURULU_WORKSPACE" : "VITE_GURULU_WORKSPACE";
25365
+ const prefix = framework === "next" ? "NEXT_PUBLIC_GURULU" : "VITE_GURULU";
25355
25366
  return [
25356
- {
25357
- key: envKey,
25358
- example: "pk_live_xxxxxxxxxxxx",
25359
- required: false
25360
- }
25367
+ { key: `${prefix}_WORKSPACE`, example: "pk_live_xxxxxxxxxxxx", required: false },
25368
+ { key: `${prefix}_ENDPOINT`, example: "https://ingest.gurulu.io", required: false }
25361
25369
  ];
25362
25370
  }
25363
25371
  function buildInstallPlan(detected, ctx = {}) {
@@ -25706,7 +25714,7 @@ var pushCmd = defineCommand({
25706
25714
  });
25707
25715
 
25708
25716
  // src/index.ts
25709
- var VERSION = "1.0.1";
25717
+ var VERSION = "1.0.4";
25710
25718
  var mcpCmd = defineCommand({
25711
25719
  meta: {
25712
25720
  name: "mcp",
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "1.0.1";
1
+ export declare const VERSION = "1.0.4";
2
2
  declare const mainCmd: import("citty").CommandDef<import("citty").ArgsDef>;
3
3
  export default mainCmd;
4
4
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -24818,36 +24818,43 @@ function sdkFor(framework) {
24818
24818
  }
24819
24819
  }
24820
24820
  function snippetWeb(workspaceKey) {
24821
- return `import { createGurulu } from '@gurulu/web';
24821
+ return `import gurulu from '@gurulu/web';
24822
24822
 
24823
- const gurulu = createGurulu();
24824
- gurulu.init({ workspace: '${workspaceKey}' });`;
24823
+ gurulu.init({
24824
+ workspaceKey: process.env.NEXT_PUBLIC_GURULU_WORKSPACE ?? '${workspaceKey}',
24825
+ endpoint: process.env.NEXT_PUBLIC_GURULU_ENDPOINT, // optional, defaults to https://ingest.gurulu.io
24826
+ });`;
24825
24827
  }
24826
24828
  function snippetNext(workspaceKey) {
24827
- return `// app/layout.tsx (or pages/_app.tsx)
24829
+ return `// src/app/gurulu-provider.tsx
24828
24830
  'use client';
24829
24831
  import { useEffect } from 'react';
24830
- import { createGurulu } from '@gurulu/web';
24831
-
24832
- const gurulu = createGurulu();
24832
+ import gurulu from '@gurulu/web';
24833
24833
 
24834
24834
  export function GuruluProvider({ children }: { children: React.ReactNode }) {
24835
24835
  useEffect(() => {
24836
- gurulu.init({ workspace: '${workspaceKey}' });
24836
+ gurulu.init({
24837
+ workspaceKey: process.env.NEXT_PUBLIC_GURULU_WORKSPACE ?? '${workspaceKey}',
24838
+ endpoint: process.env.NEXT_PUBLIC_GURULU_ENDPOINT,
24839
+ });
24837
24840
  }, []);
24838
24841
  return <>{children}</>;
24839
- }`;
24842
+ }
24843
+
24844
+ // Then wrap your root in app/layout.tsx:
24845
+ // <GuruluProvider>{children}</GuruluProvider>`;
24840
24846
  }
24841
24847
  function snippetNode(workspaceKey) {
24842
24848
  return `import { createGurulu } from '@gurulu/node';
24843
24849
 
24844
24850
  const gurulu = createGurulu({
24845
- workspace: '${workspaceKey}',
24851
+ workspaceKey: process.env.GURULU_WORKSPACE ?? '${workspaceKey}',
24846
24852
  apiKey: process.env.GURULU_API_KEY,
24853
+ endpoint: process.env.GURULU_ENDPOINT, // optional, defaults to https://ingest.gurulu.io
24847
24854
  });
24848
24855
 
24849
24856
  // In your handler:
24850
- await gurulu.track('purchase.completed', {
24857
+ await gurulu.track('purchase_completed', {
24851
24858
  user_id: 'u_42',
24852
24859
  order_id: 'o_123',
24853
24860
  total: 49.99,
@@ -24859,8 +24866,9 @@ import { guruluMiddleware } from '@gurulu/node/middleware/express';
24859
24866
 
24860
24867
  const app = express();
24861
24868
  app.use(guruluMiddleware({
24862
- workspace: '${workspaceKey}',
24869
+ workspaceKey: process.env.GURULU_WORKSPACE ?? '${workspaceKey}',
24863
24870
  apiKey: process.env.GURULU_API_KEY,
24871
+ endpoint: process.env.GURULU_ENDPOINT,
24864
24872
  }));`;
24865
24873
  }
24866
24874
  function snippetHono(workspaceKey) {
@@ -24868,13 +24876,14 @@ function snippetHono(workspaceKey) {
24868
24876
  import { createGurulu } from '@gurulu/node';
24869
24877
 
24870
24878
  const gurulu = createGurulu({
24871
- workspace: '${workspaceKey}',
24879
+ workspaceKey: process.env.GURULU_WORKSPACE ?? '${workspaceKey}',
24872
24880
  apiKey: process.env.GURULU_API_KEY,
24881
+ endpoint: process.env.GURULU_ENDPOINT,
24873
24882
  });
24874
24883
 
24875
24884
  const app = new Hono();
24876
24885
  app.post('/checkout/complete', async (c) => {
24877
- await gurulu.track('purchase.completed', await c.req.json());
24886
+ await gurulu.track('purchase_completed', await c.req.json());
24878
24887
  return c.json({ ok: true });
24879
24888
  });`;
24880
24889
  }
@@ -24921,20 +24930,19 @@ function initSnippetFor(framework, sdk, workspaceKey) {
24921
24930
  function envKeysFor(sdk, framework) {
24922
24931
  if (sdk === "@gurulu/node") {
24923
24932
  return [
24933
+ { key: "GURULU_WORKSPACE", example: "pk_live_xxxxxxxxxxxx", required: true },
24934
+ { key: "GURULU_API_KEY", example: "sk_live_xxxxxxxxxxxx", required: true },
24924
24935
  {
24925
- key: "GURULU_API_KEY",
24926
- example: "sk_live_xxxxxxxxxxxx",
24927
- required: true
24936
+ key: "GURULU_ENDPOINT",
24937
+ example: "https://ingest.gurulu.io",
24938
+ required: false
24928
24939
  }
24929
24940
  ];
24930
24941
  }
24931
- const envKey = framework === "next" ? "NEXT_PUBLIC_GURULU_WORKSPACE" : "VITE_GURULU_WORKSPACE";
24942
+ const prefix = framework === "next" ? "NEXT_PUBLIC_GURULU" : "VITE_GURULU";
24932
24943
  return [
24933
- {
24934
- key: envKey,
24935
- example: "pk_live_xxxxxxxxxxxx",
24936
- required: false
24937
- }
24944
+ { key: `${prefix}_WORKSPACE`, example: "pk_live_xxxxxxxxxxxx", required: false },
24945
+ { key: `${prefix}_ENDPOINT`, example: "https://ingest.gurulu.io", required: false }
24938
24946
  ];
24939
24947
  }
24940
24948
  function buildInstallPlan(detected, ctx = {}) {
@@ -25283,7 +25291,7 @@ var pushCmd = defineCommand({
25283
25291
  });
25284
25292
 
25285
25293
  // src/index.ts
25286
- var VERSION = "1.0.1";
25294
+ var VERSION = "1.0.4";
25287
25295
  var mcpCmd = defineCommand({
25288
25296
  meta: {
25289
25297
  name: "mcp",
@@ -1 +1 @@
1
- {"version":3,"file":"install-plan.d.ts","sourceRoot":"","sources":["../../src/lib/install-plan.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE9E,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG,cAAc,CAAC;AAExD,MAAM,WAAW,kBAAkB;IACjC,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,UAAU,CAAC;IAChB,cAAc,EAAE,cAAc,CAAC;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACpE,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,SAAS,CAAC;CACtB;AA2JD,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,eAAe,EACzB,GAAG,GAAE,kBAAuB,GAC3B,WAAW,CAYb"}
1
+ {"version":3,"file":"install-plan.d.ts","sourceRoot":"","sources":["../../src/lib/install-plan.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE9E,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG,cAAc,CAAC;AAExD,MAAM,WAAW,kBAAkB;IACjC,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,UAAU,CAAC;IAChB,cAAc,EAAE,cAAc,CAAC;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IACpE,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,SAAS,CAAC;CACtB;AAwKD,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,eAAe,EACzB,GAAG,GAAE,kBAAuB,GAC3B,WAAW,CAYb"}
@@ -24,36 +24,43 @@ function sdkFor(framework) {
24
24
  }
25
25
  }
26
26
  function snippetWeb(workspaceKey) {
27
- return `import { createGurulu } from '@gurulu/web';
27
+ return `import gurulu from '@gurulu/web';
28
28
 
29
- const gurulu = createGurulu();
30
- gurulu.init({ workspace: '${workspaceKey}' });`;
29
+ gurulu.init({
30
+ workspaceKey: process.env.NEXT_PUBLIC_GURULU_WORKSPACE ?? '${workspaceKey}',
31
+ endpoint: process.env.NEXT_PUBLIC_GURULU_ENDPOINT, // optional, defaults to https://ingest.gurulu.io
32
+ });`;
31
33
  }
32
34
  function snippetNext(workspaceKey) {
33
- return `// app/layout.tsx (or pages/_app.tsx)
35
+ return `// src/app/gurulu-provider.tsx
34
36
  'use client';
35
37
  import { useEffect } from 'react';
36
- import { createGurulu } from '@gurulu/web';
37
-
38
- const gurulu = createGurulu();
38
+ import gurulu from '@gurulu/web';
39
39
 
40
40
  export function GuruluProvider({ children }: { children: React.ReactNode }) {
41
41
  useEffect(() => {
42
- gurulu.init({ workspace: '${workspaceKey}' });
42
+ gurulu.init({
43
+ workspaceKey: process.env.NEXT_PUBLIC_GURULU_WORKSPACE ?? '${workspaceKey}',
44
+ endpoint: process.env.NEXT_PUBLIC_GURULU_ENDPOINT,
45
+ });
43
46
  }, []);
44
47
  return <>{children}</>;
45
- }`;
48
+ }
49
+
50
+ // Then wrap your root in app/layout.tsx:
51
+ // <GuruluProvider>{children}</GuruluProvider>`;
46
52
  }
47
53
  function snippetNode(workspaceKey) {
48
54
  return `import { createGurulu } from '@gurulu/node';
49
55
 
50
56
  const gurulu = createGurulu({
51
- workspace: '${workspaceKey}',
57
+ workspaceKey: process.env.GURULU_WORKSPACE ?? '${workspaceKey}',
52
58
  apiKey: process.env.GURULU_API_KEY,
59
+ endpoint: process.env.GURULU_ENDPOINT, // optional, defaults to https://ingest.gurulu.io
53
60
  });
54
61
 
55
62
  // In your handler:
56
- await gurulu.track('purchase.completed', {
63
+ await gurulu.track('purchase_completed', {
57
64
  user_id: 'u_42',
58
65
  order_id: 'o_123',
59
66
  total: 49.99,
@@ -65,8 +72,9 @@ import { guruluMiddleware } from '@gurulu/node/middleware/express';
65
72
 
66
73
  const app = express();
67
74
  app.use(guruluMiddleware({
68
- workspace: '${workspaceKey}',
75
+ workspaceKey: process.env.GURULU_WORKSPACE ?? '${workspaceKey}',
69
76
  apiKey: process.env.GURULU_API_KEY,
77
+ endpoint: process.env.GURULU_ENDPOINT,
70
78
  }));`;
71
79
  }
72
80
  function snippetHono(workspaceKey) {
@@ -74,13 +82,14 @@ function snippetHono(workspaceKey) {
74
82
  import { createGurulu } from '@gurulu/node';
75
83
 
76
84
  const gurulu = createGurulu({
77
- workspace: '${workspaceKey}',
85
+ workspaceKey: process.env.GURULU_WORKSPACE ?? '${workspaceKey}',
78
86
  apiKey: process.env.GURULU_API_KEY,
87
+ endpoint: process.env.GURULU_ENDPOINT,
79
88
  });
80
89
 
81
90
  const app = new Hono();
82
91
  app.post('/checkout/complete', async (c) => {
83
- await gurulu.track('purchase.completed', await c.req.json());
92
+ await gurulu.track('purchase_completed', await c.req.json());
84
93
  return c.json({ ok: true });
85
94
  });`;
86
95
  }
@@ -127,20 +136,19 @@ function initSnippetFor(framework, sdk, workspaceKey) {
127
136
  function envKeysFor(sdk, framework) {
128
137
  if (sdk === "@gurulu/node") {
129
138
  return [
139
+ { key: "GURULU_WORKSPACE", example: "pk_live_xxxxxxxxxxxx", required: true },
140
+ { key: "GURULU_API_KEY", example: "sk_live_xxxxxxxxxxxx", required: true },
130
141
  {
131
- key: "GURULU_API_KEY",
132
- example: "sk_live_xxxxxxxxxxxx",
133
- required: true
142
+ key: "GURULU_ENDPOINT",
143
+ example: "https://ingest.gurulu.io",
144
+ required: false
134
145
  }
135
146
  ];
136
147
  }
137
- const envKey = framework === "next" ? "NEXT_PUBLIC_GURULU_WORKSPACE" : "VITE_GURULU_WORKSPACE";
148
+ const prefix = framework === "next" ? "NEXT_PUBLIC_GURULU" : "VITE_GURULU";
138
149
  return [
139
- {
140
- key: envKey,
141
- example: "pk_live_xxxxxxxxxxxx",
142
- required: false
143
- }
150
+ { key: `${prefix}_WORKSPACE`, example: "pk_live_xxxxxxxxxxxx", required: false },
151
+ { key: `${prefix}_ENDPOINT`, example: "https://ingest.gurulu.io", required: false }
144
152
  ];
145
153
  }
146
154
  function buildInstallPlan(detected, ctx = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gurulu/cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.4",
4
4
  "private": false,
5
5
  "license": "BUSL-1.1",
6
6
  "publishConfig": {