1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
use clap::Subcommand;
use std::path::PathBuf;
#[derive(Debug, Subcommand)]
pub enum NewCommand {
/// Generate controller(s) with routing
Controller {
/// Add sample CRUD operations
#[arg(long)]
crud: bool,
/// Controller name(s) - comma-separated for multiple
#[arg(short, long)]
names: String,
/// Add sample routes
#[arg(long)]
routes: bool,
},
/// Generate an event handler
Event {
/// Add custom event samples
#[arg(long)]
custom: bool,
/// Add lifecycle event samples
#[arg(long)]
lifecycle: bool,
/// Event handler name
#[arg(short, long)]
name: String,
},
/// Generate a middleware component
Middleware {
/// Middleware name
#[arg(short, long)]
name: String,
/// Include authentication example
#[arg(long)]
auth: bool,
/// Include logging example
#[arg(long)]
logging: bool,
/// Execution priority (lower = earlier, default: 0)
#[arg(short, long, default_value = "0")]
priority: i32,
},
/// Generate a utility module or shared service
Module {
/// Module name
#[arg(short, long)]
name: String,
/// Generate as a shared service (SharedModule singleton)
/// Default: generate as simple utility module
#[arg(long)]
shared: bool,
/// Add sample methods
#[arg(long)]
with_methods: bool,
},
/// Create a new RustF project with AI-friendly structure and documentation
Project {
/// Project name (will be converted to snake_case for directory)
project_name: String,
/// Overwrite existing non-empty directory
#[arg(short, long)]
force: bool,
/// Target directory path (defaults to current directory)
#[arg(long)]
path: Option<PathBuf>,
},
/// Generate a WebSocket controller: a `SOCKET` route, a room with
/// on_open/on_message/on_close, a page, and a browser client.
Socket {
/// Socket name (used for the route, the file, and the view directory)
#[arg(short, long)]
name: String,
},
/// Generate a background worker for async task execution
Worker {
/// Worker name (will be converted to kebab-case for registration)
#[arg(short, long)]
name: String,
},
/// Generate a full CRUD scaffold enforcing the
/// Base Model -> Model -> Module -> Controller layering rule.
///
/// Scaffolds the HTTP + business layers around an EXISTING model:
/// a thin controller, a business-logic module (only caller of the
/// model), four views (index/show/new/edit), and an integration-test
/// stub. Requires src/models/<name>.rs to already exist (run
/// `schema generate models` first); it never creates or edits the model.
Crud {
/// Feature name (plural form, e.g. "posts", "users", "articles").
/// Used as-is for routes, views dir, and controller/module filenames.
#[arg(short, long)]
name: String,
},
}