Skip to content

fix: keep .rulesync/.aiignore exception effective in gitignore#1460

Merged
dyoshikawa merged 1 commit intomainfrom
codex/fix-issue-1459
Apr 12, 2026
Merged

fix: keep .rulesync/.aiignore exception effective in gitignore#1460
dyoshikawa merged 1 commit intomainfrom
codex/fix-issue-1459

Conversation

@dyoshikawa
Copy link
Copy Markdown
Owner

Motivation

  • Fix a bug where the negation entry !.rulesync/.aiignore was placed before broad **/.aiignore ignore rules, causing the exception to be ineffective in generated .gitignore.
  • Add a regression check to ensure the exception ordering is preserved so .rulesync/.aiignore is not accidentally ignored.

Description

  • Moved the !.rulesync/.aiignore entry in GITIGNORE_ENTRY_REGISTRY so it appears after ignore entries such as **/.aiignore and added an explanatory comment.
  • Added a unit test to src/cli/commands/gitignore.test.ts that asserts the generated .gitignore places **/.aiignore before !.rulesync/.aiignore.
  • Updated src/cli/commands/gitignore-entries.ts and the corresponding test to reflect the new ordering.

Testing

  • Ran pnpm vitest run src/cli/commands/gitignore.test.ts src/cli/commands/gitignore-entries.test.ts and the two test files passed (all assertions succeeded).
  • Ran full CI checks with pnpm cicheck which completed successfully including formatting, linting, typecheck, the full test suite (all tests passed), and content checks (cspell and secretlint).

Codex Task

Copilot AI review requested due to automatic review settings April 12, 2026 12:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes .gitignore generation so the negation rule for .rulesync/.aiignore remains effective by ensuring it appears after broad .aiignore ignore patterns, and adds a regression test to lock in the ordering.

Changes:

  • Reordered !.rulesync/.aiignore in the gitignore entry registry to come after **/.aiignore.
  • Added a unit test asserting **/.aiignore appears before !.rulesync/.aiignore in generated .gitignore.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/cli/commands/gitignore-entries.ts Moves the .rulesync/.aiignore exception later in the registry to ensure Git ignore negation semantics work as intended.
src/cli/commands/gitignore.test.ts Adds a regression test verifying the ordering of **/.aiignore and !.rulesync/.aiignore in generated output.

const writeCall = vi.mocked(writeFileContent).mock.calls[0];
expect(writeCall).toBeDefined();
const content = writeCall![1];

Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new ordering assertion relies on indexOf and will pass if **/.aiignore isn't present but the earlier test that checks toContain("**/.aiignore") is removed/changed later. Consider asserting content contains both patterns (or that both indexOf values are >= 0) before comparing indexes so failures are clearer and the test can’t become a false-positive over time.

Suggested change
expect(content).toContain("**/.aiignore");
expect(content).toContain("!.rulesync/.aiignore");

Copilot uses AI. Check for mistakes.
@@ -178,6 +177,8 @@ export const GITIGNORE_ENTRY_REGISTRY: ReadonlyArray<GitignoreEntryTag> = [
{ target: "kiro", feature: "subagents", entry: "**/.kiro/agents/" },
{ target: "kiro", feature: "mcp", entry: "**/.kiro/settings/mcp.json" },
{ target: "kiro", feature: "ignore", entry: "**/.aiignore" },
Copy link

Copilot AI Apr 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

**/.aiignore is currently tagged only for the kiro target, but Junie also generates a root .aiignore file (see JunieIgnore.getSettablePaths() and e2e ignore coverage). With rulesync gitignore --targets junie, this entry won’t be included, so the generated .aiignore won’t be gitignored. Consider changing this registry tag to apply to both kiro and junie (e.g., target: ["kiro","junie"]) so target-filtered output stays consistent.

Suggested change
{ target: "kiro", feature: "ignore", entry: "**/.aiignore" },
{ target: ["kiro", "junie"], feature: "ignore", entry: "**/.aiignore" },

Copilot uses AI. Check for mistakes.
@dyoshikawa dyoshikawa merged commit 1065cc6 into main Apr 12, 2026
14 checks passed
@dyoshikawa dyoshikawa deleted the codex/fix-issue-1459 branch April 12, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants