@snelusha/noto 1.1.1 → 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.
- package/README.md +15 -3
- package/dist/index.js +239 -91
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -109,13 +109,25 @@ noto checkout
|
|
|
109
109
|
To copy the selected branch to your clipboard immediately after choosing it, use the new `-c` flag:
|
|
110
110
|
|
|
111
111
|
```bash
|
|
112
|
-
noto
|
|
112
|
+
noto branch
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
To list all branches, including remote branches, use the -r flag
|
|
115
|
+
To list all branches, including remote branches, use the -r flag
|
|
116
116
|
|
|
117
117
|
```bash
|
|
118
|
-
noto
|
|
118
|
+
noto branch -r
|
|
119
|
+
```
|
|
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
|
|
119
131
|
```
|
|
120
132
|
|
|
121
133
|
## Pro Tips
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
2
|
+
import * as p8 from "@clack/prompts";
|
|
3
|
+
import color9 from "picocolors";
|
|
4
4
|
|
|
5
5
|
// src/utils/parser.ts
|
|
6
6
|
import arg from "arg";
|
|
@@ -12,21 +12,21 @@ var parse = (schema, raw) => {
|
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
14
|
var safeParse = (schema, raw) => {
|
|
15
|
-
let
|
|
15
|
+
let current2 = { ...schema };
|
|
16
16
|
let iterations = 0;
|
|
17
|
-
const maxIterations = Object.keys(
|
|
18
|
-
(key2) =>
|
|
17
|
+
const maxIterations = Object.keys(current2).filter(
|
|
18
|
+
(key2) => current2[key2] === String
|
|
19
19
|
).length;
|
|
20
20
|
while (iterations++ < maxIterations) {
|
|
21
21
|
try {
|
|
22
|
-
return parse(
|
|
22
|
+
return parse(current2, raw);
|
|
23
23
|
} catch (error) {
|
|
24
24
|
if (error.code === "ARG_MISSING_REQUIRED_LONGARG") {
|
|
25
25
|
const match = error.message.match(/(--\w[\w-]*)/);
|
|
26
26
|
if (match) {
|
|
27
27
|
const missingFlag = match[0];
|
|
28
|
-
if (
|
|
29
|
-
|
|
28
|
+
if (current2[missingFlag] === String) {
|
|
29
|
+
current2[missingFlag] = Boolean;
|
|
30
30
|
continue;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -34,7 +34,7 @@ var safeParse = (schema, raw) => {
|
|
|
34
34
|
throw error;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
return parse(
|
|
37
|
+
return parse(current2, raw);
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
// src/commands/noto.ts
|
|
@@ -62,9 +62,7 @@ var AvailableModelsSchema = z.enum([
|
|
|
62
62
|
"gemini-1.5-flash-8b-latest",
|
|
63
63
|
"gemini-1.5-pro",
|
|
64
64
|
"gemini-1.5-pro-latest",
|
|
65
|
-
"gemini-2.0-flash-
|
|
66
|
-
"gemini-2.0-flash-exp",
|
|
67
|
-
"gemini-2.0-pro-exp-02-05",
|
|
65
|
+
"gemini-2.0-flash-001",
|
|
68
66
|
"gemini-2.5-pro-exp-03-25"
|
|
69
67
|
]);
|
|
70
68
|
|
|
@@ -224,6 +222,14 @@ var checkout = async (branch) => {
|
|
|
224
222
|
return false;
|
|
225
223
|
}
|
|
226
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
|
+
};
|
|
227
233
|
|
|
228
234
|
// src/middleware/git.ts
|
|
229
235
|
var withRepository = (fn, options = { enabled: true }) => {
|
|
@@ -274,7 +280,7 @@ var NotoError = class _NotoError extends Error {
|
|
|
274
280
|
var google = createGoogleGenerativeAI({
|
|
275
281
|
apiKey: (await StorageManager.get()).llm?.apiKey ?? "api-key"
|
|
276
282
|
});
|
|
277
|
-
var defaultModel = "gemini-2.0-
|
|
283
|
+
var defaultModel = "gemini-2.0-flash-001";
|
|
278
284
|
var models = {
|
|
279
285
|
"gemini-1.5-flash": google("gemini-1.5-flash"),
|
|
280
286
|
"gemini-1.5-flash-latest": google("gemini-1.5-flash-latest"),
|
|
@@ -282,22 +288,18 @@ var models = {
|
|
|
282
288
|
"gemini-1.5-flash-8b-latest": google("gemini-1.5-flash-8b-latest"),
|
|
283
289
|
"gemini-1.5-pro": google("gemini-1.5-pro"),
|
|
284
290
|
"gemini-1.5-pro-latest": google("gemini-1.5-pro-latest"),
|
|
285
|
-
"gemini-2.0-flash-
|
|
286
|
-
"gemini-2.0-flash-lite-preview-02-05"
|
|
287
|
-
),
|
|
288
|
-
"gemini-2.0-flash-exp": google("gemini-2.0-flash-exp"),
|
|
289
|
-
"gemini-2.0-pro-exp-02-05": google("gemini-2.0-pro-exp-02-05"),
|
|
291
|
+
"gemini-2.0-flash-001": google("gemini-2.0-flash-001"),
|
|
290
292
|
"gemini-2.5-pro-exp-03-25": google("gemini-2.5-pro-exp-03-25")
|
|
291
293
|
};
|
|
292
294
|
var availableModels = Object.keys(models);
|
|
293
295
|
var getModel = async () => {
|
|
294
296
|
let model2 = (await StorageManager.get()).llm?.model;
|
|
295
|
-
if (!model2) {
|
|
297
|
+
if (!model2 || model2 === "gemini-2.0-pro-exp-02-05") {
|
|
296
298
|
model2 = defaultModel;
|
|
297
|
-
await StorageManager.update((
|
|
298
|
-
...
|
|
299
|
+
await StorageManager.update((current2) => ({
|
|
300
|
+
...current2,
|
|
299
301
|
llm: {
|
|
300
|
-
...
|
|
302
|
+
...current2.llm,
|
|
301
303
|
model: model2
|
|
302
304
|
}
|
|
303
305
|
}));
|
|
@@ -441,8 +443,8 @@ var command = {
|
|
|
441
443
|
message = editedMessage;
|
|
442
444
|
p3.log.step(color3.green(message));
|
|
443
445
|
}
|
|
444
|
-
await StorageManager.update((
|
|
445
|
-
...
|
|
446
|
+
await StorageManager.update((current2) => ({
|
|
447
|
+
...current2,
|
|
446
448
|
lastGeneratedMessage: message
|
|
447
449
|
}));
|
|
448
450
|
if (options["--copy"]) {
|
|
@@ -539,8 +541,8 @@ var command2 = {
|
|
|
539
541
|
return await exit(1);
|
|
540
542
|
}
|
|
541
543
|
lastGeneratedMessage = editedMessage;
|
|
542
|
-
await StorageManager.update((
|
|
543
|
-
...
|
|
544
|
+
await StorageManager.update((current2) => ({
|
|
545
|
+
...current2,
|
|
544
546
|
lastGeneratedMessage: editedMessage
|
|
545
547
|
}));
|
|
546
548
|
p4.log.step(color4.green(lastGeneratedMessage));
|
|
@@ -581,22 +583,111 @@ var command2 = {
|
|
|
581
583
|
};
|
|
582
584
|
var prev_default = command2;
|
|
583
585
|
|
|
584
|
-
// src/commands/
|
|
586
|
+
// src/commands/branch.ts
|
|
585
587
|
import * as p5 from "@clack/prompts";
|
|
586
588
|
import color5 from "picocolors";
|
|
587
589
|
import clipboard3 from "clipboardy";
|
|
588
590
|
import dedent5 from "dedent";
|
|
589
|
-
var
|
|
590
|
-
name: "
|
|
591
|
-
description: "
|
|
592
|
-
usage: "
|
|
591
|
+
var current = {
|
|
592
|
+
name: "current",
|
|
593
|
+
description: "get current branch",
|
|
594
|
+
usage: "branch current",
|
|
593
595
|
options: [
|
|
594
596
|
{
|
|
595
597
|
type: Boolean,
|
|
596
598
|
flag: "--copy",
|
|
597
599
|
alias: "-c",
|
|
598
600
|
description: "copy the selected branch to clipboard"
|
|
601
|
+
}
|
|
602
|
+
],
|
|
603
|
+
execute: withRepository(
|
|
604
|
+
async (options) => {
|
|
605
|
+
if (!options.isRepo) {
|
|
606
|
+
p5.log.error(
|
|
607
|
+
dedent5`${color5.red("no git repository found in cwd.")}
|
|
608
|
+
${color5.dim(`run ${color5.cyan("`git init`")} to initialize a new repository.`)}`
|
|
609
|
+
);
|
|
610
|
+
return await exit(1);
|
|
611
|
+
}
|
|
612
|
+
const branch = await getCurrentBranch();
|
|
613
|
+
if (!branch) {
|
|
614
|
+
p5.log.error("failed to fetch current branch");
|
|
615
|
+
return await exit(1);
|
|
616
|
+
}
|
|
617
|
+
p5.log.success(`current branch: ${color5.bold(branch)}`);
|
|
618
|
+
if (options["--copy"]) {
|
|
619
|
+
clipboard3.writeSync(branch);
|
|
620
|
+
p5.log.success(`${color5.green("copied to clipboard!")}`);
|
|
621
|
+
}
|
|
622
|
+
await exit(0);
|
|
599
623
|
},
|
|
624
|
+
{ enabled: false }
|
|
625
|
+
)
|
|
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
|
+
};
|
|
686
|
+
var command3 = {
|
|
687
|
+
name: "branch",
|
|
688
|
+
description: "list branches",
|
|
689
|
+
usage: "branch [options]",
|
|
690
|
+
options: [
|
|
600
691
|
{
|
|
601
692
|
type: Boolean,
|
|
602
693
|
flag: "--remote",
|
|
@@ -621,7 +712,7 @@ var command3 = {
|
|
|
621
712
|
}
|
|
622
713
|
const currentBranch = await getCurrentBranch();
|
|
623
714
|
const branch = await p5.select({
|
|
624
|
-
message: "select a branch
|
|
715
|
+
message: "select a branch",
|
|
625
716
|
options: branches.map((branch2) => ({
|
|
626
717
|
value: branch2,
|
|
627
718
|
label: color5.bold(
|
|
@@ -639,68 +730,125 @@ var command3 = {
|
|
|
639
730
|
p5.log.error("no branch selected");
|
|
640
731
|
return await exit(1);
|
|
641
732
|
}
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
733
|
+
clipboard3.writeSync(branch);
|
|
734
|
+
p5.log.success(`${color5.green("copied to clipboard!")}`);
|
|
735
|
+
await exit(0);
|
|
736
|
+
},
|
|
737
|
+
{ enabled: false }
|
|
738
|
+
),
|
|
739
|
+
subCommands: [current, del]
|
|
740
|
+
};
|
|
741
|
+
var branch_default = command3;
|
|
742
|
+
|
|
743
|
+
// src/commands/checkout.ts
|
|
744
|
+
import * as p6 from "@clack/prompts";
|
|
745
|
+
import color6 from "picocolors";
|
|
746
|
+
import clipboard4 from "clipboardy";
|
|
747
|
+
import dedent6 from "dedent";
|
|
748
|
+
var command4 = {
|
|
749
|
+
name: "checkout",
|
|
750
|
+
description: "checkout a branch",
|
|
751
|
+
usage: "checkout [options]",
|
|
752
|
+
options: [
|
|
753
|
+
{
|
|
754
|
+
type: Boolean,
|
|
755
|
+
flag: "--copy",
|
|
756
|
+
alias: "-c",
|
|
757
|
+
description: "copy the selected branch to clipboard"
|
|
758
|
+
}
|
|
759
|
+
],
|
|
760
|
+
execute: withRepository(
|
|
761
|
+
async (options) => {
|
|
762
|
+
if (!options.isRepo) {
|
|
763
|
+
p6.log.error(
|
|
764
|
+
dedent6`${color6.red("no git repository found in cwd.")}
|
|
765
|
+
${color6.dim(`run ${color6.cyan("`git init`")} to initialize a new repository.`)}`
|
|
766
|
+
);
|
|
767
|
+
return await exit(1);
|
|
646
768
|
}
|
|
647
|
-
|
|
648
|
-
|
|
769
|
+
const branches = await getBranches();
|
|
770
|
+
if (!branches) {
|
|
771
|
+
p6.log.error("failed to fetch branches");
|
|
649
772
|
return await exit(1);
|
|
650
773
|
}
|
|
774
|
+
const currentBranch = await getCurrentBranch();
|
|
775
|
+
const branch = await p6.select({
|
|
776
|
+
message: "select a branch to checkout",
|
|
777
|
+
options: branches.map((branch2) => ({
|
|
778
|
+
value: branch2,
|
|
779
|
+
label: color6.bold(
|
|
780
|
+
branch2 === currentBranch ? color6.green(branch2) : branch2
|
|
781
|
+
),
|
|
782
|
+
hint: branch2 === currentBranch ? "current branch" : void 0
|
|
783
|
+
})),
|
|
784
|
+
initialValue: currentBranch
|
|
785
|
+
});
|
|
786
|
+
if (p6.isCancel(branch)) {
|
|
787
|
+
p6.log.error("nothing selected!");
|
|
788
|
+
return await exit(1);
|
|
789
|
+
}
|
|
790
|
+
if (!branch) {
|
|
791
|
+
p6.log.error("no branch selected");
|
|
792
|
+
return await exit(1);
|
|
793
|
+
}
|
|
794
|
+
if (options["--copy"]) {
|
|
795
|
+
clipboard4.writeSync(branch);
|
|
796
|
+
p6.log.success(`copied ${color6.green(branch)} to clipboard`);
|
|
797
|
+
return await exit(0);
|
|
798
|
+
}
|
|
651
799
|
if (branch === currentBranch) {
|
|
652
|
-
|
|
800
|
+
p6.log.error(`${color6.red("already on branch")}`);
|
|
653
801
|
return await exit(1);
|
|
654
802
|
}
|
|
655
803
|
const result = await checkout(branch);
|
|
656
804
|
if (!result) {
|
|
657
|
-
|
|
805
|
+
p6.log.error(`failed to checkout ${color6.bold(branch)}`);
|
|
658
806
|
return await exit(1);
|
|
659
807
|
}
|
|
660
|
-
|
|
808
|
+
p6.log.success(`checked out ${color6.green(branch)}`);
|
|
661
809
|
await exit(0);
|
|
662
810
|
},
|
|
663
811
|
{ enabled: false }
|
|
664
812
|
)
|
|
665
813
|
};
|
|
666
|
-
var checkout_default =
|
|
814
|
+
var checkout_default = command4;
|
|
667
815
|
|
|
668
816
|
// src/commands/config.ts
|
|
669
|
-
import * as
|
|
670
|
-
import
|
|
817
|
+
import * as p7 from "@clack/prompts";
|
|
818
|
+
import color7 from "picocolors";
|
|
671
819
|
var key = {
|
|
672
820
|
name: "key",
|
|
673
821
|
description: "configure api key",
|
|
674
822
|
usage: "noto config key [options]",
|
|
675
823
|
execute: async (options) => {
|
|
676
824
|
if ((await StorageManager.get()).llm?.apiKey) {
|
|
677
|
-
const confirm2 = await
|
|
825
|
+
const confirm2 = await p7.confirm({
|
|
678
826
|
message: "noto api key already configured, do you want to update it?"
|
|
679
827
|
});
|
|
680
|
-
if (
|
|
681
|
-
|
|
828
|
+
if (p7.isCancel(confirm2) || !confirm2) {
|
|
829
|
+
p7.log.error(color7.red("nothing changed!"));
|
|
682
830
|
return await exit(1);
|
|
683
831
|
}
|
|
684
832
|
}
|
|
685
833
|
let apiKey = options._[0];
|
|
686
834
|
if (!apiKey) {
|
|
687
|
-
const result = await
|
|
835
|
+
const result = await p7.text({
|
|
688
836
|
message: "enter your noto api key"
|
|
689
837
|
});
|
|
690
|
-
if (
|
|
691
|
-
|
|
838
|
+
if (p7.isCancel(result)) {
|
|
839
|
+
p7.log.error(color7.red("nothing changed!"));
|
|
692
840
|
return await exit(1);
|
|
693
841
|
}
|
|
694
842
|
apiKey = result;
|
|
695
843
|
}
|
|
696
|
-
await StorageManager.update((
|
|
697
|
-
...
|
|
844
|
+
await StorageManager.update((current2) => ({
|
|
845
|
+
...current2,
|
|
698
846
|
llm: {
|
|
699
|
-
...
|
|
847
|
+
...current2.llm,
|
|
700
848
|
apiKey
|
|
701
849
|
}
|
|
702
850
|
}));
|
|
703
|
-
|
|
851
|
+
p7.log.success(color7.green("noto api key configured!"));
|
|
704
852
|
console.log();
|
|
705
853
|
}
|
|
706
854
|
};
|
|
@@ -709,7 +857,7 @@ var model = {
|
|
|
709
857
|
description: "configure model",
|
|
710
858
|
usage: "noto config model [options]",
|
|
711
859
|
execute: async () => {
|
|
712
|
-
const model2 = await
|
|
860
|
+
const model2 = await p7.select({
|
|
713
861
|
message: "select a model",
|
|
714
862
|
initialValue: (await StorageManager.get()).llm?.model,
|
|
715
863
|
options: Object.keys(models).map((model3) => ({
|
|
@@ -717,27 +865,27 @@ var model = {
|
|
|
717
865
|
value: model3
|
|
718
866
|
}))
|
|
719
867
|
});
|
|
720
|
-
if (
|
|
721
|
-
|
|
868
|
+
if (p7.isCancel(model2)) {
|
|
869
|
+
p7.log.error(color7.red("nothing changed!"));
|
|
722
870
|
return await exit(1);
|
|
723
871
|
}
|
|
724
872
|
if (model2 === "gemini-2.5-pro-exp-03-25") {
|
|
725
|
-
const confirm2 = await
|
|
873
|
+
const confirm2 = await p7.confirm({
|
|
726
874
|
message: "this model has a rate limit of 5 RPM (requests per minute) 50 requests per day, do you want to continue?"
|
|
727
875
|
});
|
|
728
|
-
if (
|
|
729
|
-
|
|
876
|
+
if (p7.isCancel(confirm2) || !confirm2) {
|
|
877
|
+
p7.log.error(color7.red("nothing changed!"));
|
|
730
878
|
return await exit(1);
|
|
731
879
|
}
|
|
732
880
|
}
|
|
733
|
-
await StorageManager.update((
|
|
734
|
-
...
|
|
881
|
+
await StorageManager.update((current2) => ({
|
|
882
|
+
...current2,
|
|
735
883
|
llm: {
|
|
736
|
-
...
|
|
884
|
+
...current2.llm,
|
|
737
885
|
model: model2
|
|
738
886
|
}
|
|
739
887
|
}));
|
|
740
|
-
|
|
888
|
+
p7.log.success(color7.green("model configured!"));
|
|
741
889
|
console.log();
|
|
742
890
|
}
|
|
743
891
|
};
|
|
@@ -746,37 +894,37 @@ var reset = {
|
|
|
746
894
|
description: "reset configuration",
|
|
747
895
|
usage: "noto config reset",
|
|
748
896
|
execute: async () => {
|
|
749
|
-
const confirm2 = await
|
|
897
|
+
const confirm2 = await p7.confirm({
|
|
750
898
|
message: "are you sure you want to reset the configuration?"
|
|
751
899
|
});
|
|
752
|
-
if (
|
|
753
|
-
|
|
900
|
+
if (p7.isCancel(confirm2) || !confirm2) {
|
|
901
|
+
p7.log.error(color7.red("nothing changed!"));
|
|
754
902
|
return await exit(1);
|
|
755
903
|
}
|
|
756
904
|
await StorageManager.clear();
|
|
757
|
-
|
|
905
|
+
p7.log.success(color7.green("configuration reset!"));
|
|
758
906
|
console.log();
|
|
759
907
|
}
|
|
760
908
|
};
|
|
761
909
|
var subCommands = [key, model, reset];
|
|
762
|
-
var
|
|
910
|
+
var command5 = {
|
|
763
911
|
name: "config",
|
|
764
912
|
description: "configure noto",
|
|
765
913
|
usage: "noto config [subcommand]",
|
|
766
914
|
execute: async (options) => {
|
|
767
|
-
const
|
|
915
|
+
const command6 = await p7.select({
|
|
768
916
|
message: "Select a subcommand",
|
|
769
917
|
options: subCommands.map((cmd2) => ({
|
|
770
918
|
label: cmd2.description,
|
|
771
919
|
value: cmd2.name
|
|
772
920
|
}))
|
|
773
921
|
});
|
|
774
|
-
if (
|
|
922
|
+
if (p7.isCancel(command6)) {
|
|
775
923
|
return await exit(1);
|
|
776
924
|
}
|
|
777
|
-
const cmd = getCommand(
|
|
925
|
+
const cmd = getCommand(command6, subCommands);
|
|
778
926
|
if (!cmd) {
|
|
779
|
-
|
|
927
|
+
p7.log.error(color7.red("unknown config command"));
|
|
780
928
|
return await exit(1);
|
|
781
929
|
}
|
|
782
930
|
options._ = options._.slice(1);
|
|
@@ -784,34 +932,34 @@ var command4 = {
|
|
|
784
932
|
},
|
|
785
933
|
subCommands
|
|
786
934
|
};
|
|
787
|
-
var config_default =
|
|
935
|
+
var config_default = command5;
|
|
788
936
|
|
|
789
937
|
// src/commands/help.ts
|
|
790
|
-
import
|
|
938
|
+
import color8 from "picocolors";
|
|
791
939
|
var help = {
|
|
792
940
|
name: "help",
|
|
793
941
|
description: "show help",
|
|
794
942
|
usage: "noto help [command]",
|
|
795
943
|
execute: async (options) => {
|
|
796
|
-
const
|
|
797
|
-
if (
|
|
944
|
+
const command6 = getCommand(options._[0]);
|
|
945
|
+
if (command6 && command6.name !== "help") {
|
|
798
946
|
console.log();
|
|
799
|
-
console.log(
|
|
800
|
-
console.log(` ${
|
|
947
|
+
console.log(color8.bold("Usage"));
|
|
948
|
+
console.log(` ${command6.usage}`);
|
|
801
949
|
console.log();
|
|
802
|
-
console.log(
|
|
803
|
-
console.log(` ${
|
|
950
|
+
console.log(color8.bold("Description"));
|
|
951
|
+
console.log(` ${command6.description}`);
|
|
804
952
|
console.log();
|
|
805
953
|
} else {
|
|
806
954
|
const commands2 = listCommand();
|
|
807
955
|
console.log();
|
|
808
|
-
console.log(
|
|
956
|
+
console.log(color8.bold("Usage"));
|
|
809
957
|
console.log(` noto [command] [options]`);
|
|
810
958
|
console.log();
|
|
811
|
-
console.log(
|
|
812
|
-
commands2.forEach((
|
|
959
|
+
console.log(color8.bold("Commands"));
|
|
960
|
+
commands2.forEach((command7) => {
|
|
813
961
|
console.log(
|
|
814
|
-
` ${
|
|
962
|
+
` ${color8.bold(command7.name)} ${color8.dim(command7.description)}`
|
|
815
963
|
);
|
|
816
964
|
});
|
|
817
965
|
console.log();
|
|
@@ -821,7 +969,7 @@ var help = {
|
|
|
821
969
|
var help_default = help;
|
|
822
970
|
|
|
823
971
|
// src/commands/index.ts
|
|
824
|
-
var commands = [noto_default, prev_default, checkout_default, config_default, help_default];
|
|
972
|
+
var commands = [noto_default, prev_default, branch_default, checkout_default, config_default, help_default];
|
|
825
973
|
var getCommand = (name, cmds = commands) => {
|
|
826
974
|
return cmds.find((cmd) => cmd.name === name);
|
|
827
975
|
};
|
|
@@ -830,7 +978,7 @@ var listCommand = () => {
|
|
|
830
978
|
};
|
|
831
979
|
|
|
832
980
|
// package.json
|
|
833
|
-
var version = "1.1.
|
|
981
|
+
var version = "1.1.3";
|
|
834
982
|
|
|
835
983
|
// src/index.ts
|
|
836
984
|
var globalSpec = {
|
|
@@ -841,15 +989,15 @@ var globalSpec = {
|
|
|
841
989
|
};
|
|
842
990
|
function main() {
|
|
843
991
|
const args = process.argv.slice(2);
|
|
844
|
-
const { command:
|
|
992
|
+
const { command: command6, options: globalOptions } = parse(globalSpec, args);
|
|
845
993
|
console.log();
|
|
846
|
-
|
|
847
|
-
if (globalOptions["--version"]) return
|
|
994
|
+
p8.intro(`${color9.bgCyan(color9.black(" @snelusha/noto "))}`);
|
|
995
|
+
if (globalOptions["--version"]) return p8.outro(version);
|
|
848
996
|
if (globalOptions["--help"]) {
|
|
849
997
|
getCommand("help")?.execute(globalOptions);
|
|
850
998
|
return;
|
|
851
999
|
}
|
|
852
|
-
const cmd = getCommand(
|
|
1000
|
+
const cmd = getCommand(command6) ?? getCommand("noto");
|
|
853
1001
|
if (!cmd) return getCommand("noto")?.execute(globalOptions);
|
|
854
1002
|
let commandArgs = args;
|
|
855
1003
|
let selectedCommand = cmd;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snelusha/noto",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Generate clean commit messages in a snap! ✨",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -42,15 +42,15 @@
|
|
|
42
42
|
"cli"
|
|
43
43
|
],
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@types/node": "^22.14.
|
|
45
|
+
"@types/node": "^22.14.1",
|
|
46
46
|
"tsup": "^8.4.0",
|
|
47
47
|
"typescript": "^5.8.3",
|
|
48
48
|
"vitest": "^3.1.1"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@ai-sdk/google": "^1.2.
|
|
52
|
-
"@clack/prompts": "^0.10.
|
|
53
|
-
"ai": "^4.3.
|
|
51
|
+
"@ai-sdk/google": "^1.2.10",
|
|
52
|
+
"@clack/prompts": "^0.10.1",
|
|
53
|
+
"ai": "^4.3.5",
|
|
54
54
|
"arg": "^5.0.2",
|
|
55
55
|
"clipboardy": "^4.0.0",
|
|
56
56
|
"dedent": "^1.5.3",
|