@atolis-hq/wake 0.4.118 → 0.4.119
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,4 +1,4 @@
|
|
|
1
|
-
import { ResourceCorrelationRole, } from '../resources/index.js';
|
|
1
|
+
import { ResourceCorrelationRole, resourceId, } from '../resources/index.js';
|
|
2
2
|
import { workItemId } from '../work/index.js';
|
|
3
3
|
// Work items never embed a provider/repo/issue number (see project/adrs/0001); this joins
|
|
4
4
|
// the primary correlated resource's adapter-formatted key at the presentation layer only.
|
|
@@ -8,8 +8,15 @@ export async function primaryExternalRef(root, rawWorkItemId, suppliedCorrelatio
|
|
|
8
8
|
}
|
|
9
9
|
// Generic "repository" display field; only adapters that know a repository identity supply one.
|
|
10
10
|
export async function primaryRepository(root, rawWorkItemId) {
|
|
11
|
-
const
|
|
12
|
-
|
|
11
|
+
const correlations = await root.resources.correlationsForWork(workItemId(rawWorkItemId));
|
|
12
|
+
const primary = correlations.find((value) => value.role === ResourceCorrelationRole.Primary);
|
|
13
|
+
const selectedResourceId = primary === undefined
|
|
14
|
+
? (await root.orchestration.repositoryAssignment(rawWorkItemId))?.resourceId
|
|
15
|
+
: primary.resourceId;
|
|
16
|
+
if (selectedResourceId === undefined)
|
|
17
|
+
return undefined;
|
|
18
|
+
const resource = await root.resources.get(resourceId(selectedResourceId));
|
|
19
|
+
return resource == null
|
|
13
20
|
? undefined
|
|
14
21
|
: root.resolveResourceRepositoryIdentity(resource.externalKey);
|
|
15
22
|
}
|
|
@@ -124,6 +124,6 @@ export function resolveWakeVersion(options = {}) {
|
|
|
124
124
|
return `g${headHash.slice(0, 7)}`;
|
|
125
125
|
return '0.1.0-dev';
|
|
126
126
|
}
|
|
127
|
-
export const wakeVersion = "v0.4.
|
|
127
|
+
export const wakeVersion = "v0.4.119";
|
|
128
128
|
/** The registry-installable version used by packaged sandbox images. */
|
|
129
129
|
export const wakePackageVersion = packageVersion(defaultRepoRoot) ?? wakeVersion;
|
|
@@ -5,6 +5,6 @@ interface GitHubResourceLocator {
|
|
|
5
5
|
}
|
|
6
6
|
export declare function formatGitHubResourceKey(locator: GitHubResourceLocator): string;
|
|
7
7
|
export declare function parseGitHubResourceKey(key: string): GitHubResourceLocator;
|
|
8
|
-
/** Resolve
|
|
8
|
+
/** Resolve provider-owned repository and issue/PR keys; malformed keys remain unknown. */
|
|
9
9
|
export declare function gitHubRepositoryIdentity(key: string): string | undefined;
|
|
10
10
|
export {};
|
|
@@ -17,8 +17,10 @@ export function parseGitHubResourceKey(key) {
|
|
|
17
17
|
throw new Error(`Invalid GitHub resource key: ${key}: ${parsed.error.issues.map((issue) => issue.message).join('; ')}`, { cause: parsed.error });
|
|
18
18
|
return { owner: matched[1], repo: matched[2], number: parsed.data };
|
|
19
19
|
}
|
|
20
|
-
/** Resolve
|
|
20
|
+
/** Resolve provider-owned repository and issue/PR keys; malformed keys remain unknown. */
|
|
21
21
|
export function gitHubRepositoryIdentity(key) {
|
|
22
|
+
if (/^[^/\s#]+\/[^/\s#]+$/.test(key))
|
|
23
|
+
return key;
|
|
22
24
|
try {
|
|
23
25
|
const locator = parseGitHubResourceKey(key);
|
|
24
26
|
return `${locator.owner}/${locator.repo}`;
|