onehouse-cli 0.2.0__tar.gz → 0.3.0__tar.gz
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.
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/PKG-INFO +15 -1
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/README.md +14 -0
- onehouse_cli-0.3.0/onehouse_cli/__init__.py +32 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli/cli.py +20 -3
- onehouse_cli-0.3.0/onehouse_cli/commands/install.py +77 -0
- onehouse_cli-0.3.0/onehouse_cli/commands/skill.py +86 -0
- onehouse_cli-0.3.0/onehouse_cli/skills/onehouse-cli/SKILL.md +487 -0
- onehouse_cli-0.3.0/onehouse_cli/skills/onehouse-cli/references/command-map.md +750 -0
- onehouse_cli-0.3.0/onehouse_cli/skills/onehouse-cli/references/docs-links.md +134 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli.egg-info/PKG-INFO +15 -1
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli.egg-info/SOURCES.txt +6 -1
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli.egg-info/entry_points.txt +1 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/pyproject.toml +7 -1
- onehouse_cli-0.2.0/onehouse_cli/__init__.py +0 -21
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli/client.py +0 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli/commands/__init__.py +0 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli/commands/_base.py +0 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli/commands/api_token.py +0 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli/commands/catalog.py +0 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli/commands/cluster.py +0 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli/commands/database.py +0 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli/commands/flow.py +0 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli/commands/job.py +0 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli/commands/lake.py +0 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli/commands/service_principal.py +0 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli/commands/source.py +0 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli/commands/sql.py +0 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli/commands/table.py +0 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli/commands/transformation.py +0 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli/commands/validation.py +0 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli/configure.py +0 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli/output.py +0 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli.egg-info/dependency_links.txt +0 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli.egg-info/requires.txt +0 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/onehouse_cli.egg-info/top_level.txt +0 -0
- {onehouse_cli-0.2.0 → onehouse_cli-0.3.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: onehouse-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: A command-line tool for the full Onehouse API
|
|
5
5
|
Author-email: Sagar Lakshmipathy <18vidhyasagar@gmail.com>
|
|
6
6
|
License: Proprietary
|
|
@@ -33,6 +33,20 @@ pip install onehouse-cli
|
|
|
33
33
|
|
|
34
34
|
The SDK dependency (`onehouse-python-sdk[resources]`) is installed automatically.
|
|
35
35
|
|
|
36
|
+
## AI agent integration
|
|
37
|
+
|
|
38
|
+
The package bundles a skill that teaches AI coding agents how to use `oh`. Install it for your agent:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
oh install agent-skill --claude # ~/.claude/skills/onehouse-cli
|
|
42
|
+
oh install agent-skill --cursor # ~/.cursor/skills/onehouse-cli
|
|
43
|
+
oh install agent-skill --codex # ~/.agents/skills/onehouse-cli
|
|
44
|
+
oh install agent-skill --all # all of the above
|
|
45
|
+
oh install agent-skill --all --dry-run
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Re-run the command after `pip install --upgrade onehouse-cli` to refresh the skill. To read the skill without installing it, run `oh skill`.
|
|
49
|
+
|
|
36
50
|
## Setup
|
|
37
51
|
|
|
38
52
|
**Configure credentials:**
|
|
@@ -10,6 +10,20 @@ pip install onehouse-cli
|
|
|
10
10
|
|
|
11
11
|
The SDK dependency (`onehouse-python-sdk[resources]`) is installed automatically.
|
|
12
12
|
|
|
13
|
+
## AI agent integration
|
|
14
|
+
|
|
15
|
+
The package bundles a skill that teaches AI coding agents how to use `oh`. Install it for your agent:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
oh install agent-skill --claude # ~/.claude/skills/onehouse-cli
|
|
19
|
+
oh install agent-skill --cursor # ~/.cursor/skills/onehouse-cli
|
|
20
|
+
oh install agent-skill --codex # ~/.agents/skills/onehouse-cli
|
|
21
|
+
oh install agent-skill --all # all of the above
|
|
22
|
+
oh install agent-skill --all --dry-run
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Re-run the command after `pip install --upgrade onehouse-cli` to refresh the skill. To read the skill without installing it, run `oh skill`.
|
|
26
|
+
|
|
13
27
|
## Setup
|
|
14
28
|
|
|
15
29
|
**Configure credentials:**
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Onehouse CLI - A command-line tool for executing SQL commands against the Onehouse API.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
# For Python 3.8+
|
|
7
|
+
from importlib.metadata import version
|
|
8
|
+
except ImportError:
|
|
9
|
+
# For Python 3.7
|
|
10
|
+
from importlib_metadata import version
|
|
11
|
+
|
|
12
|
+
try:
|
|
13
|
+
__version__ = version("onehouse-cli")
|
|
14
|
+
except Exception:
|
|
15
|
+
# Fallback version if package is not installed
|
|
16
|
+
__version__ = "0.0.0.dev"
|
|
17
|
+
|
|
18
|
+
__all__ = ["cli_main", "configure_main"]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
# Imported lazily (PEP 562) so that pulling in a leaf module does not drag in
|
|
22
|
+
# the whole command tree — and with it the SDK dependency. This keeps
|
|
23
|
+
# `oh-skill` readable on an install where onehouse-python-sdk is missing,
|
|
24
|
+
# which is precisely when someone needs the usage guide.
|
|
25
|
+
def __getattr__(name):
|
|
26
|
+
if name == "cli_main":
|
|
27
|
+
from .cli import main
|
|
28
|
+
return main
|
|
29
|
+
if name == "configure_main":
|
|
30
|
+
from .configure import main
|
|
31
|
+
return main
|
|
32
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
@@ -5,7 +5,6 @@ Global options (--profile, --timeout, --output) are propagated to every
|
|
|
5
5
|
subcommand via the Click context object (ctx.obj).
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
import sys
|
|
9
8
|
import click
|
|
10
9
|
|
|
11
10
|
from . import __version__
|
|
@@ -22,10 +21,21 @@ from .commands import (
|
|
|
22
21
|
job,
|
|
23
22
|
service_principal,
|
|
24
23
|
api_token,
|
|
24
|
+
install,
|
|
25
|
+
skill as skill_cmd,
|
|
25
26
|
sql as sql_cmd,
|
|
26
27
|
)
|
|
27
28
|
|
|
28
29
|
|
|
30
|
+
_EPILOG = """\
|
|
31
|
+
Agents and new users: run `oh skill` for a complete usage guide covering
|
|
32
|
+
credential setup, the SQL each command emits, and destructive-operation safety.
|
|
33
|
+
|
|
34
|
+
Note: deletes execute immediately with no confirmation prompt. Use --show-sql
|
|
35
|
+
on any command to preview the statement without running it.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
|
|
29
39
|
class CliContext:
|
|
30
40
|
def __init__(self, profile: str | None, timeout: int, output: str):
|
|
31
41
|
self.profile = profile
|
|
@@ -33,7 +43,10 @@ class CliContext:
|
|
|
33
43
|
self.output = output
|
|
34
44
|
|
|
35
45
|
|
|
36
|
-
@click.group(
|
|
46
|
+
@click.group(
|
|
47
|
+
context_settings={"help_option_names": ["-h", "--help"]},
|
|
48
|
+
epilog=_EPILOG,
|
|
49
|
+
)
|
|
37
50
|
@click.version_option(__version__, "-v", "--version")
|
|
38
51
|
@click.option(
|
|
39
52
|
"--profile", "-p",
|
|
@@ -75,10 +88,14 @@ cli.add_command(job.job)
|
|
|
75
88
|
cli.add_command(service_principal.service_principal, name="service-principal")
|
|
76
89
|
cli.add_command(api_token.api_token, name="api-token")
|
|
77
90
|
cli.add_command(sql_cmd.sql)
|
|
91
|
+
cli.add_command(skill_cmd.skill)
|
|
92
|
+
cli.add_command(install.install)
|
|
78
93
|
|
|
79
94
|
|
|
80
95
|
def main() -> None:
|
|
81
|
-
|
|
96
|
+
# Standalone mode turns Click errors into a one-line `Error: ...` message
|
|
97
|
+
# and the conventional exit code (1 = failure, 2 = usage error).
|
|
98
|
+
cli()
|
|
82
99
|
|
|
83
100
|
|
|
84
101
|
if __name__ == "__main__":
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""Install bundled assets into other tools.
|
|
2
|
+
|
|
3
|
+
oh install agent-skill --claude ~/.claude/skills/onehouse-cli
|
|
4
|
+
oh install agent-skill --cursor ~/.cursor/skills/onehouse-cli
|
|
5
|
+
oh install agent-skill --codex ~/.agents/skills/onehouse-cli
|
|
6
|
+
oh install agent-skill --all every platform above
|
|
7
|
+
|
|
8
|
+
All three read the open agent skills layout (a directory holding SKILL.md),
|
|
9
|
+
so every target receives an identical copy of the bundled skill.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from pathlib import Path
|
|
13
|
+
import shutil
|
|
14
|
+
|
|
15
|
+
import click
|
|
16
|
+
|
|
17
|
+
from .skill import SKILL_NAME, skill_dir
|
|
18
|
+
|
|
19
|
+
# Platform flag -> skills root, relative to the user's home directory.
|
|
20
|
+
PLATFORMS = {
|
|
21
|
+
"claude": Path(".claude") / "skills",
|
|
22
|
+
"cursor": Path(".cursor") / "skills",
|
|
23
|
+
"codex": Path(".agents") / "skills",
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def install_path(platform: str) -> Path:
|
|
28
|
+
"""Directory the skill is copied to for ``platform``."""
|
|
29
|
+
return Path.home() / PLATFORMS[platform] / SKILL_NAME
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@click.group("install")
|
|
33
|
+
def install():
|
|
34
|
+
"""Install bundled assets into other tools."""
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@install.command("agent-skill")
|
|
38
|
+
@click.option("--claude", is_flag=True, help="Install for Claude Code (~/.claude/skills).")
|
|
39
|
+
@click.option("--cursor", is_flag=True, help="Install for Cursor (~/.cursor/skills).")
|
|
40
|
+
@click.option("--codex", is_flag=True, help="Install for OpenAI Codex CLI (~/.agents/skills).")
|
|
41
|
+
@click.option("--all", "all_", is_flag=True, help="Install for every supported platform.")
|
|
42
|
+
@click.option("--dry-run", is_flag=True, help="Print what would be written without writing it.")
|
|
43
|
+
def agent_skill(claude, cursor, codex, all_, dry_run):
|
|
44
|
+
"""Install the onehouse-cli skill for AI coding agents.
|
|
45
|
+
|
|
46
|
+
Re-run after upgrading onehouse-cli to refresh the installed copy; an
|
|
47
|
+
existing copy is replaced.
|
|
48
|
+
"""
|
|
49
|
+
selected = {"claude": claude, "cursor": cursor, "codex": codex}
|
|
50
|
+
targets = list(PLATFORMS) if all_ else [p for p, on in selected.items() if on]
|
|
51
|
+
if not targets:
|
|
52
|
+
raise click.UsageError("Choose at least one of --claude, --cursor, --codex, or --all.")
|
|
53
|
+
|
|
54
|
+
src = skill_dir()
|
|
55
|
+
if not (src / "SKILL.md").is_file():
|
|
56
|
+
raise click.ClickException(
|
|
57
|
+
"No bundled skill found. This build of onehouse-cli may predate the "
|
|
58
|
+
"skill, or package data was excluded at build time."
|
|
59
|
+
)
|
|
60
|
+
files = sorted(p.relative_to(src) for p in src.rglob("*") if p.is_file())
|
|
61
|
+
|
|
62
|
+
for platform in targets:
|
|
63
|
+
dest = install_path(platform)
|
|
64
|
+
if dry_run:
|
|
65
|
+
action = "replace" if dest.exists() else "create"
|
|
66
|
+
click.echo(f"[dry-run] {platform}: would {action} {dest}")
|
|
67
|
+
for rel in files:
|
|
68
|
+
click.echo(f" {dest / rel}")
|
|
69
|
+
continue
|
|
70
|
+
if dest.exists():
|
|
71
|
+
shutil.rmtree(dest)
|
|
72
|
+
dest.parent.mkdir(parents=True, exist_ok=True)
|
|
73
|
+
shutil.copytree(src, dest)
|
|
74
|
+
click.echo(f"{platform}: installed {dest}")
|
|
75
|
+
|
|
76
|
+
if not dry_run:
|
|
77
|
+
click.echo("Restart the agent, or start a new session, to load the skill.")
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"""Serve the bundled agent skill.
|
|
2
|
+
|
|
3
|
+
The skill ships inside the wheel, so ``oh skill`` works on any machine where
|
|
4
|
+
the CLI is installed — no download, no repo checkout, no path resolution.
|
|
5
|
+
|
|
6
|
+
Discovery paths, cheapest first:
|
|
7
|
+
oh skill print SKILL.md to stdout (agents: start here)
|
|
8
|
+
oh skill --list list bundled documents
|
|
9
|
+
oh skill references/... print a specific reference document
|
|
10
|
+
oh skill --path print the on-disk directory
|
|
11
|
+
|
|
12
|
+
To install the skill for an agent, use ``oh install agent-skill``.
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
import click
|
|
18
|
+
|
|
19
|
+
SKILL_NAME = "onehouse-cli"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def skill_dir() -> Path:
|
|
23
|
+
"""Absolute path to the bundled skill directory."""
|
|
24
|
+
return Path(__file__).resolve().parent.parent / "skills" / SKILL_NAME
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _read(relative: str) -> str:
|
|
28
|
+
root = skill_dir()
|
|
29
|
+
target = (root / relative).resolve()
|
|
30
|
+
# Keep `oh skill ../../etc/passwd` from escaping the bundle. Compare path
|
|
31
|
+
# components, not strings, so a sibling like `onehouse-cli-x/` is rejected.
|
|
32
|
+
if target != root and root not in target.parents:
|
|
33
|
+
raise click.ClickException(f"Invalid document path: {relative}")
|
|
34
|
+
if not target.is_file():
|
|
35
|
+
raise click.ClickException(
|
|
36
|
+
f"No such document: {relative}. Run 'oh skill --list' to see what's bundled."
|
|
37
|
+
)
|
|
38
|
+
return target.read_text()
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _documents() -> list[str]:
|
|
42
|
+
root = skill_dir()
|
|
43
|
+
if not root.is_dir():
|
|
44
|
+
return []
|
|
45
|
+
return sorted(str(p.relative_to(root)) for p in root.rglob("*.md"))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@click.command("skill")
|
|
49
|
+
@click.argument("document", required=False)
|
|
50
|
+
@click.option("--path", "show_path", is_flag=True,
|
|
51
|
+
help="Print the on-disk path of the bundled skill and exit.")
|
|
52
|
+
@click.option("--list", "do_list", is_flag=True,
|
|
53
|
+
help="List the bundled documents.")
|
|
54
|
+
def skill(document, show_path, do_list):
|
|
55
|
+
"""Print the agent usage guide for this CLI.
|
|
56
|
+
|
|
57
|
+
With no arguments, prints SKILL.md — a complete guide to installing,
|
|
58
|
+
configuring, and safely operating this CLI.
|
|
59
|
+
"""
|
|
60
|
+
root = skill_dir()
|
|
61
|
+
if not root.is_dir():
|
|
62
|
+
raise click.ClickException(
|
|
63
|
+
"No bundled skill found. This build of onehouse-cli may predate the "
|
|
64
|
+
"skill, or package data was excluded at build time."
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
if show_path:
|
|
68
|
+
click.echo(str(root))
|
|
69
|
+
return
|
|
70
|
+
|
|
71
|
+
if do_list:
|
|
72
|
+
for name in _documents():
|
|
73
|
+
click.echo(name)
|
|
74
|
+
return
|
|
75
|
+
|
|
76
|
+
click.echo(_read(document or "SKILL.md"))
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def standalone() -> None:
|
|
80
|
+
"""Entry point for the `oh-skill` script.
|
|
81
|
+
|
|
82
|
+
Deliberately separate from `oh skill`: this module imports nothing beyond
|
|
83
|
+
click and pathlib, so the guide stays readable even when the SDK
|
|
84
|
+
dependency is missing and `oh` itself cannot start.
|
|
85
|
+
"""
|
|
86
|
+
skill(standalone_mode=True)
|