autor3search-typescript 0.1.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/LICENSE +21 -0
- package/README.md +210 -0
- package/dist/benchproto/types.d.ts +32 -0
- package/dist/benchproto/types.js +28 -0
- package/dist/benchproto/types.js.map +1 -0
- package/dist/benchrun/child.d.ts +1 -0
- package/dist/benchrun/child.js +222 -0
- package/dist/benchrun/child.js.map +1 -0
- package/dist/benchrun/invoke.d.ts +61 -0
- package/dist/benchrun/invoke.js +152 -0
- package/dist/benchrun/invoke.js.map +1 -0
- package/dist/cli/cmd-baseline.d.ts +15 -0
- package/dist/cli/cmd-baseline.js +292 -0
- package/dist/cli/cmd-baseline.js.map +1 -0
- package/dist/cli/cmd-doctor.d.ts +11 -0
- package/dist/cli/cmd-doctor.js +26 -0
- package/dist/cli/cmd-doctor.js.map +1 -0
- package/dist/cli/cmd-eval.d.ts +30 -0
- package/dist/cli/cmd-eval.js +173 -0
- package/dist/cli/cmd-eval.js.map +1 -0
- package/dist/cli/cmd-init.d.ts +16 -0
- package/dist/cli/cmd-init.js +343 -0
- package/dist/cli/cmd-init.js.map +1 -0
- package/dist/cli/cmd-profile.d.ts +11 -0
- package/dist/cli/cmd-profile.js +140 -0
- package/dist/cli/cmd-profile.js.map +1 -0
- package/dist/cli/cmd-report.d.ts +15 -0
- package/dist/cli/cmd-report.js +70 -0
- package/dist/cli/cmd-report.js.map +1 -0
- package/dist/cli/cmd-status.d.ts +11 -0
- package/dist/cli/cmd-status.js +143 -0
- package/dist/cli/cmd-status.js.map +1 -0
- package/dist/cli/cmd-stop.d.ts +15 -0
- package/dist/cli/cmd-stop.js +143 -0
- package/dist/cli/cmd-stop.js.map +1 -0
- package/dist/cli/main.d.ts +31 -0
- package/dist/cli/main.js +133 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/runctx.d.ts +29 -0
- package/dist/cli/runctx.js +49 -0
- package/dist/cli/runctx.js.map +1 -0
- package/dist/cli/speedup.d.ts +14 -0
- package/dist/cli/speedup.js +25 -0
- package/dist/cli/speedup.js.map +1 -0
- package/dist/config/load.d.ts +6 -0
- package/dist/config/load.js +172 -0
- package/dist/config/load.js.map +1 -0
- package/dist/config/schema.d.ts +42 -0
- package/dist/config/schema.js +25 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/discover/benchmarks.d.ts +26 -0
- package/dist/discover/benchmarks.js +88 -0
- package/dist/discover/benchmarks.js.map +1 -0
- package/dist/discover/files.d.ts +23 -0
- package/dist/discover/files.js +82 -0
- package/dist/discover/files.js.map +1 -0
- package/dist/doctor/doctor.d.ts +56 -0
- package/dist/doctor/doctor.js +255 -0
- package/dist/doctor/doctor.js.map +1 -0
- package/dist/freeze/freeze.d.ts +23 -0
- package/dist/freeze/freeze.js +107 -0
- package/dist/freeze/freeze.js.map +1 -0
- package/dist/freeze/manifest.d.ts +6 -0
- package/dist/freeze/manifest.js +9 -0
- package/dist/freeze/manifest.js.map +1 -0
- package/dist/freeze/safepath.d.ts +8 -0
- package/dist/freeze/safepath.js +22 -0
- package/dist/freeze/safepath.js.map +1 -0
- package/dist/gitx/git.d.ts +87 -0
- package/dist/gitx/git.js +235 -0
- package/dist/gitx/git.js.map +1 -0
- package/dist/measure/interleave.d.ts +32 -0
- package/dist/measure/interleave.js +42 -0
- package/dist/measure/interleave.js.map +1 -0
- package/dist/pipeline/eval.d.ts +67 -0
- package/dist/pipeline/eval.js +495 -0
- package/dist/pipeline/eval.js.map +1 -0
- package/dist/pm/detect.d.ts +17 -0
- package/dist/pm/detect.js +131 -0
- package/dist/pm/detect.js.map +1 -0
- package/dist/profile/profile.d.ts +53 -0
- package/dist/profile/profile.js +105 -0
- package/dist/profile/profile.js.map +1 -0
- package/dist/results/results.d.ts +65 -0
- package/dist/results/results.js +214 -0
- package/dist/results/results.js.map +1 -0
- package/dist/runner/exec.d.ts +69 -0
- package/dist/runner/exec.js +185 -0
- package/dist/runner/exec.js.map +1 -0
- package/dist/scope/scope.d.ts +20 -0
- package/dist/scope/scope.js +70 -0
- package/dist/scope/scope.js.map +1 -0
- package/dist/state/baseline.d.ts +35 -0
- package/dist/state/baseline.js +38 -0
- package/dist/state/baseline.js.map +1 -0
- package/dist/state/home.d.ts +9 -0
- package/dist/state/home.js +72 -0
- package/dist/state/home.js.map +1 -0
- package/dist/state/lock.d.ts +11 -0
- package/dist/state/lock.js +89 -0
- package/dist/state/lock.js.map +1 -0
- package/dist/state/runnaming.d.ts +27 -0
- package/dist/state/runnaming.js +47 -0
- package/dist/state/runnaming.js.map +1 -0
- package/dist/state/stop.d.ts +28 -0
- package/dist/state/stop.js +59 -0
- package/dist/state/stop.js.map +1 -0
- package/dist/stats/delta.d.ts +29 -0
- package/dist/stats/delta.js +41 -0
- package/dist/stats/delta.js.map +1 -0
- package/dist/stats/geomean.d.ts +4 -0
- package/dist/stats/geomean.js +21 -0
- package/dist/stats/geomean.js.map +1 -0
- package/dist/stats/mannwhitney.d.ts +27 -0
- package/dist/stats/mannwhitney.js +158 -0
- package/dist/stats/mannwhitney.js.map +1 -0
- package/dist/verdict/verdict.d.ts +46 -0
- package/dist/verdict/verdict.js +102 -0
- package/dist/verdict/verdict.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/package.json +35 -0
- package/templates/program.md +131 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "autor3search-typescript",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Autonomous AI-driven performance optimization for any TypeScript repository.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "Gal Be <galevgi@gmail.com>",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": ">=22"
|
|
10
|
+
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"autor3search-typescript": "./dist/cli/main.js"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"templates",
|
|
17
|
+
"README.md",
|
|
18
|
+
"LICENSE"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc -p tsconfig.build.json",
|
|
22
|
+
"typecheck": "tsc --noEmit",
|
|
23
|
+
"test": "vitest run",
|
|
24
|
+
"prepare": "npm run build"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"tsx": "^4.19.2",
|
|
28
|
+
"typescript": "^5.7.2",
|
|
29
|
+
"yaml": "^2.6.1"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/node": "^22.10.2",
|
|
33
|
+
"vitest": "^5.0.0"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Autonomous performance optimization — your instructions
|
|
2
|
+
|
|
3
|
+
You are the acting agent for this run. This file is your complete
|
|
4
|
+
instruction set. Read all of it before making a single change, and follow
|
|
5
|
+
it exactly — the harness that grades your work is deliberately outside
|
|
6
|
+
your control, and departing from this program is the only way to fail
|
|
7
|
+
silently instead of just failing.
|
|
8
|
+
|
|
9
|
+
## Benchmarks in scope
|
|
10
|
+
|
|
11
|
+
{{BENCHMARKS}}
|
|
12
|
+
|
|
13
|
+
A benchmark not listed here was not discoverable (no exported `bench*`
|
|
14
|
+
function in a `*.bench.ts` file) and is not part of this run.
|
|
15
|
+
|
|
16
|
+
## The loop, in five lines
|
|
17
|
+
|
|
18
|
+
Repeat this loop until a verdict reports `"stop_requested": true`:
|
|
19
|
+
|
|
20
|
+
1. Read one benchmark and understand what it measures.
|
|
21
|
+
2. Form ONE hypothesis for a change that should make it faster.
|
|
22
|
+
3. Edit ONLY files matched by `scope` in `.autor3search/config.yaml`.
|
|
23
|
+
4. Commit the change. One experiment, one commit — never more than one
|
|
24
|
+
experiment per commit.
|
|
25
|
+
5. Run `autor3search-typescript eval --json` and apply the verdict below.
|
|
26
|
+
|
|
27
|
+
Before starting each experiment, print this line with the real values
|
|
28
|
+
filled in:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
[exp <n> | {{RUN_TAG}} | vs <measure_commit> | stop: autor3search-typescript stop]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`<n>` is this experiment's number in this run. `<measure_commit>` is the
|
|
35
|
+
`measure_commit` field from the previous `eval` result (or the baseline
|
|
36
|
+
commit, for experiment 1) — the commit your candidate is being compared
|
|
37
|
+
against. The `stop:` fragment is a reminder of the command a human (or a
|
|
38
|
+
supervising process) can run to stop the loop cleanly after the current
|
|
39
|
+
experiment finishes.
|
|
40
|
+
|
|
41
|
+
## The verdict table
|
|
42
|
+
|
|
43
|
+
| exit code | status | meaning | what you do |
|
|
44
|
+
|---|---|---|---|
|
|
45
|
+
| `0` | **KEEP** | the change is a real, statistically significant, and material win | leave the commit in place — it becomes the new comparison point for the next experiment |
|
|
46
|
+
| `1` | **DISCARD** | no acceptable win | `git reset --hard HEAD~1`, then read "how to read a DISCARD" below before your next hypothesis |
|
|
47
|
+
| `2` | **FAIL** | a gate rejected the change (scope violation, config tampering, a failing typecheck/build/test, a stale worktree, ...) before anything was even measured | `git reset --hard HEAD~1` — the change itself was the problem, not the benchmark result |
|
|
48
|
+
| `3` | **CRASH** | a measurement child process crashed or produced no usable result | `git reset --hard HEAD~1`; if this keeps happening, stop looping and report it rather than guessing |
|
|
49
|
+
|
|
50
|
+
A commit that did not receive a `0` (KEEP) verdict must never remain on
|
|
51
|
+
the branch. Discard it and move on.
|
|
52
|
+
|
|
53
|
+
## What you must never do
|
|
54
|
+
|
|
55
|
+
- Never edit `program.md` (this file).
|
|
56
|
+
- Never edit `.autor3search/config.yaml`.
|
|
57
|
+
- Never edit `results.tsv`.
|
|
58
|
+
- Never edit any `*.test.ts`, `*.spec.ts`, or `*.bench.ts` file.
|
|
59
|
+
- Never edit `package.json`.
|
|
60
|
+
- Never edit any lockfile (`package-lock.json`, `pnpm-lock.yaml`,
|
|
61
|
+
`yarn.lock`, `bun.lockb`, `bun.lock`).
|
|
62
|
+
- Never edit `tsconfig.json`.
|
|
63
|
+
- Never pass `-force` to any `autor3search-typescript` command.
|
|
64
|
+
- Never run more than one experiment per commit.
|
|
65
|
+
|
|
66
|
+
Every one of these is enforced by a gate, not just a request: `eval` will
|
|
67
|
+
FAIL the experiment if you break one. But finding out via a FAIL wastes an
|
|
68
|
+
experiment, so don't rely on the gate to catch you — follow the list.
|
|
69
|
+
|
|
70
|
+
## How the run ends
|
|
71
|
+
|
|
72
|
+
When an `eval --json` result reports `"stop_requested": true`:
|
|
73
|
+
|
|
74
|
+
1. Apply that result's verdict exactly as you would any other (KEEP the
|
|
75
|
+
commit, or discard it) — a pending stop does not change how this
|
|
76
|
+
experiment is judged.
|
|
77
|
+
2. Do not start another experiment.
|
|
78
|
+
3. Run `autor3search-typescript report`.
|
|
79
|
+
4. Summarize, in your own words, what you tried, what was kept, and the
|
|
80
|
+
cumulative speedup reported. Then exit.
|
|
81
|
+
|
|
82
|
+
## How to read a DISCARD
|
|
83
|
+
|
|
84
|
+
A DISCARD's `reason` field tells you what to try next — the three reasons
|
|
85
|
+
are not interchangeable:
|
|
86
|
+
|
|
87
|
+
- **`no_significant_improvement`** — nothing measurably moved. The
|
|
88
|
+
hypothesis was likely wrong, or the change never reached the code that
|
|
89
|
+
is actually hot. Try a genuinely different idea, not a smaller version
|
|
90
|
+
of the same one.
|
|
91
|
+
- **`improvement_below_min_effect`** — the direction was right (the
|
|
92
|
+
change really did make things faster) but the effect was too small to
|
|
93
|
+
clear `min_effect_pct`. Push the same idea harder — a more thorough
|
|
94
|
+
version of the same change — rather than abandoning the approach.
|
|
95
|
+
- **`significant_regression`** — at least one named benchmark got
|
|
96
|
+
measurably worse. Look at exactly that benchmark before trying anything
|
|
97
|
+
else that touches the same code path; whatever you changed has a real
|
|
98
|
+
cost there.
|
|
99
|
+
|
|
100
|
+
## Idea bank
|
|
101
|
+
|
|
102
|
+
If you don't have a hypothesis, or the last few experiments went nowhere,
|
|
103
|
+
start here. These are general TypeScript/V8 performance patterns, not
|
|
104
|
+
guaranteed wins for any specific benchmark — profile or reason about the
|
|
105
|
+
hot path before committing to one.
|
|
106
|
+
|
|
107
|
+
- Replace repeated string concatenation in a loop with an array `join`, or
|
|
108
|
+
build once.
|
|
109
|
+
- Hoist a regex out of a hot function; a literal in a loop body may be
|
|
110
|
+
recompiled.
|
|
111
|
+
- Replace `Object` used as a dictionary with a `Map` for non-string or
|
|
112
|
+
high-churn keys, or the reverse for small fixed key sets.
|
|
113
|
+
- Avoid allocating in the hot path: reuse a buffer or array rather than
|
|
114
|
+
creating one per call.
|
|
115
|
+
- Replace `array.forEach`/`map`/`filter` chains in a hot loop with one
|
|
116
|
+
indexed `for` loop that does the work in a single pass.
|
|
117
|
+
- Avoid `spread` and `Object.assign` in hot paths; they allocate.
|
|
118
|
+
- Keep object shapes monomorphic: initialise every property in the
|
|
119
|
+
constructor, in the same order, and never `delete`.
|
|
120
|
+
- Prefer `for (let i = 0; i < a.length; i++)` over `for...of` on arrays in
|
|
121
|
+
the hottest loops, where the iterator protocol shows up.
|
|
122
|
+
- Replace `String.prototype.split` on a hot path with index-based scanning
|
|
123
|
+
when only positions are needed.
|
|
124
|
+
- Use typed arrays for numeric data instead of `number[]`.
|
|
125
|
+
- Cache `.length` and repeated property lookups in locals inside tight
|
|
126
|
+
loops.
|
|
127
|
+
- Avoid `try/catch` around a hot loop body; put it around the loop.
|
|
128
|
+
- Replace a `charCodeAt` comparison chain with a lookup table for
|
|
129
|
+
character classification.
|
|
130
|
+
- Short-circuit before doing work: check the cheap predicate first.
|
|
131
|
+
- Replace recursion with an explicit stack where call overhead dominates.
|