selftune 0.2.21 → 0.2.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -8
- package/apps/local-dashboard/dist/assets/index-CwOtTrUS.css +1 -0
- package/apps/local-dashboard/dist/assets/index-f1HQpbeH.js +59 -0
- package/apps/local-dashboard/dist/assets/vendor-ui-jVSaIZey.js +12 -0
- package/apps/local-dashboard/dist/index.html +3 -3
- package/cli/selftune/adapters/cline/hook.ts +167 -0
- package/cli/selftune/adapters/cline/install.ts +197 -0
- package/cli/selftune/adapters/codex/hook.ts +296 -0
- package/cli/selftune/adapters/codex/install.ts +289 -0
- package/cli/selftune/adapters/opencode/hook.ts +222 -0
- package/cli/selftune/adapters/opencode/install.ts +543 -0
- package/cli/selftune/adapters/pi/hook.ts +273 -0
- package/cli/selftune/adapters/pi/install.ts +207 -0
- package/cli/selftune/constants.ts +10 -1
- package/cli/selftune/dashboard-contract.ts +14 -0
- package/cli/selftune/evolution/engines/judge-engine.ts +96 -0
- package/cli/selftune/evolution/engines/replay-engine.ts +158 -0
- package/cli/selftune/evolution/evidence.ts +2 -6
- package/cli/selftune/evolution/evolve-body.ts +73 -20
- package/cli/selftune/evolution/validate-body.ts +78 -42
- package/cli/selftune/evolution/validate-routing.ts +45 -104
- package/cli/selftune/hooks/auto-activate.ts +43 -37
- package/cli/selftune/hooks/skill-eval.ts +2 -1
- package/cli/selftune/hooks-shared/git-metadata.ts +149 -0
- package/cli/selftune/hooks-shared/hook-output.ts +105 -0
- package/cli/selftune/hooks-shared/normalize.ts +196 -0
- package/cli/selftune/hooks-shared/session-state.ts +76 -0
- package/cli/selftune/hooks-shared/skill-paths.ts +50 -0
- package/cli/selftune/hooks-shared/stdin-dispatch.ts +59 -0
- package/cli/selftune/hooks-shared/types.ts +91 -0
- package/cli/selftune/index.ts +76 -6
- package/cli/selftune/ingestors/pi-ingest.ts +726 -0
- package/cli/selftune/init.ts +11 -1
- package/cli/selftune/localdb/direct-write.ts +85 -0
- package/cli/selftune/localdb/materialize.ts +6 -7
- package/cli/selftune/localdb/queries.ts +126 -0
- package/cli/selftune/localdb/schema.ts +38 -0
- package/cli/selftune/observability.ts +8 -1
- package/cli/selftune/orchestrate.ts +43 -0
- 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 +4 -1
- package/cli/selftune/status.ts +31 -0
- package/cli/selftune/sync.ts +127 -23
- package/cli/selftune/types.ts +2 -1
- package/cli/selftune/utils/jsonl.ts +1 -30
- package/cli/selftune/utils/llm-call.ts +99 -34
- package/cli/selftune/utils/skill-discovery.ts +22 -0
- package/node_modules/@selftune/telemetry-contract/fixtures/evidence-only-push.ts +1 -1
- package/node_modules/@selftune/telemetry-contract/fixtures/golden.test.ts +0 -1
- package/node_modules/@selftune/telemetry-contract/fixtures/partial-push-unresolved-parents.ts +1 -1
- 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 +22 -4
- package/node_modules/@selftune/telemetry-contract/src/types.ts +1 -12
- package/node_modules/@selftune/telemetry-contract/tests/compatibility.test.ts +0 -1
- package/package.json +1 -1
- package/packages/telemetry-contract/fixtures/evidence-only-push.ts +1 -1
- package/packages/telemetry-contract/fixtures/golden.test.ts +0 -1
- package/packages/telemetry-contract/fixtures/partial-push-unresolved-parents.ts +1 -1
- package/packages/telemetry-contract/package.json +1 -1
- package/packages/telemetry-contract/src/index.ts +1 -0
- package/packages/telemetry-contract/src/schemas.ts +22 -4
- package/packages/telemetry-contract/src/types.ts +1 -12
- 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 +153 -443
- 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 +652 -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/types.ts +172 -4
- package/skill/SKILL.md +26 -2
- package/skill/Workflows/Ingest.md +60 -2
- package/skill/Workflows/Initialize.md +54 -9
- package/skill/Workflows/PlatformHooks.md +109 -0
- package/skill/Workflows/Registry.md +99 -0
- package/skill/Workflows/Sync.md +3 -1
- 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-ui-CGEmUayx.js +0 -12
- package/cli/selftune/utils/html.ts +0 -27
- package/packages/ui/src/components/RecentActivityFeed.tsx +0 -117
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Platform Hooks Workflow
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Install and configure selftune hooks for non-Claude-Code platforms (Codex, OpenCode, Cline, Pi).
|
|
6
|
+
|
|
7
|
+
## When to Use
|
|
8
|
+
|
|
9
|
+
- User wants selftune on Codex, OpenCode, Cline, or Pi
|
|
10
|
+
- User asks about multi-platform support
|
|
11
|
+
- User wants real-time skill tracking on a non-Claude-Code agent
|
|
12
|
+
|
|
13
|
+
## Commands
|
|
14
|
+
|
|
15
|
+
### Install hooks for a platform
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
selftune <platform> install [--dry-run] [--uninstall]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Supported platforms: `codex`, `opencode`, `cline`, `pi`
|
|
22
|
+
|
|
23
|
+
| Flag | Description |
|
|
24
|
+
| ------------- | ---------------------------------------------- |
|
|
25
|
+
| `--dry-run` | Preview what would be installed without writing |
|
|
26
|
+
| `--uninstall` | Remove selftune hooks from the platform |
|
|
27
|
+
| `--help, -h` | Show usage help |
|
|
28
|
+
|
|
29
|
+
### Hook handler (called by the agent, not the user)
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
selftune <platform> hook
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
This is called automatically by the agent's hook system. Users don't run this directly.
|
|
36
|
+
|
|
37
|
+
## Platform Details
|
|
38
|
+
|
|
39
|
+
### Codex
|
|
40
|
+
|
|
41
|
+
- Config: `~/.codex/hooks.json`
|
|
42
|
+
- Events: SessionStart, PreToolUse, PostToolUse, Stop
|
|
43
|
+
- Install creates hooks.json entries that prefer `$SELFTUNE_CLI_PATH codex hook`, otherwise `npx -y selftune@latest codex hook`
|
|
44
|
+
|
|
45
|
+
### OpenCode
|
|
46
|
+
|
|
47
|
+
- Config: `./opencode.json` or `~/.config/opencode/opencode.json`
|
|
48
|
+
- Plugin dir: `~/.config/opencode/plugins/` (global) or `./.opencode/plugins/` (project)
|
|
49
|
+
- Events: tool.execute.before, tool.execute.after, session.idle (via event handler)
|
|
50
|
+
- Install writes a TypeScript plugin file (`selftune-opencode-plugin.ts`) into the plugins directory (auto-discovered by OpenCode at startup)
|
|
51
|
+
- Agents are registered in the `agent` config key (identified by `[selftune]` description prefix)
|
|
52
|
+
|
|
53
|
+
### Cline
|
|
54
|
+
|
|
55
|
+
- Config: `~/Documents/Cline/Hooks/`
|
|
56
|
+
- Events: PostToolUse, TaskComplete, TaskCancel
|
|
57
|
+
- Install creates executable shell scripts in the hooks directory
|
|
58
|
+
|
|
59
|
+
### Pi
|
|
60
|
+
|
|
61
|
+
- Config: `~/.pi/extensions/selftune/`
|
|
62
|
+
- Sessions: `~/.pi/agent/sessions/`
|
|
63
|
+
- Events: tool_call, tool_result, message, session_shutdown
|
|
64
|
+
- Install creates executable hook scripts in the extensions directory
|
|
65
|
+
|
|
66
|
+
## Examples
|
|
67
|
+
|
|
68
|
+
### Codex
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
selftune codex install # Install hooks into ~/.codex/hooks.json
|
|
72
|
+
selftune codex install --dry-run # Preview changes without writing
|
|
73
|
+
selftune codex install --uninstall # Remove selftune hooks
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### OpenCode
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
selftune opencode install # Install plugin (selftune-opencode-plugin.ts) + config entries
|
|
80
|
+
selftune opencode install --dry-run # Preview changes without writing
|
|
81
|
+
selftune opencode install --uninstall # Remove selftune plugin and config entries
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Cline
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
selftune cline install # Create hook scripts in ~/Documents/Cline/Hooks/
|
|
88
|
+
selftune cline install --dry-run # Preview what would be created
|
|
89
|
+
selftune cline install --uninstall # Remove selftune hook scripts
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Pi
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
selftune pi install # Install hooks into ~/.pi/extensions/selftune/
|
|
96
|
+
selftune pi install --dry-run # Preview changes without writing
|
|
97
|
+
selftune pi install --uninstall # Remove selftune hooks
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Hook handler (agent-only, not user-facing)
|
|
101
|
+
|
|
102
|
+
The hook subcommand is called automatically by the agent. Users do not run it directly:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
printf '%s\n' "$PAYLOAD" | selftune codex hook
|
|
106
|
+
printf '%s\n' "$PAYLOAD" | selftune opencode hook
|
|
107
|
+
printf '%s\n' "$PAYLOAD" | selftune cline hook
|
|
108
|
+
printf '%s\n' "$PAYLOAD" | selftune pi hook
|
|
109
|
+
```
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Registry — Team Skill Distribution
|
|
2
|
+
|
|
3
|
+
Manage versioned skill distribution across your team. Push skill folders to the cloud, install from the registry, sync to latest versions, and rollback when needed.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
| Command | Flags | What It Does |
|
|
8
|
+
|---------|-------|-------------|
|
|
9
|
+
| `selftune registry push [name]` | `--version=<semver>` `--summary=<text>` | Archive current skill folder and push as a new version |
|
|
10
|
+
| `selftune registry install <name>` | `--global` | Download and extract a skill from the registry |
|
|
11
|
+
| `selftune registry sync` | | Check all installed entries for updates, pull latest |
|
|
12
|
+
| `selftune registry status` | | Show installed entries with version drift |
|
|
13
|
+
| `selftune registry rollback <name>` | `--to=<version>` `--reason=<text>` | Rollback a skill to a previous version |
|
|
14
|
+
| `selftune registry history <name>` | | Show version timeline with quality data |
|
|
15
|
+
| `selftune registry list` | | Show all published entries in the org |
|
|
16
|
+
|
|
17
|
+
## When to Use
|
|
18
|
+
|
|
19
|
+
- User says "push this skill to the team" → `selftune registry push`
|
|
20
|
+
- User says "install the deploy skill" → `selftune registry install deploy`
|
|
21
|
+
- User says "update my skills" or "sync registry" → `selftune registry sync`
|
|
22
|
+
- User says "check for updates" → `selftune registry status`
|
|
23
|
+
- User says "rollback the deploy skill" → `selftune registry rollback deploy`
|
|
24
|
+
- User says "show version history" → `selftune registry history <name>`
|
|
25
|
+
- User says "what's in the registry" → `selftune registry list`
|
|
26
|
+
|
|
27
|
+
## Push Workflow
|
|
28
|
+
|
|
29
|
+
1. Navigate to the skill directory (must contain `SKILL.md`)
|
|
30
|
+
2. Run `selftune registry push` — archives the entire folder (SKILL.md + scripts/ + assets/)
|
|
31
|
+
3. The skill name and description are extracted from SKILL.md frontmatter
|
|
32
|
+
4. Use `--version=1.0.0` for explicit semver, otherwise auto-generated
|
|
33
|
+
5. Use `--summary="Added new trigger keywords"` for change notes
|
|
34
|
+
|
|
35
|
+
## Install Workflow
|
|
36
|
+
|
|
37
|
+
1. Run `selftune registry install <name>` to pull from the registry
|
|
38
|
+
2. By default, installs to `.claude/skills/<name>/` in the current project
|
|
39
|
+
3. Use `--global` to install to `~/.claude/skills/<name>/` (available everywhere)
|
|
40
|
+
4. Installation is tracked — `selftune registry status` shows what's installed
|
|
41
|
+
|
|
42
|
+
## Sync Workflow
|
|
43
|
+
|
|
44
|
+
1. Run `selftune registry sync` to check all installations for updates
|
|
45
|
+
2. Only downloads archives when the version hash differs (lightweight check)
|
|
46
|
+
3. Local state is stored at `~/.selftune/registry-state.json`
|
|
47
|
+
|
|
48
|
+
## Rollback Workflow
|
|
49
|
+
|
|
50
|
+
1. Run `selftune registry rollback <name>` to revert to the previous version
|
|
51
|
+
2. Use `--to=1.0.0` to target a specific version
|
|
52
|
+
3. After rollback, tell team members to run `selftune registry sync`
|
|
53
|
+
4. Rollback is recorded with timestamp and reason
|
|
54
|
+
|
|
55
|
+
## Prerequisites
|
|
56
|
+
|
|
57
|
+
- Must be authenticated (`selftune alpha upload` to set up API key)
|
|
58
|
+
- Push and rollback require Team plan and admin role
|
|
59
|
+
- Install requires Pro plan or higher
|
|
60
|
+
|
|
61
|
+
## Output Format
|
|
62
|
+
|
|
63
|
+
All commands output JSON for agent consumption:
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
// push
|
|
67
|
+
{"success": true, "name": "deploy", "version": "1.2.0", "files": 8, "size": 4096, "hash": "abc123"}
|
|
68
|
+
|
|
69
|
+
// sync
|
|
70
|
+
{"synced": 2, "failed": 0, "total": 5}
|
|
71
|
+
|
|
72
|
+
// status
|
|
73
|
+
{"installations": [{"name": "deploy", "installed": "1.1.0", "latest": "1.2.0", "status": "behind"}]}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Common Patterns
|
|
77
|
+
|
|
78
|
+
**User wants to share a skill with the team**
|
|
79
|
+
|
|
80
|
+
> Run `selftune registry push` from the skill directory. Report the version
|
|
81
|
+
> and file count from the JSON output.
|
|
82
|
+
|
|
83
|
+
**User wants to install a shared skill**
|
|
84
|
+
|
|
85
|
+
> Run `selftune registry install <name>`. Use `--global` if they want it
|
|
86
|
+
> available across all projects.
|
|
87
|
+
|
|
88
|
+
**User wants to check what's outdated**
|
|
89
|
+
|
|
90
|
+
> Run `selftune registry status`. Report entries where `status` is `"behind"`.
|
|
91
|
+
|
|
92
|
+
**User wants to update everything**
|
|
93
|
+
|
|
94
|
+
> Run `selftune registry sync`. Report `synced` and `failed` counts.
|
|
95
|
+
|
|
96
|
+
**User wants to undo a bad version**
|
|
97
|
+
|
|
98
|
+
> Run `selftune registry rollback <name> --reason="regression in trigger accuracy"`.
|
|
99
|
+
> Remind them to have team members run `selftune registry sync` afterward.
|
package/skill/Workflows/Sync.md
CHANGED
|
@@ -10,7 +10,7 @@ also writes the compatibility repaired overlay JSONL.
|
|
|
10
10
|
## When to Use
|
|
11
11
|
|
|
12
12
|
- Before running `status`, `dashboard`, `watch`, or `evolve` when data may be stale
|
|
13
|
-
- The user has run many Claude Code, Codex, OpenCode, or
|
|
13
|
+
- The user has run many Claude Code, Codex, OpenCode, OpenClaw, or Pi sessions since last sync
|
|
14
14
|
- The agent detects host logs may be polluted and needs the repaired/source-first view
|
|
15
15
|
- Before inspecting alpha-upload readiness or pushing fresh cloud data
|
|
16
16
|
|
|
@@ -31,6 +31,8 @@ selftune sync
|
|
|
31
31
|
| `--no-codex` | Skip Codex rollout ingest |
|
|
32
32
|
| `--no-opencode` | Skip OpenCode ingest |
|
|
33
33
|
| `--no-openclaw` | Skip OpenClaw ingest |
|
|
34
|
+
| `--no-pi` | Skip Pi ingest |
|
|
35
|
+
| `--pi-sessions-dir <dir>` | Pi sessions directory (default: `~/.pi/agent/sessions`) |
|
|
34
36
|
| `--no-repair` | Skip rebuilding repaired skill-usage data |
|
|
35
37
|
| `--json` | Output results as JSON |
|
|
36
38
|
|