From d474aece883ae62c9ee05290bacf6b6dbaf8ccc8 Mon Sep 17 00:00:00 2001 From: NagyVikt Date: Wed, 29 Apr 2026 11:58:07 +0200 Subject: [PATCH] Ignore Codex local state during setup Guardex already appends a managed gitignore block during setup and doctor repair. Add .codex/ to that canonical path list so repo-local Codex state is excluded automatically anywhere the managed block is created or refreshed. Constraint: setup and doctor both consume MANAGED_GITIGNORE_PATHS through the shared scaffold path. Rejected: Patch only generated .gitignore fixtures | would not affect real gx setup or doctor runs Confidence: high Scope-risk: narrow Directive: Keep gitignore behavior centralized in MANAGED_GITIGNORE_PATHS rather than duplicating setup/doctor-specific lists. Tested: node --test --test-name-pattern "setup provisions workflow files and repo config|setup appends managed gitignore block without clobbering existing entries|setup and doctor explain .githooks file conflicts and still write managed gitignore first|shared context keeps the drift-prone help text, gitignore paths, and release repo root" test/setup.test.js test/cli-args-dispatch.test.js Tested: npm test Not-tested: GitHub Actions rerun --- src/context.js | 1 + test/cli-args-dispatch.test.js | 1 + test/helpers/install-test-helpers.js | 1 + test/setup.test.js | 1 + 4 files changed, 4 insertions(+) diff --git a/src/context.js b/src/context.js index 475674e0..c49c3f2d 100644 --- a/src/context.js +++ b/src/context.js @@ -289,6 +289,7 @@ const MANAGED_REPO_SCAN_IGNORED_FOLDERS = [ const MANAGED_GITIGNORE_PATHS = [ '.omx/', '.omc/', + '.codex/', '!.vscode/', '.vscode/*', '!.vscode/settings.json', diff --git a/test/cli-args-dispatch.test.js b/test/cli-args-dispatch.test.js index f5c33207..84c95483 100644 --- a/test/cli-args-dispatch.test.js +++ b/test/cli-args-dispatch.test.js @@ -215,6 +215,7 @@ test('shared context keeps the drift-prone help text, gitignore paths, and relea assert.match(descriptions.get('setup'), /--current/); assert.match(descriptions.get('doctor'), /--current/); + assert.ok(MANAGED_GITIGNORE_PATHS.includes('.codex/')); assert.ok(MANAGED_GITIGNORE_PATHS.includes('!.vscode/')); assert.ok(MANAGED_GITIGNORE_PATHS.includes('.vscode/*')); assert.ok(MANAGED_GITIGNORE_PATHS.includes('!.vscode/settings.json')); diff --git a/test/helpers/install-test-helpers.js b/test/helpers/install-test-helpers.js index 8280df24..4406c41c 100644 --- a/test/helpers/install-test-helpers.js +++ b/test/helpers/install-test-helpers.js @@ -136,6 +136,7 @@ function runHumanCmd(cmd, args, cwd, options = {}) { function assertZeroCopyManagedGitignore(content) { assert.match(content, /# multiagent-safety:START/); + assert.match(content, /^\.codex\/$/m); assert.match(content, /^!\.vscode\/$/m); assert.match(content, /^\.vscode\/\*$/m); assert.match(content, /^!\.vscode\/settings\.json$/m); diff --git a/test/setup.test.js b/test/setup.test.js index 50c8a00e..dcf03524 100644 --- a/test/setup.test.js +++ b/test/setup.test.js @@ -160,6 +160,7 @@ test('setup provisions workflow files and repo config', () => { assert.doesNotMatch(gitignoreContent, /^scripts\/agent-file-locks\.py$/m); assert.match(gitignoreContent, /^\.githooks$/m); assert.doesNotMatch(gitignoreContent, /^\.githooks\/pre-commit$/m); + assert.match(gitignoreContent, /^\.codex\/$/m); assert.match(gitignoreContent, /\.omx\//); assert.match(gitignoreContent, /\.omc\//); assert.match(gitignoreContent, /oh-my-codex\//);