{"_id":"@cognium/project-profile-detect","_rev":"4-967075d099828a0593b1fd341c873be6","name":"@cognium/project-profile-detect","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"@cognium/project-profile-detect","version":"1.0.0","keywords":["sast","project-profile","maven","gradle","monorepo","circle-ir","cognium"],"author":{"url":"https://cognium.dev","name":"Cognium Labs"},"license":"MIT","_id":"@cognium/project-profile-detect@1.0.0","maintainers":[{"name":"openmason","email":"openmason@gmail.com"}],"homepage":"https://github.com/cogniumhq/cognium-dev/tree/main/packages/project-profile-detect#readme","bugs":{"url":"https://github.com/cogniumhq/cognium-dev/issues"},"dist":{"shasum":"bb36c182262bff1194ce50163b432a246221e851","tarball":"https://registry.npmjs.org/@cognium/project-profile-detect/-/project-profile-detect-1.0.0.tgz","fileCount":39,"integrity":"sha512-5vuqrQp6bp7g/rvGGtso2OOkNXQtrww3VcoDJv8bnIFnhy9PfTeMAk9c01YyHfO4gWDa0j8alabynHOQsYIWcA==","signatures":[{"sig":"MEUCIGFl9OU3WZ4XSZ0AuBFZ263f5rbpAlpuOoS8EKdyIwUYAiEAik0DEwedj7sW9/vDOB111dmWvD81XSrLHqs29EkQJbU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":67294},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=20.19.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./package.json":"./package.json"},"gitHead":"8dbd6fe6b7a12fd61bc1033eddb909d637049cac","scripts":{"test":"bun test","build":"tsc","clean":"rm -rf dist *.tsbuildinfo","typecheck":"tsc --noEmit"},"_npmUser":{"name":"openmason","email":"openmason@gmail.com"},"repository":{"url":"git+https://github.com/cogniumhq/cognium-dev.git","type":"git","directory":"packages/project-profile-detect"},"_npmVersion":"11.13.0","description":"Detect project shape (library/application/cli/server/plugin) × environment (production/dev/sample/benchmark/test) from Maven/Gradle build files. Companion to circle-ir.","directories":{},"sideEffects":false,"_nodeVersion":"24.16.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"bun-types":"^1.3.11","circle-ir":"^3.106.0","typescript":"^6.0.2","@types/node":"^25.5.0"},"peerDependencies":{"circle-ir":">=3.106.0"},"_npmOperationalInternal":{"tmp":"tmp/project-profile-detect_1.0.0_1782344160499_0.38209899583176843","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@cognium/project-profile-detect","version":"1.1.0","keywords":["sast","project-profile","maven","gradle","monorepo","circle-ir","cognium"],"author":{"url":"https://cognium.dev","name":"Cognium Labs"},"license":"MIT","_id":"@cognium/project-profile-detect@1.1.0","maintainers":[{"name":"openmason","email":"openmason@gmail.com"}],"homepage":"https://github.com/cogniumhq/cognium-dev/tree/main/packages/project-profile-detect#readme","bugs":{"url":"https://github.com/cogniumhq/cognium-dev/issues"},"dist":{"shasum":"4e0c51f53cdb78d72786add1d4842f8107b57790","tarball":"https://registry.npmjs.org/@cognium/project-profile-detect/-/project-profile-detect-1.1.0.tgz","fileCount":39,"integrity":"sha512-Vk0HdvXcu+b7jqA6hS+04aUAjvQSRSRw3+OQ6vQexTV1KTVHlEcCzCU1ykRq0e7fugdm5vDvvI1TnX46mKthXQ==","signatures":[{"sig":"MEQCIAZvhM7hEsuDKnHnCTRrIcLSF9NnMW5hHAH2VSGtQOKoAiByKmniAy3sizyscBsssYM9C67pXNh0qQGg301QryXL/w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":67294},"main":"dist/index.js","type":"module","types":"dist/index.d.ts","engines":{"node":">=20.19.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./package.json":"./package.json"},"gitHead":"8dbd6fe6b7a12fd61bc1033eddb909d637049cac","scripts":{"test":"bun test","build":"tsc","clean":"rm -rf dist *.tsbuildinfo","typecheck":"tsc --noEmit"},"_npmUser":{"name":"openmason","email":"openmason@gmail.com"},"repository":{"url":"git+https://github.com/cogniumhq/cognium-dev.git","type":"git","directory":"packages/project-profile-detect"},"_npmVersion":"11.13.0","description":"Detect project shape (library/application/cli/server/plugin) × environment (production/dev/sample/benchmark/test) from Maven/Gradle build files. Companion to circle-ir.","directories":{},"sideEffects":false,"_nodeVersion":"24.16.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"bun-types":"^1.3.11","circle-ir":"^3.106.0","typescript":"^6.0.2","@types/node":"^25.5.0"},"peerDependencies":{"circle-ir":">=3.106.0"},"_npmOperationalInternal":{"tmp":"tmp/project-profile-detect_1.1.0_1782371183510_0.365247788889421","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@cognium/project-profile-detect","version":"1.1.1","description":"Detect project shape (library/application/cli/server/plugin) × environment (production/dev/sample/benchmark/test) from Maven/Gradle build files. Companion to circle-ir.","main":"dist/index.js","types":"dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./package.json":"./package.json"},"sideEffects":false,"scripts":{"build":"tsc","typecheck":"tsc --noEmit","test":"bun test","clean":"rm -rf dist *.tsbuildinfo"},"keywords":["sast","project-profile","maven","gradle","monorepo","circle-ir","cognium"],"author":{"name":"Cognium Labs","url":"https://cognium.dev"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/cogniumhq/cognium-dev.git","directory":"packages/project-profile-detect"},"homepage":"https://github.com/cogniumhq/cognium-dev/tree/main/packages/project-profile-detect#readme","bugs":{"url":"https://github.com/cogniumhq/cognium-dev/issues"},"engines":{"node":">=20.19.0"},"type":"module","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"peerDependencies":{"circle-ir":">=4.0.0"},"devDependencies":{"@types/node":"^25.5.0","bun-types":"^1.3.11","circle-ir":"^4.9.11","typescript":"^6.0.2"},"gitHead":"6c811aa5343e3084c1eb78c3871327dd24b886c7","_id":"@cognium/project-profile-detect@1.1.1","_nodeVersion":"26.0.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-KS9+ZTG+uJXdTdofWZvyDMRurOfv8goxoqEe5mskH3d6SSZcVsHy6bjoCO3QUQdFLyLJXZY3lGUTZ/hsqqorxw==","shasum":"d14ca13d234ff9ebd2c0618a7fb4c0032a3ba658","tarball":"https://registry.npmjs.org/@cognium/project-profile-detect/-/project-profile-detect-1.1.1.tgz","fileCount":43,"unpackedSize":84882,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCtjnAVJkpvYPRhw8d5HI272FVt56K7L58sFUrfbgB0dAIhAKfPPpgGfVDS248Cca3+1f26j0uezLvq+aE6V6jxLo0n"}]},"_npmUser":{"name":"elarasu","email":"elarasu@gmail.com"},"directories":{},"maintainers":[{"name":"openmason","email":"openmason@gmail.com"},{"name":"elarasu","email":"elarasu@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/project-profile-detect_1.1.1_1789021395198_0.9092650194140142"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-24T23:36:00.303Z","modified":"2026-09-10T06:23:15.490Z","1.0.0":"2026-06-24T23:36:00.653Z","1.1.0":"2026-06-25T07:06:23.640Z","1.1.1":"2026-09-10T06:23:15.329Z"},"bugs":{"url":"https://github.com/cogniumhq/cognium-dev/issues"},"author":{"name":"Cognium Labs","url":"https://cognium.dev"},"license":"MIT","homepage":"https://github.com/cogniumhq/cognium-dev/tree/main/packages/project-profile-detect#readme","keywords":["sast","project-profile","maven","gradle","monorepo","circle-ir","cognium"],"repository":{"type":"git","url":"git+https://github.com/cogniumhq/cognium-dev.git","directory":"packages/project-profile-detect"},"description":"Detect project shape (library/application/cli/server/plugin) × environment (production/dev/sample/benchmark/test) from Maven/Gradle build files. Companion to circle-ir.","maintainers":[{"name":"openmason","email":"openmason@gmail.com"},{"name":"elarasu","email":"elarasu@gmail.com"}],"readme":"# @cognium/project-profile-detect\n\nDetect a Java project's **shape** (`library` / `application` / `cli` / `server` / `plugin`) and **environment** (`production` / `dev` / `sample` / `benchmark` / `test`) from its Maven/Gradle build files. Designed as a caller-side companion to [`circle-ir`](https://www.npmjs.com/package/circle-ir): the detector walks the filesystem and produces a per-file `ProjectProfile` map that circle-ir's `analyzeOptions.projectProfile` consumes.\n\n## Install\n\n```bash\nnpm install @cognium/project-profile-detect circle-ir\n```\n\n`circle-ir` is a **peer dependency** — `ProjectProfile`, `ProjectShape`, and `ProjectEnv` types are owned by circle-ir and re-exported from this package.\n\n## Usage\n\n```ts\nimport { detectProjectProfiles } from '@cognium/project-profile-detect';\nimport { analyzeProject } from 'circle-ir';\n\nconst detection = await detectProjectProfiles(scanRoot, {\n  // Optional: force a single profile for every file in the scan.\n  forcedProfile: 'library/production',\n  // Optional: glob → profile overrides (from cognium.config.json or similar).\n  overrides: {\n    'samples/**': 'sample/dev',\n    'integration-tests/**': 'application/test',\n  },\n});\n\nconst result = await analyzeProject(files, {\n  projectProfile: detection.profileByFile,   // Map<absolutePath, ProjectProfile>\n});\n```\n\n`DetectionResult` shape:\n\n```ts\ninterface DetectionResult {\n  /** Per-file profile mapping (absolute paths). */\n  profileByFile: Map<string, ProjectProfile>;\n  /** Per-module resolution details (for explain output). */\n  modules: ResolvedModule[];\n  /** Files that fell back to 'unknown' (no enclosing module). */\n  unknownFiles: string[];\n}\n```\n\n## Shape resolution\n\nPrecedence ladder (highest first):\n\n1. `spring-boot` plugin → `server`\n2. `war` / `ear` packaging → `server`\n3. `maven-plugin` / `java-gradle-plugin` → `plugin`\n4. Gradle `application` plugin → `application`\n5. Source file declares `public static void main(String[])` → `application`\n6. `java-library` plugin / `module-info.java` / `META-INF/services/` — **hybrid-gated**: only resolves to `library` if the module's distribution URL is on the public-registry allowlist; otherwise falls back to `application` (internal helper library).\n7. Otherwise → `unknown`\n\n### Public-registry allowlist\n\nOnly these hosts flip the `java-library` signal to `library` (corporate Nexus / Artifactory does NOT count):\n\n- `repo.maven.apache.org`\n- `repo1.maven.org`\n- `oss.sonatype.org`\n- `s01.oss.sonatype.org`\n- `central.sonatype.com`\n- `central.sonatype.org`\n- `plugins.gradle.org`\n- `jcenter.bintray.com`\n\n## Environment resolution\n\nPath-based, evaluated **per file**:\n\n| Path contains | Environment |\n|---|---|\n| `/test/` or `/tests/` | `test` |\n| `/samples/`, `/examples/`, `/demo/` | `sample` |\n| `/benchmarks/`, `/benchmark/`, `/perf/` | `benchmark` |\n| `/src/main/` | `production` |\n| anything else | `dev` |\n\n## Why caller-side?\n\n`circle-ir` runs in both Node and browser environments and never reads the filesystem (Pillar I — browser/Node compatibility). Project-profile detection is the caller's responsibility; this package is the reference Node implementation.\n\nSee [`circle-ir/docs/ARCHITECTURE.md`](https://github.com/cogniumhq/cognium-dev/blob/main/packages/circle-ir/docs/ARCHITECTURE.md) ADR-008 for the full decision tree and severity-transform contract.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}