A minimal, deterministic, LLM-friendly, line-based file manipulation DSL
Project description
DataForge v0.2
A minimal, deterministic, LLM-friendly, line-based file manipulation DSL.
Install
pip install dfgscript
Afterwards three entry points are available:
dataforge script.dfg # canonical command
build script.dfg # alias matching the spec
py -m dataforge script.dfg # module invocation
Quick example
# notes.dfg
create-file "notes.txt"
1+Hello world
2+This is a test file
3+It has some content
4+End of file
dataforge notes.dfg # write the file
dataforge notes.dfg --dry-run # preview without writing
CLI flags
| Flag | Description |
|---|---|
--dry-run / --preview |
Show resulting file; do not write anything |
--backup-dir PATH |
Save a timestamped .bak copy before each write |
--log PATH |
Append log output to a file |
--verbose / -v |
Debug-level logging of every operation |
--version |
Print version and exit |
DSL reference
File-level commands
create-file "path" # create new — error if file exists
replace-file "path" # unconditional overwrite
change-file "path" # patch an existing file (creates if absent)
Line-level operations
N+<text> # write/replace line N (expands file with "" if N > length)
N-"<text>" # delete line N only if content matches exactly (warns otherwise)
N><text> # insert <text> after line N (shifts tail down)
$+<text> # append as new final line
Comments & blank lines
# This is a comment
Blank lines in a .dfg are ignored; use N+ with empty text to create a blank
line in the target file.
Python API
from dataforge import parse, run
source = open("edit.dfg").read()
script = parse(source) # → DfgScript
lines = run(script, dry_run=True) # → list[str]
lines = run(script, backup_dir=".backups") # write + backup
License
SOCL
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dfgscript-0.2.0.tar.gz
(8.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dfgscript-0.2.0.tar.gz.
File metadata
- Download URL: dfgscript-0.2.0.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2841fe7478c93c9f5130298e7c43c11d0d0604334bffa2bc42b11c5a9d61f3aa
|
|
| MD5 |
d02c275665a22efed317ba382990c2fc
|
|
| BLAKE2b-256 |
a21745d8576cb79f79ce6bc1a42e4e8ff23a2786a42954237e53891996c74c99
|
File details
Details for the file dfgscript-0.2.0-py3-none-any.whl.
File metadata
- Download URL: dfgscript-0.2.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30d98a64ae164b7601eb401bdb897dea80427d7636ec417cffd8fa043aec0458
|
|
| MD5 |
d702063a75ce26c39d8392d01f62f799
|
|
| BLAKE2b-256 |
8a54305f77c337be41dbe24505b3922475220e72254bcfdc5a873e5fa48e4d76
|