homegraph 1.1.2 → 1.1.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/LICENSE +21 -21
- package/README.md +243 -243
- package/dist/bin/homegraph.js +371 -9
- package/dist/bin/homegraph.js.map +1 -1
- package/dist/db/migrations.js +18 -18
- package/dist/db/queries.js +140 -140
- package/dist/db/schema.sql +152 -152
- package/dist/directory.js +5 -5
- package/dist/extraction/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/dist/extraction/wasm/tree-sitter-pascal.wasm +0 -0
- package/dist/installer/instructions-template.js +9 -9
- package/dist/installer/targets/shared.d.ts +5 -6
- package/dist/installer/targets/shared.d.ts.map +1 -1
- package/dist/installer/targets/shared.js +5 -6
- package/dist/installer/targets/shared.js.map +1 -1
- package/dist/mcp/liveness-watchdog.js +16 -16
- package/dist/mcp/server-instructions.js +69 -69
- package/dist/mcp/tools.d.ts +17 -4
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +192 -22
- package/dist/mcp/tools.js.map +1 -1
- package/dist/reasoning/reasoner.js +32 -32
- package/dist/spec/config.d.ts +43 -0
- package/dist/spec/config.d.ts.map +1 -0
- package/dist/spec/config.js +275 -0
- package/dist/spec/config.js.map +1 -0
- package/dist/spec/db/commit-node.d.ts +23 -0
- package/dist/spec/db/commit-node.d.ts.map +1 -0
- package/dist/spec/db/commit-node.js +62 -0
- package/dist/spec/db/commit-node.js.map +1 -0
- package/dist/spec/db/fragment-node.d.ts +23 -0
- package/dist/spec/db/fragment-node.d.ts.map +1 -0
- package/dist/spec/db/fragment-node.js +120 -0
- package/dist/spec/db/fragment-node.js.map +1 -0
- package/dist/spec/db/fts.d.ts +60 -0
- package/dist/spec/db/fts.d.ts.map +1 -0
- package/dist/spec/db/fts.js +285 -0
- package/dist/spec/db/fts.js.map +1 -0
- package/dist/spec/db/index.d.ts +13 -0
- package/dist/spec/db/index.d.ts.map +1 -0
- package/dist/spec/db/index.js +50 -0
- package/dist/spec/db/index.js.map +1 -0
- package/dist/spec/db/relations.d.ts +55 -0
- package/dist/spec/db/relations.d.ts.map +1 -0
- package/dist/spec/db/relations.js +158 -0
- package/dist/spec/db/relations.js.map +1 -0
- package/dist/spec/db/schema.d.ts +30 -0
- package/dist/spec/db/schema.d.ts.map +1 -0
- package/dist/spec/db/schema.js +87 -0
- package/dist/spec/db/schema.js.map +1 -0
- package/dist/spec/db/schema.sql +107 -0
- package/dist/spec/db/spec-node.d.ts +41 -0
- package/dist/spec/db/spec-node.d.ts.map +1 -0
- package/dist/spec/db/spec-node.js +114 -0
- package/dist/spec/db/spec-node.js.map +1 -0
- package/dist/spec/evolve/impact-locator.d.ts +13 -0
- package/dist/spec/evolve/impact-locator.d.ts.map +1 -0
- package/dist/spec/evolve/impact-locator.js +25 -0
- package/dist/spec/evolve/impact-locator.js.map +1 -0
- package/dist/spec/evolve/llm-client.d.ts +50 -0
- package/dist/spec/evolve/llm-client.d.ts.map +1 -0
- package/dist/spec/evolve/llm-client.js +176 -0
- package/dist/spec/evolve/llm-client.js.map +1 -0
- package/dist/spec/evolve/logic-checker.d.ts +12 -0
- package/dist/spec/evolve/logic-checker.d.ts.map +1 -0
- package/dist/spec/evolve/logic-checker.js +48 -0
- package/dist/spec/evolve/logic-checker.js.map +1 -0
- package/dist/spec/evolve/pipeline.d.ts +40 -0
- package/dist/spec/evolve/pipeline.d.ts.map +1 -0
- package/dist/spec/evolve/pipeline.js +314 -0
- package/dist/spec/evolve/pipeline.js.map +1 -0
- package/dist/spec/evolve/spec-rewriter.d.ts +42 -0
- package/dist/spec/evolve/spec-rewriter.d.ts.map +1 -0
- package/dist/spec/evolve/spec-rewriter.js +254 -0
- package/dist/spec/evolve/spec-rewriter.js.map +1 -0
- package/dist/spec/graph/queries.d.ts +58 -0
- package/dist/spec/graph/queries.d.ts.map +1 -0
- package/dist/spec/graph/queries.js +215 -0
- package/dist/spec/graph/queries.js.map +1 -0
- package/dist/spec/mining/diff-parser.d.ts +33 -0
- package/dist/spec/mining/diff-parser.d.ts.map +1 -0
- package/dist/spec/mining/diff-parser.js +166 -0
- package/dist/spec/mining/diff-parser.js.map +1 -0
- package/dist/spec/mining/git-scanner.d.ts +91 -0
- package/dist/spec/mining/git-scanner.d.ts.map +1 -0
- package/dist/spec/mining/git-scanner.js +266 -0
- package/dist/spec/mining/git-scanner.js.map +1 -0
- package/dist/spec/mining/pipeline.d.ts +53 -0
- package/dist/spec/mining/pipeline.d.ts.map +1 -0
- package/dist/spec/mining/pipeline.js +165 -0
- package/dist/spec/mining/pipeline.js.map +1 -0
- package/dist/spec/mining/scope-resolver.d.ts +45 -0
- package/dist/spec/mining/scope-resolver.d.ts.map +1 -0
- package/dist/spec/mining/scope-resolver.js +103 -0
- package/dist/spec/mining/scope-resolver.js.map +1 -0
- package/dist/spec/mining/spec-extractor.d.ts +69 -0
- package/dist/spec/mining/spec-extractor.d.ts.map +1 -0
- package/dist/spec/mining/spec-extractor.js +369 -0
- package/dist/spec/mining/spec-extractor.js.map +1 -0
- package/dist/spec/types.d.ts +149 -0
- package/dist/spec/types.d.ts.map +1 -0
- package/dist/spec/types.js +15 -0
- package/dist/spec/types.js.map +1 -0
- package/dist/spec/utils.d.ts +166 -0
- package/dist/spec/utils.d.ts.map +1 -0
- package/dist/spec/utils.js +461 -0
- package/dist/spec/utils.js.map +1 -0
- package/package.json +58 -57
- package/scripts/add-lang/bench.sh +60 -60
- package/scripts/add-lang/check-grammar.mjs +75 -75
- package/scripts/add-lang/dump-ast.mjs +103 -103
- package/scripts/add-lang/verify-extraction.mjs +70 -70
- package/scripts/agent-eval/ab-adoption.sh +91 -91
- package/scripts/agent-eval/ab-hook.sh +86 -86
- package/scripts/agent-eval/ab-impl.sh +78 -78
- package/scripts/agent-eval/ab-new-vs-baseline.sh +102 -102
- package/scripts/agent-eval/ab-sufficiency.sh +78 -78
- package/scripts/agent-eval/arms-F.sh +21 -21
- package/scripts/agent-eval/arms-matrix.sh +37 -37
- package/scripts/agent-eval/audit.sh +68 -68
- package/scripts/agent-eval/bench-readme.sh +28 -28
- package/scripts/agent-eval/bench-why-repo.sh +22 -22
- package/scripts/agent-eval/block-read-hook.sh +19 -19
- package/scripts/agent-eval/hook-settings.json +15 -15
- package/scripts/agent-eval/itrun.sh +120 -120
- package/scripts/agent-eval/offload-eval-3arm.sh +72 -72
- package/scripts/agent-eval/offload-eval-cost.mjs +133 -133
- package/scripts/agent-eval/offload-eval-effort.mjs +108 -108
- package/scripts/agent-eval/offload-eval-frontload-matrix.sh +25 -25
- package/scripts/agent-eval/offload-eval-frontload.sh +47 -47
- package/scripts/agent-eval/offload-eval-ground-truth.json +18 -18
- package/scripts/agent-eval/offload-eval-hook.mjs +84 -84
- package/scripts/agent-eval/offload-eval-judge.mjs +103 -103
- package/scripts/agent-eval/offload-eval-matrix.sh +20 -20
- package/scripts/agent-eval/offload-eval-metrics.mjs +94 -94
- package/scripts/agent-eval/offload-eval-refs1.sh +50 -50
- package/scripts/agent-eval/offload-eval-setup.sh +24 -24
- package/scripts/agent-eval/offload-eval-styles.sh +71 -71
- package/scripts/agent-eval/offload-eval-summarize.mjs +68 -68
- package/scripts/agent-eval/offload-eval.md +76 -76
- package/scripts/agent-eval/parse-arms.mjs +116 -116
- package/scripts/agent-eval/parse-bench-readme.mjs +84 -84
- package/scripts/agent-eval/parse-run.mjs +45 -45
- package/scripts/agent-eval/parse-session.mjs +93 -93
- package/scripts/agent-eval/probe-context.mjs +21 -21
- package/scripts/agent-eval/probe-explore.mjs +40 -40
- package/scripts/agent-eval/probe-node.mjs +20 -20
- package/scripts/agent-eval/probe-sweep.mjs +119 -119
- package/scripts/agent-eval/probe-trace.mjs +20 -20
- package/scripts/agent-eval/redirect-read-hook.sh +38 -38
- package/scripts/agent-eval/run-agent.sh +34 -34
- package/scripts/agent-eval/run-all.sh +69 -69
- package/scripts/agent-eval/run-arms.sh +56 -56
- package/scripts/agent-eval/seq-matrix.mjs +137 -137
- package/scripts/build-bundle.sh +118 -118
- package/scripts/extract-release-notes.mjs +130 -130
- package/scripts/local-install.sh +41 -41
- package/scripts/npm-sdk.js +75 -75
- package/scripts/npm-shim.js +246 -246
- package/scripts/pack-npm.sh +119 -119
- package/scripts/prepare-release.mjs +270 -270
- package/scripts/qa_eval/README.md +407 -404
- package/scripts/qa_eval/_test_deveco_probe.py +41 -41
- package/scripts/qa_eval/agent_runner.py +526 -526
- package/scripts/qa_eval/data/.gitignore +4 -4
- package/scripts/qa_eval/data/test-set.jsonl +2 -22
- package/scripts/qa_eval/eval_metrics.py +274 -233
- package/scripts/qa_eval/external_agent.py +976 -671
- package/scripts/qa_eval/llm_config.py +92 -92
- package/scripts/qa_eval/memory_monitor.py +132 -132
- package/scripts/qa_eval/my_answer_accuracy.py +187 -187
- package/scripts/qa_eval/requirements.txt +2 -2
- package/scripts/qa_eval/run_pipeline.py +804 -711
- package/scripts/qa_eval/stats_efficiency.py +279 -279
- package/scripts/qa_eval/stats_scores.py +207 -207
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spec utility functions — replaces `file_utils.py`, `meta.py`, and
|
|
3
|
+
* `truncate.py` from Python Commit4Spec.
|
|
4
|
+
*
|
|
5
|
+
* Covers file I/O, meta.json read/write, text/diff truncation, and budget
|
|
6
|
+
* computation. All functions are synchronous and use Node.js built-ins.
|
|
7
|
+
*
|
|
8
|
+
* @module spec/utils
|
|
9
|
+
*/
|
|
10
|
+
export interface SpecEntry {
|
|
11
|
+
specId: string;
|
|
12
|
+
entryType: 'directory' | 'file';
|
|
13
|
+
path: string;
|
|
14
|
+
}
|
|
15
|
+
export interface SpecMeta {
|
|
16
|
+
repoPath: string;
|
|
17
|
+
specStoragePath: string;
|
|
18
|
+
createdAt?: string;
|
|
19
|
+
updatedAt: string;
|
|
20
|
+
}
|
|
21
|
+
export interface BudgetProfile {
|
|
22
|
+
tier: 'tiny' | 'small' | 'medium' | 'large' | 'vlarge';
|
|
23
|
+
maxFragments: number;
|
|
24
|
+
maxContents: number;
|
|
25
|
+
contentBudget: number;
|
|
26
|
+
}
|
|
27
|
+
/** Root directory for spec data, relative to the repository root. */
|
|
28
|
+
export declare const SPEC_DATA_DIR = ".homegraph/commit4spec";
|
|
29
|
+
/**
|
|
30
|
+
* Read a UTF-8 file synchronously.
|
|
31
|
+
*
|
|
32
|
+
* Returns `null` for ENOENT (not found), EISDIR (is a directory), or EACCES
|
|
33
|
+
* (permission denied). Other errors propagate.
|
|
34
|
+
*/
|
|
35
|
+
export declare function readFileContent(filePath: string): string | null;
|
|
36
|
+
/**
|
|
37
|
+
* Write a UTF-8 file synchronously, creating parent directories as needed.
|
|
38
|
+
*
|
|
39
|
+
* Parent directories are created with `fs.mkdirSync({ recursive: true })`.
|
|
40
|
+
* If the parent exists but is not a directory the underlying error propagates.
|
|
41
|
+
*/
|
|
42
|
+
export declare function writeFileContent(filePath: string, content: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* Parse commit-info.md content for a commit hash.
|
|
45
|
+
*
|
|
46
|
+
* Searches line by line for one of:
|
|
47
|
+
* - `commit: HASH`
|
|
48
|
+
* - `commit-id: HASH`
|
|
49
|
+
* - `commit_id: HASH`
|
|
50
|
+
* - a bare 40-char hex hash on its own line
|
|
51
|
+
*
|
|
52
|
+
* Returns the first matched hash (7–40 hex chars), or `null` if no hash is
|
|
53
|
+
* found. Empty or whitespace-only input returns `null`.
|
|
54
|
+
*/
|
|
55
|
+
export declare function parseCommitInfoMd(content: string): string | null;
|
|
56
|
+
/**
|
|
57
|
+
* Discover specs in a storage directory.
|
|
58
|
+
*
|
|
59
|
+
* A "spec" is any `.md` file OR any subdirectory. For `.md` files the
|
|
60
|
+
* `specId` is the basename without the extension. For subdirectories the
|
|
61
|
+
* `specId` is the directory name.
|
|
62
|
+
*
|
|
63
|
+
* Returns an empty array when `specStoragePath` does not exist or is not a
|
|
64
|
+
* directory.
|
|
65
|
+
*/
|
|
66
|
+
export declare function discoverSpecs(specStoragePath: string): SpecEntry[];
|
|
67
|
+
/**
|
|
68
|
+
* Resolve the database path.
|
|
69
|
+
*
|
|
70
|
+
* Priority:
|
|
71
|
+
* 1. If `explicitDbPath` is given, return it as-is (no side effects).
|
|
72
|
+
* 2. If `repoPath` is given, default to `{repoPath}/${SPEC_DATA_DIR}/commit4spec.db`
|
|
73
|
+
* and ensure `${SPEC_DATA_DIR}/.gitignore` exists containing `"*"`.
|
|
74
|
+
* 3. If neither is given, return `"./commit4spec.db"`.
|
|
75
|
+
*/
|
|
76
|
+
export declare function resolveDbPath(repoPath?: string, explicitDbPath?: string): string;
|
|
77
|
+
/**
|
|
78
|
+
* Read `${SPEC_DATA_DIR}/meta.json` from `repoPath`.
|
|
79
|
+
*
|
|
80
|
+
* Returns `null` when the file is missing, unreadable, or contains invalid
|
|
81
|
+
* JSON or a JSON value that is not a plain object.
|
|
82
|
+
*/
|
|
83
|
+
export declare function readMeta(repoPath: string): SpecMeta | null;
|
|
84
|
+
/**
|
|
85
|
+
* Write `${SPEC_DATA_DIR}/meta.json` to `repoPath`.
|
|
86
|
+
*
|
|
87
|
+
* If existing meta has a `createdAt` field it is preserved; otherwise a new
|
|
88
|
+
* ISO-8601 timestamp is generated. `updatedAt` is always set to the current
|
|
89
|
+
* time. The `${SPEC_DATA_DIR}` directory is created if it does not exist.
|
|
90
|
+
*
|
|
91
|
+
* Returns the full `SpecMeta` that was written.
|
|
92
|
+
*/
|
|
93
|
+
export declare function writeMeta(repoPath: string, specStoragePath: string): SpecMeta;
|
|
94
|
+
/**
|
|
95
|
+
* Truncate a unified diff at a sensible boundary.
|
|
96
|
+
*
|
|
97
|
+
* The algorithm prefers semantic boundaries to keep diffs readable:
|
|
98
|
+
*
|
|
99
|
+
* 1. If the diff is shorter than `maxChars` (default 3800), return it unchanged.
|
|
100
|
+
* 2. Try: find the **last** `@@` hunk header in the trailing 50% portion of
|
|
101
|
+
* the diff and cut right before it.
|
|
102
|
+
* 3. Fallback: find the **last** newline in the trailing 80% portion and cut
|
|
103
|
+
* after it.
|
|
104
|
+
* 4. Hard fallback: cut exactly at `maxChars`.
|
|
105
|
+
*
|
|
106
|
+
* Always appends `" …(truncated)"` when truncation occurs.
|
|
107
|
+
*
|
|
108
|
+
* @param diff - The unified diff text to truncate.
|
|
109
|
+
* @param maxChars - Maximum allowed characters (including suffix). Default 3800.
|
|
110
|
+
* @returns The (possibly truncated) diff text.
|
|
111
|
+
*/
|
|
112
|
+
export declare function truncateCodeDiff(diff: string, maxChars?: number): string;
|
|
113
|
+
/**
|
|
114
|
+
* Truncate plain text with newline-awareness.
|
|
115
|
+
*
|
|
116
|
+
* When the text is longer than `maxChars`, it is cut at the last newline
|
|
117
|
+
* found before `maxChars` (minus the suffix length). If no suitable newline
|
|
118
|
+
* exists, a hard cut is made.
|
|
119
|
+
*
|
|
120
|
+
* The suffix `" …(truncated)"` is appended only when truncation occurs.
|
|
121
|
+
*
|
|
122
|
+
* @param text - The text to truncate.
|
|
123
|
+
* @param maxChars - Maximum allowed characters (including suffix).
|
|
124
|
+
* @returns The (possibly truncated) text.
|
|
125
|
+
*/
|
|
126
|
+
export declare function truncateText(text: string, maxChars: number): string;
|
|
127
|
+
/**
|
|
128
|
+
* Truncate a subtitles array.
|
|
129
|
+
*
|
|
130
|
+
* 1. If the array has more than `maxEntries`, it is sliced to `maxEntries`.
|
|
131
|
+
* 2. Each remaining entry that exceeds `maxChars` is individually truncated
|
|
132
|
+
* via `truncateText`.
|
|
133
|
+
*
|
|
134
|
+
* Entries that already fit within both limits are left unchanged.
|
|
135
|
+
*
|
|
136
|
+
* @param subtitles - Array of subtitle strings.
|
|
137
|
+
* @param maxChars - Maximum characters per entry (including suffix).
|
|
138
|
+
* @param maxEntries - Maximum number of entries to keep.
|
|
139
|
+
* @returns The truncated subtitles array (always a new array).
|
|
140
|
+
*/
|
|
141
|
+
export declare function truncateSubtitles(subtitles: string[], maxChars: number, maxEntries: number): string[];
|
|
142
|
+
/**
|
|
143
|
+
* Compute a budget profile based on spec and optional fragment counts.
|
|
144
|
+
*
|
|
145
|
+
* The profile determines how many fragments, contents, and characters the
|
|
146
|
+
* pipeline should budget when building LLM prompts. Higher counts produce
|
|
147
|
+
* tighter budgets to keep prompts manageable.
|
|
148
|
+
*
|
|
149
|
+
* Thresholds (matching `truncate.py:38-57`):
|
|
150
|
+
*
|
|
151
|
+
* | specCount | tier | maxFragments | maxContents | contentBudget |
|
|
152
|
+
* |-----------|---------|--------------|-------------|---------------|
|
|
153
|
+
* | ≤ 3 | tiny | 12 | 16 | 48000 |
|
|
154
|
+
* | ≤ 8 | small | 10 | 14 | 40000 |
|
|
155
|
+
* | ≤ 15 | medium | 8 | 12 | 32000 |
|
|
156
|
+
* | ≤ 30 | large | 6 | 10 | 24000 |
|
|
157
|
+
* | > 30 | vlarge | 0 | 0 | 16000 |
|
|
158
|
+
*
|
|
159
|
+
* The `vlarge` tier disables fragment/contents inclusion entirely (0 values).
|
|
160
|
+
*
|
|
161
|
+
* @param specCount - Number of specs in the knowledge graph.
|
|
162
|
+
* @param fragmentCount - (Unused) reserved for future per-fragment weighting.
|
|
163
|
+
* @returns The budget profile for the given scale.
|
|
164
|
+
*/
|
|
165
|
+
export declare function computeBudgetProfile(specCount: number, _fragmentCount?: number): BudgetProfile;
|
|
166
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/spec/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAUH,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,WAAW,GAAG,MAAM,CAAC;IAChC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,M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,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,MAAM,EAAE,EACnB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM,EAAE,CAMV;AAMD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,cAAc,CAAC,EAAE,MAAM,GACtB,aAAa,CAcf"}
|
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Spec utility functions — replaces `file_utils.py`, `meta.py`, and
|
|
4
|
+
* `truncate.py` from Python Commit4Spec.
|
|
5
|
+
*
|
|
6
|
+
* Covers file I/O, meta.json read/write, text/diff truncation, and budget
|
|
7
|
+
* computation. All functions are synchronous and use Node.js built-ins.
|
|
8
|
+
*
|
|
9
|
+
* @module spec/utils
|
|
10
|
+
*/
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
28
|
+
var ownKeys = function(o) {
|
|
29
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30
|
+
var ar = [];
|
|
31
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32
|
+
return ar;
|
|
33
|
+
};
|
|
34
|
+
return ownKeys(o);
|
|
35
|
+
};
|
|
36
|
+
return function (mod) {
|
|
37
|
+
if (mod && mod.__esModule) return mod;
|
|
38
|
+
var result = {};
|
|
39
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
40
|
+
__setModuleDefault(result, mod);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.SPEC_DATA_DIR = void 0;
|
|
46
|
+
exports.readFileContent = readFileContent;
|
|
47
|
+
exports.writeFileContent = writeFileContent;
|
|
48
|
+
exports.parseCommitInfoMd = parseCommitInfoMd;
|
|
49
|
+
exports.discoverSpecs = discoverSpecs;
|
|
50
|
+
exports.resolveDbPath = resolveDbPath;
|
|
51
|
+
exports.readMeta = readMeta;
|
|
52
|
+
exports.writeMeta = writeMeta;
|
|
53
|
+
exports.truncateCodeDiff = truncateCodeDiff;
|
|
54
|
+
exports.truncateText = truncateText;
|
|
55
|
+
exports.truncateSubtitles = truncateSubtitles;
|
|
56
|
+
exports.computeBudgetProfile = computeBudgetProfile;
|
|
57
|
+
const fs = __importStar(require("fs"));
|
|
58
|
+
const path = __importStar(require("path"));
|
|
59
|
+
const errors_1 = require("../errors");
|
|
60
|
+
// =============================================================================
|
|
61
|
+
// Constants
|
|
62
|
+
// =============================================================================
|
|
63
|
+
/** Root directory for spec data, relative to the repository root. */
|
|
64
|
+
exports.SPEC_DATA_DIR = '.homegraph/commit4spec';
|
|
65
|
+
const TRUNCATION_SUFFIX = ' …(truncated)';
|
|
66
|
+
const TRUNCATION_SUFFIX_LENGTH = TRUNCATION_SUFFIX.length;
|
|
67
|
+
// =============================================================================
|
|
68
|
+
// File I/O
|
|
69
|
+
// =============================================================================
|
|
70
|
+
/**
|
|
71
|
+
* Read a UTF-8 file synchronously.
|
|
72
|
+
*
|
|
73
|
+
* Returns `null` for ENOENT (not found), EISDIR (is a directory), or EACCES
|
|
74
|
+
* (permission denied). Other errors propagate.
|
|
75
|
+
*/
|
|
76
|
+
function readFileContent(filePath) {
|
|
77
|
+
try {
|
|
78
|
+
return fs.readFileSync(filePath, 'utf-8');
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
if (err.code === 'ENOENT' || err.code === 'EISDIR' || err.code === 'EACCES') {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
throw err;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Write a UTF-8 file synchronously, creating parent directories as needed.
|
|
89
|
+
*
|
|
90
|
+
* Parent directories are created with `fs.mkdirSync({ recursive: true })`.
|
|
91
|
+
* If the parent exists but is not a directory the underlying error propagates.
|
|
92
|
+
*/
|
|
93
|
+
function writeFileContent(filePath, content) {
|
|
94
|
+
const dir = path.dirname(filePath);
|
|
95
|
+
if (dir && dir !== '.') {
|
|
96
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
97
|
+
}
|
|
98
|
+
fs.writeFileSync(filePath, content, 'utf-8');
|
|
99
|
+
}
|
|
100
|
+
// =============================================================================
|
|
101
|
+
// Commit-info.md parsing
|
|
102
|
+
// =============================================================================
|
|
103
|
+
/**
|
|
104
|
+
* Regex matching commit-hash annotations in commit-info.md content.
|
|
105
|
+
*
|
|
106
|
+
* Matches lines like:
|
|
107
|
+
* commit: abc123def456...
|
|
108
|
+
* commit-id: abc123def456...
|
|
109
|
+
* commit_id: abc123def456...
|
|
110
|
+
* commit-id=abc123def456...
|
|
111
|
+
* abc123def456789... (bare 40-char hex on its own line)
|
|
112
|
+
*/
|
|
113
|
+
const COMMIT_HASH_RE = /^commit[-_ ]?(?:id)?[:= ]\s*([a-f0-9]{7,40})\s*$/i;
|
|
114
|
+
const BARE_HASH_RE = /^([a-f0-9]{40})\s*$/i;
|
|
115
|
+
/**
|
|
116
|
+
* Parse commit-info.md content for a commit hash.
|
|
117
|
+
*
|
|
118
|
+
* Searches line by line for one of:
|
|
119
|
+
* - `commit: HASH`
|
|
120
|
+
* - `commit-id: HASH`
|
|
121
|
+
* - `commit_id: HASH`
|
|
122
|
+
* - a bare 40-char hex hash on its own line
|
|
123
|
+
*
|
|
124
|
+
* Returns the first matched hash (7–40 hex chars), or `null` if no hash is
|
|
125
|
+
* found. Empty or whitespace-only input returns `null`.
|
|
126
|
+
*/
|
|
127
|
+
function parseCommitInfoMd(content) {
|
|
128
|
+
if (!content)
|
|
129
|
+
return null;
|
|
130
|
+
for (const line of content.split('\n')) {
|
|
131
|
+
const trimmed = line.trim();
|
|
132
|
+
if (!trimmed)
|
|
133
|
+
continue;
|
|
134
|
+
// Try annotated hash first
|
|
135
|
+
const match = COMMIT_HASH_RE.exec(trimmed);
|
|
136
|
+
if (match) {
|
|
137
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
138
|
+
return match[1].toLowerCase();
|
|
139
|
+
}
|
|
140
|
+
// Try bare 40-char hex
|
|
141
|
+
const bareMatch = BARE_HASH_RE.exec(trimmed);
|
|
142
|
+
if (bareMatch) {
|
|
143
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
144
|
+
return bareMatch[1].toLowerCase();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
// =============================================================================
|
|
150
|
+
// Spec discovery
|
|
151
|
+
// =============================================================================
|
|
152
|
+
/**
|
|
153
|
+
* Discover specs in a storage directory.
|
|
154
|
+
*
|
|
155
|
+
* A "spec" is any `.md` file OR any subdirectory. For `.md` files the
|
|
156
|
+
* `specId` is the basename without the extension. For subdirectories the
|
|
157
|
+
* `specId` is the directory name.
|
|
158
|
+
*
|
|
159
|
+
* Returns an empty array when `specStoragePath` does not exist or is not a
|
|
160
|
+
* directory.
|
|
161
|
+
*/
|
|
162
|
+
function discoverSpecs(specStoragePath) {
|
|
163
|
+
let entries;
|
|
164
|
+
try {
|
|
165
|
+
entries = fs.readdirSync(specStoragePath, { withFileTypes: true });
|
|
166
|
+
}
|
|
167
|
+
catch (err) {
|
|
168
|
+
// Non-existent or not a directory → empty list
|
|
169
|
+
return [];
|
|
170
|
+
}
|
|
171
|
+
const result = [];
|
|
172
|
+
for (const entry of entries) {
|
|
173
|
+
if (entry.isDirectory()) {
|
|
174
|
+
result.push({
|
|
175
|
+
specId: entry.name,
|
|
176
|
+
entryType: 'directory',
|
|
177
|
+
path: path.join(specStoragePath, entry.name),
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
else if (entry.isFile() && entry.name.endsWith('.md')) {
|
|
181
|
+
result.push({
|
|
182
|
+
specId: entry.name.slice(0, -3), // strip ".md"
|
|
183
|
+
entryType: 'file',
|
|
184
|
+
path: path.join(specStoragePath, entry.name),
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
// Symlinks, other file types, and dot-files are silently skipped.
|
|
188
|
+
}
|
|
189
|
+
return result;
|
|
190
|
+
}
|
|
191
|
+
// =============================================================================
|
|
192
|
+
// Database path resolution
|
|
193
|
+
// =============================================================================
|
|
194
|
+
/**
|
|
195
|
+
* Resolve the database path.
|
|
196
|
+
*
|
|
197
|
+
* Priority:
|
|
198
|
+
* 1. If `explicitDbPath` is given, return it as-is (no side effects).
|
|
199
|
+
* 2. If `repoPath` is given, default to `{repoPath}/${SPEC_DATA_DIR}/commit4spec.db`
|
|
200
|
+
* and ensure `${SPEC_DATA_DIR}/.gitignore` exists containing `"*"`.
|
|
201
|
+
* 3. If neither is given, return `"./commit4spec.db"`.
|
|
202
|
+
*/
|
|
203
|
+
function resolveDbPath(repoPath, explicitDbPath) {
|
|
204
|
+
if (explicitDbPath) {
|
|
205
|
+
return explicitDbPath;
|
|
206
|
+
}
|
|
207
|
+
if (repoPath) {
|
|
208
|
+
const commit4specDir = path.join(repoPath, exports.SPEC_DATA_DIR);
|
|
209
|
+
const gitignorePath = path.join(commit4specDir, '.gitignore');
|
|
210
|
+
const dbPath = path.join(commit4specDir, 'commit4spec.db');
|
|
211
|
+
// Ensure ${SPEC_DATA_DIR} directory exists
|
|
212
|
+
try {
|
|
213
|
+
fs.mkdirSync(commit4specDir, { recursive: true });
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
// Directory may already exist; ok.
|
|
217
|
+
}
|
|
218
|
+
// Write .gitignore if it doesn't exist
|
|
219
|
+
if (!fs.existsSync(gitignorePath)) {
|
|
220
|
+
try {
|
|
221
|
+
fs.writeFileSync(gitignorePath, '*\n', 'utf-8');
|
|
222
|
+
}
|
|
223
|
+
catch (err) {
|
|
224
|
+
(0, errors_1.logWarn)(`Failed to write ${exports.SPEC_DATA_DIR}/.gitignore`, {
|
|
225
|
+
path: gitignorePath,
|
|
226
|
+
error: err instanceof Error ? err.message : String(err),
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
return dbPath;
|
|
231
|
+
}
|
|
232
|
+
return './commit4spec.db';
|
|
233
|
+
}
|
|
234
|
+
// =============================================================================
|
|
235
|
+
// Meta read / write
|
|
236
|
+
// =============================================================================
|
|
237
|
+
/**
|
|
238
|
+
* Read `${SPEC_DATA_DIR}/meta.json` from `repoPath`.
|
|
239
|
+
*
|
|
240
|
+
* Returns `null` when the file is missing, unreadable, or contains invalid
|
|
241
|
+
* JSON or a JSON value that is not a plain object.
|
|
242
|
+
*/
|
|
243
|
+
function readMeta(repoPath) {
|
|
244
|
+
const metaPath = path.join(repoPath, exports.SPEC_DATA_DIR, 'meta.json');
|
|
245
|
+
let raw;
|
|
246
|
+
try {
|
|
247
|
+
raw = fs.readFileSync(metaPath, 'utf-8');
|
|
248
|
+
}
|
|
249
|
+
catch {
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
let parsed;
|
|
253
|
+
try {
|
|
254
|
+
parsed = JSON.parse(raw);
|
|
255
|
+
}
|
|
256
|
+
catch {
|
|
257
|
+
(0, errors_1.logWarn)(`Ignoring ${exports.SPEC_DATA_DIR}/meta.json: not valid JSON`, {
|
|
258
|
+
path: metaPath,
|
|
259
|
+
});
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
263
|
+
(0, errors_1.logWarn)(`Ignoring ${exports.SPEC_DATA_DIR}/meta.json: top-level value must be a JSON object`, { path: metaPath });
|
|
264
|
+
return null;
|
|
265
|
+
}
|
|
266
|
+
const obj = parsed;
|
|
267
|
+
// Validate required string fields
|
|
268
|
+
if (typeof obj.repoPath !== 'string' || typeof obj.specStoragePath !== 'string') {
|
|
269
|
+
(0, errors_1.logWarn)(`Ignoring ${exports.SPEC_DATA_DIR}/meta.json: repoPath and specStoragePath must be strings`, { path: metaPath });
|
|
270
|
+
return null;
|
|
271
|
+
}
|
|
272
|
+
return {
|
|
273
|
+
repoPath: obj.repoPath,
|
|
274
|
+
specStoragePath: obj.specStoragePath,
|
|
275
|
+
createdAt: typeof obj.createdAt === 'string' ? obj.createdAt : undefined,
|
|
276
|
+
updatedAt: typeof obj.updatedAt === 'string' ? obj.updatedAt : new Date().toISOString(),
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Write `${SPEC_DATA_DIR}/meta.json` to `repoPath`.
|
|
281
|
+
*
|
|
282
|
+
* If existing meta has a `createdAt` field it is preserved; otherwise a new
|
|
283
|
+
* ISO-8601 timestamp is generated. `updatedAt` is always set to the current
|
|
284
|
+
* time. The `${SPEC_DATA_DIR}` directory is created if it does not exist.
|
|
285
|
+
*
|
|
286
|
+
* Returns the full `SpecMeta` that was written.
|
|
287
|
+
*/
|
|
288
|
+
function writeMeta(repoPath, specStoragePath) {
|
|
289
|
+
const metaDir = path.join(repoPath, exports.SPEC_DATA_DIR);
|
|
290
|
+
const metaPath = path.join(metaDir, 'meta.json');
|
|
291
|
+
const now = new Date().toISOString();
|
|
292
|
+
// Preserve createdAt from existing meta if available
|
|
293
|
+
let createdAt;
|
|
294
|
+
const existing = readMeta(repoPath);
|
|
295
|
+
if (existing && existing.createdAt) {
|
|
296
|
+
createdAt = existing.createdAt;
|
|
297
|
+
}
|
|
298
|
+
const meta = {
|
|
299
|
+
repoPath,
|
|
300
|
+
specStoragePath,
|
|
301
|
+
createdAt,
|
|
302
|
+
updatedAt: now,
|
|
303
|
+
};
|
|
304
|
+
fs.mkdirSync(metaDir, { recursive: true });
|
|
305
|
+
fs.writeFileSync(metaPath, JSON.stringify(meta, null, 2) + '\n', 'utf-8');
|
|
306
|
+
return meta;
|
|
307
|
+
}
|
|
308
|
+
// =============================================================================
|
|
309
|
+
// Truncation utilities
|
|
310
|
+
// =============================================================================
|
|
311
|
+
/**
|
|
312
|
+
* Truncate a unified diff at a sensible boundary.
|
|
313
|
+
*
|
|
314
|
+
* The algorithm prefers semantic boundaries to keep diffs readable:
|
|
315
|
+
*
|
|
316
|
+
* 1. If the diff is shorter than `maxChars` (default 3800), return it unchanged.
|
|
317
|
+
* 2. Try: find the **last** `@@` hunk header in the trailing 50% portion of
|
|
318
|
+
* the diff and cut right before it.
|
|
319
|
+
* 3. Fallback: find the **last** newline in the trailing 80% portion and cut
|
|
320
|
+
* after it.
|
|
321
|
+
* 4. Hard fallback: cut exactly at `maxChars`.
|
|
322
|
+
*
|
|
323
|
+
* Always appends `" …(truncated)"` when truncation occurs.
|
|
324
|
+
*
|
|
325
|
+
* @param diff - The unified diff text to truncate.
|
|
326
|
+
* @param maxChars - Maximum allowed characters (including suffix). Default 3800.
|
|
327
|
+
* @returns The (possibly truncated) diff text.
|
|
328
|
+
*/
|
|
329
|
+
function truncateCodeDiff(diff, maxChars = 3800) {
|
|
330
|
+
if (diff.length <= maxChars) {
|
|
331
|
+
return diff;
|
|
332
|
+
}
|
|
333
|
+
const suffix = TRUNCATION_SUFFIX;
|
|
334
|
+
const effectiveMax = maxChars - TRUNCATION_SUFFIX_LENGTH;
|
|
335
|
+
if (effectiveMax <= 0) {
|
|
336
|
+
return diff.slice(0, Math.max(0, maxChars - 1)) + suffix;
|
|
337
|
+
}
|
|
338
|
+
// Step 2: find last "@@" hunk header in trailing 50%
|
|
339
|
+
const halfPoint = Math.floor(diff.length * 0.5);
|
|
340
|
+
// We search for "\n@@" or "@@" at the very start. Use a regex that
|
|
341
|
+
// matches a line starting with "@@" (after optional leading whitespace in
|
|
342
|
+
// some edge cases, but standard diffs have "@@" at column 0).
|
|
343
|
+
const hunkHeaderRe = /(^|\n)@@/g;
|
|
344
|
+
let lastHunkHeaderPos = -1;
|
|
345
|
+
let match;
|
|
346
|
+
// Reset lastIndex and scan from the beginning; we only accept matches whose
|
|
347
|
+
// index is >= halfPoint.
|
|
348
|
+
hunkHeaderRe.lastIndex = 0;
|
|
349
|
+
while ((match = hunkHeaderRe.exec(diff)) !== null) {
|
|
350
|
+
const cap = match[1]; // the newline-or-start anchor
|
|
351
|
+
const pos = match.index + (cap ? cap.length : 0); // position of "@@"
|
|
352
|
+
if (pos >= halfPoint && pos <= effectiveMax) {
|
|
353
|
+
lastHunkHeaderPos = pos;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
if (lastHunkHeaderPos > 0) {
|
|
357
|
+
return diff.slice(0, lastHunkHeaderPos) + suffix;
|
|
358
|
+
}
|
|
359
|
+
// Step 3: find last "\n" in trailing 80%
|
|
360
|
+
const eightyPoint = Math.floor(diff.length * 0.2);
|
|
361
|
+
for (let i = effectiveMax - 1; i >= eightyPoint; i--) {
|
|
362
|
+
if (diff[i] === '\n' && i < effectiveMax) {
|
|
363
|
+
return diff.slice(0, i + 1) + suffix;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
// Step 4: hard cut
|
|
367
|
+
return diff.slice(0, effectiveMax) + suffix;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Truncate plain text with newline-awareness.
|
|
371
|
+
*
|
|
372
|
+
* When the text is longer than `maxChars`, it is cut at the last newline
|
|
373
|
+
* found before `maxChars` (minus the suffix length). If no suitable newline
|
|
374
|
+
* exists, a hard cut is made.
|
|
375
|
+
*
|
|
376
|
+
* The suffix `" …(truncated)"` is appended only when truncation occurs.
|
|
377
|
+
*
|
|
378
|
+
* @param text - The text to truncate.
|
|
379
|
+
* @param maxChars - Maximum allowed characters (including suffix).
|
|
380
|
+
* @returns The (possibly truncated) text.
|
|
381
|
+
*/
|
|
382
|
+
function truncateText(text, maxChars) {
|
|
383
|
+
if (text.length <= maxChars) {
|
|
384
|
+
return text;
|
|
385
|
+
}
|
|
386
|
+
const suffix = TRUNCATION_SUFFIX;
|
|
387
|
+
const effectiveMax = maxChars - TRUNCATION_SUFFIX_LENGTH;
|
|
388
|
+
if (effectiveMax <= 0) {
|
|
389
|
+
return text.slice(0, Math.max(0, maxChars - 1)) + suffix;
|
|
390
|
+
}
|
|
391
|
+
// Try to find the last newline within the budget
|
|
392
|
+
for (let i = effectiveMax - 1; i >= 0; i--) {
|
|
393
|
+
if (text[i] === '\n') {
|
|
394
|
+
return text.slice(0, i) + suffix;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
// Hard cut
|
|
398
|
+
return text.slice(0, effectiveMax) + suffix;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Truncate a subtitles array.
|
|
402
|
+
*
|
|
403
|
+
* 1. If the array has more than `maxEntries`, it is sliced to `maxEntries`.
|
|
404
|
+
* 2. Each remaining entry that exceeds `maxChars` is individually truncated
|
|
405
|
+
* via `truncateText`.
|
|
406
|
+
*
|
|
407
|
+
* Entries that already fit within both limits are left unchanged.
|
|
408
|
+
*
|
|
409
|
+
* @param subtitles - Array of subtitle strings.
|
|
410
|
+
* @param maxChars - Maximum characters per entry (including suffix).
|
|
411
|
+
* @param maxEntries - Maximum number of entries to keep.
|
|
412
|
+
* @returns The truncated subtitles array (always a new array).
|
|
413
|
+
*/
|
|
414
|
+
function truncateSubtitles(subtitles, maxChars, maxEntries) {
|
|
415
|
+
// Cap entry count
|
|
416
|
+
const capped = subtitles.length > maxEntries ? subtitles.slice(0, maxEntries) : [...subtitles];
|
|
417
|
+
// Truncate each entry
|
|
418
|
+
return capped.map((entry) => truncateText(entry, maxChars));
|
|
419
|
+
}
|
|
420
|
+
// =============================================================================
|
|
421
|
+
// Budget profile
|
|
422
|
+
// =============================================================================
|
|
423
|
+
/**
|
|
424
|
+
* Compute a budget profile based on spec and optional fragment counts.
|
|
425
|
+
*
|
|
426
|
+
* The profile determines how many fragments, contents, and characters the
|
|
427
|
+
* pipeline should budget when building LLM prompts. Higher counts produce
|
|
428
|
+
* tighter budgets to keep prompts manageable.
|
|
429
|
+
*
|
|
430
|
+
* Thresholds (matching `truncate.py:38-57`):
|
|
431
|
+
*
|
|
432
|
+
* | specCount | tier | maxFragments | maxContents | contentBudget |
|
|
433
|
+
* |-----------|---------|--------------|-------------|---------------|
|
|
434
|
+
* | ≤ 3 | tiny | 12 | 16 | 48000 |
|
|
435
|
+
* | ≤ 8 | small | 10 | 14 | 40000 |
|
|
436
|
+
* | ≤ 15 | medium | 8 | 12 | 32000 |
|
|
437
|
+
* | ≤ 30 | large | 6 | 10 | 24000 |
|
|
438
|
+
* | > 30 | vlarge | 0 | 0 | 16000 |
|
|
439
|
+
*
|
|
440
|
+
* The `vlarge` tier disables fragment/contents inclusion entirely (0 values).
|
|
441
|
+
*
|
|
442
|
+
* @param specCount - Number of specs in the knowledge graph.
|
|
443
|
+
* @param fragmentCount - (Unused) reserved for future per-fragment weighting.
|
|
444
|
+
* @returns The budget profile for the given scale.
|
|
445
|
+
*/
|
|
446
|
+
function computeBudgetProfile(specCount, _fragmentCount) {
|
|
447
|
+
if (specCount <= 3) {
|
|
448
|
+
return { tier: 'tiny', maxFragments: 12, maxContents: 16, contentBudget: 48000 };
|
|
449
|
+
}
|
|
450
|
+
if (specCount <= 8) {
|
|
451
|
+
return { tier: 'small', maxFragments: 10, maxContents: 14, contentBudget: 40000 };
|
|
452
|
+
}
|
|
453
|
+
if (specCount <= 15) {
|
|
454
|
+
return { tier: 'medium', maxFragments: 8, maxContents: 12, contentBudget: 32000 };
|
|
455
|
+
}
|
|
456
|
+
if (specCount <= 30) {
|
|
457
|
+
return { tier: 'large', maxFragments: 6, maxContents: 10, contentBudget: 24000 };
|
|
458
|
+
}
|
|
459
|
+
return { tier: 'vlarge', maxFragments: 0, maxContents: 0, contentBudget: 16000 };
|
|
460
|
+
}
|
|
461
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/spec/utils.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDH,0CASC;AAQD,4CAMC;AA+BD,8CAuBC;AAgBD,sCA6BC;AAeD,sCAiCC;AAYD,4BA6CC;AAWD,8BAwBC;AAwBD,4CA6CC;AAeD,oCAoBC;AAgBD,8CAUC;AA6BD,oDAiBC;AAteD,uCAAyB;AACzB,2CAA6B;AAC7B,sCAAoC;AA0BpC,gFAAgF;AAChF,YAAY;AACZ,gFAAgF;AAEhF,qEAAqE;AACxD,QAAA,aAAa,GAAG,wBAAwB,CAAC;AAEtD,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AAC3C,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,MAAM,CAAC;AAE1D,gFAAgF;AAChF,WAAW;AACX,gFAAgF;AAEhF;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,QAAgB;IAC9C,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,QA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