@astrosheep/keiyaku 4.0.3 → 4.0.5
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/build/integrations/marketplace/plugins/keiyaku/.claude-plugin/plugin.json +1 -1
- package/build/integrations/marketplace/plugins/keiyaku/.codex-plugin/plugin.json +1 -1
- package/build/integrations/marketplace/plugins/keiyaku/package.json +1 -1
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku/SKILL.md +4 -4
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-akuma/SKILL.md +1 -1
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-bind/SKILL.md +15 -1
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-task/SKILL.md +3 -1
- package/build/integrations/marketplace/plugins/keiyaku/skills/keiyaku-workflow/SKILL.md +34 -13
- package/build/src/akuma/akuma.d.ts +34 -12
- package/build/src/akuma/akuma.js +118 -63
- package/build/src/akuma/allowed.d.ts +7 -0
- package/build/src/akuma/allowed.js +33 -0
- package/build/src/akuma/archetype.d.ts +7 -4
- package/build/src/akuma/archetype.js +15 -16
- package/build/src/akuma/body.d.ts +6 -1
- package/build/src/akuma/body.js +36 -27
- package/build/src/akuma/heart/facts.d.ts +82 -14
- package/build/src/akuma/heart/index.d.ts +5 -18
- package/build/src/akuma/heart/index.js +14 -84
- package/build/src/akuma/heart/request-authority.d.ts +12 -0
- package/build/src/akuma/heart/request-authority.js +119 -0
- package/build/src/akuma/heart/request-rows.d.ts +16 -0
- package/build/src/akuma/heart/request-rows.js +88 -0
- package/build/src/akuma/heart/rows.d.ts +1 -26
- package/build/src/akuma/heart/rows.js +0 -50
- package/build/src/akuma/heart/schema.d.ts +1 -1
- package/build/src/akuma/heart/schema.js +22 -10
- package/build/src/akuma/heart/soul.js +2 -36
- package/build/src/akuma/heart/storage.d.ts +1 -0
- package/build/src/akuma/heart/storage.js +15 -0
- package/build/src/akuma/heart/timeline.d.ts +1 -5
- package/build/src/akuma/heart/timeline.js +8 -17
- package/build/src/akuma/index.d.ts +5 -2
- package/build/src/akuma/index.js +1 -0
- package/build/src/akuma/projection.d.ts +17 -3
- package/build/src/akuma/projection.js +40 -3
- package/build/src/akuma/provider-recipe.js +1 -11
- package/build/src/akuma/provider.d.ts +2 -7
- package/build/src/akuma/provider.js +2 -1
- package/build/src/akuma/providers/acp/core.d.ts +3 -1
- package/build/src/akuma/providers/acp/core.js +10 -6
- package/build/src/akuma/providers/acp/events.d.ts +11 -3
- package/build/src/akuma/providers/acp/events.js +78 -4
- package/build/src/akuma/providers/acp/index.js +0 -1
- package/build/src/akuma/providers/claude/events.js +62 -3
- package/build/src/akuma/providers/claude/index.d.ts +0 -4
- package/build/src/akuma/providers/claude/index.js +7 -3
- package/build/src/akuma/providers/codex-app-server/events.js +1 -13
- package/build/src/akuma/providers/codex-app-server/index.d.ts +2 -27
- package/build/src/akuma/providers/codex-app-server/index.js +0 -2
- package/build/src/akuma/providers/grok-build/index.d.ts +2 -1
- package/build/src/akuma/providers/grok-build/index.js +72 -3
- package/build/src/akuma/providers/opencode-sdk/events.js +71 -6
- package/build/src/akuma/providers/opencode-sdk/index.d.ts +2 -28
- package/build/src/akuma/providers/opencode-sdk/index.js +8 -4
- package/build/src/akuma/providers/opencode-sdk/session.d.ts +1 -1
- package/build/src/akuma/providers/opencode-sdk/session.js +1 -1
- package/build/src/akuma/providers/pi/events.js +17 -3
- package/build/src/akuma/providers/pi/index.js +11 -4
- package/build/src/akuma/providers/unified-patch.d.ts +4 -0
- package/build/src/akuma/providers/unified-patch.js +14 -0
- package/build/src/akuma/publication.d.ts +1 -1
- package/build/src/akuma/publication.js +1 -1
- package/build/src/akuma/request-serve.d.ts +87 -0
- package/build/src/akuma/request-serve.js +484 -0
- package/build/src/akuma/request-wire.d.ts +124 -0
- package/build/src/akuma/request-wire.js +380 -0
- package/build/src/akuma/requests.d.ts +41 -41
- package/build/src/akuma/requests.js +75 -374
- package/build/src/akuma-body.d.ts +8 -0
- package/build/src/akuma-body.js +84 -0
- package/build/src/body/arc.js +4 -29
- package/build/src/body/decode.js +5 -39
- package/build/src/body/envelope.d.ts +7 -0
- package/build/src/body/envelope.js +37 -0
- package/build/src/cli/accepted.d.ts +4 -1
- package/build/src/cli/accepted.js +39 -9
- package/build/src/cli/commands/akuma-invoke.d.ts +8 -7
- package/build/src/cli/commands/akuma-invoke.js +18 -10
- package/build/src/cli/commands/akuma.d.ts +11 -2
- package/build/src/cli/commands/akuma.js +67 -28
- package/build/src/cli/commands/amend.d.ts +1 -1
- package/build/src/cli/commands/amend.js +1 -1
- package/build/src/cli/commands/contract.d.ts +8 -8
- package/build/src/cli/commands/contract.js +3 -3
- package/build/src/cli/commands/install.js +2 -2
- package/build/src/cli/commands/task-invoke.js +98 -9
- package/build/src/cli/commands/task-query.d.ts +1 -1
- package/build/src/cli/commands/task-query.js +11 -5
- package/build/src/cli/coordinates.d.ts +2 -0
- package/build/src/cli/coordinates.js +12 -5
- package/build/src/cli/invoke.d.ts +1 -0
- package/build/src/cli/invoke.js +116 -75
- package/build/src/cli/main.d.ts +2 -0
- package/build/src/cli/main.js +29 -4
- package/build/src/cli/parse.d.ts +3 -2
- package/build/src/cli/parse.js +25 -8
- package/build/src/cli/render/akuma.d.ts +2 -2
- package/build/src/cli/render/akuma.js +138 -24
- package/build/src/cli/render/audit.js +18 -8
- package/build/src/cli/render/contract.d.ts +2 -0
- package/build/src/cli/render/contract.js +243 -36
- package/build/src/cli/render/kanshi.js +64 -29
- package/build/src/cli/render/receipt.d.ts +2 -1
- package/build/src/cli/render/receipt.js +37 -2
- package/build/src/cli/render/terminal.d.ts +0 -2
- package/build/src/cli/render/terminal.js +0 -29
- package/build/src/cli/render/text.js +3 -1
- package/build/src/cli/result.d.ts +52 -9
- package/build/src/cli/selectors.d.ts +1 -0
- package/build/src/cli/selectors.js +9 -6
- package/build/src/contract-worktree.d.ts +1 -2
- package/build/src/contract-worktree.js +7 -9
- package/build/src/core/facts/codec.js +9 -0
- package/build/src/core/facts/fold.js +13 -1
- package/build/src/core/facts/types.d.ts +8 -1
- package/build/src/core/subject.js +4 -3
- package/build/src/core/verbs/placement.d.ts +9 -1
- package/build/src/core/verbs/placement.js +24 -6
- package/build/src/core/verbs/reintegrate.d.ts +13 -0
- package/build/src/core/verbs/reintegrate.js +24 -0
- package/build/src/dispatch/index.d.ts +1 -1
- package/build/src/dispatch/index.js +50 -39
- package/build/src/git/admission.d.ts +2 -1
- package/build/src/git/hooks.d.ts +0 -4
- package/build/src/git/hooks.js +0 -36
- package/build/src/git/integration.d.ts +7 -8
- package/build/src/git/integration.js +62 -9
- package/build/src/git/observe.d.ts +2 -1
- package/build/src/git/observe.js +6 -5
- package/build/src/git/process.d.ts +26 -0
- package/build/src/git/process.js +94 -0
- package/build/src/git/read-observation.d.ts +2 -1
- package/build/src/git/read-observation.js +3 -2
- package/build/src/git/reconcile.d.ts +8 -2
- package/build/src/git/reconcile.js +63 -14
- package/build/src/git/repository.d.ts +2 -29
- package/build/src/git/repository.js +4 -118
- package/build/src/git/scratch.d.ts +1 -1
- package/build/src/git/scratch.js +1 -1
- package/build/src/git/target-placement.d.ts +1 -1
- package/build/src/git/target-placement.js +9 -7
- package/build/src/git/tender.d.ts +20 -5
- package/build/src/git/tender.js +45 -13
- package/build/src/git/terminal-seal.d.ts +16 -2
- package/build/src/git/terminal-seal.js +15 -5
- package/build/src/git/workspace.d.ts +2 -1
- package/build/src/git/workspace.js +13 -5
- package/build/src/index.d.ts +1 -2
- package/build/src/index.js +1 -1
- package/build/src/kanshi/index.d.ts +1 -1
- package/build/src/kanshi/index.js +1 -1
- package/build/src/kanshi/read.d.ts +9 -1
- package/build/src/kanshi/read.js +91 -37
- package/build/src/kanshi/report.d.ts +1 -0
- package/build/src/library/address.d.ts +5 -14
- package/build/src/library/address.js +27 -23
- package/build/src/library/akuma-creation.d.ts +4 -2
- package/build/src/library/akuma-creation.js +43 -26
- package/build/src/library/audit.d.ts +2 -1
- package/build/src/library/audit.js +1 -1
- package/build/src/library/bind.d.ts +2 -1
- package/build/src/library/bind.js +4 -4
- package/build/src/library/catalog.d.ts +1 -2
- package/build/src/library/catalog.js +11 -6
- package/build/src/library/configuration.d.ts +5 -1
- package/build/src/library/configuration.js +71 -18
- package/build/src/library/contract.d.ts +70 -3
- package/build/src/library/contract.js +213 -27
- package/build/src/library/delivery.d.ts +1 -1
- package/build/src/library/fleet.d.ts +70 -12
- package/build/src/library/fleet.js +236 -56
- package/build/src/library/input.d.ts +0 -1
- package/build/src/library/input.js +1 -5
- package/build/src/library/keiyaku.d.ts +4 -4
- package/build/src/library/keiyaku.js +1 -2
- package/build/src/library/mutation.d.ts +2 -1
- package/build/src/library/reconcile.d.ts +2 -1
- package/build/src/library/reconcile.js +3 -1
- package/build/src/library/region.d.ts +1 -1
- package/build/src/library/repo.d.ts +3 -1
- package/build/src/library/repo.js +8 -4
- package/build/src/protocol/abandon.d.ts +9 -0
- package/build/src/protocol/abandon.js +15 -0
- package/build/src/protocol/amend.d.ts +16 -0
- package/build/src/protocol/amend.js +77 -0
- package/build/src/protocol/arc.d.ts +6 -0
- package/build/src/protocol/arc.js +12 -0
- package/build/src/protocol/attempt.d.ts +2 -1
- package/build/src/protocol/audit.d.ts +53 -0
- package/build/src/protocol/audit.js +140 -0
- package/build/src/protocol/bind.d.ts +2 -3
- package/build/src/protocol/bind.js +2 -16
- package/build/src/protocol/completion.d.ts +32 -0
- package/build/src/protocol/completion.js +130 -0
- package/build/src/protocol/deliver.d.ts +37 -0
- package/build/src/protocol/deliver.js +160 -0
- package/build/src/protocol/intent.d.ts +1 -1
- package/build/src/protocol/intent.js +1 -1
- package/build/src/protocol/operations.d.ts +65 -198
- package/build/src/protocol/operations.js +21 -634
- package/build/src/protocol/placement.d.ts +4 -13
- package/build/src/protocol/placement.js +3 -15
- package/build/src/protocol/read/status.d.ts +4 -2
- package/build/src/protocol/read/status.js +27 -15
- package/build/src/protocol/reconcile.d.ts +35 -0
- package/build/src/protocol/reconcile.js +41 -0
- package/build/src/protocol/reintegrate.d.ts +31 -0
- package/build/src/protocol/reintegrate.js +74 -0
- package/build/src/protocol/review.d.ts +33 -0
- package/build/src/protocol/review.js +148 -0
- package/build/src/protocol/run.d.ts +1 -1
- package/build/src/runtime/proc/run.d.ts +1 -0
- package/build/src/runtime/proc/run.js +9 -2
- package/build/src/settlement/fence.d.ts +1 -1
- package/build/src/settlement/holder.d.ts +1 -1
- package/build/src/settlement/settle.d.ts +2 -1
- package/build/src/settlement/settle.js +4 -1
- package/build/src/task/board.d.ts +18 -4
- package/build/src/task/board.js +73 -29
- package/build/src/task/compose.d.ts +1 -1
- package/build/src/task/compose.js +11 -4
- package/build/src/task/index.d.ts +4 -4
- package/build/src/task/index.js +8 -131
- package/build/src/task/input.d.ts +18 -0
- package/build/src/task/input.js +189 -0
- package/build/src/task/mutation.d.ts +39 -0
- package/build/src/task/mutation.js +85 -0
- package/build/src/task/operations.d.ts +4 -19
- package/build/src/task/operations.js +64 -18
- package/build/src/task/query.d.ts +9 -2
- package/build/src/task/query.js +32 -64
- package/build/src/task/store.js +0 -2
- package/build/src/verification/execution.d.ts +1 -1
- package/build/src/verification/execution.js +2 -1
- package/build/src/workspace-place.d.ts +1 -4
- package/build/src/workspace-place.js +0 -15
- package/package.json +5 -3
|
@@ -4,15 +4,15 @@ export const AMEND_MINIMAL_STDIN_HELP = [
|
|
|
4
4
|
" <complete replacement>",
|
|
5
5
|
].join("\n");
|
|
6
6
|
export const CONTRACT_COMMAND_SPECS = {
|
|
7
|
-
bind: { positional: "none", stdin: "required", flags: { actor: "value", task: "value", target: "value", here: "boolean", after: "repeat-value", gates: "value", json: "boolean" }, usage: "bind [--task <task/...>] [--target <ref>] [--here] [--after <kei/...> ...] [--gates <name
|
|
8
|
-
amend: { positional: "optional", stdin: "
|
|
7
|
+
bind: { positional: "none", stdin: "required", flags: { actor: "value", task: "value", target: "value", here: "boolean", after: "repeat-value", gates: "raw-value", json: "boolean" }, usage: "bind [--task <task/...>] [--target <ref>] [--here] [--after <kei/...> ...] [--gates <name,...>] [--actor <actor>] [--json] -", purpose: "Create one Contract from stdin Markdown." },
|
|
8
|
+
amend: { positional: "optional", stdin: "optional", flags: { actor: "value", after: "repeat-value", "clear-after": "boolean", gates: "raw-value", json: "boolean" }, usage: "amend [<contract>|@<contract>] [--after <kei/...> ... | --clear-after] [--gates <name,...>] [--actor <actor>] [--json] [-]", purpose: "Amend one Contract's document operations or structured terms." },
|
|
9
9
|
deliver: { positional: "optional", stdin: "none", flags: { actor: "value", message: "value", "include-dirty": "boolean", json: "boolean" }, usage: "deliver [<contract>|@<contract>] [--message <text>] [--include-dirty] [--actor <actor>] [--json]", purpose: "Deliver one Contract candidate." },
|
|
10
10
|
review: { positional: "optional", stdin: "optional", flags: { actor: "value", satisfied: "boolean", unsatisfied: "boolean", summary: "value", json: "boolean" }, usage: "review [<contract>|@<contract>] (--satisfied | --unsatisfied) (--summary <text> | -) [--actor <actor>] [--json]", purpose: "Record one review verdict." },
|
|
11
11
|
arc: { positional: "optional", stdin: "required", flags: { actor: "value", json: "boolean" }, usage: "arc [<contract>|@<contract>] [--actor <actor>] [--json] -", purpose: "Record stdin arc Markdown for one Contract." },
|
|
12
12
|
abandon: { positional: "optional", stdin: "none", flags: { actor: "value", note: "value", json: "boolean" }, usage: "abandon [<contract>|@<contract>] [--note <text>] [--actor <actor>] [--json]", purpose: "Abandon one Contract with an optional note." },
|
|
13
13
|
status: { positional: "optional", stdin: "none", flags: { json: "boolean" }, usage: "status [<contract>|@name|<aku/...>] [--json]", purpose: "Read the world status board or one Contract projection." },
|
|
14
14
|
show: { positional: "optional", stdin: "none", flags: { json: "boolean" }, usage: "show [<contract>|@<contract>] [--json]", purpose: "Read one Contract guidance projection." },
|
|
15
|
-
ls: { positional: "optional", stdin: "none", flags: { json: "boolean" }, usage: "ls task/ [--json]\n keiyaku ls kei/ [--json]\n keiyaku ls aku/ [--json]\n keiyaku ls aku/<akuma
|
|
15
|
+
ls: { positional: "optional", stdin: "none", flags: { json: "boolean" }, usage: "ls task[/] [--json]\n keiyaku ls kei[/] [--json]\n keiyaku ls aku[/] [--json]\n keiyaku ls aku/<akuma>[/] [--json]\n keiyaku ls \"aku/*/*\" [--json]", purpose: "List one identity directory." },
|
|
16
16
|
audit: { positional: "optional", stdin: "none", flags: { "include-dirty": "boolean", diff: "boolean", actor: "value", json: "boolean" }, usage: "audit [<contract>|@<contract>] [--include-dirty] [--diff] [--actor <actor>] [--json]", purpose: "Ask what candidate preparation, Verification, and target placement would do." },
|
|
17
17
|
reconcile: { positional: "optional", stdin: "none", flags: { "retry-hooks": "boolean", json: "boolean" }, usage: "reconcile [<contract>|@<contract>] [--retry-hooks] [--json]", purpose: "Reconcile one Contract or the invocation world." },
|
|
18
18
|
settings: { positional: "none", stdin: "none", flags: { json: "boolean" }, usage: "settings [--json]", purpose: "Read user and project Settings resources." },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { dirname, resolve } from "node:path";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
import {
|
|
3
|
+
import { runCrossPlatformProcess } from "../../runtime/proc/run.js";
|
|
4
4
|
import { CliUsageError, usageLine, withJsonAutomationHelp } from "../usage.js";
|
|
5
5
|
export const HARNESS_NAMES = ["codex", "claude", "opencode", "pi"];
|
|
6
6
|
export const INSTALL_USAGE = "install <codex|claude|opencode|pi> [--json]\n install --all [--json]";
|
|
@@ -80,7 +80,7 @@ function diagnostic(argv, outcome) {
|
|
|
80
80
|
export function installAssetsRoot() {
|
|
81
81
|
return ASSET_ROOT;
|
|
82
82
|
}
|
|
83
|
-
export async function installHarnesses(harnesses, environment, runner =
|
|
83
|
+
export async function installHarnesses(harnesses, environment, runner = runCrossPlatformProcess) {
|
|
84
84
|
const results = [];
|
|
85
85
|
for (const harness of harnesses) {
|
|
86
86
|
let failure;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Tasks, } from "../../task/index.js";
|
|
2
|
+
import { injectedBodyRequests, requestBodyTask } from "../../akuma/requests.js";
|
|
3
|
+
import { decodeTaskMutationRequest } from "../../task/mutation.js";
|
|
2
4
|
function value(command, name) {
|
|
3
5
|
const item = command.flags[name];
|
|
4
6
|
return typeof item === "string" ? item : undefined;
|
|
@@ -54,6 +56,82 @@ async function invokeUpdate(tasks, command, readStdin) {
|
|
|
54
56
|
...(addRelates === undefined ? {} : { addRelates }), ...(dropRelates === undefined ? {} : { dropRelates }),
|
|
55
57
|
});
|
|
56
58
|
}
|
|
59
|
+
async function addMutationRequest(command, input) {
|
|
60
|
+
const selectedNamespace = namespace(value(command, "namespace"));
|
|
61
|
+
if (command.stdin === "document")
|
|
62
|
+
return { action: "task.addDocument", input: {
|
|
63
|
+
markdown: await input.readStdin(),
|
|
64
|
+
...(selectedNamespace === undefined ? {} : { namespace: selectedNamespace }),
|
|
65
|
+
} };
|
|
66
|
+
const body = value(command, "body"), note = value(command, "note");
|
|
67
|
+
const initialState = state(value(command, "state")), selectedPriority = priority(value(command, "priority"));
|
|
68
|
+
const needs = ids(values(command, "needs")), parent = value(command, "parent");
|
|
69
|
+
const supersedes = ids(values(command, "supersedes")), relates = ids(values(command, "relates"));
|
|
70
|
+
return { action: "task.add", input: {
|
|
71
|
+
title: command.positionals[0], ...(selectedNamespace === undefined ? {} : { namespace: selectedNamespace }),
|
|
72
|
+
...(body === undefined ? {} : { body }), ...(note === undefined ? {} : { note }),
|
|
73
|
+
...(initialState === undefined ? {} : { state: initialState }),
|
|
74
|
+
...(selectedPriority === undefined ? {} : { priority: selectedPriority }),
|
|
75
|
+
...(needs === undefined ? {} : { needs }), ...(parent === undefined ? {} : { parent: parent }),
|
|
76
|
+
...(supersedes === undefined ? {} : { supersedes }), ...(relates === undefined ? {} : { relates }),
|
|
77
|
+
} };
|
|
78
|
+
}
|
|
79
|
+
async function updateMutationRequest(command, input) {
|
|
80
|
+
const body = command.stdin === "body" ? await input.readStdin() : value(command, "body");
|
|
81
|
+
const appendBody = command.stdin === "append" ? await input.readStdin() : value(command, "append");
|
|
82
|
+
const note = command.stdin === "note" ? await input.readStdin() : value(command, "note");
|
|
83
|
+
const title = value(command, "title"), selectedPriority = priority(value(command, "priority"));
|
|
84
|
+
const addNeeds = ids(values(command, "needs")), dropNeeds = ids(values(command, "drop-needs"));
|
|
85
|
+
const parent = value(command, "parent"), addSupersedes = ids(values(command, "supersedes"));
|
|
86
|
+
const dropSupersedes = ids(values(command, "drop-supersedes")), addRelates = ids(values(command, "relates"));
|
|
87
|
+
const dropRelates = ids(values(command, "drop-relates"));
|
|
88
|
+
return { action: "task.update", id: command.positionals[0], input: {
|
|
89
|
+
...(title === undefined ? {} : { title }), ...(body === undefined ? {} : { body }),
|
|
90
|
+
...(appendBody === undefined ? {} : { appendBody }), ...(note === undefined ? {} : { note }),
|
|
91
|
+
...(selectedPriority === undefined ? {} : { priority: selectedPriority }),
|
|
92
|
+
...(addNeeds === undefined ? {} : { addNeeds }), ...(dropNeeds === undefined ? {} : { dropNeeds }),
|
|
93
|
+
...(command.flags["no-parent"] === true ? { parent: null }
|
|
94
|
+
: parent === undefined ? {} : { parent: parent }),
|
|
95
|
+
...(addSupersedes === undefined ? {} : { addSupersedes }),
|
|
96
|
+
...(dropSupersedes === undefined ? {} : { dropSupersedes }),
|
|
97
|
+
...(addRelates === undefined ? {} : { addRelates }), ...(dropRelates === undefined ? {} : { dropRelates }),
|
|
98
|
+
} };
|
|
99
|
+
}
|
|
100
|
+
function lifecycleMutationRequest(command) {
|
|
101
|
+
const id = command.positionals[0];
|
|
102
|
+
switch (command.action) {
|
|
103
|
+
case "start": return { action: "task.start", id };
|
|
104
|
+
case "stop": return { action: "task.stop", id };
|
|
105
|
+
case "resume": return { action: "task.resume", id };
|
|
106
|
+
case "hold": return { action: "task.hold", ids: command.positionals };
|
|
107
|
+
case "done": return { action: "task.done", ids: command.positionals, ...(value(command, "note") === undefined ? {} : { note: value(command, "note") }) };
|
|
108
|
+
case "drop": return { action: "task.drop", ids: command.positionals, ...(value(command, "note") === undefined ? {} : { note: value(command, "note") }) };
|
|
109
|
+
default: throw new Error(`task action cannot forward: ${command.action}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
async function mutationRequest(command, input) {
|
|
113
|
+
if (command.action === "add")
|
|
114
|
+
return await addMutationRequest(command, input);
|
|
115
|
+
if (command.action === "compose")
|
|
116
|
+
return { action: "task.compose", markdown: await input.readStdin() };
|
|
117
|
+
if (command.action === "update")
|
|
118
|
+
return await updateMutationRequest(command, input);
|
|
119
|
+
return lifecycleMutationRequest(command);
|
|
120
|
+
}
|
|
121
|
+
function validatedMutationRequest(request) {
|
|
122
|
+
switch (request.action) {
|
|
123
|
+
case "task.add":
|
|
124
|
+
case "task.addDocument": return decodeTaskMutationRequest(request.action, { input: request.input });
|
|
125
|
+
case "task.compose": return decodeTaskMutationRequest(request.action, { markdown: request.markdown });
|
|
126
|
+
case "task.update": return decodeTaskMutationRequest(request.action, { id: request.id, input: request.input });
|
|
127
|
+
case "task.start":
|
|
128
|
+
case "task.stop":
|
|
129
|
+
case "task.resume": return decodeTaskMutationRequest(request.action, { id: request.id });
|
|
130
|
+
case "task.hold": return decodeTaskMutationRequest(request.action, { ids: request.ids });
|
|
131
|
+
case "task.done":
|
|
132
|
+
case "task.drop": return decodeTaskMutationRequest(request.action, { ids: request.ids, ...(request.note === undefined ? {} : { note: request.note }) });
|
|
133
|
+
}
|
|
134
|
+
}
|
|
57
135
|
async function invokeRead(tasks, command) {
|
|
58
136
|
const id = command.positionals[0];
|
|
59
137
|
switch (command.action) {
|
|
@@ -97,15 +175,7 @@ function missingWorld(command) {
|
|
|
97
175
|
}
|
|
98
176
|
return missing(command.positionals[0]);
|
|
99
177
|
}
|
|
100
|
-
|
|
101
|
-
let world = input.world;
|
|
102
|
-
if (world === null && (command.action === "add" || command.action === "compose"
|
|
103
|
-
|| (command.action === "namespace" && command.positionals.length > 0))) {
|
|
104
|
-
world = await input.establish();
|
|
105
|
-
}
|
|
106
|
-
if (world === null)
|
|
107
|
-
return missingWorld(command);
|
|
108
|
-
const tasks = Tasks.of(world);
|
|
178
|
+
async function invokeLocalMutation(tasks, command, input) {
|
|
109
179
|
if (isWorldObservation(command))
|
|
110
180
|
return observeWorldRead(tasks, command);
|
|
111
181
|
if (command.action === "show" || command.action === "tree")
|
|
@@ -138,3 +208,22 @@ export async function invokeTask(command, input) {
|
|
|
138
208
|
default: throw new Error(`task action has no invocation: ${command.action}`);
|
|
139
209
|
}
|
|
140
210
|
}
|
|
211
|
+
function establishesWorld(command) {
|
|
212
|
+
return command.action === "add" || command.action === "compose"
|
|
213
|
+
|| (command.action === "namespace" && command.positionals.length > 0);
|
|
214
|
+
}
|
|
215
|
+
function forwardsMutation(command) {
|
|
216
|
+
return command.action !== "show" && command.action !== "tree"
|
|
217
|
+
&& command.action !== "namespace" && !isWorldObservation(command);
|
|
218
|
+
}
|
|
219
|
+
export async function invokeTask(command, input) {
|
|
220
|
+
const world = input.world ?? (establishesWorld(command) ? await input.establish() : null);
|
|
221
|
+
if (world === null)
|
|
222
|
+
return missingWorld(command);
|
|
223
|
+
const requests = injectedBodyRequests();
|
|
224
|
+
if (requests !== null && forwardsMutation(command)) {
|
|
225
|
+
const request = validatedMutationRequest(await mutationRequest(command, input));
|
|
226
|
+
return await requestBodyTask({ directory: requests, world, request });
|
|
227
|
+
}
|
|
228
|
+
return await invokeLocalMutation(Tasks.of(world), command, input);
|
|
229
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type TaskQueryExpression } from "../../task/index.js";
|
|
2
2
|
export type { TaskQueryExpression } from "../../task/index.js";
|
|
3
3
|
export declare function parseTaskQueryExpression(source: string): TaskQueryExpression;
|
|
4
4
|
export declare function validateTaskLimit(source: string): void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TASK_RELATION_PREDICATE_FIELDS, } from "../../task/index.js";
|
|
1
2
|
import { MAX_TASK_LIMIT, normalizeTaskQuery } from "../../task/query.js";
|
|
2
3
|
function syntax(message, offset) { throw new Error(`${message} at column ${offset + 1}`); }
|
|
3
4
|
function scanString(source, offset) {
|
|
@@ -133,7 +134,15 @@ function parseTextPredicate(field, operator, value) {
|
|
|
133
134
|
return { field, operator: selected, value: value.value };
|
|
134
135
|
}
|
|
135
136
|
function parseRelationPredicate(field, operator, value) {
|
|
136
|
-
|
|
137
|
+
const relationField = TASK_RELATION_PREDICATE_FIELDS.find((candidate) => candidate === field.value);
|
|
138
|
+
if (relationField === undefined) {
|
|
139
|
+
syntax(`unknown query field ${JSON.stringify(field.value)}`, field.offset);
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
field: relationField,
|
|
143
|
+
operator: equalityOperator(operator, relationField),
|
|
144
|
+
value: canonicalTaskId(value, relationField),
|
|
145
|
+
};
|
|
137
146
|
}
|
|
138
147
|
function parseBooleanPredicate(field, operator, value) {
|
|
139
148
|
return { field, operator: equalityOperator(operator, field), value: boolean(value) };
|
|
@@ -216,14 +225,11 @@ class Parser {
|
|
|
216
225
|
operator: equalityOperator(operator, "parent"),
|
|
217
226
|
value: value.value === "none" ? null : canonicalTaskId(value, "parent"),
|
|
218
227
|
};
|
|
219
|
-
case "under": return parseRelationPredicate("under", operator, value);
|
|
220
|
-
case "needs": return parseRelationPredicate("needs", operator, value);
|
|
221
|
-
case "blocks": return parseRelationPredicate("blocks", operator, value);
|
|
222
228
|
case "ready": return parseBooleanPredicate("ready", operator, value);
|
|
223
229
|
case "blocked": return parseBooleanPredicate("blocked", operator, value);
|
|
224
230
|
case "created": return parseTimestampPredicate("created", operator, value);
|
|
225
231
|
case "updated": return parseTimestampPredicate("updated", operator, value);
|
|
226
|
-
default: return
|
|
232
|
+
default: return parseRelationPredicate(field, operator, value);
|
|
227
233
|
}
|
|
228
234
|
}
|
|
229
235
|
}
|
|
@@ -3,6 +3,7 @@ import { type WorldRoot } from "../world.js";
|
|
|
3
3
|
import { type ParsedCommand } from "./parse.js";
|
|
4
4
|
export type CliCoordinates = Readonly<{
|
|
5
5
|
cwd: string;
|
|
6
|
+
cwdSource: "input" | "process";
|
|
6
7
|
repo?: Repo;
|
|
7
8
|
world: WorldRoot | null;
|
|
8
9
|
candidateWorld: WorldRoot | null;
|
|
@@ -12,6 +13,7 @@ export type CliCoordinateInput = Readonly<{
|
|
|
12
13
|
processCwd?: string;
|
|
13
14
|
cwd?: string;
|
|
14
15
|
repo?: string;
|
|
16
|
+
gitPath?: string;
|
|
15
17
|
command: ParsedCommand;
|
|
16
18
|
}>;
|
|
17
19
|
export declare function assertExplicitRepoUse(command: ParsedCommand, repo: string | undefined): void;
|
|
@@ -11,9 +11,12 @@ async function canonicalInvocationCwd(input) {
|
|
|
11
11
|
throw new CliUsageError(`invocation cwd is not an existing directory: ${input}`);
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
async function discoverRepoAt(coordinate) {
|
|
14
|
+
async function discoverRepoAt(coordinate, gitPath) {
|
|
15
15
|
try {
|
|
16
|
-
return {
|
|
16
|
+
return {
|
|
17
|
+
kind: "present",
|
|
18
|
+
repo: await Repo.at({ path: coordinate, ...(gitPath === undefined ? {} : { gitPath }) }),
|
|
19
|
+
};
|
|
17
20
|
}
|
|
18
21
|
catch (error) {
|
|
19
22
|
if (error instanceof NoGitWorldError)
|
|
@@ -38,8 +41,11 @@ function repoPolicy(command) {
|
|
|
38
41
|
return { use: command.query.kind === "contracts" ? "required" : "none", acceptsExplicit: false };
|
|
39
42
|
case "status":
|
|
40
43
|
case "tell":
|
|
41
|
-
case "history":
|
|
42
44
|
return { use: "optional", acceptsExplicit: false };
|
|
45
|
+
case "history":
|
|
46
|
+
return "contract" in command
|
|
47
|
+
? { use: "required", acceptsExplicit: true }
|
|
48
|
+
: { use: "optional", acceptsExplicit: false };
|
|
43
49
|
case "fork":
|
|
44
50
|
return { use: "optional", acceptsExplicit: true };
|
|
45
51
|
case "wait":
|
|
@@ -103,15 +109,16 @@ async function resolveWorld(cwd, repo) {
|
|
|
103
109
|
export async function resolveCliCoordinates(input) {
|
|
104
110
|
const processCwd = resolve(input.processCwd ?? ".");
|
|
105
111
|
const cwd = await canonicalInvocationCwd(resolve(processCwd, input.cwd ?? "."));
|
|
106
|
-
const invocationRepo = await discoverRepoAt(cwd);
|
|
112
|
+
const invocationRepo = await discoverRepoAt(cwd, input.gitPath);
|
|
107
113
|
const selectedRepo = input.repo === undefined
|
|
108
114
|
? invocationRepo
|
|
109
|
-
: await discoverRepoAt(resolve(cwd, input.repo));
|
|
115
|
+
: await discoverRepoAt(resolve(cwd, input.repo), input.gitPath);
|
|
110
116
|
const worldRepo = invocationRepo.kind === "present" ? invocationRepo.repo : undefined;
|
|
111
117
|
const repo = repoFor(repoPolicy(input.command).use, selectedRepo);
|
|
112
118
|
const world = await resolveWorld(cwd, worldRepo);
|
|
113
119
|
return {
|
|
114
120
|
cwd,
|
|
121
|
+
cwdSource: input.cwd === undefined ? "process" : "input",
|
|
115
122
|
...(repo === undefined ? {} : { repo }),
|
|
116
123
|
world: world.root,
|
|
117
124
|
candidateWorld: world.candidate,
|