synthra 0.1.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.
Files changed (302) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +4 -0
  3. data/.rubocop.yml +40 -0
  4. data/.yardopts +18 -0
  5. data/ACCESS_DOCS.md +116 -0
  6. data/ADVANCED_FEATURES_SUMMARY.md +245 -0
  7. data/CHANGELOG.md +498 -0
  8. data/CODE_OF_CONDUCT.md +122 -0
  9. data/CONTRIBUTING.md +307 -0
  10. data/DOCUMENTATION.md +204 -0
  11. data/DOCUMENTATION_GUIDE.md +194 -0
  12. data/LICENSE +22 -0
  13. data/README.md +1458 -0
  14. data/Rakefile +128 -0
  15. data/benchmark/README.md +591 -0
  16. data/benchmark/batch_generation.rb +63 -0
  17. data/benchmark/engine_comparison.rb +295 -0
  18. data/benchmark/single_record.rb +108 -0
  19. data/benchmark/streaming.rb +74 -0
  20. data/docs/ACTIVERECORD_INFERENCE.md +524 -0
  21. data/docs/API_SERVER.md +278 -0
  22. data/docs/CONFIG_FILE.md +315 -0
  23. data/docs/DATA_CONTRACTS.md +312 -0
  24. data/docs/ENHANCED_REPL.md +304 -0
  25. data/docs/FACTORY_BOT.md +271 -0
  26. data/docs/GITHUB_ACTION.md +420 -0
  27. data/docs/GRAPHQL_EXPORT.md +303 -0
  28. data/docs/GRAPHQL_FEDERATION.md +651 -0
  29. data/docs/HOW_TO_GENERATE_DOCS.md +252 -0
  30. data/docs/LSP.md +189 -0
  31. data/docs/MIGRATION_GENERATOR.md +547 -0
  32. data/docs/MOCK_SERVER.md +280 -0
  33. data/docs/NATIVE_ENGINE.md +298 -0
  34. data/docs/OPENAPI_EXPORT.md +252 -0
  35. data/docs/PERFORMANCE_MODE.md +228 -0
  36. data/docs/PERSONAS.md +547 -0
  37. data/docs/PROPERTY_TESTING.md +284 -0
  38. data/docs/PROTOBUF_EXPORT.md +276 -0
  39. data/docs/QUALITY_METRICS.md +555 -0
  40. data/docs/QUICK_REFERENCE.md +88 -0
  41. data/docs/RAILS_ENGINE.md +404 -0
  42. data/docs/RAILS_INTEGRATION.md +454 -0
  43. data/docs/README.md +175 -0
  44. data/docs/REPL_QUICK_REFERENCE.md +149 -0
  45. data/docs/RUST_INTEGRATION_GUIDE.md +1376 -0
  46. data/docs/SCENARIOS.md +576 -0
  47. data/docs/SECURITY_TESTING.md +318 -0
  48. data/docs/SNAPSHOT_TESTING.md +308 -0
  49. data/docs/STRING_TEXT_TYPES_REFERENCE.md +512 -0
  50. data/docs/TERRAFORM_EXPORT.md +447 -0
  51. data/docs/TIME_TRAVEL.md +507 -0
  52. data/docs/USAGE_GUIDE.md +980 -0
  53. data/docs/WEBHOOK_SIMULATOR.md +579 -0
  54. data/docs/advanced_features.md +183 -0
  55. data/docs/api_reference.md +153 -0
  56. data/docs/behaviors.md +138 -0
  57. data/docs/best_practices.md +191 -0
  58. data/docs/dsl_reference.md +172 -0
  59. data/docs/examples.md +162 -0
  60. data/docs/generation_modes.md +125 -0
  61. data/docs/getting_started.md +92 -0
  62. data/docs/index.html +177 -0
  63. data/docs/strategic/CLOUD_REGISTRY_ARCHITECTURE.md +268 -0
  64. data/docs/strategic/SIMD_OPTIMIZATION_STRATEGY.md +153 -0
  65. data/docs/troubleshooting.md +215 -0
  66. data/docs/type_reference.md +224 -0
  67. data/examples/hostile_mode_demo.rb +64 -0
  68. data/exe/synthra +6 -0
  69. data/ext/synthra_native/Cargo.lock +972 -0
  70. data/ext/synthra_native/Cargo.toml +46 -0
  71. data/ext/synthra_native/extconf.rb +41 -0
  72. data/ext/synthra_native/src/generator.rs +397 -0
  73. data/ext/synthra_native/src/lib.rs +229 -0
  74. data/ext/synthra_native/src/types.rs +1485 -0
  75. data/lib/generators/synthra/install_generator.rb +86 -0
  76. data/lib/generators/synthra/templates/api_response.dsl +15 -0
  77. data/lib/generators/synthra/templates/fake_data.rake +116 -0
  78. data/lib/generators/synthra/templates/synthra.yml +31 -0
  79. data/lib/generators/synthra/templates/synthra_support.rb +19 -0
  80. data/lib/generators/synthra/templates/user.dsl +11 -0
  81. data/lib/synthra/activerecord_inference.rb +394 -0
  82. data/lib/synthra/api.rb +381 -0
  83. data/lib/synthra/api_server.rb +718 -0
  84. data/lib/synthra/behaviors/applicator.rb +165 -0
  85. data/lib/synthra/behaviors/base.rb +155 -0
  86. data/lib/synthra/behaviors/close_connection.rb +60 -0
  87. data/lib/synthra/behaviors/deprecated.rb +100 -0
  88. data/lib/synthra/behaviors/failure.rb +69 -0
  89. data/lib/synthra/behaviors/latency.rb +103 -0
  90. data/lib/synthra/behaviors/partial_data.rb +83 -0
  91. data/lib/synthra/behaviors/randomize_order.rb +74 -0
  92. data/lib/synthra/behaviors/registry.rb +238 -0
  93. data/lib/synthra/behaviors/simulate_error.rb +79 -0
  94. data/lib/synthra/cli/commands/base.rb +105 -0
  95. data/lib/synthra/cli/commands/diff.rb +227 -0
  96. data/lib/synthra/cli/commands/docs.rb +67 -0
  97. data/lib/synthra/cli/commands/export.rb +150 -0
  98. data/lib/synthra/cli/commands/generate.rb +72 -0
  99. data/lib/synthra/cli/commands/import.rb +80 -0
  100. data/lib/synthra/cli/commands/lint.rb +53 -0
  101. data/lib/synthra/cli/commands/live.rb +57 -0
  102. data/lib/synthra/cli/commands/seed.rb +99 -0
  103. data/lib/synthra/cli/commands/validate.rb +28 -0
  104. data/lib/synthra/cli.rb +2471 -0
  105. data/lib/synthra/config_file.rb +129 -0
  106. data/lib/synthra/configuration.rb +281 -0
  107. data/lib/synthra/contracts_registry.rb +408 -0
  108. data/lib/synthra/database_seeder.rb +268 -0
  109. data/lib/synthra/deterministic_ids.rb +218 -0
  110. data/lib/synthra/documentation_generator.rb +414 -0
  111. data/lib/synthra/engine.rb +251 -0
  112. data/lib/synthra/errors.rb +1169 -0
  113. data/lib/synthra/export/base.rb +85 -0
  114. data/lib/synthra/export/csv.rb +101 -0
  115. data/lib/synthra/export/graphql.rb +266 -0
  116. data/lib/synthra/export/graphql_federation.rb +377 -0
  117. data/lib/synthra/export/graphviz.rb +258 -0
  118. data/lib/synthra/export/javascript.rb +327 -0
  119. data/lib/synthra/export/json_data.rb +61 -0
  120. data/lib/synthra/export/json_schema.rb +290 -0
  121. data/lib/synthra/export/openapi.rb +514 -0
  122. data/lib/synthra/export/protobuf.rb +483 -0
  123. data/lib/synthra/export/python.rb +560 -0
  124. data/lib/synthra/export/sql.rb +381 -0
  125. data/lib/synthra/export/sql_insert.rb +152 -0
  126. data/lib/synthra/export/terraform.rb +501 -0
  127. data/lib/synthra/export/type_mapping.rb +389 -0
  128. data/lib/synthra/export/typescript.rb +300 -0
  129. data/lib/synthra/export/xml_data.rb +104 -0
  130. data/lib/synthra/export/yaml_data.rb +56 -0
  131. data/lib/synthra/export.rb +404 -0
  132. data/lib/synthra/factory_bot_integration.rb +157 -0
  133. data/lib/synthra/field.rb +440 -0
  134. data/lib/synthra/functions/registry.rb +104 -0
  135. data/lib/synthra/generator/context.rb +372 -0
  136. data/lib/synthra/generator/engine.rb +336 -0
  137. data/lib/synthra/generator/faker_adapter.rb +425 -0
  138. data/lib/synthra/generator/modes.rb +444 -0
  139. data/lib/synthra/generator/resolver.rb +256 -0
  140. data/lib/synthra/generator/rng.rb +273 -0
  141. data/lib/synthra/generator/streamer.rb +63 -0
  142. data/lib/synthra/generator/uniqueness.rb +118 -0
  143. data/lib/synthra/initializer.rb +97 -0
  144. data/lib/synthra/limits.rb +279 -0
  145. data/lib/synthra/live_preview.rb +518 -0
  146. data/lib/synthra/loader_config.rb +78 -0
  147. data/lib/synthra/lsp/server.rb +689 -0
  148. data/lib/synthra/migration_generator.rb +301 -0
  149. data/lib/synthra/mixin.rb +174 -0
  150. data/lib/synthra/mock_server.rb +458 -0
  151. data/lib/synthra/native_engine.rb +304 -0
  152. data/lib/synthra/openapi_importer.rb +228 -0
  153. data/lib/synthra/output/json_formatter.rb +40 -0
  154. data/lib/synthra/output/ndjson_formatter.rb +55 -0
  155. data/lib/synthra/parser/ast.rb +1287 -0
  156. data/lib/synthra/parser/lexer.rb +1152 -0
  157. data/lib/synthra/parser/parser.rb +1664 -0
  158. data/lib/synthra/parser/tokens.rb +461 -0
  159. data/lib/synthra/performance_mode.rb +364 -0
  160. data/lib/synthra/personas.rb +397 -0
  161. data/lib/synthra/property_testing.rb +172 -0
  162. data/lib/synthra/quality_metrics.rb +405 -0
  163. data/lib/synthra/rails_test_helper.rb +248 -0
  164. data/lib/synthra/registry.rb +533 -0
  165. data/lib/synthra/relationships.rb +193 -0
  166. data/lib/synthra/repl/enhanced_repl.rb +607 -0
  167. data/lib/synthra/repl/formatter.rb +191 -0
  168. data/lib/synthra/scenarios.rb +423 -0
  169. data/lib/synthra/schema.rb +605 -0
  170. data/lib/synthra/schema_inheritance.rb +104 -0
  171. data/lib/synthra/schema_versioning.rb +212 -0
  172. data/lib/synthra/snapshot_testing.rb +199 -0
  173. data/lib/synthra/time_travel.rb +338 -0
  174. data/lib/synthra/type_definitions.rb +274 -0
  175. data/lib/synthra/types/address_location/addresses.rb +125 -0
  176. data/lib/synthra/types/address_location/airports.rb +200 -0
  177. data/lib/synthra/types/address_location/banks_hospitals.rb +207 -0
  178. data/lib/synthra/types/address_location/locations.rb +406 -0
  179. data/lib/synthra/types/base.rb +48 -0
  180. data/lib/synthra/types/commerce_products/commerce.rb +119 -0
  181. data/lib/synthra/types/commerce_products/companies.rb +71 -0
  182. data/lib/synthra/types/commerce_products/construction.rb +126 -0
  183. data/lib/synthra/types/commerce_products/products.rb +205 -0
  184. data/lib/synthra/types/core/collections.rb +513 -0
  185. data/lib/synthra/types/core/defaults.rb +76 -0
  186. data/lib/synthra/types/core/enums.rb +102 -0
  187. data/lib/synthra/types/core/identifiers.rb +445 -0
  188. data/lib/synthra/types/core/primitives.rb +586 -0
  189. data/lib/synthra/types/core/references.rb +466 -0
  190. data/lib/synthra/types/core/sequences.rb +304 -0
  191. data/lib/synthra/types/crypto/crypto.rb +162 -0
  192. data/lib/synthra/types/date_time/dates.rb +387 -0
  193. data/lib/synthra/types/finance_banking/banking.rb +424 -0
  194. data/lib/synthra/types/finance_banking/credit_cards.rb +24 -0
  195. data/lib/synthra/types/finance_banking/identifiers.rb +93 -0
  196. data/lib/synthra/types/formula.rb +184 -0
  197. data/lib/synthra/types/health_medical/medical.rb +150 -0
  198. data/lib/synthra/types/hostile_payloads.rb +122 -0
  199. data/lib/synthra/types/json_array.rb +51 -0
  200. data/lib/synthra/types/media_entertainment/media.rb +62 -0
  201. data/lib/synthra/types/naughty_string.rb +30 -0
  202. data/lib/synthra/types/personal_names/chinese.rb +41 -0
  203. data/lib/synthra/types/personal_names/identifiers.rb +187 -0
  204. data/lib/synthra/types/personal_names/names.rb +246 -0
  205. data/lib/synthra/types/personal_names/national_id.rb +89 -0
  206. data/lib/synthra/types/personal_names/titles_suffixes.rb +41 -0
  207. data/lib/synthra/types/regex.rb +248 -0
  208. data/lib/synthra/types/registry.rb +182 -0
  209. data/lib/synthra/types/repeating_element.rb +50 -0
  210. data/lib/synthra/types/scenario.rb +29 -0
  211. data/lib/synthra/types/technology_internet/apps.rb +67 -0
  212. data/lib/synthra/types/technology_internet/communication.rb +162 -0
  213. data/lib/synthra/types/technology_internet/devices.rb +80 -0
  214. data/lib/synthra/types/technology_internet/formats.rb +139 -0
  215. data/lib/synthra/types/technology_internet/networking.rb +143 -0
  216. data/lib/synthra/types/template.rb +92 -0
  217. data/lib/synthra/types/text_content/business.rb +128 -0
  218. data/lib/synthra/types/text_content/colors.rb +70 -0
  219. data/lib/synthra/types/text_content/misc.rb +237 -0
  220. data/lib/synthra/types/text_content/security.rb +130 -0
  221. data/lib/synthra/types/text_content/text_generation.rb +532 -0
  222. data/lib/synthra/types/travel/travel.rb +150 -0
  223. data/lib/synthra/utils/string_distance.rb +133 -0
  224. data/lib/synthra/validator/dsl_validator.rb +339 -0
  225. data/lib/synthra/validator/path_validator.rb +615 -0
  226. data/lib/synthra/version.rb +35 -0
  227. data/lib/synthra/webhook_simulator.rb +341 -0
  228. data/lib/synthra.rb +259 -0
  229. data/schemas/address.dsl +16 -0
  230. data/schemas/api_response.dsl +8 -0
  231. data/schemas/error_payload.dsl +9 -0
  232. data/schemas/order.dsl +10 -0
  233. data/schemas/order_item.dsl +8 -0
  234. data/schemas/payment.dsl +11 -0
  235. data/schemas/social_post.dsl +13 -0
  236. data/schemas/user.dsl +10 -0
  237. data/scripts/batch_fix_all.rb +96 -0
  238. data/scripts/delete_old_files.rb +32 -0
  239. data/scripts/fix_all_grouped_files.rb +137 -0
  240. data/scripts/fix_all_indentation.rb +48 -0
  241. data/scripts/fix_all_syntax.rb +124 -0
  242. data/scripts/fix_grouped_files.rb +184 -0
  243. data/scripts/fix_syntax_errors.rb +108 -0
  244. data/scripts/group_domain_types.rb +112 -0
  245. data/scripts/group_domain_types_fixed.rb +150 -0
  246. data/scripts/merge_domains_to_one_file.rb +68 -0
  247. data/scripts/move_existing_types.rb +130 -0
  248. data/scripts/split_grouped_types.rb +142 -0
  249. data/tech_docs/README.md +134 -0
  250. data/tech_docs/advanced/streaming.md +405 -0
  251. data/tech_docs/advanced/thread_safety.md +253 -0
  252. data/tech_docs/api/overview.md +485 -0
  253. data/tech_docs/appendices/type_chart.md +193 -0
  254. data/tech_docs/basic_concepts.md +383 -0
  255. data/tech_docs/behaviors/overview.md +346 -0
  256. data/tech_docs/dsl/complex_types.md +790 -0
  257. data/tech_docs/dsl/core_types.md +464 -0
  258. data/tech_docs/dsl/datetime_types.md +325 -0
  259. data/tech_docs/dsl/field_modifiers.md +414 -0
  260. data/tech_docs/dsl/grammar.md +431 -0
  261. data/tech_docs/dsl/schema_definition.md +399 -0
  262. data/tech_docs/export/README.md +276 -0
  263. data/tech_docs/installation.md +273 -0
  264. data/tech_docs/integration/ci_cd.md +707 -0
  265. data/tech_docs/integration/ci_cd_guide.md +579 -0
  266. data/tech_docs/integration/factory_bot.md +485 -0
  267. data/tech_docs/integration/rails.md +630 -0
  268. data/tech_docs/integration/rspec.md +449 -0
  269. data/tech_docs/modes/overview.md +350 -0
  270. data/tech_docs/performance/NATIVE_RUST_EXTENSION.md +1270 -0
  271. data/tech_docs/performance/OPTIMIZATION_GUIDE.md +901 -0
  272. data/tech_docs/quick_start.md +256 -0
  273. data/tech_docs/templates/README.md +805 -0
  274. data/tech_docs/tutorials/advanced.md +371 -0
  275. data/tech_docs/tutorials/getting_started.md +189 -0
  276. data/tech_docs/tutorials/intermediate.md +231 -0
  277. data/tech_docs/tutorials/template_gallery.md +569 -0
  278. data/tech_example/01_basic_usage.rb +238 -0
  279. data/tech_example/02_types_demo.rb +336 -0
  280. data/tech_example/04_cli_usage.md +429 -0
  281. data/tech_example/05_database_seeding.rb +283 -0
  282. data/tech_example/07_rspec_integration.rb +359 -0
  283. data/tech_example/10_custom_types.rb +387 -0
  284. data/tech_example/12_behaviors.rb +372 -0
  285. data/tech_example/13_twitter_dm_example.rb +120 -0
  286. data/tech_example/14_exact_json_structure.rb +253 -0
  287. data/tech_example/16_lsp_server.rb +56 -0
  288. data/tech_example/17_property_testing.rb +92 -0
  289. data/tech_example/18_enhanced_repl.rb +120 -0
  290. data/tech_example/19_security_fuzzing.rb +145 -0
  291. data/tech_example/NEW_FEATURES.md +169 -0
  292. data/tech_example/README.md +118 -0
  293. data/tech_example/schemas/api_response.dsl +123 -0
  294. data/tech_example/schemas/ecommerce.dsl +121 -0
  295. data/tech_example/schemas/twitter_dm.dsl +109 -0
  296. data/tech_example/schemas/user.dsl +36 -0
  297. data/vscode-extension/README.md +246 -0
  298. data/vscode-extension/language-configuration.json +31 -0
  299. data/vscode-extension/package.json +55 -0
  300. data/vscode-extension/snippets/fakedatadsl.json +198 -0
  301. data/vscode-extension/syntaxes/fakedatadsl.tmLanguage.json +128 -0
  302. metadata +478 -0
