kaovilai / kaovilai/github-bot-command-palette

[daily] docs: add JSDoc to background.js utility functions; include background.test.js in npm test

Open
#91 0 comments 0 reactions 0 assignees View on GitHub
agentic-workflows automation
Dominant language
JavaScript
Stars
1
Forks
2
Avg merge
2m
Merged PRs (30d)
15

Description

Two small, related improvements bundled together.

## Changes

### 1. Include `background.test.js` in `npm test` (`package.json`)

`tests/background.test.js` existed and passed all 12 tests, but was not wired into the `npm test` script. This means the background service worker's unit tests (covering `extractPlugins` and `buildConfigFileUrl`) were silently skipped on every CI run.

**Before:**
```
"test": "node --test tests/accessibility-attributes.test.js tests/config-manager.test.js"
```

**After:**
```
"test": "node --test tests/accessibility-attributes.test.js tests/background.test.js tests/config-manager.test.js"
```

All 91 unit tests now pass together (`npm test`).

This resolves the actionable part of issue #64 (the code changes — trailing-slash fix and maintenance comment — were already merged; only the `package.json` update was missing due to a prior protected-file push failure).

### 2. Add JSDoc to undocumented utility functions in `background.js`

The following functions lacked any documentation:
- `storageGet` / `storageSet` — Chrome storage wrappers
- `getConfig` / `getCache` / `setCache` / `getPresubmitsCache` / `setPresubmitsCache` — thin storage accessors
- `getPluginsFromSource` — cache-aware plugin fetcher

Added concise JSDoc `@param` / `@returns` annotations consistent with the existing docs on `handleGetEnabledPlugins`, `fetchYaml`, `extractPlugins`, and `buildConfigFileUrl`.

Closes \#64

---

> [!WARNING]
> **Protected Files — Push Permission Denied**
>
> This was originally intended as a pull request, but the patch modifies protected files. A human must create the pull request manually.
>
>
> Protected files
>
> - `package.json`
>
> The push was rejected because GitHub Actions does not have `workflows` permission to push these changes, and is never allowed to make such changes, or other authorization being used does not have this permission.
>
>

Create the pull request manually

```sh
# Download the patch from the workflow run
gh run download 26266285853 -n agent -D /tmp/agent-26266285853

# Create a new branch
git checkout -b docs/background-jsdoc-and-test-script-9ef3053a2759eab0 main

# Apply the patch (--3way handles cross-repo patches)
git am --3way /tmp/agent-26266285853/aw-docs-background-jsdoc-and-test-script.patch

# Push the branch and create the pull request
git push origin docs/background-jsdoc-and-test-script-9ef3053a2759eab0
gh pr create --title '[daily] docs: add JSDoc to background.js utility functions; include background.test.js in npm test' --base main --head docs/background-jsdoc-and-test-script-9ef3053a2759eab0 --repo kaovilai/github-bot-command-palette
```

> Generated by [Daily Repository Improvement](https://github.com/kaovilai/github-bot-command-palette/actions/runs/26266285853) · ● 10.6M · [◷](https://github.com/search?q=repo%3Akaovilai%2Fgithub-bot-command-palette+%22gh-aw-workflow-id%3A+continuous-improvement%22&type=pullrequests)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.