Skip to content

feat: stage the Windows office install in %PUBLIC% and bake real-user paths - #245

Merged
quickbeard merged 3 commits into
mainfrom
feat/public-downloads-staging
Aug 5, 2026
Merged

feat: stage the Windows office install in %PUBLIC% and bake real-user paths#245
quickbeard merged 3 commits into
mainfrom
feat/public-downloads-staging

Conversation

@quickbeard

Copy link
Copy Markdown
Owner

Summary

Companion to quickbeard/codev-scripts#22 — two profile-divergence fixes for the Windows install flow. Field report: when codevhub skill office runs in an elevated shell (or the UAC prompt is approved with a different admin account), %USERPROFILE% resolves to the admin's profile and users keep looking for files — and worse, get skills installed — under the wrong account.

  1. Profile-independent staging. The Windows default download dir moves from ~/.codev-hub/office to %PUBLIC%\Downloads\codev-office — the same absolute path for every account (normal shell, elevated shell, any admin), world-writable, not OneDrive-synced, not targeted by Storage Sense. Already-downloaded files migrate from the old dot-folder via same-volume renames, so multi-GB bundles are never re-fetched. --dir still overrides; Ubuntu/macOS are unchanged.
  2. Real-user path baking in the .cmd wrappers. The install and uninstall wrappers now pass -ModulesDir %PUBLIC%\codev-office\node_modules (account-independent) and — when staged on a Windows host — -SkillsRoot pinned to the real user's skills folder, which codevhub knows authoritatively because it runs unelevated as that user. Combined with codev-scripts#22 (Machine-scope NODE_PATH when elevated), a different-account elevation now installs skills and modules where the actual user needs them. Cross-platform staging bakes only the modules dir, since the staging host's homedir says nothing about the target machine's user. Arguments containing spaces are quoted in the generated .cmd.

Deployment order: publish the codev-scripts#22 setup/uninstall scripts before releasing this — the baked -ModulesDir/-SkillsRoot flags are unknown parameters to the older published scripts.

Test plan

  • pnpm typecheck, pnpm check, download/office suite: 36 passed
  • New tests: baked args (modules dir always, skills root only on a Windows host), wrapper space-quoting, legacy-dir migration (moves absent files, never clobbers, missing source is a no-op); cross-platform staging asserts no -SkillsRoot
  • Field: fresh Windows machine, UAC approved with a different admin account → skills land in the real user's .config\codev\skills, node -e "require('pptxgenjs')" works as the real user, staging folder identical from both shells

🤖 Generated with Claude Code

Quickbeard and others added 2 commits August 5, 2026 18:15
Two profile-divergence fixes for the Windows flow, prompted by a field
report: %USERPROFILE% resolves differently between a normal shell and a
UAC elevation approved with a different admin account, so files (and
worse, installed skills) landed under the admin's profile where the
real user never finds them.

- The default staging dir on Windows moves from ~/.codev-hub/office to
  the profile-independent %PUBLIC%\Downloads\codev-office - the same
  path for every account, world-writable, not OneDrive-synced. Files
  already downloaded under the old dot-folder are migrated with
  same-volume renames so multi-GB bundles are never re-fetched.
- The generated .cmd wrappers bake profile-safe paths for the setup and
  uninstall scripts: -ModulesDir %PUBLIC%\codev-office\node_modules
  (account-independent) always, and -SkillsRoot pinned to the REAL
  user's profile when staging on a Windows host (codevhub runs
  unelevated as that user, so homedir() is authoritative).
  Cross-platform staging bakes only the modules dir - this host's
  homedir says nothing about the target machine's user. Wrapper
  arguments containing spaces are now quoted.

Requires the codev-scripts side (-ModulesDir/-SkillsRoot parameters on
the Windows scripts) to be published first.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
C:\Users\Public\Downloads is deletable by debloat scripts (harmless -
mkdirSync recreates it recursively), but a hardened image can deny
non-admin writes under C:\Users\Public entirely. Instead of crashing,
staging now falls back to the old per-user ~/.codev-hub/office with a
printed notice. --dir overrides keep failing loudly - an explicit
choice should not be silently redirected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@quickbeard

Copy link
Copy Markdown
Owner Author

Added a hardening commit for the "does %PUBLIC%\Downloads exist?" question: the folder is recreated automatically by the recursive mkdir if a debloat script pruned it, and when a hardened image denies non-admin writes under C:\Users\Public entirely, staging now falls back to the old per-user ~/.codev-hub/office with a printed notice instead of crashing (explicit --dir choices still fail loudly). Covered by a chmod-based test.

@quickbeard
quickbeard merged commit 370ee36 into main Aug 5, 2026
2 of 4 checks passed
@quickbeard
quickbeard deleted the feat/public-downloads-staging branch August 5, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant