Skip to content

Commit d9032e9

Browse files
authored
Merge pull request #20 from ngallodev/sync/upstream-step5
Sync upstream step 5: merge 84 new upstream commits (96c3f41..268a9d8) into the CLI fork
2 parents b770042 + b64cf42 commit d9032e9

126 files changed

Lines changed: 15754 additions & 1535 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/codeql.yml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
run: sudo apt-get update && sudo apt-get install -y zlib1g-dev
3030

3131
- name: Initialize CodeQL
32-
uses: github/codeql-action/init@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4.38.0
32+
uses: github/codeql-action/init@1c5b675653bb5c22dbe9b12b556ec555138e09fd # v4.38.1
3333
with:
3434
languages: c-cpp
3535
build-mode: manual
@@ -38,6 +38,6 @@ jobs:
3838
run: scripts/build.sh
3939

4040
- name: Perform CodeQL Analysis
41-
uses: github/codeql-action/analyze@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4.38.0
41+
uses: github/codeql-action/analyze@1c5b675653bb5c22dbe9b12b556ec555138e09fd # v4.38.1
4242
with:
4343
category: "/language:c-cpp"

‎.github/workflows/scorecard.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ jobs:
2727
publish_results: true
2828

2929
- name: Upload SARIF results
30-
uses: github/codeql-action/upload-sarif@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4
30+
uses: github/codeql-action/upload-sarif@1c5b675653bb5c22dbe9b12b556ec555138e09fd # v4
3131
with:
3232
sarif_file: results.sarif

