@planu/cli 0.96.5 → 0.97.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/dist/cli/commands/install.d.ts.map +1 -1
- package/dist/cli/commands/install.js +3 -1
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/config/compliance-profiles.json +62 -0
- package/dist/config/license-plans.json +18 -2
- package/dist/config/spec-templates/crud-rest-api/spec.md +35 -0
- package/dist/config/spec-templates/crud-rest-api/template.json +10 -0
- package/dist/config/spec-templates/email-notifications/spec.md +31 -0
- package/dist/config/spec-templates/email-notifications/template.json +10 -0
- package/dist/config/spec-templates/file-upload-s3/spec.md +31 -0
- package/dist/config/spec-templates/file-upload-s3/template.json +11 -0
- package/dist/config/spec-templates/jwt-auth/spec.md +35 -0
- package/dist/config/spec-templates/jwt-auth/template.json +10 -0
- package/dist/config/spec-templates/oauth-social-login/spec.md +31 -0
- package/dist/config/spec-templates/oauth-social-login/template.json +10 -0
- package/dist/config/spec-templates/rate-limiting/spec.md +31 -0
- package/dist/config/spec-templates/rate-limiting/template.json +10 -0
- package/dist/config/spec-templates/stripe-payments/spec.md +32 -0
- package/dist/config/spec-templates/stripe-payments/template.json +10 -0
- package/dist/config/spec-templates/webhook-system/spec.md +36 -0
- package/dist/config/spec-templates/webhook-system/template.json +10 -0
- package/dist/engine/agent-ready-exporter/formatters/devin.d.ts +7 -0
- package/dist/engine/agent-ready-exporter/formatters/devin.d.ts.map +1 -0
- package/dist/engine/agent-ready-exporter/formatters/devin.js +23 -0
- package/dist/engine/agent-ready-exporter/formatters/devin.js.map +1 -0
- package/dist/engine/agent-ready-exporter/formatters/generic.d.ts +7 -0
- package/dist/engine/agent-ready-exporter/formatters/generic.d.ts.map +1 -0
- package/dist/engine/agent-ready-exporter/formatters/generic.js +9 -0
- package/dist/engine/agent-ready-exporter/formatters/generic.js.map +1 -0
- package/dist/engine/agent-ready-exporter/formatters/kiro.d.ts +6 -0
- package/dist/engine/agent-ready-exporter/formatters/kiro.d.ts.map +1 -0
- package/dist/engine/agent-ready-exporter/formatters/kiro.js +34 -0
- package/dist/engine/agent-ready-exporter/formatters/kiro.js.map +1 -0
- package/dist/engine/agent-ready-exporter/formatters/swe-agent.d.ts +6 -0
- package/dist/engine/agent-ready-exporter/formatters/swe-agent.d.ts.map +1 -0
- package/dist/engine/agent-ready-exporter/formatters/swe-agent.js +40 -0
- package/dist/engine/agent-ready-exporter/formatters/swe-agent.js.map +1 -0
- package/dist/engine/agent-ready-exporter.d.ts +11 -0
- package/dist/engine/agent-ready-exporter.d.ts.map +1 -0
- package/dist/engine/agent-ready-exporter.js +86 -0
- package/dist/engine/agent-ready-exporter.js.map +1 -0
- package/dist/engine/compliance-checker.d.ts +19 -0
- package/dist/engine/compliance-checker.d.ts.map +1 -0
- package/dist/engine/compliance-checker.js +145 -0
- package/dist/engine/compliance-checker.js.map +1 -0
- package/dist/engine/generate-tests/generators/property-based-generator.d.ts +12 -0
- package/dist/engine/generate-tests/generators/property-based-generator.d.ts.map +1 -0
- package/dist/engine/generate-tests/generators/property-based-generator.js +159 -0
- package/dist/engine/generate-tests/generators/property-based-generator.js.map +1 -0
- package/dist/engine/jira-exporter.d.ts +39 -0
- package/dist/engine/jira-exporter.d.ts.map +1 -0
- package/dist/engine/jira-exporter.js +190 -0
- package/dist/engine/jira-exporter.js.map +1 -0
- package/dist/engine/linear-exporter.d.ts +32 -0
- package/dist/engine/linear-exporter.d.ts.map +1 -0
- package/dist/engine/linear-exporter.js +184 -0
- package/dist/engine/linear-exporter.js.map +1 -0
- package/dist/engine/property-test-generator.d.ts +14 -0
- package/dist/engine/property-test-generator.d.ts.map +1 -0
- package/dist/engine/property-test-generator.js +223 -0
- package/dist/engine/property-test-generator.js.map +1 -0
- package/dist/engine/skill-evaluator.d.ts +21 -0
- package/dist/engine/skill-evaluator.d.ts.map +1 -0
- package/dist/engine/skill-evaluator.js +126 -0
- package/dist/engine/skill-evaluator.js.map +1 -0
- package/dist/engine/spec-quality-scorer.d.ts +4 -0
- package/dist/engine/spec-quality-scorer.d.ts.map +1 -0
- package/dist/engine/spec-quality-scorer.js +334 -0
- package/dist/engine/spec-quality-scorer.js.map +1 -0
- package/dist/engine/spec-template-engine.d.ts +26 -0
- package/dist/engine/spec-template-engine.d.ts.map +1 -0
- package/dist/engine/spec-template-engine.js +127 -0
- package/dist/engine/spec-template-engine.js.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/storage/compliance-store.d.ts +11 -0
- package/dist/storage/compliance-store.d.ts.map +1 -0
- package/dist/storage/compliance-store.js +30 -0
- package/dist/storage/compliance-store.js.map +1 -0
- package/dist/storage/jira-store.d.ts +30 -0
- package/dist/storage/jira-store.d.ts.map +1 -0
- package/dist/storage/jira-store.js +84 -0
- package/dist/storage/jira-store.js.map +1 -0
- package/dist/storage/linear-store.d.ts +30 -0
- package/dist/storage/linear-store.d.ts.map +1 -0
- package/dist/storage/linear-store.js +84 -0
- package/dist/storage/linear-store.js.map +1 -0
- package/dist/tools/check-readiness.d.ts.map +1 -1
- package/dist/tools/check-readiness.js +8 -2
- package/dist/tools/check-readiness.js.map +1 -1
- package/dist/tools/compliance-handler.d.ts +6 -0
- package/dist/tools/compliance-handler.d.ts.map +1 -0
- package/dist/tools/compliance-handler.js +99 -0
- package/dist/tools/compliance-handler.js.map +1 -0
- package/dist/tools/eval-skill-handler.d.ts +4 -0
- package/dist/tools/eval-skill-handler.d.ts.map +1 -0
- package/dist/tools/eval-skill-handler.js +26 -0
- package/dist/tools/eval-skill-handler.js.map +1 -0
- package/dist/tools/export-spec.d.ts.map +1 -1
- package/dist/tools/export-spec.js +42 -1
- package/dist/tools/export-spec.js.map +1 -1
- package/dist/tools/generate-tests/generators/property-based-generator.d.ts +11 -0
- package/dist/tools/generate-tests/generators/property-based-generator.d.ts.map +1 -0
- package/dist/tools/generate-tests/generators/property-based-generator.js +27 -0
- package/dist/tools/generate-tests/generators/property-based-generator.js.map +1 -0
- package/dist/tools/generate-tests/spec-dispatcher.d.ts +5 -0
- package/dist/tools/generate-tests/spec-dispatcher.d.ts.map +1 -1
- package/dist/tools/generate-tests/spec-dispatcher.js +18 -1
- package/dist/tools/generate-tests/spec-dispatcher.js.map +1 -1
- package/dist/tools/jira-sync-handler.d.ts +6 -0
- package/dist/tools/jira-sync-handler.d.ts.map +1 -0
- package/dist/tools/jira-sync-handler.js +220 -0
- package/dist/tools/jira-sync-handler.js.map +1 -0
- package/dist/tools/linear-sync-handler.d.ts +6 -0
- package/dist/tools/linear-sync-handler.d.ts.map +1 -0
- package/dist/tools/linear-sync-handler.js +212 -0
- package/dist/tools/linear-sync-handler.js.map +1 -0
- package/dist/tools/register-export-tools.d.ts.map +1 -1
- package/dist/tools/register-export-tools.js +10 -3
- package/dist/tools/register-export-tools.js.map +1 -1
- package/dist/tools/register-spec-314.d.ts +3 -0
- package/dist/tools/register-spec-314.d.ts.map +1 -0
- package/dist/tools/register-spec-314.js +38 -0
- package/dist/tools/register-spec-314.js.map +1 -0
- package/dist/tools/register-spec-316.d.ts +3 -0
- package/dist/tools/register-spec-316.d.ts.map +1 -0
- package/dist/tools/register-spec-316.js +71 -0
- package/dist/tools/register-spec-316.js.map +1 -0
- package/dist/tools/register-spec-317.d.ts +3 -0
- package/dist/tools/register-spec-317.d.ts.map +1 -0
- package/dist/tools/register-spec-317.js +158 -0
- package/dist/tools/register-spec-317.js.map +1 -0
- package/dist/tools/register-spec-319.d.ts +3 -0
- package/dist/tools/register-spec-319.d.ts.map +1 -0
- package/dist/tools/register-spec-319.js +59 -0
- package/dist/tools/register-spec-319.js.map +1 -0
- package/dist/tools/register-spec-320.d.ts +3 -0
- package/dist/tools/register-spec-320.d.ts.map +1 -0
- package/dist/tools/register-spec-320.js +60 -0
- package/dist/tools/register-spec-320.js.map +1 -0
- package/dist/tools/spec-marketplace-handler.d.ts +6 -0
- package/dist/tools/spec-marketplace-handler.d.ts.map +1 -0
- package/dist/tools/spec-marketplace-handler.js +113 -0
- package/dist/tools/spec-marketplace-handler.js.map +1 -0
- package/dist/tools/spec-quality-score-handler.d.ts +7 -0
- package/dist/tools/spec-quality-score-handler.d.ts.map +1 -0
- package/dist/tools/spec-quality-score-handler.js +106 -0
- package/dist/tools/spec-quality-score-handler.js.map +1 -0
- package/dist/types/agent-ready.d.ts +58 -0
- package/dist/types/agent-ready.d.ts.map +1 -0
- package/dist/types/agent-ready.js +3 -0
- package/dist/types/agent-ready.js.map +1 -0
- package/dist/types/compliance.d.ts +44 -0
- package/dist/types/compliance.d.ts.map +1 -0
- package/dist/types/compliance.js +3 -0
- package/dist/types/compliance.js.map +1 -0
- package/dist/types/export.d.ts +5 -1
- package/dist/types/export.d.ts.map +1 -1
- package/dist/types/export.js +1 -1
- package/dist/types/export.js.map +1 -1
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/jira-linear.d.ts +216 -0
- package/dist/types/jira-linear.d.ts.map +1 -0
- package/dist/types/jira-linear.js +3 -0
- package/dist/types/jira-linear.js.map +1 -0
- package/dist/types/property-testing.d.ts +50 -0
- package/dist/types/property-testing.d.ts.map +1 -0
- package/dist/types/property-testing.js +3 -0
- package/dist/types/property-testing.js.map +1 -0
- package/dist/types/skill-eval.d.ts +41 -0
- package/dist/types/skill-eval.d.ts.map +1 -0
- package/dist/types/skill-eval.js +3 -0
- package/dist/types/skill-eval.js.map +1 -0
- package/dist/types/spec-marketplace.d.ts +31 -0
- package/dist/types/spec-marketplace.d.ts.map +1 -0
- package/dist/types/spec-marketplace.js +3 -0
- package/dist/types/spec-marketplace.js.map +1 -0
- package/dist/types/spec-quality.d.ts +36 -0
- package/dist/types/spec-quality.d.ts.map +1 -0
- package/dist/types/spec-quality.js +3 -0
- package/dist/types/spec-quality.js.map +1 -0
- package/package.json +7 -2
- package/src/config/compliance-profiles.json +62 -0
- package/src/config/license-plans.json +18 -2
- package/src/config/spec-templates/crud-rest-api/spec.md +35 -0
- package/src/config/spec-templates/crud-rest-api/template.json +10 -0
- package/src/config/spec-templates/email-notifications/spec.md +31 -0
- package/src/config/spec-templates/email-notifications/template.json +10 -0
- package/src/config/spec-templates/file-upload-s3/spec.md +31 -0
- package/src/config/spec-templates/file-upload-s3/template.json +11 -0
- package/src/config/spec-templates/jwt-auth/spec.md +35 -0
- package/src/config/spec-templates/jwt-auth/template.json +10 -0
- package/src/config/spec-templates/oauth-social-login/spec.md +31 -0
- package/src/config/spec-templates/oauth-social-login/template.json +10 -0
- package/src/config/spec-templates/rate-limiting/spec.md +31 -0
- package/src/config/spec-templates/rate-limiting/template.json +10 -0
- package/src/config/spec-templates/stripe-payments/spec.md +32 -0
- package/src/config/spec-templates/stripe-payments/template.json +10 -0
- package/src/config/spec-templates/webhook-system/spec.md +36 -0
- package/src/config/spec-templates/webhook-system/template.json +10 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Email Notifications — {{provider}}
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
Transactional email system using {{provider}} sent from `{{from_address}}`, with template rendering, {{queue_enabled}} async queuing, and delivery tracking.
|
|
5
|
+
|
|
6
|
+
## Acceptance Criteria
|
|
7
|
+
|
|
8
|
+
### AC-1: Template Rendering
|
|
9
|
+
- Define email templates with subject and HTML/text body variants
|
|
10
|
+
- Interpolate dynamic variables (e.g. `{{user_name}}`, `{{action_url}}`) at send time
|
|
11
|
+
- Validate all required variables are provided before queuing
|
|
12
|
+
|
|
13
|
+
### AC-2: Sending via {{provider}}
|
|
14
|
+
- Send emails via {{provider}} API using environment-configured credentials
|
|
15
|
+
- Set `From: {{from_address}}` on all outgoing emails
|
|
16
|
+
- Handle API errors with retry logic (3 attempts, exponential backoff)
|
|
17
|
+
|
|
18
|
+
### AC-3: Async Queue
|
|
19
|
+
- When `queue_enabled` is {{queue_enabled}}, enqueue emails instead of sending synchronously
|
|
20
|
+
- Worker processes the queue and marks emails as `sent` or `failed`
|
|
21
|
+
- Retry failed sends up to 3 times before marking as permanently failed
|
|
22
|
+
|
|
23
|
+
### AC-4: Delivery Tracking
|
|
24
|
+
- Store delivery records: recipient, template, status, sentAt, provider message ID
|
|
25
|
+
- Expose delivery status via an internal admin API
|
|
26
|
+
- Alert when failure rate exceeds 5% in a 1-hour window
|
|
27
|
+
|
|
28
|
+
## Technical Notes
|
|
29
|
+
- Never log email body content — only metadata (recipient, template name, status)
|
|
30
|
+
- Implement unsubscribe links and honor opt-out preferences
|
|
31
|
+
- Test with {{provider}} sandbox/test mode before production deployment
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "email-notifications",
|
|
3
|
+
"description": "Transactional email system with templates, queuing, and delivery tracking",
|
|
4
|
+
"variables": [
|
|
5
|
+
{ "name": "provider", "description": "Email provider (sendgrid, mailgun, ses, resend)", "default": "sendgrid" },
|
|
6
|
+
{ "name": "from_address", "description": "Default sender email address", "default": "noreply@example.com" },
|
|
7
|
+
{ "name": "queue_enabled", "description": "Whether to queue emails asynchronously (true/false)", "default": "true" }
|
|
8
|
+
],
|
|
9
|
+
"tags": ["email", "notifications", "backend", "queuing"]
|
|
10
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# File Upload — {{provider}}
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
Secure file upload system using {{provider}} bucket `{{bucket_name}}` with presigned URLs, a maximum file size of {{max_size_mb}} MB, and allowed types: {{allowed_types}}.
|
|
5
|
+
|
|
6
|
+
## Acceptance Criteria
|
|
7
|
+
|
|
8
|
+
### AC-1: Presigned URL Generation
|
|
9
|
+
- Generate a presigned upload URL valid for 15 minutes
|
|
10
|
+
- URL is scoped to the authenticated user's namespace
|
|
11
|
+
- Enforce `Content-Type` matching one of: {{allowed_types}}
|
|
12
|
+
|
|
13
|
+
### AC-2: File Validation
|
|
14
|
+
- Reject uploads exceeding {{max_size_mb}} MB with a clear error
|
|
15
|
+
- Validate MIME type against the Content-Type header
|
|
16
|
+
- Scan file content for malicious patterns before confirming upload
|
|
17
|
+
|
|
18
|
+
### AC-3: Upload Confirmation
|
|
19
|
+
- Client calls confirm endpoint after direct upload to {{provider}}
|
|
20
|
+
- Server verifies the object exists in `{{bucket_name}}` before saving metadata
|
|
21
|
+
- Store file metadata (name, size, type, owner, uploadedAt) in the database
|
|
22
|
+
|
|
23
|
+
### AC-4: Download and Deletion
|
|
24
|
+
- Generate presigned download URLs valid for 1 hour
|
|
25
|
+
- Delete the object from `{{bucket_name}}` and metadata on user request
|
|
26
|
+
- Restrict access so users can only download/delete their own files
|
|
27
|
+
|
|
28
|
+
## Technical Notes
|
|
29
|
+
- Never expose {{provider}} credentials to the client
|
|
30
|
+
- Use server-side encryption at rest in `{{bucket_name}}`
|
|
31
|
+
- Log all upload attempts (success and failure) with user ID and file metadata
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "file-upload-s3",
|
|
3
|
+
"description": "File upload system with cloud storage, presigned URLs, and file validation",
|
|
4
|
+
"variables": [
|
|
5
|
+
{ "name": "provider", "description": "Cloud storage provider (s3, gcs, r2)", "default": "s3" },
|
|
6
|
+
{ "name": "bucket_name", "description": "Name of the storage bucket", "default": "uploads" },
|
|
7
|
+
{ "name": "max_size_mb", "description": "Maximum allowed file size in megabytes", "default": "10" },
|
|
8
|
+
{ "name": "allowed_types", "description": "Comma-separated list of allowed MIME types", "default": "image/jpeg,image/png,application/pdf" }
|
|
9
|
+
],
|
|
10
|
+
"tags": ["file-upload", "s3", "storage", "backend"]
|
|
11
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# JWT Authentication
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
JWT-based authentication with {{algorithm}} signing, access tokens valid for {{access_token_ttl}}, refresh tokens valid for {{refresh_token_ttl}}, and token rotation on refresh.
|
|
5
|
+
|
|
6
|
+
## Acceptance Criteria
|
|
7
|
+
|
|
8
|
+
### AC-1: Login
|
|
9
|
+
- Accept `email` and `password` credentials
|
|
10
|
+
- Issue a signed access token ({{algorithm}}, TTL {{access_token_ttl}}) and refresh token (TTL {{refresh_token_ttl}})
|
|
11
|
+
- Return tokens in the response body; set refresh token as `HttpOnly` cookie
|
|
12
|
+
|
|
13
|
+
### AC-2: Token Verification
|
|
14
|
+
- Validate signature, expiry, and issuer on every protected route
|
|
15
|
+
- Return 401 with a clear message when token is expired or invalid
|
|
16
|
+
- Extract user claims (id, role, email) from token without a database lookup
|
|
17
|
+
|
|
18
|
+
### AC-3: Token Refresh
|
|
19
|
+
- Accept refresh token from `HttpOnly` cookie
|
|
20
|
+
- Issue new access and refresh tokens (rotation)
|
|
21
|
+
- Blacklist the previous refresh token to prevent reuse
|
|
22
|
+
|
|
23
|
+
### AC-4: Logout
|
|
24
|
+
- Blacklist the current refresh token on logout
|
|
25
|
+
- Clear the `HttpOnly` cookie
|
|
26
|
+
- Return 204 on success
|
|
27
|
+
|
|
28
|
+
### AC-5: Token Blacklist
|
|
29
|
+
- Store blacklisted token JTIs in a fast store (Redis recommended)
|
|
30
|
+
- Entries expire automatically at token TTL to prevent unbounded growth
|
|
31
|
+
|
|
32
|
+
## Technical Notes
|
|
33
|
+
- Never store the raw JWT secret in application code — use environment variables
|
|
34
|
+
- Include `jti` (JWT ID) claim for blacklist lookups
|
|
35
|
+
- Rotate signing keys on a quarterly schedule
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jwt-auth",
|
|
3
|
+
"description": "JWT authentication with access/refresh token rotation, blacklisting, and role-based claims",
|
|
4
|
+
"variables": [
|
|
5
|
+
{ "name": "access_token_ttl", "description": "Access token time-to-live (e.g. 15m, 1h)", "default": "15m" },
|
|
6
|
+
{ "name": "refresh_token_ttl", "description": "Refresh token time-to-live (e.g. 7d, 30d)", "default": "7d" },
|
|
7
|
+
{ "name": "algorithm", "description": "JWT signing algorithm (HS256, RS256)", "default": "HS256" }
|
|
8
|
+
],
|
|
9
|
+
"tags": ["auth", "jwt", "security", "backend"]
|
|
10
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# OAuth2 Social Login — {{provider}}
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
Implement OAuth2 social login via {{provider}} with secure token handling and session management lasting {{session_duration}} seconds.
|
|
5
|
+
|
|
6
|
+
## Acceptance Criteria
|
|
7
|
+
|
|
8
|
+
### AC-1: OAuth Authorization Flow
|
|
9
|
+
- Redirect users to {{provider}} authorization endpoint with correct scopes
|
|
10
|
+
- Handle the callback at {{callback_path}} and exchange code for tokens
|
|
11
|
+
- Validate the `state` parameter to prevent CSRF attacks
|
|
12
|
+
|
|
13
|
+
### AC-2: User Account Linking
|
|
14
|
+
- Create a new user account if the OAuth identity does not exist
|
|
15
|
+
- Link the OAuth identity to an existing account if the email matches
|
|
16
|
+
- Store the provider, provider user ID, and access token securely
|
|
17
|
+
|
|
18
|
+
### AC-3: Session Management
|
|
19
|
+
- Issue a signed session token valid for {{session_duration}} seconds after successful login
|
|
20
|
+
- Invalidate session on explicit logout
|
|
21
|
+
- Refresh session silently when less than 10% of lifetime remains
|
|
22
|
+
|
|
23
|
+
### AC-4: Error Handling
|
|
24
|
+
- Return clear errors when the user denies authorization
|
|
25
|
+
- Handle provider API outages with a user-friendly fallback message
|
|
26
|
+
- Log all authentication failures with anonymized user identifiers
|
|
27
|
+
|
|
28
|
+
## Technical Notes
|
|
29
|
+
- Never store OAuth access tokens in client-accessible cookies
|
|
30
|
+
- Use PKCE (Proof Key for Code Exchange) when supported by the provider
|
|
31
|
+
- Implement rate limiting on the callback endpoint to prevent abuse
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "oauth-social-login",
|
|
3
|
+
"description": "OAuth2 social login with Google and GitHub, including token handling and session management",
|
|
4
|
+
"variables": [
|
|
5
|
+
{ "name": "provider", "description": "OAuth provider to integrate (google, github, or both)", "default": "google" },
|
|
6
|
+
{ "name": "callback_path", "description": "OAuth callback URL path", "default": "/auth/callback" },
|
|
7
|
+
{ "name": "session_duration", "description": "Session duration in seconds", "default": "86400" }
|
|
8
|
+
],
|
|
9
|
+
"tags": ["auth", "oauth2", "social-login", "google", "github", "backend"]
|
|
10
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Rate Limiting Middleware
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
Sliding window rate limiting middleware with a limit of {{requests_per_window}} requests per {{window_seconds}} seconds, applied per {{strategy}}.
|
|
5
|
+
|
|
6
|
+
## Acceptance Criteria
|
|
7
|
+
|
|
8
|
+
### AC-1: Sliding Window Enforcement
|
|
9
|
+
- Track request counts in a {{window_seconds}}-second sliding window per {{strategy}}
|
|
10
|
+
- Block requests exceeding {{requests_per_window}} with HTTP 429
|
|
11
|
+
- Include `Retry-After` header indicating seconds until the window resets
|
|
12
|
+
|
|
13
|
+
### AC-2: Response Headers
|
|
14
|
+
- Include `X-RateLimit-Limit: {{requests_per_window}}` on all responses
|
|
15
|
+
- Include `X-RateLimit-Remaining` with current remaining count
|
|
16
|
+
- Include `X-RateLimit-Reset` with the Unix timestamp of window expiry
|
|
17
|
+
|
|
18
|
+
### AC-3: Strategy Configuration
|
|
19
|
+
- Apply limits by {{strategy}} (ip address, authenticated user ID, or API key)
|
|
20
|
+
- Fall back to IP-based limiting for unauthenticated requests
|
|
21
|
+
- Support per-route override limits via middleware options
|
|
22
|
+
|
|
23
|
+
### AC-4: Bypass and Exemptions
|
|
24
|
+
- Allow exemption list for internal service IPs
|
|
25
|
+
- Support admin-level bypass via a trusted header `X-Internal-Request: true`
|
|
26
|
+
- Log all exemptions for audit purposes
|
|
27
|
+
|
|
28
|
+
## Technical Notes
|
|
29
|
+
- Use atomic Redis operations (INCR + EXPIRE) to avoid race conditions
|
|
30
|
+
- Store counters in Redis with TTL equal to the window duration
|
|
31
|
+
- Degrade gracefully to allow-all if Redis is unavailable (fail open with alert)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "rate-limiting",
|
|
3
|
+
"description": "Rate limiting middleware with sliding window algorithm, per-user and per-IP limits",
|
|
4
|
+
"variables": [
|
|
5
|
+
{ "name": "requests_per_window", "description": "Maximum requests allowed per window", "default": "100" },
|
|
6
|
+
{ "name": "window_seconds", "description": "Time window in seconds", "default": "60" },
|
|
7
|
+
{ "name": "strategy", "description": "Rate limiting strategy (ip, user, api-key)", "default": "ip" }
|
|
8
|
+
],
|
|
9
|
+
"tags": ["rate-limiting", "middleware", "security", "backend"]
|
|
10
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Stripe Payments Integration
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
Integrate Stripe payment processing to support one-time payments and subscriptions for {{plan_name}} in {{currency}} currency.
|
|
5
|
+
|
|
6
|
+
## Acceptance Criteria
|
|
7
|
+
|
|
8
|
+
### AC-1: Checkout Session Creation
|
|
9
|
+
- Create a Stripe checkout session for {{plan_name}} with currency {{currency}}
|
|
10
|
+
- Return a redirect URL to the hosted Stripe payment page
|
|
11
|
+
- Store the session ID for reconciliation
|
|
12
|
+
|
|
13
|
+
### AC-2: Webhook Processing
|
|
14
|
+
- Handle incoming Stripe events at {{webhook_endpoint}}
|
|
15
|
+
- Verify HMAC signature using `Stripe-Signature` header
|
|
16
|
+
- Process `checkout.session.completed` and `invoice.payment_failed` events
|
|
17
|
+
- Idempotently handle duplicate webhook deliveries
|
|
18
|
+
|
|
19
|
+
### AC-3: Subscription Management
|
|
20
|
+
- Retrieve subscription status from Stripe API
|
|
21
|
+
- Cancel subscriptions on user request
|
|
22
|
+
- Expose subscription status in user profile response
|
|
23
|
+
|
|
24
|
+
### AC-4: Error Handling
|
|
25
|
+
- Return user-friendly errors when payment fails
|
|
26
|
+
- Log Stripe API errors with request IDs for debugging
|
|
27
|
+
- Handle network timeouts with retry logic (max 3 attempts)
|
|
28
|
+
|
|
29
|
+
## Technical Notes
|
|
30
|
+
- Store Stripe customer IDs and subscription IDs in the database, never card data
|
|
31
|
+
- All prices defined in cents to avoid floating-point errors
|
|
32
|
+
- Use Stripe's idempotency keys for all write operations
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "stripe-payments",
|
|
3
|
+
"description": "Stripe payment integration with checkout sessions, webhooks, and subscription management",
|
|
4
|
+
"variables": [
|
|
5
|
+
{ "name": "currency", "description": "Default currency code (e.g. usd, eur)", "default": "usd" },
|
|
6
|
+
{ "name": "plan_name", "description": "Name of the subscription plan or product", "default": "Pro Plan" },
|
|
7
|
+
{ "name": "webhook_endpoint", "description": "Path for the Stripe webhook endpoint", "default": "/api/webhooks/stripe" }
|
|
8
|
+
],
|
|
9
|
+
"tags": ["payments", "stripe", "subscriptions", "backend"]
|
|
10
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Webhook System
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
Webhook delivery system with event subscriptions, HMAC signature verification via `{{signature_header}}`, retry logic (max {{max_retries}} attempts), and {{timeout_seconds}}s per request timeout.
|
|
5
|
+
|
|
6
|
+
## Acceptance Criteria
|
|
7
|
+
|
|
8
|
+
### AC-1: Subscription Management
|
|
9
|
+
- Allow consumers to register webhook endpoints with target URL and event types
|
|
10
|
+
- Validate that the target URL is reachable via a test ping on registration
|
|
11
|
+
- Store subscriptions with status (active, paused, failed)
|
|
12
|
+
|
|
13
|
+
### AC-2: Event Delivery
|
|
14
|
+
- Deliver event payloads via HTTP POST to registered endpoints
|
|
15
|
+
- Include `{{signature_header}}` HMAC-SHA256 signature in each request
|
|
16
|
+
- Set request timeout to {{timeout_seconds}} seconds per attempt
|
|
17
|
+
|
|
18
|
+
### AC-3: Retry Logic
|
|
19
|
+
- Retry failed deliveries up to {{max_retries}} times
|
|
20
|
+
- Use exponential backoff: 1min, 5min, 30min between retries
|
|
21
|
+
- Mark subscription as `failed` after exhausting all retries
|
|
22
|
+
|
|
23
|
+
### AC-4: Signature Verification (Consumer Guide)
|
|
24
|
+
- Compute HMAC-SHA256 of the raw request body using the shared secret
|
|
25
|
+
- Compare computed signature with the value in `{{signature_header}}`
|
|
26
|
+
- Reject requests with invalid or missing signatures
|
|
27
|
+
|
|
28
|
+
### AC-5: Delivery Log
|
|
29
|
+
- Store delivery attempts: endpoint, event type, response code, latency, attempt number
|
|
30
|
+
- Expose delivery history per subscription via admin API
|
|
31
|
+
- Purge logs older than 30 days automatically
|
|
32
|
+
|
|
33
|
+
## Technical Notes
|
|
34
|
+
- Use a unique shared secret per subscription — never reuse across consumers
|
|
35
|
+
- Process delivery queue asynchronously to avoid blocking event producers
|
|
36
|
+
- Validate registered URLs against an allowlist to prevent SSRF attacks
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "webhook-system",
|
|
3
|
+
"description": "Webhook system with event subscriptions, HMAC signature verification, and retry logic",
|
|
4
|
+
"variables": [
|
|
5
|
+
{ "name": "max_retries", "description": "Maximum delivery retry attempts", "default": "3" },
|
|
6
|
+
{ "name": "timeout_seconds", "description": "HTTP request timeout per delivery attempt", "default": "10" },
|
|
7
|
+
{ "name": "signature_header", "description": "HTTP header name for HMAC signature", "default": "X-Webhook-Signature" }
|
|
8
|
+
],
|
|
9
|
+
"tags": ["webhooks", "events", "backend", "integrations"]
|
|
10
|
+
}
|