Skip to content

Commit 0e751bb

Browse files
authored
Merge pull request #1 from ServiceStack/copilot/create-npx-add-in-package
[WIP] Add npx add-in node package for functionality replication
2 parents 6095c71 + a85acee commit 0e751bb

File tree

5 files changed

+1407
-1
lines changed

5 files changed

+1407
-1
lines changed

README.md

Lines changed: 115 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,116 @@
11
# add-in
2-
npx add-in feature - alternative to x mix dotnet tool
2+
3+
A Node.js CLI tool that replicates the functionality of the `x mix` dotnet tool from ServiceStack. It allows you to apply gist files to your project, supporting features like MyApp replacements, JSON patching, and more.
4+
5+
## Installation
6+
7+
You can run directly with npx (no installation required):
8+
9+
```bash
10+
npx add-in
11+
```
12+
13+
Or install globally:
14+
15+
```bash
16+
npm install -g @anthropic-custom/add-in
17+
```
18+
19+
## Usage
20+
21+
### View all published gists
22+
23+
```bash
24+
npx add-in
25+
```
26+
27+
### Apply gists to your project
28+
29+
```bash
30+
npx add-in <name> <name> ...
31+
```
32+
33+
### Mix using numbered list index
34+
35+
```bash
36+
npx add-in 1 3 5 ...
37+
```
38+
39+
### Mix file contents from gist URL
40+
41+
```bash
42+
npx add-in <gist-url>
43+
```
44+
45+
### Delete previously mixed gists
46+
47+
```bash
48+
npx add-in -delete <name> <name> ...
49+
```
50+
51+
### Use custom project name
52+
53+
Instead of using the current folder name, you can specify a custom project name (replaces `MyApp`):
54+
55+
```bash
56+
npx add-in -name ProjectName <name> <name> ...
57+
```
58+
59+
### Replace additional tokens
60+
61+
Replace custom tokens before mixing:
62+
63+
```bash
64+
npx add-in -replace term=with <name> <name> ...
65+
```
66+
67+
Multiple replacements:
68+
69+
```bash
70+
npx add-in -replace term=with -replace "This Phrase"="With This" <name> <name> ...
71+
```
72+
73+
### Search by tag
74+
75+
Display available gists with a specific tag:
76+
77+
```bash
78+
npx add-in [tag]
79+
npx add-in [tag1,tag2]
80+
```
81+
82+
## Options
83+
84+
| Option | Description |
85+
|--------|-------------|
86+
| `--help`, `-help`, `?` | Show help |
87+
| `-v`, `--verbose` | Enable verbose output |
88+
| `-s`, `--source` | Specify custom gist registry source |
89+
| `-f`, `--force`, `-y`, `--yes` | Skip confirmation prompts |
90+
| `-p`, `--preserve` | Don't overwrite existing files |
91+
| `--ignore-ssl-errors` | Ignore SSL certificate errors |
92+
| `--delete` | Delete mode - remove previously mixed files |
93+
| `--out` | Specify output directory |
94+
| `--name` | Specify custom project name |
95+
| `--replace` | Replace tokens in files |
96+
97+
## Environment Variables
98+
99+
| Variable | Description |
100+
|----------|-------------|
101+
| `MIX_SOURCE` | Custom gist registry ID |
102+
| `GITHUB_TOKEN` | GitHub API token for authentication |
103+
| `SERVICESTACK_TELEMETRY_OPTOUT` | Set to `1` or `true` to disable telemetry |
104+
105+
## Features
106+
107+
- **MyApp Replacement**: Automatically replaces `MyApp`, `My_App`, `my-app`, `myapp`, `My App`, `my_app` with your project name
108+
- **JSON Patching**: Support for `.json.patch` files using JSON Patch format
109+
- **Base64 Files**: Support for binary files encoded as base64
110+
- **Init Scripts**: Execute initialization commands (`npm`, `dotnet`, `flutter`, etc.) from `_init` files
111+
- **Tag Search**: Filter gists by tags
112+
- **Delete Mode**: Remove previously mixed files
113+
114+
## License
115+
116+
BSD-3-Clause

bin/add-in.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env node
2+
3+
const { mix } = require('../lib/index.js');
4+
5+
const tool = 'add-in';
6+
const args = process.argv.slice(2);
7+
8+
mix(tool, args)
9+
.then(() => {
10+
// Successful completion naturally exits with code 0
11+
})
12+
.catch(err => {
13+
console.error(err.message);
14+
if (process.env.VERBOSE === '1' || args.includes('-v') || args.includes('--verbose')) {
15+
console.error(err.stack);
16+
}
17+
process.exit(1);
18+
});

0 commit comments

Comments
 (0)