0xkobold 0.5.0 → 0.5.2

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 (128) hide show
  1. package/dist/package.json +5 -4
  2. package/dist/src/agent/types/definitions.js +2 -1
  3. package/dist/src/agent/types/definitions.js.map +1 -1
  4. package/dist/src/cli/commands/setup.js +0 -3
  5. package/dist/src/cli/commands/setup.js.map +1 -1
  6. package/dist/src/config/loader.js +0 -3
  7. package/dist/src/config/loader.js.map +1 -1
  8. package/dist/src/event-bus/index.js.map +1 -1
  9. package/dist/src/extensions/core/agent-orchestrator-extension.js +19 -2
  10. package/dist/src/extensions/core/agent-orchestrator-extension.js.map +1 -1
  11. package/dist/src/extensions/core/auto-security-scan-extension.js +41 -0
  12. package/dist/src/extensions/core/auto-security-scan-extension.js.map +1 -0
  13. package/dist/src/extensions/core/task-manager-extension.js +20 -3
  14. package/dist/src/extensions/core/task-manager-extension.js.map +1 -1
  15. package/dist/src/index.js +0 -1
  16. package/dist/src/index.js.map +1 -1
  17. package/dist/src/pi-config.js +2 -0
  18. package/dist/src/pi-config.js.map +1 -1
  19. package/package.json +5 -4
  20. package/skills/kobold-scan-skill/README.md +218 -0
  21. package/skills/kobold-scan-skill/config/default.json +14 -0
  22. package/skills/kobold-scan-skill/examples/vulnerable.js +56 -0
  23. package/skills/kobold-scan-skill/examples/vulnerable.sol +38 -0
  24. package/skills/kobold-scan-skill/index.js +130 -0
  25. package/skills/kobold-scan-skill/node_modules/.package-lock.json +172 -0
  26. package/skills/kobold-scan-skill/node_modules/ansi-styles/index.d.ts +345 -0
  27. package/skills/kobold-scan-skill/node_modules/ansi-styles/index.js +163 -0
  28. package/skills/kobold-scan-skill/node_modules/ansi-styles/license +9 -0
  29. package/skills/kobold-scan-skill/node_modules/ansi-styles/package.json +56 -0
  30. package/skills/kobold-scan-skill/node_modules/ansi-styles/readme.md +152 -0
  31. package/skills/kobold-scan-skill/node_modules/balanced-match/.github/FUNDING.yml +2 -0
  32. package/skills/kobold-scan-skill/node_modules/balanced-match/LICENSE.md +21 -0
  33. package/skills/kobold-scan-skill/node_modules/balanced-match/README.md +97 -0
  34. package/skills/kobold-scan-skill/node_modules/balanced-match/index.js +62 -0
  35. package/skills/kobold-scan-skill/node_modules/balanced-match/package.json +48 -0
  36. package/skills/kobold-scan-skill/node_modules/brace-expansion/.github/FUNDING.yml +2 -0
  37. package/skills/kobold-scan-skill/node_modules/brace-expansion/LICENSE +21 -0
  38. package/skills/kobold-scan-skill/node_modules/brace-expansion/README.md +135 -0
  39. package/skills/kobold-scan-skill/node_modules/brace-expansion/index.js +203 -0
  40. package/skills/kobold-scan-skill/node_modules/brace-expansion/package.json +49 -0
  41. package/skills/kobold-scan-skill/node_modules/chalk/index.d.ts +415 -0
  42. package/skills/kobold-scan-skill/node_modules/chalk/license +9 -0
  43. package/skills/kobold-scan-skill/node_modules/chalk/package.json +68 -0
  44. package/skills/kobold-scan-skill/node_modules/chalk/readme.md +341 -0
  45. package/skills/kobold-scan-skill/node_modules/chalk/source/index.js +229 -0
  46. package/skills/kobold-scan-skill/node_modules/chalk/source/templates.js +134 -0
  47. package/skills/kobold-scan-skill/node_modules/chalk/source/util.js +39 -0
  48. package/skills/kobold-scan-skill/node_modules/color-convert/CHANGELOG.md +54 -0
  49. package/skills/kobold-scan-skill/node_modules/color-convert/LICENSE +21 -0
  50. package/skills/kobold-scan-skill/node_modules/color-convert/README.md +68 -0
  51. package/skills/kobold-scan-skill/node_modules/color-convert/conversions.js +839 -0
  52. package/skills/kobold-scan-skill/node_modules/color-convert/index.js +81 -0
  53. package/skills/kobold-scan-skill/node_modules/color-convert/package.json +48 -0
  54. package/skills/kobold-scan-skill/node_modules/color-convert/route.js +97 -0
  55. package/skills/kobold-scan-skill/node_modules/color-name/LICENSE +8 -0
  56. package/skills/kobold-scan-skill/node_modules/color-name/README.md +11 -0
  57. package/skills/kobold-scan-skill/node_modules/color-name/index.js +152 -0
  58. package/skills/kobold-scan-skill/node_modules/color-name/package.json +28 -0
  59. package/skills/kobold-scan-skill/node_modules/commander/LICENSE +22 -0
  60. package/skills/kobold-scan-skill/node_modules/commander/Readme.md +1129 -0
  61. package/skills/kobold-scan-skill/node_modules/commander/esm.mjs +16 -0
  62. package/skills/kobold-scan-skill/node_modules/commander/index.js +27 -0
  63. package/skills/kobold-scan-skill/node_modules/commander/lib/argument.js +147 -0
  64. package/skills/kobold-scan-skill/node_modules/commander/lib/command.js +2179 -0
  65. package/skills/kobold-scan-skill/node_modules/commander/lib/error.js +45 -0
  66. package/skills/kobold-scan-skill/node_modules/commander/lib/help.js +461 -0
  67. package/skills/kobold-scan-skill/node_modules/commander/lib/option.js +326 -0
  68. package/skills/kobold-scan-skill/node_modules/commander/lib/suggestSimilar.js +100 -0
  69. package/skills/kobold-scan-skill/node_modules/commander/package-support.json +16 -0
  70. package/skills/kobold-scan-skill/node_modules/commander/package.json +80 -0
  71. package/skills/kobold-scan-skill/node_modules/commander/typings/index.d.ts +891 -0
  72. package/skills/kobold-scan-skill/node_modules/fs.realpath/LICENSE +43 -0
  73. package/skills/kobold-scan-skill/node_modules/fs.realpath/README.md +33 -0
  74. package/skills/kobold-scan-skill/node_modules/fs.realpath/index.js +66 -0
  75. package/skills/kobold-scan-skill/node_modules/fs.realpath/old.js +303 -0
  76. package/skills/kobold-scan-skill/node_modules/fs.realpath/package.json +26 -0
  77. package/skills/kobold-scan-skill/node_modules/glob/LICENSE +15 -0
  78. package/skills/kobold-scan-skill/node_modules/glob/README.md +399 -0
  79. package/skills/kobold-scan-skill/node_modules/glob/common.js +244 -0
  80. package/skills/kobold-scan-skill/node_modules/glob/glob.js +790 -0
  81. package/skills/kobold-scan-skill/node_modules/glob/package.json +55 -0
  82. package/skills/kobold-scan-skill/node_modules/glob/sync.js +486 -0
  83. package/skills/kobold-scan-skill/node_modules/has-flag/index.d.ts +39 -0
  84. package/skills/kobold-scan-skill/node_modules/has-flag/index.js +8 -0
  85. package/skills/kobold-scan-skill/node_modules/has-flag/license +9 -0
  86. package/skills/kobold-scan-skill/node_modules/has-flag/package.json +46 -0
  87. package/skills/kobold-scan-skill/node_modules/has-flag/readme.md +89 -0
  88. package/skills/kobold-scan-skill/node_modules/inflight/LICENSE +15 -0
  89. package/skills/kobold-scan-skill/node_modules/inflight/README.md +37 -0
  90. package/skills/kobold-scan-skill/node_modules/inflight/inflight.js +54 -0
  91. package/skills/kobold-scan-skill/node_modules/inflight/package.json +29 -0
  92. package/skills/kobold-scan-skill/node_modules/inherits/LICENSE +16 -0
  93. package/skills/kobold-scan-skill/node_modules/inherits/README.md +42 -0
  94. package/skills/kobold-scan-skill/node_modules/inherits/inherits.js +9 -0
  95. package/skills/kobold-scan-skill/node_modules/inherits/inherits_browser.js +27 -0
  96. package/skills/kobold-scan-skill/node_modules/inherits/package.json +29 -0
  97. package/skills/kobold-scan-skill/node_modules/minimatch/LICENSE +15 -0
  98. package/skills/kobold-scan-skill/node_modules/minimatch/README.md +259 -0
  99. package/skills/kobold-scan-skill/node_modules/minimatch/lib/path.js +4 -0
  100. package/skills/kobold-scan-skill/node_modules/minimatch/minimatch.js +944 -0
  101. package/skills/kobold-scan-skill/node_modules/minimatch/package.json +35 -0
  102. package/skills/kobold-scan-skill/node_modules/once/LICENSE +15 -0
  103. package/skills/kobold-scan-skill/node_modules/once/README.md +79 -0
  104. package/skills/kobold-scan-skill/node_modules/once/once.js +42 -0
  105. package/skills/kobold-scan-skill/node_modules/once/package.json +33 -0
  106. package/skills/kobold-scan-skill/node_modules/supports-color/browser.js +5 -0
  107. package/skills/kobold-scan-skill/node_modules/supports-color/index.js +135 -0
  108. package/skills/kobold-scan-skill/node_modules/supports-color/license +9 -0
  109. package/skills/kobold-scan-skill/node_modules/supports-color/package.json +53 -0
  110. package/skills/kobold-scan-skill/node_modules/supports-color/readme.md +76 -0
  111. package/skills/kobold-scan-skill/node_modules/wrappy/LICENSE +15 -0
  112. package/skills/kobold-scan-skill/node_modules/wrappy/README.md +36 -0
  113. package/skills/kobold-scan-skill/node_modules/wrappy/package.json +29 -0
  114. package/skills/kobold-scan-skill/node_modules/wrappy/wrappy.js +33 -0
  115. package/skills/kobold-scan-skill/package-lock.json +188 -0
  116. package/skills/kobold-scan-skill/package.json +34 -0
  117. package/skills/kobold-scan-skill/rules/general.json +30 -0
  118. package/skills/kobold-scan-skill/rules/javascript.json +44 -0
  119. package/skills/kobold-scan-skill/rules/solidity.json +30 -0
  120. package/skills/kobold-scan-skill/src/formatters/json.js +7 -0
  121. package/skills/kobold-scan-skill/src/formatters/terminal.js +66 -0
  122. package/skills/kobold-scan-skill/src/scanner-engine.js +139 -0
  123. package/skills/kobold-scan-skill/src/scanners/general.js +83 -0
  124. package/skills/kobold-scan-skill/src/scanners/javascript.js +182 -0
  125. package/skills/kobold-scan-skill/src/scanners/solidity.js +131 -0
  126. package/skills/kobold-scan-skill/src/utils/config-manager.js +37 -0
  127. package/skills/kobold-scan-skill/src/utils/rule-loader.js +24 -0
  128. package/skills/kobold-scan.ts +107 -0
