@opencode_weave/weave 0.6.3 → 0.6.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.
|
@@ -26,7 +26,8 @@ export declare function generateFingerprint(directory: string): ProjectFingerpri
|
|
|
26
26
|
*/
|
|
27
27
|
export declare function fingerprintProject(directory: string): ProjectFingerprint | null;
|
|
28
28
|
/**
|
|
29
|
-
* Get the cached fingerprint, or generate a new one if missing.
|
|
29
|
+
* Get the cached fingerprint, or generate a new one if missing or stale.
|
|
30
|
+
* Regenerates if the cached fingerprint was generated by a different Weave version.
|
|
30
31
|
* Fire-and-forget: errors are logged but never thrown.
|
|
31
32
|
*/
|
|
32
33
|
export declare function getOrCreateFingerprint(directory: string): ProjectFingerprint | null;
|
|
@@ -68,6 +68,8 @@ export interface ProjectFingerprint {
|
|
|
68
68
|
os?: string;
|
|
69
69
|
/** CPU architecture (e.g., "arm64", "x64") */
|
|
70
70
|
arch?: string;
|
|
71
|
+
/** Weave version that generated this fingerprint (e.g., "0.6.3") */
|
|
72
|
+
weaveVersion?: string;
|
|
71
73
|
}
|
|
72
74
|
/** A suggestion generated from session analytics */
|
|
73
75
|
export interface Suggestion {
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import { join as
|
|
2
|
+
import { join as join10 } from "path";
|
|
3
3
|
|
|
4
4
|
// src/config/loader.ts
|
|
5
5
|
import { existsSync, readFileSync } from "node:fs";
|
|
@@ -3407,9 +3407,36 @@ function readFingerprint(directory) {
|
|
|
3407
3407
|
}
|
|
3408
3408
|
}
|
|
3409
3409
|
// src/features/analytics/fingerprint.ts
|
|
3410
|
-
import { existsSync as existsSync9, readFileSync as
|
|
3411
|
-
import { join as
|
|
3410
|
+
import { existsSync as existsSync9, readFileSync as readFileSync9, readdirSync as readdirSync3 } from "fs";
|
|
3411
|
+
import { join as join9 } from "path";
|
|
3412
3412
|
import { arch } from "os";
|
|
3413
|
+
|
|
3414
|
+
// src/shared/version.ts
|
|
3415
|
+
import { readFileSync as readFileSync8 } from "fs";
|
|
3416
|
+
import { fileURLToPath } from "url";
|
|
3417
|
+
import { dirname as dirname2, join as join8 } from "path";
|
|
3418
|
+
var cachedVersion;
|
|
3419
|
+
function getWeaveVersion() {
|
|
3420
|
+
if (cachedVersion !== undefined)
|
|
3421
|
+
return cachedVersion;
|
|
3422
|
+
try {
|
|
3423
|
+
const thisDir = dirname2(fileURLToPath(import.meta.url));
|
|
3424
|
+
for (const rel of ["../../package.json", "../package.json"]) {
|
|
3425
|
+
try {
|
|
3426
|
+
const pkg = JSON.parse(readFileSync8(join8(thisDir, rel), "utf-8"));
|
|
3427
|
+
if (pkg.name === "@opencode_weave/weave" && typeof pkg.version === "string") {
|
|
3428
|
+
const version = pkg.version;
|
|
3429
|
+
cachedVersion = version;
|
|
3430
|
+
return version;
|
|
3431
|
+
}
|
|
3432
|
+
} catch {}
|
|
3433
|
+
}
|
|
3434
|
+
} catch {}
|
|
3435
|
+
cachedVersion = "0.0.0";
|
|
3436
|
+
return cachedVersion;
|
|
3437
|
+
}
|
|
3438
|
+
|
|
3439
|
+
// src/features/analytics/fingerprint.ts
|
|
3413
3440
|
var STACK_MARKERS = [
|
|
3414
3441
|
{
|
|
3415
3442
|
name: "typescript",
|
|
@@ -3501,7 +3528,7 @@ function detectStack(directory) {
|
|
|
3501
3528
|
const detected = [];
|
|
3502
3529
|
for (const marker of STACK_MARKERS) {
|
|
3503
3530
|
for (const file of marker.files) {
|
|
3504
|
-
if (existsSync9(
|
|
3531
|
+
if (existsSync9(join9(directory, file))) {
|
|
3505
3532
|
detected.push({
|
|
3506
3533
|
name: marker.name,
|
|
3507
3534
|
confidence: marker.confidence,
|
|
@@ -3512,9 +3539,9 @@ function detectStack(directory) {
|
|
|
3512
3539
|
}
|
|
3513
3540
|
}
|
|
3514
3541
|
try {
|
|
3515
|
-
const pkgPath =
|
|
3542
|
+
const pkgPath = join9(directory, "package.json");
|
|
3516
3543
|
if (existsSync9(pkgPath)) {
|
|
3517
|
-
const pkg = JSON.parse(
|
|
3544
|
+
const pkg = JSON.parse(readFileSync9(pkgPath, "utf-8"));
|
|
3518
3545
|
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
3519
3546
|
if (deps.react) {
|
|
3520
3547
|
detected.push({
|
|
@@ -3547,27 +3574,27 @@ function detectStack(directory) {
|
|
|
3547
3574
|
});
|
|
3548
3575
|
}
|
|
3549
3576
|
function detectPackageManager(directory) {
|
|
3550
|
-
if (existsSync9(
|
|
3577
|
+
if (existsSync9(join9(directory, "bun.lockb")))
|
|
3551
3578
|
return "bun";
|
|
3552
|
-
if (existsSync9(
|
|
3579
|
+
if (existsSync9(join9(directory, "pnpm-lock.yaml")))
|
|
3553
3580
|
return "pnpm";
|
|
3554
|
-
if (existsSync9(
|
|
3581
|
+
if (existsSync9(join9(directory, "yarn.lock")))
|
|
3555
3582
|
return "yarn";
|
|
3556
|
-
if (existsSync9(
|
|
3583
|
+
if (existsSync9(join9(directory, "package-lock.json")))
|
|
3557
3584
|
return "npm";
|
|
3558
|
-
if (existsSync9(
|
|
3585
|
+
if (existsSync9(join9(directory, "package.json")))
|
|
3559
3586
|
return "npm";
|
|
3560
3587
|
return;
|
|
3561
3588
|
}
|
|
3562
3589
|
function detectMonorepo(directory) {
|
|
3563
3590
|
for (const marker of MONOREPO_MARKERS) {
|
|
3564
|
-
if (existsSync9(
|
|
3591
|
+
if (existsSync9(join9(directory, marker)))
|
|
3565
3592
|
return true;
|
|
3566
3593
|
}
|
|
3567
3594
|
try {
|
|
3568
|
-
const pkgPath =
|
|
3595
|
+
const pkgPath = join9(directory, "package.json");
|
|
3569
3596
|
if (existsSync9(pkgPath)) {
|
|
3570
|
-
const pkg = JSON.parse(
|
|
3597
|
+
const pkg = JSON.parse(readFileSync9(pkgPath, "utf-8"));
|
|
3571
3598
|
if (pkg.workspaces)
|
|
3572
3599
|
return true;
|
|
3573
3600
|
}
|
|
@@ -3593,7 +3620,8 @@ function generateFingerprint(directory) {
|
|
|
3593
3620
|
packageManager: detectPackageManager(directory),
|
|
3594
3621
|
primaryLanguage: detectPrimaryLanguage(stack),
|
|
3595
3622
|
os: process.platform,
|
|
3596
|
-
arch: arch()
|
|
3623
|
+
arch: arch(),
|
|
3624
|
+
weaveVersion: getWeaveVersion()
|
|
3597
3625
|
};
|
|
3598
3626
|
}
|
|
3599
3627
|
function fingerprintProject(directory) {
|
|
@@ -3614,8 +3642,16 @@ function fingerprintProject(directory) {
|
|
|
3614
3642
|
function getOrCreateFingerprint(directory) {
|
|
3615
3643
|
try {
|
|
3616
3644
|
const existing = readFingerprint(directory);
|
|
3617
|
-
if (existing)
|
|
3618
|
-
|
|
3645
|
+
if (existing) {
|
|
3646
|
+
const currentVersion = getWeaveVersion();
|
|
3647
|
+
if (existing.weaveVersion === currentVersion) {
|
|
3648
|
+
return existing;
|
|
3649
|
+
}
|
|
3650
|
+
log("[analytics] Fingerprint version mismatch — regenerating", {
|
|
3651
|
+
cached: existing.weaveVersion ?? "none",
|
|
3652
|
+
current: currentVersion
|
|
3653
|
+
});
|
|
3654
|
+
}
|
|
3619
3655
|
return fingerprintProject(directory);
|
|
3620
3656
|
} catch (err) {
|
|
3621
3657
|
log("[analytics] getOrCreateFingerprint failed (non-fatal)", { error: String(err) });
|
|
@@ -3734,7 +3770,7 @@ var WeavePlugin = async (ctx) => {
|
|
|
3734
3770
|
const isHookEnabled = (name) => !disabledHooks.has(name);
|
|
3735
3771
|
const analyticsEnabled = pluginConfig.analytics?.enabled === true;
|
|
3736
3772
|
const fingerprint = analyticsEnabled ? getOrCreateFingerprint(ctx.directory) : null;
|
|
3737
|
-
const configDir =
|
|
3773
|
+
const configDir = join10(ctx.directory, ".opencode");
|
|
3738
3774
|
const toolsResult = await createTools({ ctx, pluginConfig });
|
|
3739
3775
|
const managers = createManagers({ ctx, pluginConfig, resolveSkills: toolsResult.resolveSkillsFn, fingerprint, configDir });
|
|
3740
3776
|
const hooks = createHooks({ pluginConfig, isHookEnabled, directory: ctx.directory, analyticsEnabled });
|
package/dist/shared/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type { DeepPartial, Brand } from "./types";
|
|
2
|
+
export { getWeaveVersion } from "./version";
|
|
2
3
|
export { log, getLogFilePath, logDelegation } from "./log";
|
|
3
4
|
export type { DelegationEvent } from "./log";
|
|
4
5
|
export { AGENT_DISPLAY_NAMES, getAgentDisplayName, getAgentConfigKey, registerAgentDisplayName, } from "./agent-display-names";
|