@manishbht/helpcode 0.2.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/LICENSE +21 -0
- package/README.md +186 -0
- package/dist/bin/helpcode.d.ts +5 -0
- package/dist/bin/helpcode.js +10 -0
- package/dist/bin/helpcode.js.map +1 -0
- package/dist/src/commands/apply.d.ts +15 -0
- package/dist/src/commands/apply.js +195 -0
- package/dist/src/commands/apply.js.map +1 -0
- package/dist/src/commands/ask.d.ts +12 -0
- package/dist/src/commands/ask.js +93 -0
- package/dist/src/commands/ask.js.map +1 -0
- package/dist/src/commands/init.d.ts +13 -0
- package/dist/src/commands/init.js +91 -0
- package/dist/src/commands/init.js.map +1 -0
- package/dist/src/commands/reset.d.ts +8 -0
- package/dist/src/commands/reset.js +19 -0
- package/dist/src/commands/reset.js.map +1 -0
- package/dist/src/commands/run.d.ts +15 -0
- package/dist/src/commands/run.js +109 -0
- package/dist/src/commands/run.js.map +1 -0
- package/dist/src/commands/status.d.ts +4 -0
- package/dist/src/commands/status.js +53 -0
- package/dist/src/commands/status.js.map +1 -0
- package/dist/src/core/llmSelector.d.ts +65 -0
- package/dist/src/core/llmSelector.js +134 -0
- package/dist/src/core/llmSelector.js.map +1 -0
- package/dist/src/core/ollama.d.ts +43 -0
- package/dist/src/core/ollama.js +128 -0
- package/dist/src/core/ollama.js.map +1 -0
- package/dist/src/core/parser.d.ts +78 -0
- package/dist/src/core/parser.js +273 -0
- package/dist/src/core/parser.js.map +1 -0
- package/dist/src/core/patcher.d.ts +31 -0
- package/dist/src/core/patcher.js +128 -0
- package/dist/src/core/patcher.js.map +1 -0
- package/dist/src/core/project.d.ts +26 -0
- package/dist/src/core/project.js +199 -0
- package/dist/src/core/project.js.map +1 -0
- package/dist/src/core/prompt.d.ts +19 -0
- package/dist/src/core/prompt.js +121 -0
- package/dist/src/core/prompt.js.map +1 -0
- package/dist/src/core/selector.d.ts +46 -0
- package/dist/src/core/selector.js +193 -0
- package/dist/src/core/selector.js.map +1 -0
- package/dist/src/core/state.d.ts +11 -0
- package/dist/src/core/state.js +63 -0
- package/dist/src/core/state.js.map +1 -0
- package/dist/src/core/tools.d.ts +32 -0
- package/dist/src/core/tools.js +67 -0
- package/dist/src/core/tools.js.map +1 -0
- package/dist/src/core/triage.d.ts +37 -0
- package/dist/src/core/triage.js +69 -0
- package/dist/src/core/triage.js.map +1 -0
- package/dist/src/index.d.ts +12 -0
- package/dist/src/index.js +120 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/lib/compress.d.ts +14 -0
- package/dist/src/lib/compress.js +35 -0
- package/dist/src/lib/compress.js.map +1 -0
- package/dist/src/lib/errors.d.ts +25 -0
- package/dist/src/lib/errors.js +32 -0
- package/dist/src/lib/errors.js.map +1 -0
- package/dist/src/lib/git.d.ts +7 -0
- package/dist/src/lib/git.js +45 -0
- package/dist/src/lib/git.js.map +1 -0
- package/dist/src/lib/runclass.d.ts +24 -0
- package/dist/src/lib/runclass.js +66 -0
- package/dist/src/lib/runclass.js.map +1 -0
- package/dist/src/lib/ui.d.ts +41 -0
- package/dist/src/lib/ui.js +92 -0
- package/dist/src/lib/ui.js.map +1 -0
- package/dist/src/types.d.ts +70 -0
- package/dist/src/types.js +7 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classify why a test/command run failed, so the CLI can give the right
|
|
3
|
+
* advice. The key distinction:
|
|
4
|
+
*
|
|
5
|
+
* - 'setup' : the runner never started (not installed, not on PATH,
|
|
6
|
+
* missing module). Sending this back to Claude wastes a
|
|
7
|
+
* turn — the user needs to install something.
|
|
8
|
+
* - 'timeout' : the command ran too long and was killed.
|
|
9
|
+
* - 'test' : the runner started and tests genuinely failed. THIS is
|
|
10
|
+
* the case worth sending back to Claude.
|
|
11
|
+
*
|
|
12
|
+
* This is a pure function over the captured CommandResult, so it's easy to
|
|
13
|
+
* unit-test against real-world stderr strings.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Patterns that indicate the runner could not start — a setup problem,
|
|
17
|
+
* not a test failure. Cross-platform.
|
|
18
|
+
*/
|
|
19
|
+
const SETUP_PATTERNS = [
|
|
20
|
+
// POSIX shells: "/bin/sh: pytest: command not found" or "bash: jest: command not found"
|
|
21
|
+
{
|
|
22
|
+
re: /(?:^|\n).*?:\s*([\w.-]+):\s*command not found/i,
|
|
23
|
+
describe: m => `\`${m[1]}\` is not installed or not on your PATH`,
|
|
24
|
+
},
|
|
25
|
+
// Windows cmd: "'pytest' is not recognized as an internal or external command"
|
|
26
|
+
{
|
|
27
|
+
re: /'([\w.-]+)' is not recognized as an internal or external command/i,
|
|
28
|
+
describe: m => `\`${m[1]}\` is not installed or not on your PATH`,
|
|
29
|
+
},
|
|
30
|
+
// Python module missing: "No module named pytest"
|
|
31
|
+
{
|
|
32
|
+
re: /No module named ([\w.]+)/i,
|
|
33
|
+
describe: m => `the Python module \`${m[1]}\` is not installed`,
|
|
34
|
+
},
|
|
35
|
+
// Node module missing: "Cannot find module 'jest'"
|
|
36
|
+
{
|
|
37
|
+
re: /Cannot find module '([\w@/.-]+)'/i,
|
|
38
|
+
describe: m => `the module \`${m[1]}\` is not installed`,
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
export function classifyRunFailure(result) {
|
|
42
|
+
if (result.timedOut || result.exitCode === 124) {
|
|
43
|
+
return {
|
|
44
|
+
kind: 'timeout',
|
|
45
|
+
message: 'The command timed out and was killed.',
|
|
46
|
+
hint: 'If the command is genuinely slow, raise the timeout or run it manually.',
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const haystack = `${result.stderr}\n${result.stdout}`;
|
|
50
|
+
for (const pattern of SETUP_PATTERNS) {
|
|
51
|
+
const m = haystack.match(pattern.re);
|
|
52
|
+
if (m) {
|
|
53
|
+
return {
|
|
54
|
+
kind: 'setup',
|
|
55
|
+
message: `The test runner didn't start — ${pattern.describe(m)}.`,
|
|
56
|
+
hint: 'Install it (e.g. `pip install pytest` / `npm install`), or fix the test_command in .helpcode/project.json. This is a setup issue, not something to send back to Claude.',
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
kind: 'test',
|
|
62
|
+
message: 'Tests ran and some failed.',
|
|
63
|
+
hint: 'Run `helpcode ask "..."` to send the failure back to Claude.',
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=runclass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runclass.js","sourceRoot":"","sources":["../../../src/lib/runclass.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAcH;;;GAGG;AACH,MAAM,cAAc,GAAgE;IAClF,wFAAwF;IACxF;QACE,EAAE,EAAE,gDAAgD;QACpD,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,yCAAyC;KAClE;IACD,+EAA+E;IAC/E;QACE,EAAE,EAAE,mEAAmE;QACvE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,yCAAyC;KAClE;IACD,kDAAkD;IAClD;QACE,EAAE,EAAE,2BAA2B;QAC/B,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,qBAAqB;KAChE;IACD,mDAAmD;IACnD;QACE,EAAE,EAAE,mCAAmC;QACvC,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,qBAAqB;KACzD;CACF,CAAC;AAEF,MAAM,UAAU,kBAAkB,CAAC,MAAqB;IACtD,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,KAAK,GAAG,EAAE,CAAC;QAC/C,OAAO;YACL,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,uCAAuC;YAChD,IAAI,EAAE,yEAAyE;SAChF,CAAC;IACJ,CAAC;IAED,MAAM,QAAQ,GAAG,GAAG,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC;IACtD,KAAK,MAAM,OAAO,IAAI,cAAc,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACrC,IAAI,CAAC,EAAE,CAAC;YACN,OAAO;gBACL,IAAI,EAAE,OAAO;gBACb,OAAO,EAAE,kCAAkC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG;gBACjE,IAAI,EAAE,yKAAyK;aAChL,CAAC;QACJ,CAAC;IACH,CAAC;IAED,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,4BAA4B;QACrC,IAAI,EAAE,8DAA8D;KACrE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny terminal UI helpers. Zero dependencies.
|
|
3
|
+
*
|
|
4
|
+
* Colors degrade gracefully when stdout isn't a TTY (CI, pipes).
|
|
5
|
+
*/
|
|
6
|
+
export declare const c: {
|
|
7
|
+
bold: (s: string) => string;
|
|
8
|
+
dim: (s: string) => string;
|
|
9
|
+
red: (s: string) => string;
|
|
10
|
+
green: (s: string) => string;
|
|
11
|
+
yellow: (s: string) => string;
|
|
12
|
+
blue: (s: string) => string;
|
|
13
|
+
cyan: (s: string) => string;
|
|
14
|
+
gray: (s: string) => string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Print text inside a clearly-marked block so the user knows what to copy.
|
|
18
|
+
* Format:
|
|
19
|
+
*
|
|
20
|
+
* ───────── COPY EVERYTHING BELOW INTO CLAUDE.AI ─────────
|
|
21
|
+
* <body>
|
|
22
|
+
* ───────── END COPY BLOCK ─────────
|
|
23
|
+
*/
|
|
24
|
+
export declare function printPasteBlock(body: string): void;
|
|
25
|
+
/** Print a header for a section of output. */
|
|
26
|
+
export declare function header(title: string): void;
|
|
27
|
+
/** A simple status line. Use info/warn/ok/err. */
|
|
28
|
+
export declare const log: {
|
|
29
|
+
info: (msg: string) => void;
|
|
30
|
+
ok: (msg: string) => void;
|
|
31
|
+
warn: (msg: string) => void;
|
|
32
|
+
err: (msg: string) => void;
|
|
33
|
+
dim: (msg: string) => void;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Read all of stdin until EOF. Used for `helpcode apply` to receive
|
|
37
|
+
* Claude's pasted response.
|
|
38
|
+
*/
|
|
39
|
+
export declare function readStdin(): Promise<string>;
|
|
40
|
+
/** Simple Y/n prompt that defaults to N. */
|
|
41
|
+
export declare function confirm(question: string): Promise<boolean>;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiny terminal UI helpers. Zero dependencies.
|
|
3
|
+
*
|
|
4
|
+
* Colors degrade gracefully when stdout isn't a TTY (CI, pipes).
|
|
5
|
+
*/
|
|
6
|
+
const supportsColor = process.stdout.isTTY && process.env.NO_COLOR !== '1';
|
|
7
|
+
const codes = {
|
|
8
|
+
reset: '\x1b[0m',
|
|
9
|
+
bold: '\x1b[1m',
|
|
10
|
+
dim: '\x1b[2m',
|
|
11
|
+
red: '\x1b[31m',
|
|
12
|
+
green: '\x1b[32m',
|
|
13
|
+
yellow: '\x1b[33m',
|
|
14
|
+
blue: '\x1b[34m',
|
|
15
|
+
cyan: '\x1b[36m',
|
|
16
|
+
gray: '\x1b[90m',
|
|
17
|
+
};
|
|
18
|
+
function color(c, s) {
|
|
19
|
+
return supportsColor ? codes[c] + s + codes.reset : s;
|
|
20
|
+
}
|
|
21
|
+
export const c = {
|
|
22
|
+
bold: (s) => color('bold', s),
|
|
23
|
+
dim: (s) => color('dim', s),
|
|
24
|
+
red: (s) => color('red', s),
|
|
25
|
+
green: (s) => color('green', s),
|
|
26
|
+
yellow: (s) => color('yellow', s),
|
|
27
|
+
blue: (s) => color('blue', s),
|
|
28
|
+
cyan: (s) => color('cyan', s),
|
|
29
|
+
gray: (s) => color('gray', s),
|
|
30
|
+
};
|
|
31
|
+
const DIVIDER = '─'.repeat(60);
|
|
32
|
+
/**
|
|
33
|
+
* Print text inside a clearly-marked block so the user knows what to copy.
|
|
34
|
+
* Format:
|
|
35
|
+
*
|
|
36
|
+
* ───────── COPY EVERYTHING BELOW INTO CLAUDE.AI ─────────
|
|
37
|
+
* <body>
|
|
38
|
+
* ───────── END COPY BLOCK ─────────
|
|
39
|
+
*/
|
|
40
|
+
export function printPasteBlock(body) {
|
|
41
|
+
console.log();
|
|
42
|
+
console.log(c.cyan(DIVIDER));
|
|
43
|
+
console.log(c.cyan(' COPY EVERYTHING BELOW INTO CLAUDE.AI'));
|
|
44
|
+
console.log(c.cyan(DIVIDER));
|
|
45
|
+
console.log();
|
|
46
|
+
console.log(body);
|
|
47
|
+
console.log();
|
|
48
|
+
console.log(c.cyan(DIVIDER));
|
|
49
|
+
console.log(c.cyan(' END COPY BLOCK'));
|
|
50
|
+
console.log(c.cyan(DIVIDER));
|
|
51
|
+
}
|
|
52
|
+
/** Print a header for a section of output. */
|
|
53
|
+
export function header(title) {
|
|
54
|
+
console.log();
|
|
55
|
+
console.log(c.bold(title));
|
|
56
|
+
console.log(c.dim('─'.repeat(title.length)));
|
|
57
|
+
}
|
|
58
|
+
/** A simple status line. Use info/warn/ok/err. */
|
|
59
|
+
export const log = {
|
|
60
|
+
info: (msg) => console.log(`${c.blue('•')} ${msg}`),
|
|
61
|
+
ok: (msg) => console.log(`${c.green('✓')} ${msg}`),
|
|
62
|
+
warn: (msg) => console.log(`${c.yellow('!')} ${msg}`),
|
|
63
|
+
err: (msg) => console.error(`${c.red('✗')} ${msg}`),
|
|
64
|
+
dim: (msg) => console.log(c.dim(msg)),
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Read all of stdin until EOF. Used for `helpcode apply` to receive
|
|
68
|
+
* Claude's pasted response.
|
|
69
|
+
*/
|
|
70
|
+
export async function readStdin() {
|
|
71
|
+
if (process.stdin.isTTY) {
|
|
72
|
+
log.dim('Paste Claude\'s reply, then press Ctrl-D (Linux/Mac) or Ctrl-Z+Enter (Windows):');
|
|
73
|
+
}
|
|
74
|
+
const chunks = [];
|
|
75
|
+
for await (const chunk of process.stdin) {
|
|
76
|
+
chunks.push(chunk);
|
|
77
|
+
}
|
|
78
|
+
return Buffer.concat(chunks).toString('utf-8');
|
|
79
|
+
}
|
|
80
|
+
/** Simple Y/n prompt that defaults to N. */
|
|
81
|
+
export async function confirm(question) {
|
|
82
|
+
process.stdout.write(`${question} ${c.dim('[y/N]')} `);
|
|
83
|
+
return new Promise(resolve => {
|
|
84
|
+
process.stdin.resume();
|
|
85
|
+
process.stdin.setEncoding('utf-8');
|
|
86
|
+
process.stdin.once('data', (data) => {
|
|
87
|
+
process.stdin.pause();
|
|
88
|
+
resolve(data.trim().toLowerCase().startsWith('y'));
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/lib/ui.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,GAAG,CAAC;AAE3E,MAAM,KAAK,GAAG;IACZ,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,UAAU;IACf,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;CACjB,CAAC;AAEF,SAAS,KAAK,CAAC,CAAqB,EAAE,CAAS;IAC7C,OAAO,aAAa,CAAC,CAAC,CAAC,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0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types used across the helpcode CLI.
|
|
3
|
+
*
|
|
4
|
+
* Kept in one file so contributors can read the data model in one place.
|
|
5
|
+
*/
|
|
6
|
+
/** What kind of project the user is in. Detected by `init`, stored on disk. */
|
|
7
|
+
export interface ProjectConfig {
|
|
8
|
+
/** Absolute path to the project root. */
|
|
9
|
+
root: string;
|
|
10
|
+
/** Primary language detected. */
|
|
11
|
+
language: 'python' | 'javascript' | 'typescript' | 'unknown';
|
|
12
|
+
/** Framework, if obvious. */
|
|
13
|
+
framework: string | null;
|
|
14
|
+
/** Command (as a single string) the user's test runner expects. */
|
|
15
|
+
testCommand: string | null;
|
|
16
|
+
/** Source dirs to consider when selecting context. */
|
|
17
|
+
sourceDirs: string[];
|
|
18
|
+
/** When this config was written. */
|
|
19
|
+
createdAt: string;
|
|
20
|
+
/** Optional local-LLM (Ollama) settings for smarter file selection (v0.2). */
|
|
21
|
+
ollama?: OllamaSettings;
|
|
22
|
+
}
|
|
23
|
+
/** Local-LLM configuration. Opt-in; absent or disabled = heuristic only. */
|
|
24
|
+
export interface OllamaSettings {
|
|
25
|
+
/** When true, file selection uses the local model (with heuristic fallback). */
|
|
26
|
+
enabled: boolean;
|
|
27
|
+
/** Model tag, e.g. "qwen2.5-coder:7b". User-editable. */
|
|
28
|
+
model: string;
|
|
29
|
+
/** Ollama server URL. */
|
|
30
|
+
host: string;
|
|
31
|
+
/** Generation timeout in milliseconds. */
|
|
32
|
+
timeoutMs: number;
|
|
33
|
+
}
|
|
34
|
+
/** Status of the current iteration with Claude. */
|
|
35
|
+
export type TaskStatus = 'idle' | 'awaiting_paste' | 'applying' | 'testing' | 'resolved' | 'failed';
|
|
36
|
+
/** The agent's memory across CLI invocations. Stored at .helpcode/state.json. */
|
|
37
|
+
export interface AgentState {
|
|
38
|
+
/** Schema version so we can migrate later without breaking installs. */
|
|
39
|
+
version: 1;
|
|
40
|
+
currentTask: CurrentTask | null;
|
|
41
|
+
/** History of resolved tasks (summary only, not full content). */
|
|
42
|
+
history: TaskHistoryEntry[];
|
|
43
|
+
}
|
|
44
|
+
export interface CurrentTask {
|
|
45
|
+
id: string;
|
|
46
|
+
description: string;
|
|
47
|
+
createdAt: string;
|
|
48
|
+
iterations: number;
|
|
49
|
+
status: TaskStatus;
|
|
50
|
+
/** Last prompt generated for Claude. */
|
|
51
|
+
lastPrompt: string | null;
|
|
52
|
+
/** Raw last response from Claude (as pasted by the user). */
|
|
53
|
+
lastResponseRaw: string | null;
|
|
54
|
+
/** Last captured test output, compacted. */
|
|
55
|
+
lastTestOutput: string | null;
|
|
56
|
+
/** Files touched by the most recent apply. */
|
|
57
|
+
lastDiffsApplied: AppliedDiff[];
|
|
58
|
+
}
|
|
59
|
+
export interface AppliedDiff {
|
|
60
|
+
filepath: string;
|
|
61
|
+
hunks: number;
|
|
62
|
+
ok: boolean;
|
|
63
|
+
created: boolean;
|
|
64
|
+
}
|
|
65
|
+
export interface TaskHistoryEntry {
|
|
66
|
+
id: string;
|
|
67
|
+
description: string;
|
|
68
|
+
resolvedAt: string;
|
|
69
|
+
iterations: number;
|
|
70
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@manishbht/helpcode",
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"description": "A local agent that makes Claude.ai conversations efficient enough to ship real projects on a Pro subscription.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/src/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"helpcode": "dist/bin/helpcode.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist/src/",
|
|
12
|
+
"dist/bin/",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"test": "npm run build && node --test dist/tests/unit/*.test.js dist/tests/integration/*.test.js",
|
|
19
|
+
"test:unit": "npm run build && node --test dist/tests/unit/*.test.js",
|
|
20
|
+
"test:integration": "npm run build && node --test dist/tests/integration/*.test.js",
|
|
21
|
+
"lint": "tsc --noEmit",
|
|
22
|
+
"typecheck": "tsc --noEmit",
|
|
23
|
+
"prepublishOnly": "npm run build"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"claude",
|
|
27
|
+
"ai",
|
|
28
|
+
"cli",
|
|
29
|
+
"code-assistant",
|
|
30
|
+
"anthropic",
|
|
31
|
+
"claude-code",
|
|
32
|
+
"developer-tools",
|
|
33
|
+
"frugal-ai"
|
|
34
|
+
],
|
|
35
|
+
"author": "merolaagi",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/merolaagi/helpcode.git",
|
|
40
|
+
"directory": "packages/cli"
|
|
41
|
+
},
|
|
42
|
+
"bugs": {
|
|
43
|
+
"url": "https://github.com/merolaagi/helpcode/issues"
|
|
44
|
+
},
|
|
45
|
+
"homepage": "https://github.com/merolaagi/helpcode#readme",
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=20"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"@types/node": "^20.11.0",
|
|
51
|
+
"typescript": "^5.4.0"
|
|
52
|
+
}
|
|
53
|
+
}
|