webctx 0.2.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.
Files changed (40) hide show
  1. package/AGENTS.md +97 -0
  2. package/CONTRIBUTORS.md +126 -0
  3. package/LICENSE +202 -0
  4. package/Makefile +69 -0
  5. package/README.md +121 -0
  6. package/bin/webctx.js +28 -0
  7. package/cmd/webctx/main.go +11 -0
  8. package/docs/porting-status.md +173 -0
  9. package/go.mod +3 -0
  10. package/internal/app/app.go +139 -0
  11. package/internal/app/app_test.go +194 -0
  12. package/internal/app/github.go +2084 -0
  13. package/internal/app/github_acceptance_test.go +166 -0
  14. package/internal/app/github_actions.go +1008 -0
  15. package/internal/app/github_actions_test.go +484 -0
  16. package/internal/app/github_activity_deployments.go +503 -0
  17. package/internal/app/github_activity_deployments_test.go +321 -0
  18. package/internal/app/github_commits.go +1004 -0
  19. package/internal/app/github_commits_test.go +503 -0
  20. package/internal/app/github_discussions_gists.go +1156 -0
  21. package/internal/app/github_discussions_gists_test.go +425 -0
  22. package/internal/app/github_issues.go +1616 -0
  23. package/internal/app/github_issues_test.go +731 -0
  24. package/internal/app/github_packages_projects.go +429 -0
  25. package/internal/app/github_packages_projects_test.go +168 -0
  26. package/internal/app/github_phase9_overview_stress_test.go +178 -0
  27. package/internal/app/github_pull_views.go +1141 -0
  28. package/internal/app/github_pull_views_test.go +603 -0
  29. package/internal/app/github_pulls.go +1459 -0
  30. package/internal/app/github_pulls_test.go +715 -0
  31. package/internal/app/github_refs.go +621 -0
  32. package/internal/app/github_refs_test.go +260 -0
  33. package/internal/app/github_search_profiles.go +505 -0
  34. package/internal/app/github_search_profiles_test.go +352 -0
  35. package/internal/app/github_test.go +888 -0
  36. package/internal/app/scrape.go +264 -0
  37. package/internal/app/tools.go +670 -0
  38. package/internal/buildinfo/buildinfo.go +16 -0
  39. package/package.json +66 -0
  40. package/scripts/postinstall.js +137 -0
