Skip to content

Fix/bugs#13

Open
Lftobs wants to merge 3 commits into
devfrom
fix/bugs
Open

Fix/bugs#13
Lftobs wants to merge 3 commits into
devfrom
fix/bugs

Conversation

@Lftobs

@Lftobs Lftobs commented Jun 16, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added standardized GitHub issue templates for bug reports and feature requests.
    • Added GitHub pull request template.
    • Introduced security vulnerability scanning workflow.
    • Added monitoring dashboard for deployed applications.
  • Bug Fixes

    • Improved deployment pipeline robustness; cleanup failures no longer mask deployment outcomes.
  • Chores

    • Updated default configuration values for ports and queue concurrency.
    • Enhanced installation script with dashboard provisioning.
    • Added MIT License.
    • Updated monitoring infrastructure configuration.
    • Added comprehensive contributing guidelines.

Lftobs added 2 commits June 16, 2026 12:09
configuration management

- Update docker-compose and install scripts to
  handle monitoring configs
  and Grafana dashboards more effectively
- Strengthen pipeline workspace cleanup to prevent
  blocking deployments
- Centralize and update system configurations in
  the API
- Add default admin email and network filtering to
  monitoring stack
security CI

- Add GitHub issue templates for bug reports and
  feature requests
- Add a pull request template for standardized
  contributions
- Add a security workflow for scanning for
  forbidden patterns and vulnerabilities
- Add a version bump utility script
- Add Grafana dashboard provisioning for
  monitoring
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@Lftobs, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 52 minutes and 22 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bc4f371c-6411-4fbf-9307-7cfc45ab0b9e

📥 Commits

Reviewing files that changed from the base of the PR and between ffdceb5 and fb2e810.

📒 Files selected for processing (2)
  • .github/ISSUE_TEMPLATE/bug_report.md
  • .github/ISSUE_TEMPLATE/feature_request.md
📝 Walkthrough

Walkthrough

This PR adds Grafana dashboard provisioning (new deployed-apps dashboard, datasource UIDs, dashboards.yml provider), hardens docker-compose service configs (Prometheus TSDB rebuild, buildkit healthcheck, Caddy email default), introduces a security scan CI workflow with a forbidden-pattern script and Lazarus scanner, refactors the API config.ts with a SYSTEM constant and updated defaults, isolates pipeline cleanup errors, and adds community health files (LICENSE, CONTRIBUTING.md, issue/PR templates, bump.sh tooling).

Changes

Monitoring Stack Improvements

Layer / File(s) Summary
Grafana dashboard provisioning and datasource UIDs
infra/monitoring/grafana/dashboards/dashboards.yml, infra/monitoring/grafana/dashboards/deployed-apps.json, infra/monitoring/grafana/datasources/prometheus.yml, infra/monitoring/grafana/datasources/loki.yml
Adds dashboards.yml provider config and a new deployed-apps.json dashboard with CPU, memory, and Loki log panels; adds uid fields to Prometheus and Loki datasource YAMLs for stable cross-reference.
docker-compose service hardening and Caddy email default
docker-compose.yml, infra/caddy/Caddyfile, infra/monitoring/promtail-config.yml, .github/workflows/release.yml
Updates buildkit healthcheck to HTTP wget, sets CADDY_EMAIL default to admin@dequel.local, adds Prometheus TSDB index rebuild and WAL compression on startup, mounts Grafana dashboards provisioning volume, filters Promtail to the dequel_net Docker network, and simplifies the release tarball step to copy the full infra/monitoring directory.
Install script dashboard support and non-interactive prompts
scripts/install.sh
Creates Grafana dashboards directory, downloads dashboards.yml and deployed-apps.json during config fetch, and replaces blocking stdin prompts with TTY-aware prompting that gracefully skips in non-interactive environments.

Security Scan CI Workflow

Layer / File(s) Summary
Forbidden pattern scan script
scripts/workflow/forbidden-pattern-scan.sh
Bash script using git grep to detect the global['!'] forbidden literal in tracked files, reporting matches to stderr and exiting non-zero on any hit.
Security Scans CI workflow
.github/workflows/vuln-scan.yml
New GitHub Actions workflow with concurrency cancellation running two jobs: the local forbidden-pattern scan and a remote Lazarus Python scanner downloaded via curl.

API Config Refactor and Pipeline Cleanup Fix

Layer / File(s) Summary
config.ts SYSTEM constant and default value updates
apps/api/src/utils/config.ts
Extracts database/workspace/caddy/network path defaults into a SYSTEM constant spread into config; changes port to 17474, appInternalPort to 17476, and queueConcurrency to 3.
pipeline.ts finally-block cleanup isolation
apps/api/src/orchestrator/pipeline.ts
Wraps workspace cleanup and archive removal in separate try/catch blocks with force: true on the rm call so neither cleanup failure can mask the deployment result.

Community Health Files and Version Bump Tooling

