@eldrforge/shared 0.1.6 → 0.1.8

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.
Files changed (2) hide show
  1. package/guide/index.md +84 -0
  2. package/package.json +4 -3
package/guide/index.md ADDED
@@ -0,0 +1,84 @@
1
+ # @eldrforge/shared - Agentic Guide
2
+
3
+ ## Purpose
4
+
5
+ Shared utilities for Eldrforge tools. Provides storage, validation, error handling, date utilities, and common helpers.
6
+
7
+ ## Key Features
8
+
9
+ - **Storage** - File-based storage with JSON/YAML support
10
+ - **Validation** - Input validation and sanitization
11
+ - **Error Handling** - Custom error types (ArgumentError, CommandErrors, etc.)
12
+ - **Date Utilities** - Date parsing and formatting
13
+ - **Safety** - Safe file operations and input handling
14
+ - **Standard Input** - Interactive input reading
15
+
16
+ ## Usage
17
+
18
+ ```typescript
19
+ import {
20
+ Storage,
21
+ validateInput,
22
+ ArgumentError,
23
+ formatDate,
24
+ safeReadFile
25
+ } from '@eldrforge/shared';
26
+
27
+ // Storage
28
+ const storage = new Storage('config.json');
29
+ await storage.save({ key: 'value' });
30
+ const data = await storage.load();
31
+
32
+ // Validation
33
+ const valid = validateInput(userInput, schema);
34
+
35
+ // Error handling
36
+ if (!valid) {
37
+ throw new ArgumentError('Invalid input', { input: userInput });
38
+ }
39
+
40
+ // Date utilities
41
+ const formatted = formatDate(new Date(), 'YYYY-MM-DD');
42
+ ```
43
+
44
+ ## Dependencies
45
+
46
+ - dayjs - Date manipulation
47
+ - js-yaml - YAML parsing
48
+ - glob - File pattern matching
49
+ - moment-timezone - Timezone support
50
+ - semver - Version parsing
51
+ - zod - Schema validation
52
+
53
+ ## Package Structure
54
+
55
+ ```
56
+ src/
57
+ ├── errors/ # Error types
58
+ │ ├── ArgumentError.ts
59
+ │ ├── CancellationError.ts
60
+ │ ├── CommandErrors.ts
61
+ │ ├── ExitError.ts
62
+ │ └── index.ts
63
+ ├── storage.ts # File storage
64
+ ├── validation.ts # Input validation
65
+ ├── dates.ts # Date utilities
66
+ ├── general.ts # General utilities
67
+ ├── safety.ts # Safe operations
68
+ ├── stdin.ts # Standard input
69
+ ├── types.ts # Type definitions
70
+ └── index.ts
71
+ ```
72
+
73
+ ## Key Exports
74
+
75
+ - `Storage` - File-based storage
76
+ - `validateInput()` - Input validation
77
+ - `ArgumentError` - Argument validation error
78
+ - `CommandError` - Command execution error
79
+ - `CancellationError` - Operation cancelled
80
+ - `ExitError` - Process exit error
81
+ - `formatDate()` - Date formatting
82
+ - `safeReadFile()` - Safe file reading
83
+ - `sanitizeInput()` - Input sanitization
84
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eldrforge/shared",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Shared utilities for Eldrforge tools - storage, validation, errors, and more",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -11,7 +11,8 @@
11
11
  }
12
12
  },
13
13
  "files": [
14
- "dist"
14
+ "dist",
15
+ "guide"
15
16
  ],
16
17
  "repository": {
17
18
  "type": "git",
@@ -59,7 +60,7 @@
59
60
  }
60
61
  },
61
62
  "devDependencies": {
62
- "@eldrforge/git-tools": "^0.1.16",
63
+ "@eldrforge/git-tools": "^0.1.18",
63
64
  "@eslint/eslintrc": "^3.3.1",
64
65
  "@eslint/js": "^9.33.0",
65
66
  "@swc/core": "^1.13.3",