@homericintelligence/athena-opencode 0.4.4

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 (36) hide show
  1. package/LICENSE +29 -0
  2. package/NOTICE +22 -0
  3. package/README.md +45 -0
  4. package/package.json +29 -0
  5. package/plugin.js +54 -0
  6. package/skills/THIRD_PARTY_LICENSES.md +50 -0
  7. package/skills/_cli.py +152 -0
  8. package/skills/advise/SKILL.md +62 -0
  9. package/skills/advise/scripts/list_retrievable_skills.py +49 -0
  10. package/skills/brainstorm/SKILL.md +110 -0
  11. package/skills/change-review/SKILL.md +68 -0
  12. package/skills/change-review/references/scope-resolution.md +52 -0
  13. package/skills/change-review/scripts/resolve_scope.py +1219 -0
  14. package/skills/finalize-plan/SKILL.md +129 -0
  15. package/skills/git-worktrees/SKILL.md +113 -0
  16. package/skills/git-worktrees/scripts/prepare_worktree.py +153 -0
  17. package/skills/issue-review/SKILL.md +67 -0
  18. package/skills/learn/SKILL.md +208 -0
  19. package/skills/myrmidon-swarm/SKILL.md +93 -0
  20. package/skills/plan-issue/SKILL.md +70 -0
  21. package/skills/pr-review/SKILL.md +114 -0
  22. package/skills/pr-review/references/criteria.md +26 -0
  23. package/skills/pr-review/references/delivery.md +135 -0
  24. package/skills/pr-review/references/evidence.md +233 -0
  25. package/skills/pr-review/references/prevalidated.md +155 -0
  26. package/skills/pr-review/scripts/collect_evidence.py +1478 -0
  27. package/skills/pr-review/scripts/diff_context.py +74 -0
  28. package/skills/pr-review/scripts/materialize_snapshot.py +731 -0
  29. package/skills/pr-review/scripts/pr_identity.py +80 -0
  30. package/skills/pr-review/scripts/resolve_pr.py +258 -0
  31. package/skills/repo-review/SKILL.md +119 -0
  32. package/skills/systematic-debugging/SKILL.md +199 -0
  33. package/skills/systematic-debugging/scripts/repository_evidence.py +77 -0
  34. package/skills/test-driven-development/SKILL.md +75 -0
  35. package/skills/tidy/SKILL.md +71 -0
  36. package/skills/tidy/scripts/run_tidy.py +43 -0
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env python3
2
+ """Collect reproducible recent-change and source-pattern evidence."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import json
7
+ import sys
8
+ from pathlib import Path
9
+
10
+ if __package__ in {None, ""}:
11
+ sys.path.insert(0, str(Path(__file__).resolve().parents[3]))
12
+
13
+ from skills._cli import argument_parser, run_command
14
+
15
+ EMPTY_TREE = "4b825dc642cb6eb9a060e54bf8d69288fbee4904"
16
+
17
+
18
+ def run(*arguments: str, accepted_codes: tuple[int, ...] = (0,)) -> str:
19
+ result = run_command(arguments, capture_output=True, text=True, check=False)
20
+ if result.returncode not in accepted_codes:
21
+ raise RuntimeError(result.stderr.strip() or f"{' '.join(arguments)} failed")
22
+ return result.stdout
23
+
24
+
25
+ def main() -> int:
26
+ parser = argument_parser(description=__doc__)
27
+ parser.add_argument("pattern")
28
+ parser.add_argument("--source-root", default=".")
29
+ arguments = parser.parse_args()
30
+ try:
31
+ try:
32
+ recent_revisions = run(
33
+ "git", "rev-list", "--max-count=10", "HEAD"
34
+ ).splitlines()
35
+ except RuntimeError as error:
36
+ raise RuntimeError(f"cannot resolve HEAD: {error}") from error
37
+ if not recent_revisions:
38
+ raise RuntimeError("cannot resolve HEAD: repository has no commits")
39
+ recent_commits = run("git", "log", "--oneline", "-10")
40
+ oldest_parent = run(
41
+ "git",
42
+ "rev-parse",
43
+ "--verify",
44
+ f"{recent_revisions[-1]}^",
45
+ accepted_codes=(0, 128),
46
+ ).strip()
47
+ recent_range = f"{oldest_parent or EMPTY_TREE}..HEAD"
48
+ recent_diff = run("git", "diff", "--stat", recent_range)
49
+ pattern_matches = run(
50
+ "git",
51
+ "grep",
52
+ "--line-number",
53
+ "-e",
54
+ arguments.pattern,
55
+ "--",
56
+ arguments.source_root,
57
+ accepted_codes=(0, 1),
58
+ )
59
+ except RuntimeError as error:
60
+ print(error, file=sys.stderr)
61
+ return 1
62
+ print(
63
+ json.dumps(
64
+ {
65
+ "pattern_matches": pattern_matches,
66
+ "recent_commits": recent_commits,
67
+ "recent_diff": recent_diff,
68
+ "recent_range": recent_range,
69
+ },
70
+ sort_keys=True,
71
+ )
72
+ )
73
+ return 0
74
+
75
+
76
+ if __name__ == "__main__":
77
+ raise SystemExit(main())
@@ -0,0 +1,75 @@
1
+ ---
2
+ name: test-driven-development
3
+ license: BSD-3-Clause
4
+ description: Use when implementing any feature or bugfix, before writing implementation code — enforces RED-GREEN-REFACTOR cycle
5
+ argument-hint: <feature or bugfix description>
6
+ allowed-tools: [Read, Write, Edit, Bash, Grep, Glob]
7
+ ---
8
+
9
+ # Test-Driven Development (TDD)
10
+
11
+ Why: seeing a focused test fail proves it can detect the missing product
12
+ behavior; seeing it pass proves the smallest implementation satisfies it.
13
+
14
+ Use Athena's shared [behavior-first testing guidance](../../docs/review/behavior-first-testing.md)
15
+ for good-test/bad-test criteria, determinism, and false-pass checks. Test
16
+ observable product behavior and core contracts, not wording, documentation
17
+ layout, or a private implementation arrangement.
18
+
19
+ ## Use and rule
20
+
21
+ Use TDD for features, bug fixes, refactoring, and behavior changes. Ask the
22
+ human partner before exempting a throwaway prototype, generated code,
23
+ configuration-only work, or documentation-only wording/layout change. In a
24
+ swarm, the test specialist completes RED before implementation begins.
25
+
26
+ ```text
27
+ NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
28
+ ```
29
+
30
+ If you wrote in-scope implementation first, remove only that newly authored
31
+ work and start with RED. Preserve pre-existing or user-authored work and ask for
32
+ direction when provenance or scope is unclear.
33
+
34
+ ## RED–GREEN–REFACTOR
35
+
36
+ 1. **RED:** Write one minimal, clearly named test for one observable behavior,
37
+ data contract, security property, or executable artifact outcome. Use real
38
+ code unless a controlled substitute is needed at a genuine external boundary.
39
+ 2. **Verify RED:** Discover the repository's focused test command and run it.
40
+ The test must fail—not error—for the expected missing behavior. A filtered
41
+ command must prove it selected a relevant test; C++/CMake tests must be wired
42
+ to a real build and test target. If the test passes, it covers existing
43
+ behavior; if it errors, fix the test setup and run it again.
44
+ 3. **GREEN:** Write the simplest behaviorally complete code that passes. Do not
45
+ add speculative features, unrelated refactors, or implementation beyond the
46
+ test's demonstrated need.
47
+ 4. **Verify GREEN:** Run the discovered relevant suite. The new and existing
48
+ tests must pass without errors or warnings; fix code rather than weakening a
49
+ test.
50
+ 5. **REFACTOR:** After green, remove duplication, clarify names, or extract a
51
+ helper without adding behavior. Keep tests green, then start the next RED
52
+ cycle.
53
+
54
+ For documentation-only changes, use existing Markdown, link, and executable
55
+ example validation. Do not create production code or a text-assertion harness
56
+ to manufacture a RED phase.
57
+
58
+ ## Evidence before completion
59
+
60
+ Discover commands from `AGENTS.md`, task runners, manifests, lockfiles, and
61
+ required CI; prefer repository-native entry points. Record focused and relevant
62
+ suite, coverage, type, and lint commands when applicable. If they conflict or
63
+ no safe command is discoverable, ask the user rather than borrow another
64
+ repository's command.
65
+
66
+ Before completion, confirm proportionate coverage for every changed observable
67
+ behavior and bug regression; controlled time, services, randomness, state, and
68
+ mocks where the product requires them; non-empty focused test selection; and
69
+ fresh passing relevant tests, type checks, and lint. Follow the evidence policy
70
+ before claiming success. Use `learn` for a durable testing lesson; its own
71
+ scope and delivery rules determine whether it publishes a PR.
72
+
73
+ ---
74
+
75
+ _Adapted from [obra/superpowers](https://github.com/obra/superpowers) under the [MIT License](https://github.com/obra/superpowers/blob/main/LICENSE). Copyright (c) 2025 Jesse Vincent._
@@ -0,0 +1,71 @@
1
+ ---
2
+ name: tidy
3
+ license: BSD-3-Clause
4
+ description: Delegate repository branch and worktree cleanup to the dependency-locked Hephaestus tidy command. Use for tidy, cleanup, or rebase requests; fail closed when the trusted automation checkout or required execution capability cannot be prepared.
5
+ argument-hint: "<optional: hephaestus-tidy arguments>"
6
+ allowed-tools: [Bash, Read]
7
+ ---
8
+
9
+ # Tidy through Hephaestus
10
+
11
+ Use this when the user asks to tidy, clean up, or rebase a repository's local branches or
12
+ worktrees. Athena prepares the trusted automation dependency and delegates the complete operation;
13
+ `hephaestus-tidy` owns discovery, preservation rules, prompts, rebases, removal safeguards, output,
14
+ and the final exit status.
15
+
16
+ ## Inputs
17
+
18
+ Keep the target repository as the current working directory. Treat every argument supplied to this
19
+ skill as a `hephaestus-tidy` argument and forward it unchanged. When the user wants a preview,
20
+ forward `--dry-run`; do not reinterpret it or add it implicitly.
21
+
22
+ ## Workflow
23
+
24
+ 1. Prepare Hephaestus at `$HOME/.agent_brain/automation` under the canonical
25
+ [`dependency-resolution` contract](../../docs/dependency-resolution.md). Report the resolved
26
+ repository, commit SHA, and trust basis. Resolution, authentication, checkout, update,
27
+ cleanliness, identity, revision-binding, or automatic-fork revalidation failure is blocking.
28
+ 2. Keep the target repository as the current working directory. Resolve `scripts/run_tidy.py`
29
+ against this installed skill directory and invoke that absolute helper path with the resolved
30
+ automation checkout as its first internal operand, followed by every user argument in its
31
+ original order and form.
32
+ 3. The helper replaces itself with this dependency-locked command vector:
33
+
34
+ ```text
35
+ uv run --project <resolved-automation-checkout> --locked hephaestus-tidy <user-arguments>
36
+ ```
37
+
38
+ 4. Leave stdin, stdout, and stderr attached. Do not capture, pipe, summarize in place of, answer,
39
+ retry, or otherwise mediate the command. The user answers any interactive prompt emitted by
40
+ Hephaestus.
41
+
42
+ Athena performs no worktree audit, candidate classification, removal, prompt, branch rebase, or
43
+ cleanup safety decision of its own. It never substitutes a `hephaestus-tidy` executable found on
44
+ `PATH` for the dependency-locked command.
45
+
46
+ ## Dependency and capability failures
47
+
48
+ Authenticated `gh`, Git, and network access are required by dependency preparation. Python 3 and
49
+ `uv` are required to start the locked command. On any missing capability or nonzero command result,
50
+ return the failure unchanged and stop. Do not fall back to a stale checkout, a similarly named
51
+ repository, an ambient executable, or a second cleanup implementation.
52
+
53
+ ## Failed approaches
54
+
55
+ - Auditing and removing worktrees in Athena duplicated Hephaestus policy and produced a second set
56
+ of destructive-action prompts.
57
+ - Invoking an ambient `hephaestus-tidy` could bypass the resolved repository and its lockfile.
58
+ - Parsing, normalizing, or reconstructing user arguments changed the delegated CLI contract.
59
+ - Capturing or piping the process could alter interactive behavior, output, signals, or exit status.
60
+
61
+ ## Output
62
+
63
+ Before execution, report the resolved Hephaestus repository, commit SHA, and trust basis. After
64
+ that, preserve the delegated command's output and terminal result without adding Athena-specific
65
+ worktree classifications or cleanup conclusions.
66
+
67
+ ## Attribution
68
+
69
+ The cleanup implementation and safeguards are owned by
70
+ [`HomericIntelligence/Hephaestus`](https://github.com/HomericIntelligence/Hephaestus). Athena owns
71
+ only dependency preparation and the tested transport adapter.
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env python3
2
+ """Replace this process with the dependency-locked Hephaestus tidy command."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import argparse
7
+ import os
8
+ import sys
9
+ from collections.abc import Sequence
10
+ from pathlib import Path
11
+
12
+ if __package__ in {None, ""}:
13
+ sys.path.insert(0, str(Path(__file__).resolve().parents[3]))
14
+
15
+ from skills._cli import argument_parser
16
+
17
+
18
+ def main(argv: Sequence[str] | None = None) -> int:
19
+ raw_arguments = list(sys.argv[1:] if argv is None else argv)
20
+ parser = argument_parser(description=__doc__)
21
+ parser.add_argument("automation_checkout", type=Path)
22
+ parser.add_argument("arguments", nargs=argparse.REMAINDER)
23
+ parsed = parser.parse_args(raw_arguments)
24
+ command = [
25
+ "uv",
26
+ "run",
27
+ "--project",
28
+ str(parsed.automation_checkout),
29
+ "--locked",
30
+ "hephaestus-tidy",
31
+ *raw_arguments[1:],
32
+ ]
33
+ try:
34
+ os.execvp(command[0], command)
35
+ except FileNotFoundError as error:
36
+ missing = error.filename or command[0]
37
+ print(f"required command unavailable: {missing}", file=sys.stderr)
38
+ return 127
39
+ raise RuntimeError("os.execvp returned unexpectedly")
40
+
41
+
42
+ if __name__ == "__main__":
43
+ raise SystemExit(main())