diff --git a/.dockerignore b/.dockerignore index e4142a4d..21507c8c 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,4 +6,4 @@ docs/ tests/ .github/ helm/ -src/osscodeiq/ +src/codeiq/ diff --git a/.github/workflows/ci-java.yml b/.github/workflows/ci-java.yml index 7521dab9..3c030510 100644 --- a/.github/workflows/ci-java.yml +++ b/.github/workflows/ci-java.yml @@ -34,7 +34,7 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: > mvn sonar:sonar -B - -Dsonar.projectKey=RandomCodeSpace_code-iq + -Dsonar.projectKey=RandomCodeSpace_codeiq -Dsonar.organization=randomcodespace -Dsonar.host.url=https://sonarcloud.io "-Dsonar.exclusions=**/grammar/**,target/generated-sources/**" diff --git a/.gitignore b/.gitignore index 1fbaf9b0..27dc9fa8 100644 --- a/.gitignore +++ b/.gitignore @@ -21,9 +21,7 @@ target/ Thumbs.db # Project runtime data -.osscodeiq/ -.code-intelligence/ -.code_intelligence_cache*/ +.codeiq/ *.db *.db-wal *.db-shm diff --git a/CLAUDE.md b/CLAUDE.md index 4c319a34..3239294f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,16 +1,16 @@ -# Code IQ (Java) -- Project Instructions +# codeiq (Java) -- Project Instructions ## What This Project Is -**Code IQ** -- a CLI tool + server that scans codebases to build a deterministic code knowledge graph. No AI, no external APIs -- pure static analysis. 97 detectors, 35+ languages, Neo4j Embedded graph database, Spring AI MCP server, REST API, web UI. +**codeiq** -- a CLI tool + server that scans codebases to build a deterministic code knowledge graph. No AI, no external APIs -- pure static analysis. 97 detectors, 35+ languages, Neo4j Embedded graph database, Spring AI MCP server, REST API, web UI. -- **Maven coordinates:** `io.github.randomcodespace.iq:code-iq` -- **CLI command:** `code-iq` (via `java -jar`) +- **Maven coordinates:** `io.github.randomcodespace.iq:code-iq` (artifactId intentionally unchanged) +- **CLI command:** `codeiq` (via `java -jar`; JAR filename remains `code-iq-*-cli.jar`) - **Java package:** `io.github.randomcodespace.iq` (under `src/main/java/`) -- **GitHub repo:** `RandomCodeSpace/code-iq` (branch: `main`) -- **Cache directory on disk:** `.code-intelligence` (H2 analysis cache) -- **Neo4j directory on disk:** `.osscodeiq/graph.db` (enriched graph) -- **Config file:** `.osscodeiq.yml` (project-level overrides) +- **GitHub repo:** `RandomCodeSpace/codeiq` (branch: `main`) +- **Cache directory on disk:** `.codeiq/cache` (H2 analysis cache) +- **Neo4j directory on disk:** `.codeiq/graph/graph.db` (enriched graph) +- **Config file:** `codeiq.yml` (project-level overrides) ## Tech Stack @@ -30,12 +30,12 @@ ``` Developer machine: - code-iq index /repo → H2 cache (.code-intelligence/) - code-iq enrich /repo → Neo4j (.osscodeiq/graph.db) - code-iq bundle /repo → bundle.zip (graph + source snapshot) + codeiq index /repo → H2 cache (.codeiq/cache/) + codeiq enrich /repo → Neo4j (.codeiq/graph/graph.db) + codeiq bundle /repo → bundle.zip (graph + source snapshot) Remote server (or local): - code-iq serve /repo → read-only API + MCP + UI (from Neo4j) + codeiq serve /repo → read-only API + MCP + UI (from Neo4j) ``` **Key principle:** MCP and API are strictly **read-only**. No data manipulation from the serving layer. Analysis happens only via CLI (`index`/`enrich`). The remote server may not have source code access (bundle deployment model). @@ -164,13 +164,13 @@ io.github.randomcodespace.iq ```bash # For large codebases (44K+ files): -code-iq index /path/to/repo # ~220s for 44K files, writes to H2 -code-iq enrich /path/to/repo # loads H2 → Neo4j with linkers/layers/services -code-iq serve /path/to/repo # read-only server +codeiq index /path/to/repo # ~220s for 44K files, writes to H2 +codeiq enrich /path/to/repo # loads H2 → Neo4j with linkers/layers/services +codeiq serve /path/to/repo # read-only server # For small codebases: -code-iq analyze /path/to/repo # in-memory, all-in-one -code-iq serve /path/to/repo # needs enrich if using index +codeiq analyze /path/to/repo # in-memory, all-in-one +codeiq serve /path/to/repo # needs enrich if using index ``` ## Server Endpoints (all read-only) @@ -380,13 +380,13 @@ camelCase accepted as a deprecated alias for one release). Resolution order 2. `~/.codeiq/config.yml` (user-global) 3. `./codeiq.yml` (project) 4. `CODEIQ_
_` env vars (e.g. `CODEIQ_SERVING_PORT=9090`) -5. CLI flags on `code-iq ` +5. CLI flags on `codeiq ` Validate and introspect with: ```bash -code-iq config validate -code-iq config explain +codeiq config validate +codeiq config explain ``` ### Spring-owned keys (stay in `application.yml`) @@ -404,14 +404,6 @@ have not been migrated into `codeiq.yml`: `UnifiedConfigBeans` bridges the unified config to the legacy `CodeIqConfig` bean for code paths that haven't been ported yet. -### `.osscodeiq.yml` deprecation - -`.osscodeiq.yml` is deprecated. `ProjectConfigLoader` still loads it for one -release, translates its legacy flat keys into the unified nested shape, and -logs a one-time WARN per canonical path. Rename to `codeiq.yml` and migrate -flat keys into the `project:` / `indexing:` / `serving:` / `mcp:` / -`observability:` / `detectors:` sections. - ## Gotchas & Lessons Learned - **Pipeline is index → enrich → serve**: Don't put analysis/enrichment in serve. Serve is read-only. @@ -434,7 +426,7 @@ flat keys into the `project:` / `indexing:` / `serving:` / `mcp:` / - **SnakeYAML parses `on` as Boolean.TRUE**: In YAML files, bare `on` key becomes `Boolean.TRUE`. Use `String.valueOf(key)` comparisons, not `Boolean.TRUE.equals(key)` (SonarCloud S2159). - **Regex possessive quantifiers**: Use `*+` instead of `*` for nested quantifiers like `([^"\\]*(?:\\.[^"\\]*)*)` → `([^"\\]*+(?:\\.[^"\\]*+)*+)` to prevent stack overflow (SonarCloud S5998). - **Parallel agent conflicts**: Don't dispatch multiple agents editing the same files concurrently. Use worktree isolation or sequential execution. -- **SonarCloud project key**: `RandomCodeSpace_code-iq`, org: `randomcodespace` +- **SonarCloud project key**: `RandomCodeSpace_codeiq`, org: `randomcodespace` - **CI workflow**: Single `ci-java.yml` runs build + SonarCloud analysis. No cross-platform builds needed (JVM). ## Updating This File diff --git a/README.md b/README.md index 6dc16978..d04f7fd3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

-

Code IQ

+

codeiq

Deterministic code knowledge graph -- scans codebases to map services, endpoints, entities, infrastructure, auth patterns, and framework usage. No AI, pure static analysis.

@@ -7,13 +7,13 @@

Maven Central - CI + CI Java 25 - MIT License - Security - Reliability - 97 Detectors - 35+ Languages + MIT License + Security + Reliability + 97 Detectors + 35+ Languages

--- @@ -22,8 +22,8 @@ ```bash # Build from source (requires Java 25+, Maven 3.9+) -git clone https://github.com/RandomCodeSpace/code-iq.git -cd code-iq +git clone https://github.com/RandomCodeSpace/codeiq.git +cd codeiq mvn clean package -DskipTests # Analyze a codebase @@ -36,7 +36,7 @@ java -jar target/code-iq-*-cli.jar serve /path/to/repo ## How It Works -Code IQ scans source files using 97 detectors across 35+ languages, builds a knowledge graph of code relationships, and serves it via REST API, MCP server, and React UI. +codeiq scans source files using 97 detectors across 35+ languages, builds a knowledge graph of code relationships, and serves it via REST API, MCP server, and React UI. ```mermaid graph TD @@ -157,7 +157,7 @@ java -jar code-iq-*-cli.jar serve /shared ## Configuration -code-iq is configured by a single YAML file at the repo root: **`codeiq.yml`**. +codeiq is configured by a single YAML file at the repo root: **`codeiq.yml`**. Every field is optional; omitted fields fall back to the in-code defaults (`ConfigDefaults.builtIn()`). See [`docs/codeiq.yml.example`](docs/codeiq.yml.example) for the full reference @@ -172,14 +172,14 @@ are accepted as deprecated aliases for one release and log a WARN on load. 4. Environment variables: `CODEIQ_
_` (e.g. `CODEIQ_SERVING_PORT=9090`, `CODEIQ_MCP_AUTH_MODE=bearer`, `CODEIQ_INDEXING_BATCH_SIZE=1000`). Nested keys are flattened with underscores; values parse as YAML scalars. -5. CLI flags on `code-iq ` +5. CLI flags on `codeiq ` ### Commands ```bash -code-iq config validate # Validate ./codeiq.yml, exit 1 on error -code-iq config validate -p custom.yml -code-iq config explain # Print each effective value + its source layer +codeiq config validate # Validate ./codeiq.yml, exit 1 on error +codeiq config validate -p custom.yml +codeiq config explain # Print each effective value + its source layer ``` ### Minimal example @@ -191,7 +191,7 @@ project: indexing: exclude: ['**/node_modules/**', '**/build/**', '**/dist/**'] - cache_dir: .code-iq/cache + cache_dir: .codeiq/cache batch_size: 500 serving: @@ -218,38 +218,6 @@ and have not been migrated into `codeiq.yml`. Keep them in Everything else belongs in `codeiq.yml`. `UnifiedConfigBeans` bridges the two worlds for values that exist in both. -### Migration from `.osscodeiq.yml` - -`.osscodeiq.yml` is deprecated. code-iq still loads it for one release via -`ProjectConfigLoader`, translates its legacy flat keys into the unified -shape, and logs a one-time WARN per path. Rename the file to `codeiq.yml` -and restructure flat keys into the nested sections. - -**Before** (`.osscodeiq.yml`, legacy flat schema): - -```yaml -languages: [java, typescript, yaml] -exclude: - - '**/node_modules/**' - - '**/build/**' -pipeline: - parallelism: 4 - batch-size: 500 -batch_size: 500 -``` - -**After** (`codeiq.yml`, unified snake_case schema): - -```yaml -indexing: - languages: [java, typescript, yaml] - exclude: - - '**/node_modules/**' - - '**/build/**' - parallelism: 4 - batch_size: 500 -``` - See `docs/codeiq.yml.example` for the full schema. ## Graph Model @@ -294,8 +262,8 @@ All results are 100% deterministic across runs. ## Development ```bash -git clone https://github.com/RandomCodeSpace/code-iq.git -cd code-iq +git clone https://github.com/RandomCodeSpace/codeiq.git +cd codeiq mvn clean package # Build + test (3,219 tests) mvn test # Tests only ``` diff --git a/docs/codeiq.yml.example b/docs/codeiq.yml.example index 5eca2e52..489628b4 100644 --- a/docs/codeiq.yml.example +++ b/docs/codeiq.yml.example @@ -9,8 +9,8 @@ # `bindAddress`, `pageCacheMb`, `perToolTimeoutMs`, `logFormat`) are accepted # as deprecated aliases for one release and emit a WARN on load. Do not use # camelCase in new config. -# - Run `code-iq config validate` to type-check your file, and -# `code-iq config explain` to print every effective value and the layer it +# - Run `codeiq config validate` to type-check your file, and +# `codeiq config explain` to print every effective value and the layer it # was resolved from. # --------------------------------------------------------------------------- @@ -38,7 +38,7 @@ indexing: - '**/dist/**' - '**/generated/**' incremental: true # reuse H2 cache when file hashes match - cache_dir: .code-iq/cache # H2 analysis cache directory + cache_dir: .codeiq/cache # H2 analysis cache directory parallelism: null # null = auto-detect (Runtime.availableProcessors()); positive int to pin batch_size: 500 # files per H2 flush batch (default: 500) max_depth: 10 # max impact-trace depth @@ -55,7 +55,7 @@ serving: bind_address: 0.0.0.0 # interface to bind; 127.0.0.1 for localhost-only read_only: false # must be false in non-prod; CI gate enforces this neo4j: - dir: .code-iq/graph/graph.db # embedded Neo4j data directory + dir: .codeiq/graph/graph.db # embedded Neo4j data directory page_cache_mb: 256 # Neo4j page cache (MB) heap_initial_mb: 256 # JVM -Xms for Neo4j (MB) heap_max_mb: 1024 # JVM -Xmx for Neo4j (MB) diff --git a/pom.xml b/pom.xml index ec1fa21d..691566be 100644 --- a/pom.xml +++ b/pom.xml @@ -16,9 +16,9 @@ 0.1.0-SNAPSHOT jar - OSSCodeIQ + codeiq CLI tool and server that scans codebases to build a deterministic code knowledge graph - https://github.com/RandomCodeSpace/code-iq + https://github.com/RandomCodeSpace/codeiq 25 @@ -220,9 +220,9 @@ - scm:git:git://github.com/RandomCodeSpace/code-iq.git - scm:git:ssh://github.com:RandomCodeSpace/code-iq.git - https://github.com/RandomCodeSpace/code-iq/tree/main + scm:git:git://github.com/RandomCodeSpace/codeiq.git + scm:git:ssh://github.com:RandomCodeSpace/codeiq.git + https://github.com/RandomCodeSpace/codeiq/tree/main diff --git a/scripts/baseline/consolidate.sh b/scripts/baseline/consolidate.sh index f2d29997..f12c9bc8 100755 --- a/scripts/baseline/consolidate.sh +++ b/scripts/baseline/consolidate.sh @@ -21,7 +21,7 @@ NODE_V=$(node --version) NPM_V=$(npm --version) cat > "$OUT" < "$OUT/timings.txt" diff --git a/sonar-project.properties b/sonar-project.properties index 917c45eb..a59e4306 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,4 +1,4 @@ -sonar.projectKey=RandomCodeSpace_code-iq +sonar.projectKey=RandomCodeSpace_codeiq sonar.organization=randomcodespace sonar.sources=src/main/java sonar.tests=src/test/java diff --git a/spotbugs-exclude.xml b/spotbugs-exclude.xml index 019922f6..b97f611d 100644 --- a/spotbugs-exclude.xml +++ b/spotbugs-exclude.xml @@ -1,6 +1,6 @@