Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(website): publish stargazer map on star events

rubenluetke10-beepa944de4c1649
diff --git a/.github/scripts/test-stargazer-map.mjs b/.github/scripts/test-stargazer-map.mjs
new file mode 100644
index 0000000000..46e8e6fdb2
--- /dev/null
+++ b/.github/scripts/test-stargazer-map.mjs
@@ -0,0 +1,69 @@
+import assert from "node:assert/strict";
+import { readFileSync } from "node:fs";
+import { test } from "node:test";
+
+const yaml = readFileSync(new URL("../workflows/stargazer-map.yml", import.meta.url), "utf8").replace(/\r\n/g, "\n");
+const script = yaml.split(" script: |\n")[1].replace(/^ /gm, "");
+const execute = new (Object.getPrototypeOf(async function () {}).constructor)(
+ "require", "github", "context", "core", script,
+);
+
+const snapshot = {
+ repo: "PersonalJarvis/PersonalJarvis", count: 1, forks: 0, placed: 1, stated: 1,
+ generatedAt: "2026-09-01T00:00:00Z", login: "must-not-publish",
+ clusters: [{ lat: 52, lon: 13, label: "Berlin", country: "Germany", count: 1,
+ profile: "must-not-publish" }],
+};
+
+async function run({ exists = false, fail = false } = {}) {
+ const writes = [];
+ const github = { rest: {
+ git: {
+ async getRef({ ref }) {
+ if (ref === "heads/stargazer-map" && !exists) throw { status: fail ? 403 : 404 };
+ return { data: { object: { sha: "main-sha" } } };
+ },
+ async createRef(args) { writes.push({ kind: "branch", ...args }); },
+ },
+ repos: {
+ async getContent() {
+ if (!exists) throw { status: 404 };
+ return { data: { sha: "old-file-sha" } };
+ },
+ async createOrUpdateFileContents(args) { writes.push({ kind: "file", ...args }); },
+ },
+ } };
+ await execute(() => ({ readFileSync: () => JSON.stringify(snapshot) }), github,
+ { repo: { owner: "PersonalJarvis", repo: "PersonalJarvis" } }, { info() {} });
+ return writes;
+}
+
+test("bootstrap creates the data branch and publishes only aggregate fields", async () => {
+ const writes = await run();
+ assert.equal(writes[0].ref, "refs/heads/stargazer-map");
+ assert.equal(writes[0].sha, "main-sha");
+ const data = JSON.parse(Buffer.from(writes[1].content, "base64"));
+ assert.equal(data.login, undefined);
+ assert.equal(data.clusters[0].profile, undefined);
+ assert.equal(data.placed, 1);
+ assert.equal(writes[1].branch, "stargazer-map");
+});
+
+test("existing branch is updated using the previous file SHA without touching main", async () => {
+ const writes = await run({ exists: true });
+ assert.equal(writes.length, 1);
+ assert.equal(writes[0].sha, "old-file-sha");
+ assert.equal(writes[0].branch, "stargazer-map");
+});
+
+test("permission failures abort publication", async () => {
+ await assert.rejects(run({ fail: true }), (error) => error.status === 403);
+});
+
+test("star and reconciliation triggers use a pinned collector without a personal token", () => {
+ assert.match(yaml, /watch:\s+types: \[started\]/);
+ assert.match(yaml, /cron: "23 \* \* \* \*"/);
+ assert.match(yaml, /ref: [a-f0-9]{40}/);
+ assert.match(yaml, /GITHUB_TOKEN: \$\{\{ github.token \}\}/);
+ assert.doesNotMatch(yaml, /STARGAZERS_TOKEN|pull_request_target/);
+});
diff --git a/.github/workflows/stargazer-map.yml b/.github/workflows/stargazer-map.yml
new file mode 100644
index 0000000000..e5ecb94d33
--- /dev/null
+++ b/.github/workflows/stargazer-map.yml
@@ -0,0 +1,92 @@
+name: Stargazer map
+
+on:
+ push:
+ branches: [main]
+ paths:
+ - .github/workflows/stargazer-map.yml
+ - .github/scripts/test-stargazer-map.mjs
+ watch:
+ types: [started]
+ schedule:
+ # Reconcile unstars, profile edits, and any delayed/missed star events.
+ - cron: "23 * * * *"
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+concurrency:
+ group: stargazer-map
+ cancel-in-progress: false
+
+jobs:
+ verify:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 22
+ - run: node --test .github/scripts/test-stargazer-map.mjs
+
+ refresh:
+ needs: verify
+ if: github.repository == 'PersonalJarvis/PersonalJarvis'
+ permissions:
+ contents: write
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+ steps:
+ # The geocoder belongs to the website. Pin reviewed code: it runs with
+ # this repository's token, never a contributor-controlled checkout.
+ - uses: actions/checkout@v4
+ with:
+ repository: PersonalJarvis/personaljarvis.github.io
+ ref: 70125a6f2206415a60f15cdf99921f7b0dd4f0f2
+ persist-credentials: false
+
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 22
+
+ - name: Resolve public profile locations
+ env:
+ GITHUB_TOKEN: ${{ github.token }}
+ run: node scripts/fetch-stargazers.mjs --repo PersonalJarvis/PersonalJarvis
+
+ - name: Publish the aggregate feed
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const fs = require('node:fs');
+ const repo = context.repo;
+ const branch = 'stargazer-map';
+ const path = 'data/stargazers.json';
+ const raw = fs.readFileSync('src/data/stargazers.json', 'utf8');
+ const data = JSON.parse(raw);
+ // Publish an explicit allowlist, never profile names or raw locations.
+ const { count, forks, placed, stated, generatedAt } = data;
+ const clusters = data.clusters.map(({ lat, lon, label, country, count }) =>
+ ({ lat, lon, label, country, count }));
+ const body = { repo: 'PersonalJarvis/PersonalJarvis', count, forks,
+ placed, stated, generatedAt, clusters };
+ try {
+ await github.rest.git.getRef({ ...repo, ref: `heads/${branch}` });
+ } catch (error) {
+ if (error.status !== 404) throw error;
+ const main = await github.rest.git.getRef({ ...repo, ref: 'heads/main' });
+ await github.rest.git.createRef({ ...repo, ref: `refs/heads/${branch}`,
+ sha: main.data.object.sha });
+ }
+ let sha;
+ try {
+ const existing = await github.rest.repos.getContent({ ...repo, path, ref: branch });
+ sha = existing.data.sha;
+ } catch (error) {
+ if (error.status !== 404) throw error;
+ }
+ await github.rest.repos.createOrUpdateFileContents({ ...repo, path, branch, sha,
+ message: 'chore: refresh public stargazer map',
+ content: Buffer.from(JSON.stringify(body, null, 2) + '\n').toString('base64') });
+ core.info(`Published ${placed} resolved stargazers across ${clusters.length} places.`);