Skip to content

Commit dd52f0a

Browse files
WomB0ComB0claude
andcommitted
chore: add Apache-2.0 license headers and install canonical git hooks
Add license headers to README.md, TODO.md, main.css, and vite.config.ts for compliance. Include canonical ResQ git hooks (pre-commit, pre-push, commit-msg, prepare-commit-msg, post-checkout, post-merge). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7e5c421 commit dd52f0a

10 files changed

Lines changed: 311 additions & 0 deletions

File tree

.git-hooks/commit-msg

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2026 ResQ Software
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# Canonical ResQ commit-msg shim — source: resq-software/dev.
6+
# Enforces Conventional Commits; blocks fixup/squash/WIP on main/master.
7+
8+
set -euo pipefail
9+
10+
[ -n "${GIT_HOOKS_SKIP:-}" ] && exit 0
11+
12+
INPUT_FILE="${1:-}"
13+
PATTERN="^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?(!)?: .+$"
14+
15+
FIRST_LINE=$(head -1 "$INPUT_FILE")
16+
# Ticket-prefix regex matches what prepare-commit-msg prepends ({2,} chars).
17+
SUBJECT=$(sed -E 's/^\[[A-Z]{2,}-[0-9]+\][[:space:]]*//' <<<"$FIRST_LINE")
18+
19+
# WIP / fixup! / squash! guard runs *before* the format check so users get
20+
# a branch-specific error message on main/master instead of the generic
21+
# "Invalid commit message format".
22+
BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null || echo "")
23+
case "$BRANCH" in
24+
main|master)
25+
if grep -qiE "^(\[[A-Z]{2,}-[0-9]+\] )?(fixup!|squash!|wip[: ])" <<<"$FIRST_LINE"; then
26+
echo "Error: fixup!/squash!/WIP commits are not allowed on $BRANCH."
27+
echo "Create a feature branch instead."
28+
exit 1
29+
fi
30+
;;
31+
esac
32+
33+
if ! grep -qE "$PATTERN" <<<"$SUBJECT"; then
34+
echo "Error: Invalid commit message format."
35+
echo "Expected: type(scope)(!): subject"
36+
echo "Examples:"
37+
echo " feat(core): add new feature"
38+
echo " feat!: remove deprecated API (breaking change marker)"
39+
echo " fix(ui): fix button color"
40+
exit 1
41+
fi
42+
43+
LOCAL_HOOK="$(git rev-parse --show-toplevel)/.git-hooks/local-commit-msg"
44+
if [ -x "$LOCAL_HOOK" ]; then
45+
exec "$LOCAL_HOOK" "$@"
46+
fi

.git-hooks/post-checkout

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2026 ResQ Software
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# Canonical ResQ post-checkout shim — source: resq-software/dev.
6+
# Notifies when lock files change so devs know to resync dependencies.
7+
8+
set -euo pipefail
9+
10+
[ -n "${GIT_HOOKS_SKIP:-}" ] && exit 0
11+
12+
PREV_HEAD="${1:-}"
13+
NEW_HEAD="${2:-}"
14+
IS_BRANCH_CHECKOUT="${3:-}"
15+
16+
if [ "$IS_BRANCH_CHECKOUT" = "1" ] && [ "$PREV_HEAD" != "$NEW_HEAD" ]; then
17+
CHANGED=$(git diff --name-only "$PREV_HEAD" "$NEW_HEAD" 2>/dev/null || true)
18+
19+
grep -q "^Cargo\.lock$" <<<"$CHANGED" && echo "📦 Cargo.lock changed — run: cargo build"
20+
grep -q "^bun\.lockb\?$" <<<"$CHANGED" && echo "📦 bun.lock changed — run: bun install"
21+
grep -q "^uv\.lock$" <<<"$CHANGED" && echo "📦 uv.lock changed — run: uv sync"
22+
grep -q "^flake\.lock$" <<<"$CHANGED" && echo "📦 flake.lock changed — exit and re-enter: nix develop"
23+
fi
24+
25+
LOCAL_HOOK="$(git rev-parse --show-toplevel)/.git-hooks/local-post-checkout"
26+
if [ -x "$LOCAL_HOOK" ]; then
27+
exec "$LOCAL_HOOK" "$@"
28+
fi
29+
30+
exit 0

