@elevasis/sdk 1.5.4 → 1.5.5

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
@@ -43990,7 +43990,7 @@ function wrapAction(commandName, fn) {
43990
43990
  // package.json
43991
43991
  var package_default = {
43992
43992
  name: "@elevasis/sdk",
43993
- version: "1.5.4",
43993
+ version: "1.5.5",
43994
43994
  description: "SDK for building Elevasis organization resources",
43995
43995
  type: "module",
43996
43996
  bin: {
@@ -46165,6 +46165,72 @@ function registerProjectCommands(program3) {
46165
46165
  registerNoteDelete(program3);
46166
46166
  }
46167
46167
 
46168
+ // src/cli/commands/issue/issue.ts
46169
+ var import_node_fs2 = require("node:fs");
46170
+
46171
+ // ../core/src/issues/api-schemas.ts
46172
+ var IssueSeverityEnum = external_exports.enum(["critical", "warning", "info"]);
46173
+ var IssueCategoryEnum = external_exports.enum([
46174
+ "ui_bug",
46175
+ "data_inconsistency",
46176
+ "performance",
46177
+ "error_pattern",
46178
+ "configuration",
46179
+ "other"
46180
+ ]);
46181
+ var IssueStatusEnum = external_exports.enum(["open", "investigating", "resolved", "wont_fix"]);
46182
+ var IssueSourceEnum = external_exports.enum(["agent", "cli", "api", "webhook", "user", "external"]);
46183
+ var CreateIssueInputSchema = external_exports.object({
46184
+ title: external_exports.string().min(1),
46185
+ description: external_exports.string().min(1),
46186
+ severity: IssueSeverityEnum,
46187
+ category: IssueCategoryEnum,
46188
+ affected_page: external_exports.string().nullish(),
46189
+ evidence: external_exports.record(external_exports.string(), external_exports.unknown()).nullish(),
46190
+ context: external_exports.record(external_exports.string(), external_exports.unknown()).nullish(),
46191
+ project_id: external_exports.string().uuid().nullish(),
46192
+ task_id: external_exports.string().uuid().nullish()
46193
+ }).strict();
46194
+ var ListIssuesQuerySchema = external_exports.object({
46195
+ status: IssueStatusEnum.optional(),
46196
+ severity: IssueSeverityEnum.optional(),
46197
+ project_id: external_exports.string().uuid().optional(),
46198
+ limit: external_exports.coerce.number().int().min(1).max(200).default(50)
46199
+ });
46200
+
46201
+ // src/cli/commands/issue/issue.ts
46202
+ function registerIssueCommands(program3) {
46203
+ program3.command("issue:submit").description(
46204
+ "Submit a structured issue report via POST /api/external/issues\n Example: elevasis-sdk issue:submit -f ./issue.json"
46205
+ ).option("-i, --input <json>", "Issue body as JSON string").option("-f, --input-file <path>", "Read issue body from a JSON file (avoids shell escaping)").option("--api-url <url>", "API base URL").option("--pretty", "Render human-readable output instead of raw JSON").action(
46206
+ wrapAction("issue:submit", async (options2) => {
46207
+ if (!options2.input && !options2.inputFile) {
46208
+ throw new Error("Provide --input <json> or --input-file <path>");
46209
+ }
46210
+ const raw = options2.inputFile ? JSON.parse((0, import_node_fs2.readFileSync)(options2.inputFile, "utf8")) : JSON.parse(options2.input);
46211
+ const parsed = CreateIssueInputSchema.safeParse(raw);
46212
+ if (!parsed.success) {
46213
+ const issues = parsed.error.issues.map((i) => ` - ${i.path.join(".") || "(root)"}: ${i.message}`).join("\n");
46214
+ throw new Error(`Invalid issue body:
46215
+ ${issues}`);
46216
+ }
46217
+ const apiUrl = resolveApiUrl(options2.apiUrl);
46218
+ const result = await apiPost("/api/external/issues", parsed.data, apiUrl);
46219
+ if (options2.pretty) {
46220
+ const i = result.issue;
46221
+ console.log(source_default.green("\nIssue submitted"));
46222
+ console.log(source_default.gray(` ID: ${i.id}`));
46223
+ console.log(source_default.gray(` Severity: ${i.severity}`));
46224
+ console.log(source_default.gray(` Category: ${i.category}`));
46225
+ console.log(source_default.gray(` Status: ${i.status}`));
46226
+ console.log();
46227
+ } else {
46228
+ console.log(JSON.stringify(result, null, 2));
46229
+ }
46230
+ })
46231
+ );
46232
+ }
46233
+
46168
46234
  // src/cli/commands/init-claude.ts
46169
46235
  var import_path4 = require("path");
46170
46236
  var import_fs2 = require("fs");
@@ -46707,6 +46773,7 @@ Commands:
46707
46773
  elevasis-sdk project:list [--search <query>] List projects with optional search
46708
46774
  elevasis-sdk project:resolve <query> Resolve a project ID from a name or UUID
46709
46775
  elevasis-sdk project:work <query> Open a lifecycle-aware project work brief
46776
+ elevasis-sdk issue:submit -f <path> Submit a structured issue report
46710
46777
  elevasis-sdk rename <id> --to <newId> [--prod] Rename resource across platform tables
46711
46778
  elevasis-sdk init-claude Initialize .claude/ config from SDK
46712
46779
  elevasis-sdk generate-docs Generate docs/index.md from frontmatter
@@ -46727,6 +46794,7 @@ registerCredsCommand(program2);
46727
46794
  registerErrorCommand(program2);
46728
46795
  registerRenameCommand(program2);
46729
46796
  registerProjectCommands(program2);
46797
+ registerIssueCommands(program2);
46730
46798
  registerInitClaudeCommand(program2);
46731
46799
  registerGenerateDocsCommand(program2);
46732
46800
  registerGenerateResourcesCommand(program2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elevasis/sdk",
3
- "version": "1.5.4",
3
+ "version": "1.5.5",
4
4
  "description": "SDK for building Elevasis organization resources",
5
5
  "type": "module",
6
6
  "bin": {
@@ -44,8 +44,8 @@
44
44
  "tsup": "^8.0.0",
45
45
  "typescript": "5.9.2",
46
46
  "zod": "^4.1.0",
47
- "@repo/typescript-config": "0.0.0",
48
- "@repo/core": "0.5.0"
47
+ "@repo/core": "0.5.0",
48
+ "@repo/typescript-config": "0.0.0"
49
49
  },
50
50
  "scripts": {
51
51
  "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 --banner:js=\"#!/usr/bin/env node\" && node scripts/copy-reference-docs.mjs && node ../../scripts/monorepo/generate-reference-artifacts.js",
@@ -8,5 +8,4 @@
8
8
 
9
9
  ## Env Requirements
10
10
 
11
- - `ELEVASIS_API_URL` (base URL of the Elevasis API)
12
- - `ELEVASIS_API_KEY` (Bearer `sk_*`, provisioned via Command Center → Settings → API Keys)
11
+ - `ELEVASIS_PLATFORM_KEY` (same key used by all `elevasis-sdk` commands — no extra setup if deploy already works)
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: submit-issue
3
- description: Submit a structured issue report to the Elevasis platform via API — enforces pre-analysis before posting
3
+ description: Submit a structured issue report to the Elevasis platform via CLI — enforces pre-analysis before posting
4
4
  ---
5
5
 
6
6
  # Submit Issue
@@ -9,18 +9,13 @@ Submit a structured issue report to the Elevasis platform. The agent performs a
9
9
 
10
10
  **Usage:** `/submit-issue [optional description]`
11
11
 
12
- If a description is provided, it is the primary signal for Phase 1. Otherwise the agent analyzes recent conversation context (~20 messages) plus any active error context.
12
+ If a description is provided, it is the primary signal for Phase 1. Otherwise the agent analyzes recent conversation context plus any active error context.
13
13
 
14
14
  ## Env Requirements
15
15
 
16
- Both variables must be present in the project's root `.env`:
16
+ `ELEVASIS_PLATFORM_KEY` must be present in the project's root `.env` (the same key used by all other `elevasis-sdk` commands — no additional setup needed if deploy is already working).
17
17
 
18
- | Variable | Description |
19
- | ------------------ | --------------------------------------------------------------------------------------------- |
20
- | `ELEVASIS_API_URL` | Platform API base URL (e.g. `https://api.elevasis.io`) |
21
- | `ELEVASIS_API_KEY` | API key starting with `sk_` (67 chars), provisioned from Command Center > Settings > API Keys |
22
-
23
- The organization is resolved server-side from the key. Never include an `organization_id` in the request body.
18
+ The organization and API base URL are resolved automatically by the CLI. No `ELEVASIS_API_KEY` or `ELEVASIS_API_URL` needed.
24
19
 
25
20
  ## Pre-Analysis Phases
26
21
 
@@ -81,7 +76,7 @@ Select exactly one value for each:
81
76
 
82
77
  ### Phase 5: Build Structured Report
83
78
 
84
- Assemble the request body from phases 1–4:
79
+ Assemble the report body from phases 1–4:
85
80
 
86
81
  ```json
87
82
  {
@@ -106,6 +101,8 @@ Assemble the request body from phases 1–4:
106
101
 
107
102
  Omit any field that has nothing meaningful to record. `project_id` and `task_id` are optional UUID fields — include them only if the issue is clearly scoped to a specific project or task visible in context.
108
103
 
104
+ Do NOT include `source` or `organization_id` — the server sets both automatically.
105
+
109
106
  ### Phase 6: Confirm with User
110
107
 
111
108
  Unless the command was invoked with `--auto`, present the assembled report to the user before submitting:
@@ -136,44 +133,33 @@ Auto-submit (`--auto`) skips this confirmation entirely — use only when the ca
136
133
 
137
134
  ## Submit
138
135
 
139
- Once confirmed (or `--auto`), POST to the external issues endpoint:
136
+ Once confirmed (or `--auto`), write the assembled JSON body to a temp file then submit via the SDK CLI:
140
137
 
141
138
  ```bash
142
- curl -sS -X POST "${ELEVASIS_API_URL}/api/external/issues" \
143
- -H "Authorization: Bearer ${ELEVASIS_API_KEY}" \
144
- -H "Content-Type: application/json" \
145
- -d @- <<'JSON'
146
- {
147
- "title": "...",
148
- "description": "...",
149
- "severity": "warning",
150
- "category": "ui_bug",
151
- "affected_page": "/projects/abc",
152
- "evidence": {},
153
- "context": {}
154
- }
155
- JSON
139
+ # Write the report body to a temp file
140
+ # (Use the Write tool to create issue-report.json at the project root)
141
+
142
+ pnpm exec elevasis-sdk issue:submit --input-file ./issue-report.json --pretty
156
143
  ```
157
144
 
158
- Do NOT include `source` or `organization_id` in the body the server sets both automatically.
145
+ Delete the temp file after submission succeeds or fails.
159
146
 
160
147
  ## Report Back
161
148
 
162
- On a successful response (2xx), surface the issue ID to the user:
149
+ On success, the CLI prints the issue ID. Surface it to the user:
163
150
 
164
151
  ```
165
152
  Submitted — id: <uuid>
166
153
  Track it in Command Center > Issues.
167
154
  ```
168
155
 
169
- If the response body contains additional fields (status, created_at), include them in a brief one-line summary.
170
-
171
156
  ## Troubleshooting
172
157
 
173
- | Status | Cause | Fix |
174
- | ------------------ | ----------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
175
- | `401 Unauthorized` | `ELEVASIS_API_KEY` is missing, malformed, or revoked | Verify the key in root `.env` starts with `sk_` and is 67 chars. Re-provision from Command Center > Settings > API Keys if needed. |
176
- | `403 Forbidden` | Key exists but the associated org lacks access to issue reporting | Contact the platform operator to verify the key's org permissions. |
177
- | `400 Bad Request` | Request body failed validation | Read the response body for the specific field error. Common causes: missing `title` or `description`, invalid `severity` or `category` value. |
178
- | `404 Not Found` | `ELEVASIS_API_URL` is wrong or the endpoint path has a typo | Confirm the URL in `.env` (no trailing slash) and that the path is exactly `/api/external/issues`. |
179
- | Connection refused | API server unreachable | Check `ELEVASIS_API_URL` and network connectivity. For local dev, confirm the API server is running. |
158
+ | Error | Cause | Fix |
159
+ | ------------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
160
+ | `ELEVASIS_PLATFORM_KEY` missing | Key not set in root `.env` | Add `ELEVASIS_PLATFORM_KEY=sk_...` to `.env`. Provision from Command Center > Settings > API Keys. |
161
+ | `401 Unauthorized` | Key is malformed or revoked | Verify the key starts with `sk_` and is 67 chars. Re-provision if needed. |
162
+ | `403 Forbidden` | Key's org lacks access to issue reporting | Contact the platform operator to verify the key's org permissions. |
163
+ | `Invalid issue body` | Report failed CLI-side Zod validation before the request was sent | Read the field errors printed by the CLI. Common causes: missing `title`/`description`, invalid enum. |
164
+ | `400 Bad Request` | Body passed CLI validation but failed server-side validation | Read the response body for the specific field error. |
165
+ | Connection refused | API server unreachable | Default target is `https://api.elevasis.io` — check network. For local dev, set `ELEVASIS_API_URL` in `.env`. |
@@ -1,4 +1,4 @@
1
- <!-- Auto-generated on 2026-04-19T10:24:34.890Z by scripts/monorepo/generate-scaffold-contracts.js -->
1
+ <!-- Auto-generated on 2026-04-19T10:47:49.477Z by scripts/monorepo/generate-scaffold-contracts.js -->
2
2
  ---
3
3
  title: Reference Contracts
4
4
  description: Auto-generated TypeScript contracts for SDK consumers. Do not edit manually.