selftune 0.2.22 → 0.2.24
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 +6 -0
- package/README.md +95 -15
- package/apps/local-dashboard/dist/assets/index-DgY2KGP-.css +1 -0
- package/apps/local-dashboard/dist/assets/index-Dmx7LPVX.js +15 -0
- package/apps/local-dashboard/dist/assets/vendor-react-C5oyHiV1.js +11 -0
- package/apps/local-dashboard/dist/assets/{vendor-table-BIiI3YhS.js → vendor-table-Bc_bbKd8.js} +1 -1
- package/apps/local-dashboard/dist/assets/vendor-ui-B3BPIYy7.js +1 -0
- package/apps/local-dashboard/dist/index.html +5 -5
- package/cli/selftune/adapters/codex/install.ts +310 -78
- package/cli/selftune/adapters/opencode/install.ts +3 -4
- package/cli/selftune/adapters/pi/hook.ts +273 -0
- package/cli/selftune/adapters/pi/install.ts +207 -0
- package/cli/selftune/alpha-upload/build-payloads.ts +3 -3
- package/cli/selftune/alpha-upload/stage-canonical.ts +17 -11
- package/cli/selftune/auto-update.ts +200 -8
- package/cli/selftune/canonical-export.ts +55 -25
- package/cli/selftune/command-surface.ts +397 -0
- package/cli/selftune/constants.ts +10 -1
- package/cli/selftune/contribute/contribute.ts +64 -13
- package/cli/selftune/contribution-config.ts +57 -3
- package/cli/selftune/contribution-preferences.ts +117 -0
- package/cli/selftune/contribution-signals.ts +8 -4
- package/cli/selftune/contribution-staging.ts +13 -2
- package/cli/selftune/contributions.ts +55 -121
- package/cli/selftune/creator-contributions.ts +29 -10
- package/cli/selftune/cron/setup.ts +7 -3
- package/cli/selftune/dashboard-contract.ts +87 -0
- package/cli/selftune/dashboard-server.ts +168 -17
- package/cli/selftune/dashboard.ts +350 -17
- package/cli/selftune/eval/baseline.ts +21 -5
- package/cli/selftune/eval/execution-eval.ts +170 -0
- package/cli/selftune/eval/family-overlap.ts +2 -2
- package/cli/selftune/eval/hooks-to-evals.ts +228 -82
- package/cli/selftune/eval/import-skillsbench.ts +2 -2
- package/cli/selftune/eval/invocation-classifier.ts +56 -0
- package/cli/selftune/eval/synthetic-evals.ts +5 -3
- package/cli/selftune/eval/unit-test-cli.ts +7 -4
- package/cli/selftune/evolution/apply-proposal.ts +295 -0
- package/cli/selftune/evolution/engines/judge-engine.ts +96 -0
- package/cli/selftune/evolution/engines/replay-engine.ts +180 -0
- package/cli/selftune/evolution/evidence.ts +2 -6
- package/cli/selftune/evolution/evolve-body.ts +152 -38
- package/cli/selftune/evolution/evolve.ts +244 -52
- package/cli/selftune/evolution/rollback.ts +0 -1
- package/cli/selftune/evolution/validate-body.ts +111 -49
- package/cli/selftune/evolution/validate-host-replay.ts +510 -60
- package/cli/selftune/evolution/validate-proposal.ts +11 -150
- package/cli/selftune/evolution/validate-routing.ts +51 -108
- package/cli/selftune/evolution/validation-contract.ts +91 -0
- package/cli/selftune/grading/auto-grade.ts +11 -7
- package/cli/selftune/grading/grade-session.ts +10 -16
- package/cli/selftune/hooks/skill-eval.ts +2 -1
- package/cli/selftune/hooks-shared/types.ts +1 -0
- package/cli/selftune/index.ts +58 -15
- package/cli/selftune/ingestors/claude-replay.ts +15 -10
- package/cli/selftune/ingestors/codex-wrapper.ts +3 -3
- package/cli/selftune/ingestors/opencode-ingest.ts +2 -2
- package/cli/selftune/ingestors/pi-ingest.ts +727 -0
- package/cli/selftune/init.ts +38 -4
- package/cli/selftune/localdb/direct-write.ts +120 -1
- package/cli/selftune/localdb/materialize.ts +6 -7
- package/cli/selftune/localdb/queries/cron.ts +34 -0
- package/cli/selftune/localdb/queries/dashboard.ts +834 -0
- package/cli/selftune/localdb/queries/evolution.ts +158 -0
- package/cli/selftune/localdb/queries/execution.ts +133 -0
- package/cli/selftune/localdb/queries/json.ts +18 -0
- package/cli/selftune/localdb/queries/monitoring.ts +263 -0
- package/cli/selftune/localdb/queries/raw.ts +95 -0
- package/cli/selftune/localdb/queries/staging.ts +270 -0
- package/cli/selftune/localdb/queries/trust.ts +392 -0
- package/cli/selftune/localdb/queries.ts +60 -2162
- package/cli/selftune/localdb/schema.ts +59 -0
- package/cli/selftune/monitoring/watch.ts +96 -29
- package/cli/selftune/normalization.ts +3 -0
- package/cli/selftune/observability.ts +12 -3
- package/cli/selftune/orchestrate/cli.ts +161 -0
- package/cli/selftune/orchestrate/execute.ts +295 -0
- package/cli/selftune/orchestrate/finalize.ts +157 -0
- package/cli/selftune/orchestrate/locks.ts +40 -0
- package/cli/selftune/orchestrate/plan.ts +131 -0
- package/cli/selftune/orchestrate/post-run.ts +59 -0
- package/cli/selftune/orchestrate/prepare.ts +334 -0
- package/cli/selftune/orchestrate/report.ts +182 -0
- package/cli/selftune/orchestrate/runtime.ts +120 -0
- package/cli/selftune/orchestrate/signals.ts +48 -0
- package/cli/selftune/orchestrate.ts +162 -1142
- package/cli/selftune/registry/client.ts +74 -0
- package/cli/selftune/registry/history.ts +54 -0
- package/cli/selftune/registry/index.ts +90 -0
- package/cli/selftune/registry/install.ts +141 -0
- package/cli/selftune/registry/list.ts +44 -0
- package/cli/selftune/registry/push.ts +171 -0
- package/cli/selftune/registry/rollback.ts +49 -0
- package/cli/selftune/registry/status.ts +62 -0
- package/cli/selftune/registry/sync.ts +125 -0
- package/cli/selftune/repair/skill-usage.ts +9 -3
- package/cli/selftune/routes/overview.ts +5 -2
- package/cli/selftune/routes/skill-report.ts +15 -2
- package/cli/selftune/schedule.ts +5 -5
- package/cli/selftune/status.ts +70 -2
- package/cli/selftune/sync.ts +127 -23
- package/cli/selftune/testing-readiness.ts +597 -0
- package/cli/selftune/types.ts +46 -5
- package/cli/selftune/uninstall.ts +2 -1
- package/cli/selftune/utils/canonical-log.ts +1 -9
- package/cli/selftune/utils/cli-error.ts +9 -0
- package/cli/selftune/utils/jsonl.ts +1 -30
- package/cli/selftune/utils/llm-call.ts +126 -6
- package/cli/selftune/utils/skill-discovery.ts +24 -0
- package/cli/selftune/workflows/proposals.ts +184 -0
- package/cli/selftune/workflows/skill-scaffold.ts +241 -0
- package/cli/selftune/workflows/workflows.ts +100 -26
- package/node_modules/@selftune/telemetry-contract/fixtures/complete-push.ts +1 -1
- package/node_modules/@selftune/telemetry-contract/fixtures/evidence-only-push.ts +2 -2
- package/node_modules/@selftune/telemetry-contract/fixtures/golden.test.ts +0 -1
- package/node_modules/@selftune/telemetry-contract/fixtures/partial-push-no-sessions.ts +1 -1
- package/node_modules/@selftune/telemetry-contract/fixtures/partial-push-unresolved-parents.ts +2 -2
- package/node_modules/@selftune/telemetry-contract/package.json +1 -1
- package/node_modules/@selftune/telemetry-contract/src/index.ts +1 -0
- package/node_modules/@selftune/telemetry-contract/src/schemas.ts +63 -5
- package/node_modules/@selftune/telemetry-contract/src/types.ts +97 -7
- package/node_modules/@selftune/telemetry-contract/tests/compatibility.test.ts +0 -1
- package/package.json +25 -9
- package/packages/dashboard-core/AGENTS.md +18 -0
- package/packages/dashboard-core/README.md +30 -0
- package/packages/dashboard-core/index.ts +3 -0
- package/packages/dashboard-core/package.json +39 -0
- package/packages/dashboard-core/src/chrome/DashboardChrome.tsx +74 -0
- package/packages/dashboard-core/src/chrome/DashboardHeader.tsx +200 -0
- package/packages/dashboard-core/src/chrome/DashboardSidebar.tsx +219 -0
- package/packages/dashboard-core/src/chrome/RuntimeBadge.tsx +46 -0
- package/packages/dashboard-core/src/chrome/index.ts +14 -0
- package/packages/dashboard-core/src/chrome/types.ts +81 -0
- package/packages/dashboard-core/src/chrome/utils.ts +23 -0
- package/packages/dashboard-core/src/gates/FeatureGate.tsx +11 -0
- package/packages/dashboard-core/src/gates/LockedRoute.tsx +29 -0
- package/packages/dashboard-core/src/gates/UpgradeCard.tsx +89 -0
- package/packages/dashboard-core/src/gates/index.ts +3 -0
- package/packages/dashboard-core/src/host/DashboardHostProvider.tsx +62 -0
- package/packages/dashboard-core/src/host/adapter.ts +47 -0
- package/packages/dashboard-core/src/host/capabilities.ts +55 -0
- package/packages/dashboard-core/src/host/index.ts +3 -0
- package/packages/dashboard-core/src/models/analytics.ts +39 -0
- package/packages/dashboard-core/src/models/index.ts +4 -0
- package/packages/dashboard-core/src/models/overview.ts +98 -0
- package/packages/dashboard-core/src/models/runtime.ts +7 -0
- package/packages/dashboard-core/src/models/skills.ts +34 -0
- package/packages/dashboard-core/src/routes/index.ts +2 -0
- package/packages/dashboard-core/src/routes/manifest.test.ts +70 -0
- package/packages/dashboard-core/src/routes/manifest.ts +451 -0
- package/packages/dashboard-core/src/routes/types.ts +39 -0
- package/packages/dashboard-core/src/screens/analytics/AnalyticsScreen.tsx +278 -0
- package/packages/dashboard-core/src/screens/analytics/index.ts +1 -0
- package/packages/dashboard-core/src/screens/index.ts +37 -0
- package/packages/dashboard-core/src/screens/overview/OverviewComparisonSurface.test.ts +101 -0
- package/packages/dashboard-core/src/screens/overview/OverviewComparisonSurface.tsx +393 -0
- package/packages/dashboard-core/src/screens/overview/OverviewCompositionSurface.test.tsx +113 -0
- package/packages/dashboard-core/src/screens/overview/OverviewCompositionSurface.tsx +72 -0
- package/packages/dashboard-core/src/screens/overview/OverviewCoreSurface.tsx +71 -0
- package/packages/dashboard-core/src/screens/overview/OverviewOnboardingBanner.tsx +90 -0
- package/packages/dashboard-core/src/screens/overview/OverviewRunSummary.tsx +40 -0
- package/packages/dashboard-core/src/screens/overview/index.ts +16 -0
- package/packages/dashboard-core/src/screens/overview/types.ts +13 -0
- package/packages/dashboard-core/src/screens/skill-report/SkillReportDailyBreakdownSection.tsx +99 -0
- package/packages/dashboard-core/src/screens/skill-report/SkillReportDataQualityTabContent.tsx +35 -0
- package/packages/dashboard-core/src/screens/skill-report/SkillReportEvidenceRail.tsx +71 -0
- package/packages/dashboard-core/src/screens/skill-report/SkillReportEvidenceSection.tsx +63 -0
- package/packages/dashboard-core/src/screens/skill-report/SkillReportEvidenceTabContent.tsx +25 -0
- package/packages/dashboard-core/src/screens/skill-report/SkillReportInvocationsSection.tsx +24 -0
- package/packages/dashboard-core/src/screens/skill-report/SkillReportMissedQueriesSection.tsx +79 -0
- package/packages/dashboard-core/src/screens/skill-report/SkillReportScaffold.tsx +150 -0
- package/packages/dashboard-core/src/screens/skill-report/SkillReportSections.test.tsx +224 -0
- package/packages/dashboard-core/src/screens/skill-report/SkillReportTabs.test.tsx +76 -0
- package/packages/dashboard-core/src/screens/skill-report/SkillReportTabs.tsx +88 -0
- package/packages/dashboard-core/src/screens/skill-report/SkillReportTrendSection.tsx +33 -0
- package/packages/dashboard-core/src/screens/skill-report/SkillReportTrustBadge.tsx +67 -0
- package/packages/dashboard-core/src/screens/skill-report/index.ts +45 -0
- package/packages/dashboard-core/src/screens/skills/SkillsLibraryScreen.tsx +162 -0
- package/packages/dashboard-core/src/screens/skills/index.ts +6 -0
- package/packages/telemetry-contract/fixtures/complete-push.ts +1 -1
- package/packages/telemetry-contract/fixtures/evidence-only-push.ts +2 -2
- package/packages/telemetry-contract/fixtures/golden.test.ts +0 -1
- package/packages/telemetry-contract/fixtures/partial-push-no-sessions.ts +1 -1
- package/packages/telemetry-contract/fixtures/partial-push-unresolved-parents.ts +2 -2
- package/packages/telemetry-contract/package.json +1 -1
- package/packages/telemetry-contract/src/index.ts +1 -0
- package/packages/telemetry-contract/src/schemas.ts +63 -5
- package/packages/telemetry-contract/src/types.ts +97 -7
- package/packages/telemetry-contract/tests/compatibility.test.ts +0 -1
- package/packages/ui/AGENTS.md +16 -0
- package/packages/ui/README.md +1 -1
- package/packages/ui/package.json +1 -1
- package/packages/ui/src/components/ActivityTimeline.tsx +152 -168
- package/packages/ui/src/components/AnalyticsCharts.tsx +344 -0
- package/packages/ui/src/components/EvidenceViewer.tsx +229 -464
- package/packages/ui/src/components/EvolutionTimeline.tsx +34 -87
- package/packages/ui/src/components/InfoTip.tsx +1 -2
- package/packages/ui/src/components/InvocationsPanel.tsx +413 -0
- package/packages/ui/src/components/JobHistoryTimeline.tsx +156 -0
- package/packages/ui/src/components/OrchestrateRunsPanel.tsx +18 -36
- package/packages/ui/src/components/OverviewPanels.tsx +693 -0
- package/packages/ui/src/components/PipelineStatusBar.tsx +65 -0
- package/packages/ui/src/components/SkillReportGuide.tsx +215 -0
- package/packages/ui/src/components/SkillReportPanels.tsx +919 -0
- package/packages/ui/src/components/SkillsLibrary.tsx +437 -0
- package/packages/ui/src/components/index.ts +56 -1
- package/packages/ui/src/components/section-cards.tsx +18 -35
- package/packages/ui/src/components/skill-health-grid.tsx +47 -37
- package/packages/ui/src/lib/constants.tsx +0 -1
- package/packages/ui/src/primitives/card.tsx +1 -1
- package/packages/ui/src/primitives/checkbox.tsx +1 -1
- package/packages/ui/src/primitives/dropdown-menu.tsx +2 -2
- package/packages/ui/src/primitives/select.tsx +2 -2
- package/packages/ui/src/primitives/tabs.tsx +7 -6
- package/packages/ui/src/types.ts +182 -4
- package/skill/SKILL.md +130 -318
- package/skill/agents/diagnosis-analyst.md +3 -3
- package/skill/agents/evolution-reviewer.md +3 -3
- package/skill/agents/integration-guide.md +3 -3
- package/skill/agents/pattern-analyst.md +2 -2
- package/skill/references/cli-quick-reference.md +89 -0
- package/skill/references/creator-playbook.md +131 -0
- package/skill/references/examples.md +48 -0
- package/skill/references/troubleshooting.md +47 -0
- package/skill/references/version-history.md +1 -1
- package/skill/selftune.contribute.json +11 -0
- package/skill/{Workflows → workflows}/Baseline.md +20 -1
- package/skill/{Workflows → workflows}/Contribute.md +23 -10
- package/skill/{Workflows → workflows}/Contributions.md +13 -5
- package/skill/workflows/CreateTestDeploy.md +170 -0
- package/skill/{Workflows → workflows}/CreatorContributions.md +18 -6
- package/skill/{Workflows → workflows}/Cron.md +1 -1
- package/skill/{Workflows → workflows}/Dashboard.md +20 -0
- package/skill/{Workflows → workflows}/Doctor.md +1 -1
- package/skill/{Workflows → workflows}/Evals.md +67 -2
- package/skill/{Workflows → workflows}/Evolve.md +119 -30
- package/skill/{Workflows → workflows}/EvolveBody.md +41 -1
- package/skill/{Workflows → workflows}/Grade.md +1 -1
- package/skill/{Workflows → workflows}/Ingest.md +60 -2
- package/skill/{Workflows → workflows}/Initialize.md +16 -9
- package/skill/{Workflows → workflows}/Orchestrate.md +13 -3
- package/skill/{Workflows → workflows}/PlatformHooks.md +19 -3
- package/skill/workflows/Registry.md +99 -0
- package/skill/{Workflows → workflows}/Schedule.md +3 -3
- package/skill/workflows/SignalsDashboard.md +87 -0
- package/skill/{Workflows → workflows}/Sync.md +3 -1
- package/skill/{Workflows → workflows}/UnitTest.md +19 -0
- package/skill/{Workflows → workflows}/Watch.md +42 -2
- package/skill/{Workflows → workflows}/Workflows.md +39 -2
- package/apps/local-dashboard/dist/assets/index-D8O-RG1I.js +0 -60
- package/apps/local-dashboard/dist/assets/index-_EcLywDg.css +0 -1
- package/apps/local-dashboard/dist/assets/vendor-react-CKkiCskZ.js +0 -11
- package/apps/local-dashboard/dist/assets/vendor-ui-CGEmUayx.js +0 -12
- package/cli/selftune/utils/html.ts +0 -27
- package/packages/ui/src/components/RecentActivityFeed.tsx +0 -117
- /package/skill/{Workflows → workflows}/AlphaUpload.md +0 -0
- /package/skill/{Workflows → workflows}/AutoActivation.md +0 -0
- /package/skill/{Workflows → workflows}/Badge.md +0 -0
- /package/skill/{Workflows → workflows}/Composability.md +0 -0
- /package/skill/{Workflows → workflows}/EvolutionMemory.md +0 -0
- /package/skill/{Workflows → workflows}/ExportCanonical.md +0 -0
- /package/skill/{Workflows → workflows}/Hook.md +0 -0
- /package/skill/{Workflows → workflows}/ImportSkillsBench.md +0 -0
- /package/skill/{Workflows → workflows}/Quickstart.md +0 -0
- /package/skill/{Workflows → workflows}/Recover.md +0 -0
- /package/skill/{Workflows → workflows}/RepairSkillUsage.md +0 -0
- /package/skill/{Workflows → workflows}/Replay.md +0 -0
- /package/skill/{Workflows → workflows}/Rollback.md +0 -0
- /package/skill/{Workflows → workflows}/Telemetry.md +0 -0
- /package/skill/{Workflows → workflows}/Uninstall.md +0 -0
package/cli/selftune/index.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* selftune CLI entry point.
|
|
4
4
|
*
|
|
5
5
|
* Usage:
|
|
6
|
-
* selftune ingest <agent> — Ingest agent sessions (claude, codex, opencode, openclaw, wrap-codex)
|
|
6
|
+
* selftune ingest <agent> — Ingest agent sessions (claude, codex, opencode, openclaw, pi, wrap-codex)
|
|
7
7
|
* selftune grade [mode] — Grade skill sessions (auto, baseline)
|
|
8
8
|
* selftune evolve [target] — Evolve skill descriptions (body, rollback)
|
|
9
9
|
* selftune eval <action> — Evaluation tools (generate, unit-test, import, composability, family-overlap)
|
|
@@ -21,21 +21,24 @@
|
|
|
21
21
|
* selftune contribute — Export anonymized skill data for community
|
|
22
22
|
* selftune contributions — Manage creator-directed sharing preferences
|
|
23
23
|
* selftune creator-contributions — Manage creator-side contribution configs
|
|
24
|
-
* selftune workflows — Discover and
|
|
24
|
+
* selftune workflows — Discover workflows and scaffold workflow skills
|
|
25
25
|
* selftune quickstart — Guided onboarding: init, ingest, status, and suggestions
|
|
26
26
|
* selftune repair-skill-usage — Rebuild trustworthy skill usage from transcripts
|
|
27
27
|
* selftune export — Export SQLite data to JSONL snapshots
|
|
28
28
|
* selftune export-canonical — Export canonical telemetry for downstream ingestion
|
|
29
29
|
* selftune recover — Recover SQLite from legacy/exported JSONL
|
|
30
30
|
* selftune telemetry — Manage anonymous usage analytics (status, enable, disable)
|
|
31
|
+
* selftune registry <sub> — Team skill distribution (push, install, sync, status, rollback, history, list)
|
|
31
32
|
* selftune alpha <subcommand> — Alpha program management (upload)
|
|
32
33
|
* selftune hook <name> — Run a hook by name (prompt-log, session-stop, etc.)
|
|
33
34
|
* selftune codex <subcommand> — Codex platform hooks (hook, install)
|
|
34
35
|
* selftune opencode <sub> — OpenCode platform hooks (hook, install)
|
|
35
36
|
* selftune cline <subcommand> — Cline platform hooks (hook, install)
|
|
37
|
+
* selftune pi <subcommand> — Pi platform hooks (hook, install)
|
|
36
38
|
*/
|
|
37
39
|
|
|
38
40
|
import { CLIError, handleCLIError } from "./utils/cli-error.js";
|
|
41
|
+
import { PUBLIC_COMMAND_SURFACES, renderCommandHelp } from "./command-surface.js";
|
|
39
42
|
|
|
40
43
|
process.on("uncaughtException", handleCLIError);
|
|
41
44
|
process.on("unhandledRejection", handleCLIError);
|
|
@@ -49,7 +52,7 @@ Usage:
|
|
|
49
52
|
selftune <command> [options]
|
|
50
53
|
|
|
51
54
|
Commands:
|
|
52
|
-
ingest <agent> Ingest agent sessions (claude, codex, opencode, openclaw, wrap-codex)
|
|
55
|
+
ingest <agent> Ingest agent sessions (claude, codex, opencode, openclaw, pi, wrap-codex)
|
|
53
56
|
grade [mode] Grade skill sessions (auto, baseline)
|
|
54
57
|
evolve [target] Evolve skill descriptions (body, rollback)
|
|
55
58
|
eval <action> Evaluation tools (generate, unit-test, import, composability, family-overlap)
|
|
@@ -67,25 +70,27 @@ Commands:
|
|
|
67
70
|
contribute Export anonymized skill data for community
|
|
68
71
|
contributions Manage creator-directed sharing preferences
|
|
69
72
|
creator-contributions Manage creator-side contribution configs
|
|
70
|
-
workflows Discover and
|
|
73
|
+
workflows Discover workflows and scaffold workflow skills
|
|
71
74
|
quickstart Guided onboarding: init, ingest, status, and suggestions
|
|
72
75
|
repair-skill-usage Rebuild trustworthy skill usage from transcripts
|
|
73
76
|
export Export SQLite data to JSONL snapshots
|
|
74
77
|
export-canonical Export canonical telemetry for downstream ingestion
|
|
75
78
|
recover Recover SQLite from legacy/exported JSONL
|
|
79
|
+
registry <sub> Team skill distribution (push, install, sync, status, rollback, history, list)
|
|
76
80
|
alpha <subcommand> Alpha program management (upload)
|
|
77
81
|
telemetry Manage anonymous usage analytics (status, enable, disable)
|
|
78
82
|
hook <name> Run a hook by name (prompt-log, session-stop, etc.)
|
|
79
83
|
codex <sub> Codex platform hooks (hook, install)
|
|
80
84
|
opencode <sub> OpenCode platform hooks (hook, install)
|
|
81
85
|
cline <sub> Cline platform hooks (hook, install)
|
|
86
|
+
pi <sub> Pi platform hooks (hook, install)
|
|
82
87
|
|
|
83
88
|
Run 'selftune <command> --help' for command-specific options.`);
|
|
84
89
|
process.exit(0);
|
|
85
90
|
}
|
|
86
91
|
|
|
87
92
|
// Fast-path commands (real-time hooks) — skip analytics and auto-update to minimize latency
|
|
88
|
-
const FAST_COMMANDS: ReadonlySet<string> = new Set(["hook", "codex", "opencode", "cline"]);
|
|
93
|
+
const FAST_COMMANDS: ReadonlySet<string> = new Set(["hook", "codex", "opencode", "cline", "pi"]);
|
|
89
94
|
|
|
90
95
|
// Track command usage (lazy import — skip for hooks and --help to avoid loading crypto/os)
|
|
91
96
|
if (command && !FAST_COMMANDS.has(command) && command !== "--help" && command !== "-h") {
|
|
@@ -129,6 +134,7 @@ Agents:
|
|
|
129
134
|
codex Ingest Codex rollout logs (experimental)
|
|
130
135
|
opencode Ingest OpenCode sessions (experimental)
|
|
131
136
|
openclaw Ingest OpenClaw sessions (experimental)
|
|
137
|
+
pi Ingest Pi sessions (experimental)
|
|
132
138
|
wrap-codex Wrap codex exec with real-time telemetry (experimental)
|
|
133
139
|
|
|
134
140
|
Run 'selftune ingest <agent> --help' for agent-specific options.`);
|
|
@@ -157,6 +163,11 @@ Run 'selftune ingest <agent> --help' for agent-specific options.`);
|
|
|
157
163
|
cliMain();
|
|
158
164
|
break;
|
|
159
165
|
}
|
|
166
|
+
case "pi": {
|
|
167
|
+
const { cliMain } = await import("./ingestors/pi-ingest.js");
|
|
168
|
+
cliMain();
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
160
171
|
case "wrap-codex": {
|
|
161
172
|
const { cliMain } = await import("./ingestors/codex-wrapper.js");
|
|
162
173
|
await cliMain();
|
|
@@ -217,12 +228,12 @@ Run 'selftune grade <subcommand> --help' for subcommand-specific options.`);
|
|
|
217
228
|
case "evolve": {
|
|
218
229
|
const sub = process.argv[2];
|
|
219
230
|
if (sub === "--help" || sub === "-h") {
|
|
220
|
-
console.log(
|
|
231
|
+
console.log(`${renderCommandHelp(PUBLIC_COMMAND_SURFACES.evolve)}
|
|
221
232
|
|
|
222
|
-
|
|
223
|
-
selftune evolve [options]
|
|
224
|
-
selftune evolve
|
|
225
|
-
selftune evolve
|
|
233
|
+
Subcommands:
|
|
234
|
+
selftune evolve body [options] Evolve full body or routing table
|
|
235
|
+
selftune evolve rollback [options] Rollback a previous evolution
|
|
236
|
+
selftune evolve apply-proposal [options] Apply an approved contributor proposal
|
|
226
237
|
|
|
227
238
|
Run 'selftune evolve <subcommand> --help' for subcommand-specific options.`);
|
|
228
239
|
process.exit(0);
|
|
@@ -245,6 +256,11 @@ Run 'selftune evolve <subcommand> --help' for subcommand-specific options.`);
|
|
|
245
256
|
await cliMain();
|
|
246
257
|
break;
|
|
247
258
|
}
|
|
259
|
+
case "apply-proposal": {
|
|
260
|
+
const { cliMain } = await import("./evolution/apply-proposal.js");
|
|
261
|
+
await cliMain();
|
|
262
|
+
break;
|
|
263
|
+
}
|
|
248
264
|
default:
|
|
249
265
|
throw new CLIError(
|
|
250
266
|
`Unknown evolve target: ${sub}`,
|
|
@@ -271,6 +287,12 @@ Actions:
|
|
|
271
287
|
composability Analyze skill co-occurrence conflicts
|
|
272
288
|
family-overlap Detect sibling-skill overlap and consolidation pressure
|
|
273
289
|
|
|
290
|
+
Recommended creator loop:
|
|
291
|
+
1. selftune eval generate --skill <name>
|
|
292
|
+
2. selftune eval unit-test --skill <name> --generate --skill-path <path>
|
|
293
|
+
3. selftune evolve --skill <name> --skill-path <path> --dry-run --validation-mode replay
|
|
294
|
+
4. selftune grade baseline --skill <name> --skill-path <path>
|
|
295
|
+
|
|
274
296
|
Run 'selftune eval <action> --help' for action-specific options.`);
|
|
275
297
|
process.exit(0);
|
|
276
298
|
}
|
|
@@ -327,7 +349,8 @@ Run 'selftune eval <action> --help' for action-specific options.`);
|
|
|
327
349
|
"selftune eval composability --skill <name>",
|
|
328
350
|
);
|
|
329
351
|
}
|
|
330
|
-
const logPath =
|
|
352
|
+
const logPath =
|
|
353
|
+
typeof values["telemetry-log"] === "string" ? values["telemetry-log"] : TELEMETRY_LOG;
|
|
331
354
|
let telemetry: unknown[];
|
|
332
355
|
if (logPath === TELEMETRY_LOG) {
|
|
333
356
|
try {
|
|
@@ -353,7 +376,19 @@ Run 'selftune eval <action> --help' for action-specific options.`);
|
|
|
353
376
|
);
|
|
354
377
|
}
|
|
355
378
|
const windowSize = rawWindow === undefined ? undefined : Number(rawWindow);
|
|
356
|
-
const
|
|
379
|
+
const skillName = typeof values.skill === "string" ? values.skill : undefined;
|
|
380
|
+
if (!skillName) {
|
|
381
|
+
throw new CLIError(
|
|
382
|
+
"--skill <name> is required.",
|
|
383
|
+
"MISSING_FLAG",
|
|
384
|
+
"selftune eval composability --skill <name>",
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
const report = analyzeComposability(
|
|
388
|
+
skillName,
|
|
389
|
+
telemetry as import("./types.js").SessionTelemetryRecord[],
|
|
390
|
+
windowSize,
|
|
391
|
+
);
|
|
357
392
|
console.log(JSON.stringify(report, null, 2));
|
|
358
393
|
break;
|
|
359
394
|
}
|
|
@@ -620,6 +655,11 @@ Options:
|
|
|
620
655
|
await cliMain();
|
|
621
656
|
break;
|
|
622
657
|
}
|
|
658
|
+
case "registry": {
|
|
659
|
+
const { cliMain } = await import("./registry/index.js");
|
|
660
|
+
await cliMain();
|
|
661
|
+
break;
|
|
662
|
+
}
|
|
623
663
|
case "alpha": {
|
|
624
664
|
const sub = process.argv[2];
|
|
625
665
|
if (!sub || sub === "--help" || sub === "-h") {
|
|
@@ -705,7 +745,7 @@ Output:
|
|
|
705
745
|
userId: identity.user_id,
|
|
706
746
|
agentType: readConfiguredAgentType(SELFTUNE_CONFIG_PATH, "unknown"),
|
|
707
747
|
selftuneVersion: getSelftuneVersion(),
|
|
708
|
-
dryRun: values["dry-run"]
|
|
748
|
+
dryRun: values["dry-run"] === true,
|
|
709
749
|
apiKey: identity.api_key,
|
|
710
750
|
});
|
|
711
751
|
|
|
@@ -828,9 +868,12 @@ Output:
|
|
|
828
868
|
|
|
829
869
|
case "codex":
|
|
830
870
|
case "opencode":
|
|
831
|
-
case "cline":
|
|
871
|
+
case "cline":
|
|
872
|
+
case "pi": {
|
|
832
873
|
const platform = command;
|
|
833
|
-
const displayName = { codex: "Codex", opencode: "OpenCode", cline: "Cline" }[
|
|
874
|
+
const displayName = { codex: "Codex", opencode: "OpenCode", cline: "Cline", pi: "Pi" }[
|
|
875
|
+
platform
|
|
876
|
+
];
|
|
834
877
|
const sub = process.argv[2];
|
|
835
878
|
if (!sub || sub === "--help" || sub === "-h") {
|
|
836
879
|
console.log(`selftune ${platform} — ${displayName} platform hooks
|
|
@@ -347,13 +347,15 @@ export function cliMain(): void {
|
|
|
347
347
|
);
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
-
const projectsDir =
|
|
350
|
+
const projectsDir =
|
|
351
|
+
typeof values["projects-dir"] === "string" ? values["projects-dir"] : CLAUDE_CODE_PROJECTS_DIR;
|
|
351
352
|
let since: Date | undefined;
|
|
352
|
-
|
|
353
|
-
|
|
353
|
+
const sinceValue = typeof values.since === "string" ? values.since : undefined;
|
|
354
|
+
if (sinceValue) {
|
|
355
|
+
since = new Date(sinceValue);
|
|
354
356
|
if (Number.isNaN(since.getTime())) {
|
|
355
357
|
throw new CLIError(
|
|
356
|
-
`Invalid --since date: "${
|
|
358
|
+
`Invalid --since date: "${sinceValue}"`,
|
|
357
359
|
"INVALID_FLAG",
|
|
358
360
|
"selftune ingest claude --since 2026-01-01",
|
|
359
361
|
);
|
|
@@ -376,32 +378,35 @@ export function cliMain(): void {
|
|
|
376
378
|
);
|
|
377
379
|
|
|
378
380
|
if (since) {
|
|
379
|
-
console.log(` Filtering to sessions from ${
|
|
381
|
+
console.log(` Filtering to sessions from ${sinceValue} onward.`);
|
|
380
382
|
}
|
|
381
383
|
|
|
382
384
|
let ingestedCount = 0;
|
|
383
385
|
let skippedCount = 0;
|
|
384
386
|
|
|
387
|
+
const dryRun = values["dry-run"] === true;
|
|
388
|
+
const verbose = values.verbose === true;
|
|
389
|
+
|
|
385
390
|
for (const transcriptFile of pending) {
|
|
386
391
|
const session = parseSession(transcriptFile);
|
|
387
392
|
if (session === null) {
|
|
388
|
-
if (
|
|
393
|
+
if (verbose) {
|
|
389
394
|
console.log(` SKIP (empty/no queries): ${basename(transcriptFile)}`);
|
|
390
395
|
}
|
|
391
396
|
skippedCount += 1;
|
|
392
397
|
continue;
|
|
393
398
|
}
|
|
394
399
|
|
|
395
|
-
if (
|
|
396
|
-
console.log(` ${
|
|
400
|
+
if (verbose || dryRun) {
|
|
401
|
+
console.log(` ${dryRun ? "[DRY] " : ""}Ingesting: ${basename(transcriptFile)}`);
|
|
397
402
|
}
|
|
398
403
|
|
|
399
|
-
writeSession(session,
|
|
404
|
+
writeSession(session, dryRun);
|
|
400
405
|
newIngested.add(transcriptFile);
|
|
401
406
|
ingestedCount += 1;
|
|
402
407
|
}
|
|
403
408
|
|
|
404
|
-
if (!
|
|
409
|
+
if (!dryRun) {
|
|
405
410
|
saveMarker(CLAUDE_CODE_MARKER, new Set([...alreadyIngested, ...newIngested]));
|
|
406
411
|
}
|
|
407
412
|
|
|
@@ -87,7 +87,7 @@ export function extractPromptFromArgs(args: string[]): string {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
export interface ParsedCodexStream {
|
|
90
|
-
thread_id
|
|
90
|
+
thread_id?: string;
|
|
91
91
|
tool_calls: Record<string, number>;
|
|
92
92
|
total_tool_calls: number;
|
|
93
93
|
bash_commands: string[];
|
|
@@ -96,7 +96,7 @@ export interface ParsedCodexStream {
|
|
|
96
96
|
errors_encountered: number;
|
|
97
97
|
input_tokens: number;
|
|
98
98
|
output_tokens: number;
|
|
99
|
-
agent_summary
|
|
99
|
+
agent_summary?: string;
|
|
100
100
|
transcript_chars: number;
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -475,7 +475,7 @@ export async function cliMain(): Promise<void> {
|
|
|
475
475
|
// Parse and log
|
|
476
476
|
const metrics = parseJsonlStream(collectedLines, skillNames);
|
|
477
477
|
const actualThreadId = metrics.thread_id;
|
|
478
|
-
const sessionId = actualThreadId !== "unknown" ? actualThreadId : threadId;
|
|
478
|
+
const sessionId = actualThreadId && actualThreadId !== "unknown" ? actualThreadId : threadId;
|
|
479
479
|
|
|
480
480
|
const { thread_id: _, ...metricsWithoutThread } = metrics;
|
|
481
481
|
|
|
@@ -210,7 +210,7 @@ export function readSessionsFromSqlite(
|
|
|
210
210
|
|
|
211
211
|
// Get sessions
|
|
212
212
|
let whereClause = "";
|
|
213
|
-
const queryParams:
|
|
213
|
+
const queryParams: number[] = [];
|
|
214
214
|
if (sinceTs) {
|
|
215
215
|
whereClause = "WHERE created > ?";
|
|
216
216
|
queryParams.push(Math.floor(sinceTs * 1000));
|
|
@@ -239,7 +239,7 @@ export function readSessionsFromSqlite(
|
|
|
239
239
|
try {
|
|
240
240
|
msgRows = db
|
|
241
241
|
.query(`SELECT * FROM ${safeMessagesTable} WHERE session_id = ? ORDER BY created ASC`)
|
|
242
|
-
.all(sessionRow.id) as Array<Record<string, unknown>>;
|
|
242
|
+
.all(String(sessionRow.id)) as Array<Record<string, unknown>>;
|
|
243
243
|
} catch {
|
|
244
244
|
continue;
|
|
245
245
|
}
|