narai-primitives 2.1.2 → 2.2.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 +16 -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 +4 -3
- package/dist/connectors/db/dispatcher.d.ts.map +1 -1
- package/dist/connectors/db/dispatcher.js +144 -45
- 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 +70 -0
- package/dist/connectors/db/lib/grant-store.d.ts.map +1 -0
- package/dist/connectors/db/lib/grant-store.js +149 -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 +295 -73
- 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 +584 -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 +37 -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-connector/package.json +8 -0
- 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 +54 -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/github-connector/package.json +8 -0
- 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/hooks/hooks.json +50 -0
- package/plugins/gitlab-connector/package.json +8 -0
- 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/hooks/hooks.json +50 -0
- package/plugins/jira-connector/package.json +8 -0
- 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/package.json +0 -8
- 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/db-agent/package.json +0 -8
- 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/package.json +0 -8
- 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/package.json +0 -8
- 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,412 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: connector-creator
|
|
3
|
+
description: |
|
|
4
|
+
Use this skill when the user wants to add a custom connector to their project —
|
|
5
|
+
wrapping a SaaS API, REST endpoint, GraphQL endpoint, SDK, or CLI tool so
|
|
6
|
+
Claude can call it via `gather()` from `narai-primitives`. Trigger even when
|
|
7
|
+
the user doesn't say "connector" explicitly: phrases like "I want to query
|
|
8
|
+
Stripe from Claude", "add Slack to our agents", "wrap our internal orders
|
|
9
|
+
API", "connect Salesforce", "make a Linear agent" all warrant this skill.
|
|
10
|
+
Also triggers for: "gate kubectl in prod", "approve before force push",
|
|
11
|
+
"pull from Linear, summarize, post to Slack", "document this workflow".
|
|
12
|
+
Scaffolds a minimal local connector at `.connectors/connectors/<name>/`
|
|
13
|
+
(project scope, default) or `~/.connectors/connectors/<name>/` (user scope) —
|
|
14
|
+
no `git init`, no `npm publish`, no plugin manifest, no marketplace entry.
|
|
15
|
+
Do NOT use for: modifying an existing connector (just edit the file),
|
|
16
|
+
wrapping an MCP server (different abstraction), querying databases (the `db`
|
|
17
|
+
connector inside narai-primitives already covers postgres/mysql/sqlite/mssql/
|
|
18
|
+
mongodb/dynamodb/oracle), or contributing a new builtin connector (that's a
|
|
19
|
+
PR to https://github.com/narailabs/narai-primitives — see its CONTRIBUTING.md).
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# connector-creator
|
|
23
|
+
|
|
24
|
+
Scaffold a custom connector that the user's local installation loads via `narai-primitives`'s `gather()`. The connector is **local-only**: it does not get published to npm, does not become a Claude Code plugin, and does not go in any marketplace. The user can later send a PR to `narailabs/narai-primitives` if their connector turns out to be broadly useful — that's a separate flow.
|
|
25
|
+
|
|
26
|
+
This skill is **not a fixed form**. It recognizes five distinct connector shapes (flavors) from the user's words, asks only the questions that matter for the recognized shape, and falls back to freeform code-gen for novel cases. For unknown services it researches docs before asking questions.
|
|
27
|
+
|
|
28
|
+
## When to invoke
|
|
29
|
+
|
|
30
|
+
Use this skill when the user wants to **create a new custom connector** for local use.
|
|
31
|
+
|
|
32
|
+
Classic phrasings:
|
|
33
|
+
- "I want to wrap the Stripe API"
|
|
34
|
+
- "Make me a Slack connector"
|
|
35
|
+
- "We need a connector for our internal orders API"
|
|
36
|
+
- "Add Linear to our agents"
|
|
37
|
+
|
|
38
|
+
Near-miss phrasings (still trigger):
|
|
39
|
+
- "I want to query Stripe from Claude"
|
|
40
|
+
- "Connect Salesforce to Claude Code"
|
|
41
|
+
- "Make a thing that lets me search Jira from Claude"
|
|
42
|
+
|
|
43
|
+
Also triggers for the new flavors:
|
|
44
|
+
- "Gate `kubectl` in prod" / "Deny force push" / "Approve before deploy runs" → Shell-command gate
|
|
45
|
+
- "Pull from Linear, summarize, post to Slack" / "Multi-step workflow" → Composite orchestrator
|
|
46
|
+
- "Document this runbook" / "Capture this workflow as a skill" → Knowledge-only
|
|
47
|
+
|
|
48
|
+
**Do NOT use this skill for:**
|
|
49
|
+
|
|
50
|
+
- **Modifying an existing connector.** Just edit the file directly.
|
|
51
|
+
- **Wrapping an MCP server.** MCP servers and connectors are different abstractions in Claude Code. Point the user at the Claude Code MCP docs.
|
|
52
|
+
- **Querying a database.** `narai-primitives/db` covers postgres, mysql, sqlite, mssql, mongodb, dynamodb, oracle. See `references/db-connector-pointer.md`. Only suggest a custom DB connector if it's a backend the bundled `db` connector doesn't support.
|
|
53
|
+
- **Contributing a builtin connector to `narai-primitives`.** That's a different flow (PR to the bundle's repo, separate test suite, plugin marketplace entry). This skill is for end-user local connectors only.
|
|
54
|
+
|
|
55
|
+
## What gets created
|
|
56
|
+
|
|
57
|
+
Files vary by flavor. Examples for each:
|
|
58
|
+
|
|
59
|
+
**API/SDK wrapper** (`stripe`):
|
|
60
|
+
```
|
|
61
|
+
<scope>/.connectors/connectors/stripe/
|
|
62
|
+
├── SKILL.md
|
|
63
|
+
├── index.mjs
|
|
64
|
+
└── bin/stripe
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Shell-command gate** (`prod-kubectl`):
|
|
68
|
+
```
|
|
69
|
+
<scope>/.connectors/connectors/prod-kubectl/
|
|
70
|
+
├── SKILL.md
|
|
71
|
+
└── gates.json
|
|
72
|
+
```
|
|
73
|
+
Plus first-run wiring (once per scope):
|
|
74
|
+
```
|
|
75
|
+
<scope>/.connectors/connector-gate.mjs ← stamped from _runtime template
|
|
76
|
+
<scope>/.claude/settings.json ← PreToolUse hook entry added
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Composite orchestrator** (`linear-to-slack`):
|
|
80
|
+
```
|
|
81
|
+
<scope>/.connectors/connectors/linear-to-slack/
|
|
82
|
+
├── SKILL.md
|
|
83
|
+
├── index.mjs
|
|
84
|
+
└── bin/linear-to-slack
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**Knowledge-only** (`deploy-runbook`):
|
|
88
|
+
```
|
|
89
|
+
<scope>/.connectors/connectors/deploy-runbook/
|
|
90
|
+
└── SKILL.md
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Custom** (whatever files are needed — code-gen guided by the connector contract).
|
|
94
|
+
|
|
95
|
+
Plus one entry appended to `<scope>/.connectors/config.yaml` in all cases:
|
|
96
|
+
|
|
97
|
+
```yaml
|
|
98
|
+
connectors:
|
|
99
|
+
<slug>:
|
|
100
|
+
skill: <abs-path-to-connector-dir>
|
|
101
|
+
bin: <abs-path-to-bin> # null for shell-gate, knowledge-only
|
|
102
|
+
enabled: true
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Adaptive flow
|
|
106
|
+
|
|
107
|
+
The skill runs a 7-step flow. Steps 1-2 identify the shape; steps 3-4 do the research and ask shape-specific questions; steps 5-7 confirm, stamp, and verify.
|
|
108
|
+
|
|
109
|
+
1. **Open** — Ask: *"Tell me about what you want to build."* Freeform. Do not offer a menu.
|
|
110
|
+
2. **Identify shape** — Listen for cues (see "Flavor recognition cues" below). Ask 1-3 clarifying questions if the shape is ambiguous. Pick a flavor. State your pick explicitly: *"This sounds like a shell-command gate. Is that right?"*
|
|
111
|
+
3. **Research** — For unknown services, use WebFetch / WebSearch / context7. See `references/research-patterns.md`. Research findings inform questions asked; never decide architectural shape unilaterally based on research alone.
|
|
112
|
+
4. **Shape-specific questions** — Each flavor has its own checklist (sections below). Ask only the checklist that matches the shape.
|
|
113
|
+
5. **Confirm summary** — Show the file tree that will be created, the registry entry, and (if first run) the settings.json change. Wait for explicit OK before writing anything.
|
|
114
|
+
6. **Stamp** — Write template files; substitute placeholders; register in `config.yaml`; (first time for gate-bearing connectors) install `settings.json` hook and stamp `connector-gate.mjs`.
|
|
115
|
+
7. **Verify** — Smoke-test the bin shim or hook script. Report success or troubleshoot.
|
|
116
|
+
|
|
117
|
+
## Flavor recognition cues
|
|
118
|
+
|
|
119
|
+
| Cue | Flavor |
|
|
120
|
+
|---|---|
|
|
121
|
+
| "wrap our X API", "connect to Y SaaS", "query X from Claude" | API/SDK wrapper |
|
|
122
|
+
| "gate `cmd`", "approve before X runs", "deny Y in prod", "block force push" | Shell-command gate |
|
|
123
|
+
| "pull A, summarize, post to B"; multi-step workflows using existing connectors | Composite orchestrator |
|
|
124
|
+
| "document this workflow", "capture this runbook", "make a skill for our deploy process" | Knowledge-only |
|
|
125
|
+
| anything that doesn't fit the above | Custom (pure code-gen) |
|
|
126
|
+
|
|
127
|
+
## Flavor: API / SDK wrapper
|
|
128
|
+
|
|
129
|
+
Today's default behavior. Use when the user wants to call a SaaS or REST/GraphQL API.
|
|
130
|
+
|
|
131
|
+
### Step 1 — Scope
|
|
132
|
+
|
|
133
|
+
Ask: *"Should this connector be available only in this project, or for all your projects?"*
|
|
134
|
+
|
|
135
|
+
| Choice | Where it lives | Default for |
|
|
136
|
+
|---|---|---|
|
|
137
|
+
| **Project (default)** | `./.connectors/connectors/<slug>/` | repo-specific stuff |
|
|
138
|
+
| **User** | `~/.connectors/connectors/<slug>/` | personal tools |
|
|
139
|
+
|
|
140
|
+
Pick a sensible default based on the user's phrasing. The scope determines which `config.yaml` gets the entry.
|
|
141
|
+
|
|
142
|
+
### Step 2 — Identity
|
|
143
|
+
|
|
144
|
+
Ask: *"What's the service slug?"*
|
|
145
|
+
|
|
146
|
+
- **Slug**: lowercase, alphanumeric + hyphens (e.g., `stripe`, `slack`, `acme-orders`). Used everywhere.
|
|
147
|
+
- **Description**: one sentence (e.g., "Read-only Stripe connector: customers, charges, invoices.")
|
|
148
|
+
|
|
149
|
+
### Step 3 — Auth
|
|
150
|
+
|
|
151
|
+
Ask: *"How does authentication work for this API?"*
|
|
152
|
+
|
|
153
|
+
Map the answer to one of:
|
|
154
|
+
|
|
155
|
+
- **`bearer-token-env-var`** (default) — single env var like `STRIPE_API_KEY`, used as `Authorization: Bearer …`.
|
|
156
|
+
- **`api-key-header-env-var`** — single env var, used as a custom header like `X-API-Key`. Capture the header name.
|
|
157
|
+
- **`multi-secret`** — multiple env vars. Capture each `config-key → env-var` pairing.
|
|
158
|
+
- **`basic-auth`** — username + password env vars.
|
|
159
|
+
- **`oauth-with-refresh`** — leave a `// TODO` placeholder in `loadCredentials`. Tell the user they'll need to implement the OAuth flow before the connector works.
|
|
160
|
+
- **`custom`** — anything else (mTLS, signed URLs, etc.). Same TODO treatment.
|
|
161
|
+
|
|
162
|
+
See `references/auth-patterns.md` for per-scheme `loadCredentials` snippets.
|
|
163
|
+
|
|
164
|
+
### Step 4 — API basics
|
|
165
|
+
|
|
166
|
+
Ask: *"What's the API base URL? Any rate limit or versioning header you know about?"*
|
|
167
|
+
|
|
168
|
+
Defaults:
|
|
169
|
+
- **Rate limit**: 60/min
|
|
170
|
+
- **Read timeout**: 30s
|
|
171
|
+
- **User-Agent**: `narai-custom-<slug>`
|
|
172
|
+
|
|
173
|
+
### Step 5 — Action surface
|
|
174
|
+
|
|
175
|
+
Ask: *"What actions should this connector expose? Just describe them — name, what it does, what params, what it returns."*
|
|
176
|
+
|
|
177
|
+
Write the Zod schemas, pick HTTP methods/endpoints, and assign default classifications:
|
|
178
|
+
|
|
179
|
+
- `get_*`, `list_*`, `search_*`, `query_*`, `fetch_*` → `read`
|
|
180
|
+
- `create_*`, `post_*`, `send_*`, `update_*`, `patch_*` → `write`
|
|
181
|
+
- `delete_*`, `remove_*`, `archive_*` → `delete`
|
|
182
|
+
- `grant_*`, `revoke_*` → `privilege`
|
|
183
|
+
|
|
184
|
+
Override on user signal ("this one mutates state" → classify as `write` even if the name says `get`).
|
|
185
|
+
|
|
186
|
+
See `references/action-design.md` for Zod schema patterns and the full classification → approval-mode table.
|
|
187
|
+
|
|
188
|
+
### Step 6 — Approval mode (only if non-read actions exist)
|
|
189
|
+
|
|
190
|
+
Ask: *"For the write/delete actions, how should the user approve them — `auto`, `confirm_once`, `confirm_each`, or `grant_required`?"*
|
|
191
|
+
|
|
192
|
+
Defaults:
|
|
193
|
+
- `read` → `auto`
|
|
194
|
+
- `write` → `confirm_once`
|
|
195
|
+
- `delete` → `confirm_each`
|
|
196
|
+
- `admin` / `privilege` → `grant_required`
|
|
197
|
+
|
|
198
|
+
Skip entirely if all actions are read-only.
|
|
199
|
+
|
|
200
|
+
### Step 7 — Confirmation
|
|
201
|
+
|
|
202
|
+
Show:
|
|
203
|
+
- File tree that will be created
|
|
204
|
+
- Actions table with classifications
|
|
205
|
+
- Auth scheme + env vars
|
|
206
|
+
- Scope path
|
|
207
|
+
|
|
208
|
+
Ask: *"Anything to change before I scaffold?"* Wait for explicit OK.
|
|
209
|
+
|
|
210
|
+
### Stamp (API wrapper)
|
|
211
|
+
|
|
212
|
+
Templates: `assets/templates/index.mjs.tmpl`, `assets/templates/bin.tmpl`, `assets/templates/connector-SKILL.md.tmpl`.
|
|
213
|
+
|
|
214
|
+
| Placeholder | Example |
|
|
215
|
+
|---|---|
|
|
216
|
+
| `{{SLUG}}` | `stripe` |
|
|
217
|
+
| `{{ServicePascal}}` | `Stripe` |
|
|
218
|
+
| `{{DESCRIPTION}}` | `Read-only Stripe connector: customers, charges, invoices.` |
|
|
219
|
+
| `{{API_BASE}}` | `https://api.stripe.com` |
|
|
220
|
+
| `{{RATE_LIMIT_PER_MIN}}` | `60` |
|
|
221
|
+
| `{{CREDENTIAL_ENV_VAR}}` | `STRIPE_API_KEY` |
|
|
222
|
+
| `{{AUTH_HEADER_ENTRY}}` | `` Authorization: `Bearer ${creds.token}` `` |
|
|
223
|
+
| `{{ACTIONS_DICTIONARY}}` | JS object literal of action handlers |
|
|
224
|
+
| `{{ACTIONS_TABLE_MD}}` | Markdown table of actions |
|
|
225
|
+
| `{{FIRST_ACTION}}` | First action name (used in smoke test) |
|
|
226
|
+
|
|
227
|
+
After stamping:
|
|
228
|
+
1. `chmod +x <bin>`
|
|
229
|
+
2. Open `<scope>/.connectors/config.yaml` (create if missing — minimal: `connectors: {}`) and append the `<slug>` entry.
|
|
230
|
+
3. Report what was created with absolute paths.
|
|
231
|
+
|
|
232
|
+
### Verify (API wrapper)
|
|
233
|
+
|
|
234
|
+
```sh
|
|
235
|
+
# Smoke-test the bin shim
|
|
236
|
+
<scope>/.connectors/connectors/<slug>/bin/<slug> --action <first-action> --params '{}'
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Without credentials, expect `{"status":"error","error_code":"CONFIG_ERROR",…}` — correct shape, testing dispatch plumbing.
|
|
240
|
+
|
|
241
|
+
```sh
|
|
242
|
+
# End-to-end via the hub
|
|
243
|
+
node -e 'import("narai-primitives").then(({gather}) => gather({prompt:"call <slug> <first-action>"}).then(r => console.log(JSON.stringify(r, null, 2))))'
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Common failure causes:
|
|
247
|
+
- `bin` not executable (`chmod +x`)
|
|
248
|
+
- `config.yaml` paths not absolute (must not use `~/...`)
|
|
249
|
+
- `index.mjs` import path wrong (must be `narai-primitives/toolkit`)
|
|
250
|
+
|
|
251
|
+
## Flavor: Shell-command gate
|
|
252
|
+
|
|
253
|
+
Trigger: user wants to gate a Bash command — deny prod kubectl, ask before force push, block destructive operations in certain environments.
|
|
254
|
+
|
|
255
|
+
No `index.mjs`, no `bin/`. The connector is purely declarative (`gates.json`).
|
|
256
|
+
|
|
257
|
+
### Checklist
|
|
258
|
+
|
|
259
|
+
1. **Slug** — short identifier (e.g., `prod-kubectl`, `deploy-guard`).
|
|
260
|
+
2. **Description** — one sentence.
|
|
261
|
+
3. **Rules** — for each rule, ask:
|
|
262
|
+
- Pattern (regex) the command must match
|
|
263
|
+
- Decision: `deny` / `ask` / `allow`
|
|
264
|
+
- Reason (shown to the user in the prompt)
|
|
265
|
+
4. **Scope** — project or user (same as API wrapper).
|
|
266
|
+
|
|
267
|
+
### Stamp (shell-gate)
|
|
268
|
+
|
|
269
|
+
Templates: `assets/templates/shell-gate/gates.json.tmpl`, `assets/templates/shell-gate/SKILL.md.tmpl`.
|
|
270
|
+
|
|
271
|
+
Substitutions: `{{SLUG}}`, `{{DESCRIPTION}}`, `{{RULES}}` (JSON array), `{{RULES_TABLE}}` (markdown table), `{{ServicePascal}}`.
|
|
272
|
+
|
|
273
|
+
After stamping:
|
|
274
|
+
|
|
275
|
+
**First-run wiring** (if `<scope>/.connectors/connector-gate.mjs` doesn't exist yet):
|
|
276
|
+
1. Stamp `assets/templates/_runtime/connector-gate.mjs.tmpl` to `<scope>/.connectors/connector-gate.mjs`. Make it executable. The template is ESM; stamp the content verbatim.
|
|
277
|
+
2. Call `ensureSettingsHook(<scope>/.claude/settings.json, <abs-path-to-connector-gate.mjs>)` from `lib/settings-wiring.mjs`. This adds the `PreToolUse` hook entry. Settings.json is backed up to `<file>.bak-<timestamp>` before any write.
|
|
278
|
+
|
|
279
|
+
Subsequent shell-gate connectors do **not** repeat the first-run wiring — `connector-gate.mjs` auto-discovers all `<scope>/.connectors/connectors/*/gates.json` at runtime.
|
|
280
|
+
|
|
281
|
+
**Register** — call `registerConnector(<scope>, <slug>, {skill: <abs-path>, bin: null})` from `lib/connector-registry.mjs`.
|
|
282
|
+
|
|
283
|
+
### Verify (shell-gate)
|
|
284
|
+
|
|
285
|
+
Run the gate script directly with a synthetic payload to confirm rule evaluation:
|
|
286
|
+
|
|
287
|
+
```sh
|
|
288
|
+
echo '{"tool_name":"Bash","tool_input":{"command":"kubectl delete pod --all -n prod"}}' \
|
|
289
|
+
| node <scope>/.connectors/connector-gate.mjs
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Expect a JSON object with `hookSpecificOutput.permissionDecision` set to `"deny"` (or `"ask"` depending on the rule).
|
|
293
|
+
|
|
294
|
+
## Flavor: Composite orchestrator
|
|
295
|
+
|
|
296
|
+
Trigger: user describes a multi-step flow that calls existing connectors in sequence — pull data from one service, transform or summarize it, post results to another.
|
|
297
|
+
|
|
298
|
+
### Checklist
|
|
299
|
+
|
|
300
|
+
1. **Slug + description**
|
|
301
|
+
2. **Dependencies** — which existing connectors will this call? List slugs. Flag any that aren't yet installed.
|
|
302
|
+
3. **Goal** — what does the composite produce?
|
|
303
|
+
4. **Actions** — name + params + return shape for each (typically 1-3 actions).
|
|
304
|
+
5. **Scope** — project or user.
|
|
305
|
+
|
|
306
|
+
### Stamp (composite)
|
|
307
|
+
|
|
308
|
+
Templates: `assets/templates/composite/index.mjs.tmpl`, `assets/templates/composite/bin.tmpl`, `assets/templates/composite/SKILL.md.tmpl`.
|
|
309
|
+
|
|
310
|
+
The `index.mjs` calls `gather()` to invoke dependency connectors rather than making HTTP calls directly.
|
|
311
|
+
|
|
312
|
+
**Register** — call `registerConnector(<scope>, <slug>, {skill: <abs-path>, bin: <abs-bin-path>})` from `lib/connector-registry.mjs`.
|
|
313
|
+
|
|
314
|
+
### Verify (composite)
|
|
315
|
+
|
|
316
|
+
```sh
|
|
317
|
+
<scope>/.connectors/connectors/<slug>/bin/<slug> --action <first-action> --params '{}'
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
Expect either a success envelope (if dependencies are configured) or a `CONFIG_ERROR` from a missing dependency connector — either is the correct dispatch shape.
|
|
321
|
+
|
|
322
|
+
## Flavor: Knowledge-only
|
|
323
|
+
|
|
324
|
+
Trigger: user wants to document a workflow but no code is needed — runbooks, checklists, process descriptions that the planner should be able to invoke by name.
|
|
325
|
+
|
|
326
|
+
No `index.mjs`, no `bin/`, no `gates.json`.
|
|
327
|
+
|
|
328
|
+
### Checklist
|
|
329
|
+
|
|
330
|
+
1. **Slug + description**
|
|
331
|
+
2. **Use cases** — when should the model invoke this skill? (A sentence or two.)
|
|
332
|
+
3. **Steps** — numbered runbook
|
|
333
|
+
4. **Caveats** — warnings, edge cases, things to watch out for
|
|
334
|
+
|
|
335
|
+
### Stamp (knowledge-only)
|
|
336
|
+
|
|
337
|
+
Template: `assets/templates/knowledge/SKILL.md.tmpl` only.
|
|
338
|
+
|
|
339
|
+
**Register** — call `registerConnector(<scope>, <slug>, {skill: <abs-path>, bin: null})` from `lib/connector-registry.mjs`.
|
|
340
|
+
|
|
341
|
+
### Verify (knowledge-only)
|
|
342
|
+
|
|
343
|
+
No binary to smoke-test. Verify:
|
|
344
|
+
1. The SKILL.md file exists at the expected path.
|
|
345
|
+
2. The `config.yaml` entry is present with `bin: null`.
|
|
346
|
+
3. Ask the user to confirm the runbook content looks right.
|
|
347
|
+
|
|
348
|
+
## Flavor: Custom (code-gen)
|
|
349
|
+
|
|
350
|
+
Trigger: the user's description doesn't fit any of the four shapes above.
|
|
351
|
+
|
|
352
|
+
### Approach
|
|
353
|
+
|
|
354
|
+
1. Discuss with the user what the connector needs to do. Explore the design before generating code.
|
|
355
|
+
2. Write `index.mjs` from scratch (or whatever files make sense). Anchor on the connector contract — see `references/connector-contract.md`.
|
|
356
|
+
3. Stamp `SKILL.md` covering the actions / gates / behavior generated.
|
|
357
|
+
4. Append the entry to `config.yaml`.
|
|
358
|
+
|
|
359
|
+
Use `references/auth-patterns.md` and `references/action-design.md` as building blocks for the code-gen.
|
|
360
|
+
|
|
361
|
+
### Register
|
|
362
|
+
|
|
363
|
+
Call `registerConnector(<scope>, <slug>, {skill: <abs-path>, bin: <abs-bin-path-or-null>})` from `lib/connector-registry.mjs`.
|
|
364
|
+
|
|
365
|
+
## First-run wiring
|
|
366
|
+
|
|
367
|
+
The first time a gate-bearing connector is created (shell-gate flavor, or any custom connector that ships `gates.json`) in a given scope:
|
|
368
|
+
|
|
369
|
+
1. Check whether `<scope>/.connectors/connector-gate.mjs` already exists via `hasConnectorGateHook(<scope>/.claude/settings.json, <scope>/.connectors/connector-gate.mjs)` from `lib/settings-wiring.mjs`.
|
|
370
|
+
2. If not: stamp `assets/templates/_runtime/connector-gate.mjs.tmpl` to `<scope>/.connectors/connector-gate.mjs`. The template is ESM; stamp verbatim. Make the file executable.
|
|
371
|
+
3. Call `ensureSettingsHook(<scope>/.claude/settings.json, <abs-path-to-connector-gate.mjs>)`. This adds a `PreToolUse` hook entry. The function is idempotent — safe to call on every run.
|
|
372
|
+
4. Settings.json is backed up to `<file>.bak-<timestamp>` before any write.
|
|
373
|
+
|
|
374
|
+
After first run, subsequent shell-gate connectors skip stamping — `connector-gate.mjs` auto-discovers all `<scope>/.connectors/connectors/*/gates.json` at runtime.
|
|
375
|
+
|
|
376
|
+
## Policy gate is automatic
|
|
377
|
+
|
|
378
|
+
Every connector built on `createConnector` from `narai-primitives/toolkit` gets the policy gate **automatically**. Classification (`read` / `write` / `delete` / `admin` / `privilege`), approval-mode resolution (`auto` / `confirm_once` / `confirm_each` / `grant_required`), escalation, audit logging, and hardship recording all flow from the toolkit — no extra modules, no approval logic to write yourself.
|
|
379
|
+
|
|
380
|
+
What you **do** choose:
|
|
381
|
+
|
|
382
|
+
- The **classification** of each action (defaults to `read`).
|
|
383
|
+
- The **approval mode** for the connector (defaults to `auto` for read-only connectors).
|
|
384
|
+
|
|
385
|
+
Both surface in the interview only when relevant.
|
|
386
|
+
|
|
387
|
+
## When NOT to use this skill
|
|
388
|
+
|
|
389
|
+
- **Modifying an existing connector.** Edit the file directly.
|
|
390
|
+
- **Wrapping an MCP server.** Different abstraction — point the user at the Claude Code MCP docs.
|
|
391
|
+
- **Querying a supported database.** `narai-primitives/db` already covers postgres, mysql, sqlite, mssql, mongodb, dynamodb, oracle. See `references/db-connector-pointer.md`.
|
|
392
|
+
- **Contributing a builtin connector.** That's a PR to `narailabs/narai-primitives` — different scaffolding, plugin layer, marketplace entry.
|
|
393
|
+
|
|
394
|
+
## Next steps (tell the user)
|
|
395
|
+
|
|
396
|
+
After verification:
|
|
397
|
+
|
|
398
|
+
1. **Set credentials**: `export <ENV_VAR>="…"` (or persist in shell rc). Not applicable for knowledge-only and most shell-gate connectors.
|
|
399
|
+
2. **Run a real action**: `node <bin> --action <action> --params '<real-params>'`. Should return `{"status":"success","data":…}`. Not applicable for knowledge-only.
|
|
400
|
+
3. **(Optional) Add tests**: drop happy-path tests in `tests/` using vitest if installed locally.
|
|
401
|
+
4. **(If broadly useful)** Send a PR to `narailabs/narai-primitives` to promote to a builtin.
|
|
402
|
+
|
|
403
|
+
If auth scheme was `oauth-with-refresh` or `custom`, flag: *"You'll need to implement the OAuth/custom flow in `loadCredentials` in `index.mjs` before the connector works against the live API."*
|
|
404
|
+
|
|
405
|
+
## References
|
|
406
|
+
|
|
407
|
+
- `references/connector-contract.md` — the contract every connector follows; use as the anchor for custom code-gen
|
|
408
|
+
- `references/flavor-authoring.md` — how to add a 6th flavor (template structure, checklist format, registration)
|
|
409
|
+
- `references/research-patterns.md` — when to use WebFetch vs WebSearch vs context7; how to confirm findings with the user
|
|
410
|
+
- `references/auth-patterns.md` — auth schemes and `loadCredentials` snippets for API wrapper connectors
|
|
411
|
+
- `references/action-design.md` — Zod schema patterns, classification rules, approval-mode table for API wrapper actions
|
|
412
|
+
- `references/db-connector-pointer.md` — when to point the user at the bundled db connector instead of building a new one
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* connector-gate.mjs — auto-discovers user connectors at
|
|
4
|
+
* <scope>/.connectors/connectors/*\/gates.json and applies the rules at
|
|
5
|
+
* Claude Code PreToolUse on Bash.
|
|
6
|
+
*
|
|
7
|
+
* Scope is resolved from NARAI_GATE_SCOPE (set by Claude Code's hook
|
|
8
|
+
* invocation), or falls back to the parent of this script's directory.
|
|
9
|
+
*
|
|
10
|
+
* Output shape (per Claude Code hook contract):
|
|
11
|
+
* { hookSpecificOutput: { hookEventName: "PreToolUse",
|
|
12
|
+
* permissionDecision: "allow"|"deny"|"ask",
|
|
13
|
+
* permissionDecisionReason: "..." } }
|
|
14
|
+
*
|
|
15
|
+
* Decision precedence: deny > ask > allow.
|
|
16
|
+
*/
|
|
17
|
+
import * as fs from "node:fs";
|
|
18
|
+
import * as path from "node:path";
|
|
19
|
+
import { fileURLToPath } from "node:url";
|
|
20
|
+
|
|
21
|
+
main().catch((err) => {
|
|
22
|
+
process.stderr.write(`connector-gate: ${err?.message ?? err}\n`);
|
|
23
|
+
process.exit(0);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
async function main() {
|
|
27
|
+
const payload = await readStdinJson();
|
|
28
|
+
if (payload === null) return;
|
|
29
|
+
if (payload.tool_name !== "Bash") return;
|
|
30
|
+
const command = payload.tool_input?.command;
|
|
31
|
+
if (typeof command !== "string" || command.length === 0) return;
|
|
32
|
+
|
|
33
|
+
const scope = resolveScope();
|
|
34
|
+
const decisions = scanConnectors(scope, command);
|
|
35
|
+
if (decisions.length === 0) return;
|
|
36
|
+
|
|
37
|
+
const rank = { deny: 2, ask: 1, allow: 0 };
|
|
38
|
+
decisions.sort((a, b) => rank[b.decision] - rank[a.decision]);
|
|
39
|
+
const winner = decisions[0];
|
|
40
|
+
process.stdout.write(JSON.stringify({
|
|
41
|
+
hookSpecificOutput: {
|
|
42
|
+
hookEventName: "PreToolUse",
|
|
43
|
+
permissionDecision: winner.decision,
|
|
44
|
+
permissionDecisionReason: winner.reason,
|
|
45
|
+
},
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function resolveScope() {
|
|
50
|
+
if (process.env.NARAI_GATE_SCOPE) return process.env.NARAI_GATE_SCOPE;
|
|
51
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
52
|
+
return path.dirname(here); // …/<scope>/.connectors → <scope>
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function scanConnectors(scope, command) {
|
|
56
|
+
const root = path.join(scope, ".connectors", "connectors");
|
|
57
|
+
if (!fs.existsSync(root)) return [];
|
|
58
|
+
// NARAI_GATE_DISABLE is a comma-separated list of rule names to skip.
|
|
59
|
+
// Documented in the shell-gate SKILL.md as the disable hatch; runtime
|
|
60
|
+
// honors it so operators can silence a noisy rule without editing
|
|
61
|
+
// gates.json.
|
|
62
|
+
const disabled = new Set(
|
|
63
|
+
(process.env.NARAI_GATE_DISABLE ?? "")
|
|
64
|
+
.split(",")
|
|
65
|
+
.map((s) => s.trim())
|
|
66
|
+
.filter(Boolean),
|
|
67
|
+
);
|
|
68
|
+
const out = [];
|
|
69
|
+
for (const slug of fs.readdirSync(root)) {
|
|
70
|
+
const file = path.join(root, slug, "gates.json");
|
|
71
|
+
if (!fs.existsSync(file)) continue;
|
|
72
|
+
try {
|
|
73
|
+
const cfg = JSON.parse(fs.readFileSync(file, "utf-8"));
|
|
74
|
+
for (const rule of cfg.rules ?? []) {
|
|
75
|
+
if (
|
|
76
|
+
!["deny", "ask", "allow"].includes(rule.decision) ||
|
|
77
|
+
typeof rule.pattern !== "string"
|
|
78
|
+
) continue;
|
|
79
|
+
if (typeof rule.name === "string" && disabled.has(rule.name)) continue;
|
|
80
|
+
let re;
|
|
81
|
+
try { re = new RegExp(rule.pattern); } catch { continue; }
|
|
82
|
+
for (const segment of splitCompound(command)) {
|
|
83
|
+
if (re.test(segment)) {
|
|
84
|
+
out.push({
|
|
85
|
+
decision: rule.decision,
|
|
86
|
+
reason: rule.reason ?? `${slug}: ${rule.name ?? "rule"}`,
|
|
87
|
+
});
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
} catch (err) {
|
|
93
|
+
process.stderr.write(`connector-gate: bad ${file} (${err.message})\n`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return out;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function splitCompound(cmd) {
|
|
100
|
+
const parts = cmd.split(/\s*(?:&&|\|\||;|\|)\s*/);
|
|
101
|
+
return parts
|
|
102
|
+
.map((p) => stripPrefix(p.trim()))
|
|
103
|
+
.filter((p) => p.length > 0);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function stripPrefix(s) {
|
|
107
|
+
let cur = s;
|
|
108
|
+
while (/^[A-Za-z_][A-Za-z0-9_]*=\S*\s+/.test(cur)) {
|
|
109
|
+
cur = cur.replace(/^[A-Za-z_][A-Za-z0-9_]*=\S*\s+/, "");
|
|
110
|
+
}
|
|
111
|
+
return cur.replace(/^(sudo|nice|time)\s+/, "");
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
async function readStdinJson() {
|
|
115
|
+
const chunks = [];
|
|
116
|
+
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
117
|
+
const raw = Buffer.concat(chunks).toString("utf-8").trim();
|
|
118
|
+
if (raw.length === 0) return null;
|
|
119
|
+
try { return JSON.parse(raw); } catch { return null; }
|
|
120
|
+
}
|
package/plugins/connector-creator/skills/connector-creator/assets/templates/composite/SKILL.md.tmpl
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: {{SLUG}}
|
|
3
|
+
description: |
|
|
4
|
+
{{DESCRIPTION}}
|
|
5
|
+
context: connector
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# {{ServicePascal}}
|
|
9
|
+
|
|
10
|
+
Composite orchestrator. {{DESCRIPTION}}
|
|
11
|
+
|
|
12
|
+
## Calls
|
|
13
|
+
|
|
14
|
+
This connector calls these other connectors via `gather()`:
|
|
15
|
+
|
|
16
|
+
{{DEPENDENCIES_TABLE}}
|
|
17
|
+
|
|
18
|
+
## Actions
|
|
19
|
+
|
|
20
|
+
{{ACTIONS_TABLE_MD}}
|
|
21
|
+
|
|
22
|
+
## Invocation
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
{{SLUG}} --action {{FIRST_ACTION}} --params '{...}'
|
|
26
|
+
```
|
package/plugins/connector-creator/skills/connector-creator/assets/templates/composite/index.mjs.tmpl
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// {{SLUG}} — composite orchestrator. Calls {{DEPENDENCIES}} and composes the result.
|
|
2
|
+
import { gather } from "narai-primitives";
|
|
3
|
+
|
|
4
|
+
const SLUG = "{{SLUG}}";
|
|
5
|
+
|
|
6
|
+
async function main() {
|
|
7
|
+
const args = parseArgs(process.argv.slice(2));
|
|
8
|
+
if (!args.action) return errorEnvelope("VALIDATION_ERROR", "missing --action");
|
|
9
|
+
|
|
10
|
+
switch (args.action) {
|
|
11
|
+
{{ACTIONS_DICTIONARY}}
|
|
12
|
+
default:
|
|
13
|
+
return errorEnvelope("VALIDATION_ERROR", `unknown action ${args.action}`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function parseArgs(argv) {
|
|
18
|
+
const out = {};
|
|
19
|
+
for (let i = 0; i < argv.length; i++) {
|
|
20
|
+
if (argv[i] === "--action") out.action = argv[++i];
|
|
21
|
+
if (argv[i] === "--params") out.params = JSON.parse(argv[++i]);
|
|
22
|
+
}
|
|
23
|
+
return out;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function errorEnvelope(code, message) {
|
|
27
|
+
process.stdout.write(JSON.stringify({
|
|
28
|
+
status: "error",
|
|
29
|
+
error_code: code,
|
|
30
|
+
message,
|
|
31
|
+
}) + "\n");
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
main().catch((err) => errorEnvelope("INTERNAL_ERROR", err?.message ?? String(err)));
|
package/plugins/connector-creator/skills/connector-creator/assets/templates/knowledge/SKILL.md.tmpl
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: {{SLUG}}
|
|
3
|
+
description: |
|
|
4
|
+
{{DESCRIPTION}}
|
|
5
|
+
context: connector
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# {{ServicePascal}}
|
|
9
|
+
|
|
10
|
+
Knowledge-only connector — no executable code. The model uses this SKILL.md
|
|
11
|
+
as a runbook for {{DESCRIPTION_SHORT}}.
|
|
12
|
+
|
|
13
|
+
## When to use
|
|
14
|
+
|
|
15
|
+
{{USE_CASES}}
|
|
16
|
+
|
|
17
|
+
## Steps
|
|
18
|
+
|
|
19
|
+
{{STEPS}}
|
|
20
|
+
|
|
21
|
+
## Caveats
|
|
22
|
+
|
|
23
|
+
{{CAVEATS}}
|
package/plugins/connector-creator/skills/connector-creator/assets/templates/shell-gate/SKILL.md.tmpl
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: {{SLUG}}
|
|
3
|
+
description: |
|
|
4
|
+
{{DESCRIPTION}}
|
|
5
|
+
context: connector
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# {{ServicePascal}}
|
|
9
|
+
|
|
10
|
+
Shell-command gate. {{DESCRIPTION}}
|
|
11
|
+
|
|
12
|
+
## What it does
|
|
13
|
+
|
|
14
|
+
When Claude Code is about to invoke a Bash command matching one of the
|
|
15
|
+
patterns below, this connector intercepts and surfaces a permission
|
|
16
|
+
decision. No actions are exposed; this connector is purely a gate.
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
|
|
20
|
+
| Pattern | Decision | Reason |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
{{RULES_TABLE}}
|
|
23
|
+
|
|
24
|
+
## Disable
|
|
25
|
+
|
|
26
|
+
Set `NARAI_GATE_DISABLE` to a comma-separated list of rule names to skip
|
|
27
|
+
specific rules without uninstalling.
|