@ai-driven-dev/cli 3.0.0 → 3.1.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.
Files changed (2) hide show
  1. package/dist/cli.js +109 -78
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1986,7 +1986,7 @@ var CliUpdaterAdapter = class {
1986
1986
  // package.json
1987
1987
  var package_default = {
1988
1988
  name: "@ai-driven-dev/cli",
1989
- version: "3.0.0",
1989
+ version: "3.1.0",
1990
1990
  description: "AI-Driven Development CLI \u2014 distribute the AIDD framework across AI coding assistants",
1991
1991
  type: "module",
1992
1992
  main: "dist/cli.js",
@@ -4992,6 +4992,9 @@ var SetupUseCase = class {
4992
4992
  docsDir = options.docsDir;
4993
4993
  explicitDocsDir = options.docsDir;
4994
4994
  Manifest.validateDocsDir(docsDir);
4995
+ } else if (!options.interactive) {
4996
+ docsDir = Manifest.DEFAULT_DOCS_DIR;
4997
+ explicitDocsDir = "";
4995
4998
  } else {
4996
4999
  const docsDirInput = await this.prompter.input(
4997
5000
  "Documentation directory name:",
@@ -5014,10 +5017,7 @@ var SetupUseCase = class {
5014
5017
  } else {
5015
5018
  const existingManifest = await this.manifestRepo.load();
5016
5019
  const sourceDefault = existingManifest?.repo ?? this.resolver.getDefaultRepo() ?? "";
5017
- const sourceInput = await this.prompter.input(
5018
- "Framework source (owner/repo or local path):",
5019
- sourceDefault
5020
- );
5020
+ const sourceInput = options.interactive ? await this.prompter.input("Framework source (owner/repo or local path):", sourceDefault) : sourceDefault;
5021
5021
  if (sourceInput) {
5022
5022
  if (isLocalPath(sourceInput)) {
5023
5023
  frameworkPath = sourceInput;
@@ -5028,11 +5028,15 @@ var SetupUseCase = class {
5028
5028
  }
5029
5029
  let resolvedRelease = release;
5030
5030
  if (!frameworkPath && !release) {
5031
- const latest = await this.resolver.fetchLatestVersion(frameworkRepo).catch(() => "");
5032
- resolvedRelease = await this.prompter.input(
5033
- latest ? `Framework release tag (latest: ${latest}):` : "Framework release tag:",
5034
- latest
5035
- ) || latest || void 0;
5031
+ if (options.interactive) {
5032
+ const latest = await this.resolver.fetchLatestVersion(frameworkRepo).catch(() => "");
5033
+ resolvedRelease = await this.prompter.input(
5034
+ latest ? `Framework release tag (latest: ${latest}):` : "Framework release tag:",
5035
+ latest
5036
+ ) || latest || void 0;
5037
+ } else {
5038
+ resolvedRelease = await this.resolver.fetchLatestVersion(frameworkRepo).catch(() => void 0);
5039
+ }
5036
5040
  }
5037
5041
  const resolved = await this.frameworkResolver.execute({
5038
5042
  path: frameworkPath,
@@ -5071,6 +5075,14 @@ var SetupUseCase = class {
5071
5075
  }
5072
5076
  async handleAdopt(options) {
5073
5077
  const { projectRoot, repo } = options;
5078
+ if (!options.interactive) {
5079
+ if (!options.toolIds || options.toolIds.length === 0) {
5080
+ throw new Error("--tools <ids> is required for adopt in non-interactive mode.");
5081
+ }
5082
+ if (options.from === void 0) {
5083
+ throw new AdoptRequiresVersionError(repo);
5084
+ }
5085
+ }
5074
5086
  let selected;
5075
5087
  if (options.toolIds !== void 0 && options.toolIds.length > 0) {
5076
5088
  selected = options.toolIds;
@@ -5153,7 +5165,7 @@ var SetupUseCase = class {
5153
5165
  frameworkPath,
5154
5166
  version,
5155
5167
  projectRoot,
5156
- interactive: true,
5168
+ interactive: options.interactive ?? false,
5157
5169
  repo
5158
5170
  });
5159
5171
  if (updateResult.cancelled) {
@@ -5167,7 +5179,8 @@ var SetupUseCase = class {
5167
5179
  frameworkPath,
5168
5180
  version,
5169
5181
  projectRoot,
5170
- repo
5182
+ repo,
5183
+ options.interactive
5171
5184
  );
5172
5185
  return {
5173
5186
  kind: "updated",
@@ -5186,6 +5199,9 @@ var SetupUseCase = class {
5186
5199
  if (missingTools.length === 0) {
5187
5200
  return { kind: "up-to-date", hasAdditionalTools: false };
5188
5201
  }
5202
+ if (!options.interactive) {
5203
+ return { kind: "up-to-date", hasAdditionalTools: true };
5204
+ }
5189
5205
  const wantsMore = await this.prompter.confirm("Install additional tools?");
5190
5206
  if (!wantsMore) {
5191
5207
  return { kind: "up-to-date", hasAdditionalTools: true };
@@ -5209,8 +5225,9 @@ var SetupUseCase = class {
5209
5225
  additionalInstall: { results: installResults }
5210
5226
  };
5211
5227
  }
5212
- async offerAdditionalInstall(hasMissing, frameworkPath, version, projectRoot, repo) {
5228
+ async offerAdditionalInstall(hasMissing, frameworkPath, version, projectRoot, repo, interactive) {
5213
5229
  if (!hasMissing) return void 0;
5230
+ if (!interactive) return void 0;
5214
5231
  const wantsMore = await this.prompter.confirm("Install additional tools?");
5215
5232
  if (!wantsMore) return void 0;
5216
5233
  const installResults = await this.runInstall(
@@ -5292,78 +5309,92 @@ function displayInstall(output, results, verbose) {
5292
5309
  }
5293
5310
  }
5294
5311
  function registerSetupCommand(program2) {
5295
- program2.command("setup").description("Interactively set up or update the project to a correct state").option("--path <path>", "Path to a local framework directory or tarball").option("--release <tag>", "Specific framework release tag to install (e.g., v3.2.0)").action(async (cmdOptions) => {
5296
- if (!process.stdout.isTTY) {
5297
- const output2 = new CLIOutput(false);
5298
- output2.error("aidd setup requires an interactive TTY.");
5299
- process.exit(1);
5300
- }
5301
- const { verbose, repo, output, projectRoot } = parseGlobalOptions(program2);
5302
- try {
5303
- const deps = await createDeps(projectRoot, { verbose, repo }, output);
5304
- const result = await new SetupUseCase(
5305
- deps.fs,
5306
- deps.manifestRepo,
5307
- deps.loader,
5308
- deps.hasher,
5309
- deps.logger,
5310
- deps.git,
5311
- deps.platform,
5312
- deps.prompter,
5313
- deps.resolver,
5314
- deps.authReader
5315
- ).execute({
5316
- projectRoot,
5317
- path: cmdOptions.path,
5318
- release: cmdOptions.release,
5319
- repo,
5320
- interactive: true
5321
- });
5322
- switch (result.kind) {
5323
- case "initialized": {
5324
- output.success(`Initialized docs in ${result.docsDir}/ (${result.fileCount} files)`);
5325
- displayInstall(output, result.install.results, verbose);
5326
- break;
5327
- }
5328
- case "adopted": {
5329
- output.success(
5330
- `Adopted ${result.toolCount} tool(s) at version ${result.version}: ${result.totalRegistered} files registered, ${result.docsRegistered} docs registered`
5331
- );
5332
- break;
5333
- }
5334
- case "installed": {
5335
- displayInstall(output, result.install.results, verbose);
5336
- break;
5337
- }
5338
- case "update-cancelled": {
5339
- output.info("Update cancelled.");
5340
- break;
5312
+ program2.command("setup").description("Set up or update the project to a correct state").option("--path <path>", "Path to a local framework directory or tarball").option("--release <tag>", "Specific framework release tag to install (e.g., v3.2.0)").option("--docs-dir <dir>", "Documentation directory name (default: aidd_docs)").option("--tools <ids>", "Comma-separated tool IDs to install (e.g., claude,cursor)").option("--all-tools", "Install all available tools").option(
5313
+ "--from <version>",
5314
+ "Framework version already installed, required for adopt (e.g., v3.2.0)"
5315
+ ).action(
5316
+ async (cmdOptions) => {
5317
+ const { verbose, repo, output, projectRoot } = parseGlobalOptions(program2);
5318
+ const rawToolIds = cmdOptions.allTools ? [...VALID_TOOL_IDS] : cmdOptions.tools ? cmdOptions.tools.split(",").map((s) => s.trim()) : void 0;
5319
+ if (rawToolIds && rawToolIds.length > 0) {
5320
+ try {
5321
+ assertValidToolIds(rawToolIds);
5322
+ } catch (e) {
5323
+ output.error(e instanceof Error ? e.message : String(e));
5324
+ process.exit(1);
5341
5325
  }
5342
- case "updated": {
5343
- output.success(
5344
- `Updated ${result.totalWritten} files, deleted ${result.totalDeleted} files across ${result.toolCount} tool(s)`
5345
- );
5346
- if (result.additionalInstall) {
5347
- displayInstall(output, result.additionalInstall.results, verbose);
5326
+ }
5327
+ try {
5328
+ const hasScriptingFlags = !!(cmdOptions.allTools || cmdOptions.tools);
5329
+ const interactive = process.stdout.isTTY && !hasScriptingFlags;
5330
+ const deps = await createDeps(projectRoot, { verbose, repo }, output);
5331
+ const result = await new SetupUseCase(
5332
+ deps.fs,
5333
+ deps.manifestRepo,
5334
+ deps.loader,
5335
+ deps.hasher,
5336
+ deps.logger,
5337
+ deps.git,
5338
+ deps.platform,
5339
+ deps.prompter,
5340
+ deps.resolver,
5341
+ deps.authReader
5342
+ ).execute({
5343
+ projectRoot,
5344
+ path: cmdOptions.path,
5345
+ release: cmdOptions.release,
5346
+ repo,
5347
+ interactive,
5348
+ docsDir: cmdOptions.docsDir,
5349
+ toolIds: rawToolIds,
5350
+ from: cmdOptions.from
5351
+ });
5352
+ switch (result.kind) {
5353
+ case "initialized": {
5354
+ output.success(`Initialized docs in ${result.docsDir}/ (${result.fileCount} files)`);
5355
+ displayInstall(output, result.install.results, verbose);
5356
+ break;
5348
5357
  }
5349
- break;
5350
- }
5351
- case "up-to-date": {
5352
- if (result.hasAdditionalTools) {
5353
- output.info("All installed tools are up to date.");
5354
- } else {
5355
- output.info("Project is up to date.");
5358
+ case "adopted": {
5359
+ output.success(
5360
+ `Adopted ${result.toolCount} tool(s) at version ${result.version}: ${result.totalRegistered} files registered, ${result.docsRegistered} docs registered`
5361
+ );
5362
+ break;
5356
5363
  }
5357
- if (result.additionalInstall) {
5358
- displayInstall(output, result.additionalInstall.results, verbose);
5364
+ case "installed": {
5365
+ displayInstall(output, result.install.results, verbose);
5366
+ break;
5367
+ }
5368
+ case "update-cancelled": {
5369
+ output.info("Update cancelled.");
5370
+ break;
5371
+ }
5372
+ case "updated": {
5373
+ output.success(
5374
+ `Updated ${result.totalWritten} files, deleted ${result.totalDeleted} files across ${result.toolCount} tool(s)`
5375
+ );
5376
+ if (result.additionalInstall) {
5377
+ displayInstall(output, result.additionalInstall.results, verbose);
5378
+ }
5379
+ break;
5380
+ }
5381
+ case "up-to-date": {
5382
+ if (result.hasAdditionalTools) {
5383
+ output.info("All installed tools are up to date.");
5384
+ } else {
5385
+ output.info("Project is up to date.");
5386
+ }
5387
+ if (result.additionalInstall) {
5388
+ displayInstall(output, result.additionalInstall.results, verbose);
5389
+ }
5390
+ break;
5359
5391
  }
5360
- break;
5361
5392
  }
5393
+ } catch (error) {
5394
+ output.exit(error);
5362
5395
  }
5363
- } catch (error) {
5364
- output.exit(error);
5365
5396
  }
5366
- });
5397
+ );
5367
5398
  }
5368
5399
 
5369
5400
  // src/application/commands/status.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-driven-dev/cli",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "AI-Driven Development CLI — distribute the AIDD framework across AI coding assistants",
5
5
  "type": "module",
6
6
  "main": "dist/cli.js",