{"id":25793775,"url":"https://github.com/krymtkts/snippetpredictor","last_synced_at":"2026-04-11T21:02:42.360Z","repository":{"id":276956496,"uuid":"930122043","full_name":"krymtkts/SnippetPredictor","owner":"krymtkts","description":"A command-line predictor written in F# that suggests code snippets based on the input. This module requires PowerShell 7.2 or higher and PSReadLine 2.2.2. or higher.","archived":false,"fork":false,"pushed_at":"2026-03-14T23:29:59.000Z","size":557,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-15T09:29:13.784Z","etag":null,"topics":["command-line-predictor","fsharp","powershell","powershell-module"],"latest_commit_sha":null,"homepage":"https://www.powershellgallery.com/packages/SnippetPredictor/","language":"F#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/krymtkts.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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-10T05:26:49.000Z","updated_at":"2026-03-14T23:30:02.000Z","dependencies_parsed_at":"2025-02-26T12:26:53.587Z","dependency_job_id":"2e743b6c-d259-401e-bdd7-3dd91823b0e6","html_url":"https://github.com/krymtkts/SnippetPredictor","commit_stats":null,"previous_names":["krymtkts/snippetpredictor"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/krymtkts/SnippetPredictor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krymtkts%2FSnippetPredictor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krymtkts%2FSnippetPredictor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krymtkts%2FSnippetPredictor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krymtkts%2FSnippetPredictor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krymtkts","download_url":"https://codeload.github.com/krymtkts/SnippetPredictor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krymtkts%2FSnippetPredictor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31695165,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-11T20:18:30.949Z","status":"ssl_error","status_checked_at":"2026-04-11T20:18:29.982Z","response_time":54,"last_error":"SSL_read: 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":["command-line-predictor","fsharp","powershell","powershell-module"],"created_at":"2025-02-27T13:38:59.781Z","updated_at":"2026-04-11T21:02:42.355Z","avatar_url":"https://github.com/krymtkts.png","language":"F#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SnippetPredictor\n\n[![PowerShell Gallery](https://img.shields.io/powershellgallery/v/SnippetPredictor)](https://www.powershellgallery.com/packages/SnippetPredictor)\n[![PowerShell Gallery](https://img.shields.io/powershellgallery/dt/SnippetPredictor)](https://www.powershellgallery.com/packages/SnippetPredictor)\n![Test main status](https://github.com/krymtkts/SnippetPredictor/actions/workflows/main.yml/badge.svg)\n[![codecov](https://codecov.io/gh/krymtkts/SnippetPredictor/graph/badge.svg?token=7HA9NC8PHT)](https://codecov.io/gh/krymtkts/SnippetPredictor)\n![Top Language](https://img.shields.io/github/languages/top/krymtkts/SnippetPredictor?color=%23b845fc)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\nSnippetPredictor is a command-line predictor written in F#. It suggests code snippets based on the input.\nThis module requires PowerShell 7.2 and PSReadLine 2.2.2.\n\nThis project builds upon the following article:\n\n[How to create a command-line predictor - PowerShell | Microsoft Learn](https://learn.microsoft.com/en-us/powershell/scripting/dev-cross-plat/create-cmdline-predictor?view=powershell-7.4)\n\n## Installation\n\nInstall SnippetPredictor from the PowerShell Gallery:\n\n[PowerShell Gallery | SnippetPredictor](https://www.powershellgallery.com/packages/SnippetPredictor/)\n\n```powershell\n# Recommended: PSResourceGet (PowerShellGet 3.0)\nInstall-PSResource -Name SnippetPredictor\n\n# Alternatively, if you are using PowerShellGet 2.x:\nInstall-Module -Name SnippetPredictor\n```\n\nBefore using SnippetPredictor, ensure that your PowerShell `PredictionSource` equals `HistoryAndPlugin`[^1]:\n\n```powershell\n# PredictionSource = HistoryAndPlugin required.\nGet-PSReadLineOption | Select-Object PredictionSource\n#\n# PredictionSource\n# ----------------\n# HistoryAndPlugin\n```\n\n[^1]: [Using predictors in PSReadLine - PowerShell | Microsoft Learn](https://learn.microsoft.com/en-us/powershell/scripting/learn/shell/using-predictors?view=powershell-7.4#managing-predictive-intellisense)\n\nImport the SnippetPredictor module and verify that the predictor loads:\n\n```powershell\nImport-Module SnippetPredictor\n\n# Confirm SnippetPredictor(Snippet) loaded.\nGet-PSSubsystem -Kind CommandPredictor\n#\n# Kind              SubsystemType      IsRegistered Implementations\n# ----              -------------      ------------ ---------------\n# CommandPredictor  ICommandPredictor          True {Snippet, Windows Package Manager - WinGet}\n```\n\nSet the prediction view style to `ListView`[^2]:\n\n```powershell\nSet-PSReadLineOption -PredictionViewStyle ListView\n```\n\n[^2]: [Using predictors in PSReadLine - PowerShell | Microsoft Learn](https://learn.microsoft.com/en-us/powershell/scripting/learn/shell/using-predictors?view=powershell-7.4#using-other-predictor-plug-ins)\n\n## Cmdlet help\n\nRefer to the following documents for detailed cmdlet help:\n\n- [`Add-Snippet.md`](./docs/SnippetPredictor/Add-Snippet.md)\n- [`Get-Snippet.md`](./docs/SnippetPredictor/Get-Snippet.md)\n- [`Remove-Snippet.md`](./docs/SnippetPredictor/Remove-Snippet.md)\n\n## Usage\n\nFirst, set up your `~/.snippet-predictor.json` file.\nThe easiest way to do this is to run the `Add-Snippet` command:\n\n```powershell\nAdd-Snippet \"echo 'hello'\" -Tooltip 'say hello' -Group 'greeting'\n```\n\nThis will create a file with the following content.\nYou can also create the file manually if you prefer.\n\n```json\n{\n  \"Snippets\": [\n    {\n      \"Snippet\": \"echo 'hello'\",\n      \"Tooltip\": \"say hello.\",\n      \"Group\": \"greeting\"\n    }\n  ]\n}\n```\n\nFilter snippets in your `~/.snippet-predictor.json` file using the following keywords:\n\n- Use `:snp {input}` to search for `{input}` in the `Snippet` field.\n- Use `:tip {input}` to search for `{input}` in the `Tooltip` field.\n- Use `:{group} {input}` to search for `{input}` in the `Snippet` field for snippets in a specified `Group`.\n  - Allowed characters for the `Group` field: `^[a-zA-Z0-9]+$`.\n    (Group names must consist of alphanumeric characters.)\n  - Typing `:` or a partial group name (e.g., `:p`) suggests matching groups like `:pwsh`.\n\nBy default, the predictor searches snippets in a case-insensitive manner.\nTo enable case-sensitive search, set `SearchCaseSensitive` to `true` in `.snippet-predictor.json`.\nThe default value is `false`.\n\nYou can list your registered snippets with the `Get-Snippet` command.\n\nTo remove a snippet, use the `Remove-Snippet` command.\n\n```powershell\nRemove-Snippet \"echo 'hello'\"\n```\n\nYou can also delete it directly from `~/.snippet-predictor.json`.\n\nBy combining `Get-Snippet` and `Remove-Snippet`, you can remove snippets that match a specific pattern. Perform this in one step:\n\n```powershell\nGet-Snippet | Where-Object -Property Tooltip -like *test* | Remove-Snippet\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrymtkts%2Fsnippetpredictor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrymtkts%2Fsnippetpredictor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrymtkts%2Fsnippetpredictor/lists"}