thuthi-plugin 0.0.0-stage → 0.1.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/.claude-plugin/marketplace.json +55 -0
- package/README.md +13 -2
- package/bin/parallel-browser.js +109 -0
- package/extension/background.js +1329 -0
- package/extension/config.json +1 -0
- package/extension/guard.js +44 -0
- package/extension/manifest.json +10 -0
- package/extension/overlay.js +104 -0
- package/extension/popup.html +34 -0
- package/extension/popup.js +39 -0
- package/extension-reloader/manifest.json +13 -0
- package/extension-reloader/sw.js +17 -0
- package/package.json +13 -4
- package/plugins/thuthi/.claude-plugin/plugin.json +8 -0
- package/plugins/thuthi/context.md +3 -0
- package/plugins/thuthi/hooks/hooks.json +15 -0
- package/plugins/thuthi/skills/setup/SKILL.md +55 -0
- package/plugins/thuthi/skills/setup/scripts/doctor.py +249 -0
- package/plugins/thuthi/skills/setup/scripts/selftest.py +188 -0
- package/plugins/thuthi/tools/claude-switch/claude_switch.py +8 -0
- package/plugins/thuthi/tools/legacy_launcher.py +65 -0
- package/plugins/thuthi/tools/statusline/statusline.py +8 -0
- package/plugins/thuthi-accounts/.claude-plugin/plugin.json +9 -0
- package/plugins/thuthi-accounts/bin/claude-switch +5 -0
- package/plugins/thuthi-accounts/bin/claude-switch.cmd +4 -0
- package/plugins/thuthi-accounts/hooks/hooks.json +15 -0
- package/plugins/thuthi-accounts/lib/tls.py +68 -0
- package/plugins/thuthi-accounts/lib/usage_store.py +150 -0
- package/plugins/thuthi-accounts/setup_check.py +21 -0
- package/plugins/thuthi-accounts/skills/claude-switch/SKILL.md +48 -0
- package/plugins/thuthi-accounts/tools/claude-switch/claude-switch-tui.py +397 -0
- package/plugins/thuthi-accounts/tools/claude-switch/claude_switch.py +1204 -0
- package/plugins/thuthi-accounts/tools/claude-switch/credstore.py +417 -0
- package/plugins/thuthi-accounts/tools/claude-switch/install.py +301 -0
- package/plugins/thuthi-accounts/tools/claude-switch/tests/selftest.py +491 -0
- package/plugins/thuthi-accounts/tools/statusline/statusline.py +212 -0
- package/plugins/thuthi-agenda-picker/.claude-plugin/plugin.json +9 -0
- package/plugins/thuthi-agenda-picker/context.md +3 -0
- package/plugins/thuthi-agenda-picker/hooks/hooks.json +15 -0
- package/plugins/thuthi-agenda-picker/lib/pbpage.py +397 -0
- package/plugins/thuthi-agenda-picker/setup_check.py +18 -0
- package/plugins/thuthi-agenda-picker/skills/agenda-picker/SKILL.md +280 -0
- package/plugins/thuthi-agenda-picker/skills/agenda-picker/references/design-rules.md +110 -0
- package/plugins/thuthi-agenda-picker/skills/agenda-picker/references/diagram/base.css +33 -0
- package/plugins/thuthi-agenda-picker/skills/agenda-picker/references/example/agenda.json +146 -0
- package/plugins/thuthi-agenda-picker/skills/agenda-picker/references/example/shots/A-dark.svg +5 -0
- package/plugins/thuthi-agenda-picker/skills/agenda-picker/references/example/shots/A-light.svg +5 -0
- package/plugins/thuthi-agenda-picker/skills/agenda-picker/references/example/shots/B-dark.svg +5 -0
- package/plugins/thuthi-agenda-picker/skills/agenda-picker/references/example/shots/B-light.svg +5 -0
- package/plugins/thuthi-agenda-picker/skills/agenda-picker/references/example/shots/C-dark.svg +5 -0
- package/plugins/thuthi-agenda-picker/skills/agenda-picker/references/example/shots/C-light.svg +5 -0
- package/plugins/thuthi-agenda-picker/skills/agenda-picker/references/example/shots/base.css +33 -0
- package/plugins/thuthi-agenda-picker/skills/agenda-picker/references/example/shots/name-B.html +15 -0
- package/plugins/thuthi-agenda-picker/skills/agenda-picker/references/example/shots/now-dark.svg +5 -0
- package/plugins/thuthi-agenda-picker/skills/agenda-picker/references/example/shots/now-light.svg +5 -0
- package/plugins/thuthi-agenda-picker/skills/agenda-picker/scripts/picker.py +1286 -0
- package/plugins/thuthi-agenda-picker/skills/agenda-picker/scripts/selftest.py +771 -0
- package/plugins/thuthi-agenda-picker/skills/agenda-picker/scripts/shot.py +117 -0
- package/plugins/thuthi-agenda-picker/skills/agenda-picker/scripts/template.html +1029 -0
- package/plugins/thuthi-arch-diagram/.claude-plugin/plugin.json +9 -0
- package/plugins/thuthi-arch-diagram/lib/pbpage.py +397 -0
- package/plugins/thuthi-arch-diagram/lib/tls.py +68 -0
- package/plugins/thuthi-arch-diagram/setup_check.py +10 -0
- package/plugins/thuthi-arch-diagram/skills/arch-diagram/SKILL.md +125 -0
- package/plugins/thuthi-arch-diagram/skills/arch-diagram/references/design-rules.md +110 -0
- package/plugins/thuthi-arch-diagram/skills/arch-diagram/references/example-shop.py +167 -0
- package/plugins/thuthi-arch-diagram/skills/arch-diagram/scripts/check.py +194 -0
- package/plugins/thuthi-arch-diagram/skills/arch-diagram/scripts/diagramkit.py +682 -0
- package/plugins/thuthi-arch-diagram/skills/arch-diagram/scripts/interact_test.py +115 -0
- package/plugins/thuthi-arch-diagram/skills/arch-diagram/scripts/render.py +113 -0
- package/plugins/thuthi-browser/.claude-plugin/plugin.json +9 -0
- package/plugins/thuthi-browser/context.md +3 -0
- package/plugins/thuthi-browser/hooks/hooks.json +15 -0
- package/plugins/thuthi-browser/lib/pbpage.py +397 -0
- package/plugins/thuthi-browser/setup_check.py +93 -0
- package/plugins/thuthi-browser/skills/parallel-browser/SKILL.md +271 -0
- package/plugins/thuthi-browser/skills/parallel-browser/references/api.md +243 -0
- package/plugins/thuthi-browser/skills/parallel-browser/references/install.md +106 -0
- package/plugins/thuthi-demo-video/.claude-plugin/plugin.json +9 -0
- package/plugins/thuthi-demo-video/lib/pbpage.py +397 -0
- package/plugins/thuthi-demo-video/setup_check.py +14 -0
- package/plugins/thuthi-demo-video/skills/demo-video/SKILL.md +261 -0
- package/plugins/thuthi-demo-video/skills/demo-video/scripts/caption.html +16 -0
- package/plugins/thuthi-demo-video/skills/demo-video/scripts/cursor.js +132 -0
- package/plugins/thuthi-demo-video/skills/demo-video/scripts/demo_video.py +2416 -0
- package/plugins/thuthi-demo-video/skills/demo-video/scripts/example_scenario.py +97 -0
- package/plugins/thuthi-demo-video/skills/demo-video/scripts/frame.html +95 -0
- package/plugins/thuthi-demo-video/skills/demo-video/scripts/overlay.js +129 -0
- package/plugins/thuthi-demo-video/skills/demo-video/scripts/title.html +30 -0
- package/plugins/thuthi-no-more-slop/.claude-plugin/plugin.json +9 -0
- package/plugins/thuthi-no-more-slop/setup_check.py +10 -0
- package/plugins/thuthi-no-more-slop/skills/no-more-slop/LICENSE +21 -0
- package/plugins/thuthi-no-more-slop/skills/no-more-slop/SKILL.md +235 -0
- package/plugins/thuthi-no-more-slop/skills/no-more-slop/SOURCE.txt +1 -0
- package/plugins/thuthi-no-more-slop/skills/no-more-slop/agents/openai.yaml +6 -0
- package/plugins/thuthi-no-more-slop/skills/no-more-slop/references/examples.md +289 -0
- package/plugins/thuthi-no-more-slop/skills/no-more-slop/references/tokens.md +46 -0
- package/plugins/thuthi-no-more-slop/skills/no-more-slop/references/unslop-fallback.md +36 -0
- package/plugins/thuthi-no-more-slop/skills/no-more-slop/scripts/count_tells.py +426 -0
- package/plugins/thuthi-orca/.claude-plugin/plugin.json +9 -0
- package/plugins/thuthi-orca/context.md +5 -0
- package/plugins/thuthi-orca/hooks/hooks.json +18 -0
- package/plugins/thuthi-orca/hooks/orca-team-grid.ts +21 -0
- package/plugins/thuthi-orca/setup_check.py +12 -0
- package/plugins/thuthi-orca/skills/orca-new-work/SKILL.md +492 -0
- package/plugins/thuthi-orca/tools/orca-team-grid/bin/tmux +338 -0
- package/plugins/thuthi-orca/tools/orca-team-grid/tests/selftest.py +299 -0
- package/runtime/client.js +69 -0
- package/runtime/daemon.js +503 -0
- package/runtime/focus-monitor.js +53 -0
- package/runtime/keys.js +86 -0
- package/runtime/owner.js +64 -0
- package/runtime/recorder.js +267 -0
- package/runtime/relay.js +95 -0
- package/runtime/session.js +1599 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "relayPort": 9333 }
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// CDP guard rails. Runs inside the extension, so the runtime cannot bypass it.
|
|
2
|
+
// Philosophy: an agent session may do anything to *its own tab*, but nothing that
|
|
3
|
+
// touches the browser process, other targets, or shared storage.
|
|
4
|
+
|
|
5
|
+
const DENY_METHODS = [
|
|
6
|
+
/^Browser\./, // Browser.close / Browser.crash / crashGpuProcess / permissions ...
|
|
7
|
+
/^Target\./, // tab/window lifecycle goes through the extension API, not CDP
|
|
8
|
+
/^Page\.crash$/,
|
|
9
|
+
/^Page\.close$/,
|
|
10
|
+
/^Storage\.clear/, // clearDataForOrigin, clearCookies ...
|
|
11
|
+
/^Network\.clearBrowser/,
|
|
12
|
+
/^Security\./,
|
|
13
|
+
/^SystemInfo\./,
|
|
14
|
+
/^Tethering\./,
|
|
15
|
+
/^Extensions\./,
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
const ALLOW_METHODS = [/^Browser\.getVersion$/];
|
|
19
|
+
|
|
20
|
+
// Schemes an agent tab may never navigate to. about:blank is the only about: URL allowed.
|
|
21
|
+
const DENY_URL = /^(chrome|edge|chrome-extension|extension|devtools|file|javascript|view-source|brave|opera|vivaldi|chrome-untrusted|chrome-search):/i;
|
|
22
|
+
|
|
23
|
+
function urlBlocked(url) {
|
|
24
|
+
if (typeof url !== 'string') return false;
|
|
25
|
+
const u = url.trim();
|
|
26
|
+
if (/^about:/i.test(u)) return u.toLowerCase() !== 'about:blank';
|
|
27
|
+
return DENY_URL.test(u);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** @returns {string|null} error message, or null when the command may pass */
|
|
31
|
+
export function checkCommand(method, params) {
|
|
32
|
+
if (typeof method !== 'string') return 'method must be a string';
|
|
33
|
+
if (ALLOW_METHODS.some((re) => re.test(method))) return null;
|
|
34
|
+
if (DENY_METHODS.some((re) => re.test(method))) return `blocked by guard: ${method}`;
|
|
35
|
+
if (method === 'Page.navigate' && urlBlocked(params?.url)) return `blocked by guard: navigation to ${params.url}`;
|
|
36
|
+
if (method === 'Page.setDownloadBehavior' && params?.behavior === 'allow' && !params?.downloadPath) {
|
|
37
|
+
return 'blocked by guard: downloads need an explicit downloadPath';
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function isUrlBlocked(url) {
|
|
43
|
+
return urlBlocked(url);
|
|
44
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest_version": 3,
|
|
3
|
+
"name": "parallel-browser bridge",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"description": "Gives AI agent sessions their own isolated, never-focused windows inside your real browser.",
|
|
6
|
+
"permissions": ["debugger", "tabs", "tabGroups", "scripting", "storage", "alarms"],
|
|
7
|
+
"host_permissions": ["<all_urls>"],
|
|
8
|
+
"background": { "service_worker": "background.js", "type": "module" },
|
|
9
|
+
"action": { "default_title": "parallel-browser 현황", "default_popup": "popup.html" }
|
|
10
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// Injected into every page an agent session owns (via chrome.scripting.executeScript, which
|
|
2
|
+
// runs in the isolated world, so chrome.runtime is available for the button).
|
|
3
|
+
// Colors follow chrome.tabGroups color names so the tab strip and the page match.
|
|
4
|
+
|
|
5
|
+
export const OVERLAY_ID = '__parallel_browser_overlay__';
|
|
6
|
+
|
|
7
|
+
export const GROUP_COLOR_CSS = {
|
|
8
|
+
blue: '#1a73e8',
|
|
9
|
+
red: '#d93025',
|
|
10
|
+
yellow: '#f9ab00',
|
|
11
|
+
green: '#188038',
|
|
12
|
+
pink: '#d01884',
|
|
13
|
+
purple: '#a142f4',
|
|
14
|
+
cyan: '#007b83',
|
|
15
|
+
orange: '#fa903e',
|
|
16
|
+
grey: '#5f6368',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The marker lives inside a *closed* shadow root, which keeps its text out of
|
|
21
|
+
* textContent/innerText of every ancestor, so neither our own selectors nor the page's scripts
|
|
22
|
+
* see the status line as page content. Everything is click-through except the button: the user
|
|
23
|
+
* can keep clicking and typing in the page without disturbing the agent, and takes control only
|
|
24
|
+
* by pressing that button (or when the agent hands over with handOff).
|
|
25
|
+
*/
|
|
26
|
+
export function overlayInject(sessionId, label, cssColor, status, paused, handedOver) {
|
|
27
|
+
// Everything this function needs must live inside it: chrome.scripting.executeScript({ func })
|
|
28
|
+
// ships the function body alone, so module scope does not exist where this runs.
|
|
29
|
+
const ID = '__parallel_browser_overlay__';
|
|
30
|
+
// `position:fixed` is itself a stacking context, so a host without a z-index would trap the
|
|
31
|
+
// children's z-index inside it and paint the whole overlay at an effective 0 — any positioned
|
|
32
|
+
// page element would cover it. The host carries the maximum z-index itself. `inset:auto` and
|
|
33
|
+
// the explicit box undo the UA styles that come with [popover]; `background:none` undoes its
|
|
34
|
+
// Canvas background.
|
|
35
|
+
const HOST_CSS =
|
|
36
|
+
'position:fixed;inset:auto;top:0;left:0;width:0;height:0;margin:0;border:0;padding:0;' +
|
|
37
|
+
'background:none;overflow:visible;pointer-events:none;z-index:2147483647;';
|
|
38
|
+
// z-index only orders us against the page's normal content. The top layer sits above all of it,
|
|
39
|
+
// so a page popup cannot cover us however high it bids. Re-asserting on every repaint moves us
|
|
40
|
+
// back to the front if the page put something in the top layer after us.
|
|
41
|
+
const raise = (el) => {
|
|
42
|
+
if (!el.showPopover) return; // pre-Chrome-114: the max z-index above is all we have
|
|
43
|
+
try {
|
|
44
|
+
if (el.getAttribute('popover') !== 'manual') el.setAttribute('popover', 'manual');
|
|
45
|
+
if (el.matches(':popover-open')) el.hidePopover();
|
|
46
|
+
el.showPopover();
|
|
47
|
+
} catch {
|
|
48
|
+
// Not connected, or the page disabled it. Fall back to plain stacking rather than leaving
|
|
49
|
+
// the host display:none, which is what an unopened popover would be.
|
|
50
|
+
el.removeAttribute('popover');
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const docEl = document.documentElement;
|
|
54
|
+
if (!docEl) return;
|
|
55
|
+
let host = document.getElementById(ID);
|
|
56
|
+
if (!host) {
|
|
57
|
+
host = document.createElement('div');
|
|
58
|
+
host.id = ID;
|
|
59
|
+
host.setAttribute('data-parallel-browser', 'overlay');
|
|
60
|
+
host.setAttribute('aria-hidden', 'true');
|
|
61
|
+
docEl.appendChild(host);
|
|
62
|
+
try {
|
|
63
|
+
host.__pcRoot = host.attachShadow({ mode: 'closed' });
|
|
64
|
+
host.__pcRoot.innerHTML = '<div id="b"></div><div id="p"><span id="t"></span><button id="a"></button></div>';
|
|
65
|
+
} catch { /* a page may forbid attachShadow on this element */ }
|
|
66
|
+
}
|
|
67
|
+
// Unconditionally, so a host left in the page by an older build is restyled rather than kept.
|
|
68
|
+
host.style.cssText = HOST_CSS;
|
|
69
|
+
raise(host);
|
|
70
|
+
const sr = host.__pcRoot;
|
|
71
|
+
if (!sr) return;
|
|
72
|
+
const box = sr.querySelector('#b');
|
|
73
|
+
const pill = sr.querySelector('#p');
|
|
74
|
+
const text = sr.querySelector('#t');
|
|
75
|
+
const action = sr.querySelector('#a');
|
|
76
|
+
if (!box || !pill || !text || !action) return;
|
|
77
|
+
|
|
78
|
+
// Click-through. Working in the page never takes the session away; the button below is the
|
|
79
|
+
// only thing here that accepts a click, and pressing it is the entire handover gesture.
|
|
80
|
+
box.style.cssText = `position:fixed;inset:0;z-index:2147483647;pointer-events:none;box-shadow:inset 0 0 0 4px ${cssColor};`;
|
|
81
|
+
|
|
82
|
+
pill.style.cssText =
|
|
83
|
+
`position:fixed;top:0;left:0;z-index:2147483647;pointer-events:none;background:${cssColor};color:#fff;` +
|
|
84
|
+
'font:600 12px/1 system-ui,-apple-system,sans-serif;padding:5px 6px 5px 10px;' +
|
|
85
|
+
'border-bottom-right-radius:8px;letter-spacing:.2px;display:flex;align-items:center;gap:8px;';
|
|
86
|
+
text.textContent = `${paused ? (handedOver ? '🖐' : '⏸') : '●'} ${label} · ${status}`;
|
|
87
|
+
action.textContent = paused ? '에이전트에게 돌려주기' : '내가 하기';
|
|
88
|
+
action.style.cssText =
|
|
89
|
+
'pointer-events:auto;cursor:pointer;border:0;border-radius:5px;padding:4px 8px;' +
|
|
90
|
+
`font:600 11px/1 system-ui,-apple-system,sans-serif;background:#fff;color:${cssColor};`;
|
|
91
|
+
// The button must never hold keyboard focus. A focused button is activated by Enter or Space,
|
|
92
|
+
// so a press the agent sends to the page afterwards would push it again and hand the session
|
|
93
|
+
// over a second time — the accidental takeover this whole design exists to prevent. Out of the
|
|
94
|
+
// tab order, refusing focus on mousedown, and dropped again after every activation.
|
|
95
|
+
action.tabIndex = -1;
|
|
96
|
+
action.onmousedown = (e) => e.preventDefault();
|
|
97
|
+
// The one and only way the user takes the session from inside the page.
|
|
98
|
+
action.onclick = (e) => {
|
|
99
|
+
e.preventDefault();
|
|
100
|
+
e.stopPropagation();
|
|
101
|
+
try { action.blur(); } catch { /* detached */ }
|
|
102
|
+
try { chrome.runtime.sendMessage({ type: 'overlayAction', sessionId, action: paused ? 'resume' : 'pause' }); } catch { /* extension reloaded */ }
|
|
103
|
+
};
|
|
104
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="ko">
|
|
3
|
+
<meta charset="utf-8">
|
|
4
|
+
<style>
|
|
5
|
+
body { width: 380px; margin: 0; font: 13px/1.4 system-ui, -apple-system, sans-serif; color: #202124; background: #fff; }
|
|
6
|
+
header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid #e8eaed; }
|
|
7
|
+
header b { font-size: 14px; }
|
|
8
|
+
.conn { font-size: 12px; color: #5f6368; }
|
|
9
|
+
.conn.on::before { content: '● '; color: #188038; }
|
|
10
|
+
.conn.off::before { content: '● '; color: #d93025; }
|
|
11
|
+
#list { max-height: 420px; overflow: auto; }
|
|
12
|
+
.s { padding: 10px 12px; border-bottom: 1px solid #f1f3f4; border-left: 5px solid var(--c); }
|
|
13
|
+
.s .t { display: flex; align-items: center; gap: 8px; }
|
|
14
|
+
.s .name { font-weight: 600; }
|
|
15
|
+
.s .st { color: #5f6368; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
16
|
+
.s .st.paused { color: #b06000; }
|
|
17
|
+
.tabs { margin: 6px 0 0; padding: 0; list-style: none; }
|
|
18
|
+
.tabs li { color: #3c4043; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
|
|
19
|
+
.tabs li::before { content: '– '; color: #9aa0a6; }
|
|
20
|
+
button { font: inherit; font-size: 12px; padding: 3px 8px; border: 1px solid #dadce0; border-radius: 6px; background: #fff; cursor: pointer; }
|
|
21
|
+
button:hover { background: #f8f9fa; }
|
|
22
|
+
button.danger { color: #d93025; border-color: #f5c2c0; }
|
|
23
|
+
footer { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; }
|
|
24
|
+
.empty { padding: 24px 12px; color: #5f6368; text-align: center; }
|
|
25
|
+
.muted { color: #9aa0a6; font-size: 11px; }
|
|
26
|
+
</style>
|
|
27
|
+
<header><b>parallel-browser</b><span id="conn" class="conn off">runtime 미연결</span></header>
|
|
28
|
+
<div id="list"></div>
|
|
29
|
+
<footer>
|
|
30
|
+
<span id="meta" class="muted"></span>
|
|
31
|
+
<button id="panic" class="danger">모든 세션 정지</button>
|
|
32
|
+
</footer>
|
|
33
|
+
<script src="popup.js"></script>
|
|
34
|
+
</html>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Dashboard popup: current sessions, their tabs, pause/resume/stop. Read-only otherwise;
|
|
2
|
+
// it never focuses or activates anything.
|
|
3
|
+
const COLOR = { blue: '#1a73e8', red: '#d93025', yellow: '#f9ab00', green: '#188038', pink: '#d01884', purple: '#a142f4', cyan: '#007b83', orange: '#fa903e', grey: '#5f6368' };
|
|
4
|
+
const send = (msg) => chrome.runtime.sendMessage(msg);
|
|
5
|
+
const $ = (id) => document.getElementById(id);
|
|
6
|
+
|
|
7
|
+
async function render() {
|
|
8
|
+
const st = await send({ type: 'state' }).catch(() => null);
|
|
9
|
+
if (!st) return;
|
|
10
|
+
const conn = $('conn');
|
|
11
|
+
conn.className = `conn ${st.relayConnected ? 'on' : 'off'}`;
|
|
12
|
+
conn.textContent = st.relayConnected ? 'runtime 연결됨' : 'runtime 미연결';
|
|
13
|
+
$('meta').textContent = st.agentWindowId ? `전용 창 #${st.agentWindowId} · 세션 ${st.sessions.length}` : '전용 창 없음';
|
|
14
|
+
const list = $('list');
|
|
15
|
+
list.innerHTML = '';
|
|
16
|
+
if (!st.sessions.length) { list.innerHTML = '<div class="empty">실행 중인 세션이 없습니다</div>'; return; }
|
|
17
|
+
for (const s of st.sessions) {
|
|
18
|
+
const el = document.createElement('div');
|
|
19
|
+
el.className = 's';
|
|
20
|
+
el.style.setProperty('--c', COLOR[s.color] || COLOR.grey);
|
|
21
|
+
const status = s.paused ? '⏸ 일시정지 (사용자 제어 중)' : `● ${s.status}`;
|
|
22
|
+
el.innerHTML = `
|
|
23
|
+
<div class="t"><span class="name"></span><span class="st ${s.paused ? 'paused' : ''}"></span>
|
|
24
|
+
<button data-act="${s.paused ? 'resume' : 'pause'}">${s.paused ? '재개' : '일시정지'}</button>
|
|
25
|
+
<button data-act="close" class="danger">정지</button></div>
|
|
26
|
+
<ul class="tabs"></ul>`;
|
|
27
|
+
el.querySelector('.name').textContent = s.name;
|
|
28
|
+
el.querySelector('.st').textContent = status;
|
|
29
|
+
const ul = el.querySelector('.tabs');
|
|
30
|
+
for (const t of s.tabs) { const li = document.createElement('li'); li.textContent = `${t.title || '(제목 없음)'} · ${t.url}`; li.title = t.url; ul.appendChild(li); }
|
|
31
|
+
const li = document.createElement('li'); li.className = 'muted'; li.textContent = `탭 ${s.tabs.length}/${s.budget}`; ul.appendChild(li);
|
|
32
|
+
for (const b of el.querySelectorAll('button')) b.onclick = async () => { await send({ type: b.dataset.act, sessionId: s.id }); render(); };
|
|
33
|
+
list.appendChild(el);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
$('panic').onclick = async () => { await send({ type: 'panic' }); render(); };
|
|
38
|
+
render();
|
|
39
|
+
setInterval(render, 1000);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest_version": 3,
|
|
3
|
+
"name": "parallel-browser reloader",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"description": "Reloads the parallel-browser bridge extension when it asks, so updates on disk take effect without a trip to the extensions page.",
|
|
6
|
+
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1KRN52EX+JJdfZfrwXSemB+geJrMBwAFvOTzSNZl3n9QY+ZS0dPps8ojgFeW/ogZc4pEercQbZMqDEiAXhuSjPbKjtLEwbN5EvrhC5teMgvdzFDByqpkAHwLkdzyvDD26j6GBmNl5y8BPna5SASW6GDqEdbmTgX1DMit6gcmUIJyu/u+YJMNukIEqim0KTMwktetwi3aTaE1NUWkYBoNKnFa5o+1uyskagjuroie7cUeDa4PpKw0aIv7SeXLgEUnk3GfcryLPm7T5blVAd80K/NKs3DaSqo0NFJXbnsSugHuOd75+rBFug6jExo1yG0iadtBbyZlhu2EF68ASqqgCQIDAQAB",
|
|
7
|
+
"permissions": [
|
|
8
|
+
"management"
|
|
9
|
+
],
|
|
10
|
+
"background": {
|
|
11
|
+
"service_worker": "sw.js"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// parallel-browser reloader: turns the extension that messages it off and on again, which makes
|
|
2
|
+
// the browser load that extension's files from disk afresh. The bridge cannot do this itself in
|
|
3
|
+
// every browser: chrome.runtime.reload() brought it back on Edge but left it gone on Chrome
|
|
4
|
+
// (2026-11-16, Chrome 157 / Chrome for Testing 159), while a disable + enable from another
|
|
5
|
+
// extension reloaded it on both (and on Edge 157). A service-worker restart does not pick up new
|
|
6
|
+
// files on either.
|
|
7
|
+
//
|
|
8
|
+
// It only ever reloads the sender, so another extension asking can do nothing but reload itself.
|
|
9
|
+
chrome.runtime.onMessageExternal.addListener((msg, sender, reply) => {
|
|
10
|
+
if (msg?.type === 'ping') { reply({ ok: true, version: chrome.runtime.getManifest().version }); return; }
|
|
11
|
+
if (msg?.type !== 'reload-me' || !sender.id) return;
|
|
12
|
+
(async () => {
|
|
13
|
+
await chrome.management.setEnabled(sender.id, false);
|
|
14
|
+
await chrome.management.setEnabled(sender.id, true);
|
|
15
|
+
})().then(() => reply({ ok: true }), (e) => reply({ error: String(e?.message || e) }));
|
|
16
|
+
return true;
|
|
17
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "thuthi-plugin",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "thuthi 의 Claude Code 플러그인 마켓플레이스 (marketplace.json + plugins/). Claude Code 에서 npm 마켓플레이스로 등록해 쓴다.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=22"
|
|
8
|
+
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"parallel-browser": "./bin/parallel-browser.js"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"ws": "^8.18.0"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: setup
|
|
3
|
+
description: >-
|
|
4
|
+
켜진 thuthi-* 플러그인(thuthi-browser · thuthi-agenda-picker · thuthi-demo-video · thuthi-arch-diagram · thuthi-orca ·
|
|
5
|
+
thuthi-accounts · thuthi-notify · thuthi-no-more-slop)이 쓰는 도구만 이 PC 에 있는지 점검하고, 빠진 것을 설치하는 길을 안내한다. 꺼진 플러그인은 건너뛴다.
|
|
6
|
+
python3 · ffmpeg · Node 22 · orca · jq · parallel-browser 런타임과 브라우저 확장 연결, 터미널 claude-switch 명령과 statusLine 설정,
|
|
7
|
+
ntfy 알림 설정을 본다 (브라우저 작업은 모두 parallel-browser 로 한다). "thuthi 셋업", "/thuthi:setup", "새 PC 에서 thuthi
|
|
8
|
+
플러그인 준비", "스킬 도구가 없다는 오류" 같은 요청에 진입한다. 다른 thuthi 스킬이 도구가 없어 실패했을 때도 쓴다.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# thuthi:setup: 켜진 thuthi 플러그인의 도구 점검 · 설치
|
|
12
|
+
|
|
13
|
+
## 1. 점검한다
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
python3 ${CLAUDE_PLUGIN_ROOT}/skills/setup/scripts/doctor.py
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`dangerouslyDisableSandbox: true` 로 실행한다 (`claude plugin list` · `parallel-browser status` · `gh auth status` · `npm` 이 샌드박스에 막힌다). 아무것도 설치하지 않는다.
|
|
20
|
+
|
|
21
|
+
- 켜진 플러그인은 `claude plugin list --json` 으로 찾고 (프로젝트 설정까지 합친 값), 플러그인마다 자기 `setup_check.py` 를 부른다. 꺼진 플러그인은 마지막에 "꺼져 있어 건너뜀" (켜기 `claude plugin enable`), 마켓플레이스에 있지만 안 깐 것은 "설치 안 됨" (`claude plugin install`) 으로 이름만 찍는다. 의존 플러그인이 빠지거나 꺼져 불러오지 못한 플러그인은 ✗ "불러오기 실패" 로 찍는다. 꺼진 것까지 보려면 `doctor.py --all`.
|
|
22
|
+
- 묶음(스킬 · 기능)마다 `✓ 있음 · ✗ 필수인데 없음 · △ 선택 기능이 빠짐` 과 고치는 법을 찍는다 (exit 1 = ✗ 가 있다).
|
|
23
|
+
|
|
24
|
+
결과를 사용자에게 묶음별로 짧게 알린다. 쓰고 싶은 기능의 플러그인이 꺼져 있으면 켜는 법(`/plugin` 또는 `claude plugin install <이름>@thuthi-plugin`)을 알린다. 안 쓸 기능은 플러그인을 꺼 두면 점검에서도 빠진다.
|
|
25
|
+
|
|
26
|
+
## 2. 고친다 (사용자 확인을 받고)
|
|
27
|
+
|
|
28
|
+
| 빠진 것 | 하는 일 |
|
|
29
|
+
|---|---|
|
|
30
|
+
| parallel-browser 명령 · 런타임 의존성 (`thuthi-browser`) | `python3 ${CLAUDE_PLUGIN_ROOT}/skills/setup/scripts/doctor.py fix pb-runtime` (마켓플레이스가 받아 둔 레포에서 `npm install` + `npm link`) |
|
|
31
|
+
| 브라우저 확장 연결 | 사람이 한 번 한다: Chrome · Edge 확장 화면 → 개발자 모드 → 압축 해제된 확장 로드 → doctor 가 찍은 `<마켓플레이스 레포>/extension`. Chrome 이면 `<마켓플레이스 레포>/extension-reloader` 도 같은 방법으로 (업데이트 자동 반영) |
|
|
32
|
+
| ffmpeg · node · jq · gh | `brew install <이름>` (사용자에게 무엇을 깔지 보이고 확인받은 뒤) |
|
|
33
|
+
| GitHub 로그인 | 사용자가 직접 `! gh auth login` (대화형) |
|
|
34
|
+
| claude-switch launcher · 터미널 shim (`thuthi-accounts`) | `python3 ${CLAUDE_PLUGIN_ROOT}/skills/setup/scripts/doctor.py fix claude-switch` (`~/.local/share/claude-switch/launch.py` + `~/.local/bin` 의 `claude-switch` · `thuthi-statusline`, Windows 는 `.cmd` 도. 예전 install.sh 복사본은 `~/.local/share/claude-switch/replaced/<시각>/` 으로 옮긴다) |
|
|
35
|
+
| 알림 (ntfy, `thuthi-notify`) | 할 것 없다. 기본 토픽 `claude` 와 발행 토큰이 코드에 들어 있다. 사용자가 다른 토픽 · 토큰을 원할 때만 `python3 <thuthi-notify 플러그인>/tools/notify/notify.py setup --topic <토픽> --token tk_…` 한 뒤 `notify.py test` (플러그인 폴더는 `claude plugin list --json` 의 `readFromFolder` · `installPath`) |
|
|
36
|
+
| statusLine (`thuthi-accounts`) | `python3 ${CLAUDE_PLUGIN_ROOT}/skills/setup/scripts/doctor.py fix statusline` (`~/.claude/settings.json` 을 `settings.json.bak-thuthi-<시각>` 으로 백업하고 `statusLine.command` 를 바꾼다: macOS · Linux 는 `~/.local/bin/thuthi-statusline`, Windows 는 `<python> <launch.py> statusline`. 다른 키는 그대로 둔다). 고치기 전에 지금 statusLine 을 사용자에게 보이고 바꿔도 되는지 묻는다 |
|
|
37
|
+
|
|
38
|
+
- 설치는 무엇을 어디에 까는지 먼저 말하고 확인받는다. `brew` · `npm link` 는 이 PC 전체에 깔린다.
|
|
39
|
+
- 고친 뒤 doctor 를 다시 돌려 ✓ 로 바뀐 것을 보인다.
|
|
40
|
+
|
|
41
|
+
## parallel-browser 런타임을 마켓플레이스 레포에서 쓰는 이유
|
|
42
|
+
|
|
43
|
+
플러그인 설치는 `plugins/thuthi-browser` 만 캐시로 가져가서 `runtime/` · `extension/` 이 없다. 마켓플레이스를 추가하면 레포 전체가 `~/.claude/plugins/marketplaces/thuthi-plugin` 에 받아지므로 (이 레포를 로컬 경로로 등록한 PC 는 그 경로), 런타임과 확장을 거기서 쓴다. clone 이 하나로 줄고 플러그인 업데이트 때 런타임도 같이 바뀐다.
|
|
44
|
+
|
|
45
|
+
- 마켓플레이스를 업데이트하면 저절로 반영된다: 데몬은 코드가 바뀌면 브라우저를 쓰는 에이전트가 없는 때 스스로 다시 뜨고, 확장도 다시 불러온다 (Edge 는 그대로, Chrome 은 도우미 확장 `extension-reloader/` 를 한 번 올려 두어야 한다). 안 되면 `parallel-browser status` 의 `extension.note` 가 까닭을 적는다.
|
|
46
|
+
- 업데이트가 레포를 새로 받으면 `node_modules` 가 없어질 수 있다. doctor 가 "런타임 의존성" ✗ 로 알려 주면 `fix pb-runtime` 을 다시 한다.
|
|
47
|
+
- 그 폴더는 Claude Code 가 관리하는 곳이라 위치가 바뀌면 확장 경로를 다시 올려야 한다. doctor 의 "parallel-browser 명령" 줄이 마켓플레이스 레포가 아닌 곳을 가리키면 그 신호다.
|
|
48
|
+
|
|
49
|
+
## claude-switch shim 이 판을 찾는 방법
|
|
50
|
+
|
|
51
|
+
플러그인 판이 바뀌면 `${CLAUDE_PLUGIN_ROOT}` 경로도 바뀐다. 그래서 shim 은 고정 위치의 launcher(`~/.local/share/claude-switch/launch.py`) 를 부르고, launcher 가 실행할 때마다 지금 판을 찾는다: 로컬 경로 마켓플레이스면 원본 폴더, 아니면 `installed_plugins.json` 의 `installPath`. 그래서 `fix claude-switch` 는 PC 마다 한 번이면 된다 (python 을 옮겼을 때만 다시). launcher 내용이 바뀌는 판(예: 0.12.0 에서 찾는 플러그인 이름이 `thuthi-accounts` 로 바뀜)은 `thuthi-accounts` 의 Stop 훅이 깔린 launcher 를 알아서 다시 쓴다. 플러그인은 사용자 statusLine 을 직접 정할 수 없어서 (플러그인 settings 는 `agent` · `subagentStatusLine` 만 받는다) `fix statusline` 이 settings.json 을 고친다. 설치 코드는 `thuthi-accounts` 의 `tools/claude-switch/install.py` 에 있고 그 플러그인의 `setup_check.py` 가 그것을 부른다.
|
|
52
|
+
|
|
53
|
+
## 점검 목록을 고칠 때
|
|
54
|
+
|
|
55
|
+
점검은 플러그인마다 `<플러그인>/setup_check.py` 에 둔다: `check(d)` 가 `[(묶음, 기호, 항목, 설명)]` 을 돌려주고, 고칠 수 있으면 `fix(what, d)` 가 종료 코드를 돌려준다 (자기 항목이 아니면 `None`). `d` 는 doctor 모듈이라 `d.run` · `d.version` · `d.market_root` · `d.OK/BAD/OPT` 를 같이 쓴다. 새 플러그인이나 새 도구가 생기면 그 플러그인의 `setup_check.py` 에 더한다. doctor 는 켜진 플러그인 찾기 · 공통 항목 · 출력만 한다. python3 3.9 표준 라이브러리만 쓴다. 고친 뒤 `python3 scripts/selftest.py` 를 돌린다.
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""켜진 thuthi-* 플러그인이 쓰는 도구가 이 PC 에 있는지 점검한다.
|
|
3
|
+
|
|
4
|
+
doctor.py 켜진 플러그인만 점검 (아무것도 설치하지 않는다)
|
|
5
|
+
doctor.py --all 꺼진 플러그인까지 마켓플레이스의 플러그인을 모두 점검
|
|
6
|
+
doctor.py fix <항목> 그 항목을 가진 플러그인의 setup_check.py 가 고친다
|
|
7
|
+
pb-runtime (thuthi-browser) 마켓플레이스가 받아 둔 레포에서 npm install + npm link
|
|
8
|
+
claude-switch (thuthi-accounts) launcher 와 터미널 shim (~/.local/bin 의 claude-switch · thuthi-statusline)
|
|
9
|
+
statusline (thuthi-accounts) ~/.claude/settings.json 의 statusLine 을 thuthi statusline 으로 (백업을 남긴다)
|
|
10
|
+
|
|
11
|
+
플러그인마다 자기 점검을 <플러그인>/setup_check.py 에 둔다: check(d) → [(묶음, 기호, 항목, 설명)], fix(what, d) → 종료 코드
|
|
12
|
+
(자기 항목이 아니면 None). d 는 이 모듈이라 run · version · market_root · OK/BAD/OPT 를 같이 쓴다.
|
|
13
|
+
켜진 플러그인은 `claude plugin list --json` 으로 찾는다 (프로젝트 설정까지 합친 값). claude 명령이 없으면 installed_plugins.json
|
|
14
|
+
과 settings.json 의 enabledPlugins 로 어림한다.
|
|
15
|
+
brew 로 까는 것(ffmpeg · node · jq · gh)은 명령만 알려 준다. 설치는 사용자 확인을 받고 따로 한다.
|
|
16
|
+
python3 3.9 표준 라이브러리만 쓴다. exit 0 = 필수 항목이 다 있다, 1 = 빠진 필수 항목이 있다.
|
|
17
|
+
"""
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
import importlib.util
|
|
21
|
+
import json
|
|
22
|
+
import os
|
|
23
|
+
import re
|
|
24
|
+
import shutil
|
|
25
|
+
import subprocess
|
|
26
|
+
import sys
|
|
27
|
+
import unicodedata
|
|
28
|
+
from pathlib import Path
|
|
29
|
+
|
|
30
|
+
HERE = Path(__file__).resolve().parent
|
|
31
|
+
PLUGIN = HERE.parents[2] # <thuthi> (= CLAUDE_PLUGIN_ROOT, 판마다 바뀐다)
|
|
32
|
+
MARKET = "thuthi-plugin"
|
|
33
|
+
OK, BAD, OPT = "✓", "✗", "△" # 있음 · 필수인데 없음 · 선택 기능이 빠짐
|
|
34
|
+
|
|
35
|
+
CLAUDE_DIR = Path(os.environ.get("CLAUDE_CONFIG_DIR") or Path.home() / ".claude")
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def run(cmd, timeout=20, cwd=None):
|
|
39
|
+
# 이름은 shutil.which 로 찾아 전체 경로로 부른다. Windows 의 npm · parallel-browser 는 .cmd 라 이름만으로는
|
|
40
|
+
# 실행되지 않는다 (WinError 2, Windows 실측)
|
|
41
|
+
cmd = [shutil.which(cmd[0]) or cmd[0], *cmd[1:]]
|
|
42
|
+
try:
|
|
43
|
+
r = subprocess.run(cmd, capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=timeout, cwd=cwd)
|
|
44
|
+
return r.returncode, (r.stdout or "") + (r.stderr or "")
|
|
45
|
+
except (OSError, subprocess.TimeoutExpired) as e:
|
|
46
|
+
return 127, str(e)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def version(cmd, pattern=r"(\d+)\.(\d+)"):
|
|
50
|
+
if not shutil.which(cmd[0]):
|
|
51
|
+
return None
|
|
52
|
+
_, out = run(cmd)
|
|
53
|
+
m = re.search(pattern, out)
|
|
54
|
+
return tuple(int(x) for x in m.groups()) if m else ()
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def load_json(p: Path) -> dict:
|
|
58
|
+
try:
|
|
59
|
+
return json.loads(p.read_text(encoding="utf-8"))
|
|
60
|
+
except (OSError, ValueError):
|
|
61
|
+
return {}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def market_root() -> Path | None:
|
|
65
|
+
"""마켓플레이스가 받아 둔 레포 (GitHub 로 받았으면 ~/.claude/plugins/marketplaces/thuthi-plugin, 로컬 경로면 그 경로)."""
|
|
66
|
+
loc = (load_json(CLAUDE_DIR / "plugins" / "known_marketplaces.json").get(MARKET) or {}).get("installLocation")
|
|
67
|
+
return Path(loc) if loc and Path(loc, "runtime").is_dir() else None
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
# ─── 플러그인 찾기 ────────────────────────────────────────────
|
|
71
|
+
|
|
72
|
+
def _local_plugins() -> dict:
|
|
73
|
+
"""이 core 옆 (레포 · 로컬 경로 마켓플레이스) 이나 마켓플레이스 레포에 있는 thuthi 플러그인 이름 → 폴더."""
|
|
74
|
+
out = {}
|
|
75
|
+
bases = [PLUGIN.parent]
|
|
76
|
+
root = market_root()
|
|
77
|
+
if root:
|
|
78
|
+
bases.append(root / "plugins")
|
|
79
|
+
for base in bases:
|
|
80
|
+
for d in sorted(base.glob("*/.claude-plugin/plugin.json")):
|
|
81
|
+
name = load_json(d).get("name")
|
|
82
|
+
if name and (name == "thuthi" or name.startswith("thuthi-")):
|
|
83
|
+
out.setdefault(name, d.parent.parent)
|
|
84
|
+
return out
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def _from_cli() -> dict | None:
|
|
88
|
+
"""`claude plugin list --json` 의 이 마켓플레이스 플러그인 → {이름: (켜짐, 폴더, 오류)}. 못 부르면 None.
|
|
89
|
+
의존 플러그인이 빠지거나 꺼지면 enabled 는 true 인 채 errors 가 붙는다 (failed to load)."""
|
|
90
|
+
if not shutil.which("claude"):
|
|
91
|
+
return None
|
|
92
|
+
code, out = run(["claude", "plugin", "list", "--json"], timeout=60)
|
|
93
|
+
try:
|
|
94
|
+
rows = json.loads(out[out.index("["):])
|
|
95
|
+
except ValueError:
|
|
96
|
+
return None
|
|
97
|
+
if code:
|
|
98
|
+
return None
|
|
99
|
+
found = {}
|
|
100
|
+
for r in rows:
|
|
101
|
+
name, _, market = str(r.get("id", "")).partition("@")
|
|
102
|
+
if market != MARKET:
|
|
103
|
+
continue
|
|
104
|
+
root = r.get("readFromFolder") or r.get("installPath")
|
|
105
|
+
errs = [str(x.get("message") if isinstance(x, dict) else x) for x in (r.get("errors") or [])]
|
|
106
|
+
found[name] = (bool(r.get("enabled")), Path(root) if root else None, errs)
|
|
107
|
+
return found
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def _from_files() -> dict:
|
|
111
|
+
"""claude 명령이 없을 때: installed_plugins.json 의 설치 + 사용자 · 프로젝트 settings 의 enabledPlugins 로 어림한다."""
|
|
112
|
+
found = {}
|
|
113
|
+
for key, entries in (load_json(CLAUDE_DIR / "plugins" / "installed_plugins.json").get("plugins") or {}).items():
|
|
114
|
+
name, _, market = key.partition("@")
|
|
115
|
+
if market == MARKET and entries:
|
|
116
|
+
p = entries[0].get("installPath")
|
|
117
|
+
found[name] = (True, Path(p) if p else None, [])
|
|
118
|
+
enabled = {}
|
|
119
|
+
for f in (CLAUDE_DIR / "settings.json", Path.cwd() / ".claude" / "settings.json", Path.cwd() / ".claude" / "settings.local.json"):
|
|
120
|
+
enabled.update(load_json(f).get("enabledPlugins") or {})
|
|
121
|
+
for key, on in enabled.items():
|
|
122
|
+
name, _, market = key.partition("@")
|
|
123
|
+
if market == MARKET:
|
|
124
|
+
found[name] = (bool(on), (found.get(name) or (None, None, []))[1], [])
|
|
125
|
+
return found
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def plugins(include_off: bool = False) -> tuple:
|
|
129
|
+
"""(점검할 {이름: 폴더}, 깔았지만 꺼진 이름, 마켓플레이스에 있지만 안 깐 이름, 어떻게 찾았나, {이름: 불러오기 오류})"""
|
|
130
|
+
local = _local_plugins()
|
|
131
|
+
got = _from_cli()
|
|
132
|
+
how = "claude plugin list"
|
|
133
|
+
if got is None:
|
|
134
|
+
got = _from_files()
|
|
135
|
+
how = "설정 파일로 어림"
|
|
136
|
+
if not got: # 설치 기록이 없다: 레포에서 바로 돌린 것 (CI · 개발)
|
|
137
|
+
got = {n: (True, p, []) for n, p in local.items()}
|
|
138
|
+
how = "레포의 플러그인 전부"
|
|
139
|
+
on, off, errors = {}, [], {}
|
|
140
|
+
missing = [] if include_off else sorted(set(local) - set(got))
|
|
141
|
+
for name in sorted(set(got) | (set(local) if include_off else set())):
|
|
142
|
+
enabled, root, errs = got.get(name, (False, None, []))
|
|
143
|
+
if errs and enabled:
|
|
144
|
+
errors[name] = errs
|
|
145
|
+
# 로컬 경로 마켓플레이스는 원본 폴더를 읽는다. 기록된 폴더에 setup_check.py 가 없으면 (예전 판 캐시) 원본을 쓴다
|
|
146
|
+
if not (root and (root / "setup_check.py").is_file()) and name in local:
|
|
147
|
+
root = local[name]
|
|
148
|
+
if enabled or include_off:
|
|
149
|
+
on[name] = root
|
|
150
|
+
else:
|
|
151
|
+
off.append(name)
|
|
152
|
+
return on, off, missing, how, errors
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def load_check(name: str, root: Path | None):
|
|
156
|
+
f = root / "setup_check.py" if root else None
|
|
157
|
+
if not f or not f.is_file():
|
|
158
|
+
return None
|
|
159
|
+
spec = importlib.util.spec_from_file_location(f"setup_check_{name.replace('-', '_')}", f)
|
|
160
|
+
mod = importlib.util.module_from_spec(spec)
|
|
161
|
+
spec.loader.exec_module(mod)
|
|
162
|
+
return mod
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
# ─── 점검 · 고치기 ────────────────────────────────────────────
|
|
166
|
+
|
|
167
|
+
def check(include_off: bool = False) -> int:
|
|
168
|
+
rows = [] # (묶음, 기호, 항목, 설명/고치는 법)
|
|
169
|
+
add = lambda group, mark, item, note="": rows.append((group, mark, item, note))
|
|
170
|
+
|
|
171
|
+
py = sys.version_info[:2]
|
|
172
|
+
root = market_root()
|
|
173
|
+
add("공통", OK if py >= (3, 9) else BAD, f"python3 {py[0]}.{py[1]}", "" if py >= (3, 9) else "3.9 이상 필요")
|
|
174
|
+
add("공통", OK if shutil.which("git") else BAD, "git", "" if shutil.which("git") else "xcode-select --install")
|
|
175
|
+
if shutil.which("gh"):
|
|
176
|
+
code, _ = run(["gh", "auth", "status"])
|
|
177
|
+
add("공통", OK if code == 0 else OPT, "GitHub 로그인 (gh)", "" if code == 0 else "gh auth login (비공개 레포 업데이트)")
|
|
178
|
+
else:
|
|
179
|
+
add("공통", OPT, "gh", "brew install gh && gh auth login (비공개 레포 업데이트)")
|
|
180
|
+
add("공통", OK if os.environ.get("GITHUB_TOKEN") else OPT, "GITHUB_TOKEN",
|
|
181
|
+
"" if os.environ.get("GITHUB_TOKEN") else "없으면 백그라운드 자동 업데이트를 못 한다 (claude plugin update 는 된다)")
|
|
182
|
+
add("공통", OK if root else OPT, "마켓플레이스 레포", str(root) if root else
|
|
183
|
+
f"claude plugin marketplace add whquddn55/{MARKET}")
|
|
184
|
+
|
|
185
|
+
on, off, missing, how, errors = plugins(include_off)
|
|
186
|
+
for name, proot in on.items():
|
|
187
|
+
for err in errors.get(name, []):
|
|
188
|
+
add(name, BAD, "불러오기 실패", f"{err} → 빠지거나 꺼진 의존 플러그인을 claude plugin enable|install <이름>@{MARKET}")
|
|
189
|
+
if name == "thuthi":
|
|
190
|
+
continue
|
|
191
|
+
mod = load_check(name, proot)
|
|
192
|
+
if mod is None:
|
|
193
|
+
add(name, BAD, "점검 파일 (setup_check.py)", f"못 찾았다: {proot or '폴더 없음'} → claude plugin update {name}@{MARKET}")
|
|
194
|
+
continue
|
|
195
|
+
try:
|
|
196
|
+
rows.extend(mod.check(sys.modules[__name__]))
|
|
197
|
+
except Exception as e: # noqa: BLE001 한 플러그인 점검이 깨져도 나머지는 찍는다
|
|
198
|
+
add(name, BAD, "점검 중 오류", f"{type(e).__name__}: {e}")
|
|
199
|
+
|
|
200
|
+
cols = lambda t: sum(2 if unicodedata.east_asian_width(c) in "WF" else 1 for c in t) # 한글은 두 칸
|
|
201
|
+
width = max(cols(r[0]) for r in rows)
|
|
202
|
+
last = None
|
|
203
|
+
for group, mark, item, note in rows:
|
|
204
|
+
head = group if group != last else ""
|
|
205
|
+
last = group
|
|
206
|
+
print(head + " " * (width - cols(head)) + f" {mark} {item}" + (f" · {note}" if note else ""))
|
|
207
|
+
bad = sum(1 for r in rows if r[1] == BAD)
|
|
208
|
+
opt = sum(1 for r in rows if r[1] == OPT)
|
|
209
|
+
print(f"\n점검한 플러그인 ({how}): {', '.join(on) or '없음'}")
|
|
210
|
+
if off:
|
|
211
|
+
print(f"꺼져 있어 건너뜀: {', '.join(off)} (켜기: /plugin 또는 claude plugin enable <이름>@{MARKET})")
|
|
212
|
+
if missing:
|
|
213
|
+
print(f"설치 안 됨: {', '.join(missing)} (쓰려면: /plugin 또는 claude plugin install <이름>@{MARKET})")
|
|
214
|
+
print(f"{OK} 있음 {BAD} 필수인데 없음 {bad}개 {OPT} 선택 기능이 빠짐 {opt}개")
|
|
215
|
+
return 1 if bad else 0
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def fix(what: str) -> int:
|
|
219
|
+
on = plugins(include_off=True)[0] # 고치기는 꺼진 플러그인 것도 한다 (켜기 전에 준비할 수 있게)
|
|
220
|
+
for name, proot in on.items():
|
|
221
|
+
mod = load_check(name, proot)
|
|
222
|
+
if mod is None or not hasattr(mod, "fix"):
|
|
223
|
+
continue
|
|
224
|
+
code = mod.fix(what, sys.modules[__name__])
|
|
225
|
+
if code is not None:
|
|
226
|
+
return code
|
|
227
|
+
print(f"모르는 항목: {what} (pb-runtime · claude-switch · statusline)", file=sys.stderr)
|
|
228
|
+
return 2
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
def main() -> int:
|
|
232
|
+
for _f in (sys.stdout, sys.stderr): # Windows 콘솔(cp949)에서 ✓ · 한글을 찍다 죽지 않게
|
|
233
|
+
try:
|
|
234
|
+
_f.reconfigure(encoding="utf-8", errors="replace")
|
|
235
|
+
except (AttributeError, ValueError):
|
|
236
|
+
pass
|
|
237
|
+
args = sys.argv[1:]
|
|
238
|
+
if args[:1] == ["fix"] and len(args) == 2:
|
|
239
|
+
return fix(args[1])
|
|
240
|
+
if args == ["--all"]:
|
|
241
|
+
return check(include_off=True)
|
|
242
|
+
if args:
|
|
243
|
+
print(__doc__)
|
|
244
|
+
return 2
|
|
245
|
+
return check()
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
if __name__ == "__main__":
|
|
249
|
+
sys.exit(main())
|