This repository was archived by the owner on Feb 24, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcli.ts
More file actions
123 lines (109 loc) · 3.39 KB
/
cli.ts
File metadata and controls
123 lines (109 loc) · 3.39 KB
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
#!/usr/bin/env node
import { Command } from "commander";
import chalk from "chalk";
import { publishCommand } from "./lib/commands/publish.js";
import { syncCommand } from "./lib/commands/sync.js";
import { listCommand } from "./lib/commands/list.js";
import { deleteCommand } from "./lib/commands/delete.js";
import { authLoginCommand } from "./lib/commands/auth-login.js";
import { authLogoutCommand } from "./lib/commands/auth-logout.js";
import { authStatusCommand } from "./lib/commands/auth-status.js";
import packageJson from "./package.json" with { type: "json" };
const program = new Command();
program
.name("publish")
.description("CLI tool for publishing to FlowerShow")
.version(packageJson.version);
// Default action: publish files/folders
program
.argument("[path]", "File or folder to publish")
.argument("[morePaths...]", "Additional files to publish")
.option("--overwrite", "Overwrite existing site if it already exists")
.option("--name <siteName>", "Custom name for the site")
.action(
async (
path: string | undefined,
morePaths: string[],
options: { overwrite?: boolean; name?: string },
) => {
// If no path provided and no subcommand, show help
if (!path) {
program.help();
return;
}
console.log(chalk.bold("\n💐 FlowerShow CLI - Publish\n"));
const paths = [path, ...morePaths];
await publishCommand(paths, options.overwrite || false, options.name);
},
);
// Auth commands
const auth = program
.command("auth")
.description("Manage authentication")
.action(() => {
auth.help();
});
auth
.command("login")
.description("Authenticate with FlowerShow via browser")
.action(async () => {
console.log(chalk.bold("\n💐 FlowerShow CLI - Authentication\n"));
await authLoginCommand();
});
auth
.command("logout")
.description("Remove stored authentication token")
.action(async () => {
console.log(chalk.bold("\n💐 FlowerShow CLI - Logout\n"));
await authLogoutCommand();
});
auth
.command("status")
.description("Check authentication status")
.action(async () => {
console.log(chalk.bold("\n💐 FlowerShow CLI - Auth Status\n"));
await authStatusCommand();
});
// Site management commands
program
.command("sync <path>")
.description("Sync changes to an existing published site")
.option(
"--name <siteName>",
"Specify site name if different from folder name",
)
.option("--dry-run", "Show what would be synced without making changes")
.option("--verbose", "Show detailed list of all files in each category")
.action(
async (
path: string,
options: {
name?: string;
dryRun?: boolean;
force?: boolean;
verbose?: boolean;
},
) => {
console.log(chalk.bold("\n💐 FlowerShow CLI - Sync\n"));
await syncCommand(path, options);
},
);
program
.command("list")
.description("List all published sites")
.action(async () => {
console.log(chalk.bold("\n💐 FlowerShow CLI - List Sites\n"));
await listCommand();
});
program
.command("delete <project-name>")
.description("Delete a published site")
.action(async (projectName: string) => {
console.log(chalk.bold("\n💐 FlowerShow CLI - Delete Site\n"));
await deleteCommand(projectName);
});
// Show help if no command provided
if (process.argv.length === 2) {
program.help();
}
program.parse();