From 3c3447d191e6f8eec2a3d4e89ac295a4b59783d0 Mon Sep 17 00:00:00 2001 From: jdalton Date: Fri, 4 Dec 2026 13:28:45 -0500 Subject: [PATCH] refactor: flatten action and README asset paths --- .config/vitest.config.mts | 1 - .../{repo => }/cache-downloads/action.yml | 0 .../{repo => }/cache-downloads/index.mts | 0 .../{repo => }/upload-artifact/action.yml | 0 .../{repo => }/upload-artifact/index.mjs | 0 .github/workflows/ci.yml | 4 +-- .github/workflows/publish-npm.yml | 8 ++--- .gitignore | 30 +++++++---------- README.md | 10 +++--- assets/{fleet => }/badge-follow-bluesky.svg | 0 assets/{fleet => }/badge-follow-x.svg | 0 assets/{fleet => }/socket-combomark-dark.svg | 0 assets/{fleet => }/socket-combomark-light.svg | 0 eslint.config.js | 4 +-- scripts/ci/check-actions.mts | 4 +-- .../{repo => }/cache-downloads/index.test.mts | 2 +- test/unit/scripts/ci/check-actions.test.mts | 32 +++++++++---------- 17 files changed, 44 insertions(+), 51 deletions(-) rename .github/actions/{repo => }/cache-downloads/action.yml (100%) rename .github/actions/{repo => }/cache-downloads/index.mts (100%) rename .github/actions/{repo => }/upload-artifact/action.yml (100%) rename .github/actions/{repo => }/upload-artifact/index.mjs (100%) rename assets/{fleet => }/badge-follow-bluesky.svg (100%) rename assets/{fleet => }/badge-follow-x.svg (100%) rename assets/{fleet => }/socket-combomark-dark.svg (100%) rename assets/{fleet => }/socket-combomark-light.svg (100%) rename test/unit/github/actions/{repo => }/cache-downloads/index.test.mts (98%) diff --git a/.config/vitest.config.mts b/.config/vitest.config.mts index a41216992c..d6d2ec7e88 100644 --- a/.config/vitest.config.mts +++ b/.config/vitest.config.mts @@ -37,7 +37,6 @@ export default { // contain full repo copies populated by `socket optimize` runs; their .test.mts // files would otherwise be globbed and run as if they were the real suite. 'test/fixtures/**', - 'test/fleet/**', 'upstream/**', ], coverage: { diff --git a/.github/actions/repo/cache-downloads/action.yml b/.github/actions/cache-downloads/action.yml similarity index 100% rename from .github/actions/repo/cache-downloads/action.yml rename to .github/actions/cache-downloads/action.yml diff --git a/.github/actions/repo/cache-downloads/index.mts b/.github/actions/cache-downloads/index.mts similarity index 100% rename from .github/actions/repo/cache-downloads/index.mts rename to .github/actions/cache-downloads/index.mts diff --git a/.github/actions/repo/upload-artifact/action.yml b/.github/actions/upload-artifact/action.yml similarity index 100% rename from .github/actions/repo/upload-artifact/action.yml rename to .github/actions/upload-artifact/action.yml diff --git a/.github/actions/repo/upload-artifact/index.mjs b/.github/actions/upload-artifact/index.mjs similarity index 100% rename from .github/actions/repo/upload-artifact/index.mjs rename to .github/actions/upload-artifact/index.mjs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e568d9e255..25734e624f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -428,7 +428,7 @@ jobs: - name: Restore pinned SEA download cache id: sea-download-cache - uses: ./.github/actions/repo/cache-downloads + uses: ./.github/actions/cache-downloads with: mode: restore path: ~/.cache/socket-sea/downloads/v1/blobs @@ -472,7 +472,7 @@ jobs: - name: Save pinned SEA download cache if: success() && steps.sea-download-cache.outputs.cache-hit != 'true' && github.repository == 'SocketDev/socket-cli' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (github.ref == 'refs/heads/v1.x' || github.ref == 'refs/heads/feat/v1x-node27-sea-vfs-socket' || startsWith(github.ref, 'refs/heads/test/native-terminal-validation-')) - uses: ./.github/actions/repo/cache-downloads + uses: ./.github/actions/cache-downloads with: mode: save path: ~/.cache/socket-sea/downloads/v1/blobs diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index fccd2e93ae..babc78b9a9 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -327,7 +327,7 @@ jobs: - name: Upload verified tarballs if: steps.release-meta.outputs.version != '' id: upload - uses: ./.github/actions/repo/upload-artifact + uses: ./.github/actions/upload-artifact with: name: npm-release-tarballs-${{ github.run_attempt }} path: ${{ runner.temp }}/dist @@ -345,7 +345,7 @@ jobs: - name: Upload verified launcher if: steps.native-meta.outputs.version != '' id: upload-native - uses: ./.github/actions/repo/upload-artifact + uses: ./.github/actions/upload-artifact with: name: npm-native-launcher-${{ github.run_attempt }} path: ${{ runner.temp }}/launcher @@ -434,7 +434,7 @@ jobs: - name: Upload tested platform package id: upload - uses: ./.github/actions/repo/upload-artifact + uses: ./.github/actions/upload-artifact with: name: native-${{ matrix.target }}-${{ github.run_attempt }} path: ${{ runner.temp }}/platform @@ -713,7 +713,7 @@ jobs: - name: Upload the prepared release patch if: ${{ inputs.dry-run == false }} id: patch - uses: ./.github/actions/repo/upload-artifact + uses: ./.github/actions/upload-artifact with: name: release-bump-${{ github.run_attempt }} path: ${{ runner.temp }}/release-bump diff --git a/.gitignore b/.gitignore index 7dd4d1664a..1b8eab414d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,15 +10,14 @@ !/.vscode/ !/.github/ !/.github/actions/ -!/.github/actions/repo/ -!/.github/actions/repo/cache-downloads/ -!/.github/actions/repo/upload-artifact/ +!/.github/actions/cache-downloads/ +!/.github/actions/upload-artifact/ !/.github/scripts/ !/.github/workflows/ -!/.github/actions/repo/upload-artifact/action.yml -!/.github/actions/repo/upload-artifact/index.mjs -!/.github/actions/repo/cache-downloads/action.yml -!/.github/actions/repo/cache-downloads/index.mts +!/.github/actions/upload-artifact/action.yml +!/.github/actions/upload-artifact/index.mjs +!/.github/actions/cache-downloads/action.yml +!/.github/actions/cache-downloads/index.mts !/.github/scripts/download-release-artifacts.mts !/.github/scripts/pin-readme-assets.mjs !/.github/scripts/smoke-test-tarball.mts @@ -28,7 +27,6 @@ !/.github/workflows/publish-npm.yml !/.github/workflows/release-github.yml !/assets/ -!/assets/fleet/ !/bin/ !/docs/ !/docs/commands/ @@ -137,9 +135,8 @@ !/test/unit/ !/test/unit/github/ !/test/unit/github/actions/ -!/test/unit/github/actions/repo/ -!/test/unit/github/actions/repo/cache-downloads/ -!/test/unit/github/actions/repo/cache-downloads/index.test.mts +!/test/unit/github/actions/cache-downloads/ +!/test/unit/github/actions/cache-downloads/index.test.mts !/test/unit/constants.test.mts !/test/unit/sea/ !/test/unit/sea/build/ @@ -272,10 +269,10 @@ !/DISCLOSURE !/LICENSE !/README.md -!/assets/fleet/badge-follow-bluesky.svg -!/assets/fleet/badge-follow-x.svg -!/assets/fleet/socket-combomark-dark.svg -!/assets/fleet/socket-combomark-light.svg +!/assets/badge-follow-bluesky.svg +!/assets/badge-follow-x.svg +!/assets/socket-combomark-dark.svg +!/assets/socket-combomark-light.svg !/bin/cli.js !/bin/npm-cli.js !/bin/npx-cli.js @@ -989,9 +986,6 @@ *.tsbuildinfo /.repo-map/ /upstream/ -/docs/fleet/ -/scripts/fleet/ -/test/fleet/ /.claude/ops/ /.claude/worktrees/ /.github/copilot-instructions.md diff --git a/README.md b/README.md index fd8211b9c7..4caa3a60db 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ [![Coverage](https://img.shields.io/badge/coverage-95%25-brightgreen)](https://github.com/SocketDev/socket-cli/actions) -[![Follow @SocketSecurity](assets/fleet/badge-follow-x.svg)](https://twitter.com/SocketSecurity) -[![Follow @socket.dev on Bluesky](assets/fleet/badge-follow-bluesky.svg)](https://bsky.app/profile/socket.dev) +[![Follow @SocketSecurity](assets/badge-follow-x.svg)](https://twitter.com/SocketSecurity) +[![Follow @socket.dev on Bluesky](assets/badge-follow-bluesky.svg)](https://bsky.app/profile/socket.dev) CLI for [Socket.dev](https://socket.dev) — scan dependencies, audit packages, apply security patches, and gate installs from your terminal or CI. This is the 1.x line of the published `socket` package on npm. @@ -212,8 +212,8 @@ MIT
- - - Socket + + + Socket
diff --git a/assets/fleet/badge-follow-bluesky.svg b/assets/badge-follow-bluesky.svg similarity index 100% rename from assets/fleet/badge-follow-bluesky.svg rename to assets/badge-follow-bluesky.svg diff --git a/assets/fleet/badge-follow-x.svg b/assets/badge-follow-x.svg similarity index 100% rename from assets/fleet/badge-follow-x.svg rename to assets/badge-follow-x.svg diff --git a/assets/fleet/socket-combomark-dark.svg b/assets/socket-combomark-dark.svg similarity index 100% rename from assets/fleet/socket-combomark-dark.svg rename to assets/socket-combomark-dark.svg diff --git a/assets/fleet/socket-combomark-light.svg b/assets/socket-combomark-light.svg similarity index 100% rename from assets/fleet/socket-combomark-light.svg rename to assets/socket-combomark-light.svg diff --git a/eslint.config.js b/eslint.config.js index b3821b41f8..03765ad0f0 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -220,7 +220,7 @@ module.exports = [ '*.config.mts', '.config/*.config.mts', '.config/snapshot-path.mts', - '.github/actions/repo/cache-downloads/*.mts', + '.github/actions/cache-downloads/*.mts', // Allow paths like src/utils/*.test.mts. 'src/*/*.test.mts', // Allow paths like src/commands/optimize/*.test.mts. @@ -244,7 +244,7 @@ module.exports = [ 'test/e2e/*.test.mts', 'test/termless/utils/*.test.mts', 'test/unit/utils/*.test.mts', - 'test/unit/github/actions/repo/cache-downloads/*.test.mts', + 'test/unit/github/actions/cache-downloads/*.test.mts', 'test/lib/native/*.mts', 'test/lib/terminal/*.mts', 'test/lib/termless/*.mts', diff --git a/scripts/ci/check-actions.mts b/scripts/ci/check-actions.mts index a6cb6ce03d..e0f51e6378 100644 --- a/scripts/ci/check-actions.mts +++ b/scripts/ci/check-actions.mts @@ -19,7 +19,7 @@ export function disallowedActionReferences(document: unknown): string[] { if ( key === 'uses' && typeof value === 'string' && - !/^\.\/\.github\/actions\/repo\/[\da-z][\w.-]*(?:\/[\da-z][\w.-]*)*$/i.test( + !/^\.\/\.github\/actions\/[\da-z][\w.-]*(?:\/[\da-z][\w.-]*)*$/i.test( value, ) ) { @@ -60,7 +60,7 @@ if (isMainModule(import.meta.url)) { process.stdout.write(`${JSON.stringify({ findings })}\n`) } else if (findings.length) { process.stderr.write( - `Disallowed actions or symbolic links found: ${findings.join(', ')}. Use steps under ./.github/actions/repo/ without traversal or symbolic links.\n`, + `Disallowed actions or symbolic links found: ${findings.join(', ')}. Use steps under ./.github/actions/ without traversal or symbolic links.\n`, ) } return findings.length ? 1 : 0 diff --git a/test/unit/github/actions/repo/cache-downloads/index.test.mts b/test/unit/github/actions/cache-downloads/index.test.mts similarity index 98% rename from test/unit/github/actions/repo/cache-downloads/index.test.mts rename to test/unit/github/actions/cache-downloads/index.test.mts index 55f77d3318..56e7ce442e 100644 --- a/test/unit/github/actions/repo/cache-downloads/index.test.mts +++ b/test/unit/github/actions/cache-downloads/index.test.mts @@ -15,7 +15,7 @@ import { resolveBlobPath, runCacheAction, seaDownloadBlobPath, -} from '../../../../../../.github/actions/repo/cache-downloads/index.mts' +} from '../../../../../.github/actions/cache-downloads/index.mts' const reporter = () => ({ warning: vi.fn(), diff --git a/test/unit/scripts/ci/check-actions.test.mts b/test/unit/scripts/ci/check-actions.test.mts index b71c6f9640..cdc2b8dc7c 100644 --- a/test/unit/scripts/ci/check-actions.test.mts +++ b/test/unit/scripts/ci/check-actions.test.mts @@ -24,7 +24,7 @@ function actionFixture(reference: string) { directories.push(root) const github = path.join(root, '.github') const workflows = path.join(github, 'workflows') - const actions = path.join(github, 'actions', 'repo') + const actions = path.join(github, 'actions') mkdirSync(workflows, { recursive: true }) mkdirSync(actions, { recursive: true }) const workflow = path.join(workflows, 'build.yml') @@ -69,7 +69,7 @@ jobs: runs: using: composite steps: - - uses: ./.github/actions/repo/upload-artifact + - uses: ./.github/actions/upload-artifact - run: echo ready `), ), @@ -78,16 +78,16 @@ runs: it.each([ './scripts/actions/tool', - './.github/actions/fleet/tool', - './.github/actions/repo', - './.github/actions/repo/tool/', - './.github/actions/repo/../external', - './.github/actions/repo/./tool', - './.github/actions/repo/tool/../../external', - './.github/actions/repo//tool', - './.github/actions/repo/tool\\external', - './.github/actions/repo/%2e%2e/external', - './.github/actions/repo/tool@revision', + './.github/workflows/tool', + './.github/actions', + './.github/actions/tool/', + './.github/actions/../external', + './.github/actions/./tool', + './.github/actions/tool/../../external', + './.github/actions//tool', + './.github/actions/tool\\external', + './.github/actions/%2e%2e/external', + './.github/actions/tool@revision', ])( 'rejects a local action outside the permitted path syntax: %s', reference => { @@ -99,7 +99,7 @@ runs: ) it('accepts nested repository action directories and inspects their definitions', () => { - const fixture = actionFixture('./.github/actions/repo/build/tool') + const fixture = actionFixture('./.github/actions/build/tool') const directory = path.join(fixture.actions, 'build', 'tool') mkdirSync(directory, { recursive: true }) const action = path.join(directory, 'action.yml') @@ -118,7 +118,7 @@ runs: }) it('rejects a linked action directory without following it', () => { - const fixture = actionFixture('./.github/actions/repo/linked') + const fixture = actionFixture('./.github/actions/linked') const outside = path.join(fixture.root, 'external-action') mkdirSync(outside) writeFileSync( @@ -133,7 +133,7 @@ runs: }) it('rejects linked action files and broken links', () => { - const fixture = actionFixture('./.github/actions/repo/linked') + const fixture = actionFixture('./.github/actions/linked') const directory = path.join(fixture.actions, 'linked') mkdirSync(directory) const linked = path.join(directory, 'action.yml') @@ -144,7 +144,7 @@ runs: }) it('rejects a linked scan root', () => { - const fixture = actionFixture('./.github/actions/repo/tool') + const fixture = actionFixture('./.github/actions/tool') const linked = path.join(fixture.root, 'linked-github') symlinkSync(fixture.github, linked, 'dir') const findings = checkWorkflowActions(linked)