import { org } from './live/org.svelte.js';
// The org in the llms.txt format (llmstxt.org). A file in the org's profile repository wins; otherwise it is built
// from the org: public repositories, people, and the rules a change merges under, so an assistant knows what it may do here.
export const orgLlmsTxt = (origin: string) => {
if (org.files.llms) return org.files.llms;
const at = (path: string) => `${origin}${path}`;
const lines = [
`# ${org.name}`,
'',
`> ${org.tagline} Based in ${org.location}; ${org.members.length} people.`,
'',
`Agents the org runs use the org's API keys, not Sailfork, and merge under the rules below.`,
'',
'## Start here',
'',
`- [${org.name} on Sailfork](${at(`/${org.handle}`)}): what the org builds, its people and its house rules`,
...(org.files.readme ? [`- [README](${at(`/${org.handle}#readme`)}): from ${org.files.repo}`] : []),
'',
'## Public repositories',
'',
// llms.txt is public, so private and archived repositories never appear in it.
...org.repos
.filter((r) => r.visibility === 'public' && !r.archived)
.map((r) => `- [${r.name}](${at(`/${org.handle}/${r.name}`)}): ${[r.about, r.language].filter(Boolean).join(' ')}.`),
'',
'## House rules',
'',
...org.rules.map((r) => `- ${r}`),
'',
'## Optional',
'',
`- [People](${at(`/${org.handle}#people`)}): who works here and when, across ${new Set(org.members.map((m) => m.timeZone)).size} time zones`
];
return lines.join('\n') + '\n';
};