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.
Files changed (84) hide show
  1. yjcli/__init__.py +3 -0
  2. yjcli/__main__.py +4 -0
  3. yjcli/cli.py +51 -0
  4. yjcli/commands/__init__.py +1 -0
  5. yjcli/commands/add.py +95 -0
  6. yjcli/commands/init_cmd.py +61 -0
  7. yjcli/data/__init__.py +0 -0
  8. yjcli/data/claude-rules/output-discipline.md +11 -0
  9. yjcli/data/claude-rules/skill-backend-msa.md +9 -0
  10. yjcli/data/claude-rules/skill-backend-service.md +10 -0
  11. yjcli/data/claude-rules/skill-browser-extension.md +10 -0
  12. yjcli/data/claude-rules/skill-cli.md +9 -0
  13. yjcli/data/claude-rules/skill-frontend.md +9 -0
  14. yjcli/data/claude-rules/skill-mobile-app.md +9 -0
  15. yjcli/data/claude-rules/skill-pc-app.md +9 -0
  16. yjcli/data/claude-rules/yj-arch-core.md +7 -0
  17. yjcli/data/cursor-rules/output-discipline.mdc +12 -0
  18. yjcli/data/cursor-rules/skill-backend-msa.mdc +9 -0
  19. yjcli/data/cursor-rules/skill-backend-service.mdc +9 -0
  20. yjcli/data/cursor-rules/skill-browser-extension.mdc +10 -0
  21. yjcli/data/cursor-rules/skill-cli.mdc +9 -0
  22. yjcli/data/cursor-rules/skill-frontend.mdc +9 -0
  23. yjcli/data/cursor-rules/skill-mobile-app.mdc +9 -0
  24. yjcli/data/cursor-rules/skill-pc-app.mdc +9 -0
  25. yjcli/data/cursor-rules/yj-arch-core.mdc +8 -0
  26. yjcli/data/skills/yj-arch-core/SKILL.md +110 -0
  27. yjcli/data/skills/yj-backend-msa/SKILL.md +127 -0
  28. yjcli/data/skills/yj-backend-service/SKILL.md +101 -0
  29. yjcli/data/skills/yj-browser-extension/SKILL.md +77 -0
  30. yjcli/data/skills/yj-cli/SKILL.md +75 -0
  31. yjcli/data/skills/yj-frontend/SKILL.md +68 -0
  32. yjcli/data/skills/yj-mobile-app/SKILL.md +63 -0
  33. yjcli/data/skills/yj-pc-app/SKILL.md +83 -0
  34. yjcli/data/templates/.gitignore +196 -0
  35. yjcli/data/templates/AGENTS.md +109 -0
  36. yjcli/data/templates/Makefile +14 -0
  37. yjcli/data/templates/make.bat +44 -0
  38. yjcli/data/templates/platform/backend/.env.development +4 -0
  39. yjcli/data/templates/platform/backend/.env.examples +11 -0
  40. yjcli/data/templates/platform/backend/.env.local-dev +4 -0
  41. yjcli/data/templates/platform/backend/.env.production +4 -0
  42. yjcli/data/templates/platform/backend-service/.env.development +2 -0
  43. yjcli/data/templates/platform/backend-service/.env.examples +11 -0
  44. yjcli/data/templates/platform/backend-service/.env.local-dev +2 -0
  45. yjcli/data/templates/platform/backend-service/.env.production +2 -0
  46. yjcli/data/templates/platform/browser-extension/.env.development +2 -0
  47. yjcli/data/templates/platform/browser-extension/.env.examples +5 -0
  48. yjcli/data/templates/platform/browser-extension/.env.local-dev +2 -0
  49. yjcli/data/templates/platform/browser-extension/.env.production +2 -0
  50. yjcli/data/templates/platform/cli/.env.development +2 -0
  51. yjcli/data/templates/platform/cli/.env.examples +5 -0
  52. yjcli/data/templates/platform/cli/.env.local-dev +2 -0
  53. yjcli/data/templates/platform/cli/.env.production +2 -0
  54. yjcli/data/templates/platform/frontend/.env.development +4 -0
  55. yjcli/data/templates/platform/frontend/.env.examples +11 -0
  56. yjcli/data/templates/platform/frontend/.env.local-dev +4 -0
  57. yjcli/data/templates/platform/frontend/.env.production +4 -0
  58. yjcli/data/templates/platform/frontend/package.json +26 -0
  59. yjcli/data/templates/platform/frontend/vite.config.ts +30 -0
  60. yjcli/data/templates/platform/mobile-app/.env.development +2 -0
  61. yjcli/data/templates/platform/mobile-app/.env.examples +5 -0
  62. yjcli/data/templates/platform/mobile-app/.env.local-dev +2 -0
  63. yjcli/data/templates/platform/mobile-app/.env.production +2 -0
  64. yjcli/data/templates/platform/pc-app/.env.development +2 -0
  65. yjcli/data/templates/platform/pc-app/.env.examples +5 -0
  66. yjcli/data/templates/platform/pc-app/.env.local-dev +2 -0
  67. yjcli/data/templates/platform/pc-app/.env.production +2 -0
  68. yjcli/data/templates/platform/scripts/run.bat +87 -0
  69. yjcli/data/templates/platform/scripts/run.sh +145 -0
  70. yjcli/data/templates/settings.json +1 -0
  71. yjcli/modules/__init__.py +1 -0
  72. yjcli/modules/constants.py +15 -0
  73. yjcli/modules/fsutil.py +102 -0
  74. yjcli/modules/paths.py +26 -0
  75. yjcli/modules/prompt.py +70 -0
  76. yjcli/services/__init__.py +1 -0
  77. yjcli/services/scaffold.py +201 -0
  78. yjcli/services/status.py +20 -0
  79. yjcli/services/wiring.py +61 -0
  80. yjcli-0.0.1.dist-info/METADATA +81 -0
  81. yjcli-0.0.1.dist-info/RECORD +84 -0
  82. yjcli-0.0.1.dist-info/WHEEL +4 -0
  83. yjcli-0.0.1.dist-info/entry_points.txt +2 -0
  84. yjcli-0.0.1.dist-info/licenses/LICENSE +21 -0
