@aifabrix/builder 2.32.3 → 2.33.1

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 (127) hide show
  1. package/.cursor/rules/project-rules.mdc +8 -0
  2. package/README.md +36 -8
  3. package/bin/aifabrix.js +6 -8
  4. package/integration/hubspot/README.md +12 -11
  5. package/integration/hubspot/companies.json +2048 -0
  6. package/integration/hubspot/create-hubspot.js +665 -0
  7. package/integration/hubspot/{hubspot-deploy-company.json → hubspot-datasource-company.json} +1 -1
  8. package/integration/hubspot/{hubspot-deploy-contact.json → hubspot-datasource-contact.json} +1 -1
  9. package/integration/hubspot/{hubspot-deploy-deal.json → hubspot-datasource-deal.json} +1 -1
  10. package/integration/hubspot/hubspot-deploy.json +832 -81
  11. package/integration/hubspot/hubspot-system.json +99 -0
  12. package/integration/hubspot/test-artifacts/wizard-hubspot-credential-real.yaml +20 -0
  13. package/integration/hubspot/test-artifacts/wizard-hubspot-env-vars.yaml +9 -0
  14. package/integration/hubspot/test-artifacts/wizard-invalid-add-datasource.yaml +5 -0
  15. package/integration/hubspot/test-artifacts/wizard-invalid-app-name.yaml +5 -0
  16. package/integration/hubspot/test-artifacts/wizard-invalid-credential-create.yaml +7 -0
  17. package/integration/hubspot/test-artifacts/wizard-invalid-credential-select.yaml +7 -0
  18. package/integration/hubspot/test-artifacts/wizard-invalid-known-platform.yaml +4 -0
  19. package/integration/hubspot/test-artifacts/wizard-invalid-missing-app.yaml +4 -0
  20. package/integration/hubspot/test-artifacts/wizard-invalid-missing-source.yaml +2 -0
  21. package/integration/hubspot/test-artifacts/wizard-invalid-mode.yaml +5 -0
  22. package/integration/hubspot/test-artifacts/wizard-invalid-openapi-file.yaml +5 -0
  23. package/integration/hubspot/test-artifacts/wizard-invalid-openapi-url.yaml +4 -0
  24. package/integration/hubspot/test-artifacts/wizard-invalid-source.yaml +4 -0
  25. package/integration/hubspot/test-artifacts/wizard-valid-for-dimension-array-test.yaml +5 -0
  26. package/integration/hubspot/test-artifacts/wizard-valid-for-dimension-key-test.yaml +5 -0
  27. package/integration/hubspot/test-artifacts/wizard-valid-for-dimension-path-test.yaml +5 -0
  28. package/integration/hubspot/test-artifacts/wizard-valid-for-dimension-test.yaml +5 -0
  29. package/integration/hubspot/test-artifacts/wizard-valid-for-rbac-test.yaml +5 -0
  30. package/integration/hubspot/test-artifacts/wizard-valid-for-rbac-yaml-test.yaml +5 -0
  31. package/integration/hubspot/test-dataplane-down-helpers.js +246 -0
  32. package/integration/hubspot/test-dataplane-down-tests.js +419 -0
  33. package/integration/hubspot/test-dataplane-down.js +157 -0
  34. package/integration/hubspot/test.js +1517 -0
  35. package/integration/hubspot/variables.yaml +4 -4
  36. package/integration/hubspot/wizard-hubspot-e2e.yaml +16 -0
  37. package/integration/hubspot/wizard-hubspot-platform.yaml +8 -0
  38. package/lib/api/applications.api.js +1 -0
  39. package/lib/api/index.js +6 -2
  40. package/lib/api/types/wizard.types.js +176 -38
  41. package/lib/api/wizard.api.js +161 -23
  42. package/lib/app/deploy.js +116 -54
  43. package/lib/app/display.js +6 -5
  44. package/lib/app/dockerfile.js +2 -1
  45. package/lib/app/list.js +17 -10
  46. package/lib/app/readme.js +41 -112
  47. package/lib/app/register.js +44 -9
  48. package/lib/app/rotate-secret.js +48 -31
  49. package/lib/cli.js +219 -70
  50. package/lib/commands/app.js +4 -9
  51. package/lib/commands/auth-config.js +125 -0
  52. package/lib/commands/auth-status.js +7 -8
  53. package/lib/commands/datasource.js +3 -6
  54. package/lib/commands/login-credentials.js +4 -4
  55. package/lib/commands/login-device.js +26 -17
  56. package/lib/commands/login.js +12 -10
  57. package/lib/commands/wizard-config-normalizer.js +92 -0
  58. package/lib/commands/wizard-core.js +515 -0
  59. package/lib/commands/wizard-dataplane.js +122 -0
  60. package/lib/commands/wizard-headless.js +115 -0
  61. package/lib/commands/wizard.js +110 -332
  62. package/lib/core/config.js +46 -0
  63. package/lib/core/secrets.js +3 -22
  64. package/lib/core/templates-env.js +1 -1
  65. package/lib/datasource/deploy.js +59 -23
  66. package/lib/datasource/list.js +108 -19
  67. package/lib/deployment/deployer.js +25 -0
  68. package/lib/deployment/environment.js +10 -13
  69. package/lib/external-system/delete.js +151 -0
  70. package/lib/external-system/deploy.js +53 -378
  71. package/lib/external-system/download-helpers.js +45 -65
  72. package/lib/external-system/download.js +33 -13
  73. package/lib/external-system/generator.js +11 -7
  74. package/lib/external-system/test-auth.js +4 -3
  75. package/lib/generator/builders.js +3 -1
  76. package/lib/generator/external-controller-manifest.js +157 -0
  77. package/lib/generator/external-schema-utils.js +236 -0
  78. package/lib/generator/external.js +55 -3
  79. package/lib/generator/index.js +22 -10
  80. package/lib/generator/wizard-prompts.js +33 -10
  81. package/lib/generator/wizard.js +69 -86
  82. package/lib/infrastructure/compose.js +100 -0
  83. package/lib/infrastructure/helpers.js +139 -0
  84. package/lib/infrastructure/index.js +52 -311
  85. package/lib/infrastructure/services.js +168 -0
  86. package/lib/schema/application-schema.json +23 -4
  87. package/lib/schema/external-datasource.schema.json +2 -2
  88. package/lib/schema/wizard-config.schema.json +234 -0
  89. package/lib/utils/api.js +102 -52
  90. package/lib/utils/app-existence.js +42 -0
  91. package/lib/utils/app-register-config.js +7 -2
  92. package/lib/utils/auth-config-validator.js +92 -0
  93. package/lib/utils/command-header.js +43 -0
  94. package/lib/utils/compose-generator.js +113 -70
  95. package/lib/utils/controller-url.js +65 -17
  96. package/lib/utils/dataplane-health.js +115 -0
  97. package/lib/utils/dataplane-resolver.js +29 -0
  98. package/lib/utils/dev-config.js +6 -2
  99. package/lib/utils/env-copy.js +2 -1
  100. package/lib/utils/env-ports.js +2 -1
  101. package/lib/utils/env-template.js +1 -1
  102. package/lib/utils/error-formatter.js +49 -0
  103. package/lib/utils/error-formatters/network-errors.js +13 -3
  104. package/lib/utils/external-readme.js +125 -0
  105. package/lib/utils/help-builder.js +190 -0
  106. package/lib/utils/infra-status.js +13 -3
  107. package/lib/utils/paths.js +17 -2
  108. package/lib/utils/port-resolver.js +111 -0
  109. package/lib/utils/secrets-helpers.js +3 -15
  110. package/lib/utils/secrets-utils.js +2 -2
  111. package/lib/utils/token-manager.js +9 -4
  112. package/lib/utils/variable-transformer.js +7 -2
  113. package/lib/validation/external-manifest-validator.js +202 -0
  114. package/lib/validation/validate-display.js +406 -0
  115. package/lib/validation/validate.js +159 -123
  116. package/lib/validation/validator.js +36 -3
  117. package/lib/validation/wizard-config-validator.js +267 -0
  118. package/package.json +4 -2
  119. package/templates/applications/README.md.hbs +18 -16
  120. package/templates/applications/miso-controller/env.template +1 -1
  121. package/templates/applications/miso-controller/rbac.yaml +7 -7
  122. package/templates/external-system/README.md.hbs +99 -0
  123. package/templates/github/ci.yaml.hbs +44 -1
  124. package/templates/github/release.yaml.hbs +44 -0
  125. package/templates/infra/compose.yaml.hbs +35 -0
  126. package/templates/python/docker-compose.hbs +26 -0
  127. package/templates/typescript/docker-compose.hbs +26 -0
