Token导航 LogoToken导航TokenDH.com
研究检索执行命令github未标认证来源可访问许可证需确认审计异常

drushdrush 搜索

Agent Skill

drush 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

279

周安装

12

GitHub Stars

1

下载量

98
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:drush(drush 搜索)
来源仓库:https://github.com/factorial-io/skills
仓库路径:skills/drush
安装命令:
npx skills add https://github.com/factorial-io/skills --skill drush
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/factorial-io/skills --skill drush

简介

该技能提供 Drush CLI 的完整命令参考,支持 Drupal 站点管理操作。

  • 适用于缓存重建、配置导入导出和数据库管理等日常运维任务。
  • 所有命令均在 Drupal 引导上下文中运行,可直接访问 Drupal API。
  • 安装需从 GitHub 仓库获取,使用前应确认 Drush 版本和项目兼容性。
  • 在 DDEV 环境中使用时,应添加 ddev 前缀执行命令,确保环境隔离。

SKILL.md

Drush CLI Reference

Command-line interface for Drupal site management. Drush runs in the Drupal bootstrap context, giving full access to the Drupal API.

Command Structure

All commands follow: drush <command> [arguments] [--options]

Most commands have short aliases. Use drush list to see all available commands, drush <command> --help for details.

In DDEV: Prefix with ddev (e.g., ddev drush cr).

Quick Reference

TaskCommandAlias
Cache rebuilddrush cache:rebuilddrush cr
Config exportdrush config:exportdrush cex
Config importdrush config:importdrush cim
Config getdrush config:get <name>drush cget <name>
Config setdrush config:set <name> <key> <value>drush cset <name> <key> <value>
Database updatedrush updatedbdrush updb
Module installdrush pm:install <module>drush en <module>
Module uninstalldrush pm:uninstall <module>drush pmu <module>
List modulesdrush pm:listdrush pml
User login linkdrush user:logindrush uli
User infodrush user:information <name>
Watchdog logsdrush watchdog:showdrush ws (requires dblog module)
Status overviewdrush statusdrush st
Run crondrush cron
State getdrush state:get <key>drush sget <key>
State setdrush state:set <key> <value>drush sset <key> <value>
Deploy (updb+cim+cr)drush deploy
Code generationdrush generatedrush gen
Site requirementsdrush core:requirementsdrush rq
Watchdog taildrush watchdog:taildrush wt (requires dblog module)
Queue listdrush queue:list
Queue rundrush queue:run <name>

Running PHP Code

Drush can evaluate arbitrary PHP within full Drupal bootstrap context.

Inline PHP with eval

# Simple expression
drush php:eval "echo \Drupal::VERSION;"

# Load and inspect an entity
drush php:eval "\$node = \Drupal\node\Entity\Node::load(1); echo \$node->getTitle();"

# Query entities
drush php:eval "\$ids = \Drupal::entityTypeManager()->getStorage('node')->getQuery()->accessCheck(FALSE)->condition('type', 'article')->range(0, 5)->execute(); print_r(\$ids);"

# Access a service
drush php:eval "echo \Drupal::service('extension.list.module')->getPath('node');"

# Get current user
drush php:eval "echo \Drupal::currentUser()->getAccountName();"

Shell escaping: Use single quotes around the PHP string in fish/zsh to avoid $ expansion, or escape \$ in double quotes.

Interactive PHP shell

# Opens interactive REPL with Drupal bootstrapped
drush php:cli

Useful for exploring APIs interactively. Tab completion available for classes/functions.

Running PHP scripts

# Execute a PHP file with full Drupal bootstrap
drush php:script path/to/script.php

# Pass arguments (available as $extra in the script)
drush php:script path/to/script.php -- arg1 arg2

Executing SQL Commands

Direct SQL queries

# Run a SQL query directly
drush sql:query "SELECT nid, title FROM node_field_data LIMIT 10"

# Count content by type
drush sql:query "SELECT type, COUNT(*) as count FROM node_field_data GROUP BY type"

# Check a specific table (MySQL-specific syntax)
drush sql:query "DESCRIBE users_field_data"

# Show tables matching a pattern (MySQL-specific)
drush sql:query "SHOW TABLES LIKE '%node%'"

Note: DESCRIBE and SHOW TABLES are MySQL-specific. For PostgreSQL use \d table_name in sql:cli.

Database shell and dumps

# Open interactive database client (mysql/psql)
drush sql:cli

# Create database dump
drush sql:dump > dump.sql
drush sql:dump --result-file=/tmp/dump.sql
drush sql:dump --gzip --result-file=/tmp/dump.sql  # produces dump.sql.gz

# Import SQL file
drush sql:cli < dump.sql

# Show database connection info
drush sql:conf

# Sanitize user data (emails, passwords) for safe copies
drush sql:sanitize

# Drop all tables (use with caution)
drush sql:drop

Retrieving Configuration

Get configuration values

# Get entire config object (YAML output)
drush config:get system.site
drush cget system.site

# Get a specific key
drush config:get system.site name
drush cget system.site page.front

# List all config names (no config:list command in Drush 13+)
drush php:eval 'foreach (\Drupal::service("config.storage")->listAll("system") as $name) echo "$name\n";'

# Get active vs sync diff
drush config:status

Edit and set configuration

# Set a single value
drush config:set system.site name "My Site"
drush cset system.site name "My Site"

# Set nested value
drush config:set system.site page.front "/node"

# Edit full config object in editor
drush config:edit system.site

