@dreamlake/dreamlake-cli 0.119.2 → 0.120.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/dist/api/index.d.ts +20 -0
- package/dist/api/workspace.d.ts +10 -0
- package/dist/api/workspace.js +1 -0
- package/dist/cli/folders/index.d.ts +6 -0
- package/dist/cli/folders/index.js +38 -0
- package/dist/cli/help-examples.generated.js +2 -0
- package/dist/cli/version.d.ts +1 -1
- package/dist/cli/version.js +1 -1
- package/package.json +9 -9
package/dist/api/index.d.ts
CHANGED
|
@@ -864,6 +864,16 @@ export declare function createApi(transport: Transport, storageFetch?: typeof fe
|
|
|
864
864
|
delete: (id: string) => Promise<unknown>;
|
|
865
865
|
};
|
|
866
866
|
nodes: {
|
|
867
|
+
move: (nodes: {
|
|
868
|
+
id: string;
|
|
869
|
+
expectedPath: string;
|
|
870
|
+
}[], parentId: string) => Promise<{
|
|
871
|
+
nodes: {
|
|
872
|
+
id: string;
|
|
873
|
+
path: string;
|
|
874
|
+
name: string;
|
|
875
|
+
}[];
|
|
876
|
+
}>;
|
|
867
877
|
list: (query?: import("./workspace.js").NodeTreeQuery) => Promise<unknown>;
|
|
868
878
|
children: (query: import("./workspace.js").NodeTreeQuery) => Promise<import("./workspace.js").NodeChildrenPage>;
|
|
869
879
|
descendants: (id: string, query?: import("./workspace.js").NodeTreeQuery) => Promise<unknown>;
|
|
@@ -2191,6 +2201,16 @@ export declare function createClient(options: ClientOptions): {
|
|
|
2191
2201
|
delete: (id: string) => Promise<unknown>;
|
|
2192
2202
|
};
|
|
2193
2203
|
nodes: {
|
|
2204
|
+
move: (nodes: {
|
|
2205
|
+
id: string;
|
|
2206
|
+
expectedPath: string;
|
|
2207
|
+
}[], parentId: string) => Promise<{
|
|
2208
|
+
nodes: {
|
|
2209
|
+
id: string;
|
|
2210
|
+
path: string;
|
|
2211
|
+
name: string;
|
|
2212
|
+
}[];
|
|
2213
|
+
}>;
|
|
2194
2214
|
list: (query?: import("./workspace.js").NodeTreeQuery) => Promise<unknown>;
|
|
2195
2215
|
children: (query: import("./workspace.js").NodeTreeQuery) => Promise<import("./workspace.js").NodeChildrenPage>;
|
|
2196
2216
|
descendants: (id: string, query?: import("./workspace.js").NodeTreeQuery) => Promise<unknown>;
|
package/dist/api/workspace.d.ts
CHANGED
|
@@ -170,6 +170,16 @@ export interface NodeChildrenPage {
|
|
|
170
170
|
searchMode?: string;
|
|
171
171
|
}
|
|
172
172
|
export declare function nodesApi(t: Transport): {
|
|
173
|
+
move: (nodes: {
|
|
174
|
+
id: string;
|
|
175
|
+
expectedPath: string;
|
|
176
|
+
}[], parentId: string) => Promise<{
|
|
177
|
+
nodes: {
|
|
178
|
+
id: string;
|
|
179
|
+
path: string;
|
|
180
|
+
name: string;
|
|
181
|
+
}[];
|
|
182
|
+
}>;
|
|
173
183
|
list: (query?: NodeTreeQuery) => Promise<unknown>;
|
|
174
184
|
children: (query: NodeTreeQuery) => Promise<NodeChildrenPage>;
|
|
175
185
|
descendants: (id: string, query?: NodeTreeQuery) => Promise<unknown>;
|
package/dist/api/workspace.js
CHANGED
|
@@ -66,6 +66,7 @@ export function projectsApi(t, namespace) {
|
|
|
66
66
|
}
|
|
67
67
|
export function nodesApi(t) {
|
|
68
68
|
return {
|
|
69
|
+
move: (nodes, parentId) => call(t, "POST", "/nodes/move", { nodes, parentId }),
|
|
69
70
|
list: (query = {}) => call(t, "GET", "/nodes", undefined, query),
|
|
70
71
|
children: (query) => call(t, "GET", "/nodes/children", undefined, query),
|
|
71
72
|
descendants: (id, query = {}) => call(t, "GET", `/nodes/${seg(id)}/descendants`, undefined, { ...query, includeArchived: query.includeArchived ?? false }),
|
|
@@ -12,4 +12,10 @@ type Options = ConnOpts & {
|
|
|
12
12
|
export declare function runFoldersList(opts: Options): Promise<number>;
|
|
13
13
|
export declare function runFoldersArchive(id: string, archived: boolean, opts: Options): Promise<number>;
|
|
14
14
|
export declare function registerFoldersCommand(program: Command): void;
|
|
15
|
+
/** File and folder moves share an atomic endpoint; no recursive client copies. */
|
|
16
|
+
export declare function runNodesMove(ids: string[], opts: ConnOpts & {
|
|
17
|
+
to: string;
|
|
18
|
+
json?: boolean;
|
|
19
|
+
}): Promise<number>;
|
|
20
|
+
export declare function registerNodeMoveCommand(command: Command): void;
|
|
15
21
|
export {};
|
|
@@ -61,6 +61,8 @@ export async function runFoldersArchive(id, archived, opts) {
|
|
|
61
61
|
}
|
|
62
62
|
export function registerFoldersCommand(program) {
|
|
63
63
|
const folders = program.command('folders').description('browse folder contents and manage folder archival');
|
|
64
|
+
registerNodeMoveCommand(folders);
|
|
65
|
+
registerNodeMoveCommand(program.command('files').description('move project files without copying stored bytes'));
|
|
64
66
|
withConnFlags(folders.command('list').allowExcessArguments(false))
|
|
65
67
|
.description('list immediate contents of a folder or project root')
|
|
66
68
|
.option('--parent-id <id>', 'folder node id')
|
|
@@ -79,3 +81,39 @@ export function registerFoldersCommand(program) {
|
|
|
79
81
|
.action(async (id, opts) => { process.exitCode = await runFoldersArchive(id, action === 'archive', opts); });
|
|
80
82
|
}
|
|
81
83
|
}
|
|
84
|
+
/** File and folder moves share an atomic endpoint; no recursive client copies. */
|
|
85
|
+
export async function runNodesMove(ids, opts) {
|
|
86
|
+
const c = resolveCtx(opts), token = requireToken(c);
|
|
87
|
+
if (!token)
|
|
88
|
+
return 1;
|
|
89
|
+
if (!ids.length || ids.length > 200 || new Set(ids).size !== ids.length ||
|
|
90
|
+
[...ids, opts.to].some(id => !/^[a-f0-9]{24}$/i.test(id))) {
|
|
91
|
+
fail('Supply 1–200 unique node IDs and a destination folder/project node ID');
|
|
92
|
+
return 1;
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
const transport = memoTransport({ remote: c.remote, token });
|
|
96
|
+
const nodes = [];
|
|
97
|
+
for (const id of ids) {
|
|
98
|
+
const node = await transport.request('GET', `/nodes/${id}`);
|
|
99
|
+
nodes.push({ id, expectedPath: node.path });
|
|
100
|
+
}
|
|
101
|
+
const result = await nodesApi(transport).move(nodes, opts.to);
|
|
102
|
+
if (opts.json)
|
|
103
|
+
emitJson(result);
|
|
104
|
+
else
|
|
105
|
+
process.stdout.write(`Moved ${result.nodes.length} item(s) to ${opts.to}\n`);
|
|
106
|
+
return 0;
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
return report(error);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
export function registerNodeMoveCommand(command) {
|
|
113
|
+
withConnFlags(command.command('move').allowExcessArguments(false))
|
|
114
|
+
.description('atomically move files/folders within their project and Episode; never overwrite')
|
|
115
|
+
.argument('<ids...>', 'file or folder node IDs (at most 200)')
|
|
116
|
+
.requiredOption('--to <id>', 'destination folder, Episode or project node ID')
|
|
117
|
+
.option('--json', 'emit the confirmed node locations')
|
|
118
|
+
.action(async (ids, opts) => { process.exitCode = await runNodesMove(ids, opts); });
|
|
119
|
+
}
|
|
@@ -120,6 +120,8 @@ export const helpExamples = {
|
|
|
120
120
|
"layout apply": "dl layout apply request.json --cdp http://127.0.0.1:9222 --page PAGE_ID --layout LAYOUT_ID",
|
|
121
121
|
"machine": "dl machine self\ndl machine host 0123456789abcdef01234567\ndl machine project 0123456789abcdef01234567",
|
|
122
122
|
"auth identity": "dl auth identity\ndl --identity machine profile\ndl --identity user profile",
|
|
123
|
+
"files move": "dl files move FILE_NODE_ID --to DESTINATION_FOLDER_ID",
|
|
124
|
+
"folders move": "dl folders move FOLDER_NODE_ID --to DESTINATION_FOLDER_ID\ndl folders move FIRST_NODE_ID SECOND_NODE_ID --to PROJECT_NODE_ID --json",
|
|
123
125
|
"memos archive": "dl memos archive MEMO_ID --json\n# With a slug or exact title, select its owning namespace.\ndl memos archive release-plan --namespace acme",
|
|
124
126
|
"memos unarchive": "dl memos unarchive MEMO_ID --json\n# Archived titles and slugs remain resolvable.\ndl memos unarchive release-plan --namespace acme",
|
|
125
127
|
"folders list": "# List immediate contents at a project root or inside a folder.\ndl folders list --project project-slug --namespace acme --include-archived --json\ndl folders list --parent-id FOLDER_ID --include-archived --page 1 --page-size 50",
|
package/dist/cli/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.120.0";
|
package/dist/cli/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dreamlake/dreamlake-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.120.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dreamlake-ai/dreamlake-cli.git"
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"node": ">=18"
|
|
38
38
|
},
|
|
39
39
|
"optionalDependencies": {
|
|
40
|
-
"@dreamlake/dreamlake-cli-darwin-arm64": "0.
|
|
41
|
-
"@dreamlake/dreamlake-cli-darwin-x64": "0.
|
|
42
|
-
"@dreamlake/dreamlake-cli-linux-x64": "0.
|
|
43
|
-
"@dreamlake/dreamlake-cli-linux-arm64": "0.
|
|
44
|
-
"@dreamlake/dreamlake-cli-linux-x64-musl": "0.
|
|
45
|
-
"@dreamlake/dreamlake-cli-linux-arm64-musl": "0.
|
|
46
|
-
"@dreamlake/dreamlake-cli-win32-x64": "0.
|
|
47
|
-
"@dreamlake/dreamlake-cli-win32-arm64": "0.
|
|
40
|
+
"@dreamlake/dreamlake-cli-darwin-arm64": "0.120.0",
|
|
41
|
+
"@dreamlake/dreamlake-cli-darwin-x64": "0.120.0",
|
|
42
|
+
"@dreamlake/dreamlake-cli-linux-x64": "0.120.0",
|
|
43
|
+
"@dreamlake/dreamlake-cli-linux-arm64": "0.120.0",
|
|
44
|
+
"@dreamlake/dreamlake-cli-linux-x64-musl": "0.120.0",
|
|
45
|
+
"@dreamlake/dreamlake-cli-linux-arm64-musl": "0.120.0",
|
|
46
|
+
"@dreamlake/dreamlake-cli-win32-x64": "0.120.0",
|
|
47
|
+
"@dreamlake/dreamlake-cli-win32-arm64": "0.120.0"
|
|
48
48
|
}
|
|
49
49
|
}
|