Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 04:45 UTC
| 1 | // Guards the CLI's Effect platform boundaries: every eslint-disable comment in |
| 2 | // src/ must be a single-line `eslint-disable-next-line` with a `-- reason` |
| 3 | // justification, and must be registered in lint-boundaries.json. The manifest |
| 4 | // pins each rule, justification, and governed next-line target, so adding or |
| 5 | // relocating a disable fails until the manifest is regenerated on purpose (see |
| 6 | // AGENTS.md, "Effect Boundary Policy"). |
| 7 | // |
| 8 | // Usage: |
| 9 | // tsx ./scripts/validate-lint-boundaries.ts # verify (CI) |
| 10 | // tsx ./scripts/validate-lint-boundaries.ts --update # regenerate manifest |
| 11 | import * as fs from 'node:fs'; |
| 12 | import * as path from 'node:path'; |
| 13 | |
| 14 | import { |
| 15 | collectBoundaryManifest, |
| 16 | compareBoundaryManifests, |
| 17 | countBoundarySites, |
| 18 | type BoundaryManifest, |
| 19 | } from './lint-boundaries'; |
| 20 | |
| 21 | const scriptDir = import.meta.dirname ?? path.dirname(new URL(import.meta.url).pathname); |
| 22 | const packageRoot = path.resolve(scriptDir, '..'); |
| 23 | const srcRoot = path.join(packageRoot, 'src'); |
| 24 | const manifestPath = path.join(packageRoot, 'lint-boundaries.json'); |
| 25 | |
| 26 | const collected = collectBoundaryManifest(packageRoot, srcRoot); |
| 27 | const errors = [...collected.errors]; |
| 28 | const found = collected.manifest; |
| 29 | |
| 30 | if (process.argv.includes('--update')) { |
| 31 | if (errors.length > 0) { |
| 32 | console.error(errors.join('\n')); |
| 33 | console.error('\nFix the malformed disables above before regenerating the manifest.'); |
| 34 | process.exit(1); |
| 35 | } |
| 36 | fs.writeFileSync(manifestPath, `${JSON.stringify(found, null, 2)}\n`); |
| 37 | console.log( |
| 38 | `Wrote ${path.relative(packageRoot, manifestPath)} (${Object.keys(found).length} files).` |
| 39 | ); |
| 40 | process.exit(0); |
| 41 | } |
| 42 | |
| 43 | const manifest: BoundaryManifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8')); |
| 44 | errors.push(...compareBoundaryManifests(found, manifest)); |
| 45 | |
| 46 | if (errors.length > 0) { |
| 47 | console.error(errors.join('\n')); |
| 48 | process.exit(1); |
| 49 | } |
| 50 | |
| 51 | console.log( |
| 52 | `lint boundaries OK: ${countBoundarySites(found)} registered disables across ${Object.keys(found).length} files.` |
| 53 | ); |