Skip to content

Add Elixir Mix and Phoenix mapper#51

Merged
steipete merged 4 commits into
openclaw:mainfrom
tears-mysthrala:codex/elixir-mix-phoenix-mapper
May 18, 2026
Merged

Add Elixir Mix and Phoenix mapper#51
steipete merged 4 commits into
openclaw:mainfrom
tears-mysthrala:codex/elixir-mix-phoenix-mapper

Conversation

@tears-mysthrala
Copy link
Copy Markdown
Contributor

@tears-mysthrala tears-mysthrala commented May 17, 2026

Summary

Adds first-pass heuristic mapping for Elixir Mix and Phoenix projects.

The mapper creates feature seeds for:

  • Mix project metadata (mix.exs, mix.lock, .formatter.exs)
  • application context directories under lib/<app>
  • Phoenix web slices under lib/<app>_web for controllers, LiveViews, plugs, components, and channels
  • runtime config under config/*.exs
  • Ecto migrations under priv/repo/migrations
  • project-local scripts under scripts/*.exs and scripts/*.sh
  • associated ExUnit tests where path conventions make a direct match possible

It also teaches project detection about Mix, Elixir source extensions, Phoenix/Ecto dependencies, default Mix validation commands, and skips generated Mix dependency directories during mapping.

Why

Before this change, Elixir projects fall back to much weaker generic mapping even when the repository has clear Mix/Phoenix conventions. This gives Clawpatch deterministic feature boundaries for common Phoenix applications without invoking agent mapping when heuristic coverage is already meaningful.

Notes

This is intentionally conservative. It does not try to parse Elixir ASTs or infer every Phoenix route. It follows common Mix/Phoenix filesystem conventions and keeps ownership scoped to recognizable project areas.

Validation

Ran on Fedora WSL with Node 26 and pnpm@11.1.2:

pnpm format
pnpm lint
pnpm typecheck
pnpm test
pnpm build

Result: 445 passed | 1 skipped, lint/typecheck/build clean.

I also smoke-tested the built CLI against a large Phoenix/Elixir repository: the mapper produced 40 heuristic features, skipped agent mapping as meaningful, avoided deps ownership, and produced usable security-context review/fix boundaries.

@tears-mysthrala tears-mysthrala marked this pull request as ready for review May 17, 2026 14:04
Copilot AI review requested due to automatic review settings May 17, 2026 14:04
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f062f5c99a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/mappers/elixir.ts Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds first-pass heuristic mapping and detection for Elixir Mix / Phoenix projects so Clawpatch can generate meaningful feature seeds (and avoid agent mapping) based on common filesystem conventions.

Changes:

  • Introduces a new elixir mapper that seeds Mix metadata, contexts under lib/<app>, Phoenix web slices under lib/<app>_web, runtime config, Ecto migrations, scripts, and associated ExUnit tests.
  • Extends project detection to recognize Mix/Elixir/Phoenix/Ecto signals and provide default mix validation commands.
  • Improves mapping hygiene by skipping Mix dependency directories (deps) and teaches agent mapping about Elixir/Phoenix file extensions.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/workflow.test.ts Adds regression test ensuring meaningful Elixir heuristics prevent agent mapping.
src/mappers/shared.ts Adds deps to skip logic for filesystem walking.
src/mappers/elixir.ts New heuristic mapper for Mix/Phoenix project structure and ExUnit test association.
src/mapper.ts Registers the new Elixir mapper in the mapper pipeline.
src/mapper.test.ts Adds tests for Mix/Phoenix detection, mapping coverage, and deps skipping.
src/detect.ts Detects Elixir/Mix, Elixir frameworks (Phoenix/Ecto/etc), and sets default Mix commands; skips deps during detection scans.
src/agent-mapper.ts Adds Elixir/Phoenix-related extensions and Mix manifest name for agent mapping.
README.md Documents Elixir Mix/Phoenix heuristic mapping support.
CHANGELOG.md Notes the new Elixir mapping/detection capability.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/mappers/shared.ts
Comment thread src/mappers/elixir.ts Outdated
Comment thread src/mappers/elixir.ts
@steipete steipete force-pushed the codex/elixir-mix-phoenix-mapper branch from 2800d25 to 0a11234 Compare May 18, 2026 00:33
@steipete steipete merged commit 7b1dc7d into openclaw:main May 18, 2026
2 checks passed
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0a11234adb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/mappers/c-cpp.ts

function isCOrCppDependencyPath(path: string): boolean {
return /(^|\/)(vendor|CMakeFiles|cmake-build-[^/]+)(\/|$)/u.test(path);
return /(^|\/)(deps|vendor|CMakeFiles|cmake-build-[^/]+)(\/|$)/u.test(path);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Limit C/C++ deps filtering to actual dependency roots

The new deps pattern now treats any path segment named deps as third-party, so targetSourcePaths drops explicit CMake sources like src/deps/util.c even when they are first-party code declared in add_executable/add_library. This regresses mapping accuracy by silently omitting real target files from ownedFiles, which can make heuristic coverage and downstream feature boundaries incorrect for projects that use deps as a normal source folder name.

Useful? React with 👍 / 👎.

Comment thread src/detect.ts
}
return [
"node_modules",
"deps",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid skipping nested deps folders in language detection

Adding "deps" to shouldSkipSearchEntry causes recursive detection scans to skip every nested deps directory, not just top-level dependency trees. As a result, projects with reviewable files under paths like src/deps/*.py/*.java/*.php can fail language detection (and therefore miss default commands/framework inference) when no root manifest is present, even though those files are first-party source.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants