@entelligentsia/forgecli 0.9.1 → 0.9.3

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 (121) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/CHANGELOG-pi.md +14 -19
  3. package/dist/bin/update-cli.js +1 -1
  4. package/dist/bin/update-cli.js.map +1 -1
  5. package/dist/extensions/forgecli/forge-update-command.d.ts +3 -1
  6. package/dist/extensions/forgecli/forge-update-command.js +48 -18
  7. package/dist/extensions/forgecli/forge-update-command.js.map +1 -1
  8. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.d.ts.map +1 -1
  9. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js +6 -1
  10. package/node_modules/@earendil-works/pi-agent-core/dist/harness/env/nodejs.js.map +1 -1
  11. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.d.ts.map +1 -1
  12. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js +2 -0
  13. package/node_modules/@earendil-works/pi-agent-core/dist/harness/utils/truncate.js.map +1 -1
  14. package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
  15. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +15 -0
  16. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts.map +1 -1
  17. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +15 -0
  18. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js.map +1 -1
  19. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +80 -0
  20. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
  21. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +20 -0
  22. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -1
  23. package/node_modules/@earendil-works/pi-ai/package.json +1 -1
  24. package/node_modules/@earendil-works/pi-coding-agent/CHANGELOG.md +14 -19
  25. package/node_modules/@earendil-works/pi-coding-agent/dist/cli.d.ts.map +1 -1
  26. package/node_modules/@earendil-works/pi-coding-agent/dist/cli.js +3 -3
  27. package/node_modules/@earendil-works/pi-coding-agent/dist/cli.js.map +1 -1
  28. package/node_modules/@earendil-works/pi-coding-agent/dist/config.d.ts.map +1 -1
  29. package/node_modules/@earendil-works/pi-coding-agent/dist/config.js +35 -27
  30. package/node_modules/@earendil-works/pi-coding-agent/dist/config.js.map +1 -1
  31. package/node_modules/@earendil-works/pi-coding-agent/dist/core/export-html/template.js +17 -3
  32. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -1
  33. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js +4 -8
  34. package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js.map +1 -1
  35. package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.d.ts.map +1 -1
  36. package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.js +3 -2
  37. package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.js.map +1 -1
  38. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.d.ts.map +1 -1
  39. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js +1 -0
  40. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js.map +1 -1
  41. package/node_modules/@earendil-works/pi-coding-agent/dist/main.d.ts.map +1 -1
  42. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js +5 -1
  43. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js.map +1 -1
  44. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  45. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/extension-editor.js +14 -6
  46. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/extension-editor.js.map +1 -1
  47. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  48. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +13 -6
  49. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  50. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/dark.json +5 -4
  51. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/light.json +5 -4
  52. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +21 -2
  53. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  54. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js +82 -40
  55. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
  56. package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.d.ts.map +1 -1
  57. package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.js +22 -5
  58. package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.js.map +1 -1
  59. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/child-process.d.ts +5 -8
  60. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/child-process.d.ts.map +1 -1
  61. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/child-process.js +8 -59
  62. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/child-process.js.map +1 -1
  63. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/shell.d.ts.map +1 -1
  64. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/shell.js +6 -1
  65. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/shell.js.map +1 -1
  66. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/windows-self-update.d.ts +3 -0
  67. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/windows-self-update.d.ts.map +1 -0
  68. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/windows-self-update.js +77 -0
  69. package/node_modules/@earendil-works/pi-coding-agent/dist/utils/windows-self-update.js.map +1 -0
  70. package/node_modules/@earendil-works/pi-coding-agent/docs/index.md +8 -0
  71. package/node_modules/@earendil-works/pi-coding-agent/docs/packages.md +2 -0
  72. package/node_modules/@earendil-works/pi-coding-agent/docs/quickstart.md +20 -0
  73. package/node_modules/@earendil-works/pi-coding-agent/docs/usage.md +2 -0
  74. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package.json +1 -1
  75. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  76. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package.json +1 -1
  77. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/README.md +3 -0
  78. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/subagent/index.ts +41 -19
  79. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package.json +1 -1
  80. package/node_modules/@earendil-works/pi-coding-agent/package.json +6 -4
  81. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -1
  82. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +3 -4
  83. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -1
  84. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  85. package/node_modules/cross-spawn/LICENSE +21 -0
  86. package/node_modules/cross-spawn/README.md +89 -0
  87. package/node_modules/cross-spawn/index.js +39 -0
  88. package/node_modules/cross-spawn/lib/enoent.js +59 -0
  89. package/node_modules/cross-spawn/lib/parse.js +91 -0
  90. package/node_modules/cross-spawn/lib/util/escape.js +47 -0
  91. package/node_modules/cross-spawn/lib/util/readShebang.js +23 -0
  92. package/node_modules/cross-spawn/lib/util/resolveCommand.js +52 -0
  93. package/node_modules/cross-spawn/package.json +73 -0
  94. package/node_modules/isexe/.npmignore +2 -0
  95. package/node_modules/isexe/LICENSE +15 -0
  96. package/node_modules/isexe/README.md +51 -0
  97. package/node_modules/isexe/index.js +57 -0
  98. package/node_modules/isexe/mode.js +41 -0
  99. package/node_modules/isexe/package.json +31 -0
  100. package/node_modules/isexe/test/basic.js +221 -0
  101. package/node_modules/isexe/windows.js +42 -0
  102. package/node_modules/path-key/index.d.ts +40 -0
  103. package/node_modules/path-key/index.js +16 -0
  104. package/node_modules/path-key/license +9 -0
  105. package/node_modules/path-key/package.json +39 -0
  106. package/node_modules/path-key/readme.md +61 -0
  107. package/node_modules/shebang-command/index.js +19 -0
  108. package/node_modules/shebang-command/license +9 -0
  109. package/node_modules/shebang-command/package.json +34 -0
  110. package/node_modules/shebang-command/readme.md +34 -0
  111. package/node_modules/shebang-regex/index.d.ts +22 -0
  112. package/node_modules/shebang-regex/index.js +2 -0
  113. package/node_modules/shebang-regex/license +9 -0
  114. package/node_modules/shebang-regex/package.json +35 -0
  115. package/node_modules/shebang-regex/readme.md +33 -0
  116. package/node_modules/which/LICENSE +15 -0
  117. package/node_modules/which/README.md +54 -0
  118. package/node_modules/which/bin/node-which +52 -0
  119. package/node_modules/which/package.json +43 -0
  120. package/node_modules/which/which.js +125 -0
  121. package/package.json +6 -6
