@forgehive/forge-cli 0.3.11 → 0.3.12
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/dist/runner.js +9 -6
- package/dist/tasks/auth/add.d.ts +16 -0
- package/dist/tasks/auth/add.js +56 -4
- package/dist/tasks/auth/clear.d.ts +16 -0
- package/dist/tasks/auth/clear.js +54 -0
- package/dist/tasks/auth/list.d.ts +2 -0
- package/dist/tasks/auth/list.js +10 -2
- package/dist/tasks/project/sync.d.ts +116 -0
- package/dist/tasks/project/sync.js +152 -0
- package/dist/tasks/task/createTask.d.ts +12 -0
- package/dist/tasks/task/createTask.js +51 -2
- package/dist/tasks/task/run.d.ts +10 -2
- package/dist/tasks/task/run.js +14 -6
- package/dist/tasks/types.d.ts +3 -0
- package/package.json +3 -3
- package/src/runner.ts +9 -6
- package/src/tasks/auth/add.ts +66 -4
- package/src/tasks/auth/clear.ts +63 -0
- package/src/tasks/auth/list.ts +10 -2
- package/src/tasks/project/sync.ts +202 -0
- package/src/tasks/task/createTask.ts +68 -2
- package/src/tasks/task/run.ts +17 -6
- package/src/tasks/types.ts +3 -0
package/src/tasks/task/run.ts
CHANGED
|
@@ -49,7 +49,7 @@ const boundaries = {
|
|
|
49
49
|
|
|
50
50
|
return buildsPath
|
|
51
51
|
},
|
|
52
|
-
sendLogToAPI: async (profile: Profile, projectName: string, record: ExecutionRecord): Promise<boolean> => {
|
|
52
|
+
sendLogToAPI: async (profile: Profile, projectName: string, record: ExecutionRecord, taskUuid?: string): Promise<{ success: boolean; logUuid?: string; taskUuid?: string }> => {
|
|
53
53
|
try {
|
|
54
54
|
const config = {
|
|
55
55
|
projectName,
|
|
@@ -64,19 +64,25 @@ const boundaries = {
|
|
|
64
64
|
const client = new HiveLogClient(config)
|
|
65
65
|
const result = await client.sendLog(record)
|
|
66
66
|
|
|
67
|
-
if (result === 'success') {
|
|
67
|
+
if (result === 'success' || (typeof result === 'object' && 'uuid' in result)) {
|
|
68
68
|
console.log('===============================================')
|
|
69
69
|
console.log('Log sent to API... ', profile.name, profile.url)
|
|
70
|
-
|
|
70
|
+
|
|
71
|
+
if (typeof result === 'object' && result && 'uuid' in result) {
|
|
72
|
+
const logResponse = result as { uuid: string }
|
|
73
|
+
return { success: true, logUuid: logResponse.uuid, taskUuid }
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return { success: true, taskUuid }
|
|
71
77
|
} else {
|
|
72
78
|
console.error('Failed to send log to API:', profile.url)
|
|
73
|
-
return false
|
|
79
|
+
return { success: false }
|
|
74
80
|
}
|
|
75
81
|
} catch (e) {
|
|
76
82
|
console.error('Failed to send log to API:', profile.url)
|
|
77
83
|
const error = e as Error
|
|
78
84
|
console.error('Error:', error.message)
|
|
79
|
-
return false
|
|
85
|
+
return { success: false }
|
|
80
86
|
}
|
|
81
87
|
}
|
|
82
88
|
}
|
|
@@ -97,6 +103,7 @@ export const run = createTask({
|
|
|
97
103
|
const forge: ForgeConf = await loadConf({})
|
|
98
104
|
const taskDescriptor = forge.tasks[descriptorName as keyof typeof forge.tasks]
|
|
99
105
|
const projectName = forge.project.name
|
|
106
|
+
const taskUuid = taskDescriptor?.uuid
|
|
100
107
|
|
|
101
108
|
if (taskDescriptor === undefined) {
|
|
102
109
|
throw new Error('Task is not defined on forge.json')
|
|
@@ -169,7 +176,11 @@ export const run = createTask({
|
|
|
169
176
|
|
|
170
177
|
if (profile) {
|
|
171
178
|
try {
|
|
172
|
-
await sendLogToAPI(profile, projectName, logItem)
|
|
179
|
+
const logResult = await sendLogToAPI(profile, projectName, logItem, taskUuid)
|
|
180
|
+
|
|
181
|
+
if (logResult.success && taskUuid) {
|
|
182
|
+
console.log(`🔗 View execution logs: ${profile.url}/tasks/${taskUuid}?tab=logs`)
|
|
183
|
+
}
|
|
173
184
|
} catch (e) {
|
|
174
185
|
console.error('Failed to send log to API:', e)
|
|
175
186
|
}
|