.git-hooks/post-merge

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2026 ResQ Software
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# Canonical ResQ post-merge shim — source: resq-software/dev.
6+
# Notifies when lock files change after a merge.
7+
8+
set -euo pipefail
9+
10+
[ -n "${GIT_HOOKS_SKIP:-}" ] && exit 0
11+
12+
CHANGED=$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD 2>/dev/null || true)
13+
14+
grep -q "^Cargo\.lock$" <<<"$CHANGED" && echo "📦 Cargo.lock changed after merge — run: cargo build"
15+
grep -q "^bun\.lockb\?$" <<<"$CHANGED" && echo "📦 bun.lock changed after merge — run: bun install"
16+
grep -q "^uv\.lock$" <<<"$CHANGED" && echo "📦 uv.lock changed after merge — run: uv sync"
17+
grep -q "^flake\.lock$" <<<"$CHANGED" && echo "📦 flake.lock changed after merge — exit and re-enter: nix develop"
18+
19+
LOCAL_HOOK="$(git rev-parse --show-toplevel)/.git-hooks/local-post-merge"
20+
if [ -x "$LOCAL_HOOK" ]; then
21+
exec "$LOCAL_HOOK" "$@"
22+
fi
23+
24+
exit 0

.git-hooks/pre-commit

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2026 ResQ Software
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Canonical ResQ pre-commit shim — source: resq-software/dev.
11+
# Delegates all logic to `resq pre-commit`; runs `.git-hooks/local-pre-commit`
12+
# as a repo-specific escape hatch if present and executable.
13+
14+
set -euo pipefail
15+
16+
[ -n "${GIT_HOOKS_SKIP:-}" ] && exit 0
17+
18+
PROJECT_ROOT="$(git rev-parse --show-toplevel)"
19+
20+
# ── Resolve resq binary ─────────────────────────────────────────────────────
21+
# PATH first (covers nix develop + ~/.cargo/bin on PATH). Soft-skip otherwise
22+
# so a missing backend never blocks a commit silently — the user sees a hint.
23+
RESQ_BIN=""
24+
if command -v resq >/dev/null 2>&1; then
25+
RESQ_BIN="resq"
26+
elif [ -x "$HOME/.cargo/bin/resq" ]; then
27+
RESQ_BIN="$HOME/.cargo/bin/resq"
28+
fi
29+
30+
if [ -n "$RESQ_BIN" ]; then
31+
"$RESQ_BIN" pre-commit --root "$PROJECT_ROOT" "$@"
32+
else
33+
echo "⚠️ resq not found — skipping ResQ pre-commit checks."
34+
echo " Install: enter 'nix develop', or run:"
35+
echo " cargo install --git https://github.com/resq-software/crates resq-cli"
36+
fi
37+
38+
# ── Local override ──────────────────────────────────────────────────────────
39+
LOCAL_HOOK="$PROJECT_ROOT/.git-hooks/local-pre-commit"
40+
if [ -x "$LOCAL_HOOK" ]; then
41+
exec "$LOCAL_HOOK" "$@"
42+
fi

