helix-layer 4.3.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 (42) hide show
  1. helix_layer-4.3.0/LICENSE +1 -0
  2. helix_layer-4.3.0/PKG-INFO +68 -0
  3. helix_layer-4.3.0/README.md +42 -0
  4. helix_layer-4.3.0/helix_layer/__init__.py +1 -0
  5. helix_layer-4.3.0/helix_layer/auto.py +120 -0
  6. helix_layer-4.3.0/helix_layer/checks.py +74 -0
  7. helix_layer-4.3.0/helix_layer/cli.py +633 -0
  8. helix_layer-4.3.0/helix_layer/config.py +101 -0
  9. helix_layer-4.3.0/helix_layer/connectors/__init__.py +41 -0
  10. helix_layer-4.3.0/helix_layer/connectors/azure.py +210 -0
  11. helix_layer-4.3.0/helix_layer/connectors/base.py +150 -0
  12. helix_layer-4.3.0/helix_layer/connectors/github.py +120 -0
  13. helix_layer-4.3.0/helix_layer/connectors/jira.py +114 -0
  14. helix_layer-4.3.0/helix_layer/connectors/linear.py +93 -0
  15. helix_layer-4.3.0/helix_layer/git.py +64 -0
  16. helix_layer-4.3.0/helix_layer/memory.py +312 -0
  17. helix_layer-4.3.0/helix_layer/pipeline.py +202 -0
  18. helix_layer-4.3.0/helix_layer/prompt.py +120 -0
  19. helix_layer-4.3.0/helix_layer/review.py +73 -0
  20. helix_layer-4.3.0/helix_layer/runner.py +165 -0
  21. helix_layer-4.3.0/helix_layer/selftest.py +143 -0
  22. helix_layer-4.3.0/helix_layer/templates/CLAUDE.md +17 -0
  23. helix_layer-4.3.0/helix_layer/templates/claude/agents/explorer.md +8 -0
  24. helix_layer-4.3.0/helix_layer/templates/claude/agents/reviewer.md +8 -0
  25. helix_layer-4.3.0/helix_layer/templates/claude/commands/fix.md +9 -0
  26. helix_layer-4.3.0/helix_layer/templates/claude/commands/review.md +4 -0
  27. helix_layer-4.3.0/helix_layer/templates/claude/settings.json +63 -0
  28. helix_layer-4.3.0/helix_layer/templates/config.toml +27 -0
  29. helix_layer-4.3.0/helix_layer/usage.py +162 -0
  30. helix_layer-4.3.0/helix_layer.egg-info/PKG-INFO +68 -0
  31. helix_layer-4.3.0/helix_layer.egg-info/SOURCES.txt +40 -0
  32. helix_layer-4.3.0/helix_layer.egg-info/dependency_links.txt +1 -0
  33. helix_layer-4.3.0/helix_layer.egg-info/entry_points.txt +2 -0
  34. helix_layer-4.3.0/helix_layer.egg-info/requires.txt +8 -0
  35. helix_layer-4.3.0/helix_layer.egg-info/top_level.txt +1 -0
  36. helix_layer-4.3.0/pyproject.toml +39 -0
  37. helix_layer-4.3.0/setup.cfg +4 -0
  38. helix_layer-4.3.0/tests/test_auto.py +96 -0
  39. helix_layer-4.3.0/tests/test_connectors.py +217 -0
  40. helix_layer-4.3.0/tests/test_flow.py +103 -0
  41. helix_layer-4.3.0/tests/test_selftest.py +41 -0
  42. helix_layer-4.3.0/tests/test_usage_hook.py +62 -0
