@sabaiway/agent-workflow-kit 14.44.0 → 14.45.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,27 @@ Semantically versioned ([semver](https://semver.org)), newest first. The `versio
4
4
  is the current release. `upgrade` mode reads a project's `docs/ai/.workflow-version` and applies
5
5
  every `migrations/<version>-<slug>.md` newer than it, in semver order.
6
6
 
7
+ ## 14.45.0 — the kit's search and plan checks no longer walk into the folder of kept-aside copies (AD-197)
8
+
9
+ **A kept-aside copy no longer shows up beside the live file.** Since 14.44.0 the upgrade keeps a replaced edit at
10
+ `.agent-workflow/kept-aside/<16 hex>/<path>`. The kit's literal search (`tools/repo-search.mjs`, the MCP `repo_search`
11
+ tool) walked into that folder, so a project-wide search returned the stale copy next to the live file and an agent
12
+ could read or edit the wrong one; the plan-shape check walked into it too, so a short anchor such as
13
+ `check-docs-size.mjs` could match the copy as well as the live `scripts/check-docs-size.mjs`.
14
+
15
+ - **The search's walk never enters `.git`, `node_modules` or `.agent-workflow`, at any depth**, unless that folder or a
16
+ path inside it is named as a target (`--path`, `--paths-file`, the MCP `paths` field); below a named target the rule
17
+ applies again. A regular file with one of those names is still searched, and a symlink the walk meets is still a
18
+ counted skip. `--help` and the MCP `repo_search` `paths` description name the three folders.
19
+ - **The plan-shape checks never walk into those folders either**, for anchor candidates, the pin search and sweep
20
+ expansion; they have no named exemption.
21
+ - **One list.** `tools/repo-lex.mjs` exports `RESERVED_DIR` and `NEVER_WALKED`; the search and the plan-shape walk
22
+ import `NEVER_WALKED`, and the kept-aside writer imports `RESERVED_DIR`.
23
+ - **`--help` and `-h` are read only at a flag position.** Before, they were read anywhere in the arguments, so MCP
24
+ `repo_search {"pattern": "--help"}` answered with the help text and searched nothing; a pattern or a target spelled
25
+ `--help` is now searched. An unknown argument beside `--help` is a usage error.
26
+ - Contracts: repo-search revision 1 (new; the search had none), plan-review-loop revision 12.
27
+
7
28
  ## 14.44.0 — before the upgrade replaces a spec-layer file you edited, it keeps your edit aside and names it, under one replace block (AD-196)
8
29
 
9
30
  **An edited spec-layer script is no longer lost on the upgrade's yes.** Before the bundled body replaces it, the
package/SKILL.md CHANGED
@@ -3,7 +3,7 @@ name: agent-workflow-kit
3
3
  description: Deploy or upgrade a portable AI-agent memory-and-workflow system in any project. Use when the user wants to bootstrap `docs/ai/` + an entry-point `AGENTS.md` (+ `CLAUDE.md` alias) + cap/archive/index enforcement in a new or existing repo, set up the Memory Map and session protocols, install the docs-rotation pre-commit hook, or run `/agent-workflow-kit` / `/agent-workflow-kit upgrade`. Triggers on phrases like "set up the memory system", "deploy the AI workflow here", "bootstrap docs/ai", "upgrade the workflow". New to the epic, story and task tier? Run `/agent-workflow-kit tier`. A typed decision with a confidence from Jev? Run `/agent-workflow-kit jev`.
4
4
  disable-model-invocation: true
5
5
  metadata:
6
- version: '14.44.0'
6
+ version: '14.45.0'
7
7
  ---
8
8
 
9
9
  # agent-workflow-kit
package/capability.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "schema": 1,
4
4
  "name": "agent-workflow-kit",
5
5
  "kind": "composition-root",
6
- "version": "14.44.0",
6
+ "version": "14.45.0",
7
7
  "provides": [],
8
8
  "roles": {},
9
9
  "detect": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sabaiway/agent-workflow-kit",
3
- "version": "14.44.0",
3
+ "version": "14.45.0",
4
4
  "description": "Portable, cross-agent memory & workflow for AI coding agents — Claude Code, Codex, Cursor, Devin Desktop. One command deploys an AGENTS.md entry point + docs/ai context with cap/archive/index enforcement into any repo.",
5
5
  "keywords": [
6
6
  "ai-agents",
@@ -44,7 +44,7 @@ diverge:
44
44
 
45
45
  The kit's OWN footprint (`KIT_OWN_PATHS`) — `AGENTS.md`, `CLAUDE.md`, `docs/ai/` (subsumes the stamp), the added `scripts/*.mjs`, `docs/plans/`, `.claude/settings.local.json`, `.claude/settings.json` (hidden-only — visible mode commits it), and `.mcp.json` (the `mcp` mode's registration; hidden-only for the same reason, and it carries an absolute machine path) — is always a candidate in hidden mode.
46
46
 
47
- `.agent-workflow/` is the family's reserved folder. Before an upgrade replaces a kit file the user edited, it keeps the edit there, unchanged, at `.agent-workflow/kept-aside/<16 hex>/<path>`; the folder's own `.gitignore` (`*`) keeps git from seeing the copies in either visibility mode. The copies are the user's, outside the kit's own paths: no kit tool overwrites, deletes or hides them.
47
+ `.agent-workflow/` is the family's reserved folder. Before an upgrade replaces a kit file the user edited, it keeps the edit there, unchanged, at `.agent-workflow/kept-aside/<16 hex>/<path>`; the folder's own `.gitignore` (`*`) keeps git from seeing the copies in either visibility mode. The copies are the user's, outside the kit's own paths: no kit tool overwrites, deletes or hides them. The kit's literal search never walks into the reserved `.agent-workflow` folder, at any depth, unless that folder or a path inside it is named as a target, and the plan-shape checks never walk into it, so an unnamed kept-aside copy never stands beside the live file in their results.
48
48
 
49
49
  Not in this version: a fully-external hidden mode (artifacts relocated outside the repo tree).
50
50
  Deferred to a later release + migration.
@@ -12,8 +12,8 @@ import { lstatSync, readFileSync } from 'node:fs';
12
12
  import { createHash } from 'node:crypto';
13
13
  import { join } from 'node:path';
14
14
  import { lstatNoFollow, writeProjectFileCreateOnly } from '../atomic-write.mjs';
15
+ import { RESERVED_DIR } from '../repo-lex.mjs';
15
16
 
16
- const RESERVED_DIR = '.agent-workflow';
17
17
  export const KEPT_ASIDE_DIR = `${RESERVED_DIR}/kept-aside`;
18
18
  const IGNORE_REL = `${RESERVED_DIR}/.gitignore`;
19
19
  const IGNORE_BODY = '*\n';
@@ -29,6 +29,7 @@ import {
29
29
  HARD_MAX_FILE_BYTES,
30
30
  HARD_MAX_TOTAL_BYTES as SEARCH_HARD_MAX_TOTAL_BYTES,
31
31
  } from './repo-search.mjs';
32
+ import { NEVER_WALKED } from './repo-lex.mjs';
32
33
 
33
34
  export const SERVER_NAME = 'agent-workflow';
34
35
  const EXIT_OK = 0;
@@ -82,7 +83,7 @@ export const TOOLS = Object.freeze([
82
83
  required: ['pattern'],
83
84
  properties: {
84
85
  pattern: { type: 'string', minLength: 1, description: 'The literal bytes to find; multiline allowed.' },
85
- paths: pathList('Project-relative search targets (default: the whole root).'),
86
+ paths: pathList(`Project-relative search targets (default: the whole root). The walk never enters ${NEVER_WALKED.join(', ')} at any depth unless that folder or a path inside it is named here; below a named target the rule applies again.`),
86
87
  max: count(HARD_MAX_RESULTS, 'Result ceiling.'),
87
88
  maxBytes: count(HARD_MAX_FILE_BYTES, 'Per-file byte ceiling.'),
88
89
  maxTotalBytes: count(SEARCH_HARD_MAX_TOTAL_BYTES, 'Whole-call byte ceiling.'),
@@ -8,10 +8,10 @@ import { listStories } from './claim-relation.mjs';
8
8
  import { EPICS_REL, readEpicStore } from './epic-store.mjs';
9
9
  import { sweepSiblings } from './epic-shape-ledger.mjs';
10
10
  import { PIN_FILE } from './plan-shape-ownership.mjs';
11
+ import { NEVER_WALKED } from './repo-lex.mjs';
11
12
 
12
13
  const SOURCE_SIZE_REL = 'docs/ai/source-size.json';
13
14
  const PACKAGE_FILE = 'package.json';
14
- const EXCLUDED_DIRECTORIES = new Set(['.git', 'node_modules']);
15
15
  const NEGATED_CLASS = /\[[!^]/;
16
16
  const UNSUPPORTED_GLOB = /[()\\\u0000-\u001f]/;
17
17
  const STORE_REFUSED = 'refused';
@@ -38,7 +38,7 @@ const walkRegularFiles = (root, directory = root) => readdirSync(directory, { wi
38
38
  .flatMap((entry) => {
39
39
  const path = join(directory, entry.name);
40
40
  const rel = toPosix(relative(root, path));
41
- if (entry.isDirectory() && !EXCLUDED_DIRECTORIES.has(entry.name)) return walkRegularFiles(root, path);
41
+ if (entry.isDirectory() && !NEVER_WALKED.includes(entry.name)) return walkRegularFiles(root, path);
42
42
  return entry.isFile() ? [rel] : [];
43
43
  });
44
44
 
@@ -18,6 +18,10 @@ export const lexicalRepoRelative = (rel) => {
18
18
  return { ok: true };
19
19
  };
20
20
 
21
+ // ONE home of the family's reserved folder and of the names no repository walk enters (spec repo-search).
22
+ export const RESERVED_DIR = '.agent-workflow';
23
+ export const NEVER_WALKED = Object.freeze(['.git', 'node_modules', RESERVED_DIR]);
24
+
21
25
  // POSIX single-quote for pasteable command rendering (display only — never an execution boundary).
22
26
  export const shellQuoteArg = (s) => (/^[A-Za-z0-9_/.\-]+$/.test(s) ? s : `'${s.replace(/'/g, `'\\''`)}'`);
23
27
 
@@ -51,6 +51,7 @@ import { openSync, fstatSync, readSync, closeSync, opendirSync, realpathSync, ls
51
51
  import { createHash } from 'node:crypto';
52
52
  import { join, resolve, relative, isAbsolute, sep } from 'node:path';
53
53
  import { isDirectRun } from './direct-run.mjs';
54
+ import { NEVER_WALKED } from './repo-lex.mjs';
54
55
 
55
56
  export const EXIT_OK = 0;
56
57
  export const EXIT_ERROR = 1;
@@ -80,7 +81,6 @@ const BINARY_SNIFF_BYTES = 8192;
80
81
  // cap the stored size per match is a constant, so no size of pattern or file can grow it.
81
82
  const SNIPPET_CONTEXT = 200;
82
83
  const SNIPPET_MAX = 512;
83
- const NEVER_WALKED = Object.freeze(['.git', 'node_modules']);
84
84
  // O_NOFOLLOW refuses a symlinked leaf at open time; O_NONBLOCK means a FIFO that slipped in returns
85
85
  // instead of hanging. Both are POSIX; on a platform lacking them the flags degrade to 0 and the
86
86
  // fstat check below is the remaining guard.
@@ -123,7 +123,7 @@ export const parseCount = (raw, flag, ceiling) => {
123
123
  };
124
124
 
125
125
  const parseArgs = (argv) => {
126
- const opts = { pattern: null, patternFile: null, paths: [], pathsFile: null, max: DEFAULT_MAX_RESULTS, maxBytes: DEFAULT_MAX_FILE_BYTES, maxTotalBytes: DEFAULT_MAX_TOTAL_BYTES, json: false };
126
+ const opts = { help: false, pattern: null, patternFile: null, paths: [], pathsFile: null, max: DEFAULT_MAX_RESULTS, maxBytes: DEFAULT_MAX_FILE_BYTES, maxTotalBytes: DEFAULT_MAX_TOTAL_BYTES, json: false };
127
127
  for (let i = 0; i < argv.length; i += 1) {
128
128
  const arg = argv[i];
129
129
  const next = () => {
@@ -139,8 +139,10 @@ const parseArgs = (argv) => {
139
139
  else if (arg === '--max-bytes') opts.maxBytes = parseCount(next(), '--max-bytes', HARD_MAX_FILE_BYTES);
140
140
  else if (arg === '--max-total-bytes') opts.maxTotalBytes = parseCount(next(), '--max-total-bytes', HARD_MAX_TOTAL_BYTES);
141
141
  else if (arg === '--json') opts.json = true;
142
+ else if (arg === '--help' || arg === '-h') opts.help = true;
142
143
  else throw new UsageError(`unknown argument: ${arg} (see --help)`);
143
144
  }
145
+ if (opts.help) return opts;
144
146
  if (opts.pattern !== null && opts.patternFile !== null) {
145
147
  throw new UsageError('--pattern and --pattern-file are mutually exclusive — the lane must be unambiguous');
146
148
  }
@@ -520,6 +522,9 @@ are done — this tool never writes. --paths-file format: one target per line, U
520
522
  lines ignored; duplicates collapse; no comment syntax and no escaping, so a filename containing a
521
523
  newline cannot be expressed by this lane. Both lane files are excluded from the search itself.
522
524
 
525
+ The walk never enters a directory named ${NEVER_WALKED.join(', ')}, at any depth, unless that folder
526
+ or a path inside it is named as a target; below a named target the rule applies again.
527
+
523
528
  LITERAL only, multiline patterns supported. Reads regular files only, opened no-follow. Skipped
524
529
  entries (symlinks, non-regular, binary, oversized, unreadable) are counted and reported, never
525
530
  dropped silently; an oversized file additionally makes the whole search INCOMPLETE.
@@ -529,9 +534,9 @@ Exit codes: 0 search completed (matches or an explicitly empty result) · 1 I/O
529
534
 
530
535
  export const main = (argv, ctx = {}) => {
531
536
  try {
532
- if (argv.includes('--help') || argv.includes('-h')) return { code: EXIT_OK, stdout: HELP, stderr: '', result: null };
533
- const root = realpathSync(resolve(ctx.cwd ?? process.cwd()));
534
537
  const opts = parseArgs(argv);
538
+ if (opts.help) return { code: EXIT_OK, stdout: HELP, stderr: '', result: null };
539
+ const root = realpathSync(resolve(ctx.cwd ?? process.cwd()));
535
540
  const excludePaths = new Map();
536
541
  // ONE reader for both out-of-band lanes, so their failure classification cannot drift: a missing,
537
542
  // unreadable or non-regular lane file is an IoError (exit 1) for the pattern lane and for the