agentloopkit 0.24.1 → 0.24.2

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/README.md CHANGED
@@ -39,18 +39,21 @@ Coding agents often move fast but leave reviewers with weak evidence: unclear sc
39
39
 
40
40
  ## Install
41
41
 
42
- Use it with `npx` inside an existing repository:
42
+ Use it with `npx` from the root of the repository you want to configure:
43
43
 
44
44
  ```bash
45
- npx agentloopkit init
45
+ cd /path/to/your/repo
46
46
  npx agentloopkit init --dry-run
47
+ npx agentloopkit init
47
48
  ```
48
49
 
50
+ `init` writes files into the current directory. Do not run it from `~` unless you intend to configure your home directory. `--dry-run` previews the file changes without writing them.
51
+
49
52
  Pin the current version when you need repeatable CI or team setup:
50
53
 
51
54
  ```bash
52
- npx --yes agentloopkit@0.24.1 version
53
- npx --yes agentloopkit@0.24.1 init
55
+ npx --yes agentloopkit@0.24.2 version
56
+ npx --yes agentloopkit@0.24.2 init
54
57
  ```
55
58
 
56
59
  Run the CLI after install:
@@ -112,6 +115,7 @@ pnpm build
112
115
  | --------------------------------------- | ------------------------------------------------------------------------------ |
113
116
  | `agentloop init` | Generate the repo harness and config |
114
117
  | `agentloop init --dry-run` | Preview generated files without writing them |
118
+ | `agentloop init --force` | Allow initialization when the current directory is your home directory |
115
119
  | `agentloop doctor` | Check setup health, template version, commands, git state, and risk categories |
116
120
  | `agentloop create-task` | Create a task contract in `.agentloop/tasks/` |
117
121
  | `agentloop task list` | List task contracts and show the pinned active task |
@@ -380,7 +384,7 @@ See `docs/ci-summary.md`.
380
384
  ```bash
381
385
  agentloop release-notes
382
386
  agentloop release-notes --from v0.19.0 --to HEAD
383
- agentloop release-notes --release-version 0.24.0
387
+ agentloop release-notes --release-version 0.24.2
384
388
  agentloop release-notes --json
385
389
  agentloop release-notes --write
386
390
  ```
@@ -446,7 +450,7 @@ Use `agentloop check-gates --strict` as a review-evidence gate in pull request C
446
450
 
447
451
  CI-generated verification reports include GitHub Actions provenance when available, so reviewers can trace an artifact back to the workflow run that created it.
448
452
 
449
- See `docs/github-actions.md`, `examples/github-actions/`, `examples/gitlab-ci/`, and `examples/buildkite/` for copy-pasteable workflows. Pin `agentloopkit@0.24.1` or a newer vetted release when reproducibility matters.
453
+ See `docs/github-actions.md`, `examples/github-actions/`, `examples/gitlab-ci/`, and `examples/buildkite/` for copy-pasteable workflows. Pin `agentloopkit@0.24.2` or a newer vetted release when reproducibility matters.
450
454
 
451
455
  ## PR Summaries
452
456
 
package/dist/cli/index.js CHANGED
@@ -9,6 +9,7 @@ import { Command } from "commander";
9
9
  // src/core/init.ts
10
10
  import path6 from "path";
11
11
  import { readdir as readdir3 } from "fs/promises";
12
+ import { homedir } from "os";
12
13
 
13
14
  // src/core/constants.ts
14
15
  var PACKAGE_NAME = "agentloopkit";
@@ -196,14 +197,20 @@ async function listFilesRecursive(root, options = {}) {
196
197
  options.ignore ?? [".git", ".agentloop", "node_modules", "dist", "coverage"]
197
198
  );
198
199
  const files = [];
