feat(system): directory/process primitives (chdir, cwd, mkdtemp, remove-all)#129
Merged
Conversation
…ve-all) Adds to the system library: - (chdir path) -> nil; os.Chdir, process-global working directory. - (cwd) -> the working directory as an absolute path. - (mkdtemp & [pfx]) -> a fresh unique temp directory (os.MkdirTemp). - (remove-all path) -> nil; os.RemoveAll, recursive, no error if absent. These let in-process tests drive state-save/state-load against a temporary git repo (mkdtemp + git-init + chdir) instead of the real one, verified end to end: state-save creates the first commit on an unborn branch and state-load reads it back, both without --integrity. The Go func is remove_all (snake_case) so the lisp name is remove-all; the chdir test restores cwd (registered after t.TempDir so it runs first) to avoid polluting other tests in the package. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds four primitives to the
systemlibrary so lisp code can drive filesystem/process state — the immediate need being an in-process integration test that runs the staging→custodian flow against a temporary git repo instead of the real one.(chdir path)os.Chdir);nilon success(cwd)(mkdtemp & [prefix])os.MkdirTemp), returns its path(remove-all path)os.RemoveAll); no error if the path is absentPlaced in
system(the host-OS library):chdir/cwdare process-global state like the existinggetenv/setenv, andmkdtemp/remove-allare OS operations.Verified end to end:
mkdtemp+git-init+chdir+state-save(which creates the first commit on an unborn branch) +state-load, all without--integrity, then cleanup withchdirback +remove-all.Notes from the spec review
remove_all(snake_case) so the derived lisp name isremove-all—removeAllwould have becomeremoveall(the name derivation is lowercase +_→-, no camelCase split).chdirGo test restores cwd (its cleanup is registered aftert.TempDir(), so it runs first) to avoid polluting other tests in the package.Test plan
lib/system/system_test.go:chdir+cwdround-trip and failure-leaves-cwd,mkdtempuniqueness/prefix/type-error,remove-allrecursive + absent-path.docs_test.goextended to cover the new builtins;LANGUAGE.mdregenerated. Full suite green.🤖 Generated with Claude Code