adtec-core-package 2.9.5 → 2.9.7
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.
- package/.claude/skills/gitnexus/gitnexus-cli/SKILL.md +83 -0
- package/.claude/skills/gitnexus/gitnexus-debugging/SKILL.md +89 -0
- package/.claude/skills/gitnexus/gitnexus-exploring/SKILL.md +78 -0
- package/.claude/skills/gitnexus/gitnexus-guide/SKILL.md +64 -0
- package/.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md +97 -0
- package/.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md +121 -0
- package/AGENTS.md +43 -0
- package/CLAUDE.md +43 -0
- package/package.json +1 -1
- package/src/components/bpmntree/views/flowDesign/nodes/JumpNode.vue +16 -4
- package/src/components/bpmntree/views/flowDesign/panels/JumpPanel.vue +2 -1
- package/src/components/upload/CustomElUpload.vue +61 -47
- package/src/hooks/useListenerHooks.ts +81 -52
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gitnexus-cli
|
|
3
|
+
description: "Use when the user needs to run GitNexus CLI commands like analyze/index a repo, check status, clean the index, generate a wiki, or list indexed repos. Examples: \"Index this repo\", \"Reanalyze the codebase\", \"Generate a wiki\""
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# GitNexus CLI Commands
|
|
7
|
+
|
|
8
|
+
All commands work via `npx` — no global install required.
|
|
9
|
+
|
|
10
|
+
## Commands
|
|
11
|
+
|
|
12
|
+
### analyze — Build or refresh the index
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npx gitnexus analyze
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Run from the project root. This parses all source files, builds the knowledge graph, writes it to `.gitnexus/`, and generates CLAUDE.md / AGENTS.md context files.
|
|
19
|
+
|
|
20
|
+
| Flag | Effect |
|
|
21
|
+
| -------------- | ---------------------------------------------------------------- |
|
|
22
|
+
| `--force` | Force full re-index even if up to date |
|
|
23
|
+
| `--embeddings` | Enable embedding generation for semantic search (off by default) |
|
|
24
|
+
| `--drop-embeddings` | Drop existing embeddings on rebuild. By default, an `analyze` without `--embeddings` preserves them. |
|
|
25
|
+
|
|
26
|
+
**When to run:** First time in a project, after major code changes, or when `gitnexus://repo/{name}/context` reports the index is stale. In Claude Code, a PostToolUse hook detects staleness after `git commit` and `git merge` and notifies the agent to run `analyze` — the hook does not run analyze itself, to avoid blocking the agent for up to 120s and risking KuzuDB corruption on timeout.
|
|
27
|
+
|
|
28
|
+
### status — Check index freshness
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx gitnexus status
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Shows whether the current repo has a GitNexus index, when it was last updated, and symbol/relationship counts. Use this to check if re-indexing is needed.
|
|
35
|
+
|
|
36
|
+
### clean — Delete the index
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
npx gitnexus clean
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Deletes the `.gitnexus/` directory and unregisters the repo from the global registry. Use before re-indexing if the index is corrupt or after removing GitNexus from a project.
|
|
43
|
+
|
|
44
|
+
| Flag | Effect |
|
|
45
|
+
| --------- | ------------------------------------------------- |
|
|
46
|
+
| `--force` | Skip confirmation prompt |
|
|
47
|
+
| `--all` | Clean all indexed repos, not just the current one |
|
|
48
|
+
|
|
49
|
+
### wiki — Generate documentation from the graph
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npx gitnexus wiki
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Generates repository documentation from the knowledge graph using an LLM. Requires an API key (saved to `~/.gitnexus/config.json` on first use).
|
|
56
|
+
|
|
57
|
+
| Flag | Effect |
|
|
58
|
+
| ------------------- | ----------------------------------------- |
|
|
59
|
+
| `--force` | Force full regeneration |
|
|
60
|
+
| `--model <model>` | LLM model (default: minimax/minimax-m2.5) |
|
|
61
|
+
| `--base-url <url>` | LLM API base URL |
|
|
62
|
+
| `--api-key <key>` | LLM API key |
|
|
63
|
+
| `--concurrency <n>` | Parallel LLM calls (default: 3) |
|
|
64
|
+
| `--gist` | Publish wiki as a public GitHub Gist |
|
|
65
|
+
|
|
66
|
+
### list — Show all indexed repos
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npx gitnexus list
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Lists all repositories registered in `~/.gitnexus/registry.json`. The MCP `list_repos` tool provides the same information.
|
|
73
|
+
|
|
74
|
+
## After Indexing
|
|
75
|
+
|
|
76
|
+
1. **Read `gitnexus://repo/{name}/context`** to verify the index loaded
|
|
77
|
+
2. Use the other GitNexus skills (`exploring`, `debugging`, `impact-analysis`, `refactoring`) for your task
|
|
78
|
+
|
|
79
|
+
## Troubleshooting
|
|
80
|
+
|
|
81
|
+
- **"Not inside a git repository"**: Run from a directory inside a git repo
|
|
82
|
+
- **Index is stale after re-analyzing**: Restart Claude Code to reload the MCP server
|
|
83
|
+
- **Embeddings slow**: Omit `--embeddings` (it's off by default) or set `OPENAI_API_KEY` for faster API-based embedding
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gitnexus-debugging
|
|
3
|
+
description: "Use when the user is debugging a bug, tracing an error, or asking why something fails. Examples: \"Why is X failing?\", \"Where does this error come from?\", \"Trace this bug\""
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Debugging with GitNexus
|
|
7
|
+
|
|
8
|
+
## When to Use
|
|
9
|
+
|
|
10
|
+
- "Why is this function failing?"
|
|
11
|
+
- "Trace where this error comes from"
|
|
12
|
+
- "Who calls this method?"
|
|
13
|
+
- "This endpoint returns 500"
|
|
14
|
+
- Investigating bugs, errors, or unexpected behavior
|
|
15
|
+
|
|
16
|
+
## Workflow
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
1. gitnexus_query({query: "<error or symptom>"}) → Find related execution flows
|
|
20
|
+
2. gitnexus_context({name: "<suspect>"}) → See callers/callees/processes
|
|
21
|
+
3. READ gitnexus://repo/{name}/process/{name} → Trace execution flow
|
|
22
|
+
4. gitnexus_cypher({query: "MATCH path..."}) → Custom traces if needed
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
> If "Index is stale" → run `npx gitnexus analyze` in terminal.
|
|
26
|
+
|
|
27
|
+
## Checklist
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
- [ ] Understand the symptom (error message, unexpected behavior)
|
|
31
|
+
- [ ] gitnexus_query for error text or related code
|
|
32
|
+
- [ ] Identify the suspect function from returned processes
|
|
33
|
+
- [ ] gitnexus_context to see callers and callees
|
|
34
|
+
- [ ] Trace execution flow via process resource if applicable
|
|
35
|
+
- [ ] gitnexus_cypher for custom call chain traces if needed
|
|
36
|
+
- [ ] Read source files to confirm root cause
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Debugging Patterns
|
|
40
|
+
|
|
41
|
+
| Symptom | GitNexus Approach |
|
|
42
|
+
| -------------------- | ---------------------------------------------------------- |
|
|
43
|
+
| Error message | `gitnexus_query` for error text → `context` on throw sites |
|
|
44
|
+
| Wrong return value | `context` on the function → trace callees for data flow |
|
|
45
|
+
| Intermittent failure | `context` → look for external calls, async deps |
|
|
46
|
+
| Performance issue | `context` → find symbols with many callers (hot paths) |
|
|
47
|
+
| Recent regression | `detect_changes` to see what your changes affect |
|
|
48
|
+
|
|
49
|
+
## Tools
|
|
50
|
+
|
|
51
|
+
**gitnexus_query** — find code related to error:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
gitnexus_query({query: "payment validation error"})
|
|
55
|
+
→ Processes: CheckoutFlow, ErrorHandling
|
|
56
|
+
→ Symbols: validatePayment, handlePaymentError, PaymentException
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**gitnexus_context** — full context for a suspect:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
gitnexus_context({name: "validatePayment"})
|
|
63
|
+
→ Incoming calls: processCheckout, webhookHandler
|
|
64
|
+
→ Outgoing calls: verifyCard, fetchRates (external API!)
|
|
65
|
+
→ Processes: CheckoutFlow (step 3/7)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**gitnexus_cypher** — custom call chain traces:
|
|
69
|
+
|
|
70
|
+
```cypher
|
|
71
|
+
MATCH path = (a)-[:CodeRelation {type: 'CALLS'}*1..2]->(b:Function {name: "validatePayment"})
|
|
72
|
+
RETURN [n IN nodes(path) | n.name] AS chain
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Example: "Payment endpoint returns 500 intermittently"
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
1. gitnexus_query({query: "payment error handling"})
|
|
79
|
+
→ Processes: CheckoutFlow, ErrorHandling
|
|
80
|
+
→ Symbols: validatePayment, handlePaymentError
|
|
81
|
+
|
|
82
|
+
2. gitnexus_context({name: "validatePayment"})
|
|
83
|
+
→ Outgoing calls: verifyCard, fetchRates (external API!)
|
|
84
|
+
|
|
85
|
+
3. READ gitnexus://repo/my-app/process/CheckoutFlow
|
|
86
|
+
→ Step 3: validatePayment → calls fetchRates (external)
|
|
87
|
+
|
|
88
|
+
4. Root cause: fetchRates calls external API without proper timeout
|
|
89
|
+
```
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gitnexus-exploring
|
|
3
|
+
description: "Use when the user asks how code works, wants to understand architecture, trace execution flows, or explore unfamiliar parts of the codebase. Examples: \"How does X work?\", \"What calls this function?\", \"Show me the auth flow\""
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Exploring Codebases with GitNexus
|
|
7
|
+
|
|
8
|
+
## When to Use
|
|
9
|
+
|
|
10
|
+
- "How does authentication work?"
|
|
11
|
+
- "What's the project structure?"
|
|
12
|
+
- "Show me the main components"
|
|
13
|
+
- "Where is the database logic?"
|
|
14
|
+
- Understanding code you haven't seen before
|
|
15
|
+
|
|
16
|
+
## Workflow
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
1. READ gitnexus://repos → Discover indexed repos
|
|
20
|
+
2. READ gitnexus://repo/{name}/context → Codebase overview, check staleness
|
|
21
|
+
3. gitnexus_query({query: "<what you want to understand>"}) → Find related execution flows
|
|
22
|
+
4. gitnexus_context({name: "<symbol>"}) → Deep dive on specific symbol
|
|
23
|
+
5. READ gitnexus://repo/{name}/process/{name} → Trace full execution flow
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
> If step 2 says "Index is stale" → run `npx gitnexus analyze` in terminal.
|
|
27
|
+
|
|
28
|
+
## Checklist
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
- [ ] READ gitnexus://repo/{name}/context
|
|
32
|
+
- [ ] gitnexus_query for the concept you want to understand
|
|
33
|
+
- [ ] Review returned processes (execution flows)
|
|
34
|
+
- [ ] gitnexus_context on key symbols for callers/callees
|
|
35
|
+
- [ ] READ process resource for full execution traces
|
|
36
|
+
- [ ] Read source files for implementation details
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Resources
|
|
40
|
+
|
|
41
|
+
| Resource | What you get |
|
|
42
|
+
| --------------------------------------- | ------------------------------------------------------- |
|
|
43
|
+
| `gitnexus://repo/{name}/context` | Stats, staleness warning (~150 tokens) |
|
|
44
|
+
| `gitnexus://repo/{name}/clusters` | All functional areas with cohesion scores (~300 tokens) |
|
|
45
|
+
| `gitnexus://repo/{name}/cluster/{name}` | Area members with file paths (~500 tokens) |
|
|
46
|
+
| `gitnexus://repo/{name}/process/{name}` | Step-by-step execution trace (~200 tokens) |
|
|
47
|
+
|
|
48
|
+
## Tools
|
|
49
|
+
|
|
50
|
+
**gitnexus_query** — find execution flows related to a concept:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
gitnexus_query({query: "payment processing"})
|
|
54
|
+
→ Processes: CheckoutFlow, RefundFlow, WebhookHandler
|
|
55
|
+
→ Symbols grouped by flow with file locations
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**gitnexus_context** — 360-degree view of a symbol:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
gitnexus_context({name: "validateUser"})
|
|
62
|
+
→ Incoming calls: loginHandler, apiMiddleware
|
|
63
|
+
→ Outgoing calls: checkToken, getUserById
|
|
64
|
+
→ Processes: LoginFlow (step 2/5), TokenRefresh (step 1/3)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Example: "How does payment processing work?"
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
1. READ gitnexus://repo/my-app/context → 918 symbols, 45 processes
|
|
71
|
+
2. gitnexus_query({query: "payment processing"})
|
|
72
|
+
→ CheckoutFlow: processPayment → validateCard → chargeStripe
|
|
73
|
+
→ RefundFlow: initiateRefund → calculateRefund → processRefund
|
|
74
|
+
3. gitnexus_context({name: "processPayment"})
|
|
75
|
+
→ Incoming: checkoutHandler, webhookHandler
|
|
76
|
+
→ Outgoing: validateCard, chargeStripe, saveTransaction
|
|
77
|
+
4. Read src/payments/processor.ts for implementation details
|
|
78
|
+
```
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gitnexus-guide
|
|
3
|
+
description: "Use when the user asks about GitNexus itself — available tools, how to query the knowledge graph, MCP resources, graph schema, or workflow reference. Examples: \"What GitNexus tools are available?\", \"How do I use GitNexus?\""
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# GitNexus Guide
|
|
7
|
+
|
|
8
|
+
Quick reference for all GitNexus MCP tools, resources, and the knowledge graph schema.
|
|
9
|
+
|
|
10
|
+
## Always Start Here
|
|
11
|
+
|
|
12
|
+
For any task involving code understanding, debugging, impact analysis, or refactoring:
|
|
13
|
+
|
|
14
|
+
1. **Read `gitnexus://repo/{name}/context`** — codebase overview + check index freshness
|
|
15
|
+
2. **Match your task to a skill below** and **read that skill file**
|
|
16
|
+
3. **Follow the skill's workflow and checklist**
|
|
17
|
+
|
|
18
|
+
> If step 1 warns the index is stale, run `npx gitnexus analyze` in the terminal first.
|
|
19
|
+
|
|
20
|
+
## Skills
|
|
21
|
+
|
|
22
|
+
| Task | Skill to read |
|
|
23
|
+
| -------------------------------------------- | ------------------- |
|
|
24
|
+
| Understand architecture / "How does X work?" | `gitnexus-exploring` |
|
|
25
|
+
| Blast radius / "What breaks if I change X?" | `gitnexus-impact-analysis` |
|
|
26
|
+
| Trace bugs / "Why is X failing?" | `gitnexus-debugging` |
|
|
27
|
+
| Rename / extract / split / refactor | `gitnexus-refactoring` |
|
|
28
|
+
| Tools, resources, schema reference | `gitnexus-guide` (this file) |
|
|
29
|
+
| Index, status, clean, wiki CLI commands | `gitnexus-cli` |
|
|
30
|
+
|
|
31
|
+
## Tools Reference
|
|
32
|
+
|
|
33
|
+
| Tool | What it gives you |
|
|
34
|
+
| ---------------- | ------------------------------------------------------------------------ |
|
|
35
|
+
| `query` | Process-grouped code intelligence — execution flows related to a concept |
|
|
36
|
+
| `context` | 360-degree symbol view — categorized refs, processes it participates in |
|
|
37
|
+
| `impact` | Symbol blast radius — what breaks at depth 1/2/3 with confidence |
|
|
38
|
+
| `detect_changes` | Git-diff impact — what do your current changes affect |
|
|
39
|
+
| `rename` | Multi-file coordinated rename with confidence-tagged edits |
|
|
40
|
+
| `cypher` | Raw graph queries (read `gitnexus://repo/{name}/schema` first) |
|
|
41
|
+
| `list_repos` | Discover indexed repos |
|
|
42
|
+
|
|
43
|
+
## Resources Reference
|
|
44
|
+
|
|
45
|
+
Lightweight reads (~100-500 tokens) for navigation:
|
|
46
|
+
|
|
47
|
+
| Resource | Content |
|
|
48
|
+
| ---------------------------------------------- | ----------------------------------------- |
|
|
49
|
+
| `gitnexus://repo/{name}/context` | Stats, staleness check |
|
|
50
|
+
| `gitnexus://repo/{name}/clusters` | All functional areas with cohesion scores |
|
|
51
|
+
| `gitnexus://repo/{name}/cluster/{clusterName}` | Area members |
|
|
52
|
+
| `gitnexus://repo/{name}/processes` | All execution flows |
|
|
53
|
+
| `gitnexus://repo/{name}/process/{processName}` | Step-by-step trace |
|
|
54
|
+
| `gitnexus://repo/{name}/schema` | Graph schema for Cypher |
|
|
55
|
+
|
|
56
|
+
## Graph Schema
|
|
57
|
+
|
|
58
|
+
**Nodes:** File, Function, Class, Interface, Method, Community, Process
|
|
59
|
+
**Edges (via CodeRelation.type):** CALLS, IMPORTS, EXTENDS, IMPLEMENTS, DEFINES, MEMBER_OF, STEP_IN_PROCESS
|
|
60
|
+
|
|
61
|
+
```cypher
|
|
62
|
+
MATCH (caller)-[:CodeRelation {type: 'CALLS'}]->(f:Function {name: "myFunc"})
|
|
63
|
+
RETURN caller.name, caller.filePath
|
|
64
|
+
```
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gitnexus-impact-analysis
|
|
3
|
+
description: "Use when the user wants to know what will break if they change something, or needs safety analysis before editing code. Examples: \"Is it safe to change X?\", \"What depends on this?\", \"What will break?\""
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Impact Analysis with GitNexus
|
|
7
|
+
|
|
8
|
+
## When to Use
|
|
9
|
+
|
|
10
|
+
- "Is it safe to change this function?"
|
|
11
|
+
- "What will break if I modify X?"
|
|
12
|
+
- "Show me the blast radius"
|
|
13
|
+
- "Who uses this code?"
|
|
14
|
+
- Before making non-trivial code changes
|
|
15
|
+
- Before committing — to understand what your changes affect
|
|
16
|
+
|
|
17
|
+
## Workflow
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
1. gitnexus_impact({target: "X", direction: "upstream"}) → What depends on this
|
|
21
|
+
2. READ gitnexus://repo/{name}/processes → Check affected execution flows
|
|
22
|
+
3. gitnexus_detect_changes() → Map current git changes to affected flows
|
|
23
|
+
4. Assess risk and report to user
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
> If "Index is stale" → run `npx gitnexus analyze` in terminal.
|
|
27
|
+
|
|
28
|
+
## Checklist
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
- [ ] gitnexus_impact({target, direction: "upstream"}) to find dependents
|
|
32
|
+
- [ ] Review d=1 items first (these WILL BREAK)
|
|
33
|
+
- [ ] Check high-confidence (>0.8) dependencies
|
|
34
|
+
- [ ] READ processes to check affected execution flows
|
|
35
|
+
- [ ] gitnexus_detect_changes() for pre-commit check
|
|
36
|
+
- [ ] Assess risk level and report to user
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Understanding Output
|
|
40
|
+
|
|
41
|
+
| Depth | Risk Level | Meaning |
|
|
42
|
+
| ----- | ---------------- | ------------------------ |
|
|
43
|
+
| d=1 | **WILL BREAK** | Direct callers/importers |
|
|
44
|
+
| d=2 | LIKELY AFFECTED | Indirect dependencies |
|
|
45
|
+
| d=3 | MAY NEED TESTING | Transitive effects |
|
|
46
|
+
|
|
47
|
+
## Risk Assessment
|
|
48
|
+
|
|
49
|
+
| Affected | Risk |
|
|
50
|
+
| ------------------------------ | -------- |
|
|
51
|
+
| <5 symbols, few processes | LOW |
|
|
52
|
+
| 5-15 symbols, 2-5 processes | MEDIUM |
|
|
53
|
+
| >15 symbols or many processes | HIGH |
|
|
54
|
+
| Critical path (auth, payments) | CRITICAL |
|
|
55
|
+
|
|
56
|
+
## Tools
|
|
57
|
+
|
|
58
|
+
**gitnexus_impact** — the primary tool for symbol blast radius:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
gitnexus_impact({
|
|
62
|
+
target: "validateUser",
|
|
63
|
+
direction: "upstream",
|
|
64
|
+
minConfidence: 0.8,
|
|
65
|
+
maxDepth: 3
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
→ d=1 (WILL BREAK):
|
|
69
|
+
- loginHandler (src/auth/login.ts:42) [CALLS, 100%]
|
|
70
|
+
- apiMiddleware (src/api/middleware.ts:15) [CALLS, 100%]
|
|
71
|
+
|
|
72
|
+
→ d=2 (LIKELY AFFECTED):
|
|
73
|
+
- authRouter (src/routes/auth.ts:22) [CALLS, 95%]
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**gitnexus_detect_changes** — git-diff based impact analysis:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
gitnexus_detect_changes({scope: "staged"})
|
|
80
|
+
|
|
81
|
+
→ Changed: 5 symbols in 3 files
|
|
82
|
+
→ Affected: LoginFlow, TokenRefresh, APIMiddlewarePipeline
|
|
83
|
+
→ Risk: MEDIUM
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Example: "What breaks if I change validateUser?"
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
1. gitnexus_impact({target: "validateUser", direction: "upstream"})
|
|
90
|
+
→ d=1: loginHandler, apiMiddleware (WILL BREAK)
|
|
91
|
+
→ d=2: authRouter, sessionManager (LIKELY AFFECTED)
|
|
92
|
+
|
|
93
|
+
2. READ gitnexus://repo/my-app/processes
|
|
94
|
+
→ LoginFlow and TokenRefresh touch validateUser
|
|
95
|
+
|
|
96
|
+
3. Risk: 2 direct callers, 2 processes = MEDIUM
|
|
97
|
+
```
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gitnexus-refactoring
|
|
3
|
+
description: "Use when the user wants to rename, extract, split, move, or restructure code safely. Examples: \"Rename this function\", \"Extract this into a module\", \"Refactor this class\", \"Move this to a separate file\""
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Refactoring with GitNexus
|
|
7
|
+
|
|
8
|
+
## When to Use
|
|
9
|
+
|
|
10
|
+
- "Rename this function safely"
|
|
11
|
+
- "Extract this into a module"
|
|
12
|
+
- "Split this service"
|
|
13
|
+
- "Move this to a new file"
|
|
14
|
+
- Any task involving renaming, extracting, splitting, or restructuring code
|
|
15
|
+
|
|
16
|
+
## Workflow
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
1. gitnexus_impact({target: "X", direction: "upstream"}) → Map all dependents
|
|
20
|
+
2. gitnexus_query({query: "X"}) → Find execution flows involving X
|
|
21
|
+
3. gitnexus_context({name: "X"}) → See all incoming/outgoing refs
|
|
22
|
+
4. Plan update order: interfaces → implementations → callers → tests
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
> If "Index is stale" → run `npx gitnexus analyze` in terminal.
|
|
26
|
+
|
|
27
|
+
## Checklists
|
|
28
|
+
|
|
29
|
+
### Rename Symbol
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
- [ ] gitnexus_rename({symbol_name: "oldName", new_name: "newName", dry_run: true}) — preview all edits
|
|
33
|
+
- [ ] Review graph edits (high confidence) and ast_search edits (review carefully)
|
|
34
|
+
- [ ] If satisfied: gitnexus_rename({..., dry_run: false}) — apply edits
|
|
35
|
+
- [ ] gitnexus_detect_changes() — verify only expected files changed
|
|
36
|
+
- [ ] Run tests for affected processes
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Extract Module
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
- [ ] gitnexus_context({name: target}) — see all incoming/outgoing refs
|
|
43
|
+
- [ ] gitnexus_impact({target, direction: "upstream"}) — find all external callers
|
|
44
|
+
- [ ] Define new module interface
|
|
45
|
+
- [ ] Extract code, update imports
|
|
46
|
+
- [ ] gitnexus_detect_changes() — verify affected scope
|
|
47
|
+
- [ ] Run tests for affected processes
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Split Function/Service
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
- [ ] gitnexus_context({name: target}) — understand all callees
|
|
54
|
+
- [ ] Group callees by responsibility
|
|
55
|
+
- [ ] gitnexus_impact({target, direction: "upstream"}) — map callers to update
|
|
56
|
+
- [ ] Create new functions/services
|
|
57
|
+
- [ ] Update callers
|
|
58
|
+
- [ ] gitnexus_detect_changes() — verify affected scope
|
|
59
|
+
- [ ] Run tests for affected processes
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Tools
|
|
63
|
+
|
|
64
|
+
**gitnexus_rename** — automated multi-file rename:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
gitnexus_rename({symbol_name: "validateUser", new_name: "authenticateUser", dry_run: true})
|
|
68
|
+
→ 12 edits across 8 files
|
|
69
|
+
→ 10 graph edits (high confidence), 2 ast_search edits (review)
|
|
70
|
+
→ Changes: [{file_path, edits: [{line, old_text, new_text, confidence}]}]
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**gitnexus_impact** — map all dependents first:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
gitnexus_impact({target: "validateUser", direction: "upstream"})
|
|
77
|
+
→ d=1: loginHandler, apiMiddleware, testUtils
|
|
78
|
+
→ Affected Processes: LoginFlow, TokenRefresh
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**gitnexus_detect_changes** — verify your changes after refactoring:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
gitnexus_detect_changes({scope: "all"})
|
|
85
|
+
→ Changed: 8 files, 12 symbols
|
|
86
|
+
→ Affected processes: LoginFlow, TokenRefresh
|
|
87
|
+
→ Risk: MEDIUM
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**gitnexus_cypher** — custom reference queries:
|
|
91
|
+
|
|
92
|
+
```cypher
|
|
93
|
+
MATCH (caller)-[:CodeRelation {type: 'CALLS'}]->(f:Function {name: "validateUser"})
|
|
94
|
+
RETURN caller.name, caller.filePath ORDER BY caller.filePath
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Risk Rules
|
|
98
|
+
|
|
99
|
+
| Risk Factor | Mitigation |
|
|
100
|
+
| ------------------- | ----------------------------------------- |
|
|
101
|
+
| Many callers (>5) | Use gitnexus_rename for automated updates |
|
|
102
|
+
| Cross-area refs | Use detect_changes after to verify scope |
|
|
103
|
+
| String/dynamic refs | gitnexus_query to find them |
|
|
104
|
+
| External/public API | Version and deprecate properly |
|
|
105
|
+
|
|
106
|
+
## Example: Rename `validateUser` to `authenticateUser`
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
1. gitnexus_rename({symbol_name: "validateUser", new_name: "authenticateUser", dry_run: true})
|
|
110
|
+
→ 12 edits: 10 graph (safe), 2 ast_search (review)
|
|
111
|
+
→ Files: validator.ts, login.ts, middleware.ts, config.json...
|
|
112
|
+
|
|
113
|
+
2. Review ast_search edits (config.json: dynamic reference!)
|
|
114
|
+
|
|
115
|
+
3. gitnexus_rename({symbol_name: "validateUser", new_name: "authenticateUser", dry_run: false})
|
|
116
|
+
→ Applied 12 edits across 8 files
|
|
117
|
+
|
|
118
|
+
4. gitnexus_detect_changes({scope: "all"})
|
|
119
|
+
→ Affected: LoginFlow, TokenRefresh
|
|
120
|
+
→ Risk: MEDIUM — run tests for these flows
|
|
121
|
+
```
|
package/AGENTS.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<!-- gitnexus:start -->
|
|
2
|
+
# GitNexus — Code Intelligence
|
|
3
|
+
|
|
4
|
+
This project is indexed by GitNexus as **adtec-front-end-core-package** (2241 symbols, 3020 relationships, 28 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
|
|
5
|
+
|
|
6
|
+
> If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first.
|
|
7
|
+
|
|
8
|
+
## Always Do
|
|
9
|
+
|
|
10
|
+
- **MUST run impact analysis before editing any symbol.** Before modifying a function, class, or method, run `gitnexus_impact({target: "symbolName", direction: "upstream"})` and report the blast radius (direct callers, affected processes, risk level) to the user.
|
|
11
|
+
- **MUST run `gitnexus_detect_changes()` before committing** to verify your changes only affect expected symbols and execution flows.
|
|
12
|
+
- **MUST warn the user** if impact analysis returns HIGH or CRITICAL risk before proceeding with edits.
|
|
13
|
+
- When exploring unfamiliar code, use `gitnexus_query({query: "concept"})` to find execution flows instead of grepping. It returns process-grouped results ranked by relevance.
|
|
14
|
+
- When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use `gitnexus_context({name: "symbolName"})`.
|
|
15
|
+
|
|
16
|
+
## Never Do
|
|
17
|
+
|
|
18
|
+
- NEVER edit a function, class, or method without first running `gitnexus_impact` on it.
|
|
19
|
+
- NEVER ignore HIGH or CRITICAL risk warnings from impact analysis.
|
|
20
|
+
- NEVER rename symbols with find-and-replace — use `gitnexus_rename` which understands the call graph.
|
|
21
|
+
- NEVER commit changes without running `gitnexus_detect_changes()` to check affected scope.
|
|
22
|
+
|
|
23
|
+
## Resources
|
|
24
|
+
|
|
25
|
+
| Resource | Use for |
|
|
26
|
+
|----------|---------|
|
|
27
|
+
| `gitnexus://repo/adtec-front-end-core-package/context` | Codebase overview, check index freshness |
|
|
28
|
+
| `gitnexus://repo/adtec-front-end-core-package/clusters` | All functional areas |
|
|
29
|
+
| `gitnexus://repo/adtec-front-end-core-package/processes` | All execution flows |
|
|
30
|
+
| `gitnexus://repo/adtec-front-end-core-package/process/{name}` | Step-by-step execution trace |
|
|
31
|
+
|
|
32
|
+
## CLI
|
|
33
|
+
|
|
34
|
+
| Task | Read this skill file |
|
|
35
|
+
|------|---------------------|
|
|
36
|
+
| Understand architecture / "How does X work?" | `.claude/skills/gitnexus/gitnexus-exploring/SKILL.md` |
|
|
37
|
+
| Blast radius / "What breaks if I change X?" | `.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md` |
|
|
38
|
+
| Trace bugs / "Why is X failing?" | `.claude/skills/gitnexus/gitnexus-debugging/SKILL.md` |
|
|
39
|
+
| Rename / extract / split / refactor | `.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md` |
|
|
40
|
+
| Tools, resources, schema reference | `.claude/skills/gitnexus/gitnexus-guide/SKILL.md` |
|
|
41
|
+
| Index, status, clean, wiki CLI commands | `.claude/skills/gitnexus/gitnexus-cli/SKILL.md` |
|
|
42
|
+
|
|
43
|
+
<!-- gitnexus:end -->
|
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<!-- gitnexus:start -->
|
|
2
|
+
# GitNexus — Code Intelligence
|
|
3
|
+
|
|
4
|
+
This project is indexed by GitNexus as **adtec-front-end-core-package** (2241 symbols, 3020 relationships, 28 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
|
|
5
|
+
|
|
6
|
+
> If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first.
|
|
7
|
+
|
|
8
|
+
## Always Do
|
|
9
|
+
|
|
10
|
+
- **MUST run impact analysis before editing any symbol.** Before modifying a function, class, or method, run `gitnexus_impact({target: "symbolName", direction: "upstream"})` and report the blast radius (direct callers, affected processes, risk level) to the user.
|
|
11
|
+
- **MUST run `gitnexus_detect_changes()` before committing** to verify your changes only affect expected symbols and execution flows.
|
|
12
|
+
- **MUST warn the user** if impact analysis returns HIGH or CRITICAL risk before proceeding with edits.
|
|
13
|
+
- When exploring unfamiliar code, use `gitnexus_query({query: "concept"})` to find execution flows instead of grepping. It returns process-grouped results ranked by relevance.
|
|
14
|
+
- When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use `gitnexus_context({name: "symbolName"})`.
|
|
15
|
+
|
|
16
|
+
## Never Do
|
|
17
|
+
|
|
18
|
+
- NEVER edit a function, class, or method without first running `gitnexus_impact` on it.
|
|
19
|
+
- NEVER ignore HIGH or CRITICAL risk warnings from impact analysis.
|
|
20
|
+
- NEVER rename symbols with find-and-replace — use `gitnexus_rename` which understands the call graph.
|
|
21
|
+
- NEVER commit changes without running `gitnexus_detect_changes()` to check affected scope.
|
|
22
|
+
|
|
23
|
+
## Resources
|
|
24
|
+
|
|
25
|
+
| Resource | Use for |
|
|
26
|
+
|----------|---------|
|
|
27
|
+
| `gitnexus://repo/adtec-front-end-core-package/context` | Codebase overview, check index freshness |
|
|
28
|
+
| `gitnexus://repo/adtec-front-end-core-package/clusters` | All functional areas |
|
|
29
|
+
| `gitnexus://repo/adtec-front-end-core-package/processes` | All execution flows |
|
|
30
|
+
| `gitnexus://repo/adtec-front-end-core-package/process/{name}` | Step-by-step execution trace |
|
|
31
|
+
|
|
32
|
+
## CLI
|
|
33
|
+
|
|
34
|
+
| Task | Read this skill file |
|
|
35
|
+
|------|---------------------|
|
|
36
|
+
| Understand architecture / "How does X work?" | `.claude/skills/gitnexus/gitnexus-exploring/SKILL.md` |
|
|
37
|
+
| Blast radius / "What breaks if I change X?" | `.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md` |
|
|
38
|
+
| Trace bugs / "Why is X failing?" | `.claude/skills/gitnexus/gitnexus-debugging/SKILL.md` |
|
|
39
|
+
| Rename / extract / split / refactor | `.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md` |
|
|
40
|
+
| Tools, resources, schema reference | `.claude/skills/gitnexus/gitnexus-guide/SKILL.md` |
|
|
41
|
+
| Index, status, clean, wiki CLI commands | `.claude/skills/gitnexus/gitnexus-cli/SKILL.md` |
|
|
42
|
+
|
|
43
|
+
<!-- gitnexus:end -->
|
package/package.json
CHANGED
|
@@ -10,12 +10,14 @@ import Node from './Node.vue'
|
|
|
10
10
|
const props = defineProps<{
|
|
11
11
|
node: JumpNode
|
|
12
12
|
}>()
|
|
13
|
-
const { nodesError, getTaskNodes } = inject<{
|
|
13
|
+
const { nodesError, getTaskNodes, getNodeById } = inject<{
|
|
14
14
|
nodesError: Ref<Recordable<ErrorInfo[]>>
|
|
15
15
|
getTaskNodes: (arg: string) => FlowNode[]
|
|
16
|
+
getNodeById: (id: string) => FlowNode | undefined
|
|
16
17
|
}>('flowDesign', {
|
|
17
18
|
nodesError: ref({}),
|
|
18
19
|
getTaskNodes: (arg: string) => [],
|
|
20
|
+
getNodeById: () => undefined,
|
|
19
21
|
})
|
|
20
22
|
const content = ref<string>('')
|
|
21
23
|
watchEffect(() => {
|
|
@@ -24,10 +26,20 @@ watchEffect(() => {
|
|
|
24
26
|
content.value = '未指定跳转节点'
|
|
25
27
|
if (!targetNode) {
|
|
26
28
|
errors.push({ id: id, name: name, message: '未配置跳转节点' })
|
|
29
|
+
} else if (targetNode === 'end') {
|
|
30
|
+
// 结束节点仅在主链路末端定义,分支 jump 固定指向 id=end
|
|
31
|
+
content.value = '跳转至:流程结束'
|
|
27
32
|
} else {
|
|
28
|
-
|
|
29
|
-
if (
|
|
30
|
-
content.value = '跳转至:' +
|
|
33
|
+
const taskNodes = getTaskNodes('').filter((x) => x.id === targetNode)
|
|
34
|
+
if (taskNodes.length > 0) {
|
|
35
|
+
content.value = '跳转至:' + taskNodes[0].name
|
|
36
|
+
} else {
|
|
37
|
+
const endNode = getNodeById(targetNode)
|
|
38
|
+
if (endNode?.type === 'end') {
|
|
39
|
+
content.value = '跳转至:' + (endNode.name || '流程结束')
|
|
40
|
+
} else {
|
|
41
|
+
errors.push({ id: id, name: name, message: '跳转目标节点不存在' })
|
|
42
|
+
}
|
|
31
43
|
}
|
|
32
44
|
}
|
|
33
45
|
// 记录错误
|
|
@@ -10,7 +10,7 @@ const { getTaskNodes } = inject<{
|
|
|
10
10
|
getTaskNodes: (arg: string) => FlowNode[]
|
|
11
11
|
}>('flowDesign', {
|
|
12
12
|
readOnly: ref(false),
|
|
13
|
-
getTaskNodes: (arg: string) => []
|
|
13
|
+
getTaskNodes: (arg: string) => [],
|
|
14
14
|
})
|
|
15
15
|
</script>
|
|
16
16
|
|
|
@@ -18,6 +18,7 @@ const { getTaskNodes } = inject<{
|
|
|
18
18
|
<el-form label-position="top" label-width="90px">
|
|
19
19
|
<el-form-item prop="types" label="跳转节点">
|
|
20
20
|
<el-select v-model="activeData.targetNode">
|
|
21
|
+
<el-option label="流程结束" value="end" />
|
|
21
22
|
<el-option
|
|
22
23
|
v-for="item in getTaskNodes(activeData.id)"
|
|
23
24
|
:key="item.id"
|
|
@@ -6,29 +6,27 @@
|
|
|
6
6
|
<div v-if="!isEdit">
|
|
7
7
|
<el-auto-tool-tip v-if="uploadFilesList?.length">
|
|
8
8
|
<template #tooltipContent>
|
|
9
|
-
<div style="display:flex;flex-direction:column">
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
style="margin: 0 2px"
|
|
14
|
-
>{{ item.name }}
|
|
15
|
-
</span>
|
|
9
|
+
<div style="display: flex; flex-direction: column">
|
|
10
|
+
<span v-for="item in uploadFilesList" :key="item.id" style="margin: 0 2px"
|
|
11
|
+
>{{ item.name }}
|
|
12
|
+
</span>
|
|
16
13
|
</div>
|
|
17
14
|
</template>
|
|
18
15
|
<template #content>
|
|
19
|
-
<div style="display:flex;flex-direction:column">
|
|
20
|
-
<div
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
<div style="display: flex; flex-direction: column">
|
|
17
|
+
<div
|
|
18
|
+
v-for="item in uploadFilesList"
|
|
19
|
+
:key="item.id"
|
|
20
|
+
class="file-item"
|
|
21
|
+
style="display: flex; align-items: center; overflow: hidden"
|
|
22
|
+
>
|
|
23
23
|
<el-icons :model-value="getIcon(item.name)" style="margin-right: 5px"></el-icons>
|
|
24
24
|
<span class="link-name" @click="fileView(item.id)">{{ item.name }}</span>
|
|
25
25
|
</div>
|
|
26
26
|
</div>
|
|
27
27
|
</template>
|
|
28
28
|
</el-auto-tool-tip>
|
|
29
|
-
<div style="text-align: center;color: var(--el-disabled-text-color)" v-else>
|
|
30
|
-
暂无附件
|
|
31
|
-
</div>
|
|
29
|
+
<div style="text-align: center; color: var(--el-disabled-text-color)" v-else>暂无附件</div>
|
|
32
30
|
</div>
|
|
33
31
|
<el-upload
|
|
34
32
|
v-else
|
|
@@ -46,7 +44,15 @@
|
|
|
46
44
|
:before-upload="beforeUpload"
|
|
47
45
|
drag
|
|
48
46
|
:accept="getAccept"
|
|
49
|
-
:action="
|
|
47
|
+
:action="
|
|
48
|
+
'/api/doc/uploadFile/' +
|
|
49
|
+
business +
|
|
50
|
+
'/' +
|
|
51
|
+
businessId +
|
|
52
|
+
'/' +
|
|
53
|
+
association +
|
|
54
|
+
(watermarkCode ? '?watermarkCode=' + watermarkCode : '')
|
|
55
|
+
"
|
|
50
56
|
multiple
|
|
51
57
|
:limit="limit"
|
|
52
58
|
:headers="uploadHeaders"
|
|
@@ -75,7 +81,7 @@
|
|
|
75
81
|
</el-flex>
|
|
76
82
|
<el-flex align="center" justify="flex-end" width="50px">
|
|
77
83
|
<el-text v-if="!file?.businessId && file.percentage !== 100"
|
|
78
|
-
|
|
84
|
+
>{{ file.percentage }}%
|
|
79
85
|
</el-text>
|
|
80
86
|
<el-icons
|
|
81
87
|
v-if="file?.businessId || file.percentage === 100"
|
|
@@ -96,18 +102,24 @@
|
|
|
96
102
|
<script setup lang="ts">
|
|
97
103
|
import { UploadFilled } from '@element-plus/icons-vue'
|
|
98
104
|
import { computed, onMounted, ref } from 'vue'
|
|
99
|
-
import {
|
|
105
|
+
import {
|
|
106
|
+
ElMessage,
|
|
107
|
+
ElMessageBox,
|
|
108
|
+
type UploadFile,
|
|
109
|
+
type UploadFiles,
|
|
110
|
+
type UploadUserFile,
|
|
111
|
+
} from 'element-plus'
|
|
100
112
|
import type { ISysUploadFiles } from '../../interface/ISysUploadFiles'
|
|
101
113
|
//@ts-ignore
|
|
102
114
|
import useFileView from '../../hooks/useFileView.ts'
|
|
103
115
|
import documentApi from '../../api/DocumentApi.ts'
|
|
104
116
|
import frameworkUtils from '../../utils/FrameworkUtils.ts'
|
|
105
117
|
import { userInfoStore } from '../../stores/userInfoStore'
|
|
106
|
-
import { getAcceptString } from '
|
|
118
|
+
import { getAcceptString } from '../../utils/uploadAccept.ts'
|
|
107
119
|
|
|
108
120
|
const { fileView: fileView } = useFileView()
|
|
109
121
|
const uploadHeaders = ref({
|
|
110
|
-
Authorization: ''
|
|
122
|
+
Authorization: '',
|
|
111
123
|
})
|
|
112
124
|
const emit = defineEmits(['success'])
|
|
113
125
|
const userInfo = userInfoStore()
|
|
@@ -122,7 +134,7 @@ const props = defineProps({
|
|
|
122
134
|
*/
|
|
123
135
|
limit: {
|
|
124
136
|
type: Number,
|
|
125
|
-
default: 1
|
|
137
|
+
default: 1,
|
|
126
138
|
},
|
|
127
139
|
/**
|
|
128
140
|
* @description 纵向排列
|
|
@@ -130,7 +142,7 @@ const props = defineProps({
|
|
|
130
142
|
*/
|
|
131
143
|
vertical: {
|
|
132
144
|
type: Boolean,
|
|
133
|
-
default: false
|
|
145
|
+
default: false,
|
|
134
146
|
},
|
|
135
147
|
/**
|
|
136
148
|
* @description 上传文件类型
|
|
@@ -139,7 +151,7 @@ const props = defineProps({
|
|
|
139
151
|
*/
|
|
140
152
|
accept: {
|
|
141
153
|
type: String,
|
|
142
|
-
default: ''
|
|
154
|
+
default: '',
|
|
143
155
|
},
|
|
144
156
|
/**
|
|
145
157
|
* @description 业务类型
|
|
@@ -147,7 +159,7 @@ const props = defineProps({
|
|
|
147
159
|
*/
|
|
148
160
|
business: {
|
|
149
161
|
type: String,
|
|
150
|
-
default: 'default'
|
|
162
|
+
default: 'default',
|
|
151
163
|
},
|
|
152
164
|
/**
|
|
153
165
|
* @description 业务id
|
|
@@ -155,7 +167,7 @@ const props = defineProps({
|
|
|
155
167
|
*/
|
|
156
168
|
businessId: {
|
|
157
169
|
type: String,
|
|
158
|
-
default: 'default'
|
|
170
|
+
default: 'default',
|
|
159
171
|
},
|
|
160
172
|
/**
|
|
161
173
|
* @description 是否编辑状态
|
|
@@ -164,7 +176,7 @@ const props = defineProps({
|
|
|
164
176
|
*/
|
|
165
177
|
isEdit: {
|
|
166
178
|
type: Boolean,
|
|
167
|
-
default: true
|
|
179
|
+
default: true,
|
|
168
180
|
},
|
|
169
181
|
/**
|
|
170
182
|
* @description 文档上传是否默认关联,默认不关联
|
|
@@ -173,37 +185,37 @@ const props = defineProps({
|
|
|
173
185
|
*/
|
|
174
186
|
association: {
|
|
175
187
|
type: Boolean,
|
|
176
|
-
default: false
|
|
188
|
+
default: false,
|
|
177
189
|
},
|
|
178
190
|
size: {
|
|
179
191
|
type: Number,
|
|
180
|
-
default: 50
|
|
192
|
+
default: 50,
|
|
181
193
|
},
|
|
182
194
|
//附件宽度
|
|
183
195
|
itemWidth: {
|
|
184
196
|
type: String,
|
|
185
|
-
default: '100%'
|
|
197
|
+
default: '100%',
|
|
186
198
|
},
|
|
187
199
|
isConfirmDelete: {
|
|
188
200
|
type: Boolean,
|
|
189
|
-
default: true
|
|
201
|
+
default: true,
|
|
190
202
|
},
|
|
191
203
|
overwrite: {
|
|
192
204
|
type: Boolean,
|
|
193
|
-
default: true
|
|
205
|
+
default: true,
|
|
194
206
|
},
|
|
195
207
|
autoUpload: {
|
|
196
208
|
type: Boolean,
|
|
197
|
-
default: true
|
|
209
|
+
default: true,
|
|
198
210
|
},
|
|
199
211
|
showOptMessage: {
|
|
200
212
|
type: Boolean,
|
|
201
|
-
default: true
|
|
213
|
+
default: true,
|
|
202
214
|
},
|
|
203
215
|
watermarkCode: {
|
|
204
216
|
type: String,
|
|
205
|
-
default: () => undefined
|
|
206
|
-
}
|
|
217
|
+
default: () => undefined,
|
|
218
|
+
},
|
|
207
219
|
})
|
|
208
220
|
/**
|
|
209
221
|
* 文件列表
|
|
@@ -255,7 +267,7 @@ const success = (response: any, uploadFile: UploadFile, uploadFiles: UploadFiles
|
|
|
255
267
|
const loading = defineModel<boolean>('loading')
|
|
256
268
|
const loadingFiles = ref<string[]>([])
|
|
257
269
|
const hasPendingFiles = computed(() => {
|
|
258
|
-
return fileList.value.some(file => {
|
|
270
|
+
return fileList.value.some((file) => {
|
|
259
271
|
return file.status !== 'success' && file.status !== 'error'
|
|
260
272
|
})
|
|
261
273
|
})
|
|
@@ -281,9 +293,7 @@ const beforeUpload = async (file: File) => {
|
|
|
281
293
|
ElMessage.warning('文件大小不能超过' + props.size + 'MB')
|
|
282
294
|
return false
|
|
283
295
|
}
|
|
284
|
-
const acceptSuffixes = getAccept.value
|
|
285
|
-
?.split(',')
|
|
286
|
-
.map(suffix => suffix.slice(1).toLowerCase())
|
|
296
|
+
const acceptSuffixes = getAccept.value?.split(',').map((suffix) => suffix.slice(1).toLowerCase())
|
|
287
297
|
const fileSuffix = file.name.split('.').pop()?.toLowerCase()
|
|
288
298
|
if (acceptSuffixes && !acceptSuffixes.includes(fileSuffix ?? '')) {
|
|
289
299
|
ElMessage.error(`文件 ${file.name} 格式不支持,仅允许 ${getAccept.value}!`)
|
|
@@ -305,7 +315,7 @@ const fileClick = async (file: UploadFile & ISysUploadFiles) => {
|
|
|
305
315
|
const flag = await ElMessageBox.confirm('删除不可恢复!您确定删除此附件?', '提示', {
|
|
306
316
|
confirmButtonText: '确定',
|
|
307
317
|
cancelButtonText: '取消',
|
|
308
|
-
type: 'warning'
|
|
318
|
+
type: 'warning',
|
|
309
319
|
})
|
|
310
320
|
if (!flag) {
|
|
311
321
|
return
|
|
@@ -324,17 +334,21 @@ const exceed = async (files: File[], uploadFiles: UploadUserFile[]) => {
|
|
|
324
334
|
if (props.limit === 1 && props.overwrite && uploadFilesList.value.length >= 1) {
|
|
325
335
|
const existingFile = uploadFilesList.value[0]
|
|
326
336
|
if (!props.isConfirmDelete) {
|
|
327
|
-
const flag = await ElMessageBox.confirm(
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
337
|
+
const flag = await ElMessageBox.confirm(
|
|
338
|
+
'只允许上传一个附件,是否点击确定覆盖原有附件?',
|
|
339
|
+
'提示',
|
|
340
|
+
{
|
|
341
|
+
confirmButtonText: '确定',
|
|
342
|
+
cancelButtonText: '取消',
|
|
343
|
+
type: 'warning',
|
|
344
|
+
},
|
|
345
|
+
)
|
|
332
346
|
if (!flag) {
|
|
333
347
|
return
|
|
334
348
|
}
|
|
335
349
|
try {
|
|
336
350
|
loading.value = true
|
|
337
|
-
await documentApi.delSysUploadFile(existingFile.id).catch(err => {
|
|
351
|
+
await documentApi.delSysUploadFile(existingFile.id).catch((err) => {
|
|
338
352
|
frameworkUtils.messageError(err)
|
|
339
353
|
})
|
|
340
354
|
} catch (err) {
|
|
@@ -401,7 +415,7 @@ const confirm = async (autoDelete: boolean = true) => {
|
|
|
401
415
|
try {
|
|
402
416
|
loading.value = true
|
|
403
417
|
if (props.isConfirmDelete && deleteFiles.value.length > 0 && autoDelete) {
|
|
404
|
-
await documentApi.delSysUploadFiles(deleteFiles.value.map(item => item.id))
|
|
418
|
+
await documentApi.delSysUploadFiles(deleteFiles.value.map((item) => item.id))
|
|
405
419
|
}
|
|
406
420
|
if (!props.autoUpload) {
|
|
407
421
|
//此处判断是否存在需要上传的文件
|
|
@@ -426,7 +440,7 @@ onMounted(() => {
|
|
|
426
440
|
})
|
|
427
441
|
defineExpose({
|
|
428
442
|
remove,
|
|
429
|
-
confirm
|
|
443
|
+
confirm,
|
|
430
444
|
})
|
|
431
445
|
</script>
|
|
432
446
|
<style scoped lang="scss">
|
|
@@ -94,65 +94,94 @@ const blurEvent = (event: FocusEvent) => {
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
const findSearchButton = (root: ParentNode, routeCode?: string | null): HTMLElement | null => {
|
|
98
|
+
const buttons = root.querySelectorAll('button')
|
|
99
|
+
if (routeCode) {
|
|
100
|
+
const expected = `${routeCode}_search`
|
|
101
|
+
for (const el of buttons) {
|
|
102
|
+
if (el instanceof HTMLElement && el.classList.contains(expected)) {
|
|
103
|
+
return el
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
for (const el of buttons) {
|
|
108
|
+
if (!(el instanceof HTMLElement)) continue
|
|
109
|
+
for (const cls of el.classList) {
|
|
110
|
+
if (cls.endsWith('_search')) return el
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return null
|
|
114
|
+
}
|
|
115
|
+
|
|
97
116
|
const keyUpEvent = (event: KeyboardEvent) => {
|
|
98
|
-
if (event.key
|
|
99
|
-
|
|
100
|
-
|
|
117
|
+
if (event.key !== 'Enter') {
|
|
118
|
+
return
|
|
119
|
+
}
|
|
101
120
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
121
|
+
const applicationModule = moduleName.value || sessionStorage.getItem('applicationModule')
|
|
122
|
+
const docTemp = event.currentTarget as any
|
|
123
|
+
const doc =
|
|
124
|
+
applicationModule === 'system'
|
|
105
125
|
? (docTemp as Document)
|
|
106
|
-
: (docTemp &&
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
126
|
+
: (docTemp &&
|
|
127
|
+
docTemp[applicationModule ?? 'default'] &&
|
|
128
|
+
docTemp[applicationModule ?? 'default'].document) ||
|
|
129
|
+
undefined
|
|
130
|
+
|
|
131
|
+
if (!doc) return
|
|
132
|
+
|
|
133
|
+
const isElementVisible = (el: HTMLElement | null): boolean => {
|
|
134
|
+
if (!el) return false
|
|
135
|
+
if (el.style.display === 'none' || getComputedStyle(el).display === 'none') return false
|
|
136
|
+
if (el.style.visibility === 'hidden' || getComputedStyle(el).visibility === 'hidden') {
|
|
137
|
+
return false
|
|
138
|
+
}
|
|
139
|
+
let parent = el.parentElement
|
|
140
|
+
while (parent) {
|
|
141
|
+
if (parent.style.display === 'none' || getComputedStyle(parent).display === 'none') {
|
|
142
|
+
return false
|
|
122
143
|
}
|
|
123
|
-
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
// 1. 优先查找登录按钮(可见时才点击)
|
|
127
|
-
const loginButton = doc.body.querySelector('.login_button') as HTMLElement;
|
|
128
|
-
if (loginButton && isElementVisible(loginButton)) {
|
|
129
|
-
event.stopPropagation();
|
|
130
|
-
event.preventDefault(); // 新增:阻止表单默认提交(避免页面刷新)
|
|
131
|
-
loginButton.click();
|
|
132
|
-
return;
|
|
144
|
+
parent = parent.parentElement
|
|
133
145
|
}
|
|
146
|
+
return true
|
|
147
|
+
}
|
|
134
148
|
|
|
135
|
-
|
|
136
|
-
const hasDrawer = doc.body.className === 'el-popup-parent--hidden' || doc.body.querySelector('.el-drawer .open');
|
|
137
|
-
let target: HTMLElement | null = null;
|
|
138
|
-
const routeCode = sessionStorage.getItem('activationRouteCode') as string;
|
|
149
|
+
const routeCode = sessionStorage.getItem('activationRouteCode')
|
|
139
150
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
// 页面内的搜索按钮(需可见)
|
|
148
|
-
target = doc.body.querySelector(`.${routeCode}_search`) as HTMLElement;
|
|
151
|
+
const findDrawerSearchButton = (): HTMLElement | null => {
|
|
152
|
+
const drawerBodies = [...doc.body.querySelectorAll('.el-drawer__body')]
|
|
153
|
+
for (let i = drawerBodies.length - 1; i >= 0; i--) {
|
|
154
|
+
const drawer = drawerBodies[i] as HTMLElement
|
|
155
|
+
if (!isElementVisible(drawer)) continue
|
|
156
|
+
const btn = findSearchButton(drawer, routeCode)
|
|
157
|
+
if (btn && isElementVisible(btn)) return btn
|
|
149
158
|
}
|
|
159
|
+
return null
|
|
160
|
+
}
|
|
150
161
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
162
|
+
const loginButton = doc.body.querySelector('.login_button') as HTMLElement
|
|
163
|
+
if (loginButton && isElementVisible(loginButton)) {
|
|
164
|
+
event.preventDefault()
|
|
165
|
+
event.stopPropagation()
|
|
166
|
+
loginButton.click()
|
|
167
|
+
return
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const hasDrawer =
|
|
171
|
+
doc.body.classList.contains('el-popup-parent--hidden') ||
|
|
172
|
+
!!doc.body.querySelector('.el-drawer__body')
|
|
173
|
+
|
|
174
|
+
let target: HTMLElement | null = null
|
|
175
|
+
|
|
176
|
+
if (hasDrawer) {
|
|
177
|
+
target = findDrawerSearchButton()
|
|
178
|
+
} else if (routeCode) {
|
|
179
|
+
target = findSearchButton(doc.body, routeCode)
|
|
157
180
|
}
|
|
158
|
-
|
|
181
|
+
|
|
182
|
+
if (target && isElementVisible(target)) {
|
|
183
|
+
event.preventDefault()
|
|
184
|
+
event.stopPropagation()
|
|
185
|
+
target.click()
|
|
186
|
+
}
|
|
187
|
+
}
|