@autocodeflow/cli 1.5.2 → 1.5.3

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/dist/config.js CHANGED
@@ -1,33 +1,4 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || function (mod) {
20
- if (mod && mod.__esModule) return mod;
21
- var result = {};
22
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
- __setModuleDefault(result, mod);
24
- return result;
25
- };
26
- var __importDefault = (this && this.__importDefault) || function (mod) {
27
- return (mod && mod.__esModule) ? mod : { "default": mod };
28
- };
29
- Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.showConfig = exports.clearAuth = exports.setRefreshToken = exports.setToken = exports.setApiUrl = exports.getRefreshToken = exports.getToken = exports.getApiUrl = exports.hardenConfigPermissions = exports.getConfigPath = void 0;
31
2
  /**
32
3
  * Persistent config store for the ACF CLI.
33
4
  * Stores API URL and tokens in the user's config directory.
@@ -44,8 +15,8 @@ exports.showConfig = exports.clearAuth = exports.setRefreshToken = exports.setTo
44
15
  * ACF_REFRESH_TOKEN (URL via ACF_API_URL) without ever touching disk —
45
16
  * the recommended mode for CI / cron (see README "CLI 工具 (acf)").
46
17
  */
47
- const conf_1 = __importDefault(require("conf"));
48
- const fs = __importStar(require("fs"));
18
+ import Conf from 'conf';
19
+ import * as fs from 'fs';
49
20
  /** Owner-only (rw-------). Mirrors the private-credential intent of ADR-012. */
50
21
  const CONFIG_FILE_MODE = 0o600;
51
22
  /**
@@ -80,18 +51,17 @@ function createStore() {
80
51
  },
81
52
  };
82
53
  try {
83
- return new conf_1.default({ ...base, configFileMode: CONFIG_FILE_MODE });
54
+ return new Conf({ ...base, configFileMode: CONFIG_FILE_MODE });
84
55
  }
85
56
  catch {
86
- return new conf_1.default(base);
57
+ return new Conf(base);
87
58
  }
88
59
  }
89
60
  const store = createStore();
90
61
  /** Absolute path of the on-disk config file (diagnostics / tests / showConfig). */
