pinokiod 5.0.3 → 5.0.5

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/aside ADDED
File without changes
@@ -1498,9 +1498,14 @@ class Api {
1498
1498
  // let keypath = path.resolve(this.kernel.homedir, "key.json")
1499
1499
  // this.kernel.keys = (await this.loader.load(keypath)).resolved
1500
1500
 
1501
- // ensure gitconfig carries required defaults before any shell commands run
1502
- if (this.kernel.git && typeof this.kernel.git.ensureDefaults === "function") {
1503
- await this.kernel.git.ensureDefaults()
1501
+ // ensure gitconfig defaults and clear stale git locks before any shell commands run
1502
+ if (this.kernel.git) {
1503
+ if (typeof this.kernel.git.ensureDefaults === "function") {
1504
+ await this.kernel.git.ensureDefaults()
1505
+ }
1506
+ if (typeof this.kernel.git.clearStaleLock === "function") {
1507
+ await this.kernel.git.clearStaleLock()
1508
+ }
1504
1509
  }
1505
1510
  // init shell before running just to make sure the environment variables are fresh
1506
1511
  await this.kernel.shell.init()
package/kernel/git.js CHANGED
@@ -105,6 +105,22 @@ class Git {
105
105
  await fs.promises.writeFile(gitconfigPath, ini.stringify(config))
106
106
  }
107
107
  }
108
+ async clearStaleLock(homeOverride) {
109
+ const home = homeOverride || this.kernel.homedir
110
+ if (!home) return
111
+ const lockPath = path.resolve(home, ".git", "index.lock")
112
+ try {
113
+ await fs.promises.access(lockPath, fs.constants.F_OK)
114
+ } catch (_) {
115
+ return
116
+ }
117
+ // best-effort: if no other git op is active, remove the stale lock
118
+ try {
119
+ await fs.promises.unlink(lockPath)
120
+ } catch (_) {
121
+ // ignore
122
+ }
123
+ }
108
124
  async findGitDirs(dir, results = []) {
109
125
  const entries = await fs.promises.readdir(dir, { withFileTypes: true });
110
126
  for (const entry of entries) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "5.0.3",
3
+ "version": "5.0.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -216,7 +216,7 @@ body.dark .appcanvas > aside {
216
216
  .appcanvas > aside .menu-container {
217
217
  display: flex;
218
218
  flex-direction: row;
219
- align-items: stretch;
219
+ align-items: center;
220
220
  gap: 6px;
221
221
  padding: 0;
222
222
  overflow-x: auto;
@@ -7484,9 +7484,12 @@ const rerenderMenuSection = (container, html) => {
7484
7484
  fileItemsArray.forEach(item => {
7485
7485
  item.addEventListener('click', async (event) => {
7486
7486
  const targetIsCheckbox = event.target && event.target.hasAttribute && event.target.hasAttribute('data-file-checkbox')
7487
+ if (!targetIsCheckbox) {
7488
+ event.preventDefault()
7489
+ event.stopPropagation()
7490
+ }
7487
7491
  const index = Number(item.getAttribute('data-index') || '-1')
7488
7492
  if (!targetIsCheckbox) {
7489
- // Preview only
7490
7493
  lastSelectedIndex = index
7491
7494
  await renderFileDiff(item)
7492
7495
  return
@@ -8035,7 +8038,9 @@ const rerenderMenuSection = (container, html) => {
8035
8038
  }
8036
8039
 
8037
8040
  fileItems.forEach(item => {
8038
- item.addEventListener('click', async () => {
8041
+ item.addEventListener('click', async (event) => {
8042
+ event.preventDefault()
8043
+ event.stopPropagation()
8039
8044
  // Remove active class from all items
8040
8045
  fileItems.forEach(i => i.classList.remove('pinokio-active-file-item'))
8041
8046
  // Add active class to clicked item