specweave 1.0.464 → 1.0.466
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/plugins/specweave/lib/vendor/core/ac-test-validator-cli.d.ts +16 -0
- package/dist/plugins/specweave/lib/vendor/core/ac-test-validator-cli.js +139 -0
- package/dist/plugins/specweave/lib/vendor/core/ac-test-validator-cli.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/core/ac-test-validator.d.ts +111 -0
- package/dist/plugins/specweave/lib/vendor/core/ac-test-validator.js +304 -0
- package/dist/plugins/specweave/lib/vendor/core/ac-test-validator.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/core/increment/ac-status-manager.d.ts +115 -0
- package/dist/plugins/specweave/lib/vendor/core/increment/ac-status-manager.js +359 -0
- package/dist/plugins/specweave/lib/vendor/core/increment/ac-status-manager.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/core/increment/active-increment-manager.d.ts +121 -0
- package/dist/plugins/specweave/lib/vendor/core/increment/active-increment-manager.js +273 -0
- package/dist/plugins/specweave/lib/vendor/core/increment/active-increment-manager.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/core/increment/auto-transition-manager.d.ts +72 -0
- package/dist/plugins/specweave/lib/vendor/core/increment/auto-transition-manager.js +237 -0
- package/dist/plugins/specweave/lib/vendor/core/increment/auto-transition-manager.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/core/increment/duplicate-detector.d.ts +52 -0
- package/dist/plugins/specweave/lib/vendor/core/increment/duplicate-detector.js +281 -0
- package/dist/plugins/specweave/lib/vendor/core/increment/duplicate-detector.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/core/increment/metadata-manager.d.ts +278 -0
- package/dist/plugins/specweave/lib/vendor/core/increment/metadata-manager.js +925 -0
- package/dist/plugins/specweave/lib/vendor/core/increment/metadata-manager.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/core/increment/status-auto-transition.d.ts +113 -0
- package/dist/plugins/specweave/lib/vendor/core/increment/status-auto-transition.js +317 -0
- package/dist/plugins/specweave/lib/vendor/core/increment/status-auto-transition.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/core/types/increment-metadata.d.ts +442 -0
- package/dist/plugins/specweave/lib/vendor/core/types/increment-metadata.js +246 -0
- package/dist/plugins/specweave/lib/vendor/core/types/increment-metadata.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/core/universal-auto-create.d.ts +64 -0
- package/dist/plugins/specweave/lib/vendor/core/universal-auto-create.js +228 -0
- package/dist/plugins/specweave/lib/vendor/core/universal-auto-create.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/generators/spec/task-parser.d.ts +95 -0
- package/dist/plugins/specweave/lib/vendor/generators/spec/task-parser.js +300 -0
- package/dist/plugins/specweave/lib/vendor/generators/spec/task-parser.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/sync/config.d.ts +73 -0
- package/dist/plugins/specweave/lib/vendor/sync/config.js +132 -0
- package/dist/plugins/specweave/lib/vendor/sync/config.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/sync/github-reconciler.d.ts +163 -0
- package/dist/plugins/specweave/lib/vendor/sync/github-reconciler.js +898 -0
- package/dist/plugins/specweave/lib/vendor/sync/github-reconciler.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/sync/provider-router.d.ts +86 -0
- package/dist/plugins/specweave/lib/vendor/sync/provider-router.js +147 -0
- package/dist/plugins/specweave/lib/vendor/sync/provider-router.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/sync/status-mapper.d.ts +120 -0
- package/dist/plugins/specweave/lib/vendor/sync/status-mapper.js +164 -0
- package/dist/plugins/specweave/lib/vendor/sync/status-mapper.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/utils/auth-helpers.d.ts +151 -0
- package/dist/plugins/specweave/lib/vendor/utils/auth-helpers.js +359 -0
- package/dist/plugins/specweave/lib/vendor/utils/auth-helpers.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/utils/chalk-fallback.d.ts +38 -0
- package/dist/plugins/specweave/lib/vendor/utils/chalk-fallback.js +118 -0
- package/dist/plugins/specweave/lib/vendor/utils/chalk-fallback.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/utils/clean-env.d.ts +47 -0
- package/dist/plugins/specweave/lib/vendor/utils/clean-env.js +63 -0
- package/dist/plugins/specweave/lib/vendor/utils/clean-env.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/utils/credential-masker.d.ts +118 -0
- package/dist/plugins/specweave/lib/vendor/utils/credential-masker.js +275 -0
- package/dist/plugins/specweave/lib/vendor/utils/credential-masker.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/utils/execFileNoThrow.d.ts +99 -0
- package/dist/plugins/specweave/lib/vendor/utils/execFileNoThrow.js +149 -0
- package/dist/plugins/specweave/lib/vendor/utils/execFileNoThrow.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/utils/feature-id-derivation.d.ts +63 -0
- package/dist/plugins/specweave/lib/vendor/utils/feature-id-derivation.js +85 -0
- package/dist/plugins/specweave/lib/vendor/utils/feature-id-derivation.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/utils/fs-native.d.ts +219 -0
- package/dist/plugins/specweave/lib/vendor/utils/fs-native.js +397 -0
- package/dist/plugins/specweave/lib/vendor/utils/fs-native.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/utils/logger.d.ts +56 -0
- package/dist/plugins/specweave/lib/vendor/utils/logger.js +123 -0
- package/dist/plugins/specweave/lib/vendor/utils/logger.js.map +1 -0
- package/dist/plugins/specweave/lib/vendor/utils/translation.d.ts +187 -0
- package/dist/plugins/specweave/lib/vendor/utils/translation.js +414 -0
- package/dist/plugins/specweave/lib/vendor/utils/translation.js.map +1 -0
- package/dist/plugins/specweave-ado/lib/ado-ac-checkbox-sync.js +1 -1
- package/dist/plugins/specweave-ado/lib/ado-ac-checkbox-sync.js.map +1 -1
- package/dist/plugins/specweave-ado/lib/ado-spec-sync.js +1 -1
- package/dist/plugins/specweave-ado/lib/ado-spec-sync.js.map +1 -1
- package/dist/plugins/specweave-github/lib/github-ac-checkbox-sync.js +2 -2
- package/dist/plugins/specweave-github/lib/github-ac-checkbox-sync.js.map +1 -1
- package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/github-feature-sync.js +13 -4
- package/dist/plugins/specweave-github/lib/github-feature-sync.js.map +1 -1
- package/dist/plugins/specweave-jira/lib/jira-ac-checkbox-sync.js +1 -1
- package/dist/plugins/specweave-jira/lib/jira-ac-checkbox-sync.js.map +1 -1
- package/dist/plugins/specweave-jira/lib/jira-spec-sync.js +1 -1
- package/dist/plugins/specweave-jira/lib/jira-spec-sync.js.map +1 -1
- package/dist/src/sync/spec-to-living-docs-sync.js +1 -1
- package/dist/src/sync/spec-to-living-docs-sync.js.map +1 -1
- package/package.json +1 -1
- package/plugins/specweave/lib/vendor/utils/auth-helpers.d.ts +151 -0
- package/plugins/specweave/lib/vendor/utils/auth-helpers.js +359 -0
- package/plugins/specweave/lib/vendor/utils/auth-helpers.js.map +1 -0
- package/plugins/specweave/skills/team-lead/SKILL.md +150 -56
- package/plugins/specweave/skills/team-lead/agents/backend.md +13 -9
- package/plugins/specweave/skills/team-lead/agents/database.md +13 -9
- package/plugins/specweave/skills/team-lead/agents/frontend.md +12 -8
- package/plugins/specweave/skills/team-lead/agents/security.md +13 -9
- package/plugins/specweave/skills/team-lead/agents/testing.md +12 -8
- package/plugins/specweave-ado/lib/ado-ac-checkbox-sync.js +1 -1
- package/plugins/specweave-ado/lib/ado-ac-checkbox-sync.ts +1 -1
- package/plugins/specweave-ado/lib/ado-spec-sync.js +1 -1
- package/plugins/specweave-ado/lib/ado-spec-sync.ts +1 -1
- package/plugins/specweave-github/lib/github-ac-checkbox-sync.js +1 -1
- package/plugins/specweave-github/lib/github-ac-checkbox-sync.ts +2 -2
- package/plugins/specweave-github/lib/github-feature-sync.js +11 -3
- package/plugins/specweave-github/lib/github-feature-sync.ts +13 -4
- package/plugins/specweave-jira/lib/jira-ac-checkbox-sync.js +1 -1
- package/plugins/specweave-jira/lib/jira-ac-checkbox-sync.ts +1 -1
- package/plugins/specweave-jira/lib/jira-spec-sync.js +1 -1
- package/plugins/specweave-jira/lib/jira-spec-sync.ts +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chalk-fallback.js","sourceRoot":"","sources":["../../../src/utils/chalk-fallback.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,8CAA8C;AAC9C,MAAM,IAAI,GAAG;IACX,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,UAAU;IACf,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;CACjB,CAAC;AAEF,+CAA+C;AAC/C,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,KAAK,IAAI,KAAK,CAAC;AAKrD;;GAEG;AACH,SAAS,aAAa,CAAC,SAAiB;IACtC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAgB,EAAE,EAAE;QAC/B,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,CAAC,aAAa;YAAE,OAAO,GAAG,CAAC;QAC/B,OAAO,GAAG,SAAS,GAAG,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IAC3C,CAAC,CAAY,CAAC;IAEd,0BAA0B;IAC1B,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,IAAgB,EAAE,EAAE;QAC9B,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QACzB,IAAI,CAAC,aAAa;YAAE,OAAO,GAAG,CAAC;QAC/B,OAAO,GAAG,IAAI,CAAC,IAAI,GAAG,SAAS,GAAG,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IACvD,CA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CAAC;QAC1C,aAAa,GAAG,WAAW,CAAC,OAAmC,CAAC;QAChE,OAAO,aAAa,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,oCAAoC;QACpC,aAAa,GAAG,aAAa,CAAC;QAC9B,OAAO,aAAa,CAAC;IACvB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,aAAa,IAAI,aAAa,CAAC;AACxC,CAAC;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clean Environment Utility
|
|
3
|
+
*
|
|
4
|
+
* CRITICAL: This module MUST have NO imports from modules that spawn child processes
|
|
5
|
+
* to avoid circular dependencies. This is a foundational utility.
|
|
6
|
+
*
|
|
7
|
+
* This utility is used by:
|
|
8
|
+
* - execFileNoThrow.ts (core exec utility)
|
|
9
|
+
* - claude-cli-detector.ts (CLI detection)
|
|
10
|
+
* - Test files (via tests/test-utils/clean-env.ts)
|
|
11
|
+
*
|
|
12
|
+
* @module clean-env
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Create a clean environment for spawning child processes.
|
|
16
|
+
*
|
|
17
|
+
* CRITICAL: Removes env vars that can cause child processes to fail:
|
|
18
|
+
*
|
|
19
|
+
* - CLAUDECODE: Nested session guard (Claude Code v2.1.39+) blocks `claude -p`
|
|
20
|
+
* when running inside a Claude Code session. Unsetting is the official bypass.
|
|
21
|
+
* See: https://github.com/anthropics/claude-code/issues/25434
|
|
22
|
+
* Same fix applied in Python Agent SDK PR #594.
|
|
23
|
+
* - VSCode Debug: NODE_OPTIONS contains --inspect-brk flags
|
|
24
|
+
* - WebStorm/IntelliJ: NODE_OPTIONS or IDEA-specific vars
|
|
25
|
+
* - CI/CD (GitHub Actions, etc.): May set NODE_OPTIONS for coverage
|
|
26
|
+
* - Jest/Vitest: May set NODE_OPTIONS for debugging
|
|
27
|
+
*
|
|
28
|
+
* This function is safe to use in ALL environments:
|
|
29
|
+
* - Windows, macOS, Linux
|
|
30
|
+
* - Local development, CI/CD pipelines
|
|
31
|
+
* - Debug mode, run mode, production
|
|
32
|
+
*
|
|
33
|
+
* If a variable is not set, delete is a no-op (safe).
|
|
34
|
+
*
|
|
35
|
+
* @returns A copy of process.env with problematic vars removed
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* import { getCleanEnv } from './clean-env.js';
|
|
40
|
+
*
|
|
41
|
+
* // Spawn a child process without debugger interference
|
|
42
|
+
* execSync('node script.js', { env: getCleanEnv() });
|
|
43
|
+
* spawnSync('claude', ['--version'], { env: getCleanEnv() });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export declare function getCleanEnv(): NodeJS.ProcessEnv;
|
|
47
|
+
//# sourceMappingURL=clean-env.d.ts.map
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clean Environment Utility
|
|
3
|
+
*
|
|
4
|
+
* CRITICAL: This module MUST have NO imports from modules that spawn child processes
|
|
5
|
+
* to avoid circular dependencies. This is a foundational utility.
|
|
6
|
+
*
|
|
7
|
+
* This utility is used by:
|
|
8
|
+
* - execFileNoThrow.ts (core exec utility)
|
|
9
|
+
* - claude-cli-detector.ts (CLI detection)
|
|
10
|
+
* - Test files (via tests/test-utils/clean-env.ts)
|
|
11
|
+
*
|
|
12
|
+
* @module clean-env
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Create a clean environment for spawning child processes.
|
|
16
|
+
*
|
|
17
|
+
* CRITICAL: Removes env vars that can cause child processes to fail:
|
|
18
|
+
*
|
|
19
|
+
* - CLAUDECODE: Nested session guard (Claude Code v2.1.39+) blocks `claude -p`
|
|
20
|
+
* when running inside a Claude Code session. Unsetting is the official bypass.
|
|
21
|
+
* See: https://github.com/anthropics/claude-code/issues/25434
|
|
22
|
+
* Same fix applied in Python Agent SDK PR #594.
|
|
23
|
+
* - VSCode Debug: NODE_OPTIONS contains --inspect-brk flags
|
|
24
|
+
* - WebStorm/IntelliJ: NODE_OPTIONS or IDEA-specific vars
|
|
25
|
+
* - CI/CD (GitHub Actions, etc.): May set NODE_OPTIONS for coverage
|
|
26
|
+
* - Jest/Vitest: May set NODE_OPTIONS for debugging
|
|
27
|
+
*
|
|
28
|
+
* This function is safe to use in ALL environments:
|
|
29
|
+
* - Windows, macOS, Linux
|
|
30
|
+
* - Local development, CI/CD pipelines
|
|
31
|
+
* - Debug mode, run mode, production
|
|
32
|
+
*
|
|
33
|
+
* If a variable is not set, delete is a no-op (safe).
|
|
34
|
+
*
|
|
35
|
+
* @returns A copy of process.env with problematic vars removed
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* import { getCleanEnv } from './clean-env.js';
|
|
40
|
+
*
|
|
41
|
+
* // Spawn a child process without debugger interference
|
|
42
|
+
* execSync('node script.js', { env: getCleanEnv() });
|
|
43
|
+
* spawnSync('claude', ['--version'], { env: getCleanEnv() });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export function getCleanEnv() {
|
|
47
|
+
const cleanEnv = { ...process.env };
|
|
48
|
+
// Remove Claude Code nested session guard (v2.1.39+)
|
|
49
|
+
// When CLAUDECODE=1, `claude -p` refuses to start with:
|
|
50
|
+
// "Claude Code cannot be launched inside another Claude Code session"
|
|
51
|
+
// This is safe: we're spawning a one-shot pipe-mode call, not a competing session.
|
|
52
|
+
delete cleanEnv.CLAUDECODE;
|
|
53
|
+
// Remove Node.js debugger/inspector flags (VSCode, WebStorm, etc.)
|
|
54
|
+
delete cleanEnv.NODE_OPTIONS;
|
|
55
|
+
delete cleanEnv.NODE_INSPECT;
|
|
56
|
+
delete cleanEnv.NODE_INSPECT_RESUME_ON_START;
|
|
57
|
+
// Remove coverage instrumentation that can interfere with spawned processes
|
|
58
|
+
delete cleanEnv.NODE_V8_COVERAGE;
|
|
59
|
+
// Remove test runner debug vars
|
|
60
|
+
delete cleanEnv.VSCODE_INSPECTOR_OPTIONS;
|
|
61
|
+
return cleanEnv;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=clean-env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clean-env.js","sourceRoot":"","sources":["../../../src/utils/clean-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,WAAW;IACzB,MAAM,QAAQ,GAAG,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAEpC,qDAAqD;IACrD,wDAAwD;IACxD,wEAAwE;IACxE,mFAAmF;IACnF,OAAO,QAAQ,CAAC,UAAU,CAAC;IAE3B,mEAAmE;IACnE,OAAO,QAAQ,CAAC,YAAY,CAAC;IAC7B,OAAO,QAAQ,CAAC,YAAY,CAAC;IAC7B,OAAO,QAAQ,CAAC,4BAA4B,CAAC;IAE7C,4EAA4E;IAC5E,OAAO,QAAQ,CAAC,gBAAgB,CAAC;IAEjC,gCAAgC;IAChC,OAAO,QAAQ,CAAC,wBAAwB,CAAC;IAEzC,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credential Masker - Security Utility
|
|
3
|
+
*
|
|
4
|
+
* Automatically masks sensitive credentials in logs, console output, and file writes.
|
|
5
|
+
* Prevents accidental exposure of secrets in debugging output and log files.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Pattern-based detection of common credential formats
|
|
9
|
+
* - Context-aware masking (preserves first/last characters for debugging)
|
|
10
|
+
* - Zero-config (works out of the box)
|
|
11
|
+
* - Handles JSON, environment variables, URLs, and more
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Masking options
|
|
15
|
+
*/
|
|
16
|
+
export interface MaskOptions {
|
|
17
|
+
/**
|
|
18
|
+
* Show first N characters (default: 4)
|
|
19
|
+
*/
|
|
20
|
+
showFirst?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Show last N characters (default: 4)
|
|
23
|
+
*/
|
|
24
|
+
showLast?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Mask character (default: '*')
|
|
27
|
+
*/
|
|
28
|
+
maskChar?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Minimum length to mask (default: 8)
|
|
31
|
+
* Shorter values are completely masked
|
|
32
|
+
*/
|
|
33
|
+
minLength?: number;
|
|
34
|
+
/**
|
|
35
|
+
* Enable aggressive mode (masks more patterns)
|
|
36
|
+
*/
|
|
37
|
+
aggressive?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Mask a credential value
|
|
41
|
+
*
|
|
42
|
+
* @param value - Credential to mask
|
|
43
|
+
* @param options - Masking options
|
|
44
|
+
* @returns Masked credential
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* maskValue('ghp_1234567890abcdef') // 'ghp_****def'
|
|
48
|
+
* maskValue('short') // '********'
|
|
49
|
+
*/
|
|
50
|
+
export declare function maskValue(value: string, options?: MaskOptions): string;
|
|
51
|
+
/**
|
|
52
|
+
* Mask all credentials in a string
|
|
53
|
+
*
|
|
54
|
+
* @param text - Text potentially containing credentials
|
|
55
|
+
* @param options - Masking options
|
|
56
|
+
* @returns Text with credentials masked
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* maskCredentials('GITHUB_TOKEN=ghp_123456') // 'GITHUB_TOKEN=ghp_****'
|
|
60
|
+
* maskCredentials('Bearer eyJhbGc...') // 'Bearer eyJh****...'
|
|
61
|
+
*/
|
|
62
|
+
export declare function maskCredentials(text: string, options?: MaskOptions): string;
|
|
63
|
+
/**
|
|
64
|
+
* Mask credentials in structured data (objects, arrays)
|
|
65
|
+
*
|
|
66
|
+
* @param data - Data structure
|
|
67
|
+
* @param options - Masking options
|
|
68
|
+
* @returns Data with credentials masked
|
|
69
|
+
*/
|
|
70
|
+
export declare function maskCredentialsInData(data: any, options?: MaskOptions): any;
|
|
71
|
+
/**
|
|
72
|
+
* Sanitize bash command output
|
|
73
|
+
*
|
|
74
|
+
* Masks credentials in bash command outputs (especially grep results)
|
|
75
|
+
*
|
|
76
|
+
* @param output - Command output
|
|
77
|
+
* @param options - Masking options
|
|
78
|
+
* @returns Sanitized output
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* sanitizeBashOutput('GITHUB_TOKEN=ghp_123456\nAPI_KEY=sk_test_123')
|
|
82
|
+
* // 'GITHUB_TOKEN=ghp_****\nAPI_KEY=sk_t****123'
|
|
83
|
+
*/
|
|
84
|
+
export declare function sanitizeBashOutput(output: string, options?: MaskOptions): string;
|
|
85
|
+
/**
|
|
86
|
+
* Check if text contains potential credentials
|
|
87
|
+
*
|
|
88
|
+
* @param text - Text to check
|
|
89
|
+
* @returns True if credentials detected
|
|
90
|
+
*/
|
|
91
|
+
export declare function containsCredentials(text: string): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Create a credential-safe logger wrapper
|
|
94
|
+
*
|
|
95
|
+
* Wraps a logger to automatically mask credentials
|
|
96
|
+
*
|
|
97
|
+
* @param logger - Original logger
|
|
98
|
+
* @param options - Masking options
|
|
99
|
+
* @returns Wrapped logger with automatic masking
|
|
100
|
+
*/
|
|
101
|
+
export declare function createSecureLogger(logger: any, options?: MaskOptions): {
|
|
102
|
+
log: (message: string, ...args: any[]) => void;
|
|
103
|
+
info: (message: string, ...args: any[]) => void;
|
|
104
|
+
error: (message: string, error?: any) => void;
|
|
105
|
+
warn: (message: string) => void;
|
|
106
|
+
debug: (message: string) => void;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Environment variable masking helper
|
|
110
|
+
*
|
|
111
|
+
* Masks sensitive environment variables before logging
|
|
112
|
+
*
|
|
113
|
+
* @param env - Environment object
|
|
114
|
+
* @param options - Masking options
|
|
115
|
+
* @returns Masked environment object
|
|
116
|
+
*/
|
|
117
|
+
export declare function maskEnvironment(env?: NodeJS.ProcessEnv, options?: MaskOptions): Record<string, string>;
|
|
118
|
+
//# sourceMappingURL=credential-masker.d.ts.map
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credential Masker - Security Utility
|
|
3
|
+
*
|
|
4
|
+
* Automatically masks sensitive credentials in logs, console output, and file writes.
|
|
5
|
+
* Prevents accidental exposure of secrets in debugging output and log files.
|
|
6
|
+
*
|
|
7
|
+
* Features:
|
|
8
|
+
* - Pattern-based detection of common credential formats
|
|
9
|
+
* - Context-aware masking (preserves first/last characters for debugging)
|
|
10
|
+
* - Zero-config (works out of the box)
|
|
11
|
+
* - Handles JSON, environment variables, URLs, and more
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Sensitive patterns to mask
|
|
15
|
+
*/
|
|
16
|
+
const SENSITIVE_PATTERNS = [
|
|
17
|
+
// Environment variable assignments
|
|
18
|
+
{ pattern: /\b(GITHUB_TOKEN|GH_TOKEN)=([^\s]+)/gi, name: 'GitHub Token' },
|
|
19
|
+
{ pattern: /\b(JIRA_API_TOKEN|JIRA_TOKEN)=([^\s]+)/gi, name: 'JIRA Token' },
|
|
20
|
+
{ pattern: /\b(JIRA_EMAIL)=([^\s@]+@[^\s]+)/gi, name: 'JIRA Email' },
|
|
21
|
+
{ pattern: /\b(AZURE_DEVOPS_PAT|AZURE_DEVOPS_TOKEN|ADO_PAT)=([^\s]+)/gi, name: 'Azure DevOps PAT' },
|
|
22
|
+
{ pattern: /\b(AWS_SECRET_ACCESS_KEY)=([^\s]+)/gi, name: 'AWS Secret Key' },
|
|
23
|
+
{ pattern: /\b(AWS_ACCESS_KEY_ID)=([^\s]+)/gi, name: 'AWS Access Key' },
|
|
24
|
+
{ pattern: /\b(OPENAI_API_KEY|ANTHROPIC_API_KEY)=([^\s]+)/gi, name: 'API Key' },
|
|
25
|
+
{ pattern: /\b(DATABASE_URL|DB_URL|POSTGRES_URL|MYSQL_URL)=([^\s]+)/gi, name: 'Database URL' },
|
|
26
|
+
{ pattern: /\b(SUPABASE_KEY|SUPABASE_ANON_KEY|SUPABASE_SERVICE_KEY)=([^\s]+)/gi, name: 'Supabase Key' },
|
|
27
|
+
{ pattern: /\b(CF_API_TOKEN|CLOUDFLARE_API_TOKEN)=([^\s]+)/gi, name: 'Cloudflare Token' },
|
|
28
|
+
{ pattern: /\b(VERCEL_TOKEN)=([^\s]+)/gi, name: 'Vercel Token' },
|
|
29
|
+
// JSON-style credentials
|
|
30
|
+
{ pattern: /"(token|apiToken|api_token|accessToken|access_token|password|secret|apiKey|api_key)"\s*:\s*"([^"]{8,})"/gi, name: 'JSON Token' },
|
|
31
|
+
// URLs with credentials (http/https)
|
|
32
|
+
{ pattern: /https?:\/\/[^:]+:([^@]{8,})@[^\s]+/gi, name: 'HTTP URL with credentials' },
|
|
33
|
+
// URLs with credentials (redis, postgresql, mysql, mongodb)
|
|
34
|
+
{ pattern: /(redis|postgresql|postgres|mysql|mongodb):\/\/[^:]*:([^@]{6,})@[^\s]+/gi, name: 'Database URL with credentials' },
|
|
35
|
+
// Bearer tokens
|
|
36
|
+
{ pattern: /Bearer\s+([A-Za-z0-9\-_=]+\.[A-Za-z0-9\-_=]+\.[A-Za-z0-9\-_.+/=]+)/gi, name: 'Bearer JWT' },
|
|
37
|
+
{ pattern: /Bearer\s+([A-Za-z0-9_\-]{20,})/gi, name: 'Bearer Token' },
|
|
38
|
+
// Generic tokens (alphanumeric strings 32+ chars)
|
|
39
|
+
{ pattern: /\b([a-zA-Z0-9_\-]{40,})\b/g, name: 'Generic Token' },
|
|
40
|
+
];
|
|
41
|
+
/**
|
|
42
|
+
* Default masking options
|
|
43
|
+
*/
|
|
44
|
+
const DEFAULT_OPTIONS = {
|
|
45
|
+
showFirst: 4,
|
|
46
|
+
showLast: 4,
|
|
47
|
+
maskChar: '*',
|
|
48
|
+
minLength: 8,
|
|
49
|
+
aggressive: false,
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Mask a credential value
|
|
53
|
+
*
|
|
54
|
+
* @param value - Credential to mask
|
|
55
|
+
* @param options - Masking options
|
|
56
|
+
* @returns Masked credential
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* maskValue('ghp_1234567890abcdef') // 'ghp_****def'
|
|
60
|
+
* maskValue('short') // '********'
|
|
61
|
+
*/
|
|
62
|
+
export function maskValue(value, options = {}) {
|
|
63
|
+
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
64
|
+
if (!value || value.length < opts.minLength) {
|
|
65
|
+
// Short values - completely mask
|
|
66
|
+
return opts.maskChar.repeat(8);
|
|
67
|
+
}
|
|
68
|
+
const showCount = opts.showFirst + opts.showLast;
|
|
69
|
+
if (value.length <= showCount) {
|
|
70
|
+
// Value too short to show partial
|
|
71
|
+
return opts.maskChar.repeat(8);
|
|
72
|
+
}
|
|
73
|
+
const first = value.slice(0, opts.showFirst);
|
|
74
|
+
const last = value.slice(-opts.showLast);
|
|
75
|
+
const maskLength = Math.max(8, value.length - showCount);
|
|
76
|
+
const mask = opts.maskChar.repeat(maskLength);
|
|
77
|
+
return `${first}${mask}${last}`;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Mask all credentials in a string
|
|
81
|
+
*
|
|
82
|
+
* @param text - Text potentially containing credentials
|
|
83
|
+
* @param options - Masking options
|
|
84
|
+
* @returns Text with credentials masked
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* maskCredentials('GITHUB_TOKEN=ghp_123456') // 'GITHUB_TOKEN=ghp_****'
|
|
88
|
+
* maskCredentials('Bearer eyJhbGc...') // 'Bearer eyJh****...'
|
|
89
|
+
*/
|
|
90
|
+
export function maskCredentials(text, options = {}) {
|
|
91
|
+
if (!text)
|
|
92
|
+
return text;
|
|
93
|
+
let maskedText = text;
|
|
94
|
+
for (const { pattern, name } of SENSITIVE_PATTERNS) {
|
|
95
|
+
maskedText = maskedText.replace(pattern, (match, key, value) => {
|
|
96
|
+
// For environment variables: KEY=value
|
|
97
|
+
if (key && value && typeof value === 'string') {
|
|
98
|
+
return `${key}=${maskValue(value, options)}`;
|
|
99
|
+
}
|
|
100
|
+
// For JSON: "key": "value"
|
|
101
|
+
if (match.includes(':') && value && typeof value === 'string') {
|
|
102
|
+
return match.replace(value, maskValue(value, options));
|
|
103
|
+
}
|
|
104
|
+
// For URLs: http://user:pass@host
|
|
105
|
+
if (match.includes('://') && value && typeof value === 'string') {
|
|
106
|
+
return match.replace(value, maskValue(value, options));
|
|
107
|
+
}
|
|
108
|
+
// For Bearer tokens: Bearer <token>
|
|
109
|
+
if (match.toLowerCase().includes('bearer') && key && typeof key === 'string') {
|
|
110
|
+
return `Bearer ${maskValue(key, options)}`;
|
|
111
|
+
}
|
|
112
|
+
// Generic token (single capture group)
|
|
113
|
+
if (key && !value && typeof key === 'string') {
|
|
114
|
+
return maskValue(key, options);
|
|
115
|
+
}
|
|
116
|
+
// Fallback: mask the whole match
|
|
117
|
+
return maskValue(match, options);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
return maskedText;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Mask credentials in structured data (objects, arrays)
|
|
124
|
+
*
|
|
125
|
+
* @param data - Data structure
|
|
126
|
+
* @param options - Masking options
|
|
127
|
+
* @returns Data with credentials masked
|
|
128
|
+
*/
|
|
129
|
+
export function maskCredentialsInData(data, options = {}) {
|
|
130
|
+
if (typeof data === 'string') {
|
|
131
|
+
return maskCredentials(data, options);
|
|
132
|
+
}
|
|
133
|
+
if (Array.isArray(data)) {
|
|
134
|
+
return data.map(item => maskCredentialsInData(item, options));
|
|
135
|
+
}
|
|
136
|
+
if (data && typeof data === 'object') {
|
|
137
|
+
const masked = {};
|
|
138
|
+
for (const [key, value] of Object.entries(data)) {
|
|
139
|
+
const lowerKey = key.toLowerCase();
|
|
140
|
+
// Check if key suggests sensitive data
|
|
141
|
+
const isSensitiveKey = [
|
|
142
|
+
'token', 'password', 'secret', 'key', 'credential',
|
|
143
|
+
'apitoken', 'api_token', 'accesstoken', 'access_token',
|
|
144
|
+
'pat', 'apikey', 'api_key'
|
|
145
|
+
].some(sensitive => lowerKey.includes(sensitive));
|
|
146
|
+
if (isSensitiveKey && typeof value === 'string') {
|
|
147
|
+
masked[key] = maskValue(value, options);
|
|
148
|
+
}
|
|
149
|
+
else if (typeof value === 'object') {
|
|
150
|
+
masked[key] = maskCredentialsInData(value, options);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
masked[key] = value;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return masked;
|
|
157
|
+
}
|
|
158
|
+
return data;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Sanitize bash command output
|
|
162
|
+
*
|
|
163
|
+
* Masks credentials in bash command outputs (especially grep results)
|
|
164
|
+
*
|
|
165
|
+
* @param output - Command output
|
|
166
|
+
* @param options - Masking options
|
|
167
|
+
* @returns Sanitized output
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* sanitizeBashOutput('GITHUB_TOKEN=ghp_123456\nAPI_KEY=sk_test_123')
|
|
171
|
+
* // 'GITHUB_TOKEN=ghp_****\nAPI_KEY=sk_t****123'
|
|
172
|
+
*/
|
|
173
|
+
export function sanitizeBashOutput(output, options = {}) {
|
|
174
|
+
if (!output)
|
|
175
|
+
return output;
|
|
176
|
+
// Mask line-by-line to preserve structure
|
|
177
|
+
return output
|
|
178
|
+
.split('\n')
|
|
179
|
+
.map(line => maskCredentials(line, options))
|
|
180
|
+
.join('\n');
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Check if text contains potential credentials
|
|
184
|
+
*
|
|
185
|
+
* @param text - Text to check
|
|
186
|
+
* @returns True if credentials detected
|
|
187
|
+
*/
|
|
188
|
+
export function containsCredentials(text) {
|
|
189
|
+
if (!text)
|
|
190
|
+
return false;
|
|
191
|
+
return SENSITIVE_PATTERNS.some(({ pattern }) => {
|
|
192
|
+
// Reset regex state
|
|
193
|
+
pattern.lastIndex = 0;
|
|
194
|
+
return pattern.test(text);
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Create a credential-safe logger wrapper
|
|
199
|
+
*
|
|
200
|
+
* Wraps a logger to automatically mask credentials
|
|
201
|
+
*
|
|
202
|
+
* @param logger - Original logger
|
|
203
|
+
* @param options - Masking options
|
|
204
|
+
* @returns Wrapped logger with automatic masking
|
|
205
|
+
*/
|
|
206
|
+
export function createSecureLogger(logger, options = {}) {
|
|
207
|
+
return {
|
|
208
|
+
log: (message, ...args) => {
|
|
209
|
+
const maskedMsg = maskCredentials(message, options);
|
|
210
|
+
const maskedArgs = args.map(arg => typeof arg === 'string' ? maskCredentials(arg, options) : arg);
|
|
211
|
+
logger.log(maskedMsg, ...maskedArgs);
|
|
212
|
+
},
|
|
213
|
+
info: (message, ...args) => {
|
|
214
|
+
const maskedMsg = maskCredentials(message, options);
|
|
215
|
+
const maskedArgs = args.map(arg => typeof arg === 'string' ? maskCredentials(arg, options) : arg);
|
|
216
|
+
logger.info(maskedMsg, ...maskedArgs);
|
|
217
|
+
},
|
|
218
|
+
error: (message, error) => {
|
|
219
|
+
const maskedMsg = maskCredentials(message, options);
|
|
220
|
+
let maskedError = error;
|
|
221
|
+
if (error && typeof error === 'object') {
|
|
222
|
+
maskedError = maskCredentialsInData(error, options);
|
|
223
|
+
}
|
|
224
|
+
else if (typeof error === 'string') {
|
|
225
|
+
maskedError = maskCredentials(error, options);
|
|
226
|
+
}
|
|
227
|
+
logger.error(maskedMsg, maskedError);
|
|
228
|
+
},
|
|
229
|
+
warn: (message) => {
|
|
230
|
+
const maskedMsg = maskCredentials(message, options);
|
|
231
|
+
logger.warn(maskedMsg);
|
|
232
|
+
},
|
|
233
|
+
debug: (message) => {
|
|
234
|
+
const maskedMsg = maskCredentials(message, options);
|
|
235
|
+
logger.debug(maskedMsg);
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Environment variable masking helper
|
|
241
|
+
*
|
|
242
|
+
* Masks sensitive environment variables before logging
|
|
243
|
+
*
|
|
244
|
+
* @param env - Environment object
|
|
245
|
+
* @param options - Masking options
|
|
246
|
+
* @returns Masked environment object
|
|
247
|
+
*/
|
|
248
|
+
export function maskEnvironment(env = process.env, options = {}) {
|
|
249
|
+
const masked = {};
|
|
250
|
+
// Never mask these common environment variables
|
|
251
|
+
const neverMask = new Set([
|
|
252
|
+
'PATH', 'HOME', 'USER', 'SHELL', 'LANG', 'PWD', 'OLDPWD',
|
|
253
|
+
'NODE_ENV', 'NODE_VERSION', 'NPM_VERSION', 'TERM', 'EDITOR',
|
|
254
|
+
'TMPDIR', 'TMP', 'TEMP', 'HOSTNAME', 'OSTYPE'
|
|
255
|
+
]);
|
|
256
|
+
for (const [key, value] of Object.entries(env)) {
|
|
257
|
+
if (!value) {
|
|
258
|
+
masked[key] = '';
|
|
259
|
+
continue;
|
|
260
|
+
}
|
|
261
|
+
// Never mask whitelisted vars
|
|
262
|
+
if (neverMask.has(key.toUpperCase())) {
|
|
263
|
+
masked[key] = value;
|
|
264
|
+
continue;
|
|
265
|
+
}
|
|
266
|
+
const lowerKey = key.toLowerCase();
|
|
267
|
+
const isSensitive = [
|
|
268
|
+
'token', 'password', 'secret', 'key', 'credential',
|
|
269
|
+
'pat', 'api', 'auth'
|
|
270
|
+
].some(word => lowerKey.includes(word));
|
|
271
|
+
masked[key] = isSensitive ? maskValue(value, options) : value;
|
|
272
|
+
}
|
|
273
|
+
return masked;
|
|
274
|
+
}
|
|
275
|
+
//# sourceMappingURL=credential-masker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-masker.js","sourceRoot":"","sources":["../../../src/utils/credential-masker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;GAEG;AACH,MAAM,kBAAkB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IAAI,CAAC,CAAC,CAAC;QAExC,MAAM,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAChE,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { ExecFileException } from 'child_process';
|
|
2
|
+
/**
|
|
3
|
+
* Result from command execution
|
|
4
|
+
*/
|
|
5
|
+
export interface ExecResult {
|
|
6
|
+
/** Standard output from command */
|
|
7
|
+
stdout: string;
|
|
8
|
+
/** Standard error from command */
|
|
9
|
+
stderr: string;
|
|
10
|
+
/** Exit code (0 = success) */
|
|
11
|
+
exitCode: number;
|
|
12
|
+
/** Whether command succeeded (exitCode === 0) */
|
|
13
|
+
success: boolean;
|
|
14
|
+
/** Error object if command failed */
|
|
15
|
+
error?: ExecFileException;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Safely execute a command without throwing errors
|
|
19
|
+
*
|
|
20
|
+
* This utility uses child_process.execFile instead of exec/execSync:
|
|
21
|
+
* - ✅ Prevents command injection vulnerabilities (no shell interpolation)
|
|
22
|
+
* - ✅ Cross-platform compatible (Windows, Mac, Linux)
|
|
23
|
+
* - ✅ Proper error handling (returns result instead of throwing)
|
|
24
|
+
* - ✅ Structured output (stdout, stderr, exitCode)
|
|
25
|
+
*
|
|
26
|
+
* @param command - Command to execute (must be in PATH or absolute path)
|
|
27
|
+
* @param args - Array of arguments (safely escaped automatically)
|
|
28
|
+
* @param options - Additional execution options
|
|
29
|
+
* @returns Promise resolving to execution result
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* // ✅ Safe: Arguments automatically escaped
|
|
34
|
+
* const result = await execFileNoThrow('git', ['add', userProvidedFilename]);
|
|
35
|
+
* if (result.success) {
|
|
36
|
+
* console.log('Git add succeeded:', result.stdout);
|
|
37
|
+
* } else {
|
|
38
|
+
* console.error('Git add failed:', result.stderr);
|
|
39
|
+
* }
|
|
40
|
+
*
|
|
41
|
+
* // ✅ Check if command exists
|
|
42
|
+
* const which = process.platform === 'win32' ? 'where' : 'which';
|
|
43
|
+
* const checkResult = await execFileNoThrow(which, ['claude']);
|
|
44
|
+
* if (checkResult.success) {
|
|
45
|
+
* console.log('Claude CLI found at:', checkResult.stdout.trim());
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function execFileNoThrow(command: string, args?: string[], options?: {
|
|
50
|
+
cwd?: string;
|
|
51
|
+
env?: NodeJS.ProcessEnv;
|
|
52
|
+
timeout?: number;
|
|
53
|
+
maxBuffer?: number;
|
|
54
|
+
shell?: boolean;
|
|
55
|
+
}): Promise<ExecResult>;
|
|
56
|
+
/**
|
|
57
|
+
* Synchronous version of execFileNoThrow
|
|
58
|
+
*
|
|
59
|
+
* Use sparingly - prefer async version when possible.
|
|
60
|
+
* Useful for initialization code that needs to be synchronous.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const result = execFileNoThrowSync('claude', ['--version']);
|
|
65
|
+
* if (result.success) {
|
|
66
|
+
* console.log('Claude version:', result.stdout.trim());
|
|
67
|
+
* }
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function execFileNoThrowSync(command: string, args?: string[], options?: {
|
|
71
|
+
cwd?: string;
|
|
72
|
+
env?: NodeJS.ProcessEnv;
|
|
73
|
+
timeout?: number;
|
|
74
|
+
maxBuffer?: number;
|
|
75
|
+
shell?: boolean;
|
|
76
|
+
}): ExecResult;
|
|
77
|
+
/**
|
|
78
|
+
* Check if a command is available in PATH
|
|
79
|
+
*
|
|
80
|
+
* Cross-platform helper that uses 'which' (Unix) or 'where' (Windows)
|
|
81
|
+
*
|
|
82
|
+
* @param command - Command name to check (e.g., 'claude', 'git', 'node')
|
|
83
|
+
* @returns Promise resolving to true if command exists, false otherwise
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* if (await isCommandAvailable('claude')) {
|
|
88
|
+
* console.log('Claude CLI is installed');
|
|
89
|
+
* } else {
|
|
90
|
+
* console.log('Claude CLI not found - install from https://claude.com/code');
|
|
91
|
+
* }
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export declare function isCommandAvailable(command: string): Promise<boolean>;
|
|
95
|
+
/**
|
|
96
|
+
* Synchronous version of isCommandAvailable
|
|
97
|
+
*/
|
|
98
|
+
export declare function isCommandAvailableSync(command: string): boolean;
|
|
99
|
+
//# sourceMappingURL=execFileNoThrow.d.ts.map
|