@alcops/core

中文文档
0.2.0发布于 2026/09/09MITTypeScriptCommonJS构建来源已验证近 30 天下载 5033

ALCops核心库和CLI - 为商务中心安装TFM检测和分析器

中文使用文档
文档目录12 节
  1. 特征
  2. 安装
  3. 所需资源
  4. CLI 使用量
  5. 实例
  6. 下载命令
  7. 产出
  8. CI/CD 示例(GitHub 动作)
  9. AL 18/BC 29号注解
  10. 程序化 API
  11. 捐款
  12. 许可证

@ alcops/ core (韩语)

CI npm License: MIT

自动检测商务中心的目标框架Moniker(TFM)并下载匹配的代码分析文件. 使用右侧分析器构建 AL 扩展, 不进行手动版本拼接 。 为CI/CD管道所设计.

特征

  • 从四个不同来源检测出TFM:
    • BC 工艺品 URL (例如沙盒或OnPrem文物)
    • VS 市场 (AL语言扩展名)
    • NuGet 开发工具 (微软的 AL 开发工具包)
    • 本地编译器路径 (包含 AL 编译器 DLLs 的目录)
  • 下载和提取 ALCops 分析器 DLLs 检测到的 TFM
  • JSON 输出在 stdout, 日志在 stderr (方便管道)
  • 需要零配置
  • 可用作CLI或节点.js库

安装

# Install globally
npm install -g @alcops/core

# Or run directly with npx
npx @alcops/core detect-tfm marketplace

所需资源

  • 节点.js 20

CLI 使用量

alcops <command> [args]

Commands:
  detect-tfm bc-artifact <url>         Detect TFM from a BC artifact URL
  detect-tfm marketplace [channel|version]     Detect TFM from VS Marketplace (default: current)
  detect-tfm nuget-devtools [version|channel]  Detect TFM from NuGet DevTools (default: latest)
  detect-tfm compiler-path <dir>       Detect TFM from a local compiler directory
  download --output <dir>               Download and extract ALCops analyzers

Download options:
  --output <dir>                       Required. Directory to extract analyzer DLLs into
  --detect-using <input>               TFM detection input (URL, path, channel, or version)
  --tfm <tfm>                          Explicit TFM (skips auto-detection)
  --version <ver>                      ALCops package version (default: latest)
  --detect-from <source>               Force detection source (bc-artifact, marketplace,
                                         nuget-devtools, compiler-path)

Global options:
  --verbose   Enable debug-level logging
  --help      Show this help message

实例

从VS市场检测(最常见的):

alcops detect-tfm marketplace

从特定的 NuGet DevTools 版本检测 :

alcops detect-tfm nuget-devtools 26.0.12345

从 BC 文物 URL 中检测到 :

alcops detect-tfm bc-artifact "https://bcartifacts.azureedge.net/sandbox/26.0.12345.0/us"

从本地编译器目录中检测 :

alcops detect-tfm compiler-path ./path/to/compiler

下载命令

这个 download 命令将 TFM 检测与分析器提取合并为一个步骤.

从 NuGet DevTools 自动检测到的 TFM 下载分析器 :

alcops download --detect-using latest --output ./analyzers

使用 BC 文物 URL 自动检测的 TFM 下载分析器 :

alcops download --detect-using "https://bcartifacts.azureedge.net/sandbox/26.0.12345.0/us" --output ./analyzers

从本地编译器目录下载自动检测的 TFM 分析器 :

alcops download --detect-using ./path/to/compiler --output ./analyzers

带有明确的 TFM( skips 检测) 的下载分析器 :

alcops download --tfm net8.0 --output ./analyzers

下载特定的ALCops版本 :

alcops download --detect-using latest --output ./analyzers --version 1.0.0

强制检测源 --detect-from (覆盖智能路由):

alcops download --detect-using 18.0.2293710 --detect-from marketplace --output ./analyzers

启用调试的动词记录 :

alcops download --detect-using latest --output ./analyzers --verbose

下载输出

{
  "version": "1.0.0",
  "tfm": "net8.0",
  "outputDir": "/absolute/path/to/analyzers",
  "files": [
    "/absolute/path/to/analyzers/ALCops.Analyzers.dll"
  ]
}

产出

所有命令都写出 JSON 命令 :

{
  "tfm": "net8.0",
  "source": "marketplace",
  "details": "AL Language extension v14.0.12345"
}

日志输入 stderr , 这样您就可以安全控制结果 :

TFM=$(alcops detect-tfm marketplace | jq -r '.tfm')
echo "Building with TFM: $TFM"

CI/CD 示例(GitHub 动作)

- name: Detect TFM
  id: tfm
  run: |
    result=$(npx @alcops/core detect-tfm marketplace)
    echo "tfm=$(echo "$result" | jq -r '.tfm')" >> "$GITHUB_OUTPUT"

- name: Use TFM
  run: echo "Target framework is ${{ steps.tfm.outputs.tfm }}"

或者用那个 download 命令,用于单步解决方案 :

- name: Download ALCops Analyzers
  run: npx @alcops/core download --detect-using latest --output ./analyzers --verbose

AL 18/BC 29号注解

  • AL Language 18 VSIX将它的编译二进制平放于 extension/bin/ (无) Analyzers/, (中文(简体) ), win32/, (中文(简体) ), linux/ 或者说 darwin/ 文件夹). 探测器首先探测平面布局并倒回了后遗症路径,因此AL 18+和AL QQ 17的工作都没有改变.
  • 那些二进制目标 净额10.0 并依赖框架:与 AL 18 工具集相编译需要.NET 10运行时间在机器或代理上.
  • 微软DevTools NuGet软件包两艘 net8.0 财务报告和审定财务报表 net10.0 集会。 检测更喜欢最新的TFM,所以 nuget-devtools 报告 net10.0。 。 。 .
  • 如果你的建筑运行 net8.0 工具盘,用鼠标检测 --detect-from compiler-path 或完全跳过检测 --tfm net8.0。 。 。 .

程序化 API

软件包导出所有检测功能用作库 :

import { detectFromMarketplace, createConsoleLogger } from '@alcops/core';

const logger = createConsoleLogger();
const result = await detectFromMarketplace('current', logger);
console.log(result.tfm); // e.g. "net8.0"

见 导出 API 表面 用于完整列出可用的函数和类型.

捐款

见 捐款额 (c) 促进发展的设置和贡献准则.

许可证

麻省理工学院

版本与发布记录

@alcops/core 共发布 4 个版本,首次发布于 2026/04/27;过去 12 个月发布了 4 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.2.0latest2026/09/091 个月前
0.1.22026/04/306 个月前
0.1.12026/04/296 个月前
0.1.02026/04/276 个月前

关于 @alcops/core 的常见问题

@alcops/core 是什么?

ALCops核心库和CLI - 为商务中心安装TFM检测和分析器

如何安装 @alcops/core?

在项目目录运行 npm install @alcops/core,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 alcops,可以用 npx alcops 直接运行。

@alcops/core 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@alcops/core 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@alcops/core 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@alcops/core 可以商用吗?

@alcops/core 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@alcops/core 的下载量有多少?

根据 npm 官方下载统计,@alcops/core 在 2026/10/06 – 2026/11/04 这 30 天内被下载 5,033 次,日均约 168 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@alcops/core 还在维护吗?

最新版本 0.2.0 发布于 2026/09/09(1 个月前);至今共发布 4 个版本,其中过去 12 个月发布了 4 个;首次发布于 2026/04/27。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。