@open-tomato/rafa 0.16.0 → 0.18.0
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/NOTICE +9 -1
- package/README.md +44 -17
- package/dist/bundled/agents/build-error-resolver.md +144 -0
- package/dist/bundled/agents/code-reviewer.md +335 -0
- package/dist/bundled/agents/doc-updater.md +108 -0
- package/dist/bundled/agents/loop-implementer.md +57 -0
- package/dist/bundled/agents/qa-bug-reporter.md +164 -0
- package/dist/bundled/agents/tdd-guide.md +121 -0
- package/dist/bundled/bin/ts-symbols +272 -0
- package/dist/{SKILL.md → bundled/skills/dev-planner/SKILL.md} +13 -10
- package/dist/bundled/skills/documentation/SKILL.md +93 -0
- package/dist/bundled/skills/git-workflow/SKILL.md +242 -0
- package/dist/bundled/skills/ts-symbols/SKILL.md +82 -0
- package/dist/cli.js +5431 -3819
- package/dist/{describe-wbn759vf.js → describe-vq037dyt.js} +3 -3
- package/dist/effort/store/index.js +4 -4
- package/dist/{index-krjzghpz.js → index-0pdsq2hy.js} +21 -8
- package/dist/{index-1vtd5fr7.js → index-6vkd153j.js} +3312 -1267
- package/dist/{index-n3rw8rhr.js → index-944pncd8.js} +69 -1
- package/dist/{index-q491ekzm.js → index-at9f1z2z.js} +40 -13
- package/dist/{index-kph6p7rp.js → index-cvpdvmtg.js} +1521 -2527
- package/dist/{index-p901zs2p.js → index-ddf85qac.js} +1 -1
- package/dist/{index-6cw1n0qy.js → index-jva32qe6.js} +254 -6
- package/dist/{index-qzhpqmfy.js → index-kvnggvyk.js} +2 -2
- package/dist/index.js +7 -7
- package/dist/plan/index.js +3 -3
- package/dist/plan-prompt.md +5 -1
- package/package.json +2 -2
|
@@ -11,6 +11,65 @@ function isMergeMethod(value) {
|
|
|
11
11
|
return typeof value === "string" && MERGE_METHODS.includes(value);
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
// src/schema/tiers.ts
|
|
15
|
+
import { existsSync, realpathSync } from "fs";
|
|
16
|
+
import { dirname, join } from "path";
|
|
17
|
+
var SKILL_TIERS = ["project", "rafa", "user"];
|
|
18
|
+
var INSTINCT_SCOPES = ["project", "user"];
|
|
19
|
+
var CLAUDE_SKILLS_PATH = join(".claude", "skills");
|
|
20
|
+
var RAFA_INSTINCTS_PATH = join(".rafa", "instincts");
|
|
21
|
+
var BUNDLED_SKILLS_DIR = join("bundled", "skills");
|
|
22
|
+
var BUNDLED_BIN_DIR = join("bundled", "bin");
|
|
23
|
+
function isSkillTier(value) {
|
|
24
|
+
return SKILL_TIERS.includes(value);
|
|
25
|
+
}
|
|
26
|
+
function realEntry(entry) {
|
|
27
|
+
try {
|
|
28
|
+
return realpathSync(entry);
|
|
29
|
+
} catch {
|
|
30
|
+
return entry;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function bundledSkillsDirectory(entry) {
|
|
34
|
+
return join(dirname(realEntry(entry ?? Bun.main)), BUNDLED_SKILLS_DIR);
|
|
35
|
+
}
|
|
36
|
+
function bundledBinDirectory(entry) {
|
|
37
|
+
return join(dirname(realEntry(entry ?? Bun.main)), BUNDLED_BIN_DIR);
|
|
38
|
+
}
|
|
39
|
+
function skillTierDirectory(tier, seams) {
|
|
40
|
+
if (tier === "user")
|
|
41
|
+
return join(seams.home, CLAUDE_SKILLS_PATH);
|
|
42
|
+
if (tier === "rafa")
|
|
43
|
+
return bundledSkillsDirectory(seams.entry);
|
|
44
|
+
return seams.projectRoot === null ? null : join(seams.projectRoot, CLAUDE_SKILLS_PATH);
|
|
45
|
+
}
|
|
46
|
+
function resolveSkillTiers(seams) {
|
|
47
|
+
const located = [];
|
|
48
|
+
for (const tier of SKILL_TIERS) {
|
|
49
|
+
const dir = skillTierDirectory(tier, seams);
|
|
50
|
+
if (dir !== null)
|
|
51
|
+
located.push({ tier, dir });
|
|
52
|
+
}
|
|
53
|
+
return located;
|
|
54
|
+
}
|
|
55
|
+
function instinctScopeDirectory(scope, seams) {
|
|
56
|
+
if (scope === "user")
|
|
57
|
+
return join(seams.home, RAFA_INSTINCTS_PATH);
|
|
58
|
+
return seams.projectRoot === null ? null : join(seams.projectRoot, RAFA_INSTINCTS_PATH);
|
|
59
|
+
}
|
|
60
|
+
function resolveInstinctScopes(seams) {
|
|
61
|
+
const located = [];
|
|
62
|
+
for (const scope of INSTINCT_SCOPES) {
|
|
63
|
+
const dir = instinctScopeDirectory(scope, seams);
|
|
64
|
+
if (dir !== null)
|
|
65
|
+
located.push({ scope, dir });
|
|
66
|
+
}
|
|
67
|
+
return located;
|
|
68
|
+
}
|
|
69
|
+
function tierExists(dir) {
|
|
70
|
+
return existsSync(dir);
|
|
71
|
+
}
|
|
72
|
+
|
|
14
73
|
// src/utils/declaration.ts
|
|
15
74
|
var DECLARATION_KEYS = [
|
|
16
75
|
"agent",
|
|
@@ -255,6 +314,7 @@ var OUTPUT_MODES = ["text", "json"];
|
|
|
255
314
|
var CLAUDE_SETTING_SOURCES = ["user", "project", "local"];
|
|
256
315
|
var PR_PROVIDERS = ["gh", "none"];
|
|
257
316
|
var RELEASE_AUTO = "auto";
|
|
317
|
+
var TIER_SWITCHES = ["on", "off"];
|
|
258
318
|
function accepted(value) {
|
|
259
319
|
return { value, problems: [], extras: [] };
|
|
260
320
|
}
|
|
@@ -290,6 +350,14 @@ var usdAmount = (raw, at) => {
|
|
|
290
350
|
var issueNumber = (raw, at) => typeof raw === "number" && Number.isSafeInteger(raw) && raw > 0 ? accepted(raw) : refused(at, raw, "an issue number, a whole number above zero");
|
|
291
351
|
var dayCount = (raw, at) => typeof raw === "number" && Number.isSafeInteger(raw) && raw > 0 ? accepted(raw) : refused(at, raw, "a number of days, a whole number above zero");
|
|
292
352
|
var releaseEnabled = (raw, at) => typeof raw === "boolean" || raw === RELEASE_AUTO ? accepted(raw) : refused(at, raw, `true, false or ${RELEASE_AUTO}`);
|
|
353
|
+
var tierSwitch = oneOf(TIER_SWITCHES);
|
|
354
|
+
var tierPin = (raw, at) => {
|
|
355
|
+
if (raw === false)
|
|
356
|
+
return accepted(false);
|
|
357
|
+
const tier = SKILL_TIERS.find((name) => name === raw);
|
|
358
|
+
return tier === undefined ? refused(at, raw, `false or one of: ${SKILL_TIERS.join(", ")}`) : accepted(tier);
|
|
359
|
+
};
|
|
360
|
+
var routeTarget = (raw, at) => raw === false || typeof raw === "string" && raw.trim() !== "" ? accepted(raw) : refused(at, raw, "false or an agent name");
|
|
293
361
|
var GITHUB_LOGIN = /^[A-Za-z0-9][A-Za-z0-9-]*(?:\[bot\])?$/;
|
|
294
362
|
function isGitHubLogin(value) {
|
|
295
363
|
return typeof value === "string" && GITHUB_LOGIN.test(value);
|
|
@@ -394,4 +462,4 @@ var moduleSource = (raw, at) => {
|
|
|
394
462
|
}));
|
|
395
463
|
};
|
|
396
464
|
|
|
397
|
-
export { __require, MERGE_METHODS, isMergeMethod, isAgentName, BUDGET_FLAG, parseBudgetUsd, parseTaskDeclaration, stripTaskDeclaration, resolveDeclarationFlags, isMapping, describeValue, messageOf, CONFIG_VERSIONS, STORE_BACKENDS, INJECT_MODES, OUTPUT_MODES, CLAUDE_SETTING_SOURCES, PR_PROVIDERS, RELEASE_AUTO, oneOf, text, flag, mergeMethod, usdAmount, issueNumber, dayCount, releaseEnabled, isGitHubLogin, githubLogin, listOf, subsetOf, PREREQUISITE_KINDS, REQUIRED_ITEM_KEYS, OPTIONAL_ITEM_KEYS, requiredPrerequisite, optionalPrerequisite, MODULE_SOURCE_KINDS, MODULE_SOURCE_KEYS, moduleSource };
|
|
465
|
+
export { __require, MERGE_METHODS, isMergeMethod, SKILL_TIERS, BUNDLED_SKILLS_DIR, isSkillTier, realEntry, bundledBinDirectory, skillTierDirectory, resolveSkillTiers, resolveInstinctScopes, tierExists, isAgentName, BUDGET_FLAG, parseBudgetUsd, parseTaskDeclaration, stripTaskDeclaration, resolveDeclarationFlags, isMapping, describeValue, messageOf, CONFIG_VERSIONS, STORE_BACKENDS, INJECT_MODES, OUTPUT_MODES, CLAUDE_SETTING_SOURCES, PR_PROVIDERS, RELEASE_AUTO, oneOf, text, flag, mergeMethod, usdAmount, issueNumber, dayCount, releaseEnabled, tierSwitch, tierPin, routeTarget, isGitHubLogin, githubLogin, listOf, subsetOf, PREREQUISITE_KINDS, REQUIRED_ITEM_KEYS, OPTIONAL_ITEM_KEYS, requiredPrerequisite, optionalPrerequisite, MODULE_SOURCE_KINDS, MODULE_SOURCE_KEYS, moduleSource };
|
|
@@ -4,16 +4,17 @@ import {
|
|
|
4
4
|
activeOutputMode,
|
|
5
5
|
createTextOutput,
|
|
6
6
|
readRafaBlocks
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-jva32qe6.js";
|
|
8
8
|
import {
|
|
9
9
|
commandSpelling
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-ddf85qac.js";
|
|
11
11
|
import {
|
|
12
12
|
STORE_BACKENDS,
|
|
13
|
+
bundledBinDirectory,
|
|
13
14
|
describeValue,
|
|
14
15
|
isMapping,
|
|
15
16
|
messageOf
|
|
16
|
-
} from "./index-
|
|
17
|
+
} from "./index-944pncd8.js";
|
|
17
18
|
|
|
18
19
|
// src/effort/store.ts
|
|
19
20
|
import {
|
|
@@ -852,9 +853,14 @@ function runningCommand() {
|
|
|
852
853
|
}
|
|
853
854
|
|
|
854
855
|
// src/utils/session-env.ts
|
|
855
|
-
|
|
856
|
+
import { delimiter } from "path";
|
|
857
|
+
function sessionPath(base, binDir) {
|
|
858
|
+
return base === undefined || base === "" ? binDir : `${binDir}${delimiter}${base}`;
|
|
859
|
+
}
|
|
860
|
+
function sessionSpawnEnv(base, binDir = bundledBinDirectory()) {
|
|
856
861
|
return {
|
|
857
862
|
...base,
|
|
863
|
+
PATH: sessionPath(base["PATH"], binDir),
|
|
858
864
|
CLAUDE_CODE_ENTRYPOINT: "cli"
|
|
859
865
|
};
|
|
860
866
|
}
|
|
@@ -895,8 +901,8 @@ var CLAUDE_BASE_ARGS = [
|
|
|
895
901
|
"--dangerously-skip-permissions"
|
|
896
902
|
];
|
|
897
903
|
var SETTING_SOURCES_FLAG = "--setting-sources";
|
|
898
|
-
function claudeArgs(settingSources, flags = []) {
|
|
899
|
-
return [...CLAUDE_BASE_ARGS, SETTING_SOURCES_FLAG, settingSources.join(","), ...flags];
|
|
904
|
+
function claudeArgs(settingSources, flags = [], served = []) {
|
|
905
|
+
return [...CLAUDE_BASE_ARGS, SETTING_SOURCES_FLAG, settingSources.join(","), ...served, ...flags];
|
|
900
906
|
}
|
|
901
907
|
var liveSessions = new Set;
|
|
902
908
|
function interruptClaudeSessions() {
|
|
@@ -957,8 +963,8 @@ async function spawnClaude(args, prompt) {
|
|
|
957
963
|
liveSessions.delete(proc);
|
|
958
964
|
}
|
|
959
965
|
}
|
|
960
|
-
function runClaude(prompt, settingSources, flags = [], spawn = spawnClaude) {
|
|
961
|
-
return spawn(claudeArgs(settingSources, flags), prompt);
|
|
966
|
+
function runClaude(prompt, settingSources, flags = [], spawn = spawnClaude, served = []) {
|
|
967
|
+
return spawn(claudeArgs(settingSources, flags, served), prompt);
|
|
962
968
|
}
|
|
963
969
|
function writeWholeLines(text, write) {
|
|
964
970
|
const lines = text.split(`
|
|
@@ -1014,8 +1020,8 @@ async function spawnCaptured(args, prompt, options = {}) {
|
|
|
1014
1020
|
}
|
|
1015
1021
|
return { exitCode: await proc.exited, stdout };
|
|
1016
1022
|
}
|
|
1017
|
-
function runClaudeCaptured(prompt, settingSources, flags = [], spawn = spawnClaudeCaptured) {
|
|
1018
|
-
return spawn(claudeArgs(settingSources, flags), prompt);
|
|
1023
|
+
function runClaudeCaptured(prompt, settingSources, flags = [], spawn = spawnClaudeCaptured, served = []) {
|
|
1024
|
+
return spawn(claudeArgs(settingSources, flags, served), prompt);
|
|
1019
1025
|
}
|
|
1020
1026
|
|
|
1021
1027
|
// src/adapters/planner/claude.ts
|
|
@@ -1117,7 +1123,7 @@ var REST_STATES = {
|
|
|
1117
1123
|
cancelled: "closed"
|
|
1118
1124
|
};
|
|
1119
1125
|
function createGhRunner(options) {
|
|
1120
|
-
const { cwd, command = "gh", env } = options;
|
|
1126
|
+
const { cwd, command = "gh", env, timeoutMs } = options;
|
|
1121
1127
|
return async (args) => {
|
|
1122
1128
|
const executable = env === undefined ? command : Bun.which(command, { PATH: env.PATH ?? "", cwd });
|
|
1123
1129
|
if (executable === null) {
|
|
@@ -1131,17 +1137,38 @@ function createGhRunner(options) {
|
|
|
1131
1137
|
stdout: "pipe",
|
|
1132
1138
|
stderr: "pipe"
|
|
1133
1139
|
});
|
|
1134
|
-
const
|
|
1140
|
+
const finished = Promise.all([
|
|
1135
1141
|
new Response(proc.stdout).text(),
|
|
1136
1142
|
new Response(proc.stderr).text(),
|
|
1137
1143
|
proc.exited
|
|
1138
1144
|
]);
|
|
1145
|
+
const outcome = await withDeadline(finished, timeoutMs);
|
|
1146
|
+
if (outcome === TIMED_OUT) {
|
|
1147
|
+
proc.kill("SIGKILL");
|
|
1148
|
+
await proc.exited;
|
|
1149
|
+
return { ok: false, stdout: "", stderr: `${command} in ${cwd} timed out after ${timeoutMs}ms and was killed` };
|
|
1150
|
+
}
|
|
1151
|
+
const [stdout, stderr, exitCode] = outcome;
|
|
1139
1152
|
return { ok: exitCode === 0, stdout, stderr };
|
|
1140
1153
|
} catch (error) {
|
|
1141
1154
|
return { ok: false, stdout: "", stderr: `could not run ${command} in ${cwd}: ${messageOf(error)}` };
|
|
1142
1155
|
}
|
|
1143
1156
|
};
|
|
1144
1157
|
}
|
|
1158
|
+
var TIMED_OUT = Symbol("timed out");
|
|
1159
|
+
async function withDeadline(work, timeoutMs) {
|
|
1160
|
+
if (timeoutMs === undefined)
|
|
1161
|
+
return work;
|
|
1162
|
+
let timer;
|
|
1163
|
+
const deadline = new Promise((resolve2) => {
|
|
1164
|
+
timer = setTimeout(() => resolve2(TIMED_OUT), timeoutMs);
|
|
1165
|
+
});
|
|
1166
|
+
try {
|
|
1167
|
+
return await Promise.race([work, deadline]);
|
|
1168
|
+
} finally {
|
|
1169
|
+
clearTimeout(timer);
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1145
1172
|
function notOnPath(command, cwd, path) {
|
|
1146
1173
|
const searched = path === undefined ? "an environment with no PATH" : `PATH ${JSON.stringify(path)}`;
|
|
1147
1174
|
return `could not run ${command} in ${cwd}: not found on ${searched} (ENOENT)`;
|
|
@@ -1839,4 +1866,4 @@ function selectEffortStore(repoRoot, config) {
|
|
|
1839
1866
|
return adapter.create({ repoRoot });
|
|
1840
1867
|
}
|
|
1841
1868
|
|
|
1842
|
-
export { EFFORT_STORE_DIR, effortStorePath, EFFORT_KEY_PROJECTIONS, openNdjsonStore, sqliteStorePath, LONE_SURROGATE, withSqliteStore, writeSqliteStore, openSqliteStore, sessionSpawnEnv, getClaudeUsagePercent, checkUsage, claudeArgs, interruptClaudeSessions, runClaude, spawnClaudeCaptured, runClaudeCaptured, planFilePath, ClaudePlannerError, ISSUE_TYPES, ISSUE_PRIORITIES, ISSUE_STATES, GITHUB_LABELS, createGhRunner, typeOfLabels, moduleOfLabels, createLocalTracker, PORT_VERSIONS, createAdapterRegistry, CORE_ADAPTER_REGISTRY, selectEffortStore };
|
|
1869
|
+
export { EFFORT_STORE_DIR, effortStorePath, EFFORT_KEY_PROJECTIONS, openNdjsonStore, sqliteStorePath, LONE_SURROGATE, withSqliteStore, writeSqliteStore, openSqliteStore, sessionSpawnEnv, getClaudeUsagePercent, checkUsage, CLAUDE_BIN, claudeArgs, interruptClaudeSessions, runClaude, spawnClaudeCaptured, runClaudeCaptured, planFilePath, ClaudePlannerError, ISSUE_TYPES, ISSUE_PRIORITIES, ISSUE_STATES, GITHUB_LABELS, createGhRunner, typeOfLabels, moduleOfLabels, createLocalTracker, PORT_VERSIONS, createAdapterRegistry, CORE_ADAPTER_REGISTRY, selectEffortStore };
|