@synth1s/cloak 1.8.0 → 1.9.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 +1 -1
- package/src/cli.js +6 -0
- package/src/commands/banner.js +18 -0
- package/src/commands/init.js +1 -5
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -12,6 +12,7 @@ import { listAccounts } from './commands/list.js'
|
|
|
12
12
|
import { deleteAccount } from './commands/delete.js'
|
|
13
13
|
import { whoami } from './commands/whoami.js'
|
|
14
14
|
import { renameAccount } from './commands/rename.js'
|
|
15
|
+
import { showBanner } from './commands/banner.js'
|
|
15
16
|
import { initShell } from './commands/init.js'
|
|
16
17
|
|
|
17
18
|
const __dirname = dirname(fileURLToPath(import.meta.url))
|
|
@@ -58,6 +59,11 @@ program
|
|
|
58
59
|
.description('Rename a cloak')
|
|
59
60
|
.action((oldName, newName) => renameAccount(oldName, newName))
|
|
60
61
|
|
|
62
|
+
program
|
|
63
|
+
.command('banner', { hidden: true })
|
|
64
|
+
.description('Show active cloak banner')
|
|
65
|
+
.action(() => showBanner())
|
|
66
|
+
|
|
61
67
|
program
|
|
62
68
|
.command('init')
|
|
63
69
|
.description('Output shell integration code (use with eval)')
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { getActiveProfile } from '../lib/paths.js'
|
|
2
|
+
|
|
3
|
+
export function showBanner(columns) {
|
|
4
|
+
const name = getActiveProfile()
|
|
5
|
+
if (!name) return
|
|
6
|
+
|
|
7
|
+
const cols = columns || process.stderr.columns || process.stdout.columns || 80
|
|
8
|
+
const msg = `🔹 Wearing cloak "${name}"`
|
|
9
|
+
const inner = cols - 2
|
|
10
|
+
const contentLen = msg.length + 2 // space before and after
|
|
11
|
+
const pad = Math.max(0, inner - contentLen)
|
|
12
|
+
|
|
13
|
+
const top = '╭' + '─'.repeat(inner) + '╮'
|
|
14
|
+
const mid = '│ ' + msg + ' '.repeat(pad) + ' │'
|
|
15
|
+
const bot = '╰' + '─'.repeat(inner) + '╯'
|
|
16
|
+
|
|
17
|
+
process.stdout.write(top + '\n' + mid + '\n' + bot + '\n')
|
|
18
|
+
}
|
package/src/commands/init.js
CHANGED
|
@@ -43,11 +43,7 @@ export function getInitScript() {
|
|
|
43
43
|
' fi',
|
|
44
44
|
' else',
|
|
45
45
|
' if [ -n "$CLAUDE_CONFIG_DIR" ]; then',
|
|
46
|
-
'
|
|
47
|
-
' _cloak_name=$(command cloak whoami 2>/dev/null)',
|
|
48
|
-
' if [ -n "$_cloak_name" ]; then',
|
|
49
|
-
' echo "🔹 Wearing cloak \\"$_cloak_name\\"" >&2',
|
|
50
|
-
' fi',
|
|
46
|
+
' command cloak banner 2>/dev/null >&2',
|
|
51
47
|
' fi',
|
|
52
48
|
' command claude "$@"',
|
|
53
49
|
' fi',
|