@link-assistant/hive-mind 1.72.3 → 1.72.4

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,11 @@
1
1
  # @link-assistant/hive-mind
2
2
 
3
+ ## 1.72.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 82d440c: Fix fork creation verification for dotted repository names such as GitHub Pages forks.
8
+
3
9
  ## 1.72.3
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@link-assistant/hive-mind",
3
- "version": "1.72.3",
3
+ "version": "1.72.4",
4
4
  "description": "AI-powered issue solver and hive mind for collaborative problem solving",
5
5
  "main": "src/hive.mjs",
6
6
  "type": "module",
@@ -0,0 +1,63 @@
1
+ const OWNER_NAME_PATTERN = /^[A-Za-z0-9_-]+$/;
2
+ const REPOSITORY_NAME_PATTERN = /^[A-Za-z0-9._-]+$/;
3
+ const FULL_NAME_IN_TEXT_PATTERN = /(?:^|\s)([A-Za-z0-9_-]+\/[A-Za-z0-9._-]+)(?=$|\s|[),.;:])/;
4
+
5
+ function trimOutputToken(token) {
6
+ return token.replace(/^[<([{'"`]+/, '').replace(/[>\])}'"`.,;]+$/, '');
7
+ }
8
+
9
+ function stripGitSuffix(repositoryName) {
10
+ return repositoryName.endsWith('.git') ? repositoryName.slice(0, -4) : repositoryName;
11
+ }
12
+
13
+ function normalizeRepositoryFullName(owner, repositoryName) {
14
+ if (!owner || !repositoryName) return null;
15
+ if (!OWNER_NAME_PATTERN.test(owner)) return null;
16
+ if (!REPOSITORY_NAME_PATTERN.test(repositoryName)) return null;
17
+ return `${owner}/${repositoryName}`;
18
+ }
19
+
20
+ function parseGitHubRepositoryUrlToken(token) {
21
+ const cleaned = trimOutputToken(token);
22
+ let pathName = null;
23
+
24
+ if (cleaned.startsWith('git@github.com:')) {
25
+ pathName = cleaned.slice('git@github.com:'.length);
26
+ } else if (cleaned.startsWith('github.com/')) {
27
+ pathName = cleaned.slice('github.com/'.length);
28
+ } else {
29
+ try {
30
+ const parsed = new URL(cleaned);
31
+ if (parsed.hostname !== 'github.com') return null;
32
+ pathName = parsed.pathname.replace(/^\/+/, '');
33
+ } catch {
34
+ return null;
35
+ }
36
+ }
37
+
38
+ const [owner, repositoryName] = pathName.split('/');
39
+ return normalizeRepositoryFullName(owner, stripGitSuffix(repositoryName || ''));
40
+ }
41
+
42
+ /**
43
+ * Parse the repository full name returned by `gh repo fork`.
44
+ *
45
+ * GitHub repository names can contain dots, notably GitHub Pages names like
46
+ * `parking.github.io`. The previous inline regex only accepted letters,
47
+ * digits, underscores, and dashes, so it truncated dotted fork names and
48
+ * verified the wrong repository.
49
+ *
50
+ * @param {string} output
51
+ * @returns {string|null}
52
+ */
53
+ export function parseForkFullNameFromGhOutput(output) {
54
+ const text = String(output || '');
55
+
56
+ for (const token of text.match(/\S+/g) || []) {
57
+ const parsed = parseGitHubRepositoryUrlToken(token);
58
+ if (parsed) return parsed;
59
+ }
60
+
61
+ const fullNameMatch = text.match(FULL_NAME_IN_TEXT_PATTERN);
62
+ return fullNameMatch ? fullNameMatch[1] : null;
63
+ }
@@ -28,6 +28,7 @@ const { log, formatAligned } = lib;
28
28
 
29
29
  // Import exit handler
30
30
  import { safeExit } from './exit-handler.lib.mjs';
31
+ import { parseForkFullNameFromGhOutput } from './github-repository-names.lib.mjs';
31
32
 
32
33
  // Import GitHub utilities for permission checks
33
34
  const githubLib = await import('./github.lib.mjs');
@@ -589,11 +590,10 @@ export const setupRepository = async (argv, owner, repo, forkOwner = null, issue
589
590
  const forkOutput = (forkResult.stderr ? forkResult.stderr.toString() : '') + (forkResult.stdout ? forkResult.stdout.toString() : '');
590
591
  if (argv.verbose) await log(`${formatAligned('🔧', 'Fork output:', forkOutput.split('\n')[0] || '(empty)')}`); // Issue #1518
591
592
  // Parse actual fork name from output (e.g., "konard/netkeep80-jsonRVM already exists")
592
- // GitHub may create forks with modified names to avoid conflicts
593
- // Use regex that won't match domain names like "github.com/user" -> "com/user"
594
- const forkNameMatch = forkOutput.match(/(?:github\.com\/|^|\s)([a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+)/);
595
- if (forkNameMatch) {
596
- actualForkName = forkNameMatch[1];
593
+ // Issue #1819: repository names can contain dots, such as "*.github.io".
594
+ const parsedForkName = parseForkFullNameFromGhOutput(forkOutput);
595
+ if (parsedForkName) {
596
+ actualForkName = parsedForkName;
597
597
  }
598
598
 
599
599
  if (forkResult.code === 0) {