@freesyntax/notch-cli 0.5.21 → 0.5.22
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/{apply-patch-D5PDUXUC.js → apply-patch-U6K67CMT.js} +1 -0
- package/dist/auth-UAMMP5IJ.js +29 -0
- package/dist/{chunk-OSWUX6TC.js → chunk-4HPRBCSY.js} +1 -1
- package/dist/{chunk-QKM27RHS.js → chunk-6NKRMZTX.js} +1 -1
- package/dist/{chunk-TU465P2P.js → chunk-EPSOOCNB.js} +4 -2
- package/dist/{chunk-MMBFNIKE.js → chunk-FZVPGJJW.js} +5 -3
- package/dist/chunk-J66N6AFH.js +137 -0
- package/dist/{chunk-443G6HCC.js → chunk-JXQ4HZ47.js} +56 -55
- package/dist/chunk-KCAR5DOB.js +52 -0
- package/dist/chunk-KFQGP6VL.js +33 -0
- package/dist/chunk-O6AKZ4OH.js +0 -0
- package/dist/{chunk-FIFC4V2R.js → chunk-PPEBWOMJ.js} +91 -7
- package/dist/{compression-SQAIQ2UU.js → compression-YJLWEHCC.js} +1 -0
- package/dist/config-set-3IWEVZQ4.js +110 -0
- package/dist/{edit-JEFEK43H.js → edit-6QYAXVNU.js} +1 -0
- package/dist/{git-5T5TSQTX.js → git-DNQ5EELH.js} +1 -0
- package/dist/{github-DWRGWX6U.js → github-34T4QQIH.js} +1 -0
- package/dist/{glob-BI3P4C7Q.js → glob-XT43LEJ4.js} +1 -0
- package/dist/{grep-VZ3I5GNW.js → grep-T2CXYNRI.js} +1 -0
- package/dist/index.js +420 -298
- package/dist/{lsp-UPY6I3L7.js → lsp-JXQVU7NP.js} +1 -0
- package/dist/model-download-3NDKS3VM.js +176 -0
- package/dist/{notebook-FXJBTSPA.js → notebook-MFODW345.js} +1 -0
- package/dist/{ollama-bench-QQHBIG2D.js → ollama-bench-5V5CCOCQ.js} +6 -2
- package/dist/{ollama-launch-2ASVER3S.js → ollama-launch-P5KBK7AJ.js} +6 -2
- package/dist/{ollama-usage-2WPCZJJI.js → ollama-usage-3PROM2WC.js} +1 -0
- package/dist/{plugins-OG2P75K5.js → plugins-PNGRZLFW.js} +1 -0
- package/dist/{read-OVJG2XKW.js → read-B64XE7N3.js} +1 -0
- package/dist/{server-7UQKCB2Z.js → server-IGOZHW52.js} +17 -15
- package/dist/{session-index-SSGOOZXK.js → session-index-7FWEVP6E.js} +3 -2
- package/dist/{shell-4X545EVN.js → shell-BOZTHQUT.js} +1 -0
- package/dist/{task-OS3E5F3X.js → task-67G4KLYC.js} +1 -0
- package/dist/{tools-7WAWS6V4.js → tools-XWKCW4RN.js} +4 -3
- package/dist/{web-fetch-KNIV3Z3W.js → web-fetch-OTNDICGJ.js} +1 -0
- package/dist/{write-NNHLOTYK.js → write-ZOSB7I4J.js} +1 -0
- package/package.json +1 -1
- package/dist/auth-JQX6MHJG.js +0 -16
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import {
|
|
2
|
+
persistConfigPatch
|
|
3
|
+
} from "./chunk-J66N6AFH.js";
|
|
4
|
+
import "./chunk-KCAR5DOB.js";
|
|
5
|
+
import "./chunk-JXQ4HZ47.js";
|
|
6
|
+
import "./chunk-PPEBWOMJ.js";
|
|
7
|
+
import "./chunk-KFQGP6VL.js";
|
|
8
|
+
|
|
9
|
+
// src/commands/config-set.ts
|
|
10
|
+
import fs from "fs/promises";
|
|
11
|
+
import path from "path";
|
|
12
|
+
var HELP = `notch config \u2014 manage .notch.json settings
|
|
13
|
+
|
|
14
|
+
Usage:
|
|
15
|
+
notch config get [key]
|
|
16
|
+
notch config set <key> <value>
|
|
17
|
+
notch config unset <key>
|
|
18
|
+
notch config yolo [on|off] # auto-allow every tool call (sticks)
|
|
19
|
+
|
|
20
|
+
Examples:
|
|
21
|
+
notch config set permissionMode trust
|
|
22
|
+
notch config set autoConfirm true
|
|
23
|
+
notch config set model pyre
|
|
24
|
+
notch config yolo on
|
|
25
|
+
notch config yolo off
|
|
26
|
+
`;
|
|
27
|
+
function parseValue(raw) {
|
|
28
|
+
try {
|
|
29
|
+
return JSON.parse(raw);
|
|
30
|
+
} catch {
|
|
31
|
+
return raw;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async function readCurrent(projectRoot) {
|
|
35
|
+
const p = path.resolve(projectRoot, ".notch.json");
|
|
36
|
+
try {
|
|
37
|
+
const raw = await fs.readFile(p, "utf-8");
|
|
38
|
+
const parsed = JSON.parse(raw);
|
|
39
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
40
|
+
return parsed;
|
|
41
|
+
}
|
|
42
|
+
} catch {
|
|
43
|
+
}
|
|
44
|
+
return {};
|
|
45
|
+
}
|
|
46
|
+
async function runConfigCli(argv, projectRoot) {
|
|
47
|
+
const sub = argv[0];
|
|
48
|
+
if (!sub || sub === "-h" || sub === "--help" || sub === "help") {
|
|
49
|
+
process.stdout.write(HELP);
|
|
50
|
+
return 0;
|
|
51
|
+
}
|
|
52
|
+
if (sub === "get") {
|
|
53
|
+
const key = argv[1];
|
|
54
|
+
const cur = await readCurrent(projectRoot);
|
|
55
|
+
if (!key) {
|
|
56
|
+
process.stdout.write(JSON.stringify(cur, null, 2) + "\n");
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
59
|
+
if (key in cur) {
|
|
60
|
+
process.stdout.write(JSON.stringify(cur[key]) + "\n");
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
63
|
+
process.stderr.write(`notch: no such key: ${key}
|
|
64
|
+
`);
|
|
65
|
+
return 1;
|
|
66
|
+
}
|
|
67
|
+
if (sub === "set") {
|
|
68
|
+
const key = argv[1];
|
|
69
|
+
const value = argv.slice(2).join(" ");
|
|
70
|
+
if (!key || value.length === 0) {
|
|
71
|
+
process.stderr.write("usage: notch config set <key> <value>\n");
|
|
72
|
+
return 2;
|
|
73
|
+
}
|
|
74
|
+
const parsed = parseValue(value);
|
|
75
|
+
const merged = await persistConfigPatch(projectRoot, { [key]: parsed });
|
|
76
|
+
process.stdout.write(`${key} = ${JSON.stringify(merged[key])}
|
|
77
|
+
`);
|
|
78
|
+
return 0;
|
|
79
|
+
}
|
|
80
|
+
if (sub === "unset") {
|
|
81
|
+
const key = argv[1];
|
|
82
|
+
if (!key) {
|
|
83
|
+
process.stderr.write("usage: notch config unset <key>\n");
|
|
84
|
+
return 2;
|
|
85
|
+
}
|
|
86
|
+
await persistConfigPatch(projectRoot, { [key]: void 0 });
|
|
87
|
+
process.stdout.write(`removed ${key}
|
|
88
|
+
`);
|
|
89
|
+
return 0;
|
|
90
|
+
}
|
|
91
|
+
if (sub === "yolo") {
|
|
92
|
+
const arg = (argv[1] ?? "").toLowerCase();
|
|
93
|
+
const cur = await readCurrent(projectRoot);
|
|
94
|
+
const currentlyOn = cur.permissionMode === "trust";
|
|
95
|
+
const turnOn = arg === "" ? !currentlyOn : arg === "on" || arg === "true" || arg === "1" || arg === "yes";
|
|
96
|
+
await persistConfigPatch(projectRoot, {
|
|
97
|
+
permissionMode: turnOn ? "trust" : "auto",
|
|
98
|
+
autoConfirm: turnOn ? true : void 0
|
|
99
|
+
});
|
|
100
|
+
process.stdout.write(turnOn ? "YOLO mode ON \u2014 every tool call auto-allowed. Saved to .notch.json.\n" : "YOLO mode OFF \u2014 prompts restored. Saved to .notch.json.\n");
|
|
101
|
+
return 0;
|
|
102
|
+
}
|
|
103
|
+
process.stderr.write(`notch: unknown config subcommand: ${sub}
|
|
104
|
+
`);
|
|
105
|
+
process.stderr.write(HELP);
|
|
106
|
+
return 2;
|
|
107
|
+
}
|
|
108
|
+
export {
|
|
109
|
+
runConfigCli
|
|
110
|
+
};
|