@conscience-technology/ctds

中文文档
0.6.3发布于 2026/10/27MITES Module零依赖近 30 天下载 3408

CTDS — 하이브리드 디자인 시스템 설치 · 온보딩 CLI (shadcn식 코드 생성기)

原始使用文档
文档目录18 节
  1. Requirements
  2. Compatibility and verification
  3. Install (end user)
  4. Options
  5. Local development (contributors)
  6. Publish
  7. Known gaps (resolved before end-to-end stage 2)
  8. 1. tokens.css was not extracted (resolved 2026-10-07)
  9. 2. ThemeController referenced web/app/data.ts (resolved 202…
  10. 3. Copied components used the @/components/* alias (resolve…
  11. 4. OnboardingPage export shape (resolved 2026-10-07)
  12. 5. Dependency compatibility (resolved 2026-10-07)
  13. 6. Server action process.cwd() assumption (resolved 2026-10…
  14. Known small gaps (found during end-to-end testing, non-bloc…
  15. 7. .visually-hidden global utility (resolved)
  16. 8. web/public/onboarding/*.png not copied (resolved)
  17. End-to-end test result (2026-10-07)
  18. License

ctds

Install and onboarding CLI for CTDS, the hybrid design system.

Requirements

  • Node.js 18+
  • A Next.js App Router project (an app/ or src/app/ directory)

Compatibility and verification

The CLI declares Node.js 18+, React >=18.2 <20, and optional Next.js >=14 <17 compatibility. These are declared compatibility ranges, not a fully tested version matrix. Installation currently targets Next.js App Router; Vite is not yet a verified installation target.

Repository CI uses Node.js 24 (including native TypeScript execution in tests) and the exact Next.js/React versions in web/package-lock.json. It runs lint, source/registry/catalog checks, unit tests, TypeScript, the documentation build, gate integration, and isolated tarball installation. Package smoke tests verify packaged assets; they do not yet prove a complete new consumer application build across every declared peer version. Broader consumer/version testing is planned separately.

The release gate uses the exact Playwright Chromium version and runs Core keyboard/state/axe/reflow tests. Ubuntu CI renders exact Templates in smoke mode; a separate macOS 26 arm64 job compares reviewed Core and Template pixel baselines and retains visual diffs/traces on failure. Baselines use deterministic OS fallback fonts with remote requests blocked, and are separated by platform/architecture. Missing baselines fail. These checks do not replace real screen-reader or downloaded-webfont review. See web/tests/quality/README.md in the repository for commands and scope.

Automatic Next.js 16 compatibility fix. The turbopack.rules["*.css"] + @tailwindcss/turbopack combo that create-next-app@latest emits bypasses Turbopack's built-in Lightning CSS CSS Modules path, which makes .module.css class names resolve to undefined. ctds init detects this and automatically:

  1. Removes the turbopack.rules["*.css"] block from next.config.ts
  2. Creates a new postcss.config.mjs and registers the @tailwindcss/postcss plugin
  3. Prints a console fallback explaining how to remove @tailwindcss/turbopack

On Next 15 LTS projects, none of these changes are applied and the setup works as-is.

Install (end user)

cd my-next-app
npx @conscience-technology/ctds init

What init does:

  1. Detects the project (checks package.json plus an app/ directory)
  2. Copies these assets:
    • components/ → components/ctds/ (or src/components/ctds/) (reusable React components plus tokens.css with fonts, tokens, and every axis selector)
    • prompts/ → prompts/
    • .claude/skills/ctds/ → .claude/skills/ctds/
  3. Creates app/ctds/page.tsx (the onboarding route)
  4. Prints two manual steps to the console:
    • Add @import "../components/ctds/tokens.css"; to the top of app/globals.css
    • Wrap app/layout.tsx with <ThemeController>

After install:

npm run dev
# Open http://localhost:3000/ctds, finish onboarding, click "Apply"

Clicking "Apply" writes two files to the project root:

  • ctds.config.json: axis values. Consumed by AI agents (Claude Code and friends) and ThemeController.
  • DESIGN.md: a prose summary of the theme and axes. Read by both humans and AI.

Commit both files. Other developers and AI agents need to read them.

Options

npx @conscience-technology/ctds init           # default
npx @conscience-technology/ctds init --dry     # print planned writes without touching disk
npx @conscience-technology/ctds init --force   # overwrite existing files

Debug:

CTDS_DEBUG=1 npx @conscience-technology/ctds init

Local development (contributors)

For editing and testing the CLI inside the CTDS repo:

cd packages/ctds-cli
npm link                     # symlink the `ctds` binary globally

cd /tmp/test-next-app        # a Next.js project to test against
ctds init --dry              # assets are pulled from the CTDS repo directly (no bundle step needed)

When assets/components is missing, getAssetSources() automatically falls back to the repo root (../../web/components, ../../prompts, ../../.claude/skills/ctds).

Publish

From the repository root:

npm run check:release
npm run pack:cli
npm run verify:cli-tarball

pack:cli regenerates assets before creating packages/ctds-cli/ctds-package.tgz. Verification installs that exact tarball offline and checks the manifest projection, public exports/prompts, catalog, WIP exclusion, and private recipe boundaries. Tag publishing runs the same required quality workflow as PRs, then packs, verifies, and publishes that tarball with lifecycle scripts disabled. Do not repack between verification and publication.

Install the test browser with cd web && npx playwright install chromium. For local Template smoke checks, set CTDS_VISUAL_MODE=smoke; without smoke mode, reviewed platform-specific pixel comparisons run.

Component status and stable IDs are maintained in the root component-manifest.json. After an intentional change, run npm run build:registry; the runtime registry and catalog are generated. Internal runtime helpers remain installed but are excluded from the UI catalog.

Known gaps (resolved before end-to-end stage 2)

Current status. The in-repo /ctds apply flow (stage 1) works. Running ctds init in a separate Next.js project (stage 2) used to break on the gaps below. Each has since been resolved.

1. tokens.css was not extracted (resolved 2026-10-07)

The token and axis selector block (lines 1 to 718) was moved out of web/app/globals.css into web/components/tokens.css, including font loading. After the CLI copies the assets, a single @import "../components/ctds/tokens.css"; at the top of app/globals.css makes CTDS fully active.

2. ThemeController referenced web/app/data.ts (resolved 2026-10-07)

web/app/data.ts was moved wholesale to web/components/_data.ts, carrying both axis types and preset data. Every importer (ThemeController, OnboardingAxisPanel, Icon, and others) now points at @/components/_data or ../_data, so copying components/ carries the data file along automatically.

3. Copied components used the @/components/* alias (resolved 2026-10-07)

All @/components/<name> imports inside components/ were rewritten to relative paths (../<name>). The @/lib/cn and @/lib/color utilities were moved to components/_cn.ts and components/_color.ts and all references updated to relative imports. The copied tree now works regardless of the consumer project's tsconfig aliases.

4. OnboardingPage export shape (resolved 2026-10-07)

The whole onboarding UI moved from web/app/onboarding/ to web/components/Onboarding/. OnboardingPage is now a named export. The CTDS repo's /onboarding route still works via a default-export wrapper. ThemeController and axisOptions moved under web/components/ too. The copied project imports via ../../components/ctds/Onboarding.

5. Dependency compatibility (resolved 2026-10-07)

The CLI now reads the consumer package.json deps and prints an npm install ... command for any missing CTDS runtime packages. See CTDS_RUNTIME_DEPS in src/utils/deps.js. End-to-end tests pass on Next 16 and React 18.3.

6. Server action process.cwd() assumption (resolved 2026-10-07)

findProjectRoot() in actions.ts now walks up from the current working directory and picks the outermost directory that contains package.json. This resolves the right root both for the in-repo test case (web/ vs root) and for end-to-end test projects.


Known small gaps (found during end-to-end testing, non-blocking)

7. .visually-hidden global utility (resolved)

SelectableCard references className="visually-hidden", but that class only lived in globals.css and was therefore not copied. It now lives in a new web/components/_utils.css file that tokens.css pulls in via @import "./_utils.css". Native radio and checkbox inputs are now correctly hidden.

8. web/public/onboarding/*.png not copied (resolved)

Onboarding theme hover previews (pure.png, spare.png, expressive.png) were added to the copy plan. The bundler (bundle-assets.mjs) and the repo fallback (getAssetSources) both include public/onboarding.


End-to-end test result (2026-10-07)

Ran node bin/ctds.js init in a fresh Next.js 16 project, followed the CLI's manual steps, opened /ctds, finished onboarding, and clicked "Apply".

  • Assets copied (components/ctds/, prompts/, .claude/skills/ctds/, public/onboarding/)
  • /ctds/page.tsx created
  • Manual setup printed (globals.css import, layout.tsx wrapper, npm install deps)
  • Dev server rendered correctly (radios, titles, background)
  • Apply wrote ctds.config.json and DESIGN.md to the test project root
  • findProjectRoot() picked cwd (/private/tmp/ctds-e2e) as expected

License

MIT

版本与发布记录

@conscience-technology/ctds 共发布 42 个版本,首次发布于 2026/10/08;过去 12 个月发布了 42 个版本。

版本发布日期距今
0.6.3latest2026/10/2714 天前
0.6.12026/10/2219 天前
0.6.02026/10/2120 天前
0.5.02026/10/1724 天前
0.4.72026/10/1625 天前
0.4.62026/10/1625 天前

关于 @conscience-technology/ctds 的常见问题

@conscience-technology/ctds 是什么?

CTDS — 하이브리드 디자인 시스템 설치 · 온보딩 CLI (shadcn식 코드 생성기)

如何安装 @conscience-technology/ctds?

在项目目录运行 npm install @conscience-technology/ctds,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react(>=18.2.0 <20.0.0)、react-dom(>=18.2.0 <20.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。它还提供命令行工具 ctds,可以用 npx ctds 直接运行。

@conscience-technology/ctds 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/conscience-technology__ctds 是否存在。

@conscience-technology/ctds 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@conscience-technology/ctds 需要什么版本的 Node.js?

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

@conscience-technology/ctds 可以商用吗?

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

@conscience-technology/ctds 的下载量有多少?

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

@conscience-technology/ctds 还在维护吗?

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