Commit graph

4 commits

Author SHA1 Message Date
63f35027f6 Add daily store phone export to Webex space
Some checks failed
CI / verify (push) Has been cancelled
Weekday 10am Eastern cron exports all Webex Calling locations whose
name starts with "Store" to a legacy-format CSV (+E164,Store XXXX),
diffs against the previous baseline, and posts the file plus a change
summary to a configured Webex space.

- src/webex/storePhones.js: paginated GET /telephony/config/locations
- src/services/storePhoneExport.js: CSV format, filename, diff, message
- src/webex/messages.js: bot-token multipart POST /messages with file
- src/jobs/storePhoneExport.js + cron in src/index.js
- scripts/exportStorePhones.js for manual runs (npm run export-store-phones)
- Persist baseline + archives under data/store-phone-export/ (gitignored)
- Dockerfile: create /app/data for volume mount in prod
- CI: align node-version with Dockerfile (20)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-27 14:57:45 -04:00
203850fd69 Fix requestJson dropping Content-Type on POSTs (HTTP 415)
Some checks are pending
CI / verify (push) Waiting to run
requestJson merged Content-Type: application/json into a headers object,
then spread `...extra` after `headers` in the fetch options — which let
extra.headers (always passed by webexJson for Authorization) overwrite
the merged object, stripping Content-Type entirely. Undici then
defaulted the string body's Content-Type to text/plain;charset=UTF-8,
and strict Webex endpoints like POST /locations rejected the request
with HTTP 415. Latent since the node-fetch -> native fetch migration.

Reorder to `{ method, ...extra, headers }` so the explicit merged
headers win, and add a test/http.test.js suite (7 tests) that pins the
merge behaviour down so this can't regress silently again.

Also: update the npm test script to `test/**/*.test.js` glob. Node
22.23 no longer accepts a bare `test/` directory as a positional arg
to `--test` (fails with ERR_UNSUPPORTED_DIR_IMPORT).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-09 12:07:15 -04:00
6de5392e90 Add node:test suite and Gitea Actions CI
Some checks are pending
CI / verify (push) Waiting to run
- 30-test suite (node --test, no framework) covering the exact functions
  that have regressed in previous rounds:
    * parseStoreArg / parseStoreNumber / storeEmail (helpers)
    * greetingForBrand (brand fallback)
    * formatE911Address / formatSuite (google response reducer)
    * parseNextLink (RFC-5988 pagination — now exported)
    * runStep success / non-critical / critical / no-bot paths
- test/setup.js stubs required env vars so any src/ module can be
  imported cleanly; loaded via --import once per test process
- npm run test wired up; directory form works on Node 20 + 22
- .gitea/workflows/ci.yml runs lint + format:check + test on push/PR
  to main, on Node 22 to match the runtime image
- Exclude test/ and .gitea/ from the Docker build context
- Exclude docker/ from bot Prettier scope (remote-agent is its own
  sub-project with its own tooling)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 16:07:02 -04:00
93b060bc8b Modernize bot to Node.js 22 with modular architecture and remote SIW agent
- Refactor monolithic index.js (2646 lines) into src/{webex,integrations,
  cards,flows,commands,services} modules; replace node-fetch/form-data
  with native fetch/FormData; move all secrets to .env via dotenv
- Add dockerized remote SIW agent (docker/remote-agent/) with cross-arch
  buildx packaging (arm64 Mac -> linux/amd64), idempotent install.sh
  deploy bundle, and docker-free ZIP inspector for arch verification
- Bot hosts a WebSocket server; agent proxies SIW requests with a
  per-request insecure:true flag, replacing the process-wide
  NODE_TLS_REJECT_UNAUTHORIZED bypass
- Add ESLint flat config + Prettier, rewrite Dockerfile as non-root
  multi-stage node:22-alpine build, README covering setup / deploy /
  remote agent workflow
- Fix parseStoreArg to read trigger.prompt correctly (was indexing past
  the framework's post-match slice); register /help as regex (string
  matcher only compares the first token); switch catch-all to /.+/
  (previous /.*/gim was stateful due to the g flag); remove
  /fixDisplayNames command and its flow/card

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 14:48:51 -04:00