fix(cli): marketplace add --overwrite removes the old marketplace before the new one resolves

Đang mở
#1,307 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
node.js, typescript
Lĩnh vực
backend, cli

Hướng nghiên cứu

Read cli/src/contexts/distribution/application/marketplace-add-use-case.ts, focusing on execute and the order of removal, resolution, validation, trust confirmation, and save. Add red-first tests for resolve failure, a null catalog, and denied trust; verify the old registry entry and installed plugin files remain intact in each case. Then run the relevant CLI tests and confirm successful overwrite still works.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Description

aidd marketplace add --overwrite removes the existing marketplace of the same name before it fetches and validates the new source. If the fetch fails, or the source has no marketplace.json, the command errors and the previous entry is already gone.

Affected file(s)
  • next: cli/src/contexts/distribution/application/marketplace-add-use-case.ts (execute: assertNotRegistered runs before resolveMarketplace.execute; assertNotRegistered calls removeUseCase.execute with autoConfirm: true).
  • refactor/cli-target: cli/src/contexts/distribution/application/add-marketplace.ts (same order, remover.remove).
Expected behaviour

The existing marketplace is replaced only once the new one resolved and its marketplace.json was found (ideally after trust is confirmed). A failed add leaves the registry as it was.

Observed behaviour

Order in execute: remove the old entry, Marketplace.create, resolveMarketplace.execute, catalog === null check (throws InvalidPluginManifestError), ensureTrust, registry.save. Any throw after the first step, including a denied trust prompt, loses the old entry. Removal also deletes installed plugin files, so the loss is not limited to the registry line.

AI tool

All

aidd-cli version

unreleased, next

OS

Any

Additional context

Red-first test: register marketplace m from source A; run add with overwrite: true and a source whose resolve throws (and a second case where catalog is null, and a third where trust is denied). Assert the registry still lists m with source A and its installed plugin files are untouched. Fix direction: resolve and validate the new marketplace first, then remove and save.

Ngôn ngữ chính
TypeScript
Star
481
Fork
45
Merge trung bình
1 ngày 13 giờ
Pull request đã merge (30 ngày)
91

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ai-driven-dev/framework

Tất cả issue của ai-driven-dev/framework

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.