autodev-cli 1.4.0 → 1.4.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/bin/autodev.js +0 -0
- package/out/agentBackup/archive.d.ts +44 -0
- package/out/agentBackup/archive.js +131 -0
- package/out/agentBackup/archive.js.map +1 -0
- package/out/agentBackup/export.d.ts +18 -0
- package/out/agentBackup/export.js +92 -0
- package/out/agentBackup/export.js.map +1 -0
- package/out/agentBackup/import.d.ts +21 -0
- package/out/agentBackup/import.js +40 -0
- package/out/agentBackup/import.js.map +1 -0
- package/out/agentBackup/index.d.ts +6 -0
- package/out/agentBackup/index.js +11 -0
- package/out/agentBackup/index.js.map +1 -0
- package/out/agentBackup/layout.d.ts +30 -0
- package/out/agentBackup/layout.js +126 -0
- package/out/agentBackup/layout.js.map +1 -0
- package/out/agentBackup/manifest.d.ts +24 -0
- package/out/agentBackup/manifest.js +70 -0
- package/out/agentBackup/manifest.js.map +1 -0
- package/out/agentBackup/opencodeDb.d.ts +20 -0
- package/out/agentBackup/opencodeDb.js +213 -0
- package/out/agentBackup/opencodeDb.js.map +1 -0
- package/out/agentBackup/sessionProviders.d.ts +35 -0
- package/out/agentBackup/sessionProviders.js +263 -0
- package/out/agentBackup/sessionProviders.js.map +1 -0
- package/out/agentBackup/upload.d.ts +9 -0
- package/out/agentBackup/upload.js +121 -0
- package/out/agentBackup/upload.js.map +1 -0
- package/out/cli.d.ts +1 -0
- package/out/cli.js +8 -0
- package/out/cli.js.map +1 -1
- package/out/cliExit.d.ts +34 -0
- package/out/cliExit.js +159 -0
- package/out/cliExit.js.map +1 -0
- package/out/commands/config.d.ts +2 -0
- package/out/commands/config.js +7 -7
- package/out/commands/config.js.map +1 -1
- package/out/commands/connect.d.ts +2 -0
- package/out/commands/connect.js +11 -0
- package/out/commands/connect.js.map +1 -1
- package/out/commands/export.d.ts +2 -0
- package/out/commands/export.js +79 -0
- package/out/commands/export.js.map +1 -0
- package/out/commands/import.d.ts +2 -0
- package/out/commands/import.js +92 -0
- package/out/commands/import.js.map +1 -0
- package/out/commands/init.d.ts +16 -0
- package/out/commands/init.js +9 -5
- package/out/commands/init.js.map +1 -1
- package/out/commands/resume.d.ts +2 -0
- package/out/commands/resume.js +65 -0
- package/out/commands/resume.js.map +1 -0
- package/out/commands/sessions.d.ts +2 -0
- package/out/commands/sessions.js +64 -0
- package/out/commands/sessions.js.map +1 -0
- package/out/commands/start.d.ts +2 -0
- package/out/commands/start.js +40 -7
- package/out/commands/start.js.map +1 -1
- package/out/commands/status.d.ts +2 -0
- package/out/commands/status.js +3 -3
- package/out/commands/status.js.map +1 -1
- package/out/commands/tailOutput.d.ts +12 -0
- package/out/commands/up.d.ts +3 -0
- package/out/configManager.d.ts +42 -0
- package/out/configManager.js +430 -0
- package/out/configManager.js.map +1 -0
- package/out/connect.d.ts +4 -0
- package/out/connect.js +7 -7
- package/out/connect.js.map +1 -1
- package/out/core/adapters.d.ts +34 -0
- package/out/core/adapters.js +84 -0
- package/out/core/adapters.js.map +1 -0
- package/out/core/commandHelpers.d.ts +12 -0
- package/out/core/commandHelpers.js +96 -0
- package/out/core/commandHelpers.js.map +1 -0
- package/out/core/projectMcp.d.ts +25 -0
- package/out/core/projectMcp.js +144 -0
- package/out/core/projectMcp.js.map +1 -0
- package/out/core/provider/BaseProvider.d.ts +14 -0
- package/out/core/provider/BaseProvider.js +25 -0
- package/out/core/provider/BaseProvider.js.map +1 -0
- package/out/core/provider/ProviderRegistry.d.ts +12 -0
- package/out/core/provider/ProviderRegistry.js +40 -0
- package/out/core/provider/ProviderRegistry.js.map +1 -0
- package/out/core/provider/contract.d.ts +62 -0
- package/out/core/provider/contract.js +9 -0
- package/out/core/provider/contract.js.map +1 -0
- package/out/core/provider/implementations.d.ts +54 -0
- package/out/core/provider/implementations.js +147 -0
- package/out/core/provider/implementations.js.map +1 -0
- package/out/core/settingsLoader.d.ts +221 -0
- package/out/core/settingsLoader.js +176 -0
- package/out/core/settingsLoader.js.map +1 -0
- package/out/discordGateway.d.ts +26 -0
- package/out/discordGateway.js +230 -0
- package/out/discordGateway.js.map +1 -0
- package/out/discordPoller.d.ts +28 -0
- package/out/discordPoller.js +247 -0
- package/out/discordPoller.js.map +1 -0
- package/out/dispatcher.d.ts +12 -0
- package/out/dispatcher.js +214 -0
- package/out/dispatcher.js.map +1 -0
- package/out/emailPoller.d.ts +42 -0
- package/out/emailPoller.js +221 -0
- package/out/emailPoller.js.map +1 -0
- package/out/git/gitService.d.ts +36 -0
- package/out/git/gitService.js +165 -0
- package/out/git/gitService.js.map +1 -0
- package/out/hookEventNormalizer.d.ts +39 -0
- package/out/hookEventNormalizer.js +397 -0
- package/out/hookEventNormalizer.js.map +1 -0
- package/out/hooksManager.d.ts +25 -0
- package/out/hooksManager.js +471 -0
- package/out/hooksManager.js.map +1 -0
- package/out/launchIde.d.ts +14 -0
- package/out/logger.d.ts +12 -0
- package/out/mcpEmailTest.d.ts +29 -0
- package/out/mcpEmailTest.js +245 -0
- package/out/mcpEmailTest.js.map +1 -0
- package/out/mcpInstallCheck.d.ts +23 -0
- package/out/mcpInstallCheck.js +219 -0
- package/out/mcpInstallCheck.js.map +1 -0
- package/out/mcpManager.d.ts +35 -0
- package/out/mcpManager.js +371 -0
- package/out/mcpManager.js.map +1 -0
- package/out/messageBuilder.d.ts +54 -0
- package/out/messageBuilder.js +373 -0
- package/out/messageBuilder.js.map +1 -0
- package/out/openCodeHooksManager.d.ts +23 -0
- package/out/openCodeHooksManager.js +511 -0
- package/out/openCodeHooksManager.js.map +1 -0
- package/out/periodicActions.d.ts +63 -0
- package/out/periodicActions.js +237 -0
- package/out/periodicActions.js.map +1 -0
- package/out/profileBuilder.d.ts +29 -0
- package/out/profileBuilder.js +366 -0
- package/out/profileBuilder.js.map +1 -0
- package/out/prompt.d.ts +12 -0
- package/out/prompt.js +18 -0
- package/out/prompt.js.map +1 -0
- package/out/protocolSections.d.ts +26 -0
- package/out/protocolSections.js +209 -0
- package/out/protocolSections.js.map +1 -0
- package/out/providers/claudeCliProvider.d.ts +71 -0
- package/out/providers/claudeCliProvider.js +425 -0
- package/out/providers/claudeCliProvider.js.map +1 -0
- package/out/providers/claudeTuiProvider.d.ts +23 -0
- package/out/providers/claudeTuiProvider.js +296 -0
- package/out/providers/claudeTuiProvider.js.map +1 -0
- package/out/providers/copilotCliProvider.d.ts +16 -0
- package/out/providers/copilotCliProvider.js +44 -0
- package/out/providers/copilotCliProvider.js.map +1 -0
- package/out/providers/copilotSdkProvider.d.ts +12 -0
- package/out/providers/copilotSdkProvider.js +445 -0
- package/out/providers/copilotSdkProvider.js.map +1 -0
- package/out/providers/grokTuiProvider.d.ts +14 -0
- package/out/providers/grokTuiProvider.js +271 -0
- package/out/providers/grokTuiProvider.js.map +1 -0
- package/out/providers/opencodeCliProvider.d.ts +29 -0
- package/out/providers/opencodeCliProvider.js +199 -0
- package/out/providers/opencodeCliProvider.js.map +1 -0
- package/out/providers/opencodeSdkProvider.d.ts +22 -0
- package/out/providers/opencodeSdkProvider.js +557 -0
- package/out/providers/opencodeSdkProvider.js.map +1 -0
- package/out/providers.d.ts +9 -0
- package/out/providers.js +44 -0
- package/out/providers.js.map +1 -0
- package/out/rateLimit.d.ts +18 -0
- package/out/rateLimit.js +90 -0
- package/out/rateLimit.js.map +1 -0
- package/out/rdp/auth.d.ts +55 -0
- package/out/rdp/auth.js +197 -0
- package/out/rdp/auth.js.map +1 -0
- package/out/rdp/bridge.d.ts +86 -0
- package/out/rdp/bridge.js +1398 -0
- package/out/rdp/bridge.js.map +1 -0
- package/out/rdp/constants.d.ts +86 -0
- package/out/rdp/constants.js +182 -0
- package/out/rdp/constants.js.map +1 -0
- package/out/rdp/index.d.ts +7 -0
- package/out/rdp/index.js +14 -0
- package/out/rdp/index.js.map +1 -0
- package/out/rdp/session.d.ts +30 -0
- package/out/rdp/session.js +196 -0
- package/out/rdp/session.js.map +1 -0
- package/out/rdp/types.d.ts +27 -0
- package/out/rdp/types.js +6 -0
- package/out/rdp/types.js.map +1 -0
- package/out/sdk/index.d.ts +22 -0
- package/out/sdk/index.js +81 -0
- package/out/sdk/index.js.map +1 -0
- package/out/sessionState.d.ts +54 -0
- package/out/sessionState.js +284 -0
- package/out/sessionState.js.map +1 -0
- package/out/sessions.d.ts +11 -0
- package/out/sessions.js +32 -0
- package/out/sessions.js.map +1 -0
- package/out/taskLoop.d.ts +152 -0
- package/out/taskLoop.js +2505 -0
- package/out/taskLoop.js.map +1 -0
- package/out/todo.d.ts +42 -0
- package/out/todo.js +311 -0
- package/out/todo.js.map +1 -0
- package/out/todoWriteManager.d.ts +26 -0
- package/out/todoWriteManager.js +44 -0
- package/out/todoWriteManager.js.map +1 -0
- package/out/vnc/auth.d.ts +52 -0
- package/out/vnc/auth.js +181 -0
- package/out/vnc/auth.js.map +1 -0
- package/out/vnc/bridge.d.ts +40 -0
- package/out/vnc/bridge.js +540 -0
- package/out/vnc/bridge.js.map +1 -0
- package/out/vnc/constants.d.ts +8 -0
- package/out/vnc/constants.js +34 -0
- package/out/vnc/constants.js.map +1 -0
- package/out/vnc/des.d.ts +6 -0
- package/out/vnc/des.js +93 -0
- package/out/vnc/des.js.map +1 -0
- package/out/vnc/index.d.ts +7 -0
- package/out/vnc/index.js +13 -0
- package/out/vnc/index.js.map +1 -0
- package/out/vnc/session.d.ts +18 -0
- package/out/vnc/session.js +193 -0
- package/out/vnc/session.js.map +1 -0
- package/out/vnc/types.d.ts +16 -0
- package/out/vnc/types.js +6 -0
- package/out/vnc/types.js.map +1 -0
- package/out/webSocketPoller.d.ts +95 -0
- package/out/webSocketPoller.js +986 -0
- package/out/webSocketPoller.js.map +1 -0
- package/out/webhook.d.ts +37 -0
- package/out/webhook.js +265 -0
- package/out/webhook.js.map +1 -0
- package/out/webhookPoller.d.ts +40 -0
- package/out/webhookPoller.js +378 -0
- package/out/webhookPoller.js.map +1 -0
- package/package.json +54 -41
package/out/prompt.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Task } from './todo';
|
|
2
|
+
/**
|
|
3
|
+
* Build the prompt string for a task, and write the split files:
|
|
4
|
+
* .autodev/AGENT_PROFILE.md — profile instructions (rebuilt fresh)
|
|
5
|
+
* .autodev/messages/MESSAGE_<timestamp>.md — task trigger message
|
|
6
|
+
*
|
|
7
|
+
* The agent profile is loaded automatically by the agent via AGENTS.md → @.autodev/AGENT_PROFILE.md.
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildPrompt(task: Task, root: string, todoDir: string, includeProfile?: boolean): {
|
|
10
|
+
prompt: string;
|
|
11
|
+
messageFile: string;
|
|
12
|
+
};
|
package/out/prompt.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildPrompt = buildPrompt;
|
|
4
|
+
const messageBuilder_1 = require("./messageBuilder");
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
// PromptBuilder — delegates to messageBuilder which writes split files
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
/**
|
|
9
|
+
* Build the prompt string for a task, and write the split files:
|
|
10
|
+
* .autodev/AGENT_PROFILE.md — profile instructions (rebuilt fresh)
|
|
11
|
+
* .autodev/messages/MESSAGE_<timestamp>.md — task trigger message
|
|
12
|
+
*
|
|
13
|
+
* The agent profile is loaded automatically by the agent via AGENTS.md → @.autodev/AGENT_PROFILE.md.
|
|
14
|
+
*/
|
|
15
|
+
function buildPrompt(task, root, todoDir, includeProfile = true) {
|
|
16
|
+
return (0, messageBuilder_1.buildMessage)(task, root, todoDir, includeProfile);
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":";;AAcA,kCAOC;AApBD,qDAAgD;AAEhD,8EAA8E;AAC9E,uEAAuE;AACvE,8EAA8E;AAE9E;;;;;;GAMG;AACH,SAAgB,WAAW,CACzB,IAAU,EACV,IAAY,EACZ,OAAe,EACf,cAAc,GAAG,IAAI;IAErB,OAAO,IAAA,6BAAY,EAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
interface SettingsLike {
|
|
2
|
+
mcpServers?: Record<string, {
|
|
3
|
+
enabled?: boolean;
|
|
4
|
+
} | undefined>;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Strip any existing protocol markers from `body`, then append fresh blocks
|
|
8
|
+
* from `media/mcp/<name>.md` for each MCP currently enabled in `settings`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function applyProtocolSections(body: string, settings: SettingsLike | undefined): string;
|
|
11
|
+
/**
|
|
12
|
+
* Copy ALL skills from media/skills/ to root/.claude/skills/.
|
|
13
|
+
* This ensures all general skills (not just MCP-related ones) are available to Claude.
|
|
14
|
+
* Does nothing if root is falsy.
|
|
15
|
+
*/
|
|
16
|
+
export declare function applyAllSkills(root: string): void;
|
|
17
|
+
/**
|
|
18
|
+
* For every MCP that has a corresponding `media/skills/<name>/SKILL.md`:
|
|
19
|
+
* - If the MCP is enabled, copy the skill file to `<root>/.claude/skills/<name>/SKILL.md`.
|
|
20
|
+
* - If the MCP is disabled (or absent), delete `<root>/.claude/skills/<name>/SKILL.md`
|
|
21
|
+
* if it was previously deployed by autodev.
|
|
22
|
+
*
|
|
23
|
+
* Does nothing if `root` is falsy.
|
|
24
|
+
*/
|
|
25
|
+
export declare function applyMcpSkills(root: string, settings: SettingsLike | undefined): void;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.applyProtocolSections = applyProtocolSections;
|
|
37
|
+
exports.applyAllSkills = applyAllSkills;
|
|
38
|
+
exports.applyMcpSkills = applyMcpSkills;
|
|
39
|
+
const fs = __importStar(require("fs"));
|
|
40
|
+
const path = __importStar(require("path"));
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
// Protocol sections — for each MCP server enabled in settings, look up
|
|
43
|
+
// `media/mcp/<server-name>.md` and inject its contents into the agent profile,
|
|
44
|
+
// wrapped in BEGIN/END markers. Toggling an MCP off cleanly removes its block
|
|
45
|
+
// on the next regeneration.
|
|
46
|
+
//
|
|
47
|
+
// Additionally, if `media/skills/<server-name>/SKILL.md` exists for an
|
|
48
|
+
// enabled MCP, it is deployed to `.claude/skills/<server-name>/SKILL.md` in
|
|
49
|
+
// the workspace so Claude Code loads it automatically. Skills for disabled
|
|
50
|
+
// MCPs are removed.
|
|
51
|
+
//
|
|
52
|
+
// To add a new protocol: drop a markdown file in `media/mcp/` named exactly
|
|
53
|
+
// after the MCP server (e.g. `media/mcp/zerolib-email.md`). No code changes
|
|
54
|
+
// required. Optionally add `media/skills/<name>/SKILL.md` for Claude skills.
|
|
55
|
+
// ---------------------------------------------------------------------------
|
|
56
|
+
const BEGIN_MARKER = '<!-- AUTODEV:mcp-protocol:';
|
|
57
|
+
const END_MARKER = ':end -->';
|
|
58
|
+
function _isEnabled(s, name) {
|
|
59
|
+
const entry = s?.mcpServers?.[name];
|
|
60
|
+
if (!entry)
|
|
61
|
+
return false;
|
|
62
|
+
return entry.enabled !== false;
|
|
63
|
+
}
|
|
64
|
+
function _mcpDir() {
|
|
65
|
+
return path.join(__dirname, '..', 'media', 'mcp');
|
|
66
|
+
}
|
|
67
|
+
function _skillsMediaDir() {
|
|
68
|
+
return path.join(__dirname, '..', 'media', 'skills');
|
|
69
|
+
}
|
|
70
|
+
/** Strip every existing `<!-- AUTODEV:mcp-protocol:*:begin -->...end -->` block. */
|
|
71
|
+
function _stripAllProtocolBlocks(body) {
|
|
72
|
+
// Greedy-safe non-greedy match across newlines
|
|
73
|
+
const re = /\n*<!-- AUTODEV:mcp-protocol:[^:]+:begin -->[\s\S]*?<!-- AUTODEV:mcp-protocol:[^:]+:end -->\n*/g;
|
|
74
|
+
return body.replace(re, '\n').replace(/\n{3,}/g, '\n\n');
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Strip any existing protocol markers from `body`, then append fresh blocks
|
|
78
|
+
* from `media/mcp/<name>.md` for each MCP currently enabled in `settings`.
|
|
79
|
+
*/
|
|
80
|
+
function applyProtocolSections(body, settings) {
|
|
81
|
+
let out = _stripAllProtocolBlocks(body).trimEnd();
|
|
82
|
+
const dir = _mcpDir();
|
|
83
|
+
if (!fs.existsSync(dir))
|
|
84
|
+
return out + '\n';
|
|
85
|
+
const enabledNames = Object.keys(settings?.mcpServers ?? {})
|
|
86
|
+
.filter(name => _isEnabled(settings, name))
|
|
87
|
+
.sort();
|
|
88
|
+
const additions = [];
|
|
89
|
+
for (const name of enabledNames) {
|
|
90
|
+
const file = path.join(dir, `${name}.md`);
|
|
91
|
+
if (!fs.existsSync(file))
|
|
92
|
+
continue;
|
|
93
|
+
let content;
|
|
94
|
+
try {
|
|
95
|
+
content = fs.readFileSync(file, 'utf8').trim();
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (!content)
|
|
101
|
+
continue;
|
|
102
|
+
additions.push(`${BEGIN_MARKER}${name}:begin -->\n\n${content}\n\n${BEGIN_MARKER}${name}${END_MARKER}`);
|
|
103
|
+
}
|
|
104
|
+
if (additions.length === 0)
|
|
105
|
+
return out + '\n';
|
|
106
|
+
return out + '\n\n' + additions.join('\n\n') + '\n';
|
|
107
|
+
}
|
|
108
|
+
// ---------------------------------------------------------------------------
|
|
109
|
+
// Skill deployment — copy media/skills/<name>/SKILL.md to
|
|
110
|
+
// <root>/.claude/skills/<name>/SKILL.md when the MCP is enabled, and remove
|
|
111
|
+
// it when the MCP is disabled or no longer present.
|
|
112
|
+
// ---------------------------------------------------------------------------
|
|
113
|
+
/**
|
|
114
|
+
* Copy ALL skills from media/skills/ to root/.claude/skills/.
|
|
115
|
+
* This ensures all general skills (not just MCP-related ones) are available to Claude.
|
|
116
|
+
* Does nothing if root is falsy.
|
|
117
|
+
*/
|
|
118
|
+
function applyAllSkills(root) {
|
|
119
|
+
if (!root) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const skillsMedia = _skillsMediaDir();
|
|
123
|
+
if (!fs.existsSync(skillsMedia)) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const skillNames = fs.readdirSync(skillsMedia).filter(n => {
|
|
127
|
+
try {
|
|
128
|
+
return fs.statSync(path.join(skillsMedia, n)).isDirectory();
|
|
129
|
+
}
|
|
130
|
+
catch {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
for (const name of skillNames) {
|
|
135
|
+
const srcSkill = path.join(skillsMedia, name, 'SKILL.md');
|
|
136
|
+
if (!fs.existsSync(srcSkill)) {
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
const destDir = path.join(root, '.claude', 'skills', name);
|
|
140
|
+
const destSkill = path.join(destDir, 'SKILL.md');
|
|
141
|
+
// Always deploy the skill file
|
|
142
|
+
if (!fs.existsSync(destDir)) {
|
|
143
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
144
|
+
}
|
|
145
|
+
try {
|
|
146
|
+
const src = fs.readFileSync(srcSkill, 'utf8');
|
|
147
|
+
fs.writeFileSync(destSkill, src, 'utf8');
|
|
148
|
+
}
|
|
149
|
+
catch { /* ignore write errors */ }
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* For every MCP that has a corresponding `media/skills/<name>/SKILL.md`:
|
|
154
|
+
* - If the MCP is enabled, copy the skill file to `<root>/.claude/skills/<name>/SKILL.md`.
|
|
155
|
+
* - If the MCP is disabled (or absent), delete `<root>/.claude/skills/<name>/SKILL.md`
|
|
156
|
+
* if it was previously deployed by autodev.
|
|
157
|
+
*
|
|
158
|
+
* Does nothing if `root` is falsy.
|
|
159
|
+
*/
|
|
160
|
+
function applyMcpSkills(root, settings) {
|
|
161
|
+
if (!root) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const skillsMedia = _skillsMediaDir();
|
|
165
|
+
if (!fs.existsSync(skillsMedia)) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const mcpNames = fs.readdirSync(skillsMedia).filter(n => {
|
|
169
|
+
try {
|
|
170
|
+
return fs.statSync(path.join(skillsMedia, n)).isDirectory();
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
for (const name of mcpNames) {
|
|
177
|
+
const srcSkill = path.join(skillsMedia, name, 'SKILL.md');
|
|
178
|
+
if (!fs.existsSync(srcSkill)) {
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
const destDir = path.join(root, '.claude', 'skills', name);
|
|
182
|
+
const destSkill = path.join(destDir, 'SKILL.md');
|
|
183
|
+
if (_isEnabled(settings, name)) {
|
|
184
|
+
// Deploy the skill file
|
|
185
|
+
if (!fs.existsSync(destDir)) {
|
|
186
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
187
|
+
}
|
|
188
|
+
try {
|
|
189
|
+
const src = fs.readFileSync(srcSkill, 'utf8');
|
|
190
|
+
fs.writeFileSync(destSkill, src, 'utf8');
|
|
191
|
+
}
|
|
192
|
+
catch { /* ignore write errors */ }
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
// Remove the previously deployed skill file
|
|
196
|
+
try {
|
|
197
|
+
if (fs.existsSync(destSkill)) {
|
|
198
|
+
fs.unlinkSync(destSkill);
|
|
199
|
+
}
|
|
200
|
+
// Remove the skill directory if it is now empty
|
|
201
|
+
if (fs.existsSync(destDir) && fs.readdirSync(destDir).length === 0) {
|
|
202
|
+
fs.rmdirSync(destDir);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
catch { /* ignore */ }
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=protocolSections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"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,CAAC,EAAE,CAAC;YAC/B,wBAAwB;YACxB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC5B,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC7C,CAAC;YACD,IAAI,CAAC;gBACH,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;gBAC9C,EAAE,CAAC,aAAa,CAAC,SAAS,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;YAC3C,CAAC;YAAC,MAAM,CAAC,CAAC,yBAAyB,CAAC,CAAC;QACvC,CAAC;aAAM,CAAC;YACN,4CAA4C;YAC5C,IAAI,CAAC;gBACH,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;oBAAC,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;gBAAC,CAAC;gBAC3D,gDAAgD;gBAChD,IAAI,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;oBACnE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;gBACxB,CAAC;YACH,CAAC;YAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encode a workspace path the way Claude Code names its `~/.claude/projects/`
|
|
3
|
+
* folders: every `:`, `\`, `/` becomes `-`, and runs of dashes are collapsed.
|
|
4
|
+
* Note: Claude **keeps the leading dash** that comes from a leading slash on
|
|
5
|
+
* POSIX paths (e.g. `/home/x/foo` → `-home-x-foo`), so we don't strip `^-`.
|
|
6
|
+
* Trailing dashes are dropped.
|
|
7
|
+
*/
|
|
8
|
+
export declare function claudeProjectFolder(workspacePath: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Compute the `~/.claude/projects/<encoded>` directory for a workspace,
|
|
11
|
+
* regardless of whether it already exists. Used when restoring an agent
|
|
12
|
+
* backup into a new folder: the destination's session traces must land in
|
|
13
|
+
* the project dir that Claude will look up for that folder.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getClaudeProjectDir(workspacePath: string): string;
|
|
16
|
+
export declare function listClaudeSessionFiles(workspacePath: string): Array<{
|
|
17
|
+
name: string;
|
|
18
|
+
mtime: number;
|
|
19
|
+
full: string;
|
|
20
|
+
}>;
|
|
21
|
+
export declare function listClaudeSessions(workspacePath: string): Array<{
|
|
22
|
+
id: string;
|
|
23
|
+
mtime: number;
|
|
24
|
+
}>;
|
|
25
|
+
export declare function findLatestClaudeSession(workspacePath: string): string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Set the display NAME shown for a Claude session in the `claude --resume`
|
|
28
|
+
* picker. This Claude version has no dedicated title field — the picker label is
|
|
29
|
+
* the `display` value in ~/.claude/history.jsonl keyed by sessionId. We APPEND a
|
|
30
|
+
* fresh entry (never rewrite existing lines, so history can't be corrupted); the
|
|
31
|
+
* picker surfaces the latest display for the session.
|
|
32
|
+
*/
|
|
33
|
+
/** Read the display NAME shown for a claude session in the --resume picker
|
|
34
|
+
* (latest `display` for this sessionId in ~/.claude/history.jsonl). */
|
|
35
|
+
export declare function getClaudeSessionDisplay(sessionId: string): string | undefined;
|
|
36
|
+
export declare function setClaudeSessionName(sessionId: string, name: string, cwd: string): void;
|
|
37
|
+
export declare function getClaudeSessionCursor(workspacePath: string): number;
|
|
38
|
+
export interface ClaudeSessionState {
|
|
39
|
+
/** True if a definitive turn-end was detected. */
|
|
40
|
+
hasEndTurn: boolean;
|
|
41
|
+
/** Human-readable label for the tool currently running, if any. */
|
|
42
|
+
activeToolStatus?: string;
|
|
43
|
+
/** True if a bash_progress or mcp_progress record was seen. */
|
|
44
|
+
hasProgress: boolean;
|
|
45
|
+
/** Set when a rate_limit error is found — contains the raw message text. */
|
|
46
|
+
rateLimitMessage?: string;
|
|
47
|
+
}
|
|
48
|
+
export declare function parseClaudeStateSince(workspacePath: string, fromByte: number): ClaudeSessionState;
|
|
49
|
+
/** @deprecated Use parseClaudeStateSince instead. */
|
|
50
|
+
export declare function hasClaudeEndTurnSince(workspacePath: string, fromByte: number): boolean;
|
|
51
|
+
export declare function readClaudeOutputSince(workspacePath: string, fromByte: number): string;
|
|
52
|
+
/** Build the shell command string for the claude-cli provider. */
|
|
53
|
+
export declare function buildClaudeCliCommand(agentProfileFile: string, messageFile: string, sessionId?: string, includeProfile?: boolean, model?: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Run a tiny probe prompt via Node exec to obtain a claude-cli session ID
|
|
56
|
+
* before the main prompt runs. Extracts "session_id" from --output-format json output.
|
|
57
|
+
*/
|
|
58
|
+
export declare function probeClaudeSession(cwd: string, log: (msg: string) => void): Promise<string | undefined>;
|
|
59
|
+
/**
|
|
60
|
+
* Run `/compact` on an existing Claude session to summarise conversation
|
|
61
|
+
* history and free up context window space. Used after Claude returns
|
|
62
|
+
* `prompt is too long: N tokens > MAX maximum` (HTTP 400). Resolves on exit
|
|
63
|
+
* (success or failure — caller decides what to do).
|
|
64
|
+
*/
|
|
65
|
+
export declare function runClaudeCompact(sessionId: string, cwd: string, log: (msg: string) => void): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Run `/clear` on an existing Claude session to wipe the conversation history
|
|
68
|
+
* and start fresh. Used when autocompact is thrashing (context refills to
|
|
69
|
+
* limit immediately after compact). Resolves on exit.
|
|
70
|
+
*/
|
|
71
|
+
export declare function runClaudeClear(sessionId: string, cwd: string, log: (msg: string) => void): Promise<void>;
|