@devflow-tools/cli 0.16.2 → 0.16.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/dist/commands/doctor.d.ts +4 -19
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +86 -1
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +13 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/memory-maintain.d.ts +9 -0
- package/dist/commands/memory-maintain.d.ts.map +1 -0
- package/dist/commands/memory-maintain.js +32 -0
- package/dist/commands/memory-maintain.js.map +1 -0
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +14 -0
- package/dist/commands/status.js.map +1 -1
- package/dist/index.js +29 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/plugin-setup.d.ts +35 -1
- package/dist/lib/plugin-setup.d.ts.map +1 -1
- package/dist/lib/plugin-setup.js +180 -2
- package/dist/lib/plugin-setup.js.map +1 -1
- package/dist/plugin-files/.claude-plugin/plugin.json +2 -2
- package/dist/plugin-files/dist/hooks/hook-client.js +6 -6
- package/dist/plugin-files/dist/hooks/hook-daemon.js +6 -6
- package/dist/plugin-files/dist/hooks/post-tool-use.js +3 -3
- package/dist/plugin-files/dist/hooks/pre-tool-use.js +2 -2
- package/dist/plugin-files/dist/hooks/session-end.js +2 -2
- package/dist/plugin-files/hooks/session-start +37 -7
- package/dist/plugin-files/package.json +7 -7
- package/package.json +27 -27
|
@@ -1,21 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export type
|
|
3
|
-
export
|
|
4
|
-
key: string;
|
|
5
|
-
value: unknown;
|
|
6
|
-
target?: unknown;
|
|
7
|
-
ok: boolean;
|
|
8
|
-
severity?: DoctorSeverity;
|
|
9
|
-
}
|
|
10
|
-
export interface DoctorSection {
|
|
11
|
-
name: "Isolation" | "Distill" | "Vectors" | "Telemetry" | "Injection" | "Memory quality" | "Knowledge quality" | "Contract" | "Deadcode" | "Data face" | "Legacy paths" | "Runtime security" | "Benchmark" | "UI reachability" | "Hook path health";
|
|
12
|
-
status: DoctorStatus;
|
|
13
|
-
metrics: DoctorMetric[];
|
|
14
|
-
}
|
|
15
|
-
export interface DoctorResult {
|
|
16
|
-
sections: DoctorSection[];
|
|
17
|
-
exitCode: number;
|
|
18
|
-
}
|
|
1
|
+
import type { DoctorReportV1 } from "@devflow-tools/sdk";
|
|
2
|
+
export type { DoctorMetric, DoctorReportV1, DoctorSection, DoctorSeverity, DoctorStatus, } from "@devflow-tools/sdk";
|
|
3
|
+
export type DoctorResult = DoctorReportV1;
|
|
19
4
|
export interface DoctorOptions {
|
|
20
5
|
project?: string;
|
|
21
6
|
json?: boolean;
|
|
@@ -38,6 +23,7 @@ export interface DoctorDependencies {
|
|
|
38
23
|
installedPluginsPath?: string;
|
|
39
24
|
knownMarketplacesPath?: string;
|
|
40
25
|
pluginCachePath?: string;
|
|
26
|
+
activePluginRoot?: string;
|
|
41
27
|
env?: NodeJS.ProcessEnv;
|
|
42
28
|
now?: () => number;
|
|
43
29
|
openDatabase?: (path: string) => DoctorDatabase;
|
|
@@ -110,5 +96,4 @@ export declare function runDoctorReceipts(): {
|
|
|
110
96
|
sessionId: string;
|
|
111
97
|
data: unknown;
|
|
112
98
|
};
|
|
113
|
-
export {};
|
|
114
99
|
//# sourceMappingURL=doctor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAEV,cAAc,EAIf,MAAM,oBAAoB,CAAC;AAK5B,YAAY,EACV,YAAY,EACZ,cAAc,EACd,aAAa,EACb,cAAc,EACd,YAAY,GACb,MAAM,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;QAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;IAC7D,UAAU,EAAE,MAAM,CAAC;CACpB;AAOD,wBAAsB,qBAAqB,CACzC,OAAO,SAAgB,GACtB,OAAO,CAAC,YAAY,CAAC,CA8DvB;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC;IAC9C,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC,CAiBD;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAevE;AAED,wBAAsB,mBAAmB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChE,UAAU,EAAE,KAAK,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;QACtB,EAAE,EAAE,MAAM,CAAC;QACX,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;CACJ,CAAC,CAsBD;AAED,wBAAgB,iBAAiB,IAAI;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CASxE"}
|
package/dist/commands/doctor.js
CHANGED
|
@@ -6,6 +6,8 @@ import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep }
|
|
|
6
6
|
import { spawnSync } from "node:child_process";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
8
|
import chalk from "chalk";
|
|
9
|
+
import { DOCTOR_SCHEMA_VERSION } from "@devflow-tools/sdk";
|
|
10
|
+
import { resolveActivePlugin, scanClaudeSkillShadowing } from "../lib/plugin-setup.js";
|
|
9
11
|
import { serverStatus } from "./server.js";
|
|
10
12
|
import { getGlobalDevFlowDbPath } from "@devflow-tools/database";
|
|
11
13
|
function getProjectHash(rootPath) {
|
|
@@ -371,6 +373,15 @@ function checkDistill(project, dependencies) {
|
|
|
371
373
|
ok: staleUnleased === 0,
|
|
372
374
|
severity: "error",
|
|
373
375
|
});
|
|
376
|
+
const oldestPending = openedDb.prepare("SELECT MIN(created_at) oldest FROM session_events WHERE processed = 0").get();
|
|
377
|
+
const oldestPendingAt = oldestPending?.oldest == null ? null : Number(oldestPending.oldest);
|
|
378
|
+
metrics.push({
|
|
379
|
+
key: "pending_memory_oldest_age_ms",
|
|
380
|
+
value: oldestPendingAt === null ? 0 : Math.max(0, now - oldestPendingAt),
|
|
381
|
+
target: "<= 300000 when no active lease is present",
|
|
382
|
+
ok: oldestPendingAt === null || staleUnleased === 0,
|
|
383
|
+
severity: "warning",
|
|
384
|
+
});
|
|
374
385
|
const orphanEvents = doctorCount(openedDb, `
|
|
375
386
|
SELECT COUNT(*) count
|
|
376
387
|
FROM session_events event
|
|
@@ -475,6 +486,14 @@ function checkVectors(project, dependencies) {
|
|
|
475
486
|
codegraphNodes = doctorCount(db, "SELECT COUNT(*) count FROM nodes");
|
|
476
487
|
metrics.push({ key: "codegraph_nodes", value: codegraphNodes, ok: true, severity: "info" });
|
|
477
488
|
}
|
|
489
|
+
const freshnessMs = Math.max(0, (dependencies.now ?? Date.now)() - statSync(codegraphPath).mtimeMs);
|
|
490
|
+
metrics.push({
|
|
491
|
+
key: "index_freshness_ms",
|
|
492
|
+
value: freshnessMs,
|
|
493
|
+
target: "recently updated codegraph database",
|
|
494
|
+
ok: true,
|
|
495
|
+
severity: "info",
|
|
496
|
+
});
|
|
478
497
|
}
|
|
479
498
|
catch (error) {
|
|
480
499
|
metrics.push({ key: "codegraph_db_read", value: error.message, target: "readable SQLite database", ok: false, severity: "error" });
|
|
@@ -3671,6 +3690,39 @@ function checkLegacyPaths(project, dependencies) {
|
|
|
3671
3690
|
? `${selection.method}-unresolved`
|
|
3672
3691
|
: selection.method;
|
|
3673
3692
|
const lifecycle = inspectPluginLifecycle(selection.targets, dependencies);
|
|
3693
|
+
const injectedSettingsHome = dependencies.claudeSettingsPath
|
|
3694
|
+
? dirname(dependencies.claudeSettingsPath)
|
|
3695
|
+
: null;
|
|
3696
|
+
const skillHome = dependencies.homePath
|
|
3697
|
+
?? (injectedSettingsHome && basename(injectedSettingsHome) === ".claude"
|
|
3698
|
+
? dirname(injectedSettingsHome)
|
|
3699
|
+
: injectedSettingsHome)
|
|
3700
|
+
?? homedir();
|
|
3701
|
+
const selectedSkillRoot = selection.targets
|
|
3702
|
+
.map((target) => target.root)
|
|
3703
|
+
.find((root) => existsSync(join(root, "skills"))) ?? null;
|
|
3704
|
+
const activePlugin = dependencies.activePluginRoot
|
|
3705
|
+
? {
|
|
3706
|
+
root: existsSync(dependencies.activePluginRoot) ? dependencies.activePluginRoot : null,
|
|
3707
|
+
version: null,
|
|
3708
|
+
}
|
|
3709
|
+
: selectedSkillRoot
|
|
3710
|
+
? { root: selectedSkillRoot, version: null }
|
|
3711
|
+
: resolveActivePlugin(skillHome, {
|
|
3712
|
+
installedPluginsPath: dependencies.installedPluginsPath,
|
|
3713
|
+
pluginCachePath: dependencies.pluginCachePath,
|
|
3714
|
+
});
|
|
3715
|
+
const activeSkillRoot = activePlugin.root;
|
|
3716
|
+
const shadowedSkills = activeSkillRoot
|
|
3717
|
+
? scanClaudeSkillShadowing(skillHome, activeSkillRoot)
|
|
3718
|
+
: [];
|
|
3719
|
+
const remediation = shadowedSkills
|
|
3720
|
+
.filter((skill) => !skill.isKnownDevFlowArtifact)
|
|
3721
|
+
.map((skill) => ({
|
|
3722
|
+
skillName: skill.skillName,
|
|
3723
|
+
path: skill.globalPath,
|
|
3724
|
+
action: "inspect manually; file is modified or not a known DevFlow artifact",
|
|
3725
|
+
}));
|
|
3674
3726
|
const metrics = [
|
|
3675
3727
|
{
|
|
3676
3728
|
key: "active_plugin_resolution",
|
|
@@ -3802,7 +3854,40 @@ function checkLegacyPaths(project, dependencies) {
|
|
|
3802
3854
|
ok: true,
|
|
3803
3855
|
severity: "info",
|
|
3804
3856
|
},
|
|
3857
|
+
{
|
|
3858
|
+
key: "skill_shadowing_count",
|
|
3859
|
+
value: shadowedSkills.length,
|
|
3860
|
+
target: 0,
|
|
3861
|
+
ok: shadowedSkills.length === 0,
|
|
3862
|
+
severity: "error",
|
|
3863
|
+
},
|
|
3864
|
+
{
|
|
3865
|
+
key: "shadowed_skills",
|
|
3866
|
+
value: shadowedSkills,
|
|
3867
|
+
target: [],
|
|
3868
|
+
ok: shadowedSkills.length === 0,
|
|
3869
|
+
severity: "error",
|
|
3870
|
+
},
|
|
3871
|
+
{
|
|
3872
|
+
key: "active_skill_source",
|
|
3873
|
+
value: activeSkillRoot,
|
|
3874
|
+
target: "existing plugin cache path",
|
|
3875
|
+
ok: true,
|
|
3876
|
+
severity: "info",
|
|
3877
|
+
},
|
|
3878
|
+
{
|
|
3879
|
+
key: "skill_shadowing_remediation",
|
|
3880
|
+
value: remediation,
|
|
3881
|
+
target: [],
|
|
3882
|
+
ok: true,
|
|
3883
|
+
severity: "info",
|
|
3884
|
+
},
|
|
3805
3885
|
];
|
|
3886
|
+
const activePluginVersion = activePlugin.version
|
|
3887
|
+
?? lifecycle.versionRecords.find((record) => record.root === activeSkillRoot)?.packageVersion;
|
|
3888
|
+
if (activePluginVersion) {
|
|
3889
|
+
metrics.push({ key: "active_plugin_version", value: activePluginVersion, ok: true, severity: "info" });
|
|
3890
|
+
}
|
|
3806
3891
|
return { name: "Legacy paths", status: sectionStatus(metrics), metrics };
|
|
3807
3892
|
}
|
|
3808
3893
|
function loadAcceptanceManifest(dependencies) {
|
|
@@ -4100,7 +4185,7 @@ export async function runStructuredDoctor(options = {}, dependencies = {}) {
|
|
|
4100
4185
|
const exitCode = options.strict && sections.some((section) => section.status !== "green")
|
|
4101
4186
|
? 1
|
|
4102
4187
|
: 0;
|
|
4103
|
-
return { sections, exitCode };
|
|
4188
|
+
return { schemaVersion: DOCTOR_SCHEMA_VERSION, sections, exitCode };
|
|
4104
4189
|
}
|
|
4105
4190
|
export function runDoctor(options, dependencies = {}) {
|
|
4106
4191
|
return options === undefined
|