mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-10 08:05:14 +02:00
* docs: revise claude-code ingest backend spec * docs: keep claude-code spec focused on ingest * docs: expand claude-code spec to full llm parity * Refine claude-code backend spec after adversarial review iteration 1 * Refine claude-code backend spec after adversarial review iteration 2 * Refine claude-code backend spec after adversarial review iteration 3 * feat: recognize claude-code llm backend * feat: add ktx llm runtime port * feat: add claude-code llm runtime * feat: route non-agent llm calls through runtime * feat: run ingest agents through llm runtime * feat: support claude-code setup and status * test: verify claude-code backend runtime * docs: add claude-code backend v1 runtime plan * fix: close claude-code runtime isolation checks * fix: warn on claude-code prompt caching during setup * chore: verify claude-code v1 closure * docs: add claude-code backend v1 isolation closure plan * fix: update claude-code ingest setup guidance * docs: add claude-code backend v1 ingest guidance closure plan * docs: align claude-code isolation spec with sdk metadata * test: cover claude-code host discovery metadata * fix: tolerate claude-code host discovery metadata * docs: clarify claude-code host discovery metadata * docs: add claude-code auth-probe isolation fix plan * chore: prepare kaelio ktx rc1 release * chore: add semantic release workflow * fix: unblock ci checks * chore(release): 0.1.0-rc.1 * feat: add Claude Code model selection to setup * fix: keep git maintenance attached in local repos
109 lines
3 KiB
JavaScript
109 lines
3 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import { readFile } from 'node:fs/promises';
|
|
import { describe, it } from 'node:test';
|
|
|
|
import {
|
|
buildNpmPublishCommand,
|
|
requireNpmPublicReleaseReady,
|
|
resolvePublishMode,
|
|
} from './publish-public-npm-package.mjs';
|
|
|
|
const readyReport = {
|
|
releaseMode: 'npm-public-release-ready',
|
|
npmPublishEnabled: true,
|
|
npmPublish: {
|
|
packageName: '@kaelio/ktx',
|
|
version: '0.1.0-rc.1',
|
|
access: 'public',
|
|
tag: 'next',
|
|
registry: null,
|
|
},
|
|
};
|
|
|
|
describe('resolvePublishMode', () => {
|
|
it('dry-runs by default', () => {
|
|
assert.deepEqual(resolvePublishMode([]), { live: false });
|
|
});
|
|
|
|
it('requires an explicit flag for live publish', () => {
|
|
assert.deepEqual(resolvePublishMode(['--publish']), { live: true });
|
|
});
|
|
});
|
|
|
|
describe('requireNpmPublicReleaseReady', () => {
|
|
it('accepts the npm public release ready report', () => {
|
|
assert.equal(requireNpmPublicReleaseReady(readyReport), readyReport.npmPublish);
|
|
});
|
|
|
|
it('rejects artifact-only reports', () => {
|
|
assert.throws(
|
|
() =>
|
|
requireNpmPublicReleaseReady({
|
|
releaseMode: 'ci-artifact-only',
|
|
npmPublishEnabled: false,
|
|
npmPublish: null,
|
|
}),
|
|
/release-policy.json must use npm-public-release-ready before publishing/,
|
|
);
|
|
});
|
|
});
|
|
|
|
describe('buildNpmPublishCommand', () => {
|
|
it('builds a dry-run pnpm publish command by default', () => {
|
|
assert.deepEqual(
|
|
buildNpmPublishCommand('/repo/ktx/dist/artifacts/npm/kaelio-ktx-0.1.0-rc.1.tgz', readyReport.npmPublish, {
|
|
live: false,
|
|
}),
|
|
{
|
|
command: 'pnpm',
|
|
args: [
|
|
'publish',
|
|
'/repo/ktx/dist/artifacts/npm/kaelio-ktx-0.1.0-rc.1.tgz',
|
|
'--access',
|
|
'public',
|
|
'--tag',
|
|
'next',
|
|
'--dry-run',
|
|
'--no-git-checks',
|
|
],
|
|
env: {},
|
|
},
|
|
);
|
|
});
|
|
|
|
it('omits dry-run only for explicit live publish', () => {
|
|
assert.deepEqual(
|
|
buildNpmPublishCommand('/repo/ktx/dist/artifacts/npm/kaelio-ktx-0.1.0-rc.1.tgz', readyReport.npmPublish, {
|
|
live: true,
|
|
}).args,
|
|
[
|
|
'publish',
|
|
'/repo/ktx/dist/artifacts/npm/kaelio-ktx-0.1.0-rc.1.tgz',
|
|
'--access',
|
|
'public',
|
|
'--tag',
|
|
'next',
|
|
],
|
|
);
|
|
});
|
|
|
|
it('uses npm_config_registry when a registry is configured', () => {
|
|
const publish = {
|
|
...readyReport.npmPublish,
|
|
registry: 'https://registry.npmjs.org/',
|
|
};
|
|
|
|
assert.deepEqual(
|
|
buildNpmPublishCommand('/repo/ktx/dist/artifacts/npm/kaelio-ktx-0.1.0-rc.1.tgz', publish, { live: false }).env,
|
|
{ npm_config_registry: 'https://registry.npmjs.org/' },
|
|
);
|
|
});
|
|
});
|
|
|
|
describe('package script', () => {
|
|
it('registers release:npm-publish', async () => {
|
|
const packageJson = JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8'));
|
|
|
|
assert.equal(packageJson.scripts['release:npm-publish'], 'node scripts/publish-public-npm-package.mjs');
|
|
});
|
|
});
|