# Delete a config object
drush config:delete <config-name>

Config export/import workflow

# Export active config to sync directory
drush cex

# Show pending changes (what would be imported)
drush config:status

# Import config from sync directory
drush cim

# Import partial (only imports items in sync dir, does not delete active-only config)
drush cim --partial

# Import from a non-default directory
drush cim --source=/path/to/config

# Export single config item to stdout
drush config:get system.site --format=yaml

Module Management

# List all modules with status
drush pml
drush pml --status=enabled
drush pml --type=module --status="not installed"

# Install module(s)
drush en module_name
drush en module_one module_two

# Uninstall module(s)
drush pmu module_name

# Check if module is enabled
drush pml --filter=module_name

User Management

# Generate one-time login link
drush uli
drush uli --uid=1
drush uli admin

# Create user
drush user:create username --mail="user@example.com" --password="pass"

# Add role to user
drush user:role:add editor admin

# Remove role
drush user:role:remove editor admin

# Block/unblock user
drush user:block username
drush user:unblock username

# Reset password
drush user:password admin "newpassword"

Roles and Permissions

Inspecting roles

# List all roles with their permissions
drush role:list
drush role:list --format=table
drush role:list --format=json

# Get permissions for a specific role via config
drush cget user.role.editor

# Check a user's roles
drush user:information admin --format=json

Checking permissions

# List all available permissions (grep to search)
drush php:eval 'echo implode("\n", array_keys(\Drupal::service("user.permissions")->getPermissions()));'

# Search for specific permissions
drush php:eval 'echo implode("\n", array_keys(\Drupal::service("user.permissions")->getPermissions()));' | grep administer

Managing permissions

# Grant permission to a role
drush role:perm:add anonymous 'access content'

# Grant multiple permissions
drush role:perm:add editor 'access content,administer nodes'

# Remove permission from a role
drush role:perm:remove anonymous 'access content'

# Create / delete a role
drush role:create editor Editor
drush role:delete editor

Code Generation

Drush includes scaffolding for modules, plugins, forms, entities, and more via drush generate (powered by drupal-code-generator).

# Interactive: pick a generator from the list
drush generate

# Generate a specific component
drush generate module
drush generate controller
drush generate form:config
drush generate plugin:block
drush generate entity:content
drush generate hook

# Preview what would be generated (no files written)
drush generate controller --dry-run

# Pre-fill answers to skip interactive prompts
drush generate controller --answer=Example --answer=example

# See all available generators
drush generate --dry-run

Common generators: module, controller, field, hook, form:simple, form:config, form:confirm, plugin:block, plugin:action, entity:content, entity:configuration, service-provider, drush:command.

Run drush generate <name> --help for details on a specific generator.

Useful Options

OptionDescription
--format=jsonJSON output (useful for scripting/parsing)
--format=yamlYAML output
--format=tableTable output (default for many commands)
-yAuto-confirm prompts
-vVerbose output
--debugDebug output
--uri=http://example.comSet base URI for commands
--root=/path/to/drupalSet Drupal root

Deprecated and Removed Commands

Commands that NO LONGER EXIST in modern Drush (12+). Do NOT suggest these:

Removed CommandWhat to Use Instead
drush entity-updates / drush entupRemoved entirely. Entity schema updates are handled by drush updatedb (drush updb). If hook_update_N does not cover your change, write a custom update hook.
drush pm-download / drush dlUse composer require drupal/<module>
drush pm-update / drush upUse composer update then drush updb
drush pm-enable (old syntax)Use drush pm:install / drush en
drush pm-disable / drush disUse drush pm:uninstall / drush pmu (no "disable" concept in modern Drupal)
drush features-*Features module commands; use config management instead
drush sql-syncStill exists as sql:sync but requires site aliases. Without aliases, use drush sql:dump + transfer, or tools like phabalicious copy-from
drush core-rsyncStill exists as core:rsync but requires site aliases. Without aliases, use rsync directly or deployment tools
drush registry-rebuild / drush rrRemoved. Use drush cr instead
drush variable-get/setVariables replaced by State API (drush sget/drush sset) or Config API (drush cget/drush cset)

General rule: If a command uses a hyphen (e.g., entity-updates), it is likely old Drush syntax. Modern Drush uses colons (e.g., cache:rebuild).

Common Mistakes

WrongRightWhy
drush entity-updatesdrush updbentity-updates removed in Drush 11+
drush dl modulecomposer require drupal/modulePackage management via Composer now
drush upcomposer update && drush updbUpdates via Composer, then run DB updates
drush dis moduledrush pmu moduleNo disable concept; uninstall instead
drush cim without drush cr after issuesdrush cr && drush cimCache rebuild can resolve import errors
drush variable-get xdrush sget x or drush cget xVariables removed; use State or Config API
Running drush cim before drush updbdrush updb && drush cim or drush deployUpdate hooks may add schemas needed by config import
Manual drush updb && drush cim && drush crdrush deploydeploy handles correct order and error handling
drush cim/drush updb in scripts without -yAdd -y flagThese commands prompt for confirmation and hang without it
Forgetting accessCheck(FALSE) in entity queries via php:evalAlways add ->accessCheck(FALSE)Required since Drupal 9.2, throws deprecation without it

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.63%
按下载量换算35

Claude

30.76%
按下载量换算30

Cursor

16.29%
按下载量换算16

Gemini CLI

9.29%
按下载量换算9

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

未通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/factorial-io/skills --skill drush 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills