@intrig/core 0.0.15-12 → 0.0.15-13

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 (2) hide show
  1. package/main.js +81 -37
  2. package/package.json +2 -1
package/main.js CHANGED
@@ -7716,36 +7716,6 @@ DataSearchController = data_search_controller_ts_decorate([
7716
7716
  ])
7717
7717
  ], DataSearchController);
7718
7718
 
7719
- ;// ./src/app/plugins/plugin.module.ts
7720
- function plugin_module_ts_decorate(decorators, target, key, desc) {
7721
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7722
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7723
- else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7724
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7725
- }
7726
-
7727
-
7728
- // Token for dependency injection - keeping for backward compatibility
7729
- const INTRIG_PLUGIN = Symbol('INTRIG_PLUGIN');
7730
- const INTRIG_PLUGIN_NAME = Symbol('INTRIG_PLUGIN_NAME');
7731
- class PluginModule {
7732
- static forRootAsync() {
7733
- return {
7734
- module: PluginModule,
7735
- providers: [
7736
- LazyPluginService
7737
- ],
7738
- exports: [
7739
- LazyPluginService
7740
- ],
7741
- global: true
7742
- };
7743
- }
7744
- }
7745
- PluginModule = plugin_module_ts_decorate([
7746
- (0,common_namespaceObject.Module)({})
7747
- ], PluginModule);
7748
-
7749
7719
  ;// ./src/app/daemon/daemon.module.ts
