@enjoys/context-engine 1.0.5 → 1.0.7
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/README.md +477 -100
- package/data/commands/journalctl.json +203 -66
- package/data/commands/manifest.json +6 -2
- package/data/commands/systemctl.json +800 -23
- package/data/commands/systemd-analyze.json +239 -0
- package/data/commands/zsh.json +166 -0
- package/data/completion/nginx.json +561 -77
- package/data/completion/systemd.json +795 -47
- package/data/completion/zsh.json +829 -70
- package/data/defination/nginx.json +416 -32
- package/data/defination/systemd.json +538 -56
- package/data/defination/zsh.json +323 -86
- package/data/hover/nginx.json +59 -17
- package/data/hover/systemd.json +42 -7
- package/data/hover/zsh.json +44 -9
- package/package.json +7 -3
package/data/hover/systemd.json
CHANGED
|
@@ -4,49 +4,84 @@
|
|
|
4
4
|
"Unit": {
|
|
5
5
|
"contents": [
|
|
6
6
|
{
|
|
7
|
-
"value": "```ini\n[Unit]\nDescription=My Web Application\nAfter=network.target postgresql.service\
|
|
7
|
+
"value": "```ini\n[Unit]\nDescription=My Web Application\nDocumentation=https://docs.example.com\n\n# Dependencies (what to start):\nRequires=postgresql.service # Hard: fail if postgres fails\nWants=redis.service # Soft: ok if redis fails\nBindsTo=docker.service # Stop if docker stops\n\n# Ordering (when to start):\nAfter=network-online.target postgresql.service\nBefore=nginx.service\n\n# Conditions:\nConditionPathExists=/etc/myapp/config.yml\nConditionFileNotEmpty=/etc/myapp/license.key\n\n# On failure:\nOnFailure=notify-admin@%n.service\n```\n**[Unit]** defines metadata and dependencies. Ordering (After/Before) and requirements (Requires/Wants) are independent — use both for correct startup order."
|
|
8
8
|
}
|
|
9
9
|
]
|
|
10
10
|
},
|
|
11
11
|
"Service": {
|
|
12
12
|
"contents": [
|
|
13
13
|
{
|
|
14
|
-
"value": "```ini\n[Service]\nType=simple\nUser=
|
|
14
|
+
"value": "```ini\n[Service]\n# Startup types:\n# simple - process IS the service (default)\n# exec - like simple, started after exec()\n# forking - traditional daemon (fork+exit parent)\n# oneshot - run and exit (scripts)\n# notify - sends sd_notify() when ready\n# dbus - ready when D-Bus name acquired\nType=simple\n\nUser=appuser\nGroup=appuser\nWorkingDirectory=/opt/app\n\nExecStartPre=-/opt/app/pre-check.sh # - = ignore failure\nExecStart=/opt/app/bin/server\nExecReload=/bin/kill -HUP $MAINPID\n\nRestart=on-failure\nRestartSec=5\nStartLimitBurst=3\nStartLimitIntervalSec=60\n\nEnvironment=NODE_ENV=production\nEnvironmentFile=-/opt/app/.env\n\nStandardOutput=journal\nSyslogIdentifier=myapp\n```\n**[Service]** configures how the service starts, stops, and restarts. Choose Type= carefully — it affects how systemd determines readiness."
|
|
15
15
|
}
|
|
16
16
|
]
|
|
17
17
|
},
|
|
18
18
|
"Type": {
|
|
19
19
|
"contents": [
|
|
20
20
|
{
|
|
21
|
-
"value": "```ini\
|
|
21
|
+
"value": "```ini\n# Type=simple (default, most common)\n# Process started by ExecStart IS the main process\nType=simple\nExecStart=/usr/bin/node server.js\n\n# Type=exec (like simple, but started after exec())\n# More reliable startup detection\nType=exec\n\n# Type=forking (traditional daemons)\n# Parent forks, exits; child is the daemon\nType=forking\nPIDFile=/var/run/myapp.pid\nExecStart=/usr/sbin/mydaemon -d\n\n# Type=notify (modern services)\n# Service calls sd_notify(READY=1) when ready\nType=notify\nNotifyAccess=main\n\n# Type=oneshot (scripts, setup tasks)\n# Runs to completion, then considered started\nType=oneshot\nRemainAfterExit=yes\nExecStart=/opt/scripts/setup.sh\n```\n**Type** determines how systemd considers the service 'started'. Use `simple` for foreground processes, `forking` for traditional daemons, `notify` for sd_notify()-capable services, `oneshot` for scripts."
|
|
22
22
|
}
|
|
23
23
|
]
|
|
24
24
|
},
|
|
25
25
|
"Restart": {
|
|
26
26
|
"contents": [
|
|
27
27
|
{
|
|
28
|
-
"value": "```ini\
|
|
28
|
+
"value": "```ini\n# Restart conditions:\n# no - never restart (default)\n# always - always restart\n# on-failure - non-zero exit, signal, timeout, watchdog\n# on-abnormal - signal, timeout, watchdog (not clean non-zero)\n# on-abort - unclean signal only\n# on-watchdog - watchdog timeout only\n# on-success - clean exit (exit 0) only\n\nRestart=on-failure\nRestartSec=5 # Wait 5s before restart\n\n# Rate limiting:\nStartLimitBurst=5 # Max 5 restarts...\nStartLimitIntervalSec=60 # ...in 60 seconds\n# After limit: unit enters 'failed' state\n\n# What counts as failure:\n# Exit code != 0, killed by signal, core dump,\n# timeout, watchdog timeout\n\n# Override exit codes:\nSuccessExitStatus=143 # Treat SIGTERM exit as success\nRestartPreventExitStatus=1 # Don't restart on exit 1\nRestartForceExitStatus=SIGABRT # Always restart on SIGABRT\n```\n**Restart** policy determines when the service is automatically restarted. `on-failure` is most common. Combine with `RestartSec` and `StartLimitBurst` to prevent restart loops."
|
|
29
29
|
}
|
|
30
30
|
]
|
|
31
31
|
},
|
|
32
32
|
"Timer": {
|
|
33
33
|
"contents": [
|
|
34
34
|
{
|
|
35
|
-
"value": "```ini\n
|
|
35
|
+
"value": "```ini\n# Calendar expressions:\nOnCalendar=*-*-* 02:00:00 # Daily at 2 AM\nOnCalendar=Mon *-*-* 09:00:00 # Every Monday 9 AM\nOnCalendar=*-*-01 00:00:00 # 1st of each month\nOnCalendar=*:0/15 # Every 15 minutes\nOnCalendar=hourly # Every hour\nOnCalendar=daily # Every day at midnight\nOnCalendar=weekly # Every Monday midnight\nOnCalendar=monthly # 1st of month midnight\n\n# Monotonic timers:\nOnBootSec=5min # 5 min after boot\nOnUnitActiveSec=15min # Every 15 min (repeating)\nOnStartupSec=30s # 30s after systemd starts\n\n# Options:\nPersistent=true # Run missed events\nRandomizedDelaySec=300 # Random 0-5min delay\nAccuracySec=1s # Precision (default: 1min)\n\n# Test expressions:\n# systemd-analyze calendar '*-*-* 02:00:00'\n# systemd-analyze calendar 'Mon *-*-* 09:00:00' --iterations=5\n```\n**Timers** replace cron with more features: persistent (catch-up after downtime), randomized delay (prevent thundering herd), and monotonic schedules. Use `systemd-analyze calendar` to test expressions."
|
|
36
36
|
}
|
|
37
37
|
]
|
|
38
38
|
},
|
|
39
39
|
"Install": {
|
|
40
40
|
"contents": [
|
|
41
41
|
{
|
|
42
|
-
"value": "```ini\n[Install]\nWantedBy=multi-user.target
|
|
42
|
+
"value": "```ini\n[Install]\n# Most common — start at boot:\nWantedBy=multi-user.target\n\n# For graphical login:\nWantedBy=graphical.target\n\n# For timer units:\nWantedBy=timers.target\n\n# For socket units:\nWantedBy=sockets.target\n\n# Enable companion units together:\nAlso=myapp.socket\nAlso=myapp.timer\n\n# How it works:\n# 'systemctl enable myapp.service' creates a symlink:\n# /etc/systemd/system/multi-user.target.wants/myapp.service\n# -> /etc/systemd/system/myapp.service\n#\n# This makes the target 'want' the service,\n# so it starts automatically at boot.\n```\n**[Install]** tells systemd what happens when you `systemctl enable` a unit. `WantedBy=multi-user.target` means 'start at boot'. This section is only used by enable/disable."
|
|
43
43
|
}
|
|
44
44
|
]
|
|
45
45
|
},
|
|
46
46
|
"security": {
|
|
47
47
|
"contents": [
|
|
48
48
|
{
|
|
49
|
-
"value": "```ini\
|
|
49
|
+
"value": "```ini\n# Progressive security hardening:\n\n# Level 1: Basic isolation\nNoNewPrivileges=true\nPrivateTmp=true\nProtectHome=true\nProtectSystem=strict\nReadWritePaths=/opt/app/data\n\n# Level 2: + Kernel protection\nProtectKernelTunables=true\nProtectKernelModules=true\nProtectKernelLogs=true\nProtectControlGroups=true\nProtectHostname=true\nProtectClock=true\n\n# Level 3: + Capability dropping\nCapabilityBoundingSet=\n# CAP_NET_BIND_SERVICE for port < 1024\nAmbientCapabilities=CAP_NET_BIND_SERVICE\n\n# Level 4: + Syscall filtering\nSystemCallFilter=@system-service\nSystemCallErrorNumber=EPERM\nSystemCallArchitectures=native\n\n# Level 5: + Network restrictions\nRestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX\nRestrictNamespaces=true\nLockPersonality=true\nMemoryDenyWriteExecute=true\n\n# Audit your security:\n# systemd-analyze security myapp.service\n```\n**Security hardening** is progressive — start with basic isolation and add more restrictions. Use `systemd-analyze security` to audit your service. Score of 0-2 = good."
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
"Socket": {
|
|
54
|
+
"contents": [
|
|
55
|
+
{
|
|
56
|
+
"value": "```ini\n# myapp.socket — triggers myapp.service on connection\n[Unit]\nDescription=MyApp Socket\n\n[Socket]\n# TCP port:\nListenStream=8080\n\n# Unix socket:\nListenStream=/run/myapp.sock\nSocketUser=www-data\nSocketGroup=www-data\nSocketMode=0660\n\n# UDP:\nListenDatagram=514\n\n# Options:\nAccept=no # no: one service for all (default)\n # yes: one service per connection\nBacklog=128\nMaxConnections=256\nKeepAlive=true\nNoDelay=true\nFreeBind=true # Bind even if address not yet available\n\n[Install]\nWantedBy=sockets.target\n\n# Benefits:\n# - Service starts on first connection (lazy loading)\n# - Zero-downtime restarts (socket stays open)\n# - systemd handles socket permissions\n```\n**Socket activation** lets systemd manage the listening socket. The service starts on first connection, enabling lazy loading and zero-downtime restarts."
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
"template": {
|
|
61
|
+
"contents": [
|
|
62
|
+
{
|
|
63
|
+
"value": "```ini\n# Template unit: myapp@.service (note the @)\n# Run multiple instances with different parameters\n\n[Unit]\nDescription=MyApp on port %i\nAfter=network-online.target\n\n[Service]\nType=simple\nUser=appuser\nExecStart=/opt/myapp/bin/server --port %i\nRestart=on-failure\n\n[Install]\nWantedBy=multi-user.target\n\n# Usage:\n# systemctl start myapp@8080.service\n# systemctl start myapp@8081.service\n# systemctl enable myapp@8080.service\n\n# Specifiers in templates:\n# %i Instance name (e.g., 8080)\n# %I Unescaped instance name\n# %p Prefix (e.g., myapp)\n# %n Full name (e.g., myapp@8080.service)\n\n# List instances:\n# systemctl list-units 'myapp@*'\n```\n**Template units** (name@.service) create parameterized services. The instance name after @ is available as %i. Great for running multiple copies on different ports, configs, or users."
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
"journalctl": {
|
|
68
|
+
"contents": [
|
|
69
|
+
{
|
|
70
|
+
"value": "```bash\n# View logs for a service:\njournalctl -u myapp.service\n\n# Follow (tail) logs:\njournalctl -u myapp.service -f\n\n# Since last boot:\njournalctl -u myapp.service -b\n\n# Last 100 lines:\njournalctl -u myapp.service -n 100\n\n# Time range:\njournalctl -u myapp --since '2024-01-01' --until '2024-01-02'\njournalctl -u myapp --since '1 hour ago'\n\n# Priority filter:\njournalctl -u myapp -p err # Errors and above\njournalctl -u myapp -p warning # Warnings and above\n\n# Output formats:\njournalctl -u myapp -o json # JSON output\njournalctl -u myapp -o json-pretty # Pretty JSON\njournalctl -u myapp -o short-iso # ISO timestamps\n\n# Disk usage:\njournalctl --disk-usage\njournalctl --vacuum-size=500M # Reduce to 500MB\njournalctl --vacuum-time=30d # Keep 30 days\n```\n**journalctl** reads the systemd journal. Use `-u` for service logs, `-f` to follow, `-p` for priority filtering. JSON output is useful for log aggregation."
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
"targets": {
|
|
75
|
+
"contents": [
|
|
76
|
+
{
|
|
77
|
+
"value": "```bash\n# Common targets:\n# multi-user.target - Normal multi-user system (most services)\n# graphical.target - GUI environment\n# network.target - Network stack is up\n# network-online.target - Network is fully configured (use this!)\n# timers.target - Timer units auto-start\n# sockets.target - Socket units auto-start\n# basic.target - Basic system initialization\n# sysinit.target - System initialization\n# rescue.target - Single-user rescue mode\n# emergency.target - Emergency shell\n# shutdown.target - System is shutting down\n# reboot.target - System is rebooting\n# poweroff.target - System is powering off\n\n# Check default target:\nsystemctl get-default\n\n# Set default:\nsystemctl set-default multi-user.target\n\n# Switch target now:\nsystemctl isolate rescue.target\n\n# List all targets:\nsystemctl list-units --type=target\n```\n**Targets** are systemd's equivalent of run levels. Most services use `WantedBy=multi-user.target` (boot). Use `network-online.target` (not network.target) for services needing network."
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
"environment": {
|
|
82
|
+
"contents": [
|
|
83
|
+
{
|
|
84
|
+
"value": "```ini\n# Single variable:\nEnvironment=NODE_ENV=production\n\n# Multiple on one line (space-separated):\nEnvironment=NODE_ENV=production PORT=3000 LOG_LEVEL=info\n\n# Multiple lines:\nEnvironment=NODE_ENV=production\nEnvironment=PORT=3000\nEnvironment=DATABASE_URL=postgres://...\n\n# From file (KEY=VALUE format):\nEnvironmentFile=/opt/app/.env\nEnvironmentFile=-/opt/app/.env.local # - = ignore if missing\n\n# .env file format:\n# NODE_ENV=production\n# PORT=3000\n# # Comments allowed\n# DATABASE_URL=\"postgres://user:pass@host/db\"\n\n# Override per-instance (drop-in):\n# systemctl edit myapp.service\n# Creates: /etc/systemd/system/myapp.service.d/override.conf\n# [Service]\n# Environment=DEBUG=true\n```\n**Environment** variables can be set inline, from files, or via drop-in overrides. File format is simple KEY=VALUE. Use `-` prefix on EnvironmentFile to ignore missing files."
|
|
50
85
|
}
|
|
51
86
|
]
|
|
52
87
|
}
|
package/data/hover/zsh.json
CHANGED
|
@@ -4,56 +4,91 @@
|
|
|
4
4
|
"alias": {
|
|
5
5
|
"contents": [
|
|
6
6
|
{
|
|
7
|
-
"value": "```zsh\nalias ll='ls -
|
|
7
|
+
"value": "```zsh\n# Regular alias:\nalias ll='ls -alF'\nalias gs='git status'\nalias dc='docker compose'\n\n# Global alias (expanded anywhere in line):\nalias -g G='| grep'\nalias -g L='| less'\nalias -g NUL='> /dev/null 2>&1'\n\n# Suffix alias (run when opening file by extension):\nalias -s json='code'\nalias -s log='tail -f'\nalias -s py='python3'\n\n# Usage:\nps aux G nginx # expands to: ps aux | grep nginx\n./data.json # opens in VS Code\n```\n**alias** creates shortcuts. Regular (-r, default) replaces first word. Global (-g) expands anywhere. Suffix (-s) sets handler for file extensions."
|
|
8
8
|
}
|
|
9
9
|
]
|
|
10
10
|
},
|
|
11
11
|
"setopt": {
|
|
12
12
|
"contents": [
|
|
13
13
|
{
|
|
14
|
-
"value": "```zsh\nsetopt AUTO_CD
|
|
14
|
+
"value": "```zsh\n# Most useful options:\nsetopt AUTO_CD # Type dir name to cd\nsetopt AUTO_PUSHD # cd pushes to dir stack\nsetopt GLOB_DOTS # Include dotfiles in globs\nsetopt EXTENDED_GLOB # ^, ~, # glob operators\nsetopt NO_CASE_GLOB # Case-insensitive matching\nsetopt CORRECT # Suggest corrections\nsetopt INTERACTIVE_COMMENTS # Allow # comments\nsetopt PROMPT_SUBST # Expand variables in prompt\n\n# History options:\nsetopt SHARE_HISTORY # Sync across sessions\nsetopt HIST_IGNORE_ALL_DUPS # Remove older duplicates\nsetopt HIST_IGNORE_SPACE # Skip space-prefixed cmds\nsetopt HIST_VERIFY # Show before executing !!\n\n# Disable an option:\nunsetopt BEEP\nsetopt NO_BEEP # equivalent\n```\n**setopt** enables shell options. Options can be written NO_BEEP or NOBEEP or nobeep. Use `setopt` alone to list all enabled options."
|
|
15
15
|
}
|
|
16
16
|
]
|
|
17
17
|
},
|
|
18
18
|
"autoload": {
|
|
19
19
|
"contents": [
|
|
20
20
|
{
|
|
21
|
-
"value": "```zsh\nautoload -Uz compinit && compinit\nautoload -Uz vcs_info\nautoload -Uz add-zsh-hook\n```\n**autoload**
|
|
21
|
+
"value": "```zsh\n# Autoload marks functions for lazy loading from fpath:\nautoload -Uz compinit && compinit # Completion system\nautoload -Uz vcs_info # VCS info for prompt\nautoload -Uz add-zsh-hook # Hook management\nautoload -Uz colors && colors # Color variables\nautoload -Uz zmv # Advanced rename\nautoload -Uz zargs # xargs equivalent\nautoload -Uz zcalc # Calculator\n\n# Create your own autoloaded function:\n# 1. Create file ~/.zsh/functions/myfunc\n# 2. Write function body (no function wrapper needed)\n# 3. Add to fpath:\nfpath=(~/.zsh/functions $fpath)\nautoload -Uz myfunc\n```\n**autoload -Uz** is the standard way to load functions. `-U` suppresses alias expansion, `-z` forces zsh-style loading. Functions are loaded from `$fpath` on first call."
|
|
22
22
|
}
|
|
23
23
|
]
|
|
24
24
|
},
|
|
25
|
-
"
|
|
25
|
+
"prompt": {
|
|
26
26
|
"contents": [
|
|
27
27
|
{
|
|
28
|
-
"value": "```zsh\n#
|
|
28
|
+
"value": "```zsh\n# Prompt escape sequences:\n# %n username %m hostname\n# %~ current dir %d full path\n# %# # if root %? exit status\n# %D date %* time HH:MM:SS\n# %j number of jobs\n\n# Colors:\n# %F{red}text%f foreground color\n# %K{blue}text%k background color\n# %B bold %b %U underline %u\n\n# Examples:\nPROMPT='%F{cyan}%n%f@%F{green}%m%f:%F{yellow}%~%f %# '\nRPROMPT='%F{gray}%*%f'\n\n# Git info in prompt:\nautoload -Uz vcs_info\nprecmd() { vcs_info }\nzstyle ':vcs_info:git:*' formats '(%b)'\nsetopt PROMPT_SUBST\nPROMPT='%~ ${vcs_info_msg_0_} %# '\n```\n**PROMPT / PS1** sets the primary prompt. Use `%F{color}...%f` for colors. Enable `PROMPT_SUBST` for variable expansion in prompts."
|
|
29
29
|
}
|
|
30
30
|
]
|
|
31
31
|
},
|
|
32
32
|
"bindkey": {
|
|
33
33
|
"contents": [
|
|
34
34
|
{
|
|
35
|
-
"value": "```zsh\nbindkey '^R'
|
|
35
|
+
"value": "```zsh\n# List all bindings:\nbindkey\n\n# Emacs mode (default):\nbindkey -e\n\n# Vi mode:\nbindkey -v\n\n# Common bindings:\nbindkey '^R' history-incremental-search-backward\nbindkey '^S' history-incremental-search-forward\nbindkey '^P' up-line-or-history\nbindkey '^N' down-line-or-history\nbindkey '^A' beginning-of-line\nbindkey '^E' end-of-line\nbindkey '^K' kill-line\nbindkey '^W' backward-kill-word\nbindkey '^[[A' up-line-or-search # Up arrow\nbindkey '^[[B' down-line-or-search # Down arrow\nbindkey '^[[3~' delete-char # Delete key\n\n# Show what a key does:\nbindkey '^R'\n```\n**bindkey** maps keys to ZLE (Zsh Line Editor) widgets. Use `^X` for Ctrl+X, `^[` for Alt/Escape. `bindkey -l` lists keymaps."
|
|
36
36
|
}
|
|
37
37
|
]
|
|
38
38
|
},
|
|
39
39
|
"zstyle": {
|
|
40
40
|
"contents": [
|
|
41
41
|
{
|
|
42
|
-
"value": "```zsh\nzstyle ':completion:*' menu select\nzstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'\nzstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}\n```\n**zstyle** configures the completion system. Pattern
|
|
42
|
+
"value": "```zsh\n# Completion styling:\nzstyle ':completion:*' menu select # Tab menu\nzstyle ':completion:*' matcher-list \\ \n 'm:{a-z}={A-Z}' 'r:|[._-]=* r:|=*' # Case insensitive\nzstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} # Colorize\nzstyle ':completion:*' use-cache on # Cache completions\nzstyle ':completion:*' cache-path ~/.zsh/cache\nzstyle ':completion:*' group-name '' # Group by type\nzstyle ':completion:*:descriptions' format '%F{yellow}-- %d --%f'\nzstyle ':completion:*:warnings' format '%F{red}No matches%f'\n\n# Kill command completion:\nzstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'\nzstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cmd'\n\n# SSH host completion:\nzstyle ':completion:*:ssh:*' hosts $(awk '/^Host / {print $2}' ~/.ssh/config)\n```\n**zstyle** configures the completion system. Pattern format: `:completion:function:completer:command:argument:tag`. Incredibly powerful for customizing tab completion behavior."
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
"globbing": {
|
|
47
|
+
"contents": [
|
|
48
|
+
{
|
|
49
|
+
"value": "```zsh\n# Basic globs:\n* # Any file\n**/* # Recursive\n*.{js,ts} # Alternation\n\n# Glob qualifiers (after closing paren):\nls *(.) # Regular files only\nls *(/) # Directories only\nls *(@) # Symlinks only\nls *(*) # Executables\nls *(om) # Sort by modification time\nls *(oL) # Sort by size\nls *(Lk+100) # Files > 100KB\nls *(mh-1) # Modified in last hour\nls *(mw-1) # Modified in last week\nls *(.om[1,5]) # 5 most recent files\nls *(N) # Null glob (no error if empty)\n\n# Extended glob (setopt EXTENDED_GLOB):\nls ^*.bak # NOT matching *.bak\nls *.txt~secret* # *.txt except secret*\nls (#i)*.jpg # Case-insensitive\n```\n**Zsh globbing** is extremely powerful. Glob qualifiers filter by file type, size, date, permissions. Extended glob adds negation (^), exclusion (~), case-insensitive (#i)."
|
|
43
50
|
}
|
|
44
51
|
]
|
|
45
52
|
},
|
|
46
53
|
"history": {
|
|
47
54
|
"contents": [
|
|
48
55
|
{
|
|
49
|
-
"value": "```zsh\nHISTFILE=~/.zsh_history\nHISTSIZE=50000\nSAVEHIST=50000\nsetopt SHARE_HISTORY
|
|
56
|
+
"value": "```zsh\n# Configuration:\nHISTFILE=~/.zsh_history\nHISTSIZE=50000\nSAVEHIST=50000\n\n# Essential options:\nsetopt SHARE_HISTORY # Share between sessions\nsetopt HIST_IGNORE_ALL_DUPS # Remove older duplicate\nsetopt HIST_IGNORE_SPACE # Space prefix = private\nsetopt HIST_VERIFY # Show before executing !!\nsetopt INC_APPEND_HISTORY # Write immediately\n\n# History expansion:\n!! # Last command\n!$ # Last argument\n!^ # First argument\n!* # All arguments\n!-2 # Two commands ago\n!cmd # Last cmd starting with 'cmd'\n^old^new # Replace in last command\n\n# History search:\nbindkey '^R' history-incremental-search-backward\nbindkey '^[[A' up-line-or-search # Up arrow\n```\n**History** in zsh is highly configurable. Use `SHARE_HISTORY` for multi-session sync. Space-prefix commands are ignored with `HIST_IGNORE_SPACE`."
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
"parameter_expansion": {
|
|
61
|
+
"contents": [
|
|
62
|
+
{
|
|
63
|
+
"value": "```zsh\n# Basic:\n${var} # Value\n${#var} # Length\n${var:-default} # Default if unset\n${var:=default} # Assign default\n${var:+alt} # Alternative if set\n${var:?error} # Error if unset\n\n# Substring:\n${var:offset:len} # Substring\n${var#pat} # Remove shortest prefix\n${var##pat} # Remove longest prefix\n${var%pat} # Remove shortest suffix\n${var%%pat} # Remove longest suffix\n${var/pat/rep} # Replace first\n${var//pat/rep} # Replace all\n\n# Zsh-specific flags:\n${(U)var} # UPPERCASE\n${(L)var} # lowercase\n${(C)var} # Capitalize Words\n${(s:.:)var} # Split on '.'\n${(j:,:)arr} # Join with ','\n${(u)arr} # Unique elements\n${(o)arr} # Sort\n${(f)var} # Split on newlines\n${(F)arr} # Join with newlines\n${(k)hash} # Keys of assoc array\n${(v)hash} # Values of assoc array\n```\n**Parameter expansion** is zsh's most powerful feature. The `(flags)` syntax provides string/array transformations without external commands."
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
"completion_system": {
|
|
68
|
+
"contents": [
|
|
69
|
+
{
|
|
70
|
+
"value": "```zsh\n# Initialize:\nautoload -Uz compinit && compinit\n\n# Custom completion function:\n_myapp() {\n local -a commands\n commands=(\n 'start:Start the application'\n 'stop:Stop the application'\n 'deploy:Deploy to production'\n )\n \n _arguments \\\n '-v[Verbose output]' \\\n '-c[Config file]:config file:_files -g \"*.yml\"' \\\n '1:command:->cmd' && return\n \n case $state in\n cmd) _describe 'command' commands ;;\n esac\n}\ncompdef _myapp myapp\n\n# Useful completion functions:\n# _files - complete files\n# _directories - complete directories\n# _users - complete usernames\n# _hosts - complete hostnames\n# _describe - describe and complete from array\n# _arguments - full argument specification\n```\n**Completion system** provides intelligent tab completion. Write `_command` functions using `_arguments` for option specs and `_describe` for subcommands."
|
|
50
71
|
}
|
|
51
72
|
]
|
|
52
73
|
},
|
|
53
74
|
"oh_my_zsh": {
|
|
54
75
|
"contents": [
|
|
55
76
|
{
|
|
56
|
-
"value": "```zsh\nexport ZSH=\"$HOME/.oh-my-zsh\"\nZSH_THEME=\"robbyrussell\"\nplugins=(git docker kubectl z fzf)\nsource $ZSH/oh-my-zsh.sh\n```\n**Oh My Zsh** is a framework for managing zsh configuration.
|
|
77
|
+
"value": "```zsh\n# Install:\nsh -c \"$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)\"\n\n# Configuration in ~/.zshrc:\nexport ZSH=\"$HOME/.oh-my-zsh\"\nZSH_THEME=\"robbyrussell\" # or: agnoster, powerlevel10k\n\nplugins=(\n git # Git aliases (gst, gco, gp, gl)\n docker # Docker completions\n kubectl # k8s completions & aliases\n z # Frecency-based cd\n fzf # Fuzzy finder integration\n colored-man-pages\n command-not-found\n zsh-autosuggestions\n zsh-syntax-highlighting\n)\n\nsource $ZSH/oh-my-zsh.sh\n\n# Custom plugins: ~/.oh-my-zsh/custom/plugins/\n# Custom themes: ~/.oh-my-zsh/custom/themes/\n\n# Update: omz update\n# List plugins: ls ~/.oh-my-zsh/plugins/\n```\n**Oh My Zsh** is a framework for managing zsh configuration. 300+ plugins and 150+ themes. Use sparingly — too many plugins slow startup."
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
"zmv": {
|
|
82
|
+
"contents": [
|
|
83
|
+
{
|
|
84
|
+
"value": "```zsh\nautoload -Uz zmv\n\n# Rename with patterns:\nzmv '(*).txt' '$1.md' # .txt -> .md\nzmv '(*).JPG' '${(L)1}.jpg' # UPPERCASE -> lowercase\nzmv -W '*.jpeg' '*.jpg' # Simple wildcard rename\n\n# Complex renames:\nzmv '(**/)(*).txt' '$1${2// /_}.txt' # Replace spaces\nzmv -n '(*).log' '$1_$(date +%Y%m%d).log' # Dry run (-n)\n\n# Copy / Link variants:\nzcp '*.txt' backup/ # Copy with patterns\nzln -s '*.conf' links/ # Symlink with patterns\n```\n**zmv** is a powerful batch rename tool. Use `-n` for dry run. `-W` enables simpler wildcard syntax. Supports all zsh parameter expansion."
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
"hook_functions": {
|
|
89
|
+
"contents": [
|
|
90
|
+
{
|
|
91
|
+
"value": "```zsh\n# Hook functions run at specific times:\nprecmd() { } # Before each prompt\npreexec() { } # Before each command ($1=typed, $2=expanded)\nchpwd() { } # After directory change\nperiodic(){ } # Every $PERIOD seconds\nzshaddhistory() { } # Before adding to history\n\n# Multiple functions per hook:\nautoload -Uz add-zsh-hook\nadd-zsh-hook precmd my_precmd_1\nadd-zsh-hook precmd my_precmd_2\nadd-zsh-hook -d precmd my_precmd_1 # Remove\n\n# Example: Timer for commands\n__timer_preexec() { __timer=$EPOCHREALTIME }\n__timer_precmd() {\n [[ -n $__timer ]] || return\n local elapsed=$(( EPOCHREALTIME - __timer ))\n (( elapsed > 3 )) && printf 'Elapsed: %.2fs\\n' $elapsed\n unset __timer\n}\nadd-zsh-hook preexec __timer_preexec\nadd-zsh-hook precmd __timer_precmd\n```\n**Hook functions** execute at shell events. Use `add-zsh-hook` to register multiple handlers. `preexec` receives the command as arguments."
|
|
57
92
|
}
|
|
58
93
|
]
|
|
59
94
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enjoys/context-engine",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Comprehensive CLI command context engine with
|
|
3
|
+
"version": "1.0.7",
|
|
4
|
+
"description": "Comprehensive CLI command context engine with 135 tools — subcommands, options, examples, and runtime context detectors for intelligent terminal autocomplete",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -11,7 +11,11 @@
|
|
|
11
11
|
"types": "./index.d.ts"
|
|
12
12
|
},
|
|
13
13
|
"./commands": "./data/commands",
|
|
14
|
-
"./commands/*": "./data/commands/*"
|
|
14
|
+
"./commands/*": "./data/commands/*",
|
|
15
|
+
"./completion/*": "./data/completion/*",
|
|
16
|
+
"./defination/*": "./data/defination/*",
|
|
17
|
+
"./hover/*": "./data/hover/*",
|
|
18
|
+
"./data/*": "./data/*"
|
|
15
19
|
},
|
|
16
20
|
"files": [
|
|
17
21
|
"index.js",
|