@dinoxx/dinox-cli 1.0.20 → 1.0.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/README.md +72 -139
- package/dist/auth/userInfo.d.ts +8 -1
- package/dist/auth/userInfo.js +38 -6
- package/dist/cli.js +1 -2
- package/dist/cliTypes.d.ts +1 -0
- package/dist/commands/auth/index.js +11 -4
- package/dist/commands/boxes/index.js +274 -54
- package/dist/commands/boxes/model.d.ts +34 -0
- package/dist/commands/boxes/model.js +78 -0
- package/dist/commands/boxes/operations.d.ts +86 -0
- package/dist/commands/boxes/operations.js +415 -0
- package/dist/commands/boxes/repo.d.ts +13 -6
- package/dist/commands/boxes/repo.js +272 -149
- package/dist/commands/boxes/store.d.ts +22 -0
- package/dist/commands/boxes/store.js +143 -0
- package/dist/commands/graph/index.js +11 -38
- package/dist/commands/mcp/noteContentTools.d.ts +222 -0
- package/dist/commands/mcp/noteContentTools.js +390 -0
- package/dist/commands/mcp/server.d.ts +3 -0
- package/dist/commands/mcp/server.js +43 -15
- package/dist/commands/mcp/tools.js +3 -1
- package/dist/commands/mcp/types.d.ts +6 -2
- package/dist/commands/meta/index.js +8 -24
- package/dist/commands/meta/repo.d.ts +0 -3
- package/dist/commands/meta/repo.js +1 -4
- package/dist/commands/notes/actions.d.ts +2 -0
- package/dist/commands/notes/actions.js +149 -55
- package/dist/commands/notes/bulk.d.ts +34 -0
- package/dist/commands/notes/bulk.js +204 -0
- package/dist/commands/notes/contentEngine.d.ts +95 -0
- package/dist/commands/notes/contentEngine.js +652 -0
- package/dist/commands/notes/contentPatch.d.ts +84 -0
- package/dist/commands/notes/contentPatch.js +337 -0
- package/dist/commands/notes/contentPatchCommand.d.ts +3 -0
- package/dist/commands/notes/contentPatchCommand.js +126 -0
- package/dist/commands/notes/descriptors.js +194 -42
- package/dist/commands/notes/export.d.ts +21 -0
- package/dist/commands/notes/export.js +224 -0
- package/dist/commands/notes/metadataMutation.d.ts +28 -0
- package/dist/commands/notes/metadataMutation.js +127 -0
- package/dist/commands/notes/repo.d.ts +20 -0
- package/dist/commands/notes/repo.js +135 -18
- package/dist/commands/notes/runtime.d.ts +3 -12
- package/dist/commands/notes/runtime.js +4 -30
- package/dist/commands/notes/searchSql.js +1 -1
- package/dist/commands/prompt/index.js +17 -47
- package/dist/commands/prompt/repo.js +2 -2
- package/dist/commands/runtime.d.ts +34 -0
- package/dist/commands/runtime.js +110 -0
- package/dist/commands/schema/globalOptions.d.ts +1 -0
- package/dist/commands/schema/globalOptions.js +1 -0
- package/dist/commands/schema/renderSkills.js +21 -7
- package/dist/commands/schema/spec.d.ts +1 -2
- package/dist/commands/schema/spec.js +2 -3
- package/dist/commands/schema/types.d.ts +0 -13
- package/dist/commands/storage/index.js +32 -62
- package/dist/commands/sync.js +22 -5
- package/dist/commands/tags/content.d.ts +32 -0
- package/dist/commands/tags/content.js +243 -0
- package/dist/commands/tags/index.js +287 -51
- package/dist/commands/tags/model.d.ts +38 -0
- package/dist/commands/tags/model.js +100 -0
- package/dist/commands/tags/operations.d.ts +105 -0
- package/dist/commands/tags/operations.js +438 -0
- package/dist/commands/tags/repo.d.ts +5 -1
- package/dist/commands/tags/repo.js +142 -218
- package/dist/commands/tags/store.d.ts +28 -0
- package/dist/commands/tags/store.js +166 -0
- package/dist/commands/todo/index.js +32 -63
- package/dist/commands/writeDryRun.d.ts +25 -0
- package/dist/commands/writeDryRun.js +31 -1
- package/dist/config/resolve.js +2 -2
- package/dist/daemon/index.d.ts +2 -0
- package/dist/daemon/index.js +176 -58
- package/dist/powersync/runtime.d.ts +1 -0
- package/dist/powersync/runtime.js +16 -0
- package/dist/powersync/schema/content.d.ts +2 -0
- package/dist/powersync/schema/content.js +2 -0
- package/dist/powersync/schema/index.d.ts +2 -0
- package/dist/powersync/syncGate.d.ts +24 -0
- package/dist/powersync/syncGate.js +36 -0
- package/dist/skills/check.d.ts +1 -1
- package/dist/skills/check.js +27 -2
- package/dist/utils/authToken.d.ts +2 -0
- package/dist/utils/authToken.js +7 -2
- package/dist/utils/noteContentEngine.d.ts +333 -0
- package/dist/utils/noteContentEngine.js +740 -0
- package/dist/utils/tiptapMarkdownSchema.js +31 -0
- package/package.json +4 -8
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { loadConfig } from '../../config/store.js';
|
|
2
|
-
import { resolveConfig } from '../../config/resolve.js';
|
|
3
|
-
import { connectPowerSync } from '../../powersync/runtime.js';
|
|
4
1
|
import { sendDaemonRequest } from '../../daemon/client.js';
|
|
5
2
|
import { ensureDaemonRunning } from '../../daemon/ensure.js';
|
|
6
3
|
import { registerCommandGroup } from '../descriptor/register.js';
|
|
7
|
-
import { FORMAT_OPTIONS, OFFLINE_OPTIONS, SYNC_TIMEOUT_OPTIONS } from '../schema/globalOptions.js';
|
|
4
|
+
import { FORMAT_OPTIONS, OFFLINE_OPTIONS, REQUIRE_SYNC_OPTIONS, SYNC_TIMEOUT_OPTIONS } from '../schema/globalOptions.js';
|
|
8
5
|
import { DinoxError } from '../../utils/errors.js';
|
|
9
6
|
import { printSuccess } from '../../utils/output.js';
|
|
10
|
-
import {
|
|
7
|
+
import { syncBeforeCommand, withCommandRuntime } from '../runtime.js';
|
|
11
8
|
import { getBacklinks, getGraphStats, getOutlinks, getRelatedNotes } from './repo.js';
|
|
12
|
-
const GRAPH_GLOBAL_OPTIONS = [...FORMAT_OPTIONS, ...OFFLINE_OPTIONS, ...SYNC_TIMEOUT_OPTIONS];
|
|
9
|
+
const GRAPH_GLOBAL_OPTIONS = [...FORMAT_OPTIONS, ...OFFLINE_OPTIONS, ...REQUIRE_SYNC_OPTIONS, ...SYNC_TIMEOUT_OPTIONS];
|
|
13
10
|
function parseDepth(value) {
|
|
14
11
|
if (value === undefined || value === null || value === '') {
|
|
15
12
|
return 2;
|
|
@@ -32,15 +29,7 @@ async function withOfflineDb(command, fn) {
|
|
|
32
29
|
if (!Boolean(globals.offline)) {
|
|
33
30
|
throw new DinoxError('withOfflineDb called without --offline');
|
|
34
31
|
}
|
|
35
|
-
|
|
36
|
-
const timeoutMs = parseSyncTimeoutMs(globals.syncTimeout) ?? config.sync.timeoutMs;
|
|
37
|
-
const { db } = await connectPowerSync({ config, offline: true, timeoutMs });
|
|
38
|
-
try {
|
|
39
|
-
return await fn(db);
|
|
40
|
-
}
|
|
41
|
-
finally {
|
|
42
|
-
await db.close().catch(() => undefined);
|
|
43
|
-
}
|
|
32
|
+
return withCommandRuntime(command, async ({ db }) => fn(db));
|
|
44
33
|
}
|
|
45
34
|
async function runGraphCommand(context, onlineAction, offlineAction) {
|
|
46
35
|
const globals = context.globals;
|
|
@@ -48,6 +37,13 @@ async function runGraphCommand(context, onlineAction, offlineAction) {
|
|
|
48
37
|
printSuccess(await withOfflineDb(context.command, offlineAction));
|
|
49
38
|
return;
|
|
50
39
|
}
|
|
40
|
+
if (Boolean(globals.requireSync)) {
|
|
41
|
+
await withCommandRuntime(context, async (runtime) => {
|
|
42
|
+
await syncBeforeCommand(runtime, { syncTokenIndex: true });
|
|
43
|
+
printSuccess(await offlineAction(runtime.db));
|
|
44
|
+
});
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
51
47
|
await ensureDaemonRunning();
|
|
52
48
|
printSuccess(await onlineAction());
|
|
53
49
|
}
|
|
@@ -65,11 +61,6 @@ const graphBacklinksCommand = {
|
|
|
65
61
|
summary: 'Backlink graph payload',
|
|
66
62
|
fields: ['note_id', 'backlinks'],
|
|
67
63
|
},
|
|
68
|
-
mcp: {
|
|
69
|
-
toolName: 'dinox_graph_backlinks',
|
|
70
|
-
description: 'Get notes that link to this note',
|
|
71
|
-
properties: [{ name: 'id', type: 'string', description: 'Note ID', required: true }],
|
|
72
|
-
},
|
|
73
64
|
examples: ['dino graph backlinks <id> --format json'],
|
|
74
65
|
},
|
|
75
66
|
action: async (context) => {
|
|
@@ -94,11 +85,6 @@ const graphOutlinksCommand = {
|
|
|
94
85
|
summary: 'Outlink graph payload',
|
|
95
86
|
fields: ['note_id', 'outlinks'],
|
|
96
87
|
},
|
|
97
|
-
mcp: {
|
|
98
|
-
toolName: 'dinox_graph_outlinks',
|
|
99
|
-
description: 'Get notes that this note links to',
|
|
100
|
-
properties: [{ name: 'id', type: 'string', description: 'Note ID', required: true }],
|
|
101
|
-
},
|
|
102
88
|
examples: ['dino graph outlinks <id> --format json'],
|
|
103
89
|
},
|
|
104
90
|
action: async (context) => {
|
|
@@ -124,14 +110,6 @@ const graphRelatedCommand = {
|
|
|
124
110
|
summary: 'Related-notes graph payload',
|
|
125
111
|
fields: ['note_id', 'depth', 'related_notes'],
|
|
126
112
|
},
|
|
127
|
-
mcp: {
|
|
128
|
-
toolName: 'dinox_graph_related',
|
|
129
|
-
description: 'Get related notes within N degrees',
|
|
130
|
-
properties: [
|
|
131
|
-
{ name: 'id', type: 'string', description: 'Note ID', required: true },
|
|
132
|
-
{ name: 'depth', type: 'number', description: 'Degrees (1-5, default: 2)' },
|
|
133
|
-
],
|
|
134
|
-
},
|
|
135
113
|
examples: ['dino graph related <id> --depth 2 --format json'],
|
|
136
114
|
},
|
|
137
115
|
action: async (context) => {
|
|
@@ -157,11 +135,6 @@ const graphStatsCommand = {
|
|
|
157
135
|
entity: 'graph_stats',
|
|
158
136
|
fields: ['notes_count', 'links_count', 'connected_notes_count', 'isolated_notes_count'],
|
|
159
137
|
},
|
|
160
|
-
mcp: {
|
|
161
|
-
toolName: 'dinox_graph_stats',
|
|
162
|
-
description: 'Get graph statistics for notes and links',
|
|
163
|
-
properties: [],
|
|
164
|
-
},
|
|
165
138
|
examples: ['dino graph stats --format json'],
|
|
166
139
|
},
|
|
167
140
|
action: async (context) => {
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import type { AbstractPowerSyncDatabase } from '@powersync/common';
|
|
2
|
+
import { type NoteEditOperation, type TiptapJsonNode } from '../../utils/noteContentEngine.js';
|
|
3
|
+
import type { MCPTool } from './types.js';
|
|
4
|
+
export declare const NOTE_CONTENT_READ_TOOL_NAME = "noteContentRead";
|
|
5
|
+
export declare const NOTE_CONTENT_EDIT_TOOL_NAME = "noteContentEdit";
|
|
6
|
+
type ReadInput = {
|
|
7
|
+
noteId: string;
|
|
8
|
+
from?: number | null;
|
|
9
|
+
cursor?: {
|
|
10
|
+
from: number;
|
|
11
|
+
contentHash?: string | null;
|
|
12
|
+
} | null;
|
|
13
|
+
nodeRange?: string | null;
|
|
14
|
+
includeJson?: boolean | null;
|
|
15
|
+
maxChars?: number | null;
|
|
16
|
+
maxNodes?: number | null;
|
|
17
|
+
};
|
|
18
|
+
type EditInput = {
|
|
19
|
+
readToken: string;
|
|
20
|
+
operations: NoteEditOperation[];
|
|
21
|
+
};
|
|
22
|
+
type Runtime = {
|
|
23
|
+
userId: string;
|
|
24
|
+
};
|
|
25
|
+
export declare const noteContentMcpTools: MCPTool[];
|
|
26
|
+
export declare class NoteContentMcpService {
|
|
27
|
+
#private;
|
|
28
|
+
private readonly getDatabase;
|
|
29
|
+
private readonly now;
|
|
30
|
+
constructor(getDatabase: () => AbstractPowerSyncDatabase, now?: () => number);
|
|
31
|
+
read(input: ReadInput, runtime: Runtime): Promise<{
|
|
32
|
+
range?: {
|
|
33
|
+
json?: TiptapJsonNode[] | undefined;
|
|
34
|
+
nodeRange: string;
|
|
35
|
+
nodeRangeTuple: readonly [number, number];
|
|
36
|
+
format: "dinox-shorthand";
|
|
37
|
+
from: number;
|
|
38
|
+
text: string;
|
|
39
|
+
textHash: string;
|
|
40
|
+
nodeHash: string;
|
|
41
|
+
preferredTarget: {
|
|
42
|
+
nodeRange: string;
|
|
43
|
+
anchorIds: string[];
|
|
44
|
+
expectedTextHash: string;
|
|
45
|
+
expectedNodeHash: string;
|
|
46
|
+
};
|
|
47
|
+
shorthand: string;
|
|
48
|
+
markdown: string;
|
|
49
|
+
textWindow: {
|
|
50
|
+
offset: number;
|
|
51
|
+
length: number;
|
|
52
|
+
total: number;
|
|
53
|
+
nextOffset: number | null;
|
|
54
|
+
};
|
|
55
|
+
shorthandWindow: {
|
|
56
|
+
offset: number;
|
|
57
|
+
length: number;
|
|
58
|
+
total: number;
|
|
59
|
+
nextOffset: number | null;
|
|
60
|
+
};
|
|
61
|
+
markdownWindow: {
|
|
62
|
+
offset: number;
|
|
63
|
+
length: number;
|
|
64
|
+
total: number;
|
|
65
|
+
nextOffset: number | null;
|
|
66
|
+
};
|
|
67
|
+
isTruncated: boolean;
|
|
68
|
+
nextCursor: {
|
|
69
|
+
from: number;
|
|
70
|
+
contentHash: string;
|
|
71
|
+
} | null;
|
|
72
|
+
} | undefined;
|
|
73
|
+
success: boolean;
|
|
74
|
+
hasError: boolean;
|
|
75
|
+
docChanged: boolean;
|
|
76
|
+
document: null;
|
|
77
|
+
noteId: string;
|
|
78
|
+
title: string;
|
|
79
|
+
readToken: string;
|
|
80
|
+
readTokenExpiresAt: string;
|
|
81
|
+
base: {
|
|
82
|
+
contentHash: string;
|
|
83
|
+
updatedAt: string | null;
|
|
84
|
+
version: number | null;
|
|
85
|
+
};
|
|
86
|
+
totalNodes: number;
|
|
87
|
+
totalCharCount: number;
|
|
88
|
+
estimatedTokens: number;
|
|
89
|
+
from: number;
|
|
90
|
+
nodeRange: readonly [number, number];
|
|
91
|
+
format: "dinox-shorthand";
|
|
92
|
+
content: string;
|
|
93
|
+
canReadMore: boolean;
|
|
94
|
+
nextCursor: {
|
|
95
|
+
from: number;
|
|
96
|
+
contentHash: string;
|
|
97
|
+
} | null;
|
|
98
|
+
schema: {
|
|
99
|
+
version: string;
|
|
100
|
+
readFormat: string;
|
|
101
|
+
editProtocol: string;
|
|
102
|
+
operations: ("insertBlocksAfter" | "insertBlocksBefore" | "replaceBlocks" | "deleteBlocks" | "replaceText" | "updateBlockAttrs" | "replaceContainerContent")[];
|
|
103
|
+
};
|
|
104
|
+
readFormatInstructions: string;
|
|
105
|
+
chunks: {
|
|
106
|
+
index: number;
|
|
107
|
+
nodeRange: string;
|
|
108
|
+
anchorIds: string[];
|
|
109
|
+
textPreview: string;
|
|
110
|
+
charCount: number;
|
|
111
|
+
estimatedTokens: number;
|
|
112
|
+
}[];
|
|
113
|
+
blocks: {
|
|
114
|
+
preferredTarget: {
|
|
115
|
+
anchorId: string;
|
|
116
|
+
nodeRange: string;
|
|
117
|
+
expectedTextHash: string;
|
|
118
|
+
expectedNodeHash: string;
|
|
119
|
+
};
|
|
120
|
+
anchorId: string;
|
|
121
|
+
hasStableAnchor: boolean;
|
|
122
|
+
nodeIndex: number;
|
|
123
|
+
nodeRange: string;
|
|
124
|
+
type: string;
|
|
125
|
+
editMode: string;
|
|
126
|
+
level: number | null;
|
|
127
|
+
textPreview: string;
|
|
128
|
+
textHash: string;
|
|
129
|
+
nodeHash: string;
|
|
130
|
+
charCount: number;
|
|
131
|
+
attrs: Record<string, unknown> | undefined;
|
|
132
|
+
}[];
|
|
133
|
+
page: {
|
|
134
|
+
json?: TiptapJsonNode[] | undefined;
|
|
135
|
+
nodeRange: string;
|
|
136
|
+
nodeRangeTuple: readonly [number, number];
|
|
137
|
+
format: "dinox-shorthand";
|
|
138
|
+
from: number;
|
|
139
|
+
text: string;
|
|
140
|
+
textHash: string;
|
|
141
|
+
nodeHash: string;
|
|
142
|
+
preferredTarget: {
|
|
143
|
+
nodeRange: string;
|
|
144
|
+
anchorIds: string[];
|
|
145
|
+
expectedTextHash: string;
|
|
146
|
+
expectedNodeHash: string;
|
|
147
|
+
};
|
|
148
|
+
shorthand: string;
|
|
149
|
+
markdown: string;
|
|
150
|
+
textWindow: {
|
|
151
|
+
offset: number;
|
|
152
|
+
length: number;
|
|
153
|
+
total: number;
|
|
154
|
+
nextOffset: number | null;
|
|
155
|
+
};
|
|
156
|
+
shorthandWindow: {
|
|
157
|
+
offset: number;
|
|
158
|
+
length: number;
|
|
159
|
+
total: number;
|
|
160
|
+
nextOffset: number | null;
|
|
161
|
+
};
|
|
162
|
+
markdownWindow: {
|
|
163
|
+
offset: number;
|
|
164
|
+
length: number;
|
|
165
|
+
total: number;
|
|
166
|
+
nextOffset: number | null;
|
|
167
|
+
};
|
|
168
|
+
isTruncated: boolean;
|
|
169
|
+
nextCursor: {
|
|
170
|
+
from: number;
|
|
171
|
+
contentHash: string;
|
|
172
|
+
} | null;
|
|
173
|
+
};
|
|
174
|
+
}>;
|
|
175
|
+
edit(input: EditInput, runtime: Runtime): Promise<{
|
|
176
|
+
success: boolean;
|
|
177
|
+
hasError: boolean;
|
|
178
|
+
docChanged: boolean;
|
|
179
|
+
document: null;
|
|
180
|
+
saved: boolean;
|
|
181
|
+
noteId: string;
|
|
182
|
+
title: string;
|
|
183
|
+
changed: boolean;
|
|
184
|
+
appliedOperations: number;
|
|
185
|
+
operationResults: {
|
|
186
|
+
operationIndex: number;
|
|
187
|
+
type: "insertBlocksAfter" | "insertBlocksBefore" | "replaceBlocks" | "deleteBlocks" | "replaceText" | "updateBlockAttrs" | "replaceContainerContent";
|
|
188
|
+
success: boolean;
|
|
189
|
+
target: string;
|
|
190
|
+
nodeRange: string;
|
|
191
|
+
error: null;
|
|
192
|
+
}[];
|
|
193
|
+
updatedAt: string | null;
|
|
194
|
+
before: {
|
|
195
|
+
contentHash: string;
|
|
196
|
+
totalNodes: number;
|
|
197
|
+
};
|
|
198
|
+
after: {
|
|
199
|
+
contentHash: string;
|
|
200
|
+
totalNodes: number;
|
|
201
|
+
version: number | null;
|
|
202
|
+
};
|
|
203
|
+
}>;
|
|
204
|
+
}
|
|
205
|
+
export declare function buildNoteContentToolError(error: unknown, operations?: NoteEditOperation[]): {
|
|
206
|
+
success: boolean;
|
|
207
|
+
hasError: boolean;
|
|
208
|
+
docChanged: boolean;
|
|
209
|
+
document: null;
|
|
210
|
+
reason: string;
|
|
211
|
+
error: string;
|
|
212
|
+
shouldRetry: boolean;
|
|
213
|
+
operationResults: {
|
|
214
|
+
operationIndex: number;
|
|
215
|
+
type: "insertBlocksAfter" | "insertBlocksBefore" | "replaceBlocks" | "deleteBlocks" | "replaceText" | "updateBlockAttrs" | "replaceContainerContent";
|
|
216
|
+
success: boolean;
|
|
217
|
+
target: string;
|
|
218
|
+
nodeRange: null;
|
|
219
|
+
error: string;
|
|
220
|
+
}[];
|
|
221
|
+
};
|
|
222
|
+
export {};
|