qa360 1.1.7 → 1.1.8

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.
@@ -1 +1 @@
1
- {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/commands/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAeH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAqGD;;GAEG;AACH,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAgDjB;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,MAAM,CAAC,CA6EjB;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CA2Bf"}
1
+ {"version":3,"file":"verify.d.ts","sourceRoot":"","sources":["../../src/commands/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAeH;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAoID;;GAEG;AACH,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,MAAM,CAAC,CA8BjB;AAED;;GAEG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,MAAM,CAAC,CA6EjB;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,IAAI,CAAC,CA2Bf"}
@@ -15,6 +15,38 @@ import { join, resolve, basename } from 'path';
15
15
  import chalk from 'chalk';
16
16
  // Import from core
17
17
  import { verifyProofFile, verifyPhase3Proof, VerificationCode, } from '../core/index.js';
18
+ /**
19
+ * Verify a proof file with automatic format detection
20
+ */
21
+ async function verifyProofAuto(filePath) {
22
+ try {
23
+ const content = readFileSync(filePath, 'utf-8');
24
+ const json = JSON.parse(content);
25
+ // Detect format
26
+ if (json.spec === 'qa360.proof.v1') {
27
+ // RFC format
28
+ return await verifyProofFile(filePath);
29
+ }
30
+ else if (json.version && json.signature && json.runId) {
31
+ // Phase3 format
32
+ return await verifyPhase3Proof(filePath);
33
+ }
34
+ else {
35
+ return {
36
+ valid: false,
37
+ code: VerificationCode.PROOF_MALFORMED,
38
+ message: 'Unknown proof format',
39
+ };
40
+ }
41
+ }
42
+ catch (error) {
43
+ return {
44
+ valid: false,
45
+ code: VerificationCode.PROOF_MALFORMED,
46
+ message: `Failed to read proof: ${error instanceof Error ? error.message : 'Unknown error'}`,
47
+ };
48
+ }
49
+ }
18
50
  /**
19
51
  * Format verification result for human-readable output
20
52
  */
@@ -118,25 +150,7 @@ export async function verifySingle(filePath, options = {}) {
118
150
  return 1;
119
151
  }
120
152
  try {
121
- // Detect proof format
122
- const content = readFileSync(absolutePath, 'utf-8');
123
- const json = JSON.parse(content);
124
- let result;
125
- if (json.spec === 'qa360.proof.v1') {
126
- // RFC format
127
- result = await verifyProofFile(absolutePath);
128
- }
129
- else if (json.version && json.signature && json.runId) {
130
- // Phase3 format
131
- result = await verifyPhase3Proof(absolutePath);
132
- }
133
- else {
134
- result = {
135
- valid: false,
136
- code: VerificationCode.PROOF_MALFORMED,
137
- message: 'Unknown proof format',
138
- };
139
- }
153
+ const result = await verifyProofAuto(absolutePath);
140
154
  if (options.json) {
141
155
  formatJSON(result);
142
156
  }
@@ -184,7 +198,7 @@ export async function verifyDirectory(dirPath, options = {}) {
184
198
  console.log(chalk.gray(`\n━━━ ${fileName} ━━━`));
185
199
  }
186
200
  try {
187
- const result = await verifyProofFile(proofFile);
201
+ const result = await verifyProofAuto(proofFile);
188
202
  if (!options.json) {
189
203
  formatResult(result, proofFile);
190
204
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qa360",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "QA360 Proof CLI - Quality as Cryptographic Proof",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",