初始化项目文档结构:分离开发者文档和用户手册

This commit is contained in:
lzh
2026-03-26 10:40:23 +08:00
commit 5ea1a0c70c
29 changed files with 82436 additions and 0 deletions

View File

@@ -0,0 +1,82 @@
{
"userName": "",
"enableBlocklist": true,
"allowExternalAccess": false,
"blockedCommands": {
"unix": [
"rm -rf",
"chmod 777",
"chmod -R 777"
],
"windows": [
"del /s /q",
"rd /s /q",
"rmdir /s /q",
"format",
"diskpart",
"Remove-Item -Recurse -Force",
"Remove-Item -Force -Recurse",
"Remove-Item -r -fo",
"Remove-Item -fo -r",
"Remove-Item -Recurse",
"Remove-Item -r",
"ri -Recurse",
"ri -r",
"ri -Force",
"ri -fo",
"rm -r -fo",
"rm -Recurse",
"rm -Force",
"del -Recurse",
"del -Force",
"erase -Recurse",
"erase -Force",
"rd -Recurse",
"rmdir -Recurse",
"Format-Volume",
"Clear-Disk",
"Initialize-Disk",
"Remove-Partition"
]
},
"permissionMode": "yolo",
"model": "haiku",
"thinkingBudget": "off",
"effortLevel": "high",
"enableAutoTitleGeneration": true,
"titleGenerationModel": "",
"enableChrome": false,
"enableBangBash": false,
"enableOpus1M": true,
"enableSonnet1M": false,
"excludedTags": [],
"mediaFolder": "",
"systemPrompt": "",
"allowedExportPaths": [
"~/Desktop",
"~/Downloads"
],
"persistentExternalContextPaths": [],
"environmentVariables": "",
"envSnippets": [],
"customContextLimits": {},
"keyboardNavigation": {
"scrollUpKey": "w",
"scrollDownKey": "s",
"focusInputKey": "i"
},
"locale": "zh-CN",
"claudeCliPath": "",
"claudeCliPathsByHost": {
"wwlh01": "C:\\devTools\\nodejs\\node_modules\\@anthropic-ai\\claude-code\\cli.js"
},
"loadUserClaudeSettings": true,
"lastClaudeModel": "haiku",
"lastCustomModel": "",
"lastEnvHash": "",
"maxTabs": 3,
"tabBarPosition": "input",
"enableAutoScroll": true,
"openInMainTab": false,
"hiddenSlashCommands": []
}

View File

@@ -0,0 +1,19 @@
{
"id": "conv-1774491344119-vtzl0zypu",
"title": "帮我删除这个仓库的所有内容然后建立初始化git",
"titleGenerationStatus": "failed",
"createdAt": 1774491344124,
"updatedAt": 1774492799849,
"lastResponseAt": 1774492799849,
"sessionId": "724660e2-bef1-427c-85e6-6efe8974c8fb",
"sdkSessionId": "724660e2-bef1-427c-85e6-6efe8974c8fb",
"usage": {
"model": "haiku",
"inputTokens": 8,
"cacheCreationInputTokens": 466,
"cacheReadInputTokens": 100009,
"contextWindow": 200000,
"contextTokens": 100483,
"percentage": 50
}
}

11
.claude/settings.json Normal file
View File

@@ -0,0 +1,11 @@
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"permissions": {
"allow": [],
"deny": [],
"ask": []
},
"enabledPlugins": {
"claude-ralph-agent@ralph-marketplace": false
}
}

View File

@@ -0,0 +1,7 @@
{
"permissions": {
"allow": [
"WebFetch(domain:raw.githubusercontent.com)"
]
}
}

3
.obsidian/app.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"promptDelete": false
}

1
.obsidian/appearance.json vendored Normal file
View File

@@ -0,0 +1 @@
{}

5
.obsidian/community-plugins.json vendored Normal file
View File

@@ -0,0 +1,5 @@
[
"obsidian42-brat",
"obsidian-git",
"claudian"
]

33
.obsidian/core-plugins.json vendored Normal file
View File

@@ -0,0 +1,33 @@
{
"file-explorer": true,
"global-search": true,
"switcher": true,
"graph": true,
"backlink": true,
"canvas": true,
"outgoing-link": true,
"tag-pane": true,
"footnotes": false,
"properties": true,
"page-preview": true,
"daily-notes": true,
"templates": true,
"note-composer": true,
"command-palette": true,
"slash-command": false,
"editor-status": true,
"bookmarks": true,
"markdown-importer": false,
"zk-prefixer": false,
"random-note": false,
"outline": true,
"word-count": true,
"slides": false,
"audio-recorder": false,
"workspaces": false,
"file-recovery": true,
"publish": false,
"sync": true,
"bases": true,
"webviewer": false
}

22
.obsidian/graph.json vendored Normal file
View File

@@ -0,0 +1,22 @@
{
"collapse-filter": true,
"search": "",
"showTags": false,
"showAttachments": false,
"hideUnresolved": false,
"showOrphans": true,
"collapse-color-groups": true,
"colorGroups": [],
"collapse-display": true,
"showArrow": false,
"textFadeMultiplier": 0,
"nodeSizeMultiplier": 1,
"lineSizeMultiplier": 1,
"collapse-forces": true,
"centerStrength": 0.518713248970312,
"repelStrength": 10,
"linkStrength": 1,
"linkDistance": 250,
"scale": 1,
"close": false
}

11
.obsidian/plugins/claudian/data.json vendored Normal file
View File

@@ -0,0 +1,11 @@
{
"tabManagerState": {
"openTabs": [
{
"tabId": "tab-1774491293239-9pz200a",
"conversationId": "conv-1774491344119-vtzl0zypu"
}
],
"activeTabId": "tab-1774491293239-9pz200a"
}
}

73765
.obsidian/plugins/claudian/main.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1 @@
{"id":"claudian","name":"Claudian","version":"1.3.71","minAppVersion":"1.4.5","description":"Embeds Claude Code as an AI collaborator in your vault. Your vault becomes Claude's working directory, giving it full agentic capabilities: file read/write, search, bash commands, and multi-step workflows.","author":"Yishen Tu","authorUrl":"https://github.com/YishenTu","isDesktopOnly":true}

5534
.obsidian/plugins/claudian/styles.css vendored Normal file

File diff suppressed because it is too large Load Diff

452
.obsidian/plugins/obsidian-git/main.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,10 @@
{
"author": "Vinzent",
"authorUrl": "https://github.com/Vinzent03",
"id": "obsidian-git",
"name": "Git",
"description": "Integrate Git version control with automatic backup and other advanced features.",
"isDesktopOnly": false,
"fundingUrl": "https://ko-fi.com/vinzent",
"version": "2.38.0"
}

View File

@@ -0,0 +1,23 @@
#!/bin/sh
PROMPT="$1"
TEMP_FILE="$OBSIDIAN_GIT_CREDENTIALS_INPUT"
cleanup() {
rm -f "$TEMP_FILE" "$TEMP_FILE.response"
}
trap cleanup EXIT
echo "$PROMPT" > "$TEMP_FILE"
while [ ! -e "$TEMP_FILE.response" ]; do
if [ ! -e "$TEMP_FILE" ]; then
echo "Trigger file got removed: Abort" >&2
exit 1
fi
sleep 0.1
done
RESPONSE=$(cat "$TEMP_FILE.response")
echo "$RESPONSE"

View File

