@dreamlake/dreamlake-cli 0.107.1 → 0.107.2
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/bindrs.d.ts +76 -0
- package/dist/api/bindrs.js +83 -0
- package/dist/api/client.d.ts +3 -0
- package/dist/api/client.js +4 -1
- package/dist/api/common.js +2 -2
- package/dist/api/execution.js +4 -4
- package/dist/api/host-moves.js +2 -2
- package/dist/api/index.d.ts +126 -14
- package/dist/api/memo-facade.js +2 -2
- package/dist/api/memo-reading.js +2 -2
- package/dist/api/memos.js +3 -3
- package/dist/api/native-experiments.js +2 -2
- package/dist/api/platform.js +6 -6
- package/dist/api/sessions.js +5 -5
- package/dist/api/workspace.d.ts +64 -7
- package/dist/api/workspace.js +4 -10
- package/dist/cli/create/index.d.ts +1 -0
- package/dist/cli/create/index.js +23 -9
- package/dist/cli/delete/index.js +13 -4
- package/dist/cli/help-examples.generated.js +2 -0
- package/dist/cli/list/index.js +5 -7
- package/dist/cli/resources.d.ts +2 -0
- package/dist/cli/resources.js +17 -3
- package/dist/cli/self-update/index.js +6 -4
- package/dist/cli/self-update/install.d.ts +5 -1
- package/dist/cli/self-update/install.js +28 -86
- package/dist/cli/self-update/shell-path.d.ts +4 -0
- package/dist/cli/self-update/shell-path.js +135 -0
- package/dist/cli/update/index.js +29 -65
- package/dist/cli/version.d.ts +1 -1
- package/dist/cli/version.js +1 -1
- package/package.json +9 -9
package/dist/cli/update/index.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// Port of dreamlake-py's cli/commands/update.py.
|
|
4
|
-
//
|
|
5
|
-
// bindr — add/remove EPISODES (matched by node-path glob), or tag one
|
|
6
|
-
// NOTE's node in the project (--add-note)
|
|
7
|
-
// dataset — add/remove BINDRS (matched by name glob)
|
|
1
|
+
import { bindrsApi } from "../../api/bindrs.js";
|
|
2
|
+
import { createTransport } from "../../api/client.js";
|
|
8
3
|
import { HttpError, requestJson } from "../client.js";
|
|
9
4
|
import { resolveNamespace, resolveRemote, resolveToken } from "../config.js";
|
|
10
5
|
import { fail, ok, splitCsv } from "../helpers.js";
|
|
11
6
|
import { resolveNote, seg } from "../memos/index.js";
|
|
12
7
|
import { memoProjectNode } from "../memos/move-command.js";
|
|
13
|
-
import { fetchAllBindrs, fetchAllEpisodes, matchBindrs, matchEpisodes, resolveProjectCtx, } from "../resources.js";
|
|
8
|
+
import { fetchAllBindrs, fetchAllEpisodes, matchBindrs, matchEpisodes, resolveProjectCtx, resolveBindr, } from "../resources.js";
|
|
14
9
|
import { formatProject } from "../target.js";
|
|
15
10
|
function nothingToDo(opts) {
|
|
16
11
|
return !opts.add && !opts.remove && !opts.addNote && opts.description === undefined && opts.tags === undefined;
|
|
@@ -51,75 +46,44 @@ export async function runUpdateBindr(name, opts) {
|
|
|
51
46
|
return 1;
|
|
52
47
|
const { s, token, remote } = ctx;
|
|
53
48
|
const proj = formatProject(s);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
49
|
+
try {
|
|
50
|
+
const bindr = await resolveBindr(ctx, name);
|
|
51
|
+
const base = `/bindrs/${seg(bindr.id)}`;
|
|
52
|
+
const api = bindrsApi(createTransport({ remote, token }), s.namespace, s.project);
|
|
53
|
+
const episodes = opts.add || opts.remove
|
|
54
|
+
? await fetchAllEpisodes(remote, s.namespace, s.project, token, { includeArchived: true }) : [];
|
|
55
|
+
const toAdd = opts.add ? matchEpisodes(episodes, opts.add) : [];
|
|
56
|
+
const toRemove = opts.remove ? matchEpisodes(episodes, opts.remove) : [];
|
|
57
|
+
// Resolve every selector before the first write, including combined operations.
|
|
58
|
+
if (opts.add && !toAdd.length)
|
|
59
|
+
throw new Error(`no episodes match '${opts.add}'`);
|
|
60
|
+
if (opts.remove && !toRemove.length)
|
|
61
|
+
throw new Error(`no episodes match '${opts.remove}'`);
|
|
62
|
+
let noteNode;
|
|
63
|
+
if (opts.addNote) {
|
|
62
64
|
const noteId = await resolveNote({ remote, token, ns: s.namespace }, opts.addNote);
|
|
63
65
|
if (!noteId)
|
|
64
66
|
return 1;
|
|
65
|
-
|
|
66
|
-
// Idempotent on the server: re-tagging an already-tagged node changes nothing.
|
|
67
|
-
const res = await requestJson(remote, `/bindrs/${seg(bindr.id)}/members`, {
|
|
68
|
-
method: "POST",
|
|
69
|
-
token,
|
|
70
|
-
json: { nodeId: node.id },
|
|
71
|
-
});
|
|
72
|
-
ok(`Tagged memo '${node.name}' with bindr ${name} → ${res.memberCount ?? "?"} total members`);
|
|
67
|
+
noteNode = await memoProjectNode(remote, token, s.namespace, noteId, s.project);
|
|
73
68
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
if (noteNode) {
|
|
70
|
+
const res = await api.addMember(bindr.id, noteNode.id);
|
|
71
|
+
ok(`Tagged memo '${noteNode.name}' with bindr ${name} → ${res.memberCount} total members`);
|
|
77
72
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (opts.add) {
|
|
82
|
-
const toAdd = matchEpisodes(episodes, opts.add);
|
|
83
|
-
if (toAdd.length === 0) {
|
|
84
|
-
fail(`no episodes match '${opts.add}'`);
|
|
85
|
-
return 1;
|
|
86
|
-
}
|
|
87
|
-
process.stdout.write(`Adding ${toAdd.length} episode(s) matching '${opts.add}':\n`);
|
|
88
|
-
for (const ep of toAdd)
|
|
89
|
-
process.stdout.write(` ${ep.nodePath ?? ep.name ?? ""}\n`);
|
|
90
|
-
const res = await requestJson(remote, `${base}/members`, {
|
|
91
|
-
method: "POST",
|
|
92
|
-
token,
|
|
93
|
-
json: { add: toAdd.map((e) => e.id) },
|
|
94
|
-
});
|
|
95
|
-
ok(`Added ${toAdd.length} → ${res.total ?? "?"} total members`);
|
|
73
|
+
if (toAdd.length) {
|
|
74
|
+
const res = await api.addMembers(bindr.id, toAdd.map(ep => ep.id));
|
|
75
|
+
ok(`Tagged ${res.completedNodeIds.length} episode(s) → ${res.memberCount} total members`);
|
|
96
76
|
}
|
|
97
|
-
if (
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
fail(`no episodes match '${opts.remove}'`);
|
|
101
|
-
return 1;
|
|
102
|
-
}
|
|
103
|
-
process.stdout.write(`Removing ${toRemove.length} episode(s) matching '${opts.remove}':\n`);
|
|
104
|
-
for (const ep of toRemove)
|
|
105
|
-
process.stdout.write(` ${ep.nodePath ?? ep.name ?? ""}\n`);
|
|
106
|
-
const res = await requestJson(remote, `${base}/members`, {
|
|
107
|
-
method: "DELETE",
|
|
108
|
-
token,
|
|
109
|
-
json: { remove: toRemove.map((e) => e.id) },
|
|
110
|
-
});
|
|
111
|
-
ok(`Removed ${toRemove.length} → ${res.total ?? "?"} total members`);
|
|
77
|
+
if (toRemove.length) {
|
|
78
|
+
const res = await api.removeMembers(bindr.id, toRemove.map(ep => ep.id));
|
|
79
|
+
ok(`Untagged ${res.completedNodeIds.length} episode(s) → ${res.memberCount} total members`);
|
|
112
80
|
}
|
|
81
|
+
return (await patchMetadata(remote, base, token, opts, "bindr", name, proj)) ? 0 : 1;
|
|
113
82
|
}
|
|
114
83
|
catch (err) {
|
|
115
|
-
if (err instanceof HttpError && err.status === 404) {
|
|
116
|
-
fail(`bindr '${name}' not found in ${proj}`);
|
|
117
|
-
return 1;
|
|
118
|
-
}
|
|
119
84
|
fail(err.message);
|
|
120
85
|
return 1;
|
|
121
86
|
}
|
|
122
|
-
return (await patchMetadata(remote, base, token, opts, "bindr", name, proj)) ? 0 : 1;
|
|
123
87
|
}
|
|
124
88
|
export async function runUpdateDataset(name, opts) {
|
|
125
89
|
if (!opts.project) {
|
package/dist/cli/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.107.
|
|
1
|
+
export declare const VERSION = "0.107.2";
|
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.107.
|
|
3
|
+
"version": "0.107.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/dreamlake-ai/dreamlake-cli.git"
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"node": ">=18"
|
|
37
37
|
},
|
|
38
38
|
"optionalDependencies": {
|
|
39
|
-
"@dreamlake/dreamlake-cli-darwin-arm64": "0.107.
|
|
40
|
-
"@dreamlake/dreamlake-cli-darwin-x64": "0.107.
|
|
41
|
-
"@dreamlake/dreamlake-cli-linux-x64": "0.107.
|
|
42
|
-
"@dreamlake/dreamlake-cli-linux-arm64": "0.107.
|
|
43
|
-
"@dreamlake/dreamlake-cli-linux-x64-musl": "0.107.
|
|
44
|
-
"@dreamlake/dreamlake-cli-linux-arm64-musl": "0.107.
|
|
45
|
-
"@dreamlake/dreamlake-cli-win32-x64": "0.107.
|
|
46
|
-
"@dreamlake/dreamlake-cli-win32-arm64": "0.107.
|
|
39
|
+
"@dreamlake/dreamlake-cli-darwin-arm64": "0.107.2",
|
|
40
|
+
"@dreamlake/dreamlake-cli-darwin-x64": "0.107.2",
|
|
41
|
+
"@dreamlake/dreamlake-cli-linux-x64": "0.107.2",
|
|
42
|
+
"@dreamlake/dreamlake-cli-linux-arm64": "0.107.2",
|
|
43
|
+
"@dreamlake/dreamlake-cli-linux-x64-musl": "0.107.2",
|
|
44
|
+
"@dreamlake/dreamlake-cli-linux-arm64-musl": "0.107.2",
|
|
45
|
+
"@dreamlake/dreamlake-cli-win32-x64": "0.107.2",
|
|
46
|
+
"@dreamlake/dreamlake-cli-win32-arm64": "0.107.2"
|
|
47
47
|
}
|
|
48
48
|
}
|