cmd

package
v2.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Overview

Package cmd: `axm check` — local validation.

`axm check` elaborates the given workspace files (or all modified ones) and their transitive workspace closure with `lake exe axm_transform` in dry-run mode, one file per short-lived subprocess so Lean import regions stay bounded. Nothing leaves the machine.

Package cmd / fork.go implements `axm fork <file_id> [<dest>]` per the internal content-submission-pipeline doc §"axm fork".

The five-step flow:

  1. Copy <file_id>'s dependency closure from the installed Published Corpus into .axiomdata/files/A/ (the root itself is not cached).
  2. Derive the dest path: Workspace/<dest>.lean (warn-and-default if dest omitted).
  3. Reverse-transform the fetched content to workspace form by shelling to `lake exe axm_transform` with `mode: "reverse"`. The exe walks the parsed Syntax tree and applies byte-range edits to strip the outer `namespace <file_id> ... end <file_id>` wrapper, rewrite each `import A.<x>` back to `import Workspace.<path-stem>` when <x> is the latest-published unified file_id of one of the user's own workspace files, and drop the auto-open markers the forward transform emitted alongside those imports.
  4. Write Workspace/<dest>.lean (refuses to clobber).
  5. Record the fork intent in fork_intents.json. Consumed on the next successful publish of that path.

Package cmd / lock.go — workspace-wide flock helper shared by every subcommand that mutates .axiomdata/ state (pull, fork, fetch).

`axm pull`, `axm fork`, and `axm fetch` all RMW files under .axiomdata/index/ (published.json, fork_intents.json, fetched.json). Two concurrent invocations against the same workspace race on these files — e.g. `axm fetch` and `axm fork` both rewriting fetched.json. We serialize all three commands behind a single workspace-wide lockfile with LOCK_EX|LOCK_NB so a second invocation exits immediately with a git-style message rather than waiting.

NB: the lockfile path — .axiomdata/workspace.lock — must live on a local filesystem. POSIX flock() may silently no-op on some NFS clients (pre-Linux 2.6.12 in particular), in which case the guard degrades to best-effort. The design assumes workspace roots live on local disk; users operating from an NFS-mounted workspace accept the weaker guarantee.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute()

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址