@forgehive/forge-cli 0.3.0 → 0.3.1

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.
@@ -122,23 +122,17 @@ exports.run = (0, task_1.createTask)({
122
122
  throw new Error(`Handler "${taskDescriptor.handler}" not found in bundle`);
123
123
  }
124
124
  // Setup record tape
125
- let tape = new record_tape_1.RecordTape({
125
+ const tape = new record_tape_1.RecordTape({
126
126
  path: logsPath
127
127
  });
128
128
  // load record tape
129
129
  try {
130
130
  await tape.load();
131
- // Need to figure out how to handle the log length
132
- // and other options for the RecordTape
133
- // For now, we'll just keep the implementation simple
134
- const maxLogLength = 9;
135
- const log = tape.getLog();
136
- if (log.length > maxLogLength) {
137
- const newTape = new record_tape_1.RecordTape({
138
- path: logsPath,
139
- log: log.slice(-maxLogLength)
140
- });
141
- tape = newTape;
131
+ // Maintain a maximum log length by removing old records
132
+ const maxLogLength = 10;
133
+ // Remove records from the beginning until we're within the limit
134
+ while (tape.getLength() >= maxLogLength) {
135
+ tape.shift();
142
136
  }
143
137
  }
144
138
  catch (_error) {
@@ -146,7 +140,7 @@ exports.run = (0, task_1.createTask)({
146
140
  }
147
141
  // Run the task with provided arguments
148
142
  const [result, error, record] = await task.safeRun(args);
149
- const logItem = tape.push(descriptorName, record, {
143
+ const logItem = tape.push(record, {
150
144
  environment: 'cli'
151
145
  });
152
146
  await tape.save();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forgehive/forge-cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "TypeScript CLI application",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -10,10 +10,10 @@
10
10
  "publishConfig": {
11
11
  "access": "public",
12
12
  "dependencies": {
13
- "@forgehive/record-tape": "^0.2.0",
14
- "@forgehive/runner": "^0.2.0",
13
+ "@forgehive/record-tape": "^0.2.1",
14
+ "@forgehive/runner": "^0.2.1",
15
15
  "@forgehive/schema": "^0.1.4",
16
- "@forgehive/task": "^0.2.0",
16
+ "@forgehive/task": "^0.2.1",
17
17
  "esbuild": "^0.25.0",
18
18
  "handlebars": "^4.7.8",
19
19
  "minimist": "^1.2.8"
@@ -26,10 +26,10 @@
26
26
  "esbuild": "^0.25.0",
27
27
  "handlebars": "^4.7.8",
28
28
  "minimist": "^1.2.8",
29
- "@forgehive/record-tape": "0.2.0",
30
- "@forgehive/task": "0.2.0",
31
29
  "@forgehive/schema": "0.1.4",
32
- "@forgehive/runner": "0.2.0"
30
+ "@forgehive/runner": "0.2.1",
31
+ "@forgehive/record-tape": "0.2.1",
32
+ "@forgehive/task": "0.2.1"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/archiver": "^6.0.3",
@@ -141,7 +141,7 @@ export const run = createTask({
141
141
  }
142
142
 
143
143
  // Setup record tape
144
- let tape = new RecordTape({
144
+ const tape = new RecordTape({
145
145
  path: logsPath
146
146
  })
147
147
 
@@ -149,19 +149,12 @@ export const run = createTask({
149
149
  try {
150
150
  await tape.load()
151
151
 
152
- // Need to figure out how to handle the log length
153
- // and other options for the RecordTape
154
- // For now, we'll just keep the implementation simple
155
- const maxLogLength = 9
156
- const log = tape.getLog()
152
+ // Maintain a maximum log length by removing old records
153
+ const maxLogLength = 10
157
154
 
158
- if (log.length > maxLogLength) {
159
- const newTape = new RecordTape({
160
- path: logsPath,
161
- log: log.slice(-maxLogLength)
162
- })
163
-
164
- tape = newTape
155
+ // Remove records from the beginning until we're within the limit
156
+ while (tape.getLength() >= maxLogLength) {
157
+ tape.shift()
165
158
  }
166
159
  } catch (_error) {
167
160
  // if the tape is not found, create a new one on saving
@@ -169,7 +162,7 @@ export const run = createTask({
169
162
 
170
163
  // Run the task with provided arguments
171
164
  const [result, error, record] = await task.safeRun(args)
172
- const logItem = tape.push(descriptorName, record, {
165
+ const logItem = tape.push(record, {
173
166
  environment: 'cli'
174
167
  })
175
168
  await tape.save()