Skip to content

Commit c58c856

Browse files
committed
chore(docs): improved site metadata and tests
- Enhanced metadata handling in various layout files to improve SEO and user experience. - Introduced a new skill to verify the availability of NVIDIA Elements packages on npm and check the documentation site status. - Added a deterministic script for generating the availability report, including npm metadata checks and temporary project management. - Updated the pre-tool use hook to warn about destructive git operations in isolated VM environments. Signed-off-by: Cory Rylan <crylan@nvidia.com>
1 parent d2ecd86 commit c58c856

26 files changed

Lines changed: 911 additions & 79 deletions

File tree

.agents/hooks/pre-tool-use-bash.sh

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,25 @@ source "$HOOK_DIR/lib/project-root.sh"
77
COMMAND=$(hook_command_from_input "$INPUT" || true)
88
GIT_PREFIX='(^|[;&|][[:space:]]*)git([[:space:]]+(-C[[:space:]]+[^[:space:];&|]+|--no-pager|-c[[:space:]]+[^[:space:];&|]+|--work-tree(=|[[:space:]]+)[^[:space:];&|]+))*[[:space:]]+'
99

10+
if [[ -z "${NVE_AGENT:-}" && -n "${CURSOR_AGENT+x}" && -z "${CURSOR_SANDBOX+x}" ]]; then
11+
export NVE_AGENT="cursor-cloud-agent"
12+
fi
13+
1014
# Exit early if not a git command
1115
if [[ -z "$COMMAND" ]] || ! echo "$COMMAND" | grep -qE '(^|[;&|][[:space:]]*)git([[:space:]]|$)'; then
1216
exit 0
1317
fi
1418

