t44 0.4.0-rc.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/.dco-signatures +9 -0
  2. package/.github/workflows/dco.yaml +12 -0
  3. package/.github/workflows/gordian-open-integrity.yaml +13 -0
  4. package/.o/GordianOpenIntegrity-CurrentLifehash.svg +1026 -0
  5. package/.o/GordianOpenIntegrity-InceptionLifehash.svg +1026 -0
  6. package/.o/GordianOpenIntegrity.yaml +25 -0
  7. package/.o/assets/Hero-Terminal44-v0.jpeg +0 -0
  8. package/DCO.md +34 -0
  9. package/LICENSE.md +203 -0
  10. package/README.md +185 -0
  11. package/bin/activate +36 -0
  12. package/bin/activate.ts +30 -0
  13. package/bin/postinstall.sh +19 -0
  14. package/bin/shell +27 -0
  15. package/bin/t44 +27 -0
  16. package/caps/ConfigSchemaStruct.ts +55 -0
  17. package/caps/Home.ts +57 -0
  18. package/caps/HomeRegistry.ts +319 -0
  19. package/caps/HomeRegistryFile.ts +144 -0
  20. package/caps/JsonSchemas.ts +220 -0
  21. package/caps/OpenApiSchema.ts +67 -0
  22. package/caps/PackageDescriptor.ts +88 -0
  23. package/caps/ProjectCatalogs.ts +153 -0
  24. package/caps/ProjectDeployment.ts +363 -0
  25. package/caps/ProjectDevelopment.ts +257 -0
  26. package/caps/ProjectPublishing.ts +522 -0
  27. package/caps/ProjectRack.ts +155 -0
  28. package/caps/ProjectRepository.ts +322 -0
  29. package/caps/RootKey.ts +219 -0
  30. package/caps/SigningKey.ts +243 -0
  31. package/caps/WorkspaceCli.ts +442 -0
  32. package/caps/WorkspaceConfig.ts +268 -0
  33. package/caps/WorkspaceConfig.yaml +71 -0
  34. package/caps/WorkspaceConfigFile.ts +807 -0
  35. package/caps/WorkspaceConnection.ts +256 -0
  36. package/caps/WorkspaceEntityConfig.ts +78 -0
  37. package/caps/WorkspaceEntityConfig.v0.ts +77 -0
  38. package/caps/WorkspaceEntityFact.ts +218 -0
  39. package/caps/WorkspaceInfo.ts +595 -0
  40. package/caps/WorkspaceInit.ts +30 -0
  41. package/caps/WorkspaceKey.ts +338 -0
  42. package/caps/WorkspaceModel.ts +373 -0
  43. package/caps/WorkspaceProjects.ts +636 -0
  44. package/caps/WorkspacePrompt.ts +406 -0
  45. package/caps/WorkspaceShell.sh +39 -0
  46. package/caps/WorkspaceShell.ts +104 -0
  47. package/caps/WorkspaceShell.yaml +64 -0
  48. package/caps/WorkspaceShellCli.ts +109 -0
  49. package/caps/WorkspaceTest.ts +167 -0
  50. package/caps/providers/README.md +2 -0
  51. package/caps/providers/bunny.net/ProjectDeployment.ts +327 -0
  52. package/caps/providers/bunny.net/api-pull.test.ts +319 -0
  53. package/caps/providers/bunny.net/api-pull.ts +164 -0
  54. package/caps/providers/bunny.net/api-storage.test.ts +168 -0
  55. package/caps/providers/bunny.net/api-storage.ts +248 -0
  56. package/caps/providers/bunny.net/api.ts +95 -0
  57. package/caps/providers/dynadot.com/ProjectDeployment.ts +202 -0
  58. package/caps/providers/dynadot.com/api-domains.test.ts +224 -0
  59. package/caps/providers/dynadot.com/api-domains.ts +169 -0
  60. package/caps/providers/dynadot.com/api-restful-v1.test.ts +190 -0
  61. package/caps/providers/dynadot.com/api-restful-v1.ts +94 -0
  62. package/caps/providers/dynadot.com/api-restful-v2.test.ts +200 -0
  63. package/caps/providers/dynadot.com/api-restful-v2.ts +94 -0
  64. package/caps/providers/git-scm.com/ProjectPublishing.ts +654 -0
  65. package/caps/providers/github.com/ProjectPublishing.ts +133 -0
  66. package/caps/providers/github.com/api.ts +130 -0
  67. package/caps/providers/npmjs.com/ProjectPublishing.ts +536 -0
  68. package/caps/providers/semver.org/ProjectPublishing.ts +286 -0
  69. package/caps/providers/vercel.com/ProjectDeployment.ts +326 -0
  70. package/caps/providers/vercel.com/api.test.ts +67 -0
  71. package/caps/providers/vercel.com/api.ts +132 -0
  72. package/caps/providers/vercel.com/bun.lock +194 -0
  73. package/caps/providers/vercel.com/package.json +10 -0
  74. package/caps/providers/vercel.com/project.test.ts +108 -0
  75. package/caps/providers/vercel.com/project.ts +150 -0
  76. package/caps/providers/vercel.com/tsconfig.json +28 -0
  77. package/docs/Overview.drawio +248 -0
  78. package/docs/Overview.svg +4 -0
  79. package/examples/01-Lifecycle/main.test.ts +228 -0
  80. package/lib/crypto.ts +53 -0
  81. package/lib/key.ts +369 -0
  82. package/lib/schema-console-renderer.ts +181 -0
  83. package/lib/schema-resolver.ts +349 -0
  84. package/lib/ucan.ts +137 -0
  85. package/package.json +102 -0
  86. package/standalone-rt.ts +121 -0
  87. package/structs/HomeRegistry.ts +55 -0
  88. package/structs/HomeRegistryConfig.ts +60 -0
  89. package/structs/ProjectCatalogsConfig.ts +53 -0
  90. package/structs/ProjectDeploymentConfig.ts +56 -0
  91. package/structs/ProjectDeploymentFact.ts +106 -0
  92. package/structs/ProjectPublishingFact.ts +68 -0
  93. package/structs/ProjectRack.ts +51 -0
  94. package/structs/ProjectRackConfig.ts +56 -0
  95. package/structs/RepositoryOriginDescriptor.ts +51 -0
  96. package/structs/RootKeyConfig.ts +64 -0
  97. package/structs/SigningKeyConfig.ts +64 -0
  98. package/structs/Workspace.ts +56 -0
  99. package/structs/WorkspaceCatalogs.ts +56 -0
  100. package/structs/WorkspaceCliConfig.ts +53 -0
  101. package/structs/WorkspaceConfig.ts +64 -0
  102. package/structs/WorkspaceConfigFile.ts +50 -0
  103. package/structs/WorkspaceConfigFileMeta.ts +70 -0
  104. package/structs/WorkspaceKey.ts +55 -0
  105. package/structs/WorkspaceKeyConfig.ts +56 -0
  106. package/structs/WorkspaceMappingsConfig.ts +56 -0
  107. package/structs/WorkspaceProject.ts +104 -0
  108. package/structs/WorkspaceProjectsConfig.ts +67 -0
  109. package/structs/WorkspacePublishingConfig.ts +65 -0
  110. package/structs/WorkspaceShellConfig.ts +83 -0
  111. package/structs/providers/README.md +2 -0
  112. package/structs/providers/bunny.net/PullZoneFact.ts +55 -0
  113. package/structs/providers/bunny.net/PullZoneListFact.ts +55 -0
  114. package/structs/providers/bunny.net/StorageZoneFact.ts +55 -0
  115. package/structs/providers/bunny.net/StorageZoneListFact.ts +55 -0
  116. package/structs/providers/bunny.net/WorkspaceConnectionConfig.ts +43 -0
  117. package/structs/providers/dynadot.com/DomainFact.ts +46 -0
  118. package/structs/providers/dynadot.com/WorkspaceConnectionConfig.ts +54 -0
  119. package/structs/providers/git-scm.com/ProjectPublishingFact.ts +46 -0
  120. package/structs/providers/github.com/ProjectPublishingFact.ts +46 -0
  121. package/structs/providers/github.com/WorkspaceConnectionConfig.ts +43 -0
  122. package/structs/providers/npmjs.com/ProjectPublishingFact.ts +46 -0
  123. package/structs/providers/vercel.com/ProjectDeploymentFact.ts +55 -0
  124. package/structs/providers/vercel.com/WorkspaceConnectionConfig.ts +49 -0
  125. package/tsconfig.json +28 -0
  126. package/workspace-rt.ts +134 -0
  127. package/workspace.yaml +3 -0
