Skip to content

Commit 602a82e

Browse files
suryaiyer95claude
andcommitted
fix: address code review findings — re-add altimate_core_rewrite, fix tool_lookup, fix skill docs
- Re-add `altimate_core_rewrite` to registry (different Rust backend from `sql_optimize`) - Fix `tool_lookup` to use new `ToolRegistry.allInfos()` instead of fake providerID/modelID hack - Fix `sql-review` SKILL.md: correct `altimate_core_check` params (`schema_context`, no `dialect`) - Fix `pii-audit` SKILL.md: add `schema_index` prerequisite in Option B code block - Add deprecation markers to 6 removed tool source files - Fix misleading test name "tool count is exactly 80" - Update all test REMOVED lists to exclude `altimate_core_rewrite` Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a956f1c commit 602a82e

13 files changed

Lines changed: 33 additions & 26 deletions

.opencode/skills/pii-audit/SKILL.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ Analyzes column names, types, and patterns to detect PII categories:
3939

4040
**Option B — From warehouse connection:**
4141

42-
First inspect the schema, then classify:
42+
First index the schema, inspect it, then classify:
4343
```
44+
schema_index(warehouse: <name>)
4445
schema_inspect(warehouse: <name>, database: <db>, schema: <schema>, table: <table>)
4546
schema_detect_pii(warehouse: <name>)
4647
```

.opencode/skills/sql-review/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,15 @@ Call `altimate_core_check` — this is the single-call code review that composes
4949
- **PII exposure**: Flags queries accessing columns classified as PII
5050

5151
```
52-
altimate_core_check(sql: <sql>, schema: <schema_yaml>, dialect: <dialect>)
52+
altimate_core_check(sql: <sql>, schema_context: <schema_object>)
5353
```
5454

5555
### 3. Grade the SQL
5656

5757
Call `altimate_core_grade` to get an A-F quality score with per-category breakdown:
5858

5959
```
60-
altimate_core_grade(sql: <sql>, schema: <schema_yaml>)
60+
altimate_core_grade(sql: <sql>, schema_context: <schema_object>)
6161
```
6262

6363
Categories scored:

packages/opencode/src/altimate/tools/altimate-core-format.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// DEPRECATED: Removed from registry in PR #222. Superseded by sql_format.
12
import z from "zod"
23
import { Tool } from "../../tool/tool"
34
import { Bridge } from "../bridge/client"

packages/opencode/src/altimate/tools/altimate-core-is-safe.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// DEPRECATED: Removed from registry in PR #222. Superseded by altimate_core_check.
12
import z from "zod"
23
import { Tool } from "../../tool/tool"
34
import { Bridge } from "../bridge/client"

packages/opencode/src/altimate/tools/altimate-core-lint.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// DEPRECATED: Removed from registry in PR #222. Superseded by altimate_core_check.
12
import z from "zod"
23
import { Tool } from "../../tool/tool"
34
import { Bridge } from "../bridge/client"

packages/opencode/src/altimate/tools/altimate-core-optimize-for-query.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// DEPRECATED: Removed from registry in PR #222. Superseded by altimate_core_prune_schema.
12
import z from "zod"
23
import { Tool } from "../../tool/tool"
34
import { Bridge } from "../bridge/client"

packages/opencode/src/altimate/tools/altimate-core-safety.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// DEPRECATED: Removed from registry in PR #222. Superseded by altimate_core_check.
12
import z from "zod"
23
import { Tool } from "../../tool/tool"
34
import { Bridge } from "../bridge/client"

packages/opencode/src/altimate/tools/altimate-core-transpile.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// DEPRECATED: Removed from registry in PR #222. Superseded by sql_translate.
12
import z from "zod"
23
import { Tool } from "../../tool/tool"
34
import { Bridge } from "../bridge/client"

packages/opencode/src/altimate/tools/tool-lookup.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,20 @@ export const ToolLookupTool = Tool.define("tool_lookup", {
1010
tool_name: z.string().describe("Exact tool ID (e.g., 'sql_analyze', 'altimate_core_migration')"),
1111
}),
1212
async execute(args) {
13-
const tools = await ToolRegistry.tools(
14-
{ providerID: "anthropic" as any, modelID: "" as any },
15-
undefined,
16-
)
17-
const tool = tools.find((t) => t.id === args.tool_name)
18-
if (!tool) {
19-
const ids = tools.map((t) => t.id).sort()
13+
const infos = await ToolRegistry.allInfos()
14+
const info = infos.find((t) => t.id === args.tool_name)
15+
if (!info) {
16+
const ids = infos.map((t) => t.id).sort()
2017
return {
2118
title: "Tool not found",
2219
metadata: {},
2320
output: `No tool named "${args.tool_name}". Available tools:\n${ids.join(", ")}`,
2421
}
2522
}
2623

24+
const tool = await info.init()
2725
const params = describeZodSchema(tool.parameters)
28-
const lines = [tool.id, ` ${tool.description}`, ""]
26+
const lines = [info.id, ` ${tool.description}`, ""]
2927
if (params.length) {
3028
lines.push(" Parameters:")
3129
for (const p of params) {
@@ -37,7 +35,7 @@ export const ToolLookupTool = Tool.define("tool_lookup", {
3735
lines.push(" No parameters.")
3836
}
3937

40-
return { title: `Lookup: ${tool.id}`, metadata: {}, output: lines.join("\n") }
38+
return { title: `Lookup: ${info.id}`, metadata: {}, output: lines.join("\n") }
4139
},
4240
})
4341

packages/opencode/src/tool/registry.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ import { AltimateCoreExportDdlTool } from "../altimate/tools/altimate-core-expor
9292
import { AltimateCoreFingerprintTool } from "../altimate/tools/altimate-core-fingerprint"
9393
import { AltimateCoreIntrospectionSqlTool } from "../altimate/tools/altimate-core-introspection-sql"
9494
import { AltimateCoreParseDbtTool } from "../altimate/tools/altimate-core-parse-dbt"
95+
import { AltimateCoreRewriteTool } from "../altimate/tools/altimate-core-rewrite"
9596
import { ToolLookupTool } from "../altimate/tools/tool-lookup"
9697
import { ProjectScanTool } from "../altimate/tools/project-scan"
9798
import { DatamateManagerTool } from "../altimate/tools/datamate"
@@ -236,6 +237,7 @@ export namespace ToolRegistry {
236237
SchemaTagsTool,
237238
SchemaTagsListTool,
238239
SqlRewriteTool,
240+
AltimateCoreRewriteTool,
239241
SchemaDiffTool,
240242
AltimateCoreValidateTool,
241243
AltimateCoreCheckTool,
@@ -278,6 +280,11 @@ export namespace ToolRegistry {
278280
]
279281
}
280282

283+
/** All tool infos without model/provider filtering. */
284+
export async function allInfos(): Promise<Tool.Info[]> {
285+
return all()
286+
}
287+
281288
export async function ids() {
282289
return all().then((x) => x.map((t) => t.id))
283290
}

0 commit comments

Comments
 (0)