@snelusha/noto 1.1.2 → 1.1.3

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.
Files changed (3) hide show
  1. package/README.md +12 -0
  2. package/dist/index.js +69 -2
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -118,6 +118,18 @@ To list all branches, including remote branches, use the -r flag
118
118
  noto branch -r
119
119
  ```
120
120
 
121
+ Delete local branches:
122
+
123
+ ```bash
124
+ noto branch delete
125
+ ```
126
+
127
+ If you need to force delete a branch, you can use the force flag:
128
+
129
+ ```bash
130
+ noto branch delete --force # simply: noto branch delete -f
131
+ ```
132
+
121
133
  ## Pro Tips
122
134
 
123
135
  - 🚀 Get fast commits on the fly with `noto -e -a` to streamline your workflow!
package/dist/index.js CHANGED
@@ -222,6 +222,14 @@ var checkout = async (branch) => {
222
222
  return false;
223
223
  }
224
224
  };
225
+ var deleteBranches = async (branches, force = false) => {
226
+ try {
227
+ const result = await git.deleteLocalBranches(branches, force);
228
+ return result.success;
229
+ } catch {
230
+ return false;
231
+ }
232
+ };
225
233
 
226
234
  // src/middleware/git.ts
227
235
  var withRepository = (fn, options = { enabled: true }) => {
@@ -616,6 +624,65 @@ var current = {
616
624
  { enabled: false }
617
625
  )
618
626
  };
627
+ var del = {
628
+ name: "delete",
629
+ description: "delete a branch",
630
+ usage: "branch delete <branch>",
631
+ options: [
632
+ {
633
+ type: Boolean,
634
+ flag: "--force",
635
+ alias: "-f",
636
+ description: "force delete a branch"
637
+ }
638
+ ],
639
+ execute: withRepository(
640
+ async (options) => {
641
+ if (!options.isRepo) {
642
+ p5.log.error(
643
+ dedent5`${color5.red("no git repository found in cwd.")}
644
+ ${color5.dim(`run ${color5.cyan("`git init`")} to initialize a new repository.`)}`
645
+ );
646
+ return await exit(1);
647
+ }
648
+ const branches = await getBranches();
649
+ if (!branches) {
650
+ p5.log.error("failed to fetch branches");
651
+ return await exit(1);
652
+ }
653
+ const selectedBranches = await p5.multiselect({
654
+ message: "select branches to delete",
655
+ options: branches.map((branch) => ({
656
+ value: branch,
657
+ label: color5.bold(branch),
658
+ hint: branch === options["--current"] ? "current branch" : void 0
659
+ }))
660
+ });
661
+ if (p5.isCancel(selectedBranches)) {
662
+ p5.log.error("nothing selected!");
663
+ return await exit(1);
664
+ }
665
+ if (!selectedBranches) {
666
+ p5.log.error("no branch selected");
667
+ return await exit(1);
668
+ }
669
+ const force = options["--force"];
670
+ const currentBranch = await getCurrentBranch();
671
+ if (currentBranch && selectedBranches.includes(currentBranch)) {
672
+ p5.log.error("cannot delete current branch");
673
+ return await exit(1);
674
+ }
675
+ const deletedBranches = await deleteBranches(selectedBranches, force);
676
+ if (!deletedBranches) {
677
+ p5.log.error("failed to delete branches");
678
+ return await exit(1);
679
+ }
680
+ p5.log.success("branches deleted successfully");
681
+ await exit(0);
682
+ },
683
+ { enabled: false }
684
+ )
685
+ };
619
686
  var command3 = {
620
687
  name: "branch",
621
688
  description: "list branches",
@@ -669,7 +736,7 @@ var command3 = {
669
736
  },
670
737
  { enabled: false }
671
738
  ),
672
- subCommands: [current]
739
+ subCommands: [current, del]
673
740
  };
674
741
  var branch_default = command3;
675
742
 
@@ -911,7 +978,7 @@ var listCommand = () => {
911
978
  };
912
979
 
913
980
  // package.json
914
- var version = "1.1.2";
981
+ var version = "1.1.3";
915
982
 
916
983
  // src/index.ts
917
984
  var globalSpec = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snelusha/noto",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Generate clean commit messages in a snap! ✨",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -42,7 +42,7 @@
42
42
  "cli"
43
43
  ],
44
44
  "devDependencies": {
45
- "@types/node": "^22.14.0",
45
+ "@types/node": "^22.14.1",
46
46
  "tsup": "^8.4.0",
47
47
  "typescript": "^5.8.3",
48
48
  "vitest": "^3.1.1"
@@ -50,7 +50,7 @@
50
50
  "dependencies": {
51
51
  "@ai-sdk/google": "^1.2.10",
52
52
  "@clack/prompts": "^0.10.1",
53
- "ai": "^4.3.4",
53
+ "ai": "^4.3.5",
54
54
  "arg": "^5.0.2",
55
55
  "clipboardy": "^4.0.0",
56
56
  "dedent": "^1.5.3",