@link-assistant/hive-mind 1.78.2 → 1.78.3

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.78.3
4
+
5
+ ### Patch Changes
6
+
7
+ - b346808: Use the latest gh-upload-log package for attached log uploads and rely on its default auto mode/shared repository fallback instead of passing explicit strategy flags.
8
+
3
9
  ## 1.78.2
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.78.2",
3
+ "version": "1.78.3",
4
4
  "description": "AI-powered issue solver and hive mind for collaborative problem solving",
5
5
  "main": "src/hive.mjs",
6
6
  "type": "module",
@@ -631,7 +631,7 @@ ${logContent}
631
631
  // Use the original sanitized content for upload since it's a plain text file
632
632
  await fs.writeFile(tempLogFile, await sanitizeLogContent(rawLogContent));
633
633
 
634
- // Use gh-upload-log to upload the log file
634
+ // Use gh-upload-log default auto mode and shared repository fallback.
635
635
  const uploadDescription = `Solution draft log for https://github.com/${owner}/${repo}/${targetType === 'pr' ? 'pull' : 'issues'}/${targetNumber}`;
636
636
  const uploadResult = await uploadLogWithGhUploadLog({
637
637
  logFile: tempLogFile,
@@ -28,6 +28,63 @@ const summarizeCommandOutput = value => {
28
28
  return text.length > 500 ? `${text.slice(0, 500)}... [truncated ${text.length - 500} chars]` : text;
29
29
  };
30
30
 
31
+ export const buildGhUploadLogArgs = ({ logFile, isPublic, description, verbose = false }) => {
32
+ if (!logFile) {
33
+ throw new Error('logFile is required for gh-upload-log');
34
+ }
35
+
36
+ const args = [logFile, isPublic ? '--public' : '--private'];
37
+
38
+ if (description) {
39
+ args.push('--description', description);
40
+ }
41
+ if (verbose) {
42
+ args.push('--verbose');
43
+ }
44
+
45
+ return args;
46
+ };
47
+
48
+ const quoteShellArg = value => {
49
+ const text = String(value);
50
+ if (/^[A-Za-z0-9_./:=@+-]+$/u.test(text)) return text;
51
+ return `"${text.replace(/(["\\$`])/gu, '\\$1')}"`;
52
+ };
53
+
54
+ const formatGhUploadLogCommand = args => `gh-upload-log ${args.map(quoteShellArg).join(' ')}`;
55
+
56
+ const runGhUploadLogCommand = async args => {
57
+ const { spawn } = await use('child_process');
58
+
59
+ return new Promise(resolve => {
60
+ const child = spawn('gh-upload-log', args, { stdio: ['ignore', 'pipe', 'pipe'] });
61
+ let stdout = '';
62
+ let stderr = '';
63
+ let settled = false;
64
+
65
+ const settle = value => {
66
+ if (!settled) {
67
+ settled = true;
68
+ resolve(value);
69
+ }
70
+ };
71
+
72
+ child.stdout?.on('data', chunk => {
73
+ stdout += chunk.toString();
74
+ });
75
+ child.stderr?.on('data', chunk => {
76
+ stderr += chunk.toString();
77
+ });
78
+ child.on('error', error => {
79
+ const errorText = stderr ? `${stderr}\n${error.message}` : error.message;
80
+ settle({ code: error.code === 'ENOENT' ? 127 : 1, stdout, stderr: errorText });
81
+ });
82
+ child.on('close', code => {
83
+ settle({ code: code ?? 1, stdout, stderr });
84
+ });
85
+ });
86
+ };
87
+
31
88
  export const parseGhUploadLogOutput = outputValue => {
32
89
  const output = outputValue?.toString?.() || '';
33
90
  const parsed = {
@@ -89,30 +146,18 @@ export const uploadLogWithGhUploadLog = async ({ logFile, isPublic, description,
89
146
  const result = { success: false, url: null, rawUrl: null, type: null, chunks: 1 };
90
147
 
91
148
  try {
92
- // Build command flags
93
- // IMPORTANT: When using command-stream's $ template tag, each ${} interpolation is treated
94
- // as a single argument. DO NOT use commandArgs.join(' ') as it will make all flags part
95
- // of the first positional argument, causing "File does not exist" errors.
96
- // See case study: docs/case-studies/issue-1096/README.md
97
- const publicFlag = isPublic ? '--public' : '--private';
149
+ const commandArgs = buildGhUploadLogArgs({
150
+ logFile,
151
+ isPublic,
152
+ description,
153
+ verbose,
154
+ });
98
155
 
99
156
  if (verbose) {
100
- const descDisplay = description ? ` --description "${description}"` : '';
101
- await log(` 📤 Running: gh-upload-log "${logFile}" ${publicFlag}${descDisplay} --verbose`, { verbose: true });
157
+ await log(` 📤 Running: ${formatGhUploadLogCommand(commandArgs)}`, { verbose: true });
102
158
  }
103
159
 
104
- // Execute command with separate interpolations for each argument
105
- // Each ${} is properly passed as a separate argument to the shell
106
- let uploadResult;
107
- if (description && verbose) {
108
- uploadResult = await $`gh-upload-log ${logFile} ${publicFlag} --description ${description} --verbose`;
109
- } else if (description) {
110
- uploadResult = await $`gh-upload-log ${logFile} ${publicFlag} --description ${description}`;
111
- } else if (verbose) {
112
- uploadResult = await $`gh-upload-log ${logFile} ${publicFlag} --verbose`;
113
- } else {
114
- uploadResult = await $`gh-upload-log ${logFile} ${publicFlag}`;
115
- }
160
+ const uploadResult = await runGhUploadLogCommand(commandArgs);
116
161
  const output = (uploadResult.stdout?.toString() || '') + (uploadResult.stderr?.toString() || '');
117
162
 
118
163
  if (uploadResult.code !== 0) {
@@ -252,5 +297,6 @@ export const uploadLogWithGhUploadLog = async ({ logFile, isPublic, description,
252
297
  // Export all functions as default object too
253
298
  export default {
254
299
  parseGhUploadLogOutput,
300
+ buildGhUploadLogArgs,
255
301
  uploadLogWithGhUploadLog,
256
302
  };