Skip to content

Add shop management commands - #14

Merged
ruibaby merged 3 commits into
mainfrom
feat/add-shop-commands
Nov 3, 2026
Merged

ruibaby merged 3 commits into
mainfrom
feat/add-shop-commands

Conversation

@ruibaby

@ruibaby ruibaby commented Nov 3, 2026

Copy link
Copy Markdown
Member

Summary

Add a new halo shop command area for managing Halo Pro/Commercial ecommerce resources through the Console API group console.api.ecommerce.halo.run/v1alpha1.

The command area covers:

  • Products: list, get, create, update, publish, unpublish, delete
  • Product categories: CRUD and tree listing
  • Orders: list, get, create, cancel, mark as paid, fulfill, timeline notes
  • Customers: list, get, update, addresses, entitlements
  • Coupons: CRUD, auto/manual distribution
  • Discounts: CRUD
  • Shop statistics and configuration

The published @halo-dev/api-client package does not expose the ecommerce Console API, so shop requests use a command-local axios client in src/commands/shop/api.ts.

Implementation notes

  • Adds a dedicated halo shop sub-CLI following the existing command-area architecture.
  • Product updates preserve existing variant fields for sparse file payloads and re-read the product before specifications or full updates to avoid writing stale snapshots.
  • Dangerous shop mutations (delete, unpublish, disable, block, cancel, mark as paid, fulfill) require confirmation in TTY mode and --force in non-interactive use.
  • Validates file input and flags for variant fields, monetary values, ISO-8601 instants, note length limits, discount/coupon rules, and external product fields.
  • Rejects anonymous sessions during auth login instead of persisting a broken profile.
  • Adds shop command completion and updates README, AGENTS, and skill documentation.

Compatibility

Shop commands require Halo Pro or Halo Commercial with the ecommerce feature enabled. halo shop status reports when the shop API is unavailable.

Validation

  • pnpm typecheck
  • vp test — 534 tests passed
  • vp run build
  • vp check --fix src/commands/shop
  • End-to-end tested against a local Halo Pro 2.28.0-SNAPSHOT instance: shop status, category CRUD, product create/update/delete, sparse variant merge, stock update, external product full update, coupon/discount CRUD and validation, order/customer lists, and daily statistics.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T07:36:00.780186Z 8353462 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@ruibaby

ruibaby commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: d50d849c54

ℹ️ 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".

Copilot AI 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.

🟡 Changes recommended

Coupon discount validation allows negative, null, array, and percentage values above 100 to be sent unchanged to the API during both creation and updates.

1 open issue
What changed in this PR

Adds a dedicated halo shop command area for Halo Pro/Commercial ecommerce management, using a command-local Axios client for APIs unavailable in the published SDK.

Changes:

  • Adds product, category, order, customer, coupon, discount, statistics, and configuration commands.
  • Introduces input validation, mutation confirmations, output formatting, and safer product updates.
  • Adds completion, tests, and documentation, and rejects anonymous login sessions.

Tests, builds, and linters were not rerun because the review environment has no installed project dependencies.

File Description
src/​utils/​errors.ts Prioritizes API error details.
src/​utils/​confirmation.ts Requires explicit boolean force confirmation.
src/​utils/​completion.ts Adds shop commands and flags.
src/​utils/​__test__/​completion.spec.ts Tests shop completion candidates.
src/​commands/​shop/​types.ts Defines ecommerce resource and request types.
src/​commands/​shop/​stats.ts Adds daily statistics commands.
src/​commands/​shop/​product.ts Adds product management and update safeguards.
src/​commands/​shop/​order.ts Adds order management and fulfillment.
src/​commands/​shop/​input.ts Adds JSON input and validation helpers.
src/​commands/​shop/​index.ts Routes shop commands and reports API availability.
src/​commands/​shop/​format.ts Formats shop tables, details, and JSON output.
src/​commands/​shop/​discount.ts Adds discount management.
src/​commands/​shop/​customer.ts Adds customer updates, addresses, and entitlements.
src/​commands/​shop/​coupon.ts Adds coupon management and distribution.
src/​commands/​shop/​config.ts Adds shop configuration commands.
src/​commands/​shop/​cli.ts Preserves option values and normalizes boolean flags.
src/​commands/​shop/​category.ts Adds category management and tree listing.
src/​commands/​shop/​api.ts Wraps ecommerce Console API requests.
src/​commands/​shop/​__test__/​input.spec.ts Tests input parsing and validation.
src/​commands/​shop/​__test__/​format.spec.ts Tests shop output formatting.
src/​commands/​shop/​__test__/​cli.spec.ts Tests option normalization and preservation.
src/​commands/​auth/​index.ts Rejects anonymous authentication responses.
src/​commands/​auth/​__test__/​auth-entry.spec.ts Tests anonymous login rejection.
src/​cli.ts Registers and dispatches shop commands.
skills/​README.md Lists the shop skill.
skills/​halo-cli/​SKILL.md Adds shop skill routing.
skills/​halo-cli-shop/​SKILL.md Documents shop workflows, payloads, and safety.
skills/​halo-cli-shared/​SKILL.md Adds shared shop command references.
README.zh-CN.md Lists shop commands and skills in Chinese documentation.
README.md Lists shop commands and skills.
AGENTS.md Documents the shop area and API integration.

Review effort: Balanced

Comment thread src/commands/shop/coupon.ts Resolved
- Add a read-only shop diagnostic command with capability, permission, and configuration reporting
- Validate coupon discount values and percentage limits
- Merge config group updates instead of replacing the whole group
- Require confirmation when removing variants from published products
- Add tests, completion entries, and skill documentation

@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: b51ecaf442

ℹ️ 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/commands/shop/product.ts Resolved
The specifications endpoint archives omitted variants regardless of product status, so detect removals for draft and archived products too.
@ruibaby

ruibaby commented Nov 3, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 8353462451

ℹ️ 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".

@ruibaby
ruibaby merged commit 7b6895f into main Nov 3, 2026
2 checks passed
@ruibaby
ruibaby deleted the feat/add-shop-commands branch November 3, 2026 07:57
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.

2 participants