@skrr-ai/cli 0.1.17 → 0.1.18
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/README.md +7 -4
- package/dist/commands/commitments/action-proposals/decide.d.ts +13 -0
- package/dist/commands/commitments/action-proposals/decide.js +41 -0
- package/dist/commands/commitments/action-proposals/execute.d.ts +12 -0
- package/dist/commands/commitments/action-proposals/execute.js +29 -0
- package/dist/commands/commitments/action-proposals.d.ts +13 -0
- package/dist/commands/commitments/action-proposals.js +56 -0
- package/dist/commands/commitments/autonomy.d.ts +7 -11
- package/dist/commands/commitments/autonomy.js +16 -25
- package/dist/commands/commitments/bundle.d.ts +14 -0
- package/dist/commands/commitments/bundle.js +49 -0
- package/dist/commands/commitments/create.d.ts +25 -0
- package/dist/commands/commitments/create.js +200 -23
- package/dist/commands/commitments/delivery.d.ts +16 -0
- package/dist/commands/commitments/delivery.js +71 -0
- package/dist/commands/commitments/doctor.d.ts +1 -0
- package/dist/commands/commitments/doctor.js +33 -17
- package/dist/commands/commitments/effective-policy.d.ts +2 -0
- package/dist/commands/commitments/effective-policy.js +50 -5
- package/dist/commands/commitments/endpoints/connect.d.ts +3 -10
- package/dist/commands/commitments/endpoints/connect.js +6 -37
- package/dist/commands/commitments/endpoints/create.d.ts +2 -9
- package/dist/commands/commitments/endpoints/create.js +10 -23
- package/dist/commands/commitments/mode.d.ts +15 -0
- package/dist/commands/commitments/mode.js +57 -0
- package/dist/commands/commitments/pack/promote.d.ts +1 -1
- package/dist/commands/commitments/pack/promote.js +7 -3
- package/dist/commands/commitments/pack/shadow.d.ts +3 -2
- package/dist/commands/commitments/pack/shadow.js +6 -4
- package/dist/commands/commitments/patch.d.ts +14 -0
- package/dist/commands/commitments/patch.js +51 -0
- package/dist/commands/commitments/preflight.d.ts +2 -1
- package/dist/commands/commitments/preflight.js +23 -4
- package/dist/commands/commitments/receipt.d.ts +15 -0
- package/dist/commands/commitments/receipt.js +34 -0
- package/dist/commands/commitments/remediate.d.ts +0 -1
- package/dist/commands/commitments/remediate.js +5 -3
- package/dist/commands/commitments/reports.js +12 -3
- package/dist/commands/commitments/show.d.ts +1 -0
- package/dist/commands/commitments/show.js +22 -1
- package/dist/commands/commitments/update.js +4 -2
- package/dist/commands/commitments/wake-capabilities.d.ts +5 -0
- package/dist/commands/commitments/wake-capabilities.js +23 -7
- package/dist/commands/spaces/bootstrap.js +1 -1
- package/dist/lib/commitment-endpoints.d.ts +3 -2
- package/dist/lib/commitment-endpoints.js +12 -9
- package/dist/lib/commitment-product.d.ts +14 -0
- package/dist/lib/commitment-product.js +78 -0
- package/dist/lib/commitments.d.ts +39 -17
- package/dist/lib/commitments.js +70 -29
- package/dist/node_modules/@skrr-ai/data-provider/index.js +3551 -3461
- package/oclif.manifest.json +19993 -19322
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ observability), and shared links.
|
|
|
43
43
|
| **dm** | `list`, `show`, `messages`, `threads`, `thread show/messages/follow/mute/share`, `send` (agent 1:1 main chat and Slack-style Thread controls) |
|
|
44
44
|
| **diagnostics** | `context`, `doctor`, `usage`, `commands` (agent-friendly runtime identity, readiness, progressive token-budgeted discovery, and complete machine-readable schemas) |
|
|
45
45
|
| **goals** | `list`, `show`, `create`, `update`, `delete`, `descendants`, `tasks`, `archive`, `revisions` |
|
|
46
|
-
| **commitments** | `list`, `show`, `create`, `plan`, `preflight`, `update`, `checks`, `check-now`, `autonomy`, `pause`, `resume`, `complete`, `subject`, `attach`, `detach`, `reports`, `export`, `import`, `fork` (durable agent commitment contracts)
|
|
46
|
+
| **commitments** | `list`, `show`, `create`, `plan`, `preflight`, `update`, `checks`, `check-now`, `action-proposals`, `autonomy`, `pause`, `resume`, `complete`, `subject`, `attach`, `detach`, `reports`, `export`, `import`, `fork` (durable agent commitment contracts) |
|
|
47
47
|
| **goals briefing** | `enable`, `disable`, `preview` |
|
|
48
48
|
| **tasks** | `list`, `show`, `create`, `upsert`, `create-tree`, `bulk-update`, `tree`, `update`, `delete`, `actionability`, `ready`, `start`, `active`, `monitor`, `watch`, `wait`, `continue-ready`, `move`, `complete`, `children`, `ancestors`, `descendants`, `activity`, `runs`, `execution-summary`, `execution-timeline`, `replay`, `checkout`, `release`, `start-all`, `cancel-cascade`, `cascade-status`, `dri-status`, `duplicate-pipeline`, `archive`, `today`, `prompt-log`, `revisions`, `transcript`, `output` |
|
|
49
49
|
| **tasks input** | `show`, `answer`, `dismiss` (durable Human-input handoff) |
|
|
@@ -756,6 +756,9 @@ sky commitments create --agent <agent-id> \
|
|
|
756
756
|
sky commitments create --agent <agent-id> --title "AWS cost watch" \
|
|
757
757
|
--outcome "Cost regressions are investigated" \
|
|
758
758
|
--agent-directive-file ./aws-cost-policy.md
|
|
759
|
+
sky commitments create --agent <agent-id> --title "Keep CI healthy" \
|
|
760
|
+
--outcome "Failed checks are repaired" --watch github --event-driven \
|
|
761
|
+
--mode execute --delivery draft-pr --repo owner/repo --base main --status active
|
|
759
762
|
sky commitments resume <commitment-id> # activate
|
|
760
763
|
|
|
761
764
|
# Or draft it from a sentence (read-only proposal)
|
|
@@ -763,14 +766,14 @@ sky commitments plan --agent <agent-id> --sentence "Make sure every candidate he
|
|
|
763
766
|
|
|
764
767
|
# Steer it
|
|
765
768
|
sky commitments update <commitment-id> --cadence 6h # retune how often it checks
|
|
766
|
-
sky commitments autonomy <commitment-id> --mode
|
|
769
|
+
sky commitments autonomy <commitment-id> --mode prepare # reason and wait for approval
|
|
767
770
|
sky commitments checks <commitment-id> # what it has been deciding
|
|
768
771
|
sky commitments check-now <commitment-id> # run one iteration now
|
|
769
772
|
sky commitments pause <commitment-id> # kill-switch
|
|
770
773
|
```
|
|
771
774
|
|
|
772
|
-
Autonomy
|
|
773
|
-
|
|
775
|
+
Autonomy modes: `monitor` (default), `prepare`, and `execute`. Pause/resume is
|
|
776
|
+
the lifecycle control; approval classes live in execution policy. Full reference:
|
|
774
777
|
[docs/cli/SKRR_COMMITMENTS.md](../docs/cli/SKRR_COMMITMENTS.md).
|
|
775
778
|
|
|
776
779
|
### `sky spaces` — perspective guide
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command';
|
|
2
|
+
export default class CommitmentsActionProposalsDecide extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
commitmentId: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
proposalId: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
decision: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_command_1 = require("../../../base-command");
|
|
5
|
+
const commitments_1 = require("../../../lib/commitments");
|
|
6
|
+
class CommitmentsActionProposalsDecide extends base_command_1.BaseCommand {
|
|
7
|
+
static description = 'Approve & run, or reject, one frozen prepared action';
|
|
8
|
+
static args = {
|
|
9
|
+
commitmentId: core_1.Args.string({ description: 'Commitment ID', required: true, ignoreStdin: true }),
|
|
10
|
+
proposalId: core_1.Args.string({ description: 'Action Proposal ID', required: true, ignoreStdin: true }),
|
|
11
|
+
};
|
|
12
|
+
static flags = {
|
|
13
|
+
json: core_1.Flags.boolean({ description: 'Output the decision and execution receipts as JSON' }),
|
|
14
|
+
decision: core_1.Flags.string({ options: ['approve', 'reject'], required: true }),
|
|
15
|
+
};
|
|
16
|
+
async run() {
|
|
17
|
+
this.requireAuth();
|
|
18
|
+
const { args, flags } = await this.parse(CommitmentsActionProposalsDecide);
|
|
19
|
+
const decision = flags.decision;
|
|
20
|
+
let result;
|
|
21
|
+
try {
|
|
22
|
+
const decided = await commitments_1.commitmentApi.decideActionProposal(args.commitmentId, args.proposalId, decision);
|
|
23
|
+
const execution = decision === 'approve' && decided.status === 'approved'
|
|
24
|
+
? await commitments_1.commitmentApi.executeActionProposal(args.commitmentId, args.proposalId)
|
|
25
|
+
: undefined;
|
|
26
|
+
result = { decision: decided, ...(execution ? { execution } : {}) };
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
this.handleApiError(error);
|
|
30
|
+
}
|
|
31
|
+
if (flags.json)
|
|
32
|
+
this.log(JSON.stringify(result, null, 2));
|
|
33
|
+
else if (decision === 'approve') {
|
|
34
|
+
this.log('Prepared action approved and handed to the durable executor.');
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
this.log('Prepared action rejected.');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.default = CommitmentsActionProposalsDecide;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseCommand } from '../../../base-command';
|
|
2
|
+
export default class CommitmentsActionProposalsExecute extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
commitmentId: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
proposalId: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
10
|
+
};
|
|
11
|
+
run(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_command_1 = require("../../../base-command");
|
|
5
|
+
const commitments_1 = require("../../../lib/commitments");
|
|
6
|
+
class CommitmentsActionProposalsExecute extends base_command_1.BaseCommand {
|
|
7
|
+
static description = 'Nudge an approved action now (recovery continues automatically)';
|
|
8
|
+
static args = {
|
|
9
|
+
commitmentId: core_1.Args.string({ description: 'Commitment ID', required: true, ignoreStdin: true }),
|
|
10
|
+
proposalId: core_1.Args.string({ description: 'Action Proposal ID', required: true, ignoreStdin: true }),
|
|
11
|
+
};
|
|
12
|
+
static flags = { json: core_1.Flags.boolean({ description: 'Output as JSON' }) };
|
|
13
|
+
async run() {
|
|
14
|
+
this.requireAuth();
|
|
15
|
+
const { args, flags } = await this.parse(CommitmentsActionProposalsExecute);
|
|
16
|
+
let result;
|
|
17
|
+
try {
|
|
18
|
+
result = await commitments_1.commitmentApi.executeActionProposal(args.commitmentId, args.proposalId);
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
this.handleApiError(error);
|
|
22
|
+
}
|
|
23
|
+
if (flags.json)
|
|
24
|
+
this.log(JSON.stringify(result, null, 2));
|
|
25
|
+
else
|
|
26
|
+
this.log(`Prepared action is ${String(result.status || 'queued')}.`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.default = CommitmentsActionProposalsExecute;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command';
|
|
2
|
+
export default class CommitmentsActionProposals extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static args: {
|
|
5
|
+
id: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
6
|
+
};
|
|
7
|
+
static flags: {
|
|
8
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
|
+
status: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
limit: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
};
|
|
12
|
+
run(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const base_command_1 = require("../../base-command");
|
|
5
|
+
const commitments_1 = require("../../lib/commitments");
|
|
6
|
+
const format_1 = require("../../lib/format");
|
|
7
|
+
class CommitmentsActionProposals extends base_command_1.BaseCommand {
|
|
8
|
+
static description = 'List frozen prepared actions and their recovery state';
|
|
9
|
+
static args = {
|
|
10
|
+
id: core_1.Args.string({ description: 'Commitment ID', required: true, ignoreStdin: true }),
|
|
11
|
+
};
|
|
12
|
+
static flags = {
|
|
13
|
+
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
14
|
+
status: core_1.Flags.string({
|
|
15
|
+
description: 'Filter by proposal status',
|
|
16
|
+
options: ['proposed', 'approved', 'rejected', 'executing', 'succeeded', 'failed', 'expired'],
|
|
17
|
+
}),
|
|
18
|
+
limit: core_1.Flags.integer({ description: 'Maximum rows', default: 50, min: 1, max: 200 }),
|
|
19
|
+
};
|
|
20
|
+
async run() {
|
|
21
|
+
this.requireAuth();
|
|
22
|
+
const { args, flags } = await this.parse(CommitmentsActionProposals);
|
|
23
|
+
let response;
|
|
24
|
+
try {
|
|
25
|
+
response = await commitments_1.commitmentApi.actionProposals(args.id, {
|
|
26
|
+
status: flags.status,
|
|
27
|
+
limit: flags.limit,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
this.handleApiError(error);
|
|
32
|
+
}
|
|
33
|
+
if (flags.json) {
|
|
34
|
+
this.log(JSON.stringify(response, null, 2));
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (!response.data.length) {
|
|
38
|
+
this.log('No prepared actions.');
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
(0, format_1.renderTable)(response.data.map((proposal) => ({
|
|
42
|
+
id: proposal.id,
|
|
43
|
+
action: String(proposal.actionSnapshot?.type || 'action').replace(/_/g, ' '),
|
|
44
|
+
status: proposal.status,
|
|
45
|
+
attempt: `${proposal.attempt || 0}/${proposal.maxAttempts || 3}`,
|
|
46
|
+
expires: proposal.expiresAt || '—',
|
|
47
|
+
})), [
|
|
48
|
+
{ key: 'id', header: 'PROPOSAL', verbatim: true },
|
|
49
|
+
{ key: 'action', header: 'ACTION', maxWidth: 28 },
|
|
50
|
+
{ key: 'status', header: 'STATUS' },
|
|
51
|
+
{ key: 'attempt', header: 'ATTEMPT' },
|
|
52
|
+
{ key: 'expires', header: 'EXPIRES', maxWidth: 28 },
|
|
53
|
+
], (line) => this.log(line));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.default = CommitmentsActionProposals;
|
|
@@ -3,23 +3,19 @@ import { BaseCommand } from '../../base-command';
|
|
|
3
3
|
* `skrr commitments autonomy <id> --mode <mode>` — grant or withdraw how much the
|
|
4
4
|
* commitment may do on its own.
|
|
5
5
|
*
|
|
6
|
-
* The
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* auto_run_limited — acts on low-risk actions; escalates the rest
|
|
11
|
-
* auto_run — acts within its policy without asking
|
|
6
|
+
* The one public autonomy axis:
|
|
7
|
+
* monitor — observe and report; never execute external work
|
|
8
|
+
* prepare — reason and freeze a plan for approval
|
|
9
|
+
* execute — act within the explicit execution policy
|
|
12
10
|
*
|
|
13
11
|
* Use this rather than `commitments update`: the API replaces `policy` wholesale,
|
|
14
12
|
* whereas this endpoint merges the change into the existing policy.
|
|
15
13
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* quietHours, requiresApprovalFor). `policy.delivery` is not among them — it is
|
|
19
|
-
* accepted by the API but never persisted, and the delivery policy that actually
|
|
20
|
-
* takes effect lives on the agent (`agent.deliveryPolicy.commitment`).
|
|
14
|
+
* The merge is field-by-field over the policy fields the Commitment Store owns;
|
|
15
|
+
* report destinations remain the separate `reports[]` contract.
|
|
21
16
|
*/
|
|
22
17
|
export default class CommitmentsAutonomy extends BaseCommand {
|
|
18
|
+
static hidden: boolean;
|
|
23
19
|
static description: string;
|
|
24
20
|
static examples: string[];
|
|
25
21
|
static args: {
|
|
@@ -8,28 +8,25 @@ const commitments_1 = require("../../lib/commitments");
|
|
|
8
8
|
* `skrr commitments autonomy <id> --mode <mode>` — grant or withdraw how much the
|
|
9
9
|
* commitment may do on its own.
|
|
10
10
|
*
|
|
11
|
-
* The
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* auto_run_limited — acts on low-risk actions; escalates the rest
|
|
16
|
-
* auto_run — acts within its policy without asking
|
|
11
|
+
* The one public autonomy axis:
|
|
12
|
+
* monitor — observe and report; never execute external work
|
|
13
|
+
* prepare — reason and freeze a plan for approval
|
|
14
|
+
* execute — act within the explicit execution policy
|
|
17
15
|
*
|
|
18
16
|
* Use this rather than `commitments update`: the API replaces `policy` wholesale,
|
|
19
17
|
* whereas this endpoint merges the change into the existing policy.
|
|
20
18
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* quietHours, requiresApprovalFor). `policy.delivery` is not among them — it is
|
|
24
|
-
* accepted by the API but never persisted, and the delivery policy that actually
|
|
25
|
-
* takes effect lives on the agent (`agent.deliveryPolicy.commitment`).
|
|
19
|
+
* The merge is field-by-field over the policy fields the Commitment Store owns;
|
|
20
|
+
* report destinations remain the separate `reports[]` contract.
|
|
26
21
|
*/
|
|
27
22
|
class CommitmentsAutonomy extends base_command_1.BaseCommand {
|
|
23
|
+
// Kept callable for existing scripts, but omitted from command discovery so
|
|
24
|
+
// new users see one product vocabulary: Monitor, Prepare, Execute.
|
|
25
|
+
static hidden = true;
|
|
28
26
|
static description = "Set a commitment's autonomy mode (how much it may act unattended)";
|
|
29
27
|
static examples = [
|
|
30
|
-
'<%= config.bin %> commitments
|
|
31
|
-
'<%= config.bin %> commitments
|
|
32
|
-
'<%= config.bin %> commitments autonomy <commitment-id> --mode auto_run --reason "owns the pipeline end to end"',
|
|
28
|
+
'<%= config.bin %> commitments mode <commitment-id> prepare',
|
|
29
|
+
'<%= config.bin %> commitments mode <commitment-id> execute',
|
|
33
30
|
];
|
|
34
31
|
static args = {
|
|
35
32
|
id: core_1.Args.string({ description: 'Commitment ID', required: true, ignoreStdin: true }),
|
|
@@ -37,15 +34,8 @@ class CommitmentsAutonomy extends base_command_1.BaseCommand {
|
|
|
37
34
|
static flags = {
|
|
38
35
|
json: core_1.Flags.boolean({ description: 'Output as JSON' }),
|
|
39
36
|
mode: core_1.Flags.string({
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// the stored value. What it must NOT keep is the silence: the two acting
|
|
43
|
-
// rungs were indistinguishable in the decision core until the authority
|
|
44
|
-
// rework, and this help text never said what separated them.
|
|
45
|
-
description: 'Autonomy mode: off (stop) | suggestions_only (propose only) | ask_first (prepare, wait for approval) | ' +
|
|
46
|
-
'auto_run_limited (act unattended on low/medium-risk work, bring high-risk to the owner) | ' +
|
|
47
|
-
'auto_run (act unattended, high-risk work included)',
|
|
48
|
-
options: [...commitments_1.COMMITMENT_AUTONOMY_MODES],
|
|
37
|
+
description: 'Compatibility command. Prefer commitments mode <id> monitor|prepare|execute; use commitments pause to stop wakes.',
|
|
38
|
+
options: [...commitments_1.COMMITMENT_AUTHORABLE_AUTONOMY_MODES],
|
|
49
39
|
required: true,
|
|
50
40
|
}),
|
|
51
41
|
reason: core_1.Flags.string({
|
|
@@ -56,9 +46,10 @@ class CommitmentsAutonomy extends base_command_1.BaseCommand {
|
|
|
56
46
|
this.requireAuth();
|
|
57
47
|
const { args, flags } = await this.parse(CommitmentsAutonomy);
|
|
58
48
|
let commitment;
|
|
49
|
+
const storedMode = (0, commitments_1.storedAutonomyModeForAuthoring)(flags.mode);
|
|
59
50
|
try {
|
|
60
51
|
commitment = await commitments_1.commitmentApi.autonomy(args.id, {
|
|
61
|
-
autonomyMode:
|
|
52
|
+
autonomyMode: storedMode,
|
|
62
53
|
...(flags.reason ? { reason: flags.reason } : {}),
|
|
63
54
|
});
|
|
64
55
|
}
|
|
@@ -69,7 +60,7 @@ class CommitmentsAutonomy extends base_command_1.BaseCommand {
|
|
|
69
60
|
this.log(JSON.stringify((0, web_url_1.withCommitmentUrl)(this.cliConfig.baseURL, commitment), null, 2));
|
|
70
61
|
return;
|
|
71
62
|
}
|
|
72
|
-
this.log(
|
|
63
|
+
this.log('Compatibility command accepted. Use commitments mode <id> monitor|prepare|execute for new workflows.');
|
|
73
64
|
(0, commitments_1.renderCommitmentSummary)(commitment, (line) => this.log(line));
|
|
74
65
|
}
|
|
75
66
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseCommand } from '../../base-command';
|
|
2
|
+
export default class CommitmentsBundle extends BaseCommand {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static args: {
|
|
6
|
+
id: import("@oclif/core/lib/interfaces").Arg<string, Record<string, unknown>>;
|
|
7
|
+
};
|
|
8
|
+
static flags: {
|
|
9
|
+
task: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
|
+
output: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
11
|
+
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
};
|
|
13
|
+
run(): Promise<void>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
const node_fs_1 = require("node:fs");
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
const base_command_1 = require("../../base-command");
|
|
8
|
+
const commitments_1 = require("../../lib/commitments");
|
|
9
|
+
class CommitmentsBundle extends base_command_1.BaseCommand {
|
|
10
|
+
static description = 'Download the retained Git bundle for a Commitment delivery Task';
|
|
11
|
+
static examples = [
|
|
12
|
+
'<%= config.bin %> commitments bundle <id> --task <task-id> --output remediation.bundle',
|
|
13
|
+
];
|
|
14
|
+
static args = { id: core_1.Args.string({ required: true, ignoreStdin: true }) };
|
|
15
|
+
static flags = {
|
|
16
|
+
task: core_1.Flags.string({
|
|
17
|
+
required: true,
|
|
18
|
+
description: 'Delivery Task ID from the execution receipt',
|
|
19
|
+
}),
|
|
20
|
+
output: core_1.Flags.string({
|
|
21
|
+
required: true,
|
|
22
|
+
description: 'Save a new Git bundle file (existing files are not overwritten)',
|
|
23
|
+
}),
|
|
24
|
+
json: core_1.Flags.boolean({ description: 'Output the saved path and integrity metadata as JSON' }),
|
|
25
|
+
};
|
|
26
|
+
async run() {
|
|
27
|
+
this.requireAuth();
|
|
28
|
+
const { args, flags } = await this.parse(CommitmentsBundle);
|
|
29
|
+
try {
|
|
30
|
+
const { bundle } = await commitments_1.commitmentApi.deliveryBundle(args.id, flags.task);
|
|
31
|
+
if (bundle.encoding !== 'base64')
|
|
32
|
+
this.error('Unsupported Git bundle encoding.');
|
|
33
|
+
const content = Buffer.from(bundle.content, 'base64');
|
|
34
|
+
if ((0, node_crypto_1.createHash)('sha256').update(content).digest('hex') !== bundle.sha256 ||
|
|
35
|
+
content.length !== bundle.bytes)
|
|
36
|
+
this.error('Git bundle integrity check failed. The downloaded content was not saved.');
|
|
37
|
+
const output = (0, node_path_1.resolve)(flags.output);
|
|
38
|
+
(0, node_fs_1.writeFileSync)(output, content, { flag: 'wx', mode: 0o600 });
|
|
39
|
+
if (flags.json)
|
|
40
|
+
this.log(JSON.stringify({ path: output, sha256: bundle.sha256, bytes: bundle.bytes }, null, 2));
|
|
41
|
+
else
|
|
42
|
+
this.log(`Git bundle saved: ${output}\nSHA-256: ${bundle.sha256}`);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
this.handleApiError(error);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.default = CommitmentsBundle;
|
|
@@ -1,4 +1,24 @@
|
|
|
1
1
|
import { BaseCommand } from '../../base-command';
|
|
2
|
+
/**
|
|
3
|
+
* True only when the authored create body can materialize at least one event
|
|
4
|
+
* binding. A polling-only source must not make `--event-driven` look successful
|
|
5
|
+
* while the resulting Commitment still wakes exclusively on its backstop.
|
|
6
|
+
*/
|
|
7
|
+
export declare function hasEventCapableWatchedSource(payload: Record<string, unknown>): boolean;
|
|
8
|
+
export declare function assertEventDrivenWatchedSource(payload: Record<string, unknown>): void;
|
|
9
|
+
/**
|
|
10
|
+
* Resolve the create-time cadence flags into the API payload.
|
|
11
|
+
*
|
|
12
|
+
* `--event-driven` is deliberately a complete shortcut rather than an alias
|
|
13
|
+
* for the mode string: event delivery is an accelerator, so the contract must
|
|
14
|
+
* always retain a timed safety net even when the author omits `--cadence`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createCadenceFromFlags({ eventDriven, cadence: cadenceInput, cadenceMode, timezone, }: {
|
|
17
|
+
eventDriven?: boolean;
|
|
18
|
+
cadence?: string;
|
|
19
|
+
cadenceMode?: string;
|
|
20
|
+
timezone?: string;
|
|
21
|
+
}): Record<string, unknown> | undefined;
|
|
2
22
|
/**
|
|
3
23
|
* Creation preserves the policy its author wrote, so the mode that comes back
|
|
4
24
|
* is normally the mode that was asked for. When it is not — normalization
|
|
@@ -46,8 +66,13 @@ export default class CommitmentsCreate extends BaseCommand {
|
|
|
46
66
|
'watch-space': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
47
67
|
'watch-monitor': import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
48
68
|
cadence: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
69
|
+
'event-driven': import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
49
70
|
'cadence-mode': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
50
71
|
timezone: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
72
|
+
mode: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
73
|
+
delivery: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
74
|
+
repo: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
75
|
+
base: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
51
76
|
autonomy: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
52
77
|
isolation: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
53
78
|
'max-nudges': import("@oclif/core/lib/interfaces").OptionFlag<number | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|