@anvil-works/anvil-cli 0.5.12 → 0.5.13
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 +27 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -52647,10 +52647,19 @@ var __webpack_exports__ = {};
|
|
|
52647
52647
|
return appId;
|
|
52648
52648
|
}
|
|
52649
52649
|
async function resolveCheckoutUrl(explicitUrl, parsedUrl) {
|
|
52650
|
-
if (explicitUrl)
|
|
52651
|
-
|
|
52650
|
+
if (explicitUrl) {
|
|
52651
|
+
logger_logger.verbose(chalk_source.cyan("Using Anvil URL from --url: ") + chalk_source.bold(normalizeAnvilUrl(explicitUrl)));
|
|
52652
|
+
return normalizeAnvilUrl(explicitUrl);
|
|
52653
|
+
}
|
|
52654
|
+
if (parsedUrl) {
|
|
52655
|
+
logger_logger.verbose(chalk_source.cyan("Using Anvil URL from checkout input: ") + chalk_source.bold(normalizeAnvilUrl(parsedUrl)));
|
|
52656
|
+
return normalizeAnvilUrl(parsedUrl);
|
|
52657
|
+
}
|
|
52652
52658
|
const decision = decideFallbackUrl(void 0);
|
|
52653
|
-
if ("available-multiple" !== decision.source)
|
|
52659
|
+
if ("available-multiple" !== decision.source) {
|
|
52660
|
+
if (decision.url) logger_logger.verbose(chalk_source.cyan("Using configured Anvil URL: ") + chalk_source.bold(decision.url));
|
|
52661
|
+
return decision.url;
|
|
52662
|
+
}
|
|
52654
52663
|
const choices = decision.urls.map((url)=>({
|
|
52655
52664
|
name: url,
|
|
52656
52665
|
value: url
|
|
@@ -52696,6 +52705,7 @@ var __webpack_exports__ = {};
|
|
|
52696
52705
|
}
|
|
52697
52706
|
async function ensureCheckoutAuthToken(anvilUrl, username, deps = defaultCheckoutDeps) {
|
|
52698
52707
|
try {
|
|
52708
|
+
logger_logger.verbose(chalk_source.cyan("Checking auth token for: ") + chalk_source.bold(username ? `${username} @ ${anvilUrl}` : anvilUrl));
|
|
52699
52709
|
return await deps.getValidAuthToken(anvilUrl, username);
|
|
52700
52710
|
} catch (e) {
|
|
52701
52711
|
const interactive = process.stdin.isTTY && process.stdout.isTTY;
|
|
@@ -52742,11 +52752,15 @@ var __webpack_exports__ = {};
|
|
|
52742
52752
|
if (!selectedInput) return void logger_logger.info("Checkout cancelled.");
|
|
52743
52753
|
checkoutInput = selectedInput;
|
|
52744
52754
|
}
|
|
52755
|
+
logger_logger.verbose(chalk_source.cyan("Checkout input: ") + chalk_source.bold(checkoutInput));
|
|
52745
52756
|
const parsed = parseCheckoutInput(checkoutInput);
|
|
52757
|
+
logger_logger.verbose(chalk_source.cyan("Resolved app ID: ") + chalk_source.bold(parsed.appId));
|
|
52746
52758
|
const anvilUrl = preselectedAnvilUrl || await resolveCheckoutUrl(options.url, parsed.detectedUrl);
|
|
52747
52759
|
if (!anvilUrl) return void logger_logger.info("Checkout cancelled.");
|
|
52748
52760
|
const resolvedUsername = preselectedUsername || await resolveCheckoutUsername(anvilUrl, options.user);
|
|
52749
52761
|
if (null === resolvedUsername) return void logger_logger.info("Checkout cancelled.");
|
|
52762
|
+
if (resolvedUsername) logger_logger.verbose(chalk_source.cyan("Using account: ") + chalk_source.bold(resolvedUsername));
|
|
52763
|
+
else logger_logger.verbose(chalk_source.cyan("No account preselected; resolving after auth token lookup."));
|
|
52750
52764
|
const authToken = await ensureCheckoutAuthToken(anvilUrl, resolvedUsername, deps);
|
|
52751
52765
|
let checkoutUsername = resolvedUsername;
|
|
52752
52766
|
if (!checkoutUsername) {
|
|
@@ -52755,13 +52769,22 @@ var __webpack_exports__ = {};
|
|
|
52755
52769
|
if (!inferredUsername) throw new Error(`Could not determine account for ${anvilUrl}. Use --user <USERNAME> so checkout can bind repository credentials.`);
|
|
52756
52770
|
checkoutUsername = inferredUsername;
|
|
52757
52771
|
}
|
|
52772
|
+
logger_logger.verbose(chalk_source.cyan("Checkout account: ") + chalk_source.bold(checkoutUsername));
|
|
52773
|
+
logger_logger.verbose(chalk_source.blue(`Validating app ID ${parsed.appId} with Anvil server...`));
|
|
52758
52774
|
const validation = await deps.validateAppId(parsed.appId, anvilUrl, checkoutUsername);
|
|
52759
52775
|
if (!validation.valid) throw new Error(validation.error || `App '${parsed.appId}' is not accessible on ${anvilUrl}.`);
|
|
52776
|
+
logger_logger.verbose(chalk_source.green(`✔ App ID validated successfully`));
|
|
52777
|
+
if (validation.app_name) logger_logger.verbose(chalk_source.gray(` App name: ${validation.app_name}`));
|
|
52760
52778
|
const destinationDir = options.directory || getDefaultDestinationDirectory(parsed.appId, validation.app_name);
|
|
52761
52779
|
const destinationPath = external_path_default().resolve(process.cwd(), destinationDir);
|
|
52762
52780
|
const destinationDisplay = formatPathForDisplay(destinationPath);
|
|
52781
|
+
logger_logger.verbose(chalk_source.cyan("Resolved destination: ") + chalk_source.bold(destinationDisplay));
|
|
52763
52782
|
await validateCheckoutDestination(destinationPath, options.force);
|
|
52764
52783
|
const cloneUrl = getGitPushUrl(parsed.appId, authToken, anvilUrl);
|
|
52784
|
+
logger_logger.verbose(chalk_source.cyan("Clone source: ") + chalk_source.bold(`${anvilUrl}/git/${parsed.appId}.git`));
|
|
52785
|
+
if (options.branch) logger_logger.verbose(chalk_source.cyan("Requested branch: ") + chalk_source.bold(options.branch));
|
|
52786
|
+
if ("number" == typeof options.depth) logger_logger.verbose(chalk_source.cyan("Clone depth: ") + chalk_source.bold(String(options.depth)));
|
|
52787
|
+
if (options.singleBranch) logger_logger.verbose(chalk_source.cyan("Single-branch clone enabled"));
|
|
52765
52788
|
logger_logger.progress("checkout", `Checking out app ${parsed.appId} from ${anvilUrl}`);
|
|
52766
52789
|
logger_logger.info(chalk_source.gray(` Destination directory: ${destinationDisplay}`));
|
|
52767
52790
|
await deps.clone(cloneUrl, destinationPath, {
|
|
@@ -52781,6 +52804,7 @@ var __webpack_exports__ = {};
|
|
|
52781
52804
|
username: checkoutUsername,
|
|
52782
52805
|
remoteName
|
|
52783
52806
|
});
|
|
52807
|
+
logger_logger.verbose(chalk_source.cyan("Configured Git auth bridge for remote: ") + chalk_source.bold(remoteName));
|
|
52784
52808
|
} catch (e) {
|
|
52785
52809
|
throw new Error(`Checkout clone succeeded, but failed to configure repository credentials: ${errors_getErrorMessage(e)}. The repository exists at ${destinationDisplay}, but Git auth bridge setup is incomplete.`);
|
|
52786
52810
|
}
|