fireflyy 4.0.0-alpha.8 → 4.0.0-dev.3098d1f

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.
@@ -6,17 +6,6 @@
6
6
  *
7
7
  * @param options - The configuration options
8
8
  * @returns The same options (identity function for type inference)
9
- *
10
- * @example
11
- * ```ts
12
- * export default defineConfig({
13
- * verbose: true,
14
- * release: {
15
- * bumpStrategy: "conventional",
16
- * releaseType: "github",
17
- * },
18
- * });
19
- * ```
20
9
  */
21
10
  function defineConfig(options) {
22
11
  return options;
@@ -1,5 +1,5 @@
1
- import { t as logger } from "./main.js";
2
- import { i as FireflyOkAsync } from "./result.constructors-C9M1MP3_.js";
1
+ import { i as FireflyOkAsync } from "./result.constructors-D9jmQ0uj.js";
2
+ import { t as logger } from "./logging-BuIkRrn1.js";
3
3
 
4
4
  //#region src/infrastructure/dry-run/index.ts
5
5
  /**
@@ -1,6 +1,7 @@
1
- import { c as notFoundErrAsync } from "./result.constructors-C9M1MP3_.js";
2
- import { n as wrapPromise } from "./result.utilities-oXWCXEvw.js";
3
- import { t as withDryRun } from "./dry-run-BfYCtldz.js";
1
+ import { l as notFoundErrAsync } from "./result.constructors-D9jmQ0uj.js";
2
+ import { n as wrapPromise } from "./result.utilities-DiG1ae54.js";
3
+ import { t as logger } from "./logging-BuIkRrn1.js";
4
+ import { t as withDryRun } from "./dry-run-BPDFHMIs.js";
4
5
 
5
6
  //#region src/services/implementations/filesystem.service.ts
6
7
  /**
@@ -29,21 +30,18 @@ var DefaultFileSystemService = class {
29
30
  }
30
31
  exists(path) {
31
32
  const resolved = this.resolvePath(path);
32
- return wrapPromise(Bun.file(resolved).exists());
33
+ return wrapPromise(Bun.file(resolved).exists()).andTee(() => logger.verbose(`DefaultFileSystemService: Checked existence of file: ${resolved}`));
33
34
  }
34
35
  read(path) {
35
36
  const resolved = this.resolvePath(path);
36
37
  const file = Bun.file(resolved);
37
38
  return wrapPromise(file.exists()).andThen((fileExists) => {
38
- if (!fileExists) return notFoundErrAsync({
39
- message: `File not found: ${resolved}`,
40
- source: "FileSystemService.read"
41
- });
42
- return wrapPromise(file.text());
39
+ if (!fileExists) return notFoundErrAsync({ message: `File not found: ${resolved}` });
40
+ return wrapPromise(file.text()).andTee(() => logger.verbose(`DefaultFileSystemService: Read file: ${resolved}`));
43
41
  });
44
42
  }
45
43
  write(path, content, options) {
46
- return withDryRun(options, `Writing to ${this.resolvePath(path)}`, () => wrapPromise(Bun.write(this.resolvePath(path), content).then(() => {})));
44
+ return withDryRun(options, `Writing to ${this.resolvePath(path)}`, () => wrapPromise(Bun.write(this.resolvePath(path), content).then(() => {})).andTee(() => logger.verbose(`DefaultFileSystemService: Wrote file: ${this.resolvePath(path)}`)));
47
45
  }
48
46
  };
49
47
  /**
@@ -1,6 +1,6 @@
1
- import { t as logger } from "./main.js";
2
- import { i as FireflyOkAsync, m as failedError, o as failedErrAsync } from "./result.constructors-C9M1MP3_.js";
3
- import { t as withDryRun } from "./dry-run-BfYCtldz.js";
1
+ import { h as failedError, i as FireflyOkAsync, o as failedErrAsync } from "./result.constructors-D9jmQ0uj.js";
2
+ import { t as logger } from "./logging-BuIkRrn1.js";
3
+ import { t as withDryRun } from "./dry-run-BPDFHMIs.js";
4
4
  import { ResultAsync } from "neverthrow";
5
5
  import { z } from "zod";
6
6
 
@@ -250,14 +250,14 @@ var DefaultGitService = class {
250
250
  return executeGitCommand(args, {
251
251
  cwd: this.cwd,
252
252
  dryRun: options?.dryRun,
253
- verbose: options?.verbose ?? false
253
+ verbose: options?.verbose ?? true
254
254
  });
255
255
  }
256
256
  isInsideRepository() {
257
257
  return this.git(["rev-parse", "--is-inside-work-tree"]).map(() => true).orElse(() => FireflyOkAsync(false));
258
258
  }
259
259
  getRepositoryRoot() {
260
- return this.git(["rev-parse", "--show-toplevel"]).map((output) => output.trim());
260
+ return this.git(["rev-parse", "--show-toplevel"]).andTee(() => logger.verbose("DefaultGitService: Resolving repository root")).map((output) => output.trim()).andTee(() => logger.verbose("DefaultGitService: Repository root resolved"));
261
261
  }
262
262
  getRemoteUrl(remote) {
263
263
  const remoteName = remote ?? "origin";
@@ -280,12 +280,14 @@ var DefaultGitService = class {
280
280
  else if (index !== " " && index !== "?") hasStaged = true;
281
281
  if (workTree !== " " && workTree !== "?") hasUnstaged = true;
282
282
  }
283
- return {
283
+ const status = {
284
284
  hasStaged,
285
285
  hasUnstaged,
286
286
  hasUntracked,
287
287
  isClean: lines.length === 0
288
288
  };
289
+ logger.verbose(`DefaultGitService: Git status: staged=${status.hasStaged},unstaged=${status.hasUnstaged},untracked=${status.hasUntracked},clean=${status.isClean}`);
290
+ return status;
289
291
  });
290
292
  }
291
293
  isWorkingTreeClean() {
@@ -312,7 +314,7 @@ var DefaultGitService = class {
312
314
  const includeStaged = filter?.staged ?? true;
313
315
  const includeUnstaged = filter?.unstaged ?? true;
314
316
  return this.git(["status", "--porcelain"]).map((output) => {
315
- return this.parseStatusOutput(output).filter((file) => {
317
+ const filtered = this.parseStatusOutput(output).filter((file) => {
316
318
  const isStaged = file.indexStatus !== " " && file.indexStatus !== "?";
317
319
  const isUnstaged = file.workTreeStatus !== " " && file.workTreeStatus !== "?";
318
320
  if (includeStaged && includeUnstaged) return isStaged || isUnstaged;
@@ -320,6 +322,8 @@ var DefaultGitService = class {
320
322
  if (includeUnstaged) return isUnstaged;
321
323
  return false;
322
324
  });
325
+ logger.verbose(`DefaultGitService: Found ${filtered.length} file(s) for filter staged=${includeStaged} unstaged=${includeUnstaged}`);
326
+ return filtered;
323
327
  });
324
328
  }
325
329
  getFileNames(filter) {
@@ -344,11 +348,13 @@ var DefaultGitService = class {
344
348
  const isRemote = line.includes("remotes/");
345
349
  let branchName = line.replace(CURRENT_BRANCH_MARKER_REGEX, "").trim();
346
350
  if (isRemote) branchName = branchName.replace(REMOTES_PREFIX_REGEX, "");
347
- return {
351
+ const branch = {
348
352
  name: branchName,
349
353
  isCurrent,
350
354
  isRemote
351
355
  };
356
+ logger.verbose(`DefaultGitService: Parsed branch: ${branch.name} current=${branch.isCurrent} remote=${branch.isRemote}`);
357
+ return branch;
352
358
  }
353
359
  listBranches(includeRemote) {
354
360
  const args = ["branch"];
@@ -359,7 +365,7 @@ var DefaultGitService = class {
359
365
  }
360
366
  createCommit(message, options) {
361
367
  if (options?.dryRun) {
362
- logger.verbose("GitService: Dry run, skipping commit");
368
+ logger.verbose("DefaultGitService: Dry run, skipping commit");
363
369
  return FireflyOkAsync({ sha: "dry-run-sha" });
364
370
  }
365
371
  const args = [
@@ -402,6 +408,7 @@ var DefaultGitService = class {
402
408
  `${upstream}..HEAD`
403
409
  ]).map((output) => {
404
410
  const count = Number.parseInt(output.trim(), 10) || 0;
411
+ logger.verbose(`DefaultGitService: Unpushed commits count for ${upstream}: ${count}`);
405
412
  return {
406
413
  hasUnpushed: count > 0,
407
414
  count
@@ -413,6 +420,7 @@ var DefaultGitService = class {
413
420
  "HEAD"
414
421
  ]).map((output) => {
415
422
  const count = Number.parseInt(output.trim(), 10) || 0;
423
+ logger.verbose(`DefaultGitService: Total commit count: ${count}`);
416
424
  return {
417
425
  hasUnpushed: count > 0,
418
426
  count
@@ -426,7 +434,7 @@ var DefaultGitService = class {
426
434
  }
427
435
  createTag(name, options) {
428
436
  if (options?.dryRun) {
429
- logger.verbose(`GitService: Dry run, skipping tag creation: ${name}`);
437
+ logger.verbose(`DefaultGitService: Dry run, skipping tag creation: ${name}`);
430
438
  return FireflyOkAsync(void 0);
431
439
  }
432
440
  const args = ["tag"];
@@ -439,7 +447,7 @@ var DefaultGitService = class {
439
447
  const scope = options?.scope ?? "local";
440
448
  const remote = options?.remote ?? "origin";
441
449
  if (options?.dryRun) {
442
- logger.verbose(`GitService: Dry run, skipping tag deletion (${scope}): ${name}`);
450
+ logger.verbose(`DefaultGitService: Dry run, skipping tag deletion (${scope}): ${name}`);
443
451
  return FireflyOkAsync(void 0);
444
452
  }
445
453
  if (scope === "local") return this.git([
@@ -447,11 +455,15 @@ var DefaultGitService = class {
447
455
  "-d",
448
456
  name
449
457
  ]).map(() => void 0);
450
- if (scope === "remote") return this.git([
451
- "push",
452
- remote,
453
- `:refs/tags/${name}`
454
- ]).map(() => void 0);
458
+ if (scope === "remote") {
459
+ logger.verbose(`DefaultGitService: Deleting remote tag: ${name} on ${remote}`);
460
+ return this.git([
461
+ "push",
462
+ remote,
463
+ `:refs/tags/${name}`
464
+ ]).andTee(() => logger.verbose(`DefaultGitService: Remote tag deleted: ${name} on ${remote}`)).map(() => void 0);
465
+ }
466
+ logger.verbose(`DefaultGitService: Deleting tag locally and remotely: ${name} on ${remote}`);
455
467
  return this.git([
456
468
  "tag",
457
469
  "-d",
@@ -460,17 +472,21 @@ var DefaultGitService = class {
460
472
  "push",
461
473
  remote,
462
474
  `:refs/tags/${name}`
463
- ])).map(() => void 0);
475
+ ])).andTee(() => logger.verbose(`DefaultGitService: Local and remote tag deleted: ${name} on ${remote}`)).map(() => void 0);
464
476
  }
465
477
  hasTag(name) {
466
478
  return this.git([
467
479
  "tag",
468
480
  "--list",
469
481
  name
470
- ]).map((output) => output.trim() === name);
482
+ ]).map((output) => {
483
+ const exists = output.trim() === name;
484
+ logger.verbose(`DefaultGitService: Tag ${name} exists=${exists}`);
485
+ return exists;
486
+ });
471
487
  }
472
488
  hasAnyTags() {
473
- return this.getLatestTag().map((tag) => tag !== null);
489
+ return this.getLatestTag().andTee(() => logger.verbose("DefaultGitService: Checking if any tags exist")).map((tag) => tag !== null);
474
490
  }
475
491
  listTags() {
476
492
  return this.git(["tag", "--list"]).map((output) => output.split("\n").map((tag) => tag.trim()).filter((tag) => tag.length > 0));
@@ -494,25 +510,28 @@ var DefaultGitService = class {
494
510
  "--format=%(contents)",
495
511
  name
496
512
  ]).map((output) => {
497
- return output.trim() || null;
513
+ const message = output.trim();
514
+ logger.verbose(`DefaultGitService: Tag message for ${name}: ${message?.substring(0, 60) ?? "(none)"}`);
515
+ return message || null;
498
516
  }).orElse(() => FireflyOkAsync(null));
499
517
  }
500
518
  stage(paths) {
501
519
  const pathArray = Array.isArray(paths) ? paths : [paths];
502
- return this.git(["add", ...pathArray]).map(() => void 0);
520
+ return this.git(["add", ...pathArray]).andTee(() => logger.verbose(`DefaultGitService: Staged paths: ${pathArray.join(", ")}`)).map(() => void 0);
503
521
  }
504
522
  unstage(paths) {
505
523
  const pathArray = Array.isArray(paths) ? paths : [paths];
524
+ logger.verbose(`DefaultGitService: Unstaging paths: ${pathArray.join(", ")}`);
506
525
  return this.git([
507
526
  "reset",
508
527
  "HEAD",
509
528
  "--",
510
529
  ...pathArray
511
- ]).map(() => void 0);
530
+ ]).andTee(() => logger.verbose(`DefaultGitService: Unstaged paths: ${pathArray.join(", ")}`)).map(() => void 0);
512
531
  }
513
532
  push(options) {
514
533
  if (options?.dryRun) {
515
- logger.verbose("GitService: Dry run, skipping push");
534
+ logger.verbose("DefaultGitService: Dry run, skipping push");
516
535
  return FireflyOkAsync(void 0);
517
536
  }
518
537
  const args = ["push"];
@@ -523,6 +542,59 @@ var DefaultGitService = class {
523
542
  if (options?.followTags) args.push("--follow-tags");
524
543
  return this.git(args).map(() => void 0);
525
544
  }
545
+ /**
546
+ * Gets the upstream remote name for the current branch.
547
+ * @returns The remote name or null if no upstream is configured.
548
+ */
549
+ getUpstreamRemote() {
550
+ return this.git([
551
+ "rev-parse",
552
+ "--abbrev-ref",
553
+ "--symbolic-full-name",
554
+ "@{upstream}"
555
+ ]).map((output) => {
556
+ const upstream = output.trim();
557
+ const slashIndex = upstream.indexOf("/");
558
+ if (slashIndex > 0) return upstream.substring(0, slashIndex);
559
+ return null;
560
+ }).orElse(() => FireflyOkAsync(null));
561
+ }
562
+ /**
563
+ * Lists all configured remotes.
564
+ * @returns Array of remote names.
565
+ */
566
+ listRemotes() {
567
+ return this.git(["remote"]).map((output) => output.split("\n").map((remote) => remote.trim()).filter((remote) => remote.length > 0));
568
+ }
569
+ inferRepositoryUrl() {
570
+ return this.getUpstreamRemote().andThen((upstreamRemote) => {
571
+ if (upstreamRemote) {
572
+ logger.verbose(`DefaultGitService: Inferring repository URL from upstream remote: ${upstreamRemote}`);
573
+ return this.getRemoteUrl(upstreamRemote).map((url) => url).orElse(() => this.tryOriginOrFirstRemote());
574
+ }
575
+ logger.verbose("DefaultGitService: No upstream remote; falling back to origin or first remote");
576
+ return this.tryOriginOrFirstRemote();
577
+ });
578
+ }
579
+ /**
580
+ * Tries to get the repository URL from 'origin' or the first available remote.
581
+ */
582
+ tryOriginOrFirstRemote() {
583
+ return this.getRemoteUrl("origin").map((url) => {
584
+ logger.verbose("DefaultGitService: Inferring repository URL from origin remote");
585
+ return url;
586
+ }).orElse(() => {
587
+ return this.listRemotes().andThen((remotes) => {
588
+ if (remotes.length === 0) {
589
+ logger.verbose("DefaultGitService: No remotes configured, cannot infer repository URL");
590
+ return FireflyOkAsync(null);
591
+ }
592
+ const firstRemote = remotes[0];
593
+ logger.verbose(`DefaultGitService: Inferring repository URL from first remote: ${firstRemote}`);
594
+ return this.getRemoteUrl(firstRemote).map((url) => url).orElse(() => FireflyOkAsync(null));
595
+ });
596
+ });
597
+ }
526
598
  };
