codequill 0.8.1-beta.3 → 0.9.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/README.md +365 -118
- package/dist/commands/attest.js +0 -1
- package/dist/commands/attest.js.map +1 -1
- package/dist/commands/backup.js +1 -1
- package/dist/commands/backup.js.map +1 -1
- package/dist/commands/why.js +107 -87
- package/dist/commands/why.js.map +1 -1
- package/dist/services/api.js +2 -3
- package/dist/services/api.js.map +1 -1
- package/dist/services/manifests/attestationManifest.js +0 -1
- package/dist/services/manifests/attestationManifest.js.map +1 -1
- package/dist/services/ui.js +12 -11
- package/dist/services/ui.js.map +1 -1
- package/package.json +1 -1
- package/dist/commands/revoke.js +0 -97
- package/dist/commands/revoke.js.map +0 -1
package/dist/commands/revoke.js
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { colors, spinner } from '../services/ui.js';
|
|
2
|
-
import { apiClient } from '../services/apiClient.js';
|
|
3
|
-
import { assertAuthenticated } from '../services/utilities.js';
|
|
4
|
-
import { waitForTxConfirmation } from '../services/txWaiter.js';
|
|
5
|
-
import { getBaseUrl } from '../services/config.js';
|
|
6
|
-
export async function handleRevoke(attestationId, opts) {
|
|
7
|
-
if (!assertAuthenticated())
|
|
8
|
-
return;
|
|
9
|
-
const id = String(attestationId || '').trim();
|
|
10
|
-
if (!id) {
|
|
11
|
-
console.error(colors.error('Missing <attestationId>.'));
|
|
12
|
-
process.exitCode = 1;
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
// 1) Call backend (backend resolves uuid -> (repoId,digest,type) + author wallet and relays revoke tx)
|
|
16
|
-
const s = spinner('Revoking attestation ...');
|
|
17
|
-
let res;
|
|
18
|
-
try {
|
|
19
|
-
// Keep payload explicit. Backend can ignore fields it doesn't support yet.
|
|
20
|
-
const body = {
|
|
21
|
-
attestation_id: id,
|
|
22
|
-
// Off-chain context (DB + UI)
|
|
23
|
-
reason: opts.reason ? String(opts.reason) : undefined,
|
|
24
|
-
replacement_attestation_id: opts.replacement ? String(opts.replacement) : undefined,
|
|
25
|
-
// Optional on-chain context (if your contract includes these)
|
|
26
|
-
note_cid: opts.noteCid ? String(opts.noteCid) : undefined,
|
|
27
|
-
onchain_reason: typeof opts.onchainReason === 'number' ? opts.onchainReason : undefined,
|
|
28
|
-
};
|
|
29
|
-
res = await apiClient.post('/v1/cli/attest/revoke', body);
|
|
30
|
-
if (!res || !res.attestation_id)
|
|
31
|
-
throw new Error('Malformed revoke response.');
|
|
32
|
-
s.succeed(colors.success(res.status === 'already_revoked' ? 'Already revoked.' : 'Revocation submitted.'));
|
|
33
|
-
}
|
|
34
|
-
catch (e) {
|
|
35
|
-
s.fail(colors.error('Revocation failed.'));
|
|
36
|
-
console.error(colors.error(String(e?.message || e)));
|
|
37
|
-
process.exitCode = 1;
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
// 2) Output
|
|
41
|
-
console.log('');
|
|
42
|
-
console.log(colors.bold('🧯 Attestation revocation'));
|
|
43
|
-
console.log(colors.dim('────────────────────────────────────────'));
|
|
44
|
-
console.log(` Attestation ID ${res.attestation_id}`);
|
|
45
|
-
console.log(` Status ${res.status}`);
|
|
46
|
-
console.log(` URL ${getBaseUrl() + '/a/' + res.attestation_id}`);
|
|
47
|
-
if (res.tx_hash)
|
|
48
|
-
console.log(` Tx Hash ${res.tx_hash}`);
|
|
49
|
-
if (res.chain_id)
|
|
50
|
-
console.log(` Chain ID ${res.chain_id}`);
|
|
51
|
-
if (res.explorer_url)
|
|
52
|
-
console.log(` Explorer ${res.explorer_url}`);
|
|
53
|
-
console.log(colors.dim('────────────────────────────────────────'));
|
|
54
|
-
// 3) Wait confirmation (if tx returned and user wants it)
|
|
55
|
-
if (opts.noWait || !res.tx_hash) {
|
|
56
|
-
if (!res.tx_hash)
|
|
57
|
-
console.log(colors.dim('Note: no tx hash returned (revocation may be purely off-chain or queued).'));
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
const confTarget = Math.max(1, Number(opts.confirmations ?? 1));
|
|
61
|
-
try {
|
|
62
|
-
await waitForTxConfirmation({
|
|
63
|
-
txHash: res.tx_hash,
|
|
64
|
-
confirmations: confTarget,
|
|
65
|
-
timeoutMs: opts.timeoutMs,
|
|
66
|
-
});
|
|
67
|
-
console.log(colors.success(`✓ Confirmed on-chain (${confTarget} confirmation${confTarget > 1 ? 's' : ''}).`));
|
|
68
|
-
}
|
|
69
|
-
catch (e) {
|
|
70
|
-
console.error(colors.error(String(e?.message || e)));
|
|
71
|
-
process.exitCode = 1;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
export function registerRevokeCommand(program) {
|
|
75
|
-
program
|
|
76
|
-
.command('revoke <attestationId>')
|
|
77
|
-
.description('Revoke an attestation (records revocation; does not delete).')
|
|
78
|
-
.option('--reason <text>', 'Human-readable reason (stored off-chain)')
|
|
79
|
-
.option('--replacement <attestationId>', 'Replacement attestation UUID (stored off-chain)')
|
|
80
|
-
.option('--note-cid <cid>', 'Optional public CID with revocation note')
|
|
81
|
-
.option('--onchain-reason <n>', 'Optional on-chain reason code (uint8)', (v) => parseInt(v, 10))
|
|
82
|
-
.option('--confirmations <n>', 'Wait for N confirmations (default: 1)', (v) => parseInt(v, 10))
|
|
83
|
-
.option('--timeout <ms>', 'Timeout waiting for confirmation (ms)', (v) => parseInt(v, 10))
|
|
84
|
-
.option('--no-wait', 'Do not wait for confirmation', false)
|
|
85
|
-
.action(async (attestationId, options) => {
|
|
86
|
-
await handleRevoke(attestationId, {
|
|
87
|
-
reason: options.reason,
|
|
88
|
-
replacement: options.replacement,
|
|
89
|
-
noteCid: options.noteCid,
|
|
90
|
-
onchainReason: Number.isFinite(options.onchainReason) ? options.onchainReason : undefined,
|
|
91
|
-
confirmations: options.confirmations,
|
|
92
|
-
timeoutMs: options.timeout,
|
|
93
|
-
noWait: !!options.noWait,
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
//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