@bragduck/cli 2.16.1 → 2.17.0
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/bin/bragduck.js +50 -17
- package/dist/bin/bragduck.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/bragduck.js
CHANGED
|
@@ -4782,7 +4782,7 @@ async function syncSingleService(sourceType, options, TOTAL_STEPS) {
|
|
|
4782
4782
|
fetchSpinner.start();
|
|
4783
4783
|
const workItems = await adapter.fetchWorkItems({
|
|
4784
4784
|
days,
|
|
4785
|
-
author:
|
|
4785
|
+
author: await adapter.getCurrentUser() || void 0
|
|
4786
4786
|
});
|
|
4787
4787
|
if (workItems.length === 0) {
|
|
4788
4788
|
failStepSpinner(fetchSpinner, 3, TOTAL_STEPS, `No work items found in the last ${days} days`);
|
|
@@ -4890,12 +4890,12 @@ async function syncSingleService(sourceType, options, TOTAL_STEPS) {
|
|
|
4890
4890
|
logger.log(formatRefinedCommitsTable(refinedBrags, newCommits));
|
|
4891
4891
|
logger.log("");
|
|
4892
4892
|
acceptedBrags = await promptReviewBrags(refinedBrags, newCommits);
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
}
|
|
4893
|
+
}
|
|
4894
|
+
if (acceptedBrags.length === 0) {
|
|
4895
|
+
logger.log("");
|
|
4896
|
+
logger.info(theme.secondary("No brags selected for creation. Sync cancelled."));
|
|
4897
|
+
logger.log("");
|
|
4898
|
+
return { created: 0, skipped: duplicates.length };
|
|
4899
4899
|
}
|
|
4900
4900
|
logger.log("");
|
|
4901
4901
|
let selectedOrgId = null;
|
|
@@ -4940,14 +4940,32 @@ async function syncSingleService(sourceType, options, TOTAL_STEPS) {
|
|
|
4940
4940
|
};
|
|
4941
4941
|
})
|
|
4942
4942
|
};
|
|
4943
|
-
const
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4943
|
+
const CREATE_TIMEOUT = 6e4;
|
|
4944
|
+
logger.debug(`Sending ${acceptedBrags.length} brags to API for creation...`);
|
|
4945
|
+
let createResponse;
|
|
4946
|
+
try {
|
|
4947
|
+
createResponse = await Promise.race([
|
|
4948
|
+
apiService.createBrags(createRequest),
|
|
4949
|
+
new Promise((_, reject) => {
|
|
4950
|
+
setTimeout(
|
|
4951
|
+
() => reject(new Error("Create brags timeout after 60 seconds")),
|
|
4952
|
+
CREATE_TIMEOUT
|
|
4953
|
+
);
|
|
4954
|
+
})
|
|
4955
|
+
]);
|
|
4956
|
+
logger.debug(`API response: ${createResponse.created} brags created`);
|
|
4957
|
+
succeedStepSpinner(
|
|
4958
|
+
createSpinner2,
|
|
4959
|
+
5,
|
|
4960
|
+
TOTAL_STEPS,
|
|
4961
|
+
`Created ${theme.count(createResponse.created)} brag${createResponse.created > 1 ? "s" : ""}`
|
|
4962
|
+
);
|
|
4963
|
+
logger.log("");
|
|
4964
|
+
} catch (error) {
|
|
4965
|
+
failStepSpinner(createSpinner2, 5, TOTAL_STEPS, "Failed to create brags");
|
|
4966
|
+
logger.log("");
|
|
4967
|
+
throw error;
|
|
4968
|
+
}
|
|
4951
4969
|
return { created: createResponse.created, skipped: duplicates.length };
|
|
4952
4970
|
}
|
|
4953
4971
|
async function syncAllAuthenticatedServices(options) {
|
|
@@ -5071,7 +5089,10 @@ async function syncCommand(options = {}) {
|
|
|
5071
5089
|
}
|
|
5072
5090
|
logger.debug(`Subscription tier "${subscriptionStatus.tier}" - proceeding with sync`);
|
|
5073
5091
|
let selectedSource;
|
|
5074
|
-
if (options.
|
|
5092
|
+
if (options.all) {
|
|
5093
|
+
selectedSource = "all";
|
|
5094
|
+
logger.debug("Using --all flag: syncing all authenticated services");
|
|
5095
|
+
} else if (options.source) {
|
|
5075
5096
|
sourceType = options.source;
|
|
5076
5097
|
if (!AdapterFactory.isSupported(sourceType)) {
|
|
5077
5098
|
logger.log("");
|
|
@@ -5116,6 +5137,18 @@ async function syncCommand(options = {}) {
|
|
|
5116
5137
|
const result = await syncSingleService(sourceType, options, TOTAL_STEPS);
|
|
5117
5138
|
if (result.created > 0) {
|
|
5118
5139
|
logger.log(boxen6(formatSuccessMessage(result.created), boxStyles.success));
|
|
5140
|
+
} else if (result.skipped > 0) {
|
|
5141
|
+
logger.log("");
|
|
5142
|
+
logger.info(
|
|
5143
|
+
theme.secondary(
|
|
5144
|
+
`No new brags created. ${result.skipped} item${result.skipped > 1 ? "s were" : " was"} skipped (already exists in Bragduck).`
|
|
5145
|
+
)
|
|
5146
|
+
);
|
|
5147
|
+
logger.log("");
|
|
5148
|
+
} else {
|
|
5149
|
+
logger.log("");
|
|
5150
|
+
logger.info(theme.secondary("No brags created."));
|
|
5151
|
+
logger.log("");
|
|
5119
5152
|
}
|
|
5120
5153
|
}
|
|
5121
5154
|
} catch (error) {
|
|
@@ -5885,7 +5918,7 @@ program.command("auth [subcommand]").description("Manage authentication (subcomm
|
|
|
5885
5918
|
process.exit(1);
|
|
5886
5919
|
}
|
|
5887
5920
|
});
|
|
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", "
|
|
5921
|
+
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", "Sync all authenticated services (skip service selection)").option("-s, --source <type>", "Explicit source type (github)").action(async (options) => {
|
|
5889
5922
|
try {
|
|
5890
5923
|
await syncCommand(options);
|
|
5891
5924
|
} catch (error) {
|