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,43 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import * as yaml from "js-yaml";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Register a connector under <scope>/.connectors/config.yaml.
|
|
7
|
+
*
|
|
8
|
+
* Creates the file with `connectors: {}` if missing. Idempotent: re-running
|
|
9
|
+
* with the same slug overwrites that slug's block but does not duplicate.
|
|
10
|
+
*/
|
|
11
|
+
export function registerConnector(scope, slug, entry) {
|
|
12
|
+
const file = path.join(scope, ".connectors", "config.yaml");
|
|
13
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
14
|
+
|
|
15
|
+
let parsed = { connectors: {} };
|
|
16
|
+
if (fs.existsSync(file)) {
|
|
17
|
+
let raw;
|
|
18
|
+
try {
|
|
19
|
+
raw = fs.readFileSync(file, "utf-8");
|
|
20
|
+
parsed = yaml.load(raw) ?? {};
|
|
21
|
+
} catch (err) {
|
|
22
|
+
// Fail closed: a malformed config.yaml (often from in-progress
|
|
23
|
+
// user edits) must not silently overwrite existing entries. Throw
|
|
24
|
+
// so the caller can surface the parse error and let the user fix
|
|
25
|
+
// their YAML before we mutate anything.
|
|
26
|
+
throw new Error(
|
|
27
|
+
`registerConnector: refusing to overwrite '${file}' — parse failed (${
|
|
28
|
+
err instanceof Error ? err.message : String(err)
|
|
29
|
+
})`,
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
if (!parsed.connectors || typeof parsed.connectors !== "object") {
|
|
33
|
+
parsed.connectors = {};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
parsed.connectors[slug] = {
|
|
38
|
+
...entry,
|
|
39
|
+
enabled: true,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
fs.writeFileSync(file, yaml.dump(parsed, { lineWidth: 120 }));
|
|
43
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* settings-wiring.mjs — idempotent management of Claude Code's settings.json
|
|
3
|
+
* to register the connector-gate.mjs PreToolUse hook.
|
|
4
|
+
*
|
|
5
|
+
* Two functions:
|
|
6
|
+
* - ensureSettingsHook(settingsPath, gatePath)
|
|
7
|
+
* - hasConnectorGateHook(settingsPath, gatePath)
|
|
8
|
+
*
|
|
9
|
+
* Backs up the file with a timestamped suffix before any write.
|
|
10
|
+
*/
|
|
11
|
+
import * as fs from "node:fs";
|
|
12
|
+
import * as path from "node:path";
|
|
13
|
+
|
|
14
|
+
export function ensureSettingsHook(settingsPath, gatePath) {
|
|
15
|
+
const dir = path.dirname(settingsPath);
|
|
16
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
17
|
+
|
|
18
|
+
let parsed = {};
|
|
19
|
+
if (fs.existsSync(settingsPath)) {
|
|
20
|
+
backup(settingsPath);
|
|
21
|
+
parsed = JSON.parse(fs.readFileSync(settingsPath, "utf-8"));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (!parsed.hooks) parsed.hooks = {};
|
|
25
|
+
if (!parsed.hooks.PreToolUse) parsed.hooks.PreToolUse = [];
|
|
26
|
+
|
|
27
|
+
// Find an existing Bash matcher block; create one if missing.
|
|
28
|
+
let block = parsed.hooks.PreToolUse.find((b) => b.matcher === "Bash");
|
|
29
|
+
if (!block) {
|
|
30
|
+
block = { matcher: "Bash", hooks: [] };
|
|
31
|
+
parsed.hooks.PreToolUse.push(block);
|
|
32
|
+
}
|
|
33
|
+
if (!Array.isArray(block.hooks)) block.hooks = [];
|
|
34
|
+
|
|
35
|
+
const entry = { type: "command", command: `node "${gatePath}"` };
|
|
36
|
+
const exists = block.hooks.some(
|
|
37
|
+
(h) =>
|
|
38
|
+
h.type === "command" &&
|
|
39
|
+
typeof h.command === "string" &&
|
|
40
|
+
h.command.includes(gatePath),
|
|
41
|
+
);
|
|
42
|
+
if (!exists) block.hooks.push(entry);
|
|
43
|
+
|
|
44
|
+
fs.writeFileSync(settingsPath, JSON.stringify(parsed, null, 2) + "\n");
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function hasConnectorGateHook(settingsPath, gatePath) {
|
|
48
|
+
if (!fs.existsSync(settingsPath)) return false;
|
|
49
|
+
let parsed;
|
|
50
|
+
try {
|
|
51
|
+
parsed = JSON.parse(fs.readFileSync(settingsPath, "utf-8"));
|
|
52
|
+
} catch {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
const blocks = parsed.hooks?.PreToolUse ?? [];
|
|
56
|
+
return blocks.some(
|
|
57
|
+
(b) =>
|
|
58
|
+
Array.isArray(b.hooks) &&
|
|
59
|
+
b.hooks.some(
|
|
60
|
+
(h) =>
|
|
61
|
+
h.type === "command" &&
|
|
62
|
+
typeof h.command === "string" &&
|
|
63
|
+
h.command.includes(gatePath),
|
|
64
|
+
),
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function backup(filePath) {
|
|
69
|
+
const ts = new Date().toISOString().replace(/[:.]/g, "-");
|
|
70
|
+
fs.copyFileSync(filePath, `${filePath}.bak-${ts}`);
|
|
71
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Connector contract
|
|
2
|
+
|
|
3
|
+
A connector is a directory at `<scope>/.connectors/connectors/<slug>/` that
|
|
4
|
+
satisfies a thin contract. The runtime treats unknown files as opaque, so
|
|
5
|
+
flavors can extend the layout without changing the contract.
|
|
6
|
+
|
|
7
|
+
## Required
|
|
8
|
+
|
|
9
|
+
- `SKILL.md` — model-facing description (frontmatter `name`, `description`,
|
|
10
|
+
`context: connector`). The skill describes when to invoke this connector
|
|
11
|
+
and what params it accepts.
|
|
12
|
+
- Entry in `<scope>/.connectors/config.yaml` under `connectors:`:
|
|
13
|
+
```yaml
|
|
14
|
+
connectors:
|
|
15
|
+
<slug>:
|
|
16
|
+
skill: <abs-path-to-connector-dir>
|
|
17
|
+
bin: <abs-path-to-bin-or-null>
|
|
18
|
+
enabled: true
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Optional (any combination)
|
|
22
|
+
|
|
23
|
+
- `index.mjs` — programmatic actions, built with `createConnector` from
|
|
24
|
+
`narai-primitives/toolkit`. Gives you the toolkit's policy gate,
|
|
25
|
+
classification, audit, and hardship logging for free. Invoked via
|
|
26
|
+
`gather()` or directly via the bin shim.
|
|
27
|
+
- `gates.json` — declarative shell-command gates fired at PreToolUse:
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"rules": [
|
|
31
|
+
{ "name": "deny_x", "decision": "deny|ask|allow",
|
|
32
|
+
"reason": "...", "pattern": "<regex>" }
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
The runtime applies each rule's regex to the bash command (split on
|
|
37
|
+
`&&`/`||`/`;`/`|`); strictest decision wins (`deny` > `ask` > `allow`).
|
|
38
|
+
- `bin/<slug>` — CLI shim that execs `index.mjs`. Required if `index.mjs`
|
|
39
|
+
is present.
|
|
40
|
+
- (nothing) — knowledge-only connector. Just SKILL.md + config.yaml entry.
|
|
41
|
+
|
|
42
|
+
## How the runtime finds connectors
|
|
43
|
+
|
|
44
|
+
Two firing points:
|
|
45
|
+
|
|
46
|
+
1. **Standalone runtime** — `connector-gate.mjs` at `<scope>/.connectors/`,
|
|
47
|
+
wired into `<scope>/.claude/settings.json` as a `PreToolUse` hook. Reads
|
|
48
|
+
`<scope>/.connectors/connectors/*/gates.json` and applies decisions.
|
|
49
|
+
2. **Builtin Claude Code plugin** — when any narai builtin plugin is
|
|
50
|
+
installed (jira-agent, aws-agent, etc.), its dispatcher *also* discovers
|
|
51
|
+
user connectors at the same path and applies their gates. Defense in
|
|
52
|
+
depth.
|
|
53
|
+
|
|
54
|
+
If both fire, `deny` precedence ensures consistency.
|
|
55
|
+
|
|
56
|
+
## File-tree example
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
<scope>/
|
|
60
|
+
├── .claude/
|
|
61
|
+
│ └── settings.json # PreToolUse hook → connector-gate.mjs
|
|
62
|
+
└── .connectors/
|
|
63
|
+
├── config.yaml # connector registry
|
|
64
|
+
├── connector-gate.mjs # standalone runtime (stamped on first /create-connector)
|
|
65
|
+
└── connectors/
|
|
66
|
+
├── stripe/ # API/SDK wrapper
|
|
67
|
+
│ ├── SKILL.md
|
|
68
|
+
│ ├── index.mjs
|
|
69
|
+
│ └── bin/stripe
|
|
70
|
+
├── deploy-prod/ # shell-gate
|
|
71
|
+
│ ├── SKILL.md
|
|
72
|
+
│ └── gates.json
|
|
73
|
+
├── linear-summary/ # composite orchestrator
|
|
74
|
+
│ ├── SKILL.md
|
|
75
|
+
│ ├── index.mjs
|
|
76
|
+
│ └── bin/linear-summary
|
|
77
|
+
└── runbook-ssh/ # knowledge-only
|
|
78
|
+
└── SKILL.md
|
|
79
|
+
```
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Authoring a new flavor
|
|
2
|
+
|
|
3
|
+
The create-connector skill recognizes 5 flavors today (api-wrapper,
|
|
4
|
+
shell-gate, composite, knowledge, custom). Adding a 6th is additive —
|
|
5
|
+
the runtime is contract-driven and does not need to know about the
|
|
6
|
+
flavor.
|
|
7
|
+
|
|
8
|
+
## What a flavor is
|
|
9
|
+
|
|
10
|
+
A flavor is:
|
|
11
|
+
- A trigger phrasing the skill listens for in the user's freeform
|
|
12
|
+
description.
|
|
13
|
+
- A checklist of shape-specific questions the skill asks once the
|
|
14
|
+
flavor is identified.
|
|
15
|
+
- A template directory at
|
|
16
|
+
`plugins/connector-creator/skills/connector-creator/assets/templates/<flavor>/`
|
|
17
|
+
containing the `.tmpl` files to stamp.
|
|
18
|
+
|
|
19
|
+
## Adding a flavor
|
|
20
|
+
|
|
21
|
+
1. Create the template directory: `assets/templates/<flavor>/`.
|
|
22
|
+
2. Add `.tmpl` files for each artifact the flavor produces. Use double-
|
|
23
|
+
curly placeholders (`{{SLUG}}`, `{{DESCRIPTION}}`, `{{ServicePascal}}`,
|
|
24
|
+
etc.). Reuse existing placeholder names where the meaning is the same.
|
|
25
|
+
3. Add a flavor section in `SKILL.md` with:
|
|
26
|
+
- Trigger phrasings (1-3 examples)
|
|
27
|
+
- Shape-specific questions checklist
|
|
28
|
+
- Which templates get stamped
|
|
29
|
+
4. Add tests in `tests/plugins/connector-creator/templates.test.ts`
|
|
30
|
+
asserting the new template files exist with the expected placeholders.
|
|
31
|
+
|
|
32
|
+
## Placeholder conventions
|
|
33
|
+
|
|
34
|
+
| Placeholder | Substituted with |
|
|
35
|
+
|---|---|
|
|
36
|
+
| `{{SLUG}}` | lowercase, alphanumeric+hyphen connector slug |
|
|
37
|
+
| `{{ServicePascal}}` | PascalCase form of slug for display |
|
|
38
|
+
| `{{DESCRIPTION}}` | one-sentence connector description |
|
|
39
|
+
| `{{DESCRIPTION_SHORT}}` | brief noun phrase for inline use |
|
|
40
|
+
| `{{ACTIONS_TABLE_MD}}` | markdown table of action names + descriptions |
|
|
41
|
+
| `{{ACTIONS_DICTIONARY}}` | JS object literal of action handlers (composite) |
|
|
42
|
+
| `{{RULES}}` | JSON array of rule objects (shell-gate) |
|
|
43
|
+
| `{{RULES_TABLE}}` | markdown table of pattern/decision/reason (shell-gate) |
|
|
44
|
+
| `{{DEPENDENCIES}}` | comma-separated list of upstream connectors (composite) |
|
|
45
|
+
| `{{DEPENDENCIES_TABLE}}` | markdown table of dependencies (composite) |
|
|
46
|
+
| `{{FIRST_ACTION}}` | name of the first action, used in invocation example |
|
|
47
|
+
| `{{USE_CASES}}` | bullet list of when to use this connector (knowledge) |
|
|
48
|
+
| `{{STEPS}}` | numbered list of runbook steps (knowledge) |
|
|
49
|
+
| `{{CAVEATS}}` | bullet list of warnings (knowledge) |
|
|
50
|
+
|
|
51
|
+
When adding a new placeholder, document it here.
|
|
52
|
+
|
|
53
|
+
## Custom flavor
|
|
54
|
+
|
|
55
|
+
For shapes that don't fit a flavor, the skill falls back to pure code-gen.
|
|
56
|
+
The skill writes whatever `index.mjs` / `gates.json` / `SKILL.md` makes
|
|
57
|
+
sense for the user's description, anchored on the connector contract
|
|
58
|
+
(see `connector-contract.md`). No template directory.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Research patterns for create-connector
|
|
2
|
+
|
|
3
|
+
The skill is open-ended: the user describes their need in their own
|
|
4
|
+
words, and the skill identifies the right connector shape. For
|
|
5
|
+
unfamiliar services, the skill researches before asking
|
|
6
|
+
shape-specific questions.
|
|
7
|
+
|
|
8
|
+
## When to research
|
|
9
|
+
|
|
10
|
+
| User cue | Tool to use |
|
|
11
|
+
|---|---|
|
|
12
|
+
| Names a SaaS the skill doesn't recognize | `WebFetch` on `<service>.com/docs/api` (or whatever doc URL the user mentions) |
|
|
13
|
+
| Mentions a Node/Python library | `context7` for current docs |
|
|
14
|
+
| Says "like the jira-agent / aws-agent / etc." | Read the corresponding `src/connectors/<x>/index.ts` for structural reference |
|
|
15
|
+
| Vague service description, no URL | `WebSearch` to find the official docs URL, then `WebFetch` |
|
|
16
|
+
|
|
17
|
+
## What research informs
|
|
18
|
+
|
|
19
|
+
Research findings inform the *questions* the skill asks. The skill
|
|
20
|
+
never decides architectural shape unilaterally based on research — the
|
|
21
|
+
user always chooses.
|
|
22
|
+
|
|
23
|
+
Examples:
|
|
24
|
+
|
|
25
|
+
- **API wrapper detected** → confirm auth scheme (bearer / api-key /
|
|
26
|
+
basic / oauth), confirm rate limits, ask which actions to expose.
|
|
27
|
+
- **Webhook-only service** → push back on user, suggest knowledge-only
|
|
28
|
+
flavor instead since the model can't initiate calls.
|
|
29
|
+
- **GraphQL only** → confirm with user, then generate `index.mjs` with
|
|
30
|
+
a thin GraphQL client (no `createConnector`-style typed actions).
|
|
31
|
+
|
|
32
|
+
## Anti-patterns
|
|
33
|
+
|
|
34
|
+
Don't:
|
|
35
|
+
- Spend 5+ tool calls researching before asking the user. Surface what
|
|
36
|
+
you found in 1-2 fetches and ask the user.
|
|
37
|
+
- Pretend to know an API you don't. If the docs are inaccessible, tell
|
|
38
|
+
the user and let them describe the API.
|
|
39
|
+
- Auto-classify actions without asking. The user's name for an action
|
|
40
|
+
may not follow the `get_*`/`create_*` convention; confirm intent.
|
|
41
|
+
|
|
42
|
+
## Reference connectors
|
|
43
|
+
|
|
44
|
+
For "build me a connector like X", these are the canonical references:
|
|
45
|
+
|
|
46
|
+
- **REST + bearer auth** → `src/connectors/jira/`
|
|
47
|
+
- **REST + multi-secret auth** → `src/connectors/github/`
|
|
48
|
+
- **GraphQL** → `src/connectors/linear/` (if PR #17 has merged)
|
|
49
|
+
- **Stub pattern (auth pending)** → use the `oauth-with-refresh`
|
|
50
|
+
template from `references/auth-patterns.md`
|
|
51
|
+
- **Hook-only / shell-gate** → `plugins/git-connector/hooks/rules.mjs`
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "db-
|
|
2
|
+
"name": "db-connector-plugin",
|
|
3
3
|
"version": "1.1.0",
|
|
4
4
|
"description": "Safe, read-only database query agent for Claude Code. Built on narai-primitives (subpath ./db). Every statement passes the policy gate before any driver loads or any connection is opened.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Narai Labs",
|
|
7
7
|
"url": "https://github.com/narailabs"
|
|
8
8
|
},
|
|
9
|
-
"homepage": "https://github.com/narailabs/narai-primitives/tree/main/plugins/db-
|
|
9
|
+
"homepage": "https://github.com/narailabs/narai-primitives/tree/main/plugins/db-connector",
|
|
10
10
|
"repository": "https://github.com/narailabs/narai-primitives",
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"keywords": ["database", "sql", "postgresql", "mysql", "sqlite", "policy-gate"],
|
|
13
13
|
"userConfig": {
|
|
14
14
|
"install_guardrails": {
|
|
15
|
-
"description": "Block direct DB-client invocations (psql, mysql, sqlite3, mongosh, pg_dump, aws dynamodb, ...) from Bash so all database access is routed through the db-
|
|
15
|
+
"description": "Block direct DB-client invocations (psql, mysql, sqlite3, mongosh, pg_dump, aws dynamodb, ...) from Bash so all database access is routed through the db-connector CLI. Strongly recommended. Set to 'off' to disable.",
|
|
16
16
|
"sensitive": false
|
|
17
17
|
}
|
|
18
18
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# db-
|
|
1
|
+
# db-connector-plugin
|
|
2
2
|
|
|
3
3
|
Claude Code plugin that wraps [`narai-primitives/db`](https://www.npmjs.com/package/narai-primitives).
|
|
4
4
|
|
|
5
|
-
Exposes the `db-
|
|
5
|
+
Exposes the `db-connector` skill. Every query passes through the policy gate before any driver loads or any connection opens. V2.0 vocab and defaults:
|
|
6
6
|
|
|
7
7
|
- `read` (SELECT/EXPLAIN/SHOW/DESCRIBE/WITH) → executed through the driver with row/timeout caps
|
|
8
8
|
- `write` (INSERT/UPDATE/REPLACE/MERGE/UPSERT) → escalates by default
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
4
|
if [ -z "${CLAUDE_PLUGIN_DATA:-}" ]; then
|
|
5
|
-
echo "
|
|
5
|
+
echo "db-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/db/cli.js"
|
|
10
10
|
|
|
11
11
|
if [ ! -f "$CLI" ]; then
|
|
12
|
-
echo "
|
|
12
|
+
echo "db-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 read-only database query via the db-connector connector
|
|
3
|
+
argument-hint: "<action> <params-json>"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Invoke the `db-connector` skill with the user's $ARGUMENTS as the action name and params JSON. Return the connector's JSON envelope verbatim.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"name": "db-strict",
|
|
4
|
+
"enforcement": "fail_closed",
|
|
5
|
+
"rules": [
|
|
6
|
+
{
|
|
7
|
+
"name": "python_db_driver_import",
|
|
8
|
+
"decision": "deny",
|
|
9
|
+
"reason": "Importing a database driver in-process bypasses the connector. Route DB access through the sanctioned connector instead.",
|
|
10
|
+
"pattern": "[iI][mM][pP][oO][rR][tT]\\s+(psycopg2|psycopg|pymysql|MySQLdb|sqlite3|pymongo|pyodbc|asyncpg|sqlalchemy)\\b|[fF][rR][oO][mM]\\s+(psycopg2|psycopg|pymysql|MySQLdb|sqlite3|pymongo|pyodbc|asyncpg|sqlalchemy)\\s+[iI][mM][pP][oO][rR][tT]\\b"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "node_db_driver_require",
|
|
14
|
+
"decision": "deny",
|
|
15
|
+
"reason": "Requiring a database driver in-process bypasses the connector. Route DB access through the sanctioned connector instead.",
|
|
16
|
+
"pattern": "[rR][eE][qQ][uU][iI][rR][eE]\\s*\\(\\s*['\"\\\\]+(pg|mysql2|mysql|mongodb|mssql|tedious|better-sqlite3|sqlite3|oracledb)['\"\\\\]+\\s*\\)"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"name": "jdbc_url",
|
|
20
|
+
"decision": "deny",
|
|
21
|
+
"reason": "A JDBC connection URL bypasses the connector. Route DB access through the sanctioned connector instead.",
|
|
22
|
+
"pattern": "[jJ][dD][bB][cC]:(postgresql|mysql|mariadb|sqlserver|oracle|sqlite|mongodb)://",
|
|
23
|
+
"applies_to": ["Bash", "Write", "Edit"]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"name": "db_uri_credentials",
|
|
27
|
+
"decision": "deny",
|
|
28
|
+
"reason": "A database URI with embedded credentials is a credential/target leak. Route DB access through the sanctioned connector instead.",
|
|
29
|
+
"pattern": "(postgres(ql)?|mysql|mariadb|mongodb(\\+srv)?|mssql|sqlserver|oracle):\\/\\/[^:@\\/\\s]+:[^@\\/\\s]+@",
|
|
30
|
+
"applies_to": ["Bash", "Write", "Edit"]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "node_db_client_construct",
|
|
34
|
+
"decision": "deny",
|
|
35
|
+
"reason": "Constructing a database client in-process bypasses the connector. Route DB access through the sanctioned connector instead.",
|
|
36
|
+
"pattern": "[nN][eE][wW]\\s+(Pool|Client)\\s*\\([^)]*\\b(host|port|database|connectionString|user|password)\\b"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "raw_dml_exec",
|
|
40
|
+
"decision": "deny",
|
|
41
|
+
"reason": "Executing raw DML/DDL inline bypasses the connector. Route DB access through the sanctioned connector instead.",
|
|
42
|
+
"pattern": "(-c\\b|-e\\b|--eval\\b|--command\\b|--query\\b|python3?|node|deno|ruby|perl|php)\\b.*([iI][nN][sS][eE][rR][tT]\\s+[iI][nN][tT][oO]|[uU][pP][dD][aA][tT][eE]\\s+.+\\s+[sS][eE][tT]\\b|[dD][eE][lL][eE][tT][eE]\\s+[fF][rR][oO][mM]|[dD][rR][oO][pP]\\s+[tT][aA][bB][lL][eE]|[tT][rR][uU][nN][cC][aA][tT][eE]\\s+([tT][aA][bB][lL][eE]\\s+)?)"
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"name": "db-strict-bare",
|
|
4
|
+
"enforcement": "fail_closed",
|
|
5
|
+
"rules": [
|
|
6
|
+
{
|
|
7
|
+
"name": "raw_dml_bare",
|
|
8
|
+
"decision": "deny",
|
|
9
|
+
"reason": "A bare leading DML/DDL statement bypasses the connector. Route data/schema changes through the sanctioned connector instead.",
|
|
10
|
+
"pattern": "^\\s*([iI][nN][sS][eE][rR][tT]\\s+[iI][nN][tT][oO]|[uU][pP][dD][aA][tT][eE]\\s+\\S+\\s+[sS][eE][tT]\\b|[dD][eE][lL][eE][tT][eE]\\s+[fF][rR][oO][mM]|[dD][rR][oO][pP]\\s+[tT][aA][bB][lL][eE]|[tT][rR][uU][nN][cC][aA][tT][eE]\\s+([tT][aA][bB][lL][eE]\\s+)?)"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|
|
@@ -19,8 +19,10 @@
|
|
|
19
19
|
"mssql-cli",
|
|
20
20
|
"duckdb"
|
|
21
21
|
],
|
|
22
|
-
"block_two_token_command": [
|
|
23
|
-
|
|
22
|
+
"block_two_token_command": [
|
|
23
|
+
"aws dynamodb"
|
|
24
|
+
],
|
|
25
|
+
"redirect": "Route database access through the db-connector CLI: `db-connector --action query --params '{\"env\":\"<name>\",\"sql\":\"...\"}'` or use sqlite_path. Do NOT bypass \u2014 reformulate the intent."
|
|
24
26
|
}
|
|
25
27
|
]
|
|
26
28
|
}
|
|
@@ -9,12 +9,21 @@
|
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
"type": "command",
|
|
12
|
-
"command": "node \"${
|
|
13
|
-
}
|
|
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|Write|Edit",
|
|
20
|
+
"hooks": [
|
|
14
21
|
{
|
|
15
22
|
"type": "command",
|
|
16
|
-
"command": "node \"${CLAUDE_PLUGIN_DATA}/node_modules/narai-primitives/plugin-hooks/
|
|
17
|
-
"env": {
|
|
23
|
+
"command": "node \"${CLAUDE_PLUGIN_DATA}/node_modules/narai-primitives/plugin-hooks/dispatcher.mjs\" pre-tool-use",
|
|
24
|
+
"env": {
|
|
25
|
+
"DB_AGENT_GUARDRAILS": "${user_config.install_guardrails}"
|
|
26
|
+
}
|
|
18
27
|
}
|
|
19
28
|
]
|
|
20
29
|
}
|
|
@@ -25,11 +34,7 @@
|
|
|
25
34
|
"hooks": [
|
|
26
35
|
{
|
|
27
36
|
"type": "command",
|
|
28
|
-
"command": "node \"${CLAUDE_PLUGIN_DATA}/node_modules/narai-primitives/plugin-hooks/
|
|
29
|
-
"env": {
|
|
30
|
-
"USAGE_CONNECTOR_NAME": "aws",
|
|
31
|
-
"USAGE_BIN_HINT": "narai-primitives/dist/connectors/aws"
|
|
32
|
-
}
|
|
37
|
+
"command": "node \"${CLAUDE_PLUGIN_DATA}/node_modules/narai-primitives/plugin-hooks/dispatcher.mjs\" post-tool-use"
|
|
33
38
|
}
|
|
34
39
|
]
|
|
35
40
|
}
|
|
@@ -39,8 +44,7 @@
|
|
|
39
44
|
"hooks": [
|
|
40
45
|
{
|
|
41
46
|
"type": "command",
|
|
42
|
-
"command": "node \"${CLAUDE_PLUGIN_DATA}/node_modules/narai-primitives/plugin-hooks/
|
|
43
|
-
"env": { "USAGE_CONNECTOR_NAME": "aws" }
|
|
47
|
+
"command": "node \"${CLAUDE_PLUGIN_DATA}/node_modules/narai-primitives/plugin-hooks/dispatcher.mjs\" session-end"
|
|
44
48
|
}
|
|
45
49
|
]
|
|
46
50
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: db-
|
|
2
|
+
name: db-connector
|
|
3
3
|
description: |
|
|
4
4
|
Use when the user asks about reading data from a database — SELECT queries,
|
|
5
5
|
schema introspection, "show me the rows/tables/columns…". Supports
|
|
@@ -11,16 +11,16 @@ description: |
|
|
|
11
11
|
context: fork
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
# Database
|
|
14
|
+
# Database Connector
|
|
15
15
|
|
|
16
|
-
Answer the user's question by invoking the `db-
|
|
16
|
+
Answer the user's question by invoking the `db-connector` binary exposed by this
|
|
17
17
|
plugin. It delegates to `narai-primitives/db`, which enforces the
|
|
18
18
|
policy gate before any backend is touched.
|
|
19
19
|
|
|
20
20
|
## Invocation
|
|
21
21
|
|
|
22
22
|
```
|
|
23
|
-
db-
|
|
23
|
+
db-connector --action <action> --params '<json>'
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
Return the connector's JSON envelope verbatim.
|
|
@@ -46,5 +46,5 @@ Read-only by design. The policy gate rejects every non-read statement before
|
|
|
46
46
|
any driver loads. WRITE escalates by default; DELETE/ADMIN return formatted
|
|
47
47
|
SQL with no execution; PRIVILEGE is hard-denied. Never shell out to `psql`,
|
|
48
48
|
`mysql`, `sqlite3`, `mongosh`, `pg_dump`, `duckdb`, or `aws dynamodb` — the
|
|
49
|
-
`db-
|
|
49
|
+
`db-connector` binary is the only sanctioned channel. Never edit the operator's
|
|
50
50
|
config to weaken a policy decision; report the decision instead.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
# gcp-
|
|
1
|
+
# gcp-connector-plugin
|
|
2
2
|
|
|
3
3
|
Claude Code plugin that wraps [`narai-primitives/gcp`](https://www.npmjs.com/package/narai-primitives) as a read-only GCP skill and slash command.
|
|
4
4
|
|
|
5
|
-
- **Skill** `gcp-
|
|
6
|
-
- **Slash command** `/gcp-
|
|
7
|
-
- **Binary** `gcp-
|
|
5
|
+
- **Skill** `gcp-connector` — automatic invocation for Cloud Run / Cloud SQL / Pub/Sub / Cloud Logging questions.
|
|
6
|
+
- **Slash command** `/gcp-connector <action> <params-json>`.
|
|
7
|
+
- **Binary** `gcp-connector` — thin shim over the installed connector CLI.
|
|
8
8
|
|
|
9
9
|
## How install works
|
|
10
10
|
|
|
@@ -16,7 +16,7 @@ On first `SessionStart` the hook in `hooks/hooks.json`:
|
|
|
16
16
|
|
|
17
17
|
After install,
|
|
18
18
|
`${CLAUDE_PLUGIN_DATA}/node_modules/narai-primitives/dist/connectors/gcp/cli.js`
|
|
19
|
-
exists and `bin/gcp-
|
|
19
|
+
exists and `bin/gcp-connector` exec's it.
|
|
20
20
|
|
|
21
21
|
## Credentials
|
|
22
22
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# gcp-
|
|
2
|
+
# gcp-connector — thin shim over narai-primitives (CLI at dist/connectors/gcp).
|
|
3
3
|
set -euo pipefail
|
|
4
4
|
|
|
5
5
|
if [ -z "${CLAUDE_PLUGIN_DATA:-}" ]; then
|
|
6
|
-
echo "gcp-
|
|
6
|
+
echo "gcp-connector: CLAUDE_PLUGIN_DATA is not set (run from inside Claude Code)" >&2
|
|
7
7
|
exit 2
|
|
8
8
|
fi
|
|
9
9
|
|
|
10
10
|
CLI="${CLAUDE_PLUGIN_DATA}/node_modules/narai-primitives/dist/connectors/gcp/cli.js"
|
|
11
11
|
|
|
12
12
|
if [ ! -f "$CLI" ]; then
|
|
13
|
-
echo "gcp-
|
|
13
|
+
echo "gcp-connector: connector CLI not found at $CLI" >&2
|
|
14
14
|
echo "Restart your Claude Code session to re-run the SessionStart install hook." >&2
|
|
15
15
|
exit 2
|
|
16
16
|
fi
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Run a read-only GCP query via the gcp-connector connector
|
|
3
|
+
argument-hint: "<action> <params-json>"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Invoke the `gcp-connector` skill with the user's $ARGUMENTS as the action name and params JSON. Return the connector's JSON envelope verbatim.
|
|
@@ -9,12 +9,18 @@
|
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
"type": "command",
|
|
12
|
-
"command": "node \"${
|
|
13
|
-
}
|
|
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": [
|
|
14
21
|
{
|
|
15
22
|
"type": "command",
|
|
16
|
-
"command": "node \"${CLAUDE_PLUGIN_DATA}/node_modules/narai-primitives/plugin-hooks/
|
|
17
|
-
"env": { "USAGE_CONNECTOR_NAME": "github" }
|
|
23
|
+
"command": "node \"${CLAUDE_PLUGIN_DATA}/node_modules/narai-primitives/plugin-hooks/dispatcher.mjs\" pre-tool-use"
|
|
18
24
|
}
|
|
19
25
|
]
|
|
20
26
|
}
|
|
@@ -25,11 +31,7 @@
|
|
|
25
31
|
"hooks": [
|
|
26
32
|
{
|
|
27
33
|
"type": "command",
|
|
28
|
-
"command": "node \"${CLAUDE_PLUGIN_DATA}/node_modules/narai-primitives/plugin-hooks/
|
|
29
|
-
"env": {
|
|
30
|
-
"USAGE_CONNECTOR_NAME": "github",
|
|
31
|
-
"USAGE_BIN_HINT": "narai-primitives/dist/connectors/github"
|
|
32
|
-
}
|
|
34
|
+
"command": "node \"${CLAUDE_PLUGIN_DATA}/node_modules/narai-primitives/plugin-hooks/dispatcher.mjs\" post-tool-use"
|
|
33
35
|
}
|
|
34
36
|
]
|
|
35
37
|
}
|
|
@@ -39,8 +41,7 @@
|
|
|
39
41
|
"hooks": [
|
|
40
42
|
{
|
|
41
43
|
"type": "command",
|
|
42
|
-
"command": "node \"${CLAUDE_PLUGIN_DATA}/node_modules/narai-primitives/plugin-hooks/
|
|
43
|
-
"env": { "USAGE_CONNECTOR_NAME": "github" }
|
|
44
|
+
"command": "node \"${CLAUDE_PLUGIN_DATA}/node_modules/narai-primitives/plugin-hooks/dispatcher.mjs\" session-end"
|
|
44
45
|
}
|
|
45
46
|
]
|
|
46
47
|
}
|