Add new PHP quality commands: - psalm: Psalm static analysis with auto-fix support - audit: Security audit for composer and npm dependencies - security: Filesystem security checks (.env exposure, permissions) - qa: Full QA pipeline with quick/standard/full stages - rector: Automated code refactoring with dry-run - infection: Mutation testing Split cmd/php/php.go (2k+ lines) into logical files: - php.go: Styles and command registration - php_dev.go: dev, logs, stop, status, ssl - php_build.go: build, serve, shell - php_quality.go: test, fmt, analyse, psalm, audit, security, qa, rector, infection - php_packages.go: packages link/unlink/update/list - php_deploy.go: deploy commands QA pipeline improvements: - Suppress tool output noise in pipeline mode - Show actionable "To fix:" suggestions with commands Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
36 lines
861 B
Go
36 lines
861 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"io/ioutil"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
// Read package.json
|
|
data, err := ioutil.ReadFile("package.json")
|
|
if err != nil {
|
|
fmt.Println("Error reading package.json, skipping version file generation.")
|
|
os.Exit(0)
|
|
}
|
|
|
|
// Parse package.json
|
|
var pkg struct {
|
|
Version string `json:"version"`
|
|
}
|
|
if err := json.Unmarshal(data, &pkg); err != nil {
|
|
fmt.Println("Error parsing package.json, skipping version file generation.")
|
|
os.Exit(0)
|
|
}
|
|
|
|
// Create the version file
|
|
content := fmt.Sprintf("package updater\n\n// Generated by go:generate. DO NOT EDIT.\n\nconst PkgVersion = %q\n", pkg.Version)
|
|
err = ioutil.WriteFile("version.go", []byte(content), 0644)
|
|
if err != nil {
|
|
fmt.Printf("Error writing version file: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
fmt.Println("Generated version.go with version:", pkg.Version)
|
|
}
|