Skip to content

Commit 4edf767

Browse files
committed
Expand TUI panels for run and deploy
1 parent 5a53c6b commit 4edf767

172 files changed

Lines changed: 5811 additions & 259 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ Open: `http://127.0.0.1:8000`
1515
## Documentation
1616

1717
- Main docs: `docs/README.md`
18+
- CLI guide: `docs/CLI.md`
19+
- Routing & pipelines: `docs/ROUTING.md`
20+
- Error handling: `docs/ERROR_HANDLING.md`
21+
- Flash messages: `docs/FLASH.md`
22+
- Authentication: `docs/AUTH.md`
23+
- Database layer: `docs/DATABASE.md`
24+
- Workers: `docs/WORKERS.md`
25+
- HTTP helpers: `docs/HTTP.md`
26+
- Changelog: `docs/CHANGELOG.md`
1827
- Architecture overview: `docs/ARCHITECTURE.md`
1928
- Per-file reference: `docs/reference/`
2029
- Codex / AI contributor notes: `docs/CODEX.md`

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"ext-pdo": "*",
2020
"ext-json": "*",
2121
"ext-mbstring": "*",
22+
"psr/log": "^3.0",
2223
"vlucas/phpdotenv": "^5.6"
2324
},
2425
"require-dev": {

config/app.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
return [
44
'env' => env('APP_ENV', 'local'),
55
'debug' => env('APP_DEBUG', true),
6+
'log_level' => env('APP_LOG_LEVEL', 'error'),
7+
'request_id_header' => env('APP_REQUEST_ID_HEADER', 'X-Request-Id'),
8+
'debug_toolbar' => env('APP_DEBUG_TOOLBAR', false),
69
// Phoenix analogue: secret_key_base. Required for signed cookies/sessions.
710
'secret_key_base' => env('APP_KEY', 'change-me-in-.env'),
811
// Phoenix analogue: Endpoint module that defines pipelines/scopes/routes.

config/auth.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?php
2+
3+
return [
4+
'remember_cookie' => env('AUTH_REMEMBER_COOKIE', 'pipeflow_remember'),
5+
];

docs/ARCHITECTURE.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,44 @@ PipeFlow is structured to keep the "pipeline" idea central:
77
- **App composition**: `Foundation\Application` owns config, container bindings, router instance, view engine, and DB.
88
- **Scaffolding**: `pipeflow` CLI generates controllers/models/migrations using the `stubs/` templates.
99

10+
### Currying note (functional style)
11+
12+
Many pipeline-friendly functions can be written in a curried style so they compose
13+
cleanly in `pipe()` or `|>` chains. Prefer small functions that return closures
14+
when you need configuration first, then data:
15+
16+
```php
17+
$trim = fn(int $length) => fn(string $value) => mb_substr($value, 0, $length);
18+
$result = pipe('hello world', $trim(5), fn($s) => strtoupper($s));
19+
```
20+
1021
## Where to start
1122

1223
- Web entry: `public/index.php`
1324
- App bootstrap: `bootstrap/app.php`
1425
- Routes: `routes/web.php`
1526
- CLI: `pipeflow`
1627

28+
## Router pipelines (Phoenix-style) status
29+
30+
PipeFlow already supports a Phoenix-inspired request flow using `Conn` + plugs/pipelines,
31+
but the routing and pipeline DSL is **not yet Phoenix-complete**. The current scope is
32+
intentionally minimal, so keep these gaps in mind:
33+
34+
- **Nested scopes with inherited pipelines** (predictable merge rules are not implemented).
35+
- **Route naming + reverse routing helpers** (e.g., `route('post.show', ['id' => 1])`).
36+
- **404/405 handling with content negotiation** (HTML vs JSON responses).
37+
38+
For routing overview and current behavior, see `docs/ROUTING.md`.
39+
40+
## Error handling & diagnostics
41+
42+
The kernel captures uncaught exceptions and delegates to `ExceptionHandler`, which
43+
returns HTML error pages for browser requests and JSON problem details for API calls.
44+
Logging and request-id correlation are built in, and a debug toolbar hook is available.
45+
46+
See `docs/ERROR_HANDLING.md` for details.
47+
1748
## Middleware vs Plugs (Pipes) and runtime modes
1849

1950
PipeFlow supports two ways to run logic before/after your route handler:

docs/AUTH.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Authentication & Authorization
2+
3+
PipeFlow includes a minimal authentication layer built on plugs and a user provider.
4+
The goal is to make it easy to assign a `current_user` and authorize actions without
5+
locking you into a storage strategy.
6+
7+
## Auth plug (current_user)
8+
9+
The `AuthPlug` reads the user id from the session and assigns it to the connection:
10+
11+
- `assigns['current_user']`
12+
- `private['current_user']`
13+
14+
Enable it by keeping `AuthPlug` in the global plug list (default).
15+
16+
## User provider
17+
18+
Implement `PipeFlow\Auth\UserProviderInterface` to fetch and validate users. The
19+
provider is bound into the container, so you can swap in your own implementation:
20+
21+
```php
22+
app(PipeFlow\Foundation\Container::class)->instance(
23+
PipeFlow\Auth\UserProviderInterface::class,
24+
new App\Auth\DbUserProvider()
25+
);
26+
```
27+
28+
Required methods:
29+
- `findById($id)`
30+
- `findByCredentials(array $credentials)`
31+
- `validateCredentials($user, array $credentials)`
32+
- `getUserId($user)`
33+
34+
## Auth manager
35+
36+
`PipeFlow\Auth\AuthManager` offers convenience APIs:
37+
38+
- `attempt($conn, $credentials, $remember = false)`
39+
- `login($conn, $user, $remember = false)`
40+
- `logout($conn)`
41+
- `userFromSession($conn)`
42+
43+
## Password hashing
44+
45+
Use `PipeFlow\Security\PasswordHasher` for hashing/verifying:
46+
47+
```php
48+
$hash = app(PipeFlow\Security\PasswordHasher::class)->hash($password);
49+
$isValid = app(PipeFlow\Security\PasswordHasher::class)->verify($password, $hash);
50+
```
51+
52+
## Authorization (gates)
53+
54+
`PipeFlow\Auth\AuthorizationGate` is a lightweight policy registry:
55+
56+
```php
57+
$gate = app(PipeFlow\Auth\AuthorizationGate::class);
58+
$gate->define('posts.update', fn($user, $post) => $user->id === $post->user_id);
59+
```
60+
61+
In views/templates, use `can()` to check abilities.
62+
63+
## Remember-me (optional)
64+
65+
`AuthManager` can set a remember cookie when `remember=true`. For a production system
66+
back this with a secure token store and rotation policy.
67+
68+
Configuration:
69+
- `AUTH_REMEMBER_COOKIE` (default: `pipeflow_remember`)

docs/CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Changelog
2+
3+
All notable documentation changes are recorded here. This project follows a simplified
4+
"keep a changelog" format without strict versioning.
5+
6+
## Unreleased
7+
8+
### Added
9+
- Central exception handling with HTML/JSON responses and environment-aware diagnostics.
10+
- PSR-3 logging integration with request ID correlation.
11+
- Optional debug toolbar hook and error-handling guide.
12+
- Flash message helpers and optional flash partial documentation.
13+
- Functional currying guidance in architecture notes.
14+
- Phoenix-style Result helpers for ok/error flows.
15+
- Documented Result metadata conventions for UI/diagnostics.
16+
- Authentication plug, auth manager, gates, and password hashing utilities.
17+
- Database safety improvements, transactions, and model casting/validation.
18+
- Long-lived worker checklist and per-request cleanup hooks.
19+
- Boot-once helper for warming config/routes/views.
20+
- Additional CLI scaffolds (crud, plug, channel, test, factory, fixture).
21+
- HTTP header/cookie helpers and security/static plugs.
22+
- Typed route parameters with built-in patterns (including `slug`) for routing.
23+
- Routing guide section describing typed parameters and constraints.
24+
- Routing & pipelines guide (`docs/ROUTING.md`) with current behavior and known gaps.
25+
- Router pipeline status section in architecture notes.
26+
- Clickable reference index and per-file summaries in generated docs.
27+
- CLI guide with beginner walkthrough and command reference.

0 commit comments

Comments
 (0)