teamshare-bridge 0.22.7 → 0.22.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +383 -383
- package/dist/bridge/daemon.js +43 -20
- package/dist/bridge/daemon.js.map +1 -1
- package/dist/bridge/install-verify.js +8 -8
- package/dist/bridge/spawn.d.ts +14 -0
- package/dist/bridge/spawn.js +7 -1
- package/dist/bridge/spawn.js.map +1 -1
- package/dist/bridge/wake-handler.d.ts +8 -15
- package/dist/bridge/wake-handler.js +109 -14
- package/dist/bridge/wake-handler.js.map +1 -1
- package/dist/bridge/wake-outbox.js +7 -0
- package/dist/bridge/wake-outbox.js.map +1 -1
- package/dist/cli/commands/plan.js +4 -0
- package/dist/cli/commands/plan.js.map +1 -1
- package/dist/lib/browser/human-input-guard.js +98 -98
- package/dist/lib/browser/screen-change.js +60 -60
- package/dist/lib/llm/usage-reader.js +4 -4
- package/dist/lib/workspace/classify.d.ts +29 -0
- package/dist/lib/workspace/classify.js +62 -0
- package/dist/lib/workspace/classify.js.map +1 -1
- package/dist/lib/workspace/presence.d.ts +31 -0
- package/dist/lib/workspace/presence.js +35 -1
- package/dist/lib/workspace/presence.js.map +1 -1
- package/dist/lib/workspace/shim-runner.js +23 -0
- package/dist/lib/workspace/shim-runner.js.map +1 -1
- package/package.json +70 -70
- package/skills/THIRD_PARTY_NOTICES.md +26 -26
- package/skills/architect/LICENSE +21 -21
- package/skills/codebase-design/LICENSE +21 -21
- package/skills/diagnosing-bugs/LICENSE +21 -21
- package/skills/domain-modeling/LICENSE +21 -21
- package/skills/improve-codebase-architecture/LICENSE +21 -21
- package/skills/recover/LICENSE +21 -21
- package/skills/review/LICENSE +21 -21
- package/skills/tdd/LICENSE +21 -21
- package/skills/teamshare-auth-rbac/SKILL.md +78 -78
- package/skills/teamshare-cdd/SKILL.md +205 -205
- package/skills/teamshare-modularity/SKILL.md +146 -146
- package/skills/teamshare-orchestrator-ask/SKILL.md +77 -77
- package/skills/teamshare-scaffold/SKILL.md +116 -116
- package/templates/backend/.env.example.tpl +13 -13
- package/templates/backend/nest-cli.json.tpl +8 -8
- package/templates/backend/package.json.tpl +41 -41
- package/templates/backend/prisma/schema.prisma.tpl +39 -39
- package/templates/backend/src/app.module.ts.tpl +24 -24
- package/templates/backend/src/common/filters/all-exceptions.filter.ts.tpl +59 -59
- package/templates/backend/src/common/guards/jwt-auth.guard.ts.tpl +27 -27
- package/templates/backend/src/common/guards/rbac.guard.ts.tpl +48 -48
- package/templates/backend/src/common/interceptors/transform.interceptor.ts.tpl +44 -44
- package/templates/backend/src/common/pipes/zod-validation.pipe.ts.tpl +29 -29
- package/templates/backend/src/common/swagger/envelope.schemas.ts.tpl +53 -53
- package/templates/backend/src/common/swagger/error.schemas.ts.tpl +62 -62
- package/templates/backend/src/main.ts.tpl +27 -27
- package/templates/backend/src/modules/example/example.controller.ts.tpl +102 -102
- package/templates/backend/src/modules/example/example.dto.ts.tpl +14 -14
- package/templates/backend/src/modules/example/example.module.ts.tpl +10 -10
- package/templates/backend/src/modules/example/example.service.ts.tpl +45 -45
- package/templates/backend/tsconfig.json.tpl +26 -26
- package/templates/common/.gitignore.tpl +42 -42
- package/templates/common/AGENTS.md.tpl +58 -58
- package/templates/common/docs/adr/README.md +25 -25
- package/templates/common/docs/api-contract.md.tpl +72 -72
- package/templates/web/next.config.ts.tpl +7 -7
- package/templates/web/package.json.tpl +37 -37
- package/templates/web/src/app/globals.css.tpl +48 -48
- package/templates/web/src/app/layout.tsx.tpl +25 -25
- package/templates/web/src/components/shared/app-button.tsx.tpl +59 -59
- package/templates/web/src/components/shared/app-empty-state.tsx.tpl +39 -39
- package/templates/web/src/components/shared/app-list-toolbar.tsx.tpl +63 -63
- package/templates/web/src/components/shared/app-skeleton.tsx.tpl +14 -14
- package/templates/web/src/components/shared/app-table.tsx.tpl +128 -128
- package/templates/web/src/components/shared/index.ts.tpl +5 -5
- package/templates/web/src/hooks/use-list-state.ts.tpl +72 -72
- package/templates/web/src/hooks/use-url-tab.ts.tpl +25 -25
- package/templates/web/src/lib/api/client.ts.tpl +123 -123
- package/templates/web/src/lib/providers.tsx.tpl +35 -35
- package/templates/web/src/lib/query-keys.ts.tpl +21 -21
- package/templates/web/src/lib/utils.ts.tpl +7 -7
- package/templates/web/src/lib/validation/schemas.ts.tpl +15 -15
- package/templates/web/src/modules/example/views/example-list-view.tsx.tpl +97 -97
- package/templates/web/tsconfig.json.tpl +23 -23
- package/tools/workspace-arbitration-check.mjs +389 -389
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: teamshare-modularity
|
|
3
|
-
description: Enforce TeamShare's modular architecture when writing code in teamshare-backend, frontend, teamshare-mobile-app or teamshare-bridge. Follow the per-repo layout (src/modules/<feature>/{controller,service,dto,module}, src/components/{ui,shared}, modules/<feature>/{views,components,columns,hooks,utils}, src/lib/api per feature), never import vendor ui/ in app code, use TS* wrappers, zod-first DTOs, the response envelope, and pass the repo build/typecheck gates before done.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# TeamShare Modular Architecture Enforcement
|
|
7
|
-
|
|
8
|
-
TeamShare is four separate repos with strict internal layouts. Before writing
|
|
9
|
-
code, check which repo you are in and follow its module structure exactly.
|
|
10
|
-
These rules are enforced per repo — know where you are.
|
|
11
|
-
|
|
12
|
-
## 1. teamshare-backend (NestJS + Prisma 6 + zod)
|
|
13
|
-
|
|
14
|
-
- **Layout:** a feature lives in `src/modules/<plural-feature>/` with
|
|
15
|
-
`<feature>.controller.ts`, `<feature>.service.ts`, `<feature>.dto.ts`,
|
|
16
|
-
`<feature>.module.ts` (+ `*.spec.ts`). Cross-cutting infra goes in
|
|
17
|
-
`src/common/<area>/` (constants, decorators, dto, filters, guards,
|
|
18
|
-
interceptors, pipes, prisma, utils, ...) — never inside a feature module.
|
|
19
|
-
- **DTOs are zod-first:** `export const CreateXSchema = z.object({...})` +
|
|
20
|
-
`export type CreateXDto = z.infer<typeof ...>`. Validate via
|
|
21
|
-
`@Body(new ZodValidationPipe(Schema))`. Import enum schemas from
|
|
22
|
-
`src/generated/zod/schemas/enums/...`; never hand-edit `src/generated/zod`.
|
|
23
|
-
- **Every endpoint returns the envelope** `{ success, data, pagination? }`
|
|
24
|
-
(TransformInterceptor) — handlers return raw data, lists return
|
|
25
|
-
`{ items, pagination }` via `computePagination`.
|
|
26
|
-
- **Every endpoint declares access metadata** (`@Permissions`, or
|
|
27
|
-
`@Public()` + `@UseGuards(AgentsDualAuthGuard)` + `@ApiKeyScopes` for the
|
|
28
|
-
agent+human surface) — see the teamshare-auth-rbac skill.
|
|
29
|
-
- **Prisma:** `prisma/schema.prisma` is the single source of truth. After a
|
|
30
|
-
schema change run `npx prisma generate` (do not hand-edit generated zod).
|
|
31
|
-
Deploy migrations with `npx prisma migrate deploy`, never `migrate dev`.
|
|
32
|
-
- **Error style:** throw exceptions with a machine-readable `code`
|
|
33
|
-
(`new BadRequestException({ code: 'X', message: '...' })`).
|
|
34
|
-
|
|
35
|
-
## 2. frontend (Next.js App Router + Tailwind v4 + TanStack Query)
|
|
36
|
-
|
|
37
|
-
- **Two component layers, never mixed:**
|
|
38
|
-
- `src/components/ui/` = VENDOR shadcn primitives — do not edit, do not
|
|
39
|
-
import from app code.
|
|
40
|
-
- `src/components/shared/` = TeamShare `TS*` wrappers. **App code imports
|
|
41
|
-
ONLY from `@/components/shared`** (barrel `index.ts`). Build new shared
|
|
42
|
-
components here, named `TS*`, with `data-slot="ts-*"` and `--ts-*` tokens.
|
|
43
|
-
- **Feature modules:** `src/modules/<feature>/{views,components,columns,hooks,utils}`.
|
|
44
|
-
Pages under `src/app/` stay thin and delegate to views. Route tabs use
|
|
45
|
-
`useUrlTab` (`?tab=...`).
|
|
46
|
-
- **API + data:** per-feature `src/lib/api/<feature>.ts` exporting a
|
|
47
|
-
`<feature>Api` object of `listX/getX/createX/updateX/deleteX`; envelope-aware
|
|
48
|
-
`apiFetch` from `@/lib/api/client`. Query keys via `qk.*` factory
|
|
49
|
-
(`src/lib/query-keys.ts`), list state via `useListState`.
|
|
50
|
-
- **Validation mirror:** zod schemas live in `src/lib/validation/schemas.ts`
|
|
51
|
-
and MIRROR the backend contract (backend is canonical). Enums derive from
|
|
52
|
-
the schemas in `src/lib/constants/enums.ts`.
|
|
53
|
-
- **Tables/forms:** TanStack React Table **v8** inside `TSTable`; forms always
|
|
54
|
-
`TSForm` + `TSFormField` + `zodResolver`.
|
|
55
|
-
- **IconSax hard rule:** `iconsax-react`, every icon passes `variant` AND
|
|
56
|
-
`color`; pick names from `docs/ui-style-guide.md` §6.4. No emoji as icons.
|
|
57
|
-
|
|
58
|
-
## 3. teamshare-mobile-app (Expo SDK 57 + NativeWind v4)
|
|
59
|
-
|
|
60
|
-
Same two-layer rule (`ui/` vendor vs `shared/` `TS*`), same zod schema
|
|
61
|
-
mirroring, same `modules/<feature>/` organization. Themexing via `--ts-*`
|
|
62
|
-
tokens; run `npx expo start --clear` when classes misbehave on Windows.
|
|
63
|
-
|
|
64
|
-
## 4. teamshare-bridge (plain CommonJS TypeScript)
|
|
65
|
-
|
|
66
|
-
- `src/lib/` = shared modules (plain exported functions + classes, named
|
|
67
|
-
exports, single quotes, JSDoc header naming the phase/IMP). `src/cli/` and
|
|
68
|
-
`src/bridge/` hold the two binaries' entry points. Custom `parseArgs`, no
|
|
69
|
-
arg libraries.
|
|
70
|
-
- **Best-effort by design:** heartbeats, closing comments, streaming, config
|
|
71
|
-
writes and lock release never throw; log with `console.warn`/empty catch.
|
|
72
|
-
Only the API client propagates errors (`ApiError`), with `msg()` for logs.
|
|
73
|
-
- Locks (`~/.teamshare/locks/<agentId>.lock`) gate every session; use
|
|
74
|
-
`acquireLock`/`releaseLock`; never bypass the wake queue.
|
|
75
|
-
- **Gates:** `npm run build` and `npm run typecheck` — `npm run lint` is
|
|
76
|
-
broken (eslint is not installed), do not rely on it.
|
|
77
|
-
|
|
78
|
-
## Cross-repo rules
|
|
79
|
-
|
|
80
|
-
- Backend schema is canonical; mirrors are for UX. A stale mirror is a bug.
|
|
81
|
-
- No new dependencies without a reason; prefer Node built-ins / existing libs.
|
|
82
|
-
- Commit per repo, never cross-commit.
|
|
83
|
-
|
|
84
|
-
## Git workflow (CRITICAL - read before any git operations)
|
|
85
|
-
|
|
86
|
-
> **The root directory is NOT a git repository.** Running `git add`, `git commit`,
|
|
87
|
-
> or `git push` from the root will fail with "not a git repository" errors.
|
|
88
|
-
|
|
89
|
-
### Rules for git operations
|
|
90
|
-
|
|
91
|
-
1. **Always `cd` into the app folder before git commands.** Example:
|
|
92
|
-
```bash
|
|
93
|
-
cd frontend && git add . && git commit -m "feat: add new component"
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
2. **When work crosses multiple repos, commit separately in each repo.** Example:
|
|
97
|
-
```bash
|
|
98
|
-
# Backend changes
|
|
99
|
-
cd teamshare-backend && git add . && git commit -m "feat: add API endpoint"
|
|
100
|
-
|
|
101
|
-
# Frontend changes
|
|
102
|
-
cd frontend && git add . && git commit -m "feat: consume new API"
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
3. **Never try to commit from the root directory.** It will fail.
|
|
106
|
-
|
|
107
|
-
4. **Use the `workdir` parameter in bash commands** to run git operations in the correct folder:
|
|
108
|
-
```bash
|
|
109
|
-
git add .
|
|
110
|
-
git commit -m "feat: description"
|
|
111
|
-
```
|
|
112
|
-
with `workdir` set to the app folder (e.g., `frontend/`).
|
|
113
|
-
|
|
114
|
-
5. **Branch naming:** use `teamshare/<taskId8>` format for task branches.
|
|
115
|
-
|
|
116
|
-
6. **One commit per logical change** in each repo. Don't mix unrelated changes.
|
|
117
|
-
|
|
118
|
-
### Multi-repo structure
|
|
119
|
-
|
|
120
|
-
| Path | Git repo name | Notes |
|
|
121
|
-
|---|---|---|
|
|
122
|
-
| `frontend/` | `teamshare-frontend` | Next.js web app |
|
|
123
|
-
| `teamshare-backend/` | `teamshare-backend` | NestJS API |
|
|
124
|
-
| `teamshare-mobile-app/` | `teamshare-mobile-app` | Expo mobile app |
|
|
125
|
-
| `teamshare-bridge/` | `teamshare-bridge` | Agent bridge/CLI |
|
|
126
|
-
|
|
127
|
-
### Cross-repo workflow example
|
|
128
|
-
|
|
129
|
-
When a task requires changes in both backend and frontend:
|
|
130
|
-
|
|
131
|
-
```
|
|
132
|
-
1. Make backend changes in teamshare-backend/
|
|
133
|
-
2. cd teamshare-backend && git add . && git commit -m "feat: add X endpoint"
|
|
134
|
-
3. Make frontend changes in frontend/
|
|
135
|
-
4. cd frontend && git add . && git commit -m "feat: consume X endpoint"
|
|
136
|
-
5. Push each repo separately: git push origin teamshare/<branch>
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
## Pre-done checklist (all must pass)
|
|
140
|
-
|
|
141
|
-
- [ ] Backend: `npm run build` green; eslint clean on the files you touched.
|
|
142
|
-
- [ ] Backend: zod-first DTO + `ZodValidationPipe` on every new endpoint.
|
|
143
|
-
- [ ] Backend: envelope + pagination + access metadata on every endpoint.
|
|
144
|
-
- [ ] Frontend/mobile: imports only from `@/components/shared`; `TS*` used.
|
|
145
|
-
- [ ] Frontend/mobile: `npm run build` (web) / `npx expo export` (mobile) green.
|
|
146
|
-
- [ ] Bridge: `npm run build` + `npm run typecheck` green.
|
|
1
|
+
---
|
|
2
|
+
name: teamshare-modularity
|
|
3
|
+
description: Enforce TeamShare's modular architecture when writing code in teamshare-backend, frontend, teamshare-mobile-app or teamshare-bridge. Follow the per-repo layout (src/modules/<feature>/{controller,service,dto,module}, src/components/{ui,shared}, modules/<feature>/{views,components,columns,hooks,utils}, src/lib/api per feature), never import vendor ui/ in app code, use TS* wrappers, zod-first DTOs, the response envelope, and pass the repo build/typecheck gates before done.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# TeamShare Modular Architecture Enforcement
|
|
7
|
+
|
|
8
|
+
TeamShare is four separate repos with strict internal layouts. Before writing
|
|
9
|
+
code, check which repo you are in and follow its module structure exactly.
|
|
10
|
+
These rules are enforced per repo — know where you are.
|
|
11
|
+
|
|
12
|
+
## 1. teamshare-backend (NestJS + Prisma 6 + zod)
|
|
13
|
+
|
|
14
|
+
- **Layout:** a feature lives in `src/modules/<plural-feature>/` with
|
|
15
|
+
`<feature>.controller.ts`, `<feature>.service.ts`, `<feature>.dto.ts`,
|
|
16
|
+
`<feature>.module.ts` (+ `*.spec.ts`). Cross-cutting infra goes in
|
|
17
|
+
`src/common/<area>/` (constants, decorators, dto, filters, guards,
|
|
18
|
+
interceptors, pipes, prisma, utils, ...) — never inside a feature module.
|
|
19
|
+
- **DTOs are zod-first:** `export const CreateXSchema = z.object({...})` +
|
|
20
|
+
`export type CreateXDto = z.infer<typeof ...>`. Validate via
|
|
21
|
+
`@Body(new ZodValidationPipe(Schema))`. Import enum schemas from
|
|
22
|
+
`src/generated/zod/schemas/enums/...`; never hand-edit `src/generated/zod`.
|
|
23
|
+
- **Every endpoint returns the envelope** `{ success, data, pagination? }`
|
|
24
|
+
(TransformInterceptor) — handlers return raw data, lists return
|
|
25
|
+
`{ items, pagination }` via `computePagination`.
|
|
26
|
+
- **Every endpoint declares access metadata** (`@Permissions`, or
|
|
27
|
+
`@Public()` + `@UseGuards(AgentsDualAuthGuard)` + `@ApiKeyScopes` for the
|
|
28
|
+
agent+human surface) — see the teamshare-auth-rbac skill.
|
|
29
|
+
- **Prisma:** `prisma/schema.prisma` is the single source of truth. After a
|
|
30
|
+
schema change run `npx prisma generate` (do not hand-edit generated zod).
|
|
31
|
+
Deploy migrations with `npx prisma migrate deploy`, never `migrate dev`.
|
|
32
|
+
- **Error style:** throw exceptions with a machine-readable `code`
|
|
33
|
+
(`new BadRequestException({ code: 'X', message: '...' })`).
|
|
34
|
+
|
|
35
|
+
## 2. frontend (Next.js App Router + Tailwind v4 + TanStack Query)
|
|
36
|
+
|
|
37
|
+
- **Two component layers, never mixed:**
|
|
38
|
+
- `src/components/ui/` = VENDOR shadcn primitives — do not edit, do not
|
|
39
|
+
import from app code.
|
|
40
|
+
- `src/components/shared/` = TeamShare `TS*` wrappers. **App code imports
|
|
41
|
+
ONLY from `@/components/shared`** (barrel `index.ts`). Build new shared
|
|
42
|
+
components here, named `TS*`, with `data-slot="ts-*"` and `--ts-*` tokens.
|
|
43
|
+
- **Feature modules:** `src/modules/<feature>/{views,components,columns,hooks,utils}`.
|
|
44
|
+
Pages under `src/app/` stay thin and delegate to views. Route tabs use
|
|
45
|
+
`useUrlTab` (`?tab=...`).
|
|
46
|
+
- **API + data:** per-feature `src/lib/api/<feature>.ts` exporting a
|
|
47
|
+
`<feature>Api` object of `listX/getX/createX/updateX/deleteX`; envelope-aware
|
|
48
|
+
`apiFetch` from `@/lib/api/client`. Query keys via `qk.*` factory
|
|
49
|
+
(`src/lib/query-keys.ts`), list state via `useListState`.
|
|
50
|
+
- **Validation mirror:** zod schemas live in `src/lib/validation/schemas.ts`
|
|
51
|
+
and MIRROR the backend contract (backend is canonical). Enums derive from
|
|
52
|
+
the schemas in `src/lib/constants/enums.ts`.
|
|
53
|
+
- **Tables/forms:** TanStack React Table **v8** inside `TSTable`; forms always
|
|
54
|
+
`TSForm` + `TSFormField` + `zodResolver`.
|
|
55
|
+
- **IconSax hard rule:** `iconsax-react`, every icon passes `variant` AND
|
|
56
|
+
`color`; pick names from `docs/ui-style-guide.md` §6.4. No emoji as icons.
|
|
57
|
+
|
|
58
|
+
## 3. teamshare-mobile-app (Expo SDK 57 + NativeWind v4)
|
|
59
|
+
|
|
60
|
+
Same two-layer rule (`ui/` vendor vs `shared/` `TS*`), same zod schema
|
|
61
|
+
mirroring, same `modules/<feature>/` organization. Themexing via `--ts-*`
|
|
62
|
+
tokens; run `npx expo start --clear` when classes misbehave on Windows.
|
|
63
|
+
|
|
64
|
+
## 4. teamshare-bridge (plain CommonJS TypeScript)
|
|
65
|
+
|
|
66
|
+
- `src/lib/` = shared modules (plain exported functions + classes, named
|
|
67
|
+
exports, single quotes, JSDoc header naming the phase/IMP). `src/cli/` and
|
|
68
|
+
`src/bridge/` hold the two binaries' entry points. Custom `parseArgs`, no
|
|
69
|
+
arg libraries.
|
|
70
|
+
- **Best-effort by design:** heartbeats, closing comments, streaming, config
|
|
71
|
+
writes and lock release never throw; log with `console.warn`/empty catch.
|
|
72
|
+
Only the API client propagates errors (`ApiError`), with `msg()` for logs.
|
|
73
|
+
- Locks (`~/.teamshare/locks/<agentId>.lock`) gate every session; use
|
|
74
|
+
`acquireLock`/`releaseLock`; never bypass the wake queue.
|
|
75
|
+
- **Gates:** `npm run build` and `npm run typecheck` — `npm run lint` is
|
|
76
|
+
broken (eslint is not installed), do not rely on it.
|
|
77
|
+
|
|
78
|
+
## Cross-repo rules
|
|
79
|
+
|
|
80
|
+
- Backend schema is canonical; mirrors are for UX. A stale mirror is a bug.
|
|
81
|
+
- No new dependencies without a reason; prefer Node built-ins / existing libs.
|
|
82
|
+
- Commit per repo, never cross-commit.
|
|
83
|
+
|
|
84
|
+
## Git workflow (CRITICAL - read before any git operations)
|
|
85
|
+
|
|
86
|
+
> **The root directory is NOT a git repository.** Running `git add`, `git commit`,
|
|
87
|
+
> or `git push` from the root will fail with "not a git repository" errors.
|
|
88
|
+
|
|
89
|
+
### Rules for git operations
|
|
90
|
+
|
|
91
|
+
1. **Always `cd` into the app folder before git commands.** Example:
|
|
92
|
+
```bash
|
|
93
|
+
cd frontend && git add . && git commit -m "feat: add new component"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
2. **When work crosses multiple repos, commit separately in each repo.** Example:
|
|
97
|
+
```bash
|
|
98
|
+
# Backend changes
|
|
99
|
+
cd teamshare-backend && git add . && git commit -m "feat: add API endpoint"
|
|
100
|
+
|
|
101
|
+
# Frontend changes
|
|
102
|
+
cd frontend && git add . && git commit -m "feat: consume new API"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
3. **Never try to commit from the root directory.** It will fail.
|
|
106
|
+
|
|
107
|
+
4. **Use the `workdir` parameter in bash commands** to run git operations in the correct folder:
|
|
108
|
+
```bash
|
|
109
|
+
git add .
|
|
110
|
+
git commit -m "feat: description"
|
|
111
|
+
```
|
|
112
|
+
with `workdir` set to the app folder (e.g., `frontend/`).
|
|
113
|
+
|
|
114
|
+
5. **Branch naming:** use `teamshare/<taskId8>` format for task branches.
|
|
115
|
+
|
|
116
|
+
6. **One commit per logical change** in each repo. Don't mix unrelated changes.
|
|
117
|
+
|
|
118
|
+
### Multi-repo structure
|
|
119
|
+
|
|
120
|
+
| Path | Git repo name | Notes |
|
|
121
|
+
|---|---|---|
|
|
122
|
+
| `frontend/` | `teamshare-frontend` | Next.js web app |
|
|
123
|
+
| `teamshare-backend/` | `teamshare-backend` | NestJS API |
|
|
124
|
+
| `teamshare-mobile-app/` | `teamshare-mobile-app` | Expo mobile app |
|
|
125
|
+
| `teamshare-bridge/` | `teamshare-bridge` | Agent bridge/CLI |
|
|
126
|
+
|
|
127
|
+
### Cross-repo workflow example
|
|
128
|
+
|
|
129
|
+
When a task requires changes in both backend and frontend:
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
1. Make backend changes in teamshare-backend/
|
|
133
|
+
2. cd teamshare-backend && git add . && git commit -m "feat: add X endpoint"
|
|
134
|
+
3. Make frontend changes in frontend/
|
|
135
|
+
4. cd frontend && git add . && git commit -m "feat: consume X endpoint"
|
|
136
|
+
5. Push each repo separately: git push origin teamshare/<branch>
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Pre-done checklist (all must pass)
|
|
140
|
+
|
|
141
|
+
- [ ] Backend: `npm run build` green; eslint clean on the files you touched.
|
|
142
|
+
- [ ] Backend: zod-first DTO + `ZodValidationPipe` on every new endpoint.
|
|
143
|
+
- [ ] Backend: envelope + pagination + access metadata on every endpoint.
|
|
144
|
+
- [ ] Frontend/mobile: imports only from `@/components/shared`; `TS*` used.
|
|
145
|
+
- [ ] Frontend/mobile: `npm run build` (web) / `npx expo export` (mobile) green.
|
|
146
|
+
- [ ] Bridge: `npm run build` + `npm run typecheck` green.
|
|
147
147
|
- [ ] No generated files hand-edited; no secrets committed.
|
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: teamshare-orchestrator-ask
|
|
3
|
-
description: When to pause and ask human questions during orchestrator-driven builds. Covers ask_human/wait_for_answer MCP tools, orchestrator question_pending lifecycle, conflict resolution, and when to ask vs. when to decide autonomously.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# TeamShare Orchestrator Ask-Human
|
|
7
|
-
|
|
8
|
-
You are working an orchestrator-dispatched task in a TeamShare project.
|
|
9
|
-
The orchestrator manages your task lifecycle: plan -> dispatch -> work ->
|
|
10
|
-
verify -> merge. Sometimes you need human input before continuing.
|
|
11
|
-
|
|
12
|
-
## When to ask
|
|
13
|
-
|
|
14
|
-
- Ambiguous requirements (task description has multiple valid interpretations)
|
|
15
|
-
- Conflicting acceptance criteria
|
|
16
|
-
- Missing environment info (secrets, URLs, credentials not in env vars)
|
|
17
|
-
- Architecture decisions not covered by the plan
|
|
18
|
-
- Git conflicts that need human resolution
|
|
19
|
-
- Scope questions (task is larger/smaller than expected)
|
|
20
|
-
|
|
21
|
-
## When NOT to ask
|
|
22
|
-
|
|
23
|
-
- Something you can resolve from the project docs
|
|
24
|
-
- A preference that has a reasonable default
|
|
25
|
-
- Something the PRD already specifies
|
|
26
|
-
- Style/formatting choices (follow the codebase conventions)
|
|
27
|
-
|
|
28
|
-
## How to ask
|
|
29
|
-
|
|
30
|
-
1. Call `ask_human` MCP tool with:
|
|
31
|
-
- `taskId`: your current task ID
|
|
32
|
-
- `question`: clear, specific question with context
|
|
33
|
-
- `choices`: numbered options when applicable
|
|
34
|
-
- `mentionNames`: humans to notify (optional)
|
|
35
|
-
|
|
36
|
-
2. Call `wait_for_answer` immediately after -- it returns `{ pending: true }`
|
|
37
|
-
and you go to sleep.
|
|
38
|
-
|
|
39
|
-
3. You will be woken by a `question.answered` event when the human responds.
|
|
40
|
-
|
|
41
|
-
## Orchestrator lifecycle
|
|
42
|
-
|
|
43
|
-
When you call `ask_human`:
|
|
44
|
-
- Your orchestrator task transitions to `question_pending`
|
|
45
|
-
- The orchestrator stops sweeping your task (no capacity consumed)
|
|
46
|
-
- When the human answers, your task transitions back to `queued`
|
|
47
|
-
- The next sweep re-dispatches your task with the answer context
|
|
48
|
-
|
|
49
|
-
## Conflict resolution
|
|
50
|
-
|
|
51
|
-
When two agents disagree on approach:
|
|
52
|
-
- Both call `ask_human` with their recommended approach
|
|
53
|
-
- The human resolves via task comments or #agent-questions chat
|
|
54
|
-
- Both agents are woken with `question.answered`
|
|
55
|
-
- The losing agent adapts to the human's decision
|
|
56
|
-
|
|
57
|
-
## Two-surface answering
|
|
58
|
-
|
|
59
|
-
Humans can answer from two places:
|
|
60
|
-
1. **Task comment thread**: reply directly on the task page
|
|
61
|
-
2. **#agent-questions chat**: answer in the project's agent-questions channel
|
|
62
|
-
|
|
63
|
-
Both surfaces trigger the same `question.answered` wake event.
|
|
64
|
-
|
|
65
|
-
## Merge conflicts (IMP-810)
|
|
66
|
-
|
|
67
|
-
When two agents edit the same file and their branches conflict during merge:
|
|
68
|
-
1. The orchestrator blocks the task (`status: 'blocked'`, `workerStatus: 'blocked'`)
|
|
69
|
-
2. A `[question]` comment is posted on the linked task listing the conflicting files
|
|
70
|
-
3. The OT transitions to `question_pending`
|
|
71
|
-
4. A human resolves the conflicts (manually or by telling an agent what to do)
|
|
72
|
-
5. When the question is answered, the OT requeues and the worker retries
|
|
73
|
-
|
|
74
|
-
If you are the worker agent and see a merge conflict:
|
|
75
|
-
- Do NOT force-push or overwrite the integration branch
|
|
76
|
-
- Wait for the human to resolve or give you instructions
|
|
77
|
-
- When re-dispatched, pull the latest integration branch and re-apply your changes
|
|
1
|
+
---
|
|
2
|
+
name: teamshare-orchestrator-ask
|
|
3
|
+
description: When to pause and ask human questions during orchestrator-driven builds. Covers ask_human/wait_for_answer MCP tools, orchestrator question_pending lifecycle, conflict resolution, and when to ask vs. when to decide autonomously.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# TeamShare Orchestrator Ask-Human
|
|
7
|
+
|
|
8
|
+
You are working an orchestrator-dispatched task in a TeamShare project.
|
|
9
|
+
The orchestrator manages your task lifecycle: plan -> dispatch -> work ->
|
|
10
|
+
verify -> merge. Sometimes you need human input before continuing.
|
|
11
|
+
|
|
12
|
+
## When to ask
|
|
13
|
+
|
|
14
|
+
- Ambiguous requirements (task description has multiple valid interpretations)
|
|
15
|
+
- Conflicting acceptance criteria
|
|
16
|
+
- Missing environment info (secrets, URLs, credentials not in env vars)
|
|
17
|
+
- Architecture decisions not covered by the plan
|
|
18
|
+
- Git conflicts that need human resolution
|
|
19
|
+
- Scope questions (task is larger/smaller than expected)
|
|
20
|
+
|
|
21
|
+
## When NOT to ask
|
|
22
|
+
|
|
23
|
+
- Something you can resolve from the project docs
|
|
24
|
+
- A preference that has a reasonable default
|
|
25
|
+
- Something the PRD already specifies
|
|
26
|
+
- Style/formatting choices (follow the codebase conventions)
|
|
27
|
+
|
|
28
|
+
## How to ask
|
|
29
|
+
|
|
30
|
+
1. Call `ask_human` MCP tool with:
|
|
31
|
+
- `taskId`: your current task ID
|
|
32
|
+
- `question`: clear, specific question with context
|
|
33
|
+
- `choices`: numbered options when applicable
|
|
34
|
+
- `mentionNames`: humans to notify (optional)
|
|
35
|
+
|
|
36
|
+
2. Call `wait_for_answer` immediately after -- it returns `{ pending: true }`
|
|
37
|
+
and you go to sleep.
|
|
38
|
+
|
|
39
|
+
3. You will be woken by a `question.answered` event when the human responds.
|
|
40
|
+
|
|
41
|
+
## Orchestrator lifecycle
|
|
42
|
+
|
|
43
|
+
When you call `ask_human`:
|
|
44
|
+
- Your orchestrator task transitions to `question_pending`
|
|
45
|
+
- The orchestrator stops sweeping your task (no capacity consumed)
|
|
46
|
+
- When the human answers, your task transitions back to `queued`
|
|
47
|
+
- The next sweep re-dispatches your task with the answer context
|
|
48
|
+
|
|
49
|
+
## Conflict resolution
|
|
50
|
+
|
|
51
|
+
When two agents disagree on approach:
|
|
52
|
+
- Both call `ask_human` with their recommended approach
|
|
53
|
+
- The human resolves via task comments or #agent-questions chat
|
|
54
|
+
- Both agents are woken with `question.answered`
|
|
55
|
+
- The losing agent adapts to the human's decision
|
|
56
|
+
|
|
57
|
+
## Two-surface answering
|
|
58
|
+
|
|
59
|
+
Humans can answer from two places:
|
|
60
|
+
1. **Task comment thread**: reply directly on the task page
|
|
61
|
+
2. **#agent-questions chat**: answer in the project's agent-questions channel
|
|
62
|
+
|
|
63
|
+
Both surfaces trigger the same `question.answered` wake event.
|
|
64
|
+
|
|
65
|
+
## Merge conflicts (IMP-810)
|
|
66
|
+
|
|
67
|
+
When two agents edit the same file and their branches conflict during merge:
|
|
68
|
+
1. The orchestrator blocks the task (`status: 'blocked'`, `workerStatus: 'blocked'`)
|
|
69
|
+
2. A `[question]` comment is posted on the linked task listing the conflicting files
|
|
70
|
+
3. The OT transitions to `question_pending`
|
|
71
|
+
4. A human resolves the conflicts (manually or by telling an agent what to do)
|
|
72
|
+
5. When the question is answered, the OT requeues and the worker retries
|
|
73
|
+
|
|
74
|
+
If you are the worker agent and see a merge conflict:
|
|
75
|
+
- Do NOT force-push or overwrite the integration branch
|
|
76
|
+
- Wait for the human to resolve or give you instructions
|
|
77
|
+
- When re-dispatched, pull the latest integration branch and re-apply your changes
|