@wirecat/cli-template 0.14.0 → 0.16.0
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/.github/workflows/ci.yml +17 -0
- package/AGENTS.md +56 -2
- package/CHANGELOG.md +46 -0
- package/README.md +12 -4
- package/biome.json +2 -2
- package/contracts/mcp-tools.json +2 -2
- package/dist/bin/clidev.js +2 -2
- package/dist/bundle/{chunk-LU4A2T7Y.js → all-profiles-FS7AEOE7.js} +8 -5
- package/dist/bundle/{anthropic-ICTW7CNQ.js → anthropic-5RN7BGDI.js} +3 -3
- package/dist/bundle/{app-server-B6BCKXR7.js → app-server-WGTKZQKJ.js} +28 -29
- package/dist/bundle/{bun-sqlite-JE6FJFQT.js → bun-sqlite-WK2IGBGD.js} +2 -2
- package/dist/bundle/{chunk-AS2PJNQ2.js → chunk-2MWNE4L3.js} +1 -1
- package/dist/bundle/{chunk-2DAXUNTS.js → chunk-5HHIPDNW.js} +1 -1
- package/dist/bundle/{chunk-YOJLIVGO.js → chunk-5KAYQKBK.js} +1 -1
- package/dist/bundle/{chunk-62JRF2JA.js → chunk-6WOJIAYA.js} +1 -1
- package/dist/bundle/chunk-7EUX7AZV.js +141 -0
- package/dist/bundle/{chunk-7F5VMLVK.js → chunk-ADFSSIV4.js} +1 -1
- package/dist/bundle/{chunk-U6QD3J3F.js → chunk-ATHZEV2Z.js} +2 -2
- package/dist/bundle/{chunk-UT5TQ6MD.js → chunk-BPMKAZSS.js} +8 -8
- package/dist/bundle/{chunk-DZLHY4IA.js → chunk-C3GNOEJP.js} +1 -1
- package/dist/bundle/{chunk-PIJUGF5F.js → chunk-CTBHQRX6.js} +1 -1
- package/dist/bundle/{chunk-LFLSV353.js → chunk-DEHBTFIC.js} +1 -1
- package/dist/bundle/{chunk-NVNUUHT5.js → chunk-EA3TMI4A.js} +8 -8
- package/dist/bundle/{chunk-BEBD27QT.js → chunk-EILS4BTQ.js} +16 -18
- package/dist/bundle/{chunk-BVLPNNEL.js → chunk-ENDBOYQR.js} +14 -14
- package/dist/bundle/{chunk-6AW4DDK4.js → chunk-ETJXPB6A.js} +1 -1
- package/dist/bundle/{chunk-LATYBJ4T.js → chunk-FMO6F5Q2.js} +1 -1
- package/dist/bundle/{chunk-RJ7AS7UB.js → chunk-HTYLT6ME.js} +24 -7
- package/dist/bundle/{chunk-F34HGYWF.js → chunk-JFXWLQ2L.js} +1 -1
- package/dist/bundle/{chunk-IZKXJJ7V.js → chunk-JJZCPBH3.js} +29 -6
- package/dist/bundle/{chunk-G7W53MQP.js → chunk-LRHX62ZF.js} +2 -2
- package/dist/bundle/{chunk-SOYOOU2D.js → chunk-MBBOINK4.js} +2 -2
- package/dist/bundle/{chunk-BM5ZCDPQ.js → chunk-MEXT6XDP.js} +2 -2
- package/dist/bundle/{chunk-R2JKPHH5.js → chunk-NVPWZF67.js} +1 -1
- package/dist/bundle/{chunk-45244QQ6.js → chunk-OF56L2JU.js} +2 -2
- package/dist/bundle/{chunk-4PA6DJ7F.js → chunk-OGTRPW2K.js} +3 -3
- package/dist/bundle/{chunk-VXOR76ZL.js → chunk-ORV4EGNC.js} +1 -1
- package/dist/bundle/{chunk-TJJ2XSJP.js → chunk-QGOOPPEW.js} +2 -2
- package/dist/bundle/{chunk-NH6LZ3H3.js → chunk-RFJKNFVF.js} +3 -3
- package/dist/bundle/{chunk-R5RYPD23.js → chunk-RYOAQCVJ.js} +1 -1
- package/dist/bundle/{chunk-66VMJGV6.js → chunk-SKBRW5U3.js} +1 -1
- package/dist/bundle/{chunk-BWBZCYUN.js → chunk-TXHCL75B.js} +43 -6
- package/dist/bundle/{chunk-QXOSPYM3.js → chunk-VPCXYY46.js} +1 -1
- package/dist/bundle/{chunk-IOJ2DTCY.js → chunk-WDWP5N6M.js} +2 -0
- package/dist/bundle/{chunk-HYTHTSJP.js → chunk-WM5AMTRY.js} +4 -4
- package/dist/bundle/{chunk-ASHVHS52.js → chunk-YNROUY3R.js} +10 -10
- package/dist/bundle/{chunk-DQIBGCF3.js → chunk-Z5NL6YNU.js} +2 -2
- package/dist/bundle/{chunk-5SAF3XOL.js → chunk-ZSY4WAGI.js} +28 -21
- package/dist/bundle/clidev.js +3 -3
- package/dist/bundle/{command-contract-JMVMT5HT.js → command-contract-ZDU73EPH.js} +9 -9
- package/dist/bundle/{decode-NXB5UKMO.js → decode-QMLOGZ6R.js} +2 -2
- package/dist/bundle/{embed-IKZ24BMC.js → embed-PIR2LJR2.js} +4 -4
- package/dist/bundle/{embedder-GMQ24DOQ.js → embedder-6KBRPAEQ.js} +4 -4
- package/dist/bundle/{first-run-MDD4SIUK.js → first-run-JO3CMY3Z.js} +7 -7
- package/dist/bundle/{first-screen-376CXGXJ.js → first-screen-3T5IXTFL.js} +10 -10
- package/dist/bundle/{node-sqlite-73Z4SFOA.js → node-sqlite-LIK6OYNF.js} +2 -2
- package/dist/bundle/{oauth-EVTPAMZP.js → oauth-7FVF7HQQ.js} +4 -4
- package/dist/bundle/{open-46WZAPJ3.js → open-CRZDEATN.js} +2 -2
- package/dist/bundle/{openai-GWRDAHDU.js → openai-WAJ6WREQ.js} +11 -32
- package/dist/bundle/{program-B3CY3FP7.js → program-ZFFFPBRS.js} +2263 -300
- package/dist/bundle/{prompt-IVEYRLS5.js → prompt-QQIVHO3M.js} +3 -3
- package/dist/bundle/{recognize-WVEKHODM.js → recognize-4KLBZDEC.js} +2 -2
- package/dist/bundle/{remote-4K5VPMC7.js → remote-BABMZTHA.js} +5 -5
- package/dist/bundle/{rerank-V24UJZYJ.js → rerank-P3IQQJIL.js} +4 -4
- package/dist/bundle/{chunk-EMHCXXNJ.js → serve-25SSAKRZ.js} +6 -4
- package/dist/bundle/server-G4GCDMYI.js +52 -0
- package/dist/bundle/{chunk-PX2KP4QE.js → server-P4XUYY5A.js} +27 -7
- package/dist/bundle/{state-ZPYGECVP.js → state-QCQALQBJ.js} +3 -3
- package/dist/bundle/{store-6JQCLPQF.js → store-ZECPRGGH.js} +7 -7
- package/dist/bundle/store-maintenance-command-ECUO5G6L.js +42 -0
- package/dist/commands/comments.d.ts +3 -0
- package/dist/commands/comments.d.ts.map +1 -0
- package/dist/commands/comments.js +114 -0
- package/dist/commands/comments.js.map +1 -0
- package/dist/commands/session.d.ts +3 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +96 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +4 -2
- package/dist/config.js.map +1 -1
- package/dist/context.d.ts +83 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +58 -0
- package/dist/context.js.map +1 -0
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +26 -5
- package/dist/program.js.map +1 -1
- package/dist/sample/comments.d.ts +61 -0
- package/dist/sample/comments.d.ts.map +1 -0
- package/dist/sample/comments.js +39 -0
- package/dist/sample/comments.js.map +1 -0
- package/dist/sample/transport.d.ts +42 -0
- package/dist/sample/transport.d.ts.map +1 -0
- package/dist/sample/transport.js +152 -0
- package/dist/sample/transport.js.map +1 -0
- package/dist/token.d.ts +16 -0
- package/dist/token.d.ts.map +1 -0
- package/dist/token.js +32 -0
- package/dist/token.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/commands.md +234 -12
- package/docs/configuration.md +1 -1
- package/docs/dev/reference-clis.md +3 -2
- package/docs/dev/test-matrix.md +36 -5
- package/docs/index.md +4 -3
- package/docs/security.md +4 -2
- package/kit/dist/new.js +6 -3
- package/lint/overrides.json +9 -1
- package/package.json +3 -4
- package/scripts/test-matrix-untested.ts +19 -0
- package/skills/clidev-cli/SKILL.md +1 -1
- package/src/commands/comments.ts +167 -0
- package/src/commands/session.ts +144 -0
- package/src/comments.test.ts +258 -0
- package/src/config.ts +5 -2
- package/src/context.ts +78 -0
- package/src/mcp.test.ts +71 -76
- package/src/program.test.ts +39 -17
- package/src/program.ts +30 -5
- package/src/sample/comments.ts +51 -0
- package/src/sample/transport.test.ts +117 -0
- package/src/sample/transport.ts +184 -0
- package/src/testing/fake-comments.ts +167 -0
- package/src/testing/harness.ts +51 -0
- package/src/token.ts +42 -0
- package/src/version.ts +1 -1
- package/dist/bundle/all-profiles-NVB2HT2S.js +0 -24
- package/dist/bundle/chunk-GUFPQZUA.js +0 -48
- package/dist/bundle/chunk-NL2DQPT7.js +0 -2
- package/dist/bundle/mcp-KHUZOJO6.js +0 -82
- package/dist/bundle/mcp-MZHWJXAE.js +0 -152
- package/dist/bundle/serve-PJWSOV7F.js +0 -19
- package/dist/bundle/server-2ZN7KZHZ.js +0 -40
- package/dist/bundle/server-5VYM7CCF.js +0 -53
- package/dist/bundle/store-maintenance-command-7XICIYHW.js +0 -42
- package/dist/commands/doctor.d.ts +0 -77
- package/dist/commands/doctor.d.ts.map +0 -1
- package/dist/commands/doctor.js +0 -74
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/mcp.d.ts +0 -3
- package/dist/commands/mcp.d.ts.map +0 -1
- package/dist/commands/mcp.js +0 -97
- package/dist/commands/mcp.js.map +0 -1
- package/dist/mcp.d.ts +0 -29
- package/dist/mcp.d.ts.map +0 -1
- package/dist/mcp.js +0 -98
- package/dist/mcp.js.map +0 -1
- package/src/commands/doctor.ts +0 -86
- package/src/commands/mcp.ts +0 -130
- package/src/mcp-http.test.ts +0 -172
- package/src/mcp.ts +0 -140
|
@@ -2,9 +2,9 @@ import { createRequire as __bundleRequire } from "node:module";
|
|
|
2
2
|
const require = __bundleRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
readSecret
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-LRHX62ZF.js";
|
|
6
|
+
import "./chunk-5HHIPDNW.js";
|
|
7
|
+
import "./chunk-WDWP5N6M.js";
|
|
8
8
|
import "./chunk-Y5E2WNWB.js";
|
|
9
9
|
import "./chunk-ZVVMGPBJ.js";
|
|
10
10
|
export {
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
openRecognizer,
|
|
9
9
|
openSpeechCutter,
|
|
10
10
|
toModelRate
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-ADFSSIV4.js";
|
|
12
|
+
import "./chunk-WDWP5N6M.js";
|
|
13
13
|
import "./chunk-Y5E2WNWB.js";
|
|
14
14
|
import "./chunk-ZVVMGPBJ.js";
|
|
15
15
|
export {
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
openRemote,
|
|
9
9
|
remoteKey,
|
|
10
10
|
remoteModel
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-MBBOINK4.js";
|
|
12
|
+
import "./chunk-Z5NL6YNU.js";
|
|
13
|
+
import "./chunk-OF56L2JU.js";
|
|
14
|
+
import "./chunk-6WOJIAYA.js";
|
|
15
|
+
import "./chunk-WDWP5N6M.js";
|
|
16
16
|
import "./chunk-Y5E2WNWB.js";
|
|
17
17
|
import "./chunk-ZVVMGPBJ.js";
|
|
18
18
|
export {
|
|
@@ -4,10 +4,10 @@ import {
|
|
|
4
4
|
defaultThreads,
|
|
5
5
|
loadModel,
|
|
6
6
|
truncated
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-Z5NL6YNU.js";
|
|
8
|
+
import "./chunk-OF56L2JU.js";
|
|
9
|
+
import "./chunk-6WOJIAYA.js";
|
|
10
|
+
import "./chunk-WDWP5N6M.js";
|
|
11
11
|
import "./chunk-Y5E2WNWB.js";
|
|
12
12
|
import {
|
|
13
13
|
__name
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-NENYWEXF.js";
|
|
6
6
|
import {
|
|
7
7
|
ownerLogin
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-SKBRW5U3.js";
|
|
9
9
|
import {
|
|
10
10
|
WebStandardStreamableHTTPServerTransport,
|
|
11
11
|
createMcpHandler,
|
|
@@ -20,10 +20,13 @@ import {
|
|
|
20
20
|
calledTools,
|
|
21
21
|
httpActivityFile,
|
|
22
22
|
httpLock
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-ETJXPB6A.js";
|
|
24
|
+
import "./chunk-C3GNOEJP.js";
|
|
25
|
+
import "./chunk-VOTEB3AN.js";
|
|
24
26
|
import {
|
|
25
27
|
CliError
|
|
26
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-WDWP5N6M.js";
|
|
29
|
+
import "./chunk-Y5E2WNWB.js";
|
|
27
30
|
import {
|
|
28
31
|
__name
|
|
29
32
|
} from "./chunk-ZVVMGPBJ.js";
|
|
@@ -187,7 +190,6 @@ var serveOverHttp = /* @__PURE__ */ __name(async (build, options) => {
|
|
|
187
190
|
}, "close")
|
|
188
191
|
};
|
|
189
192
|
}, "serveOverHttp");
|
|
190
|
-
|
|
191
193
|
export {
|
|
192
194
|
MCP_PATH,
|
|
193
195
|
serveOverHttp
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
PER_RUN,
|
|
5
|
+
createServer,
|
|
6
|
+
envelope,
|
|
7
|
+
serveOverHttpUntilStopped,
|
|
8
|
+
serveOverStdio
|
|
9
|
+
} from "./chunk-EILS4BTQ.js";
|
|
10
|
+
import "./chunk-TXHCL75B.js";
|
|
11
|
+
import "./chunk-VS5LGSTM.js";
|
|
12
|
+
import "./chunk-BPMKAZSS.js";
|
|
13
|
+
import "./chunk-WM5AMTRY.js";
|
|
14
|
+
import "./chunk-JFXWLQ2L.js";
|
|
15
|
+
import "./chunk-JJZCPBH3.js";
|
|
16
|
+
import "./chunk-ZSY4WAGI.js";
|
|
17
|
+
import "./chunk-CTBHQRX6.js";
|
|
18
|
+
import "./chunk-5HHIPDNW.js";
|
|
19
|
+
import "./chunk-2MWNE4L3.js";
|
|
20
|
+
import "./chunk-7Z4HR6GO.js";
|
|
21
|
+
import "./chunk-G45R7M42.js";
|
|
22
|
+
import "./chunk-5D4AEUVA.js";
|
|
23
|
+
import "./chunk-ETJXPB6A.js";
|
|
24
|
+
import "./chunk-C3GNOEJP.js";
|
|
25
|
+
import "./chunk-MBBOINK4.js";
|
|
26
|
+
import "./chunk-FMO6F5Q2.js";
|
|
27
|
+
import "./chunk-MEXT6XDP.js";
|
|
28
|
+
import "./chunk-HTYLT6ME.js";
|
|
29
|
+
import "./chunk-ORV4EGNC.js";
|
|
30
|
+
import "./chunk-ATHZEV2Z.js";
|
|
31
|
+
import "./chunk-VOTEB3AN.js";
|
|
32
|
+
import "./chunk-EA3TMI4A.js";
|
|
33
|
+
import "./chunk-NVPWZF67.js";
|
|
34
|
+
import "./chunk-5KAYQKBK.js";
|
|
35
|
+
import "./chunk-3WDYHOAF.js";
|
|
36
|
+
import "./chunk-QGOOPPEW.js";
|
|
37
|
+
import "./chunk-RFJKNFVF.js";
|
|
38
|
+
import "./chunk-3MDNAYQA.js";
|
|
39
|
+
import "./chunk-CGFQT3LQ.js";
|
|
40
|
+
import "./chunk-Z5NL6YNU.js";
|
|
41
|
+
import "./chunk-OF56L2JU.js";
|
|
42
|
+
import "./chunk-6WOJIAYA.js";
|
|
43
|
+
import "./chunk-WDWP5N6M.js";
|
|
44
|
+
import "./chunk-Y5E2WNWB.js";
|
|
45
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
46
|
+
export {
|
|
47
|
+
PER_RUN,
|
|
48
|
+
createServer,
|
|
49
|
+
envelope,
|
|
50
|
+
serveOverHttpUntilStopped,
|
|
51
|
+
serveOverStdio
|
|
52
|
+
};
|
|
@@ -9,21 +9,27 @@ import {
|
|
|
9
9
|
registerCommands,
|
|
10
10
|
runCommandForAgent,
|
|
11
11
|
toolsFromCommands
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-BPMKAZSS.js";
|
|
13
13
|
import {
|
|
14
14
|
agentJson,
|
|
15
15
|
skillResource
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-WM5AMTRY.js";
|
|
17
17
|
import {
|
|
18
18
|
callerOf,
|
|
19
19
|
serveStdio
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-JFXWLQ2L.js";
|
|
21
21
|
import {
|
|
22
22
|
wholeList
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-ZSY4WAGI.js";
|
|
24
|
+
import "./chunk-CTBHQRX6.js";
|
|
25
|
+
import "./chunk-5HHIPDNW.js";
|
|
26
|
+
import "./chunk-2MWNE4L3.js";
|
|
27
|
+
import "./chunk-7Z4HR6GO.js";
|
|
24
28
|
import {
|
|
25
29
|
McpServer
|
|
26
30
|
} from "./chunk-5D4AEUVA.js";
|
|
31
|
+
import "./chunk-MBBOINK4.js";
|
|
32
|
+
import "./chunk-FMO6F5Q2.js";
|
|
27
33
|
import {
|
|
28
34
|
MESSENGER_CHANGE_REFUSAL,
|
|
29
35
|
changesMessenger,
|
|
@@ -31,11 +37,26 @@ import {
|
|
|
31
37
|
itemOf,
|
|
32
38
|
readOnlyLockOf,
|
|
33
39
|
readOnlyRefusal
|
|
34
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-HTYLT6ME.js";
|
|
41
|
+
import "./chunk-ORV4EGNC.js";
|
|
42
|
+
import "./chunk-ATHZEV2Z.js";
|
|
43
|
+
import "./chunk-VOTEB3AN.js";
|
|
44
|
+
import "./chunk-EA3TMI4A.js";
|
|
45
|
+
import "./chunk-NVPWZF67.js";
|
|
46
|
+
import "./chunk-5KAYQKBK.js";
|
|
47
|
+
import "./chunk-3WDYHOAF.js";
|
|
48
|
+
import "./chunk-QGOOPPEW.js";
|
|
49
|
+
import "./chunk-RFJKNFVF.js";
|
|
50
|
+
import "./chunk-3MDNAYQA.js";
|
|
51
|
+
import "./chunk-CGFQT3LQ.js";
|
|
52
|
+
import "./chunk-Z5NL6YNU.js";
|
|
53
|
+
import "./chunk-OF56L2JU.js";
|
|
54
|
+
import "./chunk-6WOJIAYA.js";
|
|
35
55
|
import {
|
|
36
56
|
mcpErrorResult,
|
|
37
57
|
object
|
|
38
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-WDWP5N6M.js";
|
|
59
|
+
import "./chunk-Y5E2WNWB.js";
|
|
39
60
|
import {
|
|
40
61
|
__name
|
|
41
62
|
} from "./chunk-ZVVMGPBJ.js";
|
|
@@ -151,7 +172,6 @@ var serveBotOverStdio = /* @__PURE__ */ __name(async (options, note) => {
|
|
|
151
172
|
});
|
|
152
173
|
await handle.close();
|
|
153
174
|
}, "serveBotOverStdio");
|
|
154
|
-
|
|
155
175
|
export {
|
|
156
176
|
createBotServer,
|
|
157
177
|
serveBotOverStdio
|
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
readHttpLock,
|
|
13
13
|
readStored,
|
|
14
14
|
signedInClients
|
|
15
|
-
} from "./chunk-
|
|
16
|
-
import "./chunk-
|
|
15
|
+
} from "./chunk-ETJXPB6A.js";
|
|
16
|
+
import "./chunk-C3GNOEJP.js";
|
|
17
17
|
import "./chunk-VOTEB3AN.js";
|
|
18
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-WDWP5N6M.js";
|
|
19
19
|
import "./chunk-Y5E2WNWB.js";
|
|
20
20
|
import "./chunk-ZVVMGPBJ.js";
|
|
21
21
|
export {
|
|
@@ -55,16 +55,16 @@ import {
|
|
|
55
55
|
threadConversation,
|
|
56
56
|
titlePart,
|
|
57
57
|
vectorIndexCounts
|
|
58
|
-
} from "./chunk-
|
|
59
|
-
import "./chunk-
|
|
60
|
-
import "./chunk-
|
|
58
|
+
} from "./chunk-EA3TMI4A.js";
|
|
59
|
+
import "./chunk-NVPWZF67.js";
|
|
60
|
+
import "./chunk-5KAYQKBK.js";
|
|
61
61
|
import "./chunk-3WDYHOAF.js";
|
|
62
|
-
import "./chunk-
|
|
63
|
-
import "./chunk-
|
|
62
|
+
import "./chunk-QGOOPPEW.js";
|
|
63
|
+
import "./chunk-RFJKNFVF.js";
|
|
64
64
|
import "./chunk-3MDNAYQA.js";
|
|
65
65
|
import "./chunk-CGFQT3LQ.js";
|
|
66
|
-
import "./chunk-
|
|
67
|
-
import "./chunk-
|
|
66
|
+
import "./chunk-6WOJIAYA.js";
|
|
67
|
+
import "./chunk-WDWP5N6M.js";
|
|
68
68
|
import "./chunk-Y5E2WNWB.js";
|
|
69
69
|
import "./chunk-ZVVMGPBJ.js";
|
|
70
70
|
export {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createRequire as __bundleRequire } from "node:module";
|
|
2
|
+
const require = __bundleRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
buildStems,
|
|
5
|
+
storeMaintenanceCommands,
|
|
6
|
+
storeSummary
|
|
7
|
+
} from "./chunk-ENDBOYQR.js";
|
|
8
|
+
import "./chunk-JJZCPBH3.js";
|
|
9
|
+
import "./chunk-ZSY4WAGI.js";
|
|
10
|
+
import "./chunk-CTBHQRX6.js";
|
|
11
|
+
import "./chunk-LRHX62ZF.js";
|
|
12
|
+
import "./chunk-5HHIPDNW.js";
|
|
13
|
+
import "./chunk-HTQTIKWP.js";
|
|
14
|
+
import "./chunk-2MWNE4L3.js";
|
|
15
|
+
import "./chunk-7Z4HR6GO.js";
|
|
16
|
+
import "./chunk-C3GNOEJP.js";
|
|
17
|
+
import "./chunk-MBBOINK4.js";
|
|
18
|
+
import "./chunk-RYOAQCVJ.js";
|
|
19
|
+
import "./chunk-FMO6F5Q2.js";
|
|
20
|
+
import "./chunk-HTYLT6ME.js";
|
|
21
|
+
import "./chunk-ORV4EGNC.js";
|
|
22
|
+
import "./chunk-ATHZEV2Z.js";
|
|
23
|
+
import "./chunk-VOTEB3AN.js";
|
|
24
|
+
import "./chunk-EA3TMI4A.js";
|
|
25
|
+
import "./chunk-NVPWZF67.js";
|
|
26
|
+
import "./chunk-5KAYQKBK.js";
|
|
27
|
+
import "./chunk-3WDYHOAF.js";
|
|
28
|
+
import "./chunk-QGOOPPEW.js";
|
|
29
|
+
import "./chunk-RFJKNFVF.js";
|
|
30
|
+
import "./chunk-3MDNAYQA.js";
|
|
31
|
+
import "./chunk-CGFQT3LQ.js";
|
|
32
|
+
import "./chunk-Z5NL6YNU.js";
|
|
33
|
+
import "./chunk-OF56L2JU.js";
|
|
34
|
+
import "./chunk-6WOJIAYA.js";
|
|
35
|
+
import "./chunk-WDWP5N6M.js";
|
|
36
|
+
import "./chunk-Y5E2WNWB.js";
|
|
37
|
+
import "./chunk-ZVVMGPBJ.js";
|
|
38
|
+
export {
|
|
39
|
+
buildStems,
|
|
40
|
+
storeMaintenanceCommands,
|
|
41
|
+
storeSummary
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comments.d.ts","sourceRoot":"","sources":["../../src/commands/comments.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AA6InC,eAAO,MAAM,eAAe,QAAO,OAMH,CAAA"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { CliError } from "@wirecat/cli-base";
|
|
2
|
+
import { annotate } from "@wirecat/cli-base/commands";
|
|
3
|
+
import { answerEntity, commandPath, itemOf, outputFor, pagedList, pageOf, queryTerms, REMOTE_READ, REMOTE_WRITE, renderAnswer, termField, terminalAsker, withPaging, withQuery, } from "@wirecat/cli-core/cli";
|
|
4
|
+
import { guardedWrite, guardFor, keyedGuard, levelFor, newOperationId } from "@wirecat/cli-core/sends";
|
|
5
|
+
import { Command } from "commander";
|
|
6
|
+
import { permissions } from "../config.js";
|
|
7
|
+
import { contextOf, withService } from "../context.js";
|
|
8
|
+
import { IDENTITY } from "../identity.js";
|
|
9
|
+
import { commentSchema } from "../sample/comments.js";
|
|
10
|
+
import { SERVICE } from "../sample/transport.js";
|
|
11
|
+
// SAMPLE: `comments` is the reference command group. Keep its shape; replace the noun and the calls with your
|
|
12
|
+
// service's. Every command path is its own permission key (`comments.create`), from `commandPermissions()`.
|
|
13
|
+
const CLI = IDENTITY.command;
|
|
14
|
+
/** The list's query: one field the service filters itself (WC-CMD-20). Nothing is filtered in memory. */
|
|
15
|
+
const COMMENTS_QUERY = {
|
|
16
|
+
entity: "comment",
|
|
17
|
+
backend: "native",
|
|
18
|
+
fields: [termField("author", "kw", "author:u2")],
|
|
19
|
+
};
|
|
20
|
+
/** --all walks pages until the service has no more, at most this many, so a huge account cannot hold the run open. */
|
|
21
|
+
const ALL_PAGES = 20;
|
|
22
|
+
const ALL_PAGE_SIZE = 100;
|
|
23
|
+
const listAll = async (service, author) => {
|
|
24
|
+
const items = [];
|
|
25
|
+
for (let page = 0; page < ALL_PAGES; page++) {
|
|
26
|
+
const found = await service.list({ limit: ALL_PAGE_SIZE, offset: page * ALL_PAGE_SIZE, author });
|
|
27
|
+
for (const item of found.items)
|
|
28
|
+
items.push(item);
|
|
29
|
+
if (!found.has_more)
|
|
30
|
+
return { items, has_more: false };
|
|
31
|
+
}
|
|
32
|
+
return { items, has_more: true };
|
|
33
|
+
};
|
|
34
|
+
const listCommand = () => withPaging(withQuery(answerEntity(annotate(new Command("list"), {
|
|
35
|
+
effects: REMOTE_READ,
|
|
36
|
+
offline: false,
|
|
37
|
+
examples: [`${CLI} personal comments list`, `${CLI} personal comments list author:u2 --json=id,text`],
|
|
38
|
+
}), "comment", commentSchema), COMMENTS_QUERY))
|
|
39
|
+
.description(`list the comments in ${SERVICE}, newest first`)
|
|
40
|
+
.action(async function (words) {
|
|
41
|
+
const path = commandPath(this);
|
|
42
|
+
const author = queryTerms(words, COMMENTS_QUERY, path).get("author");
|
|
43
|
+
const { settings } = contextOf(this);
|
|
44
|
+
const found = await withService(this, (service) => settings.all ? listAll(service, author) : service.list({ ...pageOf(settings), author }));
|
|
45
|
+
renderAnswer(this, outputFor(this), pagedList(path, settings, found));
|
|
46
|
+
});
|
|
47
|
+
const showCommand = () => answerEntity(annotate(new Command("show"), {
|
|
48
|
+
effects: REMOTE_READ,
|
|
49
|
+
offline: false,
|
|
50
|
+
examples: [`${CLI} personal comments show c1`, `${CLI} personal comments show c1 --json`],
|
|
51
|
+
}), "comment", commentSchema)
|
|
52
|
+
.description(`show one comment in ${SERVICE}`)
|
|
53
|
+
.argument("<id>", "the comment's id, as list prints it")
|
|
54
|
+
.action(async function (id) {
|
|
55
|
+
renderAnswer(this, outputFor(this), itemOf(await withService(this, (service) => service.show(id))));
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* Every write's one path (WC-PERM-13). The profile's level for the command's key refuses, or asks once; the send
|
|
59
|
+
* journal records the attempt and its outcome, never its content (WC-PERM-17); the answer carries the `operation_id`
|
|
60
|
+
* (WC-OUT-10). cli-core's `run` has already answered `--dry-run` and refused under `<PREFIX>_READ_ONLY` before this
|
|
61
|
+
* runs. Never retried: a write that got no answer is `outcome_unknown`, with the id to look it up by (WC-LIFE-9).
|
|
62
|
+
*/
|
|
63
|
+
const write = async (command, act) => {
|
|
64
|
+
const { settings, env, renderer } = contextOf(command);
|
|
65
|
+
const key = commandPath(command).replaceAll(" ", ".");
|
|
66
|
+
const operationId = newOperationId();
|
|
67
|
+
const levelOf = (one) => levelFor(settings.permissions, one, permissions.defaults).level;
|
|
68
|
+
const guard = keyedGuard((ask) => guardFor(IDENTITY,
|
|
69
|
+
// SAMPLE: the service limits its own rate, so this guard keeps the levels and the journal, not a send cap.
|
|
70
|
+
{ ...settings, sendsPerHour: Number.MAX_SAFE_INTEGER, permissionDefaults: permissions.defaults }, renderer.warn, env, ask), terminalAsker(command), levelOf, []);
|
|
71
|
+
const request = { chatId: null, kind: "edit", key, operationId };
|
|
72
|
+
guard.refuse(request);
|
|
73
|
+
let comment;
|
|
74
|
+
try {
|
|
75
|
+
comment = await guardedWrite(guard, request, () => withService(command, act));
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
if (error instanceof CliError && error.code === "outcome_unknown")
|
|
79
|
+
throw new CliError("outcome_unknown", error.message, { ...error.details, operation_id: operationId });
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
renderAnswer(command, outputFor(command), itemOf({ operation_id: operationId, comment }));
|
|
83
|
+
};
|
|
84
|
+
const createCommand = () => annotate(new Command("create"), {
|
|
85
|
+
effects: REMOTE_WRITE,
|
|
86
|
+
offline: false,
|
|
87
|
+
examples: [
|
|
88
|
+
`${CLI} personal comments create --text "Looks good to me"`,
|
|
89
|
+
`${CLI} personal comments create --text "Looks good to me" --dry-run`,
|
|
90
|
+
],
|
|
91
|
+
})
|
|
92
|
+
.description(`post a comment in ${SERVICE}`)
|
|
93
|
+
.requiredOption("--text <text>", "the comment's text")
|
|
94
|
+
.action(async function (args) {
|
|
95
|
+
await write(this, (service) => service.create(args.text));
|
|
96
|
+
});
|
|
97
|
+
const updateCommand = () => annotate(new Command("update"), {
|
|
98
|
+
effects: REMOTE_WRITE,
|
|
99
|
+
offline: false,
|
|
100
|
+
examples: [`${CLI} personal comments update c1 --text "Looks good now"`],
|
|
101
|
+
})
|
|
102
|
+
.description(`change the text of your comment in ${SERVICE}`)
|
|
103
|
+
.argument("<id>", "the comment's id, as list prints it")
|
|
104
|
+
.requiredOption("--text <text>", "the new text")
|
|
105
|
+
.action(async function (id, args) {
|
|
106
|
+
await write(this, (service) => service.update(id, args.text));
|
|
107
|
+
});
|
|
108
|
+
export const commentsCommand = () => annotate(new Command("comments"), { effects: REMOTE_READ })
|
|
109
|
+
.description(`read and write comments in ${SERVICE}, the sample service`)
|
|
110
|
+
.addCommand(listCommand())
|
|
111
|
+
.addCommand(showCommand())
|
|
112
|
+
.addCommand(createCommand())
|
|
113
|
+
.addCommand(updateCommand());
|
|
114
|
+
//# sourceMapp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AU,CAAC,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;KACxD,WAAW,CAAC,8BAA8B,OAAO,sBAAsB,CAAC;KACxE,UAAU,CAAC,WAAW,EAAE,CAAC;KACzB,UAAU,CAAC,WAAW,EAAE,CAAC;KACzB,UAAU,CAAC,aAAa,EAAE,CAAC;KAC3B,UAAU,CAAC,aAAa,EAAE,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/commands/session.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAkHnC,eAAO,MAAM,cAAc,QAAO,OAMJ,CAAA"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { CliError } from "@wirecat/cli-base";
|
|
2
|
+
import { annotate } from "@wirecat/cli-base/commands";
|
|
3
|
+
import { readSecret } from "@wirecat/cli-core";
|
|
4
|
+
import { commandWords, environmentOf, FETCH, itemOf, LOCAL_READ, LOCAL_WRITE, listOf, logsInOrOut, outputFor, profileFree, profilesHere, REMOTE_READ, refuseCommandName, refuseUnderReadOnly, rememberAccount, renderAnswer, rootOf, secretInputOf, } from "@wirecat/cli-core/cli";
|
|
5
|
+
import { Command } from "commander";
|
|
6
|
+
import { configuration } from "../config.js";
|
|
7
|
+
import { contextOf, refuseOffline, serviceFor, withService } from "../context.js";
|
|
8
|
+
import { IDENTITY } from "../identity.js";
|
|
9
|
+
import { SERVICE } from "../sample/transport.js";
|
|
10
|
+
import { TOKEN_VARIABLE, tokenStore } from "../token.js";
|
|
11
|
+
// `session start | status | end | list` is every provider CLI's sign-in (WC-ACCT-12). Keep it; replace the token
|
|
12
|
+
// prompt and the `me` check with your service's. A service with OAuth signs in through cli-core's oauth module
|
|
13
|
+
// instead (WC-SECR-22); see gcal-cli's src/commands/session.ts.
|
|
14
|
+
const CLI = IDENTITY.command;
|
|
15
|
+
const answer = (command, item) => renderAnswer(command, outputFor(command), itemOf(item));
|
|
16
|
+
const storageOf = (raw) => {
|
|
17
|
+
if (raw === "keyring" || raw === "file")
|
|
18
|
+
return raw;
|
|
19
|
+
throw new CliError("validation_error", `--credential-storage takes keyring or file; got ${raw}`);
|
|
20
|
+
};
|
|
21
|
+
const startCommand = () => logsInOrOut(annotate(new Command("start"), {
|
|
22
|
+
effects: FETCH,
|
|
23
|
+
lifetime: "interactive",
|
|
24
|
+
mcp: false,
|
|
25
|
+
examples: [`${CLI} personal session start`, `${CLI} personal session start --credential-storage file`],
|
|
26
|
+
}))
|
|
27
|
+
.summary(`sign in to ${SERVICE} with an API token`)
|
|
28
|
+
.description(`sign this profile in: the ${SERVICE} API token is asked hidden or read from stdin, never taken as an ` +
|
|
29
|
+
"argument, checked against the service, and only then kept in the keyring, or in a private file")
|
|
30
|
+
.option("--credential-storage <storage>", "where the token is kept: keyring, which falls back to a private file by itself, or file", storageOf, "keyring")
|
|
31
|
+
.action(async function (args) {
|
|
32
|
+
const { env, flags, profile, tokens, run } = contextOf(this);
|
|
33
|
+
refuseCommandName(profile, commandWords(rootOf(this)), CLI);
|
|
34
|
+
refuseOffline(flags);
|
|
35
|
+
// A secret is never an argument: it would land in shell history and in the run record (WC-SECR-5).
|
|
36
|
+
const token = (await readSecret(`${SERVICE} API token: `, secretInputOf(this))).trim();
|
|
37
|
+
if (!token)
|
|
38
|
+
throw new CliError("validation_error", "no token was given");
|
|
39
|
+
const user = await run((events) => serviceFor(this, token, events).me());
|
|
40
|
+
const storedIn = tokens.write(profile, token, args.credentialStorage);
|
|
41
|
+
rememberAccount(IDENTITY, profile, user.id, env);
|
|
42
|
+
answer(this, { profile, state: "saved", stored_in: storedIn, verified: true, user });
|
|
43
|
+
});
|
|
44
|
+
const statusCommand = () => annotate(new Command("status"), {
|
|
45
|
+
effects: REMOTE_READ,
|
|
46
|
+
examples: [`${CLI} personal session status`, `${CLI} personal session status --check --json`],
|
|
47
|
+
})
|
|
48
|
+
.summary("show where this profile's token comes from; never the token")
|
|
49
|
+
.description(`show where this profile's token comes from: ${TOKEN_VARIABLE}, the keyring or a file, never the token; ` +
|
|
50
|
+
`--check asks ${SERVICE} whose token it is`)
|
|
51
|
+
.option("--check", `ask ${SERVICE} whether the token still works, and whose it is`)
|
|
52
|
+
.action(async function (args) {
|
|
53
|
+
const { profile, tokens } = contextOf(this);
|
|
54
|
+
const saved = tokens.read(profile);
|
|
55
|
+
const status = { profile, state: saved ? "saved" : "missing", token_from: saved?.source ?? null };
|
|
56
|
+
if (!args.check || !saved)
|
|
57
|
+
return answer(this, { ...status, verified: false });
|
|
58
|
+
answer(this, { ...status, verified: true, user: await withService(this, (service) => service.me()) });
|
|
59
|
+
});
|
|
60
|
+
const endCommand = () => logsInOrOut(annotate(new Command("end"), {
|
|
61
|
+
effects: LOCAL_WRITE,
|
|
62
|
+
mcp: false,
|
|
63
|
+
examples: [`${CLI} personal session end`],
|
|
64
|
+
}))
|
|
65
|
+
.summary("forget this profile's token on this computer")
|
|
66
|
+
.description(`forget this profile's token on this computer; the token itself stays valid in ${SERVICE}`)
|
|
67
|
+
.action(function () {
|
|
68
|
+
refuseUnderReadOnly(this, "session end");
|
|
69
|
+
const { profile, tokens } = contextOf(this);
|
|
70
|
+
answer(this, { profile, ended: tokens.remove(profile) });
|
|
71
|
+
});
|
|
72
|
+
const listCommand = () => profileFree(annotate(new Command("list"), {
|
|
73
|
+
effects: LOCAL_READ,
|
|
74
|
+
examples: [`${CLI} session list`, `${CLI} session list --json`],
|
|
75
|
+
}))
|
|
76
|
+
.summary("list the profiles here and whether each is signed in")
|
|
77
|
+
.description("list the profiles on this computer and whether each has a token; picks none")
|
|
78
|
+
.action(function () {
|
|
79
|
+
// Not contextOf: cli-core's baseContext needs a profile, and this command names none.
|
|
80
|
+
const environment = environmentOf(this);
|
|
81
|
+
const env = environment.env ?? process.env;
|
|
82
|
+
const { configuredProfiles } = configuration.resolveSettings({}, { env, needsProfile: false });
|
|
83
|
+
const tokens = tokenStore(env, environment.keyring, outputFor(this).renderer.warn);
|
|
84
|
+
const items = profilesHere(IDENTITY, configuredProfiles, env).map((profile) => {
|
|
85
|
+
const saved = tokens.read(profile);
|
|
86
|
+
return { profile, signed_in: saved !== undefined, token_from: saved?.source ?? null };
|
|
87
|
+
});
|
|
88
|
+
renderAnswer(this, outputFor(this), listOf("session list", { items, limit: Math.max(1, items.length), has_more: false }));
|
|
89
|
+
});
|
|
90
|
+
export const sessionCommand = () => annotate(new Command("session"), { effects: LOCAL_READ })
|
|
91
|
+
.description(`keep this profile's ${SERVICE} token in the OS keyring`)
|
|
92
|
+
.addCommand(startCommand())
|
|
93
|
+
.addCommand(statusCommand())
|
|
94
|
+
.addCommand(endCommand())
|
|
95
|
+
.addCommand(listCommand());
|
|
96
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/commands/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EACL,YAAY,EACZ,aAAa,EACb,KAAK,EACL,MAAM,EACN,UAAU,EACV,WAAW,EACX,MAAM,EACN,WAAW,EACX,SAAS,EACT,WAAW,EACX,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,YAAY,EACZ,MAAM,EACN,aAAa,GACd,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AACjF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;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AC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CACrF,CAAA;AACH,CAAC,CAAC,CAAA;AAEN,MAAM,CAAC,MAAM,cAAc,GAAG,GAAY,EAAE,CAC1C,QAAQ,CAAC,IAAI,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;KACtD,WAAW,CAAC,uBAAuB,OAAO,0BAA0B,CAAC;KACrE,UAAU,CAAC,YAAY,EAAE,CAAC;KAC1B,UAAU,CAAC,aAAa,EAAE,CAAC;KAC3B,UAAU,CAAC,UAAU,EAAE,CAAC;KACxB,UAAU,CAAC,WAAW,EAAE,CAAC,CAAA"}
|
package/dist/config.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { type Configuration } from "@wirecat/cli-core/cli";
|
|
2
|
+
/** Each command is checked against its own path (`notes.list`); add the keys a command checks inside itself. */
|
|
3
|
+
export declare const permissions: import("@wirecat/cli-core/cli").CommandPermissions;
|
|
2
4
|
export declare const configuration: Configuration;
|
|
3
5
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAmC,MAAM,uBAAuB,CAAA;AAG3F,gHAAgH;AAChH,eAAO,MAAM,WAAW,oDAAuB,CAAA;AAE/C,eAAO,MAAM,aAAa,EAAE,aAAsD,CAAA"}
|
package/dist/config.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { settingsFor } from "@wirecat/cli-core/cli";
|
|
1
|
+
import { commandPermissions, settingsFor } from "@wirecat/cli-core/cli";
|
|
2
2
|
import { IDENTITY } from "./identity.js";
|
|
3
|
-
|
|
3
|
+
/** Each command is checked against its own path (`notes.list`); add the keys a command checks inside itself. */
|
|
4
|
+
export const permissions = commandPermissions();
|
|
5
|
+
export const configuration = settingsFor(IDENTITY, { permissions });
|
|
4
6
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,WAAW,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,kBAAkB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAC3F,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,gHAAgH;AAChH,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,EAAE,CAAA;AAE/C,MAAM,CAAC,MAAM,aAAa,GAAkB,WAAW,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,CAAC,CAAA"}
|