@stream44.studio/t44-blockchaincommons.com 0.1.0-rc.2

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 (37) hide show
  1. package/.dco-signatures +9 -0
  2. package/.github/workflows/dco.yml +12 -0
  3. package/.github/workflows/gordian-open-integrity.yml +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/DCO.md +34 -0
  8. package/README.md +210 -0
  9. package/action.yml +47 -0
  10. package/bin/oi +152 -0
  11. package/caps/GordianOpenIntegrity.test.ts +879 -0
  12. package/caps/GordianOpenIntegrity.ts +821 -0
  13. package/caps/XidDocumentLedger.test.ts +687 -0
  14. package/caps/XidDocumentLedger.ts +545 -0
  15. package/caps/__snapshots__/XidDocumentLedger.test.ts.snap +11 -0
  16. package/caps/__snapshots__/XidLedger.test.ts.snap +11 -0
  17. package/caps/lifehash.test.ts +302 -0
  18. package/caps/lifehash.ts +142 -0
  19. package/caps/open-integrity-js.test.ts +252 -0
  20. package/caps/open-integrity-js.ts +485 -0
  21. package/caps/open-integrity-sh.test.ts +188 -0
  22. package/caps/open-integrity-sh.ts +187 -0
  23. package/caps/open-integrity.test.ts +259 -0
  24. package/caps/provenance-mark-cli.test.ts +387 -0
  25. package/caps/provenance-mark-cli.ts +174 -0
  26. package/caps/provenance-mark.test.ts +233 -0
  27. package/caps/provenance-mark.ts +223 -0
  28. package/caps/xid.test.ts +828 -0
  29. package/caps/xid.ts +565 -0
  30. package/examples/01-XID-DocumentLedger/__snapshots__/main.test.ts.snap +10 -0
  31. package/examples/01-XID-DocumentLedger/main.test.ts +182 -0
  32. package/examples/02-XID-Rotate-InceptionKey/__snapshots__/main.test.ts.snap +53 -0
  33. package/examples/02-XID-Rotate-InceptionKey/main.test.ts +232 -0
  34. package/examples/03-GordianOpenIntegrity/main.test.ts +176 -0
  35. package/examples/04-GordianOpenIntegrityCli/main.test.ts +119 -0
  36. package/package.json +37 -0
  37. package/tsconfig.json +28 -0
