@compforge/harness-common 0.5.7 → 0.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,10 @@
1
1
  import type { Identity } from "../identity.js";
2
- import { type Repository } from "./repository.js";
2
+ import { type Repository, type RepositoryKey, type RepositorySnapshot } from "./repository.js";
3
3
  export type PullRequestState = "open" | "merged" | "closed";
4
+ /** Code conflict facts do not establish permission/readiness to merge, or a completed merge. */
5
+ export type PullRequestConflictState = "none" | "conflicted" | "unknown";
6
+ /** Provider-reported merge conditions at observation time, not authorization for a merge operation. */
7
+ export type PullRequestMergeReadiness = "ready" | "conflict" | "discussions_unresolved" | "ci_blocked" | "needs_approval" | "draft" | "behind" | "blocked" | "unknown";
4
8
  /**
5
9
  * A code-review proposal owned by its target Repository (GitHub PR or GitLab MR).
6
10
  * @spec Identity is target Repository + repository-local number; source, revisions and state are metadata.
@@ -14,6 +18,9 @@ export interface PullRequest extends Identity {
14
18
  readonly title?: string;
15
19
  readonly url?: string;
16
20
  readonly state?: PullRequestState;
21
+ /** Independent transient facts; neither implies state=merged. */
22
+ readonly conflictState?: PullRequestConflictState;
23
+ readonly mergeReadiness?: PullRequestMergeReadiness;
17
24
  readonly sourceRepository?: Repository;
18
25
  readonly sourceBranch?: string;
19
26
  readonly targetBranch?: string;
@@ -23,5 +30,19 @@ export interface PullRequest extends Identity {
23
30
  readonly updatedAt?: string;
24
31
  readonly mergedAt?: string;
25
32
  }
33
+ /** The target Repository and its local PR number / MR iid; no methods or observation facts are required. */
34
+ export interface PullRequestKey {
35
+ readonly repository: RepositoryKey;
36
+ readonly number: PullRequest["number"];
37
+ }
38
+ /**
39
+ * @spec A PR snapshot retains the common field names and optional facts, without PR or nested Repository identity methods.
40
+ * @why JSON and remote observations must not require each consumer to invent a parallel PR shape or reconstruct methods.
41
+ * @see {@link component://docs/pull-request.md}
42
+ */
43
+ export type PullRequestSnapshot = Omit<PullRequest, "id" | "repository" | "sourceRepository"> & {
44
+ readonly repository: RepositorySnapshot;
45
+ readonly sourceRepository?: RepositorySnapshot;
46
+ };
26
47
  /** Derive identity from fields; never trust a consumer's display URL or repository id method. */
27
- export declare function pullRequestId(pr: Pick<PullRequest, "repository" | "number">): string;
48
+ export declare function pullRequestId<T extends PullRequestKey>(pr: T): string;
@@ -14,8 +14,12 @@ export interface Repository extends Identity {
14
14
  */
15
15
  readonly forkedFrom?: string | null;
16
16
  }
17
+ /** Identity fields usable without constructing an in-process Repository. */
18
+ export type RepositoryKey = Pick<Repository, "forge" | "path">;
19
+ /** Repository facts carried by JSON, storage and remote observations; identity methods are not data. */
20
+ export type RepositorySnapshot = Omit<Repository, "id">;
17
21
  /**
18
22
  * Derive the Repository.id() value from identity fields.
19
23
  * @spec Repository identity is forge.name/path; fork provenance is excluded.
20
24
  */
21
- export declare function repositoryId(repository: Pick<Repository, "forge" | "path">): string;
25
+ export declare function repositoryId(repository: RepositoryKey): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compforge/harness-common",
3
- "version": "0.5.7",
3
+ "version": "0.5.9",
4
4
  "description": "Execution-neutral client lifecycle and datasource contracts for harnesses",
5
5
  "type": "module",
6
6
  "scripts": {