Skip to content

Commit a82e3bb

Browse files
authored
Renaming generate_rules prompts to generate_security_rules (#9745)
* Renaming generate_rules prompts to generate_security_rules * Adding in missing files * Fix typo in changelog
1 parent cf9d531 commit a82e3bb

File tree

5 files changed

+39
-38
lines changed

5 files changed

+39
-38
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Renamed MCP prompts `/firestore:generate_rules` to `/firestore:generate_security_rules` and `/storage:generate_rules` to `/storage:generate_security_rules`.

src/mcp/prompts/firestore/generate_rules.ts renamed to src/mcp/prompts/firestore/generate_security_rules.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { prompt } from "../../prompt";
22

3-
export const generateRules = prompt(
3+
export const generateSecurityRules = prompt(
44
"firestore",
55
{
6-
name: "generate_rules",
6+
name: "generate_security_rules",
77
description:
88
"Generate secure Firebase Firestore Security Rules and corresponding unit tests for your project.",
99
arguments: [],
@@ -261,7 +261,7 @@ The test suite must:
261261
262262
'''bash
263263
# Step-1: Navigate to test directory
264-
cd rules_test
264+
cd security_rules_test_firestore
265265
266266
# Step-2: Install dependencies
267267
npm install
@@ -296,10 +296,10 @@ Provide your response in this structure:
296296
297297
## Generated Files Structure
298298
299-
A complete 'rules_test/' directory will be created as an independent Node.js project:
299+
A complete 'security_rules_test_firestore/' directory will be created as an independent Node.js project:
300300
301301
'''
302-
rules_test/
302+
security_rules_test_firestore/
303303
├── package.json
304304
├── firebase.json
305305
├── firestore.rules (symlinked or copied from root)
@@ -327,11 +327,11 @@ rules_test/
327327
- Project ID: [project-id]
328328
- Files created:
329329
- firestore.rules (project root)
330-
- rules_test/package.json
331-
- rules_test/firebase.json
332-
- rules_test/firestore.rules
333-
- rules_test/tests/firestore.test.js
334-
- rules_test/README.md
330+
- security_rules_test_firestore/package.json
331+
- security_rules_test_firestore/firebase.json
332+
- security_rules_test_firestore/firestore.rules
333+
- security_rules_test_firestore/tests/firestore.test.js
334+
- security_rules_test_firestore/README.md
335335
'''
336336
337337
**After providing the analysis and summary, create all necessary files:**
@@ -341,26 +341,26 @@ Files to Create:
341341
1. 'firestore.rules' (in project root)
342342
- Complete Firebase Security Rules with comments
343343
344-
2. 'rules_test/package.json'
344+
2. 'security_rules_test_firestore/package.json'
345345
- Include dependencies: '@firebase/rules-unit-testing', 'jest'
346346
- Include scripts: 'test', 'emulator:start'
347347
- Use the provided Project ID
348348
349-
3. 'rules_test/firebase.json'
349+
3. 'security_rules_test_firestore/firebase.json'
350350
- Configure Firestore emulator
351351
- Reference the rules file
352352
- Use the provided Project ID
353353
354-
4. 'rules_test/firestore.rules'
354+
4. 'security_rules_test_firestore/firestore.rules'
355355
- Copy of the generated rules
356356
357-
5. 'rules_test/tests/firestore.test.js' (or '.ts' if TypeScript)
357+
5. 'security_rules_test_firestore/tests/firestore.test.js' (or '.ts' if TypeScript)
358358
- Complete test suite using '@firebase/rules-unit-testing'
359359
- All CRUD operations tested
360360
- Auth scenarios covered
361361
- Clear test Descriptions
362362
363-
6. 'rules_test/README.md'
363+
6. 'security_rules_test_firestore/README.md'
364364
- Prerequisites checklist
365365
- Step-by-step commands with exact terminal instructions
366366
- Expected output
@@ -376,7 +376,7 @@ Files to Create:
376376
5. **Do not modify rules during test validation** - only fix test code
377377
6. **Always use firebase_validate_security_rules** before generating the tests
378378
7. **Tests must be JavaScript / TypeScript only** - regardless of the codebase language
379-
8. **Create a self-contained test environment** - the 'rules_test/' directory should be independently runnable
379+
8. **Create a self-contained test environment** - the 'security_rules_test_firestore/' directory should be independently runnable
380380
9. **Provide complete, runnable code** - no placeholders or TODOs
381381
10. **Document all assumptions** about data structure or access patterns
382382
`,

src/mcp/prompts/firestore/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { ServerPrompt } from "../../prompt";
2-
import { generateRules } from "./generate_rules";
2+
import { generateSecurityRules } from "./generate_security_rules";
33

44
export const firestorePrompts: ServerPrompt[] = [];
55

6-
firestorePrompts.push(generateRules);
6+
firestorePrompts.push(generateSecurityRules);

src/mcp/prompts/storage/generate_rules.ts renamed to src/mcp/prompts/storage/generate_security_rules.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { prompt } from "../../prompt";
22

3-
export const generateRules = prompt(
3+
export const generateSecurityRules = prompt(
44
"storage",
55
{
6-
name: "generate_rules",
6+
name: "generate_security_rules",
77
description:
88
"Generate secure Firebase Storage Security Rules and corresponding unit tests for your project.",
99
arguments: [],
@@ -142,10 +142,10 @@ Provide your response in this structure:
142142
143143
## Generated Files Structure
144144
145-
A complete 'storage_rules_test/' directory will be created as an independent Node.js project:
145+
A complete 'security_rules_test_storage/' directory will be created as an independent Node.js project:
146146
147147
'
148-
storage_rules_test/
148+
security_rules_test_storage/
149149
├── package.json
150150
├── firebase.json
151151
├── storage.rules (symlinked or copied from root)
@@ -177,18 +177,18 @@ storage_rules_test/
177177
- Bucket: [bucket-name]
178178
- Files created:
179179
- storage.rules (project root)
180-
- storage_rules_test/package.json
181-
- storage_rules_test/firebase.json
182-
- storage_rules_test/storage.rules
183-
- storage_rules_test/tests/storage.test.js
184-
- storage_rules_test/test-files/[mock files]
185-
- storage_rules_test/README.md
180+
- security_rules_test_storage/package.json
181+
- security_rules_test_storage/firebase.json
182+
- security_rules_test_storage/storage.rules
183+
- security_rules_test_storage/tests/storage.test.js
184+
- security_rules_test_storage/test-files/[mock files]
185+
- security_rules_test_storage/README.md
186186
187187
## Setup and Run Instructions
188188
189189
'''bash
190190
# Navigate to test directory
191-
cd storage_rules_test
191+
cd security_rules_test_storage
192192
193193
# Install dependencies
194194
npm install
@@ -209,21 +209,21 @@ Files to Create:
209209
- File type and size validations
210210
- Authentication and authorization logic
211211
212-
2. 'storage_rules_test/package.json'
212+
2. 'security_rules_test_storage/package.json'
213213
- Include dependencies: '@firebase/rules-unit-testing', 'jest'
214214
- Include scripts: 'test', 'emulator:start'
215215
- Use the provided Project ID and Bucket Name
216216
217-
3. 'storage_rules_test/firebase.json'
217+
3. 'security_rules_test_storage/firebase.json'
218218
- Configure Firebase Storage emulator
219219
- Reference the rules file
220220
- Use the provided Project ID and Bucket Name
221221
- Configure emulator port (default: 9199)
222222
223-
4. 'storage_rules_test/storage.rules'
223+
4. 'security_rules_test_storage/storage.rules'
224224
- Copy of the generated rules
225225
226-
5. 'storage_rules_test/tests/storage.test.js' (or '.ts' if TypeScript)
226+
5. 'security_rules_test_storage/tests/storage.test.js' (or '.ts' if TypeScript)
227227
- Complete test suite using '@firebase/rules-unit-testing'
228228
- All upload/read/delete operations tested
229229
- File type validation tests
@@ -232,15 +232,15 @@ Files to Create:
232232
- Clear test Descriptions
233233
- Helper functions for creating mock files
234234
235-
6. 'storage_rules_test/test-files/' (directory)
235+
6. 'security_rules_test_storage/test-files/' (directory)
236236
- Create mock files for testing:
237237
- 'test-image.jpg' (small valid image)
238238
- 'test-image-large.jpg' (oversized image for size validation)
239239
- 'test-document.pdf' (valid document)
240240
- 'test-invalid.exe' (invalid file type)
241241
- Or document how to generate these files in tests
242242
243-
7. 'storage_rules_test/README.md'
243+
7. 'security_rules_test_storage/README.md'
244244
- Setup instructions
245245
- How to run tests
246246
- How to deploy rules
@@ -254,7 +254,7 @@ Files to Create:
254254
3. **Do not modify rules during test validation** - only fix test code
255255
4. **Always use firebase_validate_security_rules** before generating the tests
256256
5. **Tests must be JavaScript / TypeScript only** - regardless of the codebase language
257-
6. **Create a self-contained test environment** - the 'storage_rules_test/' directory should be independently runnable
257+
6. **Create a self-contained test environment** - the 'security_rules_test_storage/' directory should be independently runnable
258258
7. **Provide complete, runnable code** - no placeholders or TODOs
259259
8. **Test with realistic file scenarios** - include various file types and sizes
260260
9. **Document all assumptions** about storage structure, file types, and access patterns

src/mcp/prompts/storage/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { ServerPrompt } from "../../prompt";
2-
import { generateRules } from "./generate_rules";
2+
import { generateSecurityRules } from "./generate_security_rules";
33

44
export const storagePrompts: ServerPrompt[] = [];
55

6-
storagePrompts.push(generateRules);
6+
storagePrompts.push(generateSecurityRules);

0 commit comments

Comments
 (0)