lab-kit-cli 1.8.0__tar.gz → 1.9.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/CHANGELOG.md +7 -0
  2. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/PKG-INFO +1 -1
  3. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/docs/model.md +7 -1
  4. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/pyproject.toml +1 -1
  5. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/src/lab_kit/__init__.py +1 -1
  6. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/src/lab_kit/site.py +55 -1
  7. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/tests/test_site.py +26 -0
  8. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/.github/workflows/ci.yml +0 -0
  9. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/.github/workflows/policy.yml +0 -0
  10. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/.github/workflows/release.yml +0 -0
  11. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/.gitignore +0 -0
  12. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/AGENTS.md +0 -0
  13. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/CLAUDE.md +0 -0
  14. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/CONTRIBUTING.md +0 -0
  15. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/LICENSE +0 -0
  16. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/README.md +0 -0
  17. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/agents/reviewer.md +0 -0
  18. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/method/METHOD.md +0 -0
  19. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/skills/lab-mission/SKILL.md +0 -0
  20. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/skills/lab-review/SKILL.md +0 -0
  21. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/skills/lab-set-up/SKILL.md +0 -0
  22. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/skills/lab-talk/SKILL.md +0 -0
  23. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/skills/lab-work/SKILL.md +0 -0
  24. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/src/lab_kit/checks.py +0 -0
  25. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/src/lab_kit/cli.py +0 -0
  26. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/src/lab_kit/history.py +0 -0
  27. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/src/lab_kit/record.py +0 -0
  28. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/src/lab_kit/runs.py +0 -0
  29. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/src/lab_kit/supervise.py +0 -0
  30. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/src/lab_kit/views.py +0 -0
  31. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/src/lab_kit/write.py +0 -0
  32. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/tests/test_flow.py +0 -0
  33. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/tests/test_held.py +0 -0
  34. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/tests/test_integrity.py +0 -0
  35. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/tests/test_mission.py +0 -0
  36. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/tests/test_needs.py +0 -0
  37. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/tests/test_order.py +0 -0
  38. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/tests/test_parked.py +0 -0
  39. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/tests/test_refusals.py +0 -0
  40. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/tests/test_states.py +0 -0
  41. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/tests/test_vocabulary.py +0 -0
  42. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/tests/test_wording.py +0 -0
  43. {lab_kit_cli-1.8.0 → lab_kit_cli-1.9.0}/tools/import_run.py +0 -0
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.0
4
+
5
+ - **A Missions page** on the site, compact like Decisions: the current first, then the next, then the closed.
6
+ Each mission shows its status mark, the decision it carries, what it is for, its steps as marks with how many
7
+ are closed, its last log line, and its rules and log folded. The rail lists the page with how many are current,
8
+ and Now's mission line links to it.
9
+
3
10
  ## 1.8.0
4
11
 
5
12
  - **A question with nothing left under it is the agent's next step.** `lab now` ("Yours next") and Now's "Next for
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: lab-kit-cli
3
- Version: 1.8.0
3
+ Version: 1.9.0
4
4
  Summary: A research lab's record, its method, and the command that keeps both.
5
5
  Project-URL: Homepage, https://github.com/pierg/lab-kit
6
6
  Project-URL: Issues, https://github.com/pierg/lab-kit/issues
@@ -481,7 +481,13 @@ A folder is named after its card's title, so a short title gives a short path.
481
481
  ## 7. The site
482
482
 
483
483
  Now (the dashboard), a page per goal, question, experiment, build, reading and decision, Decisions,
484
- Log, Resources, Glossary. Every page has the copy-path control.
484
+ Missions (when the lab has any), Log, Resources, Glossary. Every page has the copy-path control.
485
+
486
+ **Missions** lists every mission compactly, as Decisions lists decisions: the current first, then the next,
487
+ then the closed, the latest first. Each shows its status as a mark, the decision it carries, what it is for,
488
+ the steps its decision orders as one mark each with how many are closed, its last log line, and its rules
489
+ and whole log folded. The rail names the page, with how many missions are current; Now's mission line
490
+ links to it.
485
491
 
486
492
  **The rail** on the left of every page is the lab as a tree: each goal, its questions under it, and
487
493
  each question's steps under that. A row shows a mark for its type (G, Q, E, B, R), its short id, its
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
5
5
  [project]
6
6
  dynamic = ["readme"]
7
7
  name = "lab-kit-cli"
8
- version = "1.8.0"
8
+ version = "1.9.0"
9
9
  description = "A research lab's record, its method, and the command that keeps both."
10
10
  license = "MIT"
11
11
  authors = [{ name = "Piergiuseppe Mallozzi" }]
@@ -1,2 +1,2 @@
1
1
  """lab-kit: a research lab's record, its method, and the command that keeps both."""
