Skip to content

ops: add weekly growth review scaffold#39

Merged
hudsonaikins merged 1 commit into
mainfrom
codex/design-partner-operations
Apr 12, 2026
Merged

ops: add weekly growth review scaffold#39
hudsonaikins merged 1 commit into
mainfrom
codex/design-partner-operations

Conversation

@hudsonaikins
Copy link
Copy Markdown
Contributor

@hudsonaikins hudsonaikins commented Apr 12, 2026

Summary

  • add a repo-native script to scaffold the weekly adoption review and dashboard row
  • prefill the review with current release metadata when gh is available
  • document the script in the growth dashboard and weekly review docs

Testing

  • bash -n scripts/growth/scaffold-weekly-review.sh
  • bash scripts/growth/scaffold-weekly-review.sh --week-of 2026-04-13 --owner "Hudson Aikins" --release-version v0.1.3 --release-downloads 42 --homebrew-installs 3 --output /tmp/profitctl-weekly-review-test.md --force

Greptile Summary

This PR adds scripts/growth/scaffold-weekly-review.sh, a Bash script that generates a prefilled weekly-review Markdown file and a matching adoption-dashboard row, optionally pulling the latest release metadata from GitHub via gh release view. The three docs files (README.md, adoption-dashboard.md, weekly-review-template.md) are updated to reference the new script.

Confidence Score: 5/5

Safe to merge; only P2 robustness suggestions remain.

All findings are P2 style/robustness improvements (undocumented python3 dependency, unguarded shift 2). The docs changes are clean and consistent. No logic errors, security issues, or broken behaviour on the happy path.

scripts/growth/scaffold-weekly-review.sh — the python3 guard and shift 2 guard are worth a quick fix before wider adoption.

Important Files Changed

Filename Overview
scripts/growth/scaffold-weekly-review.sh New bash scaffold script; uses python3 for JSON parsing without a guard, and shift 2 on option value is unprotected against a missing argument.
docs/growth/README.md Added step 19 documenting the scaffold script invocation — looks correct and consistent.
docs/growth/adoption-dashboard.md Added "Fastest path" bash snippet and description of the scaffold script output — consistent with the script.
docs/growth/weekly-review-template.md Added scaffold script reference at the top and the private-notes guidance — no issues.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A([scaffold-weekly-review.sh]) --> B[Parse CLI args]
    B --> C{output_path set?}
    C -- No --> D[Default: /tmp/profitctl-weekly-review-WEEK.md]
    C -- Yes --> E{File exists & no --force?}
    D --> E
    E -- Yes --> F[Exit 1: use --force]
    E -- No --> G{release_version or release_downloads missing?}
    G -- No --> K
    G -- Yes --> H{gh available?}
    H -- No --> K
    H -- Yes --> I[gh release view --json tagName,assets]
    I --> J[python3: parse tagName & downloadCount]
    J --> K[mkdir -p dirname output_path]
    K --> L[Write Markdown review scaffold]
    L --> M[Print dashboard row to stdout]
Loading
Prompt To Fix All With AI
This is a comment left during a code review.
Path: scripts/growth/scaffold-weekly-review.sh
Line: 91-94

Comment:
**Undocumented `python3` dependency may cause unexpected exit**

`python3` is called inside the `if gh ...` block without a prior `command -v python3` guard. With `set -euo pipefail` active, if `python3` is absent (e.g. minimal CI, Alpine containers) the script exits with a cryptic "command not found" error instead of gracefully leaving the release fields empty. The usage block and `--help` output also don't mention this requirement.

Consider using `gh`'s built-in `--jq` flag (no extra binary needed) or adding a guard similar to the `gh` check:

```bash
if [[ -z "${release_version}" ]]; then
  release_version="$(gh release view --repo IntelIP/ProfitCtl --json tagName --jq '.tagName' 2>/dev/null || true)"
fi
if [[ -z "${release_downloads}" ]]; then
  release_downloads="$(gh release view --repo IntelIP/ProfitCtl --json assets --jq '[.assets[].downloadCount] | add // 0' 2>/dev/null || true)"
fi
```

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: scripts/growth/scaffold-weekly-review.sh
Line: 38-61

Comment:
**`shift 2` unguarded when option value is omitted**

Every value-taking option (e.g. `--week-of`, `--owner`, `--output`) uses `${2:-}` to silently accept an empty value, but still calls `shift 2`. If one of these flags is passed as the very last argument (no value following), `$#` is 1, `shift 2` exits with a non-zero status, and `set -e` kills the script with no useful message.

