@ia-ccun/code-agent-cli 0.0.59-beta.4 → 0.0.59-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/config/agent/extensions/aicode-provider-scope.ts +388 -0
  2. package/config/agent/mcp.json +5 -0
  3. package/config/agent/skills/agent-browser/LICENSE +201 -0
  4. package/config/agent/skills/agent-browser/SKILL.md +55 -0
  5. package/config/agent/skills/codebase-design/DEEPENING.md +37 -0
  6. package/config/agent/skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
  7. package/config/agent/skills/{chroma → codebase-design}/LICENSE +1 -1
  8. package/config/agent/skills/codebase-design/SKILL.md +118 -0
  9. package/config/agent/skills/codebase-design/agents/openai.yaml +3 -0
  10. package/config/agent/skills/domain-modeling/ADR-FORMAT.md +47 -0
  11. package/config/agent/skills/domain-modeling/GLOSSARY-FORMAT.md +61 -0
  12. package/config/agent/skills/{fireworks-tech-graph → domain-modeling}/LICENSE +1 -1
  13. package/config/agent/skills/domain-modeling/SKILL.md +78 -0
  14. package/config/agent/skills/domain-modeling/agents/openai.yaml +3 -0
  15. package/config/agent/skills/frontend-design/SKILL.md +55 -26
  16. package/config/agent/skills/grill-with-docs/LICENSE +21 -0
  17. package/config/agent/skills/grill-with-docs/SKILL.md +21 -0
  18. package/config/agent/skills/grill-with-docs/agents/openai.yaml +5 -0
  19. package/config/agent/skills/grilling/LICENSE +21 -0
  20. package/config/agent/skills/grilling/SKILL.md +34 -0
  21. package/config/agent/skills/grilling/agents/openai.yaml +3 -0
  22. package/config/agent/skills/tdd/LICENSE +21 -0
  23. package/config/agent/skills/tdd/SKILL.md +42 -0
  24. package/config/agent/skills/tdd/agents/openai.yaml +3 -0
  25. package/config/agent/skills/tdd/mocking.md +59 -0
  26. package/config/agent/skills/tdd/tests.md +77 -0
  27. package/config/agent/skills/ui-taste/CHECKSUMS.sha256 +25 -0
  28. package/config/agent/skills/{milvus-skill → ui-taste}/LICENSE +12 -23
  29. package/config/agent/skills/ui-taste/MANIFEST.json +256 -0
  30. package/config/agent/skills/ui-taste/MODIFICATIONS.md +23 -0
  31. package/config/agent/skills/ui-taste/NOTICE +74 -0
  32. package/config/agent/skills/ui-taste/SKILL.md +90 -0
  33. package/config/agent/skills/ui-taste/agents/openai.yaml +4 -0
  34. package/config/agent/skills/ui-taste/reference/anti-slop-craft.md +138 -0
  35. package/config/agent/skills/ui-taste/reference/audit.md +71 -0
  36. package/config/agent/skills/ui-taste/reference/audit.native.md +78 -0
  37. package/config/agent/skills/ui-taste/reference/craft.md +48 -0
  38. package/config/agent/skills/ui-taste/reference/distill.md +20 -0
  39. package/config/agent/skills/ui-taste/reference/image-assets.md +31 -0
  40. package/config/agent/skills/ui-taste/reference/ios.md +35 -0
  41. package/config/agent/skills/ui-taste/reference/mobile-controls.md +37 -0
  42. package/config/agent/skills/ui-taste/reference/mobile-state-performance.md +34 -0
  43. package/config/agent/skills/ui-taste/reference/native-verification.md +33 -0
  44. package/config/agent/skills/ui-taste/reference/new-work.md +87 -0
  45. package/config/agent/skills/ui-taste/reference/operate.md +37 -0
  46. package/config/agent/skills/ui-taste/reference/overdrive.md +65 -0
  47. package/config/agent/skills/ui-taste/reference/polish.md +63 -0
  48. package/config/agent/skills/ui-taste/reference/research.md +45 -0
  49. package/config/agent/skills/ui-taste/references/uizze-image-to-ui.md +77 -0
  50. package/config/agent/skills/ui-taste/references/uizze-reference-policy.md +27 -0
  51. package/config/agent/skills/ui-taste/references/uizze-visual-verification.md +62 -0
  52. package/config/agent/skills/ui-taste/scripts/verify-visual-evidence.mjs +108 -0
  53. package/package.json +5 -5
  54. package/scripts/postinstall.js +19 -0
  55. package/config/agent/extensions/aicode-safety-guard.ts +0 -924
  56. package/config/agent/skills/chroma/chroma-local/SKILL.md +0 -165
  57. package/config/agent/skills/chroma/chroma-local/cli.md +0 -48
  58. package/config/agent/skills/chroma/chroma-local/data-model.md +0 -103
  59. package/config/agent/skills/chroma/chroma-local/error-handling/python.md +0 -166
  60. package/config/agent/skills/chroma/chroma-local/error-handling/typescript.md +0 -231
  61. package/config/agent/skills/chroma/chroma-local/local-chroma/python.md +0 -95
  62. package/config/agent/skills/chroma/chroma-local/local-chroma/typescript.md +0 -101
  63. package/config/agent/skills/chroma/chroma-local/metadata/python.md +0 -154
  64. package/config/agent/skills/chroma/chroma-local/metadata/typescript.md +0 -153
  65. package/config/agent/skills/chroma/chroma-local/querying/python.md +0 -147
  66. package/config/agent/skills/chroma/chroma-local/querying/typescript.md +0 -157
  67. package/config/agent/skills/chroma/chroma-local/regex/python.md +0 -69
  68. package/config/agent/skills/chroma/chroma-local/regex/typescript.md +0 -71
  69. package/config/agent/skills/chroma/chroma-local/understanding-a-codebase.md +0 -80
  70. package/config/agent/skills/chroma/chroma-local/updating-deleting/python.md +0 -159
  71. package/config/agent/skills/chroma/chroma-local/updating-deleting/typescript.md +0 -228
  72. package/config/agent/skills/find-skills/SKILL.md +0 -137
  73. package/config/agent/skills/fireworks-tech-graph/README.md +0 -528
  74. package/config/agent/skills/fireworks-tech-graph/README.zh.md +0 -499
  75. package/config/agent/skills/fireworks-tech-graph/SKILL.md +0 -538
  76. package/config/agent/skills/fireworks-tech-graph/agentloop-core.svg +0 -101
  77. package/config/agent/skills/fireworks-tech-graph/agents/openai.yaml +0 -4
  78. package/config/agent/skills/fireworks-tech-graph/assets/samples/sample-style1-flat.png +0 -0
  79. package/config/agent/skills/fireworks-tech-graph/assets/samples/sample-style2-dark.png +0 -0
  80. package/config/agent/skills/fireworks-tech-graph/assets/samples/sample-style3-blueprint.png +0 -0
  81. package/config/agent/skills/fireworks-tech-graph/assets/samples/sample-style4-notion.png +0 -0
  82. package/config/agent/skills/fireworks-tech-graph/assets/samples/sample-style5-glass.png +0 -0
  83. package/config/agent/skills/fireworks-tech-graph/assets/samples/sample-style6-claude.png +0 -0
  84. package/config/agent/skills/fireworks-tech-graph/assets/samples/sample-style7-openai.png +0 -0
  85. package/config/agent/skills/fireworks-tech-graph/fixtures/agent-memory-types-style4.json +0 -181
  86. package/config/agent/skills/fireworks-tech-graph/fixtures/api-flow-style7.json +0 -40
  87. package/config/agent/skills/fireworks-tech-graph/fixtures/mem0-style1.json +0 -297
  88. package/config/agent/skills/fireworks-tech-graph/fixtures/microservices-style3.json +0 -64
  89. package/config/agent/skills/fireworks-tech-graph/fixtures/multi-agent-style5.json +0 -45
  90. package/config/agent/skills/fireworks-tech-graph/fixtures/system-architecture-style6.json +0 -48
  91. package/config/agent/skills/fireworks-tech-graph/fixtures/tool-call-style2.json +0 -182
  92. package/config/agent/skills/fireworks-tech-graph/package.json +0 -42
  93. package/config/agent/skills/fireworks-tech-graph/references/icons.md +0 -406
  94. package/config/agent/skills/fireworks-tech-graph/references/style-1-flat-icon.md +0 -108
  95. package/config/agent/skills/fireworks-tech-graph/references/style-2-dark-terminal.md +0 -107
  96. package/config/agent/skills/fireworks-tech-graph/references/style-3-blueprint.md +0 -113
  97. package/config/agent/skills/fireworks-tech-graph/references/style-4-notion-clean.md +0 -94
  98. package/config/agent/skills/fireworks-tech-graph/references/style-5-glassmorphism.md +0 -125
  99. package/config/agent/skills/fireworks-tech-graph/references/style-6-claude-official.md +0 -209
  100. package/config/agent/skills/fireworks-tech-graph/references/style-7-openai.md +0 -215
  101. package/config/agent/skills/fireworks-tech-graph/references/style-diagram-matrix.md +0 -135
  102. package/config/agent/skills/fireworks-tech-graph/references/svg-layout-best-practices.md +0 -100
  103. package/config/agent/skills/fireworks-tech-graph/scripts/README.md +0 -244
  104. package/config/agent/skills/fireworks-tech-graph/scripts/generate-diagram.sh +0 -157
  105. package/config/agent/skills/fireworks-tech-graph/scripts/generate-from-template.py +0 -1556
  106. package/config/agent/skills/fireworks-tech-graph/scripts/test-all-styles.sh +0 -135
  107. package/config/agent/skills/fireworks-tech-graph/scripts/validate-svg.sh +0 -292
  108. package/config/agent/skills/fireworks-tech-graph/templates/agent-architecture.svg +0 -28
  109. package/config/agent/skills/fireworks-tech-graph/templates/architecture.svg +0 -23
  110. package/config/agent/skills/fireworks-tech-graph/templates/comparison-matrix.svg +0 -14
  111. package/config/agent/skills/fireworks-tech-graph/templates/data-flow.svg +0 -28
  112. package/config/agent/skills/fireworks-tech-graph/templates/er-diagram.svg +0 -21
  113. package/config/agent/skills/fireworks-tech-graph/templates/flowchart.svg +0 -21
  114. package/config/agent/skills/fireworks-tech-graph/templates/sequence.svg +0 -20
  115. package/config/agent/skills/fireworks-tech-graph/templates/state-machine.svg +0 -20
  116. package/config/agent/skills/fireworks-tech-graph/templates/timeline.svg +0 -19
  117. package/config/agent/skills/fireworks-tech-graph/templates/use-case.svg +0 -21
  118. package/config/agent/skills/hello/SKILL.md +0 -26
  119. package/config/agent/skills/librarian/SKILL.md +0 -199
  120. package/config/agent/skills/milvus-skill/README.md +0 -37
  121. package/config/agent/skills/milvus-skill/SKILL.md +0 -259
  122. package/config/agent/skills/milvus-skill/references/collection.md +0 -86
  123. package/config/agent/skills/milvus-skill/references/database.md +0 -24
  124. package/config/agent/skills/milvus-skill/references/index.md +0 -69
  125. package/config/agent/skills/milvus-skill/references/partition.md +0 -29
  126. package/config/agent/skills/milvus-skill/references/patterns.md +0 -150
  127. package/config/agent/skills/milvus-skill/references/user-role.md +0 -90
  128. package/config/agent/skills/milvus-skill/references/vector.md +0 -247
  129. package/config/agent/skills/pr/SKILL.md +0 -59
