Module: Textus::Layout

Defined in:
lib/textus/layout.rb

Overview

Single source of truth for every path textus owns under a store root. All disposable runtime state nests under <root>/.run/ so the tracked/disposable boundary is a directory boundary. ADR 0038.

Constant Summary collapse

RUN =
".run"
GITIGNORE =

Back-compat constant: the no-untracked-entries body (just the run subtree).

gitignore_body

Class Method Summary collapse

Class Method Details

.audit_dir(root) ⇒ Object



28
29
30
# File 'lib/textus/layout.rb', line 28

def self.audit_dir(root)
  File.join(run(root), "audit")
end

.audit_log(root) ⇒ Object



32
33
34
# File 'lib/textus/layout.rb', line 32

def self.audit_log(root)
  File.join(audit_dir(root), "audit.log")
end

.build_lock(root) ⇒ Object



24
25
26
# File 'lib/textus/layout.rb', line 24

def self.build_lock(root)
  File.join(run(root), "build.lock")
end

.cursor(root, role) ⇒ Object



16
17
18
# File 'lib/textus/layout.rb', line 16

def self.cursor(root, role)
  File.join(state(root), "cursor.#{role}")
end

.gitignore_body(untracked_paths: []) ⇒ Object

The store’s ‘.gitignore` body. Always ignores the runtime subtree (`.run/`, ADR 0038); when given untracked entry paths (entries marked `tracked: false`), it also lists those so they stay protocol-readable but uncommitted (ADR 0043, refining 0038). Generated, never hand-kept — no drift between the manifest and the ignore file.



41
42
43
44
45
46
47
48
49
# File 'lib/textus/layout.rb', line 41

def self.gitignore_body(untracked_paths: [])
  lines = ["# textus runtime artifacts — safe to delete, never commit",
           "#{RUN}/"]
  unless untracked_paths.empty?
    lines << "# tracked:false entries — protocol-readable, not committed (sensitive)"
    lines.concat(untracked_paths)
  end
  "#{lines.join("\n")}\n"
end

.locks(root) ⇒ Object



20
21
22
# File 'lib/textus/layout.rb', line 20

def self.locks(root)
  File.join(run(root), "locks")
end

.run(root) ⇒ Object



8
9
10
# File 'lib/textus/layout.rb', line 8

def self.run(root)
  File.join(root, RUN)
end

.state(root) ⇒ Object



12
13
14
# File 'lib/textus/layout.rb', line 12

def self.state(root)
  File.join(run(root), "state")
end