oneagent 0.1.0 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oneagent",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "description": "One source of truth for AI agent rules — distributed via symlinks to Claude, Cursor, Windsurf, Copilot, OpenCode",
6
6
  "license": "MIT",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@clack/prompts": "latest",
26
- "@moskala/oneagent-core": "0.1.0",
26
+ "@moskala/oneagent-core": "workspace:*",
27
27
  "citty": "latest"
28
28
  },
29
29
  "devDependencies": {
@@ -1,6 +1,9 @@
1
+ import path from "path";
2
+ import fs from "fs/promises";
1
3
  import { defineCommand } from "citty";
2
- import { spinner } from "@clack/prompts";
3
- import { readConfig, generate } from "@moskala/oneagent-core";
4
+ import { confirm, isCancel, note, outro, spinner } from "@clack/prompts";
5
+ import { warnDeprecatedCommandFiles } from "../utils.ts";
6
+ import { readConfig, generate, detectGenerateCollisions, migrateRuleAndSkillFiles } from "@moskala/oneagent-core";
4
7
 
5
8
  export default defineCommand({
6
9
  meta: {
@@ -18,6 +21,36 @@ export default defineCommand({
18
21
  process.exit(1);
19
22
  }
20
23
 
24
+ const { mainFiles, ruleSkillFiles } = await detectGenerateCollisions(root, config);
25
+
26
+ // Auto-backup main instruction files (CLAUDE.md, AGENTS.md, etc.) — no prompt
27
+ if (mainFiles.length > 0) {
28
+ const backupDir = path.join(root, ".oneagent/backup");
29
+ await fs.mkdir(backupDir, { recursive: true });
30
+ for (const file of mainFiles) {
31
+ const safeName = file.relativePath.replace(/\//g, "_");
32
+ await Bun.write(path.join(backupDir, safeName), file.content);
33
+ }
34
+ }
35
+
36
+ await warnDeprecatedCommandFiles(root);
37
+
38
+ // Prompt only for rule/skill files
39
+ if (ruleSkillFiles.length > 0) {
40
+ note(
41
+ ruleSkillFiles.map((f) => ` • ${f.relativePath}`).join("\n"),
42
+ "These rule/skill files are not dotai symlinks",
43
+ );
44
+ const proceed = await confirm({
45
+ message: "Move them to .oneagent/ and replace with symlinks?",
46
+ });
47
+ if (isCancel(proceed) || !proceed) {
48
+ outro("Aborted.");
49
+ process.exit(0);
50
+ }
51
+ await migrateRuleAndSkillFiles(root);
52
+ }
53
+
21
54
  const s = spinner();
22
55
  s.start("Generating...");
23
56
 
@@ -11,13 +11,16 @@ import {
11
11
  } from "@clack/prompts";
12
12
  import path from "path";
13
13
  import fs from "fs/promises";
14
- import { timeAgo } from "../utils.ts";
14
+ import { timeAgo, warnDeprecatedCommandFiles } from "../utils.ts";
15
15
  import {
16
16
  configExists,
17
17
  writeConfig,
18
+ makeTargets,
18
19
  detectExistingFiles,
19
20
  filesHaveSameContent,
20
21
  generate,
22
+ migrateRuleAndSkillFiles,
23
+ removeDeprecatedFiles,
21
24
  type AgentTarget,
22
25
  type Config,
23
26
  type DetectedFile,
@@ -146,7 +149,7 @@ export default defineCommand({
146
149
 
147
150
  const detected = await detectExistingFiles(root);
148
151
  const content = await chooseContent(detected);
149
- const targets = await pickTargets();
152
+ const selectedTargets = await pickTargets();
150
153
 
151
154
  const s = spinner();
152
155
  s.start("Setting up .oneagent/ directory...");
@@ -155,8 +158,12 @@ export default defineCommand({
155
158
  await fs.mkdir(path.join(root, ".oneagent/skills"), { recursive: true });
156
159
 
157
160
  await backupFiles(root, detected);
161
+ await removeDeprecatedFiles(root);
162
+ await warnDeprecatedCommandFiles(root);
158
163
 
159
- const config: Config = { version: 1, targets };
164
+ await migrateRuleAndSkillFiles(root);
165
+
166
+ const config: Config = { version: 1, targets: makeTargets(...selectedTargets) };
160
167
  await writeConfig(root, config);
161
168
 
162
169
  const instructionsContent =
@@ -174,7 +181,7 @@ export default defineCommand({
174
181
  const lines = [
175
182
  "Created .oneagent/instructions.md",
176
183
  "Created .oneagent/rules/oneagent.md",
177
- ...targets.map((t) => `Configured: ${t}`),
184
+ ...selectedTargets.map((t) => `Configured: ${t}`),
178
185
  ...(detected.length > 0
179
186
  ? [`Backed up ${detected.length} file(s) to .oneagent/backup/`]
180
187
  : []),
@@ -1,5 +1,5 @@
1
1
  import { defineCommand } from "citty";
2
- import { readConfig, checkStatus } from "@moskala/oneagent-core";
2
+ import { readConfig, checkStatus, activeTargets } from "@moskala/oneagent-core";
3
3
 
4
4
  export default defineCommand({
5
5
  meta: {
@@ -35,7 +35,7 @@ export default defineCommand({
35
35
  }
36
36
  }
37
37
 
38
- if (config.targets.includes("opencode")) {
38
+ if (activeTargets(config).includes("opencode")) {
39
39
  const { opencode } = status;
40
40
  const icon = !opencode.exists ? "✗" : opencode.valid ? "✓" : "⚠";
41
41
  const text = !opencode.exists ? "missing" : opencode.valid ? "valid" : "invalid";
package/src/index.ts CHANGED
File without changes
package/src/utils.ts CHANGED
@@ -1,3 +1,16 @@
1
+ import { note } from "@clack/prompts";
2
+ import { detectDeprecatedCommandFiles } from "@moskala/oneagent-core";
3
+
4
+ export async function warnDeprecatedCommandFiles(root: string): Promise<void> {
5
+ const deprecated = await detectDeprecatedCommandFiles(root);
6
+ if (deprecated.length === 0) return;
7
+ note(
8
+ deprecated.map((f) => ` • ${f}`).join("\n") +
9
+ "\n\n Move them to .oneagent/skills/ to manage them with oneagent.",
10
+ ".claude/commands/ is deprecated — use .oneagent/skills/ instead",
11
+ );
12
+ }
13
+
1
14
  export function timeAgo(date: Date): string {
2
15
  const seconds = Math.floor((Date.now() - date.getTime()) / 1000);
3
16
  if (seconds < 60) return `${seconds}s ago`;