19+
warn() {
20+
echo "WARNING: Destructive git operation detected." >&2
21+
echo " Command: $COMMAND" >&2
22+
echo " Reason: $1." >&2
23+
echo "" >&2
24+
echo "Per AGENTS.md policy, destructive git operations require explicit user confirmation on user machines." >&2
25+
echo "In isolated VM environments, this hook is warning instead of blocking." >&2
26+
exit 0
27+
}
28+
1529
block() {
1630
echo "BLOCKED: Destructive git operation detected." >&2
1731
echo " Command: $COMMAND" >&2
@@ -22,19 +36,27 @@ block() {
2236
exit 2
2337
}
2438

25-
echo "$COMMAND" | grep -qF "reset --hard" && block "git reset --hard discards all uncommitted changes irreversibly"
26-
echo "$COMMAND" | grep -qF "push --force" && block "git push --force can overwrite remote history and destroy teammates' work"
27-
echo "$COMMAND" | grep -qF "push -f" && block "git push -f can overwrite remote history and destroy teammates' work"
28-
echo "$COMMAND" | grep -qF "clean -f" && block "git clean -f permanently deletes untracked files"
29-
echo "$COMMAND" | grep -qF "checkout -- ." && block "git checkout -- . discards all unstaged changes irreversibly"
30-
echo "$COMMAND" | grep -qF "branch -D" && block "git branch -D force-deletes a branch without merge checks"
31-
32-
echo "$COMMAND" | grep -qE "${GIT_PREFIX}(add|stage)([[:space:]]|$)" && block "git add/stage modifies the index"
33-
echo "$COMMAND" | grep -qE "${GIT_PREFIX}restore([[:space:]][^;&|]*)?[[:space:]]--staged([[:space:]]|$)" && block "git restore --staged removes files from the index"
34-
echo "$COMMAND" | grep -qE "${GIT_PREFIX}reset([[:space:]]|$)" && block "git reset modifies the index or moves HEAD"
35-
echo "$COMMAND" | grep -qE "${GIT_PREFIX}rm([[:space:]][^;&|]*)?[[:space:]]--cached([[:space:]]|$)" && block "git rm --cached removes files from the index"
36-
echo "$COMMAND" | grep -qE "${GIT_PREFIX}rm([[:space:]]|$)" && block "git rm stages file removals"
37-
echo "$COMMAND" | grep -qE "${GIT_PREFIX}mv([[:space:]]|$)" && block "git mv stages file renames"
38-
echo "$COMMAND" | grep -qE "${GIT_PREFIX}update-index([[:space:]]|$)" && block "git update-index modifies the index"
39+
handle_blocked_operation() {
40+
if [[ "${NVE_AGENT:-}" == *cloud* ]]; then
41+
warn "$1"
42+
fi
43+
44+
block "$1"
45+
}
46+
47+
echo "$COMMAND" | grep -qF "reset --hard" && handle_blocked_operation "git reset --hard discards all uncommitted changes irreversibly"
48+
echo "$COMMAND" | grep -qF "push --force" && handle_blocked_operation "git push --force can overwrite remote history and destroy teammates' work"
49+
echo "$COMMAND" | grep -qF "push -f" && handle_blocked_operation "git push -f can overwrite remote history and destroy teammates' work"
50+
echo "$COMMAND" | grep -qF "clean -f" && handle_blocked_operation "git clean -f permanently deletes untracked files"
51+
echo "$COMMAND" | grep -qF "checkout -- ." && handle_blocked_operation "git checkout -- . discards all unstaged changes irreversibly"
52+
echo "$COMMAND" | grep -qF "branch -D" && handle_blocked_operation "git branch -D force-deletes a branch without merge checks"
53+
54+
echo "$COMMAND" | grep -qE "${GIT_PREFIX}(add|stage)([[:space:]]|$)" && handle_blocked_operation "git add/stage modifies the index"
55+
echo "$COMMAND" | grep -qE "${GIT_PREFIX}restore([[:space:]][^;&|]*)?[[:space:]]--staged([[:space:]]|$)" && handle_blocked_operation "git restore --staged removes files from the index"
56+
echo "$COMMAND" | grep -qE "${GIT_PREFIX}reset([[:space:]]|$)" && handle_blocked_operation "git reset modifies the index or moves HEAD"
57+
echo "$COMMAND" | grep -qE "${GIT_PREFIX}rm([[:space:]][^;&|]*)?[[:space:]]--cached([[:space:]]|$)" && handle_blocked_operation "git rm --cached removes files from the index"
58+
echo "$COMMAND" | grep -qE "${GIT_PREFIX}rm([[:space:]]|$)" && handle_blocked_operation "git rm stages file removals"
59+
echo "$COMMAND" | grep -qE "${GIT_PREFIX}mv([[:space:]]|$)" && handle_blocked_operation "git mv stages file renames"
60+
echo "$COMMAND" | grep -qE "${GIT_PREFIX}update-index([[:space:]]|$)" && handle_blocked_operation "git update-index modifies the index"
3961

4062
exit 0
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
name: availability-report
3+
description: Generate a production availability report for NVIDIA Elements packages and documentation.
4+
---
5+
6+
# Availability Report
7+
8+
You are an Elements package availability verification agent.
9+
10+
## Goal
11+
12+
Verify that the latest NVIDIA Elements packages are available on npm, confirm the documentation site is live, and generate a brief status report.
13+
14+
## Deterministic Script
15+
16+
Run the deterministic report script:
17+
18+
```shell
19+
node .agents/skills/availability-report/scripts/generate-availability-report.js
20+
```
21+
22+
The script is the source of truth for:
23+
24+
- package order through `PACKAGES`
25+
- docs URL order through `DOCS_URLS`
26+
- npm metadata checks
27+
- npm install checks
28+
- Node package resolution checks
29+
- docs URL checks
30+
- package version comparison
31+
- temporary project creation and cleanup
32+
- status calculation
33+
- report formatting
34+
35+
Do not repeat those lists or the report format in this skill. Update `scripts/generate-availability-report.js` instead.
36+
37+
## Script Behavior
38+
39+
The CLI prints the formatted report to standard output. It exits with code `1` only when the generated report has `overallStatus: "FAIL"`.
40+
41+
The exported API returns both the formatted report and structured data:
42+
43+
```js
44+
const { formattedReport, report } = await generateReport();
45+
```
46+
47+
Return or surface `formattedReport` as the generated report.
48+
49+
The script creates a temporary npm project with:
50+
51+
- `mkdtemp(path.join(os.tmpdir(), 'nvidia-elements-availability-report-'))`
52+
- `npm init -y`
53+
- `npm install --no-audit --no-fund ...`
54+
55+
It removes the temporary project before returning the report.
56+
57+
## Report Workflow
58+
59+
1. Run the deterministic script from the repository root.
60+
2. Return or surface the exact formatted report produced by the script.
61+
3. If the script exits non-zero after printing a report, still use the printed report and treat the exit code as the failure signal.
62+
63+
Do not rewrite, summarize, or recompute the generated report.
64+
65+
Report delivery is outside this skill.
66+
67+
## Debugging
68+
69+
- Use `--json` to print structured report data.
70+
- Use `--timestamp <iso-utc>` only for deterministic verification.
71+
- Stop early only for environment-level problems, such as missing `npm`.

0 commit comments

Comments
 (0)