Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .claude/commands/finish-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Extra instructions (may be empty): $ARGUMENTS

1. Read the state: run `pwsh -NoProfile -File .template/Get-PlanState.ps1` from the repository root, adding `-Path <folder>` when the plan is in another folder. It fetches `origin` and prints `key: value` lines; `-` means none. Below, `<default branch>` is its `default` value and `<plan's branch>` its `branch` value. When `dirty` is `yes`, stop and list the files `git status --porcelain` prints. When `feedback` isn't `-`, stop: the plan belongs to a stopped `/address-feedback` run on pull request `<feedback>`, and `/address-feedback <feedback>` finishes it, or discards it once that pull request is merged or closed. When `steps` isn't `-` and its two counts differ, as in `3/5`, stop and list the step headings in `PLAN.md` that don't start with `### [x]`. When `unfiled` is above 0 and the `landing` line's `follow-ups` isn't `none`, stop: the `## Follow-ups` section of `PLAN.md` lists follow-ups that were never filed as issues. List those lines, and say to run ship-plan, which files them, then finish-plan again.
2. Check the work is upstream: the check passed when `landed` is `yes`. The script counts the branch as landed when `HEAD` is on `origin/<default branch>`, or when `gh` or `glab` finds a merged pull request from it whose merge commit is on `origin/<default branch>` and whose head holds `HEAD` or has the same tree, as a squash merge or a merge queue leaves it. When `ahead` isn't `0`, it landed the second way: name the pull request on the `pr` line. When `default` is `-`, stop: there is no `origin` remote. Otherwise — no such pull request, or `pr` is `unknown` because the CLI is missing or failed — show `git log --oneline origin/<default branch>..HEAD` and stop to ask me whether to push those commits first or whether they reached the default branch another way.
3. Retire the plan: delete `PLAN.md` when it exists.
3. Retire the plan: first note, in order, each line of the `## Follow-ups` section of `PLAN.md` that ends with ` — next — filed as #<number>` or ` — next — already tracked as #<number>`, with its number. Then delete `PLAN.md` when it exists.
4. Fast-forward the default branch: run `git switch <default branch>`, then `git pull --ff-only`. When either fails, stop and report the error.
5. When the plan's branch is not `-` and not the default branch, delete it with `git branch -d <plan's branch>`. When `-d` refuses, use `git branch -D <plan's branch>` only if step 2 passed or I confirmed the commits reached the default branch. When `origin/<plan's branch>` still exists, say so and leave it: deleting it is a push.
6. Finish with the range `git pull` printed (or "already up to date"), the default branch's commit (`git log --oneline -1`), and the branches deleted.
6. Finish with the range `git pull` printed (or "already up to date"), the default branch's commit (`git log --oneline -1`), and the branches deleted. When item 3 noted a follow-up, end with the command that plans it next, from the default branch in this session or a new one: `/plan-issue #<number>` for each noted follow-up, one per line, in order; and when it noted two or more and the `landing` line's `integrate` is `pull-request`, also `/run-issues #<number> #<number> …` with every noted number, which takes them all in one session.
13 changes: 7 additions & 6 deletions .claude/commands/ship-plan.md

Large diffs are not rendered by default.

58 changes: 58 additions & 0 deletions .claude/hooks/ensure-pwsh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env bash
#
# ensure-pwsh.sh - make PowerShell available in a Claude Code cloud session.
#
# This project's scripts and commands run with `pwsh`, and a cloud session's
# container doesn't have it, so a session would stop and ask to install it.
# The SessionStart hook in .claude/settings.json runs this file instead.
#
# It does nothing outside a cloud session (CLAUDE_CODE_REMOTE is not "true"),
# so it never installs software on a developer's own machine, and nothing when
# pwsh is already on the PATH, such as when the cloud environment's setup script
# installed it. Otherwise, on Ubuntu 24.04 x86_64 it installs the pinned
# PowerShell package from Microsoft's apt repository, which a cloud session's
# network reaches by default, after checking its SHA-256. Any other system, or
# any failure, prints one line and exits 0: the hook never blocks a session.
#
# To move to a newer PowerShell, change PWSH_VERSION and PWSH_SHA256 to the values of the
# `powershell` entry in
# https://packages.microsoft.com/ubuntu/24.04/prod/dists/noble/main/binary-amd64/Packages.gz
#
# This file comes from the project template, and template updates replace it.

