@chronicle.app/shell 0.3.0 → 0.4.0
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Extractor } from '@chronicle.app/etl';
|
|
1
|
+
import { Extractor, fileError } from '@chronicle.app/etl';
|
|
2
2
|
import { readFile, access } from 'node:fs/promises';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import os from 'node:os';
|
|
@@ -25,7 +25,9 @@ export class ShellHistoryExtractor extends Extractor {
|
|
|
25
25
|
});
|
|
26
26
|
async detectShellType() {
|
|
27
27
|
if (this.config.input) {
|
|
28
|
-
const content = await readFile(this.config.input, 'utf8')
|
|
28
|
+
const content = await readFile(this.config.input, 'utf8').catch(error => {
|
|
29
|
+
throw fileError(error, this.config.input, 'shell history');
|
|
30
|
+
});
|
|
29
31
|
if (/^: \d+:\d+;/m.test(content))
|
|
30
32
|
return 'zsh';
|
|
31
33
|
if (/^- cmd: /m.test(content))
|
|
@@ -101,6 +103,9 @@ export class ShellHistoryExtractor extends Extractor {
|
|
|
101
103
|
}
|
|
102
104
|
}
|
|
103
105
|
catch (error) {
|
|
106
|
+
const typed = fileError(error, inputPath, `${shellType} history`);
|
|
107
|
+
if (typed !== error)
|
|
108
|
+
throw typed;
|
|
104
109
|
throw new Error(`Failed to read ${shellType} history file from ${inputPath}: ${error}`);
|
|
105
110
|
}
|
|
106
111
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chronicle.app/shell",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"type": "module",
|
|
20
20
|
"description": "Chronicle shell extraction plugin",
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@chronicle.app/etl": "0.
|
|
23
|
-
"@chronicle.app/schema": "0.
|
|
24
|
-
"@chronicle.app/tsconfig": "0.
|
|
22
|
+
"@chronicle.app/etl": "0.4.0",
|
|
23
|
+
"@chronicle.app/schema": "0.4.0",
|
|
24
|
+
"@chronicle.app/tsconfig": "0.4.0",
|
|
25
25
|
"@types/node": "^22.10.1",
|
|
26
26
|
"typescript": "^5.7.2"
|
|
27
27
|
},
|