@@ -0,0 +1,35 @@
1
+ {
2
+ "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
3
+ "name": "minimatch",
4
+ "description": "a glob matcher in javascript",
5
+ "publishConfig": {
6
+ "tag": "legacy-v5"
7
+ },
8
+ "version": "5.1.6",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git://github.com/isaacs/minimatch.git"
12
+ },
13
+ "main": "minimatch.js",
14
+ "scripts": {
15
+ "test": "tap",
16
+ "snap": "tap",
17
+ "preversion": "npm test",
18
+ "postversion": "npm publish",
19
+ "prepublishOnly": "git push origin --follow-tags"
20
+ },
21
+ "engines": {
22
+ "node": ">=10"
23
+ },
24
+ "dependencies": {
25
+ "brace-expansion": "^2.0.1"
26
+ },
27
+ "devDependencies": {
28
+ "tap": "^16.3.2"
29
+ },
30
+ "license": "ISC",
31
+ "files": [
32
+ "minimatch.js",
33
+ "lib"
34
+ ]
35
+ }
@@ -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.
@@ -0,0 +1,79 @@
1
+ # once
2
+
3
+ Only call a function once.
4
+
5
+ ## usage
6
+
7
+ ```javascript
8
+ var once = require('once')
9
+
10
+ function load (file, cb) {
11
+ cb = once(cb)
12
+ loader.load('file')
13
+ loader.once('load', cb)
14
+ loader.once('error', cb)
15
+ }
16
+ ```
17
+
18
+ Or add to the Function.prototype in a responsible way:
19
+
20
+ ```javascript
21
+ // only has to be done once
22
+ require('once').proto()
23
+
24
+ function load (file, cb) {
25
+ cb = cb.once()
26
+ loader.load('file')
27
+ loader.once('load', cb)
28
+ loader.once('error', cb)
29
+ }
30
+ ```
31
+
32
+ Ironically, the prototype feature makes this module twice as
33
+ complicated as necessary.
34
+
35
+ To check whether you function has been called, use `fn.called`. Once the
36
+ function is called for the first time the return value of the original
37
+ function is saved in `fn.value` and subsequent calls will continue to
38
+ return this value.
39
+
40
+ ```javascript
41
+ var once = require('once')
42
+
43
+ function load (cb) {
44
+ cb = once(cb)
45
+ var stream = createStream()
46
+ stream.once('data', cb)
47
+ stream.once('end', function () {
48
+ if (!cb.called) cb(new Error('not found'))
49
+ })
50
+ }
51
+ ```
52
+
53
+ ## `once.strict(func)`
54
+
55
+ Throw an error if the function is called twice.
56
+
57
+ Some functions are expected to be called only once. Using `once` for them would
58
+ potentially hide logical errors.
59
+
60
+ In the example below, the `greet` function has to call the callback only once:
61
+
62
+ ```javascript
63
+ function greet (name, cb) {
64
+ // return is missing from the if statement
65
+ // when no name is passed, the callback is called twice
66
+ if (!name) cb('Hello anonymous')
67
+ cb('Hello ' + name)
68
+ }
69
+
70
+ function log (msg) {
71
+ console.log(msg)
72
+ }
73
+
74
+ // this will print 'Hello anonymous' but the logical error will be missed
75
+ greet(null, once(msg))
76
+
77
+ // once.strict will print 'Hello anonymous' and throw an error when the callback will be called the second time
78
+ greet(null, once.strict(msg))
79
+ ```
@@ -0,0 +1,42 @@
1
+ var wrappy = require('wrappy')
2
+ module.exports = wrappy(once)
3
+ module.exports.strict = wrappy(onceStrict)
4
+
5
+ once.proto = once(function () {
6
+ Object.defineProperty(Function.prototype, 'once', {
7
+ value: function () {
8
+ return once(this)
9
+ },
10
+ configurable: true
11
+ })
12
+
13
+ Object.defineProperty(Function.prototype, 'onceStrict', {
14
+ value: function () {
15
+ return onceStrict(this)
16
+ },
17
+ configurable: true
18
+ })
19
+ })
20
+
21
+ function once (fn) {
22
+ var f = function () {
23
+ if (f.called) return f.value
24
+ f.called = true
25
+ return f.value = fn.apply(this, arguments)
26
+ }
27
+ f.called = false
28
+ return f
29
+ }
30
+
31
+ function onceStrict (fn) {
32
+ var f = function () {
33
+ if (f.called)
34
+ throw new Error(f.onceError)
35
+ f.called = true
36
+ return f.value = fn.apply(this, arguments)
37
+ }
38
+ var name = fn.name || 'Function wrapped with `once`'
39
+ f.onceError = name + " shouldn't be called more than once"
40
+ f.called = false
41
+ return f
42
+ }
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "once",
3
+ "version": "1.4.0",
4
+ "description": "Run a function exactly one time",
5
+ "main": "once.js",
6
+ "directories": {
7
+ "test": "test"
8
+ },
9
+ "dependencies": {
10
+ "wrappy": "1"
11
+ },
12
+ "devDependencies": {
13
+ "tap": "^7.0.1"
14
+ },
15
+ "scripts": {
16
+ "test": "tap test/*.js"
17
+ },
18
+ "files": [
19
+ "once.js"
20
+ ],
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git://github.com/isaacs/once"
24
+ },
25
+ "keywords": [
26
+ "once",
27
+ "function",
28
+ "one",
29
+ "single"
30
+ ],
31
+ "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
32
+ "license": "ISC"
33
+ }
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+ module.exports = {
3
+ stdout: false,
4
+ stderr: false
5
+ };
@@ -0,0 +1,135 @@
1
+ 'use strict';
2
+ const os = require('os');
3
+ const tty = require('tty');
4
+ const hasFlag = require('has-flag');
5
+
6
+ const {env} = process;
7
+
8
+ let forceColor;
9
+ if (hasFlag('no-color') ||
10
+ hasFlag('no-colors') ||
11
+ hasFlag('color=false') ||
12
+ hasFlag('color=never')) {
13
+ forceColor = 0;
14
+ } else if (hasFlag('color') ||
15
+ hasFlag('colors') ||
16
+ hasFlag('color=true') ||
17
+ hasFlag('color=always')) {
18
+ forceColor = 1;
19
+ }
20
+
21
+ if ('FORCE_COLOR' in env) {
22
+ if (env.FORCE_COLOR === 'true') {
23
+ forceColor = 1;
24
+ } else if (env.FORCE_COLOR === 'false') {
25
+ forceColor = 0;
26
+ } else {
27
+ forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
28
+ }
29
+ }
30
+
31
+ function translateLevel(level) {
32
+ if (level === 0) {
33
+ return false;
34
+ }
35
+
36
+ return {
37
+ level,
38
+ hasBasic: true,
39
+ has256: level >= 2,
40
+ has16m: level >= 3
41
+ };
42
+ }
43
+
44
+ function supportsColor(haveStream, streamIsTTY) {
45
+ if (forceColor === 0) {
46
+ return 0;
47
+ }
48
+
49
+ if (hasFlag('color=16m') ||
50
+ hasFlag('color=full') ||
51
+ hasFlag('color=truecolor')) {
52
+ return 3;
53
+ }
54
+
55
+ if (hasFlag('color=256')) {
56
+ return 2;
57
+ }
58
+
59
+ if (haveStream && !streamIsTTY && forceColor === undefined) {
60
+ return 0;
61
+ }
62
+
63
+ const min = forceColor || 0;
64
+
65
+ if (env.TERM === 'dumb') {
66
+ return min;
67
+ }
68
+
69
+ if (process.platform === 'win32') {
70
+ // Windows 10 build 10586 is the first Windows release that supports 256 colors.
71
+ // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
72
+ const osRelease = os.release().split('.');
73
+ if (
74
+ Number(osRelease[0]) >= 10 &&
75
+ Number(osRelease[2]) >= 10586
76
+ ) {
77
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
78
+ }
79
+
80
+ return 1;
81
+ }
82
+
83
+ if ('CI' in env) {
84
+ if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
85
+ return 1;
86
+ }
87
+
88
+ return min;
89
+ }
90
+
91
+ if ('TEAMCITY_VERSION' in env) {
92
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
93
+ }
94
+
95
+ if (env.COLORTERM === 'truecolor') {
96
+ return 3;
97
+ }
98
+
99
+ if ('TERM_PROGRAM' in env) {
100
+ const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
101
+
102
+ switch (env.TERM_PROGRAM) {
103
+ case 'iTerm.app':
104
+ return version >= 3 ? 3 : 2;
105
+ case 'Apple_Terminal':
106
+ return 2;
107
+ // No default
108
+ }
109
+ }
110
+
111
+ if (/-256(color)?$/i.test(env.TERM)) {
112
+ return 2;
113
+ }
114
+
115
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
116
+ return 1;
117
+ }
118
+
119
+ if ('COLORTERM' in env) {
120
+ return 1;
121
+ }
122
+
123
+ return min;
124
+ }
125
+
126
+ function getSupportLevel(stream) {
127
+ const level = supportsColor(stream, stream && stream.isTTY);
128
+ return translateLevel(level);
129
+ }
130
+
131
+ module.exports = {
132
+ supportsColor: getSupportLevel,
133
+ stdout: translateLevel(supportsColor(true, tty.isatty(1))),
134
+ stderr: translateLevel(supportsColor(true, tty.isatty(2)))
135
+ };
@@ -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,53 @@
1
+ {
2
+ "name": "supports-color",
3
+ "version": "7.2.0",
4
+ "description": "Detect whether a terminal supports color",
5
+ "license": "MIT",
6
+ "repository": "chalk/supports-color",
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"
17
+ },
18
+ "files": [
19
+ "index.js",
20
+ "browser.js"
21
+ ],
22
+ "keywords": [
23
+ "color",
24
+ "colour",
25
+ "colors",
26
+ "terminal",
27
+ "console",
28
+ "cli",
29
+ "ansi",
30
+ "styles",
31
+ "tty",
32
+ "rgb",
33
+ "256",
34
+ "shell",
35
+ "xterm",
36
+ "command-line",
37
+ "support",
38
+ "supports",
39
+ "capability",
40
+ "detect",
41
+ "truecolor",
42
+ "16m"
43
+ ],
44
+ "dependencies": {
45
+ "has-flag": "^4.0.0"
46
+ },
47
+ "devDependencies": {
48
+ "ava": "^1.4.1",
49
+ "import-fresh": "^3.0.0",
50
+ "xo": "^0.24.0"
51
+ },
52
+ "browser": "browser.js"
53
+ }
@@ -0,0 +1,76 @@
1
+ # supports-color [![Build Status](https://travis-ci.org/chalk/supports-color.svg?branch=master)](https://travis-ci.org/chalk/supports-color)
2
+
3
+ > Detect whether a terminal supports color
4
+
5
+
6
+ ## Install
7
+
8
+ ```
9
+ $ npm install supports-color
10
+ ```
11
+
12
+
13
+ ## Usage
14
+
15
+ ```js
16
+ const supportsColor = require('supports-color');
17
+
18
+ if (supportsColor.stdout) {
19
+ console.log('Terminal stdout supports color');
20
+ }
21
+
22
+ if (supportsColor.stdout.has256) {
23
+ console.log('Terminal stdout supports 256 colors');
24
+ }
25
+
26
+ if (supportsColor.stderr.has16m) {
27
+ console.log('Terminal stderr supports 16 million colors (truecolor)');
28
+ }
29
+ ```
30
+
31
+
32
+ ## API
33
+
34
+ Returns an `Object` with a `stdout` and `stderr` property for testing either streams. Each property is an `Object`, or `false` if color is not supported.
35
+
36
+ The `stdout`/`stderr` objects specifies a level of support for color through a `.level` property and a corresponding flag:
37
+
38
+ - `.level = 1` and `.hasBasic = true`: Basic color support (16 colors)
39
+ - `.level = 2` and `.has256 = true`: 256 color support
40
+ - `.level = 3` and `.has16m = true`: Truecolor support (16 million colors)
41
+
42
+
43
+ ## Info
44
+
45
+ It obeys the `--color` and `--no-color` CLI flags.
46
+
47
+ For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
48
+
49
+ Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
50
+
51
+
52
+ ## Related
53
+
54
+ - [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module
55
+ - [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
56
+
57
+
58
+ ## Maintainers
59
+
60
+ - [Sindre Sorhus](https://github.com/sindresorhus)
61
+ - [Josh Junon](https://github.com/qix-)
62
+
63
+
64
+ ---
65
+
66
+ <div align="center">
67
+ <b>
68
+ <a href="https://tidelift.com/subscription/pkg/npm-supports-color?utm_source=npm-supports-color&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
69
+ </b>
70
+ <br>
71
+ <sub>
72
+ Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
73
+ </sub>
74
+ </div>
75
+
76
+ ---
@@ -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.
@@ -0,0 +1,36 @@
1
+ # wrappy
2
+
3
+ Callback wrapping utility
4
+
5
+ ## USAGE
6
+
7
+ ```javascript
8
+ var wrappy = require("wrappy")
9
+
10
+ // var wrapper = wrappy(wrapperFunction)
11
+
12
+ // make sure a cb is called only once
13
+ // See also: http://npm.im/once for this specific use case
14
+ var once = wrappy(function (cb) {
15
+ var called = false
16
+ return function () {
17
+ if (called) return
18
+ called = true
19
+ return cb.apply(this, arguments)
20
+ }
21
+ })
22
+
23
+ function printBoo () {
24
+ console.log('boo')
25
+ }
26
+ // has some rando property
27
+ printBoo.iAmBooPrinter = true
28
+
29
+ var onlyPrintOnce = once(printBoo)
30
+
31
+ onlyPrintOnce() // prints 'boo'
32
+ onlyPrintOnce() // does nothing
33
+
34
+ // random property is retained!
35
+ assert.equal(onlyPrintOnce.iAmBooPrinter, true)
36
+ ```
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "wrappy",
3
+ "version": "1.0.2",
4
+ "description": "Callback wrapping utility",
5
+ "main": "wrappy.js",
6
+ "files": [
7
+ "wrappy.js"
8
+ ],
9
+ "directories": {
10
+ "test": "test"
11
+ },
12
+ "dependencies": {},
13
+ "devDependencies": {
14
+ "tap": "^2.3.1"
15
+ },
16
+ "scripts": {
17
+ "test": "tap --coverage test/*.js"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/npm/wrappy"
22
+ },
23
+ "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
24
+ "license": "ISC",
25
+ "bugs": {
26
+ "url": "https://github.com/npm/wrappy/issues"
27
+ },
28
+ "homepage": "https://github.com/npm/wrappy"
29
+ }
@@ -0,0 +1,33 @@
1
+ // Returns a wrapper function that returns a wrapped callback
2
+ // The wrapper function should do some stuff, and return a
3
+ // presumably different callback function.
4
+ // This makes sure that own properties are retained, so that
5
+ // decorations and such are not lost along the way.
6
+ module.exports = wrappy
7
+ function wrappy (fn, cb) {
8
+ if (fn && cb) return wrappy(fn)(cb)
9
+
10
+ if (typeof fn !== 'function')
11
+ throw new TypeError('need wrapper function')
12
+
13
+ Object.keys(fn).forEach(function (k) {
14
+ wrapper[k] = fn[k]
15
+ })
16
+
17
+ return wrapper
18
+
19
+ function wrapper() {
20
+ var args = new Array(arguments.length)
21
+ for (var i = 0; i < args.length; i++) {
22
+ args[i] = arguments[i]
23
+ }
24
+ var ret = fn.apply(this, args)
25
+ var cb = args[args.length-1]
26
+ if (typeof ret === 'function' && ret !== cb) {
27
+ Object.keys(cb).forEach(function (k) {
28
+ ret[k] = cb[k]
29
+ })
30
+ }
31
+ return ret
32
+ }
33
+ }