@compforge/harness-common 0.5.6 → 0.5.8
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.
- package/README.md +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/system/pull-request.d.ts +41 -0
- package/dist/system/pull-request.js +5 -0
- package/dist/system/repository.d.ts +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -183,3 +183,10 @@ custom Entry now renders consistently when shown alone or through its Dictionary
|
|
|
183
183
|
relationships without duplicating identity. `ResourceSnapshot` retains typed instances, unit-bearing
|
|
184
184
|
measurements, independently known totals and complete/partial/unavailable coverage. Discovery and
|
|
185
185
|
rendering remain consumer-owned. See [the shared contract](../../../docs/resource.md).
|
|
186
|
+
|
|
187
|
+
## PullRequest
|
|
188
|
+
|
|
189
|
+
`PullRequest` identifies a PR/MR by its target `Repository` and repository-local number.
|
|
190
|
+
State, branches, source repository, revisions and provider timestamps are optional facts.
|
|
191
|
+
See [the shared contract](../../../docs/pull-request.md) for identity and unknown-state semantics.
|
|
192
|
+
Forge access and polling remain consumer/toolkit responsibilities.
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from "./access/datasource.js";
|
|
|
6
6
|
export * from "./system/workload.js";
|
|
7
7
|
export * from "./system/forge.js";
|
|
8
8
|
export * from "./system/repository.js";
|
|
9
|
+
export * from "./system/pull-request.js";
|
|
9
10
|
export * from "./system/component.js";
|
|
10
11
|
export * from "./system/host.js";
|
|
11
12
|
export * from "./system/environment.js";
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export * from "./access/datasource.js";
|
|
|
6
6
|
export * from "./system/workload.js";
|
|
7
7
|
export * from "./system/forge.js";
|
|
8
8
|
export * from "./system/repository.js";
|
|
9
|
+
export * from "./system/pull-request.js";
|
|
9
10
|
export * from "./system/component.js";
|
|
10
11
|
export * from "./system/host.js";
|
|
11
12
|
export * from "./system/environment.js";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Identity } from "../identity.js";
|
|
2
|
+
import { type Repository, type RepositoryKey, type RepositorySnapshot } from "./repository.js";
|
|
3
|
+
export type PullRequestState = "open" | "merged" | "closed";
|
|
4
|
+
/**
|
|
5
|
+
* A code-review proposal owned by its target Repository (GitHub PR or GitLab MR).
|
|
6
|
+
* @spec Identity is target Repository + repository-local number; source, revisions and state are metadata.
|
|
7
|
+
* @spec Omitted facts are unknown. A missing state or mergedAt never proves closure or merge.
|
|
8
|
+
* @see {@link component://docs/pull-request.md}
|
|
9
|
+
*/
|
|
10
|
+
export interface PullRequest extends Identity {
|
|
11
|
+
readonly repository: Repository;
|
|
12
|
+
/** Positive GitHub PR number or GitLab MR iid, not the provider's global database ID. */
|
|
13
|
+
readonly number: number;
|
|
14
|
+
readonly title?: string;
|
|
15
|
+
readonly url?: string;
|
|
16
|
+
readonly state?: PullRequestState;
|
|
17
|
+
readonly sourceRepository?: Repository;
|
|
18
|
+
readonly sourceBranch?: string;
|
|
19
|
+
readonly targetBranch?: string;
|
|
20
|
+
readonly headSha?: string;
|
|
21
|
+
readonly baseSha?: string;
|
|
22
|
+
/** Provider timestamps, represented as ISO 8601 strings. */
|
|
23
|
+
readonly updatedAt?: string;
|
|
24
|
+
readonly mergedAt?: string;
|
|
25
|
+
}
|
|
26
|
+
/** The target Repository and its local PR number / MR iid; no methods or observation facts are required. */
|
|
27
|
+
export interface PullRequestKey {
|
|
28
|
+
readonly repository: RepositoryKey;
|
|
29
|
+
readonly number: PullRequest["number"];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @spec A PR snapshot retains the common field names and optional facts, without PR or nested Repository identity methods.
|
|
33
|
+
* @why JSON and remote observations must not require each consumer to invent a parallel PR shape or reconstruct methods.
|
|
34
|
+
* @see {@link component://docs/pull-request.md}
|
|
35
|
+
*/
|
|
36
|
+
export type PullRequestSnapshot = Omit<PullRequest, "id" | "repository" | "sourceRepository"> & {
|
|
37
|
+
readonly repository: RepositorySnapshot;
|
|
38
|
+
readonly sourceRepository?: RepositorySnapshot;
|
|
39
|
+
};
|
|
40
|
+
/** Derive identity from fields; never trust a consumer's display URL or repository id method. */
|
|
41
|
+
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:
|
|
25
|
+
export declare function repositoryId(repository: RepositoryKey): string;
|