t44 0.2.0-rc.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.

Potentially problematic release.


This version of t44 might be problematic. Click here for more details.

Files changed (86) hide show
  1. package/LICENSE.md +203 -0
  2. package/README.md +154 -0
  3. package/bin/activate +36 -0
  4. package/bin/activate.ts +30 -0
  5. package/bin/postinstall.sh +19 -0
  6. package/bin/shell +27 -0
  7. package/bin/t44 +27 -0
  8. package/caps/HomeRegistry.v0.ts +298 -0
  9. package/caps/OpenApiSchema.v0.ts +192 -0
  10. package/caps/ProjectDeployment.v0.ts +363 -0
  11. package/caps/ProjectDevelopment.v0.ts +246 -0
  12. package/caps/ProjectPublishing.v0.ts +307 -0
  13. package/caps/ProjectRack.v0.ts +128 -0
  14. package/caps/WorkspaceCli.v0.ts +391 -0
  15. package/caps/WorkspaceConfig.v0.ts +626 -0
  16. package/caps/WorkspaceConfig.yaml +53 -0
  17. package/caps/WorkspaceConnection.v0.ts +240 -0
  18. package/caps/WorkspaceEntityConfig.v0.ts +64 -0
  19. package/caps/WorkspaceEntityFact.v0.ts +193 -0
  20. package/caps/WorkspaceInfo.v0.ts +554 -0
  21. package/caps/WorkspaceInit.v0.ts +30 -0
  22. package/caps/WorkspaceKey.v0.ts +186 -0
  23. package/caps/WorkspaceProjects.v0.ts +455 -0
  24. package/caps/WorkspacePrompt.v0.ts +396 -0
  25. package/caps/WorkspaceShell.sh +39 -0
  26. package/caps/WorkspaceShell.v0.ts +104 -0
  27. package/caps/WorkspaceShell.yaml +65 -0
  28. package/caps/WorkspaceShellCli.v0.ts +109 -0
  29. package/caps/WorkspaceTest.v0.ts +167 -0
  30. package/caps/providers/LICENSE.md +8 -0
  31. package/caps/providers/README.md +2 -0
  32. package/caps/providers/bunny.net/ProjectDeployment.v0.ts +328 -0
  33. package/caps/providers/bunny.net/api-pull.v0.test.ts +319 -0
  34. package/caps/providers/bunny.net/api-pull.v0.ts +161 -0
  35. package/caps/providers/bunny.net/api-storage.v0.test.ts +168 -0
  36. package/caps/providers/bunny.net/api-storage.v0.ts +245 -0
  37. package/caps/providers/bunny.net/api.v0.ts +95 -0
  38. package/caps/providers/dynadot.com/ProjectDeployment.v0.ts +207 -0
  39. package/caps/providers/dynadot.com/api-domains.v0.test.ts +147 -0
  40. package/caps/providers/dynadot.com/api-domains.v0.ts +137 -0
  41. package/caps/providers/dynadot.com/api.v0.ts +88 -0
  42. package/caps/providers/git-scm.com/ProjectPublishing.v0.ts +231 -0
  43. package/caps/providers/github.com/ProjectPublishing.v0.ts +75 -0
  44. package/caps/providers/github.com/api.v0.ts +90 -0
  45. package/caps/providers/npmjs.com/ProjectPublishing.v0.ts +741 -0
  46. package/caps/providers/vercel.com/ProjectDeployment.v0.ts +339 -0
  47. package/caps/providers/vercel.com/api.v0.test.ts +67 -0
  48. package/caps/providers/vercel.com/api.v0.ts +132 -0
  49. package/caps/providers/vercel.com/bun.lock +194 -0
  50. package/caps/providers/vercel.com/package.json +10 -0
  51. package/caps/providers/vercel.com/project.v0.test.ts +108 -0
  52. package/caps/providers/vercel.com/project.v0.ts +150 -0
  53. package/caps/providers/vercel.com/tsconfig.json +28 -0
  54. package/docs/Overview.drawio +189 -0
  55. package/docs/Overview.svg +4 -0
  56. package/lib/crypto.ts +53 -0
  57. package/lib/openapi.ts +132 -0
  58. package/lib/ucan.ts +137 -0
  59. package/package.json +41 -0
  60. package/structs/HomeRegistryConfig.v0.ts +27 -0
  61. package/structs/ProjectDeploymentConfig.v0.ts +27 -0
  62. package/structs/ProjectDeploymentFact.v0.ts +110 -0
  63. package/structs/ProjectPublishingFact.v0.ts +69 -0
  64. package/structs/ProjectRackConfig.v0.ts +27 -0
  65. package/structs/WorkspaceCliConfig.v0.ts +27 -0
  66. package/structs/WorkspaceConfig.v0.ts +27 -0
  67. package/structs/WorkspaceKeyConfig.v0.ts +27 -0
  68. package/structs/WorkspaceMappings.v0.ts +27 -0
  69. package/structs/WorkspaceProjectsConfig.v0.ts +27 -0
  70. package/structs/WorkspaceRepositories.v0.ts +27 -0
  71. package/structs/WorkspaceShellConfig.v0.ts +45 -0
  72. package/structs/providers/LICENSE.md +8 -0
  73. package/structs/providers/README.md +2 -0
  74. package/structs/providers/bunny.net/ProjectDeploymentFact.v0.ts +41 -0
  75. package/structs/providers/bunny.net/WorkspaceConnectionConfig.v0.ts +42 -0
  76. package/structs/providers/dynadot.com/DomainFact.v0.ts +146 -0
  77. package/structs/providers/dynadot.com/WorkspaceConnectionConfig.v0.ts +41 -0
  78. package/structs/providers/git-scm.com/ProjectPublishingFact.v0.ts +46 -0
  79. package/structs/providers/github.com/ProjectPublishingFact.v0.ts +52 -0
  80. package/structs/providers/github.com/WorkspaceConnectionConfig.v0.ts +42 -0
  81. package/structs/providers/npmjs.com/ProjectPublishingFact.v0.ts +48 -0
  82. package/structs/providers/vercel.com/ProjectDeploymentFact.v0.ts +38 -0
  83. package/structs/providers/vercel.com/WorkspaceConnectionConfig.v0.ts +48 -0
  84. package/tsconfig.json +28 -0
  85. package/workspace-rt.ts +134 -0
  86. package/workspace.yaml +5 -0
