Entwicklung

PHP Structured Edit

PHP-Änderungen über den AST statt über Regex oder sed: typisierte Operationen auf nikic/php-parser, Hash-Guards, erneutes Parsen vor dem Schreiben.

Letztes Release v0.1.0

Installation

Nimm den Weg, der zu deinem Projekt passt — alle führen zum selben Skill.

  1. Claude Code über diesen Marketplace
    /plugin install php-structured-edit@netresearch-claude-code-marketplace
  2. npx beliebige Agent-Skills-CLI
    npx skills add https://github.com/netresearch/php-ast-edit-skill --skill php-structured-edit

    Universelle Agent-Skills-CLI von skills.sh — funktioniert in Claude Code, Cursor, GitHub Copilot, Codex, Gemini CLI und 30+ weiteren Agents.

  3. composer require PHP-Projekt, als Paket
    composer require netresearch/php-ast-edit-skill

    Setzt netresearch/composer-agent-skill-plugin voraus — bindet Agent Skills als Composer-Dependencies in PHP-Projekte ein, erkennt Skills automatisch, generiert AGENTS.md.

  4. composer skills:add PHP-Projekt, direkte Quelle
    composer skills:add github:netresearch/php-ast-edit-skill

    Kommt aus netresearch/composer-agent-skill-plugin — pinnt Skill-Repos direkt ohne Packagist-Veröffentlichung, persistiert in composer.skills.lock.

Wofür du den Skill einsetzt

  • Edits PHP through its AST rather than regex, sed or patch, so a rename hits the identifier and not the same-named string literal beside it
  • Ten typed operations on nikic/php-parser, guarded by SHA-256 and expected node type, reparsed before write
  • Ships the php-ast-edit CLI

Was du zurück­bekommst

  • An inspect JSON document: file SHA-256 plus the AST ancestry at the requested position, smallest node first.
  • A mutated PHP file, canonically printed and reparsed before the write.
  • A structured failure (STALE_SOURCE, expectation mismatch, detached target) when a guard rejects the transaction — the file is left untouched.

Was der Skill im Projekt erwartet

  • PHP 8.2+ with ext-json and ext-tokenizer.
  • nikic/php-parser 5.8+ — via composer install, or bundled in the release PHAR.
  • Write access to the target working tree. No external network access.

Tags

  • development
  • quality-security