Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions .claude/commands/build.md

This file was deleted.

21 changes: 0 additions & 21 deletions .claude/commands/format.md

This file was deleted.

22 changes: 0 additions & 22 deletions .claude/commands/gtest.md

This file was deleted.

19 changes: 0 additions & 19 deletions .claude/commands/lint.md

This file was deleted.

23 changes: 0 additions & 23 deletions .claude/commands/pytest.md

This file was deleted.

2 changes: 0 additions & 2 deletions .claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
"Bash(make gtest:*)",
"Bash(make pilot:*)",
"Bash(make lint:*)",
"Bash(make format:*)",
"Bash(make pyformat:*)",
"Bash(make cformat:*)",
"Bash(make flake8:*)",
"Bash(make cinclude:*)",
Expand Down
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Changing sub agents to skills. This is for issue #774 .

Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
name: cpp-style-reviewer
description: Judgment-call C++ review for modmesh (m_ prefix, function-body placement, SimpleCollector preference, pybind11 binding split, const_cast). Use proactively after editing files in cpp/.
tools: Read, Grep, Glob, Bash
model: sonnet
name: cpp-style-review
description: Apply modmesh's judgment-call C++ style rules (m_ prefix, function-body placement, SimpleCollector preference, pybind11 binding split, const_cast) to changed lines in cpp/ or gtests/. Use after editing C++ sources.
tools: Read, Grep, Glob, Edit, Bash
---

You are a C++ code reviewer for modmesh. Authoritative reference is `STYLE.md`
at the repo root; `CLAUDE.md` is a summary. If they disagree, follow `STYLE.md`
and flag the drift in your verdict.
# C++ Style Review (modmesh)

Authoritative reference is `STYLE.md` at the repo root; `CLAUDE.md` is a
summary. If they disagree, follow `STYLE.md` and flag the drift in the
verdict.

## Scope

Expand All @@ -20,7 +21,7 @@ include-style, line length) are handled by `.claude/hooks/check-source.sh`
(PostToolUse). Do not duplicate them. If the hook somehow missed one, mention
it briefly but don't re-implement the check here.

## Judgment-call rules you check
## Judgment-call rules

**Naming**
- Classes / structs: `CamelCase`.
Expand Down Expand Up @@ -59,19 +60,25 @@ it briefly but don't re-implement the check here.
`cpp/**/*.{cpp,hpp,c,h}` and `gtests/**/*.cpp`.
2. For each file, read only the diff hunks (use `git diff` output).
3. Apply the rules above to changed lines.
4. Output each finding as `path:line -- rule -- one-line fix suggestion`.
4. Output each finding as `path:line -- rule -- (fix applied | suggestion):
<description>`.
5. End with a single verdict line: `verdict: clean | issues found | blocking`.
Use `clean` only when no findings remain after any hand-fixes.

`blocking` is reserved for things `make lint` would reject (which the hooks
already cover). Findings from this agent are typically `issues found`.
already cover). Findings from this skill are typically `issues found`.

## Output

- Bullets only. No prose summaries.
- Don't paste long code excerpts; point to `file:line`.
- Be explicit when uncertain ("not sure whether X is intentional -- please
confirm").
- Suggest `/format` (or `make format`) for pure formatting nits; do not
hand-fix yourself.
- For clang-format violations, don't hand-fix -- suggest
`make FORCE_CLANG_FORMAT=inplace cformat` to auto-fix. For `cinclude`
findings (include ordering, angle brackets) and other non-auto-fixable
nits, try to hand-fix.

Do not run `make pyformat` or `make format`. They are still work in progress.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

make format depends on make pyformat, which is still work in progress. See issue #775 .


<!-- vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4 tw=79: -->
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
name: python-style-reviewer
description: Judgment-call Python review for modmesh (naming, test intent, project conventions). Use proactively after editing files in modmesh/ or tests/.
tools: Read, Grep, Glob, Bash
model: sonnet
name: python-style-review
description: Apply modmesh's judgment-call Python style rules (naming, project conventions, test intent) to changed lines in modmesh/ or tests/. Use after editing Python sources.
tools: Read, Grep, Glob, Edit, Bash
---

You are a Python code reviewer for modmesh. Authoritative reference is
`STYLE.md` at the repo root; `CLAUDE.md` is a summary. If they disagree,
follow `STYLE.md` and flag the drift in your verdict.
# Python Style Review (modmesh)

Authoritative reference is `STYLE.md` at the repo root; `CLAUDE.md` is a
summary. If they disagree, follow `STYLE.md` and flag the drift in the
verdict.

## Scope

Expand All @@ -17,9 +18,9 @@ unchanged lines -- out of scope per Rule 3 (surgical changes).

Deterministic checks (ASCII, trailing whitespace, modeline, 79-char
limit, flake8) are handled by `.claude/hooks/check-source.sh`
(PostToolUse) and `make flake8`. Do not duplicate them.
(PostToolUse) and `make flake8`. Do not duplicate them.

## Judgment-call rules you check
## Judgment-call rules

**Naming**
- Classes: `CamelCase`.
Expand All @@ -42,16 +43,19 @@ limit, flake8) are handled by `.claude/hooks/check-source.sh`
2. Read diff hunks only.
3. Apply rules to changed lines.
4. Output each finding as
`path:line -- rule -- one-line fix suggestion`.
`path:line -- rule -- (fix applied | suggestion): <description>`.
5. End with a single verdict line:
`verdict: clean | issues found | blocking`.
`verdict: clean | issues found | blocking`. Use `clean` only when no
findings remain after any hand-fixes.

