mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-12-04 06:21:59 +09:00
* test(console): fixture file system accepts Windows drive paths
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(console): Windows project folders are project folders (ADRs, export, catalog, mission cost)
Guards that accepted only a path starting with "/" treated a Windows session
folder (C:\Users\x\proj) as "no project folder is known". Adds hooks/data/paths.ts
(pure string helpers: isAbsolutePath, joinPath, samePath, plus hasParentSegment,
normalizePath, below, trimTrailing, isWindowsPath) and uses it at the absolute-path
guards in adr, event-export, wf-file, plugin-catalog, mission-cost (and the ledger
install path), wf-worktrees, skills-lab, wf-drill-io, facts, ap-envelope and
register. Each caller keeps its own ".." refusal; POSIX paths take the same code
path as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(console): protected autopilot folders match ignoring case on Windows paths
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(console): find the home folder on Windows (sessions, plugin health, What's new)
Implements homeOf function that checks HOME → USERPROFILE → HOMEDRIVE+HOMEPATH
with comprehensive test coverage. Fixes state.home initialization on Windows
where HOME is unset.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(console): disk writes work on Windows through the host file API
Windows has none of uname, dd, sh, install, mkdir or cp in Claude Code's process
environment, so every console write (Events, Timeline, autopilot journal, ADRs,
exports, .gitignore) failed there. New write flavor host-fs, chosen on win32 (no
uname is run), carries the enumerated writes through $.fs.read/write/exists via
writeVia. Linux GNU and macOS/BSD argv are unchanged (pinned by test).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(console): autopilot kill flag can be cleared on Windows; document host-fs create window
Windows has no delete, so clearKill rewrites the KILL flag with a fixed marker and
killSeen treats exactly that content as not set (host-fs only); stopNow rewrites
the flag empty so a second stop is seen. POSIX rm/stat behaviour is unchanged.
write-via and wf-file now say host-fs creates are check-then-write (no O_EXCL).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(console): no Linux-only process probe on Windows; clear probe timers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(console): a hive started from the console shows at once
When a start's CLI run exited 0 but its verify fails (the CLI can return
before its state file lands), wait 1 s via host.after, read fresh and verify
once more before reporting the "expected ..." text. No retry when the run
failed; exactly one retry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* test(console): pin Windows containment, parent-segment and UNC rules in paths.ts
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(console): workspace keys equal across drive-letter case and trailing separator
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(console): autopilot start is refused on Windows until atomic appends and Windows-aware path checks exist
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* chore(console): 0.42.2 changelog and version
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix(console): read home variables by literal name so the module loads
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* post-merge cleanup: finish #4036 integration
The Option B merge commit (4313013cb) landed cleanly against upstream/main
but a batch of merge-resolution edits in the working tree were not persisted
into the commit itself. This commit finishes the integration:
Path-helper consolidation (abs-path.ts → paths.ts):
- hooks/data/wf-drill-io.ts: add missing paths.ts import for below,
hasParentSegment, isAbsolutePath, samePath, trimTrailing (fixes 4
wf-drill-read.spec.ts failures that threw `ReferenceError: isAbsolutePath
is not defined` at runtime).
- hooks/adr.ts: migrate from ./data/abs-path to ./data/paths, pulling in
joinPath which is needed at lines 89/94.
- hooks/register.ts: drop the rootedPath import from the deleted
abs-path.ts; inline the equivalent isAbsolutePath+joinPath expression.
- hooks/data/event-export.ts, hooks/data/wf-file.ts: drop the duplicate
isAbsolutePath import from the deleted ./abs-path (the main-side wider
'./paths' import already covers it).
VERIFY_RETRY_MS lifecycle (ADR-450 interaction with Marius' feature):
- hooks/runner.ts: extend the retry condition — `verified === 'n/a' &&
spec.verify !== undefined` also retries, so a snapshot that hasn't
loaded yet (null, not "no verifier") gets the one-second re-check.
Tests brought in line with the new timing / platform guards:
- tests/tui-actions.spec.ts: settle(600) → settle(1200) at the point the
runner's VERIFY_RETRY_MS one-second re-check has to resolve before the
verdict is drawn.
- tests/windows-drive-path-sites.spec.ts: fsWithDir made separator-agnostic
via a normSeps helper, since joinPath now uses the base path's own
separator (`\` on a Windows base).
Version bump:
- .claude-plugin/plugin.json, hooks/version.ts, scripts/smoke.sh: 0.44.7
→ 0.44.8.
- CHANGELOG.md: prepend 0.44.8 entry crediting #4036 and @socrates6969.
Verified: full console suite 3400 total · 3362 pass · 15 fail · 23 skipped.
Every one of the 15 remaining fails is pre-existing on main or a
platform/env limitation (Windows chmod, fake-timer timing, codex not
installed) — zero merge-caused failures remain.
Co-Authored-By: RuFlo <ruv@ruv.net>
---------
Co-authored-by: Marius Carlsson <109006081+socrates6969@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Mario Jauvin <marioja@users.noreply.github.com>
Co-authored-by: r <r@x>
74 lines
5.1 KiB
TypeScript
74 lines
5.1 KiB
TypeScript
import type { CommandSpec, HookStream, PaneOpenArgs, ProcessRunResult, ProcessSpawnChunk, ProcessSpawnResult, Timer, UiBlitArgs } from 'claude-code'
|
|
|
|
import type { WriterFs } from './data/write-via'
|
|
import type { ToastLevel } from './toast-policy'
|
|
import type { RufloRoute, RufloSnapshot } from '../types'
|
|
|
|
/** What `$.ui.open` answers: drawn, or held back with the reason. A build that answers nothing has drawn it. */
|
|
export type OpenResult = { isPlaced: boolean; reason?: string } | void
|
|
|
|
/**
|
|
* The engine as `session.start` bound it. Every later hook, timer and button reaches the engine through this, so the
|
|
* controller is plain functions over an interface a test can stand in for. Any member may be refused (an administrator
|
|
* removed the affordance, a policy mod said no): every caller catches, and a refusal is a missing fact, never a crash.
|
|
*/
|
|
export type Host = {
|
|
fs: WriterFs
|
|
every: (ms: number, fn: () => void) => Timer
|
|
after: (ms: number, fn: () => void) => Timer
|
|
storeGet: (key: string) => Promise<unknown>
|
|
storeSet: (key: string, value: unknown) => Promise<void>
|
|
/** A GET through the host (never the plugin's own network; an administrator's policy may refuse it): the status and the body text. */
|
|
fetchText: (url: string) => Promise<{ ok: boolean; status: number; text: string }>
|
|
/** The engine's own choice dialog: the label chosen. Rejects when dismissed, and when nobody can be asked (a -p run). */
|
|
askChoice: (question: string, options: readonly string[]) => Promise<string>
|
|
/** A short note over the transcript's corner; it leaves the transcript and the model untouched. */
|
|
toast: (text: string, timeoutMs?: number, level?: ToastLevel) => void
|
|
invalidate: () => void
|
|
/** Scrolls the pane back to its first row: a page that was switched to (or opened over this one) starts at its top, not where the last one was left. */
|
|
scrollTop: () => void
|
|
/** Moves a pane's focus ring onto an element it drew (a field), while the pane holds the keys. */
|
|
focus: (paneId: string, key: string) => Promise<unknown>
|
|
/** Fire and forget: a blit resolves only once painted, and blits between frames fold anyway. */
|
|
blit: (args: UiBlitArgs) => void
|
|
openPane: (pane: PaneOpenArgs) => Promise<OpenResult>
|
|
closePane: (id: string) => Promise<void>
|
|
panes: () => Promise<readonly { id: string; isShown: boolean; isFocused: boolean }[]>
|
|
registerCommand: (spec: CommandSpec) => Promise<unknown>
|
|
run: (argv: readonly string[], timeoutMs: number, stdin?: string) => Promise<ProcessRunResult>
|
|
/** Starts a command and streams what it writes; `input` goes to its stdin, which is then closed. */
|
|
spawn: (argv: readonly string[], input?: string) => HookStream<ProcessSpawnChunk, ProcessSpawnResult>
|
|
usage: () => Promise<{ costUsd?: number; contextPercent?: number }>
|
|
/** The ruflo / claude-flow MCP tools the model can call now, and the servers they come from. */
|
|
rufloTools: () => Promise<{ tools: number; servers: string[] }>
|
|
settings: () => Promise<unknown>
|
|
home: () => Promise<string | undefined>
|
|
configDir: () => Promise<string | undefined>
|
|
/** This plugin's folder: where its own files (the command catalog) are. */
|
|
pluginRoot: string
|
|
rufloSnapshot: () => Promise<RufloSnapshot>
|
|
rufloRoute: () => Promise<RufloRoute | null>
|
|
rufloSegment: (text: string | null) => Promise<void>
|
|
/** Submits a prompt to the primary Claude session as a visible turn of its own (once idle). */
|
|
submitPrompt: (text: string) => Promise<void>
|
|
/** Puts text in the prompt box as the draft (the person presses Enter); false where there is no box. */
|
|
fillPrompt: (text: string) => Promise<boolean>
|
|
/** The names of the slash commands the session offers now (built-in, plugin and MCP alike). */
|
|
listCommands: () => Promise<string[]>
|
|
/** Runs a slash command as if typed (built-in, plugin or MCP); queued until the session is idle. */
|
|
runSlash: (command: string, args: string) => Promise<{ text?: string } | void>
|
|
/**
|
|
* Calls an engine tool as the session would ($.tool.call: every hook, the permission check and its dialog, then the tool), from a clock tick
|
|
* (a tool call waits on the turn). A refusal comes back as `deny`, a failure as `isError`; a missing tool or an aborted call rejects.
|
|
* Optional: a build that does not bind it makes the control actions fall back to a prompt-box prefill (ADR-465).
|
|
*/
|
|
toolCall?: (input: { tool: string } & Record<string, unknown>) => Promise<ToolReply>
|
|
/** The engine's permission verdict for a tool call now, with nothing run and no dialog ($.tool.check). */
|
|
toolCheck?: (tool: string, input: unknown) => Promise<{ decision: 'allow' | 'ask' | 'deny'; reason?: string }>
|
|
/** A request with a method, headers and a text body through the host (the OpenAI-compatible targets); the key rides a header and is never logged. */
|
|
httpSend?: (url: string, init: { method: string; headers: Record<string, string>; body: string }) => Promise<{ ok: boolean; status: number; text: string }>
|
|
}
|
|
|
|
/** What a tool call answered: the refusal, or the output (text and structure) and whether it was an error. */
|
|
export type ToolReply = { deny?: string; text?: string; result?: unknown; isError?: boolean }
|