@jaypie/mcp 0.3.2 → 0.4.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/createMcpServer.d.ts +7 -1
- package/dist/index.js +26 -3135
- package/dist/index.js.map +1 -1
- package/dist/suite.d.ts +1 -0
- package/dist/suite.js +2442 -0
- package/dist/suite.js.map +1 -0
- package/package.json +8 -3
- package/release-notes/constructs/1.2.17.md +11 -0
- package/release-notes/fabric/0.1.2.md +11 -0
- package/release-notes/fabric/0.1.3.md +25 -0
- package/release-notes/fabric/0.1.4.md +42 -0
- package/release-notes/mcp/0.3.3.md +12 -0
- package/release-notes/mcp/0.3.4.md +36 -0
- package/release-notes/mcp/0.4.0.md +27 -0
- package/release-notes/testkit/1.2.15.md +23 -0
- package/skills/agents.md +25 -0
- package/skills/aws.md +107 -0
- package/skills/cdk.md +141 -0
- package/skills/cicd.md +152 -0
- package/skills/datadog.md +129 -0
- package/skills/debugging.md +148 -0
- package/skills/dns.md +134 -0
- package/skills/dynamodb.md +140 -0
- package/skills/errors.md +142 -0
- package/skills/fabric.md +191 -0
- package/skills/index.md +7 -0
- package/skills/jaypie.md +100 -0
- package/skills/legacy.md +97 -0
- package/skills/logs.md +160 -0
- package/skills/mocks.md +174 -0
- package/skills/models.md +195 -0
- package/skills/releasenotes.md +94 -0
- package/skills/secrets.md +155 -0
- package/skills/services.md +175 -0
- package/skills/style.md +190 -0
- package/skills/tests.md +209 -0
- package/skills/tools.md +127 -0
- package/skills/topics.md +116 -0
- package/skills/variables.md +146 -0
- package/skills/writing.md +153 -0
- package/prompts/Branch_Management.md +0 -34
- package/prompts/Development_Process.md +0 -89
- package/prompts/Jaypie_Agent_Rules.md +0 -110
- package/prompts/Jaypie_Auth0_Express_Mongoose.md +0 -736
- package/prompts/Jaypie_Browser_and_Frontend_Web_Packages.md +0 -18
- package/prompts/Jaypie_CDK_Constructs_and_Patterns.md +0 -430
- package/prompts/Jaypie_CICD_with_GitHub_Actions.md +0 -371
- package/prompts/Jaypie_Commander_CLI_Package.md +0 -166
- package/prompts/Jaypie_Core_Errors_and_Logging.md +0 -39
- package/prompts/Jaypie_DynamoDB_Package.md +0 -774
- package/prompts/Jaypie_Eslint_NPM_Package.md +0 -78
- package/prompts/Jaypie_Express_Package.md +0 -630
- package/prompts/Jaypie_Fabric_Commander.md +0 -411
- package/prompts/Jaypie_Fabric_LLM.md +0 -312
- package/prompts/Jaypie_Fabric_Lambda.md +0 -308
- package/prompts/Jaypie_Fabric_MCP.md +0 -316
- package/prompts/Jaypie_Fabric_Package.md +0 -513
- package/prompts/Jaypie_Fabricator.md +0 -617
- package/prompts/Jaypie_Ideal_Project_Structure.md +0 -78
- package/prompts/Jaypie_Init_CICD_with_GitHub_Actions.md +0 -1186
- package/prompts/Jaypie_Init_Express_on_Lambda.md +0 -115
- package/prompts/Jaypie_Init_Jaypie_CDK_Package.md +0 -35
- package/prompts/Jaypie_Init_Lambda_Package.md +0 -505
- package/prompts/Jaypie_Init_Monorepo_Project.md +0 -44
- package/prompts/Jaypie_Init_Project_Subpackage.md +0 -65
- package/prompts/Jaypie_Legacy_Patterns.md +0 -15
- package/prompts/Jaypie_Llm_Calls.md +0 -449
- package/prompts/Jaypie_Llm_Tools.md +0 -155
- package/prompts/Jaypie_MCP_Package.md +0 -281
- package/prompts/Jaypie_Mocks_and_Testkit.md +0 -137
- package/prompts/Jaypie_Repokit.md +0 -103
- package/prompts/Jaypie_Scrub.md +0 -177
- package/prompts/Jaypie_Streaming.md +0 -467
- package/prompts/Templates_CDK_Subpackage.md +0 -115
- package/prompts/Templates_Express_Subpackage.md +0 -187
- package/prompts/Templates_Project_Monorepo.md +0 -326
- package/prompts/Templates_Project_Subpackage.md +0 -93
- package/prompts/Write_Efficient_Prompt_Guides.md +0 -48
- package/prompts/Write_and_Maintain_Engaging_Readme.md +0 -67
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Environment variables reference
|
|
3
|
+
related: secrets, cdk, datadog
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Environment Variables
|
|
7
|
+
|
|
8
|
+
Configuration variables used in Jaypie applications.
|
|
9
|
+
|
|
10
|
+
## Project Variables
|
|
11
|
+
|
|
12
|
+
| Variable | Description | Values |
|
|
13
|
+
|----------|-------------|--------|
|
|
14
|
+
| `PROJECT_ENV` | Environment identifier | local, sandbox, kitchen, lab, studio, production |
|
|
15
|
+
| `PROJECT_KEY` | Project name for logging | e.g., my-api |
|
|
16
|
+
| `PROJECT_NONCE` | Unique resource suffix | e.g., dev, staging, prod |
|
|
17
|
+
| `PROJECT_CHAOS` | Chaos engineering mode | none, partial, full |
|
|
18
|
+
|
|
19
|
+
### Usage
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
const env = process.env.PROJECT_ENV || "local";
|
|
23
|
+
const key = process.env.PROJECT_KEY || "unknown";
|
|
24
|
+
|
|
25
|
+
log.info("Starting", { env, project: key });
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Node Environment
|
|
29
|
+
|
|
30
|
+
| Variable | Description | Values |
|
|
31
|
+
|----------|-------------|--------|
|
|
32
|
+
| `NODE_ENV` | Node.js environment | development, production, test |
|
|
33
|
+
| `LOG_LEVEL` | Logging verbosity | trace, debug, info, warn, error |
|
|
34
|
+
|
|
35
|
+
### Log Level in Development
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Very verbose
|
|
39
|
+
LOG_LEVEL=trace npm run dev
|
|
40
|
+
|
|
41
|
+
# Normal debugging
|
|
42
|
+
LOG_LEVEL=debug npm run dev
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## CDK Infrastructure Variables
|
|
46
|
+
|
|
47
|
+
| Variable | Description |
|
|
48
|
+
|----------|-------------|
|
|
49
|
+
| `CDK_ENV_BUCKET` | S3 bucket name |
|
|
50
|
+
| `CDK_ENV_QUEUE_URL` | SQS queue URL |
|
|
51
|
+
| `CDK_ENV_SNS_ROLE_ARN` | SNS role ARN |
|
|
52
|
+
| `CDK_ENV_SNS_TOPIC_ARN` | SNS topic ARN |
|
|
53
|
+
| `CDK_ENV_DATADOG_API_KEY_ARN` | Datadog API key ARN |
|
|
54
|
+
| `CDK_ENV_TABLE` | DynamoDB table name |
|
|
55
|
+
|
|
56
|
+
### Passing to Lambda
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
const handler = new JaypieLambda(this, "Handler", {
|
|
60
|
+
environment: {
|
|
61
|
+
PROJECT_ENV: "production",
|
|
62
|
+
PROJECT_KEY: "my-api",
|
|
63
|
+
CDK_ENV_BUCKET: bucket.bucketName,
|
|
64
|
+
CDK_ENV_QUEUE_URL: queue.queueUrl,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Secret Variables
|
|
70
|
+
|
|
71
|
+
| Variable | Description |
|
|
72
|
+
|----------|-------------|
|
|
73
|
+
| `SECRET_MONGODB_URI` | MongoDB connection secret name |
|
|
74
|
+
| `SECRET_API_KEY` | Third-party API key secret name |
|
|
75
|
+
|
|
76
|
+
### Usage Pattern
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
// Secret name from env, value from Secrets Manager
|
|
80
|
+
const secretName = process.env.SECRET_MONGODB_URI;
|
|
81
|
+
const mongoUri = await getSecret(secretName);
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## AWS Variables
|
|
85
|
+
|
|
86
|
+
| Variable | Description |
|
|
87
|
+
|----------|-------------|
|
|
88
|
+
| `AWS_PROFILE` | Default AWS profile |
|
|
89
|
+
| `AWS_REGION` | Default AWS region |
|
|
90
|
+
| `AWS_DEFAULT_REGION` | Fallback region |
|
|
91
|
+
| `AWS_SESSION_TOKEN` | Session token (Lambda runtime) |
|
|
92
|
+
| `AWS_ACCESS_KEY_ID` | Access key (if not using profile) |
|
|
93
|
+
| `AWS_SECRET_ACCESS_KEY` | Secret key (if not using profile) |
|
|
94
|
+
|
|
95
|
+
## Datadog Variables
|
|
96
|
+
|
|
97
|
+
| Variable | Description |
|
|
98
|
+
|----------|-------------|
|
|
99
|
+
| `DATADOG_API_KEY` or `DD_API_KEY` | API key |
|
|
100
|
+
| `DATADOG_APP_KEY` or `DD_APP_KEY` | Application key |
|
|
101
|
+
| `DD_ENV` | Environment tag |
|
|
102
|
+
| `DD_SERVICE` | Service name tag |
|
|
103
|
+
| `DD_VERSION` | Version tag |
|
|
104
|
+
| `DD_SOURCE` | Log source (default: lambda) |
|
|
105
|
+
|
|
106
|
+
### Unified Service Tagging
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
environment: {
|
|
110
|
+
DD_ENV: process.env.PROJECT_ENV,
|
|
111
|
+
DD_SERVICE: process.env.PROJECT_KEY,
|
|
112
|
+
DD_VERSION: process.env.npm_package_version,
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Local Development
|
|
117
|
+
|
|
118
|
+
### .env Files
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# .env.local (not committed)
|
|
122
|
+
PROJECT_ENV=local
|
|
123
|
+
PROJECT_KEY=my-api
|
|
124
|
+
LOG_LEVEL=debug
|
|
125
|
+
MONGODB_URI=mongodb://localhost:27017/dev
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Loading .env
|
|
129
|
+
|
|
130
|
+
```typescript
|
|
131
|
+
import "dotenv/config";
|
|
132
|
+
|
|
133
|
+
// Or in package.json
|
|
134
|
+
"scripts": {
|
|
135
|
+
"dev": "dotenv -- node src/index.js"
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Environment Detection
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
const isProduction = process.env.PROJECT_ENV === "production";
|
|
143
|
+
const isLocal = process.env.PROJECT_ENV === "local";
|
|
144
|
+
const isDevelopment = !isProduction;
|
|
145
|
+
```
|
|
146
|
+
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Documentation and writing style
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Writing Style
|
|
6
|
+
|
|
7
|
+
Guidelines for writing Jaypie documentation.
|
|
8
|
+
|
|
9
|
+
## Principles
|
|
10
|
+
|
|
11
|
+
1. **Concise** - Fewer words, more clarity
|
|
12
|
+
2. **Scannable** - Use headings, lists, tables
|
|
13
|
+
3. **Actionable** - Show, don't tell
|
|
14
|
+
4. **Current** - Keep examples up to date
|
|
15
|
+
|
|
16
|
+
## Formatting
|
|
17
|
+
|
|
18
|
+
### Headings
|
|
19
|
+
|
|
20
|
+
```markdown
|
|
21
|
+
# Page Title (H1 - one per file)
|
|
22
|
+
## Major Section (H2)
|
|
23
|
+
### Subsection (H3)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Code Blocks
|
|
27
|
+
|
|
28
|
+
Always specify language:
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import { log } from "jaypie";
|
|
32
|
+
log.info("Message", { context });
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Lists
|
|
36
|
+
|
|
37
|
+
Use bullets for unordered items:
|
|
38
|
+
- First item
|
|
39
|
+
- Second item
|
|
40
|
+
|
|
41
|
+
Use numbers for sequential steps:
|
|
42
|
+
1. First step
|
|
43
|
+
2. Second step
|
|
44
|
+
|
|
45
|
+
### Tables
|
|
46
|
+
|
|
47
|
+
Use for structured comparisons:
|
|
48
|
+
|
|
49
|
+
| Option | Description |
|
|
50
|
+
|--------|-------------|
|
|
51
|
+
| `verbose` | Enable verbose logging |
|
|
52
|
+
| `timeout` | Request timeout in ms |
|
|
53
|
+
|
|
54
|
+
## Voice
|
|
55
|
+
|
|
56
|
+
- **Active voice**: "Run the command" not "The command should be run"
|
|
57
|
+
- **Present tense**: "Returns a string" not "Will return a string"
|
|
58
|
+
- **Second person**: "You can configure" not "Users can configure"
|
|
59
|
+
- **Imperative mood**: "Create a file" not "You should create a file"
|
|
60
|
+
|
|
61
|
+
## Code Examples
|
|
62
|
+
|
|
63
|
+
### Good Example
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
// Clear purpose
|
|
67
|
+
import { NotFoundError } from "jaypie";
|
|
68
|
+
|
|
69
|
+
throw new NotFoundError("User not found");
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Bad Example
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
// Avoid: no explanation, poor naming
|
|
76
|
+
import { NotFoundError } from "jaypie";
|
|
77
|
+
const e = new NotFoundError("err");
|
|
78
|
+
throw e;
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Structure
|
|
82
|
+
|
|
83
|
+
### Skill Files
|
|
84
|
+
|
|
85
|
+
```markdown
|
|
86
|
+
---
|
|
87
|
+
description: Brief description for index listing
|
|
88
|
+
related: alias1, alias2
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
# Skill Title
|
|
92
|
+
|
|
93
|
+
One sentence overview.
|
|
94
|
+
|
|
95
|
+
## Quick Start
|
|
96
|
+
|
|
97
|
+
Minimal working example.
|
|
98
|
+
|
|
99
|
+
## Details
|
|
100
|
+
|
|
101
|
+
Deeper explanation with examples.
|
|
102
|
+
|
|
103
|
+
## Reference
|
|
104
|
+
|
|
105
|
+
Tables, options, API details.
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### README Files
|
|
109
|
+
|
|
110
|
+
```markdown
|
|
111
|
+
# Package Name
|
|
112
|
+
|
|
113
|
+
One-line description.
|
|
114
|
+
|
|
115
|
+
## Installation
|
|
116
|
+
|
|
117
|
+
\`\`\`bash
|
|
118
|
+
npm install package-name
|
|
119
|
+
\`\`\`
|
|
120
|
+
|
|
121
|
+
## Usage
|
|
122
|
+
|
|
123
|
+
\`\`\`typescript
|
|
124
|
+
import { feature } from "package-name";
|
|
125
|
+
feature();
|
|
126
|
+
\`\`\`
|
|
127
|
+
|
|
128
|
+
## API
|
|
129
|
+
|
|
130
|
+
Document exports.
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
MIT
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Anti-Patterns
|
|
138
|
+
|
|
139
|
+
Avoid:
|
|
140
|
+
- Long paragraphs (use lists)
|
|
141
|
+
- Vague language ("various", "etc.")
|
|
142
|
+
- Redundant words ("in order to" → "to")
|
|
143
|
+
- Future promises ("will be added")
|
|
144
|
+
- Passive voice ("is used by" → "uses")
|
|
145
|
+
|
|
146
|
+
## Checklist
|
|
147
|
+
|
|
148
|
+
Before publishing:
|
|
149
|
+
- [ ] Code examples run without errors
|
|
150
|
+
- [ ] All links work
|
|
151
|
+
- [ ] No placeholder text
|
|
152
|
+
- [ ] Spelling and grammar checked
|
|
153
|
+
- [ ] Frontmatter complete
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Process for creating, merging branches (always read)
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Branch Management
|
|
6
|
-
|
|
7
|
-
## Naming Conventions
|
|
8
|
-
|
|
9
|
-
Name branches after the ticket or use a generic naming scheme.
|
|
10
|
-
|
|
11
|
-
### Ticket Naming
|
|
12
|
-
|
|
13
|
-
If the issue is from a ticketing system such as GitHub, Jira, or Linear, use `feat/{{ ticket }}`.
|
|
14
|
-
Jira and Linear usually include a keyword like `DEV-12`.
|
|
15
|
-
For GitHub tickets use `GITHUB-#`.
|
|
16
|
-
|
|
17
|
-
### Generic Naming
|
|
18
|
-
|
|
19
|
-
Check the first eight characters of the latest commit hash with `git -C workspace rev-parse --short=8 HEAD`
|
|
20
|
-
Create a new branch prefixed with `feat/`.
|
|
21
|
-
Make the branch name a concise two- or three-word summary of the ticket.
|
|
22
|
-
Lead with the most important word.
|
|
23
|
-
Use dashes, for example `feat/readme-update-abcd5678`.
|
|
24
|
-
|
|
25
|
-
## Development
|
|
26
|
-
|
|
27
|
-
Refer to [Development_Process.md](./Development_Process.md) for details on process, scripts, and tests expected in the development step.
|
|
28
|
-
|
|
29
|
-
## Completion
|
|
30
|
-
|
|
31
|
-
Push the completed branch.
|
|
32
|
-
Start a new pull request.
|
|
33
|
-
Describe the changes and any failing validation steps.
|
|
34
|
-
Mark it closing the issue.
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Development workflow, required reading for coding tasks (always read)
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Development Process
|
|
6
|
-
|
|
7
|
-
## Baseline Conditions
|
|
8
|
-
|
|
9
|
-
Check package.json scripts for available commands: build, format, lint, test, and typecheck.
|
|
10
|
-
Run each available script to establish baseline state.
|
|
11
|
-
Document all errors and warnings from the baseline run.
|
|
12
|
-
Do not fix baseline errors or warnings.
|
|
13
|
-
Use this baseline to identify new issues introduced by development work.
|
|
14
|
-
|
|
15
|
-
## Development
|
|
16
|
-
|
|
17
|
-
Implement the requested feature or fix.
|
|
18
|
-
Write tests to validate the work whenever possible.
|
|
19
|
-
Run tests to verify functionality (do not run lint or typecheck yet).
|
|
20
|
-
When development is complete, commit changes using conventional commit format.
|
|
21
|
-
Conventional commit format: `type: scope: description` (examples: `feat: api: add user endpoint`, `fix: auth: handle expired tokens`, `chore: config: update dependencies`).
|
|
22
|
-
|
|
23
|
-
## Validation
|
|
24
|
-
|
|
25
|
-
Check package.json for available scripts before running validation steps.
|
|
26
|
-
Skip any step that does not have a corresponding npm script.
|
|
27
|
-
If a npm script produces errors or warnings, note them for context in subsequent steps.
|
|
28
|
-
Include any pre-existing build, lint, test, and type warnings in instructions to disregard when fixing new issues.
|
|
29
|
-
Skip any step that cannot be passed due to pre-existing failures.
|
|
30
|
-
Commit after each successful validation step to create restore points.
|
|
31
|
-
|
|
32
|
-
### Scrub
|
|
33
|
-
|
|
34
|
-
Follow code style rules in packages/mcp/prompts/Jaypie_Scrub.md.
|
|
35
|
-
Repository-specific style guides (CLAUDE.md, .cursorrules) override Jaypie_Scrub.md when they conflict.
|
|
36
|
-
Applying scrub rules can prevent errors in subsequent validation steps, especially testing.
|
|
37
|
-
If no errors are found, no commit is needed for this step.
|
|
38
|
-
|
|
39
|
-
### Test
|
|
40
|
-
|
|
41
|
-
Run `npm run test` to execute the test suite.
|
|
42
|
-
Compare results to baseline: only fix failures introduced by your changes.
|
|
43
|
-
Determine root cause of each new failure:
|
|
44
|
-
- Unchanged test failing: implementation likely broke existing functionality
|
|
45
|
-
- Test covering intentionally modified behavior: test needs updating
|
|
46
|
-
- New test failing: fix the test or implementation as appropriate
|
|
47
|
-
Fix identified issues and re-run tests until only baseline failures remain.
|
|
48
|
-
Commit fixes with message describing what was corrected.
|
|
49
|
-
|
|
50
|
-
### Type Check
|
|
51
|
-
|
|
52
|
-
Run `npm run typecheck` (runs typecheck across all workspace packages).
|
|
53
|
-
Note: Some packages output `[TODO] Convert @jaypie/package to TypeScript` - this is expected and should be ignored.
|
|
54
|
-
Compare results to baseline: only fix type errors introduced by your changes.
|
|
55
|
-
Fix new type errors and re-run typecheck until only baseline errors remain.
|
|
56
|
-
Commit fixes with message describing type corrections.
|
|
57
|
-
|
|
58
|
-
### Format and Lint
|
|
59
|
-
|
|
60
|
-
Run `npm run format` (runs package.json sorting and auto-fixes linting issues).
|
|
61
|
-
Check git status to see if format updated any files.
|
|
62
|
-
If files were modified by format, review changes and commit them.
|
|
63
|
-
Run `npm run lint` to check for remaining lint errors.
|
|
64
|
-
Fix any new lint errors introduced by your changes (compare to baseline).
|
|
65
|
-
Commit lint fixes with appropriate message.
|
|
66
|
-
|
|
67
|
-
### Build
|
|
68
|
-
|
|
69
|
-
Run `npm run build` (uses Lerna to build all packages in dependency order).
|
|
70
|
-
Compare results to baseline: only fix build errors introduced by your changes.
|
|
71
|
-
Fix new build errors and re-run build until only baseline errors remain.
|
|
72
|
-
Commit build fixes with appropriate message.
|
|
73
|
-
Verify dist/ directories were created/updated for modified packages.
|
|
74
|
-
|
|
75
|
-
## Documentation
|
|
76
|
-
|
|
77
|
-
Check if README.md updates are needed:
|
|
78
|
-
- Public API changes (function signatures, exports, parameters)
|
|
79
|
-
- New features that users need to know about
|
|
80
|
-
- Breaking changes to existing functionality
|
|
81
|
-
- Changes to installation or setup procedures
|
|
82
|
-
|
|
83
|
-
Do NOT update README.md for:
|
|
84
|
-
- Internal refactoring
|
|
85
|
-
- Test updates
|
|
86
|
-
- Bug fixes that don't change behavior
|
|
87
|
-
- Dependency updates
|
|
88
|
-
|
|
89
|
-
If updates are needed, modify README.md to reflect changes and commit with message `docs: update README`.
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
trigger: always_on
|
|
3
|
-
description: Baseline rules in Jaypie repositories. Required reading.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Jaypie's Agent Rules
|
|
7
|
-
|
|
8
|
-
This repository uses Jaypie, an opinionated event-driven fullstack library.
|
|
9
|
-
|
|
10
|
-
## Errors
|
|
11
|
-
|
|
12
|
-
Jaypie providers errors that will be handled properly when thrown (e.g., presenting the correct status code).
|
|
13
|
-
|
|
14
|
-
`import { BadGatewayError, BadRequestError, ConfigurationError, ForbiddenError, GatewayTimeoutError, GoneError, IllogicalError, InternalError, MethodNotAllowedError, NotFoundError, NotImplementedError, RejectedError, TeapotError, UnauthorizedError, UnavailableError, UnhandledError, UnreachableCodeError } from "jaypie";`
|
|
15
|
-
|
|
16
|
-
ConfigurationError is a special InternalError 500 that is also thrown when types are incorrect.
|
|
17
|
-
|
|
18
|
-
Though supported, rely on default error messages when throwing.
|
|
19
|
-
Custom error messages should be logged not thrown
|
|
20
|
-
|
|
21
|
-
<Bad>
|
|
22
|
-
throw new NotFoundError("Item not found");
|
|
23
|
-
</Bad>
|
|
24
|
-
<Good>
|
|
25
|
-
log.error("Item not found");
|
|
26
|
-
throw new NotFoundError();
|
|
27
|
-
</Good>
|
|
28
|
-
|
|
29
|
-
Error messages may be returned to the user especially in express.
|
|
30
|
-
|
|
31
|
-
## Logging
|
|
32
|
-
|
|
33
|
-
`import { log } from "jaypie";`
|
|
34
|
-
`log` has methods `trace`, `debug`, `info`, `warn`, `error`, `fatal`, and `var`.
|
|
35
|
-
Only `trace` and `var` should be used in "happy paths".
|
|
36
|
-
`debug` should be used when execution deviates from the happy path.
|
|
37
|
-
`info` should rarely be used.
|
|
38
|
-
`var` expects a _single_ key-value pair like `log.var({ key: "value" });`.
|
|
39
|
-
Do _not_ pass multiple keys to `var`.
|
|
40
|
-
|
|
41
|
-
## Testing
|
|
42
|
-
|
|
43
|
-
`@jaypie/testkit` is a testing library used with vitest providing custom matchers and mocks for the main Jaypie library.
|
|
44
|
-
Always use the testkit to mock Jaypie.
|
|
45
|
-
Always create a manual mock for a models package.
|
|
46
|
-
Always mock network calls and external commands.
|
|
47
|
-
Jaypie relies heavily on mocking to confirm expected behavior and prevent behavior drift.
|
|
48
|
-
|
|
49
|
-
See [Jaypie_Mocks_and_Testkit.md](./Jaypie_Mocks_and_Testkit.md) for more context.
|
|
50
|
-
|
|
51
|
-
### Configuration
|
|
52
|
-
|
|
53
|
-
Mocks and matchers are usually configured at the subpackage-level in `testSetup.js` (legacy path) or `vitest.setup.[js|ts]` (modern path).
|
|
54
|
-
The subpackage `[vite|vitest].config[js|ts]` will reference the setup file.
|
|
55
|
-
All jaypie functions are mocked with `vi.mock("jaypie", async () => vi.importActual("@jaypie/testkit/mock"));`
|
|
56
|
-
|
|
57
|
-
vitest.setup.ts
|
|
58
|
-
```typescript
|
|
59
|
-
import { matchers as jaypieMatchers } from "@jaypie/testkit";
|
|
60
|
-
import * as extendedMatchers from "jest-extended";
|
|
61
|
-
import { expect , vi} from "vitest";
|
|
62
|
-
|
|
63
|
-
expect.extend(extendedMatchers);
|
|
64
|
-
expect.extend(jaypieMatchers);
|
|
65
|
-
|
|
66
|
-
vi.mock("jaypie", async () => vi.importActual("@jaypie/testkit/mock"));
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
### Errors
|
|
70
|
-
|
|
71
|
-
Use matchers to test errors.
|
|
72
|
-
`expect(fn).toThrowBadGatewayError();`
|
|
73
|
-
`await expect(async() => fn()).toThrowBadGatewayError();`
|
|
74
|
-
Do not use `.rejects`
|
|
75
|
-
|
|
76
|
-
### Matchers
|
|
77
|
-
|
|
78
|
-
toBeCalledAboveTrace, toBeCalledWithInitialParams, toBeClass, toBeJaypieError, toMatchBase64, toMatchJwt, toMatchMongoId, toMatchSchema, toMatchSignedCookie, toMatchUuid4, toMatchUuid5, toMatchUuid, toThrowBadGatewayError, toThrowBadRequestError, toThrowConfigurationError, toThrowForbiddenError, toThrowGatewayTimeoutError, toThrowInternalError, toThrowJaypieError, toThrowNotFoundError, toThrowUnauthorizedError, toThrowUnavailableError,
|
|
79
|
-
|
|
80
|
-
### Order of Tests
|
|
81
|
-
|
|
82
|
-
Tests are named `./__tests__/<subject>.spec.<js|ts>`.
|
|
83
|
-
Each file should have one top-level `describe` block.
|
|
84
|
-
Organize tests in one of seven second-level describe block sections in this order:
|
|
85
|
-
|
|
86
|
-
1. Base Cases - it is the type we expect ("It is a Function"). For functions, the simplest possible call works and returns not undefined ("It Works"). For objects, the expected shape.
|
|
87
|
-
2. Error Conditions - any error handling the code performs
|
|
88
|
-
3. Security - any security checks the code performs
|
|
89
|
-
4. Observability - any logging the code performs
|
|
90
|
-
5. Happy Paths - The most common use case
|
|
91
|
-
6. Features - Features in addition to the happy path
|
|
92
|
-
7. Specific Scenarios - Special cases
|
|
93
|
-
Omit describe blocks for sections that are not applicable or empty.
|
|
94
|
-
Whenever possible, especially when refactoring, write the test first so the user can confirm the expected behavior passes/fails.
|
|
95
|
-
|
|
96
|
-
### Test Coverage
|
|
97
|
-
|
|
98
|
-
Aim for complete coverage of all happy paths, features, and error conditions.
|
|
99
|
-
Whenever possible, confirm mocked functions are called.
|
|
100
|
-
Confirm calls to log above debug in Observability. Do not confirm calls to debug, var, or trace.
|
|
101
|
-
|
|
102
|
-
## Linting
|
|
103
|
-
|
|
104
|
-
Use double quotes, trailing commas, and semicolons.
|
|
105
|
-
Do not delete `// eslint-disable-next-line no-shadow` comments; add when shadowing variables, especially `error` in catch blocks.
|
|
106
|
-
|
|
107
|
-
### Beyond Lint
|
|
108
|
-
|
|
109
|
-
Whenever a hard-coded value like `site: "datadoghq.com"` is used, define a constant at the top of the file, `const DATADOG_SITE = "datadoghq.com"`, and reference that throughout.
|
|
110
|
-
Alphabetize as much as possible.
|