@foss.global/interfaces 1.0.0 → 1.1.0

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/changelog.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 2026-10-13 - 1.1.0
4
+
5
+ ### Features
6
+
7
+ - add forge source inventory contracts (data)
8
+ - `IForgeSourceInventoryReport`: an authenticated, read-only, deterministic measurement of a source forge before its migration, with `complete`, `partial` and `notMeasured` measures as decimal strings, organization and user owner inventories with owner totals, and per-repository Git, LFS, collaboration, release (drafts, asset counts and bytes), access and Actions counts.
9
+ - Run units (`TForgeSourceInventoryUnit`, `TForgeSourceInventoryUnitResult`, `IForgeSourceInventoryDiscovery`) for resumable measurement, and `TForgeSourceCollisionCheck` for the native name collision check.
10
+ - A report never carries secret values; secrets and variables are counted, never named.
11
+
12
+ ### Maintenance
13
+
14
+ - release tooling: `@git.zone/tsbuild` ^6.0.2 (TypeScript 7; the tsconfig needs no change), `@git.zone/tstest` ^7.2.1, `@git.zone/tsrun` ^3.0.3, `@git.zone/tsdoc` ^3.0.2 (its CLI moved to smartconsole; `buildDocs` is unchanged), `@types/node` ^26.6.4 and pnpm 12.10.0 (26.6.5 and pnpm 12.11.x are younger than seven days)
15
+
3
16
  ## 2026-09-25 - 1.0.0
4
17
 
5
18
  ### Breaking Changes
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@foss.global/interfaces',
6
- version: '1.0.0',
6
+ version: '1.1.0',
7
7
  description: 'Shared TypeScript interfaces and TypedRequest contracts for the foss.global Git platform ecosystem.'
8
8
  };
