Skip to content

Commit 89698bf

Browse files
committed
feat(cli): Make skore agent-friendly
1 parent ade31f5 commit 89698bf

18 files changed

Lines changed: 1234 additions & 690 deletions

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ user-wide install and `--agent`/`-a` to target specific agents (`agents`,
3333
`claude-code`, `cursor`, `codex`, `gemini`).
3434

3535
```bash
36-
skore skills find # browse the catalog interactively
3736
skore skills list # list installed skills
3837
skore skills install # install skills (interactive or by id)
3938
skore skills update # update installed skills
@@ -54,6 +53,34 @@ skore agent --harness claude # non-interactive harness choice
5453
skore agent --workspace ./myapp # configure another project directory
5554
```
5655

56+
## Agent detection
57+
58+
When `skore` is run inside a coding agent, it detects the agent from
59+
environment variables and adapts its behavior:
60+
61+
- **`skore`** (no args) shows an agent-specific quick-start with the detected
62+
agent's skill directory and harness
63+
- **`skore skills install`** (no args, non-interactive) prints the catalog and
64+
the detected agent's skill directory — no `--agent` flag needed
65+
- **`skore skills install all`** installs all skills into the detected
66+
agent's directory (also works with `--all`)
67+
- **`skore skills install <ids>`** installs specific skills into the detected
68+
agent's directory
69+
- **`skore agent`** (no `--harness`, non-interactive) auto-selects the
70+
detected agent's harness and skips the launch step (the agent is already
71+
running)
72+
73+
| Agent | Env Var |
74+
|-------|---------|
75+
| Claude Code | `CLAUDECODE` |
76+
| Cursor | `CURSOR_AGENT` |
77+
| Gemini CLI | `GEMINI_CLI` |
78+
| Codex CLI | `CODEX_SANDBOX` |
79+
| Pi | `PI_CODING_AGENT` |
80+
| OpenCode | `OPENCODE_CLIENT` |
81+
82+
Any non-empty value triggers detection.
83+
5784
## License
5885

5986
MIT

src/skore_cli/__init__.py

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
import rich_click as click
66

77
import skore_cli._style # noqa: F401 (applies the CLI palette and rich-click config)
8+
from skore_cli._agents import (
9+
Agent,
10+
detect_agent,
11+
is_non_interactive,
12+
resolve_skill_agent,
13+
)
814
from skore_cli._plugins import load_plugins
915

1016
# These command modules defer their heavy `skore` imports into the callbacks, so
@@ -21,18 +27,65 @@
2127
],
2228
}
2329

30+
_COMMANDS = [
31+
("agent", "Authenticate, configure and launch a Skore Hub agent harness."),
32+
("skills", "Install and manage Agent Skills from the probabl-ai/skills release."),
33+
]
34+
35+
36+
def _render_help(detected: Agent | None) -> str:
37+
"""Build a plain-text help page, agent-flavored when ``detected`` is set."""
38+
lines = ["Skore command-line interface.", ""]
39+
40+
if detected is not None:
41+
lines.append(f"Detected: {detected.label}")
42+
target = resolve_skill_agent(detected).project_skills_dir
43+
lines.append(f"Skills target: {target}")
44+
if detected.harness_name:
45+
lines.append(f"Harness: {detected.harness_display_name}")
46+
lines.append("")
47+
48+
lines.append("Quick start:")
49+
50+
if detected is not None:
51+
skill_target = resolve_skill_agent(detected).project_skills_dir
52+
lines.append(
53+
f" skore skills install all Install all skills to {skill_target}"
54+
)
55+
else:
56+
lines.append(" skore skills install all Install all skills")
57+
lines.append(" skore skills install <ids> Install specific skills by id")
58+
59+
if detected is not None and detected.harness_name:
60+
label = detected.harness_display_name
61+
lines.append(
62+
f" skore agent "
63+
f"Configure {label} with the Skore Hub provider"
64+
)
65+
else:
66+
lines.append(
67+
" skore agent "
68+
"Configure and launch a Skore Hub agent harness"
69+
)
70+
71+
lines.append("")
72+
lines.append("Commands:")
73+
for name, desc in _COMMANDS:
74+
lines.append(f" {name:<7} {desc}")
75+
76+
return "\n".join(lines)
77+
2478

2579
@click.group(invoke_without_command=True)
2680
@click.pass_context
2781
@click.version_option(package_name="skore-cli")
2882
def cli(ctx) -> None:
29-
"""Skore command-line interface.
30-
31-
Use ``skore agent`` to connect a project to the Skore Hub agent, and
32-
``skore skills`` to install probabl-skills locally.
33-
"""
83+
"""Skore command-line interface."""
3484
if ctx.invoked_subcommand is None:
35-
click.echo(ctx.get_help())
85+
if is_non_interactive():
86+
click.echo(_render_help(detect_agent()))
87+
else:
88+
click.echo(ctx.get_help())
3689

3790

3891
cli.add_command(skills)

0 commit comments

Comments
 (0)