## Output

- Bullets only.
- Don't paste long code excerpts; point to `file:line`.
- Be explicit when uncertain.
- Suggest `/format` (or `make pyformat`) for pure formatting nits; do
not hand-fix yourself.
- Try to hand-fix formatting nits. `make flake8` verifies but does not fix.

Do not run `make pyformat`, which is not set up to conform to the existing
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

make pyformat is still work in progress. See issue #775 .

Python coding style yet.

<!-- vim: set ff=unix fenc=utf8 et sw=4 ts=4 sts=4 tw=79: -->
117 changes: 62 additions & 55 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,24 @@ unstructured meshes. The codebase emphasizes:

## Claude Code Tooling

This repository ships a `.claude/` directory with permissions, hooks, slash
commands, and subagents tuned to this codebase. General behavioral rules live
in `contrib/prompt/general-rule.md` (not auto-imported). This section indexes
This repository ships a `.claude/` directory with permissions, hooks, and
skills tuned to this codebase. General behavioral rules live in
`contrib/prompt/general-rule.md` (not auto-imported). This section indexes
the tools.

### Slash commands (`.claude/commands/`)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Slash commands are all about run tests and incorporated right in this file CLAUDE.md. This is for issue #773 .

### Skills (`.claude/skills/`)

| Command | Wraps | Notes |
| ----------------- | ------------------------------ | -------------------------------------------------- |
| `/build [args]` | `make $ARGUMENTS` | Builds the Python extension by default. |
| `/pytest [args]` | `make pytest PYTEST_OPTS=...` | Forwards args via `PYTEST_OPTS`; default is full suite. |
| `/gtest [args]` | `make gtest` or `run_gtest` | Forwards `--gtest_filter=...` to the built binary. |
| `/lint [target]` | `make lint` | Or a single sub-target (`flake8`, `cinclude`, ...). |
| `/format [pyformat]` | `make format` | `pyformat` runs Python-only. |

All commands end with `verdict: clean | issues found | blocking`.

### Subagents (`.claude/agents/`)

- `cpp-style-reviewer` -- judgment-call C++ review (`m_` prefix, function-body
- `cpp-style-review` -- judgment-call C++ review (`m_` prefix, function-body
placement, `SimpleCollector` preference, pybind11 binding split,
`const_cast`). Scoped to `git diff`. Pinned `model: sonnet`.
- `python-style-reviewer` -- judgment-call Python review (naming, test intent,
project conventions). Scoped to `git diff`. Pinned `model: sonnet`.
`const_cast`). Scoped to `git diff`. Invoke after editing files in `cpp/`
or `gtests/`.
- `python-style-review` -- judgment-call Python review (naming, test intent,
project conventions). Scoped to `git diff`. Invoke after editing files in
`modmesh/` or `tests/`.

Deterministic style checks (ASCII, trailing whitespace, modeline, 79-char
Python lines) are owned by hooks, not subagents.
Skills inherit the caller's model rather than pinning their own. Deterministic
style checks (ASCII, trailing whitespace, modeline, 79-char Python lines) are
owned by hooks, not skills.

### Hooks (`.claude/hooks/`)

Expand All @@ -62,19 +53,50 @@ Python lines) are owned by hooks, not subagents.
- `statusLine` runs `.claude/statusline.sh` -- shows model, project, branch
(with `*` if dirty), and context-window usage.

## Build Commands
## Build, Test, Lint, Format

All workflows are driven through `make` from the repo root. The Makefile sets
`PYTHONPATH=$(MODMESH_ROOT)` so the in-tree `_modmesh` extension is picked up
without installation, and works around macOS SIP stripping `DYLD_LIBRARY_PATH`.

