@anvil-works/anvil-cli 0.5.7 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +65 -37
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -33132,6 +33132,16 @@ function __webpack_require__(moduleId) {
|
|
|
33132
33132
|
(()=>{
|
|
33133
33133
|
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
33134
33134
|
})();
|
|
33135
|
+
(()=>{
|
|
33136
|
+
__webpack_require__.r = (exports1)=>{
|
|
33137
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
33138
|
+
value: 'Module'
|
|
33139
|
+
});
|
|
33140
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
33141
|
+
value: true
|
|
33142
|
+
});
|
|
33143
|
+
};
|
|
33144
|
+
})();
|
|
33135
33145
|
(()=>{
|
|
33136
33146
|
__webpack_require__.nmd = (module)=>{
|
|
33137
33147
|
module.paths = [];
|
|
@@ -33142,6 +33152,10 @@ function __webpack_require__(moduleId) {
|
|
|
33142
33152
|
var __webpack_exports__ = {};
|
|
33143
33153
|
(()=>{
|
|
33144
33154
|
"use strict";
|
|
33155
|
+
__webpack_require__.r(__webpack_exports__);
|
|
33156
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
33157
|
+
buildProgram: ()=>buildProgram
|
|
33158
|
+
});
|
|
33145
33159
|
const ANSI_BACKGROUND_OFFSET = 10;
|
|
33146
33160
|
const wrapAnsi16 = (offset = 0)=>(code)=>`\u001B[${code + offset}m`;
|
|
33147
33161
|
const wrapAnsi256 = (offset = 0)=>(code)=>`\u001B[${38 + offset};5;${code}m`;
|
|
@@ -51638,15 +51652,16 @@ var __webpack_exports__ = {};
|
|
|
51638
51652
|
}
|
|
51639
51653
|
}
|
|
51640
51654
|
function registerWatchCommand(program) {
|
|
51641
|
-
const watchCommand = program.command("watch [path]").description("Watch for file changes and sync to Anvil").alias("sync").alias("w").option("-A, --appid <APP_ID>", "Specify app ID directly").option("-f, --first", "Auto-select first detected app ID without confirmation").option("-s, --staged-only", "Only sync staged changes (use git add to stage files)").option("-a, --auto", "Auto mode: restart on branch changes and sync when behind").option("-
|
|
51642
|
-
|
|
51655
|
+
const watchCommand = program.command("watch [path]").description("Watch for file changes and sync to Anvil").alias("sync").alias("w").option("-A, --appid <APP_ID>", "Specify app ID directly").option("-f, --first", "Auto-select first detected app ID without confirmation").option("-s, --staged-only", "Only sync staged changes (use git add to stage files)").option("-a, --auto", "Auto mode: restart on branch changes and sync when behind").option("-O, --open", "Open watched path in preferred editor (or default app)").option("-u, --url <ANVIL_URL>", "Specify Anvil server URL (e.g., anvil.works, localhost)").option("-U, --user <USERNAME>", "Specify which user account to use").action(async (path, options, command)=>{
|
|
51656
|
+
const globalOptions = command.optsWithGlobals();
|
|
51657
|
+
if (void 0 !== globalOptions.verbose && logger_logger instanceof CLILogger) logger_logger.setVerbose(globalOptions.verbose);
|
|
51643
51658
|
await handleWatchCommand({
|
|
51644
51659
|
path,
|
|
51645
51660
|
appid: options.appid,
|
|
51646
51661
|
useFirst: options.first,
|
|
51647
51662
|
stagedOnly: options.stagedOnly,
|
|
51648
51663
|
autoMode: options.auto,
|
|
51649
|
-
verbose:
|
|
51664
|
+
verbose: globalOptions.verbose,
|
|
51650
51665
|
open: options.open,
|
|
51651
51666
|
url: options.url,
|
|
51652
51667
|
user: options.user
|
|
@@ -52574,8 +52589,9 @@ var __webpack_exports__ = {};
|
|
|
52574
52589
|
await openPathInEditorOrDefault(destinationPath, preferredEditorCommand, deps);
|
|
52575
52590
|
}
|
|
52576
52591
|
function registerCheckoutCommand(program) {
|
|
52577
|
-
const checkoutCommand = program.command("checkout [input] [directory]").description("Check out an Anvil app locally from editor URL, git URL, app ID, or interactive selection").alias("co").option("-O, --open", "Open destination after checkout").option("-b, --branch <BRANCH>", "Checkout a specific branch").option("--depth <N>", "Create a shallow clone with history truncated to N commits", (value)=>parseInt(value, 10)).option("--single-branch", "Clone only one branch").option("--origin <NAME>", "Use a custom remote name instead of origin").option("--quiet", "Suppress git clone progress output").option("--verbose", "Enable verbose git clone output").option("-u, --url <ANVIL_URL>", "Specify Anvil server URL").option("-U, --user <USERNAME>", "Specify which user account to use").option("-f, --force", "Override safety checks for destination path").option("-Q, --query <QUERY>", "Initial search query for interactive checkout picker").action(async (input, directory, options)=>{
|
|
52592
|
+
const checkoutCommand = program.command("checkout [input] [directory]").description("Check out an Anvil app locally from editor URL, git URL, app ID, or interactive selection").alias("co").option("-O, --open", "Open destination after checkout").option("-b, --branch <BRANCH>", "Checkout a specific branch").option("--depth <N>", "Create a shallow clone with history truncated to N commits", (value)=>parseInt(value, 10)).option("--single-branch", "Clone only one branch").option("--origin <NAME>", "Use a custom remote name instead of origin").option("--quiet", "Suppress git clone progress output").option("--verbose", "Enable verbose git clone output").option("-u, --url <ANVIL_URL>", "Specify Anvil server URL").option("-U, --user <USERNAME>", "Specify which user account to use").option("-f, --force", "Override safety checks for destination path").option("-Q, --query <QUERY>", "Initial search query for interactive checkout picker").action(async (input, directory, options, command)=>{
|
|
52578
52593
|
try {
|
|
52594
|
+
const globalOptions = command?.optsWithGlobals() || options || {};
|
|
52579
52595
|
if ("number" == typeof options?.depth && (!Number.isFinite(options.depth) || options.depth <= 0)) throw new Error("--depth must be a positive integer");
|
|
52580
52596
|
await executeCheckout({
|
|
52581
52597
|
input,
|
|
@@ -52586,7 +52602,7 @@ var __webpack_exports__ = {};
|
|
|
52586
52602
|
singleBranch: options?.singleBranch,
|
|
52587
52603
|
origin: options?.origin,
|
|
52588
52604
|
quiet: options?.quiet,
|
|
52589
|
-
verbose:
|
|
52605
|
+
verbose: globalOptions.verbose,
|
|
52590
52606
|
url: options?.url,
|
|
52591
52607
|
user: options?.user,
|
|
52592
52608
|
force: options?.force,
|
|
@@ -53054,39 +53070,51 @@ var __webpack_exports__ = {};
|
|
|
53054
53070
|
process.exit(1);
|
|
53055
53071
|
}
|
|
53056
53072
|
}
|
|
53057
|
-
|
|
53058
|
-
|
|
53059
|
-
|
|
53060
|
-
|
|
53061
|
-
|
|
53062
|
-
|
|
53063
|
-
|
|
53064
|
-
const
|
|
53065
|
-
|
|
53066
|
-
|
|
53067
|
-
|
|
53068
|
-
|
|
53069
|
-
|
|
53070
|
-
|
|
53071
|
-
|
|
53072
|
-
|
|
53073
|
-
|
|
53074
|
-
|
|
53075
|
-
|
|
53076
|
-
|
|
53077
|
-
|
|
53078
|
-
|
|
53079
|
-
|
|
53080
|
-
|
|
53081
|
-
|
|
53082
|
-
|
|
53083
|
-
|
|
53084
|
-
})
|
|
53085
|
-
if (
|
|
53086
|
-
|
|
53087
|
-
|
|
53073
|
+
function addGlobalOptionsHelp(command) {
|
|
53074
|
+
if ("help" !== command.name()) command.addHelpText("after", "\n" + chalk_source.bold("Global Options:") + "\n -V, --verbose Show detailed output\n");
|
|
53075
|
+
command.commands.forEach((subcommand)=>addGlobalOptionsHelp(subcommand));
|
|
53076
|
+
}
|
|
53077
|
+
function buildProgram() {
|
|
53078
|
+
const program = new Command();
|
|
53079
|
+
program.name("anvil").description("CLI tool for developing Anvil apps locally").version(VERSION, "-v, --version", "Output the version number").option("--json", "Output in JSON format (NDJSON) for scripting/LLM consumption").option("-V, --verbose", "Show detailed output").helpOption('-h, --help', 'Display help for anvil command').hook("preAction", async (_thisCommand, actionCommand)=>{
|
|
53080
|
+
const opts = actionCommand.optsWithGlobals();
|
|
53081
|
+
setGlobalOutputConfig({
|
|
53082
|
+
jsonMode: !!opts.json
|
|
53083
|
+
});
|
|
53084
|
+
if (logger_logger instanceof CLILogger) logger_logger.setVerbose(!!opts.verbose);
|
|
53085
|
+
if (!opts.json) {
|
|
53086
|
+
const commandName = actionCommand?.name();
|
|
53087
|
+
if ("update" !== commandName && "git-credential" !== commandName) checkVersionAndWarn();
|
|
53088
|
+
}
|
|
53089
|
+
});
|
|
53090
|
+
const watchCommand = registerWatchCommand(program);
|
|
53091
|
+
registerCheckoutCommand(program);
|
|
53092
|
+
registerGitCredentialCommand(program);
|
|
53093
|
+
registerLoginCommand(program);
|
|
53094
|
+
registerLogoutCommand(program);
|
|
53095
|
+
registerConfigCommand(program);
|
|
53096
|
+
registerVersionCommand(program, VERSION);
|
|
53097
|
+
registerConfigureCommand(program, VERSION);
|
|
53098
|
+
program.command("update").description("Update anvil to the latest version").alias("u").action(async ()=>{
|
|
53099
|
+
await handleUpdateCommand();
|
|
53100
|
+
});
|
|
53101
|
+
if (watchCommand) {
|
|
53102
|
+
const watchOptions = watchCommand.options.map((opt)=>{
|
|
53103
|
+
const flags = opt.flags;
|
|
53104
|
+
const description = opt.description || "";
|
|
53105
|
+
return ` ${flags.padEnd(30)} ${description}`;
|
|
53106
|
+
}).join("\n");
|
|
53107
|
+
if (watchOptions) program.addHelpText("after", "\n" + chalk_source.bold("Watch Command Options:") + "\n" + chalk_source.gray(" (These options apply to the 'watch' command)") + "\n" + watchOptions + "\n");
|
|
53108
|
+
}
|
|
53109
|
+
program.commands.forEach((command)=>addGlobalOptionsHelp(command));
|
|
53110
|
+
return program;
|
|
53111
|
+
}
|
|
53112
|
+
buildProgram().parse();
|
|
53088
53113
|
})();
|
|
53089
|
-
|
|
53114
|
+
exports.buildProgram = __webpack_exports__.buildProgram;
|
|
53115
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
53116
|
+
"buildProgram"
|
|
53117
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
53090
53118
|
Object.defineProperty(exports, '__esModule', {
|
|
53091
53119
|
value: true
|
|
53092
53120
|
});
|