Layer / File(s) Summary
LICENSE and CONTRIBUTING.md
LICENSE, CONTRIBUTING.md
Adds MIT LICENSE and populates CONTRIBUTING.md with setup, coding conventions, migration, testing, versioning, PR/release process, and discussion links.
GitHub issue and PR templates
.github/ISSUE_TEMPLATE/*, .github/PULL_REQUEST_TEMPLATE.md
Adds bug_report.yml and feature_request.yml issue form templates, config.yml disabling blank issues with contact links, and a PR template with type checklist and review items.
bump.sh version bump script and root symlink
bump.sh, scripts/workflow/bump.sh
Adds scripts/workflow/bump.sh implementing semver validation, VERSION file update, bun run sync-versions, interactive CHANGELOG.md entry, and run summary; root bump.sh converted to a symlink.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰 A rabbit hops through infra land,
Dashboards bloom at Grafana's hand,
Forbidden patterns meet their scan,
Ports updated, config planned,
With templates set and license signed—
The warren's tidy, well-defined! 🌿

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'Fix/bugs' is vague and generic, using non-descriptive terms that fail to convey meaningful information about the substantial changeset covering templates, workflows, monitoring, configuration, and scripts. Replace with a specific title describing the main change, such as 'Add GitHub issue/PR templates and monitoring infrastructure' or 'Set up CI workflows and Grafana dashboards'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/bugs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Replace YAML issue forms with standard Markdown
templates to reduce
overhead.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 10

🧹 Nitpick comments (7)
.github/workflows/vuln-scan.yml (1)

17-18: ⚡ Quick win

Harden checkout step with persist-credentials: false.

Setting persist-credentials: false prevents the GitHub token from persisting in the local git config, reducing risk if subsequent steps are compromised. Static analysis also flagged unpinned action references—consider pinning to a SHA for tag-poisoning protection.

🛡️ Proposed hardening
             - name: Checkout
-              uses: actions/checkout@v4
+              uses: actions/checkout@v4  # or pin to SHA: actions/checkout@<sha>
+              with:
+                  persist-credentials: false

Apply the same change to the checkout step in the lazarus-scanner job (line 27-28).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/vuln-scan.yml around lines 17 - 18, The checkout action in
the vuln-scan workflow lacks security hardening. Add `persist-credentials:
false` to the `actions/checkout@v4` step to prevent GitHub tokens from
persisting in the local git config and reduce compromise risk. Additionally,
consider pinning the action reference from `@v4` to a specific SHA hash to
protect against tag-poisoning attacks. Apply these same hardening measures to
all checkout steps in the workflow file, including those in other job sections.

Source: Linters/SAST tools

scripts/install.sh (1)

140-140: 💤 Low value

Redundant directory creation.

The data directory is already created by setup_directories() at line 57. This mkdir -p call is harmless but unnecessary.

♻️ Proposed cleanup
-	mkdir -p "$INSTALL_DIR/data"
-
 	local ENC_KEY
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/install.sh` at line 140, Remove the redundant mkdir -p
"$INSTALL_DIR/data" call at line 140 in scripts/install.sh because the data
directory is already created by the setup_directories() function called earlier
in the script. Simply delete this line as it performs duplicate directory
creation that is unnecessary.
.github/PULL_REQUEST_TEMPLATE.md (1)

27-27: ⚡ Quick win

Clarify "no comments" in the code style checklist.

The phrase "no comments" is ambiguous—it could mean "no commented-out code" (good practice) or "no code comments" (which would discourage helpful documentation). Consider rewording for clarity.

💡 Suggested rewording
-- [ ] My code follows the project's code style (no comments, named exports, functional components, etc.)
+- [ ] My code follows the project's code style (no commented-out code, named exports, functional components, etc.)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/PULL_REQUEST_TEMPLATE.md at line 27, The phrase "no comments" in the
code style checklist item is ambiguous and could be misinterpreted as
discouraging helpful documentation. Reword this checklist item to clarify that
it specifically refers to avoiding commented-out code while still allowing
necessary documentation comments. Replace the unclear "no comments" phrase with
more explicit language like "no commented-out code" or "no dead code" to make
the intent unambiguous.
.github/ISSUE_TEMPLATE/feature_request.yml (1)

45-60: ⚡ Quick win

Add missing "Docker / Deployment" component option.

The bug report template includes "Docker / Deployment" as a component option, but this feature request template omits it. Deployment-related feature requests are valid use cases and should be supported for consistency.

📝 Proposed fix to add the missing component
       options:
         - API (Backend)
         - Web Dashboard (Frontend)
         - Docs
         - CLI / Install Script
+        - Docker / Deployment
         - Build System (Railpack / BuildKit)
         - Caddy / Ingress
         - Monitoring (Prometheus / Grafana / Loki)
         - Other
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/ISSUE_TEMPLATE/feature_request.yml around lines 45 - 60, The
feature_request.yml template is missing the "Docker / Deployment" component
option that exists in the bug report template, creating an inconsistency. Add
"Docker / Deployment" to the options list in the Affected Component dropdown to
ensure feature requests related to deployment can be properly categorized,
maintaining parity with the bug report template options.
.github/ISSUE_TEMPLATE/bug_report.yml (1)

83-98: ⚡ Quick win

Add missing "Deployment:" field to match the example.

The description example (line 92) shows **Deployment**: Docker Compose / Bare metal, but the prefilled value template (lines 93-97) omits this field. Users seeing the example will expect a corresponding entry in the template.

📝 Proposed fix to add the missing field
       value: |
         - OS:
         - Docker version:
         - Bun version (if relevant):
         - Browser (if relevant):
+        - Deployment (if relevant):
     validations:
       required: false
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/ISSUE_TEMPLATE/bug_report.yml around lines 83 - 98, The Environment
textarea's value template is missing a "Deployment:" field entry that is shown
in the description examples. Add a new line with "- Deployment:" to the
prefilled value template in the Environment section so that users see all the
fields documented in the example, making the template complete and consistent
with the provided examples.
apps/api/src/utils/config.ts (1)

55-59: ⚡ Quick win

Verify queueConcurrency default increase is appropriate.

The default queueConcurrency increased from 1 (sequential) to 3 (parallel). This changes the default behavior to process up to 3 deployments concurrently, which could impact resource usage (CPU, memory, buildkit load).

Confirm this default is appropriate for typical deployment scenarios and won't cause resource contention issues.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/api/src/utils/config.ts` around lines 55 - 59, The default value for
queueConcurrency in the withFile configuration has been increased from 1 to 3,
enabling parallel processing of up to 3 deployments concurrently. Review and
confirm this default value is appropriate for typical deployment scenarios and
assess whether it could cause resource contention issues with CPU, memory, or
buildkit load. If testing or deployment experience shows that this default
causes problems, reduce it back to a more conservative value such as 1 or 2.
Document the reasoning behind the chosen default value to help future
maintainers understand the performance tradeoff.
scripts/workflow/bump.sh (1)

73-91: ⚡ Quick win

Consider making the target branch flexible.

Line 90 hardcodes the main branch in the push instruction, but this PR targets the dev branch. The assumed branch may not match the user's workflow.

💡 Suggested improvement to detect current branch
 print_summary() {
   local version="$1"
   local changelog_updated="$2"
+  local branch
+  branch=$(git branch --show-current)
   echo ""
   echo -e "${CYAN}=== Summary ===${NC}"
   echo -e "  VERSION:        ${GREEN}$version${NC}"
   echo -e "  package.json:   ${GREEN}synced${NC}"
   if [ "$changelog_updated" = true ]; then
     echo -e "  CHANGELOG:      ${GREEN}updated${NC}"
   else
     echo -e "  CHANGELOG:      ${YELLOW}skipped${NC}"
   fi
   echo ""
   echo -e "Next steps:"
   echo -e "  ${YELLOW}1. Review CHANGELOG.md${NC}"
   echo -e "  ${YELLOW}2. Commit: git add -A && git commit -m \"chore: bump to v$version\"${NC}"
   echo -e "  ${YELLOW}3. Tag:    git tag v$version${NC}"
-  echo -e "  ${YELLOW}4. Push:   git push origin main --tags${NC}"
+  echo -e "  ${YELLOW}4. Push:   git push origin $branch --tags${NC}"
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/workflow/bump.sh` around lines 73 - 91, The print_summary function
contains a hardcoded "main" branch name in the git push instruction (line 90),
which does not adapt to different branch workflows. Modify the function to
dynamically detect and use the current branch instead of hardcoding "main".
Either pass the current branch as a parameter to print_summary or detect it
within the function using git rev-parse --abbrev-ref HEAD, then update the git
push command to use this dynamic branch name instead of the hardcoded "main"
value.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/vuln-scan.yml:
- Around line 1-11: The Security Scans workflow currently runs with default
write-all permissions, but security scanning only requires read access. Add an
explicit permissions block to the workflow (at the top level, after the
concurrency section) that specifies contents: read to follow least-privilege
security practices and prevent potential credential leakage from future
modifications to the workflow.
- Around line 35-42: The workflow downloads lazarus_scanner.py from the main
branch of an external repository without any integrity verification, creating a
supply-chain attack risk. Modify the download step to pin the URL to a specific
commit hash instead of main, and add SHA256 checksum verification after the
download. Capture the expected checksum for that specific commit version and add
a verification step using sha256sum that validates the downloaded file before
the "Run Lazarus scanner" step executes python3 lazarus_scanner.py. The checksum
verification should fail and exit with an error message if the hash does not
match, preventing execution of unverified code.

In `@apps/api/src/utils/config.ts`:
- Around line 26-36: The SYSTEM constant contains hardcoded values for
databasePath, workspaceRoot, caddyRoutesDir, dockerNetwork, buildkitHost, and
redisUrl that were previously configurable via environment variables or config
files. To restore configurability, replace the hardcoded string values in the
SYSTEM constant with calls to withFile for each of these properties, allowing
deployments to override these settings through configuration files or
environment variables as they could previously.
- Around line 37-41: The port and appInternalPort configuration defaults in
config.ts have been changed (from 3001 to 17474 and 3000 to 17476 respectively),
but this change has not been propagated to the supporting infrastructure,
causing a mismatch that will break the application. Update the corresponding
port values in docker-compose.yml (both environment variables and health check
URLs), test files (hardcoded appInternalPort values and reverse proxy targets),
infra/monitoring/prometheus.yml (API targets), and all documentation files
(README, CONTRIBUTING, AGENTS, docs/) to consistently use the new port values;
alternatively, if these port changes were made prematurely, revert the port
configuration changes in config.ts for both the port and appInternalPort fields
to restore consistency.

In `@CONTRIBUTING.md`:
- Around line 34-41: Update the local development guide section in
CONTRIBUTING.md to correct the port numbers and entry point commands for all
three services. Replace the API section comment and command to use port 17474
(the default) with the command `bun run dev`. Update the Web dashboard section
to specify port 5173 for development (not 3000) with the command `bun run dev`.
Update the Docs section to use port 3000 (not 4321) with the command `bun run
dev`. Remove the incorrect file paths (`bun apps/web/src/main.tsx` and `bun
apps/docs/src/main.tsx`) and replace them with the proper `bun run dev` command,
as the original commands reference non-existent entry point files. Optionally
add a note that these commands can also be run from the workspace root with
appropriate filters if configured.

In `@infra/monitoring/promtail-config.yml`:
- Around line 17-19: The source label
`__meta_docker_container_network_dequel_net` on line 17 is not a documented
Docker service discovery meta label, causing the `action: keep` filter to fail
and stop all container log ingestion. Replace
`__meta_docker_container_network_dequel_net` with the correct documented meta
label `__meta_docker_network_name` to properly filter containers by network.

In `@scripts/install.sh`:
- Around line 145-153: The script creates dequel.json with potentially insecure
defaults when running in non-interactive mode (without TTY), where
prompt_config() skips user prompts but still writes the file with empty
CADDY_BASE_DOMAIN and a potentially insecure ENV_ENCRYPTION_KEY. To fix this,
check whether the script is running in a TTY (interactive mode) before executing
the dequel.json creation block that uses cat with the EOF delimiter. Only create
the dequel.json file with the CADDY_BASE_DOMAIN, ENV_ENCRYPTION_KEY, and
GITHUB_APP_NAME values when the script is running interactively. In
non-interactive mode, skip this file creation entirely and update the warning
message to clarify that both .env variables and manual dequel.json configuration
may be required.
- Around line 142-143: The ENC_KEY variable assignment has an insecure fallback
that silently uses a hardcoded string "dev-env-key-change-me" if both openssl
rand and dd commands fail, which could allow insecure keys to be deployed to
production without user awareness. Replace the final fallback clause (the `||
echo "dev-env-key-change-me"` part) with a fail-fast mechanism that logs an
error message and exits the script, ensuring the installation stops immediately
when secure key generation is impossible rather than continuing with a
known-insecure default.

In `@scripts/workflow/bump.sh`:
- Around line 46-71: The sed command in the add_changelog_entry function uses
the non-portable sed -i syntax without a backup extension, which fails on BSD
sed (macOS). Change the sed -i invocation to use sed -i'' (with empty quotes)
instead, which is compatible with both GNU sed and BSD sed. This modification
should be applied to the sed command that appends the changelog entry to the
CHANGELOG.md file.
- Around line 12-18: The validate_version function uses grep with the -P flag
which is GNU-specific Perl regex syntax and not available in BSD grep (used on
macOS). Replace the grep command to use POSIX ERE syntax instead by changing the
flag from -P to -E and converting the Perl regex pattern to POSIX ERE format.
Specifically, in the grep command within validate_version, replace the \d+
patterns with [0-9]+ and use -E flag instead of -P to ensure the pattern works
across both GNU and BSD grep implementations.

---

Nitpick comments:
In @.github/ISSUE_TEMPLATE/bug_report.yml:
- Around line 83-98: The Environment textarea's value template is missing a
"Deployment:" field entry that is shown in the description examples. Add a new
line with "- Deployment:" to the prefilled value template in the Environment
section so that users see all the fields documented in the example, making the
template complete and consistent with the provided examples.

In @.github/ISSUE_TEMPLATE/feature_request.yml:
- Around line 45-60: The feature_request.yml template is missing the "Docker /
Deployment" component option that exists in the bug report template, creating an
inconsistency. Add "Docker / Deployment" to the options list in the Affected
Component dropdown to ensure feature requests related to deployment can be
properly categorized, maintaining parity with the bug report template options.

In @.github/PULL_REQUEST_TEMPLATE.md:
- Line 27: The phrase "no comments" in the code style checklist item is
ambiguous and could be misinterpreted as discouraging helpful documentation.
Reword this checklist item to clarify that it specifically refers to avoiding
commented-out code while still allowing necessary documentation comments.
Replace the unclear "no comments" phrase with more explicit language like "no
commented-out code" or "no dead code" to make the intent unambiguous.

In @.github/workflows/vuln-scan.yml:
- Around line 17-18: The checkout action in the vuln-scan workflow lacks
security hardening. Add `persist-credentials: false` to the
`actions/checkout@v4` step to prevent GitHub tokens from persisting in the local
git config and reduce compromise risk. Additionally, consider pinning the action
reference from `@v4` to a specific SHA hash to protect against tag-poisoning
attacks. Apply these same hardening measures to all checkout steps in the
workflow file, including those in other job sections.

In `@apps/api/src/utils/config.ts`:
- Around line 55-59: The default value for queueConcurrency in the withFile
configuration has been increased from 1 to 3, enabling parallel processing of up
to 3 deployments concurrently. Review and confirm this default value is
appropriate for typical deployment scenarios and assess whether it could cause
resource contention issues with CPU, memory, or buildkit load. If testing or
deployment experience shows that this default causes problems, reduce it back to
a more conservative value such as 1 or 2. Document the reasoning behind the
chosen default value to help future maintainers understand the performance
tradeoff.

In `@scripts/install.sh`:
- Line 140: Remove the redundant mkdir -p "$INSTALL_DIR/data" call at line 140
in scripts/install.sh because the data directory is already created by the
setup_directories() function called earlier in the script. Simply delete this
line as it performs duplicate directory creation that is unnecessary.

In `@scripts/workflow/bump.sh`:
- Around line 73-91: The print_summary function contains a hardcoded "main"
branch name in the git push instruction (line 90), which does not adapt to
different branch workflows. Modify the function to dynamically detect and use
the current branch instead of hardcoding "main". Either pass the current branch
as a parameter to print_summary or detect it within the function using git
rev-parse --abbrev-ref HEAD, then update the git push command to use this
dynamic branch name instead of the hardcoded "main" value.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 426f10f6-efeb-4e8a-89b1-d03f8397cc92

📥 Commits

Reviewing files that changed from the base of the PR and between cecc54a and ffdceb5.

📒 Files selected for processing (21)
  • .github/ISSUE_TEMPLATE/bug_report.yml
  • .github/ISSUE_TEMPLATE/config.yml
  • .github/ISSUE_TEMPLATE/feature_request.yml
  • .github/PULL_REQUEST_TEMPLATE.md
  • .github/workflows/release.yml
  • .github/workflows/vuln-scan.yml
  • CONTRIBUTING.md
  • LICENSE
  • apps/api/src/orchestrator/pipeline.ts
  • apps/api/src/utils/config.ts
  • bump.sh
  • docker-compose.yml
  • infra/caddy/Caddyfile
  • infra/monitoring/grafana/dashboards/dashboards.yml
  • infra/monitoring/grafana/dashboards/deployed-apps.json
  • infra/monitoring/grafana/datasources/loki.yml
  • infra/monitoring/grafana/datasources/prometheus.yml
  • infra/monitoring/promtail-config.yml
  • scripts/install.sh
  • scripts/workflow/bump.sh
  • scripts/workflow/forbidden-pattern-scan.sh

Comment on lines +1 to +11
name: Security Scans

on:
push:
pull_request:
workflow_dispatch:

concurrency:
group: security-scans-${{ github.ref }}
cancel-in-progress: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add explicit minimal permissions for least-privilege security.

The workflow runs with default write-all permissions, but a read-only scan only requires contents: read. Explicit permissions also protect against future credential leakage if steps are added.

🛡️ Proposed fix to add permissions block
 name: Security Scans

 on:
     push:
     pull_request:
     workflow_dispatch:

+permissions:
+    contents: read
+
 concurrency:
     group: security-scans-${{ github.ref }}
     cancel-in-progress: true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
name: Security Scans
on:
push:
pull_request:
workflow_dispatch:
concurrency:
group: security-scans-${{ github.ref }}
cancel-in-progress: true
name: Security Scans
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: security-scans-${{ github.ref }}
cancel-in-progress: true
🧰 Tools
🪛 zizmor (1.25.2)

[warning] 1-43: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/vuln-scan.yml around lines 1 - 11, The Security Scans
workflow currently runs with default write-all permissions, but security
scanning only requires read access. Add an explicit permissions block to the
workflow (at the top level, after the concurrency section) that specifies
contents: read to follow least-privilege security practices and prevent
potential credential leakage from future modifications to the workflow.

Source: Linters/SAST tools

Comment on lines +35 to +42
- name: Download lazarus_scanner.py
run: |
curl -fsSL -o lazarus_scanner.py \
https://raw.githubusercontent.com/hngprojects/lazarus-scanner/main/lazarus_scanner.py
[ -s lazarus_scanner.py ] || { echo "FAIL: lazarus_scanner.py is empty or missing"; exit 1; }

- name: Run Lazarus scanner
run: python3 lazarus_scanner.py

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Remote code execution without integrity verification is a supply-chain risk.

The workflow downloads and executes a Python script from an external repository with no checksum validation. If that repository is compromised, malicious code runs with full repository access. For a security-focused workflow, this is particularly concerning.

Consider pinning to a specific commit and verifying a SHA256 checksum:

🛡️ Proposed fix with checksum verification
             - name: Download lazarus_scanner.py
               run: |
-                  curl -fsSL -o lazarus_scanner.py \
-                    https://raw.githubusercontent.com/hngprojects/lazarus-scanner/main/lazarus_scanner.py
-                  [ -s lazarus_scanner.py ] || { echo "FAIL: lazarus_scanner.py is empty or missing"; exit 1; }
+                  SCANNER_SHA256="<expected-sha256-hash>"  # Pin to known-good hash
+                  curl -fsSL -o lazarus_scanner.py \
+                    https://raw.githubusercontent.com/hngprojects/lazarus-scanner/<commit-sha>/lazarus_scanner.py
+                  echo "${SCANNER_SHA256}  lazarus_scanner.py" | sha256sum -c - || {
+                    echo "FAIL: checksum mismatch for lazarus_scanner.py"; exit 1;
+                  }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/vuln-scan.yml around lines 35 - 42, The workflow downloads
lazarus_scanner.py from the main branch of an external repository without any
integrity verification, creating a supply-chain attack risk. Modify the download
step to pin the URL to a specific commit hash instead of main, and add SHA256
checksum verification after the download. Capture the expected checksum for that
specific commit version and add a verification step using sha256sum that
validates the downloaded file before the "Run Lazarus scanner" step executes
python3 lazarus_scanner.py. The checksum verification should fail and exit with
an error message if the hash does not match, preventing execution of unverified
code.

Comment on lines +26 to +36
const SYSTEM = {
databasePath: "/app/data/dequel.db",
workspaceRoot: "/app/workspace",
caddyRoutesDir: "/caddy/routes",
dockerNetwork: "dequel_net",
buildkitHost: "tcp://buildkit:1234",
redisUrl: "redis://redis:6379",
} as const;

export const config = {
port: withFile<number>("PORT", "3001", Number),
databasePath: withFile<string>("DATABASE_PATH", "/app/data/dequel.db"),
workspaceRoot: withFile<string>("WORKSPACE_ROOT", "/app/workspace"),
caddyRoutesDir: withFile<string>("CADDY_ROUTES_DIR", "/caddy/routes"),
caddyBaseDomain: withFile<string>("CADDY_BASE_DOMAIN", "localhost"),
dockerNetwork: withFile<string>("DOCKER_NETWORK", "dequel_net"),
appInternalPort: withFile<number>("APP_INTERNAL_PORT", "3000", Number),
buildkitHost: withFile<string>("BUILDKIT_HOST", "tcp://buildkit:1234"),
envEncryptionKey: withFile<string>("ENV_ENCRYPTION_KEY", "dev-env-key-change-me"),
redisUrl: withFile<string>("REDIS_URL", "redis://redis:6379"),
queueConcurrency: withFile<number>("QUEUE_CONCURRENCY", "1", Number),
queueRetryMax: withFile<number>("QUEUE_RETRY_MAX", "5", Number),
queueRetryBaseMs: withFile<number>("QUEUE_RETRY_BASE_MS", "5000", Number),
smtpHost: withFile<string>("SMTP_HOST", ""),
smtpPort: withFile<number>("SMTP_PORT", "587", Number),
smtpUser: withFile<string>("SMTP_USER", ""),
smtpPass: withFile<string>("SMTP_PASS", ""),
smtpFrom: withFile<string>("SMTP_FROM", "dequel@localhost"),
alertEvalIntervalMs: withFile<number>("ALERT_EVAL_INTERVAL_MS", "60000", Number),
githubClientId: withFile<string>("GITHUB_CLIENT_ID", ""),
githubClientSecret: withFile<string>("GITHUB_CLIENT_SECRET", ""),
githubAppName: withFile<string>("GITHUB_APP_NAME", "Dequel"),
githubWebhookSecret: withFile<string>("GITHUB_WEBHOOK_SECRET", ""),
...SYSTEM,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

System paths are now hardcoded and no longer configurable.

The SYSTEM constant hardcodes databasePath, workspaceRoot, caddyRoutesDir, dockerNetwork, buildkitHost, and redisUrl values that were previously configurable via environment variables or config file using withFile. This removes the ability to override these paths, which is a breaking change for deployments that customize these settings.

If these values must remain hardcoded, consider documenting this change. Otherwise, restore configurability by using withFile for each property.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/api/src/utils/config.ts` around lines 26 - 36, The SYSTEM constant
contains hardcoded values for databasePath, workspaceRoot, caddyRoutesDir,
dockerNetwork, buildkitHost, and redisUrl that were previously configurable via
environment variables or config files. To restore configurability, replace the
hardcoded string values in the SYSTEM constant with calls to withFile for each
of these properties, allowing deployments to override these settings through
configuration files or environment variables as they could previously.

Comment on lines +37 to +41
port: withFile<number>(
"PORT",
"17474",
Number,
),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Search for hardcoded references to old default ports

# Search for old port values in docs, configs, and code
rg -n -C2 '\b(3001|3000)\b' --glob '!node_modules' --glob '*.{md,yml,yaml,json,ts,js,sh}'

Repository: Lftobs/dequel

Length of output: 14460


Port default changes are incomplete and will break the application.

The defaults for port (3001→17474) and appInternalPort (3000→17476) were changed in config.ts, but the supporting infrastructure was not updated:

  • docker-compose.yml still sets PORT: 3001 and APP_INTERNAL_PORT: 3000
  • Health checks in docker-compose still reference localhost:3001 and localhost:3000
  • Test files hardcode appInternalPort: 3000 and reverse_proxy targets using :3000
  • infra/monitoring/prometheus.yml still targets api:3001
  • Documentation (README, CONTRIBUTING, AGENTS, docs/) all reference the old ports

All related files must be updated consistently, or revert the port changes if they were made prematurely. This is blocking and will cause runtime failures.

Also applies to: lines 46-50

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/api/src/utils/config.ts` around lines 37 - 41, The port and
appInternalPort configuration defaults in config.ts have been changed (from 3001
to 17474 and 3000 to 17476 respectively), but this change has not been
propagated to the supporting infrastructure, causing a mismatch that will break
the application. Update the corresponding port values in docker-compose.yml
(both environment variables and health check URLs), test files (hardcoded
appInternalPort values and reverse proxy targets),
infra/monitoring/prometheus.yml (API targets), and all documentation files
(README, CONTRIBUTING, AGENTS, docs/) to consistently use the new port values;
alternatively, if these port changes were made prematurely, revert the port
configuration changes in config.ts for both the port and appInternalPort fields
to restore consistency.

Comment thread CONTRIBUTING.md
Comment on lines +34 to +41
# API (port 3001)
bun apps/api/src/index.ts

# Web dashboard (port 3000)
bun apps/web/src/main.tsx

# Docs (port 4321)
bun apps/docs/src/main.tsx

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for port configurations in API, web, and docs apps
echo "=== Checking API entry point for port configuration ==="
fd -e 'index.ts|main.ts|config.ts' apps/api/src --max-depth 3 -x grep -l '3001\|17474\|PORT' {} \;

echo -e "\n=== Checking Web entry point ==="
fd -e 'main.tsx' apps/web/src --max-depth 2 -x grep -l '3000\|PORT' {} \;

echo -e "\n=== Checking Docs entry point and port ==="
fd -e 'main.tsx' apps/docs/src --max-depth 2 | head -5
fd -e 'main.tsx|index.ts' apps/docs/src --max-depth 2 -x grep -l '4321\|PORT' {} \;

Repository: Lftobs/dequel

Length of output: 1633


🏁 Script executed:

#!/bin/bash
# List directory structure first
echo "=== Repository structure ==="
ls -la apps/ 2>/dev/null | head -20

echo -e "\n=== API src files ==="
find apps/api/src -type f -name "*.ts" -o -name "*.js" 2>/dev/null | head -10

echo -e "\n=== Web src files ==="
find apps/web/src -type f -name "*.tsx" -o -name "*.ts" 2>/dev/null | head -10

echo -e "\n=== Docs src files ==="
find apps/docs/src -type f -name "*.tsx" -o -name "*.ts" -o -name "*.jsx" -o -name "*.js" 2>/dev/null | head -10

echo -e "\n=== Searching for port 3001 references ==="
rg '3001' apps/ -t ts -t tsx -t js -t json 2>/dev/null | head -20

echo -e "\n=== Searching for port 3000 references ==="
rg '3000' apps/ -t ts -t tsx -t js -t json 2>/dev/null | head -20

echo -e "\n=== Searching for port 4321 references ==="
rg '4321' apps/ -t ts -t tsx -t js -t json 2>/dev/null | head -20

echo -e "\n=== Checking API index.ts content ==="
cat apps/api/src/index.ts 2>/dev/null | head -50

echo -e "\n=== Checking Web main.tsx content ==="
cat apps/web/src/main.tsx 2>/dev/null | head -50

echo -e "\n=== Checking Docs main.tsx content ==="
cat apps/docs/src/main.tsx 2>/dev/null | head -50

Repository: Lftobs/dequel

Length of output: 3954


🏁 Script executed:

#!/bin/bash
# Find config files in docs
echo "=== All files in apps/docs ==="
find apps/docs -type f 2>/dev/null

echo -e "\n=== Check for astro.config or package.json ==="
find apps/docs -name "*.config.*" -o -name "package.json" 2>/dev/null

echo -e "\n=== Full API index.ts ==="
wc -l apps/api/src/index.ts
cat apps/api/src/index.ts

echo -e "\n=== Search for listen/port binding in API ==="
rg 'listen|port|\.listen\|3001' apps/api/ -i 2>/dev/null | head -30

Repository: Lftobs/dequel

Length of output: 6180


🏁 Script executed:

#!/bin/bash
echo "=== API config.ts to find port defaults ==="
cat apps/api/src/utils/config.ts | head -100

echo -e "\n=== Docs astro.config.mjs ==="
cat apps/docs/astro.config.mjs

echo -e "\n=== API package.json scripts ==="
cat apps/api/package.json | grep -A 10 '"scripts"'

echo -e "\n=== Web package.json scripts ==="
cat apps/web/package.json | grep -A 10 '"scripts"'

echo -e "\n=== Docs package.json scripts ==="
cat apps/docs/package.json | grep -A 10 '"scripts"'

echo -e "\n=== CONTRIBUTING.md content around lines 34-41 ==="
cat CONTRIBUTING.md | sed -n '30,45p'

Repository: Lftobs/dequel

Length of output: 3494


Fix incorrect ports and entry point commands in local development guide.

The specified ports and entry point commands are incorrect. API defaults to port 17474 (configured via PORT env var, not 3001), Web dev runs on Vite's default 5173 (preview uses 3000), and Docs is an Astro project running on port 3000—not 4321. More critically, the entry point commands are wrong: bun apps/web/src/main.tsx and bun apps/docs/src/main.tsx files do not exist. Use the package.json scripts instead:

# API (port 17474 by default)
bun run dev

# Web dashboard (port 5173 by default for dev)
bun run dev

# Docs (port 3000 by default)
bun run dev

Or run from the workspace root with workspace filters if configured.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@CONTRIBUTING.md` around lines 34 - 41, Update the local development guide
section in CONTRIBUTING.md to correct the port numbers and entry point commands
for all three services. Replace the API section comment and command to use port
17474 (the default) with the command `bun run dev`. Update the Web dashboard
section to specify port 5173 for development (not 3000) with the command `bun
run dev`. Update the Docs section to use port 3000 (not 4321) with the command
`bun run dev`. Remove the incorrect file paths (`bun apps/web/src/main.tsx` and
`bun apps/docs/src/main.tsx`) and replace them with the proper `bun run dev`
command, as the original commands reference non-existent entry point files.
Optionally add a note that these commands can also be run from the workspace
root with appropriate filters if configured.

Comment on lines +17 to +19
- source_labels: ['__meta_docker_container_network_dequel_net']
regex: 'true'
action: keep

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "1) Current promtail label filter:"
rg -n "__meta_docker_container_network_dequel_net|__meta_docker_network_name" infra/monitoring/promtail-config.yml

echo
echo "2) Documented docker_sd meta labels from Prometheus docs:"
curl -fsSL https://prometheus.io/docs/prometheus/latest/configuration/configuration/ \
  | sed -n '/Docker SD configurations/,/dockerswarm_sd_config/p' \
  | grep -o '__meta_docker_[a-zA-Z0-9_<>-]*' \
  | sort -u

Repository: Lftobs/dequel

Length of output: 977


Use a documented Docker SD meta label for network filtering.

Line 17 references __meta_docker_container_network_dequel_net, which is not a documented docker_sd_configs meta label. With action: keep, this will fail to match any targets and stop container log ingestion entirely. Use __meta_docker_network_name instead.

Suggested fix
-      - source_labels: ['__meta_docker_container_network_dequel_net']
-        regex: 'true'
+      - source_labels: ['__meta_docker_network_name']
+        regex: 'dequel_net'
         action: keep
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@infra/monitoring/promtail-config.yml` around lines 17 - 19, The source label
`__meta_docker_container_network_dequel_net` on line 17 is not a documented
Docker service discovery meta label, causing the `action: keep` filter to fail
and stop all container log ingestion. Replace
`__meta_docker_container_network_dequel_net` with the correct documented meta
label `__meta_docker_network_name` to properly filter containers by network.

Source: MCP tools

Comment thread scripts/install.sh
Comment on lines +142 to +143
local ENC_KEY
ENC_KEY=$(openssl rand -hex 32 2>/dev/null || dd if=/dev/urandom bs=32 count=1 status=none 2>/dev/null | od -A n -t x1 | tr -d ' \n' || echo "dev-env-key-change-me")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Insecure encryption key fallback poses a security risk.

If both openssl rand and dd fail (e.g., in minimal container environments), the script silently falls back to the hardcoded string "dev-env-key-change-me". This known-insecure default could be deployed to production without the user's awareness, compromising encryption security. The warning at line 136 does not mention this risk.

🔒 Proposed fix to fail fast when secure key generation is impossible
-	local ENC_KEY
-	ENC_KEY=$(openssl rand -hex 32 2>/dev/null || dd if=/dev/urandom bs=32 count=1 status=none 2>/dev/null | od -A n -t x1 | tr -d ' \n' || echo "dev-env-key-change-me")
+	local ENC_KEY
+	if ENC_KEY=$(openssl rand -hex 32 2>/dev/null); then
+		:
+	elif ENC_KEY=$(dd if=/dev/urandom bs=32 count=1 status=none 2>/dev/null | od -A n -t x1 | tr -d ' \n'); then
+		:
+	else
+		fail "Cannot generate secure encryption key (openssl and dd unavailable). Install openssl or ensure /dev/urandom is accessible."
+	fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
local ENC_KEY
ENC_KEY=$(openssl rand -hex 32 2>/dev/null || dd if=/dev/urandom bs=32 count=1 status=none 2>/dev/null | od -A n -t x1 | tr -d ' \n' || echo "dev-env-key-change-me")
local ENC_KEY
if ENC_KEY=$(openssl rand -hex 32 2>/dev/null); then
:
elif ENC_KEY=$(dd if=/dev/urandom bs=32 count=1 status=none 2>/dev/null | od -A n -t x1 | tr -d ' \n'); then
:
else
fail "Cannot generate secure encryption key (openssl and dd unavailable). Install openssl or ensure /dev/urandom is accessible."
fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/install.sh` around lines 142 - 143, The ENC_KEY variable assignment
has an insecure fallback that silently uses a hardcoded string
"dev-env-key-change-me" if both openssl rand and dd commands fail, which could
allow insecure keys to be deployed to production without user awareness. Replace
the final fallback clause (the `|| echo "dev-env-key-change-me"` part) with a
fail-fast mechanism that logs an error message and exits the script, ensuring
the installation stops immediately when secure key generation is impossible
rather than continuing with a known-insecure default.

Comment thread scripts/install.sh
Comment on lines +145 to +153
cat > "$INSTALL_DIR/data/dequel.json" <<EOF
{
"CADDY_BASE_DOMAIN": "$HOSTNAME",
"ENV_ENCRYPTION_KEY": "$ENC_KEY",
"GITHUB_APP_NAME": "Dequel"
}
EOF
success "Created $INSTALL_DIR/.env"
fi
chmod 600 "$INSTALL_DIR/data/dequel.json"
success "Created $INSTALL_DIR/data/dequel.json"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Config file created with insecure defaults in non-interactive mode.

When the script runs without a TTY, prompt_config() skips user prompts but still creates dequel.json with an empty CADDY_BASE_DOMAIN and a potentially insecure ENV_ENCRYPTION_KEY (if the fallback at line 143 triggered). The warning at line 136 only instructs users to set .env variables and does not mention that dequel.json was also written with defaults that may require manual correction.

🛡️ Proposed fix to skip config file creation in non-interactive mode
 	elif (: </dev/tty) 2>/dev/null; then
 		read -r -p "  Admin email (for SSL notifications, optional): " ADMIN_EMAIL < /dev/tty
 		read -r -p "  Base domain (e.g. dequel.example.com, optional): " HOSTNAME < /dev/tty
 	else
 		warn "No terminal — skipping configuration prompt"
-		warn "Set CADDY_EMAIL and CADDY_BASE_DOMAIN in $INSTALL_DIR/.env after install"
+		warn "After install, create $INSTALL_DIR/data/dequel.json and $INSTALL_DIR/.env manually"
+		warn "See installation docs for required structure and ENV_ENCRYPTION_KEY generation"
 		return
 	fi
 
 	mkdir -p "$INSTALL_DIR/data"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/install.sh` around lines 145 - 153, The script creates dequel.json
with potentially insecure defaults when running in non-interactive mode (without
TTY), where prompt_config() skips user prompts but still writes the file with
empty CADDY_BASE_DOMAIN and a potentially insecure ENV_ENCRYPTION_KEY. To fix
this, check whether the script is running in a TTY (interactive mode) before
executing the dequel.json creation block that uses cat with the EOF delimiter.
Only create the dequel.json file with the CADDY_BASE_DOMAIN, ENV_ENCRYPTION_KEY,
and GITHUB_APP_NAME values when the script is running interactively. In
non-interactive mode, skip this file creation entirely and update the warning
message to clarify that both .env variables and manual dequel.json configuration
may be required.

Comment thread scripts/workflow/bump.sh
Comment on lines +12 to +18
validate_version() {
local version="$1"
if ! echo "$version" | grep -qP '^\d+\.\d+\.\d+$'; then
echo "Error: Version must be in format MAJOR.MINOR.PATCH (e.g. 0.1.1). Got: $version"
exit 1
fi
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check if grep -P is available (GNU grep) or if we need POSIX alternative

# Test grep -P support
if echo "1.2.3" | grep -qP '^\d+\.\d+\.\d+$' 2>/dev/null; then
  echo "grep -P supported (GNU grep)"
else
  echo "grep -P NOT supported (likely BSD grep on macOS)"
fi

# Test portable alternative
if echo "1.2.3" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
  echo "POSIX ERE alternative works"
else
  echo "POSIX ERE alternative failed"
fi

Repository: Lftobs/dequel

Length of output: 114


🏁 Script executed:

# Check for CI/CD workflows that might test on macOS
find . -type f \( -name "*.yml" -o -name "*.yaml" \) | head -20

Repository: Lftobs/dequel

Length of output: 564


🏁 Script executed:

# Check README for system requirements
find . -type f -iname "README*" -exec cat {} \;

Repository: Lftobs/dequel

Length of output: 7392


🏁 Script executed:

# Look for any macOS or platform-specific references
rg -i "macos|darwin|bsd|platform" --max-count=10

Repository: Lftobs/dequel

Length of output: 10562


🏁 Script executed:

# Check release workflow for macOS testing
cat .github/workflows/release.yml

Repository: Lftobs/dequel

Length of output: 2539


🏁 Script executed:

# Check if bump.sh is used in CI/workflows
rg "bump\.sh" --type sh --type yml

Repository: Lftobs/dequel

Length of output: 85


🏁 Script executed:

# Check if scripts are documented for macOS use
rg "macos|osx|apple|darwin" scripts/ README.md --type sh

Repository: Lftobs/dequel

Length of output: 39


🏁 Script executed:

# Check what systems are mentioned in installation docs
find . -name "*.md" -exec grep -l "macOS\|Mac\|Darwin\|BSD" {} \;

Repository: Lftobs/dequel

Length of output: 39


🏁 Script executed:

# Check what bump.sh is and where it's called from
cat scripts/bump.sh

Repository: Lftobs/dequel

Length of output: 105


🏁 Script executed:

# Check install.sh to see if it references bump.sh
cat scripts/install.sh | head -50

Repository: Lftobs/dequel

Length of output: 1449


🏁 Script executed:

# Look for references to bump.sh in documentation or workflows
rg "bump" --type md --type sh --type yml

Repository: Lftobs/dequel

Length of output: 85


🏁 Script executed:

# Search for any file named bump.sh anywhere
find . -name "*bump*" -type f

Repository: Lftobs/dequel

Length of output: 84


🏁 Script executed:

# Check if validate_version function exists anywhere in the codebase
rg "validate_version" --type sh

Repository: Lftobs/dequel

Length of output: 158


🏁 Script executed:

# Read the bump.sh file to see the actual code
cat scripts/workflow/bump.sh

Repository: Lftobs/dequel

Length of output: 3001


Use portable POSIX regex instead of GNU-specific grep -P.

The -P flag uses Perl regex syntax and is only available in GNU grep. While current CI targets Linux, this pattern may not work on macOS (which uses BSD grep). Since the fix is simple and improves portability for any developers or systems using non-GNU grep, use the POSIX ERE alternative:

Suggested fix
 validate_version() {
   local version="$1"
-  if ! echo "$version" | grep -qP '^\d+\.\d+\.\d+$'; then
+  if ! echo "$version" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
     echo "Error: Version must be in format MAJOR.MINOR.PATCH (e.g. 0.1.1). Got: $version"
     exit 1
   fi
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/workflow/bump.sh` around lines 12 - 18, The validate_version function
uses grep with the -P flag which is GNU-specific Perl regex syntax and not
available in BSD grep (used on macOS). Replace the grep command to use POSIX ERE
syntax instead by changing the flag from -P to -E and converting the Perl regex
pattern to POSIX ERE format. Specifically, in the grep command within
validate_version, replace the \d+ patterns with [0-9]+ and use -E flag instead
of -P to ensure the pattern works across both GNU and BSD grep implementations.

Comment thread scripts/workflow/bump.sh
Comment on lines +46 to +71
add_changelog_entry() {
local version="$1"
echo ""
echo -e "${CYAN}Changelog entry${NC}"
echo -e "Format: ${YELLOW}# Changelog entry title (empty to skip)${NC}"
echo "Example: '### Added' or '### Fixed'"
read -p "Section header: " -r header
if [ -z "$header" ]; then
return 1
fi
echo "Enter bullet points (one per line). Press Ctrl+D when done:"
bullets=$(cat)
if [ -z "$bullets" ]; then
return 1
fi
local date
date=$(date +%Y-%m-%d)
local entry="\n## [$version] - $date\n\n$header\n"
while IFS= read -r line; do
if [ -n "$line" ]; then
entry="$entry\n- $line"
fi
done <<< "$bullets"
sed -i "2a\\$entry" "$ROOT_DIR/CHANGELOG.md"
echo -e "${GREEN}✓${NC} Added changelog entry"
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Check sed flavor and test portability

# Detect sed flavor
if sed --version 2>&1 | grep -q GNU; then
  echo "GNU sed detected"
else
  echo "Likely BSD sed (macOS)"
fi

# Test BSD-compatible syntax
echo "test" | sed -i'' 's/test/works/' /dev/stdin 2>&1 || echo "sed -i'' syntax test"

Repository: Lftobs/dequel

Length of output: 149


🏁 Script executed:

cat -n scripts/workflow/bump.sh | sed -n '46,71p'

Repository: Lftobs/dequel

Length of output: 977


🏁 Script executed:

#!/bin/bash
# Test sed syntax variations for portability
# This test uses actual file operations to test real-world behavior

# Create a test CHANGELOG.md
cat > /tmp/test_changelog.md << 'EOF'
# Test Changelog
Original content
EOF

echo "=== Test 1: Original syntax (sed -i without extension) ==="
cp /tmp/test_changelog.md /tmp/test1.md
sed -i "2a\\test content" /tmp/test1.md 2>&1
echo "Exit code: $?"
cat /tmp/test1.md

echo ""
echo "=== Test 2: Proposed syntax (sed -i'' with empty string) ==="
cp /tmp/test_changelog.md /tmp/test2.md
sed -i'' "2a\\test content" /tmp/test2.md 2>&1
echo "Exit code: $?"
cat /tmp/test2.md

echo ""
echo "=== Test 3: Proposed syntax (sed -i '' with space) ==="
cp /tmp/test_changelog.md /tmp/test3.md
sed -i '' "2a\\test content" /tmp/test3.md 2>&1
echo "Exit code: $?"
cat /tmp/test3.md

Repository: Lftobs/dequel

Length of output: 460


🏁 Script executed:

#!/bin/bash
# Verify which sed -i syntax is actually portable and correct

# Test the exact scenario from the code
TEST_FILE="/tmp/changelog_test.md"
TEST_CONTENT="## [1.0.0] - 2024-01-01

### Added\n- Feature 1"

echo "=== Verifying sed -i syntax portability ==="
echo ""

# Create test file
cat > "$TEST_FILE" << 'EOF'
# Changelog
EOF

echo "Test 1: Original syntax (sed -i)"
cp "$TEST_FILE" /tmp/test1.md
sed -i "2a\\$TEST_CONTENT" /tmp/test1.md 2>&1 && echo "✓ Works" || echo "✗ Failed"

echo ""
echo "Test 2: sed -i'' (no space - proposed fix `#1`)"
cp "$TEST_FILE" /tmp/test2.md
sed -i'' "2a\\$TEST_CONTENT" /tmp/test2.md 2>&1 && echo "✓ Works" || echo "✗ Failed"

echo ""
echo "Test 3: sed -i '' (with space - proposed fix `#2`)"
cp "$TEST_FILE" /tmp/test3.md
sed -i '' "2a\\$TEST_CONTENT" /tmp/test3.md 2>&1 && echo "✓ Works" || echo "✗ Failed"

echo ""
echo "Test 4: sed -i.bak (with backup extension - alternative portable fix)"
cp "$TEST_FILE" /tmp/test4.md
sed -i.bak "2a\\$TEST_CONTENT" /tmp/test4.md 2>&1 && echo "✓ Works" || echo "✗ Failed"
rm -f /tmp/test4.md.bak

Repository: Lftobs/dequel

Length of output: 430


Fix sed -i portability issue on macOS.

Line 69 uses sed -i without a backup extension argument, which fails on BSD sed (macOS). Use the portable syntax sed -i'' that works on both GNU and BSD sed:

-  sed -i "2a\\$entry" "$ROOT_DIR/CHANGELOG.md"
+  sed -i'' "2a\\$entry" "$ROOT_DIR/CHANGELOG.md"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
add_changelog_entry() {
local version="$1"
echo ""
echo -e "${CYAN}Changelog entry${NC}"
echo -e "Format: ${YELLOW}# Changelog entry title (empty to skip)${NC}"
echo "Example: '### Added' or '### Fixed'"
read -p "Section header: " -r header
if [ -z "$header" ]; then
return 1
fi
echo "Enter bullet points (one per line). Press Ctrl+D when done:"
bullets=$(cat)
if [ -z "$bullets" ]; then
return 1
fi
local date
date=$(date +%Y-%m-%d)
local entry="\n## [$version] - $date\n\n$header\n"
while IFS= read -r line; do
if [ -n "$line" ]; then
entry="$entry\n- $line"
fi
done <<< "$bullets"
sed -i "2a\\$entry" "$ROOT_DIR/CHANGELOG.md"
echo -e "${GREEN}${NC} Added changelog entry"
}
add_changelog_entry() {
local version="$1"
echo ""
echo -e "${CYAN}Changelog entry${NC}"
echo -e "Format: ${YELLOW}# Changelog entry title (empty to skip)${NC}"
echo "Example: '### Added' or '### Fixed'"
read -p "Section header: " -r header
if [ -z "$header" ]; then
return 1
fi
echo "Enter bullet points (one per line). Press Ctrl+D when done:"
bullets=$(cat)
if [ -z "$bullets" ]; then
return 1
fi
local date
date=$(date +%Y-%m-%d)
local entry="\n## [$version] - $date\n\n$header\n"
while IFS= read -r line; do
if [ -n "$line" ]; then
entry="$entry\n- $line"
fi
done <<< "$bullets"
sed -i'' "2a\\$entry" "$ROOT_DIR/CHANGELOG.md"
echo -e "${GREEN}${NC} Added changelog entry
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/workflow/bump.sh` around lines 46 - 71, The sed command in the
add_changelog_entry function uses the non-portable sed -i syntax without a
backup extension, which fails on BSD sed (macOS). Change the sed -i invocation
to use sed -i'' (with empty quotes) instead, which is compatible with both GNU
sed and BSD sed. This modification should be applied to the sed command that
appends the changelog entry to the CHANGELOG.md file.

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