Rename loom → norn
The project is now norn: .loom/ is .norn/, loomctl is nornctl (NORNCTL_* env vars, ~/.config/nornctl), and the Gitea org is norn. Event logs moved with the directory but their text is unchanged — they are a record of what was decided at the time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c6354c95fa
commit
dde7183528
36 files changed
+216
-216
No files matched your search
@@ -1,4 +1,4 @@
|
||||
// Package config reads the per-host settings loomctl needs to talk to a git host.
|
||||
// Package config reads the per-host settings nornctl needs to talk to a git host.
|
||||
//
|
||||
// The config is not only a secret. It is how you talk to a host at all — which
|
||||
// is why it is a set of named contexts with one current, and why a host's URL
|
||||
@@ -24,7 +24,7 @@ type Context struct {
|
||||
Host string `json:"host"`
|
||||
// Flavor selects the URL shapes: gitea, github or gitlab. Empty means gitea.
|
||||
Flavor string `json:"flavor,omitempty"`
|
||||
// Token is read-only. loomctl never writes over the network, so a token it
|
||||
// Token is read-only. nornctl never writes over the network, so a token it
|
||||
// is given should not carry write scope.
|
||||
Token string `json:"token,omitempty"`
|
||||
}
|
||||
@@ -36,17 +36,17 @@ type Config struct {
|
||||
|
||||
// Path is where the config lives. Never inside a repository.
|
||||
func Path() string {
|
||||
if p := os.Getenv("LOOMCTL_CONFIG"); p != "" {
|
||||
if p := os.Getenv("NORNCTL_CONFIG"); p != "" {
|
||||
return p
|
||||
}
|
||||
home, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return filepath.Join(home, ".config", "loomctl", "config.json")
|
||||
return filepath.Join(home, ".config", "nornctl", "config.json")
|
||||
}
|
||||
|
||||
// Load reads the config. A missing file is not an error: everything loomctl
|
||||
// Load reads the config. A missing file is not an error: everything nornctl
|
||||
// does against a public repository works with no credential and no context.
|
||||
func Load() (*Config, error) {
|
||||
c := &Config{Contexts: map[string]Context{}}
|
||||
@@ -90,10 +90,10 @@ func (c *Config) Current() (Context, error) {
|
||||
// An environment variable wins over the file, so a token can be supplied for
|
||||
// one invocation without ever being written to disk.
|
||||
func (c *Config) TokenFor(host string) string {
|
||||
if t := os.Getenv("LOOMCTL_TOKEN_" + envKey(host)); t != "" {
|
||||
if t := os.Getenv("NORNCTL_TOKEN_" + envKey(host)); t != "" {
|
||||
return t
|
||||
}
|
||||
if t := os.Getenv("LOOMCTL_TOKEN"); t != "" {
|
||||
if t := os.Getenv("NORNCTL_TOKEN"); t != "" {
|
||||
return t
|
||||
}
|
||||
for _, ctx := range c.Contexts {
|
||||
|
||||
Vendored
+2
-2
@@ -9,13 +9,13 @@ import (
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"git.hypertheory-labs.dev/loom/loom-cli/internal/config"
|
||||
"git.hypertheory-labs.dev/norn/norn-cli/internal/config"
|
||||
)
|
||||
|
||||
// AddByName adopts a document named the way `list` prints it, against the
|
||||
// current context.
|
||||
//
|
||||
// loomctl external add loom/cart cart
|
||||
// nornctl external add norn/cart cart
|
||||
//
|
||||
// Nobody should have to type a host's raw-file route to adopt a document. The
|
||||
// route belongs to the host, so it lives in the context; the published
|
||||
|
||||
Vendored
+1
-1
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"git.hypertheory-labs.dev/loom/loom-cli/internal/lock"
|
||||
"git.hypertheory-labs.dev/norn/norn-cli/internal/lock"
|
||||
)
|
||||
|
||||
// auditExposure reports documents adopted from a source that could not be read
|
||||
|
||||
Vendored
+10
-10
@@ -19,26 +19,26 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.hypertheory-labs.dev/loom/loom-cli/internal/config"
|
||||
"git.hypertheory-labs.dev/loom/loom-cli/internal/lock"
|
||||
"git.hypertheory-labs.dev/norn/norn-cli/internal/config"
|
||||
"git.hypertheory-labs.dev/norn/norn-cli/internal/lock"
|
||||
)
|
||||
|
||||
var client = &http.Client{Timeout: 30 * time.Second}
|
||||
|
||||
// FindRoot walks up from dir looking for the .loom directory that marks a
|
||||
// repository using loom.
|
||||
// FindRoot walks up from dir looking for the .norn directory that marks a
|
||||
// repository using norn.
|
||||
func FindRoot(dir string) (string, error) {
|
||||
d, err := filepath.Abs(dir)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
for {
|
||||
if fi, err := os.Stat(filepath.Join(d, ".loom")); err == nil && fi.IsDir() {
|
||||
if fi, err := os.Stat(filepath.Join(d, ".norn")); err == nil && fi.IsDir() {
|
||||
return d, nil
|
||||
}
|
||||
parent := filepath.Dir(d)
|
||||
if parent == d {
|
||||
return "", errors.New("no .loom directory found in this directory or any parent")
|
||||
return "", errors.New("no .norn directory found in this directory or any parent")
|
||||
}
|
||||
d = parent
|
||||
}
|
||||
@@ -47,7 +47,7 @@ func FindRoot(dir string) (string, error) {
|
||||
// localPath derives where an adopted document is kept from the URL it came from.
|
||||
//
|
||||
// The path is for a person: <host>/<owner>/<repo>/<basename>. It deliberately
|
||||
// does not encode the route, the branch, or .loom/published/ — which is why it
|
||||
// does not encode the route, the branch, or .norn/published/ — which is why it
|
||||
// cannot be turned back into a URL, and why the lock records the origin.
|
||||
func localPath(raw string) (string, error) {
|
||||
u, err := url.Parse(raw)
|
||||
@@ -109,7 +109,7 @@ func Add(root, raw, override string, out io.Writer) error {
|
||||
_, isLocked := locks.Get(rel)
|
||||
|
||||
if isLocked {
|
||||
return fmt.Errorf("%s is already adopted — `loomctl external check` is what notices it moving", rel)
|
||||
return fmt.Errorf("%s is already adopted — `nornctl external check` is what notices it moving", rel)
|
||||
}
|
||||
|
||||
body, etag, err := fetch(cfg, raw, "")
|
||||
@@ -250,7 +250,7 @@ func warnIfNotPublic(root, raw, vis string, out io.Writer) {
|
||||
fmt.Fprintf(out, " readable than the repository you are adopting into.\n")
|
||||
fmt.Fprintf(out, " Two ways out: ask them to publish it — usually the thing you\n")
|
||||
fmt.Fprintf(out, " needed was not the confidential part — or keep no copy and\n")
|
||||
fmt.Fprintf(out, " record only the dependency, which loomctl cannot do yet.\n")
|
||||
fmt.Fprintf(out, " record only the dependency, which nornctl cannot do yet.\n")
|
||||
}
|
||||
|
||||
// NotFoundError is a 404, which over HTTP carries more than one reading.
|
||||
@@ -407,7 +407,7 @@ func checkUnlocked(cfg *config.Config, root, rel string, locks *lock.Set, open b
|
||||
// Without a lock we have no origin, and the path does not round-trip to a
|
||||
// URL, so there is nothing to ask and nowhere to ask it. Supplying the URL
|
||||
// through add is the only way out.
|
||||
return Status{rel, "unlocked", "no origin recorded — `loomctl external add <url>` supplies it without rewriting this copy"}, 0
|
||||
return Status{rel, "unlocked", "no origin recorded — `nornctl external add <url>` supplies it without rewriting this copy"}, 0
|
||||
}
|
||||
|
||||
func usagesNote(root, rel string) string {
|
||||
|
||||
Vendored
+7
-7
@@ -13,8 +13,8 @@ func TestLocalPath(t *testing.T) {
|
||||
}{
|
||||
{
|
||||
name: "gitea raw, published document",
|
||||
url: "https://git.hypertheory-labs.dev/loom/bedrock/raw/branch/main/.loom/published/starting.md",
|
||||
want: "git.hypertheory-labs.dev/loom/bedrock/starting.md",
|
||||
url: "https://git.hypertheory-labs.dev/norn/bedrock/raw/branch/main/.norn/published/starting.md",
|
||||
want: "git.hypertheory-labs.dev/norn/bedrock/starting.md",
|
||||
},
|
||||
{
|
||||
name: "github raw host",
|
||||
@@ -28,7 +28,7 @@ func TestLocalPath(t *testing.T) {
|
||||
},
|
||||
{
|
||||
name: "not absolute",
|
||||
url: "/loom/bedrock/starting.md",
|
||||
url: "/norn/bedrock/starting.md",
|
||||
wantErr: true,
|
||||
},
|
||||
} {
|
||||
@@ -54,13 +54,13 @@ func TestIsFacet(t *testing.T) {
|
||||
// A facet is something we wrote beside an adopted document. check must not
|
||||
// report our own writing as an unlocked external.
|
||||
facets := []string{
|
||||
"host/loom/cart/cart.usages.md",
|
||||
"host/loom/externals/externals.gaps.md",
|
||||
"host/norn/cart/cart.usages.md",
|
||||
"host/norn/externals/externals.gaps.md",
|
||||
"host/o/r/plan.notes.md",
|
||||
}
|
||||
documents := []string{
|
||||
"host/loom/cart/cart.md",
|
||||
"host/loom/bedrock/recording-decisions.md", // a hyphen is not a facet
|
||||
"host/norn/cart/cart.md",
|
||||
"host/norn/bedrock/recording-decisions.md", // a hyphen is not a facet
|
||||
"host/o/r/starting.md",
|
||||
}
|
||||
for _, p := range facets {
|
||||
|
||||
Vendored
+3
-3
@@ -8,13 +8,13 @@ import (
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"git.hypertheory-labs.dev/loom/loom-cli/internal/config"
|
||||
"git.hypertheory-labs.dev/norn/norn-cli/internal/config"
|
||||
)
|
||||
|
||||
// PublishedDir is the only directory in somebody else's repository that list
|
||||
// looks at. What is not exported is not hidden — it is simply not what you
|
||||
// depend on.
|
||||
const PublishedDir = ".loom/published"
|
||||
const PublishedDir = ".norn/published"
|
||||
|
||||
// List enumerates a publisher's published surface.
|
||||
//
|
||||
@@ -29,7 +29,7 @@ func List(repoURL string, out io.Writer) error {
|
||||
return err
|
||||
}
|
||||
|
||||
dir, err := os.MkdirTemp("", "loomctl-list-")
|
||||
dir, err := os.MkdirTemp("", "nornctl-list-")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -7,13 +7,13 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"git.hypertheory-labs.dev/loom/loom-cli/internal/lock"
|
||||
"git.hypertheory-labs.dev/norn/norn-cli/internal/lock"
|
||||
)
|
||||
|
||||
// CartDir is where a round happens. A cart is not committed — it lives in the
|
||||
// working tree of the machine the two presences share — so everything staged
|
||||
// here is deliberately outside version control.
|
||||
const CartDir = ".loom/cart/current"
|
||||
const CartDir = ".norn/cart/current"
|
||||
|
||||
// PoladDir is where a changed external waits for somebody to decide.
|
||||
//
|
||||
|
||||
Vendored
+1
-1
@@ -6,7 +6,7 @@ import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"git.hypertheory-labs.dev/loom/loom-cli/internal/lock"
|
||||
"git.hypertheory-labs.dev/norn/norn-cli/internal/lock"
|
||||
)
|
||||
|
||||
// apply used to write the staged record verbatim, and a staged record carried no
|
||||
|
||||
Vendored
+2
-2
@@ -7,8 +7,8 @@ func TestSplitRemote(t *testing.T) {
|
||||
remote, host, ownerRepo string
|
||||
ok bool
|
||||
}{
|
||||
{"ssh://git@git.hypertheory-labs.dev:2222/loom/loom-cli.git", "git.hypertheory-labs.dev", "loom/loom-cli", true},
|
||||
{"ssh://git@git.hypertheory-labs.dev/loom/loom-cli.git", "git.hypertheory-labs.dev", "loom/loom-cli", true},
|
||||
{"ssh://git@git.hypertheory-labs.dev:2222/norn/norn-cli.git", "git.hypertheory-labs.dev", "norn/norn-cli", true},
|
||||
{"ssh://git@git.hypertheory-labs.dev/norn/norn-cli.git", "git.hypertheory-labs.dev", "norn/norn-cli", true},
|
||||
{"git@github.com:octocat/Hello-World.git", "github.com", "octocat/Hello-World", true},
|
||||
{"https://gitlab.com/gitlab-org/gitlab-svgs.git", "gitlab.com", "gitlab-org/gitlab-svgs", true},
|
||||
{"https://gitlab.com/gitlab-org/gitlab-svgs", "gitlab.com", "gitlab-org/gitlab-svgs", true},
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// Package lock reads and writes .loom/externals/.locks.
|
||||
// Package lock reads and writes .norn/externals/.locks.
|
||||
//
|
||||
// One record per adopted document: where it was fetched from, resolved, and the
|
||||
// ETag the publisher served with it. The ETag is opaque and is never a hash we
|
||||
// compute — on gitea it happens to equal the git blob hash and on GitHub it does
|
||||
// not, so a design that compares a local hash to a remote ETag works on exactly
|
||||
// one host by coincidence. See .loom/event-log.md.
|
||||
// one host by coincidence. See .norn/event-log.md.
|
||||
package lock
|
||||
|
||||
import (
|
||||
@@ -19,12 +19,12 @@ import (
|
||||
)
|
||||
|
||||
// Dir is where adopted documents live, relative to the repository root.
|
||||
const Dir = ".loom/externals"
|
||||
const Dir = ".norn/externals"
|
||||
|
||||
// File is the lock file, inside Dir.
|
||||
const File = ".locks"
|
||||
|
||||
const header = "# loomctl locks — one record per adopted document.\n" +
|
||||
const header = "# nornctl locks — one record per adopted document.\n" +
|
||||
"# path<TAB>url<TAB>etag[<TAB>visibility]\n" +
|
||||
"# The url is resolved: a short form would follow whatever the default branch\n" +
|
||||
"# is at the time you ask. visibility is what the source could be read as when\n" +
|
||||
@@ -34,7 +34,7 @@ const header = "# loomctl locks — one record per adopted document.\n" +
|
||||
type Record struct {
|
||||
// Path is relative to Dir, and is for a person to read. The origin is the
|
||||
// URL: the path does not round-trip, because it drops the route, the
|
||||
// branch, and .loom/published/.
|
||||
// branch, and .norn/published/.
|
||||
Path string
|
||||
// URL is the resolved origin, branch and all.
|
||||
URL string
|
||||
|
||||
@@ -16,23 +16,23 @@ import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"git.hypertheory-labs.dev/loom/loom-cli/internal/lock"
|
||||
"git.hypertheory-labs.dev/norn/norn-cli/internal/lock"
|
||||
)
|
||||
|
||||
// File is where the orientation lives, relative to the repository root.
|
||||
//
|
||||
// Beside .loom/event-log.md rather than inside .loom/externals/, because
|
||||
// Beside .norn/event-log.md rather than inside .norn/externals/, because
|
||||
// everything in that directory is somebody else's document — which is what makes
|
||||
// "do not edit these" a rule you can state in four words — and because `check`
|
||||
// walks it and would report a generated file as an unlocked external forever.
|
||||
const File = ".loom/orientation.md"
|
||||
const File = ".norn/orientation.md"
|
||||
|
||||
const preamble = `<!-- Generated by ` + "`loomctl orient`" + `. Safe to overwrite; nobody typed it.
|
||||
const preamble = `<!-- Generated by ` + "`nornctl orient`" + `. Safe to overwrite; nobody typed it.
|
||||
Regenerate after adopting a document or reconciling a change. -->
|
||||
|
||||
# What this repository depends on
|
||||
|
||||
Copies of other people's documents are kept under ` + "`.loom/externals/`" + `, at a path
|
||||
Copies of other people's documents are kept under ` + "`.norn/externals/`" + `, at a path
|
||||
that says where each came from. **They are copies: do not edit them.** Anything
|
||||
you want to say about one goes in a file *beside* it, never into it.
|
||||
|
||||
@@ -41,8 +41,8 @@ Three moves, and each has a document that owns the rule:
|
||||
- **A copy is wrong, or you needed something it does not say** — write it in
|
||||
` + "`<name>.gaps.md`" + ` beside the copy.
|
||||
- **What of ours depends on a copy** — write it in ` + "`<name>.usages.md`" + ` beside it.
|
||||
- **A source changed** — ` + "`loomctl external check`" + ` says so and stages the new copy;
|
||||
` + "`loomctl external apply`" + ` takes it. Neither edits anything on its own.
|
||||
- **A source changed** — ` + "`nornctl external check`" + ` says so and stages the new copy;
|
||||
` + "`nornctl external apply`" + ` takes it. Neither edits anything on its own.
|
||||
`
|
||||
|
||||
// Generate writes the orientation for the repository at root.
|
||||
@@ -72,9 +72,9 @@ func Generate(root, out string) (string, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if dir := filepath.Join(root, ".loom", "published"); isDir(dir) {
|
||||
if dir := filepath.Join(root, ".norn", "published"); isDir(dir) {
|
||||
b.WriteString("\n## This repository publishes\n\n")
|
||||
b.WriteString("See `.loom/published/`. What is handed over for others to depend on is\n")
|
||||
b.WriteString("See `.norn/published/`. What is handed over for others to depend on is\n")
|
||||
b.WriteString("there; the rest of the repository is not hidden, it is simply not what\n")
|
||||
b.WriteString("anybody depends on.\n")
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"git.hypertheory-labs.dev/loom/loom-cli/internal/lock"
|
||||
"git.hypertheory-labs.dev/norn/norn-cli/internal/lock"
|
||||
)
|
||||
|
||||
// A generated file that churns produces diffs nobody reads, and the diff is most
|
||||
@@ -51,7 +51,7 @@ func TestGenerateIsDeterministic(t *testing.T) {
|
||||
t.Error("entries are not ordered by path")
|
||||
}
|
||||
if strings.Contains(first, "publishes") {
|
||||
t.Error("claimed the repository publishes with no .loom/published")
|
||||
t.Error("claimed the repository publishes with no .norn/published")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user