|
| 1 | +library: flame-cli |
| 2 | +description: > |
| 3 | + A developer-friendly CLI for interacting with Firebase Firestore databases. |
| 4 | + Primary use cases: seeding test data to the local emulator, one-off document |
| 5 | + operations, backups, and exports. Built with Stricli on Node.js >=22. |
| 6 | +repository: https://github.com/your-username/flame-cli |
| 7 | +domains: |
| 8 | + - id: setup |
| 9 | + name: Project Setup & Configuration |
| 10 | + description: > |
| 11 | + Initializing flame in a Firebase project, configuring emulator vs remote |
| 12 | + mode, and setting up authentication. Developers encounter this domain |
| 13 | + when first installing flame and when switching between environments. |
| 14 | + concepts: |
| 15 | + - .flame.json config file |
| 16 | + - .firebaserc project detection |
| 17 | + - firebase.json emulator settings |
| 18 | + - flame init command |
| 19 | + - flame use command |
| 20 | + - useEmulator flag |
| 21 | + - Application Default Credentials (ADC) |
| 22 | + - FIRESTORE_EMULATOR_HOST env var |
| 23 | + - Firebase CLI dependency for emulators |
| 24 | + |
| 25 | + - id: data-upload |
| 26 | + name: Uploading Documents |
| 27 | + description: > |
| 28 | + Writing documents to Firestore — single documents, collections from arrays, |
| 29 | + piped stdin, merge vs overwrite. The --idField flag is the most critical |
| 30 | + concept here and a common source of errors. |
| 31 | + concepts: |
| 32 | + - flame up command |
| 33 | + - document path vs collection path (even vs odd segments) |
| 34 | + - --idField flag |
| 35 | + - --data flag |
| 36 | + - --merge flag |
| 37 | + - stdin piping |
| 38 | + - array upload to collection |
| 39 | + - single doc to document path |
| 40 | + - single doc to collection path (requires --idField) |
| 41 | + - auto-generated IDs (collection.add) |
| 42 | + |
| 43 | + - id: data-read |
| 44 | + name: Reading & Exporting Documents |
| 45 | + description: > |
| 46 | + Downloading documents and collections, using output for pipelines and |
| 47 | + backup workflows. |
| 48 | + concepts: |
| 49 | + - flame down command |
| 50 | + - --limit flag |
| 51 | + - --docId flag (_id field inclusion) |
| 52 | + - collection vs document path detection |
| 53 | + - JSON output format |
| 54 | + - stdout piping |
| 55 | + - pipeline-friendly mode (no spinner when piping) |
| 56 | + |
| 57 | + - id: data-management |
| 58 | + name: Document Management |
| 59 | + description: > |
| 60 | + Copying, moving, and deleting documents. Move and copy are transactional. |
| 61 | + Delete requires confirmation unless --force is used, and prominently |
| 62 | + shows whether you are targeting EMULATOR or REMOTE. |
| 63 | + concepts: |
| 64 | + - flame delete / rm command |
| 65 | + - flame copy / cp command |
| 66 | + - flame move / mv command |
| 67 | + - flame collections command |
| 68 | + - --force flag (skip confirmation) |
| 69 | + - transactional move (source deleted only if destination write succeeds) |
| 70 | + - transactional copy |
| 71 | + - confirmation prompt showing EMULATOR vs REMOTE target |
| 72 | + - document-only constraint on copy/move |
| 73 | + |
| 74 | +path_routing: |
| 75 | + rule: > |
| 76 | + ALL commands that accept a path use the same routing logic: |
| 77 | + even number of segments = document path, odd number = collection path. |
| 78 | + examples: |
| 79 | + - path: "users" |
| 80 | + segments: 1 |
| 81 | + type: collection |
| 82 | + - path: "users/abc123" |
| 83 | + segments: 2 |
| 84 | + type: document |
| 85 | + - path: "users/abc123/orders" |
| 86 | + segments: 3 |
| 87 | + type: collection |
| 88 | + - path: "users/abc123/orders/order1" |
| 89 | + segments: 4 |
| 90 | + type: document |
| 91 | + |
| 92 | +failure_modes: |
| 93 | + - id: idfield-missing-collection-upload |
| 94 | + description: > |
| 95 | + Uploading a single document to a collection path without --idField throws |
| 96 | + "Must specify a document ID field with --idField!". Agents often omit |
| 97 | + --idField when the user hasn't mentioned it. |
| 98 | + severity: high |
| 99 | + |
| 100 | + - id: array-to-document-path |
| 101 | + description: > |
| 102 | + Uploading a JSON array to a document path (even segments) logs an error |
| 103 | + about needing --idField and a collection path. The error is silent (no |
| 104 | + throw), so the command exits without writing anything. |
| 105 | + severity: high |
| 106 | + |
| 107 | + - id: wrong-environment |
| 108 | + description: > |
| 109 | + Running write/delete commands while targeting remote Firestore when the |
| 110 | + developer intended the emulator (or vice versa). The delete command shows |
| 111 | + EMULATOR/REMOTE prominently in its confirmation prompt; up/down do not. |
| 112 | + Always verify with `flame status` before destructive operations against remote. |
| 113 | + severity: critical |
| 114 | + |
| 115 | + - id: adc-not-configured |
| 116 | + description: > |
| 117 | + Remote mode always calls applicationDefault(). If ADC is not set up |
| 118 | + (`gcloud auth application-default login` not run), all commands against |
| 119 | + remote will fail with a credentials error. The emulator also calls |
| 120 | + applicationDefault() but the FIRESTORE_EMULATOR_HOST env var bypasses |
| 121 | + actual auth checks. |
| 122 | + severity: high |
| 123 | + |
| 124 | + - id: idfield-value-undefined |
| 125 | + description: > |
| 126 | + If --idField is specified but the field is missing or undefined on a |
| 127 | + document in the array, the command throws "Document N does not have ID |
| 128 | + field X!". Every document in the array must contain the specified field. |
| 129 | + severity: medium |
| 130 | + |
| 131 | + - id: copy-move-collection-paths |
| 132 | + description: > |
| 133 | + flame copy and flame move only accept document paths (even segments). |
| 134 | + Passing a collection path throws "Source and destination paths must be |
| 135 | + documents". There is no bulk copy/move. |
| 136 | + severity: medium |
| 137 | + |
| 138 | + - id: delete-collection-not-recursive |
| 139 | + description: > |
| 140 | + flame delete on a collection path deletes only the direct documents in |
| 141 | + that collection. Subcollections are NOT deleted. Firestore subcollection |
| 142 | + documents will remain after the parent collection is cleared. |
| 143 | + severity: medium |
| 144 | + |
| 145 | + - id: firebase-project-not-found |
| 146 | + description: > |
| 147 | + All commands require .firebaserc and firebase.json to be present in the |
| 148 | + working directory or a parent directory. Running flame outside a Firebase |
| 149 | + project directory fails with "No firebaserc file found!". |
| 150 | + severity: high |
0 commit comments