Skip to content

feat: dct-init - one command to set up any project folder (Windows + Mac/Linux) - #105

Merged
terchris merged 3 commits into
mainfrom
feature/dct-init
Sep 25, 2026
Merged

terchris merged 3 commits into
mainfrom
feature/dct-init

Conversation

@terchris

Copy link
Copy Markdown
Collaborator

Draft: do not merge before Terje's execution-policy result (urb-agents #1539). Today's irm | iex isn't subject to PowerShell's execution policy. The new installer runs a .ps1 file, which is. On a PC where the organisation enforces AllSigned, it deliberately stops with ERR006 ("ask IT"). If that's the case on the managed PCs, merging would break the Quick Start there.

What it does

  • dct-init sets up a project folder:
    • writes devcontainer.json and .vscode/extensions.json
    • installs the Dev Containers extension
    • downloads the image
  • It checks before writing anything:
    • Rancher Desktop: installed, visible, running
    • VS Code
    • Intel Macs (Terje: out of scope)
  • It refuses system folders, the drive root and the home folder (System32 was where Terje's first test landed). It never overwrites an existing backup.
  • Exit codes 0 done, 1 prerequisite missing, 2 download/network, 3 folder problem, each with an ERRnnn line. This is the contract agreed with client-provisioning (urb-agents #1505).
  • install.sh / install.ps1 become bootstraps. They install the dct-* commands for the user (no admin), then run dct-init once. The Quick Start command is unchanged.
    • Windows: %LOCALAPPDATA%\devcontainer-toolbox\bin, added to the user PATH.
    • Mac/Linux: ~/.local/bin, next to dct-exec.

Verification so far

  • bash, with a throwaway HOME and stub docker/code: every case returns the right exit code, and dct-init works by name in a new folder.
  • PowerShell 7 on Linux, with install.ps1 via Invoke-Expression like the Quick Start: the session survives every case, and the user's $ErrorActionPreference is untouched.
  • Lint: shellcheck, PSScriptAnalyzer (0 findings apart from PSAvoidUsingWriteHost), actionlint. The .ps1 files are plain ASCII, because Windows PowerShell 5.1 reads BOM-less files as ANSI.
  • Pending:
    • the new Host Commands jobs on windows-latest / Linux in this PR
    • Terje's test on his managed PC (branch install via DCT_INSTALL_REF)
    • #1539

🤖 Generated with Claude Code

terchris and others added 3 commits September 25, 2026 16:38
…Mac/Linux)

After the first install a user sets up a new project folder by typing
`dct-init` in it, on every machine (Terje, 2026-09-25). Every dct-*
command is installed by DCT's own install script.

- host-tools/dct-init.sh, dct-init.ps1 + dct-init.cmd: the per-folder
  logic moved out of install.sh / install.ps1. Checks Rancher Desktop
  (installed / visible / running), VS Code and Intel Macs before writing
  anything; refuses system folders, the drive root and the home folder;
  never overwrites an existing backup. Exit codes 0/1/2/3 with ERRnnn
  lines, as agreed with client-provisioning (urb-agents #1505).
- install.sh / install.ps1 are now bootstraps: install the commands for
  the user (Windows: %LOCALAPPDATA%\devcontainer-toolbox\bin on the user
  PATH), then run dct-init once. install.ps1 stops with ERR006 when an
  organisation enforces AllSigned/Restricted instead of working around it.
- Host Commands workflow: new dct-init jobs on windows-latest (install via
  install.ps1, dct-init by name from a new shell, exit codes through the
  .cmd shim) and Linux.
- DCT_INSTALL_SOURCE / DCT_INSTALL_REF test hooks.
- PLAN-dct-init-command (active): Phase 1 waits on Terje's execution
  policy test (urb-agents #1539); Phase 2 built.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Found on Terje's PC (urb-agents #1541): `dct-init -TargetDir C:\Windows\System32`
with Rancher Desktop stopped said 'Rancher Desktop is not running' (exit 1),
so a wrong folder cost the user two round trips. The folder checks are
local and about the command the user just typed, so they now come first
(bash and PowerShell). Nothing is written before either check passes.
Regression checks added to both CI jobs. Plan: Phase 1 done (the real
install ran unsigned on the managed PC, no ERR006).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
- Getting Started: new section 'Setting Up Another Project: dct-init'
  (what it checks, where it is installed, -TargetDir, exit codes for
  scripts); Step 1 says the installer installs dct-init first; the
  migration steps and the dct-exec section updated.
- Quick Start (index.md, README): 'Next time: just type dct-init'.
- project-devcontainer-toolbox.md lists dct-init with the host commands.
- PLAN-dct-init-command: Phase 2 done, Phase 3 in progress.
- Version 1.9.0 (MINOR: new feature). Terje chose to merge code and docs
  together.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@terchris
terchris marked this pull request as ready for review September 25, 2026 15:50
@terchris
terchris merged commit a9dda47 into main Sep 25, 2026
10 checks passed
@terchris
terchris deleted the feature/dct-init branch September 25, 2026 15:50
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