-
Notifications
You must be signed in to change notification settings - Fork 6.3k
feat(core): broaden .understandignore starter for C#/Java/Go test patterns #466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Lum1104
merged 3 commits into
Egonex-AI:main
from
thejesh23:fix/understandignore-multi-language-test-patterns
Jun 18, 2026
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
f5682bf
feat(core): broaden .understandignore starter — C#/Java/Go test patterns
thejesh23 a0155c5
refactor(skills): extract generate-ignore.mjs from SKILL.md inline on…
thejesh23 83d3fb6
fix(skills): prefer $PLUGIN_ROOT over relative path in generate-ignor…
thejesh23 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
understand-anything-plugin/skills/understand/generate-ignore.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| #!/usr/bin/env node | ||
| /** | ||
| * generate-ignore.mjs | ||
| * | ||
| * Writes a starter `.understand-anything/.understandignore` for the target | ||
| * project by delegating to `generateStarterIgnoreFile` in | ||
| * `@understand-anything/core`. Invoked from SKILL.md Phase 0.5; replaces the | ||
| * inline `node -e "…"` block that previously duplicated the generator logic. | ||
| * | ||
| * Usage: | ||
| * node generate-ignore.mjs <projectRoot> | ||
| * | ||
| * Behaviour: | ||
| * - Exits 0 with a stderr notice if the target file already exists. | ||
| * - Creates `<projectRoot>/.understand-anything/` if missing. | ||
| * - Emits a one-line stderr summary on success. | ||
| * | ||
| * Mirrors the @understand-anything/core resolution dance used by | ||
| * scan-project.mjs: workspace-linked package first, plugin-cache dist fallback. | ||
| */ | ||
|
|
||
| import { createRequire } from 'node:module'; | ||
| import { dirname, join, resolve } from 'node:path'; | ||
| import { fileURLToPath, pathToFileURL } from 'node:url'; | ||
| import { existsSync, mkdirSync, writeFileSync } from 'node:fs'; | ||
|
|
||
| const __dirname = dirname(fileURLToPath(import.meta.url)); | ||
| // skills/understand/ -> plugin root is two dirs up | ||
| const pluginRoot = resolve(__dirname, '../..'); | ||
| const require = createRequire(resolve(pluginRoot, 'package.json')); | ||
|
|
||
| let core; | ||
| try { | ||
| core = await import(pathToFileURL(require.resolve('@understand-anything/core')).href); | ||
| } catch { | ||
| core = await import(pathToFileURL(resolve(pluginRoot, 'packages/core/dist/index.js')).href); | ||
| } | ||
|
|
||
| const { generateStarterIgnoreFile } = core; | ||
|
|
||
| const projectRoot = resolve(process.argv[2] ?? process.cwd()); | ||
| const outDir = join(projectRoot, '.understand-anything'); | ||
| const outPath = join(outDir, '.understandignore'); | ||
|
|
||
| if (existsSync(outPath)) { | ||
| console.error(`generate-ignore: ${outPath} already exists — skipping`); | ||
| process.exit(0); | ||
| } | ||
|
|
||
| if (!existsSync(outDir)) mkdirSync(outDir, { recursive: true }); | ||
| writeFileSync(outPath, generateStarterIgnoreFile(projectRoot)); | ||
| console.error(`generate-ignore: wrote ${outPath}`); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the skill directory is copied to a runtime skills folder instead of symlinked under the plugin checkout,
resolve(__dirname, '../..')points at that skills parent rather than the real plugin root. Phase 0 already supports those installs by resolvingPLUGIN_ROOTfrom several locations, but this new Phase 0.5 helper ignores that value, so first-time runs with no.understandignorefail to resolve@understand-anything/coreand then try a nonexistentpackages/core/dist/index.jsunder the skills folder. Use the resolved plugin root or implement the same fallback search here before importing core.Useful? React with 👍 / 👎.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, addressed in 83d3fb6.
generate-ignore.mjsnow prefers$PLUGIN_ROOTfrom the env (validated by checking for apackage.jsonat that path) and falls back to the existingresolve(__dirname, '../..')heuristic. SKILL.md Phase 0.5 was updated to pass the env var:Smoke-tested both paths locally — the env-set path resolves through Phase 0's multi-candidate value; the fallback path matches prior behavior for standard installs. 753 tests still pass; lint clean.
Note: the same
resolve(__dirname, '../..')pattern exists inscan-project.mjs,compute-batches.mjs,extract-import-map.mjs,extract-structure.mjs, andbuild-fingerprints.mjs. They share the same latent issue but kept out of this PR's scope — happy to file a follow-up to harden them uniformly if the maintainers want. @Lum1104 I will scope out these to address these in follow up PR