data/CHANGELOG.md ADDED
@@ -0,0 +1,498 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ #### Rails Test Helper ⭐ NEW (Phase 2)
13
+ - `generate_for_test(Model)` for seamless Rails test integration
14
+ - `create_for_test(Model)` for persisted records
15
+ - `generate_many_for_test(Model, count)` for batch generation
16
+ - ActiveRecord schema inference from column types
17
+ - Location: `lib/synthra/rails_test_helper.rb`
18
+
19
+ #### Schema Mixins ⭐ NEW (Phase 2)
20
+ - `@mixin` directive for reusable field sets
21
+ - Pre-built mixins: Timestamps, SoftDelete, Auditable, Sluggable, Publishable
22
+ - Mixin registry with thread-safe operations
23
+ - Location: `lib/synthra/mixin.rb`
24
+
25
+ #### Data Relationships ⭐ NEW (Phase 2)
26
+ - `belongs_to(Schema)` - required reference
27
+ - `has_one(Schema)` - optional single reference
28
+ - `has_many(Schema, 1..10)` - collection reference
29
+ - Automatic cardinality handling
30
+ - Location: `lib/synthra/relationships.rb`
31
+
32
+ #### Schema Versioning ⭐ NEW (Phase 2)
33
+ - `User@v2` versioned schema names
34
+ - `@migrated_from User@v1` migration tracking
35
+ - Version registry with migration path finding
36
+ - Breaking change analyzer
37
+ - Location: `lib/synthra/schema_versioning.rb`
38
+
39
+ #### OpenAPI/Swagger Import ⭐ NEW (Phase 2)
40
+ - `synthra import openapi.yaml --output schemas/`
41
+ - Automatic type mapping from OpenAPI to DSL
42
+ - Enum, array, and reference support
43
+ - JSON and YAML format support
44
+ - Location: `lib/synthra/openapi_importer.rb`
45
+
46
+ #### Database Seeder ⭐ NEW (Phase 2)
47
+ - `Synthra.seed_database { create User, count: 100 }`
48
+ - Foreign key constraint awareness
49
+ - Batch insert support for performance
50
+ - Schema inference from ActiveRecord models
51
+ - Location: `lib/synthra/database_seeder.rb`
52
+
53
+ #### Live Preview Server ⭐ NEW (Phase 2)
54
+ - `synthra live schemas/ --port 4567`
55
+ - Beautiful web UI with real-time generation
56
+ - Hot reload on schema changes
57
+ - Multiple generation modes (random, edge, invalid, hostile)
58
+ - JSON copy-to-clipboard support
59
+ - Location: `lib/synthra/live_preview.rb`
60
+
61
+ #### Documentation Generator ⭐ NEW (Phase 2)
62
+ - `synthra docs schemas/ --output docs/`
63
+ - Beautiful dark-themed HTML documentation
64
+ - Sample data in both random and edge modes
65
+ - Schema statistics and field tables
66
+ - Location: `lib/synthra/documentation_generator.rb`
67
+
68
+ #### Deterministic IDs ⭐ NEW (Phase 2)
69
+ - `DeterministicIds.uuid(variant: "user", index: 0)`
70
+ - `DeterministicIds.integer(variant: "order")`
71
+ - `DeterministicIds.short_id` for YouTube-style IDs
72
+ - `DeterministicIds.slug` for URL-friendly IDs
73
+ - Batch generation support
74
+ - Location: `lib/synthra/deterministic_ids.rb`
75
+
76
+ #### New CLI Commands (Phase 2)
77
+ - `synthra import` - Import from OpenAPI/Swagger
78
+ - `synthra docs` - Generate HTML documentation
79
+ - `synthra live` - Start live preview server
80
+ - `synthra seed` - Database seeding
81
+
82
+ #### Rails Engine 🚂 NEW (Rails-Tier Phase)
83
+ - Zero-configuration Rails integration
84
+ - Auto-discovery of schemas from `db/schemas/`, `app/schemas/`, `schemas/`
85
+ - Automatic Factory Bot integration
86
+ - Test helpers (`fake_data`, `fake_data_list`, `Synthra[:User]`)
87
+ - Auto-mount API in development at `/fake_data`
88
+ - Location: `lib/synthra/engine.rb`
89
+
90
+ #### ActiveRecord Inference 🔍 NEW (Rails-Tier Phase)
91
+ - `Synthra::ActiveRecordInference.infer(User)` - Infer schema from model
92
+ - `discover_all!` - Auto-discover all ActiveRecord models
93
+ - Smart type inference from column names (email, phone, url patterns)
94
+ - Validation-aware field mapping
95
+ - Association handling (belongs_to, has_many)
96
+ - Export to DSL files
97
+ - Location: `lib/synthra/activerecord_inference.rb`
98
+
99
+ #### Scenario-Based Fixtures 📸 NEW (Rails-Tier Phase)
100
+ - Define complex test data scenarios
101
+ - `Synthra::Scenarios.define(:e_commerce_checkout) { ... }`
102
+ - `let(:user) { User(role: "admin") }` fixture syntax
103
+ - Scenario inheritance with `extends:`
104
+ - RSpec and Minitest integration
105
+ - Reference resolution between fixtures
106
+ - Location: `lib/synthra/scenarios.rb`
107
+
108
+ #### Time Travel ⏰ NEW (Rails-Tier Phase)
109
+ - `Synthra::TimeTravel.at(3.months.ago) { ... }` - Generate historical data
110
+ - `TimeTravel.between(start, end)` - Random times in range
111
+ - `TimeTravel.time_series(schema, count:, distribution:)` - Generate time series
112
+ - `TimeTravel.age(record, by:)` - Age existing records
113
+ - `TimeTravel.progression(schema, steps:, interval:)` - Create data progressions
114
+ - Distributions: `:uniform`, `:linear`, `:exponential`, `:logarithmic`
115
+ - Location: `lib/synthra/time_travel.rb`
116
+
117
+ #### Personas 🎭 NEW (Rails-Tier Phase)
118
+ - Named data profiles: `:happy_path`, `:edge_cases`, `:security_test`
119
+ - `Synthra.as(:happy_path) { generate("User") }`
120
+ - Define custom personas with mode, seed, and overrides
121
+ - Trait system for reusable configurations
122
+ - Transform hooks for data modification
123
+ - YAML configuration support
124
+ - Location: `lib/synthra/personas.rb`
125
+
126
+ #### Data Quality Metrics 📊 NEW (Rails-Tier Phase)
127
+ - `Synthra::QualityMetrics.analyze(records)` - Analyze generated data
128
+ - Uniqueness analysis per field
129
+ - Distribution analysis for categorical data
130
+ - Completeness scoring
131
+ - Type consistency checking
132
+ - Realism score (0-100)
133
+ - Pattern detection (prefixes, suffixes, lengths)
134
+ - Anomaly detection (duplicates, skewed distributions)
135
+ - Location: `lib/synthra/quality_metrics.rb`
136
+
137
+ #### GraphQL Federation Export 🔗 NEW (Rails-Tier Phase)
138
+ - `synthra export --all -f graphql-federation -o schema.graphql`
139
+ - Apollo Federation v2 compatible SDL
140
+ - `@key`, `@shareable`, `@external`, `@provides` directives
141
+ - Connection types with pagination (Relay-style)
142
+ - Query, Mutation, and Subscription types
143
+ - Input types for each schema
144
+ - Generation mode enum
145
+ - Location: `lib/synthra/export/graphql_federation.rb`
146
+
147
+ #### Webhook Simulation 🎬 NEW (Rails-Tier Phase)
148
+ - `Synthra::WebhookSimulator.send("event.type", data: {...})`
149
+ - Pre-built Stripe webhooks (payment_succeeded, subscription_created)
150
+ - Pre-built GitHub webhooks (push, pull_request)
151
+ - Template system for reusable webhooks
152
+ - Signature generation (Stripe-compatible)
153
+ - Async and delayed delivery
154
+ - Sequence support for multi-step flows
155
+ - Location: `lib/synthra/webhook_simulator.rb`
156
+
157
+ #### Schema Migration Generator 🧬 NEW (Rails-Tier Phase)
158
+ - `Synthra::MigrationGenerator.create_table(schema)`
159
+ - `MigrationGenerator.generate(from: "User@v1", to: "User@v2")`
160
+ - Generates Rails 7.1 compatible migrations
161
+ - Detects added, removed, and changed fields
162
+ - Type mapping to ActiveRecord column types
163
+ - Nullable field handling
164
+ - Location: `lib/synthra/migration_generator.rb`
165
+
166
+ #### Terraform/IaC Export 🏗️ NEW (Rails-Tier Phase)
167
+ - `synthra export --all -f terraform -o main.tf`
168
+ - AWS DynamoDB table generation
169
+ - AWS RDS PostgreSQL with SQL schema
170
+ - AWS S3 bucket with encryption
171
+ - GCP provider support
172
+ - HCL and JSON output formats
173
+ - Global Secondary Indexes for indexed fields
174
+ - Location: `lib/synthra/export/terraform.rb`
175
+
176
+ #### GitHub Action 🤖 NEW (Rails-Tier Phase)
177
+ - Composite action for CI/CD integration
178
+ - Schema validation in pull requests
179
+ - Breaking change detection
180
+ - Export generation (TypeScript, JSON Schema, etc.)
181
+ - Artifact upload for generated files
182
+ - Location: `.github/actions/fake-data-dsl/action.yml`
183
+
184
+ #### Production API Server 🔥 NEW (Production Phase)
185
+ - `synthra server schemas/ --port 3000` - Start REST API server
186
+ - Full REST API for data generation (`GET /api/:schema`, `/api/:schema/batch`, `/api/:schema/stream`)
187
+ - API key and bearer token authentication
188
+ - Rate limiting with configurable limits per minute
189
+ - CORS support with customizable headers
190
+ - Metrics endpoint for monitoring
191
+ - Rack-compatible for deployment with Puma/Unicorn
192
+ - Location: `lib/synthra/api_server.rb`
193
+
194
+ #### gRPC/Protobuf Export 🔥 NEW (Production Phase)
195
+ - `synthra export User -f protobuf -o user.proto`
196
+ - Generate .proto files from DSL schemas
197
+ - Automatic service definition generation
198
+ - Enum extraction and mapping
199
+ - `export_all` for combined proto file
200
+ - Custom package and go_package options
201
+ - Location: `lib/synthra/export/protobuf.rb`
202
+
203
+ #### OpenAPI Export 🔥 NEW (Production Phase)
204
+ - `synthra export --all -f openapi -o api.yaml`
205
+ - Generate OpenAPI 3.0 specifications
206
+ - Complete endpoint documentation
207
+ - Request/response schema generation
208
+ - YAML and JSON output formats
209
+ - Custom title, version, and server URL
210
+ - Location: `lib/synthra/export/openapi.rb`
211
+
212
+ #### Mock Server with Recording 🔥 NEW (Production Phase)
213
+ - `Synthra::MockServer.start(schema_dir: "schemas/", recording: true)`
214
+ - Record real API responses for replay
215
+ - Persistent recording storage
216
+ - Rate limiting support
217
+ - Behavior simulation (latency, failures)
218
+ - Location: `lib/synthra/mock_server.rb`
219
+
220
+ #### Data Contracts Registry 🔥 NEW (Production Phase)
221
+ - `synthra contracts publish User -v 1.0.0`
222
+ - Semantic versioning support
223
+ - Publish, deprecate, and retire contracts
224
+ - Compatibility checking between versions
225
+ - Breaking change detection
226
+ - History tracking with timestamps
227
+ - Location: `lib/synthra/contracts_registry.rb`
228
+
229
+ #### Performance Mode 🔥 NEW (Production Phase)
230
+ - `synthra perf User -c 1000000 -o users.ndjson`
231
+ - Generate millions of records with parallel processing
232
+ - Progress callbacks with ETA
233
+ - File streaming (NDJSON, JSON, CSV)
234
+ - Benchmark mode for performance testing
235
+ - System capability detection
236
+ - Location: `lib/synthra/performance_mode.rb`
237
+
238
+ #### New CLI Commands (Production Phase)
239
+ - `synthra server` - Start production API server
240
+ - `synthra contracts` - Manage data contracts registry
241
+ - `synthra perf` - High-performance generation mode
242
+
243
+ #### GraphQL Schema Export ⭐ NEW
244
+ - Export schemas to GraphQL SDL (Schema Definition Language)
245
+ - Automatic Query type generation with pagination
246
+ - Enum type extraction and mapping
247
+ - Full registry export support with `export_all`
248
+ - Location: `lib/synthra/export/graphql.rb`
249
+
250
+ #### Config File Support ⭐ NEW
251
+ - YAML configuration file support (`config/synthra.yml`)
252
+ - Environment-specific configuration (development, test, production)
253
+ - Auto-loading from standard locations
254
+ - Rails-like convention over configuration
255
+ - Location: `lib/synthra/config_file.rb`
256
+
257
+ #### Factory Bot Integration ⭐ NEW
258
+ - Bridge between Synthra and Factory Bot
259
+ - `Synthra.define_factory(:user, schema: "User")` syntax
260
+ - Trait support for different data variations
261
+ - RSpec helpers: `fake_data_build`, `build_fake_data`
262
+ - Location: `lib/synthra/factory_bot_integration.rb`
263
+
264
+ #### Schema Inheritance ⭐ NEW
265
+ - Schema inheritance with `<` operator
266
+ - `AdminUser < BaseUser:` syntax support
267
+ - Child fields override parent fields
268
+ - Reduces schema duplication
269
+ - Location: `lib/synthra/schema_inheritance.rb`
270
+
271
+ #### Breaking Changes Diff for CI ⭐ NEW
272
+ - `synthra diff schemas/v1/ schemas/v2/ --breaking-only`
273
+ - Detects: removed schemas, removed fields, type changes
274
+ - Perfect for CI pipelines to block breaking PRs
275
+ - Exit code 1 on breaking changes
276
+ - Location: `lib/synthra/cli/commands/diff.rb`
277
+
278
+ #### Snapshot Testing Integration ⭐ NEW
279
+ - `expect_snapshot(schema, seed: 42)` for RSpec
280
+ - `match_snapshot("User")` custom matcher
281
+ - `generate_all_snapshots` for bulk operations
282
+ - Deterministic seed-based comparisons
283
+ - Location: `lib/synthra/snapshot_testing.rb`
284
+
285
+ #### Shared Type Mapping ⭐ NEW
286
+ - Centralized type mapping module for all exporters
287
+ - Consistent JSON Schema, TypeScript, Python, and SQL mappings
288
+ - Reduces code duplication across export modules
289
+ - Location: `lib/synthra/export/type_mapping.rb`
290
+
291
+ ### Changed
292
+
293
+ #### Architecture Improvements
294
+ - Refactored main lib file from ~1000 to ~140 lines
295
+ - Split into `api.rb` (public API) and `type_definitions.rb` (type registrations)
296
+ - CLI command pattern with individual command classes
297
+ - Optimized Generator::Engine hot path with cached observability check
298
+ - Added `observability_enabled?` method to Configuration
299
+
300
+ #### CLI Command Pattern
301
+ - Base command class: `lib/synthra/cli/commands/base.rb`
302
+ - Individual commands: `validate.rb`, `lint.rb`, `generate.rb`, `export.rb`, `diff.rb`
303
+ - Each command is focused, testable, and maintainable
304
+
305
+ #### LSP Server
306
+ - Full Language Server Protocol (LSP) implementation for IDE integration
307
+ - Go-to-definition support for schema references
308
+ - Hover information with type details and documentation
309
+ - Auto-completion for schema names, types, and field names
310
+ - Real-time diagnostics and validation
311
+ - Location: `lib/synthra/lsp/server.rb`
312
+ - Documentation: `docs/LSP.md`
313
+
314
+ #### Property-Based Testing
315
+ - RSpec integration for property-based testing with Synthra schemas
316
+ - `verify_property` helper for verifying properties across multiple generated records
317
+ - `verify_property_stream` for memory-efficient testing with large datasets
318
+ - `shrink_counterexample` for finding minimal failing test cases
319
+ - Automatic seed tracking for reproducible test failures
320
+ - Location: `lib/synthra/property_testing.rb`
321
+ - Documentation: `docs/PROPERTY_TESTING.md`
322
+
323
+ #### Enhanced REPL
324
+ - Visual data inspection with `table` command (tabular format)
325
+ - Step-through debugging with `debug` command (field-by-field generation)
326
+ - Detailed inspection with `inspect` command (context state, generated fields)
327
+ - Better formatting for hashes, arrays, and nested structures
328
+ - **NEW**: Command aliases (`t`, `d`, `i`, `g`, `l`, `h`, `q`)
329
+ - **NEW**: Readline-based command history with arrow key navigation
330
+ - **NEW**: Tab completion for commands and schema names
331
+ - **NEW**: Export to file support (`gen User 100 > users.json`)
332
+ - **NEW**: "Did you mean" suggestions for typos
333
+ - **NEW**: Enhanced debug context showing all previously generated fields
334
+ - Location: `lib/synthra/repl/formatter.rb`, `lib/synthra/repl/enhanced_repl.rb`
335
+ - Documentation: `docs/ENHANCED_REPL.md`
336
+
337
+ #### Security Fuzzing (Hostile Mode)
338
+ - New `:hostile` generation mode for security testing
339
+ - SQL injection payloads
340
+ - XSS (Cross-Site Scripting) attack vectors
341
+ - Buffer overflow payloads
342
+ - Unicode attack strings
343
+ - Comprehensive hostile payload library
344
+ - Location: `lib/synthra/generator/modes.rb`, `lib/synthra/types/hostile_payloads.rb`
345
+ - Documentation: `docs/SECURITY_TESTING.md`
346
+
347
+ #### Documentation
348
+ - Comprehensive YARD documentation generation
349
+ - Rake tasks for documentation (`rake docs`, `rake docs_server`)
350
+ - Full API documentation with examples
351
+ - Contributing guidelines (CONTRIBUTING.md)
352
+ - Code of Conduct (CODE_OF_CONDUCT.md)
353
+ - Strategic planning documents for SIMD optimization and Cloud Registry
354
+
355
+ #### Integration Tests
356
+ - Comprehensive integration tests for enhanced features
357
+ - End-to-end REPL workflow tests
358
+ - Property testing integration tests
359
+ - LSP server hover and documentation tests
360
+ - Debug engine callback tests
361
+ - Location: `spec/integration/enhanced_features_spec.rb`
362
+
363
+ #### Performance Tests
364
+ - Comprehensive performance benchmarks
365
+ - Generation throughput tests (simple and complex schemas)
366
+ - Streaming performance tests (10,000+ records)
367
+ - REPL formatter performance tests
368
+ - Property testing performance tests
369
+ - LSP server response time tests
370
+ - Location: `spec/synthra/performance_spec.rb`
371
+
372
+ ### Changed
373
+ - Enhanced README with detailed examples and troubleshooting
374
+ - Improved documentation coverage across all modules
375
+ - Updated test coverage to 94.57% line, 79.05% branch
376
+
377
+ ### Fixed
378
+ - Property testing tests now properly pass registry parameter
379
+ - REPL DebugEngine callback signature matches engine's 4-argument format
380
+ - RSpec integration test uses correct method for checking module inclusion
381
+
382
+ ## [0.1.0] - 2024-01-01
383
+
384
+ ### Added
385
+
386
+ - **Initial release** - Full-featured fake data generation DSL
387
+ - **Custom DSL Parser** - Indentation-based syntax similar to YAML
388
+ - Lexer for tokenizing DSL input
389
+ - Recursive descent parser
390
+ - Abstract Syntax Tree (AST) representation
391
+ - Support for multiple schemas per file
392
+
393
+ - **Core Data Types**:
394
+ - `uuid` - UUID v4, v6, and v7 support with uniqueness constraints
395
+ - `ulid` - Time-sortable ULID identifiers
396
+ - `id_sequence` - Auto-incrementing sequential IDs
397
+ - `name` - Full names using Faker
398
+ - `email` - Email addresses
399
+ - `text` - Random text with configurable length ranges
400
+ - `number` - Integers and floats with min/max ranges
401
+ - `boolean` - True/false with probability support
402
+ - `enum` - Value selection with weighted probabilities
403
+ - `date` - Random dates
404
+ - `past_date` - Dates in the past with time ranges (d/m/y)
405
+ - `future_date` - Dates in the future with time ranges
406
+ - `now` - Current timestamp
407
+ - `timestamp` - DateTime values
408
+
409
+ - **Extended Data Types**:
410
+ - `phone` - Phone numbers with locale support
411
+ - `url` - URLs
412
+ - `ip` - IPv4 addresses
413
+ - `ipv6` - IPv6 addresses
414
+ - `country_code` - ISO 3166-1 alpha-2 country codes (using Faker)
415
+ - `currency` - ISO 4217 currency codes (using Faker)
416
+ - `postal_code` - Postal/ZIP codes with country-specific formats (using Faker)
417
+ - `money` - Money amounts with currency (using Faker for currency)
418
+ - `locale` - Locale codes
419
+
420
+ - **Complex Types**:
421
+ - `array` - Arrays of values or nested schemas with size constraints
422
+ - `object` - Nested object structures
423
+ - `reference` - Cross-schema field references with `Ref(Schema.field)` syntax
424
+ - `custom` - Computed fields using registered functions
425
+
426
+ - **Field Modifiers**:
427
+ - Optional fields with `?` suffix (e.g., `email?: email`)
428
+ - Nullable types with `?` prefix (e.g., `bio: text?`)
429
+ - Combined optional and nullable (e.g., `phone?: phone?`)
430
+ - Conditional fields with `if` syntax
431
+
432
+ - **Behaviors** - Simulation behaviors for testing:
433
+ - `@latency` - Add artificial delays (schema or field level)
434
+ - `@failure` - Simulate failures with probability
435
+ - `@partial_data` - Remove random fields with probability
436
+ - `@close_connection` - Simulate connection drops
437
+ - `@simulate_error` - Return HTTP error codes
438
+ - `@randomize_order` - Shuffle array field order
439
+
440
+ - **Generation Modes**:
441
+ - `:random` - Standard realistic data (default)
442
+ - `:edge` - Boundary values and edge cases
443
+ - `:invalid` - Invalid data for validation testing
444
+ - `:mixed` - Combination of all modes (80% random, 15% edge, 5% invalid)
445
+
446
+ - **Advanced Features**:
447
+ - Cross-schema references with automatic resolution
448
+ - Computed fields with custom functions
449
+ - Conditional field generation
450
+ - Uniqueness constraints with configurable scopes
451
+ - Deterministic generation with seed support
452
+ - Thread-safe random number generation
453
+ - Streaming generation for large datasets (memory-efficient)
454
+ - Resource limits (max latency, recursion depth, array size)
455
+ - Schema registry for multi-schema projects
456
+ - Circular dependency detection
457
+
458
+ - **CLI Tool** (`synthra`):
459
+ - `validate` command - Validate DSL schema files
460
+ - `generate` command - Generate data from schemas
461
+ - Support for pretty JSON, NDJSON, and CSV output formats
462
+ - Seed support for reproducible generation
463
+ - Generation mode selection
464
+
465
+ - **Output Formatters**:
466
+ - JSON formatter with pretty printing
467
+ - NDJSON (newline-delimited JSON) for streaming
468
+ - File writing support
469
+
470
+ - **Error Handling**:
471
+ - Custom error classes for different failure scenarios
472
+ - Detailed error messages with context
473
+ - Graceful handling of uniqueness constraint failures
474
+
475
+ - **Configuration**:
476
+ - Global configuration system
477
+ - Resource limits configuration
478
+ - Default generation mode
479
+ - Behavior enable/disable
480
+
481
+ - **Extensibility**:
482
+ - Custom type registration
483
+ - Custom function registration
484
+ - Custom behavior registration
485
+ - Plugin architecture
486
+
487
+ - **Testing**:
488
+ - Comprehensive RSpec test suite
489
+ - 100% code coverage
490
+ - Integration tests
491
+ - Shared examples and custom matchers
492
+
493
+ - **Documentation**:
494
+ - Comprehensive README with examples
495
+ - YARD documentation for all public APIs
496
+ - Contributing guidelines
497
+ - Code of Conduct
498
+
@@ -0,0 +1,122 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Using welcoming and inclusive language
21
+ * Being respectful of differing viewpoints and experiences
22
+ * Gracefully accepting constructive criticism
23
+ * Focusing on what is best for the community
24
+ * Showing empathy towards other community members
25
+
26
+ Examples of unacceptable behavior include:
27
+
28
+ * The use of sexualized language or imagery, and sexual attention or
29
+ advances of any kind
30
+ * Trolling, insulting/derogatory comments, and personal or political attacks
31
+ * Public or private harassment
32
+ * Publishing others' private information, such as a physical or email
33
+ address, without their explicit permission
34
+ * Other conduct which could reasonably be considered inappropriate in a
35
+ professional setting
36
+
37
+ ## Enforcement Responsibilities
38
+
39
+ Community leaders are responsible for clarifying and enforcing our standards of
40
+ acceptable behavior and will take appropriate and fair corrective action in
41
+ response to any behavior that they deem inappropriate, threatening, offensive,
42
+ or harmful.
43
+
44
+ Community leaders have the right and responsibility to remove, edit, or reject
45
+ comments, commits, code, wiki edits, issues, and other contributions that are
46
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
47
+ decisions when appropriate.
48
+
49
+ ## Scope
50
+
51
+ This Code of Conduct applies within all community spaces, and also applies when
52
+ an individual is officially representing the community in public spaces.
53
+ Examples of representing our community include using an official e-mail address,
54
+ posting via an official social media account, or acting as an appointed
55
+ representative at an online or offline event.
56
+
57
+ ## Enforcement
58
+
59
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
60
+ reported to the community leaders responsible for enforcement at
61
+ [team@fakedatadsl.dev](mailto:team@fakedatadsl.dev).
62
+ All complaints will be reviewed and investigated promptly and fairly.
63
+
64
+ All community leaders are obligated to respect the privacy and security of the
65
+ reporter of any incident.
66
+
67
+ ## Enforcement Guidelines
68
+
69
+ Community leaders will follow these Community Impact Guidelines in determining
70
+ the consequences for any action they deem in violation of this Code of Conduct:
71
+
72
+ ### 1. Correction
73
+ **Community Impact**: Use of inappropriate language or other behavior deemed
74
+ unprofessional or unwelcome in the community.
75
+
76
+ **Consequence**: A private, written warning from community leaders, providing
77
+ clarity around the nature of the violation and an explanation of why the
78
+ behavior was inappropriate. A public apology may be requested.
79
+
80
+ ### 2. Warning
81
+ **Community Impact**: A violation through a single incident or series
82
+ of actions.
83
+
84
+ **Consequence**: A warning with consequences for continued behavior. No
85
+ interaction with the people involved, including unsolicited interaction with
86
+ those enforcing the Code of Conduct, for a specified period of time. This
87
+ includes avoiding interactions in community spaces as well as external channels
88
+ like social media. Violating these terms may lead to a temporary or
89
+ permanent ban.
90
+
91
+ ### 3. Temporary Ban
92
+ **Community Impact**: A serious violation of community standards, including
93
+ sustained inappropriate behavior.
94
+
95
+ **Consequence**: A temporary ban from any sort of interaction or public
96
+ communication with the community for a specified period of time. No public or
97
+ private interaction with the people involved, including unsolicited interaction
98
+ with those enforcing the Code of Conduct, is allowed during this period.
99
+ Violating these terms may lead to a permanent ban.
100
+
101
+ ### 4. Permanent Ban
102
+ **Community Impact**: Demonstrating a pattern of violation of community
103
+ standards, including sustained inappropriate behavior, harassment of an
104
+ individual, or aggression toward or disparagement of classes of individuals.
105
+
106
+ **Consequence**: A permanent ban from any sort of public interaction within
107
+ the community.
108
+
109
+ ## Attribution
110
+
111
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
112
+ version 2.0, available at
113
+ https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
114
+
115
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct
116
+ enforcement ladder](https://github.com/mozilla/diversity).
117
+
118
+ [homepage]: https://www.contributor-covenant.org
119
+
120
+ For answers to common questions about this code of conduct, see
121
+ https://www.contributor-covenant.org/faq
122
+