@@ -0,0 +1,710 @@
@keyframes loading {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.git-signs-gutter {
.cm-gutterElement {
/* Needed to align the sign properly for different line heigts. Such as
* when having a heading or list item.
*/
padding-top: 0 !important;
}
}
.workspace-leaf-content[data-type="git-view"] .button-border {
border: 2px solid var(--interactive-accent);
border-radius: var(--radius-s);
}
.workspace-leaf-content[data-type="git-view"] .view-content {
padding-left: 0;
padding-top: 0;
padding-right: 0;
}
.workspace-leaf-content[data-type="git-history-view"] .view-content {
padding-left: 0;
padding-top: 0;
padding-right: 0;
}
.loading {
overflow: hidden;
}
.loading > svg {
animation: 2s linear infinite loading;
transform-origin: 50% 50%;
display: inline-block;
}
.obsidian-git-center {
margin: auto;
text-align: center;
width: 50%;
}
.obsidian-git-textarea {
display: block;
margin-left: auto;
margin-right: auto;
}
.obsidian-git-disabled {
opacity: 0.5;
}
.obsidian-git-center-button {
display: block;
margin: 20px auto;
}
.tooltip.mod-left {
overflow-wrap: break-word;
}
.tooltip.mod-right {
overflow-wrap: break-word;
}
/* Limits the scrollbar to the view body */
.git-view {
display: flex;
flex-direction: column;
position: relative;
height: 100%;
}
/* Re-enable wrapping of nav buttns to prevent overflow on smaller screens #*/
.workspace-drawer .git-view .nav-buttons-container {
flex-wrap: wrap;
}
.git-tools {
display: flex;
margin-left: auto;
}
.git-tools .type {
padding-left: var(--size-2-1);
display: flex;
align-items: center;
justify-content: center;
width: 11px;
}
.git-tools .type[data-type="M"] {
color: orange;
}
.git-tools .type[data-type="D"] {
color: red;
}
.git-tools .buttons {
display: flex;
}
.git-tools .buttons > * {
padding: 0 0;
height: auto;
}
.workspace-leaf-content[data-type="git-view"] .tree-item-self,
.workspace-leaf-content[data-type="git-history-view"] .tree-item-self {
align-items: center;
}
.workspace-leaf-content[data-type="git-view"]
.tree-item-self:hover
.clickable-icon,
.workspace-leaf-content[data-type="git-history-view"]
.tree-item-self:hover
.clickable-icon {
color: var(--icon-color-hover);
}
/* Highlight an item as active if it's diff is currently opened */
.is-active .git-tools .buttons > * {
color: var(--nav-item-color-active);
}
.git-author {
color: var(--text-accent);
}
.git-date {
color: var(--text-accent);
}
.git-ref {
color: var(--text-accent);
}
/* ====== diff2html ======
The following styles are adapted from the obsidian-version-history plugin by
@kometenstaub https://github.com/kometenstaub/obsidian-version-history-diff/blob/main/src/styles.scss
which itself is adapted from the diff2html library with the following original license:
https://github.com/rtfpessoa/diff2html/blob/master/LICENSE.md
Copyright 2014-2016 Rodrigo Fernandes https://rtfpessoa.github.io/
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
.theme-dark,
.theme-light {
--git-delete-bg: #ff475040;
--git-delete-hl: #96050a75;
--git-insert-bg: #68d36840;
--git-insert-hl: #23c02350;
--git-change-bg: #ffd55840;
--git-selected: #3572b0;
--git-delete: #c33;
--git-insert: #399839;
--git-change: #d0b44c;
--git-move: #3572b0;
}
.git-diff {
.d2h-d-none {
display: none;
}
.d2h-wrapper {
text-align: left;
border-radius: 0.25em;
overflow: auto;
}
.d2h-file-header.d2h-file-header {
background-color: var(--background-secondary);
border-bottom: 1px solid var(--background-modifier-border);
font-family:
Source Sans Pro,
Helvetica Neue,
Helvetica,
Arial,
sans-serif;
height: 35px;
padding: 5px 10px;
}
.d2h-file-header,
.d2h-file-stats {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.d2h-file-header {
display: none;
}
.d2h-file-stats {
font-size: 14px;
margin-left: auto;
}
.d2h-lines-added {
border: 1px solid var(--color-green);
border-radius: 5px 0 0 5px;
color: var(--color-green);
padding: 2px;
text-align: right;
vertical-align: middle;
}
.d2h-lines-deleted {
border: 1px solid var(--color-red);
border-radius: 0 5px 5px 0;
color: var(--color-red);
margin-left: 1px;
padding: 2px;
text-align: left;
vertical-align: middle;
}
.d2h-file-name-wrapper {
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
font-size: 15px;
width: 100%;
}
.d2h-file-name {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: var(--text-normal);
font-size: var(--h5-size);
}
.d2h-file-wrapper {
border: 1px solid var(--background-secondary-alt);
border-radius: 3px;
margin-bottom: 1em;
max-height: 100%;
}
.d2h-file-collapse {
-webkit-box-pack: end;
-ms-flex-pack: end;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
border: 1px solid var(--background-secondary-alt);
border-radius: 3px;
cursor: pointer;
display: none;
font-size: 12px;
justify-content: flex-end;
padding: 4px 8px;
}
.d2h-file-collapse.d2h-selected {
background-color: var(--git-selected);
}
.d2h-file-collapse-input {
margin: 0 4px 0 0;
}
.d2h-diff-table {
border-collapse: collapse;
font-family: var(--font-monospace);
font-size: var(--code-size);
width: 100%;
}
.d2h-files-diff {
width: 100%;
}
.d2h-file-diff {
/*
overflow-y: scroll;
*/
border-radius: 5px;
font-size: var(--font-text-size);
line-height: var(--line-height-normal);
}
.d2h-file-side-diff {
display: inline-block;
margin-bottom: -8px;
margin-right: -4px;
overflow-x: scroll;
overflow-y: hidden;
width: 50%;
}
.d2h-code-line {
padding-left: 6em;
padding-right: 1.5em;
}
.d2h-code-line,
.d2h-code-side-line {
display: inline-block;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
white-space: nowrap;
width: 100%;
}
.d2h-code-side-line {
/* needed to be changed */
padding-left: 0.5em;
padding-right: 0.5em;
}
.d2h-code-line-ctn {
word-wrap: normal;
background: none;
display: inline-block;
padding: 0;
-webkit-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
vertical-align: middle;
width: 100%;
/* only works for line-by-line */
white-space: pre-wrap;
}
.d2h-code-line del,
.d2h-code-side-line del {
background-color: var(--git-delete-hl);
color: var(--text-normal);
}
.d2h-code-line del,
.d2h-code-line ins,
.d2h-code-side-line del,
.d2h-code-side-line ins {
border-radius: 0.2em;
display: inline-block;
margin-top: -1px;
text-decoration: none;
vertical-align: middle;
}
.d2h-code-line ins,
.d2h-code-side-line ins {
background-color: var(--git-insert-hl);
text-align: left;
}
.d2h-code-line-prefix {
word-wrap: normal;
background: none;
display: inline;
padding: 0;
white-space: pre;
}
.line-num1 {
float: left;
}
.line-num1,
.line-num2 {
-webkit-box-sizing: border-box;
box-sizing: border-box;
overflow: hidden;
/*
padding: 0 0.5em;
*/
text-overflow: ellipsis;
width: 2.5em;
padding-left: 0;
}
.line-num2 {
float: right;
}
.d2h-code-linenumber {
background-color: var(--background-primary);
border: solid var(--background-modifier-border);
border-width: 0 1px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: var(--text-faint);
cursor: pointer;
display: inline-block;
position: absolute;
text-align: right;
width: 5.5em;
}
.d2h-code-linenumber:after {
content: "\200b";
}
.d2h-code-side-linenumber {
background-color: var(--background-primary);
border: solid var(--background-modifier-border);
border-width: 0 1px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: var(--text-faint);
cursor: pointer;
overflow: hidden;
padding: 0 0.5em;
text-align: right;
text-overflow: ellipsis;
width: 4em;
/* needed to be changed */
display: table-cell;
position: relative;
}
.d2h-code-side-linenumber:after {
content: "\200b";
}
.d2h-code-side-emptyplaceholder,
.d2h-emptyplaceholder {
background-color: var(--background-primary);
border-color: var(--background-modifier-border);
}
.d2h-code-line-prefix,
.d2h-code-linenumber,
.d2h-code-side-linenumber,
.d2h-emptyplaceholder {
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.d2h-code-linenumber,
.d2h-code-side-linenumber {
direction: rtl;
}
.d2h-del {
background-color: var(--git-delete-bg);
border-color: var(--git-delete-hl);
}
.d2h-ins {
background-color: var(--git-insert-bg);
border-color: var(--git-insert-hl);
}
.d2h-info {
background-color: var(--background-primary);
border-color: var(--background-modifier-border);
color: var(--text-faint);
}
.d2h-del,
.d2h-ins,
.d2h-file-diff .d2h-change {
color: var(--text-normal);
}
.d2h-file-diff .d2h-del.d2h-change {
background-color: var(--git-change-bg);
}
.d2h-file-diff .d2h-ins.d2h-change {
background-color: var(--git-insert-bg);
}
.d2h-file-list-wrapper {
a {
text-decoration: none;
cursor: default;
-webkit-user-drag: none;
}
svg {
display: none;
}
}
.d2h-file-list-header {
text-align: left;
}
.d2h-file-list-title {
display: none;
}
.d2h-file-list-line {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
text-align: left;
}
.d2h-file-list {
}
.d2h-file-list > li {
border-bottom: 1px solid var(--background-modifier-border);
margin: 0;
padding: 5px 10px;
}
.d2h-file-list > li:last-child {
border-bottom: none;
}
.d2h-file-switch {
cursor: pointer;
display: none;
font-size: 10px;
}
.d2h-icon {
fill: currentColor;
margin-right: 10px;
vertical-align: middle;
}
.d2h-deleted {
color: var(--git-delete);
}
.d2h-added {
color: var(--git-insert);
}
.d2h-changed {
color: var(--git-change);
}
.d2h-moved {
color: var(--git-move);
}
.d2h-tag {
background-color: var(--background-secondary);
display: -webkit-box;
display: -ms-flexbox;
display: flex;
font-size: 10px;
margin-left: 5px;
padding: 0 2px;
}
.d2h-deleted-tag {
border: 1px solid var(--git-delete);
}
.d2h-added-tag {
border: 1px solid var(--git-insert);
}
.d2h-changed-tag {
border: 1px solid var(--git-change);
}
.d2h-moved-tag {
border: 1px solid var(--git-move);
}
/* needed for line-by-line*/
.d2h-diff-tbody {
position: relative;
}
}
/* ====================== Line Authoring Information ====================== */
.cm-gutterElement.obs-git-blame-gutter {
/* Add background color to spacing inbetween and around the gutter for better aesthetics */
border-width: 0px 2px 0.2px 2px;
border-style: solid;
border-color: var(--background-secondary);
background-color: var(--background-secondary);
}
.cm-gutterElement.obs-git-blame-gutter > div,
.line-author-settings-preview {
/* delegate text color to settings */
color: var(--obs-git-gutter-text);
font-family: monospace;
height: 100%; /* ensure, that age-based background color occupies entire parent */
text-align: right;
padding: 0px 6px 0px 6px;
white-space: pre; /* Keep spaces and do not collapse them. */
}
@media (max-width: 800px) {
/* hide git blame gutter not to superpose text */
.cm-gutterElement.obs-git-blame-gutter {
display: none;
}
}
.git-unified-diff-view,
.git-split-diff-view .cm-deletedLine .cm-changedText {
background-color: #ee443330;
}
.git-unified-diff-view,
.git-split-diff-view .cm-insertedLine .cm-changedText {
background-color: #22bb2230;
}
.git-obscure-prompt[git-is-obscured="true"] #git-show-password:after {
-webkit-mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-eye"><path d="M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"></path><circle cx="12" cy="12" r="3"></circle></svg>');
}
.git-obscure-prompt[git-is-obscured="false"] #git-show-password:after {
-webkit-mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="svg-icon lucide-eye-off"><path d="M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"></path><path d="M14.084 14.158a3 3 0 0 1-4.242-4.242"></path><path d="M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"></path><path d="m2 2 20 20"></path></svg>');
}
/* Override styling of Codemirror merge view "collapsed lines" indicator */
.git-split-diff-view .ͼ2 .cm-collapsedLines {
background: var(--interactive-normal);
border-radius: var(--radius-m);
color: var(--text-accent);
font-size: var(--font-small);
padding: var(--size-4-1) var(--size-4-1);
}
.git-split-diff-view .ͼ2 .cm-collapsedLines:hover {
background: var(--interactive-hover);
color: var(--text-accent-hover);
}
.git-signs-gutter {
.cm-gutterElement {
display: grid;
}
}
.git-gutter-marker:hover {
border-radius: 2px;
}
.git-gutter-marker.git-add {
background-color: var(--color-green);
justify-self: center;
height: inherit;
width: 0.2rem;
}
.git-gutter-marker.git-change {
background-color: var(--color-yellow);
justify-self: center;
height: inherit;
width: 0.2rem;
}
.git-gutter-marker.git-changedelete {
color: var(--color-yellow);
font-weight: var(--font-bold);
font-size: 1rem;
justify-self: center;
height: inherit;
}
.git-gutter-marker.git-delete {
background-color: var(--color-red);
height: 0.2rem;
width: 0.8rem;
align-self: end;
}
.git-gutter-marker.git-topdelete {
background-color: var(--color-red);
height: 0.2rem;
width: 0.8rem;
align-self: start;
}
div:hover > .git-gutter-marker.git-change {
width: 0.6rem;
}
div:hover > .git-gutter-marker.git-add {
width: 0.6rem;
}
div:hover > .git-gutter-marker.git-delete {
height: 0.6rem;
}
div:hover > .git-gutter-marker.git-topdelete {
height: 0.6rem;
}
div:hover > .git-gutter-marker.git-changedelete {
font-weight: var(--font-bold);
}
.git-gutter-marker.staged {
opacity: 0.5;
}
.git-diff {
.cm-merge-revert {
width: 4em;
}
/* Ensure that merge revert markers are positioned correctly */
.cm-merge-revert > * {
position: absolute;
background-color: var(--background-secondary);
display: flex;
}
}
/* Prevent shifting of the editor when git signs gutter is the only gutter present */
.cm-gutters.cm-gutters-before:has(> .git-signs-gutter:only-child) {
margin-inline-end: 0;
.git-signs-gutter {
margin-inline-start: -1rem;
}
}
.git-changes-status-bar-colored {
.git-add {
color: var(--color-green);
}
.git-change {
color: var(--color-yellow);
}
.git-delete {
color: var(--color-red);
}
}
.git-changes-status-bar .git-add {
margin-right: 0.3em;
}
.git-changes-status-bar .git-change {
margin-right: 0.3em;
}