@@ -0,0 +1,38 @@
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/OpenApiSchema.v0': {
10
+ as: 'schema',
11
+ options: {
12
+ '#': {
13
+ url: 'https://openapi.vercel.sh/',
14
+ definitions: {
15
+ 'Project': '#/paths/~1v9~1projects~1{idOrName}/get/responses/200/content/application~1json/schema',
16
+ }
17
+ }
18
+ }
19
+ },
20
+ '#': {
21
+ capsuleName: {
22
+ type: CapsulePropertyTypes.Literal,
23
+ value: capsule['#']
24
+ },
25
+ origin: {
26
+ type: CapsulePropertyTypes.Literal,
27
+ value: 'vercel.com',
28
+ },
29
+ }
30
+ }
31
+ }, {
32
+ extendsCapsule: 't44/caps/WorkspaceEntityFact.v0',
33
+ importMeta: import.meta,
34
+ importStack: makeImportStack(),
35
+ capsuleName: capsule['#'],
36
+ })
37
+ }
38
+ capsule['#'] = 't44/structs/providers/vercel.com/ProjectDeploymentFact.v0'
@@ -0,0 +1,48 @@
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
+ '#': {
10
+ capsuleName: {
11
+ type: CapsulePropertyTypes.Literal,
12
+ value: capsule['#']
13
+ },
14
+ origin: {
15
+ type: CapsulePropertyTypes.Literal,
16
+ value: 'vercel.com',
17
+ },
18
+ schema: {
19
+ type: CapsulePropertyTypes.Literal,
20
+ value: {
21
+ properties: {
22
+ apiToken: {
23
+ type: 'string',
24
+ title: 'Vercel API Token',
25
+ description: 'Your Vercel API token from https://vercel.com/account/tokens',
26
+ minLength: 20,
27
+ pattern: '^[A-Za-z0-9_-]+$'
28
+ },
29
+ team: {
30
+ type: 'string',
31
+ title: 'Default Team',
32
+ description: 'Your default Vercel team slug',
33
+ minLength: 1
34
+ }
35
+ },
36
+ required: ['apiToken']
37
+ }
38
+ },
39
+ }
40
+ }
41
+ }, {
42
+ extendsCapsule: 't44/caps/WorkspaceConnection.v0',
43
+ importMeta: import.meta,
44
+ importStack: makeImportStack(),
45
+ capsuleName: capsule['#'],
46
+ })
47
+ }
48
+ capsule['#'] = 't44/structs/providers/vercel.com/WorkspaceConnectionConfig.v0'
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/src/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.v0']: {
114
+ '#': {
115
+ workspaceRootDir
116
+ }
117
+ },
118
+ ['t44/caps/WorkspaceTest.v0']: {
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,5 @@
1
+
2
+ extends:
3
+ - ./caps/WorkspaceConfig.yaml
4
+
5
+ # Configure your workspace here