@dreamlake/dreamlake-cli 0.95.0 → 0.97.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.
@@ -541,8 +541,12 @@ export declare function createApi(transport: Transport): {
541
541
  namespaceSlug: string;
542
542
  permissions: Record<string, boolean>;
543
543
  }>;
544
+ archive: (noteId: string) => Promise<import("./notes.js").NoteRow>;
545
+ unarchive: (noteId: string) => Promise<import("./notes.js").NoteRow>;
544
546
  delete: (noteId: string) => Promise<unknown>;
545
- shared: () => Promise<{
547
+ shared: (query?: {
548
+ includeArchived?: boolean;
549
+ }) => Promise<{
546
550
  notes: import("./notes.js").NoteRow[];
547
551
  }>;
548
552
  projects: (noteId: string, view?: "nodes") => Promise<unknown>;
@@ -646,6 +650,7 @@ export declare function createApi(transport: Transport): {
646
650
  note?: string;
647
651
  cursor?: string;
648
652
  limit?: number;
653
+ includeArchived?: boolean;
649
654
  caseSensitive?: boolean;
650
655
  glob?: string;
651
656
  regex?: string;
@@ -681,10 +686,13 @@ export declare function createApi(transport: Transport): {
681
686
  q?: string;
682
687
  limit?: number;
683
688
  offset?: number;
689
+ includeArchived?: boolean;
684
690
  }) => Promise<{
685
691
  notes: import("./notes.js").NoteRow[];
686
692
  }>;
687
- search: (q: string, limit?: number, offset?: number) => Promise<{
693
+ search: (q: string, limit?: number, offset?: number, options?: {
694
+ includeArchived?: boolean;
695
+ }) => Promise<{
688
696
  notes: import("./notes.js").NoteRow[];
689
697
  total: number;
690
698
  }>;
@@ -736,6 +744,13 @@ export declare function createApi(transport: Transport): {
736
744
  type: string;
737
745
  resourceId: string;
738
746
  }) => Promise<unknown>;
747
+ resourceList: (project: string, query?: import("./workspace.js").NodeTreeQuery) => Promise<{
748
+ resources: import("./workspace.js").ProjectResourceRow[];
749
+ page: number;
750
+ pageSize: number;
751
+ total: number;
752
+ totalPages: number;
753
+ }>;
739
754
  resources: (project: string, kind: "bindrs" | "datasets" | "episodes") => {
740
755
  list: (query?: import("./common.js").Query) => Promise<{
741
756
  [key: string]: unknown;
@@ -776,15 +791,19 @@ export declare function createApi(transport: Transport): {
776
791
  delete: (id: string) => Promise<unknown>;
777
792
  };
778
793
  nodes: {
779
- list: (query?: import("./common.js").Query) => Promise<unknown>;
780
- children: (query: import("./common.js").Query) => Promise<unknown>;
794
+ list: (query?: import("./workspace.js").NodeTreeQuery) => Promise<unknown>;
795
+ children: (query: import("./workspace.js").NodeTreeQuery) => Promise<import("./workspace.js").NodeChildrenPage>;
796
+ descendants: (id: string, query?: import("./workspace.js").NodeTreeQuery) => Promise<unknown>;
797
+ archive: (id: string) => Promise<import("./workspace.js").NodeRow>;
798
+ unarchive: (id: string) => Promise<import("./workspace.js").NodeRow>;
781
799
  lookup: (query: {
782
800
  namespace: string;
783
801
  project: string;
784
802
  path: string;
785
803
  episode?: string;
786
804
  }) => Promise<import("./common.js").Resource>;
787
- contents: (id: string, query?: import("./common.js").Query) => Promise<unknown>;
805
+ episodes: (id: string, query?: import("./workspace.js").NodeTreeQuery) => Promise<unknown>;
806
+ contents: (id: string, query?: import("./workspace.js").NodeTreeQuery) => Promise<unknown>;
788
807
  update: (id: string, input: import("./common.js").JsonObject) => Promise<unknown>;
789
808
  delete: (id: string) => Promise<{
790
809
  deleted?: number;
@@ -1740,8 +1759,12 @@ export declare function createClient(options: ClientOptions): {
1740
1759
  namespaceSlug: string;
1741
1760
  permissions: Record<string, boolean>;
1742
1761
  }>;
1762
+ archive: (noteId: string) => Promise<import("./notes.js").NoteRow>;
1763
+ unarchive: (noteId: string) => Promise<import("./notes.js").NoteRow>;
1743
1764
  delete: (noteId: string) => Promise<unknown>;
1744
- shared: () => Promise<{
1765
+ shared: (query?: {
1766
+ includeArchived?: boolean;
1767
+ }) => Promise<{
1745
1768
  notes: import("./notes.js").NoteRow[];
1746
1769
  }>;
1747
1770
  projects: (noteId: string, view?: "nodes") => Promise<unknown>;
@@ -1845,6 +1868,7 @@ export declare function createClient(options: ClientOptions): {
1845
1868
  note?: string;
1846
1869
  cursor?: string;
1847
1870
  limit?: number;
1871
+ includeArchived?: boolean;
1848
1872
  caseSensitive?: boolean;
1849
1873
  glob?: string;
1850
1874
  regex?: string;
@@ -1880,10 +1904,13 @@ export declare function createClient(options: ClientOptions): {
1880
1904
  q?: string;
1881
1905
  limit?: number;
1882
1906
  offset?: number;
1907
+ includeArchived?: boolean;
1883
1908
  }) => Promise<{
1884
1909
  notes: import("./notes.js").NoteRow[];
1885
1910
  }>;
1886
- search: (q: string, limit?: number, offset?: number) => Promise<{
1911
+ search: (q: string, limit?: number, offset?: number, options?: {
1912
+ includeArchived?: boolean;
1913
+ }) => Promise<{
1887
1914
  notes: import("./notes.js").NoteRow[];
1888
1915
  total: number;
1889
1916
  }>;
@@ -1935,6 +1962,13 @@ export declare function createClient(options: ClientOptions): {
1935
1962
  type: string;
1936
1963
  resourceId: string;
1937
1964
  }) => Promise<unknown>;
1965
+ resourceList: (project: string, query?: import("./workspace.js").NodeTreeQuery) => Promise<{
1966
+ resources: import("./workspace.js").ProjectResourceRow[];
1967
+ page: number;
1968
+ pageSize: number;
1969
+ total: number;
1970
+ totalPages: number;
1971
+ }>;
1938
1972
  resources: (project: string, kind: "bindrs" | "datasets" | "episodes") => {
1939
1973
  list: (query?: import("./common.js").Query) => Promise<{
1940
1974
  [key: string]: unknown;
@@ -1975,15 +2009,19 @@ export declare function createClient(options: ClientOptions): {
1975
2009
  delete: (id: string) => Promise<unknown>;
1976
2010
  };
1977
2011
  nodes: {
1978
- list: (query?: import("./common.js").Query) => Promise<unknown>;
1979
- children: (query: import("./common.js").Query) => Promise<unknown>;
2012
+ list: (query?: import("./workspace.js").NodeTreeQuery) => Promise<unknown>;
2013
+ children: (query: import("./workspace.js").NodeTreeQuery) => Promise<import("./workspace.js").NodeChildrenPage>;
2014
+ descendants: (id: string, query?: import("./workspace.js").NodeTreeQuery) => Promise<unknown>;
2015
+ archive: (id: string) => Promise<import("./workspace.js").NodeRow>;
2016
+ unarchive: (id: string) => Promise<import("./workspace.js").NodeRow>;
1980
2017
  lookup: (query: {
1981
2018
  namespace: string;
1982
2019
  project: string;
1983
2020
  path: string;
1984
2021
  episode?: string;
1985
2022
  }) => Promise<import("./common.js").Resource>;
1986
- contents: (id: string, query?: import("./common.js").Query) => Promise<unknown>;
2023
+ episodes: (id: string, query?: import("./workspace.js").NodeTreeQuery) => Promise<unknown>;
2024
+ contents: (id: string, query?: import("./workspace.js").NodeTreeQuery) => Promise<unknown>;
1987
2025
  update: (id: string, input: import("./common.js").JsonObject) => Promise<unknown>;
1988
2026
  delete: (id: string) => Promise<{
1989
2027
  deleted?: number;
@@ -34,6 +34,8 @@ export interface NoteRow {
34
34
  namespaceSlug?: string;
35
35
  visibility?: string;
36
36
  updatedAt?: string;
37
+ /** Independent lifecycle state; null/missing means active. */
38
+ archivedAt?: string | null;
37
39
  matches?: {
38
40
  anchor: string;
39
41
  title: string;
@@ -151,8 +153,13 @@ export declare function notesApi(t: Transport, namespace: string): {
151
153
  namespaceSlug: string;
152
154
  permissions: Record<string, boolean>;
153
155
  }>;
156
+ /** Archive independently of delete/tags. A saved edit restores the note and its folder path. */
157
+ archive: (noteId: string) => Promise<NoteRow>;
158
+ unarchive: (noteId: string) => Promise<NoteRow>;
154
159
  delete: (noteId: string) => Promise<unknown>;
155
- shared: () => Promise<{
160
+ shared: (query?: {
161
+ includeArchived?: boolean;
162
+ }) => Promise<{
156
163
  notes: NoteRow[];
157
164
  }>;
158
165
  projects: (noteId: string, view?: "nodes") => Promise<unknown>;
@@ -256,6 +263,7 @@ export declare function notesApi(t: Transport, namespace: string): {
256
263
  note?: string;
257
264
  cursor?: string;
258
265
  limit?: number;
266
+ includeArchived?: boolean;
259
267
  caseSensitive?: boolean;
260
268
  glob?: string;
261
269
  regex?: string;
@@ -291,10 +299,13 @@ export declare function notesApi(t: Transport, namespace: string): {
291
299
  q?: string;
292
300
  limit?: number;
293
301
  offset?: number;
302
+ includeArchived?: boolean;
294
303
  }) => Promise<{
295
304
  notes: NoteRow[];
296
305
  }>;
297
- search: (q: string, limit?: number, offset?: number) => Promise<{
306
+ search: (q: string, limit?: number, offset?: number, options?: {
307
+ includeArchived?: boolean;
308
+ }) => Promise<{
298
309
  notes: NoteRow[];
299
310
  total: number;
300
311
  }>;
package/dist/api/notes.js CHANGED
@@ -60,11 +60,17 @@ export function notesApi(t, namespace) {
60
60
  resolve: async (ref) => {
61
61
  if (/^[a-f0-9]{24}$/i.test(ref))
62
62
  return ref;
63
- const result = await t.request('GET', base, { query: { limit: 200 } });
64
- const hit = result.notes.find(row => row.slug === ref || row.id === ref || row.name === ref);
65
- if (!hit)
66
- throw new ApiError(404, 'note_not_found', { namespace, ref });
67
- return hit.id;
63
+ let offset = 0;
64
+ for (;;) {
65
+ const result = await t.request('GET', base, { query: { limit: 200, offset, includeArchived: true } });
66
+ const hit = result.notes.find(row => row.slug === ref || row.id === ref || row.name === ref);
67
+ if (hit)
68
+ return hit.id;
69
+ offset += result.notes.length;
70
+ if (!result.notes.length || (result.total === undefined ? result.notes.length < 200 : offset >= result.total))
71
+ break;
72
+ }
73
+ throw new ApiError(404, 'note_not_found', { namespace, ref });
68
74
  },
69
75
  /** CSS inspection is read-only; selectText publishes a separate agent selection. */
70
76
  selectElement: async (noteId, css) => {
@@ -113,8 +119,11 @@ export function notesApi(t, namespace) {
113
119
  };
114
120
  },
115
121
  get: (noteId) => t.request("GET", `/notes/${id(noteId)}`),
122
+ /** Archive independently of delete/tags. A saved edit restores the note and its folder path. */
123
+ archive: (noteId) => t.request("PATCH", `${base}/${id(noteId)}`, { json: { archived: true } }),
124
+ unarchive: (noteId) => t.request("PATCH", `${base}/${id(noteId)}`, { json: { archived: false } }),
116
125
  delete: (noteId) => t.request("DELETE", `${base}/${id(noteId)}`),
117
- shared: () => t.request("GET", "/me/notes/shared"),
126
+ shared: (query = {}) => t.request("GET", "/me/notes/shared", { query }),
118
127
  projects: (noteId, view) => t.request("GET", `/namespaces/${seg(namespace)}/resources/note/${id(noteId)}/projects`, { query: { view } }),
119
128
  move: (noteId, input) => t.request("POST", `${base}/${id(noteId)}/move`, { json: input }),
120
129
  share: (noteId) => sharingApi(t, namespace, "notes", id(noteId)),
@@ -172,8 +181,8 @@ export function notesApi(t, namespace) {
172
181
  versions: (noteId, query = {}) => t.request("GET", `${base}/${id(noteId)}/versions`, { query }),
173
182
  version: (noteId, versionId) => t.request("GET", `${base}/${id(noteId)}/versions/${seg(versionId)}`),
174
183
  list: (query = {}) => t.request("GET", base, { query }),
175
- search: (q, limit = 50, offset = 0) => t.request("GET", base, {
176
- query: { q, limit, offset },
184
+ search: (q, limit = 50, offset = 0, options = {}) => t.request("GET", base, {
185
+ query: { q, limit, offset, ...options },
177
186
  }),
178
187
  body: (noteId) => t.request("GET", `${base}/${id(noteId)}/body`),
179
188
  sections: (noteId) => t.request("GET", `${base}/${id(noteId)}/sections`),
@@ -26,6 +26,14 @@ export declare function projectsApi(t: Transport, namespace: string): {
26
26
  type: string;
27
27
  resourceId: string;
28
28
  }) => Promise<unknown>;
29
+ /** Mixed project resources, or one bindr's members via the bindr filter. */
30
+ resourceList: (project: string, query?: NodeTreeQuery) => Promise<{
31
+ resources: ProjectResourceRow[];
32
+ page: number;
33
+ pageSize: number;
34
+ total: number;
35
+ totalPages: number;
36
+ }>;
29
37
  resources: (project: string, kind: "bindrs" | "datasets" | "episodes") => {
30
38
  list: (query?: Query) => Promise<{
31
39
  [key: string]: unknown;
@@ -65,16 +73,47 @@ export declare function projectsApi(t: Transport, namespace: string): {
65
73
  update: (id: string, input: Partial<ProjectInput>) => Promise<Resource>;
66
74
  delete: (id: string) => Promise<unknown>;
67
75
  };
76
+ export interface ProjectResourceRow {
77
+ nodeId: string;
78
+ name: string;
79
+ kind: string;
80
+ archivedAt?: string | null;
81
+ [key: string]: unknown;
82
+ }
83
+ export interface NodeRow extends Resource {
84
+ name?: string;
85
+ kind?: string;
86
+ archivedAt?: string | null;
87
+ }
88
+ export type NodeTreeQuery = Query & {
89
+ includeArchived?: boolean;
90
+ };
91
+ export interface NodeChildrenPage {
92
+ nodes: NodeRow[];
93
+ page?: number;
94
+ pageSize?: number;
95
+ total?: number;
96
+ totalPages?: number;
97
+ /** Recursive search uses cursors rather than page numbers. */
98
+ nextCursor?: string | null;
99
+ hasMore?: boolean;
100
+ searchMode?: string;
101
+ }
68
102
  export declare function nodesApi(t: Transport): {
69
- list: (query?: Query) => Promise<unknown>;
70
- children: (query: Query) => Promise<unknown>;
103
+ list: (query?: NodeTreeQuery) => Promise<unknown>;
104
+ children: (query: NodeTreeQuery) => Promise<NodeChildrenPage>;
105
+ descendants: (id: string, query?: NodeTreeQuery) => Promise<unknown>;
106
+ /** Only folder nodes are archivable; the server enforces kind and write access. */
107
+ archive: (id: string) => Promise<NodeRow>;
108
+ unarchive: (id: string) => Promise<NodeRow>;
71
109
  lookup: (query: {
72
110
  namespace: string;
73
111
  project: string;
74
112
  path: string;
75
113
  episode?: string;
76
114
  }) => Promise<Resource>;
77
- contents: (id: string, query?: Query) => Promise<unknown>;
115
+ episodes: (id: string, query?: NodeTreeQuery) => Promise<unknown>;
116
+ contents: (id: string, query?: NodeTreeQuery) => Promise<unknown>;
78
117
  update: (id: string, input: JsonObject) => Promise<unknown>;
79
118
  delete: (id: string) => Promise<{
80
119
  deleted?: number;
@@ -44,6 +44,8 @@ export function projectsApi(t, namespace) {
44
44
  resourceId: input.resourceId,
45
45
  });
46
46
  },
47
+ /** Mixed project resources, or one bindr's members via the bindr filter. */
48
+ resourceList: (project, query = {}) => call(t, "GET", path(project) + "/resources", undefined, query),
47
49
  resources: (project, kind) => resourceApi(t, path(project) + "/" + kind),
48
50
  bindrs: (project) => ({
49
51
  ...resourceApi(t, path(project) + "/bindrs"),
@@ -67,7 +69,12 @@ export function nodesApi(t) {
67
69
  return {
68
70
  list: (query = {}) => call(t, "GET", "/nodes", undefined, query),
69
71
  children: (query) => call(t, "GET", "/nodes/children", undefined, query),
72
+ descendants: (id, query = {}) => call(t, "GET", `/nodes/${seg(id)}/descendants`, undefined, { includeArchived: false, ...query }),
73
+ /** Only folder nodes are archivable; the server enforces kind and write access. */
74
+ archive: (id) => call(t, "PATCH", `/nodes/${seg(id)}`, { archived: true }),
75
+ unarchive: (id) => call(t, "PATCH", `/nodes/${seg(id)}`, { archived: false }),
70
76
  lookup: (query) => call(t, "GET", "/nodes/lookup", undefined, query),
77
+ episodes: (id, query = {}) => call(t, "GET", `/nodes/${seg(id)}/episodes`, undefined, query),
71
78
  contents: (id, query = {}) => call(t, "GET", `/nodes/${seg(id)}/contents`, undefined, query),
72
79
  update: (id, input) => call(t, "PATCH", `/nodes/${seg(id)}`, input),
73
80
  delete: (id) => call(t, "DELETE", `/nodes/${seg(id)}`),
@@ -21,7 +21,7 @@ export async function runCreateBindr(name, opts) {
21
21
  const base = `/namespaces/${s.namespace}/projects/${s.project}/bindrs`;
22
22
  let members = [];
23
23
  if (opts.episode) {
24
- const episodes = await fetchAllEpisodes(remote, s.namespace, s.project, token);
24
+ const episodes = await fetchAllEpisodes(remote, s.namespace, s.project, token, { includeArchived: true });
25
25
  const matched = matchEpisodes(episodes, opts.episode);
26
26
  if (matched.length === 0) {
27
27
  fail(`no episodes match '${opts.episode}'`);
@@ -97,7 +97,7 @@ export async function runDeleteEpisode(name, opts) {
97
97
  return 1;
98
98
  const { s, token, remote } = ctx;
99
99
  const proj = formatProject(s);
100
- const episodes = await fetchAllEpisodes(remote, s.namespace, s.project, token);
100
+ const episodes = await fetchAllEpisodes(remote, s.namespace, s.project, token, { includeArchived: true });
101
101
  const ep = episodes.find((e) => e.name === name);
102
102
  if (!ep) {
103
103
  fail(`episode '${name}' not found in ${proj}`);
@@ -95,7 +95,8 @@ export async function runDownload(opts) {
95
95
  // ── Container (folder / episode / project) — recursive ──────────
96
96
  const outDir = opts.output ?? node.name;
97
97
  const prefix = `${node.path ?? ""}${node.name},`;
98
- const files = await fetchAllContents(remote, token, node.id);
98
+ // An explicit recursive download includes the complete retained subtree.
99
+ const files = await fetchAllContents(remote, token, node.id, undefined, { includeArchived: true });
99
100
  if (files.length === 0) {
100
101
  process.stdout.write(` (no files under ${node.kind} '${node.name}')\n`);
101
102
  return 0;
@@ -0,0 +1,15 @@
1
+ /** Folder lifecycle and browsing use the shared node API. */
2
+ import type { Command } from 'commander';
3
+ import { type ConnOpts } from '../notes/index.js';
4
+ type Options = ConnOpts & {
5
+ json?: boolean;
6
+ project?: string;
7
+ parentId?: string;
8
+ includeArchived?: boolean;
9
+ page?: string;
10
+ pageSize?: string;
11
+ };
12
+ export declare function runFoldersList(opts: Options): Promise<number>;
13
+ export declare function runFoldersArchive(id: string, archived: boolean, opts: Options): Promise<number>;
14
+ export declare function registerFoldersCommand(program: Command): void;
15
+ export {};
@@ -0,0 +1,81 @@
1
+ import { nodesApi } from '../../api/workspace.js';
2
+ import { resolveCtx } from '../compat/ctx.js';
3
+ import { requireToken, requireNamespace } from '../compat/http.js';
4
+ import { withConnFlags } from '../compat/flags.js';
5
+ import { emitJson, fail, renderTable } from '../helpers.js';
6
+ import { noteTransport } from '../notes/api-transport.js';
7
+ import { report } from '../notes/index.js';
8
+ export async function runFoldersList(opts) {
9
+ const c = resolveCtx(opts), token = requireToken(c);
10
+ if (!token)
11
+ return 1;
12
+ try {
13
+ if (!opts.parentId && !opts.project) {
14
+ fail('pass --parent-id or --project (and optionally --namespace)');
15
+ return 1;
16
+ }
17
+ const namespace = opts.parentId ? undefined : await requireNamespace(c, opts.namespace);
18
+ if (!opts.parentId && !namespace)
19
+ return 1;
20
+ const page = Number(opts.page ?? 1), pageSize = Number(opts.pageSize ?? 50);
21
+ if (!Number.isInteger(page) || page < 1 || !Number.isInteger(pageSize) || pageSize < 1 || pageSize > 200) {
22
+ fail('--page must be positive; --page-size must be 1–200');
23
+ return 1;
24
+ }
25
+ const result = await nodesApi(noteTransport({ remote: c.remote, token })).children({
26
+ ...(opts.parentId ? { parentId: opts.parentId } : { namespace: namespace, project: opts.project }),
27
+ page, pageSize, ...(opts.includeArchived ? { includeArchived: true } : {}),
28
+ });
29
+ if (opts.json)
30
+ emitJson(result);
31
+ else {
32
+ process.stdout.write(renderTable(result.nodes.map(n => ({ ID: n.id, NAME: n.name ?? '', KIND: n.kind ?? '', ARCHIVED: n.archivedAt ?? '' })), ['ID', 'NAME', 'KIND', 'ARCHIVED']));
33
+ process.stdout.write(`\nPage ${result.page} of ${result.totalPages} (${result.total} items)\n`);
34
+ }
35
+ return 0;
36
+ }
37
+ catch (error) {
38
+ return report(error);
39
+ }
40
+ }
41
+ export async function runFoldersArchive(id, archived, opts) {
42
+ const c = resolveCtx(opts), token = requireToken(c);
43
+ if (!token)
44
+ return 1;
45
+ if (!/^[a-f0-9]{24}$/i.test(id)) {
46
+ fail('expected a 24-hex folder node id');
47
+ return 1;
48
+ }
49
+ try {
50
+ const api = nodesApi(noteTransport({ remote: c.remote, token }));
51
+ const result = await (archived ? api.archive(id) : api.unarchive(id));
52
+ if (opts.json)
53
+ emitJson(result);
54
+ else
55
+ process.stdout.write(`✓ ${archived ? 'archived' : 'unarchived'} folder ${id}\n`);
56
+ return 0;
57
+ }
58
+ catch (error) {
59
+ return report(error);
60
+ }
61
+ }
62
+ export function registerFoldersCommand(program) {
63
+ const folders = program.command('folders').description('browse folder contents and manage folder archival');
64
+ withConnFlags(folders.command('list').allowExcessArguments(false))
65
+ .description('list immediate contents of a folder or project root')
66
+ .option('--parent-id <id>', 'folder node id')
67
+ .option('--project <slug>', 'project root when no --parent-id is supplied')
68
+ .option('--namespace <slug>', 'project namespace')
69
+ .option('--include-archived', 'include archived items and paths')
70
+ .option('--page <n>', 'page number', '1')
71
+ .option('--page-size <n>', 'items per page (1–200)', '50')
72
+ .option('--json', 'emit nodes and pagination metadata')
73
+ .action(async (opts) => { process.exitCode = await runFoldersList(opts); });
74
+ for (const action of ['archive', 'unarchive']) {
75
+ withConnFlags(folders.command(action).allowExcessArguments(false))
76
+ .description(action === 'archive' ? 'archive a folder without deleting its contents' : 'unarchive a folder and restore its ancestor path')
77
+ .argument('<id>', 'folder node id')
78
+ .option('--json', 'emit updated folder metadata')
79
+ .action(async (id, opts) => { process.exitCode = await runFoldersArchive(id, action === 'archive', opts); });
80
+ }
81
+ }
@@ -43,6 +43,8 @@ export const helpExamples = {
43
43
  "hosts ssh": "dreamlake hosts ssh geyang/dev/worker --duration 1800",
44
44
  "exec": "dreamlake exec geyang/dev/worker -- uname -a\ndreamlake exec geyang/dev/worker --timeout 30 -- sh -c 'printf \"%s\\n\" \"$HOME\"'",
45
45
  "hosts exec": "dreamlake hosts exec geyang/dev/worker -- python3 -c 'print(\"hello\")'",
46
+ "hosts upgrade": "dreamlake hosts upgrade geyang/dev/worker --nymph-version 0.1.32 --dry-run\ndreamlake hosts upgrade geyang/dev/worker --nymph-version 0.1.32\ndreamlake hosts upgrade 'geyang/lab/*' --nymph-version 0.1.32 --concurrency 4 --max-failures 2\ndreamlake hosts upgrade --all --namespace geyang --nymph-version 0.1.32 --json",
47
+ "hosts rollback": "dreamlake hosts rollback geyang/dev/worker\ndreamlake hosts rollback geyang/dev/worker --upgrade-id 20261029-001 --json",
46
48
  "infra list": "dreamlake infra list --namespace fortyfive --project dreamlake-infra --json",
47
49
  "infra status": "dreamlake infra status da8e49cf-1b37-446f-9494-9620faf3192d --json",
48
50
  "infra connect": "dreamlake infra connect da8e49cf-1b37-446f-9494-9620faf3192d",
@@ -65,6 +67,11 @@ export const helpExamples = {
65
67
  "layout apply": "dreamlake layout apply request.json --cdp http://127.0.0.1:9222 --page PAGE_ID --layout LAYOUT_ID",
66
68
  "machine": "dreamlake machine self\ndreamlake machine host 0123456789abcdef01234567\ndreamlake machine project 0123456789abcdef01234567",
67
69
  "auth identity": "dreamlake auth identity\ndreamlake --identity machine profile\ndreamlake --identity user profile",
70
+ "notes archive": "dreamlake notes archive NOTE_ID --json\n# With a slug or exact title, select its owning namespace.\ndreamlake notes archive release-plan --namespace acme",
71
+ "notes unarchive": "dreamlake notes unarchive NOTE_ID --json\n# Archived titles and slugs remain resolvable.\ndreamlake notes unarchive release-plan --namespace acme",
72
+ "folders list": "# List immediate contents at a project root or inside a folder.\ndreamlake folders list --project project-slug --namespace acme --include-archived --json\ndreamlake folders list --parent-id FOLDER_ID --include-archived --page 1 --page-size 50",
73
+ "folders archive": "dreamlake folders archive FOLDER_ID --json",
74
+ "folders unarchive": "dreamlake folders unarchive FOLDER_ID --json",
68
75
  "notes files list": "dreamlake notes files list --note release-plan\ndreamlake notes files list 'assets/*.png' --note release-plan --limit 50\ndreamlake notes files list --note release-plan --json",
69
76
  "notes media upload": "dreamlake notes media upload ./diagram.png\nIMAGE_URL=$(dreamlake notes media upload ./diagram.png)",
70
77
  "notes files write": "dreamlake notes files write config.json --text '{\"enabled\":true}' --note \"$NOTE_ID\" --idempotency-key config-initial-1",
@@ -81,11 +88,11 @@ export const helpExamples = {
81
88
  "notes insert": "dreamlake notes insert --note \"$NOTE_ID\" --ind 0 --text 'Review: ' \\\n --base-revision \"$BASE\" --json\n# ACK is the revision returned by the insertion receipt.\ndreamlake notes read \"$NOTE_ID\" --at \"$ACK\"",
82
89
  "notes delete": "dreamlake notes delete 'obsolete paragraph' --note \"$NOTE_ID\" \\\n --base-revision \"$BASE\" --json\n# Pin verification to the receipt's acknowledged revision.\ndreamlake notes read \"$NOTE_ID\" --at \"$ACK\"",
83
90
  "notes write": "dreamlake notes read \"$NOTE_ID\" --json > baseline.json\nBASE=$(jq -er .revision baseline.json)\njq -jr .content baseline.json > draft.md\n# Edit draft.md without changing the saved original baseline.\ndreamlake notes write \"$NOTE_ID\" --file draft.md --base-revision \"$BASE\" --json\n# ACK is the successful write receipt's revision.\ndreamlake notes read \"$NOTE_ID\" --at \"$ACK\"",
84
- "notes": "# Find a note and read it directly.\ndreamlake notes search \"release plan\"\ndreamlake notes read release-plan\n\n# Preview a unique wording change, apply it, then read back.\ndreamlake notes replace \"Draft checklist\" --text \"Ready for review\" --note release-plan --dry-run\ndreamlake notes replace \"Draft checklist\" --text \"Ready for review\" --note release-plan\ndreamlake notes read release-plan\n\n# Create a private note from a Markdown file.\ndreamlake notes create \"Release plan\" --file release-plan.md",
85
- "notes list": "dreamlake notes list --limit 10\ndreamlake notes list --shared\ndreamlake notes list --namespace acme",
86
- "notes search": "dreamlake notes search \"release plan\"\ndreamlake notes search deploy --namespace acme --json",
91
+ "notes": "# Find a note and read it directly.\ndreamlake notes search \"release plan\"\ndreamlake notes read release-plan\n\n# Preview a unique wording change, apply it, then read back.\ndreamlake notes replace \"Draft checklist\" --text \"Ready for review\" --note release-plan --dry-run\ndreamlake notes replace \"Draft checklist\" --text \"Ready for review\" --note release-plan\ndreamlake notes read release-plan\n\n# Create a private note from a Markdown file.\ndreamlake notes create \"Release plan\" --file release-plan.md\n\n# Cross-interface design (unreleased target APIs; verify installed --help):\n# https://docs.dreamlake.ai/notes/api/",
92
+ "notes list": "dreamlake notes list --limit 10\ndreamlake notes list --shared\ndreamlake notes list --namespace acme\ndreamlake notes list --include-archived",
93
+ "notes search": "dreamlake notes search \"release plan\"\ndreamlake notes search deploy --namespace acme --json\ndreamlake notes search deploy --include-archived",
87
94
  "notes create": "dreamlake notes create \"Release plan\" --text \"Draft checklist\"\nprintf '# Release plan\\n' | dreamlake notes create \"Release plan\" --file - --json",
88
- "notes read": "dreamlake notes read release-plan\ndreamlake notes read release-plan --since \"10 minutes ago\" --format diff\n# Reuse a stable agent identity for this task.\nexport DREAMLAKE_AGENT_ID=release-reviewer-a\nexport DREAMLAKE_AGENT_NAME=\"Release reviewer A\"\ndreamlake notes read release-plan --linger\n# Ctrl-C stops following.\n\nExample notifications:\n+ @alice joined\n+ Reviewer (agent) joined\n* Reviewer (agent) read the note\n* Reviewer (agent) edited the note\n* @alice selected \"## The center\"\n- @alice left",
95
+ "notes read": "dreamlake notes read release-plan\n# Inspect source with generated address hints; do not write the hints back.\ndreamlake notes read release-plan --view markdown\n# Preserve exact source plus revision/hash for a programmatic edit baseline.\ndreamlake notes read release-plan --json > baseline.json\ndreamlake notes read release-plan --since \"10 minutes ago\" --format diff\n# Detailed read design (unreleased target syntax):\n# https://docs.dreamlake.ai/notes/api/reading/\n# Reuse a stable agent identity for this task.\nexport DREAMLAKE_AGENT_ID=release-reviewer-a\nexport DREAMLAKE_AGENT_NAME=\"Release reviewer A\"\ndreamlake notes read release-plan --linger\n# Ctrl-C stops following.\n\nExample notifications:\n+ @alice joined\n+ Reviewer (agent) joined\n* Reviewer (agent) read the note\n* Reviewer (agent) edited the note\n* @alice selected \"## The center\"\n- @alice left",
89
96
  "notes projects": "dreamlake notes projects 000000000000000000000001 --namespace acme",
90
97
  "notes move": "# Standalone cross-namespace Note transfer is unavailable (exit 3).\ndreamlake notes move NOTE_ID --to-namespace my-org --project shared-research --dry-run\n# Add a project association within the note's CURRENT workspace.\ndreamlake notes move NOTE_ID --to-namespace current-workspace --project research --dry-run\n# Apply only an executable same-workspace preview.\ndreamlake notes move NOTE_ID --to-namespace current-workspace --project research\n# Relocate the note to an existing folder of one project (CLI 0.87.0+).\ndreamlake notes move NOTE_ID --namespace acme --project research --folder reports/2026 --dry-run",
91
98
  "notes diff": "NOTE_ID=release-plan\ndreamlake notes read \"$NOTE_ID\" --json > baseline.json\nHASH=$(jq -er .hash baseline.json)\ndreamlake notes diff \"$NOTE_ID\" --since \"$HASH\" --format diff",