@@ -0,0 +1,119 @@
1
+ #!/usr/bin/env bun test
2
+
3
+ import * as bunTest from 'bun:test'
4
+ import { run } from 't44/workspace-rt'
5
+ import { join } from 'path'
6
+ import { rm, mkdir, readFile, access } from 'fs/promises'
7
+
8
+ const WORK_DIR = join(import.meta.dir, '.~open-integrity-cli')
9
+ const REPO_DIR = join(WORK_DIR, 'repo')
10
+ const KEYS_DIR = join(WORK_DIR, 'keys')
11
+ const OI_BIN = join(import.meta.dir, '../../bin/oi')
12
+
13
+ const {
14
+ test: { describe, it, expect },
15
+ } = await run(async ({ encapsulate, CapsulePropertyTypes, makeImportStack }: any) => {
16
+ const spine = await encapsulate({
17
+ '#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
18
+ '#@stream44.studio/encapsulate/structs/Capsule': {},
19
+ '#': {
20
+ test: {
21
+ type: CapsulePropertyTypes.Mapping,
22
+ value: 't44/caps/WorkspaceTest',
23
+ options: {
24
+ '#': {
25
+ bunTest,
26
+ env: {}
27
+ }
28
+ }
29
+ },
30
+ }
31
+ }
32
+ }, {
33
+ importMeta: import.meta,
34
+ importStack: makeImportStack(),
35
+ capsuleName: '@stream44.studio/t44-blockchaincommons.com/examples/04-GordianOpenIntegrityCli'
36
+ })
37
+ return { spine }
38
+ }, async ({ spine, apis }: any) => {
39
+ return apis[spine.capsuleSourceLineRef]
40
+ }, {
41
+ importMeta: import.meta
42
+ })
43
+
44
+ describe('GordianOpenIntegrity CLI', function () {
45
+
46
+ it('should display help when no command is provided', async function () {
47
+ const proc = Bun.spawn(['bun', OI_BIN], {
48
+ stdout: 'pipe',
49
+ stderr: 'pipe',
50
+ })
51
+ const stdout = await new Response(proc.stdout).text()
52
+ const stderr = await new Response(proc.stderr).text()
53
+ await proc.exited
54
+ const output = stdout + stderr
55
+ expect(output).toContain('Gordian Open Integrity CLI')
56
+ })
57
+
58
+ it('should init a repository with --inception-key', async function () {
59
+ // Clean up and prepare directories
60
+ await rm(WORK_DIR, { recursive: true, force: true })
61
+ await mkdir(REPO_DIR, { recursive: true })
62
+ await mkdir(KEYS_DIR, { recursive: true })
63
+
64
+ // Generate a test SSH key
65
+ const keyPath = join(KEYS_DIR, 'test_ed25519')
66
+ const keygenProc = Bun.spawn(['ssh-keygen', '-t', 'ed25519', '-f', keyPath, '-N', '', '-C', 'test_ed25519'], {
67
+ stdout: 'pipe',
68
+ stderr: 'pipe',
69
+ })
70
+ await keygenProc.exited
71
+
72
+ // Run the init command
73
+ const proc = Bun.spawn(['bun', OI_BIN, 'init', 'GordianOpenIntegrity', '--inception-key', keyPath], {
74
+ cwd: REPO_DIR,
75
+ stdout: 'pipe',
76
+ stderr: 'pipe',
77
+ })
78
+ const stdout = await new Response(proc.stdout).text()
79
+ const stderr = await new Response(proc.stderr).text()
80
+ const exitCode = await proc.exited
81
+
82
+ const output = stdout + stderr
83
+ if (exitCode !== 0) {
84
+ console.error('CLI output:', output)
85
+ }
86
+ expect(exitCode).toBe(0)
87
+ expect(output).toContain('Gordian Open Integrity repository initialized')
88
+ expect(output).toContain('DID:')
89
+ expect(output).toContain('Mark:')
90
+
91
+ // Verify the repo was created with expected files
92
+ const provenancePath = join(REPO_DIR, '.o', 'GordianOpenIntegrity.yaml')
93
+ await access(provenancePath)
94
+ const content = await readFile(provenancePath, 'utf-8')
95
+ expect(content).toContain('envelope')
96
+ expect(content).toContain('mark')
97
+ })
98
+
99
+ it('should validate a repository after init', async function () {
100
+ // Run the validate command on the repo initialized above
101
+ const proc = Bun.spawn(['bun', OI_BIN, 'validate', 'GordianOpenIntegrity'], {
102
+ cwd: REPO_DIR,
103
+ stdout: 'pipe',
104
+ stderr: 'pipe',
105
+ })
106
+ const stdout = await new Response(proc.stdout).text()
107
+ const stderr = await new Response(proc.stderr).text()
108
+ const exitCode = await proc.exited
109
+
110
+ const output = stdout + stderr
111
+ if (exitCode !== 0) {
112
+ console.error('CLI output:', output)
113
+ }
114
+ expect(exitCode).toBe(0)
115
+ expect(output).toContain('Repository integrity verified')
116
+ expect(output).toContain('XID:')
117
+ expect(output).toContain('Commits:')
118
+ })
119
+ })
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@stream44.studio/t44-blockchaincommons.com",
3
+ "version": "0.1.0-rc.2",
4
+ "private": false,
5
+ "license": "BSD-2-Clause-Patent",
6
+ "type": "module",
7
+ "bin": {
8
+ "oi": "./bin/oi"
9
+ },
10
+ "exports": {
11
+ "./caps/xid": "./caps/xid.ts",
12
+ "./caps/open-integrity-sh": "./caps/open-integrity-sh.ts",
13
+ "./caps/open-integrity-js": "./caps/open-integrity-js.ts",
14
+ "./caps/provenance-mark": "./caps/provenance-mark.ts",
15
+ "./caps/XidDocumentLedger": "./caps/XidDocumentLedger.ts",
16
+ "./caps/GordianOpenIntegrity": "./caps/GordianOpenIntegrity.ts",
17
+ "./caps/provenance-mark-cli": "./caps/provenance-mark-cli.ts",
18
+ "./caps/lifehash": "./caps/lifehash.ts"
19
+ },
20
+ "dependencies": {
21
+ "@bcts/xid": "^1.0.0-alpha.19",
22
+ "@bcts/components": "^1.0.0-alpha.19",
23
+ "@bcts/provenance-mark": "^1.0.0-alpha.19",
24
+ "@bcts/provenance-mark-cli": "^1.0.0-alpha.20",
25
+ "@bcts/lifehash": "^1.0.0-alpha.20",
26
+ "commander": "^14.0.0",
27
+ "chalk": "^5.6.2",
28
+ "t44": "^0.4.0-rc.2",
29
+ "@stream44.studio/encapsulate": "^0.4.0-rc.2",
30
+ "open-integrity-core": "git+ssh://git@github.com/OpenIntegrityProject/core.git"
31
+ },
32
+ "devDependencies": {
33
+ "@types/bun": "^1.3.4",
34
+ "@types/node": "^25.0.3",
35
+ "bun-types": "^1.3.4"
36
+ }
37
+ }
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
+ }