.git-hooks/pre-push

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2026 ResQ Software
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# Canonical ResQ pre-push shim — source: resq-software/dev.
6+
# Force-push guard on main/master, branch naming convention, and an optional
7+
# per-repo local-pre-push hook for language-specific checks
8+
# (e.g. cargo check, ruff check, anchor build).
9+
10+
set -euo pipefail
11+
12+
[ -n "${GIT_HOOKS_SKIP:-}" ] && exit 0
13+
14+
echo "🚀 Running pre-push checks..."
15+
16+
BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null || echo "")
17+
18+
# Capture stdin (the ref info git passes to pre-push) so both the force-push
19+
# guard and any local-pre-push hook can read it.
20+
PUSH_REFS=""
21+
if [ ! -t 0 ]; then
22+
PUSH_REFS=$(cat)
23+
fi
24+
25+
# ── Force-push guard on main/master ─────────────────────────────────────────
26+
case "$BRANCH" in
27+
main|master)
28+
# Only iterate when git actually gave us refs — an empty $PUSH_REFS
29+
# would otherwise feed one blank line through the heredoc and trip
30+
# the guard.
31+
if [ -n "$PUSH_REFS" ]; then
32+
while read -r _local_ref local_sha _remote_ref remote_sha; do
33+
[ -z "$local_sha" ] && continue
34+
if [ "$remote_sha" != "0000000000000000000000000000000000000000" ] && \
35+
[ "$local_sha" != "0000000000000000000000000000000000000000" ]; then
36+
if ! git merge-base --is-ancestor "$remote_sha" "$local_sha" 2>/dev/null; then
37+
echo "❌ Force push to $BRANCH is not allowed."
38+
echo " Override with: git push --no-verify"
39+
exit 1
40+
fi
41+
fi
42+
done <<EOF
43+
$PUSH_REFS
44+
EOF
45+
fi
46+
;;
47+
esac
48+
49+
# ── Branch naming convention ────────────────────────────────────────────────
50+
ALLOWED_PATTERN="^(feat|fix|docs|chore|refactor|test|ci|perf|release)/.*$"
51+
SKIP_BRANCHES="^(main|master|dev|develop|staging|production|changeset-release/.*)$"
52+
53+
if [ -n "$BRANCH" ]; then
54+
if ! grep -qE "$SKIP_BRANCHES" <<<"$BRANCH"; then
55+
if ! grep -qE "$ALLOWED_PATTERN" <<<"$BRANCH"; then
56+
echo "❌ Branch '$BRANCH' does not follow naming convention."
57+
echo " Expected: type/description (e.g. feat/add-login)"
58+
echo " Allowed prefixes: feat, fix, docs, chore, refactor, test, ci, perf, release"
59+
echo " Override with: git push --no-verify"
60+
exit 1
61+
fi
62+
fi
63+
fi
64+
65+
# ── Local override (language-specific checks) ───────────────────────────────
66+
LOCAL_HOOK="$(git rev-parse --show-toplevel)/.git-hooks/local-pre-push"
67+
if [ -x "$LOCAL_HOOK" ]; then
68+
# Re-supply captured stdin so local hooks that inspect refs still work.
69+
"$LOCAL_HOOK" "$@" <<EOF
70+
$PUSH_REFS
71+
EOF
72+
fi
73+
74+
echo "✅ Pre-push checks passed"

.git-hooks/prepare-commit-msg

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
# Copyright 2026 ResQ Software
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# Canonical ResQ prepare-commit-msg shim — source: resq-software/dev.
6+
# Prepends a ticket ref (e.g. PROJ-123) extracted from the branch name.
7+
8+
set -euo pipefail
9+
10+
COMMIT_MSG_FILE="${1:-}"
11+
COMMIT_SOURCE="${2:-}"
12+
13+
case "$COMMIT_SOURCE" in
14+
merge|squash|message|commit) exit 0 ;;
15+
esac
16+
17+
BRANCH=$(git symbolic-ref --short HEAD 2>/dev/null || echo "")
18+
[ -z "$BRANCH" ] && exit 0
19+
20+
TICKET=$(grep -oE '[A-Z]{2,}-[0-9]+' <<<"$BRANCH" | head -1 || true)
21+
if [ -n "$TICKET" ]; then
22+
COMMIT_MSG=$(cat "$COMMIT_MSG_FILE")
23+
if ! grep -qF -- "$TICKET" <<<"$COMMIT_MSG"; then
24+
printf '[%s] %s\n' "$TICKET" "$COMMIT_MSG" > "$COMMIT_MSG_FILE"
25+
fi
26+
fi
27+
28+
LOCAL_HOOK="$(git rev-parse --show-toplevel)/.git-hooks/local-prepare-commit-msg"
29+
if [ -x "$LOCAL_HOOK" ]; then
30+
exec "$LOCAL_HOOK" "$@"
31+
fi

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
<!--
2+
Copyright 2026 ResQ Systems, Inc.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
117
# ResQ Viz
218

319
Real-time 3D visualization for ResQ autonomous drone swarms. A tactical dark-theme dashboard that streams live telemetry, mesh topology, hazard zones, and detection events at 10 Hz over SignalR — rendered in Three.js with a post-processing pipeline, procedural terrain, and a Unity-style free-fly camera.

TODO.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
<!--
2+
Copyright 2026 ResQ Systems, Inc.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
117
# Security Remediation TODO
218

319
Tracking fixes for vulnerabilities identified in the 2026-04-07 security assessment.

src/ResQ.Viz.Web/client/styles/main.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2026 ResQ Systems, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
/* ── Design tokens ────────────────────────────────────────────────────── */
218
:root {
319
--bg: #0d1117;

src/ResQ.Viz.Web/vite.config.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* Copyright 2026 ResQ Systems, Inc.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
import { defineConfig } from 'vite';
218

319
export default defineConfig({

0 commit comments

Comments
 (0)