Skip to content

Commit 692430a

Browse files
committed
feat: fresh repo~
0 parents  commit 692430a

124 files changed

Lines changed: 35286 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--- Cursor Command: opencontext-context.md ---
2+
---
3+
title: /opencontext-context
4+
description: Load relevant OpenContext docs for the current task (safe, no index build)
5+
---
6+
7+
Goal: Load enough context from OpenContext so you can proceed confidently.
8+
Safety: Do NOT trigger index builds by default (no `oc index build`). Prefer manifest + direct reads.
9+
10+
1. If the target space/folder is unclear, run `oc folder ls --all` and ask the user to choose a folder (no guessing when ambiguous).
11+
2. Run `oc context manifest <folder_path> --limit 10` (or `oc context manifest . --limit 10` for broad context).
12+
3. Load 3–10 relevant files by `abs_path` and extract:
13+
- Key constraints, decisions, and current state
14+
- Open questions / risks
15+
4. Cite sources:
16+
- Prefer stable links `oc://doc/<stable_id>` when available in the manifest output.
17+
- Use `abs_path` + `range` only for line-level evidence.
18+
5. Summarize the loaded context and proceed with the user’s task.
19+
--- End Command ---
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--- Cursor Command: opencontext-create.md ---
2+
---
3+
title: /opencontext-create
4+
description: Create a new idea or problem statement inside OpenContext
5+
---
6+
7+
0. **Blocking requirement**: Do NOT answer the user’s broader question until the document has been created and minimally populated.
8+
1. Infer the target space from recent context; if unclear, ask the user to specify the space (no default).
9+
2. Derive a concise idea title & summary from the current conversation, then generate a slug (kebab-case; fallback to `idea-<YYYYMMDDHHmm>`). Only ask the user if information is insufficient.
10+
3. Determine the target folder path under OpenContext (do NOT assume fixed subfolders like `ideas/`):
11+
- If the user gave a target folder, use it.
12+
- Otherwise, infer a sensible default and confirm with the user (or ask the user to choose).
13+
- If you are unsure what folders exist, run `oc folder ls --all` and pick/ask accordingly.
14+
4. Ensure the target folder exists by running `oc folder create <folder_path> -d "<folder description>"` (safe to rerun).
15+
5. **[CRITICAL - DO NOT SKIP]** You MUST run: `oc doc create <folder_path> <slug>.md -d "<title>"` to create the document.
16+
- This command registers the document in the OpenContext database.
17+
- DO NOT directly create the file with Write tool - you MUST use `oc doc create` first.
18+
- The command will output the file path after successful creation.
19+
6. After `oc doc create` succeeds, set `CONTEXTS_ROOT=${OPENCONTEXT_CONTEXTS_ROOT:-$HOME/.opencontext/contexts}` and edit `${CONTEXTS_ROOT}/<folder_path>/<slug>.md` directly - do not mirror it inside the project repo.
20+
7. Populate that file with:
21+
- Title / problem statement
22+
- Initial description/background
23+
- “Related Requests” list (can be empty placeholders)
24+
8. Return the document path and immediately keep organizing content (no follow-up questions unless critical info is missing).
25+
--- End Command ---
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--- Cursor Command: opencontext-help.md ---
2+
---
3+
title: /opencontext-help
4+
description: Start here — choose the right OpenContext command (beginner-friendly)
5+
---
6+
7+
You are assisting a user who may be new to OpenContext. Your goal is to route them to the right workflow and execute it.
8+
9+
1. Ask the user which of these they want (pick one):
10+
- A) "I want to find what I've written before" → use **/opencontext-search**
11+
- B) "I want to load background/context for the current task" → use **/opencontext-context**
12+
- C) "I want to create a new doc/idea" → use **/opencontext-create**
13+
- D) "I want to save/update a doc with what we just learned" → use **/opencontext-iterate**
14+
2. If they are unsure, default to **/opencontext-context**.
15+
3. Then run the chosen command and continue the task.
16+
--- End Command ---
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--- Cursor Command: opencontext-iterate.md ---
2+
---
3+
title: /opencontext-iterate
4+
description: Enrich an existing idea with additional context from OpenContext
5+
---
6+
7+
1. Identify the target idea document from the current discussion (ask only if ambiguous). Set `CONTEXTS_ROOT=${OPENCONTEXT_CONTEXTS_ROOT:-$HOME/.opencontext/contexts}` and load `${CONTEXTS_ROOT}/<target_doc>` to understand existing sections (never duplicate it under the project repo).
8+
2. Derive the owning space from the doc path (e.g., `<space>/.../foo.md` → space `<space>`). If the space is unclear, run `oc folder ls --all`. Then run `oc context manifest <space> --limit 10` (or `oc context manifest . --limit 10`) and load each `abs_path` for inspiration.
9+
3. Update the Markdown directly in the global file:
10+
- Ensure a `## Iteration Log` section exists (create if missing).
11+
- Append a new entry timestamped with local date/time in readable format (e.g., `2025-12-11 17:00` or `Dec 11, 2025 5:00 PM`) that summarizes insights, cites referenced docs, and lists next steps/risks.
12+
- **Citation rule (DO NOT SKIP)**: when citing any OpenContext doc in `Iteration Log`, you MUST use the stable link format `oc://doc/<stable_id>` as the primary reference (example: `[label](oc://doc/<stable_id>)`). Only add `abs_path` and/or `range` when you specifically need auditability or line-level evidence. Do NOT cite using only file paths if `stable_id` is available in the manifest output.
13+
- Refresh any other impacted sections (Overview, Requirements, Implementation notes, etc.).
14+
4. Save the updated document and call `oc doc set-desc <target_doc> "<latest summary>"` so the manifest reflects the newest iteration.
15+
5. Report the updated doc path plus which references were used.
16+
--- End Command ---
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--- Cursor Command: opencontext-search.md ---
2+
---
3+
title: /opencontext-search
4+
description: Search OpenContext to find the right docs (safe, no index build by default)
5+
---
6+
7+
Goal: Help the user find relevant existing docs quickly.
8+
Safety: Do NOT trigger index builds by default (cost may be unpredictable).
9+
10+
1. Ask the user for a short query (or infer one from the conversation).
11+
2. Try search in read-only mode:
12+
- Run: `oc search "<query>" --format json --limit 10`
13+
- If it succeeds, use results to pick candidate docs and then use **/opencontext-context** (manifest + reads) to load and cite them.
14+
3. If search fails due to missing index:
15+
- Fall back to `oc context manifest <folder> --limit 20` and use doc `description` + filename triage.
16+
- Optionally suggest a controlled index build, but do NOT run it unless the user explicitly approves.
17+
4. Cite sources using stable links `oc://doc/<stable_id>` when available.
18+
--- End Command ---

.github/workflows/ci.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
# JavaScript tests
14+
test-js:
15+
name: Test JS (${{ matrix.os }})
16+
runs-on: ${{ matrix.os }}
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os: [ubuntu-latest, macos-latest, windows-latest]
21+
node: [18, 20]
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: ${{ matrix.node }}
30+
cache: 'npm'
31+
32+
- name: Install Rust
33+
uses: dtolnay/rust-action@stable
34+
35+
- name: Install dependencies
36+
run: npm ci
37+
38+
- name: Build native module
39+
run: |
40+
cd crates/opencontext-node
41+
npm ci
42+
npm run build
43+
44+
- name: Run JS tests
45+
run: npm test
46+
47+
# Rust tests
48+
test-rust:
49+
name: Test Rust
50+
runs-on: ubuntu-latest
51+
52+
steps:
53+
- uses: actions/checkout@v4
54+
55+
- name: Install Rust
56+
uses: dtolnay/rust-action@stable
57+
58+
- name: Run Rust tests
59+
run: |
60+
cd crates/opencontext-core
61+
cargo test --release --features search
62+
63+
# Lint
64+
lint:
65+
name: Lint
66+
runs-on: ubuntu-latest
67+
68+
steps:
69+
- uses: actions/checkout@v4
70+
71+
- name: Install Rust
72+
uses: dtolnay/rust-action@stable
73+
with:
74+
components: clippy, rustfmt
75+
76+
- name: Check Rust formatting
77+
run: |
78+
cd crates/opencontext-core
79+
cargo fmt --check
80+
81+
- name: Run Clippy
82+
run: |
83+
cd crates/opencontext-core
84+
cargo clippy --features search -- -D warnings
85+

