Luigit
repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by admin

.pi/skills/modernize/SKILL.md

Raw
Rendered preview

name: modernize description: "Audit this repository against the latest published Pi changelog and APIs. Use when checking for obsolete Pi extension, SDK, config, prompt, skill, model, session, tool, TUI, or provider code. Also reports new-API adoption opportunities that subsume hand-rolled code." disable-model-invocation: true

Modernize

Read-only audit. Never edit repository files.

Procedure

  1. Run from the repository root:

    node .pi/skills/modernize/scripts/audit.mjs
    
  2. If the command fails, stop. Report MODERNIZE FAILED, its exact reason, and local/latest versions when available. Do not scan, claim clean, or print celebratory art.

  3. Treat the JSON as collected evidence, not conclusions. Use tools to read both locations in changelogs, then check every candidate in candidates.

  4. Normalize each candidate against latest Pi truth:

    • read the candidate's linked current documentation when present;
    • otherwise inspect the release-tag-pinned source or installed latest declarations;
    • identify exact obsolete and replacement code shapes;
    • discard provider catalog, prose, and bug-fix entries that require no repository migration.
  5. Collect simplification opportunities from the same audit. Treat every Added or Changed entry introducing or extending public API at the repository-resolved Pi version (candidatesAfterVersion) or newer as a capability. For each capability derive the hand-rolled repository shape it subsumes, such as manual auth resolution, direct provider calls, manual entry persistence, or duplicated projection logic. Discard capabilities without a plausible repository shape and stylistic-only preferences.

  6. Obtain the complete scan scope from git ls-files -z --cached --others --exclude-standard. Pipe or chunk its NUL-delimited paths directly into searches; never print the full list into context. If enumeration fails, stop and report MODERNIZE FAILED with the exact reason. Search that complete scope for each normalized obsolete shape and each derived simplification shape with grep, then read every match and relevant caller. Skip binary content, but never silently narrow the enumerated file set. Optional user focus prioritizes inspection only; whole-repository coverage remains mandatory.

  7. Confirm a finding only when both are present:

    • migration evidence from a changelog plus latest docs/source;
    • contextual repository evidence showing obsolete behavior still applies.
  8. Confirm a simplification only when both are present:

    • capability evidence from the changelog plus latest docs/source showing the new API performs the equivalent work;
    • contextual repository evidence showing the hand-rolled shape at a precise path:line. Name the observable behavior delta. Discard the simplification when the delta exceeds error typing, error timing, or internal call routing.
  9. Do not report dependency age alone as a code finding. Report an old repo-resolved Pi package only when its age leaves code or package constraints requiring migration.

Output

For findings:

MODERNIZE FINDINGS: N
- [high|medium|low] path:line — obsolete API or behavior
  latest: exact replacement
  evidence: Pi version and current doc/source

Order by severity, then path. Deduplicate shared root causes. Every finding needs path:line.

When nothing needs fixing:

MODERNIZE CLEAN
<funny ASCII art>

Generate fresh, non-boxed ASCII art under 20 lines. No art on failure or findings.

When simplifications were confirmed, append after the verdict:

MODERNIZE SIMPLIFICATIONS: N
- path:line — hand-rolled shape
  replacement: exact new API and introducing version
  evidence: current doc or source
  delta: observable behavior difference, or none

Order simplifications by path. Simplifications never change the verdict or suppress the art.

---
name: modernize
description: "Audit this repository against the latest published Pi changelog and APIs. Use when checking for obsolete Pi extension, SDK, config, prompt, skill, model, session, tool, TUI, or provider code. Also reports new-API adoption opportunities that subsume hand-rolled code."
disable-model-invocation: true
---

# Modernize

Read-only audit.
Never edit repository files.

## Procedure

1. Run from the repository root:

   ```bash
   node .pi/skills/modernize/scripts/audit.mjs
   ```

2. If the command fails, stop.
   Report `MODERNIZE FAILED`, its exact reason, and local/latest versions when available.
   Do not scan, claim clean, or print celebratory art.

3. Treat the JSON as collected evidence, not conclusions.
   Use tools to read both locations in `changelogs`, then check every candidate in `candidates`.

4. Normalize each candidate against latest Pi truth:
   - read the candidate's linked current documentation when present;
   - otherwise inspect the release-tag-pinned source or installed latest declarations;
   - identify exact obsolete and replacement code shapes;
   - discard provider catalog, prose, and bug-fix entries that require no repository migration.

5. Collect simplification opportunities from the same audit.
   Treat every Added or Changed entry introducing or extending public API at the repository-resolved Pi version (`candidatesAfterVersion`) or newer as a capability.
   For each capability derive the hand-rolled repository shape it subsumes, such as manual auth resolution, direct provider calls, manual entry persistence, or duplicated projection logic.
   Discard capabilities without a plausible repository shape and stylistic-only preferences.

6. Obtain the complete scan scope from `git ls-files -z --cached --others --exclude-standard`.
   Pipe or chunk its NUL-delimited paths directly into searches; never print the full list into context.
   If enumeration fails, stop and report `MODERNIZE FAILED` with the exact reason.
   Search that complete scope for each normalized obsolete shape and each derived simplification shape with `grep`, then `read` every match and relevant caller.
   Skip binary content, but never silently narrow the enumerated file set.
   Optional user focus prioritizes inspection only; whole-repository coverage remains mandatory.

7. Confirm a finding only when both are present:
   - migration evidence from a changelog plus latest docs/source;
   - contextual repository evidence showing obsolete behavior still applies.

8. Confirm a simplification only when both are present:
   - capability evidence from the changelog plus latest docs/source showing the new API performs the equivalent work;
   - contextual repository evidence showing the hand-rolled shape at a precise `path:line`.
   Name the observable behavior delta.
   Discard the simplification when the delta exceeds error typing, error timing, or internal call routing.

9. Do not report dependency age alone as a code finding.
   Report an old repo-resolved Pi package only when its age leaves code or package constraints requiring migration.

## Output

For findings:

```text
MODERNIZE FINDINGS: N
- [high|medium|low] path:line — obsolete API or behavior
  latest: exact replacement
  evidence: Pi version and current doc/source
```

Order by severity, then path.
Deduplicate shared root causes.
Every finding needs `path:line`.

When nothing needs fixing:

```text
MODERNIZE CLEAN
<funny ASCII art>
```

Generate fresh, non-boxed ASCII art under 20 lines.
No art on failure or findings.

When simplifications were confirmed, append after the verdict:

```text
MODERNIZE SIMPLIFICATIONS: N
- path:line — hand-rolled shape
  replacement: exact new API and introducing version
  evidence: current doc or source
  delta: observable behavior difference, or none
```

Order simplifications by path.
Simplifications never change the verdict or suppress the art.