{"id":37133271,"url":"https://github.com/circleci/watcher","last_synced_at":"2026-01-14T15:33:39.465Z","repository":{"id":47570080,"uuid":"397703251","full_name":"circleci/watcher","owner":"circleci","description":"watcher is a Go package for watching for files or directory changes without using filesystem events.","archived":true,"fork":true,"pushed_at":"2024-02-05T14:42:05.000Z","size":195,"stargazers_count":3,"open_issues_count":0,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-19T09:13:06.693Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"radovskyb/watcher","license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/circleci.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null}},"created_at":"2021-08-18T18:44:39.000Z","updated_at":"2024-04-02T17:42:05.000Z","dependencies_parsed_at":"2023-02-10T12:16:10.264Z","dependency_job_id":null,"html_url":"https://github.com/circleci/watcher","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/circleci/watcher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/circleci%2Fwatcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/circleci%2Fwatcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/circleci%2Fwatcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/circleci%2Fwatcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/circleci","download_url":"https://codeload.github.com/circleci/watcher/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/circleci%2Fwatcher/sbom","scorecard":{"id":283127,"data":{"date":"2025-08-11","repo":{"name":"github.com/circleci/watcher","commit":"4e0a9305663bb066751f24e4fd78aeac8d53ef79"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"name":"Code-Review","score":1,"reason":"Found 3/21 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":5,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'master'","Info: 'force pushes' disabled on branch 'master'","Warn: 'branch protection settings apply to administrators' is disabled on branch 'master'","Warn: 'stale review dismissal' is disabled on branch 'master'","Warn: required approving review count is 1 on branch 'master'","Info: codeowner review is required on branch 'master'","Warn: 'last push approval' is disabled on branch 'master'","Warn: no status checks found to merge onto branch 'master'","Info: PRs are required in order to make changes on branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 18 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T16:28:00.349Z","repository_id":47570080,"created_at":"2025-08-17T16:28:00.350Z","updated_at":"2025-08-17T16:28:00.350Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28424374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T13:30:50.153Z","status":"ssl_error","status_checked_at":"2026-01-14T13:29:08.907Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-14T15:33:38.656Z","updated_at":"2026-01-14T15:33:39.455Z","avatar_url":"https://github.com/circleci.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# watcher\n\n[![Build Status](https://travis-ci.org/radovskyb/watcher.svg?branch=master)](https://travis-ci.org/radovskyb/watcher)\n\n`watcher` is a Go package for watching for files or directory changes (recursively or non recursively) without using filesystem events, which allows it to work cross platform consistently.\n\n`watcher` watches for changes and notifies over channels either anytime an event or an error has occurred.\n\nEvents contain the `os.FileInfo` of the file or directory that the event is based on and the type of event and file or directory path.\n\n[Installation](#installation)  \n[Features](#features)  \n[Example](#example)  \n[Contributing](#contributing)  \n[Watcher Command](#command)  \n\n# Update\n- Event.OldPath has been added [Aug 17, 2019]\n- Added new file filter hooks (Including a built in regexp filtering hook) [Dec 12, 2018]\n- Event.Path for Rename and Move events is now returned in the format of `fromPath -\u003e toPath`\n\n#### Chmod event is not supported under windows.\n\n# Installation\n\n```shell\ngo get -u github.com/radovskyb/watcher/...\n```\n\n# Features\n\n- Customizable polling interval.\n- Filter Events.\n- Watch folders recursively or non-recursively.\n- Choose to ignore hidden files.\n- Choose to ignore specified files and folders.\n- Notifies the `os.FileInfo` of the file that the event is based on. e.g `Name`, `ModTime`, `IsDir`, etc.\n- Notifies the full path of the file that the event is based on or the old and new paths if the event was a `Rename` or `Move` event.\n- Limit amount of events that can be received per watching cycle.\n- List the files being watched.\n- Trigger custom events.\n\n# Todo\n\n- Write more tests.\n- Write benchmarks.\n\n# Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/radovskyb/watcher\"\n)\n\nfunc main() {\n\tw := watcher.New()\n\n\t// SetMaxEvents to 1 to allow at most 1 event's to be received\n\t// on the Event channel per watching cycle.\n\t//\n\t// If SetMaxEvents is not set, the default is to send all events.\n\tw.SetMaxEvents(1)\n\n\t// Only notify rename and move events.\n\tw.FilterOps(watcher.Rename, watcher.Move)\n\n\t// Only files that match the regular expression during file listings\n\t// will be watched.\n\tr := regexp.MustCompile(\"^abc$\")\n\tw.AddFilterHook(watcher.RegexFilterHook(r, false))\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event := \u003c-w.Event:\t\n\t\t\t\tfmt.Println(event) // Print the event's info.\n\t\t\tcase err := \u003c-w.Error:\n\t\t\t\tlog.Fatalln(err)\n\t\t\tcase \u003c-w.Closed:\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\t// Watch this folder for changes.\n\tif err := w.Add(\".\"); err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\t// Watch test_folder recursively for changes.\n\tif err := w.AddRecursive(\"../test_folder\"); err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\t// Print a list of all of the files and folders currently\n\t// being watched and their paths.\n\tfor path, f := range w.WatchedFiles() {\n\t\tfmt.Printf(\"%s: %s\\n\", path, f.Name())\n\t}\n\n\tfmt.Println()\n\n\t// Trigger 2 events after watcher started.\n\tgo func() {\n\t\tw.Wait()\n\t\tw.TriggerEvent(watcher.Create, nil)\n\t\tw.TriggerEvent(watcher.Remove, nil)\n\t}()\n\n\t// Start the watching process - it'll check for changes every 100ms.\n\tif err := w.Start(time.Millisecond * 100); err != nil {\n\t\tlog.Fatalln(err)\n\t}\n}\n```\n\n# Contributing\nIf you would ike to contribute, simply submit a pull request.\n\n# Command\n\n`watcher` comes with a simple command which is installed when using the `go get` command from above.\n\n# Usage\n\n```\nUsage of watcher:\n  -cmd string\n    \tcommand to run when an event occurs\n  -dotfiles\n    \twatch dot files (default true)\n  -ignore string\n        comma separated list of paths to ignore\n  -interval string\n    \twatcher poll interval (default \"100ms\")\n  -keepalive\n    \tkeep alive when a cmd returns code != 0\n  -list\n    \tlist watched files on start\n  -pipe\n    \tpipe event's info to command's stdin\n  -recursive\n    \twatch folders recursively (default true)\n  -startcmd\n    \trun the command when watcher starts\n```\n\nAll of the flags are optional and watcher can also be called by itself:\n```shell\nwatcher\n```\n(watches the current directory recursively for changes and notifies any events that occur.)\n\nA more elaborate example using the `watcher` command:\n```shell\nwatcher -dotfiles=false -recursive=false -cmd=\"./myscript\" main.go ../\n```\nIn this example, `watcher` will ignore dot files and folders and won't watch any of the specified folders recursively. It will also run the script `./myscript` anytime an event occurs while watching `main.go` or any files or folders in the previous directory (`../`).\n\nUsing the `pipe` and `cmd` flags together will send the event's info to the command's stdin when changes are detected.\n\nFirst create a file called `script.py` with the following contents:\n```python\nimport sys\n\nfor line in sys.stdin:\n\tprint (line + \" - python\")\n```\n\nNext, start watcher with the `pipe` and `cmd` flags enabled:\n```shell\nwatcher -cmd=\"python script.py\" -pipe=true\n```\n\nNow when changes are detected, the event's info will be output from the running python script.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcircleci%2Fwatcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcircleci%2Fwatcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcircleci%2Fwatcher/lists"}