@kitschpatrol/snip 0.0.1

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.
Files changed (4) hide show
  1. package/bin/cli.js +128473 -0
  2. package/license.txt +23 -0
  3. package/package.json +84 -0
  4. package/readme.md +134 -0
package/license.txt ADDED
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 - 2024 Eric Mika
4
+
5
+ Based on the MIT-licensed "Snipster" project by Jared Hanstra
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
package/package.json ADDED
@@ -0,0 +1,84 @@
1
+ {
2
+ "name": "@kitschpatrol/snip",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "description": "A CLI tool for snippet management.",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/kitschpatrol/snip.git"
9
+ },
10
+ "homepage": "https://github.com/kitschpatrol/snip",
11
+ "bugs": {
12
+ "url": "https://github.com/kitschpatrol/snip/issues",
13
+ "email": "eric@ericmika.com"
14
+ },
15
+ "author": {
16
+ "name": "Eric Mika",
17
+ "email": "eric@ericmika.com",
18
+ "url": "https://ericmika.com"
19
+ },
20
+ "contributors": [
21
+ {
22
+ "name": "Original Author: Jared Hanstra",
23
+ "url": "https://github.com/jhanstra"
24
+ }
25
+ ],
26
+ "license": "MIT",
27
+ "engines": {
28
+ "node": ">=18.0.0",
29
+ "pnpm": ">=8.0.0"
30
+ },
31
+ "bin": {
32
+ "snip": "./bin/cli.js"
33
+ },
34
+ "main": "./bin/cli.js",
35
+ "files": [
36
+ "bin/*"
37
+ ],
38
+ "keywords": [
39
+ "cli",
40
+ "snippets",
41
+ "vscode"
42
+ ],
43
+ "dependencies": {
44
+ "@commander-js/extra-typings": "^12.1.0",
45
+ "commander": "^12.1.0",
46
+ "execa": "^9.1.0",
47
+ "fs-extra": "^11.2.0",
48
+ "ignore-walk": "^6.0.5",
49
+ "inquirer": "^9.2.22"
50
+ },
51
+ "devDependencies": {
52
+ "@fig/complete-commander": "^3.0.0",
53
+ "@kitschpatrol/shared-config": "^4.6.6",
54
+ "@types/fs-extra": "^11.0.4",
55
+ "@types/ignore-walk": "^4.0.3",
56
+ "@types/inquirer": "^9.0.7",
57
+ "@types/node": "^20.12.12",
58
+ "bumpp": "^9.4.1",
59
+ "chalk": "^5.3.0",
60
+ "date-fns": "^3.6.0",
61
+ "esbuild": "^0.21.4",
62
+ "node-jq": "^4.4.0",
63
+ "npm-run-all": "^4.1.5",
64
+ "tslog": "^4.9.2",
65
+ "tsx": "^4.11.0",
66
+ "typescript": "^5.4.5",
67
+ "vitest": "^1.6.0",
68
+ "zod": "^3.23.8"
69
+ },
70
+ "publishConfig": {
71
+ "access": "public"
72
+ },
73
+ "scripts": {
74
+ "build": "tsx ./scripts/build-cli.ts",
75
+ "fig:generate": "npm run build && NODE_ENV=development node bin/cli.js generate-fig-spec > /tmp/snip.ts && npx @fig/publish-spec -p /tmp/snip.ts && rm /tmp/snip.ts",
76
+ "fix": "pnpm shared-config --fix",
77
+ "lint": "pnpm shared-config --lint",
78
+ "prebuild": "jq '{command: .bin | keys[], version, description}' package.json > ./src/generated/package-info.json",
79
+ "release": "pnpm run build && pnpm bumpp --commit 'Release: %s' && pnpm publish --otp $(op read 'op://Personal/Npmjs/one-time password?attribute=otp')",
80
+ "start": "node ./bin/cli.js",
81
+ "test": "vitest",
82
+ "update-language-data": "tsx ./scripts/update-vscode-language-data.ts"
83
+ }
84
+ }
package/readme.md ADDED
@@ -0,0 +1,134 @@
1
+ <!--+ Warning: Content inside HTML comment blocks was generated by mdat and may be overwritten. +-->
2
+
3
+ <!-- title -->
4
+
5
+ # @kitschpatrol/snip
6
+
7
+ <!-- /title -->
8
+
9
+ <!-- badges -->
10
+
11
+ [![NPM Package @kitschpatrol/snip](https://img.shields.io/npm/v/@kitschpatrol/snip.svg)](https://npmjs.com/package/@kitschpatrol/snip)
12
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
13
+
14
+ <!-- /badges -->
15
+
16
+ <!-- short-description -->
17
+
18
+ **A CLI tool for snippet management.**
19
+
20
+ <!-- /short-description -->
21
+
22
+ > \[!CAUTION]
23
+ > This tool is a work in progress, certain commands are not yet implemented and
24
+ > others might behave unpredictably. I don't recommend using it until a 1.0.0
25
+ > release.
26
+
27
+ ## Overview
28
+
29
+ Snip helps you create, edit, manage, and synchronize code snippets from the command line. Synchronize to (and possibly eventually from) editors like VSCode.
30
+
31
+ Snip is a fork of [Jared Hanstra](https://github.com/jhanstra)'s [snipster](https://github.com/jhanstra/snipster). Snip includes both some [additions](#background) and some [regressions](#the-future) vs. the original.
32
+
33
+ ## Getting started
34
+
35
+ ### Dependencies
36
+
37
+ The `snip` CLI tool requires Node 18+.
38
+
39
+ ### Installation
40
+
41
+ Install globally for access across your system:
42
+
43
+ ```sh
44
+ npm install --global @kitschpatrol/snip
45
+ ```
46
+
47
+ ## Usage
48
+
49
+ TK
50
+
51
+ ### CLI
52
+
53
+ <!-- cli-help -->
54
+
55
+ ```txt
56
+ Usage: snip [options] [command]
57
+
58
+ A CLI tool for snippet management.
59
+
60
+ Options:
61
+ -v, --version output the version number
62
+ -c, --config <path> path to configuration file (default:
63
+ "/Users/mika/.config/snip/config.json", env:
64
+ SNIP_CONFIG_FILE)
65
+ -l, --library <path> path to library directory where snippets are
66
+ stored (default: "/Users/mika/.snip", env:
67
+ SNIP_LIBRARY_DIR)
68
+ -d, --debug extra logging for troubleshooting (default:
69
+ false, env: SNIP_DEBUG)
70
+ -h, --help display help for command
71
+
72
+ Commands:
73
+ add [filename] add a snippet
74
+ cd launch a shell in the snippets directory
75
+ list list all snippets
76
+ setup set up snip
77
+ sync-to-editors [editors...] sync snippets to editors
78
+ sync-from-editors [editors...] sync snippets from editors (not yet
79
+ implemented)
80
+ help [command] display help for command
81
+ ```
82
+
83
+ <!-- /cli-help -->
84
+
85
+ #### Examples
86
+
87
+ TK
88
+
89
+ ## Background
90
+
91
+ Snip is a fork of [Jared Hanstra](https://github.com/jhanstra)'s [snipster](https://github.com/jhanstra/snipster).
92
+
93
+ Modifications include:
94
+
95
+ - A monosyllabic name 😅.
96
+ - Migration from JavaScript → TypeScript + Zod.
97
+ - Migration from CommonJS → ES Modules.
98
+ - Migration from Yarn → PNPM.
99
+ - Added `.ignore` file support.
100
+ - Added `$EDITOR` support for creating new snippets.
101
+ - Added support for `~` in paths.
102
+ - Implemented a new automated language ID aggregation approach based on scraping plugin manifests from the VSCode marketplace.
103
+ - Added support for snippet descriptions — stored in the snippet file name itself.
104
+
105
+ ## The future
106
+
107
+ - [ ] Figure out what to do about [Fig integration](https://github.com/withfig/autocomplete-tools/blob/main/integrations/commander/README.md>).
108
+ - [ ] Additional editor adapters
109
+ - [ ] Sync-from-editor migration fixes
110
+ - [ ] Cosmiconfig
111
+
112
+ ## Maintainers
113
+
114
+ [@kitschpatrol](https://github.com/kitschpatrol)
115
+
116
+ ## Acknowledgements
117
+
118
+ [Jared Hanstra](https://github.com/jhanstra) is the author of the original [snipster](https://github.com/jhanstra/snipster) project on which Snip is based.
119
+
120
+ <!-- contributing -->
121
+
122
+ ## Contributing
123
+
124
+ [Issues](https://github.com/kitschpatrol/snip/issues) and pull requests are welcome.
125
+
126
+ <!-- /contributing -->
127
+
128
+ <!-- license -->
129
+
130
+ ## License
131
+
132
+ [MIT](license.txt) © Eric Mika
133
+
134
+ <!-- /license -->