Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
195 commits
Select commit Hold shift + click to select a range
760e2a4
Restore project and add GitHub Codespaces support
cursoragent Feb 13, 2026
b20c5a7
Use pg driver for local and Codespaces Postgres
cursoragent Feb 13, 2026
8cada71
Fix pg import for ESM runtime compatibility
cursoragent Feb 13, 2026
98b00ee
Add Codespaces workflow, health checks, seed flow, and UI tokens
cursoragent Feb 13, 2026
382d127
Add non-blocking TypeScript lint reporting baseline
cursoragent Feb 13, 2026
b58f967
Stabilize demo seed controls and add deep health checks
cursoragent Feb 14, 2026
ba1370e
Add typed client baseline, UX shell polish, and TS status report
cursoragent Feb 14, 2026
0920eb9
feat(ui): standard page patterns + query state
cursoragent Feb 14, 2026
c810da2
feat(inventory): list/detail/adjust + movement tracking + shortage ex…
cursoragent Feb 14, 2026
eb3195b
feat(ui-inventory): operational list/detail/adjust workflow
cursoragent Feb 14, 2026
cdd35bf
feat(purchase): list/detail/status + partial receive + mismatch excep…
cursoragent Feb 14, 2026
7c25ef7
feat(ui-purchase): list/detail/receive flow + change summary
cursoragent Feb 14, 2026
0401ff5
feat(logistics): shipment detail/timeline + late risk exceptions
cursoragent Feb 14, 2026
a2988c5
feat(integrations): run logs + run now stub
cursoragent Feb 14, 2026
99700d3
feat(dashboard): control tower overview + activity feed
cursoragent Feb 14, 2026
012a841
chore(ts): reduce typecheck errors (batch 1)
cursoragent Feb 14, 2026
40ef861
fix(api): standard response envelope + consistent frontend handling
cursoragent Feb 14, 2026
7b2e7df
feat(demo): guided walkthrough button + checklist
cursoragent Feb 14, 2026
01ee37d
fix(nav): consistent deep-links from dashboard KPIs
cursoragent Feb 14, 2026
dacd32a
chore(ts): reduce typecheck errors (batch 2)
cursoragent Feb 14, 2026
c99c82b
feat(rbac): disable-with-tooltip for forbidden actions
cursoragent Feb 14, 2026
72d159c
chore(docs): add doctor script + CI guardrails
cursoragent Feb 14, 2026
25d7c98
feat(activity): unify activity feed, API toasts, polling, and exports
cursoragent Feb 14, 2026
b13c3e3
chore(ts): reduce typecheck errors (batch 3)
cursoragent Feb 14, 2026
3dd9183
feat(theme): dynamic accents, density modes, and demo role UX
cursoragent Feb 14, 2026
18ada51
chore(test): add runtime harness for contract + deeplink scripts
cursoragent Feb 14, 2026
580f97d
fix(test): run contract/deeplink scripts against running app via BASE…
cursoragent Feb 14, 2026
7b867ca
ci: run runtime harness for API contract + deeplinks
cursoragent Feb 14, 2026
e8a7a7c
fix(codespaces): auto-detect reachable postgres endpoint in startup s…
cursoragent Feb 14, 2026
fa39d39
fix(codespaces): enforce host bind and startup health verification
cursoragent Feb 14, 2026
851c0d2
fix(codespaces): harden startup wait and non-interactive schema push
cursoragent Feb 14, 2026
bdf7c14
fix(codespaces): prevent silent script exit and add pg check fallback
cursoragent Feb 14, 2026
5f7e5fd
fix(codespaces): improve DB endpoint detection and startup conflict h…
cursoragent Feb 15, 2026
f22136c
chore(ts): fix billing nullability and vite typing (213 baseline)
cursoragent Feb 15, 2026
a8d9ab7
fix(codespaces): harden forwarded startup readiness
cursoragent Feb 15, 2026
cb7fe42
Describe your changes
Feb 15, 2026
7db361a
Describe your changes
Feb 15, 2026
2d7a04a
Describe your changes
Feb 15, 2026
36c9b1a
chore: sync package-lock.json with package.json
Mqhele-dot Feb 15, 2026
c483f2f
Describe your changes
Feb 15, 2026
36240a3
Merge branch 'cursor/project-codespace-compatibility-b14c' of https:/…
Feb 15, 2026
ed38ea1
feat: real diagnostics scan and fix (API + client)
Feb 15, 2026
4b8a73f
fix: inventory detail crash, supplier edit, search echo, report preview
Feb 15, 2026
0ba61a0
fix: item-detail loading, undefined fields, operational list stubs, e…
Feb 15, 2026
c887e71
fix: return 200 + safe JSON from critical GET routes to avoid 502
Feb 15, 2026
c9d87a0
Tests: skip on auth/server down, 200 fallbacks, endpoint allow 500 fo…
Feb 16, 2026
8022854
Dashboard/reports/warehouses: unwrapApiData, credentials, warehouse f…
Feb 16, 2026
1ec949c
fix: create session table for connect-pg-simple in DB init
Feb 16, 2026
5ea085d
fix: ensure session table before server.listen; dashboard/reports/war…
Feb 17, 2026
52d6964
Codespaces fixes: db:repair script, X-InvTrack-Fallback headers, clie…
Feb 17, 2026
380554c
Warehouses: validation helper, noValidate comment, post-create verifi…
Feb 17, 2026
2c2a304
Ops resilience: timeouts 12s, all routes wrapped, degraded mode, Cach…
Feb 17, 2026
80c9272
Fix loading/refetch loops: memoized fetchers, safe arrays, dev loop d…
Feb 21, 2026
5cbab95
Fix duplicate class members in storage.ts, SSL default for non-Neon D…
Feb 21, 2026
f161244
Fix duplicate class members in server/storage.ts (MemStorage and Data…
Feb 21, 2026
bac1bfe
Radix Select fix, QueryState, CSV BOM+CRLF, seed data, Playwright e2e…
Feb 21, 2026
4cbaf73
Reliability: operational seed, /ready, fallback UI, toasts, API stand…
Feb 21, 2026
50d24be
Tutorial: prepare demo, full-app tour, status/start API
Feb 21, 2026
a24656e
Dashboard: stock/value charts, Edit/View inventory, Recent Orders, ve…
Feb 21, 2026
41ed7f3
Fix duplicate-class-member warnings: split DatabaseStorage into datab…
Feb 21, 2026
4f6e72f
Fix PostgresSessionStore not defined in database-storage.ts (npm run …
Feb 21, 2026
f4d7ed7
Fix pool.end() on import: run seed-operational CLI only when executed…
Feb 21, 2026
aa41827
Contracts tab, explain-mode tutorial, bug fixes and dedup
Feb 23, 2026
f4023a3
Fix login errors: pool.end() guard, clear server errors, test:login s…
Feb 23, 2026
8ec77b3
UI and tutorial fixes; dashboard custom graphs - Sidebar: show nav la…
Feb 23, 2026
cd0df35
Standardize API layer and fallback UI - Route client fetches through …
Feb 24, 2026
6def063
Fix duplications and bugs: remove duplicate import, fix stock-alerts …
Feb 24, 2026
0165c93
feat: DB-backed contracts, analytics nav, seed data, PDF export cleanup
Feb 24, 2026
a7160aa
fix: DB-backed warehouse inventory, transferStock, convertReorderRequ…
Feb 24, 2026
fd3375a
chore: apply ESLint --fix and add lint issues summary doc
Feb 25, 2026
d434713
Fix TypeScript errors and schema alignment across storage, routes, an…
Feb 28, 2026
a805715
Add lint and TypeScript error output files
Feb 28, 2026
1fd7fea
Fix TS7016: include nodemailer, csurf, speakeasy in tsconfig types
Feb 28, 2026
fd2aeb4
Fix lint: type-only imports and useEffect deps
Feb 28, 2026
0ad2b69
Analytics, requisitions, tutorial, PDF export, and fixes
Mar 15, 2026
46c2d8c
Audit remediation: RBAC for suppliers/PO/requisitions, contract audit…
Mar 15, 2026
0e1350b
Fix build and types: requisitions TSX, PDF merge, warehouse types, au…
Mar 15, 2026
681900d
Requisitions audit: fix 500, validation, getRequisitionWithDetails, p…
Mar 15, 2026
6bbbbfd
Supply chain updates: master data, schema extensions, RBAC, requisiti…
Mar 15, 2026
135e628
Complete remaining roadmap features for supplier portal, logistics, d…
Mar 15, 2026
f0ba2a4
Close remaining audit gaps: carriers CRUD, supplier invoice upload fl…
Mar 15, 2026
77b7edc
Extend compliance and analytics reliability across procurement workfl…
Mar 16, 2026
8c9088c
Upgrade reporting, onboarding, and employee management reliability.
Mar 16, 2026
cd6eeb0
Deliver professional multi-format exports and broaden full demo seedi…
Mar 16, 2026
99cc834
Stabilize requisition and supplier portal workflows by fixing DB-back…
Mar 17, 2026
829ff7d
Harden platform reliability contracts and diagnostics across core wor…
Mar 18, 2026
3026a4e
Fix PO action reliability and align auth/error behavior with operatio…
Mar 18, 2026
88b3987
Stabilize runtime UX and unblock critical workflows under partial API…
Mar 19, 2026
b671ded
fix: complete error UX reliability plan (toasts, fetch diagnostics, r…
Mar 19, 2026
7b5d132
feat(client): enterprise navigation and performance pass
Mar 19, 2026
35cb61e
fix(ci): codespaces workflow, docs validation, integration test HTTP …
Mar 20, 2026
95950b5
feat: export hardening, API audit conformance, and UI refactors
Mar 21, 2026
71a5922
feat: dedicated export PDFs, list UX, page splits, detail routes, dep…
Mar 21, 2026
097855e
feat: approvals, logistics, mobile ops, shared CSV, docs + cleanup
Mar 21, 2026
a3ba7e4
Fix app shell scroll, inventory expiring route, and layout polish
Mar 27, 2026
8323fb9
UI polish, mobile hub, org isolation, PO PDF layout, CI and scripts
Mar 30, 2026
77b65ff
feat: domain modules, gas/assets/sync, and dev UX fixes
Apr 11, 2026
a6146e5
feat(accounts-payable): add AP module, schema, UI, and smoke test
Apr 12, 2026
6d0fea3
feat(accounts-payable): harden AP controls and release safety
Apr 12, 2026
2465c7e
feat: product architecture — canonical routes, shell resolver, analyt…
Apr 12, 2026
e02e08a
fix: align canonical navigation and route structure
Apr 12, 2026
3a9455f
chore: production hardening, export worker, observability, and CI scr…
Apr 14, 2026
69b2a5b
fix: close remaining production hardening gaps
Apr 14, 2026
138f787
refactor: canonical routing, procurement fixes, App shell split
Apr 16, 2026
2fb8b4a
Productization: router legacy rules, server bootstrap split, onboardi…
Apr 16, 2026
80345f1
feat(finance): reporting currency, analytics/AP modularization, AP su…
Apr 16, 2026
9d6a330
feat(finance): contracts currency defaults, export PDF/CSV parity, AP…
Apr 19, 2026
e378563
fix: satisfy ESLint for CI (type imports, hook deps, RequestHandler)
Apr 19, 2026
d170d68
fix(ci): use git+https for @electron/node-gyp in lockfile (npm ci on …
Apr 19, 2026
4969686
fix(ci): drop optional bufferutil (lockfile sync); keep @electron/nod…
Apr 19, 2026
20ef0d0
feat: installable product onboarding, diagnostics, packaged defaults
Apr 19, 2026
b17f600
Installable product setup: verification scripts, E2E gate, and report…
Apr 19, 2026
4f5f2b6
Codespaces: fix CSRF/session behind HTTPS proxy and harden .env loading.
Apr 19, 2026
6230476
fix(client): production stabilization for routing, errors, and Codesp…
Apr 19, 2026
8edf8ea
fix(client): finish stabilization gaps for finance and reorder UX
Apr 20, 2026
8542562
fix(codespaces): make port 5000 auto-public more reliable
Apr 20, 2026
a708b0c
fix(codespaces): restore devcontainer and protect Compose DB env
Apr 20, 2026
ed18ada
Stabilization phases 10-17: setup status loop, resilient API, page is…
Apr 20, 2026
6eb1e8d
Stabilization gap pass: readiness banner, suppliers/PO/reports harden…
Apr 20, 2026
6186162
feat: operations nav hub, mobile launcher, workspace and API hardening
Apr 21, 2026
1309b94
fix(nav): admin sidebar groups, breadcrumb IA, nav regression tests
Apr 21, 2026
06393e1
fix(codespaces): tailwind ESM plugins, auto-forward ports, keep dev s…
Apr 22, 2026
e1ab94b
fix(codespaces): public port 5000, Vite origin/HMR for app.github.dev
Apr 22, 2026
ea6631d
fix(codespaces): retry npm ci after rm -rf node_modules on ENOTEMPTY
Apr 22, 2026
6a9c1d8
fix(codespaces): doctor script + fail fast if tsx/drizzle-kit missing…
Apr 22, 2026
498dd40
fix(codespaces): doctor curl http_code without duplicate 000
Apr 22, 2026
f2a928f
fix(codespaces): ports-public helper + 502 forwarding guidance
Apr 22, 2026
1da592f
chore(devcontainer): install gh + git-lfs for Codespaces port scripts
Apr 22, 2026
ad0fb3b
fix(setup): skip __drizzle_migrations probe when table absent (push w…
Apr 22, 2026
46ec576
fix(client): initialize useMediaQuery from matchMedia to stop desktop…
Apr 22, 2026
333ce92
fix(dev): avoid Vite error logger killing server; verify Tailwind dep…
Apr 22, 2026
0998559
fix(client): stabilize routing shell, setup gate, and route registry …
Apr 22, 2026
6cd9ff0
fix(auth): stop login blank loop — no invalidate on session restore, …
Apr 23, 2026
3d37632
chore(client): finish stabilization — auth policy test, active refetc…
Apr 23, 2026
d1525cc
fix(dev): gate Replit error overlay; debounce 401 user invalidation
Apr 23, 2026
0bab2d4
fix(dev): stop refresh loops from Vite watch churn and stale setup gates
Apr 23, 2026
c932825
fix(dev): disable Vite HMR by default in GitHub Codespaces
Apr 23, 2026
caa56ab
refactor: dedupe pathWithoutQuery; simplify Codespaces HMR guard
Apr 26, 2026
5f63586
chore(client): remove dead TutorialContext.tsx (unused; app uses tuto…
Apr 26, 2026
821d7a5
docs(devcontainer): Playwright OS deps for Codespaces; E2E run notes
Apr 26, 2026
da072d7
fix(e2e): libxshmfence1 in devcontainer; Chromium launch flags for Linux
Apr 26, 2026
c706078
Codespaces/Playwright: full install-deps, opt-in webServer reuse, CI env
Apr 26, 2026
e421790
fix(e2e): wrap Playwright with explicit dev server lifecycle
Apr 26, 2026
ae84d4d
fix(e2e): wait for /api/ready and /auth before Playwright
May 3, 2026
831a551
feat(dev): external tester entry points and diagnostics
May 3, 2026
7ef7cc8
feat(client): Get Educated training hub, contextual panels, and e2e f…
May 3, 2026
2063b1f
refine(training): tutorial copy, Help panel routing, training progres…
May 3, 2026
89a57a3
fix(client): PO/inventory detail routes, billing invoice dialog, side…
May 3, 2026
c5652d3
Functional QA audit: AP batch totals, inventory export filters, tests…
May 4, 2026
d9183b0
feat(qa): functional audit E2E, seed parity, docs and release gate
May 4, 2026
639e5fb
fix: CSRF retry on apiRequest, inventory routing, SKU detail, crud path
May 4, 2026
e100325
feat: diagnostics command center; inventory and PO workspace UX
May 10, 2026
df6f318
feat: procurement AP workflow foundation
May 10, 2026
8e539bd
fix: release cleanup sprint, diagnostics noise, and AP submit-approval
May 10, 2026
b736cc8
fix(po): stabilize detail, activity, commercial PUT, AP batch 403, di…
May 10, 2026
dae46aa
PO release gate: lifecycle helpers, API contract script, E2E hardenin…
May 11, 2026
0e26ed4
Control Tower executive dashboard: aggregated API, charts, tests
May 12, 2026
448e208
Converge PO API, fix exception links, logistics debounce, control tow…
May 12, 2026
76529c6
feat(ops): logistics, exceptions, control tower readiness
May 12, 2026
8a65d8e
feat(po): boot/auth hardening, PO query boundaries, receive validatio…
May 13, 2026
e6a15d9
fix(po): prevent stale GET cache after approve/send; setQueryData on …
May 13, 2026
f71e47e
refactor(purchase-orders): feature API, React Query, mutations, recei…
May 13, 2026
c624e20
fix(purchase-orders): normalize receive results, detail lines, record…
May 13, 2026
f2296b2
fix(po): harden receive normalization, record IDs, PDF URL cleanup, _…
May 13, 2026
7ee284e
feat(ops): PO draft approve, logistics filters, planner role, tests
May 16, 2026
4aab492
fix: logistics filters (supplier), chips/clear UX, tests and PO role …
May 16, 2026
deeab69
ci: migrate invtest after migrate:check; extend release job with veri…
May 16, 2026
08fa455
ci: run workflow on all branches, PRs, and workflow_dispatch
May 16, 2026
b156312
fix: procurement convert unwrap, DB PO line receive, strict over-receipt
May 16, 2026
0ee6c6b
feat(api): procurement envelopes and shared shipment filters
May 16, 2026
54ce23f
fix(seed): ensure planner user_role enum before demo users
May 16, 2026
d57a777
feat(procurement): PO currency, routing fix, analytics workspace charts
May 16, 2026
2792d35
fix: API envelope unwrap in procurement/AP tests; analytics operation…
May 17, 2026
b0db6c4
feat(client): master-data domain invalidation, qk registry, propagati…
May 17, 2026
e227dcc
feat: PO putaway (warehouse/aisle/bin), admin AP approval + withdraw,…
May 17, 2026
efd9ad8
feat: cross-module integration (AP, invoices cache, PO logistics, PDF…
May 18, 2026
8973e01
feat(logistics): unified shipments, direction filters, GRN receive
May 19, 2026
58c30e0
feat(logistics): compact toolbar, modal shipment create
May 19, 2026
9fd2e37
feat(security): supply chain CI, dep upgrades, CSP, SHA-pinned actions
May 24, 2026
7fe7c66
fix(security): minimatch overrides, CI gates, Node 24, remove sharp
May 28, 2026
c6c83af
feat(procurement): supplier carrier default, AP invoice fields, maste…
May 30, 2026
e01565c
Consolidate warehouse setup and role access
May 30, 2026
91bcd4b
feat(testing): add local and remote browser walkthrough docs
Mqhele-dot Jun 2, 2026
faac764
feat(testing): add browser-only Playwright config
Mqhele-dot Jun 2, 2026
bc55879
feat(testing): add remote browser walkthrough runner
Mqhele-dot Jun 2, 2026
f2f1591
feat(testing): add local browser walkthrough runner
Mqhele-dot Jun 2, 2026
04a733f
feat(testing): add core app browser walkthrough
Mqhele-dot Jun 2, 2026
7d4a865
feat(testing): add Windows dependency repair script
Mqhele-dot Jun 2, 2026
d8298f3
feat(testing): add local test runner
Mqhele-dot Jun 2, 2026
7de14e8
feat(procurement): add supplier commercial defaults helper
Mqhele-dot Jun 2, 2026
cbb649e
docs(testing): document direct local browser runners
Mqhele-dot Jun 2, 2026
3e66943
chore(testing): ignore local npm repair cache
Mqhele-dot Jun 2, 2026
ef5dcc8
feat(testing): allow API-only local test startup
Mqhele-dot Jun 2, 2026
353fa6a
fix(dev): constrain Vite file access for cloud workspaces
Mqhele-dot Jun 2, 2026
95ceda4
fix(testing): support browser channel in Playwright config
Mqhele-dot Jun 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 12 additions & 0 deletions .cursor/rules/integration-scripts-test-http.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
description: Integration scripts under scripts/test-*.ts must share HTTP helpers
globs: scripts/test-*.ts
---

# Integration test scripts

- **Do not** copy `fetch` blocks, `/api/auth/login` + `/api/login`, or cookie handling into new scripts.
- **Do** import from [`scripts/test-http.ts`](scripts/test-http.ts): `apiJsonRequest`, `apiRawRequest`, `loginForTests`, `getTestBaseUrl`, `isConnectionRefused`, and extend that module if you need JSON unwrap or retries.
- **Do not** treat “no rows” as success when the script is meant to exercise APIs — seed or create minimal data first, then assert (see `test-supplier-portal.ts` + `ensureSupplierPurchaseOrder`).
- **Rate limits**: login scripts may see HTTP 429; warn and exit 0 is acceptable so reruns are not confused with broken auth.
- CSV/unit tests: assert **structure** (e.g. locate header row by content), not fixed line indices, when generators emit title/metadata before headers.
30 changes: 30 additions & 0 deletions .cursor/rules/use-async-resource.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
description: Contract for useAsyncResource to prevent loading/refetch loops
globs: client/src/**/*.tsx
---

# useAsyncResource fetcher contract

When using `useAsyncResource` from `@/hooks/use-async-resource`:

1. **Always pass a memoized fetcher** with `useCallback`. Example:
```ts
const fetcher = useCallback((): Promise<MyType[]> => fetchMyData(), []);
// or with deps when query params change:
const fetcher = useCallback(
(): Promise<MyType[]> => fetchMyData(status, supplier),
[status, supplier],
);
const { loading, error, data, refetch } = useAsyncResource(fetcher);
```
Do **not** pass an inline function (e.g. `() => fetchX()`). An inline fetcher gets a new identity every render, so the effect that depends on `fetcher` re-runs every time and can cause an infinite refetch loop.

2. **DataState list rendering**: When the hook's `data` is an array and you pass it to `DataState`'s children render prop, guard against non-array `data` (e.g. API envelope or error shape):
```ts
{(list) => {
const safeList = Array.isArray(list) ? list : [];
return safeList.map(...);
}}
```

Pages that use `useAsyncResource`: home (Control Tower), orders, logistics, exceptions, integrations. Ensure every one uses a `useCallback`-wrapped fetcher and safe array handling where applicable.
15 changes: 15 additions & 0 deletions .devcontainer.disabled/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Dev container moved to `.devcontainer/`

The active **Docker Compose devcontainer** (Postgres service hostname **`db`**, app + DB for **GitHub Codespaces**) lives in **`/.devcontainer/`** at the repo root.

This folder is kept as a short pointer so older docs and bookmarks still resolve.

## Windows desktop (no Docker)

Use **`docs/WINDOWS-LOCAL-SETUP.md`**, **`npm run dev`**, and **`npm run doctor:win`**.

If **VS Code / Cursor** offers **“Reopen in Container”**, you can choose **Reopen locally** and continue with a normal Windows Postgres install.

## Why this folder used to exist

Previously the devcontainer config was renamed to **`.devcontainer.disabled`** to reduce Dev Container detection on Windows. That broke **GitHub Codespaces** (no `db` host, `ENOTFOUND db`). The repo now ships **`.devcontainer`** again so Codespaces gets Postgres automatically.
36 changes: 36 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM mcr.microsoft.com/devcontainers/javascript-node:20-bookworm

RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
python3 \
pkg-config \
libcairo2-dev \
libjpeg-dev \
libpango1.0-dev \
libgif-dev \
librsvg2-dev \
libpixman-1-dev \
libvips-dev \
libsqlite3-dev \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*

# All browsers (Chromium, Firefox, WebKit) — single source of truth; bump @1.x.x when upgrading @playwright/test in package-lock.json.
RUN npx -y playwright@1.58.2 install-deps \
&& rm -rf /var/lib/apt/lists/*

# GitHub CLI: `npm run codespaces:ports-public` and codespaces-up port visibility automation.
# git-lfs: satisfy repo hooks when Git LFS is configured.
RUN apt-get update && apt-get install -y --no-install-recommends \
wget \
ca-certificates \
git-lfs \
&& mkdir -p -m 755 /etc/apt/keyrings \
&& wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg \
| tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
&& chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \
| tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& apt-get update && apt-get install -y --no-install-recommends gh \
&& git lfs install --system \
&& rm -rf /var/lib/apt/lists/*
27 changes: 27 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "inventory-manager-codespace",
"dockerComposeFile": "docker-compose.yml",
"service": "app",
"workspaceFolder": "/workspace",
"remoteUser": "node",
"shutdownAction": "stopCompose",
"forwardPorts": [5000],
"portsAttributes": {
"5000": {
"label": "Inventory Manager",
"onAutoForward": "openBrowserOnce",
"protocol": "http",
"visibility": "public"
}
},
"postCreateCommand": "bash .devcontainer/post-create.sh",
"customizations": {
"vscode": {
"extensions": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"bradlc.vscode-tailwindcss"
]
}
}
}
45 changes: 45 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
version: "3.8"

services:
app:
build:
context: ..
dockerfile: .devcontainer/Dockerfile
volumes:
- ..:/workspace:cached
command: sleep infinity
depends_on:
db:
condition: service_healthy
environment:
DATABASE_URL: postgresql://postgres:postgres@db:5432/inventory_dev
PGHOST: db
PGPORT: "5432"
PGDATABASE: inventory_dev
PGUSER: postgres
PGPASSWORD: postgres
NODE_ENV: development
CHOKIDAR_USEPOLLING: "true"
# Pass through from the Codespaces host so Express trusts X-Forwarded-Proto and sets Secure cookies.
CODESPACES: ${CODESPACES:-}
CODESPACE_NAME: ${CODESPACE_NAME:-}
GITHUB_CODESPACES: ${GITHUB_CODESPACES:-}
GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN: ${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN:-}

db:
image: postgres:16-bookworm
restart: unless-stopped
volumes:
- postgres-data:/var/lib/postgresql/data
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: inventory_dev
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d inventory_dev"]
interval: 5s
timeout: 5s
retries: 10

volumes:
postgres-data:
37 changes: 37 additions & 0 deletions .devcontainer/post-create.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env bash
set -euo pipefail

cd /workspace

if [ ! -f .env ]; then
cp .env.example .env
fi

bash scripts/npm-ci-robust.sh

echo "Waiting for PostgreSQL to become ready..."
for attempt in {1..30}; do
if pg_isready -h "${PGHOST:-db}" -p "${PGPORT:-5432}" -U "${PGUSER:-postgres}" >/dev/null 2>&1; then
break
fi

if [ "$attempt" -eq 30 ]; then
echo "PostgreSQL did not become ready in time." >&2
exit 1
fi

sleep 2
done

npm run db:push

# System libraries for Chromium, Firefox, and WebKit (matches upstream Playwright; avoid hand-picked apt lib lists).
echo "Installing Playwright OS dependencies (all browsers)..."
if command -v sudo >/dev/null 2>&1; then
sudo npx playwright install-deps
else
npx playwright install-deps
fi

echo "Installing Playwright browser binaries..."
npx playwright install
32 changes: 32 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# ISS Sourcing — copy to `.env` and adjust. Never commit `.env`.
# Windows: docs/WINDOWS-LOCAL-SETUP.md
#
# GitHub Codespaces (Docker devcontainer): Postgres is on host `db` (see `.devcontainer/docker-compose.yml`).
# The app loads this file with override=false so Compose-injected DATABASE_URL / PG* are NOT replaced by
# laptop-local values. If you still see wrong DB host inside Codespaces, remove DATABASE_URL from `.env` there.

# --- PostgreSQL (recommended: PG* vars; db.ts builds DATABASE_URL) ---
PGHOST=localhost
PGPORT=5432
PGDATABASE=iss_sourcing
PGUSER=postgres
PGPASSWORD=postgres
PGSSLMODE=disable

# Or set a single URL (then PG* above are ignored by the app if this is set):
# DATABASE_URL=postgresql://postgres:postgres@localhost:5432/iss_sourcing?sslmode=disable

# --- App ---
NODE_ENV=development
SESSION_SECRET=change-me-to-a-long-random-string-in-production

HOST=127.0.0.1
PORT=5000
CLIENT_PORT=5000
DB_PORT=5432

# Optional: auto-seed when DB is empty (default true in dev, false in production)
# AUTO_SEED_ON_EMPTY_DB=true

# Optional: PASSWORD_MAX_AGE_DAYS, OPERATIONAL_EXCEPTION_SCAN_INTERVAL_MINUTES
# Optional: EMAIL_*, TWILIO_*, DISABLE_NOTIFICATION_* — see docs/ENV-CONFIG.md
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Normalize line endings so bash/docs validation and CI stay consistent (Linux runners).
* text=auto
*.sh text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
.env.example text eol=lf
22 changes: 22 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Weekly dependency bumps (npm + Actions). Alerts still require GitHub "Dependabot alerts" repo setting enabled.
# Workflow steps now pin immutable SHAs — Dependabot proposes digest bumps weekly (package-ecosystem: github-actions).
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
labels:
- dependencies
- security
open-pull-requests-limit: 15
versioning-strategy: increase-if-necessary

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
labels:
- dependencies
- security
open-pull-requests-limit: 5
65 changes: 65 additions & 0 deletions .github/workflows/artifact-attestation-experimental.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Artifact attestation (experimental)

# Runs after a successful Security supply chain workflow on the default branch, or manually.
# Non-blocking OIDC attestation step remains continue-on-error — see docs/security/artifact-attestation.md

on:
workflow_dispatch:
workflow_run:
workflows: ["Security supply chain"]
types: [completed]
branches: [main, master]

permissions:
contents: read
id-token: write
attestations: write

jobs:
attest-build:
if: >-
github.event_name == 'workflow_dispatch'
|| (github.event.workflow_run.conclusion == 'success'
&& (github.event.workflow_run.head_branch == 'main'
|| github.event.workflow_run.head_branch == 'master'))
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }}

- name: Setup Node.js
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: "24"
cache: npm

- name: npm ci
run: npm ci

- name: Verify package manifest drift
run: npm run verify:package-manifests

- name: Build production artifact
run: npm run build

- name: Generate CycloneDX SBOM
run: npm run security:sbom

- name: Pack dist artifact
shell: bash
run: tar -czf invtrack-dist.tgz dist sbom.cdx.json

- name: Sign attestation for dist artifact
uses: actions/attest@v2
with:
subject-path: invtrack-dist.tgz

- name: Sign attestation for SBOM file
uses: actions/attest@v2
with:
subject-path: sbom.cdx.json
predicate-type: https://cyclonedx.org/schema
predicate: "{}"
Loading
Loading