View File

@@ -0,0 +1,5 @@
{
"appliedMigrations": [
"tokens-to-secretstorage-v1"
]
}

View File

@@ -0,0 +1,24 @@
{
"pluginList": [
"YishenTu/claudian"
],
"pluginSubListFrozenVersion": [
{
"repo": "YishenTu/claudian",
"version": ""
}
],
"themesList": [],
"updateAtStartup": true,
"updateThemesAtStartup": true,
"enableAfterInstall": true,
"loggingEnabled": false,
"loggingPath": "BRAT-log",
"loggingVerboseEnabled": false,
"debuggingMode": false,
"notificationsEnabled": true,
"globalTokenName": "",
"personalAccessToken": "",
"selectLatestPluginVersionByDefault": false,
"allowIncompatiblePlugins": false
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,14 @@
{
"id": "obsidian42-brat",
"name": "BRAT",
"version": "2.0.4",
"minAppVersion": "1.11.4",
"description": "Easily install a beta version of a plugin for testing.",
"author": "TfTHacker",
"authorUrl": "https://github.com/TfTHacker/obsidian42-brat",
"helpUrl": "https://tfthacker.com/BRAT",
"isDesktopOnly": false,
"fundingUrl": {
"Visit my site": "https://tfthacker.com"
}
}

View File

@@ -0,0 +1,152 @@
.brat-modal .modal-button-container {
margin-top: 5px;
}
.brat-modal .disabled-setting {
opacity: 0.5;
}
.brat-modal .disabled-setting:hover {
cursor: not-allowed;
}
/* Input validation styles */
.brat-settings .valid-input,
.brat-modal .valid-repository {
border-color: var(--color-green);
}
.brat-settings .invalid-input,
.brat-modal .invalid-repository {
border-color: var(--color-red);
}
.brat-settings .validation-error,
.brat-modal .validation-error {
border-color: var(--color-orange);
}
/* Version selector */
.brat-version-selector {
width: 100%;
max-width: 400px;
justify-content: left;
}
.brat-token-input {
min-width: 33%;
}
/* Token info container styles */
.brat-token-info {
margin-top: 8px;
font-size: 0.8em;
padding: 8px;
border-radius: 4px;
background-color: var(--background-secondary);
}
/* Token status indicators */
.brat-token-info.valid,
.brat-token-status.valid {
color: var(--color-green);
}
.brat-token-info.invalid,
.brat-token-status.invalid {
color: var(--color-red);
}
.brat-token-info.valid {
border-left: 3px solid var(--color-green);
}
.brat-token-info.invalid {
border-left: 3px solid var(--color-red);
}
/* Token details and status */
.brat-token-status {
margin-bottom: 4px;
}
.brat-token-details {
margin-top: 4px;
color: var(--text-muted);
}
/* Token warnings */
.brat-token-warning {
color: var(--color-orange);
margin-top: 4px;
}
/* Token additional info */
.brat-token-scopes,
.brat-token-rate {
color: var(--text-muted);
margin-top: 2px;
}
/* Flex break utility */
.brat-modal .break {
flex-basis: 100%;
height: 0;
}
/* Validation status */
.brat-modal .validation-status-error {
color: var(--text-error);
}
.brat-modal .validation-status {
margin-top: 0.5em;
margin-bottom: 0.5em;
font-size: 0.8em;
text-align: left;
}
.confirm-modal .ok-button {
margin-right: 10px;
margin-top: 20px;
}
/* Hide filtered plugin items */
.brat-plugin-item[hidden] {
display: none !important;
}
/* Hide filtered theme items */
.brat-theme-item[hidden] {
display: none !important;
}
/* Filter and button layout */
.brat-filter-and-button {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
margin: 0.75em 0;
}
.brat-filter-input {
max-width: 300px;
padding: 4px 8px;
border: 1px solid var(--background-modifier-border);
border-radius: 4px;
background-color: var(--background-secondary);
color: var(--text-normal);
}
.brat-filter-input:focus {
outline: none;
border-color: var(--interactive-accent);
}
.brat-filter-and-button .setting-item {
border: none;
padding: 0;
}
.brat-filter-and-button .setting-item-control {
justify-content: flex-end;
}

232
.obsidian/workspace.json vendored Normal file
View File

@@ -0,0 +1,232 @@
{
"main": {
"id": "973da3c06db7597b",
"type": "split",
"children": [
{
"id": "3c776ec28c643ba8",
"type": "tabs",
"children": [
{
"id": "17e2dfcbe52383c9",
"type": "leaf",
"state": {
"type": "empty",
"state": {},
"icon": "lucide-file",
"title": "新标签页"
}
}
]
}
],
"direction": "vertical"
},
"left": {
"id": "24dec7ef5074eea3",
"type": "split",
"children": [
{
"id": "2b29963d2e7acd36",
"type": "tabs",
"children": [
{
"id": "a87175456da52de6",
"type": "leaf",
"state": {
"type": "file-explorer",
"state": {
"sortOrder": "alphabetical",
"autoReveal": true
},
"icon": "lucide-folder-closed",
"title": "文件列表"
}
},
{
"id": "9cdfd659fa29c993",
"type": "leaf",
"state": {
"type": "search",
"state": {
"query": "",
"matchingCase": false,
"explainSearch": false,
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical"
},
"icon": "lucide-search",
"title": "搜索"
}
},
{
"id": "a717af3e81b9f74b",
"type": "leaf",
"state": {
"type": "bookmarks",
"state": {},
"icon": "lucide-bookmark",
"title": "书签"
}
}
]
}
],
"direction": "horizontal",
"width": 300
},
"right": {
"id": "28cec8f4bee65c7f",
"type": "split",
"children": [
{
"id": "ed489fdd55005e33",
"type": "tabs",
"children": [
{
"id": "a68f4123e4efcd65",
"type": "leaf",
"state": {
"type": "backlink",
"state": {
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
"showSearch": false,
"searchQuery": "",
"backlinkCollapsed": false,
"unlinkedCollapsed": true
},
"icon": "links-coming-in",
"title": "反向链接"
}
},
{
"id": "15c434f8db779d05",
"type": "leaf",
"state": {
"type": "outgoing-link",
"state": {
"linksCollapsed": false,
"unlinkedCollapsed": true
},
"icon": "links-going-out",
"title": "出链"
}
},
{
"id": "d53c53617e93d97c",
"type": "leaf",
"state": {
"type": "tag",
"state": {
"sortOrder": "frequency",
"useHierarchy": true,
"showSearch": false,
"searchQuery": ""
},
"icon": "lucide-tags",
"title": "标签"
}
},
{
"id": "e58d2a2052906d80",
"type": "leaf",
"state": {
"type": "all-properties",
"state": {
"sortOrder": "frequency",
"showSearch": false,
"searchQuery": ""
},
"icon": "lucide-archive",
"title": "添加笔记属性"
}
},
{
"id": "eeb7dbc29f5878bf",
"type": "leaf",
"state": {
"type": "outline",
"state": {
"followCursor": false,
"showSearch": false,
"searchQuery": ""
},
"icon": "lucide-list",
"title": "大纲"
}
},
{
"id": "d10921295c266fca",
"type": "leaf",
"state": {
"type": "claudian-view",
"state": {},
"icon": "bot",
"title": "Claudian"
}
}
],
"currentTab": 5
}
],
"direction": "horizontal",
"width": 664.5
},
"left-ribbon": {
"hiddenItems": {
"switcher:打开快速切换": false,
"graph:查看关系图谱": false,
"canvas:新建白板": false,
"daily-notes:打开/创建今天的日记": false,
"templates:插入模板": false,
"command-palette:打开命令面板": false,
"bases:新建数据库": false,
"obsidian42-brat:BRAT": false,
"obsidian-git:Open Git source control": false,
"claudian:Open Claudian": false
}
},
"active": "d10921295c266fca",
"lastOpenFiles": [
"README.md",
"开发者文档/部署指南.md",
"开发者文档/开发指南.md",
"开发者文档/贡献指南.md",
"开发者文档/系统架构.md",
"开发者文档/README.md",
"用户文档/08-常见问题",
"用户文档/图片",
"用户文档/07-移动应用",
"用户文档/06-Web管理后台",
"用户文档/04-数据查看",
"用户文档/02-账户管理",
"用户文档/03-设备管理",
"用户文档/05-告警通知",
"用户文档/01-快速入门",
"用户文档",
"01-快速开始/01-getting-started/01-project-overview.md",
"01-快速开始/01-project-overview.md",
"开发指南.md",
"贡献指南.md",
"部署指南.md",
"系统架构.md",
"docs/README.md",
"文档/01-快速开始/01-getting-started/01-project-overview.md",
"文档/部署指南.md",
"文档/开发指南.md",
"文档/贡献指南.md",
"文档/系统架构.md",
"文档/README.md",
"docs/DEVELOPMENT.md",
"docs/DEPLOYMENT.md",
"docs/CONTRIBUTING.md",
"docs/ARCHITECTURE.md",
"docs/01-getting-started/01-project-overview.md",
"2026-01-19.md",
"欢迎.md",
"未命名.canvas"
]
}

View File

@@ -0,0 +1,114 @@
# 项目概述
欢迎来到 AIOT人工智能物联网项目本文档介绍项目的背景、目标和范围。
## 🎯 项目目标
AIOT 项目的核心目标是:
1. **实时设备管理** — 连接和管理各类物联网设备
2. **数据驱动洞察** — 收集和分析设备数据
3. **智能决策支持** — 使用 AI 模型提供智能建议
4. **用户友好体验** — 提供直观的 Web 和移动界面
5. **高可用和可扩展** — 支持大规模设备接入
## 📊 项目范围
### 核心功能
| 功能 | 说明 | 优先级 |
|-----|------|--------|
| 设备接入 | 支持多种协议的设备连接 | 高 |
| 数据采集 | 实时采集设备数据 | 高 |
| 数据分析 | 数据统计和可视化 | 高 |
| 告警系统 | 异常告警和通知 | 中 |
| 远程控制 | 远程操作设备 | 中 |
| AI 预测 | 基于 ML 的预测 | 中 |
| 用户管理 | 组织和权限管理 | 高 |
| 移动应用 | iOS/Android 原生应用 | 中 |
### 支持的设备类型
- 温湿度传感器
- 门窗磁传感器
- 运动传感器
- 智能灯
- 智能插座
- 摄像头
- 能源监测设备
- 自定义设备(通过 API
## 👥 目标用户
1. **企业管理员** — 管理组织内的设备和用户
2. **运维工程师** — 监控系统健康和性能
3. **数据分析师** — 分析数据和生成报告
4. **普通用户** — 通过移动端控制设备
5. **开发者** — 集成自定义设备和应用
## 🏗️ 技术栈概览
### 后端
- **运行时** — Node.js / Python
- **框架** — Express / FastAPI
- **数据库** — PostgreSQL + Redis
- **消息队列** — RabbitMQ / Kafka
- **实时通信** — WebSocket / Socket.io
### 前端
- **框架** — React 18+
- **状态管理** — Redux / Context API
- **UI 库** — Material-UI / Ant Design
- **构建工具** — Webpack / Vite
### 移动端
- **框架** — React Native / Flutter
- **原生功能** — 地理定位、推送通知等
- **离线支持** — SQLite + Redux Persist
### 基础设施
- **容器化** — Docker
- **编排** — Kubernetes
- **CI/CD** — GitHub Actions / GitLab CI
- **监控** — Prometheus + Grafana
- **日志** — ELK Stack
## 📈 项目里程碑
| 阶段 | 时间 | 目标 |
|-----|------|------|
| MVP | Q1 2024 | 核心功能实现 |
| Beta | Q2 2024 | 用户测试和反馈 |
| GA | Q3 2024 | 正式发布 |
| 迭代 | Q4 2024+ | 功能完善和优化 |
## 📚 相关文档
- **[技术栈详解](02-tech-stack.md)** — 每个技术的选择原因
- **[环境配置](03-environment-setup.md)** — 本地开发环境设置
- **[快速开始](04-quick-start.md)** — 5 分钟快速上手
- **[系统架构](../02-architecture/01-system-architecture.md)** — 整体架构设计
- **[ARCHITECTURE.md](../ARCHITECTURE.md)** — 详细架构文档
## 🔗 相关链接
- GitHub 仓库:`[待填充]`
- 项目管理:`[待填充]`
- 问题追踪:`[待填充]`
- 文档网站:`[待填充]`
- API 文档:`[待填充]`
## ❓ 常见问题
**Q: 这个项目适合我吗?**
A: 如果你对物联网、全栈开发或 AI 应用感兴趣,是的!无论你的背景如何,我们都欢迎。
**Q: 需要什么前置知识?**
A: 基本的编程知识即可。具体技术可以在参与过程中学习。
**Q: 怎么开始贡献?**
A: 请阅读 [CONTRIBUTING.md](../CONTRIBUTING.md) 和本指南的后续部分。
---
准备好开始了吗?前往 **[快速开始](04-quick-start.md)** 或选择你感兴趣的领域开始学习!

121
开发者文档/README.md Normal file
View File

@@ -0,0 +1,121 @@
# AIOT 项目文档
欢迎来到 AIOT 项目的完整文档中心!本文档涵盖了整个项目的架构、开发、部署和运维指南。
## 📋 项目概述
AIOT人工智能物联网是一个全栈项目包含
- **后端服务** — 核心业务逻辑和 API
- **Web 前端** — 管理后台和数据展示
- **移动应用** — iOS/Android 原生应用
- **设备接入** — 物联网设备管理和通信
## 🚀 快速开始
新开发者请从这里开始:
1. **[项目概述](01-getting-started/01-project-overview.md)** — 了解项目目标和范围
2. **[技术栈](01-getting-started/02-tech-stack.md)** — 查看使用的技术
3. **[环境配置](01-getting-started/03-environment-setup.md)** — 配置本地开发环境
4. **[快速开始](01-getting-started/04-quick-start.md)** — 5分钟快速上手
## 📚 文档导航
### 🏗️ 架构和设计
- **[系统架构](02-architecture/01-system-architecture.md)** — 整体系统设计
- **[数据流设计](02-architecture/02-data-flow.md)** — 数据如何流动
- **[API 设计](02-architecture/04-api-design.md)** — REST 和 WebSocket API 规范
- **[数据库设计](02-architecture/05-database-schema.md)** — 数据模型
### 🔧 后端开发
- **[后端环境配置](03-backend/01-setup.md)**
- **[项目结构](03-backend/02-project-structure.md)**
- **[API 文档](07-api-docs/openapi.yaml)**
- **[认证和授权](03-backend/05-authentication.md)**
- **[测试指南](03-backend/09-testing.md)**
- **[部署流程](03-backend/10-deployment.md)**
### 🎨 前端开发
- **[前端环境配置](04-frontend/01-setup.md)**
- **[项目结构](04-frontend/02-project-structure.md)**
- **[组件库使用](04-frontend/03-components-guide.md)**
- **[状态管理](04-frontend/04-state-management.md)**
- **[性能优化](04-frontend/08-performance.md)**
- **[UI 设计规范](04-frontend/12-ui-guidelines.md)**
### 📱 移动端开发
- **[移动端环境配置](05-mobile/01-setup.md)**
- **[应用架构](05-mobile/03-app-architecture.md)**
- **[屏幕导航](05-mobile/04-screen-guide.md)**
- **[API 集成](05-mobile/06-api-integration.md)**
- **[原生功能](05-mobile/07-native-features.md)**
- **[App 发布](05-mobile/12-build-deploy.md)**
### 🔌 设备和物联网
- **[设备类型](06-device/01-device-types.md)**
- **[连接配置](06-device/02-connection-setup.md)**
- **[固件更新](06-device/03-firmware-update.md)**
- **[数据传输协议](06-device/04-data-transmission.md)**
### 🛠️ DevOps 和运维
- **[CI/CD 流程](09-devops/01-ci-cd.md)**
- **[Docker 配置](09-devops/02-docker-setup.md)**
- **[监控告警](09-devops/04-monitoring.md)**
- **[灾难恢复](09-devops/07-disaster-recovery.md)**
### 📖 规范和指南
- **[代码风格指南](10-standards/01-code-style.md)**
- **[Git 工作流](10-standards/03-git-workflow.md)**
- **[编码规范](10-standards/02-naming-conventions.md)**
- **[常见任务](11-guides/01-common-tasks.md)**
- **[调试指南](11-guides/02-debugging.md)**
### ❓ FAQ 和支持
- **[常见问题](13-faq/general.md)**
- **[词汇表](14-glossary/terms.md)**
## 📖 核心文档
- **[ARCHITECTURE.md](ARCHITECTURE.md)** — 系统架构详细说明
- **[CONTRIBUTING.md](CONTRIBUTING.md)** — 贡献指南
- **[DEVELOPMENT.md](DEVELOPMENT.md)** — 开发工作流
- **[DEPLOYMENT.md](DEPLOYMENT.md)** — 部署和上线
## 🔍 快速查找
按角色查找你需要的文档:
| 角色 | 推荐阅读 |
|-----|---------|
| 新团队成员 | 快速开始 → 项目概述 → 你的端环境配置 |
| 后端开发 | 后端设置 → API 文档 → 认证指南 |
| 前端开发 | 前端设置 → 组件库 → UI 规范 |
| 移动开发 | 移动设置 → 应用架构 → 发布流程 |
| 设备工程 | 设备类型 → 连接配置 → 数据传输 |
| DevOps | CI/CD → Docker → 监控 → 灾难恢复 |
| 项目经理 | 项目概述 → 系统架构 → 技术栈 |
## 🔗 相关链接
- GitHub 仓库:`待填充`
- Issue 追踪:`待填充`
- CI/CD Dashboard`待填充`
- API 文档(实时):`待填充`
## 📝 最后更新
- 最后更新时间:{{ now }}
- 文档版本1.0.0
- 项目版本:见 `VERSION` 文件
## ❓ 有问题?
- 查看 [FAQ](13-faq/general.md)
- 提交 Issue 或 Pull Request
- 联系项目维护者
---
**贡献者请阅读:** [CONTRIBUTING.md](CONTRIBUTING.md)
**代码审查流程:** [代码审查指南](10-standards/05-code-review.md)

View File

@@ -0,0 +1,319 @@
# 开发工作流
本文档描述了 AIOT 项目的日常开发工作流和最佳实践。
## 🔄 日常工作流
### 1. 同步最新代码
```bash
# 更新 main 分支
git fetch origin
git checkout main
git pull origin main
# 创建功能分支
git checkout -b feature/your-feature
```
### 2. 本地开发
```bash
# 后端
cd backend
npm install # 或 pip install
npm run dev
# 前端
cd frontend
npm install
npm run dev
# 移动端
cd mobile
npm install
npm start
```
### 3. 测试
```bash
# 后端测试
cd backend
npm run test
npm run test:coverage
# 前端测试
cd frontend
npm run test
npm run test:e2e
# 移动测试
cd mobile
npm run test
npm run test:e2e
```
### 4. 提交代码
```bash
# 检查代码风格
npm run lint
npm run lint:fix
# 提交
git add .
git commit -m "feat(scope): description"
```
### 5. 推送和创建 PR
```bash
# 推送到远程
git push origin feature/your-feature
# 在 GitHub 创建 PR
# 1. 访问 GitHub
# 2. 点击 "New Pull Request"
# 3. 选择 base: main, compare: feature/your-feature
# 4. 填写 PR 标题和描述
```
## 📦 环境设置
### 前置条件
| 工具 | 版本 | 说明 |
|-----|------|------|
| Node.js | 18+ | JavaScript 运行时 |
| Python | 3.9+ | 后端(如果使用) |
| Docker | 24+ | 容器化 |
| PostgreSQL | 14+ | 数据库 |
| Redis | 7+ | 缓存 |
### 快速设置
详见各端的设置指南:
- [后端设置](03-backend/01-setup.md)
- [前端设置](04-frontend/01-setup.md)
- [移动设置](05-mobile/01-setup.md)
## 🐛 调试
### 后端调试
```bash
# 启用调试模式
DEBUG=* npm run dev
# 使用 debugger
node --inspect backend/server.js
# 访问 chrome://inspect
```
### 前端调试
```bash
# React DevTools 浏览器扩展
# Redux DevTools 扩展
# 控制台日志
console.log()
console.table()
```
### 移动调试
```bash
# React Native Debugger
npm install -g react-native-debugger
# Xcode DebuggeriOS
# Android Studio DebuggerAndroid
```
详见:[调试指南](11-guides/02-debugging.md)
## 🧪 测试工作流
### 单元测试
```bash
# 运行所有测试
npm run test
# 监视模式
npm run test:watch
# 覆盖率报告
npm run test:coverage
```
### 集成测试
```bash
# 启动测试服务
npm run test:integration
```
### 端到端测试
```bash
# 启动应用
npm run dev
# 运行 E2E 测试
npm run test:e2e
```
## 📝 编码规范
### 前端
- [代码风格](10-standards/01-code-style.md#前端)
- [命名规范](10-standards/02-naming-conventions.md#前端)
- 使用 ESLint + Prettier
### 后端
- [代码风格](10-standards/01-code-style.md#后端)
- [命名规范](10-standards/02-naming-conventions.md#后端)
- 使用 LinterESLint/Pylint
### 移动端
- [代码风格](10-standards/01-code-style.md#移动端)
- [命名规范](10-standards/02-naming-conventions.md#移动端)
### 自动修复
```bash
# 格式化代码
npm run lint:fix
# 自动修复所有端
npm run lint:fix:all
```
## 🔀 Git 工作流
### 分支命名规范
```
feature/描述 # 新功能
fix/issue-number # 错误修复
refactor/描述 # 代码重构
docs/描述 # 文档改进
perf/描述 # 性能优化
test/描述 # 测试相关
```
### 提交信息规范
```
<type>(<scope>): <subject>
<body>
<footer>
```
详见:[Commit 信息规范](10-standards/04-commit-messages.md)
### 处理冲突
```bash
# 更新分支
git fetch origin
git rebase origin/main
# 解决冲突
# 编辑冲突文件
# 标记为已解决
git add .
git rebase --continue
# 推送
git push origin feature/your-feature -f
```
## 📊 性能检查
### 页面加载性能
```bash
# 前端性能分析
npm run analyze
# Lighthouse 检查
npm run lighthouse
```
### API 性能
```bash
# 后端性能测试
npm run test:performance
# 数据库查询分析
EXPLAIN ANALYZE SELECT ...;
```
### 内存使用
```bash
# 监控内存
node --max-old-space-size=4096 server.js
# 堆快照
node --inspect server.js
# 访问 chrome://inspect
```
详见:[性能优化](11-guides/03-performance-tuning.md)
## 🔒 安全检查
### 依赖安全
```bash
# 检查已知漏洞
npm audit
npm audit fix
# 定期更新
npm update
```
### 代码安全
```bash
# 安全扫描(如果配置)
npm run security:scan
```
详见:[安全检查清单](11-guides/04-security-checklist.md)
## 📚 常用命令
| 命令 | 说明 |
|-----|------|
| `npm run dev` | 启动开发服务器 |
| `npm run build` | 构建生产版本 |
| `npm run test` | 运行测试 |
| `npm run lint` | 代码检查 |
| `npm run lint:fix` | 自动修复 |
| `npm run type-check` | TypeScript 检查 |
| `npm run format` | 代码格式化 |
## 🆘 常见问题
详见:[常见任务指南](11-guides/01-common-tasks.md)
## 📖 相关文档
- [CONTRIBUTING.md](CONTRIBUTING.md) — 贡献指南
- [Git 工作流](10-standards/03-git-workflow.md)
- [编码规范](10-standards/01-code-style.md)
- [测试指南](03-backend/09-testing.md)
---
**新手提示:** 如果你是第一次贡献,请先阅读 [CONTRIBUTING.md](CONTRIBUTING.md) 和 [快速开始](01-getting-started/04-quick-start.md)。

View File

@@ -0,0 +1,190 @@
# AIOT 系统架构
本文档描述 AIOT 项目的整体系统架构、组件设计和数据流。
## 🏗️ 高层架构
```
┌─────────────────────────────────────────────────────────────┐
│ 用户端 │
├──────────────┬──────────────────────┬──────────────────────┤
│ Web 前端 │ 移动应用App │ 设备硬件/固件 │
│ (React) │ (React Native) │ (IoT Devices) │
└──────┬───────┴──────────┬───────────┴──────────┬────────────┘
│ │ │
│ HTTPS/WSS │ HTTP/MQTT │
│ │ │
┌──────▼──────────────────▼──────────────────────▼────────────┐
│ API 网关 / 负载均衡 │
└──────┬──────────────────────────────────────────────────────┘
┌──────▼──────────────────────────────────────────────────────┐
│ 后端服务Microservices
├──────────────┬──────────────────┬──────────────────────────┤
│ 身份验证 │ 用户管理 │ 设备管理 │
│ (Auth) │ (User Service) │ (Device Service) │
├──────────────┼──────────────────┼──────────────────────────┤
│ 数据处理 │ 实时通信 │ 任务调度 │
│ (Analytics) │ (WebSocket) │ (Job Queue) │
├──────────────┼──────────────────┼──────────────────────────┤
│ AI 模型 │ 文件存储 │ 日志系统 │
│ (ML Models) │ (File Storage) │ (Logging) │
└──────┬───────┴────────┬─────────┴──────────────┬───────────┘
│ │ │
┌──────▼────────────────▼────────────────────────▼───────────┐
│ 数据层 │
├──────────────┬──────────────────┬──────────────────────────┤
│ PostgreSQL │ Redis Cache │ Time Series DB │
│ (主数据) │ (会话/缓存) │ (时间序列数据) │
├──────────────┼──────────────────┼──────────────────────────┤
│ S3/OSS │ Message Queue │ Search Engine │
│ (文件存储) │ (异步消息) │ (Elasticsearch) │
└──────────────┴──────────────────┴──────────────────────────┘
│ │ │
┌──────▼────────────────▼────────────────────────▼───────────┐
│ 基础设施 │
├──────────────┬──────────────────┬──────────────────────────┤
│ Kubernetes │ 监控/告警 │ CI/CD Pipeline │
│ (容器编排) │ (Prometheus) │ (GitHub Actions) │
└──────────────┴──────────────────┴──────────────────────────┘
```
## 📦 组件概览
### 前端层
- **Web 前端 (React)**
- 基于 React + Next.js
- 状态管理Redux / Context API
- UI 框架Material-UI 或 Ant Design
- 实时通信WebSocket
- **移动应用 (React Native)**
- 跨平台iOS 和 Android
- 状态管理Redux 或 Zustand
- 原生功能集成:地理定位、推送通知等
- 离线支持SQLite + Redux Persist
### API 层
- **HTTP REST API**
- 基于 Node.js/Express 或 Python/FastAPI
- RESTful 设计规范
- 速率限制和认证
- **WebSocket实时通信**
- 实时数据推送
- 设备状态更新
- 用户通知
- **MQTT设备通信**
- 轻量级物联网协议
- 发布-订阅模式
- QoS 支持
### 业务逻辑层
- **认证服务**
- JWT Token 管理
- OAuth2 集成(可选)
- 权限控制
- **设备管理服务**
- 设备注册和发现
- 固件更新管理
- 设备状态监控
- **数据处理服务**
- 数据聚合和清理
- 分析和统计
- AI 模型推理
- **任务调度服务**
- 定时任务执行
- 异步任务处理
- 重试机制
### 数据层
- **关系型数据库**
- PostgreSQL用户、设备、配置等
- 数据一致性保证
- ACID 事务支持
- **缓存层**
- Redis会话、缓存
- 性能优化
- 实时计数器
- **时间序列数据库**
- InfluxDB 或 TimescaleDB
- 设备数据存储
- 高效查询
- **消息队列**
- RabbitMQ 或 Kafka
- 异步处理
- 解耦服务
### 基础设施
- **容器编排**
- Kubernetes
- Docker 镜像
- 自动扩展
- **监控和告警**
- Prometheus + Grafana
- 日志管理ELK Stack
- 性能追踪Jaeger
- **CI/CD**
- GitHub Actions / GitLab CI
- 自动化测试
- 自动部署
## 🔄 数据流
详见:[数据流设计](02-architecture/02-data-flow.md)
## 🔐 安全架构
详见:[安全架构](02-architecture/06-security-design.md)
## 📈 扩展性设计
详见:[可扩展性规划](02-architecture/07-scalability-plan.md)
## 🔌 通信协议
### HTTP/REST
- 客户端 ↔ 服务器通信
- 标准 HTTP 方法GET, POST, PUT, DELETE
- JSON 请求/响应
### WebSocket
- 实时双向通信
- 服务器主动推送
- 心跳机制保活
### MQTT
- 设备 ↔ 服务器通信
- 发布-订阅模式
- 三个 QoS 等级
## 🎯 关键设计原则
1. **微服务架构** — 服务独立部署和扩展
2. **异步处理** — 耗时操作异步化
3. **缓存优先** — 减少数据库查询
4. **实时驱动** — WebSocket/消息队列驱动
5. **可观测性** — 完整的日志、监控和追踪
## 📋 版本历史
| 版本 | 日期 | 变更 |
|-----|------|------|
| 1.0 | 2024-01-01 | 初始架构设计 |
---
详细的各部分架构说明请查看:
- [系统架构](02-architecture/01-system-architecture.md)
- [数据流设计](02-architecture/02-data-flow.md)
- [设备协议](02-architecture/03-device-protocol.md)
- [API 设计](02-architecture/04-api-design.md)

View File

@@ -0,0 +1,235 @@
# 贡献指南
感谢您对 AIOT 项目的兴趣!本指南将帮助您有效地为项目做出贡献。
## 🚀 开始贡献
### 第一步:设置开发环境
```bash
# 克隆仓库
git clone https://github.com/your-org/aiot.git
cd aiot
# 按照你的端的指南配置环境
# 后端docs/03-backend/01-setup.md
# 前端docs/04-frontend/01-setup.md
# 移动docs/05-mobile/01-setup.md
```
### 第二步:阅读编码规范
- [代码风格指南](10-standards/01-code-style.md)
- [命名规范](10-standards/02-naming-conventions.md)
- [Git 工作流](10-standards/03-git-workflow.md)
- [Commit 信息规范](10-standards/04-commit-messages.md)
### 第三步:创建 Feature 分支
```bash
git checkout -b feature/your-feature-name
```
### 第四步:编写代码和测试
- 遵循编码规范
- 添加单元测试
- 确保测试通过
### 第五步:提交 Pull Request
详见:[代码审查流程](10-standards/05-code-review.md)
## 📋 贡献类型
### 🐛 Bug 修复
1. 创建 Issue 描述 Bug
2. Fork 仓库
3. 创建修复分支:`git checkout -b fix/issue-number`
4. 提交 PR引用 Issue
### ✨ 新功能
1. 讨论功能设计(创建 Discussion 或 Issue
2. Fork 仓库
3. 创建功能分支:`git checkout -b feature/feature-name`
4. 提交 PR 描述功能和测试
### 📖 文档改进
1. 编辑相关 Markdown 文件
2. 提交 PR
3. 使用 Preview 功能检查格式
### 🎨 UI/UX 改进
1. 在 Issue 中提出建议(包括设计稿)
2. 讨论和反馈
3. 实现并提交 PR
## 📝 Commit 信息规范
遵循 [Conventional Commits](https://www.conventionalcommits.org/) 规范:
```
<type>(<scope>): <subject>
<body>
<footer>
```
### 类型type
- `feat` — 新功能
- `fix` — 错误修复
- `docs` — 文档改进
- `style` — 代码风格(不影响功能)
- `refactor` — 代码重构
- `perf` — 性能优化
- `test` — 测试相关
- `chore` — 构建、依赖等
### 范围scope
- `backend` — 后端
- `frontend` — 前端
- `mobile` — 移动端
- `device` — 设备相关
- `docs` — 文档
- `infra` — 基础设施
### 例子
```
feat(backend): add device real-time status updates via WebSocket
- Implement WebSocket server for real-time device status
- Add subscription management for device changes
- Add reconnection logic with exponential backoff
Fixes #123
```
## ✅ Pull Request 检查清单
在提交 PR 前,请确保:
- [ ] 代码遵循项目编码规范
- [ ] 添加了必要的测试
- [ ] 所有测试通过
- [ ] 更新了相关文档
- [ ] Commit 信息清晰明了
- [ ] 没有 merge 冲突
- [ ] 代码审查无重大问题
## 🔍 代码审查
### 审查标准
- 代码质量和可维护性
- 测试覆盖率
- 性能影响
- 安全考虑
- API 设计一致性
### 审查流程
1. 至少一位维护者审查
2. 全部对话解决
3. 至少一个 Approve
4. CI/CD 通过
5. 合并到主分支
详见:[代码审查指南](10-standards/05-code-review.md)
## 🧪 测试要求
### 单元测试
- 所有新功能必须有单元测试
- 目标覆盖率80%+
- 测试应该是独立的和快速的
### 集成测试
- 跨服务交互必须有集成测试
- 数据库操作需要测试
### 端到端测试E2E
- 关键用户流程必须有 E2E 测试
- 使用 Selenium/Cypress前端或 Appium移动
### 性能测试
- 关键路径的性能基准
- 监控性能回归
详见各端的测试指南:
- [后端测试](03-backend/09-testing.md)
- [前端测试](04-frontend/10-testing.md)
- [移动测试](05-mobile/11-testing.md)
## 📚 文档要求
### 代码注释
- 复杂逻辑需要注释
- 函数应该有 JSDoc/docstring
- 解释 *为什么*,不是 *什么*
### API 文档
- 新端点需要 OpenAPI/Swagger 文档
- 包括请求/响应示例
### README
- 新功能应该在 README 中提及
- 更新相关文档
### 更新日志
- 在 CHANGELOG.md 中记录重要变更
- 按版本组织
## 🚨 安全考虑
提交包含以下内容的 PR 时,请特别小心:
- [ ] 用户输入验证
- [ ] SQL 注入防护
- [ ] 跨站脚本XSS防护
- [ ] 跨站请求伪造CSRF防护
- [ ] 认证和授权检查
- [ ] 敏感数据加密
详见:[安全检查清单](11-guides/04-security-checklist.md)
## 💬 沟通和讨论
### GitHub Discussions
- 功能建议
- 架构讨论
- 最佳实践分享
### Issues
- Bug 报告
- 功能请求
- 任务跟踪
### 其他沟通
- 项目 Slack 频道
- 定期团队会议
## 🏆 贡献者荣誉
我们感谢所有贡献者!在以下地方获得认可:
- CONTRIBUTORS.md 文件
- GitHub Contributors 页面
- 项目网站
## ❓ 有问题?
- 查看 [FAQ](../13-faq/general.md)
- 提交 GitHub Issue
- 联系项目维护者
- 加入项目社区
## 📖 更多资源
- [开发指南](DEVELOPMENT.md)
- [Git 工作流详解](10-standards/03-git-workflow.md)
- [架构文档](ARCHITECTURE.md)
- [各端开发指南](01-getting-started/)
---
**感谢您的贡献!** 🎉
我们期待看到您的代码、想法和改进!

View File

@@ -0,0 +1,296 @@
# 部署和运维指南
本文档描述如何部署 AIOT 项目到各个环境,以及日常的运维操作。
## 🚀 部署流程
### 部署环境
| 环境 | 用途 | 稳定性 | 更新频率 |
|-----|------|--------|---------|
| 开发 (Dev) | 开发和测试 | 低 | 频繁 |
| 测试 (Test) | QA 测试 | 中 | 中等 |
| 预生产 (Staging) | 上线前验证 | 高 | 每周 |
| 生产 (Prod) | 用户使用 | 最高 | 计划性 |
### 部署流程图
```
开发分支 → 创建 PR → 代码审查 → 合并到 main → 自动部署到 Test
手动验证
部署到 Staging → 测试
上线审批
部署到 Production
```
## 🔧 各环节部署指南
### 后端部署
详见:[后端部署](03-backend/10-deployment.md)
```bash
# 构建
npm run build
# 测试
npm run test
# 部署到 Test
npm run deploy:test
# 部署到 Staging
npm run deploy:staging
# 部署到 Prod
npm run deploy:prod
```
### 前端部署
详见:[前端构建和部署](04-frontend/11-build-deploy.md)
```bash
# 构建
npm run build
# 部署到 Test
npm run deploy:test
# 部署到 Prod
npm run deploy:prod
```
### 移动端发布
详见:[移动端构建和发布](05-mobile/12-build-deploy.md)
```bash
# 构建 iOS
npm run build:ios
# 构建 Android
npm run build:android
# 发布到应用商店
npm run deploy:appstore
npm run deploy:playstore
```
## 🐳 Docker 和 Kubernetes
### Docker 部署
详见:[Docker 配置](09-devops/02-docker-setup.md)
```bash
# 构建 Docker 镜像
docker build -t aiot-backend:latest .
# 运行容器
docker run -d -p 3000:3000 aiot-backend:latest
# 推送到镜像仓库
docker push aiot-backend:latest
```
### Kubernetes 部署
详见:[Kubernetes 部署](09-devops/03-kubernetes.md)
```bash
# 部署
kubectl apply -f k8s/
# 检查状态
kubectl get pods
kubectl logs pod-name
# 更新
kubectl set image deployment/aiot-backend aiot-backend=aiot-backend:v2
```
## 📊 监控和告警
### 配置监控
详见:[监控和告警](09-devops/04-monitoring.md)
```bash
# 启动 Prometheus
docker run -d -p 9090:9090 -v prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus
# 配置 Grafana
# 访问 http://localhost:3000
```
### 关键指标
- API 响应时间
- 错误率
- CPU 使用率
- 内存使用率
- 数据库连接数
- 消息队列深度
### 告警规则
| 告警 | 阈值 | 动作 |
|-----|------|------|
| 错误率高 | >5% | 通知 Dev |
| 响应时间长 | >1000ms | 通知 DevOps |
| CPU 高 | >80% | 自动扩容 |
| 内存高 | >85% | 自动重启 |
## 📝 变更管理
### 变更流程
1. **计划** — 确定变更内容和时间
2. **验证** — 在 Staging 充分测试
3. **审批** — 获得项目经理和 DevOps 批准
4. **执行** — 按计划进行部署
5. **验证** — 部署后检查系统状态
6. **记录** — 更新 CHANGELOG
### 紧急修复
对于严重的 Bug 或安全问题:
```bash
# 1. 创建修复分支
git checkout -b hotfix/issue-name
# 2. 修复和测试
# 3. 提交 PR标记为紧急
# 4. 快速审查和合并
# 5. 立即部署到生产
```
## 🔄 灾难恢复
详见:[灾难恢复](09-devops/07-disaster-recovery.md)
### 备份策略
```bash
# 数据库备份(每天)
pg_dump aiot_db > backup_$(date +%Y%m%d).sql
# 备份到 S3
aws s3 cp backup_*.sql s3://backups/
```
### 恢复流程
```bash
# 从备份恢复
psql aiot_db < backup_20240101.sql
# 验证数据完整性
SELECT COUNT(*) FROM users;
```
### RTO 和 RPO
| 场景 | RTO | RPO |
|-----|-----|-----|
| 单个 Pod 失败 | 1 分钟 | 0无数据丢失 |
| 数据库故障 | 5 分钟 | <1 小时 |
| 整个服务故障 | 30 分钟 | <1 小时 |
## 🔐 安全部署
### 密钥管理
```bash
# 使用 Kubernetes Secrets
kubectl create secret generic db-password --from-literal=password=xxx
# 使用 HashiCorp Vault
vault write secret/aiot/db-password value=xxx
```
### SSL/TLS 证书
```bash
# 自动续期
certbot renew --quiet
# 检查证书过期
openssl x509 -in cert.pem -noout -dates
```
### 网络安全
- 启用 WAFWeb Application Firewall
- 配置 DDoS 防护
- 限制 IP 白名单
- 启用 VPN 访问
## 📈 性能优化
### 缓存策略
- Redis 缓存数据库查询结果
- CDN 缓存静态资源
- 浏览器缓存策略
### 数据库优化
- 创建合适的索引
- 分析慢查询
- 实施缓存层
### 应用优化
- 代码分割和懒加载
- 资源压缩gzip
- 异步处理
详见[性能优化](11-guides/03-performance-tuning.md)
## 🧪 部署前检查清单
部署前必须检查
- [ ] 所有测试通过
- [ ] 代码审查完成
- [ ] 文档已更新
- [ ] CHANGELOG 已更新
- [ ] 版本号已更新
- [ ] 数据库迁移脚本已准备
- [ ] 回滚计划已制定
- [ ] 相关人员已通知
## 📞 部署支持
### 联系方式
- **DevOps 团队** #devops Slack 频道
- **On-call 工程师** 参见值班表
- **项目经理** 部署审批
### 部署时间
- **日常部署** 工作日 10:00-18:00
- **紧急部署** 24/7
- **维护窗口** 周二凌晨 2:00-4:00
## 📖 相关文档
- [CI/CD 流程](09-devops/01-ci-cd.md)
- [Docker 配置](09-devops/02-docker-setup.md)
- [Kubernetes 部署](09-devops/03-kubernetes.md)
- [监控和告警](09-devops/04-monitoring.md)
- [灾难恢复](09-devops/07-disaster-recovery.md)
- [后端部署](03-backend/10-deployment.md)
- [前端部署](04-frontend/11-build-deploy.md)
---
**首次部署?** 请先阅读 [快速开始](01-getting-started/04-quick-start.md) 和相应的部署指南