@forgehive/forge-cli 0.3.12 → 0.3.13

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.
@@ -17,10 +17,11 @@ export declare const run: import("@forgehive/task").TaskInstanceType<(argv: {
17
17
  }) => Promise<Promise<any>>;
18
18
  ensureLogFolder: (logsPath: string) => Promise<void>;
19
19
  ensureBuildsFolder: () => Promise<string>;
20
- sendLogToAPI: (profile: Profile, projectName: string, record: ExecutionRecord, taskUuid?: string) => Promise<{
20
+ sendLogToAPI: (profile: Profile, projectName: string, record: ExecutionRecord, taskUuid?: string, projectUuid?: string) => Promise<{
21
21
  success: boolean;
22
22
  logUuid?: string;
23
23
  taskUuid?: string;
24
+ skipRemoteLog?: boolean;
24
25
  }>;
25
26
  }>) => Promise<any>, {
26
27
  loadConf: (args: {}) => Promise<Promise<ForgeConf>>;
@@ -36,9 +37,10 @@ export declare const run: import("@forgehive/task").TaskInstanceType<(argv: {
36
37
  }) => Promise<Promise<any>>;
37
38
  ensureLogFolder: (logsPath: string) => Promise<void>;
38
39
  ensureBuildsFolder: () => Promise<string>;
39
- sendLogToAPI: (profile: Profile, projectName: string, record: ExecutionRecord, taskUuid?: string) => Promise<{
40
+ sendLogToAPI: (profile: Profile, projectName: string, record: ExecutionRecord, taskUuid?: string, projectUuid?: string) => Promise<{
40
41
  success: boolean;
41
42
  logUuid?: string;
42
43
  taskUuid?: string;
44
+ skipRemoteLog?: boolean;
43
45
  }>;
44
46
  }>;
@@ -50,10 +50,27 @@ const boundaries = {
50
50
  }
51
51
  return buildsPath;
52
52
  },
