@kienha/anti-chaotic 1.0.0 → 1.0.2

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.
Files changed (2) hide show
  1. package/bin/ag.js +16 -108
  2. package/package.json +2 -2
package/bin/ag.js CHANGED
@@ -5,64 +5,30 @@ const fs = require("fs-extra");
5
5
  const path = require("path");
6
6
  const chalk = require("chalk");
7
7
 
8
- const tiged = require("tiged");
9
-
10
8
  program.version("0.0.1").description("Anti-Chaotic Agent Kit CLI");
11
9
 
12
10
  const REPO_URI = "kienhaminh/anti-chaotic/.agent";
13
11
 
14
12
  program
15
13
  .command("init")
16
- .description("Initialize the Anti-Chaotic framework structure (local copy)")
17
- .option(
18
- "-r, --remote",
19
- "Fetch from remote GitHub repository instead of local package",
20
- )
21
- .action(async (cmd) => {
14
+ .description("Initialize the Anti-Chaotic Agent Kit (download from GitHub)")
15
+ .action(async () => {
22
16
  const projectRoot = process.cwd();
23
- const sourceAgentDir = path.join(__dirname, "..", ".agent");
24
17
  const targetAgentDir = path.join(projectRoot, ".agent");
25
18
 
26
19
  try {
27
- console.log(chalk.blue("Initializing Anti-Chaotic framework..."));
20
+ console.log(chalk.blue("Initializing Anti-Chaotic Agent Kit..."));
21
+ console.log(chalk.yellow(`Fetching from GitHub: ${REPO_URI}...`));
28
22
 
29
- if (cmd.remote) {
30
- console.log(chalk.yellow(`Fetching from GitHub: ${REPO_URI}...`));
31
- const emitter = tiged(REPO_URI, {
32
- disableCache: true,
33
- force: true,
34
- mode: "git",
35
- });
23
+ const { downloadTemplate } = await import("giget");
24
+ await downloadTemplate(`github:${REPO_URI}`, {
25
+ dir: targetAgentDir,
26
+ force: true,
27
+ });
36
28
 
37
- await emitter.clone(targetAgentDir);
38
- console.log(chalk.green("✔ Successfully fetched .agent from GitHub."));
39
- } else {
40
- // Local Copy
41
- if (!(await fs.pathExists(sourceAgentDir))) {
42
- // Fallback to remote if local not found (e.g. npx cache issue), though unlikely in packaged env
43
- console.log(
44
- chalk.yellow("Local source not found, attempting remote fetch..."),
45
- );
46
- const emitter = tiged(REPO_URI, {
47
- disableCache: true,
48
- force: true,
49
- mode: "git",
50
- });
51
- await emitter.clone(targetAgentDir);
52
- console.log(
53
- chalk.green(
54
- "✔ Successfully fetched .agent from GitHub (fallback).",
55
- ),
56
- );
57
- } else {
58
- await fs.copy(sourceAgentDir, targetAgentDir, { overwrite: true });
59
- console.log(
60
- chalk.green(
61
- "✔ Successfully installed .agent configuration from local package.",
62
- ),
63
- );
64
- }
65
- }
29
+ console.log(
30
+ chalk.green("✔ Successfully installed Anti-Chaotic Agent Kit."),
31
+ );
66
32
 
67
33
  console.log(chalk.dim(` Location: ${targetAgentDir}`));
68
34
  } catch (err) {
@@ -78,17 +44,15 @@ program
78
44
 
79
45
  try {
80
46
  console.log(
81
- chalk.blue(`Updating Anti-Chaotic framework from ${REPO_URI}...`),
47
+ chalk.blue(`Updating Anti-Chaotic Agent Kit from ${REPO_URI}...`),
82
48
  );
83
49
 
84
- const emitter = tiged(REPO_URI, {
85
- disableCache: true,
50
+ const { downloadTemplate } = await import("giget");
51
+ await downloadTemplate(`github:${REPO_URI}`, {
52
+ dir: targetAgentDir,
86
53
  force: true,
87
- mode: "git",
88
54
  });
89
55
 
90
- await emitter.clone(targetAgentDir);
91
-
92
56
  console.log(chalk.green("✔ Successfully updated .agent from GitHub."));
93
57
  console.log(chalk.dim(` Location: ${targetAgentDir}`));
94
58
  } catch (err) {
@@ -96,60 +60,4 @@ program
96
60
  }
97
61
  });
98
62
 
99
- program
100
- .command("add <type> <name>")
101
- .description("Add a new component (skill, rule, or workflow)")
102
- .action(async (type, name) => {
103
- const agentDir = path.join(process.cwd(), ".agent");
104
-
105
- if (!(await fs.pathExists(agentDir))) {
106
- console.error(
107
- chalk.red(
108
- '✘ Documentation framework not initialized. Run "ag init" first.',
109
- ),
110
- );
111
- return;
112
- }
113
-
114
- try {
115
- if (type === "skill") {
116
- const skillDir = path.join(agentDir, "skills", name);
117
- await fs.ensureDir(skillDir);
118
- await fs.ensureDir(path.join(skillDir, "scripts"));
119
- await fs.writeFile(
120
- path.join(skillDir, "SKILL.md"),
121
- `# ${name} Skill\n\nDescription of the ${name} skill.\n`,
122
- );
123
- console.log(
124
- chalk.green(`✔ Added skill: ${name} at .agent/skills/${name}`),
125
- );
126
- } else if (type === "workflow") {
127
- const workflowFile = path.join(agentDir, "workflows", `${name}.md`);
128
- await fs.writeFile(
129
- workflowFile,
130
- `---\ndescription: ${name} workflow\n---\n\n1. Step one\n2. Step two\n`,
131
- );
132
- console.log(
133
- chalk.green(
134
- `✔ Added workflow: ${name} at .agent/workflows/${name}.md`,
135
- ),
136
- );
137
- } else if (type === "rule") {
138
- const ruleFile = path.join(agentDir, "rules", `${name}.md`);
139
- await fs.writeFile(ruleFile, `# ${name} Rules\n\n- Rule 1\n`);
140
- console.log(
141
- chalk.green(`✔ Added rule: ${name} at .agent/rules/${name}.md`),
142
- );
143
- } else {
144
- console.error(
145
- chalk.red(
146
- `✘ Unknown type: ${type}. Use "skill", "rule", or "workflow".`,
147
- ),
148
- );
149
- }
150
- } catch (err) {
151
- console.error(chalk.red("✘ Error adding component:"), err.message);
152
- }
153
- });
154
-
155
63
  program.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kienha/anti-chaotic",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Anti-Chaotic - An agent kit for Antigravity to standardize the software development process",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
@@ -37,6 +37,6 @@
37
37
  "chalk": "^4.1.2",
38
38
  "commander": "^14.0.2",
39
39
  "fs-extra": "^11.3.3",
40
- "tiged": "^2.12.7"
40
+ "giget": "^2.0.0"
41
41
  }
42
42
  }