@volter/twin-github 0.1.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/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "@volter/twin-github",
3
+ "version": "0.1.0",
4
+ "description": "Local GitHub twin \u2014 PR-evidence REST; your real `@octokit/rest` talks to it unmodified. Mirror, simulate, and fork. Built on @volter/twin.",
5
+ "keywords": [
6
+ "twin",
7
+ "local",
8
+ "mock",
9
+ "mirror",
10
+ "simulator",
11
+ "fixtures",
12
+ "testing",
13
+ "sdk",
14
+ "api",
15
+ "localstack",
16
+ "github",
17
+ "octokit",
18
+ "pull-requests"
19
+ ],
20
+ "author": "Volter (https://github.com/volter-ai)",
21
+ "license": "Apache-2.0",
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "files": [
26
+ "src",
27
+ "client",
28
+ "test-fixtures",
29
+ "README.md",
30
+ "LICENSE",
31
+ "!test-fixtures/*.SOURCE.md",
32
+ "!**/*.test.ts",
33
+ "!**/*.test.tsx"
34
+ ],
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "git+https://github.com/volter-ai/twin.git",
38
+ "directory": "packages/twin/github"
39
+ },
40
+ "homepage": "https://github.com/volter-ai/twin/tree/main/packages/twin/github#readme",
41
+ "type": "module",
42
+ "exports": {
43
+ ".": "./src/index.ts"
44
+ },
45
+ "bin": {
46
+ "world-github": "src/cli.ts"
47
+ },
48
+ "scripts": {
49
+ "test": "bun test src/*.test.ts",
50
+ "typecheck": "tsc --noEmit"
51
+ },
52
+ "dependencies": {
53
+ "react": "^19.2.7",
54
+ "react-dom": "^19.2.7"
55
+ },
56
+ "peerDependencies": {
57
+ "@volter/twin": "0.1.0"
58
+ },
59
+ "devDependencies": {
60
+ "@volter/twin": "0.1.0",
61
+ "@volter/twin-tooling": "0.1.0",
62
+ "@octokit/rest": "^22.0.1",
63
+ "playwright": "^1.61.0",
64
+ "@types/bun": "^1.2.20",
65
+ "@types/node": "^24.0.0",
66
+ "@types/react": "^19.2.17",
67
+ "@types/react-dom": "^19.2.3",
68
+ "typescript": "^5.9.0"
69
+ },
70
+ "engines": {
71
+ "bun": ">=1.2.0"
72
+ }
73
+ }
package/src/cli.ts ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env bun
2
+ // world-github — the GitHub PR-evidence twin CLI (R14): serve | mirror | conformance.
3
+ import { hasFlag, optionValue } from '@volter/twin/args';
4
+ import { createGithubMirrorServer } from './github-mirror-ui.ts';
5
+ import { createGithubTwinServer } from './github-server.ts';
6
+
7
+ const cmd = process.argv[2];
8
+ const rest = process.argv.slice(3);
9
+ const port = Number(optionValue(rest, '--port', '0')) || undefined;
10
+ const root = optionValue(rest, '--root') || undefined;
11
+ const readOnly = hasFlag(rest, "--read-only");
12
+
13
+ if (cmd === 'serve') {
14
+ const s = createGithubTwinServer({ readOnly, ...(root ? { root } : {}), ...(port ? { port } : {}) });
15
+ process.stdout.write(`github twin (GitHub REST) at http://127.0.0.1:${s.port}\n`);
16
+ await new Promise(() => {});
17
+ } else if (cmd === 'mirror') {
18
+ const s = createGithubMirrorServer({ ...(root ? { root } : {}), ...(port ? { port } : {}) });
19
+ process.stdout.write(`github mirror UI (PR evidence) at http://127.0.0.1:${s.port}\n`);
20
+ await new Promise(() => {});
21
+ } else if (cmd === 'conformance') {
22
+ // dev-only; lazy so the bin runs without @volter/twin-tooling
23
+ const {
24
+ checkGithubConformance, githubCommentCoverage, githubCoverage, githubReviewCoverage,
25
+ loadGithubCommentSchema, loadGithubKnownDeviations, loadGithubPrSchema, loadGithubReviewSchema,
26
+ } = await import('./github-conformance.ts');
27
+ const [prSchema, reviewSchema, commentSchema, known] = await Promise.all([
28
+ loadGithubPrSchema(), loadGithubReviewSchema(), loadGithubCommentSchema(), loadGithubKnownDeviations(),
29
+ ]);
30
+ const report = checkGithubConformance(prSchema, { ...(root ? { root } : {}), known });
31
+ const coverage = {
32
+ pull_request: githubCoverage(prSchema),
33
+ pull_request_review: githubReviewCoverage(reviewSchema),
34
+ issue_comment: githubCommentCoverage(commentSchema),
35
+ };
36
+ process.stdout.write(`${JSON.stringify({ ...report, coverage }, null, 2)}\n`);
37
+ process.exit(report.ok ? 0 : 1);
38
+ } else {
39
+ process.stdout.write('Usage: world-github <serve|mirror|conformance> [--read-only] [--port N] [--root DIR]\n');
40
+ }