Skip to content

[EPIC-D][LOU-D25] github and jira tools are defined with defineTool; src/tools has no ai import - #114

Merged
LinuxDevil merged 1 commit into
mainfrom
lou-d25-github-jira-define-tool
Oct 1, 2026
Merged

LinuxDevil merged 1 commit into
mainfrom
lou-d25-github-jira-define-tool

Conversation

@LinuxDevil

Copy link
Copy Markdown
Owner

What

  • All 28 createGitHubTools() tools and all 20 createJiraTools() tools are built with defineTool instead of ai's tool(). Names, descriptions, zod schemas, sandbox flags and factory signatures are unchanged. Each tool now carries canonical inputSchema / execute, and the legacy .tool stays.
  • The change is mechanical (a regex codemod over the this.register('name', { displayName, tool: tool({ ... }) }) pattern). Inner lines keep their indentation, so only each tool's header and footer lines changed. parameters: became input:.
  • GitHubTools.register() disables the out-of-scope tools by registering a copy of the descriptor whose canonical execute and legacy tool.execute both throw the "out of scope" error. A canonical execute takes priority, so overriding only tool.execute would have left the real implementation reachable. This is the same hazard D24 fixed in examples/ops-pipeline/fixer.ts.
  • JiraTools.register() now routes a defineTool result through routeFetchThroughSandbox as well. Before, the register(DefinedTool) overload skipped it, so a descriptor registered that way would not have been flagged requiresSandbox.
  • src/tools/noAiToolImport.test.ts lists github.ts and jira.ts. CHANGELOG has an entry under Changed (not breaking).

Why

Step 4 of the ai v4 -> v6/v7 upgrade chain (after D22 #79, D23 #103 and D24 #108). With the last tool() call under src/tools gone, the legacy .tool shape can be removed in D26.

ai imports remaining under src/:

  • Production code: src/types/tool.ts (type import), src/providers/* (OpenRouterProvider, AnthropicProvider, OpenAIProvider, OllamaProvider, aiSdkProvider), src/execution/structuredOutput.ts and src/execution/errors.ts.
  • Tests only: src/tools/toolContract.test.ts and src/tools/defineTool.test-d.ts (they import ai to assert that defineTool no longer calls ai.tool()), plus provider and execution tests.

No production file under src/tools imports ai any more. A literal grep -rn "from 'ai'" src/tools still matches those two D22 test files. I left them alone because they are out of this ticket's scope and they test the absence of tool().

Acceptance criteria

  • Both files build every descriptor with defineTool (28 + 20), import nothing from ai, and keep names, descriptions, schemas and factory signatures unchanged. Neither file sets needsApproval or requiresSandbox itself, so no such flags changed. requiresSandbox and sandboxExecute are still set in register() via routeFetchThroughSandbox.
  • Scope and disable logic works through the canonical execute: a new test calls every out-of-scope GitHub tool through getToolExecute() and descriptor.execute and expects the "out of scope" error with no fetch call.
  • Existing github.test.ts and jira.test.ts pass with no edits to existing assertions. I only added new tests, and the existing tests still call .tool.execute, which now equals the canonical execute.
  • Both files added to noAiToolImport.test.ts.
  • The diff is mostly header and footer lines, not reformatting.
  • CHANGELOG entry under Changed (not breaking). No docs changes.
  • Only the in-scope files were touched.

How verified

  • npx tsc --noEmit: pass, no output.
  • npm run lint: 0 errors, 402 warnings. For the files I touched, github.ts + jira.ts still have 23 warnings, the same as on origin/main, and the two test files have 18, with none added.
  • npm run test:types: 30 passed, no type errors.
  • npx vitest run after npm run build (the create-loushy-agent e2e test needs dist): 160 files passed, 2337 tests passed, 3 skipped.
  • npm run build && npm run build --workspace=packages/create-loushy-agent: success.
  • npm run test:coverage: exit 0.
  • npm run fallow: exit 0, "No issues found" in dead code, and no refactor targets above threshold. It lists one existing duplicate block, AnthropicProvider.ts and OpenAIProvider.ts, which this PR does not touch.
  • docs:verify-snippets and docs:llms:check were not run, since README and docs are untouched.

🤖 Generated with Claude Code

https://claude.ai/code/session_016bY29ibQgv3MDdjAbUT4YR


Generated by Claude Code

…src/tools has no ai import

All 28 GitHub and 20 Jira descriptors are built with defineTool (names,
descriptions, schemas and factory signatures unchanged) and carry canonical
inputSchema / execute. GitHubTools.register() disables out-of-scope tools by
registering a copy whose canonical execute and legacy tool.execute both throw.
JiraTools.register() now routes defineTool results through the sandbox seam.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016bY29ibQgv3MDdjAbUT4YR
@LinuxDevil
LinuxDevil merged commit acd46cf into main Oct 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants