From 95ed66c3c7eabffd82674df369fab09a9edaef82 Mon Sep 17 00:00:00 2001 From: hivemoot-heater Date: Sun, 12 Apr 2026 06:37:59 +0000 Subject: [PATCH 1/2] fix: derive colony-instance.json name from COLONY_GITHUB_URL Template deployments were emitting "hivemoot/colony" as the name regardless of the configured COLONY_GITHUB_URL. Any agent or registry indexing the name field would record the wrong identity. Derive the name from the last two path segments of resolveGitHubUrl() so template deployers automatically emit "owner/repo" matching their own instance. --- web/scripts/__tests__/static-pages.test.ts | 34 ++++++++++++++++++++++ web/scripts/static-pages.ts | 8 ++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/web/scripts/__tests__/static-pages.test.ts b/web/scripts/__tests__/static-pages.test.ts index 92af3282..b8eb1474 100644 --- a/web/scripts/__tests__/static-pages.test.ts +++ b/web/scripts/__tests__/static-pages.test.ts @@ -1485,6 +1485,40 @@ describe('generateStaticPages', () => { vi.resetModules(); } }); + + it('derives colony-instance.json name from COLONY_GITHUB_URL', async () => { + const savedGithub = process.env.COLONY_GITHUB_URL; + process.env.COLONY_GITHUB_URL = 'https://github.com/acme/swarm'; + vi.resetModules(); + + try { + const { generateStaticPages: generate } = await import('../static-pages'); + + writeFileSync( + join(TEST_OUT, 'data', 'activity.json'), + JSON.stringify(minimalActivityData()) + ); + + generate(TEST_OUT); + + const manifest = JSON.parse( + readFileSync( + join(TEST_OUT, '.well-known', 'colony-instance.json'), + 'utf-8' + ) + ); + + expect(manifest.name).toBe('acme/swarm'); + expect(manifest.name).not.toBe('hivemoot/colony'); + } finally { + if (savedGithub === undefined) { + delete process.env.COLONY_GITHUB_URL; + } else { + process.env.COLONY_GITHUB_URL = savedGithub; + } + vi.resetModules(); + } + }); }); describe('generateAtomFeed', () => { diff --git a/web/scripts/static-pages.ts b/web/scripts/static-pages.ts index eb0e846c..6edd64d8 100644 --- a/web/scripts/static-pages.ts +++ b/web/scripts/static-pages.ts @@ -786,10 +786,16 @@ export function generateStaticPages(outDir: string): void { // own deployed URL rather than the upstream hivemoot/colony URL. const wellKnownDir = join(outDir, '.well-known'); mkdirSync(wellKnownDir, { recursive: true }); + const instanceGithubUrl = resolveGitHubUrl(); + const instanceRepoName = new URL(instanceGithubUrl).pathname + .split('/') + .filter(Boolean) + .slice(-2) + .join('/'); const colonyInstanceManifest = { version: '1', type: 'colony-instance', - name: 'hivemoot/colony', + name: instanceRepoName, dashboardUrl: `${BASE_URL}/`, dataEndpoints: { activityJson: `${BASE_URL}/data/activity.json`, From b80d041a508771a450ac40b04f356a0d843682ab Mon Sep 17 00:00:00 2001 From: hivemoot-heater Date: Mon, 20 Apr 2026 14:37:41 +0000 Subject: [PATCH 2/2] fix: also derive sourceRepository from resolveGitHubUrl() Both name and sourceRepository in colony-instance.json were hardcoded as hivemoot/colony. The name field was already fixed in this branch; this commit extends the fix to sourceRepository so all identity fields are consistent for template deployers. Adds a test assertion to verify sourceRepository is also derived from COLONY_GITHUB_URL. --- web/scripts/__tests__/static-pages.test.ts | 2 ++ web/scripts/static-pages.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/web/scripts/__tests__/static-pages.test.ts b/web/scripts/__tests__/static-pages.test.ts index b8eb1474..0054d681 100644 --- a/web/scripts/__tests__/static-pages.test.ts +++ b/web/scripts/__tests__/static-pages.test.ts @@ -1510,6 +1510,8 @@ describe('generateStaticPages', () => { expect(manifest.name).toBe('acme/swarm'); expect(manifest.name).not.toBe('hivemoot/colony'); + expect(manifest.sourceRepository).toBe('https://github.com/acme/swarm'); + expect(manifest.sourceRepository).not.toBe('https://github.com/hivemoot/colony'); } finally { if (savedGithub === undefined) { delete process.env.COLONY_GITHUB_URL; diff --git a/web/scripts/static-pages.ts b/web/scripts/static-pages.ts index 6edd64d8..76823185 100644 --- a/web/scripts/static-pages.ts +++ b/web/scripts/static-pages.ts @@ -801,7 +801,7 @@ export function generateStaticPages(outDir: string): void { activityJson: `${BASE_URL}/data/activity.json`, governanceHistoryJson: `${BASE_URL}/data/governance-history.json`, }, - sourceRepository: 'https://github.com/hivemoot/colony', + sourceRepository: instanceGithubUrl, framework: 'https://github.com/hivemoot/hivemoot', since: '2026-02', };