@ryuenn3123/agentic-senior-core 2.5.22 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agent-context/prompts/init-project.md +5 -5
- package/.agent-context/prompts/refactor.md +2 -1
- package/.agent-context/prompts/review-code.md +3 -2
- package/.agent-context/review-checklists/pr-checklist.md +8 -1
- package/.agent-context/rules/architecture.md +11 -0
- package/.agent-context/rules/frontend-architecture.md +2 -2
- package/.agent-context/state/architecture-map.md +1 -1
- package/.agent-context/state/memory-continuity-benchmark.json +1 -1
- package/.agents/workflows/init-project.md +3 -3
- package/.agents/workflows/refactor.md +1 -1
- package/.agents/workflows/review-code.md +4 -5
- package/.cursorrules +27 -71
- package/.gemini/instructions.md +6 -7
- package/.github/copilot-instructions.md +5 -6
- package/.windsurfrules +27 -71
- package/AGENTS.md +7 -9
- package/CONTRIBUTING.md +18 -31
- package/README.md +21 -4
- package/bin/agentic-senior-core.js +0 -6
- package/lib/cli/commands/init.mjs +113 -650
- package/lib/cli/commands/launch.mjs +1 -23
- package/lib/cli/commands/rollback.mjs +1 -1
- package/lib/cli/commands/upgrade.mjs +1 -23
- package/lib/cli/compiler.mjs +77 -72
- package/lib/cli/constants.mjs +84 -26
- package/lib/cli/init-architecture-flow.mjs +231 -0
- package/lib/cli/init-detection-flow.mjs +123 -0
- package/lib/cli/init-options.mjs +344 -0
- package/lib/cli/init-selection.mjs +100 -0
- package/lib/cli/preflight.mjs +1 -1
- package/lib/cli/profile-packs.mjs +15 -1
- package/lib/cli/project-scaffolder.mjs +18 -154
- package/lib/cli/utils.mjs +16 -12
- package/mcp.json +19 -19
- package/package.json +5 -2
- package/scripts/context-triggered-audit.mjs +18 -18
- package/scripts/documentation-boundary-audit.mjs +92 -5
- package/scripts/forbidden-content-check.mjs +1 -1
- package/scripts/frontend-usability-audit.mjs +21 -28
- package/scripts/governance-weekly-report.mjs +29 -15
- package/scripts/llm-judge.mjs +2 -5
- package/scripts/mcp-server.mjs +389 -5
- package/scripts/release-gate.mjs +121 -145
- package/scripts/sync-thin-adapters.mjs +161 -0
- package/scripts/v3-purge-audit.mjs +231 -0
- package/scripts/validate-evidence-bundle.mjs +1 -1
- package/scripts/validate.mjs +224 -272
- package/.agent-context/blueprints/api-nextjs.md +0 -184
- package/.agent-context/blueprints/aspnet-api.md +0 -247
- package/.agent-context/blueprints/ci-github-actions.md +0 -226
- package/.agent-context/blueprints/ci-gitlab.md +0 -200
- package/.agent-context/blueprints/fastapi-service.md +0 -210
- package/.agent-context/blueprints/go-service.md +0 -217
- package/.agent-context/blueprints/graphql-grpc-api.md +0 -51
- package/.agent-context/blueprints/infrastructure-as-code.md +0 -62
- package/.agent-context/blueprints/kubernetes-manifests.md +0 -76
- package/.agent-context/blueprints/laravel-api.md +0 -233
- package/.agent-context/blueprints/mobile-app.md +0 -91
- package/.agent-context/blueprints/nestjs-logic.md +0 -247
- package/.agent-context/blueprints/observability.md +0 -227
- package/.agent-context/blueprints/spring-boot-api.md +0 -218
- package/.agent-context/profiles/platform.md +0 -13
- package/.agent-context/profiles/regulated.md +0 -13
- package/.agent-context/profiles/startup.md +0 -13
- package/.agent-context/review-checklists/frontend-excellence-rubric.md +0 -73
- package/.agent-context/review-checklists/frontend-skill-parity.md +0 -29
- package/.agent-context/review-checklists/frontend-usability.md +0 -35
- package/.agent-context/review-checklists/marketplace-acceptance.md +0 -60
- package/.agent-context/review-checklists/performance-audit.md +0 -71
- package/.agent-context/review-checklists/release-operations.md +0 -33
- package/.agent-context/review-checklists/security-audit.md +0 -119
- package/.agent-context/skills/README.md +0 -63
- package/.agent-context/skills/backend/README.md +0 -68
- package/.agent-context/skills/backend/architecture.md +0 -361
- package/.agent-context/skills/backend/compatibility-manifest.json +0 -8
- package/.agent-context/skills/backend/data-access.md +0 -231
- package/.agent-context/skills/backend/errors.md +0 -138
- package/.agent-context/skills/backend/validation.md +0 -117
- package/.agent-context/skills/backend.md +0 -29
- package/.agent-context/skills/cli/.evidence/compatibility-manifest.json +0 -5
- package/.agent-context/skills/cli/.evidence/sbom-excerpt.json +0 -10
- package/.agent-context/skills/cli/.evidence/test-report.json +0 -8
- package/.agent-context/skills/cli/CHANGELOG.md +0 -6
- package/.agent-context/skills/cli/README.md +0 -56
- package/.agent-context/skills/cli/compatibility-manifest.json +0 -8
- package/.agent-context/skills/cli/init.md +0 -38
- package/.agent-context/skills/cli/output.md +0 -36
- package/.agent-context/skills/cli/package.json +0 -5
- package/.agent-context/skills/cli/safety-telemetry.md +0 -39
- package/.agent-context/skills/cli/tests/.gitkeep +0 -1
- package/.agent-context/skills/cli/upgrade.md +0 -38
- package/.agent-context/skills/cli.md +0 -32
- package/.agent-context/skills/distribution/.evidence/compatibility-manifest.json +0 -9
- package/.agent-context/skills/distribution/.evidence/sbom-excerpt.json +0 -6
- package/.agent-context/skills/distribution/.evidence/test-report.json +0 -8
- package/.agent-context/skills/distribution/CHANGELOG.md +0 -7
- package/.agent-context/skills/distribution/README.md +0 -27
- package/.agent-context/skills/distribution/compatibility-manifest.json +0 -8
- package/.agent-context/skills/distribution/compatibility.md +0 -32
- package/.agent-context/skills/distribution/package.json +0 -5
- package/.agent-context/skills/distribution/provenance-attestation.md +0 -47
- package/.agent-context/skills/distribution/publish.md +0 -37
- package/.agent-context/skills/distribution/rollback.md +0 -32
- package/.agent-context/skills/distribution/tests/.gitkeep +0 -1
- package/.agent-context/skills/distribution.md +0 -32
- package/.agent-context/skills/frontend/.evidence/compatibility-manifest.json +0 -9
- package/.agent-context/skills/frontend/.evidence/sbom-excerpt.json +0 -6
- package/.agent-context/skills/frontend/.evidence/test-report.json +0 -8
- package/.agent-context/skills/frontend/CHANGELOG.md +0 -7
- package/.agent-context/skills/frontend/README.md +0 -50
- package/.agent-context/skills/frontend/accessibility.md +0 -107
- package/.agent-context/skills/frontend/compatibility-manifest.json +0 -8
- package/.agent-context/skills/frontend/conversion-clarity.md +0 -51
- package/.agent-context/skills/frontend/motion.md +0 -67
- package/.agent-context/skills/frontend/package.json +0 -5
- package/.agent-context/skills/frontend/performance.md +0 -63
- package/.agent-context/skills/frontend/responsive-delivery.md +0 -41
- package/.agent-context/skills/frontend/tests/.gitkeep +0 -1
- package/.agent-context/skills/frontend/ui-architecture.md +0 -128
- package/.agent-context/skills/frontend.md +0 -40
- package/.agent-context/skills/fullstack/.evidence/compatibility-manifest.json +0 -9
- package/.agent-context/skills/fullstack/.evidence/sbom-excerpt.json +0 -6
- package/.agent-context/skills/fullstack/.evidence/test-report.json +0 -8
- package/.agent-context/skills/fullstack/CHANGELOG.md +0 -7
- package/.agent-context/skills/fullstack/README.md +0 -27
- package/.agent-context/skills/fullstack/compatibility-manifest.json +0 -8
- package/.agent-context/skills/fullstack/contracts.md +0 -53
- package/.agent-context/skills/fullstack/end-to-end.md +0 -42
- package/.agent-context/skills/fullstack/feature-slicing.md +0 -65
- package/.agent-context/skills/fullstack/package.json +0 -5
- package/.agent-context/skills/fullstack/release-coordination.md +0 -51
- package/.agent-context/skills/fullstack/tests/.gitkeep +0 -1
- package/.agent-context/skills/fullstack.md +0 -30
- package/.agent-context/skills/index.json +0 -107
- package/.agent-context/skills/review-quality/.evidence/compatibility-manifest.json +0 -9
- package/.agent-context/skills/review-quality/.evidence/sbom-excerpt.json +0 -6
- package/.agent-context/skills/review-quality/.evidence/test-report.json +0 -8
- package/.agent-context/skills/review-quality/CHANGELOG.md +0 -7
- package/.agent-context/skills/review-quality/README.md +0 -27
- package/.agent-context/skills/review-quality/benchmark.md +0 -30
- package/.agent-context/skills/review-quality/compatibility-manifest.json +0 -8
- package/.agent-context/skills/review-quality/package.json +0 -5
- package/.agent-context/skills/review-quality/planning.md +0 -38
- package/.agent-context/skills/review-quality/release-decision.md +0 -49
- package/.agent-context/skills/review-quality/security.md +0 -34
- package/.agent-context/skills/review-quality/tests/.gitkeep +0 -1
- package/.agent-context/skills/review-quality.md +0 -34
- package/.agent-context/stacks/csharp.md +0 -149
- package/.agent-context/stacks/flutter.md +0 -16
- package/.agent-context/stacks/go.md +0 -181
- package/.agent-context/stacks/java.md +0 -135
- package/.agent-context/stacks/php.md +0 -192
- package/.agent-context/stacks/python.md +0 -153
- package/.agent-context/stacks/react-native.md +0 -16
- package/.agent-context/stacks/ruby.md +0 -80
- package/.agent-context/stacks/rust.md +0 -86
- package/.agent-context/stacks/typescript.md +0 -317
- package/.agent-context/state/skill-platform.json +0 -38
- package/lib/cli/skill-selector.mjs +0 -232
- package/lib/cli/templates/api-contract.md.id.tmpl +0 -143
- package/lib/cli/templates/api-contract.md.tmpl +0 -143
- package/lib/cli/templates/architecture-decision-record.md.id.tmpl +0 -106
- package/lib/cli/templates/architecture-decision-record.md.tmpl +0 -145
- package/lib/cli/templates/database-schema.md.id.tmpl +0 -74
- package/lib/cli/templates/database-schema.md.tmpl +0 -74
- package/lib/cli/templates/flow-overview.md.id.tmpl +0 -118
- package/lib/cli/templates/flow-overview.md.tmpl +0 -131
- package/lib/cli/templates/project-brief.md.id.tmpl +0 -55
- package/lib/cli/templates/project-brief.md.tmpl +0 -79
- package/scripts/init-project.ps1 +0 -105
- package/scripts/init-project.sh +0 -131
- package/scripts/skill-tier-policy.mjs +0 -76
- package/scripts/trust-scorer.mjs +0 -119
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# Infrastructure as Code (IaC) Blueprint
|
|
2
|
-
|
|
3
|
-
> ClickOps is a sin. If it's not in code, it doesn't exist. Treats your servers like cattle, not pets.
|
|
4
|
-
|
|
5
|
-
## 1. Tooling (March 2026)
|
|
6
|
-
- **Standard:** Terraform / OpenTofu (HCL) or Pulumi (TypeScript/Go/Python).
|
|
7
|
-
- **BANNED:** AWS CloudFormation (verbose, slow, vendor-locked) unless mandated by enterprise policy. AWS CDK is acceptable but requires rigorous linting to prevent runaway loops.
|
|
8
|
-
|
|
9
|
-
## 2. Directory Structure (Blast Radius Management)
|
|
10
|
-
Never put all your infrastructure into a single `main.tf` or a single state file.
|
|
11
|
-
- **BANNED:** Flat structure. A single mistake could destroy the database while updating an S3 bucket.
|
|
12
|
-
- **REQUIRED (Component/Environment Split):**
|
|
13
|
-
```
|
|
14
|
-
infrastructure/
|
|
15
|
-
modules/
|
|
16
|
-
vpc/
|
|
17
|
-
rds/
|
|
18
|
-
eks/
|
|
19
|
-
environments/
|
|
20
|
-
dev/
|
|
21
|
-
vpc/ (depends on modules/vpc)
|
|
22
|
-
rds/ (runs its own state file)
|
|
23
|
-
prod/
|
|
24
|
-
vpc/
|
|
25
|
-
rds/
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## 3. Remote State & Locking
|
|
29
|
-
State files contain sensitive data (passwords, IP addresses) and represent the source of truth for your physical architecture.
|
|
30
|
-
- **Rule:** ALWAYS use a remote backend (S3, GCS, HCP Terraform) with state locking (DynamoDB, native GCS/HCP).
|
|
31
|
-
- **BANNED:** Committing `terraform.tfstate` or `Pulumi.dev.yaml` to Git. Ensure `*.tfstate` is in `.gitignore`.
|
|
32
|
-
|
|
33
|
-
## 4. Hardcoded Values & Secrets
|
|
34
|
-
- **Rule:** NEVER hardcode ARNs, IPs, or passwords in your IaC.
|
|
35
|
-
- **REQUIRED:** Pass variables via `.tfvars` (which are gitignored) or environment variables (`TF_VAR_db_password`). Use a Secret Manager (AWS Secrets Manager, HashiCorp Vault) and reference the secret dynamically.
|
|
36
|
-
- **Example:**
|
|
37
|
-
```hcl
|
|
38
|
-
# ❌ BANNED
|
|
39
|
-
password = "SuperSecretPassword123!"
|
|
40
|
-
|
|
41
|
-
# ✅ REQUIRED
|
|
42
|
-
data "aws_secretsmanager_secret_version" "db" {
|
|
43
|
-
secret_id = aws_secretsmanager_secret.db.id
|
|
44
|
-
}
|
|
45
|
-
password = jsondecode(data.aws_secretsmanager_secret_version.db.secret_string)["password"]
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## 5. Principle of Least Privilege (IAM)
|
|
49
|
-
- **Rule:** Wildcards (`*`) in IAM policies are strictly banned unless absolutely necessary (e.g., specific S3 actions).
|
|
50
|
-
- **BANNED:** Assigning `AmazonS3FullAccess` to a worker node that only needs to read from one bucket.
|
|
51
|
-
- **REQUIRED:** Explicit resource ARNs and explicit Actions.
|
|
52
|
-
```hcl
|
|
53
|
-
statement {
|
|
54
|
-
effect = "Allow"
|
|
55
|
-
actions = ["s3:GetObject"]
|
|
56
|
-
resources = ["arn:aws:s3:::my-specific-bucket/uploads/*"]
|
|
57
|
-
}
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## 6. Immutable Infrastructure
|
|
61
|
-
- **Rule:** If a server is unhealthy, terminate it. Do not SSH into it to fix it.
|
|
62
|
-
- **Rule:** Use Auto Scaling Groups (ASGs) even if the desired capacity is 1. This ensures the component is self-healing.
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
# Kubernetes Manifests Blueprint
|
|
2
|
-
|
|
3
|
-
> Kubernetes is a declarative state machine. Tell it what you want, not how to do it.
|
|
4
|
-
|
|
5
|
-
## 1. Bare Minimum Requirements
|
|
6
|
-
Every application deployed to Kubernetes MUST include at minimum:
|
|
7
|
-
1. `Deployment` (or `StatefulSet`/`DaemonSet`)
|
|
8
|
-
2. `Service`
|
|
9
|
-
3. `ConfigMap` (for non-sensitive config)
|
|
10
|
-
4. `Secret` (managed externally, e.g., via ExternalSecrets)
|
|
11
|
-
5. `Ingress` (or `Gateway APIRoute`)
|
|
12
|
-
|
|
13
|
-
## 2. Resource Limits & Requests (Mandatory)
|
|
14
|
-
A container without resource limits is a noisy neighbor that will eventually crash the node.
|
|
15
|
-
- **Rule:** EVERY container in a Pod MUST have BOTH `requests` and `limits` defined for CPU and Memory.
|
|
16
|
-
- **BANNED:** Omitting the `resources` block.
|
|
17
|
-
- **REQUIRED:**
|
|
18
|
-
```yaml
|
|
19
|
-
resources:
|
|
20
|
-
requests:
|
|
21
|
-
memory: "256Mi"
|
|
22
|
-
cpu: "100m"
|
|
23
|
-
limits:
|
|
24
|
-
memory: "512Mi"
|
|
25
|
-
cpu: "500m"
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## 3. Liveness & Readiness Probes (Mandatory)
|
|
29
|
-
Kubernetes needs to know when your app is ready to serve traffic and if it needs to be restarted.
|
|
30
|
-
- **Rule:** EVERY container MUST define a `readinessProbe` and a `livenessProbe`.
|
|
31
|
-
- **BANNED:** Assuming the container is ready just because the process started.
|
|
32
|
-
- **REQUIRED:**
|
|
33
|
-
```yaml
|
|
34
|
-
livenessProbe:
|
|
35
|
-
httpGet:
|
|
36
|
-
path: /healthz
|
|
37
|
-
port: 8080
|
|
38
|
-
initialDelaySeconds: 5
|
|
39
|
-
periodSeconds: 10
|
|
40
|
-
readinessProbe:
|
|
41
|
-
httpGet:
|
|
42
|
-
path: /ready
|
|
43
|
-
port: 8080
|
|
44
|
-
initialDelaySeconds: 5
|
|
45
|
-
periodSeconds: 5
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
## 4. The `latest` Tag Fallacy
|
|
49
|
-
- **Rule:** NEVER use the `:latest` tag for container images in production.
|
|
50
|
-
- **Why:** Deployments containing the `latest` tag cannot be easily rolled back, and nodes may cache different versions of `latest`.
|
|
51
|
-
- **REQUIRED:** Use explicit semantic versioning (`:v1.2.3`) or Git SHA hashes (`:sha-7a8f9b`).
|
|
52
|
-
|
|
53
|
-
## 5. Configuration & Secrets Management
|
|
54
|
-
- **Rule:** Application configuration must be injected via Environment Variables originating from `ConfigMaps` or `Secrets`.
|
|
55
|
-
- **BANNED:** Hardcoding environment variables in the `Deployment` manifest.
|
|
56
|
-
- **BANNED:** Storing Base64-encoded `Secret` manifests in version control.
|
|
57
|
-
- **REQUIRED:** Use tools like `External Secrets Operator` to pull secrets from AWS Secrets Manager / HashiCorp Vault into the cluster securely.
|
|
58
|
-
```yaml
|
|
59
|
-
envFrom:
|
|
60
|
-
- configMapRef:
|
|
61
|
-
name: app-config
|
|
62
|
-
- secretRef:
|
|
63
|
-
name: app-secrets
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## 6. Security Context
|
|
67
|
-
By default, containers run as `root`. This is a massive security risk.
|
|
68
|
-
- **Rule:** Containers MUST run as a non-root user. The filesystem should be read-only where possible.
|
|
69
|
-
- **REQUIRED:**
|
|
70
|
-
```yaml
|
|
71
|
-
securityContext:
|
|
72
|
-
runAsNonRoot: true
|
|
73
|
-
runAsUser: 1000
|
|
74
|
-
readOnlyRootFilesystem: true
|
|
75
|
-
allowPrivilegeEscalation: false
|
|
76
|
-
```
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
# Blueprint: Laravel API
|
|
2
|
-
|
|
3
|
-
> PHP backend API service using Laravel 13, PHP 8.3+, Form Requests, Eloquent, and Scribe for docs.
|
|
4
|
-
|
|
5
|
-
## Tech Stack
|
|
6
|
-
|
|
7
|
-
| Layer | Technology |
|
|
8
|
-
|-------|-----------|
|
|
9
|
-
| Framework | Laravel 13 |
|
|
10
|
-
| Validation | Form Requests |
|
|
11
|
-
| ORM | Eloquent |
|
|
12
|
-
| Migration | Laravel Migrations |
|
|
13
|
-
| Testing | Pest PHP |
|
|
14
|
-
| Static analysis | PHPStan (level 8) |
|
|
15
|
-
| Formatting | Laravel Pint |
|
|
16
|
-
| API docs | Scribe |
|
|
17
|
-
|
|
18
|
-
## Laravel 13 Upgrade Guardrails
|
|
19
|
-
|
|
20
|
-
- Target `laravel/framework:^13.0` with PHP 8.3+.
|
|
21
|
-
- Use `PreventRequestForgery` when explicitly disabling or excluding CSRF middleware in tests and routes.
|
|
22
|
-
- Keep `upsert` calls explicit with a non-empty `uniqueBy` value for MySQL and MariaDB paths.
|
|
23
|
-
- Decide cache object strategy up front: primitive payloads, or explicit `serializable_classes` allow-list.
|
|
24
|
-
- For existing Laravel 12 projects, keep framework-12-compatible middleware and APIs until upgrade is done; treat this blueprint as target-state guidance.
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## Project Structure
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
project-name/
|
|
32
|
-
├── app/
|
|
33
|
-
│ ├── Modules/
|
|
34
|
-
│ │ └── User/
|
|
35
|
-
│ │ ├── Controllers/
|
|
36
|
-
│ │ │ └── UserController.php
|
|
37
|
-
│ │ ├── Services/
|
|
38
|
-
│ │ │ └── UserService.php
|
|
39
|
-
│ │ ├── Repositories/
|
|
40
|
-
│ │ │ └── UserRepository.php
|
|
41
|
-
│ │ ├── Requests/
|
|
42
|
-
│ │ │ ├── StoreUserRequest.php
|
|
43
|
-
│ │ │ └── UpdateUserRequest.php
|
|
44
|
-
│ │ ├── Resources/
|
|
45
|
-
│ │ │ └── UserResource.php
|
|
46
|
-
│ │ ├── Models/
|
|
47
|
-
│ │ │ └── User.php
|
|
48
|
-
│ │ ├── Policies/
|
|
49
|
-
│ │ │ └── UserPolicy.php
|
|
50
|
-
│ │ └── Exceptions/
|
|
51
|
-
│ │ └── UserNotFoundException.php
|
|
52
|
-
│ │
|
|
53
|
-
│ ├── Shared/
|
|
54
|
-
│ │ ├── Exceptions/
|
|
55
|
-
│ │ │ └── Handler.php
|
|
56
|
-
│ │ └── Traits/
|
|
57
|
-
│ │ └── ApiResponse.php
|
|
58
|
-
│ │
|
|
59
|
-
│ └── Providers/
|
|
60
|
-
│
|
|
61
|
-
├── database/
|
|
62
|
-
│ ├── factories/
|
|
63
|
-
│ │ └── UserFactory.php
|
|
64
|
-
│ ├── migrations/
|
|
65
|
-
│ └── seeders/
|
|
66
|
-
│
|
|
67
|
-
├── routes/
|
|
68
|
-
│ └── api.php
|
|
69
|
-
│
|
|
70
|
-
├── tests/
|
|
71
|
-
│ ├── Feature/
|
|
72
|
-
│ │ └── User/
|
|
73
|
-
│ │ └── UserEndpointTest.php
|
|
74
|
-
│ └── Unit/
|
|
75
|
-
│ └── User/
|
|
76
|
-
│ └── UserServiceTest.php
|
|
77
|
-
│
|
|
78
|
-
├── phpstan.neon
|
|
79
|
-
├── .env.example
|
|
80
|
-
├── composer.json
|
|
81
|
-
└── Dockerfile
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
---
|
|
85
|
-
|
|
86
|
-
## File Patterns
|
|
87
|
-
|
|
88
|
-
### Controller — Thin Transport Layer
|
|
89
|
-
```php
|
|
90
|
-
<?php
|
|
91
|
-
|
|
92
|
-
declare(strict_types=1);
|
|
93
|
-
|
|
94
|
-
namespace App\Modules\User\Controllers;
|
|
95
|
-
|
|
96
|
-
use App\Modules\User\Requests\StoreUserRequest;
|
|
97
|
-
use App\Modules\User\Resources\UserResource;
|
|
98
|
-
use App\Modules\User\Services\UserService;
|
|
99
|
-
use Illuminate\Http\JsonResponse;
|
|
100
|
-
use Illuminate\Http\Resources\Json\AnonymousResourceCollection;
|
|
101
|
-
use Symfony\Component\HttpFoundation\Response;
|
|
102
|
-
|
|
103
|
-
final class UserController
|
|
104
|
-
{
|
|
105
|
-
public function __construct(
|
|
106
|
-
private readonly UserService $userService,
|
|
107
|
-
) {}
|
|
108
|
-
|
|
109
|
-
public function store(StoreUserRequest $request): JsonResponse
|
|
110
|
-
{
|
|
111
|
-
$user = $this->userService->create($request->validated());
|
|
112
|
-
|
|
113
|
-
return (new UserResource($user))
|
|
114
|
-
->response()
|
|
115
|
-
->setStatusCode(Response::HTTP_CREATED);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
public function index(): AnonymousResourceCollection
|
|
119
|
-
{
|
|
120
|
-
return UserResource::collection(
|
|
121
|
-
$this->userService->listPaginated()
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
### Form Request — Boundary Validation
|
|
128
|
-
```php
|
|
129
|
-
<?php
|
|
130
|
-
|
|
131
|
-
declare(strict_types=1);
|
|
132
|
-
|
|
133
|
-
namespace App\Modules\User\Requests;
|
|
134
|
-
|
|
135
|
-
use Illuminate\Foundation\Http\FormRequest;
|
|
136
|
-
|
|
137
|
-
final class StoreUserRequest extends FormRequest
|
|
138
|
-
{
|
|
139
|
-
/** @return array<string, array<int, string>> */
|
|
140
|
-
public function rules(): array
|
|
141
|
-
{
|
|
142
|
-
return [
|
|
143
|
-
'name' => ['required', 'string', 'max:100'],
|
|
144
|
-
'email' => ['required', 'email', 'unique:users,email'],
|
|
145
|
-
'password' => ['required', 'string', 'min:8', 'confirmed'],
|
|
146
|
-
];
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
### Service — Business Logic
|
|
152
|
-
```php
|
|
153
|
-
<?php
|
|
154
|
-
|
|
155
|
-
declare(strict_types=1);
|
|
156
|
-
|
|
157
|
-
namespace App\Modules\User\Services;
|
|
158
|
-
|
|
159
|
-
use App\Modules\User\Models\User;
|
|
160
|
-
use App\Modules\User\Repositories\UserRepository;
|
|
161
|
-
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
|
162
|
-
use Illuminate\Support\Facades\Hash;
|
|
163
|
-
use Illuminate\Support\Facades\Log;
|
|
164
|
-
|
|
165
|
-
final class UserService
|
|
166
|
-
{
|
|
167
|
-
public function __construct(
|
|
168
|
-
private readonly UserRepository $userRepository,
|
|
169
|
-
) {}
|
|
170
|
-
|
|
171
|
-
/** @param array{name: string, email: string, password: string} $data */
|
|
172
|
-
public function create(array $data): User
|
|
173
|
-
{
|
|
174
|
-
$data['password'] = Hash::make($data['password']);
|
|
175
|
-
$user = $this->userRepository->create($data);
|
|
176
|
-
|
|
177
|
-
Log::info('User created', ['user_id' => $user->id, 'email' => $user->email]);
|
|
178
|
-
|
|
179
|
-
return $user;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
public function listPaginated(int $perPage = 15): LengthAwarePaginator
|
|
183
|
-
{
|
|
184
|
-
return $this->userRepository->paginate($perPage);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
### API Resource — Response Transformer
|
|
190
|
-
```php
|
|
191
|
-
<?php
|
|
192
|
-
|
|
193
|
-
declare(strict_types=1);
|
|
194
|
-
|
|
195
|
-
namespace App\Modules\User\Resources;
|
|
196
|
-
|
|
197
|
-
use Illuminate\Http\Request;
|
|
198
|
-
use Illuminate\Http\Resources\Json\JsonResource;
|
|
199
|
-
|
|
200
|
-
/** @mixin \App\Modules\User\Models\User */
|
|
201
|
-
final class UserResource extends JsonResource
|
|
202
|
-
{
|
|
203
|
-
/** @return array<string, mixed> */
|
|
204
|
-
public function toArray(Request $request): array
|
|
205
|
-
{
|
|
206
|
-
return [
|
|
207
|
-
'id' => $this->id,
|
|
208
|
-
'name' => $this->name,
|
|
209
|
-
'email' => $this->email,
|
|
210
|
-
'created_at' => $this->created_at?->toISOString(),
|
|
211
|
-
];
|
|
212
|
-
// NEVER expose: password, remember_token, email_verified_at (unless needed)
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
---
|
|
218
|
-
|
|
219
|
-
## Scaffolding Checklist
|
|
220
|
-
|
|
221
|
-
- [ ] Create Laravel project: `composer create-project laravel/laravel:^13.0`
|
|
222
|
-
- [ ] Confirm core dependencies: `laravel/framework:^13.0`, `laravel/tinker:^3.0`, `phpunit/phpunit:^12.0`, `pestphp/pest:^4.0`
|
|
223
|
-
- [ ] Optional AI workflow: install `laravel/boost:^2.0` and run `php artisan boost:install`
|
|
224
|
-
- [ ] Set up modular structure under `app/Modules/`
|
|
225
|
-
- [ ] Create shared error handler with consistent JSON responses
|
|
226
|
-
- [ ] Create shared `ApiResponse` trait for standard response format
|
|
227
|
-
- [ ] Install and configure PHPStan level 8
|
|
228
|
-
- [ ] Install and configure Laravel Pint
|
|
229
|
-
- [ ] Install Pest PHP for testing
|
|
230
|
-
- [ ] Install Scribe for API documentation
|
|
231
|
-
- [ ] Create first module following the pattern above
|
|
232
|
-
- [ ] Create `.env.example` with all required variables
|
|
233
|
-
- [ ] Run `php artisan test`, `./vendor/bin/phpstan`, `./vendor/bin/pint` — zero errors
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
# Mobile App Blueprint
|
|
2
|
-
|
|
3
|
-
This blueprint defines a production starter for mobile products that need strict separation between UI flow, device integration, offline behavior, and backend contracts.
|
|
4
|
-
|
|
5
|
-
## Reference Architecture
|
|
6
|
-
|
|
7
|
-
Use a three-layer mobile module boundary:
|
|
8
|
-
|
|
9
|
-
- Transport layer: navigation routes, deep links, push notification handlers, platform lifecycle hooks.
|
|
10
|
-
- Service layer: screen orchestration, input validation, business workflows, permission policy decisions.
|
|
11
|
-
- Repository layer: API clients, local persistence, cache synchronization, device adapter wrappers.
|
|
12
|
-
|
|
13
|
-
## Suggested Structure
|
|
14
|
-
|
|
15
|
-
```text
|
|
16
|
-
mobile/
|
|
17
|
-
app/
|
|
18
|
-
navigation/
|
|
19
|
-
screens/
|
|
20
|
-
feature-flags/
|
|
21
|
-
features/
|
|
22
|
-
checkout/
|
|
23
|
-
ui/
|
|
24
|
-
service/
|
|
25
|
-
repository/
|
|
26
|
-
contracts/
|
|
27
|
-
tests/
|
|
28
|
-
index.ts
|
|
29
|
-
account/
|
|
30
|
-
ui/
|
|
31
|
-
service/
|
|
32
|
-
repository/
|
|
33
|
-
contracts/
|
|
34
|
-
tests/
|
|
35
|
-
index.ts
|
|
36
|
-
shared/
|
|
37
|
-
design-tokens/
|
|
38
|
-
telemetry/
|
|
39
|
-
error-boundaries/
|
|
40
|
-
accessibility/
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## State and Data Rules
|
|
44
|
-
|
|
45
|
-
- Keep transient UI state local to the screen component.
|
|
46
|
-
- Keep feature workflow state in service-level orchestrators.
|
|
47
|
-
- Keep remote and local synchronization logic in repository adapters.
|
|
48
|
-
- Enforce idempotent retry semantics for background sync and push-triggered refresh.
|
|
49
|
-
|
|
50
|
-
## Device and Platform Boundaries
|
|
51
|
-
|
|
52
|
-
- Wrap native modules behind explicit interfaces.
|
|
53
|
-
- Keep iOS/Android-specific behavior in adapter files, not in feature UI components.
|
|
54
|
-
- Centralize permission checks for camera, location, notifications, and storage.
|
|
55
|
-
- Define fallback behavior for denied permissions before QA sign-off.
|
|
56
|
-
|
|
57
|
-
## Offline and Failure Handling
|
|
58
|
-
|
|
59
|
-
- Define offline-first behavior per feature (read-only, queued writes, or blocked operations).
|
|
60
|
-
- Persist pending mutations with retry metadata.
|
|
61
|
-
- Show explicit user-facing recovery actions for network and permission failures.
|
|
62
|
-
- Log mobile crash context with feature name, operation, and user impact summary.
|
|
63
|
-
|
|
64
|
-
## Testing Baseline
|
|
65
|
-
|
|
66
|
-
- Unit tests: service decisions, validation, and adapter boundary behavior.
|
|
67
|
-
- Integration tests: repository sync logic with mocked device/network behavior.
|
|
68
|
-
- End-to-end tests: critical journeys (login, primary conversion flow, error recovery path).
|
|
69
|
-
- Accessibility checks: screen reader labels, focus order, and reduced-motion behavior.
|
|
70
|
-
|
|
71
|
-
## Release Governance
|
|
72
|
-
|
|
73
|
-
Before shipping each mobile release candidate:
|
|
74
|
-
|
|
75
|
-
- Verify signing and packaging pipeline integrity.
|
|
76
|
-
- Verify crash-free session and startup stability thresholds.
|
|
77
|
-
- Verify telemetry/analytics payload schema compatibility.
|
|
78
|
-
- Verify rollback strategy for binary release and remote config toggles.
|
|
79
|
-
|
|
80
|
-
## Recommended Stack Pairings
|
|
81
|
-
|
|
82
|
-
- React Native for teams that want JavaScript or TypeScript alignment and shared web hiring pool.
|
|
83
|
-
- Flutter for teams that want consistent rendering across platforms and widget-driven architecture.
|
|
84
|
-
|
|
85
|
-
## Blueprint Checklist
|
|
86
|
-
|
|
87
|
-
- [ ] Feature boundaries are modular and explicit.
|
|
88
|
-
- [ ] Device adapters are isolated from UI rendering code.
|
|
89
|
-
- [ ] Offline and permission failure behavior is documented.
|
|
90
|
-
- [ ] Critical mobile journeys are covered by automated tests.
|
|
91
|
-
- [ ] Release package and telemetry gates are enforced before ship.
|