diff --git a/.archgate/adrs/ARCH-005-testing-standards.rules.ts b/.archgate/adrs/ARCH-005-testing-standards.rules.ts index 278b4a38..9c0f29b9 100644 --- a/.archgate/adrs/ARCH-005-testing-standards.rules.ts +++ b/.archgate/adrs/ARCH-005-testing-standards.rules.ts @@ -1,6 +1,7 @@ -import { defineRules } from "../../src/formats/rules"; import { basename, dirname } from "node:path"; +import { defineRules } from "../../src/formats/rules"; + export default defineRules({ "test-mirrors-src": { description: "Test directory structure should mirror src/ structure", diff --git a/.archgate/adrs/ARCH-006-dependency-policy.md b/.archgate/adrs/ARCH-006-dependency-policy.md index bf5538d9..eaa28d9b 100644 --- a/.archgate/adrs/ARCH-006-dependency-policy.md +++ b/.archgate/adrs/ARCH-006-dependency-policy.md @@ -38,7 +38,7 @@ Keep production dependencies minimal. Prefer Bun built-ins over external package 2. Review of the package's dependency tree size, maintenance status, and download count 3. Approval by the project maintainer -Development dependencies (`devDependencies`) are less restricted but should still be minimal: linting (oxlint), formatting (prettier), commit conventions (commitlint), and type declarations only. +Development dependencies (`devDependencies`) are less restricted but should still be minimal: linting (oxlint), formatting (oxfmt), commit conventions (commitlint), and type declarations only. ## Do's and Don'ts diff --git a/.archgate/lint/README.md b/.archgate/lint/README.md index 9c7e1d65..62e8c682 100644 --- a/.archgate/lint/README.md +++ b/.archgate/lint/README.md @@ -16,9 +16,7 @@ Place linter plugin files here, named by tool: 2. Reference it in your oxlint config: ```json -{ - "plugins": [".archgate/lint/oxlint.js"] -} +{ "plugins": [".archgate/lint/oxlint.js"] } ``` ## Why here? diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 00000000..0392fba6 --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,35 @@ +{ + "permissions": { + "allow": [ + "Bash(oxfmt *)", + "Bash(oxlint *)", + "Bash(bun run *)", + "Bash(bun test *)", + "Bash(bun install *)", + "Bash(git *)", + "Bash(wc *)", + "Bash(ls *)", + "Bash(rm *)", + "Bash(proto *)", + "Read", + "Write", + "Edit", + "Glob", + "Grep" + ] + }, + "attribution": { "commit": "", "pr": "" }, + "hooks": { + "PostToolUse": [ + { + "matcher": "Write|Edit", + "hooks": [ + { + "type": "command", + "command": "jq -r '.tool_input.file_path' | xargs -I {} oxfmt --write {}" + } + ] + } + ] + } +} diff --git a/.commitlintrc.json b/.commitlintrc.json index c30e5a97..d3d7f0cd 100644 --- a/.commitlintrc.json +++ b/.commitlintrc.json @@ -1,3 +1 @@ -{ - "extends": ["@commitlint/config-conventional"] -} +{ "extends": ["@commitlint/config-conventional"] } diff --git a/.oxfmtrc.json b/.oxfmtrc.json new file mode 100644 index 00000000..750b4e33 --- /dev/null +++ b/.oxfmtrc.json @@ -0,0 +1,8 @@ +{ + "trailingComma": "es5", + "printWidth": 80, + "objectWrap": "collapse", + "sortImports": {}, + "sortPackageJson": { "sortScripts": true }, + "ignorePatterns": ["bun.lock", "CHANGELOG.md"] +} diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 274a744c..00000000 --- a/.prettierignore +++ /dev/null @@ -1,7 +0,0 @@ -node_modules/ -dist -coverage -bun.lock -CHANGELOG.md -packages/*/bin/ -docs/.astro diff --git a/.prettierrc.json b/.prettierrc.json deleted file mode 100644 index a1420793..00000000 --- a/.prettierrc.json +++ /dev/null @@ -1 +0,0 @@ -{ "trailingComma": "es5" } diff --git a/.simple-release.js b/.simple-release.js index 2aa2e355..23003237 100644 --- a/.simple-release.js +++ b/.simple-release.js @@ -1,4 +1,5 @@ import { readFileSync, writeFileSync } from "node:fs"; + import { NpmProject } from "@simple-release/npm"; class ArchgateProject extends NpmProject { diff --git a/.vscode/extensions.json b/.vscode/extensions.json index aa6f49a2..846d8c2c 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,6 +1,5 @@ { "recommendations": [ - "esbenp.prettier-vscode", "christian-kohler.npm-intellisense", "christian-kohler.path-intellisense", "redhat.vscode-yaml", diff --git a/.vscode/mcp.json b/.vscode/mcp.json deleted file mode 100644 index 55daa16c..00000000 --- a/.vscode/mcp.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "servers": { - "archgate": { - "command": "archgate", - "args": ["mcp"] - } - } -} diff --git a/.vscode/settings.json b/.vscode/settings.json index 74a6b611..f47b1277 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,52 +3,25 @@ "editor.tabSize": 2, "git.autofetch": true, "git.confirmSync": false, - "prettier.enable": true, - "prettier.configPath": ".prettierrc.json", - "prettier.useEditorConfig": false, - "editor.defaultFormatter": "esbenp.prettier-vscode", + "oxfmt.enable": true, + "oxfmt.configPath": ".oxfmtrc.json", + "editor.defaultFormatter": "oxc.oxc-vscode", "editor.formatOnSave": true, "typescript.enablePromptUseWorkspaceTsdk": true, "terminal.integrated.scrollback": 100000, - "[less]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[mdx]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[markdown]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[html]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[javascriptreact]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[javascript]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[yaml]": { - "editor.defaultFormatter": "redhat.vscode-yaml" - }, - "[json]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[typescriptreact]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[jsonc]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[typescript]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[xml]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, - "[css]": { - "editor.defaultFormatter": "esbenp.prettier-vscode" - }, + "[less]": { "editor.defaultFormatter": "oxc.oxc-vscode" }, + "[mdx]": { "editor.defaultFormatter": "oxc.oxc-vscode" }, + "[markdown]": { "editor.defaultFormatter": "oxc.oxc-vscode" }, + "[html]": { "editor.defaultFormatter": "oxc.oxc-vscode" }, + "[javascriptreact]": { "editor.defaultFormatter": "oxc.oxc-vscode" }, + "[javascript]": { "editor.defaultFormatter": "oxc.oxc-vscode" }, + "[yaml]": { "editor.defaultFormatter": "redhat.vscode-yaml" }, + "[json]": { "editor.defaultFormatter": "oxc.oxc-vscode" }, + "[typescriptreact]": { "editor.defaultFormatter": "oxc.oxc-vscode" }, + "[jsonc]": { "editor.defaultFormatter": "oxc.oxc-vscode" }, + "[typescript]": { "editor.defaultFormatter": "oxc.oxc-vscode" }, + "[xml]": { "editor.defaultFormatter": "oxc.oxc-vscode" }, + "[css]": { "editor.defaultFormatter": "oxc.oxc-vscode" }, "redhat.telemetry.enabled": false, "typescript.tsdk": "node_modules/typescript/lib", "typescript.tsserver.maxTsServerMemory": 16384, diff --git a/CLAUDE.md b/CLAUDE.md index 17da74b5..923b77cf 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -7,7 +7,7 @@ Archgate is a CLI tool for AI governance via Architecture Decision Records (ADRs - **Runtime:** Bun (>=1.2.21) — not Node.js compatible - **Language:** TypeScript (strict mode, ESNext, ES modules) - **CLI framework:** Commander.js (`@commander-js/extra-typings`) -- **Linter:** Oxlint | **Formatter:** Prettier | **Commits:** Conventional Commits +- **Linter:** Oxlint | **Formatter:** Oxfmt | **Commits:** Conventional Commits ## Commands @@ -15,8 +15,8 @@ Archgate is a CLI tool for AI governance via Architecture Decision Records (ADRs bun run src/cli.ts # run CLI locally bun run lint # oxlint bun run typecheck # tsc --build -bun run format # prettier --write -bun run format:check # prettier --check +bun run format # oxfmt --write +bun run format:check # oxfmt --check bun test # all tests bun run validate # MANDATORY: lint + typecheck + format + test + ADR check + build check bun run build # binaries → dist/ (darwin-arm64, linux-x64, win32-x64) diff --git a/bun.lock b/bun.lock index 78a8a584..acf67b0e 100644 --- a/bun.lock +++ b/bun.lock @@ -14,8 +14,8 @@ "conventional-changelog": "7.1.1", "conventional-changelog-angular": "8.0.0", "inquirer": "12.9.4", + "oxfmt": "0.41.0", "oxlint": "1.14.0", - "prettier": "3.6.2", "zod": "4.3.6", }, "optionalDependencies": { @@ -103,6 +103,44 @@ "@inquirer/type": ["@inquirer/type@3.0.8", "", { "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-lg9Whz8onIHRthWaN1Q9EGLa/0LFJjyM8mEUbL1eTi6yMGvBf8gvyDLtxSXztQsxMvhxxNpJYrwa1YHdq+w4Jw=="], + "@oxfmt/binding-android-arm-eabi": ["@oxfmt/binding-android-arm-eabi@0.41.0", "", { "os": "android", "cpu": "arm" }, "sha512-REfrqeMKGkfMP+m/ScX4f5jJBSmVNYcpoDF8vP8f8eYPDuPGZmzp56NIUsYmx3h7f6NzC6cE3gqh8GDWrJHCKw=="], + + "@oxfmt/binding-android-arm64": ["@oxfmt/binding-android-arm64@0.41.0", "", { "os": "android", "cpu": "arm64" }, "sha512-s0b1dxNgb2KomspFV2LfogC2XtSJB42POXF4bMCLJyvQmAGos4ZtjGPfQreToQEaY0FQFjz3030ggI36rF1q5g=="], + + "@oxfmt/binding-darwin-arm64": ["@oxfmt/binding-darwin-arm64@0.41.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-EGXGualADbv/ZmamE7/2DbsrYmjoPlAmHEpTL4vapLF4EfVD6fr8/uQDFnPJkUBjiSWFJZtFNsGeN1B6V3owmA=="], + + "@oxfmt/binding-darwin-x64": ["@oxfmt/binding-darwin-x64@0.41.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-WxySJEvdQQYMmyvISH3qDpTvoS0ebnIP63IMxLLWowJyPp/AAH0hdWtlo+iGNK5y3eVfa5jZguwNaQkDKWpGSw=="], + + "@oxfmt/binding-freebsd-x64": ["@oxfmt/binding-freebsd-x64@0.41.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-Y2kzMkv3U3oyuYaR4wTfGjOTYTXiFC/hXmG0yVASKkbh02BJkvD98Ij8bIevr45hNZ0DmZEgqiXF+9buD4yMYQ=="], + + "@oxfmt/binding-linux-arm-gnueabihf": ["@oxfmt/binding-linux-arm-gnueabihf@0.41.0", "", { "os": "linux", "cpu": "arm" }, "sha512-ptazDjdUyhket01IjPTT6ULS1KFuBfTUU97osTP96X5y/0oso+AgAaJzuH81oP0+XXyrWIHbRzozSAuQm4p48g=="], + + "@oxfmt/binding-linux-arm-musleabihf": ["@oxfmt/binding-linux-arm-musleabihf@0.41.0", "", { "os": "linux", "cpu": "arm" }, "sha512-UkoL2OKxFD+56bPEBcdGn+4juTW4HRv/T6w1dIDLnvKKWr6DbarB/mtHXlADKlFiJubJz8pRkttOR7qjYR6lTA=="], + + "@oxfmt/binding-linux-arm64-gnu": ["@oxfmt/binding-linux-arm64-gnu@0.41.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-gofu0PuumSOHYczD8p62CPY4UF6ee+rSLZJdUXkpwxg6pILiwSDBIouPskjF/5nF3A7QZTz2O9KFNkNxxFN9tA=="], + + "@oxfmt/binding-linux-arm64-musl": ["@oxfmt/binding-linux-arm64-musl@0.41.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-VfVZxL0+6RU86T8F8vKiDBa+iHsr8PAjQmKGBzSCAX70b6x+UOMFl+2dNihmKmUwqkCazCPfYjt6SuAPOeQJ3g=="], + + "@oxfmt/binding-linux-ppc64-gnu": ["@oxfmt/binding-linux-ppc64-gnu@0.41.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-bwzokz2eGvdfJbc0i+zXMJ4BBjQPqg13jyWpEEZDOrBCQ91r8KeY2Mi2kUeuMTZNFXju+jcAbAbpyJxRGla0eg=="], + + "@oxfmt/binding-linux-riscv64-gnu": ["@oxfmt/binding-linux-riscv64-gnu@0.41.0", "", { "os": "linux", "cpu": "none" }, "sha512-POLM//PCH9uqDeNDwWL3b3DkMmI3oI2cU6hwc2lnztD1o7dzrQs3R9nq555BZ6wI7t2lyhT9CS+CRaz5X0XqLA=="], + + "@oxfmt/binding-linux-riscv64-musl": ["@oxfmt/binding-linux-riscv64-musl@0.41.0", "", { "os": "linux", "cpu": "none" }, "sha512-NNK7PzhFqLUwx/G12Xtm6scGv7UITvyGdAR5Y+TlqsG+essnuRWR4jRNODWRjzLZod0T3SayRbnkSIWMBov33w=="], + + "@oxfmt/binding-linux-s390x-gnu": ["@oxfmt/binding-linux-s390x-gnu@0.41.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-qVf/zDC5cN9eKe4qI/O/m445er1IRl6swsSl7jHkqmOSVfknwCe5JXitYjZca+V/cNJSU/xPlC5EFMabMMFDpw=="], + + "@oxfmt/binding-linux-x64-gnu": ["@oxfmt/binding-linux-x64-gnu@0.41.0", "", { "os": "linux", "cpu": "x64" }, "sha512-ojxYWu7vUb6ysYqVCPHuAPVZHAI40gfZ0PDtZAMwVmh2f0V8ExpPIKoAKr7/8sNbAXJBBpZhs2coypIo2jJX4w=="], + + "@oxfmt/binding-linux-x64-musl": ["@oxfmt/binding-linux-x64-musl@0.41.0", "", { "os": "linux", "cpu": "x64" }, "sha512-O2exZLBxoCMIv2vlvcbkdedazJPTdG0VSup+0QUCfYQtx751zCZNboX2ZUOiQ/gDTdhtXvSiot0h6GEGkOyalA=="], + + "@oxfmt/binding-openharmony-arm64": ["@oxfmt/binding-openharmony-arm64@0.41.0", "", { "os": "none", "cpu": "arm64" }, "sha512-N+31/VoL+z+NNBt8viy3I4NaIdPbiYeOnB884LKqvXldaE2dRztdPv3q5ipfZYv0RwFp7JfqS4I27K/DSHCakg=="], + + "@oxfmt/binding-win32-arm64-msvc": ["@oxfmt/binding-win32-arm64-msvc@0.41.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-Z7NAtu/RN8kjCQ1y5oDD0nTAeRswh3GJ93qwcW51srmidP7XPBmZbLlwERu1W5veCevQJtPS9xmkpcDTYsGIwQ=="], + + "@oxfmt/binding-win32-ia32-msvc": ["@oxfmt/binding-win32-ia32-msvc@0.41.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-uNxxP3l4bJ6VyzIeRqCmBU2Q0SkCFgIhvx9/9dJ9V8t/v+jP1IBsuaLwCXGR8JPHtkj4tFp+RHtUmU2ZYAUpMA=="], + + "@oxfmt/binding-win32-x64-msvc": ["@oxfmt/binding-win32-x64-msvc@0.41.0", "", { "os": "win32", "cpu": "x64" }, "sha512-49ZSpbZ1noozyPapE8SUOSm3IN0Ze4b5nkO+4+7fq6oEYQQJFhE0saj5k/Gg4oewVPdjn0L3ZFeWk2Vehjcw7A=="], + "@oxlint/darwin-arm64": ["@oxlint/darwin-arm64@1.14.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-rcTw0QWeOc6IeVp+Up7WtcwdS9l4j7TOq4tihF0Ud/fl+VUVdvDCPuZ9QTnLXJhwMXiyQRWdxRyI6XBwf80ncQ=="], "@oxlint/darwin-x64": ["@oxlint/darwin-x64@1.14.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-TWFSEmyl2/DN4HoXNwQl0y/y3EXFJDctfv5MiDtVOV1GJKX80cGSIxMxXb08Q3CCWqteqEijmfSMo5TG8X1H/A=="], @@ -403,6 +441,8 @@ "os-tmpdir": ["os-tmpdir@1.0.2", "", {}, "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g=="], + "oxfmt": ["oxfmt@0.41.0", "", { "dependencies": { "tinypool": "2.1.0" }, "optionalDependencies": { "@oxfmt/binding-android-arm-eabi": "0.41.0", "@oxfmt/binding-android-arm64": "0.41.0", "@oxfmt/binding-darwin-arm64": "0.41.0", "@oxfmt/binding-darwin-x64": "0.41.0", "@oxfmt/binding-freebsd-x64": "0.41.0", "@oxfmt/binding-linux-arm-gnueabihf": "0.41.0", "@oxfmt/binding-linux-arm-musleabihf": "0.41.0", "@oxfmt/binding-linux-arm64-gnu": "0.41.0", "@oxfmt/binding-linux-arm64-musl": "0.41.0", "@oxfmt/binding-linux-ppc64-gnu": "0.41.0", "@oxfmt/binding-linux-riscv64-gnu": "0.41.0", "@oxfmt/binding-linux-riscv64-musl": "0.41.0", "@oxfmt/binding-linux-s390x-gnu": "0.41.0", "@oxfmt/binding-linux-x64-gnu": "0.41.0", "@oxfmt/binding-linux-x64-musl": "0.41.0", "@oxfmt/binding-openharmony-arm64": "0.41.0", "@oxfmt/binding-win32-arm64-msvc": "0.41.0", "@oxfmt/binding-win32-ia32-msvc": "0.41.0", "@oxfmt/binding-win32-x64-msvc": "0.41.0" }, "bin": { "oxfmt": "bin/oxfmt" } }, "sha512-sKLdJZdQ3bw6x9qKiT7+eID4MNEXlDHf5ZacfIircrq6Qwjk0L6t2/JQlZZrVHTXJawK3KaMuBoJnEJPcqCEdg=="], + "oxlint": ["oxlint@1.14.0", "", { "optionalDependencies": { "@oxlint/darwin-arm64": "1.14.0", "@oxlint/darwin-x64": "1.14.0", "@oxlint/linux-arm64-gnu": "1.14.0", "@oxlint/linux-arm64-musl": "1.14.0", "@oxlint/linux-x64-gnu": "1.14.0", "@oxlint/linux-x64-musl": "1.14.0", "@oxlint/win32-arm64": "1.14.0", "@oxlint/win32-x64": "1.14.0" }, "peerDependencies": { "oxlint-tsgolint": ">=0.1.5" }, "optionalPeers": ["oxlint-tsgolint"], "bin": { "oxlint": "bin/oxlint", "oxc_language_server": "bin/oxc_language_server" } }, "sha512-oo0nq3zF9hmgATGc9esoMahLuEESOodUxEDeHDA2K7tbYcSfcmReE9G2QNppnq9rOSQHLTwlMtzGAjjttYaufQ=="], "p-limit": ["p-limit@4.0.0", "", { "dependencies": { "yocto-queue": "^1.0.0" } }, "sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ=="], @@ -423,8 +463,6 @@ "picomatch": ["picomatch@2.3.1", "", {}, "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="], - "prettier": ["prettier@3.6.2", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ=="], - "readable-stream": ["readable-stream@3.6.2", "", { "dependencies": { "inherits": "^2.0.3", "string_decoder": "^1.1.1", "util-deprecate": "^1.0.1" } }, "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA=="], "require-directory": ["require-directory@2.1.1", "", {}, "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q=="], @@ -479,6 +517,8 @@ "tinyexec": ["tinyexec@1.0.1", "", {}, "sha512-5uC6DDlmeqiOwCPmK9jMSdOuZTh8bU39Ys6yidB+UTt5hfZUPGAypSgFRiEp+jbi9qH40BLDvy85jIU88wKSqw=="], + "tinypool": ["tinypool@2.1.0", "", {}, "sha512-Pugqs6M0m7Lv1I7FtxN4aoyToKg1C4tu+/381vH35y8oENM/Ai7f7C4StcoK4/+BSw9ebcS8jRiVrORFKCALLw=="], + "tmp": ["tmp@0.0.33", "", { "dependencies": { "os-tmpdir": "~1.0.2" } }, "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw=="], "to-regex-range": ["to-regex-range@5.0.1", "", { "dependencies": { "is-number": "^7.0.0" } }, "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ=="], diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index 366afa2b..ebcbb9ee 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -1,5 +1,5 @@ -import { defineConfig } from "astro/config"; import starlight from "@astrojs/starlight"; +import { defineConfig } from "astro/config"; export default defineConfig({ site: "https://cli.archgate.dev", @@ -79,22 +79,14 @@ export default defineConfig({ href: "https://github.com/archgate/cli", }, ], - components: { - Head: "./src/components/HeadSEO.astro", - }, - editLink: { - baseUrl: "https://github.com/archgate/cli/edit/main/docs/", - }, + components: { Head: "./src/components/HeadSEO.astro" }, + editLink: { baseUrl: "https://github.com/archgate/cli/edit/main/docs/" }, favicon: "/favicon.svg", head: [ // ── Favicon ─────────────────────────────────────────────── { tag: "link", - attrs: { - rel: "icon", - type: "image/svg+xml", - href: "/favicon.svg", - }, + attrs: { rel: "icon", type: "image/svg+xml", href: "/favicon.svg" }, }, // ── Analytics ───────────────────────────────────────────── { @@ -106,18 +98,12 @@ export default defineConfig({ }, }, // ── Open Graph ──────────────────────────────────────────── - { - tag: "meta", - attrs: { property: "og:type", content: "website" }, - }, + { tag: "meta", attrs: { property: "og:type", content: "website" } }, { tag: "meta", attrs: { property: "og:site_name", content: "Archgate" }, }, - { - tag: "meta", - attrs: { property: "og:locale", content: "en_US" }, - }, + { tag: "meta", attrs: { property: "og:locale", content: "en_US" } }, { tag: "meta", attrs: { property: "og:locale:alternate", content: "pt_BR" }, @@ -129,14 +115,8 @@ export default defineConfig({ content: "https://cli.archgate.dev/og-image.png", }, }, - { - tag: "meta", - attrs: { property: "og:image:width", content: "1200" }, - }, - { - tag: "meta", - attrs: { property: "og:image:height", content: "630" }, - }, + { tag: "meta", attrs: { property: "og:image:width", content: "1200" } }, + { tag: "meta", attrs: { property: "og:image:height", content: "630" } }, { tag: "meta", attrs: { @@ -158,14 +138,8 @@ export default defineConfig({ }, }, // ── Additional meta ─────────────────────────────────────── - { - tag: "meta", - attrs: { name: "author", content: "Archgate" }, - }, - { - tag: "meta", - attrs: { name: "theme-color", content: "#6366f1" }, - }, + { tag: "meta", attrs: { name: "author", content: "Archgate" } }, + { tag: "meta", attrs: { name: "theme-color", content: "#6366f1" } }, { tag: "meta", attrs: { @@ -225,10 +199,7 @@ export default defineConfig({ { label: "Core Concepts", items: [ - { - label: "Architecture Decision Records", - slug: "concepts/adrs", - }, + { label: "Architecture Decision Records", slug: "concepts/adrs" }, { label: "Rules", slug: "concepts/rules" }, { label: "Domains", slug: "concepts/domains" }, ], @@ -239,26 +210,11 @@ export default defineConfig({ { label: "Writing ADRs", slug: "guides/writing-adrs" }, { label: "Writing Rules", slug: "guides/writing-rules" }, { label: "CI Integration", slug: "guides/ci-integration" }, - { - label: "Claude Code Plugin", - slug: "guides/claude-code-plugin", - }, - { - label: "VS Code Plugin", - slug: "guides/vscode-plugin", - }, - { - label: "Copilot CLI Plugin", - slug: "guides/copilot-cli-plugin", - }, - { - label: "Cursor Integration", - slug: "guides/cursor-integration", - }, - { - label: "Pre-commit Hooks", - slug: "guides/pre-commit-hooks", - }, + { label: "Claude Code Plugin", slug: "guides/claude-code-plugin" }, + { label: "VS Code Plugin", slug: "guides/vscode-plugin" }, + { label: "Copilot CLI Plugin", slug: "guides/copilot-cli-plugin" }, + { label: "Cursor Integration", slug: "guides/cursor-integration" }, + { label: "Pre-commit Hooks", slug: "guides/pre-commit-hooks" }, ], }, { diff --git a/docs/package.json b/docs/package.json index 4218cbe7..8b6897c3 100644 --- a/docs/package.json +++ b/docs/package.json @@ -3,8 +3,8 @@ "private": true, "type": "module", "scripts": { - "dev": "astro dev", "build": "bun run scripts/generate-llms-full.ts && astro build", + "dev": "astro dev", "preview": "astro preview" }, "dependencies": { diff --git a/docs/scripts/generate-og-image.ts b/docs/scripts/generate-og-image.ts index 80675970..f9b38d5a 100644 --- a/docs/scripts/generate-og-image.ts +++ b/docs/scripts/generate-og-image.ts @@ -1,3 +1,6 @@ +import { readFileSync } from "node:fs"; +import { join } from "node:path"; + /** * Generates the default Open Graph image (1200x630 PNG) for social sharing. * Reads the branded SVG from the website repo and converts it to PNG via sharp. @@ -5,8 +8,6 @@ * Run: bun run docs/scripts/generate-og-image.ts */ import sharp from "sharp"; -import { join } from "node:path"; -import { readFileSync } from "node:fs"; const svgPath = join(import.meta.dirname, "..", "public", "og-image.svg"); const outputPath = join(import.meta.dirname, "..", "public", "og-image.png"); diff --git a/docs/src/content.config.ts b/docs/src/content.config.ts index 7fbcf2c3..0bead424 100644 --- a/docs/src/content.config.ts +++ b/docs/src/content.config.ts @@ -1,6 +1,6 @@ -import { defineCollection } from "astro:content"; import { docsLoader } from "@astrojs/starlight/loaders"; import { docsSchema } from "@astrojs/starlight/schema"; +import { defineCollection } from "astro:content"; export const collections = { docs: defineCollection({ loader: docsLoader(), schema: docsSchema() }), diff --git a/docs/src/content/docs/getting-started/installation.mdx b/docs/src/content/docs/getting-started/installation.mdx index 8f76ea6c..7aa60d34 100644 --- a/docs/src/content/docs/getting-started/installation.mdx +++ b/docs/src/content/docs/getting-started/installation.mdx @@ -54,11 +54,7 @@ bun run archgate check Or add a script to your `package.json`: ```json -{ - "scripts": { - "check:adrs": "archgate check" - } -} +{ "scripts": { "check:adrs": "archgate check" } } ``` ```bash diff --git a/docs/src/content/docs/pt-br/getting-started/installation.mdx b/docs/src/content/docs/pt-br/getting-started/installation.mdx index 2a88f644..0705d520 100644 --- a/docs/src/content/docs/pt-br/getting-started/installation.mdx +++ b/docs/src/content/docs/pt-br/getting-started/installation.mdx @@ -54,11 +54,7 @@ bun run archgate check Ou adicione um script ao seu `package.json`: ```json -{ - "scripts": { - "check:adrs": "archgate check" - } -} +{ "scripts": { "check:adrs": "archgate check" } } ``` ```bash diff --git a/docs/src/content/docs/pt-br/reference/rule-api.mdx b/docs/src/content/docs/pt-br/reference/rule-api.mdx index 7c3cfb4a..d967cf7a 100644 --- a/docs/src/content/docs/pt-br/reference/rule-api.mdx +++ b/docs/src/content/docs/pt-br/reference/rule-api.mdx @@ -294,7 +294,5 @@ interface ViolationDetail { O tipo de retorno de `defineRules`. Você não constrói isso diretamente. ```typescript -type RuleSet = { - rules: Record; -}; +type RuleSet = { rules: Record }; ``` diff --git a/docs/src/content/docs/reference/rule-api.mdx b/docs/src/content/docs/reference/rule-api.mdx index c5431bd7..dd013c9a 100644 --- a/docs/src/content/docs/reference/rule-api.mdx +++ b/docs/src/content/docs/reference/rule-api.mdx @@ -294,7 +294,5 @@ interface ViolationDetail { The return type of `defineRules`. You do not construct this directly. ```typescript -type RuleSet = { - rules: Record; -}; +type RuleSet = { rules: Record }; ``` diff --git a/docs/tsconfig.json b/docs/tsconfig.json index bcbf8b50..c1965003 100644 --- a/docs/tsconfig.json +++ b/docs/tsconfig.json @@ -1,3 +1 @@ -{ - "extends": "astro/tsconfigs/strict" -} +{ "extends": "astro/tsconfigs/strict" } diff --git a/package.json b/package.json index a6fcb385..6fa59bf7 100644 --- a/package.json +++ b/package.json @@ -2,61 +2,60 @@ "name": "archgate", "version": "0.11.1", "description": "Enforce Architecture Decision Records as executable rules — for both humans and AI agents", - "readme": "README.md", - "license": "Apache-2.0", - "homepage": "https://cli.archgate.dev", - "bin": { - "archgate": "bin/archgate.cjs" - }, - "exports": { - "./rules": "./src/formats/rules.ts" - }, - "files": [ - "src/formats/rules.ts", - "bin/archgate.cjs" - ], - "author": { - "name": "Archgate", - "url": "https://archgate.dev" - }, "keywords": [ - "archgate", "adr", + "archgate", "architecture-decision-records", + "cli", "governance", - "linter", - "cli" + "linter" ], + "homepage": "https://cli.archgate.dev", "bugs": { "url": "https://github.com/archgate/cli/issues" }, + "license": "Apache-2.0", + "author": { + "name": "Archgate", + "url": "https://archgate.dev" + }, "repository": { "type": "git", "url": "git+https://github.com/archgate/cli.git" }, + "bin": { + "archgate": "bin/archgate.cjs" + }, + "files": [ + "src/formats/rules.ts", + "bin/archgate.cjs" + ], "os": [ "darwin", "linux", "win32" ], + "type": "module", + "exports": { + "./rules": "./src/formats/rules.ts" + }, "scripts": { - "cli": "bun run src/cli.ts", + "build:check": "bun build src/cli.ts --compile --bytecode --outfile dist/.build-check && rm -f dist/.build-check dist/.build-check.exe", + "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", "check": "bun run src/cli.ts check", + "cli": "bun run src/cli.ts", + "commit": "cz", + "docs:build": "cd docs && bunx --bun astro build", + "docs:dev": "cd docs && bunx --bun astro dev", + "docs:preview": "cd docs && bunx --bun astro preview", + "format": "oxfmt --write .", + "format:check": "oxfmt --check .", "lint": "oxlint --deny-warnings .", - "typecheck": "tsc --build", - "format": "prettier --write .", - "format:check": "prettier --check .", "test": "bun test --timeout 60000", "test:watch": "bun test --watch --timeout 60000", - "build:check": "bun build src/cli.ts --compile --bytecode --outfile dist/.build-check && rm -f dist/.build-check dist/.build-check.exe", - "validate": "bun run lint && bun run typecheck && bun run format:check && bun test && bun run check && bun run build:check", - "commit": "cz", - "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0", - "docs:dev": "cd docs && bunx --bun astro dev", - "docs:build": "cd docs && bunx --bun astro build", - "docs:preview": "cd docs && bunx --bun astro preview" + "typecheck": "tsc --build", + "validate": "bun run lint && bun run typecheck && bun run format:check && bun test && bun run check && bun run build:check" }, - "type": "module", "devDependencies": { "@commander-js/extra-typings": "14.0.0", "@commitlint/cli": "19.8.1", @@ -68,8 +67,8 @@ "conventional-changelog": "7.1.1", "conventional-changelog-angular": "8.0.0", "inquirer": "12.9.4", + "oxfmt": "0.41.0", "oxlint": "1.14.0", - "prettier": "3.6.2", "zod": "4.3.6" }, "peerDependencies": { @@ -79,5 +78,6 @@ "archgate-darwin-arm64": "0.11.1", "archgate-linux-x64": "0.11.1", "archgate-win32-x64": "0.11.1" - } + }, + "readme": "README.md" } diff --git a/packages/archgate-darwin-arm64/package.json b/packages/archgate-darwin-arm64/package.json index af4f43b7..d44a4fb8 100644 --- a/packages/archgate-darwin-arm64/package.json +++ b/packages/archgate-darwin-arm64/package.json @@ -2,18 +2,18 @@ "name": "archgate-darwin-arm64", "version": "0.0.0", "description": "darwin arm64 binary for archgate", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git+https://github.com/archgate/cli.git" + }, + "files": [ + "bin/archgate" + ], "os": [ "darwin" ], "cpu": [ "arm64" - ], - "files": [ - "bin/archgate" - ], - "license": "Apache-2.0", - "repository": { - "type": "git", - "url": "git+https://github.com/archgate/cli.git" - } + ] } diff --git a/packages/archgate-linux-x64/package.json b/packages/archgate-linux-x64/package.json index 8a3ea97e..cb2ba141 100644 --- a/packages/archgate-linux-x64/package.json +++ b/packages/archgate-linux-x64/package.json @@ -2,18 +2,18 @@ "name": "archgate-linux-x64", "version": "0.0.0", "description": "linux x64 binary for archgate", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git+https://github.com/archgate/cli.git" + }, + "files": [ + "bin/archgate" + ], "os": [ "linux" ], "cpu": [ "x64" - ], - "files": [ - "bin/archgate" - ], - "license": "Apache-2.0", - "repository": { - "type": "git", - "url": "git+https://github.com/archgate/cli.git" - } + ] } diff --git a/packages/archgate-win32-x64/package.json b/packages/archgate-win32-x64/package.json index efaf0a41..8e21ef7a 100644 --- a/packages/archgate-win32-x64/package.json +++ b/packages/archgate-win32-x64/package.json @@ -2,18 +2,18 @@ "name": "archgate-win32-x64", "version": "0.0.0", "description": "windows x64 binary for archgate", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git+https://github.com/archgate/cli.git" + }, + "files": [ + "bin/archgate.exe" + ], "os": [ "win32" ], "cpu": [ "x64" - ], - "files": [ - "bin/archgate.exe" - ], - "license": "Apache-2.0", - "repository": { - "type": "git", - "url": "git+https://github.com/archgate/cli.git" - } + ] } diff --git a/src/cli.ts b/src/cli.ts index 303a7c42..bfc866c9 100755 --- a/src/cli.ts +++ b/src/cli.ts @@ -1,21 +1,22 @@ #!/usr/bin/env bun import { Command } from "@commander-js/extra-typings"; -import packageJson from "../package.json"; -import { createPathIfNotExists, paths } from "./helpers/paths"; import { semver } from "bun"; -import { installGit } from "./helpers/git"; -import { registerInitCommand } from "./commands/init"; + +import packageJson from "../package.json"; import { registerAdrCommand } from "./commands/adr/index"; -import { registerUpgradeCommand } from "./commands/upgrade"; -import { registerCleanCommand } from "./commands/clean"; import { registerCheckCommand } from "./commands/check"; +import { registerCleanCommand } from "./commands/clean"; +import { registerInitCommand } from "./commands/init"; import { registerLoginCommand } from "./commands/login"; +import { registerPluginCommand } from "./commands/plugin/index"; import { registerReviewContextCommand } from "./commands/review-context"; import { registerSessionContextCommand } from "./commands/session-context/index"; -import { registerPluginCommand } from "./commands/plugin/index"; -import { checkForUpdatesIfNeeded } from "./helpers/update-check"; +import { registerUpgradeCommand } from "./commands/upgrade"; +import { installGit } from "./helpers/git"; import { logError } from "./helpers/log"; +import { createPathIfNotExists, paths } from "./helpers/paths"; import { isSupportedPlatform } from "./helpers/platform"; +import { checkForUpdatesIfNeeded } from "./helpers/update-check"; if (typeof Bun === "undefined") throw new Error( diff --git a/src/commands/adr/create.ts b/src/commands/adr/create.ts index 014ec596..544e2b1d 100644 --- a/src/commands/adr/create.ts +++ b/src/commands/adr/create.ts @@ -1,11 +1,13 @@ +import { existsSync } from "node:fs"; + import type { Command } from "@commander-js/extra-typings"; import { Option } from "@commander-js/extra-typings"; -import { existsSync } from "node:fs"; import inquirer from "inquirer"; -import { projectPaths } from "../../helpers/paths"; + import { ADR_DOMAINS, type AdrDomain } from "../../formats/adr"; import { createAdrFile } from "../../helpers/adr-writer"; import { logError } from "../../helpers/log"; +import { projectPaths } from "../../helpers/paths"; const domainOption = new Option("--domain ", "ADR domain").choices( ADR_DOMAINS diff --git a/src/commands/adr/index.ts b/src/commands/adr/index.ts index 27de8e89..bfc18578 100644 --- a/src/commands/adr/index.ts +++ b/src/commands/adr/index.ts @@ -1,4 +1,5 @@ import type { Command } from "@commander-js/extra-typings"; + import { registerAdrCreateCommand } from "./create"; import { registerAdrListCommand } from "./list"; import { registerAdrShowCommand } from "./show"; diff --git a/src/commands/adr/list.ts b/src/commands/adr/list.ts index 1e879f70..6b04895b 100644 --- a/src/commands/adr/list.ts +++ b/src/commands/adr/list.ts @@ -1,9 +1,11 @@ -import type { Command } from "@commander-js/extra-typings"; import { existsSync, readdirSync } from "node:fs"; import { styleText } from "node:util"; -import { projectPaths } from "../../helpers/paths"; + +import type { Command } from "@commander-js/extra-typings"; + import { parseAdr, type AdrDocument } from "../../formats/adr"; import { logError } from "../../helpers/log"; +import { projectPaths } from "../../helpers/paths"; async function loadAdrs(adrsDir: string): Promise { const files = readdirSync(adrsDir).filter((f) => f.endsWith(".md")); diff --git a/src/commands/adr/show.ts b/src/commands/adr/show.ts index 0d68c8fa..b4176512 100644 --- a/src/commands/adr/show.ts +++ b/src/commands/adr/show.ts @@ -1,8 +1,10 @@ -import type { Command } from "@commander-js/extra-typings"; import { existsSync } from "node:fs"; -import { projectPaths } from "../../helpers/paths"; + +import type { Command } from "@commander-js/extra-typings"; + import { findAdrFileById } from "../../helpers/adr-writer"; import { logError } from "../../helpers/log"; +import { projectPaths } from "../../helpers/paths"; export function registerAdrShowCommand(adr: Command) { adr diff --git a/src/commands/adr/update.ts b/src/commands/adr/update.ts index 3376cb6b..77519fdd 100644 --- a/src/commands/adr/update.ts +++ b/src/commands/adr/update.ts @@ -1,10 +1,12 @@ +import { existsSync } from "node:fs"; + import type { Command } from "@commander-js/extra-typings"; import { Option } from "@commander-js/extra-typings"; -import { existsSync } from "node:fs"; -import { projectPaths } from "../../helpers/paths"; + import { ADR_DOMAINS } from "../../formats/adr"; import { updateAdrFile } from "../../helpers/adr-writer"; import { logError } from "../../helpers/log"; +import { projectPaths } from "../../helpers/paths"; const domainOption = new Option("--domain ", "new ADR domain").choices( ADR_DOMAINS diff --git a/src/commands/check.ts b/src/commands/check.ts index 46e58a44..65821ebc 100644 --- a/src/commands/check.ts +++ b/src/commands/check.ts @@ -1,14 +1,15 @@ import type { Command } from "@commander-js/extra-typings"; -import { logError } from "../helpers/log"; -import { findProjectRoot } from "../helpers/paths"; + import { loadRuleAdrs } from "../engine/loader"; -import { runChecks } from "../engine/runner"; import { reportConsole, reportJSON, reportCI, getExitCode, } from "../engine/reporter"; +import { runChecks } from "../engine/runner"; +import { logError } from "../helpers/log"; +import { findProjectRoot } from "../helpers/paths"; export function registerCheckCommand(program: Command) { program diff --git a/src/commands/clean.ts b/src/commands/clean.ts index 87106d02..7299d2eb 100644 --- a/src/commands/clean.ts +++ b/src/commands/clean.ts @@ -1,8 +1,10 @@ -import type { Command } from "@commander-js/extra-typings"; import { existsSync } from "node:fs"; import { rmSync } from "node:fs"; -import { internalPath } from "../helpers/paths"; + +import type { Command } from "@commander-js/extra-typings"; + import { logError } from "../helpers/log"; +import { internalPath } from "../helpers/paths"; export function registerCleanCommand(program: Command) { program diff --git a/src/commands/init.ts b/src/commands/init.ts index b341b02a..59b2dd47 100644 --- a/src/commands/init.ts +++ b/src/commands/init.ts @@ -1,10 +1,12 @@ +import { styleText } from "node:util"; + import type { Command } from "@commander-js/extra-typings"; import { Option } from "@commander-js/extra-typings"; -import { styleText } from "node:util"; -import { logError, logInfo, logWarn } from "../helpers/log"; + +import { loadCredentials } from "../helpers/auth"; import { initProject } from "../helpers/init-project"; import type { EditorTarget } from "../helpers/init-project"; -import { loadCredentials } from "../helpers/auth"; +import { logError, logInfo, logWarn } from "../helpers/log"; const EDITOR_LABELS: Record = { claude: "Claude Code", diff --git a/src/commands/login.ts b/src/commands/login.ts index 5e6df87b..17056ffd 100644 --- a/src/commands/login.ts +++ b/src/commands/login.ts @@ -1,6 +1,7 @@ -import type { Command } from "@commander-js/extra-typings"; import { styleText } from "node:util"; -import { logError, logInfo } from "../helpers/log"; + +import type { Command } from "@commander-js/extra-typings"; + import { requestDeviceCode, pollForAccessToken, @@ -10,6 +11,7 @@ import { loadCredentials, clearCredentials, } from "../helpers/auth"; +import { logError, logInfo } from "../helpers/log"; export function registerLoginCommand(program: Command) { const login = program diff --git a/src/commands/plugin/index.ts b/src/commands/plugin/index.ts index a807289e..caab5c6d 100644 --- a/src/commands/plugin/index.ts +++ b/src/commands/plugin/index.ts @@ -1,6 +1,7 @@ import type { Command } from "@commander-js/extra-typings"; -import { registerPluginUrlCommand } from "./url"; + import { registerPluginInstallCommand } from "./install"; +import { registerPluginUrlCommand } from "./url"; export function registerPluginCommand(program: Command) { const plugin = program diff --git a/src/commands/plugin/install.ts b/src/commands/plugin/install.ts index 2cd596bd..eb109c61 100644 --- a/src/commands/plugin/install.ts +++ b/src/commands/plugin/install.ts @@ -1,7 +1,11 @@ +import { styleText } from "node:util"; + import type { Command } from "@commander-js/extra-typings"; import { Option } from "@commander-js/extra-typings"; -import { styleText } from "node:util"; + import { loadCredentials } from "../../helpers/auth"; +import type { EditorTarget } from "../../helpers/init-project"; +import { logError, logInfo, logWarn } from "../../helpers/log"; import { buildMarketplaceUrl, buildVscodeMarketplaceUrl, @@ -12,8 +16,6 @@ import { isCopilotCliAvailable, } from "../../helpers/plugin-install"; import { configureVscodeSettings } from "../../helpers/vscode-settings"; -import { logError, logInfo, logWarn } from "../../helpers/log"; -import type { EditorTarget } from "../../helpers/init-project"; const EDITOR_LABELS: Record = { claude: "Claude Code", diff --git a/src/commands/plugin/url.ts b/src/commands/plugin/url.ts index 7b439141..f12f21d8 100644 --- a/src/commands/plugin/url.ts +++ b/src/commands/plugin/url.ts @@ -1,11 +1,12 @@ import type { Command } from "@commander-js/extra-typings"; import { Option } from "@commander-js/extra-typings"; + import { loadCredentials } from "../../helpers/auth"; +import { logError } from "../../helpers/log"; import { buildMarketplaceUrl, buildVscodeMarketplaceUrl, } from "../../helpers/plugin-install"; -import { logError } from "../../helpers/log"; const editorOption = new Option("--editor ", "target editor") .choices(["claude", "cursor", "vscode", "copilot"] as const) diff --git a/src/commands/review-context.ts b/src/commands/review-context.ts index 36c7e7cc..45d6a10d 100644 --- a/src/commands/review-context.ts +++ b/src/commands/review-context.ts @@ -1,9 +1,10 @@ import type { Command } from "@commander-js/extra-typings"; import { Option } from "@commander-js/extra-typings"; -import { logError } from "../helpers/log"; -import { findProjectRoot } from "../helpers/paths"; + import { buildReviewContext } from "../engine/context"; import { ADR_DOMAINS } from "../formats/adr"; +import { logError } from "../helpers/log"; +import { findProjectRoot } from "../helpers/paths"; const domainOption = new Option( "--domain ", diff --git a/src/commands/session-context/claude-code.ts b/src/commands/session-context/claude-code.ts index 41a0d724..eead8adf 100644 --- a/src/commands/session-context/claude-code.ts +++ b/src/commands/session-context/claude-code.ts @@ -1,8 +1,9 @@ import type { Command } from "@commander-js/extra-typings"; import { Option } from "@commander-js/extra-typings"; + +import { logError } from "../../helpers/log"; import { findProjectRoot } from "../../helpers/paths"; import { readClaudeCodeSession } from "../../helpers/session-context"; -import { logError } from "../../helpers/log"; const maxEntriesOption = new Option( "--max-entries ", diff --git a/src/commands/session-context/cursor.ts b/src/commands/session-context/cursor.ts index 32e7e6dc..296e6433 100644 --- a/src/commands/session-context/cursor.ts +++ b/src/commands/session-context/cursor.ts @@ -1,8 +1,9 @@ import type { Command } from "@commander-js/extra-typings"; import { Option } from "@commander-js/extra-typings"; + +import { logError } from "../../helpers/log"; import { findProjectRoot } from "../../helpers/paths"; import { readCursorSession } from "../../helpers/session-context"; -import { logError } from "../../helpers/log"; const maxEntriesOption = new Option( "--max-entries ", diff --git a/src/commands/session-context/index.ts b/src/commands/session-context/index.ts index dccb7bff..1ad8662f 100644 --- a/src/commands/session-context/index.ts +++ b/src/commands/session-context/index.ts @@ -1,4 +1,5 @@ import type { Command } from "@commander-js/extra-typings"; + import { registerClaudeCodeSessionContextCommand } from "./claude-code"; import { registerCursorSessionContextCommand } from "./cursor"; diff --git a/src/commands/upgrade.ts b/src/commands/upgrade.ts index 11c06399..e3a9f75f 100644 --- a/src/commands/upgrade.ts +++ b/src/commands/upgrade.ts @@ -1,5 +1,6 @@ import type { Command } from "@commander-js/extra-typings"; import { semver } from "bun"; + import { logError } from "../helpers/log"; import { resolveCommand } from "../helpers/platform"; diff --git a/src/engine/context.ts b/src/engine/context.ts index 8c632593..1d8d4c21 100644 --- a/src/engine/context.ts +++ b/src/engine/context.ts @@ -1,13 +1,14 @@ import { readdirSync } from "node:fs"; import { join } from "node:path"; + import { parseAdr } from "../formats/adr"; import type { AdrDocument, AdrDomain } from "../formats/adr"; -import type { ReportSummary } from "./reporter"; -import { buildSummary } from "./reporter"; +import { projectPaths } from "../helpers/paths"; import { getChangedFiles, getStagedFiles } from "./git-files"; import { loadRuleAdrs } from "./loader"; +import type { ReportSummary } from "./reporter"; +import { buildSummary } from "./reporter"; import { runChecks } from "./runner"; -import { projectPaths } from "../helpers/paths"; export interface AdrBriefing { id: string; diff --git a/src/engine/loader.ts b/src/engine/loader.ts index 8ceeca08..baf9067f 100644 --- a/src/engine/loader.ts +++ b/src/engine/loader.ts @@ -1,10 +1,12 @@ import { readdirSync } from "node:fs"; import { join, basename } from "node:path"; import { pathToFileURL } from "node:url"; + +import { z } from "zod"; + import { parseAdr } from "../formats/adr"; import type { AdrDocument } from "../formats/adr"; import { type RuleSet } from "../formats/rules"; -import { z } from "zod"; import type { RuleContext } from "../formats/rules"; const RuleSetSchema = z.object({ @@ -20,8 +22,8 @@ const RuleSetSchema = z.object({ }) ), }); -import { projectPaths } from "../helpers/paths"; import { logDebug, logWarn } from "../helpers/log"; +import { projectPaths } from "../helpers/paths"; export interface LoadedAdr { adr: AdrDocument; diff --git a/src/engine/reporter.ts b/src/engine/reporter.ts index e58c31c0..0d4c110b 100644 --- a/src/engine/reporter.ts +++ b/src/engine/reporter.ts @@ -1,6 +1,7 @@ import { styleText } from "node:util"; -import type { CheckResult } from "./runner"; + import type { Severity } from "../formats/rules"; +import type { CheckResult } from "./runner"; export interface ReportSummary { pass: boolean; diff --git a/src/engine/runner.ts b/src/engine/runner.ts index 2b963431..9b44fdb9 100644 --- a/src/engine/runner.ts +++ b/src/engine/runner.ts @@ -1,13 +1,14 @@ import { join, relative, isAbsolute } from "node:path"; + import type { GrepMatch, RuleContext, RuleReport, ViolationDetail, } from "../formats/rules"; -import type { LoadedAdr } from "./loader"; import { logDebug } from "../helpers/log"; import { resolveScopedFiles, getStagedFiles } from "./git-files"; +import type { LoadedAdr } from "./loader"; const RULE_TIMEOUT_MS = 30_000; @@ -213,8 +214,5 @@ export async function runChecks( } } - return { - results, - totalDurationMs: performance.now() - startTime, - }; + return { results, totalDurationMs: performance.now() - startTime }; } diff --git a/src/formats/adr.ts b/src/formats/adr.ts index a3da3f39..6cbc5d87 100644 --- a/src/formats/adr.ts +++ b/src/formats/adr.ts @@ -72,9 +72,5 @@ export function parseAdr(content: string, filePath: string): AdrDocument { ); } - return { - frontmatter: result.data, - body, - filePath, - }; + return { frontmatter: result.data, body, filePath }; } diff --git a/src/formats/rules.ts b/src/formats/rules.ts index 52f7ccae..00833a8e 100644 --- a/src/formats/rules.ts +++ b/src/formats/rules.ts @@ -57,9 +57,7 @@ export interface RuleConfig { // --- Rule Set --- -export type RuleSet = { - rules: Record; -}; +export type RuleSet = { rules: Record }; /** * Define rules in a .rules.ts companion file. diff --git a/src/helpers/adr-writer.ts b/src/helpers/adr-writer.ts index 978304b2..26fbb82f 100644 --- a/src/helpers/adr-writer.ts +++ b/src/helpers/adr-writer.ts @@ -1,5 +1,6 @@ import { existsSync, readdirSync } from "node:fs"; import { join, basename } from "node:path"; + import { DOMAIN_PREFIXES, type AdrDomain, diff --git a/src/helpers/auth.ts b/src/helpers/auth.ts index fbc82235..bca5a0ad 100644 --- a/src/helpers/auth.ts +++ b/src/helpers/auth.ts @@ -6,8 +6,9 @@ */ import { unlinkSync } from "node:fs"; -import { internalPath, createPathIfNotExists } from "./paths"; + import { logDebug } from "./log"; +import { internalPath, createPathIfNotExists } from "./paths"; // --------------------------------------------------------------------------- // Constants @@ -74,14 +75,8 @@ export interface StoredCredentials { export async function requestDeviceCode(): Promise { const response = await fetch(GITHUB_DEVICE_CODE_URL, { method: "POST", - headers: { - Accept: "application/json", - "Content-Type": "application/json", - }, - body: JSON.stringify({ - client_id: GITHUB_CLIENT_ID, - scope: "read:user", - }), + headers: { Accept: "application/json", "Content-Type": "application/json" }, + body: JSON.stringify({ client_id: GITHUB_CLIENT_ID, scope: "read:user" }), signal: AbortSignal.timeout(15_000), }); diff --git a/src/helpers/claude-settings.ts b/src/helpers/claude-settings.ts index a2fc694e..52325316 100644 --- a/src/helpers/claude-settings.ts +++ b/src/helpers/claude-settings.ts @@ -1,5 +1,5 @@ -import { join } from "node:path"; import { existsSync, mkdirSync } from "node:fs"; +import { join } from "node:path"; /** * Settings that archgate injects into .claude/settings.local.json. diff --git a/src/helpers/copilot-settings.ts b/src/helpers/copilot-settings.ts index 68b2c70b..b625af86 100644 --- a/src/helpers/copilot-settings.ts +++ b/src/helpers/copilot-settings.ts @@ -1,5 +1,5 @@ -import { join } from "node:path"; import { existsSync, mkdirSync } from "node:fs"; +import { join } from "node:path"; /** * Configure Copilot CLI settings for archgate integration. diff --git a/src/helpers/cursor-settings.ts b/src/helpers/cursor-settings.ts index 65c3211e..40435cc1 100644 --- a/src/helpers/cursor-settings.ts +++ b/src/helpers/cursor-settings.ts @@ -1,5 +1,5 @@ -import { join } from "node:path"; import { existsSync, mkdirSync } from "node:fs"; +import { join } from "node:path"; /** * Content for .cursor/rules/archgate-governance.mdc. diff --git a/src/helpers/init-project.ts b/src/helpers/init-project.ts index d37b4087..fa706a82 100644 --- a/src/helpers/init-project.ts +++ b/src/helpers/init-project.ts @@ -1,11 +1,12 @@ -import { basename } from "node:path"; import { existsSync, readdirSync } from "node:fs"; -import { createPathIfNotExists, projectPaths } from "./paths"; +import { basename } from "node:path"; + import { generateExampleAdr } from "./adr-templates"; import { configureClaudeSettings } from "./claude-settings"; +import { configureCopilotSettings } from "./copilot-settings"; import { configureCursorSettings } from "./cursor-settings"; +import { createPathIfNotExists, projectPaths } from "./paths"; import { configureVscodeSettings } from "./vscode-settings"; -import { configureCopilotSettings } from "./copilot-settings"; export type EditorTarget = "claude" | "cursor" | "vscode" | "copilot"; diff --git a/src/helpers/paths.ts b/src/helpers/paths.ts index 9e04f61d..01fa8962 100644 --- a/src/helpers/paths.ts +++ b/src/helpers/paths.ts @@ -1,6 +1,7 @@ +import { existsSync, mkdirSync } from "node:fs"; import { join, dirname } from "node:path"; + import { logDebug } from "./log"; -import { existsSync, mkdirSync } from "node:fs"; export function internalPath(...path: string[]) { const internalFolder = join( diff --git a/src/helpers/plugin-install.ts b/src/helpers/plugin-install.ts index 24389adb..31e98189 100644 --- a/src/helpers/plugin-install.ts +++ b/src/helpers/plugin-install.ts @@ -7,10 +7,11 @@ * - Cursor: downloads cursor.tar.gz from the plugins service and extracts it */ -import { join } from "node:path"; import { mkdirSync, unlinkSync } from "node:fs"; -import { logDebug } from "./log"; +import { join } from "node:path"; + import type { StoredCredentials } from "./auth"; +import { logDebug } from "./log"; import { resolveCommand } from "./platform"; const PLUGINS_API = "https://plugins.archgate.dev"; @@ -114,10 +115,7 @@ export async function installCursorPlugin( token: string ): Promise { const response = await fetch(`${PLUGINS_API}/api/cursor`, { - headers: { - Authorization: `Bearer ${token}`, - "User-Agent": "archgate-cli", - }, + headers: { Authorization: `Bearer ${token}`, "User-Agent": "archgate-cli" }, signal: AbortSignal.timeout(30_000), }); diff --git a/src/helpers/session-context.ts b/src/helpers/session-context.ts index f0dbfc2a..2b5190e2 100644 --- a/src/helpers/session-context.ts +++ b/src/helpers/session-context.ts @@ -1,6 +1,7 @@ import { readdirSync, statSync } from "node:fs"; -import { join, basename } from "node:path"; import { homedir } from "node:os"; +import { basename, join } from "node:path"; + import { isWSL, toWindowsPath } from "./platform"; /** diff --git a/src/helpers/update-check.ts b/src/helpers/update-check.ts index 92ea4ff1..e64b406a 100644 --- a/src/helpers/update-check.ts +++ b/src/helpers/update-check.ts @@ -1,6 +1,7 @@ import { semver } from "bun"; -import { internalPath } from "./paths"; + import { logDebug } from "./log"; +import { internalPath } from "./paths"; const CACHE_FILE = "last-update-check"; const CACHE_TTL_MS = 24 * 60 * 60 * 1000; // 24 hours diff --git a/src/helpers/vscode-settings.ts b/src/helpers/vscode-settings.ts index 74a52757..9635ff37 100644 --- a/src/helpers/vscode-settings.ts +++ b/src/helpers/vscode-settings.ts @@ -1,11 +1,12 @@ -import { join } from "node:path"; import { existsSync, mkdirSync } from "node:fs"; import { homedir } from "node:os"; +import { join } from "node:path"; + import { + getWindowsHomeDirFromWSL, + isMacOS, isWSL, isWindows, - isMacOS, - getWindowsHomeDirFromWSL, } from "./platform"; type VscodeUserSettings = Record; diff --git a/tests/commands/adr.test.ts b/tests/commands/adr.test.ts index 4d994acf..3b6e6e96 100644 --- a/tests/commands/adr.test.ts +++ b/tests/commands/adr.test.ts @@ -1,14 +1,15 @@ import { describe, expect, test, beforeEach, afterEach } from "bun:test"; import { mkdtempSync, rmSync, readdirSync, existsSync } from "node:fs"; -import { join } from "node:path"; import { tmpdir } from "node:os"; -import { projectPaths, createPathIfNotExists } from "../../src/helpers/paths"; +import { join } from "node:path"; + import { parseAdr } from "../../src/formats/adr"; import { generateExampleAdr, generateAdrTemplate, } from "../../src/helpers/adr-templates"; import { createAdrFile, updateAdrFile } from "../../src/helpers/adr-writer"; +import { projectPaths, createPathIfNotExists } from "../../src/helpers/paths"; let tempDir: string; diff --git a/tests/commands/adr/create.test.ts b/tests/commands/adr/create.test.ts index 7ba3dffa..5c8e5ff4 100644 --- a/tests/commands/adr/create.test.ts +++ b/tests/commands/adr/create.test.ts @@ -1,5 +1,7 @@ import { describe, expect, test } from "bun:test"; + import { Command } from "@commander-js/extra-typings"; + import { registerAdrCreateCommand } from "../../../src/commands/adr/create"; describe("registerAdrCreateCommand", () => { diff --git a/tests/commands/adr/list.test.ts b/tests/commands/adr/list.test.ts index ceec5a31..f241b723 100644 --- a/tests/commands/adr/list.test.ts +++ b/tests/commands/adr/list.test.ts @@ -1,5 +1,7 @@ import { describe, expect, test } from "bun:test"; + import { Command } from "@commander-js/extra-typings"; + import { registerAdrListCommand } from "../../../src/commands/adr/list"; describe("registerAdrListCommand", () => { diff --git a/tests/commands/adr/show.test.ts b/tests/commands/adr/show.test.ts index d8832590..ebe82f5e 100644 --- a/tests/commands/adr/show.test.ts +++ b/tests/commands/adr/show.test.ts @@ -1,5 +1,7 @@ import { describe, expect, test } from "bun:test"; + import { Command } from "@commander-js/extra-typings"; + import { registerAdrShowCommand } from "../../../src/commands/adr/show"; describe("registerAdrShowCommand", () => { diff --git a/tests/commands/adr/update.test.ts b/tests/commands/adr/update.test.ts index a8df2013..5e9dea81 100644 --- a/tests/commands/adr/update.test.ts +++ b/tests/commands/adr/update.test.ts @@ -1,5 +1,7 @@ import { describe, expect, test } from "bun:test"; + import { Command } from "@commander-js/extra-typings"; + import { registerAdrUpdateCommand } from "../../../src/commands/adr/update"; describe("registerAdrUpdateCommand", () => { diff --git a/tests/commands/check.test.ts b/tests/commands/check.test.ts index ea7c6890..ece45dd0 100644 --- a/tests/commands/check.test.ts +++ b/tests/commands/check.test.ts @@ -1,10 +1,11 @@ import { describe, expect, test, beforeEach, afterEach } from "bun:test"; import { mkdtempSync, rmSync, mkdirSync, writeFileSync } from "node:fs"; -import { join } from "node:path"; import { tmpdir } from "node:os"; +import { join } from "node:path"; + import { loadRuleAdrs } from "../../src/engine/loader"; -import { runChecks } from "../../src/engine/runner"; import { getExitCode } from "../../src/engine/reporter"; +import { runChecks } from "../../src/engine/runner"; // Absolute path to the real defineRules module (forward slashes for import specifiers) const RULES_MODULE_PATH = join( diff --git a/tests/commands/clean.test.ts b/tests/commands/clean.test.ts index 5af6eb09..31a9ec73 100644 --- a/tests/commands/clean.test.ts +++ b/tests/commands/clean.test.ts @@ -1,5 +1,7 @@ import { describe, expect, test } from "bun:test"; + import { Command } from "@commander-js/extra-typings"; + import { registerCleanCommand } from "../../src/commands/clean"; describe("registerCleanCommand", () => { diff --git a/tests/commands/init.test.ts b/tests/commands/init.test.ts index 2d43ff46..8c4fcbc6 100644 --- a/tests/commands/init.test.ts +++ b/tests/commands/init.test.ts @@ -1,11 +1,12 @@ import { describe, expect, test, beforeEach, afterEach } from "bun:test"; import { mkdtempSync, rmSync, existsSync } from "node:fs"; -import { join } from "node:path"; import { tmpdir } from "node:os"; -import { projectPaths } from "../../src/helpers/paths"; +import { join } from "node:path"; + +import { parseAdr } from "../../src/formats/adr"; import { generateExampleAdr } from "../../src/helpers/adr-templates"; +import { projectPaths } from "../../src/helpers/paths"; import { createPathIfNotExists } from "../../src/helpers/paths"; -import { parseAdr } from "../../src/formats/adr"; let tempDir: string; diff --git a/tests/commands/login.test.ts b/tests/commands/login.test.ts index 67a7714c..3f5d0cc5 100644 --- a/tests/commands/login.test.ts +++ b/tests/commands/login.test.ts @@ -1,5 +1,7 @@ import { describe, expect, test } from "bun:test"; + import { Command } from "@commander-js/extra-typings"; + import { registerLoginCommand } from "../../src/commands/login"; describe("registerLoginCommand", () => { diff --git a/tests/commands/plugin/install.test.ts b/tests/commands/plugin/install.test.ts index 635ed1bc..5564363e 100644 --- a/tests/commands/plugin/install.test.ts +++ b/tests/commands/plugin/install.test.ts @@ -1,5 +1,7 @@ import { describe, expect, test } from "bun:test"; + import { Command } from "@commander-js/extra-typings"; + import { registerPluginInstallCommand } from "../../../src/commands/plugin/install"; describe("registerPluginInstallCommand", () => { diff --git a/tests/commands/plugin/url.test.ts b/tests/commands/plugin/url.test.ts index 527eaa03..cdd6b094 100644 --- a/tests/commands/plugin/url.test.ts +++ b/tests/commands/plugin/url.test.ts @@ -1,5 +1,7 @@ import { describe, expect, test } from "bun:test"; + import { Command } from "@commander-js/extra-typings"; + import { registerPluginUrlCommand } from "../../../src/commands/plugin/url"; describe("registerPluginUrlCommand", () => { diff --git a/tests/commands/review-context.test.ts b/tests/commands/review-context.test.ts index 30f282a3..966e6f9b 100644 --- a/tests/commands/review-context.test.ts +++ b/tests/commands/review-context.test.ts @@ -1,5 +1,7 @@ import { describe, expect, test } from "bun:test"; + import { Command } from "@commander-js/extra-typings"; + import { registerReviewContextCommand } from "../../src/commands/review-context"; describe("registerReviewContextCommand", () => { diff --git a/tests/commands/session-context.test.ts b/tests/commands/session-context.test.ts index 03daa2ac..304e586e 100644 --- a/tests/commands/session-context.test.ts +++ b/tests/commands/session-context.test.ts @@ -1,5 +1,7 @@ import { describe, expect, test } from "bun:test"; + import { Command } from "@commander-js/extra-typings"; + import { registerSessionContextCommand } from "../../src/commands/session-context/index"; describe("registerSessionContextCommand", () => { diff --git a/tests/commands/session-context/claude-code.test.ts b/tests/commands/session-context/claude-code.test.ts index d9075d7c..97196fb6 100644 --- a/tests/commands/session-context/claude-code.test.ts +++ b/tests/commands/session-context/claude-code.test.ts @@ -1,5 +1,7 @@ import { describe, expect, test } from "bun:test"; + import { Command } from "@commander-js/extra-typings"; + import { registerClaudeCodeSessionContextCommand } from "../../../src/commands/session-context/claude-code"; describe("registerClaudeCodeSessionContextCommand", () => { diff --git a/tests/commands/session-context/cursor.test.ts b/tests/commands/session-context/cursor.test.ts index 73b2e849..3b715158 100644 --- a/tests/commands/session-context/cursor.test.ts +++ b/tests/commands/session-context/cursor.test.ts @@ -1,5 +1,7 @@ import { describe, expect, test } from "bun:test"; + import { Command } from "@commander-js/extra-typings"; + import { registerCursorSessionContextCommand } from "../../../src/commands/session-context/cursor"; describe("registerCursorSessionContextCommand", () => { diff --git a/tests/commands/upgrade.test.ts b/tests/commands/upgrade.test.ts index f61523e7..0a94ac93 100644 --- a/tests/commands/upgrade.test.ts +++ b/tests/commands/upgrade.test.ts @@ -1,5 +1,7 @@ import { describe, expect, test } from "bun:test"; + import { Command } from "@commander-js/extra-typings"; + import { registerUpgradeCommand } from "../../src/commands/upgrade"; describe("registerUpgradeCommand", () => { diff --git a/tests/engine/context.test.ts b/tests/engine/context.test.ts index b42a18b9..f0a14000 100644 --- a/tests/engine/context.test.ts +++ b/tests/engine/context.test.ts @@ -1,7 +1,8 @@ import { describe, expect, test, beforeEach, afterEach } from "bun:test"; import { mkdtempSync, rmSync, mkdirSync, writeFileSync } from "node:fs"; -import { join } from "node:path"; import { tmpdir } from "node:os"; +import { join } from "node:path"; + import { extractAdrSections, briefAdr, @@ -97,9 +98,6 @@ describe("briefAdr", () => { makeAdr({ files: ["src/**/*.ts"] }, "## Decision\nX.") ); expect(briefing.files).toEqual(["src/**/*.ts"]); - }); - - test("files is undefined when ADR has no files globs", () => { expect(briefAdr(makeAdr({}, "## Decision\nX.")).files).toBeUndefined(); }); diff --git a/tests/engine/git-files.test.ts b/tests/engine/git-files.test.ts index 9f8ffd67..49f6370a 100644 --- a/tests/engine/git-files.test.ts +++ b/tests/engine/git-files.test.ts @@ -1,7 +1,8 @@ import { describe, expect, test, beforeEach, afterEach } from "bun:test"; import { mkdtempSync, rmSync, mkdirSync, writeFileSync } from "node:fs"; -import { join } from "node:path"; import { tmpdir } from "node:os"; +import { join } from "node:path"; + import { getGitTrackedFiles, getStagedFiles, diff --git a/tests/engine/loader.test.ts b/tests/engine/loader.test.ts index 30349ce6..0eba7ee5 100644 --- a/tests/engine/loader.test.ts +++ b/tests/engine/loader.test.ts @@ -6,8 +6,9 @@ import { copyFileSync, writeFileSync, } from "node:fs"; -import { join } from "node:path"; import { tmpdir } from "node:os"; +import { join } from "node:path"; + import { loadRuleAdrs } from "../../src/engine/loader"; // Absolute path to the real defineRules module (forward slashes for import specifiers) diff --git a/tests/engine/reporter.test.ts b/tests/engine/reporter.test.ts index 49d79d2d..23206040 100644 --- a/tests/engine/reporter.test.ts +++ b/tests/engine/reporter.test.ts @@ -1,4 +1,5 @@ import { describe, expect, test, beforeEach, afterEach, spyOn } from "bun:test"; + import { buildSummary, reportConsole, @@ -51,12 +52,7 @@ describe("reporter", () => { test("returns 1 when there are error violations", () => { const result = makeResult({ violations: [ - { - ruleId: "r", - adrId: "a", - message: "bad", - severity: "error", - }, + { ruleId: "r", adrId: "a", message: "bad", severity: "error" }, ], }); expect(getExitCode(result)).toBe(1); @@ -65,12 +61,7 @@ describe("reporter", () => { test("returns 0 when only warnings present", () => { const result = makeResult({ violations: [ - { - ruleId: "r", - adrId: "a", - message: "meh", - severity: "warning", - }, + { ruleId: "r", adrId: "a", message: "meh", severity: "warning" }, ], }); expect(getExitCode(result)).toBe(0); @@ -154,12 +145,7 @@ describe("reporter", () => { reportCI( makeResult({ violations: [ - { - ruleId: "r", - adrId: "a", - message: "info msg", - severity: "info", - }, + { ruleId: "r", adrId: "a", message: "info msg", severity: "info" }, ], }) ); diff --git a/tests/engine/runner.test.ts b/tests/engine/runner.test.ts index 6deebe09..55f7035e 100644 --- a/tests/engine/runner.test.ts +++ b/tests/engine/runner.test.ts @@ -1,11 +1,12 @@ import { describe, expect, test, beforeEach, afterEach } from "bun:test"; import { mkdtempSync, rmSync, mkdirSync, writeFileSync } from "node:fs"; -import { join } from "node:path"; import { tmpdir } from "node:os"; +import { join } from "node:path"; + +import type { LoadedAdr } from "../../src/engine/loader"; import { runChecks } from "../../src/engine/runner"; -import { defineRules } from "../../src/formats/rules"; import type { AdrDocument } from "../../src/formats/adr"; -import type { LoadedAdr } from "../../src/engine/loader"; +import { defineRules } from "../../src/formats/rules"; describe("runChecks", () => { let tempDir: string; @@ -222,10 +223,7 @@ describe("runChecks", () => { const loaded = makeLoadedAdr( {}, defineRules({ - "timing-test": { - description: "Test timing", - async check() {}, - }, + "timing-test": { description: "Test timing", async check() {} }, }) ); diff --git a/tests/formats/adr.test.ts b/tests/formats/adr.test.ts index 7ce64caf..b6430b81 100644 --- a/tests/formats/adr.test.ts +++ b/tests/formats/adr.test.ts @@ -1,5 +1,6 @@ import { describe, expect, test } from "bun:test"; import { join } from "node:path"; + import { parseAdr, parseFrontmatter } from "../../src/formats/adr"; const FIXTURES = join(import.meta.dir, "..", "fixtures"); diff --git a/tests/formats/rules.test.ts b/tests/formats/rules.test.ts index c1125557..1b484036 100644 --- a/tests/formats/rules.test.ts +++ b/tests/formats/rules.test.ts @@ -1,4 +1,5 @@ import { describe, expect, test } from "bun:test"; + import { defineRules } from "../../src/formats/rules"; import type { RuleConfig, RuleSet } from "../../src/formats/rules"; @@ -43,10 +44,7 @@ describe("defineRules", () => { test("defaults severity to undefined (engine applies 'error' default)", () => { const result = defineRules({ - "my-rule": { - description: "A rule", - check: async () => {}, - }, + "my-rule": { description: "A rule", check: async () => {} }, }); expect(result.rules["my-rule"].severity).toBeUndefined(); @@ -55,10 +53,7 @@ describe("defineRules", () => { test("preserves check function references", () => { const checkFn = async () => {}; const result = defineRules({ - "test-rule": { - description: "Test", - check: checkFn, - }, + "test-rule": { description: "Test", check: checkFn }, }); expect(result.rules["test-rule"].check).toBe(checkFn); @@ -66,10 +61,7 @@ describe("defineRules", () => { test("satisfies RuleSet type", () => { const result: RuleSet = defineRules({ - "typed-rule": { - description: "Typed", - check: async () => {}, - }, + "typed-rule": { description: "Typed", check: async () => {} }, }); expect(result.rules).toBeDefined(); diff --git a/tests/helpers/adr-templates.test.ts b/tests/helpers/adr-templates.test.ts index 4ac0cd55..710a286c 100644 --- a/tests/helpers/adr-templates.test.ts +++ b/tests/helpers/adr-templates.test.ts @@ -1,9 +1,10 @@ import { describe, expect, test } from "bun:test"; + +import { parseAdr } from "../../src/formats/adr"; import { generateExampleAdr, generateAdrTemplate, } from "../../src/helpers/adr-templates"; -import { parseAdr } from "../../src/formats/adr"; describe("generateExampleAdr", () => { test("produces a parseable ADR", () => { diff --git a/tests/helpers/adr-writer.test.ts b/tests/helpers/adr-writer.test.ts index 76737baf..67cca05f 100644 --- a/tests/helpers/adr-writer.test.ts +++ b/tests/helpers/adr-writer.test.ts @@ -6,8 +6,10 @@ import { writeFileSync, existsSync, } from "node:fs"; -import { join } from "node:path"; import { tmpdir } from "node:os"; +import { join } from "node:path"; + +import { parseAdr } from "../../src/formats/adr"; import { slugify, getNextId, @@ -16,7 +18,6 @@ import { findAdrFileById, updateAdrFile, } from "../../src/helpers/adr-writer"; -import { parseAdr } from "../../src/formats/adr"; describe("slugify", () => { test("converts title to lowercase kebab-case", () => { diff --git a/tests/helpers/auth.test.ts b/tests/helpers/auth.test.ts index 9cda859d..6757e4e7 100644 --- a/tests/helpers/auth.test.ts +++ b/tests/helpers/auth.test.ts @@ -1,7 +1,7 @@ import { describe, expect, test, beforeEach, afterEach, mock } from "bun:test"; import { mkdtempSync, rmSync } from "node:fs"; -import { join } from "node:path"; import { tmpdir } from "node:os"; +import { join } from "node:path"; /** Type-safe fetch mock — Bun's fetch type includes `preconnect` which mock() doesn't provide. */ function mockFetch(handler: () => Promise) { @@ -25,9 +25,8 @@ describe("auth", () => { describe("saveCredentials / loadCredentials", () => { test("round-trips credentials to ~/.archgate/credentials", async () => { - const { saveCredentials, loadCredentials } = await import( - "../../src/helpers/auth" - ); + const { saveCredentials, loadCredentials } = + await import("../../src/helpers/auth"); await saveCredentials({ token: "ag_beta_abc123", diff --git a/tests/helpers/claude-settings.test.ts b/tests/helpers/claude-settings.test.ts index 1f65ceba..36ba425f 100644 --- a/tests/helpers/claude-settings.test.ts +++ b/tests/helpers/claude-settings.test.ts @@ -1,7 +1,8 @@ import { describe, expect, test, beforeEach, afterEach } from "bun:test"; import { mkdtempSync, rmSync, existsSync, mkdirSync } from "node:fs"; -import { join } from "node:path"; import { tmpdir } from "node:os"; +import { join } from "node:path"; + import { ARCHGATE_CLAUDE_SETTINGS, mergeClaudeSettings, @@ -33,11 +34,7 @@ describe("mergeClaudeSettings", () => { test("appends permissions.allow with dedup", () => { const result = mergeClaudeSettings( - { - permissions: { - allow: ["Bash(git *)", "Skill(archgate:architect)"], - }, - }, + { permissions: { allow: ["Bash(git *)", "Skill(archgate:architect)"] } }, ARCHGATE_CLAUDE_SETTINGS ); @@ -52,12 +49,7 @@ describe("mergeClaudeSettings", () => { test("preserves existing deny permissions", () => { const result = mergeClaudeSettings( - { - permissions: { - allow: ["Bash(ls)"], - deny: ["Bash(rm -rf *)"], - }, - }, + { permissions: { allow: ["Bash(ls)"], deny: ["Bash(rm -rf *)"] } }, ARCHGATE_CLAUDE_SETTINGS ); @@ -68,10 +60,7 @@ describe("mergeClaudeSettings", () => { test("preserves unknown top-level keys", () => { const result = mergeClaudeSettings( - { - customSetting: "value", - anotherKey: 42, - }, + { customSetting: "value", anotherKey: 42 }, ARCHGATE_CLAUDE_SETTINGS ); @@ -121,10 +110,7 @@ describe("configureClaudeSettings", () => { const existingSettings = { agent: "my-custom-agent", myCustomKey: true, - permissions: { - allow: ["Bash(git *)"], - deny: ["Bash(rm *)"], - }, + permissions: { allow: ["Bash(git *)"], deny: ["Bash(rm *)"] }, }; await Bun.write( join(claudeDir, "settings.local.json"), diff --git a/tests/helpers/copilot-settings.test.ts b/tests/helpers/copilot-settings.test.ts index 525f922d..0a5f67af 100644 --- a/tests/helpers/copilot-settings.test.ts +++ b/tests/helpers/copilot-settings.test.ts @@ -1,7 +1,8 @@ import { describe, expect, test, beforeEach, afterEach } from "bun:test"; import { mkdtempSync, rmSync, existsSync } from "node:fs"; -import { join } from "node:path"; import { tmpdir } from "node:os"; +import { join } from "node:path"; + import { configureCopilotSettings } from "../../src/helpers/copilot-settings"; describe("configureCopilotSettings", () => { diff --git a/tests/helpers/cursor-settings.test.ts b/tests/helpers/cursor-settings.test.ts index 26f16aea..c4892321 100644 --- a/tests/helpers/cursor-settings.test.ts +++ b/tests/helpers/cursor-settings.test.ts @@ -1,7 +1,8 @@ import { describe, expect, test, beforeEach, afterEach } from "bun:test"; import { mkdtempSync, rmSync, existsSync } from "node:fs"; -import { join } from "node:path"; import { tmpdir } from "node:os"; +import { join } from "node:path"; + import { ARCHGATE_CURSOR_RULE, configureCursorSettings, diff --git a/tests/helpers/git.test.ts b/tests/helpers/git.test.ts index 18b98f34..214983e4 100644 --- a/tests/helpers/git.test.ts +++ b/tests/helpers/git.test.ts @@ -1,8 +1,10 @@ import { describe, expect, test, beforeEach, afterEach } from "bun:test"; import { mkdtempSync, rmSync, writeFileSync } from "node:fs"; -import { join } from "node:path"; import { tmpdir } from "node:os"; +import { join } from "node:path"; + import { $ } from "bun"; + import { getChangedFiles } from "../../src/helpers/git"; describe("getChangedFiles", () => { diff --git a/tests/helpers/init-project.test.ts b/tests/helpers/init-project.test.ts index f97f9428..849e7344 100644 --- a/tests/helpers/init-project.test.ts +++ b/tests/helpers/init-project.test.ts @@ -1,7 +1,8 @@ import { describe, expect, test, beforeEach, afterEach } from "bun:test"; import { mkdtempSync, rmSync, existsSync, mkdirSync } from "node:fs"; -import { join } from "node:path"; import { tmpdir } from "node:os"; +import { join } from "node:path"; + import { initProject } from "../../src/helpers/init-project"; describe("initProject", () => { diff --git a/tests/helpers/log.test.ts b/tests/helpers/log.test.ts index 2c24e765..5372d13b 100644 --- a/tests/helpers/log.test.ts +++ b/tests/helpers/log.test.ts @@ -1,4 +1,5 @@ import { describe, expect, test, beforeEach, afterEach, spyOn } from "bun:test"; + import { logDebug, logInfo, logError, logWarn } from "../../src/helpers/log"; describe("log helpers", () => { diff --git a/tests/helpers/paths.test.ts b/tests/helpers/paths.test.ts index ec1908bb..2e24e35d 100644 --- a/tests/helpers/paths.test.ts +++ b/tests/helpers/paths.test.ts @@ -1,7 +1,8 @@ import { describe, expect, test, beforeEach, afterEach } from "bun:test"; import { mkdtempSync, rmSync, mkdirSync } from "node:fs"; -import { join } from "node:path"; import { tmpdir } from "node:os"; +import { join } from "node:path"; + import { findProjectRoot } from "../../src/helpers/paths"; describe("findProjectRoot", () => { diff --git a/tests/helpers/platform.test.ts b/tests/helpers/platform.test.ts index 2d4a8af3..cb61a141 100644 --- a/tests/helpers/platform.test.ts +++ b/tests/helpers/platform.test.ts @@ -1,4 +1,5 @@ import { describe, expect, test, beforeEach, afterEach } from "bun:test"; + import { getPlatformInfo, isWSL, diff --git a/tests/helpers/plugin-install.test.ts b/tests/helpers/plugin-install.test.ts index 9a4fc696..1f7fb3db 100644 --- a/tests/helpers/plugin-install.test.ts +++ b/tests/helpers/plugin-install.test.ts @@ -1,4 +1,5 @@ import { describe, expect, test } from "bun:test"; + import { buildMarketplaceUrl, isClaudeCliAvailable, diff --git a/tests/helpers/session-context.test.ts b/tests/helpers/session-context.test.ts index c212af26..47aa123e 100644 --- a/tests/helpers/session-context.test.ts +++ b/tests/helpers/session-context.test.ts @@ -1,4 +1,5 @@ import { describe, expect, test } from "bun:test"; + import { encodeProjectPath, readClaudeCodeSession, diff --git a/tests/helpers/update-check.test.ts b/tests/helpers/update-check.test.ts index d4dc32a9..60899bd3 100644 --- a/tests/helpers/update-check.test.ts +++ b/tests/helpers/update-check.test.ts @@ -1,7 +1,7 @@ import { describe, expect, test, beforeEach, afterEach, mock } from "bun:test"; import { mkdtempSync, rmSync } from "node:fs"; -import { join } from "node:path"; import { tmpdir } from "node:os"; +import { join } from "node:path"; describe("checkForUpdatesIfNeeded", () => { let tempDir: string; @@ -93,10 +93,7 @@ describe("checkForUpdatesIfNeeded", () => { test("returns null when version is missing from response", async () => { const mockFetch = mock(() => - Promise.resolve({ - ok: true, - json: () => Promise.resolve({}), - }) + Promise.resolve({ ok: true, json: () => Promise.resolve({}) }) ); globalThis.fetch = mockFetch as unknown as typeof fetch; diff --git a/tests/helpers/vscode-settings.test.ts b/tests/helpers/vscode-settings.test.ts index 0bd6b714..5c1120f6 100644 --- a/tests/helpers/vscode-settings.test.ts +++ b/tests/helpers/vscode-settings.test.ts @@ -1,7 +1,8 @@ import { describe, expect, test, beforeEach, afterEach } from "bun:test"; import { mkdtempSync, rmSync, existsSync, mkdirSync } from "node:fs"; -import { join } from "node:path"; import { tmpdir } from "node:os"; +import { join } from "node:path"; + import { mergeMarketplaceUrl, configureVscodeSettings,