feat(cli,package): add/remove dependencies and cleaner manifest serialization
- `marqdo add <name> --path <dir>` / `--git URL --rev SHA` and `marqdo remove <name>` edit marqdo.yaml only after validating the dependency source (path-relative, git pinned by exact rev, no duplicate entry). Removing a dependency also drops its stale lock entry; locking stays an explicit step so no version changes happen silently. - Manifest serialization omits empty dependency/plugin maps and empty capability requests, keeping generated manifests readable and stable.
This commit is contained in:
1 parent
3d1c37d217
commit
6f04c17f7a
3 files changed
+150
-5
No files matched your search
@@ -41,6 +41,10 @@ enum Command {
|
||||
Fmt(FmtArgs),
|
||||
/// Plugin artifact inspection (never loads plugin code).
|
||||
Plugin(PluginArgs),
|
||||
/// Add a dependency to marqdo.yaml.
|
||||
Add(AddArgs),
|
||||
/// Remove a dependency from marqdo.yaml.
|
||||
Remove(RemoveArgs),
|
||||
/// Generate a deterministic marqdo.lock for the current project.
|
||||
Lock(LockArgs),
|
||||
/// Verify that path dependencies match the lockfile.
|
||||
@@ -199,6 +203,33 @@ struct PluginInspectArgs {
|
||||
json: bool,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
struct AddArgs {
|
||||
/// Dependency name used by front-matter imports (`@name`).
|
||||
name: String,
|
||||
/// Project-relative path dependency.
|
||||
#[arg(long)]
|
||||
path: Option<PathBuf>,
|
||||
/// Git URL dependency (requires --rev).
|
||||
#[arg(long)]
|
||||
git: Option<String>,
|
||||
/// Exact git revision for a git dependency.
|
||||
#[arg(long)]
|
||||
rev: Option<String>,
|
||||
/// Machine readable JSON output.
|
||||
#[arg(long)]
|
||||
json: bool,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
struct RemoveArgs {
|
||||
/// Dependency name.
|
||||
name: String,
|
||||
/// Machine readable JSON output.
|
||||
#[arg(long)]
|
||||
json: bool,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
struct LockArgs {
|
||||
/// Machine readable JSON output.
|
||||
@@ -258,6 +289,14 @@ fn main() {
|
||||
Command::Plugin(args) => match args.command {
|
||||
PluginCommand::Inspect(args) => commands::plugin_inspect(&args.target, args.json),
|
||||
},
|
||||
Command::Add(args) => commands::add(
|
||||
&args.name,
|
||||
args.path.as_deref(),
|
||||
args.git.as_deref(),
|
||||
args.rev.as_deref(),
|
||||
args.json,
|
||||
),
|
||||
Command::Remove(args) => commands::remove(&args.name, args.json),
|
||||
Command::Lock(args) => commands::lock(args.json),
|
||||
Command::Sync(args) => commands::sync(args.locked, args.json),
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user