{"_id":"@ai-agencee/core","_rev":"5-8933e6aeb04ac42505186ea87e457817","name":"@ai-agencee/core","dist-tags":{"latest":"1.1.4"},"versions":{"1.1.0":{"name":"@ai-agencee/core","version":"1.1.0","_id":"@ai-agencee/core@1.1.0","maintainers":[{"name":"formular.dev","email":"pianatadeo@hotmail.com"}],"dist":{"shasum":"03a4d39c6d4ddb9b7237ade20b36ef16bec96346","tarball":"https://registry.npmjs.org/@ai-agencee/core/-/core-1.1.0.tgz","fileCount":48,"integrity":"sha512-ogPIKCKXrl0Yzn1smRArWkUArVyMuToh8LzxAlK6d4IhgFxKk7zE/LJiwHIzWpLFE4Ht2u6021aqRsvp+UxBug==","signatures":[{"sig":"MEQCIAhJO0TH1voQeQer5I/xlvQi14W5pvPEjmN8jJjg7+pFAiBn48lUCdDXpi0pheOo5i8dlwpz6JpEutWqUazsDX3v/g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":77416},"main":"./dist/src/index.js","type":"commonjs","_from":"file:ai-agencee-core-1.1.0.tgz","types":"./dist/src/index.d.ts","exports":{".":{"types":"./dist/src/index.d.ts","default":"./dist/src/index.js"}},"scripts":{"lint":"tsc --noEmit","test":"jest","build":"tsc && node scripts/copy-template.js"},"_npmUser":{"name":"formular.dev","email":"pianatadeo@hotmail.com"},"_resolved":"/tmp/ff3ff621b7df798e0f5de10d1b0ddd31/ai-agencee-core-1.1.0.tgz","_integrity":"sha512-ogPIKCKXrl0Yzn1smRArWkUArVyMuToh8LzxAlK6d4IhgFxKk7zE/LJiwHIzWpLFE4Ht2u6021aqRsvp+UxBug==","_npmVersion":"10.8.2","description":"Core utilities for AI Agencee","directories":{},"_nodeVersion":"20.20.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.2.0","ts-jest":"^29.1.5","typescript":"^5.4.5","@types/jest":"^30.0.0","@types/node":"^25.3.5"},"_npmOperationalInternal":{"tmp":"tmp/core_1.1.0_1772914834619_0.38893189532284356","host":"s3://npm-registry-packages-npm-production"},"deprecated":"This package is legacy and no longer maintained."},"1.1.2":{"name":"@ai-agencee/core","version":"1.1.2","_id":"@ai-agencee/core@1.1.2","maintainers":[{"name":"formular.dev","email":"pianatadeo@hotmail.com"}],"dist":{"shasum":"63ac04366fa85c6a10b40c1e941c79ed6e2c52c3","tarball":"https://registry.npmjs.org/@ai-agencee/core/-/core-1.1.2.tgz","fileCount":140,"integrity":"sha512-1JUzOe7D4rG45OhEVSMr24iv4mSlRzP17ND7PbM6e8xZN8pmzhw68kyOZa70SRa8YCcpBl+DB7vZmPivP3msPg==","signatures":[{"sig":"MEYCIQCVlmHomJW6QmBNzpBSJXmBShPoVE9cQBWzjNxZ4DLM7gIhANiEqjIEHsDp0axFSFciupqD2VU3XOUkBVh2iQmBS5WZ","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":115408},"main":"./dist/src/index.js","type":"commonjs","types":"./dist/src/index.d.ts","exports":{".":{"types":"./dist/src/index.d.ts","default":"./dist/src/index.js"}},"gitHead":"2c71955acc2619bcdc4a52698722db1302959c28","scripts":{"lint":"tsc --noEmit","test":"jest","build":"tsc && node scripts/copy-template.js","prepublishOnly":"pnpm run build"},"_npmUser":{"name":"formular.dev","email":"pianatadeo@hotmail.com"},"_npmVersion":"10.9.0","description":"Core utilities for AI Agencee","directories":{},"_nodeVersion":"24.12.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.3.0","ts-jest":"^29.4.9","typescript":"^5.9.3","@types/jest":"^30.0.0","@types/node":"^25.6.0"},"_npmOperationalInternal":{"tmp":"tmp/core_1.1.2_1778145509399_0.8767379907726078","host":"s3://npm-registry-packages-npm-production"},"deprecated":"This package is legacy and no longer maintained."},"1.1.3":{"name":"@ai-agencee/core","version":"1.1.3","_id":"@ai-agencee/core@1.1.3","maintainers":[{"name":"formular.dev","email":"pianatadeo@hotmail.com"}],"dist":{"shasum":"f5d18557fcdcbc242c524b38636caef937164377","tarball":"https://registry.npmjs.org/@ai-agencee/core/-/core-1.1.3.tgz","fileCount":140,"integrity":"sha512-lkQMFGDlEWspNtpcDKVefp4EwqBVMa9+p6JLVv8oKMgnoOppMWckvC968k9Xp9E3kus09fHG0Oow4CFNgVlx7w==","signatures":[{"sig":"MEUCIQCrxO2V4HYCyNqcrXcfDg+0EUSnTTN/rWSvn2hAEIpTBQIgLiix/fYEdRp0ZIspHH6gmPz4IfIUv7azyBrCtqxC8Xw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":115408},"main":"./dist/src/index.js","type":"commonjs","types":"./dist/src/index.d.ts","exports":{".":{"types":"./dist/src/index.d.ts","default":"./dist/src/index.js"}},"gitHead":"057758a6bf88ee28e086d4976f26e2d4ecfbe7b0","scripts":{"lint":"tsc --noEmit","test":"jest","build":"tsc && node scripts/copy-template.js","prepublishOnly":"pnpm run build"},"_npmUser":{"name":"formular.dev","email":"pianatadeo@hotmail.com"},"_npmVersion":"10.9.0","description":"Core utilities for AI Agencee","directories":{},"_nodeVersion":"24.12.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.3.0","ts-jest":"^29.4.9","typescript":"^5.9.3","@types/jest":"^30.0.0","@types/node":"^25.6.0"},"_npmOperationalInternal":{"tmp":"tmp/core_1.1.3_1778145600946_0.23331731076191975","host":"s3://npm-registry-packages-npm-production"},"deprecated":"This package is legacy and no longer maintained."},"1.1.4":{"name":"@ai-agencee/core","version":"1.1.4","_id":"@ai-agencee/core@1.1.4","maintainers":[{"name":"formular.dev","email":"pianatadeo@hotmail.com"}],"dist":{"shasum":"9a1755d9f9e027cec723f7daf5c454d8ca6d75a4","tarball":"https://registry.npmjs.org/@ai-agencee/core/-/core-1.1.4.tgz","fileCount":140,"integrity":"sha512-X/n5LBKIW6XXh4gefLpI8hT0TUtrCGP5chBnZs2iNkOcO3t5IG8o4v/dKiQR/31Tg1hLRNVOpyfQbkZ0h6w7CA==","signatures":[{"sig":"MEUCIQCG9IyL14cs6RwUwOotqUY4bi0j0+U/MmsAb3aCUK46SgIgNmnlfc9LPK3QWQG7k3nb+pjwq2q8GbWzQE+qdID1OI4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":115408},"main":"./dist/src/index.js","type":"commonjs","types":"./dist/src/index.d.ts","exports":{".":{"types":"./dist/src/index.d.ts","default":"./dist/src/index.js"}},"gitHead":"057758a6bf88ee28e086d4976f26e2d4ecfbe7b0","scripts":{"lint":"tsc --noEmit","test":"jest","build":"tsc && node scripts/copy-template.js","prepublishOnly":"pnpm run build"},"_npmUser":{"name":"formular.dev","email":"pianatadeo@hotmail.com"},"_npmVersion":"10.9.0","description":"Core utilities for AI Agencee","directories":{},"_nodeVersion":"24.12.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.3.0","ts-jest":"^29.4.9","typescript":"^5.9.3","@types/jest":"^30.0.0","@types/node":"^25.6.0"},"_npmOperationalInternal":{"tmp":"tmp/core_1.1.4_1778145953482_0.831671413192379","host":"s3://npm-registry-packages-npm-production"},"deprecated":"This package is legacy and no longer maintained."}},"time":{"created":"2026-03-07T20:20:34.563Z","modified":"2026-07-01T08:49:55.445Z","1.1.0":"2026-03-07T20:20:34.804Z","1.1.2":"2026-05-07T09:18:29.545Z","1.1.3":"2026-05-07T09:20:01.095Z","1.1.4":"2026-05-07T09:25:53.668Z"},"description":"Core utilities for AI Agencee","maintainers":[{"name":"formular.dev","email":"pianatadeo@hotmail.com"}],"readme":"# @ai-agencee/core\r\n\r\n[![npm](https://img.shields.io/npm/v/@ai-agencee/core)](https://www.npmjs.com/package/@ai-agencee/core)\r\n[![license](https://img.shields.io/npm/l/@ai-agencee/core)](https://github.com/binaryjack/ai-agencee/blob/main/LICENSE)\r\n\r\nFoundation utilities for the **AI Agencee** toolkit. Provides async file-system helpers, project validation, and a template scaffolding/sync system used by [`@ai-agencee/cli`](https://www.npmjs.com/package/@ai-agencee/cli) and [`@ai-agencee/engine`](https://www.npmjs.com/package/@ai-agencee/engine).\r\n\r\n---\r\n\r\n## Installation\r\n\r\n```bash\r\nnpm install @ai-agencee/core\r\n# or\r\npnpm add @ai-agencee/core\r\n```\r\n\r\n> **Node ≥ 20** required. CommonJS module.\r\n\r\n---\r\n\r\n## API\r\n\r\n### File System\r\n\r\nAsync wrappers over `fs/promises` with safe directory creation.\r\n\r\n```ts\r\nimport {\r\n  fileExists,\r\n  readFile,\r\n  writeFile,\r\n  listFilesRecursive,\r\n  copyTemplateFiles,\r\n  syncTemplateFiles,\r\n} from '@ai-agencee/core';\r\n```\r\n\r\n#### `fileExists(filePath: string): Promise<boolean>`\r\n\r\nReturns `true` if the path is accessible, `false` otherwise. Never throws.\r\n\r\n```ts\r\nif (await fileExists('./src/.ai/rules.md')) {\r\n  // already initialised\r\n}\r\n```\r\n\r\n#### `readFile(filePath: string): Promise<string>`\r\n\r\nReads a file as UTF-8 text.\r\n\r\n#### `writeFile(filePath: string, content: string): Promise<void>`\r\n\r\nWrites `content` to `filePath`. Creates all parent directories automatically.\r\n\r\n#### `listFilesRecursive(dir: string): Promise<string[]>`\r\n\r\nReturns the absolute paths of every file under `dir`, traversing subdirectories.\r\n\r\n```ts\r\nconst files = await listFilesRecursive('./src');\r\n// [ '/abs/path/src/index.ts', '/abs/path/src/utils/helper.ts', … ]\r\n```\r\n\r\n#### `copyTemplateFiles(src, dest, confirm): Promise<string[]>`\r\n\r\nCopies all files from `src` into `dest`. For each destination path, calls `confirm(filePath)` — only copies when `confirm` returns `true`. Returns the list of files actually written.\r\n\r\n```ts\r\nconst written = await copyTemplateFiles(templateDir, projectDir, async (dest) => {\r\n  if (await fileExists(dest)) {\r\n    const answer = await prompt(`Overwrite ${dest}? [y/N] `);\r\n    return answer === 'y';\r\n  }\r\n  return true;\r\n});\r\n```\r\n\r\n#### `syncTemplateFiles(src, dest): Promise<SyncResult[]>`\r\n\r\nCompares every file in `src` to `dest`. Writes files that are missing or diverged, leaves identical files untouched.\r\n\r\n```ts\r\nexport interface SyncResult {\r\n  path: string;\r\n  status: 'updated' | 'ok' | 'diverged';\r\n}\r\n```\r\n\r\n| Status | Meaning |\r\n|--------|---------|\r\n| `updated` | File was missing in dest — created |\r\n| `diverged` | File existed but differed — overwritten with template version |\r\n| `ok` | File matched template — no action |\r\n\r\n---\r\n\r\n### Project Validation\r\n\r\n```ts\r\nimport { checkProject, CheckResult } from '@ai-agencee/core';\r\n```\r\n\r\n#### `checkProject(projectDir: string): Promise<CheckResult[]>`\r\n\r\nRuns three categories of rules against a project directory:\r\n\r\n1. **Required-file checks** — verifies every entry in `REQUIRED_FILES` exists.\r\n2. **Naming checks** — asserts all source file base-names are `kebab-case`.\r\n3. **Forbidden-pattern checks** — scans `.ts`/`.tsx`/`.js`/`.jsx` files for patterns in `FORBIDDEN_PATTERNS`.\r\n\r\n```ts\r\nexport interface CheckResult {\r\n  rule: string;   // e.g. 'required-file:.github/copilot-instructions.md'\r\n  pass: boolean;\r\n  message: string; // empty when pass === true\r\n}\r\n\r\nconst results = await checkProject('./my-project');\r\nfor (const r of results) {\r\n  if (!r.pass) console.error(`FAIL ${r.rule}: ${r.message}`);\r\n}\r\n```\r\n\r\n---\r\n\r\n### Template Loading\r\n\r\n```ts\r\nimport { loadTemplateFiles, TemplateFile } from '@ai-agencee/core';\r\n```\r\n\r\n#### `loadTemplateFiles(): Promise<TemplateFile[]>`\r\n\r\nReads every file bundled inside the package's `template/` directory and returns their relative paths and contents. Used by the CLI and MCP server to stream template content to AI assistants.\r\n\r\n```ts\r\nexport interface TemplateFile {\r\n  relativePath: string;  // e.g. '.github/copilot-instructions.md'\r\n  content: string;\r\n}\r\n```\r\n\r\n---\r\n\r\n### Constants\r\n\r\n```ts\r\nimport { TEMPLATE_DIR, REQUIRED_FILES, FORBIDDEN_PATTERNS } from '@ai-agencee/core';\r\n```\r\n\r\n| Constant | Type | Description |\r\n|----------|------|-------------|\r\n| `TEMPLATE_DIR` | `string` | Absolute path to the bundled template directory |\r\n| `REQUIRED_FILES` | `string[]` | Relative paths that must exist in a valid project |\r\n| `FORBIDDEN_PATTERNS` | `string[]` | Code substrings that must not appear (`class `, ` any `, `useImperativeHandle`) |\r\n\r\n**Required files enforced:**\r\n```\r\n.github/copilot-instructions.md\r\n.github/ai/manifest.xml\r\n.github/ai/pipeline.xml\r\n.github/ai/architecture-rules.xml\r\n.github/ai/quality-gates.xml\r\nsrc/.ai/bootstrap.md\r\nsrc/.ai/rules.md\r\nsrc/.ai/patterns.md\r\n```\r\n\r\n---\r\n\r\n## Bundled Template\r\n\r\nWhen you install this package, a ready-to-use project template ships inside `dist/template/`. It contains the complete set of AI rule files referenced by `REQUIRED_FILES`:\r\n\r\n- **`.github/copilot-instructions.md`** — Copilot/Claude session configuration with ULTRA_HIGH standards\r\n- **`.github/ai/manifest.xml`** — Project capabilities manifest\r\n- **`.github/ai/pipeline.xml`** — CI/CD pipeline rules\r\n- **`.github/ai/architecture-rules.xml`** — Architecture constraints\r\n- **`.github/ai/quality-gates.xml`** — Quality gate thresholds\r\n- **`src/.ai/bootstrap.md`** — Session bootstrap guide\r\n- **`src/.ai/rules.md`** — Coding rules reference\r\n- **`src/.ai/patterns.md`** — Design patterns reference\r\n\r\nUse `ai-kit init` (from [`@ai-agencee/cli`](https://www.npmjs.com/package/@ai-agencee/cli)) to scaffold these files into your project.\r\n\r\n---\r\n\r\n## Related Packages\r\n\r\n| Package | Description |\r\n|---------|-------------|\r\n| [`@ai-agencee/engine`](https://www.npmjs.com/package/@ai-agencee/engine) | Multi-lane supervised DAG execution engine |\r\n| [`@ai-agencee/mcp`](https://www.npmjs.com/package/@ai-agencee/mcp) | MCP server for AI assistant integration |\r\n| [`@ai-agencee/cli`](https://www.npmjs.com/package/@ai-agencee/cli) | CLI tool — `ai-kit init / sync / check / agent:dag` |\r\n\r\n---\r\n\r\n## License\r\n\r\nMIT — see [LICENSE](https://github.com/binaryjack/ai-agencee/blob/main/LICENSE)\r\n","readmeFilename":"README.md"}