Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
name: CI

on:
push:
branches: [main, cursor/**]
pull_request:
branches: [main]
push:
branches: [main]

# House gate is synapse-sentinel/quality-runners (Pint / Pest / PHPStan / Rector
# on the clone host, then Statuses API: quality-runners/{tool} + quality-runners/gate).
# https://github.com/synapse-sentinel/quality-runners
#
# Residual: this workflow still runs Pest (and Pint --test) on GitHub-hosted
# runners until conduit-ui is subscribed (quality-runners#73). It is not the
# house gate. Do not name this job "quality-runners is the house gate".

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
tests:
Expand All @@ -16,4 +29,5 @@ jobs:
extensions: mbstring, xml
coverage: none
- run: composer install --no-interaction --prefer-dist
- run: vendor/bin/pest
- run: vendor/bin/pint --test
- run: vendor/bin/pest --compact
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,17 @@ app/
│ └── Requests/ # Individual API requests
```

## Development

PR quality is [quality-runners](https://github.com/synapse-sentinel/quality-runners) (Pint, Pest, PHPStan, Rector on the clone host). Until that runner is subscribed to this repo, GitHub Actions still runs Pint `--test` and Pest as a residual. Local `./bin/ci` is the full set.

Locally:

```bash
composer install
./bin/ci
```

## License

MIT
7 changes: 6 additions & 1 deletion app/Commands/DnsCreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public function handle(): int
$zoneId = $this->resolveZoneId($connector, $zone);
if (! $zoneId) {
$this->error("Zone not found: {$zone}");

return self::FAILURE;
}
$zone = $zoneId;
Expand All @@ -44,14 +45,16 @@ public function handle(): int
);

if (! $response->successful()) {
$this->error('Failed to create DNS record: ' . $response->body());
$this->error('Failed to create DNS record: '.$response->body());

return self::FAILURE;
}

$record = $response->json('result');

if ($this->option('json')) {
$this->line(json_encode($record, JSON_PRETTY_PRINT));

return self::SUCCESS;
}

Expand All @@ -72,8 +75,10 @@ protected function resolveZoneId(CloudflareConnector $connector, string $name):
$response = $connector->zones()->list($name);
if ($response->successful()) {
$zones = $response->json('result', []);

return $zones[0]['id'] ?? null;
}

return null;
}

Expand Down
10 changes: 8 additions & 2 deletions app/Commands/DnsListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function handle(): int
$zoneId = $this->resolveZoneId($connector, $zone);
if (! $zoneId) {
$this->error("Zone not found: {$zone}");

return self::FAILURE;
}
$zone = $zoneId;
Expand All @@ -38,19 +39,22 @@ public function handle(): int
);

if (! $response->successful()) {
$this->error('Failed to list DNS records: ' . $response->body());
$this->error('Failed to list DNS records: '.$response->body());

return self::FAILURE;
}

$records = $response->json('result', []);

if ($this->option('json')) {
$this->line(json_encode($records, JSON_PRETTY_PRINT));

return self::SUCCESS;
}

if (empty($records)) {
$this->info('No DNS records found.');

return self::SUCCESS;
}

Expand All @@ -73,15 +77,17 @@ protected function resolveZoneId(CloudflareConnector $connector, string $name):
$response = $connector->zones()->list($name);
if ($response->successful()) {
$zones = $response->json('result', []);

return $zones[0]['id'] ?? null;
}

return null;
}

protected function truncate(string $value, int $length): string
{
return strlen($value) > $length
? substr($value, 0, $length - 3) . '...'
? substr($value, 0, $length - 3).'...'
: $value;
}

Expand Down
2 changes: 1 addition & 1 deletion app/Commands/TunnelDeleteCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function handle(): int
$response = $connector->tunnels()->delete($tunnelId);

if (! $response->successful()) {
$this->error('Failed to delete tunnel: ' . $response->body());
$this->error('Failed to delete tunnel: '.$response->body());

return self::FAILURE;
}
Expand Down
4 changes: 2 additions & 2 deletions app/Commands/TunnelListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function handle(): int
$response = $connector->tunnels()->list();

if (! $response->successful()) {
$this->error('Failed to list tunnels: ' . $response->body());
$this->error('Failed to list tunnels: '.$response->body());

return self::FAILURE;
}
Expand All @@ -44,7 +44,7 @@ public function handle(): int
$this->table(
['ID', 'Name', 'Status', 'Created', 'Connections'],
collect($tunnels)->map(fn ($t) => [
substr($t['id'], 0, 8) . '...',
substr($t['id'], 0, 8).'...',
$t['name'],
$t['status'] ?? 'unknown',
substr($t['created_at'] ?? '', 0, 10),
Expand Down
5 changes: 4 additions & 1 deletion app/Commands/ZonesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,22 @@ public function handle(): int
$response = $connector->zones()->list($this->option('name'));

if (! $response->successful()) {
$this->error('Failed to list zones: ' . $response->body());
$this->error('Failed to list zones: '.$response->body());

return self::FAILURE;
}

$zones = $response->json('result', []);

if ($this->option('json')) {
$this->line(json_encode($zones, JSON_PRETTY_PRINT));

return self::SUCCESS;
}

if (empty($zones)) {
$this->info('No zones found.');

return self::SUCCESS;
}

Expand Down
2 changes: 1 addition & 1 deletion app/Integrations/Cloudflare/CloudflareConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function resolveBaseUrl(): string
protected function defaultHeaders(): array
{
return [
'Authorization' => 'Bearer ' . $this->apiToken,
'Authorization' => 'Bearer '.$this->apiToken,
'Content-Type' => 'application/json',
];
}
Expand Down
17 changes: 17 additions & 0 deletions bin/ci
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
# Local merge gate — same fail-closed set quality-runners runs on the PR.
# House PR quality is synapse-sentinel/quality-runners, not GitHub Actions.
set -euo pipefail
cd "$(dirname "$0")/.."

echo "== Pint =="
vendor/bin/pint --test

echo "== PHPStan =="
vendor/bin/phpstan analyse --no-progress --memory-limit=512M

echo "== Rector =="
vendor/bin/rector --dry-run --no-progress-bar

echo "== Pest =="
vendor/bin/pest --compact
4 changes: 3 additions & 1 deletion bootstrap/providers.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use App\Providers\AppServiceProvider;

return [
App\Providers\AppServiceProvider::class,
AppServiceProvider::class,
];
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
"require-dev": {
"laravel/pint": "^1.25.1",
"mockery/mockery": "^1.6.12",
"pestphp/pest": "^3.8.4|^4.1.2"
"pestphp/pest": "^3.8.4|^4.1.2",
"phpstan/phpstan": "^2.2",
"rector/rector": "^2.6"
},
"autoload": {
"psr-4": {
Expand Down
123 changes: 122 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion config/app.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use App\Providers\AppServiceProvider;

return [

/*
Expand Down Expand Up @@ -54,7 +56,7 @@
*/

'providers' => [
App\Providers\AppServiceProvider::class,
AppServiceProvider::class,
],

];
Loading
Loading