@@ -0,0 +1 @@
1
+ MIT License - Copyright (c) 2026 Vijay Arther
@@ -0,0 +1,68 @@
1
+ Metadata-Version: 2.4
2
+ Name: helix-layer
3
+ Version: 4.3.0
4
+ Summary: Tickets or plain words in, tested PRs out - a token-lean layer over Claude Code
5
+ Author: Vijay Arther
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/Arther100/jessie-ai
8
+ Project-URL: Issues, https://github.com/Arther100/jessie-ai/issues
9
+ Keywords: claude,claude-code,ai,azure-devops,jira,github,pull-request,testing
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Software Development :: Quality Assurance
16
+ Classifier: Topic :: Software Development :: Testing
17
+ Requires-Python: >=3.10
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: typer>=0.12
21
+ Requires-Dist: httpx>=0.27
22
+ Requires-Dist: tomli>=2; python_version < "3.11"
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest>=8; extra == "dev"
25
+ Dynamic: license-file
26
+
27
+ # helix-layer
28
+
29
+ **Helix**: tickets or plain words in, tested pull requests out. A token-lean layer over [Claude Code](https://docs.claude.com/en/docs/claude-code/overview), running on each developer's own Claude login.
30
+
31
+ ```
32
+ pip install helix-layer
33
+ helix setup # once per computer: your email, optional team server
34
+ helix init # once per repo: Claude hooks, rules, project map
35
+ helix doctor # checks Claude Code, tracker, repo host
36
+ ```
37
+
38
+ Then type in the Claude chat as usual, for example `fix ticket 4821` or `login crashes on empty email`. Helix's Claude Code hooks add:
39
+ - the ticket text
40
+ - ranked start-here files
41
+ - past-bug rules
42
+ - test-first steps
43
+
44
+ They also run your checks before Claude stops. Claude finishes with `helix ship`, which commits, pushes, opens the PR and updates the ticket.
45
+
46
+ **Commands:**
47
+
48
+ | Command | What it does |
49
+ |---|---|
50
+ | `helix do <ticket or words>` | Headless run, ending in a PR |
51
+ | `helix fix` | Fix a bug: failing test first, then fix |
52
+ | `helix ask` | Ask a question about the code |
53
+ | `helix test` | Write tests |
54
+ | `helix ci` | Fix a failed pipeline |
55
+ | `helix review`, `helix review-pr` | Review a branch or a PR |
56
+ | `helix tickets`, `helix prs` | List your tickets or open PRs |
57
+ | `helix usage report` | Per-member token report, weekly or monthly |
58
+ | `helix lessons list` | Lessons saved from past fixes |
59
+ | `helix selftest` | Runs every flow on a throwaway repo |
60
+
61
+ **Connectors:**
62
+ - Trackers: Azure Boards, GitHub Issues, Jira, Linear
63
+ - Repos: Azure Repos, GitHub
64
+ - CI: Azure Pipelines, GitHub Actions
65
+
66
+ VS Code extension: search **"Helix: Tickets to Tested PRs"** in the Extensions view.
67
+
68
+ Helix is an independent project. It is not made, endorsed or supported by Anthropic.
@@ -0,0 +1,42 @@
1
+ # helix-layer
2
+
3
+ **Helix**: tickets or plain words in, tested pull requests out. A token-lean layer over [Claude Code](https://docs.claude.com/en/docs/claude-code/overview), running on each developer's own Claude login.
4
+
5
+ ```
6
+ pip install helix-layer
7
+ helix setup # once per computer: your email, optional team server
8
+ helix init # once per repo: Claude hooks, rules, project map
9
+ helix doctor # checks Claude Code, tracker, repo host
10
+ ```
11
+
12
+ Then type in the Claude chat as usual, for example `fix ticket 4821` or `login crashes on empty email`. Helix's Claude Code hooks add:
13
+ - the ticket text
14
+ - ranked start-here files
15
+ - past-bug rules
16
+ - test-first steps
17
+
18
+ They also run your checks before Claude stops. Claude finishes with `helix ship`, which commits, pushes, opens the PR and updates the ticket.
19
+
20
+ **Commands:**
21
+
22
+ | Command | What it does |
23
+ |---|---|
24
+ | `helix do <ticket or words>` | Headless run, ending in a PR |
25
+ | `helix fix` | Fix a bug: failing test first, then fix |
26
+ | `helix ask` | Ask a question about the code |
27
+ | `helix test` | Write tests |
28
+ | `helix ci` | Fix a failed pipeline |
29
+ | `helix review`, `helix review-pr` | Review a branch or a PR |
30
+ | `helix tickets`, `helix prs` | List your tickets or open PRs |
31
+ | `helix usage report` | Per-member token report, weekly or monthly |
32
+ | `helix lessons list` | Lessons saved from past fixes |
33
+ | `helix selftest` | Runs every flow on a throwaway repo |
34
+
35
+ **Connectors:**
36
+ - Trackers: Azure Boards, GitHub Issues, Jira, Linear
37
+ - Repos: Azure Repos, GitHub
38
+ - CI: Azure Pipelines, GitHub Actions
39
+
40
+ VS Code extension: search **"Helix: Tickets to Tested PRs"** in the Extensions view.
41
+
42
+ Helix is an independent project. It is not made, endorsed or supported by Anthropic.
@@ -0,0 +1 @@
1
+ __version__ = "4.3.0"
@@ -0,0 +1,120 @@
1
+ """Zero-command mode: Helix inside Claude Code's own chat (VS Code extension, terminal, desktop Code tab).
2
+
3
+ Claude Code hooks call these:
4
+ SessionStart -> refresh the project map (incremental, ~1s) and say what Helix adds
5
+ UserPromptSubmit -> enrich every raw prompt: ticket text, start-here files, past-bug lessons,
6
+ the right workflow (test-first for bugs) and how to finish (`helix ship`)
7
+ Stop -> real checks (see cli.hook_stop)
8
+
9
+ The injected context is kept small (a few hundred tokens) and is skipped for chit-chat,
10
+ so it saves far more exploration tokens than it costs.
11
+ """
12
+ from __future__ import annotations
13
+
14
+ import json
15
+ import re
16
+ from pathlib import Path
17
+
18
+ from .config import load_config
19
+ from .connectors import ConnectorError, tracker_from
20
+ from .memory import Lessons, Retriever, build_map, load_map
21
+ from .prompt import STEPS, detect_intent
22
+
23
+ # "#4821", "ticket 4821", "bug 4821", "work item 4821", "AB#4821", "issue 12", "ENG-42"
24
+ TICKET_IN_TEXT = re.compile(
25
+ r"(?:\b(?:ticket|bug|story|task|issue|work\s*item|wi|item)\s*#?\s*(\d{1,7})\b)"
26
+ r"|(?:(?:AB)?#(\d{1,7})\b)"
27
+ r"|(?:\b([A-Z][A-Z0-9]{1,9}-\d{1,6})\b)", re.I)
28
+ SMALL_TALK = re.compile(r"^\s*(hi|hello|hey|thanks|thank you|ok|okay|yes|no|cool|great)\b[\s!.]*$", re.I)
29
+
30
+ SHIP_HINT = ("When the checks pass, finish by running in the terminal:\n"
31
+ " helix ship {ticket}--summary \"<one line>\" --root-cause \"<for bugs>\" --rule \"<one-line rule that "
32
+ "prevents this bug class>\"\n"
33
+ "It commits on a helix/ branch, pushes, opens the PR{link} and saves the lesson. "
34
+ "Do not run git commit/push yourself.")
35
+
36
+
37
+ def find_ticket(prompt: str) -> str | None:
38
+ m = TICKET_IN_TEXT.search(prompt)
39
+ if not m:
40
+ return None
41
+ ref = next(g for g in m.groups() if g)
42
+ return ref.upper() if "-" in ref else ref
43
+
44
+
45
+ def build_context(prompt: str, root: Path, max_files: int = 6) -> str:
46
+ """The text added to Claude's context for this prompt ('' = add nothing)."""
47
+ if not prompt.strip() or SMALL_TALK.match(prompt) or prompt.lstrip().startswith("/"):
48
+ return ""
49
+ cfg = load_config(root)
50
+ parts: list[str] = []
51
+ item = None
52
+ ref = find_ticket(prompt)
53
+ if ref and cfg.tracker.get("type"):
54
+ try:
55
+ item = tracker_from(cfg.tracker).get(ref)
56
+ parts.append("## Ticket (fetched by Helix)\n" + item.brief(limit=2500))
57
+ except ConnectorError as exc:
58
+ parts.append(f"## Ticket {ref}\n(Helix could not fetch it: {str(exc)[:150]})")
59
+ query = (item.brief(limit=1500) if item else "") + " " + prompt
60
+ intent = detect_intent(item.title if item else prompt, item)
61
+ if intent == "feature" and len(prompt.split()) < 4 and not item:
62
+ return "" # too vague to help; don't spend tokens
63
+ pmap = load_map(root)
64
+ files = Retriever(pmap).search(query, k=max_files) if pmap.get("files") else []
65
+ if files:
66
+ parts.append("## Start here (ranked by Helix; open these before searching)\n"
67
+ + "\n".join(f"- {f}" for f, _ in files))
68
+ lessons = Lessons(root).relevant(query, [f for f, _ in files])
69
+ if lessons:
70
+ parts.append("## Past bugs in this repo - do not repeat\n"
71
+ + "\n".join(f"- {l.get('rule') or l.get('root_cause')}" for l in lessons))
72
+ if intent != "research":
73
+ parts.append(f"## Helix workflow ({intent})\n{STEPS[intent]}")
74
+ parts.append(SHIP_HINT.format(ticket=f"{item.id} " if item else "",
75
+ link=" and links/updates the ticket" if item else ""))
76
+ else:
77
+ parts.append(f"## Helix workflow (question)\n{STEPS['research']}")
78
+ return "[Helix context - added automatically]\n\n" + "\n\n".join(parts)
79
+
80
+
81
+ def hook_prompt(payload: dict) -> dict | None:
82
+ root = Path(payload.get("cwd") or ".")
83
+ try:
84
+ ctx = build_context(payload.get("prompt", ""), root)
85
+ except Exception: # noqa: BLE001 - a hook must never block the user's prompt
86
+ return None
87
+ if not ctx:
88
+ return None
89
+ return {"hookSpecificOutput": {"hookEventName": "UserPromptSubmit", "additionalContext": ctx}}
90
+
91
+
92
+ def hook_session_start(payload: dict) -> dict | None:
93
+ root = Path(payload.get("cwd") or ".")
94
+ try:
95
+ if (root / ".helix").exists():
96
+ build_map(root) # incremental: only changed files are re-parsed
97
+ except Exception: # noqa: BLE001
98
+ return None
99
+ msg = ("Helix is active in this repo: prompts get ticket text, ranked files and past-bug lessons "
100
+ "automatically; checks run before you finish; use `helix ship` to open the PR.")
101
+ return {"hookSpecificOutput": {"hookEventName": "SessionStart", "additionalContext": msg}}
102
+
103
+
104
+ def merge_settings(existing: dict, template: dict) -> dict:
105
+ """Add Helix hooks/permissions to a repo's .claude/settings.json without dropping the user's own."""
106
+ out = json.loads(json.dumps(existing))
107
+ perms = out.setdefault("permissions", {})
108
+ for key in ("allow", "deny"):
109
+ cur = perms.setdefault(key, [])
110
+ for rule in template.get("permissions", {}).get(key, []):
111
+ if rule not in cur:
112
+ cur.append(rule)
113
+ hooks = out.setdefault("hooks", {})
114
+ for event, groups in template.get("hooks", {}).items():
115
+ cur = hooks.setdefault(event, [])
116
+ have = {h.get("command") for g in cur for h in g.get("hooks", [])}
117
+ for g in groups:
118
+ if not any(h.get("command") in have for h in g.get("hooks", [])):
119
+ cur.append(g)
120
+ return out
@@ -0,0 +1,74 @@
1
+ """Real verification: tests, lint and type checks (replaces Jessie's rubric score)."""
2
+ from __future__ import annotations
3
+
4
+ import json
5
+ import re
6
+ import shutil
7
+ import subprocess
8
+ import sys
9
+ from dataclasses import dataclass
10
+ from pathlib import Path
11
+
12
+
13
+ @dataclass
14
+ class CheckResult:
15
+ name: str
16
+ cmd: str
17
+ ok: bool
18
+ output: str
19
+
20
+
21
+ def detect_checks(root: Path) -> dict[str, str]:
22
+ """Best-effort defaults when .helix/config.toml has no [checks]."""
23
+ checks: dict[str, str] = {}
24
+ if (root / "pubspec.yaml").exists():
25
+ flutter = "flutter" if shutil.which("flutter") else "dart"
26
+ checks["analyze"] = f"{flutter} analyze"
27
+ if (root / "test").exists():
28
+ checks["test"] = f"{flutter} test"
29
+ pkg = root / "package.json"
30
+ if pkg.exists():
31
+ try:
32
+ scripts = json.loads(pkg.read_text("utf-8")).get("scripts", {})
33
+ except json.JSONDecodeError:
34
+ scripts = {}
35
+ runner = "pnpm" if (root / "pnpm-lock.yaml").exists() else "yarn" if (root / "yarn.lock").exists() else "npm run"
36
+ for name in ("lint", "typecheck", "test"):
37
+ if name in scripts:
38
+ checks[f"js-{name}"] = f"{runner} {name}"
39
+ if "typecheck" not in scripts and (root / "tsconfig.json").exists():
40
+ checks["js-typecheck"] = "npx tsc --noEmit"
41
+ if any((root / f).exists() for f in ("pyproject.toml", "setup.cfg", "pytest.ini", "requirements.txt")):
42
+ if shutil.which("ruff"):
43
+ checks["py-lint"] = "ruff check ."
44
+ if (root / "tests").exists() or (root / "test").exists():
45
+ checks["py-test"] = "python -m pytest -q -x"
46
+ if (root / "go.mod").exists():
47
+ checks["go"] = "go vet ./... && go test ./..."
48
+ return checks
49
+
50
+
51
+ def portable(cmd: str) -> str:
52
+ """Run `python` as the interpreter Helix itself uses. Plain `python` can be missing,
53
+ Python 2 (some Linux) or the Store stub (Windows)."""
54
+ return re.sub(r"(^|&&\s*|;\s*|\|\|\s*)python(?=\s)", lambda m: m.group(1) + f'"{sys.executable}"', cmd)
55
+
56
+
57
+ def run_checks(root: Path, checks: dict[str, str], timeout: int = 1200) -> list[CheckResult]:
58
+ results = []
59
+ for name, cmd in checks.items():
60
+ if not cmd:
61
+ continue
62
+ cmd = portable(cmd)
63
+ try:
64
+ p = subprocess.run(cmd, shell=True, cwd=root, capture_output=True, text=True,
65
+ timeout=timeout, encoding="utf-8", errors="replace")
66
+ out = (p.stdout + "\n" + p.stderr).strip()
67
+ results.append(CheckResult(name, cmd, p.returncode == 0, out[-4000:]))
68
+ except subprocess.TimeoutExpired:
69
+ results.append(CheckResult(name, cmd, False, f"timed out after {timeout}s"))
70
+ return results
71
+
72
+
73
+ def failure_text(results: list[CheckResult]) -> str:
74
+ return "\n\n".join(f"## {r.name}: `{r.cmd}`\n{r.output[-2500:]}" for r in results if not r.ok)