91
- function getConfigPath() {
62
+ export function getConfigPath() {
92
63
  return store.path;
93
64
  }
94
- exports.getConfigPath = getConfigPath;
95
65
  /**
96
66
  * SEC-NEW-4: best-effort hardening of an existing config file to owner-only
97
67
  * permissions. conf applies `configFileMode` when it *writes*, but it never
@@ -102,7 +72,7 @@ exports.getConfigPath = getConfigPath;
102
72
  * read-only mounts) and must not break the CLI. Credentials are never moved or
103
73
  * deleted by this repair — only the file mode changes.
104
74
  */
105
- function hardenConfigPermissions() {
75
+ export function hardenConfigPermissions() {
106
76
  try {
107
77
  if (!fs.existsSync(store.path))
108
78
  return;
@@ -114,47 +84,38 @@ function hardenConfigPermissions() {
114
84
  // best-effort: leave the file as-is when the platform refuses the chmod.
115
85
  }
116
86
  }
117
- exports.hardenConfigPermissions = hardenConfigPermissions;
118
87
  // Run once at module load so every CLI invocation repairs a stale mode.
119
88
  hardenConfigPermissions();
120
- function getApiUrl() {
89
+ export function getApiUrl() {
121
90
  return process.env.ACF_API_URL || store.get('apiUrl');
122
91
  }
123
- exports.getApiUrl = getApiUrl;
124
- function getToken() {
92
+ export function getToken() {
125
93
  return process.env.ACF_TOKEN || store.get('token');
126
94
  }
127
- exports.getToken = getToken;
128
- function getRefreshToken() {
95
+ export function getRefreshToken() {
129
96
  return process.env.ACF_REFRESH_TOKEN || store.get('refreshToken');
130
97
  }
131
- exports.getRefreshToken = getRefreshToken;
132
- function setApiUrl(url) {
98
+ export function setApiUrl(url) {
133
99
  store.set('apiUrl', url);
134
100
  }
135
- exports.setApiUrl = setApiUrl;
136
- function setToken(token) {
101
+ export function setToken(token) {
137
102
  store.set('token', token);
138
103
  }
139
- exports.setToken = setToken;
140
- function setRefreshToken(token) {
104
+ export function setRefreshToken(token) {
141
105
  store.set('refreshToken', token);
142
106
  }
143
- exports.setRefreshToken = setRefreshToken;
144
107
  /**
145
108
  * BUG-13: 刷新彻底失败(refresh token 也已过期/被轮换掉)时清除本地凭据,
146
109
  * 后续请求返回到「未登录」状态——避免拿着必死 token 反复打 401。
147
110
  * apiUrl 保留(用户环境不丢)。
148
111
  */
149
- function clearAuth() {
112
+ export function clearAuth() {
150
113
  store.set('token', '');
151
114
  store.set('refreshToken', '');
152
115
  }
153
- exports.clearAuth = clearAuth;
154
- function showConfig() {
116
+ export function showConfig() {
155
117
  console.log('API URL :', getApiUrl());
156
118
  console.log('Token :', getToken() ? '[set]' : '[not set]');
157
119
  console.log('Refresh :', getRefreshToken() ? '[set]' : '[not set]');
158
120
  console.log('Config file:', store.path);
159
121
  }
160
- exports.showConfig = showConfig;
package/dist/index.js CHANGED
@@ -1,9 +1,4 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
2
  /**
8
3
  * ACF CLI — AutoCodeFlow command-line interface
9
4
  *
@@ -23,17 +18,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
18
  * acf audit list
24
19
  * acf config show
25
20
  */
26
- const commander_1 = require("commander");
27
- const chalk_1 = __importDefault(require("chalk"));
28
- const login_1 = require("./commands/login");
29
- const tasks_1 = require("./commands/tasks");
30
- const apps_1 = require("./commands/apps");
31
- const executors_1 = require("./commands/executors");
32
- const deploy_1 = require("./commands/deploy");
33
- const audit_1 = require("./commands/audit");
34
- const exec_1 = require("./commands/exec");
35
- const projects_1 = require("./commands/projects");
36
- const config_1 = require("./config");
21
+ import { Command } from 'commander';
22
+ import chalk from 'chalk';
23
+ import { loginCommand } from './commands/login.js';
24
+ import { tasksCommand } from './commands/tasks.js';
25
+ import { appsCommand } from './commands/apps.js';
26
+ import { executorsCommand } from './commands/executors.js';
27
+ import { deployCommand } from './commands/deploy.js';
28
+ import { auditCommand } from './commands/audit.js';
29
+ import { execCommand } from './commands/exec.js';
30
+ import { projectsCommand } from './commands/projects.js';
31
+ import { showConfig, setApiUrl, setToken } from './config.js';
37
32
  // 版本号单一事实源:直接读 package.json,而不是硬编码字面量。
38
33
  //
39
34
  // 原实现写死 `.version('1.0.0')`,而 package.json 是 `version-guard` 与
@@ -42,11 +37,10 @@ const config_1 = require("./config");
42
37
  // 这是发布物里最不该出错的一处:用户报 issue、我们排查兼容性、`acf` 自身
43
38
  // 做版本相关的行为分支,读的都是这个数。
44
39
  // `resolveJsonModule` 已在 tsconfig 打开;tsc 的 rootDir=src 会把 package.json
45
- // 视为 src 之外的输入,故用 require 走运行时解析(发布物里 package.json 与
46
- // dist/ 同级,路径稳定)。
47
- // eslint-disable-next-line @typescript-eslint/no-var-requires
48
- const pkg = require('../package.json');
49
- const program = new commander_1.Command();
40
+ // 视为 src 之外的输入,故走运行时解析(发布物里 package.json 与 dist/ 同级,
41
+ // 路径稳定)。本包为 ESM(type: module),JSON 导入须带 import attribute。
42
+ import pkg from '../package.json' with { type: 'json' };
43
+ const program = new Command();
50
44
  program
51
45
  .name('acf')
52
46
  .description('AutoCodeFlow CLI — manage tasks, executions, applications and projects')
@@ -63,31 +57,31 @@ program.hook('preAction', (thisCommand) => {
63
57
  process.env['ACF_TOKEN'] = opts.token;
64
58
  });
65
59
  // ---- sub-commands ----
66
- program.addCommand((0, login_1.loginCommand)());
67
- program.addCommand((0, tasks_1.tasksCommand)());
68
- program.addCommand((0, apps_1.appsCommand)());
69
- program.addCommand((0, executors_1.executorsCommand)());
70
- program.addCommand((0, deploy_1.deployCommand)());
71
- program.addCommand((0, audit_1.auditCommand)());
72
- program.addCommand((0, exec_1.execCommand)());
73
- program.addCommand((0, projects_1.projectsCommand)());
60
+ program.addCommand(loginCommand());
61
+ program.addCommand(tasksCommand());
62
+ program.addCommand(appsCommand());
63
+ program.addCommand(executorsCommand());
64
+ program.addCommand(deployCommand());
65
+ program.addCommand(auditCommand());
66
+ program.addCommand(execCommand());
67
+ program.addCommand(projectsCommand());
74
68
  // acf config show / set
75
- const configCmd = new commander_1.Command('config').description('View or update CLI configuration');
76
- configCmd.command('show').description('Show current config').action(() => (0, config_1.showConfig)());
69
+ const configCmd = new Command('config').description('View or update CLI configuration');
70
+ configCmd.command('show').description('Show current config').action(() => showConfig());
77
71
  configCmd.command('set-url <url>').description('Set API base URL').action((url) => {
78
- (0, config_1.setApiUrl)(url);
79
- console.log(chalk_1.default.green(`✔ API URL set to ${url}`));
72
+ setApiUrl(url);
73
+ console.log(chalk.green(`✔ API URL set to ${url}`));
80
74
  });
81
75
  configCmd.command('set-token <token>').description('Set auth token directly').action((token) => {
82
- (0, config_1.setToken)(token);
83
- console.log(chalk_1.default.green('✔ Token saved'));
76
+ setToken(token);
77
+ console.log(chalk.green('✔ Token saved'));
84
78
  });
85
79
  program.addCommand(configCmd);
86
80
  // Better error display
87
81
  program.configureOutput({
88
- outputError: (str, write) => write(chalk_1.default.red(str)),
82
+ outputError: (str, write) => write(chalk.red(str)),
89
83
  });
90
84
  program.parseAsync(process.argv).catch((e) => {
91
- console.error(chalk_1.default.red('Error:'), e instanceof Error ? e.message : String(e));
85
+ console.error(chalk.red('Error:'), e instanceof Error ? e.message : String(e));
92
86
  process.exit(1);
93
87
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autocodeflow/cli",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "AutoCodeFlow CLI — manage tasks, executions and applications from the terminal",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -22,26 +22,28 @@
22
22
  "scripts": {
23
23
  "build": "tsc",
24
24
  "prepublishOnly": "npm run build",
25
- "dev": "ts-node src/index.ts",
25
+ "dev": "tsx src/index.ts",
26
26
  "start": "node dist/index.js",
27
27
  "test": "vitest run",
28
28
  "typecheck": "tsc --noEmit"
29
29
  },
30
30
  "dependencies": {
31
31
  "axios": "1.20.0",
32
- "chalk": "4.1.2",
32
+ "chalk": "^6.0.0",
33
33
  "cli-table3": "0.6.5",
34
- "commander": "12.0.0",
35
- "conf": "10.2.0",
36
- "ora": "5.4.1"
34
+ "commander": "15.0.0",
35
+ "conf": "^15.1.0",
36
+ "ora": "^9.4.1"
37
37
  },
38
38
  "devDependencies": {
39
- "@types/node": "24.13.3",
40
- "ts-node": "10.9.2",
41
- "typescript": "5.4.5",
42
- "vitest": "^3.2.4"
39
+ "@types/node": "24.13.6",
40
+ "typescript": "^5.9.3",
41
+ "vitest": "^5.0.1",
42
+ "tsx": "^4.20.6"
43
43
  },
44
44
  "engines": {
45
- "node": ">=18"
46
- }
45
+ "node": ">=22.12.0"
46
+ },
47
+ "_comment_deps": "版本基线(2026-09 依赖审计 + ESM 迁移):本包为 ESM(type: module,NodeNext 产出)。commander 15 / chalk 6 / ora 9 / conf 15 均为 npm 最新;chalk 6 要求 Node >=22,engines 相应抬至 >=22.12.0(commander 15 同要求)。conf 15 保留 configFileMode/defaults/cwd 语义(config.ts 凭据文件 0600 权限与用户目录布局不变)。",
48
+ "type": "module"
47
49
  }