@@ -0,0 +1,166 @@
1
+ package app
2
+
3
+ import "testing"
4
+
5
+ type githubTargetContractAudit struct {
6
+ kind GitHubTargetKind
7
+ class string
8
+ contract string
9
+ }
10
+
11
+ func TestFinalGitHubTargetContractAuditCoversEveryNativeKind(t *testing.T) {
12
+ audits := []githubTargetContractAudit{
13
+ {GitHubTargetRepository, "overview", "repository metadata + bounded README preview"},
14
+ {GitHubTargetBlob, "exact", "selected file; optional copied line selector"},
15
+ {GitHubTargetTree, "overview", "bounded one-level directory index + README preview"},
16
+ {GitHubTargetIssue, "overview/exact", "adaptive Issue root; #issue-* / #issuecomment-* exact"},
17
+ {GitHubTargetIssueList, "overview", "single provider page with copied page navigation"},
18
+ {GitHubTargetPullList, "overview", "single provider page with copied page navigation"},
19
+ {GitHubTargetLabel, "overview", "selected label metadata + one Issue page"},
20
+ {GitHubTargetLabelList, "overview", "single provider label page"},
21
+ {GitHubTargetMilestone, "overview", "selected milestone metadata + one Issue page"},
22
+ {GitHubTargetMilestones, "overview", "single provider milestone page"},
23
+ {GitHubTargetPull, "overview/exact", "bounded PR root; copied body/comment/review/thread selectors exact"},
24
+ {GitHubTargetPullFiles, "overview/exact", "bounded files root; copied diff file/hunk selector exact"},
25
+ {GitHubTargetPullCommits, "overview", "bounded commit index; provider endpoint ceiling retained"},
26
+ {GitHubTargetPullChecks, "overview/exact", "bounded checks rollup; ?check_run_id exact machine detail"},
27
+ {GitHubTargetPullDiff, "raw", "explicit complete PR diff"},
28
+ {GitHubTargetPullPatch, "raw", "explicit complete PR patch"},
29
+ {GitHubTargetCommit, "overview/exact", "bounded commit root; diff/comment selector exact"},
30
+ {GitHubTargetCommitDiff, "raw", "explicit complete commit diff"},
31
+ {GitHubTargetCommitPatch, "raw", "explicit complete commit patch"},
32
+ {GitHubTargetCompare, "overview", "bounded compare metadata/index with provider ceiling truth"},
33
+ {GitHubTargetCompareDiff, "raw", "explicit complete compare diff"},
34
+ {GitHubTargetComparePatch, "raw", "explicit complete compare patch"},
35
+ {GitHubTargetHistory, "overview", "one 30-commit provider page"},
36
+ {GitHubTargetBlame, "exact", "selected file blame ranges"},
37
+ {GitHubTargetActions, "overview", "bounded workflows/recent-runs landing"},
38
+ {GitHubTargetWorkflows, "overview", "one workflow provider page"},
39
+ {GitHubTargetWorkflow, "overview", "workflow metadata + one run page"},
40
+ {GitHubTargetActionsRun, "overview", "bounded job/artifact rollup with exact job URLs"},
41
+ {GitHubTargetActionsJob, "exact", "selected structured job + bounded log preview"},
42
+ {GitHubTargetBranches, "overview", "single bounded provider page"},
43
+ {GitHubTargetTags, "overview", "single bounded provider page"},
44
+ {GitHubTargetReleases, "overview", "single bounded provider page"},
45
+ {GitHubTargetRelease, "overview", "bounded release notes + first asset page"},
46
+ {GitHubTargetReleaseLatest, "overview", "bounded latest release notes + first asset page"},
47
+ {GitHubTargetForks, "overview", "single bounded provider page"},
48
+ {GitHubTargetStargazers, "overview", "single bounded provider page"},
49
+ {GitHubTargetWatchers, "overview", "single bounded provider page"},
50
+ {GitHubTargetDiscussions, "overview", "first 30 GraphQL Discussions with upstream cursor truth"},
51
+ {GitHubTargetDiscussion, "overview/exact", "bounded root; #discussioncomment-* exact"},
52
+ {GitHubTargetGist, "overview/exact", "bounded root; #file-* / #gistcomment-* exact"},
53
+ {GitHubTargetSearch, "overview", "one 30-result provider page + provider ceiling truth"},
54
+ {GitHubTargetProfile, "overview", "profile metadata or one selected profile-tab page"},
55
+ {GitHubTargetActivity, "overview", "one 30-item activity provider page"},
56
+ {GitHubTargetStatsContributors, "overview", "bounded contributor ranking from provider aggregate"},
57
+ {GitHubTargetStatsCommitActivity, "overview", "provider-defined last-year weekly aggregate"},
58
+ {GitHubTargetStatsCodeFrequency, "overview", "full aggregates + recent 52-week index"},
59
+ {GitHubTargetDeployments, "overview", "one deployment provider page; no status fan-out"},
60
+ {GitHubTargetDeploymentEnvironment, "overview", "bounded deployments + latest returned status each"},
61
+ {GitHubTargetPackage, "overview", "package metadata + one version provider page"},
62
+ {GitHubTargetProjectV2, "overview", "project metadata + first bounded item page"},
63
+ }
64
+
65
+ if len(audits) != 50 {
66
+ t.Fatalf("GitHub target contract audit has %d entries, want 50 current native kinds", len(audits))
67
+ }
68
+ seen := map[GitHubTargetKind]bool{}
69
+ for _, audit := range audits {
70
+ if seen[audit.kind] {
71
+ t.Fatalf("GitHub target contract audit duplicates %q", audit.kind)
72
+ }
73
+ seen[audit.kind] = true
74
+ t.Logf("%-24s %-14s %s", audit.kind, audit.class, audit.contract)
75
+ }
76
+ for _, kind := range []GitHubTargetKind{
77
+ GitHubTargetRepository, GitHubTargetBlob, GitHubTargetTree, GitHubTargetIssue, GitHubTargetIssueList,
78
+ GitHubTargetPullList, GitHubTargetLabel, GitHubTargetLabelList, GitHubTargetMilestone, GitHubTargetMilestones,
79
+ GitHubTargetPull, GitHubTargetPullFiles, GitHubTargetPullCommits, GitHubTargetPullChecks, GitHubTargetPullDiff,
80
+ GitHubTargetPullPatch, GitHubTargetCommit, GitHubTargetCommitDiff, GitHubTargetCommitPatch, GitHubTargetCompare,
81
+ GitHubTargetCompareDiff, GitHubTargetComparePatch, GitHubTargetHistory, GitHubTargetBlame, GitHubTargetActions,
82
+ GitHubTargetWorkflows, GitHubTargetWorkflow, GitHubTargetActionsRun, GitHubTargetActionsJob, GitHubTargetBranches,
83
+ GitHubTargetTags, GitHubTargetReleases, GitHubTargetRelease, GitHubTargetReleaseLatest, GitHubTargetForks,
84
+ GitHubTargetStargazers, GitHubTargetWatchers, GitHubTargetDiscussions, GitHubTargetDiscussion, GitHubTargetGist,
85
+ GitHubTargetSearch, GitHubTargetProfile, GitHubTargetActivity, GitHubTargetStatsContributors, GitHubTargetStatsCommitActivity,
86
+ GitHubTargetStatsCodeFrequency, GitHubTargetDeployments, GitHubTargetDeploymentEnvironment, GitHubTargetPackage, GitHubTargetProjectV2,
87
+ } {
88
+ if !seen[kind] {
89
+ t.Fatalf("GitHub target contract audit omitted %q", kind)
90
+ }
91
+ }
92
+ }
93
+
94
+ func TestFinalRouteFidelityDoesNotClaimGlobalGitHubNamespaces(t *testing.T) {
95
+ for _, raw := range []string{
96
+ "https://github.com/settings/profile",
97
+ "https://github.com/settings/security",
98
+ "https://github.com/organizations/plan",
99
+ "https://github.com/codespaces/new",
100
+ "https://github.com/marketplace/actions",
101
+ "https://github.com/security/advisories",
102
+ "https://github.com/sponsors/explore",
103
+ "https://github.com/notifications/subscriptions",
104
+ } {
105
+ if target := parseGitHubTarget(raw); target != nil {
106
+ t.Fatalf("global GitHub namespace must stay outside native repository/profile routing: %s => %#v", raw, target)
107
+ }
108
+ }
109
+ }
110
+
111
+ func TestFinalRouteFidelityKeepsExcludedRepositorySurfacesGeneric(t *testing.T) {
112
+ for _, raw := range []string{
113
+ "https://github.com/o/r/wiki",
114
+ "https://github.com/o/r/settings",
115
+ "https://github.com/o/r/settings/actions",
116
+ "https://github.com/o/r/security",
117
+ "https://github.com/o/r/security/code-scanning",
118
+ "https://github.com/o/r/network/members",
119
+ "https://github.com/o/r/community",
120
+ "https://github.com/o/r/graphs/traffic",
121
+ "https://github.com/o/r/archive/refs/heads/main.zip",
122
+ "https://github.com/o/r/releases/download/v1/binary.zip",
123
+ "https://github.com/o/r/issues/new",
124
+ } {
125
+ if target := parseGitHubTarget(raw); target != nil {
126
+ t.Fatalf("excluded/unproven repository surface must stay generic: %s => %#v", raw, target)
127
+ }
128
+ }
129
+ }
130
+
131
+ func TestFinalNativeRouteCoverageRepresentativeMatrix(t *testing.T) {
132
+ for _, raw := range []string{
133
+ "https://github.com/o/r",
134
+ "https://github.com/o/r/blob/main/README.md#L1-L2",
135
+ "https://github.com/o/r/tree/main/docs",
136
+ "https://github.com/o/r/issues/1",
137
+ "https://github.com/o/r/pulls",
138
+ "https://github.com/o/r/pull/1",
139
+ "https://github.com/o/r/pull/1/files",
140
+ "https://github.com/o/r/commit/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
141
+ "https://github.com/o/r/compare/main...next",
142
+ "https://github.com/o/r/commits/main/README.md",
143
+ "https://github.com/o/r/blame/main/README.md",
144
+ "https://github.com/o/r/actions",
145
+ "https://github.com/o/r/actions/runs/1/job/2",
146
+ "https://github.com/o/r/branches",
147
+ "https://github.com/o/r/tags",
148
+ "https://github.com/o/r/releases",
149
+ "https://github.com/o/r/forks",
150
+ "https://github.com/o/r/stargazers",
151
+ "https://github.com/o/r/watchers",
152
+ "https://github.com/o/r/discussions/1",
153
+ "https://gist.github.com/alice/abcdef#file-readme-md-L1-L2",
154
+ "https://github.com/search?q=webctx&type=repositories",
155
+ "https://github.com/octocat",
156
+ "https://github.com/o/r/activity",
157
+ "https://github.com/o/r/graphs/contributors",
158
+ "https://github.com/o/r/deployments/production",
159
+ "https://github.com/orgs/acme/packages/container/package/widget",
160
+ "https://github.com/orgs/acme/projects/7",
161
+ } {
162
+ if target := parseGitHubTarget(raw); target == nil {
163
+ t.Fatalf("representative native route unexpectedly unsupported: %s", raw)
164
+ }
165
+ }
166
+ }