Files
deepseek-harness/packages/experimental/forge/src/keys.ts
T
Yichen Jiang dcbfd8079a feat(experimental): bind code host change requests to Sessions
Add the experimental forge capability seam:

- dsh-experimental-forge: provider-neutral repository and change request
  references, a provider registry, and shared status polling. Watchers of
  one change request share one loop; each forge has one batched fetch in
  flight, and the cadence follows check, mergeability, and lifecycle state.
- dsh-experimental-forge-github: GitHub provider that runs the GitHub CLI
  on the host with a scrubbed environment and reads every due pull request
  of a host in one GraphQL query.
- dsh-experimental-forge-session: a host-only projection derives Session
  bindings from gh pr create and git push shell results and from
  plugin:forge-session/binding records; push results trigger head-branch
  discovery of open pull requests, and Session watchers poll bound change
  requests through ctx.forge.
2026-10-20 11:49:25 +08:00

16 lines
682 B
TypeScript

/** Canonical identities for change requests. */
import { brandString } from '@deepseek-ai/dsh-brand'
import type { ChangeRequestKey, ChangeRequestRef } from './types.ts'
/**
* Build the canonical identity of a change request. Host, owner, and name
* compare case-insensitively, as they do on the hosts this vocabulary serves.
* @param ref - change request to identify.
* @returns `<forge>:<host>/<owner>/<name>#<number>` in lowercase.
*/
export function changeRequestKey(ref: ChangeRequestRef): ChangeRequestKey {
const { forge, host, owner, name } = ref.repository
return brandString<ChangeRequestKey>(`${forge}:${host}/${owner}/${name}#${ref.number}`.toLowerCase())
}