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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
pub mod add;
pub mod admin;
pub mod build;
pub mod cron;
pub mod deploy;
pub mod dev;
pub mod domain;
pub mod fe_runtime;
pub mod init;
pub mod rename;
use clap::{Parser, Subcommand};
use std::path::PathBuf;
#[derive(Parser)]
#[command(name = "forte")]
#[command(about = "Forte - Fullstack Framework", long_about = None)]
pub struct Cli {
#[command(subcommand)]
pub command: Commands,
}
#[derive(Subcommand)]
pub enum Commands {
/// Start the development server with hot reload
Dev {
/// Project directory (defaults to current directory)
#[arg(short, long)]
project: Option<PathBuf>,
/// Port to listen on (auto-selects from 3000 if not specified)
#[arg(short = 'P', long)]
port: Option<u16>,
},
/// Initialize a new Forte project
Init {
/// Project name
name: String,
},
/// Add a new page or action
Add {
#[command(subcommand)]
command: AddCommands,
},
/// Build the project locally without deploying
Build {
/// Project directory (defaults to current directory)
#[arg(short, long)]
project: Option<PathBuf>,
},
/// Build and deploy the project to fn0 cloud
Deploy {
/// Project directory (defaults to current directory)
#[arg(short, long)]
project: Option<PathBuf>,
},
/// Rename the deployed project (migrates Turso DB and switches subdomain)
Rename {
/// New project name
new_name: String,
/// Project directory (defaults to current directory)
#[arg(short, long)]
project: Option<PathBuf>,
},
/// Admin task commands
Admin {
#[command(subcommand)]
command: AdminCommands,
},
/// Custom domain management
Domain {
#[command(subcommand)]
command: DomainCommands,
},
}
#[derive(Subcommand)]
pub enum DomainCommands {
/// Attach a custom domain to this project (CNAME-based)
Add {
/// Domain to attach (e.g. www.example.com)
domain: String,
/// Project directory (defaults to current directory)
#[arg(short, long)]
project: Option<PathBuf>,
},
/// Detach the custom domain from this project
Remove {
/// Project directory (defaults to current directory)
#[arg(short, long)]
project: Option<PathBuf>,
},
/// Show custom domain status for this project
Status {
/// Project directory (defaults to current directory)
#[arg(short, long)]
project: Option<PathBuf>,
},
}
#[derive(Subcommand)]
pub enum AdminCommands {
/// Run an admin task against the deployed app
Run {
/// Task name (matches src/admin/<name>.rs)
task: String,
#[arg(short, long)]
project: Option<PathBuf>,
#[arg(long)]
input_file: Option<PathBuf>,
#[arg(long)]
input: Option<String>,
#[arg(long, default_value_t = 300)]
timeout_seconds: u64,
},
/// Run an admin task against a locally-running `forte dev`
RunLocal {
/// Task name
task: String,
#[arg(short = 'P', long, default_value_t = 3000)]
port: u16,
#[arg(long)]
input_file: Option<PathBuf>,
#[arg(long)]
input: Option<String>,
#[arg(long, default_value_t = 300)]
timeout_seconds: u64,
},
}
#[derive(Subcommand)]
pub enum AddCommands {
/// Add a new page
Page {
/// Page path (e.g., "product/[id]")
path: String,
},
/// Add a new action
Action {
/// Action path (e.g., "user/login")
path: String,
},
}