@parall/cli 1.65.0 → 1.67.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/commands/apps.d.ts +8 -0
- package/dist/commands/apps.d.ts.map +1 -0
- package/dist/commands/apps.js +173 -0
- package/dist/commands/task-deps.d.ts +32 -0
- package/dist/commands/task-deps.d.ts.map +1 -0
- package/dist/commands/task-deps.js +105 -0
- package/dist/commands/tasks.d.ts.map +1 -1
- package/dist/commands/tasks.js +4 -1
- package/dist/commands/wiki.js +1 -1
- package/dist/index.js +18 -16
- package/dist/lib/output.d.ts +11 -0
- package/dist/lib/output.d.ts.map +1 -1
- package/dist/lib/output.js +51 -4
- package/package.json +4 -4
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
/** Mini App entity: an agent-authored app with its own database
|
|
3
|
+
* (docs/engineering-design/mini-app-design.md). This slice manages the entity
|
|
4
|
+
* and its author roster; the data plane (`db query/exec`), publishing and the
|
|
5
|
+
* scaffold arrive in later slices. Every command answers 404 while the
|
|
6
|
+
* deployment has cap:mini-apps off. */
|
|
7
|
+
export declare function registerAppCommands(program: Command): void;
|
|
8
|
+
//# sourceMappingURL=apps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../src/commands/apps.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC;;;;uCAIuC;AACvC,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,QAuKnD"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { resolveCredentials } from '../lib/client.js';
|
|
2
|
+
import { printError, printJson, printRefHint, stripPrllScheme } from '../lib/output.js';
|
|
3
|
+
/** Mini App entity: an agent-authored app with its own database
|
|
4
|
+
* (docs/engineering-design/mini-app-design.md). This slice manages the entity
|
|
5
|
+
* and its author roster; the data plane (`db query/exec`), publishing and the
|
|
6
|
+
* scaffold arrive in later slices. Every command answers 404 while the
|
|
7
|
+
* deployment has cap:mini-apps off. */
|
|
8
|
+
export function registerAppCommands(program) {
|
|
9
|
+
const app = program
|
|
10
|
+
.command('app')
|
|
11
|
+
.description('Manage Mini Apps (agent-authored apps with their own database)');
|
|
12
|
+
app
|
|
13
|
+
.command('list')
|
|
14
|
+
.description('List Mini Apps in projects you can read')
|
|
15
|
+
.option('--project <projectId>', 'Only apps in this project')
|
|
16
|
+
.option('--include-archived', 'Include archived apps')
|
|
17
|
+
.action(async (opts) => {
|
|
18
|
+
try {
|
|
19
|
+
const { client, orgId } = resolveCredentials();
|
|
20
|
+
const result = await client.getMiniApps(orgId, {
|
|
21
|
+
project_id: opts.project ? stripPrllScheme(opts.project) : undefined,
|
|
22
|
+
include_archived: Boolean(opts.includeArchived),
|
|
23
|
+
});
|
|
24
|
+
printJson(result);
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
printError(err);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
app
|
|
31
|
+
.command('get')
|
|
32
|
+
.description('Get a Mini App by ID')
|
|
33
|
+
.argument('<appId>', 'App ID (app_… or prll://app_…)')
|
|
34
|
+
.action(async (appId) => {
|
|
35
|
+
try {
|
|
36
|
+
const { client, orgId } = resolveCredentials();
|
|
37
|
+
printJson(await client.getMiniApp(orgId, stripPrllScheme(appId)));
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
printError(err);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
app
|
|
44
|
+
.command('create')
|
|
45
|
+
.description('Create a Mini App in a project you are a member of')
|
|
46
|
+
.requiredOption('--project <projectId>', 'Project the app belongs to')
|
|
47
|
+
.requiredOption('--name <name>', 'App name')
|
|
48
|
+
.option('--slug <slug>', 'URL slug (lowercase kebab-case; derived from the name when omitted)')
|
|
49
|
+
.option('--description <text>', 'App description')
|
|
50
|
+
.option('--members-read-only', 'Only authors and project managers may write app data')
|
|
51
|
+
.action(async (opts) => {
|
|
52
|
+
try {
|
|
53
|
+
const { client, orgId } = resolveCredentials();
|
|
54
|
+
const data = {
|
|
55
|
+
project_id: stripPrllScheme(opts.project),
|
|
56
|
+
name: opts.name,
|
|
57
|
+
};
|
|
58
|
+
if (opts.slug)
|
|
59
|
+
data.slug = opts.slug;
|
|
60
|
+
if (opts.description)
|
|
61
|
+
data.description = opts.description;
|
|
62
|
+
if (opts.membersReadOnly)
|
|
63
|
+
data.members_read_only = true;
|
|
64
|
+
const result = await client.createMiniApp(orgId, data);
|
|
65
|
+
printJson(result);
|
|
66
|
+
printRefHint(result.id);
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
printError(err);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
app
|
|
73
|
+
.command('update')
|
|
74
|
+
.description('Update a Mini App (project manager)')
|
|
75
|
+
.argument('<appId>', 'App ID')
|
|
76
|
+
.option('--name <name>', 'New name')
|
|
77
|
+
.option('--description <text>', 'New description (empty string clears)')
|
|
78
|
+
.option('--members-read-only <bool>', 'true = only authors and managers may write app data')
|
|
79
|
+
.action(async (appId, opts) => {
|
|
80
|
+
try {
|
|
81
|
+
const { client, orgId } = resolveCredentials();
|
|
82
|
+
const data = {};
|
|
83
|
+
if (opts.name !== undefined)
|
|
84
|
+
data.name = opts.name;
|
|
85
|
+
if (opts.description !== undefined)
|
|
86
|
+
data.description = opts.description;
|
|
87
|
+
if (opts.membersReadOnly !== undefined) {
|
|
88
|
+
if (opts.membersReadOnly !== 'true' && opts.membersReadOnly !== 'false') {
|
|
89
|
+
throw new Error('--members-read-only must be true or false');
|
|
90
|
+
}
|
|
91
|
+
data.members_read_only = opts.membersReadOnly === 'true';
|
|
92
|
+
}
|
|
93
|
+
if (Object.keys(data).length === 0) {
|
|
94
|
+
throw new Error('Nothing to update: pass at least one of --name, --description, --members-read-only');
|
|
95
|
+
}
|
|
96
|
+
printJson(await client.updateMiniApp(orgId, stripPrllScheme(appId), data));
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
printError(err);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
app
|
|
103
|
+
.command('archive')
|
|
104
|
+
.description('Archive a Mini App (project manager); data and versions are kept')
|
|
105
|
+
.argument('<appId>', 'App ID')
|
|
106
|
+
.action(async (appId) => {
|
|
107
|
+
try {
|
|
108
|
+
const { client, orgId } = resolveCredentials();
|
|
109
|
+
printJson(await client.archiveMiniApp(orgId, stripPrllScheme(appId)));
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
printError(err);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
app
|
|
116
|
+
.command('restore')
|
|
117
|
+
.description('Restore an archived Mini App (project manager)')
|
|
118
|
+
.argument('<appId>', 'App ID')
|
|
119
|
+
.action(async (appId) => {
|
|
120
|
+
try {
|
|
121
|
+
const { client, orgId } = resolveCredentials();
|
|
122
|
+
printJson(await client.restoreMiniApp(orgId, stripPrllScheme(appId)));
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
printError(err);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
const authors = app
|
|
129
|
+
.command('authors')
|
|
130
|
+
.description('Manage who may publish versions and change the app schema');
|
|
131
|
+
authors
|
|
132
|
+
.command('list')
|
|
133
|
+
.description('List the authors of a Mini App')
|
|
134
|
+
.argument('<appId>', 'App ID')
|
|
135
|
+
.action(async (appId) => {
|
|
136
|
+
try {
|
|
137
|
+
const { client, orgId } = resolveCredentials();
|
|
138
|
+
printJson(await client.getMiniAppAuthors(orgId, stripPrllScheme(appId)));
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
printError(err);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
authors
|
|
145
|
+
.command('add')
|
|
146
|
+
.description('Add an author (project manager); the user must be on the project roster')
|
|
147
|
+
.argument('<appId>', 'App ID')
|
|
148
|
+
.argument('<userId>', 'User or agent ID (usr_…)')
|
|
149
|
+
.action(async (appId, userId) => {
|
|
150
|
+
try {
|
|
151
|
+
const { client, orgId } = resolveCredentials();
|
|
152
|
+
printJson(await client.addMiniAppAuthor(orgId, stripPrllScheme(appId), stripPrllScheme(userId)));
|
|
153
|
+
}
|
|
154
|
+
catch (err) {
|
|
155
|
+
printError(err);
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
authors
|
|
159
|
+
.command('remove')
|
|
160
|
+
.description('Remove an author (project manager); the creator cannot be removed')
|
|
161
|
+
.argument('<appId>', 'App ID')
|
|
162
|
+
.argument('<userId>', 'User or agent ID (usr_…)')
|
|
163
|
+
.action(async (appId, userId) => {
|
|
164
|
+
try {
|
|
165
|
+
const { client, orgId } = resolveCredentials();
|
|
166
|
+
await client.removeMiniAppAuthor(orgId, stripPrllScheme(appId), stripPrllScheme(userId));
|
|
167
|
+
console.error(`Removed ${stripPrllScheme(userId)} from the authors of ${stripPrllScheme(appId)}`);
|
|
168
|
+
}
|
|
169
|
+
catch (err) {
|
|
170
|
+
printError(err);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { TaskDependencies, TaskDependencyEdge } from '@parall/sdk';
|
|
2
|
+
import type { Command } from 'commander';
|
|
3
|
+
/** Which side of a "blocks" edge the other task sits on, as named by the
|
|
4
|
+
* flag: `--blocked-by X` means X blocks the task, `--blocks Y` means the task
|
|
5
|
+
* blocks Y. */
|
|
6
|
+
export type DepsDirection = 'blocked_by' | 'blocks';
|
|
7
|
+
export interface DepsTarget {
|
|
8
|
+
direction: DepsDirection;
|
|
9
|
+
otherId: string;
|
|
10
|
+
}
|
|
11
|
+
/** Flag grammar for `tasks deps add/remove`: exactly one of --blocked-by /
|
|
12
|
+
* --blocks names the other task. The flag name carries the direction so the
|
|
13
|
+
* agent never has to infer who blocks whom. Exported for tests. */
|
|
14
|
+
export declare function resolveDepsTarget(opts: {
|
|
15
|
+
blockedBy?: string;
|
|
16
|
+
blocks?: string;
|
|
17
|
+
}): DepsTarget;
|
|
18
|
+
/** The relation row of a "blocks" edge is stored on the blocker side —
|
|
19
|
+
* POST/DELETE go to /tasks/{blocker}/relations. Exported for tests. */
|
|
20
|
+
export declare function resolveDepsEdgeEnds(taskId: string, target: DepsTarget): {
|
|
21
|
+
blockerId: string;
|
|
22
|
+
blockedId: string;
|
|
23
|
+
};
|
|
24
|
+
/** Finds the edge to the other task on the side the direction names.
|
|
25
|
+
* Exported for tests. */
|
|
26
|
+
export declare function findDepsEdge(deps: TaskDependencies, target: DepsTarget): TaskDependencyEdge | undefined;
|
|
27
|
+
/** Task dependency commands (`parall tasks deps …`), a sibling of tasks.ts to
|
|
28
|
+
* respect the file-size ratchet. Registered by registerTaskCommands on the
|
|
29
|
+
* `tasks` command group. Dependencies are `blocks` relations; the flag name
|
|
30
|
+
* gives the direction, so `tasks relations` stays for the other types. */
|
|
31
|
+
export declare function registerTaskDepsCommands(tasks: Command): void;
|
|
32
|
+
//# sourceMappingURL=task-deps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-deps.d.ts","sourceRoot":"","sources":["../../src/commands/task-deps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC;;eAEe;AACf,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,QAAQ,CAAC;AAEpD,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,aAAa,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;mEAEmE;AACnE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,UAAU,CAe3F;AAED;uEACuE;AACvE,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,UAAU,GACjB;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAI1C;AAED;yBACyB;AACzB,wBAAgB,YAAY,CAC1B,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,UAAU,GACjB,kBAAkB,GAAG,SAAS,CAGhC;AAQD;;;0EAG0E;AAC1E,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,QAyEtD"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { resolveCredentials } from '../lib/client.js';
|
|
2
|
+
import { printError, printJson, stripPrllScheme } from '../lib/output.js';
|
|
3
|
+
/** Flag grammar for `tasks deps add/remove`: exactly one of --blocked-by /
|
|
4
|
+
* --blocks names the other task. The flag name carries the direction so the
|
|
5
|
+
* agent never has to infer who blocks whom. Exported for tests. */
|
|
6
|
+
export function resolveDepsTarget(opts) {
|
|
7
|
+
const hasBlockedBy = opts.blockedBy !== undefined;
|
|
8
|
+
const hasBlocks = opts.blocks !== undefined;
|
|
9
|
+
if (hasBlockedBy && hasBlocks) {
|
|
10
|
+
throw new Error('--blocked-by and --blocks are mutually exclusive. Provide exactly one.');
|
|
11
|
+
}
|
|
12
|
+
if (!hasBlockedBy && !hasBlocks) {
|
|
13
|
+
throw new Error('Provide exactly one of --blocked-by <taskId> or --blocks <taskId>.');
|
|
14
|
+
}
|
|
15
|
+
const flag = hasBlockedBy ? '--blocked-by' : '--blocks';
|
|
16
|
+
const otherId = stripPrllScheme(((hasBlockedBy ? opts.blockedBy : opts.blocks) ?? '').trim());
|
|
17
|
+
if (!otherId) {
|
|
18
|
+
throw new Error(`${flag} requires a task ID`);
|
|
19
|
+
}
|
|
20
|
+
return { direction: hasBlockedBy ? 'blocked_by' : 'blocks', otherId };
|
|
21
|
+
}
|
|
22
|
+
/** The relation row of a "blocks" edge is stored on the blocker side —
|
|
23
|
+
* POST/DELETE go to /tasks/{blocker}/relations. Exported for tests. */
|
|
24
|
+
export function resolveDepsEdgeEnds(taskId, target) {
|
|
25
|
+
return target.direction === 'blocked_by'
|
|
26
|
+
? { blockerId: target.otherId, blockedId: taskId }
|
|
27
|
+
: { blockerId: taskId, blockedId: target.otherId };
|
|
28
|
+
}
|
|
29
|
+
/** Finds the edge to the other task on the side the direction names.
|
|
30
|
+
* Exported for tests. */
|
|
31
|
+
export function findDepsEdge(deps, target) {
|
|
32
|
+
const side = target.direction === 'blocked_by' ? deps.blocked_by : deps.blocking;
|
|
33
|
+
return side.find((edge) => edge.task.id === target.otherId);
|
|
34
|
+
}
|
|
35
|
+
function withDirectionFlags(cmd) {
|
|
36
|
+
return cmd
|
|
37
|
+
.option('--blocked-by <taskId>', 'The other task blocks this one (it must finish first)')
|
|
38
|
+
.option('--blocks <taskId>', 'This task blocks the other one (it has to wait)');
|
|
39
|
+
}
|
|
40
|
+
/** Task dependency commands (`parall tasks deps …`), a sibling of tasks.ts to
|
|
41
|
+
* respect the file-size ratchet. Registered by registerTaskCommands on the
|
|
42
|
+
* `tasks` command group. Dependencies are `blocks` relations; the flag name
|
|
43
|
+
* gives the direction, so `tasks relations` stays for the other types. */
|
|
44
|
+
export function registerTaskDepsCommands(tasks) {
|
|
45
|
+
const deps = tasks
|
|
46
|
+
.command('deps')
|
|
47
|
+
.description('Blocking dependencies between tasks (who blocks whom)');
|
|
48
|
+
deps
|
|
49
|
+
.command('list')
|
|
50
|
+
.description('Show what blocks a task (blocked_by) and what it blocks (blocking); a restricted entry is a task you cannot read and names the project to join')
|
|
51
|
+
.argument('<taskId>', 'Task ID')
|
|
52
|
+
.action(async (taskId) => {
|
|
53
|
+
try {
|
|
54
|
+
const { client, orgId } = resolveCredentials();
|
|
55
|
+
const result = await client.getTaskDependencies(orgId, stripPrllScheme(taskId));
|
|
56
|
+
printJson(result);
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
printError(err);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
withDirectionFlags(deps
|
|
63
|
+
.command('add')
|
|
64
|
+
.description('Declare a blocking dependency with exactly one of --blocked-by <id> or --blocks <id>')
|
|
65
|
+
.argument('<taskId>', 'Task ID')).action(async (taskId, opts) => {
|
|
66
|
+
try {
|
|
67
|
+
// Grammar first: a flag error is a parameter error even when
|
|
68
|
+
// credentials are absent, and it must never reach the wire.
|
|
69
|
+
const target = resolveDepsTarget(opts);
|
|
70
|
+
const { blockerId, blockedId } = resolveDepsEdgeEnds(stripPrllScheme(taskId), target);
|
|
71
|
+
const { client, orgId } = resolveCredentials();
|
|
72
|
+
const result = await client.createTaskRelation(orgId, blockerId, {
|
|
73
|
+
target_type: 'task',
|
|
74
|
+
target_id: blockedId,
|
|
75
|
+
relation_type: 'blocks',
|
|
76
|
+
});
|
|
77
|
+
printJson(result);
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
printError(err);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
withDirectionFlags(deps
|
|
84
|
+
.command('remove')
|
|
85
|
+
.description('Remove a blocking dependency (same --blocked-by / --blocks grammar as "tasks deps add")')
|
|
86
|
+
.argument('<taskId>', 'Task ID')).action(async (taskId, opts) => {
|
|
87
|
+
try {
|
|
88
|
+
const target = resolveDepsTarget(opts);
|
|
89
|
+
const normalizedTaskId = stripPrllScheme(taskId);
|
|
90
|
+
const { blockerId } = resolveDepsEdgeEnds(normalizedTaskId, target);
|
|
91
|
+
const { client, orgId } = resolveCredentials();
|
|
92
|
+
const edge = findDepsEdge(await client.getTaskDependencies(orgId, normalizedTaskId), target);
|
|
93
|
+
if (!edge) {
|
|
94
|
+
throw new Error(target.direction === 'blocked_by'
|
|
95
|
+
? `${normalizedTaskId} is not blocked by ${target.otherId} (run "tasks deps list ${normalizedTaskId}" to see its blockers)`
|
|
96
|
+
: `${normalizedTaskId} does not block ${target.otherId} (run "tasks deps list ${normalizedTaskId}" to see what it blocks)`);
|
|
97
|
+
}
|
|
98
|
+
await client.deleteTaskRelation(orgId, blockerId, edge.relation_id);
|
|
99
|
+
printJson({ ok: true });
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
printError(err);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/commands/tasks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,sBAAsB,EAEtB,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../../src/commands/tasks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,sBAAsB,EAEtB,iBAAiB,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA4GpC;+EAC+E;AAC/E,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG;IAClD,WAAW,EAAE,sBAAsB,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;CACnB,CAOA;AAgCD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;;;;;;;;;;;;GAcA;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IACxC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;;YAS0B,iBAAiB,CAAC,QAAQ,CAAC;cACvB,iBAAiB,CAAC,UAAU,CAAC;;;;;;;;;GAU3D;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QA+iBpD"}
|
package/dist/commands/tasks.js
CHANGED
|
@@ -3,6 +3,7 @@ import { createHash } from 'node:crypto';
|
|
|
3
3
|
import { resolveCredentials, resolveTypedDispatchBinding } from '../lib/client.js';
|
|
4
4
|
import { printJson, printError, printRefHint, stripPrllScheme } from '../lib/output.js';
|
|
5
5
|
import { resolveResolutionFlag } from './comments.js';
|
|
6
|
+
import { registerTaskDepsCommands } from './task-deps.js';
|
|
6
7
|
import { BODY_FILE_OPTION_DESC, BODY_OPTION_DESC, DESCRIPTION_FILE_OPTION_DESC, DESCRIPTION_OPTION_DESC, resolveCommentBody, resolveTaskDescription, } from '../lib/text-input.js';
|
|
7
8
|
function stripUndefined(obj) {
|
|
8
9
|
return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== undefined));
|
|
@@ -616,7 +617,7 @@ export function registerTaskCommands(program) {
|
|
|
616
617
|
// ---- Relations ----
|
|
617
618
|
const relations = tasks
|
|
618
619
|
.command('relations')
|
|
619
|
-
.description('Link a task to other entities (blocks / related / duplicate / source / …)');
|
|
620
|
+
.description('Link a task to other entities (blocks / related / duplicate / source / …); for who-blocks-whom between tasks prefer "tasks deps"');
|
|
620
621
|
relations
|
|
621
622
|
.command('add')
|
|
622
623
|
.description('Create a relation from a task to another entity')
|
|
@@ -667,4 +668,6 @@ export function registerTaskCommands(program) {
|
|
|
667
668
|
printError(err);
|
|
668
669
|
}
|
|
669
670
|
});
|
|
671
|
+
// ---- Dependencies (blocks edges; direction given by the flag name) ----
|
|
672
|
+
registerTaskDepsCommands(tasks);
|
|
670
673
|
}
|
package/dist/commands/wiki.js
CHANGED
|
@@ -659,7 +659,7 @@ export function registerWikiCommands(program) {
|
|
|
659
659
|
const result = await ctx.client.getWikiPageIndex(ctx.orgId, wiki.id);
|
|
660
660
|
process.stderr.write(`Wiki: ${result.wiki_name} (${result.wiki_slug}) | ${result.page_count} pages\n\n`);
|
|
661
661
|
for (const page of result.pages) {
|
|
662
|
-
const headings = page.top_headings
|
|
662
|
+
const headings = page.top_headings?.length ? ` — ${page.top_headings.join(', ')}` : '';
|
|
663
663
|
process.stderr.write(` ${page.path} "${page.title}" (${page.section_count} sections, ${page.size_bytes}B)${headings}\n`);
|
|
664
664
|
}
|
|
665
665
|
printJson(result);
|
package/dist/index.js
CHANGED
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { createRequire } from 'module';
|
|
3
2
|
import { Command } from 'commander';
|
|
3
|
+
import { createRequire } from 'module';
|
|
4
4
|
import { registerAgentCommands } from './commands/agents.js';
|
|
5
5
|
import { registerApprovalCommands } from './commands/approvals.js';
|
|
6
|
+
import { registerAppCommands } from './commands/apps.js';
|
|
7
|
+
import { registerBrowserCommands } from './commands/browser.js';
|
|
6
8
|
import { registerChatCommands } from './commands/chats.js';
|
|
7
|
-
import {
|
|
8
|
-
import { registerMessageCommands } from './commands/messages.js';
|
|
9
|
-
import { registerTaskCommands } from './commands/tasks.js';
|
|
9
|
+
import { registerClipCommands } from './commands/clip.js';
|
|
10
10
|
import { registerCommentCommands } from './commands/comments.js';
|
|
11
|
+
import { registerDMCommands } from './commands/dm.js';
|
|
12
|
+
import { registerFileCommands } from './commands/files.js';
|
|
11
13
|
import { registerLabelCommands } from './commands/labels.js';
|
|
12
|
-
import {
|
|
13
|
-
import { registerProfileCommands } from './commands/profile.js';
|
|
14
|
-
import { registerTeamCommands } from './commands/teams.js';
|
|
15
|
-
import { registerScheduleCommands } from './commands/schedules.js';
|
|
16
|
-
import { registerTriggerCommands } from './commands/triggers.js';
|
|
17
|
-
import { registerUserCommands } from './commands/users.js';
|
|
18
|
-
import { registerWikiCommands } from './commands/wiki.js';
|
|
14
|
+
import { registerMachineCommands } from './commands/machines.js';
|
|
19
15
|
import { registerMcpCommands } from './commands/mcp.js';
|
|
16
|
+
import { registerMessageCommands } from './commands/messages.js';
|
|
20
17
|
import { registerNoReplyCommands } from './commands/no-reply.js';
|
|
18
|
+
import { registerProfileCommands } from './commands/profile.js';
|
|
19
|
+
import { registerProjectCommands } from './commands/projects.js';
|
|
21
20
|
import { registerRefCommands } from './commands/refs.js';
|
|
21
|
+
import { registerScheduleCommands } from './commands/schedules.js';
|
|
22
22
|
import { registerSearchCommands } from './commands/search.js';
|
|
23
|
-
import { registerFileCommands } from './commands/files.js';
|
|
24
|
-
import { registerMachineCommands } from './commands/machines.js';
|
|
25
|
-
import { registerBrowserCommands } from './commands/browser.js';
|
|
26
|
-
import { registerClipCommands } from './commands/clip.js';
|
|
27
23
|
import { registerSlackCommands } from './commands/slack.js';
|
|
28
|
-
import {
|
|
24
|
+
import { registerTaskCommands } from './commands/tasks.js';
|
|
25
|
+
import { registerTeamCommands } from './commands/teams.js';
|
|
26
|
+
import { registerTriggerCommands } from './commands/triggers.js';
|
|
27
|
+
import { registerUserCommands } from './commands/users.js';
|
|
29
28
|
import { registerWatchCommands } from './commands/watch.js';
|
|
29
|
+
import { registerWechatCommands } from './commands/wechat.js';
|
|
30
|
+
import { registerWikiCommands } from './commands/wiki.js';
|
|
30
31
|
import { createUpdateNotifier } from './lib/update-check.js';
|
|
31
32
|
const version = typeof __PARALL_CLI_VERSION__ === 'string'
|
|
32
33
|
? __PARALL_CLI_VERSION__
|
|
@@ -45,6 +46,7 @@ registerWatchCommands(program);
|
|
|
45
46
|
registerTaskCommands(program);
|
|
46
47
|
registerCommentCommands(program);
|
|
47
48
|
registerLabelCommands(program);
|
|
49
|
+
registerAppCommands(program);
|
|
48
50
|
registerProjectCommands(program);
|
|
49
51
|
registerProfileCommands(program);
|
|
50
52
|
registerTeamCommands(program);
|
package/dist/lib/output.d.ts
CHANGED
|
@@ -21,5 +21,16 @@ export declare function ensurePrllScheme(idOrUri: string): string;
|
|
|
21
21
|
* than receiving a malformed value.
|
|
22
22
|
*/
|
|
23
23
|
export declare function parsePositiveInt(raw: string | undefined): number | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Plain-text next step for a project-roster denial: a 403 `PERMISSION_DENIED`
|
|
26
|
+
* whose `details.project` names an existing task/project the caller is not on
|
|
27
|
+
* the roster of. The wire carries only facts (id, visibility, key/name); the
|
|
28
|
+
* remediation command is synthesized here from `visibility`, so no command
|
|
29
|
+
* string ever comes from the server. Undefined when `details` does not carry
|
|
30
|
+
* a well-formed project or the visibility is unknown, so the caller falls
|
|
31
|
+
* back to the generic approval guidance.
|
|
32
|
+
* See docs/engineering-design/project-roster-denial-design.md §3.2 / §5
|
|
33
|
+
*/
|
|
34
|
+
export declare function projectRosterNextStep(details: unknown): string | undefined;
|
|
24
35
|
export declare function printError(err: unknown, attemptedPayload?: Record<string, unknown>): never;
|
|
25
36
|
//# sourceMappingURL=output.d.ts.map
|
package/dist/lib/output.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/lib/output.ts"],"names":[],"mappings":"AAEA,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAE7C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAY,GAAG,IAAI,CAEvE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAW5E;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/lib/output.ts"],"names":[],"mappings":"AAEA,wBAAgB,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,CAE7C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,SAAY,GAAG,IAAI,CAEvE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAW5E;AAmBD;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAe1E;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,KAAK,CAqD1F"}
|
package/dist/lib/output.js
CHANGED
|
@@ -43,6 +43,46 @@ export function parsePositiveInt(raw) {
|
|
|
43
43
|
const n = Number(t);
|
|
44
44
|
return Number.isInteger(n) && n > 0 ? n : undefined;
|
|
45
45
|
}
|
|
46
|
+
/** Reads `details.project` off a denial envelope; undefined unless it carries
|
|
47
|
+
* a string `id` and `visibility` (`key` / `name` are omitted for private). */
|
|
48
|
+
function readProjectDenial(details) {
|
|
49
|
+
if (details === null || typeof details !== 'object')
|
|
50
|
+
return undefined;
|
|
51
|
+
const project = details.project;
|
|
52
|
+
if (project === null || typeof project !== 'object')
|
|
53
|
+
return undefined;
|
|
54
|
+
const { id, visibility, key } = project;
|
|
55
|
+
if (typeof id !== 'string' || id === '' || typeof visibility !== 'string')
|
|
56
|
+
return undefined;
|
|
57
|
+
return { id, visibility, key: typeof key === 'string' && key !== '' ? key : undefined };
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Plain-text next step for a project-roster denial: a 403 `PERMISSION_DENIED`
|
|
61
|
+
* whose `details.project` names an existing task/project the caller is not on
|
|
62
|
+
* the roster of. The wire carries only facts (id, visibility, key/name); the
|
|
63
|
+
* remediation command is synthesized here from `visibility`, so no command
|
|
64
|
+
* string ever comes from the server. Undefined when `details` does not carry
|
|
65
|
+
* a well-formed project or the visibility is unknown, so the caller falls
|
|
66
|
+
* back to the generic approval guidance.
|
|
67
|
+
* See docs/engineering-design/project-roster-denial-design.md §3.2 / §5
|
|
68
|
+
*/
|
|
69
|
+
export function projectRosterNextStep(details) {
|
|
70
|
+
const project = readProjectDenial(details);
|
|
71
|
+
if (!project)
|
|
72
|
+
return undefined;
|
|
73
|
+
const label = project.key ?? project.id;
|
|
74
|
+
const ref = `prll://${project.id}`;
|
|
75
|
+
switch (project.visibility) {
|
|
76
|
+
case 'public':
|
|
77
|
+
return `You are not on the roster of project ${label} (public). Join it yourself — project admission is self-service, not the approvals flow, so approvable above does not apply:\n parall projects join ${ref}`;
|
|
78
|
+
case 'restricted':
|
|
79
|
+
return `You are not on the roster of project ${label} (restricted). Request to join it yourself — project admission is self-service, not the approvals flow, so approvable above does not apply; a project manager approves and you receive an approval.decided event:\n parall projects request-join ${ref}`;
|
|
80
|
+
case 'private':
|
|
81
|
+
return 'This belongs to a private project you are not on. Ask a project manager or org owner/admin to add you.';
|
|
82
|
+
default:
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
46
86
|
export function printError(err, attemptedPayload) {
|
|
47
87
|
if (err instanceof ApiError) {
|
|
48
88
|
// Faithful, parseable line: the server's real message + machine anchors.
|
|
@@ -55,10 +95,17 @@ export function printError(err, attemptedPayload) {
|
|
|
55
95
|
...(err.approvable !== undefined ? { approvable: err.approvable } : {}),
|
|
56
96
|
...(err.extras ? { extras: err.extras } : {}),
|
|
57
97
|
}));
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
|
|
98
|
+
// Project-roster denial: the fix is joining the project (its own action
|
|
99
|
+
// with its own endpoint), not an approval of the read — so this branch
|
|
100
|
+
// replaces the approval guidance below rather than adding to it.
|
|
101
|
+
const rosterStep = err.code === 'PERMISSION_DENIED' ? projectRosterNextStep(err.extras?.details) : undefined;
|
|
102
|
+
if (rosterStep) {
|
|
103
|
+
console.error(rosterStep);
|
|
104
|
+
}
|
|
105
|
+
else if (err.code === 'PERMISSION_DENIED' && err.action) {
|
|
106
|
+
// Authorization denial: tell the agent how to escalate, driven entirely by
|
|
107
|
+
// the server's `approvable` flag (no hardcoded allowlist that can drift).
|
|
108
|
+
// See docs/engineering-design/error-contract-design.md
|
|
62
109
|
// Only an explicit `false` means "not approvable". A missing flag (older
|
|
63
110
|
// server, or a service that doesn't emit it) is unknown — offer the
|
|
64
111
|
// approval path rather than suppressing a possibly-valid request.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parall/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.67.0",
|
|
4
4
|
"description": "CLI client for Parall — universal agent & human access to Parall API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -37,15 +37,15 @@
|
|
|
37
37
|
"js-yaml": "^4.1.0",
|
|
38
38
|
"node-diff3": "3.2.1",
|
|
39
39
|
"zod": "^4.3.6",
|
|
40
|
-
"@parall/agent-core": "1.
|
|
41
|
-
"@parall/sdk": "1.
|
|
40
|
+
"@parall/agent-core": "1.67.0",
|
|
41
|
+
"@parall/sdk": "1.67.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/js-yaml": "^4.0.9",
|
|
45
45
|
"@types/node": "^22.0.0",
|
|
46
46
|
"esbuild": "^0.25.0",
|
|
47
47
|
"typescript": "^5.7.0",
|
|
48
|
-
"@parall/agent-core": "1.
|
|
48
|
+
"@parall/agent-core": "1.67.0"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"build": "tsc",
|