Skip to main content

latest
JSR Score
52%
Published
2 months ago (0.0.1)

Code Generator CLI

PoC

Install

$ deno install -Afg mod.ts --name codegen

Concept

I expect this module structure (generated by codegen new <name>).

deps.ts     # Declare external import modules
mod.ts      # export latest v*.ts
mod.test.ts # module test
lib.ts      # internal api. Programmer writes it.
v0.ts       # first version
v1.ts       # next version
v*.ts       # ...
README.md   # README
PROMPT.md   # Additional prompt

If you exec $ codegen, it generates next v*.ts.

codegen dedupe emits new v0.ts and mod.test.ts and remove others.

How to use

You cant edit PROMPT.md to fix code


First prompt

---

Second prompt
$ codegen new mymod
$ cd mymod
# Edit PROMPT.md
$ codegen
# Edit PROMPT.md
$ codegen
# ...

# run deno test
$ codegen fix
# manual command
$ codegen fix -- deno run -A __FILE__ mod.test.ts

# create refactor proposals and select and run it
$ codegen refactor
> select refactor command

$ codegen dedupe # delete all v*.ts and generate new v0

LICENSE

MIT

Add Package

deno add @mizchi/codegen

Import symbol

import * as mod from "@mizchi/codegen";

Add Package

npx jsr add @mizchi/codegen

Import symbol

import * as mod from "@mizchi/codegen";

Add Package

yarn dlx jsr add @mizchi/codegen

Import symbol

import * as mod from "@mizchi/codegen";

Add Package

pnpm dlx jsr add @mizchi/codegen

Import symbol

import * as mod from "@mizchi/codegen";

Add Package

bunx jsr add @mizchi/codegen

Import symbol

import * as mod from "@mizchi/codegen";