mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-13 08:15:14 +02:00
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.
63 lines
2.3 KiB
JavaScript
63 lines
2.3 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import { access, readFile } from 'node:fs/promises';
|
|
import { dirname, resolve } from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { describe, it } from 'node:test';
|
|
|
|
const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
const ciWorkflowPath = resolve(repoRoot, '.github', 'workflows', 'ci.yml');
|
|
|
|
async function readCiWorkflowOrSkip(testContext) {
|
|
try {
|
|
await access(ciWorkflowPath);
|
|
} catch (error) {
|
|
if (error && error.code === 'ENOENT') {
|
|
testContext.skip('root CI workflow is absent from sparse ktx checkout');
|
|
return null;
|
|
}
|
|
throw error;
|
|
}
|
|
return readFile(ciWorkflowPath, 'utf-8');
|
|
}
|
|
|
|
describe('ktx CI artifact upload contract', () => {
|
|
it('uploads verified ktx package artifacts from the standalone check job', async (testContext) => {
|
|
const workflow = await readCiWorkflowOrSkip(testContext);
|
|
if (workflow === null) {
|
|
return;
|
|
}
|
|
|
|
assert.match(
|
|
workflow,
|
|
/name: Build and verify package artifacts\s+run: pnpm run artifacts:check\s+- name: Upload package artifacts/s,
|
|
);
|
|
assert.match(workflow, /uses: actions\/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a/);
|
|
assert.match(workflow, /name: ktx-package-artifacts-\$\{\{ github\.sha \}\}/);
|
|
assert.match(workflow, /dist\/artifacts\/manifest\.json/);
|
|
assert.match(workflow, /dist\/artifacts\/npm\/\*\.tgz/);
|
|
assert.match(workflow, /dist\/artifacts\/python\/\*\.whl/);
|
|
assert.match(workflow, /dist\/artifacts\/python\/\*\.tar\.gz/);
|
|
assert.match(workflow, /if-no-files-found: error/);
|
|
assert.match(workflow, /retention-days: 7/);
|
|
});
|
|
|
|
it('runs TypeScript and Python checks in the standalone workflow', async (testContext) => {
|
|
const workflow = await readCiWorkflowOrSkip(testContext);
|
|
if (workflow === null) {
|
|
return;
|
|
}
|
|
|
|
assert.match(workflow, /run: pnpm run check/);
|
|
assert.match(workflow, /run: uv sync --all-packages/);
|
|
assert.match(workflow, /run: uv run pytest/);
|
|
});
|
|
|
|
it('does not depend on host application CI jobs', async (testContext) => {
|
|
const workflow = await readCiWorkflowOrSkip(testContext);
|
|
if (workflow === null) {
|
|
return;
|
|
}
|
|
|
|
assert.doesNotMatch(workflow, /build-python-service|test-server|build-frontend|build-docker-images/);
|
|
});
|
|
});
|