@bragduck/cli 2.15.0 → 2.16.1

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.
@@ -4449,6 +4449,7 @@ async function promptConfirm(message, defaultValue = true) {
4449
4449
  }
4450
4450
  async function promptDaysToScan(defaultDays = 30) {
4451
4451
  const choices = [
4452
+ { name: "1 day", value: "1", description: "Last 24 hours" },
4452
4453
  { name: "7 days", value: "7", description: "Last week" },
4453
4454
  { name: "30 days (Recommended)", value: "30", description: "Last month" },
4454
4455
  { name: "60 days", value: "60", description: "Last 2 months" },
@@ -4737,10 +4738,32 @@ async function syncSingleService(sourceType, options, TOTAL_STEPS) {
4737
4738
  const adapter = AdapterFactory.getAdapter(sourceType);
4738
4739
  const repoSpinner = createStepSpinner(2, TOTAL_STEPS, "Validating repository");
4739
4740
  repoSpinner.start();
4740
- await adapter.validate();
4741
- const repoInfo = await adapter.getRepositoryInfo();
4742
- succeedStepSpinner(repoSpinner, 2, TOTAL_STEPS, `Repository: ${theme.value(repoInfo.fullName)}`);
4743
- logger.log("");
4741
+ const VALIDATION_TIMEOUT = 3e4;
4742
+ let repoInfo;
4743
+ try {
4744
+ repoInfo = await Promise.race([
4745
+ (async () => {
4746
+ await adapter.validate();
4747
+ return await adapter.getRepositoryInfo();
4748
+ })(),
4749
+ new Promise((_, reject) => {
4750
+ setTimeout(
4751
+ () => reject(new Error("Validation timeout after 30 seconds")),
4752
+ VALIDATION_TIMEOUT
4753
+ );
4754
+ })
4755
+ ]);
4756
+ succeedStepSpinner(
4757
+ repoSpinner,
4758
+ 2,
4759
+ TOTAL_STEPS,
4760
+ `Repository: ${theme.value(repoInfo.fullName)}`
4761
+ );
4762
+ logger.log("");
4763
+ } catch (error) {
4764
+ failStepSpinner(repoSpinner, 2, TOTAL_STEPS, "Validation failed");
4765
+ throw error;
4766
+ }
4744
4767
  let days = options.days;
4745
4768
  if (!days && options.today) {
4746
4769
  days = 1;
@@ -4777,7 +4800,7 @@ async function syncSingleService(sourceType, options, TOTAL_STEPS) {
4777
4800
  logger.log(formatCommitStats(workItems));
4778
4801
  logger.log("");
4779
4802
  let sortedCommits = [...workItems];
4780
- if (workItems.length > 1) {
4803
+ if (workItems.length > 1 && !options.turbo) {
4781
4804
  const sortOption = await promptSortOption();
4782
4805
  logger.log("");
4783
4806
  if (sortOption === "date") {
@@ -4795,13 +4818,22 @@ async function syncSingleService(sourceType, options, TOTAL_STEPS) {
4795
4818
  return filesB - filesA;
4796
4819
  });
4797
4820
  }
4821
+ } else if (workItems.length > 1 && options.turbo) {
4822
+ sortedCommits.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime());
4823
+ logger.debug("Turbo mode: sorted by date (most recent first)");
4798
4824
  }
4799
- const selectedShas = await promptSelectCommits(sortedCommits);
4800
- if (selectedShas.length === 0) {
4801
- logger.log("");
4802
- logger.info(theme.secondary("No work items selected. Sync cancelled."));
4803
- logger.log("");
4804
- return { created: 0, skipped: 0 };
4825
+ let selectedShas;
4826
+ if (options.turbo) {
4827
+ selectedShas = sortedCommits.map((c) => c.sha);
4828
+ logger.debug(`Turbo mode: auto-selected all ${selectedShas.length} items`);
4829
+ } else {
4830
+ selectedShas = await promptSelectCommits(sortedCommits);
4831
+ if (selectedShas.length === 0) {
4832
+ logger.log("");
4833
+ logger.info(theme.secondary("No work items selected. Sync cancelled."));
4834
+ logger.log("");
4835
+ return { created: 0, skipped: 0 };
4836
+ }
4805
4837
  }
4806
4838
  const selectedCommits = sortedCommits.filter((c) => selectedShas.includes(c.sha));
4807
4839
  logger.log(formatSelectionSummary(selectedCommits.length, selectedCommits));
@@ -4847,16 +4879,23 @@ async function syncSingleService(sourceType, options, TOTAL_STEPS) {
4847
4879
  let refinedBrags = refineResponse.refined_brags;
4848
4880
  succeedStepSpinner(refineSpinner, 4, TOTAL_STEPS, "Work items refined successfully");
4849
4881
  logger.log("");
4850
- logger.info("Preview of refined brags:");
4851
- logger.log("");
4852
- logger.log(formatRefinedCommitsTable(refinedBrags, newCommits));
4853
- logger.log("");
4854
- const acceptedBrags = await promptReviewBrags(refinedBrags, newCommits);
4855
- if (acceptedBrags.length === 0) {
4882
+ let acceptedBrags;
4883
+ if (options.turbo) {
4884
+ acceptedBrags = refinedBrags;
4885
+ logger.debug(`Turbo mode: auto-accepted all ${acceptedBrags.length} refined brags`);
4856
4886
  logger.log("");
4857
- logger.info(theme.secondary("No brags selected for creation. Sync cancelled."));
4887
+ } else {
4888
+ logger.info("Preview of refined brags:");
4858
4889
  logger.log("");
4859
- return { created: 0, skipped: duplicates.length };
4890
+ logger.log(formatRefinedCommitsTable(refinedBrags, newCommits));
4891
+ logger.log("");
4892
+ acceptedBrags = await promptReviewBrags(refinedBrags, newCommits);
4893
+ if (acceptedBrags.length === 0) {
4894
+ logger.log("");
4895
+ logger.info(theme.secondary("No brags selected for creation. Sync cancelled."));
4896
+ logger.log("");
4897
+ return { created: 0, skipped: duplicates.length };
4898
+ }
4860
4899
  }
4861
4900
  logger.log("");
4862
4901
  let selectedOrgId = null;
@@ -5846,7 +5885,7 @@ program.command("auth [subcommand]").description("Manage authentication (subcomm
5846
5885
  process.exit(1);
5847
5886
  }
5848
5887
  });
5849
- program.command("sync").description("Sync work items and create brags").option("-d, --days <number>", "Number of days to scan", (val) => parseInt(val, 10)).option("-t, --today", "Scan the last 24 hours (shorthand for --days 1)").option("-a, --all", "Include all items (not just current user)").option("-s, --source <type>", "Explicit source type (github)").action(async (options) => {
5888
+ program.command("sync").description("Sync work items and create brags").option("-d, --days <number>", "Number of days to scan", (val) => parseInt(val, 10)).option("-t, --today", "Scan the last 24 hours (shorthand for --days 1)").option("--turbo", "Turbo mode: skip all prompts, auto-select all items, auto-accept refinements").option("-a, --all", "Include all items (not just current user)").option("-s, --source <type>", "Explicit source type (github)").action(async (options) => {
5850
5889
  try {
5851
5890
  await syncCommand(options);
5852
5891
  } catch (error) {