@elevasis/sdk 1.5.2 → 1.5.4
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 +899 -57
- package/dist/index.d.ts +94 -110
- package/package.json +3 -3
- package/reference/_navigation.md +11 -1
- package/reference/_reference-manifest.json +70 -0
- package/reference/claude-config/commands/submit-issue.md +12 -0
- package/reference/claude-config/hooks/post-edit-validate.mjs +109 -0
- package/reference/claude-config/hooks/tool-failure-recovery.mjs +73 -0
- package/reference/claude-config/rules/deployment.md +57 -0
- package/reference/claude-config/rules/docs.md +26 -0
- package/reference/claude-config/rules/error-handling.md +56 -0
- package/reference/claude-config/rules/execution.md +40 -0
- package/reference/claude-config/rules/frontend.md +43 -0
- package/reference/claude-config/rules/observability.md +31 -0
- package/reference/claude-config/rules/organization-os.md +62 -0
- package/reference/claude-config/rules/platform.md +41 -0
- package/reference/claude-config/rules/shared-types.md +46 -0
- package/reference/claude-config/rules/task-tracking.md +47 -0
- package/reference/claude-config/scripts/statusline-command.js +18 -0
- package/reference/claude-config/settings.json +30 -0
- package/reference/claude-config/skills/deploy/SKILL.md +166 -0
- package/reference/claude-config/skills/dsp/SKILL.md +66 -0
- package/reference/claude-config/skills/elevasis/SKILL.md +239 -0
- package/reference/claude-config/skills/explore/SKILL.md +78 -0
- package/reference/claude-config/skills/project/SKILL.md +918 -0
- package/reference/claude-config/skills/save/SKILL.md +197 -0
- package/reference/claude-config/skills/setup/SKILL.md +210 -0
- package/reference/claude-config/skills/status/SKILL.md +60 -0
- package/reference/claude-config/skills/submit-issue/SKILL.md +179 -0
- package/reference/claude-config/skills/sync/SKILL.md +81 -0
- package/reference/cli.mdx +35 -20
- package/reference/deployment/index.mdx +6 -5
- package/reference/deployment/provided-features.mdx +62 -40
- package/reference/deployment/ui-execution.mdx +1 -2
- package/reference/framework/agent.mdx +50 -50
- package/reference/framework/index.mdx +13 -10
- package/reference/framework/project-structure.mdx +76 -70
- package/reference/packages/core/src/README.md +24 -17
- package/reference/packages/core/src/business/README.md +52 -0
- package/reference/packages/core/src/organization-model/README.md +25 -26
- package/reference/packages/ui/src/app/README.md +24 -0
- package/reference/packages/ui/src/provider/README.md +8 -7
- package/reference/platform-tools/type-safety.mdx +0 -10
- package/reference/roadmap.mdx +6 -4
- package/reference/scaffold/core/organization-graph.mdx +37 -28
- package/reference/scaffold/core/organization-model.mdx +34 -36
- package/reference/scaffold/index.mdx +14 -9
- package/reference/scaffold/operations/propagation-pipeline.md +133 -0
- package/reference/scaffold/operations/scaffold-maintenance.md +125 -0
- package/reference/scaffold/operations/workflow-recipes.md +18 -1
- package/reference/scaffold/recipes/add-a-feature.md +37 -21
- package/reference/scaffold/recipes/add-a-resource.md +16 -12
- package/reference/scaffold/recipes/customize-organization-model.md +400 -0
- package/reference/scaffold/recipes/extend-a-base-entity.md +140 -0
- package/reference/scaffold/recipes/gate-by-feature-or-admin.md +18 -12
- package/reference/scaffold/recipes/index.md +3 -3
- package/reference/scaffold/reference/contracts.md +11 -32
- package/reference/scaffold/reference/feature-registry.md +10 -9
- package/reference/scaffold/reference/glossary.md +14 -18
- package/reference/scaffold/ui/customization.md +2 -2
- package/reference/scaffold/ui/feature-flags-and-gating.md +40 -54
- package/reference/scaffold/ui/feature-shell.mdx +23 -24
- package/reference/scaffold/ui/recipes.md +118 -3
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Documentation conventions -- structure, frontmatter, /save integration, auto-generated files
|
|
3
|
+
paths:
|
|
4
|
+
- docs/**
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Documentation
|
|
8
|
+
|
|
9
|
+
## Safety Invariants
|
|
10
|
+
|
|
11
|
+
- `docs/index.md` and `docs/resources.md` are auto-generated by the SDK CLI -- never edit manually
|
|
12
|
+
- Regenerate: `pnpm exec elevasis-sdk generate-docs` / `pnpm exec elevasis-sdk generate-resources`
|
|
13
|
+
- Validate: `pnpm exec elevasis-sdk validate-docs` (or `pnpm check:autogenerated-docs`)
|
|
14
|
+
- Every `.md` file in `docs/` MUST have `title` and `description` frontmatter -- docs without it are skipped by the index generator
|
|
15
|
+
- In-progress docs additionally require `status: planned | in-progress | complete`
|
|
16
|
+
|
|
17
|
+
## Structure
|
|
18
|
+
|
|
19
|
+
- All docs are Markdown (`.md`), not MDX -- external projects don't use Fumadocs
|
|
20
|
+
- UI features → `docs/ui/`, platform features → `docs/operations/`, knowledge → `docs/knowledge/`
|
|
21
|
+
- New subdirectories under `docs/` are automatically discovered by the index generator
|
|
22
|
+
|
|
23
|
+
## Detailed Reference
|
|
24
|
+
|
|
25
|
+
- `docs/index.md` -- auto-generated navigation hub (full doc map)
|
|
26
|
+
- `docs/agent-start-here.md` -- canonical agent entrypoint and task-routing guidance
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Error handling -- ExecutionError vs PlatformToolError, retry logic, no auto-retry
|
|
3
|
+
paths:
|
|
4
|
+
- operations/**
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Error Handling
|
|
8
|
+
|
|
9
|
+
## Error Types
|
|
10
|
+
|
|
11
|
+
Two error classes from `@elevasis/sdk`:
|
|
12
|
+
|
|
13
|
+
**`ExecutionError`** -- base class for workflow/step failures.
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { ExecutionError } from '@elevasis/sdk'
|
|
17
|
+
|
|
18
|
+
throw new ExecutionError('Payment processing failed', {
|
|
19
|
+
context: { invoiceId: '123', amount: 500 }
|
|
20
|
+
})
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
**`PlatformToolError`** -- thrown by `platform.call()` and typed adapters.
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { PlatformToolError } from '@elevasis/sdk'
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
await attio.createRecord({ ... })
|
|
30
|
+
} catch (err) {
|
|
31
|
+
if (err instanceof PlatformToolError && err.retryable) {
|
|
32
|
+
// Transient error (rate limit, timeout, network) -- safe to retry
|
|
33
|
+
} else {
|
|
34
|
+
// Permanent error (invalid credentials, bad input) -- don't retry
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## No Auto-Retry
|
|
40
|
+
|
|
41
|
+
The platform does NOT automatically retry failed steps. Your handler is responsible for retry logic. Check `PlatformToolError.retryable` to decide whether retrying is safe.
|
|
42
|
+
|
|
43
|
+
## Error Visibility
|
|
44
|
+
|
|
45
|
+
- Unhandled exceptions in handlers surface directly to CLI output and AI Studio.
|
|
46
|
+
- Use `context.logger.error()` to log errors -- `console.error()` is NOT captured by the platform.
|
|
47
|
+
- Write clear, descriptive error messages -- they're the primary debugging signal for end users.
|
|
48
|
+
|
|
49
|
+
## Common PlatformToolError Codes
|
|
50
|
+
|
|
51
|
+
| Code | Retryable | Cause |
|
|
52
|
+
| --------------------- | --------- | --------------------------------- |
|
|
53
|
+
| `rate_limit_exceeded` | Yes | Integration API rate limit hit |
|
|
54
|
+
| `timeout_error` | Yes | Integration call timed out |
|
|
55
|
+
| `credentials_invalid` | No | Credential not found or expired |
|
|
56
|
+
| `validation_error` | No | Invalid parameters passed to tool |
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Execution model -- timeouts, memory, concurrency, org isolation, runtime constraints
|
|
3
|
+
paths:
|
|
4
|
+
- operations/**
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Execution Model
|
|
8
|
+
|
|
9
|
+
## Runtime Environment
|
|
10
|
+
|
|
11
|
+
Each execution runs in an isolated Node.js worker thread spawned from the deployed bundle. Workers are ephemeral -- created on execution start, terminated on completion. No state persists between executions.
|
|
12
|
+
|
|
13
|
+
## Constraints
|
|
14
|
+
|
|
15
|
+
| Constraint | Workflows | Agents |
|
|
16
|
+
| ---------- | ------------------------------- | ----------------------------------------------------- |
|
|
17
|
+
| Timeout | 300s (5 min) | 600s (10 min, configurable via `constraints.timeout`) |
|
|
18
|
+
| Memory | 256MB hard limit | 256MB hard limit |
|
|
19
|
+
| Disk | None (no persistent filesystem) | None |
|
|
20
|
+
|
|
21
|
+
- Platform enforces timeouts -- no handler code needed, worker terminates automatically.
|
|
22
|
+
- Memory overflow crashes the worker. Other tenants are unaffected.
|
|
23
|
+
- For long-running tasks, break work into multiple steps or use agents with extended timeout.
|
|
24
|
+
|
|
25
|
+
## Concurrency
|
|
26
|
+
|
|
27
|
+
Concurrent executions for the same organization run in completely separate workers with zero shared state. No locking, no race conditions between executions.
|
|
28
|
+
|
|
29
|
+
## Organization Isolation
|
|
30
|
+
|
|
31
|
+
- `organizationId` is injected server-side from the JWT context -- workers never see it.
|
|
32
|
+
- Storage paths are automatically org-prefixed.
|
|
33
|
+
- Resource IDs are scoped per organization (not global).
|
|
34
|
+
- External developers cannot access other organizations' data by construction.
|
|
35
|
+
|
|
36
|
+
No developer action needed for multi-tenancy -- the platform handles it.
|
|
37
|
+
|
|
38
|
+
## Cancellation
|
|
39
|
+
|
|
40
|
+
The platform can cancel in-flight executions. The worker terminates immediately with no cleanup handler.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Frontend conventions -- React, routing, state, styling, testing, pages
|
|
3
|
+
paths:
|
|
4
|
+
- ui/src/**
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Frontend
|
|
8
|
+
|
|
9
|
+
## Safety Invariants
|
|
10
|
+
|
|
11
|
+
- `ElevasisUIProvider` in `ui/src/main.tsx` auto-composes shared UI, auth, and API surface -- route files do not wire providers manually
|
|
12
|
+
- `useApiClient()` from `@/lib/hooks/useApiClient` for authenticated API calls -- never raw `fetch` with auth headers
|
|
13
|
+
- `routeTree.gen.ts` is auto-generated on `pnpm dev` -- never edit manually
|
|
14
|
+
- Auth protection: wrap page content with `ProtectedRoute` from `@elevasis/ui/auth`. Admin pages nest `AdminGuard` inside `ProtectedRoute`
|
|
15
|
+
- Never fork `@elevasis/ui` components -- if a published component needs a tweak, that missing capability is a bug in `@elevasis/ui`
|
|
16
|
+
|
|
17
|
+
## Silent-Break Gotchas
|
|
18
|
+
|
|
19
|
+
- Route files vs layout files: `operations.tsx` is a layout (renders `<Outlet />`), `operations/my-page.index.tsx` is a page. Confusing the two breaks routing silently
|
|
20
|
+
- `foundations/` cannot import React or `@elevasis/sdk/worker` -- it is runtime-agnostic shared types only
|
|
21
|
+
- `@/*` resolves to `ui/src/*`, `@foundation/*` resolves to `foundations/*` -- never import from `operations/` (separate runtime)
|
|
22
|
+
|
|
23
|
+
## Stack Constraints
|
|
24
|
+
|
|
25
|
+
- Mantine 8.2.7 for all UI components -- no Radix UI, no Tailwind CSS, no shadcn
|
|
26
|
+
- `@tabler/icons-react` for icons -- never Lucide
|
|
27
|
+
- Server state: TanStack Query. Client state: Zustand + Immer. Never mix the two
|
|
28
|
+
- Glass background is the primary surface treatment: `var(--glass-background)` with `backdrop-filter: var(--glass-blur)`
|
|
29
|
+
- Import shared components from `@elevasis/ui/components`, `@elevasis/ui/layout`, `@elevasis/ui/charts`
|
|
30
|
+
- Import charts from `@elevasis/ui/charts`, not directly from `@mantine/charts`
|
|
31
|
+
|
|
32
|
+
## Integration UI Surfaces
|
|
33
|
+
|
|
34
|
+
When building pages that display external data, use published `@elevasis/ui` components before building custom UI. Use Mantine components and CSS variables exclusively -- no inline hex colors, no custom design tokens. Match existing page density and spacing.
|
|
35
|
+
|
|
36
|
+
## Detailed Reference
|
|
37
|
+
|
|
38
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/ui/recipes.md` -- add a page, add a nav item, theme tokens, feature-scoped components, route patterns (static, nested, dynamic)
|
|
39
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/ui/feature-flags-and-gating.md` -- `featureKey` / `FeatureGuard` / `AdminGuard` model
|
|
40
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/ui/customization.md` -- sidebar composition via manifest overrides
|
|
41
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md` -- TypeScript shapes (`FeatureModule`, `NavItem`, `OrganizationModel`)
|
|
42
|
+
- `ui/src/config/theme.ts` -- theme configuration and CSS variable definitions
|
|
43
|
+
- `ui/src/config/nav-items.ts` -- sidebar navigation entries
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Observability -- context.logger API, execution inspection, step-level context
|
|
3
|
+
paths:
|
|
4
|
+
- operations/**
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Observability
|
|
8
|
+
|
|
9
|
+
## Safety Invariants
|
|
10
|
+
|
|
11
|
+
- Use `context.logger` for all logging in step handlers -- `console.*` is NOT captured by the platform
|
|
12
|
+
- Log levels: `debug` (verbose), `info` (normal progress), `warn` (non-fatal, processing continues), `error` (fatal, processing stops)
|
|
13
|
+
- Step lifecycle events (started, completed, failed, route taken) are auto-logged by the SDK worker -- no handler code needed
|
|
14
|
+
|
|
15
|
+
## Key Rules
|
|
16
|
+
|
|
17
|
+
- Every handler should log at: entry (step name + key params), decisions (skips, branches), progress (per-item in loops), summary (counts at end)
|
|
18
|
+
- Error messages in handlers surface as the execution's error message -- write for humans, not machines
|
|
19
|
+
- String values truncated at 200 characters in logs
|
|
20
|
+
- 30-day log retention (includes logs from deleted resources)
|
|
21
|
+
|
|
22
|
+
## Inspecting Executions
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pnpm exec elevasis-sdk execution <resourceId> <executionId>
|
|
26
|
+
pnpm exec elevasis-sdk executions <resourceId>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Detailed Reference
|
|
30
|
+
|
|
31
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md` -- full logging patterns and handler examples
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Organization OS
|
|
2
|
+
|
|
3
|
+
Organization OS is the semantic contract layer defining how organizations, features, domains, surfaces, entities, capabilities, and resources relate. This project consumes Organization OS through the SDK and foundations config.
|
|
4
|
+
|
|
5
|
+
## Key Files in This Project
|
|
6
|
+
|
|
7
|
+
- `foundations/config/organization-model.ts` -- project-specific org model definition (calls `defineOrganizationModel` + `resolveOrganizationModel`)
|
|
8
|
+
- `foundations/config/organization-model.examples.ts` -- 5 reference patterns: branding, CRM stages, lead-gen stages, resource mappings, custom features. Pure reference -- not imported anywhere. Read this when customizing the org model.
|
|
9
|
+
- `foundations/types/entities.ts` -- typed entity contracts (Project, Deal, etc.). Extends `BaseProject`, `BaseDeal` from `@elevasis/core/entities` with project-specific metadata. Read this when authoring workflows that operate on these entities.
|
|
10
|
+
- `ui/src/routes/__root.tsx` -- wires `ElevasisFeaturesProvider` with `canonicalOrganizationModel`
|
|
11
|
+
- `ui/src/app-config.ts` -- references the org model
|
|
12
|
+
- `operations/src/index.ts` -- `DeploymentSpec` registry for workflows and agents
|
|
13
|
+
|
|
14
|
+
## Reference Documentation
|
|
15
|
+
|
|
16
|
+
Full Organization OS documentation ships with the SDK and is available locally after `pnpm install`:
|
|
17
|
+
|
|
18
|
+
### Scaffold Reference (via SDK)
|
|
19
|
+
|
|
20
|
+
All paths under `node_modules/@elevasis/sdk/reference/scaffold/`:
|
|
21
|
+
|
|
22
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/index.mdx` -- scaffold root and navigation
|
|
23
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/core/organization-model.mdx` -- semantic contract, schema, authoring helpers
|
|
24
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/core/organization-graph.mdx` -- graph derivation, node/edge taxonomy, lenses
|
|
25
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/ui/feature-shell.mdx` -- FeatureModule manifest, provider runtime
|
|
26
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/ui/composition-extensibility.mdx` -- layout primitives, router abstraction
|
|
27
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/ui/recipes.md` -- copy-paste UI recipes for pages, nav items, components
|
|
28
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/ui/feature-flags-and-gating.md` -- three-concept gating model
|
|
29
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/ui/customization.md` -- sidebar composition via manifest overrides
|
|
30
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/recipes/add-a-feature.md` -- end-to-end from org model key through manifest, routes, gating
|
|
31
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/recipes/add-a-resource.md` -- author and deploy a workflow or agent
|
|
32
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/recipes/gate-by-feature-or-admin.md` -- decision table for access control patterns
|
|
33
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md` -- workflow anatomy, adapter patterns, trigger patterns
|
|
34
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/operations/propagation-pipeline.md` -- how sync and verification work across projects
|
|
35
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/operations/scaffold-maintenance.md` -- content placement and auto-generation pipeline
|
|
36
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/reference/glossary.md` -- Organization OS term definitions
|
|
37
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md` -- auto-generated TypeScript contract shapes
|
|
38
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/reference/feature-registry.md` -- auto-generated feature manifest catalog
|
|
39
|
+
|
|
40
|
+
### Local Project Docs
|
|
41
|
+
|
|
42
|
+
- `docs/platform-navigation-map.md` -- auto-generated cross-package reference map
|
|
43
|
+
- `docs/resources.md` -- auto-generated project resource topology
|
|
44
|
+
- `docs/agent-start-here.md` -- canonical first-read for agents (includes task-class routing)
|
|
45
|
+
|
|
46
|
+
## Published Subpaths and Constants
|
|
47
|
+
|
|
48
|
+
- `@elevasis/core/organization-model` -- the curated organization-model barrel. Exports `defineOrganizationModel`, `resolveOrganizationModel`, `OrganizationModelSchema`, `DEFAULT_ORGANIZATION_MODEL`, organization-model types, and typed feature/surface constants.
|
|
49
|
+
- Feature IDs: `CRM_FEATURE_ID`, `LEAD_GEN_FEATURE_ID`, `PROJECTS_FEATURE_ID`, `OPERATIONS_FEATURE_ID`, `MONITORING_FEATURE_ID`, `SETTINGS_FEATURE_ID`, `SEO_FEATURE_ID`
|
|
50
|
+
- Headline surface IDs: `CRM_PIPELINE_SURFACE_ID`, `LEAD_GEN_LISTS_SURFACE_ID`, `PROJECTS_INDEX_SURFACE_ID`, `OPERATIONS_ORGANIZATION_GRAPH_SURFACE_ID`
|
|
51
|
+
- Use these constants instead of magic strings when overriding the org model.
|
|
52
|
+
- `@elevasis/core/entities` -- entity contracts barrel. Exports `BaseProject`, `BaseProjectSchema`, `BaseProjectInput` and the equivalents for `Milestone`, `Task`, `Deal`, `Company`, `Contact`. Each base interface is generic over a `\<TMeta>` extension slot. Extend these in `foundations/types/entities.ts` to add project-specific fields.
|
|
53
|
+
|
|
54
|
+
## When Working with Organization OS
|
|
55
|
+
|
|
56
|
+
- **Adding a feature:** Follow `node_modules/@elevasis/sdk/reference/scaffold/recipes/add-a-feature.md`
|
|
57
|
+
- **Adding a resource:** Follow `node_modules/@elevasis/sdk/reference/scaffold/recipes/add-a-resource.md`
|
|
58
|
+
- **Changing org model:** Start with `foundations/config/organization-model.examples.ts` for reference patterns, then edit `foundations/config/organization-model.ts`. Use the typed feature/surface constants from `@elevasis/core/organization-model` rather than magic strings. Verify the org-os wiring (provider chain, CSS imports, feature shell).
|
|
59
|
+
- **Extending entities:** Start with `foundations/types/entities.ts` for the demo extension pattern. Base shapes come from `@elevasis/core/entities`.
|
|
60
|
+
- **Authoring a workflow that takes a Project/Deal/etc.:** Reference entity types from `foundations/types/entities.ts` in the input schema -- do not redeclare them.
|
|
61
|
+
- **Understanding contracts:** Check `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md` for current type shapes
|
|
62
|
+
- **Debugging sync issues:** Check `node_modules/@elevasis/sdk/reference/scaffold/operations/propagation-pipeline.md` for the verification pipeline
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Platform conventions -- SDK workflows, agents, deployment, resource registry
|
|
3
|
+
paths:
|
|
4
|
+
- operations/**
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Platform (Elevasis SDK)
|
|
8
|
+
|
|
9
|
+
## Safety Invariants
|
|
10
|
+
|
|
11
|
+
- Every workflow implements `WorkflowDefinition` from `@elevasis/sdk` with: `config`, `contract` (Zod schemas), `steps` map, and `entryPoint`
|
|
12
|
+
- Input/output schemas MUST come from `@shared/types` -- never define inline Zod schemas in workflow files
|
|
13
|
+
- `operations/src/index.ts` default-exports a `DeploymentSpec` with `workflows` and `agents` arrays -- every resource must be registered here
|
|
14
|
+
- Always run `check` before `deploy`
|
|
15
|
+
|
|
16
|
+
## Imports
|
|
17
|
+
|
|
18
|
+
- `@elevasis/sdk` for types (`WorkflowDefinition`, `DeploymentSpec`)
|
|
19
|
+
- `@elevasis/sdk/worker` for runtime utilities (`platform`, adapters: `llm`, `storage`, `scheduler`, `notifications`)
|
|
20
|
+
- `@shared/*` resolves to `../shared/*` for shared type imports
|
|
21
|
+
- Never import from `ui/src/` -- separate runtimes
|
|
22
|
+
|
|
23
|
+
## Key Rules
|
|
24
|
+
|
|
25
|
+
- Use typed adapters over raw `platform.call()` whenever a typed adapter exists
|
|
26
|
+
- `version` in resource config is semver -- bump on contract changes
|
|
27
|
+
- `status` is `'dev'` or `'prod'` -- new resources start as `'dev'`
|
|
28
|
+
|
|
29
|
+
## CLI Commands
|
|
30
|
+
|
|
31
|
+
| Command | Purpose |
|
|
32
|
+
| ------------------------------------ | ----------------------------- |
|
|
33
|
+
| `pnpm -C operations run check` | Validate resource definitions |
|
|
34
|
+
| `pnpm -C operations run deploy` | Deploy to dev |
|
|
35
|
+
| `pnpm -C operations run deploy:prod` | Deploy to production |
|
|
36
|
+
|
|
37
|
+
## Detailed Reference
|
|
38
|
+
|
|
39
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/operations/workflow-recipes.md` -- workflow anatomy, adapter patterns, trigger patterns
|
|
40
|
+
- `node_modules/@elevasis/sdk/reference/scaffold/recipes/add-a-resource.md` -- end-to-end resource authoring guide
|
|
41
|
+
- SDK reference docs: `operations/node_modules/@elevasis/sdk/reference/` (concepts, framework, platform-tools, runtime, CLI)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Shared type boundary -- what belongs in shared/, import rules, schema conventions
|
|
3
|
+
paths:
|
|
4
|
+
- shared/**
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Shared Types
|
|
8
|
+
|
|
9
|
+
`shared/` is the type boundary between the frontend (`src/`) and platform (`operations/`). Both runtimes import from here but never from each other.
|
|
10
|
+
|
|
11
|
+
## What Belongs Here
|
|
12
|
+
|
|
13
|
+
- Zod schemas for workflow input/output contracts
|
|
14
|
+
- TypeScript types inferred from those schemas (`z.infer<typeof schema>`)
|
|
15
|
+
- Domain types referenced by both runtimes (status enums, entity shapes)
|
|
16
|
+
- Shared constants
|
|
17
|
+
|
|
18
|
+
## What Does NOT Belong Here
|
|
19
|
+
|
|
20
|
+
- React components, hooks, or anything importing `react`
|
|
21
|
+
- SDK runtime code or anything importing `@elevasis/sdk/worker`
|
|
22
|
+
- Browser APIs or Node-specific APIs
|
|
23
|
+
- Implementation logic -- types and constants only
|
|
24
|
+
|
|
25
|
+
## Schema Convention
|
|
26
|
+
|
|
27
|
+
Define Zod schemas first, then infer the type:
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
export const fooInputSchema = z.object({ ... })
|
|
31
|
+
export type FooInput = z.infer<typeof fooInputSchema>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Name schemas `<name>InputSchema` / `<name>OutputSchema`. Name types `<Name>Input` / `<Name>Output`.
|
|
35
|
+
|
|
36
|
+
## File Organization
|
|
37
|
+
|
|
38
|
+
Types live in `shared/types/`. The directory structure:
|
|
39
|
+
|
|
40
|
+
- `shared/types/index.ts` -- Main entry point, re-exports from domain files
|
|
41
|
+
- As the project grows: split into domain files within the directory (e.g., `shared/types/billing.ts`, `shared/types/auth.ts`)
|
|
42
|
+
- Re-export new domain files from `shared/types/index.ts`
|
|
43
|
+
|
|
44
|
+
## Path Alias
|
|
45
|
+
|
|
46
|
+
Both tsconfigs resolve `@shared/*` to `shared/*`. Always use `@shared/types` (not relative paths) when importing from `src/` or `operations/src/`.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: In-progress task conventions -- doc format, status values, auto-save behavior
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Task Tracking
|
|
6
|
+
|
|
7
|
+
## Status Values
|
|
8
|
+
|
|
9
|
+
Exactly three values for frontmatter `status`: `planned`, `in-progress`, `complete`.
|
|
10
|
+
|
|
11
|
+
## Doc Format
|
|
12
|
+
|
|
13
|
+
- Frontmatter: `title`, `description`, `status` (per the monorepo rule in `.claude/rules/in-progress-tasks.md` -- nothing else belongs in task-doc frontmatter; `resume_context` is DB-canonical on `prj_tasks`)
|
|
14
|
+
- Sections: Objective, Plan, Progress, Resume Context
|
|
15
|
+
- Progress subsections use markers: `### Step N: Title -- PENDING`, `-- IN PROGRESS`, `-- COMPLETE`
|
|
16
|
+
|
|
17
|
+
## Auto-Update Behavior
|
|
18
|
+
|
|
19
|
+
- When working on a tracked task, update the Progress section when a plan step transitions:
|
|
20
|
+
- PENDING -> IN PROGRESS (starting work on a step)
|
|
21
|
+
- IN PROGRESS -> COMPLETE (finishing a step)
|
|
22
|
+
- Do NOT update on every action -- only on step transitions
|
|
23
|
+
|
|
24
|
+
## Auto-Save Behavior
|
|
25
|
+
|
|
26
|
+
The agent auto-saves progress (no user action needed) when:
|
|
27
|
+
|
|
28
|
+
- The conversation context is getting heavy (many tool calls, large file reads)
|
|
29
|
+
- The user appears to be wrapping up (thanks, goodbye, switching topics)
|
|
30
|
+
- Significant progress has been made (2+ steps completed without saving)
|
|
31
|
+
- Before a context reset
|
|
32
|
+
|
|
33
|
+
Auto-save updates the task doc's Progress and Resume Context sections silently, then briefly confirms. The canonical persistence path is `pnpm exec elevasis-sdk project:task:save` -- the CLI writes through to `prj_tasks.resume_context` (JSONB) so another agent can resume without re-deriving intent.
|
|
34
|
+
|
|
35
|
+
## Completion Suggestions
|
|
36
|
+
|
|
37
|
+
When all plan steps are marked COMPLETE, **suggest** completing the task -- never auto-invoke. Ask: "All steps for '{task}' look done. Want me to finalize it?"
|
|
38
|
+
|
|
39
|
+
## Where Tasks Live
|
|
40
|
+
|
|
41
|
+
Project tasks for this template live in the `prj_tasks` Supabase table, not in repo-local files. Operate on them via the SDK CLI:
|
|
42
|
+
|
|
43
|
+
- `pnpm exec elevasis-sdk project:work` -- entrypoint for task work (resume / new intent detection)
|
|
44
|
+
- `pnpm exec elevasis-sdk project:list` -- portfolio / task listing
|
|
45
|
+
- `pnpm exec elevasis-sdk project:task:save` -- persist progress + `resume_context` to the DB
|
|
46
|
+
|
|
47
|
+
The monorepo-side `/work` slash command still exists for monorepo task docs under `apps/docs/content/docs/in-progress/**`; that flow is unchanged. What went away is the external template's own `/work` skill and its `docs/in-progress/` directory -- external projects now route through the DB-backed `project:*` surface above.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
let input = ''
|
|
3
|
+
process.stdin.on('data', (chunk) => (input += chunk))
|
|
4
|
+
process.stdin.on('end', () => {
|
|
5
|
+
const data = JSON.parse(input)
|
|
6
|
+
const model = data.model?.display_name || '?'
|
|
7
|
+
const pct = Math.floor(data.context_window?.used_percentage || 0)
|
|
8
|
+
|
|
9
|
+
const DIM = '\x1b[90m',
|
|
10
|
+
RESET = '\x1b[0m'
|
|
11
|
+
|
|
12
|
+
const ctxSize = data.context_window?.context_window_size || 0
|
|
13
|
+
const usedTokens = Math.round((ctxSize * pct) / 100)
|
|
14
|
+
const rounded = Math.round(usedTokens / 100) * 100
|
|
15
|
+
const tokenStr = rounded >= 1000 ? (rounded / 1000).toFixed(1).replace(/\.0$/, '') + 'k' : String(rounded)
|
|
16
|
+
|
|
17
|
+
console.log(`${DIM}[${RESET}${model}${DIM}]${RESET} ${tokenStr} Tokens`)
|
|
18
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"statusLine": {
|
|
3
|
+
"type": "command",
|
|
4
|
+
"command": "node .claude/scripts/statusline-command.js"
|
|
5
|
+
},
|
|
6
|
+
"hooks": {
|
|
7
|
+
"PostToolUse": [
|
|
8
|
+
{
|
|
9
|
+
"matcher": "Write|Edit|MultiEdit",
|
|
10
|
+
"hooks": [
|
|
11
|
+
{
|
|
12
|
+
"type": "command",
|
|
13
|
+
"command": "node .claude/hooks/post-edit-validate.mjs"
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"PostToolUseFailure": [
|
|
19
|
+
{
|
|
20
|
+
"matcher": "Bash",
|
|
21
|
+
"hooks": [
|
|
22
|
+
{
|
|
23
|
+
"type": "command",
|
|
24
|
+
"command": "node .claude/hooks/tool-failure-recovery.mjs"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deploy
|
|
3
|
+
description: Test, build, fix issues, then commit and push
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Deploy
|
|
7
|
+
|
|
8
|
+
Test, build, fix issues, then commit and push.
|
|
9
|
+
|
|
10
|
+
**Usage:** `/deploy [--skip] [--minor | --major] [commit message]`
|
|
11
|
+
|
|
12
|
+
## Flags
|
|
13
|
+
|
|
14
|
+
- `--skip` -- Skip tests, type checking, and build (Steps 2-4). Go straight from pre-flight to commit and push.
|
|
15
|
+
- `--minor` -- Bump the minor version instead of patch (e.g. 1.0.0 -> 1.1.0).
|
|
16
|
+
- `--major` -- Bump the major version instead of patch (e.g. 1.0.0 -> 2.0.0).
|
|
17
|
+
|
|
18
|
+
## Process
|
|
19
|
+
|
|
20
|
+
### Step 1: Pre-flight Check
|
|
21
|
+
|
|
22
|
+
Run in parallel:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
git status
|
|
26
|
+
git diff --stat
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
If there are no changes, report "Nothing to deploy" and stop.
|
|
30
|
+
|
|
31
|
+
### Step 1b: Version Bump
|
|
32
|
+
|
|
33
|
+
Read the current version from `package.json`, then bump it:
|
|
34
|
+
|
|
35
|
+
- Default: bump **patch** (e.g. 1.0.0 -> 1.0.1)
|
|
36
|
+
- `--minor`: bump **minor** (e.g. 1.0.0 -> 1.1.0)
|
|
37
|
+
- `--major`: bump **major** (e.g. 1.0.0 -> 2.0.0)
|
|
38
|
+
|
|
39
|
+
Use the Edit tool to update the `"version"` field in `package.json` directly. Do not use `npm version` or any CLI command.
|
|
40
|
+
|
|
41
|
+
### Step 1c: Regenerate Documentation
|
|
42
|
+
|
|
43
|
+
Run both doc generators in sequence (resources first so the nav index picks up `resources.md`):
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pnpm exec elevasis-sdk generate-resources
|
|
47
|
+
pnpm exec elevasis-sdk generate-docs
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
This ensures autogenerated files (`docs/resources.md`, `docs/index.md`) reflect the current resource state before they are committed. These must run after the version bump so any version references in generated output are correct.
|
|
51
|
+
|
|
52
|
+
### Step 2: Run Tests
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pnpm test
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
If tests fail:
|
|
59
|
+
|
|
60
|
+
1. Read the failing test output
|
|
61
|
+
2. Attempt to fix the issue
|
|
62
|
+
3. Re-run tests
|
|
63
|
+
4. If still failing after 2 attempts, stop and report the failures
|
|
64
|
+
|
|
65
|
+
### Step 3: Type Check
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pnpm lint
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
If type errors exist:
|
|
72
|
+
|
|
73
|
+
1. Read the errors
|
|
74
|
+
2. Attempt to fix
|
|
75
|
+
3. Re-run
|
|
76
|
+
4. If still failing after 2 attempts, stop and report
|
|
77
|
+
|
|
78
|
+
### Step 4: Build
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pnpm build
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
If build fails:
|
|
85
|
+
|
|
86
|
+
1. Read the error output
|
|
87
|
+
2. Attempt to fix
|
|
88
|
+
3. Re-run
|
|
89
|
+
4. If still failing after 2 attempts, stop and report
|
|
90
|
+
|
|
91
|
+
### Step 5: Commit
|
|
92
|
+
|
|
93
|
+
1. Stage all changed files: `git add -A`
|
|
94
|
+
2. Create commit with the provided message (or auto-generate from changes)
|
|
95
|
+
3. Format: conventional commits (feat:, fix:, chore:, docs:, etc.)
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
git add -A
|
|
99
|
+
git commit -m "<message>"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Step 6: Push
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
git push
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
If push fails (e.g., remote has new commits):
|
|
109
|
+
|
|
110
|
+
1. `git pull --rebase`
|
|
111
|
+
2. Re-run tests to verify no conflicts broke anything
|
|
112
|
+
3. `git push`
|
|
113
|
+
|
|
114
|
+
### Step 7: Report
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
Deploy Complete
|
|
118
|
+
===============
|
|
119
|
+
Version: <old> -> <new>
|
|
120
|
+
Tests: passed
|
|
121
|
+
Types: clean
|
|
122
|
+
Build: success
|
|
123
|
+
Commit: <hash> - <message>
|
|
124
|
+
Push: pushed to <branch>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Step 8: Project Task Status Transition
|
|
128
|
+
|
|
129
|
+
After a successful push, mark any linked project task as `submitted`. This is a best-effort fanout -- it must never fail the deploy.
|
|
130
|
+
|
|
131
|
+
1. **Resolve the task ID.** Look for a `prj_tasks` UUID tied to the current work, in this order:
|
|
132
|
+
- A task UUID explicitly captured in the current conversation (e.g. from a previous `/save`, `/project work`, or `project:task:*` invocation).
|
|
133
|
+
- The most recent in-progress task on the most-recently-touched project, via:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
pnpm -C operations exec elevasis-sdk project:list --status active,blocked --format brief
|
|
137
|
+
pnpm -C operations exec elevasis-sdk project:task:list --project <project-id> --status in_progress
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
- If the session produced an ambiguous or empty result, PROMPT the user once: "Mark a project task as submitted? (task UUID, or 'skip')". Default is skip.
|
|
141
|
+
|
|
142
|
+
2. **Fire the transition** (only when a single confident task ID is resolved):
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
pnpm -C operations exec elevasis-sdk project:task:update <task-id> --status submitted
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
3. **Failure handling.** If the CLI call errors, no task ID can be resolved, or the user declines, emit a single warning line and continue:
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
Warning: skipped project:task status transition (<reason>). Deploy itself succeeded.
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Never retry, never block the deploy report, never exit non-zero on this step.
|
|
155
|
+
|
|
156
|
+
## Error Recovery
|
|
157
|
+
|
|
158
|
+
If any step fails and cannot be auto-fixed:
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
Deploy Failed at Step N: [step name]
|
|
162
|
+
=====================================
|
|
163
|
+
Error: [description]
|
|
164
|
+
Attempted fixes: [what was tried]
|
|
165
|
+
Manual action needed: [what the user should do]
|
|
166
|
+
```
|