@nt-ai-lab/opencode-skillz 0.3.6 → 0.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/tools/lint.js
CHANGED
|
@@ -16,7 +16,7 @@ class GitCommandError extends Error {
|
|
|
16
16
|
super(message);
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
class
|
|
19
|
+
class MissingBundledLintAssetError extends Error {
|
|
20
20
|
constructor(message) {
|
|
21
21
|
super(message);
|
|
22
22
|
}
|
|
@@ -26,9 +26,9 @@ class LintExecutionError extends Error {
|
|
|
26
26
|
super(message);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
+
const ansiEscapeSequencePattern = new RegExp(String.raw `\u001B\[[0-?]*[ -/]*[@-~]`, "g");
|
|
29
30
|
const toolDirectory = path.dirname(fileURLToPath(import.meta.url));
|
|
30
31
|
const toolRepositoryRoot = path.resolve(toolDirectory, "..", "..");
|
|
31
|
-
const eslintCliPath = path.join(toolRepositoryRoot, "node_modules", "eslint", "bin", "eslint.js");
|
|
32
32
|
const eslintConfigPath = path.join(toolRepositoryRoot, "scripts", "living-architecture-eslint.config.mjs");
|
|
33
33
|
const gitBinaryPath = "/usr/bin/git";
|
|
34
34
|
export const LINT_TOOL_NAME = "nt_skillz_lint";
|
|
@@ -63,11 +63,11 @@ function normalizeFilePaths(filePaths) {
|
|
|
63
63
|
normalizedFilePaths.forEach(ensureSupportedFilePath);
|
|
64
64
|
return normalizedFilePaths;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
67
|
-
if (fs.existsSync(
|
|
66
|
+
function ensureBundledLintAssetsExist() {
|
|
67
|
+
if (fs.existsSync(eslintConfigPath)) {
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
throw new
|
|
70
|
+
throw new MissingBundledLintAssetError(`Expected bundled lint config to exist at ${eslintConfigPath}.`);
|
|
71
71
|
}
|
|
72
72
|
function runGitCommand(repositoryRoot, gitArguments) {
|
|
73
73
|
const gitResult = spawnSync(gitBinaryPath, ["-C", repositoryRoot, ...gitArguments], { encoding: "utf8" });
|
|
@@ -131,6 +131,9 @@ function createLintTitle(filePaths, baseReference) {
|
|
|
131
131
|
}
|
|
132
132
|
return "Lint current TypeScript files";
|
|
133
133
|
}
|
|
134
|
+
function removeAnsiEscapeSequences(value) {
|
|
135
|
+
return value.replaceAll(ansiEscapeSequencePattern, "");
|
|
136
|
+
}
|
|
134
137
|
async function runEslint(repositoryRoot, lintTargets) {
|
|
135
138
|
const previousLintRepositoryRoot = process.env.NT_SKILLZ_LINT_REPO_ROOT;
|
|
136
139
|
process.env.NT_SKILLZ_LINT_REPO_ROOT = repositoryRoot;
|
|
@@ -143,7 +146,7 @@ async function runEslint(repositoryRoot, lintTargets) {
|
|
|
143
146
|
try {
|
|
144
147
|
const lintResults = await eslint.lintFiles(lintTargets);
|
|
145
148
|
const formatter = await eslint.loadFormatter("stylish");
|
|
146
|
-
const formattedOutput = (await formatter.format(lintResults)).trim();
|
|
149
|
+
const formattedOutput = removeAnsiEscapeSequences((await formatter.format(lintResults)).trim());
|
|
147
150
|
const errorCount = lintResults.reduce((count, lintResult) => count + lintResult.errorCount + lintResult.fatalErrorCount, 0);
|
|
148
151
|
return {
|
|
149
152
|
exitCode: errorCount > 0 ? 1 : 0,
|
|
@@ -192,7 +195,7 @@ function parsePortableLintCommandLine(commandLineArguments) {
|
|
|
192
195
|
};
|
|
193
196
|
}
|
|
194
197
|
export async function runPortableLint(request) {
|
|
195
|
-
|
|
198
|
+
ensureBundledLintAssetsExist();
|
|
196
199
|
const repositoryRoot = resolveDirectory(request.repositoryRoot ?? process.cwd());
|
|
197
200
|
const baseReference = normalizeOptionalText(request.base);
|
|
198
201
|
const headReference = normalizeOptionalText(request.head);
|
package/package.json
CHANGED
|
@@ -22,8 +22,6 @@ if (!lintRepositoryRoot) {
|
|
|
22
22
|
|
|
23
23
|
const typescriptFiles = ['**/*.ts', '**/*.tsx']
|
|
24
24
|
const testFiles = ['**/*.spec.ts', '**/*.spec.tsx', '**/*.test.ts', '**/*.test.tsx']
|
|
25
|
-
const thinLayerFiles = ['**/entrypoint/**/*.ts', '**/commands/**/*.ts', '**/queries/**/*.ts']
|
|
26
|
-
const thinLayerIgnoredFiles = ['**/*.spec.ts', '**/*.test.ts']
|
|
27
25
|
const ignoredPaths = [
|
|
28
26
|
'**/dist',
|
|
29
27
|
'**/out-tsc',
|
|
@@ -58,21 +56,6 @@ const noEmptyStringFallbackRule = {
|
|
|
58
56
|
|
|
59
57
|
const restrictedSyntaxRules = ['error', noLetRule, noGenericErrorRule, noEmptyStringFallbackRule]
|
|
60
58
|
|
|
61
|
-
const entrypointRestrictedSyntaxRules = [
|
|
62
|
-
'error',
|
|
63
|
-
noLetRule,
|
|
64
|
-
noGenericErrorRule,
|
|
65
|
-
{
|
|
66
|
-
selector: 'FunctionDeclaration:not([parent.type="ExportNamedDeclaration"])',
|
|
67
|
-
message: 'Entrypoints must not define private functions. Move logic to commands/, queries/, or infra/.',
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
selector: 'VariableDeclarator > ArrowFunctionExpression',
|
|
71
|
-
message: 'Entrypoints must not define private arrow functions. Move logic to commands/, queries/, or infra/.',
|
|
72
|
-
},
|
|
73
|
-
noEmptyStringFallbackRule,
|
|
74
|
-
]
|
|
75
|
-
|
|
76
59
|
const restrictedImportPatterns = [
|
|
77
60
|
{
|
|
78
61
|
group: ['*/utils/*', '*/utils', '*/utilities'],
|
|
@@ -229,20 +212,6 @@ export default tseslint.config(
|
|
|
229
212
|
'@stylistic/object-property-newline': ['error', { allowAllPropertiesOnSameLine: false }],
|
|
230
213
|
},
|
|
231
214
|
},
|
|
232
|
-
{
|
|
233
|
-
files: thinLayerFiles,
|
|
234
|
-
ignores: thinLayerIgnoredFiles,
|
|
235
|
-
rules: {
|
|
236
|
-
'max-lines': ['error', { max: 150, skipBlankLines: true, skipComments: true }],
|
|
237
|
-
},
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
files: ['**/entrypoint/**/*.ts'],
|
|
241
|
-
ignores: thinLayerIgnoredFiles,
|
|
242
|
-
rules: {
|
|
243
|
-
'no-restricted-syntax': entrypointRestrictedSyntaxRules,
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
215
|
{
|
|
247
216
|
files: typescriptFiles,
|
|
248
217
|
plugins: {
|