Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ user-wide install and `--agent`/`-a` to target specific agents (`agents`,
`claude-code`, `cursor`, `codex`, `gemini`).

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

## Agent detection

When `skore` is run inside a coding agent, it detects the agent from
environment variables and adapts its behavior:

- **`skore`** (no args) shows an agent-specific quick-start with the detected
agent's skill directory and harness
- **`skore skills install`** (no args, non-interactive) prints the catalog and
the detected agent's skill directory — no `--agent` flag needed
- **`skore skills install all`** installs all skills into the detected
agent's directory (also works with `--all`)
- **`skore skills install <ids>`** installs specific skills into the detected
agent's directory
- **`skore agent`** (no `--harness`, non-interactive) auto-selects the
detected agent's harness and skips the launch step (the agent is already
running)

| Agent | Env Var |
|-------|---------|
| Claude Code | `CLAUDECODE` |
| Cursor | `CURSOR_AGENT` |
| Gemini CLI | `GEMINI_CLI` |
| Codex CLI | `CODEX_SANDBOX` |
| Pi | `PI_CODING_AGENT` |
| OpenCode | `OPENCODE_CLIENT` |

Any non-empty value triggers detection.

## License

MIT
65 changes: 59 additions & 6 deletions src/skore_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
import rich_click as click

import skore_cli._style # noqa: F401 (applies the CLI palette and rich-click config)
from skore_cli._agents import (
Agent,
detect_agent,
is_non_interactive,
resolve_skill_agent,
)
from skore_cli._plugins import load_plugins

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

_COMMANDS = [
("agent", "Authenticate, configure and launch a Skore Hub agent harness."),
("skills", "Install and manage Agent Skills from the probabl-ai/skills release."),
]


def _render_help(detected: Agent | None) -> str:
"""Build a plain-text help page, agent-flavored when ``detected`` is set."""
lines = ["Skore command-line interface.", ""]

if detected is not None:
lines.append(f"Detected: {detected.label}")
target = resolve_skill_agent(detected).project_skills_dir
lines.append(f"Skills target: {target}")
if detected.harness_name:
lines.append(f"Harness: {detected.harness_display_name}")
lines.append("")

lines.append("Quick start:")

if detected is not None:
skill_target = resolve_skill_agent(detected).project_skills_dir
lines.append(
f" skore skills install all Install all skills to {skill_target}"
)
else:
lines.append(" skore skills install all Install all skills")
lines.append(" skore skills install <ids> Install specific skills by id")

if detected is not None and detected.harness_name:
label = detected.harness_display_name
lines.append(
f" skore agent "
f"Configure {label} with the Skore Hub provider"
)
else:
lines.append(
" skore agent "
"Configure and launch a Skore Hub agent harness"
)

lines.append("")
lines.append("Commands:")
for name, desc in _COMMANDS:
lines.append(f" {name:<7} {desc}")

return "\n".join(lines)


@click.group(invoke_without_command=True)
@click.pass_context
@click.version_option(package_name="skore-cli")
def cli(ctx) -> None:
"""Skore command-line interface.

Use ``skore agent`` to connect a project to the Skore Hub agent, and
``skore skills`` to install probabl-skills locally.
"""
"""Skore command-line interface."""
if ctx.invoked_subcommand is None:
click.echo(ctx.get_help())
if is_non_interactive():
click.echo(_render_help(detect_agent()))
else:
click.echo(ctx.get_help())


cli.add_command(skills)
Expand Down
Loading
Loading