@@ -1,69 +0,0 @@
1
- # Index Management — Detailed Reference
2
-
3
- ## Create Index
4
-
5
- ```python
6
- index_params = client.prepare_index_params()
7
-
8
- # Vector index
9
- index_params.add_index(
10
- field_name="embedding",
11
- index_type="HNSW", # See index types table below
12
- metric_type="COSINE", # "COSINE", "L2", "IP"
13
- params={"M": 16, "efConstruction": 256}
14
- )
15
-
16
- # Optional: scalar index
17
- index_params.add_index(
18
- field_name="text",
19
- index_type="" # Auto-select for scalars
20
- )
21
-
22
- client.create_index(
23
- collection_name="my_collection",
24
- index_params=index_params
25
- )
26
- ```
27
-
28
- ## Common Index Types
29
-
30
- | Index Type | For | Key Params | Notes |
31
- |------------|-----|------------|-------|
32
- | `AUTOINDEX` | Dense vectors | Auto-tuned | Recommended for most cases |
33
- | `FLAT` | Dense vectors | None | Brute force, 100% recall |
34
- | `IVF_FLAT` | Dense vectors | `nlist` | Good balance |
35
- | `IVF_SQ8` | Dense vectors | `nlist` | Compressed, less memory |
36
- | `HNSW` | Dense vectors | `M`, `efConstruction` | High recall, more memory |
37
- | `DISKANN` | Dense vectors | None | Disk-based, large datasets |
38
- | `SPARSE_INVERTED_INDEX` | Sparse vectors | `drop_ratio_build` | For sparse vectors |
39
- | `SPARSE_WAND` | Sparse vectors | `drop_ratio_build` | Faster sparse search |
40
-
41
- ## Metric Types
42
-
43
- | Metric | Description | Use With |
44
- |--------|-------------|----------|
45
- | `"COSINE"` | Cosine similarity (larger = more similar) | Dense vectors |
46
- | `"L2"` | Euclidean distance (smaller = more similar) | Dense vectors |
47
- | `"IP"` | Inner product (larger = more similar) | Dense & Sparse vectors |
48
- | `"BM25"` | BM25 relevance scoring | Full-text search (sparse vectors from built-in tokenizer) |
49
-
50
- ## Other Index Operations
51
-
52
- ```python
53
- # List indexes
54
- indexes = client.list_indexes(collection_name="my_collection")
55
-
56
- # Describe an index
57
- info = client.describe_index(collection_name="my_collection", index_name="my_index")
58
-
59
- # Drop an index
60
- client.drop_index(collection_name="my_collection", index_name="my_index")
61
- ```
62
-
63
- ## Guidance
64
-
65
- - `AUTOINDEX` is recommended for most use cases.
66
- - An index is required before loading a collection.
67
- - After creating an index, load the collection before searching.
68
- - Sparse vectors only support `"IP"` metric type.
69
- - For full-text search, use `"BM25"` metric type with `SPARSE_INVERTED_INDEX` or `SPARSE_WAND`.
@@ -1,29 +0,0 @@
1
- # Partition Management
2
-
3
- ```python
4
- # Create a partition
5
- client.create_partition(collection_name="my_collection", partition_name="partition_A")
6
-
7
- # List partitions
8
- partitions = client.list_partitions(collection_name="my_collection")
9
- # Returns: ["_default", "partition_A"]
10
-
11
- # Check if partition exists
12
- exists = client.has_partition(collection_name="my_collection", partition_name="partition_A")
13
-
14
- # Load specific partitions
15
- client.load_partitions(collection_name="my_collection", partition_names=["partition_A"])
16
-
17
- # Release specific partitions
18
- client.release_partitions(collection_name="my_collection", partition_names=["partition_A"])
19
-
20
- # Drop a partition
21
- client.drop_partition(collection_name="my_collection", partition_name="partition_A")
22
- ```
23
-
24
- ## Guidance
25
-
26
- - Every collection has a `_default` partition.
27
- - Use `is_partition_key=True` on a field to enable automatic partitioning by field value.
28
- - A partition must be loaded before search.
29
- - Before dropping a partition, confirm with the user — all data in it will be deleted.
@@ -1,150 +0,0 @@
1
- # Common Patterns
2
-
3
- > **Note:** All patterns below use `<USER_URI>` and `<USER_TOKEN>` as connection placeholders. Always ask the user for their actual connection details before writing code. For local development, use Milvus Lite (`uri="./milvus.db"`) only if the user explicitly requests it.
4
-
5
- ## RAG Pipeline Pattern
6
-
7
- ```python
8
- from pymilvus import MilvusClient, DataType, model
9
-
10
- # 1. Connect (ask user for URI and credentials)
11
- client = MilvusClient(uri="<USER_URI>", token="<USER_TOKEN>")
12
-
13
- # 2. Set up embedding model
14
- embedding_fn = model.dense.SentenceTransformerEmbeddingFunction(model_name="all-MiniLM-L6-v2")
15
-
16
- # 3. Create collection (dim must match embedding model output)
17
- schema = client.create_schema(auto_id=True, enable_dynamic_field=True)
18
- schema.add_field("id", DataType.INT64, is_primary=True)
19
- schema.add_field("text", DataType.VARCHAR, max_length=2048)
20
- schema.add_field("embedding", DataType.FLOAT_VECTOR, dim=384) # all-MiniLM-L6-v2 outputs 384-dim
21
- schema.add_field("source", DataType.VARCHAR, max_length=256)
22
-
23
- index_params = client.prepare_index_params()
24
- index_params.add_index(field_name="embedding", index_type="AUTOINDEX", metric_type="COSINE")
25
-
26
- client.create_collection(collection_name="knowledge_base", schema=schema, index_params=index_params)
27
-
28
- # 4. Insert documents — generate real vectors from text chunks
29
- chunks = ["Milvus is a vector database...", "RAG combines retrieval and generation..."]
30
- vectors = embedding_fn.encode_documents(chunks)
31
-
32
- client.insert("knowledge_base", data=[
33
- {"text": chunk, "embedding": vec, "source": "doc1.pdf"}
34
- for chunk, vec in zip(chunks, vectors)
35
- ])
36
-
37
- # 5. Retrieve relevant context — use the SAME embedding model
38
- query = "What is a vector database?"
39
- query_vectors = embedding_fn.encode_queries([query])
40
-
41
- results = client.search(
42
- collection_name="knowledge_base",
43
- data=query_vectors,
44
- limit=5,
45
- output_fields=["text", "source"],
46
- search_params={"metric_type": "COSINE"}
47
- )
48
- ```
49
-
50
- ## Quick Semantic Search Pattern
51
-
52
- ```python
53
- from pymilvus import MilvusClient, model
54
-
55
- # Simplest possible setup (Milvus Lite for local dev)
56
- client = MilvusClient(uri="./search.db")
57
- embedding_fn = model.dense.SentenceTransformerEmbeddingFunction(model_name="all-MiniLM-L6-v2")
58
-
59
- # Prepare data — vectors come from embedding model
60
- texts = ["first document", "second document", "third document"]
61
- vectors = embedding_fn.encode_documents(texts)
62
-
63
- client.create_collection(collection_name="docs", dimension=384)
64
- client.insert("docs", data=[
65
- {"id": i, "vector": vec, "text": txt}
66
- for i, (vec, txt) in enumerate(zip(vectors, texts))
67
- ])
68
-
69
- # Search — encode query with the same model
70
- query_vectors = embedding_fn.encode_queries(["search query"])
71
- results = client.search("docs", data=query_vectors, limit=10, output_fields=["text"])
72
- ```
73
-
74
- ## Hybrid Search Pattern (Dense + Sparse)
75
-
76
- ```python
77
- from pymilvus import MilvusClient, DataType, AnnSearchRequest, RRFRanker
78
-
79
- # Ask user for connection details
80
- client = MilvusClient(uri="<USER_URI>", token="<USER_TOKEN>")
81
-
82
- # Schema with both dense and sparse vectors
83
- schema = client.create_schema(auto_id=True)
84
- schema.add_field("id", DataType.INT64, is_primary=True)
85
- schema.add_field("text", DataType.VARCHAR, max_length=2048)
86
- schema.add_field("dense_embedding", DataType.FLOAT_VECTOR, dim=768)
87
- schema.add_field("sparse_embedding", DataType.SPARSE_FLOAT_VECTOR)
88
-
89
- index_params = client.prepare_index_params()
90
- index_params.add_index(field_name="dense_embedding", index_type="AUTOINDEX", metric_type="COSINE")
91
- index_params.add_index(field_name="sparse_embedding", index_type="SPARSE_INVERTED_INDEX", metric_type="IP")
92
-
93
- client.create_collection(collection_name="hybrid_col", schema=schema, index_params=index_params)
94
-
95
- # Search with both vectors and fuse results
96
- # dense_query_vector and sparse_query_vector come from your respective embedding models
97
- req1 = AnnSearchRequest(data=[dense_query_vector], anns_field="dense_embedding",
98
- param={"metric_type": "COSINE"}, limit=20)
99
- req2 = AnnSearchRequest(data=[sparse_query_vector], anns_field="sparse_embedding",
100
- param={"metric_type": "IP"}, limit=20)
101
-
102
- results = client.hybrid_search(
103
- collection_name="hybrid_col",
104
- reqs=[req1, req2],
105
- ranker=RRFRanker(k=60),
106
- limit=10,
107
- output_fields=["text"]
108
- )
109
- ```
110
-
111
- ## Full-Text Search Pattern (BM25)
112
-
113
- ```python
114
- from pymilvus import MilvusClient, DataType, Function, FunctionType
115
-
116
- # Ask user for connection details
117
- client = MilvusClient(uri="<USER_URI>", token="<USER_TOKEN>")
118
-
119
- schema = client.create_schema(auto_id=True)
120
- schema.add_field("id", DataType.INT64, is_primary=True)
121
- schema.add_field("title", DataType.VARCHAR, max_length=512)
122
- schema.add_field("body", DataType.VARCHAR, max_length=4096, enable_analyzer=True)
123
- schema.add_field("body_sparse", DataType.SPARSE_FLOAT_VECTOR)
124
-
125
- schema.add_function(Function(
126
- name="body_bm25",
127
- input_field_names=["body"],
128
- output_field_names=["body_sparse"],
129
- function_type=FunctionType.BM25,
130
- ))
131
-
132
- index_params = client.prepare_index_params()
133
- index_params.add_index(field_name="body_sparse", index_type="AUTOINDEX", metric_type="BM25")
134
-
135
- client.create_collection(collection_name="articles", schema=schema, index_params=index_params)
136
-
137
- # Insert — only provide text, sparse vector is auto-generated by BM25 function
138
- client.insert("articles", data=[
139
- {"title": "Intro to ML", "body": "Machine learning is a subset of artificial intelligence..."},
140
- ])
141
-
142
- # Search with raw text — no embedding model needed, Milvus handles BM25 tokenization
143
- results = client.search(
144
- collection_name="articles",
145
- data=["machine learning fundamentals"],
146
- anns_field="body_sparse",
147
- limit=10,
148
- output_fields=["title", "body"]
149
- )
150
- ```
@@ -1,90 +0,0 @@
1
- # User & Role Management (RBAC)
2
-
3
- ## User Operations
4
-
5
- ```python
6
- # Create a user
7
- client.create_user(user_name="analyst", password="SecureP@ss123")
8
-
9
- # List users
10
- users = client.list_users()
11
-
12
- # Describe a user (shows assigned roles)
13
- info = client.describe_user(user_name="analyst")
14
-
15
- # Update password
16
- client.update_password(user_name="analyst", old_password="SecureP@ss123", new_password="NewP@ss456")
17
-
18
- # Grant role to user
19
- client.grant_role(user_name="analyst", role_name="read_only")
20
-
21
- # Revoke role from user
22
- client.revoke_role(user_name="analyst", role_name="read_only")
23
-
24
- # Drop a user
25
- client.drop_user(user_name="analyst")
26
- ```
27
-
28
- ## Role Operations
29
-
30
- ```python
31
- # Create a role
32
- client.create_role(role_name="read_only")
33
-
34
- # List roles
35
- roles = client.list_roles()
36
-
37
- # Grant privilege (v2 API — recommended)
38
- client.grant_privilege_v2(
39
- role_name="read_only",
40
- privilege="Search", # e.g., "Search", "Insert", "Query", "Delete"
41
- collection_name="my_collection", # Use "*" for all collections
42
- db_name="default" # Use "*" for all databases
43
- )
44
-
45
- # Built-in privilege groups
46
- client.grant_privilege_v2(
47
- role_name="admin_role",
48
- privilege="ClusterAdmin", # See privilege groups below
49
- collection_name="*",
50
- db_name="*"
51
- )
52
-
53
- # Revoke privilege
54
- client.revoke_privilege_v2(
55
- role_name="read_only",
56
- privilege="Search",
57
- collection_name="my_collection",
58
- db_name="default"
59
- )
60
-
61
- # Describe role (see granted privileges)
62
- info = client.describe_role(role_name="read_only")
63
-
64
- # Drop a role
65
- client.drop_role(role_name="read_only")
66
- ```
67
-
68
- ## Built-in Privilege Groups
69
-
70
- | Group | Scope |
71
- |-------|-------|
72
- | `ClusterAdmin` | Full cluster access |
73
- | `ClusterReadOnly` | Read-only cluster access |
74
- | `ClusterReadWrite` | Read-write cluster access |
75
- | `DatabaseAdmin` | Full database access |
76
- | `DatabaseReadOnly` | Read-only database access |
77
- | `DatabaseReadWrite` | Read-write database access |
78
- | `CollectionAdmin` | Full collection access |
79
- | `CollectionReadOnly` | Read-only collection access |
80
- | `CollectionReadWrite` | Read-write collection access |
81
-
82
- ## Common Individual Privileges
83
-
84
- `Search`, `Query`, `Insert`, `Delete`, `Upsert`, `CreateIndex`, `DropIndex`, `CreateCollection`, `DropCollection`, `Load`, `Release`, `CreatePartition`, `DropPartition`
85
-
86
- ## Guidance
87
-
88
- - Recommended workflow: create role -> grant privileges -> create user -> assign role.
89
- - Use `"*"` for collection_name/db_name to grant on all resources.
90
- - Before dropping a user or role, confirm with the user.
@@ -1,247 +0,0 @@
1
- # Vector Operations — Detailed Reference
2
-
3
- Target collection must exist and be loaded.
4
-
5
- > **Never use fake or placeholder vectors** (e.g., `[0.1, 0.2, ...]`). Always generate vectors from an embedding model. Use `pip install "pymilvus[model]"` for built-in embedding support, or use any external embedding model (OpenAI, Cohere, HuggingFace, etc.).
6
-
7
- ## Embedding Model Setup
8
-
9
- ```python
10
- # Option 1: Built-in pymilvus embedding (pip install "pymilvus[model]")
11
- from pymilvus import model
12
- embedding_fn = model.dense.SentenceTransformerEmbeddingFunction(model_name="all-MiniLM-L6-v2")
13
-
14
- # Encode documents for insertion
15
- doc_vectors = embedding_fn.encode_documents(["AI advances in 2024", "ML basics for beginners"])
16
- # Encode queries for search (use the SAME model that encoded the stored documents)
17
- query_vectors = embedding_fn.encode_queries(["What is artificial intelligence?"])
18
-
19
- # Option 2: OpenAI embeddings (pip install openai)
20
- from openai import OpenAI
21
- openai_client = OpenAI()
22
- response = openai_client.embeddings.create(input=["some text"], model="text-embedding-3-small")
23
- vectors = [item.embedding for item in response.data]
24
- ```
25
-
26
- ## Insert
27
-
28
- ```python
29
- docs = ["AI advances in 2024", "ML basics for beginners"]
30
- vectors = embedding_fn.encode_documents(docs)
31
-
32
- data = [
33
- {"id": 1, "text": docs[0], "embedding": vectors[0]},
34
- {"id": 2, "text": docs[1], "embedding": vectors[1]},
35
- ]
36
- res = client.insert(collection_name="my_collection", data=data)
37
- # Returns: {"insert_count": 2, "ids": [1, 2]}
38
- ```
39
-
40
- ## Upsert (insert or update if PK exists)
41
-
42
- ```python
43
- res = client.upsert(collection_name="my_collection", data=data)
44
- # Returns: {"upsert_count": 2}
45
- ```
46
-
47
- ## Search (vector similarity)
48
-
49
- ```python
50
- query_vectors = embedding_fn.encode_queries(["What is artificial intelligence?"])
51
-
52
- results = client.search(
53
- collection_name="my_collection",
54
- data=query_vectors, # Vectors from embedding model
55
- anns_field="embedding", # Vector field name
56
- limit=10, # Top-K
57
- output_fields=["text", "id"], # Fields to return
58
- filter='age > 20 and status == "active"', # Optional scalar filter
59
- search_params={
60
- "metric_type": "COSINE",
61
- "params": {"nprobe": 10} # Index-specific params
62
- }
63
- )
64
- # Returns: List[List[dict]]
65
- # Each hit: {"id": 1, "distance": 0.95, "entity": {"text": "AI advances..."}}
66
- ```
67
-
68
- ## Hybrid Search (multi-vector with reranking)
69
-
70
- ```python
71
- from pymilvus import AnnSearchRequest, RRFRanker, WeightedRanker
72
-
73
- # dense_query_vector and sparse_query_vector come from your embedding models
74
- req1 = AnnSearchRequest(
75
- data=[dense_query_vector],
76
- anns_field="dense_embedding",
77
- param={"metric_type": "COSINE", "params": {"nprobe": 10}},
78
- limit=10
79
- )
80
- req2 = AnnSearchRequest(
81
- data=[{1: 0.5, 100: 0.3}], # Sparse vector
82
- anns_field="sparse_embedding",
83
- param={"metric_type": "IP"},
84
- limit=10
85
- )
86
-
87
- # RRF reranking
88
- results = client.hybrid_search(
89
- collection_name="my_collection",
90
- reqs=[req1, req2],
91
- ranker=RRFRanker(k=60),
92
- limit=10,
93
- output_fields=["text"]
94
- )
95
-
96
- # Or weighted reranking
97
- results = client.hybrid_search(
98
- collection_name="my_collection",
99
- reqs=[req1, req2],
100
- ranker=WeightedRanker(0.7, 0.3),
101
- limit=10
102
- )
103
- ```
104
-
105
- ## Full-Text Search
106
-
107
- Full-text search uses Milvus's built-in BM25 tokenizer to convert text into sparse vectors automatically.
108
-
109
- ### Setup: Collection with Full-Text Search
110
-
111
- ```python
112
- from pymilvus import MilvusClient, DataType, Function, FunctionType
113
-
114
- client = MilvusClient(uri="<USER_URI>", token="<USER_TOKEN>")
115
-
116
- schema = client.create_schema()
117
- schema.add_field("id", DataType.INT64, is_primary=True, auto_id=True)
118
- schema.add_field("text", DataType.VARCHAR, max_length=1000, enable_analyzer=True)
119
- schema.add_field("sparse", DataType.SPARSE_FLOAT_VECTOR)
120
-
121
- # Define BM25 function to auto-convert text -> sparse vector
122
- bm25_function = Function(
123
- name="text_bm25",
124
- input_field_names=["text"],
125
- output_field_names=["sparse"],
126
- function_type=FunctionType.BM25,
127
- )
128
- schema.add_function(bm25_function)
129
-
130
- index_params = client.prepare_index_params()
131
- index_params.add_index(field_name="sparse", index_type="AUTOINDEX", metric_type="BM25")
132
-
133
- client.create_collection(collection_name="full_text_col", schema=schema, index_params=index_params)
134
- ```
135
-
136
- ### Search with Text
137
-
138
- ```python
139
- results = client.search(
140
- collection_name="full_text_col",
141
- data=["machine learning algorithms"], # Raw text query
142
- anns_field="sparse",
143
- limit=10,
144
- output_fields=["text"]
145
- )
146
- ```
147
-
148
- ## Search Iterator (paginated search over large results)
149
-
150
- ```python
151
- query_vectors = embedding_fn.encode_queries(["search query text"])
152
-
153
- iterator = client.search_iterator(
154
- collection_name="my_collection",
155
- data=query_vectors,
156
- anns_field="embedding",
157
- batch_size=100,
158
- limit=10000,
159
- output_fields=["text"],
160
- search_params={"metric_type": "COSINE", "params": {"nprobe": 10}}
161
- )
162
-
163
- results = []
164
- while True:
165
- batch = iterator.next()
166
- if not batch:
167
- break
168
- results.extend(batch)
169
-
170
- iterator.close()
171
- ```
172
-
173
- ## Query Iterator (paginated filter-based retrieval)
174
-
175
- ```python
176
- iterator = client.query_iterator(
177
- collection_name="my_collection",
178
- filter='age > 20',
179
- output_fields=["text", "age"],
180
- batch_size=100,
181
- limit=10000
182
- )
183
-
184
- results = []
185
- while True:
186
- batch = iterator.next()
187
- if not batch:
188
- break
189
- results.extend(batch)
190
-
191
- iterator.close()
192
- ```
193
-
194
- ## Query (filter-based retrieval)
195
-
196
- ```python
197
- results = client.query(
198
- collection_name="my_collection",
199
- filter='id in [1, 2, 3]',
200
- output_fields=["text", "embedding"],
201
- limit=100
202
- )
203
- ```
204
-
205
- ## Get (by primary key)
206
-
207
- ```python
208
- results = client.get(
209
- collection_name="my_collection",
210
- ids=[1, 2, 3],
211
- output_fields=["text"]
212
- )
213
- ```
214
-
215
- ## Delete
216
-
217
- ```python
218
- # By primary keys
219
- client.delete(collection_name="my_collection", ids=[1, 2, 3])
220
-
221
- # By filter expression
222
- client.delete(collection_name="my_collection", filter='status == "obsolete"')
223
- ```
224
-
225
- ## Filter Expression Syntax
226
-
227
- | Expression | Example |
228
- |---|---|
229
- | Comparison | `age > 20` |
230
- | Equality | `status == "active"` |
231
- | IN list | `id in [1, 2, 3]` |
232
- | AND/OR | `age > 20 and status == "active"` |
233
- | String match | `text like "hello%"` |
234
- | Array contains | `ARRAY_CONTAINS(tags, "ml")` |
235
- | JSON field | `json_field["key"] > 100` |
236
- | Match all | `id > 0` |
237
-
238
- ## Guidance
239
-
240
- - **Never use fake or placeholder vectors.** Always generate vectors from an embedding model.
241
- - The query embedding model must be the **same model** used to generate the stored vectors.
242
- - The `data` parameter in search must match the collection's vector dimension exactly.
243
- - For full-text search, pass raw text strings as `data` — Milvus handles tokenization via BM25.
244
- - For large inserts, batch data into chunks (e.g., 1000 rows per batch).
245
- - Always specify `output_fields` to control which fields are returned.
246
- - For large result sets, use `search_iterator` or `query_iterator` instead of increasing `limit`.
247
- - Always call `iterator.close()` when done to release server resources.
@@ -1,59 +0,0 @@
1
- ---
2
- name: pr
3
- description: "分析代码变更并生成规范的 Pull Request 描述。Use when generating PR descriptions, creating pull requests, or documenting changes."
4
- disable-model-invocation: true
5
- metadata:
6
- version: "1.0.0"
7
- author: "xujianjiang"
8
- ---
9
-
10
- # Git PR 描述 Skill
11
-
12
- ## 描述
13
- 分析代码变更并生成规范的 Pull Request 描述。
14
-
15
- ## 触发方式
16
- `/skill:pr`
17
-
18
- ## 执行步骤
19
-
20
- 1. **获取变更信息**
21
- - 运行 `git log --oneline -10` 查看最近提交
22
- - 运行 `git diff main...HEAD` 或 `git diff master...HEAD` 获取完整变更
23
-
24
- 2. **分析变更内容**
25
- - 识别新增功能
26
- - 识别 bug 修复
27
- - 识别性能优化
28
- - 识别重构
29
-
30
- 3. **生成 PR 描述**
31
- - 标题:简明扼要
32
- - 描述:详细说明变更内容和动机
33
- - 类型:Feature / Bug Fix / Refactor / Docs 等
34
-
35
- ## 输出格式
36
-
37
- ```markdown
38
- ## Summary
39
- [简短描述本次 PR 的目的]
40
-
41
- ## Changes
42
- - [变更点 1]
43
- - [变更点 2]
44
- - [变更点 3]
45
-
46
- ## Testing
47
- - [测试方法]
48
- - [测试结果]
49
-
50
- ## Checklist
51
- - [ ] 代码已自测
52
- - [ ] 已更新相关文档
53
- - [ ] 已添加测试用例
54
- ```
55
-
56
- ## 注意事项
57
- - 保持描述清晰完整
58
- - 包含测试验证信息
59
- - 说明是否需要特别关注