Skip to content

refactor: workspace restructure and archive legacy projects#2

Open
redredchen01 wants to merge 9 commits intomasterfrom
refactor/workspace-restructure-1774847975
Open

refactor: workspace restructure and archive legacy projects#2
redredchen01 wants to merge 9 commits intomasterfrom
refactor/workspace-restructure-1774847975

Conversation

@redredchen01
Copy link
Copy Markdown
Owner

Summary

完成工作区重构,归档legacy项目,为新的workspace governance铺路。

Changes

1. 文档整理

  • 归档session-wrap相关文档至 docs/archive/session-wrap/
  • 移除顶层旧文档(AGENT-WORKFLOW、BENCHMARKS等11个)
  • 新增SOLO-DEVELOPER、PRODUCTION-SETUP等聚焦文档

2. 项目迁移

  • 删除obsidian-agent项目目录(已重命名为clausidian v2.0.0)
  • 完成所有引用更新
  • 更新backend entrypoints

3. Scripts重组

  • 新增 scripts/agent/* — agent工具集
  • 新增 scripts/viz/* — visualization和analytics工具
  • 新增 scripts/lib/* — shared utilities和test helpers
  • 新增 scripts/deploy/ — deployment脚本
  • scripts/archive/ — 归档旧脚本
  • 删除 scripts/skill-deploy.sh(移至deploy目录)

4. 后端测试

  • session-wrap-backend: 新增单元测试套件(analytics, auth, forecasting, integrations, middleware)
  • session-wrap-skill: 新增tasks route测试

5. 配置更新

  • 更新zsh configurations
  • 修改Python experimental projects
  • 新增workspace governance和architecture升级计划

Design Decisions

  • 归档策略:保留完整历史,移到archive目录而非完全删除
  • 脚本组织:按功能分类(agent, viz, deploy, lib),便于发现和维护
  • 测试优先:为关键后端路由补充测试覆盖
  • 向后兼容:保留所有active功能,只清理已放弃的路径

Testing

运行以下验证:

  1. `npm test` — 全套测试(包括新增测试)
  2. `scripts/agent/agent-*.sh` — 验证新agent工具可执行
  3. `scripts/viz/*.sh` — 验证visualization脚本运行

🤖 Generated with Claude Haiku 4.5 via Claude Code

redredchen01 and others added 9 commits March 30, 2026 13:17
- Package renamed: obsidian-agent → clausidian
- Binary renamed: obsidian-agent → clausidian
- Version bumped to 2.0.0
- GitHub repo: redredchen01/Clausidian
- Updated all references:
  * CLI source (package.json, bin, src, commands, tests)
  * Scaffold & skill templates
  * README (with migration guide)
  * Project index & workspace docs

Tests: 122/124 pass
CLI: clausidian v2.0.0 ✓

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Update WORKSPACE_STRUCTURE.md with clausidian tool name
- Update automation plan and restructure plan with clausidian CLI references
- Ensure documentation reflects official tool rename
- Remove archived docs (AGENT-WORKFLOW, BENCHMARKS, ENTERPRISE-ADOPTION, etc.)
- Complete obsidian-agent → clausidian v2.0.0 migration (delete old directory)
- Remove skill-deploy.sh (superseded by new deployment workflow)
- Update backend entrypoints and session-wrap references
- Reorganize scripts: add visualization tools, clean up unused scripts
- Update zsh configurations and Python experimental projects
- Add structured plans for workspace governance and architecture

This completes the workspace restructuring phase started in previous sessions.
Replace hardcoded command dispatch with router function that handles
install/uninstall/status subcommands. Update documentation to note
that com.clausidian.* agents are deprecated in favor of com.dex.obsidian-*
system which uses shell scripts in YD 2026/scripts/ (daily/weekly/monthly).

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Update all obsidian-*.sh scripts to call 'clausidian' command instead of
deprecated 'obsidian-agent'. These scripts are invoked by com.dex.obsidian-*
LaunchAgents (installed daily at 08:00, weekly at 20:00 Sunday, monthly at
20:00 1st day).

Changes:
- obsidian-daily.sh: journal + backfill + sync + health + auto-commit
- obsidian-weekly.sh: review + health + validate + orphans + broken-links
- obsidian-monthly.sh: monthly review + health + duplicates + sync

All 3 scripts tested and verified working.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Restructure root package.json as workspace metadata (private: true)
- Improve task lock with stale lock cleanup (60s threshold)
- Reduce retry count to 10s, add graceful release_lock trap
- Add .editorconfig for consistent formatting
Add bridge command group with subcommands support for syncing external
systems to vault:
- bridge gcal: Sync Google Calendar events to daily journal
- bridge gmail: Placeholder for Gmail digest capture
- bridge github: Placeholder for GitHub activity sync

Changes:
- Create src/commands/bridge.mjs with bridgeGcal() implementation
- Register bridge subcommands in src/registry.mjs
- Update bin/cli.mjs to route subcommands to their run functions
- Flatten subcommands into MCP tools automatically for agent access

Google Calendar integration (bridge gcal):
- Queries gwx calendar CLI for events on specified date
- Generates meeting blocks with time, attendees, description
- Appends to existing journal entry without overwriting
- Gracefully handles missing gwx or auth errors

Testing:
- All 123/124 tests pass (1 pre-existing failure unrelated)
- Manual testing: bridge gcal command works, awaiting OAuth setup
- batch command now also works with updated subcommand routing

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Update obsidian-daily.sh to include bridge gcal step for syncing Google
Calendar events to journal. This adds event details (time, attendees,
description) to daily journal entries automatically.

Execution order:
1. Create journal entry (idempotent)
2. Backfill missing journals from git history
3. Sync Google Calendar events to journal
4. Rebuild vault indices (TF-IDF link suggestions)
5. Generate health report
6. Auto-commit changes

Requires: gwx CLI with Google OAuth setup (skip gracefully if not auth'd)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
- Add bridge.mjs command for gcal/gmail/github integration
- Update registry.mjs to expose bridge subcommands
- Update cli.mjs with bridge command documentation
- Update workspace governance plan with bridge architecture
- Update obsidian-daily.sh automation with bridge integration
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 087bf146be

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


// Middleware: Ensure user is authenticated
router.use(authenticateToken);
router.use(checkRole(['admin', 'editor', 'viewer']));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Apply role check after workspaceId is bound

Placing checkRole(['admin', 'editor', 'viewer']) on router.use(...) runs the authorization middleware before :workspaceId is populated from route matching, so checkRole falls back to checking only global roles and can reject users who have valid workspace-scoped roles. This makes analytics endpoints return 403 for legitimate members unless they also have a global role; attach checkRole to the '/analytics/.../:workspaceId' handlers (or another path that includes :workspaceId) so it authorizes against the correct workspace.

Useful? React with 👍 / 👎.

const ForecastEngine = require('../utils/forecast')

const router = express.Router()

router.use(authenticateToken)
router.use(checkRole(['admin', 'editor', 'viewer']))
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Scope forecasting role checks to workspace routes

This router-level checkRole(...) executes before route params are bound, so req.params.workspaceId is not available when authorization runs and users with only workspace-level roles can be denied from /forecast/:workspaceId and /anomalies/:workspaceId. Mount the role middleware on routes that include :workspaceId (or a middleware path with that param) so role lookup is evaluated in the requested workspace instead of global scope.

Useful? React with 👍 / 👎.

Comment on lines +100 to +101
if (!fs.existsSync(AGENT_TASKS_PATH)) {
return res.status(500).json({ error: 'agent-tasks.sh not found. Run setup first.' });
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Update task script path used by task mutations

After this workspace restructure, task mutations now hit this guard because the default AGENT_TASKS_PATH still targets the old scripts/agent-tasks.sh location while the script was moved under scripts/agent/agent-tasks.sh. In a default install, POST/PATCH /tasks will return 500 (agent-tasks.sh not found) until operators set an override manually; update the default path to the relocated script so task creation/updates work out of the box.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant