@volter/twin-github 0.1.0 → 0.1.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/README.md +162 -20
- package/client/github-mirror.tsx +10 -4
- package/package.json +2 -2
- package/src/cli.ts +3 -2
- package/src/github-a11y-snapshot.uitest.ts +117 -0
- package/src/github-budget.ts +198 -0
- package/src/github-capabilities.ts +502 -23
- package/src/github-connector.ts +832 -61
- package/src/github-events.ts +11 -1
- package/src/github-git-http.ts +248 -0
- package/src/github-git-plane.ts +511 -0
- package/src/github-graphql.ts +212 -1
- package/src/github-journey.uitest.ts +193 -0
- package/src/github-mirror-state.ts +369 -0
- package/src/github-mirror-ui.ts +53 -372
- package/src/github-server.ts +125 -21
- package/src/github-shared.ts +26 -0
- package/src/github-twin.ts +821 -53
- package/src/github-ui-conformance.ts +2 -2
- package/src/index.ts +71 -5
- package/test-fixtures/github-openapi-operations.json +467 -34
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
//
|
|
5
5
|
// Honesty: `status` is the current truth, kept honest by github-ui-conformance.test.ts,
|
|
6
6
|
// which cross-checks every 'rendered' claim against the actual mirror (the bundled
|
|
7
|
-
// client + the
|
|
7
|
+
// client + the `mirror` store payload). `rendered` = the UI mirror shows it today;
|
|
8
8
|
// `modeled` = the twin has the data but the mirror doesn't render it (a UI gap to
|
|
9
9
|
// close); `unmodeled` = real GitHub shows it but the EVIDENCE twin doesn't model it
|
|
10
10
|
// (a twin-model gap). The github world is an evidence mirror — OBSERVED PRs carry
|
|
@@ -40,7 +40,7 @@ export const GITHUB_UI_INVENTORY: UiSurface[] = [
|
|
|
40
40
|
{ key: 'prUrl', label: 'Link to PR on GitHub', status: 'rendered' },
|
|
41
41
|
{ key: 'issuesList', label: 'Issues list (first-class issues view)', status: 'rendered' },
|
|
42
42
|
{ key: 'repoSelector', label: 'Per-repo selector (repo grouping)', status: 'rendered' },
|
|
43
|
-
// reviewCommentsCount is computed + emitted in
|
|
43
|
+
// reviewCommentsCount is computed + emitted in the mirror store and now rendered in the
|
|
44
44
|
// conversation header alongside reviewCount + commentsCount.
|
|
45
45
|
{ key: 'reviewCommentsCount', label: 'Review-comment (diff-thread) count', status: 'rendered' },
|
|
46
46
|
// CI rollup (commit statuses + check-runs) over the PR head_sha — the twin now models
|
package/src/index.ts
CHANGED
|
@@ -1,23 +1,89 @@
|
|
|
1
1
|
// @volter/twin-github — the GitHub PR-evidence twin (REST), on @volter/twin.
|
|
2
|
-
export { applyGithubWrite, githubState, handleGithubRequest, toGithubComment, toGithubIssue, toGithubRest, toGithubReview, toGithubReviewComment } from './github-twin.ts';
|
|
2
|
+
export { applyGithubWrite, githubState, handleGithubRequest, syncPrHeadsToBranchTip, toGithubComment, toGithubIssue, toGithubRest, toGithubReview, toGithubReviewComment } from './github-twin.ts';
|
|
3
|
+
// The REAL git plane: bare repos under the twin's state dir + the git smart-HTTP protocol
|
|
4
|
+
// (clone/fetch/push by an unmodified `git` CLI), reconciled with the Git Data REST surface.
|
|
5
|
+
export {
|
|
6
|
+
bareRepoDir, ensureBareRepo, hasBareRepo, listGitPlaneRefs, objectExistsInPlane,
|
|
7
|
+
readGitBlobFromPlane, readGitCommitFromPlane, readGitTagFromPlane, readGitTreeFromPlane,
|
|
8
|
+
updateGitRefInPlane, writeGitBlobToPlane, writeGitCommitToPlane, writeGitTagToPlane, writeGitTreeToPlane,
|
|
9
|
+
} from './github-git-plane.ts';
|
|
10
|
+
export { handleGithubGitSmartHttp, parseGitSmartHttpPath, reconcileGitPlaneRefs } from './github-git-http.ts';
|
|
11
|
+
export type { GitSmartHttpResponse, GitSmartHttpRoute } from './github-git-http.ts';
|
|
3
12
|
export type { GithubComment, GithubIssue, GithubPr, GithubResponse, GithubReview, GithubState, GithubWriteEvent, GithubWriteOutcome } from './github-twin.ts';
|
|
4
|
-
export { createGithubTwinServer } from './github-server.ts';
|
|
13
|
+
export { createGithubTwinFetch, createGithubTwinServer } from './github-server.ts';
|
|
5
14
|
export { clearGithubWebhooks, emitGithubEvent, listGithubWebhooks, registerGithubWebhook } from './github-events.ts';
|
|
6
15
|
export type { GithubWebhook, GithubWebhookDelivery } from './github-events.ts';
|
|
7
|
-
|
|
16
|
+
// The mirror is a pure frontend (R3): shell + assets + the mounted adapter. Its state comes
|
|
17
|
+
// from the twin's store door, whose projection lives server-side in github-mirror-state.ts.
|
|
18
|
+
export { buildGithubMirrorClient, createGithubMirrorServer, githubMirrorHtml } from './github-mirror-ui.ts';
|
|
19
|
+
export { githubMirrorState } from './github-mirror-state.ts';
|
|
20
|
+
export { GITHUB_MIRROR_STORE, GITHUB_MIRROR_STORE_PATH, GITHUB_WEB_ORIGIN, githubIssuePath, githubPullPath } from './github-shared.ts';
|
|
8
21
|
export {
|
|
9
22
|
liveGithubExecute, observedPrsToResources, pullGithubPrs, pushGithubAction,
|
|
10
|
-
pushPendingGithubActions, syncGithubFromReal,
|
|
23
|
+
pushGithubToRemote, pushPendingGithubActions, syncGithubFromReal, syncGithubFromRemote,
|
|
11
24
|
} from './github-connector.ts';
|
|
12
|
-
export type { GithubExecute } from './github-connector.ts';
|
|
25
|
+
export type { GithubExecute, LiveGithubOptions } from './github-connector.ts';
|
|
26
|
+
// The client-side rate budget — the fail-closed backstop `liveGithubExecute` routes every live
|
|
27
|
+
// request through. The MECHANISM is the kernel's shared, vendor-agnostic `RateBudget`; what lives
|
|
28
|
+
// here is GitHub's DECLARATION — and uniquely, its weights ARE GitHub's own published point costs
|
|
29
|
+
// (1 for a read, 5 for a write). Exported so an operator can inspect spend (`snapshot`) and so a
|
|
30
|
+
// caller can catch `GithubBudgetError` by type; there is deliberately no export that disables it.
|
|
31
|
+
export {
|
|
32
|
+
GITHUB_BUDGET_BURST_CEILING,
|
|
33
|
+
GITHUB_BUDGET_CEILING,
|
|
34
|
+
GITHUB_BUDGET_MAX_RETRY_AFTER_S,
|
|
35
|
+
GITHUB_BUDGET_WINDOW_MS,
|
|
36
|
+
GITHUB_CALL_WEIGHTS,
|
|
37
|
+
GITHUB_RATE_BUDGET,
|
|
38
|
+
GithubBudget,
|
|
39
|
+
GithubBudgetError,
|
|
40
|
+
githubBudgetPath,
|
|
41
|
+
githubCallWeight,
|
|
42
|
+
} from './github-budget.ts';
|
|
43
|
+
export type { GithubBudgetErrorKind, GithubBudgetOptions, GithubBudgetReservation, GithubBudgetSnapshot } from './github-budget.ts';
|
|
13
44
|
|
|
14
45
|
// Registry descriptor (#1).
|
|
15
46
|
import type { TwinPack } from '@volter/twin';
|
|
47
|
+
import { GITHUB_RATE_BUDGET as RATE_BUDGET } from './github-budget.ts';
|
|
16
48
|
export const pack: TwinPack = {
|
|
17
49
|
vendor: 'github',
|
|
50
|
+
// The SAME object github-budget.ts declares at module load — one source of truth, so registering
|
|
51
|
+
// the pack and importing the connector can never arm two different ceilings.
|
|
52
|
+
rateBudget: RATE_BUDGET,
|
|
53
|
+
pullPosture: 'continuous',
|
|
54
|
+
pullPostureReason:
|
|
55
|
+
"GitHub REST is 5000 req/hour authenticated with X-RateLimit-* headers on every response, so a scheduled sync can measure its own headroom.",
|
|
18
56
|
transport: 'rest',
|
|
57
|
+
archetype: 'engine-control',
|
|
19
58
|
bin: 'world-github',
|
|
20
59
|
resources: ['pull_request', 'pull_request_review', 'pull_request_review_comment', 'issue', 'issue_comment'],
|
|
21
60
|
specSource: 'test-fixtures/github-pull-schema.json (full GitHub OpenAPI PR schema)',
|
|
22
61
|
description: 'GitHub PR-evidence REST twin — writes, webhooks, UI mirror.',
|
|
62
|
+
// Adoption + interception, all in the pack's one home (TWIN-PACK-CONTRACT back-migration
|
|
63
|
+
// 2026-08-31; the eight SDK names, the `@octokit/` scope and the bare `github`/`gh` stems moved
|
|
64
|
+
// off the central maps unchanged). The two canonical Octokit clients plus the official
|
|
65
|
+
// auth/webhook companions — each battery-observed as a repo's ONLY GitHub dep — and the whole
|
|
66
|
+
// `@octokit/` scope so an unlisted satellite still detects. Stems: the bare GITHUB_*/GH_* pair
|
|
67
|
+
// and the credential-var shapes real apps use for their GitHub App / OAuth App connections
|
|
68
|
+
// (BACKEND_GITHUB_*, INF_APP_CONNECTION_GITHUB_APP_*, …_GITHUB_OAUTH_*, …_GITHUB_RADAR_APP_*).
|
|
69
|
+
adoption: {
|
|
70
|
+
// COMMUNITY: GitHub ships no official Python SDK (octokit is JS, go-github is Go), and `PyGithub`
|
|
71
|
+
// is the de-facto Python client of the same REST API.
|
|
72
|
+
pypi: ['pygithub'],
|
|
73
|
+
sdks: [
|
|
74
|
+
'@octokit/rest', '@octokit/core', 'octokit',
|
|
75
|
+
'@octokit/auth-app', '@octokit/auth-oauth-app', '@octokit/auth-oauth-device',
|
|
76
|
+
'@octokit/graphql', '@octokit/webhooks',
|
|
77
|
+
],
|
|
78
|
+
scopes: ['@octokit/'],
|
|
79
|
+
envStems: [
|
|
80
|
+
'GITHUB', 'GH',
|
|
81
|
+
'BACKENDGITHUB', 'INFAPPCONNECTIONGITHUBAPP',
|
|
82
|
+
'INFAPPCONNECTIONGITHUBOAUTH', 'INFAPPCONNECTIONGITHUBRADARAPP',
|
|
83
|
+
// appsmith names its GitHub OAuth app APPSMITH_OAUTH2_GITHUB_CLIENT_ID/_SECRET — the same
|
|
84
|
+
// app-prefixed shape as the INFAPPCONNECTION* stems above (ladder classification 2026-09-02).
|
|
85
|
+
'APPSMITHOAUTH2GITHUB',
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
hosts: [{ host: 'api.github.com' }],
|
|
23
89
|
};
|