Skip to content

JD-107 Hello PR#7

Closed
IstiN wants to merge 1 commit into
mainfrom
ai/JD-107
Closed

JD-107 Hello PR#7
IstiN wants to merge 1 commit into
mainfrom
ai/JD-107

Conversation

@IstiN
Copy link
Copy Markdown
Owner

@IstiN IstiN commented Feb 26, 2026

Issues/Notes

All acceptance criteria implemented successfully. No blocking issues encountered.

Assumption: The ticket request "create Hello changes in web index" was interpreted as enhancing the web landing page with a dynamic "Hello" greeting driven by a testable JavaScript module, replacing the static h1 with a greeting sourced from a dedicated module.

Approach

  1. Greeting module: Created web/js/greeting.js as the single source of truth for the "Hello" greeting and page title. Exports getGreeting(), getPageTitle(), and attachToGlobal().

  2. Browser script: Added web/scripts/build-greeting-browser.js to generate web/js/greeting-browser.js from the greeting module. The browser script is an IIFE that attaches getGreeting and getPageTitle to window.

  3. index.html: Updated to load greeting-browser.js and use getPageTitle() to set the h1 and document title dynamically. The greeting is now driven by the module instead of hardcoded HTML.

  4. Test setup: Introduced Jest in web/ with package.json, jest.config.js, and 100% coverage thresholds. The pretest script runs the build so greeting-browser.js is regenerated before tests.

  5. CI workflow: Added .github/workflows/unit-tests.yml to run unit tests on pull requests that touch web/ or the workflow file. Updated deploy-pages.yml to run the build step before deploying so the browser script is always up to date.

Files Modified

File Change
web/index.html Replaced static h1 with dynamic greeting via greeting-browser.js and inline script
web/package.json New – npm project with Jest, test/build scripts
web/jest.config.js New – Jest config with 100% coverage thresholds
web/js/greeting.js New – greeting module (getGreeting, getPageTitle, attachToGlobal)
web/js/greeting-browser.js New – generated browser IIFE (built from greeting.js)
web/scripts/build-greeting-browser.js New – build script to generate greeting-browser.js
web/__tests__/greeting.test.js New – unit tests for greeting module, build script, and HTML integration
.github/workflows/unit-tests.yml New – PR workflow to run unit tests
.github/workflows/deploy-pages.yml Modified – added Node setup and build step before deploy

Test Coverage

100% coverage on all new and modified code:

  • greeting.js: getGreeting, getPageTitle, attachToGlobal – happy path and integration
  • build-greeting-browser.js: Output generation and file write
  • index.html integration: Script reference, getPageTitle usage, greeting-title element
  • greeting-browser.js sync: Values match greeting module

10 tests total, all passing.

CI/CD

  • Unit test workflow: Created .github/workflows/unit-tests.yml. Triggers on pull_request to main when web/** or the workflow file changes. Runs npm ci and npm test in web/.
  • Deploy workflow: Updated to run npm run build before deploying so greeting-browser.js is regenerated from the greeting module.

Copilot AI review requested due to automatic review settings February 26, 2026 08:59
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Implements a dynamic “Hello” greeting on the web landing page by introducing a dedicated greeting module, generating a browser-friendly script, and adding CI coverage/tests to keep the generated asset in sync.

Changes:

  • Added greeting.js module and generated greeting-browser.js for browser usage.
  • Updated web/index.html to set the page <h1> and document title dynamically via the greeting module.
  • Introduced Jest tests and GitHub Actions workflows for PR unit tests and Pages deploy build step.

Reviewed changes

Copilot reviewed 8 out of 4295 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
web/js/greeting.js Adds a Node-exported greeting/page-title module and global attachment helper
web/js/greeting-browser.js Adds generated browser IIFE exposing greeting functions on window
web/jest.config.js Adds Jest configuration with strict coverage thresholds and generation file exclusion
web/index.html Switches to dynamic greeting/title populated at runtime via browser script
web/tests/greeting.test.js Adds unit + integration-style tests for module, generated output, and HTML references
.github/workflows/unit-tests.yml Adds PR workflow to run web/ unit tests when relevant files change
.github/workflows/deploy-pages.yml Ensures browser bundle is rebuilt before deploying Pages
.github/workflows/ai-teammate.yml Adds caching logic for Codemie CLI installation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,4 @@
(function(){
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

This IIFE is not protected against concatenation issues if it’s ever combined with other scripts that don’t end with a semicolon. Prefixing the IIFE with a leading semicolon (e.g., ;(function(){ ... })();) prevents accidental invocation/parse errors in concatenated/minified contexts.

Suggested change
(function(){
;(function(){

Copilot uses AI. Check for mistakes.
Comment thread web/index.html
Comment on lines +87 to +96
<script src="js/greeting-browser.js"></script>
<div class="container">
<h1>Hello Jira Diff</h1>
<h1 id="greeting-title"></h1>
<script>
(function() {
var title = getPageTitle();
document.getElementById('greeting-title').textContent = title;
document.title = title;
})();
</script>
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The <h1> is initially empty and only populated by JavaScript, which degrades the experience for users with JS disabled and can reduce accessibility/SEO. Consider providing a fallback text inside the <h1> (or a <noscript> fallback) and letting the script overwrite it when available.

Copilot uses AI. Check for mistakes.
Comment on lines +67 to +73
- name: Cache npm global packages
if: vars.AI_AGENT_PROVIDER == 'codemie'
uses: actions/cache@v4
with:
path: |
~/.npm
/usr/local/lib/node_modules
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

Caching /usr/local/lib/node_modules without also restoring the global npm bin directory (commonly /usr/local/bin) means the codemie-claude executable may not be present even if the module directory is cached, making the cache ineffective. A more reliable approach is to set an npm global prefix under the workspace/home (e.g., ~/.npm-global) and cache that prefix (bin + lib) so both packages and executables are restored consistently.

Suggested change
- name: Cache npm global packages
if: vars.AI_AGENT_PROVIDER == 'codemie'
uses: actions/cache@v4
with:
path: |
~/.npm
/usr/local/lib/node_modules
- name: Configure npm global prefix
if: vars.AI_AGENT_PROVIDER == 'codemie'
run: |
mkdir -p "${HOME}/.npm-global"
npm config set prefix "${HOME}/.npm-global"
echo "${HOME}/.npm-global/bin" >> "${GITHUB_PATH}"
- name: Cache npm global packages
if: vars.AI_AGENT_PROVIDER == 'codemie'
uses: actions/cache@v4
with:
path: |
~/.npm-global
~/.npm

Copilot uses AI. Check for mistakes.
Comment on lines +106 to +109
if command -v codemie-claude &> /dev/null; then
echo "✅ Codemie CLI found in cache"
codemie-claude --version || echo "Version check failed"
else
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

Caching /usr/local/lib/node_modules without also restoring the global npm bin directory (commonly /usr/local/bin) means the codemie-claude executable may not be present even if the module directory is cached, making the cache ineffective. A more reliable approach is to set an npm global prefix under the workspace/home (e.g., ~/.npm-global) and cache that prefix (bin + lib) so both packages and executables are restored consistently.

Copilot uses AI. Check for mistakes.
Comment on lines +27 to +34
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Build greeting-browser.js
run: |
cd web && npm ci && npm run build
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The deploy workflow installs dependencies on every run without using the built-in npm cache support from actions/setup-node. Adding cache: 'npm' (and cache-dependency-path: web/package-lock.json) can significantly speed up deploy runs while keeping behavior consistent with the unit test workflow.

Copilot uses AI. Check for mistakes.
@IstiN IstiN closed this Feb 26, 2026
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.

3 participants