feat(plugin): matcha create plugin scaffolds an in-app plugin and wires it

In-app is the default. Each plugin gets its own folder under plugins/
(or --folder), so it can be exported as a package later, and the
factory is registered in createApp({ plugins }). A plugins value that
is not an array literal is left alone with a hint, as modules already
is.

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
chrnx committed 2026-09-24 12:54:51 -05:00
1 parent f2a3c16023
commit 3c3b7aaf8e
8 files changed
+383 -12

No files matched your search

+32 -2
View File
@@ -6,9 +6,11 @@ mod cmd_create;
mod cmd_doctor;
mod cmd_graph;
mod cmd_new;
mod cmd_plugin;
mod cmd_run;
mod entry;
mod naming;
mod plugin_files;
mod runtime;
mod template;
mod wire;
@@ -35,8 +37,36 @@ fn main() {
std::process::exit(1);
}
}
Command::Create { kind, name, check } => {
if let Err(e) = cmd_create::run(&kind, &name, check) {
Command::Create {
kind,
name,
check,
package,
folder,
scope,
registry,
npm_name,
} => {
let result = if kind == "plugin" {
cmd_plugin::run(cmd_plugin::Opts {
name,
package,
folder,
scope,
registry,
npm_name,
check,
})
} else {
match name {
Some(name) => cmd_create::run(&kind, &name, check),
None => Err(std::io::Error::new(
std::io::ErrorKind::InvalidInput,
format!("create {kind} needs a name"),
)),
}
};
if let Err(e) = result {
eprintln!("error: {e}");
std::process::exit(1);
}