**Build**

- `make` -- build the `_modmesh` Python extension (default target).
- `make pilot` -- build the Qt pilot GUI binary.
- `make clean` / `make cmakeclean` -- remove build artifacts.

**Test**

- `make pytest` -- full Python test suite.
- `make pytest PYTEST_OPTS="tests/test_buffer.py::SimpleArrayBasicTC::test_sort"`
-- run a single test or subset; `PYTEST_OPTS` is forwarded verbatim to
pytest.
- `make run_pilot_pytest` -- Python tests that require the pilot GUI;
accepts `PYTEST_OPTS` the same way.
- `make gtest` -- build and run the full C++ test suite.
- `./build/rel<pyvminor>/gtests/run_gtest --gtest_filter=Suite.Test` -- run a
single gtest after `make gtest` has built the binary
(`<pyvminor>` is the Python major+minor, e.g. `314`).
- `make pyprof` -- run profiling benchmarks; results land in
`profiling/results/`.

Prefer the slash commands listed above (`/build`, `/pytest`, `/gtest`,
`/lint`, `/format`). The underlying `make` targets are: `make` (Python
extension; default), `make pytest`, `make gtest`, `make pilot`,
`make run_pilot_pytest`, `make pyprof`, `make lint` (or individual:
`cinclude`, `flake8`, `checkascii`, `checktws`, `cformat`), `make pyformat`,
`make format` (in-place C++ + Python), `make clean`, `make cmakeclean`.
**Lint** (`make lint` runs all five)

Any target whose tool (`clang-format`, `flake8`, `black`) is missing prints an
install hint and exits 1. `make cformat` also warns when the local
`clang-format` major version differs from the CI pin (`CLANG_FORMAT_CI_VERSION`
in the Makefile).
- `make cformat` -- check C++ formatting (read-only; use
`make FORCE_CLANG_FORMAT=inplace cformat` to fix).
- `make cinclude` -- check `#include` ordering and style.
- `make flake8` -- Python style and 79-char line limit.
- `make checkascii` -- reject non-ASCII bytes in source.
- `make checktws` -- reject trailing whitespace.

**Format**

Automatic formatting is still work in progress. Do not run `make format` or
`make pyformat`.

Any target whose tool (`clang-format`, `flake8`) is missing prints an install
hint and exits 1. `make cformat` also warns when the local `clang-format` major
version differs from the CI pin (`CLANG_FORMAT_CI_VERSION` in the Makefile).

### Build Configuration

Expand Down Expand Up @@ -140,17 +162,12 @@ Python interface in `modmesh/`:

### Testing Structure

- **Python tests** (`tests/`): pytest-based
- Named `test_*.py`
- Run with `make pytest`

- **C++ tests** (`gtests/`): googletest-based
- Named `test_nopython_*.cpp`
- Run with `make gtest`
- **Python tests** (`tests/`): pytest-based, files named `test_*.py`.
- **C++ tests** (`gtests/`): googletest-based, files named
`test_nopython_*.cpp`.
- **Profiling benchmarks** (`profiling/`): files named `profile_*.py`.

- **Profiling benchmarks** (`profiling/`): performance tests
- Named `profile_*.py`
- Run with `make pyprof`; outputs to `profiling/results/`
See "Build, Test, Lint, Format" above for the `make` invocations.

## Code Style

Expand All @@ -166,8 +183,8 @@ How style is enforced in this repo:

- `.claude/hooks/check-source.sh` owns the deterministic checks (ASCII bytes,
trailing whitespace, modeline at EOF, Python `>79`-char lines).
- The `cpp-style-reviewer` and `python-style-reviewer` subagents in
`.claude/agents/` own the judgment-call rules (`m_` prefix in context,
- The `cpp-style-review` and `python-style-review` skills in
`.claude/skills/` own the judgment-call rules (`m_` prefix in context,
function-body placement, container choice, pybind11 binding split, test
intent). They are scoped to `git diff`.

Expand All @@ -182,16 +199,6 @@ management.

## Development Workflow

### Running Single Tests

Prefer the slash commands (`/pytest <path or args>`,
`/gtest --gtest_filter=Suite.Test`). Direct invocations:

```bash
make pytest PYTEST_OPTS="tests/test_buffer.py::SimpleArrayBasicTC::test_sort"
./build/rel<pyvminor>/gtests/run_gtest --gtest_filter=Suite.Test
```

### Build System Notes

- CMake is the primary build system (minimum version 3.27)
Expand Down
Loading
Loading