Quick start¶
Install¶
npm i -D deukpack # per project
npm i -g deukpack # global CLI
- Node.js 18 or later, for the CLI only
- Install registers the AI agent skill → AI agents
Schema¶
hero.deuk:
namespace Dto
struct Hero {
1> required int32 id
2> required string name
3> optional float hp
}
.protoand.thriftwork as input too → IDL
Generate¶
npx deukpack gen hero.deuk --lang typescript --out generated
npx deukpack gen hero.deuk --lang csharp,python --out generated
- Several languages →
<out>/<language>/ - PowerShell:
--lang "csharp,python" generated/= objects, codecs and their runtime. The app installs nothing else
TypeScript¶
import { Hero } from './generated/dto'; // file = namespace (Dto → dto)
import { HeroCodec } from './generated/dto.codec';
const hero = new Hero();
hero.id = 1;
hero.name = 'Deuki';
const bytes = HeroCodec.pack(hero, 'dppack'); // Uint8Array
const back = HeroCodec.unpack(bytes, 'dppack'); // Hero
Python¶
pip install "pydantic>=2"
npx deukpack gen hero.deuk --lang python --out generated
from generated.dto import Hero
from generated.dto_codec import HeroCodec
hero = Hero(id=1, name="Deuki")
data = HeroCodec.pack(hero, "dppack") # bytes
back = HeroCodec.unpack(data, "dppack") # Hero
- Other languages: Languages
- Switch format: change the second argument only,
'dpjson'→'dppack'
Update¶
npm i -D deukpack@latest
npx deukpack --version
npx deukpack gen # deukpack.json, or the same gen arguments as before
- Regenerate after every update. Generated runtime = the version that wrote it
- Commit the regenerated folder together with the version bump