feat(config): create a new project's memory file from Settings
The Memory tab could only show this machine's user memory and the
dashboard's own project file. Setting up a project you had not run
through the dashboard meant opening a terminal — `PUT /file`'s
"project" scope always resolves against the server's cwd, on purpose.
Add one narrow route per tool that writes into the directory you name:
CLAUDE.md for Claude Code, AGENTS.md for Codex, both through the same
`project-memory.js`. Being the only write path that honours a
caller-supplied directory, it pays for that:
- the directory must be absolute and already exist — nothing is
created for you;
- the filename comes from the route, never from the body;
- an existing file, symlink included, is a 409 — this can only
create, never overwrite;
- it sits behind the loopback-Origin guard /api/run uses, so a page
in the user's browser cannot plant agent instructions in a project
directory. That guard moves to lib/same-origin.js to be shared.
The modal takes the dashboard's known project dirs as suggestions on a
free-text input rather than a closed list: a project it has never seen
is exactly the case this exists for.
Mutation-checked: dropping the origin guard, and swapping lstat for
stat, each fail a test.
This commit is contained in:
@@ -174,6 +174,20 @@
|
||||
"projectLabel": "Project",
|
||||
"projectHelp": "Created in this project's memory dir."
|
||||
},
|
||||
"projectMemory": {
|
||||
"newButton": "New project memory",
|
||||
"title": "Create {{file}} for another project",
|
||||
"dirLabel": "Project directory",
|
||||
"dirHelp": "Absolute path to a project that already exists on this machine. {{file}} is created inside it; an existing one is never overwritten.",
|
||||
"dirRequired": "A project directory is required",
|
||||
"createButton": "Create",
|
||||
"created": "Created {{path}}",
|
||||
"template": "# Project memory\n\nWhat this project is, and anything an agent should know before touching it.\n\n## Stack\n\n## Conventions\n\n## Commands\n",
|
||||
"contentLabel": "Content",
|
||||
"cancel": "Cancel",
|
||||
"saving": "Creating…",
|
||||
"close": "Close"
|
||||
},
|
||||
"edit": {
|
||||
"newButton": "New",
|
||||
"editButton": "Edit",
|
||||
|
||||
@@ -56,6 +56,20 @@
|
||||
"memory": {
|
||||
"missing": "No AGENTS.md found."
|
||||
},
|
||||
"projectMemory": {
|
||||
"newButton": "New project memory",
|
||||
"title": "Create {{file}} for another project",
|
||||
"dirLabel": "Project directory",
|
||||
"dirHelp": "Absolute path to a project that already exists on this machine. {{file}} is created inside it; an existing one is never overwritten.",
|
||||
"dirRequired": "A project directory is required",
|
||||
"createButton": "Create",
|
||||
"created": "Created {{path}}",
|
||||
"template": "# Project memory\n\nWhat this project is, and anything an agent should know before touching it.\n\n## Stack\n\n## Conventions\n\n## Commands\n",
|
||||
"contentLabel": "Content",
|
||||
"cancel": "Cancel",
|
||||
"saving": "Creating…",
|
||||
"close": "Close"
|
||||
},
|
||||
"config": {
|
||||
"missing": "No config.toml found."
|
||||
},
|
||||
|
||||
@@ -169,6 +169,20 @@
|
||||
"projectLabel": "Dự án",
|
||||
"projectHelp": "Được tạo trong thư mục bộ nhớ của dự án này."
|
||||
},
|
||||
"projectMemory": {
|
||||
"newButton": "Memory cho project khác",
|
||||
"title": "Tạo {{file}} cho một project khác",
|
||||
"dirLabel": "Thư mục project",
|
||||
"dirHelp": "Đường dẫn tuyệt đối tới một project đã có trên máy. {{file}} sẽ được tạo bên trong; file đã tồn tại thì không bao giờ bị ghi đè.",
|
||||
"dirRequired": "Cần nhập thư mục project",
|
||||
"createButton": "Tạo",
|
||||
"created": "Đã tạo {{path}}",
|
||||
"template": "# Project memory\n\nProject này là gì, và những gì agent cần biết trước khi đụng vào.\n\n## Stack\n\n## Quy ước\n\n## Lệnh thường dùng\n",
|
||||
"contentLabel": "Nội dung",
|
||||
"cancel": "Huỷ",
|
||||
"saving": "Đang tạo…",
|
||||
"close": "Đóng"
|
||||
},
|
||||
"edit": {
|
||||
"newButton": "Tạo mới",
|
||||
"editButton": "Sửa",
|
||||
|
||||
@@ -56,6 +56,20 @@
|
||||
"memory": {
|
||||
"missing": "Không tìm thấy AGENTS.md."
|
||||
},
|
||||
"projectMemory": {
|
||||
"newButton": "Memory cho project khác",
|
||||
"title": "Tạo {{file}} cho một project khác",
|
||||
"dirLabel": "Thư mục project",
|
||||
"dirHelp": "Đường dẫn tuyệt đối tới một project đã có trên máy. {{file}} sẽ được tạo bên trong; file đã tồn tại thì không bao giờ bị ghi đè.",
|
||||
"dirRequired": "Cần nhập thư mục project",
|
||||
"createButton": "Tạo",
|
||||
"created": "Đã tạo {{path}}",
|
||||
"template": "# Project memory\n\nProject này là gì, và những gì agent cần biết trước khi đụng vào.\n\n## Stack\n\n## Quy ước\n\n## Lệnh thường dùng\n",
|
||||
"contentLabel": "Nội dung",
|
||||
"cancel": "Huỷ",
|
||||
"saving": "Đang tạo…",
|
||||
"close": "Đóng"
|
||||
},
|
||||
"config": {
|
||||
"missing": "Không tìm thấy config.toml."
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user