refactor: enforce ktx naming and AGENTS.md compliance sweep (#289)

Align the tree with AGENTS.md/CLAUDE.md conventions:

- Rewrite user-facing strings, docs, and tests to lowercase `ktx`
  (no bare uppercase `KTX` tokens remain outside literal identifiers).
- Drop the legacy `historicSql` migration path and its now-unused
  helpers, per the no-backward-compat rule.
- Remove `as unknown as` / `any` casts: narrow `BaseTool` generics to
  `z.ZodObject`, add a typed `createLookerClient`, and delete the dead
  `getParametersSchema`/`toAnthropicFormat` pre-AI-SDK helpers.
- Use `InvalidArgumentError` for Commander parse failures.
- Finish the adapter→connector prose conversion in the `ktx.yaml` docs
  while keeping the literal `adapters` config key.
This commit is contained in:
Andrey Avtomonov 2026-06-11 13:49:45 +02:00 committed by GitHub
parent 005c5fc860
commit 00cdf2de90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
237 changed files with 844 additions and 974 deletions

View file

@ -2,7 +2,7 @@
{
"name": "connection_list",
"title": "Connection List",
"description": "List configured read-only data connections available to this KTX project. Use this before connection-scoped tools when the project may have multiple warehouses.",
"description": "List configured read-only data connections available to this ktx project. Use this before connection-scoped tools when the project may have multiple warehouses.",
"inputSchema": {
"type": "object",
"properties": {},
@ -54,7 +54,7 @@
{
"name": "wiki_search",
"title": "Wiki Search",
"description": "Search KTX wiki pages for reusable business context. Example: wiki_search({ query: \"revenue recognition\", limit: 5 }).",
"description": "Search ktx wiki pages for reusable business context. Example: wiki_search({ query: \"revenue recognition\", limit: 5 }).",
"inputSchema": {
"type": "object",
"properties": {
@ -181,7 +181,7 @@
{
"name": "wiki_read",
"title": "Wiki Read",
"description": "Read a KTX wiki page by key returned from wiki_search. Example: wiki_read({ key: \"global/revenue\" }).",
"description": "Read a ktx wiki page by key returned from wiki_search. Example: wiki_read({ key: \"global/revenue\" }).",
"inputSchema": {
"type": "object",
"properties": {
@ -1227,7 +1227,7 @@
{
"name": "discover_data",
"title": "Discover Data",
"description": "Search across KTX wiki pages, semantic-layer sources, measures, dimensions, raw tables, and columns. Example: discover_data({ query: \"monthly orders by customer\", connectionId: \"warehouse\", kinds: [\"sl_source\", \"table\"] }).",
"description": "Search across ktx wiki pages, semantic-layer sources, measures, dimensions, raw tables, and columns. Example: discover_data({ query: \"monthly orders by customer\", connectionId: \"warehouse\", kinds: [\"sl_source\", \"table\"] }).",
"inputSchema": {
"type": "object",
"properties": {
@ -1398,7 +1398,7 @@
{
"name": "sql_execution",
"title": "SQL Execution",
"description": "Execute one parser-validated read-only SQL query against a configured KTX connection. Example: sql_execution({ connectionId: \"warehouse\", sql: \"select count(*) from public.orders\", maxRows: 100 }).",
"description": "Execute one parser-validated read-only SQL query against a configured ktx connection. Example: sql_execution({ connectionId: \"warehouse\", sql: \"select count(*) from public.orders\", maxRows: 100 }).",
"inputSchema": {
"type": "object",
"properties": {
@ -1472,7 +1472,7 @@
{
"name": "memory_ingest",
"title": "Memory Ingest",
"description": "Ingest free-form markdown knowledge into durable KTX memory. Use this for business rules, metric definitions, schema gotchas, recurring findings, or explicit user requests to remember something. Example: memory_ingest({ connectionId: \"warehouse\", content: \"ARR is reported in cents in this warehouse.\" }).",
"description": "Ingest free-form markdown knowledge into durable ktx memory. Use this for business rules, metric definitions, schema gotchas, recurring findings, or explicit user requests to remember something. Example: memory_ingest({ connectionId: \"warehouse\", content: \"ARR is reported in cents in this warehouse.\" }).",
"inputSchema": {
"type": "object",
"properties": {

View file

@ -987,7 +987,7 @@ describe('createKtxMcpServer', () => {
expect(ingest.ingest).toHaveBeenCalledWith({
userId: 'mcp-user',
chatId: expect.stringMatching(/^mcp-/),
userMessage: 'Ingest external knowledge into KTX memory.',
userMessage: 'Ingest external knowledge into ktx memory.',
assistantMessage: content,
connectionId: '00000000-0000-4000-8000-000000000001',
sourceType: 'external_ingest',
@ -996,7 +996,7 @@ describe('createKtxMcpServer', () => {
const cliEquivalentInput: MemoryAgentInput = {
userId: 'mcp-user',
chatId: 'cli-text-ingest-test-1',
userMessage: 'Ingest external text artifact "orders lookml" into KTX memory.',
userMessage: 'Ingest external text artifact "orders lookml" into ktx memory.',
assistantMessage: content,
connectionId: '00000000-0000-4000-8000-000000000001',
sourceType: 'external_ingest',
@ -1101,7 +1101,7 @@ describe('createKtxMcpServer', () => {
expect(ingestSpy).toHaveBeenCalledWith({
userId: 'local',
chatId: expect.stringMatching(/^mcp-/),
userMessage: 'Ingest external knowledge into KTX memory.',
userMessage: 'Ingest external knowledge into ktx memory.',
assistantMessage: 'Revenue means paid order value.',
connectionId: 'warehouse',
sourceType: 'external_ingest',
@ -1127,7 +1127,7 @@ describe('createKtxMcpServer', () => {
}
});
it('registers KTX context MCP tools when context ports are supplied', async () => {
it('registers ktx context MCP tools when context ports are supplied', async () => {
const fake = makeFakeServer();
const contextTools: KtxMcpContextPorts = {
connections: {
@ -1298,7 +1298,7 @@ describe('createKtxMcpServer', () => {
expect(jsonToolResult({ ok: true }).structuredContent).toEqual({ ok: true });
if (false) {
// @ts-expect-error bare arrays are not valid MCP structuredContent objects in KTX
// @ts-expect-error bare arrays are not valid MCP structuredContent objects in ktx
jsonToolResult([]);
}
});