@@ -0,0 +1,55 @@
1
+
2
+ export async function capsule({
3
+ encapsulate,
4
+ CapsulePropertyTypes,
5
+ makeImportStack
6
+ }: any) {
7
+ return encapsulate({
8
+ '#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
9
+ '#t44/caps/ConfigSchemaStruct': {
10
+ as: 'schema',
11
+ options: {
12
+ '#': {
13
+ schema: {
14
+ type: 'object',
15
+ properties: {
16
+ createdAt: {
17
+ type: 'string',
18
+ format: 'date-time',
19
+ description: 'ISO 8601 timestamp when the storage zone list fact was created'
20
+ },
21
+ updatedAt: {
22
+ type: 'string',
23
+ format: 'date-time',
24
+ description: 'ISO 8601 timestamp when the storage zone list fact was last updated'
25
+ }
26
+ },
27
+ additionalProperties: true
28
+ }
29
+ }
30
+ }
31
+ },
32
+ '#t44/caps/OpenApiSchema': {
33
+ as: 'schemaOpenApi',
34
+ options: {
35
+ '#': {
36
+ url: 'https://core-api-public-docs.b-cdn.net/docs/v3/public.json',
37
+ def: '#/components/schemas/StorageZoneModel'
38
+ }
39
+ }
40
+ },
41
+ '#': {
42
+ capsuleName: {
43
+ type: CapsulePropertyTypes.Literal,
44
+ value: capsule['#']
45
+ },
46
+ }
47
+ }
48
+ }, {
49
+ extendsCapsule: 't44/caps/WorkspaceEntityFact',
50
+ importMeta: import.meta,
51
+ importStack: makeImportStack(),
52
+ capsuleName: capsule['#'],
53
+ })
54
+ }
55
+ capsule['#'] = 't44/structs/providers/bunny.net/StorageZoneListFact'
@@ -0,0 +1,43 @@
1
+
2
+ export async function capsule({
3
+ encapsulate,
4
+ CapsulePropertyTypes,
5
+ makeImportStack
6
+ }: any) {
7
+ return encapsulate({
8
+ '#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
9
+ '#t44/caps/ConfigSchemaStruct': {
10
+ as: 'schema',
11
+ options: {
12
+ '#': {
13
+ schema: {
14
+ type: 'object',
15
+ properties: {
16
+ apiKey: {
17
+ type: 'string',
18
+ title: 'Bunny.net API Key',
19
+ description: 'Your Bunny.net API key from https://dash.bunny.net/account/settings',
20
+ minLength: 30,
21
+ pattern: '^[a-f0-9-]+$'
22
+ }
23
+ },
24
+ required: ['apiKey']
25
+ }
26
+ }
27
+ }
28
+ },
29
+ '#': {
30
+ capsuleName: {
31
+ type: CapsulePropertyTypes.Literal,
32
+ value: capsule['#']
33
+ },
34
+ }
35
+ }
36
+ }, {
37
+ extendsCapsule: 't44/caps/WorkspaceConnection',
38
+ importMeta: import.meta,
39
+ importStack: makeImportStack(),
40
+ capsuleName: capsule['#'],
41
+ })
42
+ }
43
+ capsule['#'] = 't44/structs/providers/bunny.net/WorkspaceConnectionConfig'
@@ -0,0 +1,46 @@
1
+
2
+ export async function capsule({
3
+ encapsulate,
4
+ CapsulePropertyTypes,
5
+ makeImportStack
6
+ }: any) {
7
+ return encapsulate({
8
+ '#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
9
+ '#t44/caps/ConfigSchemaStruct': {
10
+ as: 'schema',
11
+ options: {
12
+ '#': {
13
+ schema: {
14
+ type: 'object',
15
+ properties: {
16
+ createdAt: {
17
+ type: 'string',
18
+ format: 'date-time',
19
+ description: 'ISO 8601 timestamp when the domain fact was created'
20
+ },
21
+ updatedAt: {
22
+ type: 'string',
23
+ format: 'date-time',
24
+ description: 'ISO 8601 timestamp when the domain fact was last updated'
25
+ }
26
+ },
27
+ additionalProperties: true
28
+ }
29
+ }
30
+ }
31
+ },
32
+ '#': {
33
+ capsuleName: {
34
+ type: CapsulePropertyTypes.Literal,
35
+ value: capsule['#']
36
+ },
37
+ }
38
+ }
39
+ }, {
40
+ extendsCapsule: 't44/caps/WorkspaceEntityFact',
41
+ importMeta: import.meta,
42
+ importStack: makeImportStack(),
43
+ capsuleName: capsule['#'],
44
+ })
45
+ }
46
+ capsule['#'] = 't44/structs/providers/dynadot.com/DomainFact'
@@ -0,0 +1,54 @@
1
+
2
+ export async function capsule({
3
+ encapsulate,
4
+ CapsulePropertyTypes,
5
+ makeImportStack
6
+ }: any) {
7
+ return encapsulate({
8
+ '#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
9
+ '#t44/caps/ConfigSchemaStruct': {
10
+ as: 'schema',
11
+ options: {
12
+ '#': {
13
+ schema: {
14
+ type: 'object',
15
+ properties: {
16
+ apiKey: {
17
+ type: 'string',
18
+ title: 'Dynadot API Key',
19
+ description: 'Your Dynadot API key. Generate at https://www.dynadot.com/account/domain/setting/api.html',
20
+ minLength: 10
21
+ },
22
+ apiSecret: {
23
+ type: 'string',
24
+ title: 'Dynadot API Secret',
25
+ description: 'Your Dynadot API secret for REST API HMAC-SHA256 signing.',
26
+ minLength: 10
27
+ },
28
+ apiKeyTransactionSecret: {
29
+ type: 'string',
30
+ title: 'Dynadot API Key Transaction Secret',
31
+ description: 'Your Dynadot API key transaction secret (optional, for transactional endpoints).',
32
+ minLength: 10
33
+ }
34
+ },
35
+ required: ['apiKey', 'apiSecret']
36
+ }
37
+ }
38
+ }
39
+ },
40
+ '#': {
41
+ capsuleName: {
42
+ type: CapsulePropertyTypes.Literal,
43
+ value: capsule['#']
44
+ },
45
+ }
46
+ }
47
+ }, {
48
+ extendsCapsule: 't44/caps/WorkspaceConnection',
49
+ importMeta: import.meta,
50
+ importStack: makeImportStack(),
51
+ capsuleName: capsule['#'],
52
+ })
53
+ }
54
+ capsule['#'] = 't44/structs/providers/dynadot.com/WorkspaceConnectionConfig'
@@ -0,0 +1,46 @@
1
+
2
+ export async function capsule({
3
+ encapsulate,
4
+ CapsulePropertyTypes,
5
+ makeImportStack
6
+ }: any) {
7
+ return encapsulate({
8
+ '#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
9
+ '#t44/caps/ConfigSchemaStruct': {
10
+ as: 'schema',
11
+ options: {
12
+ '#': {
13
+ schema: {
14
+ type: 'object',
15
+ properties: {
16
+ createdAt: {
17
+ type: 'string',
18
+ format: 'date-time',
19
+ description: 'ISO 8601 timestamp when the project publishing fact was created'
20
+ },
21
+ updatedAt: {
22
+ type: 'string',
23
+ format: 'date-time',
24
+ description: 'ISO 8601 timestamp when the project publishing fact was last updated'
25
+ }
26
+ },
27
+ additionalProperties: true
28
+ }
29
+ }
30
+ }
31
+ },
32
+ '#': {
33
+ capsuleName: {
34
+ type: CapsulePropertyTypes.Literal,
35
+ value: capsule['#']
36
+ },
37
+ }
38
+ }
39
+ }, {
40
+ extendsCapsule: 't44/caps/WorkspaceEntityFact',
41
+ importMeta: import.meta,
42
+ importStack: makeImportStack(),
43
+ capsuleName: capsule['#'],
44
+ })
45
+ }
46
+ capsule['#'] = 't44/structs/providers/git-scm.com/ProjectPublishingFact'
@@ -0,0 +1,46 @@
1
+
2
+ export async function capsule({
3
+ encapsulate,
4
+ CapsulePropertyTypes,
5
+ makeImportStack
6
+ }: any) {
7
+ return encapsulate({
8
+ '#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
9
+ '#t44/caps/ConfigSchemaStruct': {
10
+ as: 'schema',
11
+ options: {
12
+ '#': {
13
+ schema: {
14
+ type: 'object',
15
+ properties: {
16
+ createdAt: {
17
+ type: 'string',
18
+ format: 'date-time',
19
+ description: 'ISO 8601 timestamp when the project publishing fact was created'
20
+ },
21
+ updatedAt: {
22
+ type: 'string',
23
+ format: 'date-time',
24
+ description: 'ISO 8601 timestamp when the project publishing fact was last updated'
25
+ }
26
+ },
27
+ additionalProperties: true
28
+ }
29
+ }
30
+ }
31
+ },
32
+ '#': {
33
+ capsuleName: {
34
+ type: CapsulePropertyTypes.Literal,
35
+ value: capsule['#']
36
+ },
37
+ }
38
+ }
39
+ }, {
40
+ extendsCapsule: 't44/caps/WorkspaceEntityFact',
41
+ importMeta: import.meta,
42
+ importStack: makeImportStack(),
43
+ capsuleName: capsule['#'],
44
+ })
45
+ }
46
+ capsule['#'] = 't44/structs/providers/github.com/ProjectPublishingFact'
@@ -0,0 +1,43 @@
1
+
2
+ export async function capsule({
3
+ encapsulate,
4
+ CapsulePropertyTypes,
5
+ makeImportStack
6
+ }: any) {
7
+ return encapsulate({
8
+ '#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
9
+ '#t44/caps/ConfigSchemaStruct': {
10
+ as: 'schema',
11
+ options: {
12
+ '#': {
13
+ schema: {
14
+ type: 'object',
15
+ properties: {
16
+ apiToken: {
17
+ type: 'string',
18
+ title: 'GitHub Personal Access Token',
19
+ description: 'Your GitHub personal access token from https://github.com/settings/tokens (needs repo scope)',
20
+ minLength: 10,
21
+ pattern: '^(ghp_[A-Za-z0-9]+|github_pat_[A-Za-z0-9_]+)$'
22
+ }
23
+ },
24
+ required: ['apiToken']
25
+ }
26
+ }
27
+ }
28
+ },
29
+ '#': {
30
+ capsuleName: {
31
+ type: CapsulePropertyTypes.Literal,
32
+ value: capsule['#']
33
+ },
34
+ }
35
+ }
36
+ }, {
37
+ extendsCapsule: 't44/caps/WorkspaceConnection',
38
+ importMeta: import.meta,
39
+ importStack: makeImportStack(),
40
+ capsuleName: capsule['#'],
41
+ })
42
+ }
43
+ capsule['#'] = 't44/structs/providers/github.com/WorkspaceConnectionConfig'
@@ -0,0 +1,46 @@
1
+
2
+ export async function capsule({
3
+ encapsulate,
4
+ CapsulePropertyTypes,
5
+ makeImportStack
6
+ }: any) {
7
+ return encapsulate({
8
+ '#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
9
+ '#t44/caps/ConfigSchemaStruct': {
10
+ as: 'schema',
11
+ options: {
12
+ '#': {
13
+ schema: {
14
+ type: 'object',
15
+ properties: {
16
+ createdAt: {
17
+ type: 'string',
18
+ format: 'date-time',
19
+ description: 'ISO 8601 timestamp when the project publishing fact was created'
20
+ },
21
+ updatedAt: {
22
+ type: 'string',
23
+ format: 'date-time',
24
+ description: 'ISO 8601 timestamp when the project publishing fact was last updated'
25
+ }
26
+ },
27
+ additionalProperties: true
28
+ }
29
+ }
30
+ }
31
+ },
32
+ '#': {
33
+ capsuleName: {
34
+ type: CapsulePropertyTypes.Literal,
35
+ value: capsule['#']
36
+ },
37
+ }
38
+ }
39
+ }, {
40
+ extendsCapsule: 't44/caps/WorkspaceEntityFact',
41
+ importMeta: import.meta,
42
+ importStack: makeImportStack(),
43
+ capsuleName: capsule['#'],
44
+ })
45
+ }
46
+ capsule['#'] = 't44/structs/providers/npmjs.com/ProjectPublishingFact'
@@ -0,0 +1,55 @@
1
+
2
+ export async function capsule({
3
+ encapsulate,
4
+ CapsulePropertyTypes,
5
+ makeImportStack
6
+ }: any) {
7
+ return encapsulate({
8
+ '#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
9
+ '#t44/caps/ConfigSchemaStruct': {
10
+ as: 'schema',
11
+ options: {
12
+ '#': {
13
+ schema: {
14
+ type: 'object',
15
+ properties: {
16
+ createdAt: {
17
+ type: 'string',
18
+ format: 'date-time',
19
+ description: 'ISO 8601 timestamp when the project deployment fact was created'
20
+ },
21
+ updatedAt: {
22
+ type: 'string',
23
+ format: 'date-time',
24
+ description: 'ISO 8601 timestamp when the project deployment fact was last updated'
25
+ }
26
+ },
27
+ additionalProperties: true
28
+ }
29
+ }
30
+ }
31
+ },
32
+ '#t44/caps/OpenApiSchema': {
33
+ as: 'schemaOpenApi',
34
+ options: {
35
+ '#': {
36
+ url: 'https://openapi.vercel.sh/',
37
+ def: '#/paths/~1v9~1projects~1{idOrName}/get/responses/200/content/application~1json/schema'
38
+ }
39
+ }
40
+ },
41
+ '#': {
42
+ capsuleName: {
43
+ type: CapsulePropertyTypes.Literal,
44
+ value: capsule['#']
45
+ },
46
+ }
47
+ }
48
+ }, {
49
+ extendsCapsule: 't44/caps/WorkspaceEntityFact',
50
+ importMeta: import.meta,
51
+ importStack: makeImportStack(),
52
+ capsuleName: capsule['#'],
53
+ })
54
+ }
55
+ capsule['#'] = 't44/structs/providers/vercel.com/ProjectDeploymentFact'
@@ -0,0 +1,49 @@
1
+
2
+ export async function capsule({
3
+ encapsulate,
4
+ CapsulePropertyTypes,
5
+ makeImportStack
6
+ }: any) {
7
+ return encapsulate({
8
+ '#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
9
+ '#t44/caps/ConfigSchemaStruct': {
10
+ as: 'schema',
11
+ options: {
12
+ '#': {
13
+ schema: {
14
+ type: 'object',
15
+ properties: {
16
+ apiToken: {
17
+ type: 'string',
18
+ title: 'Vercel API Token',
19
+ description: 'Your Vercel API token from https://vercel.com/account/tokens',
20
+ minLength: 20,
21
+ pattern: '^[A-Za-z0-9_-]+$'
22
+ },
23
+ team: {
24
+ type: 'string',
25
+ title: 'Default Team',
26
+ description: 'Your default Vercel team slug',
27
+ minLength: 1
28
+ }
29
+ },
30
+ required: ['apiToken']
31
+ }
32
+ }
33
+ }
34
+ },
35
+ '#': {
36
+ capsuleName: {
37
+ type: CapsulePropertyTypes.Literal,
38
+ value: capsule['#']
39
+ },
40
+ }
41
+ }
42
+ }, {
43
+ extendsCapsule: 't44/caps/WorkspaceConnection',
44
+ importMeta: import.meta,
45
+ importStack: makeImportStack(),
46
+ capsuleName: capsule['#'],
47
+ })
48
+ }
49
+ capsule['#'] = 't44/structs/providers/vercel.com/WorkspaceConnectionConfig'
package/tsconfig.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "extends": "../../../tsconfig.paths.json",
3
+ "compilerOptions": {
4
+ "target": "es2021",
5
+ "module": "esnext",
6
+ "lib": [
7
+ "ES2021",
8
+ "DOM"
9
+ ],
10
+ "types": [
11
+ "bun",
12
+ "node"
13
+ ],
14
+ "moduleResolution": "bundler",
15
+ "strict": true,
16
+ "esModuleInterop": true,
17
+ "skipLibCheck": true,
18
+ "forceConsistentCasingInFileNames": true,
19
+ "resolveJsonModule": true,
20
+ "allowSyntheticDefaultImports": true
21
+ },
22
+ "include": [
23
+ "**/*.ts"
24
+ ],
25
+ "exclude": [
26
+ "node_modules"
27
+ ]
28
+ }
@@ -0,0 +1,134 @@
1
+ #!/usr/bin/env bun
2
+ /// <reference types="bun" />
3
+ /// <reference types="node" />
4
+
5
+ const startTime = Date.now()
6
+
7
+ import { join, resolve } from 'path'
8
+ import { access } from 'fs/promises'
9
+ import chalk from 'chalk'
10
+ import { CapsuleSpineFactory } from "@stream44.studio/encapsulate/spine-factories/CapsuleSpineFactory.v0"
11
+ import { CapsuleSpineContract } from "@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0/Membrane.v0"
12
+ import { TimingObserver } from "@stream44.studio/encapsulate/spine-factories/TimingObserver"
13
+
14
+ async function findWorkspaceRoot(): Promise<string> {
15
+ let currentDir = resolve(process.cwd())
16
+
17
+ while (true) {
18
+ const workspaceConfigPath = join(currentDir, '.workspace', 'workspace.yaml')
19
+ try {
20
+ await access(workspaceConfigPath)
21
+ return currentDir
22
+ } catch {
23
+ // File doesn't exist, continue traversing
24
+ }
25
+
26
+ const parentDir = resolve(currentDir, '..')
27
+ if (parentDir === currentDir) {
28
+ throw new Error(
29
+ `Could not find workspace root. Please run this command from within a workspace directory ` +
30
+ `(a directory containing .workspace/workspace.yaml).`
31
+ )
32
+ }
33
+ currentDir = parentDir
34
+ }
35
+ }
36
+
37
+ export async function run(encapsulateHandler: any, runHandler: any, options?: { importMeta?: { dir: string } }) {
38
+
39
+ const timing = process.argv.includes('--trace') ? TimingObserver({ startTime }) : undefined
40
+
41
+ timing?.recordMajor('INIT SPINE')
42
+
43
+ const eventsByKey = new Map<string, any>()
44
+
45
+ const workspaceRootDir = await findWorkspaceRoot()
46
+
47
+ const { encapsulate, freeze, CapsulePropertyTypes, makeImportStack, hoistSnapshot } = await CapsuleSpineFactory({
48
+ spineFilesystemRoot: workspaceRootDir,
49
+ capsuleModuleProjectionRoot: (import.meta as any).dir,
50
+ enableCallerStackInference: true,
51
+ spineContracts: {
52
+ ['#' + CapsuleSpineContract['#']]: CapsuleSpineContract
53
+ },
54
+ timing,
55
+ onMembraneEvent: timing ? (event: any) => {
56
+ const instanceId = event.target?.spineContractCapsuleInstanceId
57
+ const eventIndex = event.eventIndex
58
+
59
+ // Store event by composite key (instance ID + event index)
60
+ const key = `${eventIndex}`
61
+ eventsByKey.set(key, event)
62
+
63
+ let capsuleRef = event.target?.capsuleSourceLineRef
64
+ let prop = event.target?.prop
65
+ let callerLocation = event.caller ? `${event.caller.filepath}:${event.caller.line}` : 'unknown'
66
+ const eventType = event.event
67
+
68
+ // For call-result events, look up the original call event to get all info
69
+ if (eventType === 'call-result') {
70
+ const callKey = `${event.callEventIndex}`
71
+ const callEvent = eventsByKey.get(callKey)
72
+ if (callEvent) {
73
+ capsuleRef = callEvent.target?.capsuleSourceLineRef || capsuleRef
74
+ prop = callEvent.target?.prop || prop
75
+ if (callEvent.caller) {
76
+ callerLocation = `${callEvent.caller.filepath}:${callEvent.caller.line}`
77
+ }
78
+ }
79
+ }
80
+
81
+ console.error(
82
+ chalk.gray(`[${eventIndex}]`),
83
+ chalk.cyan(eventType.padEnd(12)),
84
+ chalk.yellow(capsuleRef),
85
+ chalk.magenta(`.${prop}`),
86
+ chalk.dim(`from ${callerLocation}`)
87
+ )
88
+ } : undefined
89
+ })
90
+
91
+ timing?.recordMajor('ENCAPSULATE')
92
+
93
+ const exportedApi = await encapsulateHandler({
94
+ encapsulate,
95
+ CapsulePropertyTypes,
96
+ makeImportStack
97
+ })
98
+
99
+ timing?.recordMajor('FREEZE')
100
+
101
+ const snapshot = await freeze()
102
+
103
+ timing?.recordMajor('HOIST SNAPSHOT')
104
+
105
+ const { run } = await hoistSnapshot({
106
+ snapshot
107
+ })
108
+
109
+ timing?.recordMajor('RUN')
110
+
111
+ const result = await run({
112
+ overrides: {
113
+ ['t44/caps/WorkspaceConfig']: {
114
+ '#': {
115
+ workspaceRootDir
116
+ }
117
+ },
118
+ ['t44/caps/WorkspaceTest']: {
119
+ '#': {
120
+ testRootDir: options?.importMeta?.dir
121
+ }
122
+ }
123
+ }
124
+ }, async (opts) => {
125
+ return runHandler({
126
+ ...opts,
127
+ ...(exportedApi || {})
128
+ })
129
+ })
130
+
131
+ timing?.recordMajor('DONE')
132
+
133
+ return result
134
+ }
package/workspace.yaml ADDED
@@ -0,0 +1,3 @@
1
+ $schema: ../../../../../../.~o/workspace.foundation/@t44.sh~t44~caps~JsonSchemas/@t44.sh~t44~structs~WorkspaceConfigFile.json
2
+ extends:
3
+ - ./caps/WorkspaceConfig.yaml