@mbsi/mkcmd 0.2.2 → 0.2.3

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/CHANGELOG.md CHANGED
@@ -7,40 +7,61 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.3] - 2025-12-30
11
+
12
+ ### Fixed
13
+
14
+ I forgot to push some files from 0.2.2 to github and then forgot to make sure they existed before publishing to npm.
15
+ Oh well.
10
16
 
11
17
  ## [0.2.2] - 2025-12-30
12
18
 
13
19
  ### Added
20
+
14
21
  - `src/core/helpers/stringifier.ts` to codegen before building
15
22
  - `prebuild` script to dynamically update the code located in data/core at build time.
16
23
  - `src/data/core.ts` is generated / regenerated at before building for use in dist
24
+ - `README.md` - Rewrote to make sense for display on NPM store as NPX package
17
25
 
18
26
  ### Fixed
27
+
19
28
  - `src/functions/scaffold-core.ts` doesn't try to pull data that doesn't exist anymore :^)
29
+ - `src/core/cli.ts` doesn't try to read the version from the user's computer anymore (hopefully)
30
+
31
+ ### Moved
32
+
33
+ - Original `README.md` moved to `src/README.md` - it's for devs, anyways.
20
34
 
21
35
  ## [0.2.1] - 2025-12-30
36
+
22
37
  ### Added
38
+
23
39
  - `CHANGELOG.md` for tracking changes
24
40
 
25
41
  ### Changed
42
+
26
43
  - Simplified `file-utils.ts` by removing path caching (was causing issues with non-existent directories)
27
44
 
28
45
  ### Fixed
46
+
29
47
  - Directory creation bug: `realpath()` now replaced with `resolve()` to handle new target directories
30
48
  - Path resolution in bundled code for version command
31
49
 
32
50
  ### Removed
51
+
33
52
  - Path caching in `file-utils.ts` (unnecessary optimization causing failures)
34
53
  - Removed unused imports in `src/functions/orchestrate-scaffold.ts` to lint warnings
35
54
 
36
55
  ## [0.2.0] - 2025-12-30
37
56
 
38
57
  ### Added
58
+
39
59
  - Build system with `bun build --target=bun`
40
60
  - Build scripts: `build`, `build:exe`, `prepack`
41
61
  - npm package preparation (removed `private: true`)
42
62
 
43
63
  ### Changed
64
+
44
65
  - Moved `typescript` from peerDependencies to devDependencies
45
66
  - Updated package.json entry points to `./dist/index.js`
46
67
  - Fixed `--version` command to use `process.cwd()` for package.json resolution
@@ -48,6 +69,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
48
69
  ## [0.1.0] - 2025-12-30
49
70
 
50
71
  ### Added
72
+
51
73
  - Initial CLI scaffolding tool
52
74
  - Interactive project setup with `@clack/prompts`
53
75
  - Full CLI scaffold generation (package.json, tsconfig.json, README.md, core files)
package/README.md CHANGED
@@ -1,111 +1,133 @@
1
1
  # mkcmd
2
2
 
3
- A remote node executable for scaffolding other remote node executables with sensible defaults.
4
-
5
- **Version:** 0.2.0 | See [CHANGELOG.md](./CHANGELOG.md) for version history.
3
+ A CLI tool for scaffolding new CLI projects with sensible defaults. Create command-line tools with TypeScript, Bun runtime, and a solid core structure out of the box.
6
4
 
7
5
  ## Features
8
6
 
9
- - **Interactive Project Setup** - Prompts for project name, target directory, and description using `@clack/prompts`
10
- - **Full CLI Scaffold** - Generates a complete CLI project structure with configuration files
11
- - **Core Utilities Included** - Ships with `file-builder.ts` and `file-utils.ts` for dynamic code generation
12
- - **TypeScript & Bun** - Pre-configured TypeScript settings and Bun runtime support
13
- - **Dynamic Core Copying** - Automatically copies all core CLI files to your new project
7
+ - **Interactive Setup** - Prompts for project name, location, and description
8
+ - **Complete CLI Framework** - Generates a working CLI with command registration, logging, and helpers
9
+ - **TypeScript + Bun** - Pre-configured with TypeScript and Bun runtime support
10
+ - **Core Utilities** - Includes `FileBuilder` for dynamic code generation and file utilities
11
+ - **Extensible** - Easy to add your own commands
12
+
13
+ > [!WARNING]
14
+ > While you can *run* the program in without Bun, the source code itself **depends on Bun** for development and building.
15
+
16
+ ## Run remotely
17
+
18
+ ```bash
19
+ npx @mbsi/mkcmd init
20
+ # or
21
+ bun @mbsi/mkcmd init
22
+ ```
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ npm install -g @mbsi/mkcmd
28
+ # or
29
+ bun install -g @mbsi/mkcmd
30
+ ```
31
+
32
+ ## Quick Start
33
+
34
+ ```bash
35
+ mkcmd init
36
+ ```
37
+
38
+ The `init` command will prompt you for:
39
+ - Project name
40
+ - Target directory (defaults to `./<project-name>`)
41
+ - Project description
14
42
 
15
43
  ## What Gets Scaffolding
16
44
 
17
- When you run `mkcmd init`, it creates:
45
+ After running `mkcmd init`, you'll have a complete CLI project:
18
46
 
19
47
  ```
