oh-my-opencode 5.1.84 → 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/index.js +1022 -842
- package/dist/cli/service-auth/devices.d.ts +5 -2
- package/dist/cli-node/index.js +1022 -842
- package/dist/config/schema/agent-names.d.ts +1 -0
- package/dist/index.js +180 -205
- package/dist/skills/browser/SKILL.md +4 -1
- package/dist/skills/browser/references/commands.md +5 -2
- package/dist/skills/browser/references/desktop.md +1 -0
- package/dist/skills/browser/references/owned-engine/README.md +2 -0
- package/dist/skills/browser/references/owned-engine/frames-and-humans.md +2 -0
- package/dist/skills/browser/references/owned-engine/network.md +10 -5
- package/dist/skills/browser/references/recipes/1password.md +2 -0
- package/dist/skills/browser/runtime/omowright/index.js +11 -11
- package/dist/skills/browser/runtime/omowright/manifest.json +4 -4
- package/dist/skills/debugging/SKILL.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 +1 -1
- package/dist/skills/ulw-execute/SKILL.md +1 -1
- package/dist/tui.js +30 -27
- package/package.json +28 -26
- package/packages/omo-codex/plugin/.codex-plugin/plugin.json +1 -1
- 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/hooks/hooks.json +1 -1
- package/packages/omo-codex/plugin/components/telemetry/package.json +1 -1
- 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/skills/browser/SKILL.md +4 -1
- package/packages/omo-codex/plugin/skills/browser/references/commands.md +5 -2
- package/packages/omo-codex/plugin/skills/browser/references/desktop.md +1 -0
- package/packages/omo-codex/plugin/skills/browser/references/owned-engine/README.md +2 -0
- package/packages/omo-codex/plugin/skills/browser/references/owned-engine/frames-and-humans.md +2 -0
- package/packages/omo-codex/plugin/skills/browser/references/owned-engine/network.md +10 -5
- package/packages/omo-codex/plugin/skills/browser/references/recipes/1password.md +2 -0
- package/packages/omo-codex/plugin/skills/browser/runtime/omowright/index.js +11 -11
- 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/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 +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/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 +20 -15
- package/packages/shared-skills/skills/browser/SKILL.md +4 -1
- package/packages/shared-skills/skills/browser/references/commands.md +5 -2
- package/packages/shared-skills/skills/browser/references/desktop.md +1 -0
- package/packages/shared-skills/skills/browser/references/owned-engine/README.md +2 -0
- package/packages/shared-skills/skills/browser/references/owned-engine/frames-and-humans.md +2 -0
- package/packages/shared-skills/skills/browser/references/owned-engine/network.md +10 -5
- package/packages/shared-skills/skills/browser/references/recipes/1password.md +2 -0
- package/packages/shared-skills/skills/browser/runtime/omowright/index.js +11 -11
- 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/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 +1 -1
- package/packages/shared-skills/skills/ulw-execute/SKILL.md +1 -1
- 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,195 @@
|
|
|
1
|
+
// Command-line flags from an input schema: each top-level property is `--kebab-name`, typed by
|
|
2
|
+
// its schema. `--json '{...}'` (or `--input file`, `-` for stdin) supplies the whole input, and
|
|
3
|
+
// flags given beside it override its fields. A field its schema marks `writeOnly` is a secret: other
|
|
4
|
+
// processes can read an argument list, so it is accepted only through `--input`.
|
|
5
|
+
import { SurfaceError } from "./surface.ts";
|
|
6
|
+
import type { JsonSchema } from "./schema.ts";
|
|
7
|
+
|
|
8
|
+
export type Property = {
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly flag: string;
|
|
11
|
+
readonly schema: JsonSchema;
|
|
12
|
+
readonly required: boolean;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const isObject = (
|
|
16
|
+
value: unknown,
|
|
17
|
+
): value is { readonly [key: string]: unknown } =>
|
|
18
|
+
typeof value === "object" && value !== null && !Array.isArray(value);
|
|
19
|
+
|
|
20
|
+
export const kebab = (name: string): string =>
|
|
21
|
+
name
|
|
22
|
+
.replace(/([a-z0-9])([A-Z])/g, "$1-$2")
|
|
23
|
+
.replaceAll("_", "-")
|
|
24
|
+
.toLowerCase();
|
|
25
|
+
|
|
26
|
+
export const propertiesOf = (schema: JsonSchema): readonly Property[] => {
|
|
27
|
+
const properties = isObject(schema["properties"]) ? schema["properties"] : {};
|
|
28
|
+
const required = Array.isArray(schema["required"]) ? schema["required"] : [];
|
|
29
|
+
return Object.entries(properties).map(([name, value]) => ({
|
|
30
|
+
name,
|
|
31
|
+
flag: kebab(name),
|
|
32
|
+
schema: isObject(value) ? value : {},
|
|
33
|
+
required: required.includes(name),
|
|
34
|
+
}));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const kindOf = (schema: JsonSchema): string => {
|
|
38
|
+
const kind = schema["type"];
|
|
39
|
+
if (typeof kind === "string") return kind;
|
|
40
|
+
if (Array.isArray(kind))
|
|
41
|
+
return kind.find((each) => each !== "null") ?? "json";
|
|
42
|
+
return Array.isArray(schema["enum"]) ? "string" : "json";
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const typeLabel = (schema: JsonSchema): string => {
|
|
46
|
+
if (Array.isArray(schema["enum"]))
|
|
47
|
+
return schema["enum"].map(String).join("|");
|
|
48
|
+
const kind = kindOf(schema);
|
|
49
|
+
if (kind === "array")
|
|
50
|
+
return `${typeLabel(isObject(schema["items"]) ? schema["items"] : {})}...`;
|
|
51
|
+
return kind === "object" ? "json" : kind;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const parseJson = (text: string, what: string): unknown => {
|
|
55
|
+
try {
|
|
56
|
+
return JSON.parse(text);
|
|
57
|
+
} catch {
|
|
58
|
+
throw new SurfaceError(
|
|
59
|
+
"usage",
|
|
60
|
+
`${what} is not valid JSON (${text.length} characters given)`,
|
|
61
|
+
"check the quoting, or pass the input with --input <file|->",
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const secretInArgv = (flag: string): SurfaceError =>
|
|
67
|
+
new SurfaceError(
|
|
68
|
+
"usage",
|
|
69
|
+
`--${flag} is a secret and cannot be passed as an argument`,
|
|
70
|
+
"pass the whole input on stdin with --input -, or from a file with --input <file>",
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
const scalar = (schema: JsonSchema, raw: string, flag: string): unknown => {
|
|
74
|
+
const kind = kindOf(schema);
|
|
75
|
+
if (kind === "string") return raw;
|
|
76
|
+
if (kind === "boolean") {
|
|
77
|
+
if (raw === "true" || raw === "false") return raw === "true";
|
|
78
|
+
throw new SurfaceError(
|
|
79
|
+
"usage",
|
|
80
|
+
`--${flag} takes true or false, not ${raw}`,
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
if (kind === "number" || kind === "integer") {
|
|
84
|
+
const value = Number(raw);
|
|
85
|
+
if (raw.trim() === "" || !Number.isFinite(value)) {
|
|
86
|
+
throw new SurfaceError("usage", `--${flag} takes a number, not ${raw}`);
|
|
87
|
+
}
|
|
88
|
+
return value;
|
|
89
|
+
}
|
|
90
|
+
return parseJson(raw, `--${flag}`);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export type Parsed = {
|
|
94
|
+
readonly input: Readonly<Record<string, unknown>>;
|
|
95
|
+
readonly help: boolean;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export const parseFlags = async (
|
|
99
|
+
schema: JsonSchema,
|
|
100
|
+
argv: readonly string[],
|
|
101
|
+
readStdin: () => Promise<string>,
|
|
102
|
+
): Promise<Parsed> => {
|
|
103
|
+
const properties = propertiesOf(schema);
|
|
104
|
+
const byFlag = new Map(properties.map((each) => [each.flag, each]));
|
|
105
|
+
const secrets = properties.filter(
|
|
106
|
+
(each) => each.schema["writeOnly"] === true,
|
|
107
|
+
);
|
|
108
|
+
let base: Readonly<Record<string, unknown>> = {};
|
|
109
|
+
const given: Record<string, unknown> = {};
|
|
110
|
+
let help = false;
|
|
111
|
+
for (let at = 0; at < argv.length; at += 1) {
|
|
112
|
+
const token = argv[at] ?? "";
|
|
113
|
+
if (token === "--help" || token === "-h") {
|
|
114
|
+
help = true;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (!token.startsWith("--")) {
|
|
118
|
+
throw new SurfaceError(
|
|
119
|
+
"usage",
|
|
120
|
+
`unexpected argument ${token}`,
|
|
121
|
+
"inputs are --flags",
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
const [name = "", inline] = token.slice(2).split(/=(.*)/s, 2);
|
|
125
|
+
const next = (): string => {
|
|
126
|
+
if (inline !== undefined) return inline;
|
|
127
|
+
const value = argv[at + 1];
|
|
128
|
+
if (value === undefined)
|
|
129
|
+
throw new SurfaceError("usage", `--${name} needs a value`);
|
|
130
|
+
at += 1;
|
|
131
|
+
return value;
|
|
132
|
+
};
|
|
133
|
+
if (name === "json" || name === "input") {
|
|
134
|
+
const source = next();
|
|
135
|
+
const text =
|
|
136
|
+
name === "json"
|
|
137
|
+
? source
|
|
138
|
+
: source === "-"
|
|
139
|
+
? await readStdin()
|
|
140
|
+
: await Bun.file(source).text();
|
|
141
|
+
const value = parseJson(text, `--${name}`);
|
|
142
|
+
if (!isObject(value))
|
|
143
|
+
throw new SurfaceError("usage", `--${name} must be a JSON object`);
|
|
144
|
+
const carried = secrets.find((each) => each.name in value);
|
|
145
|
+
if (name === "json" && carried !== undefined)
|
|
146
|
+
throw secretInArgv(carried.flag);
|
|
147
|
+
base = value;
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
const negated = name.startsWith("no-")
|
|
151
|
+
? byFlag.get(name.slice(3))
|
|
152
|
+
: undefined;
|
|
153
|
+
if (
|
|
154
|
+
negated !== undefined &&
|
|
155
|
+
kindOf(negated.schema) === "boolean" &&
|
|
156
|
+
inline === undefined
|
|
157
|
+
) {
|
|
158
|
+
given[negated.name] = false;
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
const property = byFlag.get(name);
|
|
162
|
+
if (property === undefined) {
|
|
163
|
+
const known =
|
|
164
|
+
[...byFlag.keys()].map((flag) => `--${flag}`).join(", ") || "none";
|
|
165
|
+
throw new SurfaceError(
|
|
166
|
+
"usage",
|
|
167
|
+
`unknown flag --${name}`,
|
|
168
|
+
`flags: ${known}, --json, --input`,
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
if (secrets.includes(property)) throw secretInArgv(property.flag);
|
|
172
|
+
const kind = kindOf(property.schema);
|
|
173
|
+
if (
|
|
174
|
+
kind === "boolean" &&
|
|
175
|
+
inline === undefined &&
|
|
176
|
+
!["true", "false"].includes(argv[at + 1] ?? "")
|
|
177
|
+
) {
|
|
178
|
+
given[property.name] = true;
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
if (kind === "array") {
|
|
182
|
+
const items = isObject(property.schema["items"])
|
|
183
|
+
? property.schema["items"]
|
|
184
|
+
: {};
|
|
185
|
+
const previous = given[property.name];
|
|
186
|
+
given[property.name] = [
|
|
187
|
+
...(Array.isArray(previous) ? previous : []),
|
|
188
|
+
scalar(items, next(), name),
|
|
189
|
+
];
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
given[property.name] = scalar(property.schema, next(), name);
|
|
193
|
+
}
|
|
194
|
+
return { input: { ...base, ...given }, help };
|
|
195
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// The text `--help` prints: the overview of a surface or a group, one operation's flags, and the
|
|
2
|
+
// `mcp` command. It is built from the surface definition and the caller's label, and the command
|
|
3
|
+
// line prints it through its redactor like everything else.
|
|
4
|
+
import { propertiesOf, typeLabel } from "./flags.ts";
|
|
5
|
+
import { toolName } from "./mcp.ts";
|
|
6
|
+
import {
|
|
7
|
+
isOp,
|
|
8
|
+
type AnyOp,
|
|
9
|
+
type Ops,
|
|
10
|
+
type SurfaceDefinition,
|
|
11
|
+
} from "./surface.ts";
|
|
12
|
+
|
|
13
|
+
const firstLine = (text: string): string => text.split("\n")[0] ?? "";
|
|
14
|
+
|
|
15
|
+
const listing = (
|
|
16
|
+
ops: Ops,
|
|
17
|
+
prefix: readonly string[],
|
|
18
|
+
depth: number,
|
|
19
|
+
): string[] =>
|
|
20
|
+
Object.entries(ops).flatMap(([name, value]) => {
|
|
21
|
+
const path = [...prefix, name].join(" ");
|
|
22
|
+
return isOp(value)
|
|
23
|
+
? [` ${path.padEnd(28)} ${firstLine(value.description)}`]
|
|
24
|
+
: depth > 0
|
|
25
|
+
? listing(value, [...prefix, name], depth - 1)
|
|
26
|
+
: [
|
|
27
|
+
` ${path.padEnd(28)} (${Object.keys(value).length} commands: ${path} --help)`,
|
|
28
|
+
];
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const overview = (
|
|
32
|
+
surface: SurfaceDefinition<Ops>,
|
|
33
|
+
cli: string,
|
|
34
|
+
ops: Ops,
|
|
35
|
+
prefix: readonly string[],
|
|
36
|
+
): string =>
|
|
37
|
+
[
|
|
38
|
+
prefix.length === 0
|
|
39
|
+
? `${surface.name} ${surface.version}${surface.description === undefined ? "" : `: ${surface.description}`}`
|
|
40
|
+
: `${cli} ${prefix.join(" ")}`,
|
|
41
|
+
"",
|
|
42
|
+
`usage: ${cli} ${[...prefix, "<command>"].join(" ")} [--flags | --json '{...}' | --input file]`,
|
|
43
|
+
"",
|
|
44
|
+
"commands:",
|
|
45
|
+
...listing(ops, prefix, prefix.length === 0 ? 0 : 1),
|
|
46
|
+
...(prefix.length === 0
|
|
47
|
+
? [
|
|
48
|
+
` ${"mcp".padEnd(28)} serve every command as an MCP server (mcp --help)`,
|
|
49
|
+
]
|
|
50
|
+
: []),
|
|
51
|
+
].join("\n");
|
|
52
|
+
|
|
53
|
+
export const opHelp = (
|
|
54
|
+
cli: string,
|
|
55
|
+
path: readonly string[],
|
|
56
|
+
op: AnyOp,
|
|
57
|
+
): string => {
|
|
58
|
+
const flags = propertiesOf(op.input.json).map((each) => {
|
|
59
|
+
const said =
|
|
60
|
+
typeof each.schema["description"] === "string"
|
|
61
|
+
? each.schema["description"]
|
|
62
|
+
: "";
|
|
63
|
+
const secret =
|
|
64
|
+
each.schema["writeOnly"] === true ? "(secret: --input only) " : "";
|
|
65
|
+
return ` --${`${each.flag} <${typeLabel(each.schema)}>`.padEnd(34)} ${each.required ? "(required) " : ""}${secret}${firstLine(said)}`;
|
|
66
|
+
});
|
|
67
|
+
const hints = Object.entries(op.annotations ?? {})
|
|
68
|
+
.filter(([, on]) => on)
|
|
69
|
+
.map(([hint]) => hint);
|
|
70
|
+
return [
|
|
71
|
+
`${cli} ${path.join(" ")}: ${op.description}`,
|
|
72
|
+
"",
|
|
73
|
+
...(flags.length === 0 ? ["takes no input"] : ["flags:", ...flags]),
|
|
74
|
+
" --json <object>, --input <file|-> the whole input as JSON; flags override its fields",
|
|
75
|
+
"",
|
|
76
|
+
`mcp tool: ${toolName(path)}${hints.length === 0 ? "" : ` (${hints.join(", ")})`}`,
|
|
77
|
+
].join("\n");
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export const mcpHelp = (cli: string): string =>
|
|
81
|
+
[
|
|
82
|
+
`usage: ${cli} mcp [--http --token-env NAME] [--host 127.0.0.1] [--port 0] [--path /mcp]`,
|
|
83
|
+
" [--read-only] [--only pattern,...] [--exclude pattern,...]",
|
|
84
|
+
"",
|
|
85
|
+
"stdio by default (one JSON-RPC message per line). --http serves Streamable HTTP and prints",
|
|
86
|
+
"its URL on stderr. It is plain HTTP, so it serves loopback only and every request must carry",
|
|
87
|
+
"`Authorization: Bearer <the value of $NAME>` (--token-env NAME is required with --http).",
|
|
88
|
+
"Speaks MCP 2026-07-28 (stateless) and the initialize-based revisions back to 2024-11-05.",
|
|
89
|
+
].join("\n");
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
// The Streamable HTTP binding, JSON responses only (no operation streams). Modern requests are
|
|
2
|
+
// checked against the MCP-Protocol-Version, Mcp-Method and Mcp-Name headers; a request without
|
|
3
|
+
// modern `_meta` is served under legacy semantics with no session, which those revisions allow.
|
|
4
|
+
// It speaks plain HTTP, so it binds to loopback only, refuses a foreign Origin (DNS rebinding) and
|
|
5
|
+
// requires a bearer token on every request: without one, any local process, another user's
|
|
6
|
+
// included, could run the surface's operations with this process's credentials.
|
|
7
|
+
import { createHash, timingSafeEqual } from "node:crypto";
|
|
8
|
+
import { ERRORS, type McpHandler, type Reply } from "./mcp.ts";
|
|
9
|
+
import { SurfaceError } from "./surface.ts";
|
|
10
|
+
|
|
11
|
+
export type HttpOptions = {
|
|
12
|
+
readonly hostname?: string;
|
|
13
|
+
readonly port?: number;
|
|
14
|
+
readonly path?: string;
|
|
15
|
+
/** Required on every request as `Authorization: Bearer <token>`. */
|
|
16
|
+
readonly token: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type HttpServer = {
|
|
20
|
+
readonly url: string;
|
|
21
|
+
readonly stop: () => Promise<void>;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const LOOPBACK = new Set(["127.0.0.1", "::1", "localhost"]);
|
|
25
|
+
const META_VERSION = "io.modelcontextprotocol/protocolVersion";
|
|
26
|
+
|
|
27
|
+
const isObject = (
|
|
28
|
+
value: unknown,
|
|
29
|
+
): value is { readonly [key: string]: unknown } =>
|
|
30
|
+
typeof value === "object" && value !== null && !Array.isArray(value);
|
|
31
|
+
|
|
32
|
+
const decoded = (header: string): string => {
|
|
33
|
+
const match = /^=\?base64\?(.*)\?=$/s.exec(header);
|
|
34
|
+
return match === null
|
|
35
|
+
? header
|
|
36
|
+
: Buffer.from(match[1] ?? "", "base64").toString("utf8");
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const json = (body: unknown, status: number): Response =>
|
|
40
|
+
Response.json(body, { status, headers: { "cache-control": "no-store" } });
|
|
41
|
+
|
|
42
|
+
const refuse = (
|
|
43
|
+
id: unknown,
|
|
44
|
+
status: number,
|
|
45
|
+
code: number,
|
|
46
|
+
message: string,
|
|
47
|
+
): Response =>
|
|
48
|
+
json({ jsonrpc: "2.0", id: id ?? null, error: { code, message } }, status);
|
|
49
|
+
|
|
50
|
+
const statusOf = (reply: Reply, modern: boolean): number => {
|
|
51
|
+
const error = reply["error"];
|
|
52
|
+
if (!modern || !isObject(error)) return 200;
|
|
53
|
+
if (error["code"] === ERRORS.methodNotFound) return 404;
|
|
54
|
+
const malformed = [
|
|
55
|
+
ERRORS.invalidParams,
|
|
56
|
+
ERRORS.unsupportedVersion,
|
|
57
|
+
ERRORS.headerMismatch,
|
|
58
|
+
];
|
|
59
|
+
return malformed.some((code) => code === error["code"]) ? 400 : 200;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const headerProblem = (
|
|
63
|
+
request: Request,
|
|
64
|
+
message: { readonly [key: string]: unknown },
|
|
65
|
+
): string | undefined => {
|
|
66
|
+
const params = isObject(message["params"]) ? message["params"] : {};
|
|
67
|
+
const meta = isObject(params["_meta"]) ? params["_meta"] : {};
|
|
68
|
+
const version = request.headers.get("mcp-protocol-version");
|
|
69
|
+
if (version !== meta[META_VERSION])
|
|
70
|
+
return "MCP-Protocol-Version header does not match _meta";
|
|
71
|
+
if (request.headers.get("mcp-method") !== message["method"])
|
|
72
|
+
return "Mcp-Method header does not match the body";
|
|
73
|
+
const named = message["method"] === "tools/call";
|
|
74
|
+
const name = request.headers.get("mcp-name");
|
|
75
|
+
if (named && (name === null || decoded(name) !== params["name"]))
|
|
76
|
+
return "Mcp-Name header does not match params.name";
|
|
77
|
+
return undefined;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const originAllowed = (request: Request): boolean => {
|
|
81
|
+
const origin = request.headers.get("origin");
|
|
82
|
+
if (origin === null) return true;
|
|
83
|
+
try {
|
|
84
|
+
return LOOPBACK.has(new URL(origin).hostname.replace(/^\[|\]$/g, ""));
|
|
85
|
+
} catch {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const digest = (text: string): Buffer =>
|
|
91
|
+
createHash("sha256").update(text).digest();
|
|
92
|
+
|
|
93
|
+
export const serveHttp = (
|
|
94
|
+
handler: McpHandler,
|
|
95
|
+
options: HttpOptions,
|
|
96
|
+
): HttpServer => {
|
|
97
|
+
const hostname = options.hostname ?? "127.0.0.1";
|
|
98
|
+
const path = options.path ?? "/mcp";
|
|
99
|
+
if (!LOOPBACK.has(hostname)) {
|
|
100
|
+
throw new SurfaceError(
|
|
101
|
+
"usage",
|
|
102
|
+
`serving on ${hostname} is refused: only loopback is served, because this is plain HTTP`,
|
|
103
|
+
"bind 127.0.0.1 and reach it through an SSH tunnel or a proxy that terminates TLS",
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
// Checked at run time as well: a caller without the types must not end up serving "Bearer undefined".
|
|
107
|
+
const token: unknown = options.token;
|
|
108
|
+
if (typeof token !== "string" || token === "") {
|
|
109
|
+
throw new SurfaceError(
|
|
110
|
+
"usage",
|
|
111
|
+
"the HTTP server needs a bearer token",
|
|
112
|
+
"set one with --token-env NAME",
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
const expected = digest(`Bearer ${token}`);
|
|
116
|
+
const authorized = (request: Request): boolean =>
|
|
117
|
+
timingSafeEqual(
|
|
118
|
+
digest(request.headers.get("authorization") ?? ""),
|
|
119
|
+
expected,
|
|
120
|
+
);
|
|
121
|
+
const server = Bun.serve({
|
|
122
|
+
hostname,
|
|
123
|
+
port: options.port ?? 0,
|
|
124
|
+
// Whatever a handler throws stays in this process: the default error page would print it.
|
|
125
|
+
error: () => refuse(null, 500, ERRORS.internal, "Internal error"),
|
|
126
|
+
fetch: async (request) => {
|
|
127
|
+
if (new URL(request.url).pathname !== path)
|
|
128
|
+
return new Response("not found", { status: 404 });
|
|
129
|
+
if (!originAllowed(request))
|
|
130
|
+
return refuse(null, 403, ERRORS.invalidRequest, "Origin not allowed");
|
|
131
|
+
if (!authorized(request)) {
|
|
132
|
+
return new Response("unauthorized", {
|
|
133
|
+
status: 401,
|
|
134
|
+
headers: { "www-authenticate": "Bearer" },
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
if (request.method !== "POST")
|
|
138
|
+
return new Response("method not allowed", {
|
|
139
|
+
status: 405,
|
|
140
|
+
headers: { allow: "POST" },
|
|
141
|
+
});
|
|
142
|
+
let message: unknown;
|
|
143
|
+
try {
|
|
144
|
+
message = await request.json();
|
|
145
|
+
} catch {
|
|
146
|
+
return refuse(null, 400, ERRORS.parse, "Parse error");
|
|
147
|
+
}
|
|
148
|
+
if (!isObject(message))
|
|
149
|
+
return refuse(null, 400, ERRORS.invalidRequest, "Invalid Request");
|
|
150
|
+
const params = isObject(message["params"]) ? message["params"] : {};
|
|
151
|
+
const modern =
|
|
152
|
+
isObject(params["_meta"]) && META_VERSION in params["_meta"];
|
|
153
|
+
if (modern) {
|
|
154
|
+
const problem = headerProblem(request, message);
|
|
155
|
+
// This reply echoes the caller's id and never reaches the handler, so it is redacted here.
|
|
156
|
+
if (problem !== undefined)
|
|
157
|
+
return json(
|
|
158
|
+
await handler.redact({
|
|
159
|
+
jsonrpc: "2.0",
|
|
160
|
+
id: message["id"] ?? null,
|
|
161
|
+
error: {
|
|
162
|
+
code: ERRORS.headerMismatch,
|
|
163
|
+
message: `Header mismatch: ${problem}`,
|
|
164
|
+
},
|
|
165
|
+
}),
|
|
166
|
+
400,
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
const reply = await handler.handle(message, {
|
|
170
|
+
legacy: modern ? undefined : "stateless",
|
|
171
|
+
});
|
|
172
|
+
if (reply === undefined) return new Response(null, { status: 202 });
|
|
173
|
+
return json(reply, statusOf(reply, modern));
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
return {
|
|
177
|
+
url: `http://${hostname.includes(":") ? `[${hostname}]` : hostname}:${server.port}${path}`,
|
|
178
|
+
stop: () => server.stop(true),
|
|
179
|
+
};
|
|
180
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export { s, problems, conforms } from "./schema.ts";
|
|
2
|
+
export type {
|
|
3
|
+
Doc,
|
|
4
|
+
Infer,
|
|
5
|
+
JsonSchema,
|
|
6
|
+
ObjectOf,
|
|
7
|
+
Schema,
|
|
8
|
+
Shape,
|
|
9
|
+
} from "./schema.ts";
|
|
10
|
+
export {
|
|
11
|
+
bind,
|
|
12
|
+
defineSurface,
|
|
13
|
+
describeError,
|
|
14
|
+
entries,
|
|
15
|
+
internalError,
|
|
16
|
+
isOp,
|
|
17
|
+
op,
|
|
18
|
+
secretTally,
|
|
19
|
+
SurfaceError,
|
|
20
|
+
} from "./surface.ts";
|
|
21
|
+
export type {
|
|
22
|
+
Annotations,
|
|
23
|
+
AnyOp,
|
|
24
|
+
Client,
|
|
25
|
+
Described,
|
|
26
|
+
Entry,
|
|
27
|
+
Op,
|
|
28
|
+
Ops,
|
|
29
|
+
SurfaceDefinition,
|
|
30
|
+
} from "./surface.ts";
|
|
31
|
+
export { runCli } from "./cli.ts";
|
|
32
|
+
export type { CliIo } from "./cli.ts";
|
|
33
|
+
export {
|
|
34
|
+
ERRORS,
|
|
35
|
+
LEGACY_VERSIONS,
|
|
36
|
+
MODERN_VERSIONS,
|
|
37
|
+
mcpHandler,
|
|
38
|
+
toolName,
|
|
39
|
+
} from "./mcp.ts";
|
|
40
|
+
export type { Connection, McpHandler, McpOptions, Reply, Tool } from "./mcp.ts";
|
|
41
|
+
export { serveStdio } from "./stdio.ts";
|
|
42
|
+
export type { StdioStreams } from "./stdio.ts";
|
|
43
|
+
export { serveHttp } from "./http.ts";
|
|
44
|
+
export type { HttpOptions, HttpServer } from "./http.ts";
|