Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.go text eol=lf
61 changes: 61 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Verify and package

on: [push, pull_request]

permissions:
contents: read

env:
CGO_ENABLED: '0'
GOTOOLCHAIN: local

jobs:
verify:
name: Native verification (${{ matrix.os }})
runs-on: ${{ matrix.os }}
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, windows-2025, macos-15]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
with:
go-version: '1.27.4'
cache-dependency-path: go.sum
- name: Verify native CLI
shell: pwsh
run: ./scripts/verify.ps1
- name: Scan Go dependencies
if: runner.os == 'Linux'
run: go run golang.org/x/vuln/cmd/[email protected] ./...
- name: Scan Git history for secrets
if: runner.os == 'Linux'
run: go run github.com/zricethezav/gitleaks/[email protected] git --redact --no-banner .

package:
name: Package binaries
needs: verify
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
with:
go-version: '1.27.4'
cache-dependency-path: go.sum
- name: Build packages
shell: pwsh
run: ./scripts/package.ps1
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: dct-packages
path: dist/dct-*/*
if-no-files-found: error
retention-days: 7
8 changes: 4 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# AGENTS.md — Engineering Mastery project policy

You are working on ONE ORIGINAL implementation project inside the user's F: workspace.
Work directly in the current VS Code Codex session on this original project inside the user's F: workspace. Keep the workspace manifest and progress report current.

## Scope and ethics
- Never access, rewrite, delete or search outside the active project directory.
- Reference products are inspiration, not source-copy instructions. Respect licenses, IP and trademarks.
- No employer-owned source, production secrets, private personal data or real customer records.
- Security testing must use only local authorized fixtures. No external target testing.
- Do not provision paid cloud services, purchase assets, publish publicly, or rotate credentials.
- Do not push/merge to GitHub; a separate gated runner or the human handles these actions.
- Do not push or merge to GitHub from the IDE. A separately authorized private GitHub workflow or the human handles remote operations.

## Engineering behavior
- Inspect existing code, tests, current git status and decisions first.
- Maintain README.md, docs/TASKS.md, docs/EVIDENCE.md and PROJECT_STATE.json.
- One small, valuable, unblocked feature or repair per invocation. Prefer correctness to velocity.
- Complete one small, verifiable milestone at a time and continue while the IDE session and daily budget permit.
- Produce real runnable code; use reproducible synthetic fixtures and test first where sensible.
- Every nontrivial public API needs contract and misuse tests. Document decisions with ADRs.
- Create scripts/verify.ps1 with REAL nontrivial checks. Never make it an always-success shim.
- Run all project checks you can. Mark a test as not run if missing tools; do not claim passing.
- Commit only actual completed changes, with one logical purpose per commit. No empty/vanity commits.
- Record test output and any honest limitations in docs/EVIDENCE.md.
- If blocked, record why and what exact human action is necessary.
- Set PROJECT_STATE.json.status to review only if MVP works and verification passes.
- Set `PROJECT_STATE.json` status to `release_review` after the working MVP, required verification, and release materials are complete. Wait for explicit user acceptance before recording completion or advancing the queue.
- End each invocation with a short summary: modified files, commits, tests, next task, blockers.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Changelog

## 0.1.0 — Release candidate

- Search UTF-8 text recursively for a case-sensitive literal.
- Inspect regular files and report their relative paths and byte sizes.
- Filter either command by repeatable suffixes and emit newline-delimited JSON.
- Return documented exit codes for matches, empty results, and failures.
- Build archives for Windows amd64, Linux amd64, and macOS arm64 with SHA-256 checksums and dependency notices.
- Keep Go sources in LF format during Git checkout so native Windows formatting verification sees the same source bytes as Linux and macOS.

Native CI passed on Windows, Linux, and macOS. The packaging job uploaded all three target archives, and a Windows executable extracted from the verified hosted package passed a synthetic CLI smoke check. See `docs/RELEASE_EVIDENCE.md` in the source repository for the exact commit, verification coverage, and review items.
17 changes: 13 additions & 4 deletions PROJECT_STATE.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{
"next_action": "Create specification and first executable test",
"status": "in_progress",
"blocker": null,
"verified": false
"next_action": "Await explicit user acceptance of the A02 release review",
"status": "release_review",
"blocker": null,
"evidence": "docs/RELEASE_EVIDENCE.md",
"candidate_version": "0.1.0",
"verified_implementation_commit": "482ebacf9d2dcc940c1e6931652b49610dee797a",
"verified_release_source_commit": "1d41dcc0184a7fad5e09e1e7c9ee6cefc37dd930",
"verified_ci_run": 44523796632,
"verified_release_artifact": 14528472864,
"verified_release_sha256": "2261c04556de25eb3d793d1b1da5ebc716171ccf450ec944d841d20652ef7fa1",
"verified_windows": true,
"verified_hosted_linux_macos": true,
"verified": true
}
88 changes: 84 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,90 @@
# Developer CLI Toolkit

Reference: ripgrep — https://github.com/BurntSushi/ripgrep
`dct` searches workspace text for a literal and lists regular files with their byte sizes. Both commands produce sorted, relative paths and can emit newline-delimited JSON (NDJSON) for scripts.

Original MVP: Build a fast file-search and workspace-inspection CLI with filters, JSON output and error codes.
The original Go/Cobra implementation takes inspiration from the recursive search and file filters in [ripgrep](https://github.com/BurntSushi/ripgrep). `dct` includes hidden files, uses case-sensitive literal matching, and applies only explicit suffix filters. Its scope and performance goals are defined by the [v0.1 contract](docs/SPEC.md).

Proof: Cross-platform integration tests, binary packaging and sample workflows.
## Install the 0.1.0 candidate

See docs/TASKS.md for work items.
Use the `dct-packages` bundle from CI run `44523796632` at source commit `1d41dcc0184a7fad5e09e1e7c9ee6cefc37dd930`. GitHub listed November 26, 2026 at 13:27:23 CET as the download expiration. The outer archive, the three target ZIPs, and `SHA256SUMS.txt` are retained privately in `dist/hosted-44523796632/` in the original workspace. [Private artifact 14528472864](https://github.com/soroushneyestani/developer-cli-toolkit/actions/runs/44523796632/artifacts/14528472864)

Compare the outer ZIP's SHA-256 with the digest in the release evidence. From the extracted bundle directory, compare `SHA256SUMS.txt` with the checked-in manifest and verify the three target ZIPs before choosing the archive for your platform. The candidate packages are unsigned. [Release evidence](docs/RELEASE_EVIDENCE.md) · [Pinned SHA-256 manifest](docs/RELEASE_SHA256SUMS.txt)

| Target | Archive | Executable |
| --- | --- | --- |
| Windows amd64 | `dct-windows-amd64.zip` | `dct.exe` |
| Linux amd64 | `dct-linux-amd64.zip` | `dct` |
| macOS arm64 | `dct-darwin-arm64.zip` | `dct` |

```powershell
Get-Content SHA256SUMS.txt | ForEach-Object {
$expected, $name = $_ -split '\s+', 2
$actual = (Get-FileHash -LiteralPath $name -Algorithm SHA256).Hash
if ($actual -ine $expected) { throw "Checksum mismatch for $name" }
}
Expand-Archive -LiteralPath dct-windows-amd64.zip -DestinationPath dct-windows
.\dct-windows\dct.exe --version
```

On Linux, verify with `sha256sum -c SHA256SUMS.txt`. On macOS, use `shasum -a 256 -c SHA256SUMS.txt`. Extract the target ZIP, set its run permission with `chmod +x dct` if needed, and run `./dct --version`. The packaged executable runs without a local Go installation.

## Build and verify

Use Go 1.26 or newer. Use Go 1.27.4 to match the verified native CI and packaging toolchain.

```powershell
powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/verify.ps1
```

The verifier checks formatting, module integrity, vet, tests, and the native build. It writes `bin/dct.exe` on Windows and `bin/dct` on Linux and macOS. Use `pwsh -NoProfile -File scripts/verify.ps1` with PowerShell 7.

Git checks out Go sources with LF endings on every platform so `gofmt` sees the same source bytes on Windows and Unix.

## Usage

```text
dct search <literal> [root] [--ext <suffix>]... [--json]
dct inspect [root] [--ext <suffix>]... [--json]
dct --help
dct --version
```

`root` defaults to the current directory. Put any flags before `--` when passing a literal or a path that starts with `-`. Repeat `--ext` to include files matching any supplied suffix. Suffixes are case-sensitive, start with a dot, and may contain multiple dots.

Search emits one record per matching line and skips files containing NUL or invalid UTF-8. Inspect includes all regular files that pass the suffix filter. Both commands skip symlink entries and reject symlink roots.

| Exit code | Meaning |
| --- | --- |
| 0 | Search found matches, or inspection succeeded. |
| 1 | Search completed with no matches. |
| 2 | Invalid invocation, filesystem failure, or output failure. Diagnostics go to stderr. |

Check the exit code before treating output as complete. Errors may follow partial results.

## Sample workflow

In PowerShell from the project directory, create a synthetic workspace and run the built binary.

```powershell
$demo = Join-Path (Get-Location).Path ('bin/dct-demo-' + [guid]::NewGuid().ToString('N'))
New-Item -ItemType Directory -Path $demo | Out-Null
[IO.File]::WriteAllBytes((Join-Path $demo 'notes.txt'), [Text.Encoding]::ASCII.GetBytes("TODO: review the change`n"))
.\bin\dct.exe search TODO $demo --ext .txt --json
# {"path":"notes.txt","line":1,"text":"TODO: review the change"}
.\bin\dct.exe inspect $demo --json
# {"path":"notes.txt","bytes":24}
```

Use NDJSON when paths or contents can contain output delimiters. Read it one line at a time and decode each record independently.

## Packaging

Run `pwsh -NoProfile -File scripts/package.ps1` with Go 1.27.4. On Windows PowerShell, use `powershell.exe -NoProfile -ExecutionPolicy Bypass -File scripts/package.ps1`. A successful run creates a directory under `dist/` with ZIP archives for Linux amd64, Windows amd64, and macOS arm64, plus `SHA256SUMS.txt`. Verify each archive's SHA-256 before extraction. On a Unix host, run `chmod +x dct` if the extracted binary lacks the execute bit.

The [CI workflow](.github/workflows/ci.yml) runs native integration tests and builds on Windows, Linux and macOS, and makes archive upload depend on those jobs. The [release evidence](docs/RELEASE_EVIDENCE.md) records the tested commit, checksum results, and what ran on each platform.

## Architecture and limits

`main.go` parses commands with Cobra, renders output and maps errors to exit codes. `workspace.go` scopes filesystem access to the opened directory, sorts relative paths, and checks each search file before matching its lines. Memory usage grows with the number of selected paths and the size of the largest searched file. Results describe a live filesystem, so keep the tree stable for reproducible output. On Unix, filenames with invalid UTF-8 bytes are represented with replacement characters in JSON. Search takes its literal and root from command arguments. Regex matching, stdin search, ignore-file rules and numeric performance targets are outside the 0.1.0 contract.

See the [Persian tutorial](docs/LEARNING_FA.md), [technical article](docs/WEBSITE_EN.md), [design decisions](docs/adr/), [test evidence](docs/EVIDENCE.md), and [third-party notices](THIRD_PARTY_NOTICES.md).
25 changes: 25 additions & 0 deletions REVIEW_INDEX.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# A02 Developer CLI Toolkit v0.1.0 review index

A02 is in `release_review`. The implementation, tests, and review documents follow their repository paths in the review ZIP. Extract the whole archive into one directory and open this file to follow the relative links offline.

## Documentation

- [README](README.md) covers setup, installation, and command examples.
- [Changelog](CHANGELOG.md) describes the v0.1.0 changes.
- [Persian learning guide](docs/LEARNING_FA.md), [English portfolio article](docs/WEBSITE_EN.md), and [English Instagram copy](docs/INSTAGRAM_EN.md) are ready for content review.
- [Project state](PROJECT_STATE.json) records the release review status. [Project tasks](docs/TASKS.md) record the outstanding approval.

## Implementation and verification

- [CLI specification](docs/SPEC.md), [CLI contract decision](docs/adr/0001-cli-contract.md), and [workspace I/O decision](docs/adr/0002-workspace-io.md) explain the implemented behavior.
- [Command entry points](main.go) and [workspace traversal, search, and inspection](workspace.go) contain the implementation.
- [Search integration tests](search_test.go), [inspection and options integration tests](options_test.go), and [Windows sharing-violation test](search_windows_test.go) exercise the executable.
- [Test summary](docs/TEST_SUMMARY.md), [release evidence](docs/RELEASE_EVIDENCE.md), and [verification history](docs/EVIDENCE.md) record the checked results and their scope.
- [Local verifier](scripts/verify.ps1), [packaging script](scripts/package.ps1), and [GitHub Actions workflow](.github/workflows/ci.yml) define the runnable checks.
- [Release SHA-256 manifest](docs/RELEASE_SHA256SUMS.txt) lists the three distribution archive digests. [Third-party notices](THIRD_PARTY_NOTICES.md) identify their redistributed components.

## Release candidate package

The v0.1.0 binary candidate comes from run `44523796632` at `1d41dcc0184a7fad5e09e1e7c9ee6cefc37dd930` on `codex/a02`. The link to the artifact requires repository access and is subject to GitHub Actions retention. [Private candidate CI run](https://github.com/soroushneyestani/developer-cli-toolkit/actions/runs/44523796632) · [Private candidate artifact 14528472864](https://github.com/soroushneyestani/developer-cli-toolkit/actions/runs/44523796632/artifacts/14528472864) · [Private draft PR #1](https://github.com/soroushneyestani/developer-cli-toolkit/pull/1)

In the extracted review ZIP, `artifacts/dct-packages.zip` is the preserved copy of the candidate artifact. Its outer digest is recorded in the [test summary](docs/TEST_SUMMARY.md). Extract it into a separate directory to see the three target ZIPs and their bundled checksum manifest. The review ZIP also includes `SOURCE_OVERVIEW.md`, `RELEASE_CHECKLIST.md`, `REVIEW_PACKAGE_CHANGES.md`, and saved CI metadata and verification output for offline review.
10 changes: 10 additions & 0 deletions THIRD_PARTY_NOTICES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Third-party notices

The command uses the Go standard library and runtime and these Go modules. Redistributed binaries should be accompanied by this notice and the license texts in `licenses/`.

| Component | Version | License |
| --- | --- | --- |
| [Go runtime and standard library](https://github.com/golang/go/tree/go1.27.4) | 1.27.4 in packaged builds | [BSD 3-Clause](licenses/go.txt) |
| [Cobra](https://github.com/spf13/cobra/tree/v1.10.2) | 1.10.2 | [Apache 2.0](licenses/cobra.txt) |
| [pflag](https://github.com/spf13/pflag/tree/v1.0.9) | 1.0.9 | [BSD 3-Clause](licenses/pflag.txt) |
| [mousetrap](https://github.com/inconshreveable/mousetrap/tree/v1.1.0) | 1.1.0 | [Apache 2.0](licenses/mousetrap.txt) |
Loading
Loading