diff --git a/CLAUDE.md b/CLAUDE.md index c07f4f8..031deca 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -58,7 +58,8 @@ | Redis | תור משימות | `legal-ai-redis` | | n8n | אוטומציית workflows | להגדרה | | Gitea | מאגר קוד | `gitea.nautilus.marcusgroup.org/ezer-mishpati` | -| ezer-mishpati-web | ממשק העלאת מסמכים | `legal-ai.nautilus.marcusgroup.org` | +| ezer-mishpati-web | ממשק העלאת מסמכים (Docker/Coolify) | `legal-ai.nautilus.marcusgroup.org` | +| Paperclip | סוכן AI — מריץ Claude Code agents (pm2, מקומי) | `localhost:3100` | | Infisical | ניהול סודות | `secret.dev.marcus-law.co.il` | --- diff --git a/paperclip-bug-report.md b/paperclip-bug-report.md deleted file mode 100644 index cf451da..0000000 --- a/paperclip-bug-report.md +++ /dev/null @@ -1,65 +0,0 @@ -# Bug: Skill import from Gitea — wrong raw URL format causes empty SKILL.md - -**File at:** https://github.com/paperclipai/paperclip/issues/new - -## Title -Skill import from Gitea: wrong raw URL format causes empty SKILL.md - -## Body - -### Bug Summary - -When importing skills from a **Gitea** instance (self-hosted), Paperclip fetches the git tree successfully via the `/api/v3/` endpoint (which Gitea supports), but then uses the **wrong raw file URL format** to download `SKILL.md` content, resulting in a 404 and an almost-empty stub being saved. - -### Environment - -- Paperclip server: `@paperclipai/server@2026.403.0` -- Gitea instance: self-hosted Gitea - -### Steps to Reproduce - -1. Host a skill repo on a Gitea instance with a `SKILL.md` (32KB+), `scripts/`, and `references/` directories -2. Import the skill via URL: `https://my-gitea.example.com/org/skill-name.git` -3. Observe that only a stub SKILL.md (~283 bytes) is saved, and subdirectories are missing - -### Root Cause - -In `server/dist/services/github-fetch.js`, the `resolveRawGitHubUrl()` function builds: - -``` -https://{hostname}/raw/{owner}/{repo}/{ref}/{file} -``` - -This format works for **GitHub Enterprise**, but **not for Gitea**. Gitea expects: - -``` -https://{hostname}/{owner}/{repo}/raw/branch/{ref}/{file} -``` - -### Proof - -```bash -# Paperclip's URL format -> 404 -$ curl -s -o /dev/null -w "%{http_code}" "https://my-gitea.example.com/raw/org/skill-repo/main/SKILL.md" -404 - -# Correct Gitea format -> 200 -$ curl -s -o /dev/null -w "%{http_code}" "https://my-gitea.example.com/org/skill-repo/raw/branch/main/SKILL.md" -200 -``` - -### Secondary Issue - -When `SKILL.md` is at the repository root, `path.posix.dirname("SKILL.md")` returns `"."`, causing the inventory filter `entry.startsWith("./")` to miss all sibling directories (`scripts/`, `references/`). This means even if the raw URL worked, subdirectories would still be excluded from the file inventory. - -### Suggested Fix - -1. **Detect Gitea** vs GitHub Enterprise (e.g., check for `/api/v1/` endpoint which is Gitea-specific, vs `/api/v3/`) -2. **Use the correct raw URL format** per platform: - - GitHub/GHE: `https://{hostname}/raw/{owner}/{repo}/{ref}/{file}` - - Gitea: `https://{hostname}/{owner}/{repo}/raw/branch/{ref}/{file}` -3. **Fix root-level SKILL.md inventory**: when `skillDir === "."`, include all files instead of filtering by `entry.startsWith("./")` - -### Workaround - -Manually clone the repo into `~/.paperclip/instances/default/skills/{company_id}/{slug}/` and update the `company_skills` table directly with correct markdown content and file_inventory. diff --git a/web/app.py b/web/app.py index dae36b6..5e0e0a7 100644 --- a/web/app.py +++ b/web/app.py @@ -2172,10 +2172,9 @@ async def api_delete_tag_mapping(mapping_id: str): PAPERCLIP_DB_URL = os.environ.get( "PAPERCLIP_DB_URL", "postgresql://paperclip:paperclip@127.0.0.1:54329/paperclip" ) -# In Docker: mounted at /paperclip-skills; locally: ~/.paperclip/instances/default/skills -_docker_skills = Path("/paperclip-skills") +# Paperclip runs locally via pm2; skills are in ~/.paperclip _local_skills = Path.home() / ".paperclip" / "instances" / "default" / "skills" -PAPERCLIP_SKILLS_DIR = _docker_skills if _docker_skills.exists() else _local_skills +PAPERCLIP_SKILLS_DIR = _local_skills # Default company ID for skills SKILLS_COMPANY_ID = os.environ.get("PAPERCLIP_COMPANY_ID", "42a7acd0-30c5-4cbd-ac97-7424f65df294") @@ -2499,7 +2498,7 @@ async def api_restart_paperclip(): "message": "Restart requested — the host watcher will restart Paperclip shortly.", } except Exception: - raise HTTPException(500, "Cannot restart Paperclip from Docker. Run manually: pm2 restart paperclip") + raise HTTPException(500, "שגיאה בהפעלת restart. הרץ ידנית: pm2 restart paperclip") @app.post("/api/cases/{case_number}/documents/upload-tagged")