akm-cli 0.9.0-rc.2 → 0.9.0-rc.4
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/CHANGELOG.md +40 -12
- package/README.md +7 -8
- package/SECURITY.md +5 -3
- package/dist/akm +44 -33
- package/dist/akm-migrate-storage +44 -33
- package/dist/assets/backends/schtasks-template.xml +2 -1
- package/dist/assets/improve-strategies/catchup.json +3 -1
- package/dist/assets/improve-strategies/consolidate.json +3 -1
- package/dist/assets/improve-strategies/frequent.json +3 -1
- package/dist/assets/improve-strategies/graph-refresh.json +3 -1
- package/dist/assets/improve-strategies/memory-focus.json +4 -1
- package/dist/assets/improve-strategies/proactive-maintenance.json +1 -0
- package/dist/assets/improve-strategies/quick.json +3 -1
- package/dist/assets/improve-strategies/recombine-only.json +2 -0
- package/dist/assets/improve-strategies/reflect-distill.json +1 -0
- package/dist/assets/improve-strategies/synthesize.json +2 -0
- package/dist/assets/tasks/core/backup.yml +2 -2
- package/dist/cli/config-migrate.js +554 -26
- package/dist/cli.js +28 -11
- package/dist/commands/backup-cli.js +6 -4
- package/dist/commands/config-cli.js +10 -3
- package/dist/commands/feedback-cli.js +24 -7
- package/dist/commands/health/checks.js +94 -15
- package/dist/commands/health/html-report.js +23 -2
- package/dist/commands/health/improve-metrics.js +45 -6
- package/dist/commands/health/md-report.js +10 -1
- package/dist/commands/health/surfaces.js +2 -1
- package/dist/commands/health/windows.js +1 -1
- package/dist/commands/health.js +1 -1
- package/dist/commands/improve/anti-collapse.js +3 -3
- package/dist/commands/improve/collapse-detector.js +5 -5
- package/dist/commands/improve/consolidate.js +123 -66
- package/dist/commands/improve/distill/promote-memory.js +8 -6
- package/dist/commands/improve/distill/quality-gate.js +1 -1
- package/dist/commands/improve/distill-guards.js +1 -1
- package/dist/commands/improve/distill-promotion-policy.js +32 -26
- package/dist/commands/improve/distill.js +52 -36
- package/dist/commands/improve/eligibility.js +9 -8
- package/dist/commands/improve/extract-prompt.js +2 -2
- package/dist/commands/improve/extract.js +43 -11
- package/dist/commands/improve/improve-auto-accept.js +14 -28
- package/dist/commands/improve/improve-cli.js +4 -2
- package/dist/commands/improve/improve-strategies.js +2 -1
- package/dist/commands/improve/improve.js +49 -8
- package/dist/commands/improve/loop-stages.js +11 -6
- package/dist/commands/improve/preparation.js +51 -17
- package/dist/commands/improve/procedural.js +10 -6
- package/dist/commands/improve/recombine.js +31 -7
- package/dist/commands/improve/reflect.js +24 -14
- package/dist/commands/improve/salience.js +5 -1
- package/dist/commands/improve/source-identity.js +43 -0
- package/dist/commands/migrate-cli.js +36 -0
- package/dist/commands/mv-cli.js +647 -258
- package/dist/commands/proposal/drain.js +16 -4
- package/dist/commands/proposal/proposal-cli.js +3 -2
- package/dist/commands/proposal/proposal.js +16 -55
- package/dist/commands/proposal/repository.js +664 -58
- package/dist/commands/read/curate.js +4 -2
- package/dist/commands/read/knowledge.js +4 -1
- package/dist/commands/read/search.js +6 -2
- package/dist/commands/read/show.js +8 -7
- package/dist/commands/sources/self-update.js +156 -112
- package/dist/commands/sources/sources-cli.js +7 -2
- package/dist/commands/tasks/default-tasks.js +5 -5
- package/dist/commands/tasks/tasks-cli.js +7 -3
- package/dist/commands/tasks/tasks.js +261 -68
- package/dist/core/common.js +36 -3
- package/dist/core/config/config-io.js +2 -2
- package/dist/core/config/config-schema.js +15 -3
- package/dist/core/config/config.js +14 -13
- package/dist/core/file-lock.js +2 -2
- package/dist/core/improve-result.js +87 -7
- package/dist/core/migration-backup.js +816 -171
- package/dist/core/migration-operation.js +44 -0
- package/dist/core/state/migrations.js +4 -7
- package/dist/core/state-db.js +23 -7
- package/dist/core/write-source.js +86 -18
- package/dist/indexer/db/db.js +109 -53
- package/dist/indexer/index-writer-lock.js +38 -37
- package/dist/indexer/index-written-assets.js +73 -56
- package/dist/indexer/indexer.js +5 -1
- package/dist/indexer/search/search-source.js +2 -2
- package/dist/indexer/usage/usage-events.js +8 -2
- package/dist/integrations/agent/engine-resolution.js +14 -7
- package/dist/scripts/migrate-storage.js +887 -992
- package/dist/scripts/migrations/import-fs-improve-runs-to-db.js +494 -574
- package/dist/setup/detected-engines.js +7 -13
- package/dist/setup/engine-config.js +14 -4
- package/dist/setup/setup.js +1 -1
- package/dist/setup/steps/connection.js +1 -1
- package/dist/setup/steps/tasks.js +1 -1
- package/dist/sources/providers/git-stash.js +58 -21
- package/dist/sources/providers/git.js +1 -1
- package/dist/storage/engines/sqlite-migrations.js +138 -3
- package/dist/storage/repositories/events-repository.js +24 -0
- package/dist/storage/repositories/proposals-repository.js +14 -0
- package/dist/storage/repositories/task-history-repository.js +30 -3
- package/dist/tasks/backends/cron.js +71 -38
- package/dist/tasks/backends/exec-utils.js +55 -3
- package/dist/tasks/backends/launchd.js +241 -50
- package/dist/tasks/backends/schtasks.js +434 -59
- package/dist/tasks/command-executable.js +93 -0
- package/dist/tasks/embedded.js +2 -0
- package/dist/tasks/parser.js +142 -6
- package/dist/tasks/resolve-akm-bin.js +19 -4
- package/dist/tasks/runner.js +258 -93
- package/dist/tasks/schedule.js +108 -19
- package/dist/tasks/scheduler-invocation.js +86 -0
- package/dist/tasks/task-id.js +37 -0
- package/dist/workflows/db.js +24 -13
- package/dist/workflows/validator.js +24 -2
- package/docs/README.md +103 -0
- package/docs/migration/release-notes/0.9.0.md +28 -9
- package/docs/migration/v0.8-to-v0.9.md +186 -26
- package/package.json +2 -3
|
@@ -284,7 +284,7 @@ async function runJudgmentTier(input) {
|
|
|
284
284
|
continue;
|
|
285
285
|
}
|
|
286
286
|
try {
|
|
287
|
-
input.rejectFn({ stashDir: input.stashDir, id: item.id, reason: verdict.reason || "judgment: reject" });
|
|
287
|
+
await input.rejectFn({ stashDir: input.stashDir, id: item.id, reason: verdict.reason || "judgment: reject" });
|
|
288
288
|
rejected.push(item.id);
|
|
289
289
|
}
|
|
290
290
|
catch (err) {
|
|
@@ -314,7 +314,12 @@ async function runJudgmentTier(input) {
|
|
|
314
314
|
continue;
|
|
315
315
|
}
|
|
316
316
|
try {
|
|
317
|
-
await input.promoteFn({
|
|
317
|
+
await input.promoteFn({
|
|
318
|
+
stashDir: input.stashDir,
|
|
319
|
+
id: item.id,
|
|
320
|
+
...(input.target ? { target: input.target } : {}),
|
|
321
|
+
...(input.config ? { config: input.config } : {}),
|
|
322
|
+
});
|
|
318
323
|
promoted.push(item.id);
|
|
319
324
|
acceptBudget -= 1;
|
|
320
325
|
}
|
|
@@ -392,7 +397,7 @@ export async function drainProposals(opts, promoteFn = akmProposalAccept, reject
|
|
|
392
397
|
continue;
|
|
393
398
|
}
|
|
394
399
|
try {
|
|
395
|
-
rejectFn({ stashDir: opts.stashDir, id: target.id, reason: target.reason });
|
|
400
|
+
await rejectFn({ stashDir: opts.stashDir, id: target.id, reason: target.reason });
|
|
396
401
|
result.rejected.push(target.id);
|
|
397
402
|
}
|
|
398
403
|
catch (err) {
|
|
@@ -413,7 +418,12 @@ export async function drainProposals(opts, promoteFn = akmProposalAccept, reject
|
|
|
413
418
|
info(`[triage] auto-promote active: ${withinCap.length} accepts allowed this run`);
|
|
414
419
|
for (const id of withinCap) {
|
|
415
420
|
try {
|
|
416
|
-
await promoteFn({
|
|
421
|
+
await promoteFn({
|
|
422
|
+
stashDir: opts.stashDir,
|
|
423
|
+
id,
|
|
424
|
+
...(opts.target ? { target: opts.target } : {}),
|
|
425
|
+
...(opts.config ? { config: opts.config } : {}),
|
|
426
|
+
});
|
|
417
427
|
result.promoted.push(id);
|
|
418
428
|
deterministicPromoted += 1;
|
|
419
429
|
}
|
|
@@ -447,6 +457,8 @@ export async function drainProposals(opts, promoteFn = akmProposalAccept, reject
|
|
|
447
457
|
promoteFn,
|
|
448
458
|
rejectFn,
|
|
449
459
|
seams: judgmentSeams,
|
|
460
|
+
...(opts.target ? { target: opts.target } : {}),
|
|
461
|
+
...(opts.config ? { config: opts.config } : {}),
|
|
450
462
|
remainingAcceptBudget,
|
|
451
463
|
});
|
|
452
464
|
result.promoted.push(...tier.promoted);
|
|
@@ -224,7 +224,7 @@ const proposalRejectCommand = defineJsonCommand({
|
|
|
224
224
|
results.push({ id: proposal.id, ref: proposal.ref, source: proposal.source, dryRun: true });
|
|
225
225
|
}
|
|
226
226
|
else {
|
|
227
|
-
const result = akmProposalReject({ id: proposal.id, reason: String(args.reason) });
|
|
227
|
+
const result = await akmProposalReject({ id: proposal.id, reason: String(args.reason) });
|
|
228
228
|
results.push(result);
|
|
229
229
|
}
|
|
230
230
|
}
|
|
@@ -242,7 +242,7 @@ const proposalRejectCommand = defineJsonCommand({
|
|
|
242
242
|
process.stderr.write("Aborted.\n");
|
|
243
243
|
return;
|
|
244
244
|
}
|
|
245
|
-
const result = akmProposalReject({ id: args.id, reason: String(args.reason) });
|
|
245
|
+
const result = await akmProposalReject({ id: args.id, reason: String(args.reason) });
|
|
246
246
|
output("proposal-reject", result);
|
|
247
247
|
},
|
|
248
248
|
});
|
|
@@ -422,6 +422,7 @@ const proposalDrainCommand = defineJsonCommand({
|
|
|
422
422
|
try {
|
|
423
423
|
result = await withLlmStage("drain", () => drainProposals({
|
|
424
424
|
stashDir,
|
|
425
|
+
config: cfg,
|
|
425
426
|
policy,
|
|
426
427
|
applyMode,
|
|
427
428
|
maxAccepts,
|
|
@@ -13,9 +13,8 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { resolveStashDir } from "../../core/common.js";
|
|
15
15
|
import { loadConfig } from "../../core/config/config.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { archiveProposal, createProposal, diffProposal, getProposal, isProposalSkipped, listProposals, promoteProposal, resolveProposalId, revertProposal, } from "./repository.js";
|
|
16
|
+
import { withAssetMutationLease } from "../../indexer/index-writer-lock.js";
|
|
17
|
+
import { createProposal, diffProposal, getProposal, isProposalSkipped, listProposals, promoteProposal, recoverProposalTransactionsForStash, rejectProposalDurably, resolveProposalId, revertProposal, } from "./repository.js";
|
|
19
18
|
import { validateProposal } from "./validators/proposals.js";
|
|
20
19
|
// ── Shared helpers ──────────────────────────────────────────────────────────
|
|
21
20
|
function resolveStash(stashDir) {
|
|
@@ -64,25 +63,6 @@ export async function akmProposalAccept(options) {
|
|
|
64
63
|
const config = options.config ?? loadConfig();
|
|
65
64
|
const resolvedId = resolveProposalId(stash, options.id).id;
|
|
66
65
|
const result = await promoteProposal(stash, config, resolvedId, { target: options.target }, options.ctx);
|
|
67
|
-
// Emit `promoted` to the events stream so observers (audit, dashboards,
|
|
68
|
-
// sync) see the accept happen. Only emit on the happy path — promotion
|
|
69
|
-
// throws on validation failure, so reaching this point means the asset
|
|
70
|
-
// is committed.
|
|
71
|
-
appendEvent({
|
|
72
|
-
eventType: "promoted",
|
|
73
|
-
ref: result.ref,
|
|
74
|
-
metadata: {
|
|
75
|
-
proposalId: result.proposal.id,
|
|
76
|
-
source: result.proposal.source,
|
|
77
|
-
...(result.proposal.sourceRun !== undefined ? { sourceRun: result.proposal.sourceRun } : {}),
|
|
78
|
-
assetPath: result.assetPath,
|
|
79
|
-
// Attribution tagging: carry the eligibility lane from the proposal record
|
|
80
|
-
// onto the promoted event so accept outcomes can be sliced by lane.
|
|
81
|
-
...(result.proposal.eligibilitySource !== undefined
|
|
82
|
-
? { eligibilitySource: result.proposal.eligibilitySource }
|
|
83
|
-
: {}),
|
|
84
|
-
},
|
|
85
|
-
});
|
|
86
66
|
return {
|
|
87
67
|
schemaVersion: 1,
|
|
88
68
|
ok: true,
|
|
@@ -92,31 +72,22 @@ export async function akmProposalAccept(options) {
|
|
|
92
72
|
proposal: result.proposal,
|
|
93
73
|
};
|
|
94
74
|
}
|
|
95
|
-
export function akmProposalReject(options) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
source: updated.source,
|
|
108
|
-
...(updated.sourceRun !== undefined ? { sourceRun: updated.sourceRun } : {}),
|
|
75
|
+
export async function akmProposalReject(options) {
|
|
76
|
+
return withAssetMutationLease("proposal-reject", async () => {
|
|
77
|
+
const stash = resolveStash(options.stashDir);
|
|
78
|
+
const config = options.config ?? loadConfig();
|
|
79
|
+
const proposalId = resolveProposalId(stash, options.id).id;
|
|
80
|
+
await recoverProposalTransactionsForStash(stash, config, options.ctx, proposalId);
|
|
81
|
+
const updated = rejectProposalDurably(stash, proposalId, options.reason, options.ctx);
|
|
82
|
+
return {
|
|
83
|
+
schemaVersion: 1,
|
|
84
|
+
ok: true,
|
|
85
|
+
id: updated.id,
|
|
86
|
+
ref: updated.ref,
|
|
109
87
|
...(options.reason !== undefined ? { reason: options.reason } : {}),
|
|
110
|
-
|
|
88
|
+
proposal: updated,
|
|
89
|
+
};
|
|
111
90
|
});
|
|
112
|
-
return {
|
|
113
|
-
schemaVersion: 1,
|
|
114
|
-
ok: true,
|
|
115
|
-
id: updated.id,
|
|
116
|
-
ref: updated.ref,
|
|
117
|
-
...(options.reason !== undefined ? { reason: options.reason } : {}),
|
|
118
|
-
proposal: updated,
|
|
119
|
-
};
|
|
120
91
|
}
|
|
121
92
|
export function akmProposalDiff(options) {
|
|
122
93
|
const stash = resolveStash(options.stashDir);
|
|
@@ -170,16 +141,6 @@ export async function akmProposalRevert(options) {
|
|
|
170
141
|
const config = options.config ?? loadConfig();
|
|
171
142
|
const resolvedId = resolveProposalId(stash, options.id).id;
|
|
172
143
|
const result = await revertProposal(stash, config, resolvedId, { target: options.target }, options.ctx);
|
|
173
|
-
appendEvent({
|
|
174
|
-
eventType: "proposal_reverted",
|
|
175
|
-
ref: result.ref,
|
|
176
|
-
metadata: {
|
|
177
|
-
proposalId: result.proposal.id,
|
|
178
|
-
source: result.proposal.source,
|
|
179
|
-
...(result.proposal.sourceRun !== undefined ? { sourceRun: result.proposal.sourceRun } : {}),
|
|
180
|
-
assetPath: result.assetPath,
|
|
181
|
-
},
|
|
182
|
-
});
|
|
183
144
|
return {
|
|
184
145
|
schemaVersion: 1,
|
|
185
146
|
ok: true,
|