A common guard pattern:

```bash
--week-of)
  [[ $# -ge 2 ]] || { echo "Missing value for --week-of" >&2; exit 1; }
  week_of="$2"
  shift 2
  ;;
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "ops: add weekly growth review scaffold" | Re-trigger Greptile

Greptile also left 2 inline comments on this PR.

@hudsonaikins hudsonaikins merged commit f509b7f into main Apr 12, 2026
3 checks passed
@hudsonaikins hudsonaikins deleted the codex/design-partner-operations branch April 12, 2026 20:20
Comment on lines +91 to +94
release_version="$(printf '%s' "${release_json}" | python3 -c 'import json,sys; data=json.load(sys.stdin); print(data.get("tagName",""))')"
fi
if [[ -z "${release_downloads}" ]]; then
release_downloads="$(printf '%s' "${release_json}" | python3 -c 'import json,sys; data=json.load(sys.stdin); print(sum(a.get("downloadCount",0) for a in data.get("assets",[])))')"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Undocumented python3 dependency may cause unexpected exit

python3 is called inside the if gh ... block without a prior command -v python3 guard. With set -euo pipefail active, if python3 is absent (e.g. minimal CI, Alpine containers) the script exits with a cryptic "command not found" error instead of gracefully leaving the release fields empty. The usage block and --help output also don't mention this requirement.

Consider using gh's built-in --jq flag (no extra binary needed) or adding a guard similar to the gh check:

if [[ -z "${release_version}" ]]; then
  release_version="$(gh release view --repo IntelIP/ProfitCtl --json tagName --jq '.tagName' 2>/dev/null || true)"
fi
if [[ -z "${release_downloads}" ]]; then
  release_downloads="$(gh release view --repo IntelIP/ProfitCtl --json assets --jq '[.assets[].downloadCount] | add // 0' 2>/dev/null || true)"
fi
Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/growth/scaffold-weekly-review.sh
Line: 91-94

Comment:
**Undocumented `python3` dependency may cause unexpected exit**

`python3` is called inside the `if gh ...` block without a prior `command -v python3` guard. With `set -euo pipefail` active, if `python3` is absent (e.g. minimal CI, Alpine containers) the script exits with a cryptic "command not found" error instead of gracefully leaving the release fields empty. The usage block and `--help` output also don't mention this requirement.

Consider using `gh`'s built-in `--jq` flag (no extra binary needed) or adding a guard similar to the `gh` check:

```bash
if [[ -z "${release_version}" ]]; then
  release_version="$(gh release view --repo IntelIP/ProfitCtl --json tagName --jq '.tagName' 2>/dev/null || true)"
fi
if [[ -z "${release_downloads}" ]]; then
  release_downloads="$(gh release view --repo IntelIP/ProfitCtl --json assets --jq '[.assets[].downloadCount] | add // 0' 2>/dev/null || true)"
fi
```

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +38 to +61
--week-of)
week_of="${2:-}"
shift 2
;;
--owner)
owner="${2:-}"
shift 2
;;
--release-version)
release_version="${2:-}"
shift 2
;;
--release-downloads)
release_downloads="${2:-}"
shift 2
;;
--homebrew-installs)
homebrew_installs="${2:-}"
shift 2
;;
--output)
output_path="${2:-}"
shift 2
;;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 shift 2 unguarded when option value is omitted

Every value-taking option (e.g. --week-of, --owner, --output) uses ${2:-} to silently accept an empty value, but still calls shift 2. If one of these flags is passed as the very last argument (no value following), $# is 1, shift 2 exits with a non-zero status, and set -e kills the script with no useful message.

A common guard pattern:

--week-of)
  [[ $# -ge 2 ]] || { echo "Missing value for --week-of" >&2; exit 1; }
  week_of="$2"
  shift 2
  ;;
Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/growth/scaffold-weekly-review.sh
Line: 38-61

Comment:
**`shift 2` unguarded when option value is omitted**

Every value-taking option (e.g. `--week-of`, `--owner`, `--output`) uses `${2:-}` to silently accept an empty value, but still calls `shift 2`. If one of these flags is passed as the very last argument (no value following), `$#` is 1, `shift 2` exits with a non-zero status, and `set -e` kills the script with no useful message.

A common guard pattern:

```bash
--week-of)
  [[ $# -ge 2 ]] || { echo "Missing value for --week-of" >&2; exit 1; }
  week_of="$2"
  shift 2
  ;;
```

How can I resolve this? If you propose a fix, please make it concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant