Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
771c6f5245 | ||
|
|
5fc405d86a | ||
|
|
c82ab5028b | ||
|
|
d8c5a0bf0e | ||
|
|
dad2685ea3 | ||
|
|
84ee68d4da | ||
|
|
43b07aca48 | ||
|
|
0fd10df43d | ||
|
|
a84a3acaa0 | ||
|
|
e150de3c93 | ||
|
|
a0c95a035c | ||
|
|
843194b429 | ||
|
|
462171f27b | ||
|
|
18818c1bd4 | ||
|
|
d644c97dd9 | ||
|
|
0a724142ff |
No files matched your search
@@ -3,6 +3,58 @@
|
||||
All notable changes to CodeCraft. Versions follow [Semantic Versioning](https://semver.org/);
|
||||
until 1.0, minor versions may contain breaking changes.
|
||||
|
||||
## [v202611-00059] – 2026-11-17
|
||||
|
||||
### Changed
|
||||
|
||||
- **Collapsible chat list** on wide screens: the menu button in the title bar folds the chat list away (remembered), so chat menus are no longer hidden behind it on small monitors.
|
||||
|
||||
## [v202611-00058] – 2026-11-17
|
||||
|
||||
### Changed
|
||||
|
||||
- **README and screenshots** brought up to date (code factory, skills, new interface); skills labels no longer say "1 files".
|
||||
|
||||
## [v202611-00057] – 2026-11-17
|
||||
|
||||
### Added
|
||||
|
||||
- **Factory: skills per phase.** In the repository settings, each phase (review, build, acceptance) can have
|
||||
skills switched on; the chat of that phase follows them in every turn.
|
||||
|
||||
## [v202611-00056] – 2026-11-17
|
||||
|
||||
### Added
|
||||
|
||||
- **Skills you manage yourself.** *Settings → Skills*: create skills (a folder with `SKILL.md` and further
|
||||
files) in an editor, or import them from a GitHub repository or folder – every folder with a `SKILL.md` is
|
||||
offered, with a filter and multi-select. They are stored per user.
|
||||
- **Skills per chat.** Switch skills on for a chat (menu ⋯ → *Skills for this chat*): their full instructions
|
||||
are part of every turn. All other skills cost no context: up to 12 skills are listed by name in the prompt, a
|
||||
larger library is not listed at all – the agent finds a skill with `skill(query=…)` and reads its further
|
||||
files with `skill(name, file)`.
|
||||
|
||||
## [v202611-00055] – 2026-11-17
|
||||
|
||||
### Fixed
|
||||
|
||||
- **New project from a Git repository:** the wizard no longer clones into the factory area by default
|
||||
("target folder already exists" when the factory had checked out the same repository); your workspace is
|
||||
preselected, and the factory area is labelled as such in the folder list.
|
||||
|
||||
## [v202611-00053] – 2026-11-17
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Factory versioning.** The current version is read from the tags on the forge, not from the checkout
|
||||
(which kept tags that were deleted there and so counted from a stale version).
|
||||
|
||||
## [v202611-00054] – 2026-11-17
|
||||
|
||||
### Changed
|
||||
|
||||
- **README:** new "Code factory" section explaining phases, scope, planning chats, versions and releases.
|
||||
|
||||
## [v202611-00052] – 2026-11-17
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<img alt="Version v202611-00052" src="https://img.shields.io/badge/version-v202611--00052-d69e2e?style=flat-square">
|
||||
<img alt="Version v202611-00059" src="https://img.shields.io/badge/version-v202611--00059-d69e2e?style=flat-square">
|
||||
<img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-689d6a?style=flat-square">
|
||||
<img alt="Rust backend" src="https://img.shields.io/badge/backend-Rust-b7410e?style=flat-square&logo=rust">
|
||||
<img alt="React PWA" src="https://img.shields.io/badge/frontend-React%20PWA-2d81ff?style=flat-square&logo=react">
|
||||
@@ -25,6 +25,7 @@
|
||||
<a href="#models">Models</a> ·
|
||||
<a href="#terminal-client">Terminal client</a> ·
|
||||
<a href="#automations">Automations</a> ·
|
||||
<a href="#code-factory">Code factory</a> ·
|
||||
<a href="#integrations">Integrations</a> ·
|
||||
<a href="#users-and-security">Users</a> ·
|
||||
<a href="#statistics">Statistics</a> ·
|
||||
@@ -36,7 +37,7 @@
|
||||
<br>
|
||||
|
||||
<p align="center">
|
||||
<img src="docs/images/chat.png" alt="A CodeCraft session in the Gruvbox dark theme: a diff of the fix, the task list, and a permission card asking before the test suite runs; the sidebar shows pinned chats, a folder and the archive" width="100%">
|
||||
<img src="docs/images/chat.png" alt="A CodeCraft session in the Gruvbox dark theme: the agent's task list and a permission card with the diff of a one-line fix; the sidebar shows a pinned chat, a folder and today's chats, and the chip in the top bar shows an active skill" width="100%">
|
||||
<br>
|
||||
<sub>A session: the agent works through its task list, shows diffs, and asks before anything outside the rules.</sub>
|
||||
</p>
|
||||
@@ -129,7 +130,7 @@ opens the command palette, and prompt templates with placeholders save typing.
|
||||
<table>
|
||||
<tr>
|
||||
<td width="40%" valign="top">
|
||||
<img src="docs/images/mobile.png" alt="CodeCraft on a phone in a light theme: the agent asks where coupon codes should be stored and offers three options plus free text" width="100%"><br>
|
||||
<img src="docs/images/mobile.png" alt="CodeCraft on a phone in a dark theme: the task list and a permission card with the diff, with Allow once, Always allow and Reject buttons" width="100%"><br>
|
||||
<sub><b>Mobile:</b> answer questions and approve changes from your phone. Share links and text from other apps into a chat.</sub>
|
||||
</td>
|
||||
<td width="60%" valign="top">
|
||||
@@ -153,6 +154,19 @@ slash commands in `.claude/commands` and skills in `.claude/skills` are picked u
|
||||
The agent keeps notes about a project in `.codecraft/memory.md`; your personal memory applies to
|
||||
every project.
|
||||
|
||||
<p align="center">
|
||||
<img src="docs/images/skills.png" alt="Settings, Skills tab: the user's own skills with description and file count, buttons for a new skill and the import from GitHub" width="100%">
|
||||
</p>
|
||||
|
||||
**Skills** are packaged instructions for a kind of task: a folder with a `SKILL.md` (name, description,
|
||||
instructions) and further files. Create them in *Settings → Skills* with a small editor, or import them
|
||||
from a GitHub repository or folder (every folder with a `SKILL.md` is offered; filter and select several).
|
||||
They are stored per user and work next to the skills of your projects and the built-in ones. To keep the
|
||||
context small, you switch skills on **per chat** (menu ⋯ → *Skills for this chat*): only those are part of
|
||||
every turn. All others cost nothing – up to 12 are listed by name, a larger library is not listed at all and
|
||||
the agent finds a skill by keyword and loads it, with its further files, when it needs it. In the
|
||||
[code factory](#code-factory) each phase can have its own skills.
|
||||
|
||||
## Models
|
||||
|
||||
Every provider is an endpoint with a list of models. Each model can have a context size,
|
||||
@@ -203,7 +217,7 @@ platforms: `cargo install --locked --git https://git.familie-zink.org/zink/codec
|
||||
## Automations
|
||||
|
||||
<p align="center">
|
||||
<img src="docs/images/automations.png" alt="Creating an automation from a template: schedule chips, cron expression, mode, permission mode, model and the task for the agent" width="100%">
|
||||
<img src="docs/images/automations.png" alt="The automation editor: schedule chips with the next runs, mode, approval mode, model, time limit and the instructions file next to an assistant chat" width="100%">
|
||||
</p>
|
||||
|
||||
An automation is an agent that starts on a schedule. Its instructions are a Markdown file
|
||||
@@ -219,6 +233,96 @@ read and continue it.
|
||||
**Webhooks** start an automation from outside, e.g. on every push: the request is checked with a
|
||||
shared secret or a Gitea/GitHub HMAC signature, and its JSON payload is handed to the agent.
|
||||
|
||||
## Code factory
|
||||
|
||||
The factory turns issues on your Git forge (Gitea, GitHub or GitLab) into reviewed, built, accepted and
|
||||
merged changes – with agents doing the work and you deciding at the points that matter. It is
|
||||
the **Factory** page in the sidebar; all chats it creates live in the sidebar folder *Factory*.
|
||||
|
||||
<p align="center">
|
||||
<img src="docs/images/factory.png" alt="The factory board: columns for review, questions, approved, build, acceptance, failed and done with issue cards, the repository tile with its version, and buttons to plan a feature, cut a milestone and start a release" width="100%">
|
||||
<br>
|
||||
<sub>The factory page: every issue sits in the column of its phase; the repository shows its current version.</sub>
|
||||
</p>
|
||||
|
||||
```
|
||||
issue + label "factory"
|
||||
│
|
||||
▼
|
||||
review ──► question (the agent asks in the issue; you answer, it continues)
|
||||
│ └──► rejected (not buildable as written)
|
||||
▼
|
||||
approved ──► building ──► qa (acceptance) ──► done ──► PR merged ──► version + tag ──► closed
|
||||
▲ │
|
||||
└── rework ◄──┘ (up to N rounds, then failed)
|
||||
```
|
||||
|
||||
**Phases.** Each phase is a normal CodeCraft chat in the sandbox, so you can open and read it.
|
||||
The agent's answer ends with a JSON result that the factory parses; everything else is done by
|
||||
the server.
|
||||
|
||||
1. **Review.** An agent reads the issue and the repository and decides: *approved*, *question*
|
||||
(it comments in the issue and waits for your reply) or *rejected*. It also writes acceptance
|
||||
scenarios. The scenarios are stored in the factory database and are **never shown to the
|
||||
builder**, so the build cannot be tuned to the test.
|
||||
2. **Build.** The builder works in its own git worktree on the branch `factory/issue-<n>`.
|
||||
The server – not the agent – commits, pushes (never forced) and restores the spec file.
|
||||
3. **Acceptance.** A different agent checks the pushed branch in a clean checkout against the
|
||||
scenarios, using the repository's `.factory/setup.json` to build and start the app. Each
|
||||
scenario ends as `pass`, `fail`, `unverified` or `out_of_scope`; the verdict comes from these
|
||||
results, not from the model's opinion, and a run without any pass or fail counts as failed.
|
||||
On *pass* the factory opens the pull request (if none is open) and comments a result table
|
||||
in the issue. On *fail* the issue goes back to the build with the findings (*rework*).
|
||||
4. **Done, merge, version.** You review the pull request in the factory (diff, description) and
|
||||
merge it there. The factory then pulls the merge, gives the issue its version, commits
|
||||
`VERSION`, pushes an annotated tag, comments on the issue and closes it.
|
||||
|
||||
Issue text is treated as data, never as instructions for the factory itself.
|
||||
|
||||
**Scope.** An issue body can contain `Spec: <file>` and `Scope: <deliverable>` lines. Review,
|
||||
build and acceptance then restrict themselves to that deliverable, so a big specification is
|
||||
built in small steps instead of one huge run. Without a `Scope:` line the review picks the
|
||||
first unbuilt milestone of the spec. `Prerequisite:` lines name what must be merged first.
|
||||
|
||||
**Planning with a model.** Three chats help you create issues, without the usual review loop:
|
||||
|
||||
- **Spec chat** (*New project*): works out a specification with you and creates the repository
|
||||
with `docs/specs/<name>.md`, the factory setup and the first issues.
|
||||
- **Plan a feature**: you describe a feature or a bug; the model asks questions and ends with a
|
||||
list of issues (title, description, scope, prerequisites).
|
||||
- **Cut a milestone**: the model splits a milestone of the spec into numbered deliverables
|
||||
(`M2.1 – …`).
|
||||
|
||||
*Create issues* shows the proposal for editing and files the issues on the forge. They get the
|
||||
`factory` label only if you tick *Start right away*; by default you set the label yourself,
|
||||
one after the other, because later issues build on the merged earlier ones.
|
||||
|
||||
**Versions and releases.** Every issue that is merged raises the version of the repository
|
||||
(starting from the highest `vX.Y.Z` tag): a deliverable of a milestone raises the **patch**
|
||||
number (0.0.1, 0.0.2, …); the **last** open deliverable of a milestone (`M<k>.<n>`) raises the
|
||||
**minor** number and resets the patch (M1 complete → 0.1.0). Issues without a milestone
|
||||
(bugs, features) raise the patch number. The factory writes the `VERSION` file, pushes the tag
|
||||
`vX.Y.Z` and closes the issue. The **Release** button turns the current version into a
|
||||
release, e.g. 0.x → 1.0.0: it builds what the repository's `.factory/release.json` describes
|
||||
(Docker image for amd64 and arm64 pushed to your registry, a source zip, extra files by glob,
|
||||
shell commands), tags it and creates the release on the forge with notes from the git log and
|
||||
the files attached (Gitea and GitHub).
|
||||
|
||||
**Settings per repository** (*Factory → Repositories*, *New repository*): forge connection and token, label
|
||||
(default `factory`), parallel runs, allowed issue authors (default: the token's owner), and per
|
||||
phase the model, agent (CodeCraft or Claude Code), permission mode, timeout, tries on
|
||||
technical failures, the skills that are switched on for it, plus the number of rework rounds (default 2). Failed or rejected issues
|
||||
can be restarted from the board, finished ones are closed with a comment.
|
||||
|
||||
**Files in the repository** (all optional, kept in `.factory/`):
|
||||
|
||||
| File | Purpose |
|
||||
|---|---|
|
||||
| `setup.json` | How acceptance installs and starts the app: `install`, `start`, `url` |
|
||||
| `release.json` | Recipe for releases: image, platforms, Dockerfile, build args, commands, files |
|
||||
|
||||
Repositories are cloned into a separate factory area, not into your workspace, and agents never see the forge API token.
|
||||
|
||||
## Integrations
|
||||
|
||||
- **Telegram:** connect your own bot (*Settings → Account → Telegram*) and use CodeCraft from
|
||||
|
||||
@@ -196,6 +196,9 @@ pub struct Session {
|
||||
/// Icon of the chat (a name from `SESSION_ICONS`), shown in the list and the top bar.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub icon: Option<String>,
|
||||
/// Skills the user switched on for this chat: their instructions are part of every turn.
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub skills: Vec<String>,
|
||||
}
|
||||
|
||||
/// Names of the colour tags: the client draws them with the colours of the active theme.
|
||||
|
||||
|
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 167 KiB |
|
Before Width: | Height: | Size: 144 KiB After Width: | Height: | Size: 156 KiB |
|
After Width: | Height: | Size: 136 KiB |
|
Before Width: | Height: | Size: 172 KiB After Width: | Height: | Size: 176 KiB |
|
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 123 KiB |
|
After Width: | Height: | Size: 134 KiB |
|
Before Width: | Height: | Size: 177 KiB After Width: | Height: | Size: 203 KiB |
@@ -72,6 +72,10 @@ pub fn router(app: AppState) -> Router {
|
||||
.route("/agents/tools", get(agent_tools))
|
||||
.route("/agents/{name}", delete(delete_agent))
|
||||
.route("/commands", get(commands))
|
||||
.route("/skills", get(crate::skills_api::list))
|
||||
.route("/skills/github/scan", post(crate::skills_api::scan))
|
||||
.route("/skills/github/import", post(crate::skills_api::import))
|
||||
.route("/skills/{name}", get(crate::skills_api::get).put(crate::skills_api::put).delete(crate::skills_api::delete))
|
||||
.route("/transcribe", post(transcribe))
|
||||
.route("/sessions", get(list_sessions).post(create_session))
|
||||
.route("/sessions/search", get(search_sessions))
|
||||
@@ -532,7 +536,7 @@ async fn commands(Extension(user): Extension<User>, State(app): State<AppState>,
|
||||
let (root, cwd) = scope(&app, &user, q.cwd);
|
||||
Json(json!({
|
||||
"commands": prompts::commands(&app, &root, &cwd),
|
||||
"skills": prompts::skills(&app, &root, &cwd),
|
||||
"skills": prompts::skills(&app, &root, &cwd, Some(&user.id)),
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -676,6 +680,7 @@ async fn create_session(Extension(user): Extension<User>, State(app): State<AppS
|
||||
summary: String::new(),
|
||||
color: dstr("color").filter(|c| codecraft_core::types::SESSION_COLORS.contains(&c.as_str())),
|
||||
icon: dstr("icon").filter(|c| codecraft_core::types::SESSION_ICONS.contains(&c.as_str())),
|
||||
skills: Vec::new(),
|
||||
};
|
||||
let s = app.save_session(s)?;
|
||||
Ok(Json(json!(s)))
|
||||
@@ -973,6 +978,8 @@ struct UpdateSession {
|
||||
color: Option<String>,
|
||||
/// Icon ("" removes it).
|
||||
icon: Option<String>,
|
||||
/// Skills switched on for this chat (names).
|
||||
skills: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
async fn update_session(Extension(user): Extension<User>, State(app): State<AppState>, Path(id): Path<String>, Json(body): Json<UpdateSession>) -> ApiResult {
|
||||
@@ -1036,6 +1043,15 @@ async fn update_session(Extension(user): Extension<User>, State(app): State<AppS
|
||||
if let Some(i) = body.icon {
|
||||
s.icon = (!i.is_empty()).then_some(i);
|
||||
}
|
||||
if let Some(list) = body.skills {
|
||||
let mut seen = Vec::new();
|
||||
for n in list.into_iter().map(|n| n.trim().to_string()).filter(|n| !n.is_empty() && n.len() <= 64) {
|
||||
if !seen.contains(&n) && seen.len() < 20 {
|
||||
seen.push(n);
|
||||
}
|
||||
}
|
||||
s.skills = seen;
|
||||
}
|
||||
})?;
|
||||
Ok(Json(json!(s)))
|
||||
}
|
||||
@@ -1830,8 +1846,13 @@ async fn list_roots(Extension(user): Extension<User>, State(app): State<AppState
|
||||
.user_roots(Some(&user.id))
|
||||
.into_iter()
|
||||
.map(|r| {
|
||||
let rel = r.strip_prefix(&ws).map(|p| p.display().to_string()).unwrap_or_default();
|
||||
json!({"path": r, "name": if rel.is_empty() { "/".to_string() } else { rel }})
|
||||
let name = match r.strip_prefix(&ws) {
|
||||
Ok(p) if p.as_os_str().is_empty() => "/".to_string(),
|
||||
Ok(p) => p.display().to_string(),
|
||||
// Outside the workspace (e.g. the factory area): show where it is, not "workspace".
|
||||
Err(_) => format!("{} (factory)", r.file_name().and_then(|n| n.to_str()).unwrap_or("")).replace(" ()", ""),
|
||||
};
|
||||
json!({"path": r, "name": name})
|
||||
})
|
||||
.collect();
|
||||
Json(json!(roots))
|
||||
@@ -2431,7 +2452,7 @@ async fn job_assistant(Extension(user): Extension<User>, State(app): State<AppSt
|
||||
telegram_quiet: true,
|
||||
summary: String::new(),
|
||||
color: None,
|
||||
icon: None,
|
||||
icon: None, skills: Vec::new(),
|
||||
};
|
||||
let s = app.save_session(s)?;
|
||||
st.assistant_session = Some(s.id.clone());
|
||||
|
||||
@@ -36,7 +36,7 @@ pub async fn config(Extension(user): Extension<User>, State(app): State<AppState
|
||||
.filter(|c| c.description.len() < 400)
|
||||
.map(|c| json!({"name": c.name, "description": c.description, "body": c.body, "agent": c.agent}))
|
||||
.collect();
|
||||
let skills: Vec<Value> = crate::prompts::skills(&app, &root, &root).into_iter().map(|s| json!({"name": s.name, "description": s.description})).collect();
|
||||
let skills: Vec<Value> = crate::prompts::skills(&app, &root, &root, Some(&user.id)).into_iter().map(|s| json!({"name": s.name, "description": s.description})).collect();
|
||||
let (direct, deferred) = app.mcp.tools(&cfg, Some(&user));
|
||||
let mut mcp_tools: Vec<ToolDef> = direct.iter().map(|t| t.def()).collect();
|
||||
if !deferred.is_empty() {
|
||||
@@ -69,7 +69,7 @@ pub async fn config(Extension(user): Extension<User>, State(app): State<AppState
|
||||
/// A server skill with its supporting text files (templates).
|
||||
pub async fn skill(Extension(user): Extension<User>, State(app): State<AppState>, Path(name): Path<String>) -> ApiResult {
|
||||
let root = app.user_roots(Some(&user.id)).into_iter().next().unwrap_or_else(|| app.workspace());
|
||||
let sk = crate::prompts::skills(&app, &root, &root).into_iter().find(|s| s.name == name).ok_or_else(|| ApiError(StatusCode::NOT_FOUND, "skill not found".into()))?;
|
||||
let sk = crate::prompts::skills(&app, &root, &root, Some(&user.id)).into_iter().find(|s| s.name == name).ok_or_else(|| ApiError(StatusCode::NOT_FOUND, "skill not found".into()))?;
|
||||
let dir = sk.path.parent().map(PathBuf::from).unwrap_or_default();
|
||||
let content = std::fs::read_to_string(&sk.path)?;
|
||||
let mut files = Vec::new();
|
||||
|
||||
@@ -49,6 +49,9 @@ pub struct PhaseCfg {
|
||||
/// Extra instructions appended to the phase prompt.
|
||||
#[serde(default)]
|
||||
pub extra_prompt: String,
|
||||
/// Skills (names) switched on for the chat of this phase; only the CodeCraft agent uses them.
|
||||
#[serde(default)]
|
||||
pub skills: Vec<String>,
|
||||
}
|
||||
|
||||
fn default_agent() -> String {
|
||||
@@ -69,7 +72,7 @@ fn default_rework() -> i64 {
|
||||
|
||||
impl Default for PhaseCfg {
|
||||
fn default() -> Self {
|
||||
Self { model: String::new(), agent: default_agent(), permission_mode: default_mode(), timeout_minutes: default_timeout(), max_attempts: default_attempts(), extra_prompt: String::new() }
|
||||
Self { model: String::new(), agent: default_agent(), permission_mode: default_mode(), timeout_minutes: default_timeout(), max_attempts: default_attempts(), extra_prompt: String::new(), skills: Vec::new() }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,6 +174,7 @@ impl RepoCfg {
|
||||
}
|
||||
p.timeout_minutes = p.timeout_minutes.clamp(1, 24 * 60);
|
||||
p.max_attempts = p.max_attempts.clamp(1, 10);
|
||||
p.skills = p.skills.iter().map(|n| n.trim().to_string()).filter(|n| !n.is_empty() && n.len() <= 64).take(10).collect();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -882,6 +886,7 @@ fn start_phase(app: &Arc<App>, user: &User, cfg: &RepoCfg, issue: i64, phase: &s
|
||||
summary: String::new(),
|
||||
color: None,
|
||||
icon: None,
|
||||
skills: pc.skills.clone(),
|
||||
};
|
||||
let session = app.save_session(session)?;
|
||||
let run_id = crate::types::new_id();
|
||||
@@ -1462,7 +1467,7 @@ pub async fn start_issue_chat(app: &Arc<App>, user: &User, cfg: &RepoCfg, model:
|
||||
telegram_quiet: true,
|
||||
summary: String::new(),
|
||||
color: None,
|
||||
icon: None,
|
||||
icon: None, skills: Vec::new(),
|
||||
};
|
||||
app.save_session(session)
|
||||
}
|
||||
@@ -1583,7 +1588,7 @@ pub fn start_spec_chat(app: &Arc<App>, user: &User, model: &str) -> Result<crate
|
||||
telegram_quiet: true,
|
||||
summary: String::new(),
|
||||
color: None,
|
||||
icon: None,
|
||||
icon: None, skills: Vec::new(),
|
||||
};
|
||||
app.save_session(session)
|
||||
}
|
||||
|
||||
@@ -80,8 +80,16 @@ pub fn next_version(cur: Ver, b: Bump) -> Ver {
|
||||
|
||||
/// Highest `vX.Y.Z` tag of the remote (0.0.0 when there is none).
|
||||
async fn tags_version(cfg: &RepoCfg, dir: &Path) -> Ver {
|
||||
let _ = git(cfg, dir, &["fetch", "--tags", "--force", "origin"]).await;
|
||||
git(cfg, dir, &["tag", "-l", "v[0-9]*"]).await.unwrap_or_default().lines().filter_map(parse_version).max().unwrap_or((0, 0, 0))
|
||||
// The remote is the truth: a local checkout keeps tags that were deleted on the forge.
|
||||
let remote = git(cfg, dir, &["ls-remote", "--tags", "--refs", "origin", "v[0-9]*"]).await;
|
||||
let names: Vec<String> = match remote {
|
||||
Ok(out) => out.lines().filter_map(|l| l.split("refs/tags/").nth(1)).map(str::to_string).collect(),
|
||||
Err(_) => {
|
||||
let _ = git(cfg, dir, &["fetch", "--tags", "--force", "origin"]).await;
|
||||
git(cfg, dir, &["tag", "-l", "v[0-9]*"]).await.unwrap_or_default().lines().map(str::to_string).collect()
|
||||
}
|
||||
};
|
||||
names.iter().filter_map(|t| parse_version(t)).max().unwrap_or((0, 0, 0))
|
||||
}
|
||||
|
||||
/// `git pull --ff-only` of the default branch in the main checkout, so everything that was merged
|
||||
|
||||
@@ -335,7 +335,7 @@ pub async fn run_with(app: &Arc<App>, job: &Job, trigger: &str, payload: Option<
|
||||
telegram_quiet: true,
|
||||
summary: String::new(),
|
||||
color: None,
|
||||
icon: None,
|
||||
icon: None, skills: Vec::new(),
|
||||
};
|
||||
let session = app.save_session(session)?;
|
||||
app.store.job_started(&job.id, &session.id, now)?;
|
||||
|
||||
@@ -35,6 +35,7 @@ mod push;
|
||||
mod provider;
|
||||
mod reverse;
|
||||
mod runner;
|
||||
mod skills_api;
|
||||
mod sandbox;
|
||||
mod shells;
|
||||
mod sshkeys;
|
||||
|
||||
@@ -211,7 +211,7 @@ mod tests {
|
||||
let session = crate::types::Session {
|
||||
id: crate::types::new_id(), title: String::new(), cwd: dir.join("ws").display().to_string(), model: "x/y".into(), agent: "build".into(), permission_mode: "bypass".into(),
|
||||
parent_id: None, owner_id: None, created_at: now, updated_at: now, todos: Value::Null, last_usage: None, clean_room: None, phase: None, worktree: None,
|
||||
pinned: false, archived: false, folder: None, instructions: String::new(), telegram_quiet: true, summary: String::new(), color: None, icon: None,
|
||||
pinned: false, archived: false, folder: None, instructions: String::new(), telegram_quiet: true, summary: String::new(), color: None, icon: None, skills: Vec::new(),
|
||||
};
|
||||
let session = app.save_session(session).unwrap();
|
||||
let reg = register(&session.id);
|
||||
|
||||
@@ -285,11 +285,16 @@ pub fn system_prompt(app: &App, agent: &Agent, root: &Path, cwd: &Path, model: &
|
||||
s.push_str(&format!("- {server} ({n} tools, e.g. {})\n", names.join(", ")));
|
||||
}
|
||||
}
|
||||
let skills = skills(app, root, cwd);
|
||||
let skills = skills(app, root, cwd, owner.map(|u| u.id.as_str()));
|
||||
if !skills.is_empty() {
|
||||
s.push_str("\n# Skills\nLoad a skill with the skill tool when the task matches its description:\n");
|
||||
for sk in &skills {
|
||||
s.push_str(&format!("- {}: {}\n", sk.name, sk.description));
|
||||
if skills.len() <= SKILL_LIST_MAX {
|
||||
s.push_str("\n# Skills\nLoad a skill with the skill tool when the task matches its description:\n");
|
||||
for sk in &skills {
|
||||
s.push_str(&format!("- {}: {}\n", sk.name, sk.description.chars().take(160).collect::<String>()));
|
||||
}
|
||||
} else {
|
||||
// A large library must not fill the context: only the count; the agent searches on demand.
|
||||
s.push_str(&format!("\n# Skills\n{} skills (packaged instructions for kinds of task) are available but not listed. Find one with the skill tool (query=<keywords>), then load it with name=<skill>.\n", skills.len()));
|
||||
}
|
||||
}
|
||||
if let Some(u) = owner {
|
||||
@@ -381,23 +386,91 @@ pub struct Skill {
|
||||
pub name: String,
|
||||
pub description: String,
|
||||
pub path: PathBuf,
|
||||
/// Further files of the skill (relative paths, without SKILL.md).
|
||||
pub files: Vec<String>,
|
||||
/// Created by the user in the UI (editable there).
|
||||
pub user: bool,
|
||||
}
|
||||
|
||||
pub fn skills(app: &App, root: &Path, cwd: &Path) -> Vec<Skill> {
|
||||
/// Where a user's own skills live: `<data>/user-skills/<user id>/<name>/SKILL.md` (+ more files).
|
||||
pub fn user_skills_dir(app: &App, owner_id: &str) -> PathBuf {
|
||||
app.data_dir().join("user-skills").join(owner_id)
|
||||
}
|
||||
|
||||
/// Relative paths of all files below `dir` (depth <= 5, at most 200), without `SKILL.md` at the top.
|
||||
pub fn skill_files(dir: &Path) -> Vec<String> {
|
||||
fn walk(base: &Path, dir: &Path, depth: usize, out: &mut Vec<String>) {
|
||||
let Ok(entries) = std::fs::read_dir(dir) else { return };
|
||||
let mut entries: Vec<_> = entries.flatten().collect();
|
||||
entries.sort_by_key(|e| e.file_name());
|
||||
for e in entries {
|
||||
if out.len() >= 200 {
|
||||
return;
|
||||
}
|
||||
let p = e.path();
|
||||
let Ok(ty) = e.file_type() else { continue };
|
||||
if ty.is_dir() && depth < 5 {
|
||||
walk(base, &p, depth + 1, out);
|
||||
} else if ty.is_file() {
|
||||
if let Ok(rel) = p.strip_prefix(base) {
|
||||
let rel = rel.to_string_lossy().to_string();
|
||||
if rel != "SKILL.md" {
|
||||
out.push(rel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let mut out = Vec::new();
|
||||
walk(dir, dir, 0, &mut out);
|
||||
out
|
||||
}
|
||||
|
||||
pub fn skills(app: &App, root: &Path, cwd: &Path, owner_id: Option<&str>) -> Vec<Skill> {
|
||||
let mut map = BTreeMap::new();
|
||||
for dir in resource_dirs(app, root, cwd, "skills") {
|
||||
let mut dirs: Vec<(PathBuf, bool)> = resource_dirs(app, root, cwd, "skills").into_iter().map(|d| (d, false)).collect();
|
||||
if let Some(id) = owner_id {
|
||||
dirs.push((user_skills_dir(app, id), true));
|
||||
}
|
||||
for (dir, user) in dirs {
|
||||
let Ok(entries) = std::fs::read_dir(&dir) else { continue };
|
||||
for e in entries.flatten() {
|
||||
let p = e.path().join("SKILL.md");
|
||||
let Ok(text) = std::fs::read_to_string(&p) else { continue };
|
||||
let (meta, _) = frontmatter(&text);
|
||||
let name = meta.get("name").cloned().unwrap_or_else(|| e.file_name().to_string_lossy().into());
|
||||
map.insert(name.clone(), Skill { name, description: meta.get("description").cloned().unwrap_or_default(), path: p });
|
||||
map.insert(name.clone(), Skill { name, description: meta.get("description").cloned().unwrap_or_default(), files: skill_files(&e.path()), path: p, user });
|
||||
}
|
||||
}
|
||||
map.into_values().collect()
|
||||
}
|
||||
|
||||
/// Adds the skills the user switched on for this chat: their full instructions are part of every turn.
|
||||
pub fn with_active_skills(app: &App, mut system: String, active: &[String], root: &Path, cwd: &Path, owner_id: Option<&str>) -> String {
|
||||
if active.is_empty() {
|
||||
return system;
|
||||
}
|
||||
let all = skills(app, root, cwd, owner_id);
|
||||
let mut block = String::new();
|
||||
for name in active {
|
||||
let Some(sk) = all.iter().find(|s| &s.name == name) else { continue };
|
||||
let Ok(text) = std::fs::read_to_string(&sk.path) else { continue };
|
||||
let (_, body) = frontmatter(&text);
|
||||
let body: String = body.chars().take(40_000).collect();
|
||||
block.push_str(&format!("\n## Skill: {}\n{}\n", sk.name, body.trim()));
|
||||
if !sk.files.is_empty() {
|
||||
block.push_str(&format!("\nFurther files of this skill (read them with the skill tool: name=\"{}\", file=<path>): {}\n", sk.name, sk.files.join(", ")));
|
||||
}
|
||||
}
|
||||
if !block.is_empty() {
|
||||
system.push_str(&format!("\n\n# Active skills\nThe user switched these skills on for this chat. Follow them for every task they cover.\n{block}"));
|
||||
}
|
||||
system
|
||||
}
|
||||
|
||||
/// More skills than this are not listed in the system prompt (the agent searches instead).
|
||||
const SKILL_LIST_MAX: usize = 12;
|
||||
|
||||
pub struct SkillTool;
|
||||
|
||||
#[async_trait]
|
||||
@@ -406,23 +479,60 @@ impl Tool for SkillTool {
|
||||
"skill"
|
||||
}
|
||||
fn description(&self) -> String {
|
||||
"Load a skill (packaged instructions for a kind of task) by name. Follow the returned instructions.".into()
|
||||
"Load a skill (packaged instructions for a kind of task) by name and follow the returned instructions. `query` (keywords) lists matching skills instead; `file` reads one of the skill's further files.".into()
|
||||
}
|
||||
fn schema(&self) -> Value {
|
||||
json!({"type": "object", "properties": {"name": {"type": "string"}}, "required": ["name"]})
|
||||
json!({"type": "object", "properties": {
|
||||
"name": {"type": "string"},
|
||||
"file": {"type": "string", "description": "relative path of a further file of the skill"},
|
||||
"query": {"type": "string", "description": "keywords: lists the matching skills instead of loading one"}
|
||||
}})
|
||||
}
|
||||
fn read_only(&self) -> bool {
|
||||
true
|
||||
}
|
||||
async fn run(&self, input: Value, ctx: &ToolCtx) -> Result<ToolOutput> {
|
||||
let owner = ctx.app.store.get_session(&ctx.session_id).ok().flatten().and_then(|s| s.owner_id).or_else(|| ctx.owner_id.clone());
|
||||
let all = skills(&ctx.app, &ctx.root(), &ctx.cwd, owner.as_deref());
|
||||
if let Some(q) = input.get("query").and_then(|v| v.as_str()).filter(|q| !q.trim().is_empty()) {
|
||||
let words: Vec<String> = q.to_lowercase().split_whitespace().map(str::to_string).collect();
|
||||
let mut hits: Vec<(usize, &Skill)> = all
|
||||
.iter()
|
||||
.map(|s| {
|
||||
let hay = format!("{} {}", s.name, s.description).to_lowercase();
|
||||
(words.iter().filter(|w| hay.contains(w.as_str())).count(), s)
|
||||
})
|
||||
.filter(|(n, _)| *n > 0)
|
||||
.collect();
|
||||
hits.sort_by_key(|(n, s)| (std::cmp::Reverse(*n), s.name.clone()));
|
||||
if hits.is_empty() {
|
||||
return Ok(ToolOutput::text(format!("No skill matches '{q}' ({} skills available).", all.len())));
|
||||
}
|
||||
let lines: Vec<String> = hits.iter().take(15).map(|(_, s)| format!("- {}: {}", s.name, s.description.chars().take(200).collect::<String>())).collect();
|
||||
return Ok(ToolOutput::text(format!("Matching skills (load one with name=<skill>):\n{}", lines.join("\n"))));
|
||||
}
|
||||
let name = arg_str(&input, "name")?;
|
||||
let Some(sk) = skills(&ctx.app, &ctx.root(), &ctx.cwd).into_iter().find(|s| s.name == name) else {
|
||||
let Some(sk) = all.into_iter().find(|s| s.name == name) else {
|
||||
return Ok(ToolOutput::error(format!("unknown skill '{name}'")));
|
||||
};
|
||||
let dir = sk.path.parent().unwrap_or(Path::new("."));
|
||||
if let Some(file) = input.get("file").and_then(|v| v.as_str()).filter(|f| !f.trim().is_empty()) {
|
||||
let rel = Path::new(file.trim());
|
||||
if rel.is_absolute() || rel.components().any(|c| !matches!(c, std::path::Component::Normal(_))) {
|
||||
return Ok(ToolOutput::error("file must be a relative path inside the skill"));
|
||||
}
|
||||
let Ok(real) = std::fs::canonicalize(dir.join(rel)) else { return Ok(ToolOutput::error(format!("no file '{file}' in skill '{name}'"))) };
|
||||
if !real.starts_with(std::fs::canonicalize(dir)?) || !real.is_file() {
|
||||
return Ok(ToolOutput::error(format!("no file '{file}' in skill '{name}'")));
|
||||
}
|
||||
let mut text = std::fs::read_to_string(&real).unwrap_or_else(|_| "(binary file)".into());
|
||||
text.truncate(text.char_indices().nth(100_000).map(|(i, _)| i).unwrap_or(text.len()));
|
||||
return Ok(ToolOutput::text(text));
|
||||
}
|
||||
let text = std::fs::read_to_string(&sk.path)?;
|
||||
let (_, body) = frontmatter(&text);
|
||||
let dir = sk.path.parent().unwrap_or(Path::new("."));
|
||||
Ok(ToolOutput::text(format!("Skill '{name}' (base directory: {}):\n\n{body}", dir.display())))
|
||||
let files = if sk.files.is_empty() { String::new() } else { format!("\n\nFurther files (read with name=\"{name}\" and file=<path>): {}", sk.files.join(", ")) };
|
||||
Ok(ToolOutput::text(format!("Skill '{name}' (base directory: {}):\n\n{body}{files}", dir.display())))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -335,7 +335,7 @@ pub async fn run_session(app: Arc<App>, session_id: &str, cancel: CancellationTo
|
||||
let owner = session.owner_id.as_deref().and_then(|id| app.store.user(id).ok().flatten());
|
||||
let tools = available_tools(&app, &agent, owner.as_ref());
|
||||
let req = ChatRequest {
|
||||
system: prompts::with_chat_instructions(prompts::system_prompt(&app, &agent, &root, &cwd, &model_spec, &session.permission_mode, owner.as_ref()), &session.instructions),
|
||||
system: prompts::with_active_skills(&app, prompts::with_chat_instructions(prompts::system_prompt(&app, &agent, &root, &cwd, &model_spec, &session.permission_mode, owner.as_ref()), &session.instructions), &session.skills, &root, &cwd, session.owner_id.as_deref()),
|
||||
messages: history,
|
||||
tools: tools.iter().map(|t| t.def()).collect(),
|
||||
max_tokens,
|
||||
@@ -903,7 +903,7 @@ fn create_child(app: &Arc<App>, ctx: &ToolCtx, agent_name: &str, description: &s
|
||||
telegram_quiet: false,
|
||||
summary: String::new(),
|
||||
color: None,
|
||||
icon: None,
|
||||
icon: None, skills: Vec::new(),
|
||||
};
|
||||
let child = app.save_session(child)?;
|
||||
let msg = Message::new(Role::User, vec![Part::Text { text: prompt }]);
|
||||
|
||||
@@ -0,0 +1,326 @@
|
||||
//! The user's own skills: a folder per skill with `SKILL.md` and further text files, kept in
|
||||
//! `<data>/user-skills/<user id>/<name>/`; created in the UI or imported from a GitHub repository.
|
||||
|
||||
use crate::api::{ApiError, ApiResult, AppState};
|
||||
use crate::prompts::{frontmatter, skill_files, user_skills_dir};
|
||||
use crate::store::User;
|
||||
use axum::extract::{Path, State};
|
||||
use axum::http::StatusCode;
|
||||
use axum::{Extension, Json};
|
||||
use serde::Deserialize;
|
||||
use serde_json::{Value, json};
|
||||
use std::path::PathBuf;
|
||||
|
||||
const MAX_FILES: usize = 100;
|
||||
const MAX_FILE: usize = 200_000;
|
||||
const MAX_TOTAL: usize = 2_000_000;
|
||||
|
||||
fn bad(m: impl Into<String>) -> ApiError {
|
||||
ApiError(StatusCode::BAD_REQUEST, m.into())
|
||||
}
|
||||
|
||||
/// A skill name is a folder name: lowercase letters, digits, `-` and `_`.
|
||||
pub fn valid_name(n: &str) -> bool {
|
||||
!n.is_empty() && n.len() <= 64 && n.chars().all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '-' || c == '_') && !n.starts_with(['-', '_'])
|
||||
}
|
||||
|
||||
/// Turn any title into a valid skill name.
|
||||
pub fn slug(s: &str) -> String {
|
||||
let mut out = String::new();
|
||||
for c in s.to_lowercase().chars() {
|
||||
if c.is_ascii_alphanumeric() {
|
||||
out.push(c);
|
||||
} else if !out.ends_with('-') && !out.is_empty() {
|
||||
out.push('-');
|
||||
}
|
||||
}
|
||||
out.trim_matches('-').chars().take(64).collect()
|
||||
}
|
||||
|
||||
fn valid_rel(p: &str) -> bool {
|
||||
let rel = std::path::Path::new(p);
|
||||
!p.is_empty() && p.len() <= 200 && !rel.is_absolute() && rel.components().all(|c| matches!(c, std::path::Component::Normal(_)))
|
||||
}
|
||||
|
||||
fn dir_of(app: &AppState, user: &User, name: &str) -> Result<PathBuf, ApiError> {
|
||||
if !valid_name(name) {
|
||||
return Err(bad("invalid skill name (lowercase letters, digits, - and _)"));
|
||||
}
|
||||
Ok(user_skills_dir(app, &user.id).join(name))
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Clone)]
|
||||
pub struct FileBody {
|
||||
path: String,
|
||||
content: String,
|
||||
}
|
||||
|
||||
/// Replace the files of a skill by `files` (must contain `SKILL.md`).
|
||||
fn write_skill(dir: &std::path::Path, files: &[FileBody]) -> Result<(), ApiError> {
|
||||
if !files.iter().any(|f| f.path == "SKILL.md" && !f.content.trim().is_empty()) {
|
||||
return Err(bad("SKILL.md is required"));
|
||||
}
|
||||
if files.len() > MAX_FILES {
|
||||
return Err(bad(format!("at most {MAX_FILES} files")));
|
||||
}
|
||||
let mut total = 0;
|
||||
for f in files {
|
||||
if !valid_rel(&f.path) {
|
||||
return Err(bad(format!("invalid file path '{}'", f.path)));
|
||||
}
|
||||
if f.content.len() > MAX_FILE {
|
||||
return Err(bad(format!("'{}' is too large (max {} KB)", f.path, MAX_FILE / 1000)));
|
||||
}
|
||||
total += f.content.len();
|
||||
}
|
||||
if total > MAX_TOTAL {
|
||||
return Err(bad("the skill is too large (max 2 MB)"));
|
||||
}
|
||||
let tmp = dir.with_extension("saving");
|
||||
let _ = std::fs::remove_dir_all(&tmp);
|
||||
for f in files {
|
||||
let p = tmp.join(&f.path);
|
||||
if let Some(parent) = p.parent() {
|
||||
std::fs::create_dir_all(parent)?;
|
||||
}
|
||||
std::fs::write(&p, &f.content)?;
|
||||
}
|
||||
let _ = std::fs::remove_dir_all(dir);
|
||||
std::fs::rename(&tmp, dir)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn list(Extension(user): Extension<User>, State(app): State<AppState>) -> ApiResult {
|
||||
let base = user_skills_dir(&app, &user.id);
|
||||
let mut out = Vec::new();
|
||||
for e in std::fs::read_dir(&base).into_iter().flatten().flatten() {
|
||||
let Ok(text) = std::fs::read_to_string(e.path().join("SKILL.md")) else { continue };
|
||||
let (meta, _) = frontmatter(&text);
|
||||
out.push(json!({
|
||||
"name": e.file_name().to_string_lossy(),
|
||||
"description": meta.get("description").cloned().unwrap_or_default(),
|
||||
"files": skill_files(&e.path()),
|
||||
}));
|
||||
}
|
||||
out.sort_by(|a, b| a["name"].as_str().cmp(&b["name"].as_str()));
|
||||
Ok(Json(json!({"skills": out})))
|
||||
}
|
||||
|
||||
pub async fn get(Extension(user): Extension<User>, State(app): State<AppState>, Path(name): Path<String>) -> ApiResult {
|
||||
let dir = dir_of(&app, &user, &name)?;
|
||||
let main = std::fs::read_to_string(dir.join("SKILL.md")).map_err(|_| ApiError(StatusCode::NOT_FOUND, "skill not found".into()))?;
|
||||
let mut files = vec![json!({"path": "SKILL.md", "content": main})];
|
||||
for f in skill_files(&dir) {
|
||||
let content = std::fs::read_to_string(dir.join(&f)).unwrap_or_default();
|
||||
files.push(json!({"path": f, "content": content}));
|
||||
}
|
||||
Ok(Json(json!({"name": name, "files": files})))
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct PutBody {
|
||||
files: Vec<FileBody>,
|
||||
}
|
||||
|
||||
pub async fn put(Extension(user): Extension<User>, State(app): State<AppState>, Path(name): Path<String>, Json(b): Json<PutBody>) -> ApiResult {
|
||||
let dir = dir_of(&app, &user, &name)?;
|
||||
std::fs::create_dir_all(user_skills_dir(&app, &user.id))?;
|
||||
write_skill(&dir, &b.files)?;
|
||||
app.audit(Some(&user), "skill.save", name, "");
|
||||
Ok(Json(json!({"ok": true})))
|
||||
}
|
||||
|
||||
pub async fn delete(Extension(user): Extension<User>, State(app): State<AppState>, Path(name): Path<String>) -> ApiResult {
|
||||
let dir = dir_of(&app, &user, &name)?;
|
||||
if !dir.join("SKILL.md").exists() {
|
||||
return Err(ApiError(StatusCode::NOT_FOUND, "skill not found".into()));
|
||||
}
|
||||
std::fs::remove_dir_all(&dir)?;
|
||||
app.audit(Some(&user), "skill.delete", name, "");
|
||||
Ok(Json(json!({"ok": true})))
|
||||
}
|
||||
|
||||
// --- GitHub import -------------------------------------------------------------------------
|
||||
|
||||
struct Source {
|
||||
owner: String,
|
||||
repo: String,
|
||||
branch: Option<String>,
|
||||
sub: String,
|
||||
}
|
||||
|
||||
/// `https://github.com/<owner>/<repo>[/tree|blob/<branch>[/<path>]]`
|
||||
fn parse_github(url: &str) -> Result<Source, ApiError> {
|
||||
let rest = url.trim().strip_prefix("https://github.com/").ok_or_else(|| bad("only https://github.com/… URLs are supported"))?;
|
||||
let rest = rest.split(['?', '#']).next().unwrap_or("").trim_end_matches('/');
|
||||
let mut it = rest.split('/');
|
||||
let (Some(owner), Some(repo)) = (it.next().filter(|s| !s.is_empty()), it.next().map(|r| r.trim_end_matches(".git")).filter(|s| !s.is_empty())) else {
|
||||
return Err(bad("not a repository URL"));
|
||||
};
|
||||
let (mut branch, mut sub) = (None, String::new());
|
||||
if matches!(it.next(), Some("tree") | Some("blob")) {
|
||||
branch = it.next().map(str::to_string);
|
||||
sub = it.collect::<Vec<_>>().join("/");
|
||||
if sub.ends_with("SKILL.md") {
|
||||
sub = sub.trim_end_matches("SKILL.md").trim_end_matches('/').to_string();
|
||||
}
|
||||
}
|
||||
let ok = |s: &str| s.chars().all(|c| c.is_ascii_alphanumeric() || matches!(c, '-' | '_' | '.'));
|
||||
if !ok(owner) || !ok(repo) {
|
||||
return Err(bad("not a repository URL"));
|
||||
}
|
||||
Ok(Source { owner: owner.into(), repo: repo.into(), branch, sub })
|
||||
}
|
||||
|
||||
fn client() -> Result<reqwest::Client, ApiError> {
|
||||
reqwest::Client::builder().timeout(std::time::Duration::from_secs(30)).user_agent("codecraft-skill-import").build().map_err(|e| bad(e.to_string()))
|
||||
}
|
||||
|
||||
/// Blobs (path, size) of the repository below `src.sub`, and the resolved branch.
|
||||
async fn tree(c: &reqwest::Client, src: &Source) -> Result<(String, Vec<(String, u64)>), ApiError> {
|
||||
let branch = match &src.branch {
|
||||
Some(b) => b.clone(),
|
||||
None => {
|
||||
let v: Value = c.get(format!("https://api.github.com/repos/{}/{}", src.owner, src.repo)).send().await.map_err(|e| bad(e.to_string()))?.json().await.map_err(|e| bad(e.to_string()))?;
|
||||
v["default_branch"].as_str().ok_or_else(|| bad("repository not found (is it public?)"))?.to_string()
|
||||
}
|
||||
};
|
||||
let r = c.get(format!("https://api.github.com/repos/{}/{}/git/trees/{branch}?recursive=1", src.owner, src.repo)).send().await.map_err(|e| bad(e.to_string()))?;
|
||||
if !r.status().is_success() {
|
||||
return Err(bad(format!("GitHub answered {} (repository or branch not found, or rate limit)", r.status())));
|
||||
}
|
||||
let v: Value = r.json().await.map_err(|e| bad(e.to_string()))?;
|
||||
let prefix = if src.sub.is_empty() { String::new() } else { format!("{}/", src.sub) };
|
||||
let blobs = v["tree"]
|
||||
.as_array()
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.filter(|e| e["type"] == "blob")
|
||||
.filter_map(|e| Some((e["path"].as_str()?.to_string(), e["size"].as_u64().unwrap_or(0))))
|
||||
.filter(|(p, _)| prefix.is_empty() || p.starts_with(&prefix))
|
||||
.collect();
|
||||
Ok((branch, blobs))
|
||||
}
|
||||
|
||||
/// Folders that contain a `SKILL.md` (path relative to the repository root; "" = the root itself).
|
||||
fn skill_dirs(blobs: &[(String, u64)]) -> Vec<String> {
|
||||
let mut v: Vec<String> = blobs
|
||||
.iter()
|
||||
.filter_map(|(p, _)| if p == "SKILL.md" { Some(String::new()) } else { p.strip_suffix("/SKILL.md").map(str::to_string) })
|
||||
.collect();
|
||||
v.sort();
|
||||
v.truncate(1000);
|
||||
v
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct ScanBody {
|
||||
url: String,
|
||||
}
|
||||
|
||||
/// List the skills found at a GitHub URL (nothing is imported).
|
||||
pub async fn scan(Extension(_user): Extension<User>, Json(b): Json<ScanBody>) -> ApiResult {
|
||||
let src = parse_github(&b.url)?;
|
||||
let c = client()?;
|
||||
let (branch, blobs) = tree(&c, &src).await?;
|
||||
let dirs = skill_dirs(&blobs);
|
||||
let list: Vec<Value> = dirs
|
||||
.iter()
|
||||
.map(|d| {
|
||||
let name = d.rsplit('/').next().filter(|n| !n.is_empty()).unwrap_or(&src.repo);
|
||||
let n = blobs.iter().filter(|(p, _)| d.is_empty() || p.starts_with(&format!("{d}/"))).count();
|
||||
json!({"path": d, "name": slug(name), "files": n})
|
||||
})
|
||||
.collect();
|
||||
Ok(Json(json!({"branch": branch, "skills": list})))
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct ImportBody {
|
||||
url: String,
|
||||
/// Folders (as listed by `scan`).
|
||||
paths: Vec<String>,
|
||||
}
|
||||
|
||||
const BINARY: &[&str] = &["png", "jpg", "jpeg", "gif", "webp", "ico", "pdf", "zip", "gz", "tar", "woff", "woff2", "ttf", "otf", "mp4", "mov", "mp3", "wav", "pyc", "so", "bin", "exe"];
|
||||
|
||||
/// Fetch the chosen skills of a GitHub repository and save them as the user's own skills.
|
||||
pub async fn import(Extension(user): Extension<User>, State(app): State<AppState>, Json(b): Json<ImportBody>) -> ApiResult {
|
||||
if b.paths.is_empty() || b.paths.len() > 100 {
|
||||
return Err(bad("choose between 1 and 100 skills"));
|
||||
}
|
||||
let src = parse_github(&b.url)?;
|
||||
let c = client()?;
|
||||
let (branch, blobs) = tree(&c, &src).await?;
|
||||
let known = skill_dirs(&blobs);
|
||||
std::fs::create_dir_all(user_skills_dir(&app, &user.id))?;
|
||||
let (mut saved, mut skipped) = (Vec::new(), Vec::new());
|
||||
for d in &b.paths {
|
||||
if !known.contains(d) {
|
||||
skipped.push(json!({"path": d, "why": "no SKILL.md there"}));
|
||||
continue;
|
||||
}
|
||||
let name = slug(d.rsplit('/').next().filter(|n| !n.is_empty()).unwrap_or(&src.repo));
|
||||
if !valid_name(&name) {
|
||||
skipped.push(json!({"path": d, "why": "no usable name"}));
|
||||
continue;
|
||||
}
|
||||
let prefix = if d.is_empty() { String::new() } else { format!("{d}/") };
|
||||
let mut files = Vec::new();
|
||||
let mut dropped = 0;
|
||||
for (p, size) in blobs.iter().filter(|(p, _)| p.starts_with(&prefix)) {
|
||||
let rel = &p[prefix.len()..];
|
||||
let ext = rel.rsplit('.').next().unwrap_or("").to_lowercase();
|
||||
if rel.is_empty() || !valid_rel(rel) || *size as usize > MAX_FILE || BINARY.contains(&ext.as_str()) || files.len() >= MAX_FILES || rel.starts_with(".git") {
|
||||
dropped += 1;
|
||||
continue;
|
||||
}
|
||||
// A skill at the repository root: only Markdown files, not the whole repository.
|
||||
if d.is_empty() && rel != "SKILL.md" && !rel.ends_with(".md") {
|
||||
dropped += 1;
|
||||
continue;
|
||||
}
|
||||
let url = format!("https://raw.githubusercontent.com/{}/{}/{branch}/{p}", src.owner, src.repo);
|
||||
let Ok(r) = c.get(&url).send().await else { dropped += 1; continue };
|
||||
if !r.status().is_success() {
|
||||
dropped += 1;
|
||||
continue;
|
||||
}
|
||||
match r.text().await {
|
||||
Ok(content) => files.push(FileBody { path: rel.to_string(), content }),
|
||||
Err(_) => dropped += 1,
|
||||
}
|
||||
}
|
||||
match write_skill(&user_skills_dir(&app, &user.id).join(&name), &files) {
|
||||
Ok(()) => saved.push(json!({"name": name, "files": files.len(), "dropped": dropped})),
|
||||
Err(e) => skipped.push(json!({"path": d, "why": e.1})),
|
||||
}
|
||||
}
|
||||
app.audit(Some(&user), "skill.import", format!("{}/{}: {} skills", src.owner, src.repo, saved.len()), "");
|
||||
Ok(Json(json!({"saved": saved, "skipped": skipped})))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn names_and_urls() {
|
||||
assert!(valid_name("frontend-design"));
|
||||
assert!(!valid_name("../x") && !valid_name("Front") && !valid_name(""));
|
||||
assert_eq!(slug("Frontend Design!"), "frontend-design");
|
||||
let s = parse_github("https://github.com/o/r/blob/main/.claude/skills/frontend/SKILL.md").ok().unwrap();
|
||||
assert_eq!((s.owner.as_str(), s.repo.as_str(), s.branch.as_deref(), s.sub.as_str()), ("o", "r", Some("main"), ".claude/skills/frontend"));
|
||||
let s = parse_github("https://github.com/o/r.git").ok().unwrap();
|
||||
assert!(s.branch.is_none() && s.sub.is_empty());
|
||||
assert!(parse_github("https://example.org/o/r").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn finds_skill_folders() {
|
||||
let b = |p: &str| (p.to_string(), 10u64);
|
||||
let dirs = skill_dirs(&[b("a/SKILL.md"), b("a/ref.md"), b("x/y/SKILL.md"), b("README.md")]);
|
||||
assert_eq!(dirs, vec!["a".to_string(), "x/y".to_string()]);
|
||||
assert!(valid_rel("ref/a.md") && !valid_rel("../a") && !valid_rel("/etc/passwd"));
|
||||
}
|
||||
}
|
||||
@@ -543,7 +543,7 @@ async fn new_session(app: &Arc<App>, u: &User, bot: &Bot, chat: i64, arg: &str,
|
||||
telegram_quiet: false,
|
||||
summary: String::new(),
|
||||
color: None,
|
||||
icon: None,
|
||||
icon: None, skills: Vec::new(),
|
||||
})?;
|
||||
update(app, &u.id, |st| st.session = Some(s.id.clone()));
|
||||
bot.send(chat, &format!("{} <b>{}</b> · {} · {}", tr(de, "Neue Sitzung", "New session"), esc(&s.cwd), esc(&s.agent), esc(&s.model)), None).await?;
|
||||
|
||||
@@ -36,6 +36,23 @@ export function App() {
|
||||
const [info, setInfo] = useState<Info>();
|
||||
const [error, setError] = useState<string>();
|
||||
const [menuOpen, setMenuOpen] = useState(false);
|
||||
// Wide screens: the chat list can be folded away (remembered); narrow screens use the slide-in drawer.
|
||||
const [folded, setFolded] = useState(() => {
|
||||
try {
|
||||
return localStorage.getItem("codecraft.sidebarFolded") === "1";
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
const openMenu = () => {
|
||||
if (window.matchMedia("(max-width: 800px)").matches) return setMenuOpen(true);
|
||||
setFolded((f) => {
|
||||
try {
|
||||
localStorage.setItem("codecraft.sidebarFolded", f ? "0" : "1");
|
||||
} catch {}
|
||||
return !f;
|
||||
});
|
||||
};
|
||||
const [shared, setShared] = useState(pendingShare);
|
||||
const offline = useStore((s) => s.offline);
|
||||
useTitleActivity();
|
||||
@@ -98,40 +115,40 @@ export function App() {
|
||||
const [section, arg] = route;
|
||||
let content;
|
||||
const chatIds = section === "s" && arg ? arg.split("+").filter(Boolean).slice(0, MAX_PANES) : [];
|
||||
if (chatIds.length === 1) content = <ChatView key={chatIds[0]} sessionId={chatIds[0]} onMenu={() => setMenuOpen(true)} />;
|
||||
if (chatIds.length === 1) content = <ChatView key={chatIds[0]} sessionId={chatIds[0]} onMenu={openMenu} />;
|
||||
else if (chatIds.length > 1)
|
||||
content = (
|
||||
<div className="split-view">
|
||||
{chatIds.map((id) => (
|
||||
<div key={id} className="split-pane">
|
||||
<ChatView sessionId={id} onMenu={() => setMenuOpen(true)} onClosePane={() => closePane(id)} />
|
||||
<ChatView sessionId={id} onMenu={openMenu} onClosePane={() => closePane(id)} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
else if (section === "settings") content = <Settings tab={arg} onMenu={() => setMenuOpen(true)} />;
|
||||
else if (section === "p" && arg) content = <ProjectPage key={arg} cwd={decodeURIComponent(arg)} onMenu={() => setMenuOpen(true)} />;
|
||||
else if (section === "factory") content = <Factory onMenu={() => setMenuOpen(true)} />;
|
||||
else if (section === "stats") content = <Stats onMenu={() => setMenuOpen(true)} />;
|
||||
else if (section === "images") content = <Images onMenu={() => setMenuOpen(true)} />;
|
||||
else if (section === "jobs" && arg) content = <JobEditor key={arg} id={arg} onMenu={() => setMenuOpen(true)} />;
|
||||
else if (section === "jobs") content = <Jobs onMenu={() => setMenuOpen(true)} />;
|
||||
else if (section === "settings") content = <Settings tab={arg} onMenu={openMenu} />;
|
||||
else if (section === "p" && arg) content = <ProjectPage key={arg} cwd={decodeURIComponent(arg)} onMenu={openMenu} />;
|
||||
else if (section === "factory") content = <Factory onMenu={openMenu} />;
|
||||
else if (section === "stats") content = <Stats onMenu={openMenu} />;
|
||||
else if (section === "images") content = <Images onMenu={openMenu} />;
|
||||
else if (section === "jobs" && arg) content = <JobEditor key={arg} id={arg} onMenu={openMenu} />;
|
||||
else if (section === "jobs") content = <Jobs onMenu={openMenu} />;
|
||||
else if (section === "terminal")
|
||||
content = (
|
||||
<Suspense fallback={<div className="empty"><Spinner /></div>}>
|
||||
<TerminalPage id={arg} onMenu={() => setMenuOpen(true)} />
|
||||
<TerminalPage id={arg} onMenu={openMenu} />
|
||||
</Suspense>
|
||||
);
|
||||
else if (section === "files")
|
||||
content = (
|
||||
<Suspense fallback={<div className="empty"><Spinner /></div>}>
|
||||
<Files onMenu={() => setMenuOpen(true)} />
|
||||
<Files onMenu={openMenu} />
|
||||
</Suspense>
|
||||
);
|
||||
else content = <NewSession onMenu={() => setMenuOpen(true)} onCreated={(id) => navigate(`/s/${id}`)} />;
|
||||
else content = <NewSession onMenu={openMenu} onCreated={(id) => navigate(`/s/${id}`)} />;
|
||||
|
||||
return (
|
||||
<div className="app">
|
||||
<div className={`app ${folded ? "side-folded" : ""}`}>
|
||||
{menuOpen && <div className="backdrop" onClick={() => setMenuOpen(false)} />}
|
||||
<Sidebar open={menuOpen} activeIds={chatIds} section={section ?? ""} />
|
||||
<main className="main">
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
import { useState } from "react";
|
||||
import { patch } from "../api";
|
||||
import { toast } from "../dialogs";
|
||||
import { useFetch } from "../hooks";
|
||||
import { useT } from "../i18n";
|
||||
import { Spinner } from "./Activity";
|
||||
import { Icon } from "./Icon";
|
||||
|
||||
interface SkillInfo {
|
||||
name: string;
|
||||
description: string;
|
||||
files: string[];
|
||||
user?: boolean;
|
||||
}
|
||||
|
||||
/** Switch skills on for one chat: their full instructions go into every turn. */
|
||||
export function ChatSkillsDialog({ sessionId, cwd, active, onClose }: { sessionId: string; cwd: string; active: string[]; onClose: () => void }) {
|
||||
const t = useT();
|
||||
const { data } = useFetch<{ skills: SkillInfo[] }>(`/commands?cwd=${encodeURIComponent(cwd)}`);
|
||||
const [picked, setPicked] = useState<string[]>(active);
|
||||
const [filter, setFilter] = useState("");
|
||||
const [busy, setBusy] = useState(false);
|
||||
const all = data?.skills ?? [];
|
||||
// Chosen skills first, then the rest.
|
||||
const shown = all
|
||||
.filter((s) => !filter.trim() || `${s.name} ${s.description}`.toLowerCase().includes(filter.trim().toLowerCase()))
|
||||
.sort((a, b) => Number(picked.includes(b.name)) - Number(picked.includes(a.name)) || a.name.localeCompare(b.name));
|
||||
const toggle = (n: string) => setPicked((p) => (p.includes(n) ? p.filter((x) => x !== n) : [...p, n]));
|
||||
const save = async () => {
|
||||
setBusy(true);
|
||||
try {
|
||||
await patch(`/sessions/${sessionId}`, { skills: picked });
|
||||
onClose();
|
||||
} catch (e: any) {
|
||||
toast(e.message);
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="modal-backdrop" onClick={onClose}>
|
||||
<div className="modal draft-modal" role="dialog" aria-label={t("skills.chatTitle")} onClick={(e) => e.stopPropagation()}>
|
||||
<h3>{t("skills.chatTitle")}</h3>
|
||||
<div className="hint" style={{ marginBottom: 8 }}>
|
||||
{t("skills.chatHint")}
|
||||
</div>
|
||||
{!data ? (
|
||||
<Spinner />
|
||||
) : all.length === 0 ? (
|
||||
<div className="empty">{t("skills.empty")}</div>
|
||||
) : (
|
||||
<>
|
||||
{all.length > 6 && <input autoFocus style={{ width: "100%" }} placeholder={t("skills.filter")} value={filter} onChange={(e) => setFilter(e.target.value)} />}
|
||||
<div className="issue-list">
|
||||
{shown.map((s) => (
|
||||
<label key={s.name} className="row" style={{ gap: 8, alignItems: "flex-start", padding: "2px 0" }}>
|
||||
<input type="checkbox" checked={picked.includes(s.name)} onChange={() => toggle(s.name)} />
|
||||
<span>
|
||||
<code>{s.name}</code>
|
||||
{s.files.length > 0 && <span className="hint"> · {t("skills.files", { n: s.files.length })}</span>}
|
||||
<div className="hint">{s.description}</div>
|
||||
</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
{picked.length > 4 && <div className="notice">{t("skills.manyActive")}</div>}
|
||||
</>
|
||||
)}
|
||||
<div className="row" style={{ marginTop: 10, justifyContent: "flex-end", gap: 6 }}>
|
||||
<button onClick={onClose} disabled={busy}>
|
||||
{t("common.cancel")}
|
||||
</button>
|
||||
<button className="primary" onClick={() => void save()} disabled={busy}>
|
||||
{busy ? <Spinner small /> : <Icon name="check" />} {t("common.save")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import { Composer } from "./Composer";
|
||||
import { ShareDialog } from "./ShareDialog";
|
||||
import { RenameDialog } from "./RenameDialog";
|
||||
import { InstructionsDialog } from "./InstructionsDialog";
|
||||
import { ChatSkillsDialog } from "./ChatSkills";
|
||||
import { RegenerateButton } from "./Regenerate";
|
||||
import { WorktreeChip } from "./WorktreeChip";
|
||||
import { QueueList } from "./QueueList";
|
||||
@@ -565,6 +566,7 @@ export function ChatView({ sessionId, onMenu, onClosePane }: { sessionId: string
|
||||
// The Telegram switch in the ⋯ menu only matters with a paired bot.
|
||||
const telegramPaired = useFetch<{ paired: boolean }>("/account/telegram").data?.paired ?? false;
|
||||
const [editingInstructions, setEditingInstructions] = useState(false);
|
||||
const [pickingSkills, setPickingSkills] = useState(false);
|
||||
const [showApprovals, setShowApprovals] = useState(false);
|
||||
const [planning, setPlanning] = useState(false);
|
||||
const models = useModels();
|
||||
@@ -823,6 +825,11 @@ export function ChatView({ sessionId, onMenu, onClosePane }: { sessionId: string
|
||||
<Icon name="edit" /> {t("instructions.chip")}
|
||||
</button>
|
||||
)}
|
||||
{!!session.skills?.length && (
|
||||
<button className="chip" style={{ border: "none" }} onClick={() => !readOnly && setPickingSkills(true)} title={session.skills.join(", ")}>
|
||||
<Icon name="scroll" /> {t("skills.chip", { n: session.skills.length })}
|
||||
</button>
|
||||
)}
|
||||
{readOnly && <span className="chip">{t("chat.readOnly")}</span>}
|
||||
{!readOnly && (
|
||||
<>
|
||||
@@ -886,6 +893,16 @@ export function ChatView({ sessionId, onMenu, onClosePane }: { sessionId: string
|
||||
>
|
||||
<Icon name="edit" /> {t("instructions.title")}
|
||||
</a>
|
||||
<a
|
||||
href="#"
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
(e.currentTarget.closest("details") as HTMLDetailsElement).open = false;
|
||||
setPickingSkills(true);
|
||||
}}
|
||||
>
|
||||
<Icon name="scroll" /> {t("skills.chatTitle")}
|
||||
</a>
|
||||
<ColorSwatches value={session.color} onChange={(color) => void update({ color })} />
|
||||
<IconPicker value={session.icon} color={session.color} onChange={(icon) => void update({ icon })} />
|
||||
<a href="#" onClick={(e) => (e.preventDefault(), ((e.currentTarget.closest("details") as HTMLDetailsElement).open = false), void planJob())} title={t("job.planHint")}>
|
||||
@@ -1086,6 +1103,7 @@ export function ChatView({ sessionId, onMenu, onClosePane }: { sessionId: string
|
||||
)}
|
||||
</div>
|
||||
{showApprovals && <ProjectPermissions sessionId={sessionId} cwd={session.cwd} onClose={() => setShowApprovals(false)} />}
|
||||
{pickingSkills && <ChatSkillsDialog sessionId={sessionId} cwd={session.cwd} active={session.skills ?? []} onClose={() => setPickingSkills(false)} />}
|
||||
{editingInstructions && <InstructionsDialog sessionId={sessionId} value={session.instructions ?? ""} onClose={() => setEditingInstructions(false)} />}
|
||||
{editingTitle && <RenameDialog sessionId={sessionId} title={session.title} onClose={() => setEditingTitle(false)} />}
|
||||
{sharing && <ShareDialog sessionId={sessionId} onClose={() => setSharing(false)} />}
|
||||
|
||||
@@ -30,6 +30,7 @@ interface PhaseCfg {
|
||||
timeout_minutes: number;
|
||||
max_attempts: number;
|
||||
extra_prompt: string;
|
||||
skills: string[];
|
||||
}
|
||||
interface RepoCfg {
|
||||
url: string;
|
||||
@@ -575,11 +576,46 @@ function FactoryOverview({ onSettings }: { onSettings: () => void }) {
|
||||
);
|
||||
}
|
||||
|
||||
const blankPhase = (): PhaseCfg => ({ model: "", agent: "codecraft", permission_mode: "auto", timeout_minutes: 60, max_attempts: 2, extra_prompt: "" });
|
||||
const blankPhase = (): PhaseCfg => ({ model: "", agent: "codecraft", permission_mode: "auto", timeout_minutes: 60, max_attempts: 2, extra_prompt: "", skills: [] });
|
||||
const blankRepo = (connection = "", kind = "gitea"): RepoCfg => ({ url: "", kind, connection, token: "", label: "factory", max_parallel: 1, max_rework: 2, allowed_users: [], enabled: true, review: blankPhase(), build: blankPhase(), qa: blankPhase() });
|
||||
const blankConn = (): Connection => ({ id: "", name: "", kind: "gitea", url: "", token: "", owner: "" });
|
||||
const MODES = ["default", "auto", "accept_edits", "bypass"];
|
||||
|
||||
/** Skills switched on for the chat of one phase (the agent follows them in every turn). */
|
||||
function PhaseSkills({ value, onChange }: { value: string[]; onChange: (v: string[]) => void }) {
|
||||
const t = useT();
|
||||
const [all, setAll] = useState<{ name: string; description: string }[]>([]);
|
||||
useEffect(() => {
|
||||
get<{ skills: { name: string; description: string }[] }>("/commands")
|
||||
.then((d) => setAll(d.skills))
|
||||
.catch(() => {});
|
||||
}, []);
|
||||
const rest = all.filter((s) => !value.includes(s.name));
|
||||
return (
|
||||
<div className="factory-skills">
|
||||
<span>{t("factory.skills")}</span>
|
||||
<div className="row" style={{ gap: 4, flexWrap: "wrap" }}>
|
||||
{value.map((n) => (
|
||||
<button key={n} type="button" className="chip" style={{ border: "none" }} title={t("factory.skillRemove")} onClick={() => onChange(value.filter((x) => x !== n))}>
|
||||
{n} ×
|
||||
</button>
|
||||
))}
|
||||
{rest.length > 0 && value.length < 10 && (
|
||||
<select value="" onChange={(e) => e.target.value && onChange([...value, e.target.value])}>
|
||||
<option value="">{t("factory.skillAdd")}</option>
|
||||
{rest.map((s) => (
|
||||
<option key={s.name} value={s.name} title={s.description}>
|
||||
{s.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
)}
|
||||
</div>
|
||||
<div className="hint">{t("factory.skillsHint")}</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function PhaseForm({ phase, value, onChange }: { phase: Phase; value: PhaseCfg; onChange: (patch: Partial<PhaseCfg>) => void }) {
|
||||
const t = useT();
|
||||
return (
|
||||
@@ -614,6 +650,7 @@ function PhaseForm({ phase, value, onChange }: { phase: Phase; value: PhaseCfg;
|
||||
<span>{t("factory.attempts")}</span>
|
||||
<input type="number" min={1} max={10} value={value.max_attempts} title={t("factory.attemptsHint")} onChange={(e) => onChange({ max_attempts: Math.max(1, Number(e.target.value) || 1) })} />
|
||||
</label>
|
||||
<PhaseSkills value={value.skills ?? []} onChange={(skills) => onChange({ skills })} />
|
||||
<label>
|
||||
<span>{t("factory.extraPrompt")}</span>
|
||||
<textarea rows={3} value={value.extra_prompt} onChange={(e) => onChange({ extra_prompt: e.target.value })} />
|
||||
|
||||
@@ -193,7 +193,7 @@ export function NewSession({ onMenu, onCreated }: { onMenu: () => void; onCreate
|
||||
if (!model && config?.default_model) setModel(config.default_model);
|
||||
}, [config, model]);
|
||||
useEffect(() => {
|
||||
if (!rootPath && roots.length) setRootPath(roots[roots.length - 1].path);
|
||||
if (!rootPath && roots.length) setRootPath(roots[0].path);
|
||||
}, [roots, rootPath]);
|
||||
// Old software is analysed in deep mode; websites default to clean room.
|
||||
useEffect(() => {
|
||||
|
||||
@@ -18,6 +18,7 @@ import { Folders } from "./settings/Folders";
|
||||
import { Users } from "./settings/Users";
|
||||
import { Audit } from "./settings/Audit";
|
||||
import { Tools } from "./settings/Tools";
|
||||
import { Skills } from "./settings/Skills";
|
||||
import { confirmDialog, promptDialog, toast } from "../dialogs";
|
||||
|
||||
type Json = any;
|
||||
@@ -1088,8 +1089,8 @@ function Raw({ reload }: { reload: () => void }) {
|
||||
|
||||
// --- page -------------------------------------------------------------------
|
||||
|
||||
const ADMIN_TABS = ["general", "providers", "agents", "mcp", "permissions", "users", "folders", "tools", "audit", "templates", "modes", "account", "raw"] as const;
|
||||
const USER_TABS = ["general", "templates", "modes", "account"] as const;
|
||||
const ADMIN_TABS = ["general", "providers", "agents", "mcp", "permissions", "users", "folders", "tools", "audit", "templates", "modes", "skills", "account", "raw"] as const;
|
||||
const USER_TABS = ["general", "templates", "modes", "skills", "account"] as const;
|
||||
const TAB_ICONS: Record<string, string> = {
|
||||
general: "gear",
|
||||
providers: "brain",
|
||||
@@ -1102,6 +1103,7 @@ const TAB_ICONS: Record<string, string> = {
|
||||
audit: "scroll",
|
||||
templates: "template",
|
||||
modes: "sparkle",
|
||||
skills: "scroll",
|
||||
account: "user",
|
||||
raw: "file-text",
|
||||
};
|
||||
@@ -1139,6 +1141,7 @@ export function Settings({ tab, onMenu }: { tab?: string; onMenu: () => void })
|
||||
{active === "account" && <Account />}
|
||||
{active === "templates" && <Templates />}
|
||||
{active === "modes" && <PersonalModes />}
|
||||
{active === "skills" && <Skills />}
|
||||
{cfg && active === "users" && <Users />}
|
||||
{cfg && active === "folders" && <Folders />}
|
||||
{cfg && active === "audit" && <Audit />}
|
||||
|
||||
@@ -0,0 +1,290 @@
|
||||
import { useState } from "react";
|
||||
import { del, get, post, put } from "../../api";
|
||||
import { confirmDialog, promptDialog, toast } from "../../dialogs";
|
||||
import { useFetch } from "../../hooks";
|
||||
import { useT } from "../../i18n";
|
||||
import { Icon } from "../Icon";
|
||||
import { Spinner } from "../Activity";
|
||||
|
||||
interface SkillInfo {
|
||||
name: string;
|
||||
description: string;
|
||||
files: string[];
|
||||
}
|
||||
interface SkillFile {
|
||||
path: string;
|
||||
content: string;
|
||||
}
|
||||
|
||||
const TEMPLATE = `---
|
||||
name: my-skill
|
||||
description: When to use this skill, in one or two sentences
|
||||
---
|
||||
|
||||
# Instructions
|
||||
|
||||
Describe what the agent should do.
|
||||
`;
|
||||
|
||||
/** The user's own skills: SKILL.md plus further files; created here or imported from GitHub. */
|
||||
export function Skills() {
|
||||
const t = useT();
|
||||
const { data, reload } = useFetch<{ skills: SkillInfo[] }>("/skills");
|
||||
const [editing, setEditing] = useState<{ name: string; isNew: boolean }>();
|
||||
const [importing, setImporting] = useState(false);
|
||||
const [filter, setFilter] = useState("");
|
||||
const list = (data?.skills ?? []).filter((s) => !filter.trim() || `${s.name} ${s.description}`.toLowerCase().includes(filter.trim().toLowerCase()));
|
||||
|
||||
const remove = async (s: SkillInfo) => {
|
||||
if (!(await confirmDialog({ message: t("skills.confirmDelete", { name: s.name }), danger: true }))) return;
|
||||
try {
|
||||
await del(`/skills/${s.name}`);
|
||||
reload();
|
||||
} catch (e: any) {
|
||||
toast(e.message);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="panel">
|
||||
<h3>
|
||||
<Icon name="sparkle" /> {t("skills.title")}
|
||||
</h3>
|
||||
<div className="hint" style={{ marginBottom: 8 }}>
|
||||
{t("skills.hint")}
|
||||
</div>
|
||||
<div className="row" style={{ gap: 6, marginBottom: 8 }}>
|
||||
<button className="primary" onClick={() => setEditing({ name: "", isNew: true })}>
|
||||
<Icon name="plus" /> {t("skills.new")}
|
||||
</button>
|
||||
<button onClick={() => setImporting(true)}>
|
||||
<Icon name="git" /> {t("skills.import")}
|
||||
</button>
|
||||
<span className="spacer" />
|
||||
{(data?.skills.length ?? 0) > 8 && <input placeholder={t("skills.filter")} value={filter} onChange={(e) => setFilter(e.target.value)} />}
|
||||
</div>
|
||||
{!data ? (
|
||||
<Spinner />
|
||||
) : list.length === 0 ? (
|
||||
<div className="empty">{t("skills.empty")}</div>
|
||||
) : (
|
||||
list.map((s) => (
|
||||
<div key={s.name} className="row" style={{ gap: 8, padding: "6px 0", borderBottom: "1px solid var(--border)" }}>
|
||||
<div style={{ flex: 1, minWidth: 0 }}>
|
||||
<code>{s.name}</code>
|
||||
{s.files.length > 0 && <span className="chip" style={{ marginLeft: 6 }}>{t("skills.files", { n: s.files.length })}</span>}
|
||||
<div className="hint" style={{ overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
|
||||
{s.description}
|
||||
</div>
|
||||
</div>
|
||||
<button className="small" onClick={() => setEditing({ name: s.name, isNew: false })}>
|
||||
<Icon name="edit" /> {t("common.edit")}
|
||||
</button>
|
||||
<button className="small danger" onClick={() => void remove(s)} aria-label={t("common.delete")}>
|
||||
<Icon name="trash" />
|
||||
</button>
|
||||
</div>
|
||||
))
|
||||
)}
|
||||
{editing && (
|
||||
<SkillEditor
|
||||
name={editing.name}
|
||||
isNew={editing.isNew}
|
||||
onClose={(saved) => {
|
||||
setEditing(undefined);
|
||||
if (saved) reload();
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{importing && (
|
||||
<ImportDialog
|
||||
onClose={(done) => {
|
||||
setImporting(false);
|
||||
if (done) reload();
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function SkillEditor({ name: initial, isNew, onClose }: { name: string; isNew: boolean; onClose: (saved: boolean) => void }) {
|
||||
const t = useT();
|
||||
const [name, setName] = useState(initial);
|
||||
const [files, setFiles] = useState<SkillFile[]>(isNew ? [{ path: "SKILL.md", content: TEMPLATE }] : []);
|
||||
const [loaded, setLoaded] = useState(isNew);
|
||||
const [current, setCurrent] = useState("SKILL.md");
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState<string>();
|
||||
|
||||
useState(() => {
|
||||
if (!isNew)
|
||||
get<{ files: SkillFile[] }>(`/skills/${initial}`)
|
||||
.then((d) => (setFiles(d.files), setLoaded(true)))
|
||||
.catch((e) => (setError(e.message), setLoaded(true)));
|
||||
});
|
||||
|
||||
const file = files.find((f) => f.path === current) ?? files[0];
|
||||
const setContent = (content: string) => setFiles(files.map((f) => (f.path === file?.path ? { ...f, content } : f)));
|
||||
const addFile = async () => {
|
||||
const p = await promptDialog({ message: t("skills.addFile"), placeholder: "references/guide.md", confirmLabel: t("common.add") });
|
||||
const path = p?.trim().replace(/^\/+/, "");
|
||||
if (!path) return;
|
||||
if (files.some((f) => f.path === path)) return setCurrent(path);
|
||||
setFiles([...files, { path, content: "" }]);
|
||||
setCurrent(path);
|
||||
};
|
||||
const removeFile = () => {
|
||||
if (!file || file.path === "SKILL.md") return;
|
||||
setFiles(files.filter((f) => f.path !== file.path));
|
||||
setCurrent("SKILL.md");
|
||||
};
|
||||
const save = async () => {
|
||||
setBusy(true);
|
||||
setError(undefined);
|
||||
try {
|
||||
await put(`/skills/${name.trim()}`, { files });
|
||||
onClose(true);
|
||||
} catch (e: any) {
|
||||
setError(e.message);
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="modal-backdrop">
|
||||
<div className="modal draft-modal" role="dialog" aria-label={t("skills.edit")}>
|
||||
<h3>{isNew ? t("skills.new") : t("skills.edit")}</h3>
|
||||
{!loaded ? (
|
||||
<Spinner />
|
||||
) : (
|
||||
<>
|
||||
<label style={{ display: "block", marginBottom: 8 }}>
|
||||
<span className="hint">{t("skills.name")}</span>
|
||||
<input className="mono" style={{ width: "100%" }} value={name} disabled={!isNew} placeholder="frontend" onChange={(e) => setName(e.target.value.toLowerCase().replace(/[^a-z0-9_-]/g, "-"))} />
|
||||
</label>
|
||||
<div className="row" style={{ gap: 4, flexWrap: "wrap", marginBottom: 6 }}>
|
||||
{files.map((f) => (
|
||||
<button key={f.path} className={`small ${f.path === file?.path ? "primary" : ""}`} onClick={() => setCurrent(f.path)}>
|
||||
{f.path}
|
||||
</button>
|
||||
))}
|
||||
<button className="small ghost" onClick={() => void addFile()}>
|
||||
<Icon name="plus" /> {t("skills.file")}
|
||||
</button>
|
||||
{file && file.path !== "SKILL.md" && (
|
||||
<button className="small danger" onClick={removeFile} aria-label={t("common.delete")}>
|
||||
<Icon name="trash" />
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
<textarea className="mono" rows={18} style={{ width: "100%" }} value={file?.content ?? ""} onChange={(e) => setContent(e.target.value)} spellCheck={false} />
|
||||
<div className="hint">{t("skills.fileHint")}</div>
|
||||
</>
|
||||
)}
|
||||
{error && <div className="notice err">{error}</div>}
|
||||
<div className="row" style={{ marginTop: 10, justifyContent: "flex-end", gap: 6 }}>
|
||||
<button onClick={() => onClose(false)} disabled={busy}>
|
||||
{t("common.cancel")}
|
||||
</button>
|
||||
<button className="primary" onClick={() => void save()} disabled={busy || !loaded || !name.trim() || !files.some((f) => f.path === "SKILL.md")}>
|
||||
{busy ? <Spinner small /> : <Icon name="check" />} {t("common.save")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
interface Found {
|
||||
path: string;
|
||||
name: string;
|
||||
files: number;
|
||||
}
|
||||
|
||||
function ImportDialog({ onClose }: { onClose: (done: boolean) => void }) {
|
||||
const t = useT();
|
||||
const [url, setUrl] = useState("");
|
||||
const [found, setFound] = useState<Found[]>();
|
||||
const [picked, setPicked] = useState<Set<string>>(new Set());
|
||||
const [filter, setFilter] = useState("");
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState<string>();
|
||||
|
||||
const scan = async () => {
|
||||
setBusy(true);
|
||||
setError(undefined);
|
||||
try {
|
||||
const r = await post<{ skills: Found[] }>("/skills/github/scan", { url: url.trim() });
|
||||
setFound(r.skills);
|
||||
setPicked(new Set());
|
||||
if (r.skills.length === 0) setError(t("skills.noneFound"));
|
||||
} catch (e: any) {
|
||||
setError(e.message);
|
||||
}
|
||||
setBusy(false);
|
||||
};
|
||||
const shown = (found ?? []).filter((s) => !filter.trim() || s.path.toLowerCase().includes(filter.trim().toLowerCase()));
|
||||
const toggle = (p: string) => setPicked((s) => (s.has(p) ? new Set([...s].filter((x) => x !== p)) : new Set(s).add(p)));
|
||||
const run = async () => {
|
||||
setBusy(true);
|
||||
setError(undefined);
|
||||
try {
|
||||
const r = await post<{ saved: unknown[]; skipped: { path: string; why: string }[] }>("/skills/github/import", { url: url.trim(), paths: [...picked] });
|
||||
toast(t("skills.imported", { n: r.saved.length }) + (r.skipped.length ? ` (${r.skipped.length} ${t("skills.skipped")})` : ""), "success");
|
||||
onClose(true);
|
||||
} catch (e: any) {
|
||||
setError(e.message);
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="modal-backdrop">
|
||||
<div className="modal draft-modal" role="dialog" aria-label={t("skills.import")}>
|
||||
<h3>{t("skills.import")}</h3>
|
||||
<div className="hint" style={{ marginBottom: 8 }}>
|
||||
{t("skills.importHint")}
|
||||
</div>
|
||||
<div className="row" style={{ gap: 6 }}>
|
||||
<input className="mono" style={{ flex: 1 }} value={url} placeholder="https://github.com/owner/repo/tree/main/skills" onChange={(e) => setUrl(e.target.value)} onKeyDown={(e) => e.key === "Enter" && url.trim() && !busy && void scan()} />
|
||||
<button onClick={() => void scan()} disabled={busy || !url.trim()}>
|
||||
{busy && !found ? <Spinner small /> : <Icon name="search" />} {t("skills.scan")}
|
||||
</button>
|
||||
</div>
|
||||
{found && found.length > 0 && (
|
||||
<>
|
||||
<div className="row" style={{ gap: 6, margin: "8px 0" }}>
|
||||
<input style={{ flex: 1 }} placeholder={t("skills.filter")} value={filter} onChange={(e) => setFilter(e.target.value)} />
|
||||
<button className="small" onClick={() => setPicked(new Set([...picked, ...shown.map((s) => s.path)]))}>
|
||||
{t("skills.selectShown", { n: shown.length })}
|
||||
</button>
|
||||
<button className="small ghost" onClick={() => setPicked(new Set())}>
|
||||
{t("skills.selectNone")}
|
||||
</button>
|
||||
</div>
|
||||
<div className="issue-list">
|
||||
{shown.map((s) => (
|
||||
<label key={s.path} className="row" style={{ gap: 8, padding: "2px 0" }}>
|
||||
<input type="checkbox" checked={picked.has(s.path)} onChange={() => toggle(s.path)} />
|
||||
<span>
|
||||
<code>{s.name}</code> <span className="hint">{s.path} · {t("skills.files", { n: s.files })}</span>
|
||||
</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
{error && <div className="notice err">{error}</div>}
|
||||
<div className="row" style={{ marginTop: 10, justifyContent: "flex-end", gap: 6 }}>
|
||||
<button onClick={() => onClose(false)} disabled={busy}>
|
||||
{t("common.cancel")}
|
||||
</button>
|
||||
<button className="primary" onClick={() => void run()} disabled={busy || picked.size === 0}>
|
||||
{busy && found ? <Spinner small /> : <Icon name="check" />} {t("skills.importN", { n: picked.size })}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -774,6 +774,32 @@ export const de: Messages = {
|
||||
"instructions.hint": "Gelten für jede Nachricht in diesem Chat, zusätzlich zum Modus – z. B. Sprache, Ton, Regeln oder der Teil des Projekts, um den es geht.",
|
||||
"instructions.placeholder": "z. B. Antworte immer auf Englisch. Ändere nur Dateien unter api/. Frag, bevor du Abhängigkeiten hinzufügst.",
|
||||
"instructions.clear": "Entfernen",
|
||||
"settings.tab.skills": "Skills",
|
||||
"skills.title": "Skills",
|
||||
"skills.hint": "Ein Skill ist ein Ordner mit SKILL.md (Anweisungen) und weiteren Dateien. Skills schaltest du pro Chat ein (Menü ⋯ → Skills); ihre Anweisungen gelten dann in jeder Runde, alle anderen kosten keinen Kontext. Agenten können außerdem alle Skills per Stichwort suchen und bei Bedarf laden.",
|
||||
"skills.new": "Neuer Skill",
|
||||
"skills.edit": "Skill bearbeiten",
|
||||
"skills.import": "Von GitHub importieren",
|
||||
"skills.importHint": "URL eines Repositorys oder eines Ordners darin einfügen. Jeder Ordner mit SKILL.md wird angeboten; die Textdateien des Skills werden mit importiert. Bei großen Repositorys die URL auf einen Ordner eingrenzen (…/tree/main/engineering).",
|
||||
"skills.scan": "Suchen",
|
||||
"skills.noneFound": "Unter dieser Adresse wurde keine SKILL.md gefunden.",
|
||||
"skills.selectShown": "Angezeigte wählen ({n})",
|
||||
"skills.selectNone": "Keine wählen",
|
||||
"skills.importN": "{n} importieren",
|
||||
"skills.imported": "{n} Skills importiert",
|
||||
"skills.skipped": "übersprungen",
|
||||
"skills.filter": "Filtern…",
|
||||
"skills.empty": "Noch keine Skills.",
|
||||
"skills.files": "Dateien: {n}",
|
||||
"skills.name": "Name (Ordner, Kleinbuchstaben)",
|
||||
"skills.file": "Datei",
|
||||
"skills.addFile": "Pfad der neuen Datei",
|
||||
"skills.fileHint": "SKILL.md beginnt mit einem Kopfblock (name, description); die Beschreibung sagt dem Agenten, wann der Skill passt.",
|
||||
"skills.confirmDelete": "Skill {name} löschen?",
|
||||
"skills.chatTitle": "Skills für diesen Chat",
|
||||
"skills.chatHint": "Eingeschaltete Skills gelten für jede Nachricht dieses Chats. Schalte nur ein, was du brauchst – jeder belegt Kontext.",
|
||||
"skills.manyActive": "Viele aktive Skills belegen viel Kontext.",
|
||||
"skills.chip": "Skills: {n}",
|
||||
"instructions.chip": "Anweisungen",
|
||||
"chat.compacted": "Unterhaltung komprimiert – Zusammenfassung",
|
||||
"chat.context": "Kontext",
|
||||
@@ -1266,6 +1292,10 @@ export const de: Messages = {
|
||||
"factory.closeMsg": "Kommentar zum Schließen von Issue #{n}. Er wird im Issue veröffentlicht, danach wird das Issue geschlossen.",
|
||||
"factory.closeDefault": "Erledigt und abgenommen.",
|
||||
"factory.closed": "Issue geschlossen",
|
||||
"factory.skills": "Skills",
|
||||
"factory.skillAdd": "Skill hinzufügen…",
|
||||
"factory.skillRemove": "Entfernen",
|
||||
"factory.skillsHint": "Für jeden Chat dieser Phase eingeschaltet (CodeCraft-Agent). Jeder belegt Kontext – wenige wählen.",
|
||||
"factory.pr": "Pull Request",
|
||||
"factory.round": "Runde {n}",
|
||||
"factory.openChat": "Chat öffnen",
|
||||
|
||||
@@ -773,6 +773,32 @@ export const en = {
|
||||
"instructions.hint": "Apply to every message in this chat, in addition to the mode – e.g. language, tone, rules, the part of the project to work on.",
|
||||
"instructions.placeholder": "e.g. Always answer in English. Only change files under api/. Ask before adding dependencies.",
|
||||
"instructions.clear": "Remove",
|
||||
"settings.tab.skills": "Skills",
|
||||
"skills.title": "Skills",
|
||||
"skills.hint": "A skill is a folder with SKILL.md (instructions) and further files. Switch skills on per chat (menu ⋯ → Skills) so their instructions are used in every turn; the others cost no context. Agents can also search all skills by keyword and load one when needed.",
|
||||
"skills.new": "New skill",
|
||||
"skills.edit": "Edit skill",
|
||||
"skills.import": "Import from GitHub",
|
||||
"skills.importHint": "Paste the URL of a repository or of a folder in it. Every folder with a SKILL.md is offered; text files of the skill are imported with it. For large repositories, narrow the URL to a folder (…/tree/main/engineering).",
|
||||
"skills.scan": "Search",
|
||||
"skills.noneFound": "No SKILL.md found at this address.",
|
||||
"skills.selectShown": "Select shown ({n})",
|
||||
"skills.selectNone": "Select none",
|
||||
"skills.importN": "Import {n}",
|
||||
"skills.imported": "{n} skills imported",
|
||||
"skills.skipped": "skipped",
|
||||
"skills.filter": "Filter…",
|
||||
"skills.empty": "No skills yet.",
|
||||
"skills.files": "Files: {n}",
|
||||
"skills.name": "Name (folder, lowercase)",
|
||||
"skills.file": "File",
|
||||
"skills.addFile": "Path of the new file",
|
||||
"skills.fileHint": "SKILL.md starts with a front matter block (name, description); the description tells the agent when to use the skill.",
|
||||
"skills.confirmDelete": "Delete the skill {name}?",
|
||||
"skills.chatTitle": "Skills for this chat",
|
||||
"skills.chatHint": "Switched-on skills are part of every message of this chat. Switch on only what you need – each one uses context.",
|
||||
"skills.manyActive": "Many active skills use a lot of context.",
|
||||
"skills.chip": "Skills: {n}",
|
||||
"instructions.chip": "Instructions",
|
||||
"chat.compacted": "Conversation compacted – summary",
|
||||
"chat.context": "Context",
|
||||
@@ -1265,6 +1291,10 @@ export const en = {
|
||||
"factory.closeMsg": "Comment for closing issue #{n}. It is posted on the issue, then the issue is closed.",
|
||||
"factory.closeDefault": "Done and accepted.",
|
||||
"factory.closed": "Issue closed",
|
||||
"factory.skills": "Skills",
|
||||
"factory.skillAdd": "Add skill…",
|
||||
"factory.skillRemove": "Remove",
|
||||
"factory.skillsHint": "Switched on for every chat of this phase (CodeCraft agent). Each one uses context – choose few.",
|
||||
"factory.pr": "Pull request",
|
||||
"factory.round": "round {n}",
|
||||
"factory.openChat": "Open chat",
|
||||
|
||||
@@ -477,8 +477,10 @@ button.session-group:hover {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
.menu-btn {
|
||||
display: none;
|
||||
@media (min-width: 801px) {
|
||||
.app.side-folded .sidebar {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.chip {
|
||||
|
||||
@@ -82,6 +82,8 @@ export interface Session {
|
||||
folder?: string | null;
|
||||
/** Instructions for this chat (added to the system prompt). */
|
||||
instructions?: string;
|
||||
/** Skills switched on for this chat. */
|
||||
skills?: string[];
|
||||
/** Approvals and questions of this chat are not sent to Telegram. */
|
||||
telegram_quiet?: boolean;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,34 @@
|
||||
* under "unreleased"; scripts/release.sh renames the key to the release version.
|
||||
*/
|
||||
export const WHATS_NEW: Record<string, { en: string[]; de: string[] }> = {
|
||||
"202611-00059": {
|
||||
en: ["The chat list can be folded away on wide screens (menu button in the title bar)"],
|
||||
de: ["Die Chatliste lässt sich auf breiten Bildschirmen zuklappen (Menü-Button in der Titelleiste)"],
|
||||
},
|
||||
"202611-00058": {
|
||||
en: ["README and screenshots updated"],
|
||||
de: ["README und Screenshots aktualisiert"],
|
||||
},
|
||||
"202611-00057": {
|
||||
en: ["Factory: choose skills for each phase (review, build, acceptance)"],
|
||||
de: ["Factory: Skills für jede Phase wählbar (Review, Build, Abnahme)"],
|
||||
},
|
||||
"202611-00056": {
|
||||
en: ["Skills: create or import them from GitHub (Settings → Skills) and switch them on per chat; large libraries do not fill the context"],
|
||||
de: ["Skills: selbst anlegen oder von GitHub importieren (Einstellungen → Skills) und pro Chat einschalten; große Bibliotheken füllen den Kontext nicht"],
|
||||
},
|
||||
"202611-00055": {
|
||||
en: ["Fixed: cloning a repository for a new project no longer ends up in the factory area"],
|
||||
de: ["Behoben: Klonen eines Repositorys für ein neues Projekt landet nicht mehr in der Factory-Ablage"],
|
||||
},
|
||||
"202611-00054": {
|
||||
en: ["README: new section explaining the code factory"],
|
||||
de: ["README: neuer Abschnitt zur Code-Factory"],
|
||||
},
|
||||
"202611-00053": {
|
||||
en: ["Factory: the current version is read from the tags on the forge"],
|
||||
de: ["Factory: die aktuelle Version wird aus den Tags im Forge gelesen"],
|
||||
},
|
||||
"202611-00052": {
|
||||
en: ["Factory: fixed versioning – deliverables raise the patch version, only the last one of a milestone raises the minor version"],
|
||||
de: ["Factory: Versionierung korrigiert – Deliverables erhöhen die Patch-Version, nur das letzte eines Meilensteins die Minor-Version"],
|
||||
|
||||