@tpmjs/tools-sprites-checkpoint-create 0.1.1 → 0.1.2
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/README.md +68 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# @tpmjs/sprites-checkpoint-create
|
|
2
|
+
|
|
3
|
+
Create a point-in-time snapshot (checkpoint) of a sprite's filesystem state for later restoration.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @tpmjs/sprites-checkpoint-create
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Requirements
|
|
12
|
+
|
|
13
|
+
- `SPRITES_TOKEN` environment variable - Get your token from https://sprites.dev
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { spritesCheckpointCreateTool } from '@tpmjs/sprites-checkpoint-create';
|
|
19
|
+
|
|
20
|
+
const result = await spritesCheckpointCreateTool.execute({
|
|
21
|
+
name: 'my-sandbox',
|
|
22
|
+
checkpointName: 'before-experiment'
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
console.log(result);
|
|
26
|
+
// {
|
|
27
|
+
// id: 'chk_abc123',
|
|
28
|
+
// name: 'before-experiment',
|
|
29
|
+
// createdAt: '2024-01-15T10:30:00Z',
|
|
30
|
+
// size: 52428800
|
|
31
|
+
// }
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Input Parameters
|
|
35
|
+
|
|
36
|
+
| Parameter | Type | Required | Description |
|
|
37
|
+
|-----------|------|----------|-------------|
|
|
38
|
+
| `name` | `string` | Yes | Name of the sprite to checkpoint |
|
|
39
|
+
| `checkpointName` | `string` | No | Optional human-readable name for the checkpoint |
|
|
40
|
+
|
|
41
|
+
## Output
|
|
42
|
+
|
|
43
|
+
| Field | Type | Description |
|
|
44
|
+
|-------|------|-------------|
|
|
45
|
+
| `id` | `string` | Unique checkpoint identifier (use this for restore) |
|
|
46
|
+
| `name` | `string?` | Human-readable checkpoint name if provided |
|
|
47
|
+
| `createdAt` | `string` | ISO 8601 timestamp of creation |
|
|
48
|
+
| `size` | `number?` | Checkpoint size in bytes |
|
|
49
|
+
|
|
50
|
+
## Use Cases
|
|
51
|
+
|
|
52
|
+
- Save state before risky operations
|
|
53
|
+
- Create restore points for experiments
|
|
54
|
+
- Backup filesystem before installing packages
|
|
55
|
+
- Version control for sprite state
|
|
56
|
+
|
|
57
|
+
## Error Handling
|
|
58
|
+
|
|
59
|
+
The tool throws errors in these cases:
|
|
60
|
+
- `SPRITES_TOKEN` environment variable is not set
|
|
61
|
+
- Sprite not found (HTTP 404)
|
|
62
|
+
- Invalid or expired API token (HTTP 401)
|
|
63
|
+
- Network timeout (120 second limit for large checkpoints)
|
|
64
|
+
- API errors with descriptive messages
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
|
|
68
|
+
MIT
|