mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-22 08:38:08 +02:00
fix: update ktx CI boundary checks (#223)
This commit is contained in:
parent
0eeac6f980
commit
bc7373fa8e
5 changed files with 6 additions and 110 deletions
|
|
@ -5,15 +5,6 @@ import path from 'node:path';
|
|||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
|
||||
const codeExtensions = new Set(['.ts', '.tsx', '.js', '.jsx', '.mjs', '.cjs', '.py']);
|
||||
const runtimeAssetPatterns = [/^packages\/cli\/src\/prompts\/.+\.md$/, /^packages\/cli\/src\/skills\/.+\.md$/];
|
||||
const identifierSkipPrefixes = ['docs/', 'docs-site/', 'examples/', 'python/ktx-sl/plans/', 'python/ktx-sl/openspec/'];
|
||||
const identifierAllowPatterns = [
|
||||
/^packages\/cli\/src\/(?:index|managed-local-embeddings|managed-python-command|managed-python-daemon|managed-python-runtime|release-version|runtime)(?:\.test)?\.ts$/,
|
||||
/^python\/ktx-daemon\/src\/ktx_daemon\/__init__\.py$/,
|
||||
/^scripts\/(?:build-python-runtime-wheel|local-embeddings-runtime-smoke|package-artifacts|public-npm-release-metadata|published-package-smoke|release-readiness)(?:\.test)?\.mjs$/,
|
||||
/^scripts\/semantic-release-config\.cjs$/,
|
||||
];
|
||||
const forbiddenIdentifierTerms = ['kae' + 'lio', 'Kae' + 'lio', 'KAE' + 'LIO_'];
|
||||
|
||||
const appImportPatterns = [
|
||||
{
|
||||
|
|
@ -83,10 +74,6 @@ function isCodeSource(relativePath) {
|
|||
return codeExtensions.has(path.extname(relativePath));
|
||||
}
|
||||
|
||||
function isRuntimeAsset(relativePath) {
|
||||
return runtimeAssetPatterns.some((pattern) => pattern.test(relativePath));
|
||||
}
|
||||
|
||||
function scansForAppImports(relativePath) {
|
||||
return isCodeSource(relativePath);
|
||||
}
|
||||
|
|
@ -113,18 +100,6 @@ function scansForConcreteDialectImportBoundaries(relativePath) {
|
|||
);
|
||||
}
|
||||
|
||||
function scansForForbiddenIdentifiers(relativePath) {
|
||||
return (isCodeSource(relativePath) && !isTestSource(relativePath)) || isRuntimeAsset(relativePath);
|
||||
}
|
||||
|
||||
function skipsIdentifierScan(relativePath) {
|
||||
return identifierSkipPrefixes.some((prefix) => relativePath.startsWith(prefix));
|
||||
}
|
||||
|
||||
function allowsForbiddenIdentifier(relativePath) {
|
||||
return identifierAllowPatterns.some((pattern) => pattern.test(relativePath));
|
||||
}
|
||||
|
||||
export function scanFileContent(relativePath, content) {
|
||||
const normalizedPath = normalizePath(relativePath);
|
||||
const violations = [];
|
||||
|
|
@ -178,22 +153,6 @@ export function scanFileContent(relativePath, content) {
|
|||
}
|
||||
}
|
||||
|
||||
if (
|
||||
scansForForbiddenIdentifiers(normalizedPath) &&
|
||||
!skipsIdentifierScan(normalizedPath) &&
|
||||
!allowsForbiddenIdentifier(normalizedPath)
|
||||
) {
|
||||
for (const term of forbiddenIdentifierTerms) {
|
||||
if (content.includes(term)) {
|
||||
violations.push({
|
||||
file: normalizedPath,
|
||||
kind: 'identifier',
|
||||
message: `Forbidden product identifier "${term}"`,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return violations;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue