feat(cli): auto-manage ignore files for vendored .ask/docs#26
Merged
Conversation
Mark .ask/docs/ as vendored third-party documentation so that
lint/format/code-review tools skip it, while keeping the directory
readable as AI context.
Strategy:
- (A) Self-contained nested configs inside .ask/docs/: .gitattributes,
eslint.config.mjs, biome.json, .markdownlint-cli2.jsonc. Covers Git,
ESLint flat config, Biome, and markdownlint-cli2 without touching
root files.
- (B) Extend the existing AGENTS.md auto-generated block with a
"Vendored Documentation" notice. CodeRabbit, cubic, Claude Code,
Cursor rules, Codex, Copilot, Continue and Aider all auto-consume
this context file, so a single notice transitively affects every
major AI review tool.
- (C) Patch root files only for tools that do NOT support nested
resolution: .prettierignore and sonar-project.properties get a
marker block ('# ask:start ... # ask:end'). Legacy .markdownlintignore
is patched with a warning to migrate to markdownlint-cli2.
New modules:
- src/markers.ts: pure inject/remove/wrap helpers for marker blocks
- src/ignore-files.ts: categories A/C plus the 'manageIgnoreFiles'
orchestrator called from add/sync/remove
Schema: ConfigSchema gains an optional 'manageIgnores' flag (default
true). Set to false in .ask/config.json to disable entirely.
Track: ignore-vendored-docs-20260408 (#24)
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
15 tasks
Contributor
There was a problem hiding this comment.
2 issues found across 16 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/cli/src/index.ts">
<violation number="1" location="packages/cli/src/index.ts:286">
P2: skipAgentsMd is documented to skip only AGENTS.md regeneration, but manageIgnoreFiles is now gated by the same flag, changing behavior and leaving ignore files unsynchronized when skipAgentsMd is true.</violation>
</file>
<file name="packages/cli/src/ignore-files.ts">
<violation number="1" location="packages/cli/src/ignore-files.ts:217">
P2: manageIgnoreFiles swallows all config load errors and still mutates ignore files, so invalid/unreadable config silently proceeds with changes instead of surfacing the error or skipping management.</violation>
</file>
Architecture diagram
sequenceDiagram
participant CLI as CLI Command (add/sync/remove)
participant CFG as Config Loader
participant AGM as Agents Generator
participant IGN as NEW: IgnoreFiles Orchestrator
participant MRK as NEW: Marker Helpers
participant FS as File System
Note over CLI,FS: Execution Flow for 'add' or 'sync'
CLI->>CFG: loadConfig()
CFG-->>CLI: config (inc. manageIgnores)
CLI->>AGM: CHANGED: generateAgentsMd()
AGM->>AGM: Prepend "Vendored Documentation" notice
AGM->>FS: Update AGENTS.md with extended marker block
opt manageIgnores is true (default)
CLI->>IGN: NEW: manageIgnoreFiles(dir, 'install')
Note over IGN,FS: Category A: Nested Configs
IGN->>FS: NEW: Write .ask/docs/.gitattributes
IGN->>FS: NEW: Write .ask/docs/eslint.config.mjs
IGN->>FS: NEW: Write .ask/docs/biome.json
IGN->>FS: NEW: Write .ask/docs/.markdownlint-cli2.jsonc
Note over IGN,FS: Category C: Root Patching
loop For each: .prettierignore, sonar-project.properties, .markdownlintignore
IGN->>FS: Check if file exists
alt File Exists
FS-->>IGN: Existing content
IGN->>MRK: NEW: wrap(payload, syntax)
MRK-->>IGN: block
IGN->>MRK: NEW: inject(content, block)
MRK-->>IGN: updated content
IGN->>FS: NEW: Write patched file
end
end
end
Note over CLI,FS: Execution Flow for 'remove' (last doc)
CLI->>CLI: Check remaining docs
opt No docs remaining
CLI->>IGN: NEW: manageIgnoreFiles(dir, 'remove')
IGN->>FS: NEW: Delete nested configs in .ask/docs/
loop For each potential root patch
IGN->>FS: Read file
IGN->>MRK: NEW: remove(content, syntax)
MRK-->>IGN: content without marker block
IGN->>FS: NEW: Write cleaned root file
end
end
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Contributor
There was a problem hiding this comment.
0 issues found across 4 files (changes from recent commits).
Requires human review: This PR introduces automatic modification of project-level configuration files (e.g., .prettierignore) and new file creation, which requires human review of the architectural strategy.
- ignore-files: do not swallow config-load errors. The previous try/catch silently proceeded with mutations on corrupt configs; loadConfig already returns a default for missing files and only throws on real errors, so the catch was hiding them. - index: hoist manageIgnoreFiles out of the skipAgentsMd branch in runSync. The flag is documented to skip only AGENTS.md regeneration; ignore file management should always run so lint/format tooling stays in sync with .ask/docs/. - test: regression coverage for the corrupt-config error surface. Refs cubic review on PR #26.
This was referenced Apr 8, 2026
Merged
Merged
Merged
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Marks
.ask/docs/as vendored third-party documentation so that lint/format/code-review tools skip it, while keeping the directory readable as AI context.Closes #24
Strategy
.ask/docs/:.gitattributes,eslint.config.mjs,biome.json,.markdownlint-cli2.jsonc. Covers Git, ESLint flat config, Biome, and markdownlint-cli2 without touching root files (these tools all walk up from each file to find the nearest config).AGENTS.mdauto-generated block with a "Vendored Documentation" notice. CodeRabbit, cubic, Claude Code, Cursor rules, Codex, Copilot, Continue, and Aider all auto-consume this context file, so a single notice transitively affects every major AI review tool (verified against vendor docs)..prettierignoreandsonar-project.propertiesget a marker block (# ask:start ... # ask:end). Legacy.markdownlintignoreis patched with a warning to migrate to markdownlint-cli2. Files are only patched when they already exist — ASK never creates a root ignore file from scratch.What's New
packages/cli/src/markers.ts— pureinject/remove/wraphelpers for marker blocks (HTML and hash comment syntaxes)packages/cli/src/ignore-files.ts— categories A/C plus themanageIgnoreFilesorchestrator called fromadd/sync/removeConfigSchema.manageIgnores— optional flag (defaulttrue); set tofalsein.ask/config.jsonto disableTest plan
bun --cwd packages/cli test— 199 pass, 0 fail (43 new tests added)bun --cwd packages/cli lint— clean.prettierignore, runask docs add npm:react, verify nested configs + AGENTS.md notice +.prettierignorepatchask docs remove react→ verify all artifacts cleaned upgit check-attr -a path/to/file/inside/.ask/docs/foo.mdreportslinguist-vendoredtrueVerification Checklist
(See `plan.md` ## Verification.)
Summary by cubic
Automatically marks
.ask/docs/as vendored and manages ignore configs so linters/formatters/review tools skip it, while keeping docs readable as context. Addresses #24.New Features
manageIgnoreFilesto install/remove ignore artifacts duringask docs add|sync|remove..ask/docs/:.gitattributes,eslint.config.mjs,biome.json,.markdownlint-cli2.jsonc.AGENTS.mdwith a "Vendored Documentation" notice inside the auto-generated block..prettierignore,sonar-project.properties, and legacy.markdownlintignorevia# ask:start ... # ask:endblocks.manageIgnores(defaulttrue) to.ask/config.jsonto disable ignore management when needed.Bug Fixes
runSyncnow always runsmanageIgnoreFiles, independent of--skip-agents-md, to keep tooling in sync with.ask/docs/.manageIgnoreFilesno longer swallows corrupt.ask/config.jsonerrors; they surface instead.Written for commit 297c710. Summary will update on new commits.