@elevasis/core 0.23.0 → 0.24.1
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 +4343 -2690
- package/dist/index.js +1101 -156
- package/dist/knowledge/index.d.ts +574 -210
- package/dist/knowledge/index.js +104 -1
- package/dist/organization-model/index.d.ts +4343 -2690
- package/dist/organization-model/index.js +1101 -156
- package/dist/test-utils/index.d.ts +483 -109
- package/dist/test-utils/index.js +904 -144
- package/package.json +3 -3
- package/src/README.md +14 -14
- package/src/__tests__/publish.test.ts +24 -24
- package/src/__tests__/template-core-compatibility.test.ts +9 -12
- package/src/_gen/__tests__/__snapshots__/contracts.md.snap +2137 -2093
- package/src/_gen/__tests__/scaffold-contracts.test.ts +30 -30
- package/src/auth/multi-tenancy/credentials/__tests__/encryption.test.ts +217 -217
- package/src/auth/multi-tenancy/credentials/server/encryption.ts +69 -69
- package/src/auth/multi-tenancy/credentials/server/kek-loader.ts +37 -37
- package/src/auth/multi-tenancy/index.ts +26 -26
- package/src/auth/multi-tenancy/invitations/api-schemas.ts +104 -104
- package/src/auth/multi-tenancy/memberships/api-schemas.ts +143 -143
- package/src/auth/multi-tenancy/memberships/index.ts +26 -26
- package/src/auth/multi-tenancy/memberships/membership.ts +130 -130
- package/src/auth/multi-tenancy/organizations/__tests__/api-schemas.test.ts +194 -194
- package/src/auth/multi-tenancy/organizations/api-schemas.ts +136 -136
- package/src/auth/multi-tenancy/permissions.test.ts +42 -42
- package/src/auth/multi-tenancy/permissions.ts +123 -123
- package/src/auth/multi-tenancy/role-management/api-schemas.ts +78 -78
- package/src/auth/multi-tenancy/role-management/index.ts +16 -16
- package/src/auth/multi-tenancy/theme-presets.ts +45 -45
- package/src/auth/multi-tenancy/types.ts +57 -57
- package/src/auth/multi-tenancy/users/api-schemas.ts +165 -165
- package/src/business/README.md +2 -2
- package/src/business/acquisition/activity-events.test.ts +250 -250
- package/src/business/acquisition/activity-events.ts +93 -93
- package/src/business/acquisition/api-schemas.test.ts +1883 -1843
- package/src/business/acquisition/api-schemas.ts +1492 -1497
- package/src/business/acquisition/build-templates.test.ts +240 -240
- package/src/business/acquisition/build-templates.ts +98 -98
- package/src/business/acquisition/crm-next-action.test.ts +262 -262
- package/src/business/acquisition/crm-next-action.ts +220 -220
- package/src/business/acquisition/crm-priority.test.ts +216 -216
- package/src/business/acquisition/crm-priority.ts +349 -349
- package/src/business/acquisition/crm-state-actions.test.ts +153 -153
- package/src/business/acquisition/deal-ownership.test.ts +351 -351
- package/src/business/acquisition/deal-ownership.ts +120 -120
- package/src/business/acquisition/derive-actions.test.ts +129 -104
- package/src/business/acquisition/derive-actions.ts +74 -84
- package/src/business/acquisition/index.ts +171 -170
- package/src/business/acquisition/ontology-validation.ts +309 -0
- package/src/business/acquisition/stateful.ts +30 -30
- package/src/business/acquisition/types.ts +396 -396
- package/src/business/clients/api-schemas.test.ts +115 -115
- package/src/business/clients/api-schemas.ts +158 -158
- package/src/business/clients/index.ts +1 -1
- package/src/business/crm/api-schemas.ts +40 -40
- package/src/business/crm/index.ts +1 -1
- package/src/business/deals/api-schemas.ts +87 -87
- package/src/business/deals/index.ts +1 -1
- package/src/business/index.ts +5 -5
- package/src/business/projects/types.ts +144 -144
- package/src/commands/queue/types/task.ts +15 -15
- package/src/execution/core/runner-types.ts +61 -61
- package/src/execution/core/sse-executions.ts +7 -7
- package/src/execution/engine/__tests__/fixtures/test-agents.ts +10 -10
- package/src/execution/engine/agent/core/__tests__/agent.test.ts +16 -16
- package/src/execution/engine/agent/core/__tests__/error-passthrough.test.ts +4 -4
- package/src/execution/engine/agent/core/types.ts +25 -25
- package/src/execution/engine/agent/index.ts +6 -6
- package/src/execution/engine/agent/reasoning/__tests__/request-builder.test.ts +24 -24
- package/src/execution/engine/index.ts +443 -443
- package/src/execution/engine/tools/integration/server/adapters/apify/__tests__/apify-run-actor.integration.test.ts +298 -298
- package/src/execution/engine/tools/integration/server/adapters/apify/apify-adapter.test.ts +55 -55
- package/src/execution/engine/tools/integration/server/adapters/apify/apify-adapter.ts +107 -107
- package/src/execution/engine/tools/integration/server/adapters/apollo/apollo-adapter.test.ts +48 -48
- package/src/execution/engine/tools/integration/server/adapters/apollo/apollo-adapter.ts +99 -99
- package/src/execution/engine/tools/integration/server/adapters/apollo/index.ts +1 -1
- package/src/execution/engine/tools/integration/server/adapters/attio/__tests__/attio-crud.integration.test.ts +363 -363
- package/src/execution/engine/tools/integration/server/adapters/attio/fetch/get-record/index.test.ts +162 -162
- package/src/execution/engine/tools/integration/server/adapters/attio/fetch/list-records/index.test.ts +316 -316
- package/src/execution/engine/tools/integration/server/adapters/clickup/clickup-adapter.test.ts +18 -18
- package/src/execution/engine/tools/integration/server/adapters/clickup/clickup-adapter.ts +194 -194
- package/src/execution/engine/tools/integration/server/adapters/clickup/index.ts +7 -7
- package/src/execution/engine/tools/integration/server/adapters/gmail/gmail-adapter.ts +204 -204
- package/src/execution/engine/tools/integration/server/adapters/gmail/gmail-tools.ts +105 -105
- package/src/execution/engine/tools/integration/server/adapters/google-calendar/google-calendar-adapter.ts +428 -428
- package/src/execution/engine/tools/integration/server/adapters/google-calendar/index.ts +2 -2
- package/src/execution/engine/tools/integration/server/adapters/google-sheets/__tests__/google-sheets.integration.test.ts +261 -261
- package/src/execution/engine/tools/integration/server/adapters/instantly/instantly-tools.ts +1474 -1474
- package/src/execution/engine/tools/integration/server/adapters/millionverifier/millionverifier-tools.ts +103 -103
- package/src/execution/engine/tools/integration/server/adapters/resend/fetch/send-email/index.test.ts +88 -88
- package/src/execution/engine/tools/integration/server/adapters/resend/fetch/send-email/index.ts +141 -141
- package/src/execution/engine/tools/integration/server/adapters/resend/fetch/utils/types.ts +76 -76
- package/src/execution/engine/tools/integration/server/adapters/signature-api/signature-api-tools.ts +182 -182
- package/src/execution/engine/tools/integration/server/adapters/stripe/stripe-tools.ts +310 -310
- package/src/execution/engine/tools/integration/service.test.ts +239 -239
- package/src/execution/engine/tools/integration/service.ts +172 -172
- package/src/execution/engine/tools/integration/tool.ts +255 -255
- package/src/execution/engine/tools/lead-service-types.ts +1005 -1005
- package/src/execution/engine/tools/messages.ts +43 -43
- package/src/execution/engine/tools/platform/acquisition/company-tools.ts +7 -7
- package/src/execution/engine/tools/platform/acquisition/contact-tools.ts +6 -6
- package/src/execution/engine/tools/platform/acquisition/list-tools.ts +6 -6
- package/src/execution/engine/tools/platform/acquisition/types.ts +280 -280
- package/src/execution/engine/tools/platform/email/types.ts +97 -97
- package/src/execution/engine/tools/registry.ts +704 -704
- package/src/execution/engine/tools/tool-maps.ts +831 -831
- package/src/execution/engine/tools/types.ts +234 -234
- package/src/execution/engine/workflow/types.ts +195 -197
- package/src/execution/external/__tests__/api-schemas.test.ts +127 -127
- package/src/execution/external/api-schemas.ts +40 -40
- package/src/execution/external/index.ts +1 -1
- package/src/index.ts +18 -18
- package/src/integrations/credentials/__tests__/api-schemas.test.ts +420 -420
- package/src/integrations/credentials/api-schemas.ts +146 -146
- package/src/integrations/credentials/schemas.ts +200 -200
- package/src/integrations/oauth/__tests__/provider-registry.test.ts +7 -7
- package/src/integrations/oauth/provider-registry.ts +74 -74
- package/src/integrations/oauth/server/credentials.ts +43 -43
- package/src/integrations/webhook-endpoints/__tests__/api-schemas.test.ts +327 -327
- package/src/integrations/webhook-endpoints/api-schemas.ts +103 -103
- package/src/integrations/webhook-endpoints/types.ts +58 -58
- package/src/knowledge/README.md +32 -32
- package/src/knowledge/__tests__/queries.test.ts +626 -535
- package/src/knowledge/format.ts +99 -99
- package/src/knowledge/index.ts +5 -5
- package/src/knowledge/published.ts +5 -5
- package/src/knowledge/queries.ts +269 -218
- package/src/operations/activities/api-schemas.ts +80 -80
- package/src/operations/activities/types.ts +64 -64
- package/src/organization-model/README.md +149 -149
- package/src/organization-model/__tests__/content-kinds-registry.test.ts +210 -210
- package/src/organization-model/__tests__/defaults.test.ts +168 -168
- package/src/organization-model/__tests__/domains/actions.test.ts +78 -56
- package/src/organization-model/__tests__/domains/customers.test.ts +299 -299
- package/src/organization-model/__tests__/domains/entities.test.ts +56 -56
- package/src/organization-model/__tests__/domains/goals.test.ts +493 -493
- package/src/organization-model/__tests__/domains/identity.test.ts +280 -280
- package/src/organization-model/__tests__/domains/navigation.test.ts +268 -268
- package/src/organization-model/__tests__/domains/offerings.test.ts +414 -414
- package/src/organization-model/__tests__/domains/policies.test.ts +323 -323
- package/src/organization-model/__tests__/domains/resource-mappings.test.ts +293 -293
- package/src/organization-model/__tests__/domains/resources.test.ts +387 -277
- package/src/organization-model/__tests__/domains/roles.test.ts +463 -463
- package/src/organization-model/__tests__/domains/statuses.test.ts +246 -246
- package/src/organization-model/__tests__/domains/systems.test.ts +209 -209
- package/src/organization-model/__tests__/domains/topology.test.ts +188 -0
- package/src/organization-model/__tests__/flatten-additive-merge.test.ts +362 -361
- package/src/organization-model/__tests__/foundation.test.ts +77 -77
- package/src/organization-model/__tests__/get-resources-for-system.test.ts +144 -144
- package/src/organization-model/__tests__/graph.test.ts +1312 -862
- package/src/organization-model/__tests__/icons.test.ts +10 -1
- package/src/organization-model/__tests__/knowledge.test.ts +251 -15
- package/src/organization-model/__tests__/lookup-helpers.test.ts +438 -438
- package/src/organization-model/__tests__/migration-helpers.test.ts +591 -591
- package/src/organization-model/__tests__/prospecting-ssot.test.ts +103 -103
- package/src/organization-model/__tests__/recursive-system-schema.test.ts +535 -506
- package/src/organization-model/__tests__/resolve.test.ts +274 -164
- package/src/organization-model/__tests__/schema.test.ts +844 -301
- package/src/organization-model/__tests__/surface-projection.test.ts +284 -284
- package/src/organization-model/catalogs/lead-gen.ts +144 -144
- package/src/organization-model/content-kinds/config.ts +36 -36
- package/src/organization-model/content-kinds/index.ts +76 -72
- package/src/organization-model/content-kinds/pipeline.ts +68 -68
- package/src/organization-model/content-kinds/registry.ts +44 -44
- package/src/organization-model/content-kinds/status.ts +71 -71
- package/src/organization-model/content-kinds/template.ts +83 -83
- package/src/organization-model/content-kinds/types.ts +117 -117
- package/src/organization-model/contracts.ts +27 -27
- package/src/organization-model/defaults.ts +42 -50
- package/src/organization-model/domains/actions.ts +333 -239
- package/src/organization-model/domains/customers.ts +78 -78
- package/src/organization-model/domains/entities.ts +144 -144
- package/src/organization-model/domains/goals.ts +83 -83
- package/src/organization-model/domains/knowledge.ts +117 -101
- package/src/organization-model/domains/navigation.ts +139 -139
- package/src/organization-model/domains/offerings.ts +71 -71
- package/src/organization-model/domains/policies.ts +102 -102
- package/src/organization-model/domains/projects.ts +14 -14
- package/src/organization-model/domains/prospecting.ts +395 -395
- package/src/organization-model/domains/resources.ts +202 -124
- package/src/organization-model/domains/roles.ts +96 -96
- package/src/organization-model/domains/sales.test.ts +218 -218
- package/src/organization-model/domains/sales.ts +380 -380
- package/src/organization-model/domains/shared.ts +63 -63
- package/src/organization-model/domains/statuses.ts +339 -339
- package/src/organization-model/domains/systems.ts +217 -172
- package/src/organization-model/domains/topology.ts +261 -0
- package/src/organization-model/foundation.ts +75 -75
- package/src/organization-model/graph/build.ts +1043 -867
- package/src/organization-model/graph/index.ts +4 -4
- package/src/organization-model/graph/link.ts +10 -10
- package/src/organization-model/graph/schema.ts +75 -68
- package/src/organization-model/graph/types.ts +71 -64
- package/src/organization-model/helpers.ts +289 -241
- package/src/organization-model/icons.ts +78 -66
- package/src/organization-model/index.ts +128 -125
- package/src/organization-model/migration-helpers.ts +247 -244
- package/src/organization-model/ontology.ts +658 -0
- package/src/organization-model/organization-graph.mdx +110 -90
- package/src/organization-model/organization-model.mdx +225 -213
- package/src/organization-model/published.ts +299 -222
- package/src/organization-model/resolve.ts +146 -91
- package/src/organization-model/schema.ts +818 -659
- package/src/organization-model/surface-projection.ts +212 -212
- package/src/organization-model/types.ts +179 -155
- package/src/platform/api/types.ts +38 -38
- package/src/platform/constants/versions.ts +3 -3
- package/src/platform/index.ts +23 -23
- package/src/platform/registry/__tests__/command-view.test.ts +10 -10
- package/src/platform/registry/__tests__/resource-link.test.ts +35 -35
- package/src/platform/registry/__tests__/resource-registry.integration.test.ts +20 -20
- package/src/platform/registry/__tests__/resource-registry.nested-systems.test.ts +245 -245
- package/src/platform/registry/__tests__/resource-registry.test.ts +2053 -2053
- package/src/platform/registry/__tests__/validation.test.ts +1444 -1259
- package/src/platform/registry/command-view.ts +10 -10
- package/src/platform/registry/index.ts +103 -103
- package/src/platform/registry/resource-link.ts +32 -32
- package/src/platform/registry/resource-registry.ts +886 -886
- package/src/platform/registry/serialization.ts +295 -295
- package/src/platform/registry/serialized-types.ts +166 -166
- package/src/platform/registry/stats-types.ts +68 -68
- package/src/platform/registry/types.ts +425 -425
- package/src/platform/registry/validation.ts +876 -684
- package/src/platform/utils/__tests__/validation.test.ts +1084 -1084
- package/src/platform/utils/validation.ts +425 -425
- package/src/projects/api-schemas.test.ts +39 -39
- package/src/projects/api-schemas.ts +291 -291
- package/src/reference/_generated/contracts.md +2136 -2093
- package/src/reference/glossary.md +76 -76
- package/src/scaffold-registry/__tests__/index.test.ts +206 -206
- package/src/scaffold-registry/__tests__/schema.test.ts +166 -166
- package/src/scaffold-registry/index.ts +392 -392
- package/src/scaffold-registry/schema.ts +243 -243
- package/src/server.ts +289 -289
- package/src/supabase/database.types.ts +3 -0
- package/src/test-utils/README.md +37 -37
- package/src/test-utils/entities.ts +108 -108
- package/src/test-utils/fixtures/memberships.ts +82 -82
- package/src/test-utils/index.ts +12 -12
- package/src/test-utils/organization-model.ts +65 -65
- package/src/test-utils/published.ts +6 -6
- package/src/test-utils/rls/RLSTestContext.ts +588 -588
- package/src/test-utils/test-utils.test.ts +44 -44
|
@@ -1,76 +1,76 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Glossary
|
|
3
|
-
description: Terminology disambiguation for Organization OS concepts used in the template scaffold, core package, and published packages.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Glossary
|
|
7
|
-
|
|
8
|
-
## Terms
|
|
9
|
-
|
|
10
|
-
**AdminGuard** -- route-level admin wrapper from `@elevasis/ui/features/auth`. Must nest inside `ProtectedRoute`.
|
|
11
|
-
|
|
12
|
-
**Contract** -- the publishable boundary a consumer depends on: Zod schemas, TypeScript types, provider props, resource definitions, or workflow I/O schemas.
|
|
13
|
-
|
|
14
|
-
**DeploymentSpec** -- runtime/deploy assembly for one organization: workflows, agents, triggers, integrations, relationships, external resources, and human checkpoints. It assembles executable behavior around Organization Model resource descriptors; it is not the source of resource identity.
|
|
15
|
-
|
|
16
|
-
**Feature** -- legacy or UI-package wording for a platform capability area. In the current Organization Model, use **System** for semantic ownership and **navigation surface** for shell placement. Keep "feature" only when referring to existing UI package folders, exported manifest names, or legacy compatibility recipes.
|
|
17
|
-
|
|
18
|
-
**SystemGuard** -- route-level System gate from `@elevasis/ui/features/auth`.
|
|
19
|
-
|
|
20
|
-
**SystemModule** -- manifest contract a shell module provides to `ElevasisSystemsProvider`. Key fields are `key`, optional `systemId`, optional `routePrefixes`, optional `capabilityIds`, optional `icon`, optional `sidebar`, optional `sidebarWidth
|
|
21
|
-
|
|
22
|
-
**systemId** -- the `SystemModule` field that points to an `OrganizationModel.systems` entry. Navigation-only app modules may omit it and use route prefixes/surface metadata instead.
|
|
23
|
-
|
|
24
|
-
**Foundations** -- local adapter layer in external projects that exports `canonicalOrganizationModel`, `organizationModel`, and workflow I/O schemas.
|
|
25
|
-
|
|
26
|
-
**Graph node ID** -- kind-prefixed cross-collection identifier such as `system:sales.crm`, `integration:instantly`, or `resource:lead-import`.
|
|
27
|
-
|
|
28
|
-
**Manifest** -- a runtime declaration for a feature or resource collection.
|
|
29
|
-
|
|
30
|
-
**MembershipFeatureConfig** -- legacy per-member feature override config. Current System visibility
|
|
31
|
-
|
|
32
|
-
**OrganizationModel** -- top-level semantic contract for an organization. Current primary fields include `version`, `domainMetadata`, `branding`, `navigation`, `
|
|
33
|
-
|
|
34
|
-
**OrganizationModelSystemEntry** -- System node in `OrganizationModel.systems`.
|
|
35
|
-
|
|
36
|
-
**Provider / ElevasisSystemsProvider** -- runtime that registers System modules, resolves System access against the org model, projects sidebar navigation, and exposes shell helpers through `useElevasisSystems()`.
|
|
37
|
-
|
|
38
|
-
**Resource** -- governance-only descriptor in `OrganizationModel.resources` for a workflow, agent, integration, or script. Runtime code derives `resourceId` and kind from the descriptor, then attaches executable behavior in operations.
|
|
39
|
-
|
|
40
|
-
**Resource descriptor** -- OM entry with canonical `id`, required `systemPath`, governance `status`,
|
|
41
|
-
|
|
42
|
-
**System** -- tenant-defined bounded context in `OrganizationModel.systems
|
|
43
|
-
|
|
44
|
-
**ResourceCategory** -- resource metadata category: `production`, `diagnostic`, `internal`, or `testing`.
|
|
45
|
-
|
|
46
|
-
**ResourceLink** -- graph binding on resource metadata: `{ nodeId, kind }`.
|
|
47
|
-
|
|
48
|
-
**Settings asymmetry** -- Settings is a navigation/app surface whose individual pages are normally governed by admin checks rather than user-facing System toggles.
|
|
49
|
-
|
|
50
|
-
**Shell model** -- provider output used by sidebars and breadcrumbs. Includes `systems`, `childrenOf`, `ancestorsOf`, `parentOf`, `topLevel`, `findByPath`, `requiresAdminFor`, and `devOnlyFor`.
|
|
51
|
-
|
|
52
|
-
**Subshell / Sidebar** -- System- or route-prefix-scoped UI region rendered when the current route matches a module whose manifest supplies a sidebar.
|
|
53
|
-
|
|
54
|
-
**Topology** --
|
|
55
|
-
|
|
56
|
-
## Package Boundary
|
|
57
|
-
|
|
58
|
-
**`@elevasis/core`**
|
|
59
|
-
|
|
60
|
-
- `OrganizationModel`, `OrganizationModelSystemEntry`
|
|
61
|
-
- `SystemEntry`, `ResourceEntry`
|
|
62
|
-
- `resolveOrganizationModel`, `defineOrganizationModel`, `DEFAULT_ORGANIZATION_MODEL`
|
|
63
|
-
- `MembershipFeatureConfig`
|
|
64
|
-
- `DeploymentSpec`, `ResourceLink`, `ResourceCategory`
|
|
65
|
-
|
|
66
|
-
**`@elevasis/ui`**
|
|
67
|
-
|
|
68
|
-
- `SystemModule`
|
|
69
|
-
- `SystemGuard`, `AdminGuard`, `ProtectedRoute`
|
|
70
|
-
- `ElevasisSystemsProvider`, `ElevasisCoreProvider`, `useElevasisSystems`
|
|
71
|
-
|
|
72
|
-
**External project source**
|
|
73
|
-
|
|
74
|
-
- `canonicalOrganizationModel`
|
|
75
|
-
- `organizationModel`
|
|
76
|
-
- workflow I/O schemas
|
|
1
|
+
---
|
|
2
|
+
title: Glossary
|
|
3
|
+
description: Terminology disambiguation for Organization OS concepts used in the template scaffold, core package, and published packages.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Glossary
|
|
7
|
+
|
|
8
|
+
## Terms
|
|
9
|
+
|
|
10
|
+
**AdminGuard** -- route-level admin wrapper from `@elevasis/ui/features/auth`. Must nest inside `ProtectedRoute`.
|
|
11
|
+
|
|
12
|
+
**Contract** -- the publishable boundary a consumer depends on: Zod schemas, TypeScript types, provider props, resource definitions, or workflow I/O schemas.
|
|
13
|
+
|
|
14
|
+
**DeploymentSpec** -- runtime/deploy assembly for one organization: workflows, agents, triggers, integrations, relationships, external resources, and human checkpoints. It assembles executable behavior around Organization Model resource descriptors; it is not the source of resource identity.
|
|
15
|
+
|
|
16
|
+
**Feature** -- legacy or UI-package wording for a platform capability area. In the current Organization Model, use **System** for semantic ownership and **navigation surface** for shell placement. Keep "feature" only when referring to existing UI package folders, exported manifest names, or legacy compatibility recipes.
|
|
17
|
+
|
|
18
|
+
**SystemGuard** -- route-level System gate from `@elevasis/ui/features/auth`.
|
|
19
|
+
|
|
20
|
+
**SystemModule** -- manifest contract a shell module provides to `ElevasisSystemsProvider`. Key fields are `key`, optional `systemId`, optional `routePrefixes`, optional `capabilityIds`, optional `icon`, optional `sidebar`, and optional `sidebarWidth`. Graph bridge metadata is compatibility-only; new semantic bindings belong in the Organization Model System, ontology, navigation, and Resource descriptors.
|
|
21
|
+
|
|
22
|
+
**systemId** -- the `SystemModule` field that points to an `OrganizationModel.systems` entry. Navigation-only app modules may omit it and use route prefixes/surface metadata instead.
|
|
23
|
+
|
|
24
|
+
**Foundations** -- local adapter layer in external projects that exports `canonicalOrganizationModel`, `organizationModel`, and workflow I/O schemas.
|
|
25
|
+
|
|
26
|
+
**Graph node ID** -- kind-prefixed cross-collection identifier such as `system:sales.crm`, `integration:instantly`, or `resource:lead-import`.
|
|
27
|
+
|
|
28
|
+
**Manifest** -- a runtime declaration for a feature or resource collection.
|
|
29
|
+
|
|
30
|
+
**MembershipFeatureConfig** -- legacy per-member feature override config. Current System visibility should be authored through Organization Model System lifecycle/access metadata and resolved through provider compatibility layers for older consumers.
|
|
31
|
+
|
|
32
|
+
**OrganizationModel** -- top-level semantic contract for an organization. Current primary fields include `version`, `domainMetadata`, `branding`, `navigation`, `ontology`, `systems`, `resources`, `topology`, `identity`, `customers`, `offerings`, `roles`, `goals`, `policies`, `statuses`, and `knowledge`. Legacy domain keys such as `sales`, `prospecting`, `projects`, `actions`, and `entities` remain compatibility inputs while projects migrate to System-owned ontology/config/resource contracts.
|
|
33
|
+
|
|
34
|
+
**OrganizationModelSystemEntry** -- System node in `OrganizationModel.systems`. Primary authoring fields include `id`, `label`, `description`, `parentSystemId`, `systems`, `lifecycle`, `ui`, `requiresAdmin`, `devOnly`, `responsibleRoleId`, `governedByKnowledge`, `drivesGoals`, `actions`, `policies`, `ontology`, `config`, and `order`. `subsystems` and `content` are retained compatibility inputs for older projects and should not be used for new recursive Systems, schemas, catalogs, or config.
|
|
35
|
+
|
|
36
|
+
**Provider / ElevasisSystemsProvider** -- runtime that registers System modules, resolves System access against the org model, projects sidebar navigation, and exposes shell helpers through `useElevasisSystems()`.
|
|
37
|
+
|
|
38
|
+
**Resource** -- governance-only descriptor in `OrganizationModel.resources` for a workflow, agent, integration, or script. Runtime code derives `resourceId` and kind from the descriptor, then attaches executable behavior in operations.
|
|
39
|
+
|
|
40
|
+
**Resource descriptor** -- OM entry with canonical `id`, required `systemPath`, descriptor `title` / `description`, governance `status`, optional role ownership, `codeRefs`, and nested `ontology` bindings for `actions`, optional `primaryAction`, read/write objects, used catalogs, and emitted events. Top-level `emits` remains a compatibility mirror for older descriptors.
|
|
41
|
+
|
|
42
|
+
**System** -- tenant-defined bounded context in `OrganizationModel.systems` that groups operational resources and carries governance metadata such as responsible role, governing knowledge, driven goals, kind, lifecycle, System-local ontology, and System-local config.
|
|
43
|
+
|
|
44
|
+
**ResourceCategory** -- resource metadata category: `production`, `diagnostic`, `internal`, or `testing`.
|
|
45
|
+
|
|
46
|
+
**ResourceLink** -- graph binding on resource metadata: `{ nodeId, kind }`.
|
|
47
|
+
|
|
48
|
+
**Settings asymmetry** -- Settings is a navigation/app surface whose individual pages are normally governed by admin checks rather than user-facing System toggles.
|
|
49
|
+
|
|
50
|
+
**Shell model** -- provider output used by sidebars and breadcrumbs. Includes `systems`, `childrenOf`, `ancestorsOf`, `parentOf`, `topLevel`, `findByPath`, `requiresAdminFor`, and `devOnlyFor`.
|
|
51
|
+
|
|
52
|
+
**Subshell / Sidebar** -- System- or route-prefix-scoped UI region rendered when the current route matches a module whose manifest supplies a sidebar.
|
|
53
|
+
|
|
54
|
+
**Topology** -- durable OM operational wiring declared in `OrganizationModel.topology.relationships`. Initial relationship kinds are `triggers`, `uses`, and `approval`; relationships use typed refs such as `{ kind: 'resource', id: 'lead-import' }`.
|
|
55
|
+
|
|
56
|
+
## Package Boundary
|
|
57
|
+
|
|
58
|
+
**`@elevasis/core`**
|
|
59
|
+
|
|
60
|
+
- `OrganizationModel`, `OrganizationModelSystemEntry`
|
|
61
|
+
- `SystemEntry`, `ResourceEntry`
|
|
62
|
+
- `resolveOrganizationModel`, `defineOrganizationModel`, `DEFAULT_ORGANIZATION_MODEL`
|
|
63
|
+
- `MembershipFeatureConfig`
|
|
64
|
+
- `DeploymentSpec`, `ResourceLink`, `ResourceCategory`
|
|
65
|
+
|
|
66
|
+
**`@elevasis/ui`**
|
|
67
|
+
|
|
68
|
+
- `SystemModule`
|
|
69
|
+
- `SystemGuard`, `AdminGuard`, `ProtectedRoute`
|
|
70
|
+
- `ElevasisSystemsProvider`, `ElevasisCoreProvider`, `useElevasisSystems`
|
|
71
|
+
|
|
72
|
+
**External project source**
|
|
73
|
+
|
|
74
|
+
- `canonicalOrganizationModel`
|
|
75
|
+
- `organizationModel`
|
|
76
|
+
- workflow I/O schemas
|
|
@@ -1,206 +1,206 @@
|
|
|
1
|
-
import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from 'node:fs'
|
|
2
|
-
import { tmpdir } from 'node:os'
|
|
3
|
-
import path from 'node:path'
|
|
4
|
-
import { afterEach, describe, expect, it } from 'vitest'
|
|
5
|
-
import {
|
|
6
|
-
findEmptySourcePatterns,
|
|
7
|
-
findMatchingEntries,
|
|
8
|
-
findMissingDependentPaths,
|
|
9
|
-
loadScaffoldRegistryFast,
|
|
10
|
-
normalizeScaffoldPath,
|
|
11
|
-
scaffoldPathMatchesPattern
|
|
12
|
-
} from '../index'
|
|
13
|
-
import type { ScaffoldRegistry, ScaffoldRegistryEntry } from '../schema'
|
|
14
|
-
|
|
15
|
-
function makeEntry(id: string, sources: string[]): ScaffoldRegistryEntry {
|
|
16
|
-
return {
|
|
17
|
-
id,
|
|
18
|
-
kind: 'manual-scaffold',
|
|
19
|
-
owner: 'packages/core',
|
|
20
|
-
sources,
|
|
21
|
-
dependents: [{ path: 'packages/core/package.json', regen: 'manual', hint: 'h' }]
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function registryFromEntries(entries: ScaffoldRegistryEntry[]): ScaffoldRegistry {
|
|
26
|
-
return { version: '1', entries }
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function matchedIds(registry: ScaffoldRegistry, filePath: string): string[] {
|
|
30
|
-
return findMatchingEntries(registry, filePath).map((e) => e.id)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
let tempRoots: string[] = []
|
|
34
|
-
|
|
35
|
-
function makeTempRoot(): string {
|
|
36
|
-
const root = mkdtempSync(path.join(tmpdir(), 'scaffold-registry-'))
|
|
37
|
-
tempRoots.push(root)
|
|
38
|
-
return root
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
afterEach(() => {
|
|
42
|
-
for (const root of tempRoots) {
|
|
43
|
-
rmSync(root, { recursive: true, force: true })
|
|
44
|
-
}
|
|
45
|
-
tempRoots = []
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
describe('loadScaffoldRegistryFast', () => {
|
|
49
|
-
it('preserves external sync metadata from the compiled registry', () => {
|
|
50
|
-
const registry = loadScaffoldRegistryFast()
|
|
51
|
-
const entry = registry.entries.find((candidate) => candidate.id === 'external-sync-managed-claude')
|
|
52
|
-
|
|
53
|
-
expect(entry).toBeDefined()
|
|
54
|
-
expect(entry).toMatchObject({
|
|
55
|
-
owner: 'template',
|
|
56
|
-
category: 'replace',
|
|
57
|
-
strategy: 'replace-all',
|
|
58
|
-
delete_policy: 'manifest-only'
|
|
59
|
-
})
|
|
60
|
-
})
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
describe('findMissingDependentPaths', () => {
|
|
64
|
-
const baseEntry = {
|
|
65
|
-
id: 'fake-entry',
|
|
66
|
-
kind: 'manual-scaffold' as const,
|
|
67
|
-
owner: 'packages/core',
|
|
68
|
-
sources: ['packages/core/src/**'],
|
|
69
|
-
dependents: [{ path: 'packages/core/this-file-does-not-exist.ts', regen: 'manual', hint: 'h' }]
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
it('flags dependents whose paths are missing on disk', () => {
|
|
73
|
-
const registry: ScaffoldRegistry = { version: '1', entries: [baseEntry] }
|
|
74
|
-
const missing = findMissingDependentPaths(registry, process.cwd())
|
|
75
|
-
expect(missing).toEqual([{ entryId: 'fake-entry', path: 'packages/core/this-file-does-not-exist.ts' }])
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
it('skips symbolic targets, globs, and (self)', () => {
|
|
79
|
-
const registry: ScaffoldRegistry = {
|
|
80
|
-
version: '1',
|
|
81
|
-
entries: [
|
|
82
|
-
{
|
|
83
|
-
...baseEntry,
|
|
84
|
-
dependents: [
|
|
85
|
-
{ path: 'docs: sync-preservation-matrix', regen: 'manual', hint: 'h' },
|
|
86
|
-
{ path: 'autogen-target:foo', regen: 'manual', hint: 'h' },
|
|
87
|
-
{ path: 'packages/core/src/**/*.ts', regen: 'manual', hint: 'h' },
|
|
88
|
-
{ path: '(self)', regen: 'manual', hint: 'h' }
|
|
89
|
-
]
|
|
90
|
-
}
|
|
91
|
-
]
|
|
92
|
-
}
|
|
93
|
-
expect(findMissingDependentPaths(registry, process.cwd())).toEqual([])
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
it('skips sync-preservation entries (their paths target derived external projects)', () => {
|
|
97
|
-
const registry: ScaffoldRegistry = {
|
|
98
|
-
version: '1',
|
|
99
|
-
entries: [
|
|
100
|
-
{
|
|
101
|
-
id: 'sync-entry',
|
|
102
|
-
kind: 'sync-preservation',
|
|
103
|
-
owner: '@elevasis/core',
|
|
104
|
-
category: 'merge',
|
|
105
|
-
strategy: 'merge-regions',
|
|
106
|
-
delete_policy: 'none',
|
|
107
|
-
sources: ['external/_template/foo.ts'],
|
|
108
|
-
dependents: [{ path: 'core/src/foo-not-in-monorepo.ts', regen: 'manual', hint: 'h' }]
|
|
109
|
-
}
|
|
110
|
-
]
|
|
111
|
-
}
|
|
112
|
-
expect(findMissingDependentPaths(registry, process.cwd())).toEqual([])
|
|
113
|
-
})
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
describe('findMatchingEntries (pattern matching)', () => {
|
|
117
|
-
it('normalizes Windows and relative paths', () => {
|
|
118
|
-
expect(normalizeScaffoldPath('.\\packages\\core\\src\\')).toBe('packages/core/src')
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
it('matches exact paths', () => {
|
|
122
|
-
const reg = registryFromEntries([makeEntry('exact', ['packages/core/src/index.ts'])])
|
|
123
|
-
expect(matchedIds(reg, 'packages/core/src/index.ts')).toEqual(['exact'])
|
|
124
|
-
expect(matchedIds(reg, 'packages/core/src/other.ts')).toEqual([])
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
it('matches /** suffix as deep prefix', () => {
|
|
128
|
-
const reg = registryFromEntries([makeEntry('deep', ['packages/core/src/**'])])
|
|
129
|
-
expect(matchedIds(reg, 'packages/core/src/foo.ts')).toEqual(['deep'])
|
|
130
|
-
expect(matchedIds(reg, 'packages/core/src/nested/deeply/foo.ts')).toEqual(['deep'])
|
|
131
|
-
expect(matchedIds(reg, 'packages/core/package.json')).toEqual([])
|
|
132
|
-
expect(matchedIds(reg, 'packages/core/src')).toEqual([])
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
it('matches /* suffix as single-level prefix', () => {
|
|
136
|
-
const reg = registryFromEntries([makeEntry('shallow', ['packages/*/package.json'])])
|
|
137
|
-
expect(matchedIds(reg, 'packages/core/package.json')).toEqual(['shallow'])
|
|
138
|
-
expect(matchedIds(reg, 'packages/ui/package.json')).toEqual(['shallow'])
|
|
139
|
-
expect(matchedIds(reg, 'packages/core/nested/package.json')).toEqual([])
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
it('matches mixed **/*.ext patterns at direct-child and nested depths', () => {
|
|
143
|
-
const reg = registryFromEntries([makeEntry('ext', ['apps/api/src/**/*.ts'])])
|
|
144
|
-
expect(matchedIds(reg, 'apps/api/src/foo.ts')).toEqual(['ext'])
|
|
145
|
-
expect(matchedIds(reg, 'apps/api/src/nested/deeply/foo.ts')).toEqual(['ext'])
|
|
146
|
-
expect(matchedIds(reg, 'apps/api/src/foo.tsx')).toEqual([])
|
|
147
|
-
})
|
|
148
|
-
|
|
149
|
-
it('normalizes Windows backslashes to forward slashes', () => {
|
|
150
|
-
const reg = registryFromEntries([makeEntry('winpath', ['packages/core/src/**'])])
|
|
151
|
-
expect(matchedIds(reg, 'packages\\core\\src\\foo.ts')).toEqual(['winpath'])
|
|
152
|
-
})
|
|
153
|
-
|
|
154
|
-
it('matches a directory-prefix pattern (no glob characters)', () => {
|
|
155
|
-
const reg = registryFromEntries([makeEntry('dir', ['packages/core/src'])])
|
|
156
|
-
expect(matchedIds(reg, 'packages/core/src/foo.ts')).toEqual(['dir'])
|
|
157
|
-
expect(matchedIds(reg, 'packages/core/srcfoo.ts')).toEqual([])
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
it('returns multiple entries when several match the same file', () => {
|
|
161
|
-
const reg = registryFromEntries([makeEntry('a', ['packages/core/src/**']), makeEntry('b', ['packages/core/src'])])
|
|
162
|
-
expect(matchedIds(reg, 'packages/core/src/foo.ts').sort()).toEqual(['a', 'b'])
|
|
163
|
-
})
|
|
164
|
-
|
|
165
|
-
it('returns empty when no entries match', () => {
|
|
166
|
-
const reg = registryFromEntries([makeEntry('a', ['packages/core/src/**'])])
|
|
167
|
-
expect(matchedIds(reg, 'apps/api/src/foo.ts')).toEqual([])
|
|
168
|
-
})
|
|
169
|
-
|
|
170
|
-
it('exposes the same matcher for direct consumers', () => {
|
|
171
|
-
expect(scaffoldPathMatchesPattern('packages/core/src/foo.test.ts', 'packages/core/src/**/*.ts')).toBe(true)
|
|
172
|
-
expect(scaffoldPathMatchesPattern('packages/core/src/foo.test.ts', 'packages/ui/src/**/*.ts')).toBe(false)
|
|
173
|
-
})
|
|
174
|
-
})
|
|
175
|
-
|
|
176
|
-
describe('findEmptySourcePatterns', () => {
|
|
177
|
-
it('flags source patterns that do not match any file or directory', () => {
|
|
178
|
-
const root = makeTempRoot()
|
|
179
|
-
mkdirSync(path.join(root, 'packages', 'core', 'src'), { recursive: true })
|
|
180
|
-
writeFileSync(path.join(root, 'packages', 'core', 'src', 'index.ts'), 'export {}\n', 'utf8')
|
|
181
|
-
|
|
182
|
-
const registry = registryFromEntries([
|
|
183
|
-
makeEntry('ok-exact', ['packages/core/src/index.ts']),
|
|
184
|
-
makeEntry('ok-glob', ['packages/core/src/**/*.ts']),
|
|
185
|
-
makeEntry('empty', ['packages/core/src/**/*.tsx'])
|
|
186
|
-
])
|
|
187
|
-
|
|
188
|
-
expect(findEmptySourcePatterns(registry, root)).toEqual([
|
|
189
|
-
{ entryId: 'empty', pattern: 'packages/core/src/**/*.tsx' }
|
|
190
|
-
])
|
|
191
|
-
})
|
|
192
|
-
|
|
193
|
-
it('treats exact directories as non-empty source coverage', () => {
|
|
194
|
-
const root = makeTempRoot()
|
|
195
|
-
mkdirSync(path.join(root, 'external', '_template', '.claude', 'skills'), { recursive: true })
|
|
196
|
-
|
|
197
|
-
const registry = registryFromEntries([
|
|
198
|
-
makeEntry('dir', ['external/_template/.claude/skills']),
|
|
199
|
-
makeEntry('missing-dir', ['external/_template/.claude/commands'])
|
|
200
|
-
])
|
|
201
|
-
|
|
202
|
-
expect(findEmptySourcePatterns(registry, root)).toEqual([
|
|
203
|
-
{ entryId: 'missing-dir', pattern: 'external/_template/.claude/commands' }
|
|
204
|
-
])
|
|
205
|
-
})
|
|
206
|
-
})
|
|
1
|
+
import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from 'node:fs'
|
|
2
|
+
import { tmpdir } from 'node:os'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
import { afterEach, describe, expect, it } from 'vitest'
|
|
5
|
+
import {
|
|
6
|
+
findEmptySourcePatterns,
|
|
7
|
+
findMatchingEntries,
|
|
8
|
+
findMissingDependentPaths,
|
|
9
|
+
loadScaffoldRegistryFast,
|
|
10
|
+
normalizeScaffoldPath,
|
|
11
|
+
scaffoldPathMatchesPattern
|
|
12
|
+
} from '../index'
|
|
13
|
+
import type { ScaffoldRegistry, ScaffoldRegistryEntry } from '../schema'
|
|
14
|
+
|
|
15
|
+
function makeEntry(id: string, sources: string[]): ScaffoldRegistryEntry {
|
|
16
|
+
return {
|
|
17
|
+
id,
|
|
18
|
+
kind: 'manual-scaffold',
|
|
19
|
+
owner: 'packages/core',
|
|
20
|
+
sources,
|
|
21
|
+
dependents: [{ path: 'packages/core/package.json', regen: 'manual', hint: 'h' }]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function registryFromEntries(entries: ScaffoldRegistryEntry[]): ScaffoldRegistry {
|
|
26
|
+
return { version: '1', entries }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function matchedIds(registry: ScaffoldRegistry, filePath: string): string[] {
|
|
30
|
+
return findMatchingEntries(registry, filePath).map((e) => e.id)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let tempRoots: string[] = []
|
|
34
|
+
|
|
35
|
+
function makeTempRoot(): string {
|
|
36
|
+
const root = mkdtempSync(path.join(tmpdir(), 'scaffold-registry-'))
|
|
37
|
+
tempRoots.push(root)
|
|
38
|
+
return root
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
afterEach(() => {
|
|
42
|
+
for (const root of tempRoots) {
|
|
43
|
+
rmSync(root, { recursive: true, force: true })
|
|
44
|
+
}
|
|
45
|
+
tempRoots = []
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
describe('loadScaffoldRegistryFast', () => {
|
|
49
|
+
it('preserves external sync metadata from the compiled registry', () => {
|
|
50
|
+
const registry = loadScaffoldRegistryFast()
|
|
51
|
+
const entry = registry.entries.find((candidate) => candidate.id === 'external-sync-managed-claude')
|
|
52
|
+
|
|
53
|
+
expect(entry).toBeDefined()
|
|
54
|
+
expect(entry).toMatchObject({
|
|
55
|
+
owner: 'template',
|
|
56
|
+
category: 'replace',
|
|
57
|
+
strategy: 'replace-all',
|
|
58
|
+
delete_policy: 'manifest-only'
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
describe('findMissingDependentPaths', () => {
|
|
64
|
+
const baseEntry = {
|
|
65
|
+
id: 'fake-entry',
|
|
66
|
+
kind: 'manual-scaffold' as const,
|
|
67
|
+
owner: 'packages/core',
|
|
68
|
+
sources: ['packages/core/src/**'],
|
|
69
|
+
dependents: [{ path: 'packages/core/this-file-does-not-exist.ts', regen: 'manual', hint: 'h' }]
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
it('flags dependents whose paths are missing on disk', () => {
|
|
73
|
+
const registry: ScaffoldRegistry = { version: '1', entries: [baseEntry] }
|
|
74
|
+
const missing = findMissingDependentPaths(registry, process.cwd())
|
|
75
|
+
expect(missing).toEqual([{ entryId: 'fake-entry', path: 'packages/core/this-file-does-not-exist.ts' }])
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
it('skips symbolic targets, globs, and (self)', () => {
|
|
79
|
+
const registry: ScaffoldRegistry = {
|
|
80
|
+
version: '1',
|
|
81
|
+
entries: [
|
|
82
|
+
{
|
|
83
|
+
...baseEntry,
|
|
84
|
+
dependents: [
|
|
85
|
+
{ path: 'docs: sync-preservation-matrix', regen: 'manual', hint: 'h' },
|
|
86
|
+
{ path: 'autogen-target:foo', regen: 'manual', hint: 'h' },
|
|
87
|
+
{ path: 'packages/core/src/**/*.ts', regen: 'manual', hint: 'h' },
|
|
88
|
+
{ path: '(self)', regen: 'manual', hint: 'h' }
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
expect(findMissingDependentPaths(registry, process.cwd())).toEqual([])
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
it('skips sync-preservation entries (their paths target derived external projects)', () => {
|
|
97
|
+
const registry: ScaffoldRegistry = {
|
|
98
|
+
version: '1',
|
|
99
|
+
entries: [
|
|
100
|
+
{
|
|
101
|
+
id: 'sync-entry',
|
|
102
|
+
kind: 'sync-preservation',
|
|
103
|
+
owner: '@elevasis/core',
|
|
104
|
+
category: 'merge',
|
|
105
|
+
strategy: 'merge-regions',
|
|
106
|
+
delete_policy: 'none',
|
|
107
|
+
sources: ['external/_template/foo.ts'],
|
|
108
|
+
dependents: [{ path: 'core/src/foo-not-in-monorepo.ts', regen: 'manual', hint: 'h' }]
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
}
|
|
112
|
+
expect(findMissingDependentPaths(registry, process.cwd())).toEqual([])
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
describe('findMatchingEntries (pattern matching)', () => {
|
|
117
|
+
it('normalizes Windows and relative paths', () => {
|
|
118
|
+
expect(normalizeScaffoldPath('.\\packages\\core\\src\\')).toBe('packages/core/src')
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
it('matches exact paths', () => {
|
|
122
|
+
const reg = registryFromEntries([makeEntry('exact', ['packages/core/src/index.ts'])])
|
|
123
|
+
expect(matchedIds(reg, 'packages/core/src/index.ts')).toEqual(['exact'])
|
|
124
|
+
expect(matchedIds(reg, 'packages/core/src/other.ts')).toEqual([])
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
it('matches /** suffix as deep prefix', () => {
|
|
128
|
+
const reg = registryFromEntries([makeEntry('deep', ['packages/core/src/**'])])
|
|
129
|
+
expect(matchedIds(reg, 'packages/core/src/foo.ts')).toEqual(['deep'])
|
|
130
|
+
expect(matchedIds(reg, 'packages/core/src/nested/deeply/foo.ts')).toEqual(['deep'])
|
|
131
|
+
expect(matchedIds(reg, 'packages/core/package.json')).toEqual([])
|
|
132
|
+
expect(matchedIds(reg, 'packages/core/src')).toEqual([])
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
it('matches /* suffix as single-level prefix', () => {
|
|
136
|
+
const reg = registryFromEntries([makeEntry('shallow', ['packages/*/package.json'])])
|
|
137
|
+
expect(matchedIds(reg, 'packages/core/package.json')).toEqual(['shallow'])
|
|
138
|
+
expect(matchedIds(reg, 'packages/ui/package.json')).toEqual(['shallow'])
|
|
139
|
+
expect(matchedIds(reg, 'packages/core/nested/package.json')).toEqual([])
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
it('matches mixed **/*.ext patterns at direct-child and nested depths', () => {
|
|
143
|
+
const reg = registryFromEntries([makeEntry('ext', ['apps/api/src/**/*.ts'])])
|
|
144
|
+
expect(matchedIds(reg, 'apps/api/src/foo.ts')).toEqual(['ext'])
|
|
145
|
+
expect(matchedIds(reg, 'apps/api/src/nested/deeply/foo.ts')).toEqual(['ext'])
|
|
146
|
+
expect(matchedIds(reg, 'apps/api/src/foo.tsx')).toEqual([])
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
it('normalizes Windows backslashes to forward slashes', () => {
|
|
150
|
+
const reg = registryFromEntries([makeEntry('winpath', ['packages/core/src/**'])])
|
|
151
|
+
expect(matchedIds(reg, 'packages\\core\\src\\foo.ts')).toEqual(['winpath'])
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
it('matches a directory-prefix pattern (no glob characters)', () => {
|
|
155
|
+
const reg = registryFromEntries([makeEntry('dir', ['packages/core/src'])])
|
|
156
|
+
expect(matchedIds(reg, 'packages/core/src/foo.ts')).toEqual(['dir'])
|
|
157
|
+
expect(matchedIds(reg, 'packages/core/srcfoo.ts')).toEqual([])
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
it('returns multiple entries when several match the same file', () => {
|
|
161
|
+
const reg = registryFromEntries([makeEntry('a', ['packages/core/src/**']), makeEntry('b', ['packages/core/src'])])
|
|
162
|
+
expect(matchedIds(reg, 'packages/core/src/foo.ts').sort()).toEqual(['a', 'b'])
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
it('returns empty when no entries match', () => {
|
|
166
|
+
const reg = registryFromEntries([makeEntry('a', ['packages/core/src/**'])])
|
|
167
|
+
expect(matchedIds(reg, 'apps/api/src/foo.ts')).toEqual([])
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
it('exposes the same matcher for direct consumers', () => {
|
|
171
|
+
expect(scaffoldPathMatchesPattern('packages/core/src/foo.test.ts', 'packages/core/src/**/*.ts')).toBe(true)
|
|
172
|
+
expect(scaffoldPathMatchesPattern('packages/core/src/foo.test.ts', 'packages/ui/src/**/*.ts')).toBe(false)
|
|
173
|
+
})
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
describe('findEmptySourcePatterns', () => {
|
|
177
|
+
it('flags source patterns that do not match any file or directory', () => {
|
|
178
|
+
const root = makeTempRoot()
|
|
179
|
+
mkdirSync(path.join(root, 'packages', 'core', 'src'), { recursive: true })
|
|
180
|
+
writeFileSync(path.join(root, 'packages', 'core', 'src', 'index.ts'), 'export {}\n', 'utf8')
|
|
181
|
+
|
|
182
|
+
const registry = registryFromEntries([
|
|
183
|
+
makeEntry('ok-exact', ['packages/core/src/index.ts']),
|
|
184
|
+
makeEntry('ok-glob', ['packages/core/src/**/*.ts']),
|
|
185
|
+
makeEntry('empty', ['packages/core/src/**/*.tsx'])
|
|
186
|
+
])
|
|
187
|
+
|
|
188
|
+
expect(findEmptySourcePatterns(registry, root)).toEqual([
|
|
189
|
+
{ entryId: 'empty', pattern: 'packages/core/src/**/*.tsx' }
|
|
190
|
+
])
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
it('treats exact directories as non-empty source coverage', () => {
|
|
194
|
+
const root = makeTempRoot()
|
|
195
|
+
mkdirSync(path.join(root, 'external', '_template', '.claude', 'skills'), { recursive: true })
|
|
196
|
+
|
|
197
|
+
const registry = registryFromEntries([
|
|
198
|
+
makeEntry('dir', ['external/_template/.claude/skills']),
|
|
199
|
+
makeEntry('missing-dir', ['external/_template/.claude/commands'])
|
|
200
|
+
])
|
|
201
|
+
|
|
202
|
+
expect(findEmptySourcePatterns(registry, root)).toEqual([
|
|
203
|
+
{ entryId: 'missing-dir', pattern: 'external/_template/.claude/commands' }
|
|
204
|
+
])
|
|
205
|
+
})
|
|
206
|
+
})
|