@elevasis/sdk 0.4.9 → 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 CHANGED
@@ -43780,6 +43780,38 @@ 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
+ }
43783
43815
 
43784
43816
  // package.json
43785
43817
  var package_default = {
@@ -44498,7 +44530,7 @@ function registerDescribeCommand(program3) {
44498
44530
  // src/cli/commands/init.ts
44499
44531
  var import_path3 = require("path");
44500
44532
  var import_promises2 = require("fs/promises");
44501
- var TEMPLATE_VERSION = 5;
44533
+ var TEMPLATE_VERSION = 9;
44502
44534
  var INIT_ONLY_FILES = [
44503
44535
  "package.json",
44504
44536
  "pnpm-workspace.yaml",
@@ -44528,7 +44560,9 @@ var MANAGED_FILES = [
44528
44560
  ".claude/commands/database.md",
44529
44561
  ".claude/commands/agent.md",
44530
44562
  ".claude/commands/profile.md",
44531
- ".claude/commands/meta.md"
44563
+ ".claude/commands/meta.md",
44564
+ ".claude/commands/work.md",
44565
+ ".claude/skills/creds/SKILL.md"
44532
44566
  ];
44533
44567
  var SCAFFOLD_FILES = [...INIT_ONLY_FILES, ...MANAGED_FILES];
44534
44568
  function registerInitCommand(program3) {
@@ -44558,6 +44592,7 @@ function registerInitCommand(program3) {
44558
44592
  await (0, import_promises2.mkdir)((0, import_path3.resolve)(targetDir, "src/shared"), { recursive: true });
44559
44593
  await (0, import_promises2.mkdir)((0, import_path3.resolve)(targetDir, "docs/in-progress"), { recursive: true });
44560
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 });
44561
44596
  const files = {
44562
44597
  "elevasis.config.ts": configTemplate(),
44563
44598
  "package.json": packageJsonTemplate(orgSlug),
@@ -44585,7 +44620,9 @@ function registerInitCommand(program3) {
44585
44620
  ".claude/commands/database.md": claudeDatabaseCommandTemplate(),
44586
44621
  ".claude/commands/agent.md": claudeAgentCommandTemplate(),
44587
44622
  ".claude/commands/profile.md": claudeProfileCommandTemplate(),
44588
- ".claude/commands/meta.md": claudeMetaCommandTemplate()
44623
+ ".claude/commands/meta.md": claudeMetaCommandTemplate(),
44624
+ ".claude/commands/work.md": claudeWorkCommandTemplate(),
44625
+ ".claude/skills/creds/SKILL.md": claudeCredsSkillTemplate()
44589
44626
  };
44590
44627
  for (const [filePath, content] of Object.entries(files)) {
44591
44628
  await (0, import_promises2.writeFile)((0, import_path3.resolve)(targetDir, filePath), content, "utf-8");
@@ -44725,7 +44762,7 @@ elevasis executions <resourceId> # View execution history
44725
44762
  ### Platform Status Workflow (\`src/operations/\`)
44726
44763
 
44727
44764
  A multi-step workflow that queries platform status and compiles a natural language
44728
- summary using an LLM. Demonstrates real platform API usage with \`platform.call()\`.
44765
+ summary using an LLM. Demonstrates platform API usage with the \`llm\` typed adapter and \`platform.call()\`.
44729
44766
 
44730
44767
  \`\`\`bash
44731
44768
  elevasis exec platform-status --input '{"timeRange": "24h"}'
@@ -44798,6 +44835,7 @@ proactivity -- to their assessed levels.
44798
44835
  | Credential model | \`reference/security/credentials.mdx\` | Setting up integrations or tool access |
44799
44836
  | Interaction guidance | \`reference/developer/interaction-guidance.mdx\` | Unsure how to adapt for a skill combination |
44800
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 |
44801
44839
  | SDK error reference | \`reference/troubleshooting/common-errors.mdx\` | Unknown error not in workspace memory |
44802
44840
  | Project resource map | \`docs/navigation.mdx\` | Understanding what's deployed |
44803
44841
  | Project priorities | \`docs/priorities.mdx\` | Deciding what to work on next |
@@ -44817,7 +44855,7 @@ All \`reference/\` paths resolve to \`node_modules/@elevasis/sdk/reference/\`.
44817
44855
  - \`StepType\`, \`ExecutionError\`, \`ToolingError\` are runtime imports from \`'@elevasis/sdk'\`
44818
44856
  - \`platform\`, \`PlatformToolError\` are runtime imports from \`'@elevasis/sdk/worker'\`
44819
44857
  - \`.env\` is for CLI authentication only (\`ELEVASIS_API_KEY\`) -- never deployed, never in workers
44820
- - Integration credentials are managed via the platform credential system (command center UI)
44858
+ - Integration credentials are managed via the \`creds\` skill (auto-triggers when you mention credentials) or the Command Center UI
44821
44859
  - Documentation goes in \`docs/\` as \`.mdx\` files
44822
44860
  - \`dist/\` is generated by deploy -- never commit it
44823
44861
  - \`resourceId\` must be lowercase with hyphens, unique per organization
@@ -44851,7 +44889,8 @@ For detailed per-dimension adaptation rules, read
44851
44889
  | Command | Purpose |
44852
44890
  | --- | --- |
44853
44891
  | \`/meta\` | Project lifecycle: init, status, update, fix, deploy, health, develop |
44854
- | \`/docs\` | Documentation lifecycle: create, checkpoint, cleanup, resume, verify |
44892
+ | \`/docs\` | Documentation lifecycle: create, review, verify |
44893
+ | \`/work\` | Task tracking: start, save, resume, done, list |
44855
44894
  | \`/database\` | Database operations: init, browse, query, schema, import |
44856
44895
  | \`/resource\` | Scaffold a new workflow or agent |
44857
44896
  | \`/templates\` | Discover and apply workflow templates |
@@ -44860,6 +44899,14 @@ For detailed per-dimension adaptation rules, read
44860
44899
  | \`/help\` | Command tree and navigation map |
44861
44900
  | \`/profile\` | View and update developer profile |
44862
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
+
44863
44910
  ## Maintaining Memory
44864
44911
 
44865
44912
  ### What Memory Is
@@ -44918,21 +44965,6 @@ Populate with content based on the resource definitions in src/.
44918
44965
  **\`review\`:** Review all docs/ files for accuracy against the actual resource
44919
44966
  definitions. Flag mismatches between documented schemas and code.
44920
44967
 
44921
- **\`checkpoint\`:** Save current work progress for session resume.
44922
- Create or update \`docs/in-progress/<topic>.mdx\` with:
44923
- - Current state and decisions made
44924
- - Remaining work and blockers
44925
- - Update \`docs/priorities.mdx\` with task status
44926
-
44927
- **\`cleanup\`:** Move completed documents from \`docs/in-progress/\` to their
44928
- final location in \`docs/\`. Review each in-progress doc to determine if it's
44929
- complete. Incomplete docs remain in \`docs/in-progress/\`.
44930
- Also rebuild \`docs/navigation.mdx\` from the current project state.
44931
-
44932
- **\`resume\`:** Start-of-session command. Review in-progress docs, priorities,
44933
- and recent deployment state. Present a summary: what's in progress, what's
44934
- blocking, what's next. Offer to continue the highest-priority item.
44935
-
44936
44968
  **\`verify [path]\`:** Cross-reference documentation with the codebase.
44937
44969
  Read the specified doc (or all docs if no path), compare claims against actual
44938
44970
  code (resource IDs, schema fields, platform tools used), and report
@@ -44986,10 +45018,14 @@ cannot specify schemas directly.
44986
45018
  - Add to \`src/index.ts\` registry
44987
45019
 
44988
45020
  **\`tool-step <name>\`:** Create a step that calls a platform tool:
44989
- - Import \`{ platform, PlatformToolError }\` from '@elevasis/sdk/worker'
44990
- - Use \`await platform.call({ tool, method, params, credential })\`
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
44991
45026
  - Wrap in try/catch for PlatformToolError
44992
45027
  - Note: 60s timeout per call, credential required for integration tools
45028
+ - See reference/platform-tools/adapters.mdx for the full adapter API
44993
45029
  `;
44994
45030
  }
44995
45031
  function claudeTutorialCommandTemplate() {
@@ -45042,7 +45078,10 @@ Observation focus: optional fields, types, suggesting own fields.
45042
45078
  **Lesson 4: Using Platform Tools**
45043
45079
  Explain platform tools (concepts page). Browse available tools via
45044
45080
  reference/platform-tools/index.mdx. Pick a tool based on user's goals.
45045
- Build: add a platform.call() step. Explain credential setup.
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.
45046
45085
  Observation focus: credential model, async/await.
45047
45086
 
45048
45087
  **Lesson 5: Multi-Step Workflows**
@@ -45103,11 +45142,17 @@ Available Commands:
45103
45142
  /docs Documentation lifecycle
45104
45143
  /docs Show documentation status
45105
45144
  /docs create Create new documentation page
45106
- /docs checkpoint Save progress for session resume
45107
- /docs cleanup Move completed docs, rebuild navigation maps
45108
- /docs resume Review in-progress work and priorities
45145
+ /docs review Review docs for accuracy
45109
45146
  /docs verify Cross-reference docs with codebase for accuracy
45110
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
+
45111
45156
  /database Database operations
45112
45157
  /database init Connect Supabase project
45113
45158
  /database browse Query and display table contents
@@ -45234,14 +45279,14 @@ You are an agent development assistant for this Elevasis workspace.
45234
45279
 
45235
45280
  Agent definitions are accepted by the SDK and appear in the registry.
45236
45281
  Autonomous agent execution (multi-turn tool use loops) is deferred.
45237
- LLM calls are available via \`platform.call({ tool: 'llm' })\` as a workaround.
45282
+ LLM calls are available via the \`llm\` typed adapter: \`import { llm } from '@elevasis/sdk/worker'\`, then \`await llm.generate({ messages: [...] })\`.
45238
45283
 
45239
45284
  ## Operations
45240
45285
 
45241
45286
  **\`/agent\` (no args):** Explain the current state:
45242
45287
  - Agent definitions are accepted by the SDK and appear in the registry
45243
45288
  - Autonomous agent execution (multi-turn tool use loops) is deferred
45244
- - LLM calls are available via platform.call({ tool: 'llm' }) as a workaround
45289
+ - LLM calls are available via the \`llm\` typed adapter (\`import { llm } from '@elevasis/sdk/worker'\`)
45245
45290
  - Show the AgentDefinition pattern for future use
45246
45291
 
45247
45292
  **\`/agent scaffold <name>\`:** Create an agent definition with:
@@ -45398,6 +45443,9 @@ Detect and repair drift without a version upgrade:
45398
45443
 
45399
45444
  ### \`/meta deploy\` -- Full Deploy Pipeline
45400
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.
45401
45449
  1. Run \`elevasis check\` (validation)
45402
45450
  2. Type check if \`tsconfig.json\` exists
45403
45451
  3. Verify docs reflect current resources
@@ -45409,6 +45457,8 @@ Detect and repair drift without a version upgrade:
45409
45457
  9. If git configured and remote exists: optionally push
45410
45458
 
45411
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.
45412
45462
 
45413
45463
  ### \`/meta health\` -- Execution Debugging
45414
45464
 
@@ -45447,6 +45497,147 @@ The agent reads current templates from the installed SDK:
45447
45497
  \`@elevasis/sdk/templates\` subpath exports all template functions.
45448
45498
  `;
45449
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
+ }
45450
45641
  function starterTemplate() {
45451
45642
  return `import type { OrganizationResources } from '@elevasis/sdk'
45452
45643
  import * as operations from './operations/index.js'
@@ -45508,6 +45699,7 @@ function platformStatusTemplate() {
45508
45699
  return `import type { WorkflowDefinition } from '@elevasis/sdk'
45509
45700
  import { StepType } from '@elevasis/sdk'
45510
45701
  import { platform } from '@elevasis/sdk/worker'
45702
+ import { llm } from '@elevasis/sdk/worker'
45511
45703
  import { z } from 'zod'
45512
45704
 
45513
45705
  const input = z.object({
@@ -45559,33 +45751,29 @@ export const platformStatus: WorkflowDefinition = {
45559
45751
  description: 'Generates a natural language summary from raw status data',
45560
45752
  handler: async (rawInput) => {
45561
45753
  const { raw } = rawInput as z.infer<typeof statusData>
45562
- const result = await platform.call({
45563
- tool: 'llm',
45564
- method: 'generate',
45565
- params: {
45566
- provider: 'google',
45567
- model: 'gemini-3-flash-preview',
45568
- messages: [
45569
- {
45570
- role: 'user',
45571
- content: [
45572
- 'Summarize this platform status overview in 3-5 concise bullet points.',
45573
- 'Focus on: execution health, pending items needing attention, upcoming schedules, and credential coverage.',
45574
- 'Be specific with numbers. Flag any issues.',
45575
- '',
45576
- JSON.stringify(raw, null, 2),
45577
- ].join('\\n'),
45578
- },
45579
- ],
45580
- responseSchema: {
45581
- type: 'object',
45582
- properties: {
45583
- summary: { type: 'string', description: 'Natural language status summary with bullet points' },
45584
- },
45585
- required: ['summary'],
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' },
45586
45773
  },
45587
- temperature: 0,
45774
+ required: ['summary'],
45588
45775
  },
45776
+ temperature: 0,
45589
45777
  })
45590
45778
  const summary = (result as any)?.summary ?? String(result)
45591
45779
  return { raw, summary }
@@ -45648,7 +45836,8 @@ function registerUpdateCommand(program3) {
45648
45836
  ".claude/commands/database.md": claudeDatabaseCommandTemplate,
45649
45837
  ".claude/commands/agent.md": claudeAgentCommandTemplate,
45650
45838
  ".claude/commands/profile.md": claudeProfileCommandTemplate,
45651
- ".claude/commands/meta.md": claudeMetaCommandTemplate
45839
+ ".claude/commands/meta.md": claudeMetaCommandTemplate,
45840
+ ".claude/commands/work.md": claudeWorkCommandTemplate
45652
45841
  };
45653
45842
  const added = [];
45654
45843
  const flagged = [];
@@ -45756,6 +45945,216 @@ function registerUpdateCommand(program3) {
45756
45945
  }));
45757
45946
  }
45758
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
+
45759
46158
  // src/cli/index.ts
45760
46159
  (0, import_dotenv.config)({ path: (0, import_path5.resolve)(process.cwd(), ".env"), override: false });
45761
46160
  var program2 = new Command();
@@ -45786,6 +46185,7 @@ registerDescribeCommand(program2);
45786
46185
  registerDeploymentsCommand(program2);
45787
46186
  registerInitCommand(program2);
45788
46187
  registerUpdateCommand(program2);
46188
+ registerCredsCommand(program2);
45789
46189
  program2.parse();
45790
46190
  /*! Bundled license information:
45791
46191