@secondlayer/cli 3.2.1 → 3.3.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.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { AbiContract as AbiContract2 } from "@secondlayer/stacks/clarity";
2
1
  import { AbiContract } from "@secondlayer/stacks/clarity";
3
2
  /** Supported Stacks network identifiers for contract resolution. */
4
3
  type NetworkName = "mainnet" | "testnet" | "devnet";
@@ -56,6 +55,8 @@ interface ResolvedContract {
56
55
  abi: AbiContract;
57
56
  source: "api" | "local";
58
57
  }
58
+ type ConfigDefiner = (config: SecondLayerConfig) => SecondLayerConfig;
59
+ import { AbiContract as AbiContract2 } from "@secondlayer/stacks/clarity";
59
60
  /**
60
61
  * Core plugin interface that all plugins must implement
61
62
  */
@@ -215,6 +216,23 @@ interface HookResult<T = any> {
215
216
  plugin: string;
216
217
  }
217
218
  /**
219
+ * Type-safe helper for creating a `secondlayer.config.ts` configuration.
220
+ * Accepts either a config object or a factory function that receives a base config and returns a modified one.
221
+ *
222
+ * @example
223
+ * ```ts
224
+ * import { defineConfig } from "@secondlayer/cli";
225
+ *
226
+ * defineConfig({
227
+ * contracts: [{ address: "SP000000000000000000002Q6VF78.bns" }],
228
+ * out: "./src/generated.ts",
229
+ * });
230
+ * ```
231
+ */
232
+ declare function defineConfig(config: SecondLayerConfig): SecondLayerConfig;
233
+ declare function defineConfig(definer: ConfigDefiner): ConfigDefiner;
234
+ import { AbiContract as AbiContract3, AbiFunction, AbiType } from "@secondlayer/stacks/clarity";
235
+ /**
218
236
  * Core plugin manager that orchestrates plugin execution
219
237
  */
220
238
  declare class PluginManager {
@@ -280,85 +298,4 @@ declare class PluginManager {
280
298
  */
281
299
  private createUtils;
282
300
  }
283
- interface ClarinetPluginOptions {
284
- /** Path to Clarinet.toml file */
285
- path?: string;
286
- /** Include only specific contracts */
287
- include?: string[];
288
- /** Exclude specific contracts */
289
- exclude?: string[];
290
- /** Enable debug output */
291
- debug?: boolean;
292
- }
293
- /**
294
- * Clarinet plugin factory
295
- */
296
- declare const clarinet: PluginFactory<ClarinetPluginOptions>;
297
- /**
298
- * Utility function to check if a Clarinet project exists
299
- */
300
- declare function hasClarinetProject(path?: string): Promise<boolean>;
301
- interface ActionsPluginOptions {
302
- /** Include only specific contracts */
303
- include?: string[];
304
- /** Exclude specific contracts */
305
- exclude?: string[];
306
- /** Include only specific functions */
307
- includeFunctions?: string[];
308
- /** Exclude specific functions */
309
- excludeFunctions?: string[];
310
- /** Enable debug output */
311
- debug?: boolean;
312
- /** Environment variable name for default sender key (default: "STX_SENDER_KEY") */
313
- senderKeyEnv?: string;
314
- }
315
- /**
316
- * Actions plugin factory
317
- */
318
- declare const actions: PluginFactory<ActionsPluginOptions>;
319
- /**
320
- * React plugin configuration options
321
- */
322
- interface ReactPluginOptions extends PluginOptions {
323
- /**
324
- * Hooks to exclude from generation (both generic and contract-specific)
325
- * By default, all hooks are generated
326
- */
327
- exclude?: string[];
328
- }
329
- /**
330
- * React plugin factory
331
- */
332
- declare const react: PluginFactory<ReactPluginOptions>;
333
- interface TestingPluginOptions {
334
- /** Include only specific contracts */
335
- include?: string[];
336
- /** Exclude specific contracts */
337
- exclude?: string[];
338
- /** Output path for generated testing helpers (default: ./src/generated/testing.ts) */
339
- out?: string;
340
- /** Include private function helpers (default: false) */
341
- includePrivate?: boolean;
342
- /** Enable debug output */
343
- debug?: boolean;
344
- }
345
- declare const testing: PluginFactory<TestingPluginOptions>;
346
- interface BasePluginOptions {
347
- /** Include only specific contracts/functions */
348
- include?: string[];
349
- /** Exclude specific contracts/functions */
350
- exclude?: string[];
351
- /** Enable debug output */
352
- debug?: boolean;
353
- }
354
- /**
355
- * Utility function to filter contracts/functions based on include/exclude options
356
- */
357
- declare function filterByOptions<T extends {
358
- name: string
359
- }>(items: T[], options?: BasePluginOptions): T[];
360
- /**
361
- * Utility function to create a simple plugin
362
- */
363
- declare function createPlugin(name: string, version: string, implementation: Partial<SecondLayerPlugin>): SecondLayerPlugin;
364
- export { testing, react, hasClarinetProject, filterByOptions, createPlugin, clarinet, actions, TestingPluginOptions, SecondLayerPlugin, ReactPluginOptions, PluginUtils, PluginOptions, PluginManager, PluginFactory, PluginContext, Logger, GenerateContext, ClarinetPluginOptions, BasePluginOptions, ActionsPluginOptions };
301
+ export { defineConfig, UserConfig, SecondLayerPlugin, SecondLayerConfig, ResolvedConfig, ProcessedContract, PluginUtils, PluginOptions, PluginManager, PluginFactory, PluginContext, OutputType, NetworkName, Logger, GeneratedOutput, GenerateContext, ContractSource, ContractConfig, AbiType, AbiFunction, AbiContract3 as AbiContract };