@andespindola/crow-skills 0.19.0 → 0.19.1

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.
@@ -1,3 +1,3 @@
1
1
  """Portable, local-first installer for the crow-skills catalogue."""
2
2
 
3
- __version__ = "0.19.0"
3
+ __version__ = "0.19.1"
@@ -352,6 +352,14 @@ def edit_paths(host, tool, tool_input, cwd):
352
352
  GIT_WORD = re.compile(r"^(?:\S*/)?git$")
353
353
  DIR_WORD = re.compile(r"(?:^|[\s;&|()])(?:cd|[^\s;&|()]*/?git)(?:\s|$)")
354
354
  TREE_SUBCOMMANDS = ("checkout", "switch", "rebase", "stash", "merge", "pull", "cherry-pick", "bisect", "restore", "clean")
355
+ # A git call is not by itself a sign of working in a clone: `git log`, `git status` and `git diff`
356
+ # are reading. Measured right after shipping occupancy(): a peer session that only INSPECTED two
357
+ # clones was still published as occupying them, because any git verb marked the clone as driven.
358
+ # Everything outside this list keeps marking occupancy, so an unknown verb errs toward warning.
359
+ READ_SUBCOMMANDS = ("log", "status", "diff", "show", "rev-parse", "rev-list", "ls-tree", "ls-files",
360
+ "ls-remote", "cat-file", "describe", "blame", "shortlog", "for-each-ref",
361
+ "name-rev", "merge-base", "symbolic-ref", "whatchanged", "grep", "count-objects",
362
+ "check-ignore", "verify-commit", "verify-tag", "var", "help", "version")
355
363
 
356
364
 
357
365
  def tree_command(host, tool, tool_input, cwd=None):
@@ -423,7 +431,7 @@ def _note(visited, directory, source="cd"):
423
431
  if visited is None or not directory or not directory.startswith("/"):
424
432
  return
425
433
  if directory in visited:
426
- if source == "git":
434
+ if source == "git": # working outranks reading and the incidental cd
427
435
  visited[directory] = "git"
428
436
  return
429
437
  if len(visited) < MAX_PATTERNS:
@@ -488,7 +496,8 @@ def _segment(words, here, targets, depth=0, visited=None):
488
496
  if i >= len(words):
489
497
  return here
490
498
  sub, rest = words[i], words[i + 1:]
491
- _note(visited, directory, "git") # any git call names the clone the session is working in
499
+ # "git" means the session WORKS in that clone; a read-only verb means it only looked.
500
+ _note(visited, directory, "read" if sub in READ_SUBCOMMANDS else "git")
492
501
  if sub in TREE_SUBCOMMANDS or (sub == "reset" and "--hard" in rest):
493
502
  if directory and directory not in targets:
494
503
  targets.append(directory)
@@ -703,14 +712,21 @@ def fold(snap, event, touched=(), now=None, ppid=None, cli_pid=None, tty_runner=
703
712
  repos = [r for r in repos if r["root"] != found["root"]]
704
713
  entry = {"id": found["id"], "root": found["root"], "ts": now_iso(now),
705
714
  "hits": int((previous or {}).get("hits") or 0) + 1}
706
- if (previous or {}).get("driven") or (isinstance(dirs, dict) and dirs.get(directory) == "git"):
715
+ source = dirs.get(directory) if isinstance(dirs, dict) else None
716
+ # TWO different questions about the same clone. `driven`: a git call named it, which is a
717
+ # stronger signal than an incidental `cd` and wins the eviction contest — a `git log` counts.
718
+ # `working`: the verb CHANGES something there, which is what occupancy() may warn about.
719
+ if (previous or {}).get("driven") or source in ("git", "read"):
707
720
  entry["driven"] = True
721
+ if (previous or {}).get("working") or source == "git":
722
+ entry["working"] = True
708
723
  repos.append(entry)
709
724
  if repos or presence.get("repos") is not None:
710
725
  # Eviction is not FIFO: a clone a git command actually drove, and one visited many times,
711
726
  # outrank the incidental `cd` that would otherwise push it out of the eight slots.
712
- keep = sorted(repos, key=lambda r: (bool(r.get("driven")), int(r.get("hits") or 0),
713
- parse_time(r.get("ts")) or 0), reverse=True)[:MAX_REPOS]
727
+ keep = sorted(repos, key=lambda r: (bool(r.get("working")), bool(r.get("driven")),
728
+ int(r.get("hits") or 0), parse_time(r.get("ts")) or 0),
729
+ reverse=True)[:MAX_REPOS]
714
730
  presence["repos"] = [r for r in repos if r in keep]
715
731
  snap["presence"] = presence
716
732
  return snap
@@ -929,8 +945,8 @@ def occupancy(snap, now=None, window=None):
929
945
  ids.add(repo["id"])
930
946
  if repo.get("root"):
931
947
  roots.add(repo["root"])
932
- for entry in presence.get("repos") or []: # only the clones a git command drove
933
- if not isinstance(entry, dict) or not entry.get("driven"):
948
+ for entry in presence.get("repos") or []: # only the clones a WRITING git command drove
949
+ if not isinstance(entry, dict) or not entry.get("working"):
934
950
  continue
935
951
  if now - (parse_time(entry.get("ts")) or 0) > window:
936
952
  continue
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andespindola/crow-skills",
3
- "version": "0.19.0",
3
+ "version": "0.19.1",
4
4
  "description": "Versioned, complementary agent skills with a protected multi-agent installer",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
package/release.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "crow_skills/__init__.py": {
19
19
  "executable": false,
20
20
  "kind": "file",
21
- "sha256": "7720abacfffca6315ecfee7b1dfced20c3c6e7387f00113ce2c437ed63f8e0bc"
21
+ "sha256": "0fac3e997aef5911a1a83e61ec8abc3b92abc0e02cdff187a430b3277e40b80f"
22
22
  },
23
23
  "crow_skills/__main__.py": {
24
24
  "executable": false,
@@ -38,7 +38,7 @@
38
38
  "crow_skills/broadcast.py": {
39
39
  "executable": false,
40
40
  "kind": "file",
41
- "sha256": "998cdd9bc67d52e63dfcde5528c5caaa04c509ec6e1e7d6afb298c8bcf4a442f"
41
+ "sha256": "135fb80925dea8e6c0790ee830c6b7e440cc5c0f116a4c9dcc4cf36bab1c22e3"
42
42
  },
43
43
  "crow_skills/cli.py": {
44
44
  "executable": false,
@@ -128,7 +128,7 @@
128
128
  "package.json": {
129
129
  "executable": false,
130
130
  "kind": "file",
131
- "sha256": "b70074096ec8ed3994a6cff3eeb2b72885ec366d01269f9006d0e492fccf649a"
131
+ "sha256": "25d9d44e380c13b64264f33b18d0b722a1b465c693fd92d819581b78df7f6fb8"
132
132
  },
133
133
  "skills/crow-accessibility/SKILL.md": {
134
134
  "executable": false,
@@ -721,7 +721,7 @@
721
721
  "sha256": "e37132ef8b060548191fbf14a5a18a9dd3acd84ea9a35e802174455b9e374d3d"
722
722
  }
723
723
  },
724
- "revision": "9c7d5fe418c5c993eef7df75790263b3c77d400d",
724
+ "revision": "2a8fb8a28c5b1073fd5faea2da0e2b4fe631fab7",
725
725
  "schema_version": 1,
726
- "version": "0.19.0"
726
+ "version": "0.19.1"
727
727
  }