w3pk 0.10.2 → 0.10.3

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.
@@ -1,112 +0,0 @@
1
- /**
2
- * Node.js Inspection Module
3
- *
4
- * Provides filesystem-based code inspection capabilities for analyzing web3 applications
5
- * from the server-side or during development. Scans application source code and generates
6
- * security reports via the Rukh API.
7
- *
8
- * @module inspect/node
9
- */
10
- /**
11
- * Configuration options for Node.js-based application inspection
12
- */
13
- interface InspectOptions {
14
- /**
15
- * The root directory of the application to inspect
16
- * @default process.cwd()
17
- */
18
- appPath?: string;
19
- /**
20
- * File patterns to include (glob patterns)
21
- * @default ['**\/*.ts', '**\/*.tsx', '**\/*.js', '**\/*.jsx', '**\/*.json']
22
- */
23
- includePatterns?: string[];
24
- /**
25
- * Directories to exclude from inspection
26
- * @default ['node_modules', 'dist', '.next', '.git', 'build', 'coverage']
27
- */
28
- excludeDirs?: string[];
29
- /**
30
- * Maximum file size in KB to include
31
- * @default 500
32
- */
33
- maxFileSizeKB?: number;
34
- /**
35
- * Maximum total size in KB for all collected code (prevents exceeding API token limits)
36
- * @default 100
37
- */
38
- maxTotalSizeKB?: number;
39
- /**
40
- * Focus mode: filters files to only include those relevant to specific features
41
- * - 'transactions': Only files with signing, transactions, or blockchain operations
42
- * - 'all': Include all files (default)
43
- * @default 'all'
44
- */
45
- focusMode?: 'transactions' | 'all';
46
- }
47
- /**
48
- * Result of the code gathering operation
49
- */
50
- interface InspectResult {
51
- /**
52
- * The generated markdown content with all collected code
53
- */
54
- markdown: string;
55
- /**
56
- * List of files that were included
57
- */
58
- includedFiles: string[];
59
- /**
60
- * Total size in KB of all included files
61
- */
62
- totalSizeKB: number;
63
- }
64
- /**
65
- * Gathers application code and generates a markdown document
66
- *
67
- * @param options - Configuration options for the inspection
68
- * @returns An object containing the markdown content and metadata
69
- *
70
- * @example
71
- * ```typescript
72
- * const result = await gatherCode({
73
- * appPath: '../genji-passkey',
74
- * includePatterns: ['**\/*.ts', '**\/*.tsx']
75
- * });
76
- *
77
- * console.log(`Collected ${result.includedFiles.length} files`);
78
- * console.log(`Total size: ${result.totalSizeKB} KB`);
79
- * ```
80
- */
81
- declare function gatherCode(options?: InspectOptions): Promise<InspectResult>;
82
- /**
83
- * Inspects an application and returns a security report via Rukh API
84
- *
85
- * @param appPath - Path to the application to inspect
86
- * @param rukhUrl - The Rukh API endpoint URL
87
- * @param context - The context name to use (should have an instruction file with report format)
88
- * @param model - The AI model to use ('anthropic', 'mistral', or 'openai')
89
- * @param focusMode - Focus on 'transactions' or include 'all' files
90
- * @returns A markdown-formatted security report
91
- *
92
- * @example
93
- * ```typescript
94
- * const report = await inspect(
95
- * '../genji-passkey',
96
- * 'https://rukh.w3hc.org',
97
- * 'w3pk',
98
- * 'anthropic',
99
- * 'transactions'
100
- * );
101
- *
102
- * console.log(report);
103
- * // Outputs:
104
- * // # Genji Passkey Report
105
- * // ## Available Methods
106
- * // ### Method #1: Sign Message
107
- * // ...
108
- * ```
109
- */
110
- declare function inspect(appPath: string, rukhUrl?: string, context?: string, model?: 'anthropic' | 'mistral' | 'openai', focusMode?: 'transactions' | 'all'): Promise<string>;
111
-
112
- export { type InspectOptions, type InspectResult, gatherCode, inspect };
@@ -1,112 +0,0 @@
1
- /**
2
- * Node.js Inspection Module
3
- *
4
- * Provides filesystem-based code inspection capabilities for analyzing web3 applications
5
- * from the server-side or during development. Scans application source code and generates
6
- * security reports via the Rukh API.
7
- *
8
- * @module inspect/node
9
- */
10
- /**
11
- * Configuration options for Node.js-based application inspection
12
- */
13
- interface InspectOptions {
14
- /**
15
- * The root directory of the application to inspect
16
- * @default process.cwd()
17
- */
18
- appPath?: string;
19
- /**
20
- * File patterns to include (glob patterns)
21
- * @default ['**\/*.ts', '**\/*.tsx', '**\/*.js', '**\/*.jsx', '**\/*.json']
22
- */
23
- includePatterns?: string[];
24
- /**
25
- * Directories to exclude from inspection
26
- * @default ['node_modules', 'dist', '.next', '.git', 'build', 'coverage']
27
- */
28
- excludeDirs?: string[];
29
- /**
30
- * Maximum file size in KB to include
31
- * @default 500
32
- */
33
- maxFileSizeKB?: number;
34
- /**
35
- * Maximum total size in KB for all collected code (prevents exceeding API token limits)
36
- * @default 100
37
- */
38
- maxTotalSizeKB?: number;
39
- /**
40
- * Focus mode: filters files to only include those relevant to specific features
41
- * - 'transactions': Only files with signing, transactions, or blockchain operations
42
- * - 'all': Include all files (default)
43
- * @default 'all'
44
- */
45
- focusMode?: 'transactions' | 'all';
46
- }
47
- /**
48
- * Result of the code gathering operation
49
- */
50
- interface InspectResult {
51
- /**
52
- * The generated markdown content with all collected code
53
- */
54
- markdown: string;
55
- /**
56
- * List of files that were included
57
- */
58
- includedFiles: string[];
59
- /**
60
- * Total size in KB of all included files
61
- */
62
- totalSizeKB: number;
63
- }
64
- /**
65
- * Gathers application code and generates a markdown document
66
- *
67
- * @param options - Configuration options for the inspection
68
- * @returns An object containing the markdown content and metadata
69
- *
70
- * @example
71
- * ```typescript
72
- * const result = await gatherCode({
73
- * appPath: '../genji-passkey',
74
- * includePatterns: ['**\/*.ts', '**\/*.tsx']
75
- * });
76
- *
77
- * console.log(`Collected ${result.includedFiles.length} files`);
78
- * console.log(`Total size: ${result.totalSizeKB} KB`);
79
- * ```
80
- */
81
- declare function gatherCode(options?: InspectOptions): Promise<InspectResult>;
82
- /**
83
- * Inspects an application and returns a security report via Rukh API
84
- *
85
- * @param appPath - Path to the application to inspect
86
- * @param rukhUrl - The Rukh API endpoint URL
87
- * @param context - The context name to use (should have an instruction file with report format)
88
- * @param model - The AI model to use ('anthropic', 'mistral', or 'openai')
89
- * @param focusMode - Focus on 'transactions' or include 'all' files
90
- * @returns A markdown-formatted security report
91
- *
92
- * @example
93
- * ```typescript
94
- * const report = await inspect(
95
- * '../genji-passkey',
96
- * 'https://rukh.w3hc.org',
97
- * 'w3pk',
98
- * 'anthropic',
99
- * 'transactions'
100
- * );
101
- *
102
- * console.log(report);
103
- * // Outputs:
104
- * // # Genji Passkey Report
105
- * // ## Available Methods
106
- * // ### Method #1: Sign Message
107
- * // ...
108
- * ```
109
- */
110
- declare function inspect(appPath: string, rukhUrl?: string, context?: string, model?: 'anthropic' | 'mistral' | 'openai', focusMode?: 'transactions' | 'all'): Promise<string>;
111
-
112
- export { type InspectOptions, type InspectResult, gatherCode, inspect };