@synth1s/cloak 1.10.0 → 2.0.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synth1s/cloak",
3
- "version": "1.10.0",
3
+ "version": "2.0.0",
4
4
  "description": "Cloak your Claude. Switch identities in seconds.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.js CHANGED
@@ -6,13 +6,13 @@ import { fileURLToPath } from 'url'
6
6
  import { dirname, join } from 'path'
7
7
 
8
8
  import { showTipIfNeeded } from './lib/tip.js'
9
+ import { renderContextBar } from './lib/context-bar.js'
9
10
  import { createAccount } from './commands/create.js'
10
11
  import { switchAccount } from './commands/switch.js'
11
12
  import { listAccounts } from './commands/list.js'
12
13
  import { deleteAccount } from './commands/delete.js'
13
14
  import { whoami } from './commands/whoami.js'
14
15
  import { renameAccount } from './commands/rename.js'
15
- import { showBanner } from './commands/banner.js'
16
16
  import { initShell } from './commands/init.js'
17
17
 
18
18
  const __dirname = dirname(fileURLToPath(import.meta.url))
@@ -28,41 +28,60 @@ program
28
28
  program
29
29
  .command('create [name]')
30
30
  .description('Save current session as a new cloak')
31
- .action(createAccount)
31
+ .action((name) => {
32
+ renderContextBar('create')
33
+ return createAccount(name)
34
+ })
32
35
 
33
36
  program
34
37
  .command('switch <name>')
35
38
  .alias('use')
36
39
  .description('Wear a different cloak')
37
40
  .addOption(new Option('--print-env').hideHelp())
38
- .action((name, opts) => switchAccount(name, { printEnv: opts.printEnv }))
41
+ .action((name, opts) => {
42
+ if (!opts.printEnv) renderContextBar('switch')
43
+ return switchAccount(name, { printEnv: opts.printEnv })
44
+ })
39
45
 
40
46
  program
41
47
  .command('list')
42
48
  .alias('ls')
43
49
  .description('See all cloaks in your wardrobe')
44
- .action(listAccounts)
50
+ .action(() => {
51
+ renderContextBar('list')
52
+ return listAccounts()
53
+ })
45
54
 
46
55
  program
47
56
  .command('delete <name>')
48
57
  .alias('rm')
49
58
  .description('Discard a cloak')
50
- .action((name) => deleteAccount(name))
59
+ .action((name) => {
60
+ renderContextBar('delete')
61
+ return deleteAccount(name)
62
+ })
51
63
 
52
64
  program
53
65
  .command('whoami')
54
66
  .description('Which cloak are you wearing?')
55
- .action(whoami)
67
+ .action(() => {
68
+ renderContextBar('whoami')
69
+ return whoami()
70
+ })
56
71
 
57
72
  program
58
73
  .command('rename <old> <new>')
59
74
  .description('Rename a cloak')
60
- .action((oldName, newName) => renameAccount(oldName, newName))
75
+ .action((oldName, newName) => {
76
+ renderContextBar('rename')
77
+ return renameAccount(oldName, newName)
78
+ })
61
79
 
62
80
  program
63
- .command('banner', { hidden: true })
64
- .description('Show active cloak banner')
65
- .action(() => showBanner())
81
+ .command('context-bar', { hidden: true })
82
+ .argument('<command>')
83
+ .description('Show context bar')
84
+ .action((cmd) => renderContextBar(cmd))
66
85
 
67
86
  program
68
87
  .command('init')
@@ -39,12 +39,12 @@ export function getInitScript() {
39
39
  ' local exit_code=$?',
40
40
  ' if [ $exit_code -eq 0 ]; then',
41
41
  ' eval "$output"',
42
- ' command cloak banner >&2',
42
+ ' command cloak context-bar claude',
43
43
  ' command claude "$@"',
44
44
  ' fi',
45
45
  ' else',
46
46
  ' if [ -n "$CLAUDE_CONFIG_DIR" ]; then',
47
- ' command cloak banner >&2',
47
+ ' command cloak context-bar claude',
48
48
  ' fi',
49
49
  ' command claude "$@"',
50
50
  ' fi',
@@ -0,0 +1,27 @@
1
+ import chalk from 'chalk'
2
+ import { getActiveProfile, getAccountEmail } from './paths.js'
3
+
4
+ export function renderContextBar(command, columns) {
5
+ if (!process.stderr.isTTY) return
6
+
7
+ const cols = columns || process.stderr.columns || process.stdout.columns || 80
8
+ const profile = getActiveProfile()
9
+ const email = profile ? getAccountEmail(profile) : null
10
+
11
+ const prefix = 'cloak › '
12
+ const cmdPart = command
13
+ const profilePart = profile ? ' · ' + profile : ''
14
+ const emailPart = (profile && email) ? ' ‹' + email + '›' : ''
15
+ const text = prefix + cmdPart + profilePart + emailPart + ' '
16
+ const barLen = Math.max(3, cols - text.length)
17
+
18
+ const line =
19
+ chalk.dim('cloak › ') +
20
+ chalk.bold(command) +
21
+ (profile ? chalk.dim(' · ') + chalk.white(profile) : '') +
22
+ (email ? chalk.dim(' ‹' + email + '›') : '') +
23
+ ' ' +
24
+ chalk.dim('─'.repeat(barLen))
25
+
26
+ process.stderr.write(line + '\n')
27
+ }
@@ -5,7 +5,7 @@ const icon = {
5
5
  success: chalk.green('✔'),
6
6
  error: chalk.red('✖'),
7
7
  warning: chalk.yellow('⚠'),
8
- tip: '💡',
8
+ tip: chalk.yellow('*'),
9
9
  active: chalk.green('●'),
10
10
  inactive: chalk.dim('○'),
11
11
  }
@@ -131,7 +131,7 @@ export function shellIntegrationTip(rcFile) {
131
131
  // --- Active cloak indicator (shown on claude launch) ---
132
132
 
133
133
  export function wearingCloak(name) {
134
- return `🔹 Wearing cloak "${name}"`
134
+ return `Wearing cloak "${name}"`
135
135
  }
136
136
 
137
137
  // --- Print-env (stdout, no chalk — evaluated by shell) ---
@@ -1,22 +0,0 @@
1
- import chalk from 'chalk'
2
- import { getActiveProfile, getAccountEmail } from '../lib/paths.js'
3
-
4
- export function showBanner(columns) {
5
- const name = getActiveProfile()
6
- if (!name) return
7
-
8
- const cols = columns || process.stderr.columns || process.stdout.columns || 80
9
- const email = getAccountEmail(name)
10
- const label = `cloak › ${name}`
11
- const emailSuffix = email ? ` — ${email}` : ''
12
- const msg = label + emailSuffix
13
- const inner = cols - 2
14
- const contentLen = msg.length + 2
15
- const pad = Math.max(0, inner - contentLen)
16
-
17
- const top = '╭' + '─'.repeat(inner) + '╮'
18
- const mid = '│ ' + chalk.bold(label) + chalk.dim(emailSuffix) + ' '.repeat(pad) + ' │'
19
- const bot = '╰' + '─'.repeat(inner) + '╯'
20
-
21
- process.stdout.write(top + '\n' + mid + '\n' + bot + '\n')
22
- }