2
- __version__ = "1.8.0"
2
+ __version__ = "1.9.0"
@@ -166,6 +166,54 @@ def header_css():
166
166
  return "".join(out)
167
167
 
168
168
 
169
+ # A mission's status reads as a card's state: next as open, current as running, done as done, stopped as dropped.
170
+ MISSION_KEY = {"next": "open", "current": "running", "done": "done", "stopped": "dropped"}
171
+
172
+
173
+ def mission_mark(m):
174
+ return mark(MISSION_KEY.get(m["state"], "open"), m["state"])
175
+
176
+
177
+ def mission_box(lab, T, m):
178
+ """One mission, compact: what it carries and where it stands, its steps as marks, its last line, and its log folded."""
179
+ d = lab.nodes.get(m["carries"])
180
+ carries = named(lab, d["id"]) if d and d["type"] == "decision" else '<span class="muted">no decision: lab check says why</span>'
181
+ started = next((l for l in m["log"] if l.get("what") == "launched"), None)
182
+ head = (f'{e(m["id"])} · {mission_mark(m)} {e(m["state"])} · carries {carries}'
183
+ + (f' · launched {nice(started["day"])}' if started else ""))
184
+ rows = []
185
+ if L.flat(m["description"]):
186
+ rows.append(("For", T(L.flat(m["description"]))))
187
+ steps = lab.mission_steps(m)
188
+ if steps:
189
+ done = sum(x["state"] in L.CLOSED for x in steps)
190
+ rows.append(("Steps", f'{done} of {len(steps)} closed <span class="marks">' + "".join(dot(x, f'{x["id"]} {x["title"]}: {label(x)}') for x in steps) + "</span>"))
191
+ lines = [l for l in m["log"] if l.get("what")]
192
+ if lines:
193
+ last = lines[-1]
194
+ rows.append(("Last", f'<span class="muted">{nice(last["day"])} {e(last["time"])}</span> {T(last["what"])}'))
195
+ if L.flat(m["slots"].get("Rules", "")):
196
+ rows.append(("Rules", f'<details><summary>the rules of this mission</summary>{block(T, m["slots"]["Rules"])}</details>'))
197
+ if len(lines) > 1:
198
+ rows.append(("Log", f'<details><summary>{len(lines)} lines</summary><ul class="mlog">'
199
+ + "".join(f'<li><span class="muted">{nice(l["day"])} {e(l["time"])}</span> {T(l["what"])}</li>' for l in lines) + "</ul></details>"))
200
+ return (f'<div class="box mission m-{e(m["state"])}" id="{e(m["id"])}"><div class="decisionhead">{head}</div>'
201
+ f'<p class="decisionq">{e(m["title"] or m["path"])}</p>'
202
+ '<dl class="decisionrows">' + "".join(f"<dt>{k}</dt><dd>{v}</dd>" for k, v in rows) + "</dl></div>")
203
+
204
+
205
+ def missions_page(lab, T):
206
+ """Every mission: the current first, then the next, then the closed, the latest first."""
207
+ body = ["<h1>Missions</h1>", '<p class="lead">A mission carries out a settled decision across sessions: its rules, and a log a later session resumes from.</p>']
208
+ closed = sorted([m for m in lab.missions if m["state"] in ("done", "stopped")], key=lambda m: m["n"], reverse=True)
209
+ for title, group in (("Current", [m for m in lab.missions if m["state"] == "current"]), ("Next", [m for m in lab.missions if m["state"] == "next"]), ("Closed", closed)):
210
+ if group:
211
+ body.append(f"<h2>{title}</h2>" + "".join(mission_box(lab, T, m) for m in group))
212
+ if not lab.missions:
213
+ body.append('<p class="muted">None yet.</p>')
214
+ return frame(lab, "Missions", "".join(body))
215
+
216
+
169
217
  def libraries(lab):
170
218
  """The other libraries this lab's charter names, each with where it is on disk and where it is served."""
171
219
  if not hasattr(lab, "_libraries"):
