Commit graph

26 commits

Author SHA1 Message Date
Jiang Bohan
423bb6e5a6 docs: add language switch and update root README skills section
- Add English/Chinese language switch links to skills READMEs
- Update root README.md with new skills features and CLI examples
- Link to full skills documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 17:10:01 +08:00
Jiang Bohan
8974f52669 docs(skills): add plugin system docs and Chinese translation
- Document plugin system in Loading & Precedence section
- Add guidance on when to use plugins vs `add` command
- Create README.zh-CN.md with full Chinese translation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 17:03:39 +08:00
Jiang Bohan
8c2f8add76 feat(skills): add plugin system for npm package discovery
- Add plugin.ts with manifest loading and plugin discovery
- Scan node_modules for packages with multica.plugin.json
- Auto-discover and load skills from installed npm packages
- Integrate plugin skills into SkillManager via loader.ts
- Add workspaceDir and pluginPaths options to SkillManagerOptions
- Export plugin types and functions from index.ts

This enables users to install skill packages via npm and have them
automatically discovered without running `skills add`.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 16:48:36 +08:00
Jiang Bohan
a07e3ae280 docs(skills): add documentation for diagnostics and serialization
Document new Phase 5 features:
- Status diagnostics with diagnostic types table
- Async serialization API and utilities
- Updated troubleshooting section

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 16:33:23 +08:00
Jiang Bohan
3f1566694d chore(skills): export new diagnostics and serialize modules
Export checkEligibilityDetailed, DiagnosticItem, serialize, and
related utilities from skills index.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 16:33:19 +08:00
Jiang Bohan
7ddf4f76a3 refactor(skills): add serialization to add/remove/install operations
Apply async serialization to prevent concurrent operations:
- addSkill: serialized by target skill name
- removeSkill: serialized by skill name
- installSkill: serialized by skill ID

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 16:33:14 +08:00
Jiang Bohan
deb96496e7 feat(skills): add detailed eligibility diagnostics with hints
Enhance eligibility checking to provide detailed diagnostics including:
- Diagnostic type categorization (binary, env, platform, config)
- Actionable hints for resolving issues
- Platform-specific install suggestions for common tools
- API key source hints for well-known services

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 16:33:06 +08:00
Jiang Bohan
3bd85b63a4 feat(skills): add async serialization for concurrent operations
Add serialize module to prevent concurrent operations from corrupting
files when multiple add/remove/install operations run simultaneously.

- Queue-based serialization by key
- Utility functions: isProcessing, getQueueLength, waitForKey, waitForAll
- Standard SerializeKeys for common operations

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 16:33:01 +08:00
Jiang Bohan
40b680266a docs(skills): add skill invocation documentation
Document Phase 4 skill invocation features:
- User invocation via slash commands
- Tab completion usage
- Invocation control frontmatter fields
- Command dispatch configuration
- Command name normalization rules

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 16:11:23 +08:00
Jiang Bohan
4e10ee7e15 feat(skills): extend SkillManager with invocation methods
Add invocation capabilities to SkillManager:
- getSkillCommands: get user-invocable skill command specs
- resolveCommand: match user input to skill invocation
- getCompletions: get tab completions for command prefix
- buildModelSkillsPrompt: build prompt excluding user-only skills

Export invoke module functions for external use.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 16:11:13 +08:00
Jiang Bohan
42e2943999 feat(skills): add invoke module for skill commands
Implement skill command invocation system:
- resolveInvocationPolicy: get skill's invocation settings
- isUserInvocable/isModelInvocable: check invocation eligibility
- sanitizeCommandName: normalize skill names for commands
- buildSkillCommands: generate command specs from skills
- findSkillCommand: match command by name or skill ID
- resolveSkillInvocation: parse user input to skill invocation
- getCommandCompletions: tab completion for skill commands

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 16:11:07 +08:00
Jiang Bohan
8fbd72c329 feat(skills): add invocation types and parser support
Add types for skill invocation control:
- SkillInvocationPolicy for user-invocable/model-invocable flags
- SkillCommandSpec for command specifications
- SkillCommandDispatch for tool dispatch configuration
- SkillInvocationResult for resolved command results

