From d5d4df5f171a4f58d00195688a1645108d0822ef Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sun, 30 Nov 2025 09:03:14 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 14 ++++++++++ README.md | 3 +++ commands/pack.md | 38 +++++++++++++++++++++++++++ commands/search.md | 39 ++++++++++++++++++++++++++++ plugin.lock.json | 53 ++++++++++++++++++++++++++++++++++++++ skills/ospack/SKILL.md | 49 +++++++++++++++++++++++++++++++++++ 6 files changed, 196 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100644 commands/pack.md create mode 100644 commands/search.md create mode 100644 plugin.lock.json create mode 100644 skills/ospack/SKILL.md diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..4fb1fe6 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,14 @@ +{ + "name": "ospack", + "description": "Semantic context packer - combines import resolution with semantic search", + "version": "0.4.0", + "author": { + "name": "ospack" + }, + "skills": [ + "./skills" + ], + "commands": [ + "./commands" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..80c64a6 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# ospack + +Semantic context packer - combines import resolution with semantic search diff --git a/commands/pack.md b/commands/pack.md new file mode 100644 index 0000000..b9c8eeb --- /dev/null +++ b/commands/pack.md @@ -0,0 +1,38 @@ +--- +description: Pack context from a focus file and/or semantic query +allowed-tools: Bash +--- + +# Pack Context + +Use ospack to gather relevant code context for the current task. + +## Usage + +Run `ospack pack` with the appropriate flags: + +```bash +# Pack from a specific file + its imports +ospack pack --focus --root $(pwd) + +# Semantic search for related code +ospack pack --query "" --root $(pwd) + +# Combine both (recommended) +ospack pack --focus --query "" --root $(pwd) +``` + +## Options + +- `--focus, -f`: Entry point file for import resolution +- `--query, -q`: Natural language semantic search +- `--max-files, -m`: Max files to include (default: 10) +- `--import-depth, -d`: Import traversal depth (default: 2) +- `--format, -o`: Output format: xml, compact, or chunks + +## When to use + +Use this command when you need to: +- Understand a file and its dependencies +- Find related code for a concept +- Build context for refactoring or debugging diff --git a/commands/search.md b/commands/search.md new file mode 100644 index 0000000..f8f25f8 --- /dev/null +++ b/commands/search.md @@ -0,0 +1,39 @@ +--- +description: Semantic search for code in the current repository +allowed-tools: Bash +--- + +# Semantic Search + +Use ospack to find code semantically by concept, not just keywords. + +## Usage + +```bash +ospack search "" --root $(pwd) +``` + +## Examples + +```bash +# Find authentication logic +ospack search "user authentication" --root $(pwd) + +# Find error handling patterns +ospack search "error handling middleware" --root $(pwd) + +# Find database queries +ospack search "database connection pooling" --root $(pwd) +``` + +## Options + +- `--limit, -l`: Max results to return (default: 10) +- `--root`: Repository root directory + +## When to use + +Use this for quick semantic searches when you need to find: +- Where a concept is implemented +- Related code across the codebase +- Patterns and examples diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..24e47f3 --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,53 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:Tylerbryy/ospack:plugins/ospack", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "da7fde86962a19678a115b4d0527fef85d98b05e", + "treeHash": "7edf64051f6ef94114569a83b5f174042f1b602ef4df0a57f0ca6ac6a7a0c0f4", + "generatedAt": "2025-11-28T10:12:55.205847Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "ospack", + "description": "Semantic context packer - combines import resolution with semantic search", + "version": "0.4.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "ac8bf8b8c128241dc5f7681d76cd05185b86a75750be0a1ee3efc616b4977535" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "795810d99280973e5b37f444ec2c1d05bcd5e9f4f46d2b9ff2b6869dc084b833" + }, + { + "path": "commands/search.md", + "sha256": "ab6904652aa2b93a19c3db8a0082771547ca4c9f9d8541107fe6a25eb88a03b8" + }, + { + "path": "commands/pack.md", + "sha256": "067540cbb352952104065f64419797aa0a3912cbd76fbd788be4059db7e1db5a" + }, + { + "path": "skills/ospack/SKILL.md", + "sha256": "2918072372a33f14d447b2e70e8ea4e76335d9010065e3ea6f5e1d13863d2160" + } + ], + "dirSha256": "7edf64051f6ef94114569a83b5f174042f1b602ef4df0a57f0ca6ac6a7a0c0f4" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file diff --git a/skills/ospack/SKILL.md b/skills/ospack/SKILL.md new file mode 100644 index 0000000..117a3ae --- /dev/null +++ b/skills/ospack/SKILL.md @@ -0,0 +1,49 @@ +# ospack - Semantic Context Packer + +Use ospack to gather relevant code context through import resolution and semantic search. + +## When to use this skill + +Use ospack when you need to: +- Understand a file and all its dependencies +- Find code related to a concept across the codebase +- Build comprehensive context for refactoring, debugging, or feature work +- Explore unfamiliar codebases + +## Commands + +### Pack context (recommended) + +Combines import resolution with semantic search: + +```bash +# From a focus file +ospack pack --focus src/auth.py --root $(pwd) + +# With semantic query +ospack pack --query "error handling" --root $(pwd) + +# Both together (best results) +ospack pack --focus src/api.py --query "validation" --root $(pwd) +``` + +### Quick search + +For fast semantic searches: + +```bash +ospack search "database connection" --root $(pwd) +``` + +## Output formats + +- `--format xml`: Structured XML (default, best for context) +- `--format compact`: Human-readable markdown +- `--format chunks`: Function-level results with scores + +## Tips + +- Use `--focus` when you have a specific entry point +- Use `--query` when searching by concept +- Combine both for comprehensive context +- Increase `--max-files` for larger explorations