7750
7720
  function daemon_module_ts_decorate(decorators, target, key, desc) {
7751
7721
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -7767,7 +7737,6 @@ function daemon_module_ts_decorate(decorators, target, key, desc) {
7767
7737
 
7768
7738
 
7769
7739
 
7770
-
7771
7740
  class DaemonModule {
7772
7741
  }
7773
7742
  DaemonModule = daemon_module_ts_decorate([
@@ -7775,8 +7744,7 @@ DaemonModule = daemon_module_ts_decorate([
7775
7744
  imports: [
7776
7745
  CommonModule,
7777
7746
  OpenapiSourceModule,
7778
- axios_namespaceObject.HttpModule,
7779
- PluginModule
7747
+ axios_namespaceObject.HttpModule
7780
7748
  ],
7781
7749
  controllers: [
7782
7750
  SourcesController,
@@ -7793,11 +7761,42 @@ DaemonModule = daemon_module_ts_decorate([
7793
7761
  LazyCodeAnalyzerService
7794
7762
  ],
7795
7763
  exports: [
7796
- OperationsService
7764
+ OperationsService,
7765
+ IntrigConfigService
7797
7766
  ]
7798
7767
  })
7799
7768
  ], DaemonModule);
7800
7769
 
7770
+ ;// ./src/app/plugins/plugin.module.ts
7771
+ function plugin_module_ts_decorate(decorators, target, key, desc) {
7772
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
7773
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7774
+ else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
7775
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7776
+ }
7777
+
7778
+
7779
+ // Token for dependency injection - keeping for backward compatibility
7780
+ const INTRIG_PLUGIN = Symbol('INTRIG_PLUGIN');
7781
+ const INTRIG_PLUGIN_NAME = Symbol('INTRIG_PLUGIN_NAME');
7782
+ class PluginModule {
7783
+ static forRootAsync() {
7784
+ return {
7785
+ module: PluginModule,
7786
+ providers: [
7787
+ LazyPluginService
7788
+ ],
7789
+ exports: [
7790
+ LazyPluginService
7791
+ ],
7792
+ global: true
7793
+ };
7794
+ }
7795
+ }
7796
+ PluginModule = plugin_module_ts_decorate([
7797
+ (0,common_namespaceObject.Module)({})
7798
+ ], PluginModule);
7799
+
7801
7800
  ;// ./src/app/cli/cli.module.ts
7802
7801
  function cli_module_ts_decorate(decorators, target, key, desc) {
7803
7802
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
@@ -7821,6 +7820,7 @@ function cli_module_ts_decorate(decorators, target, key, desc) {
7821
7820
 
7822
7821
 
7823
7822
 
7823
+
7824
7824
  class CliModule {
7825
7825
  }
7826
7826
  CliModule = cli_module_ts_decorate([
@@ -7834,6 +7834,7 @@ CliModule = cli_module_ts_decorate([
7834
7834
  ],
7835
7835
  providers: [
7836
7836
  ProcessManagerService,
7837
+ IntrigConfigService,
7837
7838
  ...DaemonCommand.registerWithSubCommands(),
7838
7839
  GenerateCommand,
7839
7840
  ...SourcesCommand.registerWithSubCommands(),
@@ -8162,6 +8163,8 @@ McpModule = mcp_module_ts_decorate([
8162
8163
 
8163
8164
  ;// external "semver"
8164
8165
  const external_semver_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("semver");
8166
+ ;// external "schinquirer"
8167
+ const external_schinquirer_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("schinquirer");
8165
8168
  ;// external "@intrig/plugin-sdk"
8166
8169
  const plugin_sdk_namespaceObject = __WEBPACK_EXTERNAL_createRequire(import.meta.url)("@intrig/plugin-sdk");
8167
8170
  ;// ./src/app/init-cli/templates/schema.template.ts
@@ -8225,6 +8228,7 @@ function init_command_ts_decorate(decorators, target, key, desc) {
8225
8228
 
8226
8229
 
8227
8230
 
8231
+
8228
8232
  class InitCommand extends external_nest_commander_namespaceObject.CommandRunner {
8229
8233
  async run(passedParams, options) {
8230
8234
  console.log(external_chalk_default().blue('🚀 Initializing Intrig setup...'));
@@ -8251,6 +8255,10 @@ class InitCommand extends external_nest_commander_namespaceObject.CommandRunner
8251
8255
  }
8252
8256
  // Load and initialize the selected plugin
8253
8257
  const pluginInstance = await this.loadAndInitializePlugin(selectedPlugin);
8258
+ // Check if plugin loading failed
8259
+ if (!pluginInstance) {
8260
+ throw new Error(`Failed to load and initialize plugin ${selectedPlugin.name}. Please check the plugin installation and try again.`);
8261
+ }
8254
8262
  // Create .intrig directory if it doesn't exist
8255
8263
  const intrigDir = external_path_namespaceObject.resolve(rootDir, '.intrig');
8256
8264
  if (!external_fs_namespaceObject.existsSync(intrigDir)) {
@@ -8471,11 +8479,17 @@ class InitCommand extends external_nest_commander_namespaceObject.CommandRunner
8471
8479
  if (!pluginInstance || typeof pluginInstance.meta !== 'function' || typeof pluginInstance.generate !== 'function') {
8472
8480
  throw new Error(`Plugin factory from "${plugin.name}" did not return a valid Intrig plugin instance.`);
8473
8481
  }
8482
+ // Collect generatorSchema information if plugin has one
8483
+ let generatorOptions = {};
8484
+ if (pluginInstance.$generatorSchema) {
8485
+ loadSpinner.text = 'Collecting generator configuration...';
8486
+ generatorOptions = await this.collectGeneratorOptions(pluginInstance.$generatorSchema, plugin.name);
8487
+ }
8474
8488
  // Call init function if it exists on the plugin instance
8475
8489
  if (typeof pluginInstance.init === 'function') {
8476
8490
  loadSpinner.text = 'Calling plugin init function...';
8477
8491
  await pluginInstance.init({
8478
- options: {},
8492
+ options: generatorOptions,
8479
8493
  rootDir: rootDir,
8480
8494
  buildDir: external_path_namespaceObject.resolve(rootDir, '.intrig', 'generated'),
8481
8495
  dump: async (content)=>{
@@ -8491,6 +8505,10 @@ class InitCommand extends external_nest_commander_namespaceObject.CommandRunner
8491
8505
  }
8492
8506
  });
8493
8507
  }
8508
+ // Save generator options to intrig.config.json
8509
+ if (Object.keys(generatorOptions).length > 0) {
8510
+ await this.saveGeneratorOptions(generatorOptions);
8511
+ }
8494
8512
  loadSpinner.succeed(`Plugin ${plugin.name} loaded and initialized successfully`);
8495
8513
  return pluginInstance;
8496
8514
  } catch (loadError) {
@@ -8516,6 +8534,32 @@ class InitCommand extends external_nest_commander_namespaceObject.CommandRunner
8516
8534
  throw new Error(`Plugin "${pluginName}" does not export a factory function. ` + `Expected "createPlugin()" or a default function export. ` + `Available exports: ${Object.keys(mod || {}).join(', ')}`);
8517
8535
  }
8518
8536
  }
8537
+ async collectGeneratorOptions(generatorSchema, pluginName) {
8538
+ const options = {};
8539
+ if (!generatorSchema.properties) {
8540
+ return options;
8541
+ }
8542
+ // Use schinquirer to generate questions from schema
8543
+ if (generatorSchema.properties && Object.keys(generatorSchema.properties).length > 0) {
8544
+ const schemaInquirer = (0,external_schinquirer_namespaceObject.createInquirer)(generatorSchema);
8545
+ const answers = await schemaInquirer.prompt();
8546
+ Object.assign(options, answers);
8547
+ }
8548
+ return options;
8549
+ }
8550
+ async saveGeneratorOptions(generatorOptions) {
8551
+ const configPath = external_path_namespaceObject.resolve(process.cwd(), 'intrig.config.json');
8552
+ let config = {};
8553
+ if (external_fs_namespaceObject.existsSync(configPath)) {
8554
+ const configContent = external_fs_namespaceObject.readFileSync(configPath, 'utf-8');
8555
+ config = JSON.parse(configContent);
8556
+ }
8557
+ config.generatorOptions = {
8558
+ ...config.generatorOptions,
8559
+ ...generatorOptions
8560
+ };
8561
+ external_fs_namespaceObject.writeFileSync(configPath, JSON.stringify(config, null, 2), 'utf-8');
8562
+ }
8519
8563
  addConfigToGit(rootDir) {
8520
8564
  try {
8521
8565
  const { execSync } = __webpack_require__(1);
@@ -8625,14 +8669,14 @@ AppModule = app_module_ts_decorate([
8625
8669
  ]
8626
8670
  }),
8627
8671
  CommonModule,
8672
+ PluginModule.forRootAsync(),
8628
8673
  CliModule,
8629
8674
  DiscoveryModule,
8630
8675
  DaemonModule,
8631
8676
  InitModule,
8632
8677
  ...process?.argv?.[2] === 'mcp' || process?.env?.MCP_ENABLED === '1' ? [
8633
8678
  McpModule
8634
- ] : [],
8635
- PluginModule.forRootAsync()
8679
+ ] : []
8636
8680
  ],
8637
8681
  controllers: [],
8638
8682
  providers: []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intrig/core",
3
- "version": "0.0.15-12",
3
+ "version": "0.0.15-13",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
@@ -43,6 +43,7 @@
43
43
  "proper-lockfile": "4.1.2",
44
44
  "reflect-metadata": "0.1.14",
45
45
  "rxjs": "7.8.2",
46
+ "schinquirer": "0.3.2",
46
47
  "semver": "6.3.1",
47
48
  "tcp-port-used": "1.0.2",
48
49
  "ts-morph": "26.0.0",