Update parser to handle frontmatter fields:
- user-invocable (kebab-case, camelCase, snake_case)
- disable-model-invocation
- command-dispatch, command-tool, command-arg-mode

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 16:10:59 +08:00
Jiang Bohan
578c8a6534 docs(skills): add README for skills system 2026-01-30 15:53:55 +08:00
Jiang Bohan
da3bb254ec fix(skills): support nested skill directories and managed skills
- Add managed skills directory (~/.super-multica/skills/) to loader
- Change discoverSkillDirs to recursively scan up to 3 levels deep
- Skip hidden directories during scan
- Fixes skills installed via `skills add` not being discovered

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 15:36:31 +08:00
Jiang Bohan
ecaada1df0 feat(skills): add CLI commands for add/remove skills
Add new CLI commands:
- add <source>: Add skill from GitHub (owner/repo format)
- remove <name>: Remove installed skill
- Support for --force flag to overwrite existing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 15:30:00 +08:00
Jiang Bohan
aee807e95a feat(skills): add module for GitHub skill installation
Implement skill download from GitHub repositories:
- parseSource() to handle owner/repo, owner/repo/skill, and full URLs
- addSkill() with shallow clone and sparse checkout support
- removeSkill() to uninstall skills
- listInstalledSkills() for listing managed skills
- Automatic .git cleanup after clone

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 15:29:55 +08:00
Jiang Bohan
91709ddd84 feat(skills): integrate watcher into SkillManager
Add hot reload support to SkillManager:
- startWatching/stopWatching methods
- Version-based automatic cache invalidation
- Export install and watcher functions
- listAllSkillsWithStatus and checkSkillEligibility helpers

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 15:15:51 +08:00
Jiang Bohan
8eba6c0f4a feat(skills): add file watcher for hot reload
Implement chokidar-based file watching for skill hot reload:
- Version-based cache invalidation
- Debounced change detection
- Change listener registration with onSkillsChange
- Dynamic chokidar import (optional dependency)
- Watch skill directories with configurable paths

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 15:15:46 +08:00
Jiang Bohan
5853c9146a feat(skills): add install mechanism for skill dependencies
Implement install support for brew/npm/uv/go/download methods:
- buildInstallCommand for each installer type
- selectPreferredInstallSpec with configurable priority
- installSkill main function with timeout support
- Download support with archive extraction (tar.gz, zip)
- getInstallOptions for UI listing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 15:15:41 +08:00
Jiang Bohan
6d0ee87fdf test(skills): update eligibility tests for new context-based API
- Update checkEligibility calls to use EligibilityContext object
- Add tests for new features: anyBins, always flag, config disabled
- Add tests for bundled allowlist filtering
- Add tests for env var injection via config
- Add tests for apiKey + primaryEnv combination
- Add tests for new requires.bins/env format alongside legacy format

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 15:01:50 +08:00
Jiang Bohan
00915d7fb9 feat(skills): enhance metadata and config system for OpenClaw compatibility
- Add SkillInstallSpec type for future install mechanism support
- Add SkillRequirements type with bins, anyBins, env, config checks
- Add SkillConfig, SkillsConfig types for per-skill and global config
- Add utility functions: getSkillKey, getSkillConfig, normalizeRequirements
- Support both new (requires.bins, os) and legacy (requiresBinaries, platforms) fields
- Implement 'always' flag to skip eligibility checks
- Implement bundled skills allowlist filtering
- Implement config-based skill enable/disable
- Implement env var injection via config (apiKey + primaryEnv)
- Add listAllSkillsWithStatus() method to SkillManager
- Export new types and utility functions

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 15:01:35 +08:00
Jiayuan
75fba044bd
Merge pull request #30 from multica-ai/forrestchang/add-unit-tests
test: add comprehensive unit tests across the codebase
2026-01-30 14:13:10 +08:00
Jiayuan
5353161b1d test(skills): add unit tests for skills loader
Add tests for getProfileSkillsDir, getBundledSkillsDir, and loadAllSkills
with skill precedence, invalid files, and directory discovery.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 14:00:47 +08:00
Jiayuan
de8ff730fb test(skills): add unit tests for parser and eligibility checker
Add tests for:
- YAML frontmatter parsing from SKILL.md files
- Skill eligibility checking (platform, binary, env requirements)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 13:54:50 +08:00
yushen
36e9acb35f refactor(shared): extract DATA_DIR constant to shared/paths.ts
Replace hardcoded ~/.super-multica paths across agent and hub modules
with a single DATA_DIR constant exported from shared.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 13:49:35 +08:00
Jiayuan
50ae997ab4
feat(agent): add skills system with profile integration (#21)
* chore(deps): add yaml package for skill parsing

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(agent): add skills system

Implement a skills system inspired by moltbot's approach:

- Skills are markdown files (SKILL.md) with YAML frontmatter
- Multi-source loading with precedence: bundled < user < workspace
- Eligibility filtering based on platform, binaries, and env vars
- Skills are automatically included in agent system prompt
- New AgentOptions: enableSkills, skillsBaseDir, extraSkillDirs

Includes two bundled skills:
- commit: Git commit helper with conventional commit guidelines
- code-review: Code review checklist and best practices

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* refactor(skills): use profile-based skills instead of workspace

Change skill loading from workspace-based (.skills/) to profile-based:
- Skills now load from ~/.super-multica/agent-profiles/<profileId>/skills/
- Remove workspace and user skill sources
- Simplify to only bundled and profile sources
- Profile skills have higher precedence than bundled

This is more appropriate for non-coding agents where skills are
associated with agent identity rather than working directory.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 05:21:57 +08:00