@dreamlake/dreamlake-cli 0.121.1 → 0.122.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/annotations.d.ts +43 -0
- package/dist/api/annotations.js +10 -0
- package/dist/api/index.d.ts +15 -0
- package/dist/api/index.js +3 -0
- package/dist/cli/annotation/index.d.ts +11 -0
- package/dist/cli/annotation/index.js +83 -0
- package/dist/cli/help-examples.generated.js +1 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/version.d.ts +1 -1
- package/dist/cli/version.js +1 -1
- package/package.json +9 -9
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type Transport } from './client.js';
|
|
2
|
+
export interface AnnotationSummary {
|
|
3
|
+
id: string;
|
|
4
|
+
/** Immutable storage identity. */
|
|
5
|
+
name: string;
|
|
6
|
+
title: string | null;
|
|
7
|
+
/** Canonical URL; absent only on older servers. */
|
|
8
|
+
slug?: string;
|
|
9
|
+
slugRevision?: number;
|
|
10
|
+
schemaType: string;
|
|
11
|
+
visibility: 'private' | 'public';
|
|
12
|
+
createdAt: string;
|
|
13
|
+
updatedAt: string;
|
|
14
|
+
}
|
|
15
|
+
export interface AnnotationDetail extends AnnotationSummary {
|
|
16
|
+
schemaJson: string | null;
|
|
17
|
+
bucket: string | null;
|
|
18
|
+
permissions?: {
|
|
19
|
+
edit: boolean;
|
|
20
|
+
share: boolean;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export type AnnotationUpdate = {
|
|
24
|
+
title?: string;
|
|
25
|
+
visibility?: 'private' | 'public';
|
|
26
|
+
} & ({
|
|
27
|
+
slug?: never;
|
|
28
|
+
expectedResourceId?: never;
|
|
29
|
+
expectedSlug?: never;
|
|
30
|
+
expectedRevision?: never;
|
|
31
|
+
} | {
|
|
32
|
+
slug: string;
|
|
33
|
+
expectedResourceId: string;
|
|
34
|
+
expectedSlug: string;
|
|
35
|
+
expectedRevision: number;
|
|
36
|
+
});
|
|
37
|
+
export declare function annotationsApi(t: Transport, namespace: string): {
|
|
38
|
+
list: (schemaType?: string) => Promise<{
|
|
39
|
+
annotations: AnnotationSummary[];
|
|
40
|
+
}>;
|
|
41
|
+
get: (name: string, share?: string) => Promise<AnnotationDetail>;
|
|
42
|
+
update: (name: string, input: AnnotationUpdate, share?: string) => Promise<AnnotationDetail>;
|
|
43
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { namespacePath } from './common.js';
|
|
2
|
+
import { seg } from './client.js';
|
|
3
|
+
export function annotationsApi(t, namespace) {
|
|
4
|
+
const base = `${namespacePath(namespace)}/annotations`;
|
|
5
|
+
return {
|
|
6
|
+
list: (schemaType) => t.request('GET', base, { query: { schemaType } }),
|
|
7
|
+
get: (name, share) => t.request('GET', `${base}/${seg(name)}`, { query: { share } }),
|
|
8
|
+
update: (name, input, share) => t.request('PATCH', `${base}/${seg(name)}`, { json: input, query: { share } }),
|
|
9
|
+
};
|
|
10
|
+
}
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './annotations.js';
|
|
1
2
|
import { FileWorkspace } from "./file-workspace.js";
|
|
2
3
|
export * from "./file-workspace.js";
|
|
3
4
|
export * from "./file-source.js";
|
|
@@ -982,6 +983,13 @@ export declare function createApi(transport: Transport, storageFetch?: typeof fe
|
|
|
982
983
|
disable: (id: string, expectedSettingsRevision: number, key: string) => Promise<unknown>;
|
|
983
984
|
delete: (id: string, expectedSettingsRevision: number, key: string) => Promise<unknown>;
|
|
984
985
|
};
|
|
986
|
+
annotations: (namespace: string) => {
|
|
987
|
+
list: (schemaType?: string) => Promise<{
|
|
988
|
+
annotations: import("./annotations.js").AnnotationSummary[];
|
|
989
|
+
}>;
|
|
990
|
+
get: (name: string, share?: string) => Promise<import("./annotations.js").AnnotationDetail>;
|
|
991
|
+
update: (name: string, input: import("./annotations.js").AnnotationUpdate, share?: string) => Promise<import("./annotations.js").AnnotationDetail>;
|
|
992
|
+
};
|
|
985
993
|
artifacts: (namespace: string) => {
|
|
986
994
|
publish: (id: string, input: {
|
|
987
995
|
content: Uint8Array;
|
|
@@ -2319,6 +2327,13 @@ export declare function createClient(options: ClientOptions): {
|
|
|
2319
2327
|
disable: (id: string, expectedSettingsRevision: number, key: string) => Promise<unknown>;
|
|
2320
2328
|
delete: (id: string, expectedSettingsRevision: number, key: string) => Promise<unknown>;
|
|
2321
2329
|
};
|
|
2330
|
+
annotations: (namespace: string) => {
|
|
2331
|
+
list: (schemaType?: string) => Promise<{
|
|
2332
|
+
annotations: import("./annotations.js").AnnotationSummary[];
|
|
2333
|
+
}>;
|
|
2334
|
+
get: (name: string, share?: string) => Promise<import("./annotations.js").AnnotationDetail>;
|
|
2335
|
+
update: (name: string, input: import("./annotations.js").AnnotationUpdate, share?: string) => Promise<import("./annotations.js").AnnotationDetail>;
|
|
2336
|
+
};
|
|
2322
2337
|
artifacts: (namespace: string) => {
|
|
2323
2338
|
publish: (id: string, input: {
|
|
2324
2339
|
content: Uint8Array;
|
package/dist/api/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { annotationsApi } from './annotations.js';
|
|
2
|
+
export * from './annotations.js';
|
|
1
3
|
import { FileWorkspace } from "./file-workspace.js";
|
|
2
4
|
import { SourceFileAdapter } from "./file-source.js";
|
|
3
5
|
export * from "./file-workspace.js";
|
|
@@ -95,6 +97,7 @@ export function createApi(transport, storageFetch = fetch) {
|
|
|
95
97
|
nodes: nodesApi(transport),
|
|
96
98
|
tasks: (namespace, project) => tasksApi(transport, namespace, project),
|
|
97
99
|
connections: (namespace) => connectionsApi(transport, namespace),
|
|
100
|
+
annotations: (namespace) => annotationsApi(transport, namespace),
|
|
98
101
|
artifacts: (namespace) => artifactsApi(transport, namespace),
|
|
99
102
|
scenes: (namespace) => scenesApi(transport, namespace),
|
|
100
103
|
pipelines: (namespace) => pipelinesApi(transport, namespace),
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import { type DreamlakeOpts } from '../compat/ctx.js';
|
|
3
|
+
export declare function runAnnotationUpdate(args: DreamlakeOpts & {
|
|
4
|
+
name: string;
|
|
5
|
+
slug?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
visibility?: string;
|
|
8
|
+
namespace?: string;
|
|
9
|
+
json?: boolean;
|
|
10
|
+
}): Promise<number>;
|
|
11
|
+
export declare function registerAnnotationCommand(program: Command): void;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { createClient } from '../../api/index.js';
|
|
2
|
+
import { resolveCtx } from '../compat/ctx.js';
|
|
3
|
+
import { requireNamespace, requireToken } from '../compat/http.js';
|
|
4
|
+
import { withConnFlags } from '../compat/flags.js';
|
|
5
|
+
import { emitJson, fail, ok } from '../helpers.js';
|
|
6
|
+
export async function runAnnotationUpdate(args) {
|
|
7
|
+
if (args.slug !== undefined && !/^[a-z0-9][a-z0-9._-]{0,63}$/.test(args.slug)) {
|
|
8
|
+
fail('Invalid slug: use 1–64 lowercase letters, digits, dots, underscores or hyphens, starting with a letter or digit.');
|
|
9
|
+
return 1;
|
|
10
|
+
}
|
|
11
|
+
if (args.title === undefined && args.visibility === undefined && args.slug === undefined) {
|
|
12
|
+
fail('Supply --title, --visibility or --slug.');
|
|
13
|
+
return 1;
|
|
14
|
+
}
|
|
15
|
+
if (args.visibility !== undefined && !['private', 'public'].includes(args.visibility)) {
|
|
16
|
+
fail('Visibility must be private or public.');
|
|
17
|
+
return 1;
|
|
18
|
+
}
|
|
19
|
+
const ctx = resolveCtx(args), token = requireToken(ctx);
|
|
20
|
+
if (!token)
|
|
21
|
+
return 1;
|
|
22
|
+
const namespace = await requireNamespace(ctx, args.namespace);
|
|
23
|
+
if (!namespace)
|
|
24
|
+
return 1;
|
|
25
|
+
const api = createClient({ remote: ctx.remote, token }).annotations(namespace);
|
|
26
|
+
try {
|
|
27
|
+
let input = { ...(args.title !== undefined ? { title: args.title } : {}),
|
|
28
|
+
...(args.visibility !== undefined ? { visibility: args.visibility } : {}) };
|
|
29
|
+
if (args.slug !== undefined) {
|
|
30
|
+
const row = await api.get(args.name);
|
|
31
|
+
if (!row.id || !row.slug || !Number.isSafeInteger(row.slugRevision)) {
|
|
32
|
+
fail('This server does not support annotation slug rename. No changes made.');
|
|
33
|
+
return 1;
|
|
34
|
+
}
|
|
35
|
+
input = { ...input, slug: args.slug, expectedResourceId: row.id, expectedSlug: row.slug, expectedRevision: row.slugRevision };
|
|
36
|
+
}
|
|
37
|
+
const row = await api.update(args.name, input);
|
|
38
|
+
if (args.json)
|
|
39
|
+
emitJson(row);
|
|
40
|
+
else
|
|
41
|
+
ok(`annotation: ${row.title || row.name} (${row.slug || row.name})`);
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
fail(`${error instanceof Error ? error.message : String(error)}. Re-read the annotation before retrying a conflict or uncertain write.`);
|
|
46
|
+
return 1;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export function registerAnnotationCommand(program) {
|
|
50
|
+
const command = program.command('annotation').alias('annotations').description('read annotation metadata and update titles or URL slugs');
|
|
51
|
+
withConnFlags(command.command('update').argument('<name>', 'current/old URL slug or immutable storage name')
|
|
52
|
+
.option('--namespace <slug>', 'namespace').option('--title <title>', 'display title')
|
|
53
|
+
.option('--slug <slug>', 'canonical URL slug; preserves old links').option('--visibility <visibility>', 'private or public').option('--json'))
|
|
54
|
+
.action(async (name, opts) => { process.exitCode = await runAnnotationUpdate({ ...opts, name }); });
|
|
55
|
+
withConnFlags(command.command('rename').argument('<name>', 'current/old URL slug or immutable storage name').argument('<slug>', 'new canonical URL slug')
|
|
56
|
+
.option('--namespace <slug>', 'namespace').option('--json'))
|
|
57
|
+
.action(async (name, slug, opts) => { process.exitCode = await runAnnotationUpdate({ ...opts, name, slug }); });
|
|
58
|
+
for (const operation of ['list', 'get']) {
|
|
59
|
+
const sub = command.command(operation).option('--namespace <slug>', 'namespace');
|
|
60
|
+
if (operation === 'get')
|
|
61
|
+
sub.argument('<name>', 'current/old slug or immutable name');
|
|
62
|
+
withConnFlags(sub).action(async (...params) => {
|
|
63
|
+
const opts = params[operation === 'get' ? 1 : 0], ctx = resolveCtx(opts), token = requireToken(ctx);
|
|
64
|
+
if (!token) {
|
|
65
|
+
process.exitCode = 1;
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const ns = await requireNamespace(ctx, opts.namespace);
|
|
69
|
+
if (!ns) {
|
|
70
|
+
process.exitCode = 1;
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
const api = createClient({ remote: ctx.remote, token }).annotations(ns);
|
|
75
|
+
emitJson(operation === 'get' ? await api.get(params[0]) : await api.list());
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
fail(String(error));
|
|
79
|
+
process.exitCode = 1;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -6,6 +6,7 @@ export const helpExamples = {
|
|
|
6
6
|
"agents show": "dl agents show my_repo.tri --namespace my-workspace",
|
|
7
7
|
"agents edit": "dl agents edit my_repo.tri --namespace my-workspace\n# Browser form: follow the localhost URL printed by the command.\ndl agents edit my_repo.tri --namespace my-workspace --web",
|
|
8
8
|
"telemetry": "dl telemetry disable --quiet\ndl telemetry status\ndl telemetry enable --quiet",
|
|
9
|
+
"annotation": "dl annotation list --namespace team\ndl annotation get original-name --namespace team\ndl annotation update original-name --namespace team --title \"Retail Task Annotation\"\ndl annotation rename original-name retail-task-annotation --namespace team --json",
|
|
9
10
|
"apps": "dl apps list --json\ndl connection oauth create --connector slack-mcp --label \"Work Slack\" --access read\ndl connection oauth create --connector plaud-mcp --label \"My Plaud\" --access read",
|
|
10
11
|
"apps grant": "dl apps grant <connection-id>",
|
|
11
12
|
"apps check": "dl apps check <connection-id> --json",
|
package/dist/cli/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { registerAnnotationCommand } from './annotation/index.js';
|
|
1
2
|
import { registerNamespaceCommand } from "./namespace.js";
|
|
2
3
|
import { registerNymphCommand } from "./nymph/index.js";
|
|
3
4
|
import { collectionList } from "./collection-list.js";
|
|
@@ -262,6 +263,7 @@ async function main(argv) {
|
|
|
262
263
|
//
|
|
263
264
|
// These carry their own --remote/--token/--debug flags; the commands above
|
|
264
265
|
// take their connection from the active login.
|
|
266
|
+
registerAnnotationCommand(program);
|
|
265
267
|
registerArtifactCommand(program);
|
|
266
268
|
registerEnvCommand(program);
|
|
267
269
|
registerLibraryCommand(program);
|
package/dist/cli/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.122.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.122.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.122.0",
|
|
41
|
+
"@dreamlake/dreamlake-cli-darwin-x64": "0.122.0",
|
|
42
|
+
"@dreamlake/dreamlake-cli-linux-x64": "0.122.0",
|
|
43
|
+
"@dreamlake/dreamlake-cli-linux-arm64": "0.122.0",
|
|
44
|
+
"@dreamlake/dreamlake-cli-linux-x64-musl": "0.122.0",
|
|
45
|
+
"@dreamlake/dreamlake-cli-linux-arm64-musl": "0.122.0",
|
|
46
|
+
"@dreamlake/dreamlake-cli-win32-x64": "0.122.0",
|
|
47
|
+
"@dreamlake/dreamlake-cli-win32-arm64": "0.122.0"
|
|
48
48
|
}
|
|
49
49
|
}
|