@elevasis/sdk 0.5.5 → 0.5.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/dist/cli.cjs +46 -22
- package/dist/index.d.ts +1 -1
- package/dist/templates.js +20 -7
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -43706,13 +43706,19 @@ function resolveEnvironment(prod) {
|
|
|
43706
43706
|
if (prod) return "production";
|
|
43707
43707
|
return process.env.NODE_ENV === "development" ? "development" : "production";
|
|
43708
43708
|
}
|
|
43709
|
+
function resolveApiKey(prod) {
|
|
43710
|
+
if (!prod && process.env.NODE_ENV === "development") {
|
|
43711
|
+
return process.env.ELEVASIS_PLATFORM_KEY_DEV ?? process.env.ELEVASIS_PLATFORM_KEY ?? "";
|
|
43712
|
+
}
|
|
43713
|
+
return process.env.ELEVASIS_PLATFORM_KEY ?? "";
|
|
43714
|
+
}
|
|
43709
43715
|
|
|
43710
43716
|
// src/cli/api-client.ts
|
|
43711
43717
|
function getApiKey() {
|
|
43712
|
-
const key = process.env.
|
|
43718
|
+
const key = process.env.ELEVASIS_PLATFORM_KEY;
|
|
43713
43719
|
if (!key) {
|
|
43714
43720
|
throw new Error(
|
|
43715
|
-
"
|
|
43721
|
+
"ELEVASIS_PLATFORM_KEY environment variable is required.\nSet it in your .env file: ELEVASIS_PLATFORM_KEY=sk_..."
|
|
43716
43722
|
);
|
|
43717
43723
|
}
|
|
43718
43724
|
return key;
|
|
@@ -43724,7 +43730,7 @@ async function apiGet(endpoint, apiUrl = resolveApiUrl()) {
|
|
|
43724
43730
|
if (!response.ok) {
|
|
43725
43731
|
const errorText = await response.text();
|
|
43726
43732
|
if (response.status === 401) {
|
|
43727
|
-
throw new Error(`401 Unauthorized: Invalid or missing
|
|
43733
|
+
throw new Error(`401 Unauthorized: Invalid or missing ELEVASIS_PLATFORM_KEY. Check your .env file.`);
|
|
43728
43734
|
}
|
|
43729
43735
|
throw new Error(`API request failed (${response.status}): ${errorText}`);
|
|
43730
43736
|
}
|
|
@@ -43787,7 +43793,7 @@ async function apiDelete(endpoint, apiUrl = resolveApiUrl()) {
|
|
|
43787
43793
|
// package.json
|
|
43788
43794
|
var package_default = {
|
|
43789
43795
|
name: "@elevasis/sdk",
|
|
43790
|
-
version: "0.5.
|
|
43796
|
+
version: "0.5.7",
|
|
43791
43797
|
description: "SDK for building Elevasis organization resources",
|
|
43792
43798
|
"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.",
|
|
43793
43799
|
type: "module",
|
|
@@ -44287,7 +44293,7 @@ async function generateProjectMap(org) {
|
|
|
44287
44293
|
let nodeEnv = "not set";
|
|
44288
44294
|
try {
|
|
44289
44295
|
const envContent = await (0, import_promises.readFile)((0, import_path.resolve)(".env"), "utf-8");
|
|
44290
|
-
const apiKeyMatch = envContent.match(/^
|
|
44296
|
+
const apiKeyMatch = envContent.match(/^ELEVASIS_PLATFORM_KEY=(.+)$/m);
|
|
44291
44297
|
if (apiKeyMatch && apiKeyMatch[1].trim()) apiKeySet = "yes";
|
|
44292
44298
|
const nodeEnvMatch = envContent.match(/^NODE_ENV=(.+)$/m);
|
|
44293
44299
|
if (nodeEnvMatch && nodeEnvMatch[1].trim()) nodeEnv = nodeEnvMatch[1].trim();
|
|
@@ -44323,11 +44329,12 @@ function registerDeployCommand(program3) {
|
|
|
44323
44329
|
authSpinner.fail(source_default.red("Authentication failed"));
|
|
44324
44330
|
const errMsg = error46 instanceof Error ? error46.message : String(error46);
|
|
44325
44331
|
if (errMsg.includes("401") || errMsg.toLowerCase().includes("unauthorized")) {
|
|
44332
|
+
const keyVar = !options2.prod && process.env.NODE_ENV === "development" && process.env.ELEVASIS_PLATFORM_KEY_DEV ? "ELEVASIS_PLATFORM_KEY_DEV" : "ELEVASIS_PLATFORM_KEY";
|
|
44326
44333
|
console.error(source_default.red(" Invalid API key."));
|
|
44327
|
-
console.error(source_default.gray(
|
|
44334
|
+
console.error(source_default.gray(` Your ${keyVar} was rejected by the server.`));
|
|
44328
44335
|
console.error(source_default.gray(" Check your .env file and verify the key in the Elevasis dashboard."));
|
|
44329
44336
|
} else {
|
|
44330
|
-
console.error(source_default.gray(" Check your
|
|
44337
|
+
console.error(source_default.gray(" Check your API key and API URL."));
|
|
44331
44338
|
}
|
|
44332
44339
|
throw error46;
|
|
44333
44340
|
}
|
|
@@ -44462,7 +44469,7 @@ startWorker(org)
|
|
|
44462
44469
|
entryPoints: [wrapperPath],
|
|
44463
44470
|
bundle: true,
|
|
44464
44471
|
platform: "node",
|
|
44465
|
-
format: "
|
|
44472
|
+
format: "cjs",
|
|
44466
44473
|
outfile: bundleOutfile
|
|
44467
44474
|
});
|
|
44468
44475
|
await (0, import_promises.unlink)(wrapperPath);
|
|
@@ -44482,12 +44489,16 @@ startWorker(org)
|
|
|
44482
44489
|
const uploadSpinner = ora("Uploading...").start();
|
|
44483
44490
|
try {
|
|
44484
44491
|
const bundleBuffer = await (0, import_promises.readFile)(bundleOutfile);
|
|
44485
|
-
const apiKey =
|
|
44492
|
+
const apiKey = resolveApiKey(options2.prod);
|
|
44486
44493
|
if (!apiKey) {
|
|
44487
|
-
uploadSpinner.fail(source_default.red("Missing
|
|
44494
|
+
uploadSpinner.fail(source_default.red("Missing API key environment variable"));
|
|
44488
44495
|
console.error(source_default.gray(" Set it in your .env file or shell environment:"));
|
|
44489
|
-
|
|
44490
|
-
|
|
44496
|
+
if (!options2.prod && process.env.NODE_ENV === "development") {
|
|
44497
|
+
console.error(source_default.gray(" ELEVASIS_PLATFORM_KEY_DEV=sk_... (or ELEVASIS_PLATFORM_KEY as fallback)"));
|
|
44498
|
+
} else {
|
|
44499
|
+
console.error(source_default.gray(" ELEVASIS_PLATFORM_KEY=sk_..."));
|
|
44500
|
+
}
|
|
44501
|
+
throw new Error("Missing API key environment variable");
|
|
44491
44502
|
}
|
|
44492
44503
|
const metadata = {
|
|
44493
44504
|
sdkVersion: SDK_VERSION,
|
|
@@ -45128,11 +45139,11 @@ function tsconfigTemplate() {
|
|
|
45128
45139
|
}, null, 2) + "\n";
|
|
45129
45140
|
}
|
|
45130
45141
|
function envTemplate() {
|
|
45131
|
-
return `
|
|
45142
|
+
return `ELEVASIS_PLATFORM_KEY=
|
|
45132
45143
|
`;
|
|
45133
45144
|
}
|
|
45134
45145
|
function envExampleTemplate() {
|
|
45135
|
-
return `
|
|
45146
|
+
return `ELEVASIS_PLATFORM_KEY=sk_your_key_here
|
|
45136
45147
|
`;
|
|
45137
45148
|
}
|
|
45138
45149
|
function npmrcTemplate() {
|
|
@@ -45174,7 +45185,7 @@ pnpm install
|
|
|
45174
45185
|
Copy \`.env.example\` to \`.env\` and add your API key:
|
|
45175
45186
|
|
|
45176
45187
|
\`\`\`
|
|
45177
|
-
|
|
45188
|
+
ELEVASIS_PLATFORM_KEY=sk_...
|
|
45178
45189
|
\`\`\`
|
|
45179
45190
|
|
|
45180
45191
|
## Development
|
|
@@ -45426,7 +45437,7 @@ proactivity -- to their assessed levels.
|
|
|
45426
45437
|
| Workspace concepts | \`reference/concepts/index.mdx\` | User asks "what is...?" or needs conceptual grounding |
|
|
45427
45438
|
| SDK patterns and examples | \`reference/resources/patterns.mdx\` | Building or modifying a workflow |
|
|
45428
45439
|
| Platform tool catalog | \`reference/platform-tools/index.mdx\` | Connecting to external services |
|
|
45429
|
-
| CLI reference | \`reference/cli/index.mdx\` | Running
|
|
45440
|
+
| CLI reference | \`reference/cli/index.mdx\` | Running execution/platform operations |
|
|
45430
45441
|
| Credential model | \`reference/security/credentials.mdx\` | Setting up integrations or tool access |
|
|
45431
45442
|
| Interaction guidance | \`reference/developer/interaction-guidance.mdx\` | Unsure how to adapt for a skill combination |
|
|
45432
45443
|
| Error history | \`.claude/memory/errors/index.md\` | Debugging errors, checking past fixes |
|
|
@@ -45442,6 +45453,19 @@ proactivity -- to their assessed levels.
|
|
|
45442
45453
|
|
|
45443
45454
|
All \`reference/\` paths resolve to \`node_modules/@elevasis/sdk/reference/\`.
|
|
45444
45455
|
|
|
45456
|
+
## Elevasis CLI
|
|
45457
|
+
|
|
45458
|
+
**MANDATORY:** Use the \`elevasis\` CLI for all execution/platform operations -- never \`npx\`, \`curl\`, or any other tool.
|
|
45459
|
+
|
|
45460
|
+
- \`elevasis exec <resource-id> --input '{...}'\` -- run a resource synchronously
|
|
45461
|
+
- \`elevasis exec <resource-id> --input '{...}' --async\` -- run async, returns execution ID
|
|
45462
|
+
- \`elevasis execution <resource-id> <execution-id>\` -- inspect execution detail
|
|
45463
|
+
- \`elevasis check\` -- validate resource definitions without deploying
|
|
45464
|
+
- \`elevasis deploy\` -- deploy to the platform
|
|
45465
|
+
|
|
45466
|
+
Organization is derived from your API key -- no org prefix needed in the resource ID.
|
|
45467
|
+
For full CLI reference: \`reference/cli/index.mdx\`
|
|
45468
|
+
|
|
45445
45469
|
## Rules
|
|
45446
45470
|
|
|
45447
45471
|
SDK patterns (imports, source structure, platform tools) are auto-loaded from
|
|
@@ -46091,14 +46115,14 @@ by the \`<!-- initialized: false -->\` flag in CLAUDE.md, or run manually.
|
|
|
46091
46115
|
Run \`pnpm install\`. Wait for completion. Report any errors.
|
|
46092
46116
|
|
|
46093
46117
|
2. **Setup environment**
|
|
46094
|
-
Read \`.env\`. It should contain only a single line: \`
|
|
46095
|
-
If \`
|
|
46118
|
+
Read \`.env\`. It should contain only a single line: \`ELEVASIS_PLATFORM_KEY=\`.
|
|
46119
|
+
If \`ELEVASIS_PLATFORM_KEY\` is empty or missing, ask the user: "What is your
|
|
46096
46120
|
Elevasis API key?" When the user provides it, write \`.env\` with exactly:
|
|
46097
46121
|
\`\`\`
|
|
46098
|
-
|
|
46122
|
+
ELEVASIS_PLATFORM_KEY=<value they provided>
|
|
46099
46123
|
\`\`\`
|
|
46100
46124
|
No other keys (no \`NODE_ENV\`, no extras). The \`.env\` file must contain
|
|
46101
|
-
only \`
|
|
46125
|
+
only \`ELEVASIS_PLATFORM_KEY\`.
|
|
46102
46126
|
Validate the key works: run \`elevasis resources\` (should return an empty
|
|
46103
46127
|
list, not an auth error). If auth fails, tell the user their key appears
|
|
46104
46128
|
invalid and ask them to check it in the Elevasis dashboard.
|
|
@@ -46586,7 +46610,7 @@ organization. They are used by workflows and agents at runtime via \`platform.ge
|
|
|
46586
46610
|
or the \`credential:\` field on tool steps.
|
|
46587
46611
|
|
|
46588
46612
|
The SDK CLI (\`elevasis-sdk creds\`) manages credentials via API key authentication.
|
|
46589
|
-
Your \`
|
|
46613
|
+
Your \`ELEVASIS_PLATFORM_KEY\` in \`.env\` determines the organization.
|
|
46590
46614
|
|
|
46591
46615
|
## Credential Types
|
|
46592
46616
|
|
|
@@ -46686,7 +46710,7 @@ description: Elevasis SDK patterns -- imports, source structure, runtime, and pl
|
|
|
46686
46710
|
|
|
46687
46711
|
## Runtime
|
|
46688
46712
|
|
|
46689
|
-
- \`.env\` contains only \`
|
|
46713
|
+
- \`.env\` contains only \`ELEVASIS_PLATFORM_KEY\` for CLI auth -- never deployed, never in worker memory
|
|
46690
46714
|
- Integration credentials are managed via the \`creds\` skill or Command Center UI
|
|
46691
46715
|
|
|
46692
46716
|
## Platform Tools
|
package/dist/index.d.ts
CHANGED
|
@@ -6320,7 +6320,7 @@ type ResourceStatus = 'dev' | 'prod';
|
|
|
6320
6320
|
/**
|
|
6321
6321
|
* Project configuration for an external developer project.
|
|
6322
6322
|
* Defined in elevasis.config.ts at the project root.
|
|
6323
|
-
* Organization is derived from the
|
|
6323
|
+
* Organization is derived from the ELEVASIS_PLATFORM_KEY -- not configured here.
|
|
6324
6324
|
*/
|
|
6325
6325
|
interface ElevasConfig {
|
|
6326
6326
|
/** Managed by `elevasis init` and `elevasis update`. Do not set manually. */
|
package/dist/templates.js
CHANGED
|
@@ -228,7 +228,7 @@ proactivity -- to their assessed levels.
|
|
|
228
228
|
| Workspace concepts | \`reference/concepts/index.mdx\` | User asks "what is...?" or needs conceptual grounding |
|
|
229
229
|
| SDK patterns and examples | \`reference/resources/patterns.mdx\` | Building or modifying a workflow |
|
|
230
230
|
| Platform tool catalog | \`reference/platform-tools/index.mdx\` | Connecting to external services |
|
|
231
|
-
| CLI reference | \`reference/cli/index.mdx\` | Running
|
|
231
|
+
| CLI reference | \`reference/cli/index.mdx\` | Running execution/platform operations |
|
|
232
232
|
| Credential model | \`reference/security/credentials.mdx\` | Setting up integrations or tool access |
|
|
233
233
|
| Interaction guidance | \`reference/developer/interaction-guidance.mdx\` | Unsure how to adapt for a skill combination |
|
|
234
234
|
| Error history | \`.claude/memory/errors/index.md\` | Debugging errors, checking past fixes |
|
|
@@ -244,6 +244,19 @@ proactivity -- to their assessed levels.
|
|
|
244
244
|
|
|
245
245
|
All \`reference/\` paths resolve to \`node_modules/@elevasis/sdk/reference/\`.
|
|
246
246
|
|
|
247
|
+
## Elevasis CLI
|
|
248
|
+
|
|
249
|
+
**MANDATORY:** Use the \`elevasis\` CLI for all execution/platform operations -- never \`npx\`, \`curl\`, or any other tool.
|
|
250
|
+
|
|
251
|
+
- \`elevasis exec <resource-id> --input '{...}'\` -- run a resource synchronously
|
|
252
|
+
- \`elevasis exec <resource-id> --input '{...}' --async\` -- run async, returns execution ID
|
|
253
|
+
- \`elevasis execution <resource-id> <execution-id>\` -- inspect execution detail
|
|
254
|
+
- \`elevasis check\` -- validate resource definitions without deploying
|
|
255
|
+
- \`elevasis deploy\` -- deploy to the platform
|
|
256
|
+
|
|
257
|
+
Organization is derived from your API key -- no org prefix needed in the resource ID.
|
|
258
|
+
For full CLI reference: \`reference/cli/index.mdx\`
|
|
259
|
+
|
|
247
260
|
## Rules
|
|
248
261
|
|
|
249
262
|
SDK patterns (imports, source structure, platform tools) are auto-loaded from
|
|
@@ -893,14 +906,14 @@ by the \`<!-- initialized: false -->\` flag in CLAUDE.md, or run manually.
|
|
|
893
906
|
Run \`pnpm install\`. Wait for completion. Report any errors.
|
|
894
907
|
|
|
895
908
|
2. **Setup environment**
|
|
896
|
-
Read \`.env\`. It should contain only a single line: \`
|
|
897
|
-
If \`
|
|
909
|
+
Read \`.env\`. It should contain only a single line: \`ELEVASIS_PLATFORM_KEY=\`.
|
|
910
|
+
If \`ELEVASIS_PLATFORM_KEY\` is empty or missing, ask the user: "What is your
|
|
898
911
|
Elevasis API key?" When the user provides it, write \`.env\` with exactly:
|
|
899
912
|
\`\`\`
|
|
900
|
-
|
|
913
|
+
ELEVASIS_PLATFORM_KEY=<value they provided>
|
|
901
914
|
\`\`\`
|
|
902
915
|
No other keys (no \`NODE_ENV\`, no extras). The \`.env\` file must contain
|
|
903
|
-
only \`
|
|
916
|
+
only \`ELEVASIS_PLATFORM_KEY\`.
|
|
904
917
|
Validate the key works: run \`elevasis resources\` (should return an empty
|
|
905
918
|
list, not an auth error). If auth fails, tell the user their key appears
|
|
906
919
|
invalid and ask them to check it in the Elevasis dashboard.
|
|
@@ -1388,7 +1401,7 @@ organization. They are used by workflows and agents at runtime via \`platform.ge
|
|
|
1388
1401
|
or the \`credential:\` field on tool steps.
|
|
1389
1402
|
|
|
1390
1403
|
The SDK CLI (\`elevasis-sdk creds\`) manages credentials via API key authentication.
|
|
1391
|
-
Your \`
|
|
1404
|
+
Your \`ELEVASIS_PLATFORM_KEY\` in \`.env\` determines the organization.
|
|
1392
1405
|
|
|
1393
1406
|
## Credential Types
|
|
1394
1407
|
|
|
@@ -1488,7 +1501,7 @@ description: Elevasis SDK patterns -- imports, source structure, runtime, and pl
|
|
|
1488
1501
|
|
|
1489
1502
|
## Runtime
|
|
1490
1503
|
|
|
1491
|
-
- \`.env\` contains only \`
|
|
1504
|
+
- \`.env\` contains only \`ELEVASIS_PLATFORM_KEY\` for CLI auth -- never deployed, never in worker memory
|
|
1492
1505
|
- Integration credentials are managed via the \`creds\` skill or Command Center UI
|
|
1493
1506
|
|
|
1494
1507
|
## Platform Tools
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elevasis/sdk",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.7",
|
|
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",
|