11import { 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
194194npm 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:
2542543. **Do not modify rules during test validation** - only fix test code
2552554. **Always use firebase_validate_security_rules** before generating the tests
2562565. **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
2582587. **Provide complete, runnable code** - no placeholders or TODOs
2592598. **Test with realistic file scenarios** - include various file types and sizes
2602609. **Document all assumptions** about storage structure, file types, and access patterns
0 commit comments