howtofixcli 0.7.8 → 0.7.10
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/chunk-27TRKD65.js +2 -0
- package/dist/chunk-2YYQ3OBQ.js +1 -0
- package/dist/chunk-3FYCFLNK.js +1 -0
- package/dist/chunk-3KT55SQP.js +34 -0
- package/dist/chunk-4BWDGEXH.js +5 -0
- package/dist/chunk-56SEAGAQ.js +1 -0
- package/dist/chunk-6FUWMLWO.js +1 -0
- package/dist/chunk-7CHDNTH6.js +1 -0
- package/dist/chunk-ACOMNDUL.js +185 -0
- package/dist/chunk-AGGIYXN7.js +2 -0
- package/dist/chunk-BHVBO4SC.js +1 -0
- package/dist/chunk-CGHISVXB.js +1 -0
- package/dist/chunk-FPXVDP32.js +8 -0
- package/dist/chunk-FRGMJPNO.js +2 -0
- package/dist/chunk-GXB7RZHH.js +1 -0
- package/dist/chunk-ILDDDLRC.js +1 -0
- package/dist/chunk-JFYVRWJI.js +2 -0
- package/dist/chunk-MTNY7MFG.js +6 -0
- package/dist/chunk-MVLCGU3G.js +1 -0
- package/dist/chunk-N345KWWK.js +1 -0
- package/dist/chunk-ORJ2QZBG.js +3 -0
- package/dist/chunk-PCALBZOO.js +2 -0
- package/dist/chunk-PIEAJJRE.js +5 -0
- package/dist/chunk-RDRF7DIS.js +109 -0
- package/dist/chunk-TEW62VDF.js +1 -0
- package/dist/chunk-TSEKPGK4.js +1 -0
- package/dist/chunk-UTYFLLSM.js +1 -0
- package/dist/chunk-V3R4FYTJ.js +1 -0
- package/dist/chunk-V656XVXV.js +8 -0
- package/dist/chunk-VICEM5Y2.js +2 -0
- package/dist/chunk-WKUJ7CFO.js +1 -0
- package/dist/chunk-WOT6VMZA.js +1 -0
- package/dist/chunk-WUPU6LTD.js +4 -0
- package/dist/chunk-WX3V5P7U.js +5 -0
- package/dist/chunk-WZKWT757.js +2 -0
- package/dist/main.js +94 -536
- package/package.json +16 -63
- package/dist/account-credential.js +0 -136
- package/dist/account-credential.test.js +0 -38
- package/dist/activity.js +0 -124
- package/dist/agent-defs.js +0 -237
- package/dist/agent-limiter.js +0 -68
- package/dist/agents.js +0 -554
- package/dist/anim.js +0 -361
- package/dist/args.js +0 -228
- package/dist/at-file.js +0 -28
- package/dist/brand-extension.js +0 -87
- package/dist/brand.js +0 -76
- package/dist/browser.js +0 -58
- package/dist/cache-report.js +0 -139
- package/dist/checkpoint.js +0 -437
- package/dist/claims.js +0 -167
- package/dist/cli-auth.js +0 -142
- package/dist/cli-checkin.js +0 -120
- package/dist/cli-credentials.js +0 -254
- package/dist/clipboard.js +0 -149
- package/dist/collapse.js +0 -129
- package/dist/commands.js +0 -301
- package/dist/compaction-guard.js +0 -81
- package/dist/context-extension.js +0 -17
- package/dist/dcp/commands.js +0 -172
- package/dist/dcp/compress-state.js +0 -139
- package/dist/dcp/compress.js +0 -329
- package/dist/dcp/dcp-extension.js +0 -288
- package/dist/dcp/dedup.js +0 -93
- package/dist/dcp/ids.js +0 -189
- package/dist/dcp/index.js +0 -25
- package/dist/dcp/prompts.js +0 -68
- package/dist/dcp/protected-content.js +0 -221
- package/dist/dcp/protected.js +0 -161
- package/dist/dcp/prune.js +0 -418
- package/dist/dcp/state.js +0 -176
- package/dist/device-id.js +0 -90
- package/dist/device-id.test.js +0 -23
- package/dist/errors.js +0 -63
- package/dist/extensions.js +0 -48
- package/dist/fatal.js +0 -35
- package/dist/feed.js +0 -498
- package/dist/fs-atomic.js +0 -54
- package/dist/gateway-errors.js +0 -90
- package/dist/git.js +0 -230
- package/dist/goal-extension.js +0 -88
- package/dist/goal.js +0 -222
- package/dist/hooks-extension.js +0 -176
- package/dist/hooks.js +0 -443
- package/dist/howtofix-account.js +0 -715
- package/dist/hud-line.js +0 -153
- package/dist/hwid.js +0 -130
- package/dist/interrupt.js +0 -60
- package/dist/json-events.js +0 -50
- package/dist/level-style.js +0 -112
- package/dist/loop-guard.js +0 -95
- package/dist/lsp-tools.js +0 -32
- package/dist/lsp.js +0 -347
- package/dist/mcp-config.js +0 -85
- package/dist/mcp-lifecycle.js +0 -147
- package/dist/model-catalog.js +0 -217
- package/dist/model-resolve.js +0 -65
- package/dist/notes.js +0 -78
- package/dist/oauth-login.js +0 -568
- package/dist/paths.js +0 -61
- package/dist/permissions.js +0 -298
- package/dist/plan-mode.js +0 -363
- package/dist/preset-command.js +0 -227
- package/dist/preset-extension.js +0 -35
- package/dist/preset-mcp.js +0 -292
- package/dist/presets.js +0 -727
- package/dist/prompt-files.js +0 -103
- package/dist/prompt-text.js +0 -41
- package/dist/proxy.js +0 -137
- package/dist/quality/ast.js +0 -196
- package/dist/quality/cognitive.js +0 -83
- package/dist/quality/cyclomatic.js +0 -30
- package/dist/quality/halstead.js +0 -83
- package/dist/quality/index.js +0 -18
- package/dist/quality/length.js +0 -3
- package/dist/quality/maintainability.js +0 -15
- package/dist/quality/nesting.js +0 -57
- package/dist/quality/report.js +0 -803
- package/dist/quality/smells.js +0 -67
- package/dist/quality-tool.js +0 -63
- package/dist/read-only-commands.js +0 -597
- package/dist/repo-map.js +0 -292
- package/dist/rtk.js +0 -193
- package/dist/sandbox.js +0 -105
- package/dist/schema.js +0 -214
- package/dist/session-lifecycle.js +0 -19
- package/dist/session-retention.js +0 -111
- package/dist/session.js +0 -446
- package/dist/sessions.js +0 -100
- package/dist/settings.js +0 -148
- package/dist/skills.js +0 -35
- package/dist/slop-tool.js +0 -96
- package/dist/spend-cap.js +0 -43
- package/dist/subagent.js +0 -171
- package/dist/tar.js +0 -146
- package/dist/theme.js +0 -79
- package/dist/thinking.js +0 -45
- package/dist/todo.js +0 -114
- package/dist/tool-loadout.js +0 -97
- package/dist/tool-render.js +0 -769
- package/dist/tools.js +0 -176
- package/dist/ui.js +0 -4757
- package/dist/update.js +0 -533
- package/dist/usage-segment.js +0 -69
- package/dist/web-tools.js +0 -46
- package/dist/web.js +0 -265
- package/dist/welcome.js +0 -179
- package/dist/workflow-engine.js +0 -246
- package/dist/workflow-progress.js +0 -446
- package/dist/workflow-view.js +0 -195
- package/dist/workflow.js +0 -349
package/dist/quality/smells.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compound smells — spec §3.7.
|
|
3
|
-
*
|
|
4
|
-
* A smell fires only when SEVERAL metrics are over their warn line at the same
|
|
5
|
-
* time; one metric over the line is just a number and is reported as such.
|
|
6
|
-
* Ids, labels, and conditions come from the reference
|
|
7
|
-
* (`code-multivitals/src/analyzers/smells.ts`); the `warn`/`ok` tests of the
|
|
8
|
-
* reference are expressed here as severity RANKS supplied by the caller, so
|
|
9
|
-
* this module depends on neither thresholds nor config and stays trivially
|
|
10
|
-
* testable.
|
|
11
|
-
*
|
|
12
|
-
* Rank semantics (from `report.ts`): `0` = ok, `1` = warn, `2` = error; a
|
|
13
|
-
* metric "at warn" means rank ≥ 1 (warn or worse), and MI < 65 is exactly
|
|
14
|
-
* rank(mi) ≥ 1.
|
|
15
|
-
*/
|
|
16
|
-
/** The report prints one concrete next step per smell that fired (spec §6). */
|
|
17
|
-
export const SMELL_SUGGESTIONS = {
|
|
18
|
-
"god-function": "split it into smaller functions, one job each",
|
|
19
|
-
incomprehensible: "extract helpers and simplify the flow before touching it",
|
|
20
|
-
bloated: "long but linear; extract helpers",
|
|
21
|
-
"deeply-tangled": "nesting, not branching; flatten with early returns",
|
|
22
|
-
fragile: "many branches; add guard clauses and tests around it",
|
|
23
|
-
};
|
|
24
|
-
export function detectSmells(values, ranks) {
|
|
25
|
-
const smells = [];
|
|
26
|
-
// God Function: does too much — long, branchy, AND deep.
|
|
27
|
-
if (ranks.cyclomatic >= 1 && ranks.length >= 1 && ranks.nesting >= 1) {
|
|
28
|
-
smells.push({
|
|
29
|
-
id: "god-function",
|
|
30
|
-
label: "God Function",
|
|
31
|
-
reason: `high cyclomatic complexity (${values.cyclomatic}), long body (${values.length} lines), and deep nesting (${values.nesting}) — likely doing too many things`,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
// Incomprehensible: hard to read — cognitively dense, big vocabulary, low MI.
|
|
35
|
-
if (ranks.cognitive >= 1 && ranks.halstead >= 1 && ranks.mi >= 1) {
|
|
36
|
-
smells.push({
|
|
37
|
-
id: "incomprehensible",
|
|
38
|
-
label: "Incomprehensible",
|
|
39
|
-
reason: `high cognitive complexity (${values.cognitive}) and Halstead volume (${values.halstead}) with MI ${values.mi} — very hard to understand`,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
// Bloated: too much code, but not because of branching — extract helpers.
|
|
43
|
-
if (ranks.length >= 1 && ranks.halstead >= 1 && ranks.cyclomatic === 0) {
|
|
44
|
-
smells.push({
|
|
45
|
-
id: "bloated",
|
|
46
|
-
label: "Bloated",
|
|
47
|
-
reason: `large function (${values.length} lines) with high vocabulary (Halstead ${values.halstead}) but low branching — consider extracting helpers`,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
// Deeply Tangled: the complexity comes from nesting, not from branches.
|
|
51
|
-
if (ranks.nesting >= 1 && ranks.cognitive >= 1 && ranks.cyclomatic === 0) {
|
|
52
|
-
smells.push({
|
|
53
|
-
id: "deeply-tangled",
|
|
54
|
-
label: "Deeply Tangled",
|
|
55
|
-
reason: `nesting depth ${values.nesting} drives cognitive complexity ${values.cognitive} — flatten with early returns or extracted helpers`,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
// Fragile: branchy and hard to maintain, but short enough to not be bloated.
|
|
59
|
-
if (ranks.cyclomatic >= 1 && ranks.mi >= 1 && ranks.length === 0) {
|
|
60
|
-
smells.push({
|
|
61
|
-
id: "fragile",
|
|
62
|
-
label: "Fragile",
|
|
63
|
-
reason: `high cyclomatic complexity (${values.cyclomatic}) with MI ${values.mi} — many branches, hard to change safely`,
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
return smells;
|
|
67
|
-
}
|
package/dist/quality-tool.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `quality` tool — metrics for the code the agent just wrote.
|
|
3
|
-
*
|
|
4
|
-
* Read-only by construction: it analyses source and reports, it never edits.
|
|
5
|
-
* That is the whole point of exposing it to the agent. A run that ends with
|
|
6
|
-
* "done" can be checked against numbers instead of a claim, and the agent can
|
|
7
|
-
* act on the numbers before it reports: "cognitive 31, split it" is something
|
|
8
|
-
* it can fix, "looks clean to me" is not.
|
|
9
|
-
*
|
|
10
|
-
* It defaults to the files the agent is most likely to have touched rather than
|
|
11
|
-
* the whole project, because a whole-project scan on a large repo is slow and
|
|
12
|
-
* buries the one function the agent just wrote under a hundred unrelated
|
|
13
|
-
* warnings.
|
|
14
|
-
*/
|
|
15
|
-
import { defineTool } from "@netrodev/hxf-coding-agent";
|
|
16
|
-
import { Type } from "typebox";
|
|
17
|
-
import { analyzeFiles, collectTargetPaths, formatHuman, loadQualityConfig, qualityEnabled, reportScore, summarize } from "./quality/index.js";
|
|
18
|
-
/** Longest report handed back to the model, so one call cannot flood the context. */
|
|
19
|
-
const MAX_REPORT_CHARS = 6000;
|
|
20
|
-
export const qualityTool = defineTool({
|
|
21
|
-
name: "quality",
|
|
22
|
-
label: "quality",
|
|
23
|
-
description: "Measure code quality: cyclomatic and cognitive complexity, nesting depth, function length, Halstead volume, maintainability index, and compound smells like god-function and deeply-tangled. Read-only. Use it before reporting a task finished, especially on functions you just wrote or changed; it reports concrete numbers with line numbers and a suggested next step, so 'is this too complex' stops being a guess. Defaults to the changed files; pass a path to narrow it further.",
|
|
24
|
-
promptSnippet: "quality: complexity and maintainability metrics for changed code",
|
|
25
|
-
parameters: Type.Object({
|
|
26
|
-
path: Type.Optional(Type.String({ description: "One file or directory, relative to the project root. Omit to scan the changed set." })),
|
|
27
|
-
changes: Type.Optional(Type.Boolean({ description: "Scan only files changed against the base ref. Default true when path is omitted." })),
|
|
28
|
-
base: Type.Optional(Type.String({ description: "Git ref for `changes`. Defaults to HEAD." })),
|
|
29
|
-
top: Type.Optional(Type.Number({ description: "Only report the N worst functions." })),
|
|
30
|
-
}),
|
|
31
|
-
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
32
|
-
const cwd = ctx.cwd ?? process.cwd();
|
|
33
|
-
const state = qualityEnabled(cwd);
|
|
34
|
-
if (!state.enabled) {
|
|
35
|
-
return {
|
|
36
|
-
content: [{ type: "text", text: `quality metrics are off (source: ${state.source})` }],
|
|
37
|
-
details: { off: true },
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
const config = loadQualityConfig(cwd);
|
|
41
|
-
const useChanges = params.changes ?? params.path === undefined;
|
|
42
|
-
const paths = collectTargetPaths(cwd, { changes: useChanges, base: params.base, target: params.path }, config.ignore);
|
|
43
|
-
if (paths.length === 0) {
|
|
44
|
-
return {
|
|
45
|
-
content: [{ type: "text", text: useChanges ? "no changed files to measure" : "no source files found" }],
|
|
46
|
-
details: { files: 0 },
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
const report = await analyzeFiles(paths, config);
|
|
50
|
-
const summary = summarize(report);
|
|
51
|
-
const text = formatHuman(report, config, { top: params.top });
|
|
52
|
-
const clipped = text.length > MAX_REPORT_CHARS ? `${text.slice(0, MAX_REPORT_CHARS)}\n… (truncated; run the quality script for the full report)` : text;
|
|
53
|
-
return {
|
|
54
|
-
content: [{ type: "text", text: clipped }],
|
|
55
|
-
details: {
|
|
56
|
-
files: summary.files,
|
|
57
|
-
functions: summary.functions,
|
|
58
|
-
findings: summary.findings,
|
|
59
|
-
score: reportScore(report),
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
},
|
|
63
|
-
});
|