@fitlab-ai/agent-infra 0.9.9 → 0.9.11
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 +13 -3
- package/README.zh-CN.md +13 -3
- package/bin/cli.ts +17 -4
- package/dist/bin/cli.js +19 -4
- package/dist/bin/internal-cli.js +55 -4
- package/dist/lib/agent-client.js +0 -1
- package/dist/lib/agent-clients/adapters/codex-lifecycle/build-identity.js +17 -10
- package/dist/lib/agent-clients/adapters/codex-lifecycle/controller-context.js +11 -31
- package/dist/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.js +15 -33
- package/dist/lib/agent-clients/adapters/codex-sandbox.js +72 -11
- package/dist/lib/agent-clients/adapters/index.js +3 -1
- package/dist/lib/agent-clients/adapters/opencode-sandbox.js +0 -4
- package/dist/lib/agent-clients/adapters/traecli.js +65 -0
- package/dist/lib/agent-clients/config.js +14 -99
- package/dist/lib/agent-clients/reconcile.js +1 -11
- package/dist/lib/agent-clients/schema.js +5 -4
- package/dist/lib/agent-clients/tokens.js +7 -17
- package/dist/lib/agent-clients/types.js +2 -1
- package/dist/lib/decide.js +14 -30
- package/dist/lib/defaults.json +9 -0
- package/dist/lib/init.js +2 -2
- package/dist/lib/internal/codex-lifecycle.js +2 -2
- package/dist/lib/internal/codex-sandbox-controller.js +4 -3
- package/dist/lib/internal/release-workflow.js +0 -1
- package/dist/lib/internal/sandbox-control.js +2 -2
- package/dist/lib/internal/task-finalization.js +19 -9
- package/dist/lib/internal/task-ledger.js +8 -2
- package/dist/lib/internal/task-lifecycle.js +17 -93
- package/dist/lib/internal/task-orchestration.js +30 -216
- package/dist/lib/{task/commands/validate.js → internal/task-validate.js} +77 -43
- package/dist/lib/merge.js +205 -103
- package/dist/lib/process-data/normalize.js +2 -9
- package/dist/lib/run/host.js +46 -16
- package/dist/lib/run/tui.js +5 -2
- package/dist/lib/sandbox/agent-client-reconciler.js +4 -12
- package/dist/lib/sandbox/commands/create.js +3 -3
- package/dist/lib/sandbox/commands/enter.js +18 -4
- package/dist/lib/sandbox/config.js +3 -12
- package/dist/lib/sandbox/control/controller-registration.js +4 -2
- package/dist/lib/sandbox/control/executor.js +135 -40
- package/dist/lib/sandbox/control/lifecycle.js +29 -20
- package/dist/lib/sandbox/control/server.js +18 -16
- package/dist/lib/sandbox/mounts.js +3 -2
- package/dist/lib/sandbox/recovery.js +123 -22
- package/dist/lib/sandbox/workspace-identity.js +14 -0
- package/dist/lib/sandbox/workspace-view.js +8 -9
- package/dist/lib/self-update.js +278 -0
- package/dist/lib/server/protocol.js +5 -5
- package/dist/lib/task/activity-log.js +4 -1
- package/dist/lib/task/artifact-lifecycle.js +4 -2
- package/dist/lib/task/codex-orchestration.js +32 -35
- package/dist/lib/task/command-options.js +1 -3
- package/dist/lib/task/commands/cat.js +0 -5
- package/dist/lib/task/commands/decisions.js +76 -92
- package/dist/lib/task/commands/files.js +6 -6
- package/dist/lib/task/commands/grep.js +25 -61
- package/dist/lib/task/commands/issue-body.js +6 -6
- package/dist/lib/task/commands/log.js +25 -10
- package/dist/lib/task/commands/show.js +5 -6
- package/dist/lib/task/commands/status.js +8 -8
- package/dist/lib/task/commit-operation.js +21 -25
- package/dist/lib/task/commit-policy.js +1 -1
- package/dist/lib/task/control-authority.js +431 -0
- package/dist/lib/task/create.js +6 -1
- package/dist/lib/task/current-contract.js +35 -0
- package/dist/lib/task/decision-details.js +263 -0
- package/dist/lib/task/decision-intents.js +5 -2
- package/dist/lib/task/delegation-receipts.js +8 -7
- package/dist/lib/task/events.js +11 -5
- package/dist/lib/task/finalization.js +72 -46
- package/dist/lib/task/index.js +19 -29
- package/dist/lib/task/ledger-intents.js +8 -9
- package/dist/lib/task/ledger.js +13 -6
- package/dist/lib/task/lifecycle.js +16 -0
- package/dist/lib/task/orchestration.js +51 -14
- package/dist/lib/task/review-artifacts.js +31 -12
- package/dist/lib/task/review-finalization.js +19 -6
- package/dist/lib/task/verification-engine.js +38 -18
- package/dist/lib/task/verification-review.js +1 -1
- package/dist/lib/task/workspace-snapshot.js +5 -11
- package/dist/lib/task/write.js +11 -1
- package/dist/lib/update.js +6 -37
- package/dist/lib/version.js +5 -1
- package/dist/lifecycle-build-manifest.json +3 -3
- package/lib/agent-client.ts +0 -1
- package/lib/agent-clients/adapters/codex-lifecycle/build-identity.ts +25 -10
- package/lib/agent-clients/adapters/codex-lifecycle/controller-context.ts +16 -33
- package/lib/agent-clients/adapters/codex-lifecycle/sandbox-controller.ts +16 -35
- package/lib/agent-clients/adapters/codex-sandbox.ts +89 -14
- package/lib/agent-clients/adapters/index.ts +3 -1
- package/lib/agent-clients/adapters/opencode-sandbox.ts +0 -5
- package/lib/agent-clients/adapters/traecli.ts +66 -0
- package/lib/agent-clients/config.ts +14 -144
- package/lib/agent-clients/reconcile.ts +1 -12
- package/lib/agent-clients/schema.ts +5 -4
- package/lib/agent-clients/tokens.ts +7 -20
- package/lib/agent-clients/types.ts +2 -1
- package/lib/decide.ts +12 -22
- package/lib/defaults.json +9 -0
- package/lib/init.ts +2 -2
- package/lib/internal/codex-lifecycle.ts +2 -2
- package/lib/internal/codex-sandbox-controller.ts +4 -3
- package/lib/internal/release-workflow.ts +0 -1
- package/lib/internal/sandbox-control.ts +2 -2
- package/lib/internal/task-finalization.ts +27 -13
- package/lib/internal/task-ledger.ts +8 -2
- package/lib/internal/task-lifecycle.ts +33 -76
- package/lib/internal/task-orchestration.ts +33 -190
- package/lib/{task/commands/validate.ts → internal/task-validate.ts} +77 -41
- package/lib/merge.ts +236 -120
- package/lib/process-data/normalize.ts +2 -8
- package/lib/run/host.ts +63 -14
- package/lib/run/tui.ts +5 -3
- package/lib/sandbox/agent-client-reconciler.ts +5 -15
- package/lib/sandbox/commands/create.ts +4 -4
- package/lib/sandbox/commands/enter.ts +24 -4
- package/lib/sandbox/config.ts +2 -14
- package/lib/sandbox/control/container-identity.ts +2 -2
- package/lib/sandbox/control/controller-registration.ts +8 -3
- package/lib/sandbox/control/executor.ts +156 -53
- package/lib/sandbox/control/lifecycle.ts +34 -28
- package/lib/sandbox/control/protocol.ts +1 -3
- package/lib/sandbox/control/server.ts +15 -12
- package/lib/sandbox/control/state.ts +7 -7
- package/lib/sandbox/mounts.ts +4 -3
- package/lib/sandbox/recovery.ts +162 -34
- package/lib/sandbox/tools.ts +1 -1
- package/lib/sandbox/workspace-identity.ts +28 -0
- package/lib/sandbox/workspace-view.ts +14 -10
- package/lib/self-update.ts +341 -0
- package/lib/server/protocol.ts +5 -5
- package/lib/task/activity-log.ts +6 -1
- package/lib/task/artifact-lifecycle.ts +5 -3
- package/lib/task/codex-orchestration.ts +40 -45
- package/lib/task/command-options.ts +1 -2
- package/lib/task/commands/cat.ts +0 -4
- package/lib/task/commands/decisions.ts +80 -75
- package/lib/task/commands/files.ts +6 -6
- package/lib/task/commands/grep.ts +23 -51
- package/lib/task/commands/issue-body.ts +6 -6
- package/lib/task/commands/log.ts +22 -10
- package/lib/task/commands/show.ts +5 -6
- package/lib/task/commands/status.ts +8 -8
- package/lib/task/commit-operation.ts +25 -30
- package/lib/task/commit-policy.ts +1 -2
- package/lib/task/control-authority.ts +563 -0
- package/lib/task/create.ts +6 -1
- package/lib/task/current-contract.ts +49 -0
- package/lib/task/decision-details.ts +340 -0
- package/lib/task/decision-intents.ts +7 -2
- package/lib/task/delegation-receipts.ts +8 -6
- package/lib/task/events.ts +10 -5
- package/lib/task/finalization.ts +84 -42
- package/lib/task/index.ts +19 -28
- package/lib/task/ledger-intents.ts +6 -8
- package/lib/task/ledger.ts +17 -7
- package/lib/task/lifecycle.ts +20 -0
- package/lib/task/orchestration.ts +42 -16
- package/lib/task/review-artifacts.ts +53 -15
- package/lib/task/review-finalization.ts +33 -7
- package/lib/task/verification-engine.ts +33 -21
- package/lib/task/verification-review.ts +1 -1
- package/lib/task/workspace-snapshot.ts +4 -13
- package/lib/task/write.ts +20 -1
- package/lib/update.ts +6 -40
- package/lib/version.ts +6 -1
- package/package.json +1 -1
- package/templates/.agents/QUICKSTART.en.md +2 -3
- package/templates/.agents/QUICKSTART.zh-CN.md +2 -3
- package/templates/.agents/README.en.md +5 -3
- package/templates/.agents/README.zh-CN.md +5 -3
- package/templates/.agents/rules/README.en.md +1 -0
- package/templates/.agents/rules/README.zh-CN.md +1 -0
- package/templates/.agents/rules/compatibility-policy.en.md +40 -0
- package/templates/.agents/rules/compatibility-policy.zh-CN.md +40 -0
- package/templates/.agents/rules/create-issue.github.en.md +1 -1
- package/templates/.agents/rules/create-issue.github.zh-CN.md +1 -1
- package/templates/.agents/rules/human-decision-context.en.md +9 -7
- package/templates/.agents/rules/human-decision-context.zh-CN.md +9 -7
- package/templates/.agents/rules/issue-fields.github.en.md +1 -1
- package/templates/.agents/rules/issue-fields.github.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-pr-commands.en.md +1 -1
- package/templates/.agents/rules/issue-pr-commands.github.en.md +1 -1
- package/templates/.agents/rules/issue-pr-commands.github.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-pr-commands.zh-CN.md +1 -1
- package/templates/.agents/rules/issue-sync.github.en.md +1 -1
- package/templates/.agents/rules/issue-sync.github.zh-CN.md +2 -2
- package/templates/.agents/rules/lifecycle-orchestration.en.md +4 -4
- package/templates/.agents/rules/lifecycle-orchestration.zh-CN.md +4 -4
- package/templates/.agents/rules/milestone-inference.github.en.md +1 -1
- package/templates/.agents/rules/milestone-inference.github.zh-CN.md +1 -1
- package/templates/.agents/rules/next-step-output.en.md +3 -3
- package/templates/.agents/rules/next-step-output.zh-CN.md +3 -3
- package/templates/.agents/rules/no-mid-flow-questions.en.md +1 -1
- package/templates/.agents/rules/no-mid-flow-questions.zh-CN.md +1 -1
- package/templates/.agents/rules/pr-sync.en.md +2 -2
- package/templates/.agents/rules/pr-sync.github.en.md +3 -2
- package/templates/.agents/rules/pr-sync.github.zh-CN.md +3 -1
- package/templates/.agents/rules/pr-sync.zh-CN.md +2 -1
- package/templates/.agents/rules/release-commands.github.en.md +6 -0
- package/templates/.agents/rules/release-commands.github.zh-CN.md +6 -0
- package/templates/.agents/rules/review-handshake.en.md +1 -1
- package/templates/.agents/rules/review-handshake.zh-CN.md +1 -1
- package/templates/.agents/rules/review-method.en.md +1 -0
- package/templates/.agents/rules/review-method.zh-CN.md +1 -0
- package/templates/.agents/rules/task-management.en.md +1 -2
- package/templates/.agents/rules/task-management.zh-CN.md +1 -2
- package/templates/.agents/skills/analyze-task/SKILL.en.md +4 -3
- package/templates/.agents/skills/analyze-task/SKILL.zh-CN.md +4 -3
- package/templates/.agents/skills/block-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/block-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/cancel-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/cancel-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/check-task/SKILL.en.md +2 -2
- package/templates/.agents/skills/check-task/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/close-codescan/SKILL.en.md +1 -1
- package/templates/.agents/skills/close-codescan/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/close-dependabot/SKILL.en.md +1 -1
- package/templates/.agents/skills/close-dependabot/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/code-task/SKILL.en.md +4 -3
- package/templates/.agents/skills/code-task/SKILL.zh-CN.md +5 -3
- package/templates/.agents/skills/commit/SKILL.en.md +27 -7
- package/templates/.agents/skills/commit/SKILL.zh-CN.md +3 -4
- package/templates/.agents/skills/complete-manual-validation/SKILL.en.md +5 -5
- package/templates/.agents/skills/complete-manual-validation/SKILL.zh-CN.md +5 -5
- package/templates/.agents/skills/complete-task/SKILL.en.md +3 -3
- package/templates/.agents/skills/complete-task/SKILL.zh-CN.md +3 -3
- package/templates/.agents/skills/create-pr/SKILL.en.md +15 -11
- package/templates/.agents/skills/create-pr/SKILL.zh-CN.md +15 -11
- package/templates/.agents/skills/create-pr/reference/change-report.en.md +46 -0
- package/templates/.agents/skills/create-pr/reference/change-report.zh-CN.md +46 -0
- package/templates/.agents/skills/create-pr/scripts/change-report.mjs +203 -0
- package/templates/.agents/skills/create-release-note/SKILL.en.md +5 -6
- package/templates/.agents/skills/create-release-note/SKILL.zh-CN.md +5 -6
- package/templates/.agents/skills/create-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/create-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/import-issue/SKILL.en.md +1 -1
- package/templates/.agents/skills/import-issue/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/plan-task/SKILL.en.md +5 -4
- package/templates/.agents/skills/plan-task/SKILL.zh-CN.md +5 -4
- package/templates/.agents/skills/restore-task/SKILL.en.md +1 -1
- package/templates/.agents/skills/restore-task/SKILL.zh-CN.md +1 -1
- package/templates/.agents/skills/review-analysis/SKILL.en.md +5 -3
- package/templates/.agents/skills/review-analysis/SKILL.zh-CN.md +5 -3
- package/templates/.agents/skills/review-analysis/config/verify.en.json +1 -0
- package/templates/.agents/skills/review-analysis/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/review-code/SKILL.en.md +5 -3
- package/templates/.agents/skills/review-code/SKILL.zh-CN.md +5 -3
- package/templates/.agents/skills/review-code/config/verify.en.json +1 -0
- package/templates/.agents/skills/review-code/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/review-code/reference/migration-risks.en.md +9 -6
- package/templates/.agents/skills/review-code/reference/migration-risks.zh-CN.md +9 -6
- package/templates/.agents/skills/review-plan/SKILL.en.md +5 -3
- package/templates/.agents/skills/review-plan/SKILL.zh-CN.md +5 -3
- package/templates/.agents/skills/review-plan/config/verify.en.json +1 -0
- package/templates/.agents/skills/review-plan/config/verify.zh-CN.json +1 -0
- package/templates/.agents/skills/run-manual-validation/SKILL.en.md +7 -3
- package/templates/.agents/skills/run-manual-validation/SKILL.zh-CN.md +7 -3
- package/templates/.agents/skills/run-manual-validation/reference/discovery-and-execution.en.md +1 -1
- package/templates/.agents/skills/run-manual-validation/reference/discovery-and-execution.zh-CN.md +1 -1
- package/templates/.agents/skills/run-manual-validation/reference/report-template.en.md +2 -2
- package/templates/.agents/skills/run-manual-validation/reference/report-template.zh-CN.md +2 -2
- package/templates/.agents/skills/run-task/SKILL.en.md +6 -2
- package/templates/.agents/skills/run-task/SKILL.zh-CN.md +6 -2
- package/templates/.agents/skills/run-task/reference/host-validation.en.md +2 -2
- package/templates/.agents/skills/run-task/reference/host-validation.zh-CN.md +2 -2
- package/templates/.agents/skills/update-agent-infra/SKILL.en.md +2 -2
- package/templates/.agents/skills/update-agent-infra/SKILL.zh-CN.md +2 -2
- package/templates/.agents/skills/update-agent-infra/scripts/sync-templates.js +159 -104
- package/templates/.agents/skills/watch-pr/SKILL.en.md +2 -2
- package/templates/.agents/skills/watch-pr/SKILL.zh-CN.md +2 -2
- package/templates/.agents/templates/task.en.md +1 -1
- package/templates/.agents/templates/task.zh-CN.md +1 -1
- package/templates/.claude/commands/analyze-task.en.md +1 -1
- package/templates/.claude/commands/analyze-task.zh-CN.md +1 -1
- package/templates/.claude/commands/block-task.en.md +1 -1
- package/templates/.claude/commands/block-task.zh-CN.md +1 -1
- package/templates/.claude/commands/cancel-task.en.md +1 -1
- package/templates/.claude/commands/cancel-task.zh-CN.md +1 -1
- package/templates/.claude/commands/check-task.en.md +1 -1
- package/templates/.claude/commands/check-task.zh-CN.md +1 -1
- package/templates/.claude/commands/code-task.en.md +1 -1
- package/templates/.claude/commands/code-task.zh-CN.md +1 -1
- package/templates/.claude/commands/commit.en.md +1 -1
- package/templates/.claude/commands/commit.zh-CN.md +1 -1
- package/templates/.claude/commands/complete-manual-validation.en.md +1 -1
- package/templates/.claude/commands/complete-manual-validation.zh-CN.md +1 -1
- package/templates/.claude/commands/complete-task.en.md +1 -1
- package/templates/.claude/commands/complete-task.zh-CN.md +1 -1
- package/templates/.claude/commands/create-pr.en.md +1 -1
- package/templates/.claude/commands/create-pr.zh-CN.md +1 -1
- package/templates/.claude/commands/plan-task.en.md +1 -1
- package/templates/.claude/commands/plan-task.zh-CN.md +1 -1
- package/templates/.claude/commands/review-analysis.en.md +1 -1
- package/templates/.claude/commands/review-analysis.zh-CN.md +1 -1
- package/templates/.claude/commands/review-code.en.md +1 -1
- package/templates/.claude/commands/review-code.zh-CN.md +1 -1
- package/templates/.claude/commands/review-plan.en.md +1 -1
- package/templates/.claude/commands/review-plan.zh-CN.md +1 -1
- package/templates/.claude/commands/run-manual-validation.en.md +1 -1
- package/templates/.claude/commands/run-manual-validation.zh-CN.md +1 -1
- package/templates/.claude/commands/run-task.en.md +1 -1
- package/templates/.claude/commands/run-task.zh-CN.md +1 -1
- package/templates/.claude/commands/watch-pr.en.md +1 -1
- package/templates/.claude/commands/watch-pr.zh-CN.md +1 -1
- package/templates/.traecli/commands/update-agent-infra.en.md +7 -0
- package/templates/.traecli/commands/update-agent-infra.zh-CN.md +7 -0
- package/dist/lib/builtin-tuis.js +0 -40
- package/lib/builtin-tuis.ts +0 -56
|
@@ -3,15 +3,15 @@ import { classifyAgent } from '../../agent-clients/tokens.js';
|
|
|
3
3
|
import { formatTable } from '../../table.js';
|
|
4
4
|
import { parseTaskScope } from '../command-options.js';
|
|
5
5
|
import { resolveTaskContext } from '../resolve-ref.js';
|
|
6
|
-
import { isReviewStage,
|
|
6
|
+
import { LEDGER_SECTION_MISSING_CODE, LEDGER_SECTION_MISSING_MESSAGE, isReviewStage, parseLedgerDocument } from '../ledger.js';
|
|
7
7
|
import { parseActivityLog, pairEntries } from '../activity-log.js';
|
|
8
|
-
const USAGE = `Usage: ai task log [
|
|
8
|
+
const USAGE = `Usage: ai task log [--task <ref> | -t <ref>]
|
|
9
9
|
|
|
10
10
|
Renders a task's activity log as a per-step status table. A step's start and
|
|
11
11
|
completion are paired onto one row: STARTED holds the start time, DONE the
|
|
12
12
|
completion time (or '(in progress)' while still running).
|
|
13
|
-
Omit
|
|
14
|
-
<ref>
|
|
13
|
+
Omit the scope Resolve the unique active task for the current branch.
|
|
14
|
+
--task/-t <ref> Bare numeric short id, or a full TASK-YYYYMMDD-HHMMSS id.
|
|
15
15
|
|
|
16
16
|
Columns: # (row) / STEP / AGENT / STARTED / DONE / NOTE
|
|
17
17
|
A human-executed step shows AGENT as 'human' and, when it has no start marker,
|
|
@@ -85,8 +85,8 @@ function isHumanCountField(field) {
|
|
|
85
85
|
return fieldNumber(field, 'manual-validation') !== undefined || fieldNumber(field, 'human-decision') !== undefined;
|
|
86
86
|
}
|
|
87
87
|
// A step is human-executed when its agent token is not a known AI token.
|
|
88
|
-
// Known long names
|
|
89
|
-
//
|
|
88
|
+
// Known long names classify as AI; empty or unknown tokens classify as non-AI
|
|
89
|
+
// (human).
|
|
90
90
|
export function isHumanAgent(agent) {
|
|
91
91
|
return classifyAgent(agent).status !== 'ai';
|
|
92
92
|
}
|
|
@@ -118,12 +118,12 @@ function log(args = []) {
|
|
|
118
118
|
process.exitCode = 1;
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
|
-
if (scope.positionals.length >
|
|
122
|
-
process.stderr.write('ai task log: task ref
|
|
121
|
+
if (scope.positionals.length > 0) {
|
|
122
|
+
process.stderr.write('ai task log: positional task ref is not supported; use --task <ref> or -t <ref>\n');
|
|
123
123
|
process.exitCode = 1;
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
126
|
-
const resolved = resolveTaskContext(scope.taskRef
|
|
126
|
+
const resolved = resolveTaskContext(scope.taskRef);
|
|
127
127
|
if (!resolved.ok) {
|
|
128
128
|
process.stderr.write(`ai task log: ${resolved.message}\n`);
|
|
129
129
|
process.exitCode = 1;
|
|
@@ -142,7 +142,18 @@ function log(args = []) {
|
|
|
142
142
|
return;
|
|
143
143
|
}
|
|
144
144
|
const steps = pairEntries(entries);
|
|
145
|
-
|
|
145
|
+
let humanDecisionCounts = new Map();
|
|
146
|
+
let ledgerDiagnostic = null;
|
|
147
|
+
try {
|
|
148
|
+
const ledger = parseLedgerDocument(content);
|
|
149
|
+
if (ledger.present)
|
|
150
|
+
humanDecisionCounts = countHumanDecisionsByStage(ledger.rows);
|
|
151
|
+
else
|
|
152
|
+
ledgerDiagnostic = `${LEDGER_SECTION_MISSING_CODE}: ${LEDGER_SECTION_MISSING_MESSAGE}`;
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
ledgerDiagnostic = `LEDGER_DOCUMENT_INVALID: ${error instanceof Error ? error.message : String(error)}`;
|
|
156
|
+
}
|
|
146
157
|
const rows = steps.map((s, idx) => {
|
|
147
158
|
const stage = reviewStageForStep(s.step);
|
|
148
159
|
const note = stage
|
|
@@ -157,6 +168,10 @@ function log(args = []) {
|
|
|
157
168
|
for (const line of formatTable(TABLE_HEADERS, rows, { zebra: Boolean(process.stdout.isTTY) })) {
|
|
158
169
|
process.stdout.write(`${line}\n`);
|
|
159
170
|
}
|
|
171
|
+
if (ledgerDiagnostic) {
|
|
172
|
+
process.stdout.write(`Ledger: unavailable [${ledgerDiagnostic}]\n`);
|
|
173
|
+
process.exitCode = 1;
|
|
174
|
+
}
|
|
160
175
|
process.stdout.write(`Total: ${steps.length} steps\n`);
|
|
161
176
|
}
|
|
162
177
|
export { log };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import { parseTaskScope } from '../command-options.js';
|
|
3
3
|
import { resolveTaskContext } from '../resolve-ref.js';
|
|
4
|
-
const USAGE = `Usage: ai task show [
|
|
4
|
+
const USAGE = `Usage: ai task show [--task <ref> | -t <ref>]
|
|
5
5
|
|
|
6
6
|
Prints the task.md content for the matching task.
|
|
7
7
|
Omit the ref Resolve the unique active task for the current branch.
|
|
8
|
-
|
|
9
|
-
TASK-YYYYMMDD-HHMMSS Locates a task in active / blocked / completed / archive.
|
|
8
|
+
--task/-t <ref> Bare numeric short id, or a full TASK-YYYYMMDD-HHMMSS id.
|
|
10
9
|
`;
|
|
11
10
|
function show(args = []) {
|
|
12
11
|
if (args[0] === '--help' || args[0] === '-h') {
|
|
@@ -22,12 +21,12 @@ function show(args = []) {
|
|
|
22
21
|
process.exitCode = 1;
|
|
23
22
|
return;
|
|
24
23
|
}
|
|
25
|
-
if (scope.positionals.length >
|
|
26
|
-
process.stderr.write('ai task show: task ref
|
|
24
|
+
if (scope.positionals.length > 0) {
|
|
25
|
+
process.stderr.write('ai task show: positional task ref is not supported; use --task <ref> or -t <ref>\n');
|
|
27
26
|
process.exitCode = 1;
|
|
28
27
|
return;
|
|
29
28
|
}
|
|
30
|
-
const resolved = resolveTaskContext(scope.taskRef
|
|
29
|
+
const resolved = resolveTaskContext(scope.taskRef);
|
|
31
30
|
if (!resolved.ok) {
|
|
32
31
|
process.stderr.write(`ai task show: ${resolved.message}\n`);
|
|
33
32
|
process.exitCode = 1;
|
|
@@ -8,15 +8,15 @@ import { enumerateArtifacts } from '../artifacts.js';
|
|
|
8
8
|
import { parseTaskFrontmatter, extractTitle } from '../frontmatter.js';
|
|
9
9
|
import { loadShortIdByTaskId } from '../short-id.js';
|
|
10
10
|
import { getOpenWorkflowWarnings, formatWorkflowWarningSummary } from '../workflow-warnings.js';
|
|
11
|
-
import { parseActivityLog, pairEntries } from '../activity-log.js';
|
|
11
|
+
import { parseActivityLog, pairEntries, startedBackedRows } from '../activity-log.js';
|
|
12
12
|
import { readRun } from '../orchestration.js';
|
|
13
13
|
import { statusCard } from '../../server/display.js';
|
|
14
|
-
const USAGE = `Usage: ai task status [
|
|
14
|
+
const USAGE = `Usage: ai task status [--task <ref> | -t <ref>]
|
|
15
15
|
|
|
16
16
|
Prints an aggregated "health check" view for a task: header, metadata,
|
|
17
17
|
artifacts, workflow/runtime execution state, and git branch state.
|
|
18
|
-
Omit
|
|
19
|
-
<ref>
|
|
18
|
+
Omit the scope Resolve the unique active task for the current branch.
|
|
19
|
+
--task/-t <ref> Bare numeric short id, or a full TASK-YYYYMMDD-HHMMSS id.
|
|
20
20
|
|
|
21
21
|
Git rows are best-effort: a failed git call degrades that row to '-' without
|
|
22
22
|
failing the command.
|
|
@@ -155,7 +155,7 @@ function collectWorkflow(content, now = new Date()) {
|
|
|
155
155
|
if (!parsed.sectionFound || parsed.entries.length === 0) {
|
|
156
156
|
return { state: 'unknown', step: DASH, agent: DASH, startedAt: DASH, doneAt: DASH, stale: DASH };
|
|
157
157
|
}
|
|
158
|
-
const rows = pairEntries(parsed.entries);
|
|
158
|
+
const rows = startedBackedRows(pairEntries(parsed.entries));
|
|
159
159
|
const latest = rows.at(-1);
|
|
160
160
|
if (!latest) {
|
|
161
161
|
return { state: 'unknown', step: DASH, agent: DASH, startedAt: DASH, doneAt: DASH, stale: DASH };
|
|
@@ -431,10 +431,10 @@ function status(args = []) {
|
|
|
431
431
|
let model;
|
|
432
432
|
try {
|
|
433
433
|
const scope = parseTaskScope(args);
|
|
434
|
-
if (scope.positionals.length >
|
|
435
|
-
throw new Error('task ref
|
|
434
|
+
if (scope.positionals.length > 0) {
|
|
435
|
+
throw new Error('positional task ref is not supported; use --task <ref> or -t <ref>');
|
|
436
436
|
}
|
|
437
|
-
const resolved = resolveTaskContext(scope.taskRef
|
|
437
|
+
const resolved = resolveTaskContext(scope.taskRef);
|
|
438
438
|
if (!resolved.ok)
|
|
439
439
|
throw new Error(resolved.message);
|
|
440
440
|
model = buildFromResolved({
|
|
@@ -82,12 +82,12 @@ function boundTask(input, taskId, taskDir, taskMdPath, repoRoot, state) {
|
|
|
82
82
|
function validateCommon(input, branch) {
|
|
83
83
|
if (!input.message.trim())
|
|
84
84
|
return { code: 'GIT_COMMIT_INPUT_INVALID', message: 'Commit message is required' };
|
|
85
|
-
if (input.paths.length === 0 && !input.push)
|
|
86
|
-
return { code: 'GIT_COMMIT_INPUT_INVALID', message: 'At least one explicit path is required unless this is a push-only retry' };
|
|
87
85
|
if (!/^[a-f0-9]{40,64}$/.test(input.expectedHead))
|
|
88
86
|
return { code: 'GIT_HEAD_EXPECTATION_REQUIRED', message: 'A valid expected HEAD is required' };
|
|
89
87
|
if (!/^[a-f0-9]{40,64}$/.test(input.expectedTree))
|
|
90
88
|
return { code: 'GIT_TREE_EXPECTATION_REQUIRED', message: 'A valid expected tree is required' };
|
|
89
|
+
if (!input.push)
|
|
90
|
+
return { code: 'GIT_PUSH_INPUT_INVALID', message: 'Commit delivery requires a push policy' };
|
|
91
91
|
if (input.paths.some((candidate) => !candidate || candidate.startsWith('/') || candidate.split(/[\\/]/).includes('..'))) {
|
|
92
92
|
return { code: 'GIT_COMMIT_INPUT_INVALID', message: 'Commit paths must stay inside the repository' };
|
|
93
93
|
}
|
|
@@ -96,13 +96,11 @@ function validateCommon(input, branch) {
|
|
|
96
96
|
}
|
|
97
97
|
if (branch !== null && branch === '')
|
|
98
98
|
return { code: 'GIT_BRANCH_INVALID', message: 'A named branch is required' };
|
|
99
|
-
if (input.push)
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return { code: 'GIT_PUSH_INPUT_INVALID', message: 'Push ref must be the current full heads ref' };
|
|
105
|
-
}
|
|
99
|
+
if (!input.push.remote || input.push.refs.length !== 1)
|
|
100
|
+
return { code: 'GIT_PUSH_INPUT_INVALID', message: 'Push requires one remote and one ref' };
|
|
101
|
+
const ref = input.push.refs[0] ?? '';
|
|
102
|
+
if (!HEAD_REF.test(ref) || HEAD_REF.exec(ref)?.[1] !== branch) {
|
|
103
|
+
return { code: 'GIT_PUSH_INPUT_INVALID', message: 'Push ref must be the current full heads ref' };
|
|
106
104
|
}
|
|
107
105
|
return null;
|
|
108
106
|
}
|
|
@@ -253,22 +251,20 @@ function executeUnlocked(input, task, mode) {
|
|
|
253
251
|
}
|
|
254
252
|
let status = committed.status;
|
|
255
253
|
let result = committed.status === 'applied' ? 'committed' : 'no_op';
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
warnings.push(warning('COMMIT_PUSH_FAILED', pushed.error?.message ?? 'Git push failed', true, 'push', target, 'ACTION_REQUIRED'));
|
|
271
|
-
}
|
|
254
|
+
const target = `${input.push.remote}:${input.push.refs[0]}`;
|
|
255
|
+
const decision = commitPushDecision({ branch }, target);
|
|
256
|
+
if (!decision.shouldPush) {
|
|
257
|
+
warnings.push(decision.warning);
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
const pushed = pushGitRefs({
|
|
261
|
+
cwd: input.cwd,
|
|
262
|
+
remote: input.push.remote,
|
|
263
|
+
refs: input.push.refs,
|
|
264
|
+
expectedSha: committed.snapshot?.head ?? gitText(input.cwd, ['rev-parse', 'HEAD'])
|
|
265
|
+
});
|
|
266
|
+
if (pushed.status !== 'applied')
|
|
267
|
+
warnings.push(warning('COMMIT_PUSH_FAILED', pushed.error?.message ?? 'Git push failed', true, 'push', target, 'ACTION_REQUIRED'));
|
|
272
268
|
}
|
|
273
269
|
if (warnings.length > 0) {
|
|
274
270
|
status = 'applied';
|