@openora/create 0.4.1-canary.45 → 0.4.1-canary.450
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 +5 -5
- package/dist/.tsbuildinfo +1 -1
- package/dist/generated/versions.d.ts +11 -0
- package/dist/generated/versions.d.ts.map +1 -0
- package/dist/generated/versions.js +11 -0
- package/dist/generated/versions.js.map +1 -0
- package/dist/index.js +50 -96
- package/dist/index.js.map +1 -1
- package/dist/render.d.ts +12 -0
- package/dist/render.d.ts.map +1 -0
- package/dist/render.js +125 -0
- package/dist/render.js.map +1 -0
- package/package.json +8 -6
- package/template/Caddyfile +13 -0
- package/template/Dockerfile +11 -0
- package/template/README.md.tpl +45 -10
- package/template/__dot__claude/settings.json.tpl +39 -12
- package/template/__dot__dockerignore +8 -0
- package/template/__dot__env.example +51 -2
- package/template/__dot__gitignore +5 -5
- package/template/__dot__rulesync/commands/check.md +11 -10
- package/template/__dot__rulesync/commands/doctor.md.tpl +17 -0
- package/template/__dot__rulesync/commands/scaffold-module.md +3 -2
- package/template/__dot__rulesync/commands/scaffold-plugin.md +23 -4
- package/template/__dot__rulesync/commands/scaffold-route.md +1 -0
- package/template/__dot__rulesync/commands/start.md +3 -3
- package/template/__dot__rulesync/hooks/_shared.mjs +25 -34
- package/template/__dot__rulesync/hooks/guard-comments.mjs +82 -0
- package/template/__dot__rulesync/hooks/guard-core.mjs.tpl +98 -28
- package/template/__dot__rulesync/hooks/guard-generated.mjs +15 -16
- package/template/__dot__rulesync/hooks/guard-mr.mjs +199 -0
- package/template/__dot__rulesync/hooks/guard-review.mjs +294 -0
- package/template/__dot__rulesync/hooks/guard-stack.mjs +35 -0
- package/template/__dot__rulesync/hooks/guard-subagent.mjs +22 -6
- package/template/__dot__rulesync/hooks/post-edit.mjs.tpl +116 -0
- package/template/__dot__rulesync/hooks.json +42 -4
- package/template/__dot__rulesync/rules/conventions.md +100 -119
- package/template/__dot__rulesync/rules/db-conventions.md +6 -72
- package/template/__dot__rulesync/rules/e2e-conventions.md +41 -7
- package/template/__dot__rulesync/rules/frontend-conventions.md.tpl +35 -0
- package/template/__dot__rulesync/rules/oss-boundaries.md.tpl +78 -0
- package/template/__dot__rulesync/rules/overview.md +20 -82
- package/template/__dot__rulesync/skills/agent-retro/SKILL.md.tpl +81 -0
- package/template/__dot__rulesync/skills/agent-retro/scan.mjs +420 -0
- package/template/__dot__rulesync/skills/babysit/SKILL.md.tpl +48 -0
- package/template/__dot__rulesync/skills/babysit/babysit.mjs +290 -0
- package/template/__dot__rulesync/skills/create-plugin/{SKILL.md → SKILL.md.tpl} +12 -23
- package/template/__dot__rulesync/skills/create-pr/SKILL.md.tpl +39 -0
- package/template/__dot__rulesync/skills/create-task/SKILL.md.tpl +96 -0
- package/template/__dot__rulesync/skills/create-ui-module/{SKILL.md → SKILL.md.tpl} +12 -10
- package/template/__dot__rulesync/skills/enhance-prompt/{SKILL.md → SKILL.md.tpl} +4 -4
- package/template/__dot__rulesync/skills/handoff/SKILL.md +4 -3
- package/template/__dot__rulesync/skills/review/SKILL.md.tpl +276 -0
- package/template/__dot__rulesync/skills/ship/SKILL.md.tpl +157 -0
- package/template/__dot__rulesync/skills/ship/handoff.md.tpl +48 -0
- package/template/__dot__rulesync/skills/ui-verify/SKILL.md.tpl +123 -0
- package/template/__dot__rulesync/skills/ui-verify/layout-check.check.sh +58 -0
- package/template/__dot__rulesync/skills/ui-verify/layout-check.js +163 -0
- package/template/__dot__rulesync/subagents/builder.md.tpl +116 -0
- package/template/__dot__rulesync/subagents/compliance-reviewer.md +78 -0
- package/template/__dot__rulesync/subagents/debugger.md.tpl +89 -0
- package/template/__dot__rulesync/subagents/deployer.md.tpl +54 -0
- package/template/__dot__rulesync/subagents/expert.md +29 -34
- package/template/__dot__rulesync/subagents/planner.md.tpl +47 -0
- package/template/__dot__rulesync/subagents/quality-reviewer.md.tpl +113 -0
- package/template/__dot__rulesync/subagents/security-reviewer.md.tpl +85 -0
- package/template/__dot__rulesync/subagents/tester.md.tpl +103 -0
- package/template/__dot__rulesync/sync.json.tpl +26 -0
- package/template/apps/api/package.json.tpl +2 -2
- package/template/apps/api/src/extensions.config.ts.tpl +17 -2
- package/template/apps/api/src/main.ts.tpl +5 -4
- package/template/apps/api/src/seed.ts.tpl +24 -18
- package/template/compose.prod.yml +109 -0
- package/template/docker-compose.yml +15 -3
- package/template/docs/agents/cross-repo.md.tpl +36 -0
- package/template/docs/agents/forge.md.tpl +56 -0
- package/template/docs/agents/issue-tracker.md.tpl +42 -0
- package/template/docs/standards/comments.md +16 -0
- package/template/docs/standards/database.md +77 -0
- package/template/docs/standards/enforcement.md +12 -0
- package/template/docs/standards/errors.md +30 -0
- package/template/docs/standards/frontend.md +60 -0
- package/template/docs/standards/functions.md +38 -0
- package/template/docs/standards/git-delivery.md +31 -0
- package/template/docs/standards/module-structure.md +37 -0
- package/template/docs/standards/testing.md +93 -0
- package/template/docs/standards/types.md +31 -0
- package/template/package.json.tpl +17 -10
- package/template/pnpm-workspace.yaml.tpl +6 -0
- package/template/rulesync.jsonc +4 -5
- package/template/tools/bootstrap.mjs +73 -0
- package/template/tools/oss-worktree.mjs.tpl +105 -0
- package/template/tools/review-precheck.mjs +622 -0
- package/template/tools/sync-agents.mjs +279 -0
- package/dist/generated/core-version.d.ts +0 -2
- package/dist/generated/core-version.d.ts.map +0 -1
- package/dist/generated/core-version.js +0 -2
- package/dist/generated/core-version.js.map +0 -1
- package/template/__dot__rulesync/commands/doctor.md +0 -16
- package/template/__dot__rulesync/hooks/post-edit.mjs +0 -57
- package/template/__dot__rulesync/rules/oss-boundaries.md +0 -31
- package/template/__dot__rulesync/skills/add-feature/SKILL.md +0 -113
- package/template/__dot__rulesync/skills/add-feature/handoff.md +0 -58
- package/template/__dot__rulesync/skills/create-pr/SKILL.md +0 -55
- package/template/__dot__rulesync/skills/create-task/SKILL.md +0 -77
- package/template/__dot__rulesync/skills/review/SKILL.md +0 -110
- package/template/__dot__rulesync/subagents/builder.md +0 -93
- package/template/__dot__rulesync/subagents/debugger.md +0 -82
- package/template/__dot__rulesync/subagents/deployer.md +0 -66
- package/template/__dot__rulesync/subagents/qa.md +0 -88
- package/template/__dot__rulesync/subagents/quality-reviewer.md +0 -67
- package/template/__dot__rulesync/subagents/security-reviewer.md +0 -54
package/dist/render.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { basename, dirname, join, relative, sep } from 'node:path';
|
|
3
|
+
const MCP_COMMAND = 'node';
|
|
4
|
+
const MCP_ARGS = ['node_modules/@openora/mcp/dist/main.js'];
|
|
5
|
+
const SKIPPED_BASENAMES = new Set();
|
|
6
|
+
const USAGE = 'Usage: npm create @openora <target-dir> [--name <name>] [--no-telemetry]';
|
|
7
|
+
function readFlag(args, index) {
|
|
8
|
+
const arg = args[index] ?? '';
|
|
9
|
+
const eq = arg.indexOf('=');
|
|
10
|
+
if (eq !== -1) {
|
|
11
|
+
return { value: arg.slice(eq + 1), next: index };
|
|
12
|
+
}
|
|
13
|
+
return { value: args[index + 1], next: index + 1 };
|
|
14
|
+
}
|
|
15
|
+
export function parseArgs(argv) {
|
|
16
|
+
const args = argv.slice(2);
|
|
17
|
+
let target;
|
|
18
|
+
let name;
|
|
19
|
+
let telemetry = true;
|
|
20
|
+
for (let i = 0; i < args.length; i++) {
|
|
21
|
+
const arg = args[i];
|
|
22
|
+
if (arg === undefined) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (arg === '--name' || arg.startsWith('--name=')) {
|
|
26
|
+
const flag = readFlag(args, i);
|
|
27
|
+
name = flag.value;
|
|
28
|
+
i = flag.next;
|
|
29
|
+
}
|
|
30
|
+
else if (arg === '--no-telemetry') {
|
|
31
|
+
telemetry = false;
|
|
32
|
+
}
|
|
33
|
+
else if (!arg.startsWith('-') && !target) {
|
|
34
|
+
target = arg;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (!target) {
|
|
38
|
+
throw new Error(`missing target directory.\n ${USAGE}`);
|
|
39
|
+
}
|
|
40
|
+
return name === undefined ? { target, telemetry } : { target, name, telemetry };
|
|
41
|
+
}
|
|
42
|
+
function isSet(flag) {
|
|
43
|
+
return flag !== undefined && ['1', 'true', 'yes'].includes(flag.trim().toLowerCase());
|
|
44
|
+
}
|
|
45
|
+
// Mirrors `isTelemetryEnabled` in core's server/runtime/telemetry.ts; change both together.
|
|
46
|
+
export function isTelemetryEnabled(telemetry, env) {
|
|
47
|
+
return (telemetry &&
|
|
48
|
+
!isSet(env['OPENORA_TELEMETRY_DISABLED']) &&
|
|
49
|
+
!isSet(env['DO_NOT_TRACK']) &&
|
|
50
|
+
env['CI'] === undefined &&
|
|
51
|
+
env['NODE_ENV'] !== 'test');
|
|
52
|
+
}
|
|
53
|
+
export function sanitizeName(raw) {
|
|
54
|
+
return (raw
|
|
55
|
+
.toLowerCase()
|
|
56
|
+
.replace(/[^a-z0-9-_]/g, '-')
|
|
57
|
+
.replace(/^-+|-+$/g, '') || 'igaming-app');
|
|
58
|
+
}
|
|
59
|
+
export function posix(path) {
|
|
60
|
+
return path.split(sep).join('/');
|
|
61
|
+
}
|
|
62
|
+
function substitute(content, vars) {
|
|
63
|
+
return content.replace(/\{\{(\w+)\}\}/g, (match, key) => {
|
|
64
|
+
const value = vars[key];
|
|
65
|
+
return value === undefined ? match : value;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function walk(dir) {
|
|
69
|
+
const out = [];
|
|
70
|
+
for (const entry of readdirSync(dir)) {
|
|
71
|
+
const full = join(dir, entry);
|
|
72
|
+
if (statSync(full).isDirectory()) {
|
|
73
|
+
out.push(...walk(full));
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
out.push(full);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return out;
|
|
80
|
+
}
|
|
81
|
+
function undotSegment(segment) {
|
|
82
|
+
return segment.startsWith('__dot__') ? `.${segment.slice('__dot__'.length)}` : segment;
|
|
83
|
+
}
|
|
84
|
+
function outputPath(templateRel) {
|
|
85
|
+
const mapped = templateRel.split(sep).map(undotSegment).join(sep);
|
|
86
|
+
return mapped.endsWith('.tpl') ? mapped.slice(0, -'.tpl'.length) : mapped;
|
|
87
|
+
}
|
|
88
|
+
export function emitTree(srcRoot, vars, targetDir) {
|
|
89
|
+
for (const file of walk(srcRoot)) {
|
|
90
|
+
if (SKIPPED_BASENAMES.has(basename(file))) {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
const outRel = outputPath(relative(srcRoot, file));
|
|
94
|
+
const raw = readFileSync(file, 'utf8');
|
|
95
|
+
const content = file.endsWith('.tpl') ? substitute(raw, vars) : raw;
|
|
96
|
+
const outPath = join(targetDir, outRel);
|
|
97
|
+
mkdirSync(dirname(outPath), { recursive: true });
|
|
98
|
+
writeFileSync(outPath, content);
|
|
99
|
+
console.log(` + ${posix(outRel)}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
// Operator coordinates the agent files reference. A fresh scaffold gets placeholders;
|
|
103
|
+
// the consumer fills them in once in .rulesync/sync.json and `pnpm sync:agents`
|
|
104
|
+
// re-renders every template-owned file from them.
|
|
105
|
+
export function buildVars(name, versions) {
|
|
106
|
+
return {
|
|
107
|
+
name,
|
|
108
|
+
...versions,
|
|
109
|
+
mcpCommand: MCP_COMMAND,
|
|
110
|
+
mcpArgsJson: JSON.stringify(MCP_ARGS),
|
|
111
|
+
scope: `@${name}`,
|
|
112
|
+
trackerKey: 'KEY',
|
|
113
|
+
jiraSite: '<your-site>.atlassian.net',
|
|
114
|
+
jiraCloudId: '<your-jira-cloud-id>',
|
|
115
|
+
wikiSpace: '<your-wiki-space>',
|
|
116
|
+
teamChannel: '#<your-team-channel>',
|
|
117
|
+
gitRemotePath: '<group>/<repo>',
|
|
118
|
+
ossDir: '../openora',
|
|
119
|
+
// Only meaningful once the consumer links a local platform checkout; until then the
|
|
120
|
+
// guard-core hook simply never matches.
|
|
121
|
+
ossFromRoot: '../openora',
|
|
122
|
+
mrTarget: 'dev',
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEnE,MAAM,WAAW,GAAG,MAAM,CAAC;AAC3B,MAAM,QAAQ,GAAG,CAAC,wCAAwC,CAAC,CAAC;AAC5D,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAE,CAAC;AAQpC,MAAM,KAAK,GAAG,0EAA0E,CAAC;AAEzF,SAAS,QAAQ,CAAC,IAAc,EAAE,KAAa;IAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;IAC9B,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;QACd,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACnD,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC;AACrD,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAc;IACtC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,IAAI,MAA0B,CAAC;IAC/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AM,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QACxC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACjD,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAChC,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IACtC,CAAC;AACH,CAAC;AAED,sFAAsF;AACtF,gFAAgF;AAChF,kDAAkD;AAClD,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,QAAgC;IACtE,OAAO;QACL,IAAI;QACJ,GAAG,QAAQ;QACX,UAAU,EAAE,WAAW;QACvB,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;QACrC,KAAK,EAAE,IAAI,IAAI,EAAE;QACjB,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,2BAA2B;QACrC,WAAW,EAAE,sBAAsB;QACnC,SAAS,EAAE,mBAAmB;QAC9B,WAAW,EAAE,sBAAsB;QACnC,aAAa,EAAE,gBAAgB;QAC/B,MAAM,EAAE,YAAY;QACpB,oFAAoF;QACpF,wCAAwC;QACxC,WAAW,EAAE,YAAY;QACzB,QAAQ,EAAE,KAAK;KAChB,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openora/create",
|
|
3
|
-
"version": "0.4.1-canary.
|
|
3
|
+
"version": "0.4.1-canary.450",
|
|
4
4
|
"description": "npm initializer that scaffolds a headless Openora consumer app from the published @openora/* packages - no OSS checkout required",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-native",
|
|
@@ -28,16 +28,18 @@
|
|
|
28
28
|
"access": "public"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@
|
|
31
|
+
"@openora/core": "0.4.1-canary.450",
|
|
32
|
+
"@types/node": "26.6.5",
|
|
32
33
|
"typescript": "6.0.3",
|
|
33
|
-
"
|
|
34
|
+
"vitest": "4.1.12"
|
|
34
35
|
},
|
|
35
36
|
"engines": {
|
|
36
37
|
"node": ">=26"
|
|
37
38
|
},
|
|
38
39
|
"scripts": {
|
|
39
|
-
"build": "node scripts/copy-template.mjs && node scripts/generate-
|
|
40
|
-
"check:types": "node scripts/generate-
|
|
41
|
-
"clean": "rm -rf dist template src/generated"
|
|
40
|
+
"build": "node scripts/copy-template.mjs && node scripts/generate-versions.mjs && tsc",
|
|
41
|
+
"check:types": "node scripts/generate-versions.mjs && tsc --noEmit",
|
|
42
|
+
"clean": "rm -rf dist template src/generated",
|
|
43
|
+
"test:unit": "vitest run --passWithNoTests"
|
|
42
44
|
}
|
|
43
45
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Trust X-Forwarded-For from the TLS proxy in front (it reaches this container from a private
|
|
2
|
+
# address); without it Caddy replaces the header and every player gets the same IP.
|
|
3
|
+
{
|
|
4
|
+
servers {
|
|
5
|
+
trusted_proxies static private_ranges
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
:80 {
|
|
10
|
+
@chat path /chat/* /backoffice/chat/* /social/* /chat-command/* /backoffice/chat-command/*
|
|
11
|
+
reverse_proxy @chat chat:3001
|
|
12
|
+
reverse_proxy api:3001
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# One image for the API and its migrations. Built and run by compose.prod.yml.
|
|
2
|
+
FROM node:22-slim
|
|
3
|
+
RUN corepack enable
|
|
4
|
+
WORKDIR /app
|
|
5
|
+
RUN chown node:node /app
|
|
6
|
+
USER node
|
|
7
|
+
COPY --chown=node:node . .
|
|
8
|
+
RUN pnpm install --frozen-lockfile
|
|
9
|
+
ENV NODE_ENV=production
|
|
10
|
+
EXPOSE 3001
|
|
11
|
+
CMD ["pnpm", "--filter", "./apps/api", "start"]
|
package/template/README.md.tpl
CHANGED
|
@@ -13,7 +13,8 @@ in its own repo and talk to this api over HTTP via `@openora/react`.
|
|
|
13
13
|
```
|
|
14
14
|
apps/
|
|
15
15
|
api/ # Hono + oRPC API (:3001) - thin createApp entry + your extensions.config.ts
|
|
16
|
-
.
|
|
16
|
+
.rulesync/ # source of truth for agent rules, subagents, commands, skills
|
|
17
|
+
.claude/agents/ # generated AI agents
|
|
17
18
|
turbo/generators/ # turbo gen: plugin, adapter
|
|
18
19
|
```
|
|
19
20
|
|
|
@@ -25,20 +26,52 @@ newest release; pin an exact version if you need reproducible installs.
|
|
|
25
26
|
|
|
26
27
|
## Dev setup
|
|
27
28
|
|
|
29
|
+
Needs Node.js 22+ and Docker Desktop running.
|
|
30
|
+
|
|
28
31
|
```bash
|
|
29
32
|
pnpm install # pulls @openora/* from npm
|
|
30
|
-
pnpm
|
|
31
|
-
pnpm
|
|
32
|
-
cp .env.example .env # set DATABASE_URL + AUTH_SECRET
|
|
33
|
-
pnpm db:migrate # apply the OSS schema to your database
|
|
34
|
-
pnpm dev # api :3001
|
|
33
|
+
pnpm bootstrap # .env, Postgres + Redis, schema, admin + demo data
|
|
34
|
+
pnpm dev # api :3001, docs at http://localhost:3001/docs
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
`pnpm bootstrap` is safe to re-run; that resets the demo data and the admin password. It logs the backoffice admin it created (`ADMIN_EMAIL` /
|
|
38
|
+
`ADMIN_PASSWORD` in `.env`). For a database that is not local, set `DATABASE_URL` in `.env` and run
|
|
39
|
+
`pnpm db:migrate` yourself; `pnpm db:seed` only seeds a local database.
|
|
40
|
+
|
|
41
|
+
The `oss` MCP server is declared in `.mcp.json`. Approve it in your editor, restart, then run
|
|
42
|
+
**`/start`** in Claude Code - it asks what you want to build and scaffolds it for you.
|
|
39
43
|
|
|
40
44
|
To pull the newest platform release, re-run `pnpm install` (the pin tracks the `latest` stable tag).
|
|
41
45
|
|
|
46
|
+
The API sends anonymous usage telemetry (a random instance id, the version, the Node.js runtime and
|
|
47
|
+
two active-player counts). Set `OPENORA_TELEMETRY_DISABLED=1` in `.env` to turn it off; every field
|
|
48
|
+
is listed at https://openora.ai/documentation/telemetry.
|
|
49
|
+
|
|
50
|
+
## Deploy
|
|
51
|
+
|
|
52
|
+
`compose.prod.yml` runs the app on one server with Docker: Postgres, Redis, a migration step, then
|
|
53
|
+
the API and chat as two services of the same image, behind a gateway that routes the chat paths
|
|
54
|
+
(`/chat/*`, `/social/*`, `/chat-command/*` and their `/backoffice` twins) to chat. Before the first start:
|
|
55
|
+
|
|
56
|
+
1. Copy the repo to the server, `pnpm-lock.yaml` included. Never commit `.env`.
|
|
57
|
+
2. In the server's `.env`, set fresh `AUTH_SECRET`, `WITHDRAWAL_PIN_HMAC_SECRET` and `INTERNAL_API_SECRETS`
|
|
58
|
+
(`openssl rand -base64 32`) and `POSTGRES_PASSWORD` (`openssl rand -hex 32`). Postgres keeps
|
|
59
|
+
the password from the first start; changing it later does not change the database.
|
|
60
|
+
3. Set `CORS_ORIGINS` and the `*_PUBLIC_API_URL` values to your real `https://` domains.
|
|
61
|
+
4. Bind a real mail sender: run `pnpm gen adapter`, pick `EMAIL_SENDER`, and point it at your
|
|
62
|
+
provider (SMTP, SES, Postmark). In production the API refuses to boot without one.
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
docker compose -f compose.prod.yml up -d --build
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The gateway listens on `127.0.0.1` only, port `API_PORT` (default 3001). Put a reverse proxy with TLS (Caddy, nginx) in front of it
|
|
69
|
+
for your public domain.
|
|
70
|
+
|
|
71
|
+
It seeds nothing: no backoffice roles and no admin yet, so nobody can log in. Create them with a
|
|
72
|
+
reference seed, see
|
|
73
|
+
[Seeding reference data (production)](https://github.com/blurifycom/openora/blob/main/docs/guides/downstream-consumer.md#seeding-reference-data-production).
|
|
74
|
+
|
|
42
75
|
## Extending
|
|
43
76
|
|
|
44
77
|
| Need | Command |
|
|
@@ -52,10 +85,12 @@ a DI token wins).
|
|
|
52
85
|
|
|
53
86
|
## AI agents
|
|
54
87
|
|
|
55
|
-
`.claude/agents/` ships
|
|
88
|
+
`.claude/agents/` ships agents scoped to this repo, generated from `.rulesync/subagents/`:
|
|
56
89
|
|
|
90
|
+
- `planner` - plan a ticket: the blocking questions, or a plan with risk-driven test cases
|
|
57
91
|
- `builder` - configure extensions, swap adapters, write overlays, customize UI
|
|
58
92
|
- `expert` - turn product asks into requirements + acceptance criteria
|
|
59
|
-
- `
|
|
93
|
+
- `tester` - attack a built change against the running stack, return a verdict table, add the tests, triage bugs; once tests and review pass, record the evidence (one clip per AC) on the final commit
|
|
94
|
+
- `debugger`, `deployer`, `quality-reviewer`, `security-reviewer`, `compliance-reviewer` - root-cause, packaging, review
|
|
60
95
|
|
|
61
96
|
The `oss` MCP server (`.mcp.json`) gives them read-only inspection of the platform surface.
|
|
@@ -1,49 +1,76 @@
|
|
|
1
1
|
{
|
|
2
2
|
"enableAllProjectMcpServers": false,
|
|
3
3
|
"enabledMcpjsonServers": ["oss"],
|
|
4
|
+
"env": {
|
|
5
|
+
"CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD": "1"
|
|
6
|
+
},
|
|
4
7
|
"permissions": {
|
|
5
|
-
"deny": [
|
|
6
|
-
|
|
7
|
-
"Write(./node_modules/**)"
|
|
8
|
-
]
|
|
8
|
+
"deny": ["Edit(./node_modules/**)"],
|
|
9
|
+
"additionalDirectories": ["{{ossFromRoot}}"]
|
|
9
10
|
},
|
|
10
11
|
"hooks": {
|
|
11
12
|
"PreToolUse": [
|
|
12
13
|
{
|
|
13
|
-
"matcher": "Bash|Edit|Write",
|
|
14
|
+
"matcher": "Bash|Edit|Write|MultiEdit|NotebookEdit",
|
|
15
|
+
"hooks": [
|
|
16
|
+
{
|
|
17
|
+
"type": "command",
|
|
18
|
+
"command": "node \"${CLAUDE_PROJECT_DIR:-.}/.rulesync/hooks/guard-core.mjs\""
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"matcher": "Bash|Edit|Write|MultiEdit|NotebookEdit",
|
|
24
|
+
"hooks": [
|
|
25
|
+
{
|
|
26
|
+
"type": "command",
|
|
27
|
+
"command": "node \"${CLAUDE_PROJECT_DIR:-.}/.rulesync/hooks/guard-generated.mjs\""
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"matcher": "Bash",
|
|
14
33
|
"hooks": [
|
|
15
34
|
{
|
|
16
35
|
"type": "command",
|
|
17
|
-
"command": "node
|
|
36
|
+
"command": "node \"${CLAUDE_PROJECT_DIR:-.}/.rulesync/hooks/guard-mr.mjs\""
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"type": "command",
|
|
40
|
+
"command": "node \"${CLAUDE_PROJECT_DIR:-.}/.rulesync/hooks/guard-review.mjs\""
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"type": "command",
|
|
44
|
+
"command": "node \"${CLAUDE_PROJECT_DIR:-.}/.rulesync/hooks/guard-stack.mjs\""
|
|
18
45
|
}
|
|
19
46
|
]
|
|
20
47
|
},
|
|
21
48
|
{
|
|
22
|
-
"matcher": "
|
|
49
|
+
"matcher": "Bash",
|
|
23
50
|
"hooks": [
|
|
24
51
|
{
|
|
25
52
|
"type": "command",
|
|
26
|
-
"command": "node
|
|
53
|
+
"command": "node \"${CLAUDE_PROJECT_DIR:-.}/.rulesync/hooks/guard-comments.mjs\""
|
|
27
54
|
}
|
|
28
55
|
]
|
|
29
56
|
},
|
|
30
57
|
{
|
|
31
|
-
"matcher": "Task",
|
|
58
|
+
"matcher": "Task|Agent",
|
|
32
59
|
"hooks": [
|
|
33
60
|
{
|
|
34
61
|
"type": "command",
|
|
35
|
-
"command": "node
|
|
62
|
+
"command": "node \"${CLAUDE_PROJECT_DIR:-.}/.rulesync/hooks/guard-subagent.mjs\""
|
|
36
63
|
}
|
|
37
64
|
]
|
|
38
65
|
}
|
|
39
66
|
],
|
|
40
67
|
"PostToolUse": [
|
|
41
68
|
{
|
|
42
|
-
"matcher": "Edit|Write",
|
|
69
|
+
"matcher": "Edit|Write|MultiEdit|NotebookEdit",
|
|
43
70
|
"hooks": [
|
|
44
71
|
{
|
|
45
72
|
"type": "command",
|
|
46
|
-
"command": "node
|
|
73
|
+
"command": "node \"${CLAUDE_PROJECT_DIR:-.}/.rulesync/hooks/post-edit.mjs\""
|
|
47
74
|
}
|
|
48
75
|
]
|
|
49
76
|
}
|
|
@@ -1,15 +1,64 @@
|
|
|
1
1
|
# Database (Postgres). In dev link-mode this is typically the same local DB the
|
|
2
2
|
# OSS checkout uses, so migrations run via `pnpm db:migrate` line up.
|
|
3
3
|
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/oss_igaming
|
|
4
|
+
# Optional pool tuning: connections per process (default 10) and how long a query waits for
|
|
5
|
+
# a free one before failing (default 5000 ms).
|
|
6
|
+
# DATABASE_POOL_MAX=10
|
|
7
|
+
# DATABASE_POOL_ACQUIRE_TIMEOUT_MS=5000
|
|
8
|
+
# Optional read replicas, comma-separated. Only reads that opt into `drizzle.replica`
|
|
9
|
+
# use them; everything else stays on DATABASE_URL. Each replica gets its own pool.
|
|
10
|
+
# DATABASE_REPLICA_URLS=
|
|
11
|
+
# Optional database of its own for the audit chain, as its writer role. The audit migrate
|
|
12
|
+
# creates the database and the role from this url; see docs/standards/audit.md.
|
|
13
|
+
# AUDIT_DATABASE_URL=postgresql://audit_writer:change-me@localhost:5432/oss_igaming_audit
|
|
14
|
+
# Required with AUDIT_DATABASE_URL: the main database as the shipper role, the only one that may
|
|
15
|
+
# delete a shipped outbox row. The audit migrate creates the role too.
|
|
16
|
+
# AUDIT_SHIPPER_DATABASE_URL=postgresql://audit_shipper:change-me@localhost:5432/oss_igaming
|
|
17
|
+
# Connections per process in each audit pool (default 3). Keep replicas x this at or under 20,
|
|
18
|
+
# the connection limit of each audit role.
|
|
19
|
+
# AUDIT_DATABASE_POOL_MAX=3
|
|
4
20
|
|
|
5
|
-
# Auth secret (min 32 chars).
|
|
6
|
-
|
|
21
|
+
# Auth secret (min 32 chars). Left empty so the API refuses to boot without a real one.
|
|
22
|
+
# `pnpm bootstrap` generates it when it creates .env; otherwise: openssl rand -base64 32
|
|
23
|
+
AUTH_SECRET=
|
|
24
|
+
|
|
25
|
+
# Withdrawal PIN hashing key (min 32 chars). Left empty for the same reason; `pnpm bootstrap`
|
|
26
|
+
# generates it, otherwise: openssl rand -base64 32
|
|
27
|
+
WITHDRAWAL_PIN_HMAC_SECRET=
|
|
28
|
+
|
|
29
|
+
# Chat runs as its own service in compose.prod.yml, next to the API on the same database. The two
|
|
30
|
+
# call each other over a signed internal API; set a shared secret of 32+ characters
|
|
31
|
+
# (openssl rand -base64 32). Local dev runs every module in one process and ignores it.
|
|
32
|
+
# compose.prod.yml sets the rest: SERVICE_NAME, REALTIME_NAMESPACE, SERVICE_MANIFEST (chat only),
|
|
33
|
+
# CHAT_SERVICE_URL, CHAT_BLOCK_READER_CALLERS, CHAT_TRANSFER_CHECK_CALLERS, JOB_WORKERS and
|
|
34
|
+
# EVENT_BUS_START_ID=0 (the chat service's new consumer groups replay retained events, so none are missed;
|
|
35
|
+
# remove it after the chat service's first boot, see docs/guides/split-deployment.md).
|
|
36
|
+
# INTERNAL_API_SECRETS=
|
|
37
|
+
|
|
38
|
+
# Backoffice super-admin that `pnpm db:seed` creates (local only). Re-seeding resets the password.
|
|
39
|
+
ADMIN_EMAIL=admin@oss.dev
|
|
40
|
+
ADMIN_PASSWORD=password1234
|
|
41
|
+
# Demo players `pnpm db:seed` creates.
|
|
42
|
+
# SEED_PLAYERS=36
|
|
43
|
+
|
|
44
|
+
# Host ports docker compose publishes. Change both these and the URLs if 5432 / 6379 are taken.
|
|
45
|
+
# POSTGRES_PORT=5432
|
|
46
|
+
# REDIS_PORT=6379
|
|
47
|
+
|
|
48
|
+
# Backoffice super-admin that `pnpm db:seed` creates (local only). Re-seeding resets the password.
|
|
49
|
+
ADMIN_EMAIL=admin@oss.dev
|
|
50
|
+
ADMIN_PASSWORD=password1234
|
|
51
|
+
# Demo players `pnpm db:seed` creates.
|
|
52
|
+
# SEED_PLAYERS=36
|
|
7
53
|
|
|
8
54
|
# Redis (required). Auto-binds the durable seams (job queue, cache, rate limiter,
|
|
9
55
|
# message broker); the API refuses to boot without them (ADR-0030). `docker compose
|
|
10
56
|
# up -d` starts this alongside Postgres.
|
|
11
57
|
REDIS_URL=redis://localhost:6379
|
|
12
58
|
|
|
59
|
+
# Anonymous usage telemetry is on by default: https://openora.ai/documentation/telemetry
|
|
60
|
+
# OPENORA_TELEMETRY_DISABLED=1
|
|
61
|
+
|
|
13
62
|
# Ports
|
|
14
63
|
PORT=3001
|
|
15
64
|
CORS_ORIGINS=http://localhost:3000,http://localhost:3002
|
|
@@ -21,11 +21,11 @@ coverage
|
|
|
21
21
|
/AGENTS.md
|
|
22
22
|
/CLAUDE.md
|
|
23
23
|
/.mcp.json
|
|
24
|
-
.vscode/mcp.json
|
|
25
24
|
.codex/
|
|
26
25
|
.claude/agents/
|
|
27
26
|
.claude/commands/
|
|
28
|
-
.
|
|
29
|
-
.
|
|
30
|
-
|
|
31
|
-
.
|
|
27
|
+
.claude/worktrees/
|
|
28
|
+
.claude/reviews/
|
|
29
|
+
|
|
30
|
+
# Agent files rendered from the @openora/create consumer template on install.
|
|
31
|
+
# The block below is rewritten by tools/sync-agents.mjs - do not edit by hand.
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
targets:
|
|
3
3
|
- '*'
|
|
4
|
-
description: Run the local gate
|
|
4
|
+
description: Run the fast local gate - typecheck + lint + unit tests. Use `pnpm verify` for the full pre-MR gate (adds format check, boundaries, build).
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Run in order, stop at the first failure:
|
|
8
8
|
|
|
9
|
-
1. `pnpm check:types`
|
|
10
|
-
2. `pnpm check:lint`
|
|
9
|
+
1. `pnpm check:types`
|
|
10
|
+
2. `pnpm check:lint`
|
|
11
|
+
3. `pnpm test:unit`
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
The generated agent files (AGENTS.md, CLAUDE.md, .codex/config.toml, Copilot mirrors) are gitignored and regenerated from `.rulesync/` on `pnpm install` - there is nothing to drift-check. If you changed agent instructions, edit `.rulesync/` and run `pnpm gen:agents`.
|
|
13
|
+
`pnpm verify` is the pre-MR gate: these three plus whatever else the repo wires into that script (format, boundaries, build). It also records the verified commit, which the `guard-mr` hook checks before an MR/PR is opened.
|
|
15
14
|
|
|
16
15
|
After running:
|
|
17
16
|
|
|
18
|
-
- All green: report ready
|
|
19
|
-
-
|
|
17
|
+
- All green: report ready; list changed files (`git diff --name-only`).
|
|
18
|
+
- A step fails: show the exact location, propose a fix. Never report ready while any step is red.
|
|
19
|
+
|
|
20
|
+
Agent files (`AGENTS.md`, `CLAUDE.md`, mirrors) are gitignored and generated from `.rulesync/` on install - nothing to drift-check. If you changed agent instructions, edit `.rulesync/` and run `pnpm gen:agents`.
|
|
20
21
|
|
|
21
|
-
Do not touch `@openora/*` core or `node_modules` - this repo extends the platform from the outside only (overlay plugins, adapter rebindings, UI plugins, config).
|
|
22
|
+
Do not touch `@openora/*` core or `node_modules` - this repo extends the platform from the outside only (overlay plugins, adapter rebindings, UI plugins, config).
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
targets:
|
|
3
|
+
- '*'
|
|
4
|
+
description: Diagnose the local dev environment - linked {{ossDir}}, node, postgres, ports, caches. Read-only; reports findings + the fix command for each.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Run these checks and report a pass/fail line per item with the fix command for failures. Read-only - never apply fixes without being asked.
|
|
8
|
+
|
|
9
|
+
1. **Node version**: `node -v` matches the major in `.nvmrc` (read the file, don't assume a number). Fix: `nvm use`.
|
|
10
|
+
2. **OSS checkout linked** (only in repos that link a local platform checkout - a stock scaffold installs `@openora/*` from npm and skips this and the next check): `{{ossDir}}` exists and `node --input-type=module -e "import {createRequire} from 'node:module'; console.log(createRequire(process.cwd()+'/').resolve('@openora/core/react'))"` resolves. Fix: clone the OSS repo side by side at `{{ossDir}}`, run the repo's link script if it ships one (`pnpm link:oss`), then `pnpm install`.
|
|
11
|
+
3. **OSS built**: the resolved path above points into a `dist/` that exists and is newer than `{{ossDir}}/packages/*/src`. Fix: rebuild the linked checkout with the repo's build script if it ships one (`pnpm build:oss`), otherwise build it from `{{ossDir}}`.
|
|
12
|
+
4. **Database**: postgres reachable on the port in `DATABASE_URL` (`nc -z localhost <port>`). Fix: `dev:infra` MCP tool (server `oss`) or the compose stack.
|
|
13
|
+
5. **Services**: port 3001 (api), plus 3000 (web) and 3002 (backoffice) in repos that have those apps - report which are up. Fix: `pnpm dev`.
|
|
14
|
+
6. **Stale bundler cache**: if this repo has a Next app and a build error persists after a fix, `rm -rf apps/*/.next` and rebuild (Turbopack caches across the link boundary).
|
|
15
|
+
7. **Generated agent files**: `pnpm gen:agents` runs clean (regenerates from `.rulesync/`).
|
|
16
|
+
|
|
17
|
+
If everything passes but a build still fails, hand off to the `debugger` agent with the verbatim error - it owns the deeper resolution table (turbopack.root, symlinked tsconfig, externalDir).
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
targets: ['*']
|
|
3
|
+
description: 'Generate a self-contained local add-on package (schema, service, router, plugin.ts) and register it. Args: <name>. Consumers rarely need this - prefer an overlay plugin.'
|
|
3
4
|
---
|
|
4
5
|
|
|
5
6
|
> A consumer extends the platform with **overlay plugins** (`scaffold-plugin`) almost always. Reach
|
|
@@ -11,7 +12,7 @@ ships a buildable add-on - a `list` route wired contract -> router -> service ov
|
|
|
11
12
|
so `/check` is green immediately. Then:
|
|
12
13
|
|
|
13
14
|
1. `<name>/src/schema/index.ts` - Drizzle tables (`pgTable`, snake_case, `timestamp({ withTimezone:
|
|
14
|
-
true })` per `
|
|
15
|
+
true })` per `docs/standards/database.md`).
|
|
15
16
|
2. `<name>/src/schemas/index.ts` - Zod input/output schemas; types via `z.infer`.
|
|
16
17
|
3. `<name>/src/service/<name>.service.ts` - business logic; inject `DRIZZLE` + `EVENT_BUS`, no inline
|
|
17
18
|
fetch/SQL.
|
|
@@ -1,24 +1,43 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
targets: ['*']
|
|
3
|
+
description: 'Generate an overlay extension under apps/api/src/extensions/<name>/. Adds routes, providers, event handlers, agent tools, or agent action types without touching @openora/* core. Args: <name>.'
|
|
3
4
|
---
|
|
4
5
|
|
|
5
6
|
Run `pnpm gen plugin $ARGUMENTS` in the repo root. For a vendor swap use
|
|
6
7
|
`pnpm gen adapter <name> <TOKEN> <dependsOn>`; for a react-sdk page use `pnpm gen page <route>`.
|
|
7
8
|
|
|
8
9
|
After the generator finishes, open `apps/api/src/extensions/<name>/plugin.ts` and implement
|
|
9
|
-
`register(ctx)
|
|
10
|
+
`register(ctx)`. It only declares: a timer, connection, file or network read, process listener,
|
|
11
|
+
global or `process.env` write goes in a `provide()` or router factory, closed with
|
|
12
|
+
`c.onDispose()`, because a failed `SERVICE_MANIFEST` boot registers plugins into a container it
|
|
13
|
+
then drops.
|
|
10
14
|
|
|
11
15
|
- `ctx.provide(TOKEN, factory)` - bind an adapter/service (sealed compliance tokens are rejected at
|
|
12
16
|
compile + runtime).
|
|
13
17
|
- `ctx.routers.add(namespace, (c) => router)` - mount oRPC routes (Zod input/output, no inline schemas).
|
|
14
18
|
- `ctx.events.on(event, handler)` - subscribe to the typed `EventBus`.
|
|
15
|
-
- `ctx.
|
|
19
|
+
- `ctx.triggers.listen((trigger, payload, envelope) => ...)` - hear the domain events the operator
|
|
20
|
+
allow-listed as agent triggers (`agents.triggers.topics`). Delivery is at-least-once: dedupe on
|
|
21
|
+
`envelope.eventId`, and drop what is older than you care about by `envelope.occurredAt`, since a
|
|
22
|
+
topic listed again can replay its backlog. The payload is raw and may hold personal data, so
|
|
23
|
+
never hand it to a model. Enqueue a job and return: a slow listener delays the topic's other
|
|
24
|
+
handlers.
|
|
25
|
+
- `ctx.mcp.tool(defineMcpTool({...}), (c) => async (input, run) => output)` - register an agent tool,
|
|
26
|
+
a read a model makes during a run.
|
|
27
|
+
- `ctx.actions.register(defineActionType({...}), (c) => ({ precondition, execute }))` - register an
|
|
28
|
+
agent action type, a change a model may only propose. `execute` performs nothing on a replay
|
|
29
|
+
while its effect still holds, and answers `already_applied`.
|
|
30
|
+
|
|
31
|
+
Both are served only through the `MCP_KERNEL` token, which checks IAM, validates input, applies the
|
|
32
|
+
output allow-list and audits every tool call and action execution; a shape it cannot serve fails
|
|
33
|
+
boot with the fix. The one-argument `ctx.mcp.tool(definition)` still registers but the kernel does
|
|
34
|
+
not serve it.
|
|
16
35
|
|
|
17
36
|
Then:
|
|
18
37
|
|
|
19
38
|
1. Register the plugin in `apps/api/src/extensions.config.ts`. Last registration of a DI token wins -
|
|
20
39
|
list an adapter swap AFTER the module that owns the default binding.
|
|
21
|
-
2. Tables go in the overlay's own `src/schema/index.ts` (follow `
|
|
40
|
+
2. Tables go in the overlay's own `src/schema/index.ts` (follow `docs/standards/database.md`); run `pnpm db:migrate`.
|
|
22
41
|
3. Audit every state-changing action (emit an event the `audit` add-on consumes, or `AUDIT_WRITER.record`).
|
|
23
42
|
4. `/check` to confirm wiring compiles and boundary lint passes.
|
|
24
43
|
|
|
@@ -4,8 +4,8 @@ targets:
|
|
|
4
4
|
description: First-run onboarding for this consumer igaming repo. Interview the user for requirements, then delegate the build to the scoped agents. Invokes the `start` MCP tool.
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
If the stack is not set up yet (no `.env`, or `pnpm db:seed` never ran), run `pnpm install` and `pnpm bootstrap` first; it needs Docker running. Then call the `start` MCP tool (server `oss`) with no arguments, then follow the script it returns exactly. If the user already described what they want to build, pass it as the `ask` argument.
|
|
8
8
|
|
|
9
|
-
The returned script will have you: confirm the MCP server is connected, run a thorough requirements interview, call `enhance-intent`, then delegate the implementation to the `expert`, `builder`, and `
|
|
9
|
+
The returned script will have you: confirm the MCP server is connected, run a thorough requirements interview, call `enhance-intent`, then delegate the implementation to the `expert`, `builder`, and `tester` agents (via the Task tool). You gather requirements and orchestrate; you do not write feature code yourself, and you never modify `@openora/*` core.
|
|
10
10
|
|
|
11
|
-
If the `start` tool is not available, the `oss` MCP server is not connected - tell the user to
|
|
11
|
+
If the `start` tool is not available, the `oss` MCP server is not connected - tell the user to approve the `oss` server declared in `.mcp.json` (or run the repo's MCP setup script if it ships one) and restart the editor.
|