@parall/cli 1.65.0 → 1.66.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/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/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,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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AS,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/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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AC,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.66.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.66.0",
|
|
41
|
+
"@parall/sdk": "1.66.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.66.0"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"build": "tsc",
|