@openora/create 0.4.1-canary.40 → 0.4.1-canary.404
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 +4 -4
- 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 +15 -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/Dockerfile +11 -0
- package/template/README.md.tpl +44 -10
- package/template/__dot__claude/settings.json.tpl +30 -12
- package/template/__dot__dockerignore +8 -0
- package/template/__dot__env.example +33 -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-core.mjs.tpl +98 -28
- package/template/__dot__rulesync/hooks/guard-generated.mjs +15 -16
- package/template/__dot__rulesync/hooks/guard-mr.mjs +143 -0
- package/template/__dot__rulesync/hooks/guard-review.mjs +280 -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 +37 -4
- package/template/__dot__rulesync/rules/conventions.md +99 -119
- package/template/__dot__rulesync/rules/db-conventions.md +6 -72
- package/template/__dot__rulesync/rules/e2e-conventions.md +33 -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/create-plugin/{SKILL.md → SKILL.md.tpl} +12 -23
- package/template/__dot__rulesync/skills/create-pr/SKILL.md.tpl +37 -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 +278 -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/ship/watch-pr.mjs +189 -0
- package/template/__dot__rulesync/skills/ui-verify/SKILL.md.tpl +120 -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 +79 -0
- package/template/__dot__rulesync/subagents/debugger.md.tpl +89 -0
- package/template/__dot__rulesync/subagents/deployer.md.tpl +53 -0
- package/template/__dot__rulesync/subagents/expert.md +29 -34
- package/template/__dot__rulesync/subagents/planner.md.tpl +40 -0
- package/template/__dot__rulesync/subagents/quality-reviewer.md.tpl +113 -0
- package/template/__dot__rulesync/subagents/security-reviewer.md.tpl +86 -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 +12 -0
- package/template/apps/api/src/main.ts.tpl +1 -4
- package/template/apps/api/src/seed.ts.tpl +24 -17
- package/template/compose.prod.yml +63 -0
- package/template/docker-compose.yml +15 -2
- 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 +33 -0
- package/template/docs/standards/module-structure.md +37 -0
- package/template/docs/standards/testing.md +91 -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 +575 -0
- package/template/tools/sync-agents.mjs +273 -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
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// First run on a fresh checkout: `.env`, Postgres + Redis, schema, then local data with an admin.
|
|
3
|
+
// Safe to re-run (it resets demo data and the admin password). Local databases only.
|
|
4
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
5
|
+
import { execSync } from 'node:child_process';
|
|
6
|
+
import { randomBytes } from 'node:crypto';
|
|
7
|
+
|
|
8
|
+
const LOCAL_DB_HOSTS = new Set(['localhost', '127.0.0.1', '[::1]', 'postgres']);
|
|
9
|
+
const SECRET_KEYS = ['AUTH_SECRET', 'WITHDRAWAL_PIN_HMAC_SECRET'];
|
|
10
|
+
const HINTS = {
|
|
11
|
+
'docker compose up -d --wait':
|
|
12
|
+
'Is port 5432 or 6379 taken? Set POSTGRES_PORT / REDIS_PORT and the matching DATABASE_URL / REDIS_URL in .env.',
|
|
13
|
+
'pnpm db:migrate': 'Check DATABASE_URL in .env points at the Docker Postgres.',
|
|
14
|
+
'pnpm db:seed': 'Check DATABASE_URL in .env points at the Docker Postgres.',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const fail = (message) => {
|
|
18
|
+
console.error(`\n${message}`);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
};
|
|
21
|
+
const run = (command) => {
|
|
22
|
+
try {
|
|
23
|
+
execSync(command, { stdio: 'inherit' });
|
|
24
|
+
} catch {
|
|
25
|
+
fail(`\`${command}\` failed (output above). ${HINTS[command]}`);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// Fill any empty or missing secret, so a new .env and one copied by hand both get real keys.
|
|
30
|
+
const original = existsSync('.env') ? readFileSync('.env', 'utf8') : null;
|
|
31
|
+
let env = original ?? readFileSync('.env.example', 'utf8');
|
|
32
|
+
for (const key of SECRET_KEYS) {
|
|
33
|
+
const line = new RegExp(`^${key}=[ \\t]*$`, 'm');
|
|
34
|
+
if (line.test(env)) env = env.replace(line, `${key}=${randomBytes(32).toString('base64')}`);
|
|
35
|
+
else if (!new RegExp(`^${key}=`, 'm').test(env))
|
|
36
|
+
env += `\n${key}=${randomBytes(32).toString('base64')}\n`;
|
|
37
|
+
}
|
|
38
|
+
if (env !== original) {
|
|
39
|
+
writeFileSync('.env', env, { mode: 0o600 });
|
|
40
|
+
console.log(
|
|
41
|
+
original === null ? 'Created .env with fresh secrets.' : 'Added missing secrets to .env.',
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Shell env wins over .env, the same way `pnpm db:migrate` resolves it.
|
|
46
|
+
process.loadEnvFile('.env');
|
|
47
|
+
if (process.env.NODE_ENV === 'production') fail('Refusing to bootstrap with NODE_ENV=production.');
|
|
48
|
+
let databaseUrl;
|
|
49
|
+
try {
|
|
50
|
+
databaseUrl = new URL(process.env.DATABASE_URL ?? '');
|
|
51
|
+
} catch {
|
|
52
|
+
fail('DATABASE_URL in .env is missing or not a valid postgres URL.');
|
|
53
|
+
}
|
|
54
|
+
const host = databaseUrl.searchParams.get('host') ?? databaseUrl.hostname;
|
|
55
|
+
if (!LOCAL_DB_HOSTS.has(host)) {
|
|
56
|
+
fail(
|
|
57
|
+
`Refusing to bootstrap the database at ${host}: it migrates and wipes demo data. Point DATABASE_URL at the local Docker Postgres.`,
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
execSync('docker info', { stdio: 'ignore' });
|
|
63
|
+
} catch {
|
|
64
|
+
fail('Docker is not running. Install Docker Desktop, start it, then run `pnpm bootstrap` again.');
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
run('docker compose up -d --wait');
|
|
68
|
+
run('pnpm db:migrate');
|
|
69
|
+
run('pnpm db:seed');
|
|
70
|
+
|
|
71
|
+
console.log(`
|
|
72
|
+
Ready. Start the API with \`pnpm dev\`, then open http://localhost:3001/docs.
|
|
73
|
+
The backoffice admin login is printed above (ADMIN_EMAIL / ADMIN_PASSWORD in .env).`);
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// A git worktree of the sibling OSS checkout - the only place an agent in this repo may change
|
|
3
|
+
// OSS code (the guard-core hook allows {{ossFromRoot}}/.worktrees/ and denies the rest of the
|
|
4
|
+
// checkout). Same command for every agent and every human, so a paired change looks the same
|
|
5
|
+
// on every machine.
|
|
6
|
+
//
|
|
7
|
+
// pnpm oss:worktree <branch> create or reuse the worktree, install its deps
|
|
8
|
+
// pnpm oss:worktree <branch> --link ...then build it and point `pnpm link:oss` at it
|
|
9
|
+
// pnpm oss:worktree <branch> --remove remove it; relinks the main checkout if it was linked
|
|
10
|
+
//
|
|
11
|
+
// Use the same branch name as this repo's branch: that is how skills pair the two requests.
|
|
12
|
+
import { execFileSync } from 'node:child_process';
|
|
13
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
14
|
+
import { join, relative, resolve } from 'node:path';
|
|
15
|
+
// oxlint-disable no-console
|
|
16
|
+
|
|
17
|
+
// This repo is often checked out as a git worktree, whose `.git` is a file pointing at
|
|
18
|
+
// <main>/.git/worktrees/<name>. The sibling OSS checkout sits next to the MAIN checkout, so
|
|
19
|
+
// resolve from there or every path below lands inside the worktree.
|
|
20
|
+
const mainCheckoutOf = (dir) => {
|
|
21
|
+
try {
|
|
22
|
+
const pointer = readFileSync(join(dir, '.git'), 'utf8');
|
|
23
|
+
const gitdir = pointer.match(/^gitdir:\s*(.*[/\\]worktrees[/\\][^/\\]+?)\s*$/m)?.[1];
|
|
24
|
+
return gitdir ? resolve(dir, gitdir, '..', '..', '..') : dir;
|
|
25
|
+
} catch {
|
|
26
|
+
return dir; // `.git` is a directory (the main checkout) or missing
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const OSS = resolve(mainCheckoutOf(process.cwd()), '{{ossFromRoot}}');
|
|
31
|
+
const USAGE = 'usage: pnpm oss:worktree <branch> [--link | --remove]';
|
|
32
|
+
|
|
33
|
+
const die = (message) => {
|
|
34
|
+
console.error(`oss:worktree - ${message}`);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const [branch, flag] = process.argv.slice(2);
|
|
39
|
+
if (!branch || branch.startsWith('--') || (flag && !['--link', '--remove'].includes(flag))) {
|
|
40
|
+
die(USAGE);
|
|
41
|
+
}
|
|
42
|
+
if (!existsSync(join(OSS, '.git'))) {
|
|
43
|
+
die(`no OSS checkout at ${OSS} - clone it next to this repo first.`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const worktree = join(OSS, '.worktrees', branch.replaceAll('/', '+'));
|
|
47
|
+
const worktreeFromHere = relative(process.cwd(), worktree);
|
|
48
|
+
// A fresh worktree has no node_modules yet, so the checkout's own post-checkout hook would run
|
|
49
|
+
// against tools it cannot resolve and fail the command. The install below does that setup.
|
|
50
|
+
const GIT = ['-C', OSS, '-c', 'core.hooksPath=/dev/null'];
|
|
51
|
+
const git = (...args) =>
|
|
52
|
+
execFileSync('git', [...GIT, ...args], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'inherit'] }).trim();
|
|
53
|
+
const gitOrEmpty = (...args) => {
|
|
54
|
+
try {
|
|
55
|
+
return execFileSync('git', [...GIT, ...args], { encoding: 'utf8', stdio: 'pipe' }).trim();
|
|
56
|
+
} catch {
|
|
57
|
+
return '';
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const run = (cmd, args) => execFileSync(cmd, args, { stdio: 'inherit' });
|
|
61
|
+
const hasLinkScript = () =>
|
|
62
|
+
Boolean(JSON.parse(readFileSync('package.json', 'utf8')).scripts?.['link:oss']);
|
|
63
|
+
const isLinkedTo = (dir) =>
|
|
64
|
+
existsSync('pnpm-workspace.yaml') &&
|
|
65
|
+
readFileSync('pnpm-workspace.yaml', 'utf8').includes(`link:${relative(process.cwd(), dir)}/`);
|
|
66
|
+
|
|
67
|
+
if (flag === '--remove') {
|
|
68
|
+
const wasLinked = isLinkedTo(worktree);
|
|
69
|
+
if (existsSync(worktree)) {
|
|
70
|
+
try {
|
|
71
|
+
git('worktree', 'remove', worktree);
|
|
72
|
+
} catch {
|
|
73
|
+
die(`${worktreeFromHere} has uncommitted changes - commit or discard them, then rerun.`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (wasLinked && hasLinkScript()) {
|
|
77
|
+
run('pnpm', ['link:oss']);
|
|
78
|
+
}
|
|
79
|
+
console.log(`removed ${worktreeFromHere}`);
|
|
80
|
+
process.exit(0);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (!existsSync(worktree)) {
|
|
84
|
+
git('fetch', 'origin', '--quiet');
|
|
85
|
+
const base = gitOrEmpty('rev-parse', '--abbrev-ref', 'origin/HEAD') || 'origin/dev';
|
|
86
|
+
if (gitOrEmpty('rev-parse', '--verify', '--quiet', `refs/heads/${branch}`)) {
|
|
87
|
+
git('worktree', 'add', worktree, branch);
|
|
88
|
+
} else if (gitOrEmpty('rev-parse', '--verify', '--quiet', `refs/remotes/origin/${branch}`)) {
|
|
89
|
+
git('worktree', 'add', '--track', '-b', branch, worktree, `origin/${branch}`);
|
|
90
|
+
} else {
|
|
91
|
+
git('worktree', 'add', '--no-track', '-b', branch, worktree, base);
|
|
92
|
+
}
|
|
93
|
+
run('pnpm', ['-C', worktree, 'install', '--frozen-lockfile']);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (flag === '--link') {
|
|
97
|
+
if (!hasLinkScript()) {
|
|
98
|
+
die('this repo has no `link:oss` script - link the worktree through pnpm overrides by hand.');
|
|
99
|
+
}
|
|
100
|
+
// @openora/* resolve from dist/, so a linked worktree works only once it is built.
|
|
101
|
+
run('pnpm', ['-C', worktree, 'build']);
|
|
102
|
+
run('pnpm', ['link:oss', worktreeFromHere]);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
console.log(worktreeFromHere);
|