diff --git a/.claude/skills/gitnexus/gitnexus-cli/SKILL.md b/.claude/skills/gitnexus/gitnexus-cli/SKILL.md new file mode 100644 index 00000000..cd9a83be --- /dev/null +++ b/.claude/skills/gitnexus/gitnexus-cli/SKILL.md @@ -0,0 +1,83 @@ +--- +name: gitnexus-cli +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\"" +--- + +# GitNexus CLI Commands + +All commands work via `npx` — no global install required. + +## Commands + +### analyze — Build or refresh the index + +```bash +npx gitnexus analyze +``` + +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. + +| Flag | Effect | +| -------------- | ---------------------------------------------------------------- | +| `--force` | Force full re-index even if up to date | +| `--embeddings` | Enable embedding generation for semantic search (off by default) | +| `--drop-embeddings` | Drop existing embeddings on rebuild. By default, an `analyze` without `--embeddings` preserves them. | + +**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. + +### status — Check index freshness + +```bash +npx gitnexus status +``` + +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. + +### clean — Delete the index + +```bash +npx gitnexus clean +``` + +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. + +| Flag | Effect | +| --------- | ------------------------------------------------- | +| `--force` | Skip confirmation prompt | +| `--all` | Clean all indexed repos, not just the current one | + +### wiki — Generate documentation from the graph + +```bash +npx gitnexus wiki +``` + +Generates repository documentation from the knowledge graph using an LLM. Requires an API key (saved to `~/.gitnexus/config.json` on first use). + +| Flag | Effect | +| ------------------- | ----------------------------------------- | +| `--force` | Force full regeneration | +| `--model ` | LLM model (default: minimax/minimax-m2.5) | +| `--base-url ` | LLM API base URL | +| `--api-key ` | LLM API key | +| `--concurrency ` | Parallel LLM calls (default: 3) | +| `--gist` | Publish wiki as a public GitHub Gist | + +### list — Show all indexed repos + +```bash +npx gitnexus list +``` + +Lists all repositories registered in `~/.gitnexus/registry.json`. The MCP `list_repos` tool provides the same information. + +## After Indexing + +1. **Read `gitnexus://repo/{name}/context`** to verify the index loaded +2. Use the other GitNexus skills (`exploring`, `debugging`, `impact-analysis`, `refactoring`) for your task + +## Troubleshooting + +- **"Not inside a git repository"**: Run from a directory inside a git repo +- **Index is stale after re-analyzing**: Restart Claude Code to reload the MCP server +- **Embeddings slow**: Omit `--embeddings` (it's off by default) or set `OPENAI_API_KEY` for faster API-based embedding diff --git a/.claude/skills/gitnexus/gitnexus-debugging/SKILL.md b/.claude/skills/gitnexus/gitnexus-debugging/SKILL.md new file mode 100644 index 00000000..9510b97a --- /dev/null +++ b/.claude/skills/gitnexus/gitnexus-debugging/SKILL.md @@ -0,0 +1,89 @@ +--- +name: gitnexus-debugging +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\"" +--- + +# Debugging with GitNexus + +## When to Use + +- "Why is this function failing?" +- "Trace where this error comes from" +- "Who calls this method?" +- "This endpoint returns 500" +- Investigating bugs, errors, or unexpected behavior + +## Workflow + +``` +1. gitnexus_query({query: ""}) → Find related execution flows +2. gitnexus_context({name: ""}) → See callers/callees/processes +3. READ gitnexus://repo/{name}/process/{name} → Trace execution flow +4. gitnexus_cypher({query: "MATCH path..."}) → Custom traces if needed +``` + +> If "Index is stale" → run `npx gitnexus analyze` in terminal. + +## Checklist + +``` +- [ ] Understand the symptom (error message, unexpected behavior) +- [ ] gitnexus_query for error text or related code +- [ ] Identify the suspect function from returned processes +- [ ] gitnexus_context to see callers and callees +- [ ] Trace execution flow via process resource if applicable +- [ ] gitnexus_cypher for custom call chain traces if needed +- [ ] Read source files to confirm root cause +``` + +## Debugging Patterns + +| Symptom | GitNexus Approach | +| -------------------- | ---------------------------------------------------------- | +| Error message | `gitnexus_query` for error text → `context` on throw sites | +| Wrong return value | `context` on the function → trace callees for data flow | +| Intermittent failure | `context` → look for external calls, async deps | +| Performance issue | `context` → find symbols with many callers (hot paths) | +| Recent regression | `detect_changes` to see what your changes affect | + +## Tools + +**gitnexus_query** — find code related to error: + +``` +gitnexus_query({query: "payment validation error"}) +→ Processes: CheckoutFlow, ErrorHandling +→ Symbols: validatePayment, handlePaymentError, PaymentException +``` + +**gitnexus_context** — full context for a suspect: + +``` +gitnexus_context({name: "validatePayment"}) +→ Incoming calls: processCheckout, webhookHandler +→ Outgoing calls: verifyCard, fetchRates (external API!) +→ Processes: CheckoutFlow (step 3/7) +``` + +**gitnexus_cypher** — custom call chain traces: + +```cypher +MATCH path = (a)-[:CodeRelation {type: 'CALLS'}*1..2]->(b:Function {name: "validatePayment"}) +RETURN [n IN nodes(path) | n.name] AS chain +``` + +## Example: "Payment endpoint returns 500 intermittently" + +``` +1. gitnexus_query({query: "payment error handling"}) + → Processes: CheckoutFlow, ErrorHandling + → Symbols: validatePayment, handlePaymentError + +2. gitnexus_context({name: "validatePayment"}) + → Outgoing calls: verifyCard, fetchRates (external API!) + +3. READ gitnexus://repo/my-app/process/CheckoutFlow + → Step 3: validatePayment → calls fetchRates (external) + +4. Root cause: fetchRates calls external API without proper timeout +``` diff --git a/.claude/skills/gitnexus/gitnexus-exploring/SKILL.md b/.claude/skills/gitnexus/gitnexus-exploring/SKILL.md new file mode 100644 index 00000000..927a4e4b --- /dev/null +++ b/.claude/skills/gitnexus/gitnexus-exploring/SKILL.md @@ -0,0 +1,78 @@ +--- +name: gitnexus-exploring +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\"" +--- + +# Exploring Codebases with GitNexus + +## When to Use + +- "How does authentication work?" +- "What's the project structure?" +- "Show me the main components" +- "Where is the database logic?" +- Understanding code you haven't seen before + +## Workflow + +``` +1. READ gitnexus://repos → Discover indexed repos +2. READ gitnexus://repo/{name}/context → Codebase overview, check staleness +3. gitnexus_query({query: ""}) → Find related execution flows +4. gitnexus_context({name: ""}) → Deep dive on specific symbol +5. READ gitnexus://repo/{name}/process/{name} → Trace full execution flow +``` + +> If step 2 says "Index is stale" → run `npx gitnexus analyze` in terminal. + +## Checklist + +``` +- [ ] READ gitnexus://repo/{name}/context +- [ ] gitnexus_query for the concept you want to understand +- [ ] Review returned processes (execution flows) +- [ ] gitnexus_context on key symbols for callers/callees +- [ ] READ process resource for full execution traces +- [ ] Read source files for implementation details +``` + +## Resources + +| Resource | What you get | +| --------------------------------------- | ------------------------------------------------------- | +| `gitnexus://repo/{name}/context` | Stats, staleness warning (~150 tokens) | +| `gitnexus://repo/{name}/clusters` | All functional areas with cohesion scores (~300 tokens) | +| `gitnexus://repo/{name}/cluster/{name}` | Area members with file paths (~500 tokens) | +| `gitnexus://repo/{name}/process/{name}` | Step-by-step execution trace (~200 tokens) | + +## Tools + +**gitnexus_query** — find execution flows related to a concept: + +``` +gitnexus_query({query: "payment processing"}) +→ Processes: CheckoutFlow, RefundFlow, WebhookHandler +→ Symbols grouped by flow with file locations +``` + +**gitnexus_context** — 360-degree view of a symbol: + +``` +gitnexus_context({name: "validateUser"}) +→ Incoming calls: loginHandler, apiMiddleware +→ Outgoing calls: checkToken, getUserById +→ Processes: LoginFlow (step 2/5), TokenRefresh (step 1/3) +``` + +## Example: "How does payment processing work?" + +``` +1. READ gitnexus://repo/my-app/context → 918 symbols, 45 processes +2. gitnexus_query({query: "payment processing"}) + → CheckoutFlow: processPayment → validateCard → chargeStripe + → RefundFlow: initiateRefund → calculateRefund → processRefund +3. gitnexus_context({name: "processPayment"}) + → Incoming: checkoutHandler, webhookHandler + → Outgoing: validateCard, chargeStripe, saveTransaction +4. Read src/payments/processor.ts for implementation details +``` diff --git a/.claude/skills/gitnexus/gitnexus-guide/SKILL.md b/.claude/skills/gitnexus/gitnexus-guide/SKILL.md new file mode 100644 index 00000000..937ac73d --- /dev/null +++ b/.claude/skills/gitnexus/gitnexus-guide/SKILL.md @@ -0,0 +1,64 @@ +--- +name: gitnexus-guide +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?\"" +--- + +# GitNexus Guide + +Quick reference for all GitNexus MCP tools, resources, and the knowledge graph schema. + +## Always Start Here + +For any task involving code understanding, debugging, impact analysis, or refactoring: + +1. **Read `gitnexus://repo/{name}/context`** — codebase overview + check index freshness +2. **Match your task to a skill below** and **read that skill file** +3. **Follow the skill's workflow and checklist** + +> If step 1 warns the index is stale, run `npx gitnexus analyze` in the terminal first. + +## Skills + +| Task | Skill to read | +| -------------------------------------------- | ------------------- | +| Understand architecture / "How does X work?" | `gitnexus-exploring` | +| Blast radius / "What breaks if I change X?" | `gitnexus-impact-analysis` | +| Trace bugs / "Why is X failing?" | `gitnexus-debugging` | +| Rename / extract / split / refactor | `gitnexus-refactoring` | +| Tools, resources, schema reference | `gitnexus-guide` (this file) | +| Index, status, clean, wiki CLI commands | `gitnexus-cli` | + +## Tools Reference + +| Tool | What it gives you | +| ---------------- | ------------------------------------------------------------------------ | +| `query` | Process-grouped code intelligence — execution flows related to a concept | +| `context` | 360-degree symbol view — categorized refs, processes it participates in | +| `impact` | Symbol blast radius — what breaks at depth 1/2/3 with confidence | +| `detect_changes` | Git-diff impact — what do your current changes affect | +| `rename` | Multi-file coordinated rename with confidence-tagged edits | +| `cypher` | Raw graph queries (read `gitnexus://repo/{name}/schema` first) | +| `list_repos` | Discover indexed repos | + +## Resources Reference + +Lightweight reads (~100-500 tokens) for navigation: + +| Resource | Content | +| ---------------------------------------------- | ----------------------------------------- | +| `gitnexus://repo/{name}/context` | Stats, staleness check | +| `gitnexus://repo/{name}/clusters` | All functional areas with cohesion scores | +| `gitnexus://repo/{name}/cluster/{clusterName}` | Area members | +| `gitnexus://repo/{name}/processes` | All execution flows | +| `gitnexus://repo/{name}/process/{processName}` | Step-by-step trace | +| `gitnexus://repo/{name}/schema` | Graph schema for Cypher | + +## Graph Schema + +**Nodes:** File, Function, Class, Interface, Method, Community, Process +**Edges (via CodeRelation.type):** CALLS, IMPORTS, EXTENDS, IMPLEMENTS, DEFINES, MEMBER_OF, STEP_IN_PROCESS + +```cypher +MATCH (caller)-[:CodeRelation {type: 'CALLS'}]->(f:Function {name: "myFunc"}) +RETURN caller.name, caller.filePath +``` diff --git a/.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md b/.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md new file mode 100644 index 00000000..e19af280 --- /dev/null +++ b/.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md @@ -0,0 +1,97 @@ +--- +name: gitnexus-impact-analysis +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?\"" +--- + +# Impact Analysis with GitNexus + +## When to Use + +- "Is it safe to change this function?" +- "What will break if I modify X?" +- "Show me the blast radius" +- "Who uses this code?" +- Before making non-trivial code changes +- Before committing — to understand what your changes affect + +## Workflow + +``` +1. gitnexus_impact({target: "X", direction: "upstream"}) → What depends on this +2. READ gitnexus://repo/{name}/processes → Check affected execution flows +3. gitnexus_detect_changes() → Map current git changes to affected flows +4. Assess risk and report to user +``` + +> If "Index is stale" → run `npx gitnexus analyze` in terminal. + +## Checklist + +``` +- [ ] gitnexus_impact({target, direction: "upstream"}) to find dependents +- [ ] Review d=1 items first (these WILL BREAK) +- [ ] Check high-confidence (>0.8) dependencies +- [ ] READ processes to check affected execution flows +- [ ] gitnexus_detect_changes() for pre-commit check +- [ ] Assess risk level and report to user +``` + +## Understanding Output + +| Depth | Risk Level | Meaning | +| ----- | ---------------- | ------------------------ | +| d=1 | **WILL BREAK** | Direct callers/importers | +| d=2 | LIKELY AFFECTED | Indirect dependencies | +| d=3 | MAY NEED TESTING | Transitive effects | + +## Risk Assessment + +| Affected | Risk | +| ------------------------------ | -------- | +| <5 symbols, few processes | LOW | +| 5-15 symbols, 2-5 processes | MEDIUM | +| >15 symbols or many processes | HIGH | +| Critical path (auth, payments) | CRITICAL | + +## Tools + +**gitnexus_impact** — the primary tool for symbol blast radius: + +``` +gitnexus_impact({ + target: "validateUser", + direction: "upstream", + minConfidence: 0.8, + maxDepth: 3 +}) + +→ d=1 (WILL BREAK): + - loginHandler (src/auth/login.ts:42) [CALLS, 100%] + - apiMiddleware (src/api/middleware.ts:15) [CALLS, 100%] + +→ d=2 (LIKELY AFFECTED): + - authRouter (src/routes/auth.ts:22) [CALLS, 95%] +``` + +**gitnexus_detect_changes** — git-diff based impact analysis: + +``` +gitnexus_detect_changes({scope: "staged"}) + +→ Changed: 5 symbols in 3 files +→ Affected: LoginFlow, TokenRefresh, APIMiddlewarePipeline +→ Risk: MEDIUM +``` + +## Example: "What breaks if I change validateUser?" + +``` +1. gitnexus_impact({target: "validateUser", direction: "upstream"}) + → d=1: loginHandler, apiMiddleware (WILL BREAK) + → d=2: authRouter, sessionManager (LIKELY AFFECTED) + +2. READ gitnexus://repo/my-app/processes + → LoginFlow and TokenRefresh touch validateUser + +3. Risk: 2 direct callers, 2 processes = MEDIUM +``` diff --git a/.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md b/.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md new file mode 100644 index 00000000..f48cc01b --- /dev/null +++ b/.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md @@ -0,0 +1,121 @@ +--- +name: gitnexus-refactoring +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\"" +--- + +# Refactoring with GitNexus + +## When to Use + +- "Rename this function safely" +- "Extract this into a module" +- "Split this service" +- "Move this to a new file" +- Any task involving renaming, extracting, splitting, or restructuring code + +## Workflow + +``` +1. gitnexus_impact({target: "X", direction: "upstream"}) → Map all dependents +2. gitnexus_query({query: "X"}) → Find execution flows involving X +3. gitnexus_context({name: "X"}) → See all incoming/outgoing refs +4. Plan update order: interfaces → implementations → callers → tests +``` + +> If "Index is stale" → run `npx gitnexus analyze` in terminal. + +## Checklists + +### Rename Symbol + +``` +- [ ] gitnexus_rename({symbol_name: "oldName", new_name: "newName", dry_run: true}) — preview all edits +- [ ] Review graph edits (high confidence) and ast_search edits (review carefully) +- [ ] If satisfied: gitnexus_rename({..., dry_run: false}) — apply edits +- [ ] gitnexus_detect_changes() — verify only expected files changed +- [ ] Run tests for affected processes +``` + +### Extract Module + +``` +- [ ] gitnexus_context({name: target}) — see all incoming/outgoing refs +- [ ] gitnexus_impact({target, direction: "upstream"}) — find all external callers +- [ ] Define new module interface +- [ ] Extract code, update imports +- [ ] gitnexus_detect_changes() — verify affected scope +- [ ] Run tests for affected processes +``` + +### Split Function/Service + +``` +- [ ] gitnexus_context({name: target}) — understand all callees +- [ ] Group callees by responsibility +- [ ] gitnexus_impact({target, direction: "upstream"}) — map callers to update +- [ ] Create new functions/services +- [ ] Update callers +- [ ] gitnexus_detect_changes() — verify affected scope +- [ ] Run tests for affected processes +``` + +## Tools + +**gitnexus_rename** — automated multi-file rename: + +``` +gitnexus_rename({symbol_name: "validateUser", new_name: "authenticateUser", dry_run: true}) +→ 12 edits across 8 files +→ 10 graph edits (high confidence), 2 ast_search edits (review) +→ Changes: [{file_path, edits: [{line, old_text, new_text, confidence}]}] +``` + +**gitnexus_impact** — map all dependents first: + +``` +gitnexus_impact({target: "validateUser", direction: "upstream"}) +→ d=1: loginHandler, apiMiddleware, testUtils +→ Affected Processes: LoginFlow, TokenRefresh +``` + +**gitnexus_detect_changes** — verify your changes after refactoring: + +``` +gitnexus_detect_changes({scope: "all"}) +→ Changed: 8 files, 12 symbols +→ Affected processes: LoginFlow, TokenRefresh +→ Risk: MEDIUM +``` + +**gitnexus_cypher** — custom reference queries: + +```cypher +MATCH (caller)-[:CodeRelation {type: 'CALLS'}]->(f:Function {name: "validateUser"}) +RETURN caller.name, caller.filePath ORDER BY caller.filePath +``` + +## Risk Rules + +| Risk Factor | Mitigation | +| ------------------- | ----------------------------------------- | +| Many callers (>5) | Use gitnexus_rename for automated updates | +| Cross-area refs | Use detect_changes after to verify scope | +| String/dynamic refs | gitnexus_query to find them | +| External/public API | Version and deprecate properly | + +## Example: Rename `validateUser` to `authenticateUser` + +``` +1. gitnexus_rename({symbol_name: "validateUser", new_name: "authenticateUser", dry_run: true}) + → 12 edits: 10 graph (safe), 2 ast_search (review) + → Files: validator.ts, login.ts, middleware.ts, config.json... + +2. Review ast_search edits (config.json: dynamic reference!) + +3. gitnexus_rename({symbol_name: "validateUser", new_name: "authenticateUser", dry_run: false}) + → Applied 12 edits across 8 files + +4. gitnexus_detect_changes({scope: "all"}) + → Affected: LoginFlow, TokenRefresh + → Risk: MEDIUM — run tests for these flows +``` diff --git a/.gitignore b/.gitignore index 9392dd61..1475fe2d 100644 --- a/.gitignore +++ b/.gitignore @@ -34,6 +34,8 @@ docs/_book # TODO: where does this rule come from? test/ +!YumiNail-Core/src/test/ +!YumiNail-Core/src/test/** # ---> Python # Byte-compiled / optimized / DLL files @@ -262,6 +264,8 @@ YumiNail-Admin-Program/utils/config.local.js # Local release/test artifacts release-packages/ +.codex-run/ +output/ .codex-temp-* *.swp diff --git a/.idea/compiler.xml b/.idea/compiler.xml index aa3a0cde..03d76123 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -7,7 +7,6 @@ - @@ -15,22 +14,16 @@ - - - - - - - - - - - + + + + + diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml index 6509128a..f731d3c4 100644 --- a/.idea/sqldialects.xml +++ b/.idea/sqldialects.xml @@ -1,9 +1,6 @@ - - - \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..e244bd5d --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,43 @@ + +# GitNexus — Code Intelligence + +This project is indexed by GitNexus as **xiaowang** (12294 symbols, 23811 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. + +> If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first. + +## Always Do + +- **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. +- **MUST run `gitnexus_detect_changes()` before committing** to verify your changes only affect expected symbols and execution flows. +- **MUST warn the user** if impact analysis returns HIGH or CRITICAL risk before proceeding with edits. +- When exploring unfamiliar code, use `gitnexus_query({query: "concept"})` to find execution flows instead of grepping. It returns process-grouped results ranked by relevance. +- When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use `gitnexus_context({name: "symbolName"})`. + +## Never Do + +- NEVER edit a function, class, or method without first running `gitnexus_impact` on it. +- NEVER ignore HIGH or CRITICAL risk warnings from impact analysis. +- NEVER rename symbols with find-and-replace — use `gitnexus_rename` which understands the call graph. +- NEVER commit changes without running `gitnexus_detect_changes()` to check affected scope. + +## Resources + +| Resource | Use for | +|----------|---------| +| `gitnexus://repo/xiaowang/context` | Codebase overview, check index freshness | +| `gitnexus://repo/xiaowang/clusters` | All functional areas | +| `gitnexus://repo/xiaowang/processes` | All execution flows | +| `gitnexus://repo/xiaowang/process/{name}` | Step-by-step execution trace | + +## CLI + +| Task | Read this skill file | +|------|---------------------| +| Understand architecture / "How does X work?" | `.claude/skills/gitnexus/gitnexus-exploring/SKILL.md` | +| Blast radius / "What breaks if I change X?" | `.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md` | +| Trace bugs / "Why is X failing?" | `.claude/skills/gitnexus/gitnexus-debugging/SKILL.md` | +| Rename / extract / split / refactor | `.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md` | +| Tools, resources, schema reference | `.claude/skills/gitnexus/gitnexus-guide/SKILL.md` | +| Index, status, clean, wiki CLI commands | `.claude/skills/gitnexus/gitnexus-cli/SKILL.md` | + + diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..e244bd5d --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,43 @@ + +# GitNexus — Code Intelligence + +This project is indexed by GitNexus as **xiaowang** (12294 symbols, 23811 relationships, 300 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely. + +> If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first. + +## Always Do + +- **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. +- **MUST run `gitnexus_detect_changes()` before committing** to verify your changes only affect expected symbols and execution flows. +- **MUST warn the user** if impact analysis returns HIGH or CRITICAL risk before proceeding with edits. +- When exploring unfamiliar code, use `gitnexus_query({query: "concept"})` to find execution flows instead of grepping. It returns process-grouped results ranked by relevance. +- When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use `gitnexus_context({name: "symbolName"})`. + +## Never Do + +- NEVER edit a function, class, or method without first running `gitnexus_impact` on it. +- NEVER ignore HIGH or CRITICAL risk warnings from impact analysis. +- NEVER rename symbols with find-and-replace — use `gitnexus_rename` which understands the call graph. +- NEVER commit changes without running `gitnexus_detect_changes()` to check affected scope. + +## Resources + +| Resource | Use for | +|----------|---------| +| `gitnexus://repo/xiaowang/context` | Codebase overview, check index freshness | +| `gitnexus://repo/xiaowang/clusters` | All functional areas | +| `gitnexus://repo/xiaowang/processes` | All execution flows | +| `gitnexus://repo/xiaowang/process/{name}` | Step-by-step execution trace | + +## CLI + +| Task | Read this skill file | +|------|---------------------| +| Understand architecture / "How does X work?" | `.claude/skills/gitnexus/gitnexus-exploring/SKILL.md` | +| Blast radius / "What breaks if I change X?" | `.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md` | +| Trace bugs / "Why is X failing?" | `.claude/skills/gitnexus/gitnexus-debugging/SKILL.md` | +| Rename / extract / split / refactor | `.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md` | +| Tools, resources, schema reference | `.claude/skills/gitnexus/gitnexus-guide/SKILL.md` | +| Index, status, clean, wiki CLI commands | `.claude/skills/gitnexus/gitnexus-cli/SKILL.md` | + + diff --git a/PROJECT_MEMORY.md b/PROJECT_MEMORY.md new file mode 100644 index 00000000..868d737f --- /dev/null +++ b/PROJECT_MEMORY.md @@ -0,0 +1,219 @@ +# YumiNail 项目记忆文件 + +这份文件给后续接手本仓库的 AI/开发者快速建立上下文。切换工作区或开启新会话后,优先阅读本文,再看 `README.md`、`YumiNail-Core/src/main/resources/API.md` 和相关源码。 + +## 1. 项目定位 + +`E:\code\xiaowang` 是 YumiNail 美甲业务系统主仓库。 + +当前主链路: + +- `YumiNail-Frontend`:Vue 3 Web 前台 + Web 后台管理。 +- `WeChatProgram`:微信小程序用户端。 +- `YumiNail-Gateway`:Spring Cloud Gateway 主业务网关。 +- `YumiNail-Core`:Spring Boot 核心业务服务。 +- `YumiNail-Admin-Program`:后台小程序/管理端实验入口,当前不是主要验收面。 + +已从主仓库移除独立日历实验项目: + +- `YumiNail-Calendar-Core` +- `YumiNail-Calendar-Gateway` +- `YumiNail-Calendar-Frontend` + +预约日历现在以内置模块存在于 `YumiNail-Core + YumiNail-Frontend`,数据直接来自主系统订单表和订单项表。 + +## 2. 强约束 + +- 所有 shell 命令必须带 `rtk` 前缀,例如 `rtk npm run build`、`rtk mvn -q -DskipTests compile`。 +- 不新增散落 SQL 文件。结构、补列、索引、权限种子和测试数据都集中到: + - `YumiNail-Core/src/main/resources/files/YumiNail.sql` +- 涉及真实数据库 SQL 时,优先使用 MySQL MCP 执行;如果 MCP 无 DDL 权限,再说明阻塞。 +- 不要回滚用户已有改动。这个仓库经常有大量未提交改动,必须按任务范围谨慎编辑。 +- 手动改文件优先用 `apply_patch`。 +- Web UI 风格偏“柔和浅粉白”,不要再混用大量蓝紫、灰、棕色主题。 +- 页面文案必须中文,避免出现英文验收/测试提示。 + +## 3. 当前重要业务状态 + +### 店长参与制作 + +- 店长账号保持 `type=2`。 +- 通过 `t_nail_artist_info.participate_production` 控制是否参与美甲制作。 +- 参与制作的店长会进入可预约人员体系,用户预约时可选择。 +- 美甲师管理列表需要展示普通美甲师和参与制作店长。 + +### VIP 与余额 + +- `t_balance` 需要同时有: + - `last_update_time`:业务展示字段。 + - `update_time`:MyBatis/BaseEntity 通用更新时间字段。 +- 之前用户报错 `Unknown column 'update_time'`,已补到 SQL 和真实库。 +- VIP 充值配置只展示档位,不接支付、不写余额流水。 +- VIP 等级来源优先取启用的 VIP 充值配置中的等级;没有配置时使用默认等级。 + +### 消息/公告 + +- 消息通知和公告是两个独立模块。 +- 消息通知: + - 可发布文本和单张图片。 + - 可弹窗一次,也可在消息通知模块查看。 +- 公告: + - 首页顶部滚动展示。 + - 不进入消息历史,不弹窗。 +- 消息范围/公告范围都支持管理员平台级、店铺级、指定用户;店长只能管理本店范围。 + +### 地图与店铺位置 + +- 店铺地图位置展示给用户时只显示地点名称/地址,不显示经纬度。 +- 经纬度只作为隐藏数据,用于距离计算、地图预览和导航。 +- 管理员在参数管理中配置地图相关 key。 +- 当前需求倾向:位置选择与展示主要使用腾讯位置服务;高德主要用于导航跳转,Web Key 和小程序 Key 分开配置。 + +### 店铺有效期 + +- `t_shop.authorization_expire_time` 表示授权有效期。 +- 为空代表长期有效。 +- 到期不改 `status`,而是动态冻结。 +- 前台用户登录过期店铺提示“店铺已被冻结”。 +- 后台账号可登录,但非平台管理员业务功能禁用,首页提示授权到期。 + +### 用户关系与自定义角色 + +- 店长可创建店铺内自定义角色,分配角色名和权限。 +- 用户有“店铺 + 直属上级”关系。 +- 自注册可填邀请码绑定上级;不填默认归属当前店铺店长。 +- 后台用户管理必须多维筛选并注意脱敏。 + +### 预约日历 + +- 日历接口在 `YumiNail-Core` 主系统内。 +- 数据来自 `t_order`、`t_order_item.artist_id`、`t_order_item.appointment_time`。 +- 美甲师和参与制作店长查看自己的预约。 +- Web 页面 `/artist-calendar` 是主入口。 +- 预约详情可跳转关联订单、展示订单金额,也可跳转用户选择的作品。 + +## 4. 最近修过的关键坑 + +- 后台管理员登录后立刻提示过期: + - 后台请求应只使用 `adminAccessToken/adminRefreshToken`。 + - `AdminLoginView` 返回前台时不要误删前台 token。 +- 图片上传 JPG 被拒: + - 分片上传的 chunk 不能按最终图片 MIME 校验。 + - 初始化阶段校验原文件元数据;chunk 只校验非空、大小和危险扩展名。 + - JPG MIME 需兼容 `image/jpeg`、`image/jpg`、`image/pjpeg`。 +- 优惠券时间保存失败: + - 后端 Jackson 需兼容 `yyyy-MM-dd HH:mm:ss` 和 ISO `yyyy-MM-ddTHH:mm:ss`。 +- 小程序作品详情未登录跳登录: + - 作品详情是匿名可访问。 + - 只有收藏、加购、下单、评论等动作需要登录。 + - 白名单接口返回 401 时不要触发全局“登录过期”跳转。 +- 小程序页面不可滚动: + - 只在弹窗遮罩上 `catchtouchmove`。 + - 登录页使用可滚动容器,小屏也要能看到按钮。 + +## 5. 运行与验证命令 + +后端: + +```powershell +rtk mvn -q -DskipTests compile +``` + +分别在: + +- `E:\code\xiaowang\YumiNail-Core` +- `E:\code\xiaowang\YumiNail-Gateway` + +Web 前端: + +```powershell +rtk npm run build +``` + +在: + +- `E:\code\xiaowang\YumiNail-Frontend` + +小程序 JS 语法检查: + +```powershell +rtk powershell -NoProfile -Command '& { Get-ChildItem -LiteralPath "WeChatProgram" -Recurse -Filter "*.js" | ForEach-Object { node --check $_.FullName } }' +``` + +## 6. 数据库与配置 + +- 真实 datasource 以 Nacos `YumiNail-Dev / DEFAULT_GROUP / datasource.yaml` 为准。 +- 用户曾明确要求:不要把生产/开发配置写到本地文件里,涉及配置修改应走 Nacos。 +- MySQL MCP 可用于查询和 DML;DDL 可能因权限受限失败,需要确认 MCP 权限。 +- 常用校验: + +```sql +SELECT COLUMN_NAME +FROM information_schema.COLUMNS +WHERE TABLE_SCHEMA = DATABASE() + AND TABLE_NAME = 't_balance' + AND COLUMN_NAME IN ('update_time', 'last_update_time'); +``` + +## 7. 文档与代码风格 + +- 新手友好注释是用户明确要求过的方向,但不要机械生成无意义注释。 +- 推荐注释重点: + - Controller:接口路径、参数用途、调用链。 + - Service/ServiceImpl:业务规则、权限边界、关键校验。 + - DTO/VO:字段含义和前端调用注意点。 +- 避免英文测试文案、英文占位验收数据出现在用户界面。 +- 避免大范围重写乱码文件,除非该文件正好在本轮任务范围内。 + +## 8. Web 前端体验偏好 + +- 用户端页面参考小程序布局,顶部栏风格统一。 +- 作品列表: + - 不要左侧分类栏。 + - 使用顶部横向滑动、吸顶标签栏,类似小红书。 +- 作品详情: + - 图片可点击放大。 + - 详情信息保持高密度,重点展示所属门店、可约美甲师。 + - 分享链接无需登录即可查看详情。 +- 我的订单: + - 订单号支持一键复制。 + - 提供多维筛选。 +- 后台: + - 侧边栏响应式可折叠。 + - 左上角 Logo/标题不要挤在一起。 + - 仪表盘显示订单金额、客户数、美甲师数、今日/近 7 日增量、快捷跳转。 + +## 9. 常见文件入口 + +后端: + +- `YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/controller` +- `YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/service` +- `YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/service/impl` +- `YumiNail-Core/src/main/java/com/xiaowang/yuminailcore/support/security` +- `YumiNail-Core/src/main/resources/files/YumiNail.sql` + +Web: + +- `YumiNail-Frontend/src/api` +- `YumiNail-Frontend/src/views` +- `YumiNail-Frontend/src/views/admin` +- `YumiNail-Frontend/src/components` +- `YumiNail-Frontend/src/style.css` + +小程序: + +- `WeChatProgram/pages` +- `WeChatProgram/api` +- `WeChatProgram/utils/request.js` +- `WeChatProgram/app.wxss` + +## 10. 接手建议 + +1. 先读本文件和 `README.md`。 +2. 运行 `git status --short`,确认已有改动,不要回滚无关文件。 +3. 根据任务锁定最小文件范围。 +4. 后端改动后编译 Core/Gateway。 +5. Web 改动后跑 `npm run build`。 +6. 小程序改动后跑全量 `node --check`。 +7. 涉及 SQL,先改 `YumiNail.sql`,再用 MySQL MCP 对真实库执行或校验。 diff --git a/README.md b/README.md index 21e07aef..e21770fc 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,11 @@ ## 项目简介 -本仓库围绕 `YumiNail` 美甲业务系统展开,当前包含 3 组主要能力: +本仓库围绕 `YumiNail` 美甲业务系统展开,当前主链路包括: -1. `YumiNail` 主业务系统 - 覆盖网页前台、后台管理、网关、核心业务、数据库初始化脚本。 -2. `WeChatProgram` - 面向普通用户的小程序端,和主业务系统共用一套核心后端接口。 -3. `YumiNail-Calendar-*` 日历子系统 - 提供独立的预约日历前端、网关和后端服务。 +1. `YumiNail` 主业务系统:Web 前台、Web 后台、网关、核心后端和数据库初始化脚本。 +2. `WeChatProgram`:面向普通用户的小程序端,复用主业务后端接口。 +3. `YumiNail-Core` 内置美甲师预约日历模块:日历数据直接来自主系统订单和订单项,不再维护独立日历服务。 `MessageHub` 已拆分为独立仓库:`http://wcy111.top:3000/xiaowang/messgehub.git`。 @@ -20,50 +17,18 @@ | `YumiNail-Frontend` | Vue 3 前端 | 用户前台 + 后台管理 SPA | | `WeChatProgram` | 微信小程序 | 用户端小程序入口 | | `YumiNail-Gateway` | Spring Cloud Gateway | 主业务统一 API 入口 | -| `YumiNail-Core` | Spring Boot | 用户、店铺、商品、订单、优惠券、权限、文件等核心业务 | -| `YumiNail-Calendar-Frontend` | Vue 3 前端 | 美甲师预约日历独立前端 | -| `YumiNail-Calendar-Gateway` | Gateway | 日历系统网关 | -| `YumiNail-Calendar-Core` | Spring Boot | 日历系统后端 | +| `YumiNail-Core` | Spring Boot | 用户、店铺、作品、订单、优惠券、权限、文件、预约日历等核心业务 | | `docs` | 文档目录 | 架构分析、变更记录、需求跟踪、实施记录 | ## 运行依赖 - `Nacos`:注册中心与配置中心 -- `MySQL`:主业务、日历系统数据存储 +- `MySQL`:主业务数据存储 - `Redis`:登录态、验证码、缓存、临时 ticket - `RabbitMQ`:主业务异步消息投递 - `MinIO`:对象存储与图片文件访问 - `JDK 21`、`Maven`、`Node.js / npm` -## 文档入口 - -- [整体架构总览](docs/architecture/整体架构总览.md) -- [项目架构分析](docs/architecture/项目架构分析.md) -- [功能清单](docs/architecture/功能清单.md) -- [网页前端 README](YumiNail-Frontend/README.md) -- [网页前端项目详细总结](YumiNail-Frontend/项目详细总结.md) -- [待优化建议](docs/features/待优化建议.md) -- [历史变更记录](docs/changes/) - ## 初始化说明 -### YumiNail 主业务 - -- 首次部署空库时,优先执行: - - `YumiNail-Core/src/main/resources/files/YumiNail.sql` -- 已部署环境做增量升级时,再按补丁文件逐步执行: - - `YumiNail-Core/src/main/resources/files/*.sql` - -## 推荐阅读顺序 - -1. 先阅读 [README](README.md) 了解模块边界。 -2. 再阅读 [整体架构总览](docs/architecture/整体架构总览.md) 把握系统关系。 -3. 接着阅读 [项目架构分析](docs/architecture/项目架构分析.md) 了解登录、权限、白名单、消息链路与部署口径。 -4. 如需查看业务能力范围,阅读 [功能清单](docs/architecture/功能清单.md)。 -5. 如需查看最近改动,阅读 `docs/changes/` 下对应日期文档。 - -## 维护约定 - -- 每次任务完成后,在 `docs/changes/` 留存一份变更记录。 -- 待确认或待实现建议放在 `docs/features/`。 -- 若涉及 SQL 结构或初始化变更,需要同时给出增量 SQL,并同步更新首次部署所需的初始化 SQL。 +数据库初始化脚本集中在 `YumiNail-Core/src/main/resources/files/YumiNail.sql`。新增结构、补列、索引、权限种子和验收数据都应继续收口到该文件,不再新增散落 SQL 文件。 diff --git a/WeChatProgram/app.js b/WeChatProgram/app.js index 5b796396..fbd0dd02 100644 --- a/WeChatProgram/app.js +++ b/WeChatProgram/app.js @@ -1,8 +1,11 @@ const authApi = require('./api/auth') const cartApi = require('./api/cart') +const shopApi = require('./api/shop') const userApi = require('./api/user') const auth = require('./utils/auth') const idleSession = require('./utils/idle-session') +const theme = require('./utils/theme') +const file = require('./utils/file') const { IDLE_TIMEOUT_MS, IDLE_WARNING_MS } = require('./utils/config') App({ @@ -10,6 +13,7 @@ App({ userInfo: null, isLoggedIn: false, cartCount: 0, + shopTheme: theme.DEFAULT_SHOP_THEME, pendingProductFilter: null, pendingWechatMiniLogin: null, wechatMiniAutoLoginState: 'idle' @@ -41,6 +45,7 @@ App({ const isLoggedIn = auth.isLoggedIn() this.globalData.userInfo = userInfo this.globalData.isLoggedIn = isLoggedIn + this.refreshShopTheme(userInfo) if (userInfo && userInfo.shopId) { auth.setPreferredMiniLoginShopId(userInfo.shopId) @@ -161,6 +166,7 @@ App({ auth.setSession(payload) this.globalData.userInfo = auth.getStoredUserInfo() this.globalData.isLoggedIn = auth.isLoggedIn() + this.refreshShopTheme(this.globalData.userInfo) if (this.globalData.userInfo && this.globalData.userInfo.shopId) { auth.setPreferredMiniLoginShopId(this.globalData.userInfo.shopId) @@ -173,6 +179,7 @@ App({ auth.updateStoredUserInfo(userInfo) this.globalData.userInfo = userInfo this.globalData.isLoggedIn = auth.isLoggedIn() + this.refreshShopTheme(userInfo) if (userInfo && userInfo.shopId) { auth.setPreferredMiniLoginShopId(userInfo.shopId) @@ -183,9 +190,62 @@ App({ auth.clearSession() this.globalData.userInfo = null this.globalData.isLoggedIn = false + this.setShopTheme(null) this.clearCartBadge() }, + setShopTheme(shop) { + const resolvedTheme = theme.resolveShopTheme(shop) + this.globalData.shopTheme = resolvedTheme + this.syncThemeToCurrentPages() + if (resolvedTheme.backgroundImageFileId) { + this.resolveShopThemeBackground(shop, resolvedTheme.backgroundImageFileId) + } + }, + + async resolveShopThemeBackground(shop, fileId) { + try { + const backgroundImageUrl = await file.getSignedUrl(fileId) + if ( + !backgroundImageUrl + || !this.globalData.shopTheme + || this.globalData.shopTheme.backgroundImageFileId !== String(fileId) + ) { + return + } + this.globalData.shopTheme = theme.resolveShopTheme({ + ...(shop || {}), + themeBackgroundImageUrl: backgroundImageUrl + }) + this.syncThemeToCurrentPages() + } catch (error) {} + }, + + async refreshShopTheme(userInfo) { + if (!userInfo || !userInfo.shopId) { + this.setShopTheme(null) + return + } + try { + const shop = await shopApi.getShopById(userInfo.shopId) + if (this.globalData.userInfo && String(this.globalData.userInfo.shopId) === String(userInfo.shopId)) { + this.setShopTheme(shop) + } + } catch (error) { + this.setShopTheme(null) + } + }, + + syncThemeToCurrentPages() { + const pages = typeof getCurrentPages === 'function' ? getCurrentPages() : [] + const data = theme.pageThemeData(this.globalData.shopTheme) + pages.forEach(page => { + if (page && typeof page.setData === 'function') { + page.setData(data) + } + }) + }, + async refreshSessionUserInfo() { if (!auth.isLoggedIn()) { return diff --git a/WeChatProgram/app.json b/WeChatProgram/app.json index 83bd2349..59b51f45 100644 --- a/WeChatProgram/app.json +++ b/WeChatProgram/app.json @@ -19,12 +19,12 @@ "navigationBarTextStyle": "black", "navigationStyle": "custom", "backgroundTextStyle": "light", - "backgroundColor": "#fff7f8" + "backgroundColor": "#fff7f9" }, "tabBar": { "color": "#8f7b83", "selectedColor": "#c6597d", - "backgroundColor": "#fffaf9", + "backgroundColor": "#fff7f9", "borderStyle": "black", "position": "bottom", "list": [ diff --git a/WeChatProgram/app.wxss b/WeChatProgram/app.wxss index 7af11a15..851b655e 100644 --- a/WeChatProgram/app.wxss +++ b/WeChatProgram/app.wxss @@ -1,8 +1,15 @@ page { - min-height: 100%; - background: - radial-gradient(circle at top right, rgba(255, 205, 219, 0.38), transparent 32%), - linear-gradient(180deg, #fff7f8 0%, #fffdfc 100%); + --theme-primary: #c6597d; + --theme-secondary: #e9b7c7; + --theme-accent: #9f4967; + --theme-page-bg: #fff7f9; + --theme-card-bg: #ffffff; + --theme-border: #efd8e0; + --theme-primary-soft: #fbf1f4; + --theme-gradient: linear-gradient(135deg, #c6597d 0%, #e9b7c7 100%); + --theme-gradient-soft: linear-gradient(145deg, #ffffff 0%, #fff1f5 58%, #ffe8ef 100%); + min-height: 100vh; + background: var(--theme-page-bg); color: #2d2430; font-size: 28rpx; } @@ -39,6 +46,7 @@ button::after { .page-shell { min-height: 100vh; padding-bottom: calc(env(safe-area-inset-bottom) + 48rpx); + background: var(--theme-page-bg); } .page-content { @@ -47,14 +55,14 @@ button::after { .page-card { overflow: hidden; - background: #ffffff; - border: 1rpx solid rgba(239, 216, 224, 0.86); + background: var(--theme-card-bg); + border: 1rpx solid var(--theme-border); border-radius: 32rpx; box-shadow: 0 22rpx 56rpx rgba(122, 67, 88, 0.1); } .glass-card { - background: rgba(255, 255, 255, 0.8); + background: rgba(255, 255, 255, 0.82); border: 1rpx solid rgba(255, 255, 255, 0.9); border-radius: 32rpx; box-shadow: 0 22rpx 56rpx rgba(122, 67, 88, 0.08); @@ -64,8 +72,8 @@ button::after { overflow: hidden; padding: 34rpx 30rpx; border-radius: 36rpx; - background: linear-gradient(145deg, #fffdfd 0%, #fff1f5 56%, #ffe8ef 100%); - border: 1rpx solid rgba(244, 214, 224, 0.92); + background: var(--theme-gradient-soft); + border: 1rpx solid var(--theme-border); box-shadow: 0 28rpx 64rpx rgba(122, 67, 88, 0.1); } @@ -74,7 +82,7 @@ button::after { font-size: 22rpx; font-weight: 700; letter-spacing: 2rpx; - color: #c6597d; + color: var(--theme-primary); } .hero-title { @@ -114,7 +122,7 @@ button::after { } .hero-action.primary { - background: linear-gradient(135deg, #ff8cb0 0%, #c6597d 100%); + background: var(--theme-gradient); color: #ffffff; } @@ -145,7 +153,7 @@ button::after { font-size: 22rpx; font-weight: 700; letter-spacing: 2rpx; - color: #c6597d; + color: var(--theme-primary); } .section-title { @@ -165,7 +173,7 @@ button::after { .section-link { font-size: 24rpx; - color: #c6597d; + color: var(--theme-primary); font-weight: 700; } @@ -213,7 +221,7 @@ button::after { width: 100%; height: 92rpx; border-radius: 999rpx; - background: linear-gradient(135deg, #ff8cb0 0%, #c6597d 100%); + background: var(--theme-gradient); color: #ffffff; font-size: 30rpx; font-weight: 700; @@ -226,8 +234,8 @@ button::after { width: 100%; height: 84rpx; border-radius: 999rpx; - border: 2rpx solid #efd7df; - background: #ffffff; + border: 2rpx solid var(--theme-border); + background: var(--theme-card-bg); color: #7a5262; font-size: 28rpx; font-weight: 600; @@ -241,8 +249,8 @@ button::after { height: 68rpx; padding: 0 26rpx; border-radius: 999rpx; - background: #fdf0f4; - color: #c6597d; + background: var(--theme-primary-soft); + color: var(--theme-primary); font-size: 24rpx; font-weight: 600; } @@ -264,8 +272,8 @@ button::after { min-height: 92rpx; padding: 0 28rpx; border-radius: 24rpx; - background: #fbf5f7; - border: 1rpx solid rgba(239, 216, 224, 0.92); + background: var(--theme-primary-soft); + border: 1rpx solid var(--theme-border); color: #2d2430; font-size: 28rpx; } @@ -287,18 +295,18 @@ button::after { } .status-text.success { - color: #2ea36f; + color: var(--theme-primary); } .status-text.error { - color: #d5536f; + color: var(--theme-accent); } .hint-card { padding: 20rpx 22rpx; border-radius: 22rpx; - background: #fff8ea; - color: #9b6900; + background: var(--theme-primary-soft); + color: var(--theme-accent); font-size: 24rpx; line-height: 1.7; } @@ -336,17 +344,17 @@ button::after { } .chip { - background: #fce8ef; - color: #c6597d; + background: var(--theme-primary-soft); + color: var(--theme-primary); } .soft-chip { - background: #fbf5f7; + background: var(--theme-primary-soft); color: #8d7a84; } .divider-line { width: 100%; height: 2rpx; - background: #f3e7eb; + background: var(--theme-border); } diff --git a/WeChatProgram/components/product-card/product-card.wxss b/WeChatProgram/components/product-card/product-card.wxss index f3d2529c..284fc4a4 100644 --- a/WeChatProgram/components/product-card/product-card.wxss +++ b/WeChatProgram/components/product-card/product-card.wxss @@ -4,8 +4,8 @@ min-width: 0; overflow: hidden; border-radius: 28rpx; - background: #ffffff; - border: 1rpx solid rgba(239, 216, 224, 0.84); + background: var(--theme-card-bg); + border: 1rpx solid var(--theme-border); box-shadow: 0 18rpx 42rpx rgba(122, 67, 88, 0.08); } @@ -16,7 +16,7 @@ .product-cover { width: 100%; height: 288rpx; - background: #f7ecf0; + background: var(--theme-primary-soft); } .product-cover-shadow { @@ -82,8 +82,8 @@ max-width: 100%; padding: 6rpx 14rpx; border-radius: 999rpx; - background: #fbecf1; - color: #c6597d; + background: var(--theme-primary-soft); + color: var(--theme-primary); font-size: 18rpx; line-height: 1; overflow: hidden; @@ -114,7 +114,7 @@ font-size: 34rpx; line-height: 1.12; font-weight: 800; - color: #d5536f; + color: var(--theme-accent); } .product-stats { @@ -132,7 +132,7 @@ width: 64rpx; height: 64rpx; border-radius: 22rpx; - background: linear-gradient(135deg, #ff8cb0 0%, #c6597d 100%); + background: var(--theme-gradient); box-shadow: 0 14rpx 30rpx rgba(198, 89, 125, 0.22); } @@ -209,8 +209,8 @@ height: 56rpx; padding: 0 18rpx; border-radius: 999rpx; - background: #f8eef1; - color: #8f6e7a; + background: var(--theme-primary-soft); + color: var(--theme-accent); font-size: 20rpx; font-weight: 700; white-space: nowrap; diff --git a/WeChatProgram/pages/auth/index.js b/WeChatProgram/pages/auth/index.js index 372b22d0..7b3545e2 100644 --- a/WeChatProgram/pages/auth/index.js +++ b/WeChatProgram/pages/auth/index.js @@ -4,6 +4,7 @@ const userApi = require('../../api/user') const authStore = require('../../utils/auth') const actionGuard = require('../../utils/action-guard') const navigation = require('../../utils/navigation') +const theme = require('../../utils/theme') const { runWithLoading } = require('../../utils/loading') const { createKeyboardSafeData, @@ -23,7 +24,7 @@ const phoneRegex = /^1[3-9]\d{9}$/ Page({ data: Object.assign(createKeyboardSafeData({ cursorSpacing: 108 - }), { + }), theme.pageThemeData(getApp().globalData.shopTheme), { redirect: '', activeTab: 'login', loginType: 'password', diff --git a/WeChatProgram/pages/auth/index.wxml b/WeChatProgram/pages/auth/index.wxml index 2033791b..abc65f07 100644 --- a/WeChatProgram/pages/auth/index.wxml +++ b/WeChatProgram/pages/auth/index.wxml @@ -1,7 +1,7 @@ - - + + - + @@ -11,7 +11,7 @@ - diff --git a/WeChatProgram/pages/auth/index.wxss b/WeChatProgram/pages/auth/index.wxss index 4e88ca6d..a6dba1ff 100644 --- a/WeChatProgram/pages/auth/index.wxss +++ b/WeChatProgram/pages/auth/index.wxss @@ -1,9 +1,11 @@ .auth-page-root { min-height: 100vh; + overflow: visible; } .auth-scroll { - min-height: 100%; + height: 100vh; + box-sizing: border-box; } .auth-page-shell { @@ -11,18 +13,16 @@ } .auth-page { - background: - radial-gradient(circle at top right, rgba(255, 204, 219, 0.32), transparent 30%), - linear-gradient(180deg, #fff8fa 0%, #fffdfc 100%); + background: var(--theme-page-bg); } .auth-content { min-height: 100%; display: flex; flex-direction: column; - justify-content: center; + justify-content: flex-start; align-items: center; - padding: 24rpx 24rpx 40rpx; + padding: 24rpx 24rpx calc(80rpx + env(safe-area-inset-bottom)); } .auth-content.keyboard-active { @@ -38,7 +38,7 @@ } .auth-panel { - margin-top: 0; + margin-top: 24rpx; } .reset-card { @@ -62,7 +62,7 @@ margin-bottom: 14rpx; padding: 10rpx; border-radius: 999rpx; - background: #faf4f6; + background: var(--theme-primary-soft); } .tab-item, @@ -80,16 +80,16 @@ .tab-item.active, .toggle-item.active { - background: #fde8ef; - color: #c6597d; + background: var(--theme-primary-soft); + color: var(--theme-primary); } .wechat-login-panel { padding: 24rpx 22rpx; border-radius: 28rpx; - background: linear-gradient(145deg, #f3fff8 0%, #e4fff0 52%, #d5fae6 100%); - border: 1rpx solid rgba(121, 214, 152, 0.46); - box-shadow: 0 18rpx 38rpx rgba(45, 175, 93, 0.12); + background: var(--theme-gradient-soft); + border: 1rpx solid var(--theme-border); + box-shadow: 0 18rpx 38rpx rgba(122, 67, 88, 0.1); } .wechat-login-copy { @@ -117,13 +117,13 @@ } .wechat-login-btn.primary-btn { - background: linear-gradient(135deg, #32d16d 0%, #13a847 100%); - box-shadow: 0 16rpx 36rpx rgba(19, 168, 71, 0.24); + background: var(--theme-gradient); + box-shadow: 0 16rpx 36rpx rgba(122, 67, 88, 0.16); } .wechat-login-btn-disabled { - color: #5d8f69; - border-color: rgba(121, 214, 152, 0.42); + color: var(--theme-accent); + border-color: var(--theme-border); background: rgba(255, 255, 255, 0.82); } @@ -132,7 +132,7 @@ margin-top: 14rpx; font-size: 22rpx; line-height: 1.6; - color: #58806a; + color: var(--theme-accent); } .mini-login-resume { @@ -207,8 +207,8 @@ height: 92rpx; padding: 0 18rpx; border-radius: 24rpx; - background: #fde8ef; - color: #c6597d; + background: var(--theme-primary-soft); + color: var(--theme-primary); font-size: 24rpx; font-weight: 700; } @@ -226,7 +226,7 @@ .aux-link { font-size: 24rpx; - color: #c6597d; + color: var(--theme-primary); font-weight: 600; } @@ -268,8 +268,8 @@ } .agreement-check.checked { - border-color: #c6597d; - background: #c6597d; + border-color: var(--theme-primary); + background: var(--theme-primary); } .agreement-copy { @@ -278,7 +278,7 @@ } .agreement-link { - color: #c6597d; + color: var(--theme-primary); font-weight: 700; } @@ -331,7 +331,7 @@ margin-top: 22rpx; padding: 20rpx; border-radius: 22rpx; - background: #fff7f8; + background: var(--theme-primary-soft); color: #5a4a52; font-size: 24rpx; line-height: 1.85; @@ -366,7 +366,7 @@ font-size: 22rpx; font-weight: 700; letter-spacing: 2rpx; - color: #c6597d; + color: var(--theme-primary); } .mini-shop-title { diff --git a/WeChatProgram/pages/cart/index.js b/WeChatProgram/pages/cart/index.js index e26a22f8..ee93b02a 100644 --- a/WeChatProgram/pages/cart/index.js +++ b/WeChatProgram/pages/cart/index.js @@ -3,6 +3,7 @@ const couponApi = require('../../api/coupon') const orderApi = require('../../api/order') const auth = require('../../utils/auth') const navigation = require('../../utils/navigation') +const theme = require('../../utils/theme') const { resolveLegacyImage } = require('../../utils/file') const { NO_COUPON_KEY } = require('../../utils/config') const { runWithLoading } = require('../../utils/loading') @@ -113,7 +114,7 @@ function buildCheckoutIssues(items) { * Call guide: page data drives the WXML template, and each method is called by user events or lifecycle callbacks. */ Page({ - data: { + data: Object.assign(theme.pageThemeData(getApp().globalData.shopTheme), { isLoggedIn: false, loading: false, minDate: getMinDateText(), @@ -128,7 +129,7 @@ Page({ totalAmountText: '¥0.00', checkoutIssues: [], submittingOrder: false - }, + }), /** * `onShow` page method. Use this from WXML event bindings or lifecycle hooks. diff --git a/WeChatProgram/pages/cart/index.wxml b/WeChatProgram/pages/cart/index.wxml index d2116f79..e6030bd8 100644 --- a/WeChatProgram/pages/cart/index.wxml +++ b/WeChatProgram/pages/cart/index.wxml @@ -1,6 +1,6 @@ - + - + 登录后查看购物车 @@ -97,14 +97,14 @@