agentleFS
D-SheyD-Shey/autoharness/.agents/skills/cli-self-updater/SKILL.md

cli-self-updater

Skill10 starsChanged todayMITView on GitHub

Self-update CLI tool via uv tool upgrade or pip install with rollback safety

  • Installs packages

The file

We split this skill into the rules it gives an agent

12 rules. About 0 are common, 1 is distinctive, and 11 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 11

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use when updating a Python command line application in-place from its git repository or release source, detecting the active package …

    line 9
  2. Very specific:

    Check if the current workspace specifically matches the tool's own repository (is_autoharness_git_repo verifying pyproject.toml package …

    line 13
  3. Very specific:

    Check if uv is available on PATH via shutil.which("uv").

    line 14
  4. Very specific:

    Check if installed as a uv tool or inside an editable git workspace.

    line 15
  5. Very specific:

    If running inside the package's own git working tree: perform git pull then re-install with uv tool install --editable .

    line 17
  6. Very specific:

    If installed globally as a uv tool or when uv is available: execute uv tool install --force git+https://github.com/{owner}/{repo}.git.

    line 18
  7. Very specific:

    If running via standard pip/venv: execute sys.executable -m pip install --upgrade git+https://github.com/{owner}/{repo}.git.

    line 19
  8. Very specific:

    Use resp.read(MAX_BYTES) (e.g.

    line 21
  9. Very specific:

    Always write configuration files atomically via temporary file in the same directory and os.replace (source: …

    line 23
  10. Very specific:

    When running autonomously without --yes, verify consent or prompt interactive user before mutating the environment.

    line 25
  11. Distinctive:

    Check subprocess exit code == 0.

    line 27
  12. Very specific:

    Run new binary version check --version to confirm upgrade.

    line 28

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

cli-self-updater

When to use

Use when updating a Python command line application in-place from its git repository or release source, detecting the active package manager (uv, pipx, or pip).

Steps

  1. Detect runtime environment:
    • Check if the current workspace specifically matches the tool's own repository (is_autoharness_git_repo verifying pyproject.toml package name matches "autoharness" and src/autoharness/__init__.py exists) rather than an arbitrary user git repository.
    • Check if uv is available on PATH via shutil.which("uv").
    • Check if installed as a uv tool or inside an editable git workspace.
  2. Determine update strategy:
    • If running inside the package's own git working tree: perform git pull then re-install with uv tool install --editable . --force (or pip install -e .).
    • If installed globally as a uv tool or when uv is available: execute uv tool install --force git+https://github.com/{owner}/{repo}.git.
    • If running via standard pip/venv: execute sys.executable -m pip install --upgrade git+https://github.com/{owner}/{repo}.git.
  3. Safe HTTP streaming with size limits:
  4. Atomic file replacement:
  5. Confirmation and approval gating:
    • When running autonomously without --yes, verify consent or prompt interactive user before mutating the environment.
  6. Post-update verification:
    • Check subprocess exit code == 0.
    • Run new binary version check --version to confirm upgrade.

Facts found here

  • A workspace containing .git and pyproject.toml is NOT necessarily the tool's repo; verify name = "autoharness" before executing in-place editable installation.
  • In Python urllib.request, response.read(size) enforces a hard buffer ceiling, preventing unbounded memory exhaustion (source: https://docs.python.org/3/library/urllib.request.html).
  • os.replace(temp_path, path) atomically overwrites existing destination files on both Windows and POSIX systems when the temp file resides in the same directory/filesystem (source: https://docs.python.org/3/library/os.html#os.replace).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.