‎Makefile.cbm‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ FOUNDATION_SRCS = \
341341
EXTRACTION_SRCS = \
342342
$(CBM_DIR)/cbm.c \
343343
$(CBM_DIR)/extract_defs.c \
344+
$(CBM_DIR)/callable_sig.c \
344345
$(CBM_DIR)/extract_calls.c \
345346
$(CBM_DIR)/extract_imports.c \
346347
$(CBM_DIR)/extract_usages.c \
@@ -438,6 +439,7 @@ PIPELINE_SRCS = \
438439
src/pipeline/lsp_surface.c \
439440
src/pipeline/pipeline_delta.c \
440441
src/pipeline/path_alias.c \
442+
src/pipeline/laravel_routing.c \
441443
src/pipeline/registry.c \
442444
src/pipeline/pipeline.c \
443445
src/pipeline/pipeline_incremental.c \
@@ -637,6 +639,7 @@ TEST_FOUNDATION_OBJS = $(patsubst %.c,$(BUILD_DIR)/%.test.o,$(TEST_FOUNDATION_SR
637639

638640
TEST_EXTRACTION_SRCS = \
639641
tests/test_extraction.c \
642+
tests/test_callable_sig.c \
640643
tests/test_extraction_inheritance.c \
641644
tests/test_extraction_imports.c \
642645
tests/test_parse_coverage.c \

‎README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,3 +337,5 @@ See [`SECURITY.md`](SECURITY.md) and [`docs/SECURITY-DISCLOSURE.md`](docs/SECURI
337337
## License and upstream attribution
338338

339339
MIT. The root [`LICENSE`](LICENSE) preserves the upstream `Copyright (c) 2025 DeusData` notice. See [`UPSTREAM_ATTRIBUTION.md`](UPSTREAM_ATTRIBUTION.md) for the explicit distinction between inherited DeusData work and modifications made in this fork.
340+
341+
Uninstall keeps project indexes by default, including with `--yes`, `--no`, or noninteractive input. Use `--delete-indexes` to remove them explicitly; `--dry-run` previews the changes.

‎docs/CONFIGURATION.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ Current keys:
8888
| `auto_index` | `false` | Permit the retained warm runtime to auto-index newly encountered projects. Canonical CLI usage can always index explicitly with `codebase-memory-cli index`. |
8989
| `auto_index_limit` | `50000` | Maximum file count allowed for automatic indexing of a new project. |
9090
| `auto_watch` | `true` | Register an active project with the retained background watcher when a warm runtime/hook integration supplies project context. The ordinary one-shot CLI does not require this. |
91+
| `watch_non_git` | `false` | Poll non-Git roots with the indexer discovery rules and an adaptive file-tree scan. Skipped paths, including `.codebase-memory/`, do not trigger indexing. The first poll after daemon startup reindexes once; later changes trigger one reindex. This walks the whole tree each poll and is read when the daemon starts. |
9192
| `watcher_enabled` | `true` | Master switch for the retained background watcher subsystem. Set `false` to stop its poll thread/project registration. Reindex manually with `codebase-memory-cli index` when disabled. |
9293
| `index_max_files` | `off` | Optional maximum number of accepted source files in one discovery run. |
9394
| `index_max_source_mb` | `off` | Optional maximum accepted source size in MiB in one discovery run. |

‎install.ps1‎

Lines changed: 84 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -320,81 +320,102 @@ try {
320320

321321
$Dest = Join-Path $InstallDir $BinName
322322

323-
# Retire the running installation before replacing it. Windows keeps an image
324-
# lock on a running .exe: the file cannot be overwritten, but it CAN be renamed
325-
# out of the way, which is what makes an in-place update possible from here.
326-
if (Test-Path -LiteralPath $Dest -PathType Leaf) {
327-
try { & $Dest daemon stop 2>&1 | Out-Null } catch { }
328-
$retired = "$Dest.retired-$(Get-Date -Format yyyyMMddHHmmss)"
329-
$renamed = $false
330-
foreach ($attempt in 1..10) {
331-
try { Move-Item -LiteralPath $Dest -Destination $retired -Force -ErrorAction Stop; $renamed = $true; break }
332-
catch { Start-Sleep -Milliseconds 500 }
323+
$retired = $null
324+
$ActivationSucceeded = $false
325+
try {
326+
# Retire the running installation before replacing it. Windows keeps an image
327+
# lock on a running .exe: the file cannot be overwritten, but it CAN be renamed
328+
# out of the way, which is what makes an in-place update possible from here.
329+
if (Test-Path -LiteralPath $Dest -PathType Leaf) {
330+
try { & $Dest daemon stop 2>&1 | Out-Null } catch { }
331+
$retired = "$Dest.retired-$([Guid]::NewGuid().ToString('N'))"
332+
$renamed = $false
333+
foreach ($attempt in 1..10) {
334+
try { Move-Item -LiteralPath $Dest -Destination $retired -ErrorAction Stop; $renamed = $true; break }
335+
catch { Start-Sleep -Milliseconds 500 }
336+
}
337+
if (-not $renamed) {
338+
Write-Host "error: could not retire the existing $BinName - close all running" -ForegroundColor Red
339+
Write-Host " codebase-memory-cli sessions and coding agents, then re-run." -ForegroundColor Red
340+
Remove-Item -Recurse -Force $TmpDir -ErrorAction SilentlyContinue
341+
exit 1
342+
}
343+
# Keep the old image until activation and the installed-binary probe succeed.
333344
}
334-
if (-not $renamed) {
335-
Write-Host "error: could not retire the existing $BinName - close all running" -ForegroundColor Red
336-
Write-Host " codebase-memory-cli sessions and coding agents, then re-run." -ForegroundColor Red
345+
346+
$InstallArgs = @("install", "-y", "--force", "--dir=$InstallDir")
347+
if ($SkipConfig) { $InstallArgs += "--skip-config" }
348+
& $DownloadedBinary @InstallArgs
349+
if ($LASTEXITCODE -ne 0) {
350+
Write-Host "error: installation failed (exit code $LASTEXITCODE)" -ForegroundColor Red
337351
Remove-Item -Recurse -Force $TmpDir -ErrorAction SilentlyContinue
338352
exit 1
339353
}
340-
# A retired image stays locked until its last process exits; delete it when
341-
# we can, and leave it for the next run when we cannot. Never fail here.
342-
Remove-Item -LiteralPath $retired -Force -ErrorAction SilentlyContinue
343-
}
344-
Get-ChildItem -LiteralPath $InstallDir -Filter "$BinName.retired-*" -ErrorAction SilentlyContinue |
345-
ForEach-Object { Remove-Item -LiteralPath $_.FullName -Force -ErrorAction SilentlyContinue }
346354

347-
$InstallArgs = @("install", "-y", "--force", "--dir=$InstallDir")
348-
if ($SkipConfig) { $InstallArgs += "--skip-config" }
349-
& $DownloadedBinary @InstallArgs
350-
if ($LASTEXITCODE -ne 0) {
351-
Write-Host "error: installation failed (exit code $LASTEXITCODE)" -ForegroundColor Red
352-
Remove-Item -Recurse -Force $TmpDir -ErrorAction SilentlyContinue
353-
exit 1
354-
}
355+
# Place the installer beside the binary so `update` points at a local file
356+
# rather than a URL, and so the next update runs THIS release's installer.
357+
#
358+
# Sourced from the archive we just checksum-verified, and published by rename
359+
# rather than written over the live path. PowerShell parses a script fully
360+
# before executing it, so self-overwrite is less hazardous here than it is for
361+
# bash -- but rename costs nothing and keeps both platforms on one rule.
362+
# Best effort: a failure here still leaves a working install.
363+
$DownloadedInstaller = Join-Path $TmpDir "install.ps1"
364+
if (Test-Path -LiteralPath $DownloadedInstaller -PathType Leaf) {
365+
$InstallerDest = Join-Path $InstallDir "install.ps1"
366+
$InstallerTmp = "$InstallerDest.new"
367+
try {
368+
Copy-Item -LiteralPath $DownloadedInstaller -Destination $InstallerTmp -Force -ErrorAction Stop
369+
Move-Item -LiteralPath $InstallerTmp -Destination $InstallerDest -Force -ErrorAction Stop
370+
Write-Host "Installed updater -> $InstallerDest"
371+
} catch {
372+
Remove-Item -LiteralPath $InstallerTmp -Force -ErrorAction SilentlyContinue
373+
Write-Host "note: could not place install.ps1 in $InstallDir (update will explain where to find it)"
374+
}
375+
}
355376

356-
# Place the installer beside the binary so `update` points at a local file
357-
# rather than a URL, and so the next update runs THIS release's installer.
358-
#
359-
# Sourced from the archive we just checksum-verified, and published by rename
360-
# rather than written over the live path. PowerShell parses a script fully
361-
# before executing it, so self-overwrite is less hazardous here than it is for
362-
# bash -- but rename costs nothing and keeps both platforms on one rule.
363-
# Best effort: a failure here still leaves a working install.
364-
$DownloadedInstaller = Join-Path $TmpDir "install.ps1"
365-
if (Test-Path -LiteralPath $DownloadedInstaller -PathType Leaf) {
366-
$InstallerDest = Join-Path $InstallDir "install.ps1"
367-
$InstallerTmp = "$InstallerDest.new"
377+
# Verify
378+
# Same PS 5.1 stderr-wrapping guard as the candidate probe above; the pre-seed
379+
# matters MOST here, because prior successful native calls leave a stale
380+
# $LASTEXITCODE=0 that a start-failure would otherwise inherit.
368381
try {
369-
Copy-Item -LiteralPath $DownloadedInstaller -Destination $InstallerTmp -Force -ErrorAction Stop
370-
Move-Item -LiteralPath $InstallerTmp -Destination $InstallerDest -Force -ErrorAction Stop
371-
Write-Host "Installed updater -> $InstallerDest"
382+
$ProbeEap = $ErrorActionPreference
383+
try {
384+
$ErrorActionPreference = "Continue"
385+
$global:LASTEXITCODE = 1
386+
$ver = & $Dest --version 2>&1
387+
} finally {
388+
$ErrorActionPreference = $ProbeEap
389+
}
390+
if ($LASTEXITCODE -ne 0) { throw "installed binary exited with $LASTEXITCODE" }
391+
Write-Host "Installed: $ver"
372392
} catch {
373-
Remove-Item -LiteralPath $InstallerTmp -Force -ErrorAction SilentlyContinue
374-
Write-Host "note: could not place install.ps1 in $InstallDir (update will explain where to find it)"
393+
Write-Host "error: installed binary failed to run" -ForegroundColor Red
394+
Remove-Item -Recurse -Force $TmpDir
395+
exit 1
375396
}
376-
}
377397

378-
# Verify
379-
# Same PS 5.1 stderr-wrapping guard as the candidate probe above; the pre-seed
380-
# matters MOST here, because prior successful native calls leave a stale
381-
# $LASTEXITCODE=0 that a start-failure would otherwise inherit.
382-
try {
383-
$ProbeEap = $ErrorActionPreference
384-
try {
385-
$ErrorActionPreference = "Continue"
386-
$global:LASTEXITCODE = 1
387-
$ver = & $Dest --version 2>&1
388-
} finally {
389-
$ErrorActionPreference = $ProbeEap
398+
$ActivationSucceeded = $true
399+
} finally {
400+
if (-not $ActivationSucceeded -and $retired -and
401+
(Test-Path -LiteralPath $retired -PathType Leaf)) {
402+
if (-not (Test-Path -LiteralPath $Dest)) {
403+
try {
404+
Move-Item -LiteralPath $retired -Destination $Dest -ErrorAction Stop
405+
} catch {
406+
Write-Host "error: could not restore $Dest; previous binary retained at $retired : $_" -ForegroundColor Red
407+
}
408+
} else {
409+
# The inner activation may deliberately retain a published candidate
410+
# after partial config/PATH changes. Do not override that decision or
411+
# overwrite an unexpected path entry outside its activation lease.
412+
Write-Host "note: keeping the published executable; previous binary retained at $retired"
413+
}
390414
}
391-
if ($LASTEXITCODE -ne 0) { throw "installed binary exited with $LASTEXITCODE" }
392-
Write-Host "Installed: $ver"
393-
} catch {
394-
Write-Host "error: installed binary failed to run" -ForegroundColor Red
395-
Remove-Item -Recurse -Force $TmpDir
396-
exit 1
397415
}
416+
# Retired images are disposable only after the replacement has been verified.
417+
Get-ChildItem -LiteralPath $InstallDir -Filter "$BinName.retired-*" -ErrorAction SilentlyContinue |
418+
ForEach-Object { Remove-Item -LiteralPath $_.FullName -Force -ErrorAction SilentlyContinue }
398419

399420
# Agent configuration was included in the candidate-owned activation window.
400421
if ($SkipConfig) {

0 commit comments

Comments
 (0)