Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions scripts/crusher-shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,25 @@

const { install, uninstall, status } = require('./lib/crusher/shim-install');

function toPathResultArray(rawPathResult) {
if (Array.isArray(rawPathResult)) {
return rawPathResult;
}
if (rawPathResult) {
return [{
...rawPathResult,
path: rawPathResult.path || 'Windows user PATH (registry)'
}];
}
return [];
}

function printInstallResult(result) {
console.log(`Shim directory: ${result.dir}`);
if (result.installed.length) console.log(`Installed: ${result.installed.join(', ')}`);
if (result.skipped.length) console.log(`Not found on this machine (skipped): ${result.skipped.join(', ')}`);
const changed = result.pathResult.filter(r => r.changed);
const pathResultArray = toPathResultArray(result.pathResult);
const changed = pathResultArray.filter(r => r && r.changed);

Check warning on line 31 in scripts/crusher-shim.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer using an optional chain expression instead, as it's more concise and easier to read.

See more on https://sonarcloud.io/project/issues?id=Fmarzochi_EGC&issues=AZ_duHYvjlN6eIyL8Ns1&open=AZ_duHYvjlN6eIyL8Ns1&pullRequest=1229
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
Comment thread
Fmarzochi marked this conversation as resolved.
if (changed.length) {
console.log(`PATH updated in: ${changed.map(r => r.path).join(', ')}`);
console.log('Open a new terminal (or `source` the file above) for it to take effect.');
Expand All @@ -26,7 +40,8 @@
function printUninstallResult(result) {
console.log(`Shim directory: ${result.dir}`);
console.log(result.removed.length ? `Removed: ${result.removed.join(', ')}` : 'Nothing to remove.');
const changed = result.pathResult.filter(r => r.changed);
const pathResultArray = toPathResultArray(result.pathResult);
const changed = pathResultArray.filter(r => r && r.changed);

Check warning on line 44 in scripts/crusher-shim.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer using an optional chain expression instead, as it's more concise and easier to read.

See more on https://sonarcloud.io/project/issues?id=Fmarzochi_EGC&issues=AZ_d6sBl-O_VINrlo_BX&open=AZ_d6sBl-O_VINrlo_BX&pullRequest=1229
Comment thread
Fmarzochi marked this conversation as resolved.
if (changed.length) console.log(`PATH entry removed from: ${changed.map(r => r.path).join(', ')}`);
}

Expand Down
2 changes: 1 addition & 1 deletion scripts/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ if (-not $DryRun) {
# but only `egc init` configured the filter that keeps that promise --
# this quick-start script (the README's own documented command) never
# did (2026-08-01 audit finding). Best-effort: must not fail the install.
node -e 'const rootDir = process.argv[1]; const { applyCommitPrivacyFilterCli } = require(rootDir + "/scripts/lib/memory-filters"); applyCommitPrivacyFilterCli({ projectDir: process.cwd(), scriptPath: rootDir + "/scripts/check-state-leak.js", log: m => console.log(" " + m) });' $RootDir
node "$RootDir/scripts/lib/apply-commit-privacy.js" $RootDir
if ($LASTEXITCODE -ne 0) { Write-Host " note: commit-privacy filter setup failed (non-fatal)" }

# Write harness config
Expand Down
12 changes: 12 additions & 0 deletions scripts/lib/apply-commit-privacy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const path = require('path');

Check warning on line 1 in scripts/lib/apply-commit-privacy.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Prefer `node:path` over `path`.

See more on https://sonarcloud.io/project/issues?id=Fmarzochi_EGC&issues=AZ_duHE8jlN6eIyL8Nsz&open=AZ_duHE8jlN6eIyL8Nsz&pullRequest=1229
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
const { applyCommitPrivacyFilterCli } = require('./memory-filters');

const scriptPath = process.argv[2]
? path.resolve(process.argv[2], 'scripts', 'check-state-leak.js')
: undefined;

applyCommitPrivacyFilterCli({
projectDir: process.cwd(),
scriptPath: scriptPath,
log: (m) => console.log(' ' + m)
});
Loading