@elevasis/sdk 1.5.3 → 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.
Files changed (58) hide show
  1. package/dist/cli.cjs +967 -57
  2. package/dist/index.d.ts +94 -110
  3. package/package.json +2 -2
  4. package/reference/_navigation.md +11 -1
  5. package/reference/_reference-manifest.json +70 -0
  6. package/reference/claude-config/commands/submit-issue.md +11 -0
  7. package/reference/claude-config/hooks/post-edit-validate.mjs +109 -0
  8. package/reference/claude-config/hooks/tool-failure-recovery.mjs +73 -0
  9. package/reference/claude-config/rules/deployment.md +57 -0
  10. package/reference/claude-config/rules/docs.md +26 -0
  11. package/reference/claude-config/rules/error-handling.md +56 -0
  12. package/reference/claude-config/rules/execution.md +40 -0
  13. package/reference/claude-config/rules/frontend.md +43 -0
  14. package/reference/claude-config/rules/observability.md +31 -0
  15. package/reference/claude-config/rules/organization-os.md +62 -0
  16. package/reference/claude-config/rules/platform.md +41 -0
  17. package/reference/claude-config/rules/shared-types.md +46 -0
  18. package/reference/claude-config/rules/task-tracking.md +47 -0
  19. package/reference/claude-config/scripts/statusline-command.js +18 -0
  20. package/reference/claude-config/settings.json +30 -0
  21. package/reference/claude-config/skills/deploy/SKILL.md +166 -0
  22. package/reference/claude-config/skills/dsp/SKILL.md +66 -0
  23. package/reference/claude-config/skills/elevasis/SKILL.md +239 -0
  24. package/reference/claude-config/skills/explore/SKILL.md +78 -0
  25. package/reference/claude-config/skills/project/SKILL.md +918 -0
  26. package/reference/claude-config/skills/save/SKILL.md +197 -0
  27. package/reference/claude-config/skills/setup/SKILL.md +210 -0
  28. package/reference/claude-config/skills/status/SKILL.md +60 -0
  29. package/reference/claude-config/skills/submit-issue/SKILL.md +165 -0
  30. package/reference/claude-config/skills/sync/SKILL.md +81 -0
  31. package/reference/cli.mdx +19 -4
  32. package/reference/deployment/provided-features.mdx +24 -2
  33. package/reference/framework/agent.mdx +12 -4
  34. package/reference/framework/project-structure.mdx +9 -3
  35. package/reference/packages/core/src/README.md +1 -1
  36. package/reference/packages/core/src/business/README.md +52 -0
  37. package/reference/packages/core/src/organization-model/README.md +25 -26
  38. package/reference/packages/ui/src/app/README.md +24 -0
  39. package/reference/platform-tools/type-safety.mdx +0 -10
  40. package/reference/scaffold/core/organization-graph.mdx +37 -28
  41. package/reference/scaffold/core/organization-model.mdx +34 -36
  42. package/reference/scaffold/index.mdx +1 -0
  43. package/reference/scaffold/operations/propagation-pipeline.md +7 -3
  44. package/reference/scaffold/operations/scaffold-maintenance.md +2 -2
  45. package/reference/scaffold/operations/workflow-recipes.md +18 -1
  46. package/reference/scaffold/recipes/add-a-feature.md +37 -21
  47. package/reference/scaffold/recipes/add-a-resource.md +4 -2
  48. package/reference/scaffold/recipes/customize-organization-model.md +400 -0
  49. package/reference/scaffold/recipes/extend-a-base-entity.md +140 -0
  50. package/reference/scaffold/recipes/gate-by-feature-or-admin.md +18 -12
  51. package/reference/scaffold/recipes/index.md +3 -3
  52. package/reference/scaffold/reference/contracts.md +11 -32
  53. package/reference/scaffold/reference/feature-registry.md +10 -9
  54. package/reference/scaffold/reference/glossary.md +14 -18
  55. package/reference/scaffold/ui/customization.md +2 -2
  56. package/reference/scaffold/ui/feature-flags-and-gating.md +40 -54
  57. package/reference/scaffold/ui/feature-shell.mdx +22 -23
  58. package/reference/scaffold/ui/recipes.md +118 -3
