deuk-agent-rule 1.0.2 → 1.0.4
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.ko.md +51 -40
- package/README.md +49 -39
- package/package.json +1 -1
- package/scripts/cli.mjs +131 -4
- package/scripts/sync-oss.mjs +10 -1
package/README.ko.md
CHANGED
|
@@ -2,77 +2,88 @@
|
|
|
2
2
|
|
|
3
3
|
**npm 패키지:** `deuk-agent-rule` · **CLI:** `deuk-agent-rule`
|
|
4
4
|
|
|
5
|
-
**English:** [README.md](README.md)
|
|
5
|
+
**English:** [README.md](https://github.com/joygram/DeukAgentRules/blob/master/README.md)
|
|
6
6
|
|
|
7
7
|
Cursor, Copilot, Gemini 등 여러 에이전트·도구를 함께 쓸 때를 위한 `AGENTS.md`·`.cursor/rules` 버전 관리형 템플릿. 핸드오프·간결 응답으로 비용·성능을 개선합니다.
|
|
8
8
|
|
|
9
9
|
## 워크스페이스 초기화
|
|
10
10
|
|
|
11
|
-
설치만으로는 파일이 바뀌지 않습니다. **대상 프로젝트 루트**에서 CLI를 실행하거나 `--cwd`로 경로를 줍니다.
|
|
12
|
-
|
|
13
11
|
```bash
|
|
14
12
|
npm install deuk-agent-rule
|
|
15
13
|
npx deuk-agent-rule init
|
|
16
14
|
```
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
`--non-interactive` 없이 실행하면 짧은 설정 질문이 시작됩니다:
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
```
|
|
19
|
+
$ npx deuk-agent-rule init
|
|
20
|
+
|
|
21
|
+
DeukAgentRules init — let's configure your workspace.
|
|
22
|
+
|
|
23
|
+
? What is your primary tech stack?
|
|
24
|
+
1) Unity / C#
|
|
25
|
+
2) Next.js + C#
|
|
26
|
+
3) Web (React / Vue / general)
|
|
27
|
+
4) Java / Spring Boot
|
|
28
|
+
5) Other / skip
|
|
29
|
+
Choice [1-5]: 1
|
|
30
|
+
|
|
31
|
+
? Which agent tools do you use? (comma-separated numbers, or 'all')
|
|
32
|
+
1) Cursor
|
|
33
|
+
2) GitHub Copilot
|
|
34
|
+
3) Gemini / Antigravity
|
|
35
|
+
4) All of the above
|
|
36
|
+
5) Other / skip
|
|
37
|
+
Choices: 1,2
|
|
38
|
+
|
|
39
|
+
Stack : unity
|
|
40
|
+
Tools : cursor, copilot
|
|
41
|
+
|
|
42
|
+
AGENTS.md: injected (inject)
|
|
43
|
+
rule copied: .cursor/rules/deuk-agent-rule-multi-ai-workflow.mdc
|
|
44
|
+
rule copied: .cursor/rules/deuk-agent-rule-git-commit.mdc
|
|
45
|
+
```
|
|
23
46
|
|
|
24
|
-
|
|
47
|
+
CI나 스크립트 환경에서 질문 없이 실행:
|
|
25
48
|
|
|
26
49
|
```bash
|
|
27
|
-
|
|
28
|
-
npx deuk-agent-rule init
|
|
50
|
+
npx deuk-agent-rule init --non-interactive
|
|
29
51
|
```
|
|
30
52
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
### `init` 파라미터
|
|
34
|
-
|
|
35
|
-
플래그는 모두 `init` **뒤**에 둡니다. 예: `npx deuk-agent-rule init --cwd ../다른레포 --dry-run`
|
|
36
|
-
|
|
37
|
-
| 플래그 | init 기본값 | 설명 |
|
|
38
|
-
|--------|-------------|------|
|
|
39
|
-
| `--cwd <path>` | 현재 디렉터리 | `AGENTS.md`·`.cursor/rules/`를 쓸 레포 루트. |
|
|
40
|
-
| `--dry-run` | 끔 | 쓰기 없이 할 일만 출력. |
|
|
41
|
-
| `--backup` | 끔 | 덮어쓰기 전 같은 이름에 `.bak` 저장. |
|
|
42
|
-
| `--tag <id>` | `deuk-agent-rule` | `<!-- <id>:begin -->` ~ `<!-- <id>:end -->` 마커 쌍. |
|
|
43
|
-
| `--marker-begin` / `--marker-end` | (`--tag` 권장) | 임의 마커 문자열, **둘 다** 필요. |
|
|
44
|
-
| `--agents <mode>` | `inject` | `inject` — 마커 안만 갱신(마커 없으면 블록 추가). `skip` — `AGENTS.md` 건드리지 않음. `overwrite` — 전체 교체(주의). |
|
|
45
|
-
| `--rules <mode>` | `prefix` | `prefix` — 있으면 `deuk-agent-rule-foo.mdc`로 추가. `skip` — 스킵. `overwrite` — 덮어쓰기. |
|
|
46
|
-
| `--append-if-no-markers` | 끔 | `merge`에서 주로 사용. |
|
|
47
|
-
|
|
48
|
-
예시:
|
|
53
|
+
패키지 업데이트 후:
|
|
49
54
|
|
|
50
55
|
```bash
|
|
51
|
-
|
|
52
|
-
npx deuk-agent-rule init --
|
|
53
|
-
npx deuk-agent-rule init --tag mycompany --rules overwrite
|
|
54
|
-
npx deuk-agent-rule init --agents skip --rules prefix
|
|
55
|
-
npx deuk-agent-rule init --backup
|
|
56
|
+
npm update deuk-agent-rule
|
|
57
|
+
npx deuk-agent-rule init --non-interactive
|
|
56
58
|
```
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
`AGENTS.md`의 **마커 안**만 갱신되고 바깥 내용은 유지됩니다.
|
|
61
|
+
|
|
62
|
+
### 주요 옵션
|
|
59
63
|
|
|
60
|
-
|
|
61
|
-
|
|
64
|
+
| 플래그 | 기본값 | 설명 |
|
|
65
|
+
|--------|--------|------|
|
|
66
|
+
| `--non-interactive` | 끔 | 질문 생략, 플래그 기본값으로 실행 |
|
|
67
|
+
| `--cwd <path>` | 현재 디렉터리 | 대상 레포 루트 |
|
|
68
|
+
| `--dry-run` | 끔 | 쓰기 없이 동작만 출력 |
|
|
69
|
+
| `--tag <id>` | `deuk-agent-rule` | 마커 id: `<!-- <id>:begin/end -->` |
|
|
70
|
+
| `--agents <mode>` | `inject` | `inject` \| `skip` \| `overwrite` |
|
|
71
|
+
| `--rules <mode>` | `prefix` | `prefix` \| `skip` \| `overwrite` |
|
|
72
|
+
| `--backup` | 끔 | 덮어쓰기 전 `*.bak` 저장 |
|
|
62
73
|
|
|
63
|
-
###
|
|
74
|
+
### 번들 규칙
|
|
64
75
|
|
|
65
76
|
- **`multi-ai-workflow.mdc`** — `alwaysApply: true`
|
|
66
77
|
- **`git-commit.mdc`** — `alwaysApply: false`
|
|
67
78
|
|
|
68
79
|
### `merge` (엄격)
|
|
69
80
|
|
|
70
|
-
|
|
81
|
+
옵션 동일. 마커가 없으면 inject 실패(`--append-if-no-markers` 없을 때). 기본 `--rules skip`.
|
|
71
82
|
|
|
72
83
|
### 주의
|
|
73
84
|
|
|
74
|
-
- `alwaysApply: true` 규칙이 겹치면 컨텍스트가
|
|
75
|
-
- `postinstall`에서 `init` 자동 실행은 권장하지
|
|
85
|
+
- `alwaysApply: true` 규칙이 겹치면 컨텍스트가 커질 수 있습니다.
|
|
86
|
+
- `postinstall`에서 `init` 자동 실행은 권장하지 않습니다.
|
|
76
87
|
|
|
77
88
|
## 버전
|
|
78
89
|
|
package/README.md
CHANGED
|
@@ -2,64 +2,74 @@
|
|
|
2
2
|
|
|
3
3
|
**npm package:** `deuk-agent-rule` · **CLI:** `deuk-agent-rule`
|
|
4
4
|
|
|
5
|
-
**한국어:** [README.ko.md](README.ko.md)
|
|
5
|
+
**한국어:** [README.ko.md](https://github.com/joygram/DeukAgentRules/blob/master/README.ko.md)
|
|
6
6
|
|
|
7
7
|
Versioned templates for `AGENTS.md` and `.cursor/rules` for Cursor, Copilot, Gemini and similar agents: shared handoff format, concise execution, stronger cost-efficiency and responsiveness.
|
|
8
8
|
|
|
9
9
|
## Initialize a workspace
|
|
10
10
|
|
|
11
|
-
Install does nothing until you run the CLI from the **target repository root** (or pass `--cwd`).
|
|
12
|
-
|
|
13
11
|
```bash
|
|
14
12
|
npm install deuk-agent-rule
|
|
15
13
|
npx deuk-agent-rule init
|
|
16
14
|
```
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
Running `init` without `--non-interactive` starts a short setup flow:
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
```
|
|
19
|
+
$ npx deuk-agent-rule init
|
|
20
|
+
|
|
21
|
+
DeukAgentRules init — let's configure your workspace.
|
|
22
|
+
|
|
23
|
+
? What is your primary tech stack?
|
|
24
|
+
1) Unity / C#
|
|
25
|
+
2) Next.js + C#
|
|
26
|
+
3) Web (React / Vue / general)
|
|
27
|
+
4) Java / Spring Boot
|
|
28
|
+
5) Other / skip
|
|
29
|
+
Choice [1-5]: 3
|
|
30
|
+
|
|
31
|
+
? Which agent tools do you use? (comma-separated numbers, or 'all')
|
|
32
|
+
1) Cursor
|
|
33
|
+
2) GitHub Copilot
|
|
34
|
+
3) Gemini / Antigravity
|
|
35
|
+
4) All of the above
|
|
36
|
+
5) Other / skip
|
|
37
|
+
Choices: all
|
|
38
|
+
|
|
39
|
+
Stack : web
|
|
40
|
+
Tools : cursor, copilot, gemini, all
|
|
41
|
+
|
|
42
|
+
AGENTS.md: injected (inject)
|
|
43
|
+
rule copied: .cursor/rules/deuk-agent-rule-multi-ai-workflow.mdc
|
|
44
|
+
rule copied: .cursor/rules/deuk-agent-rule-git-commit.mdc
|
|
45
|
+
```
|
|
23
46
|
|
|
24
|
-
|
|
47
|
+
To skip questions (CI or scripted use):
|
|
25
48
|
|
|
26
49
|
```bash
|
|
27
|
-
|
|
28
|
-
npx deuk-agent-rule init
|
|
50
|
+
npx deuk-agent-rule init --non-interactive
|
|
29
51
|
```
|
|
30
52
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
### `init` parameters
|
|
34
|
-
|
|
35
|
-
All flags go **after** `init` (e.g. `npx deuk-agent-rule init --cwd ../other-repo --dry-run`).
|
|
36
|
-
|
|
37
|
-
| Flag | Default (init) | Description |
|
|
38
|
-
|------|----------------|-------------|
|
|
39
|
-
| `--cwd <path>` | current directory | Root of the repo to modify (`AGENTS.md`, `.cursor/rules/`). |
|
|
40
|
-
| `--dry-run` | off | Print planned actions; do not write files. |
|
|
41
|
-
| `--backup` | off | Write `*.bak` next to any file that would be overwritten. |
|
|
42
|
-
| `--tag <id>` | `deuk-agent-rule` | HTML comment markers: `<!-- <id>:begin -->` … `<!-- <id>:end -->`. |
|
|
43
|
-
| `--marker-begin <s>` / `--marker-end <s>` | (use `--tag` instead) | Custom marker strings; **both** required if either is set. |
|
|
44
|
-
| `--agents <mode>` | `inject` | `inject` — update only inside markers (or append block if no markers). `skip` — do not change `AGENTS.md`. `overwrite` — replace entire `AGENTS.md` with the bundle (use with care). |
|
|
45
|
-
| `--rules <mode>` | `prefix` | `prefix` — if `foo.mdc` exists, write `deuk-agent-rule-foo.mdc`. `skip` — skip existing names. `overwrite` — replace on clash. |
|
|
46
|
-
| `--append-if-no-markers` | off | Rare for `init` (init already appends when markers are missing). Same flag is mainly for `merge`. |
|
|
47
|
-
|
|
48
|
-
Examples:
|
|
53
|
+
After a package upgrade:
|
|
49
54
|
|
|
50
55
|
```bash
|
|
51
|
-
|
|
52
|
-
npx deuk-agent-rule init --
|
|
53
|
-
npx deuk-agent-rule init --tag mycompany --rules overwrite
|
|
54
|
-
npx deuk-agent-rule init --agents skip --rules prefix
|
|
55
|
-
npx deuk-agent-rule init --backup
|
|
56
|
+
npm update deuk-agent-rule
|
|
57
|
+
npx deuk-agent-rule init --non-interactive
|
|
56
58
|
```
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
Only the **marker region** in `AGENTS.md` is replaced; your text outside stays.
|
|
61
|
+
|
|
62
|
+
### Key options
|
|
59
63
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
-
|
|
64
|
+
| Flag | Default | Description |
|
|
65
|
+
|------|---------|-------------|
|
|
66
|
+
| `--non-interactive` | off | Skip questions; use flag defaults |
|
|
67
|
+
| `--cwd <path>` | current directory | Target repo root |
|
|
68
|
+
| `--dry-run` | off | Print actions without writing |
|
|
69
|
+
| `--tag <id>` | `deuk-agent-rule` | Marker id: `<!-- <id>:begin/end -->` |
|
|
70
|
+
| `--agents <mode>` | `inject` | `inject` \| `skip` \| `overwrite` |
|
|
71
|
+
| `--rules <mode>` | `prefix` | `prefix` \| `skip` \| `overwrite` |
|
|
72
|
+
| `--backup` | off | Write `*.bak` before overwrite |
|
|
63
73
|
|
|
64
74
|
### Bundled rules
|
|
65
75
|
|
|
@@ -68,11 +78,11 @@ npx deuk-agent-rule init --backup
|
|
|
68
78
|
|
|
69
79
|
### `merge` (stricter)
|
|
70
80
|
|
|
71
|
-
Same flags;
|
|
81
|
+
Same flags; `AGENTS.md` inject fails without markers unless `--append-if-no-markers`. Default `--rules skip`.
|
|
72
82
|
|
|
73
83
|
### Caveats
|
|
74
84
|
|
|
75
|
-
- Multiple `alwaysApply: true`
|
|
85
|
+
- Multiple `alwaysApply: true` rules all apply — trim duplicates if context grows too large.
|
|
76
86
|
- Do **not** run `init` from `postinstall` without an explicit team decision.
|
|
77
87
|
|
|
78
88
|
## Versioning
|
package/package.json
CHANGED
package/scripts/cli.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { existsSync } from "fs";
|
|
2
|
+
import { existsSync, readFileSync } from "fs";
|
|
3
|
+
import { createInterface } from "readline";
|
|
3
4
|
import { dirname, join } from "path";
|
|
4
5
|
import { fileURLToPath } from "url";
|
|
5
6
|
import {
|
|
@@ -13,9 +14,122 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
13
14
|
const pkgRoot = join(__dirname, "..");
|
|
14
15
|
const bundleRoot = join(pkgRoot, "bundle");
|
|
15
16
|
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Interactive prompt helpers (no external deps)
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
function isNonInteractive(opts) {
|
|
22
|
+
return opts.nonInteractive || process.env.CI || !process.stdin.isTTY;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async function ask(rl, question) {
|
|
26
|
+
return new Promise((resolve) => rl.question(question, resolve));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function selectOne(rl, prompt, choices) {
|
|
30
|
+
console.log("\n" + prompt);
|
|
31
|
+
choices.forEach((c, i) => console.log(` ${i + 1}) ${c.label}`));
|
|
32
|
+
while (true) {
|
|
33
|
+
const ans = (await ask(rl, ` Choice [1-${choices.length}]: `)).trim();
|
|
34
|
+
const idx = parseInt(ans, 10) - 1;
|
|
35
|
+
if (idx >= 0 && idx < choices.length) return choices[idx].value;
|
|
36
|
+
console.log(" Please enter a number between 1 and " + choices.length);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
async function selectMany(rl, prompt, choices) {
|
|
41
|
+
console.log("\n" + prompt + " (comma-separated numbers, or 'all')");
|
|
42
|
+
choices.forEach((c, i) => console.log(` ${i + 1}) ${c.label}`));
|
|
43
|
+
while (true) {
|
|
44
|
+
const ans = (await ask(rl, ` Choices: `)).trim().toLowerCase();
|
|
45
|
+
if (ans === "all" || ans === "") return choices.map((c) => c.value);
|
|
46
|
+
const parts = ans.split(/[,\s]+/).map((s) => parseInt(s, 10) - 1);
|
|
47
|
+
if (parts.every((i) => i >= 0 && i < choices.length)) {
|
|
48
|
+
return parts.map((i) => choices[i].value);
|
|
49
|
+
}
|
|
50
|
+
console.log(" Invalid selection, try again.");
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const STACKS = [
|
|
55
|
+
{ label: "Unity / C#", value: "unity" },
|
|
56
|
+
{ label: "Next.js + C#", value: "nextjs-dotnet" },
|
|
57
|
+
{ label: "Web (React / Vue / general)", value: "web" },
|
|
58
|
+
{ label: "Java / Spring Boot", value: "java" },
|
|
59
|
+
{ label: "Other / skip", value: "other" },
|
|
60
|
+
];
|
|
61
|
+
|
|
62
|
+
const AGENT_TOOLS = [
|
|
63
|
+
{ label: "Cursor", value: "cursor" },
|
|
64
|
+
{ label: "GitHub Copilot", value: "copilot" },
|
|
65
|
+
{ label: "Gemini / Antigravity", value: "gemini" },
|
|
66
|
+
{ label: "All of the above", value: "all" },
|
|
67
|
+
{ label: "Other / skip", value: "other" },
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
async function runInteractive(opts) {
|
|
71
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
72
|
+
try {
|
|
73
|
+
console.log("\nDeukAgentRules init — let's configure your workspace.\n");
|
|
74
|
+
|
|
75
|
+
const stack = await selectOne(rl, "What is your primary tech stack?", STACKS);
|
|
76
|
+
const tools = await selectMany(rl, "Which agent tools do you use?", AGENT_TOOLS);
|
|
77
|
+
|
|
78
|
+
const targetAgents = join(opts.cwd, "AGENTS.md");
|
|
79
|
+
let agentsDefault = "inject";
|
|
80
|
+
if (!existsSync(targetAgents)) {
|
|
81
|
+
agentsDefault = "inject"; // will append markers
|
|
82
|
+
console.log("\n No AGENTS.md found — will create with markers.");
|
|
83
|
+
} else {
|
|
84
|
+
const content = readFileSync(targetAgents, "utf8");
|
|
85
|
+
const hasMarkers = content.includes("deuk-agent-rule:begin");
|
|
86
|
+
if (!hasMarkers) {
|
|
87
|
+
const choice = await selectOne(rl, "AGENTS.md exists but has no markers. How to apply?", [
|
|
88
|
+
{ label: "Append managed block at the end (safe)", value: "inject" },
|
|
89
|
+
{ label: "Overwrite entire AGENTS.md", value: "overwrite" },
|
|
90
|
+
{ label: "Skip AGENTS.md", value: "skip" },
|
|
91
|
+
]);
|
|
92
|
+
agentsDefault = choice;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
opts.agents = opts.agents ?? agentsDefault;
|
|
97
|
+
opts.stack = stack;
|
|
98
|
+
opts.agentTools = tools;
|
|
99
|
+
|
|
100
|
+
console.log("\n Stack : " + stack);
|
|
101
|
+
console.log(" Tools : " + (tools.join(", ") || "none"));
|
|
102
|
+
console.log(" AGENTS: " + opts.agents + "\n");
|
|
103
|
+
} finally {
|
|
104
|
+
rl.close();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// ---------------------------------------------------------------------------
|
|
109
|
+
// Help / arg parsing
|
|
110
|
+
// ---------------------------------------------------------------------------
|
|
111
|
+
|
|
16
112
|
function printHelp() {
|
|
17
113
|
console.log(
|
|
18
|
-
|
|
114
|
+
`DeukAgentRules (npm: deuk-agent-rule) — AGENTS.md + .cursor/rules templates
|
|
115
|
+
|
|
116
|
+
Usage:
|
|
117
|
+
npx deuk-agent-rule init [options] # interactive by default
|
|
118
|
+
npx deuk-agent-rule merge [options]
|
|
119
|
+
|
|
120
|
+
Options:
|
|
121
|
+
--cwd <path> Target repo root (default: current directory)
|
|
122
|
+
--dry-run Print actions; do not write files
|
|
123
|
+
--non-interactive Skip questions; use defaults/flags directly
|
|
124
|
+
--tag <id> Marker id (default: deuk-agent-rule)
|
|
125
|
+
--agents <mode> inject | skip | overwrite
|
|
126
|
+
--rules <mode> prefix | skip | overwrite
|
|
127
|
+
--backup Write *.bak before overwrite
|
|
128
|
+
--append-if-no-markers
|
|
129
|
+
--marker-begin / --marker-end Custom marker strings (both required)
|
|
130
|
+
|
|
131
|
+
Korean: package README.ko.md
|
|
132
|
+
`,
|
|
19
133
|
);
|
|
20
134
|
}
|
|
21
135
|
|
|
@@ -30,6 +144,7 @@ function parseArgs(argv) {
|
|
|
30
144
|
agents: undefined,
|
|
31
145
|
rules: undefined,
|
|
32
146
|
appendIfNoMarkers: false,
|
|
147
|
+
nonInteractive: false,
|
|
33
148
|
};
|
|
34
149
|
for (let i = 0; i < argv.length; i++) {
|
|
35
150
|
const a = argv[i];
|
|
@@ -38,6 +153,7 @@ function parseArgs(argv) {
|
|
|
38
153
|
if (!out.cwd) throw new Error("--cwd requires a path");
|
|
39
154
|
} else if (a === "--dry-run") out.dryRun = true;
|
|
40
155
|
else if (a === "--backup") out.backup = true;
|
|
156
|
+
else if (a === "--non-interactive") out.nonInteractive = true;
|
|
41
157
|
else if (a === "--tag") {
|
|
42
158
|
out.tag = argv[++i];
|
|
43
159
|
if (out.tag == null) throw new Error("--tag requires a value");
|
|
@@ -70,6 +186,10 @@ function validateMode(name, v, allowed) {
|
|
|
70
186
|
}
|
|
71
187
|
}
|
|
72
188
|
|
|
189
|
+
// ---------------------------------------------------------------------------
|
|
190
|
+
// init / merge runners
|
|
191
|
+
// ---------------------------------------------------------------------------
|
|
192
|
+
|
|
73
193
|
function runInit(opts) {
|
|
74
194
|
const markers = resolveMarkers({
|
|
75
195
|
tag: opts.tag,
|
|
@@ -150,7 +270,11 @@ function runMerge(opts) {
|
|
|
150
270
|
}
|
|
151
271
|
}
|
|
152
272
|
|
|
153
|
-
|
|
273
|
+
// ---------------------------------------------------------------------------
|
|
274
|
+
// Entry point
|
|
275
|
+
// ---------------------------------------------------------------------------
|
|
276
|
+
|
|
277
|
+
async function main() {
|
|
154
278
|
const argv = process.argv.slice(2);
|
|
155
279
|
const sub = argv[0];
|
|
156
280
|
if (!sub || sub === "-h" || sub === "--help") {
|
|
@@ -175,13 +299,16 @@ function main() {
|
|
|
175
299
|
|
|
176
300
|
if (!existsSync(bundleRoot)) {
|
|
177
301
|
console.error(
|
|
178
|
-
"Missing bundle/ (run from published package or run npm run sync in
|
|
302
|
+
"Missing bundle/ (run from published package or run npm run sync in DeukAgentRules when developing).",
|
|
179
303
|
);
|
|
180
304
|
process.exit(1);
|
|
181
305
|
}
|
|
182
306
|
|
|
183
307
|
try {
|
|
184
308
|
if (sub === "init") {
|
|
309
|
+
if (!isNonInteractive(opts)) {
|
|
310
|
+
await runInteractive(opts);
|
|
311
|
+
}
|
|
185
312
|
runInit(opts);
|
|
186
313
|
} else if (sub === "merge") {
|
|
187
314
|
runMerge(opts);
|
package/scripts/sync-oss.mjs
CHANGED
|
@@ -29,6 +29,9 @@ mkdirSync(join(ossRoot, "scripts"), { recursive: true });
|
|
|
29
29
|
mkdirSync(join(ossRoot, "publish"), { recursive: true });
|
|
30
30
|
|
|
31
31
|
cpSync(join(pkgRoot, "publish"), join(ossRoot, "publish"), { recursive: true, force: true });
|
|
32
|
+
if (existsSync(join(pkgRoot, ".github"))) {
|
|
33
|
+
cpSync(join(pkgRoot, ".github"), join(ossRoot, ".github"), { recursive: true, force: true });
|
|
34
|
+
}
|
|
32
35
|
cpSync(join(pkgRoot, "scripts", "cli.mjs"), join(ossRoot, "scripts", "cli.mjs"), { force: true });
|
|
33
36
|
cpSync(join(pkgRoot, "scripts", "merge-logic.mjs"), join(ossRoot, "scripts", "merge-logic.mjs"), {
|
|
34
37
|
force: true,
|
|
@@ -42,6 +45,12 @@ if (!existsSync(ossPublic)) {
|
|
|
42
45
|
}
|
|
43
46
|
cpSync(join(pkgRoot, "README.md"), join(ossRoot, "README.md"), { force: true });
|
|
44
47
|
cpSync(join(pkgRoot, "README.ko.md"), join(ossRoot, "README.ko.md"), { force: true });
|
|
48
|
+
if (existsSync(join(pkgRoot, "package-lock.json"))) {
|
|
49
|
+
cpSync(join(pkgRoot, "package-lock.json"), join(ossRoot, "package-lock.json"), { force: true });
|
|
50
|
+
}
|
|
51
|
+
if (existsSync(join(pkgRoot, "LICENSE"))) {
|
|
52
|
+
cpSync(join(pkgRoot, "LICENSE"), join(ossRoot, "LICENSE"), { force: true });
|
|
53
|
+
}
|
|
45
54
|
cpSync(join(ossPublic, "RELEASING.md"), join(ossRoot, "RELEASING.md"), { force: true });
|
|
46
55
|
cpSync(join(ossPublic, "RELEASING.ko.md"), join(ossRoot, "RELEASING.ko.md"), { force: true });
|
|
47
56
|
cpSync(join(ossPublic, "GITHUB_DESCRIPTION.md"), join(ossRoot, "GITHUB_DESCRIPTION.md"), {
|
|
@@ -51,7 +60,7 @@ cpSync(join(ossPublic, "GITHUB_DESCRIPTION.md"), join(ossRoot, "GITHUB_DESCRIPTI
|
|
|
51
60
|
const srcPkg = JSON.parse(readFileSync(join(pkgRoot, "package.json"), "utf8"));
|
|
52
61
|
const outPkg = {
|
|
53
62
|
...srcPkg,
|
|
54
|
-
license: "
|
|
63
|
+
license: srcPkg.license || "Apache-2.0",
|
|
55
64
|
repository: {
|
|
56
65
|
type: "git",
|
|
57
66
|
url: gitUrl,
|