yjcli 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- yjcli/__init__.py +3 -0
- yjcli/__main__.py +4 -0
- yjcli/cli.py +51 -0
- yjcli/commands/__init__.py +1 -0
- yjcli/commands/add.py +95 -0
- yjcli/commands/init_cmd.py +61 -0
- yjcli/data/__init__.py +0 -0
- yjcli/data/claude-rules/output-discipline.md +11 -0
- yjcli/data/claude-rules/skill-backend-msa.md +9 -0
- yjcli/data/claude-rules/skill-backend-service.md +10 -0
- yjcli/data/claude-rules/skill-browser-extension.md +10 -0
- yjcli/data/claude-rules/skill-cli.md +9 -0
- yjcli/data/claude-rules/skill-frontend.md +9 -0
- yjcli/data/claude-rules/skill-mobile-app.md +9 -0
- yjcli/data/claude-rules/skill-pc-app.md +9 -0
- yjcli/data/claude-rules/yj-arch-core.md +7 -0
- yjcli/data/cursor-rules/output-discipline.mdc +12 -0
- yjcli/data/cursor-rules/skill-backend-msa.mdc +9 -0
- yjcli/data/cursor-rules/skill-backend-service.mdc +9 -0
- yjcli/data/cursor-rules/skill-browser-extension.mdc +10 -0
- yjcli/data/cursor-rules/skill-cli.mdc +9 -0
- yjcli/data/cursor-rules/skill-frontend.mdc +9 -0
- yjcli/data/cursor-rules/skill-mobile-app.mdc +9 -0
- yjcli/data/cursor-rules/skill-pc-app.mdc +9 -0
- yjcli/data/cursor-rules/yj-arch-core.mdc +8 -0
- yjcli/data/skills/yj-arch-core/SKILL.md +110 -0
- yjcli/data/skills/yj-backend-msa/SKILL.md +127 -0
- yjcli/data/skills/yj-backend-service/SKILL.md +101 -0
- yjcli/data/skills/yj-browser-extension/SKILL.md +77 -0
- yjcli/data/skills/yj-cli/SKILL.md +75 -0
- yjcli/data/skills/yj-frontend/SKILL.md +68 -0
- yjcli/data/skills/yj-mobile-app/SKILL.md +63 -0
- yjcli/data/skills/yj-pc-app/SKILL.md +83 -0
- yjcli/data/templates/.gitignore +196 -0
- yjcli/data/templates/AGENTS.md +109 -0
- yjcli/data/templates/Makefile +14 -0
- yjcli/data/templates/make.bat +44 -0
- yjcli/data/templates/platform/backend/.env.development +4 -0
- yjcli/data/templates/platform/backend/.env.examples +11 -0
- yjcli/data/templates/platform/backend/.env.local-dev +4 -0
- yjcli/data/templates/platform/backend/.env.production +4 -0
- yjcli/data/templates/platform/backend-service/.env.development +2 -0
- yjcli/data/templates/platform/backend-service/.env.examples +11 -0
- yjcli/data/templates/platform/backend-service/.env.local-dev +2 -0
- yjcli/data/templates/platform/backend-service/.env.production +2 -0
- yjcli/data/templates/platform/browser-extension/.env.development +2 -0
- yjcli/data/templates/platform/browser-extension/.env.examples +5 -0
- yjcli/data/templates/platform/browser-extension/.env.local-dev +2 -0
- yjcli/data/templates/platform/browser-extension/.env.production +2 -0
- yjcli/data/templates/platform/cli/.env.development +2 -0
- yjcli/data/templates/platform/cli/.env.examples +5 -0
- yjcli/data/templates/platform/cli/.env.local-dev +2 -0
- yjcli/data/templates/platform/cli/.env.production +2 -0
- yjcli/data/templates/platform/frontend/.env.development +4 -0
- yjcli/data/templates/platform/frontend/.env.examples +11 -0
- yjcli/data/templates/platform/frontend/.env.local-dev +4 -0
- yjcli/data/templates/platform/frontend/.env.production +4 -0
- yjcli/data/templates/platform/frontend/package.json +26 -0
- yjcli/data/templates/platform/frontend/vite.config.ts +30 -0
- yjcli/data/templates/platform/mobile-app/.env.development +2 -0
- yjcli/data/templates/platform/mobile-app/.env.examples +5 -0
- yjcli/data/templates/platform/mobile-app/.env.local-dev +2 -0
- yjcli/data/templates/platform/mobile-app/.env.production +2 -0
- yjcli/data/templates/platform/pc-app/.env.development +2 -0
- yjcli/data/templates/platform/pc-app/.env.examples +5 -0
- yjcli/data/templates/platform/pc-app/.env.local-dev +2 -0
- yjcli/data/templates/platform/pc-app/.env.production +2 -0
- yjcli/data/templates/platform/scripts/run.bat +87 -0
- yjcli/data/templates/platform/scripts/run.sh +145 -0
- yjcli/data/templates/settings.json +1 -0
- yjcli/modules/__init__.py +1 -0
- yjcli/modules/constants.py +15 -0
- yjcli/modules/fsutil.py +102 -0
- yjcli/modules/paths.py +26 -0
- yjcli/modules/prompt.py +70 -0
- yjcli/services/__init__.py +1 -0
- yjcli/services/scaffold.py +201 -0
- yjcli/services/status.py +20 -0
- yjcli/services/wiring.py +61 -0
- yjcli-0.0.1.dist-info/METADATA +81 -0
- yjcli-0.0.1.dist-info/RECORD +84 -0
- yjcli-0.0.1.dist-info/WHEEL +4 -0
- yjcli-0.0.1.dist-info/entry_points.txt +2 -0
- yjcli-0.0.1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: yj-backend-service
|
|
3
|
+
description: >-
|
|
4
|
+
Single deployable backend service architecture (non-MSA). Use when editing
|
|
5
|
+
backend-service/** or browser-extension/native_*/**. Language-agnostic.
|
|
6
|
+
Optional server-templating/SSR is an add-on chapter, not a separate platform.
|
|
7
|
+
Do not use for backend/ (MSA), frontend/, mobile-app/, pc-app/, cli/, or
|
|
8
|
+
browser-extension UI/background (non-native_*) paths.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# yj-backend-service
|
|
12
|
+
|
|
13
|
+
Requires `yj-arch-core`. Scope: **`backend-service/`** and **`browser-extension/native_*/`**.
|
|
14
|
+
|
|
15
|
+
## Shape
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
backend-service/
|
|
19
|
+
scripts/ # platform-level only
|
|
20
|
+
{service_name}/
|
|
21
|
+
apps/ # entry
|
|
22
|
+
services/ # flow
|
|
23
|
+
domains/ # domain (if this process owns persistence)
|
|
24
|
+
modules/ # infra
|
|
25
|
+
views/ # optional — only if SSR/templating enabled
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`browser-extension/native_{name}/` uses the same roles and the same env templates as `backend-service` (scaffolded from `templates/platform/backend-service/`). Prefer calling it a native host service, not an MSA node, unless the user explicitly adopts MSA.
|
|
29
|
+
|
|
30
|
+
`HOST`/`PORT` are **optional** here — add them to `.env.*` only when the process actually listens.
|
|
31
|
+
|
|
32
|
+
## Default (API / worker / native host)
|
|
33
|
+
|
|
34
|
+
Roles: `entry`, `flow`, `domain` (if persistence), `infra`. No `view`.
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
entry = apps/{app_name}/main.{ext}
|
|
38
|
+
flow = services/{feature}/dto.{ext} + service.{ext}
|
|
39
|
+
domain = domains/{domain}/model.{ext} (+ repository/rules/errors/types)
|
|
40
|
+
infra = modules/{module}.{ext}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Same import rules as core: entry→flow→domain→infra. Handlers stay thin.
|
|
44
|
+
|
|
45
|
+
### domain (when persistence exists)
|
|
46
|
+
|
|
47
|
+
File responsibilities:
|
|
48
|
+
|
|
49
|
+
- `model.{ext}`: internal domain model, entity, schema, or data shape.
|
|
50
|
+
- `repository.{ext}`: persistence and retrieval using the domain model.
|
|
51
|
+
- `rules.{ext}`: domain-specific decision rules and pure validations (optional).
|
|
52
|
+
- `errors.{ext}` / `types.{ext}`: domain errors and value types (optional).
|
|
53
|
+
|
|
54
|
+
Rules:
|
|
55
|
+
|
|
56
|
+
- No HTTP/transport/template types in domain.
|
|
57
|
+
- Domains must not import apps or services.
|
|
58
|
+
- No domain→domain imports; compose in flow.
|
|
59
|
+
- Do not duplicate the same responsibility across multiple domains.
|
|
60
|
+
|
|
61
|
+
### Relation domain
|
|
62
|
+
|
|
63
|
+
Same rule as MSA: when two first-class domains have a managed relationship, add `domains/{relation_domain}/` for relationship mechanics only; compose related domains in a service. The relation domain must not import the related domains directly.
|
|
64
|
+
|
|
65
|
+
### Remote-only process
|
|
66
|
+
|
|
67
|
+
If the process has **no** local persistence (proxy/native host that only calls remote APIs): skip `domains/`; keep clients in `modules`, rules in `services`.
|
|
68
|
+
|
|
69
|
+
## Optional: server templating (SSR/MPA)
|
|
70
|
+
|
|
71
|
+
Templating is an **option**, not the folder identity. Enable only when the service must render HTML.
|
|
72
|
+
|
|
73
|
+
When enabled, add role `view`:
|
|
74
|
+
|
|
75
|
+
```text
|
|
76
|
+
view = views/{feature}/{page}.html | views/layouts/* | views/partials/*
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Extra rules:
|
|
80
|
+
|
|
81
|
+
- Handlers: parse → call flow → build template context → render. No DB in handlers.
|
|
82
|
+
- flow returns plain data / view models — never HTML.
|
|
83
|
+
- templates: presentation only; no DB/service/domain calls.
|
|
84
|
+
- If the service is JSON-API only, do **not** create `views/`.
|
|
85
|
+
|
|
86
|
+
Guide when adding SSR later:
|
|
87
|
+
|
|
88
|
+
1. Add template engine wiring in `modules` + `apps`.
|
|
89
|
+
2. Add `views/` layout/partials.
|
|
90
|
+
3. Keep existing API flows reusable; do not fork business logic into templates.
|
|
91
|
+
|
|
92
|
+
## native_host notes
|
|
93
|
+
|
|
94
|
+
- Lives under `browser-extension/native_{name}/`.
|
|
95
|
+
- Follow this skill's structure; messaging contract with the extension is infra/entry concern.
|
|
96
|
+
- Do not put Chrome extension UI code inside `native_*`.
|
|
97
|
+
|
|
98
|
+
## Editing scope
|
|
99
|
+
|
|
100
|
+
- One `{service_name}` (or one `native_{name}`) only.
|
|
101
|
+
- Do not apply MSA/proto rules from `yj-backend-msa` unless the user migrates the unit into `backend/`.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: yj-browser-extension
|
|
3
|
+
description: >-
|
|
4
|
+
Browser extension architecture (MV3, JS/TS). Use when editing
|
|
5
|
+
browser-extension/** except native_*/** paths. Covers background, content
|
|
6
|
+
scripts, and popup/options as one extension service with multiple contexts.
|
|
7
|
+
For browser-extension/native_*/**, use yj-backend-service instead. Do not use
|
|
8
|
+
for frontend/, mobile-app/, pc-app/, backend/, backend-service/, or cli/.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# yj-browser-extension
|
|
12
|
+
|
|
13
|
+
Requires `yj-arch-core`. Scope: **`browser-extension/`** excluding **`native_*/`**.
|
|
14
|
+
|
|
15
|
+
## Shape
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
browser-extension/
|
|
19
|
+
scripts/ # platform-level only
|
|
20
|
+
{extension_name}/
|
|
21
|
+
manifest.json
|
|
22
|
+
src/
|
|
23
|
+
background/ # privileged entry + flow
|
|
24
|
+
content/ # view/adapters per site
|
|
25
|
+
popup/ # view
|
|
26
|
+
lib/ # infra
|
|
27
|
+
native_{name}/ # NOT this skill → yj-backend-service
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
One `{extension_name}` = one extension service (multi-context, not microservices).
|
|
31
|
+
|
|
32
|
+
## Contexts
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
background = entry + flow (chrome.* privileges, message router)
|
|
36
|
+
content = view/DOM adapter (per site)
|
|
37
|
+
popup/options = view
|
|
38
|
+
lib = infra
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
No `domain` in the extension itself. Durable state → `chrome.storage` or a companion `native_*` / remote backend.
|
|
42
|
+
|
|
43
|
+
### background
|
|
44
|
+
|
|
45
|
+
- Listeners register and route to `services/{feature}`.
|
|
46
|
+
- Orchestrate downloads, DNR, fetch, native messaging from flow — not from raw listeners with business logic.
|
|
47
|
+
- MV3 background is a **non-persistent service worker**: do not rely on module-level globals surviving restarts. Persist durable state in `chrome.storage` (or native host / remote backend).
|
|
48
|
+
|
|
49
|
+
### content
|
|
50
|
+
|
|
51
|
+
- One module per site/target. Message background for privileged work.
|
|
52
|
+
- Split isolated vs MAIN world only when page globals are required.
|
|
53
|
+
|
|
54
|
+
### popup/options
|
|
55
|
+
|
|
56
|
+
- UI only; talk to background via messaging.
|
|
57
|
+
|
|
58
|
+
## native_host
|
|
59
|
+
|
|
60
|
+
- Folder name: `native_{name}/` under `browser-extension/`.
|
|
61
|
+
- Architecture: **`yj-backend-service`** (single local process).
|
|
62
|
+
- When editing `native_*`, do not apply extension UI rules; load `yj-backend-service`.
|
|
63
|
+
- Extension ↔ host contract stays explicit (native messaging / local HTTP).
|
|
64
|
+
|
|
65
|
+
## Import direction
|
|
66
|
+
|
|
67
|
+
```text
|
|
68
|
+
content/popup -> messaging -> background entry -> background flow -> lib / chrome.*
|
|
69
|
+
lib must not import background/content/popup
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Forbidden: content↔content business coupling; UI calling privileged chrome APIs that belong in background.
|
|
73
|
+
|
|
74
|
+
## Editing scope
|
|
75
|
+
|
|
76
|
+
- One `{extension_name}` context at a time when possible.
|
|
77
|
+
- Companion host changes → switch to `yj-backend-service`.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: yj-cli
|
|
3
|
+
description: >-
|
|
4
|
+
Single CLI application architecture, language-agnostic. Use only when editing
|
|
5
|
+
cli/**. Commands are routes; optional domains only when the CLI owns local
|
|
6
|
+
persistence. Do not use for backend/, backend-service/, frontend/,
|
|
7
|
+
mobile-app/, pc-app/, or browser-extension/.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# yj-cli
|
|
11
|
+
|
|
12
|
+
Requires `yj-arch-core`. Scope: **`cli/` only**.
|
|
13
|
+
|
|
14
|
+
## Shape
|
|
15
|
+
|
|
16
|
+
```text
|
|
17
|
+
cli/
|
|
18
|
+
scripts/ # platform-level only
|
|
19
|
+
{app_name}/
|
|
20
|
+
apps/ # entry — command tree
|
|
21
|
+
services/ # flow
|
|
22
|
+
domains/ # only if persistence-owning
|
|
23
|
+
modules/ # infra
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
One `{app_name}` = one CLI service.
|
|
27
|
+
|
|
28
|
+
## Two shapes
|
|
29
|
+
|
|
30
|
+
```text
|
|
31
|
+
persistence-owning cli -> uses domain (local db/files)
|
|
32
|
+
remote-client cli -> no domain; clients in modules; rules in services
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Roles
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
entry = apps/{app_name}/main.{ext} (+ optional command group files same package)
|
|
39
|
+
flow = services/{feature}/dto.{ext} + service.{ext}
|
|
40
|
+
domain = domains/{domain}/... # persistence-owning only
|
|
41
|
+
infra = modules/{module}.{ext} # config, http, db, output formatters
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### entry
|
|
45
|
+
|
|
46
|
+
- Build root command, register subcommands, wire deps, dispatch.
|
|
47
|
+
- Command handlers: parse flags/args → call flow → format output. No business logic / no direct domain.
|
|
48
|
+
|
|
49
|
+
### flow
|
|
50
|
+
|
|
51
|
+
- Feature operations. Return data or domain errors; do not print or parse argv.
|
|
52
|
+
- Reuse across commands; do not create one service per command automatically.
|
|
53
|
+
|
|
54
|
+
### domain
|
|
55
|
+
|
|
56
|
+
- Only when CLI persists locally. No knowledge of flags/stdout formats.
|
|
57
|
+
|
|
58
|
+
### infra
|
|
59
|
+
|
|
60
|
+
- Printing helpers OK; **what** to print is decided in the command (entry).
|
|
61
|
+
|
|
62
|
+
## Import direction
|
|
63
|
+
|
|
64
|
+
```text
|
|
65
|
+
entry -> flow -> domain -> infra
|
|
66
|
+
entry -> infra
|
|
67
|
+
flow -> infra
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Forbidden: command→domain/db/http directly; service→stdout/argv; cross-platform source imports.
|
|
71
|
+
|
|
72
|
+
## Editing scope
|
|
73
|
+
|
|
74
|
+
- `cli/{app_name}/` only.
|
|
75
|
+
- Native messaging hosts that belong to extensions live under `browser-extension/native_*` and use `yj-backend-service`, not this skill — unless the user places a pure CLI under `cli/`.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: yj-frontend
|
|
3
|
+
description: >-
|
|
4
|
+
Single frontend app architecture. Required stack: Vite + React + TypeScript +
|
|
5
|
+
react-router. Use only when editing frontend/**. Feature-level flow/view
|
|
6
|
+
separation; no domain folder by default. No plain .env. Do not use for
|
|
7
|
+
mobile-app/, pc-app/, backend/, backend-service/, cli/, or browser-extension/.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# yj-frontend
|
|
11
|
+
|
|
12
|
+
Requires `yj-arch-core`. Scope: **`frontend/` only**.
|
|
13
|
+
|
|
14
|
+
## Required stack
|
|
15
|
+
|
|
16
|
+
**Vite + React + TypeScript + react-router** (mandatory).
|
|
17
|
+
Do not scaffold CRA, Next.js, Webpack-only, or non-Vite bundlers unless the user explicitly overrides.
|
|
18
|
+
|
|
19
|
+
## Shape
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
frontend/
|
|
23
|
+
scripts/ # platform-level only
|
|
24
|
+
{app_name}/
|
|
25
|
+
src/
|
|
26
|
+
main.tsx, App.tsx # entry
|
|
27
|
+
stores/, api/ # flow
|
|
28
|
+
pages/, components/ # view
|
|
29
|
+
lib/, hooks/ # infra
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
One `{app_name}` = one web app. No micro-frontends unless the user requests it.
|
|
33
|
+
|
|
34
|
+
## Roles
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
entry = src/main.tsx, src/App.tsx (routes)
|
|
38
|
+
flow = stores + api per feature
|
|
39
|
+
view = pages + feature components (+ generated ui primitives)
|
|
40
|
+
infra = lib/*, hooks/*
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**No `src/domains/` by default.** Model = API types; rules = store/container.
|
|
44
|
+
Exception: heavy client-only persistence/engine logic only.
|
|
45
|
+
|
|
46
|
+
## Rules
|
|
47
|
+
|
|
48
|
+
- Follow `yj-arch-core` env names; listen apps need `HOST`/`PORT`. No plain `.env`.
|
|
49
|
+
- `npm start` / local mode must mean local-dev — do not silently point bare start at development/production deploy envs.
|
|
50
|
+
- Store calls `api`; pages/components do not call network directly.
|
|
51
|
+
- Container route wires store + router; presentational page takes props only.
|
|
52
|
+
- Routes declared at entry — do not scatter route tables.
|
|
53
|
+
- Generated UI primitives: do not hand-edit or duplicate.
|
|
54
|
+
- Consume backend contracts via generated client or `backend/proto/dist/{lang}` — never copy `.proto` into frontend.
|
|
55
|
+
|
|
56
|
+
## Import direction
|
|
57
|
+
|
|
58
|
+
```text
|
|
59
|
+
entry -> view
|
|
60
|
+
view (container) -> flow (store)
|
|
61
|
+
store -> api -> infra
|
|
62
|
+
view (presentational) -> props only
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Editing scope
|
|
66
|
+
|
|
67
|
+
- Stay inside `frontend/{app_name}/` (and linked contract dist if needed).
|
|
68
|
+
- Do not load Electron/Flutter skills for React web work.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: yj-mobile-app
|
|
3
|
+
description: >-
|
|
4
|
+
Single mobile app architecture (Flutter). Use only when editing mobile-app/**.
|
|
5
|
+
Same base architecture as frontend (entry/flow/view/infra, no domain by
|
|
6
|
+
default) with Flutter/Dart primitives. Do not use for frontend/, pc-app/,
|
|
7
|
+
backend/, backend-service/, cli/, or browser-extension/.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# yj-mobile-app
|
|
11
|
+
|
|
12
|
+
Requires `yj-arch-core`. Scope: **`mobile-app/` only**.
|
|
13
|
+
|
|
14
|
+
Stack: **Flutter (Dart)** + the repo's router/state choices (e.g. go_router, riverpod).
|
|
15
|
+
|
|
16
|
+
## Shape
|
|
17
|
+
|
|
18
|
+
```text
|
|
19
|
+
mobile-app/
|
|
20
|
+
scripts/ # platform-level only
|
|
21
|
+
{app_name}/
|
|
22
|
+
lib/
|
|
23
|
+
main.dart, router.dart # entry
|
|
24
|
+
providers/{feature}_*.dart # flow
|
|
25
|
+
api/{feature}_api.dart # flow
|
|
26
|
+
screens/... # view
|
|
27
|
+
widgets/... # view
|
|
28
|
+
lib/ or core/ # infra
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
One `{app_name}` = one mobile service.
|
|
32
|
+
|
|
33
|
+
## Roles (same base as frontend)
|
|
34
|
+
|
|
35
|
+
```text
|
|
36
|
+
entry = main + router
|
|
37
|
+
flow = providers + api
|
|
38
|
+
view = screens (container) + presentational views/widgets
|
|
39
|
+
infra = shared clients/formatters/utils
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**No `lib/domain/` by default.** Exception: offline DB/engine-heavy client logic.
|
|
43
|
+
|
|
44
|
+
## Rules
|
|
45
|
+
|
|
46
|
+
- Provider/store calls api; widgets do not call network directly.
|
|
47
|
+
- Container screen watches providers and passes plain props to presentational widgets.
|
|
48
|
+
- Routes declared at entry.
|
|
49
|
+
- Prefer symlink/consume `backend/proto/dist/dart` for MSA contracts when present. Do not copy `.proto` into the app.
|
|
50
|
+
|
|
51
|
+
## Import direction
|
|
52
|
+
|
|
53
|
+
```text
|
|
54
|
+
entry -> view
|
|
55
|
+
view (container) -> flow
|
|
56
|
+
flow -> api -> infra
|
|
57
|
+
view (presentational) -> constructor params only
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Editing scope
|
|
61
|
+
|
|
62
|
+
- `mobile-app/{app_name}/` only (+ linked proto dist if needed).
|
|
63
|
+
- Do not apply React/Electron folder conventions here.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: yj-pc-app
|
|
3
|
+
description: >-
|
|
4
|
+
Single Electron desktop app architecture. Use only when editing pc-app/**.
|
|
5
|
+
Stack may resemble frontend (React/TS) in the renderer, but process split
|
|
6
|
+
(main/preload/renderer) is mandatory and different from frontend/. Do not use
|
|
7
|
+
for frontend/, mobile-app/, backend/, backend-service/, cli/, or
|
|
8
|
+
browser-extension/.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# yj-pc-app
|
|
12
|
+
|
|
13
|
+
Requires `yj-arch-core`. Scope: **`pc-app/` only**.
|
|
14
|
+
|
|
15
|
+
Stack: **Electron** + TypeScript; renderer typically React + react-router (same UI stack family as frontend, different architecture).
|
|
16
|
+
|
|
17
|
+
## Shape
|
|
18
|
+
|
|
19
|
+
```text
|
|
20
|
+
pc-app/
|
|
21
|
+
scripts/ # platform-level only
|
|
22
|
+
{app_name}/
|
|
23
|
+
main/ # privileged process (backend-like)
|
|
24
|
+
preload/ # bridge only
|
|
25
|
+
renderer/ # UI (frontend-like)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
One `{app_name}` = one desktop service.
|
|
29
|
+
|
|
30
|
+
## Processes
|
|
31
|
+
|
|
32
|
+
### main (`entry`, `flow`, `domain?`, `infra`)
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
entry = main/index.ts # lifecycle, window, ipc registration
|
|
36
|
+
flow = main/services/{feature}.ts
|
|
37
|
+
domain = main/domains/{domain}/ # only if main owns real fs/db persistence
|
|
38
|
+
infra = main/modules/{module}.ts
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
- ipc handlers thin → call flow.
|
|
42
|
+
- Do not expose Node/fs directly to renderer.
|
|
43
|
+
|
|
44
|
+
### preload (`infra` bridge)
|
|
45
|
+
|
|
46
|
+
- `contextBridge` API only; thin `ipcRenderer.invoke` wrappers.
|
|
47
|
+
- No business logic. Keep channel/payload contract aligned with main + renderer api.
|
|
48
|
+
|
|
49
|
+
### renderer (`entry`, `flow`, `view`, `infra` — no domain)
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
entry = renderer/src/main.tsx, App.tsx
|
|
53
|
+
flow = stores + api (api talks to window bridge, not raw fetch to Node)
|
|
54
|
+
view = pages/components
|
|
55
|
+
infra = lib/, hooks/
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Same container/presentational split as frontend. No `renderer/src/domains/`.
|
|
59
|
+
|
|
60
|
+
## Import direction
|
|
61
|
+
|
|
62
|
+
```text
|
|
63
|
+
main entry -> main flow -> main domain -> main infra
|
|
64
|
+
renderer view -> renderer store -> renderer api -> preload bridge
|
|
65
|
+
renderer must not import Node/Electron/fs
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Contracts
|
|
69
|
+
|
|
70
|
+
- Prefer local ipc contract types shared carefully inside the app.
|
|
71
|
+
- If a future lang/client can consume `backend/proto/dist/{lang}`, symlink that dist — do not copy proto sources. Electron renderer often will not use gRPC stubs directly; do not force it.
|
|
72
|
+
|
|
73
|
+
## Environment gotchas
|
|
74
|
+
|
|
75
|
+
- Electron binary not auto-downloaded (`Error: Electron uninstall` / missing `node_modules/electron/dist`): `electron@42+` dropped the `postinstall` lifecycle script, so `npm install` may not fetch the binary.
|
|
76
|
+
- One-off: `npx install-electron` (or `node node_modules/electron/install.js`).
|
|
77
|
+
- Permanent: app `package.json` → `"scripts": { "postinstall": "install-electron" }` (real npm lifecycle name; `postinstall:electron` does **not** run).
|
|
78
|
+
- Note: recent Electron majors may require a newer Node (check the package engines).
|
|
79
|
+
|
|
80
|
+
## Editing scope
|
|
81
|
+
|
|
82
|
+
- Stay in `pc-app/{app_name}/` and the process you are changing.
|
|
83
|
+
- Do not use `yj-frontend` as a substitute; renderer likeness ≠ same skill.
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# =============================================================================
|
|
2
|
+
# Canonical gitignore (copied to repo root by `yjcli init`)
|
|
3
|
+
# Platforms: backend, backend-service, frontend, mobile-app, pc-app, cli,
|
|
4
|
+
# browser-extension (+ native hosts)
|
|
5
|
+
# =============================================================================
|
|
6
|
+
|
|
7
|
+
# ----- OS -----
|
|
8
|
+
.DS_Store
|
|
9
|
+
.DS_Store?
|
|
10
|
+
._*
|
|
11
|
+
.Spotlight-V100
|
|
12
|
+
.Trashes
|
|
13
|
+
ehthumbs.db
|
|
14
|
+
Thumbs.db
|
|
15
|
+
Desktop.ini
|
|
16
|
+
|
|
17
|
+
# ----- Editors / IDE -----
|
|
18
|
+
.idea/
|
|
19
|
+
*.iml
|
|
20
|
+
*.ipr
|
|
21
|
+
*.iws
|
|
22
|
+
.vscode/*
|
|
23
|
+
!.vscode/extensions.json
|
|
24
|
+
!.vscode/settings.json.example
|
|
25
|
+
*.swp
|
|
26
|
+
*.swo
|
|
27
|
+
*~
|
|
28
|
+
.project
|
|
29
|
+
.classpath
|
|
30
|
+
.settings/
|
|
31
|
+
.history/
|
|
32
|
+
|
|
33
|
+
# ----- Environment (commit .env.examples only) -----
|
|
34
|
+
.env
|
|
35
|
+
.env.*
|
|
36
|
+
!.env.examples
|
|
37
|
+
|
|
38
|
+
# ----- Logs / debug -----
|
|
39
|
+
logs/
|
|
40
|
+
*.log
|
|
41
|
+
npm-debug.log*
|
|
42
|
+
yarn-debug.log*
|
|
43
|
+
yarn-error.log*
|
|
44
|
+
pnpm-debug.log*
|
|
45
|
+
lerna-debug.log*
|
|
46
|
+
*.pid
|
|
47
|
+
*.seed
|
|
48
|
+
|
|
49
|
+
# ----- Dependencies -----
|
|
50
|
+
node_modules/
|
|
51
|
+
jspm_packages/
|
|
52
|
+
bower_components/
|
|
53
|
+
.pnpm-store/
|
|
54
|
+
.yarn/*
|
|
55
|
+
!.yarn/patches
|
|
56
|
+
!.yarn/plugins
|
|
57
|
+
!.yarn/releases
|
|
58
|
+
!.yarn/versions
|
|
59
|
+
|
|
60
|
+
# Python
|
|
61
|
+
.venv/
|
|
62
|
+
venv/
|
|
63
|
+
ENV/
|
|
64
|
+
env/
|
|
65
|
+
__pycache__/
|
|
66
|
+
*.py[cod]
|
|
67
|
+
*$py.class
|
|
68
|
+
*.egg-info/
|
|
69
|
+
.eggs/
|
|
70
|
+
*.egg
|
|
71
|
+
.pytest_cache/
|
|
72
|
+
.mypy_cache/
|
|
73
|
+
.ruff_cache/
|
|
74
|
+
.tox/
|
|
75
|
+
.coverage
|
|
76
|
+
.coverage.*
|
|
77
|
+
htmlcov/
|
|
78
|
+
.hypothesis/
|
|
79
|
+
|
|
80
|
+
# ----- Build / output -----
|
|
81
|
+
dist/
|
|
82
|
+
build/
|
|
83
|
+
out/
|
|
84
|
+
output/
|
|
85
|
+
target/
|
|
86
|
+
*.o
|
|
87
|
+
*.a
|
|
88
|
+
*.so
|
|
89
|
+
*.dylib
|
|
90
|
+
*.dll
|
|
91
|
+
*.exe
|
|
92
|
+
*.app
|
|
93
|
+
*.jar
|
|
94
|
+
*.war
|
|
95
|
+
*.class
|
|
96
|
+
|
|
97
|
+
# Go
|
|
98
|
+
bin/
|
|
99
|
+
*.test
|
|
100
|
+
*.out
|
|
101
|
+
coverage.out
|
|
102
|
+
vendor/
|
|
103
|
+
|
|
104
|
+
# Java / Kotlin / Gradle / Maven
|
|
105
|
+
.gradle/
|
|
106
|
+
*.class
|
|
107
|
+
hs_err_pid*
|
|
108
|
+
|
|
109
|
+
# Dart / Flutter
|
|
110
|
+
.dart_tool/
|
|
111
|
+
.flutter-plugins
|
|
112
|
+
.flutter-plugins-dependencies
|
|
113
|
+
.packages
|
|
114
|
+
.pub-cache/
|
|
115
|
+
.pub/
|
|
116
|
+
**/doc/api/
|
|
117
|
+
**/ios/Flutter/Flutter.framework
|
|
118
|
+
**/ios/Flutter/Flutter.podspec
|
|
119
|
+
**/ios/Pods/
|
|
120
|
+
**/android/.gradle/
|
|
121
|
+
**/android/local.properties
|
|
122
|
+
**/android/app/debug
|
|
123
|
+
**/android/app/profile
|
|
124
|
+
**/android/app/release
|
|
125
|
+
*.iml
|
|
126
|
+
|
|
127
|
+
# Electron / desktop packaging
|
|
128
|
+
*.asar
|
|
129
|
+
release/
|
|
130
|
+
releases/
|
|
131
|
+
*.dmg
|
|
132
|
+
*.AppImage
|
|
133
|
+
*.snap
|
|
134
|
+
*.nupkg
|
|
135
|
+
|
|
136
|
+
# Vite / frontend caches
|
|
137
|
+
.vite/
|
|
138
|
+
.turbo/
|
|
139
|
+
.cache/
|
|
140
|
+
.parcel-cache/
|
|
141
|
+
.eslintcache
|
|
142
|
+
.stylelintcache
|
|
143
|
+
*.tsbuildinfo
|
|
144
|
+
.next/
|
|
145
|
+
.nuxt/
|
|
146
|
+
.svelte-kit/
|
|
147
|
+
|
|
148
|
+
# ----- Test / coverage -----
|
|
149
|
+
coverage/
|
|
150
|
+
*.lcov
|
|
151
|
+
.nyc_output/
|
|
152
|
+
test-results/
|
|
153
|
+
playwright-report/
|
|
154
|
+
.mocha/
|
|
155
|
+
|
|
156
|
+
# ----- Local runtime / data -----
|
|
157
|
+
.data/
|
|
158
|
+
data/
|
|
159
|
+
tmp/
|
|
160
|
+
temp/
|
|
161
|
+
*.tmp
|
|
162
|
+
*.temp
|
|
163
|
+
.run.pid
|
|
164
|
+
**/.run.pid
|
|
165
|
+
*.db
|
|
166
|
+
*.db-shm
|
|
167
|
+
*.db-wal
|
|
168
|
+
*.sqlite
|
|
169
|
+
*.sqlite3
|
|
170
|
+
|
|
171
|
+
# ----- Secrets / keys (never commit) -----
|
|
172
|
+
*.pem
|
|
173
|
+
*.key
|
|
174
|
+
*.p12
|
|
175
|
+
*.pfx
|
|
176
|
+
id_rsa
|
|
177
|
+
id_rsa.pub
|
|
178
|
+
credentials.json
|
|
179
|
+
service-account*.json
|
|
180
|
+
secrets/
|
|
181
|
+
.secrets/
|
|
182
|
+
|
|
183
|
+
# ----- Protobuf generated (keep sources; ignore accidental local dumps) -----
|
|
184
|
+
# Prefer committing language dists under backend/proto/dist/{lang}/ when intentional.
|
|
185
|
+
# Uncomment if generated stubs must stay local-only:
|
|
186
|
+
# backend/proto/dist/
|
|
187
|
+
|
|
188
|
+
# ----- Misc -----
|
|
189
|
+
*.bak
|
|
190
|
+
*.orig
|
|
191
|
+
*.rej
|
|
192
|
+
.terraform/
|
|
193
|
+
*.tfstate
|
|
194
|
+
*.tfstate.*
|
|
195
|
+
.direnv/
|
|
196
|
+
.envrc.local
|