oh-my-opencode 5.1.83 → 5.1.86
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/.agents/command/remove-deadcode.md +1 -1
- package/.agents/skills/remove-deadcode/SKILL.md +1 -1
- package/.agents/skills/work-with-pr/SKILL.md +2 -2
- package/.opencode/command/remove-deadcode.md +1 -1
- package/.opencode/skills/work-with-pr/SKILL.md +2 -2
- package/THIRD-PARTY-NOTICES.md +9 -3
- package/dist/cli/cli-program.d.ts +3 -0
- package/dist/cli/index.js +1197 -1008
- package/dist/cli/service-auth/devices.d.ts +5 -2
- package/dist/cli-node/index.js +1197 -1008
- package/dist/config/schema/agent-names.d.ts +1 -0
- package/dist/index.js +194 -213
- package/dist/skills/browser/SKILL.md +100 -91
- package/dist/skills/browser/references/commands.md +92 -27
- package/dist/skills/browser/references/desktop.md +22 -0
- package/dist/skills/browser/references/install.md +18 -0
- package/dist/skills/browser/references/owned-engine/README.md +7 -2
- package/dist/skills/browser/references/owned-engine/frames-and-humans.md +9 -2
- package/dist/skills/browser/references/owned-engine/network.md +13 -7
- package/dist/skills/browser/references/recipes/1password.md +6 -2
- package/dist/skills/browser/runtime/omowright/index.js +15 -15
- package/dist/skills/browser/runtime/omowright/manifest.json +4 -4
- package/dist/skills/debugging/SKILL.md +1 -1
- package/dist/skills/debugging/references/tools/browser-qa.md +1 -1
- package/dist/skills/git/SKILL.md +62 -0
- package/dist/skills/git/agents/openai.yaml +13 -0
- package/dist/skills/github/SKILL.md +94 -0
- package/dist/skills/github/references/branch-rules.md +129 -0
- package/dist/skills/github/references/evidence-attachments.md +16 -0
- package/dist/skills/github/references/repo-setup.md +152 -0
- package/dist/skills/github/references/waiting.md +52 -0
- package/dist/skills/github/references/workflows.md +161 -0
- package/dist/skills/github/scripts/cli.ts +8 -0
- package/dist/skills/github/scripts/package.json +12 -0
- package/dist/skills/github/scripts/sdk.ts +11 -0
- package/dist/skills/github/scripts/src/account.ts +243 -0
- package/dist/skills/github/scripts/src/actions-write.ts +86 -0
- package/dist/skills/github/scripts/src/actions.ts +210 -0
- package/dist/skills/github/scripts/src/attestations.ts +136 -0
- package/dist/skills/github/scripts/src/blake2b.ts +102 -0
- package/dist/skills/github/scripts/src/branch-protection.ts +192 -0
- package/dist/skills/github/scripts/src/caches.ts +105 -0
- package/dist/skills/github/scripts/src/checks.ts +107 -0
- package/dist/skills/github/scripts/src/codespaces.ts +230 -0
- package/dist/skills/github/scripts/src/conversation-lock.ts +50 -0
- package/dist/skills/github/scripts/src/discussion-list.ts +126 -0
- package/dist/skills/github/scripts/src/discussion-lookup.ts +127 -0
- package/dist/skills/github/scripts/src/discussions.ts +234 -0
- package/dist/skills/github/scripts/src/env.ts +100 -0
- package/dist/skills/github/scripts/src/errors.ts +79 -0
- package/dist/skills/github/scripts/src/fields.ts +27 -0
- package/dist/skills/github/scripts/src/gist-shape.ts +58 -0
- package/dist/skills/github/scripts/src/gists-write.ts +130 -0
- package/dist/skills/github/scripts/src/gists.ts +118 -0
- package/dist/skills/github/scripts/src/git-auth.ts +46 -0
- package/dist/skills/github/scripts/src/http.ts +159 -0
- package/dist/skills/github/scripts/src/issue-develop.ts +118 -0
- package/dist/skills/github/scripts/src/issues-extra.ts +135 -0
- package/dist/skills/github/scripts/src/issues-write.ts +174 -0
- package/dist/skills/github/scripts/src/issues.ts +156 -0
- package/dist/skills/github/scripts/src/keys.ts +176 -0
- package/dist/skills/github/scripts/src/labels.ts +209 -0
- package/dist/skills/github/scripts/src/merge.ts +115 -0
- package/dist/skills/github/scripts/src/poly1305.ts +22 -0
- package/dist/skills/github/scripts/src/pr-checkout.ts +92 -0
- package/dist/skills/github/scripts/src/pr-view.ts +106 -0
- package/dist/skills/github/scripts/src/project-fields.ts +144 -0
- package/dist/skills/github/scripts/src/project-item-edit.ts +153 -0
- package/dist/skills/github/scripts/src/project-items.ts +191 -0
- package/dist/skills/github/scripts/src/project-links.ts +104 -0
- package/dist/skills/github/scripts/src/project-ref.ts +145 -0
- package/dist/skills/github/scripts/src/project-state.ts +99 -0
- package/dist/skills/github/scripts/src/projects.ts +158 -0
- package/dist/skills/github/scripts/src/pulls-extra.ts +165 -0
- package/dist/skills/github/scripts/src/pulls-read.ts +176 -0
- package/dist/skills/github/scripts/src/pulls-review.ts +206 -0
- package/dist/skills/github/scripts/src/pulls-write.ts +187 -0
- package/dist/skills/github/scripts/src/raw.ts +78 -0
- package/dist/skills/github/scripts/src/read.ts +77 -0
- package/dist/skills/github/scripts/src/release-assets.ts +111 -0
- package/dist/skills/github/scripts/src/release-download.ts +151 -0
- package/dist/skills/github/scripts/src/release-write.ts +197 -0
- package/dist/skills/github/scripts/src/repo-admin.ts +112 -0
- package/dist/skills/github/scripts/src/repo-content.ts +187 -0
- package/dist/skills/github/scripts/src/repo-create.ts +139 -0
- package/dist/skills/github/scripts/src/repo-extras.ts +217 -0
- package/dist/skills/github/scripts/src/repo-list.ts +143 -0
- package/dist/skills/github/scripts/src/repo-settings.ts +176 -0
- package/dist/skills/github/scripts/src/repo-sync.ts +81 -0
- package/dist/skills/github/scripts/src/repo-url.ts +104 -0
- package/dist/skills/github/scripts/src/repos.ts +87 -0
- package/dist/skills/github/scripts/src/ruleset-shape.ts +96 -0
- package/dist/skills/github/scripts/src/rulesets-write.ts +124 -0
- package/dist/skills/github/scripts/src/rulesets.ts +80 -0
- package/dist/skills/github/scripts/src/run-download.ts +88 -0
- package/dist/skills/github/scripts/src/salsa20.ts +97 -0
- package/dist/skills/github/scripts/src/scopes.ts +165 -0
- package/dist/skills/github/scripts/src/sealed-box.ts +75 -0
- package/dist/skills/github/scripts/src/search-commits.ts +114 -0
- package/dist/skills/github/scripts/src/search.ts +116 -0
- package/dist/skills/github/scripts/src/secrets.ts +131 -0
- package/dist/skills/github/scripts/src/snappy.ts +57 -0
- package/dist/skills/github/scripts/src/status-search.ts +55 -0
- package/dist/skills/github/scripts/src/transfer.ts +97 -0
- package/dist/skills/github/scripts/src/types.ts +75 -0
- package/dist/skills/github/scripts/src/variables.ts +86 -0
- package/dist/skills/github/scripts/src/wait.ts +164 -0
- package/dist/skills/github/scripts/src/wire.ts +159 -0
- package/dist/skills/github/scripts/src/workflows.ts +144 -0
- package/dist/skills/github/scripts/src/zip.ts +104 -0
- package/dist/skills/github/scripts/surface.ts +106 -0
- package/dist/skills/github/scripts/vendor/surface/SOURCE.json +15 -0
- package/dist/skills/github/scripts/vendor/surface/cli.ts +203 -0
- package/dist/skills/github/scripts/vendor/surface/flags.ts +195 -0
- package/dist/skills/github/scripts/vendor/surface/help.ts +89 -0
- package/dist/skills/github/scripts/vendor/surface/http.ts +180 -0
- package/dist/skills/github/scripts/vendor/surface/index.ts +44 -0
- package/dist/skills/github/scripts/vendor/surface/mcp.ts +241 -0
- package/dist/skills/github/scripts/vendor/surface/schema.ts +200 -0
- package/dist/skills/github/scripts/vendor/surface/stdio.ts +54 -0
- package/dist/skills/github/scripts/vendor/surface/surface.ts +250 -0
- package/dist/skills/github/scripts/vendor/surface/tools.ts +80 -0
- package/dist/skills/programming/SKILL.md +51 -320
- package/dist/skills/programming/references/go/README.md +1 -0
- package/dist/skills/programming/references/python/README.md +21 -3
- package/dist/skills/programming/references/python/error-handling.md +14 -0
- package/dist/skills/programming/references/rust/README.md +5 -1
- package/dist/skills/programming/references/typescript/README.md +9 -3
- package/dist/skills/programming/references/typescript/error-handling.md +18 -0
- package/dist/skills/ultimate-browsing/SKILL.md +1 -1
- package/dist/skills/ulw-execute/SKILL.md +1 -1
- package/dist/skills/visual-qa/references/browser-setup.md +5 -5
- package/dist/tui.js +32 -29
- package/package.json +28 -26
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/dist/cli.js +2 -2
- package/packages/omo-codex/plugin/components/bootstrap/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/bootstrap/package.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/comment-checker/package.json +1 -1
- package/packages/omo-codex/plugin/components/git-bash/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/git-bash/package.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/lazycodex-executor-verify/package.json +1 -1
- package/packages/omo-codex/plugin/components/lsp/dist/.omo-runtime-manifest.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/hooks/hooks.json +2 -2
- package/packages/omo-codex/plugin/components/lsp/package.json +1 -1
- package/packages/omo-codex/plugin/components/rules/hooks/hooks.json +4 -4
- package/packages/omo-codex/plugin/components/rules/package.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/teammode/package.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/dist/cli.js +8711 -172
- package/packages/omo-codex/plugin/components/telemetry/dist/posthog.js +8660 -121
- package/packages/omo-codex/plugin/components/telemetry/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/src/posthog.ts +5 -0
- package/packages/omo-codex/plugin/components/telemetry/tsconfig.json +2 -2
- package/packages/omo-codex/plugin/components/ultrawork/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ultrawork/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-execute-continuation/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/hooks/hooks.json +5 -5
- package/packages/omo-codex/plugin/components/ulw-loop/package.json +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/SKILL.md +1 -1
- package/packages/omo-codex/plugin/components/ulw-loop/skills/ulw-loop/references/full-workflow.md +3 -3
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-git-bash-mcp-reminder.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-lsp-diagnostics-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-compact-resetting-project-rule-cache.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-comments.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-lsp-diagnostics.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-checking-thread-title-hygiene.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-matching-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/post-tool-use-recording-spawn-admission.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-enforcing-unlimited-goal-budget.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-guarding-ulw-loop-spawns.json +1 -1
- package/packages/omo-codex/plugin/hooks/pre-tool-use-recommending-git-bash-mcp.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-auto-update.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-checking-bootstrap-provisioning.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/hooks/session-start-recording-session-telemetry.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-execute-continuation.json +1 -1
- package/packages/omo-codex/plugin/hooks/stop-checking-ulw-loop-resume.json +1 -1
- package/packages/omo-codex/plugin/hooks/subagent-stop-verifying-lazycodex-executor-evidence.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ultrawork-trigger.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-checking-ulw-loop-steering.json +1 -1
- package/packages/omo-codex/plugin/hooks/user-prompt-submit-loading-project-rules.json +1 -1
- package/packages/omo-codex/plugin/package-lock.json +12 -12
- package/packages/omo-codex/plugin/package.json +1 -1
- package/packages/omo-codex/plugin/shared/src/config-loader.ts +15 -1
- package/packages/omo-codex/plugin/skills/browser/SKILL.md +100 -91
- package/packages/omo-codex/plugin/skills/browser/references/commands.md +92 -27
- package/packages/omo-codex/plugin/skills/browser/references/desktop.md +22 -0
- package/packages/omo-codex/plugin/skills/browser/references/install.md +18 -0
- package/packages/omo-codex/plugin/skills/browser/references/owned-engine/README.md +7 -2
- package/packages/omo-codex/plugin/skills/browser/references/owned-engine/frames-and-humans.md +9 -2
- package/packages/omo-codex/plugin/skills/browser/references/owned-engine/network.md +13 -7
- package/packages/omo-codex/plugin/skills/browser/references/recipes/1password.md +6 -2
- package/packages/omo-codex/plugin/skills/browser/runtime/omowright/index.js +15 -15
- package/packages/omo-codex/plugin/skills/browser/runtime/omowright/manifest.json +4 -4
- package/packages/omo-codex/plugin/skills/debugging/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/debugging/references/tools/browser-qa.md +1 -1
- package/packages/omo-codex/plugin/skills/git/SKILL.md +62 -0
- package/packages/omo-codex/plugin/skills/git/agents/openai.yaml +13 -0
- package/packages/omo-codex/plugin/skills/github/SKILL.md +94 -0
- package/packages/omo-codex/plugin/skills/github/agents/openai.yaml +2 -0
- package/packages/omo-codex/plugin/skills/github/references/branch-rules.md +129 -0
- package/packages/omo-codex/plugin/skills/github/references/evidence-attachments.md +16 -0
- package/packages/omo-codex/plugin/skills/github/references/repo-setup.md +152 -0
- package/packages/omo-codex/plugin/skills/github/references/waiting.md +52 -0
- package/packages/omo-codex/plugin/skills/github/references/workflows.md +161 -0
- package/packages/omo-codex/plugin/skills/github/scripts/cli.ts +8 -0
- package/packages/omo-codex/plugin/skills/github/scripts/package.json +12 -0
- package/packages/omo-codex/plugin/skills/github/scripts/sdk.ts +11 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/account.ts +243 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/actions-write.ts +86 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/actions.ts +210 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/attestations.ts +136 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/blake2b.ts +102 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/branch-protection.ts +192 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/caches.ts +105 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/checks.ts +107 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/codespaces.ts +230 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/conversation-lock.ts +50 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/discussion-list.ts +126 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/discussion-lookup.ts +127 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/discussions.ts +234 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/env.ts +100 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/errors.ts +79 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/fields.ts +27 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/gist-shape.ts +58 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/gists-write.ts +130 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/gists.ts +118 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/git-auth.ts +46 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/http.ts +159 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/issue-develop.ts +118 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/issues-extra.ts +135 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/issues-write.ts +174 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/issues.ts +156 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/keys.ts +176 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/labels.ts +209 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/merge.ts +115 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/poly1305.ts +22 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/pr-checkout.ts +92 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/pr-view.ts +106 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/project-fields.ts +144 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/project-item-edit.ts +153 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/project-items.ts +191 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/project-links.ts +104 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/project-ref.ts +145 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/project-state.ts +99 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/projects.ts +158 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/pulls-extra.ts +165 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/pulls-read.ts +176 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/pulls-review.ts +206 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/pulls-write.ts +187 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/raw.ts +78 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/read.ts +77 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/release-assets.ts +111 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/release-download.ts +151 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/release-write.ts +197 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/repo-admin.ts +112 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/repo-content.ts +187 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/repo-create.ts +139 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/repo-extras.ts +217 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/repo-list.ts +143 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/repo-settings.ts +176 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/repo-sync.ts +81 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/repo-url.ts +104 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/repos.ts +87 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/ruleset-shape.ts +96 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/rulesets-write.ts +124 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/rulesets.ts +80 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/run-download.ts +88 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/salsa20.ts +97 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/scopes.ts +165 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/sealed-box.ts +75 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/search-commits.ts +114 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/search.ts +116 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/secrets.ts +131 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/snappy.ts +57 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/status-search.ts +55 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/transfer.ts +97 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/types.ts +75 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/variables.ts +86 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/wait.ts +164 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/wire.ts +159 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/workflows.ts +144 -0
- package/packages/omo-codex/plugin/skills/github/scripts/src/zip.ts +104 -0
- package/packages/omo-codex/plugin/skills/github/scripts/surface.ts +106 -0
- package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/SOURCE.json +15 -0
- package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/cli.ts +203 -0
- package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/flags.ts +195 -0
- package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/help.ts +89 -0
- package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/http.ts +180 -0
- package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/index.ts +44 -0
- package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/mcp.ts +241 -0
- package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/schema.ts +200 -0
- package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/stdio.ts +54 -0
- package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/surface.ts +250 -0
- package/packages/omo-codex/plugin/skills/github/scripts/vendor/surface/tools.ts +80 -0
- package/packages/omo-codex/plugin/skills/programming/SKILL.md +51 -320
- package/packages/omo-codex/plugin/skills/programming/references/go/README.md +1 -0
- package/packages/omo-codex/plugin/skills/programming/references/python/README.md +21 -3
- package/packages/omo-codex/plugin/skills/programming/references/python/error-handling.md +14 -0
- package/packages/omo-codex/plugin/skills/programming/references/rust/README.md +5 -1
- package/packages/omo-codex/plugin/skills/programming/references/typescript/README.md +9 -3
- package/packages/omo-codex/plugin/skills/programming/references/typescript/error-handling.md +18 -0
- package/packages/omo-codex/plugin/skills/ultimate-browsing/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/ulw-execute/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/ulw-loop/SKILL.md +1 -1
- package/packages/omo-codex/plugin/skills/ulw-loop/references/full-workflow.md +3 -3
- package/packages/omo-codex/plugin/skills/visual-qa/references/browser-setup.md +5 -5
- package/packages/omo-codex/plugin/test/sync-skills-codex-compatibility.test.mjs +1 -1
- package/packages/omo-codex/plugin/test/sync-skills-test-support.mjs +2 -1
- package/packages/omo-codex/plugin/test/sync-skills.test.mjs +5 -5
- package/packages/omo-codex/scripts/install-dist/install-local.mjs +21279 -20738
- package/packages/shared-skills/skills/browser/SKILL.md +100 -91
- package/packages/shared-skills/skills/browser/references/commands.md +92 -27
- package/packages/shared-skills/skills/browser/references/desktop.md +22 -0
- package/packages/shared-skills/skills/browser/references/install.md +18 -0
- package/packages/shared-skills/skills/browser/references/owned-engine/README.md +7 -2
- package/packages/shared-skills/skills/browser/references/owned-engine/frames-and-humans.md +9 -2
- package/packages/shared-skills/skills/browser/references/owned-engine/network.md +13 -7
- package/packages/shared-skills/skills/browser/references/recipes/1password.md +6 -2
- package/packages/shared-skills/skills/browser/runtime/omowright/index.js +15 -15
- package/packages/shared-skills/skills/browser/runtime/omowright/manifest.json +4 -4
- package/packages/shared-skills/skills/debugging/SKILL.md +1 -1
- package/packages/shared-skills/skills/debugging/references/tools/browser-qa.md +1 -1
- package/packages/shared-skills/skills/git/SKILL.md +62 -0
- package/packages/shared-skills/skills/git/agents/openai.yaml +13 -0
- package/packages/shared-skills/skills/github/SKILL.md +94 -0
- package/packages/shared-skills/skills/github/references/branch-rules.md +129 -0
- package/packages/shared-skills/skills/github/references/evidence-attachments.md +16 -0
- package/packages/shared-skills/skills/github/references/repo-setup.md +152 -0
- package/packages/shared-skills/skills/github/references/waiting.md +52 -0
- package/packages/shared-skills/skills/github/references/workflows.md +161 -0
- package/packages/shared-skills/skills/github/scripts/cli.ts +8 -0
- package/packages/shared-skills/skills/github/scripts/package.json +12 -0
- package/packages/shared-skills/skills/github/scripts/sdk.ts +11 -0
- package/packages/shared-skills/skills/github/scripts/src/account.ts +243 -0
- package/packages/shared-skills/skills/github/scripts/src/actions-write.ts +86 -0
- package/packages/shared-skills/skills/github/scripts/src/actions.ts +210 -0
- package/packages/shared-skills/skills/github/scripts/src/attestations.ts +136 -0
- package/packages/shared-skills/skills/github/scripts/src/blake2b.ts +102 -0
- package/packages/shared-skills/skills/github/scripts/src/branch-protection.ts +192 -0
- package/packages/shared-skills/skills/github/scripts/src/caches.ts +105 -0
- package/packages/shared-skills/skills/github/scripts/src/checks.ts +107 -0
- package/packages/shared-skills/skills/github/scripts/src/codespaces.ts +230 -0
- package/packages/shared-skills/skills/github/scripts/src/conversation-lock.ts +50 -0
- package/packages/shared-skills/skills/github/scripts/src/discussion-list.ts +126 -0
- package/packages/shared-skills/skills/github/scripts/src/discussion-lookup.ts +127 -0
- package/packages/shared-skills/skills/github/scripts/src/discussions.ts +234 -0
- package/packages/shared-skills/skills/github/scripts/src/env.ts +100 -0
- package/packages/shared-skills/skills/github/scripts/src/errors.ts +79 -0
- package/packages/shared-skills/skills/github/scripts/src/fields.ts +27 -0
- package/packages/shared-skills/skills/github/scripts/src/gist-shape.ts +58 -0
- package/packages/shared-skills/skills/github/scripts/src/gists-write.ts +130 -0
- package/packages/shared-skills/skills/github/scripts/src/gists.ts +118 -0
- package/packages/shared-skills/skills/github/scripts/src/git-auth.ts +46 -0
- package/packages/shared-skills/skills/github/scripts/src/http.ts +159 -0
- package/packages/shared-skills/skills/github/scripts/src/issue-develop.ts +118 -0
- package/packages/shared-skills/skills/github/scripts/src/issues-extra.ts +135 -0
- package/packages/shared-skills/skills/github/scripts/src/issues-write.ts +174 -0
- package/packages/shared-skills/skills/github/scripts/src/issues.ts +156 -0
- package/packages/shared-skills/skills/github/scripts/src/keys.ts +176 -0
- package/packages/shared-skills/skills/github/scripts/src/labels.ts +209 -0
- package/packages/shared-skills/skills/github/scripts/src/merge.ts +115 -0
- package/packages/shared-skills/skills/github/scripts/src/poly1305.ts +22 -0
- package/packages/shared-skills/skills/github/scripts/src/pr-checkout.ts +92 -0
- package/packages/shared-skills/skills/github/scripts/src/pr-view.ts +106 -0
- package/packages/shared-skills/skills/github/scripts/src/project-fields.ts +144 -0
- package/packages/shared-skills/skills/github/scripts/src/project-item-edit.ts +153 -0
- package/packages/shared-skills/skills/github/scripts/src/project-items.ts +191 -0
- package/packages/shared-skills/skills/github/scripts/src/project-links.ts +104 -0
- package/packages/shared-skills/skills/github/scripts/src/project-ref.ts +145 -0
- package/packages/shared-skills/skills/github/scripts/src/project-state.ts +99 -0
- package/packages/shared-skills/skills/github/scripts/src/projects.ts +158 -0
- package/packages/shared-skills/skills/github/scripts/src/pulls-extra.ts +165 -0
- package/packages/shared-skills/skills/github/scripts/src/pulls-read.ts +176 -0
- package/packages/shared-skills/skills/github/scripts/src/pulls-review.ts +206 -0
- package/packages/shared-skills/skills/github/scripts/src/pulls-write.ts +187 -0
- package/packages/shared-skills/skills/github/scripts/src/raw.ts +78 -0
- package/packages/shared-skills/skills/github/scripts/src/read.ts +77 -0
- package/packages/shared-skills/skills/github/scripts/src/release-assets.ts +111 -0
- package/packages/shared-skills/skills/github/scripts/src/release-download.ts +151 -0
- package/packages/shared-skills/skills/github/scripts/src/release-write.ts +197 -0
- package/packages/shared-skills/skills/github/scripts/src/repo-admin.ts +112 -0
- package/packages/shared-skills/skills/github/scripts/src/repo-content.ts +187 -0
- package/packages/shared-skills/skills/github/scripts/src/repo-create.ts +139 -0
- package/packages/shared-skills/skills/github/scripts/src/repo-extras.ts +217 -0
- package/packages/shared-skills/skills/github/scripts/src/repo-list.ts +143 -0
- package/packages/shared-skills/skills/github/scripts/src/repo-settings.ts +176 -0
- package/packages/shared-skills/skills/github/scripts/src/repo-sync.ts +81 -0
- package/packages/shared-skills/skills/github/scripts/src/repo-url.ts +104 -0
- package/packages/shared-skills/skills/github/scripts/src/repos.ts +87 -0
- package/packages/shared-skills/skills/github/scripts/src/ruleset-shape.ts +96 -0
- package/packages/shared-skills/skills/github/scripts/src/rulesets-write.ts +124 -0
- package/packages/shared-skills/skills/github/scripts/src/rulesets.ts +80 -0
- package/packages/shared-skills/skills/github/scripts/src/run-download.ts +88 -0
- package/packages/shared-skills/skills/github/scripts/src/salsa20.ts +97 -0
- package/packages/shared-skills/skills/github/scripts/src/scopes.ts +165 -0
- package/packages/shared-skills/skills/github/scripts/src/sealed-box.ts +75 -0
- package/packages/shared-skills/skills/github/scripts/src/search-commits.ts +114 -0
- package/packages/shared-skills/skills/github/scripts/src/search.ts +116 -0
- package/packages/shared-skills/skills/github/scripts/src/secrets.ts +131 -0
- package/packages/shared-skills/skills/github/scripts/src/snappy.ts +57 -0
- package/packages/shared-skills/skills/github/scripts/src/status-search.ts +55 -0
- package/packages/shared-skills/skills/github/scripts/src/transfer.ts +97 -0
- package/packages/shared-skills/skills/github/scripts/src/types.ts +75 -0
- package/packages/shared-skills/skills/github/scripts/src/variables.ts +86 -0
- package/packages/shared-skills/skills/github/scripts/src/wait.ts +164 -0
- package/packages/shared-skills/skills/github/scripts/src/wire.ts +159 -0
- package/packages/shared-skills/skills/github/scripts/src/workflows.ts +144 -0
- package/packages/shared-skills/skills/github/scripts/src/zip.ts +104 -0
- package/packages/shared-skills/skills/github/scripts/surface.ts +106 -0
- package/packages/shared-skills/skills/github/scripts/vendor/surface/SOURCE.json +15 -0
- package/packages/shared-skills/skills/github/scripts/vendor/surface/cli.ts +203 -0
- package/packages/shared-skills/skills/github/scripts/vendor/surface/flags.ts +195 -0
- package/packages/shared-skills/skills/github/scripts/vendor/surface/help.ts +89 -0
- package/packages/shared-skills/skills/github/scripts/vendor/surface/http.ts +180 -0
- package/packages/shared-skills/skills/github/scripts/vendor/surface/index.ts +44 -0
- package/packages/shared-skills/skills/github/scripts/vendor/surface/mcp.ts +241 -0
- package/packages/shared-skills/skills/github/scripts/vendor/surface/schema.ts +200 -0
- package/packages/shared-skills/skills/github/scripts/vendor/surface/stdio.ts +54 -0
- package/packages/shared-skills/skills/github/scripts/vendor/surface/surface.ts +250 -0
- package/packages/shared-skills/skills/github/scripts/vendor/surface/tools.ts +80 -0
- package/packages/shared-skills/skills/programming/SKILL.md +51 -320
- package/packages/shared-skills/skills/programming/references/go/README.md +1 -0
- package/packages/shared-skills/skills/programming/references/python/README.md +21 -3
- package/packages/shared-skills/skills/programming/references/python/error-handling.md +14 -0
- package/packages/shared-skills/skills/programming/references/rust/README.md +5 -1
- package/packages/shared-skills/skills/programming/references/typescript/README.md +9 -3
- package/packages/shared-skills/skills/programming/references/typescript/error-handling.md +18 -0
- package/packages/shared-skills/skills/ultimate-browsing/SKILL.md +1 -1
- package/packages/shared-skills/skills/ulw-execute/SKILL.md +1 -1
- package/packages/shared-skills/skills/visual-qa/references/browser-setup.md +5 -5
- package/dist/skills/git-master/SKILL.md +0 -114
- package/dist/skills/git-master/agents/openai.yaml +0 -13
- package/packages/omo-codex/plugin/skills/git-master/SKILL.md +0 -114
- package/packages/omo-codex/plugin/skills/git-master/agents/openai.yaml +0 -13
- package/packages/shared-skills/skills/git-master/SKILL.md +0 -114
- package/packages/shared-skills/skills/git-master/agents/openai.yaml +0 -13
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// Discussion node ids, category and label ids resolved in one GraphQL round trip, and the shared summary shape.
|
|
2
|
+
import { s, SurfaceError } from "../vendor/surface/index.ts";
|
|
3
|
+
import type { GitHub, Repo } from "./http.ts";
|
|
4
|
+
import { at, bool, names, nodes, num, optNum, optStr, str } from "./read.ts";
|
|
5
|
+
|
|
6
|
+
export const categoryField = s.string({
|
|
7
|
+
description: "Category name or slug.",
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const DISCUSSION = `id number title url closed stateReason isAnswered createdAt updatedAt
|
|
11
|
+
author{login} category{name slug} labels(first:20){nodes{name}} comments{totalCount}`;
|
|
12
|
+
|
|
13
|
+
export const discussionSummary = (d: unknown) => ({
|
|
14
|
+
id: str(d, "id"),
|
|
15
|
+
number: num(d, "number"),
|
|
16
|
+
title: str(d, "title"),
|
|
17
|
+
url: str(d, "url"),
|
|
18
|
+
author: optStr(d, "author", "login"),
|
|
19
|
+
category: optStr(d, "category", "name"),
|
|
20
|
+
closed: bool(d, "closed"),
|
|
21
|
+
stateReason: optStr(d, "stateReason"),
|
|
22
|
+
answered: bool(d, "isAnswered"),
|
|
23
|
+
labels: names(d, "name", "labels"),
|
|
24
|
+
comments: optNum(d, "comments", "totalCount") ?? 0,
|
|
25
|
+
createdAt: str(d, "createdAt"),
|
|
26
|
+
updatedAt: str(d, "updatedAt"),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export type Category = {
|
|
30
|
+
readonly id: string;
|
|
31
|
+
readonly name: string;
|
|
32
|
+
readonly slug: string;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
type Want = {
|
|
36
|
+
readonly number?: number;
|
|
37
|
+
readonly category?: string;
|
|
38
|
+
readonly labels?: readonly string[];
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const lookup = async (gh: GitHub, r: Repo, want: Want) => {
|
|
42
|
+
const labels = want.labels ?? [];
|
|
43
|
+
const vars = labels.map((_, i) => `$l${i}:String!`).join("");
|
|
44
|
+
const query = `query($owner:String!,$name:String!,$number:Int!,$byNumber:Boolean!,$categories:Boolean!${vars}){
|
|
45
|
+
repository(owner:$owner,name:$name){id
|
|
46
|
+
discussion(number:$number) @include(if:$byNumber){id}
|
|
47
|
+
discussionCategories(first:100) @include(if:$categories){nodes{id name slug}}
|
|
48
|
+
${labels.map((_, i) => `l${i}:label(name:$l${i}){id}`).join(" ")}}}`;
|
|
49
|
+
const data = await gh.graphql(query, {
|
|
50
|
+
owner: r.owner,
|
|
51
|
+
name: r.name,
|
|
52
|
+
number: want.number ?? 0,
|
|
53
|
+
byNumber: want.number !== undefined,
|
|
54
|
+
categories: want.category !== undefined,
|
|
55
|
+
...Object.fromEntries(labels.map((l, i) => [`l${i}`, l])),
|
|
56
|
+
});
|
|
57
|
+
const repo = at(data, "repository");
|
|
58
|
+
const discussionId = optStr(repo, "discussion", "id");
|
|
59
|
+
if (want.number !== undefined && discussionId === null)
|
|
60
|
+
throw new SurfaceError(
|
|
61
|
+
"not_found",
|
|
62
|
+
`no discussion #${want.number} in ${r.full}`,
|
|
63
|
+
"check the number",
|
|
64
|
+
);
|
|
65
|
+
const labelIds = labels.map((label, i) => {
|
|
66
|
+
const id = optStr(repo, `l${i}`, "id");
|
|
67
|
+
if (id === null)
|
|
68
|
+
throw new SurfaceError(
|
|
69
|
+
"not_found",
|
|
70
|
+
`no label "${label}" in ${r.full}`,
|
|
71
|
+
"create it first or check the spelling",
|
|
72
|
+
);
|
|
73
|
+
return id;
|
|
74
|
+
});
|
|
75
|
+
return {
|
|
76
|
+
repoId: str(repo, "id"),
|
|
77
|
+
discussionId: discussionId ?? "",
|
|
78
|
+
category:
|
|
79
|
+
want.category === undefined
|
|
80
|
+
? undefined
|
|
81
|
+
: pickCategory(r, want.category, categoryList(repo)),
|
|
82
|
+
labelIds,
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const categoryList = (repo: unknown): Category[] =>
|
|
87
|
+
nodes(repo, "discussionCategories").map((c) => ({
|
|
88
|
+
id: str(c, "id"),
|
|
89
|
+
name: str(c, "name"),
|
|
90
|
+
slug: str(c, "slug"),
|
|
91
|
+
}));
|
|
92
|
+
|
|
93
|
+
export const pickCategory = (
|
|
94
|
+
r: Repo,
|
|
95
|
+
given: string,
|
|
96
|
+
all: readonly Category[],
|
|
97
|
+
): Category => {
|
|
98
|
+
const want = given.toLowerCase();
|
|
99
|
+
const hit = all.find(
|
|
100
|
+
(c) => c.name.toLowerCase() === want || c.slug.toLowerCase() === want,
|
|
101
|
+
);
|
|
102
|
+
if (hit === undefined)
|
|
103
|
+
throw new SurfaceError(
|
|
104
|
+
"not_found",
|
|
105
|
+
`no discussion category "${given}" in ${r.full}`,
|
|
106
|
+
`use one of: ${all.map((c) => c.name).join(", ") || "(discussions may be disabled)"}`,
|
|
107
|
+
);
|
|
108
|
+
return hit;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export const setLabels = async (
|
|
112
|
+
gh: GitHub,
|
|
113
|
+
id: string,
|
|
114
|
+
add: readonly string[],
|
|
115
|
+
remove: readonly string[],
|
|
116
|
+
) => {
|
|
117
|
+
if (add.length > 0)
|
|
118
|
+
await gh.graphql(
|
|
119
|
+
"mutation($id:ID!,$labels:[ID!]!){addLabelsToLabelable(input:{labelableId:$id,labelIds:$labels}){clientMutationId}}",
|
|
120
|
+
{ id, labels: add },
|
|
121
|
+
);
|
|
122
|
+
if (remove.length > 0)
|
|
123
|
+
await gh.graphql(
|
|
124
|
+
"mutation($id:ID!,$labels:[ID!]!){removeLabelsFromLabelable(input:{labelableId:$id,labelIds:$labels}){clientMutationId}}",
|
|
125
|
+
{ id, labels: remove },
|
|
126
|
+
);
|
|
127
|
+
};
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
// GitHub Discussions over GraphQL: view, create, edit and comment; list lives in discussion-list.ts.
|
|
2
|
+
import { op, s, SurfaceError } from "../vendor/surface/index.ts";
|
|
3
|
+
import { discussionListOp } from "./discussion-list.ts";
|
|
4
|
+
import {
|
|
5
|
+
categoryField,
|
|
6
|
+
DISCUSSION,
|
|
7
|
+
discussionSummary,
|
|
8
|
+
lookup,
|
|
9
|
+
setLabels,
|
|
10
|
+
} from "./discussion-lookup.ts";
|
|
11
|
+
import { reads, repoField, writes } from "./fields.ts";
|
|
12
|
+
import type { GitHub, Repo } from "./http.ts";
|
|
13
|
+
import { at, bool, nodes, num, optNum, optStr, str } from "./read.ts";
|
|
14
|
+
|
|
15
|
+
const numberField = s.integer({ description: "Discussion number." });
|
|
16
|
+
|
|
17
|
+
const VIEW = `query($owner:String!,$name:String!,$number:Int!,$comments:Int!){repository(owner:$owner,name:$name){discussion(number:$number){
|
|
18
|
+
${DISCUSSION} body answer{id url} latest:comments(last:$comments){nodes{id databaseId url body createdAt isAnswer upvoteCount author{login} replies{totalCount}}}}}}`;
|
|
19
|
+
const SUMMARY = `query($owner:String!,$name:String!,$number:Int!){repository(owner:$owner,name:$name){discussion(number:$number){${DISCUSSION}}}}`;
|
|
20
|
+
|
|
21
|
+
const read = async (gh: GitHub, r: Repo, number: number) => {
|
|
22
|
+
const d = at(
|
|
23
|
+
await gh.graphql(SUMMARY, { owner: r.owner, name: r.name, number }),
|
|
24
|
+
"repository",
|
|
25
|
+
"discussion",
|
|
26
|
+
);
|
|
27
|
+
return { repo: r.full, ...discussionSummary(d) };
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const discussionOps = (gh: GitHub) => ({
|
|
31
|
+
list: discussionListOp(gh),
|
|
32
|
+
view: op({
|
|
33
|
+
description:
|
|
34
|
+
"One discussion with its body, answer and optionally its latest N top-level comments (each with its reply count). Replaces `gh discussion view`.",
|
|
35
|
+
input: s.object({
|
|
36
|
+
repo: repoField,
|
|
37
|
+
number: numberField,
|
|
38
|
+
comments: s.optional(
|
|
39
|
+
s.integer({
|
|
40
|
+
description:
|
|
41
|
+
"Latest top-level comments to include (default 0, max 100).",
|
|
42
|
+
}),
|
|
43
|
+
),
|
|
44
|
+
}),
|
|
45
|
+
annotations: reads,
|
|
46
|
+
run: async ({ repo, number, comments }) => {
|
|
47
|
+
const r = await gh.repo(repo);
|
|
48
|
+
const d = at(
|
|
49
|
+
await gh.graphql(VIEW, {
|
|
50
|
+
owner: r.owner,
|
|
51
|
+
name: r.name,
|
|
52
|
+
number,
|
|
53
|
+
comments: Math.min(comments ?? 0, 100),
|
|
54
|
+
}),
|
|
55
|
+
"repository",
|
|
56
|
+
"discussion",
|
|
57
|
+
);
|
|
58
|
+
if (d === null || d === undefined)
|
|
59
|
+
throw new SurfaceError(
|
|
60
|
+
"not_found",
|
|
61
|
+
`no discussion #${number} in ${r.full}`,
|
|
62
|
+
"check the number",
|
|
63
|
+
);
|
|
64
|
+
return {
|
|
65
|
+
repo: r.full,
|
|
66
|
+
...discussionSummary(d),
|
|
67
|
+
body: optStr(d, "body") ?? "",
|
|
68
|
+
answer: optStr(d, "answer", "url"),
|
|
69
|
+
latestComments: nodes(d, "latest").map((c) => ({
|
|
70
|
+
id: str(c, "id"),
|
|
71
|
+
databaseId: optNum(c, "databaseId"),
|
|
72
|
+
author: optStr(c, "author", "login"),
|
|
73
|
+
createdAt: str(c, "createdAt"),
|
|
74
|
+
isAnswer: bool(c, "isAnswer"),
|
|
75
|
+
upvotes: optNum(c, "upvoteCount") ?? 0,
|
|
76
|
+
replies: optNum(c, "replies", "totalCount") ?? 0,
|
|
77
|
+
url: str(c, "url"),
|
|
78
|
+
body: str(c, "body"),
|
|
79
|
+
})),
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
}),
|
|
83
|
+
create: op({
|
|
84
|
+
description:
|
|
85
|
+
"Open a discussion in a category (name or slug), optionally labelled. Replaces `gh discussion create`.",
|
|
86
|
+
input: s.object({
|
|
87
|
+
repo: repoField,
|
|
88
|
+
title: s.string(),
|
|
89
|
+
body: s.optional(s.string()),
|
|
90
|
+
category: categoryField,
|
|
91
|
+
labels: s.optional(s.array(s.string())),
|
|
92
|
+
}),
|
|
93
|
+
annotations: writes,
|
|
94
|
+
run: async ({ repo, title, body, category, labels }) => {
|
|
95
|
+
const r = await gh.repo(repo);
|
|
96
|
+
const ids = await lookup(gh, r, { category, labels: labels ?? [] });
|
|
97
|
+
const d = at(
|
|
98
|
+
await gh.graphql(
|
|
99
|
+
"mutation($input:CreateDiscussionInput!){createDiscussion(input:$input){discussion{id number url}}}",
|
|
100
|
+
{
|
|
101
|
+
input: {
|
|
102
|
+
repositoryId: ids.repoId,
|
|
103
|
+
categoryId: ids.category?.id ?? "",
|
|
104
|
+
title,
|
|
105
|
+
body: body ?? "",
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
),
|
|
109
|
+
"createDiscussion",
|
|
110
|
+
"discussion",
|
|
111
|
+
);
|
|
112
|
+
await setLabels(gh, str(d, "id"), ids.labelIds, []);
|
|
113
|
+
return {
|
|
114
|
+
repo: r.full,
|
|
115
|
+
id: str(d, "id"),
|
|
116
|
+
number: num(d, "number"),
|
|
117
|
+
url: str(d, "url"),
|
|
118
|
+
labels: labels ?? [],
|
|
119
|
+
};
|
|
120
|
+
},
|
|
121
|
+
}),
|
|
122
|
+
edit: op({
|
|
123
|
+
description:
|
|
124
|
+
"Change a discussion's title, body or category, and add or remove labels. Returns the discussion as it stands afterwards. Replaces `gh discussion edit`.",
|
|
125
|
+
input: s.object({
|
|
126
|
+
repo: repoField,
|
|
127
|
+
number: numberField,
|
|
128
|
+
title: s.optional(s.string()),
|
|
129
|
+
body: s.optional(s.string()),
|
|
130
|
+
category: s.optional(categoryField),
|
|
131
|
+
addLabels: s.optional(s.array(s.string())),
|
|
132
|
+
removeLabels: s.optional(s.array(s.string())),
|
|
133
|
+
}),
|
|
134
|
+
annotations: writes,
|
|
135
|
+
run: async (input) => {
|
|
136
|
+
const add = input.addLabels ?? [];
|
|
137
|
+
const remove = input.removeLabels ?? [];
|
|
138
|
+
const update = { title: input.title, body: input.body };
|
|
139
|
+
if (
|
|
140
|
+
Object.values(update).every((v) => v === undefined) &&
|
|
141
|
+
input.category === undefined &&
|
|
142
|
+
add.length + remove.length === 0
|
|
143
|
+
)
|
|
144
|
+
throw new SurfaceError(
|
|
145
|
+
"usage",
|
|
146
|
+
"nothing to change",
|
|
147
|
+
"pass title, body, category, addLabels or removeLabels",
|
|
148
|
+
);
|
|
149
|
+
const r = await gh.repo(input.repo);
|
|
150
|
+
const ids = await lookup(gh, r, {
|
|
151
|
+
number: input.number,
|
|
152
|
+
...(input.category === undefined ? {} : { category: input.category }),
|
|
153
|
+
labels: [...add, ...remove],
|
|
154
|
+
});
|
|
155
|
+
const fields = Object.fromEntries(
|
|
156
|
+
Object.entries({ ...update, categoryId: ids.category?.id }).filter(
|
|
157
|
+
([, v]) => v !== undefined,
|
|
158
|
+
),
|
|
159
|
+
);
|
|
160
|
+
if (Object.keys(fields).length > 0)
|
|
161
|
+
await gh.graphql(
|
|
162
|
+
"mutation($input:UpdateDiscussionInput!){updateDiscussion(input:$input){discussion{id}}}",
|
|
163
|
+
{ input: { discussionId: ids.discussionId, ...fields } },
|
|
164
|
+
);
|
|
165
|
+
await setLabels(
|
|
166
|
+
gh,
|
|
167
|
+
ids.discussionId,
|
|
168
|
+
ids.labelIds.slice(0, add.length),
|
|
169
|
+
ids.labelIds.slice(add.length),
|
|
170
|
+
);
|
|
171
|
+
return read(gh, r, input.number);
|
|
172
|
+
},
|
|
173
|
+
}),
|
|
174
|
+
comment: op({
|
|
175
|
+
description:
|
|
176
|
+
"Comment on a discussion, reply in a comment's thread (replyTo), or replace an existing comment's body (editId). Replaces `gh discussion comment`.",
|
|
177
|
+
input: s.object({
|
|
178
|
+
repo: repoField,
|
|
179
|
+
number: s.optional(numberField),
|
|
180
|
+
body: s.string(),
|
|
181
|
+
replyTo: s.optional(
|
|
182
|
+
s.string({
|
|
183
|
+
description: "Node id of the top-level comment to reply under.",
|
|
184
|
+
}),
|
|
185
|
+
),
|
|
186
|
+
editId: s.optional(
|
|
187
|
+
s.string({ description: "Node id of an existing comment to replace." }),
|
|
188
|
+
),
|
|
189
|
+
}),
|
|
190
|
+
annotations: writes,
|
|
191
|
+
run: async ({ repo, number, body, replyTo, editId }) => {
|
|
192
|
+
if (editId !== undefined) {
|
|
193
|
+
if (replyTo !== undefined)
|
|
194
|
+
throw new SurfaceError(
|
|
195
|
+
"usage",
|
|
196
|
+
"pass replyTo or editId, not both",
|
|
197
|
+
"editId replaces a comment; replyTo adds one",
|
|
198
|
+
);
|
|
199
|
+
const c = at(
|
|
200
|
+
await gh.graphql(
|
|
201
|
+
"mutation($input:UpdateDiscussionCommentInput!){updateDiscussionComment(input:$input){comment{id url}}}",
|
|
202
|
+
{ input: { commentId: editId, body } },
|
|
203
|
+
),
|
|
204
|
+
"updateDiscussionComment",
|
|
205
|
+
"comment",
|
|
206
|
+
);
|
|
207
|
+
return { id: str(c, "id"), url: str(c, "url") };
|
|
208
|
+
}
|
|
209
|
+
if (number === undefined)
|
|
210
|
+
throw new SurfaceError(
|
|
211
|
+
"usage",
|
|
212
|
+
"pass the discussion number",
|
|
213
|
+
"number is optional only together with editId",
|
|
214
|
+
);
|
|
215
|
+
const r = await gh.repo(repo);
|
|
216
|
+
const { discussionId } = await lookup(gh, r, { number });
|
|
217
|
+
const c = at(
|
|
218
|
+
await gh.graphql(
|
|
219
|
+
"mutation($input:AddDiscussionCommentInput!){addDiscussionComment(input:$input){comment{id url}}}",
|
|
220
|
+
{
|
|
221
|
+
input: {
|
|
222
|
+
discussionId,
|
|
223
|
+
body,
|
|
224
|
+
...(replyTo === undefined ? {} : { replyToId: replyTo }),
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
),
|
|
228
|
+
"addDiscussionComment",
|
|
229
|
+
"comment",
|
|
230
|
+
);
|
|
231
|
+
return { repo: r.full, id: str(c, "id"), url: str(c, "url") };
|
|
232
|
+
},
|
|
233
|
+
}),
|
|
234
|
+
});
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// Where the transport's inputs come from by default: the token (GH_TOKEN, GITHUB_TOKEN, else the gh login read once
|
|
2
|
+
// in-process) and the repo (the git origin of the working directory).
|
|
3
|
+
import { SurfaceError } from "../vendor/surface/index.ts";
|
|
4
|
+
import { gitChildEnv } from "./git-auth.ts";
|
|
5
|
+
import type { Deps, GitResult, Repo } from "./http.ts";
|
|
6
|
+
|
|
7
|
+
const spawnText = async (
|
|
8
|
+
cmd: readonly string[],
|
|
9
|
+
env: Readonly<Record<string, string | undefined>> = process.env,
|
|
10
|
+
): Promise<string | undefined> => {
|
|
11
|
+
try {
|
|
12
|
+
const proc = Bun.spawn([...cmd], {
|
|
13
|
+
env,
|
|
14
|
+
stdout: "pipe",
|
|
15
|
+
stderr: "ignore",
|
|
16
|
+
stdin: "ignore",
|
|
17
|
+
});
|
|
18
|
+
const [out, code] = await Promise.all([
|
|
19
|
+
new Response(proc.stdout).text(),
|
|
20
|
+
proc.exited,
|
|
21
|
+
]);
|
|
22
|
+
return code === 0 ? out.trim() : undefined;
|
|
23
|
+
} catch {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const runGit = async (
|
|
29
|
+
args: readonly string[],
|
|
30
|
+
cwd: string,
|
|
31
|
+
env: Readonly<Record<string, string>>,
|
|
32
|
+
): Promise<GitResult> => {
|
|
33
|
+
try {
|
|
34
|
+
const proc = Bun.spawn(["git", ...args], {
|
|
35
|
+
cwd,
|
|
36
|
+
env,
|
|
37
|
+
stdout: "pipe",
|
|
38
|
+
stderr: "pipe",
|
|
39
|
+
stdin: "ignore",
|
|
40
|
+
});
|
|
41
|
+
const [stdout, stderr, code] = await Promise.all([
|
|
42
|
+
new Response(proc.stdout).text(),
|
|
43
|
+
new Response(proc.stderr).text(),
|
|
44
|
+
proc.exited,
|
|
45
|
+
]);
|
|
46
|
+
return { code, stdout, stderr };
|
|
47
|
+
} catch (error) {
|
|
48
|
+
return {
|
|
49
|
+
code: 127,
|
|
50
|
+
stdout: "",
|
|
51
|
+
stderr: error instanceof Error ? error.message : String(error),
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const defaultToken = (): (() => Promise<string>) => {
|
|
57
|
+
let cached: Promise<string> | undefined;
|
|
58
|
+
return () =>
|
|
59
|
+
(cached ??= (async () => {
|
|
60
|
+
const env = process.env["GH_TOKEN"] ?? process.env["GITHUB_TOKEN"];
|
|
61
|
+
if (env) return env;
|
|
62
|
+
const fromGh = await spawnText([
|
|
63
|
+
"gh",
|
|
64
|
+
"auth",
|
|
65
|
+
"token",
|
|
66
|
+
"--hostname",
|
|
67
|
+
"github.com",
|
|
68
|
+
]);
|
|
69
|
+
if (fromGh) return fromGh;
|
|
70
|
+
throw new SurfaceError(
|
|
71
|
+
"auth",
|
|
72
|
+
"no GitHub token",
|
|
73
|
+
"set GH_TOKEN, or log in once with `gh auth login`",
|
|
74
|
+
);
|
|
75
|
+
})());
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const parseRepo = (text: string): Repo | undefined => {
|
|
79
|
+
const m =
|
|
80
|
+
/^(?:https?:\/\/github\.com\/|git@github\.com:|ssh:\/\/git@github\.com\/)?([\w.-]+)\/([\w.-]+?)(?:\.git)?\/?$/.exec(
|
|
81
|
+
text.trim(),
|
|
82
|
+
);
|
|
83
|
+
if (!m?.[1] || !m[2]) return undefined;
|
|
84
|
+
return { owner: m[1], name: m[2], full: `${m[1]}/${m[2]}` };
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const defaultDeps = (): Deps => ({
|
|
88
|
+
fetch: (url, init) => fetch(url, init),
|
|
89
|
+
git: runGit,
|
|
90
|
+
env: () => process.env,
|
|
91
|
+
token: defaultToken(),
|
|
92
|
+
originRepo: () =>
|
|
93
|
+
spawnText(
|
|
94
|
+
["git", "remote", "get-url", "origin"],
|
|
95
|
+
gitChildEnv(process.env, {}),
|
|
96
|
+
),
|
|
97
|
+
sleep: (ms) => Bun.sleep(ms),
|
|
98
|
+
now: () => Date.now(),
|
|
99
|
+
apiUrl: "https://api.github.com/",
|
|
100
|
+
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// How a failed GitHub response is classified: rate limits (primary and secondary) and the error kind and message.
|
|
2
|
+
import { at, optStr } from "./read.ts";
|
|
3
|
+
|
|
4
|
+
export const rateLimit = (
|
|
5
|
+
res: Response,
|
|
6
|
+
now: number,
|
|
7
|
+
): { readonly waitMs: number; readonly when: string } | undefined => {
|
|
8
|
+
const limited =
|
|
9
|
+
res.status === 429 ||
|
|
10
|
+
(res.status === 403 &&
|
|
11
|
+
(res.headers.get("x-ratelimit-remaining") === "0" ||
|
|
12
|
+
res.headers.has("retry-after")));
|
|
13
|
+
if (!limited) return undefined;
|
|
14
|
+
const after = Number(res.headers.get("retry-after") ?? "NaN");
|
|
15
|
+
const reset = Number(res.headers.get("x-ratelimit-reset") ?? "NaN") * 1000;
|
|
16
|
+
const waitMs = Number.isFinite(after)
|
|
17
|
+
? after * 1000
|
|
18
|
+
: Number.isFinite(reset)
|
|
19
|
+
? reset - now
|
|
20
|
+
: 60_000;
|
|
21
|
+
const when = Number.isFinite(reset)
|
|
22
|
+
? new Date(reset).toISOString()
|
|
23
|
+
: `in ${Math.ceil(waitMs / 1000)} s`;
|
|
24
|
+
return { waitMs, when };
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const errorMessage = (text: string): string => {
|
|
28
|
+
try {
|
|
29
|
+
const body: unknown = JSON.parse(text);
|
|
30
|
+
const errors = at(body, "errors");
|
|
31
|
+
const detail = Array.isArray(errors)
|
|
32
|
+
? errors
|
|
33
|
+
.map((e) =>
|
|
34
|
+
typeof e === "string"
|
|
35
|
+
? e
|
|
36
|
+
: (optStr(e, "message") ?? optStr(e, "code") ?? ""),
|
|
37
|
+
)
|
|
38
|
+
.filter(Boolean)
|
|
39
|
+
.join("; ")
|
|
40
|
+
: "";
|
|
41
|
+
return [optStr(body, "message") ?? "", detail].filter(Boolean).join(": ");
|
|
42
|
+
} catch {
|
|
43
|
+
return text.slice(0, 300);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const kindFor = (status: number, message: string): [string, string] => {
|
|
48
|
+
if (status === 401)
|
|
49
|
+
return [
|
|
50
|
+
"auth",
|
|
51
|
+
"the token is invalid or expired; refresh GH_TOKEN or `gh auth login`",
|
|
52
|
+
];
|
|
53
|
+
if (status === 404)
|
|
54
|
+
return [
|
|
55
|
+
"not_found",
|
|
56
|
+
"check owner/name and number; a private repo also answers 404 without access",
|
|
57
|
+
];
|
|
58
|
+
if (status === 403)
|
|
59
|
+
return [
|
|
60
|
+
"forbidden",
|
|
61
|
+
message.includes("Upgrade to GitHub")
|
|
62
|
+
? "the account's plan does not offer this on a private repository; no token change fixes it"
|
|
63
|
+
: "the token lacks a scope or the repo blocks this action",
|
|
64
|
+
];
|
|
65
|
+
if (status === 405 || status === 409)
|
|
66
|
+
return [
|
|
67
|
+
"conflict",
|
|
68
|
+
"the target state forbids this (not mergeable, head moved, or already done)",
|
|
69
|
+
];
|
|
70
|
+
if (status === 422)
|
|
71
|
+
return [
|
|
72
|
+
"invalid",
|
|
73
|
+
message.includes("already exists")
|
|
74
|
+
? "it already exists"
|
|
75
|
+
: "fix the fields named in the message",
|
|
76
|
+
];
|
|
77
|
+
if (status >= 500) return ["server", "GitHub failed; retry later"];
|
|
78
|
+
return ["http", "see the message"];
|
|
79
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { s, type Annotations } from "../vendor/surface/index.ts";
|
|
2
|
+
|
|
3
|
+
export const repoField = s.optional(
|
|
4
|
+
s.string({
|
|
5
|
+
description:
|
|
6
|
+
"owner/name (a github.com URL works too). Defaults to the git origin of the current directory.",
|
|
7
|
+
}),
|
|
8
|
+
);
|
|
9
|
+
export const numberField = s.integer({
|
|
10
|
+
description: "Pull request or issue number.",
|
|
11
|
+
});
|
|
12
|
+
export const limitField = (fallback: number) =>
|
|
13
|
+
s.optional(
|
|
14
|
+
s.integer({
|
|
15
|
+
description: `Maximum items to return (default ${fallback}).`,
|
|
16
|
+
}),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export const reads: Annotations = {
|
|
20
|
+
readOnly: true,
|
|
21
|
+
idempotent: true,
|
|
22
|
+
openWorld: true,
|
|
23
|
+
};
|
|
24
|
+
export const writes: Annotations = { destructive: false, openWorld: true };
|
|
25
|
+
export const irreversible: Annotations = { destructive: true, openWorld: true };
|
|
26
|
+
|
|
27
|
+
export const enc = encodeURIComponent;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// How a gist is addressed (id or URL) and how GitHub's gist JSON is trimmed for results.
|
|
2
|
+
import { basename } from "node:path";
|
|
3
|
+
import { s, SurfaceError } from "../vendor/surface/index.ts";
|
|
4
|
+
import { at, bool, isObj, obj, optStr, str } from "./read.ts";
|
|
5
|
+
|
|
6
|
+
export const gistField = s.string({
|
|
7
|
+
description: "Gist id or its gist.github.com URL.",
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const gistId = (given: string): string => {
|
|
11
|
+
const last = given
|
|
12
|
+
.trim()
|
|
13
|
+
.replace(/[?#].*$/, "")
|
|
14
|
+
.replace(/\/+$/, "")
|
|
15
|
+
.split("/")
|
|
16
|
+
.pop();
|
|
17
|
+
const id = last?.replace(/\.git$/, "") ?? "";
|
|
18
|
+
if (!/^[\da-f]+$/i.test(id))
|
|
19
|
+
throw new SurfaceError(
|
|
20
|
+
"usage",
|
|
21
|
+
`not a gist id or URL: ${given}`,
|
|
22
|
+
"pass the id from `gist list` or a https://gist.github.com/<user>/<id> URL",
|
|
23
|
+
);
|
|
24
|
+
return id;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const fileList = (g: unknown) =>
|
|
28
|
+
Object.values(obj(at(g, "files"), "files")).flatMap((f) =>
|
|
29
|
+
isObj(f) ? [f] : [],
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export const gistSummary = (g: unknown) => ({
|
|
33
|
+
id: str(g, "id"),
|
|
34
|
+
description: optStr(g, "description"),
|
|
35
|
+
public: bool(g, "public"),
|
|
36
|
+
url: str(g, "html_url"),
|
|
37
|
+
updatedAt: optStr(g, "updated_at"),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export const gistWritten = (g: unknown) => ({
|
|
41
|
+
...gistSummary(g),
|
|
42
|
+
files: fileList(g).map((f) => str(f, "filename")),
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
export const readPaths = async (paths: readonly string[]) =>
|
|
46
|
+
Object.fromEntries(
|
|
47
|
+
await Promise.all(
|
|
48
|
+
paths.map(async (p) => [
|
|
49
|
+
basename(p),
|
|
50
|
+
{ content: await Bun.file(p).text() },
|
|
51
|
+
]),
|
|
52
|
+
),
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
export const contentsOf = (files: Readonly<Record<string, string>>) =>
|
|
56
|
+
Object.fromEntries(
|
|
57
|
+
Object.entries(files).map(([name, content]) => [name, { content }]),
|
|
58
|
+
);
|