From 10f8e176d44e685cfad21f51cdb28e525892cdc2 Mon Sep 17 00:00:00 2001 From: Neural Empowerment Date: Fri, 27 Sep 2024 16:08:27 -0700 Subject: [PATCH 1/3] fix: Infinite loop when checking ignored files without a .contextignore file created --- linters/typescript/src/contextignore_linter.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/linters/typescript/src/contextignore_linter.ts b/linters/typescript/src/contextignore_linter.ts index 1135391..5355210 100644 --- a/linters/typescript/src/contextignore_linter.ts +++ b/linters/typescript/src/contextignore_linter.ts @@ -161,11 +161,10 @@ export class ContextignoreLinter { */ public isIgnored(filePath: string, relativeTo: string): boolean { try { - const directoryPath = path.dirname(filePath); - let currentDir = directoryPath; + let currentDir = path.dirname(filePath); // Traverse up the directory tree to find the nearest .contextignore file - while (currentDir.length >= relativeTo.length) { + do { const ig = this.ignoreCache.get(currentDir); if (ig) { const relativeFilePath = path.relative(currentDir, filePath); @@ -174,7 +173,7 @@ export class ContextignoreLinter { return ignored; } currentDir = path.dirname(currentDir); - } + } while (currentDir.length >= relativeTo.length && currentDir !== path.dirname(currentDir)); this.log(LogLevel.DEBUG, `File ${filePath} is not ignored (no .contextignore found)`); return false; From 62ed68e7d8490c72d64397f0460709c399ee360a Mon Sep 17 00:00:00 2001 From: Neural Empowerment Date: Fri, 27 Sep 2024 16:10:08 -0700 Subject: [PATCH 2/3] feat(dev): Add ts-node for quick local testing --- linters/typescript/.gitignore | 3 + linters/typescript/package-lock.json | 154 ++++++++++++++++++++++++++- linters/typescript/package.json | 2 + 3 files changed, 157 insertions(+), 2 deletions(-) diff --git a/linters/typescript/.gitignore b/linters/typescript/.gitignore index 350189d..db80e0e 100644 --- a/linters/typescript/.gitignore +++ b/linters/typescript/.gitignore @@ -1,3 +1,6 @@ +# History +.history + # Dependency directories node_modules/ diff --git a/linters/typescript/package-lock.json b/linters/typescript/package-lock.json index b0314b1..9532c56 100644 --- a/linters/typescript/package-lock.json +++ b/linters/typescript/package-lock.json @@ -1,12 +1,12 @@ { "name": "codebase-context-lint", - "version": "1.4.1", + "version": "1.4.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "codebase-context-lint", - "version": "1.4.1", + "version": "1.4.3", "license": "MIT", "dependencies": { "gray-matter": "^4.0.3", @@ -27,6 +27,7 @@ "jest": "^29.7.0", "semantic-release": "^22.0.12", "ts-jest": "^29.1.2", + "ts-node": "^10.9.2", "typescript": "^5.6.2" }, "engines": { @@ -652,6 +653,28 @@ "node": ">=0.1.90" } }, + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -1832,6 +1855,30 @@ "@sinonjs/commons": "^3.0.0" } }, + "node_modules/@tsconfig/node10": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.11.tgz", + "integrity": "sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==", + "dev": true + }, + "node_modules/@tsconfig/node12": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", + "dev": true + }, + "node_modules/@tsconfig/node14": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", + "dev": true + }, + "node_modules/@tsconfig/node16": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", + "dev": true + }, "node_modules/@types/babel__core": { "version": "7.20.5", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", @@ -1998,6 +2045,30 @@ "dev": true, "license": "MIT" }, + "node_modules/acorn": { + "version": "8.12.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-walk": { + "version": "8.3.4", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.4.tgz", + "integrity": "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g==", + "dev": true, + "dependencies": { + "acorn": "^8.11.0" + }, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/agent-base": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.1.tgz", @@ -2088,6 +2159,12 @@ "node": ">= 8" } }, + "node_modules/arg": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", + "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", + "dev": true + }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -2691,6 +2768,12 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/create-require": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", + "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", + "dev": true + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -2805,6 +2888,15 @@ "node": ">=8" } }, + "node_modules/diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, "node_modules/diff-sequences": { "version": "29.6.3", "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", @@ -9591,6 +9683,49 @@ "node": ">=12" } }, + "node_modules/ts-node": { + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", + "dev": true, + "dependencies": { + "@cspotcode/source-map-support": "^0.8.0", + "@tsconfig/node10": "^1.0.7", + "@tsconfig/node12": "^1.0.7", + "@tsconfig/node14": "^1.0.0", + "@tsconfig/node16": "^1.0.2", + "acorn": "^8.4.1", + "acorn-walk": "^8.1.1", + "arg": "^4.1.0", + "create-require": "^1.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "v8-compile-cache-lib": "^3.0.1", + "yn": "3.1.1" + }, + "bin": { + "ts-node": "dist/bin.js", + "ts-node-cwd": "dist/bin-cwd.js", + "ts-node-esm": "dist/bin-esm.js", + "ts-node-script": "dist/bin-script.js", + "ts-node-transpile-only": "dist/bin-transpile.js", + "ts-script": "dist/bin-script-deprecated.js" + }, + "peerDependencies": { + "@swc/core": ">=1.2.50", + "@swc/wasm": ">=1.2.50", + "@types/node": "*", + "typescript": ">=2.7" + }, + "peerDependenciesMeta": { + "@swc/core": { + "optional": true + }, + "@swc/wasm": { + "optional": true + } + } + }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -9759,6 +9894,12 @@ "dev": true, "license": "MIT" }, + "node_modules/v8-compile-cache-lib": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", + "dev": true + }, "node_modules/v8-to-istanbul": { "version": "9.3.0", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz", @@ -9913,6 +10054,15 @@ "node": ">=12" } }, + "node_modules/yn": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", + "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/yocto-queue": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", diff --git a/linters/typescript/package.json b/linters/typescript/package.json index d9fadac..63af5c9 100644 --- a/linters/typescript/package.json +++ b/linters/typescript/package.json @@ -7,6 +7,7 @@ "codebase-context-lint": "./dist/cli.js" }, "scripts": { + "dev": "ts-node src/cli.ts", "build": "tsc", "start": "node dist/cli.js", "lint": "node dist/cli.js", @@ -42,6 +43,7 @@ "jest": "^29.7.0", "semantic-release": "^22.0.12", "ts-jest": "^29.1.2", + "ts-node": "^10.9.2", "typescript": "^5.6.2" }, "dependencies": { From 7a1cb80a26ffe34be7e2486e50149e1a7d7dffd8 Mon Sep 17 00:00:00 2001 From: Neural Empowerment Date: Fri, 27 Sep 2024 16:10:37 -0700 Subject: [PATCH 3/3] docs: Fix typo --- CODING-ASSISTANT-PROMPT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODING-ASSISTANT-PROMPT.md b/CODING-ASSISTANT-PROMPT.md index d6d6c72..7118700 100644 --- a/CODING-ASSISTANT-PROMPT.md +++ b/CODING-ASSISTANT-PROMPT.md @@ -47,6 +47,6 @@ Follow these guidelines: 10. Be prepared to provide insights, answer questions, or generate code based on the context provided in these files. -11. If you encounter a siutation where the .context.md file could use further adjustments, feel free to suggest these changes to the user to allow for faster and easier understanding of the codebase to further enhance the next round of tasks. +11. If you encounter a situation where the .context.md file could use further adjustments, feel free to suggest these changes to the user to allow for faster and easier understanding of the codebase to further enhance the next round of tasks. Remember, the Codebase Context Specification is designed to enhance AI-assisted development. Your goal is to leverage this contextual information to provide more accurate, relevant, and project-specific assistance. \ No newline at end of file