@dinoxx/dinox-cli 1.0.18 → 1.0.19
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 -34
- package/dist/cli.js +15 -1
- package/dist/commands/auth/index.d.ts +2 -0
- package/dist/commands/auth/index.js +209 -163
- package/dist/commands/boxes/index.d.ts +2 -0
- package/dist/commands/boxes/index.js +119 -75
- package/dist/commands/boxes/repo.d.ts +8 -0
- package/dist/commands/boxes/repo.js +41 -0
- package/dist/commands/config/index.d.ts +2 -0
- package/dist/commands/config/index.js +85 -36
- package/dist/commands/descriptor/register.d.ts +8 -0
- package/dist/commands/descriptor/register.js +113 -0
- package/dist/commands/descriptor/types.d.ts +37 -0
- package/dist/commands/descriptor/types.js +17 -0
- package/dist/commands/graph/index.d.ts +2 -0
- package/dist/commands/graph/index.js +143 -73
- package/dist/commands/info/index.d.ts +2 -0
- package/dist/commands/info/index.js +41 -14
- package/dist/commands/mcp/index.js +11 -10
- package/dist/commands/mcp/server.js +6 -3
- package/dist/commands/mcp/tools.js +30 -104
- package/dist/commands/mcp/types.d.ts +8 -1
- package/dist/commands/meta/index.d.ts +2 -0
- package/dist/commands/meta/index.js +64 -33
- package/dist/commands/meta/repo.d.ts +6 -0
- package/dist/commands/meta/repo.js +6 -0
- package/dist/commands/notes/actions.d.ts +10 -0
- package/dist/commands/notes/actions.js +403 -0
- package/dist/commands/notes/descriptors.d.ts +4 -0
- package/dist/commands/notes/descriptors.js +250 -0
- package/dist/commands/notes/dryRun.d.ts +31 -0
- package/dist/commands/notes/dryRun.js +130 -0
- package/dist/commands/notes/index.d.ts +2 -51
- package/dist/commands/notes/index.js +2 -581
- package/dist/commands/notes/repo.d.ts +9 -0
- package/dist/commands/notes/repo.js +56 -10
- package/dist/commands/notes/runtime.d.ts +28 -0
- package/dist/commands/notes/runtime.js +185 -0
- package/dist/commands/notes/searchOutput.d.ts +10 -2
- package/dist/commands/notes/searchOutput.js +14 -2
- package/dist/commands/notes/searchResponse.d.ts +51 -0
- package/dist/commands/notes/searchResponse.js +56 -0
- package/dist/commands/notes/searchSql.js +2 -0
- package/dist/commands/prompt/index.d.ts +2 -0
- package/dist/commands/prompt/index.js +122 -72
- package/dist/commands/prompt/repo.d.ts +7 -0
- package/dist/commands/prompt/repo.js +46 -0
- package/dist/commands/schema/commandMetadata.d.ts +2 -0
- package/dist/commands/schema/commandMetadata.js +18 -0
- package/dist/commands/schema/globalOptions.d.ts +3 -0
- package/dist/commands/schema/globalOptions.js +3 -0
- package/dist/commands/schema/index.d.ts +4 -0
- package/dist/commands/schema/index.js +109 -0
- package/dist/commands/schema/renderSkills.d.ts +6 -0
- package/dist/commands/schema/renderSkills.js +216 -0
- package/dist/commands/schema/spec.d.ts +6 -0
- package/dist/commands/schema/spec.js +40 -0
- package/dist/commands/schema/types.d.ts +47 -0
- package/dist/commands/schema/types.js +1 -0
- package/dist/commands/storage/index.d.ts +4 -0
- package/dist/commands/storage/index.js +292 -0
- package/dist/commands/storage/repo.d.ts +162 -0
- package/dist/commands/storage/repo.js +751 -0
- package/dist/commands/sync.d.ts +2 -0
- package/dist/commands/sync.js +41 -27
- package/dist/commands/tags/index.d.ts +2 -0
- package/dist/commands/tags/index.js +121 -79
- package/dist/commands/tags/repo.d.ts +7 -0
- package/dist/commands/tags/repo.js +52 -0
- package/dist/commands/todo/dryRun.d.ts +23 -0
- package/dist/commands/todo/dryRun.js +133 -0
- package/dist/commands/todo/index.d.ts +2 -0
- package/dist/commands/todo/index.js +285 -135
- package/dist/commands/todo/repo.d.ts +11 -0
- package/dist/commands/todo/repo.js +37 -9
- package/dist/commands/update.d.ts +3 -0
- package/dist/commands/update.js +35 -13
- package/dist/commands/writeDryRun.d.ts +62 -0
- package/dist/commands/writeDryRun.js +131 -0
- package/dist/constants/links.d.ts +1 -1
- package/dist/constants/links.js +1 -1
- package/dist/daemon/ensure.js +3 -2
- package/dist/daemon/index.js +17 -15
- package/dist/dinox.js +9 -13
- package/dist/powersync/schema/index.d.ts +27 -0
- package/dist/powersync/schema/index.js +2 -0
- package/dist/powersync/schema/note.d.ts +1 -0
- package/dist/powersync/schema/note.js +1 -0
- package/dist/powersync/schema/projects.d.ts +3 -0
- package/dist/powersync/schema/projects.js +3 -0
- package/dist/powersync/schema/storage.d.ts +24 -0
- package/dist/powersync/schema/storage.js +24 -0
- package/dist/skills/check.d.ts +6 -0
- package/dist/skills/check.js +254 -0
- package/dist/utils/bidlinkCanonicalization.d.ts +2 -0
- package/dist/utils/bidlinkCanonicalization.js +161 -0
- package/dist/utils/dryRun.d.ts +13 -0
- package/dist/utils/dryRun.js +69 -0
- package/dist/utils/output.d.ts +19 -0
- package/dist/utils/output.js +155 -1
- package/dist/utils/terminalSanitization.d.ts +2 -0
- package/dist/utils/terminalSanitization.js +33 -0
- package/dist/utils/tiptapMarkdown.d.ts +4 -1
- package/dist/utils/tiptapMarkdown.js +285 -113
- package/dist/utils/tiptapMarkdownSchema.d.ts +37 -0
- package/dist/utils/tiptapMarkdownSchema.js +577 -0
- package/dist/utils/tiptapMarkdownSchemaUtils.d.ts +74 -0
- package/dist/utils/tiptapMarkdownSchemaUtils.js +394 -0
- package/dist/utils/updateNotice.d.ts +7 -0
- package/dist/utils/updateNotice.js +64 -0
- package/package.json +25 -3
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { AbstractPowerSyncDatabase } from '@powersync/common';
|
|
2
|
+
import type { ResolvedDinoxConfig } from '../../config/types.js';
|
|
3
|
+
import type { DryRunPreview } from '../../utils/dryRun.js';
|
|
4
|
+
export declare function buildNoteCreateDryRunPreview(args: {
|
|
5
|
+
db: AbstractPowerSyncDatabase;
|
|
6
|
+
config: ResolvedDinoxConfig;
|
|
7
|
+
offline: boolean;
|
|
8
|
+
userId: string;
|
|
9
|
+
title: string;
|
|
10
|
+
noteType: 'note' | 'crawl';
|
|
11
|
+
contentMd: string;
|
|
12
|
+
tagsInput: string[];
|
|
13
|
+
zettelBoxNames: string[];
|
|
14
|
+
}): Promise<DryRunPreview>;
|
|
15
|
+
export declare function buildNoteUpdateDryRunPreview(args: {
|
|
16
|
+
db: AbstractPowerSyncDatabase;
|
|
17
|
+
config: ResolvedDinoxConfig;
|
|
18
|
+
offline: boolean;
|
|
19
|
+
ids: string[];
|
|
20
|
+
tagsInput?: string[];
|
|
21
|
+
zettelBoxNames?: string[];
|
|
22
|
+
starred?: boolean;
|
|
23
|
+
commandName: 'dino note update' | 'dino note star' | 'dino note unstar';
|
|
24
|
+
action: 'update_note' | 'star_note' | 'unstar_note';
|
|
25
|
+
}): Promise<DryRunPreview>;
|
|
26
|
+
export declare function buildNoteDeleteDryRunPreview(args: {
|
|
27
|
+
db: AbstractPowerSyncDatabase;
|
|
28
|
+
config: ResolvedDinoxConfig;
|
|
29
|
+
offline: boolean;
|
|
30
|
+
id: string;
|
|
31
|
+
}): Promise<DryRunPreview>;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { convertMarkdownToNoteContent } from '../../utils/tiptapMarkdown.js';
|
|
2
|
+
import { canonicalizeBidlinksInMarkdown } from '../../utils/bidlinkCanonicalization.js';
|
|
3
|
+
import { DinoxError } from '../../utils/errors.js';
|
|
4
|
+
import { assertNotesUpdatable, getNoteDetails, parseStoredTags, resolveZettelBoxIdsForCreate, resolveZettelBoxIdsForUpdate, validateTagsForCreate, validateTagsForUpdate, } from './repo.js';
|
|
5
|
+
function normalizeDistinctStrings(values) {
|
|
6
|
+
return Array.from(new Set(values.map((value) => value.trim()).filter(Boolean)));
|
|
7
|
+
}
|
|
8
|
+
function normalizeLowerSet(values) {
|
|
9
|
+
return normalizeDistinctStrings(values).map((value) => value.toLowerCase()).sort();
|
|
10
|
+
}
|
|
11
|
+
function sameNormalizedSet(left, right) {
|
|
12
|
+
const leftNormalized = normalizeLowerSet(left);
|
|
13
|
+
const rightNormalized = normalizeLowerSet(right);
|
|
14
|
+
if (leftNormalized.length !== rightNormalized.length) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
return leftNormalized.every((value, index) => value === rightNormalized[index]);
|
|
18
|
+
}
|
|
19
|
+
function buildExecutionWarnings(config, offline) {
|
|
20
|
+
const warnings = [];
|
|
21
|
+
if (offline) {
|
|
22
|
+
warnings.push('Execution would run in offline mode and only use the local cache.');
|
|
23
|
+
}
|
|
24
|
+
if (!offline && !config.powersync.uploadBaseUrl) {
|
|
25
|
+
warnings.push('Execution would be local-only because powersync.uploadBaseUrl is unset.');
|
|
26
|
+
}
|
|
27
|
+
return warnings;
|
|
28
|
+
}
|
|
29
|
+
export async function buildNoteCreateDryRunPreview(args) {
|
|
30
|
+
const canonicalContentMd = await canonicalizeBidlinksInMarkdown(args.db, args.contentMd, args.userId);
|
|
31
|
+
const { contentText } = convertMarkdownToNoteContent(canonicalContentMd);
|
|
32
|
+
const tags = await validateTagsForCreate(args.db, args.tagsInput);
|
|
33
|
+
await resolveZettelBoxIdsForCreate(args.db, args.zettelBoxNames);
|
|
34
|
+
return {
|
|
35
|
+
dry_run: true,
|
|
36
|
+
command: 'dino note create',
|
|
37
|
+
action: 'create_note',
|
|
38
|
+
risk: 'write',
|
|
39
|
+
summary: `Create a ${args.noteType} note titled "${args.title}".`,
|
|
40
|
+
warnings: buildExecutionWarnings(args.config, args.offline),
|
|
41
|
+
inputs: {
|
|
42
|
+
title: args.title,
|
|
43
|
+
type: args.noteType,
|
|
44
|
+
tags,
|
|
45
|
+
boxes: normalizeDistinctStrings(args.zettelBoxNames),
|
|
46
|
+
content_chars: args.contentMd.length,
|
|
47
|
+
canonicalized_content_chars: canonicalContentMd.length,
|
|
48
|
+
markdown_changed: canonicalContentMd !== args.contentMd,
|
|
49
|
+
},
|
|
50
|
+
changes: {
|
|
51
|
+
title: args.title,
|
|
52
|
+
type: args.noteType,
|
|
53
|
+
tags,
|
|
54
|
+
boxes: normalizeDistinctStrings(args.zettelBoxNames),
|
|
55
|
+
content_preview: contentText.slice(0, 200),
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export async function buildNoteUpdateDryRunPreview(args) {
|
|
60
|
+
await assertNotesUpdatable(args.db, args.ids);
|
|
61
|
+
const nextTags = Array.isArray(args.tagsInput)
|
|
62
|
+
? await validateTagsForUpdate(args.db, args.tagsInput)
|
|
63
|
+
: undefined;
|
|
64
|
+
if (Array.isArray(args.zettelBoxNames)) {
|
|
65
|
+
await resolveZettelBoxIdsForUpdate(args.db, args.zettelBoxNames);
|
|
66
|
+
}
|
|
67
|
+
const details = await getNoteDetails(args.db, args.ids);
|
|
68
|
+
const changes = details.map((note) => {
|
|
69
|
+
const currentTags = parseStoredTags(note.tags);
|
|
70
|
+
const nextBoxes = Array.isArray(args.zettelBoxNames) ? normalizeDistinctStrings(args.zettelBoxNames) : note.zettel_boxes;
|
|
71
|
+
const tagsTo = nextTags ?? currentTags;
|
|
72
|
+
const starredTo = typeof args.starred === 'boolean' ? args.starred : note.is_starred;
|
|
73
|
+
return {
|
|
74
|
+
id: note.id,
|
|
75
|
+
title: note.title ?? '',
|
|
76
|
+
tags_from: currentTags,
|
|
77
|
+
tags_to: tagsTo,
|
|
78
|
+
tags_changed: Array.isArray(args.tagsInput) ? !sameNormalizedSet(currentTags, tagsTo) : false,
|
|
79
|
+
boxes_from: note.zettel_boxes,
|
|
80
|
+
boxes_to: nextBoxes,
|
|
81
|
+
boxes_changed: Array.isArray(args.zettelBoxNames) ? !sameNormalizedSet(note.zettel_boxes, nextBoxes) : false,
|
|
82
|
+
starred_from: note.is_starred,
|
|
83
|
+
starred_to: starredTo,
|
|
84
|
+
starred_changed: typeof args.starred === 'boolean' ? note.is_starred !== starredTo : false,
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
const changedCount = changes.filter((item) => item.tags_changed || item.boxes_changed || item.starred_changed).length;
|
|
88
|
+
return {
|
|
89
|
+
dry_run: true,
|
|
90
|
+
command: args.commandName,
|
|
91
|
+
action: args.action,
|
|
92
|
+
risk: 'write',
|
|
93
|
+
summary: `Preview ${args.action.replace(/_/g, ' ')} for ${args.ids.length} note(s); ${changedCount} note(s) would change.`,
|
|
94
|
+
warnings: buildExecutionWarnings(args.config, args.offline),
|
|
95
|
+
inputs: {
|
|
96
|
+
ids: args.ids,
|
|
97
|
+
...(Array.isArray(args.tagsInput) ? { tags: nextTags } : {}),
|
|
98
|
+
...(Array.isArray(args.zettelBoxNames) ? { boxes: normalizeDistinctStrings(args.zettelBoxNames) } : {}),
|
|
99
|
+
...(typeof args.starred === 'boolean' ? { starred: args.starred } : {}),
|
|
100
|
+
},
|
|
101
|
+
targets: changes.map((item) => ({ id: item.id, title: item.title })),
|
|
102
|
+
changes,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export async function buildNoteDeleteDryRunPreview(args) {
|
|
106
|
+
const details = await getNoteDetails(args.db, [args.id]);
|
|
107
|
+
const note = details[0];
|
|
108
|
+
if (!note) {
|
|
109
|
+
throw new DinoxError(`Note not found: ${args.id}`);
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
dry_run: true,
|
|
113
|
+
command: 'dino note delete',
|
|
114
|
+
action: 'delete_note',
|
|
115
|
+
risk: 'high-risk-write',
|
|
116
|
+
summary: `Soft-delete note "${note.title ?? ''}" (${note.id}).`,
|
|
117
|
+
warnings: buildExecutionWarnings(args.config, args.offline),
|
|
118
|
+
targets: [
|
|
119
|
+
{
|
|
120
|
+
id: note.id,
|
|
121
|
+
title: note.title ?? '',
|
|
122
|
+
is_del: note.is_del,
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
changes: {
|
|
126
|
+
is_del_from: note.is_del ?? 0,
|
|
127
|
+
is_del_to: 1,
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
@@ -1,51 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
type NoteSearchResponse = {
|
|
4
|
-
meta: {
|
|
5
|
-
query: string;
|
|
6
|
-
returned_count: number;
|
|
7
|
-
total_count: number;
|
|
8
|
-
stale: boolean;
|
|
9
|
-
pagination: {
|
|
10
|
-
limit: number | null;
|
|
11
|
-
offset: number;
|
|
12
|
-
has_more: boolean;
|
|
13
|
-
};
|
|
14
|
-
fields: NoteSearchField[] | null;
|
|
15
|
-
applied_filters: {
|
|
16
|
-
include_deleted: boolean;
|
|
17
|
-
tags_expression: string | null;
|
|
18
|
-
created_at_range: {
|
|
19
|
-
from: string | null;
|
|
20
|
-
to: string | null;
|
|
21
|
-
} | null;
|
|
22
|
-
days: number | null;
|
|
23
|
-
box_names: string[];
|
|
24
|
-
box_ids: string[];
|
|
25
|
-
match_empty_boxes: boolean;
|
|
26
|
-
sql_expression: string | null;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
notes: NoteSearchResultItem[];
|
|
30
|
-
};
|
|
31
|
-
type BuildNoteSearchResponseInput = {
|
|
32
|
-
query: string;
|
|
33
|
-
notes: NoteSearchResultItem[];
|
|
34
|
-
totalCount: number;
|
|
35
|
-
stale: boolean;
|
|
36
|
-
includeDeleted: boolean;
|
|
37
|
-
limit?: number;
|
|
38
|
-
offset?: number;
|
|
39
|
-
fields?: NoteSearchField[];
|
|
40
|
-
tagsExpression?: string;
|
|
41
|
-
createdAtFrom?: string;
|
|
42
|
-
createdAtTo?: string;
|
|
43
|
-
days?: number;
|
|
44
|
-
boxNames: string[];
|
|
45
|
-
boxIds: string[];
|
|
46
|
-
matchEmptyBoxes: boolean;
|
|
47
|
-
sqlExpression?: string;
|
|
48
|
-
};
|
|
49
|
-
export declare function buildNoteSearchResponse(input: BuildNoteSearchResponseInput): NoteSearchResponse;
|
|
50
|
-
export declare function registerNoteCommands(program: Command): void;
|
|
51
|
-
export {};
|
|
1
|
+
export { buildNoteSearchResponse, type BuildNoteSearchResponseInput, type NoteSearchResponse, } from './searchResponse.js';
|
|
2
|
+
export { noteCommandGroup, registerNoteCommands } from './descriptors.js';
|