@elevasis/sdk 0.4.8 → 0.4.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 +656 -46
- package/dist/index.d.ts +4343 -3
- package/dist/templates.js +156 -33
- package/dist/types/templates.d.ts +1 -1
- package/dist/types/worker/index.d.ts +8 -2
- package/dist/worker/index.js +350 -28
- package/package.json +1 -1
- package/reference/_navigation.md +60 -58
- package/reference/deployment/command-view.mdx +154 -0
- package/reference/framework/index.mdx +1 -1
- package/reference/framework/project-structure.mdx +34 -15
- package/reference/getting-started/index.mdx +12 -6
- package/reference/platform-tools/adapters.mdx +927 -0
- package/reference/platform-tools/examples.mdx +89 -106
- package/reference/platform-tools/index.mdx +61 -47
- package/reference/resources/patterns.mdx +23 -10
- package/reference/troubleshooting/common-errors.mdx +1 -1
- package/reference/_index.md +0 -95
package/dist/cli.cjs
CHANGED
|
@@ -43780,9 +43780,106 @@ async function apiPost(endpoint, body, apiUrl = resolveApiUrl()) {
|
|
|
43780
43780
|
}
|
|
43781
43781
|
return response.json();
|
|
43782
43782
|
}
|
|
43783
|
+
async function apiPatch(endpoint, body, apiUrl = resolveApiUrl()) {
|
|
43784
|
+
const response = await fetch(`${apiUrl}${endpoint}`, {
|
|
43785
|
+
method: "PATCH",
|
|
43786
|
+
headers: {
|
|
43787
|
+
Authorization: `Bearer ${getApiKey()}`,
|
|
43788
|
+
"Content-Type": "application/json"
|
|
43789
|
+
},
|
|
43790
|
+
body: JSON.stringify(body)
|
|
43791
|
+
});
|
|
43792
|
+
if (!response.ok) {
|
|
43793
|
+
const errorText = await response.text();
|
|
43794
|
+
throw new Error(`API request failed (${response.status}): ${errorText}`);
|
|
43795
|
+
}
|
|
43796
|
+
if (response.status === 204) {
|
|
43797
|
+
return {};
|
|
43798
|
+
}
|
|
43799
|
+
return response.json();
|
|
43800
|
+
}
|
|
43801
|
+
async function apiDelete(endpoint, apiUrl = resolveApiUrl()) {
|
|
43802
|
+
const response = await fetch(`${apiUrl}${endpoint}`, {
|
|
43803
|
+
method: "DELETE",
|
|
43804
|
+
headers: { Authorization: `Bearer ${getApiKey()}` }
|
|
43805
|
+
});
|
|
43806
|
+
if (!response.ok) {
|
|
43807
|
+
const errorText = await response.text();
|
|
43808
|
+
throw new Error(`API request failed (${response.status}): ${errorText}`);
|
|
43809
|
+
}
|
|
43810
|
+
if (response.status === 204) {
|
|
43811
|
+
return {};
|
|
43812
|
+
}
|
|
43813
|
+
return response.json();
|
|
43814
|
+
}
|
|
43815
|
+
|
|
43816
|
+
// package.json
|
|
43817
|
+
var package_default = {
|
|
43818
|
+
name: "@elevasis/sdk",
|
|
43819
|
+
version: "0.4.9",
|
|
43820
|
+
description: "SDK for building Elevasis organization resources",
|
|
43821
|
+
"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.",
|
|
43822
|
+
type: "module",
|
|
43823
|
+
bin: {
|
|
43824
|
+
elevasis: "./dist/cli.cjs",
|
|
43825
|
+
"elevasis-sdk": "./dist/cli.cjs"
|
|
43826
|
+
},
|
|
43827
|
+
exports: {
|
|
43828
|
+
".": {
|
|
43829
|
+
types: "./dist/index.d.ts",
|
|
43830
|
+
import: "./dist/index.js"
|
|
43831
|
+
},
|
|
43832
|
+
"./worker": {
|
|
43833
|
+
types: "./dist/types/worker/index.d.ts",
|
|
43834
|
+
import: "./dist/worker/index.js"
|
|
43835
|
+
},
|
|
43836
|
+
"./templates": {
|
|
43837
|
+
types: "./dist/types/templates.d.ts",
|
|
43838
|
+
import: "./dist/templates.js"
|
|
43839
|
+
}
|
|
43840
|
+
},
|
|
43841
|
+
files: [
|
|
43842
|
+
"dist/index.js",
|
|
43843
|
+
"dist/index.d.ts",
|
|
43844
|
+
"dist/worker/index.js",
|
|
43845
|
+
"dist/types/worker/index.d.ts",
|
|
43846
|
+
"dist/types/worker/platform.d.ts",
|
|
43847
|
+
"dist/cli.cjs",
|
|
43848
|
+
"dist/templates.js",
|
|
43849
|
+
"dist/types/templates.d.ts",
|
|
43850
|
+
"reference/"
|
|
43851
|
+
],
|
|
43852
|
+
scripts: {
|
|
43853
|
+
build: `node -e "require('fs').rmSync('dist',{recursive:true,force:true})" && tsc -p tsconfig.core-dts.json && tsc -p tsconfig.build.json && tsup && rollup -c rollup.dts.config.mjs && esbuild src/cli/index.ts --bundle --platform=node --outfile=dist/cli.cjs --format=cjs --external:esbuild --external:jiti --banner:js="#!/usr/bin/env node" && node scripts/copy-reference-docs.mjs && node scripts/generate-navigation.mjs`,
|
|
43854
|
+
"check-types": "tsc --noEmit",
|
|
43855
|
+
"test:bundle": "pnpm build && vitest run --config vitest.bundle.config.ts"
|
|
43856
|
+
},
|
|
43857
|
+
dependencies: {
|
|
43858
|
+
esbuild: "^0.25.0",
|
|
43859
|
+
jiti: "^2.0.0"
|
|
43860
|
+
},
|
|
43861
|
+
peerDependencies: {
|
|
43862
|
+
zod: "^4.1.0"
|
|
43863
|
+
},
|
|
43864
|
+
devDependencies: {
|
|
43865
|
+
"@repo/core": "workspace:*",
|
|
43866
|
+
"@repo/typescript-config": "workspace:*",
|
|
43867
|
+
"@types/node": "^22.0.0",
|
|
43868
|
+
chalk: "^5.3.0",
|
|
43869
|
+
commander: "^11.0.0",
|
|
43870
|
+
dotenv: "^16.0.0",
|
|
43871
|
+
"gray-matter": "^4.0.3",
|
|
43872
|
+
ora: "^7.0.1",
|
|
43873
|
+
rollup: "^4.59.0",
|
|
43874
|
+
"rollup-plugin-dts": "^6.3.0",
|
|
43875
|
+
tsup: "^8.0.0",
|
|
43876
|
+
typescript: "5.9.2",
|
|
43877
|
+
zod: "^4.1.0"
|
|
43878
|
+
}
|
|
43879
|
+
};
|
|
43783
43880
|
|
|
43784
43881
|
// src/cli/version.ts
|
|
43785
|
-
var SDK_VERSION =
|
|
43882
|
+
var SDK_VERSION = package_default.version;
|
|
43786
43883
|
|
|
43787
43884
|
// src/cli/commands/deploy.ts
|
|
43788
43885
|
var import_meta2 = {};
|
|
@@ -44433,7 +44530,7 @@ function registerDescribeCommand(program3) {
|
|
|
44433
44530
|
// src/cli/commands/init.ts
|
|
44434
44531
|
var import_path3 = require("path");
|
|
44435
44532
|
var import_promises2 = require("fs/promises");
|
|
44436
|
-
var TEMPLATE_VERSION =
|
|
44533
|
+
var TEMPLATE_VERSION = 9;
|
|
44437
44534
|
var INIT_ONLY_FILES = [
|
|
44438
44535
|
"package.json",
|
|
44439
44536
|
"pnpm-workspace.yaml",
|
|
@@ -44442,7 +44539,11 @@ var INIT_ONLY_FILES = [
|
|
|
44442
44539
|
".env.example",
|
|
44443
44540
|
".npmrc",
|
|
44444
44541
|
"src/index.ts",
|
|
44445
|
-
"src/
|
|
44542
|
+
"src/operations/platform-status.ts",
|
|
44543
|
+
"src/operations/index.ts",
|
|
44544
|
+
"src/example/echo.ts",
|
|
44545
|
+
"src/example/index.ts",
|
|
44546
|
+
"src/shared/.gitkeep",
|
|
44446
44547
|
"docs/index.mdx",
|
|
44447
44548
|
"docs/in-progress/.gitkeep"
|
|
44448
44549
|
];
|
|
@@ -44459,7 +44560,9 @@ var MANAGED_FILES = [
|
|
|
44459
44560
|
".claude/commands/database.md",
|
|
44460
44561
|
".claude/commands/agent.md",
|
|
44461
44562
|
".claude/commands/profile.md",
|
|
44462
|
-
".claude/commands/meta.md"
|
|
44563
|
+
".claude/commands/meta.md",
|
|
44564
|
+
".claude/commands/work.md",
|
|
44565
|
+
".claude/skills/creds/SKILL.md"
|
|
44463
44566
|
];
|
|
44464
44567
|
var SCAFFOLD_FILES = [...INIT_ONLY_FILES, ...MANAGED_FILES];
|
|
44465
44568
|
function registerInitCommand(program3) {
|
|
@@ -44484,9 +44587,12 @@ function registerInitCommand(program3) {
|
|
|
44484
44587
|
throw new Error("Scaffold conflict");
|
|
44485
44588
|
}
|
|
44486
44589
|
}
|
|
44487
|
-
await (0, import_promises2.mkdir)((0, import_path3.resolve)(targetDir, "src/
|
|
44590
|
+
await (0, import_promises2.mkdir)((0, import_path3.resolve)(targetDir, "src/operations"), { recursive: true });
|
|
44591
|
+
await (0, import_promises2.mkdir)((0, import_path3.resolve)(targetDir, "src/example"), { recursive: true });
|
|
44592
|
+
await (0, import_promises2.mkdir)((0, import_path3.resolve)(targetDir, "src/shared"), { recursive: true });
|
|
44488
44593
|
await (0, import_promises2.mkdir)((0, import_path3.resolve)(targetDir, "docs/in-progress"), { recursive: true });
|
|
44489
44594
|
await (0, import_promises2.mkdir)((0, import_path3.resolve)(targetDir, ".claude/commands"), { recursive: true });
|
|
44595
|
+
await (0, import_promises2.mkdir)((0, import_path3.resolve)(targetDir, ".claude/skills/creds"), { recursive: true });
|
|
44490
44596
|
const files = {
|
|
44491
44597
|
"elevasis.config.ts": configTemplate(),
|
|
44492
44598
|
"package.json": packageJsonTemplate(orgSlug),
|
|
@@ -44497,7 +44603,11 @@ function registerInitCommand(program3) {
|
|
|
44497
44603
|
".npmrc": npmrcTemplate(),
|
|
44498
44604
|
".gitignore": gitignoreTemplate(),
|
|
44499
44605
|
"src/index.ts": starterTemplate(),
|
|
44500
|
-
"src/
|
|
44606
|
+
"src/operations/platform-status.ts": platformStatusTemplate(),
|
|
44607
|
+
"src/operations/index.ts": operationsBarrelTemplate(),
|
|
44608
|
+
"src/example/echo.ts": starterWorkflowTemplate(),
|
|
44609
|
+
"src/example/index.ts": exampleBarrelTemplate(),
|
|
44610
|
+
"src/shared/.gitkeep": "",
|
|
44501
44611
|
"docs/index.mdx": docsIndexTemplate(orgSlug),
|
|
44502
44612
|
"docs/in-progress/.gitkeep": "",
|
|
44503
44613
|
"CLAUDE.md": claudeMdTemplate(),
|
|
@@ -44510,7 +44620,9 @@ function registerInitCommand(program3) {
|
|
|
44510
44620
|
".claude/commands/database.md": claudeDatabaseCommandTemplate(),
|
|
44511
44621
|
".claude/commands/agent.md": claudeAgentCommandTemplate(),
|
|
44512
44622
|
".claude/commands/profile.md": claudeProfileCommandTemplate(),
|
|
44513
|
-
".claude/commands/meta.md": claudeMetaCommandTemplate()
|
|
44623
|
+
".claude/commands/meta.md": claudeMetaCommandTemplate(),
|
|
44624
|
+
".claude/commands/work.md": claudeWorkCommandTemplate(),
|
|
44625
|
+
".claude/skills/creds/SKILL.md": claudeCredsSkillTemplate()
|
|
44514
44626
|
};
|
|
44515
44627
|
for (const [filePath, content] of Object.entries(files)) {
|
|
44516
44628
|
await (0, import_promises2.writeFile)((0, import_path3.resolve)(targetDir, filePath), content, "utf-8");
|
|
@@ -44638,17 +44750,31 @@ elevasis executions <resourceId> # View execution history
|
|
|
44638
44750
|
## Project Structure
|
|
44639
44751
|
|
|
44640
44752
|
- \`elevasis.config.ts\` -- Workspace config (optional settings)
|
|
44641
|
-
- \`src/index.ts\` -- Resource registry (
|
|
44642
|
-
- \`src/
|
|
44753
|
+
- \`src/index.ts\` -- Resource registry (aggregates from domain barrels)
|
|
44754
|
+
- \`src/operations/\` -- Operations domain (platform-status workflow)
|
|
44755
|
+
- \`src/example/\` -- Example domain (echo workflow -- replace with your own)
|
|
44756
|
+
- \`src/shared/\` -- Cross-domain shared types and utilities
|
|
44643
44757
|
- \`docs/\` -- Documentation (.mdx files, deployed alongside code)
|
|
44644
44758
|
- \`.env\` -- API key for CLI authentication
|
|
44645
44759
|
|
|
44646
44760
|
## Resources
|
|
44647
44761
|
|
|
44648
|
-
###
|
|
44762
|
+
### Platform Status Workflow (\`src/operations/\`)
|
|
44763
|
+
|
|
44764
|
+
A multi-step workflow that queries platform status and compiles a natural language
|
|
44765
|
+
summary using an LLM. Demonstrates platform API usage with the \`llm\` typed adapter and \`platform.call()\`.
|
|
44766
|
+
|
|
44767
|
+
\`\`\`bash
|
|
44768
|
+
elevasis exec platform-status --input '{"timeRange": "24h"}'
|
|
44769
|
+
\`\`\`
|
|
44770
|
+
|
|
44771
|
+
**Input:** \`{ "timeRange": "1h" | "24h" | "7d" }\`
|
|
44772
|
+
**Output:** \`{ "raw": object, "summary": string }\`
|
|
44773
|
+
|
|
44774
|
+
### Echo Workflow (\`src/example/\`)
|
|
44649
44775
|
|
|
44650
|
-
A simple workflow that echoes the input message back. Use it
|
|
44651
|
-
|
|
44776
|
+
A simple workflow that echoes the input message back. Use it as a starter pattern
|
|
44777
|
+
for new workflows:
|
|
44652
44778
|
|
|
44653
44779
|
\`\`\`bash
|
|
44654
44780
|
elevasis exec echo --input '{"message": "hello"}'
|
|
@@ -44709,6 +44835,7 @@ proactivity -- to their assessed levels.
|
|
|
44709
44835
|
| Credential model | \`reference/security/credentials.mdx\` | Setting up integrations or tool access |
|
|
44710
44836
|
| Interaction guidance | \`reference/developer/interaction-guidance.mdx\` | Unsure how to adapt for a skill combination |
|
|
44711
44837
|
| Error history | \`.claude/memory/errors/index.md\` | Debugging errors, checking past fixes |
|
|
44838
|
+
| Command View model | \`reference/deployment/command-view.mdx\` | Deploying or building resources that invoke other resources |
|
|
44712
44839
|
| SDK error reference | \`reference/troubleshooting/common-errors.mdx\` | Unknown error not in workspace memory |
|
|
44713
44840
|
| Project resource map | \`docs/navigation.mdx\` | Understanding what's deployed |
|
|
44714
44841
|
| Project priorities | \`docs/priorities.mdx\` | Deciding what to work on next |
|
|
@@ -44720,12 +44847,15 @@ All \`reference/\` paths resolve to \`node_modules/@elevasis/sdk/reference/\`.
|
|
|
44720
44847
|
## Rules
|
|
44721
44848
|
|
|
44722
44849
|
- All resource definitions must be in \`src/\` and exported via \`src/index.ts\`
|
|
44850
|
+
- Organize resources by business domain (e.g., src/operations/, src/acquisition/)
|
|
44851
|
+
- Each domain exports \`workflows\` and \`agents\` arrays via an index.ts barrel
|
|
44852
|
+
- src/shared/ is for cross-domain utilities; domain-specific shared code goes in <domain>/shared/
|
|
44723
44853
|
- The default export must be an \`OrganizationResources\` object
|
|
44724
44854
|
- Do not import from \`@repo/core\` -- use \`@elevasis/sdk\` types only
|
|
44725
44855
|
- \`StepType\`, \`ExecutionError\`, \`ToolingError\` are runtime imports from \`'@elevasis/sdk'\`
|
|
44726
44856
|
- \`platform\`, \`PlatformToolError\` are runtime imports from \`'@elevasis/sdk/worker'\`
|
|
44727
44857
|
- \`.env\` is for CLI authentication only (\`ELEVASIS_API_KEY\`) -- never deployed, never in workers
|
|
44728
|
-
- Integration credentials are managed via the
|
|
44858
|
+
- Integration credentials are managed via the \`creds\` skill (auto-triggers when you mention credentials) or the Command Center UI
|
|
44729
44859
|
- Documentation goes in \`docs/\` as \`.mdx\` files
|
|
44730
44860
|
- \`dist/\` is generated by deploy -- never commit it
|
|
44731
44861
|
- \`resourceId\` must be lowercase with hyphens, unique per organization
|
|
@@ -44759,7 +44889,8 @@ For detailed per-dimension adaptation rules, read
|
|
|
44759
44889
|
| Command | Purpose |
|
|
44760
44890
|
| --- | --- |
|
|
44761
44891
|
| \`/meta\` | Project lifecycle: init, status, update, fix, deploy, health, develop |
|
|
44762
|
-
| \`/docs\` | Documentation lifecycle: create,
|
|
44892
|
+
| \`/docs\` | Documentation lifecycle: create, review, verify |
|
|
44893
|
+
| \`/work\` | Task tracking: start, save, resume, done, list |
|
|
44763
44894
|
| \`/database\` | Database operations: init, browse, query, schema, import |
|
|
44764
44895
|
| \`/resource\` | Scaffold a new workflow or agent |
|
|
44765
44896
|
| \`/templates\` | Discover and apply workflow templates |
|
|
@@ -44768,6 +44899,14 @@ For detailed per-dimension adaptation rules, read
|
|
|
44768
44899
|
| \`/help\` | Command tree and navigation map |
|
|
44769
44900
|
| \`/profile\` | View and update developer profile |
|
|
44770
44901
|
|
|
44902
|
+
## Skills
|
|
44903
|
+
|
|
44904
|
+
Skills auto-trigger based on conversation context. You do not need to invoke them manually.
|
|
44905
|
+
|
|
44906
|
+
| Skill | Triggers When |
|
|
44907
|
+
| --- | --- |
|
|
44908
|
+
| \`creds\` | You mention credentials, API keys, secrets, webhook secrets, or setting up integrations |
|
|
44909
|
+
|
|
44771
44910
|
## Maintaining Memory
|
|
44772
44911
|
|
|
44773
44912
|
### What Memory Is
|
|
@@ -44812,7 +44951,7 @@ You are a documentation assistant for this Elevasis workspace.
|
|
|
44812
44951
|
## Context
|
|
44813
44952
|
|
|
44814
44953
|
Read the project's CLAUDE.md and all files in docs/ to understand the project.
|
|
44815
|
-
Read src/index.ts and src/
|
|
44954
|
+
Read src/index.ts and the domain directories (src/operations/, src/example/, etc.) to understand the resource definitions.
|
|
44816
44955
|
|
|
44817
44956
|
## Operations
|
|
44818
44957
|
|
|
@@ -44826,21 +44965,6 @@ Populate with content based on the resource definitions in src/.
|
|
|
44826
44965
|
**\`review\`:** Review all docs/ files for accuracy against the actual resource
|
|
44827
44966
|
definitions. Flag mismatches between documented schemas and code.
|
|
44828
44967
|
|
|
44829
|
-
**\`checkpoint\`:** Save current work progress for session resume.
|
|
44830
|
-
Create or update \`docs/in-progress/<topic>.mdx\` with:
|
|
44831
|
-
- Current state and decisions made
|
|
44832
|
-
- Remaining work and blockers
|
|
44833
|
-
- Update \`docs/priorities.mdx\` with task status
|
|
44834
|
-
|
|
44835
|
-
**\`cleanup\`:** Move completed documents from \`docs/in-progress/\` to their
|
|
44836
|
-
final location in \`docs/\`. Review each in-progress doc to determine if it's
|
|
44837
|
-
complete. Incomplete docs remain in \`docs/in-progress/\`.
|
|
44838
|
-
Also rebuild \`docs/navigation.mdx\` from the current project state.
|
|
44839
|
-
|
|
44840
|
-
**\`resume\`:** Start-of-session command. Review in-progress docs, priorities,
|
|
44841
|
-
and recent deployment state. Present a summary: what's in progress, what's
|
|
44842
|
-
blocking, what's next. Offer to continue the highest-priority item.
|
|
44843
|
-
|
|
44844
44968
|
**\`verify [path]\`:** Cross-reference documentation with the codebase.
|
|
44845
44969
|
Read the specified doc (or all docs if no path), compare claims against actual
|
|
44846
44970
|
code (resource IDs, schema fields, platform tools used), and report
|
|
@@ -44855,7 +44979,7 @@ You are a resource scaffolding assistant for this Elevasis workspace.
|
|
|
44855
44979
|
## Context
|
|
44856
44980
|
|
|
44857
44981
|
Read CLAUDE.md for navigation to SDK patterns (reference/resources/patterns.mdx).
|
|
44858
|
-
Read src/index.ts for the registry and
|
|
44982
|
+
Read src/index.ts for the registry and domain directories for existing resources.
|
|
44859
44983
|
|
|
44860
44984
|
Before suggesting tools, read \`.claude/memory/profile/identity.md\` if it exists
|
|
44861
44985
|
to check the user's known integrations and suggest relevant platform tools.
|
|
@@ -44877,7 +45001,7 @@ cannot specify schemas directly.
|
|
|
44877
45001
|
|
|
44878
45002
|
## Operations
|
|
44879
45003
|
|
|
44880
|
-
**\`workflow <name>\`:** Create a new workflow in \`src
|
|
45004
|
+
**\`workflow <name>\`:** Create a new workflow in the appropriate domain directory (e.g., \`src/<domain>/<name>.ts\`) with:
|
|
44881
45005
|
- Zod input/output schemas with \`z.infer\` type aliases
|
|
44882
45006
|
- Config object (resourceId, name, type, description, version, status)
|
|
44883
45007
|
- Contract with schemas
|
|
@@ -44894,10 +45018,14 @@ cannot specify schemas directly.
|
|
|
44894
45018
|
- Add to \`src/index.ts\` registry
|
|
44895
45019
|
|
|
44896
45020
|
**\`tool-step <name>\`:** Create a step that calls a platform tool:
|
|
44897
|
-
-
|
|
44898
|
-
-
|
|
45021
|
+
- Prefer typed adapters: \`import { createAttioAdapter, scheduler, llm } from '@elevasis/sdk/worker'\`
|
|
45022
|
+
- Integration tools: \`const attio = createAttioAdapter('cred'); await attio.listRecords({...})\`
|
|
45023
|
+
- Platform singletons: \`await scheduler.createSchedule({...})\`, \`await llm.generate({...})\`
|
|
45024
|
+
- Fallback for tools without adapters: \`await platform.call({ tool, method, params, credential })\`
|
|
45025
|
+
- Import \`{ PlatformToolError }\` from '@elevasis/sdk/worker' for error handling
|
|
44899
45026
|
- Wrap in try/catch for PlatformToolError
|
|
44900
45027
|
- Note: 60s timeout per call, credential required for integration tools
|
|
45028
|
+
- See reference/platform-tools/adapters.mdx for the full adapter API
|
|
44901
45029
|
`;
|
|
44902
45030
|
}
|
|
44903
45031
|
function claudeTutorialCommandTemplate() {
|
|
@@ -44930,8 +45058,9 @@ Each lesson follows this flow:
|
|
|
44930
45058
|
## Lessons
|
|
44931
45059
|
|
|
44932
45060
|
**Lesson 1: Welcome & Orientation**
|
|
44933
|
-
Tour project files: src/index.ts (registry), src/
|
|
44934
|
-
workflow),
|
|
45061
|
+
Tour project files: src/index.ts (registry), src/example/echo.ts (starter
|
|
45062
|
+
workflow), src/operations/platform-status.ts (platform API example),
|
|
45063
|
+
elevasis.config.ts, .env, docs/. Explain the execution model.
|
|
44935
45064
|
Verify: run \`elevasis resources\`. Observation focus: cloud deployment model.
|
|
44936
45065
|
|
|
44937
45066
|
**Lesson 2: Your First Custom Workflow**
|
|
@@ -44949,7 +45078,10 @@ Observation focus: optional fields, types, suggesting own fields.
|
|
|
44949
45078
|
**Lesson 4: Using Platform Tools**
|
|
44950
45079
|
Explain platform tools (concepts page). Browse available tools via
|
|
44951
45080
|
reference/platform-tools/index.mdx. Pick a tool based on user's goals.
|
|
44952
|
-
Build: add a platform.call()
|
|
45081
|
+
Build: add a tool step using typed adapters (preferred) or platform.call().
|
|
45082
|
+
Show adapter pattern: \`const attio = createAttioAdapter('cred')\`.
|
|
45083
|
+
Show singleton pattern: \`import { scheduler, llm } from '@elevasis/sdk/worker'\`.
|
|
45084
|
+
Explain credential setup. See reference/platform-tools/adapters.mdx for full API.
|
|
44953
45085
|
Observation focus: credential model, async/await.
|
|
44954
45086
|
|
|
44955
45087
|
**Lesson 5: Multi-Step Workflows**
|
|
@@ -45010,11 +45142,17 @@ Available Commands:
|
|
|
45010
45142
|
/docs Documentation lifecycle
|
|
45011
45143
|
/docs Show documentation status
|
|
45012
45144
|
/docs create Create new documentation page
|
|
45013
|
-
/docs
|
|
45014
|
-
/docs cleanup Move completed docs, rebuild navigation maps
|
|
45015
|
-
/docs resume Review in-progress work and priorities
|
|
45145
|
+
/docs review Review docs for accuracy
|
|
45016
45146
|
/docs verify Cross-reference docs with codebase for accuracy
|
|
45017
45147
|
|
|
45148
|
+
/work Task tracking
|
|
45149
|
+
/work Show current tasks
|
|
45150
|
+
/work start Create new task
|
|
45151
|
+
/work save Save progress for session resume
|
|
45152
|
+
/work resume Resume in-progress work
|
|
45153
|
+
/work done Complete and move task
|
|
45154
|
+
/work list List all tasks with status
|
|
45155
|
+
|
|
45018
45156
|
/database Database operations
|
|
45019
45157
|
/database init Connect Supabase project
|
|
45020
45158
|
/database browse Query and display table contents
|
|
@@ -45066,7 +45204,7 @@ Read \`.claude/memory/profile/skills.md\` to adapt generated code to skill level
|
|
|
45066
45204
|
|
|
45067
45205
|
**\`/templates apply <name>\`:** Generate a workflow from the template:
|
|
45068
45206
|
1. Read the template definition from reference/templates/<name>.mdx
|
|
45069
|
-
2. Generate a workflow file in
|
|
45207
|
+
2. Generate a workflow file in the appropriate domain directory
|
|
45070
45208
|
3. Add the import to src/index.ts registry
|
|
45071
45209
|
4. If the template uses platform tools, prompt for credential setup
|
|
45072
45210
|
5. If the template uses the database, check that /database init has been run
|
|
@@ -45141,14 +45279,14 @@ You are an agent development assistant for this Elevasis workspace.
|
|
|
45141
45279
|
|
|
45142
45280
|
Agent definitions are accepted by the SDK and appear in the registry.
|
|
45143
45281
|
Autonomous agent execution (multi-turn tool use loops) is deferred.
|
|
45144
|
-
LLM calls are available via \`
|
|
45282
|
+
LLM calls are available via the \`llm\` typed adapter: \`import { llm } from '@elevasis/sdk/worker'\`, then \`await llm.generate({ messages: [...] })\`.
|
|
45145
45283
|
|
|
45146
45284
|
## Operations
|
|
45147
45285
|
|
|
45148
45286
|
**\`/agent\` (no args):** Explain the current state:
|
|
45149
45287
|
- Agent definitions are accepted by the SDK and appear in the registry
|
|
45150
45288
|
- Autonomous agent execution (multi-turn tool use loops) is deferred
|
|
45151
|
-
- LLM calls are available via
|
|
45289
|
+
- LLM calls are available via the \`llm\` typed adapter (\`import { llm } from '@elevasis/sdk/worker'\`)
|
|
45152
45290
|
- Show the AgentDefinition pattern for future use
|
|
45153
45291
|
|
|
45154
45292
|
**\`/agent scaffold <name>\`:** Create an agent definition with:
|
|
@@ -45305,6 +45443,9 @@ Detect and repair drift without a version upgrade:
|
|
|
45305
45443
|
|
|
45306
45444
|
### \`/meta deploy\` -- Full Deploy Pipeline
|
|
45307
45445
|
|
|
45446
|
+
0. Read \`reference/deployment/command-view.mdx\` -- understand the Command View
|
|
45447
|
+
model, relationship declarations, and what deploy-time validation checks.
|
|
45448
|
+
This context is essential for diagnosing validation failures in steps 1-2.
|
|
45308
45449
|
1. Run \`elevasis check\` (validation)
|
|
45309
45450
|
2. Type check if \`tsconfig.json\` exists
|
|
45310
45451
|
3. Verify docs reflect current resources
|
|
@@ -45316,6 +45457,8 @@ Detect and repair drift without a version upgrade:
|
|
|
45316
45457
|
9. If git configured and remote exists: optionally push
|
|
45317
45458
|
|
|
45318
45459
|
Each step reports its result. Pipeline stops on failure with suggested fix.
|
|
45460
|
+
If validation fails with relationship errors, re-read \`reference/deployment/command-view.mdx\`
|
|
45461
|
+
for the enforcement model and common fixes.
|
|
45319
45462
|
|
|
45320
45463
|
### \`/meta health\` -- Execution Debugging
|
|
45321
45464
|
|
|
@@ -45354,12 +45497,161 @@ The agent reads current templates from the installed SDK:
|
|
|
45354
45497
|
\`@elevasis/sdk/templates\` subpath exports all template functions.
|
|
45355
45498
|
`;
|
|
45356
45499
|
}
|
|
45500
|
+
function claudeWorkCommandTemplate() {
|
|
45501
|
+
return `# /work command
|
|
45502
|
+
|
|
45503
|
+
You are a task tracking assistant for this Elevasis workspace.
|
|
45504
|
+
|
|
45505
|
+
## Context
|
|
45506
|
+
|
|
45507
|
+
Read \`docs/priorities.mdx\` if it exists for current priorities.
|
|
45508
|
+
Scan \`docs/in-progress/\` for task documents with \`status\` frontmatter.
|
|
45509
|
+
|
|
45510
|
+
## Operations
|
|
45511
|
+
|
|
45512
|
+
**No arguments (default):** Show tasks from \`docs/in-progress/\` with status
|
|
45513
|
+
from frontmatter, cross-referenced with \`docs/priorities.mdx\`.
|
|
45514
|
+
|
|
45515
|
+
**\`start <description>\`:** Create a task doc in \`docs/in-progress/<name>.mdx\`:
|
|
45516
|
+
1. Derive a kebab-case filename from the description
|
|
45517
|
+
2. Create the file with frontmatter (\`status: in-progress\`)
|
|
45518
|
+
3. Add sections: Objective, Plan, Progress, Resume Context
|
|
45519
|
+
4. Update \`docs/priorities.mdx\` with the new task
|
|
45520
|
+
5. Report what was created
|
|
45521
|
+
|
|
45522
|
+
**\`save\`:** Update the current task doc's Progress and Resume Context sections:
|
|
45523
|
+
1. Identify the current task from conversation context
|
|
45524
|
+
2. Update Progress section (completed steps, files changed, decisions)
|
|
45525
|
+
3. Update Resume Context section with:
|
|
45526
|
+
- Current State (date, what was done, what's next)
|
|
45527
|
+
- Files Modified (table of changed files)
|
|
45528
|
+
- Key docs to read on resume (file paths)
|
|
45529
|
+
- To continue (copy-pasteable prompt)
|
|
45530
|
+
4. Set \`status\` appropriately
|
|
45531
|
+
|
|
45532
|
+
**\`resume [name]\`:** Resume in-progress work:
|
|
45533
|
+
1. If name given, find matching doc in \`docs/in-progress/\`
|
|
45534
|
+
2. If no name, scan for docs with \`status: in-progress\`, ask if multiple
|
|
45535
|
+
3. Parse Resume Context section
|
|
45536
|
+
4. Present: "Resuming [task]. Last completed: [step]. Next: [step]."
|
|
45537
|
+
|
|
45538
|
+
**\`done [name]\`:** Mark task complete:
|
|
45539
|
+
1. Find the task doc
|
|
45540
|
+
2. Set \`status: complete\` in frontmatter
|
|
45541
|
+
3. Move from \`docs/in-progress/\` to final \`docs/\` location
|
|
45542
|
+
4. Update \`docs/priorities.mdx\`
|
|
45543
|
+
|
|
45544
|
+
**\`list\`:** Show all tasks with status:
|
|
45545
|
+
1. Scan \`docs/in-progress/*.mdx\` for frontmatter
|
|
45546
|
+
2. Display status table sorted by status (in-progress first)
|
|
45547
|
+
`;
|
|
45548
|
+
}
|
|
45549
|
+
function claudeCredsSkillTemplate() {
|
|
45550
|
+
return `---
|
|
45551
|
+
name: creds
|
|
45552
|
+
description: "Credential management assistant. TRIGGER when: user mentions credentials, API keys, secrets, webhook secrets, or asks to set up integrations that need authentication. DO NOT TRIGGER when: user is discussing code that references credentials without needing to manage them."
|
|
45553
|
+
---
|
|
45554
|
+
|
|
45555
|
+
# Credential Management
|
|
45556
|
+
|
|
45557
|
+
You are a credential management assistant for this Elevasis workspace.
|
|
45558
|
+
|
|
45559
|
+
## Context
|
|
45560
|
+
|
|
45561
|
+
Credentials are stored encrypted (AES-256-GCM) on the Elevasis platform and scoped to your
|
|
45562
|
+
organization. They are used by workflows and agents at runtime via \`platform.getCredential()\`
|
|
45563
|
+
or the \`credential:\` field on tool steps.
|
|
45564
|
+
|
|
45565
|
+
The SDK CLI (\`elevasis-sdk creds\`) manages credentials via API key authentication.
|
|
45566
|
+
Your \`ELEVASIS_API_KEY\` in \`.env\` determines the organization.
|
|
45567
|
+
|
|
45568
|
+
## Credential Types
|
|
45569
|
+
|
|
45570
|
+
| Type | Value Format | Example Providers |
|
|
45571
|
+
| --- | --- | --- |
|
|
45572
|
+
| \`api-key\` | \`{"apiKey": "sk-..."}\` | Stripe, Resend, Apify, Attio, Instantly |
|
|
45573
|
+
| \`webhook-secret\` | \`{"signingSecret": "whsec_..."}\` | Cal.com, Stripe webhooks |
|
|
45574
|
+
| \`trello\` | \`{"apiKey": "...", "token": "..."}\` | Trello |
|
|
45575
|
+
| \`oauth\` | N/A (browser flow only) | Notion, Google Sheets, Dropbox |
|
|
45576
|
+
|
|
45577
|
+
OAuth credentials **cannot** be created via CLI. Redirect the user to the Command Center UI.
|
|
45578
|
+
|
|
45579
|
+
## Naming Rules
|
|
45580
|
+
|
|
45581
|
+
- Lowercase letters, digits, and hyphens only (\`[a-z0-9-]\`)
|
|
45582
|
+
- No consecutive hyphens (\`--\`)
|
|
45583
|
+
- 1-100 characters
|
|
45584
|
+
- Convention: \`{org}-{provider}\` (e.g., \`tester-stripe-key\`, \`my-project-resend\`)
|
|
45585
|
+
|
|
45586
|
+
## Operations
|
|
45587
|
+
|
|
45588
|
+
**No arguments (default):** Show this reference and list credentials.
|
|
45589
|
+
|
|
45590
|
+
**\`list\`:** List all credentials for the organization.
|
|
45591
|
+
\`\`\`bash
|
|
45592
|
+
elevasis-sdk creds list
|
|
45593
|
+
\`\`\`
|
|
45594
|
+
Display the output. Note which are \`oauth\` (not modifiable via CLI).
|
|
45595
|
+
|
|
45596
|
+
**\`create\`:** Guided credential creation flow:
|
|
45597
|
+
1. Ask credential type (\`api-key\`, \`webhook-secret\`, or \`trello\`). Not \`oauth\`.
|
|
45598
|
+
2. Ask credential name. Validate naming rules before proceeding.
|
|
45599
|
+
3. Ask the user to paste the credential value directly in chat.
|
|
45600
|
+
- For \`api-key\`: ask for the API key, construct \`{"apiKey": "..."}\`
|
|
45601
|
+
- For \`webhook-secret\`: ask for the signing secret, construct \`{"signingSecret": "..."}\`
|
|
45602
|
+
- For \`trello\`: ask for API key AND user token, construct \`{"apiKey": "...", "token": "..."}\`
|
|
45603
|
+
4. Pipe to CLI: \`echo '{"apiKey":"..."}' | elevasis-sdk creds create --name {name} --type {type}\`
|
|
45604
|
+
5. Confirm success. **NEVER echo the credential value back.**
|
|
45605
|
+
|
|
45606
|
+
**\`update\`:** Update credential value:
|
|
45607
|
+
1. Run \`elevasis-sdk creds list\` to confirm the credential exists.
|
|
45608
|
+
2. Ask the user to paste the new value.
|
|
45609
|
+
3. Pipe to CLI: \`echo '{"apiKey":"..."}' | elevasis-sdk creds update {name}\`
|
|
45610
|
+
4. Confirm success. **NEVER echo the value.**
|
|
45611
|
+
|
|
45612
|
+
**\`rename\`:** Rename a credential:
|
|
45613
|
+
1. Run \`elevasis-sdk creds list\` to confirm it exists.
|
|
45614
|
+
2. Ask for the new name. Validate naming rules.
|
|
45615
|
+
3. Run: \`elevasis-sdk creds rename {name} --to {newName}\`
|
|
45616
|
+
|
|
45617
|
+
**\`delete\`:** Delete a credential:
|
|
45618
|
+
1. Run \`elevasis-sdk creds list\` to confirm it exists.
|
|
45619
|
+
2. Confirm with user before proceeding.
|
|
45620
|
+
3. Run: \`elevasis-sdk creds delete {name} --force\`
|
|
45621
|
+
|
|
45622
|
+
**\`webhook-url\`:** Generate a webhook URL:
|
|
45623
|
+
Ask for provider, org UUID, resource ID, and credential name. Construct:
|
|
45624
|
+
\`POST https://api.elevasis.io/api/webhooks/{provider}?org={uuid}&resource={resourceId}&credential={credentialName}\`
|
|
45625
|
+
|
|
45626
|
+
**\`audit\`:** Scan project for credential references:
|
|
45627
|
+
1. Search \`src/**/*.ts\` for \`credential:\` patterns and \`platform.getCredential()\` calls.
|
|
45628
|
+
2. Extract all credential names referenced.
|
|
45629
|
+
3. Run \`elevasis-sdk creds list\` to get the actual credential list.
|
|
45630
|
+
4. Report: missing credentials (referenced but not created), unused credentials (created but not referenced).
|
|
45631
|
+
|
|
45632
|
+
## Security Rules (MANDATORY)
|
|
45633
|
+
|
|
45634
|
+
- **NEVER** log, repeat, or display credential values after the user provides them
|
|
45635
|
+
- **NEVER** store credential values in files, memory, or command history
|
|
45636
|
+
- If an API call fails, ask the user to **re-paste** rather than retrying with a cached value
|
|
45637
|
+
- Always confirm name and type **before** asking for the value
|
|
45638
|
+
- OAuth credentials cannot be created via CLI -- redirect to Command Center UI
|
|
45639
|
+
`;
|
|
45640
|
+
}
|
|
45357
45641
|
function starterTemplate() {
|
|
45358
45642
|
return `import type { OrganizationResources } from '@elevasis/sdk'
|
|
45359
|
-
import
|
|
45643
|
+
import * as operations from './operations/index.js'
|
|
45644
|
+
import * as example from './example/index.js'
|
|
45360
45645
|
|
|
45361
45646
|
const org: OrganizationResources = {
|
|
45362
|
-
workflows: [
|
|
45647
|
+
workflows: [
|
|
45648
|
+
...operations.workflows,
|
|
45649
|
+
...example.workflows,
|
|
45650
|
+
],
|
|
45651
|
+
agents: [
|
|
45652
|
+
...operations.agents,
|
|
45653
|
+
...example.agents,
|
|
45654
|
+
],
|
|
45363
45655
|
}
|
|
45364
45656
|
export default org
|
|
45365
45657
|
`;
|
|
@@ -45403,6 +45695,112 @@ export const echo: WorkflowDefinition = {
|
|
|
45403
45695
|
}
|
|
45404
45696
|
`;
|
|
45405
45697
|
}
|
|
45698
|
+
function platformStatusTemplate() {
|
|
45699
|
+
return `import type { WorkflowDefinition } from '@elevasis/sdk'
|
|
45700
|
+
import { StepType } from '@elevasis/sdk'
|
|
45701
|
+
import { platform } from '@elevasis/sdk/worker'
|
|
45702
|
+
import { llm } from '@elevasis/sdk/worker'
|
|
45703
|
+
import { z } from 'zod'
|
|
45704
|
+
|
|
45705
|
+
const input = z.object({
|
|
45706
|
+
timeRange: z.enum(['1h', '24h', '7d']).default('24h').describe('Time window for status data'),
|
|
45707
|
+
})
|
|
45708
|
+
|
|
45709
|
+
const statusData = z.object({
|
|
45710
|
+
raw: z.unknown().describe('Raw status overview from platform'),
|
|
45711
|
+
})
|
|
45712
|
+
|
|
45713
|
+
const output = z.object({
|
|
45714
|
+
raw: z.unknown().describe('Raw status overview from platform'),
|
|
45715
|
+
summary: z.string().describe('Natural language status summary'),
|
|
45716
|
+
})
|
|
45717
|
+
|
|
45718
|
+
type Input = z.infer<typeof input>
|
|
45719
|
+
|
|
45720
|
+
export const platformStatus: WorkflowDefinition = {
|
|
45721
|
+
config: {
|
|
45722
|
+
resourceId: 'platform-status',
|
|
45723
|
+
name: 'Platform Status',
|
|
45724
|
+
type: 'workflow',
|
|
45725
|
+
description: 'Gathers cross-system platform status and compiles a natural language summary',
|
|
45726
|
+
version: '1.0.0',
|
|
45727
|
+
status: 'dev',
|
|
45728
|
+
},
|
|
45729
|
+
contract: { inputSchema: input, outputSchema: output },
|
|
45730
|
+
steps: {
|
|
45731
|
+
'gather-status': {
|
|
45732
|
+
id: 'gather-status',
|
|
45733
|
+
name: 'Gather Status',
|
|
45734
|
+
description: 'Queries platform status overview (executions, pending items, schedules, credentials)',
|
|
45735
|
+
handler: async (rawInput) => {
|
|
45736
|
+
const { timeRange } = rawInput as Input
|
|
45737
|
+
const raw = await platform.call({
|
|
45738
|
+
tool: 'status',
|
|
45739
|
+
method: 'overview',
|
|
45740
|
+
params: { timeRange },
|
|
45741
|
+
})
|
|
45742
|
+
return { raw }
|
|
45743
|
+
},
|
|
45744
|
+
inputSchema: input,
|
|
45745
|
+
outputSchema: statusData,
|
|
45746
|
+
next: { type: StepType.LINEAR, target: 'compile-report' },
|
|
45747
|
+
},
|
|
45748
|
+
'compile-report': {
|
|
45749
|
+
id: 'compile-report',
|
|
45750
|
+
name: 'Compile Report',
|
|
45751
|
+
description: 'Generates a natural language summary from raw status data',
|
|
45752
|
+
handler: async (rawInput) => {
|
|
45753
|
+
const { raw } = rawInput as z.infer<typeof statusData>
|
|
45754
|
+
const result = await llm.generate({
|
|
45755
|
+
provider: 'google',
|
|
45756
|
+
model: 'gemini-3-flash-preview',
|
|
45757
|
+
messages: [
|
|
45758
|
+
{
|
|
45759
|
+
role: 'user',
|
|
45760
|
+
content: [
|
|
45761
|
+
'Summarize this platform status overview in 3-5 concise bullet points.',
|
|
45762
|
+
'Focus on: execution health, pending items needing attention, upcoming schedules, and credential coverage.',
|
|
45763
|
+
'Be specific with numbers. Flag any issues.',
|
|
45764
|
+
'',
|
|
45765
|
+
JSON.stringify(raw, null, 2),
|
|
45766
|
+
].join('\\n'),
|
|
45767
|
+
},
|
|
45768
|
+
],
|
|
45769
|
+
responseSchema: {
|
|
45770
|
+
type: 'object',
|
|
45771
|
+
properties: {
|
|
45772
|
+
summary: { type: 'string', description: 'Natural language status summary with bullet points' },
|
|
45773
|
+
},
|
|
45774
|
+
required: ['summary'],
|
|
45775
|
+
},
|
|
45776
|
+
temperature: 0,
|
|
45777
|
+
})
|
|
45778
|
+
const summary = (result as any)?.summary ?? String(result)
|
|
45779
|
+
return { raw, summary }
|
|
45780
|
+
},
|
|
45781
|
+
inputSchema: statusData,
|
|
45782
|
+
outputSchema: output,
|
|
45783
|
+
next: null,
|
|
45784
|
+
},
|
|
45785
|
+
},
|
|
45786
|
+
entryPoint: 'gather-status',
|
|
45787
|
+
}
|
|
45788
|
+
`;
|
|
45789
|
+
}
|
|
45790
|
+
function operationsBarrelTemplate() {
|
|
45791
|
+
return `import { platformStatus } from './platform-status.js'
|
|
45792
|
+
|
|
45793
|
+
export const workflows = [platformStatus]
|
|
45794
|
+
export const agents = []
|
|
45795
|
+
`;
|
|
45796
|
+
}
|
|
45797
|
+
function exampleBarrelTemplate() {
|
|
45798
|
+
return `import { echo } from './echo.js'
|
|
45799
|
+
|
|
45800
|
+
export const workflows = [echo]
|
|
45801
|
+
export const agents = []
|
|
45802
|
+
`;
|
|
45803
|
+
}
|
|
45406
45804
|
|
|
45407
45805
|
// src/cli/commands/update.ts
|
|
45408
45806
|
var import_path4 = require("path");
|
|
@@ -45438,7 +45836,8 @@ function registerUpdateCommand(program3) {
|
|
|
45438
45836
|
".claude/commands/database.md": claudeDatabaseCommandTemplate,
|
|
45439
45837
|
".claude/commands/agent.md": claudeAgentCommandTemplate,
|
|
45440
45838
|
".claude/commands/profile.md": claudeProfileCommandTemplate,
|
|
45441
|
-
".claude/commands/meta.md": claudeMetaCommandTemplate
|
|
45839
|
+
".claude/commands/meta.md": claudeMetaCommandTemplate,
|
|
45840
|
+
".claude/commands/work.md": claudeWorkCommandTemplate
|
|
45442
45841
|
};
|
|
45443
45842
|
const added = [];
|
|
45444
45843
|
const flagged = [];
|
|
@@ -45546,6 +45945,216 @@ function registerUpdateCommand(program3) {
|
|
|
45546
45945
|
}));
|
|
45547
45946
|
}
|
|
45548
45947
|
|
|
45948
|
+
// src/cli/commands/creds/creds-list.ts
|
|
45949
|
+
async function listCreds(apiUrl, json2) {
|
|
45950
|
+
const spinner = ora("Fetching credentials...").start();
|
|
45951
|
+
const data = await apiGet("/api/external/credentials", apiUrl);
|
|
45952
|
+
spinner.stop();
|
|
45953
|
+
if (json2) {
|
|
45954
|
+
console.log(JSON.stringify(data.credentials, null, 2));
|
|
45955
|
+
return;
|
|
45956
|
+
}
|
|
45957
|
+
if (data.credentials.length === 0) {
|
|
45958
|
+
console.log(source_default.yellow("No credentials found."));
|
|
45959
|
+
console.log(source_default.gray("Create one with: elevasis creds create --name my-key --type api-key"));
|
|
45960
|
+
return;
|
|
45961
|
+
}
|
|
45962
|
+
console.log(source_default.cyan(`
|
|
45963
|
+
Credentials (${data.credentials.length}):
|
|
45964
|
+
`));
|
|
45965
|
+
for (const cred of data.credentials) {
|
|
45966
|
+
const provider = cred.provider ? source_default.gray(` (${cred.provider})`) : "";
|
|
45967
|
+
console.log(` ${source_default.bold(cred.name)} ${source_default.dim(cred.type)}${provider}`);
|
|
45968
|
+
console.log(source_default.gray(` Created: ${new Date(cred.createdAt).toLocaleDateString()}`));
|
|
45969
|
+
}
|
|
45970
|
+
console.log();
|
|
45971
|
+
}
|
|
45972
|
+
|
|
45973
|
+
// src/cli/commands/creds/creds-create.ts
|
|
45974
|
+
var CREDENTIAL_NAME_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
45975
|
+
var VALID_TYPES = ["api-key", "webhook-secret", "trello"];
|
|
45976
|
+
async function createCreds(apiUrl, name, type, valueJson) {
|
|
45977
|
+
if (!name || name.length < 1 || name.length > 100) {
|
|
45978
|
+
throw new Error("Credential name must be 1-100 characters");
|
|
45979
|
+
}
|
|
45980
|
+
if (!CREDENTIAL_NAME_REGEX.test(name)) {
|
|
45981
|
+
throw new Error(
|
|
45982
|
+
"Invalid credential name. Must be lowercase letters, digits, and hyphens only.\nNo consecutive hyphens allowed. Examples: my-api-key, stripe-prod, cal-webhook"
|
|
45983
|
+
);
|
|
45984
|
+
}
|
|
45985
|
+
if (!VALID_TYPES.includes(type)) {
|
|
45986
|
+
throw new Error(
|
|
45987
|
+
`Invalid credential type: ${type}
|
|
45988
|
+
Valid types: ${VALID_TYPES.join(", ")}
|
|
45989
|
+
Note: OAuth credentials must be created through the Command Center UI`
|
|
45990
|
+
);
|
|
45991
|
+
}
|
|
45992
|
+
if (!valueJson) {
|
|
45993
|
+
throw new Error(
|
|
45994
|
+
`Credential value is required. Provide it with --value '{"apiKey":"sk-..."}'
|
|
45995
|
+
Value must be a valid JSON object.`
|
|
45996
|
+
);
|
|
45997
|
+
}
|
|
45998
|
+
let value;
|
|
45999
|
+
try {
|
|
46000
|
+
value = JSON.parse(valueJson);
|
|
46001
|
+
} catch {
|
|
46002
|
+
throw new Error(
|
|
46003
|
+
`Invalid JSON in --value. Must be a valid JSON object.
|
|
46004
|
+
Example: --value '{"apiKey":"sk-abc123"}'`
|
|
46005
|
+
);
|
|
46006
|
+
}
|
|
46007
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
46008
|
+
throw new Error("Credential value must be a JSON object (not array or primitive)");
|
|
46009
|
+
}
|
|
46010
|
+
if (Object.keys(value).length === 0) {
|
|
46011
|
+
throw new Error("Credential value must not be empty");
|
|
46012
|
+
}
|
|
46013
|
+
const spinner = ora("Creating credential...").start();
|
|
46014
|
+
const result = await apiPost(
|
|
46015
|
+
"/api/external/credentials",
|
|
46016
|
+
{ name, type, value },
|
|
46017
|
+
apiUrl
|
|
46018
|
+
);
|
|
46019
|
+
spinner.stop();
|
|
46020
|
+
console.log(source_default.green(`
|
|
46021
|
+
Credential created successfully!`));
|
|
46022
|
+
console.log(` ${source_default.bold("Name:")} ${result.name}`);
|
|
46023
|
+
console.log(` ${source_default.bold("ID:")} ${result.id}`);
|
|
46024
|
+
console.log(` ${source_default.bold("Type:")} ${type}`);
|
|
46025
|
+
}
|
|
46026
|
+
|
|
46027
|
+
// src/cli/commands/creds/creds-update.ts
|
|
46028
|
+
async function updateCreds(apiUrl, name, valueJson) {
|
|
46029
|
+
let value;
|
|
46030
|
+
try {
|
|
46031
|
+
value = JSON.parse(valueJson);
|
|
46032
|
+
} catch {
|
|
46033
|
+
throw new Error(
|
|
46034
|
+
`Invalid JSON in --value. Must be a valid JSON object.
|
|
46035
|
+
Example: --value '{"apiKey":"sk-new-key"}'`
|
|
46036
|
+
);
|
|
46037
|
+
}
|
|
46038
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
46039
|
+
throw new Error("Credential value must be a JSON object (not array or primitive)");
|
|
46040
|
+
}
|
|
46041
|
+
if (Object.keys(value).length === 0) {
|
|
46042
|
+
throw new Error("Credential value must not be empty");
|
|
46043
|
+
}
|
|
46044
|
+
const spinner = ora("Updating credential...").start();
|
|
46045
|
+
const data = await apiGet("/api/external/credentials", apiUrl);
|
|
46046
|
+
const credential = data.credentials.find((c) => c.name === name);
|
|
46047
|
+
if (!credential) {
|
|
46048
|
+
spinner.stop();
|
|
46049
|
+
throw new Error(
|
|
46050
|
+
`Credential '${name}' not found.
|
|
46051
|
+
Run "elevasis creds list" to see available credentials.`
|
|
46052
|
+
);
|
|
46053
|
+
}
|
|
46054
|
+
await apiPatch(`/api/external/credentials/${credential.id}`, { value }, apiUrl);
|
|
46055
|
+
spinner.stop();
|
|
46056
|
+
console.log(source_default.green(`
|
|
46057
|
+
Credential '${name}' updated successfully!`));
|
|
46058
|
+
}
|
|
46059
|
+
|
|
46060
|
+
// src/cli/commands/creds/creds-rename.ts
|
|
46061
|
+
var CREDENTIAL_NAME_REGEX2 = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
46062
|
+
async function renameCreds(apiUrl, name, newName) {
|
|
46063
|
+
if (!newName || newName.length < 1 || newName.length > 100) {
|
|
46064
|
+
throw new Error("New credential name must be 1-100 characters");
|
|
46065
|
+
}
|
|
46066
|
+
if (!CREDENTIAL_NAME_REGEX2.test(newName)) {
|
|
46067
|
+
throw new Error(
|
|
46068
|
+
"Invalid new credential name. Must be lowercase letters, digits, and hyphens only.\nNo consecutive hyphens allowed. Examples: my-api-key, stripe-prod, cal-webhook"
|
|
46069
|
+
);
|
|
46070
|
+
}
|
|
46071
|
+
const spinner = ora("Renaming credential...").start();
|
|
46072
|
+
const data = await apiGet("/api/external/credentials", apiUrl);
|
|
46073
|
+
const credential = data.credentials.find((c) => c.name === name);
|
|
46074
|
+
if (!credential) {
|
|
46075
|
+
spinner.stop();
|
|
46076
|
+
throw new Error(
|
|
46077
|
+
`Credential '${name}' not found.
|
|
46078
|
+
Run "elevasis creds list" to see available credentials.`
|
|
46079
|
+
);
|
|
46080
|
+
}
|
|
46081
|
+
const conflict = data.credentials.find((c) => c.name === newName);
|
|
46082
|
+
if (conflict) {
|
|
46083
|
+
spinner.stop();
|
|
46084
|
+
throw new Error(`Credential '${newName}' already exists. Choose a different name.`);
|
|
46085
|
+
}
|
|
46086
|
+
await apiPatch(`/api/external/credentials/${credential.id}`, { name: newName }, apiUrl);
|
|
46087
|
+
spinner.stop();
|
|
46088
|
+
console.log(source_default.green(`
|
|
46089
|
+
Credential renamed successfully!`));
|
|
46090
|
+
console.log(` ${source_default.dim(name)} ${source_default.gray("->")} ${source_default.bold(newName)}`);
|
|
46091
|
+
}
|
|
46092
|
+
|
|
46093
|
+
// src/cli/commands/creds/creds-delete.ts
|
|
46094
|
+
var import_readline = require("readline");
|
|
46095
|
+
function confirm(message) {
|
|
46096
|
+
const rl = (0, import_readline.createInterface)({ input: process.stdin, output: process.stdout });
|
|
46097
|
+
return new Promise((resolve6) => {
|
|
46098
|
+
rl.question(message, (answer) => {
|
|
46099
|
+
rl.close();
|
|
46100
|
+
resolve6(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
|
|
46101
|
+
});
|
|
46102
|
+
});
|
|
46103
|
+
}
|
|
46104
|
+
async function deleteCreds(apiUrl, name, force) {
|
|
46105
|
+
const spinner = ora("Looking up credential...").start();
|
|
46106
|
+
const data = await apiGet("/api/external/credentials", apiUrl);
|
|
46107
|
+
const credential = data.credentials.find((c) => c.name === name);
|
|
46108
|
+
if (!credential) {
|
|
46109
|
+
spinner.stop();
|
|
46110
|
+
throw new Error(
|
|
46111
|
+
`Credential '${name}' not found.
|
|
46112
|
+
Run "elevasis creds list" to see available credentials.`
|
|
46113
|
+
);
|
|
46114
|
+
}
|
|
46115
|
+
spinner.stop();
|
|
46116
|
+
if (!force) {
|
|
46117
|
+
console.log(source_default.yellow(`
|
|
46118
|
+
About to delete credential:`));
|
|
46119
|
+
console.log(` ${source_default.bold("Name:")} ${credential.name}`);
|
|
46120
|
+
console.log(` ${source_default.bold("Type:")} ${credential.type}`);
|
|
46121
|
+
if (credential.provider) {
|
|
46122
|
+
console.log(` ${source_default.bold("Provider:")} ${credential.provider}`);
|
|
46123
|
+
}
|
|
46124
|
+
console.log();
|
|
46125
|
+
const confirmed = await confirm(source_default.red("Are you sure? This cannot be undone. (y/N) "));
|
|
46126
|
+
if (!confirmed) {
|
|
46127
|
+
console.log(source_default.gray("Cancelled."));
|
|
46128
|
+
return;
|
|
46129
|
+
}
|
|
46130
|
+
}
|
|
46131
|
+
const deleteSpinner = ora("Deleting credential...").start();
|
|
46132
|
+
await apiDelete(`/api/external/credentials/${credential.id}`, apiUrl);
|
|
46133
|
+
deleteSpinner.stop();
|
|
46134
|
+
console.log(source_default.green(`
|
|
46135
|
+
Credential '${name}' deleted successfully.`));
|
|
46136
|
+
}
|
|
46137
|
+
|
|
46138
|
+
// src/cli/commands/creds/creds.ts
|
|
46139
|
+
function registerCredsCommand(program3) {
|
|
46140
|
+
const creds = program3.command("creds").description("Manage organization credentials");
|
|
46141
|
+
creds.command("list").description("List all credentials (metadata only, no secrets)").option("--api-url <url>", "API URL").option("--json", "Output as JSON").action(wrapAction("creds list", async (options2) => {
|
|
46142
|
+
await listCreds(resolveApiUrl(options2.apiUrl), options2.json);
|
|
46143
|
+
}));
|
|
46144
|
+
creds.command("create").description("Create a new credential").requiredOption("--name <name>", "Credential name (lowercase, digits, hyphens)").requiredOption("--type <type>", "Credential type (api-key, webhook-secret, trello)").option("--value <json>", "Credential value as JSON string").option("--api-url <url>", "API URL").action(wrapAction("creds create", async (options2) => {
|
|
46145
|
+
await createCreds(resolveApiUrl(options2.apiUrl), options2.name, options2.type, options2.value);
|
|
46146
|
+
}));
|
|
46147
|
+
creds.command("update <name>").description("Update a credential value").requiredOption("--value <json>", "New credential value as JSON string").option("--api-url <url>", "API URL").action(wrapAction("creds update", async (name, options2) => {
|
|
46148
|
+
await updateCreds(resolveApiUrl(options2.apiUrl), name, options2.value);
|
|
46149
|
+
}));
|
|
46150
|
+
creds.command("rename <name>").description("Rename a credential").requiredOption("--to <newName>", "New credential name").option("--api-url <url>", "API URL").action(wrapAction("creds rename", async (name, options2) => {
|
|
46151
|
+
await renameCreds(resolveApiUrl(options2.apiUrl), name, options2.to);
|
|
46152
|
+
}));
|
|
46153
|
+
creds.command("delete <name>").description("Delete a credential").option("--force", "Skip confirmation prompt").option("--api-url <url>", "API URL").action(wrapAction("creds delete", async (name, options2) => {
|
|
46154
|
+
await deleteCreds(resolveApiUrl(options2.apiUrl), name, options2.force);
|
|
46155
|
+
}));
|
|
46156
|
+
}
|
|
46157
|
+
|
|
45549
46158
|
// src/cli/index.ts
|
|
45550
46159
|
(0, import_dotenv.config)({ path: (0, import_path5.resolve)(process.cwd(), ".env"), override: false });
|
|
45551
46160
|
var program2 = new Command();
|
|
@@ -45576,6 +46185,7 @@ registerDescribeCommand(program2);
|
|
|
45576
46185
|
registerDeploymentsCommand(program2);
|
|
45577
46186
|
registerInitCommand(program2);
|
|
45578
46187
|
registerUpdateCommand(program2);
|
|
46188
|
+
registerCredsCommand(program2);
|
|
45579
46189
|
program2.parse();
|
|
45580
46190
|
/*! Bundled license information:
|
|
45581
46191
|
|