@@ -24,6 +24,8 @@ Technologies:
24
24
 
25
25
  ## Architecture Patterns
26
26
 
27
+ > **Visual Documentation**: When documenting architecture, workflows, or command flows, use the canonical Mermaid diagram templates from [flows-and-visuals.md](flows-and-visuals.md). These templates ensure consistent styling and accurate representation of Builder architecture.
28
+
27
29
  ### Module Structure
28
30
  - All modules use CommonJS (`require`/`module.exports`)
29
31
  - Main entry point: `bin/aifabrix.js`
@@ -506,6 +508,12 @@ function resolveSecret(key) {
506
508
  - Document error conditions
507
509
  - Add examples in comments for complex methods
508
510
  - Document security considerations
511
+ - **Visual Documentation**: Use canonical Mermaid diagram templates from [flows-and-visuals.md](flows-and-visuals.md) for architecture diagrams and workflow visualizations
512
+ - Use Template 1 for overall Builder architecture
513
+ - Use Template 2 for application creation flows
514
+ - Use Template 3 for development lifecycle workflows
515
+ - Use Template 4 for wizard/external system flows
516
+ - Follow strict styling guidelines (colors, fonts, spacing) defined in flows-and-visuals.md
509
517
 
510
518
  ### Code Comments
511
519
  - Use JSDoc format for function documentation
package/README.md CHANGED
@@ -69,15 +69,43 @@ aifabrix run miso-controller
69
69
  5. **Deploy** - Push to ACR and deploy via controller
70
70
 
71
71
  ```mermaid
72
+ %%{init: {
73
+ "theme": "base",
74
+ "themeVariables": {
75
+ "fontFamily": "Poppins, Arial Rounded MT Bold, Arial, sans-serif",
76
+ "fontSize": "16px",
77
+ "background": "#FFFFFF",
78
+ "primaryColor": "#F8FAFC",
79
+ "primaryTextColor": "#0B0E15",
80
+ "primaryBorderColor": "#E2E8F0",
81
+ "lineColor": "#E2E8F0",
82
+ "textColor": "#0B0E15",
83
+ "borderRadius": 16
84
+ },
85
+ "flowchart": {
86
+ "curve": "linear",
87
+ "nodeSpacing": 34,
88
+ "rankSpacing": 34,
89
+ "padding": 10
90
+ }
91
+ }}%%
92
+
72
93
  flowchart TD
73
- Install[Install CLI] --> Up[Start Infrastructure]
74
- Up --> Create[Create App]
75
- Create --> Build[Build Image]
76
- Build --> Run[Run Locally]
77
- Run --> Deploy[Deploy to Azure]
78
-
79
- style Install fill:#0062FF,color:#FFFFFF
80
- style Deploy fill:#10B981,color:#FFFFFF
94
+
95
+ %% =======================
96
+ %% Styles
97
+ %% =======================
98
+ classDef base fill:#FFFFFF,color:#0B0E15,stroke:#E2E8F0,stroke-width:1.5px;
99
+ classDef primary fill:#0062FF,color:#ffffff,stroke-width:0px;
100
+
101
+ %% =======================
102
+ %% Flow
103
+ %% =======================
104
+ Install[Install CLI]:::primary --> Up[Start Infrastructure]:::base
105
+ Up --> Create[Create App]:::base
106
+ Create --> Build[Build Image]:::base
107
+ Build --> Run[Run Locally]:::base
108
+ Run --> Deploy[Deploy to Azure]:::primary
81
109
  ```
82
110
 
83
111
  ## Requirements
package/bin/aifabrix.js CHANGED
@@ -15,9 +15,8 @@
15
15
 
16
16
  const { Command } = require('commander');
17
17
  const cli = require('../lib/cli');
18
- const { setupAppCommands } = require('../lib/commands/app');
19
- const { setupDatasourceCommands } = require('../lib/commands/datasource');
20
18
  const logger = require('../lib/utils/logger');
19
+ const { buildCategorizedHelp } = require('../lib/utils/help-builder');
21
20
  const packageJson = require('../package.json');
22
21
 
23
22
  /**
@@ -31,14 +30,13 @@ function initializeCLI() {
31
30
  .version(packageJson.version)
32
31
  .description('AI Fabrix Local Fabric & Deployment SDK');
33
32
 
34
- // Delegate command setup to lib/cli.js
33
+ // Delegate command setup to lib/cli.js (order matches help categories for consistency)
35
34
  cli.setupCommands(program);
36
35
 
37
- // Add application management commands
38
- setupAppCommands(program);
39
-
40
- // Add datasource management commands
41
- setupDatasourceCommands(program);
36
+ // Use categorized help for a more user-friendly command list
37
+ program.helpInformation = function() {
38
+ return buildCategorizedHelp(program);
39
+ };
42
40
 
43
41
  // Parse command line arguments
44
42
  program.parse();
@@ -9,10 +9,11 @@ This integration connects to HubSpot CRM API and exposes companies, contacts, an
9
9
  ## Files
10
10
 
11
11
  - `variables.yaml` - Application configuration with externalIntegration block
12
- - `hubspot-deploy.json` - External system definition with OAuth2 authentication
13
- - `hubspot-deploy-company.json` - Companies datasource with field mappings
14
- - `hubspot-deploy-contact.json` - Contacts datasource with field mappings
15
- - `hubspot-deploy-deal.json` - Deals datasource with field mappings
12
+ - `hubspot-system.json` - External system definition with OAuth2 authentication
13
+ - `hubspot-datasource-company.json` - Companies datasource with field mappings
14
+ - `hubspot-datasource-contact.json` - Contacts datasource with field mappings
15
+ - `hubspot-datasource-deal.json` - Deals datasource with field mappings
16
+ - `hubspot-deploy.json` - Deployment manifest (generated)
16
17
  - `env.template` - Environment variables template with kv:// references
17
18
 
18
19
  ## Setup
@@ -51,15 +52,15 @@ aifabrix validate hubspot
51
52
  aifabrix login --controller http://localhost:3100 --method device --environment dev
52
53
 
53
54
  # Register application
54
- aifabrix app register hubspot --environment dev
55
+ aifabrix app register hubspot
55
56
 
56
57
  # Deploy entire system
57
- aifabrix deploy hubspot --controller http://localhost:3100 --environment dev
58
+ aifabrix deploy hubspot
58
59
 
59
60
  # Or deploy individual datasources for testing
60
- aifabrix datasource deploy hubspot-company --environment dev --file integration/hubspot/hubspot-deploy-company.json
61
- aifabrix datasource deploy hubspot-contact --environment dev --file integration/hubspot/hubspot-deploy-contact.json
62
- aifabrix datasource deploy hubspot-deal --environment dev --file integration/hubspot/hubspot-deploy-deal.json
61
+ aifabrix datasource deploy hubspot-company --file integration/hubspot/hubspot-datasource-company.json
62
+ aifabrix datasource deploy hubspot-contact --file integration/hubspot/hubspot-datasource-contact.json
63
+ aifabrix datasource deploy hubspot-deal --file integration/hubspot/hubspot-datasource-deal.json
63
64
  ```
64
65
 
65
66
  ## Field Mappings
@@ -121,10 +122,10 @@ RBAC permissions are auto-generated: `hubspot.company.list`, `hubspot.company.ge
121
122
 
122
123
  ```bash
123
124
  # List datasources
124
- aifabrix datasource list --environment dev
125
+ aifabrix datasource list
125
126
 
126
127
  # Validate specific datasource
127
- aifabrix datasource validate hubspot-company --environment dev
128
+ aifabrix datasource validate hubspot-company
128
129
  ```
129
130
 
130
131
  ## Documentation