From 56db8bb3d759a98deffb8982655edece8923cfc0 Mon Sep 17 00:00:00 2001 From: metyatech Date: Mon, 9 Feb 2026 15:01:11 +0900 Subject: [PATCH] chore: add standard linting and formatting toolchain --- .github/ISSUE_TEMPLATE/bug_report.md | 14 +- .github/ISSUE_TEMPLATE/feature_request.md | 7 +- .github/pull_request_template.md | 8 +- .github/workflows/ci.yml | 11 +- .prettierignore | 5 + .prettierrc | 7 + CHANGELOG.md | 17 + CODE_OF_CONDUCT.md | 7 +- CONTRIBUTING.md | 5 +- README.md | 33 +- SECURITY.md | 5 +- agent-rules-local/release.md | 2 +- agent-ruleset.json | 12 +- eslint.config.js | 22 + package-lock.json | 1563 ++++++++++++++++++++- package.json | 15 +- src/compose-agents.ts | 453 +++--- test/compose-agents.test.js | 646 +++++---- tools/compose-agents.js | 2 +- tools/tool-rules.md | 1 + 20 files changed, 2244 insertions(+), 591 deletions(-) create mode 100644 .prettierignore create mode 100644 .prettierrc create mode 100644 eslint.config.js diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 28d8f12..d3bf3c5 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -5,23 +5,29 @@ labels: bug --- ## Summary + A clear and concise description of the problem. ## Steps to reproduce -1. -2. -3. + +1. +2. +3. ## Expected behavior + What you expected to happen. ## Actual behavior + What actually happened. ## Environment + - OS: - Node.js: - Version: ## Additional context -Add any other context, logs, or screenshots here. + +Add any other context, logs, or screenshots here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 4c5097c..d4e89a3 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -5,16 +5,21 @@ labels: enhancement --- ## Summary + A clear and concise description of the feature. ## Problem / motivation + What problem does this solve? ## Proposed solution + Describe the solution you'd like. ## Alternatives considered + Describe any alternative solutions or features you've considered. ## Additional context -Add any other context or screenshots about the feature request here. + +Add any other context or screenshots about the feature request here. diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 6376c63..913891c 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,15 +1,19 @@ ## Summary + Describe the change and why it is needed. ## Changes -- + +- ## Testing + - [ ] npm run lint - [ ] npm test - [ ] npm pack --dry-run (if publishing-related) ## Checklist + - [ ] README.md updated or not needed (explain why) - [ ] No generated artifacts committed -- [ ] Changes are scoped to the affected repository only +- [ ] Changes are scoped to the affected repository only diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f6a0b4..cfb50d9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,14 +18,11 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: "20" - cache: "npm" + node-version: '20' + cache: 'npm' - name: Install dependencies run: npm ci - - name: Lint - run: npm run lint - - - name: Test - run: npm test + - name: Verify + run: npm run verify diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..7e98633 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,5 @@ +dist/ +node_modules/ +coverage/ +AGENTS.md +package-lock.json diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..e78a706 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "singleQuote": true, + "trailingComma": "all", + "printWidth": 100, + "tabWidth": 2, + "semi": true +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 9f28c67..a87396d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,11 +3,13 @@ All notable changes to this project will be documented in this file. ## 3.2.7 - 2026-02-07 + - Print a unified diff for `AGENTS.md` when it changes during compose/apply-rules (works without git). - Suppress the diff/recognition hint output when using `--quiet` or `--json`. - Added regression tests for the diff output behavior. ## 3.2.6 - 2026-02-06 + - Enhanced `edit-rules` output to show the rules directory and concrete next steps for editing and applying rule updates. - Added tests that verify the new `edit-rules` guidance output for local source layouts. - Documented that `apply-rules` pushes the workspace for GitHub sources (when clean) before regenerating `AGENTS.md`. @@ -15,18 +17,22 @@ All notable changes to this project will be documented in this file. - Regenerated `AGENTS.md` with updated tool rules and latest upstream shared rule content. ## 3.2.5 - 2026-02-06 + - Clarified that `tools/tool-rules.md` is the shared rule source for all repositories using compose-agentsmd. - Added a rule that planned rule updates must be shown first (preferably as a colorized diff) and require explicit approval before edits are applied. - Regenerated `AGENTS.md` with the updated tool rules and latest shared upstream rule content. ## 3.2.4 - 2026-02-02 + - Refactored CLI argument value parsing to reduce duplication. ## 3.2.3 - 2026-02-01 + - Restored shared tool rules to use `compose-agentsmd` and moved the repo-specific compose instruction into a local rule. - Added a local rules file and wired it into the ruleset, then regenerated `AGENTS.md`. ## 3.2.2 - 2026-02-01 + - Normalized AGENTS.md Source paths to GitHub-style refs for remote rules and project-relative paths for local rules, with matching test updates. - Added a pre-commit hook to run lint/test/build. - Updated the ruleset to use `github:metyatech/agent-rules` with `cli`/`release` domains, removing the local release extra and regenerating AGENTS.md with the shared rules. @@ -34,9 +40,11 @@ All notable changes to this project will be documented in this file. - Bumped @types/node to ^25.1.0. ## 3.2.1 - 2026-01-27 + - Regenerated `AGENTS.md` to exclude the `AGENTS.md` file from rule diff output. ## 1.0.1 - 2026-01-25 + - Switched the package to ESM (`"type": "module"`, NodeNext compiler options). - Hardened npm publish settings (`publishConfig.access`, `files`, `prepare`). - Expanded test coverage for rules root precedence and ruleset validation. @@ -44,35 +52,44 @@ All notable changes to this project will be documented in this file. - Regenerated `AGENTS.md` from the updated rule modules. ## 1.1.0 - 2026-01-26 + - Added JSON Schema validation for rulesets with an explicit schema file. - Prepended tool guidance rules to generated `AGENTS.md` files. - Updated shared rule modules for JSON schema validation and English rule writing guidance. ## 1.1.1 - 2026-01-26 + - Clarified that README updates must be edited at the same time as code changes in shared rules. ## 1.1.2 - 2026-01-26 + - Clarified that version bumps must include both release creation and package publishing. ## 2.0.0 - 2026-01-26 + - Switched ruleset format to `source/global/domains/extra` with remote GitHub sources and cache support in `~/.agentsmd`. - Added `--refresh` and `--clear-cache` cache management commands. - Updated ruleset schema, tests, and README to match the new format. ## 2.0.1 - 2026-01-26 + - Moved the publish/global-update rule into local rules for this repository. ## 2.0.2 - 2026-01-26 + - Externalized tool-inserted rules and usage text into `tools/`. - Added rule guidance to externalize long embedded strings/templates when possible. ## 3.0.0 - 2026-01-26 + - Removed recursive ruleset discovery; only the project root ruleset is composed unless `--ruleset` is provided. ## 3.1.0 - 2026-01-26 + - Added `--version`/`-V` and `--verbose`/`-v` flags with verbose diagnostics output. ## 3.2.0 - 2026-01-26 + - Added `init` to bootstrap rulesets with dry-run, confirmation, and compose options. - Allowed ruleset files to include line/block comments (JSON with comments). - Updated init defaults to use generic GitHub sources and omit global/domains/extra unless specified. diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 0beef1a..4648545 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,20 +1,25 @@ # Code of Conduct ## Our pledge + We are committed to providing a friendly, safe, and welcoming environment for everyone. ## Expected behavior + - Be respectful and considerate. - Assume good intent and collaborate constructively. - Provide and accept feedback gracefully. ## Unacceptable behavior + - Harassment, discrimination, or hateful conduct. - Personal attacks, trolling, or intimidation. - Publishing private information without permission. ## Enforcement + Maintainers may remove, edit, or reject contributions that violate this Code of Conduct. ## Reporting -Report issues to the maintainers via GitHub Security Advisories or a private channel when possible. + +Report issues to the maintainers via GitHub Security Advisories or a private channel when possible. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f3b1f77..8c4503b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,7 @@ # Contributing ## Development setup + 1. Install dependencies. 2. Run lint and tests before submitting changes. @@ -11,6 +12,7 @@ npm test ``` ## Rules composition workflow + This repository treats `AGENTS.md` as a generated file. - Do not edit `AGENTS.md` directly. @@ -22,6 +24,7 @@ npm run compose ``` ## Pull requests + - Keep changes scoped to the affected repository. - Include tests for behavioral changes. -- Update `README.md` when usage or behavior changes. +- Update `README.md` when usage or behavior changes. diff --git a/README.md b/README.md index d958618..0a55743 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ Ruleset files accept JSON with `//` or `/* */` comments. // Additional local rule files to append. "extra": ["agent-rules-local/custom.md"], // Output file name. - "output": "AGENTS.md" + "output": "AGENTS.md", } ``` @@ -133,14 +133,23 @@ Remote sources are cached under `~/.agentsmd/cache////`. Use ` ```sh npm install -npm run lint -npm run build -npm test -``` - -## Overview -This repository contains the compose-agentsmd project. - -## Requirements and Configuration -- No required environment variables are documented. - +npm run verify +``` + +`npm run verify` runs linting, typechecking, formatting checks, and tests. +You can also run them individually: + +```sh +npm run lint # Check for lint issues +npm run typecheck # Check for type errors +npm run format # Fix formatting +npm test # Run tests +``` + +## Overview + +This repository contains the compose-agentsmd project. + +## Requirements and Configuration + +- No required environment variables are documented. diff --git a/SECURITY.md b/SECURITY.md index b18cc35..aca7955 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,15 +1,18 @@ # Security Policy ## Supported versions + The latest published version is supported. ## Reporting a vulnerability + Please report vulnerabilities privately via GitHub Security Advisories or by opening a private report to the maintainers. Do not file public issues for security-sensitive reports. When reporting, include: + - A clear description of the vulnerability - Steps to reproduce or a proof of concept - Impact assessment - Suggested mitigations (if known) -We will acknowledge receipt and work on a fix as quickly as possible. +We will acknowledge receipt and work on a fix as quickly as possible. diff --git a/agent-rules-local/release.md b/agent-rules-local/release.md index 44ca777..cd4a91b 100644 --- a/agent-rules-local/release.md +++ b/agent-rules-local/release.md @@ -1,3 +1,3 @@ # Distribution and release -- After publishing this repository, update the globally installed CLI to the latest version. \ No newline at end of file +- After publishing this repository, update the globally installed CLI to the latest version. diff --git a/agent-ruleset.json b/agent-ruleset.json index 913d996..5e2edd7 100644 --- a/agent-ruleset.json +++ b/agent-ruleset.json @@ -1,12 +1,6 @@ -{ +{ "source": "github:metyatech/agent-rules", - "domains": [ - "cli", - "node", - "release" - ], - "extra": [ - "agent-rules-local/compose-agentsmd-local.md" - ], + "domains": ["cli", "node", "release"], + "extra": ["agent-rules-local/compose-agentsmd-local.md"], "output": "AGENTS.md" } diff --git a/eslint.config.js b/eslint.config.js new file mode 100644 index 0000000..f0cf972 --- /dev/null +++ b/eslint.config.js @@ -0,0 +1,22 @@ +import js from '@eslint/js'; +import globals from 'globals'; +import tseslint from 'typescript-eslint'; +import prettierConfig from 'eslint-config-prettier'; + +export default tseslint.config( + { + ignores: ['dist/', 'coverage/', 'AGENTS.md', 'agent-rules-local/'], + }, + js.configs.recommended, + ...tseslint.configs.recommended, + prettierConfig, + { + languageOptions: { + ecmaVersion: 2022, + sourceType: 'module', + globals: { + ...globals.node, + }, + }, + }, +); diff --git a/package-lock.json b/package-lock.json index ab9d307..2bd4960 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,76 +16,1369 @@ "compose-agentsmd": "dist/compose-agents.js" }, "devDependencies": { + "@eslint/js": "^9.39.2", "@types/node": "^25.1.0", - "typescript": "^5.7.3" + "eslint": "^9.39.2", + "eslint-config-prettier": "^10.1.8", + "globals": "^17.3.0", + "prettier": "^3.8.1", + "typescript": "^5.7.3", + "typescript-eslint": "^8.54.0" }, "engines": { "node": ">=20" } }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz", + "integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.1.tgz", + "integrity": "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^2.1.7", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz", + "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.17.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/core": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", + "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.3.tgz", + "integrity": "sha512-Kr+LPIUVKz2qkx1HAMH8q1q6azbqBAsXJUxBl/ODDuVPX45Z9DfwB8tPjTi6nNZ8BuM3nbJxC5zCAg5elnBUTQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.1", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/eslintrc/node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@eslint/js": { + "version": "9.39.2", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.2.tgz", + "integrity": "sha512-q1mjIoW1VX4IvSocvM/vbTiveKC4k9eLrajNEuSsmjymSDEbpGddtpfOoN7YGAqBK3NG+uqo8ia4PDTt8buCYA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz", + "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz", + "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.17.0", + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.7", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.7.tgz", + "integrity": "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.4.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/node": { "version": "25.1.0", "resolved": "https://registry.npmjs.org/@types/node/-/node-25.1.0.tgz", "integrity": "sha512-t7frlewr6+cbx+9Ohpl0NOTKXZNV9xHRmNOvql47BFJKcEG1CxtxlPEEe+gR9uhVWM4DwhnvTF110mIL4yP9RA==", "dev": true, "license": "MIT", - "dependencies": { - "undici-types": "~7.16.0" + "dependencies": { + "undici-types": "~7.16.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.54.0.tgz", + "integrity": "sha512-hAAP5io/7csFStuOmR782YmTthKBJ9ND3WVL60hcOjvtGFb+HJxH4O5huAcmcZ9v9G8P+JETiZ/G1B8MALnWZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.12.2", + "@typescript-eslint/scope-manager": "8.54.0", + "@typescript-eslint/type-utils": "8.54.0", + "@typescript-eslint/utils": "8.54.0", + "@typescript-eslint/visitor-keys": "8.54.0", + "ignore": "^7.0.5", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.4.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.54.0", + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.54.0.tgz", + "integrity": "sha512-BtE0k6cjwjLZoZixN0t5AKP0kSzlGu7FctRXYuPAm//aaiZhmfq1JwdYpYr1brzEspYyFeF+8XF5j2VK6oalrA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/scope-manager": "8.54.0", + "@typescript-eslint/types": "8.54.0", + "@typescript-eslint/typescript-estree": "8.54.0", + "@typescript-eslint/visitor-keys": "8.54.0", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.54.0.tgz", + "integrity": "sha512-YPf+rvJ1s7MyiWM4uTRhE4DvBXrEV+d8oC3P9Y2eT7S+HBS0clybdMIPnhiATi9vZOYDc7OQ1L/i6ga6NFYK/g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.54.0", + "@typescript-eslint/types": "^8.54.0", + "debug": "^4.4.3" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.54.0.tgz", + "integrity": "sha512-27rYVQku26j/PbHYcVfRPonmOlVI6gihHtXFbTdB5sb6qA0wdAQAbyXFVarQ5t4HRojIz64IV90YtsjQSSGlQg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.54.0", + "@typescript-eslint/visitor-keys": "8.54.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.54.0.tgz", + "integrity": "sha512-dRgOyT2hPk/JwxNMZDsIXDgyl9axdJI3ogZ2XWhBPsnZUv+hPesa5iuhdYt2gzwA9t8RE5ytOJ6xB0moV0Ujvw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.54.0.tgz", + "integrity": "sha512-hiLguxJWHjjwL6xMBwD903ciAwd7DmK30Y9Axs/etOkftC3ZNN9K44IuRD/EB08amu+Zw6W37x9RecLkOo3pMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.54.0", + "@typescript-eslint/typescript-estree": "8.54.0", + "@typescript-eslint/utils": "8.54.0", + "debug": "^4.4.3", + "ts-api-utils": "^2.4.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.54.0.tgz", + "integrity": "sha512-PDUI9R1BVjqu7AUDsRBbKMtwmjWcn4J3le+5LpcFgWULN3LvHC5rkc9gCVxbrsrGmO1jfPybN5s6h4Jy+OnkAA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.54.0.tgz", + "integrity": "sha512-BUwcskRaPvTk6fzVWgDPdUndLjB87KYDrN5EYGetnktoeAvPtO4ONHlAZDnj5VFnUANg0Sjm7j4usBlnoVMHwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/project-service": "8.54.0", + "@typescript-eslint/tsconfig-utils": "8.54.0", + "@typescript-eslint/types": "8.54.0", + "@typescript-eslint/visitor-keys": "8.54.0", + "debug": "^4.4.3", + "minimatch": "^9.0.5", + "semver": "^7.7.3", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.4.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.54.0.tgz", + "integrity": "sha512-9Cnda8GS57AQakvRyG0PTejJNlA2xhvyNtEVIMlDWOOeEyBkYWhGPnfrIAnqxLMTSTo6q8g12XVjjev5l1NvMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.9.1", + "@typescript-eslint/scope-manager": "8.54.0", + "@typescript-eslint/types": "8.54.0", + "@typescript-eslint/typescript-estree": "8.54.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.54.0.tgz", + "integrity": "sha512-VFlhGSl4opC0bprJiItPQ1RfUhGDIBokcPwaFH4yiBCaNPeld/9VeXbiPO1cLyorQi1G1vL+ecBk1x8o1axORA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.54.0", + "eslint-visitor-keys": "^4.2.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "dev": true, + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", + "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/diff": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.3.tgz", + "integrity": "sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "9.39.2", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.2.tgz", + "integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.21.1", + "@eslint/config-helpers": "^0.4.2", + "@eslint/core": "^0.17.0", + "@eslint/eslintrc": "^3.3.1", + "@eslint/js": "9.39.2", + "@eslint/plugin-kit": "^0.4.1", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.4.0", + "eslint-visitor-keys": "^4.2.1", + "espree": "^10.4.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-config-prettier": { + "version": "10.1.8", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.8.tgz", + "integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==", + "dev": true, + "license": "MIT", + "bin": { + "eslint-config-prettier": "bin/cli.js" + }, + "funding": { + "url": "https://opencollective.com/eslint-config-prettier" + }, + "peerDependencies": { + "eslint": ">=7.0.0" + } + }, + "node_modules/eslint-scope": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", + "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint/node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/eslint/node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/espree": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", + "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.15.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", + "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", + "dev": true, + "license": "ISC" + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "17.3.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-17.3.0.tgz", + "integrity": "sha512-yMqGUQVVCkD4tqjOJf3TnrvaaHDMYp4VlUSObbkIiuCPe/ofdMBFIAcBbCSRFWOnos6qRiTVStDwqPLUclaxIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" } }, - "node_modules/ajv": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", - "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.3", - "fast-uri": "^3.0.1", - "json-schema-traverse": "^1.0.0", - "require-from-string": "^2.0.2" + "is-extglob": "^2.1.1" }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "engines": { + "node": ">=0.10.0" } }, - "node_modules/diff": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/diff/-/diff-8.0.3.tgz", - "integrity": "sha512-qejHi7bcSD4hQAZE0tNAawRK1ZtafHDmMTMkrrIGgSLl7hTnQHmKCeB45xAcbfTqK2zowkM3j3bHt/4b/ARbYQ==", - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.3.1" + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/js-yaml": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" } }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, "license": "MIT" }, - "node_modules/fast-uri": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", - "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fastify" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/fastify" - } - ], - "license": "BSD-3-Clause" - }, "node_modules/json-schema-traverse": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", "license": "MIT" }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.1.tgz", + "integrity": "sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/require-from-string": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", @@ -95,6 +1388,121 @@ "node": ">=0.10.0" } }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.15", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/ts-api-utils": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.4.0.tgz", + "integrity": "sha512-3TaVTaAv2gTiMB35i3FiGJaRfwb3Pyn/j3m/bfAvGe8FB7CF6u+LMYqYlDh7reQf7UNvoTvdfAqHGmPGOSsPmA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, "node_modules/typescript": { "version": "5.9.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", @@ -109,12 +1517,85 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.54.0.tgz", + "integrity": "sha512-CKsJ+g53QpsNPqbzUsfKVgd3Lny4yKZ1pP4qN3jdMOg/sisIDLGyDMezycquXLE5JsEU0wp3dGNdzig0/fmSVQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.54.0", + "@typescript-eslint/parser": "8.54.0", + "@typescript-eslint/typescript-estree": "8.54.0", + "@typescript-eslint/utils": "8.54.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, "node_modules/undici-types": { "version": "7.16.0", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", "dev": true, "license": "MIT" + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } } } } diff --git a/package.json b/package.json index 7b4dd62..5b4993f 100644 --- a/package.json +++ b/package.json @@ -34,18 +34,27 @@ }, "scripts": { "build": "tsc -p tsconfig.json", - "lint": "tsc -p tsconfig.json --noEmit", + "format": "prettier --write .", + "lint": "eslint .", + "typecheck": "tsc -p tsconfig.json --noEmit", "prepare": "npm run build", "prepack": "npm run build", "test": "npm run build && node --test", - "compose": "npm run build && node dist/compose-agents.js" + "compose": "npm run build && node dist/compose-agents.js", + "verify": "npm run lint && npm run typecheck && prettier --check . && npm test" }, "engines": { "node": ">=20" }, "devDependencies": { + "@eslint/js": "^9.39.2", "@types/node": "^25.1.0", - "typescript": "^5.7.3" + "eslint": "^9.39.2", + "eslint-config-prettier": "^10.1.8", + "globals": "^17.3.0", + "prettier": "^3.8.1", + "typescript": "^5.7.3", + "typescript-eslint": "^8.54.0" }, "dependencies": { "ajv": "^8.17.1", diff --git a/src/compose-agents.ts b/src/compose-agents.ts index fe2f1ca..6f404ab 100644 --- a/src/compose-agents.ts +++ b/src/compose-agents.ts @@ -1,22 +1,22 @@ #!/usr/bin/env node -import fs from "node:fs"; -import path from "node:path"; -import os from "node:os"; -import { execFileSync } from "node:child_process"; -import readline from "node:readline"; -import { Ajv, type ErrorObject } from "ajv"; -import { createTwoFilesPatch } from "diff"; - -const DEFAULT_RULESET_NAME = "agent-ruleset.json"; -const DEFAULT_OUTPUT = "AGENTS.md"; -const DEFAULT_CACHE_ROOT = path.join(os.homedir(), ".agentsmd", "cache"); -const DEFAULT_WORKSPACE_ROOT = path.join(os.homedir(), ".agentsmd", "workspace"); -const DEFAULT_INIT_SOURCE = "github:owner/repo@latest"; +import fs from 'node:fs'; +import path from 'node:path'; +import os from 'node:os'; +import { execFileSync } from 'node:child_process'; +import readline from 'node:readline'; +import { Ajv, type ErrorObject } from 'ajv'; +import { createTwoFilesPatch } from 'diff'; + +const DEFAULT_RULESET_NAME = 'agent-ruleset.json'; +const DEFAULT_OUTPUT = 'AGENTS.md'; +const DEFAULT_CACHE_ROOT = path.join(os.homedir(), '.agentsmd', 'cache'); +const DEFAULT_WORKSPACE_ROOT = path.join(os.homedir(), '.agentsmd', 'workspace'); +const DEFAULT_INIT_SOURCE = 'github:owner/repo@latest'; const DEFAULT_INIT_DOMAINS: string[] = []; const DEFAULT_INIT_EXTRA: string[] = []; -const RULESET_SCHEMA_PATH = new URL("../agent-ruleset.schema.json", import.meta.url); -const PACKAGE_JSON_PATH = new URL("../package.json", import.meta.url); +const RULESET_SCHEMA_PATH = new URL('../agent-ruleset.schema.json', import.meta.url); +const PACKAGE_JSON_PATH = new URL('../package.json', import.meta.url); type CliArgs = { help?: boolean; @@ -38,11 +38,11 @@ type CliArgs = { dryRun?: boolean; yes?: boolean; force?: boolean; - command?: "compose" | "edit-rules" | "apply-rules" | "init"; + command?: 'compose' | 'edit-rules' | 'apply-rules' | 'init'; }; -const TOOL_RULES_PATH = new URL("../tools/tool-rules.md", import.meta.url); -const USAGE_PATH = new URL("../tools/usage.txt", import.meta.url); +const TOOL_RULES_PATH = new URL('../tools/tool-rules.md', import.meta.url); +const USAGE_PATH = new URL('../tools/usage.txt', import.meta.url); const readValueArg = (remaining: string[], index: number, flag: string): string => { const value = remaining[index + 1]; @@ -54,131 +54,131 @@ const readValueArg = (remaining: string[], index: number, flag: string): string const parseArgs = (argv: string[]): CliArgs => { const args: CliArgs = {}; - const knownCommands = new Set(["edit-rules", "apply-rules", "init"]); + const knownCommands = new Set(['edit-rules', 'apply-rules', 'init']); const remaining = [...argv]; if (remaining.length > 0 && knownCommands.has(remaining[0])) { - args.command = remaining.shift() as "edit-rules" | "apply-rules" | "init"; + args.command = remaining.shift() as 'edit-rules' | 'apply-rules' | 'init'; } for (let i = 0; i < remaining.length; i += 1) { const arg = remaining[i]; - if (arg === "--help" || arg === "-h") { + if (arg === '--help' || arg === '-h') { args.help = true; continue; } - if (arg === "--version" || arg === "-V") { + if (arg === '--version' || arg === '-V') { args.version = true; continue; } - if (arg === "--verbose" || arg === "-v") { + if (arg === '--verbose' || arg === '-v') { args.verbose = true; continue; } - if (arg === "--quiet" || arg === "-q") { + if (arg === '--quiet' || arg === '-q') { args.quiet = true; continue; } - if (arg === "--json") { + if (arg === '--json') { args.json = true; continue; } - if (arg === "--root") { - const value = readValueArg(remaining, i, "--root"); + if (arg === '--root') { + const value = readValueArg(remaining, i, '--root'); args.root = value; i += 1; continue; } - if (arg === "--ruleset") { - const value = readValueArg(remaining, i, "--ruleset"); + if (arg === '--ruleset') { + const value = readValueArg(remaining, i, '--ruleset'); args.ruleset = value; i += 1; continue; } - if (arg === "--ruleset-name") { - const value = readValueArg(remaining, i, "--ruleset-name"); + if (arg === '--ruleset-name') { + const value = readValueArg(remaining, i, '--ruleset-name'); args.rulesetName = value; i += 1; continue; } - if (arg === "--refresh") { + if (arg === '--refresh') { args.refresh = true; continue; } - if (arg === "--clear-cache") { + if (arg === '--clear-cache') { args.clearCache = true; continue; } - if (arg === "--source") { - const value = readValueArg(remaining, i, "--source"); + if (arg === '--source') { + const value = readValueArg(remaining, i, '--source'); args.source = value; i += 1; continue; } - if (arg === "--domains") { - const value = readValueArg(remaining, i, "--domains"); - args.domains = [...(args.domains ?? []), ...value.split(",").map((entry) => entry.trim())]; + if (arg === '--domains') { + const value = readValueArg(remaining, i, '--domains'); + args.domains = [...(args.domains ?? []), ...value.split(',').map((entry) => entry.trim())]; i += 1; continue; } - if (arg === "--no-domains") { + if (arg === '--no-domains') { args.domains = []; continue; } - if (arg === "--extra") { - const value = readValueArg(remaining, i, "--extra"); - args.extra = [...(args.extra ?? []), ...value.split(",").map((entry) => entry.trim())]; + if (arg === '--extra') { + const value = readValueArg(remaining, i, '--extra'); + args.extra = [...(args.extra ?? []), ...value.split(',').map((entry) => entry.trim())]; i += 1; continue; } - if (arg === "--no-extra") { + if (arg === '--no-extra') { args.extra = []; continue; } - if (arg === "--output") { - const value = readValueArg(remaining, i, "--output"); + if (arg === '--output') { + const value = readValueArg(remaining, i, '--output'); args.output = value; i += 1; continue; } - if (arg === "--no-global") { + if (arg === '--no-global') { args.global = false; continue; } - if (arg === "--compose") { + if (arg === '--compose') { args.compose = true; continue; } - if (arg === "--dry-run") { + if (arg === '--dry-run') { args.dryRun = true; continue; } - if (arg === "--yes") { + if (arg === '--yes') { args.yes = true; continue; } - if (arg === "--force") { + if (arg === '--force') { args.force = true; continue; } @@ -189,10 +189,10 @@ const parseArgs = (argv: string[]): CliArgs => { return args; }; -const normalizeTrailingWhitespace = (content: string): string => content.replace(/\s+$/u, ""); -const normalizePath = (filePath: string): string => filePath.replace(/\\/g, "/"); +const normalizeTrailingWhitespace = (content: string): string => content.replace(/\s+$/u, ''); +const normalizePath = (filePath: string): string => filePath.replace(/\\/g, '/'); const isNonEmptyString = (value: unknown): value is string => - typeof value === "string" && value.trim() !== ""; + typeof value === 'string' && value.trim() !== ''; const normalizeListOption = (values: string[] | undefined, label: string): string[] | undefined => { if (!values) { return undefined; @@ -215,26 +215,26 @@ const askQuestion = (prompt: string): Promise => }); }); -const usage = normalizeTrailingWhitespace(fs.readFileSync(USAGE_PATH, "utf8")); -const packageJson = JSON.parse(fs.readFileSync(PACKAGE_JSON_PATH, "utf8")) as { version?: string }; -const getVersion = (): string => packageJson.version ?? "unknown"; +const usage = normalizeTrailingWhitespace(fs.readFileSync(USAGE_PATH, 'utf8')); +const packageJson = JSON.parse(fs.readFileSync(PACKAGE_JSON_PATH, 'utf8')) as { version?: string }; +const getVersion = (): string => packageJson.version ?? 'unknown'; -const rulesetSchema = JSON.parse(fs.readFileSync(RULESET_SCHEMA_PATH, "utf8")); -const TOOL_RULES = normalizeTrailingWhitespace(fs.readFileSync(TOOL_RULES_PATH, "utf8")); +const rulesetSchema = JSON.parse(fs.readFileSync(RULESET_SCHEMA_PATH, 'utf8')); +const TOOL_RULES = normalizeTrailingWhitespace(fs.readFileSync(TOOL_RULES_PATH, 'utf8')); const ajv = new Ajv({ allErrors: true, strict: false }); const validateRulesetSchema = ajv.compile(rulesetSchema); const formatSchemaErrors = (errors: ErrorObject[] | null | undefined): string => { if (!errors || errors.length === 0) { - return "Unknown schema validation error"; + return 'Unknown schema validation error'; } return errors .map((error) => { - const pathLabel = error.instancePath ? error.instancePath : "(root)"; - return `${pathLabel} ${error.message ?? "is invalid"}`; + const pathLabel = error.instancePath ? error.instancePath : '(root)'; + return `${pathLabel} ${error.message ?? 'is invalid'}`; }) - .join("; "); + .join('; '); }; const resolveFrom = (baseDir: string, targetPath: string): string => { @@ -273,9 +273,9 @@ const ensureDirectoryExists = (dirPath: string): void => { }; const stripJsonComments = (input: string): string => { - let output = ""; + let output = ''; let inString = false; - let stringChar = ""; + let stringChar = ''; let escaping = false; let inLineComment = false; let inBlockComment = false; @@ -285,7 +285,7 @@ const stripJsonComments = (input: string): string => { const next = input[i + 1]; if (inLineComment) { - if (char === "\n") { + if (char === '\n') { inLineComment = false; output += char; } @@ -293,7 +293,7 @@ const stripJsonComments = (input: string): string => { } if (inBlockComment) { - if (char === "*" && next === "/") { + if (char === '*' && next === '/') { inBlockComment = false; i += 1; } @@ -306,30 +306,30 @@ const stripJsonComments = (input: string): string => { escaping = false; continue; } - if (char === "\\") { + if (char === '\\') { escaping = true; continue; } if (char === stringChar) { inString = false; - stringChar = ""; + stringChar = ''; } continue; } - if (char === "/" && next === "/") { + if (char === '/' && next === '/') { inLineComment = true; i += 1; continue; } - if (char === "/" && next === "*") { + if (char === '/' && next === '*') { inBlockComment = true; i += 1; continue; } - if (char === "\"" || char === "'") { + if (char === '"' || char === "'") { inString = true; stringChar = char; output += char; @@ -343,7 +343,7 @@ const stripJsonComments = (input: string): string => { }; const readJsonFile = (filePath: string): unknown => { - const raw = fs.readFileSync(filePath, "utf8"); + const raw = fs.readFileSync(filePath, 'utf8'); return JSON.parse(stripJsonComments(raw)); }; @@ -403,7 +403,7 @@ const collectMarkdownFiles = (rootDir: string): string[] => { continue; } - if (entry.isFile() && path.extname(entry.name).toLowerCase() === ".md") { + if (entry.isFile() && path.extname(entry.name).toLowerCase() === '.md') { results.push(entryPath); } } @@ -416,7 +416,11 @@ const collectMarkdownFiles = (rootDir: string): string[] => { }); }; -const addRulePaths = (rulePaths: string[], resolvedRules: string[], seenRules: Set): void => { +const addRulePaths = ( + rulePaths: string[], + resolvedRules: string[], + seenRules: Set, +): void => { for (const rulePath of rulePaths) { const resolvedRulePath = path.resolve(rulePath); if (seenRules.has(resolvedRulePath)) { @@ -435,7 +439,7 @@ type ComposeOptions = { }; type AgentsMdOutputDiff = { - status: "unchanged" | "updated"; + status: 'unchanged' | 'updated'; patch?: string; }; @@ -444,33 +448,33 @@ type ComposeResult = { agentsMdDiff?: AgentsMdOutputDiff; }; -const sanitizeCacheSegment = (value: string): string => value.replace(/[\\/]/gu, "__"); +const sanitizeCacheSegment = (value: string): string => value.replace(/[\\/]/gu, '__'); const looksLikeCommitHash = (value: string): boolean => /^[a-f0-9]{7,40}$/iu.test(value); const execGit = (args: string[], cwd?: string): string => - execFileSync("git", args, { cwd, encoding: "utf8", stdio: ["ignore", "pipe", "pipe"] }).trim(); + execFileSync('git', args, { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] }).trim(); const parseGithubSource = (source: string): GithubSource => { const trimmed = source.trim(); - if (!trimmed.startsWith("github:")) { + if (!trimmed.startsWith('github:')) { throw new Error(`Unsupported source: ${source}`); } - const withoutPrefix = trimmed.slice("github:".length); - const [repoPart, refPart] = withoutPrefix.split("@"); - const [owner, repo] = repoPart.split("/"); + const withoutPrefix = trimmed.slice('github:'.length); + const [repoPart, refPart] = withoutPrefix.split('@'); + const [owner, repo] = repoPart.split('/'); if (!isNonEmptyString(owner) || !isNonEmptyString(repo)) { throw new Error(`Invalid GitHub source (expected github:owner/repo@ref): ${source}`); } - const ref = isNonEmptyString(refPart) ? refPart : "latest"; + const ref = isNonEmptyString(refPart) ? refPart : 'latest'; return { owner, repo, ref, url: `https://github.com/${owner}/${repo}.git` }; }; const parseSemver = (tag: string): number[] | null => { - const cleaned = tag.startsWith("v") ? tag.slice(1) : tag; - const parts = cleaned.split("."); + const cleaned = tag.startsWith('v') ? tag.slice(1) : tag; + const parts = cleaned.split('.'); if (parts.length < 2 || parts.length > 3) { return null; } @@ -496,18 +500,18 @@ const compareSemver = (a: number[], b: number[]): number => { }; const resolveLatestTag = (repoUrl: string): { tag?: string; hash?: string } => { - const raw = execGit(["ls-remote", "--tags", "--refs", repoUrl]); + const raw = execGit(['ls-remote', '--tags', '--refs', repoUrl]); if (!raw) { return {}; } const candidates = raw - .split("\n") + .split('\n') .map((line) => line.trim()) .filter(Boolean) .map((line) => { const [hash, ref] = line.split(/\s+/u); - const tag = ref?.replace("refs/tags/", ""); + const tag = ref?.replace('refs/tags/', ''); if (!hash || !tag) { return null; } @@ -529,7 +533,7 @@ const resolveLatestTag = (repoUrl: string): { tag?: string; hash?: string } => { }; const resolveHeadHash = (repoUrl: string): string => { - const raw = execGit(["ls-remote", repoUrl, "HEAD"]); + const raw = execGit(['ls-remote', repoUrl, 'HEAD']); const [hash] = raw.split(/\s+/u); if (!hash) { throw new Error(`Unable to resolve HEAD for ${repoUrl}`); @@ -538,7 +542,7 @@ const resolveHeadHash = (repoUrl: string): string => { }; const resolveRefHash = (repoUrl: string, ref: string): string | null => { - const raw = execGit(["ls-remote", repoUrl, ref, `refs/tags/${ref}`, `refs/heads/${ref}`]); + const raw = execGit(['ls-remote', repoUrl, ref, `refs/tags/${ref}`, `refs/heads/${ref}`]); if (!raw) { return null; } @@ -547,27 +551,27 @@ const resolveRefHash = (repoUrl: string, ref: string): string | null => { }; const cloneAtRef = (repoUrl: string, ref: string, destination: string): void => { - execGit(["clone", "--depth", "1", "--branch", ref, repoUrl, destination]); + execGit(['clone', '--depth', '1', '--branch', ref, repoUrl, destination]); }; const fetchCommit = (repoUrl: string, commitHash: string, destination: string): void => { ensureDir(destination); - execGit(["init"], destination); - execGit(["remote", "add", "origin", repoUrl], destination); - execGit(["fetch", "--depth", "1", "origin", commitHash], destination); - execGit(["checkout", "FETCH_HEAD"], destination); + execGit(['init'], destination); + execGit(['remote', 'add', 'origin', repoUrl], destination); + execGit(['fetch', '--depth', '1', 'origin', commitHash], destination); + execGit(['checkout', 'FETCH_HEAD'], destination); }; const resolveGithubRulesRoot = ( source: string, - refresh: boolean + refresh: boolean, ): { rulesRoot: string; resolvedRef: string } => { const parsed = parseGithubSource(source); - const resolved = parsed.ref === "latest" ? resolveLatestTag(parsed.url) : null; - const resolvedRef = resolved?.tag ?? (parsed.ref === "latest" ? "HEAD" : parsed.ref); + const resolved = parsed.ref === 'latest' ? resolveLatestTag(parsed.url) : null; + const resolvedRef = resolved?.tag ?? (parsed.ref === 'latest' ? 'HEAD' : parsed.ref); const resolvedHash = resolved?.hash ?? - (resolvedRef === "HEAD" + (resolvedRef === 'HEAD' ? resolveHeadHash(parsed.url) : resolveRefHash(parsed.url, resolvedRef)); @@ -576,7 +580,9 @@ const resolveGithubRulesRoot = ( } const cacheSegment = - resolvedRef === "HEAD" ? sanitizeCacheSegment(resolvedHash ?? resolvedRef) : sanitizeCacheSegment(resolvedRef); + resolvedRef === 'HEAD' + ? sanitizeCacheSegment(resolvedHash ?? resolvedRef) + : sanitizeCacheSegment(resolvedRef); const cacheDir = path.join(DEFAULT_CACHE_ROOT, parsed.owner, parsed.repo, cacheSegment); if (refresh && fs.existsSync(cacheDir)) { @@ -598,7 +604,7 @@ const resolveGithubRulesRoot = ( } } - const rulesRoot = path.join(cacheDir, "rules"); + const rulesRoot = path.join(cacheDir, 'rules'); ensureDirectoryExists(rulesRoot); return { rulesRoot, resolvedRef }; @@ -610,13 +616,14 @@ const resolveLocalRulesRoot = (rulesetDir: string, source: string): string => { throw new Error(`Missing source path: ${resolvedSource}`); } - const candidate = path.basename(resolvedSource) === "rules" ? resolvedSource : path.join(resolvedSource, "rules"); + const candidate = + path.basename(resolvedSource) === 'rules' ? resolvedSource : path.join(resolvedSource, 'rules'); ensureDirectoryExists(candidate); return candidate; }; const resolveWorkspaceRoot = (rulesetDir: string, source: string): string => { - if (source.startsWith("github:")) { + if (source.startsWith('github:')) { const parsed = parseGithubSource(source); return path.join(DEFAULT_WORKSPACE_ROOT, parsed.owner, parsed.repo); } @@ -630,42 +637,42 @@ const ensureWorkspaceForGithubSource = (source: string): string => { if (!fs.existsSync(workspaceRoot)) { ensureDir(path.dirname(workspaceRoot)); - execGit(["clone", parsed.url, workspaceRoot]); + execGit(['clone', parsed.url, workspaceRoot]); } - if (parsed.ref !== "latest") { - execGit(["fetch", "--all"], workspaceRoot); - execGit(["checkout", parsed.ref], workspaceRoot); + if (parsed.ref !== 'latest') { + execGit(['fetch', '--all'], workspaceRoot); + execGit(['checkout', parsed.ref], workspaceRoot); } return workspaceRoot; }; const applyRulesFromWorkspace = (rulesetDir: string, source: string): void => { - if (!source.startsWith("github:")) { + if (!source.startsWith('github:')) { return; } const workspaceRoot = ensureWorkspaceForGithubSource(source); - const status = execGit(["status", "--porcelain"], workspaceRoot); + const status = execGit(['status', '--porcelain'], workspaceRoot); if (status) { throw new Error(`Workspace has uncommitted changes: ${workspaceRoot}`); } - const branch = execGit(["rev-parse", "--abbrev-ref", "HEAD"], workspaceRoot); - if (branch === "HEAD") { + const branch = execGit(['rev-parse', '--abbrev-ref', 'HEAD'], workspaceRoot); + if (branch === 'HEAD') { throw new Error(`Workspace is in detached HEAD state: ${workspaceRoot}`); } - execGit(["push"], workspaceRoot); + execGit(['push'], workspaceRoot); }; const resolveRulesRoot = ( rulesetDir: string, source: string, - refresh: boolean + refresh: boolean, ): { rulesRoot: string; resolvedRef?: string } => { - if (source.startsWith("github:")) { + if (source.startsWith('github:')) { return resolveGithubRulesRoot(source, refresh); } @@ -677,12 +684,12 @@ const formatRuleSourcePath = ( rulesRoot: string, rulesetDir: string, source: string, - resolvedRef?: string + resolvedRef?: string, ): string => { // Check if this rule is from the resolved rulesRoot (GitHub or local source) const isFromSource = rulePath.startsWith(rulesRoot); - - if (isFromSource && source.startsWith("github:")) { + + if (isFromSource && source.startsWith('github:')) { // GitHub source rule const parsed = parseGithubSource(source); const cacheRepoRoot = path.dirname(rulesRoot); @@ -696,16 +703,24 @@ const formatRuleSourcePath = ( return result; }; -const composeRuleset = (rulesetPath: string, rootDir: string, options: ComposeOptions): ComposeResult => { +const composeRuleset = ( + rulesetPath: string, + rootDir: string, + options: ComposeOptions, +): ComposeResult => { const rulesetDir = path.dirname(rulesetPath); const projectRuleset = readProjectRuleset(rulesetPath); const outputFileName = projectRuleset.output ?? DEFAULT_OUTPUT; const outputPath = resolveFrom(rulesetDir, outputFileName); const composedOutputPath = normalizePath(path.relative(rootDir, outputPath)); - const { rulesRoot, resolvedRef } = resolveRulesRoot(rulesetDir, projectRuleset.source, options.refresh ?? false); - const globalRoot = path.join(rulesRoot, "global"); - const domainsRoot = path.join(rulesRoot, "domains"); + const { rulesRoot, resolvedRef } = resolveRulesRoot( + rulesetDir, + projectRuleset.source, + options.refresh ?? false, + ); + const globalRoot = path.join(rulesRoot, 'global'); + const domainsRoot = path.join(rulesRoot, 'domains'); const resolvedRules: string[] = []; const seenRules = new Set(); @@ -725,39 +740,45 @@ const composeRuleset = (rulesetPath: string, rootDir: string, options: ComposeOp addRulePaths(directRulePaths, resolvedRules, seenRules); const parts = resolvedRules.map((rulePath) => { - const body = normalizeTrailingWhitespace(fs.readFileSync(rulePath, "utf8")); - const sourcePath = formatRuleSourcePath(rulePath, rulesRoot, rulesetDir, projectRuleset.source, resolvedRef); + const body = normalizeTrailingWhitespace(fs.readFileSync(rulePath, 'utf8')); + const sourcePath = formatRuleSourcePath( + rulePath, + rulesRoot, + rulesetDir, + projectRuleset.source, + resolvedRef, + ); return `Source: ${sourcePath}\n\n${body}`; }); - const lintHeader = ""; + const lintHeader = ''; const toolRules = normalizeTrailingWhitespace(TOOL_RULES); - const output = `${lintHeader}\n${[toolRules, ...parts].join("\n\n")}\n`; + const output = `${lintHeader}\n${[toolRules, ...parts].join('\n\n')}\n`; let agentsMdDiff: AgentsMdOutputDiff | undefined; if (options.emitAgentsMdDiff && path.basename(outputPath) === DEFAULT_OUTPUT) { - const before = fs.existsSync(outputPath) ? fs.readFileSync(outputPath, "utf8") : ""; + const before = fs.existsSync(outputPath) ? fs.readFileSync(outputPath, 'utf8') : ''; if (before === output) { - agentsMdDiff = { status: "unchanged" }; + agentsMdDiff = { status: 'unchanged' }; } else { agentsMdDiff = { - status: "updated", + status: 'updated', patch: createTwoFilesPatch( `a/${composedOutputPath}`, `b/${composedOutputPath}`, before, output, - "", - "", - { context: 3 } - ) + '', + '', + { context: 3 }, + ), }; } } if (!options.dryRun) { fs.mkdirSync(path.dirname(outputPath), { recursive: true }); - fs.writeFileSync(outputPath, output, "utf8"); + fs.writeFileSync(outputPath, output, 'utf8'); } return { output: composedOutputPath, agentsMdDiff }; @@ -768,36 +789,38 @@ const printAgentsMdDiffIfPresent = (result: ComposeResult): void => { return; } - if (result.agentsMdDiff.status === "unchanged") { - process.stdout.write("AGENTS.md unchanged.\n"); + if (result.agentsMdDiff.status === 'unchanged') { + process.stdout.write('AGENTS.md unchanged.\n'); return; } - process.stdout.write("AGENTS.md updated. ACTION (agent): refresh rule recognition from the diff below.\n"); - process.stdout.write("--- BEGIN DIFF ---\n"); + process.stdout.write( + 'AGENTS.md updated. ACTION (agent): refresh rule recognition from the diff below.\n', + ); + process.stdout.write('--- BEGIN DIFF ---\n'); if (result.agentsMdDiff.patch) { process.stdout.write(result.agentsMdDiff.patch); - if (!result.agentsMdDiff.patch.endsWith("\n")) { - process.stdout.write("\n"); + if (!result.agentsMdDiff.patch.endsWith('\n')) { + process.stdout.write('\n'); } } - process.stdout.write("--- END DIFF ---\n"); + process.stdout.write('--- END DIFF ---\n'); }; type InitPlanItem = { - action: "create" | "overwrite"; + action: 'create' | 'overwrite'; path: string; }; -const LOCAL_RULES_TEMPLATE = "# Local Rules\n\n- Add project-specific instructions here.\n"; +const LOCAL_RULES_TEMPLATE = '# Local Rules\n\n- Add project-specific instructions here.\n'; const buildInitRuleset = (args: CliArgs): ProjectRuleset => { - const domains = normalizeListOption(args.domains, "--domains"); - const extra = normalizeListOption(args.extra, "--extra"); + const domains = normalizeListOption(args.domains, '--domains'); + const extra = normalizeListOption(args.extra, '--extra'); const ruleset: ProjectRuleset = { source: args.source ?? DEFAULT_INIT_SOURCE, - output: args.output ?? DEFAULT_OUTPUT + output: args.output ?? DEFAULT_OUTPUT, }; if (args.global === false) { @@ -821,13 +844,13 @@ const formatInitRuleset = (ruleset: ProjectRuleset): string => { const domainsValue = JSON.stringify(ruleset.domains ?? []); const extraValue = JSON.stringify(ruleset.extra ?? []); const lines = [ - "{", + '{', ' // Rules source. Use github:owner/repo@ref or a local path.', ` "source": "${ruleset.source}",`, ' // Domain folders under rules/domains.', ` "domains": ${domainsValue},`, ' // Additional local rule files to append.', - ` "extra": ${extraValue},` + ` "extra": ${extraValue},`, ]; if (ruleset.global === false) { @@ -837,19 +860,19 @@ const formatInitRuleset = (ruleset: ProjectRuleset): string => { lines.push(' // Output file name.'); lines.push(` "output": "${ruleset.output ?? DEFAULT_OUTPUT}"`); - lines.push("}"); + lines.push('}'); - return `${lines.join("\n")}\n`; + return `${lines.join('\n')}\n`; }; const formatPlan = (items: InitPlanItem[], rootDir: string): string => { const lines = items.map((item) => { - const verb = item.action === "overwrite" ? "Overwrite" : "Create"; + const verb = item.action === 'overwrite' ? 'Overwrite' : 'Create'; const relative = normalizePath(path.relative(rootDir, item.path)); return `- ${verb}: ${relative}`; }); - return `Init plan:\n${lines.join("\n")}\n`; + return `Init plan:\n${lines.join('\n')}\n`; }; const confirmInit = async (args: CliArgs): Promise => { @@ -858,17 +881,19 @@ const confirmInit = async (args: CliArgs): Promise => { } if (!process.stdin.isTTY) { - throw new Error("Confirmation required. Re-run with --yes to continue."); + throw new Error('Confirmation required. Re-run with --yes to continue.'); } - const answer = await askQuestion("Proceed with init? [y/N] "); + const answer = await askQuestion('Proceed with init? [y/N] '); if (!/^y(es)?$/iu.test(answer.trim())) { - throw new Error("Init aborted."); + throw new Error('Init aborted.'); } }; const initProject = async (args: CliArgs, rootDir: string, rulesetName: string): Promise => { - const rulesetPath = args.ruleset ? resolveFrom(rootDir, args.ruleset) : path.join(rootDir, rulesetName); + const rulesetPath = args.ruleset + ? resolveFrom(rootDir, args.ruleset) + : path.join(rootDir, rulesetName); const rulesetDir = path.dirname(rulesetPath); const ruleset = buildInitRuleset(args); const outputPath = resolveFrom(rulesetDir, ruleset.output ?? DEFAULT_OUTPUT); @@ -879,9 +904,9 @@ const initProject = async (args: CliArgs, rootDir: string, rulesetName: string): if (!args.force) { throw new Error(`Ruleset already exists: ${normalizePath(rulesetPath)}`); } - plan.push({ action: "overwrite", path: rulesetPath }); + plan.push({ action: 'overwrite', path: rulesetPath }); } else { - plan.push({ action: "create", path: rulesetPath }); + plan.push({ action: 'create', path: rulesetPath }); } const extraFiles = (ruleset.extra ?? []).map((rulePath) => resolveFrom(rulesetDir, rulePath)); @@ -889,24 +914,26 @@ const initProject = async (args: CliArgs, rootDir: string, rulesetName: string): for (const extraPath of extraFiles) { if (fs.existsSync(extraPath)) { if (args.force) { - plan.push({ action: "overwrite", path: extraPath }); + plan.push({ action: 'overwrite', path: extraPath }); extraToWrite.push(extraPath); } continue; } - plan.push({ action: "create", path: extraPath }); + plan.push({ action: 'create', path: extraPath }); extraToWrite.push(extraPath); } if (args.compose) { if (fs.existsSync(outputPath)) { if (!args.force) { - throw new Error(`Output already exists: ${normalizePath(outputPath)} (use --force to overwrite)`); + throw new Error( + `Output already exists: ${normalizePath(outputPath)} (use --force to overwrite)`, + ); } - plan.push({ action: "overwrite", path: outputPath }); + plan.push({ action: 'overwrite', path: outputPath }); } else { - plan.push({ action: "create", path: outputPath }); + plan.push({ action: 'create', path: outputPath }); } } @@ -922,15 +949,15 @@ const initProject = async (args: CliArgs, rootDir: string, rulesetName: string): dryRun: true, plan: plan.map((item) => ({ action: item.action, - path: normalizePath(path.relative(rootDir, item.path)) - })) + path: normalizePath(path.relative(rootDir, item.path)), + })), }, null, - 2 - ) + "\n" + 2, + ) + '\n', ); } else if (!args.quiet) { - process.stdout.write("Dry run: no changes made.\n"); + process.stdout.write('Dry run: no changes made.\n'); } return; } @@ -938,18 +965,18 @@ const initProject = async (args: CliArgs, rootDir: string, rulesetName: string): await confirmInit(args); fs.mkdirSync(path.dirname(rulesetPath), { recursive: true }); - fs.writeFileSync(`${rulesetPath}`, formatInitRuleset(ruleset), "utf8"); + fs.writeFileSync(`${rulesetPath}`, formatInitRuleset(ruleset), 'utf8'); for (const extraPath of extraToWrite) { fs.mkdirSync(path.dirname(extraPath), { recursive: true }); - fs.writeFileSync(extraPath, LOCAL_RULES_TEMPLATE, "utf8"); + fs.writeFileSync(extraPath, LOCAL_RULES_TEMPLATE, 'utf8'); } let composedOutput: ComposeResult | undefined; if (args.compose) { composedOutput = composeRuleset(rulesetPath, rootDir, { refresh: args.refresh ?? false, - emitAgentsMdDiff: !args.quiet && !args.json + emitAgentsMdDiff: !args.quiet && !args.json, }); } @@ -958,21 +985,25 @@ const initProject = async (args: CliArgs, rootDir: string, rulesetName: string): JSON.stringify( { initialized: [normalizePath(path.relative(rootDir, rulesetPath))], - localRules: extraToWrite.map((filePath) => normalizePath(path.relative(rootDir, filePath))), + localRules: extraToWrite.map((filePath) => + normalizePath(path.relative(rootDir, filePath)), + ), composed: composedOutput ? [composedOutput.output] : [], - dryRun: false + dryRun: false, }, null, - 2 - ) + "\n" + 2, + ) + '\n', ); } else if (!args.quiet) { - process.stdout.write(`Initialized ruleset:\n- ${normalizePath(path.relative(rootDir, rulesetPath))}\n`); + process.stdout.write( + `Initialized ruleset:\n- ${normalizePath(path.relative(rootDir, rulesetPath))}\n`, + ); if (extraToWrite.length > 0) { process.stdout.write( `Initialized local rules:\n${extraToWrite .map((filePath) => `- ${normalizePath(path.relative(rootDir, filePath))}`) - .join("\n")}\n` + .join('\n')}\n`, ); } if (composedOutput) { @@ -982,7 +1013,11 @@ const initProject = async (args: CliArgs, rootDir: string, rulesetName: string): } }; -const getRulesetFiles = (rootDir: string, specificRuleset: string | undefined, rulesetName: string): string[] => { +const getRulesetFiles = ( + rootDir: string, + specificRuleset: string | undefined, + rulesetName: string, +): string[] => { if (specificRuleset) { const resolved = resolveFrom(rootDir, specificRuleset); ensureFileExists(resolved); @@ -996,7 +1031,11 @@ const getRulesetFiles = (rootDir: string, specificRuleset: string | undefined, r return [defaultRuleset]; }; -const ensureSingleRuleset = (rulesetFiles: string[], rootDir: string, rulesetName: string): string => { +const ensureSingleRuleset = ( + rulesetFiles: string[], + rootDir: string, + rulesetName: string, +): string => { if (rulesetFiles.length === 0) { const expectedPath = normalizePath(path.join(rootDir, rulesetName)); throw new Error(`Missing ruleset file: ${expectedPath}`); @@ -1020,60 +1059,60 @@ const main = async (): Promise => { if (args.clearCache) { clearCache(); - process.stdout.write("Cache cleared.\n"); + process.stdout.write('Cache cleared.\n'); return; } const rootDir = args.root ? path.resolve(args.root) : process.cwd(); const rulesetName = args.rulesetName || DEFAULT_RULESET_NAME; const rulesetFiles = getRulesetFiles(rootDir, args.ruleset, rulesetName); - const command = args.command ?? "compose"; + const command = args.command ?? 'compose'; const logVerbose = (message: string): void => { if (args.verbose) { process.stdout.write(`${message}\n`); } }; - logVerbose("Verbose:"); + logVerbose('Verbose:'); logVerbose(`- Root: ${rootDir}`); logVerbose(`- Ruleset name: ${rulesetName}`); logVerbose( - `- Ruleset files:\n${rulesetFiles.map((file) => ` - ${normalizePath(path.relative(rootDir, file))}`).join("\n")}` + `- Ruleset files:\n${rulesetFiles.map((file) => ` - ${normalizePath(path.relative(rootDir, file))}`).join('\n')}`, ); - if (command === "edit-rules") { + if (command === 'edit-rules') { const rulesetPath = ensureSingleRuleset(rulesetFiles, rootDir, rulesetName); const rulesetDir = path.dirname(rulesetPath); const ruleset = readProjectRuleset(rulesetPath); let workspaceRoot = resolveWorkspaceRoot(rulesetDir, ruleset.source); - if (ruleset.source.startsWith("github:")) { + if (ruleset.source.startsWith('github:')) { workspaceRoot = ensureWorkspaceForGithubSource(ruleset.source); } - const rulesDirectory = ruleset.source.startsWith("github:") - ? path.join(workspaceRoot, "rules") + const rulesDirectory = ruleset.source.startsWith('github:') + ? path.join(workspaceRoot, 'rules') : resolveLocalRulesRoot(rulesetDir, ruleset.source); process.stdout.write( [ `Rules workspace: ${workspaceRoot}`, `Rules directory: ${rulesDirectory}`, - "Next steps:", + 'Next steps:', `- Edit rule files under: ${rulesDirectory}`, - "- If this source is GitHub, commit and push the workspace changes before apply-rules.", - "- Run compose-agentsmd apply-rules from your project root to apply updates and regenerate AGENTS.md." - ].join("\n") + "\n" + '- If this source is GitHub, commit and push the workspace changes before apply-rules.', + '- Run compose-agentsmd apply-rules from your project root to apply updates and regenerate AGENTS.md.', + ].join('\n') + '\n', ); return; } - if (command === "init") { + if (command === 'init') { await initProject(args, rootDir, rulesetName); return; } - if (command === "apply-rules") { + if (command === 'apply-rules') { const rulesetPath = ensureSingleRuleset(rulesetFiles, rootDir, rulesetName); const rulesetDir = path.dirname(rulesetPath); const ruleset = readProjectRuleset(rulesetPath); @@ -1082,10 +1121,12 @@ const main = async (): Promise => { const output = composeRuleset(rulesetPath, rootDir, { refresh: true, dryRun: args.dryRun, - emitAgentsMdDiff: !args.quiet && !args.json + emitAgentsMdDiff: !args.quiet && !args.json, }); if (args.json) { - process.stdout.write(JSON.stringify({ composed: [output.output], dryRun: !!args.dryRun }, null, 2) + "\n"); + process.stdout.write( + JSON.stringify({ composed: [output.output], dryRun: !!args.dryRun }, null, 2) + '\n', + ); } else if (!args.quiet) { process.stdout.write(`Composed AGENTS.md:\n- ${output.output}\n`); printAgentsMdDiffIfPresent(output); @@ -1098,22 +1139,26 @@ const main = async (): Promise => { throw new Error(`Missing ruleset file: ${expectedPath}`); } - const outputs = rulesetFiles - .sort() - .map((rulesetPath) => - composeRuleset(rulesetPath, rootDir, { - refresh: args.refresh, - dryRun: args.dryRun, - emitAgentsMdDiff: !args.quiet && !args.json - }) - ); + const outputs = rulesetFiles.sort().map((rulesetPath) => + composeRuleset(rulesetPath, rootDir, { + refresh: args.refresh, + dryRun: args.dryRun, + emitAgentsMdDiff: !args.quiet && !args.json, + }), + ); if (args.json) { process.stdout.write( - JSON.stringify({ composed: outputs.map((result) => result.output), dryRun: !!args.dryRun }, null, 2) + "\n" + JSON.stringify( + { composed: outputs.map((result) => result.output), dryRun: !!args.dryRun }, + null, + 2, + ) + '\n', ); } else if (!args.quiet) { - process.stdout.write(`Composed AGENTS.md:\n${outputs.map((result) => `- ${result.output}`).join("\n")}\n`); + process.stdout.write( + `Composed AGENTS.md:\n${outputs.map((result) => `- ${result.output}`).join('\n')}\n`, + ); for (const result of outputs) { printAgentsMdDiffIfPresent(result); } diff --git a/test/compose-agents.test.js b/test/compose-agents.test.js index d2c3213..32a47e1 100644 --- a/test/compose-agents.test.js +++ b/test/compose-agents.test.js @@ -1,29 +1,29 @@ -import test from "node:test"; -import assert from "node:assert/strict"; -import fs from "node:fs"; -import os from "node:os"; -import path from "node:path"; -import { execFileSync } from "node:child_process"; -import { fileURLToPath } from "node:url"; +import test from 'node:test'; +import assert from 'node:assert/strict'; +import fs from 'node:fs'; +import os from 'node:os'; +import path from 'node:path'; +import { execFileSync } from 'node:child_process'; +import { fileURLToPath } from 'node:url'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); -const repoRoot = path.resolve(__dirname, ".."); -const cliPath = path.join(repoRoot, "dist", "compose-agents.js"); -const packageJson = JSON.parse(fs.readFileSync(path.join(repoRoot, "package.json"), "utf8")); +const repoRoot = path.resolve(__dirname, '..'); +const cliPath = path.join(repoRoot, 'dist', 'compose-agents.js'); +const packageJson = JSON.parse(fs.readFileSync(path.join(repoRoot, 'package.json'), 'utf8')); const writeFile = (filePath, content) => { fs.mkdirSync(path.dirname(filePath), { recursive: true }); - fs.writeFileSync(filePath, content, "utf8"); + fs.writeFileSync(filePath, content, 'utf8'); }; -const normalizeTrailingWhitespace = (content) => content.replace(/\s+$/u, ""); -const normalizePath = (value) => value.replace(/\\/g, "/"); +const normalizeTrailingWhitespace = (content) => content.replace(/\s+$/u, ''); +const normalizePath = (value) => value.replace(/\\/g, '/'); const stripJsonComments = (input) => { - let output = ""; + let output = ''; let inString = false; - let stringChar = ""; + let stringChar = ''; let escaping = false; let inLineComment = false; let inBlockComment = false; @@ -33,7 +33,7 @@ const stripJsonComments = (input) => { const next = input[i + 1]; if (inLineComment) { - if (char === "\n") { + if (char === '\n') { inLineComment = false; output += char; } @@ -41,7 +41,7 @@ const stripJsonComments = (input) => { } if (inBlockComment) { - if (char === "*" && next === "/") { + if (char === '*' && next === '/') { inBlockComment = false; i += 1; } @@ -54,30 +54,30 @@ const stripJsonComments = (input) => { escaping = false; continue; } - if (char === "\\") { + if (char === '\\') { escaping = true; continue; } if (char === stringChar) { inString = false; - stringChar = ""; + stringChar = ''; } continue; } - if (char === "/" && next === "/") { + if (char === '/' && next === '/') { inLineComment = true; i += 1; continue; } - if (char === "/" && next === "*") { + if (char === '/' && next === '*') { inBlockComment = true; i += 1; continue; } - if (char === "\"" || char === "'") { + if (char === '"' || char === "'") { inString = true; stringChar = char; output += char; @@ -90,15 +90,15 @@ const stripJsonComments = (input) => { return output; }; const TOOL_RULES = normalizeTrailingWhitespace( - fs.readFileSync(path.join(repoRoot, "tools", "tool-rules.md"), "utf8") + fs.readFileSync(path.join(repoRoot, 'tools', 'tool-rules.md'), 'utf8'), ); const runCli = (args, options) => execFileSync(process.execPath, [cliPath, ...args], { cwd: options.cwd, env: { ...process.env, ...options.env }, - encoding: "utf8", - stdio: "pipe" + encoding: 'utf8', + stdio: 'pipe', }); const formatRuleBlock = (rulePath, body, projectRoot) => { @@ -108,38 +108,38 @@ const formatRuleBlock = (rulePath, body, projectRoot) => { const withToolRules = (body) => `\n${TOOL_RULES}\n\n${body}`; -test("prints version with --version and -V", () => { +test('prints version with --version and -V', () => { const expected = `${packageJson.version}\n`; - const stdoutLong = runCli(["--version"], { cwd: repoRoot }); - const stdoutShort = runCli(["-V"], { cwd: repoRoot }); + const stdoutLong = runCli(['--version'], { cwd: repoRoot }); + const stdoutShort = runCli(['-V'], { cwd: repoRoot }); assert.equal(stdoutLong, expected); assert.equal(stdoutShort, expected); }); -test("prints verbose diagnostics with -v", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('prints verbose diagnostics with -v', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const projectRoot = path.join(tempRoot, "project"); - const sourceRoot = path.join(tempRoot, "rules-source"); - const rulesRoot = path.join(sourceRoot, "rules"); + const projectRoot = path.join(tempRoot, 'project'); + const sourceRoot = path.join(tempRoot, 'rules-source'); + const rulesRoot = path.join(sourceRoot, 'rules'); writeFile( - path.join(projectRoot, "agent-ruleset.json"), + path.join(projectRoot, 'agent-ruleset.json'), JSON.stringify( { source: path.relative(projectRoot, sourceRoot), global: true, - output: "AGENTS.md" + output: 'AGENTS.md', }, null, - 2 - ) + 2, + ), ); - writeFile(path.join(rulesRoot, "global", "only.md"), "# Only\n1"); + writeFile(path.join(rulesRoot, 'global', 'only.md'), '# Only\n1'); - const stdout = runCli(["-v", "--root", projectRoot], { cwd: repoRoot }); + const stdout = runCli(['-v', '--root', projectRoot], { cwd: repoRoot }); assert.match(stdout, /Verbose:/u); assert.match(stdout, /Ruleset files:/u); assert.match(stdout, /Composed AGENTS\.md:/u); @@ -148,50 +148,56 @@ test("prints verbose diagnostics with -v", () => { } }); - - -test("composes AGENTS.md using local source and extra rules", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('composes AGENTS.md using local source and extra rules', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const projectRoot = path.join(tempRoot, "project"); - const sourceRoot = path.join(tempRoot, "rules-source"); - const rulesRoot = path.join(sourceRoot, "rules"); + const projectRoot = path.join(tempRoot, 'project'); + const sourceRoot = path.join(tempRoot, 'rules-source'); + const rulesRoot = path.join(sourceRoot, 'rules'); writeFile( - path.join(projectRoot, "agent-ruleset.json"), + path.join(projectRoot, 'agent-ruleset.json'), JSON.stringify( { source: path.relative(projectRoot, sourceRoot), global: true, - output: "AGENTS.md", - domains: ["node"], - extra: ["agent-rules-local/custom.md"] + output: 'AGENTS.md', + domains: ['node'], + extra: ['agent-rules-local/custom.md'], }, null, - 2 - ) + 2, + ), ); - writeFile(path.join(projectRoot, "agent-rules-local", "custom.md"), "# Custom\nlocal"); + writeFile(path.join(projectRoot, 'agent-rules-local', 'custom.md'), '# Custom\nlocal'); - writeFile(path.join(rulesRoot, "global", "a.md"), "# Global A\nA"); - writeFile(path.join(rulesRoot, "global", "b.md"), "# Global B\nB"); - writeFile(path.join(rulesRoot, "domains", "node", "c.md"), "# Domain C\nC"); + writeFile(path.join(rulesRoot, 'global', 'a.md'), '# Global A\nA'); + writeFile(path.join(rulesRoot, 'global', 'b.md'), '# Global B\nB'); + writeFile(path.join(rulesRoot, 'domains', 'node', 'c.md'), '# Domain C\nC'); - const stdout = runCli(["--root", projectRoot], { cwd: repoRoot }); + const stdout = runCli(['--root', projectRoot], { cwd: repoRoot }); assert.match(stdout, /Composed AGENTS\.md:/u); - const outputPath = path.join(projectRoot, "AGENTS.md"); - const output = fs.readFileSync(outputPath, "utf8"); + const outputPath = path.join(projectRoot, 'AGENTS.md'); + const output = fs.readFileSync(outputPath, 'utf8'); const expected = withToolRules( [ - formatRuleBlock(path.join(rulesRoot, "global", "a.md"), "# Global A\nA", projectRoot), - formatRuleBlock(path.join(rulesRoot, "global", "b.md"), "# Global B\nB", projectRoot), - formatRuleBlock(path.join(rulesRoot, "domains", "node", "c.md"), "# Domain C\nC", projectRoot), - formatRuleBlock(path.join(projectRoot, "agent-rules-local", "custom.md"), "# Custom\nlocal", projectRoot) - ].join("\n\n") + "\n" + formatRuleBlock(path.join(rulesRoot, 'global', 'a.md'), '# Global A\nA', projectRoot), + formatRuleBlock(path.join(rulesRoot, 'global', 'b.md'), '# Global B\nB', projectRoot), + formatRuleBlock( + path.join(rulesRoot, 'domains', 'node', 'c.md'), + '# Domain C\nC', + projectRoot, + ), + formatRuleBlock( + path.join(projectRoot, 'agent-rules-local', 'custom.md'), + '# Custom\nlocal', + projectRoot, + ), + ].join('\n\n') + '\n', ); assert.equal(output, expected); @@ -200,224 +206,241 @@ test("composes AGENTS.md using local source and extra rules", () => { } }); -test("fails fast when ruleset is missing", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('fails fast when ruleset is missing', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { assert.throws( - () => runCli(["--root", tempRoot], { cwd: repoRoot }), - /Missing ruleset file: .*agent-ruleset\.json/u + () => runCli(['--root', tempRoot], { cwd: repoRoot }), + /Missing ruleset file: .*agent-ruleset\.json/u, ); } finally { fs.rmSync(tempRoot, { recursive: true, force: true }); } }); -test("does not search for rulesets in subdirectories", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('does not search for rulesets in subdirectories', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const nestedRoot = path.join(tempRoot, "nested"); + const nestedRoot = path.join(tempRoot, 'nested'); writeFile( - path.join(nestedRoot, "agent-ruleset.json"), + path.join(nestedRoot, 'agent-ruleset.json'), JSON.stringify( { - source: path.relative(nestedRoot, path.join(tempRoot, "rules-source")), - output: "AGENTS.md" + source: path.relative(nestedRoot, path.join(tempRoot, 'rules-source')), + output: 'AGENTS.md', }, null, - 2 - ) + 2, + ), ); assert.throws( - () => runCli(["--root", tempRoot], { cwd: repoRoot }), - /Missing ruleset file: .*agent-ruleset\.json/u + () => runCli(['--root', tempRoot], { cwd: repoRoot }), + /Missing ruleset file: .*agent-ruleset\.json/u, ); } finally { fs.rmSync(tempRoot, { recursive: true, force: true }); } }); -test("supports global=false to skip global rules", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('supports global=false to skip global rules', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const projectRoot = path.join(tempRoot, "project"); - const sourceRoot = path.join(tempRoot, "rules-source"); - const rulesRoot = path.join(sourceRoot, "rules"); + const projectRoot = path.join(tempRoot, 'project'); + const sourceRoot = path.join(tempRoot, 'rules-source'); + const rulesRoot = path.join(sourceRoot, 'rules'); writeFile( - path.join(projectRoot, "agent-ruleset.json"), + path.join(projectRoot, 'agent-ruleset.json'), JSON.stringify( { source: path.relative(projectRoot, sourceRoot), global: false, - domains: ["node"], - output: "AGENTS.md" + domains: ['node'], + output: 'AGENTS.md', }, null, - 2 - ) + 2, + ), ); - writeFile(path.join(rulesRoot, "global", "only.md"), "# Only Global\n1"); - writeFile(path.join(rulesRoot, "domains", "node", "domain.md"), "# Domain\nD"); + writeFile(path.join(rulesRoot, 'global', 'only.md'), '# Only Global\n1'); + writeFile(path.join(rulesRoot, 'domains', 'node', 'domain.md'), '# Domain\nD'); - runCli(["--root", projectRoot], { cwd: repoRoot }); + runCli(['--root', projectRoot], { cwd: repoRoot }); - const output = fs.readFileSync(path.join(projectRoot, "AGENTS.md"), "utf8"); + const output = fs.readFileSync(path.join(projectRoot, 'AGENTS.md'), 'utf8'); assert.equal( output, - withToolRules(formatRuleBlock(path.join(rulesRoot, "domains", "node", "domain.md"), "# Domain\nD", projectRoot) + "\n") + withToolRules( + formatRuleBlock( + path.join(rulesRoot, 'domains', 'node', 'domain.md'), + '# Domain\nD', + projectRoot, + ) + '\n', + ), ); } finally { fs.rmSync(tempRoot, { recursive: true, force: true }); } }); -test("supports source path pointing to a rules directory", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('supports source path pointing to a rules directory', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const projectRoot = path.join(tempRoot, "project"); - const rulesRoot = path.join(tempRoot, "rules-root", "rules"); + const projectRoot = path.join(tempRoot, 'project'); + const rulesRoot = path.join(tempRoot, 'rules-root', 'rules'); const rulesRootRelative = path.relative(projectRoot, rulesRoot); writeFile( - path.join(projectRoot, "agent-ruleset.json"), + path.join(projectRoot, 'agent-ruleset.json'), JSON.stringify( { - output: "AGENTS.md", + output: 'AGENTS.md', source: rulesRootRelative, - global: true + global: true, }, null, - 2 - ) + 2, + ), ); - writeFile(path.join(rulesRoot, "global", "only.md"), "# Ruleset Root\nruleset"); + writeFile(path.join(rulesRoot, 'global', 'only.md'), '# Ruleset Root\nruleset'); - runCli(["--root", projectRoot], { cwd: repoRoot }); + runCli(['--root', projectRoot], { cwd: repoRoot }); - const output = fs.readFileSync(path.join(projectRoot, "AGENTS.md"), "utf8"); + const output = fs.readFileSync(path.join(projectRoot, 'AGENTS.md'), 'utf8'); assert.equal( output, - withToolRules(formatRuleBlock(path.join(rulesRoot, "global", "only.md"), "# Ruleset Root\nruleset", projectRoot) + "\n") + withToolRules( + formatRuleBlock( + path.join(rulesRoot, 'global', 'only.md'), + '# Ruleset Root\nruleset', + projectRoot, + ) + '\n', + ), ); } finally { fs.rmSync(tempRoot, { recursive: true, force: true }); } }); -test("accepts rulesets with comments", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('accepts rulesets with comments', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const projectRoot = path.join(tempRoot, "project"); - const sourceRoot = path.join(tempRoot, "rules-source"); - const rulesRoot = path.join(sourceRoot, "rules"); - const sourceRelative = path.relative(projectRoot, sourceRoot).replace(/\\/g, "/"); + const projectRoot = path.join(tempRoot, 'project'); + const sourceRoot = path.join(tempRoot, 'rules-source'); + const rulesRoot = path.join(sourceRoot, 'rules'); + const sourceRelative = path.relative(projectRoot, sourceRoot).replace(/\\/g, '/'); writeFile( - path.join(projectRoot, "agent-ruleset.json"), + path.join(projectRoot, 'agent-ruleset.json'), `{ // rules source "source": "${sourceRelative}", "output": "AGENTS.md" } -` +`, ); - writeFile(path.join(rulesRoot, "global", "only.md"), "# Only\n1"); + writeFile(path.join(rulesRoot, 'global', 'only.md'), '# Only\n1'); - runCli(["--root", projectRoot], { cwd: repoRoot }); + runCli(['--root', projectRoot], { cwd: repoRoot }); - const output = fs.readFileSync(path.join(projectRoot, "AGENTS.md"), "utf8"); + const output = fs.readFileSync(path.join(projectRoot, 'AGENTS.md'), 'utf8'); assert.equal( output, - withToolRules(formatRuleBlock(path.join(rulesRoot, "global", "only.md"), "# Only\n1", projectRoot) + "\n") + withToolRules( + formatRuleBlock(path.join(rulesRoot, 'global', 'only.md'), '# Only\n1', projectRoot) + '\n', + ), ); } finally { fs.rmSync(tempRoot, { recursive: true, force: true }); } }); -test("rejects invalid ruleset shapes with a clear error", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('rejects invalid ruleset shapes with a clear error', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const projectRoot = path.join(tempRoot, "project"); + const projectRoot = path.join(tempRoot, 'project'); writeFile( - path.join(projectRoot, "agent-ruleset.json"), + path.join(projectRoot, 'agent-ruleset.json'), JSON.stringify( { - source: "", - output: "", - domains: ["node", ""], - extra: ["valid.md", ""] + source: '', + output: '', + domains: ['node', ''], + extra: ['valid.md', ''], }, null, - 2 - ) + 2, + ), ); assert.throws( - () => runCli(["--root", projectRoot], { cwd: repoRoot }), - /Invalid ruleset schema .*source|Invalid ruleset schema .*\/output/u + () => runCli(['--root', projectRoot], { cwd: repoRoot }), + /Invalid ruleset schema .*source|Invalid ruleset schema .*\/output/u, ); } finally { fs.rmSync(tempRoot, { recursive: true, force: true }); } }); -test("clears cached rules with --clear-cache", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('clears cached rules with --clear-cache', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const fakeHome = path.join(tempRoot, "home"); - const cacheRoot = path.join(fakeHome, ".agentsmd", "cache", "owner", "repo", "ref"); + const fakeHome = path.join(tempRoot, 'home'); + const cacheRoot = path.join(fakeHome, '.agentsmd', 'cache', 'owner', 'repo', 'ref'); fs.mkdirSync(cacheRoot, { recursive: true }); - fs.writeFileSync(path.join(cacheRoot, "marker.txt"), "cache", "utf8"); + fs.writeFileSync(path.join(cacheRoot, 'marker.txt'), 'cache', 'utf8'); - const stdout = runCli(["--clear-cache"], { + const stdout = runCli(['--clear-cache'], { cwd: repoRoot, - env: { USERPROFILE: fakeHome, HOME: fakeHome } + env: { USERPROFILE: fakeHome, HOME: fakeHome }, }); assert.match(stdout, /Cache cleared\./u); - assert.equal(fs.existsSync(path.join(fakeHome, ".agentsmd", "cache")), false); + assert.equal(fs.existsSync(path.join(fakeHome, '.agentsmd', 'cache')), false); } finally { fs.rmSync(tempRoot, { recursive: true, force: true }); } }); -test("edit-rules uses local source path as workspace", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('edit-rules uses local source path as workspace', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const projectRoot = path.join(tempRoot, "project"); - const sourceRoot = path.join(tempRoot, "rules-source"); + const projectRoot = path.join(tempRoot, 'project'); + const sourceRoot = path.join(tempRoot, 'rules-source'); writeFile( - path.join(projectRoot, "agent-ruleset.json"), + path.join(projectRoot, 'agent-ruleset.json'), JSON.stringify( { source: path.relative(projectRoot, sourceRoot), - output: "AGENTS.md" + output: 'AGENTS.md', }, null, - 2 - ) + 2, + ), ); - fs.mkdirSync(path.join(sourceRoot, "rules", "global"), { recursive: true }); + fs.mkdirSync(path.join(sourceRoot, 'rules', 'global'), { recursive: true }); - const stdout = runCli(["edit-rules", "--root", projectRoot], { cwd: repoRoot }); - assert.match(stdout, new RegExp(`Rules workspace: ${sourceRoot.replace(/\\/g, "\\\\")}`, "u")); - assert.match(stdout, new RegExp(`Rules directory: ${path.join(sourceRoot, "rules").replace(/\\/g, "\\\\")}`, "u")); + const stdout = runCli(['edit-rules', '--root', projectRoot], { cwd: repoRoot }); + assert.match(stdout, new RegExp(`Rules workspace: ${sourceRoot.replace(/\\/g, '\\\\')}`, 'u')); + assert.match( + stdout, + new RegExp(`Rules directory: ${path.join(sourceRoot, 'rules').replace(/\\/g, '\\\\')}`, 'u'), + ); assert.match(stdout, /Next steps:/u); assert.match(stdout, /compose-agentsmd apply-rules/u); } finally { @@ -425,31 +448,31 @@ test("edit-rules uses local source path as workspace", () => { } }); -test("edit-rules keeps rules directory when source points directly to rules", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('edit-rules keeps rules directory when source points directly to rules', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const projectRoot = path.join(tempRoot, "project"); - const sourceRoot = path.join(tempRoot, "rules-source"); - const rulesRoot = path.join(sourceRoot, "rules"); + const projectRoot = path.join(tempRoot, 'project'); + const sourceRoot = path.join(tempRoot, 'rules-source'); + const rulesRoot = path.join(sourceRoot, 'rules'); writeFile( - path.join(projectRoot, "agent-ruleset.json"), + path.join(projectRoot, 'agent-ruleset.json'), JSON.stringify( { source: path.relative(projectRoot, rulesRoot), - output: "AGENTS.md" + output: 'AGENTS.md', }, null, - 2 - ) + 2, + ), ); - fs.mkdirSync(path.join(rulesRoot, "global"), { recursive: true }); + fs.mkdirSync(path.join(rulesRoot, 'global'), { recursive: true }); - const stdout = runCli(["edit-rules", "--root", projectRoot], { cwd: repoRoot }); - assert.match(stdout, new RegExp(`Rules workspace: ${sourceRoot.replace(/\\/g, "\\\\")}`, "u")); - assert.match(stdout, new RegExp(`Rules directory: ${rulesRoot.replace(/\\/g, "\\\\")}`, "u")); + const stdout = runCli(['edit-rules', '--root', projectRoot], { cwd: repoRoot }); + assert.match(stdout, new RegExp(`Rules workspace: ${sourceRoot.replace(/\\/g, '\\\\')}`, 'u')); + assert.match(stdout, new RegExp(`Rules directory: ${rulesRoot.replace(/\\/g, '\\\\')}`, 'u')); assert.match(stdout, /Next steps:/u); assert.match(stdout, /compose-agentsmd apply-rules/u); } finally { @@ -457,223 +480,229 @@ test("edit-rules keeps rules directory when source points directly to rules", () } }); -test("apply-rules composes with refresh for local source", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('apply-rules composes with refresh for local source', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const projectRoot = path.join(tempRoot, "project"); - const sourceRoot = path.join(tempRoot, "rules-source"); - const rulesRoot = path.join(sourceRoot, "rules"); + const projectRoot = path.join(tempRoot, 'project'); + const sourceRoot = path.join(tempRoot, 'rules-source'); + const rulesRoot = path.join(sourceRoot, 'rules'); writeFile( - path.join(projectRoot, "agent-ruleset.json"), + path.join(projectRoot, 'agent-ruleset.json'), JSON.stringify( { source: path.relative(projectRoot, sourceRoot), - output: "AGENTS.md" + output: 'AGENTS.md', }, null, - 2 - ) + 2, + ), ); - writeFile(path.join(rulesRoot, "global", "only.md"), "# Only\n1"); + writeFile(path.join(rulesRoot, 'global', 'only.md'), '# Only\n1'); - runCli(["apply-rules", "--root", projectRoot], { cwd: repoRoot }); + runCli(['apply-rules', '--root', projectRoot], { cwd: repoRoot }); - const output = fs.readFileSync(path.join(projectRoot, "AGENTS.md"), "utf8"); + const output = fs.readFileSync(path.join(projectRoot, 'AGENTS.md'), 'utf8'); assert.equal( output, - withToolRules(formatRuleBlock(path.join(rulesRoot, "global", "only.md"), "# Only\n1", projectRoot) + "\n") + withToolRules( + formatRuleBlock(path.join(rulesRoot, 'global', 'only.md'), '# Only\n1', projectRoot) + '\n', + ), ); } finally { fs.rmSync(tempRoot, { recursive: true, force: true }); } }); -test("apply-rules supports --json output", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('apply-rules supports --json output', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const projectRoot = path.join(tempRoot, "project"); - const sourceRoot = path.join(tempRoot, "rules-source"); - const rulesRoot = path.join(sourceRoot, "rules"); + const projectRoot = path.join(tempRoot, 'project'); + const sourceRoot = path.join(tempRoot, 'rules-source'); + const rulesRoot = path.join(sourceRoot, 'rules'); writeFile( - path.join(projectRoot, "agent-ruleset.json"), + path.join(projectRoot, 'agent-ruleset.json'), JSON.stringify( { source: path.relative(projectRoot, sourceRoot), - output: "AGENTS.md" + output: 'AGENTS.md', }, null, - 2 - ) + 2, + ), ); - writeFile(path.join(rulesRoot, "global", "only.md"), "# Only\n1"); + writeFile(path.join(rulesRoot, 'global', 'only.md'), '# Only\n1'); - const stdout = runCli(["apply-rules", "--json", "--root", projectRoot], { cwd: repoRoot }); + const stdout = runCli(['apply-rules', '--json', '--root', projectRoot], { cwd: repoRoot }); const result = JSON.parse(stdout); - assert.deepEqual(result, { composed: ["AGENTS.md"], dryRun: false }); + assert.deepEqual(result, { composed: ['AGENTS.md'], dryRun: false }); - const output = fs.readFileSync(path.join(projectRoot, "AGENTS.md"), "utf8"); + const output = fs.readFileSync(path.join(projectRoot, 'AGENTS.md'), 'utf8'); assert.equal( output, - withToolRules(formatRuleBlock(path.join(rulesRoot, "global", "only.md"), "# Only\n1", projectRoot) + "\n") + withToolRules( + formatRuleBlock(path.join(rulesRoot, 'global', 'only.md'), '# Only\n1', projectRoot) + '\n', + ), ); } finally { fs.rmSync(tempRoot, { recursive: true, force: true }); } }); -test("apply-rules respects --dry-run with --json", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('apply-rules respects --dry-run with --json', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const projectRoot = path.join(tempRoot, "project"); - const sourceRoot = path.join(tempRoot, "rules-source"); - const rulesRoot = path.join(sourceRoot, "rules"); + const projectRoot = path.join(tempRoot, 'project'); + const sourceRoot = path.join(tempRoot, 'rules-source'); + const rulesRoot = path.join(sourceRoot, 'rules'); writeFile( - path.join(projectRoot, "agent-ruleset.json"), + path.join(projectRoot, 'agent-ruleset.json'), JSON.stringify( { source: path.relative(projectRoot, sourceRoot), - output: "AGENTS.md" + output: 'AGENTS.md', }, null, - 2 - ) + 2, + ), ); - writeFile(path.join(rulesRoot, "global", "only.md"), "# Only\n1"); + writeFile(path.join(rulesRoot, 'global', 'only.md'), '# Only\n1'); - const stdout = runCli(["apply-rules", "--dry-run", "--json", "--root", projectRoot], { cwd: repoRoot }); + const stdout = runCli(['apply-rules', '--dry-run', '--json', '--root', projectRoot], { + cwd: repoRoot, + }); assert.doesNotMatch(stdout, /Composed AGENTS\.md:/u); const result = JSON.parse(stdout); - assert.deepEqual(result, { composed: ["AGENTS.md"], dryRun: true }); - assert.equal(fs.existsSync(path.join(projectRoot, "AGENTS.md")), false); + assert.deepEqual(result, { composed: ['AGENTS.md'], dryRun: true }); + assert.equal(fs.existsSync(path.join(projectRoot, 'AGENTS.md')), false); } finally { fs.rmSync(tempRoot, { recursive: true, force: true }); } }); -test("init creates a default ruleset with comments", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('init creates a default ruleset with comments', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const projectRoot = path.join(tempRoot, "project"); + const projectRoot = path.join(tempRoot, 'project'); - const stdout = runCli(["init", "--yes", "--root", projectRoot], { cwd: repoRoot }); + const stdout = runCli(['init', '--yes', '--root', projectRoot], { cwd: repoRoot }); assert.match(stdout, /Initialized ruleset:/u); - const rulesetPath = path.join(projectRoot, "agent-ruleset.json"); - const rulesetRaw = fs.readFileSync(rulesetPath, "utf8"); + const rulesetPath = path.join(projectRoot, 'agent-ruleset.json'); + const rulesetRaw = fs.readFileSync(rulesetPath, 'utf8'); assert.match(rulesetRaw, /\/\/ Rules source/u); assert.equal(/"global"\s*:/u.test(rulesetRaw), false); const ruleset = JSON.parse(stripJsonComments(rulesetRaw)); assert.deepEqual(ruleset, { - source: "github:owner/repo@latest", + source: 'github:owner/repo@latest', domains: [], extra: [], - output: "AGENTS.md" + output: 'AGENTS.md', }); - const localRulesPath = path.join(projectRoot, "agent-rules-local", "custom.md"); + const localRulesPath = path.join(projectRoot, 'agent-rules-local', 'custom.md'); assert.equal(fs.existsSync(localRulesPath), false); } finally { fs.rmSync(tempRoot, { recursive: true, force: true }); } }); -test("supports --quiet and -q to suppress output", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('supports --quiet and -q to suppress output', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const projectRoot = path.join(tempRoot, "project"); - const sourceRoot = path.join(tempRoot, "rules-source"); - const rulesRoot = path.join(sourceRoot, "rules"); + const projectRoot = path.join(tempRoot, 'project'); + const sourceRoot = path.join(tempRoot, 'rules-source'); + const rulesRoot = path.join(sourceRoot, 'rules'); writeFile( - path.join(projectRoot, "agent-ruleset.json"), - JSON.stringify({ source: path.relative(projectRoot, sourceRoot) }, null, 2) + path.join(projectRoot, 'agent-ruleset.json'), + JSON.stringify({ source: path.relative(projectRoot, sourceRoot) }, null, 2), ); - writeFile(path.join(rulesRoot, "global", "only.md"), "# Only\n1"); + writeFile(path.join(rulesRoot, 'global', 'only.md'), '# Only\n1'); - const stdoutLong = runCli(["--quiet", "--root", projectRoot], { cwd: repoRoot }); - assert.equal(stdoutLong, ""); + const stdoutLong = runCli(['--quiet', '--root', projectRoot], { cwd: repoRoot }); + assert.equal(stdoutLong, ''); - const stdoutShort = runCli(["-q", "--root", projectRoot], { cwd: repoRoot }); - assert.equal(stdoutShort, ""); + const stdoutShort = runCli(['-q', '--root', projectRoot], { cwd: repoRoot }); + assert.equal(stdoutShort, ''); } finally { fs.rmSync(tempRoot, { recursive: true, force: true }); } }); -test("supports --json for machine-readable output", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('supports --json for machine-readable output', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const projectRoot = path.join(tempRoot, "project"); - const sourceRoot = path.join(tempRoot, "rules-source"); - const rulesRoot = path.join(sourceRoot, "rules"); + const projectRoot = path.join(tempRoot, 'project'); + const sourceRoot = path.join(tempRoot, 'rules-source'); + const rulesRoot = path.join(sourceRoot, 'rules'); writeFile( - path.join(projectRoot, "agent-ruleset.json"), - JSON.stringify({ source: path.relative(projectRoot, sourceRoot) }, null, 2) + path.join(projectRoot, 'agent-ruleset.json'), + JSON.stringify({ source: path.relative(projectRoot, sourceRoot) }, null, 2), ); - writeFile(path.join(rulesRoot, "global", "only.md"), "# Only\n1"); + writeFile(path.join(rulesRoot, 'global', 'only.md'), '# Only\n1'); - const stdout = runCli(["--json", "--root", projectRoot], { cwd: repoRoot }); + const stdout = runCli(['--json', '--root', projectRoot], { cwd: repoRoot }); const result = JSON.parse(stdout); - assert.deepEqual(result, { composed: ["AGENTS.md"], dryRun: false }); + assert.deepEqual(result, { composed: ['AGENTS.md'], dryRun: false }); } finally { fs.rmSync(tempRoot, { recursive: true, force: true }); } }); -test("supports --dry-run for compose", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('supports --dry-run for compose', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const projectRoot = path.join(tempRoot, "project"); - const sourceRoot = path.join(tempRoot, "rules-source"); - const rulesRoot = path.join(sourceRoot, "rules"); + const projectRoot = path.join(tempRoot, 'project'); + const sourceRoot = path.join(tempRoot, 'rules-source'); + const rulesRoot = path.join(sourceRoot, 'rules'); writeFile( - path.join(projectRoot, "agent-ruleset.json"), - JSON.stringify({ source: path.relative(projectRoot, sourceRoot) }, null, 2) + path.join(projectRoot, 'agent-ruleset.json'), + JSON.stringify({ source: path.relative(projectRoot, sourceRoot) }, null, 2), ); - writeFile(path.join(rulesRoot, "global", "only.md"), "# Only\n1"); + writeFile(path.join(rulesRoot, 'global', 'only.md'), '# Only\n1'); - const stdout = runCli(["--dry-run", "--root", projectRoot], { cwd: repoRoot }); + const stdout = runCli(['--dry-run', '--root', projectRoot], { cwd: repoRoot }); assert.match(stdout, /Composed AGENTS\.md:/u); - assert.equal(fs.existsSync(path.join(projectRoot, "AGENTS.md")), false); + assert.equal(fs.existsSync(path.join(projectRoot, 'AGENTS.md')), false); } finally { fs.rmSync(tempRoot, { recursive: true, force: true }); } }); -test("prints an AGENTS.md diff when output changes (no git required)", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('prints an AGENTS.md diff when output changes (no git required)', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const projectRoot = path.join(tempRoot, "project"); - const sourceRoot = path.join(tempRoot, "rules-source"); - const rulesRoot = path.join(sourceRoot, "rules"); + const projectRoot = path.join(tempRoot, 'project'); + const sourceRoot = path.join(tempRoot, 'rules-source'); + const rulesRoot = path.join(sourceRoot, 'rules'); writeFile( - path.join(projectRoot, "agent-ruleset.json"), - JSON.stringify({ source: path.relative(projectRoot, sourceRoot) }, null, 2) + path.join(projectRoot, 'agent-ruleset.json'), + JSON.stringify({ source: path.relative(projectRoot, sourceRoot) }, null, 2), ); - writeFile(path.join(rulesRoot, "global", "only.md"), "# Only\n1"); + writeFile(path.join(rulesRoot, 'global', 'only.md'), '# Only\n1'); - writeFile(path.join(projectRoot, "AGENTS.md"), "old\n"); + writeFile(path.join(projectRoot, 'AGENTS.md'), 'old\n'); - const stdout = runCli(["--root", projectRoot], { cwd: repoRoot }); + const stdout = runCli(['--root', projectRoot], { cwd: repoRoot }); assert.match(stdout, /Composed AGENTS\.md:/u); assert.match(stdout, /AGENTS\.md updated/u); assert.match(stdout, /--- BEGIN DIFF ---/u); @@ -685,22 +714,22 @@ test("prints an AGENTS.md diff when output changes (no git required)", () => { } }); -test("prints no diff when AGENTS.md is unchanged", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('prints no diff when AGENTS.md is unchanged', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const projectRoot = path.join(tempRoot, "project"); - const sourceRoot = path.join(tempRoot, "rules-source"); - const rulesRoot = path.join(sourceRoot, "rules"); + const projectRoot = path.join(tempRoot, 'project'); + const sourceRoot = path.join(tempRoot, 'rules-source'); + const rulesRoot = path.join(sourceRoot, 'rules'); writeFile( - path.join(projectRoot, "agent-ruleset.json"), - JSON.stringify({ source: path.relative(projectRoot, sourceRoot) }, null, 2) + path.join(projectRoot, 'agent-ruleset.json'), + JSON.stringify({ source: path.relative(projectRoot, sourceRoot) }, null, 2), ); - writeFile(path.join(rulesRoot, "global", "only.md"), "# Only\n1"); + writeFile(path.join(rulesRoot, 'global', 'only.md'), '# Only\n1'); - runCli(["--root", projectRoot], { cwd: repoRoot }); - const stdout = runCli(["--root", projectRoot], { cwd: repoRoot }); + runCli(['--root', projectRoot], { cwd: repoRoot }); + const stdout = runCli(['--root', projectRoot], { cwd: repoRoot }); assert.match(stdout, /Composed AGENTS\.md:/u); assert.match(stdout, /AGENTS\.md unchanged/u); @@ -710,59 +739,66 @@ test("prints no diff when AGENTS.md is unchanged", () => { } }); -test("init --dry-run does not write files", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('init --dry-run does not write files', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const projectRoot = path.join(tempRoot, "project"); + const projectRoot = path.join(tempRoot, 'project'); - const stdout = runCli(["init", "--dry-run", "--root", projectRoot], { cwd: repoRoot }); + const stdout = runCli(['init', '--dry-run', '--root', projectRoot], { cwd: repoRoot }); assert.match(stdout, /Dry run/u); - assert.equal(fs.existsSync(path.join(projectRoot, "agent-ruleset.json")), false); + assert.equal(fs.existsSync(path.join(projectRoot, 'agent-ruleset.json')), false); } finally { fs.rmSync(tempRoot, { recursive: true, force: true }); } }); -test("init refuses to overwrite an existing ruleset without --force", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('init refuses to overwrite an existing ruleset without --force', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const projectRoot = path.join(tempRoot, "project"); - writeFile(path.join(projectRoot, "agent-ruleset.json"), JSON.stringify({ source: "local" }, null, 2)); + const projectRoot = path.join(tempRoot, 'project'); + writeFile( + path.join(projectRoot, 'agent-ruleset.json'), + JSON.stringify({ source: 'local' }, null, 2), + ); assert.throws( - () => runCli(["init", "--yes", "--root", projectRoot], { cwd: repoRoot }), - /Ruleset already exists/u + () => runCli(['init', '--yes', '--root', projectRoot], { cwd: repoRoot }), + /Ruleset already exists/u, ); } finally { fs.rmSync(tempRoot, { recursive: true, force: true }); } }); -test("init respects --quiet and --json", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('init respects --quiet and --json', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const projectRoot = path.join(tempRoot, "project"); + const projectRoot = path.join(tempRoot, 'project'); // Case 1: --quiet suppresses standard output - const stdoutQuiet = runCli(["init", "--yes", "--quiet", "--root", projectRoot], { cwd: repoRoot }); - assert.equal(stdoutQuiet, ""); - assert.equal(fs.existsSync(path.join(projectRoot, "agent-ruleset.json")), true); + const stdoutQuiet = runCli(['init', '--yes', '--quiet', '--root', projectRoot], { + cwd: repoRoot, + }); + assert.equal(stdoutQuiet, ''); + assert.equal(fs.existsSync(path.join(projectRoot, 'agent-ruleset.json')), true); // Clean up for next case fs.rmSync(projectRoot, { recursive: true, force: true }); // Case 2: --json outputs JSON and suppresses standard output - const stdoutJson = runCli(["init", "--yes", "--json", "--root", projectRoot], { cwd: repoRoot }); + const stdoutJson = runCli(['init', '--yes', '--json', '--root', projectRoot], { + cwd: repoRoot, + }); const result = JSON.parse(stdoutJson); assert.equal(result.dryRun, false); - assert.deepEqual(result.initialized, ["agent-ruleset.json"]); + assert.deepEqual(result.initialized, ['agent-ruleset.json']); assert.deepEqual(result.localRules, []); assert.deepEqual(result.composed, []); - assert.equal(fs.existsSync(path.join(projectRoot, "agent-ruleset.json")), true); + assert.equal(fs.existsSync(path.join(projectRoot, 'agent-ruleset.json')), true); // Check that there is no other output mixed with JSON assert.doesNotMatch(stdoutJson, /Initialized ruleset:/u); @@ -771,57 +807,61 @@ test("init respects --quiet and --json", () => { fs.rmSync(projectRoot, { recursive: true, force: true }); // Case 3: --json takes precedence over --quiet - const stdoutJsonQuiet = runCli(["init", "--yes", "--quiet", "--json", "--root", projectRoot], { cwd: repoRoot }); + const stdoutJsonQuiet = runCli(['init', '--yes', '--quiet', '--json', '--root', projectRoot], { + cwd: repoRoot, + }); const resultJsonQuiet = JSON.parse(stdoutJsonQuiet); assert.equal(resultJsonQuiet.dryRun, false); - assert.deepEqual(resultJsonQuiet.initialized, ["agent-ruleset.json"]); + assert.deepEqual(resultJsonQuiet.initialized, ['agent-ruleset.json']); assert.deepEqual(resultJsonQuiet.localRules, []); assert.deepEqual(resultJsonQuiet.composed, []); - assert.equal(fs.existsSync(path.join(projectRoot, "agent-ruleset.json")), true); + assert.equal(fs.existsSync(path.join(projectRoot, 'agent-ruleset.json')), true); assert.doesNotMatch(stdoutJsonQuiet, /Initialized ruleset:/u); } finally { fs.rmSync(tempRoot, { recursive: true, force: true }); } }); -test("compose respects --dry-run with --json", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('compose respects --dry-run with --json', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const projectRoot = path.join(tempRoot, "project"); - const sourceRoot = path.join(tempRoot, "rules-source"); + const projectRoot = path.join(tempRoot, 'project'); + const sourceRoot = path.join(tempRoot, 'rules-source'); writeFile( - path.join(projectRoot, "agent-ruleset.json"), - JSON.stringify({ source: path.relative(projectRoot, sourceRoot) }, null, 2) + path.join(projectRoot, 'agent-ruleset.json'), + JSON.stringify({ source: path.relative(projectRoot, sourceRoot) }, null, 2), ); - fs.mkdirSync(path.join(sourceRoot, "rules", "global"), { recursive: true }); + fs.mkdirSync(path.join(sourceRoot, 'rules', 'global'), { recursive: true }); - const stdout = runCli(["--dry-run", "--json", "--root", projectRoot], { cwd: repoRoot }); + const stdout = runCli(['--dry-run', '--json', '--root', projectRoot], { cwd: repoRoot }); const result = JSON.parse(stdout); assert.equal(result.dryRun, true); - assert.deepEqual(result.composed, ["AGENTS.md"]); - assert.equal(fs.existsSync(path.join(projectRoot, "AGENTS.md")), false); + assert.deepEqual(result.composed, ['AGENTS.md']); + assert.equal(fs.existsSync(path.join(projectRoot, 'AGENTS.md')), false); } finally { fs.rmSync(tempRoot, { recursive: true, force: true }); } }); -test("init --dry-run with --json outputs plan", () => { - const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "compose-agentsmd-")); +test('init --dry-run with --json outputs plan', () => { + const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'compose-agentsmd-')); try { - const projectRoot = path.join(tempRoot, "project"); + const projectRoot = path.join(tempRoot, 'project'); - const stdout = runCli(["init", "--dry-run", "--json", "--root", projectRoot], { cwd: repoRoot }); + const stdout = runCli(['init', '--dry-run', '--json', '--root', projectRoot], { + cwd: repoRoot, + }); const result = JSON.parse(stdout); assert.equal(result.dryRun, true); assert.equal(Array.isArray(result.plan), true); - assert.deepEqual(result.plan, [{ action: "create", path: "agent-ruleset.json" }]); - assert.equal(fs.existsSync(path.join(projectRoot, "agent-ruleset.json")), false); + assert.deepEqual(result.plan, [{ action: 'create', path: 'agent-ruleset.json' }]); + assert.equal(fs.existsSync(path.join(projectRoot, 'agent-ruleset.json')), false); } finally { fs.rmSync(tempRoot, { recursive: true, force: true }); } diff --git a/tools/compose-agents.js b/tools/compose-agents.js index 35b1bfd..a8073f6 100644 --- a/tools/compose-agents.js +++ b/tools/compose-agents.js @@ -1,2 +1,2 @@ #!/usr/bin/env node -import "../dist/compose-agents.js"; +import '../dist/compose-agents.js'; diff --git a/tools/tool-rules.md b/tools/tool-rules.md index 205af9b..ae46ff2 100644 --- a/tools/tool-rules.md +++ b/tools/tool-rules.md @@ -1,4 +1,5 @@ # Tool Rules (compose-agentsmd) + - Before starting any work, run `compose-agentsmd` from the project root. - `compose-agentsmd` intentionally regenerates `AGENTS.md`; any resulting `AGENTS.md` diff is expected and must not be treated as an unexpected external change. - If `compose-agentsmd` is not available, install it via npm: `npm install -g compose-agentsmd`.