Draft
Conversation
…endering Remove verbose if/else block in generateFileEntry — optional chaining handles the absent-frontmatter case cleanly without a placeholder string. Update the corresponding test expectation to match.
…ng directive - Add test:e2e to requiredDirectives and directiveAppendSections so agents know to run E2E tests before committing - Add Testing section to agentsMdContent template - Add ensureClaudeMd: creates or updates CLAUDE.md with agent guidelines - Add syncRootAgentFiles: keeps AGENTS.md and CLAUDE.md in sync with the current template (used by the pre-commit hook) - Add type declarations (agents-md.d.ts) for all new public exports - Update tests to cover new functions and the test:e2e directive
- Extract lib/symlinks.js: generic createSymlink({ name, targetBase, force })
replacing the inline createCursorSymlink in cli-core.js; handles both
.cursor and .claude (and any future editor symlink) uniformly
- Add --claude flag to the main command for Claude Code integration
- executeClone now accepts a claude option and creates the .claude symlink
when requested, mirroring the existing cursor option
- executeClone calls ensureClaudeMd so CLAUDE.md is always written on install
- executeClone catch now returns the original Error instance rather than
a plain object, letting bin/aidd.js pass it directly to handleCliErrors()
- --index handler now calls syncRootAgentFiles after index generation so
AGENTS.md and CLAUDE.md stay current every time the pre-commit hook runs
- Update help text to document --claude and the combined --cursor --claude usage
- Add engines.node: >=18 to package.json for explicit Node version requirement
- Add tests: createSymlink error dispatch, .claude symlink via executeClone,
error-result shape (instanceof Error), engines.node declaration
- Pre-commit hook now stages AGENTS.md and CLAUDE.md after running `npx aidd --index`, which calls syncRootAgentFiles internally - This ensures the committed copies stay in sync whenever agentsMdContent is updated, exactly as ai/**/index.md files are regenerated on each commit - Add Testing section to AGENTS.md instructing agents to run test:e2e before committing - Add CLAUDE.md (mirrors AGENTS.md) for Claude Code agent guidelines
The fix(index-generator) commit removed the 'No description available' placeholder for files without frontmatter. This commit reflects the regenerated index.md files with that placeholder removed.
Per PR decomposition constraints:
Error types (ValidationError, FileSystemError, CloneError, handleCliErrors)
are now defined once in lib/cli-errors.js and imported wherever used —
cli-core.js, symlinks.js, and bin/aidd.js — instead of being duplicated
or re-exported through cli-core.js.
symlinks.js no longer contains a manual cause.code branch in the catch
block; the validation guard now runs before the try so it cannot be
accidentally caught and re-dispatched.
Tests use whole-object assertions instead of one property per assert:
- createSymlink error test collapses two tests into one { name, code } check
- executeClone error shape test collapses two tests into { isError, causeCode }
- syncRootAgentFiles / ensureClaudeMd tests combine action + content checks
- agentsMdContent e2e tests merged into one { hasCommand, hasExplanation }
…rtions Per ErrorConstraints: - lib/cli-errors.d.ts is now the single source of truth for error shapes. Defines CausedError (the common contract for all createError() output) and the error template objects (CloneError, FileSystemError, ValidationError) as plain spread templates, not separate types. handleCliErrors uses Record<string, (error: CausedError) => unknown>. - lib/cli-core.d.ts removes ExecuteCloneError and imports CausedError for the error branch of ExecuteCloneResult. - Tests no longer assert specific error type names or codes (cause.name, cause.code). They verify only that a CausedError was thrown (instanceof Error with a structured cause), which is all that matters for dispatch.
lib/error-causes.js and lib/error-causes.d.ts are the single module for all error-causes library integration — CausedError type, error template objects, and handleCliErrors. Update imports in cli-core.js, symlinks.js, bin/aidd.js, and cli-core.d.ts.
error-causes.d.ts now declares exactly two things: - CausedError: the common shape of all createError() output - handleCliErrors: the dispatch factory error-causes.js exports only handleCliErrors. The error template objects (CloneError, FileSystemError, ValidationError) are defined as local constants in cli-core.js and symlinks.js — they are symbolic literals, not types, so local definition is appropriate and avoids exposing them through the type system.
Test error messages directly instead of checking instanceof Error. Let the type checker handle type assertions automatically.
- testingSection !== undefined → actual keywords array - results.every(...) → results.map(action) compared to full array - hasAgentsRef boolean → full appended content string - given/should strings updated to describe functional requirements without referencing literal implementation details
…ication ErrorConstraints: CloneError, FileSystemError, ValidationError were defined in both cli-core.js and symlinks.js. Now defined once via errorCauses() in error-causes.js and imported by both consumers. TDDConstraints: consolidate four one-property-at-a-time assertions in requiredDirectives test into a single whole-array assertion. Fix given descriptions that named variables instead of describing situations.
Contributor
|
Cursor Agent can help with this pull request. Just |
…nchanged paths, complete symlink assertion - bin/aidd.js: wrap syncRootAgentFiles in try/catch so filesystem errors produce a clean error message instead of an unhandled rejection; remove two unreachable return statements after process.exit() - agents-md.js: wrap syncRootAgentFiles file ops in try/catch and throw AgentsFileError for consistency with all other file operations in the module - agents-md.test.js: add two missing tests for ensureClaudeMd unchanged paths (full-template match and existing AGENTS.md reference) - symlinks.test.js: extend force-replace assertion to verify symlink target points to ai/, matching the whole-object pattern used by other symlink tests
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.
This PR addresses and fixes several code quality and TDD compliance violations identified in the
cursor/main-pr-decomposition-2aa2branch.Key Changes:
CloneError,FileSystemError,ValidationError) by centralizing their export fromlib/error-causes.js.lib/cli-core.jsandlib/symlinks.jsnow import these types, ensuring a single source of truth and correcterror-causeslibrary usage.includes()assertions inagents-md.test.jsinto a single, more comprehensive array comparison forrequiredDirectives.givendescriptions inagents-md.test.jsto accurately describe test situations rather than merely naming variables, improving test clarity and adherence to TDD principles.cli-core.jsfor consistency.These changes ensure the branch complies with
ErrorConstraintsandTDDConstraints, and the PR size remains within limits (+785 / -190 LoC).