@sayknow-cli/coding-agent 0.5.11 → 0.5.14
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/CHANGELOG.md +35 -0
- package/dist/types/cli/setup-cli.d.ts +1 -1
- package/dist/types/config/file-lock.d.ts +8 -0
- package/dist/types/config/model-registry.d.ts +1 -0
- package/dist/types/config/models-config-schema.d.ts +2 -0
- package/dist/types/defaults/skc-ui-skills.d.ts +12 -0
- package/dist/types/hooks/ui-skill-keywords.d.ts +84 -0
- package/dist/types/session-import/redact.d.ts +1 -1
- package/dist/types/setup/external-ui-skills.d.ts +37 -0
- package/dist/types/skc-runtime/ultragoal-runtime.d.ts +13 -1
- package/dist/types/skc-runtime/ultragoal-succession.d.ts +251 -0
- package/dist/types/skc-runtime/workflow-placeholder.d.ts +6 -0
- package/package.json +7 -7
- package/src/cli/setup-cli.ts +22 -1
- package/src/cli/skills-cli.ts +29 -10
- package/src/commands/setup.ts +1 -0
- package/src/config/file-lock-gc.ts +39 -2
- package/src/config/file-lock.ts +22 -1
- package/src/config/model-registry.ts +116 -40
- package/src/config/models-config-schema.ts +1 -0
- package/src/defaults/skc/skills/ultragoal/SKILL.md +3 -0
- package/src/defaults/skc/ui-skills/LICENSE.appllama +21 -0
- package/src/defaults/skc/ui-skills/LICENSE.emilkowalski +21 -0
- package/src/defaults/skc/ui-skills/NOTICE.md +43 -0
- package/src/defaults/skc/ui-skills/animate/SKILL.md +536 -0
- package/src/defaults/skc/ui-skills/animation-vocabulary/SKILL.md +178 -0
- package/src/defaults/skc/ui-skills/apple-design/SKILL.md +285 -0
- package/src/defaults/skc/ui-skills/appllama-app-design-skill/SKILL.md +821 -0
- package/src/defaults/skc/ui-skills/ask-sonner/SKILL.md +157 -0
- package/src/defaults/skc/ui-skills/emil-design-eng/SKILL.md +671 -0
- package/src/defaults/skc/ui-skills/find-animation-opportunities/SKILL.md +137 -0
- package/src/defaults/skc/ui-skills/improve-animations/SKILL.md +305 -0
- package/src/defaults/skc/ui-skills/mobile-native/SKILL.md +308 -0
- package/src/defaults/skc/ui-skills/pick-ui-library/SKILL.md +82 -0
- package/src/defaults/skc/ui-skills/prototype/SKILL.md +300 -0
- package/src/defaults/skc/ui-skills/react-bits/SKILL.md +113 -0
- package/src/defaults/skc/ui-skills/review-animations/SKILL.md +312 -0
- package/src/defaults/skc-ui-skills.ts +108 -0
- package/src/extensibility/runtime-skill-discovery.ts +8 -2
- package/src/hooks/native-skill-hook.ts +14 -0
- package/src/hooks/ui-skill-keywords.ts +312 -0
- package/src/internal-urls/docs-index.generated.ts +1 -1
- package/src/prompts/agents/architect.md +1 -0
- package/src/prompts/agents/critic.md +1 -0
- package/src/prompts/agents/executor.md +1 -0
- package/src/prompts/agents/planner.md +1 -0
- package/src/prompts/system/system-prompt.md +1 -0
- package/src/prompts/tools/skill.md +2 -2
- package/src/sdk/session.ts +7 -5
- package/src/session-import/redact.ts +11 -3
- package/src/setup/external-ui-skills.ts +132 -0
- package/src/skc-runtime/state-writer.ts +24 -27
- package/src/skc-runtime/ultragoal-runtime.ts +125 -45
- package/src/skc-runtime/ultragoal-succession.ts +1667 -0
- package/src/skc-runtime/workflow-placeholder.ts +33 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Install the frontend UI skills SKC routes to but cannot bundle.
|
|
3
|
+
*
|
|
4
|
+
* Most UI craft skills are compiled into the binary (see
|
|
5
|
+
* `defaults/skc-ui-skills.ts`). A few upstreams license their content for use
|
|
6
|
+
* but forbid redistributing the collection, so SKC must not carry them. For
|
|
7
|
+
* those, this installs upstream's own published payload into the project, where
|
|
8
|
+
* SKC's skill discovery picks it up like any other project skill.
|
|
9
|
+
*
|
|
10
|
+
* Target is `<project>/.agents/skills/<name>/`, which SKC's agents provider
|
|
11
|
+
* loads on the project walk-up.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import * as path from "node:path";
|
|
15
|
+
import { EXTERNAL_UI_SKILL_DEFINITIONS } from "../hooks/ui-skill-keywords";
|
|
16
|
+
|
|
17
|
+
export type ExternalUiSkillStatus = "installed" | "already-present" | "failed" | "missing";
|
|
18
|
+
|
|
19
|
+
export interface ExternalUiSkillResult {
|
|
20
|
+
skill: string;
|
|
21
|
+
source: string;
|
|
22
|
+
status: ExternalUiSkillStatus;
|
|
23
|
+
path: string;
|
|
24
|
+
detail?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface ExternalUiSkillsReport {
|
|
28
|
+
projectDir: string;
|
|
29
|
+
installed: number;
|
|
30
|
+
alreadyPresent: number;
|
|
31
|
+
failed: number;
|
|
32
|
+
missing: number;
|
|
33
|
+
skills: ExternalUiSkillResult[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface InstallExternalUiSkillsOptions {
|
|
37
|
+
cwd: string;
|
|
38
|
+
/** Report what would happen without running any installer. */
|
|
39
|
+
check?: boolean;
|
|
40
|
+
/** Reinstall even when the skill is already present. */
|
|
41
|
+
force?: boolean;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function installedSkillPath(cwd: string, skill: string): string {
|
|
45
|
+
return path.join(cwd, ".agents", "skills", skill, "SKILL.md");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export async function installExternalUiSkills(
|
|
49
|
+
options: InstallExternalUiSkillsOptions,
|
|
50
|
+
): Promise<ExternalUiSkillsReport> {
|
|
51
|
+
const cwd = path.resolve(options.cwd);
|
|
52
|
+
const skills: ExternalUiSkillResult[] = [];
|
|
53
|
+
|
|
54
|
+
for (const definition of EXTERNAL_UI_SKILL_DEFINITIONS) {
|
|
55
|
+
const target = installedSkillPath(cwd, definition.skill);
|
|
56
|
+
const present = await Bun.file(target).exists();
|
|
57
|
+
|
|
58
|
+
if (present && !options.force) {
|
|
59
|
+
skills.push({ skill: definition.skill, source: definition.source, status: "already-present", path: target });
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (options.check) {
|
|
63
|
+
skills.push({
|
|
64
|
+
skill: definition.skill,
|
|
65
|
+
source: definition.source,
|
|
66
|
+
status: "missing",
|
|
67
|
+
path: target,
|
|
68
|
+
detail: definition.installCommand,
|
|
69
|
+
});
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Upstream's own publisher CLI. SKC never republishes the payload; it only
|
|
74
|
+
// runs the documented install into the user's project.
|
|
75
|
+
const proc = Bun.spawn(["sh", "-c", definition.installCommand], {
|
|
76
|
+
cwd,
|
|
77
|
+
stdout: "pipe",
|
|
78
|
+
stderr: "pipe",
|
|
79
|
+
});
|
|
80
|
+
const [stderr, exitCode] = await Promise.all([new Response(proc.stderr).text(), proc.exited]);
|
|
81
|
+
const landed = await Bun.file(target).exists();
|
|
82
|
+
|
|
83
|
+
if (exitCode === 0 && landed) {
|
|
84
|
+
skills.push({ skill: definition.skill, source: definition.source, status: "installed", path: target });
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
skills.push({
|
|
88
|
+
skill: definition.skill,
|
|
89
|
+
source: definition.source,
|
|
90
|
+
status: "failed",
|
|
91
|
+
path: target,
|
|
92
|
+
detail:
|
|
93
|
+
exitCode !== 0
|
|
94
|
+
? `installer exited ${exitCode}: ${stderr.trim().split("\n").at(-1) ?? "no output"}`
|
|
95
|
+
: "installer reported success but no SKILL.md landed",
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
projectDir: cwd,
|
|
101
|
+
installed: skills.filter(entry => entry.status === "installed").length,
|
|
102
|
+
alreadyPresent: skills.filter(entry => entry.status === "already-present").length,
|
|
103
|
+
failed: skills.filter(entry => entry.status === "failed").length,
|
|
104
|
+
missing: skills.filter(entry => entry.status === "missing").length,
|
|
105
|
+
skills,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function formatExternalUiSkillsReport(report: ExternalUiSkillsReport): string {
|
|
110
|
+
const lines: string[] = [];
|
|
111
|
+
for (const entry of report.skills) {
|
|
112
|
+
const relative = path.relative(report.projectDir, entry.path) || entry.path;
|
|
113
|
+
switch (entry.status) {
|
|
114
|
+
case "installed":
|
|
115
|
+
lines.push(`installed ${entry.skill} -> ${relative}`);
|
|
116
|
+
break;
|
|
117
|
+
case "already-present":
|
|
118
|
+
lines.push(`present ${entry.skill} -> ${relative}`);
|
|
119
|
+
break;
|
|
120
|
+
case "missing":
|
|
121
|
+
lines.push(`missing ${entry.skill} (run: ${entry.detail})`);
|
|
122
|
+
break;
|
|
123
|
+
case "failed":
|
|
124
|
+
lines.push(`failed ${entry.skill}: ${entry.detail}`);
|
|
125
|
+
break;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
lines.push(
|
|
129
|
+
`${report.installed} installed, ${report.alreadyPresent} already present, ${report.missing} missing, ${report.failed} failed.`,
|
|
130
|
+
);
|
|
131
|
+
return lines.join("\n");
|
|
132
|
+
}
|
|
@@ -515,38 +515,35 @@ async function writeGuardedResolvedJsonAtomic(
|
|
|
515
515
|
value: unknown,
|
|
516
516
|
options: GuardedStateWriterOptions,
|
|
517
517
|
): Promise<GuardedWriteResult> {
|
|
518
|
-
|
|
519
|
-
filePath
|
|
520
|
-
|
|
521
|
-
const current = await readJsonIfPresentTolerant(filePath);
|
|
522
|
-
const currentRevision = persistedStateRevision(current);
|
|
523
|
-
|
|
524
|
-
if (options.policy === "source") {
|
|
525
|
-
if (options.expectedRevision !== undefined && options.expectedRevision !== currentRevision) {
|
|
526
|
-
throw new StateWriteConflictError(filePath, options.expectedRevision, currentRevision);
|
|
527
|
-
}
|
|
528
|
-
const next = stampStateRevision(withWorkflowReceipt(value, buildReceipt(options)), currentRevision + 1);
|
|
529
|
-
await atomicWrite(filePath, jsonText(next));
|
|
530
|
-
await maybeAudit(filePath, options);
|
|
531
|
-
return { path: filePath, written: true, revision: currentRevision + 1, stamped: next };
|
|
532
|
-
}
|
|
518
|
+
const write = async (): Promise<GuardedWriteResult> => {
|
|
519
|
+
const current = await readJsonIfPresentTolerant(filePath);
|
|
520
|
+
const currentRevision = persistedStateRevision(current);
|
|
533
521
|
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
return { path: filePath, written: false, reason: "stale-skip", revision: currentRevision };
|
|
522
|
+
if (options.policy === "source") {
|
|
523
|
+
if (options.expectedRevision !== undefined && options.expectedRevision !== currentRevision) {
|
|
524
|
+
throw new StateWriteConflictError(filePath, options.expectedRevision, currentRevision);
|
|
538
525
|
}
|
|
539
|
-
const next = stampStateRevision(
|
|
540
|
-
withWorkflowReceipt(value, buildReceipt(options)),
|
|
541
|
-
currentRevision + 1,
|
|
542
|
-
incomingSourceRevision,
|
|
543
|
-
);
|
|
526
|
+
const next = stampStateRevision(withWorkflowReceipt(value, buildReceipt(options)), currentRevision + 1);
|
|
544
527
|
await atomicWrite(filePath, jsonText(next));
|
|
545
528
|
await maybeAudit(filePath, options);
|
|
546
529
|
return { path: filePath, written: true, revision: currentRevision + 1, stamped: next };
|
|
547
|
-
}
|
|
548
|
-
|
|
549
|
-
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
const incomingSourceRevision =
|
|
533
|
+
options.sourceRevision ?? (isPlainObject(value) ? persistedStateRevision(value) : 0);
|
|
534
|
+
if (current !== undefined && incomingSourceRevision <= persistedSourceRevision(current)) {
|
|
535
|
+
return { path: filePath, written: false, reason: "stale-skip", revision: currentRevision };
|
|
536
|
+
}
|
|
537
|
+
const next = stampStateRevision(
|
|
538
|
+
withWorkflowReceipt(value, buildReceipt(options)),
|
|
539
|
+
currentRevision + 1,
|
|
540
|
+
incomingSourceRevision,
|
|
541
|
+
);
|
|
542
|
+
await atomicWrite(filePath, jsonText(next));
|
|
543
|
+
await maybeAudit(filePath, options);
|
|
544
|
+
return { path: filePath, written: true, revision: currentRevision + 1, stamped: next };
|
|
545
|
+
};
|
|
546
|
+
return options.lockHeld ? write() : lockResolvedWorkflowTarget(filePath, write, options.lock);
|
|
550
547
|
}
|
|
551
548
|
|
|
552
549
|
export async function writeGuardedJsonAtomic(
|
|
@@ -31,6 +31,11 @@ import {
|
|
|
31
31
|
validateDeferredMemberReceiptFresh,
|
|
32
32
|
validateReceiptFreshBase,
|
|
33
33
|
} from "./ultragoal-receipt-freshness";
|
|
34
|
+
import {
|
|
35
|
+
assertUltragoalAdoptionPublished,
|
|
36
|
+
assertUltragoalGoalNotFenced,
|
|
37
|
+
runUltragoalSuccessionCommand,
|
|
38
|
+
} from "./ultragoal-succession";
|
|
34
39
|
|
|
35
40
|
export {
|
|
36
41
|
CRITIC_GATE_HARD_STOP_EVENT,
|
|
@@ -600,7 +605,12 @@ export async function recordUltragoalNudgeIfBudgetRemaining(input: {
|
|
|
600
605
|
);
|
|
601
606
|
}
|
|
602
607
|
|
|
603
|
-
export async function writePlan(
|
|
608
|
+
export async function writePlan(
|
|
609
|
+
cwd: string,
|
|
610
|
+
plan: UltragoalPlan,
|
|
611
|
+
sessionId?: string | null,
|
|
612
|
+
options: { lockHeld?: boolean } = {},
|
|
613
|
+
): Promise<void> {
|
|
604
614
|
const resolvedSessionId =
|
|
605
615
|
sessionId?.trim() || resolveSkcSessionForWrite(cwd, { envSessionId: process.env.SKC_SESSION_ID }).skcSessionId;
|
|
606
616
|
const paths = getUltragoalPaths(cwd, resolvedSessionId);
|
|
@@ -611,12 +621,32 @@ export async function writePlan(cwd: string, plan: UltragoalPlan, sessionId?: st
|
|
|
611
621
|
await writeGuardedJsonAtomic(paths.goalsPath, plan, {
|
|
612
622
|
cwd,
|
|
613
623
|
policy: "source",
|
|
624
|
+
lockHeld: options.lockHeld === true,
|
|
614
625
|
expectedRevision: typeof plan.state_revision === "number" ? persistedStateRevision(plan) : undefined,
|
|
615
626
|
audit: { category: "state", verb: "write", owner: "skc-runtime", sessionId: resolvedSessionId },
|
|
616
627
|
});
|
|
617
628
|
await writeSessionActivityMarker(cwd, resolvedSessionId, { writer: "ultragoal-runtime", path: paths.goalsPath });
|
|
618
629
|
}
|
|
619
630
|
|
|
631
|
+
/**
|
|
632
|
+
* The single exclusion that decides who owns an Ultragoal run.
|
|
633
|
+
*
|
|
634
|
+
* Establishing ownership is a read-decide-write sequence: a start reads the plan,
|
|
635
|
+
* checks the outgoing succession fence, then commits `active`. Every caller that
|
|
636
|
+
* decides ownership — source admission, succession offer, and successor
|
|
637
|
+
* publication — runs that decision inside this lock, keyed on the plan.
|
|
638
|
+
*/
|
|
639
|
+
export async function withUltragoalPlanOwnership<T>(cwd: string, sessionId: string, fn: () => Promise<T>): Promise<T> {
|
|
640
|
+
return withWorkflowStateLock(getUltragoalPaths(cwd, sessionId).goalsPath, fn, { cwd });
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
export async function resolveUltragoalOwnershipSession(cwd: string, sessionId?: string | null): Promise<string> {
|
|
644
|
+
return (
|
|
645
|
+
sessionId?.trim() ||
|
|
646
|
+
(await resolveSkcSessionForRead(cwd, { envSessionId: process.env.SKC_SESSION_ID })).skcSessionId
|
|
647
|
+
);
|
|
648
|
+
}
|
|
649
|
+
|
|
620
650
|
function chooseReceiptKind(
|
|
621
651
|
plan: UltragoalPlan,
|
|
622
652
|
ledger: readonly UltragoalLedgerEvent[],
|
|
@@ -1710,40 +1740,44 @@ export async function startNextUltragoalGoal(input: {
|
|
|
1710
1740
|
allComplete: boolean;
|
|
1711
1741
|
nextAction: UltragoalCompleteNextAction;
|
|
1712
1742
|
}> {
|
|
1713
|
-
const
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
const
|
|
1743
|
+
const sessionId = await resolveUltragoalOwnershipSession(input.cwd, input.sessionId);
|
|
1744
|
+
return withUltragoalPlanOwnership(input.cwd, sessionId, async () => {
|
|
1745
|
+
const plan = await readUltragoalPlan(input.cwd, sessionId);
|
|
1746
|
+
if (!plan) throw new Error("No ultragoal plan found. Run `skc ultragoal create-goals --brief ...` first.");
|
|
1747
|
+
if (!plan.repositoryBinding) {
|
|
1748
|
+
throw new Error(
|
|
1749
|
+
"Ultragoal plan is missing repositoryBinding; recreate goals so the plan is bound to an authoritative repository identity.",
|
|
1750
|
+
);
|
|
1751
|
+
}
|
|
1752
|
+
await assertCwdMatchesRepositoryBinding(input.cwd, plan.repositoryBinding);
|
|
1753
|
+
await assertUltragoalAdoptionPublished(input.cwd, sessionId);
|
|
1754
|
+
const retryFailed = input.retryFailed === true;
|
|
1755
|
+
const goal = chooseNextGoal(plan, retryFailed);
|
|
1756
|
+
if (goal) await assertUltragoalGoalNotFenced(input.cwd, sessionId, goal.id);
|
|
1757
|
+
if (!goal) {
|
|
1758
|
+
const state = getUltragoalRunCompletionState(plan, { retryFailed });
|
|
1759
|
+
return {
|
|
1760
|
+
plan,
|
|
1761
|
+
allComplete: state.allComplete,
|
|
1762
|
+
nextAction: resolveUltragoalCompleteNextAction(plan, { retryFailed }),
|
|
1763
|
+
};
|
|
1764
|
+
}
|
|
1765
|
+
if (goal.status !== "active") {
|
|
1766
|
+
const now = new Date().toISOString();
|
|
1767
|
+
goal.status = "active";
|
|
1768
|
+
goal.startedAt = goal.startedAt ?? now;
|
|
1769
|
+
goal.updatedAt = now;
|
|
1770
|
+
plan.updatedAt = now;
|
|
1771
|
+
await writePlan(input.cwd, plan, sessionId, { lockHeld: true });
|
|
1772
|
+
await appendLedger(input.cwd, { event: "goal_started", goalId: goal.id }, sessionId);
|
|
1773
|
+
}
|
|
1726
1774
|
return {
|
|
1727
1775
|
plan,
|
|
1728
|
-
|
|
1729
|
-
|
|
1776
|
+
goal,
|
|
1777
|
+
allComplete: false,
|
|
1778
|
+
nextAction: { kind: "execute-goal", goal },
|
|
1730
1779
|
};
|
|
1731
|
-
}
|
|
1732
|
-
if (goal.status !== "active") {
|
|
1733
|
-
const now = new Date().toISOString();
|
|
1734
|
-
goal.status = "active";
|
|
1735
|
-
goal.startedAt = goal.startedAt ?? now;
|
|
1736
|
-
goal.updatedAt = now;
|
|
1737
|
-
plan.updatedAt = now;
|
|
1738
|
-
await writePlan(input.cwd, plan, input.sessionId);
|
|
1739
|
-
await appendLedger(input.cwd, { event: "goal_started", goalId: goal.id }, input.sessionId);
|
|
1740
|
-
}
|
|
1741
|
-
return {
|
|
1742
|
-
plan,
|
|
1743
|
-
goal,
|
|
1744
|
-
allComplete: false,
|
|
1745
|
-
nextAction: { kind: "execute-goal", goal },
|
|
1746
|
-
};
|
|
1780
|
+
});
|
|
1747
1781
|
}
|
|
1748
1782
|
|
|
1749
1783
|
async function readStructuredValue(cwd: string, value: string): Promise<unknown> {
|
|
@@ -3046,10 +3080,13 @@ export async function checkpointUltragoalGoal(input: {
|
|
|
3046
3080
|
evidence: string;
|
|
3047
3081
|
qualityGateJson?: string;
|
|
3048
3082
|
}): Promise<UltragoalPlan> {
|
|
3049
|
-
const
|
|
3083
|
+
const sessionId = await resolveUltragoalOwnershipSession(input.cwd, null);
|
|
3084
|
+
const plan = await readUltragoalPlan(input.cwd, sessionId);
|
|
3050
3085
|
if (!plan) throw new Error("No ultragoal plan found. Run `skc ultragoal create-goals --brief ...` first.");
|
|
3051
3086
|
const goal = plan.goals.find(item => item.id === input.goalId);
|
|
3052
3087
|
if (!goal) throw new Error(`No ultragoal goal found for ${input.goalId}.`);
|
|
3088
|
+
await assertUltragoalAdoptionPublished(input.cwd, sessionId);
|
|
3089
|
+
await assertUltragoalGoalNotFenced(input.cwd, sessionId, goal.id);
|
|
3053
3090
|
const evidence = input.evidence.trim();
|
|
3054
3091
|
if (!evidence) throw new Error("checkpoint evidence is required");
|
|
3055
3092
|
const ledgerBefore = await readUltragoalLedger(input.cwd);
|
|
@@ -3209,17 +3246,21 @@ export async function checkpointUltragoalGoal(input: {
|
|
|
3209
3246
|
goal.updatedAt = now;
|
|
3210
3247
|
if (input.status === "complete") goal.completedAt = now;
|
|
3211
3248
|
plan.updatedAt = now;
|
|
3212
|
-
await
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3249
|
+
await withUltragoalPlanOwnership(input.cwd, sessionId, async () => {
|
|
3250
|
+
await assertUltragoalAdoptionPublished(input.cwd, sessionId);
|
|
3251
|
+
await assertUltragoalGoalNotFenced(input.cwd, sessionId, goal.id);
|
|
3252
|
+
await writePlan(input.cwd, plan, sessionId, { lockHeld: true });
|
|
3253
|
+
const persistedPlan = await readUltragoalPlan(input.cwd, sessionId);
|
|
3254
|
+
if (persistedPlan?.state_revision !== undefined) plan.state_revision = persistedPlan.state_revision;
|
|
3255
|
+
await appendLedger(input.cwd, {
|
|
3256
|
+
eventId: pendingCheckpointEventId,
|
|
3257
|
+
event: "goal_checkpointed",
|
|
3258
|
+
goalId: goal.id,
|
|
3259
|
+
status: input.status,
|
|
3260
|
+
evidence,
|
|
3261
|
+
qualityGateJson,
|
|
3262
|
+
completionVerification: goal.completionVerification,
|
|
3263
|
+
});
|
|
3223
3264
|
});
|
|
3224
3265
|
return plan;
|
|
3225
3266
|
}
|
|
@@ -4155,6 +4196,10 @@ const FLAGS_WITH_VALUES = new Set([
|
|
|
4155
4196
|
"--review-result-json",
|
|
4156
4197
|
"--qa-result-json",
|
|
4157
4198
|
"--target-state-json",
|
|
4199
|
+
"--target-repo",
|
|
4200
|
+
"--authorize",
|
|
4201
|
+
"--authorized-by",
|
|
4202
|
+
"--offer",
|
|
4158
4203
|
]);
|
|
4159
4204
|
|
|
4160
4205
|
function isHelpArg(arg: string): boolean {
|
|
@@ -4283,6 +4328,36 @@ function renderUltragoalHelp(args: readonly string[]): string | null {
|
|
|
4283
4328
|
"",
|
|
4284
4329
|
].join("\n");
|
|
4285
4330
|
}
|
|
4331
|
+
if (subject === "succession") {
|
|
4332
|
+
return [
|
|
4333
|
+
"Run native SKC Ultragoal workflow commands",
|
|
4334
|
+
"",
|
|
4335
|
+
"USAGE",
|
|
4336
|
+
" $ skc ultragoal succession offer --target-repo <path> --goal-id <id> [--goal-id <id> ...] --authorize <statement> --authorized-by <identity> [--json]",
|
|
4337
|
+
" $ skc ultragoal succession adopt --offer <path> [--skc-goal-mode aggregate|per-story] [--json]",
|
|
4338
|
+
" $ skc ultragoal succession status [--json]",
|
|
4339
|
+
"",
|
|
4340
|
+
"FLAGS",
|
|
4341
|
+
" --target-repo=<value> Destination repository for the successor run; never the source repository",
|
|
4342
|
+
" --goal-id=<value> Unfinished source goal to hand off (repeatable; no implicit or wildcard selection)",
|
|
4343
|
+
" --authorize=<value> Required. Explicit bounded authorization statement for this source/target/selection",
|
|
4344
|
+
" --authorized-by=<value> Required. Identity that authorized the handoff",
|
|
4345
|
+
" --offer=<value> Offer document recorded by `succession offer`, read from inside the source worktree",
|
|
4346
|
+
" --skc-goal-mode=<value> Successor validation mode (default aggregate); the source mode is provenance only",
|
|
4347
|
+
" --json Output a machine-readable receipt",
|
|
4348
|
+
"",
|
|
4349
|
+
"OWNERSHIP",
|
|
4350
|
+
" `offer` records a durable outgoing ownership fence, so the source run stops scheduling and checkpointing the",
|
|
4351
|
+
" selected goals immediately — not when the target happens to adopt. Between offer and adoption no run owns them.",
|
|
4352
|
+
" The source brief, goals and ledger are never written. Goals the offer did not select stay schedulable.",
|
|
4353
|
+
" There is deliberately no `revoke` verb: an unadopted offer keeps its goals fenced.",
|
|
4354
|
+
"",
|
|
4355
|
+
"EXAMPLES",
|
|
4356
|
+
' $ skc ultragoal succession offer --target-repo ../payments-api --goal-id G002 --goal-id G003 --authorize "leader approved moving the refund stories" --authorized-by human:release-lead --json',
|
|
4357
|
+
" $ skc ultragoal succession adopt --offer ../plan-repo/.skc/_session-abc/ultragoal/succession/offer-<id>.json --json",
|
|
4358
|
+
"",
|
|
4359
|
+
].join("\n");
|
|
4360
|
+
}
|
|
4286
4361
|
|
|
4287
4362
|
return [
|
|
4288
4363
|
"Run native SKC Ultragoal workflow commands",
|
|
@@ -4305,8 +4380,11 @@ function renderUltragoalHelp(args: readonly string[]): string | null {
|
|
|
4305
4380
|
" start-pipeline-overlap",
|
|
4306
4381
|
" join-pipeline-overlap",
|
|
4307
4382
|
" rebaseline-pipeline-overlap",
|
|
4383
|
+
" succession offer",
|
|
4384
|
+
" succession adopt",
|
|
4385
|
+
" succession status",
|
|
4308
4386
|
"",
|
|
4309
|
-
"Run `skc ultragoal checkpoint --help`, `skc ultragoal review --help`, `skc ultragoal classify-blocker --help`, `skc ultragoal record-critic-verdict --help`,
|
|
4387
|
+
"Run `skc ultragoal checkpoint --help`, `skc ultragoal review --help`, `skc ultragoal classify-blocker --help`, `skc ultragoal record-critic-verdict --help`, `skc ultragoal record-critic-gate-override --help`, or `skc ultragoal succession --help` for command-specific requirements.",
|
|
4310
4388
|
"",
|
|
4311
4389
|
].join("\n");
|
|
4312
4390
|
}
|
|
@@ -4846,6 +4924,8 @@ async function dispatchUltragoalCommand(args: string[], cwd: string): Promise<Ul
|
|
|
4846
4924
|
stdout: json ? renderCliWriteReceipt(receipt) : `Rebaselined pipeline overlap ${receipt.overlap_id}.\n`,
|
|
4847
4925
|
};
|
|
4848
4926
|
}
|
|
4927
|
+
case "succession":
|
|
4928
|
+
return await runUltragoalSuccessionCommand(args, cwd);
|
|
4849
4929
|
default:
|
|
4850
4930
|
return { status: 1, stderr: `Unknown skc ultragoal command: ${command}\n` };
|
|
4851
4931
|
}
|