@@ -0,0 +1,221 @@
1
+ var t = require('tap')
2
+ var fs = require('fs')
3
+ var path = require('path')
4
+ var fixture = path.resolve(__dirname, 'fixtures')
5
+ var meow = fixture + '/meow.cat'
6
+ var mine = fixture + '/mine.cat'
7
+ var ours = fixture + '/ours.cat'
8
+ var fail = fixture + '/fail.false'
9
+ var noent = fixture + '/enoent.exe'
10
+ var mkdirp = require('mkdirp')
11
+ var rimraf = require('rimraf')
12
+
13
+ var isWindows = process.platform === 'win32'
14
+ var hasAccess = typeof fs.access === 'function'
15
+ var winSkip = isWindows && 'windows'
16
+ var accessSkip = !hasAccess && 'no fs.access function'
17
+ var hasPromise = typeof Promise === 'function'
18
+ var promiseSkip = !hasPromise && 'no global Promise'
19
+
20
+ function reset () {
21
+ delete require.cache[require.resolve('../')]
22
+ return require('../')
23
+ }
24
+
25
+ t.test('setup fixtures', function (t) {
26
+ rimraf.sync(fixture)
27
+ mkdirp.sync(fixture)
28
+ fs.writeFileSync(meow, '#!/usr/bin/env cat\nmeow\n')
29
+ fs.chmodSync(meow, parseInt('0755', 8))
30
+ fs.writeFileSync(fail, '#!/usr/bin/env false\n')
31
+ fs.chmodSync(fail, parseInt('0644', 8))
32
+ fs.writeFileSync(mine, '#!/usr/bin/env cat\nmine\n')
33
+ fs.chmodSync(mine, parseInt('0744', 8))
34
+ fs.writeFileSync(ours, '#!/usr/bin/env cat\nours\n')
35
+ fs.chmodSync(ours, parseInt('0754', 8))
36
+ t.end()
37
+ })
38
+
39
+ t.test('promise', { skip: promiseSkip }, function (t) {
40
+ var isexe = reset()
41
+ t.test('meow async', function (t) {
42
+ isexe(meow).then(function (is) {
43
+ t.ok(is)
44
+ t.end()
45
+ })
46
+ })
47
+ t.test('fail async', function (t) {
48
+ isexe(fail).then(function (is) {
49
+ t.notOk(is)
50
+ t.end()
51
+ })
52
+ })
53
+ t.test('noent async', function (t) {
54
+ isexe(noent).catch(function (er) {
55
+ t.ok(er)
56
+ t.end()
57
+ })
58
+ })
59
+ t.test('noent ignore async', function (t) {
60
+ isexe(noent, { ignoreErrors: true }).then(function (is) {
61
+ t.notOk(is)
62
+ t.end()
63
+ })
64
+ })
65
+ t.end()
66
+ })
67
+
68
+ t.test('no promise', function (t) {
69
+ global.Promise = null
70
+ var isexe = reset()
71
+ t.throws('try to meow a promise', function () {
72
+ isexe(meow)
73
+ })
74
+ t.end()
75
+ })
76
+
77
+ t.test('access', { skip: accessSkip || winSkip }, function (t) {
78
+ runTest(t)
79
+ })
80
+
81
+ t.test('mode', { skip: winSkip }, function (t) {
82
+ delete fs.access
83
+ delete fs.accessSync
84
+ var isexe = reset()
85
+ t.ok(isexe.sync(ours, { uid: 0, gid: 0 }))
86
+ t.ok(isexe.sync(mine, { uid: 0, gid: 0 }))
87
+ runTest(t)
88
+ })
89
+
90
+ t.test('windows', function (t) {
91
+ global.TESTING_WINDOWS = true
92
+ var pathExt = '.EXE;.CAT;.CMD;.COM'
93
+ t.test('pathExt option', function (t) {
94
+ runTest(t, { pathExt: '.EXE;.CAT;.CMD;.COM' })
95
+ })
96
+ t.test('pathExt env', function (t) {
97
+ process.env.PATHEXT = pathExt
98
+ runTest(t)
99
+ })
100
+ t.test('no pathExt', function (t) {
101
+ // with a pathExt of '', any filename is fine.
102
+ // so the "fail" one would still pass.
103
+ runTest(t, { pathExt: '', skipFail: true })
104
+ })
105
+ t.test('pathext with empty entry', function (t) {
106
+ // with a pathExt of '', any filename is fine.
107
+ // so the "fail" one would still pass.
108
+ runTest(t, { pathExt: ';' + pathExt, skipFail: true })
109
+ })
110
+ t.end()
111
+ })
112
+
113
+ t.test('cleanup', function (t) {
114
+ rimraf.sync(fixture)
115
+ t.end()
116
+ })
117
+
118
+ function runTest (t, options) {
119
+ var isexe = reset()
120
+
121
+ var optionsIgnore = Object.create(options || {})
122
+ optionsIgnore.ignoreErrors = true
123
+
124
+ if (!options || !options.skipFail) {
125
+ t.notOk(isexe.sync(fail, options))
126
+ }
127
+ t.notOk(isexe.sync(noent, optionsIgnore))
128
+ if (!options) {
129
+ t.ok(isexe.sync(meow))
130
+ } else {
131
+ t.ok(isexe.sync(meow, options))
132
+ }
133
+
134
+ t.ok(isexe.sync(mine, options))
135
+ t.ok(isexe.sync(ours, options))
136
+ t.throws(function () {
137
+ isexe.sync(noent, options)
138
+ })
139
+
140
+ t.test('meow async', function (t) {
141
+ if (!options) {
142
+ isexe(meow, function (er, is) {
143
+ if (er) {
144
+ throw er
145
+ }
146
+ t.ok(is)
147
+ t.end()
148
+ })
149
+ } else {
150
+ isexe(meow, options, function (er, is) {
151
+ if (er) {
152
+ throw er
153
+ }
154
+ t.ok(is)
155
+ t.end()
156
+ })
157
+ }
158
+ })
159
+
160
+ t.test('mine async', function (t) {
161
+ isexe(mine, options, function (er, is) {
162
+ if (er) {
163
+ throw er
164
+ }
165
+ t.ok(is)
166
+ t.end()
167
+ })
168
+ })
169
+
170
+ t.test('ours async', function (t) {
171
+ isexe(ours, options, function (er, is) {
172
+ if (er) {
173
+ throw er
174
+ }
175
+ t.ok(is)
176
+ t.end()
177
+ })
178
+ })
179
+
180
+ if (!options || !options.skipFail) {
181
+ t.test('fail async', function (t) {
182
+ isexe(fail, options, function (er, is) {
183
+ if (er) {
184
+ throw er
185
+ }
186
+ t.notOk(is)
187
+ t.end()
188
+ })
189
+ })
190
+ }
191
+
192
+ t.test('noent async', function (t) {
193
+ isexe(noent, options, function (er, is) {
194
+ t.ok(er)
195
+ t.notOk(is)
196
+ t.end()
197
+ })
198
+ })
199
+
200
+ t.test('noent ignore async', function (t) {
201
+ isexe(noent, optionsIgnore, function (er, is) {
202
+ if (er) {
203
+ throw er
204
+ }
205
+ t.notOk(is)
206
+ t.end()
207
+ })
208
+ })
209
+
210
+ t.test('directory is not executable', function (t) {
211
+ isexe(__dirname, options, function (er, is) {
212
+ if (er) {
213
+ throw er
214
+ }
215
+ t.notOk(is)
216
+ t.end()
217
+ })
218
+ })
219
+
220
+ t.end()
221
+ }
@@ -0,0 +1,42 @@
1
+ module.exports = isexe
2
+ isexe.sync = sync
3
+
4
+ var fs = require('fs')
5
+
6
+ function checkPathExt (path, options) {
7
+ var pathext = options.pathExt !== undefined ?
8
+ options.pathExt : process.env.PATHEXT
9
+
10
+ if (!pathext) {
11
+ return true
12
+ }
13
+
14
+ pathext = pathext.split(';')
15
+ if (pathext.indexOf('') !== -1) {
16
+ return true
17
+ }
18
+ for (var i = 0; i < pathext.length; i++) {
19
+ var p = pathext[i].toLowerCase()
20
+ if (p && path.substr(-p.length).toLowerCase() === p) {
21
+ return true
22
+ }
23
+ }
24
+ return false
25
+ }
26
+
27
+ function checkStat (stat, path, options) {
28
+ if (!stat.isSymbolicLink() && !stat.isFile()) {
29
+ return false
30
+ }
31
+ return checkPathExt(path, options)
32
+ }
33
+
34
+ function isexe (path, options, cb) {
35
+ fs.stat(path, function (er, stat) {
36
+ cb(er, er ? false : checkStat(stat, path, options))
37
+ })
38
+ }
39
+
40
+ function sync (path, options) {
41
+ return checkStat(fs.statSync(path), path, options)
42
+ }
@@ -0,0 +1,40 @@
1
+ /// <reference types="node" />
2
+
3
+ declare namespace pathKey {
4
+ interface Options {
5
+ /**
6
+ Use a custom environment variables object. Default: [`process.env`](https://nodejs.org/api/process.html#process_process_env).
7
+ */
8
+ readonly env?: {[key: string]: string | undefined};
9
+
10
+ /**
11
+ Get the PATH key for a specific platform. Default: [`process.platform`](https://nodejs.org/api/process.html#process_process_platform).
12
+ */
13
+ readonly platform?: NodeJS.Platform;
14
+ }
15
+ }
16
+
17
+ declare const pathKey: {
18
+ /**
19
+ Get the [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable key cross-platform.
20
+
21
+ @example
22
+ ```
23
+ import pathKey = require('path-key');
24
+
25
+ const key = pathKey();
26
+ //=> 'PATH'
27
+
28
+ const PATH = process.env[key];
29
+ //=> '/usr/local/bin:/usr/bin:/bin'
30
+ ```
31
+ */
32
+ (options?: pathKey.Options): string;
33
+
34
+ // TODO: Remove this for the next major release, refactor the whole definition to:
35
+ // declare function pathKey(options?: pathKey.Options): string;
36
+ // export = pathKey;
37
+ default: typeof pathKey;
38
+ };
39
+
40
+ export = pathKey;
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ const pathKey = (options = {}) => {
4
+ const environment = options.env || process.env;
5
+ const platform = options.platform || process.platform;
6
+
7
+ if (platform !== 'win32') {
8
+ return 'PATH';
9
+ }
10
+
11
+ return Object.keys(environment).reverse().find(key => key.toUpperCase() === 'PATH') || 'Path';
12
+ };
13
+
14
+ module.exports = pathKey;
15
+ // TODO: Remove this for the next major release
16
+ module.exports.default = pathKey;
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "path-key",
3
+ "version": "3.1.1",
4
+ "description": "Get the PATH environment variable key cross-platform",
5
+ "license": "MIT",
6
+ "repository": "sindresorhus/path-key",
7
+ "author": {
8
+ "name": "Sindre Sorhus",
9
+ "email": "sindresorhus@gmail.com",
10
+ "url": "sindresorhus.com"
11
+ },
12
+ "engines": {
13
+ "node": ">=8"
14
+ },
15
+ "scripts": {
16
+ "test": "xo && ava && tsd"
17
+ },
18
+ "files": [
19
+ "index.js",
20
+ "index.d.ts"
21
+ ],
22
+ "keywords": [
23
+ "path",
24
+ "key",
25
+ "environment",
26
+ "env",
27
+ "variable",
28
+ "var",
29
+ "get",
30
+ "cross-platform",
31
+ "windows"
32
+ ],
33
+ "devDependencies": {
34
+ "@types/node": "^11.13.0",
35
+ "ava": "^1.4.1",
36
+ "tsd": "^0.7.2",
37
+ "xo": "^0.24.0"
38
+ }
39
+ }
@@ -0,0 +1,61 @@
1
+ # path-key [![Build Status](https://travis-ci.org/sindresorhus/path-key.svg?branch=master)](https://travis-ci.org/sindresorhus/path-key)
2
+
3
+ > Get the [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) environment variable key cross-platform
4
+
5
+ It's usually `PATH`, but on Windows it can be any casing like `Path`...
6
+
7
+
8
+ ## Install
9
+
10
+ ```
11
+ $ npm install path-key
12
+ ```
13
+
14
+
15
+ ## Usage
16
+
17
+ ```js
18
+ const pathKey = require('path-key');
19
+
20
+ const key = pathKey();
21
+ //=> 'PATH'
22
+
23
+ const PATH = process.env[key];
24
+ //=> '/usr/local/bin:/usr/bin:/bin'
25
+ ```
26
+
27
+
28
+ ## API
29
+
30
+ ### pathKey(options?)
31
+
32
+ #### options
33
+
34
+ Type: `object`
35
+
36
+ ##### env
37
+
38
+ Type: `object`<br>
39
+ Default: [`process.env`](https://nodejs.org/api/process.html#process_process_env)
40
+
41
+ Use a custom environment variables object.
42
+
43
+ #### platform
44
+
45
+ Type: `string`<br>
46
+ Default: [`process.platform`](https://nodejs.org/api/process.html#process_process_platform)
47
+
48
+ Get the PATH key for a specific platform.
49
+
50
+
51
+ ---
52
+
53
+ <div align="center">
54
+ <b>
55
+ <a href="https://tidelift.com/subscription/pkg/npm-path-key?utm_source=npm-path-key&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
56
+ </b>
57
+ <br>
58
+ <sub>
59
+ Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
60
+ </sub>
61
+ </div>
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+ const shebangRegex = require('shebang-regex');
3
+
4
+ module.exports = (string = '') => {
5
+ const match = string.match(shebangRegex);
6
+
7
+ if (!match) {
8
+ return null;
9
+ }
10
+
11
+ const [path, argument] = match[0].replace(/#! ?/, '').split(' ');
12
+ const binary = path.split('/').pop();
13
+
14
+ if (binary === 'env') {
15
+ return argument;
16
+ }
17
+
18
+ return argument ? `${binary} ${argument}` : binary;
19
+ };
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Kevin Mårtensson <kevinmartensson@gmail.com> (github.com/kevva)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "shebang-command",
3
+ "version": "2.0.0",
4
+ "description": "Get the command from a shebang",
5
+ "license": "MIT",
6
+ "repository": "kevva/shebang-command",
7
+ "author": {
8
+ "name": "Kevin Mårtensson",
9
+ "email": "kevinmartensson@gmail.com",
10
+ "url": "github.com/kevva"
11
+ },
12
+ "engines": {
13
+ "node": ">=8"
14
+ },
15
+ "scripts": {
16
+ "test": "xo && ava"
17
+ },
18
+ "files": [
19
+ "index.js"
20
+ ],
21
+ "keywords": [
22
+ "cmd",
23
+ "command",
24
+ "parse",
25
+ "shebang"
26
+ ],
27
+ "dependencies": {
28
+ "shebang-regex": "^3.0.0"
29
+ },
30
+ "devDependencies": {
31
+ "ava": "^2.3.0",
32
+ "xo": "^0.24.0"
33
+ }
34
+ }
@@ -0,0 +1,34 @@
1
+ # shebang-command [![Build Status](https://travis-ci.org/kevva/shebang-command.svg?branch=master)](https://travis-ci.org/kevva/shebang-command)
2
+
3
+ > Get the command from a shebang
4
+
5
+
6
+ ## Install
7
+
8
+ ```
9
+ $ npm install shebang-command
10
+ ```
11
+
12
+
13
+ ## Usage
14
+
15
+ ```js
16
+ const shebangCommand = require('shebang-command');
17
+
18
+ shebangCommand('#!/usr/bin/env node');
19
+ //=> 'node'
20
+
21
+ shebangCommand('#!/bin/bash');
22
+ //=> 'bash'
23
+ ```
24
+
25
+
26
+ ## API
27
+
28
+ ### shebangCommand(string)
29
+
30
+ #### string
31
+
32
+ Type: `string`
33
+
34
+ String containing a shebang.
@@ -0,0 +1,22 @@
1
+ /**
2
+ Regular expression for matching a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) line.
3
+
4
+ @example
5
+ ```
6
+ import shebangRegex = require('shebang-regex');
7
+
8
+ const string = '#!/usr/bin/env node\nconsole.log("unicorns");';
9
+
10
+ shebangRegex.test(string);
11
+ //=> true
12
+
13
+ shebangRegex.exec(string)[0];
14
+ //=> '#!/usr/bin/env node'
15
+
16
+ shebangRegex.exec(string)[1];
17
+ //=> '/usr/bin/env node'
18
+ ```
19
+ */
20
+ declare const shebangRegex: RegExp;
21
+
22
+ export = shebangRegex;
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+ module.exports = /^#!(.*)/;
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "shebang-regex",
3
+ "version": "3.0.0",
4
+ "description": "Regular expression for matching a shebang line",
5
+ "license": "MIT",
6
+ "repository": "sindresorhus/shebang-regex",
7
+ "author": {
8
+ "name": "Sindre Sorhus",
9
+ "email": "sindresorhus@gmail.com",
10
+ "url": "sindresorhus.com"
11
+ },
12
+ "engines": {
13
+ "node": ">=8"
14
+ },
15
+ "scripts": {
16
+ "test": "xo && ava && tsd"
17
+ },
18
+ "files": [
19
+ "index.js",
20
+ "index.d.ts"
21
+ ],
22
+ "keywords": [
23
+ "regex",
24
+ "regexp",
25
+ "shebang",
26
+ "match",
27
+ "test",
28
+ "line"
29
+ ],
30
+ "devDependencies": {
31
+ "ava": "^1.4.1",
32
+ "tsd": "^0.7.2",
33
+ "xo": "^0.24.0"
34
+ }
35
+ }
@@ -0,0 +1,33 @@
1
+ # shebang-regex [![Build Status](https://travis-ci.org/sindresorhus/shebang-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/shebang-regex)
2
+
3
+ > Regular expression for matching a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) line
4
+
5
+
6
+ ## Install
7
+
8
+ ```
9
+ $ npm install shebang-regex
10
+ ```
11
+
12
+
13
+ ## Usage
14
+
15
+ ```js
16
+ const shebangRegex = require('shebang-regex');
17
+
18
+ const string = '#!/usr/bin/env node\nconsole.log("unicorns");';
19
+
20
+ shebangRegex.test(string);
21
+ //=> true
22
+
23
+ shebangRegex.exec(string)[0];
24
+ //=> '#!/usr/bin/env node'
25
+
26
+ shebangRegex.exec(string)[1];
27
+ //=> '/usr/bin/env node'
28
+ ```
29
+
30
+
31
+ ## License
32
+
33
+ MIT © [Sindre Sorhus](https://sindresorhus.com)
@@ -0,0 +1,15 @@
1
+ The ISC License
2
+
3
+ Copyright (c) Isaac Z. Schlueter and Contributors
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted, provided that the above
7
+ copyright notice and this permission notice appear in all copies.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
15
+ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.