20
- project-name/
48
+ my-cli/
21
49
  ├── src/
22
50
  │ ├── core/
23
- │ │ ├── cli.ts # CLI framework with command registration
24
- │ │ ├── log.ts # Logging helpers (single/multi info/warn/err, title)
25
- │ │ ├── file-builder.ts # Indentation-aware file builder
26
- │ │ └── file-utils.ts # Path caching and file writing utilities
51
+ │ │ ├── cli.ts # CLI framework with command registration
52
+ │ │ ├── log.ts # Logging helpers (single/multi info/warn/err, title)
53
+ │ │ └── helpers/
54
+ │ │ ├── file-builder.ts # Indentation-aware file builder
55
+ │ │ └── file-utils.ts # Path and file writing utilities
27
56
  │ ├── commands/
28
- │ │ └── index.ts # Command registration hook
29
- │ └── config.ts # Project configuration
57
+ │ │ └── index.ts # Command registration hook
58
+ │ └── config.ts # Project configuration
30
59
  ├── package.json
31
60
  ├── tsconfig.json
32
61
  └── README.md
33
62
  ```
34
63
 
35
- ## Installation
64
+ ## Usage
36
65
 
37
- ### For Development
66
+ ### Running Your New CLI
38
67
 
39
68
  ```bash
69
+ cd my-cli
40
70
  bun install
71
+ bun run src/index.ts --help
41
72
  ```
42
73
 
43
- ### From npm (after publishing)
44
-
45
- ```bash
46
- npm install -g mkcmd
47
- # or
48
- bun install -g mkcmd
49
- ```
50
-
51
- ## Usage
52
-
53
- ### Development
74
+ ### Adding Commands
54
75
 
55
- ```bash
56
- # Show help
57
- bun run src/index.ts --help
76
+ Commands are registered in `src/commands/index.ts`. Here's the pattern:
58
77
 
59
- # Show version
60
- bun run src/index.ts --version
78
+ ```typescript
79
+ import { registerCommand } from "../core/cli";
61
80
 
62
- # Initialize a new CLI project
63
- bun run src/index.ts init
81
+ registerCommand({
82
+ name: "greet",
83
+ description: "Say hello",
84
+ instructions: "Pass a name to greet",
85
+ run: async (args: string[]) => {
86
+ const name = args[0] || "world";
87
+ console.log(`Hello, ${name}!`);
88
+ }
89
+ });
64
90
  ```
65
91
 
66
- ### Using Built Distribution
92
+ Then run:
67
93
 
68
94
  ```bash
69
- # Build for Bun runtime
70
- bun run build
71
- bun dist/index.js --help
72
-
73
- # Build standalone executable
74
- bun run build:exe
75
- ./dist/mkcmd --help
95
+ bun run src/index.ts greet
96
+ bun run src/index.ts greet Alice
76
97
  ```
77
98
 
78
- ### After Installation (from npm)
99
+ ### Using the File Builder
79
100
 
80
- ```bash
81
- mkcmd --help
82
- mkcmd init
83
- ```
101
+ The included `FileBuilder` helps generate code files dynamically:
84
102
 
85
- The `init` command will prompt you for:
86
- - Project name
87
- - Target directory (defaults to `./<project-name>`)
88
- - Project description
103
+ ```typescript
104
+ import { FileBuilder } from "./core/helpers/file-builder";
105
+
106
+ const fb = new FileBuilder();
107
+ fb.addLine("export function hello() {");
108
+ fb.addLine(' console.log("Hello!");', 1);
109
+ fb.addLine("}");
110
+ const code = fb.build();
111
+ ```
89
112
 
90
- ## Building for npm
113
+ ## CLI Flags
91
114
 