@@ -0,0 +1,197 @@
1
+ ---
2
+ name: save
3
+ description: Auto-manage project documentation and persist task resume context from conversation
4
+ ---
5
+
6
+ # Save
7
+
8
+ Auto-manage project documentation from conversation context, and fan out conversation signals to the canonical project system (`prj_tasks.resume_context`, `prj_notes`) via the `elevasis-sdk` CLI.
9
+
10
+ ## Canonical Sources of Truth
11
+
12
+ - **Task resume context (DB):** `prj_tasks.resume_context` is canonical. Agents write it via `elevasis-sdk project:task:save`. Humans edit it via the inline task editor in Command Center. **Never** stash resume context into task-doc frontmatter.
13
+ - **Task-doc frontmatter:** ONLY `title`, `description`, `status`. No `resume_context`, no files-modified, no next-steps arrays -- those belong in the DB.
14
+ - **Project notes (DB):** `prj_notes` via `elevasis-sdk project:note:create`. Typed notes (`status_update` / `issue` / `blocker` / `call_note`) are the durable record of conversation signals.
15
+
16
+ ## Process
17
+
18
+ ### Step 1: Resolve Project + Task Context
19
+
20
+ Before doing anything else, determine the active project / task:
21
+
22
+ 1. Look for an active task-doc frontmatter in the current conversation or the most recently edited file under `docs/`. Expected frontmatter:
23
+
24
+ ```yaml
25
+ ---
26
+ title: Short title
27
+ description: One-line summary
28
+ status: planned | in-progress | blocked | complete
29
+ ---
30
+ ```
31
+
32
+ 2. If the task doc references a project/task UUID anywhere in its body (link, callout, or prior save output), capture those IDs.
33
+ 3. If no task / project context is resolvable, PROMPT the user:
34
+ - "Which project is this work under?" (accepts slug or UUID)
35
+ - "Is there an existing task I should attach this to? (task UUID, or 'new')"
36
+
37
+ Do not guess. Without a task ID, skip Step 4 (DB resume-context save) but still perform Steps 2, 3, 5, 6, 7.
38
+
39
+ ### Step 2: Analyze Conversation
40
+
41
+ Review the current conversation to identify:
42
+
43
+ 1. **New knowledge** -- architecture decisions, feature implementations, bug fixes, discoveries
44
+ 2. **Changed state** -- what was in-progress that is now complete, what new work started
45
+ 3. **Stale docs** -- information in existing docs that is now outdated
46
+ 4. **Signal events** -- blocker hit, status update worth recording, issue uncovered, call outcome
47
+ 5. **OS contract paths touched** -- scan files read/written/edited for any of these signals:
48
+ - `foundations/config/organization-model.ts` -> Foundations layer, Organization Model
49
+ - `foundations/types/index.ts` -> Foundations layer, Workflow Contracts
50
+ - `ui/src/routes/__root.tsx` -> UI Shell Runtime composition
51
+ - `ui/src/features/**/manifest.ts` or any file defining a `FeatureModule` -> Features layer
52
+ - `operations/src/index.ts` or `operations/elevasis.config.ts` -> Foundations/Deployment (DeploymentSpec)
53
+ - Any file inside `ui/src/features/<feature>/` combined with manifest, nav, or sidebar changes -> Features + Toolkit layers
54
+
55
+ Record which OS layers were touched: `foundations`, `features`, `shell-runtime`, `toolkit`, `deployment`. If none matched, OS awareness stays dormant for the rest of this run.
56
+
57
+ ### Step 3: Update Knowledge Docs
58
+
59
+ Scan `docs/` for unindexed or stale knowledge docs and draft creates / updates / moves. All edits are on knowledge/architecture/feature docs -- NOT on task resume state (that flows to the DB in Step 4).
60
+
61
+ Determine what needs to happen:
62
+
63
+ - **Create** new docs for significant new knowledge (new features, architecture decisions)
64
+ - **Update** existing docs with corrections, completions, or new details
65
+ - **Move** docs between directories (e.g., `ui/` to `operations/` when ownership shifts)
66
+ - **Delete** docs that are fully obsolete (rare -- prefer updating)
67
+
68
+ **Frontmatter requirement (all docs in `docs/`):**
69
+
70
+ ```markdown
71
+ ---
72
+ title: Short descriptive title
73
+ description: One-line summary of what this doc covers
74
+ ---
75
+ ```
76
+
77
+ In-progress task docs additionally require `status`:
78
+
79
+ ```markdown
80
+ ---
81
+ title: Feature Name
82
+ description: What this task is about
83
+ status: planned | in-progress | blocked | complete
84
+ ---
85
+ ```
86
+
87
+ No other fields. Do NOT add `resume_context`, `files_modified`, or `next_steps` to frontmatter -- those flow to the DB via Step 4.
88
+
89
+ **Doc structure rules:**
90
+
91
+ - `docs/ui/` -- frontend features, auth, components, hooks, charts, pages
92
+ - `docs/operations/` -- platform workflows, agents, deployment, resource registry
93
+ - `docs/knowledge/` -- project knowledge, research, reference material, domain context
94
+ - New sections auto-detected -- any subdirectory of `docs/` becomes a section
95
+ - All docs are `.md` (not .mdx)
96
+ - Keep docs focused -- one topic per file
97
+ - Use markdown tables for structured data
98
+ - Include "Last Updated: YYYY-MM-DD" at the bottom of modified docs
99
+
100
+ **OS layer annotation:** If OS contract paths were touched (Step 2), include an `## Organization OS Impact` section in any newly created architecture doc:
101
+
102
+ ```markdown
103
+ ## Organization OS Impact
104
+
105
+ Touched contracts: [list files]
106
+ Affected layers: [list of layers]
107
+ Cross-reference: `node_modules/@elevasis/sdk/reference/scaffold/reference/glossary.md`
108
+ Downstream: template consumer adapters may need review.
109
+ ```
110
+
111
+ Dispatch a `general-purpose` subagent with the plan, conversation context, and these rules. The subagent must read each target file before editing.
112
+
113
+ ### Step 4: Persist Task Resume Context to DB
114
+
115
+ If Step 1 resolved a task ID, save the current state to `prj_tasks.resume_context` via the SDK CLI. This is the canonical persistence step and must run every `/save` invocation that has a task in scope:
116
+
117
+ ```bash
118
+ pnpm exec elevasis-sdk project:task:save <task-uuid> \
119
+ --current-state "<concise prose summary of where we are>" \
120
+ --next-steps "<concise prose of the next concrete action>" \
121
+ --files-modified '["path/one.ts","path/two.tsx"]' \
122
+ --key-docs '["docs/knowledge/foo.md"]' \
123
+ --tools '["project:task:save","project:note:create"]'
124
+ ```
125
+
126
+ Arg rules:
127
+
128
+ - `--current-state` (required) -- terse, present-tense "what is true right now". Prefer latest state over accumulated history.
129
+ - `--next-steps` -- single next concrete action another agent could execute without re-deriving intent.
130
+ - `--files-modified` -- JSON array of uncommitted / just-changed file paths (relative to project root).
131
+ - `--key-docs` -- JSON array of doc paths an agent should re-read to resume.
132
+ - `--tools` -- JSON array of tool / CLI names used this session that are worth flagging.
133
+
134
+ The endpoint is `PATCH /api/external/tasks/<id>/resume-context` and merges (does not replace) provided fields. Omit any arg that has nothing meaningful to record.
135
+
136
+ ### Step 5: Create Typed Project Notes on Signal Events
137
+
138
+ For each signal event identified in Step 2, create a typed `prj_note`. One CLI call per note:
139
+
140
+ ```bash
141
+ pnpm exec elevasis-sdk project:note:create \
142
+ --project <project-uuid> \
143
+ --task <task-uuid> # optional, omit if not scoped to a task \
144
+ --type <note-type> \
145
+ --content "<what happened, why it matters, any next action>"
146
+ ```
147
+
148
+ Note-type mapping (use the first type that matches, in this order):
149
+
150
+ - **`blocker`** -- work cannot proceed without external action (decision, credential, fix elsewhere, upstream change). Always create if detected. Trigger phrases: "I'm stuck", "blocked on", "can't proceed until", "waiting on <X>". When detected AND a task ID is in scope, ALSO fire a status transition -- see Step 5a below.
151
+ - **`issue`** -- bug, regression, unexpected failure, contract mismatch. Include reproduction context in `--content`.
152
+ - **`status_update`** -- milestone-level progress worth flagging to the human operator (phase complete, substantial deliverable landed, direction change). Keep it substantive -- `/save` runs shouldn't emit a status_update every turn.
153
+ - **`call_note`** -- only if the conversation is transcribing a live client / stakeholder call.
154
+
155
+ If no signal rises to note-worthy, skip this step entirely. Do not create filler notes.
156
+
157
+ ### Step 5a: Blocker Signal -> Task Status Transition
158
+
159
+ Run this ONLY when Step 5 created a `blocker` note AND Step 1 resolved a task ID. It's the second half of the "I'm stuck" fanout: the note captures the why, this call flips the task's lifecycle state so it surfaces as blocked in portfolio views.
160
+
161
+ ```bash
162
+ pnpm -C operations exec elevasis-sdk project:task:update <task-uuid> --status blocked
163
+ ```
164
+
165
+ Rules:
166
+
167
+ - **Explicit task ID only** -- use the UUID resolved in Step 1. Do not re-derive or guess. If no task is in scope, skip this step (the blocker note still ships without it).
168
+ - **Best-effort** -- if the CLI returns non-2xx, surface a single warning line in Step 7 ("Warning: could not transition task <id> to blocked: <reason>") and continue. Do not retry, do not block the rest of `/save`.
169
+ - **Idempotent** -- if the task is already `blocked`, the update is a no-op. Fire it anyway; do not pre-check.
170
+ - **Order** -- the `blocker` note (Step 5) creates first; this transition follows. Keeps the note attached to the task even if the status update later fails.
171
+
172
+ ### Step 6: Regenerate Docs Index
173
+
174
+ After the Step 3 subagent completes all doc file changes, regenerate `docs/index.md`:
175
+
176
+ ```bash
177
+ pnpm exec elevasis-sdk generate-docs
178
+ ```
179
+
180
+ This deterministically scans `docs/`, reads frontmatter, and rebuilds the navigation hub. Never edit `docs/index.md` manually.
181
+
182
+ ### Step 7: Report
183
+
184
+ Summarize:
185
+
186
+ - Knowledge docs created / updated / moved / deleted
187
+ - Task ID written to (Step 4): `resume_context.last_saved` timestamp from the CLI response
188
+ - Notes created (Step 5): count, types, IDs
189
+ - OS classification (if applicable): layers detected, contracts touched
190
+ - Any files skipped due to missing frontmatter (Step 3 subagent should have added it)
191
+ - Any follow-ups for the human operator
192
+
193
+ ## Failure Modes
194
+
195
+ - **No task in scope + user declines to provide one:** proceed with Steps 2, 3, 6, 7; skip Step 4; still allow Step 5 if a `--project` UUID is available.
196
+ - **`project:task:save` returns non-2xx:** surface the error in the report, do not retry silently; Step 5 and Step 6 still run.
197
+ - **`generate-docs` fails:** surface the error; doc edits from Step 3 are already on disk, so they are not lost -- the operator can re-run the index regeneration manually.
@@ -0,0 +1,210 @@
1
+ ---
2
+ name: setup
3
+ description: First-time project setup — detect and replace template placeholders, install dependencies, verify build
4
+ argument-hint: ""
5
+ ---
6
+
7
+ # Setup
8
+
9
+ First-time project setup for projects cloned directly from the template.
10
+
11
+ **Usage:** `/setup`
12
+
13
+ ## Process
14
+
15
+ ### Step 1: Detect State
16
+
17
+ Scan these key files for unresolved placeholders:
18
+
19
+ - `package.json` — look for `__PROJECT_SLUG__` in the `name` field
20
+ - `CLAUDE.md` — look for `TEMPLATE_PROJECT_NAME`
21
+ - `ui/package.json` — look for `__PROJECT_SLUG__`
22
+ - `ui/index.html` — look for `__PROJECT_NAME__`
23
+
24
+ If NO placeholders are found, the project is already configured. Print:
25
+
26
+ ```
27
+ Project is already configured. Running verification...
28
+ ```
29
+
30
+ Then skip directly to Step 4 (Install) or Step 5 (Verify) as appropriate.
31
+
32
+ ### Step 2: Collect Info
33
+
34
+ Ask the user for three values:
35
+
36
+ 1. **Slug** — lowercase, hyphens only (e.g., `acme-dashboard`). Default to the basename of the current working directory.
37
+ 2. **Human-readable name** — used in titles, docs, and CLAUDE.md (e.g., `Acme Dashboard`).
38
+ 3. **Short description** — one sentence, used in `package.json` and CLAUDE.md (e.g., `Client dashboard for Acme Corp.`).
39
+
40
+ Confirm the values before proceeding:
41
+
42
+ ```
43
+ Configuring project with:
44
+ Slug: <slug>
45
+ Name: <name>
46
+ Description: <description>
47
+ Date: <YYYY-MM-DD>
48
+
49
+ Proceed? (yes/no)
50
+ ```
51
+
52
+ ### Step 3: Get to Know the User and Client
53
+
54
+ Transition naturally after confirming the project values: "Now let me learn a bit about you and the client so I can be more helpful going forward."
55
+
56
+ **About the user (ask conversationally, one at a time):**
57
+
58
+ 1. **Name** -- "What's your first name?"
59
+ 2. **Role** -- "What's your role?" (e.g., founder, developer, project lead)
60
+ 3. **Technical level** -- "How comfortable are you with technical stuff? No wrong answer -- just helps me know how to explain things."
61
+ 4. **Communication style** -- "When I explain things or write docs, do you prefer short and to-the-point, or more detailed with context?"
62
+
63
+ Use their name naturally from this point on.
64
+
65
+ **About the client/company this project is for:**
66
+
67
+ 5. **Company name** -- "Who's this project for? What's the company name?"
68
+ 6. **What they do** -- "What does {company} do? Just a sentence or two."
69
+ 7. **Industry** -- "What industry or space are they in?"
70
+ 8. **Key context** -- "Anything else that would help me understand the project context? Key stakeholders, business goals, important constraints -- whatever comes to mind. (Totally fine to skip, we can add this as we go.)"
71
+
72
+ React to what they share, ask natural follow-ups if something is interesting or unclear. Don't make it feel like a form.
73
+
74
+ After gathering, confirm:
75
+
76
+ ```
77
+ Got it! Here's what I captured:
78
+
79
+ User: {name} ({role}, {technical level}, prefers {style})
80
+
81
+ Client: {company}
82
+ {what they do}
83
+ Industry: {industry}
84
+ {any additional context}
85
+
86
+ Look good?
87
+ ```
88
+
89
+ ### Step 4: Replace Placeholders
90
+
91
+ Search ALL files in the project matching these extensions: `.ts`, `.tsx`, `.js`, `.mjs`, `.json`, `.md`, `.mdx`, `.html`, `.yaml`, `.yml`, `.css`, `.env.example`
92
+
93
+ Exclude these directories and files: `node_modules/`, `dist/`, `.tanstack/`, `pnpm-lock.yaml`
94
+
95
+ For each matching file, replace all occurrences of:
96
+
97
+ | Placeholder | Replace with |
98
+ | ------------------------------ | ----------------------- |
99
+ | `__PROJECT_NAME__` | human-readable name |
100
+ | `__PROJECT_SLUG__` | slug |
101
+ | `__PROJECT_DESCRIPTION__` | description |
102
+ | `__DATE__` | today's date YYYY-MM-DD |
103
+ | `TEMPLATE_PROJECT_NAME` | human-readable name |
104
+ | `TEMPLATE_PROJECT_DESCRIPTION` | description |
105
+
106
+ Use the Read tool to read each file, then the Edit tool (with `replace_all: true`) or Write tool to apply the replacements. Read each file before writing.
107
+
108
+ After all replacements, re-scan the four key files from Step 1 to verify zero placeholders remain. If any are still present, report them by file and fix immediately.
109
+
110
+ ### Step 5: Populate Knowledge
111
+
112
+ Knowledge is split between `CLAUDE.md` (essentials loaded every turn) and `docs/knowledge/client.md` (detailed context loaded on demand).
113
+
114
+ #### 5a: CLAUDE.md — lightweight summary
115
+
116
+ **`{CLIENT_CONTEXT}`** -- replace with a single line:
117
+
118
+ ```markdown
119
+ **{company name}** — {what they do, one sentence}
120
+ ```
121
+
122
+ **`{USER_PREFERENCES}`** -- replace with a table:
123
+
124
+ ```markdown
125
+ | Name | Role | Technical Level | Communication |
126
+ | ------ | ------ | --------------- | ------------- |
127
+ | {name} | {role} | {level} | {preference} |
128
+ ```
129
+
130
+ If the user skipped any knowledge questions, fill in what was provided and omit what wasn't -- don't leave placeholder text behind.
131
+
132
+ #### 5b: docs/knowledge/client.md — full client context
133
+
134
+ Create `docs/knowledge/client.md` with the detailed info:
135
+
136
+ ```markdown
137
+ ---
138
+ title: Client Context
139
+ description: Company background, industry, stakeholders, and business goals
140
+ ---
141
+
142
+ # Client Context
143
+
144
+ **Company:** {company name}
145
+ **Industry:** {industry}
146
+ **Description:** {what they do}
147
+
148
+ ## Additional Context
149
+
150
+ {any additional context shared -- key stakeholders, business goals, constraints, etc. If nothing was shared, write "No additional context provided yet. Update this as the project evolves."}
151
+ ```
152
+
153
+ ### Step 6: Install Dependencies
154
+
155
+ ```bash
156
+ pnpm install
157
+ ```
158
+
159
+ This generates the project's own `pnpm-lock.yaml`. Report success or any errors.
160
+
161
+ ### Step 7: Verify
162
+
163
+ Run all checks sequentially (stop and report on first failure, but attempt all):
164
+
165
+ ```bash
166
+ pnpm -C ui check-types
167
+ pnpm -C ui build
168
+ pnpm -C operations check
169
+ pnpm -C operations check-types
170
+ ```
171
+
172
+ For each check, record PASS or FAIL. If a check fails, read the output and report the error clearly. Do not silently skip failures.
173
+
174
+ ### Step 8: Report
175
+
176
+ ```
177
+ You're all set, {name}!
178
+ ========================
179
+ Project: <Human Name>
180
+ Slug: <slug>
181
+ Client: <company name> (<industry>)
182
+
183
+ Verification:
184
+ [PASS/FAIL] Type-check (ui)
185
+ [PASS/FAIL] Production build (ui)
186
+ [PASS/FAIL] Resource validation (operations)
187
+ [PASS/FAIL] Type-check (operations)
188
+
189
+ Next steps:
190
+ 1. Copy root .env.example to .env and fill in ELEVASIS_PLATFORM_KEY
191
+ 2. Copy ui/.env.example to ui/.env and fill in VITE_WORKOS_CLIENT_ID
192
+ 3. See TODO.md for WorkOS dashboard setup and branding
193
+ 4. pnpm -C ui dev (start dev server on port 4300)
194
+ 5. (If client-workspace/ exists) Open it in Claude Code and run /setup
195
+ ```
196
+
197
+ If any verification step failed, add an Errors section listing each failure with its output before the Next steps.
198
+
199
+ ## Error Recovery
200
+
201
+ If placeholder replacement leaves stragglers:
202
+
203
+ ```
204
+ Placeholder Cleanup Required
205
+ =============================
206
+ Remaining: <list files and placeholders>
207
+ Action: Re-applying replacements to affected files...
208
+ ```
209
+
210
+ Fix each remaining occurrence before proceeding to Step 6.
@@ -0,0 +1,60 @@
1
+ ---
2
+ name: status
3
+ description: Quick project health check
4
+ ---
5
+
6
+ # Status
7
+
8
+ Quick project health check.
9
+
10
+ **Usage:** `/status`
11
+
12
+ ## Process
13
+
14
+ ### Step 1: Gather Data
15
+
16
+ Run in parallel:
17
+
18
+ 1. `git status` - working tree state
19
+ 2. `git log --oneline -5` - recent commits
20
+ 3. `pnpm test` - test results
21
+ 4. `pnpm lint` - type check
22
+
23
+ ### Step 2: Check Docs + Active Work
24
+
25
+ 1. Read `docs/index.md` - verify doc structure is current
26
+ 2. Query active project work via `pnpm -C operations exec elevasis-sdk project:list --status active,blocked --format brief` - active project/task count lives in the DB, not in `docs/in-progress/`
27
+
28
+ ### Step 3: Report
29
+
30
+ ```
31
+ Project Status
32
+ ==============
33
+
34
+ Git
35
+ ---
36
+ Branch: <branch>
37
+ Clean: Yes/No (N uncommitted changes)
38
+ Last commit: <hash> - <message> (<date>)
39
+
40
+ Tests
41
+ -----
42
+ Result: All passing / N failures
43
+ Details: [if failures, list them]
44
+
45
+ Types
46
+ -----
47
+ Result: Clean / N errors
48
+ Details: [if errors, list them]
49
+
50
+ Docs
51
+ ----
52
+ Architecture: N docs
53
+ Features: N docs
54
+
55
+ Active Work (DB)
56
+ ----------------
57
+ Projects: N active, N blocked
58
+ - [client 1] (status)
59
+ - [client 2] (status)
60
+ ```
@@ -0,0 +1,165 @@
1
+ ---
2
+ name: submit-issue
3
+ description: Submit a structured issue report to the Elevasis platform via CLI — enforces pre-analysis before posting
4
+ ---
5
+
6
+ # Submit Issue
7
+
8
+ Submit a structured issue report to the Elevasis platform. The agent performs a six-phase analysis before posting so that every submitted issue includes meaningful context, not just a one-liner.
9
+
10
+ **Usage:** `/submit-issue [optional description]`
11
+
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
+
14
+ ## Env Requirements
15
+
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
+
18
+ The organization and API base URL are resolved automatically by the CLI. No `ELEVASIS_API_KEY` or `ELEVASIS_API_URL` needed.
19
+
20
+ ## Pre-Analysis Phases
21
+
22
+ Complete all six phases before assembling the report or asking for confirmation. Do not skip phases — they ensure the submitted record is actionable.
23
+
24
+ ### Phase 1: Collect Context
25
+
26
+ Gather available context:
27
+
28
+ - If the user provided a description with the command, treat it as the primary signal.
29
+ - Otherwise review the last ~20 conversation messages for error output, failed commands, unexpected behavior, and any `explain_page` / active error context.
30
+ - Ask one targeted follow-up question if a key detail is ambiguous. Do not fire multiple questions at once.
31
+
32
+ ### Phase 2: Identify Source
33
+
34
+ Pinpoint where the issue originates:
35
+
36
+ - File paths (if a code or config file is involved)
37
+ - Workflow or agent resource IDs (if a platform execution failed)
38
+ - Execution IDs (if available in logs or prior output)
39
+ - Route or page path (if a UI issue)
40
+
41
+ Record these for the `evidence` and `affected_page` fields.
42
+
43
+ ### Phase 3: Gather Errors
44
+
45
+ Extract concrete error signals:
46
+
47
+ - Full error messages and stack traces (truncated to the relevant portion)
48
+ - HTTP status codes and response bodies
49
+ - Log lines with timestamps if available
50
+ - Screenshots or screenshot file references if the user provided them
51
+
52
+ These go into the `evidence` object.
53
+
54
+ ### Phase 4: Classify Severity and Category
55
+
56
+ Select exactly one value for each:
57
+
58
+ **Severity:**
59
+
60
+ | Value | When to use |
61
+ | ---------- | ------------------------------------------------------------------- |
62
+ | `critical` | Data loss, security breach, complete feature outage, blocked deploy |
63
+ | `warning` | Degraded behavior, partial failure, noticeable but recoverable |
64
+ | `info` | Minor UX glitch, cosmetic bug, improvement suggestion |
65
+
66
+ **Category:**
67
+
68
+ | Value | When to use |
69
+ | -------------------- | ------------------------------------------------------ |
70
+ | `ui_bug` | Frontend rendering or interaction problem |
71
+ | `data_inconsistency` | DB records, API responses, or UI state don't match |
72
+ | `performance` | Slow load, timeout, high resource usage |
73
+ | `error_pattern` | Recurring or systematic error across executions |
74
+ | `configuration` | Misconfigured resource, credential, env var, or policy |
75
+ | `other` | Doesn't fit above |
76
+
77
+ ### Phase 5: Build Structured Report
78
+
79
+ Assemble the report body from phases 1–4:
80
+
81
+ ```json
82
+ {
83
+ "title": "One-line summary — specific, not vague",
84
+ "description": "What happened. What was expected. Steps to reproduce if applicable.",
85
+ "severity": "<critical|warning|info>",
86
+ "category": "<category value>",
87
+ "affected_page": "<route or page path, omit if not a UI issue>",
88
+ "evidence": {
89
+ "errors": ["<error message or stack trace excerpt>"],
90
+ "log_snippets": ["<relevant log lines>"],
91
+ "screenshot_refs": ["<file path if user provided a screenshot>"]
92
+ },
93
+ "context": {
94
+ "source_files": ["<file paths>"],
95
+ "resource_ids": ["<workflow or agent IDs>"],
96
+ "execution_ids": ["<execution IDs>"],
97
+ "summary": "<one-paragraph agent analysis summary>"
98
+ }
99
+ }
100
+ ```
101
+
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.
103
+
104
+ Do NOT include `source` or `organization_id` — the server sets both automatically.
105
+
106
+ ### Phase 6: Confirm with User
107
+
108
+ Unless the command was invoked with `--auto`, present the assembled report to the user before submitting:
109
+
110
+ ```
111
+ Issue Report (ready to submit)
112
+ ================================
113
+ Title: <title>
114
+ Severity: <severity>
115
+ Category: <category>
116
+ Page: <affected_page or "—">
117
+
118
+ Description:
119
+ <description>
120
+
121
+ Evidence:
122
+ <summarized evidence>
123
+
124
+ Context:
125
+ <summarized context>
126
+
127
+ Submit? (yes / edit / cancel)
128
+ ```
129
+
130
+ If the user says "edit", accept corrections and re-display the updated report before proceeding.
131
+ If the user says "cancel", abort and confirm: "Submission cancelled."
132
+ Auto-submit (`--auto`) skips this confirmation entirely — use only when the caller is a trusted agent pipeline.
133
+
134
+ ## Submit
135
+
136
+ Once confirmed (or `--auto`), write the assembled JSON body to a temp file then submit via the SDK CLI:
137
+
138
+ ```bash
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
143
+ ```
144
+
145
+ Delete the temp file after submission succeeds or fails.
146
+
147
+ ## Report Back
148
+
149
+ On success, the CLI prints the issue ID. Surface it to the user:
150
+
151
+ ```
152
+ Submitted — id: <uuid>
153
+ Track it in Command Center > Issues.
154
+ ```
155
+
156
+ ## Troubleshooting
157
+
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`. |