53
- sendLogToAPI: async (profile, projectName, record, taskUuid) => {
53
+ sendLogToAPI: async (profile, projectName, record, taskUuid, projectUuid) => {
54
+ // Check if we have required UUIDs for the new endpoint
55
+ if (!projectUuid || !taskUuid) {
56
+ console.log('===============================================');
57
+ console.log('⚠️ Remote logging skipped - missing UUIDs');
58
+ console.log('');
59
+ console.log('To enable remote logging with enhanced features:');
60
+ if (!projectUuid) {
61
+ console.log('• Use "forge project:create" to create a new project, or');
62
+ console.log('• Use "forge project:link" to connect to an existing project');
63
+ }
64
+ if (!taskUuid) {
65
+ console.log('• Use "forge project:sync" to get the task to have UUID');
66
+ }
67
+ console.log('===============================================');
68
+ return { success: true, skipRemoteLog: true };
69
+ }
54
70
  try {
55
71
  const config = {
56
72
  projectName,
73
+ projectUuid,
57
74
  apiKey: profile.apiKey,
58
75
  apiSecret: profile.apiSecret,
59
76
  host: profile.url,
@@ -62,10 +79,13 @@ const boundaries = {
62
79
  }
63
80
  };
64
81
  const client = new hive_sdk_1.HiveLogClient(config);
65
- const result = await client.sendLog(record);
82
+ console.log('Sending execution log to Hive...');
83
+ const result = await client.sendLogByUuid(record, taskUuid);
66
84
  if (result === 'success' || (typeof result === 'object' && 'uuid' in result)) {
67
85
  console.log('===============================================');
68
- console.log('Log sent to API... ', profile.name, profile.url);
86
+ console.log('Log sent to Hive successfully');
87
+ console.log(` Profile: ${profile.name}`);
88
+ console.log(` Host: ${profile.url}`);
69
89
  if (typeof result === 'object' && result && 'uuid' in result) {
70
90
  const logResponse = result;
71
91
  return { success: true, logUuid: logResponse.uuid, taskUuid };
@@ -73,12 +93,12 @@ const boundaries = {
73
93
  return { success: true, taskUuid };
74
94
  }
75
95
  else {
76
- console.error('Failed to send log to API:', profile.url);
96
+ console.error('Failed to send log to Hive:', profile.url);
77
97
  return { success: false };
78
98
  }
79
99
  }
80
100
  catch (e) {
81
- console.error('Failed to send log to API:', profile.url);
101
+ console.error('Failed to send log to Hive:', profile.url);
82
102
  const error = e;
83
103
  console.error('Error:', error.message);
84
104
  return { success: false };
@@ -93,6 +113,7 @@ exports.run = (0, task_1.createTask)({
93
113
  const forge = await loadConf({});
94
114
  const taskDescriptor = forge.tasks[descriptorName];
95
115
  const projectName = forge.project.name;
116
+ const projectUuid = forge.project.uuid;
96
117
  const taskUuid = taskDescriptor?.uuid;
97
118
  if (taskDescriptor === undefined) {
98
119
  throw new Error('Task is not defined on forge.json');
@@ -154,8 +175,8 @@ exports.run = (0, task_1.createTask)({
154
175
  await tape.save();
155
176
  if (profile) {
156
177
  try {
157
- const logResult = await sendLogToAPI(profile, projectName, logItem, taskUuid);
158
- if (logResult.success && taskUuid) {
178
+ const logResult = await sendLogToAPI(profile, projectName, logItem, taskUuid, projectUuid);
179
+ if (logResult.success && !logResult.skipRemoteLog && taskUuid) {
159
180
  console.log(`🔗 View execution logs: ${profile.url}/tasks/${taskUuid}?tab=logs`);
160
181
  }
161
182
  }
@@ -0,0 +1 @@
1
+ {"input":{},"boundaries":{"loadConf":[{"input":[{}],"output":{"project":{"name":"forge-cli"},"paths":{"logs":"logs/","fixtures":"fixtures","fingerprints":"fingerprints/","tasks":"src/tasks/","runners":"src/runners/","tests":"src/tests/"},"infra":{"region":"us-west-2","bucket":""},"tasks":{"task:createTask":{"path":"src/tasks/task/createTask.ts","handler":"createTask"},"bundle:create":{"path":"src/tasks/bundle/create.ts","handler":"create"},"bundle:load":{"path":"src/tasks/bundle/load.ts","handler":"load"},"task:run":{"path":"src/tasks/task/run.ts","handler":"run"},"task:remove":{"path":"src/tasks/task/remove.ts","handler":"remove"},"conf:info":{"path":"src/tasks/conf/info.ts","handler":"info"},"runner:create":{"path":"src/tasks/runner/create.ts","handler":"create"},"runner:remove":{"path":"src/tasks/runner/remove.ts","handler":"remove"},"runner:bundle":{"path":"src/tasks/runner/bundle.ts","handler":"bundle"},"task:publish":{"path":"src/tasks/task/publish.ts","handler":"publish"},"task:download":{"path":"src/tasks/task/download.ts","handler":"download"},"auth:add":{"path":"src/tasks/auth/add.ts","handler":"add"},"auth:load":{"path":"src/tasks/auth/load.ts","handler":"load"},"auth:loadCurrent":{"path":"src/tasks/auth/loadCurrent.ts","handler":"loadCurrent"},"auth:switch":{"path":"src/tasks/auth/switch.ts","handler":"switchProfile"},"auth:list":{"path":"src/tasks/auth/list.ts","handler":"list"},"auth:remove":{"path":"src/tasks/auth/remove.ts","handler":"remove"},"task:replay":{"path":"src/tasks/task/replay.ts","handler":"replay"},"fixture:download":{"path":"src/tasks/fixture/download.ts","handler":"download"},"bundle:zip":{"path":"src/tasks/bundle/zip.ts","handler":"zip"},"task:list":{"path":"src/tasks/task/list.ts","handler":"list"},"task:describe":{"path":"src/tasks/task/describe.ts","handler":"describe"},"task:fingerprint":{"path":"src/tasks/task/fingerprint.ts","handler":"fingerprint"},"bundle:fingerprint":{"path":"src/tasks/bundle/fingerprint.ts","handler":"fingerprint"},"task:invoke":{"path":"src/tasks/task/invoke.ts","handler":"invoke"},"docs:download":{"path":"src/tasks/docs/download.ts","handler":"download"},"project:create":{"path":"src/tasks/project/create.ts","handler":"create"},"project:link":{"path":"src/tasks/project/link.ts","handler":"link","uuid":"cb9f82e1-d397-46d9-9f0d-2b0e3becbfa1"},"project:unlink":{"path":"src/tasks/project/unlink.ts","handler":"unlink","uuid":"414d37de-793c-4d01-899d-69515f5e0948"}},"runners":{}},"timing":{"startTime":1755627445111,"endTime":1755627445112,"duration":1}}]},"metadata":{"environment":"cli"},"metrics":[],"type":"success","output":{"taskCount":29},"timing":{"startTime":1755627445111,"endTime":1755627445112,"duration":1}}
@@ -0,0 +1 @@
1
+ {"input":{},"boundaries":{},"taskName":"test:guidance","metadata":{"environment":"cli"},"metrics":[],"type":"success","output":{},"timing":{"startTime":1755627427045,"endTime":1755627427045,"duration":0}}
@@ -0,0 +1 @@
1
+ {"uuid":"0198bfeb-69c0-77e8-882b-a76dcb9300f9","input":{},"boundaries":{},"taskName":"test:uuid","metadata":{"environment":"cli"},"metrics":[],"type":"success","output":{},"timing":{"startTime":1755566533056,"endTime":1755566533057,"duration":1}}
@@ -0,0 +1 @@
1
+ {"input":{},"boundaries":{},"taskName":"test:uuidCheck","metadata":{"environment":"cli"},"metrics":[],"type":"success","output":{},"timing":{"startTime":1755567492456,"endTime":1755567492456,"duration":0}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgehive/forge-cli",
3
- "version": "0.3.12",
3
+ "version": "0.3.13",
4
4
  "description": "TypeScript CLI application",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -10,11 +10,11 @@
10
10
  "publishConfig": {
11
11
  "access": "public",
12
12
  "dependencies": {
13
- "@forgehive/hive-sdk": "^0.1.3",
14
- "@forgehive/record-tape": "^0.2.5",
15
- "@forgehive/runner": "^0.2.5",
13
+ "@forgehive/hive-sdk": "^0.1.4",
14
+ "@forgehive/record-tape": "^0.2.6",
15
+ "@forgehive/runner": "^0.2.6",
16
16
  "@forgehive/schema": "^0.1.4",
17
- "@forgehive/task": "^0.2.5",
17
+ "@forgehive/task": "^0.2.6",
18
18
  "esbuild": "^0.25.0",
19
19
  "handlebars": "^4.7.8",
20
20
  "minimist": "^1.2.8",
@@ -30,11 +30,11 @@
30
30
  "minimist": "^1.2.8",
31
31
  "typescript": "^5.3.3",
32
32
  "uuid": "^11.1.0",
33
- "@forgehive/hive-sdk": "0.1.3",
34
- "@forgehive/record-tape": "0.2.5",
35
- "@forgehive/runner": "0.2.5",
36
- "@forgehive/schema": "0.1.4",
37
- "@forgehive/task": "0.2.5"
33
+ "@forgehive/record-tape": "0.2.6",
34
+ "@forgehive/hive-sdk": "0.1.4",
35
+ "@forgehive/task": "0.2.6",
36
+ "@forgehive/runner": "0.2.6",
37
+ "@forgehive/schema": "0.1.4"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/archiver": "^6.0.3",
@@ -49,10 +49,34 @@ const boundaries = {
49
49
 
50
50
  return buildsPath
51
51
  },
52
- sendLogToAPI: async (profile: Profile, projectName: string, record: ExecutionRecord, taskUuid?: string): Promise<{ success: boolean; logUuid?: string; taskUuid?: string }> => {
52
+ sendLogToAPI: async (
53
+ profile: Profile,
54
+ projectName: string,
55
+ record: ExecutionRecord,
56
+ taskUuid?: string,
57
+ projectUuid?: string
58
+ ): Promise<{ success: boolean; logUuid?: string; taskUuid?: string; skipRemoteLog?: boolean }> => {
59
+ // Check if we have required UUIDs for the new endpoint
60
+ if (!projectUuid || !taskUuid) {
61
+ console.log('===============================================')
62
+ console.log('⚠️ Remote logging skipped - missing UUIDs')
63
+ console.log('')
64
+ console.log('To enable remote logging with enhanced features:')
65
+ if (!projectUuid) {
66
+ console.log('• Use "forge project:create" to create a new project, or')
67
+ console.log('• Use "forge project:link" to connect to an existing project')
68
+ }
69
+ if (!taskUuid) {
70
+ console.log('• Use "forge project:sync" to get the task to have UUID')
71
+ }
72
+ console.log('===============================================')
73
+ return { success: true, skipRemoteLog: true }
74
+ }
75
+
53
76
  try {
54
77
  const config = {
55
78
  projectName,
79
+ projectUuid,
56
80
  apiKey: profile.apiKey,
57
81
  apiSecret: profile.apiSecret,
58
82
  host: profile.url,
@@ -62,11 +86,14 @@ const boundaries = {
62
86
  }
63
87
 
64
88
  const client = new HiveLogClient(config)
65
- const result = await client.sendLog(record)
89
+ console.log('Sending execution log to Hive...')
90
+ const result = await client.sendLogByUuid(record, taskUuid)
66
91
 
67
92
  if (result === 'success' || (typeof result === 'object' && 'uuid' in result)) {
68
93
  console.log('===============================================')
69
- console.log('Log sent to API... ', profile.name, profile.url)
94
+ console.log('Log sent to Hive successfully')
95
+ console.log(` Profile: ${profile.name}`)
96
+ console.log(` Host: ${profile.url}`)
70
97
 
71
98
  if (typeof result === 'object' && result && 'uuid' in result) {
72
99
  const logResponse = result as { uuid: string }
@@ -75,11 +102,11 @@ const boundaries = {
75
102
 
76
103
  return { success: true, taskUuid }
77
104
  } else {
78
- console.error('Failed to send log to API:', profile.url)
105
+ console.error('Failed to send log to Hive:', profile.url)
79
106
  return { success: false }
80
107
  }
81
108
  } catch (e) {
82
- console.error('Failed to send log to API:', profile.url)
109
+ console.error('Failed to send log to Hive:', profile.url)
83
110
  const error = e as Error
84
111
  console.error('Error:', error.message)
85
112
  return { success: false }
@@ -103,6 +130,7 @@ export const run = createTask({
103
130
  const forge: ForgeConf = await loadConf({})
104
131
  const taskDescriptor = forge.tasks[descriptorName as keyof typeof forge.tasks]
105
132
  const projectName = forge.project.name
133
+ const projectUuid = forge.project.uuid
106
134
  const taskUuid = taskDescriptor?.uuid
107
135
 
108
136
  if (taskDescriptor === undefined) {
@@ -176,9 +204,9 @@ export const run = createTask({
176
204
 
177
205
  if (profile) {
178
206
  try {
179
- const logResult = await sendLogToAPI(profile, projectName, logItem, taskUuid)
207
+ const logResult = await sendLogToAPI(profile, projectName, logItem, taskUuid, projectUuid)
180
208
 
181
- if (logResult.success && taskUuid) {
209
+ if (logResult.success && !logResult.skipRemoteLog && taskUuid) {
182
210
  console.log(`🔗 View execution logs: ${profile.url}/tasks/${taskUuid}?tab=logs`)
183
211
  }
184
212
  } catch (e) {