@kennykeni/agent-trace 0.1.0 → 0.1.2
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 -1
- package/package.json +2 -8
- package/src/core/schemas.ts +0 -20
- package/src/core/trace-store.ts +7 -2
package/README.md
CHANGED
|
@@ -103,7 +103,7 @@ Schema source: [`schemas.ts`](./src/core/schemas.ts)
|
|
|
103
103
|
|
|
104
104
|
## Known limitations
|
|
105
105
|
|
|
106
|
-
- **
|
|
106
|
+
- **indexOf-based range attribution**: When the same text appears multiple times in a file, line-range attribution may point to the first occurrence rather than the actual edit location. Providers don't always supply line numbers, so `indexOf` is the best-effort fallback.
|
|
107
107
|
- **Bun-only**: The hook runtime and CLI require Bun. Node.js is not supported.
|
|
108
108
|
- **No VCS requirement**: Works without git. When git is available, traces include the current commit SHA. Without git, VCS info is omitted.
|
|
109
109
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kennykeni/agent-trace",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"agent-trace": "src/cli.ts"
|
|
@@ -14,8 +14,6 @@
|
|
|
14
14
|
"url": "https://github.com/KennyKeni/agent-trace.git"
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
|
-
"build": "bun run index.ts",
|
|
18
|
-
"dev": "bun run index.ts --dev",
|
|
19
17
|
"check": "tsc --noEmit && biome check .",
|
|
20
18
|
"check:fix": "biome check --write .",
|
|
21
19
|
"format": "biome format --write .",
|
|
@@ -28,10 +26,6 @@
|
|
|
28
26
|
},
|
|
29
27
|
"devDependencies": {
|
|
30
28
|
"@biomejs/biome": "^2.3.14",
|
|
31
|
-
"@types/bun": "latest"
|
|
32
|
-
"marked": "^15.0.0",
|
|
33
|
-
"marked-shiki": "^1.2.0",
|
|
34
|
-
"shiki": "^3.0.0",
|
|
35
|
-
"zod-to-json-schema": "^3.24.0"
|
|
29
|
+
"@types/bun": "latest"
|
|
36
30
|
}
|
|
37
31
|
}
|
package/src/core/schemas.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
3
2
|
|
|
4
3
|
export const SPEC_VERSION = "0.1.0";
|
|
5
4
|
|
|
6
|
-
const SCHEMA_BASE_URL = "https://agent-trace.dev/schemas/v1";
|
|
7
|
-
|
|
8
5
|
export const ContributorTypeSchema = z.enum([
|
|
9
6
|
"human",
|
|
10
7
|
"ai",
|
|
@@ -109,23 +106,6 @@ export const TraceRecordSchema = z.object({
|
|
|
109
106
|
),
|
|
110
107
|
});
|
|
111
108
|
|
|
112
|
-
export function generateJsonSchemas(): Record<string, object> {
|
|
113
|
-
const schemas: Record<string, object> = {};
|
|
114
|
-
|
|
115
|
-
// Trace Record Schema
|
|
116
|
-
schemas["trace-record.json"] = {
|
|
117
|
-
...zodToJsonSchema(TraceRecordSchema, {
|
|
118
|
-
name: "TraceRecord",
|
|
119
|
-
$refStrategy: "none",
|
|
120
|
-
}),
|
|
121
|
-
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
122
|
-
$id: `${SCHEMA_BASE_URL}/trace-record.json`,
|
|
123
|
-
title: "Agent Trace Record",
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
return schemas;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
109
|
export type ContributorType = z.infer<typeof ContributorTypeSchema>;
|
|
130
110
|
export type VcsType = z.infer<typeof VcsTypeSchema>;
|
|
131
111
|
export type Vcs = z.infer<typeof VcsSchema>;
|
package/src/core/trace-store.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type {
|
|
|
10
10
|
} from "./schemas";
|
|
11
11
|
import { SPEC_VERSION } from "./schemas";
|
|
12
12
|
import type { FileEdit, RangePosition } from "./types";
|
|
13
|
-
import { ensureDir,
|
|
13
|
+
import { ensureDir, resolvePosition } from "./utils";
|
|
14
14
|
|
|
15
15
|
export type {
|
|
16
16
|
ContributorType,
|
|
@@ -77,7 +77,12 @@ export function toRelativePath(
|
|
|
77
77
|
if (!isAbsolute(filePath)) {
|
|
78
78
|
const resolved = resolve(root, filePath);
|
|
79
79
|
const rel = relative(resolve(root), resolved);
|
|
80
|
-
if (
|
|
80
|
+
if (
|
|
81
|
+
rel === ".." ||
|
|
82
|
+
rel.startsWith(`..${sep}`) ||
|
|
83
|
+
isAbsolute(rel) ||
|
|
84
|
+
rel === ""
|
|
85
|
+
)
|
|
81
86
|
return undefined;
|
|
82
87
|
return rel;
|
|
83
88
|
}
|