@elevasis/core 0.6.0 → 0.7.0
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/index.d.ts +1 -0
- package/dist/index.js +9 -2
- package/dist/organization-model/index.d.ts +1 -0
- package/dist/organization-model/index.js +9 -2
- package/package.json +2 -1
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +1131 -0
- package/src/_gen/__tests__/scaffold-contracts.test.ts +53 -0
- package/src/_gen/scaffold-contracts.ts +45 -0
- package/src/index.ts +10 -0
- package/src/organization-model/__tests__/domains/identity.test.ts +1 -0
- package/src/organization-model/domains/identity.ts +9 -2
- package/src/reference/_generated/contracts.md +1 -1
- package/src/scaffold-registry/__tests__/schema.test.ts +280 -0
- package/src/scaffold-registry/index.ts +194 -0
- package/src/scaffold-registry/schema.ts +144 -0
- package/src/supabase/database.types.ts +70 -6
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// Kind taxonomy
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The kind of scaffold entry:
|
|
9
|
+
*
|
|
10
|
+
* - autogen: fully derivable from source; regen command is the fix
|
|
11
|
+
* - manual-scaffold: hand-authored structure that must be updated on source change
|
|
12
|
+
* - typed-id: typed-ID constants that encode semantic naming decisions
|
|
13
|
+
* - sync-preservation: external-template files with a declared sync tier
|
|
14
|
+
* - vibe-gated: paths protected by the pre-edit-vibe-gate hook
|
|
15
|
+
* - sdk-cli-generator: SDK CLI generators (generate-docs-index, generate-resources, etc.)
|
|
16
|
+
* - validator: drift-detection scripts or CI checks (meta.json pages[] validators, etc.)
|
|
17
|
+
* - other: escape hatch; requires free-form notes
|
|
18
|
+
*/
|
|
19
|
+
export const ScaffoldEntryKindSchema = z.enum([
|
|
20
|
+
'autogen',
|
|
21
|
+
'manual-scaffold',
|
|
22
|
+
'typed-id',
|
|
23
|
+
'sync-preservation',
|
|
24
|
+
'vibe-gated',
|
|
25
|
+
'sdk-cli-generator',
|
|
26
|
+
'validator',
|
|
27
|
+
'other'
|
|
28
|
+
])
|
|
29
|
+
|
|
30
|
+
export type ScaffoldEntryKind = z.infer<typeof ScaffoldEntryKindSchema>
|
|
31
|
+
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
// Scaffold reference (a single downstream artifact that needs attention)
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
|
|
36
|
+
export const ScaffoldRefSchema = z.object({
|
|
37
|
+
/**
|
|
38
|
+
* File path, glob, or symbolic target (e.g. "docs: sync-preservation-matrix").
|
|
39
|
+
* Symbolic targets begin with "docs:" or "autogen-target:".
|
|
40
|
+
*/
|
|
41
|
+
path: z.string().min(1),
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Command to regenerate, or "manual" if human judgment is required.
|
|
45
|
+
*/
|
|
46
|
+
regen: z.string().min(1).optional(),
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Optionally narrow the kind of this specific scaffold reference, when it
|
|
50
|
+
* differs from the parent entry's kind.
|
|
51
|
+
*/
|
|
52
|
+
kind: ScaffoldEntryKindSchema.optional(),
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Human-readable hint shown in reminder messages.
|
|
56
|
+
*/
|
|
57
|
+
hint: z.string().optional()
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
export type ScaffoldRef = z.infer<typeof ScaffoldRefSchema>
|
|
61
|
+
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
// Registry entry
|
|
64
|
+
// ---------------------------------------------------------------------------
|
|
65
|
+
|
|
66
|
+
export const ScaffoldRegistryEntrySchema = z.object({
|
|
67
|
+
/**
|
|
68
|
+
* Stable slug identifier for this entry (kebab-case).
|
|
69
|
+
* Referenced by hooks, CI checks, and the /scaffold verify skill.
|
|
70
|
+
*/
|
|
71
|
+
id: z
|
|
72
|
+
.string()
|
|
73
|
+
.min(1)
|
|
74
|
+
.regex(/^[a-z0-9-]+$/, 'id must be kebab-case'),
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The primary kind of this entry.
|
|
78
|
+
*/
|
|
79
|
+
kind: ScaffoldEntryKindSchema,
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Glob patterns (or exact paths) that, when edited, should trigger a
|
|
83
|
+
* reminder for the associated scaffolds. Uses micromatch / glob semantics.
|
|
84
|
+
*/
|
|
85
|
+
sources: z.array(z.string().min(1)).min(1, 'At least one source pattern is required'),
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Downstream artifacts that need attention when a source changes.
|
|
89
|
+
*/
|
|
90
|
+
dependents: z.array(ScaffoldRefSchema).min(1, 'At least one dependent is required'),
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Package or app path that owns this scaffold surface.
|
|
94
|
+
* Examples: "packages/core", "apps/api", "external/_template"
|
|
95
|
+
*/
|
|
96
|
+
owner: z.string().min(1),
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Free-form notes. Required when kind is "other".
|
|
100
|
+
*/
|
|
101
|
+
notes: z.string().optional(),
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* The shell command used to regenerate this entry's outputs.
|
|
105
|
+
*
|
|
106
|
+
* Required for `kind: autogen` entries once Step 6 migration lands.
|
|
107
|
+
* Optional now so harness scaffolding (Step 5) can land before migrating
|
|
108
|
+
* existing generators. Validated as a non-empty string when present.
|
|
109
|
+
*
|
|
110
|
+
* Example: `"pnpm navigation:generate"`, `"pnpm scaffold:sync"`
|
|
111
|
+
*/
|
|
112
|
+
regen: z.string().min(1).optional(),
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Per-entry reminder throttle override in milliseconds.
|
|
116
|
+
* Defaults to the hook-level default (5 minutes = 300_000 ms) when omitted.
|
|
117
|
+
*/
|
|
118
|
+
cooldown_ms: z.number().int().positive().optional(),
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* When true, the PostToolUse reminder hook will automatically run the `regen`
|
|
122
|
+
* command after emitting the reminder, rather than just advising the user.
|
|
123
|
+
* Defaults to false (advisory only). Only meaningful when `regen` is also set.
|
|
124
|
+
*/
|
|
125
|
+
auto_regen: z.boolean().optional()
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
export type ScaffoldRegistryEntry = z.infer<typeof ScaffoldRegistryEntrySchema>
|
|
129
|
+
|
|
130
|
+
// ---------------------------------------------------------------------------
|
|
131
|
+
// Top-level registry document
|
|
132
|
+
// ---------------------------------------------------------------------------
|
|
133
|
+
|
|
134
|
+
export const ScaffoldRegistrySchema = z.object({
|
|
135
|
+
/**
|
|
136
|
+
* Schema version for forward-compatibility detection.
|
|
137
|
+
* Bump when the shape changes in a breaking way.
|
|
138
|
+
*/
|
|
139
|
+
version: z.string().default('1'),
|
|
140
|
+
|
|
141
|
+
entries: z.array(ScaffoldRegistryEntrySchema).min(1)
|
|
142
|
+
})
|
|
143
|
+
|
|
144
|
+
export type ScaffoldRegistry = z.infer<typeof ScaffoldRegistrySchema>
|
|
@@ -1267,10 +1267,8 @@ export type Database = {
|
|
|
1267
1267
|
}
|
|
1268
1268
|
deployments: {
|
|
1269
1269
|
Row: {
|
|
1270
|
-
compiled_docs: Json | null
|
|
1271
1270
|
created_at: string
|
|
1272
1271
|
deployment_version: string | null
|
|
1273
|
-
documentation: Json | null
|
|
1274
1272
|
error_message: string | null
|
|
1275
1273
|
id: string
|
|
1276
1274
|
organization_id: string
|
|
@@ -1282,10 +1280,8 @@ export type Database = {
|
|
|
1282
1280
|
updated_at: string
|
|
1283
1281
|
}
|
|
1284
1282
|
Insert: {
|
|
1285
|
-
compiled_docs?: Json | null
|
|
1286
1283
|
created_at?: string
|
|
1287
1284
|
deployment_version?: string | null
|
|
1288
|
-
documentation?: Json | null
|
|
1289
1285
|
error_message?: string | null
|
|
1290
1286
|
id?: string
|
|
1291
1287
|
organization_id: string
|
|
@@ -1297,10 +1293,8 @@ export type Database = {
|
|
|
1297
1293
|
updated_at?: string
|
|
1298
1294
|
}
|
|
1299
1295
|
Update: {
|
|
1300
|
-
compiled_docs?: Json | null
|
|
1301
1296
|
created_at?: string
|
|
1302
1297
|
deployment_version?: string | null
|
|
1303
|
-
documentation?: Json | null
|
|
1304
1298
|
error_message?: string | null
|
|
1305
1299
|
id?: string
|
|
1306
1300
|
organization_id?: string
|
|
@@ -1812,6 +1806,13 @@ export type Database = {
|
|
|
1812
1806
|
updated_at?: string
|
|
1813
1807
|
}
|
|
1814
1808
|
Relationships: [
|
|
1809
|
+
{
|
|
1810
|
+
foreignKeyName: "fk_milestones_project"
|
|
1811
|
+
columns: ["project_id"]
|
|
1812
|
+
isOneToOne: false
|
|
1813
|
+
referencedRelation: "prj_projects"
|
|
1814
|
+
referencedColumns: ["id"]
|
|
1815
|
+
},
|
|
1815
1816
|
{
|
|
1816
1817
|
foreignKeyName: "prj_milestones_organization_id_fkey"
|
|
1817
1818
|
columns: ["organization_id"]
|
|
@@ -1872,6 +1873,34 @@ export type Database = {
|
|
|
1872
1873
|
type?: string
|
|
1873
1874
|
}
|
|
1874
1875
|
Relationships: [
|
|
1876
|
+
{
|
|
1877
|
+
foreignKeyName: "fk_notes_created_by"
|
|
1878
|
+
columns: ["created_by"]
|
|
1879
|
+
isOneToOne: false
|
|
1880
|
+
referencedRelation: "users"
|
|
1881
|
+
referencedColumns: ["id"]
|
|
1882
|
+
},
|
|
1883
|
+
{
|
|
1884
|
+
foreignKeyName: "fk_notes_milestone"
|
|
1885
|
+
columns: ["milestone_id"]
|
|
1886
|
+
isOneToOne: false
|
|
1887
|
+
referencedRelation: "prj_milestones"
|
|
1888
|
+
referencedColumns: ["id"]
|
|
1889
|
+
},
|
|
1890
|
+
{
|
|
1891
|
+
foreignKeyName: "fk_notes_project"
|
|
1892
|
+
columns: ["project_id"]
|
|
1893
|
+
isOneToOne: false
|
|
1894
|
+
referencedRelation: "prj_projects"
|
|
1895
|
+
referencedColumns: ["id"]
|
|
1896
|
+
},
|
|
1897
|
+
{
|
|
1898
|
+
foreignKeyName: "fk_notes_task"
|
|
1899
|
+
columns: ["task_id"]
|
|
1900
|
+
isOneToOne: false
|
|
1901
|
+
referencedRelation: "prj_tasks"
|
|
1902
|
+
referencedColumns: ["id"]
|
|
1903
|
+
},
|
|
1875
1904
|
{
|
|
1876
1905
|
foreignKeyName: "prj_notes_created_by_fkey"
|
|
1877
1906
|
columns: ["created_by"]
|
|
@@ -1962,6 +1991,20 @@ export type Database = {
|
|
|
1962
1991
|
updated_at?: string
|
|
1963
1992
|
}
|
|
1964
1993
|
Relationships: [
|
|
1994
|
+
{
|
|
1995
|
+
foreignKeyName: "fk_projects_company"
|
|
1996
|
+
columns: ["client_company_id"]
|
|
1997
|
+
isOneToOne: false
|
|
1998
|
+
referencedRelation: "acq_companies"
|
|
1999
|
+
referencedColumns: ["id"]
|
|
2000
|
+
},
|
|
2001
|
+
{
|
|
2002
|
+
foreignKeyName: "fk_projects_deal"
|
|
2003
|
+
columns: ["deal_id"]
|
|
2004
|
+
isOneToOne: false
|
|
2005
|
+
referencedRelation: "acq_deals"
|
|
2006
|
+
referencedColumns: ["id"]
|
|
2007
|
+
},
|
|
1965
2008
|
{
|
|
1966
2009
|
foreignKeyName: "prj_projects_client_company_id_fkey"
|
|
1967
2010
|
columns: ["client_company_id"]
|
|
@@ -2044,6 +2087,27 @@ export type Database = {
|
|
|
2044
2087
|
updated_at?: string
|
|
2045
2088
|
}
|
|
2046
2089
|
Relationships: [
|
|
2090
|
+
{
|
|
2091
|
+
foreignKeyName: "fk_tasks_milestone"
|
|
2092
|
+
columns: ["milestone_id"]
|
|
2093
|
+
isOneToOne: false
|
|
2094
|
+
referencedRelation: "prj_milestones"
|
|
2095
|
+
referencedColumns: ["id"]
|
|
2096
|
+
},
|
|
2097
|
+
{
|
|
2098
|
+
foreignKeyName: "fk_tasks_parent"
|
|
2099
|
+
columns: ["parent_task_id"]
|
|
2100
|
+
isOneToOne: false
|
|
2101
|
+
referencedRelation: "prj_tasks"
|
|
2102
|
+
referencedColumns: ["id"]
|
|
2103
|
+
},
|
|
2104
|
+
{
|
|
2105
|
+
foreignKeyName: "fk_tasks_project"
|
|
2106
|
+
columns: ["project_id"]
|
|
2107
|
+
isOneToOne: false
|
|
2108
|
+
referencedRelation: "prj_projects"
|
|
2109
|
+
referencedColumns: ["id"]
|
|
2110
|
+
},
|
|
2047
2111
|
{
|
|
2048
2112
|
foreignKeyName: "prj_tasks_milestone_id_fkey"
|
|
2049
2113
|
columns: ["milestone_id"]
|