@@ -325,6 +373,8 @@ CSS = """
325
373
  .lv .slot p+p{margin-top:.5rem}
326
374
  .lv .box{background:var(--surface);border:1px solid var(--rule);border-radius:8px;padding:.9rem 1.1rem;margin:0 0 1rem}
327
375
  .lv .box.decision{border-left:3px solid var(--warn);background:var(--warn-soft);margin:0 0 .8rem}
376
+ .lv .box.mission{border-left:3px solid var(--rule-strong);margin:0 0 .8rem}.lv .box.mission.m-current{border-left-color:var(--info);background:var(--info-soft)}
377
+ .lv .box.mission .marks{margin-left:.4rem}.lv .mlog{margin:.3rem 0 0;padding-left:1.1rem;font-size:.86rem}.lv .box.mission summary{cursor:pointer;color:var(--ink-3);font-size:.86rem}
328
378
  .lv .box.decision.closed{border-left-color:var(--ok);background:var(--ok-soft)}
329
379
  .lv .decisionhead{font:500 .78rem var(--sans);color:var(--muted);margin:0 0 .3rem}
330
380
  .lv .decisionq{font-size:1.08rem;line-height:1.45;margin:0 0 .6rem;font-weight:600}
@@ -890,7 +940,7 @@ def live_box(lab, T):
890
940
  + (f' on {e(", ".join(x["uses"]))}' if x["uses"] else "") + ".</p>")
891
941
  for m in [m for m in lab.missions if m["state"] == "current"]:
892
942
  last = next((l for l in reversed(m["log"]) if l.get("what")), None)
893
- rows.append(f'<p><span class="who">mission</span>{mark("running")} {e(m["id"])} {e(m["title"])}'
943
+ rows.append(f'<p><span class="who">mission</span>{mark("running")} <a href="/missions#{e(m["id"])}">{e(m["id"])} {e(m["title"])}</a>'
894
944
  + (f' <span class="muted">last, {nice(last["day"])} {e(last["time"])}: {T(last["what"])}</span>' if last else "") + "</p>")
895
945
  d = lab.doing()
896
946
  if d:
@@ -1443,6 +1493,8 @@ class Provider:
1443
1493
  page, path = log_page(lab, T, parts[1] if len(parts) == 2 else ""), "log.md"
1444
1494
  elif inner == "decisions":
1445
1495
  page = decisions_page(lab, T)
1496
+ elif inner == "missions":
1497
+ page = missions_page(lab, T)
1446
1498
  elif inner == "resources":
1447
1499
  page, path = resources_page(lab, T), "resources.toml"
1448
1500
  elif inner == "glossary":
@@ -1479,6 +1531,8 @@ class Provider:
1479
1531
 
1480
1532
  talk = len(lab.open_decisions())
1481
1533
  out = [{"title": "Now", "url": "/lab/"}, {"title": "Decisions", "url": "/lab/decisions/", **({"status": f"{talk} to discuss", "tone": "warn"} if talk else {})}]
1534
+ current = sum(m["state"] == "current" for m in lab.missions)
1535
+ out += [{"title": "Missions", "url": "/lab/missions/", **({"status": f"{current} current", "tone": "info"} if current else {})}] if lab.missions else []
1482
1536
  out += [{"title": t, "url": f"/lab/{p}"} for t, p in (("Log", "log/"), ("Resources", "resources/"), ("Glossary", "glossary/"))]
1483
1537
  for g in lab.live(lab.goals):
1484
1538
  questions, under = [], []
@@ -460,3 +460,29 @@ def test_every_state_has_one_mark_on_every_page_and_an_answer_is_a_boxed_word(tm
460
460
  assert S.key(busy) == "running" and "G1.Q1.2 running" in S.dot(busy) and " live" in S.dot(busy) # a question with a running step pulses
461
461
  assert S.key({"type": "goal", "state": "open", "questions": [busy]}) == "running"
462
462
  assert S.key({**busy, "state": "parked"}) == "parked"
463
+
464
+
465
+ def test_missions_have_a_compact_page_like_decisions_and_a_line_in_the_rail(tmp_path):
466
+ from test_flow import open_question
467
+ from test_order import order, three_steps
468
+ from test_mission import saved
469
+ root = str(tmp_path)
470
+ open_question(root)
471
+ three_steps(root)
472
+ card, d2 = order(root, ["G1.Q2.2", "G1.Q1", "G1.Q2"])
473
+ site = Provider(root)
474
+ assert all(r["title"] != "Missions" for r in site.rail()) # no mission yet: no page in the rail
475
+ saved(root, "The weight first", d2)
476
+ lab(root, "decide", d2, "--with", "Ada", "The weight on heads first.")
477
+ lab(root, "mission", "launch")
478
+ lab(root, "mission", "log", "started G1.Q2.2 in its own session")
479
+ site = Provider(root)
480
+ entry = next(r for r in site.rail() if r["title"] == "Missions")
481
+ assert entry["url"] == "/lab/missions/" and entry["status"] == "1 current"
482
+ page = site.get("missions").main
483
+ assert 'id="M1"' in page and "The weight first" in page and "Current" in page and f'href="/lab/{d2}/"' in page
484
+ assert re.search(r"\d of \d closed", page) and "in its own session</li>" in page and "<details>" in page
485
+ assert 'href="/lab/missions/#M1"' in site.get("").main # Now's mission line links to it
486
+ lab(root, "mission", "close", "M1", "Done for now.")
487
+ page = Provider(root).get("missions").main
488
+ assert "Closed" in page and "Current" not in page and "1 current" not in str(Provider(root).rail())
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes