linkany 0.0.2 → 0.0.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.
- package/README.md +1 -0
- package/dist/cli.js +6 -5
- package/dist/core/audit.js +2 -0
- package/dist/core/runner.js +3 -1
- package/dist/types.d.ts +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/cli.js
CHANGED
|
@@ -41,7 +41,8 @@ function parseCommonOptions(args) {
|
|
|
41
41
|
const dryRun = hasFlag(args, ['--dry-run']);
|
|
42
42
|
const includePlanText = hasFlag(args, ['--plan']);
|
|
43
43
|
const auditLogPath = popFlagValue(args, ['--audit-log']);
|
|
44
|
-
|
|
44
|
+
const audit = hasFlag(args, ['--no-audit']) ? false : undefined;
|
|
45
|
+
return { dryRun, includePlanText, auditLogPath, audit };
|
|
45
46
|
}
|
|
46
47
|
async function resolveManifestPath(args) {
|
|
47
48
|
const m = popFlagValue(args, ['-m', '--manifest']);
|
|
@@ -61,10 +62,10 @@ Usage:
|
|
|
61
62
|
linkany manifest show
|
|
62
63
|
linkany manifest clear
|
|
63
64
|
|
|
64
|
-
linkany add --source <path> --target <path> [--kind file|dir] [--atomic|--no-atomic] [-m <manifest>] [--dry-run] [--plan]
|
|
65
|
-
linkany remove <key> [--keep-link] [-m <manifest>] [--dry-run] [--plan]
|
|
66
|
-
linkany install [-m <manifest>] [--dry-run] [--plan]
|
|
67
|
-
linkany uninstall [-m <manifest>] [--dry-run] [--plan]
|
|
65
|
+
linkany add --source <path> --target <path> [--kind file|dir] [--atomic|--no-atomic] [-m <manifest>] [--dry-run] [--plan] [--no-audit]
|
|
66
|
+
linkany remove <key> [--keep-link] [-m <manifest>] [--dry-run] [--plan] [--no-audit]
|
|
67
|
+
linkany install [-m <manifest>] [--dry-run] [--plan] [--no-audit]
|
|
68
|
+
linkany uninstall [-m <manifest>] [--dry-run] [--plan] [--no-audit]
|
|
68
69
|
`;
|
|
69
70
|
process.stdout.write(msg.trimStart());
|
|
70
71
|
process.stdout.write('\n');
|
package/dist/core/audit.js
CHANGED
|
@@ -9,6 +9,8 @@ export async function appendAudit(logPath, result) {
|
|
|
9
9
|
await fs.appendFile(logPath, line, 'utf8');
|
|
10
10
|
}
|
|
11
11
|
export async function tryAppendAuditStep(result, manifestPath, opts) {
|
|
12
|
+
if (opts?.audit === false)
|
|
13
|
+
return result;
|
|
12
14
|
const logPath = opts?.auditLogPath ?? (manifestPath ? `${path.resolve(manifestPath)}.log.jsonl` : undefined);
|
|
13
15
|
if (!logPath)
|
|
14
16
|
return result;
|
package/dist/core/runner.js
CHANGED
|
@@ -24,7 +24,9 @@ export async function runOperation(input) {
|
|
|
24
24
|
if (input.finalize) {
|
|
25
25
|
res = await input.finalize(res);
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
if (input.opts?.audit !== false) {
|
|
28
|
+
res = await tryAppendAuditStep(res, input.manifestPath, input.opts);
|
|
29
|
+
}
|
|
28
30
|
logger?.info?.(`[linkany] ${input.operation} ${res.ok ? 'ok' : 'fail'} (${res.durationMs}ms)`);
|
|
29
31
|
return res;
|
|
30
32
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -55,6 +55,13 @@ export interface Logger {
|
|
|
55
55
|
error(msg: string): void;
|
|
56
56
|
}
|
|
57
57
|
export interface CommonOptions {
|
|
58
|
+
/**
|
|
59
|
+
* Whether to append an audit log entry for this operation.
|
|
60
|
+
* Default: true.
|
|
61
|
+
*
|
|
62
|
+
* Set to false if the caller wants to fully disable audit logging and handle it themselves.
|
|
63
|
+
*/
|
|
64
|
+
audit?: boolean;
|
|
58
65
|
/**
|
|
59
66
|
* If provided, we append one JSON line per operation (Result summary).
|
|
60
67
|
* Default strategy (V1): `${manifestPath}.log.jsonl` when manifestPath is known.
|