9
9
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMDBfY29tbWl0aW5mb19kYXRhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvMDBfY29tbWl0aW5mb19kYXRhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBQ0gsTUFBTSxDQUFDLE1BQU0sVUFBVSxHQUFHO0lBQ3hCLElBQUksRUFBRSx5QkFBeUI7SUFDL0IsT0FBTyxFQUFFLE9BQU87SUFDaEIsV0FBVyxFQUFFLHFHQUFxRztDQUNuSCxDQUFBIn0=
@@ -0,0 +1,336 @@
1
+ import type { TForgeInventoryVisibility } from './forgeinventory.js';
2
+ /**
3
+ * Authenticated, read-only measurement of a source forge before its one-time
4
+ * migration. Unlike the caller-visible inventory in `forgeinventory.ts`, it is
5
+ * read with a site administrator's token and counts per owner and repository.
6
+ *
7
+ * A report never contains secret values: no credentials, tokens, private keys,
8
+ * Actions secret or variable values, webhook secrets, or mirror remote URLs.
9
+ * Secrets and variables are counted, never named in the report. Reasons are
10
+ * sanitized diagnostics, never raw response bodies or URLs.
11
+ */
12
+ /** Source forges the inventory can read. */
13
+ export type TForgeSourceKind = 'gitea';
14
+ /**
15
+ * Values are canonical nonnegative decimal integers, retaining JSON precision.
16
+ * `partial` was attempted and did not finish (a resumed run retries it);
17
+ * `notMeasured` was not attempted, for example because no read exists yet.
18
+ */
19
+ export type TForgeSourceMeasure = {
20
+ status: 'complete';
21
+ value: string;
22
+ } | {
23
+ status: 'partial';
24
+ observedValue: string;
25
+ reason: string;
26
+ } | {
27
+ status: 'notMeasured';
28
+ reason: string;
29
+ };
30
+ export interface IForgeSourceIdentity {
31
+ /** Operator-assigned identity retained when the instance URL changes. */
32
+ instanceId: string;
33
+ kind: TForgeSourceKind;
34
+ /** Origin and path prefix only; never carries credentials. */
35
+ baseUrl: string;
36
+ version: string;
37
+ }
38
+ /** The account whose token read the source; an inventory requires a site administrator. */
39
+ export interface IForgeSourceReader {
40
+ login: string;
41
+ siteAdmin: boolean;
42
+ }
43
+ export interface IForgeSourceUserCounts {
44
+ total: TForgeSourceMeasure;
45
+ active: TForgeSourceMeasure;
46
+ admins: TForgeSourceMeasure;
47
+ restricted: TForgeSourceMeasure;
48
+ prohibitLogin: TForgeSourceMeasure;
49
+ /** Users authenticated through an external source such as LDAP or OAuth2. */
50
+ externalAuth: TForgeSourceMeasure;
51
+ twoFactor: TForgeSourceMeasure;
52
+ }
53
+ export interface IForgeSourceInstanceInventory {
54
+ users: IForgeSourceUserCounts;
55
+ organizations: TForgeSourceMeasure;
56
+ /** System and default webhooks. */
57
+ systemWebhooks: TForgeSourceMeasure;
58
+ /** Instance-scoped Actions runners; their registrations are reissued. */
59
+ runners: TForgeSourceMeasure;
60
+ /** Repositories on disk that the forge database does not know. */
61
+ unadoptedRepositories: TForgeSourceMeasure;
62
+ }
63
+ export interface IForgeSourcePackageTypeCounts {
64
+ /** Provider package type, such as `npm`, `generic` or `container`. */
65
+ type: string;
66
+ packages: TForgeSourceMeasure;
67
+ versions: TForgeSourceMeasure;
68
+ files: TForgeSourceMeasure;
69
+ bytes: TForgeSourceMeasure;
70
+ }
71
+ export interface IForgeSourceUserAccount {
72
+ admin: boolean;
73
+ active: boolean;
74
+ restricted: boolean;
75
+ prohibitLogin: boolean;
76
+ externalAuth: boolean;
77
+ }
78
+ export interface IForgeSourceOwnerInventoryBase {
79
+ name: string;
80
+ /** Provider row id as a decimal string. */
81
+ id: string;
82
+ visibility: TForgeInventoryVisibility;
83
+ repositories: TForgeSourceMeasure;
84
+ webhooks: TForgeSourceMeasure;
85
+ actionsVariables: TForgeSourceMeasure;
86
+ runners: TForgeSourceMeasure;
87
+ /** Sorted by type. */
88
+ packages: IForgeSourcePackageTypeCounts[];
89
+ }
90
+ export interface IForgeSourceOrganizationInventory extends IForgeSourceOwnerInventoryBase {
91
+ kind: 'organization';
92
+ members: TForgeSourceMeasure;
93
+ teams: TForgeSourceMeasure;
94
+ teamMemberships: TForgeSourceMeasure;
95
+ teamRepositoryGrants: TForgeSourceMeasure;
96
+ labels: TForgeSourceMeasure;
97
+ actionsSecrets: TForgeSourceMeasure;
98
+ }
99
+ /** User-scoped Actions secrets have no list read; see `IForgeSourceInventory.limitations`. */
100
+ export interface IForgeSourceUserInventory extends IForgeSourceOwnerInventoryBase {
101
+ kind: 'user';
102
+ account: IForgeSourceUserAccount;
103
+ sshKeys: TForgeSourceMeasure;
104
+ gpgKeys: TForgeSourceMeasure;
105
+ }
106
+ export type TForgeSourceOwnerInventory = IForgeSourceOrganizationInventory | IForgeSourceUserInventory;
107
+ /** Owner-level settings summed over every owner; repository settings are summed separately. */
108
+ export interface IForgeSourceOwnerTotals {
109
+ webhooks: TForgeSourceMeasure;
110
+ actionsSecrets: TForgeSourceMeasure;
111
+ actionsVariables: TForgeSourceMeasure;
112
+ runners: TForgeSourceMeasure;
113
+ members: TForgeSourceMeasure;
114
+ teams: TForgeSourceMeasure;
115
+ teamMemberships: TForgeSourceMeasure;
116
+ teamRepositoryGrants: TForgeSourceMeasure;
117
+ labels: TForgeSourceMeasure;
118
+ sshKeys: TForgeSourceMeasure;
119
+ gpgKeys: TForgeSourceMeasure;
120
+ }
121
+ export interface IForgeSourceGitCounts {
122
+ /** As reported by the forge, in KiB; not a transfer size. */
123
+ reportedSizeKiB: TForgeSourceMeasure;
124
+ branches: TForgeSourceMeasure;
125
+ tags: TForgeSourceMeasure;
126
+ /** Hidden refs that preserve pull request heads. */
127
+ pullRequestRefs: TForgeSourceMeasure;
128
+ otherRefs: TForgeSourceMeasure;
129
+ }
130
+ export interface IForgeSourceLfsCounts {
131
+ objects: TForgeSourceMeasure;
132
+ bytes: TForgeSourceMeasure;
133
+ }
134
+ export interface IForgeSourceCollaborationCounts {
135
+ issues: TForgeSourceMeasure;
136
+ pullRequests: TForgeSourceMeasure;
137
+ /** Conversation comments on issues and pull requests. */
138
+ comments: TForgeSourceMeasure;
139
+ reviews: TForgeSourceMeasure;
140
+ reviewComments: TForgeSourceMeasure;
141
+ labels: TForgeSourceMeasure;
142
+ milestones: TForgeSourceMeasure;
143
+ /** Reactions on issues, pull requests and their comments. */
144
+ reactions: TForgeSourceMeasure;
145
+ /** Files attached to issues, pull requests and their comments. */
146
+ attachments: TForgeSourceMeasure;
147
+ attachmentBytes: TForgeSourceMeasure;
148
+ }
149
+ export interface IForgeSourceReleaseCounts {
150
+ /** Includes drafts and prereleases. */
151
+ releases: TForgeSourceMeasure;
152
+ drafts: TForgeSourceMeasure;
153
+ assets: TForgeSourceMeasure;
154
+ assetBytes: TForgeSourceMeasure;
155
+ }
156
+ export interface IForgeSourceAccessCounts {
157
+ collaborators: TForgeSourceMeasure;
158
+ teams: TForgeSourceMeasure;
159
+ deployKeys: TForgeSourceMeasure;
160
+ webhooks: TForgeSourceMeasure;
161
+ branchProtections: TForgeSourceMeasure;
162
+ tagProtections: TForgeSourceMeasure;
163
+ /** Push mirror configurations; their remote credentials are reissued. */
164
+ pushMirrors: TForgeSourceMeasure;
165
+ }
166
+ export interface IForgeSourceActionsCounts {
167
+ /** Workflow files on the default branch. */
168
+ workflows: TForgeSourceMeasure;
169
+ secrets: TForgeSourceMeasure;
170
+ variables: TForgeSourceMeasure;
171
+ runners: TForgeSourceMeasure;
172
+ /** Run history and artifacts are archived, not migrated; counted to size the archive. */
173
+ runs: TForgeSourceMeasure;
174
+ artifacts: TForgeSourceMeasure;
175
+ artifactBytes: TForgeSourceMeasure;
176
+ }
177
+ /** Repository units the forge enables. */
178
+ export interface IForgeSourceRepositoryFeatures {
179
+ issues: boolean;
180
+ pullRequests: boolean;
181
+ wiki: boolean;
182
+ releases: boolean;
183
+ packages: boolean;
184
+ actions: boolean;
185
+ projects: boolean;
186
+ }
187
+ export interface IForgeSourceRepositoryInventory {
188
+ owner: string;
189
+ name: string;
190
+ id: string;
191
+ visibility: TForgeInventoryVisibility;
192
+ fork: boolean;
193
+ /** `owner/name` of the fork parent, or null. */
194
+ parent: string | null;
195
+ mirror: boolean;
196
+ template: boolean;
197
+ archived: boolean;
198
+ empty: boolean;
199
+ /** Git object format such as `sha1` or `sha256`. */
200
+ objectFormat: string;
201
+ defaultBranch: string;
202
+ features: IForgeSourceRepositoryFeatures;
203
+ git: IForgeSourceGitCounts;
204
+ lfs: IForgeSourceLfsCounts;
205
+ collaboration: IForgeSourceCollaborationCounts;
206
+ releases: IForgeSourceReleaseCounts;
207
+ wikiPages: TForgeSourceMeasure;
208
+ access: IForgeSourceAccessCounts;
209
+ actions: IForgeSourceActionsCounts;
210
+ }
211
+ export interface IForgeSourceRepositoryTotals {
212
+ total: TForgeSourceMeasure;
213
+ private: TForgeSourceMeasure;
214
+ internal: TForgeSourceMeasure;
215
+ forks: TForgeSourceMeasure;
216
+ mirrors: TForgeSourceMeasure;
217
+ templates: TForgeSourceMeasure;
218
+ archived: TForgeSourceMeasure;
219
+ empty: TForgeSourceMeasure;
220
+ withWiki: TForgeSourceMeasure;
221
+ }
222
+ /**
223
+ * Sums over every owner and repository; a sum is complete only when every
224
+ * addend is. Repository-shaped groups sum repositories only.
225
+ */
226
+ export interface IForgeSourceInventoryTotals {
227
+ organizations: TForgeSourceMeasure;
228
+ users: TForgeSourceMeasure;
229
+ repositories: IForgeSourceRepositoryTotals;
230
+ git: IForgeSourceGitCounts;
231
+ lfs: IForgeSourceLfsCounts;
232
+ collaboration: IForgeSourceCollaborationCounts;
233
+ releases: IForgeSourceReleaseCounts;
234
+ wikiPages: TForgeSourceMeasure;
235
+ access: IForgeSourceAccessCounts;
236
+ actions: IForgeSourceActionsCounts;
237
+ owners: IForgeSourceOwnerTotals;
238
+ /** Sorted by type. */
239
+ packages: IForgeSourcePackageTypeCounts[];
240
+ }
241
+ export interface IForgeSourceInventoryGenerator {
242
+ package: string;
243
+ version: string;
244
+ }
245
+ /**
246
+ * The deterministic measurement of one source: the same source state yields
247
+ * the same document. It carries no timestamps; run times belong to the run.
248
+ * Owners sort by kind then name, repositories by owner then name, and reason
249
+ * lists by code-unit order.
250
+ */
251
+ export interface IForgeSourceInventory {
252
+ generators: IForgeSourceInventoryGenerator[];
253
+ source: IForgeSourceIdentity;
254
+ reader: IForgeSourceReader;
255
+ /** True only when discovery finished and no measure is partial or not measured. */
256
+ inventoryComplete: boolean;
257
+ incompleteReasons: string[];
258
+ /**
259
+ * Source data that the migration reissues rather than copies and that the
260
+ * provider exposes to no administrator read, such as user-scoped Actions
261
+ * secrets on Gitea. Nothing that is migrated may be listed here instead of
262
+ * being measured.
263
+ */
264
+ limitations: string[];
265
+ instance: IForgeSourceInstanceInventory;
266
+ owners: TForgeSourceOwnerInventory[];
267
+ repositories: IForgeSourceRepositoryInventory[];
268
+ totals: IForgeSourceInventoryTotals;
269
+ }
270
+ /** A source name that already exists natively and would block an import under that name. */
271
+ export interface IForgeSourceCollision {
272
+ subject: 'owner' | 'repository';
273
+ /** `owner` or `owner/name` at the source. */
274
+ source: string;
275
+ /** The existing native name. */
276
+ native: string;
277
+ nativeKind: 'namespace' | 'repository' | 'user';
278
+ match: 'exact' | 'caseInsensitive';
279
+ }
280
+ export type TForgeSourceCollisionCheck = {
281
+ status: 'checked';
282
+ collisions: IForgeSourceCollision[];
283
+ } | {
284
+ status: 'notChecked';
285
+ reason: string;
286
+ };
287
+ /**
288
+ * A report is a complete basis for migration planning only when
289
+ * `inventoryComplete` is true and the collision check ran. Collisions sort by
290
+ * subject, then source, then native name.
291
+ */
292
+ export interface IForgeSourceInventoryReport extends IForgeSourceInventory {
293
+ collisionCheck: TForgeSourceCollisionCheck;
294
+ }
295
+ /** The complete list of what a run measures, read before any unit. */
296
+ export interface IForgeSourceInventoryDiscovery {
297
+ source: IForgeSourceIdentity;
298
+ reader: IForgeSourceReader;
299
+ owners: Array<{
300
+ kind: 'organization' | 'user';
301
+ name: string;
302
+ }>;
303
+ repositories: Array<{
304
+ owner: string;
305
+ name: string;
306
+ }>;
307
+ /** Non-empty when discovery could not finish; such a run can never be complete. */
308
+ incompleteReasons: string[];
309
+ }
310
+ /** One independently measured and resumable part of a run. */
311
+ export type TForgeSourceInventoryUnit = {
312
+ kind: 'instance';
313
+ } | {
314
+ kind: 'owner';
315
+ ownerKind: 'organization' | 'user';
316
+ name: string;
317
+ } | {
318
+ kind: 'repository';
319
+ owner: string;
320
+ name: string;
321
+ };
322
+ /** A failed unit, or one holding a partial measure, is measured again when a run resumes. */
323
+ export type TForgeSourceInventoryUnitResult = {
324
+ kind: 'instance';
325
+ instance: IForgeSourceInstanceInventory;
326
+ } | {
327
+ kind: 'owner';
328
+ owner: TForgeSourceOwnerInventory;
329
+ } | {
330
+ kind: 'repository';
331
+ repository: IForgeSourceRepositoryInventory;
332
+ } | {
333
+ kind: 'failed';
334
+ unit: TForgeSourceInventoryUnit;
335
+ reason: string;
336
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9yZ2Vzb3VyY2VpbnZlbnRvcnkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9kYXRhL2Zvcmdlc291cmNlaW52ZW50b3J5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==
@@ -1,5 +1,6 @@
1
1
  export * from './codefeed.js';
2
2
  export * from './forgeinventory.js';
3
+ export * from './forgesourceinventory.js';
3
4
  export * from './gitmanager.js';
4
5
  export * from './public.js';
5
6
  export * from './runner.js';
@@ -1,6 +1,7 @@
1
1
  export * from './codefeed.js';
2
2
  export * from './forgeinventory.js';
3
+ export * from './forgesourceinventory.js';
3
4
  export * from './gitmanager.js';
4
5
  export * from './public.js';
5
6
  export * from './runner.js';
6
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9kYXRhL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsZUFBZSxDQUFDO0FBQzlCLGNBQWMscUJBQXFCLENBQUM7QUFDcEMsY0FBYyxpQkFBaUIsQ0FBQztBQUNoQyxjQUFjLGFBQWEsQ0FBQztBQUM1QixjQUFjLGFBQWEsQ0FBQyJ9
7
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9kYXRhL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsZUFBZSxDQUFDO0FBQzlCLGNBQWMscUJBQXFCLENBQUM7QUFDcEMsY0FBYywyQkFBMkIsQ0FBQztBQUMxQyxjQUFjLGlCQUFpQixDQUFDO0FBQ2hDLGNBQWMsYUFBYSxDQUFDO0FBQzVCLGNBQWMsYUFBYSxDQUFDIn0=
@@ -1,4 +1,4 @@
1
- export declare const runnerProtocolVersion: "1";
1
+ export declare const runnerProtocolVersion: '1';
2
2
  export type TRunnerProtocolVersion = typeof runnerProtocolVersion;
3
3
  export type TOciRuntime = 'docker' | 'podman';
4
4
  export type TJobNetwork = 'none' | 'bridge';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foss.global/interfaces",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "private": false,
5
5
  "description": "Shared TypeScript interfaces and TypedRequest contracts for the foss.global Git platform ecosystem.",
6
6
  "exports": {
@@ -13,11 +13,11 @@
13
13
  "@api.global/typedrequest-interfaces": "^7.1.0"
14
14
  },
15
15
  "devDependencies": {
16
- "@git.zone/tsbuild": "^5.0.0",
17
- "@git.zone/tsdoc": "^2.2.2",
18
- "@git.zone/tsrun": "^3.0.0",
19
- "@git.zone/tstest": "^6.2.0",
20
- "@types/node": "^26.6.1"
16
+ "@git.zone/tsbuild": "^6.0.2",
17
+ "@git.zone/tsdoc": "^3.0.2",
18
+ "@git.zone/tsrun": "^3.0.3",
19
+ "@git.zone/tstest": "^7.2.1",
20
+ "@types/node": "^26.6.4"
21
21
  },
22
22
  "files": [
23
23
  "ts/**/*",
package/readme.md CHANGED
@@ -189,9 +189,49 @@ scope consistency, capability/result agreement, cursor binding, diagnostics, and
189
189
  authorization. These DTOs do not establish replication authority, historical
190
190
  import fidelity, checksummed manifests, or durable recovery checkpoints.
191
191
 
192
+ ### Forge source inventory contracts
193
+
194
+ `IForgeSourceInventoryReport` is the authenticated, read-only measurement of a
195
+ source forge before its one-time migration, read with a site administrator's
196
+ token. It counts users, organizations, teams, memberships, keys, packages by
197
+ type, and per repository the Git refs, LFS objects, issues, pull requests,
198
+ comments, reviews, reactions, attachments, releases (drafts included) with
199
+ asset bytes, wiki pages, access settings, webhooks, push mirrors, Actions
200
+ settings, and the Actions runs and artifacts that are archived rather than
201
+ migrated.
202
+
203
+ Every count is a `TForgeSourceMeasure`: `complete` with a decimal-string value,
204
+ `partial` with the value observed before a retryable failure, or `notMeasured`
205
+ when no read was attempted. `inventoryComplete` is true only when discovery
206
+ finished and no measure is partial or not measured; `incompleteReasons` lists
207
+ why not. `limitations` names source data the provider exposes to no
208
+ administrator read and that is reissued rather than migrated, such as Gitea's
209
+ user-scoped Actions secrets; everything readable is a measure instead.
210
+ Reasons are sanitized text, never raw response bodies or URLs.
211
+
212
+ Owners are a `TForgeSourceOwnerInventory` union: an organization carries its
213
+ members, teams, team memberships and repository grants, labels and Actions
214
+ secret count; a user carries its account flags and SSH and GPG key counts.
215
+ Both carry repositories, webhooks, Actions variables, runners and packages by
216
+ type. `totals.owners` sums the owner-level counts; the repository-shaped totals
217
+ sum repositories only.
218
+
219
+ A run first reads `IForgeSourceInventoryDiscovery`, then measures independent
220
+ `TForgeSourceInventoryUnit`s (the instance, each owner and each repository). A
221
+ failed unit, or one holding a partial measure, is measured again on resume.
222
+ `IForgeSourceInventory` is deterministic: it carries no timestamps, owners sort
223
+ by kind and name, repositories by owner and name. The report adds
224
+ `collisionCheck`, the source owner and repository names that already exist
225
+ natively, exactly or case-insensitively, sorted by subject, source and native
226
+ name. A report is a complete planning basis only when `inventoryComplete` is
227
+ true and the collision check ran.
228
+
229
+ A report never contains secret values, credentials, tokens, private keys,
230
+ Actions secret or variable values, webhook secrets, or mirror remote URLs.
231
+
192
232
  ## Exports
193
233
 
194
- - `data`: public DTOs for users, organizations, repositories, contents, commits, diffs, releases, issues, activity, news, stats, codefeed commit results, GitManager repository/read API results, and runner/CI contracts.
234
+ - `data`: public DTOs for users, organizations, repositories, contents, commits, diffs, releases, issues, activity, news, stats, codefeed commit results, GitManager repository/read API results, forge and forge source inventories, and runner/CI contracts.
195
235
  - `requests`: TypedRequest contracts for `codefeed`, `publicOverview`, `publicOrg`, `publicRepo`, `publicFile`, and `publicCommits`.
196
236
  - Barrel exports: all public data and request interfaces are also exported from the package root.
197
237
 
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@foss.global/interfaces',
6
- version: '1.0.0',
6
+ version: '1.1.0',
7
7
  description: 'Shared TypeScript interfaces and TypedRequest contracts for the foss.global Git platform ecosystem.'
8
8
  }
@@ -0,0 +1,335 @@
1
+ import type { TForgeInventoryVisibility } from './forgeinventory.js';
2
+
3
+ /**
4
+ * Authenticated, read-only measurement of a source forge before its one-time
5
+ * migration. Unlike the caller-visible inventory in `forgeinventory.ts`, it is
6
+ * read with a site administrator's token and counts per owner and repository.
7
+ *
8
+ * A report never contains secret values: no credentials, tokens, private keys,
9
+ * Actions secret or variable values, webhook secrets, or mirror remote URLs.
10
+ * Secrets and variables are counted, never named in the report. Reasons are
11
+ * sanitized diagnostics, never raw response bodies or URLs.
12
+ */
13
+
14
+ /** Source forges the inventory can read. */
15
+ export type TForgeSourceKind = 'gitea';
16
+
17
+ /**
18
+ * Values are canonical nonnegative decimal integers, retaining JSON precision.
19
+ * `partial` was attempted and did not finish (a resumed run retries it);
20
+ * `notMeasured` was not attempted, for example because no read exists yet.
21
+ */
22
+ export type TForgeSourceMeasure =
23
+ | { status: 'complete'; value: string }
24
+ | { status: 'partial'; observedValue: string; reason: string }
25
+ | { status: 'notMeasured'; reason: string };
26
+
27
+ export interface IForgeSourceIdentity {
28
+ /** Operator-assigned identity retained when the instance URL changes. */
29
+ instanceId: string;
30
+ kind: TForgeSourceKind;
31
+ /** Origin and path prefix only; never carries credentials. */
32
+ baseUrl: string;
33
+ version: string;
34
+ }
35
+
36
+ /** The account whose token read the source; an inventory requires a site administrator. */
37
+ export interface IForgeSourceReader {
38
+ login: string;
39
+ siteAdmin: boolean;
40
+ }
41
+
42
+ export interface IForgeSourceUserCounts {
43
+ total: TForgeSourceMeasure;
44
+ active: TForgeSourceMeasure;
45
+ admins: TForgeSourceMeasure;
46
+ restricted: TForgeSourceMeasure;
47
+ prohibitLogin: TForgeSourceMeasure;
48
+ /** Users authenticated through an external source such as LDAP or OAuth2. */
49
+ externalAuth: TForgeSourceMeasure;
50
+ twoFactor: TForgeSourceMeasure;
51
+ }
52
+
53
+ export interface IForgeSourceInstanceInventory {
54
+ users: IForgeSourceUserCounts;
55
+ organizations: TForgeSourceMeasure;
56
+ /** System and default webhooks. */
57
+ systemWebhooks: TForgeSourceMeasure;
58
+ /** Instance-scoped Actions runners; their registrations are reissued. */
59
+ runners: TForgeSourceMeasure;
60
+ /** Repositories on disk that the forge database does not know. */
61
+ unadoptedRepositories: TForgeSourceMeasure;
62
+ }
63
+
64
+ export interface IForgeSourcePackageTypeCounts {
65
+ /** Provider package type, such as `npm`, `generic` or `container`. */
66
+ type: string;
67
+ packages: TForgeSourceMeasure;
68
+ versions: TForgeSourceMeasure;
69
+ files: TForgeSourceMeasure;
70
+ bytes: TForgeSourceMeasure;
71
+ }
72
+
73
+ export interface IForgeSourceUserAccount {
74
+ admin: boolean;
75
+ active: boolean;
76
+ restricted: boolean;
77
+ prohibitLogin: boolean;
78
+ externalAuth: boolean;
79
+ }
80
+
81
+ export interface IForgeSourceOwnerInventoryBase {
82
+ name: string;
83
+ /** Provider row id as a decimal string. */
84
+ id: string;
85
+ visibility: TForgeInventoryVisibility;
86
+ repositories: TForgeSourceMeasure;
87
+ webhooks: TForgeSourceMeasure;
88
+ actionsVariables: TForgeSourceMeasure;
89
+ runners: TForgeSourceMeasure;
90
+ /** Sorted by type. */
91
+ packages: IForgeSourcePackageTypeCounts[];
92
+ }
93
+
94
+ export interface IForgeSourceOrganizationInventory extends IForgeSourceOwnerInventoryBase {
95
+ kind: 'organization';
96
+ members: TForgeSourceMeasure;
97
+ teams: TForgeSourceMeasure;
98
+ teamMemberships: TForgeSourceMeasure;
99
+ teamRepositoryGrants: TForgeSourceMeasure;
100
+ labels: TForgeSourceMeasure;
101
+ actionsSecrets: TForgeSourceMeasure;
102
+ }
103
+
104
+ /** User-scoped Actions secrets have no list read; see `IForgeSourceInventory.limitations`. */
105
+ export interface IForgeSourceUserInventory extends IForgeSourceOwnerInventoryBase {
106
+ kind: 'user';
107
+ account: IForgeSourceUserAccount;
108
+ sshKeys: TForgeSourceMeasure;
109
+ gpgKeys: TForgeSourceMeasure;
110
+ }
111
+
112
+ export type TForgeSourceOwnerInventory = IForgeSourceOrganizationInventory | IForgeSourceUserInventory;
113
+
114
+ /** Owner-level settings summed over every owner; repository settings are summed separately. */
115
+ export interface IForgeSourceOwnerTotals {
116
+ webhooks: TForgeSourceMeasure;
117
+ actionsSecrets: TForgeSourceMeasure;
118
+ actionsVariables: TForgeSourceMeasure;
119
+ runners: TForgeSourceMeasure;
120
+ members: TForgeSourceMeasure;
121
+ teams: TForgeSourceMeasure;
122
+ teamMemberships: TForgeSourceMeasure;
123
+ teamRepositoryGrants: TForgeSourceMeasure;
124
+ labels: TForgeSourceMeasure;
125
+ sshKeys: TForgeSourceMeasure;
126
+ gpgKeys: TForgeSourceMeasure;
127
+ }
128
+
129
+ export interface IForgeSourceGitCounts {
130
+ /** As reported by the forge, in KiB; not a transfer size. */
131
+ reportedSizeKiB: TForgeSourceMeasure;
132
+ branches: TForgeSourceMeasure;
133
+ tags: TForgeSourceMeasure;
134
+ /** Hidden refs that preserve pull request heads. */
135
+ pullRequestRefs: TForgeSourceMeasure;
136
+ otherRefs: TForgeSourceMeasure;
137
+ }
138
+
139
+ export interface IForgeSourceLfsCounts {
140
+ objects: TForgeSourceMeasure;
141
+ bytes: TForgeSourceMeasure;
142
+ }
143
+
144
+ export interface IForgeSourceCollaborationCounts {
145
+ issues: TForgeSourceMeasure;
146
+ pullRequests: TForgeSourceMeasure;
147
+ /** Conversation comments on issues and pull requests. */
148
+ comments: TForgeSourceMeasure;
149
+ reviews: TForgeSourceMeasure;
150
+ reviewComments: TForgeSourceMeasure;
151
+ labels: TForgeSourceMeasure;
152
+ milestones: TForgeSourceMeasure;
153
+ /** Reactions on issues, pull requests and their comments. */
154
+ reactions: TForgeSourceMeasure;
155
+ /** Files attached to issues, pull requests and their comments. */
156
+ attachments: TForgeSourceMeasure;
157
+ attachmentBytes: TForgeSourceMeasure;
158
+ }
159
+
160
+ export interface IForgeSourceReleaseCounts {
161
+ /** Includes drafts and prereleases. */
162
+ releases: TForgeSourceMeasure;
163
+ drafts: TForgeSourceMeasure;
164
+ assets: TForgeSourceMeasure;
165
+ assetBytes: TForgeSourceMeasure;
166
+ }
167
+
168
+ export interface IForgeSourceAccessCounts {
169
+ collaborators: TForgeSourceMeasure;
170
+ teams: TForgeSourceMeasure;
171
+ deployKeys: TForgeSourceMeasure;
172
+ webhooks: TForgeSourceMeasure;
173
+ branchProtections: TForgeSourceMeasure;
174
+ tagProtections: TForgeSourceMeasure;
175
+ /** Push mirror configurations; their remote credentials are reissued. */
176
+ pushMirrors: TForgeSourceMeasure;
177
+ }
178
+
179
+ export interface IForgeSourceActionsCounts {
180
+ /** Workflow files on the default branch. */
181
+ workflows: TForgeSourceMeasure;
182
+ secrets: TForgeSourceMeasure;
183
+ variables: TForgeSourceMeasure;
184
+ runners: TForgeSourceMeasure;
185
+ /** Run history and artifacts are archived, not migrated; counted to size the archive. */
186
+ runs: TForgeSourceMeasure;
187
+ artifacts: TForgeSourceMeasure;
188
+ artifactBytes: TForgeSourceMeasure;
189
+ }
190
+
191
+ /** Repository units the forge enables. */
192
+ export interface IForgeSourceRepositoryFeatures {
193
+ issues: boolean;
194
+ pullRequests: boolean;
195
+ wiki: boolean;
196
+ releases: boolean;
197
+ packages: boolean;
198
+ actions: boolean;
199
+ projects: boolean;
200
+ }
201
+
202
+ export interface IForgeSourceRepositoryInventory {
203
+ owner: string;
204
+ name: string;
205
+ id: string;
206
+ visibility: TForgeInventoryVisibility;
207
+ fork: boolean;
208
+ /** `owner/name` of the fork parent, or null. */
209
+ parent: string | null;
210
+ mirror: boolean;
211
+ template: boolean;
212
+ archived: boolean;
213
+ empty: boolean;
214
+ /** Git object format such as `sha1` or `sha256`. */
215
+ objectFormat: string;
216
+ defaultBranch: string;
217
+ features: IForgeSourceRepositoryFeatures;
218
+ git: IForgeSourceGitCounts;
219
+ lfs: IForgeSourceLfsCounts;
220
+ collaboration: IForgeSourceCollaborationCounts;
221
+ releases: IForgeSourceReleaseCounts;
222
+ wikiPages: TForgeSourceMeasure;
223
+ access: IForgeSourceAccessCounts;
224
+ actions: IForgeSourceActionsCounts;
225
+ }
226
+
227
+ export interface IForgeSourceRepositoryTotals {
228
+ total: TForgeSourceMeasure;
229
+ private: TForgeSourceMeasure;
230
+ internal: TForgeSourceMeasure;
231
+ forks: TForgeSourceMeasure;
232
+ mirrors: TForgeSourceMeasure;
233
+ templates: TForgeSourceMeasure;
234
+ archived: TForgeSourceMeasure;
235
+ empty: TForgeSourceMeasure;
236
+ withWiki: TForgeSourceMeasure;
237
+ }
238
+
239
+ /**
240
+ * Sums over every owner and repository; a sum is complete only when every
241
+ * addend is. Repository-shaped groups sum repositories only.
242
+ */
243
+ export interface IForgeSourceInventoryTotals {
244
+ organizations: TForgeSourceMeasure;
245
+ users: TForgeSourceMeasure;
246
+ repositories: IForgeSourceRepositoryTotals;
247
+ git: IForgeSourceGitCounts;
248
+ lfs: IForgeSourceLfsCounts;
249
+ collaboration: IForgeSourceCollaborationCounts;
250
+ releases: IForgeSourceReleaseCounts;
251
+ wikiPages: TForgeSourceMeasure;
252
+ access: IForgeSourceAccessCounts;
253
+ actions: IForgeSourceActionsCounts;
254
+ owners: IForgeSourceOwnerTotals;
255
+ /** Sorted by type. */
256
+ packages: IForgeSourcePackageTypeCounts[];
257
+ }
258
+
259
+ export interface IForgeSourceInventoryGenerator {
260
+ package: string;
261
+ version: string;
262
+ }
263
+
264
+ /**
265
+ * The deterministic measurement of one source: the same source state yields
266
+ * the same document. It carries no timestamps; run times belong to the run.
267
+ * Owners sort by kind then name, repositories by owner then name, and reason
268
+ * lists by code-unit order.
269
+ */
270
+ export interface IForgeSourceInventory {
271
+ generators: IForgeSourceInventoryGenerator[];
272
+ source: IForgeSourceIdentity;
273
+ reader: IForgeSourceReader;
274
+ /** True only when discovery finished and no measure is partial or not measured. */
275
+ inventoryComplete: boolean;
276
+ incompleteReasons: string[];
277
+ /**
278
+ * Source data that the migration reissues rather than copies and that the
279
+ * provider exposes to no administrator read, such as user-scoped Actions
280
+ * secrets on Gitea. Nothing that is migrated may be listed here instead of
281
+ * being measured.
282
+ */
283
+ limitations: string[];
284
+ instance: IForgeSourceInstanceInventory;
285
+ owners: TForgeSourceOwnerInventory[];
286
+ repositories: IForgeSourceRepositoryInventory[];
287
+ totals: IForgeSourceInventoryTotals;
288
+ }
289
+
290
+ /** A source name that already exists natively and would block an import under that name. */
291
+ export interface IForgeSourceCollision {
292
+ subject: 'owner' | 'repository';
293
+ /** `owner` or `owner/name` at the source. */
294
+ source: string;
295
+ /** The existing native name. */
296
+ native: string;
297
+ nativeKind: 'namespace' | 'repository' | 'user';
298
+ match: 'exact' | 'caseInsensitive';
299
+ }
300
+
301
+ export type TForgeSourceCollisionCheck =
302
+ | { status: 'checked'; collisions: IForgeSourceCollision[] }
303
+ | { status: 'notChecked'; reason: string };
304
+
305
+ /**
306
+ * A report is a complete basis for migration planning only when
307
+ * `inventoryComplete` is true and the collision check ran. Collisions sort by
308
+ * subject, then source, then native name.
309
+ */
310
+ export interface IForgeSourceInventoryReport extends IForgeSourceInventory {
311
+ collisionCheck: TForgeSourceCollisionCheck;
312
+ }
313
+
314
+ /** The complete list of what a run measures, read before any unit. */
315
+ export interface IForgeSourceInventoryDiscovery {
316
+ source: IForgeSourceIdentity;
317
+ reader: IForgeSourceReader;
318
+ owners: Array<{ kind: 'organization' | 'user'; name: string }>;
319
+ repositories: Array<{ owner: string; name: string }>;
320
+ /** Non-empty when discovery could not finish; such a run can never be complete. */
321
+ incompleteReasons: string[];
322
+ }
323
+
324
+ /** One independently measured and resumable part of a run. */
325
+ export type TForgeSourceInventoryUnit =
326
+ | { kind: 'instance' }
327
+ | { kind: 'owner'; ownerKind: 'organization' | 'user'; name: string }
328
+ | { kind: 'repository'; owner: string; name: string };
329
+
330
+ /** A failed unit, or one holding a partial measure, is measured again when a run resumes. */
331
+ export type TForgeSourceInventoryUnitResult =
332
+ | { kind: 'instance'; instance: IForgeSourceInstanceInventory }
333
+ | { kind: 'owner'; owner: TForgeSourceOwnerInventory }
334
+ | { kind: 'repository'; repository: IForgeSourceRepositoryInventory }
335
+ | { kind: 'failed'; unit: TForgeSourceInventoryUnit; reason: string };
package/ts/data/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './codefeed.js';
2
2
  export * from './forgeinventory.js';
3
+ export * from './forgesourceinventory.js';
3
4
  export * from './gitmanager.js';
4
5
  export * from './public.js';
5
6
  export * from './runner.js';