-
Notifications
You must be signed in to change notification settings - Fork 0
SDK and CLI
Michael Marras edited this page Jun 8, 2026
·
4 revisions
Dashboard accounts are seeded by the team (no self-serve signup). Ask in the team channel to get a project_id for your app.
Add the Watchtower SDK to your html file with the following script
<script src="https://cdn.jsdelivr.net/gh/cse110-sp26-group7/Watchtower@main/client/watchtower.min.js" defer></script>
Create and initialize a WatchTower object in in your code. Make sure to use your project id
const wt = new Watchtower({
projectId: "your_project_id",
endpoint: "https://watchtower-ingest.cse110piedpiper7.workers.dev/ingest",
environment: "prod"
})
wt.init()
Add this button to your html file to test your dashboard
<button id="trigger-error">Trigger Test Error</button>
<script>
document
.getElementById("trigger-error")
.addEventListener("click", () => {
// Simulate a runtime error
throw new Error("Manual test error triggered");
});
</script>
Command line interface for interacting with WatchTower. Used in CI/CD pipelines and by power users.
npx watchtower loginOpens a browser login prompt.
npx watchtower createOutputs a unique PROJECT_ID. Store this as WT_PROJECT_ID in your environment variables or CI secrets.
Notifies WatchTower that your project was deployed. Requires WT_PROJECT_ID.
npx watchtower deploy --environment <env> --gitSha <sha> --projectId <projectId>| Flag | Short | Required | Description |
|---|---|---|---|
--environment <environment> |
-e |
true | Deployment environment (prod, staging, dev) |
--gitSha <gitSha> |
-s |
true | Release identifier (git SHA) |
--projectId <projectId> |
-p |
true | Your WatchTower project ID (e.g. wt_abcdabcd) |
--set-version <version> |
-V |
false | SemVer tag for this release (e.g. v1.2.0) |
Example — GitHub Actions:
- name: Notify WatchTower
run: npx watchtower deploy --environment prod --gitSha $GITHUB_SHA --projectId ${{ secrets.WT_PROJECT_ID }}For tagged releases, add --set-version ${{ github.ref_name }}.