@clipboard-health/ai-rules 2.15.9 → 2.16.0
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.
package/package.json
CHANGED
|
@@ -59,7 +59,12 @@ for my $section (@sections) {
|
|
|
59
59
|
my $raw_file_name = trim($1);
|
|
60
60
|
my $file_content = $2;
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
# Category prefix is optional. CodeRabbit emits 0–N `_…_` tags
|
|
63
|
+
# separated by `|` (e.g. `_⚠️ Potential issue_ | _🟠 Major_ | _⚡ Quick win_`
|
|
64
|
+
# or just `_💤 Low value_` on lower-confidence findings). The previous
|
|
65
|
+
# regex required exactly two tags and silently dropped one-tag and
|
|
66
|
+
# three-tag variants.
|
|
67
|
+
while ($file_content =~ /`(\d+(?:-\d+)?)`:\s*(?:_[^_]+_(?:\s*\|\s*_[^_]+_)*\s*)?\*\*([^*]+)\*\*\s*([\s\S]*?)(?=---|\n`\d|<\/blockquote>|$)/g) {
|
|
63
68
|
my $line_range = $1;
|
|
64
69
|
my $title = trim($2);
|
|
65
70
|
my $clean_body = clean_comment_body(trim($3));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
allowed-tools: Bash(git checkout --branch:*), Bash(git add:*), Bash(git status:*), Bash(git push:*), Bash(git commit:*), Bash(gh pr view:*), Bash(gh pr create:*), Bash(git diff:*), Bash(git merge-base:*)
|
|
2
|
+
allowed-tools: Bash(git checkout --branch:*), Bash(git add:*), Bash(git status:*), Bash(git push:*), Bash(git commit:*), Bash(gh pr view:*), Bash(gh pr create:*), Bash(gh pr edit:*), Bash(git diff:*), Bash(git merge-base:*), Bash(bash scripts/find-session-id.sh:*)
|
|
3
3
|
description: Commit, push, and open a PR. Use when the user wants to ship changes, create a pull request, or says things like 'commit and push', 'open a PR', 'ship it', 'send it', 'create a PR for this', or 'push this up'.
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -14,20 +14,14 @@ description: Commit, push, and open a PR. Use when the user wants to ship change
|
|
|
14
14
|
|
|
15
15
|
## Your task
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
If `Commits ahead of default branch` is `(unknown)`, `origin/HEAD` couldn't be resolved — stop and tell the user to run `git remote set-head origin -a` (or otherwise set the default branch) before retrying, since the simplify step also depends on it. Otherwise, if `Git status`, `Commits ahead of default branch`, and `Existing PR` are all empty/none, stop and reply `nothing to ship.`. Otherwise:
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
4. Push the branch to origin
|
|
29
|
-
5. Check for an existing PR with `gh pr view`.
|
|
30
|
-
- No PR exists: Create with `gh pr create`. Title = commit subject line. Description = brief explanation of **why**, not what. Append `<!-- commit-push-pr:created v1 -->` on its own line at the end of the PR description so skill-created PRs can be identified later.
|
|
31
|
-
- PR exists: Report the URL and move on.
|
|
32
|
-
6. You have the capability to call multiple tools in a single response. After the `simplify` skill completes, do the remaining git and PR operations in a single message. Do not use any other tools or do anything else.
|
|
33
|
-
7. After tool calls complete, send one short final text response with the branch name and the full PR URL (e.g., `https://github.com/clipboardhealth/core-utils/pull/123`). Never use shorthand like `repo#123` — always output the complete URL so it is clickable.
|
|
19
|
+
1. Create a new branch if on main (e.g., `feat/add-user-validation`, `fix/null-check-in-parser`).
|
|
20
|
+
2. Run the `simplify` skill on the full PR diff — `git diff $(git merge-base HEAD origin/HEAD)..HEAD` plus any uncommitted changes. When it returns, continue to step 3 in the same turn; do not stop.
|
|
21
|
+
3. If `git status --short` shows changes, create a single conventional commit.
|
|
22
|
+
4. Push the branch to origin.
|
|
23
|
+
5. Look up the current agent session ID with `bash scripts/find-session-id.sh '<phrase>'`. Pass a distinctive verbatim chunk (≥10 words) from the most recent user message; see the script header for quoting constraints. On success the script prints `<agent> <id>`; otherwise nothing — if empty, omit the session ID line below.
|
|
24
|
+
6. Check for an existing PR with `gh pr view`.
|
|
25
|
+
- No PR: create with `gh pr create`. Title = commit subject. Description = brief explanation of **why**, not what. Append `Agent session ID: <output of step 5>` (omit if step 5 produced no output) and `<!-- commit-push-pr:created v1 -->` on their own lines at the end.
|
|
26
|
+
- PR exists: refresh the body via `gh pr edit --body` so (a) the new commit's changes are reflected in the prose and (b) `Agent session ID: <output of step 5>` appears in the body — append if missing, never remove or rewrite existing session ID lines so each contributing session is preserved. Then report the URL.
|
|
27
|
+
7. End with one short text response: branch name and the full PR URL (e.g., `https://github.com/clipboardhealth/core-utils/pull/123`). Never use shorthand like `repo#123` — always output the complete URL.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# find-session-id.sh — print the current agent session ID, or nothing.
|
|
3
|
+
# Output format on success: "<agent> <id>" (e.g. "codex 0193..." or "claude-code c8fb7000-...").
|
|
4
|
+
# Exits 0 either way; callers should treat empty output as "unknown, skip the line".
|
|
5
|
+
#
|
|
6
|
+
# Codex: reads $CODEX_THREAD_ID directly.
|
|
7
|
+
# Claude Code: greps the project's JSONL transcripts for a phrase the caller
|
|
8
|
+
# passes as $1. The phrase MUST come from a recent user message in the
|
|
9
|
+
# current session and MUST avoid: " ' \ tab newline (those are JSON-escaped
|
|
10
|
+
# on disk or break shell quoting). Non-ASCII is fine — Claude Code stores
|
|
11
|
+
# user messages verbatim, not as \uXXXX escapes.
|
|
12
|
+
#
|
|
13
|
+
# Usage: find-session-id.sh "<distinctive phrase>"
|
|
14
|
+
|
|
15
|
+
set -euo pipefail
|
|
16
|
+
|
|
17
|
+
if [ -n "${CODEX_THREAD_ID:-}" ]; then
|
|
18
|
+
echo "codex $CODEX_THREAD_ID"
|
|
19
|
+
exit 0
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
phrase="${1:-}"
|
|
23
|
+
[ -n "$phrase" ] || exit 0
|
|
24
|
+
|
|
25
|
+
# Claude Code encodes both / and . as - in the project-dir name
|
|
26
|
+
# (e.g. /Users/x/.claude → -Users-x--claude).
|
|
27
|
+
project_dir="$HOME/.claude/projects/$(pwd | sed -e 's|/|-|g' -e 's|\.|-|g')"
|
|
28
|
+
[ -d "$project_dir" ] || exit 0
|
|
29
|
+
|
|
30
|
+
# -- guards against a phrase that starts with -. -m 1 stops scanning each
|
|
31
|
+
# transcript at the first hit (transcripts can be hundreds of MB).
|
|
32
|
+
matches=$(grep -lFm 1 -- "$phrase" "$project_dir"/*.jsonl 2>/dev/null || true)
|
|
33
|
+
[ -n "$matches" ] || exit 0
|
|
34
|
+
|
|
35
|
+
# Require exactly one match. Falling back to recency under multi-match would
|
|
36
|
+
# risk a wrong ID when concurrent sessions exist in the same project.
|
|
37
|
+
[ "$(printf '%s\n' "$matches" | wc -l)" -eq 1 ] || exit 0
|
|
38
|
+
|
|
39
|
+
echo "claude-code $(basename "$matches" .jsonl)"
|
package/skills/go/SKILL.md
CHANGED
|
@@ -4,59 +4,43 @@ description: Implement a plan file or direct request end-to-end, then hand off t
|
|
|
4
4
|
|
|
5
5
|
# Go: Execute Work and Ship It
|
|
6
6
|
|
|
7
|
-
Given a plan file or direct implementation request, implement the requested work, then invoke the `commit-push-pr` skill to
|
|
7
|
+
Given a plan file or direct implementation request, implement the requested work, then invoke the `commit-push-pr` skill to create a PR.
|
|
8
8
|
|
|
9
9
|
This skill is the bridge between intent and shipping. It does not re-plan or re-design unless the user asked for that. If the request is wrong or cannot be implemented safely, surface that; do not silently improvise.
|
|
10
10
|
|
|
11
|
-
## Phase 1:
|
|
11
|
+
## Phase 1: Resolve the Input
|
|
12
12
|
|
|
13
|
-
The user
|
|
13
|
+
The user invokes this skill with either a plan file path/identifier or a direct request like "add a login button."
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
4. **Natural-language request** (for example, contains spaces or reads like an implementation task): treat it as the implementation request. There may be no separate plan file.
|
|
19
|
-
5. **No argument given**: ask the user to provide either the plan file path or the implementation request. Do not guess.
|
|
15
|
+
- **Path-like input** (absolute, relative, or bare name): try to read it. For bare names, check the host's plans directory first. Resolve the path first; if it lies outside the workspace/repo or the host's plans directory, ask the user to confirm before reading it (applies to both absolute and relative inputs — `..` escapes count). If the input doesn't resolve to a readable file, stop and tell the user — do not reinterpret a missing path as a direct request.
|
|
16
|
+
- **Natural-language request**: treat as the implementation task. There may be no plan file.
|
|
17
|
+
- **No argument**: ask for either a plan path or the implementation request.
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
When using a plan, read it fully before starting. Note **Critical files**, **Approach**, and **Verification** sections (or equivalents).
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
## Phase 2: Implement
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
The plan or request is the source of truth for scope:
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
- If you discover the request is wrong (the codebase has moved, an assumption is invalid, a constraint was missed), stop and report. Do not silently rewrite the approach.
|
|
32
|
-
- For direct implementation requests, inspect the relevant code before editing and use the repo's existing patterns.
|
|
33
|
-
- Do **not** modify the plan file itself when working from a plan.
|
|
25
|
+
- Make exactly the changes requested — no extra refactors, tests, or cleanup.
|
|
26
|
+
- If the plan references files or utilities that no longer exist, stop and report.
|
|
27
|
+
- If an assumption is invalid or a constraint was missed, stop and report. Do not silently rewrite the approach.
|
|
28
|
+
- Do not modify the plan file itself.
|
|
34
29
|
|
|
35
30
|
## Phase 3: Validate
|
|
36
31
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
1. **Repo instructions.** Look up the repo's standard validation guidance. Common signals, in priority order:
|
|
42
|
-
- An explicit instruction in the repo's agent or contributor instructions, such as `AGENTS.md`, `CLAUDE.md`, `CONTRIBUTING.md`, or an equivalent host-specific instruction file (e.g. "MUST run before opening PRs"). This wins over everything else.
|
|
43
|
-
- A relevant `package.json` script when the repo instructions point to it, such as `affected`, `precommit`, `validate`, `check`, `verify`, `test`, `lint`, `typecheck`, or repo-equivalent.
|
|
44
|
-
- A repo-specific equivalent in the rare case the project does not use `package.json`.
|
|
45
|
-
|
|
46
|
-
If the repo primarily relies on git pre-commit or pre-push hooks and does not mandate a manual validation command, do not invent one. Let the hooks run during the `commit-push-pr` handoff.
|
|
47
|
-
|
|
48
|
-
2. **Request-specific verification.** If the plan or user request names specific checks, run them when they are practical and consistent with the repo instructions. If a requested check is clearly a slow CI-only suite, ask before running it.
|
|
49
|
-
|
|
50
|
-
If any check you run fails, fix the failures and re-run the same check. Do not hand off to `commit-push-pr` with known failing checks unless the user explicitly accepts a pre-existing or unrelated failure.
|
|
32
|
+
- Read `AGENTS.md`, `CLAUDE.md`, `CONTRIBUTING.md`, or equivalent contributor instructions for the mandated pre-PR command (e.g. `npm run affected`). That wins over everything.
|
|
33
|
+
- If the repo relies on pre-commit/pre-push hooks and mandates no manual command, don't invent one — let the hooks run during the `commit-push-pr` handoff.
|
|
34
|
+
- If the plan names specific checks, run them when practical. Ask before running anything that's clearly a slow CI-only suite.
|
|
51
35
|
|
|
52
|
-
|
|
36
|
+
Fix any failures before handing off. Do not hand off with known failing checks unless the user explicitly accepts a pre-existing or unrelated failure.
|
|
53
37
|
|
|
54
|
-
|
|
38
|
+
## Phase 4: Hand Off
|
|
55
39
|
|
|
56
|
-
Do
|
|
40
|
+
Invoke the `commit-push-pr` skill. Do not commit, push, or open the PR yourself.
|
|
57
41
|
|
|
58
|
-
If `commit-push-pr` reports `nothing to ship
|
|
42
|
+
If `commit-push-pr` reports `nothing to ship.`, surface that.
|
|
59
43
|
|
|
60
44
|
## Phase 5: Final Output
|
|
61
45
|
|
|
62
|
-
|
|
46
|
+
Ensure the user sees the branch name and full PR URL.
|