@nemus-cli/nemus 0.2.1
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 +86 -0
- package/LICENSE +21 -0
- package/README.md +275 -0
- package/assets/README.md +53 -0
- package/assets/banner.png +0 -0
- package/assets/banner.svg +66 -0
- package/assets/favicon-32.png +0 -0
- package/assets/favicon-64.png +0 -0
- package/assets/icon-256.png +0 -0
- package/assets/icon.svg +23 -0
- package/assets/logo-256.png +0 -0
- package/assets/logo-512.png +0 -0
- package/assets/logo-wordmark.svg +35 -0
- package/assets/logo.svg +32 -0
- package/bin/workspace.js +130 -0
- package/dist/cli/ai-prompt.js +421 -0
- package/dist/cli/dashboard/AgentList.js +61 -0
- package/dist/cli/dashboard/DashboardSidebar.js +280 -0
- package/dist/cli/dashboard/HelpFooter.js +73 -0
- package/dist/cli/dashboard/StatusBadge.js +50 -0
- package/dist/cli/dashboard/index.js +11 -0
- package/dist/cli/dashboard/types.js +2 -0
- package/dist/cli/tui.js +48 -0
- package/dist/commands/ai-prompt.js +22 -0
- package/dist/commands/analyze-deps.js +138 -0
- package/dist/commands/archive.js +113 -0
- package/dist/commands/branch/create.js +119 -0
- package/dist/commands/branch/index.js +104 -0
- package/dist/commands/branch/merge.js +90 -0
- package/dist/commands/branch/rebase.js +84 -0
- package/dist/commands/branch/switch.js +165 -0
- package/dist/commands/cache/index.js +80 -0
- package/dist/commands/cache/manager.js +198 -0
- package/dist/commands/cleanup.js +153 -0
- package/dist/commands/configure-claude.js +55 -0
- package/dist/commands/configure.js +231 -0
- package/dist/commands/create.js +204 -0
- package/dist/commands/dashboard/hook-handler.js +162 -0
- package/dist/commands/dashboard/index.js +258 -0
- package/dist/commands/dashboard/launcher.js +40 -0
- package/dist/commands/dashboard/session-picker.js +106 -0
- package/dist/commands/dashboard/sidebar.js +39 -0
- package/dist/commands/dashboard/workspace-picker.js +95 -0
- package/dist/commands/delete.js +194 -0
- package/dist/commands/deprecated-aliases.js +44 -0
- package/dist/commands/diff.js +129 -0
- package/dist/commands/doctor.js +141 -0
- package/dist/commands/generate-docs.js +77 -0
- package/dist/commands/ghq-status.js +72 -0
- package/dist/commands/go.js +154 -0
- package/dist/commands/history.js +124 -0
- package/dist/commands/list.js +191 -0
- package/dist/commands/mcp/index.js +69 -0
- package/dist/commands/migrate.js +296 -0
- package/dist/commands/remove-repo.js +217 -0
- package/dist/commands/report-bug.js +112 -0
- package/dist/commands/run.js +147 -0
- package/dist/commands/save-context.js +171 -0
- package/dist/commands/sessions.js +129 -0
- package/dist/commands/status.js +138 -0
- package/dist/commands/suite/create.js +212 -0
- package/dist/commands/suite/delete.js +64 -0
- package/dist/commands/suite/export.js +126 -0
- package/dist/commands/suite/import.js +128 -0
- package/dist/commands/suite/index.js +94 -0
- package/dist/commands/suite/list.js +49 -0
- package/dist/commands/suite/use.js +227 -0
- package/dist/commands/sync.js +117 -0
- package/dist/commands/update.js +203 -0
- package/dist/mcp/install.js +550 -0
- package/dist/mcp/server.js +398 -0
- package/dist/mcp/tools.js +922 -0
- package/dist/pi-extensions/permission-sync.ts.template +41 -0
- package/dist/pi-extensions/permissions-gate.ts.template +69 -0
- package/dist/pi-extensions/pr-fix-trigger.ts.template +124 -0
- package/dist/pi-extensions/review-reminder.ts.template +58 -0
- package/dist/pi-extensions/workspace-input-status.ts.template +919 -0
- package/dist/program.js +136 -0
- package/dist/scripts/workspace-table.py +394 -0
- package/dist/types/dashboard.js +11 -0
- package/dist/types/index.js +2 -0
- package/dist/utils/agent-config.js +263 -0
- package/dist/utils/agent-state.js +178 -0
- package/dist/utils/banner.js +24 -0
- package/dist/utils/branch-operations.js +232 -0
- package/dist/utils/bug-report.js +355 -0
- package/dist/utils/cache.js +168 -0
- package/dist/utils/claude-integration.js +617 -0
- package/dist/utils/claude-sessions.js +260 -0
- package/dist/utils/cleanup-operations.js +120 -0
- package/dist/utils/colors.js +26 -0
- package/dist/utils/command-helpers.js +44 -0
- package/dist/utils/config.js +150 -0
- package/dist/utils/context-file.js +33 -0
- package/dist/utils/dashboard-hooks.js +172 -0
- package/dist/utils/dependency-analyzer.js +234 -0
- package/dist/utils/diff-operations.js +80 -0
- package/dist/utils/doc-generator.js +184 -0
- package/dist/utils/ghq-integration.js +332 -0
- package/dist/utils/git-operations.js +237 -0
- package/dist/utils/git-status.js +187 -0
- package/dist/utils/github.js +68 -0
- package/dist/utils/health-checks.js +345 -0
- package/dist/utils/history.js +150 -0
- package/dist/utils/hooks.js +100 -0
- package/dist/utils/logger.js +40 -0
- package/dist/utils/permission-sync.js +681 -0
- package/dist/utils/pi-extensions.js +224 -0
- package/dist/utils/progress.js +92 -0
- package/dist/utils/prompts.js +279 -0
- package/dist/utils/repo-resolver.js +260 -0
- package/dist/utils/retry.js +65 -0
- package/dist/utils/run-operations.js +30 -0
- package/dist/utils/suite.js +159 -0
- package/dist/utils/sync-operations.js +107 -0
- package/dist/utils/tmux-dashboard.js +184 -0
- package/dist/utils/validation.js +153 -0
- package/dist/utils/version-check.js +121 -0
- package/dist/utils/workspace-meta.js +185 -0
- package/install-shell-integration.sh +532 -0
- package/install.sh +401 -0
- package/package.json +90 -0
- package/remove-shell-block.awk +44 -0
- package/scripts/postinstall.js +85 -0
- package/skills/analyze-deps.md +23 -0
- package/skills/archive-workspace.md +26 -0
- package/skills/branch-create.md +18 -0
- package/skills/create-workspace.md +39 -0
- package/skills/delete-workspace.md +37 -0
- package/skills/list-org-repos.md +26 -0
- package/skills/list-suites.md +24 -0
- package/skills/list-workspaces.md +27 -0
- package/skills/refresh-workspace-docs.md +89 -0
- package/skills/remove-repo.md +25 -0
- package/skills/run-command.md +23 -0
- package/skills/save-context.md +68 -0
- package/skills/search-repos.md +31 -0
- package/skills/snapshot-list.md +18 -0
- package/skills/snapshot-save.md +12 -0
- package/skills/switch-branch.md +18 -0
- package/skills/update-cache.md +21 -0
- package/skills/update-workspace.md +66 -0
- package/skills/workspace-cleanup.md +18 -0
- package/skills/workspace-diff.md +23 -0
- package/skills/workspace-doctor.md +23 -0
- package/skills/workspace-info.md +45 -0
- package/skills/workspace-manager/SKILL.md +201 -0
- package/skills/workspace-manager/references/ai-prompt.md +44 -0
- package/skills/workspace-manager/references/analyze-deps.md +45 -0
- package/skills/workspace-manager/references/archive-workspace.md +38 -0
- package/skills/workspace-manager/references/branch-create.md +31 -0
- package/skills/workspace-manager/references/branch-merge.md +22 -0
- package/skills/workspace-manager/references/branch-rebase.md +22 -0
- package/skills/workspace-manager/references/cache-clear.md +18 -0
- package/skills/workspace-manager/references/cache-info.md +22 -0
- package/skills/workspace-manager/references/configure-claude.md +31 -0
- package/skills/workspace-manager/references/configure.md +35 -0
- package/skills/workspace-manager/references/create-workspace.md +45 -0
- package/skills/workspace-manager/references/dashboard.md +61 -0
- package/skills/workspace-manager/references/delete-workspace.md +33 -0
- package/skills/workspace-manager/references/generate-docs.md +36 -0
- package/skills/workspace-manager/references/ghq-status.md +28 -0
- package/skills/workspace-manager/references/go.md +33 -0
- package/skills/workspace-manager/references/history.md +41 -0
- package/skills/workspace-manager/references/list-org-repos.md +26 -0
- package/skills/workspace-manager/references/list-suites.md +21 -0
- package/skills/workspace-manager/references/list-workspaces.md +27 -0
- package/skills/workspace-manager/references/mcp.md +49 -0
- package/skills/workspace-manager/references/remove-repo.md +26 -0
- package/skills/workspace-manager/references/run-command.md +44 -0
- package/skills/workspace-manager/references/search-repos.md +24 -0
- package/skills/workspace-manager/references/sessions.md +27 -0
- package/skills/workspace-manager/references/suite-create.md +22 -0
- package/skills/workspace-manager/references/suite-delete.md +21 -0
- package/skills/workspace-manager/references/suite-export.md +19 -0
- package/skills/workspace-manager/references/suite-import.md +19 -0
- package/skills/workspace-manager/references/suite-use.md +27 -0
- package/skills/workspace-manager/references/switch-branch.md +25 -0
- package/skills/workspace-manager/references/update-cache.md +22 -0
- package/skills/workspace-manager/references/update-workspace.md +50 -0
- package/skills/workspace-manager/references/workspace-cleanup.md +33 -0
- package/skills/workspace-manager/references/workspace-diff.md +27 -0
- package/skills/workspace-manager/references/workspace-doctor.md +27 -0
- package/skills/workspace-manager/references/workspace-info.md +33 -0
- package/skills/workspace-manager/references/workspace-status.md +43 -0
- package/skills/workspace-manager/references/workspace-sync.md +26 -0
- package/skills/workspace-status.md +26 -0
- package/skills/workspace-sync.md +23 -0
- package/src/cli/ai-prompt.test.ts +667 -0
- package/src/cli/ai-prompt.ts +421 -0
- package/src/cli/dashboard/AgentList.tsx +44 -0
- package/src/cli/dashboard/DashboardSidebar.tsx +291 -0
- package/src/cli/dashboard/HelpFooter.tsx +22 -0
- package/src/cli/dashboard/StatusBadge.tsx +23 -0
- package/src/cli/dashboard/index.ts +5 -0
- package/src/cli/dashboard/types.ts +16 -0
- package/src/cli/tui.tsx +51 -0
- package/src/cli/workspace-cli.test.ts +30 -0
- package/src/commands/ai-prompt.ts +21 -0
- package/src/commands/analyze-deps.ts +119 -0
- package/src/commands/archive.ts +114 -0
- package/src/commands/branch/create.ts +94 -0
- package/src/commands/branch/index.ts +74 -0
- package/src/commands/branch/merge.ts +61 -0
- package/src/commands/branch/rebase.ts +54 -0
- package/src/commands/branch/switch.ts +150 -0
- package/src/commands/cache/index.ts +51 -0
- package/src/commands/cache/manager.ts +168 -0
- package/src/commands/cleanup.ts +132 -0
- package/src/commands/configure-claude.ts +55 -0
- package/src/commands/configure.ts +204 -0
- package/src/commands/create.ts +196 -0
- package/src/commands/dashboard/hook-handler.ts +138 -0
- package/src/commands/dashboard/index.ts +248 -0
- package/src/commands/dashboard/launcher.ts +42 -0
- package/src/commands/dashboard/session-picker.ts +73 -0
- package/src/commands/dashboard/sidebar.js +39 -0
- package/src/commands/dashboard/workspace-picker.ts +62 -0
- package/src/commands/delete.test.ts +250 -0
- package/src/commands/delete.ts +171 -0
- package/src/commands/deprecated-aliases.ts +55 -0
- package/src/commands/diff.ts +106 -0
- package/src/commands/doctor.ts +110 -0
- package/src/commands/generate-docs.ts +45 -0
- package/src/commands/ghq-status.ts +70 -0
- package/src/commands/go.ts +125 -0
- package/src/commands/history.ts +136 -0
- package/src/commands/list.test.ts +219 -0
- package/src/commands/list.ts +176 -0
- package/src/commands/mcp/index.ts +39 -0
- package/src/commands/migrate.ts +277 -0
- package/src/commands/remove-repo.ts +194 -0
- package/src/commands/report-bug.ts +88 -0
- package/src/commands/run.ts +125 -0
- package/src/commands/save-context.test.ts +113 -0
- package/src/commands/save-context.ts +141 -0
- package/src/commands/sessions.ts +99 -0
- package/src/commands/status.ts +111 -0
- package/src/commands/suite/create.ts +240 -0
- package/src/commands/suite/delete.ts +65 -0
- package/src/commands/suite/export.ts +97 -0
- package/src/commands/suite/import.ts +100 -0
- package/src/commands/suite/index.ts +66 -0
- package/src/commands/suite/list.ts +54 -0
- package/src/commands/suite/use.ts +232 -0
- package/src/commands/sync.ts +97 -0
- package/src/commands/update.ts +197 -0
- package/src/mcp/install.ts +529 -0
- package/src/mcp/server.ts +579 -0
- package/src/mcp/tools.test.ts +545 -0
- package/src/mcp/tools.ts +1019 -0
- package/src/mcp/update-workspace.test.ts +220 -0
- package/src/pi-extensions/permission-sync.ts.template +41 -0
- package/src/pi-extensions/permissions-gate.ts.template +69 -0
- package/src/pi-extensions/pr-fix-trigger.ts.template +124 -0
- package/src/pi-extensions/review-reminder.ts.template +58 -0
- package/src/pi-extensions/workspace-input-status.ts.template +919 -0
- package/src/program.ts +112 -0
- package/src/scripts/workspace-table.py +394 -0
- package/src/types/dashboard.ts +29 -0
- package/src/types/index.ts +109 -0
- package/src/types/ink.d.ts +171 -0
- package/src/utils/agent-config.test.ts +303 -0
- package/src/utils/agent-config.ts +264 -0
- package/src/utils/agent-state.test.ts +166 -0
- package/src/utils/agent-state.ts +135 -0
- package/src/utils/banner.ts +24 -0
- package/src/utils/branch-operations.ts +237 -0
- package/src/utils/bug-report.test.ts +174 -0
- package/src/utils/bug-report.ts +355 -0
- package/src/utils/cache.ts +150 -0
- package/src/utils/claude-integration.test.ts +381 -0
- package/src/utils/claude-integration.ts +649 -0
- package/src/utils/claude-sessions.test.ts +262 -0
- package/src/utils/claude-sessions.ts +251 -0
- package/src/utils/cleanup-operations.ts +94 -0
- package/src/utils/colors.ts +25 -0
- package/src/utils/command-helpers.ts +46 -0
- package/src/utils/config.test.ts +203 -0
- package/src/utils/config.ts +133 -0
- package/src/utils/context-file.ts +36 -0
- package/src/utils/dashboard-hooks.test.ts +168 -0
- package/src/utils/dashboard-hooks.ts +163 -0
- package/src/utils/dependency-analyzer.ts +243 -0
- package/src/utils/diff-operations.ts +59 -0
- package/src/utils/doc-generator.ts +187 -0
- package/src/utils/ghq-integration.test.ts +195 -0
- package/src/utils/ghq-integration.ts +317 -0
- package/src/utils/git-operations.test.ts +265 -0
- package/src/utils/git-operations.ts +233 -0
- package/src/utils/git-status.ts +171 -0
- package/src/utils/github.ts +74 -0
- package/src/utils/health-checks.ts +359 -0
- package/src/utils/history.ts +140 -0
- package/src/utils/hooks.ts +92 -0
- package/src/utils/logger.ts +37 -0
- package/src/utils/permission-sync.test.ts +593 -0
- package/src/utils/permission-sync.ts +720 -0
- package/src/utils/pi-extensions.test.ts +182 -0
- package/src/utils/pi-extensions.ts +226 -0
- package/src/utils/progress.ts +73 -0
- package/src/utils/prompts.test.ts +169 -0
- package/src/utils/prompts.ts +296 -0
- package/src/utils/repo-resolver.test.ts +313 -0
- package/src/utils/repo-resolver.ts +294 -0
- package/src/utils/retry.test.ts +124 -0
- package/src/utils/retry.ts +85 -0
- package/src/utils/run-operations.ts +38 -0
- package/src/utils/suite.test.ts +256 -0
- package/src/utils/suite.ts +144 -0
- package/src/utils/sync-operations.ts +87 -0
- package/src/utils/tmux-dashboard.ts +193 -0
- package/src/utils/validation.test.ts +139 -0
- package/src/utils/validation.ts +128 -0
- package/src/utils/version-check.test.ts +108 -0
- package/src/utils/version-check.ts +96 -0
- package/src/utils/workspace-meta.ts +173 -0
- package/sync-permissions.sh +137 -0
- package/tsconfig.json +20 -0
- package/uninstall.sh +162 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
#
|
|
3
|
+
# sync-permissions.sh — Claude Code Stop hook
|
|
4
|
+
#
|
|
5
|
+
# Merges project-level Claude Code permissions into the global
|
|
6
|
+
# ~/.claude/settings.json so they never need re-approval
|
|
7
|
+
# in other workspaces.
|
|
8
|
+
#
|
|
9
|
+
# NOTE: We write to settings.json (not settings.local.json) because
|
|
10
|
+
# Claude Code only reads ~/.claude/settings.json at the user level.
|
|
11
|
+
# The .local.json variant is only recognized at the project level.
|
|
12
|
+
#
|
|
13
|
+
# Called automatically by Claude Code after every response when
|
|
14
|
+
# registered as a Stop hook.
|
|
15
|
+
|
|
16
|
+
# Claude Code pipes tool results to Stop hook stdin.
|
|
17
|
+
# We must drain it or the hook process may block the parent.
|
|
18
|
+
cat > /dev/null
|
|
19
|
+
|
|
20
|
+
# Bail if jq is not available
|
|
21
|
+
command -v jq &>/dev/null || exit 0
|
|
22
|
+
|
|
23
|
+
# Guard against missing HOME
|
|
24
|
+
[ -z "$HOME" ] && exit 0
|
|
25
|
+
|
|
26
|
+
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-}"
|
|
27
|
+
[ -z "$PROJECT_DIR" ] && exit 0
|
|
28
|
+
|
|
29
|
+
PROJECT_SETTINGS="$PROJECT_DIR/.claude/settings.local.json"
|
|
30
|
+
GLOBAL_SETTINGS="$HOME/.claude/settings.json"
|
|
31
|
+
|
|
32
|
+
# Nothing to do if project has no settings
|
|
33
|
+
[ -f "$PROJECT_SETTINGS" ] || exit 0
|
|
34
|
+
|
|
35
|
+
# Ensure global settings file exists with a valid structure
|
|
36
|
+
if [ ! -f "$GLOBAL_SETTINGS" ]; then
|
|
37
|
+
mkdir -p "$(dirname "$GLOBAL_SETTINGS")"
|
|
38
|
+
echo '{}' > "$GLOBAL_SETTINGS"
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
LOCK_FILE="$GLOBAL_SETTINGS.lock"
|
|
42
|
+
|
|
43
|
+
# jq filter that checks if a permission is reusable (no absolute user paths, no heredoc commits).
|
|
44
|
+
# IMPORTANT: Keep in sync with isReusablePermission() in utils/permission-sync.ts.
|
|
45
|
+
IS_REUSABLE='def is_reusable: (test("/Users/|/home/") | not) and (test("cat <<.*EOF") | not);'
|
|
46
|
+
|
|
47
|
+
# jq filter to compute new allow entries:
|
|
48
|
+
# project_allow - global_allow - global_deny, filtered for reusability
|
|
49
|
+
COMPUTE_ALLOW='
|
|
50
|
+
'"$IS_REUSABLE"'
|
|
51
|
+
($project.permissions.allow // []) as $pa |
|
|
52
|
+
($global.permissions.allow // []) as $ga |
|
|
53
|
+
($global.permissions.deny // []) as $gd |
|
|
54
|
+
[$pa[] | select(is_reusable) | select(. as $e | ($ga | index($e)) | not) | select(. as $e | ($gd | index($e)) | not)]
|
|
55
|
+
'
|
|
56
|
+
|
|
57
|
+
# jq filter to compute new deny entries:
|
|
58
|
+
# project_deny - global_deny, filtered for reusability
|
|
59
|
+
COMPUTE_DENY='
|
|
60
|
+
'"$IS_REUSABLE"'
|
|
61
|
+
($project.permissions.deny // []) as $pd |
|
|
62
|
+
($global.permissions.deny // []) as $gd |
|
|
63
|
+
[$pd[] | select(is_reusable) | select(. as $e | ($gd | index($e)) | not)]
|
|
64
|
+
'
|
|
65
|
+
|
|
66
|
+
# Read project settings once
|
|
67
|
+
PROJECT_JSON=$(cat "$PROJECT_SETTINGS" 2>/dev/null) || exit 0
|
|
68
|
+
|
|
69
|
+
# Check if there's anything to sync before acquiring the lock
|
|
70
|
+
NEW_ALLOW=$(jq -n --argjson project "$PROJECT_JSON" --argjson global "$(cat "$GLOBAL_SETTINGS")" "$COMPUTE_ALLOW")
|
|
71
|
+
NEW_DENY=$(jq -n --argjson project "$PROJECT_JSON" --argjson global "$(cat "$GLOBAL_SETTINGS")" "$COMPUTE_DENY")
|
|
72
|
+
|
|
73
|
+
# Exit early if nothing to add
|
|
74
|
+
if [ "$NEW_ALLOW" = "[]" ] && [ "$NEW_DENY" = "[]" ]; then
|
|
75
|
+
exit 0
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
# Use flock for exclusive access during the read-modify-write cycle.
|
|
79
|
+
# macOS doesn't ship flock; fall back to mkdir-based locking.
|
|
80
|
+
acquire_lock() {
|
|
81
|
+
if command -v flock &>/dev/null; then
|
|
82
|
+
exec 9>"$LOCK_FILE"
|
|
83
|
+
flock -w 5 9 || return 1
|
|
84
|
+
else
|
|
85
|
+
local attempts=0
|
|
86
|
+
while ! mkdir "$LOCK_FILE" 2>/dev/null; do
|
|
87
|
+
attempts=$((attempts + 1))
|
|
88
|
+
if [ $attempts -ge 50 ]; then
|
|
89
|
+
# Stale lock — remove and retry once
|
|
90
|
+
rm -rf "$LOCK_FILE"
|
|
91
|
+
mkdir "$LOCK_FILE" 2>/dev/null || return 1
|
|
92
|
+
break
|
|
93
|
+
fi
|
|
94
|
+
sleep 0.1
|
|
95
|
+
done
|
|
96
|
+
fi
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
release_lock() {
|
|
100
|
+
if command -v flock &>/dev/null; then
|
|
101
|
+
exec 9>&-
|
|
102
|
+
rm -f "$LOCK_FILE"
|
|
103
|
+
else
|
|
104
|
+
rm -rf "$LOCK_FILE"
|
|
105
|
+
fi
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
# Clean up lock on exit
|
|
109
|
+
trap release_lock EXIT
|
|
110
|
+
|
|
111
|
+
acquire_lock || exit 0
|
|
112
|
+
|
|
113
|
+
# Re-read global settings under the lock (another process may have changed it)
|
|
114
|
+
GLOBAL_JSON=$(cat "$GLOBAL_SETTINGS" 2>/dev/null) || GLOBAL_JSON='{}'
|
|
115
|
+
|
|
116
|
+
# Recompute with fresh global state
|
|
117
|
+
NEW_ALLOW=$(jq -n --argjson project "$PROJECT_JSON" --argjson global "$GLOBAL_JSON" "$COMPUTE_ALLOW")
|
|
118
|
+
NEW_DENY=$(jq -n --argjson project "$PROJECT_JSON" --argjson global "$GLOBAL_JSON" "$COMPUTE_DENY")
|
|
119
|
+
|
|
120
|
+
# Exit if nothing to add after re-check
|
|
121
|
+
if [ "$NEW_ALLOW" = "[]" ] && [ "$NEW_DENY" = "[]" ]; then
|
|
122
|
+
exit 0
|
|
123
|
+
fi
|
|
124
|
+
|
|
125
|
+
# Build the merge filter
|
|
126
|
+
MERGE_FILTER='
|
|
127
|
+
.permissions.allow = ((.permissions.allow // []) + $new_allow | unique) |
|
|
128
|
+
.permissions.deny = ((.permissions.deny // []) + $new_deny | unique)
|
|
129
|
+
'
|
|
130
|
+
|
|
131
|
+
# Write atomically via temp file
|
|
132
|
+
TEMP_FILE=$(mktemp "${GLOBAL_SETTINGS}.XXXXXX")
|
|
133
|
+
if jq --argjson new_allow "$NEW_ALLOW" --argjson new_deny "$NEW_DENY" "$MERGE_FILTER" <<< "$GLOBAL_JSON" > "$TEMP_FILE" 2>/dev/null; then
|
|
134
|
+
mv "$TEMP_FILE" "$GLOBAL_SETTINGS"
|
|
135
|
+
else
|
|
136
|
+
rm -f "$TEMP_FILE"
|
|
137
|
+
fi
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": ["ES2020"],
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"rootDir": "./src",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"moduleResolution": "node",
|
|
14
|
+
"types": ["node"],
|
|
15
|
+
"jsx": "react",
|
|
16
|
+
"jsxFactory": "React.createElement"
|
|
17
|
+
},
|
|
18
|
+
"include": ["src/**/*.ts", "src/**/*.tsx"],
|
|
19
|
+
"exclude": ["node_modules", "dist", "**/*.test.ts"]
|
|
20
|
+
}
|
package/uninstall.sh
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Nemus - Uninstall Script
|
|
4
|
+
|
|
5
|
+
set -e
|
|
6
|
+
|
|
7
|
+
# Colors
|
|
8
|
+
RED='\033[0;31m'
|
|
9
|
+
GREEN='\033[0;32m'
|
|
10
|
+
YELLOW='\033[1;33m'
|
|
11
|
+
CYAN='\033[0;36m'
|
|
12
|
+
NC='\033[0m' # No Color
|
|
13
|
+
|
|
14
|
+
echo ""
|
|
15
|
+
echo "============================================================"
|
|
16
|
+
echo -e "${CYAN}Nemus - Uninstall${NC}"
|
|
17
|
+
echo "============================================================"
|
|
18
|
+
echo ""
|
|
19
|
+
|
|
20
|
+
print_success() {
|
|
21
|
+
echo -e "${GREEN}✓${NC} $1"
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
print_warning() {
|
|
25
|
+
echo -e "${YELLOW}⚠${NC} $1"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
print_info() {
|
|
29
|
+
echo -e "${CYAN}ℹ${NC} $1"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
# Confirm uninstall
|
|
33
|
+
echo -e "${YELLOW}This will remove:${NC}"
|
|
34
|
+
echo " • Global nemus/nem command"
|
|
35
|
+
echo " • npm link"
|
|
36
|
+
echo ""
|
|
37
|
+
echo -e "${YELLOW}This will NOT remove:${NC}"
|
|
38
|
+
echo " • Your workspaces ($HOME/workspaces/)"
|
|
39
|
+
echo " • Cache files (~/.workspace-manager-cache/)"
|
|
40
|
+
echo " • Configuration files (~/.workspace-manager-claude-config.json)"
|
|
41
|
+
echo " • Shell integration (from .zshrc or .bashrc)"
|
|
42
|
+
echo " • ghq (if installed)"
|
|
43
|
+
echo ""
|
|
44
|
+
|
|
45
|
+
read -p "Continue with uninstall? (y/n) " -n 1 -r
|
|
46
|
+
echo ""
|
|
47
|
+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
|
|
48
|
+
echo "Uninstall cancelled."
|
|
49
|
+
exit 0
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
# Get the directory where this script is located
|
|
53
|
+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
54
|
+
|
|
55
|
+
# Remove permission sync hook from Claude Code settings
|
|
56
|
+
PERM_SYNC_JS="$SCRIPT_DIR/dist/utils/permission-sync.js"
|
|
57
|
+
if [ -f "$PERM_SYNC_JS" ]; then
|
|
58
|
+
print_info "Removing Claude Code permission sync hook..."
|
|
59
|
+
node -e "require('$PERM_SYNC_JS').uninstallPermissionSyncHook()" 2>/dev/null && \
|
|
60
|
+
print_success "Permission sync hook removed" || \
|
|
61
|
+
print_warning "Could not remove permission sync hook (non-critical)"
|
|
62
|
+
print_info "Removing permission review skill and reminder hook..."
|
|
63
|
+
node -e "require('$PERM_SYNC_JS').uninstallReviewSkillAndReminder()" 2>/dev/null && \
|
|
64
|
+
print_success "Permission review skill and reminder hook removed" || \
|
|
65
|
+
print_warning "Could not remove permission review skill (non-critical)"
|
|
66
|
+
print_info "Removing Nemus skills..."
|
|
67
|
+
node -e "require('$PERM_SYNC_JS').uninstallWorkspaceSkills()" 2>/dev/null && \
|
|
68
|
+
print_success "Nemus skills removed" || \
|
|
69
|
+
print_warning "Could not remove Nemus skills (non-critical)"
|
|
70
|
+
fi
|
|
71
|
+
|
|
72
|
+
# Unlink global command
|
|
73
|
+
print_info "Removing global command..."
|
|
74
|
+
cd "$SCRIPT_DIR"
|
|
75
|
+
npm unlink || true
|
|
76
|
+
print_success "Global command removed"
|
|
77
|
+
|
|
78
|
+
# Optionally clean up shell integration
|
|
79
|
+
echo ""
|
|
80
|
+
read -p "Remove shell integration from .zshrc/.bashrc? (y/n) " -n 1 -r
|
|
81
|
+
echo ""
|
|
82
|
+
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
83
|
+
# Remove from .zshrc
|
|
84
|
+
if [ -f "$HOME/.zshrc" ]; then
|
|
85
|
+
if grep -q "# Nemus - Shell Integration" "$HOME/.zshrc"; then
|
|
86
|
+
# Create backup
|
|
87
|
+
cp "$HOME/.zshrc" "$HOME/.zshrc.backup.$(date +%Y%m%d_%H%M%S)"
|
|
88
|
+
# Remove the function
|
|
89
|
+
sed -i.bak '/# Nemus - Shell Integration/,/^}$/d' "$HOME/.zshrc"
|
|
90
|
+
print_success "Removed from .zshrc (backup created)"
|
|
91
|
+
fi
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
# Remove from .bashrc
|
|
95
|
+
if [ -f "$HOME/.bashrc" ]; then
|
|
96
|
+
if grep -q "# Nemus - Shell Integration" "$HOME/.bashrc"; then
|
|
97
|
+
# Create backup
|
|
98
|
+
cp "$HOME/.bashrc" "$HOME/.bashrc.backup.$(date +%Y%m%d_%H%M%S)"
|
|
99
|
+
# Remove the function
|
|
100
|
+
sed -i.bak '/# Nemus - Shell Integration/,/^}$/d' "$HOME/.bashrc"
|
|
101
|
+
print_success "Removed from .bashrc (backup created)"
|
|
102
|
+
fi
|
|
103
|
+
fi
|
|
104
|
+
fi
|
|
105
|
+
|
|
106
|
+
# Optionally remove cache
|
|
107
|
+
echo ""
|
|
108
|
+
read -p "Remove cache files? (y/n) " -n 1 -r
|
|
109
|
+
echo ""
|
|
110
|
+
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
111
|
+
rm -rf "$HOME/.workspace-manager-cache"
|
|
112
|
+
print_success "Cache removed"
|
|
113
|
+
fi
|
|
114
|
+
|
|
115
|
+
# Optionally remove config
|
|
116
|
+
echo ""
|
|
117
|
+
read -p "Remove configuration files? (y/n) " -n 1 -r
|
|
118
|
+
echo ""
|
|
119
|
+
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
120
|
+
rm -f "$HOME/.workspace-manager-claude-config.json"
|
|
121
|
+
rm -f "$HOME/.workspace-templates.json"
|
|
122
|
+
rm -f "$HOME/.workspace-last-created"
|
|
123
|
+
print_success "Configuration files removed"
|
|
124
|
+
fi
|
|
125
|
+
|
|
126
|
+
# Ask about workspaces
|
|
127
|
+
echo ""
|
|
128
|
+
echo -e "${YELLOW}Your workspaces are still at:${NC}"
|
|
129
|
+
echo " $HOME/workspaces/"
|
|
130
|
+
echo ""
|
|
131
|
+
read -p "Remove ALL workspaces? (THIS CANNOT BE UNDONE) (y/n) " -n 1 -r
|
|
132
|
+
echo ""
|
|
133
|
+
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
134
|
+
read -p "Are you ABSOLUTELY sure? Type 'DELETE' to confirm: " CONFIRM
|
|
135
|
+
if [ "$CONFIRM" = "DELETE" ]; then
|
|
136
|
+
rm -rf $HOME/workspaces
|
|
137
|
+
print_success "All workspaces removed"
|
|
138
|
+
else
|
|
139
|
+
print_info "Workspace removal cancelled (keeping workspaces)"
|
|
140
|
+
fi
|
|
141
|
+
else
|
|
142
|
+
print_info "Keeping workspaces"
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
echo ""
|
|
146
|
+
echo "============================================================"
|
|
147
|
+
echo -e "${GREEN}Uninstall Complete${NC}"
|
|
148
|
+
echo "============================================================"
|
|
149
|
+
echo ""
|
|
150
|
+
|
|
151
|
+
echo "What was removed:"
|
|
152
|
+
print_success "Global nemus/nem command unlinked"
|
|
153
|
+
echo ""
|
|
154
|
+
|
|
155
|
+
echo "To completely remove the source code:"
|
|
156
|
+
echo " rm -rf $SCRIPT_DIR"
|
|
157
|
+
echo ""
|
|
158
|
+
|
|
159
|
+
echo "To reinstall:"
|
|
160
|
+
echo " cd $SCRIPT_DIR"
|
|
161
|
+
echo " ./install.sh"
|
|
162
|
+
echo ""
|