{"id":15030251,"url":"https://github.com/code-lts/cli-tools","last_synced_at":"2026-02-21T10:31:02.187Z","repository":{"id":56954750,"uuid":"315987299","full_name":"code-lts/cli-tools","owner":"code-lts","description":"CLI tools to manage output errors formatting for junit, checkstyle, teamcity, gitlab and github error formats","archived":false,"fork":false,"pushed_at":"2026-01-22T09:29:24.000Z","size":201,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-22T11:54:21.392Z","etag":null,"topics":["checkstyle","checkstyle-xml-report","cli","cli-tools","formatters","github","gitlab","gitlab-ci","junit","junit-xml","php","php8","teamcity","teamcity-formatter"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/code-lts.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-25T15:57:28.000Z","updated_at":"2026-01-22T09:29:18.000Z","dependencies_parsed_at":"2024-09-28T20:40:31.035Z","dependency_job_id":null,"html_url":"https://github.com/code-lts/cli-tools","commit_stats":{"total_commits":73,"total_committers":1,"mean_commits":73.0,"dds":0.0,"last_synced_commit":"321f8046dc1070259bb01a25942e93779378e6a8"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/code-lts/cli-tools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-lts%2Fcli-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-lts%2Fcli-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-lts%2Fcli-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-lts%2Fcli-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/code-lts","download_url":"https://codeload.github.com/code-lts/cli-tools/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-lts%2Fcli-tools/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29679049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T09:33:50.764Z","status":"ssl_error","status_checked_at":"2026-02-21T09:33:19.949Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["checkstyle","checkstyle-xml-report","cli","cli-tools","formatters","github","gitlab","gitlab-ci","junit","junit-xml","php","php8","teamcity","teamcity-formatter"],"created_at":"2024-09-24T20:12:53.612Z","updated_at":"2026-02-21T10:31:02.170Z","avatar_url":"https://github.com/code-lts.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CLI tools\n\n[![codecov](https://codecov.io/gh/code-lts/cli-tools/branch/main/graph/badge.svg?branch=main)](https://codecov.io/gh/code-lts/cli-tools?branch=main)\n[![Version](https://poser.pugx.org/code-lts/cli-tools/version)](//packagist.org/packages/code-lts/cli-tools)\n[![License](https://poser.pugx.org/code-lts/cli-tools/license)](//packagist.org/packages/code-lts/cli-tools)\n\nCLI tools to manage output errors formatting for junit, checkstyle, teamcity, gitlab and github error formats.\n\n## Motivation\n\nHave formatters that I can re-use in projects to format errors.\nSome code is copied from phpstan. See [#4122](https://github.com/phpstan/phpstan/issues/4122)\n\n## Example usages\n\n### Format errors\n\n```php\nuse CodeLts\\CliTools\\Error;\nuse CodeLts\\CliTools\\AnalysisResult;\nuse CodeLts\\CliTools\\OutputFormat;\nuse CodeLts\\CliTools\\Exceptions\\FormatNotFoundException;\n\n// if the value is from an user input\n// Will throw FormatNotFoundException\n// See valid formats at OutputFormat::VALID_OUTPUT_FORMATS\nOutputFormat::checkOutputFormatIsValid('notValidFormat');\n\n$fileSpecificErrors = [\n    new Error(\n        'My error message',\n        '/file/path/to/File.php',\n        15 // Line number\n    ),\n];\n\n$notFileSpecificErrors = [\n    'Just an error message',\n];\n\n$internalErrors = [\n    'Oops the internal engine did crash !',\n];\n\n$warnings = [\n    'I warn you that most of this code is tested',\n    'Contributions are very welcome',\n];\n\n$analysisResult = new AnalysisResult(\n    $fileSpecificErrors,\n    $notFileSpecificErrors,\n    $internalErrors,\n    $warnings\n);\n\nOutputFormat::displayUserChoiceFormat(\n    OutputFormat::OUTPUT_FORMAT_TABLE,// The phpstan table error format, you can have a lot more formats in OutputFormat::VALID_OUTPUT_FORMATS\n    $analysisResult,\n    $this-\u003esourceRootDirectory,// can be null, if null the error paths will not be pretty and will be displayed as given\n    $this-\u003eoutput // Implement CodeLts\\CliTools\\Output or use CodeLts\\CliTools\\Symfony\\SymfonyOutput\n);\n```\n\n### Read/Write files\n\n```php\nuse CodeLts\\CliTools\\File\\FileReader;\nuse CodeLts\\CliTools\\File\\FileWriter;\n\n$fileName = 'myFile.txt';\n\nFileWriter::write(\n    $fileName,\n    'Some data, blob, blob, blob.'\n);\n\nFileReader::read($fileName);// -\u003e Some data, blob, blob, blob.\n```\n\n### ANSI codes\n\n```php\nuse CodeLts\\CliTools\\File\\AnsiEscapeSequences;\n\n$this-\u003eoutput-\u003ewriteFormatted(AnsiEscapeSequences::ERASE_TO_LINE_END);\n```\n\n### Detect a CI\n\n```php\nuse CodeLts\\CliTools\\Utils;\n\n// See supported CIs at https://github.com/OndraM/ci-detector#supported-continuous-integration-servers\n\nUtils::isCiDetected(); // true of false\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode-lts%2Fcli-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcode-lts%2Fcli-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode-lts%2Fcli-tools/lists"}