Compare commits

..

3 Commits

Author SHA1 Message Date
posimai cab06ec681 chore: add disaster recovery section and settings.json backup
- CLAUDE.md: add disaster recovery section with restore procedure
  for new machine setup (clone posimai-root + claude-memory, restore settings)
- claude-settings.json: backup of ~/.claude/settings.json (permissions config)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 21:01:23 +09:00
posimai 9c892e723a chore: remove emoji from server.js comments and startup log 2026-03-17 18:10:55 +09:00
posimai a60dda9528 fix: add URL protocol validation and reaction type validation 2026-03-17 17:26:59 +09:00
3 changed files with 125 additions and 2 deletions

View File

@ -10,6 +10,61 @@
2. **memory/ ディレクトリを確認する**`C:\Users\maita\.claude\projects\c--Users-maita-posimai-project\memory\MEMORY.md` にプロジェクト固有の記憶がある
3. **`posimai-dashboard/src/data/projects.json` を確認する** — 全アプリの一覧・ステータス・技術スタックがここにある
---
## ディザスタリカバリPC 完全消失時の復元手順)
### バックアップリポジトリ
| リポジトリ | Giteaローカル | GitHubクラウド | 内容 |
|-----------|-----------------|-----------------|------|
| `posimai-root` | `http://100.76.7.3:3000/mai/posimai-root` | `https://github.com/posimai/posimai-root` (private) | CLAUDE.md / _template / server.js / scripts / deploy-server.sh / claude-settings.json |
| `claude-memory` | `http://100.76.7.3:3000/mai/claude-memory` | `https://github.com/posimai/claude-memory` (private) | ~/.claude/memory 以下の全記憶ファイル |
### 新マシンでの復元手順
```bash
# 1. GitHub CLI 認証
gh auth login
# 2. posimai-root を cloneCLAUDE.md・設定類を復元
git clone https://github.com/posimai/posimai-root.git "C:/Users/maita/posimai-project"
cd "C:/Users/maita/posimai-project"
git remote add gitea http://100.76.7.3:3000/mai/posimai-root.git
# 3. Claude Code settings を復元
cp "C:/Users/maita/posimai-project/claude-settings.json" "C:/Users/maita/.claude/settings.json"
# 4. claude-memory を cloneAI 記憶を復元)
git clone https://github.com/posimai/claude-memory.git "C:/Users/maita/.claude/projects/c--Users-maita-posimai-project/memory"
cd "C:/Users/maita/.claude/projects/c--Users-maita-posimai-project/memory"
git remote add gitea http://100.76.7.3:3000/mai/claude-memory.git
# 5. 各アプリを必要に応じて clone
# git clone https://github.com/posimai/[app-name].git "C:/Users/maita/posimai-project/[app-name]"
# cd [app-name] && git remote add gitea http://100.76.7.3:3000/mai/[app-name].git
```
### posimai-root の更新方法CLAUDE.md・server.js 等を変更した後)
```bash
cd C:/Users/maita/posimai-project
git add CLAUDE.md claude-settings.json _template/ deploy-server.sh scripts/ server.js
git commit -m "chore: update ..."
git push gitea main && git push github main
```
### claude-memory の更新方法AI が記憶を更新した後)
```bash
cd "C:/Users/maita/.claude/projects/c--Users-maita-posimai-project/memory"
git add .
git commit -m "chore: update memory"
git push gitea main && git push github main
```
---
### AI が絶対に守るべきルール(違反時は即修正)
| 禁止事項 | 理由 |

63
claude-settings.json Normal file
View File

@ -0,0 +1,63 @@
{
"permissions": {
"defaultMode": "acceptEdits",
"allow": [
"Bash(*)",
"Read",
"Glob",
"Grep",
"WebSearch",
"WebFetch",
"Bash(git *)",
"Bash(npm *)",
"Bash(npx *)",
"Bash(node *)",
"Bash(python3 *)",
"Bash(flutter *)",
"Bash(vercel *)",
"Bash(gh *)",
"Bash(curl *)",
"Bash(scp *)",
"Bash(ssh *)",
"Bash(ls*)",
"Bash(find *)",
"Bash(mkdir *)",
"Bash(mv *)",
"Bash(cp *)",
"Bash(rm -f *)",
"Bash(rm -r *)",
"Bash(chmod *)",
"Bash(cat *)",
"Bash(grep *)",
"Bash(head *)",
"Bash(tail *)",
"Bash(sed *)",
"Bash(awk *)",
"Bash(echo *)",
"Bash(printf *)",
"Bash(wc *)",
"Bash(xargs *)",
"Bash(unzip *)",
"Bash(bash *)",
"Bash(keytool *)",
"Bash(yes)",
"Bash(for *)",
"Bash(do *)",
"Bash(done*)"
],
"deny": [
"Bash(rm -rf *)",
"Bash(git reset --hard *)",
"Bash(git push --force *)",
"Bash(git clean *)",
"Bash(sudo *)"
],
"additionalDirectories": [
"c:\\Users\\maita\\posimai-project\\_template",
"c:\\Users\\maita\\posimai-project\\posimai-analytics\\src\\app\\(galaxy)",
"c:\\Users\\maita\\.claude\\projects\\c--Users-maita-posimai-project\\memory",
"c:\\Users\\maita\\posimai-project",
"/tmp"
]
}
}

View File

@ -577,7 +577,7 @@ function buildRouter() {
let fullText = content || null;
const source = clientSource || extractSource(url);
// 🔥 重要: contentが空の場合、Jina Reader APIで本文を自動取得
// 重要: contentが空の場合、Jina Reader APIで本文を自動取得
if (!fullText || fullText.trim().length === 0) {
console.log(`[Brain API] No content provided for ${url}, attempting Jina Reader fetch...`);
@ -1424,6 +1424,10 @@ ${excerpt}
r.post('/together/share', async (req, res) => {
const { group_id, shared_by, url = null, title = null, message = '', tags = [] } = req.body || {};
if (!group_id || !shared_by) return res.status(400).json({ error: 'group_id と shared_by は必須です' });
if (url) {
try { const p = new URL(url); if (!['http:', 'https:'].includes(p.protocol)) throw new Error(); }
catch { return res.status(400).json({ error: 'url は http/https のみ有効です' }); }
}
try {
const grpCheck = await pool.query('SELECT id FROM together_groups WHERE id=$1', [group_id]);
if (grpCheck.rows.length === 0) return res.status(404).json({ error: 'グループが見つかりません' });
@ -1488,6 +1492,7 @@ ${excerpt}
r.post('/together/react', async (req, res) => {
const { share_id, username, type = 'like' } = req.body || {};
if (!share_id || !username) return res.status(400).json({ error: 'share_id と username は必須です' });
if (!['like', 'star', 'fire'].includes(type)) return res.status(400).json({ error: 'type は like/star/fire のみ有効です' });
try {
const existing = await pool.query(
'SELECT 1 FROM together_reactions WHERE share_id=$1 AND username=$2 AND type=$3',
@ -1696,7 +1701,7 @@ const PORT = parseInt(process.env.PORT || '8090');
initDB()
.then(() => {
app.listen(PORT, '0.0.0.0', () => {
console.log(`\n🧠 Posimai Brain API`);
console.log(`\nPosimai Brain API`);
console.log(` Port: ${PORT}`);
console.log(` Gemini: ${genAI ? 'enabled' : 'disabled (no key)'}`);
console.log(` Users: ${Object.values(KEY_MAP).join(', ') || '(none - set API_KEYS)'}`);