nolo-cli 0.8.0-alpha.2 → 0.8.0-alpha.21

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 (188) hide show
  1. package/README.md +1 -1
  2. package/_executeModel-42U3VOVZ.js +205 -0
  3. package/action-TLI3V62L.js +28 -0
  4. package/addContentAction-57RSIIMR.js +26 -0
  5. package/addDialogAgentAction-G3VWEA6E.js +68 -0
  6. package/agentDeleteCommand-5DD2IM3J.js +327 -0
  7. package/agentEmailCommands-6FACJBU4.js +628 -0
  8. package/agentListCommands-I6KZYCIG.js +223 -0
  9. package/agentMachineCommands-VKLIGMZA.js +425 -0
  10. package/agentPullCommand-O2MTUAFR.js +122 -0
  11. package/agentRecordCommands-7TZICYDT.js +96 -0
  12. package/agentRunCommand-L4OM23KV.js +114 -0
  13. package/agentRunControl-K4VKNEHF.js +57 -0
  14. package/agentRuntimeLocal-ZYEIPTY4.js +104 -0
  15. package/agentSlice-BX7GXSNO.js +42 -0
  16. package/authCommand-EB5JSOX5.js +581 -0
  17. package/authCommands-XPEHTKSM.js +35 -0
  18. package/chunk-25LCXTML.js +175 -0
  19. package/chunk-2ECQG4YX.js +22296 -0
  20. package/chunk-2FTTDCD4.js +675 -0
  21. package/chunk-2JCXITPK.js +1078 -0
  22. package/chunk-3ASDTTEI.js +1774 -0
  23. package/chunk-3EUW3WEO.js +8 -0
  24. package/chunk-3LY4F7SV.js +9293 -0
  25. package/chunk-4CQLVGRV.js +50 -0
  26. package/chunk-4IJYA27C.js +342 -0
  27. package/chunk-4O3CARJ4.js +231 -0
  28. package/chunk-4QEWT7KD.js +933 -0
  29. package/chunk-4SN6J65J.js +38 -0
  30. package/chunk-4VNS5WPM.js +42 -0
  31. package/chunk-4XENYTF5.js +222 -0
  32. package/chunk-4ZDM73SD.js +34 -0
  33. package/chunk-5CS33IBL.js +301 -0
  34. package/chunk-5EFXE3O7.js +138 -0
  35. package/chunk-5KLGBAAR.js +386 -0
  36. package/chunk-5MIDPSSK.js +206 -0
  37. package/chunk-5MMAK75Q.js +15 -0
  38. package/chunk-63W5N6P3.js +150 -0
  39. package/chunk-6HYVJV7B.js +102 -0
  40. package/chunk-6KHNO3SK.js +1948 -0
  41. package/chunk-6WD3OOJS.js +20 -0
  42. package/chunk-7DAJ4AI4.js +191 -0
  43. package/chunk-7GNGZRLZ.js +1939 -0
  44. package/chunk-7KCUSYT2.js +354 -0
  45. package/chunk-7U44LYTR.js +238 -0
  46. package/chunk-AFON4QUU.js +112 -0
  47. package/chunk-AGFH73SK.js +239 -0
  48. package/chunk-AL2KDGR2.js +27339 -0
  49. package/chunk-AS4PVWA4.js +221 -0
  50. package/chunk-ATNTHIZI.js +13 -0
  51. package/chunk-AVMKZHBC.js +85 -0
  52. package/chunk-AZPCASRE.js +36 -0
  53. package/chunk-BBYVOSU2.js +792 -0
  54. package/chunk-C3RUNRHT.js +51 -0
  55. package/chunk-C4FTUXVF.js +146 -0
  56. package/chunk-CF2WZF4N.js +134 -0
  57. package/chunk-CF7PE763.js +10 -0
  58. package/chunk-CKOJQDKR.js +198 -0
  59. package/chunk-CMKUBIGW.js +1550 -0
  60. package/chunk-CWMSB67P.js +34 -0
  61. package/chunk-DCOA4QSN.js +105 -0
  62. package/chunk-DFFIZ25G.js +30 -0
  63. package/chunk-DSZUWUYB.js +478 -0
  64. package/chunk-DWLEOOGR.js +8 -0
  65. package/chunk-DZ3XJVET.js +231 -0
  66. package/chunk-EHLHSX7R.js +1433 -0
  67. package/chunk-ENOG22KJ.js +939 -0
  68. package/chunk-FSO5B7GH.js +171 -0
  69. package/chunk-FVYY6MCS.js +1447 -0
  70. package/chunk-G3SUCT4W.js +8 -0
  71. package/chunk-GAKEBQD6.js +30 -0
  72. package/chunk-GBRG75BQ.js +86 -0
  73. package/chunk-GU3PEVGZ.js +4723 -0
  74. package/chunk-H33743XH.js +25 -0
  75. package/chunk-HNMXYYJR.js +12 -0
  76. package/chunk-HNW7IJSK.js +71 -0
  77. package/chunk-I42VC5KR.js +15 -0
  78. package/chunk-I6XMPTMR.js +113 -0
  79. package/chunk-IDZTNRP2.js +85 -0
  80. package/chunk-ISNCLGUZ.js +146 -0
  81. package/chunk-IWX4UW2E.js +548 -0
  82. package/chunk-JBTJAPUF.js +35 -0
  83. package/chunk-JEXVIMYZ.js +55 -0
  84. package/chunk-JRKKFRAV.js +537 -0
  85. package/chunk-JZPBVBIY.js +94 -0
  86. package/chunk-KKY4B2Q2.js +21 -0
  87. package/chunk-KQHGZWSV.js +63 -0
  88. package/chunk-KUG52IAP.js +8 -0
  89. package/chunk-KX6YBIHG.js +8 -0
  90. package/chunk-LCBAMY2M.js +60 -0
  91. package/chunk-LM6IYQ3F.js +16 -0
  92. package/chunk-LTRXGFMS.js +83 -0
  93. package/chunk-M76ECQRD.js +13658 -0
  94. package/chunk-MRC4Q34M.js +188 -0
  95. package/chunk-MTU75CZ2.js +91 -0
  96. package/chunk-N54XAP77.js +19 -0
  97. package/chunk-O2ZNTTET.js +3272 -0
  98. package/chunk-O4BU24WZ.js +3212 -0
  99. package/chunk-OLZBQWZU.js +6 -0
  100. package/chunk-OOSFSFMA.js +271 -0
  101. package/chunk-OPZYGHUC.js +89 -0
  102. package/chunk-OWOHNGCN.js +50 -0
  103. package/chunk-P3PKED2I.js +962 -0
  104. package/chunk-QSJ3HFEF.js +8 -0
  105. package/chunk-RCSJFQPB.js +9036 -0
  106. package/chunk-RL776AGR.js +190 -0
  107. package/chunk-ROWQEJRP.js +139 -0
  108. package/chunk-S7Z2HMCN.js +25 -0
  109. package/chunk-SDJDLO5W.js +628 -0
  110. package/chunk-SOTZ6RDN.js +69 -0
  111. package/chunk-TILFE6LV.js +381 -0
  112. package/chunk-U4TRT5V4.js +246 -0
  113. package/chunk-U6VC4MU4.js +8 -0
  114. package/chunk-UAD2WT54.js +64 -0
  115. package/chunk-UB6SN4NJ.js +421 -0
  116. package/chunk-URUUZLPA.js +807 -0
  117. package/chunk-UTLZINAP.js +3066 -0
  118. package/chunk-VC6OZXO5.js +298 -0
  119. package/chunk-VF4K2QE6.js +21 -0
  120. package/chunk-VHBWHNVT.js +59 -0
  121. package/chunk-VIDPVFP3.js +20 -0
  122. package/chunk-VP4WJWKW.js +8882 -0
  123. package/chunk-VUW5FBDB.js +573 -0
  124. package/chunk-VVX233PH.js +482 -0
  125. package/chunk-VX3SXJ3N.js +2052 -0
  126. package/chunk-W4NVOSFF.js +37 -0
  127. package/chunk-WWC7I6TA.js +8 -0
  128. package/chunk-WZSRQNQG.js +2587 -0
  129. package/chunk-XBUBEFNX.js +34 -0
  130. package/chunk-XENYHRUE.js +104 -0
  131. package/chunk-Y5GCAMGP.js +9 -0
  132. package/chunk-YPRZSPF3.js +148 -0
  133. package/chunk-Z4NR32XR.js +50 -0
  134. package/chunk-ZNFJWEN4.js +56 -0
  135. package/cliExecutor-K3F7DMRO.js +36 -0
  136. package/clipboardy-BVE3LVEH.js +12001 -0
  137. package/createAgentAutomationAction-RJF3N2QY.js +866 -0
  138. package/createDialogAction-DRSPS6CE.js +55 -0
  139. package/createPageAction-6B2WMNO3.js +172 -0
  140. package/db-HCJ5PRB5.js +271 -0
  141. package/dbSlice-Q3TM2FJV.js +60 -0
  142. package/deleteFile-OW53A6BX.js +41 -0
  143. package/dialogCommands-4IX4XIZE.js +63 -0
  144. package/dialogSlice-3M7KX2TX.js +148 -0
  145. package/docCreateCommands-SIL3NPGT.js +220 -0
  146. package/docDeleteCommands-7IOMLUS4.js +181 -0
  147. package/docReadCommands-FNFXUA5L.js +134 -0
  148. package/docStore-SV7E34D4.js +98 -0
  149. package/docUpdateCommands-X2HNDVUC.js +318 -0
  150. package/fetchMessages-KTNM7QAR.js +17 -0
  151. package/getPricing-3E6UNPKL.js +30 -0
  152. package/handleSendMessageAction-JYETO5RZ.js +185 -0
  153. package/index.js +188 -112958
  154. package/lib-FYYBQIXS.js +19839 -0
  155. package/localDialogRead-2VRI24F4.js +26 -0
  156. package/localFirstLog-DHNOY2NA.js +19 -0
  157. package/localRuntimeAuthority-TEGCOWX4.js +471 -0
  158. package/localRuntimeDb-LGDF6FQP.js +12 -0
  159. package/machineCommands-RIO3RP5Q.js +781 -0
  160. package/machineInfo-M6KB6HZN.js +10 -0
  161. package/machineWsRunDispatch-W7UYLGB5.js +112 -0
  162. package/memoryCommands-O4MIPIWQ.js +476 -0
  163. package/models-4OPOOLFS.js +9 -0
  164. package/offlineMarxistsAgentCommand-BCPJITJL.js +242 -0
  165. package/package.json +4 -24
  166. package/read-GW7ZEI23.js +17 -0
  167. package/readDocTool-HUFU6OCT.js +16 -0
  168. package/readlineWorkspace-27JR7WPW.js +5682 -0
  169. package/removeDialogAgentAction-CXKR4NJI.js +73 -0
  170. package/runAgentClientLoop-HZFAPJHS.js +293 -0
  171. package/runtimeDoctorCommands-LRHLPDRC.js +289 -0
  172. package/setDialogExtraReferencesAction-6RKUSXHX.js +60 -0
  173. package/setPrimaryDialogAgentAction-T3UTBEFG.js +80 -0
  174. package/settingSlice-IVKXJXMG.js +199 -0
  175. package/skillDiscovery-UGSQGX2U.js +16 -0
  176. package/skillSummaryMarker-42HKSXYY.js +9 -0
  177. package/slateToRenderMarkdown-Y5IYN73U.js +7 -0
  178. package/slateUtils-2M7MUTWX.js +19 -0
  179. package/spaceCommands-E7VOF4LO.js +450 -0
  180. package/spaceSlice-TSVROA5U.js +149 -0
  181. package/streamAgentChatTurn-3C5RQZJF.js +4510 -0
  182. package/tableCommands-O7O2LBEG.js +1286 -0
  183. package/toolApiClient-QI3YBNWB.js +26 -0
  184. package/tools-EQDEKR6N.js +87 -0
  185. package/tuiSummaryLlmCaller-RV3THLZF.js +78 -0
  186. package/understanding-3CUQQ6SV.js +271 -0
  187. package/updateCommands-VOSPKXFF.js +31 -0
  188. package/updateDialogTitleAction-3XV7VWSZ.js +188 -0
@@ -0,0 +1,148 @@
1
+ import {
2
+ abortAllMessages,
3
+ addDialogAgent,
4
+ clearDialogState,
5
+ createAgentAutomation,
6
+ createDialog,
7
+ createPageAndAddReference,
8
+ deleteDialog,
9
+ handleSendMessage,
10
+ initDialog,
11
+ removeDialogAgent,
12
+ selectCurrentDialogAgentIds,
13
+ selectCurrentDialogConfig,
14
+ selectCurrentDialogTokens,
15
+ selectCurrentPrimaryAgentId,
16
+ selectDialogConfigByKey,
17
+ selectTotalDialogTokens,
18
+ setDialogExtraReferences,
19
+ setPrimaryDialogAgent,
20
+ updateDialogTitle,
21
+ updateTokens
22
+ } from "./chunk-2ECQG4YX.js";
23
+ import "./chunk-4ZDM73SD.js";
24
+ import "./chunk-MRC4Q34M.js";
25
+ import "./chunk-MTU75CZ2.js";
26
+ import "./chunk-CWMSB67P.js";
27
+ import "./chunk-VUW5FBDB.js";
28
+ import "./chunk-5EFXE3O7.js";
29
+ import "./chunk-Z4NR32XR.js";
30
+ import "./chunk-M76ECQRD.js";
31
+ import "./chunk-SOTZ6RDN.js";
32
+ import "./chunk-I6XMPTMR.js";
33
+ import "./chunk-UAD2WT54.js";
34
+ import "./chunk-DCOA4QSN.js";
35
+ import "./chunk-5MMAK75Q.js";
36
+ import "./chunk-BBYVOSU2.js";
37
+ import "./chunk-5CS33IBL.js";
38
+ import "./chunk-JZPBVBIY.js";
39
+ import "./chunk-IWX4UW2E.js";
40
+ import "./chunk-DFFIZ25G.js";
41
+ import {
42
+ GLOBAL_DIALOG_RUNTIME_KEY,
43
+ addActiveController,
44
+ addPendingFile,
45
+ clearActiveControllers,
46
+ clearDialogRuntimeState,
47
+ clearPendingAttachments,
48
+ clearPendingUserInputQueue,
49
+ dequeueUserInput,
50
+ enqueueUserInput,
51
+ removeActiveController,
52
+ removePendingFile,
53
+ selectActiveControllers,
54
+ selectConfigError,
55
+ selectCurrentDialogKey,
56
+ selectDialogRuntimeByKey,
57
+ selectDialogRuntimeTokens,
58
+ selectLoopStopReason,
59
+ selectPendingFiles,
60
+ selectPendingRawData,
61
+ selectPendingRawDataByPageKey,
62
+ selectPendingUserInputQueue,
63
+ setLoopStopReason,
64
+ tokenUsageLiveUpdate,
65
+ useActiveControllers,
66
+ useCurrentDialogKey,
67
+ useDialogConfigError,
68
+ useDialogRuntimeTokens,
69
+ useLoopStopReason,
70
+ usePendingFiles,
71
+ usePendingUserInputQueue
72
+ } from "./chunk-3ASDTTEI.js";
73
+ import "./chunk-DWLEOOGR.js";
74
+ import "./chunk-HNMXYYJR.js";
75
+ import "./chunk-VX3SXJ3N.js";
76
+ import "./chunk-Y5GCAMGP.js";
77
+ import "./chunk-URUUZLPA.js";
78
+ import "./chunk-AZPCASRE.js";
79
+ import "./chunk-7U44LYTR.js";
80
+ import "./chunk-KX6YBIHG.js";
81
+ import "./chunk-O4BU24WZ.js";
82
+ import "./chunk-I42VC5KR.js";
83
+ import "./chunk-WWC7I6TA.js";
84
+ import "./chunk-QSJ3HFEF.js";
85
+ import "./chunk-DSZUWUYB.js";
86
+ import "./chunk-UTLZINAP.js";
87
+ import "./chunk-OOSFSFMA.js";
88
+ import "./chunk-GBRG75BQ.js";
89
+ import "./chunk-4SN6J65J.js";
90
+ import "./chunk-LCBAMY2M.js";
91
+ import "./chunk-3EUW3WEO.js";
92
+ import "./chunk-U6VC4MU4.js";
93
+ import "./chunk-CF7PE763.js";
94
+ import "./chunk-G3SUCT4W.js";
95
+ import "./chunk-KUG52IAP.js";
96
+ import "./chunk-4VNS5WPM.js";
97
+ export {
98
+ GLOBAL_DIALOG_RUNTIME_KEY,
99
+ abortAllMessages,
100
+ addActiveController,
101
+ addDialogAgent,
102
+ addPendingFile,
103
+ clearActiveControllers,
104
+ clearDialogRuntimeState,
105
+ clearDialogState,
106
+ clearPendingAttachments,
107
+ clearPendingUserInputQueue,
108
+ createAgentAutomation,
109
+ createDialog,
110
+ createPageAndAddReference,
111
+ deleteDialog,
112
+ dequeueUserInput,
113
+ enqueueUserInput,
114
+ handleSendMessage,
115
+ initDialog,
116
+ removeActiveController,
117
+ removeDialogAgent,
118
+ removePendingFile,
119
+ selectActiveControllers,
120
+ selectConfigError,
121
+ selectCurrentDialogAgentIds,
122
+ selectCurrentDialogConfig,
123
+ selectCurrentDialogKey,
124
+ selectCurrentDialogTokens,
125
+ selectCurrentPrimaryAgentId,
126
+ selectDialogConfigByKey,
127
+ selectDialogRuntimeByKey,
128
+ selectDialogRuntimeTokens,
129
+ selectLoopStopReason,
130
+ selectPendingFiles,
131
+ selectPendingRawData,
132
+ selectPendingRawDataByPageKey,
133
+ selectPendingUserInputQueue,
134
+ selectTotalDialogTokens,
135
+ setDialogExtraReferences,
136
+ setLoopStopReason,
137
+ setPrimaryDialogAgent,
138
+ tokenUsageLiveUpdate,
139
+ updateDialogTitle,
140
+ updateTokens,
141
+ useActiveControllers,
142
+ useCurrentDialogKey,
143
+ useDialogConfigError,
144
+ useDialogRuntimeTokens,
145
+ useLoopStopReason,
146
+ usePendingFiles,
147
+ usePendingUserInputQueue
148
+ };
@@ -0,0 +1,220 @@
1
+ import {
2
+ findPotentialSecrets,
3
+ formatSecretFindings
4
+ } from "./chunk-S7Z2HMCN.js";
5
+ import {
6
+ buildPageKey,
7
+ buildPageRecord,
8
+ buildSkillDocId,
9
+ buildSkillPageKey,
10
+ buildSkillPageRecord,
11
+ buildSkillSummaryForRecord,
12
+ createPageId,
13
+ hasFlag,
14
+ hasHelpArg,
15
+ parseJsonArg,
16
+ readBodyArg,
17
+ readTitle,
18
+ requireTokenUser,
19
+ resolveDocKind,
20
+ resolveWriteTargets,
21
+ writePageRecord
22
+ } from "./chunk-7KCUSYT2.js";
23
+ import "./chunk-SDJDLO5W.js";
24
+ import "./chunk-N54XAP77.js";
25
+ import "./chunk-VHBWHNVT.js";
26
+ import "./chunk-VF4K2QE6.js";
27
+ import "./chunk-VC6OZXO5.js";
28
+ import "./chunk-UAD2WT54.js";
29
+ import "./chunk-IDZTNRP2.js";
30
+ import {
31
+ readOption
32
+ } from "./chunk-ISNCLGUZ.js";
33
+ import "./chunk-OLZBQWZU.js";
34
+ import "./chunk-WZSRQNQG.js";
35
+ import "./chunk-O2ZNTTET.js";
36
+ import "./chunk-5KLGBAAR.js";
37
+ import "./chunk-ZNFJWEN4.js";
38
+ import "./chunk-TILFE6LV.js";
39
+ import "./chunk-4QEWT7KD.js";
40
+ import "./chunk-OPZYGHUC.js";
41
+ import "./chunk-AGFH73SK.js";
42
+ import "./chunk-JRKKFRAV.js";
43
+ import "./chunk-P3PKED2I.js";
44
+ import "./chunk-5MMAK75Q.js";
45
+ import "./chunk-BBYVOSU2.js";
46
+ import "./chunk-5CS33IBL.js";
47
+ import "./chunk-JZPBVBIY.js";
48
+ import "./chunk-IWX4UW2E.js";
49
+ import "./chunk-DWLEOOGR.js";
50
+ import "./chunk-HNMXYYJR.js";
51
+ import "./chunk-KX6YBIHG.js";
52
+ import "./chunk-O4BU24WZ.js";
53
+ import "./chunk-I42VC5KR.js";
54
+ import "./chunk-WWC7I6TA.js";
55
+ import "./chunk-QSJ3HFEF.js";
56
+ import "./chunk-4SN6J65J.js";
57
+ import "./chunk-LCBAMY2M.js";
58
+ import "./chunk-3EUW3WEO.js";
59
+ import "./chunk-U6VC4MU4.js";
60
+ import "./chunk-CF7PE763.js";
61
+ import "./chunk-G3SUCT4W.js";
62
+ import "./chunk-KUG52IAP.js";
63
+ import "./chunk-4VNS5WPM.js";
64
+
65
+ // packages/cli/docCreateCommands.ts
66
+ function printDocCreateUsage(output) {
67
+ output.write(`Usage:
68
+ nolo doc create --title <title> [--body ... | --body-file path] [--id ...] [--space ...]
69
+
70
+ Options:
71
+ --description <text> Optional page description stored in meta.
72
+ --sync local,main,us Choose write targets. Values may also be full URLs.
73
+ --local-only Write only to the local server target.
74
+ --no-local Exclude local targets when --sync includes them.
75
+ --dry-run Build and validate without writing.
76
+ --json Print machine-readable JSON.
77
+ --allow-secrets Allow bodies that look like credentials.
78
+ --server <url> Default write target when --sync is omitted.
79
+ --token <jwt> Auth token. Required for writes.
80
+ `);
81
+ }
82
+ function printSkillDocCreateUsage(output) {
83
+ output.write(`Usage:
84
+ nolo skill-doc create --title <title> --description <text> [--body ... | --body-file path]
85
+ nolo skill create-doc --title <title> --description <text> [--body ... | --body-file path]
86
+
87
+ Options:
88
+ --tools '["readDoc"]' Tool names this skill expects.
89
+ --required-skills '["skill-a"]' Required skill references.
90
+ --recommended-skills '["skill-b"]' Recommended skill references.
91
+ --preferred-agents '["agent-key"]' Preferred agent keys.
92
+ --trigger-mode explicit|required|recommended
93
+ --budget-tier low|medium|high
94
+ --prompt-patch <text>
95
+ --page | --kind page Create a normal page instead of a skill-backed page.
96
+ --sync local,main,us Choose write targets. Values may also be full URLs.
97
+ --dry-run Build and validate without writing.
98
+ --json Print machine-readable JSON.
99
+ --token <jwt> Auth token. Required for writes.
100
+ `);
101
+ }
102
+ async function runCreateCommand(args, deps, options) {
103
+ if (hasHelpArg(args)) {
104
+ options.usage(process.stdout);
105
+ return 0;
106
+ }
107
+ const title = readTitle(args);
108
+ const description = readOption(args, "--description") ?? "";
109
+ const docKind = resolveDocKind(args, options.defaultKind);
110
+ const shouldDryRun = hasFlag(args, "--dry-run");
111
+ const shouldOutputJson = hasFlag(args, "--json");
112
+ const allowSecrets = hasFlag(args, "--allow-secrets");
113
+ const spaceId = readOption(args, "--space") ?? null;
114
+ if (!title || docKind === "skill" && !description) {
115
+ options.usage(process.stderr);
116
+ return 1;
117
+ }
118
+ const body = readBodyArg(args, "");
119
+ const secretFindings = findPotentialSecrets(body);
120
+ if (secretFindings.length && !allowSecrets) {
121
+ throw new Error(
122
+ [
123
+ "Document body appears to contain credentials or secrets. Pass --allow-secrets to write it anyway.",
124
+ formatSecretFindings(secretFindings)
125
+ ].join("\n")
126
+ );
127
+ }
128
+ const { authToken, userId } = requireTokenUser(args, deps.env, shouldDryRun);
129
+ const targets = resolveWriteTargets(args, deps.env);
130
+ if (!targets.length) {
131
+ throw new Error("No write targets resolved. Check --sync / --local-only / --no-local.");
132
+ }
133
+ const explicitId = readOption(args, "--id");
134
+ const docId = explicitId ?? (docKind === "skill" ? buildSkillDocId(title) : createPageId());
135
+ const dbKey = docKind === "skill" ? buildSkillPageKey(userId, docId) : buildPageKey(userId, docId);
136
+ const record = docKind === "skill" ? buildSkillPageRecord({
137
+ dbKey,
138
+ skillId: docId,
139
+ title,
140
+ spaceId,
141
+ body,
142
+ skillConfig: {
143
+ version: "0.1",
144
+ kind: "skill",
145
+ id: docId,
146
+ name: title,
147
+ description,
148
+ ...parseJsonArg(readOption(args, "--tools"), []).length ? { toolNames: parseJsonArg(readOption(args, "--tools"), []) } : {},
149
+ ...parseJsonArg(readOption(args, "--required-skills"), []).length ? { requiredSkills: parseJsonArg(readOption(args, "--required-skills"), []) } : {},
150
+ ...parseJsonArg(readOption(args, "--recommended-skills"), []).length ? { recommendedSkills: parseJsonArg(readOption(args, "--recommended-skills"), []) } : {},
151
+ ...parseJsonArg(readOption(args, "--preferred-agents"), []).length ? { preferredAgents: parseJsonArg(readOption(args, "--preferred-agents"), []) } : {},
152
+ ...readOption(args, "--trigger-mode") ? { triggerMode: readOption(args, "--trigger-mode") } : {},
153
+ ...readOption(args, "--budget-tier") ? { budgetTier: readOption(args, "--budget-tier") } : {},
154
+ ...readOption(args, "--prompt-patch") ? { promptPatch: readOption(args, "--prompt-patch") } : {}
155
+ }
156
+ }) : buildPageRecord({
157
+ dbKey,
158
+ pageId: docId,
159
+ title,
160
+ spaceId,
161
+ content: body,
162
+ meta: description ? { description } : void 0
163
+ });
164
+ const skillSummary = buildSkillSummaryForRecord(record);
165
+ const summary = {
166
+ dryRun: shouldDryRun,
167
+ kind: docKind,
168
+ title,
169
+ dbKey,
170
+ id: docId,
171
+ userId,
172
+ spaceId,
173
+ syncTargets: targets,
174
+ writtenTargets: [],
175
+ secretFindingCount: secretFindings.length,
176
+ secretFindings
177
+ };
178
+ if (!shouldDryRun) {
179
+ for (const serverUrl of targets) {
180
+ await writePageRecord({
181
+ authToken,
182
+ dbKey,
183
+ record,
184
+ serverUrl,
185
+ spaceId,
186
+ title,
187
+ userId,
188
+ skillSummary
189
+ });
190
+ summary.writtenTargets.push(serverUrl);
191
+ }
192
+ }
193
+ if (shouldOutputJson) {
194
+ process.stdout.write(`${JSON.stringify(summary, null, 2)}
195
+ `);
196
+ } else if (shouldDryRun) {
197
+ process.stdout.write(`dry-run ok: ${dbKey}
198
+ `);
199
+ } else {
200
+ process.stdout.write(`created ${docKind}: ${dbKey}
201
+ `);
202
+ }
203
+ return 0;
204
+ }
205
+ async function runDocCreateCommand(args, deps) {
206
+ return runCreateCommand(args, deps, {
207
+ defaultKind: "page",
208
+ usage: printDocCreateUsage
209
+ });
210
+ }
211
+ async function runSkillDocCreateCommand(args, deps) {
212
+ return runCreateCommand(args, deps, {
213
+ defaultKind: "skill",
214
+ usage: printSkillDocCreateUsage
215
+ });
216
+ }
217
+ export {
218
+ runDocCreateCommand,
219
+ runSkillDocCreateCommand
220
+ };
@@ -0,0 +1,181 @@
1
+ import {
2
+ buildPageKey,
3
+ buildSkillPageKey,
4
+ hasFlag,
5
+ hasHelpArg,
6
+ readPageRecord,
7
+ removePageFromSpace,
8
+ requireTokenUser,
9
+ resolveDocKind,
10
+ resolveWriteTargets
11
+ } from "./chunk-7KCUSYT2.js";
12
+ import {
13
+ deleteDbRecordOnServers
14
+ } from "./chunk-RL776AGR.js";
15
+ import "./chunk-SDJDLO5W.js";
16
+ import "./chunk-N54XAP77.js";
17
+ import "./chunk-VHBWHNVT.js";
18
+ import "./chunk-KQHGZWSV.js";
19
+ import "./chunk-VF4K2QE6.js";
20
+ import "./chunk-VC6OZXO5.js";
21
+ import "./chunk-UAD2WT54.js";
22
+ import "./chunk-IDZTNRP2.js";
23
+ import {
24
+ readOption
25
+ } from "./chunk-ISNCLGUZ.js";
26
+ import "./chunk-OLZBQWZU.js";
27
+ import "./chunk-WZSRQNQG.js";
28
+ import "./chunk-O2ZNTTET.js";
29
+ import "./chunk-5KLGBAAR.js";
30
+ import "./chunk-ZNFJWEN4.js";
31
+ import "./chunk-TILFE6LV.js";
32
+ import "./chunk-4QEWT7KD.js";
33
+ import "./chunk-OPZYGHUC.js";
34
+ import "./chunk-AGFH73SK.js";
35
+ import "./chunk-JRKKFRAV.js";
36
+ import "./chunk-P3PKED2I.js";
37
+ import "./chunk-5MMAK75Q.js";
38
+ import "./chunk-BBYVOSU2.js";
39
+ import "./chunk-5CS33IBL.js";
40
+ import "./chunk-JZPBVBIY.js";
41
+ import "./chunk-IWX4UW2E.js";
42
+ import "./chunk-DWLEOOGR.js";
43
+ import "./chunk-HNMXYYJR.js";
44
+ import "./chunk-KX6YBIHG.js";
45
+ import "./chunk-O4BU24WZ.js";
46
+ import "./chunk-I42VC5KR.js";
47
+ import "./chunk-WWC7I6TA.js";
48
+ import "./chunk-QSJ3HFEF.js";
49
+ import "./chunk-GBRG75BQ.js";
50
+ import "./chunk-4SN6J65J.js";
51
+ import "./chunk-LCBAMY2M.js";
52
+ import "./chunk-3EUW3WEO.js";
53
+ import "./chunk-U6VC4MU4.js";
54
+ import "./chunk-CF7PE763.js";
55
+ import "./chunk-G3SUCT4W.js";
56
+ import "./chunk-KUG52IAP.js";
57
+ import "./chunk-4VNS5WPM.js";
58
+
59
+ // packages/cli/docDeleteCommands.ts
60
+ function printDocDeleteUsage(output) {
61
+ output.write(`Usage:
62
+ nolo doc delete (--id <pageId> | --key <pageKey>)
63
+
64
+ Options:
65
+ --id <pageId> Page id (without user prefix).
66
+ --key <pageKey> Full dbKey, e.g. page-<userId>-<pageId>.
67
+ --sync local,main,us Choose delete targets. Values may also be full URLs.
68
+ --local-only Delete only on the local server target.
69
+ --no-local Exclude local targets when --sync includes them.
70
+ --dry-run Show what would be deleted without deleting.
71
+ --json Print machine-readable JSON.
72
+ --server <url> Default target when --sync is omitted.
73
+ --token <jwt> Auth token. Required for deletes.
74
+ `);
75
+ }
76
+ function printSkillDocDeleteUsage(output) {
77
+ output.write(`Usage:
78
+ nolo skill-doc delete (--id <skillId> | --key <pageKey>)
79
+
80
+ Options:
81
+ --id <skillId> Skill id (without user prefix).
82
+ --key <pageKey> Full dbKey, e.g. page-<userId>-<skillId>.
83
+ --sync local,main,us Choose delete targets. Values may also be full URLs.
84
+ --local-only Delete only on the local server target.
85
+ --no-local Exclude local targets when --sync includes them.
86
+ --dry-run Show what would be deleted without deleting.
87
+ --json Print machine-readable JSON.
88
+ --token <jwt> Auth token. Required for deletes.
89
+ `);
90
+ }
91
+ async function runDeleteCommand(args, deps, options) {
92
+ if (hasHelpArg(args)) {
93
+ options.usage(process.stdout);
94
+ return 0;
95
+ }
96
+ const explicitId = readOption(args, "--id");
97
+ const explicitKey = readOption(args, "--key");
98
+ if (!explicitId && !explicitKey) {
99
+ options.usage(process.stderr);
100
+ return 1;
101
+ }
102
+ const docKind = resolveDocKind(args, options.defaultKind);
103
+ const shouldDryRun = hasFlag(args, "--dry-run");
104
+ const shouldOutputJson = hasFlag(args, "--json");
105
+ const { authToken, userId } = requireTokenUser(args, deps.env, shouldDryRun);
106
+ const targets = resolveWriteTargets(args, deps.env);
107
+ if (!targets.length) {
108
+ throw new Error("No delete targets resolved. Check --sync / --local-only / --no-local.");
109
+ }
110
+ const dbKey = explicitKey ?? (docKind === "skill" ? buildSkillPageKey(userId, explicitId) : buildPageKey(userId, explicitId));
111
+ const existing = await readPageRecord({ authToken, dbKey, serverUrl: targets[0] });
112
+ if (docKind === "page" && existing?.meta?.kind === "skill") {
113
+ throw new Error(`Target page is a skill doc. Use nolo skill-doc delete --key ${dbKey}`);
114
+ }
115
+ if (docKind === "skill" && existing?.meta?.kind !== "skill") {
116
+ throw new Error(`Target page is not a skill doc. Use nolo doc delete --key ${dbKey}`);
117
+ }
118
+ const spaceId = typeof existing?.spaceId === "string" ? existing.spaceId : null;
119
+ const summary = {
120
+ dryRun: shouldDryRun,
121
+ kind: docKind,
122
+ dbKey,
123
+ userId,
124
+ spaceId,
125
+ syncTargets: targets,
126
+ deletedTargets: []
127
+ };
128
+ if (!shouldDryRun) {
129
+ if (spaceId) {
130
+ for (const serverUrl of targets) {
131
+ await removePageFromSpace({
132
+ baseUrl: serverUrl,
133
+ userId,
134
+ authToken,
135
+ spaceId,
136
+ contentKey: dbKey
137
+ }).catch(() => null);
138
+ }
139
+ }
140
+ const results = await deleteDbRecordOnServers({
141
+ authToken,
142
+ dbKey,
143
+ fetchImpl: fetch,
144
+ serverUrls: targets
145
+ });
146
+ const failed = results.filter((result) => !result.ok);
147
+ if (failed.length) {
148
+ throw new Error(
149
+ `delete ${dbKey} failed on ${failed.map((result) => `${result.serverUrl}: ${result.error}`).join("; ")}`
150
+ );
151
+ }
152
+ summary.deletedTargets.push(...results.map((result) => result.serverUrl));
153
+ }
154
+ if (shouldOutputJson) {
155
+ process.stdout.write(`${JSON.stringify(summary, null, 2)}
156
+ `);
157
+ } else if (shouldDryRun) {
158
+ process.stdout.write(`dry-run ok: ${dbKey}
159
+ `);
160
+ } else {
161
+ process.stdout.write(`deleted ${docKind}: ${dbKey}
162
+ `);
163
+ }
164
+ return 0;
165
+ }
166
+ async function runDocDeleteCommand(args, deps) {
167
+ return runDeleteCommand(args, deps, {
168
+ defaultKind: "page",
169
+ usage: printDocDeleteUsage
170
+ });
171
+ }
172
+ async function runSkillDocDeleteCommand(args, deps) {
173
+ return runDeleteCommand(args, deps, {
174
+ defaultKind: "skill",
175
+ usage: printSkillDocDeleteUsage
176
+ });
177
+ }
178
+ export {
179
+ runDocDeleteCommand,
180
+ runSkillDocDeleteCommand
181
+ };
@@ -0,0 +1,134 @@
1
+ import {
2
+ buildPageKey,
3
+ buildSkillPageKey,
4
+ hasFlag,
5
+ hasHelpArg,
6
+ readPageRecord,
7
+ requireTokenUser,
8
+ resolveDocKind,
9
+ resolveWriteTargets
10
+ } from "./chunk-7KCUSYT2.js";
11
+ import "./chunk-SDJDLO5W.js";
12
+ import "./chunk-N54XAP77.js";
13
+ import "./chunk-VHBWHNVT.js";
14
+ import "./chunk-VF4K2QE6.js";
15
+ import "./chunk-VC6OZXO5.js";
16
+ import "./chunk-UAD2WT54.js";
17
+ import "./chunk-IDZTNRP2.js";
18
+ import {
19
+ readOption
20
+ } from "./chunk-ISNCLGUZ.js";
21
+ import "./chunk-OLZBQWZU.js";
22
+ import "./chunk-WZSRQNQG.js";
23
+ import "./chunk-O2ZNTTET.js";
24
+ import "./chunk-5KLGBAAR.js";
25
+ import "./chunk-ZNFJWEN4.js";
26
+ import "./chunk-TILFE6LV.js";
27
+ import "./chunk-4QEWT7KD.js";
28
+ import "./chunk-OPZYGHUC.js";
29
+ import "./chunk-AGFH73SK.js";
30
+ import "./chunk-JRKKFRAV.js";
31
+ import "./chunk-P3PKED2I.js";
32
+ import "./chunk-5MMAK75Q.js";
33
+ import "./chunk-BBYVOSU2.js";
34
+ import "./chunk-5CS33IBL.js";
35
+ import "./chunk-JZPBVBIY.js";
36
+ import "./chunk-IWX4UW2E.js";
37
+ import "./chunk-DWLEOOGR.js";
38
+ import "./chunk-HNMXYYJR.js";
39
+ import "./chunk-KX6YBIHG.js";
40
+ import "./chunk-O4BU24WZ.js";
41
+ import "./chunk-I42VC5KR.js";
42
+ import "./chunk-WWC7I6TA.js";
43
+ import "./chunk-QSJ3HFEF.js";
44
+ import "./chunk-4SN6J65J.js";
45
+ import "./chunk-LCBAMY2M.js";
46
+ import "./chunk-3EUW3WEO.js";
47
+ import "./chunk-U6VC4MU4.js";
48
+ import "./chunk-CF7PE763.js";
49
+ import "./chunk-G3SUCT4W.js";
50
+ import "./chunk-KUG52IAP.js";
51
+ import "./chunk-4VNS5WPM.js";
52
+
53
+ // packages/cli/docReadCommands.ts
54
+ function printDocReadUsage(output) {
55
+ output.write(`Usage:
56
+ nolo doc read (--id <pageId> | --key <pageKey>)
57
+
58
+ Options:
59
+ --id <pageId> Page id (without user prefix).
60
+ --key <pageKey> Full dbKey, e.g. page-<userId>-<pageId>.
61
+ --server <url> Server to read from.
62
+ --token <jwt> Auth token. Required for reads.
63
+ `);
64
+ }
65
+ function printSkillDocReadUsage(output) {
66
+ output.write(`Usage:
67
+ nolo skill-doc read (--id <skillId> | --key <pageKey>)
68
+
69
+ Options:
70
+ --id <skillId> Skill id (without user prefix).
71
+ --key <pageKey> Full dbKey, e.g. page-<userId>-<skillId>.
72
+ --server <url> Server to read from.
73
+ --token <jwt> Auth token. Required for reads.
74
+ `);
75
+ }
76
+ async function runReadCommand(args, deps, options) {
77
+ if (hasHelpArg(args)) {
78
+ options.usage(process.stdout);
79
+ return 0;
80
+ }
81
+ const explicitId = readOption(args, "--id");
82
+ const explicitKey = readOption(args, "--key");
83
+ if (!explicitId && !explicitKey) {
84
+ options.usage(process.stderr);
85
+ return 1;
86
+ }
87
+ const docKind = resolveDocKind(args, options.defaultKind);
88
+ const shouldOutputJson = hasFlag(args, "--json");
89
+ const { authToken, userId } = requireTokenUser(args, deps.env, false);
90
+ const targets = resolveWriteTargets(args, deps.env);
91
+ if (!targets.length) {
92
+ throw new Error("No read targets resolved. Check --server.");
93
+ }
94
+ const dbKey = explicitKey ?? (docKind === "skill" ? buildSkillPageKey(userId, explicitId) : buildPageKey(userId, explicitId));
95
+ let record = null;
96
+ for (const serverUrl of targets) {
97
+ try {
98
+ record = await readPageRecord({ authToken, dbKey, serverUrl });
99
+ if (record) break;
100
+ } catch {
101
+ }
102
+ }
103
+ if (!record) {
104
+ throw new Error(`doc not found: ${dbKey}`);
105
+ }
106
+ if (shouldOutputJson) {
107
+ process.stdout.write(`${JSON.stringify({ dbKey, record }, null, 2)}
108
+ `);
109
+ } else {
110
+ process.stdout.write(`read ${docKind}: ${dbKey}
111
+ `);
112
+ process.stdout.write(`title: ${record.title ?? "(none)"}
113
+ `);
114
+ process.stdout.write(`spaceId: ${record.spaceId ?? "(none)"}
115
+ `);
116
+ }
117
+ return 0;
118
+ }
119
+ async function runDocReadCommand(args, deps) {
120
+ return runReadCommand(args, deps, {
121
+ defaultKind: "page",
122
+ usage: printDocReadUsage
123
+ });
124
+ }
125
+ async function runSkillDocReadCommand(args, deps) {
126
+ return runReadCommand(args, deps, {
127
+ defaultKind: "skill",
128
+ usage: printSkillDocReadUsage
129
+ });
130
+ }
131
+ export {
132
+ runDocReadCommand,
133
+ runSkillDocReadCommand
134
+ };