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

Abierto
#1,307 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
76/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
node.js, typescript
Área
backend, cli

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
TypeScript
Estrellas
481
Forks
45
Merge medio
1 d 13 h
PR fusionados (30 d)
91

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ai-driven-dev/framework

Todos los issues de ai-driven-dev/framework

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.