@daemux/claude-plugin 1.25.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.
@@ -0,0 +1,106 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { ensureFile, readJson, writeJson } from './utils.mjs';
3
+
4
+ const ENV_DEFAULTS = {
5
+ CLAUDE_CODE_ENABLE_TASKS: 'true',
6
+ CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS: '1',
7
+ };
8
+
9
+ const STATUS_LINE_PARTS = [
10
+ 'input=$(cat)',
11
+ 'user=$(whoami)',
12
+ 'host=$(hostname -s)',
13
+ 'dir=$(basename "$(echo "$input" | jq -r ".workspace.current_dir")")',
14
+ 'model=$(echo "$input" | jq -r ".model.display_name")',
15
+ 'used=$(echo "$input" | jq -r ".context_window.used_percentage // empty")',
16
+ 'remaining=$(echo "$input" | jq -r ".context_window.remaining_percentage // empty")',
17
+ 'if [ -n "$used" ]; then',
18
+ ' ctx_info=$(printf "Context: %.1f%% used (%.1f%% remaining)" "$used" "$remaining")',
19
+ 'else',
20
+ ' ctx_info="Context: N/A"',
21
+ 'fi',
22
+ 'printf "%s@%s:%s | %s | %s" "$user" "$host" "$dir" "$model" "$ctx_info"',
23
+ ];
24
+
25
+ export function injectEnvVars(settingsPath) {
26
+ try {
27
+ ensureFile(settingsPath);
28
+ const settings = readJson(settingsPath);
29
+ settings.env = settings.env || {};
30
+
31
+ const added = [];
32
+ for (const [key, value] of Object.entries(ENV_DEFAULTS)) {
33
+ if (!(key in settings.env)) {
34
+ settings.env[key] = value;
35
+ added.push(key);
36
+ }
37
+ }
38
+
39
+ if (added.length > 0) {
40
+ writeJson(settingsPath, settings);
41
+ console.log(`Added env vars: ${added.join(', ')}`);
42
+ } else {
43
+ console.log('All env vars already configured');
44
+ }
45
+ } catch (err) {
46
+ console.log(`Warning: could not configure env vars (${err.message})`);
47
+ }
48
+ }
49
+
50
+ export function removeEnvVars(settingsPath) {
51
+ if (!existsSync(settingsPath)) return;
52
+
53
+ try {
54
+ const settings = readJson(settingsPath);
55
+ if (!settings.env) return;
56
+
57
+ for (const key of Object.keys(ENV_DEFAULTS)) {
58
+ delete settings.env[key];
59
+ }
60
+
61
+ if (Object.keys(settings.env).length === 0) {
62
+ delete settings.env;
63
+ }
64
+
65
+ writeJson(settingsPath, settings);
66
+ console.log('Removed env vars');
67
+ } catch {
68
+ // Silently skip if settings file is invalid
69
+ }
70
+ }
71
+
72
+ export function injectStatusLine(settingsPath) {
73
+ try {
74
+ ensureFile(settingsPath);
75
+ const settings = readJson(settingsPath);
76
+
77
+ if (settings.statusLine) {
78
+ console.log('statusLine already configured, skipping');
79
+ return;
80
+ }
81
+
82
+ settings.statusLine = {
83
+ type: 'command',
84
+ command: STATUS_LINE_PARTS.join('; '),
85
+ };
86
+ writeJson(settingsPath, settings);
87
+ console.log('Added statusLine configuration');
88
+ } catch (err) {
89
+ console.log(`Warning: could not configure statusLine (${err.message})`);
90
+ }
91
+ }
92
+
93
+ export function removeStatusLine(settingsPath) {
94
+ if (!existsSync(settingsPath)) return;
95
+
96
+ try {
97
+ const settings = readJson(settingsPath);
98
+ if (!settings.statusLine) return;
99
+
100
+ delete settings.statusLine;
101
+ writeJson(settingsPath, settings);
102
+ console.log('Removed statusLine configuration');
103
+ } catch {
104
+ // Silently skip if settings file is invalid
105
+ }
106
+ }
@@ -0,0 +1,76 @@
1
+ import { existsSync, rmSync, unlinkSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { homedir } from 'node:os';
4
+ import { execSync } from 'node:child_process';
5
+ import {
6
+ MARKETPLACE_DIR, KNOWN_MP_PATH, CACHE_DIR,
7
+ MARKETPLACE_NAME, PLUGIN_REF,
8
+ readJson, writeJson,
9
+ } from './utils.mjs';
10
+ import { removeEnvVars, removeStatusLine } from './settings.mjs';
11
+
12
+ function runClaudeUninstall(scope) {
13
+ const scopeArg = scope === 'user' ? '' : ` --scope ${scope}`;
14
+ try {
15
+ execSync(`claude plugin uninstall ${PLUGIN_REF}${scopeArg}`, {
16
+ stdio: 'inherit',
17
+ });
18
+ } catch {
19
+ // Plugin may not be installed; continue gracefully
20
+ }
21
+ }
22
+
23
+ function unregisterMarketplace() {
24
+ if (!existsSync(KNOWN_MP_PATH)) return;
25
+ try {
26
+ console.log('Removing marketplace registration...');
27
+ const data = readJson(KNOWN_MP_PATH);
28
+ delete data[MARKETPLACE_NAME];
29
+ writeJson(KNOWN_MP_PATH, data);
30
+ } catch {
31
+ // Silently skip if file is invalid
32
+ }
33
+ }
34
+
35
+ function removeFileIfExists(filePath, label) {
36
+ if (existsSync(filePath)) {
37
+ console.log(`Removing ${label}...`);
38
+ unlinkSync(filePath);
39
+ }
40
+ }
41
+
42
+ export async function runUninstall(scope) {
43
+ console.log(`Uninstalling Daemux Claude Plugins (scope: ${scope})...`);
44
+
45
+ runClaudeUninstall(scope);
46
+
47
+ if (scope === 'user') {
48
+ console.log('Removing marketplace...');
49
+ rmSync(MARKETPLACE_DIR, { recursive: true, force: true });
50
+ rmSync(CACHE_DIR, { recursive: true, force: true });
51
+ unregisterMarketplace();
52
+ }
53
+
54
+ const baseDir = scope === 'user'
55
+ ? join(homedir(), '.claude')
56
+ : join(process.cwd(), '.claude');
57
+
58
+ const scopeLabel = scope === 'user' ? 'global' : 'project';
59
+
60
+ removeFileIfExists(join(baseDir, 'CLAUDE.md'), `${scopeLabel} CLAUDE.md`);
61
+
62
+ const settingsPath = join(baseDir, 'settings.json');
63
+ console.log(`Cleaning ${scopeLabel} settings...`);
64
+ removeEnvVars(settingsPath);
65
+ removeStatusLine(settingsPath);
66
+
67
+ console.log('');
68
+ if (scope === 'user') {
69
+ console.log('Done! Plugin uninstalled globally.');
70
+ } else {
71
+ console.log('Done! Plugin uninstalled from this project.');
72
+ console.log('');
73
+ console.log(`Note: Marketplace files remain in ${MARKETPLACE_DIR}`);
74
+ console.log('Run with --global --uninstall to remove marketplace completely.');
75
+ }
76
+ }
package/src/utils.mjs ADDED
@@ -0,0 +1,47 @@
1
+ import { execSync } from 'node:child_process';
2
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { dirname, join } from 'node:path';
5
+ import { homedir } from 'node:os';
6
+
7
+ export const MARKETPLACE_NAME = 'daemux-claude-plugins';
8
+ export const PLUGIN_NAME = 'daemux-dev-toolkit';
9
+ export const PLUGIN_REF = `${PLUGIN_NAME}@${MARKETPLACE_NAME}`;
10
+
11
+ const home = homedir();
12
+ export const MARKETPLACE_DIR = join(home, '.claude', 'plugins', 'marketplaces', MARKETPLACE_NAME);
13
+ export const KNOWN_MP_PATH = join(home, '.claude', 'plugins', 'known_marketplaces.json');
14
+ export const CACHE_DIR = join(home, '.claude', 'plugins', 'cache', MARKETPLACE_NAME);
15
+ export const TYPO_DIR = join(home, '.claude', 'plugins', 'marketplaces', 'daemux-daemux-plugins');
16
+
17
+ export function getPackageDir() {
18
+ const thisFile = fileURLToPath(import.meta.url);
19
+ return dirname(dirname(thisFile));
20
+ }
21
+
22
+ export function exec(cmd) {
23
+ try {
24
+ return execSync(cmd, { encoding: 'utf8', stdio: 'pipe' }).trim();
25
+ } catch {
26
+ return null;
27
+ }
28
+ }
29
+
30
+ export function ensureDir(dirPath) {
31
+ mkdirSync(dirPath, { recursive: true });
32
+ }
33
+
34
+ export function ensureFile(filePath, defaultContent = '{}') {
35
+ ensureDir(dirname(filePath));
36
+ if (!existsSync(filePath)) {
37
+ writeFileSync(filePath, defaultContent, 'utf8');
38
+ }
39
+ }
40
+
41
+ export function readJson(filePath) {
42
+ return JSON.parse(readFileSync(filePath, 'utf8'));
43
+ }
44
+
45
+ export function writeJson(filePath, data) {
46
+ writeFileSync(filePath, JSON.stringify(data, null, 2) + '\n', 'utf8');
47
+ }
@@ -0,0 +1,250 @@
1
+ # Project Development Standards
2
+
3
+ ## Mandatory Rules
4
+
5
+ ### Agent Delegation (NEVER violate)
6
+ - ALWAYS delegate ALL tasks to agents - use either plugin agents or built-in agents (via Task tool)
7
+ - NEVER perform any work directly - the main agent's role is ONLY to coordinate and delegate
8
+ - This includes verification: if you need to confirm an agent's claims, delegate verification to another agent (e.g., tester) — do NOT run commands yourself
9
+ - This applies to ALL task types: coding, research, exploration, file operations, testing, deployment, and any other work
10
+ - If unsure which agent to use, use the Task tool with a general-purpose, explore or any other built-in agent
11
+
12
+ ### DevOps Agent Required
13
+ ALL deployment and infrastructure operations SHOULD use the devops agent (deploy, logs, status, migrations, database/server optimization).
14
+ Prefer using the devops agent over direct Bash/SSH for structured operations.
15
+
16
+ ### Code Quality (enforced by agents)
17
+ - No TODO/FIXME in committed code
18
+ - No Mock/placeholder code
19
+ - No hardcoded secrets
20
+ - Use appropriate data types for precision requirements
21
+ - Sanitize and validate all external inputs
22
+ - Follow language-specific security best practices
23
+
24
+ ## Code Limits (MANDATORY)
25
+
26
+ | Limit | Value | Action if Exceeded |
27
+ |-------|-------|-------------------|
28
+ | File size | 400 lines | Split into modules |
29
+ | Functions per file | 10 | Group by domain/feature |
30
+ | Function length | 50 lines | Extract helper functions |
31
+ | Line width | 120 chars | Wrap or refactor |
32
+ | Max nesting | 5 levels | Use early returns |
33
+
34
+ ## Workflow
35
+
36
+ ### Task Type Detection
37
+
38
+ Detect from user request:
39
+ - **backend** - Business logic, data processing, API endpoints, server code
40
+ - **frontend** - User interface, visual components, client code
41
+ - **database** - Data schema, migrations, data layer changes
42
+ - **infra** - Infrastructure setup, deployment, server optimization
43
+ - **standard** - Mixed or unclear scope
44
+
45
+ ### Agent Flows
46
+
47
+ #### Standard Flow
48
+ ```
49
+ architect → product-manager(PRE) → developer → simplifier → reviewer → tester → product-manager(POST) → [devops]
50
+ ```
51
+
52
+ #### Backend Flow
53
+ ```
54
+ architect → product-manager(PRE) → developer(backend) → simplifier → reviewer → tester(backend) → product-manager(POST) → [devops]
55
+ ```
56
+
57
+ #### Frontend Flow
58
+ ```
59
+ architect → product-manager(PRE) → [designer] → developer(frontend) → simplifier → reviewer → tester(frontend) → product-manager(POST) → [devops]
60
+ ```
61
+
62
+ #### Database Flow
63
+ ```
64
+ devops(database,migrate) → simplifier → reviewer → product-manager(POST) → [devops(deploy)]
65
+ ```
66
+
67
+ #### Infra Flow
68
+ ```
69
+ devops (standalone)
70
+ ```
71
+
72
+ ### Agents Reference
73
+
74
+ | Agent | When to use |
75
+ |-------|-------------|
76
+ | architect | BEFORE developer - designs architecture |
77
+ | product-manager | PRE-DEV: validates approach. POST-DEV: after tests |
78
+ | developer | Code implementation (auto-detects context) |
79
+ | simplifier | AFTER developer - simplifies code |
80
+ | reviewer | After ANY code changes |
81
+ | tester | After review passes (auto-detects context) |
82
+ | devops | DevOps operations (mode: deploy/database+migrate/database+optimize/server+migrate/server+optimize) |
83
+ | designer | UI/UX design specs before frontend development |
84
+ | designer(review) | After developer: design review + generate assets via MCP tools if needed |
85
+ | Explore (Task tool) | Read/understand code |
86
+
87
+ ### Optional Agents
88
+
89
+ | Agent | When to Skip |
90
+ |-------|--------------|
91
+ | [devops] | No deployment configured (workflow ends at product-manager(POST)) |
92
+ | [designer] | Minor fixes, bug fixes, or non-visual changes |
93
+ | [designer(review)] | Only use if [designer] was used (reviews implementation, generates assets via MCP tools) |
94
+
95
+ ### Autonomous Iteration Philosophy
96
+
97
+ **Self-Correction (MANDATORY):** Before each fix attempt:
98
+ 1. Read previous error output carefully
99
+ 2. Check git diff to see what was already tried
100
+ 3. Identify WHY it failed, not just WHAT failed
101
+ 4. Try a DIFFERENT approach if same fix failed twice
102
+
103
+ **Persistence Wins:** Keep iterating until success.
104
+
105
+ ### Fix-and-Verify Loops
106
+
107
+ **review-loop:** reviewer → PASS? → EXIT | ISSUES? → developer → reviewer (repeat)
108
+
109
+ **manager-loop:** product-manager → COMPLETE? → EXIT | ISSUES? → developer → product-manager (repeat)
110
+
111
+ **test-loop:** tester → PASS? → EXIT | FAIL? → developer → simplifier → reviewer → tester (repeat)
112
+
113
+ If the same error persists unchanged after one full fix cycle, try a fundamentally different approach. If an agent crashes or returns empty output, re-run it once. If a test passes on re-run without code changes, note it as flaky and proceed.
114
+
115
+ ### Gates & Prerequisites
116
+
117
+ **Before product-manager (POST-DEV):**
118
+ - `TESTS: PASSED` from tester
119
+ - `Review: NO ISSUES` from reviewer
120
+
121
+ **Before devops:**
122
+ - `APPROVED` or `COMPLETE` from product-manager
123
+ - Deployment is optional when not configured
124
+
125
+ Missing evidence means run that agent first. Do NOT proceed without it.
126
+
127
+ **Verification rule:** Trust agent output at face value. If an agent reports PASS/COMPLETE, proceed to the next stage. Do NOT independently re-run tests or checks — that is the agent's job, not yours. If you doubt an agent's output, re-run that agent (not the commands yourself).
128
+
129
+ ### Parallel Execution
130
+
131
+ **Launch multiple agents in ONE message when possible.**
132
+
133
+ **Parallel OK:** Independent features, backend + frontend, tester(backend) + tester(frontend)
134
+
135
+ **Sequential ONLY:** Same-file changes, simplifier → reviewer, review-fix cycles, deployer after tests
136
+
137
+ ---
138
+ ## FOR ORCHESTRATORS ONLY
139
+ **If you are a TEAMMATE, skip to "For Teammates" section below.**
140
+ ---
141
+
142
+ ### Agent Teams (Evaluate per stage)
143
+
144
+ **You MUST evaluate team suitability for EACH workflow stage and print your decision in the output format.**
145
+
146
+ Evaluate each stage independently — a task may use single agents for some stages and teams for others.
147
+
148
+ **Use team for a stage when:**
149
+ - Multiple perspectives improve quality
150
+ - Competing approaches find better solutions
151
+ - Stage work splits into independent file groups
152
+
153
+ **Use single agent for a stage when:**
154
+ - Work touches the same files
155
+ - Stage is a single focused operation
156
+ - Adding perspectives adds no value
157
+
158
+ **Team Enforcement (MANDATORY):**
159
+ If `TEAMS:` output includes any stage using teams, you MUST call `TeamCreate` before spawning agents for that stage. Spawning agents via `Task` without `team_name` does NOT count as using teams. Violation = workflow non-compliance.
160
+
161
+ **When creating a team:**
162
+
163
+ ```
164
+ Create agent team with [N] teammates, all using Opus model:
165
+ - [role-1]: [Specific responsibility and task details]
166
+ - [role-2]: [Specific responsibility and task details]
167
+ - [role-3]: [Specific responsibility and task details]
168
+ ...
169
+
170
+ Spawn each teammate with detailed prompt including:
171
+ - Their specific role and responsibilities
172
+ - The task details
173
+ - How to coordinate with other teammates
174
+ ```
175
+
176
+ **Guidelines:**
177
+ - Use 2-10 teammates per stage
178
+ - Always specify Opus model for all teammates
179
+ - Assign distinct, non-overlapping scopes to each teammate
180
+ - Include full instructions in spawn prompts (don't reference external files)
181
+ - One team at a time - dissolve before next stage
182
+ - Assign 5-6 tasks per teammate
183
+
184
+ ---
185
+ ## FOR TEAMMATES ONLY
186
+ **If you are the ORCHESTRATOR, skip this section.**
187
+ ---
188
+
189
+ ### Teammate Instructions
190
+
191
+ **Ignore orchestration workflows above.**
192
+
193
+ 1. Your spawn prompt contains your full instructions
194
+ 2. Message teammates directly to coordinate
195
+ 3. Focus only on your assigned scope
196
+ 4. Complete your work, let team dissolve
197
+
198
+ ---
199
+
200
+ ### Large Task Protocol
201
+
202
+ For tasks with 5+ requirements:
203
+
204
+ 1. **Save requirements** to `.claude/.tasks/{short-topic}.md` before starting any agent (create `.claude/.tasks/` directory if it doesn't exist)
205
+ 2. **Each session:** pass the exact file path (e.g., `.claude/.tasks/auth-system.md`) to architect and product-manager
206
+ 3. **After each batch:** `/clear` and continue — tell user which task file to reference
207
+ 4. **Done when:** product-manager confirms zero remaining and deletes the task file
208
+
209
+ Rules:
210
+ - ALWAYS pass the exact `.claude/.tasks/` file path when calling architect and product-manager agents
211
+ - Architect and product-manager will read ONLY the specified file — never guess the filename
212
+ - Add `.claude/.tasks/` to `.gitignore`
213
+
214
+ ### Output Format and Continuation
215
+
216
+ **CRITICAL: Copy the EXACT flow from the Agent Flows section above. Include ALL agents, including optional ones in `[brackets]`. Do NOT abbreviate or skip agents.**
217
+
218
+ Output the analysis in this format:
219
+
220
+ ```
221
+ TASK TYPE: [backend/frontend/database/infra/standard]
222
+
223
+ RECOMMENDED FLOW:
224
+ <copy the EXACT flow from Agent Flows section - include ALL agents with [optional] ones>
225
+
226
+ TEAMS: [per-stage evaluation: which stages use teams and why, or NO if all stages use single agents]
227
+
228
+ DEPLOYMENT: [AVAILABLE - deployment configured | NOT CONFIGURED - workflow ends at product-manager(POST)]
229
+
230
+ TASK TRACKING: ALWAYS use TaskCreate/TaskUpdate/TaskList tools for multi-step tasks (3+ steps)
231
+
232
+ NOTES:
233
+ - [any special considerations]
234
+
235
+ LAUNCHING: [first-agent-name]
236
+ ```
237
+
238
+ **Expected RECOMMENDED FLOW outputs (copy exactly):**
239
+
240
+ - **backend**: `architect → product-manager(PRE) → developer(backend) → simplifier → reviewer → tester(backend) → product-manager(POST) → [devops]`
241
+ - **frontend**: `architect → product-manager(PRE) → [designer] → developer(frontend) → simplifier → reviewer → tester(frontend) → product-manager(POST) → [devops]`
242
+ - **database**: `devops(database,migrate) → simplifier → reviewer → product-manager(POST) → [devops(deploy)]`
243
+ - **infra**: `devops (standalone)`
244
+ - **standard**: `architect → product-manager(PRE) → developer → simplifier → reviewer → tester → product-manager(POST) → [devops]`
245
+
246
+ **MANDATORY: After outputting the workflow analysis above, you MUST:**
247
+ 1. **Create tasks** using TaskCreate for each major step in the workflow (if 3+ steps)
248
+ 2. **Immediately invoke** the first agent using the Task tool in the same response
249
+
250
+ Do NOT stop. Do NOT wait for user confirmation. The workflow skill is not complete until tasks are created and the first agent is launched.