When to Use
- User wants to sync YAML schemas to Google Sheets (
push)
- User wants to sync Google Sheets to YAML schemas (
pull)
- User mentions "sincronizar", "spreadsheet", "google sheets", "exportar schemas"
- Troubleshooting sync issues or configuration problems
Critical Patterns
1. Spreadsheet Structure
| Sheet |
Purpose |
DATA |
Dropdown values, validations (don't modify) |
TEMPLATE |
Template duplicated for new modules |
MODULES |
Index with hyperlinks to module sheets |
{module-name} |
One sheet per module (e.g., business-partner) |
2. Module Sheet Format
- Row 1: Headers (read dynamically)
- Row 2+: Properties (one per row)
- Booleans:
✓ (CHAR 9989) = true, empty = false
3. Pull is Idempotent
Rule: If no content changes in spreadsheet, YAML files must NOT be modified.
// Content comparison before writing
if (normalizeYamlForComparison(existing) === normalizeYamlForComparison(new)) {
// Skip write - preserves original formatting
}
4. Preserve Fields Not in Spreadsheet
Fields in YAML without spreadsheet columns are preserved on pull:
relationship.singularName, relationship.aggregateName, relationship.modulePath
relationship.key, relationship.field, relationship.avoidConstraint
webComponent
5. Field Mappings
| Sheet Column |
YAML Field |
Notes |
relationship |
relationship.type |
1:1, N:1, 1:N, N:N |
master |
relationship.modulePath |
Module name only |
subtype |
arrayOptions.type |
When type=array |
values |
Multiple |
enumOptions, decimals, or arrayOptions.enumOptions |
hasAuth |
hasOAuth |
Header mapping |
6. Array Format in YAML
Inline format [A, B, C]:
enumOptions
decimals
defaultValue (when array)
Multi-line format (for readability):
excludedOperations
excludedFiles
7. Nullable and DefaultValue Rules
- nullable: If not checked (✓), defaults to
false (never undefined)
- defaultValue: Wrapped in array
[value] when type=array
- description: Format preserved even when field is renamed (matched by content)
Commands
# Navigate to tool directory
cd scripts/aurora-sheets-sync
# Install dependencies (first time)
npm install
# Push: YAML → Google Sheets
npx ts-node src/index.ts push --bc business-partner-portal
npx ts-node src/index.ts push --all
npx ts-node src/index.ts push --bc iam --dry-run
# Pull: Google Sheets → YAML
npx ts-node src/index.ts pull --bc business-partner-portal
npx ts-node src/index.ts pull --bc iam --no-backup
npx ts-node src/index.ts pull --all --dry-run
# Validate connection
npx ts-node src/index.ts validate --bc business-partner-portal
# List configured bounded contexts
npx ts-node src/index.ts list
Configuration
aurora-sheets.config.json
{
"credentialsPath": "./scripts/aurora-sheets-sync/credentials/service-account.json",
"boundedContexts": {
"business-partner-portal": {
"spreadsheetId": "1ABC123xyz...",
"description": "Business Partner Portal"
}
},
"backupsPath": "backups/aurora-schemas",
"cliterPath": "cliter"
}
Google Cloud Setup (Quick Reference)
- Create project in Google Cloud Console
- Enable Google Sheets API (APIs & Services → Library)
- Create Service Account (APIs & Services → Credentials)
- Download JSON key → save to
credentials/service-account.json
- Share spreadsheet with service account email (Editor role)
Troubleshooting
| Error |
Solution |
The caller does not have permission |
Share spreadsheet with service account email |
Google Sheets API has not been enabled |
Enable API in Google Cloud Console |
Could not load credentials |
Check credentialsPath in config |
Skipped: X (empty or invalid) |
Sheet missing headers or name/type columns |
| Pull shows "(no changes)" |
Idempotent - content unchanged, file preserved |
Key Files
scripts/aurora-sheets-sync/
├── src/
│ ├── index.ts # CLI entry point
│ ├── sync/
│ │ ├── yaml-to-sheet.ts # Push logic
│ │ └── sheet-to-yaml.ts # Pull logic (idempotent)
│ └── transformers/
│ └── property-transformer.ts # YAML ↔ Row conversion
├── credentials/
│ └── service-account.json # Google credentials (gitignored)
├── CONTEXT.md # Technical documentation
└── README.md # User guide
Resources
1---2name: aurora-sheets-sync3description: Bidirectional sync between Aurora YAML schemas and Google Sheets. Trigger: When syncing schemas to/from spreadsheets, push/pull commands, google sheets sync.4license: MIT5---6
7## When to Use
8
9- User wants to sync YAML schemas to Google Sheets (`push`)
10- User wants to sync Google Sheets to YAML schemas (`pull`)
11- User mentions "sincronizar", "spreadsheet", "google sheets", "exportar schemas"
12- Troubleshooting sync issues or configuration problems
13
14---
15
16## Critical Patterns
17
18### 1. Spreadsheet Structure
19
20| Sheet | Purpose |
21|-------|---------|
22| `DATA` | Dropdown values, validations (don't modify) |
23| `TEMPLATE` | Template duplicated for new modules |
24| `MODULES` | Index with hyperlinks to module sheets |
25| `{module-name}` | One sheet per module (e.g., `business-partner`) |
26
27### 2. Module Sheet Format
28
29- **Row 1**: Headers (read dynamically)
30- **Row 2+**: Properties (one per row)
31- **Booleans**: `✓` (CHAR 9989) = true, empty = false
32
33### 3. Pull is Idempotent
34
35**Rule**: If no content changes in spreadsheet, YAML files must NOT be modified.
36
37```typescript
38// Content comparison before writing
39if (normalizeYamlForComparison(existing) === normalizeYamlForComparison(new)) {
40 // Skip write - preserves original formatting
41}
42```
43
44### 4. Preserve Fields Not in Spreadsheet
45
46Fields in YAML without spreadsheet columns are preserved on pull:
47- `relationship.singularName`, `relationship.aggregateName`, `relationship.modulePath`
48- `relationship.key`, `relationship.field`, `relationship.avoidConstraint`
49- `webComponent`
50
51### 5. Field Mappings
52
53| Sheet Column | YAML Field | Notes |
54|--------------|------------|-------|
55| `relationship` | `relationship.type` | `1:1`, `N:1`, `1:N`, `N:N` |
56| `master` | `relationship.modulePath` | Module name only |
57| `subtype` | `arrayOptions.type` | When `type=array` |
58| `values` | Multiple | `enumOptions`, `decimals`, or `arrayOptions.enumOptions` |
59| `hasAuth` | `hasOAuth` | Header mapping |
60
61### 6. Array Format in YAML
62
63**Inline format** `[A, B, C]`:
64- `enumOptions`
65- `decimals`
66- `defaultValue` (when array)
67
68**Multi-line format** (for readability):
69- `excludedOperations`
70- `excludedFiles`
71
72### 7. Nullable and DefaultValue Rules
73
74- **nullable**: If not checked (✓), defaults to `false` (never undefined)
75- **defaultValue**: Wrapped in array `[value]` when `type=array`
76- **description**: Format preserved even when field is renamed (matched by content)
77
78---
79
80## Commands
81
82```bash
83# Navigate to tool directory
84cd scripts/aurora-sheets-sync
85
86# Install dependencies (first time)
87npm install
88
89# Push: YAML → Google Sheets
90npx ts-node src/index.ts push --bc business-partner-portal
91npx ts-node src/index.ts push --all
92npx ts-node src/index.ts push --bc iam --dry-run
93
94# Pull: Google Sheets → YAML
95npx ts-node src/index.ts pull --bc business-partner-portal
96npx ts-node src/index.ts pull --bc iam --no-backup
97npx ts-node src/index.ts pull --all --dry-run
98
99# Validate connection
100npx ts-node src/index.ts validate --bc business-partner-portal
101
102# List configured bounded contexts
103npx ts-node src/index.ts list
104```
105
106---
107
108## Configuration
109
110### aurora-sheets.config.json
111
112```json
113{
114 "credentialsPath": "./scripts/aurora-sheets-sync/credentials/service-account.json",
115 "boundedContexts": {
116 "business-partner-portal": {
117 "spreadsheetId": "1ABC123xyz...",
118 "description": "Business Partner Portal"
119 }
120 },
121 "backupsPath": "backups/aurora-schemas",
122 "cliterPath": "cliter"
123}
124```
125
126### Google Cloud Setup (Quick Reference)
127
1281. Create project in [Google Cloud Console](https://console.cloud.google.com/)
1292. Enable **Google Sheets API** (APIs & Services → Library)
1303. Create **Service Account** (APIs & Services → Credentials)
1314. Download JSON key → save to `credentials/service-account.json`
1325. Share spreadsheet with service account email (Editor role)
133
134---
135
136## Troubleshooting
137
138| Error | Solution |
139|-------|----------|
140| `The caller does not have permission` | Share spreadsheet with service account email |
141| `Google Sheets API has not been enabled` | Enable API in Google Cloud Console |
142| `Could not load credentials` | Check `credentialsPath` in config |
143| `Skipped: X (empty or invalid)` | Sheet missing headers or `name`/`type` columns |
144| Pull shows "(no changes)" | Idempotent - content unchanged, file preserved |
145
146---
147
148## Key Files
149
150```
151scripts/aurora-sheets-sync/
152├── src/
153│ ├── index.ts # CLI entry point
154│ ├── sync/
155│ │ ├── yaml-to-sheet.ts # Push logic
156│ │ └── sheet-to-yaml.ts # Pull logic (idempotent)
157│ └── transformers/
158│ └── property-transformer.ts # YAML ↔ Row conversion
159├── credentials/
160│ └── service-account.json # Google credentials (gitignored)
161├── CONTEXT.md # Technical documentation
162└── README.md # User guide
163```
164
165---
166
167## Resources
168
169- **Technical Context**: See [CONTEXT.md](../../../scripts/aurora-sheets-sync/CONTEXT.md)
170- **User Guide**: See [README.md](../../../scripts/aurora-sheets-sync/README.md)