92
- To build and prepare for publishing:
115
+ After installation, `mkcmd` supports:
93
116
 
94
117
  ```bash
95
- # Build the bundled JS file (requires Bun runtime)
96
- bun run build
118
+ mkcmd --help # Show help
119
+ mkcmd --version # Show version
120
+ ```
97
121
 
98
- # Build standalone executable (works without Bun)
99
- bun run build:exe
122
+ ## Requirements
100
123
 
101
- # Publish to npm
102
- npm publish
103
- ```
124
+ - Bun runtime (for running the generated project)
125
+ - Node.js 16+ (for installation via npm)
104
126
 
105
- **Note**: The default build (`bun run build`) produces a bundled JS file that requires Bun to run. The standalone executable (`bun run build:exe`) works independently but is platform-specific.
127
+ ## License
106
128
 
107
- ## Development
129
+ See LICENSE file for details.
108
130
 
109
- This project was created using `bun init` in bun v1.2.13. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
131
+ ---
110
132
 
111
- See [AGENTS.md](./AGENTS.md) for development guidelines, [CHANGELOG.md](./CHANGELOG.md) for version history.
133
+ **Version:** See `npm info @mbsi/mkcmd version`, `npx @mbsi/mkcmd --version`, or run `mkcmd --version` after installation.
package/dist/index.js CHANGED
@@ -1631,7 +1631,8 @@ async function runCLI(argv = Bun.argv.slice(2)) {
1631
1631
  return;
1632
1632
  }
1633
1633
  if (["-v", "--version"].includes(name)) {
1634
- const pkgText = await Bun.file(join2(process.cwd(), "package.json")).text();
1634
+ const pkgPath = join2(import.meta.dir, "..", "package.json");
1635
+ const pkgText = await Bun.file(pkgPath).text();
1635
1636
  const pkg = JSON.parse(pkgText);
1636
1637
  log_default.multi.info([
1637
1638
  {
@@ -2307,7 +2308,8 @@ var src_core_cli_init = () => {
2307
2308
  fb.addLine(" }");
2308
2309
  fb.addLine("");
2309
2310
  fb.addLine(' if (["-v", "--version"].includes(name)) {');
2310
- fb.addLine(' const pkgText = await Bun.file(join(process.cwd(), "package.json")).text();');
2311
+ fb.addLine(' const pkgPath = join(import.meta.dir, "..", "package.json");');
2312
+ fb.addLine(" const pkgText = await Bun.file(pkgPath).text();");
2311
2313
  fb.addLine(" const pkg = JSON.parse(pkgText);");
2312
2314
  fb.addLine(" log.multi.info([");
2313
2315
  fb.addLine(" {");
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
1
  {
2
- "name": "@mbsi/mkcmd",
3
- "version": "0.2.2",
4
- "main": "./dist/index.js",
5
- "module": "./dist/index.js",
6
- "type": "module",
7
- "bin": {
8
- "mkcmd": "./dist/index.js"
9
- },
10
- "scripts": {
11
- "prebuild": "bun run src/core/helpers/stringifier.ts",
12
- "build": "bun build --target=bun --outfile=dist/index.js src/index.ts",
13
- "build:exe": "bun build --compile --outfile=dist/mkcmd src/index.ts",
14
- "prepack": "bun run build"
15
- },
16
- "devDependencies": {
17
- "@types/bun": "latest",
18
- "typescript": "^5"
19
- },
20
- "dependencies": {
21
- "@clack/prompts": "^0.11.0",
22
- "@types/figlet": "^1.7.0",
23
- "figlet": "^1.9.4"
24
- }
2
+ "name": "@mbsi/mkcmd",
3
+ "version": "0.2.3",
4
+ "main": "./dist/index.js",
5
+ "module": "./dist/index.js",
6
+ "type": "module",
7
+ "bin": {
8
+ "mkcmd": "./dist/index.js"
9
+ },
10
+ "scripts": {
11
+ "prebuild": "bun run src/core/helpers/stringifier.ts",
12
+ "build": "bun build --target=bun --outfile=dist/index.js src/index.ts",
13
+ "build:exe": "bun build --compile --outfile=dist/mkcmd src/index.ts",
14
+ "prepack": "bun run build"
15
+ },
16
+ "devDependencies": {
17
+ "@types/bun": "latest",
18
+ "typescript": "^5"
19
+ },
20
+ "dependencies": {
21
+ "@clack/prompts": "^0.11.0",
22
+ "@types/figlet": "^1.7.0",
23
+ "figlet": "^1.9.4"
24
+ }
25
25
  }