project-skill.ts
This file
Path
packages/agent-kit/src/project-skill.ts
67 lines · 2.4 KiB · TypeScript
Last changed by
Merge build/comments-packages-rest into mainoscabrielbefore adoption38cd503
History of this fileTake it
The walk stopped after 200 commits: lines older than 678c8b8 point at it.
Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 1–2why, one step back1import { Brand } from "@repo/brand";2import type { Policy } from "@repo/protocol/domain/policy";Merge build/1400-w14-foundation into mainoscabrielbefore adoption47dd2f8
line 3why, one step back3import { keyOf } from "@repo/protocol/ids";Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 4–20why, one step back4import type { LandedSha, ProjectName } from "@repo/protocol/ids";5import { Effect, Option } from "effect";67import { frontmatter } from "./generated-file.ts";8import type { GeneratedFile } from "./generated-file.ts";9import { refusalSection } from "./refusals.ts";10import {11 changeSection,12 claimTerms,13 kindsSection,14 loopSteps,15 runSection,16 unfencedSection,17} from "./sections.ts";18import { code, page } from "./text.ts";1920export const contributeSkillName = (project: ProjectName) =>Merge build/1400-w14-foundation into mainoscabrielbefore adoption47dd2f8
line 21why, one step back21 `${keyOf(project)}-contribute`;Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 22–67why, one step back2223export const contributeSkillPaths = (project: ProjectName) => {24 const skill = `skills/${contributeSkillName(project)}/SKILL.md`;2526 return [`.agents/${skill}`, `.claude/${skill}`] as const;27};2829export const contributeDescription = (project: ProjectName) =>30 `Answer one of ${project}'s asks on ${Brand.name}: claim it, change only its territory, run \`${Brand.cli} check\`, push it to your fork, and read the verdict. Use when working on ${project}, or when a push to it was refused.`;3132export const contributeBody = (project: ProjectName, policy: Policy) =>33 page([34 `# Contribute to ${project}`,35 "",36 `How to answer ${project}'s asks on ${Brand.name}. It is generated from ${project}'s config folder: the gate decides what lands, and where this text and the gate differ, the gate wins. Don't edit it by hand; it is regenerated when the config changes.`,37 "",38 "## The loop",39 "",40 ...loopSteps(),41 "",42 claimTerms(policy),43 "",44 `List the open asks with ${code(`${Brand.cli} asks`)}. Add \`--json\` to any command for one JSON envelope instead of Markdown.`,45 "",46 ...changeSection(policy),47 ...runSection(policy.run),48 ...kindsSection(policy),49 ...refusalSection(),50 ...unfencedSection(policy.agents),51 ]);5253export const projectSkill = (input: {54 readonly project: ProjectName;55 readonly policy: Policy;56 readonly landed: LandedSha;57}): Effect.Effect<readonly GeneratedFile[]> =>58 frontmatter({59 body: contributeBody(input.project, input.policy),60 description: contributeDescription(input.project),61 landed: Option.some(input.landed),62 name: contributeSkillName(input.project),63 }).pipe(64 Effect.map((content) =>65 contributeSkillPaths(input.project).map((path) => ({ content, path }))66 )67 );