Skip to content

feat: clipboard import + bash/fish shell support#6

Merged
matinsaurralde merged 3 commits into
masterfrom
feat/clipboard-import-shell-support
Mar 13, 2026
Merged

feat: clipboard import + bash/fish shell support#6
matinsaurralde merged 3 commits into
masterfrom
feat/clipboard-import-shell-support

Conversation

@matinsaurralde

Copy link
Copy Markdown
Owner

Clipboard import: mem import with no file reads from the system clipboard, auto-detects JSON/markdown format and group name, and confirms before importing. The -g flag overrides the detected name.

Shell hooks: mem init bash and mem init fish now emit working hooks instead of the "coming in v1.5" error. Bash uses trap DEBUG + PROMPT_COMMAND; fish uses the native fish_postexec event.

Refactors import_from_json/markdown into string-based _str variants that return (detected_name, commands), with the file-based functions as thin wrappers.

Clipboard import: `mem import` with no file reads from the system
clipboard, auto-detects JSON/markdown format and group name, and
confirms before importing. The -g flag overrides the detected name.

Shell hooks: `mem init bash` and `mem init fish` now emit working
hooks instead of the "coming in v1.5" error. Bash uses trap DEBUG +
PROMPT_COMMAND; fish uses the native fish_postexec event.

Refactors import_from_json/markdown into string-based _str variants
that return (detected_name, commands), with the file-based functions
as thin wrappers.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 023ed9ca49

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread hooks/mem.bash Outdated
_mem_debug_trap() {
if [[ -z "$_mem_capturing" && -n "$BASH_COMMAND" ]]; then
_mem_capturing=1
_mem_cmd="$(HISTTIMEFORMAT= history 1 | sed 's/^[ ]*[0-9]*[ ]*//')"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Capture actual command instead of relying on history entry

Using history 1 here records the last persisted history item rather than the command that just triggered DEBUG, so in common Bash setups like HISTCONTROL=ignorespace/HISTIGNORE (or when history is disabled) the hook stores a stale previous command. I reproduced this in an interactive Bash session: running a leading-space command resulted in the prior command being captured again, which corrupts mem history and downstream pattern extraction.

Useful? React with 👍 / 👎.

history 1 returns the last persisted history entry, not the command
that triggered DEBUG. With HISTCONTROL=ignorespace or HISTIGNORE,
it silently captures a stale previous command. $BASH_COMMAND is
always the actual command being executed. Trade-off: pipelines
(a | b | c) capture only the first simple command.
13 importable runbooks across 6 categories:
- security: recon, headers-audit, ssl-audit
- devops: docker-cleanup, k8s-debug, incident-response
- git: forensics, cleanup
- networking: network-debug, dns-debug
- performance: system-profile
- databases: postgres-debug, redis-ops

All use $VARIABLES for mem run integration and are in
mem export format for clipboard import.
@matinsaurralde
matinsaurralde merged commit dfcf166 into master Mar 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant