fapony 0.3.3 → 0.3.5
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 +7 -1
- package/fapony.ts +3 -116
- package/package.json +5 -6
- package/skill/move-to-done/SKILL.md +3 -2
- package/src/adapters/cli.ts +128 -0
- package/src/adapters/hooks/compute-hint-impact.ts +107 -0
- package/src/adapters/hooks/context-data.ts +102 -0
- package/src/adapters/hooks/edit-hint.ts +195 -0
- package/src/adapters/hooks/git-autonomy.ts +178 -0
- package/src/adapters/hooks/index.ts +80 -0
- package/src/adapters/hooks/mv-guard.ts +52 -0
- package/src/adapters/hooks/read-hint.ts +383 -0
- package/src/adapters/hooks/session-start.ts +101 -0
- package/src/adapters/hooks/stop.ts +434 -0
- package/src/{mcp → adapters/mcp}/evidence.ts +2 -2
- package/src/{mcp → adapters/mcp}/primitives.ts +2 -2
- package/src/{mcp → adapters/mcp}/tools/check.ts +1 -1
- package/src/{mcp → adapters/mcp}/tools/collect.ts +1 -1
- package/src/{mcp → adapters/mcp}/tools/mem.ts +3 -3
- package/src/{mcp → adapters/mcp}/tools/report.ts +4 -4
- package/src/adapters/mcp/types.ts +18 -0
- package/src/{mcp → adapters/mcp}/worktree.ts +1 -1
- package/src/analyze.ts +1 -1
- package/src/commands.ts +180 -0
- package/src/conventions-seed.ts +1 -1
- package/src/core/config.ts +199 -0
- package/src/core/debt-format.ts +107 -0
- package/src/core/debt-types.ts +79 -0
- package/src/core/defaults.ts +8 -0
- package/src/core/enums.ts +34 -0
- package/src/core/format.ts +33 -0
- package/src/core/hint-log.ts +68 -0
- package/src/core/hook-helpers.ts +31 -0
- package/src/core/mem-log.ts +357 -0
- package/src/core/parse.ts +71 -0
- package/src/core/pricing.ts +217 -0
- package/src/core/safety.ts +18 -0
- package/src/core/types.ts +142 -0
- package/src/core/util.ts +105 -0
- package/src/db/store.ts +2 -2
- package/src/debt/cli.ts +1 -1
- package/src/debt/format.ts +2 -107
- package/src/debt/load.ts +1 -1
- package/src/debt/promotion.ts +1 -1
- package/src/debt/types.ts +14 -79
- package/src/digest/collect.ts +4 -3
- package/src/gate.ts +2 -2
- package/src/gates.ts +1 -1
- package/src/hook.ts +70 -1424
- package/src/init-mem.ts +1 -1
- package/src/init.ts +1 -1
- package/src/install/claude.ts +17 -0
- package/src/install/opencode.ts +114 -0
- package/src/install.ts +12 -5
- package/src/lint-baseline.ts +1 -2
- package/src/map.ts +29 -8
- package/src/mem/commands/plan.ts +197 -42
- package/src/mem/commands/read.ts +53 -12
- package/src/mem/index.ts +60 -1
- package/src/mem/store.ts +5 -1
- package/src/memory.ts +26 -388
- package/src/parse.ts +9 -71
- package/src/price/fetch.ts +4 -16
- package/src/price/resolve.ts +12 -213
- package/src/report/cli.ts +3 -3
- package/src/safety.ts +2 -18
- package/src/seed/plan-seed.ts +126 -32
- package/src/seed/primitives.ts +1 -7
- package/src/session/types.ts +14 -128
- package/src/setup.ts +1 -1
- package/src/stats/data.ts +3 -3
- package/src/telemetry.ts +2 -2
- package/src/update.ts +1 -1
- package/src/usage/cache.ts +1 -2
- package/src/usage/cli.ts +1 -1
- package/src/usage/scan.ts +2 -1
- package/src/util.ts +10 -93
- package/src/web/html.ts +2 -33
- package/src/db/defaults.ts +0 -34
- package/src/db/getters.ts +0 -35
- package/src/db/index.ts +0 -7
- package/src/db/load.ts +0 -57
- package/src/db/types.ts +0 -77
- package/src/mcp/types.ts +0 -54
- package/src/test.ts +0 -2
- /package/src/{mcp → adapters/mcp}/tools/index.ts +0 -0
- /package/src/{mcp → adapters/mcp}/transport.ts +0 -0
package/src/debt/types.ts
CHANGED
|
@@ -1,79 +1,14 @@
|
|
|
1
|
-
// src/debt
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
/** Regex source: files that already moved (informational count). */
|
|
16
|
-
ok?: string;
|
|
17
|
-
/** Regex source a file must ALSO match to be in scope (e.g. "extends Base"). */
|
|
18
|
-
guard?: string;
|
|
19
|
-
/** Non-null = a checker (eslint rule / script) exists → fapony never reports this debt. */
|
|
20
|
-
checker?: string | null;
|
|
21
|
-
/** Human answered "no checker" on the promotion question — never ask again. */
|
|
22
|
-
decided?: "no-checker" | null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface LoadedConventions {
|
|
26
|
-
path: string | null;
|
|
27
|
-
convs: Convention[];
|
|
28
|
-
/** Rows kept for display but not scannable, plus invalid rows — said out loud, never silent. */
|
|
29
|
-
warnings: string[];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface DebtEntry {
|
|
33
|
-
conv: Convention;
|
|
34
|
-
/** Files with the debt (stale match), sorted. */
|
|
35
|
-
files: string[];
|
|
36
|
-
/** Files that already moved (ok match) — null when ok is not set. */
|
|
37
|
-
movedCount: number | null;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface DebtReport {
|
|
41
|
-
worktree: string;
|
|
42
|
-
scannedFiles: number;
|
|
43
|
-
ms: number;
|
|
44
|
-
/** Scannable conventions with their debt list (checker rows never land here). */
|
|
45
|
-
entries: DebtEntry[];
|
|
46
|
-
/** Declared but not fillable by fapony: checker null + no stale — the human/agent fills `stale`. */
|
|
47
|
-
declared: Convention[];
|
|
48
|
-
/** Skipped-with-reason: checker rows are silent by design (not dropped), these are real drops. */
|
|
49
|
-
dropped: { id: string; reason: string }[];
|
|
50
|
-
/** Silent-by-design count: checker non-null — reported as a number, not a list. */
|
|
51
|
-
checkedCount: number;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export interface Promotion {
|
|
55
|
-
convId: string;
|
|
56
|
-
rule: string;
|
|
57
|
-
occurrences: number;
|
|
58
|
-
dates: string[];
|
|
59
|
-
debtCount: number;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// A stale regex matching more than this many files is not a convention — it is
|
|
63
|
-
// a broken/wide regex (stale="e" would flag the repo). SPEC §6: drop the entry
|
|
64
|
-
// and say so, never report 600 files.
|
|
65
|
-
export const DEBT_FILE_CAP = 250;
|
|
66
|
-
|
|
67
|
-
export const PROMOTION_THRESHOLD = 3;
|
|
68
|
-
export const PROMOTION_MAX = 3;
|
|
69
|
-
/** Identifiers shorter than this are too generic to match prose on ("throw", "Error"). */
|
|
70
|
-
export const WORD_MIN = 6;
|
|
71
|
-
|
|
72
|
-
// Zone grouping: a zone is a file's *directory*, capped at this many leading
|
|
73
|
-
// segments — never a fixed-depth prefix of the path (which would cut into the
|
|
74
|
-
// filename) and never the filename itself. SPEC §4 shows zones at depth 5
|
|
75
|
-
// (`apps/mdl/src/server/services`) and depth 3 (`packages/cache/src`) in the
|
|
76
|
-
// same report, so the cap must follow the directory, not a constant.
|
|
77
|
-
export const ZONE_DEPTH = 5;
|
|
78
|
-
// Default cap on zones shown per convention — more than this is a wall, not an answer.
|
|
79
|
-
export const ZONE_CAP = 6;
|
|
1
|
+
// shim — moved to src/core/debt-types.ts
|
|
2
|
+
export {
|
|
3
|
+
type Convention,
|
|
4
|
+
DEBT_FILE_CAP,
|
|
5
|
+
type DebtEntry,
|
|
6
|
+
type DebtReport,
|
|
7
|
+
type LoadedConventions,
|
|
8
|
+
PROMOTION_MAX,
|
|
9
|
+
PROMOTION_THRESHOLD,
|
|
10
|
+
type Promotion,
|
|
11
|
+
WORD_MIN,
|
|
12
|
+
ZONE_CAP,
|
|
13
|
+
ZONE_DEPTH,
|
|
14
|
+
} from "../core/debt-types.js";
|
package/src/digest/collect.ts
CHANGED
|
@@ -10,11 +10,12 @@ import {
|
|
|
10
10
|
doneDir,
|
|
11
11
|
type Event,
|
|
12
12
|
loadConfig,
|
|
13
|
-
openDb,
|
|
14
13
|
planDir,
|
|
15
14
|
type Run,
|
|
16
|
-
} from "../
|
|
17
|
-
import {
|
|
15
|
+
} from "../core/config.js";
|
|
16
|
+
import { type HintImpact, hintLogPath } from "../core/hint-log.js";
|
|
17
|
+
import { openDb } from "../db/store.js";
|
|
18
|
+
import { computeHintImpact } from "../hook.js";
|
|
18
19
|
import { type MemRow, readMemLog } from "../memory.js";
|
|
19
20
|
import { isPassFamily, VERDICT_GRADES } from "../parse.js";
|
|
20
21
|
import { imputeResult, loadPrices } from "../price/index.js";
|
package/src/gate.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// gateOnce is the core review-verdict logic — still live, called by the CLI
|
|
2
2
|
// wrapper (cmdGate) was removed with the rest of the execute→review→fix loop
|
|
3
3
|
// (Wave 2). The MCP verdict_submit tool was removed in PLAN-verdict-to-mem.
|
|
4
|
+
import { loadConfig } from "./core/config.js";
|
|
4
5
|
import {
|
|
5
6
|
addEvent,
|
|
6
7
|
getRun,
|
|
7
8
|
incrementRound,
|
|
8
|
-
loadConfig,
|
|
9
9
|
openDb,
|
|
10
10
|
setStatus,
|
|
11
|
-
} from "./db/
|
|
11
|
+
} from "./db/store.js";
|
|
12
12
|
import { closeMemory, kickoffMemory } from "./memory.js";
|
|
13
13
|
import { isPassFamily, type VerdictGrade } from "./parse.js";
|
|
14
14
|
|
package/src/gates.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// cumulative. Events arrive sorted (run_id, id), so one bucketing pass plus a
|
|
10
10
|
// forward spawn pointer over the disjoint windows is O(events) total.
|
|
11
11
|
|
|
12
|
-
import type { Event } from "./
|
|
12
|
+
import type { Event } from "./core/config.js";
|
|
13
13
|
import { qualityScore, VERDICT_GRADES, type VerdictGrade } from "./parse.js";
|
|
14
14
|
import {
|
|
15
15
|
findSessionAt,
|