@elevasis/sdk 1.5.3 → 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 +19 -4
- package/reference/deployment/provided-features.mdx +24 -2
- package/reference/framework/agent.mdx +12 -4
- package/reference/framework/project-structure.mdx +9 -3
- package/reference/packages/core/src/README.md +1 -1
- 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/platform-tools/type-safety.mdx +0 -10
- package/reference/scaffold/core/organization-graph.mdx +37 -28
- package/reference/scaffold/core/organization-model.mdx +34 -36
- package/reference/scaffold/index.mdx +1 -0
- package/reference/scaffold/operations/propagation-pipeline.md +7 -3
- package/reference/scaffold/operations/scaffold-maintenance.md +2 -2
- 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 +4 -2
- 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 +22 -23
- package/reference/scaffold/ui/recipes.md +118 -3
|
@@ -225,7 +225,7 @@ ui/src/features/reporting/
|
|
|
225
225
|
|
|
226
226
|
```ts
|
|
227
227
|
import { useQuery } from '@tanstack/react-query'
|
|
228
|
-
import { useApiClient } from '@/
|
|
228
|
+
import { useApiClient } from '@/lib/hooks/useApiClient'
|
|
229
229
|
|
|
230
230
|
export function useReports() {
|
|
231
231
|
const { apiRequest, isOrganizationReady } = useApiClient()
|
|
@@ -262,9 +262,9 @@ export function ReportingOverviewPage() {
|
|
|
262
262
|
|
|
263
263
|
### Explanation
|
|
264
264
|
|
|
265
|
-
- **`@/*` alias:** resolves to `ui/src/*`. Use it for all cross-feature imports (e.g., `@/
|
|
265
|
+
- **`@/*` alias:** resolves to `ui/src/*`. Use it for all cross-feature imports (e.g., `@/lib/hooks/useApiClient`, `@/features/auth`). Never use relative paths that cross feature boundaries.
|
|
266
266
|
- **Server state in Query, client state in Zustand:** if data comes from an API, it belongs in a `useQuery` hook, not a Zustand slice. Zustand is for client-only UI state (open/close, selection, optimistic updates).
|
|
267
|
-
- **`useApiClient`:** from `@/
|
|
267
|
+
- **`useApiClient`:** from `@/lib/hooks/useApiClient`. Returns `apiRequest` (an authenticated fetch wrapper) and `isOrganizationReady` (use this as `enabled` to avoid firing requests before the org is loaded).
|
|
268
268
|
- **`SubshellContentContainer` / `PageContainer`:** added in the route file, not in the feature component. Feature components should be layout-agnostic -- the route decides the shell treatment.
|
|
269
269
|
- **No React, no Node imports in `foundations/`:** types shared between frontend and `operations/` live in `foundations/`. Feature components live only in `ui/src/features/`.
|
|
270
270
|
|
|
@@ -416,3 +416,118 @@ export const navItems: ExtendedLinksGroupProps[] = [
|
|
|
416
416
|
- `./customization.md` -- customizing feature sidebars and pages via manifest composition
|
|
417
417
|
- `ui/src/config/README.md` -- deeper guide for theme, background, and loader config files
|
|
418
418
|
- `external/_template/.claude/rules/frontend.md` -- concise agent-oriented frontend conventions
|
|
419
|
+
|
|
420
|
+
---
|
|
421
|
+
|
|
422
|
+
## 6. Execute a Resource from a Surface
|
|
423
|
+
|
|
424
|
+
Resources (workflows, agents, triggers) deploy to the Elevasis platform and can be triggered from any feature surface. This recipe shows how to declare the resource on a surface via the org model, share its input schema via `foundations/types/`, and render a button that executes it.
|
|
425
|
+
|
|
426
|
+
### The Three Foundations Layers
|
|
427
|
+
|
|
428
|
+
- **Org model** (`foundations/config/organization-model.ts`): semantic metadata -- which surfaces exist, what resources map to them, labels and colors.
|
|
429
|
+
- **Entity contracts** (`foundations/types/entities.ts`): typed shapes for Project, Deal, etc. -- extend `BaseProject`, `BaseDeal` from `@elevasis/core/entities`.
|
|
430
|
+
- **Resource I/O** (`foundations/types/index.ts`): Zod schemas for workflow inputs/outputs.
|
|
431
|
+
|
|
432
|
+
### Code
|
|
433
|
+
|
|
434
|
+
#### 1. Declare the resource on a surface
|
|
435
|
+
|
|
436
|
+
`foundations/config/organization-model.ts`:
|
|
437
|
+
|
|
438
|
+
```ts
|
|
439
|
+
import { defineOrganizationModel, CRM_PIPELINE_SURFACE_ID } from '@elevasis/core/organization-model'
|
|
440
|
+
|
|
441
|
+
export const organizationOverride = defineOrganizationModel({
|
|
442
|
+
branding: { /* ... */ },
|
|
443
|
+
resourceMappings: [
|
|
444
|
+
{
|
|
445
|
+
id: 'crm.pipeline.write-note',
|
|
446
|
+
surfaceId: CRM_PIPELINE_SURFACE_ID,
|
|
447
|
+
resourceId: 'my-project-write-note-workflow',
|
|
448
|
+
resourceType: 'workflow',
|
|
449
|
+
label: 'Write Note',
|
|
450
|
+
color: 'blue',
|
|
451
|
+
featureIds: ['crm'],
|
|
452
|
+
entityIds: ['crm.deal'],
|
|
453
|
+
capabilityIds: []
|
|
454
|
+
}
|
|
455
|
+
]
|
|
456
|
+
})
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
#### 2. Share the input schema
|
|
460
|
+
|
|
461
|
+
`foundations/types/index.ts`:
|
|
462
|
+
|
|
463
|
+
```ts
|
|
464
|
+
import { z } from 'zod'
|
|
465
|
+
|
|
466
|
+
export const writeNoteInputSchema = z.object({
|
|
467
|
+
dealId: z.string(),
|
|
468
|
+
note: z.string().min(1).max(2000)
|
|
469
|
+
})
|
|
470
|
+
|
|
471
|
+
export type WriteNoteInput = z.infer<typeof writeNoteInputSchema>
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
#### 3. Render the button
|
|
475
|
+
|
|
476
|
+
`ui/src/features/crm/components/DealPanel.tsx`:
|
|
477
|
+
|
|
478
|
+
```tsx
|
|
479
|
+
import { RunResourceButton } from '@elevasis/ui/components'
|
|
480
|
+
import { organizationModel } from '@foundation/config/organization-model'
|
|
481
|
+
import { writeNoteInputSchema } from '@foundation/types'
|
|
482
|
+
|
|
483
|
+
export function DealPanel({ dealId }: { dealId: string }) {
|
|
484
|
+
return (
|
|
485
|
+
<RunResourceButton
|
|
486
|
+
resourceId="my-project-write-note-workflow"
|
|
487
|
+
resourceType="workflow"
|
|
488
|
+
organizationModel={organizationModel}
|
|
489
|
+
getInput={() => ({
|
|
490
|
+
schema: writeNoteInputSchema,
|
|
491
|
+
defaults: { dealId }
|
|
492
|
+
})}
|
|
493
|
+
onSuccess={(result) => console.log('Started:', result.executionId)}
|
|
494
|
+
/>
|
|
495
|
+
)
|
|
496
|
+
}
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
The three `getInput` shapes:
|
|
500
|
+
|
|
501
|
+
```tsx
|
|
502
|
+
// Plain object (no form) -- executes immediately on click
|
|
503
|
+
getInput={() => ({ dealId, note: 'Auto-generated' })}
|
|
504
|
+
|
|
505
|
+
// Mixed (form for unfixed fields) -- modal opens with dealId pre-filled
|
|
506
|
+
getInput={() => ({ schema: writeNoteInputSchema, defaults: { dealId } })}
|
|
507
|
+
|
|
508
|
+
// Full form -- modal opens with all fields blank
|
|
509
|
+
getInput={() => ({ schema: writeNoteInputSchema })}
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
#### 4. Optionally listen for live execution logs
|
|
513
|
+
|
|
514
|
+
```tsx
|
|
515
|
+
import { useExecutionLogSSE, useMergedExecution } from '@elevasis/ui/hooks'
|
|
516
|
+
// Pass the SSE manager from your app's sse.ts wrapper and apiUrl from config.
|
|
517
|
+
// For the full live-logs pattern see:
|
|
518
|
+
// apps/command-center/src/features/operations/executions/
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
### How It Works
|
|
522
|
+
|
|
523
|
+
- `RunResourceButton` inspects what `getInput()` returns: a plain object triggers execution immediately; `{ schema, defaults? }` opens a `ZodFormRenderer` modal so the user can fill in missing fields before submitting.
|
|
524
|
+
- Label and color resolve in order: explicit props > `resourceMappings` entry matching `resourceId` > default `'Run'`. The `icon` prop is prop-only and is never inferred from the mapping.
|
|
525
|
+
- `ZodFormRenderer` introspects the Zod schema at runtime and renders Mantine fields for each top-level key. Unsupported Zod types (nested objects, arrays, unions) fall back to a JSON textarea so the form always renders regardless of schema complexity.
|
|
526
|
+
- Typed feature and surface constants (e.g. `CRM_PIPELINE_SURFACE_ID`) come from `@elevasis/core/organization-model`. See Issue 4 constants for the full list.
|
|
527
|
+
- Entity contracts (Deal, Project) live in `foundations/types/entities.ts` and extend base types from `@elevasis/core/entities` -- see the entity recipe for the full shape.
|
|
528
|
+
|
|
529
|
+
### Cross-References
|
|
530
|
+
|
|
531
|
+
- `./feature-flags-and-gating.md` -- gating a surface or button by feature key or admin role
|
|
532
|
+
- `@foundation/types/entities.ts` -- Deal, Project, and other entity contracts for this project
|
|
533
|
+
- Recipe 5 (Add a Nav Item) -- how surfaces and nav entries are wired together
|