527
599
  /**
528
600
  * Creates a git service instance.
@@ -0,0 +1,20 @@
1
+ import { createConsola } from "consola";
2
+ import { colors } from "consola/utils";
3
+
4
+ //#region src/infrastructure/logging/index.ts
5
+ const opts = {
6
+ date: false,
7
+ compact: true,
8
+ columns: 0
9
+ };
10
+ const _logger = createConsola({ formatOptions: opts });
11
+ const logger = createConsola({
12
+ formatOptions: opts,
13
+ reporters: [{ log(logObj) {
14
+ if (logObj.type === "verbose") console.log(colors.gray(logObj.args.join(" ")));
15
+ else _logger.log(logObj);
16
+ } }]
17
+ });
18
+
19
+ //#endregion
20
+ export { logger as t };
package/dist/main.js CHANGED
@@ -1,7 +1,4 @@
1
1
  #!/usr/bin/env bun
2
- import { createConsola } from "consola";
3
- import { colors } from "consola/utils";
4
-
5
2
  //#region src/core/environment/runtime-env.ts
6
3
  /**
7
4
  * These are set during CLI initialization in main.ts and provide
@@ -53,25 +50,9 @@ var RuntimeEnv = class {
53
50
  }
54
51
  };
55
52
 
56
- //#endregion
57
- //#region src/infrastructure/logging/index.ts
58
- const opts = {
59
- date: false,
60
- compact: true,
61
- columns: 0
62
- };
63
- const _logger = createConsola({ formatOptions: opts });
64
- const logger = createConsola({
65
- formatOptions: opts,
66
- reporters: [{ log(logObj) {
67
- if (logObj.type === "verbose") console.log(colors.gray(logObj.args.join(" ")));
68
- else _logger.log(logObj);
69
- } }]
70
- });
71
-
72
53
  //#endregion
73
54
  //#region package.json
74
- var version = "4.0.0-alpha.8";
55
+ var version = "4.0.0-dev.3098d1f";
75
56
  var description = " CLI orchestrator for automatic semantic versioning, changelog generation, and creating releases. Built for my own use cases.";
76
57
  var dependencies = {
77
58
  "c12": "^3.3.2",
@@ -99,13 +80,10 @@ async function main() {
99
80
  description,
100
81
  gitCliffVersion: dependencies["git-cliff"]?.replace("^", "") || "unknown"
101
82
  });
102
- const { createFireflyCLI } = await import("./program-CASpr1JR.js");
103
- createFireflyCLI().parseAsync(process.argv).catch((error) => {
104
- logger.error("Fatal error:", error);
105
- process.exit(1);
106
- });
83
+ const { createFireflyCLI } = await import("./program-DSsTcwvN.js");
84
+ createFireflyCLI().parseAsync(process.argv).catch(() => process.exit(1));
107
85
  }
108
86
  main();
109
87
 
110
88
  //#endregion
111
- export { RuntimeEnv as n, logger as t };
89
+ export { RuntimeEnv as t };
@@ -1,5 +1,6 @@
1
- import { d as validationErrAsync, g as toFireflyError, i as FireflyOkAsync, u as validationErr } from "./result.constructors-C9M1MP3_.js";
2
- import { n as parseSchema } from "./schema.utilities-BGd9t1wm.js";
1
+ import { d as validationErr, f as validationErrAsync, i as FireflyOkAsync, v as toFireflyError } from "./result.constructors-D9jmQ0uj.js";
2
+ import { t as logger } from "./logging-BuIkRrn1.js";
3
+ import { n as parseSchema } from "./schema.utilities-Y2MdlRMu.js";
3
4
  import { Result } from "neverthrow";
4
5
  import z$1 from "zod";
5
6
 
@@ -28,7 +29,7 @@ var DefaultPackageJsonService = class DefaultPackageJsonService {
28
29
  return this.fs.read(path).map((content) => this.replaceVersionInContent(content, newVersion)).andThen((updatedContent) => this.fs.write(path, updatedContent)).andThen(() => this.read(path).andThen((pkg) => {
29
30
  if (pkg.version !== newVersion) return validationErrAsync({ message: `Failed to verify updated version in package.json at path: ${path}` });
30
31
  return FireflyOkAsync(void 0);
31
- }));
32
+ })).andTee(() => logger.verbose(`DefaultPackageJsonService: Updated version in package.json at path: ${path} to ${newVersion}`));
32
33
  }
33
34
  /**
34
35
  * Replaces the version string in the package.json content.