agentic-workflow-manager 3.0.0 → 3.0.1

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.
@@ -50,6 +50,7 @@ const registries_1 = require("../core/registries");
50
50
  const orchestrator_1 = require("../core/init/orchestrator");
51
51
  const steps_1 = require("../core/init/steps");
52
52
  const paths_1 = require("../core/paths");
53
+ const config_1 = require("../utils/config");
53
54
  // ---------------------------------------------------------------------------
54
55
  // Rendering
55
56
  // ---------------------------------------------------------------------------
@@ -91,6 +92,14 @@ function renderInitOutcome(o) {
91
92
  async function runInit(opts = {}) {
92
93
  const cwd = opts.cwd ?? process.cwd();
93
94
  const agent = opts.agent ?? 'claude-code';
95
+ // #7: make init the source of truth for the default agent. Persist the resolved
96
+ // agent so later `awm add`/`awm sync` (which read preferences.defaultAgent) target
97
+ // the right agent instead of stamping the static default. Do NOT clobber an existing
98
+ // explicit preference on a bare re-init: only write when an agent was passed via -a,
99
+ // or when no preferences file exists yet.
100
+ if (opts.agent != null || !(0, config_1.preferencesExist)()) {
101
+ (0, config_1.savePreferences)({ ...(0, config_1.getPreferences)(), defaultAgent: agent });
102
+ }
94
103
  let outcome;
95
104
  try {
96
105
  const mergedActions = {
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.preferencesExist = preferencesExist;
6
7
  exports.getPreferences = getPreferences;
7
8
  exports.savePreferences = savePreferences;
8
9
  // src/utils/config.ts
@@ -10,13 +11,23 @@ const fs_1 = __importDefault(require("fs"));
10
11
  const path_1 = __importDefault(require("path"));
11
12
  const paths_1 = require("../core/paths");
12
13
  const DEFAULT_PREFS = {
13
- defaultAgent: 'antigravity',
14
+ // claude-code matches `awm init`'s own documented default (see init.ts / `awm init --help`).
15
+ // Previously 'antigravity', which silently mis-installed bundles in claude-code
16
+ // environments when `awm add` (the first getPreferences caller) stamped it to disk (#7).
17
+ defaultAgent: 'claude-code',
14
18
  installMethod: 'symlink',
15
19
  defaultScope: 'local'
16
20
  };
17
21
  function prefsDir() {
18
22
  return (0, paths_1.awmHome)();
19
23
  }
24
+ function prefsFile() {
25
+ return path_1.default.join(prefsDir(), 'preferences.json');
26
+ }
27
+ /** True if preferences.json is already on disk (no side effect — does NOT create it). */
28
+ function preferencesExist() {
29
+ return fs_1.default.existsSync(prefsFile());
30
+ }
20
31
  function getPreferences() {
21
32
  const file = path_1.default.join(prefsDir(), 'preferences.json');
22
33
  if (!fs_1.default.existsSync(file)) {
@@ -84,4 +84,24 @@ describe('runInit', () => {
84
84
  expect(parsed.after.overall).toBe('degraded');
85
85
  expect(code).toBe(1);
86
86
  });
87
+ const prefsFile = () => path_1.default.join(process.env.AWM_HOME, 'preferences.json');
88
+ const readAgent = () => JSON.parse(fs_1.default.readFileSync(prefsFile(), 'utf-8')).defaultAgent;
89
+ it('#7: first init (no -a) persists claude-code as the default agent', async () => {
90
+ const { runInit } = require('../../src/commands/init');
91
+ expect(fs_1.default.existsSync(prefsFile())).toBe(false);
92
+ await runInit({ cwd: tmpHome, yes: true, actions: { syncCache: async () => { } } });
93
+ expect(readAgent()).toBe('claude-code');
94
+ });
95
+ it('#7: init -a opencode persists the explicit agent', async () => {
96
+ const { runInit } = require('../../src/commands/init');
97
+ await runInit({ cwd: tmpHome, yes: true, agent: 'opencode', actions: { syncCache: async () => { } } });
98
+ expect(readAgent()).toBe('opencode');
99
+ });
100
+ it('#7: re-init without -a does NOT clobber an existing explicit preference', async () => {
101
+ const { savePreferences } = require('../../src/utils/config');
102
+ savePreferences({ defaultAgent: 'opencode', installMethod: 'symlink', defaultScope: 'local' });
103
+ const { runInit } = require('../../src/commands/init');
104
+ await runInit({ cwd: tmpHome, yes: true, actions: { syncCache: async () => { } } });
105
+ expect(readAgent()).toBe('opencode');
106
+ });
87
107
  });
@@ -18,9 +18,14 @@ describe('Preferences Manager', () => {
18
18
  delete process.env.AWM_HOME;
19
19
  fs_1.default.rmSync(tmpDir, { recursive: true, force: true });
20
20
  });
21
- it('creates default preferences if none exist', () => {
21
+ it('creates default preferences if none exist (default agent is claude-code)', () => {
22
22
  const prefs = (0, config_1.getPreferences)();
23
- expect(prefs.defaultAgent).toBe('antigravity');
23
+ expect(prefs.defaultAgent).toBe('claude-code');
24
+ });
25
+ it('preferencesExist reflects whether the file is on disk', () => {
26
+ expect((0, config_1.preferencesExist)()).toBe(false);
27
+ (0, config_1.getPreferences)(); // side-effect: persists defaults
28
+ expect((0, config_1.preferencesExist)()).toBe(true);
24
29
  });
25
30
  it('saves and loads preferences correctly', () => {
26
31
  (0, config_1.savePreferences)({ defaultAgent: 'opencode', installMethod: 'copy', defaultScope: 'local' });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-workflow-manager",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "main": "dist/src/index.js",
5
5
  "bin": {
6
6
  "awm": "./dist/src/index.js"