Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
043fa15
feat: implement database encryption password change (Pre-1.1)
Apr 6, 2026
27e6f6e
feat: implement decrypted backup export to Backups folder (Pre-1.2)
Apr 6, 2026
7478f34
fix: preserve keychain on unencrypted backup export, remove confirm d…
Apr 6, 2026
6f6160b
feat: hide registration links when account exists (Pre-1.4)
Apr 6, 2026
0b2511b
fix: About page overhaul, sidebar flex layout fixes scrollbar, disabl…
Apr 6, 2026
d66a5ed
feat: add paging to outstanding invoices dashboard list (Pre-1.6)
Apr 6, 2026
b73822c
feat: remove SendGrid and Twilio from desktop app (Pre-1.3)
Apr 6, 2026
0d0bc66
chore: bump version to 1.2.0
Apr 6, 2026
31b0cf0
docs: update CHANGELOG for v1.2.0 (Pre-Phase-1 patches)
Apr 8, 2026
9ebb795
merge: feature/pre-phase1-patches into development (v1.2.0)
Apr 8, 2026
9690414
Phase 1: NavMenu, Inspections, Leases, Properties, and UI cleanup pri…
Apr 9, 2026
8bb886e
feat: Lease.IsActive refactor, compiled model regen, test fixes, and …
Apr 16, 2026
7f830e0
feat: Lease.IsActive refactor, compiled model regen, test fixes, and …
Apr 16, 2026
e2287af
feat(archive-delete): Phase 1 — EF migration AddIsArchived
Apr 16, 2026
9895444
feat(archive-delete): Phase 2+3 — CascadeSummary DTO and BaseService …
Apr 16, 2026
562926c
feat: cascade deletes with transactions, ActionConfirmModal UI, remov…
Apr 21, 2026
43c2aeb
removing bin folder.
Apr 21, 2026
7329369
feat: archive/delete UI for Properties, Repairs, Leases, Invoices, Pa…
May 4, 2026
2208c44
feat: dynamic port selection for Electron to prevent port conflicts
Jun 15, 2026
8fd6dd3
fix: resolve Electron window URL from app.Urls instead of pre-capture…
Jun 15, 2026
5398c87
merge: electron-dynamic-port into development
Jun 15, 2026
e2e20ab
Reimage push.
Jun 30, 2026
140b90e
See REVISIONS.md for list of changes.
Jul 23, 2026
127bee5
feat: Property market-status tabs, LeaseService IsActive fix, Inspect…
Aug 15, 2026
3643481
Merge branch 'archive-delete-records' into development
Aug 15, 2026
c47c4e5
Added property expense tracking.
xnodeoncode Aug 20, 2026
e008ab5
Add property expense tracking and lease type support
xnodeoncode Aug 20, 2026
3e127ff
Added class diagram.
xnodeoncode Aug 20, 2026
eef8c9d
Add property expense capture: recurrence, due tracking, and payments …
xnodeoncode Aug 25, 2026
920865e
Add repair supporting-document uploads; Repairs status filter; lease …
xnodeoncode Nov 10, 2026
a534db3
Add Postman Copilot customization instructions
xnodeoncode Nov 10, 2026
26d015b
Reorder filters on Repairs view.
xnodeoncode Nov 10, 2026
626fe15
docs: update release documentation for v1.1.0
xnodeoncode Nov 11, 2026
9c983a3
feat: complete Phase-1 cleanup and Property Expense Reporting Part 2
xnodeoncode Nov 11, 2026
9f2c0e5
Merge feature/Phase-1-Completion-and-Expense-Reporting into development
xnodeoncode Nov 11, 2026
42fa225
docs: update CHANGELOG for v1.2.0 release
xnodeoncode Nov 11, 2026
7967f0f
fix: restore Electron binary with MSBuild Unzip instead of PowerShell
xskcdf Nov 12, 2026
b07a582
Merge feature/Fix-Electron-Binary-Restore into development
xskcdf Nov 12, 2026
2ee3c8c
fix: keep original Linux Electron restore steps, use Unzip on Windows…
xskcdf Nov 12, 2026
fce04af
Merge feature/Restore-Linux-Electron-Steps into development
xskcdf Nov 12, 2026
9be28e9
fix: pin AngleSharp 1.5.0 in Shared.UI tests to resolve NU1902 (GHSA-…
xskcdf Nov 12, 2026
8a07f59
Merge feature/Fix-AngleSharp-Vulnerability into development
xskcdf Nov 12, 2026
db453ca
see revisions.md for list of changes.
xskcdf Nov 12, 2026
2b89adf
fix: show clear error when no active organization in user View page
xskcdf Nov 12, 2026
c27622c
Merge feature/Fix-ViewUser-Null-Org into development
xskcdf Nov 12, 2026
04b939a
fix: user View page showed wrong role due to shadowed field
xskcdf Nov 12, 2026
8d7ac79
Merge feature/Fix-ViewUser-Role-Shadowing into development
xskcdf Nov 12, 2026
52a3e37
fix: show 'No role found' for users without an organization role
xskcdf Nov 12, 2026
0c3223f
Merge feature/ViewUser-No-Role-Display into development
xskcdf Nov 12, 2026
68c0556
Documentation update.
xnodeoncode Nov 12, 2026
52d3fc9
Merge branch 'xnodeoncode:development' into development
xskcdf Nov 12, 2026
342efe5
Merge pull request #5 from xskcdf/development
xnodeoncode Nov 12, 2026
dcc93a3
build: publish Electron output outside the project folder
xskcdf Nov 12, 2026
d0e676b
Merge pull request #6 from xskcdf/development
xnodeoncode Nov 12, 2026
9a71cf8
Removed Playwright test project
xnodeoncode Nov 12, 2026
ef984f2
Replace FluentAssertions with xUnit Assert in UI tests
xnodeoncode Nov 12, 2026
d16c74d
Merge feature/Remove-FluentAssertions into development
xnodeoncode Nov 12, 2026
885cb9d
Add third-party licensing notices
xnodeoncode Nov 13, 2026
b6d3394
Merge feature/Third-Party-Licensing-Notices into development
xnodeoncode Nov 13, 2026
ae600cd
Add transitive dependencies and front-end notes to third-party notices
xnodeoncode Nov 13, 2026
8523ace
Merge feature/Third-Party-Notices-Transitive into development
xnodeoncode Nov 13, 2026
9bfd4b3
Record build audit results in third-party notices checklist
xnodeoncode Nov 13, 2026
58512bf
Merge feature/Third-Party-Notices-Build-Audit into development
xnodeoncode Nov 13, 2026
b370a33
Bundle Bootstrap Icons locally instead of loading from CDN
xnodeoncode Nov 13, 2026
98f1cea
Update notices checklist: Bootstrap Icons verified local
xnodeoncode Nov 13, 2026
6c17535
Merge feature/Bundle-Bootstrap-Icons into development
xnodeoncode Nov 13, 2026
5f546db
Restrict desktop build network access to the local app origin
xnodeoncode Nov 13, 2026
c9c6481
Hand external links to the system browser in the Electron build
xnodeoncode Nov 13, 2026
5370e24
Standardize GitHub repo URL casing and update Quick Start installer v…
xnodeoncode Nov 13, 2026
da2871c
Update README download links and version references to 1.2.0
xnodeoncode Nov 13, 2026
fedc1c2
Merge feature/Docs-Link-Fixes into development
xnodeoncode Nov 13, 2026
2b784a0
Merge feature/Network-Lockdown into development
xnodeoncode Nov 13, 2026
a4817d7
Remove emoji from markdown headings
xnodeoncode Nov 13, 2026
206a9c4
Merge feature/Docs-Heading-Emoji-Cleanup into development
xnodeoncode Nov 13, 2026
1f6a522
Remove unnecessary documentation files.
xnodeoncode Nov 13, 2026
7879168
Rewrite Quick Start Guide to match the current UI
xnodeoncode Nov 13, 2026
a4163df
Use the Nine icon for the Electron window during development
xnodeoncode Nov 13, 2026
c1eb2e9
Update electron-builder buildVersion in version scripts
xnodeoncode Nov 13, 2026
22e618f
Update version number on files. Minor edits.
xnodeoncode Nov 13, 2026
e40e078
Ship third-party license texts with the app and surface the QuestPDF …
xnodeoncode Nov 13, 2026
ec533dc
Replace About page shields.io badges with local badges; link licenses…
xnodeoncode Nov 13, 2026
9a7022c
Add in-app Third-Party Licenses page
xnodeoncode Nov 13, 2026
10767b4
Pin documentation and release-notes links to the installed version's tag
xnodeoncode Nov 13, 2026
2069ac3
Point Aquiis-era releases in the compatibility matrix at the Aquiis repo
xnodeoncode Nov 13, 2026
dc3f59a
Add Product column to the compatibility matrix and complete the relea…
xnodeoncode Nov 13, 2026
96d9034
Simplify compatibility matrix title and Aquiis note
xnodeoncode Nov 13, 2026
a3a5e03
Correct schema versioning statement in compatibility matrix note
xnodeoncode Nov 13, 2026
6609179
Use GitHub release dates in the compatibility matrix
xnodeoncode Nov 13, 2026
1908019
Show the current SchemaVersion setting in the schema mismatch warning
xnodeoncode Nov 13, 2026
219495c
Add privacy statement (Documentation/Privacy.md and in-app /privacy p…
xnodeoncode Nov 14, 2026
1e37df6
Restrict AllowedHosts to loopback names
xnodeoncode Nov 15, 2026
f90bf54
Name the auth cookie after the schema version
xnodeoncode Nov 15, 2026
bb7a141
Log NotificationHub connections at Debug; Debug level for Nine in dev…
xnodeoncode Nov 15, 2026
f8b5aab
Reword privacy statement network and data claims
xnodeoncode Nov 15, 2026
8d53211
Proof and update Compatibility Matrix for current release.
xnodeoncode Nov 15, 2026
b9d712d
Log routine keychain diagnostics at Debug
xnodeoncode Nov 15, 2026
8312667
Rename web-mode default database to nine.db
xnodeoncode Nov 15, 2026
aa10b60
Fix diagnose-startup.sh for Nine
xnodeoncode Nov 15, 2026
347774f
Add nine-removal.sh to undo the desktop integration
xnodeoncode Nov 15, 2026
734d5da
Point the installer's uninstall hints at nine-removal.sh
xnodeoncode Nov 15, 2026
921f7be
Release 1.2.0 documentation pass, default settings and installer hint…
xnodeoncode Nov 15, 2026
8001498
Move scripts to Utilities and add nine-tool, verify-build and PowerSh…
xnodeoncode Nov 16, 2026
bcdcf25
Fix appdata extraFiles path and update the appdata XML
xnodeoncode Nov 16, 2026
00ee5cf
Use 5-day late-fee grace and 10-day payment reminder defaults for new…
xnodeoncode Nov 16, 2026
1607da1
Add Advanced Troubleshooting Guide and INSTALL.md; update guides for …
xnodeoncode Nov 16, 2026
28cfb50
Rename INSTALL.md to Install-Guide.md
xnodeoncode Nov 16, 2026
7508f8c
docs: apply pending Database Management Guide validation edits and bu…
xnodeoncode Nov 16, 2026
9bfe7f1
feat: detailed database health check report
xnodeoncode Nov 16, 2026
1fb6c21
feat: show database location; count records by !IsDeleted and !IsArch…
xnodeoncode Nov 16, 2026
f29e412
docs: align health check guide with final implementation
xnodeoncode Nov 16, 2026
ca735aa
style: render database path in normal text color
xnodeoncode Nov 16, 2026
ebdce65
docs: review Database Management Guide for accuracy and conciseness
xnodeoncode Nov 16, 2026
5e10fd5
docs: correct new-computer migration steps to use Upload Backup File
xnodeoncode Nov 16, 2026
5b96592
docs: remove cloud storage recommendations from Database Management G…
xnodeoncode Nov 16, 2026
0fee08c
docs: point backup storage guidance to Privacy policy
xnodeoncode Nov 16, 2026
b0869dd
docs: restore cloud storage mentions with pointer to Privacy responsi…
xnodeoncode Nov 16, 2026
9a9c379
docs: suggest encryption before copying backups to external storage
xnodeoncode Nov 16, 2026
ac10a2d
Merge feature/database-health-check into feature/Release-Readiness-1.2.0
xnodeoncode Nov 16, 2026
5571e08
Release 1.2.0 documentation and README overhaul, Bootstrap Icons, use…
xnodeoncode Nov 16, 2026
2e6481a
Merge feature/Release-Readiness-1.2.0 into development
xnodeoncode Nov 16, 2026
1cead91
Restructure developer README, add contributor workflow, fix guide wor…
xnodeoncode Nov 16, 2026
1678861
Merge feature/Docs-Developer-README-and-Contributing into development
xnodeoncode Nov 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
34 changes: 25 additions & 9 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ feature/Phase-X-Feature-Name

## Project Overview

Nine is a multi-tenant property management system built with **ASP.NET Core 9.0 + Blazor Server**. It manages properties, tenants, leases, invoices, payments, documents, inspections, and maintenance requests with role-based access control.
Nine is a multi-tenant property management system built with **ASP.NET Core 10.0 + Blazor Server**. It manages properties, tenants, leases, invoices, payments, documents, inspections, and maintenance requests with role-based access control.

## Architecture Fundamentals

Expand Down Expand Up @@ -639,14 +639,19 @@ public async Task<Entity> AddEntityAsync(Entity entity)
### Database Changes

1. **EF Core Migrations**: Primary approach for schema changes
- Migrations stored in `Data/Migrations/`
- Run `dotnet ef migrations add MigrationName --project Nine`
- Apply with `dotnet ef database update --project Nine`
- Migrations stored in `1-Nine.Infrastructure/Data/Migrations/`
- Add migration: `dotnet ef migrations add MigrationName --project 1-Nine.Infrastructure --startup-project 4-Nine --context ApplicationDbContext --output-dir Data/Migrations`
- Apply to database: `dotnet ef database update --project 1-Nine.Infrastructure --startup-project 4-Nine --context ApplicationDbContext`
- Generate SQL script: `dotnet ef migrations script --output schema.sql`
2. **SQL Scripts**: Reference scripts in `Data/Scripts/` (not executed, for documentation)
3. Update `ApplicationDbContext.cs` with DbSet and entity configuration
4. Connection string in `appsettings.json`: `"DefaultConnection": "DataSource=Infrastructure/Data/app.db;Cache=Shared"`
5. **Database**: SQLite (not SQL Server) - scripts will be SQLite syntax
2. **Regenerate Compiled Model** (REQUIRED after every schema change):
- The app uses a **pre-compiled EF Core model** (`1-Nine.Infrastructure/Data/CompiledModels/`) for performance.
- After every migration, regenerate it or EF will throw `InvalidOperationException: Cannot create a DbSet for 'X' because this type is not included in the model for the context.`
- Command: `dotnet ef dbcontext optimize --project 1-Nine.Infrastructure --startup-project 4-Nine --context ApplicationDbContext --output-dir Data/CompiledModels --namespace Nine.Infrastructure.Data.CompiledModels`
- **Three steps for every schema change**: `migrations add` → `database update` → `dbcontext optimize`
3. **SQL Scripts**: Reference scripts in `Data/Scripts/` (not executed, for documentation)
4. Update `ApplicationDbContext.cs` with DbSet and entity configuration
5. Connection string in `appsettings.json`: `"DefaultConnection": "DataSource=Infrastructure/Data/app.db;Cache=Shared"`
6. **Database**: SQLite (not SQL Server) - scripts will be SQLite syntax

### Development Workflows

Expand Down Expand Up @@ -760,7 +765,11 @@ Components/PropertyManagement/[Entity]/

1. **Create entity model** inheriting `BaseModel` with `OrganizationId` property
2. **Add DbSet** to `ApplicationDbContext` with proper relationships and configuration
3. **Create EF Core migration**: `dotnet ef migrations add [Name] --project Nine`
3. **Run three-step schema update**:
- `dotnet ef migrations add [Name] --project 1-Nine.Infrastructure --startup-project 4-Nine --context ApplicationDbContext --output-dir Data/Migrations`
- `dotnet ef database update --project 1-Nine.Infrastructure --startup-project 4-Nine --context ApplicationDbContext`
- `dotnet ef dbcontext optimize --project 1-Nine.Infrastructure --startup-project 4-Nine --context ApplicationDbContext --output-dir Data/CompiledModels --namespace Nine.Infrastructure.Data.CompiledModels`
- All three steps are required — skipping `dbcontext optimize` will cause a runtime `InvalidOperationException` on first use of the new entity.
4. **Create entity-specific service** inheriting `BaseService<TEntity>`:
- Add constructor with dependencies (DbContext, Logger, UserContext, Settings)
- Override `ValidateEntityAsync()` for business rules
Expand Down Expand Up @@ -938,3 +947,10 @@ The database filename and schema version are tracked separately from the applica
- Allows rapid iteration and entity refactoring
- Schema migrations managed via EF Core Migrations folder
- At v1.0.0 release, formalize database versioning with `app_v1.0.0.db`

<!-- mermaid-ai-skills:start -->
## Mermaid Diagrams

When the user asks to create, edit, or visualize a diagram, follow the
instructions in `.github/instructions/mermaid.instructions.md`.
<!-- mermaid-ai-skills:end -->
85 changes: 85 additions & 0 deletions .github/instructions/mermaid.instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
applyTo: "**"
---
# Mermaid AI Skills

When the user asks to create, edit, or visualize any diagram, use the Mermaid
VS Code extension tools and commands described below.

## Workflow

1. Determine the diagram type and generate Mermaid syntax.
2. Write the diagram to a `.mmd` file in the project.
3. Validate syntax: correct first-line keyword, arrow types, balanced brackets.
4. Preview via the Mermaid extension — open the `.mmd` file (auto-preview) or run
**MermaidChart: Preview Diagram** (`mermaidChart.preview`).

## LM Tools — call these for every diagram interaction

- `mermaid-diagram-validator` — validate Mermaid syntax before presenting any diagram
- `mermaid-diagram-preview` — render a live preview inside VS Code after generating
- `get-syntax-docs-mermaid` — fetch correct syntax docs for any diagram type

## VS Code Commands

Invoke via Command Palette or the VS Code command API (GitHub Copilot in VS Code only).
Do not invent command IDs. Prefer writing/editing `.mmd` files when a command is not needed.

### Diagram editing & preview
- **Preview** (`mermaidChart.preview`) — preview the active Mermaid editor (`.mmd` / `.mermaid` must be open).
- **Create Diagram** (`mermaidChart.createMermaidFile`) — creates a demo flowchart and opens preview side by side.
- **Repair Diagram** (`mermaidChart.repairDiagram`) — Mermaid AI repair for the active diagram; uses Mermaid AI credits — tell the user before running.
- **Improve Diagram** (`mermaidChart.improveDiagram`) — uses Copilot / LM API; suggests layout + styling variants for the active diagram.

### Generate diagrams (GitHub Copilot required)
- **Generate Diagram from Code** (`mermaidChart.generateDiagramFromCode`)
- **Generate Cloud Diagram** (`mermaidChart.generateCloudDiagram`)
- **Generate ER Diagram** (`mermaidChart.generateERDiagram`)
- **Generate Docker Diagram** (`mermaidChart.generateDockerDiagram`)
- **Open AI Chat** (`mermaidChart.openCopilotChat`)

### Mermaid Chart cloud
- **Login** (`mermaidChart.login`) / **Logout** (`mermaidChart.logout`)
- **Connect Diagram** (`mermaidChart.connectDiagramToMermaidChart`) — link a local diagram to Mermaid Chart.
- **Sync Diagram** (`mermaidChart.syncDiagramWithMermaid`) — only for diagrams already connected (frontmatter has `id:`). Example:
```yaml
---
id: cbd9e9ba-a2cb-47c5-a98e-8c28a753428d
---
```

### Review Mermaid Sync
For diagrams updated by the Mermaid Chart GitHub Sync app (or pre-commit regenerate):
- **Review Mermaid Sync** (`mermaidChart.reviewAppCommits`) — start / open the review flow.
- **Regenerate with Mermaid AI** (`mermaidChart.regenerateDiagramWithMermaidAI`) — regenerate from source references.
Do not manually rewrite diagrams managed by this workflow. Accept/reject/diff UI actions stay in the extension UI.

### Install / update this pack
- **MermaidChart: Install AI Skills…** (`mermaidChart.installAiSkills`)

## @mermaid-chart slash commands

| Command | Purpose |
|---|---|
| `/generate_diagram_from_code` | General diagram from any source file |
| `/generate_execution_sequence` | Sequence diagram from code flow |
| `/generate_er_diagram` | ER diagram from schema / models |
| `/generate_cloud_architecture_diagram` | Cloud / CI-CD architecture |
| `/generate_docker_diagram` | Architecture from Dockerfiles |
| `/generate_c4_topdown_architecture` | C4 top-down architecture |
| `/analyze_code_ownership` | Code ownership diagram |
| `/generate_dependency_diagram` | Dependency / security visualisation |

## Rules

1. Always call `mermaid-diagram-validator` before showing any diagram.
2. Always call `mermaid-diagram-preview` after generating a diagram.
3. Use `get-syntax-docs-mermaid` before generating an unfamiliar diagram type.
4. Prefer `@mermaid-chart` slash commands for complex generation.
5. Write diagrams to `.mmd` files; never return unvalidated Mermaid syntax.
6. Warn the user before Repair (Mermaid AI credits).
7. Cooperate with the Sync workflow — do not manually regenerate managed diagrams.

## Docs

More commands and features: https://marketplace.visualstudio.com/items?itemName=MermaidChart.vscode-mermaid-chart
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
applyTo: '**/*-post-c-pm-*'
---

## Instructions

**Context:**
You are a Postman post-response test script generator. Your task is to create high-quality scripts for Postman. The scripts should be tailored to the specific request and follow best practices for Postman scripting.

**Rules:**

1. The response object (`pm.response`) is available in test scripts. You can perform assertions and write test cases using the response data.
2. Use the `pm.expect` function, which follows Chai assertion syntax, for writing robust and readable test cases.
3. Never declare a global variable referring to `pm.response.json()`. It should be always in test case callbacks.

**Guidelines:**

- Use `pm.response` to access the response data, status, headers, and body.
- Parse the response body as JSON if needed: `const responseBodyJson = pm.response.json();`
- Write test cases using `pm.test` and `pm.expect` (Chai assertions).
- Check status codes, response times, headers, and body content as appropriate.
- Use clear, descriptive test names.
- Leverage type definitions from `@postman/test-script-types-plugin` (these types are available by default in the extension environment).
- Use comments and JSDoc where helpful for clarity.
- Refer to the official Postman documentation for test scripts:
- https://learning.postman.com/docs/tests-and-scripts/write-scripts/test-scripts/
- https://learning.postman.com/docs/tests-and-scripts/write-scripts/test-examples/
- https://learning.postman.com/docs/tests-and-scripts/write-scripts/variables-list/
- https://learning.postman.com/docs/tests-and-scripts/write-scripts/postman-sandbox-api-reference/

**Output Format:**
Only output the Postman test script content (JavaScript code for the "Tests" tab in Postman), not the full JSON or any additional explanation.

**Quality:**
Ensure the scripts are robust, readable, and follow Postman scripting standards.

**Example Output:**

```javascript
// @ts-check
// Types from @postman/test-script-types-plugin are available
// Parse the response body as JSON
const responseBodyJson = pm.response.json();

// Check that the status code is 200
pm.test('Status code is 200', function () {
pm.response.to.have.status(200);
});

// Check that the response has a property 'success' set to true
pm.test('Response has success property set to true', function () {
pm.expect(responseJson).to.have.property('success', true);
});

// Check that the response time is less than 1000ms
pm.test('Response time is less than 1000ms', function () {
pm.expect(pm.response.responseTime).to.be.below(1000);
});

// Check that the response contains a non-empty 'data' array
pm.test('Response contains non-empty data array', function () {
pm.expect(responseJson.data).to.be.an('array').that.is.not.empty;
});
```

**Note:**

- Use `pm.response` and `pm.expect` for assertions in test scripts.
- Use JSDoc and type annotations where helpful, taking advantage of the available type definitions.
- For more details, consult the official Postman documentation linked above.
- Do not add the @ts-check comment on the top of the document to inform types from `@postman/test-script-types-plugin` are available.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
applyTo: '**/*-pre-c-pm-*'
---

## Instructions

**Context:**
You are a Postman pre-request script generator. Your task is to create high-quality scripts for Postman. The scripts should be tailored to the specific request and follow best practices for Postman scripting.

**Rules:**

1. The response object (`pm.response`) is NOT available in pre-request scripts. Do not perform any operations on the response. Show the below note as prompt response.
> **Note:** Pre-request scripts run before the request is sent, so the response object is not yet available. For more information about pre-request scripts, please refer to the [Write pre-request scripts - Postman documentation](https://learning.postman.com/docs/tests-and-scripts/write-scripts/pre-request-scripts/).
2. Do not write test cases in pre-request scripts. Do not perform any operations regarding test cases. Show the below note as prompt response.
> **Note:** Test cases should be written in the Post-response script tab, not in pre-request scripts. Pre-request scripts are meant for request preparation and setup only. For more information about writing tests, please refer to the [Write tests - Postman documentation](https://learning.postman.com/docs/tests-and-scripts/write-scripts/test-scripts/).

**Guidelines:**

- Set or update environment, global, or collection variables as needed for the request.
- Add dynamic values (e.g., timestamps, UUIDs, tokens) to the request.
- Manipulate request headers, body, or parameters if required.
- Use best practices for Postman scripting (e.g., use `pm` API, clear variable names, comments for clarity).
- Leverage type definitions from `@postman/test-script-types-plugin` (these types are available by default in the extension environment).
- Refer to the official Postman documentation for pre-request scripts:
- https://learning.postman.com/docs/tests-and-scripts/write-scripts/pre-request-scripts/
- https://learning.postman.com/docs/tests-and-scripts/write-scripts/variables-list/
- https://learning.postman.com/docs/tests-and-scripts/write-scripts/postman-sandbox-api-reference/

**Output Format:**
Only output the Postman pre-request script content (JavaScript code for the "Pre-request Script" tab in Postman), not the full JSON or any additional explanation.

**Quality:**
Ensure the scripts are robust, readable, and follow Postman scripting standards.

**Example Output:**

```javascript
// @ts-check
// Types from @postman/test-script-types-plugin are available
// Set a dynamic timestamp variable
pm.environment.set('currentTimestamp', Date.now());
// Generate a random UUID and set as a variable
pm.environment.set('uuid', pm.variables.replaceIn('{{$guid}}'));
```

**Note:**

- Use JSDoc and type annotations where helpful, taking advantage of the available type definitions.
- For more details, consult the official Postman documentation linked above.
- Do not add the @ts-check comment on the top of the document to inform types from `@postman/test-script-types-plugin` are available.
71 changes: 71 additions & 0 deletions .github/instructions/postman-folder-post-response.instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
applyTo: '**/*-post-f-pm-*'
---

## Instructions

**Context:**
You are a Postman post-response test script generator. Your task is to create high-quality scripts for Postman. The scripts should be tailored to the specific request and follow best practices for Postman scripting.

**Rules:**

1. The response object (`pm.response`) is available in test scripts. You can perform assertions and write test cases using the response data.
2. Use the `pm.expect` function, which follows Chai assertion syntax, for writing robust and readable test cases.
3. Never declare a global variable referring to `pm.response.json()`. It should be always in test case callbacks.

**Guidelines:**

- Use `pm.response` to access the response data, status, headers, and body.
- Parse the response body as JSON if needed: `const responseBodyJson = pm.response.json();`
- Write test cases using `pm.test` and `pm.expect` (Chai assertions).
- Check status codes, response times, headers, and body content as appropriate.
- Use clear, descriptive test names.
- Leverage type definitions from `@postman/test-script-types-plugin` (these types are available by default in the extension environment).
- Use comments and JSDoc where helpful for clarity.
- Refer to the official Postman documentation for test scripts:
- https://learning.postman.com/docs/tests-and-scripts/write-scripts/test-scripts/
- https://learning.postman.com/docs/tests-and-scripts/write-scripts/test-examples/
- https://learning.postman.com/docs/tests-and-scripts/write-scripts/variables-list/
- https://learning.postman.com/docs/tests-and-scripts/write-scripts/postman-sandbox-api-reference/

**Output Format:**
Only output the Postman test script content (JavaScript code for the "Tests" tab in Postman), not the full JSON or any additional explanation.

**Quality:**
Ensure the scripts are robust, readable, and follow Postman scripting standards.

**Example Output:**

```javascript
// @ts-check
// Types from @postman/test-script-types-plugin are available
// Parse the response body as JSON
const responseBodyJson = pm.response.json();

// Check that the status code is 200
pm.test('Status code is 200', function () {
pm.response.to.have.status(200);
});

// Check that the response has a property 'success' set to true
pm.test('Response has success property set to true', function () {
pm.expect(responseJson).to.have.property('success', true);
});

// Check that the response time is less than 1000ms
pm.test('Response time is less than 1000ms', function () {
pm.expect(pm.response.responseTime).to.be.below(1000);
});

// Check that the response contains a non-empty 'data' array
pm.test('Response contains non-empty data array', function () {
pm.expect(responseJson.data).to.be.an('array').that.is.not.empty;
});
```

**Note:**

- Use `pm.response` and `pm.expect` for assertions in test scripts.
- Use JSDoc and type annotations where helpful, taking advantage of the available type definitions.
- For more details, consult the official Postman documentation linked above.
- Do not add the @ts-check comment on the top of the document to inform types from `@postman/test-script-types-plugin` are available.
Loading
Loading