[ "${CLAUDE_CODE_REMOTE:-}" = "true" ] || exit 0
command -v pwsh >/dev/null 2>&1 && exit 0

PWSH_VERSION=7.6.9-1.deb
PWSH_SHA256=491b1a51e257e2ac86af33e3a4dc9aa91adb1b3926a57967af39d9a1ca38dc79

os=$(. /etc/os-release 2>/dev/null && echo "${ID:-}:${VERSION_ID:-}:${PRETTY_NAME:-unknown}")
case "$os:$(uname -m)" in
ubuntu:24.04:*:x86_64) ;;
*)
echo "ensure-pwsh: pwsh is missing and this system (${os#*:*:}, $(uname -m)) has no pinned package; install PowerShell 7 to run this project's scripts."
exit 0
;;
esac

sudo=
if [ "$(id -u)" != 0 ]; then
command -v sudo >/dev/null 2>&1 && sudo="sudo -n" || {
echo "ensure-pwsh: pwsh is missing and this session is not root and has no sudo."
exit 0
}
fi

# env sets DEBIAN_FRONTEND for apt-get itself, which sudo would otherwise strip; the package lists are refreshed
# only when the first install fails, since a fresh container's lists may be empty or stale.
apt_install() { $sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y "$dir/$file" >/dev/null; }

dir=$(mktemp -d) || exit 0
file="powershell_${PWSH_VERSION}_amd64.deb"
curl -fsS -m 120 -o "$dir/$file" "https://packages.microsoft.com/ubuntu/24.04/prod/pool/main/p/powershell/$file" &&
echo "$PWSH_SHA256 $dir/$file" | sha256sum -c - >/dev/null &&
{ apt_install || { $sudo apt-get update -qq >/dev/null 2>&1 && apt_install; }; } &&
echo "ensure-pwsh: installed PowerShell $(pwsh -NoProfile -Command '$PSVersionTable.PSVersion.ToString()')" ||
echo "ensure-pwsh: installing PowerShell failed; the project's scripts need pwsh."
rm -rf "$dir"
exit 0
23 changes: 21 additions & 2 deletions .claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,37 @@
},
"permissions": {
"allow": [
"EnterWorktree"
"EnterWorktree",
Comment thread
polewskm marked this conversation as resolved.
Resolved
"Bash",
"PowerShell"
],
"ask": [
"Bash(git push)",
"Bash(git push *)",
"PowerShell(git push)",
"PowerShell(git push *)"
"PowerShell(git push *)",
"Bash(*.env*)",
"PowerShell(*.env*)",
"Bash(*secrets*)",
"PowerShell(*secrets*)"
],
"deny": [
"Read(./.env)",
"Read(./.env.*)",
"Read(/secrets/**)"
]
},
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "bash \"$CLAUDE_PROJECT_DIR/.claude/hooks/ensure-pwsh.sh\"",
"timeout": 180
}
]
}
]
}
}
3 changes: 2 additions & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Written by Copier; never edit by hand. Change an answer with .template\Update-Project.ps1 -Data.
_commit: v0.68.4
_commit: v0.75.1
_src_path: https://github.com/NCodeGroup/project-template.git
build_command: npm run typecheck
code_review: true
Expand All @@ -11,6 +11,7 @@ project_description: 'AI pull request review for NCodeGroup repositories: a GitH
project_name: code-review
stack: node
test_command: npm test
uses_node: true
workflow_tools:
- claude
- copilot
Loading
Loading