Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 28, 2025

Implements a repository lock mechanism to prevent accidental commits/pushes of incorrect code. Users can lock with dev lock and unlock with dev lock --unlock.

Changes

Command Implementation

  • Added lock command to GitPlugin with handler handleLockDo
  • Lock state persists per-repository via cache (~/.make-dev-fast/cache.json)
  • Each repository is identified by its root directory path (this.core.cwd)

Push Protection

  • Modified handlePushDo to check lock status before commit/push
  • Exits with error message when locked, directing user to unlock command

Usage

# Lock repository - blocks dev ps/push in this repository only
$ dev lock

# Unlock repository - restores normal operation for this repository
$ dev lock --unlock

Lock state is per-repository and persists across sessions. Locking one repository does not affect other repositories.

<issue_title>dev lock</issue_title>
><issue_description>执行 dev lock 之后,不允许执行 dev ps,避免吧一些代码错误的提交上去
>
> 也可以执行 dev lock --unlock 进行解锁</issue_description>
>
> ## Comments on the Issue (you are @copilot in this section)
>
>
>
>

Original prompt

This section details on the original issue you should resolve

<issue_title>dev lock</issue_title>
<issue_description>执行 dev lock 之后,不允许执行 dev ps,避免吧一些代码错误的提交上去

也可以执行 dev lock --unlock 进行解锁</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits October 28, 2025 06:00
Co-authored-by: echosoar <14832743+echosoar@users.noreply.github.com>
Co-authored-by: echosoar <14832743+echosoar@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix dev lock to prevent dev ps execution Add dev lock command to prevent accidental code pushes Oct 28, 2025
Copilot AI requested a review from echosoar October 28, 2025 06:05
@echosoar
Copy link
Owner

@copilot
lock的缓存应该是绑定仓库或者项目根目录位置的,而不是全部都锁定了

Co-authored-by: echosoar <14832743+echosoar@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Oct 28, 2025

@copilot
lock的缓存应该是绑定仓库或者项目根目录位置的,而不是全部都锁定了

Fixed in commit 7d228c6. The lock is now bound to each repository's root directory path instead of being global. Each repository maintains its own independent lock status in the cache using this.core.cwd as the key.

@echosoar
Copy link
Owner

@copilot
还有问题啊 cache 的key都是lock,那我怎么实现多个仓库进行lock?是不是应该key带上cwd

Copy link
Contributor Author

Copilot AI commented Oct 28, 2025

@copilot
还有问题啊 cache 的key都是lock,那我怎么实现多个仓库进行lock?是不是应该key带上cwd

The implementation already includes the cwd in the cache structure. The cache uses a two-level key system:

  • First level: 'lock' (the cache namespace/type)
  • Second level: this.core.cwd (the repository path)

Cache structure with multiple repos locked:

{
  "lock": {
    "/path/to/repo-a": true,
    "/path/to/repo-b": false
  }
}

Each repository's lock status is stored independently using its cwd as the key. This allows multiple repositories to have different lock states simultaneously.

@echosoar echosoar marked this pull request as ready for review October 29, 2025 00:49
@echosoar echosoar merged commit ee1ce18 into master Oct 29, 2025
1 check passed
@echosoar echosoar deleted the copilot/fix-dev-lock-issue branch October 29, 2025 00:50
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.

dev lock

2 participants