cc-wrapper 0.3.1 → 0.3.2
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/README.md +22 -0
- package/dist/cli.js +47 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -158,6 +158,28 @@ If the deleted profile was the default, the next available profile becomes the n
|
|
|
158
158
|
|
|
159
159
|
---
|
|
160
160
|
|
|
161
|
+
### `cc-wrapper show <name>`
|
|
162
|
+
|
|
163
|
+
Display all env vars and args stored in a profile. Secret values (keys, tokens, passwords) are masked.
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
cc-wrapper show local
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Output example:
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
cc-wrapper › local (default)
|
|
173
|
+
|
|
174
|
+
env:
|
|
175
|
+
ANTHROPIC_BASE_URL http://localhost:8787
|
|
176
|
+
ANTHROPIC_API_KEY sk-a*****
|
|
177
|
+
|
|
178
|
+
args: --dangerously-skip-permissions
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
161
183
|
### `cc-wrapper claude [args...]`
|
|
162
184
|
|
|
163
185
|
Launch `claude` with the default profile's environment variables injected.
|
package/dist/cli.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
4
|
import { cac } from "cac";
|
|
5
|
-
import
|
|
5
|
+
import chalk9 from "chalk";
|
|
6
6
|
|
|
7
7
|
// src/commands/new.ts
|
|
8
8
|
import { input as input2 } from "@inquirer/prompts";
|
|
@@ -82,10 +82,11 @@ var searchableCheckbox = createPrompt(
|
|
|
82
82
|
(c) => !term || c.name.toLowerCase().includes(term) || (c.description?.toLowerCase().includes(term) ?? false)
|
|
83
83
|
);
|
|
84
84
|
const safeCursor = filtered.length === 0 ? 0 : Math.min(cursor, filtered.length - 1);
|
|
85
|
-
useKeypress((key) => {
|
|
85
|
+
useKeypress(async (key) => {
|
|
86
86
|
if (isDone) return;
|
|
87
87
|
if (isEnterKey(key)) {
|
|
88
88
|
setIsDone(true);
|
|
89
|
+
await new Promise((r) => setImmediate(r));
|
|
89
90
|
done(
|
|
90
91
|
config.choices.filter((_, i) => checked.has(i)).map((c) => c.value)
|
|
91
92
|
);
|
|
@@ -106,7 +107,7 @@ var searchableCheckbox = createPrompt(
|
|
|
106
107
|
} else if (isBackspaceKey(key)) {
|
|
107
108
|
setSearch(search.slice(0, -1));
|
|
108
109
|
setCursor(0);
|
|
109
|
-
} else if (key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta) {
|
|
110
|
+
} else if (key.sequence && key.sequence.length === 1 && !key.ctrl && !key.meta && key.sequence !== "\r" && key.sequence !== "\n") {
|
|
110
111
|
setSearch(search + key.sequence);
|
|
111
112
|
setCursor(0);
|
|
112
113
|
}
|
|
@@ -654,6 +655,45 @@ async function claudeCommand(extraArgs, options) {
|
|
|
654
655
|
process.exit(code);
|
|
655
656
|
}
|
|
656
657
|
|
|
658
|
+
// src/commands/show.ts
|
|
659
|
+
import chalk8 from "chalk";
|
|
660
|
+
async function showCommand(name) {
|
|
661
|
+
const config = await readConfig(getConfigPath());
|
|
662
|
+
const profileName = name ?? config.default;
|
|
663
|
+
if (!profileName) {
|
|
664
|
+
console.error(chalk8.red("No profile specified and no default set."));
|
|
665
|
+
process.exit(1);
|
|
666
|
+
}
|
|
667
|
+
const profile = config.configs[profileName];
|
|
668
|
+
if (!profile) {
|
|
669
|
+
console.error(chalk8.red(`Profile "${profileName}" not found.`));
|
|
670
|
+
process.exit(1);
|
|
671
|
+
}
|
|
672
|
+
const isDefault = profileName === config.default;
|
|
673
|
+
const tag = isDefault ? chalk8.dim(" (default)") : "";
|
|
674
|
+
console.log(chalk8.bold.cyan("cc-wrapper") + chalk8.dim(" \u203A ") + chalk8.bold(profileName) + tag);
|
|
675
|
+
console.log();
|
|
676
|
+
const masked = maskEnv(profile.env);
|
|
677
|
+
const envEntries = Object.entries(masked);
|
|
678
|
+
if (envEntries.length > 0) {
|
|
679
|
+
console.log(chalk8.dim(" env:"));
|
|
680
|
+
const keyWidth = Math.max(...envEntries.map(([k]) => k.length));
|
|
681
|
+
for (const [k, v] of envEntries) {
|
|
682
|
+
console.log(
|
|
683
|
+
chalk8.dim(" " + k.padEnd(keyWidth, " ") + " ") + chalk8.yellow(v)
|
|
684
|
+
);
|
|
685
|
+
}
|
|
686
|
+
} else {
|
|
687
|
+
console.log(chalk8.dim(" env: (none)"));
|
|
688
|
+
}
|
|
689
|
+
console.log();
|
|
690
|
+
if (profile.args.length > 0) {
|
|
691
|
+
console.log(chalk8.dim(" args: ") + chalk8.white(profile.args.join(" ")));
|
|
692
|
+
} else {
|
|
693
|
+
console.log(chalk8.dim(" args: (none)"));
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
|
|
657
697
|
// src/cli.ts
|
|
658
698
|
process.on("SIGINT", () => {
|
|
659
699
|
process.stdout.write("\n");
|
|
@@ -664,7 +704,7 @@ process.on("uncaughtException", (err) => {
|
|
|
664
704
|
process.stdout.write("\n");
|
|
665
705
|
process.exit(0);
|
|
666
706
|
}
|
|
667
|
-
console.error(
|
|
707
|
+
console.error(chalk9.red(`Error: ${err.message}`));
|
|
668
708
|
process.exit(1);
|
|
669
709
|
});
|
|
670
710
|
process.on("unhandledRejection", (reason) => {
|
|
@@ -672,7 +712,7 @@ process.on("unhandledRejection", (reason) => {
|
|
|
672
712
|
process.stdout.write("\n");
|
|
673
713
|
process.exit(0);
|
|
674
714
|
}
|
|
675
|
-
console.error(
|
|
715
|
+
console.error(chalk9.red(`Error: ${String(reason)}`));
|
|
676
716
|
process.exit(1);
|
|
677
717
|
});
|
|
678
718
|
var cli = cac("cc-wrapper");
|
|
@@ -681,9 +721,10 @@ cli.command("list", "List all profiles").action(listCommand);
|
|
|
681
721
|
cli.command("default <name>", "Set default profile").action(defaultCommand);
|
|
682
722
|
cli.command("edit <name>", "Edit a profile interactively").action(editCommand);
|
|
683
723
|
cli.command("delete <name>", "Delete a profile").action(deleteCommand);
|
|
724
|
+
cli.command("show <name>", "Show profile env vars and args").action(showCommand);
|
|
684
725
|
cli.command("claude [...args]", "Run claude with the default profile").option("--dd", "Disable --dangerously-skip-permissions injection").option("-p, --profile <name>", "Use a specific profile instead of default").action((args, options) => {
|
|
685
726
|
return claudeCommand(args, options);
|
|
686
727
|
});
|
|
687
728
|
cli.help();
|
|
688
|
-
cli.version("0.3.
|
|
729
|
+
cli.version("0.3.2");
|
|
689
730
|
cli.parse();
|