Skip to content

Fix: claude init now copies required hack scripts#903

Open
vruss wants to merge 1 commit intohumanlayer:mainfrom
vruss:fix/claude-init-copy-hack-scripts
Open

Fix: claude init now copies required hack scripts#903
vruss wants to merge 1 commit intohumanlayer:mainfrom
vruss:fix/claude-init-copy-hack-scripts

Conversation

@vruss
Copy link
Copy Markdown

@vruss vruss commented Dec 8, 2025

Summary

Fixes #902

The humanlayer claude init command now copies the required hack scripts that are referenced by .claude/commands, preventing "file not found" errors when users run commands.

Changes

Added 'scripts' category to claude init

  • New option in interactive selection: "Scripts - Required hack scripts (spec_metadata.sh, create_worktree.sh)"
  • Automatically included when using --all flag

Script copying logic

  • Copies hack/spec_metadata.sh and hack/create_worktree.sh to target repo's hack/ directory
  • Makes scripts executable with chmod 0o755
  • Creates hack/ directory if it doesn't exist

.gitignore handling

  • Automatically adds copied scripts to .gitignore
  • Ensures scripts are not committed to target repo (as they come from humanlayer)

Improved output

  • Shows both .claude and hack directories when scripts are copied
  • Reports number of scripts copied

Testing

Tested with:

humanlayer claude init --all

Results:

  • ✅ Successfully copied 2 hack scripts
  • ✅ Scripts are executable
  • ✅ Scripts work correctly (verified spec_metadata.sh)
  • ✅ .gitignore entries added automatically
  • ✅ All .claude commands now work properly

Important

claudeInitCommand now copies required hack scripts, makes them executable, and updates .gitignore to prevent commit errors.

  • Behavior:
    • claudeInitCommand in init.ts now copies spec_metadata.sh and create_worktree.sh to the target repo's hack/ directory.
    • Scripts are made executable with chmod 0o755.
    • Automatically adds scripts to .gitignore to prevent them from being committed.
  • Interactive Selection:
    • Adds "Scripts" category to interactive selection and includes it in --all flag.
  • Output:
    • Logs the number of scripts copied and updates .gitignore entries.

This description was created by Ellipsis for a60bbb7. You can customize this summary. It will automatically update as commits are pushed.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Dec 8, 2025

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to a60bbb7 in 40 seconds. Click for details.
  • Reviewed 83 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. hlyr/src/commands/claude/init.ts:111
  • Draft comment:
    Including 'scripts' in the --all flag selection ensures hack scripts are always copied. This satisfies the issue requirement.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
2. hlyr/src/commands/claude/init.ts:133
  • Draft comment:
    The interactive selection now includes 'scripts' with an appropriate hint and initial value. This is good for user clarity.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
3. hlyr/src/commands/claude/init.ts:334
  • Draft comment:
    The branch for the 'scripts' category properly resolves the source hack directory and copies required scripts, including setting executable permissions. This correctly addresses the missing file issue.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
4. hlyr/src/commands/claude/init.ts:414
  • Draft comment:
    Updating .gitignore for hack scripts via ensureGitignoreEntry is a good move to prevent accidental commits of these scripts.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
5. hlyr/src/commands/claude/init.ts:348
  • Draft comment:
    Consider handling duplicate section comments in .gitignore if this command is run multiple times. It may add multiple '# Claude Code local settings' blocks.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_Mql9afreqN9I60EX

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

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.

claude init doesn't copy required hack scripts, causing commands to fail

2 participants