code-ia-sota 0.1.0

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 ADDED
@@ -0,0 +1,26 @@
1
+ # code-ia-sota
2
+
3
+ Agent scaffold installer for `AGENTS.md` and `.agents`.
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ npx code-ia-sota
9
+ ```
10
+
11
+ Installs the canonical `AGENTS.md` and `.agents/` scaffold into the current directory.
12
+
13
+ ## Local development
14
+
15
+ ```sh
16
+ npm install
17
+ npm link
18
+ code-ia-sota
19
+ ```
20
+
21
+ ## Package test
22
+
23
+ ```sh
24
+ npm pack
25
+ npx ./code-ia-sota-0.1.0.tgz
26
+ ```
@@ -0,0 +1,124 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from "node:fs/promises";
4
+ import os from "node:os";
5
+ import path from "node:path";
6
+ import process from "node:process";
7
+
8
+ import fsExtra from "fs-extra";
9
+ import simpleGit from "simple-git";
10
+ import pc from "picocolors";
11
+
12
+ const REPO_URL =
13
+ "https://github.com/wolfox33/Code_IA_SotA.git";
14
+
15
+ const TARGET_DIR = process.cwd();
16
+
17
+ async function exists(filePath) {
18
+ try {
19
+ await fs.access(filePath);
20
+ return true;
21
+ } catch {
22
+ return false;
23
+ }
24
+ }
25
+
26
+ async function cloneTemplate(tmpDir) {
27
+ console.log(pc.cyan("Downloading template..."));
28
+
29
+ await simpleGit().clone(REPO_URL, tmpDir, [
30
+ "--depth",
31
+ "1",
32
+ "--filter=blob:none",
33
+ "--sparse"
34
+ ]);
35
+
36
+ const repoGit = simpleGit(tmpDir);
37
+
38
+ await repoGit.raw([
39
+ "sparse-checkout",
40
+ "set",
41
+ "--no-cone",
42
+ "AGENTS.md",
43
+ ".agents/**"
44
+ ]);
45
+ }
46
+
47
+ async function copyFiles(tmpDir) {
48
+ const sourceAgentsFile =
49
+ path.join(tmpDir, "AGENTS.md");
50
+
51
+ const sourceAgentsDir =
52
+ path.join(tmpDir, ".agents");
53
+
54
+ const targetAgentsFile =
55
+ path.join(TARGET_DIR, "AGENTS.md");
56
+
57
+ const targetAgentsDir =
58
+ path.join(TARGET_DIR, ".agents");
59
+
60
+ if (!(await exists(sourceAgentsFile))) {
61
+ throw new Error(
62
+ "AGENTS.md not found in repository."
63
+ );
64
+ }
65
+
66
+ await fsExtra.copy(
67
+ sourceAgentsFile,
68
+ targetAgentsFile,
69
+ {
70
+ overwrite: true
71
+ }
72
+ );
73
+
74
+ if (await exists(sourceAgentsDir)) {
75
+ await fsExtra.copy(
76
+ sourceAgentsDir,
77
+ targetAgentsDir,
78
+ {
79
+ overwrite: true
80
+ }
81
+ );
82
+ }
83
+ }
84
+
85
+ async function main() {
86
+ const tmpDir = await fs.mkdtemp(
87
+ path.join(os.tmpdir(), "code-ia-sota-")
88
+ );
89
+
90
+ try {
91
+ console.log(
92
+ pc.bold(pc.green("Code IA Sota"))
93
+ );
94
+
95
+ await cloneTemplate(tmpDir);
96
+
97
+ console.log(
98
+ pc.cyan("Installing files...")
99
+ );
100
+
101
+ await copyFiles(tmpDir);
102
+
103
+ console.log(
104
+ pc.green("Installation completed.")
105
+ );
106
+
107
+ console.log("");
108
+ console.log("Created:");
109
+ console.log(" AGENTS.md");
110
+ console.log(" .agents/");
111
+ } finally {
112
+ await fsExtra.remove(tmpDir);
113
+ }
114
+ }
115
+
116
+ main().catch((error) => {
117
+ console.error(
118
+ pc.red("Installation failed.")
119
+ );
120
+
121
+ console.error(error.message);
122
+
123
+ process.exit(1);
124
+ });
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "code-ia-sota",
3
+ "version": "0.1.0",
4
+ "description": "Agent scaffold installer for AGENTS.md and .agents",
5
+ "type": "module",
6
+ "bin": {
7
+ "code-ia-sota": "bin/code-ia-sota.js"
8
+ },
9
+ "files": [
10
+ "bin",
11
+ "README.md"
12
+ ],
13
+ "keywords": [
14
+ "agents",
15
+ "codex",
16
+ "agents-md",
17
+ "ai",
18
+ "llm",
19
+ "scaffold"
20
+ ],
21
+ "license": "MIT",
22
+ "dependencies": {
23
+ "fs-extra": "^11.2.0",
24
+ "picocolors": "^1.1.1",
25
+ "simple-git": "^3.28.0"
26
+ }
27
+ }