.github/workflows/native-build.yml

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
name: Build Native Modules
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
tags:
7+
- 'v*'
8+
pull_request:
9+
branches: [main, master]
10+
11+
env:
12+
APP_NAME: opencontext-node
13+
MACOSX_DEPLOYMENT_TARGET: '10.13'
14+
15+
defaults:
16+
run:
17+
working-directory: crates/opencontext-node
18+
19+
jobs:
20+
build:
21+
name: Build - ${{ matrix.settings.target }}
22+
runs-on: ${{ matrix.settings.host }}
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
settings:
27+
# macOS
28+
- host: macos-latest
29+
target: x86_64-apple-darwin
30+
build: npm run build -- --target x86_64-apple-darwin
31+
- host: macos-latest
32+
target: aarch64-apple-darwin
33+
build: npm run build -- --target aarch64-apple-darwin
34+
35+
# Linux
36+
- host: ubuntu-latest
37+
target: x86_64-unknown-linux-gnu
38+
build: npm run build -- --target x86_64-unknown-linux-gnu
39+
- host: ubuntu-latest
40+
target: aarch64-unknown-linux-gnu
41+
build: |
42+
sudo apt-get update
43+
sudo apt-get install -y gcc-aarch64-linux-gnu
44+
export CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc
45+
npm run build -- --target aarch64-unknown-linux-gnu
46+
47+
# Windows
48+
- host: windows-latest
49+
target: x86_64-pc-windows-msvc
50+
build: npm run build -- --target x86_64-pc-windows-msvc
51+
- host: windows-latest
52+
target: aarch64-pc-windows-msvc
53+
build: npm run build -- --target aarch64-pc-windows-msvc
54+
55+
steps:
56+
- uses: actions/checkout@v4
57+
58+
- name: Setup Node.js
59+
uses: actions/setup-node@v4
60+
with:
61+
node-version: 20
62+
cache: 'npm'
63+
cache-dependency-path: crates/opencontext-node/package-lock.json
64+
65+
- name: Install Rust
66+
uses: dtolnay/rust-action@stable
67+
with:
68+
targets: ${{ matrix.settings.target }}
69+
70+
- name: Install dependencies
71+
run: npm ci
72+
73+
- name: Build native module
74+
run: ${{ matrix.settings.build }}
75+
shell: bash
76+
77+
- name: Upload artifact
78+
uses: actions/upload-artifact@v4
79+
with:
80+
name: bindings-${{ matrix.settings.target }}
81+
path: crates/opencontext-node/*.node
82+
if-no-files-found: error
83+
84+
# Publish to npm when tag is pushed
85+
publish:
86+
name: Publish to npm
87+
runs-on: ubuntu-latest
88+
needs: build
89+
if: startsWith(github.ref, 'refs/tags/v')
90+
91+
steps:
92+
- uses: actions/checkout@v4
93+
94+
- name: Setup Node.js
95+
uses: actions/setup-node@v4
96+
with:
97+
node-version: 20
98+
registry-url: https://registry.npmjs.org/
99+
100+
- name: Install dependencies
101+
run: npm ci
102+
working-directory: crates/opencontext-node
103+
104+
- name: Download all artifacts
105+
uses: actions/download-artifact@v4
106+
with:
107+
path: crates/opencontext-node/artifacts
108+
109+
- name: Move artifacts
110+
run: |
111+
cd crates/opencontext-node
112+
npm run artifacts
113+
shell: bash
114+
115+
- name: List packages
116+
run: ls -la npm
117+
working-directory: crates/opencontext-node
118+
119+
- name: Publish native packages
120+
run: |
121+
cd crates/opencontext-node
122+
npm run prepublishOnly
123+
for dir in npm/*/; do
124+
cd "$dir"
125+
npm publish --access public || true
126+
cd ../..
127+
done
128+
env:
129+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
130+
131+
- name: Publish main package
132+
run: |
133+
cd crates/opencontext-node
134+
npm publish --access public
135+
env:
136+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
137+

.gitignore

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Dependencies
2+
node_modules/
3+
4+
# Database
5+
opencontext.db
6+
*.db
7+
8+
# User data
9+
contexts/
10+
11+
# Build outputs
12+
dist/
13+
14+
# Tauri
15+
src-tauri/target/
16+
src-tauri/Cargo.lock
17+
src-tauri/gen/
18+
19+
# Native module builds
20+
crates/opencontext-node/*.node
21+
crates/opencontext-node/target/
22+
crates/opencontext-node/npm/
23+
crates/opencontext-node/Cargo.lock
24+
25+
# Rust
26+
crates/*/target/
27+
*.lock
28+
!package-lock.json
29+
30+
# IDE
31+
.idea/
32+
.vscode/
33+
*.swp
34+
*.swo
35+
*~
36+
37+
# OS
38+
.DS_Store
39+
Thumbs.db
40+
41+
# Logs
42+
*.log
43+
npm-debug.log*
44+
45+
# Test coverage
46+
coverage/
47+
48+
# Environment
49+
.env
50+
.env.local
51+
.env.*.local
52+
53+
# Temporary files
54+
*.tmp
55+
*.temp
56+
.cache/
57+
58+
# Backup files
59+
*.bak
60+
*.backup
61+
62+
# Local config (use mcp.example.json as template)
63+
mcp.json

0 commit comments

Comments
 (0)