@mytechtoday/augment-extensions 0.2.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +614 -39
- package/augment-extensions/coding-standards/bash/README.md +196 -0
- package/augment-extensions/coding-standards/bash/module.json +163 -0
- package/augment-extensions/coding-standards/bash/rules/naming-conventions.md +336 -0
- package/augment-extensions/coding-standards/bash/rules/universal-standards.md +289 -0
- package/augment-extensions/coding-standards/css/README.md +40 -0
- package/augment-extensions/coding-standards/css/examples/css-examples.css +550 -0
- package/augment-extensions/coding-standards/css/module.json +44 -0
- package/augment-extensions/coding-standards/css/rules/css-modern-features.md +448 -0
- package/augment-extensions/coding-standards/css/rules/css-standards.md +492 -0
- package/augment-extensions/coding-standards/html/README.md +40 -0
- package/augment-extensions/coding-standards/html/examples/html-examples.html +267 -0
- package/augment-extensions/coding-standards/html/examples/responsive-layout.html +505 -0
- package/augment-extensions/coding-standards/html/module.json +44 -0
- package/augment-extensions/coding-standards/html/rules/html-standards.md +349 -0
- package/augment-extensions/coding-standards/html-css-js/README.md +194 -0
- package/augment-extensions/coding-standards/html-css-js/examples/async-examples.js +487 -0
- package/augment-extensions/coding-standards/html-css-js/examples/css-examples.css +550 -0
- package/augment-extensions/coding-standards/html-css-js/examples/dom-examples.js +667 -0
- package/augment-extensions/coding-standards/html-css-js/examples/html-examples.html +267 -0
- package/augment-extensions/coding-standards/html-css-js/examples/javascript-examples.js +612 -0
- package/augment-extensions/coding-standards/html-css-js/examples/responsive-layout.html +505 -0
- package/augment-extensions/coding-standards/html-css-js/module.json +48 -0
- package/augment-extensions/coding-standards/html-css-js/rules/async-patterns.md +515 -0
- package/augment-extensions/coding-standards/html-css-js/rules/css-modern-features.md +448 -0
- package/augment-extensions/coding-standards/html-css-js/rules/css-standards.md +492 -0
- package/augment-extensions/coding-standards/html-css-js/rules/dom-manipulation.md +439 -0
- package/augment-extensions/coding-standards/html-css-js/rules/html-standards.md +349 -0
- package/augment-extensions/coding-standards/html-css-js/rules/javascript-standards.md +486 -0
- package/augment-extensions/coding-standards/html-css-js/rules/performance.md +463 -0
- package/augment-extensions/coding-standards/html-css-js/rules/tooling.md +543 -0
- package/augment-extensions/coding-standards/js/README.md +46 -0
- package/augment-extensions/coding-standards/js/examples/async-examples.js +487 -0
- package/augment-extensions/coding-standards/js/examples/dom-examples.js +667 -0
- package/augment-extensions/coding-standards/js/examples/javascript-examples.js +612 -0
- package/augment-extensions/coding-standards/js/module.json +49 -0
- package/augment-extensions/coding-standards/js/rules/async-patterns.md +515 -0
- package/augment-extensions/coding-standards/js/rules/dom-manipulation.md +439 -0
- package/augment-extensions/coding-standards/js/rules/javascript-standards.md +486 -0
- package/augment-extensions/coding-standards/js/rules/performance.md +463 -0
- package/augment-extensions/coding-standards/js/rules/tooling.md +543 -0
- package/augment-extensions/coding-standards/php/README.md +248 -0
- package/augment-extensions/coding-standards/php/examples/api-endpoint-example.php +204 -0
- package/augment-extensions/coding-standards/php/examples/cli-command-example.php +206 -0
- package/augment-extensions/coding-standards/php/examples/legacy-refactoring-example.php +234 -0
- package/augment-extensions/coding-standards/php/examples/web-application-example.php +211 -0
- package/augment-extensions/coding-standards/php/examples/woocommerce-extension-example.php +215 -0
- package/augment-extensions/coding-standards/php/examples/wordpress-plugin-example.php +189 -0
- package/augment-extensions/coding-standards/php/module.json +166 -0
- package/augment-extensions/coding-standards/php/rules/api-development.md +480 -0
- package/augment-extensions/coding-standards/php/rules/category-configuration.md +332 -0
- package/augment-extensions/coding-standards/php/rules/cli-tools.md +472 -0
- package/augment-extensions/coding-standards/php/rules/cms-integration.md +561 -0
- package/augment-extensions/coding-standards/php/rules/code-quality.md +402 -0
- package/augment-extensions/coding-standards/php/rules/documentation.md +425 -0
- package/augment-extensions/coding-standards/php/rules/ecommerce.md +627 -0
- package/augment-extensions/coding-standards/php/rules/error-handling.md +336 -0
- package/augment-extensions/coding-standards/php/rules/legacy-migration.md +677 -0
- package/augment-extensions/coding-standards/php/rules/naming-conventions.md +279 -0
- package/augment-extensions/coding-standards/php/rules/performance.md +392 -0
- package/augment-extensions/coding-standards/php/rules/psr-standards.md +186 -0
- package/augment-extensions/coding-standards/php/rules/security.md +358 -0
- package/augment-extensions/coding-standards/php/rules/testing.md +403 -0
- package/augment-extensions/coding-standards/php/rules/type-declarations.md +331 -0
- package/augment-extensions/coding-standards/php/rules/web-applications.md +426 -0
- package/augment-extensions/coding-standards/powershell/README.md +154 -0
- package/augment-extensions/coding-standards/powershell/examples/admin-example.ps1 +272 -0
- package/augment-extensions/coding-standards/powershell/examples/automation-example.ps1 +173 -0
- package/augment-extensions/coding-standards/powershell/examples/cloud-example.ps1 +243 -0
- package/augment-extensions/coding-standards/powershell/examples/cross-platform-example.ps1 +297 -0
- package/augment-extensions/coding-standards/powershell/examples/dsc-example.ps1 +224 -0
- package/augment-extensions/coding-standards/powershell/examples/legacy-migration-example.ps1 +340 -0
- package/augment-extensions/coding-standards/powershell/examples/module-example.psm1 +255 -0
- package/augment-extensions/coding-standards/powershell/module.json +165 -0
- package/augment-extensions/coding-standards/powershell/rules/administrative-tools.md +439 -0
- package/augment-extensions/coding-standards/powershell/rules/automation-scripts.md +240 -0
- package/augment-extensions/coding-standards/powershell/rules/cloud-orchestration.md +384 -0
- package/augment-extensions/coding-standards/powershell/rules/configuration-schema.md +383 -0
- package/augment-extensions/coding-standards/powershell/rules/cross-platform-scripts.md +482 -0
- package/augment-extensions/coding-standards/powershell/rules/dsc-configurations.md +296 -0
- package/augment-extensions/coding-standards/powershell/rules/error-handling.md +314 -0
- package/augment-extensions/coding-standards/powershell/rules/legacy-migrations.md +466 -0
- package/augment-extensions/coding-standards/powershell/rules/modules-functions.md +244 -0
- package/augment-extensions/coding-standards/powershell/rules/naming-conventions.md +266 -0
- package/augment-extensions/coding-standards/powershell/rules/performance-optimization.md +209 -0
- package/augment-extensions/coding-standards/powershell/rules/security-practices.md +314 -0
- package/augment-extensions/coding-standards/powershell/rules/testing-guidelines.md +268 -0
- package/augment-extensions/coding-standards/powershell/rules/universal-standards.md +197 -0
- package/augment-extensions/coding-standards/python/README.md +12 -8
- package/augment-extensions/coding-standards/python/examples/best-practices.py +373 -0
- package/augment-extensions/coding-standards/python/module.json +8 -4
- package/augment-extensions/coding-standards/python/rules/async-patterns.md +884 -0
- package/augment-extensions/coding-standards/python/rules/documentation.md +831 -0
- package/augment-extensions/coding-standards/python/rules/error-handling.md +855 -68
- package/augment-extensions/coding-standards/python/rules/testing.md +409 -0
- package/augment-extensions/coding-standards/python/rules/tooling.md +446 -0
- package/augment-extensions/coding-standards/python/rules/type-hints.md +115 -50
- package/augment-extensions/collections/html-css-js/README.md +82 -0
- package/augment-extensions/collections/html-css-js/collection.json +41 -0
- package/augment-extensions/domain-rules/database/README.md +161 -0
- package/augment-extensions/domain-rules/database/examples/flat-database-example.md +793 -0
- package/augment-extensions/domain-rules/database/examples/hybrid-database-example.md +1132 -0
- package/augment-extensions/domain-rules/database/examples/nosql-document-example.md +868 -0
- package/augment-extensions/domain-rules/database/examples/nosql-graph-example.md +805 -0
- package/augment-extensions/domain-rules/database/examples/relational-schema-example.md +621 -0
- package/augment-extensions/domain-rules/database/examples/vector-database-example.md +965 -0
- package/augment-extensions/domain-rules/database/module.json +28 -0
- package/augment-extensions/domain-rules/database/rules/flat-databases.md +624 -0
- package/augment-extensions/domain-rules/database/rules/nosql-databases.md +588 -0
- package/augment-extensions/domain-rules/database/rules/nosql-document-stores.md +856 -0
- package/augment-extensions/domain-rules/database/rules/nosql-graph-databases.md +778 -0
- package/augment-extensions/domain-rules/database/rules/nosql-key-value-stores.md +963 -0
- package/augment-extensions/domain-rules/database/rules/performance-optimization.md +1076 -0
- package/augment-extensions/domain-rules/database/rules/relational-databases.md +697 -0
- package/augment-extensions/domain-rules/database/rules/relational-indexing.md +671 -0
- package/augment-extensions/domain-rules/database/rules/relational-query-optimization.md +607 -0
- package/augment-extensions/domain-rules/database/rules/relational-schema-design.md +907 -0
- package/augment-extensions/domain-rules/database/rules/relational-transactions.md +783 -0
- package/augment-extensions/domain-rules/database/rules/security-standards.md +980 -0
- package/augment-extensions/domain-rules/database/rules/universal-best-practices.md +485 -0
- package/augment-extensions/domain-rules/database/rules/vector-databases.md +521 -0
- package/augment-extensions/domain-rules/database/rules/vector-embeddings.md +858 -0
- package/augment-extensions/domain-rules/database/rules/vector-indexing.md +934 -0
- package/augment-extensions/domain-rules/design/color/themes/catppuccin-latte/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/catppuccin-latte/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/catppuccin-mocha/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/catppuccin-mocha/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/dracula/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/dracula/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/gruvbox-dark/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/gruvbox-dark/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/gruvbox-light/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/gruvbox-light/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/high-contrast/README.md +27 -0
- package/augment-extensions/domain-rules/design/color/themes/high-contrast/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/monokai/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/monokai/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/nord/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/nord/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/one-dark/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/one-dark/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/one-light/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/one-light/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/solarized-dark/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/solarized-dark/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/solarized-light/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/solarized-light/module.json +26 -0
- package/augment-extensions/domain-rules/design/color/themes/tokyo-night/README.md +23 -0
- package/augment-extensions/domain-rules/design/color/themes/tokyo-night/module.json +26 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/README.md +136 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/SCHEMA-VALIDATION-REPORT.md +216 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/brand-kit-example.yaml +292 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/campaign-brief-example.yaml +389 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/content-calendar-example.yaml +643 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/email-newsletter-example.md +376 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/landing-page-example.md +934 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/ppc-ad-copy-example.md +301 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/seo-blog-post-example.md +347 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/examples/social-media-campaign-example.md +606 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/module.json +50 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/affiliate-influencer-marketing.md +593 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/asset-management.md +418 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/brand-consistency.md +210 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/content-marketing.md +337 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/conversion-optimization.md +455 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/direct-sales.md +499 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/email-marketing.md +439 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/legal-compliance.md +227 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/ppc-advertising.md +569 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/seo-optimization.md +470 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/social-media-marketing.md +414 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/rules/universal-marketing.md +177 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/schemas/asset-inventory.schema.json +247 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/schemas/brand-kit.schema.json +326 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/schemas/campaign-brief.schema.json +342 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/schemas/color-palette.schema.json +223 -0
- package/augment-extensions/domain-rules/marketing-standards/seo-sales-marketing/schemas/content-template.schema.json +383 -0
- package/augment-extensions/domain-rules/mcp/README.md +150 -0
- package/augment-extensions/domain-rules/mcp/examples/compressed-example.md +522 -0
- package/augment-extensions/domain-rules/mcp/examples/graph-augmented-example.md +520 -0
- package/augment-extensions/domain-rules/mcp/examples/hybrid-example.md +570 -0
- package/augment-extensions/domain-rules/mcp/examples/state-based-example.md +427 -0
- package/augment-extensions/domain-rules/mcp/examples/token-based-example.md +435 -0
- package/augment-extensions/domain-rules/mcp/examples/vector-based-example.md +502 -0
- package/augment-extensions/domain-rules/mcp/module.json +49 -0
- package/augment-extensions/domain-rules/mcp/rules/compressed-mcp.md +595 -0
- package/augment-extensions/domain-rules/mcp/rules/configuration.md +345 -0
- package/augment-extensions/domain-rules/mcp/rules/graph-augmented-mcp.md +687 -0
- package/augment-extensions/domain-rules/mcp/rules/hybrid-mcp.md +636 -0
- package/augment-extensions/domain-rules/mcp/rules/state-based-mcp.md +484 -0
- package/augment-extensions/domain-rules/mcp/rules/testing-validation.md +360 -0
- package/augment-extensions/domain-rules/mcp/rules/token-based-mcp.md +393 -0
- package/augment-extensions/domain-rules/mcp/rules/universal-rules.md +194 -0
- package/augment-extensions/domain-rules/mcp/rules/vector-based-mcp.md +625 -0
- package/augment-extensions/workflows/beads/module.json +4 -3
- package/augment-extensions/workflows/beads-integration/IMPLEMENTATION-STATUS.md +145 -0
- package/augment-extensions/workflows/beads-integration/README.md +143 -0
- package/augment-extensions/workflows/beads-integration/config/defaults.json +32 -0
- package/augment-extensions/workflows/beads-integration/config/schema.json +140 -0
- package/augment-extensions/workflows/beads-integration/examples/basic-task-generation.md +293 -0
- package/augment-extensions/workflows/beads-integration/module.json +75 -0
- package/augment-extensions/workflows/beads-integration/rules/core-rules.md +219 -0
- package/augment-extensions/workflows/beads-integration/rules/effectiveness-standards.md +256 -0
- package/augment-extensions/workflows/beads-integration/rules/task-generation.md +607 -0
- package/augment-extensions/workflows/database/README.md +195 -0
- package/augment-extensions/workflows/database/ai-prompt-testing.md +295 -0
- package/augment-extensions/workflows/database/examples/migration-example.md +498 -0
- package/augment-extensions/workflows/database/examples/optimization-example.md +496 -0
- package/augment-extensions/workflows/database/examples/schema-design-example.md +444 -0
- package/augment-extensions/workflows/database/module.json +42 -0
- package/augment-extensions/workflows/database/rules/data-migration.md +249 -0
- package/augment-extensions/workflows/database/rules/documentation-standards.md +339 -0
- package/augment-extensions/workflows/database/rules/migration-workflow.md +352 -0
- package/augment-extensions/workflows/database/rules/optimization-workflow.md +435 -0
- package/augment-extensions/workflows/database/rules/schema-design-workflow.md +535 -0
- package/augment-extensions/workflows/database/rules/testing-patterns.md +305 -0
- package/augment-extensions/workflows/database/rules/workflow.md +458 -0
- package/augment-extensions/workflows/openspec/module.json +4 -3
- package/augment-extensions/writing-standards/screenplay/README.md +300 -0
- package/augment-extensions/writing-standards/screenplay/_templates/README.md +121 -0
- package/augment-extensions/writing-standards/screenplay/_templates/genre-template.md +153 -0
- package/augment-extensions/writing-standards/screenplay/_templates/style-template.md +243 -0
- package/augment-extensions/writing-standards/screenplay/_templates/theme-template.md +213 -0
- package/augment-extensions/writing-standards/screenplay/examples/aaa-hollywood-scene.fountain +164 -0
- package/augment-extensions/writing-standards/screenplay/examples/beat-sheet-example.yaml +95 -0
- package/augment-extensions/writing-standards/screenplay/examples/character-profile-example.yaml +116 -0
- package/augment-extensions/writing-standards/screenplay/examples/commercial-30sec.fountain +151 -0
- package/augment-extensions/writing-standards/screenplay/examples/independent-monologue.fountain +67 -0
- package/augment-extensions/writing-standards/screenplay/examples/news-segment.fountain +142 -0
- package/augment-extensions/writing-standards/screenplay/examples/plot-outline-example.yaml +184 -0
- package/augment-extensions/writing-standards/screenplay/examples/tv-episode-teaser.fountain +204 -0
- package/augment-extensions/writing-standards/screenplay/genres/README.md +181 -0
- package/augment-extensions/writing-standards/screenplay/genres/examples/.gitkeep +2 -0
- package/augment-extensions/writing-standards/screenplay/genres/module.json +70 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/.gitkeep +2 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/action.md +399 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/adventure.md +407 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/animation.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/biographical.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/comedy.md +401 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/documentary.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/drama.md +409 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/fantasy.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/historical.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/horror.md +268 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/musical.md +294 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/mystery.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/noir.md +294 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/romance.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/sci-fi.md +289 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/superhero.md +293 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/thriller.md +294 -0
- package/augment-extensions/writing-standards/screenplay/genres/rules/western.md +293 -0
- package/augment-extensions/writing-standards/screenplay/module.json +124 -0
- package/augment-extensions/writing-standards/screenplay/rules/aaa-hollywood-films.md +339 -0
- package/augment-extensions/writing-standards/screenplay/rules/ai-integration-testing.md +329 -0
- package/augment-extensions/writing-standards/screenplay/rules/character-development.md +169 -0
- package/augment-extensions/writing-standards/screenplay/rules/commercials.md +437 -0
- package/augment-extensions/writing-standards/screenplay/rules/dialogue-writing.md +263 -0
- package/augment-extensions/writing-standards/screenplay/rules/diversity-inclusion.md +261 -0
- package/augment-extensions/writing-standards/screenplay/rules/examples-guide.md +315 -0
- package/augment-extensions/writing-standards/screenplay/rules/formatting-validation.md +413 -0
- package/augment-extensions/writing-standards/screenplay/rules/fountain-format.md +372 -0
- package/augment-extensions/writing-standards/screenplay/rules/independent-films.md +374 -0
- package/augment-extensions/writing-standards/screenplay/rules/live-tv-productions.md +443 -0
- package/augment-extensions/writing-standards/screenplay/rules/narrative-structures.md +207 -0
- package/augment-extensions/writing-standards/screenplay/rules/news-broadcasts.md +444 -0
- package/augment-extensions/writing-standards/screenplay/rules/pacing-timing.md +331 -0
- package/augment-extensions/writing-standards/screenplay/rules/quality-review-checklist.md +334 -0
- package/augment-extensions/writing-standards/screenplay/rules/quick-reference.md +299 -0
- package/augment-extensions/writing-standards/screenplay/rules/screen-continuity.md +263 -0
- package/augment-extensions/writing-standards/screenplay/rules/streaming-content.md +412 -0
- package/augment-extensions/writing-standards/screenplay/rules/trope-management.md +370 -0
- package/augment-extensions/writing-standards/screenplay/rules/tv-series.md +374 -0
- package/augment-extensions/writing-standards/screenplay/rules/universal-formatting.md +339 -0
- package/augment-extensions/writing-standards/screenplay/rules/vscode-integration.md +277 -0
- package/augment-extensions/writing-standards/screenplay/rules/web-content.md +393 -0
- package/augment-extensions/writing-standards/screenplay/schemas/beat-sheet.json +332 -0
- package/augment-extensions/writing-standards/screenplay/schemas/character-profile.json +247 -0
- package/augment-extensions/writing-standards/screenplay/schemas/feature-selection.json +200 -0
- package/augment-extensions/writing-standards/screenplay/schemas/plot-outline.json +233 -0
- package/augment-extensions/writing-standards/screenplay/schemas/screenplay-config.json +245 -0
- package/augment-extensions/writing-standards/screenplay/schemas/trope-inventory.json +221 -0
- package/augment-extensions/writing-standards/screenplay/styles/README.md +159 -0
- package/augment-extensions/writing-standards/screenplay/styles/examples/.gitkeep +2 -0
- package/augment-extensions/writing-standards/screenplay/styles/examples/style-applications.md +1449 -0
- package/augment-extensions/writing-standards/screenplay/styles/module.json +64 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/.gitkeep +2 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/dialogue-centric.md +520 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/ensemble.md +499 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/epic.md +497 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/experimental.md +492 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/flashback.md +509 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/linear.md +490 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/minimalist.md +499 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/non-linear.md +501 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/poetic.md +499 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/realistic.md +498 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/satirical.md +499 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/surreal.md +508 -0
- package/augment-extensions/writing-standards/screenplay/styles/rules/voice-over.md +500 -0
- package/augment-extensions/writing-standards/screenplay/themes/README.md +158 -0
- package/augment-extensions/writing-standards/screenplay/themes/examples/.gitkeep +2 -0
- package/augment-extensions/writing-standards/screenplay/themes/examples/common-mistakes-and-fixes.md +643 -0
- package/augment-extensions/writing-standards/screenplay/themes/examples/complete-scene-example.md +311 -0
- package/augment-extensions/writing-standards/screenplay/themes/examples/individual-theme-examples.md +562 -0
- package/augment-extensions/writing-standards/screenplay/themes/examples/multi-theme-weaving.md +538 -0
- package/augment-extensions/writing-standards/screenplay/themes/examples/theme-application-guide.md +432 -0
- package/augment-extensions/writing-standards/screenplay/themes/examples/theme-integration-across-acts.md +637 -0
- package/augment-extensions/writing-standards/screenplay/themes/module.json +66 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/.gitkeep +2 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/ambition.md +458 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/betrayal.md +490 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/environment.md +458 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/fate.md +459 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/friendship.md +491 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/growth.md +491 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/identity.md +490 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/isolation.md +464 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/justice.md +461 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/love.md +489 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/power.md +494 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/redemption.md +483 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/revenge.md +489 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/survival.md +496 -0
- package/augment-extensions/writing-standards/screenplay/themes/rules/technology.md +463 -0
- package/cli/MODULES.md +302 -0
- package/cli/dist/cli.js +168 -10
- package/cli/dist/cli.js.map +1 -1
- package/cli/dist/commands/catalog.d.ts +13 -0
- package/cli/dist/commands/catalog.d.ts.map +1 -0
- package/cli/dist/commands/catalog.js +104 -0
- package/cli/dist/commands/catalog.js.map +1 -0
- package/cli/dist/commands/gui.d.ts +6 -0
- package/cli/dist/commands/gui.d.ts.map +1 -0
- package/cli/dist/commands/gui.js +211 -0
- package/cli/dist/commands/gui.js.map +1 -0
- package/cli/dist/commands/init.d.ts.map +1 -1
- package/cli/dist/commands/init.js +12 -0
- package/cli/dist/commands/init.js.map +1 -1
- package/cli/dist/commands/install-rules.d.ts +14 -0
- package/cli/dist/commands/install-rules.d.ts.map +1 -0
- package/cli/dist/commands/install-rules.js +127 -0
- package/cli/dist/commands/install-rules.js.map +1 -0
- package/cli/dist/commands/link.d.ts.map +1 -1
- package/cli/dist/commands/link.js +9 -11
- package/cli/dist/commands/link.js.map +1 -1
- package/cli/dist/commands/list.d.ts.map +1 -1
- package/cli/dist/commands/list.js +11 -28
- package/cli/dist/commands/list.js.map +1 -1
- package/cli/dist/commands/mcp.d.ts +48 -0
- package/cli/dist/commands/mcp.d.ts.map +1 -0
- package/cli/dist/commands/mcp.js +229 -0
- package/cli/dist/commands/mcp.js.map +1 -0
- package/cli/dist/commands/self-remove.d.ts +7 -0
- package/cli/dist/commands/self-remove.d.ts.map +1 -0
- package/cli/dist/commands/self-remove.js +179 -0
- package/cli/dist/commands/self-remove.js.map +1 -0
- package/cli/dist/commands/show.d.ts +19 -0
- package/cli/dist/commands/show.d.ts.map +1 -1
- package/cli/dist/commands/show.js +478 -63
- package/cli/dist/commands/show.js.map +1 -1
- package/cli/dist/commands/skill.d.ts +67 -0
- package/cli/dist/commands/skill.d.ts.map +1 -0
- package/cli/dist/commands/skill.js +513 -0
- package/cli/dist/commands/skill.js.map +1 -0
- package/cli/dist/commands/unlink.d.ts +6 -0
- package/cli/dist/commands/unlink.d.ts.map +1 -0
- package/cli/dist/commands/unlink.js +115 -0
- package/cli/dist/commands/unlink.js.map +1 -0
- package/cli/dist/commands/validate.d.ts +6 -0
- package/cli/dist/commands/validate.d.ts.map +1 -0
- package/cli/dist/commands/validate.js +159 -0
- package/cli/dist/commands/validate.js.map +1 -0
- package/cli/dist/types/gui.d.ts +62 -0
- package/cli/dist/types/gui.d.ts.map +1 -0
- package/cli/dist/types/gui.js +30 -0
- package/cli/dist/types/gui.js.map +1 -0
- package/cli/dist/utils/catalog-sync.d.ts +22 -0
- package/cli/dist/utils/catalog-sync.d.ts.map +1 -0
- package/cli/dist/utils/catalog-sync.js +157 -0
- package/cli/dist/utils/catalog-sync.js.map +1 -0
- package/cli/dist/utils/character-count.d.ts +56 -0
- package/cli/dist/utils/character-count.d.ts.map +1 -0
- package/cli/dist/utils/character-count.js +190 -0
- package/cli/dist/utils/character-count.js.map +1 -0
- package/cli/dist/utils/documentation-validator.d.ts +18 -0
- package/cli/dist/utils/documentation-validator.d.ts.map +1 -0
- package/cli/dist/utils/documentation-validator.js +233 -0
- package/cli/dist/utils/documentation-validator.js.map +1 -0
- package/cli/dist/utils/gui-helpers.d.ts +23 -0
- package/cli/dist/utils/gui-helpers.d.ts.map +1 -0
- package/cli/dist/utils/gui-helpers.js +159 -0
- package/cli/dist/utils/gui-helpers.js.map +1 -0
- package/cli/dist/utils/install-rules.d.ts +32 -0
- package/cli/dist/utils/install-rules.d.ts.map +1 -0
- package/cli/dist/utils/install-rules.js +375 -0
- package/cli/dist/utils/install-rules.js.map +1 -0
- package/cli/dist/utils/mcp-integration.d.ts +70 -0
- package/cli/dist/utils/mcp-integration.d.ts.map +1 -0
- package/cli/dist/utils/mcp-integration.js +292 -0
- package/cli/dist/utils/mcp-integration.js.map +1 -0
- package/cli/dist/utils/module-system.d.ts +232 -0
- package/cli/dist/utils/module-system.d.ts.map +1 -0
- package/cli/dist/utils/module-system.js +900 -0
- package/cli/dist/utils/module-system.js.map +1 -0
- package/cli/dist/utils/modules-catalog.d.ts +33 -0
- package/cli/dist/utils/modules-catalog.d.ts.map +1 -0
- package/cli/dist/utils/modules-catalog.js +163 -0
- package/cli/dist/utils/modules-catalog.js.map +1 -0
- package/cli/dist/utils/rule-install-hooks.d.ts +19 -0
- package/cli/dist/utils/rule-install-hooks.d.ts.map +1 -0
- package/cli/dist/utils/rule-install-hooks.js +224 -0
- package/cli/dist/utils/rule-install-hooks.js.map +1 -0
- package/cli/dist/utils/skill-system.d.ts +95 -0
- package/cli/dist/utils/skill-system.d.ts.map +1 -0
- package/cli/dist/utils/skill-system.js +313 -0
- package/cli/dist/utils/skill-system.js.map +1 -0
- package/modules.md +559 -105
- package/package.json +17 -6
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "database",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"displayName": "Database Design Guidelines",
|
|
5
|
+
"description": "Comprehensive database design guidelines including schema design, normalization, indexing, and best practices",
|
|
6
|
+
"type": "domain-rules",
|
|
7
|
+
"author": "Augment Extensions",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"augment": {
|
|
10
|
+
"characterCount": 449449,
|
|
11
|
+
"priority": "high",
|
|
12
|
+
"category": "domain-rules"
|
|
13
|
+
},
|
|
14
|
+
"installation": {
|
|
15
|
+
"required": false,
|
|
16
|
+
"dependencies": []
|
|
17
|
+
},
|
|
18
|
+
"tags": [
|
|
19
|
+
"database",
|
|
20
|
+
"schema",
|
|
21
|
+
"normalization",
|
|
22
|
+
"indexing",
|
|
23
|
+
"sql",
|
|
24
|
+
"nosql",
|
|
25
|
+
"best-practices"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
|
|
@@ -0,0 +1,624 @@
|
|
|
1
|
+
# Flat Database Guidelines
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Flat databases store data in simple file formats like CSV, JSON, or JSONL (JSON Lines). They are suitable for small datasets, configuration files, logs, and prototypes. This guide covers when to use flat databases, best practices, and when to migrate to more robust solutions.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## When to Use Flat Databases
|
|
10
|
+
|
|
11
|
+
### ✅ Good Use Cases
|
|
12
|
+
|
|
13
|
+
**Configuration Management:**
|
|
14
|
+
- Application settings
|
|
15
|
+
- Feature flags
|
|
16
|
+
- User preferences
|
|
17
|
+
- Environment variables
|
|
18
|
+
|
|
19
|
+
**Small Datasets:**
|
|
20
|
+
- < 10,000 records
|
|
21
|
+
- Simple data structures
|
|
22
|
+
- Infrequent updates
|
|
23
|
+
- Single-user access
|
|
24
|
+
|
|
25
|
+
**Prototyping:**
|
|
26
|
+
- Proof of concept
|
|
27
|
+
- MVP development
|
|
28
|
+
- Testing and experimentation
|
|
29
|
+
- Temporary data storage
|
|
30
|
+
|
|
31
|
+
**Logs and Append-Only Data:**
|
|
32
|
+
- Application logs
|
|
33
|
+
- Audit trails
|
|
34
|
+
- Event streams
|
|
35
|
+
- Time-series data (small scale)
|
|
36
|
+
|
|
37
|
+
**Git-Backed Data:**
|
|
38
|
+
- Issue tracking (e.g., Beads)
|
|
39
|
+
- Documentation metadata
|
|
40
|
+
- Project configuration
|
|
41
|
+
- Version-controlled data
|
|
42
|
+
|
|
43
|
+
### ❌ When NOT to Use
|
|
44
|
+
|
|
45
|
+
**Large Datasets:**
|
|
46
|
+
- > 10,000 records
|
|
47
|
+
- Complex queries
|
|
48
|
+
- Multiple indexes needed
|
|
49
|
+
- High-performance requirements
|
|
50
|
+
|
|
51
|
+
**Concurrent Access:**
|
|
52
|
+
- Multiple writers
|
|
53
|
+
- High write frequency
|
|
54
|
+
- Complex transactions
|
|
55
|
+
- ACID requirements
|
|
56
|
+
|
|
57
|
+
**Complex Relationships:**
|
|
58
|
+
- Many-to-many relationships
|
|
59
|
+
- Complex joins
|
|
60
|
+
- Referential integrity
|
|
61
|
+
- Cascading updates/deletes
|
|
62
|
+
|
|
63
|
+
**Security Requirements:**
|
|
64
|
+
- Row-level security
|
|
65
|
+
- Fine-grained access control
|
|
66
|
+
- Encryption at rest
|
|
67
|
+
- Audit logging
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## File Formats
|
|
72
|
+
|
|
73
|
+
### CSV (Comma-Separated Values)
|
|
74
|
+
|
|
75
|
+
**Strengths:**
|
|
76
|
+
- Universal compatibility
|
|
77
|
+
- Human-readable
|
|
78
|
+
- Excel/spreadsheet support
|
|
79
|
+
- Simple parsing
|
|
80
|
+
|
|
81
|
+
**Weaknesses:**
|
|
82
|
+
- No nested data
|
|
83
|
+
- Type ambiguity
|
|
84
|
+
- Escaping complexity
|
|
85
|
+
- No schema enforcement
|
|
86
|
+
|
|
87
|
+
**Example:**
|
|
88
|
+
```csv
|
|
89
|
+
id,name,email,created_at
|
|
90
|
+
1,John Doe,john@example.com,2024-01-20T10:00:00Z
|
|
91
|
+
2,Jane Smith,jane@example.com,2024-01-21T11:00:00Z
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Best Practices:**
|
|
95
|
+
- Always include header row
|
|
96
|
+
- Use consistent delimiters
|
|
97
|
+
- Escape special characters
|
|
98
|
+
- Quote fields with commas/newlines
|
|
99
|
+
- Use ISO 8601 for dates
|
|
100
|
+
|
|
101
|
+
### JSON (JavaScript Object Notation)
|
|
102
|
+
|
|
103
|
+
**Strengths:**
|
|
104
|
+
- Nested data structures
|
|
105
|
+
- Type preservation
|
|
106
|
+
- Wide language support
|
|
107
|
+
- Schema validation (JSON Schema)
|
|
108
|
+
|
|
109
|
+
**Weaknesses:**
|
|
110
|
+
- Entire file must be read/written
|
|
111
|
+
- No append-only support
|
|
112
|
+
- Larger file size
|
|
113
|
+
- Concurrent access issues
|
|
114
|
+
|
|
115
|
+
**Example:**
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"users": [
|
|
119
|
+
{
|
|
120
|
+
"id": 1,
|
|
121
|
+
"name": "John Doe",
|
|
122
|
+
"email": "john@example.com",
|
|
123
|
+
"created_at": "2024-01-20T10:00:00Z"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"id": 2,
|
|
127
|
+
"name": "Jane Smith",
|
|
128
|
+
"email": "jane@example.com",
|
|
129
|
+
"created_at": "2024-01-21T11:00:00Z"
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Best Practices:**
|
|
136
|
+
- Use consistent formatting
|
|
137
|
+
- Validate with JSON Schema
|
|
138
|
+
- Implement atomic writes
|
|
139
|
+
- Use file locking
|
|
140
|
+
- Keep files < 1MB
|
|
141
|
+
|
|
142
|
+
### JSONL (JSON Lines)
|
|
143
|
+
|
|
144
|
+
**Strengths:**
|
|
145
|
+
- Append-only support
|
|
146
|
+
- Streaming processing
|
|
147
|
+
- Partial reads
|
|
148
|
+
- Git-friendly diffs
|
|
149
|
+
- Concurrent append (with care)
|
|
150
|
+
|
|
151
|
+
**Weaknesses:**
|
|
152
|
+
- Less human-readable
|
|
153
|
+
- No nested root structure
|
|
154
|
+
- Requires line-by-line parsing
|
|
155
|
+
- Duplicate handling needed
|
|
156
|
+
|
|
157
|
+
**Example:**
|
|
158
|
+
```jsonl
|
|
159
|
+
{"id":1,"name":"John Doe","email":"john@example.com","created_at":"2024-01-20T10:00:00Z"}
|
|
160
|
+
{"id":2,"name":"Jane Smith","email":"jane@example.com","created_at":"2024-01-21T11:00:00Z"}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Best Practices:**
|
|
164
|
+
- One JSON object per line
|
|
165
|
+
- No newlines within objects
|
|
166
|
+
- Append for updates (event sourcing)
|
|
167
|
+
- Latest entry wins (for same ID)
|
|
168
|
+
- Use for logs and event streams
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Schema Validation
|
|
173
|
+
|
|
174
|
+
### JSON Schema
|
|
175
|
+
|
|
176
|
+
**Define schema for validation:**
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
180
|
+
"type": "object",
|
|
181
|
+
"properties": {
|
|
182
|
+
"id": { "type": "integer" },
|
|
183
|
+
"name": { "type": "string", "minLength": 1 },
|
|
184
|
+
"email": { "type": "string", "format": "email" },
|
|
185
|
+
"created_at": { "type": "string", "format": "date-time" }
|
|
186
|
+
},
|
|
187
|
+
"required": ["id", "name", "email", "created_at"]
|
|
188
|
+
}
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**Validate data (Python):**
|
|
192
|
+
```python
|
|
193
|
+
import json
|
|
194
|
+
import jsonschema
|
|
195
|
+
|
|
196
|
+
# Load schema
|
|
197
|
+
with open('schema.json') as f:
|
|
198
|
+
schema = json.load(f)
|
|
199
|
+
|
|
200
|
+
# Validate data
|
|
201
|
+
data = {"id": 1, "name": "John", "email": "john@example.com", "created_at": "2024-01-20T10:00:00Z"}
|
|
202
|
+
jsonschema.validate(instance=data, schema=schema)
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**Validate data (JavaScript):**
|
|
206
|
+
```javascript
|
|
207
|
+
const Ajv = require('ajv');
|
|
208
|
+
const ajv = new Ajv();
|
|
209
|
+
|
|
210
|
+
const schema = { /* schema definition */ };
|
|
211
|
+
const validate = ajv.compile(schema);
|
|
212
|
+
|
|
213
|
+
const data = {id: 1, name: "John", email: "john@example.com", created_at: "2024-01-20T10:00:00Z"};
|
|
214
|
+
const valid = validate(data);
|
|
215
|
+
if (!valid) console.log(validate.errors);
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## File Locking and Concurrency
|
|
221
|
+
|
|
222
|
+
### File Locking (Python)
|
|
223
|
+
|
|
224
|
+
**Use `fcntl` for exclusive locks:**
|
|
225
|
+
```python
|
|
226
|
+
import fcntl
|
|
227
|
+
import json
|
|
228
|
+
|
|
229
|
+
def read_json_safe(filepath):
|
|
230
|
+
"""Read JSON file with shared lock."""
|
|
231
|
+
with open(filepath, 'r') as f:
|
|
232
|
+
fcntl.flock(f.fileno(), fcntl.LOCK_SH) # Shared lock
|
|
233
|
+
try:
|
|
234
|
+
data = json.load(f)
|
|
235
|
+
finally:
|
|
236
|
+
fcntl.flock(f.fileno(), fcntl.LOCK_UN) # Unlock
|
|
237
|
+
return data
|
|
238
|
+
|
|
239
|
+
def write_json_safe(filepath, data):
|
|
240
|
+
"""Write JSON file with exclusive lock."""
|
|
241
|
+
with open(filepath, 'w') as f:
|
|
242
|
+
fcntl.flock(f.fileno(), fcntl.LOCK_EX) # Exclusive lock
|
|
243
|
+
try:
|
|
244
|
+
json.dump(data, f, indent=2)
|
|
245
|
+
finally:
|
|
246
|
+
fcntl.flock(f.fileno(), fcntl.LOCK_UN) # Unlock
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Atomic Writes
|
|
250
|
+
|
|
251
|
+
**Write to temp file, then rename:**
|
|
252
|
+
```python
|
|
253
|
+
import os
|
|
254
|
+
import json
|
|
255
|
+
import tempfile
|
|
256
|
+
|
|
257
|
+
def atomic_write_json(filepath, data):
|
|
258
|
+
"""Atomically write JSON file."""
|
|
259
|
+
# Write to temp file in same directory
|
|
260
|
+
dir_path = os.path.dirname(filepath)
|
|
261
|
+
with tempfile.NamedTemporaryFile(mode='w', dir=dir_path, delete=False) as tmp:
|
|
262
|
+
json.dump(data, tmp, indent=2)
|
|
263
|
+
tmp_path = tmp.name
|
|
264
|
+
|
|
265
|
+
# Atomic rename
|
|
266
|
+
os.replace(tmp_path, filepath)
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Append-Only Pattern (JSONL)
|
|
270
|
+
|
|
271
|
+
**Safe concurrent appends:**
|
|
272
|
+
```python
|
|
273
|
+
import json
|
|
274
|
+
import fcntl
|
|
275
|
+
|
|
276
|
+
def append_jsonl(filepath, record):
|
|
277
|
+
"""Append record to JSONL file with lock."""
|
|
278
|
+
with open(filepath, 'a') as f:
|
|
279
|
+
fcntl.flock(f.fileno(), fcntl.LOCK_EX) # Exclusive lock
|
|
280
|
+
try:
|
|
281
|
+
f.write(json.dumps(record) + '\n')
|
|
282
|
+
finally:
|
|
283
|
+
fcntl.flock(f.fileno(), fcntl.LOCK_UN) # Unlock
|
|
284
|
+
|
|
285
|
+
def read_jsonl(filepath):
|
|
286
|
+
"""Read all records from JSONL file."""
|
|
287
|
+
records = []
|
|
288
|
+
with open(filepath, 'r') as f:
|
|
289
|
+
fcntl.flock(f.fileno(), fcntl.LOCK_SH) # Shared lock
|
|
290
|
+
try:
|
|
291
|
+
for line in f:
|
|
292
|
+
if line.strip():
|
|
293
|
+
records.append(json.loads(line))
|
|
294
|
+
finally:
|
|
295
|
+
fcntl.flock(f.fileno(), fcntl.LOCK_UN) # Unlock
|
|
296
|
+
return records
|
|
297
|
+
|
|
298
|
+
def get_latest_state(filepath, id_field='id'):
|
|
299
|
+
"""Get latest state for each ID from JSONL."""
|
|
300
|
+
records = read_jsonl(filepath)
|
|
301
|
+
state = {}
|
|
302
|
+
for record in records:
|
|
303
|
+
record_id = record.get(id_field)
|
|
304
|
+
if record_id:
|
|
305
|
+
if record_id not in state:
|
|
306
|
+
state[record_id] = {}
|
|
307
|
+
state[record_id].update(record) # Latest wins
|
|
308
|
+
return list(state.values())
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## Backup Strategies
|
|
314
|
+
|
|
315
|
+
### Simple File Backup
|
|
316
|
+
|
|
317
|
+
**Copy before modification:**
|
|
318
|
+
```python
|
|
319
|
+
import shutil
|
|
320
|
+
from datetime import datetime
|
|
321
|
+
|
|
322
|
+
def backup_file(filepath):
|
|
323
|
+
"""Create timestamped backup."""
|
|
324
|
+
timestamp = datetime.now().strftime('%Y%m%d_%H%M%S')
|
|
325
|
+
backup_path = f"{filepath}.backup_{timestamp}"
|
|
326
|
+
shutil.copy2(filepath, backup_path)
|
|
327
|
+
return backup_path
|
|
328
|
+
|
|
329
|
+
def write_with_backup(filepath, data):
|
|
330
|
+
"""Write JSON with automatic backup."""
|
|
331
|
+
if os.path.exists(filepath):
|
|
332
|
+
backup_file(filepath)
|
|
333
|
+
atomic_write_json(filepath, data)
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
### Rotation Strategy
|
|
337
|
+
|
|
338
|
+
**Keep N most recent backups:**
|
|
339
|
+
```python
|
|
340
|
+
import glob
|
|
341
|
+
|
|
342
|
+
def rotate_backups(filepath, keep=5):
|
|
343
|
+
"""Keep only N most recent backups."""
|
|
344
|
+
pattern = f"{filepath}.backup_*"
|
|
345
|
+
backups = sorted(glob.glob(pattern), reverse=True)
|
|
346
|
+
|
|
347
|
+
# Delete old backups
|
|
348
|
+
for old_backup in backups[keep:]:
|
|
349
|
+
os.remove(old_backup)
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## Performance Considerations
|
|
355
|
+
|
|
356
|
+
### File Size Limits
|
|
357
|
+
|
|
358
|
+
**Recommended limits:**
|
|
359
|
+
- **CSV**: < 10 MB (< 100,000 rows)
|
|
360
|
+
- **JSON**: < 1 MB (entire file in memory)
|
|
361
|
+
- **JSONL**: < 100 MB (streaming possible)
|
|
362
|
+
|
|
363
|
+
### Indexing
|
|
364
|
+
|
|
365
|
+
**For faster lookups, build in-memory index:**
|
|
366
|
+
```python
|
|
367
|
+
def build_index(records, key_field='id'):
|
|
368
|
+
"""Build in-memory index for fast lookups."""
|
|
369
|
+
return {record[key_field]: record for record in records}
|
|
370
|
+
|
|
371
|
+
# Usage
|
|
372
|
+
records = read_jsonl('data.jsonl')
|
|
373
|
+
index = build_index(records)
|
|
374
|
+
user = index.get(123) # O(1) lookup
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
### Caching
|
|
378
|
+
|
|
379
|
+
**Cache file contents in memory:**
|
|
380
|
+
```python
|
|
381
|
+
import time
|
|
382
|
+
|
|
383
|
+
class CachedJSONFile:
|
|
384
|
+
def __init__(self, filepath, ttl=60):
|
|
385
|
+
self.filepath = filepath
|
|
386
|
+
self.ttl = ttl
|
|
387
|
+
self.cache = None
|
|
388
|
+
self.cache_time = 0
|
|
389
|
+
|
|
390
|
+
def get(self):
|
|
391
|
+
"""Get data with caching."""
|
|
392
|
+
now = time.time()
|
|
393
|
+
if self.cache is None or (now - self.cache_time) > self.ttl:
|
|
394
|
+
self.cache = read_json_safe(self.filepath)
|
|
395
|
+
self.cache_time = now
|
|
396
|
+
return self.cache
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
## Migration to Relational Database
|
|
402
|
+
|
|
403
|
+
### When to Migrate
|
|
404
|
+
|
|
405
|
+
**Migrate when you experience:**
|
|
406
|
+
- File size > 10 MB
|
|
407
|
+
- Query performance degradation
|
|
408
|
+
- Need for complex queries (joins, aggregations)
|
|
409
|
+
- Concurrent write conflicts
|
|
410
|
+
- Need for transactions
|
|
411
|
+
- Referential integrity requirements
|
|
412
|
+
- Security/access control needs
|
|
413
|
+
|
|
414
|
+
### Migration Strategy
|
|
415
|
+
|
|
416
|
+
**1. Choose Database:**
|
|
417
|
+
- **SQLite**: Embedded, serverless, single file
|
|
418
|
+
- **PostgreSQL**: Full-featured, ACID, scalable
|
|
419
|
+
- **MySQL**: Popular, well-supported, cloud-friendly
|
|
420
|
+
|
|
421
|
+
**2. Design Schema:**
|
|
422
|
+
```sql
|
|
423
|
+
-- Example: Migrate users.json to PostgreSQL
|
|
424
|
+
CREATE TABLE users (
|
|
425
|
+
id SERIAL PRIMARY KEY,
|
|
426
|
+
name VARCHAR(255) NOT NULL,
|
|
427
|
+
email VARCHAR(255) UNIQUE NOT NULL,
|
|
428
|
+
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
429
|
+
);
|
|
430
|
+
|
|
431
|
+
CREATE INDEX idx_users_email ON users(email);
|
|
432
|
+
```
|
|
433
|
+
|
|
434
|
+
**3. Migration Script (Python):**
|
|
435
|
+
```python
|
|
436
|
+
import json
|
|
437
|
+
import psycopg2
|
|
438
|
+
|
|
439
|
+
# Read flat file
|
|
440
|
+
with open('users.json') as f:
|
|
441
|
+
data = json.load(f)
|
|
442
|
+
|
|
443
|
+
# Connect to database
|
|
444
|
+
conn = psycopg2.connect("dbname=mydb user=myuser")
|
|
445
|
+
cur = conn.cursor()
|
|
446
|
+
|
|
447
|
+
# Insert data
|
|
448
|
+
for user in data['users']:
|
|
449
|
+
cur.execute(
|
|
450
|
+
"INSERT INTO users (id, name, email, created_at) VALUES (%s, %s, %s, %s)",
|
|
451
|
+
(user['id'], user['name'], user['email'], user['created_at'])
|
|
452
|
+
)
|
|
453
|
+
|
|
454
|
+
conn.commit()
|
|
455
|
+
cur.close()
|
|
456
|
+
conn.close()
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
**4. Dual-Write Period:**
|
|
460
|
+
- Write to both flat file and database
|
|
461
|
+
- Verify data consistency
|
|
462
|
+
- Monitor performance
|
|
463
|
+
- Gradually shift reads to database
|
|
464
|
+
|
|
465
|
+
**5. Cutover:**
|
|
466
|
+
- Stop writing to flat file
|
|
467
|
+
- Archive flat file as backup
|
|
468
|
+
- Remove flat file code
|
|
469
|
+
|
|
470
|
+
---
|
|
471
|
+
|
|
472
|
+
## Common Pitfalls
|
|
473
|
+
|
|
474
|
+
### ❌ DON'T
|
|
475
|
+
|
|
476
|
+
**Don't use flat files for:**
|
|
477
|
+
- Large datasets (> 10 MB)
|
|
478
|
+
- High-frequency writes
|
|
479
|
+
- Concurrent access without locking
|
|
480
|
+
- Complex queries
|
|
481
|
+
- Production systems with uptime requirements
|
|
482
|
+
|
|
483
|
+
**Don't forget:**
|
|
484
|
+
- File locking for concurrent access
|
|
485
|
+
- Atomic writes to prevent corruption
|
|
486
|
+
- Backups before modifications
|
|
487
|
+
- Schema validation
|
|
488
|
+
- Error handling for file I/O
|
|
489
|
+
|
|
490
|
+
**Don't:**
|
|
491
|
+
- Edit JSONL files manually (append only)
|
|
492
|
+
- Store sensitive data unencrypted
|
|
493
|
+
- Use CSV for nested data
|
|
494
|
+
- Ignore file size growth
|
|
495
|
+
- Skip migration planning
|
|
496
|
+
|
|
497
|
+
### ✅ DO
|
|
498
|
+
|
|
499
|
+
**Use flat files for:**
|
|
500
|
+
- Configuration management
|
|
501
|
+
- Small datasets (< 10,000 records)
|
|
502
|
+
- Prototyping and MVPs
|
|
503
|
+
- Append-only logs
|
|
504
|
+
- Git-backed data
|
|
505
|
+
|
|
506
|
+
**Always:**
|
|
507
|
+
- Implement file locking
|
|
508
|
+
- Use atomic writes
|
|
509
|
+
- Validate data against schema
|
|
510
|
+
- Create backups
|
|
511
|
+
- Monitor file size
|
|
512
|
+
- Plan migration path
|
|
513
|
+
|
|
514
|
+
**Best practices:**
|
|
515
|
+
- Use JSONL for append-only data
|
|
516
|
+
- Use JSON for configuration
|
|
517
|
+
- Use CSV for simple tabular data
|
|
518
|
+
- Implement caching for read-heavy workloads
|
|
519
|
+
- Use compression for large files
|
|
520
|
+
|
|
521
|
+
---
|
|
522
|
+
|
|
523
|
+
## Real-World Examples
|
|
524
|
+
|
|
525
|
+
### Beads Issue Tracker
|
|
526
|
+
|
|
527
|
+
**Uses JSONL for git-backed issue tracking:**
|
|
528
|
+
- Append-only log (`.beads/issues.jsonl`)
|
|
529
|
+
- Latest entry wins for each ID
|
|
530
|
+
- Git-friendly diffs
|
|
531
|
+
- No database required
|
|
532
|
+
- Works offline
|
|
533
|
+
|
|
534
|
+
**Example:**
|
|
535
|
+
```jsonl
|
|
536
|
+
{"id":"bd-a1b2","title":"Task 1","status":"open","created":"2024-01-20T10:00:00Z"}
|
|
537
|
+
{"id":"bd-a1b2","status":"in-progress","updated":"2024-01-20T11:00:00Z"}
|
|
538
|
+
{"id":"bd-a1b2","status":"closed","closed":"2024-01-20T12:00:00Z"}
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
### Configuration Management
|
|
542
|
+
|
|
543
|
+
**Uses JSON for application settings:**
|
|
544
|
+
```json
|
|
545
|
+
{
|
|
546
|
+
"database": {
|
|
547
|
+
"host": "localhost",
|
|
548
|
+
"port": 5432,
|
|
549
|
+
"name": "mydb"
|
|
550
|
+
},
|
|
551
|
+
"cache": {
|
|
552
|
+
"enabled": true,
|
|
553
|
+
"ttl": 3600
|
|
554
|
+
},
|
|
555
|
+
"features": {
|
|
556
|
+
"new_ui": true,
|
|
557
|
+
"beta_features": false
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
### Application Logs
|
|
563
|
+
|
|
564
|
+
**Uses JSONL for structured logging:**
|
|
565
|
+
```jsonl
|
|
566
|
+
{"timestamp":"2024-01-20T10:00:00Z","level":"INFO","message":"Server started","port":8080}
|
|
567
|
+
{"timestamp":"2024-01-20T10:01:00Z","level":"ERROR","message":"Database connection failed","error":"Connection timeout"}
|
|
568
|
+
{"timestamp":"2024-01-20T10:02:00Z","level":"INFO","message":"Request processed","path":"/api/users","duration_ms":45}
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
---
|
|
572
|
+
|
|
573
|
+
## Best Practices Summary
|
|
574
|
+
|
|
575
|
+
### DO
|
|
576
|
+
|
|
577
|
+
✅ **Use appropriate format**: CSV for simple tables, JSON for config, JSONL for logs
|
|
578
|
+
✅ **Implement file locking**: Prevent concurrent write conflicts
|
|
579
|
+
✅ **Use atomic writes**: Prevent file corruption
|
|
580
|
+
✅ **Validate data**: Use JSON Schema or similar
|
|
581
|
+
✅ **Create backups**: Before modifications
|
|
582
|
+
✅ **Monitor file size**: Plan migration when needed
|
|
583
|
+
✅ **Use compression**: For large files (gzip)
|
|
584
|
+
✅ **Implement caching**: For read-heavy workloads
|
|
585
|
+
✅ **Plan migration**: Know when to move to database
|
|
586
|
+
|
|
587
|
+
### DON'T
|
|
588
|
+
|
|
589
|
+
❌ **Don't use for large datasets**: > 10 MB
|
|
590
|
+
❌ **Don't skip locking**: Concurrent access requires locks
|
|
591
|
+
❌ **Don't edit JSONL manually**: Append only
|
|
592
|
+
❌ **Don't store sensitive data unencrypted**: Use encryption
|
|
593
|
+
❌ **Don't ignore errors**: Handle file I/O errors
|
|
594
|
+
❌ **Don't use for complex queries**: Migrate to database
|
|
595
|
+
❌ **Don't forget backups**: Always backup before modification
|
|
596
|
+
❌ **Don't use in production**: Without proper safeguards
|
|
597
|
+
|
|
598
|
+
---
|
|
599
|
+
|
|
600
|
+
## Tools and Libraries
|
|
601
|
+
|
|
602
|
+
### Python
|
|
603
|
+
|
|
604
|
+
- **json**: Built-in JSON parsing
|
|
605
|
+
- **csv**: Built-in CSV parsing
|
|
606
|
+
- **jsonschema**: JSON Schema validation
|
|
607
|
+
- **fcntl**: File locking (Unix)
|
|
608
|
+
- **tempfile**: Atomic writes
|
|
609
|
+
|
|
610
|
+
### JavaScript/Node.js
|
|
611
|
+
|
|
612
|
+
- **fs**: Built-in file system
|
|
613
|
+
- **csv-parser**: CSV parsing
|
|
614
|
+
- **ajv**: JSON Schema validation
|
|
615
|
+
- **proper-lockfile**: Cross-platform file locking
|
|
616
|
+
- **atomic-write**: Atomic file writes
|
|
617
|
+
|
|
618
|
+
### Command-Line Tools
|
|
619
|
+
|
|
620
|
+
- **jq**: JSON query and manipulation
|
|
621
|
+
- **csvkit**: CSV processing toolkit
|
|
622
|
+
- **sqlite3**: Migrate to SQLite
|
|
623
|
+
- **gzip**: File compression
|
|
624
|
+
|