Files
paperclip-harness/bin/shell-banner

54 lines
2.0 KiB
Python
Executable File

#!/usr/bin/env python3
"""Print where a project's files are, then the shell takes over.
Shown in Shell>shell when it opens, because the first question there is always
"where am I". It reads the project's own file and nothing else.
"""
import os
import sys
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "lib"))
import project as pj
def main():
folder = os.path.abspath(sys.argv[1] if len(sys.argv) > 1 else os.getcwd())
cfg = pj.load(folder)
home = os.path.expanduser("~")
rows = [
("project folder", folder),
("task worktrees", os.path.join(folder, ".paperclip", "worktrees")),
("this project's file", pj.path(folder)),
("harness commands", os.path.join(os.path.dirname(os.path.abspath(__file__)))),
("pi conversations", os.path.join(home, ".pi", "paperclips")),
("pi skills you own", os.path.join(home, ".agents", "skills")),
("paperclip data", os.path.join(home, ".paperclip", "instances", "default")),
("session", cfg.get("session", "")),
("watching", cfg.get("watching", "")),
]
inner = 70
label = max(len(k) for k, _ in rows) + 2
print("┌─ where things are " + "─" * (inner - 19) + "┐")
for k, v in rows:
room = inner - label - 2
if len(v) > room:
v = v[: room - 1] + "…"
line = " " + k.ljust(label) + v
print("│" + line.ljust(inner) + "│")
print("└" + "─" * inner + "┘")
print("""
the panes are the normal way to work. this shell is for the commands we do not wrap:
bin/merge <TASK> checks and merges one task (the Merge tab in Work>work does this)
bin/review <TASK> the review on its own
bin/board rebuild or repair the panes (or press R in Repair>repair)
bin/office <folder> adopt another folder as a project
""")
if __name__ == "__main__":
try:
main()
except Exception as exc: # a banner must never stop the shell opening
print("(no project file here: %s)" % exc)