From a896b0ecdb9f43d023571cd38ec7bd4df244085f Mon Sep 17 00:00:00 2001 From: Nexvyn <100619913+Nexvyn@users.noreply.github.com> Date: Wed, 25 Nov 2026 19:09:40 +0530 Subject: [PATCH 1/6] Add approved development profile and compact cache budgets --- profiles/development.json | 177 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 profiles/development.json diff --git a/profiles/development.json b/profiles/development.json new file mode 100644 index 0000000..77f4387 --- /dev/null +++ b/profiles/development.json @@ -0,0 +1,177 @@ +{ + "version": 1, + "tools": [ + { + "id": "traycer", + "name": "Traycer", + "url": "https://traycer.ai/download", + "kind": "application" + }, + { + "id": "cursor", + "name": "Cursor", + "url": "https://cursor.com/", + "kind": "application" + }, + { + "id": "moon", + "name": "Moon", + "url": "https://moonrepo.dev/moon", + "kind": "cli" + }, + { + "id": "github-cli", + "name": "GitHub CLI", + "url": "https://cli.github.com/", + "kind": "cli" + }, + { + "id": "biome", + "name": "Biome", + "url": "https://biomejs.dev/", + "kind": "project" + }, + { + "id": "vitest", + "name": "Vitest", + "url": "https://vitest.dev/", + "kind": "project" + }, + { + "id": "testing-library", + "name": "Testing Library", + "url": "https://testing-library.com/", + "kind": "project" + }, + { + "id": "playwright", + "name": "Playwright", + "url": "https://playwright.dev/", + "kind": "project" + }, + { + "id": "lighthouse", + "name": "Lighthouse", + "url": "https://developer.chrome.com/docs/lighthouse/", + "kind": "on-demand" + }, + { + "id": "tauri", + "name": "Tauri", + "url": "https://tauri.app/", + "kind": "project" + }, + { + "id": "swift", + "name": "Swift", + "url": "https://swift.org/", + "kind": "toolchain" + }, + { + "id": "kotlin", + "name": "Kotlin", + "url": "https://kotlinlang.org/", + "kind": "toolchain" + }, + { + "id": "maestro", + "name": "Maestro", + "url": "https://docs.maestro.dev/", + "kind": "cli" + }, + { + "id": "helium", + "name": "Helium Browser", + "url": "https://helium.computer/", + "kind": "application" + }, + { + "id": "kitesurf", + "name": "Cloudflare Kitesurf", + "url": "https://developers.cloudflare.com/browser-run/kitesurf/", + "kind": "remote" + }, + { + "id": "nodejs", + "name": "Node.js", + "url": "https://nodejs.org/en/download", + "kind": "toolchain" + }, + { + "id": "notion", + "name": "Notion", + "url": "https://www.notion.so/desktop", + "kind": "application", + "desktopPlatforms": [ + "win32" + ], + "alternative": "Web application" + }, + { + "id": "discord", + "name": "Discord", + "url": "https://discord.com/download", + "kind": "application" + }, + { + "id": "vlc", + "name": "VLC", + "url": "https://www.videolan.org/vlc/", + "kind": "application" + }, + { + "id": "7zip", + "name": "7-Zip", + "url": "https://www.7-zip.org/download.html", + "kind": "application" + }, + { + "id": "localsend", + "name": "LocalSend", + "url": "https://localsend.org/", + "kind": "application" + }, + { + "id": "ffmpeg", + "name": "FFmpeg", + "url": "https://ffmpeg.org/download.html", + "kind": "cli" + }, + { + "id": "figma", + "name": "Figma", + "url": "https://www.figma.com/downloads/", + "kind": "application", + "desktopPlatforms": [ + "win32" + ], + "alternative": "Web application" + }, + { + "id": "wiztree", + "name": "WizTree", + "url": "https://diskanalyzer.com/", + "kind": "application", + "desktopPlatforms": [ + "win32" + ] + }, + { + "id": "syncthing", + "name": "Syncthing", + "url": "https://syncthing.net/downloads/", + "kind": "application" + } + ], + "cachePolicy": { + "unit": "GiB", + "aggregateWarning": 25, + "aggregateRetention": 35, + "minimumFree": 40, + "cargoWorkspaceWarning": 4, + "cargoWorkspaceRetention": 5, + "sccacheRetention": 5, + "idleDependenciesHours": 24, + "idleBuildHours": 48 + } +} From 0eb201b30c6c6dce9f35fbe4ae7b79664f963e22 Mon Sep 17 00:00:00 2001 From: Nexvyn <100619913+Nexvyn@users.noreply.github.com> Date: Wed, 25 Nov 2026 19:09:56 +0530 Subject: [PATCH 2/6] Add read-only development profile planner --- tools/plan-development.mjs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tools/plan-development.mjs diff --git a/tools/plan-development.mjs b/tools/plan-development.mjs new file mode 100644 index 0000000..f553b24 --- /dev/null +++ b/tools/plan-development.mjs @@ -0,0 +1,21 @@ +// Read-only installation plan. No downloads, installs or configuration changes. +import { readFileSync } from 'node:fs'; + +const manifest = JSON.parse(readFileSync(new URL('../profiles/development.json', import.meta.url), 'utf8')); +const args = process.argv.slice(2); +const known = new Set(manifest.tools.map(tool => tool.id)); +const selected = args.length ? new Set(args) : known; +for (const id of selected) { + if (!known.has(id)) { + console.error('Unknown tool: ' + id); + process.exit(2); + } +} +for (const tool of manifest.tools) { + if (!selected.has(tool.id)) continue; + const supported = !tool.desktopPlatforms || tool.desktopPlatforms.includes(process.platform); + const mode = supported ? tool.kind : (tool.alternative || 'not available'); + console.log(tool.name + ' | ' + mode + ' | ' + tool.url); +} +console.log('\nCache retention targets (GiB; soft limits):'); +console.log(JSON.stringify(manifest.cachePolicy, null, 2)); From 6277624eb87676bfc2fe6a929d8eec499ba417c6 Mon Sep 17 00:00:00 2001 From: Nexvyn <100619913+Nexvyn@users.noreply.github.com> Date: Wed, 25 Nov 2026 19:10:14 +0530 Subject: [PATCH 3/6] Document approved profile and retention policy --- docs/development-profile.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 docs/development-profile.md diff --git a/docs/development-profile.md b/docs/development-profile.md new file mode 100644 index 0000000..d501b89 --- /dev/null +++ b/docs/development-profile.md @@ -0,0 +1,24 @@ +# Development profile + +The approved tool list is maintained in [profiles/development.json](../profiles/development.json). It contains the 25 selected tools and no additional applications. Project dependencies are installed only within the relevant project; remote-only services are references, not desktop installs. + +With Node.js installed, preview the profile: + +```sh +node tools/plan-development.mjs +node tools/plan-development.mjs traycer cursor moon helium +``` + +The planner is read-only. It rejects unknown tool IDs, prints the official sources and indicates desktop availability for explicitly restricted applications. The existing first-install workflow is unchanged by this initial PR. Actual installation adapters and project lifecycle commands are follow-up implementation work under #1. + +## Compact cache policy + +- Total disposable development data: 35 GiB retention target, warning at 25 GiB, aim for 40 GiB free. +- Cargo target and intermediate outputs: separate workspace/worktree directories, warning at 4 GiB, retention target 5 GiB per workspace. +- Shared sccache: 5 GiB. +- Idle workspace dependency cleanup eligibility after 24 hours; generated build outputs after 48 hours. +- Budgets are soft targets. Never interrupt active builds or delete unreviewed data. +- Preserve lockfiles and use the existing package manager. Keep active and pinned workspaces intact. +- Shared download caches remain separate by package manager. Keep package links on the same filesystem where supported. + +No cleanup or installation is executed by the planner. Existing cache settings remain unchanged until the migration implementation is reviewed. From 4e56dc097564d5b70b922d1611033391e06427b9 Mon Sep 17 00:00:00 2001 From: Nexvyn <100619913+Nexvyn@users.noreply.github.com> Date: Wed, 25 Nov 2026 19:19:03 +0530 Subject: [PATCH 4/6] Isolate project caches, preserve dependencies and implement curated installation --- README.md | 16 ++- docs/convert-project-prompt.md | 22 ++-- docs/development-profile.md | 21 ++-- docs/shared-cache.md | 88 ++++---------- linux/cleanup/clean_dev_caches.sh | 53 +------- linux/install/first_install.sh | 89 ++------------ linux/install/setup_shared_cache.sh | 20 ++- tests/development.test.mjs | 41 +++++++ tools/devcache.mjs | 162 +++++++++++++++++++++++++ tools/install-development.mjs | 51 ++++++++ windows/cleanup/clean_dev_caches.bat | 109 +---------------- windows/install/first_install.bat | 92 ++++---------- windows/install/setup_shared_cache.bat | 30 +++-- 13 files changed, 389 insertions(+), 405 deletions(-) create mode 100644 tests/development.test.mjs create mode 100644 tools/devcache.mjs create mode 100644 tools/install-development.mjs diff --git a/README.md b/README.md index 1dde165..9337801 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ One-click maintenance for Windows and Linux. The scripts are grouped by job: | Folder | What it does | Runs in the one-click | |---|---|---| -| `cleanup/` | Browser caches, system junk, developer caches (prunes pnpm and npm, clears yarn, bun, pip) | Yes, first | +| `cleanup/` | Browser caches, system junk, developer cache status (preserves downloads) | Yes, first | | `update/` | The whole system: OS, drivers and firmware, store apps, all other apps | Yes, second | | `install/` | Fresh PC: reinstall your apps, then set up the shared dev cache | No, run `first_install` on a new PC | @@ -27,14 +27,14 @@ docs/ shared-cache.md, convert-project-prompt.md - Browser cleanup closes Chrome, Edge, Brave and Firefox and clears their cache for every profile. It never deletes history, cookies, passwords, logins or bookmarks. - Windows cleanup clears your temp folder, Windows temp, old Windows Update downloads, the Delivery Optimization cache, crash reports and dumps, Windows logs older than 7 days, and the Recycle Bin. It reports how much space it freed. It does not clear Prefetch, because Windows uses Prefetch to start apps faster. -- Developer cleanup runs `pnpm store prune` (removes only packages no project uses), `npm cache verify` (removes only broken or unused entries), `yarn cache clean`, `bun pm cache rm` and `pip cache purge` for the tools you have. The npm cache and pnpm store can be your [shared cache](docs/shared-cache.md), so they are only pruned, never wiped. +- Developer cleanup preserves package download caches. Review managed project storage and cleanup candidates with the project lifecycle tool. - Updates cover Microsoft Defender definitions, Windows Update (including drivers and other Microsoft products, through PSWindowsUpdate, which is installed automatically), Microsoft Store apps and every winget app. It never restarts by itself. **Fresh PC** -1. On your old PC, run `windows\install\save_my_apps.bat`. It writes `apps.json` next to the script. Commit that file if you want it in the repo. -2. On the new PC, clone the repo and run `windows\install\first_install.bat`. It installs the apps from `apps.json`, then runs `setup_shared_cache.bat`. That creates the [shared dev cache](docs/shared-cache.md), installs `sccache` and `pnpm` if they are missing, and points pnpm, npm, Cargo, sccache, Gradle and Puppeteer at it. -3. Restart the PC, then run `pnpm install` in each project. To move an existing project onto the shared cache, paste [convert-project-prompt.md](docs/convert-project-prompt.md) into that project's AI. +1. Install Node.js from its official site if it is not already available. +2. Run `windows\install\first_install.bat` to preview the approved profile. +3. Run `windows\install\first_install.bat --apply cursor github-cli` with your chosen tool IDs to install and configure the shared cache. Open a new terminal afterwards. Each part also runs on its own: `install_apps.bat`, `setup_shared_cache.bat`. @@ -50,7 +50,11 @@ bash linux/oneclick.sh Run it as your normal user, not with `sudo`. It asks for your password once. It runs the same four steps as on Windows, using your distro's tools, then shows a summary and asks before restarting. -**Fresh PC:** run `bash linux/install/save_my_apps.sh` on the old machine and commit the `packages-*.txt`, `flatpak.txt` and `snap.txt` files if you want them in the repo. On the new machine run `bash linux/install/first_install.sh`. It installs the apps, then sets up the [shared dev cache](docs/shared-cache.md) (settings go in a marked block in `~/.profile`). +**Fresh PC:** install Node.js if needed, then run `bash linux/install/first_install.sh` to preview the approved profile. Pass `--apply` and selected tool IDs to install and configure shared caches. To restore a previous export, run the separate app-list scripts explicitly. + +## Approved development tools + +Use [development-profile.md](docs/development-profile.md) to preview and install the curated profile instead of restoring a previous app export. See [shared-cache.md](docs/shared-cache.md) for isolated Cargo targets and on-demand dependencies. ## Preview first diff --git a/docs/convert-project-prompt.md b/docs/convert-project-prompt.md index 662ac4d..2c79c5f 100644 --- a/docs/convert-project-prompt.md +++ b/docs/convert-project-prompt.md @@ -1,14 +1,16 @@ # Convert a project to the shared cache -Paste this into the AI of each project. Set up the shared cache first (see [shared-cache.md](shared-cache.md)). +Paste into the AI for the project: -``` -Convert this project to the shared cache. Use pnpm only. - -1. Tell me the size of node_modules and of any local target, build and .gradle folders, then wait for my yes. -2. If package-lock.json or yarn.lock exists, run `pnpm import` first. -3. After my yes, delete only: node_modules, local target folders, the old lockfile (package-lock.json or yarn.lock). Nothing else. -4. Run `pnpm install`. -5. Run the project's build and tests. -6. Confirm to me in 3 lines: new node_modules size, build result, test result. +```text +Inspect the project root, current package manager, lockfile, Cargo workspace +and existing build/cache paths. Report sizes without deleting anything. +Preserve the existing lockfile, package manager, source, local patches and +configuration. Use the OneClick Kit devcache activate and run commands +from the documented workspace root. Use a unique Cargo target directory +and shared sccache; never share a mutable target across projects. +Run the existing build and tests, then report the results and disk usage. +Do not clean active workspaces. Plan cleanup for inactive generated outputs +only after the documented grace period and get explicit owner approval. +Do not change toolchains or migrate package managers without approval. ``` diff --git a/docs/development-profile.md b/docs/development-profile.md index d501b89..d28ea56 100644 --- a/docs/development-profile.md +++ b/docs/development-profile.md @@ -1,24 +1,19 @@ # Development profile -The approved tool list is maintained in [profiles/development.json](../profiles/development.json). It contains the 25 selected tools and no additional applications. Project dependencies are installed only within the relevant project; remote-only services are references, not desktop installs. +[profiles/development.json](../profiles/development.json) contains the 25 approved tools and retention settings. -With Node.js installed, preview the profile: +With Node.js installed: ```sh node tools/plan-development.mjs -node tools/plan-development.mjs traycer cursor moon helium +node tools/install-development.mjs +node tools/install-development.mjs --apply cursor github-cli ``` -The planner is read-only. It rejects unknown tool IDs, prints the official sources and indicates desktop availability for explicitly restricted applications. The existing first-install workflow is unchanged by this initial PR. Actual installation adapters and project lifecycle commands are follow-up implementation work under #1. +The first two commands preview available choices without installing anything. Installation requires explicit tool IDs and --apply. The installer uses exact approved WinGet IDs or available distribution packages through apt; existing matching installs are skipped. Tools lacking verified adapters are listed with their official links for manual installation. Project-specific packages, toolchains needing additional prerequisites, and remote services are not installed globally. No extra standalone applications are added to the manifest. -## Compact cache policy +For cache setup and project commands, see [shared-cache.md](shared-cache.md). -- Total disposable development data: 35 GiB retention target, warning at 25 GiB, aim for 40 GiB free. -- Cargo target and intermediate outputs: separate workspace/worktree directories, warning at 4 GiB, retention target 5 GiB per workspace. -- Shared sccache: 5 GiB. -- Idle workspace dependency cleanup eligibility after 24 hours; generated build outputs after 48 hours. -- Budgets are soft targets. Never interrupt active builds or delete unreviewed data. -- Preserve lockfiles and use the existing package manager. Keep active and pinned workspaces intact. -- Shared download caches remain separate by package manager. Keep package links on the same filesystem where supported. +The existing exported-app restore remains a separate opt-in workflow. Do not use it if you want only the curated profile. -No cleanup or installation is executed by the planner. Existing cache settings remain unchanged until the migration implementation is reviewed. +The first-install scripts now use the curated profile by default. With no arguments they preview; pass --apply plus specific tool IDs to apply and configure the shared cache. Install Node.js from its official source first if it is missing. To restore an exported app list, use the existing install_apps script explicitly. diff --git a/docs/shared-cache.md b/docs/shared-cache.md index d68fe8b..e3dd1b1 100644 --- a/docs/shared-cache.md +++ b/docs/shared-cache.md @@ -1,78 +1,38 @@ -# Shared cache +# Shared development cache -One shared, regenerable cache folder for every project on the PC. Everything in it can be deleted at any time. Nothing is lost: it is rebuilt on the next install or build, which is slower once. +Share downloaded packages and eligible compiler outputs, not a single mutable build directory. Cache files are regenerable, but never remove them during active work or without review. -Default location (`` below): +Run the existing setup script, then reopen the terminal. The setup configures separate npm, pnpm, modern Yarn, Bun, pip and uv caches, plus Gradle, Playwright and Puppeteer download locations. Existing Cargo registry/Git downloads remain in Cargo home. Keep the cache on the same filesystem as projects for pnpm linking. The setup no longer sets a single global Cargo target; it preserves the old directory for manual review. If a custom legacy CARGO_TARGET_DIR remains, remove or adjust it yourself after verifying its origin. -- Windows: `%USERPROFILE%\Desktop\F-project\shared-cache` -- Linux: `~/F-project/shared-cache` +## Project lifecycle -``` -/ - pnpm-store/ pnpm package store (projects' node_modules hard-link to it) - cargo-target/ Rust build output (CARGO_TARGET_DIR) - sccache/ compiled Rust crates reused across projects, capped at 5 GB (SCCACHE_DIR) - gradle/ Android/Gradle cache (GRADLE_USER_HOME) - npm-cache/ npm and npx download cache - puppeteer/ Puppeteer browser downloads -``` - -## Set it up - -On a new PC, `first_install` runs this for you after installing your apps. To run it on its own: - -- Windows: `windows\install\setup_shared_cache.bat` (or `setup_shared_cache.bat "D:\other\place"` for another folder) -- Linux: `bash linux/install/setup_shared_cache.sh` (or `... setup_shared_cache.sh /other/place`) - -It creates the folders, installs `sccache` and `pnpm` if they are missing, and applies the settings below. Running it again is safe. To move the cache, run it with the new folder, then run `pnpm install` in each project. - -Open a new terminal afterwards (on Linux, log out and back in or run `source ~/.profile`). Then run `pnpm install` in each project. +With Node.js installed, use the following commands from the kit (substitute your actual workspace path): -## Settings it applies (user level, every project) - -| Setting | Value | -|---|---| -| pnpm `store-dir` (global) | `/pnpm-store` | -| pnpm `package-import-method` (global) | `hardlink` (install fails instead of silently copying) | -| npm `cache` (npx cache lives in `/_npx`) | `/npm-cache` | -| env `CARGO_TARGET_DIR` | `/cargo-target` | -| env `CARGO_INCREMENTAL` | `0` (sccache needs incremental builds off) | -| env `RUSTC_WRAPPER` | `sccache`, only set when sccache is installed | -| env `SCCACHE_DIR` | `/sccache` | -| env `SCCACHE_CACHE_SIZE` | `5G` | -| env `GRADLE_USER_HOME` | `/gradle` | -| env `PUPPETEER_CACHE_DIR` | `/puppeteer` | - -On Windows the environment variables are saved with `setx`. On Linux they go in a marked block in `~/.profile`, which the script replaces each time it runs. - -Use pnpm only, never npm or yarn, in projects. +```sh +node tools/devcache.mjs activate /path/to/project +node tools/devcache.mjs run /path/to/project -- cargo build +node tools/devcache.mjs status +node tools/devcache.mjs deactivate /path/to/project +node tools/devcache.mjs plan +``` -## Rules for AI agents +The run command gives each canonical workspace or worktree a distinct hashed target directory under the configured cache root. Use the actual Cargo workspace root (not a member crate). A plain Cargo invocation uses its existing configuration; configure your IDE tasks to use the wrapper if you want the centralized project-specific directory. Existing project configuration is not rewritten. If a project overrides Cargo's intermediate build directory, review it separately. -- Projects must be on the same drive as the store. Hard links do not work across drives; pnpm silently copies instead and wastes space. -- Never delete this folder or anything in it without asking the owner. -- Do not create a per-project `node_modules` store, `.pnpm-store`, or `target` folder, and do not set `target-dir` in a project's `.cargo/config.toml`. -- Never set `CARGO_TARGET_DIR`, `GRADLE_USER_HOME`, `TMP` or `TEMP` for a single command, and never create a cache, target or temp folder anywhere else. -- Converting a project: if `package-lock.json` or `yarn.lock` exists, run `pnpm import` first, ask the owner before deleting `node_modules` and the old lockfile, then run `pnpm install`. The prompt in [convert-project-prompt.md](convert-project-prompt.md) does this. +Activate restores missing dependencies using the existing lockfile and package manager; existing installations are preserved. Pin/unpin controls retention. Deactivate only after stopping external IDEs, builds, tests and watchers. The registry tracks cooperating commands, not all processes. The run wrapper holds a lock until the child command exits. -## Cleaning +Status reports logical sizes, deduplicating identifiable hardlinks, and warns at the configured budgets. It is not an exact physical allocation measurement. Plan lists idle candidates without modifying data. The cleanup command is deliberately manual: -- The OneClick Kit developer cleanup only prunes the shared cache: `pnpm store prune` removes packages no project uses any more, and `npm cache verify` removes only broken or unused entries. It never wipes the cache. -- `cargo-target` has no size limit. Delete it by hand when it gets large; the rebuild reuses `sccache`, so it is much faster than a build from nothing. -- `cargo clean` in any project wipes `cargo-target` for every project, because they all share it. -- `sccache` drops its oldest entries on its own at 5 GB. `sccache --show-stats` shows hits, misses and size. +```sh +node tools/devcache.mjs clean /path/to/project deps --apply --confirm-idle +node tools/devcache.mjs clean /path/to/project target --apply --confirm-idle +``` -## Optional (Windows): skip Defender scanning for this folder +Only use it after checking that all external processes have stopped, the directory has no manual edits, and any required release artifacts are backed up. It refuses active/pinned projects, recent projects, linked top-level directories and tracked dependencies. There is no unattended cleanup. -Defender checks every file as it is written. A `pnpm install` writes tens of thousands of small files, so those checks can make installs slow. Only do this if slow installs are a real problem. +## Retention policy -In PowerShell as administrator: +25 GiB warning; 35 GiB total retention target; aim for 40 GiB free. Cargo per workspace: warning at 4 GiB, target 5 GiB. Shared sccache: 5 GiB. Idle dependencies are eligible after 24 hours; build outputs after 48 hours. Allow exceptions for active builds. These are soft limits, not quotas. -```powershell -Add-MpPreference -ExclusionPath "$env:USERPROFILE\Desktop\F-project\shared-cache" -``` +The ordinary developer-cache maintenance step preserves package downloads. Use tool-specific approved pruning only after reviewing space and dependencies. Do not disable antivirus scanning for executable dependency caches. Keep different operating systems and toolchains isolated, and do not sync live caches. -- Check: `Get-MpPreference | Select -ExpandProperty ExclusionPath` -- Undo: `Remove-MpPreference -ExclusionPath "$env:USERPROFILE\Desktop\F-project\shared-cache"` -- Trade-off: Defender stops scanning files in this folder, so a harmful package downloaded here is not caught at download time. -- If the folder moves, remove the old exclusion and add one for the new path. +See [development-profile.md](development-profile.md) for the approved tools and installation workflow. diff --git a/linux/cleanup/clean_dev_caches.sh b/linux/cleanup/clean_dev_caches.sh index 17d5625..4bfd51c 100755 --- a/linux/cleanup/clean_dev_caches.sh +++ b/linux/cleanup/clean_dev_caches.sh @@ -1,52 +1,3 @@ #!/usr/bin/env bash -# Developer Cache Cleanup - npm, pnpm, yarn, bun and pip caches (user level, no sudo). -set -uo pipefail - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -. "$SCRIPT_DIR/../lib/common.sh" -parse_args "$@" -refuse_sudo - -# dev_clean TOOL CMD ARGS... - runs a cache command; failures are info only. -dev_clean() { - local tool="$1" - shift - if ! have "$tool"; then - info "$tool not found, skipped" - return 0 - fi - if ! run "$@"; then - info "$tool cache clean did not finish (ignored)" - fi - return 0 -} - -banner "Developer Cache Cleanup" -before="$(free_mb)" - -step 1 1 "Developer package caches" -# The npm cache and pnpm store may be the shared cache, so they are only pruned, never wiped. -dev_clean npm npm cache verify -dev_clean pnpm pnpm store prune -dev_clean yarn yarn cache clean -dev_clean bun bun pm cache rm -if have pip3; then - run pip3 cache purge || info "pip3 cache purge did not finish (ignored)" -elif have pip; then - run pip cache purge || info "pip cache purge did not finish (ignored)" -else - info "pip not found, skipped" -fi - -after="$(free_mb)" -if [[ "$before" =~ ^[0-9]+$ && "$after" =~ ^[0-9]+$ ]]; then - freed=$((after - before)) - if (( freed < 0 )); then freed=0; fi - info "Freed about ${freed} MB on /" -else - info "Free space could not be measured." -fi - -printf '\n%s\n' "Developer cache cleanup finished. Projects re-download packages the next time they install." -pause_end -exit "$RESULT" +# Preserve shared downloads by default; cleanup is reviewed separately. +printf '%s\n' 'Developer caches preserved. Run the project cache status tool to review storage.' 'No package downloads, dependencies or build outputs have been removed.' diff --git a/linux/install/first_install.sh b/linux/install/first_install.sh index 2ccc2be..ab1da02 100755 --- a/linux/install/first_install.sh +++ b/linux/install/first_install.sh @@ -1,82 +1,19 @@ #!/usr/bin/env bash -# First Install - one click for a fresh Linux machine: your apps, then the shared dev cache. -# Runs as the user; system installs ask for sudo once at the start. +# Curated profile only. Exported application restore remains a separate command. set -uo pipefail - SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -. "$SCRIPT_DIR/../lib/common.sh" -parse_args "$@" -refuse_sudo - -GREEN="" -YELLOW="" -RESET="" -if [[ -t 1 ]]; then - GREEN=$'\033[32m' - YELLOW=$'\033[33m' - RESET=$'\033[0m' +if ! command -v node >/dev/null; then + printf '%s\n' 'Install Node.js from https://nodejs.org/en/download, then rerun this script.' + exit 1 fi - -banner "First Install" - -printf '\n%s\n' " This will:" -printf '%s\n' " 1. Install your apps from the lists saved by save_my_apps.sh (system, Flatpak, Snap)" -printf '%s\n' " 2. Set up one shared developer cache folder for all projects" - -KEEPALIVE_PID="" -if [[ $DRY_RUN -eq 0 ]]; then - if ! sudo -v; then - printf '%s\n' "sudo password was not accepted. Nothing was changed." - exit 1 - fi - ( while true; do sudo -n true; sleep 50; kill -0 "$$" 2>/dev/null || exit; done ) 2>/dev/null & - KEEPALIVE_PID=$! - trap 'kill "$KEEPALIVE_PID" 2>/dev/null' EXIT -fi - -child_args=(--auto) -if [[ $DRY_RUN -eq 1 ]]; then - child_args+=(--dry-run) -fi - -APPS_STATE="skipped" -APPS_CODE=0 -CACHE_STATE="ok" -CACHE_CODE=0 - -step 1 2 "Apps" -has_lists=0 -for f in "$SCRIPT_DIR"/packages-*.txt "$SCRIPT_DIR/flatpak.txt" "$SCRIPT_DIR/snap.txt"; do - if [[ -f "$f" ]]; then has_lists=1; fi +args=() +apply=0 +for arg in "$@"; do + [[ "$arg" == --auto ]] && continue + [[ "$arg" == --apply ]] && apply=1 + args+=("$arg") done -if [[ $has_lists -eq 1 ]]; then - bash "$SCRIPT_DIR/install_apps.sh" "${child_args[@]}" - APPS_CODE=$? - if [[ $APPS_CODE -eq 0 ]]; then APPS_STATE="ok"; else APPS_STATE="warn"; RESULT=1; fi -else - info "No app lists found - app install skipped. Run save_my_apps.sh on your old machine to create them." +node "$SCRIPT_DIR/../../tools/install-development.mjs" "${args[@]}" || exit $? +if [[ $apply -eq 1 ]]; then + bash "$SCRIPT_DIR/setup_shared_cache.sh" --auto fi - -step 2 2 "Shared cache" -bash "$SCRIPT_DIR/setup_shared_cache.sh" "${child_args[@]}" -CACHE_CODE=$? -if [[ $CACHE_CODE -eq 0 ]]; then CACHE_STATE="ok"; else CACHE_STATE="warn"; RESULT=1; fi - -summary_line() { - local label="$1" state="$2" - case "$state" in - ok) printf ' %s%-14s%s %s\n' "$GREEN" "$label:" "$RESET" "OK" ;; - skipped) printf ' %s%-14s%s %s\n' "$YELLOW" "$label:" "$RESET" "skipped - no app lists" ;; - *) printf ' %s%-14s%s %s\n' "$YELLOW" "$label:" "$RESET" "finished with warnings" ;; - esac -} - -printf '\n%s\n' "============================================================" -printf ' %s\n' "Summary" -printf '%s\n' "============================================================" -summary_line "Apps" "$APPS_STATE" -summary_line "Shared cache" "$CACHE_STATE" - -printf '\n%s\n' "First install finished. Restart so every app and setting is picked up." -pause_end -exit "$RESULT" diff --git a/linux/install/setup_shared_cache.sh b/linux/install/setup_shared_cache.sh index 7bb498f..896153c 100755 --- a/linux/install/setup_shared_cache.sh +++ b/linux/install/setup_shared_cache.sh @@ -7,7 +7,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" . "$SCRIPT_DIR/../lib/common.sh" DEFAULT_FOLDER="$HOME/F-project/shared-cache" -CACHE_NAMES=(pnpm-store cargo-target sccache gradle npm-cache puppeteer) +CACHE_NAMES=(pnpm-store cargo-targets sccache gradle npm-cache puppeteer playwright bun-cache yarn-cache pip-cache uv-cache) MARK_START="# >>> OneClick Kit shared cache >>>" MARK_END="# <<< OneClick Kit shared cache <<<" @@ -41,6 +41,10 @@ if [[ "$FOLDER" == / || "$FOLDER" == "$HOME_DIR" ]]; then exit 1 fi CACHE="$FOLDER" +if [[ "$CACHE" == *\$* || "$CACHE" == *\`* || "$CACHE" == *\"* || "$CACHE" == *\\* || "$CACHE" == *$'\n'* ]]; then + fail "Cache path contains unsupported shell characters." + exit 1 +fi banner "Shared Cache Setup" @@ -105,7 +109,7 @@ fi step 4 5 "pnpm and npm settings" if have pnpm || [[ $PNPM_PENDING -eq 1 ]]; then run pnpm config set store-dir "$CACHE/pnpm-store" --global || fail "could not set pnpm store-dir" - run pnpm config set package-import-method hardlink --global || fail "could not set pnpm package-import-method" + run pnpm config set package-import-method auto --global || fail "could not set pnpm package-import-method" else fail "pnpm not found, pnpm settings skipped" fi @@ -117,12 +121,18 @@ fi step 5 5 "Environment variables" block="$MARK_START"$'\n' -block+="export CARGO_TARGET_DIR=\"$CACHE/cargo-target\""$'\n' -block+="export CARGO_INCREMENTAL=0"$'\n' +block+="export ONECLICK_CACHE_ROOT=\"$CACHE\""$'\n' +block+="export SCCACHE_ALLOW_INCREMENTAL=1"$'\n' block+="export SCCACHE_DIR=\"$CACHE/sccache\""$'\n' block+="export SCCACHE_CACHE_SIZE=5G"$'\n' block+="export GRADLE_USER_HOME=\"$CACHE/gradle\""$'\n' block+="export PUPPETEER_CACHE_DIR=\"$CACHE/puppeteer\""$'\n' +block+="export PLAYWRIGHT_BROWSERS_PATH=\"$CACHE/playwright\""$'\n' +block+="export BUN_INSTALL_CACHE_DIR=\"$CACHE/bun-cache\""$'\n' +block+="export YARN_GLOBAL_FOLDER=\"$CACHE/yarn-cache\""$'\n' +block+="export YARN_ENABLE_GLOBAL_CACHE=true"$'\n' +block+="export PIP_CACHE_DIR=\"$CACHE/pip-cache\""$'\n' +block+="export UV_CACHE_DIR=\"$CACHE/uv-cache\""$'\n' if [[ $SCCACHE_OK -eq 1 ]]; then block+="export RUSTC_WRAPPER=sccache"$'\n' else @@ -145,6 +155,6 @@ else fi fi -printf '\n%s\n' "Shared cache setup finished. Log out and back in, or run: source ~/.profile - then run pnpm install in each project." +printf '\n%s\n' "Shared cache setup finished. Log out and back in, or run: source ~/.profile - then use the project tool in docs/shared-cache.md." pause_end exit "$RESULT" diff --git a/tests/development.test.mjs b/tests/development.test.mjs new file mode 100644 index 0000000..c285edd --- /dev/null +++ b/tests/development.test.mjs @@ -0,0 +1,41 @@ +import { test } from 'node:test'; +import assert from 'node:assert/strict'; +import fs from 'node:fs'; +import os from 'node:os'; +import path from 'node:path'; +import { spawnSync } from 'node:child_process'; +import { fileURLToPath } from 'node:url'; +const kit = fileURLToPath(new URL('../',import.meta.url)); +const cli = (script,args,env={}) => spawnSync(process.execPath,[path.join(kit,'tools',script),...args],{encoding:'utf8',env:{...process.env,...env}}); +test('approved profile contains 25 unique IDs, excludes backend tools',()=>{ + const m=JSON.parse(fs.readFileSync(path.join(kit,'profiles/development.json'),'utf8')); + assert.equal(m.tools.length,25); + assert.equal(new Set(m.tools.map(t=>t.id)).size,25); + assert.ok(!m.tools.some(t=>['bruno','docker','adb','scrcpy','opentelemetry','curl'].includes(t.id))); +}); +test('installer defaults to preview and rejects unknown selections',()=>{ + const p=cli('install-development.mjs',['vlc']); + assert.equal(p.status,0); + assert.match(p.stdout,/VLC/); + assert.equal(cli('install-development.mjs',['--apply']).status,2); + assert.equal(cli('install-development.mjs',['unknown']).status,2); +}); +test('project targets are distinct, status and plan are nonmutating, active cleanup refused',()=>{ + const temp=fs.mkdtempSync(path.join(os.tmpdir(),'oneclick-test-')); + try { + const env={ONECLICK_CACHE_ROOT:path.join(temp,'cache'),ONECLICK_STATE_DIR:path.join(temp,'state')}; + const a=path.join(temp,'a'), b=path.join(temp,'b'); + for(const p of [a,b]){fs.mkdirSync(p);fs.writeFileSync(path.join(p,'Cargo.toml'),'[package]\nname="test"\nversion="0.1.0"\n');} + const run=p=>cli('devcache.mjs',['run',p,'--',process.execPath,'-e','console.log(process.env.CARGO_TARGET_DIR)'],env); + const ra=run(a),rb=run(b); + assert.equal(ra.status,0,ra.stderr);assert.equal(rb.status,0,rb.stderr); + const state=JSON.parse(fs.readFileSync(path.join(temp,'state','projects.json'),'utf8')); + assert.equal(new Set(Object.values(state).map(p=>p.target)).size,2); + assert.equal(cli('devcache.mjs',['status'],env).status,0); + assert.equal(cli('devcache.mjs',['plan'],env).status,0); + assert.notEqual(cli('devcache.mjs',['clean',a,'target','--apply','--confirm-idle'],env).status,0); + assert.ok(Object.values(state).every(p=>fs.existsSync(p.target))); + assert.equal(cli('devcache.mjs',['deactivate',a],env).status,0); + assert.notEqual(cli('devcache.mjs',['clean',a,'target','--apply','--confirm-idle'],env).status,0); + } finally { fs.rmSync(temp,{recursive:true,force:true}); } +}); diff --git a/tools/devcache.mjs b/tools/devcache.mjs new file mode 100644 index 0000000..6651e66 --- /dev/null +++ b/tools/devcache.mjs @@ -0,0 +1,162 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import os from 'node:os'; +import { createHash } from 'node:crypto'; +import { spawnSync } from 'node:child_process'; + +const manifest = JSON.parse(fs.readFileSync(new URL('../profiles/development.json', import.meta.url), 'utf8')); +const policy = manifest.cachePolicy; +const GiB = 1024 ** 3; +const root = path.resolve(process.env.ONECLICK_CACHE_ROOT || (process.platform === 'win32' + ? path.join(os.homedir(), 'Desktop', 'F-project', 'shared-cache') + : path.join(os.homedir(), 'F-project', 'shared-cache'))); +const stateDir = path.resolve(process.env.ONECLICK_STATE_DIR || path.join(os.homedir(), '.oneclick-kit')); +const stateFile = path.join(stateDir, 'projects.json'); +const lockFile = path.join(stateDir, 'projects.lock'); +const [action, input, ...rest] = process.argv.slice(2); +const now = () => Date.now(); +const exists = p => fs.existsSync(p); +const hash = s => createHash('sha256').update(s).digest('hex'); +const fail = message => { throw new Error(message); }; + +function readState() { + if (!exists(stateFile)) return {}; + return JSON.parse(fs.readFileSync(stateFile, 'utf8')); +} +function writeState(state) { + const tmp = stateFile + '.' + process.pid + '.tmp'; + fs.writeFileSync(tmp, JSON.stringify(state, null, 2) + '\n', {mode: 0o600}); + fs.renameSync(tmp, stateFile); +} +function projectInfo(input) { + if (!input) fail('Pass an explicit project root.'); + const project = fs.realpathSync(input); + if (!fs.statSync(project).isDirectory() || !['package.json','Cargo.toml','settings.gradle','settings.gradle.kts'].some(f => exists(path.join(project,f)))) fail('Not a recognized project root: ' + project); + if (project === root || project.startsWith(root + path.sep)) fail('Project cannot be inside the cache.'); + const key = process.platform === 'win32' ? project.toLowerCase() : project; + const id = hash(key).slice(0, 24); + return {project,id,target:path.join(root,'cargo-targets',id)}; +} +function size(target, seen = new Set()) { + let total = 0; + if (!exists(target)) return 0; + const pending = [target]; + while (pending.length) { + const p = pending.pop(); + let st; + try { st = fs.lstatSync(p); } catch (e) { if (e.code === 'ENOENT') continue; throw e; } + if (st.isSymbolicLink()) continue; + if (st.isDirectory()) { + for (const entry of fs.readdirSync(p)) pending.push(path.join(p,entry)); + } else if (st.isFile()) { + const key = st.ino ? st.dev + ':' + st.ino : p; + if (!seen.has(key)) { seen.add(key); total += st.size; } + } + } + return total; +} +function showSize(bytes) { return (bytes / GiB).toFixed(2) + ' GiB'; } +function status(state, plan) { + const seen = new Set(); + let total = size(root,seen); + for (const p of Object.values(state)) { + const deps = path.join(p.project,'node_modules'); + const depBytes = size(deps,seen); + const targetBytes = size(p.target); + total += depBytes; + const idle = (now() - (p.lastActive || 0)) / 3600000; + const held = p.active || p.pinned; + console.log(p.project + ' | ' + (held ? 'active/pinned' : 'idle') + ' | dependencies ' + showSize(depBytes) + ' | Cargo ' + showSize(targetBytes)); + if (targetBytes >= policy.cargoWorkspaceWarning * GiB) console.log(' Cargo storage warning; target ' + policy.cargoWorkspaceRetention + ' GiB.'); + if (plan && !held && idle >= policy.idleDependenciesHours && exists(deps)) console.log(' REVIEW ONLY: ' + deps + ' (confirm all IDEs, builds and watches are stopped before manual cleanup)'); + if (plan && !held && idle >= policy.idleBuildHours && exists(p.target)) console.log(' REVIEW ONLY: ' + p.target + ' (retain required artifacts)'); + } + console.log('Managed cache and registered dependencies (logical bytes, hardlinks deduplicated where identifiable): ' + showSize(total)); + if (total >= policy.aggregateWarning * GiB) console.log('Aggregate warning; retention target ' + policy.aggregateRetention + ' GiB.'); + if (typeof fs.statfsSync === 'function' && exists(root)) { + const disk = fs.statfsSync(root); + const free = disk.bavail * disk.bsize; + console.log('Free space: ' + showSize(free)); + if (free < policy.minimumFree * GiB) console.log('Free space below recommended reserve.'); + } +} +function restore(project) { + const files = [ + ['pnpm-lock.yaml','pnpm',['install','--frozen-lockfile','--prefer-offline']], + ['package-lock.json','npm',['ci','--prefer-offline']], + ['npm-shrinkwrap.json','npm',['ci','--prefer-offline']], + ['yarn.lock','yarn',[]], + ['bun.lock','bun',['install','--frozen-lockfile']], + ['bun.lockb','bun',['install','--frozen-lockfile']] + ].filter(([lock]) => exists(path.join(project, lock))); + if (!exists(path.join(project,'package.json'))) return; + if (exists(path.join(project,'node_modules')) || exists(path.join(project,'.pnp.cjs'))) { + console.log('Existing dependencies retained; refresh explicitly with the project package manager if needed.'); + return; + } + if (files.length !== 1) fail('Select one lockfile before restoring dependencies.'); + const [,command,args] = files[0]; + if (command === 'yarn') { + const pkg = JSON.parse(fs.readFileSync(path.join(project,'package.json'),'utf8')); + const version = /^yarn@(\d+)/.exec(pkg.packageManager || ''); + if (!version) fail('Pin the Yarn major version in packageManager before restoring.'); + args.push('install', version[1] === '1' ? '--frozen-lockfile' : '--immutable'); + } + // Only fixed commands and arguments are passed through cmd on Windows. + const result = spawnSync(command, args, {cwd:project, stdio:'inherit', shell:process.platform === 'win32'}); + if (result.status !== 0) fail('Dependency restore failed. Existing lockfile was not intentionally changed.'); +} +function main() { + if (root === path.parse(root).root || root === os.homedir()) fail('Choose a dedicated cache directory.'); + if (action === 'status' || action === 'plan') { status(readState(),action === 'plan'); return; } + if (!['activate','deactivate','pin','unpin','run','clean'].includes(action)) fail('Usage: devcache.mjs status|plan|activate|deactivate|pin|unpin|run|clean PROJECT [-- command args]'); + const info = projectInfo(input); + fs.mkdirSync(stateDir,{recursive:true}); + let lock; + try { lock = fs.openSync(lockFile,'wx',0o600); } + catch { fail('Another project operation is active. If interrupted, verify it stopped before removing the lock.'); } + try { + const state = readState(); + const p = state[info.id] || {...info,active:false,pinned:false,lastActive:now()}; + if (p.target !== info.target) fail('Cache root changed; review the registered workspace before migrating its target.'); + if (action === 'clean') { + if (!state[info.id] || p.active || p.pinned) fail('Project must be registered, inactive and unpinned.'); + if (rest.length !== 3 || !['deps','target'].includes(rest[0]) || rest[1] !== '--apply' || rest[2] !== '--confirm-idle') fail('Usage: clean PROJECT deps|target --apply --confirm-idle'); + const hours = rest[0] === 'deps' ? policy.idleDependenciesHours : policy.idleBuildHours; + if (now() - p.lastActive < hours * 3600000) fail('Project has not reached the idle retention period.'); + const target = rest[0] === 'deps' ? path.join(info.project,'node_modules') : info.target; + if (!exists(target)) { console.log('Nothing to clean'); return; } + const st = fs.lstatSync(target); + if (!st.isDirectory() || st.isSymbolicLink() || fs.realpathSync(target) !== target) fail('Refusing non-canonical or linked cleanup target.'); + if (rest[0] === 'deps') { + const tracked = spawnSync('git',['ls-files','--','node_modules'],{cwd:info.project,encoding:'utf8'}); + if (tracked.status !== 0 || tracked.stdout.trim()) fail('Cannot establish that node_modules is untracked.'); + const lockfiles = ['pnpm-lock.yaml','package-lock.json','npm-shrinkwrap.json','yarn.lock','bun.lock','bun.lockb']; + if (!lockfiles.some(f=>exists(path.join(info.project,f)))) fail('No lockfile; refusing to remove dependencies.'); + } + // Explicit operator acknowledgement is required because external IDEs and processes are not controlled by this tool. + // Refuse linked top-level directories; fs.rm unlinks nested symlinks rather than following them. + fs.rmSync(target,{recursive:true,force:false}); + console.log('Removed reviewed generated directory: ' + target); + return; + } + if (action === 'activate') { restore(info.project); p.active = true; p.lastActive = now(); } + if (action === 'deactivate') { p.active = false; p.lastActive = now(); } + if (action === 'pin') p.pinned = true; + if (action === 'unpin') p.pinned = false; + state[info.id] = p; + writeState(state); + if (action === 'run') { + if (rest[0] !== '--' || rest.length < 2) fail('Usage: run PROJECT -- executable args'); + p.active = true; p.lastActive = now(); writeState(state); + fs.mkdirSync(info.target,{recursive:true}); + console.log('Project Cargo target: ' + info.target); + const result = spawnSync(rest[1],rest.slice(2),{cwd:info.project,stdio:'inherit',env:{...process.env,CARGO_TARGET_DIR:info.target},shell:false}); + p.lastActive = now(); writeState(state); + if (result.error) fail(result.error.message); + process.exitCode = result.status ?? 1; + } + console.log(info.project + ' | target ' + info.target); + } finally { fs.closeSync(lock); fs.unlinkSync(lockFile); } +} +try { main(); } catch (error) { console.error(error.message); process.exitCode = 1; } diff --git a/tools/install-development.mjs b/tools/install-development.mjs new file mode 100644 index 0000000..08c5dd0 --- /dev/null +++ b/tools/install-development.mjs @@ -0,0 +1,51 @@ +import { readFileSync } from 'node:fs'; +import { spawnSync } from 'node:child_process'; + +const {tools} = JSON.parse(readFileSync(new URL('../profiles/development.json', import.meta.url), 'utf8')); +// Deliberately limited to exact package identifiers. Everything else is a manual or project-specific step. +const winget = { + cursor:'Anysphere.Cursor', 'github-cli':'GitHub.cli', nodejs:'OpenJS.NodeJS.LTS', + discord:'Discord.Discord', vlc:'VideoLAN.VLC', '7zip':'7zip.7zip', + localsend:'LocalSend.LocalSend', ffmpeg:'Gyan.FFmpeg', figma:'Figma.Figma', + notion:'Notion.Notion', wiztree:'AntibodySoftware.WizTree', syncthing:'Syncthing.Syncthing' +}; +const apt = {'github-cli':'gh',vlc:'vlc','7zip':'7zip',ffmpeg:'ffmpeg',syncthing:'syncthing'}; +const flags = process.argv.slice(2); +const apply = flags.includes('--apply'); +const ids = flags.filter(a => a !== '--apply' && a !== '--dry-run'); +if (apply && (flags.includes('--dry-run') || !ids.length)) { + console.error('Pass explicit tool IDs with --apply. Do not combine with --dry-run.'); + process.exit(2); +} +const known = new Set(tools.map(t=>t.id)); +if (ids.some(id=>!known.has(id))) { console.error('Unknown tool ID'); process.exit(2); } +if (!['win32','linux'].includes(process.platform)) { console.error('Unsupported platform'); process.exit(2); } +const selected = tools.filter(t => !ids.length || ids.includes(t.id)); +const isWin = process.platform === 'win32'; +const pkg = isWin ? winget : apt; +const run = (cmd,args,quiet=false) => spawnSync(cmd,args,{encoding:'utf8',stdio:quiet?'pipe':'inherit',shell:false}); +let failures = 0; +for (const t of selected) { + if (t.desktopPlatforms && !t.desktopPlatforms.includes(process.platform)) { + console.log(t.name + ': ' + (t.alternative || 'not available') + ' (' + t.url + ')'); continue; + } + if (!Object.hasOwn(pkg,t.id)) { console.log(t.name + ': manual/project-specific (' + t.url + ')'); continue; } + const id = pkg[t.id]; + const cmd = isWin ? 'winget' : 'apt-get'; + const args = isWin ? ['install','--id',id,'--exact','--source','winget'] : ['install',id]; + if (!apply) { console.log(t.name + ': ' + (isWin ? '' : 'sudo ') + [cmd,...args].join(' ')); continue; } + if (isWin) { + const installed = run('winget',['list','--id',id,'--exact','--source','winget'],true); + if (installed.status === 0 && installed.stdout.includes(id)) { console.log(t.name + ': already installed'); continue; } + const found = run('winget',['show','--id',id,'--exact','--source','winget'],true); + if (found.status !== 0) { console.error(t.name + ': package unavailable; use ' + t.url); failures++; continue; } + } else { + const installed = run('dpkg-query',['-W','-f=${Status}',id],true); + if (installed.status === 0 && installed.stdout.trim() === 'install ok installed') { console.log(t.name + ': already installed'); continue; } + const found = run('apt-cache',['show',id],true); + if (found.status !== 0 || !found.stdout.trim()) { console.error(t.name + ': package unavailable; use ' + t.url); failures++; continue; } + } + const result = isWin ? run(cmd,args) : run('sudo',[cmd,...args]); + if (result.status !== 0) { console.error(t.name + ': installation did not complete'); failures++; } +} +if (failures) process.exitCode = 1; diff --git a/windows/cleanup/clean_dev_caches.bat b/windows/cleanup/clean_dev_caches.bat index f35b704..c6f7b42 100644 --- a/windows/cleanup/clean_dev_caches.bat +++ b/windows/cleanup/clean_dev_caches.bat @@ -1,107 +1,6 @@ @echo off setlocal -set "AUTO=" -set "DRYRUN=" -set "RESULT=0" -:parseargs -if "%~1"=="" goto :argsdone -if /i "%~1"=="/auto" set "AUTO=1" -if /i "%~1"=="/dryrun" set "DRYRUN=1" -shift -goto :parseargs -:argsdone -title Developer Cache Cleanup -if not defined AUTO cls -echo ========================================= -echo Developer Cache Cleanup -echo ========================================= -if defined DRYRUN echo DRY RUN - nothing will be changed. -echo. - -rem Only package download caches are removed. Your project files, source code and -rem node_modules folders are never touched. -rem The npm cache and pnpm store may be the shared cache, so they are only pruned, never wiped. - -echo [1/6] Measuring free space before cleanup... -set "FREE_BEFORE=" -for /f "usebackq" %%A in (`powershell -NoProfile -Command "[math]::Floor((Get-PSDrive -Name '%SystemDrive:~0,1%').Free / 1MB)"`) do set "FREE_BEFORE=%%A" - -echo. -echo [2/6] npm cache - verify, removes only broken or unused entries... -set "RC=1" -where npm >nul 2>&1 -set "RC=%errorlevel%" -if not "%RC%"=="0" echo npm not found, skipped -if not "%RC%"=="0" goto :npm_done -if defined DRYRUN echo [dry run] would run npm cache verify -if defined DRYRUN goto :npm_done -call npm cache verify -:npm_done - -echo. -echo [3/6] pnpm store... -set "RC=1" -where pnpm >nul 2>&1 -set "RC=%errorlevel%" -if not "%RC%"=="0" echo pnpm not found, skipped -if not "%RC%"=="0" goto :pnpm_done -if defined DRYRUN echo [dry run] would run pnpm store prune -if defined DRYRUN goto :pnpm_done -call pnpm store prune -:pnpm_done - -echo. -echo [4/6] yarn cache... -set "RC=1" -where yarn >nul 2>&1 -set "RC=%errorlevel%" -if not "%RC%"=="0" echo yarn not found, skipped -if not "%RC%"=="0" goto :yarn_done -if defined DRYRUN echo [dry run] would run yarn cache clean -if defined DRYRUN goto :yarn_done -call yarn cache clean -:yarn_done - -echo. -echo [5/6] bun and pip caches... -set "RC=1" -where bun >nul 2>&1 -set "RC=%errorlevel%" -if not "%RC%"=="0" echo bun not found, skipped -if not "%RC%"=="0" goto :bun_done -if defined DRYRUN echo [dry run] would run bun pm cache rm -if defined DRYRUN goto :bun_done -call bun pm cache rm -:bun_done -set "RC=1" -where pip >nul 2>&1 -set "RC=%errorlevel%" -if not "%RC%"=="0" echo pip not found, skipped -if not "%RC%"=="0" goto :pip_done -if defined DRYRUN echo [dry run] would run pip cache purge -if defined DRYRUN goto :pip_done -call pip cache purge -:pip_done - -echo. -echo [6/6] Measuring free space after cleanup... -set "FREE_AFTER=" -for /f "usebackq" %%A in (`powershell -NoProfile -Command "[math]::Floor((Get-PSDrive -Name '%SystemDrive:~0,1%').Free / 1MB)"`) do set "FREE_AFTER=%%A" -set "FREED=" -if "%FREE_BEFORE%"=="" goto :freed_unknown -if "%FREE_AFTER%"=="" goto :freed_unknown -set /a FREED=FREE_AFTER-FREE_BEFORE -if %FREED% LSS 0 set "FREED=0" -goto :freed_show -:freed_unknown -echo Free space could not be measured. -goto :freed_done -:freed_show -echo Freed about %FREED% MB on %SystemDrive% -:freed_done - -echo. -echo Developer cache cleanup finished. Projects re-download packages the next time they install. -if not defined AUTO echo Press any key to close... -if not defined AUTO pause >nul -exit /b %RESULT% +rem Download caches are preserved by default. Review storage before any pruning. +echo Developer caches preserved. Run the project cache status tool to review storage. +echo No package downloads, dependencies or build outputs have been removed. +exit /b 0 diff --git a/windows/install/first_install.bat b/windows/install/first_install.bat index dac48c3..5f74177 100644 --- a/windows/install/first_install.bat +++ b/windows/install/first_install.bat @@ -1,70 +1,28 @@ @echo off setlocal -set "AUTO=" -set "DRYRUN=" -set "RESULT=0" -set "HERE=%~dp0" -set "SELF=%~f0" -set "ARGS=%*" -:parseargs -if "%~1"=="" goto :argsdone -if /i "%~1"=="/auto" set "AUTO=1" -if /i "%~1"=="/dryrun" set "DRYRUN=1" +rem Curated profile only. The old exported-app restore is explicitly run via install_apps.bat. +where node >nul 2>&1 +if errorlevel 1 ( + echo Install Node.js from https://nodejs.org/en/download, then rerun this script. + exit /b 1 +) +set "APPLY=" +set "ARGS=" +:args +if "%~1"=="" goto :run +if /i "%~1"=="/dryrun" ( + set "ARGS=%ARGS% --dry-run" + goto :next +) +if /i "%~1"=="/auto" goto :next +if /i "%~1"=="--apply" set "APPLY=1" +set "ARGS=%ARGS% %~1" +:next shift -goto :parseargs -:argsdone -title First Install -if not defined AUTO cls -echo ========================================= -echo First Install -echo ========================================= -if defined DRYRUN echo DRY RUN - nothing will be changed. -echo. - -set "CHILD_ARGS=/auto" -if not defined DRYRUN goto :args_ready -set "CHILD_ARGS=/auto /dryrun" -:args_ready - -if defined DRYRUN goto :admin_ok -fltmc >nul 2>&1 -if not errorlevel 1 goto :admin_ok -echo Requesting admin rights... -if "%ARGS%"=="" powershell -NoProfile -Command "Start-Process -FilePath '%SELF%' -Verb RunAs" -if not "%ARGS%"=="" powershell -NoProfile -Command "Start-Process -FilePath '%SELF%' -ArgumentList '%ARGS%' -Verb RunAs" -exit /b -:admin_ok - -echo. -echo [1/2] Apps... -if exist "%HERE%apps.json" goto :apps_run -echo apps.json not found - app install skipped. Run save_my_apps.bat on your old PC to create it. -set "RC_APPS=skipped" -goto :apps_done -:apps_run -call "%HERE%install_apps.bat" %CHILD_ARGS% -set "RC_APPS=%errorlevel%" -:apps_done - -echo. -echo [2/2] Shared cache... -call "%HERE%setup_shared_cache.bat" %CHILD_ARGS% -set "RC_CACHE=%errorlevel%" - -echo. -echo ========================================= -echo Summary -echo ========================================= -if "%RC_APPS%"=="0" echo Apps: OK -if "%RC_APPS%"=="skipped" echo Apps: skipped - no apps.json -if not "%RC_APPS%"=="0" if not "%RC_APPS%"=="skipped" echo Apps: finished with warnings -if not "%RC_APPS%"=="0" if not "%RC_APPS%"=="skipped" set "RESULT=1" -if "%RC_CACHE%"=="0" echo Shared cache: OK -if not "%RC_CACHE%"=="0" echo Shared cache: finished with warnings -if not "%RC_CACHE%"=="0" set "RESULT=1" - -echo. -echo First install finished. Restart the PC so every app and setting is picked up. -if not defined AUTO echo Press any key to close... -if not defined AUTO pause >nul -exit /b %RESULT% +goto :args +:run +node "%~dp0..\..\tools\install-development.mjs" %ARGS% +if errorlevel 1 exit /b 1 +if not defined APPLY exit /b 0 +call "%~dp0setup_shared_cache.bat" /auto +exit /b %errorlevel% diff --git a/windows/install/setup_shared_cache.bat b/windows/install/setup_shared_cache.bat index 51fcf2d..b81dbf5 100644 --- a/windows/install/setup_shared_cache.bat +++ b/windows/install/setup_shared_cache.bat @@ -36,11 +36,16 @@ echo Keep it on the same drive as your projects - hard links do not work acros echo. echo [2/5] Folders... call :MakeDir pnpm-store -call :MakeDir cargo-target +call :MakeDir cargo-targets call :MakeDir sccache call :MakeDir gradle call :MakeDir npm-cache call :MakeDir puppeteer +call :MakeDir playwright +call :MakeDir bun-cache +call :MakeDir yarn-cache +call :MakeDir pip-cache +call :MakeDir uv-cache echo. echo [3/5] Tools... @@ -91,13 +96,13 @@ set "RESULT=1" goto :pnpm_settings_done :pnpm_settings if defined DRYRUN echo [dry run] would run pnpm config set store-dir "%CACHE%\pnpm-store" --global -if defined DRYRUN echo [dry run] would run pnpm config set package-import-method hardlink --global +if defined DRYRUN echo [dry run] would run pnpm config set package-import-method auto --global if defined DRYRUN goto :pnpm_settings_done call pnpm config set store-dir "%CACHE%\pnpm-store" --global set "RC=%errorlevel%" if not "%RC%"=="0" echo WARNING: could not set the pnpm store folder. if not "%RC%"=="0" set "RESULT=1" -call pnpm config set package-import-method hardlink --global +call pnpm config set package-import-method auto --global set "RC=%errorlevel%" if not "%RC%"=="0" echo WARNING: could not set the pnpm import method. if not "%RC%"=="0" set "RESULT=1" @@ -107,9 +112,9 @@ where npm >nul 2>&1 set "RC=%errorlevel%" if not "%RC%"=="0" echo npm not found, npm settings skipped if not "%RC%"=="0" goto :npm_settings_done -if defined DRYRUN echo [dry run] would run npm config set cache "%CACHE%\npm-cache" --global +if defined DRYRUN echo [dry run] would run npm config set cache "%CACHE%\npm-cache" --location=user if defined DRYRUN goto :npm_settings_done -call npm config set cache "%CACHE%\npm-cache" --global +call npm config set cache "%CACHE%\npm-cache" --location=user set "RC=%errorlevel%" if "%RC%"=="0" goto :npm_settings_done call npm config set cache "%CACHE%\npm-cache" @@ -121,17 +126,26 @@ if not "%RC%"=="0" set "RESULT=1" echo. echo [5/5] Environment variables for your user... -call :SetVar CARGO_TARGET_DIR "%CACHE%\cargo-target" -call :SetVar CARGO_INCREMENTAL 0 +call :SetVar ONECLICK_CACHE_ROOT "%CACHE%" +rem Remove only the legacy target value created by OneClick Kit, not custom settings. +if defined DRYRUN echo [dry run] would check legacy CARGO_TARGET_DIR +if not defined DRYRUN powershell -NoProfile -Command "$v=[Environment]::GetEnvironmentVariable('CARGO_TARGET_DIR','User'); if ($v -eq (Join-Path $env:CACHE 'cargo-target') -or $v -eq (Join-Path $env:USERPROFILE 'Desktop\F-project\shared-cache\cargo-target')) { [Environment]::SetEnvironmentVariable('CARGO_TARGET_DIR',$null,'User') }" +call :SetVar SCCACHE_ALLOW_INCREMENTAL 1 call :SetVar SCCACHE_DIR "%CACHE%\sccache" call :SetVar SCCACHE_CACHE_SIZE 5G call :SetVar GRADLE_USER_HOME "%CACHE%\gradle" call :SetVar PUPPETEER_CACHE_DIR "%CACHE%\puppeteer" +call :SetVar PLAYWRIGHT_BROWSERS_PATH "%CACHE%\playwright" +call :SetVar BUN_INSTALL_CACHE_DIR "%CACHE%\bun-cache" +call :SetVar YARN_GLOBAL_FOLDER "%CACHE%\yarn-cache" +call :SetVar YARN_ENABLE_GLOBAL_CACHE true +call :SetVar PIP_CACHE_DIR "%CACHE%\pip-cache" +call :SetVar UV_CACHE_DIR "%CACHE%\uv-cache" if defined SCCACHE_OK call :SetVar RUSTC_WRAPPER sccache if not defined SCCACHE_OK echo RUSTC_WRAPPER not set - Rust builds fail when it points to a missing sccache. echo. -echo Shared cache setup finished. Open a new terminal, then run pnpm install in each project. +echo Shared cache setup finished. Open a new terminal, then use the project tool in docs/shared-cache.md. if not defined AUTO echo Press any key to close... if not defined AUTO pause >nul exit /b %RESULT% From db5e55d708b11cc9644b337db094ce278e3709a7 Mon Sep 17 00:00:00 2001 From: Nexvyn <100619913+Nexvyn@users.noreply.github.com> Date: Wed, 25 Nov 2026 19:26:31 +0530 Subject: [PATCH 5/6] Add independent update and idle cleanup launchers, full profile preview, README and MIT license --- LICENSE | 21 +++++ README.md | 145 +++++++++++++++++++++------------- docs/development-profile.md | 2 + docs/shared-cache.md | 4 + linux/clean-idle.sh | 4 + linux/oneclick.sh | 2 +- linux/update-only.sh | 8 ++ tests/development.test.mjs | 14 ++++ tools/devcache.mjs | 92 +++++++++++++++++---- tools/install-development.mjs | 8 +- windows/clean-idle.bat | 4 + windows/src/OneClickKit.cs | 2 +- windows/update-only.bat | 15 ++++ 13 files changed, 243 insertions(+), 78 deletions(-) create mode 100644 LICENSE create mode 100755 linux/clean-idle.sh create mode 100755 linux/update-only.sh create mode 100644 windows/clean-idle.bat create mode 100644 windows/update-only.bat diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..119487b --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Nexvyn + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 9337801..7c43808 100644 --- a/README.md +++ b/README.md @@ -1,74 +1,107 @@ # OneClick Kit -One-click maintenance for Windows and Linux. The scripts are grouped by job: - -| Folder | What it does | Runs in the one-click | -|---|---|---| -| `cleanup/` | Browser caches, system junk, developer cache status (preserves downloads) | Yes, first | -| `update/` | The whole system: OS, drivers and firmware, store apps, all other apps | Yes, second | -| `install/` | Fresh PC: reinstall your apps, then set up the shared dev cache | No, run `first_install` on a new PC | - -``` -windows/ OneClickKit.exe (after build), build.bat, cleanup/, update/, install/, src/ -linux/ oneclick.sh, cleanup/, update/, install/, lib/ -docs/ shared-cache.md, convert-project-prompt.md +A Windows and Linux development-machine toolkit for fresh installation, shared caches, project cleanup and routine maintenance. Designed for small SSDs and reproducible project environments. + +## Quick start + +| Workflow | Windows | Linux | +| --- | --- | --- | +| Fresh machine preview | `windows\install\first_install.bat /dryrun` | `bash linux/install/first_install.sh --dry-run` | +| Fresh machine apply selected tools | `windows\install\first_install.bat --apply cursor github-cli` | `bash linux/install/first_install.sh --apply github-cli vlc` | +| All approved supported installers | `windows\install\first_install.bat --apply --all` | `bash linux/install/first_install.sh --apply --all` | +| Shared cache setup | `windows\install\setup_shared_cache.bat` | `bash linux/install/setup_shared_cache.sh` | +| Idle project cleanup preview | `windows\clean-idle.bat` | `bash linux/clean-idle.sh` | +| Idle project cleanup apply | `windows\clean-idle.bat --apply` | `bash linux/clean-idle.sh --apply` | +| Update-only preview | `windows\update-only.bat` | `bash linux/update-only.sh` | +| Update-only apply | `windows\update-only.bat --apply` | `bash linux/update-only.sh --apply` | +| Full maintenance preview | `windows\OneClickKit.exe --dry-run` | `bash linux/oneclick.sh --dry-run` | + +Install Node.js from its official source before using the fresh-machine or project cache commands. Run scripts from a checked-out repository. Review previews before applying changes. On Windows, build the executable once with `windows\build.bat`; rebuild after editing embedded scripts. + +## Approved tools + +These are the 25 approved tools in [profiles/development.json](profiles/development.json). The installer never adds other standalone applications. + +| Tool | Selection ID | Type | +| --- | --- | --- | +| [Traycer](https://traycer.ai/download) | `traycer` | Desktop app | +| [Cursor](https://cursor.com/) | `cursor` | Desktop app | +| [Moon](https://moonrepo.dev/moon) | `moon` | CLI | +| [GitHub CLI](https://cli.github.com/) | `github-cli` | CLI | +| [Biome](https://biomejs.dev/) | `biome` | Project dependency | +| [Vitest](https://vitest.dev/) | `vitest` | Project dependency | +| [Testing Library](https://testing-library.com/) | `testing-library` | Project dependency | +| [Playwright](https://playwright.dev/) | `playwright` | Project dependency | +| [Lighthouse](https://developer.chrome.com/docs/lighthouse/) | `lighthouse` | On demand | +| [Tauri](https://tauri.app/) | `tauri` | Project dependency | +| [Swift](https://swift.org/) | `swift` | Toolchain | +| [Kotlin](https://kotlinlang.org/) | `kotlin` | Toolchain | +| [Maestro](https://docs.maestro.dev/) | `maestro` | CLI | +| [Helium Browser](https://helium.computer/) | `helium` | Desktop app | +| [Cloudflare Kitesurf](https://developers.cloudflare.com/browser-run/kitesurf/) | `kitesurf` | Remote service | +| [Node.js](https://nodejs.org/en/download) | `nodejs` | Toolchain | +| [Notion](https://www.notion.so/desktop) | `notion` | Desktop app (Windows desktop; web on Linux) | +| [Discord](https://discord.com/download) | `discord` | Desktop app | +| [VLC](https://www.videolan.org/vlc/) | `vlc` | Desktop app | +| [7-Zip](https://www.7-zip.org/download.html) | `7zip` | Desktop app | +| [LocalSend](https://localsend.org/) | `localsend` | Desktop app | +| [FFmpeg](https://ffmpeg.org/download.html) | `ffmpeg` | CLI | +| [Figma](https://www.figma.com/downloads/) | `figma` | Desktop app (Windows desktop; web on Linux) | +| [WizTree](https://diskanalyzer.com/) | `wiztree` | Desktop app (Windows desktop only) | +| [Syncthing](https://syncthing.net/downloads/) | `syncthing` | Desktop app | + +Install adapters currently cover selected WinGet packages on Windows and supported apt packages on Linux. Tools without an adapter are reported with official links; project dependencies remain project-pinned, and remote services require separate setup. The all-tools option installs only supported adapters, not every item in the catalog. Required compiler/runtime prerequisites are documented separately by each tool. The old exported application setup is still available through the separate `save_my_apps` and `install_apps` scripts; it is not part of the curated profile. + +## Shared development cache + +Shared package downloads (npm, pnpm, Yarn, Bun, pip and uv), eligible Rust compiler artifacts (sccache), and supported Gradle and browser downloads are configured centrally. Project-specific Rust build outputs are isolated by workspace/worktree. The project runner sets the appropriate target directory; normal Cargo invocations retain their existing configuration. + +| Budget | Target | +| --- | --- | +| Aggregate disposable development data | 35 GiB (warning at 25 GiB) | +| Cargo target per project | 5 GiB (warning at 4 GiB) | +| Shared sccache | 5 GiB | +| Recommended free space | 40 GiB | +| Idle dependencies | 24 hours before eligible for review | +| Idle build outputs | 48 hours before eligible for review | + +Budgets are retention targets, not hard quotas; active builds must be allowed to complete. + +```sh +node tools/devcache.mjs activate /path/to/project +node tools/devcache.mjs run /path/to/project -- cargo build +node tools/devcache.mjs status +node tools/devcache.mjs deactivate /path/to/project +node tools/devcache.mjs plan ``` -## Windows +Activation restores missing dependencies from the project's existing lockfile. Pin active or important projects to keep their generated files. Use [shared-cache.md](docs/shared-cache.md) for details and [convert-project-prompt.md](docs/convert-project-prompt.md) for existing projects. -**One click** +## One-click idle cleanup -1. Run `windows\build.bat` once. It creates `windows\OneClickKit.exe` with the C# compiler that ships with Windows, so nothing needs to be installed. -2. Double-click `OneClickKit.exe` and accept the admin prompt. -3. A 10-second countdown starts. Press any key to start now, or Esc to cancel. -4. It runs browser cleanup, Windows cleanup, developer cache cleanup, then updates. At the end it shows a summary and asks before restarting. +The clean-idle launchers preview registered inactive projects and their eligible generated dependency and build directories. With `--apply` they show the exact paths and ask for explicit interactive confirmation. Close editors, dev servers, tests and watches; preserve release artifacts and custom files before confirming. Active, pinned, recently used or unsafe paths are skipped. Shared package download stores are preserved to make restores faster. No unattended bulk deletion. -**What it touches** +## Update only -- Browser cleanup closes Chrome, Edge, Brave and Firefox and clears their cache for every profile. It never deletes history, cookies, passwords, logins or bookmarks. -- Windows cleanup clears your temp folder, Windows temp, old Windows Update downloads, the Delivery Optimization cache, crash reports and dumps, Windows logs older than 7 days, and the Recycle Bin. It reports how much space it freed. It does not clear Prefetch, because Windows uses Prefetch to start apps faster. -- Developer cleanup preserves package download caches. Review managed project storage and cleanup candidates with the project lifecycle tool. -- Updates cover Microsoft Defender definitions, Windows Update (including drivers and other Microsoft products, through PSWindowsUpdate, which is installed automatically), Microsoft Store apps and every winget app. It never restarts by itself. +Run the update-only launcher with `--apply` to update without invoking cleanup. -**Fresh PC** +- Windows: Windows Update and supported drivers, Defender definitions, Microsoft Store update requests and WinGet-managed applications. +- Linux: the detected apt, dnf, pacman or zypper package manager, Flatpak, Snap and supported firmware through fwupd. -1. Install Node.js from its official site if it is not already available. -2. Run `windows\install\first_install.bat` to preview the approved profile. -3. Run `windows\install\first_install.bat --apply cursor github-cli` with your chosen tool IDs to install and configure the shared cache. Open a new terminal afterwards. +Coverage depends on installed package managers and supported devices; independently installed apps may require their own updater. Restart is never automatic without user confirmation. -Each part also runs on its own: `install_apps.bat`, `setup_shared_cache.bat`. +## Full maintenance -## Linux +The legacy combined workflow remains available with `windows\OneClickKit.exe` or `bash linux/oneclick.sh`. It runs browser and system cleanup, preserves shared developer downloads, then updates. It may close browser processes and clear system junk/Trash or Recycle Bin. Save work and review the dry run first; choose update-only or idle cleanup if you do not want the legacy combined behavior. -Supports apt (Ubuntu, Debian, Mint, Pop!_OS), dnf (Fedora), pacman (Arch, Manjaro) and zypper (openSUSE), plus Flatpak, Snap and fwupd firmware updates. +## Development and tests -```bash -git clone https://github.com/Nexvyn/OneClick-Kit.git -cd OneClick-Kit -bash linux/oneclick.sh +```sh +node --test tests/development.test.mjs ``` -Run it as your normal user, not with `sudo`. It asks for your password once. It runs the same four steps as on Windows, using your distro's tools, then shows a summary and asks before restarting. - -**Fresh PC:** install Node.js if needed, then run `bash linux/install/first_install.sh` to preview the approved profile. Pass `--apply` and selected tool IDs to install and configure shared caches. To restore a previous export, run the separate app-list scripts explicitly. - -## Approved development tools - -Use [development-profile.md](docs/development-profile.md) to preview and install the curated profile instead of restoring a previous app export. See [shared-cache.md](docs/shared-cache.md) for isolated Cargo targets and on-demand dependencies. - -## Preview first - -Every script has a preview mode that changes nothing and prints what it would do: - -- Windows: `OneClickKit.exe --dry-run`, or any script with `/dryrun`, for example `windows\cleanup\clean_windows_junk.bat /dryrun` -- Linux: `bash linux/oneclick.sh --dry-run`, or any script with `--dry-run` - -## Run one step - -Every script also works on its own. Double-click a `.bat` file, or run `bash linux//