Skip to content

Add pdmaner CLI harness for PDManer database modeling tool#302

Open
anyanyna wants to merge 1 commit into
HKUDS:mainfrom
anyanyna:main
Open

Add pdmaner CLI harness for PDManer database modeling tool#302
anyanyna wants to merge 1 commit into
HKUDS:mainfrom
anyanyna:main

Conversation

@anyanyna

Copy link
Copy Markdown

PDManer (元数建模) is an open-source database modeling tool. This harness provides:

  • Project CRUD (create, open, save .chnr.json files)
  • Entity/table management with fields, indexes
  • View, diagram, dictionary, domain management
  • DDL/SQL export for MySQL, PostgreSQL, Oracle, etc.
  • Interactive REPL with undo/redo
  • JSON output mode for AI agent consumption

64 tests (51 unit + 13 E2E), all passing.

Description

Fixes #

Type of Change

  • New Software CLI (in-repo) — adds a CLI harness inside this monorepo
  • New Software CLI (standalone repo) — registry-only PR pointing to an external repo
  • New Feature — adds new functionality to an existing harness or the plugin
  • Bug Fix — fixes incorrect behavior
  • Documentation — updates docs only
  • Other — please describe:

For New Software CLIs (in-repo)

  • <SOFTWARE>.md SOP document exists at <software>/agent-harness/<SOFTWARE>.md
  • Canonical SKILL.md exists at skills/cli-anything-<software>/SKILL.md
  • Packaged compatibility SKILL.md exists at cli_anything/<software>/skills/SKILL.md
  • Unit tests at cli_anything/<software>/tests/test_core.py are present and pass without backend
  • E2E tests at cli_anything/<software>/tests/test_full_e2e.py are present
  • README.md includes the new software (with link to harness directory)
  • registry.json includes an entry with source_url: null (see Contributing guide)
  • repl_skin.py in utils/ is an unmodified copy from the plugin

For New Software CLIs (standalone repo)

  • CLI is installable via pip install <package-name> or a pip install git+https://... URL
  • SKILL.md exists in the external repo
  • External repo has its own test suite
  • registry.json entry includes source_url pointing to the external repo
  • registry.json entry includes skill_md with full URL to the external SKILL.md
  • install_cmd in registry.json works (tested locally)

For Existing CLI Modifications

  • All unit tests pass: python3 -m pytest cli_anything/<software>/tests/test_core.py -v
  • All E2E tests pass: python3 -m pytest cli_anything/<software>/tests/test_full_e2e.py -v
  • No test regressions — no previously passing tests were removed or weakened
  • registry.json entry is updated if version, description, or requirements changed

General Checklist

  • Code follows existing patterns and conventions
  • --json flag is supported on any new commands
  • Commit messages follow the conventional format (feat:, fix:, docs:, test:)
  • I have tested my changes locally

Test Results

<paste test output here>

PDManer (元数建模) is an open-source database modeling tool.
This harness provides:
- Project CRUD (create, open, save .chnr.json files)
- Entity/table management with fields, indexes
- View, diagram, dictionary, domain management
- DDL/SQL export for MySQL, PostgreSQL, Oracle, etc.
- Interactive REPL with undo/redo
- JSON output mode for AI agent consumption

64 tests (51 unit + 13 E2E), all passing.
@github-actions github-actions Bot added new-cli Adds a new CLI or generated harness cli-anything-skill Changes CLI-Anything plugin or skill files labels May 21, 2026

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

Copy link
Copy Markdown

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: 24740ee4ec

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

def diagram_add_table(ctx, diagram, entity, x, y):
"""Add an entity table to a diagram."""
data = _get_data(ctx)
node = diagram.add_table_to_diagram(data, diagram, entity, x, y)

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 Rename diagram arg before invoking diagram helpers

diagram add-table (and the same pattern in diagram add-relation) always crashes because the Click argument named diagram shadows the imported diagram module, so diagram.add_table_to_diagram(...) resolves against a string and raises AttributeError. This makes the diagram relation/table CLI paths unusable in normal workflows.

Useful? React with 👍 / 👎.

Comment on lines +47 to +48
if proj_path and sess and sess.data is not None:
sess.save(proj_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.

P2 Badge Limit auto-save callback to actual mutations

The result callback currently saves whenever --project is provided, regardless of which subcommand ran. That means read-only commands like entity list rewrite the project file and bump updatedTime, and they can also fail in read-only environments even though no mutation was requested. Auto-save should be gated by a mutation flag/command set instead of running unconditionally.

Useful? React with 👍 / 👎.

Comment on lines +10 to +11
if m.get("defKey"):
return m

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 Resolve domain type mapping by applyFor key

DDL type resolution is incorrect for domain-based fields when multiple mappings exist: _get_type_mapping returns the first mapping entry and _resolve_field_type then uses that row for every domain, ignoring the domain’s applyFor mapping key. In practice this emits wrong column types (e.g., an INT domain can become VARCHAR) and corrupts generated SQL.

Useful? React with 👍 / 👎.

@yuh-yang

Copy link
Copy Markdown
Collaborator

Thanks for adding the PDManer harness. Before merge, please bring it in line with the repo's in-repo harness conventions and fix the current runtime issues:

  • Add the root registry entry and root skills/cli-anything-pdmaner/SKILL.md. The current files only add the harness-local skill directory.
  • Fix the diagram command argument shadowing so diagram add-table and diagram add-relation call the imported diagram helper module instead of a string argument.
  • Limit auto-save to mutating commands; read-only commands like entity list should not rewrite project files.
  • Fix DDL type mapping so domain-based fields resolve by the correct applyFor mapping key.
  • Add tests covering these behaviors.

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

Labels

cli-anything-skill Changes CLI-Anything plugin or skill files new-cli Adds a new CLI or generated harness

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants