@bragduck/cli 2.23.0 → 2.24.2
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 +51 -16
- package/dist/bin/bragduck.js.map +1 -1
- package/package.json +1 -1
package/dist/bin/bragduck.js
CHANGED
|
@@ -4501,6 +4501,9 @@ import terminalLink from "terminal-link";
|
|
|
4501
4501
|
init_esm_shims();
|
|
4502
4502
|
var MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
4503
4503
|
function formatDate(dateString) {
|
|
4504
|
+
if (!dateString || typeof dateString === "string" && dateString.trim() === "") {
|
|
4505
|
+
return "No date";
|
|
4506
|
+
}
|
|
4504
4507
|
const date = typeof dateString === "string" ? new Date(dateString) : dateString;
|
|
4505
4508
|
if (isNaN(date.getTime())) {
|
|
4506
4509
|
return "Invalid date";
|
|
@@ -4927,6 +4930,8 @@ function failStepSpinner(spinner, currentStep, totalSteps, text) {
|
|
|
4927
4930
|
|
|
4928
4931
|
// src/commands/sync.ts
|
|
4929
4932
|
async function promptSelectService() {
|
|
4933
|
+
const nonGitServices = ["atlassian", "jira", "confluence"];
|
|
4934
|
+
const authenticatedServices = await storageService.getAuthenticatedServices();
|
|
4930
4935
|
const allServices = [
|
|
4931
4936
|
"github",
|
|
4932
4937
|
"gitlab",
|
|
@@ -4935,22 +4940,26 @@ async function promptSelectService() {
|
|
|
4935
4940
|
"jira",
|
|
4936
4941
|
"confluence"
|
|
4937
4942
|
];
|
|
4938
|
-
const authenticatedServices = await storageService.getAuthenticatedServices();
|
|
4939
4943
|
const authenticatedSyncServices = authenticatedServices.filter(
|
|
4940
4944
|
(service) => service !== "bragduck" && allServices.includes(service)
|
|
4941
4945
|
);
|
|
4942
|
-
const serviceChoices =
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4946
|
+
const serviceChoices = [
|
|
4947
|
+
{
|
|
4948
|
+
name: "Git Contributions (current dir)",
|
|
4949
|
+
value: "git",
|
|
4950
|
+
description: "Sync from your local repository (GitHub, GitLab, or Bitbucket)"
|
|
4951
|
+
}
|
|
4952
|
+
];
|
|
4953
|
+
for (const service of nonGitServices) {
|
|
4954
|
+
const isAuth = await storageService.isServiceAuthenticated(service);
|
|
4955
|
+
const indicator = isAuth ? "\u2713" : "\u2717";
|
|
4956
|
+
const serviceLabel = service.charAt(0).toUpperCase() + service.slice(1);
|
|
4957
|
+
serviceChoices.push({
|
|
4958
|
+
name: `${indicator} ${serviceLabel}`,
|
|
4959
|
+
value: service,
|
|
4960
|
+
description: isAuth ? "Authenticated" : "Not authenticated"
|
|
4961
|
+
});
|
|
4962
|
+
}
|
|
4954
4963
|
if (authenticatedSyncServices.length > 0) {
|
|
4955
4964
|
const serviceNames = authenticatedSyncServices.map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join(", ");
|
|
4956
4965
|
serviceChoices.push({
|
|
@@ -5157,7 +5166,7 @@ async function syncSingleService(sourceType, options, TOTAL_STEPS, sharedDays, s
|
|
|
5157
5166
|
description: refined.refined_description,
|
|
5158
5167
|
tags: refined.suggested_tags,
|
|
5159
5168
|
repository: repoInfo.url,
|
|
5160
|
-
date: originalCommit?.date ||
|
|
5169
|
+
date: originalCommit?.date || (/* @__PURE__ */ new Date()).toISOString(),
|
|
5161
5170
|
commit_url: originalCommit?.url || "",
|
|
5162
5171
|
impact_score: refined.suggested_impactLevel,
|
|
5163
5172
|
impact_description: refined.impact_description,
|
|
@@ -5199,7 +5208,7 @@ async function syncSingleService(sourceType, options, TOTAL_STEPS, sharedDays, s
|
|
|
5199
5208
|
}
|
|
5200
5209
|
const createdBrags = createResponse.brags.map((brag) => ({
|
|
5201
5210
|
title: brag.title,
|
|
5202
|
-
date: brag.
|
|
5211
|
+
date: brag.date,
|
|
5203
5212
|
source: sourceType
|
|
5204
5213
|
}));
|
|
5205
5214
|
return { created: createResponse.created, skipped: duplicates.length, createdBrags };
|
|
@@ -5419,7 +5428,33 @@ async function syncCommand(options = {}) {
|
|
|
5419
5428
|
} else {
|
|
5420
5429
|
const detectionSpinner = createStepSpinner(1, TOTAL_STEPS, "Preparing sync");
|
|
5421
5430
|
detectionSpinner.start();
|
|
5422
|
-
|
|
5431
|
+
if (selectedSource === "git") {
|
|
5432
|
+
try {
|
|
5433
|
+
const { detected } = await sourceDetector.detectSources();
|
|
5434
|
+
const gitSource = detected.find(
|
|
5435
|
+
(source) => ["github", "gitlab", "bitbucket", "atlassian"].includes(source.type)
|
|
5436
|
+
);
|
|
5437
|
+
if (!gitSource) {
|
|
5438
|
+
failStepSpinner(detectionSpinner, 1, TOTAL_STEPS, "Not a git repository");
|
|
5439
|
+
logger.log("");
|
|
5440
|
+
logger.error("No git repository detected in current directory");
|
|
5441
|
+
logger.log("");
|
|
5442
|
+
logger.info("Navigate to a git repository or select a different service");
|
|
5443
|
+
return;
|
|
5444
|
+
}
|
|
5445
|
+
sourceType = gitSource.type;
|
|
5446
|
+
logger.debug(`Detected git service: ${sourceType}`);
|
|
5447
|
+
} catch (error) {
|
|
5448
|
+
logger.debug(`Git detection error: ${error}`);
|
|
5449
|
+
failStepSpinner(detectionSpinner, 1, TOTAL_STEPS, "Failed to detect git service");
|
|
5450
|
+
logger.log("");
|
|
5451
|
+
logger.error("Could not detect git repository");
|
|
5452
|
+
logger.log("");
|
|
5453
|
+
return;
|
|
5454
|
+
}
|
|
5455
|
+
} else {
|
|
5456
|
+
sourceType = selectedSource;
|
|
5457
|
+
}
|
|
5423
5458
|
if (sourceType === "jira" || sourceType === "confluence") {
|
|
5424
5459
|
const creds = await storageService.getServiceCredentials(sourceType);
|
|
5425
5460
|
const envInstance = loadEnvConfig()[`${sourceType}Instance`];
|