@agenticcli/shipguard 0.2.1 → 0.3.0

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.
package/LICENSE ADDED
@@ -0,0 +1,91 @@
1
+ Elastic License 2.0
2
+
3
+ URL: https://www.elastic.co/licensing/elastic-license
4
+
5
+ ## Acceptance
6
+
7
+ By using the software, you agree to all of the terms and conditions below.
8
+
9
+ ## Copyright License
10
+
11
+ The licensor grants you a non-exclusive, royalty-free, worldwide,
12
+ non-sublicensable, non-transferable license to use, copy, distribute, make
13
+ available, and prepare derivative works of the software, in each case subject to
14
+ the limitations and conditions below.
15
+
16
+ ## Limitations
17
+
18
+ You may not provide the software to third parties as a hosted or managed
19
+ service, where the service provides users with access to any substantial set of
20
+ the features or functionality of the software.
21
+
22
+ You may not move, change, disable, or circumvent the license key functionality
23
+ in the software, and you may not remove or obscure any functionality in the
24
+ software that is protected by the license key.
25
+
26
+ You may not alter, remove, or obscure any licensing, copyright, or other notices
27
+ of the licensor in the software. Any use of the licensor's trademarks is subject
28
+ to applicable law.
29
+
30
+ ## Patents
31
+
32
+ The licensor grants you a license, under any patent claims the licensor can
33
+ license, or becomes able to license, to make, have made, use, sell, offer for
34
+ sale, import and have imported the software, in each case subject to the
35
+ limitations and conditions in this license. This license does not cover any
36
+ patent claims that you cause to be infringed by modifications or additions to
37
+ the software. If you or your company make any written claim that the software
38
+ infringes or contributes to infringement of any patent, your patent license for
39
+ the software granted under these terms ends immediately. If your company makes
40
+ such a claim, your patent license ends immediately for work on behalf of your
41
+ company.
42
+
43
+ ## Notices
44
+
45
+ You must ensure that anyone who gets a copy of any part of the software from you
46
+ also gets a copy of these terms or the URL for them above, along with the above
47
+ copyright notice.
48
+
49
+ ## No Other Rights
50
+
51
+ These terms do not imply any licenses other than those expressly granted in
52
+ these terms.
53
+
54
+ ## Termination
55
+
56
+ If you use the software in violation of these terms, such use is not licensed,
57
+ and your licenses will automatically terminate. If the licensor provides you
58
+ with a notice of your violation, and you cease all violation of this license no
59
+ later than 30 days after you receive that notice, your licenses will be
60
+ reinstated retroactively. However, if you violate these terms after such
61
+ reinstatement, any additional violation of these terms will cause your licenses
62
+ to terminate automatically and permanently.
63
+
64
+ ## No Liability
65
+
66
+ *As far as the law allows, the software comes as is, without any warranty or
67
+ condition, and the licensor will not be liable to you for any damages arising
68
+ out of these terms or the use or nature of the software, under any kind of
69
+ legal claim.*
70
+
71
+ ## Definitions
72
+
73
+ The **licensor** is the entity offering these terms, and the **software** is the
74
+ software the licensor makes available under these terms, including any portion
75
+ of it.
76
+
77
+ **you** refers to the individual or entity agreeing to these terms.
78
+
79
+ **your company** is any legal entity, sole proprietorship, or other kind of
80
+ organization that you work for, plus all organizations that have control over,
81
+ are under the control of, or are under common control with that organization.
82
+ **control** means ownership of substantially all the assets of an entity, or the
83
+ power to direct its management and policies by vote, contract, or otherwise.
84
+ Control can be direct or indirect.
85
+
86
+ **your licenses** are all the licenses granted to you for the software under
87
+ these terms.
88
+
89
+ **use** means anything you do with the software requiring one of your licenses.
90
+
91
+ **trademark** means trademarks, service marks, and similar rights.
package/README.md CHANGED
@@ -51,6 +51,10 @@ Details: [agenticcli.dev/docs#telemetry](https://agenticcli.dev/docs#telemetry)
51
51
 
52
52
  See [full docs](https://agenticcli.dev/docs) for policy configuration, CI setup, and agent integration.
53
53
 
54
+ ## Testing notes
55
+
56
+ Cross-impl crypto-compatibility test (CLI↔backend) lives in the private backend repo post-split; CLI repo verifies against signed-bundle fixtures. Drift risk low (stable Ed25519 scheme).
57
+
54
58
  ## License
55
59
 
56
60
  MIT
@@ -0,0 +1,7 @@
1
+ {
2
+ "secrets": "f7b1c7492d365c3bfa580a19ba721e8ef87eac0385b45284af2764a6d679df7e",
3
+ "auth": "f7b1c7492d365c3bfa580a19ba721e8ef87eac0385b45284af2764a6d679df7e",
4
+ "database": "f7b1c7492d365c3bfa580a19ba721e8ef87eac0385b45284af2764a6d679df7e",
5
+ "deployment": "f7b1c7492d365c3bfa580a19ba721e8ef87eac0385b45284af2764a6d679df7e",
6
+ "payments": "f7b1c7492d365c3bfa580a19ba721e8ef87eac0385b45284af2764a6d679df7e"
7
+ }
@@ -1,3 +1,10 @@
1
+ import {
2
+ decodeUtf8Strict,
3
+ detectBinary,
4
+ normalizeNewlines,
5
+ stripBom
6
+ } from "./chunk-ANTCYKRO.js";
7
+
1
8
  // src/utils/fs.ts
2
9
  import fg from "fast-glob";
3
10
  import { readFile, stat } from "fs/promises";
@@ -5,7 +12,6 @@ import { join } from "path";
5
12
  var DEFAULT_MAX_FILE_SIZE_BYTES = 512 * 1024;
6
13
  var DEFAULT_MAX_TOTAL_BYTES = 256 * 1024 * 1024;
7
14
  var DEFAULT_MAX_FILES = 5e3;
8
- var BINARY_CHECK_BYTES = 8192;
9
15
  var DEFAULT_IGNORE = [
10
16
  "node_modules/**",
11
17
  "dist/**",
@@ -76,6 +82,8 @@ async function readFiles(rootDir, patterns = ["**/*"], ignorePatterns = [], opti
76
82
  let truncated = false;
77
83
  let totalBytes = 0;
78
84
  let processed = 0;
85
+ const invalidUtf8Files = [];
86
+ const unreadableFiles = [];
79
87
  for (const fp of filePaths) {
80
88
  if (files.length >= maxFiles || totalBytes >= maxTotalBytes) {
81
89
  truncated = true;
@@ -93,31 +101,40 @@ async function readFiles(rootDir, patterns = ["**/*"], ignorePatterns = [], opti
93
101
  continue;
94
102
  }
95
103
  const buffer = await readFile(fullPath);
96
- const checkLen = Math.min(buffer.length, BINARY_CHECK_BYTES);
97
- let isBinary = false;
98
- for (let i = 0; i < checkLen; i++) {
99
- if (buffer[i] === 0) {
100
- isBinary = true;
101
- break;
102
- }
103
- }
104
- if (isBinary) {
104
+ if (detectBinary(new Uint8Array(buffer))) {
105
105
  skippedBinary++;
106
106
  onProgress?.(++processed, total, fp);
107
107
  continue;
108
108
  }
109
- const content = buffer.toString("utf-8");
109
+ const decoded = decodeUtf8Strict(new Uint8Array(buffer));
110
+ if (!decoded.ok) {
111
+ invalidUtf8Files.push({ relativePath: fp, reason: decoded.reason });
112
+ onProgress?.(++processed, total, fp);
113
+ continue;
114
+ }
115
+ const content = normalizeNewlines(stripBom(decoded.text));
110
116
  totalBytes += buffer.length;
111
117
  files.push({
112
118
  path: fullPath,
113
119
  content,
114
120
  relativePath: fp
115
121
  });
116
- } catch {
122
+ } catch (err) {
123
+ const detail = err instanceof Error ? err.message : String(err);
124
+ console.warn(`[shipguard] Could not read file ${fp}: ${detail}`);
125
+ unreadableFiles.push(fp);
117
126
  }
118
127
  onProgress?.(++processed, total, fp);
119
128
  }
120
- return { files, skippedTooLarge, skippedTooLargeFiles, skippedBinary, truncated };
129
+ return {
130
+ files,
131
+ skippedTooLarge,
132
+ skippedTooLargeFiles,
133
+ skippedBinary,
134
+ truncated,
135
+ invalidUtf8Files,
136
+ unreadableFiles
137
+ };
121
138
  }
122
139
 
123
140
  export {