@elevasis/sdk 0.5.8 → 0.5.10

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/cli.cjs CHANGED
@@ -43729,18 +43729,21 @@ function resolveApiKey(prod) {
43729
43729
  }
43730
43730
 
43731
43731
  // src/cli/api-client.ts
43732
- function getApiKey() {
43733
- const key = process.env.ELEVASIS_PLATFORM_KEY;
43732
+ function getApiKey(apiUrl) {
43733
+ const isProd = !apiUrl.includes("localhost");
43734
+ const key = resolveApiKey(isProd);
43734
43735
  if (!key) {
43736
+ const varName = isProd ? "ELEVASIS_PLATFORM_KEY" : "ELEVASIS_PLATFORM_KEY_DEV";
43735
43737
  throw new Error(
43736
- "ELEVASIS_PLATFORM_KEY environment variable is required.\nSet it in your .env file: ELEVASIS_PLATFORM_KEY=sk_..."
43738
+ `${varName} environment variable is required.
43739
+ Set it in your .env file: ${varName}=sk_...`
43737
43740
  );
43738
43741
  }
43739
43742
  return key;
43740
43743
  }
43741
43744
  async function apiGet(endpoint, apiUrl = resolveApiUrl()) {
43742
43745
  const response = await fetch(`${apiUrl}${endpoint}`, {
43743
- headers: { Authorization: `Bearer ${getApiKey()}` }
43746
+ headers: { Authorization: `Bearer ${getApiKey(apiUrl)}` }
43744
43747
  });
43745
43748
  if (!response.ok) {
43746
43749
  const errorText = await response.text();
@@ -43758,7 +43761,7 @@ async function apiPost(endpoint, body, apiUrl = resolveApiUrl()) {
43758
43761
  const response = await fetch(`${apiUrl}${endpoint}`, {
43759
43762
  method: "POST",
43760
43763
  headers: {
43761
- Authorization: `Bearer ${getApiKey()}`,
43764
+ Authorization: `Bearer ${getApiKey(apiUrl)}`,
43762
43765
  "Content-Type": "application/json"
43763
43766
  },
43764
43767
  body: JSON.stringify(body)
@@ -43776,7 +43779,7 @@ async function apiPatch(endpoint, body, apiUrl = resolveApiUrl()) {
43776
43779
  const response = await fetch(`${apiUrl}${endpoint}`, {
43777
43780
  method: "PATCH",
43778
43781
  headers: {
43779
- Authorization: `Bearer ${getApiKey()}`,
43782
+ Authorization: `Bearer ${getApiKey(apiUrl)}`,
43780
43783
  "Content-Type": "application/json"
43781
43784
  },
43782
43785
  body: JSON.stringify(body)
@@ -43793,7 +43796,7 @@ async function apiPatch(endpoint, body, apiUrl = resolveApiUrl()) {
43793
43796
  async function apiDelete(endpoint, apiUrl = resolveApiUrl()) {
43794
43797
  const response = await fetch(`${apiUrl}${endpoint}`, {
43795
43798
  method: "DELETE",
43796
- headers: { Authorization: `Bearer ${getApiKey()}` }
43799
+ headers: { Authorization: `Bearer ${getApiKey(apiUrl)}` }
43797
43800
  });
43798
43801
  if (!response.ok) {
43799
43802
  const errorText = await response.text();
@@ -43808,7 +43811,7 @@ async function apiDelete(endpoint, apiUrl = resolveApiUrl()) {
43808
43811
  // package.json
43809
43812
  var package_default = {
43810
43813
  name: "@elevasis/sdk",
43811
- version: "0.5.8",
43814
+ version: "0.5.10",
43812
43815
  description: "SDK for building Elevasis organization resources",
43813
43816
  "comment:bin": "IMPORTANT: This package shares the 'elevasis' binary name with @repo/cli. They never conflict because @elevasis/sdk must NEVER be added as a dependency of any workspace package (apps/*, packages/*, organizations/*). Workspace projects use @repo/cli for the 'elevasis' binary. External developers (outside the workspace) get this SDK's binary via npm install.",
43814
43817
  type: "module",
@@ -45102,7 +45105,7 @@ var import_path3 = require("path");
45102
45105
  var import_promises2 = require("fs/promises");
45103
45106
 
45104
45107
  // src/cli/commands/templates/core/workspace.ts
45105
- var TEMPLATE_VERSION = 22;
45108
+ var TEMPLATE_VERSION = 23;
45106
45109
  function configTemplate() {
45107
45110
  return `import type { ElevasConfig } from '@elevasis/sdk'
45108
45111
 
@@ -45256,6 +45259,10 @@ elevasis exec echo --input '{"message": "hello"}'
45256
45259
  function claudeSettingsTemplate() {
45257
45260
  return JSON.stringify({
45258
45261
  autoCompact: false,
45262
+ statusLine: {
45263
+ type: "command",
45264
+ command: "node .claude/scripts/statusline-command.js"
45265
+ },
45259
45266
  hooks: {
45260
45267
  PreToolUse: [
45261
45268
  {
@@ -45271,6 +45278,29 @@ function claudeSettingsTemplate() {
45271
45278
  }
45272
45279
  }, null, 2) + "\n";
45273
45280
  }
45281
+ function claudeStatuslineScriptTemplate() {
45282
+ return `#!/usr/bin/env node
45283
+ let input = '';
45284
+ process.stdin.on('data', chunk => input += chunk);
45285
+ process.stdin.on('end', () => {
45286
+ const data = JSON.parse(input);
45287
+ const model = data.model?.display_name || '?';
45288
+ const pct = Math.floor(data.context_window?.used_percentage || 0);
45289
+
45290
+ const DIM = '\\x1b[90m', RESET = '\\x1b[0m';
45291
+ const GREEN = '\\x1b[32m', YELLOW = '\\x1b[33m', RED = '\\x1b[31m';
45292
+
45293
+ const color = pct >= 90 ? RED : pct >= 70 ? YELLOW : GREEN;
45294
+
45295
+ const width = 20;
45296
+ const filled = Math.floor(pct * width / 100);
45297
+ const empty = width - filled;
45298
+ const bar = '#'.repeat(filled) + '-'.repeat(empty);
45299
+
45300
+ console.log(\`\${DIM}[\${RESET}\${model}\${DIM}]\${RESET} \${color}\${bar}\${RESET} \${pct}%\`);
45301
+ });
45302
+ `;
45303
+ }
45274
45304
  function claudeSdkBoundaryHookTemplate() {
45275
45305
  return String.raw`#!/usr/bin/env node
45276
45306
  // enforce-sdk-boundary.mjs
@@ -47124,6 +47154,7 @@ function getManagedTemplates(ctx = {}) {
47124
47154
  ".gitignore": () => gitignoreTemplate(ctx),
47125
47155
  "CLAUDE.md": () => claudeMdTemplate(ctx),
47126
47156
  ".claude/settings.json": claudeSettingsTemplate,
47157
+ ".claude/scripts/statusline-command.js": claudeStatuslineScriptTemplate,
47127
47158
  ".claude/hooks/enforce-sdk-boundary.mjs": claudeSdkBoundaryHookTemplate,
47128
47159
  ".claude/commands/tutorial.md": claudeTutorialCommandTemplate,
47129
47160
  ".claude/commands/meta.md": claudeMetaCommandTemplate,
@@ -47938,7 +47969,7 @@ function registerCredsCommand(program3) {
47938
47969
  }
47939
47970
 
47940
47971
  // src/cli/index.ts
47941
- (0, import_dotenv.config)({ path: (0, import_path5.resolve)(process.cwd(), ".env"), override: false });
47972
+ (0, import_dotenv.config)({ path: (0, import_path5.resolve)(process.cwd(), ".env"), override: true });
47942
47973
  var program2 = new Command();
47943
47974
  program2.name("elevasis").description(
47944
47975
  source_default.cyan("Elevasis SDK CLI") + `
package/dist/templates.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
 
3
3
  // src/cli/commands/templates/core/workspace.ts
4
- var TEMPLATE_VERSION = 22;
4
+ var TEMPLATE_VERSION = 23;
5
5
  function configTemplate() {
6
6
  return `import type { ElevasConfig } from '@elevasis/sdk'
7
7
 
@@ -32,6 +32,10 @@ ui/dist/
32
32
  function claudeSettingsTemplate() {
33
33
  return JSON.stringify({
34
34
  autoCompact: false,
35
+ statusLine: {
36
+ type: "command",
37
+ command: "node .claude/scripts/statusline-command.js"
38
+ },
35
39
  hooks: {
36
40
  PreToolUse: [
37
41
  {
@@ -47,6 +51,29 @@ function claudeSettingsTemplate() {
47
51
  }
48
52
  }, null, 2) + "\n";
49
53
  }
54
+ function claudeStatuslineScriptTemplate() {
55
+ return `#!/usr/bin/env node
56
+ let input = '';
57
+ process.stdin.on('data', chunk => input += chunk);
58
+ process.stdin.on('end', () => {
59
+ const data = JSON.parse(input);
60
+ const model = data.model?.display_name || '?';
61
+ const pct = Math.floor(data.context_window?.used_percentage || 0);
62
+
63
+ const DIM = '\\x1b[90m', RESET = '\\x1b[0m';
64
+ const GREEN = '\\x1b[32m', YELLOW = '\\x1b[33m', RED = '\\x1b[31m';
65
+
66
+ const color = pct >= 90 ? RED : pct >= 70 ? YELLOW : GREEN;
67
+
68
+ const width = 20;
69
+ const filled = Math.floor(pct * width / 100);
70
+ const empty = width - filled;
71
+ const bar = '#'.repeat(filled) + '-'.repeat(empty);
72
+
73
+ console.log(\`\${DIM}[\${RESET}\${model}\${DIM}]\${RESET} \${color}\${bar}\${RESET} \${pct}%\`);
74
+ });
75
+ `;
76
+ }
50
77
  function claudeSdkBoundaryHookTemplate() {
51
78
  return String.raw`#!/usr/bin/env node
52
79
  // enforce-sdk-boundary.mjs
@@ -1846,6 +1873,7 @@ function getManagedTemplates(ctx = {}) {
1846
1873
  ".gitignore": () => gitignoreTemplate(ctx),
1847
1874
  "CLAUDE.md": () => claudeMdTemplate(ctx),
1848
1875
  ".claude/settings.json": claudeSettingsTemplate,
1876
+ ".claude/scripts/statusline-command.js": claudeStatuslineScriptTemplate,
1849
1877
  ".claude/hooks/enforce-sdk-boundary.mjs": claudeSdkBoundaryHookTemplate,
1850
1878
  ".claude/commands/tutorial.md": claudeTutorialCommandTemplate,
1851
1879
  ".claude/commands/meta.md": claudeMetaCommandTemplate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elevasis/sdk",
3
- "version": "0.5.8",
3
+ "version": "0.5.10",
4
4
  "description": "SDK for building Elevasis organization resources",
5
5
  "comment:bin": "IMPORTANT: This package shares the 'elevasis' binary name with @repo/cli. They never conflict because @elevasis/sdk must NEVER be added as a dependency of any workspace package (apps/*, packages/*, organizations/*). Workspace projects use @repo/cli for the 'elevasis' binary. External developers (outside the workspace) get this SDK's binary via npm install.",
6
6
  "type": "module",