yjcli/__init__.py ADDED
@@ -0,0 +1,3 @@
1
+ """yjcli — platform/service scaffold and agent wiring."""
2
+
3
+ __version__ = "0.0.1"
yjcli/__main__.py ADDED
@@ -0,0 +1,4 @@
1
+ from yjcli.cli import app
2
+
3
+ if __name__ == "__main__":
4
+ app()
yjcli/cli.py ADDED
@@ -0,0 +1,51 @@
1
+ """Entry: register subcommands (Typer)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Optional
6
+
7
+ import typer
8
+
9
+ from yjcli import __version__
10
+ from yjcli.commands import add
11
+ from yjcli.commands.init_cmd import init_cmd
12
+ from yjcli.services import status
13
+
14
+ app = typer.Typer(
15
+ name="yjcli",
16
+ help="Scaffold YJ platforms/services and Cursor/Claude agent wiring.",
17
+ no_args_is_help=True,
18
+ )
19
+
20
+
21
+ def _version_callback(value: bool) -> None:
22
+ if value:
23
+ typer.echo(__version__)
24
+ raise typer.Exit()
25
+
26
+
27
+ @app.callback()
28
+ def main(
29
+ version: Optional[bool] = typer.Option(
30
+ None,
31
+ "--version",
32
+ "-V",
33
+ help="Print version and exit.",
34
+ callback=_version_callback,
35
+ is_eager=True,
36
+ ),
37
+ ) -> None:
38
+ """yjcli root options."""
39
+
40
+
41
+ app.command("init")(init_cmd)
42
+ app.add_typer(add.app, name="add")
43
+
44
+
45
+ @app.command("doctor")
46
+ def doctor() -> None:
47
+ """Show packaged template/skill/rule counts."""
48
+ assets = status.asset_summary()
49
+ typer.echo("yjcli packaged data:")
50
+ for key, n in assets.items():
51
+ typer.echo(f" {key}: {n} files")
@@ -0,0 +1 @@
1
+ """CLI command groups (thin entry handlers)."""
yjcli/commands/add.py ADDED
@@ -0,0 +1,95 @@
1
+ """yjcli add <resource> — extend an existing repo."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+ from typing import Optional
7
+
8
+ import typer
9
+
10
+ from yjcli.modules.constants import PLATFORMS
11
+ from yjcli.services import scaffold
12
+
13
+ app = typer.Typer(help="Add a platform or service to the current repo.")
14
+
15
+
16
+ @app.command("platform")
17
+ def add_platform(
18
+ platform: Optional[list[str]] = typer.Option(
19
+ None,
20
+ "--platform",
21
+ "-p",
22
+ help="Platform to add (repeatable). Interactive if omitted.",
23
+ ),
24
+ all_platforms: bool = typer.Option(
25
+ False,
26
+ "--all",
27
+ help="Add all missing platforms.",
28
+ ),
29
+ force: bool = typer.Option(
30
+ False,
31
+ "--force",
32
+ "-f",
33
+ help="Overwrite existing root/agent files without prompting.",
34
+ ),
35
+ path: Path = typer.Option(
36
+ Path("."),
37
+ "--path",
38
+ help="Target repository root (default: cwd).",
39
+ file_okay=False,
40
+ dir_okay=True,
41
+ resolve_path=True,
42
+ ),
43
+ ) -> None:
44
+ """Add one or more platform roots from packaged templates."""
45
+ if all_platforms and platform:
46
+ typer.echo("error: use either --all or --platform, not both", err=True)
47
+ raise typer.Exit(code=1)
48
+ if platform:
49
+ unknown = [p for p in platform if p not in PLATFORMS]
50
+ if unknown:
51
+ typer.echo(
52
+ f"error: unknown platform(s): {', '.join(unknown)}",
53
+ err=True,
54
+ )
55
+ raise typer.Exit(code=1)
56
+
57
+ scaffold.bootstrap(
58
+ path,
59
+ platforms=platform,
60
+ all_platforms=all_platforms,
61
+ force=force,
62
+ mode="add",
63
+ )
64
+
65
+
66
+ @app.command("service")
67
+ def add_service(
68
+ platform: Optional[str] = typer.Option(
69
+ None,
70
+ "--platform",
71
+ "-p",
72
+ help="Existing platform root. Interactive if omitted.",
73
+ ),
74
+ name: Optional[str] = typer.Option(
75
+ None,
76
+ "--name",
77
+ "-n",
78
+ help="Service/app name. Interactive if omitted.",
79
+ ),
80
+ path: Path = typer.Option(
81
+ Path("."),
82
+ "--path",
83
+ help="Target repository root (default: cwd).",
84
+ file_okay=False,
85
+ dir_okay=True,
86
+ resolve_path=True,
87
+ ),
88
+ ) -> None:
89
+ """Add a service/app under an existing platform."""
90
+ if platform and platform not in PLATFORMS:
91
+ typer.echo(f"error: unknown platform: {platform}", err=True)
92
+ typer.echo(f"known: {', '.join(PLATFORMS)}", err=True)
93
+ raise typer.Exit(code=1)
94
+
95
+ scaffold.add_service_flow(path, platform=platform, name=name)
@@ -0,0 +1,61 @@
1
+ """yjcli init — bootstrap the current repo."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from pathlib import Path
6
+ from typing import Optional
7
+
8
+ import typer
9
+
10
+ from yjcli.modules.constants import PLATFORMS
11
+ from yjcli.services import scaffold
12
+
13
+
14
+ def init_cmd(
15
+ platform: Optional[list[str]] = typer.Option(
16
+ None,
17
+ "--platform",
18
+ "-p",
19
+ help="Platform to create (repeatable). Interactive if omitted.",
20
+ ),
21
+ all_platforms: bool = typer.Option(
22
+ False,
23
+ "--all",
24
+ help="Create all known platforms.",
25
+ ),
26
+ force: bool = typer.Option(
27
+ False,
28
+ "--force",
29
+ "-f",
30
+ help="Overwrite existing root/agent files without prompting.",
31
+ ),
32
+ path: Path = typer.Option(
33
+ Path("."),
34
+ "--path",
35
+ help="Target repository root (default: cwd).",
36
+ file_okay=False,
37
+ dir_okay=True,
38
+ resolve_path=True,
39
+ ),
40
+ ) -> None:
41
+ """Bootstrap root templates, agent wiring, and selected platforms."""
42
+ if all_platforms and platform:
43
+ typer.echo("error: use either --all or --platform, not both", err=True)
44
+ raise typer.Exit(code=1)
45
+ if platform:
46
+ unknown = [p for p in platform if p not in PLATFORMS]
47
+ if unknown:
48
+ typer.echo(
49
+ f"error: unknown platform(s): {', '.join(unknown)}",
50
+ err=True,
51
+ )
52
+ typer.echo(f"known: {', '.join(PLATFORMS)}", err=True)
53
+ raise typer.Exit(code=1)
54
+
55
+ scaffold.bootstrap(
56
+ path,
57
+ platforms=platform,
58
+ all_platforms=all_platforms,
59
+ force=force,
60
+ mode="init",
61
+ )
yjcli/data/__init__.py ADDED
File without changes
@@ -0,0 +1,11 @@
1
+ ---
2
+ description: Output and documentation discipline - concise table-first results; do not touch docs unless asked
3
+ ---
4
+
5
+ # Output & Docs Discipline
6
+
7
+ - Present results concisely; summarize as a table when possible.
8
+ - Show only the summary. Do not dump raw execution output, full logs, or intermediate artifacts.
9
+ - No filler, no repeated explanations.
10
+ - Switch to detailed output only when the user explicitly asks (e.g. "자세히"): keep the table first, then add reasoning and key code excerpts.
11
+ - Do not create or modify docs (README, etc.) unless the user explicitly asks. When editing a doc, rewrite it in context so it stays in sync with the code.
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: Route backend/ edits to yj-backend-msa skill
3
+ paths:
4
+ - "backend/**"
5
+ ---
6
+
7
+ # Skill routing
8
+
9
+ Read and follow `yj-backend-msa` (with `yj-arch-core`). Do not apply other platform skills.
@@ -0,0 +1,10 @@
1
+ ---
2
+ description: Route backend-service/ and native host edits to yj-backend-service skill
3
+ paths:
4
+ - "backend-service/**"
5
+ - "browser-extension/native_*/**"
6
+ ---
7
+
8
+ # Skill routing
9
+
10
+ Read and follow `yj-backend-service` (with `yj-arch-core`). Do not apply other platform skills.
@@ -0,0 +1,10 @@
1
+ ---
2
+ description: Route browser-extension/ (non-native) edits to yj-browser-extension skill
3
+ paths:
4
+ - "browser-extension/**"
5
+ ---
6
+
7
+ # Skill routing
8
+
9
+ Read and follow `yj-browser-extension` (with `yj-arch-core`) for extension UI/background/content.
10
+ If the path is `browser-extension/native_*/**`, use `yj-backend-service` instead.
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: Route cli/ edits to yj-cli skill
3
+ paths:
4
+ - "cli/**"
5
+ ---
6
+
7
+ # Skill routing
8
+
9
+ Read and follow `yj-cli` (with `yj-arch-core`). Do not apply other platform skills.
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: Route frontend/ edits to yj-frontend skill
3
+ paths:
4
+ - "frontend/**"
5
+ ---
6
+
7
+ # Skill routing
8
+
9
+ Read and follow `yj-frontend` (with `yj-arch-core`). Do not apply other platform skills.
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: Route mobile-app/ edits to yj-mobile-app skill
3
+ paths:
4
+ - "mobile-app/**"
5
+ ---
6
+
7
+ # Skill routing
8
+
9
+ Read and follow `yj-mobile-app` (with `yj-arch-core`). Do not apply other platform skills.
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: Route pc-app/ edits to yj-pc-app skill
3
+ paths:
4
+ - "pc-app/**"
5
+ ---
6
+
7
+ # Skill routing
8
+
9
+ Read and follow `yj-pc-app` (with `yj-arch-core`). Do not apply other platform skills.
@@ -0,0 +1,7 @@
1
+ ---
2
+ description: Always load yj-arch-core skill for coding work
3
+ ---
4
+
5
+ # Architecture skill
6
+
7
+ When creating, modifying, reviewing, or refactoring code, read and follow the project skill `yj-arch-core`, then exactly one matching `yj-*` platform skill for the folder being edited.
@@ -0,0 +1,12 @@
1
+ ---
2
+ description: Output and documentation discipline - concise table-first results; do not touch docs unless asked
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Output & Docs Discipline
7
+
8
+ - Present results concisely; summarize as a table when possible.
9
+ - Show only the summary. Do not dump raw execution output, full logs, or intermediate artifacts.
10
+ - No filler, no repeated explanations.
11
+ - Switch to detailed output only when the user explicitly asks (e.g. "자세히"): keep the table first, then reasoning and the key code excerpts.
12
+ - Do not create or modify docs (README, etc.) unless the user explicitly asks. When editing a doc, rewrite it in context so it stays in sync with the code.
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: Route backend/ edits to yj-backend-msa skill
3
+ globs: backend/**
4
+ alwaysApply: false
5
+ ---
6
+
7
+ # Skill routing
8
+
9
+ Read and follow `yj-backend-msa` (with `yj-arch-core`). Do not apply other platform skills.
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: Route backend-service/ and native host edits to yj-backend-service skill
3
+ globs: backend-service/**,browser-extension/native_*/**
4
+ alwaysApply: false
5
+ ---
6
+
7
+ # Skill routing
8
+
9
+ Read and follow `yj-backend-service` (with `yj-arch-core`). Do not apply other platform skills.
@@ -0,0 +1,10 @@
1
+ ---
2
+ description: Route browser-extension/ (non-native) edits to yj-browser-extension skill
3
+ globs: browser-extension/**
4
+ alwaysApply: false
5
+ ---
6
+
7
+ # Skill routing
8
+
9
+ Read and follow `yj-browser-extension` (with `yj-arch-core`) for extension UI/background/content.
10
+ If the path is `browser-extension/native_*/**`, use `yj-backend-service` instead.
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: Route cli/ edits to yj-cli skill
3
+ globs: cli/**
4
+ alwaysApply: false
5
+ ---
6
+
7
+ # Skill routing
8
+
9
+ Read and follow `yj-cli` (with `yj-arch-core`). Do not apply other platform skills.
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: Route frontend/ edits to yj-frontend skill
3
+ globs: frontend/**
4
+ alwaysApply: false
5
+ ---
6
+
7
+ # Skill routing
8
+
9
+ Read and follow `yj-frontend` (with `yj-arch-core`). Do not apply other platform skills.
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: Route mobile-app/ edits to yj-mobile-app skill
3
+ globs: mobile-app/**
4
+ alwaysApply: false
5
+ ---
6
+
7
+ # Skill routing
8
+
9
+ Read and follow `yj-mobile-app` (with `yj-arch-core`). Do not apply other platform skills.
@@ -0,0 +1,9 @@
1
+ ---
2
+ description: Route pc-app/ edits to yj-pc-app skill
3
+ globs: pc-app/**
4
+ alwaysApply: false
5
+ ---
6
+
7
+ # Skill routing
8
+
9
+ Read and follow `yj-pc-app` (with `yj-arch-core`). Do not apply other platform skills.
@@ -0,0 +1,8 @@
1
+ ---
2
+ description: Always load yj-arch-core skill for coding work
3
+ alwaysApply: true
4
+ ---
5
+
6
+ # Architecture skill
7
+
8
+ When creating, modifying, reviewing, or refactoring code, read and follow the project skill `yj-arch-core`, then exactly one matching `yj-*` platform skill for the folder being edited.
@@ -0,0 +1,110 @@
1
+ ---
2
+ name: yj-arch-core
3
+ description: >-
4
+ Repository architecture constitution for this monorepo. Use on every coding,
5
+ review, or refactor task. Enforces fixed platform roots, unified env file
6
+ names, universal entry/flow/domain/view/infra roles, acyclic imports, and
7
+ minimal edit scope. Always apply together with exactly one matching yj-*
8
+ platform skill for the folder being edited.
9
+ ---
10
+
11
+ # yj-arch-core
12
+
13
+ ## Purpose
14
+
15
+ Reduce AI cost and blast radius. Do not reinterpret the whole repo, add
16
+ wrappers/layers, or read unrelated platforms.
17
+
18
+ 1. Existing repo conventions win when clearer than this skill.
19
+ 2. Identify the platform root folder first, then load **only** that platform skill.
20
+ 3. Edit the smallest file set that owns the change.
21
+
22
+ ## Fixed platform roots
23
+
24
+ ```text
25
+ backend/ # MSA + gRPC (yj-backend-msa)
26
+ backend-service/ # single BE (yj-backend-service)
27
+ frontend/ # yj-frontend
28
+ mobile-app/ # yj-mobile-app
29
+ pc-app/ # yj-pc-app
30
+ cli/ # yj-cli
31
+ browser-extension/ # yj-browser-extension
32
+ ```
33
+
34
+ ```text
35
+ {platform}/
36
+ scripts/ # platform-level only
37
+ {service_name}/ # one deployable / one app
38
+ ```
39
+
40
+ - `backend/proto/` is reserved (see yj-backend-msa).
41
+ - `browser-extension/native_{name}/` → **yj-backend-service**.
42
+ - Do not invent new platform roots or put app code at repo root.
43
+ - Do not add per-service `scripts/` or edit root Makefile for each new service.
44
+
45
+ ## Environment (guardrails only)
46
+
47
+ Allowed files at each service root (no plain `.env`):
48
+
49
+ `.env.local-dev` · `.env.development` · `.env.production` · `.env.examples`
50
+
51
+ - Do not invent alternate names (including Vite `.env` / `.env.local`) unless a thin loader maps to this set.
52
+ - Env field sets come from `templates/platform/<platform>/`. `browser-extension/native_*` uses the `backend-service` templates. Do not invent fields/filenames outside those templates.
53
+ - `HOST`/`PORT` are only required when the service actually listens (e.g. backend MSA, frontend). For `backend-service` they are optional — add only if needed.
54
+ - Commit `.env.examples` only; never commit the other three.
55
+ - Local platform `run.*` uses `.env.local-dev` only — do not hardcode HOST/PORT in scripts.
56
+
57
+ ## Skill routing
58
+
59
+ | Path | Platform skill |
60
+ |------|----------------|
61
+ | `backend/**` | `yj-backend-msa` |
62
+ | `backend-service/**` | `yj-backend-service` |
63
+ | `frontend/**` | `yj-frontend` |
64
+ | `mobile-app/**` | `yj-mobile-app` |
65
+ | `pc-app/**` | `yj-pc-app` |
66
+ | `cli/**` | `yj-cli` |
67
+ | `browser-extension/native_*/**` | `yj-backend-service` |
68
+ | `browser-extension/**` (other) | `yj-browser-extension` |
69
+
70
+ Never load all platform skills. Never apply a platform skill outside its folder.
71
+
72
+ ## Universal roles
73
+
74
+ ```text
75
+ entry = executable entrypoint + route/command/screen registration + wiring
76
+ flow = feature composition + dto / input-output shape
77
+ domain = model + repository + rules (only where persistence lives)
78
+ view = UI (only platforms that render UI)
79
+ infra = shared technical modules (config, clients, logging, utils)
80
+ ```
81
+
82
+ UI clients default to **no `domain`**: model = API types; rules live in flow.
83
+
84
+ ## Import direction
85
+
86
+ Allowed: `entry -> flow -> domain -> infra`, `entry -> infra`, `flow -> infra`, `view -> flow`, `domain -> infra`.
87
+
88
+ Forbidden: `domain -> flow/entry/other domain`, `flow -> entry/other flow` (unless repo allows), `infra -> *`, `view -> domain/infra/network`, generated UI → project-specific imports.
89
+
90
+ Cycles are structure bugs — do not paper over with lazy imports or wrappers.
91
+
92
+ ## Editing workflow
93
+
94
+ Before: platform skill → feature/domain → minimal file set → prefer reuse.
95
+
96
+ During: edit in place; no thin wrappers/adapters; no one-line functions unless the name is a real domain concept; keep feature work and drive-by refactors separate.
97
+
98
+ Avoid names: `{entity}_v2|_wrapper|_adapter|_helper`, `{feature}_manager|_processor`.
99
+
100
+ Avoid layers unless user requests: `usecases/`, `workflows/`, `orchestrations/`, `application/`, `controllers/`, `handlers/`.
101
+
102
+ `flow` is the composition layer — do not invent a layer above it.
103
+
104
+ After: summarize files, boundaries, new files, test/migration risk briefly.
105
+
106
+ ## Cross-platform contracts
107
+
108
+ - Prefer generated clients / `backend/proto/dist/{lang}` over hand-copied DTOs.
109
+ - Do not import another platform's source tree.
110
+ - Do not read unrelated platforms unless the user task explicitly spans them.
@@ -0,0 +1,127 @@
1
+ ---
2
+ name: yj-backend-msa
3
+ description: >-
4
+ Backend MSA architecture with mandatory gRPC/protobuf. Use only when creating
5
+ or editing code under backend/. Language-agnostic (Go/Python/Java/etc.).
6
+ Covers backend/{service}, backend/proto, and proto/dist/{lang}. Do not use for
7
+ backend-service/, frontend/, mobile-app/, pc-app/, cli/, or browser-extension/.
8
+ ---
9
+
10
+ # yj-backend-msa
11
+
12
+ Requires `yj-arch-core`. Scope: **`backend/` only**.
13
+
14
+ ## Shape
15
+
16
+ ```text
17
+ backend/
18
+ scripts/ # platform-level only
19
+ proto/ # owned by backend MSA only
20
+ *.proto
21
+ dist/
22
+ golang/
23
+ python/
24
+ java/
25
+ dart/
26
+ ...
27
+ {service_name}/
28
+ apps/ # entry
29
+ services/ # flow
30
+ domains/ # domain
31
+ modules/ # infra
32
+ ```
33
+
34
+ - One `{service_name}` = one deployable microservice.
35
+ - Do not over-split domains into tiny services. Split by cohesive business capability.
36
+ - gRPC + protobuf are **mandatory**. External API surface is proto, not ad-hoc JSON structs copied across services.
37
+
38
+ ## proto
39
+
40
+ - Sources live only in `backend/proto/`.
41
+ - Generated stubs go to `backend/proto/dist/{lang}/`.
42
+ - Other platforms (e.g. `mobile-app`) may **symlink** to `backend/proto/dist/{lang}` — they must not own `.proto` copies.
43
+ - Prefer package boundaries in proto that align with service boundaries.
44
+
45
+ ## Roles inside `{service_name}`
46
+
47
+ ```text
48
+ entry = apps/{app_name}/main.{ext}
49
+ flow = services/{feature}/dto.{ext} + service.{ext}
50
+ domain = domains/{domain}/model.{ext} (+ repository/rules/errors/types)
51
+ infra = modules/{module}.{ext}
52
+ ```
53
+
54
+ ### entry
55
+
56
+ - Init, gRPC server registration, dependency wiring only.
57
+ - No business logic. No direct domain calls (always through flow).
58
+
59
+ ### flow
60
+
61
+ - Feature/workflow composition. DTOs for this service's use of contracts.
62
+ - Reuse services across RPCs; do not create a service per RPC automatically.
63
+ - Do not import other services' source trees; call them over gRPC using generated clients.
64
+
65
+ ### domain
66
+
67
+ File responsibilities:
68
+
69
+ - `model.{ext}`: internal domain model, entity, schema, or data shape.
70
+ - `repository.{ext}`: persistence and retrieval using the domain model.
71
+ - `rules.{ext}`: domain-specific decision rules and pure validations (optional).
72
+ - `errors.{ext}`: domain-specific errors or exceptions (optional).
73
+ - `types.{ext}`: enums, value types, and domain-only type definitions (optional).
74
+
75
+ Rules:
76
+
77
+ - Persistence + rules for concepts this service owns.
78
+ - No gRPC/transport types in domain.
79
+ - Domains must not import apps or services.
80
+ - No domain→domain imports; compose in flow.
81
+ - Do not duplicate the same responsibility across multiple domains.
82
+
83
+ ### Relation domain
84
+
85
+ When two domains are both first-class concepts and their relationship is managed directly, create a relation domain.
86
+
87
+ Use when:
88
+
89
+ - `{domain_a}` and `{domain_b}` are both first-class concepts.
90
+ - Neither is merely a field of the other.
91
+ - The relationship itself is created, deleted, queried, or constrained.
92
+ - Multiple RPCs/routes express the same relationship from different perspectives.
93
+
94
+ ```text
95
+ domains/{domain_a}/
96
+ domains/{domain_b}/
97
+ domains/{relation_domain}/
98
+ services/{relation_feature}/
99
+ dto.{ext}
100
+ service.{ext}
101
+ ```
102
+
103
+ - The relation domain owns relationship mechanics only.
104
+ - It must not import the related domains directly.
105
+ - Existence checks, policy checks, and cross-domain composition belong in the service (flow).
106
+
107
+ ### infra
108
+
109
+ - config, db, logging, gRPC client factories, auth adapters, low-level helpers.
110
+ - No business logic or domain-specific helpers.
111
+ - Do not turn modules into a generic utilities dump.
112
+ - Modules must not import apps, services, or domains.
113
+
114
+ ## Import direction
115
+
116
+ ```text
117
+ entry -> flow -> domain -> infra
118
+ entry -> infra
119
+ flow -> infra (including generated gRPC clients)
120
+ ```
121
+
122
+ Forbidden: handler→domain, domain→flow, cross-service source imports, new layers above flow.
123
+
124
+ ## Editing scope
125
+
126
+ - Touch one `{service_name}` plus, if needed, `backend/proto` (and regenerate dist).
127
+ - Do not open `frontend/` or other platforms unless the user explicitly asks for a cross-change.