bhtool 0.2.0__tar.gz → 0.2.1__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.
- {bhtool-0.2.0 → bhtool-0.2.1}/PKG-INFO +20 -20
- bhtool-0.2.1/README.md +49 -0
- {bhtool-0.2.0 → bhtool-0.2.1}/bhtool/cli.py +34 -34
- {bhtool-0.2.0 → bhtool-0.2.1}/bhtool/run.py +2 -2
- bhtool-0.2.1/movie_mapping.json +25 -0
- {bhtool-0.2.0 → bhtool-0.2.1}/pyproject.toml +1 -1
- bhtool-0.2.0/README.md +0 -49
- {bhtool-0.2.0 → bhtool-0.2.1}/.gitignore +0 -0
- {bhtool-0.2.0 → bhtool-0.2.1}/.python-version +0 -0
- {bhtool-0.2.0 → bhtool-0.2.1}/bhtool/bumpver.py +0 -0
- {bhtool-0.2.0 → bhtool-0.2.1}/bhtool/clr_chmod.py +0 -0
- {bhtool-0.2.0 → bhtool-0.2.1}/bhtool/list_movies.py +0 -0
- {bhtool-0.2.0 → bhtool-0.2.1}/bhtool/npread.py +0 -0
- {bhtool-0.2.0 → bhtool-0.2.1}/bhtool/psword.py +0 -0
- {bhtool-0.2.0 → bhtool-0.2.1}/bhtool/rm_npm.py +0 -0
- {bhtool-0.2.0 → bhtool-0.2.1}/bhtool/text.py +0 -0
- {bhtool-0.2.0 → bhtool-0.2.1}/bhtool/todict.py +0 -0
- {bhtool-0.2.0 → bhtool-0.2.1}/bhtool/utils.py +0 -0
- {bhtool-0.2.0 → bhtool-0.2.1}/jtools/jtools.js +0 -0
- {bhtool-0.2.0 → bhtool-0.2.1}/jtools/package.json +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bhtool
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: Assorted CLI utilities for Bosco’s workflows (dev, media, macOS, LLM helpers).
|
|
5
5
|
Author-email: Bosco Ho <apposite@gmail.com>
|
|
6
6
|
Requires-Python: >=3.13
|
|
@@ -21,28 +21,28 @@ Assorted CLI utilities that are handy in Bosco’s day-to-day work—version bum
|
|
|
21
21
|
### Install options
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
| Option
|
|
25
|
-
|
|
|
24
|
+
| Option | Description |
|
|
25
|
+
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
|
|
26
26
|
| **`uvx bhtool …`** | Run from PyPI on demand (no clone). Example:`uvx bhtool --help`, `uvx bhtool run cursor`. |
|
|
27
|
-
| **`uv tool install bhtool`**
|
|
27
|
+
| **`uv tool install bhtool`** | Install**`b`** / **`bhtool`** globally from PyPI (released versions). |
|
|
28
28
|
| **`uv sync`** then **`uv run bhtool …`** | Use the project venv from a checkout (no global install). |
|
|
29
|
-
| **`uv tool install .`**
|
|
30
|
-
| **`uv tool install --editable .`**
|
|
29
|
+
| **`uv tool install .`** | Install**`b`** / **`bhtool`** globally from the current directory (pinned copy). |
|
|
30
|
+
| **`uv tool install --editable .`** | Install**`b`** / **`bhtool`** globally in **editable** mode from a checkout (code changes apply without reinstall). |
|
|
31
31
|
|
|
32
32
|
## Commands
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
| Command
|
|
36
|
-
|
|
|
37
|
-
| **bumpver**
|
|
38
|
-
| **run**
|
|
39
|
-
| **clr-chmod**
|
|
40
|
-
| **npread**
|
|
41
|
-
| **psword**
|
|
42
|
-
| **rm-npm**
|
|
43
|
-
| **text**
|
|
44
|
-
| **todict**
|
|
45
|
-
| **movies**
|
|
35
|
+
| Command | Description | |
|
|
36
|
+
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- |
|
|
37
|
+
| **bumpver** | Bump version in`pyproject.toml`, commit, push; PyPI publish is on by default (`--no-publish` to skip) | |
|
|
38
|
+
| **run** | Open macOS applications by partial name (e.g.`uvx bhtool run cursor` or `b run cursor` after a local install) | |
|
|
39
|
+
| **clr-chmod** | Remove execute bit from non-shell files; tighten group/other write | |
|
|
40
|
+
| **npread** | Print the shape of NumPy`.npy` files | |
|
|
41
|
+
| **psword** | Find processes by name;`--kill` to terminate | |
|
|
42
|
+
| **rm-npm** | Recursively delete`node_modules` dirs and `package-lock.json` files | |
|
|
43
|
+
| **text** | Convert between Markdown, HTML, DOCX, and Pug (needs`pandoc` and related tools on `PATH`) | |
|
|
44
|
+
| **todict** | JSON or YAML file, or stdin, → Python`dict(...)`-style repr on stdout | |
|
|
45
|
+
| **movies** | `uvx bhtool movies` (or `b movies`) — ask an LLM for normalized names; writes `movie_mapping.json` in the **current working directory**; `--execute` applies renames (default is dry-run table) | |
|
|
46
46
|
|
|
47
47
|
### Movies + LLM
|
|
48
48
|
|
|
@@ -59,7 +59,7 @@ Node CLI: pug formatting, agent config copy. Usage: `jtools <subcommand>`
|
|
|
59
59
|
**Run (after install):** `npx jtools <subcommand>` resolves the local `jtools` binary (same as `node_modules/.bin/jtools`). Examples: `npx jtools format-pug`, `npx jtools copy-agent`.
|
|
60
60
|
|
|
61
61
|
|
|
62
|
-
| Subcommand | Description
|
|
63
|
-
|
|
|
64
|
-
| **format-pug** | Format pug in`./index.html`
|
|
62
|
+
| Subcommand | Description |
|
|
63
|
+
| -------------- | ---------------------------------------- |
|
|
64
|
+
| **format-pug** | Format pug in`./index.html` |
|
|
65
65
|
| **copy-agent** | Copy`~/.claude/CLAUDE.md` → `./AGENT.md` |
|
bhtool-0.2.1/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# bhtool
|
|
2
|
+
|
|
3
|
+
Assorted CLI utilities that are handy in Bosco’s day-to-day work—version bumps, file conversions, process helpers, macOS shortcuts, LLM-assisted movie renaming, and other small odds and ends. **Python ≥3.13.**
|
|
4
|
+
|
|
5
|
+
### Install options
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
| Option | Description |
|
|
9
|
+
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
|
|
10
|
+
| **`uvx bhtool …`** | Run from PyPI on demand (no clone). Example:`uvx bhtool --help`, `uvx bhtool run cursor`. |
|
|
11
|
+
| **`uv tool install bhtool`** | Install**`b`** / **`bhtool`** globally from PyPI (released versions). |
|
|
12
|
+
| **`uv sync`** then **`uv run bhtool …`** | Use the project venv from a checkout (no global install). |
|
|
13
|
+
| **`uv tool install .`** | Install**`b`** / **`bhtool`** globally from the current directory (pinned copy). |
|
|
14
|
+
| **`uv tool install --editable .`** | Install**`b`** / **`bhtool`** globally in **editable** mode from a checkout (code changes apply without reinstall). |
|
|
15
|
+
|
|
16
|
+
## Commands
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
| Command | Description | |
|
|
20
|
+
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- |
|
|
21
|
+
| **bumpver** | Bump version in`pyproject.toml`, commit, push; PyPI publish is on by default (`--no-publish` to skip) | |
|
|
22
|
+
| **run** | Open macOS applications by partial name (e.g.`uvx bhtool run cursor` or `b run cursor` after a local install) | |
|
|
23
|
+
| **clr-chmod** | Remove execute bit from non-shell files; tighten group/other write | |
|
|
24
|
+
| **npread** | Print the shape of NumPy`.npy` files | |
|
|
25
|
+
| **psword** | Find processes by name;`--kill` to terminate | |
|
|
26
|
+
| **rm-npm** | Recursively delete`node_modules` dirs and `package-lock.json` files | |
|
|
27
|
+
| **text** | Convert between Markdown, HTML, DOCX, and Pug (needs`pandoc` and related tools on `PATH`) | |
|
|
28
|
+
| **todict** | JSON or YAML file, or stdin, → Python`dict(...)`-style repr on stdout | |
|
|
29
|
+
| **movies** | `uvx bhtool movies` (or `b movies`) — ask an LLM for normalized names; writes `movie_mapping.json` in the **current working directory**; `--execute` applies renames (default is dry-run table) | |
|
|
30
|
+
|
|
31
|
+
### Movies + LLM
|
|
32
|
+
|
|
33
|
+
`LLM_SERVICE` selects the backend (`openai`, `groq`, `ollama`, `bedrock`, …). Set it in the process environment or in **`bhtool/.env`** (loaded from the installed package directory). Model defaults come from [microeval](https://pypi.org/project/microeval/)’s config for that service.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## jtools
|
|
38
|
+
|
|
39
|
+
Node CLI: pug formatting, agent config copy. Usage: `jtools <subcommand>`
|
|
40
|
+
|
|
41
|
+
**Install:** `cd jtools && npm install` — dependencies only; this package is not published, so run it from that directory (or `npm link` after install).
|
|
42
|
+
|
|
43
|
+
**Run (after install):** `npx jtools <subcommand>` resolves the local `jtools` binary (same as `node_modules/.bin/jtools`). Examples: `npx jtools format-pug`, `npx jtools copy-agent`.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
| Subcommand | Description |
|
|
47
|
+
| -------------- | ---------------------------------------- |
|
|
48
|
+
| **format-pug** | Format pug in`./index.html` |
|
|
49
|
+
| **copy-agent** | Copy`~/.claude/CLAUDE.md` → `./AGENT.md` |
|
|
@@ -10,95 +10,95 @@ app = App(name="bhtool", help="boscoh tools")
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
@app.command(name="run")
|
|
13
|
-
def
|
|
13
|
+
def run_cmd(*params: str):
|
|
14
14
|
"""Open macOS applications by partial name match."""
|
|
15
15
|
if not params:
|
|
16
16
|
app["run"].help_print()
|
|
17
17
|
return
|
|
18
|
-
|
|
18
|
+
import bhtool.run as run_mod
|
|
19
19
|
|
|
20
|
-
run(*params)
|
|
20
|
+
run_mod.run(*params)
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
@app.command
|
|
24
|
-
def
|
|
23
|
+
@app.command(name="bumpver")
|
|
24
|
+
def bumpver_cmd(
|
|
25
25
|
part: Literal["major", "minor", "patch"] | None = None, *, publish: bool = True
|
|
26
26
|
):
|
|
27
27
|
"""Bump version in pyproject.toml, commit, push, and optionally publish to PyPI."""
|
|
28
|
-
|
|
28
|
+
import bhtool.bumpver as bumpver_mod
|
|
29
29
|
|
|
30
|
-
bumpver(part, publish=publish)
|
|
30
|
+
bumpver_mod.bumpver(part, publish=publish)
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
@app.command
|
|
34
|
-
def
|
|
33
|
+
@app.command(name="clr_chmod")
|
|
34
|
+
def clr_chmod_cmd():
|
|
35
35
|
"""Remove execute permissions from non-script files and write permissions from group/other."""
|
|
36
|
-
|
|
36
|
+
import bhtool.clr_chmod as clr_chmod_mod
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
clr_chmod_mod.clr_chmod()
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
@app.command
|
|
42
|
-
def
|
|
41
|
+
@app.command(name="npread")
|
|
42
|
+
def npread_cmd(*files: str):
|
|
43
43
|
"""Print shape of numpy .npy files."""
|
|
44
44
|
if not files:
|
|
45
45
|
app["npread"].help_print()
|
|
46
46
|
return
|
|
47
|
-
|
|
47
|
+
import bhtool.npread as npread_mod
|
|
48
48
|
|
|
49
|
-
npread(files)
|
|
49
|
+
npread_mod.npread(files)
|
|
50
50
|
|
|
51
51
|
|
|
52
|
-
@app.command
|
|
53
|
-
def
|
|
52
|
+
@app.command(name="psword")
|
|
53
|
+
def psword_cmd(*words: str, kill: bool = False):
|
|
54
54
|
"""Find processes by name and optionally kill them."""
|
|
55
55
|
if not words:
|
|
56
56
|
app["psword"].help_print()
|
|
57
57
|
return
|
|
58
|
-
|
|
58
|
+
import bhtool.psword as psword_mod
|
|
59
59
|
|
|
60
|
-
psword(words, kill=kill)
|
|
60
|
+
psword_mod.psword(words, kill=kill)
|
|
61
61
|
|
|
62
62
|
|
|
63
|
-
@app.command
|
|
64
|
-
def
|
|
63
|
+
@app.command(name="rm_npm")
|
|
64
|
+
def rm_npm_cmd():
|
|
65
65
|
"""Recursively remove node_modules directories and package-lock.json files."""
|
|
66
|
-
|
|
66
|
+
import bhtool.rm_npm as rm_npm_mod
|
|
67
67
|
|
|
68
|
-
rm_npm()
|
|
68
|
+
rm_npm_mod.rm_npm()
|
|
69
69
|
|
|
70
70
|
|
|
71
|
-
@app.command
|
|
72
|
-
def
|
|
71
|
+
@app.command(name="text")
|
|
72
|
+
def text_cmd(in_fname: str | None = None, out_fname: str | None = None):
|
|
73
73
|
"""Interconvert text-based formats: md, pug, docx, html."""
|
|
74
74
|
if in_fname is None or out_fname is None:
|
|
75
75
|
app["text"].help_print()
|
|
76
76
|
return
|
|
77
|
-
|
|
77
|
+
import bhtool.text as text_mod
|
|
78
78
|
|
|
79
|
-
convert_text(in_fname, out_fname)
|
|
79
|
+
text_mod.convert_text(in_fname, out_fname)
|
|
80
80
|
|
|
81
81
|
|
|
82
|
-
@app.command
|
|
83
|
-
def
|
|
82
|
+
@app.command(name="todict")
|
|
83
|
+
def todict_cmd(json: str | None = None, yaml: str | None = None):
|
|
84
84
|
"""Convert JSON or YAML to Python dict format."""
|
|
85
|
-
|
|
85
|
+
import bhtool.todict as todict_mod
|
|
86
86
|
|
|
87
|
-
todict(json=json, yaml=yaml)
|
|
87
|
+
todict_mod.todict(json=json, yaml=yaml)
|
|
88
88
|
|
|
89
89
|
|
|
90
90
|
@app.command(name="movies")
|
|
91
|
-
def
|
|
91
|
+
def movies_cmd(root_dir: str | None = None, execute: bool = False):
|
|
92
92
|
"""Normalize movie directory and file names with an LLM (dry-run table by default).
|
|
93
93
|
|
|
94
94
|
:param root_dir: Root directory containing movies (positional); default is current working directory.
|
|
95
95
|
:param execute: If true, perform renames; otherwise dry run (table output).
|
|
96
96
|
"""
|
|
97
|
-
|
|
97
|
+
import bhtool.list_movies as list_movies_mod
|
|
98
98
|
|
|
99
99
|
if root_dir == "rename":
|
|
100
100
|
root_dir = None
|
|
101
|
-
rename(root_dir=root_dir, execute=execute)
|
|
101
|
+
list_movies_mod.rename(root_dir=root_dir, execute=execute)
|
|
102
102
|
|
|
103
103
|
|
|
104
104
|
def main() -> None:
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
from path import Path
|
|
6
6
|
|
|
7
|
-
from bhtool.utils import run
|
|
7
|
+
from bhtool.utils import run as run_shell
|
|
8
8
|
|
|
9
9
|
search_dirs = [Path("/Applications"), Path.home() / "MyApps"]
|
|
10
10
|
|
|
@@ -20,4 +20,4 @@ def run(*params: str):
|
|
|
20
20
|
|
|
21
21
|
params = [f'"{p}"' for p in params]
|
|
22
22
|
cmd = "open -a " + " ".join(params)
|
|
23
|
-
|
|
23
|
+
run_shell(cmd)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"directories": [
|
|
3
|
+
{
|
|
4
|
+
"original": "bhtool",
|
|
5
|
+
"normalized": "Bhtool"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"original": "build",
|
|
9
|
+
"normalized": "Build"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"original": "dist",
|
|
13
|
+
"normalized": "Dist"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"original": "jtools",
|
|
17
|
+
"normalized": "Jtools"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"original": "src",
|
|
21
|
+
"normalized": "Src"
|
|
22
|
+
}
|
|
23
|
+
],
|
|
24
|
+
"files": []
|
|
25
|
+
}
|
bhtool-0.2.0/README.md
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# bhtool
|
|
2
|
-
|
|
3
|
-
Assorted CLI utilities that are handy in Bosco’s day-to-day work—version bumps, file conversions, process helpers, macOS shortcuts, LLM-assisted movie renaming, and other small odds and ends. **Python ≥3.13.**
|
|
4
|
-
|
|
5
|
-
### Install options
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
| Option | Description |
|
|
9
|
-
| ------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
|
|
10
|
-
| **`uvx bhtool …`** | Run from PyPI on demand (no clone). Example:`uvx bhtool --help`, `uvx bhtool run cursor`. |
|
|
11
|
-
| **`uv tool install bhtool`** | Install**`b`** / **`bhtool`** globally from PyPI (released versions). |
|
|
12
|
-
| **`uv sync`** then **`uv run bhtool …`** | Use the project venv from a checkout (no global install). |
|
|
13
|
-
| **`uv tool install .`** | Install**`b`** / **`bhtool`** globally from the current directory (pinned copy). |
|
|
14
|
-
| **`uv tool install --editable .`** | Install**`b`** / **`bhtool`** globally in **editable** mode from a checkout (code changes apply without reinstall). |
|
|
15
|
-
|
|
16
|
-
## Commands
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
| Command | Description | |
|
|
20
|
-
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- |
|
|
21
|
-
| **bumpver** | Bump version in`pyproject.toml`, commit, push; PyPI publish is on by default (`--no-publish` to skip) | |
|
|
22
|
-
| **run** | Open macOS applications by partial name (e.g.`uvx bhtool run cursor` or `b run cursor` after a local install) | |
|
|
23
|
-
| **clr-chmod** | Remove execute bit from non-shell files; tighten group/other write | |
|
|
24
|
-
| **npread** | Print the shape of NumPy`.npy` files | |
|
|
25
|
-
| **psword** | Find processes by name;`--kill` to terminate | |
|
|
26
|
-
| **rm-npm** | Recursively delete`node_modules` dirs and `package-lock.json` files | |
|
|
27
|
-
| **text** | Convert between Markdown, HTML, DOCX, and Pug (needs`pandoc` and related tools on `PATH`) | |
|
|
28
|
-
| **todict** | JSON or YAML file, or stdin, → Python`dict(...)`-style repr on stdout | |
|
|
29
|
-
| **movies** | `uvx bhtool movies` (or `b movies`) — ask an LLM for normalized names; writes `movie_mapping.json` in the **current working directory**; `--execute` applies renames (default is dry-run table) | |
|
|
30
|
-
|
|
31
|
-
### Movies + LLM
|
|
32
|
-
|
|
33
|
-
`LLM_SERVICE` selects the backend (`openai`, `groq`, `ollama`, `bedrock`, …). Set it in the process environment or in **`bhtool/.env`** (loaded from the installed package directory). Model defaults come from [microeval](https://pypi.org/project/microeval/)’s config for that service.
|
|
34
|
-
|
|
35
|
-
---
|
|
36
|
-
|
|
37
|
-
## jtools
|
|
38
|
-
|
|
39
|
-
Node CLI: pug formatting, agent config copy. Usage: `jtools <subcommand>`
|
|
40
|
-
|
|
41
|
-
**Install:** `cd jtools && npm install` — dependencies only; this package is not published, so run it from that directory (or `npm link` after install).
|
|
42
|
-
|
|
43
|
-
**Run (after install):** `npx jtools <subcommand>` resolves the local `jtools` binary (same as `node_modules/.bin/jtools`). Examples: `npx jtools format-pug`, `npx jtools copy-agent`.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
| Subcommand | Description |
|
|
47
|
-
| ---------------- | ------------------------------------------- |
|
|
48
|
-
| **format-pug** | Format pug in`./index.html` |
|
|
49
|
-
| **copy-agent** | Copy`~/.claude/CLAUDE.md` → `./AGENT.md` |
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|