* Allow Claude Code to read skill seeds and design-system specs (#6) The skill body's preamble points the agent at absolute paths like `<repo>/skills/guizang-ppt/assets/template.html`, but the agent's cwd is `.od/projects/<id>/`. Without an explicit allowlist Claude Code blocks Read on those paths and the user sees a permission error mid-conversation. Pass `SKILLS_DIR` and `DESIGN_SYSTEMS_DIR` through `buildArgs` and emit them as `--add-dir` for Claude so the seed template, references, and design-system DESIGN.md are all readable. Other agents ignore the extra dirs (no equivalent flag). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs: add verification screenshot for issue #6 fix Captures the agent successfully Read-ing skills/guizang-ppt/ side files through the new --add-dir allowlist, confirming the permission error from issue #6 is gone. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 366 KiB |
+23
-9
@@ -7,7 +7,12 @@ import path from 'node:path';
|
|||||||
const execFileP = promisify(execFile);
|
const execFileP = promisify(execFile);
|
||||||
|
|
||||||
// Each entry defines how to invoke the agent in non-interactive "one-shot" mode.
|
// Each entry defines how to invoke the agent in non-interactive "one-shot" mode.
|
||||||
// `buildArgs(prompt, imagePaths)` returns argv for the child process.
|
// `buildArgs(prompt, imagePaths, extraAllowedDirs)` returns argv for the child
|
||||||
|
// process. `extraAllowedDirs` is a list of absolute directories the agent must
|
||||||
|
// be permitted to read files from (skill seeds, design-system specs) that live
|
||||||
|
// outside the project cwd. Currently only Claude Code wires this through
|
||||||
|
// (`--add-dir`); other agents either inherit broader access or run with cwd
|
||||||
|
// boundaries we can't widen via flags.
|
||||||
// `streamFormat` hints to the daemon how to interpret stdout:
|
// `streamFormat` hints to the daemon how to interpret stdout:
|
||||||
// - 'claude-stream-json' : line-delimited JSON emitted by Claude Code's
|
// - 'claude-stream-json' : line-delimited JSON emitted by Claude Code's
|
||||||
// `--output-format stream-json`. Daemon parses it into typed events
|
// `--output-format stream-json`. Daemon parses it into typed events
|
||||||
@@ -19,14 +24,23 @@ export const AGENT_DEFS = [
|
|||||||
name: 'Claude Code',
|
name: 'Claude Code',
|
||||||
bin: 'claude',
|
bin: 'claude',
|
||||||
versionArgs: ['--version'],
|
versionArgs: ['--version'],
|
||||||
buildArgs: (prompt) => [
|
buildArgs: (prompt, _imagePaths, extraAllowedDirs = []) => {
|
||||||
'-p',
|
const args = [
|
||||||
prompt,
|
'-p',
|
||||||
'--output-format',
|
prompt,
|
||||||
'stream-json',
|
'--output-format',
|
||||||
'--verbose',
|
'stream-json',
|
||||||
'--include-partial-messages',
|
'--verbose',
|
||||||
],
|
'--include-partial-messages',
|
||||||
|
];
|
||||||
|
const dirs = (extraAllowedDirs || []).filter(
|
||||||
|
(d) => typeof d === 'string' && d.length > 0,
|
||||||
|
);
|
||||||
|
if (dirs.length > 0) {
|
||||||
|
args.push('--add-dir', ...dirs);
|
||||||
|
}
|
||||||
|
return args;
|
||||||
|
},
|
||||||
streamFormat: 'claude-stream-json',
|
streamFormat: 'claude-stream-json',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
+11
-1
@@ -769,7 +769,17 @@ export async function startServer({ port = 7456 } = {}) {
|
|||||||
safeImages.length ? `\n\n${safeImages.map((p) => `@${p}`).join(' ')}` : '',
|
safeImages.length ? `\n\n${safeImages.map((p) => `@${p}`).join(' ')}` : '',
|
||||||
].join('');
|
].join('');
|
||||||
|
|
||||||
const args = def.buildArgs(composed, safeImages);
|
// Skill seeds (`skills/<id>/assets/template.html`) and design-system
|
||||||
|
// specs (`design-systems/<id>/DESIGN.md`) live outside the project cwd.
|
||||||
|
// The composed system prompt asks the agent to Read them via absolute
|
||||||
|
// paths in the skill-root preamble — without an explicit allowlist,
|
||||||
|
// Claude Code blocks those reads (issue #6: "no permission to read
|
||||||
|
// skills template"). We surface both roots so any agent that honours
|
||||||
|
// `--add-dir` can resolve those side files.
|
||||||
|
const extraAllowedDirs = [SKILLS_DIR, DESIGN_SYSTEMS_DIR].filter(
|
||||||
|
(d) => fs.existsSync(d),
|
||||||
|
);
|
||||||
|
const args = def.buildArgs(composed, safeImages, extraAllowedDirs);
|
||||||
|
|
||||||
res.setHeader('Content-Type', 'text/event-stream');
|
res.setHeader('Content-Type', 'text/event-stream');
|
||||||
res.setHeader('Cache-Control', 'no-cache, no-transform');
|
res.setHeader('Cache-Control', 'no-cache, no-transform');
|
||||||
|
|||||||
Reference in New Issue
Block a user