199
- async function walk(current) {
200
+ let inspectedEntries = 0;
201
+ async function walk(current, depth) {
200
202
  if (!await pathExists(current)) return;
203
+ if (options.maxEntries !== void 0 && inspectedEntries >= options.maxEntries) return;
201
204
  const entries = await readdir(current, { withFileTypes: true }).catch(() => []);
202
205
  for (const entry of entries) {
206
+ if (options.maxEntries !== void 0 && inspectedEntries >= options.maxEntries) break;
207
+ inspectedEntries += 1;
203
208
  if (ignore.has(entry.name)) continue;
204
209
  const absolute = path2.join(current, entry.name);
205
210
  if (entry.isDirectory()) {
206
- await walk(absolute);
211
+ if (options.maxDepth === void 0 || depth < options.maxDepth) {
212
+ await walk(absolute, depth + 1);
213
+ }
207
214
  } else if (entry.isFile()) {
208
215
  files.push(absolute);
209
216
  }
@@ -211,7 +218,7 @@ async function listFilesRecursive(root, options = {}) {
211
218
  }
212
219
  const rootStat = await stat(root).catch(() => void 0);
213
220
  if (!rootStat?.isDirectory()) return [];
214
- await walk(root);
221
+ await walk(root, 0);
215
222
  return files;
216
223
  }
217
224
 
@@ -247,6 +254,8 @@ var MONOREPO_FILE_MARKERS = [
247
254
  "lerna.json",
248
255
  "rush.json"
249
256
  ];
257
+ var FALLBACK_PROJECT_DETECTION_MAX_DEPTH = 2;
258
+ var FALLBACK_PROJECT_DETECTION_MAX_ENTRIES = 500;
250
259
  async function readPackageJson(cwd) {
251
260
  const filePath = path4.join(cwd, "package.json");
252
261
  if (!await pathExists(filePath)) return void 0;
@@ -267,7 +276,10 @@ async function detectProjectType(cwd) {
267
276
  if (await pathExists(path4.join(cwd, "pyproject.toml")) || await pathExists(path4.join(cwd, "requirements.txt"))) {
268
277
  return "python";
269
278
  }
270
- const files = await listFilesRecursive(cwd);
279
+ const files = await listFilesRecursive(cwd, {
280
+ maxDepth: FALLBACK_PROJECT_DETECTION_MAX_DEPTH,
281
+ maxEntries: FALLBACK_PROJECT_DETECTION_MAX_ENTRIES
282
+ });
271
283
  const relativeFiles = files.map((file) => path4.relative(cwd, file));
272
284
  const hasCode = relativeFiles.some(
273
285
  (file) => /\.(ts|tsx|js|jsx|py|go|rs|java|rb|php|cs)$/.test(file)
@@ -391,6 +403,12 @@ async function initializeAgentLoop(options) {
391
403
  dryRun: Boolean(options.dryRun)
392
404
  };
393
405
  const cwd = options.cwd;
406
+ const homeDirectory = options.homeDirectory ?? homedir();
407
+ if (!options.dryRun && !options.force && path6.resolve(cwd) === path6.resolve(homeDirectory)) {
408
+ throw new Error(
409
+ "Refusing to initialize your home directory. Run this inside a project repository, or pass --force if you intentionally want AgentLoopKit files in your home directory."
410
+ );
411
+ }
394
412
  const packageManager = await detectPackageManager(cwd);
395
413
  const projectType = await detectProjectType(cwd);
396
414
  const projectName = await detectProjectName(cwd);
@@ -473,8 +491,12 @@ var consoleLogger = {
473
491
 
474
492
  // src/cli/commands/init.ts
475
493
  function initCommand() {
476
- return new Command("init").description("Initialize AgentLoopKit in the current repository").option("--dry-run", "show planned changes without writing files").option("--json", "print machine-readable output").action(async (options) => {
477
- const result = await initializeAgentLoop({ cwd: process.cwd(), dryRun: options.dryRun });
494
+ return new Command("init").description("Initialize AgentLoopKit in the current repository").option("--dry-run", "show planned changes without writing files").option("--json", "print machine-readable output").option("--force", "allow initialization when the current directory is your home directory").action(async (options) => {
495
+ const result = await initializeAgentLoop({
496
+ cwd: process.cwd(),
497
+ dryRun: options.dryRun,
498
+ force: options.force
499
+ });
478
500
  if (options.json) {
479
501
  consoleLogger.info(JSON.stringify(result, null, 2));
480
502
  return;