@ridit/forge 0.2.6 → 0.2.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.
- package/README.md +16 -2
- package/dist/index.mjs +4 -1
- package/package.json +1 -1
- package/src/utils/branch.ts +4 -1
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Forge
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> Git, but yours.
|
|
4
|
+
|
|
5
|
+
Forge is a lightweight version control system built from scratch. Designed to be simple and easy to understand — Forge gives you the core of a VCS without the complexity of Git.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
@@ -24,6 +26,7 @@ npm install -g @ridit/forge
|
|
|
24
26
|
- **Status** — view modified, staged, untracked, and deleted files
|
|
25
27
|
- **Checkpoints** — auto-saved snapshots when switching branches
|
|
26
28
|
- **ForgeIgnore** — `.forgeignore` support to exclude files
|
|
29
|
+
- **Content-addressable storage** — file content stored as hashed objects, never duplicated
|
|
27
30
|
|
|
28
31
|
## CLI Commands
|
|
29
32
|
|
|
@@ -56,16 +59,27 @@ Forge stores all data in a `.forge` folder at the root of your repository:
|
|
|
56
59
|
|
|
57
60
|
```
|
|
58
61
|
.forge/
|
|
62
|
+
├── objects/ ← content-addressable file storage (hashed)
|
|
59
63
|
├── commits/ ← global commit refs (lightweight)
|
|
60
64
|
├── branches/
|
|
61
65
|
│ └── main/
|
|
62
66
|
│ ├── branch.json ← branch metadata + latest commit id
|
|
63
67
|
│ ├── checkpoint.json ← auto-snapshot saved on branch switch
|
|
64
|
-
│ └── commits/ ← full commits with file
|
|
68
|
+
│ └── commits/ ← full commits with file hashes
|
|
65
69
|
├── repo.json ← repo metadata + active branch
|
|
66
70
|
└── tempAddedFiles.json ← staging area
|
|
67
71
|
```
|
|
68
72
|
|
|
73
|
+
## Object Storage
|
|
74
|
+
|
|
75
|
+
Instead of storing full file content in every commit, Forge uses a content-addressable object store — similar to how Git works internally.
|
|
76
|
+
|
|
77
|
+
- Every file is hashed with SHA-256 on `add`
|
|
78
|
+
- The content is stored once in `.forge/objects/` keyed by hash
|
|
79
|
+
- Commits store only file paths + hashes — not the full content
|
|
80
|
+
- Same file content across 100 commits = stored **once**
|
|
81
|
+
- Duplicate files across branches = stored **once**
|
|
82
|
+
|
|
69
83
|
## Branch System
|
|
70
84
|
|
|
71
85
|
- Every branch stores its own commit history
|
package/dist/index.mjs
CHANGED
|
@@ -44217,7 +44217,10 @@ function createBranch(repo_path, branch_name) {
|
|
|
44217
44217
|
}));
|
|
44218
44218
|
}
|
|
44219
44219
|
} catch (err) {
|
|
44220
|
-
return {
|
|
44220
|
+
return {
|
|
44221
|
+
status: "error",
|
|
44222
|
+
error: `error while creating branch: ${String(err)}.`
|
|
44223
|
+
};
|
|
44221
44224
|
}
|
|
44222
44225
|
return { status: "ok" };
|
|
44223
44226
|
}
|
package/package.json
CHANGED
package/src/utils/branch.ts
CHANGED