driftdetect 0.6.1 → 0.7.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Geoffrey Fernald
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/bin/drift.js CHANGED
@@ -9,7 +9,7 @@
9
9
  */
10
10
  import { Command } from 'commander';
11
11
  import { VERSION } from '../index.js';
12
- import { initCommand, scanCommand, checkCommand, statusCommand, approveCommand, ignoreCommand, reportCommand, exportCommand, whereCommand, filesCommand, watchCommand, dashboardCommand, trendsCommand, parserCommand, dnaCommand, boundariesCommand, callgraphCommand, projectsCommand, skillsCommand, migrateStorageCommand, wrappersCommand, createTestTopologyCommand, createCouplingCommand, createErrorHandlingCommand, createSimulateCommand, createConstraintsCommand, createWpfCommand, createGoCommand, } from '../commands/index.js';
12
+ import { initCommand, scanCommand, checkCommand, statusCommand, approveCommand, ignoreCommand, reportCommand, exportCommand, whereCommand, filesCommand, watchCommand, dashboardCommand, trendsCommand, parserCommand, dnaCommand, boundariesCommand, callgraphCommand, projectsCommand, skillsCommand, migrateStorageCommand, wrappersCommand, createTestTopologyCommand, createCouplingCommand, createErrorHandlingCommand, createSimulateCommand, createConstraintsCommand, createWpfCommand, createGoCommand, envCommand, constantsCommand, } from '../commands/index.js';
13
13
  /**
14
14
  * Create and configure the main CLI program
15
15
  */
@@ -54,6 +54,10 @@ function createProgram() {
54
54
  program.addCommand(createWpfCommand());
55
55
  // Go Language Support
56
56
  program.addCommand(createGoCommand());
57
+ // Environment Variable Detection
58
+ program.addCommand(envCommand);
59
+ // Constants & Enum Analysis
60
+ program.addCommand(constantsCommand);
57
61
  // Add help examples
58
62
  program.addHelpText('after', `
59
63
  Examples:
@@ -117,6 +121,21 @@ Examples:
117
121
  $ drift simulate "add rate limiting" Simulate implementation approaches
118
122
  $ drift simulate "add auth" -v Simulate with detailed analysis
119
123
  $ drift simulate "add caching" --json Output simulation as JSON
124
+ $ drift env Show environment variable access overview
125
+ $ drift env scan Scan for environment variable access
126
+ $ drift env list List all discovered env variables
127
+ $ drift env secrets Show secret and credential variables
128
+ $ drift env var <name> Show details for a specific variable
129
+ $ drift env required Show required variables without defaults
130
+ $ drift env file <pattern> Show what env vars a file accesses
131
+ $ drift constants Show constants overview
132
+ $ drift constants list List all constants
133
+ $ drift constants list -c api List API-related constants
134
+ $ drift constants get <name> Show constant details
135
+ $ drift constants secrets Show potential hardcoded secrets
136
+ $ drift constants inconsistent Show constants with inconsistent values
137
+ $ drift constants dead Show potentially unused constants
138
+ $ drift constants export out.json Export constants to file
120
139
 
121
140
  Documentation:
122
141
  https://github.com/drift/drift
@@ -1 +1 @@
1
- {"version":3,"file":"drift.js","sourceRoot":"","sources":["../../src/bin/drift.ts"],"names":[],"mappings":";AACA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,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,CAAC,OAAO,CAAC,EAAE,CAAC;gBACzB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,cAAc;AACd,IAAI,EAAE,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Constants Command - drift constants
3
+ *
4
+ * Analyze constants, enums, and exported values across the codebase.
5
+ * Detects hardcoded secrets, inconsistent values, and magic numbers.
6
+ *
7
+ * @requirements Constant & Enum Extraction Feature
8
+ */
9
+ import { Command } from 'commander';
10
+ import { type ConstantCategory, type ConstantLanguage, type IssueSeverity } from 'driftdetect-core';
11
+ export interface ConstantsOptions {
12
+ /** Output format */
13
+ format?: 'text' | 'json' | 'csv';
14
+ /** Filter by category */
15
+ category?: ConstantCategory;
16
+ /** Filter by language */
17
+ language?: ConstantLanguage;
18
+ /** Filter by file path */
19
+ file?: string;
20
+ /** Search by name */
21
+ search?: string;
22
+ /** Filter by exported status */
23
+ exported?: boolean;
24
+ /** Minimum severity for secrets */
25
+ severity?: IssueSeverity;
26
+ /** Limit results */
27
+ limit?: number;
28
+ /** Enable verbose output */
29
+ verbose?: boolean;
30
+ }
31
+ /**
32
+ * Create the constants command with subcommands
33
+ */
34
+ export declare const constantsCommand: Command;
35
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/commands/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,WAAW,gBAAgB;IAC/B,oBAAoB;IACpB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;IACjC,yBAAyB;IACzB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,yBAAyB;IACzB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,0BAA0B;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,oBAAoB;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4BAA4B;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAsqBD;;GAEG;AACH,eAAO,MAAM,gBAAgB,SAIJ,CAAC"}