@cleocode/cleo 2026.5.87 → 2026.5.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +377 -353
- package/dist/cli/index.js.map +3 -3
- package/package.json +11 -11
package/dist/cli/index.js
CHANGED
|
@@ -1538,6 +1538,45 @@ var init_branch_lock = __esm({
|
|
|
1538
1538
|
}
|
|
1539
1539
|
});
|
|
1540
1540
|
|
|
1541
|
+
// packages/contracts/src/changesets.ts
|
|
1542
|
+
import { z as z3 } from "zod";
|
|
1543
|
+
var CHANGESET_KINDS, TASK_ID_RE, ChangesetEntrySchema;
|
|
1544
|
+
var init_changesets = __esm({
|
|
1545
|
+
"packages/contracts/src/changesets.ts"() {
|
|
1546
|
+
"use strict";
|
|
1547
|
+
CHANGESET_KINDS = [
|
|
1548
|
+
"feat",
|
|
1549
|
+
"fix",
|
|
1550
|
+
"perf",
|
|
1551
|
+
"refactor",
|
|
1552
|
+
"docs",
|
|
1553
|
+
"test",
|
|
1554
|
+
"chore",
|
|
1555
|
+
"breaking"
|
|
1556
|
+
];
|
|
1557
|
+
TASK_ID_RE = /^(T\d+(-[A-Z][A-Za-z0-9]*)?|E-\d+(-[A-Z][A-Za-z0-9]*)?)$/;
|
|
1558
|
+
ChangesetEntrySchema = z3.object({
|
|
1559
|
+
/** Filename slug (without the `.md` extension). */
|
|
1560
|
+
id: z3.string().min(1, "id must be non-empty").regex(/^[a-z0-9][a-z0-9-]*$/, "id must be kebab-case (lowercase, digits, hyphens)"),
|
|
1561
|
+
/** One or more CLEO task IDs this change is anchored to. */
|
|
1562
|
+
tasks: z3.array(z3.string().regex(TASK_ID_RE, "task ID must match T#### or E-#### format")).min(1, "tasks must contain at least one task ID"),
|
|
1563
|
+
/** Type of change. */
|
|
1564
|
+
kind: z3.enum(CHANGESET_KINDS),
|
|
1565
|
+
/** Single-line user-facing description. */
|
|
1566
|
+
summary: z3.string().min(1, "summary must be non-empty"),
|
|
1567
|
+
/** Linked PR numbers, when known. */
|
|
1568
|
+
prs: z3.array(z3.number().int().positive()).optional(),
|
|
1569
|
+
/** Markdown body — longer-form explanation. */
|
|
1570
|
+
notes: z3.string().optional(),
|
|
1571
|
+
/** Migration note. Required iff `kind === 'breaking'`. */
|
|
1572
|
+
breaking: z3.string().optional()
|
|
1573
|
+
}).refine((entry) => entry.kind !== "breaking" || (entry.breaking?.length ?? 0) > 0, {
|
|
1574
|
+
message: "breaking entries must include a non-empty `breaking` migration note",
|
|
1575
|
+
path: ["breaking"]
|
|
1576
|
+
});
|
|
1577
|
+
}
|
|
1578
|
+
});
|
|
1579
|
+
|
|
1541
1580
|
// packages/contracts/src/credentials.ts
|
|
1542
1581
|
var init_credentials = __esm({
|
|
1543
1582
|
"packages/contracts/src/credentials.ts"() {
|
|
@@ -1679,58 +1718,58 @@ var init_errors = __esm({
|
|
|
1679
1718
|
});
|
|
1680
1719
|
|
|
1681
1720
|
// packages/contracts/src/evidence-record-schema.ts
|
|
1682
|
-
import { z as
|
|
1721
|
+
import { z as z4 } from "zod";
|
|
1683
1722
|
var evidenceBaseSchema, implDiffRecordSchema, validateSpecCheckRecordSchema, testOutputRecordSchema, lintReportRecordSchema, commandOutputRecordSchema, evidenceRecordSchema;
|
|
1684
1723
|
var init_evidence_record_schema = __esm({
|
|
1685
1724
|
"packages/contracts/src/evidence-record-schema.ts"() {
|
|
1686
1725
|
"use strict";
|
|
1687
|
-
evidenceBaseSchema =
|
|
1726
|
+
evidenceBaseSchema = z4.object({
|
|
1688
1727
|
/** Identity string of the agent that produced this record. */
|
|
1689
|
-
agentIdentity:
|
|
1728
|
+
agentIdentity: z4.string().min(1),
|
|
1690
1729
|
/** SHA-256 hex digest (64 chars) of the attached artifact. */
|
|
1691
|
-
attachmentSha256:
|
|
1730
|
+
attachmentSha256: z4.string().length(64),
|
|
1692
1731
|
/** ISO 8601 timestamp at which the action ran. */
|
|
1693
|
-
ranAt:
|
|
1732
|
+
ranAt: z4.string().datetime(),
|
|
1694
1733
|
/** Wall-clock duration of the action in milliseconds. */
|
|
1695
|
-
durationMs:
|
|
1734
|
+
durationMs: z4.number().nonnegative()
|
|
1696
1735
|
});
|
|
1697
1736
|
implDiffRecordSchema = evidenceBaseSchema.extend({
|
|
1698
|
-
kind:
|
|
1699
|
-
phase:
|
|
1700
|
-
filesChanged:
|
|
1701
|
-
linesAdded:
|
|
1702
|
-
linesRemoved:
|
|
1737
|
+
kind: z4.literal("impl-diff"),
|
|
1738
|
+
phase: z4.literal("implement"),
|
|
1739
|
+
filesChanged: z4.array(z4.string().min(1)).min(1),
|
|
1740
|
+
linesAdded: z4.number().int().nonnegative(),
|
|
1741
|
+
linesRemoved: z4.number().int().nonnegative()
|
|
1703
1742
|
});
|
|
1704
1743
|
validateSpecCheckRecordSchema = evidenceBaseSchema.extend({
|
|
1705
|
-
kind:
|
|
1706
|
-
phase:
|
|
1707
|
-
reqIdsChecked:
|
|
1708
|
-
passed:
|
|
1709
|
-
details:
|
|
1744
|
+
kind: z4.literal("validate-spec-check"),
|
|
1745
|
+
phase: z4.literal("validate"),
|
|
1746
|
+
reqIdsChecked: z4.array(z4.string().min(1)).min(1),
|
|
1747
|
+
passed: z4.boolean(),
|
|
1748
|
+
details: z4.string().min(1)
|
|
1710
1749
|
});
|
|
1711
1750
|
testOutputRecordSchema = evidenceBaseSchema.extend({
|
|
1712
|
-
kind:
|
|
1713
|
-
phase:
|
|
1714
|
-
command:
|
|
1715
|
-
exitCode:
|
|
1716
|
-
testsPassed:
|
|
1717
|
-
testsFailed:
|
|
1751
|
+
kind: z4.literal("test-output"),
|
|
1752
|
+
phase: z4.literal("test"),
|
|
1753
|
+
command: z4.string().min(1),
|
|
1754
|
+
exitCode: z4.number().int(),
|
|
1755
|
+
testsPassed: z4.number().int().nonnegative(),
|
|
1756
|
+
testsFailed: z4.number().int().nonnegative()
|
|
1718
1757
|
});
|
|
1719
1758
|
lintReportRecordSchema = evidenceBaseSchema.extend({
|
|
1720
|
-
kind:
|
|
1721
|
-
phase:
|
|
1722
|
-
tool:
|
|
1723
|
-
passed:
|
|
1724
|
-
warnings:
|
|
1725
|
-
errors:
|
|
1759
|
+
kind: z4.literal("lint-report"),
|
|
1760
|
+
phase: z4.enum(["implement", "test"]),
|
|
1761
|
+
tool: z4.string().min(1),
|
|
1762
|
+
passed: z4.boolean(),
|
|
1763
|
+
warnings: z4.number().int().nonnegative(),
|
|
1764
|
+
errors: z4.number().int().nonnegative()
|
|
1726
1765
|
});
|
|
1727
1766
|
commandOutputRecordSchema = evidenceBaseSchema.extend({
|
|
1728
|
-
kind:
|
|
1729
|
-
phase:
|
|
1730
|
-
cmd:
|
|
1731
|
-
exitCode:
|
|
1767
|
+
kind: z4.literal("command-output"),
|
|
1768
|
+
phase: z4.enum(["implement", "validate", "test"]),
|
|
1769
|
+
cmd: z4.string().min(1),
|
|
1770
|
+
exitCode: z4.number().int()
|
|
1732
1771
|
});
|
|
1733
|
-
evidenceRecordSchema =
|
|
1772
|
+
evidenceRecordSchema = z4.discriminatedUnion("kind", [
|
|
1734
1773
|
implDiffRecordSchema,
|
|
1735
1774
|
validateSpecCheckRecordSchema,
|
|
1736
1775
|
testOutputRecordSchema,
|
|
@@ -2544,7 +2583,7 @@ var init_peer = __esm({
|
|
|
2544
2583
|
});
|
|
2545
2584
|
|
|
2546
2585
|
// packages/contracts/src/release/plan.ts
|
|
2547
|
-
import { z as
|
|
2586
|
+
import { z as z5 } from "zod";
|
|
2548
2587
|
var RELEASE_CHANNEL, RELEASE_SCHEME, RELEASE_KIND, RELEASE_STATUS, GATE_STATUS, GATE_NAME, PLATFORM_TUPLE, PUBLISHER, TASK_KIND, IMPACT, RESOLVED_SOURCE, ReleaseChannelSchema, ReleaseSchemeSchema, ReleaseKindSchema, ReleaseStatusSchema, GateStatusSchema, GateNameSchema, PlatformTupleSchema, PublisherSchema, TaskKindSchema, ImpactSchema, ResolvedSourceSchema, Iso8601, NonEmptyString, ReleasePlanTaskSchema, ReleaseGateSchema, ReleasePlatformMatrixEntrySchema, ReleasePreflightSummarySchema, ReleasePlanChangelogSchema, ReleasePlanMetaSchema, ReleasePlanSchema;
|
|
2549
2588
|
var init_plan = __esm({
|
|
2550
2589
|
"packages/contracts/src/release/plan.ts"() {
|
|
@@ -2587,20 +2626,20 @@ var init_plan = __esm({
|
|
|
2587
2626
|
];
|
|
2588
2627
|
IMPACT = ["major", "minor", "patch"];
|
|
2589
2628
|
RESOLVED_SOURCE = ["project-context", "language-default", "legacy-alias"];
|
|
2590
|
-
ReleaseChannelSchema =
|
|
2591
|
-
ReleaseSchemeSchema =
|
|
2592
|
-
ReleaseKindSchema =
|
|
2593
|
-
ReleaseStatusSchema =
|
|
2594
|
-
GateStatusSchema =
|
|
2595
|
-
GateNameSchema =
|
|
2596
|
-
PlatformTupleSchema =
|
|
2597
|
-
PublisherSchema =
|
|
2598
|
-
TaskKindSchema =
|
|
2599
|
-
ImpactSchema =
|
|
2600
|
-
ResolvedSourceSchema =
|
|
2601
|
-
Iso8601 =
|
|
2602
|
-
NonEmptyString =
|
|
2603
|
-
ReleasePlanTaskSchema =
|
|
2629
|
+
ReleaseChannelSchema = z5.enum(RELEASE_CHANNEL);
|
|
2630
|
+
ReleaseSchemeSchema = z5.enum(RELEASE_SCHEME);
|
|
2631
|
+
ReleaseKindSchema = z5.enum(RELEASE_KIND);
|
|
2632
|
+
ReleaseStatusSchema = z5.enum(RELEASE_STATUS);
|
|
2633
|
+
GateStatusSchema = z5.enum(GATE_STATUS);
|
|
2634
|
+
GateNameSchema = z5.enum(GATE_NAME);
|
|
2635
|
+
PlatformTupleSchema = z5.enum(PLATFORM_TUPLE);
|
|
2636
|
+
PublisherSchema = z5.enum(PUBLISHER);
|
|
2637
|
+
TaskKindSchema = z5.enum(TASK_KIND);
|
|
2638
|
+
ImpactSchema = z5.enum(IMPACT);
|
|
2639
|
+
ResolvedSourceSchema = z5.enum(RESOLVED_SOURCE);
|
|
2640
|
+
Iso8601 = z5.iso.datetime({ offset: true });
|
|
2641
|
+
NonEmptyString = z5.string().min(1);
|
|
2642
|
+
ReleasePlanTaskSchema = z5.object({
|
|
2604
2643
|
/** Task ID (e.g. "T10001"). Format intentionally loose so historical IDs validate. */
|
|
2605
2644
|
id: NonEmptyString,
|
|
2606
2645
|
/** Conventional-commit-aligned task classification. */
|
|
@@ -2608,20 +2647,20 @@ var init_plan = __esm({
|
|
|
2608
2647
|
/** SemVer impact classification. */
|
|
2609
2648
|
impact: ImpactSchema,
|
|
2610
2649
|
/** Human-readable changelog line for this task. */
|
|
2611
|
-
userFacingSummary:
|
|
2650
|
+
userFacingSummary: z5.string(),
|
|
2612
2651
|
/**
|
|
2613
2652
|
* ADR-051 evidence atoms attesting the task's gate results. Format is
|
|
2614
2653
|
* `kind:value` (e.g. `commit:abc123`, `test-run:vitest.json`). The contract
|
|
2615
2654
|
* accepts empty arrays so legacy plans validate; `cleo release plan`
|
|
2616
2655
|
* enforces non-empty via R-301.
|
|
2617
2656
|
*/
|
|
2618
|
-
evidenceAtoms:
|
|
2657
|
+
evidenceAtoms: z5.array(NonEmptyString),
|
|
2619
2658
|
/** IVTR phase at plan time — informational only per R-316. */
|
|
2620
|
-
ivtrPhaseAtPlan:
|
|
2659
|
+
ivtrPhaseAtPlan: z5.string().optional(),
|
|
2621
2660
|
/** Epic this task rolls up to, locked at plan time per R-303. */
|
|
2622
2661
|
epicAncestor: NonEmptyString
|
|
2623
2662
|
});
|
|
2624
|
-
ReleaseGateSchema =
|
|
2663
|
+
ReleaseGateSchema = z5.object({
|
|
2625
2664
|
/** Canonical gate name. */
|
|
2626
2665
|
name: GateNameSchema,
|
|
2627
2666
|
/** ADR-051 atom string identifying the resolved tool (e.g. `tool:test`). */
|
|
@@ -2631,11 +2670,11 @@ var init_plan = __esm({
|
|
|
2631
2670
|
/** ISO-8601 timestamp the gate was last verified. */
|
|
2632
2671
|
lastVerifiedAt: Iso8601,
|
|
2633
2672
|
/** Resolved shell command (e.g. `pnpm run test`). Optional for unresolved gates. */
|
|
2634
|
-
resolvedCommand:
|
|
2673
|
+
resolvedCommand: z5.string().optional(),
|
|
2635
2674
|
/** Provenance of the resolved command. Optional for unresolved gates. */
|
|
2636
2675
|
resolvedSource: ResolvedSourceSchema.optional()
|
|
2637
2676
|
});
|
|
2638
|
-
ReleasePlatformMatrixEntrySchema =
|
|
2677
|
+
ReleasePlatformMatrixEntrySchema = z5.object({
|
|
2639
2678
|
/** Target platform tuple. */
|
|
2640
2679
|
platform: PlatformTupleSchema,
|
|
2641
2680
|
/** Distribution backend. */
|
|
@@ -2643,47 +2682,47 @@ var init_plan = __esm({
|
|
|
2643
2682
|
/** Package identifier on the target backend (e.g. `@cleocode/cleo`). */
|
|
2644
2683
|
package: NonEmptyString,
|
|
2645
2684
|
/** Whether to run the GHA smoke job for this matrix entry. */
|
|
2646
|
-
smoke:
|
|
2685
|
+
smoke: z5.boolean().default(true).optional()
|
|
2647
2686
|
});
|
|
2648
|
-
ReleasePreflightSummarySchema =
|
|
2687
|
+
ReleasePreflightSummarySchema = z5.object({
|
|
2649
2688
|
/** True if esbuild externals are out of sync with package.json. */
|
|
2650
|
-
esbuildExternalsDrift:
|
|
2689
|
+
esbuildExternalsDrift: z5.boolean(),
|
|
2651
2690
|
/** True if `pnpm-lock.yaml` diverges from the workspace manifest. */
|
|
2652
|
-
lockfileDrift:
|
|
2691
|
+
lockfileDrift: z5.boolean(),
|
|
2653
2692
|
/** True if all epic children are in terminal lifecycle states. */
|
|
2654
|
-
epicCompletenessClean:
|
|
2693
|
+
epicCompletenessClean: z5.boolean(),
|
|
2655
2694
|
/** True if no task appears in multiple in-flight release plans. */
|
|
2656
|
-
doubleListingClean:
|
|
2695
|
+
doubleListingClean: z5.boolean(),
|
|
2657
2696
|
/** Non-fatal preflight warnings (e.g. unresolved tools per R-024). */
|
|
2658
|
-
preflightWarnings:
|
|
2697
|
+
preflightWarnings: z5.array(z5.string()).default([]).optional()
|
|
2659
2698
|
});
|
|
2660
|
-
ReleasePlanChangelogSchema =
|
|
2699
|
+
ReleasePlanChangelogSchema = z5.object({
|
|
2661
2700
|
/** `kind=feat` tasks. */
|
|
2662
|
-
features:
|
|
2701
|
+
features: z5.array(NonEmptyString).default([]),
|
|
2663
2702
|
/** `kind=fix` or `kind=hotfix` tasks. */
|
|
2664
|
-
fixes:
|
|
2703
|
+
fixes: z5.array(NonEmptyString).default([]),
|
|
2665
2704
|
/** `kind=chore`, `docs`, `refactor`, `test`, `perf` tasks. */
|
|
2666
|
-
chores:
|
|
2705
|
+
chores: z5.array(NonEmptyString).default([]),
|
|
2667
2706
|
/** `kind=breaking` or `kind=revert` tasks. */
|
|
2668
|
-
breaking:
|
|
2707
|
+
breaking: z5.array(NonEmptyString).default([])
|
|
2669
2708
|
});
|
|
2670
|
-
ReleasePlanMetaSchema =
|
|
2709
|
+
ReleasePlanMetaSchema = z5.object({
|
|
2671
2710
|
/** True if this is the project's first ever release. */
|
|
2672
|
-
firstEverRelease:
|
|
2711
|
+
firstEverRelease: z5.boolean().optional(),
|
|
2673
2712
|
/** Canonical tool names that could not be resolved at plan time. */
|
|
2674
|
-
unresolvedTools:
|
|
2713
|
+
unresolvedTools: z5.array(z5.string()).optional(),
|
|
2675
2714
|
/** Project archetype detected at plan time. */
|
|
2676
|
-
archetype:
|
|
2677
|
-
}).catchall(
|
|
2678
|
-
ReleasePlanSchema =
|
|
2715
|
+
archetype: z5.string().optional()
|
|
2716
|
+
}).catchall(z5.unknown());
|
|
2717
|
+
ReleasePlanSchema = z5.object({
|
|
2679
2718
|
/** Schema URL for this plan version. */
|
|
2680
|
-
$schema:
|
|
2719
|
+
$schema: z5.string().optional(),
|
|
2681
2720
|
/** Requested version string (e.g. "v2026.6.0"). Includes the leading `v`. */
|
|
2682
2721
|
version: NonEmptyString,
|
|
2683
2722
|
/** Resolved version string after suffix application (e.g. "v2026.6.0.2"). */
|
|
2684
2723
|
resolvedVersion: NonEmptyString,
|
|
2685
2724
|
/** True if a `calver-suffix` was applied to disambiguate a same-day hotfix. */
|
|
2686
|
-
suffixApplied:
|
|
2725
|
+
suffixApplied: z5.boolean(),
|
|
2687
2726
|
/** Versioning scheme governing `version` / `resolvedVersion`. */
|
|
2688
2727
|
scheme: ReleaseSchemeSchema,
|
|
2689
2728
|
/** npm dist-tag channel for this release. */
|
|
@@ -2700,27 +2739,27 @@ var init_plan = __esm({
|
|
|
2700
2739
|
* Version of the previous release on the same channel. MUST be `null` only
|
|
2701
2740
|
* for first-ever releases (R-300, enforced at the verb layer).
|
|
2702
2741
|
*/
|
|
2703
|
-
previousVersion:
|
|
2742
|
+
previousVersion: z5.string().nullable(),
|
|
2704
2743
|
/** Git tag of the previous release (typically `previousVersion` prefixed). */
|
|
2705
|
-
previousTag:
|
|
2744
|
+
previousTag: z5.string().nullable(),
|
|
2706
2745
|
/** ISO-8601 timestamp the previous release was published. */
|
|
2707
2746
|
previousShippedAt: Iso8601.nullable(),
|
|
2708
2747
|
/** Tasks rolled into this release. */
|
|
2709
|
-
tasks:
|
|
2748
|
+
tasks: z5.array(ReleasePlanTaskSchema),
|
|
2710
2749
|
/** Bucketed changelog. */
|
|
2711
2750
|
changelog: ReleasePlanChangelogSchema,
|
|
2712
2751
|
/** Per-gate verification status. */
|
|
2713
|
-
gates:
|
|
2752
|
+
gates: z5.array(ReleaseGateSchema),
|
|
2714
2753
|
/** Platform / publisher matrix. */
|
|
2715
|
-
platformMatrix:
|
|
2754
|
+
platformMatrix: z5.array(ReleasePlatformMatrixEntrySchema),
|
|
2716
2755
|
/** Preflight summary from `cleo release plan`. */
|
|
2717
2756
|
preflightSummary: ReleasePreflightSummarySchema,
|
|
2718
2757
|
/** URL of the GHA workflow run (populated by `release-prepare.yml`). */
|
|
2719
|
-
workflowRunUrl:
|
|
2758
|
+
workflowRunUrl: z5.string().nullable(),
|
|
2720
2759
|
/** URL of the bump PR (populated by `cleo release open`). */
|
|
2721
|
-
prUrl:
|
|
2760
|
+
prUrl: z5.string().nullable(),
|
|
2722
2761
|
/** Merge commit SHA on `main` (populated by `release-publish.yml`). */
|
|
2723
|
-
mergeCommitSha:
|
|
2762
|
+
mergeCommitSha: z5.string().nullable(),
|
|
2724
2763
|
/** Current FSM state per R-302. */
|
|
2725
2764
|
status: ReleaseStatusSchema,
|
|
2726
2765
|
/** Informational / forward-compat metadata. */
|
|
@@ -2737,52 +2776,52 @@ var init_session2 = __esm({
|
|
|
2737
2776
|
});
|
|
2738
2777
|
|
|
2739
2778
|
// packages/contracts/src/session-journal.ts
|
|
2740
|
-
import { z as
|
|
2779
|
+
import { z as z6 } from "zod";
|
|
2741
2780
|
var SESSION_JOURNAL_SCHEMA_VERSION, sessionJournalDoctorSummarySchema, sessionJournalDebriefSummarySchema, sessionJournalEntrySchema;
|
|
2742
2781
|
var init_session_journal = __esm({
|
|
2743
2782
|
"packages/contracts/src/session-journal.ts"() {
|
|
2744
2783
|
"use strict";
|
|
2745
2784
|
SESSION_JOURNAL_SCHEMA_VERSION = "1.0";
|
|
2746
|
-
sessionJournalDoctorSummarySchema =
|
|
2785
|
+
sessionJournalDoctorSummarySchema = z6.object({
|
|
2747
2786
|
/** `true` when zero noise patterns were detected. */
|
|
2748
|
-
isClean:
|
|
2787
|
+
isClean: z6.boolean(),
|
|
2749
2788
|
/** Total number of noise findings across all patterns. */
|
|
2750
|
-
findingsCount:
|
|
2789
|
+
findingsCount: z6.number().int().nonnegative(),
|
|
2751
2790
|
/** Pattern names that were detected (empty when isClean). */
|
|
2752
|
-
patterns:
|
|
2791
|
+
patterns: z6.array(z6.string()),
|
|
2753
2792
|
/** Total brain entries scanned. `0` = empty or unavailable. */
|
|
2754
|
-
totalScanned:
|
|
2793
|
+
totalScanned: z6.number().int().nonnegative()
|
|
2755
2794
|
});
|
|
2756
|
-
sessionJournalDebriefSummarySchema =
|
|
2795
|
+
sessionJournalDebriefSummarySchema = z6.object({
|
|
2757
2796
|
/** First 200 characters of the session end note (if provided). */
|
|
2758
|
-
noteExcerpt:
|
|
2797
|
+
noteExcerpt: z6.string().max(200).optional(),
|
|
2759
2798
|
/** Number of tasks completed during the session. */
|
|
2760
|
-
tasksCompletedCount:
|
|
2799
|
+
tasksCompletedCount: z6.number().int().nonnegative(),
|
|
2761
2800
|
/** Up to 5 task IDs (not titles) that were the focus of the session. */
|
|
2762
|
-
tasksFocused:
|
|
2801
|
+
tasksFocused: z6.array(z6.string()).max(5).optional()
|
|
2763
2802
|
});
|
|
2764
|
-
sessionJournalEntrySchema =
|
|
2803
|
+
sessionJournalEntrySchema = z6.object({
|
|
2765
2804
|
// Identity
|
|
2766
2805
|
/** Schema version for forward-compatibility. Always `'1.0'` in this release. */
|
|
2767
|
-
schemaVersion:
|
|
2806
|
+
schemaVersion: z6.literal(SESSION_JOURNAL_SCHEMA_VERSION),
|
|
2768
2807
|
/** ISO 8601 timestamp when the entry was written. */
|
|
2769
|
-
timestamp:
|
|
2808
|
+
timestamp: z6.string(),
|
|
2770
2809
|
/** CLEO session ID (e.g. `ses_20260424055456_ede571`). */
|
|
2771
|
-
sessionId:
|
|
2810
|
+
sessionId: z6.string(),
|
|
2772
2811
|
/** Event type that triggered this journal entry. */
|
|
2773
|
-
eventType:
|
|
2812
|
+
eventType: z6.enum(["session_start", "session_end", "observation", "decision", "error"]),
|
|
2774
2813
|
// Session metadata (set on session_start / session_end)
|
|
2775
2814
|
/** Agent identifier (e.g. `cleo-prime`, `claude-code`). */
|
|
2776
|
-
agentIdentifier:
|
|
2815
|
+
agentIdentifier: z6.string().optional(),
|
|
2777
2816
|
/** Provider adapter ID active for this session. */
|
|
2778
|
-
providerId:
|
|
2817
|
+
providerId: z6.string().optional(),
|
|
2779
2818
|
/** Session scope string (e.g. `'global'` or `'epic:T1263'`). */
|
|
2780
|
-
scope:
|
|
2819
|
+
scope: z6.string().optional(),
|
|
2781
2820
|
// Session-end fields
|
|
2782
2821
|
/** Duration of the session in seconds (session_end only). */
|
|
2783
|
-
duration:
|
|
2822
|
+
duration: z6.number().int().nonnegative().optional(),
|
|
2784
2823
|
/** Task IDs (not titles) completed during the session. */
|
|
2785
|
-
tasksCompleted:
|
|
2824
|
+
tasksCompleted: z6.array(z6.string()).optional(),
|
|
2786
2825
|
// Doctor summary (T1262 absorbed)
|
|
2787
2826
|
/** Compact result of `scanBrainNoise` run at session-end. */
|
|
2788
2827
|
doctorSummary: sessionJournalDoctorSummarySchema.optional(),
|
|
@@ -2791,7 +2830,7 @@ var init_session_journal = __esm({
|
|
|
2791
2830
|
debriefSummary: sessionJournalDebriefSummarySchema.optional(),
|
|
2792
2831
|
// Optional hash chain
|
|
2793
2832
|
/** SHA-256 hex of the previous entry's raw JSON string (for integrity chain). */
|
|
2794
|
-
prevEntryHash:
|
|
2833
|
+
prevEntryHash: z6.string().optional()
|
|
2795
2834
|
});
|
|
2796
2835
|
}
|
|
2797
2836
|
});
|
|
@@ -2837,52 +2876,52 @@ var init_task = __esm({
|
|
|
2837
2876
|
});
|
|
2838
2877
|
|
|
2839
2878
|
// packages/contracts/src/task-evidence.ts
|
|
2840
|
-
import { z as
|
|
2879
|
+
import { z as z7 } from "zod";
|
|
2841
2880
|
var fileEvidenceSchema, logEvidenceSchema, screenshotEvidenceSchema, testOutputEvidenceSchema, commandOutputEvidenceSchema, taskEvidenceSchema;
|
|
2842
2881
|
var init_task_evidence = __esm({
|
|
2843
2882
|
"packages/contracts/src/task-evidence.ts"() {
|
|
2844
2883
|
"use strict";
|
|
2845
|
-
fileEvidenceSchema =
|
|
2846
|
-
kind:
|
|
2847
|
-
sha256:
|
|
2848
|
-
timestamp:
|
|
2849
|
-
path:
|
|
2850
|
-
mime:
|
|
2851
|
-
description:
|
|
2852
|
-
});
|
|
2853
|
-
logEvidenceSchema =
|
|
2854
|
-
kind:
|
|
2855
|
-
sha256:
|
|
2856
|
-
timestamp:
|
|
2857
|
-
source:
|
|
2858
|
-
description:
|
|
2859
|
-
});
|
|
2860
|
-
screenshotEvidenceSchema =
|
|
2861
|
-
kind:
|
|
2862
|
-
sha256:
|
|
2863
|
-
timestamp:
|
|
2864
|
-
mime:
|
|
2865
|
-
description:
|
|
2866
|
-
});
|
|
2867
|
-
testOutputEvidenceSchema =
|
|
2868
|
-
kind:
|
|
2869
|
-
sha256:
|
|
2870
|
-
timestamp:
|
|
2871
|
-
passed:
|
|
2872
|
-
failed:
|
|
2873
|
-
skipped:
|
|
2874
|
-
exitCode:
|
|
2875
|
-
description:
|
|
2876
|
-
});
|
|
2877
|
-
commandOutputEvidenceSchema =
|
|
2878
|
-
kind:
|
|
2879
|
-
sha256:
|
|
2880
|
-
timestamp:
|
|
2881
|
-
cmd:
|
|
2882
|
-
exitCode:
|
|
2883
|
-
description:
|
|
2884
|
-
});
|
|
2885
|
-
taskEvidenceSchema =
|
|
2884
|
+
fileEvidenceSchema = z7.object({
|
|
2885
|
+
kind: z7.literal("file"),
|
|
2886
|
+
sha256: z7.string().length(64),
|
|
2887
|
+
timestamp: z7.string().datetime(),
|
|
2888
|
+
path: z7.string().min(1),
|
|
2889
|
+
mime: z7.string().optional(),
|
|
2890
|
+
description: z7.string().optional()
|
|
2891
|
+
});
|
|
2892
|
+
logEvidenceSchema = z7.object({
|
|
2893
|
+
kind: z7.literal("log"),
|
|
2894
|
+
sha256: z7.string().length(64),
|
|
2895
|
+
timestamp: z7.string().datetime(),
|
|
2896
|
+
source: z7.string().min(1),
|
|
2897
|
+
description: z7.string().optional()
|
|
2898
|
+
});
|
|
2899
|
+
screenshotEvidenceSchema = z7.object({
|
|
2900
|
+
kind: z7.literal("screenshot"),
|
|
2901
|
+
sha256: z7.string().length(64),
|
|
2902
|
+
timestamp: z7.string().datetime(),
|
|
2903
|
+
mime: z7.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
|
|
2904
|
+
description: z7.string().optional()
|
|
2905
|
+
});
|
|
2906
|
+
testOutputEvidenceSchema = z7.object({
|
|
2907
|
+
kind: z7.literal("test-output"),
|
|
2908
|
+
sha256: z7.string().length(64),
|
|
2909
|
+
timestamp: z7.string().datetime(),
|
|
2910
|
+
passed: z7.number().int().nonnegative(),
|
|
2911
|
+
failed: z7.number().int().nonnegative(),
|
|
2912
|
+
skipped: z7.number().int().nonnegative(),
|
|
2913
|
+
exitCode: z7.number().int(),
|
|
2914
|
+
description: z7.string().optional()
|
|
2915
|
+
});
|
|
2916
|
+
commandOutputEvidenceSchema = z7.object({
|
|
2917
|
+
kind: z7.literal("command-output"),
|
|
2918
|
+
sha256: z7.string().length(64),
|
|
2919
|
+
timestamp: z7.string().datetime(),
|
|
2920
|
+
cmd: z7.string().min(1),
|
|
2921
|
+
exitCode: z7.number().int(),
|
|
2922
|
+
description: z7.string().optional()
|
|
2923
|
+
});
|
|
2924
|
+
taskEvidenceSchema = z7.discriminatedUnion("kind", [
|
|
2886
2925
|
fileEvidenceSchema,
|
|
2887
2926
|
logEvidenceSchema,
|
|
2888
2927
|
screenshotEvidenceSchema,
|
|
@@ -2893,12 +2932,12 @@ var init_task_evidence = __esm({
|
|
|
2893
2932
|
});
|
|
2894
2933
|
|
|
2895
2934
|
// packages/contracts/src/tasks/archive.ts
|
|
2896
|
-
import { z as
|
|
2935
|
+
import { z as z8 } from "zod";
|
|
2897
2936
|
var ArchiveReason, ARCHIVE_REASON_VALUES;
|
|
2898
2937
|
var init_archive = __esm({
|
|
2899
2938
|
"packages/contracts/src/tasks/archive.ts"() {
|
|
2900
2939
|
"use strict";
|
|
2901
|
-
ArchiveReason =
|
|
2940
|
+
ArchiveReason = z8.enum([
|
|
2902
2941
|
"verified",
|
|
2903
2942
|
"reconciled",
|
|
2904
2943
|
"superseded",
|
|
@@ -2916,6 +2955,7 @@ var init_src2 = __esm({
|
|
|
2916
2955
|
init_acceptance_gate_schema();
|
|
2917
2956
|
init_attachment_schema();
|
|
2918
2957
|
init_branch_lock();
|
|
2958
|
+
init_changesets();
|
|
2919
2959
|
init_credentials();
|
|
2920
2960
|
init_engine_result();
|
|
2921
2961
|
init_errors();
|
|
@@ -7284,6 +7324,31 @@ var init_registry = __esm({
|
|
|
7284
7324
|
}
|
|
7285
7325
|
]
|
|
7286
7326
|
},
|
|
7327
|
+
// T9742 — skill.migrate: legacy XDG store → ~/.cleo/skills/
|
|
7328
|
+
{
|
|
7329
|
+
gateway: "mutate",
|
|
7330
|
+
domain: "tools",
|
|
7331
|
+
operation: "skill.migrate",
|
|
7332
|
+
description: "tools.skill.migrate (mutate) \u2014 migrate ~/.local/share/agents/skills into ~/.cleo/skills (SSoT); supports --dry-run preview + --rollback restore",
|
|
7333
|
+
tier: 2,
|
|
7334
|
+
idempotent: true,
|
|
7335
|
+
sessionRequired: false,
|
|
7336
|
+
requiredParams: [],
|
|
7337
|
+
params: [
|
|
7338
|
+
{
|
|
7339
|
+
name: "dryRun",
|
|
7340
|
+
type: "boolean",
|
|
7341
|
+
required: false,
|
|
7342
|
+
description: "Preview the plan without writing anything"
|
|
7343
|
+
},
|
|
7344
|
+
{
|
|
7345
|
+
name: "rollback",
|
|
7346
|
+
type: "boolean",
|
|
7347
|
+
required: false,
|
|
7348
|
+
description: "Restore the legacy tree from the most recent backup tarball"
|
|
7349
|
+
}
|
|
7350
|
+
]
|
|
7351
|
+
},
|
|
7287
7352
|
// T9690 — skill.stats: Sphere B telemetry rollup
|
|
7288
7353
|
{
|
|
7289
7354
|
gateway: "query",
|
|
@@ -25997,16 +26062,16 @@ async function orchestrateRejectOp(params) {
|
|
|
25997
26062
|
async function orchestrateClassify(request, context, projectRoot) {
|
|
25998
26063
|
try {
|
|
25999
26064
|
const { getCleoCantWorkflowsDir } = await import("@cleocode/core/internal");
|
|
26000
|
-
const { readFileSync:
|
|
26065
|
+
const { readFileSync: readFileSync18, readdirSync: readdirSync4, existsSync: existsSync17 } = await import("node:fs");
|
|
26001
26066
|
const { join: join33 } = await import("node:path");
|
|
26002
26067
|
const workflowsDir = getCleoCantWorkflowsDir();
|
|
26003
26068
|
const combined = `${request} ${context ?? ""}`.toLowerCase();
|
|
26004
26069
|
const matches = [];
|
|
26005
|
-
if (
|
|
26070
|
+
if (existsSync17(workflowsDir)) {
|
|
26006
26071
|
const files = readdirSync4(workflowsDir).filter((f) => f.endsWith(".cant"));
|
|
26007
26072
|
for (const file of files) {
|
|
26008
26073
|
try {
|
|
26009
|
-
const src =
|
|
26074
|
+
const src = readFileSync18(join33(workflowsDir, file), "utf-8");
|
|
26010
26075
|
const teamMatch = /^team\s+(\S+):/m.exec(src);
|
|
26011
26076
|
if (!teamMatch) continue;
|
|
26012
26077
|
const teamName = teamMatch[1];
|
|
@@ -26022,11 +26087,11 @@ async function orchestrateClassify(request, context, projectRoot) {
|
|
|
26022
26087
|
}
|
|
26023
26088
|
}
|
|
26024
26089
|
const localCantDir = join33(projectRoot, CLEO_DIR_NAME, WORKFLOWS_SUBDIR);
|
|
26025
|
-
if (
|
|
26090
|
+
if (existsSync17(localCantDir)) {
|
|
26026
26091
|
const files = readdirSync4(localCantDir).filter((f) => f.endsWith(".cant"));
|
|
26027
26092
|
for (const file of files) {
|
|
26028
26093
|
try {
|
|
26029
|
-
const src =
|
|
26094
|
+
const src = readFileSync18(join33(localCantDir, file), "utf-8");
|
|
26030
26095
|
const teamMatch = /^team\s+(\S+):/m.exec(src);
|
|
26031
26096
|
if (!teamMatch) continue;
|
|
26032
26097
|
const teamName = teamMatch[1];
|
|
@@ -29873,6 +29938,7 @@ import {
|
|
|
29873
29938
|
toolsSkillImportHermes,
|
|
29874
29939
|
toolsSkillInstall,
|
|
29875
29940
|
toolsSkillList,
|
|
29941
|
+
toolsSkillMigrate,
|
|
29876
29942
|
toolsSkillPrecedenceResolve,
|
|
29877
29943
|
toolsSkillPrecedenceShow,
|
|
29878
29944
|
toolsSkillPruneTelemetry,
|
|
@@ -29976,6 +30042,7 @@ var init_tools = __esm({
|
|
|
29976
30042
|
"skill.uninstall",
|
|
29977
30043
|
"skill.refresh",
|
|
29978
30044
|
"skill.import.hermes",
|
|
30045
|
+
"skill.migrate",
|
|
29979
30046
|
"skill.prune.telemetry",
|
|
29980
30047
|
// provider
|
|
29981
30048
|
"provider.inject",
|
|
@@ -30261,6 +30328,14 @@ var init_tools = __esm({
|
|
|
30261
30328
|
const result = await toolsSkillImportHermes({ hermesHome, dryRun });
|
|
30262
30329
|
return wrapResult(result, "mutate", "tools", "skill.import.hermes", startTime);
|
|
30263
30330
|
}
|
|
30331
|
+
// T9742 — skill.migrate: legacy XDG store → ~/.cleo/skills/ (SSoT)
|
|
30332
|
+
case "migrate": {
|
|
30333
|
+
const result = await toolsSkillMigrate({
|
|
30334
|
+
dryRun: params?.dryRun === true,
|
|
30335
|
+
rollback: params?.rollback === true
|
|
30336
|
+
});
|
|
30337
|
+
return wrapResult(result, "mutate", "tools", "skill.migrate", startTime);
|
|
30338
|
+
}
|
|
30264
30339
|
// T9693 — skill.prune.telemetry: retention sweep on skill_usage
|
|
30265
30340
|
case "prune.telemetry": {
|
|
30266
30341
|
const olderThanDays = typeof params?.olderThanDays === "number" ? params.olderThanDays : void 0;
|
|
@@ -33188,12 +33263,12 @@ var init_agent = __esm({
|
|
|
33188
33263
|
transportConfig: {},
|
|
33189
33264
|
isActive: true
|
|
33190
33265
|
});
|
|
33191
|
-
const { existsSync:
|
|
33266
|
+
const { existsSync: existsSync17, mkdirSync: mkdirSync7, writeFileSync: writeFileSync7 } = await import("node:fs");
|
|
33192
33267
|
const { join: join33 } = await import("node:path");
|
|
33193
33268
|
const cantDir = join33(CLEO_DIR_NAME, AGENTS_SUBDIR);
|
|
33194
33269
|
const cantPath = join33(cantDir, `${agentId}.cant`);
|
|
33195
33270
|
let cantScaffolded = false;
|
|
33196
|
-
if (!
|
|
33271
|
+
if (!existsSync17(cantPath)) {
|
|
33197
33272
|
mkdirSync7(cantDir, { recursive: true });
|
|
33198
33273
|
const role = classification ?? "specialist";
|
|
33199
33274
|
const cantContent = `---
|
|
@@ -33253,7 +33328,7 @@ agent ${agentId}:
|
|
|
33253
33328
|
data: {
|
|
33254
33329
|
agentId: credential.agentId,
|
|
33255
33330
|
displayName: credential.displayName,
|
|
33256
|
-
cantFile: cantScaffolded ? cantPath :
|
|
33331
|
+
cantFile: cantScaffolded ? cantPath : existsSync17(cantPath) ? cantPath : null,
|
|
33257
33332
|
cantScaffolded
|
|
33258
33333
|
}
|
|
33259
33334
|
},
|
|
@@ -33374,7 +33449,7 @@ agent ${agentId}:
|
|
|
33374
33449
|
const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
|
|
33375
33450
|
const { getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
33376
33451
|
const { createRuntime } = await import("@cleocode/runtime");
|
|
33377
|
-
const { existsSync:
|
|
33452
|
+
const { existsSync: existsSync17, readFileSync: readFileSync18 } = await import("node:fs");
|
|
33378
33453
|
const { join: join33 } = await import("node:path");
|
|
33379
33454
|
await getDb3();
|
|
33380
33455
|
const registry = new AgentRegistryAccessor(getProjectRoot23());
|
|
@@ -33396,8 +33471,8 @@ agent ${agentId}:
|
|
|
33396
33471
|
let profile = null;
|
|
33397
33472
|
let cantValidation = null;
|
|
33398
33473
|
const cantPath = args.cant ?? join33(CLEO_DIR_NAME, AGENTS_SUBDIR, `${args.agentId}.cant`);
|
|
33399
|
-
if (
|
|
33400
|
-
profile =
|
|
33474
|
+
if (existsSync17(cantPath)) {
|
|
33475
|
+
profile = readFileSync18(cantPath, "utf-8");
|
|
33401
33476
|
try {
|
|
33402
33477
|
const cantModule = await import("@cleocode/cant");
|
|
33403
33478
|
const validate = "validate" in cantModule ? cantModule.validate : null;
|
|
@@ -33928,7 +34003,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
33928
34003
|
const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
|
|
33929
34004
|
const { getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
33930
34005
|
const { createRuntime } = await import("@cleocode/runtime");
|
|
33931
|
-
const { existsSync:
|
|
34006
|
+
const { existsSync: existsSync17 } = await import("node:fs");
|
|
33932
34007
|
const { join: join33 } = await import("node:path");
|
|
33933
34008
|
const { execFile: execFile2 } = await import("node:child_process");
|
|
33934
34009
|
const { promisify: promisify2 } = await import("node:util");
|
|
@@ -33950,7 +34025,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
33950
34025
|
await registry.update(args.agentId, { isActive: true });
|
|
33951
34026
|
await registry.markUsed(args.agentId);
|
|
33952
34027
|
const cantPath = join33(CLEO_DIR_NAME, AGENTS_SUBDIR, `${args.agentId}.cant`);
|
|
33953
|
-
const hasProfile =
|
|
34028
|
+
const hasProfile = existsSync17(cantPath);
|
|
33954
34029
|
const runtime = await createRuntime(registry, {
|
|
33955
34030
|
agentId: args.agentId,
|
|
33956
34031
|
pollIntervalMs: 5e3,
|
|
@@ -34808,11 +34883,11 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
34808
34883
|
async run({ args }) {
|
|
34809
34884
|
let tempDir = null;
|
|
34810
34885
|
try {
|
|
34811
|
-
const { existsSync:
|
|
34886
|
+
const { existsSync: existsSync17, mkdirSync: mkdirSync7, statSync, readdirSync: readdirSync4, copyFileSync } = await import("node:fs");
|
|
34812
34887
|
const { join: join33, basename, resolve: resolve9, extname } = await import("node:path");
|
|
34813
34888
|
const { tmpdir: tmpdir2 } = await import("node:os");
|
|
34814
34889
|
const resolvedPath = resolve9(args.path);
|
|
34815
|
-
if (!
|
|
34890
|
+
if (!existsSync17(resolvedPath)) {
|
|
34816
34891
|
cliOutput(
|
|
34817
34892
|
{
|
|
34818
34893
|
success: false,
|
|
@@ -34832,11 +34907,11 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
34832
34907
|
if (stat3.isFile() && ext === ".cant") {
|
|
34833
34908
|
cantPath = resolvedPath;
|
|
34834
34909
|
} else if (stat3.isFile() && ext === ".cantz") {
|
|
34835
|
-
const { execFileSync:
|
|
34910
|
+
const { execFileSync: execFileSync5 } = await import("node:child_process");
|
|
34836
34911
|
tempDir = join33(tmpdir2(), `cleo-agent-install-${Date.now()}`);
|
|
34837
34912
|
mkdirSync7(tempDir, { recursive: true });
|
|
34838
34913
|
try {
|
|
34839
|
-
|
|
34914
|
+
execFileSync5("unzip", ["-o", "-q", resolvedPath, "-d", tempDir], {
|
|
34840
34915
|
encoding: "utf-8",
|
|
34841
34916
|
timeout: 3e4
|
|
34842
34917
|
});
|
|
@@ -34873,7 +34948,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
34873
34948
|
}
|
|
34874
34949
|
const agentName = topLevel[0];
|
|
34875
34950
|
const personaPath = join33(tempDir, agentName, "persona.cant");
|
|
34876
|
-
if (!
|
|
34951
|
+
if (!existsSync17(personaPath)) {
|
|
34877
34952
|
cliOutput(
|
|
34878
34953
|
{
|
|
34879
34954
|
success: false,
|
|
@@ -34892,7 +34967,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
34892
34967
|
} else if (stat3.isDirectory()) {
|
|
34893
34968
|
const agentName = basename(resolvedPath);
|
|
34894
34969
|
const personaPath = join33(resolvedPath, "persona.cant");
|
|
34895
|
-
if (!
|
|
34970
|
+
if (!existsSync17(personaPath)) {
|
|
34896
34971
|
cliOutput(
|
|
34897
34972
|
{
|
|
34898
34973
|
success: false,
|
|
@@ -35027,11 +35102,11 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
35027
35102
|
},
|
|
35028
35103
|
async run({ args }) {
|
|
35029
35104
|
try {
|
|
35030
|
-
const { existsSync:
|
|
35105
|
+
const { existsSync: existsSync17, statSync } = await import("node:fs");
|
|
35031
35106
|
const { resolve: resolve9, basename, dirname: dirname13 } = await import("node:path");
|
|
35032
|
-
const { execFileSync:
|
|
35107
|
+
const { execFileSync: execFileSync5 } = await import("node:child_process");
|
|
35033
35108
|
const resolvedDir = resolve9(args.dir);
|
|
35034
|
-
if (!
|
|
35109
|
+
if (!existsSync17(resolvedDir) || !statSync(resolvedDir).isDirectory()) {
|
|
35035
35110
|
cliOutput(
|
|
35036
35111
|
{
|
|
35037
35112
|
success: false,
|
|
@@ -35047,7 +35122,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
35047
35122
|
}
|
|
35048
35123
|
const { join: join33 } = await import("node:path");
|
|
35049
35124
|
const personaPath = join33(resolvedDir, "persona.cant");
|
|
35050
|
-
if (!
|
|
35125
|
+
if (!existsSync17(personaPath)) {
|
|
35051
35126
|
cliOutput(
|
|
35052
35127
|
{
|
|
35053
35128
|
success: false,
|
|
@@ -35066,7 +35141,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
35066
35141
|
const archivePath = resolve9(archiveName);
|
|
35067
35142
|
const parentDir = dirname13(resolvedDir);
|
|
35068
35143
|
try {
|
|
35069
|
-
|
|
35144
|
+
execFileSync5("zip", ["-r", archivePath, agentName], {
|
|
35070
35145
|
cwd: parentDir,
|
|
35071
35146
|
encoding: "utf-8",
|
|
35072
35147
|
timeout: 3e4
|
|
@@ -35163,7 +35238,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
35163
35238
|
},
|
|
35164
35239
|
async run({ args }) {
|
|
35165
35240
|
try {
|
|
35166
|
-
const { existsSync:
|
|
35241
|
+
const { existsSync: existsSync17, mkdirSync: mkdirSync7, writeFileSync: writeFileSync7 } = await import("node:fs");
|
|
35167
35242
|
const { join: join33 } = await import("node:path");
|
|
35168
35243
|
const { homedir: homedir8 } = await import("node:os");
|
|
35169
35244
|
const name = args.name;
|
|
@@ -35230,7 +35305,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
35230
35305
|
targetRoot = join33(getProjectRoot23(), CLEO_DIR_NAME, CANT_AGENTS_SUBDIR);
|
|
35231
35306
|
}
|
|
35232
35307
|
const agentDir = join33(targetRoot, name);
|
|
35233
|
-
if (
|
|
35308
|
+
if (existsSync17(agentDir)) {
|
|
35234
35309
|
cliOutput(
|
|
35235
35310
|
{
|
|
35236
35311
|
success: false,
|
|
@@ -35375,15 +35450,15 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
35375
35450
|
},
|
|
35376
35451
|
async run({ args }) {
|
|
35377
35452
|
try {
|
|
35378
|
-
const { existsSync:
|
|
35453
|
+
const { existsSync: existsSync17, readFileSync: readFileSync18, mkdirSync: mkdirSync7 } = await import("node:fs");
|
|
35379
35454
|
const { resolve: resolve9, join: join33 } = await import("node:path");
|
|
35380
35455
|
const specPath = resolve9(args.spec);
|
|
35381
|
-
if (!
|
|
35456
|
+
if (!existsSync17(specPath)) {
|
|
35382
35457
|
cliError(`spec file not found: ${specPath}`, 4, { name: "E_NOT_FOUND" });
|
|
35383
35458
|
process.exitCode = 4;
|
|
35384
35459
|
return;
|
|
35385
35460
|
}
|
|
35386
|
-
const specContent =
|
|
35461
|
+
const specContent = readFileSync18(specPath, "utf-8");
|
|
35387
35462
|
const projectRoot = getProjectRoot23();
|
|
35388
35463
|
const outputDir = args["output-dir"] ? resolve9(args["output-dir"]) : join33(projectRoot, ".cleo", "cant", "agents");
|
|
35389
35464
|
mkdirSync7(outputDir, { recursive: true });
|
|
@@ -37911,11 +37986,11 @@ var init_caamp = __esm({
|
|
|
37911
37986
|
}
|
|
37912
37987
|
if (args["dry-run"]) {
|
|
37913
37988
|
const { parseCaampBlocks } = await import("@cleocode/caamp");
|
|
37914
|
-
const { existsSync:
|
|
37989
|
+
const { existsSync: existsSync17 } = await import("node:fs");
|
|
37915
37990
|
const { readFile: readFile7 } = await import("node:fs/promises");
|
|
37916
37991
|
const dryResults = [];
|
|
37917
37992
|
for (const filePath of filePaths) {
|
|
37918
|
-
if (!
|
|
37993
|
+
if (!existsSync17(filePath)) {
|
|
37919
37994
|
dryResults.push({ filePath, exists: false, blockCount: 0, wouldRemove: 0 });
|
|
37920
37995
|
continue;
|
|
37921
37996
|
}
|
|
@@ -38462,10 +38537,10 @@ var init_check2 = __esm({
|
|
|
38462
38537
|
}
|
|
38463
38538
|
},
|
|
38464
38539
|
async run({ args }) {
|
|
38465
|
-
const { readFileSync:
|
|
38540
|
+
const { readFileSync: readFileSync18 } = await import("node:fs");
|
|
38466
38541
|
let chain;
|
|
38467
38542
|
try {
|
|
38468
|
-
chain = JSON.parse(
|
|
38543
|
+
chain = JSON.parse(readFileSync18(args.file, "utf8"));
|
|
38469
38544
|
} catch (err) {
|
|
38470
38545
|
const message = err instanceof Error ? err.message : String(err);
|
|
38471
38546
|
cliError(`Failed to read or parse chain file: ${message}`, 2, {
|
|
@@ -38674,7 +38749,7 @@ var init_check2 = __esm({
|
|
|
38674
38749
|
process.exit(1);
|
|
38675
38750
|
}
|
|
38676
38751
|
const lines = logOutput.trim().split("\n").filter(Boolean);
|
|
38677
|
-
const
|
|
38752
|
+
const TASK_ID_RE2 = /T[0-9]+/;
|
|
38678
38753
|
const EXEMPT_RE = /^(Merge |Revert |fixup! |squash! |amend! )/;
|
|
38679
38754
|
const untagged = [];
|
|
38680
38755
|
const total = lines.length;
|
|
@@ -38684,7 +38759,7 @@ var init_check2 = __esm({
|
|
|
38684
38759
|
const sha = line.slice(0, tabIdx).trim();
|
|
38685
38760
|
const subject = line.slice(tabIdx + 1).trim();
|
|
38686
38761
|
if (EXEMPT_RE.test(subject)) continue;
|
|
38687
|
-
if (!
|
|
38762
|
+
if (!TASK_ID_RE2.test(subject)) {
|
|
38688
38763
|
untagged.push({ sha: sha.slice(0, 12), subject });
|
|
38689
38764
|
}
|
|
38690
38765
|
}
|
|
@@ -44623,8 +44698,8 @@ var init_event = __esm({
|
|
|
44623
44698
|
}
|
|
44624
44699
|
for (const file of filesToTail) {
|
|
44625
44700
|
const agentId = file.replace(".jsonl", "");
|
|
44626
|
-
const { readFileSync:
|
|
44627
|
-
const content =
|
|
44701
|
+
const { readFileSync: readFileSync18 } = await import("node:fs");
|
|
44702
|
+
const content = readFileSync18(join21(eventsDir, file), "utf-8");
|
|
44628
44703
|
const eventLines = content.trim().split("\n").filter(Boolean);
|
|
44629
44704
|
const tail = eventLines.slice(-lines);
|
|
44630
44705
|
if (jsonMode) {
|
|
@@ -44719,8 +44794,8 @@ var init_event = __esm({
|
|
|
44719
44794
|
const printAgentLog = async (file) => {
|
|
44720
44795
|
const agentId = file.replace(".jsonl", "");
|
|
44721
44796
|
try {
|
|
44722
|
-
const { readFileSync:
|
|
44723
|
-
const content =
|
|
44797
|
+
const { readFileSync: readFileSync18 } = await import("node:fs");
|
|
44798
|
+
const content = readFileSync18(join21(eventsDir, file), "utf-8");
|
|
44724
44799
|
const eventLines = content.trim().split("\n").filter(Boolean);
|
|
44725
44800
|
const tail = eventLines.slice(-lines);
|
|
44726
44801
|
if (jsonMode) {
|
|
@@ -59104,6 +59179,12 @@ import {
|
|
|
59104
59179
|
import { safeRunProposeTick } from "@cleocode/core/sentient/propose-tick.js";
|
|
59105
59180
|
import { patchSentientState, readSentientState as readSentientState2 } from "@cleocode/core/sentient/state.js";
|
|
59106
59181
|
import { safeRunTick } from "@cleocode/core/sentient/tick.js";
|
|
59182
|
+
import {
|
|
59183
|
+
getSkillPatch,
|
|
59184
|
+
getSkillReview,
|
|
59185
|
+
listSkillReviews,
|
|
59186
|
+
markSkillPatchRejected
|
|
59187
|
+
} from "@cleocode/core/store/skills-store.js";
|
|
59107
59188
|
function resolveProjectRoot6(arg) {
|
|
59108
59189
|
return arg && arg.length > 0 ? arg : processCwd3();
|
|
59109
59190
|
}
|
|
@@ -59767,29 +59848,7 @@ ${b64List.map((k, i) => ` ${i + 1}. ${k}`).join("\n")}`
|
|
|
59767
59848
|
const limit = args.limit ? Number.parseInt(args.limit, 10) : 50;
|
|
59768
59849
|
const pendingOnly = args.pending === true;
|
|
59769
59850
|
try {
|
|
59770
|
-
const
|
|
59771
|
-
const { skills: skills2, skillReviews, skillPatches } = await import("@cleocode/core/store/skills-schema.js");
|
|
59772
|
-
const db = await openSkillsDb();
|
|
59773
|
-
const reviews = db.select().from(skillReviews).orderBy(skillReviews.reviewedAt).limit(Number.isInteger(limit) && limit > 0 ? limit : 50).all();
|
|
59774
|
-
const entries = [];
|
|
59775
|
-
for (const review of reviews) {
|
|
59776
|
-
const { eq: eq2, desc } = await import("drizzle-orm");
|
|
59777
|
-
const skillRow = db.select().from(skills2).where(eq2(skills2.name, review.skillName)).limit(1).all()[0];
|
|
59778
|
-
const latestPatch = db.select().from(skillPatches).where(eq2(skillPatches.skillName, review.skillName)).orderBy(desc(skillPatches.proposedAt)).limit(1).all()[0];
|
|
59779
|
-
if (pendingOnly && latestPatch?.status !== "proposed") {
|
|
59780
|
-
continue;
|
|
59781
|
-
}
|
|
59782
|
-
entries.push({
|
|
59783
|
-
reviewId: review.id,
|
|
59784
|
-
skillName: review.skillName,
|
|
59785
|
-
reviewedAt: review.reviewedAt,
|
|
59786
|
-
outcome: review.outcome,
|
|
59787
|
-
summary: review.summary ?? null,
|
|
59788
|
-
patchId: latestPatch?.id ?? null,
|
|
59789
|
-
patchStatus: latestPatch?.status ?? null,
|
|
59790
|
-
isCanonical: skillRow?.sourceType === "canonical"
|
|
59791
|
-
});
|
|
59792
|
-
}
|
|
59851
|
+
const entries = await listSkillReviews({ pendingOnly, limit });
|
|
59793
59852
|
emitSuccess2(
|
|
59794
59853
|
{ entries, count: entries.length, pendingOnly },
|
|
59795
59854
|
jsonMode,
|
|
@@ -59832,12 +59891,8 @@ ${b64List.map((k, i) => ` ${i + 1}. ${k}`).join("\n")}`
|
|
|
59832
59891
|
return;
|
|
59833
59892
|
}
|
|
59834
59893
|
try {
|
|
59835
|
-
const
|
|
59836
|
-
|
|
59837
|
-
const { eq: eq2 } = await import("drizzle-orm");
|
|
59838
|
-
const db = await openSkillsDb();
|
|
59839
|
-
const review = db.select().from(skillReviews).where(eq2(skillReviews.id, reviewId)).get();
|
|
59840
|
-
if (!review) {
|
|
59894
|
+
const detail = await getSkillReview(reviewId);
|
|
59895
|
+
if (!detail.review) {
|
|
59841
59896
|
emitFailure3(
|
|
59842
59897
|
"E_NOT_FOUND",
|
|
59843
59898
|
`No skill_reviews row for id=${reviewId}`,
|
|
@@ -59846,17 +59901,15 @@ ${b64List.map((k, i) => ` ${i + 1}. ${k}`).join("\n")}`
|
|
|
59846
59901
|
);
|
|
59847
59902
|
return;
|
|
59848
59903
|
}
|
|
59849
|
-
const skillRow = db.select().from(skills2).where(eq2(skills2.name, review.skillName)).limit(1).all()[0];
|
|
59850
|
-
const patches = db.select().from(skillPatches).where(eq2(skillPatches.reviewId, reviewId)).all();
|
|
59851
59904
|
emitSuccess2(
|
|
59852
59905
|
{
|
|
59853
|
-
review,
|
|
59854
|
-
patches,
|
|
59855
|
-
isCanonical:
|
|
59856
|
-
skillRow: skillRow
|
|
59906
|
+
review: detail.review,
|
|
59907
|
+
patches: detail.patches,
|
|
59908
|
+
isCanonical: detail.isCanonical,
|
|
59909
|
+
skillRow: detail.skillRow
|
|
59857
59910
|
},
|
|
59858
59911
|
jsonMode,
|
|
59859
|
-
`Review ${reviewId} for ${review.skillName}: ${review.outcome}`,
|
|
59912
|
+
`Review ${reviewId} for ${detail.review.skillName}: ${detail.review.outcome}`,
|
|
59860
59913
|
"sentient.review-status.show"
|
|
59861
59914
|
);
|
|
59862
59915
|
} catch (err) {
|
|
@@ -59895,11 +59948,8 @@ ${b64List.map((k, i) => ` ${i + 1}. ${k}`).join("\n")}`
|
|
|
59895
59948
|
return;
|
|
59896
59949
|
}
|
|
59897
59950
|
try {
|
|
59898
|
-
const
|
|
59899
|
-
const
|
|
59900
|
-
const { eq: eq2 } = await import("drizzle-orm");
|
|
59901
|
-
const db = await openSkillsDb();
|
|
59902
|
-
const patch = db.select().from(skillPatches).where(eq2(skillPatches.id, patchId)).get();
|
|
59951
|
+
const detail = await getSkillPatch(patchId);
|
|
59952
|
+
const patch = detail.patch;
|
|
59903
59953
|
if (!patch) {
|
|
59904
59954
|
emitFailure3(
|
|
59905
59955
|
"E_NOT_FOUND",
|
|
@@ -59918,7 +59968,7 @@ ${b64List.map((k, i) => ` ${i + 1}. ${k}`).join("\n")}`
|
|
|
59918
59968
|
);
|
|
59919
59969
|
return;
|
|
59920
59970
|
}
|
|
59921
|
-
const skillRow =
|
|
59971
|
+
const skillRow = detail.skillRow;
|
|
59922
59972
|
if (!skillRow) {
|
|
59923
59973
|
emitFailure3(
|
|
59924
59974
|
"E_NOT_FOUND",
|
|
@@ -59996,12 +60046,8 @@ ${b64List.map((k, i) => ` ${i + 1}. ${k}`).join("\n")}`
|
|
|
59996
60046
|
return;
|
|
59997
60047
|
}
|
|
59998
60048
|
try {
|
|
59999
|
-
const
|
|
60000
|
-
|
|
60001
|
-
const { eq: eq2 } = await import("drizzle-orm");
|
|
60002
|
-
const db = await openSkillsDb();
|
|
60003
|
-
const patch = db.select().from(skillPatches).where(eq2(skillPatches.id, patchId)).get();
|
|
60004
|
-
if (!patch) {
|
|
60049
|
+
const detail = await getSkillPatch(patchId);
|
|
60050
|
+
if (!detail.patch) {
|
|
60005
60051
|
emitFailure3(
|
|
60006
60052
|
"E_NOT_FOUND",
|
|
60007
60053
|
`No skill_patches row for id=${patchId}`,
|
|
@@ -60010,19 +60056,19 @@ ${b64List.map((k, i) => ` ${i + 1}. ${k}`).join("\n")}`
|
|
|
60010
60056
|
);
|
|
60011
60057
|
return;
|
|
60012
60058
|
}
|
|
60013
|
-
if (patch.status !== "proposed") {
|
|
60059
|
+
if (detail.patch.status !== "proposed") {
|
|
60014
60060
|
emitFailure3(
|
|
60015
60061
|
"E_VALIDATION",
|
|
60016
|
-
`patch ${patchId} is not in 'proposed' state (status='${patch.status}')`,
|
|
60062
|
+
`patch ${patchId} is not in 'proposed' state (status='${detail.patch.status}')`,
|
|
60017
60063
|
jsonMode,
|
|
60018
60064
|
"sentient.review-status.reject"
|
|
60019
60065
|
);
|
|
60020
60066
|
return;
|
|
60021
60067
|
}
|
|
60022
|
-
|
|
60068
|
+
await markSkillPatchRejected(patchId);
|
|
60023
60069
|
const reason = args.reason ?? "rejected by operator";
|
|
60024
60070
|
emitSuccess2(
|
|
60025
|
-
{ patchId, skillName: patch.skillName, status: "rejected", reason },
|
|
60071
|
+
{ patchId, skillName: detail.patch.skillName, status: "rejected", reason },
|
|
60026
60072
|
jsonMode,
|
|
60027
60073
|
`Patch ${patchId} rejected (${reason})`,
|
|
60028
60074
|
"sentient.review-status.reject"
|
|
@@ -61450,12 +61496,12 @@ var skills_exports = {};
|
|
|
61450
61496
|
__export(skills_exports, {
|
|
61451
61497
|
skillsCommand: () => skillsCommand2
|
|
61452
61498
|
});
|
|
61453
|
-
import {
|
|
61454
|
-
|
|
61455
|
-
|
|
61456
|
-
|
|
61457
|
-
|
|
61458
|
-
|
|
61499
|
+
import {
|
|
61500
|
+
AgentsSkillsRealDirError,
|
|
61501
|
+
skills as coreSkills,
|
|
61502
|
+
runDoctorAdopt,
|
|
61503
|
+
runDoctorBridge
|
|
61504
|
+
} from "@cleocode/core";
|
|
61459
61505
|
function buildSkillsDoctorAdoptAdapters() {
|
|
61460
61506
|
return {
|
|
61461
61507
|
loadRegisteredNames: async () => {
|
|
@@ -61482,7 +61528,7 @@ function buildSkillsDoctorAdoptAdapters() {
|
|
|
61482
61528
|
}
|
|
61483
61529
|
};
|
|
61484
61530
|
}
|
|
61485
|
-
var listCommand23, searchCommand4, findCommand7, validateCommand8, infoCommand, installCommand3, uninstallCommand2, enableCommand2, disableCommand2, refreshCommand, dispatchCommand, catalogCommand, precedenceCommand, depsCommand4, doctorBridgeCommand, doctorAdoptOrphansCommand, statsCommand6, importHermesCommand, pruneTelemetryCommand, spawnProvidersCommand, doctorDiagnoseCommand, doctorCommand4, proposePatchCommand, skillsCommand2;
|
|
61531
|
+
var listCommand23, searchCommand4, findCommand7, validateCommand8, infoCommand, installCommand3, uninstallCommand2, enableCommand2, disableCommand2, refreshCommand, dispatchCommand, catalogCommand, precedenceCommand, depsCommand4, doctorBridgeCommand, doctorAdoptOrphansCommand, statsCommand6, importHermesCommand, migrateCommand2, pruneTelemetryCommand, spawnProvidersCommand, doctorDiagnoseCommand, doctorCommand4, proposePatchCommand, skillsCommand2;
|
|
61486
61532
|
var init_skills2 = __esm({
|
|
61487
61533
|
"packages/cleo/src/cli/commands/skills.ts"() {
|
|
61488
61534
|
"use strict";
|
|
@@ -61994,6 +62040,42 @@ var init_skills2 = __esm({
|
|
|
61994
62040
|
);
|
|
61995
62041
|
}
|
|
61996
62042
|
});
|
|
62043
|
+
migrateCommand2 = defineCommand({
|
|
62044
|
+
meta: {
|
|
62045
|
+
name: "migrate",
|
|
62046
|
+
description: "Migrate legacy skills (~/.local/share/agents/skills) into ~/.cleo/skills (SSoT)"
|
|
62047
|
+
},
|
|
62048
|
+
args: {
|
|
62049
|
+
"dry-run": {
|
|
62050
|
+
type: "boolean",
|
|
62051
|
+
description: "Preview the plan without writing anything"
|
|
62052
|
+
},
|
|
62053
|
+
rollback: {
|
|
62054
|
+
type: "boolean",
|
|
62055
|
+
description: "Restore from the most recent backup tarball"
|
|
62056
|
+
},
|
|
62057
|
+
json: {
|
|
62058
|
+
type: "boolean",
|
|
62059
|
+
description: "Emit LAFS JSON envelope (default)"
|
|
62060
|
+
},
|
|
62061
|
+
human: {
|
|
62062
|
+
type: "boolean",
|
|
62063
|
+
description: "Emit a coloured human-readable summary instead of JSON"
|
|
62064
|
+
}
|
|
62065
|
+
},
|
|
62066
|
+
async run({ args }) {
|
|
62067
|
+
await dispatchFromCli(
|
|
62068
|
+
"mutate",
|
|
62069
|
+
"tools",
|
|
62070
|
+
"skill.migrate",
|
|
62071
|
+
{
|
|
62072
|
+
dryRun: args["dry-run"] === true,
|
|
62073
|
+
rollback: args.rollback === true
|
|
62074
|
+
},
|
|
62075
|
+
{ command: "skills", operation: "tools.skill.migrate" }
|
|
62076
|
+
);
|
|
62077
|
+
}
|
|
62078
|
+
});
|
|
61997
62079
|
pruneTelemetryCommand = defineCommand({
|
|
61998
62080
|
meta: {
|
|
61999
62081
|
name: "prune-telemetry",
|
|
@@ -62128,119 +62210,60 @@ var init_skills2 = __esm({
|
|
|
62128
62210
|
async run({ args }) {
|
|
62129
62211
|
const skillName = String(args["skill-name"]);
|
|
62130
62212
|
const diffPath = String(args.diff);
|
|
62131
|
-
const title = typeof args.title === "string"
|
|
62132
|
-
const body = typeof args.body === "string"
|
|
62133
|
-
|
|
62134
|
-
"",
|
|
62135
|
-
`Diff source: \`${diffPath}\``,
|
|
62136
|
-
"",
|
|
62137
|
-
"This PR was opened via `cleo skill propose-patch` (T9714).",
|
|
62138
|
-
"Sphere A canonical skills are owner-CI-only \u2014 the local",
|
|
62139
|
-
"sentient daemon CANNOT mutate them in place; this PR is the",
|
|
62140
|
-
"audited path for incorporating a council-approved patch."
|
|
62141
|
-
].join("\n");
|
|
62142
|
-
const base = typeof args.base === "string" && args.base.length > 0 ? args.base : "main";
|
|
62213
|
+
const title = typeof args.title === "string" ? args.title : void 0;
|
|
62214
|
+
const body = typeof args.body === "string" ? args.body : void 0;
|
|
62215
|
+
const base = typeof args.base === "string" ? args.base : void 0;
|
|
62143
62216
|
const dryRun = args["dry-run"] === true;
|
|
62144
|
-
|
|
62145
|
-
const
|
|
62146
|
-
|
|
62147
|
-
|
|
62148
|
-
|
|
62149
|
-
|
|
62150
|
-
|
|
62151
|
-
|
|
62152
|
-
|
|
62153
|
-
|
|
62154
|
-
return;
|
|
62155
|
-
}
|
|
62156
|
-
const diffBytes = readFileSync16(resolvedDiff, "utf8");
|
|
62157
|
-
if (diffBytes.length === 0) {
|
|
62217
|
+
void (args.json === true);
|
|
62218
|
+
const result = await coreSkills.proposeCanonicalPatch({
|
|
62219
|
+
skillName,
|
|
62220
|
+
diffPath,
|
|
62221
|
+
title,
|
|
62222
|
+
body,
|
|
62223
|
+
base,
|
|
62224
|
+
dryRun
|
|
62225
|
+
});
|
|
62226
|
+
if (result.kind === "error") {
|
|
62158
62227
|
cliError(
|
|
62159
|
-
|
|
62160
|
-
|
|
62161
|
-
{ name:
|
|
62228
|
+
result.message,
|
|
62229
|
+
result.code,
|
|
62230
|
+
{ name: result.code },
|
|
62162
62231
|
{ operation: "tools.skill.propose-patch" }
|
|
62163
62232
|
);
|
|
62164
62233
|
process.exit(1);
|
|
62165
62234
|
return;
|
|
62166
62235
|
}
|
|
62167
|
-
if (
|
|
62168
|
-
try {
|
|
62169
|
-
execFileSync4("gh", ["--version"], { stdio: "pipe" });
|
|
62170
|
-
} catch {
|
|
62171
|
-
cliError(
|
|
62172
|
-
"gh CLI not found or not authenticated \u2014 install gh and run `gh auth login`",
|
|
62173
|
-
"E_GH_UNAVAILABLE",
|
|
62174
|
-
{ name: "E_GH_UNAVAILABLE" },
|
|
62175
|
-
{ operation: "tools.skill.propose-patch" }
|
|
62176
|
-
);
|
|
62177
|
-
process.exit(1);
|
|
62178
|
-
return;
|
|
62179
|
-
}
|
|
62180
|
-
}
|
|
62181
|
-
const timestamp2 = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
62182
|
-
const branchName = `propose-patch/skill-${skillName}-${timestamp2}`;
|
|
62183
|
-
const steps = [
|
|
62184
|
-
`git checkout -b ${branchName}`,
|
|
62185
|
-
`git apply ${resolvedDiff}`,
|
|
62186
|
-
`git add -A`,
|
|
62187
|
-
`git commit -m "skill(${skillName}): propose patch"`,
|
|
62188
|
-
`git push -u origin ${branchName}`,
|
|
62189
|
-
`gh pr create --base ${base} --head ${branchName} --title "${title}" --body <stdin>`
|
|
62190
|
-
];
|
|
62191
|
-
if (dryRun) {
|
|
62236
|
+
if (result.kind === "dry-run") {
|
|
62192
62237
|
cliOutput(
|
|
62193
62238
|
{
|
|
62194
|
-
skillName,
|
|
62195
|
-
diffPath:
|
|
62196
|
-
branchName,
|
|
62197
|
-
base,
|
|
62198
|
-
steps,
|
|
62239
|
+
skillName: result.skillName,
|
|
62240
|
+
diffPath: result.diffPath,
|
|
62241
|
+
branchName: result.branchName,
|
|
62242
|
+
base: result.base,
|
|
62243
|
+
steps: result.steps,
|
|
62199
62244
|
dryRun: true
|
|
62200
62245
|
},
|
|
62201
62246
|
{
|
|
62202
62247
|
command: "skills",
|
|
62203
|
-
message: `[dry-run] would open PR for ${skillName} on branch ${branchName}`,
|
|
62248
|
+
message: `[dry-run] would open PR for ${result.skillName} on branch ${result.branchName}`,
|
|
62204
62249
|
operation: "tools.skill.propose-patch"
|
|
62205
62250
|
}
|
|
62206
62251
|
);
|
|
62207
62252
|
return;
|
|
62208
62253
|
}
|
|
62209
|
-
|
|
62210
|
-
|
|
62211
|
-
|
|
62212
|
-
|
|
62213
|
-
|
|
62214
|
-
|
|
62215
|
-
|
|
62216
|
-
|
|
62217
|
-
|
|
62218
|
-
|
|
62219
|
-
|
|
62220
|
-
|
|
62221
|
-
|
|
62222
|
-
).toString("utf8").trim();
|
|
62223
|
-
return { prUrl, branchName };
|
|
62224
|
-
});
|
|
62225
|
-
cliOutput(
|
|
62226
|
-
{ skillName, prUrl: result.prUrl, branchName: result.branchName, base },
|
|
62227
|
-
{
|
|
62228
|
-
command: "skills",
|
|
62229
|
-
message: `Opened PR ${result.prUrl}`,
|
|
62230
|
-
operation: "tools.skill.propose-patch"
|
|
62231
|
-
}
|
|
62232
|
-
);
|
|
62233
|
-
} catch (err) {
|
|
62234
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
62235
|
-
cliError(
|
|
62236
|
-
`propose-patch failed: ${message}`,
|
|
62237
|
-
"E_PROPOSE_PATCH_FAILED",
|
|
62238
|
-
{ name: "E_PROPOSE_PATCH_FAILED" },
|
|
62239
|
-
{ operation: "tools.skill.propose-patch" }
|
|
62240
|
-
);
|
|
62241
|
-
process.exit(1);
|
|
62242
|
-
}
|
|
62243
|
-
void jsonMode;
|
|
62254
|
+
cliOutput(
|
|
62255
|
+
{
|
|
62256
|
+
skillName: result.skillName,
|
|
62257
|
+
prUrl: result.prUrl,
|
|
62258
|
+
branchName: result.branchName,
|
|
62259
|
+
base: result.base
|
|
62260
|
+
},
|
|
62261
|
+
{
|
|
62262
|
+
command: "skills",
|
|
62263
|
+
message: `Opened PR ${result.prUrl}`,
|
|
62264
|
+
operation: "tools.skill.propose-patch"
|
|
62265
|
+
}
|
|
62266
|
+
);
|
|
62244
62267
|
}
|
|
62245
62268
|
});
|
|
62246
62269
|
skillsCommand2 = defineCommand({
|
|
@@ -62265,6 +62288,7 @@ var init_skills2 = __esm({
|
|
|
62265
62288
|
"propose-patch": proposePatchCommand,
|
|
62266
62289
|
stats: statsCommand6,
|
|
62267
62290
|
"import-hermes": importHermesCommand,
|
|
62291
|
+
migrate: migrateCommand2,
|
|
62268
62292
|
"prune-telemetry": pruneTelemetryCommand
|
|
62269
62293
|
},
|
|
62270
62294
|
async run({ cmd, rawArgs }) {
|
|
@@ -63045,10 +63069,10 @@ var init_sync = __esm({
|
|
|
63045
63069
|
}
|
|
63046
63070
|
},
|
|
63047
63071
|
async run({ args }) {
|
|
63048
|
-
const { readFileSync:
|
|
63072
|
+
const { readFileSync: readFileSync18 } = await import("node:fs");
|
|
63049
63073
|
let externalTasks;
|
|
63050
63074
|
try {
|
|
63051
|
-
externalTasks = JSON.parse(
|
|
63075
|
+
externalTasks = JSON.parse(readFileSync18(args.file, "utf8"));
|
|
63052
63076
|
} catch (err) {
|
|
63053
63077
|
const message = err instanceof Error ? err.message : String(err);
|
|
63054
63078
|
cliError(`Failed to read or parse external tasks file: ${message}`, 2, {
|
|
@@ -63434,12 +63458,12 @@ var token_exports = {};
|
|
|
63434
63458
|
__export(token_exports, {
|
|
63435
63459
|
tokenCommand: () => tokenCommand
|
|
63436
63460
|
});
|
|
63437
|
-
import { readFileSync as
|
|
63461
|
+
import { readFileSync as readFileSync16 } from "node:fs";
|
|
63438
63462
|
import { getProjectRoot as getProjectRoot40, measureTokenExchange, recordTokenExchange as recordTokenExchange2 } from "@cleocode/core/internal";
|
|
63439
63463
|
function readPayload(args, textKey, fileKey) {
|
|
63440
63464
|
const text = args[textKey];
|
|
63441
63465
|
const file = args[fileKey];
|
|
63442
|
-
if (file) return
|
|
63466
|
+
if (file) return readFileSync16(file, "utf-8");
|
|
63443
63467
|
return text;
|
|
63444
63468
|
}
|
|
63445
63469
|
var filterArgs, summaryCommand3, listCommand25, showCommand16, deleteCommand3, clearCommand2, estimateCommand, tokenCommand;
|
|
@@ -63641,7 +63665,7 @@ import {
|
|
|
63641
63665
|
pruneTranscripts,
|
|
63642
63666
|
scanTranscripts
|
|
63643
63667
|
} from "@cleocode/core/gc/transcript.js";
|
|
63644
|
-
var scanCommand, extractCommand,
|
|
63668
|
+
var scanCommand, extractCommand, migrateCommand3, pruneCommand2, transcriptCommand;
|
|
63645
63669
|
var init_transcript = __esm({
|
|
63646
63670
|
"packages/cleo/src/cli/commands/transcript.ts"() {
|
|
63647
63671
|
"use strict";
|
|
@@ -63840,7 +63864,7 @@ var init_transcript = __esm({
|
|
|
63840
63864
|
}
|
|
63841
63865
|
}
|
|
63842
63866
|
});
|
|
63843
|
-
|
|
63867
|
+
migrateCommand3 = defineCommand({
|
|
63844
63868
|
meta: {
|
|
63845
63869
|
name: "migrate",
|
|
63846
63870
|
description: "Backfill extraction from existing ~/.claude/projects/ session JSONLs (T733)"
|
|
@@ -64036,7 +64060,7 @@ var init_transcript = __esm({
|
|
|
64036
64060
|
subCommands: {
|
|
64037
64061
|
scan: scanCommand,
|
|
64038
64062
|
extract: extractCommand,
|
|
64039
|
-
migrate:
|
|
64063
|
+
migrate: migrateCommand3,
|
|
64040
64064
|
prune: pruneCommand2
|
|
64041
64065
|
},
|
|
64042
64066
|
async run({ cmd, rawArgs }) {
|
|
@@ -64657,7 +64681,7 @@ var web_exports = {};
|
|
|
64657
64681
|
__export(web_exports, {
|
|
64658
64682
|
webCommand: () => webCommand
|
|
64659
64683
|
});
|
|
64660
|
-
import { execFileSync as
|
|
64684
|
+
import { execFileSync as execFileSync4, spawn as spawn3 } from "node:child_process";
|
|
64661
64685
|
import { mkdir as mkdir4, open, readFile as readFile6, rm, stat as stat2, writeFile as writeFile3 } from "node:fs/promises";
|
|
64662
64686
|
import { join as join30 } from "node:path";
|
|
64663
64687
|
import { CleoError as CleoError12, formatError as formatError9, getCleoHome as getCleoHome5 } from "@cleocode/core";
|
|
@@ -64721,7 +64745,7 @@ async function startWebServer(port, host) {
|
|
|
64721
64745
|
await stat2(webIndexPath);
|
|
64722
64746
|
} catch {
|
|
64723
64747
|
try {
|
|
64724
|
-
|
|
64748
|
+
execFileSync4("pnpm", ["--filter", "@cleocode/studio", "run", "build"], {
|
|
64725
64749
|
cwd: projectRoot,
|
|
64726
64750
|
stdio: "ignore"
|
|
64727
64751
|
});
|
|
@@ -65222,7 +65246,7 @@ var init_worktree3 = __esm({
|
|
|
65222
65246
|
init_dist();
|
|
65223
65247
|
init_field_context();
|
|
65224
65248
|
init_format_context();
|
|
65225
|
-
import { readFileSync as
|
|
65249
|
+
import { readFileSync as readFileSync17 } from "node:fs";
|
|
65226
65250
|
import { dirname as dirname12, join as join32 } from "node:path";
|
|
65227
65251
|
import { fileURLToPath as fileURLToPath8 } from "node:url";
|
|
65228
65252
|
|
|
@@ -66348,14 +66372,14 @@ function didYouMean(input2, candidates, maxDistance = 2) {
|
|
|
66348
66372
|
}
|
|
66349
66373
|
|
|
66350
66374
|
// packages/cleo/src/cli/lib/first-run-detection.ts
|
|
66351
|
-
import { existsSync as
|
|
66375
|
+
import { existsSync as existsSync16 } from "node:fs";
|
|
66352
66376
|
import { join as join31 } from "node:path";
|
|
66353
66377
|
async function detectFirstRun() {
|
|
66354
66378
|
const envKey = process.env["ANTHROPIC_API_KEY"];
|
|
66355
66379
|
if (typeof envKey === "string" && envKey.length > 0) return false;
|
|
66356
66380
|
const { getCleoPlatformPaths } = await import("@cleocode/paths");
|
|
66357
66381
|
const configPath = join31(getCleoPlatformPaths().config, "config.json");
|
|
66358
|
-
if (
|
|
66382
|
+
if (existsSync16(configPath)) return false;
|
|
66359
66383
|
try {
|
|
66360
66384
|
const { getCredentialPool } = await import("@cleocode/core/llm/credential-pool.js");
|
|
66361
66385
|
const pool = getCredentialPool();
|
|
@@ -66444,7 +66468,7 @@ Or via NodeSource: https://github.com/nodesource/distributions
|
|
|
66444
66468
|
}
|
|
66445
66469
|
function getPackageVersion() {
|
|
66446
66470
|
const pkgPath = join32(dirname12(fileURLToPath8(import.meta.url)), "../../package.json");
|
|
66447
|
-
const pkg = JSON.parse(
|
|
66471
|
+
const pkg = JSON.parse(readFileSync17(pkgPath, "utf-8"));
|
|
66448
66472
|
return pkg.version;
|
|
66449
66473
|
}
|
|
66450
66474
|
var CLI_VERSION = getPackageVersion();
|