narai-primitives 2.1.3 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -4
- package/dist/config/load.d.ts.map +1 -1
- package/dist/config/load.js +12 -1
- package/dist/config/load.js.map +1 -1
- package/dist/connectors/confluence/index.d.ts +3 -1
- package/dist/connectors/confluence/index.d.ts.map +1 -1
- package/dist/connectors/confluence/index.js +246 -31
- package/dist/connectors/confluence/index.js.map +1 -1
- package/dist/connectors/confluence/lib/confluence_client.d.ts +50 -30
- package/dist/connectors/confluence/lib/confluence_client.d.ts.map +1 -1
- package/dist/connectors/confluence/lib/confluence_client.js +69 -225
- package/dist/connectors/confluence/lib/confluence_client.js.map +1 -1
- package/dist/connectors/db/connector.d.ts.map +1 -1
- package/dist/connectors/db/connector.js +12 -6
- package/dist/connectors/db/connector.js.map +1 -1
- package/dist/connectors/db/dispatcher.d.ts +3 -2
- package/dist/connectors/db/dispatcher.d.ts.map +1 -1
- package/dist/connectors/db/dispatcher.js +142 -40
- package/dist/connectors/db/dispatcher.js.map +1 -1
- package/dist/connectors/db/index.d.ts +9 -0
- package/dist/connectors/db/index.d.ts.map +1 -1
- package/dist/connectors/db/index.js +9 -0
- package/dist/connectors/db/index.js.map +1 -1
- package/dist/connectors/db/lib/audit.d.ts.map +1 -1
- package/dist/connectors/db/lib/audit.js +46 -4
- package/dist/connectors/db/lib/audit.js.map +1 -1
- package/dist/connectors/db/lib/drivers/dynamodb.d.ts.map +1 -1
- package/dist/connectors/db/lib/drivers/dynamodb.js +24 -4
- package/dist/connectors/db/lib/drivers/dynamodb.js.map +1 -1
- package/dist/connectors/db/lib/drivers/mysql.js +1 -1
- package/dist/connectors/db/lib/drivers/mysql.js.map +1 -1
- package/dist/connectors/db/lib/drivers/postgresql.js +1 -1
- package/dist/connectors/db/lib/drivers/postgresql.js.map +1 -1
- package/dist/connectors/db/lib/drivers/sqlite.d.ts.map +1 -1
- package/dist/connectors/db/lib/drivers/sqlite.js +9 -5
- package/dist/connectors/db/lib/drivers/sqlite.js.map +1 -1
- package/dist/connectors/db/lib/drivers/sqlserver.d.ts.map +1 -1
- package/dist/connectors/db/lib/drivers/sqlserver.js +66 -32
- package/dist/connectors/db/lib/drivers/sqlserver.js.map +1 -1
- package/dist/connectors/db/lib/environments.d.ts +16 -0
- package/dist/connectors/db/lib/environments.d.ts.map +1 -1
- package/dist/connectors/db/lib/environments.js +16 -0
- package/dist/connectors/db/lib/environments.js.map +1 -1
- package/dist/connectors/db/lib/grant-store.d.ts +77 -0
- package/dist/connectors/db/lib/grant-store.d.ts.map +1 -0
- package/dist/connectors/db/lib/grant-store.js +158 -0
- package/dist/connectors/db/lib/grant-store.js.map +1 -0
- package/dist/connectors/db/lib/plugin_config.d.ts +2 -0
- package/dist/connectors/db/lib/plugin_config.d.ts.map +1 -1
- package/dist/connectors/db/lib/plugin_config.js +23 -2
- package/dist/connectors/db/lib/plugin_config.js.map +1 -1
- package/dist/connectors/db/lib/policy.d.ts +50 -14
- package/dist/connectors/db/lib/policy.d.ts.map +1 -1
- package/dist/connectors/db/lib/policy.js +298 -74
- package/dist/connectors/db/lib/policy.js.map +1 -1
- package/dist/connectors/github/actions/_fields.d.ts +18 -0
- package/dist/connectors/github/actions/_fields.d.ts.map +1 -0
- package/dist/connectors/github/actions/_fields.js +29 -0
- package/dist/connectors/github/actions/_fields.js.map +1 -0
- package/dist/connectors/github/actions/_pagination.d.ts +12 -0
- package/dist/connectors/github/actions/_pagination.d.ts.map +1 -0
- package/dist/connectors/github/actions/_pagination.js +26 -0
- package/dist/connectors/github/actions/_pagination.js.map +1 -0
- package/dist/connectors/github/actions/_types.d.ts +14 -0
- package/dist/connectors/github/actions/_types.d.ts.map +1 -0
- package/dist/connectors/github/actions/_types.js +2 -0
- package/dist/connectors/github/actions/_types.js.map +1 -0
- package/dist/connectors/github/actions/comments.d.ts +3 -0
- package/dist/connectors/github/actions/comments.d.ts.map +1 -0
- package/dist/connectors/github/actions/comments.js +166 -0
- package/dist/connectors/github/actions/comments.js.map +1 -0
- package/dist/connectors/github/actions/issues.d.ts +3 -0
- package/dist/connectors/github/actions/issues.d.ts.map +1 -0
- package/dist/connectors/github/actions/issues.js +129 -0
- package/dist/connectors/github/actions/issues.js.map +1 -0
- package/dist/connectors/github/actions/pulls.d.ts +3 -0
- package/dist/connectors/github/actions/pulls.d.ts.map +1 -0
- package/dist/connectors/github/actions/pulls.js +182 -0
- package/dist/connectors/github/actions/pulls.js.map +1 -0
- package/dist/connectors/github/actions/reads.d.ts +3 -0
- package/dist/connectors/github/actions/reads.d.ts.map +1 -0
- package/dist/connectors/github/actions/reads.js +349 -0
- package/dist/connectors/github/actions/reads.js.map +1 -0
- package/dist/connectors/github/actions/releases.d.ts +3 -0
- package/dist/connectors/github/actions/releases.d.ts.map +1 -0
- package/dist/connectors/github/actions/releases.js +124 -0
- package/dist/connectors/github/actions/releases.js.map +1 -0
- package/dist/connectors/github/actions/workflows.d.ts +3 -0
- package/dist/connectors/github/actions/workflows.d.ts.map +1 -0
- package/dist/connectors/github/actions/workflows.js +224 -0
- package/dist/connectors/github/actions/workflows.js.map +1 -0
- package/dist/connectors/github/index.d.ts +13 -1
- package/dist/connectors/github/index.d.ts.map +1 -1
- package/dist/connectors/github/index.js +33 -396
- package/dist/connectors/github/index.js.map +1 -1
- package/dist/connectors/github/lib/github_client.d.ts +242 -29
- package/dist/connectors/github/lib/github_client.d.ts.map +1 -1
- package/dist/connectors/github/lib/github_client.js +202 -256
- package/dist/connectors/github/lib/github_client.js.map +1 -1
- package/dist/connectors/github/lib/github_config.d.ts +10 -0
- package/dist/connectors/github/lib/github_config.d.ts.map +1 -0
- package/dist/connectors/github/lib/github_config.js +79 -0
- package/dist/connectors/github/lib/github_config.js.map +1 -0
- package/dist/connectors/gitlab/actions/_fields.d.ts +20 -0
- package/dist/connectors/gitlab/actions/_fields.d.ts.map +1 -0
- package/dist/connectors/gitlab/actions/_fields.js +44 -0
- package/dist/connectors/gitlab/actions/_fields.js.map +1 -0
- package/dist/connectors/gitlab/actions/_pagination.d.ts +19 -0
- package/dist/connectors/gitlab/actions/_pagination.d.ts.map +1 -0
- package/dist/connectors/gitlab/actions/_pagination.js +33 -0
- package/dist/connectors/gitlab/actions/_pagination.js.map +1 -0
- package/dist/connectors/gitlab/actions/_types.d.ts +12 -0
- package/dist/connectors/gitlab/actions/_types.d.ts.map +1 -0
- package/dist/connectors/gitlab/actions/_types.js +2 -0
- package/dist/connectors/gitlab/actions/_types.js.map +1 -0
- package/dist/connectors/gitlab/actions/issues.d.ts +3 -0
- package/dist/connectors/gitlab/actions/issues.d.ts.map +1 -0
- package/dist/connectors/gitlab/actions/issues.js +119 -0
- package/dist/connectors/gitlab/actions/issues.js.map +1 -0
- package/dist/connectors/gitlab/actions/merges.d.ts +3 -0
- package/dist/connectors/gitlab/actions/merges.d.ts.map +1 -0
- package/dist/connectors/gitlab/actions/merges.js +198 -0
- package/dist/connectors/gitlab/actions/merges.js.map +1 -0
- package/dist/connectors/gitlab/actions/notes.d.ts +3 -0
- package/dist/connectors/gitlab/actions/notes.d.ts.map +1 -0
- package/dist/connectors/gitlab/actions/notes.js +145 -0
- package/dist/connectors/gitlab/actions/notes.js.map +1 -0
- package/dist/connectors/gitlab/actions/pipelines.d.ts +3 -0
- package/dist/connectors/gitlab/actions/pipelines.d.ts.map +1 -0
- package/dist/connectors/gitlab/actions/pipelines.js +136 -0
- package/dist/connectors/gitlab/actions/pipelines.js.map +1 -0
- package/dist/connectors/gitlab/actions/reads.d.ts +3 -0
- package/dist/connectors/gitlab/actions/reads.d.ts.map +1 -0
- package/dist/connectors/gitlab/actions/reads.js +422 -0
- package/dist/connectors/gitlab/actions/reads.js.map +1 -0
- package/dist/connectors/gitlab/actions/releases.d.ts +3 -0
- package/dist/connectors/gitlab/actions/releases.d.ts.map +1 -0
- package/dist/connectors/gitlab/actions/releases.js +99 -0
- package/dist/connectors/gitlab/actions/releases.js.map +1 -0
- package/dist/connectors/gitlab/cli.d.ts +3 -0
- package/dist/connectors/gitlab/cli.d.ts.map +1 -0
- package/dist/connectors/gitlab/cli.js +24 -0
- package/dist/connectors/gitlab/cli.js.map +1 -0
- package/dist/connectors/gitlab/index.d.ts +29 -0
- package/dist/connectors/gitlab/index.d.ts.map +1 -0
- package/dist/connectors/gitlab/index.js +95 -0
- package/dist/connectors/gitlab/index.js.map +1 -0
- package/dist/connectors/gitlab/lib/gitlab_client.d.ts +306 -0
- package/dist/connectors/gitlab/lib/gitlab_client.d.ts.map +1 -0
- package/dist/connectors/gitlab/lib/gitlab_client.js +249 -0
- package/dist/connectors/gitlab/lib/gitlab_client.js.map +1 -0
- package/dist/connectors/gitlab/lib/gitlab_config.d.ts +11 -0
- package/dist/connectors/gitlab/lib/gitlab_config.d.ts.map +1 -0
- package/dist/connectors/gitlab/lib/gitlab_config.js +115 -0
- package/dist/connectors/gitlab/lib/gitlab_config.js.map +1 -0
- package/dist/connectors/jira/index.d.ts +3 -1
- package/dist/connectors/jira/index.d.ts.map +1 -1
- package/dist/connectors/jira/index.js +299 -41
- package/dist/connectors/jira/index.js.map +1 -1
- package/dist/connectors/jira/lib/jira_client.d.ts +56 -41
- package/dist/connectors/jira/lib/jira_client.d.ts.map +1 -1
- package/dist/connectors/jira/lib/jira_client.js +71 -248
- package/dist/connectors/jira/lib/jira_client.js.map +1 -1
- package/dist/connectors/linear/cli.d.ts +3 -0
- package/dist/connectors/linear/cli.d.ts.map +1 -0
- package/dist/connectors/linear/cli.js +22 -0
- package/dist/connectors/linear/cli.js.map +1 -0
- package/dist/connectors/linear/index.d.ts +27 -0
- package/dist/connectors/linear/index.d.ts.map +1 -0
- package/dist/connectors/linear/index.js +496 -0
- package/dist/connectors/linear/index.js.map +1 -0
- package/dist/connectors/linear/lib/linear_client.d.ts +249 -0
- package/dist/connectors/linear/lib/linear_client.d.ts.map +1 -0
- package/dist/connectors/linear/lib/linear_client.js +154 -0
- package/dist/connectors/linear/lib/linear_client.js.map +1 -0
- package/dist/connectors/linear/lib/queries.d.ts +15 -0
- package/dist/connectors/linear/lib/queries.d.ts.map +1 -0
- package/dist/connectors/linear/lib/queries.js +188 -0
- package/dist/connectors/linear/lib/queries.js.map +1 -0
- package/dist/connectors/notion/index.d.ts +2 -1
- package/dist/connectors/notion/index.d.ts.map +1 -1
- package/dist/connectors/notion/index.js +213 -28
- package/dist/connectors/notion/index.js.map +1 -1
- package/dist/connectors/notion/lib/markdown_to_blocks.d.ts +21 -0
- package/dist/connectors/notion/lib/markdown_to_blocks.d.ts.map +1 -0
- package/dist/connectors/notion/lib/markdown_to_blocks.js +102 -0
- package/dist/connectors/notion/lib/markdown_to_blocks.js.map +1 -0
- package/dist/connectors/notion/lib/notion_blocks.d.ts +34 -0
- package/dist/connectors/notion/lib/notion_blocks.d.ts.map +1 -0
- package/dist/connectors/notion/lib/notion_blocks.js +87 -0
- package/dist/connectors/notion/lib/notion_blocks.js.map +1 -0
- package/dist/connectors/notion/lib/notion_client.d.ts +35 -25
- package/dist/connectors/notion/lib/notion_client.d.ts.map +1 -1
- package/dist/connectors/notion/lib/notion_client.js +63 -185
- package/dist/connectors/notion/lib/notion_client.js.map +1 -1
- package/dist/hub/index.d.ts.map +1 -1
- package/dist/hub/index.js +23 -3
- package/dist/hub/index.js.map +1 -1
- package/dist/toolkit/agent_resolver.d.ts +14 -4
- package/dist/toolkit/agent_resolver.d.ts.map +1 -1
- package/dist/toolkit/agent_resolver.js +38 -6
- package/dist/toolkit/agent_resolver.js.map +1 -1
- package/dist/toolkit/atlassian/adf_validator.d.ts +45 -0
- package/dist/toolkit/atlassian/adf_validator.d.ts.map +1 -0
- package/dist/toolkit/atlassian/adf_validator.js +83 -0
- package/dist/toolkit/atlassian/adf_validator.js.map +1 -0
- package/dist/toolkit/atlassian/index.d.ts +5 -0
- package/dist/toolkit/atlassian/index.d.ts.map +1 -0
- package/dist/toolkit/atlassian/index.js +5 -0
- package/dist/toolkit/atlassian/index.js.map +1 -0
- package/dist/toolkit/audit/writer.d.ts.map +1 -1
- package/dist/toolkit/audit/writer.js +45 -5
- package/dist/toolkit/audit/writer.js.map +1 -1
- package/dist/toolkit/connector_error.d.ts +12 -0
- package/dist/toolkit/connector_error.d.ts.map +1 -0
- package/dist/toolkit/connector_error.js +18 -0
- package/dist/toolkit/connector_error.js.map +1 -0
- package/dist/toolkit/guardrail.d.ts +12 -2
- package/dist/toolkit/guardrail.d.ts.map +1 -1
- package/dist/toolkit/guardrail.js +17 -3
- package/dist/toolkit/guardrail.js.map +1 -1
- package/dist/toolkit/http_client.d.ts +134 -0
- package/dist/toolkit/http_client.d.ts.map +1 -0
- package/dist/toolkit/http_client.js +385 -0
- package/dist/toolkit/http_client.js.map +1 -0
- package/dist/toolkit/index.d.ts +3 -0
- package/dist/toolkit/index.d.ts.map +1 -1
- package/dist/toolkit/index.js +5 -0
- package/dist/toolkit/index.js.map +1 -1
- package/dist/toolkit/usage/aggregate.d.ts.map +1 -1
- package/dist/toolkit/usage/aggregate.js +19 -3
- package/dist/toolkit/usage/aggregate.js.map +1 -1
- package/package.json +14 -2
- package/plugin-hooks/dispatcher.mjs +639 -0
- package/plugin-hooks/plugin-config.mjs +36 -0
- package/plugins/{aws-agent → aws-connector}/.claude-plugin/plugin.json +1 -1
- package/plugins/{aws-agent → aws-connector}/README.md +7 -7
- package/plugins/{aws-agent/bin/aws-agent → aws-connector/bin/aws-connector} +3 -3
- package/plugins/aws-connector/commands/aws-connector.md +6 -0
- package/plugins/{gcp-agent → aws-connector}/hooks/hooks.json +12 -11
- package/plugins/aws-connector/package.json +9 -0
- package/plugins/aws-connector/plugin-config.json +4 -0
- package/plugins/{aws-agent/skills/aws-agent → aws-connector/skills/aws-connector}/SKILL.md +5 -5
- package/plugins/confluence-connector/.claude-plugin/plugin.json +6 -0
- package/plugins/{confluence-agent → confluence-connector}/README.md +2 -2
- package/plugins/confluence-connector/bin/confluence-connector +17 -0
- package/plugins/confluence-connector/commands/confluence-connector.md +6 -0
- package/plugins/{jira-agent → confluence-connector}/hooks/hooks.json +12 -11
- package/plugins/confluence-connector/package.json +8 -0
- package/plugins/confluence-connector/plugin-config.json +4 -0
- package/plugins/confluence-connector/skills/confluence-connector/SKILL.md +146 -0
- package/plugins/{create-connector → connector-creator}/.claude-plugin/plugin.json +1 -1
- package/plugins/{create-connector → connector-creator}/README.md +2 -2
- package/plugins/connector-creator/skills/connector-creator/SKILL.md +412 -0
- package/plugins/connector-creator/skills/connector-creator/assets/templates/_runtime/connector-gate.mjs.tmpl +120 -0
- package/plugins/connector-creator/skills/connector-creator/assets/templates/composite/SKILL.md.tmpl +26 -0
- package/plugins/connector-creator/skills/connector-creator/assets/templates/composite/bin.tmpl +2 -0
- package/plugins/connector-creator/skills/connector-creator/assets/templates/composite/index.mjs.tmpl +35 -0
- package/plugins/connector-creator/skills/connector-creator/assets/templates/knowledge/SKILL.md.tmpl +23 -0
- package/plugins/connector-creator/skills/connector-creator/assets/templates/shell-gate/SKILL.md.tmpl +27 -0
- package/plugins/connector-creator/skills/connector-creator/assets/templates/shell-gate/gates.json.tmpl +5 -0
- package/plugins/connector-creator/skills/connector-creator/lib/connector-registry.mjs +43 -0
- package/plugins/connector-creator/skills/connector-creator/lib/settings-wiring.mjs +71 -0
- package/plugins/connector-creator/skills/connector-creator/references/connector-contract.md +79 -0
- package/plugins/connector-creator/skills/connector-creator/references/flavor-authoring.md +58 -0
- package/plugins/connector-creator/skills/connector-creator/references/research-patterns.md +51 -0
- package/plugins/{db-agent → db-connector}/.claude-plugin/plugin.json +3 -3
- package/plugins/{db-agent → db-connector}/README.md +2 -2
- package/plugins/{github-agent/bin/github-agent → db-connector/bin/db-connector} +3 -3
- package/plugins/db-connector/commands/db-connector.md +6 -0
- package/plugins/db-connector/gates.json +45 -0
- package/plugins/db-connector/gates.strict-bare.json +13 -0
- package/plugins/{db-agent → db-connector}/hooks/guardrails.json +4 -2
- package/plugins/{aws-agent → db-connector}/hooks/hooks.json +15 -11
- package/plugins/{db-agent → db-connector}/package.json +1 -1
- package/plugins/db-connector/plugin-config.json +5 -0
- package/plugins/{db-agent/skills/db-agent → db-connector/skills/db-connector}/SKILL.md +5 -5
- package/plugins/{gcp-agent → gcp-connector}/.claude-plugin/plugin.json +1 -1
- package/plugins/{gcp-agent → gcp-connector}/README.md +5 -5
- package/plugins/{gcp-agent/bin/gcp-agent → gcp-connector/bin/gcp-connector} +3 -3
- package/plugins/gcp-connector/commands/gcp-connector.md +6 -0
- package/plugins/{github-agent → gcp-connector}/hooks/hooks.json +12 -11
- package/plugins/gcp-connector/package.json +9 -0
- package/plugins/gcp-connector/plugin-config.json +4 -0
- package/plugins/{gcp-agent/skills/gcp-agent → gcp-connector/skills/gcp-connector}/SKILL.md +5 -5
- package/plugins/git-connector/.claude-plugin/plugin.json +6 -0
- package/plugins/git-connector/CONTRIBUTING.md +117 -0
- package/plugins/git-connector/README.md +94 -0
- package/plugins/git-connector/SECURITY.md +143 -0
- package/plugins/git-connector/gates.json +67 -0
- package/plugins/git-connector/hooks/hooks.json +25 -0
- package/plugins/git-connector/package.json +9 -0
- package/plugins/git-connector/plugin-config.json +4 -0
- package/plugins/{github-agent → github-connector}/.claude-plugin/plugin.json +1 -1
- package/plugins/github-connector/README.md +48 -0
- package/plugins/{confluence-agent/bin/confluence-agent → github-connector/bin/github-connector} +3 -3
- package/plugins/github-connector/commands/github-connector.md +6 -0
- package/plugins/github-connector/hooks/hooks.json +50 -0
- package/plugins/{jira-agent → github-connector}/package.json +1 -1
- package/plugins/github-connector/plugin-config.json +4 -0
- package/plugins/github-connector/skills/github-connector/SKILL.md +106 -0
- package/plugins/gitlab-connector/.claude-plugin/plugin.json +6 -0
- package/plugins/gitlab-connector/README.md +62 -0
- package/plugins/{db-agent/bin/db-agent → gitlab-connector/bin/gitlab-connector} +3 -3
- package/plugins/gitlab-connector/commands/gitlab-connector.md +6 -0
- package/plugins/gitlab-connector/gates.json +18 -0
- package/plugins/gitlab-connector/hooks/hooks.json +50 -0
- package/plugins/{confluence-agent → gitlab-connector}/package.json +1 -1
- package/plugins/gitlab-connector/plugin-config.json +4 -0
- package/plugins/gitlab-connector/skills/gitlab-connector/SKILL.md +115 -0
- package/plugins/jira-connector/.claude-plugin/plugin.json +6 -0
- package/plugins/{jira-agent → jira-connector}/README.md +1 -1
- package/plugins/{jira-agent/bin/jira-agent → jira-connector/bin/jira-connector} +2 -2
- package/plugins/jira-connector/commands/jira-connector.md +6 -0
- package/plugins/jira-connector/gates.json +12 -0
- package/plugins/jira-connector/hooks/hooks.json +50 -0
- package/plugins/{github-agent → jira-connector}/package.json +1 -1
- package/plugins/jira-connector/plugin-config.json +4 -0
- package/plugins/jira-connector/skills/jira-connector/SKILL.md +146 -0
- package/plugins/linear-connector/.claude-plugin/plugin.json +6 -0
- package/plugins/linear-connector/README.md +29 -0
- package/plugins/linear-connector/bin/linear-connector +17 -0
- package/plugins/linear-connector/commands/linear-connector.md +6 -0
- package/plugins/linear-connector/hooks/hooks.json +50 -0
- package/plugins/linear-connector/package.json +8 -0
- package/plugins/linear-connector/plugin-config.json +4 -0
- package/plugins/linear-connector/skills/linear-connector/SKILL.md +159 -0
- package/plugins/notion-connector/.claude-plugin/plugin.json +6 -0
- package/plugins/{notion-agent → notion-connector}/README.md +5 -5
- package/plugins/{notion-agent/bin/notion-agent → notion-connector/bin/notion-connector} +2 -2
- package/plugins/notion-connector/commands/notion-connector.md +6 -0
- package/plugins/notion-connector/hooks/hooks.json +50 -0
- package/plugins/notion-connector/package.json +8 -0
- package/plugins/notion-connector/plugin-config.json +4 -0
- package/plugins/notion-connector/skills/notion-connector/SKILL.md +141 -0
- package/dist/connectors/confluence/lib/confluence_error.d.ts +0 -13
- package/dist/connectors/confluence/lib/confluence_error.d.ts.map +0 -1
- package/dist/connectors/confluence/lib/confluence_error.js +0 -19
- package/dist/connectors/confluence/lib/confluence_error.js.map +0 -1
- package/dist/connectors/github/lib/github_error.d.ts +0 -11
- package/dist/connectors/github/lib/github_error.d.ts.map +0 -1
- package/dist/connectors/github/lib/github_error.js +0 -17
- package/dist/connectors/github/lib/github_error.js.map +0 -1
- package/dist/connectors/jira/lib/jira_error.d.ts +0 -11
- package/dist/connectors/jira/lib/jira_error.d.ts.map +0 -1
- package/dist/connectors/jira/lib/jira_error.js +0 -17
- package/dist/connectors/jira/lib/jira_error.js.map +0 -1
- package/dist/connectors/notion/lib/notion_error.d.ts +0 -12
- package/dist/connectors/notion/lib/notion_error.d.ts.map +0 -1
- package/dist/connectors/notion/lib/notion_error.js +0 -18
- package/dist/connectors/notion/lib/notion_error.js.map +0 -1
- package/plugins/aws-agent/commands/aws-agent.md +0 -6
- package/plugins/aws-agent/hooks/reminder.mjs +0 -16
- package/plugins/aws-agent/package.json +0 -9
- package/plugins/confluence-agent/.claude-plugin/plugin.json +0 -6
- package/plugins/confluence-agent/commands/confluence-agent.md +0 -6
- package/plugins/confluence-agent/hooks/hooks.json +0 -49
- package/plugins/confluence-agent/hooks/reminder.mjs +0 -25
- package/plugins/confluence-agent/skills/confluence-agent/SKILL.md +0 -40
- package/plugins/create-connector/skills/create-connector/SKILL.md +0 -252
- package/plugins/db-agent/commands/db-agent.md +0 -6
- package/plugins/db-agent/hooks/db-guard.mjs +0 -110
- package/plugins/db-agent/hooks/hooks.json +0 -61
- package/plugins/db-agent/hooks/reminder.mjs +0 -16
- package/plugins/gcp-agent/commands/gcp-agent.md +0 -6
- package/plugins/gcp-agent/hooks/reminder.mjs +0 -16
- package/plugins/gcp-agent/package.json +0 -9
- package/plugins/github-agent/README.md +0 -13
- package/plugins/github-agent/commands/github-agent.md +0 -6
- package/plugins/github-agent/hooks/reminder.mjs +0 -16
- package/plugins/github-agent/skills/github-agent/SKILL.md +0 -41
- package/plugins/jira-agent/.claude-plugin/plugin.json +0 -6
- package/plugins/jira-agent/commands/jira-agent.md +0 -6
- package/plugins/jira-agent/hooks/reminder.mjs +0 -16
- package/plugins/jira-agent/skills/jira-agent/SKILL.md +0 -37
- package/plugins/notion-agent/.claude-plugin/plugin.json +0 -6
- package/plugins/notion-agent/commands/notion-agent.md +0 -6
- package/plugins/notion-agent/hooks/hooks.json +0 -49
- package/plugins/notion-agent/hooks/reminder.mjs +0 -17
- package/plugins/notion-agent/package.json +0 -8
- package/plugins/notion-agent/skills/notion-agent/SKILL.md +0 -48
- /package/plugins/{create-connector/skills/create-connector → connector-creator/skills/connector-creator}/assets/templates/bin.tmpl +0 -0
- /package/plugins/{create-connector/skills/create-connector → connector-creator/skills/connector-creator}/assets/templates/connector-SKILL.md.tmpl +0 -0
- /package/plugins/{create-connector/skills/create-connector → connector-creator/skills/connector-creator}/assets/templates/index.mjs.tmpl +0 -0
- /package/plugins/{create-connector/skills/create-connector → connector-creator/skills/connector-creator}/assets/templates/tests-example.mjs.tmpl +0 -0
- /package/plugins/{create-connector/skills/create-connector → connector-creator/skills/connector-creator}/references/action-design.md +0 -0
- /package/plugins/{create-connector/skills/create-connector → connector-creator/skills/connector-creator}/references/auth-patterns.md +0 -0
- /package/plugins/{create-connector/skills/create-connector → connector-creator/skills/connector-creator}/references/connector-anatomy.md +0 -0
- /package/plugins/{create-connector/skills/create-connector/references/db-agent-pointer.md → connector-creator/skills/connector-creator/references/db-connector-pointer.md} +0 -0
- /package/plugins/{create-connector/skills/create-connector → connector-creator/skills/connector-creator}/references/plugin-layer.md +0 -0
- /package/plugins/{create-connector/skills/create-connector → connector-creator/skills/connector-creator}/references/template-sync.md +0 -0
- /package/plugins/{create-connector/skills/create-connector → connector-creator/skills/connector-creator}/references/verification.md +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gcp-connector-plugin-runtime",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Runtime manifest for gcp-connector-plugin. The SessionStart hook runs `npm install` on this manifest into ${CLAUDE_PLUGIN_DATA}.",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"narai-primitives": "^2.1.3"
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: gcp-
|
|
2
|
+
name: gcp-connector
|
|
3
3
|
description: |
|
|
4
4
|
Use when the user asks about read-only GCP inventory — Cloud Run services,
|
|
5
5
|
Cloud SQL instances, Pub/Sub topics, or Cloud Logging entries. Queries are
|
|
@@ -7,16 +7,16 @@ description: |
|
|
|
7
7
|
context: fork
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
-
# GCP
|
|
10
|
+
# GCP Connector
|
|
11
11
|
|
|
12
|
-
Answer the user's question by invoking the `gcp-
|
|
12
|
+
Answer the user's question by invoking the `gcp-connector` binary exposed by
|
|
13
13
|
this plugin. It delegates to `narai-primitives/gcp`, which speaks to
|
|
14
14
|
GCP by shelling out to `gcloud` / `bq` with Application Default Credentials.
|
|
15
15
|
|
|
16
16
|
## Invocation
|
|
17
17
|
|
|
18
18
|
```
|
|
19
|
-
gcp-
|
|
19
|
+
gcp-connector --action <action> --params '<json>'
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
The CLI writes a single JSON envelope to stdout and exits 0 on success, 1
|
|
@@ -35,7 +35,7 @@ orchestrator.
|
|
|
35
35
|
Example:
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
|
-
gcp-
|
|
38
|
+
gcp-connector --action list_services --params '{"project_id":"acme-prod-123"}'
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
## Credentials
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Contributing to `git-connector`
|
|
2
|
+
|
|
3
|
+
This plugin is small. Contributions usually land in one of three places:
|
|
4
|
+
|
|
5
|
+
1. **A new default rule** — see [Adding a default rule](#adding-a-default-rule).
|
|
6
|
+
2. **A bug in an existing rule** — false positive, missed pattern, edge case in the splitter. See [Fixing a rule](#fixing-a-rule).
|
|
7
|
+
3. **Hook contract drift** — Claude Code changes the PreToolUse payload shape or output expectations. See [Hook contract](#hook-contract).
|
|
8
|
+
|
|
9
|
+
For changes elsewhere in the repo (other connectors, toolkit, hub), follow the root [`CONTRIBUTING.md`](../../CONTRIBUTING.md). Plugin-specific guidance below.
|
|
10
|
+
|
|
11
|
+
## Local dev loop
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
# from the repo root
|
|
15
|
+
npm install
|
|
16
|
+
npx vitest run tests/plugins/git-connector/
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The plugin wires its `PreToolUse` hook to the shared `plugin-hooks/dispatcher.mjs` in `narai-primitives`. To smoke-test the gate end-to-end against a fake stdin payload, point `CLAUDE_PLUGIN_ROOT` at the plugin and run the dispatcher directly:
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
echo '{"tool_name":"Bash","tool_input":{"command":"git push origin main"},"hook_event_name":"PreToolUse"}' \
|
|
23
|
+
| CLAUDE_PLUGIN_ROOT=plugins/git-connector \
|
|
24
|
+
CLAUDE_PLUGIN_DATA=/tmp/git-connector-data \
|
|
25
|
+
node plugin-hooks/dispatcher.mjs pre-tool-use
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Should print `{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"deny",...}}` to stdout. A non-git or unmatched command produces no output (the dispatcher's signal that it has no opinion).
|
|
29
|
+
|
|
30
|
+
## Adding a default rule
|
|
31
|
+
|
|
32
|
+
Default rules live in [`gates.json`](gates.json). Each rule has the shape:
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"name": "rule_name",
|
|
37
|
+
"decision": "deny",
|
|
38
|
+
"reason": "Sentence shown to the user in the prompt.",
|
|
39
|
+
"pattern": "^git\\s+<verb>\\b..."
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`pattern` is a JavaScript regex source. The dispatcher splits each compound command on `&&`, `||`, `;`, `|`, strips leading env-prefixes and `sudo`/`nice`/`time`, then tests each segment against every rule. The strictest matching decision wins (`deny` > `ask` > `allow`).
|
|
44
|
+
|
|
45
|
+
### Steps
|
|
46
|
+
|
|
47
|
+
1. Add the rule object to the `rules` array in [`gates.json`](gates.json). Keep `deny` rules at the top, `ask` rules below, ordered roughly by specificity — more specific rules first so their reason text wins ties.
|
|
48
|
+
|
|
49
|
+
2. Add a `describe` block in [`tests/plugins/git-connector/gates.test.ts`](../../tests/plugins/git-connector/gates.test.ts) covering:
|
|
50
|
+
- **Positive cases**: each command form your rule is meant to catch (use `it.each`).
|
|
51
|
+
- **Negative cases**: adjacent-but-safe commands that must not fire. This is where most rule-design bugs hide. If you skip negative cases, your rule will produce false positives in the wild.
|
|
52
|
+
- **Precedence interaction**: if your rule's decision can be overruled by an existing `deny` rule, add a test that verifies the strictest-wins resolution.
|
|
53
|
+
|
|
54
|
+
3. Add an end-to-end case in [`tests/plugins/git-connector/smoke.test.ts`](../../tests/plugins/git-connector/smoke.test.ts) if the rule covers a category not already exercised.
|
|
55
|
+
|
|
56
|
+
4. Document the rule in [`README.md`](README.md) under "Default rules". Match the existing table style.
|
|
57
|
+
|
|
58
|
+
5. If the rule has known false-positive scenarios, document them under "Limitations" in `README.md` and mention that operators can disable via `NARAI_GATE_DISABLE=<rule_name>`.
|
|
59
|
+
|
|
60
|
+
### Style guidance
|
|
61
|
+
|
|
62
|
+
- **Keep the regex anchored.** All default rules anchor on `^git\s+<verb>` so a string like `echo "git push"` doesn't trigger them. The dispatcher strips env-prefixes (`FOO=bar`) and `sudo`/`nice`/`time` before rules see the segment.
|
|
63
|
+
- **Avoid lookbehinds and back-references** unless you have a clear reason. They make the rule harder to read and slower; this code runs on every Bash call.
|
|
64
|
+
- **Bias toward over-flagging.** A safe command flagged for confirmation is annoying; a dangerous command that slipped through is the failure mode this plugin exists to prevent.
|
|
65
|
+
- **Don't push behaviour into the dispatcher.** Rules are pure regex; if you need git state (current branch, remote URL), that's a real proposal — open an issue first to discuss the added I/O cost on every Bash call.
|
|
66
|
+
|
|
67
|
+
## Fixing a rule
|
|
68
|
+
|
|
69
|
+
If you're chasing a false positive or missed pattern:
|
|
70
|
+
|
|
71
|
+
1. Reproduce in a test first — add the failing case to `gates.test.ts` so the regression is captured. The fix should make the new case pass without breaking the existing tests.
|
|
72
|
+
2. Prefer narrowing the regex over deleting the rule. If the rule is genuinely unsalvageable, delete it cleanly (rule object in `gates.json`, tests, README row, any `NARAI_GATE_DISABLE` guidance) in a single commit.
|
|
73
|
+
3. If the false positive is rare and the rule is otherwise valuable, document it under "Limitations" rather than weakening the rule.
|
|
74
|
+
|
|
75
|
+
## Hook contract
|
|
76
|
+
|
|
77
|
+
The dispatcher reads stdin and writes stdout per the [Claude Code hook
|
|
78
|
+
contract](https://code.claude.com/docs/en/hooks.md). The current shape
|
|
79
|
+
the dispatcher relies on:
|
|
80
|
+
|
|
81
|
+
- **Input**: `{tool_name: "Bash", tool_input: {command: string}, ...}`
|
|
82
|
+
- **Output**: `{hookSpecificOutput: {hookEventName: "PreToolUse", permissionDecision: "allow"|"deny"|"ask", permissionDecisionReason: string}}`
|
|
83
|
+
- **Exit code**: `0` for any decision (the JSON is the signal). Non-zero is reserved for genuine dispatcher errors (missing `CLAUDE_PLUGIN_ROOT`, missing `plugin-config.json`, etc.).
|
|
84
|
+
|
|
85
|
+
If Claude Code changes the contract:
|
|
86
|
+
|
|
87
|
+
1. Update [`plugin-hooks/dispatcher.mjs`](../../plugin-hooks/dispatcher.mjs) and the README's "How it works" section.
|
|
88
|
+
2. Bump `version` in `.claude-plugin/plugin.json` and `package.json`.
|
|
89
|
+
3. Test against the new Claude Code version with the smoke-test command above before merging.
|
|
90
|
+
|
|
91
|
+
The dispatcher is shared across every plugin in this repo — contract changes affect them all and need broader review.
|
|
92
|
+
|
|
93
|
+
## Code conventions
|
|
94
|
+
|
|
95
|
+
- **`gates.json` is the only file most rule changes touch.** Pure JSON, no JS. Keep formatting consistent with the existing entries.
|
|
96
|
+
- **Runtime deps come via `package.json`.** The plugin declares `narai-primitives` as a dep so the SessionStart hook can `npm install` it into `CLAUDE_PLUGIN_DATA` before the dispatcher runs. Don't add other runtime deps without a strong reason.
|
|
97
|
+
- **2-space indent.** Tests are TypeScript because Vitest's include glob is `**/*.test.ts`.
|
|
98
|
+
- **No emojis** in source or docs (matches repo style).
|
|
99
|
+
|
|
100
|
+
## Commit + PR hygiene
|
|
101
|
+
|
|
102
|
+
- Commit messages follow conventional-commits style: `feat(git-connector): ...`, `fix(git-connector): ...`, `docs(git-connector): ...`, `test(git-connector): ...`.
|
|
103
|
+
- One logical change per commit. If a rule fix needs a test update and a README update, those go in the same commit.
|
|
104
|
+
- Run `npx vitest run tests/plugins/git-connector/` before pushing. The full repo suite (`npx vitest run`) should also pass — the plugin shares the dispatcher with every connector, so dispatcher-touching changes need the broader suite green.
|
|
105
|
+
- Open the PR against `main`. The plugin lives outside the connector PR stack and ships independently.
|
|
106
|
+
|
|
107
|
+
## Out of scope
|
|
108
|
+
|
|
109
|
+
This plugin deliberately does NOT:
|
|
110
|
+
|
|
111
|
+
- **Block the command.** The strictest decision is `deny`, which makes Claude refuse and surfaces the reason — but the user can still run the command themselves outside the session. See [SECURITY.md](SECURITY.md) for the full list of bypass paths and why they are intentional.
|
|
112
|
+
- **Track git state.** No `git rev-parse`, no remote URL inspection, no branch detection. Rules operate on the literal command string. If you want behaviour gated on current branch (e.g., "deny rebase only when on main"), that's a real proposal — open an issue first to discuss whether the added I/O cost on every Bash call is worth it.
|
|
113
|
+
- **Replace branch protection.** Server-side branch protection rules on the remote are the actual enforcement layer. This plugin reduces blast radius from agentic flows; it does not gate the remote.
|
|
114
|
+
|
|
115
|
+
## License
|
|
116
|
+
|
|
117
|
+
MIT — see `LICENSE` at the repo root.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# git-connector
|
|
2
|
+
|
|
3
|
+
Claude Code plugin that gates risky `git` commands at the `PreToolUse` hook.
|
|
4
|
+
No agents, no actions — pure permission gating.
|
|
5
|
+
|
|
6
|
+
## Default rules
|
|
7
|
+
|
|
8
|
+
| Rule | Decision | When it fires |
|
|
9
|
+
|---|---|---|
|
|
10
|
+
| `push_main` | **deny** | `git push` whose refspec targets `main` or `master` |
|
|
11
|
+
| `force_push` | **ask** | `git push --force` / `-f` / `--force-with-lease` |
|
|
12
|
+
| `delete_branch_remote` | **ask** | `git push --delete`, `git push -d`, or `git push <remote> :branch` |
|
|
13
|
+
| `push` | **ask** | Any other `git push` |
|
|
14
|
+
| `delete_branch_local` | **ask** | `git branch -D`, `git branch --delete --force` |
|
|
15
|
+
| `reset_hard` | **ask** | `git reset --hard` |
|
|
16
|
+
| `checkout_discard` | **ask** | `git checkout <pathspec>` / `git restore --worktree` / `git checkout .` |
|
|
17
|
+
| `clean_force` | **ask** | `git clean -f…` (any `-f` variant, including `-fdx`) |
|
|
18
|
+
|
|
19
|
+
Decision precedence: `deny` > `ask` > `allow`. If multiple rules match across
|
|
20
|
+
a compound command (`a && b`), the strictest wins.
|
|
21
|
+
|
|
22
|
+
If no rule matches, the hook emits no decision and Claude Code's default
|
|
23
|
+
permission flow continues.
|
|
24
|
+
|
|
25
|
+
## Disabling rules
|
|
26
|
+
|
|
27
|
+
Set `NARAI_GATE_DISABLE` to a comma-separated list of rule names:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
export NARAI_GATE_DISABLE=push,push_main
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
…disables both the plain-`push` ask and the protected-branch deny.
|
|
34
|
+
|
|
35
|
+
## Adding rules
|
|
36
|
+
|
|
37
|
+
Drop extra rules at `~/.connectors/connectors/<slug>/gates.json` — the
|
|
38
|
+
shared dispatcher scans this path and layers the rules on top of the
|
|
39
|
+
defaults shipped with this plugin:
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"rules": [
|
|
44
|
+
{
|
|
45
|
+
"name": "deny_release",
|
|
46
|
+
"decision": "deny",
|
|
47
|
+
"reason": "Pushing to release branches needs SRE approval.",
|
|
48
|
+
"pattern": "^git\\s+push\\s+\\S+\\s+release\\b"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "ask_worktree_remove",
|
|
52
|
+
"decision": "ask",
|
|
53
|
+
"reason": "Removing a worktree is irreversible.",
|
|
54
|
+
"pattern": "^git\\s+worktree\\s+remove\\b"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`pattern` is a JavaScript regex source applied to each command segment
|
|
61
|
+
(after splitting on `&&`, `||`, `;`, `|`). `decision` must be one of
|
|
62
|
+
`allow`, `ask`, `deny`. `reason` is shown to the user in the prompt.
|
|
63
|
+
|
|
64
|
+
Custom rules are evaluated alongside the defaults; the strictest match
|
|
65
|
+
across all rules wins.
|
|
66
|
+
|
|
67
|
+
## How it works
|
|
68
|
+
|
|
69
|
+
`PreToolUse` hooks fire before any Bash invocation. The plugin wires
|
|
70
|
+
this event to the shared `plugin-hooks/dispatcher.mjs` from
|
|
71
|
+
`narai-primitives`, which loads this plugin's `gates.json` (the default
|
|
72
|
+
rules), applies them to `tool_input.command`, and writes a JSON decision
|
|
73
|
+
to stdout per the [hook contract](https://code.claude.com/docs/en/hooks.md).
|
|
74
|
+
|
|
75
|
+
Compound commands (`cd repo && git push origin main`) split on `&&`, `||`,
|
|
76
|
+
`;`, `|` and each segment is classified independently — the strictest
|
|
77
|
+
decision wins. Leading env-var assignments (`FOO=bar git push`) and
|
|
78
|
+
common prefixes (`sudo`, `nice`, `time`) are stripped before matching.
|
|
79
|
+
|
|
80
|
+
## Limitations
|
|
81
|
+
|
|
82
|
+
- The command splitter doesn't track quoted strings — a literal `&&`
|
|
83
|
+
inside single quotes will split the segment. Over-splitting is the
|
|
84
|
+
intended bias for a safety gate.
|
|
85
|
+
- `push_main` matches any `main` or `master` token in the push args.
|
|
86
|
+
A branch literally named `feature/main` would trip this. Disable
|
|
87
|
+
`push_main` via `NARAI_GATE_DISABLE=push_main` if your repo has such names.
|
|
88
|
+
- The hook runs on every Bash call. Performance is dominated by Node
|
|
89
|
+
startup (~30ms cold). The hook itself is O(rules × segments) regex
|
|
90
|
+
matching — negligible.
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
MIT
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
## What this plugin is
|
|
4
|
+
|
|
5
|
+
A `PreToolUse` hook that classifies `git` invocations made through Claude
|
|
6
|
+
Code's `Bash` tool and emits permission decisions (`allow` / `ask` /
|
|
7
|
+
`deny`). It runs inside the user's Claude Code session, on the user's
|
|
8
|
+
machine, with the user's privileges.
|
|
9
|
+
|
|
10
|
+
## What this plugin is NOT
|
|
11
|
+
|
|
12
|
+
**This plugin is not a security boundary.** It is a *speed bump* against
|
|
13
|
+
accidental destructive commands — the same role as a shell alias that
|
|
14
|
+
re-prompts on `rm -rf`. Treat it as a usability guardrail, not access
|
|
15
|
+
control.
|
|
16
|
+
|
|
17
|
+
A user (or anyone with write access to the user's environment) can defeat
|
|
18
|
+
the plugin trivially by:
|
|
19
|
+
|
|
20
|
+
- Running git outside Claude Code (a regular terminal, an IDE git panel, a
|
|
21
|
+
CI runner, etc.). The hook only fires for commands routed through
|
|
22
|
+
Claude Code's `Bash` tool.
|
|
23
|
+
- Disabling the plugin in Claude Code (`/plugin disable git-connector`) or
|
|
24
|
+
removing the marketplace entry.
|
|
25
|
+
- Toggling permission mode to `bypassPermissions` — that mode skips the
|
|
26
|
+
hook entirely.
|
|
27
|
+
- Accepting the `ask` prompt at the moment it appears.
|
|
28
|
+
- Setting `NARAI_GATE_DISABLE` to silence rules by name, or dropping
|
|
29
|
+
a custom `~/.connectors/connectors/<slug>/gates.json` (the dispatcher
|
|
30
|
+
trusts both unconditionally — see "Config file trust" below).
|
|
31
|
+
- Writing a bash command that evades pattern matching (see
|
|
32
|
+
"Pattern-matching limits" below).
|
|
33
|
+
|
|
34
|
+
If your threat model includes a malicious or curious user who has shell
|
|
35
|
+
access on the same machine, this plugin does not help. Use repository
|
|
36
|
+
permissions, branch protection rules on the remote, and CI policy
|
|
37
|
+
checks instead — those run on infrastructure outside the user's control.
|
|
38
|
+
|
|
39
|
+
## What it does help with
|
|
40
|
+
|
|
41
|
+
- Stopping a model (or a sleepy human reviewing model output) from
|
|
42
|
+
running `git push origin main` without confirmation.
|
|
43
|
+
- Catching `git reset --hard` and `git clean -fdx` before they execute.
|
|
44
|
+
- Surfacing a confirmation prompt with operator-supplied reason text so
|
|
45
|
+
the user understands the consequences before approving.
|
|
46
|
+
- Reducing blast radius from agentic flows that compose multiple git
|
|
47
|
+
commands in one Bash invocation — each compound segment is classified
|
|
48
|
+
independently.
|
|
49
|
+
|
|
50
|
+
## Pattern-matching limits
|
|
51
|
+
|
|
52
|
+
The classifier in [`gates.json`](gates.json) works on the literal command string.
|
|
53
|
+
Several constructs can evade matching:
|
|
54
|
+
|
|
55
|
+
- **Quoted operators**: a literal `&&` inside single quotes splits the
|
|
56
|
+
command for the segmenter. Over-splitting is the intended bias —
|
|
57
|
+
every sub-segment still gets classified — but the segments themselves
|
|
58
|
+
are not properly tokenised, so a quoted git argument can defeat
|
|
59
|
+
pattern anchors. Example: `eval 'git push --force'` is classified by
|
|
60
|
+
matching on `git push --force` (the quoted body), but `eval "$(echo
|
|
61
|
+
git push)"` is not.
|
|
62
|
+
- **Indirection**: `bash -c "$cmd"` where `$cmd` expands to a git
|
|
63
|
+
command. The hook sees the outer `bash -c "..."`, not the inner
|
|
64
|
+
expansion, and will not match.
|
|
65
|
+
- **Aliases / functions**: a shell alias `gpf=git push --force` invoked
|
|
66
|
+
as `gpf` does not match because the hook never sees the resolved
|
|
67
|
+
command.
|
|
68
|
+
- **Custom branch names**: the `push_main` rule matches any
|
|
69
|
+
`\bmain\b` or `\bmaster\b` token in the push args. A literal branch
|
|
70
|
+
named `feature/main` will trip the rule. Disable via
|
|
71
|
+
`NARAI_GATE_DISABLE=push_main` if your repo uses such names.
|
|
72
|
+
|
|
73
|
+
If you need defense-in-depth against these, add **server-side branch
|
|
74
|
+
protection** on the remote and require status checks before merge. The
|
|
75
|
+
plugin handles the local-side speed bump; the server enforces the rule.
|
|
76
|
+
|
|
77
|
+
## Config file trust
|
|
78
|
+
|
|
79
|
+
The dispatcher reads any `~/.connectors/connectors/<slug>/gates.json`
|
|
80
|
+
files if present (and the same under the current working directory).
|
|
81
|
+
Those files are trusted unconditionally — if an attacker can write to
|
|
82
|
+
that path, they can:
|
|
83
|
+
|
|
84
|
+
- Add a custom rule with `decision: "allow"` to short-circuit a default
|
|
85
|
+
`ask` (note: `allow` cannot beat a `deny` due to precedence, but it
|
|
86
|
+
can beat an `ask`).
|
|
87
|
+
- Layer a rule with the same regex as a default but a softer decision,
|
|
88
|
+
effectively muffling the prompt with a less alarming reason.
|
|
89
|
+
|
|
90
|
+
Mitigations:
|
|
91
|
+
|
|
92
|
+
- Keep the parent directory (`~/.connectors/`) writable only by the
|
|
93
|
+
owner (`chmod 700`).
|
|
94
|
+
- Treat write access to `~/.connectors/` as equivalent to shell access.
|
|
95
|
+
If your threat model includes someone who can modify files in `$HOME`
|
|
96
|
+
but not run git directly, the gate surface is one of many they could
|
|
97
|
+
weaponise.
|
|
98
|
+
|
|
99
|
+
## Hook contract assumptions
|
|
100
|
+
|
|
101
|
+
The plugin assumes Claude Code honours the documented hook contract
|
|
102
|
+
(reads `tool_input.command` for `Bash` calls, respects
|
|
103
|
+
`hookSpecificOutput.permissionDecision` of `"deny"`, etc.). If a future
|
|
104
|
+
version of Claude Code changes the contract, the plugin may silently
|
|
105
|
+
stop gating. Track the [hooks
|
|
106
|
+
documentation](https://code.claude.com/docs/en/hooks.md) and verify
|
|
107
|
+
behavior after Claude Code upgrades.
|
|
108
|
+
|
|
109
|
+
The hook script itself is the shared `plugin-hooks/dispatcher.mjs` from
|
|
110
|
+
`narai-primitives`. It reads only the stdin payload + on-disk gate
|
|
111
|
+
manifests (`CLAUDE_PLUGIN_ROOT/gates.json`, `~/.connectors/connectors/*/gates.json`, and the same under cwd). It does not invoke `git`, write
|
|
112
|
+
files in the gate path, or make network requests.
|
|
113
|
+
|
|
114
|
+
## Reporting a vulnerability
|
|
115
|
+
|
|
116
|
+
If you find a way for a `deny`-classified command to slip through the
|
|
117
|
+
hook in default configuration (no env vars, no config file), please
|
|
118
|
+
open an issue at
|
|
119
|
+
<https://github.com/narailabs/narai-primitives/issues> with:
|
|
120
|
+
|
|
121
|
+
- The command string the hook should have caught
|
|
122
|
+
- The actual decision the hook produced (or null if none)
|
|
123
|
+
- The Claude Code version and operating system
|
|
124
|
+
|
|
125
|
+
Behaviour we consider intentional, not vulnerabilities:
|
|
126
|
+
|
|
127
|
+
- Bypass via permission-mode toggling (`bypassPermissions`).
|
|
128
|
+
- Bypass via env var or config file overrides.
|
|
129
|
+
- Bypass via shell indirection (`bash -c`, `eval`, aliases) — see
|
|
130
|
+
"Pattern-matching limits".
|
|
131
|
+
- False positives where a safe command matches a default rule (those
|
|
132
|
+
are usability bugs; please file them, but they are not security
|
|
133
|
+
issues).
|
|
134
|
+
|
|
135
|
+
## Supported versions
|
|
136
|
+
|
|
137
|
+
Only the latest published version of `git-connector` receives security
|
|
138
|
+
fixes. Older versions are not maintained. Pin to a specific version
|
|
139
|
+
only if you have a tested compatibility constraint.
|
|
140
|
+
|
|
141
|
+
## License
|
|
142
|
+
|
|
143
|
+
MIT — see `LICENSE` at the repo root.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"name": "git",
|
|
4
|
+
"enforcement": "fail_closed",
|
|
5
|
+
"rules": [
|
|
6
|
+
{
|
|
7
|
+
"name": "push_main",
|
|
8
|
+
"decision": "deny",
|
|
9
|
+
"reason": "Pushing to a protected branch is denied by policy. Open a PR instead.",
|
|
10
|
+
"pattern": "^git\\s+push\\b.*\\b__PROTECTED_BRANCHES__\\b"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "force_push",
|
|
14
|
+
"decision": "deny",
|
|
15
|
+
"reason": "Force push rewrites remote history and is denied. Use --force-with-lease if a force is truly required.",
|
|
16
|
+
"pattern": "^git\\s+push\\b.*\\s(--force(?!-with-lease)\\b|-f\\b)"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "force_with_lease",
|
|
20
|
+
"decision": "ask",
|
|
21
|
+
"reason": "Lease-guarded force push rewrites remote history. Confirm before proceeding.",
|
|
22
|
+
"pattern": "^git\\s+push\\b.*\\s--force-with-lease\\b"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "mirror_push",
|
|
26
|
+
"decision": "deny",
|
|
27
|
+
"reason": "git push --mirror overwrites all remote refs and is denied.",
|
|
28
|
+
"pattern": "^git\\s+push\\b.*\\s--mirror\\b"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "delete_branch_remote",
|
|
32
|
+
"decision": "ask",
|
|
33
|
+
"reason": "Deleting a remote branch is irreversible. Confirm.",
|
|
34
|
+
"pattern": "^git\\s+push\\b.*(\\s(--delete\\b|-d\\b)|\\s\\S+\\s+:[\\w./-]+)"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "push",
|
|
38
|
+
"decision": "ask",
|
|
39
|
+
"reason": "Pushing publishes commits. Confirm before proceeding.",
|
|
40
|
+
"pattern": "^git\\s+push(\\s|$)"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "delete_branch_local",
|
|
44
|
+
"decision": "ask",
|
|
45
|
+
"reason": "Force-deleting a local branch can lose unmerged commits.",
|
|
46
|
+
"pattern": "^git\\s+branch\\s+(?:.*\\s)?(-D\\b|--delete\\s+--force\\b|-Df\\b|-fD\\b)"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "reset_hard",
|
|
50
|
+
"decision": "ask",
|
|
51
|
+
"reason": "git reset --hard discards working-tree and index changes.",
|
|
52
|
+
"pattern": "^git\\s+reset\\s+(?:.*\\s)?--hard\\b"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"name": "checkout_discard",
|
|
56
|
+
"decision": "ask",
|
|
57
|
+
"reason": "This checkout/restore discards working-tree changes.",
|
|
58
|
+
"pattern": "^git\\s+checkout\\s+(?:--\\s+|\\.|[^\\s-]\\S*\\.\\S*)|^git\\s+checkout\\s+\\S+\\s+--\\s+\\S|^git\\s+restore\\s+(?:.*\\s)?(--worktree\\b|-W\\b)|^git\\s+restore\\s+\\.$"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "clean_force",
|
|
62
|
+
"decision": "ask",
|
|
63
|
+
"reason": "git clean -f removes untracked files (and -fdx removes ignored too).",
|
|
64
|
+
"pattern": "^git\\s+clean\\s+(?:.*\\s)?-[a-zA-Z]*f"
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"SessionStart": [
|
|
4
|
+
{
|
|
5
|
+
"hooks": [
|
|
6
|
+
{
|
|
7
|
+
"type": "command",
|
|
8
|
+
"command": "diff -q \"${CLAUDE_PLUGIN_ROOT}/package.json\" \"${CLAUDE_PLUGIN_DATA}/package.json\" >/dev/null 2>&1 || (mkdir -p \"${CLAUDE_PLUGIN_DATA}\" && cp \"${CLAUDE_PLUGIN_ROOT}/package.json\" \"${CLAUDE_PLUGIN_DATA}/\" && cd \"${CLAUDE_PLUGIN_DATA}\" && npm install --no-audit --no-fund) || rm -f \"${CLAUDE_PLUGIN_DATA}/package.json\""
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"PreToolUse": [
|
|
14
|
+
{
|
|
15
|
+
"matcher": "Bash",
|
|
16
|
+
"hooks": [
|
|
17
|
+
{
|
|
18
|
+
"type": "command",
|
|
19
|
+
"command": "node \"${CLAUDE_PLUGIN_DATA}/node_modules/narai-primitives/plugin-hooks/dispatcher.mjs\" pre-tool-use"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "git-connector-plugin-runtime",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"description": "Runtime manifest for git-connector. SessionStart copies this manifest and runs npm install to fetch the shared dispatcher.",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"narai-primitives": "^2.1.3"
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# github-connector plugin
|
|
2
|
+
|
|
3
|
+
Read and write GitHub data — repository info, code search, issues,
|
|
4
|
+
pull requests, comments, releases, and Actions workflows — through the
|
|
5
|
+
narai-primitives connector toolkit's policy gate.
|
|
6
|
+
|
|
7
|
+
## Credentials
|
|
8
|
+
|
|
9
|
+
Set `GITHUB_TOKEN` to a PAT.
|
|
10
|
+
|
|
11
|
+
| Scope | Why |
|
|
12
|
+
|---|---|
|
|
13
|
+
| `repo` | Read + write on issues, PRs, comments, releases, file contents |
|
|
14
|
+
| `workflow` | Required for Actions writes (`rerun_*`, `cancel_workflow_run`, `trigger_workflow_dispatch`) |
|
|
15
|
+
|
|
16
|
+
Tokens without `workflow` will see `AUTH_ERROR` with a scope hint
|
|
17
|
+
when invoking Actions-write endpoints.
|
|
18
|
+
|
|
19
|
+
## Config
|
|
20
|
+
|
|
21
|
+
Place YAML at `~/.github-agent/config.yaml` (user-level) or
|
|
22
|
+
`<cwd>/.github-agent/config.yaml` (repo overlay). Repo overlay wins on
|
|
23
|
+
collisions.
|
|
24
|
+
|
|
25
|
+
```yaml
|
|
26
|
+
policy:
|
|
27
|
+
read: success
|
|
28
|
+
write: escalate
|
|
29
|
+
admin: escalate # enables merge_pull_request
|
|
30
|
+
aspects:
|
|
31
|
+
delete: escalate # cannot be set to success — floored
|
|
32
|
+
approval_mode: confirm_once
|
|
33
|
+
github:
|
|
34
|
+
require_draft_pr: true # forces every create_pull_request to draft=true
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Runtime override: `GITHUB_REQUIRE_DRAFT_PR=1` forces drafts even when
|
|
38
|
+
the YAML says false; `GITHUB_REQUIRE_DRAFT_PR=0` forces non-drafts.
|
|
39
|
+
Invalid values throw at startup.
|
|
40
|
+
|
|
41
|
+
## Action surface
|
|
42
|
+
|
|
43
|
+
36 actions across reads (15), writes (20), and admin (1). See
|
|
44
|
+
`skills/github-connector/SKILL.md` for the full table.
|
|
45
|
+
|
|
46
|
+
## License
|
|
47
|
+
|
|
48
|
+
See repo root.
|
package/plugins/{confluence-agent/bin/confluence-agent → github-connector/bin/github-connector}
RENAMED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
4
|
if [ -z "${CLAUDE_PLUGIN_DATA:-}" ]; then
|
|
5
|
-
echo "
|
|
5
|
+
echo "github-connector: CLAUDE_PLUGIN_DATA is not set (run from inside Claude Code)" >&2
|
|
6
6
|
exit 2
|
|
7
7
|
fi
|
|
8
8
|
|
|
9
|
-
CLI="${CLAUDE_PLUGIN_DATA}/node_modules/narai-primitives/dist/connectors/
|
|
9
|
+
CLI="${CLAUDE_PLUGIN_DATA}/node_modules/narai-primitives/dist/connectors/github/cli.js"
|
|
10
10
|
|
|
11
11
|
if [ ! -f "$CLI" ]; then
|
|
12
|
-
echo "
|
|
12
|
+
echo "github-connector: connector CLI not found at $CLI" >&2
|
|
13
13
|
echo "Restart your Claude Code session to re-run the SessionStart install hook." >&2
|
|
14
14
|
exit 2
|
|
15
15
|
fi
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run a GitHub action via the github-connector connector
|
|
3
|
+
argument-hint: "<action> <params-json>"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Invoke the `github-connector` skill with the user's $ARGUMENTS as the action name and params JSON. Return the connector's JSON envelope verbatim.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"SessionStart": [
|
|
4
|
+
{
|
|
5
|
+
"hooks": [
|
|
6
|
+
{
|
|
7
|
+
"type": "command",
|
|
8
|
+
"command": "diff -q \"${CLAUDE_PLUGIN_ROOT}/package.json\" \"${CLAUDE_PLUGIN_DATA}/package.json\" >/dev/null 2>&1 || (mkdir -p \"${CLAUDE_PLUGIN_DATA}\" && cp \"${CLAUDE_PLUGIN_ROOT}/package.json\" \"${CLAUDE_PLUGIN_DATA}/\" && cd \"${CLAUDE_PLUGIN_DATA}\" && npm install --no-audit --no-fund) || rm -f \"${CLAUDE_PLUGIN_DATA}/package.json\""
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"type": "command",
|
|
12
|
+
"command": "node \"${CLAUDE_PLUGIN_DATA}/node_modules/narai-primitives/plugin-hooks/dispatcher.mjs\" session-start"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"PreToolUse": [
|
|
18
|
+
{
|
|
19
|
+
"matcher": "Bash",
|
|
20
|
+
"hooks": [
|
|
21
|
+
{
|
|
22
|
+
"type": "command",
|
|
23
|
+
"command": "node \"${CLAUDE_PLUGIN_DATA}/node_modules/narai-primitives/plugin-hooks/dispatcher.mjs\" pre-tool-use"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"PostToolUse": [
|
|
29
|
+
{
|
|
30
|
+
"matcher": "Bash",
|
|
31
|
+
"hooks": [
|
|
32
|
+
{
|
|
33
|
+
"type": "command",
|
|
34
|
+
"command": "node \"${CLAUDE_PLUGIN_DATA}/node_modules/narai-primitives/plugin-hooks/dispatcher.mjs\" post-tool-use"
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"SessionEnd": [
|
|
40
|
+
{
|
|
41
|
+
"hooks": [
|
|
42
|
+
{
|
|
43
|
+
"type": "command",
|
|
44
|
+
"command": "node \"${CLAUDE_PLUGIN_DATA}/node_modules/narai-primitives/plugin-hooks/dispatcher.mjs\" session-end"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
}
|