@sabaiway/agent-workflow-kit 20.0.1 → 20.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.
- package/CHANGELOG.md +24 -0
- package/SKILL.md +1 -1
- package/capability.json +1 -1
- package/package.json +1 -1
- package/tools/plan-shape-facts.mjs +2 -1
- package/tools/source-size-config.mjs +6 -0
- package/tools/source-size-report.mjs +13 -7
- package/tools/source-size-scope.mjs +26 -15
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,30 @@ 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
|
+
## 20.1.0 — the size check leaves the kit's own folder `scripts/agent-workflow` alone (AD-218)
|
|
8
|
+
|
|
9
|
+
**A coming kit release can move its scripts into one folder of your project without stopping a single commit.** The
|
|
10
|
+
kit's scripts will live in `scripts/agent-workflow`, and the kit's own repository already judges their size. Before
|
|
11
|
+
they move, `source-size-check` stops judging that folder in your project:
|
|
12
|
+
|
|
13
|
+
- Every tracked entry at or under `scripts/agent-workflow` is taken away before anything is judged, under every
|
|
14
|
+
declared root, the root `.` and an absent `docs/ai/source-size.json` included: no line, byte, layout entry, files-per-root
|
|
15
|
+
count or aggregate line counts it, and its own name is counted by nothing in `scripts`. The comparison is by whole
|
|
16
|
+
path segment, so `scripts/agent-workflow-x/a.mjs` and `scripts/agent-workflowx.mjs` stay judged.
|
|
17
|
+
- Every `--check`, `--write-baseline` and `--override` run that judges the tree prints, as the last of its not-judged
|
|
18
|
+
lines: `source-size: NOTE — scripts/agent-workflow is the kit's own folder, so nothing in it is judged here; the
|
|
19
|
+
kit's own repository judges its files`. `--help` names the folder in its scope and layout sentences.
|
|
20
|
+
- A declared root at or inside the folder is a config stop, exit 2, naming the root; the roots `scripts` and `.` stay
|
|
21
|
+
valid, and so does an `exclude` entry inside the folder.
|
|
22
|
+
- A recorded `baseline` or `layout.directories` key under the folder reads as gone: it warns, exit 0, and your next
|
|
23
|
+
`--write-baseline` removes it with no reason.
|
|
24
|
+
- A declared scope whose only matches lie inside the folder judges no file on lines or bytes and is not refused as
|
|
25
|
+
empty; its empty-root note says the root matches nothing outside the kit's own folder.
|
|
26
|
+
- The plan-shape check's source scope takes the folder away by the same rule.
|
|
27
|
+
|
|
28
|
+
No project holds the folder yet, so the changes you see today are the new NOTE line and the `--help` text that names
|
|
29
|
+
the folder. Contract: source-size revision 8.
|
|
30
|
+
|
|
7
31
|
## 20.0.1 — `init` removes the folders it leaves empty in the kit home (AD-217)
|
|
8
32
|
|
|
9
33
|
**A refresh no longer asks you to delete folders by hand.** `init` removes from an existing kit home every file in
|
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: '20.0
|
|
6
|
+
version: '20.1.0'
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# agent-workflow-kit
|
package/capability.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sabaiway/agent-workflow-kit",
|
|
3
|
-
"version": "20.0
|
|
3
|
+
"version": "20.1.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",
|
|
@@ -2,7 +2,7 @@ import { lstatSync, readdirSync, realpathSync } from 'node:fs';
|
|
|
2
2
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
3
3
|
import { readRegularFileNoFollow } from './fs-read-nofollow.mjs';
|
|
4
4
|
import { classIds, readShippedRobustnessLiterals } from './robustness-literals.mjs';
|
|
5
|
-
import { segmentPrefixOf, validateSourceSizeConfig } from './source-size-config.mjs';
|
|
5
|
+
import { KIT_FOLDER_ROOT, segmentPrefixOf, validateSourceSizeConfig } from './source-size-config.mjs';
|
|
6
6
|
import { getLineCount, isSweep, resolveAnchorCandidates, unique } from './plan-shape.mjs';
|
|
7
7
|
import { listStories } from './claim-relation.mjs';
|
|
8
8
|
import { EPICS_REL, readEpicStore } from './epic-store.mjs';
|
|
@@ -99,6 +99,7 @@ const loadRobustClasses = (deps) => {
|
|
|
99
99
|
|
|
100
100
|
const isInScope = (path, config) => Boolean(config &&
|
|
101
101
|
config.roots.some((root) => segmentPrefixOf(root, path)) &&
|
|
102
|
+
!segmentPrefixOf(KIT_FOLDER_ROOT, path) &&
|
|
102
103
|
!config.exclude.some((excluded) => segmentPrefixOf(excluded, path)) &&
|
|
103
104
|
config.extensions.some((extension) => path.endsWith(extension)));
|
|
104
105
|
|
|
@@ -31,6 +31,8 @@ export const REASON_MAX_BYTES = 300;
|
|
|
31
31
|
export const INITIAL_ADOPTION_REASON = 'initial adoption';
|
|
32
32
|
// The root an absent `roots` declares: every tracked path. Admitted only as the sole root.
|
|
33
33
|
export const WHOLE_TREE_ROOT = '.';
|
|
34
|
+
// The kit's own folder: taken away from every judgment by this fixed path, with no config key.
|
|
35
|
+
export const KIT_FOLDER_ROOT = 'scripts/agent-workflow';
|
|
34
36
|
|
|
35
37
|
export const AUTHORED_KEYS = Object.freeze(['_README', 'schema', 'roots', 'exclude', 'extensions', 'limits']);
|
|
36
38
|
const SCHEMA1_AUTHORED_KEYS = Object.freeze(['_README', 'schema', 'defaults', 'roots', 'exclude', 'extensions']);
|
|
@@ -214,6 +216,10 @@ export const validateSourceSizeConfig = (parsed) => {
|
|
|
214
216
|
}
|
|
215
217
|
}
|
|
216
218
|
}
|
|
219
|
+
const kitRoot = roots.find((root) => segmentPrefixOf(KIT_FOLDER_ROOT, root));
|
|
220
|
+
if (kitRoot !== undefined) {
|
|
221
|
+
throw configFail(`"roots" declares "${kitRoot}", at or inside the kit's own folder ${KIT_FOLDER_ROOT} — nothing in it is judged here, so declare a root outside it`);
|
|
222
|
+
}
|
|
217
223
|
if (Object.hasOwn(parsed, 'exclude')) {
|
|
218
224
|
if (!Array.isArray(parsed.exclude)) throw configFail('"exclude" must be an array of literal path prefixes');
|
|
219
225
|
for (const value of parsed.exclude) {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
// Dependency-free, Node >= 22. No writes, no side effects on import.
|
|
17
17
|
|
|
18
18
|
import { SOURCE_SIZE_CONFIG_REL, SOURCE_SIZE_WARNING_PREFIX, SOURCE_SIZE_WHY, configPathFor, escapeForLine, isLineUnsafe, jsonForLine } from './source-size-refusal.mjs';
|
|
19
|
-
import { INITIAL_ADOPTION_REASON, SOURCE_SIZE_SCHEMA, practiceFacts } from './source-size-config.mjs';
|
|
19
|
+
import { INITIAL_ADOPTION_REASON, KIT_FOLDER_ROOT, SOURCE_SIZE_SCHEMA, practiceFacts } from './source-size-config.mjs';
|
|
20
20
|
import { SOURCE_SIZE_TOOL_PATH, dqUnsafePath } from './source-size-gate-cmd.mjs';
|
|
21
21
|
import { hasLoweredRecord, hasStoreRecord, stopsOf, warningsOf } from './source-size-judge.mjs';
|
|
22
22
|
import { isRaise, limitLines } from './source-size/index.mjs';
|
|
@@ -48,12 +48,16 @@ export const authoringTemplate = () => JSON.stringify({
|
|
|
48
48
|
export const statedLimitLines = (config) =>
|
|
49
49
|
limitLines(config.limits, { escape: escapeForLine, recorded: config.layout !== null }).map((line) => `source-size: ${line}`);
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
const KIT_FOLDER_LINE = `source-size: NOTE — ${KIT_FOLDER_ROOT} is the kit's own folder, so nothing in it is judged here; the kit's own repository judges its files`;
|
|
52
|
+
|
|
53
|
+
// What a run does not judge is said once, before its warnings: no extension, no config, no layout,
|
|
54
|
+
// and last the kit's own folder.
|
|
52
55
|
export const notJudgedLines = (cwd, { absent, config, layout }) => {
|
|
53
|
-
if (absent) return [`source-size: NOTE — ${namedConfig(cwd)} is absent, so the kit's values judge layout alone and no file is judged on lines or bytes
|
|
56
|
+
if (absent) return [`source-size: NOTE — ${namedConfig(cwd)} is absent, so the kit's values judge layout alone and no file is judged on lines or bytes`, KIT_FOLDER_LINE];
|
|
54
57
|
return [
|
|
55
58
|
...(config.extensions.length === 0 ? [`source-size: NOTE — ${namedConfig(cwd)} declares no extension, so no file is judged on lines or bytes`] : []),
|
|
56
59
|
...(layout ? [] : [`source-size: NOTE — ${namedConfig(cwd)} records no "layout", so entries per directory, depth and files per root are not judged; --write-baseline --layout --reason "<text>" starts it`]),
|
|
60
|
+
KIT_FOLDER_LINE,
|
|
57
61
|
];
|
|
58
62
|
};
|
|
59
63
|
|
|
@@ -200,8 +204,8 @@ const tightenLine = (cwd) => {
|
|
|
200
204
|
|
|
201
205
|
// The order every check prints: its notes, its warnings, then the green line or its stops.
|
|
202
206
|
export const checkReportLines = ({ cwd, config, verdict, absent = false }) => {
|
|
203
|
-
const lines = verdict.scope.emptyRoots.map(
|
|
204
|
-
|
|
207
|
+
const lines = verdict.scope.emptyRoots.map((rel) =>
|
|
208
|
+
`source-size: NOTE — the declared root "${escapeForLine(rel)}" matches no tracked file with a declared extension${verdict.scope.kitFolderRoots.includes(rel) ? ` outside the kit's own folder ${KIT_FOLDER_ROOT}` : ''}`);
|
|
205
209
|
const stops = stopsOf(verdict.findings);
|
|
206
210
|
const warnings = warningsOf(verdict.findings);
|
|
207
211
|
lines.push(...warningLines(warnings));
|
|
@@ -349,7 +353,8 @@ Usage:
|
|
|
349
353
|
node source-size-check.mjs --override <id> --kit-default --reason "<text>" [--cwd <project-root>]
|
|
350
354
|
|
|
351
355
|
Judges every in-scope file against ${SOURCE_SIZE_CONFIG_REL} (schema ${SOURCE_SIZE_SCHEMA}): git-tracked files
|
|
352
|
-
under a declared root carrying a declared extension, minus the excluded path-segment prefixes
|
|
356
|
+
under a declared root carrying a declared extension, minus the excluded path-segment prefixes and
|
|
357
|
+
the kit's own folder ${KIT_FOLDER_ROOT}, which nothing here judges and no root may declare. An
|
|
353
358
|
absent "roots" is the one root ".", every tracked path; a config declaring no extension judges no
|
|
354
359
|
file, and every check says so. With the config absent the check judges layout alone under the
|
|
355
360
|
kit's values. Symlinks and submodule gitlinks are skipped by kind; an unmerged index, a non-UTF-8
|
|
@@ -365,7 +370,8 @@ tolerance and source, then what it does not judge, then its warnings, then its s
|
|
|
365
370
|
Counting: lines, and the longest line in BYTES. A terminator never counts (the CR of a CRLF
|
|
366
371
|
included); a last line with no final newline still counts; an empty file is 0 lines. Layout: the
|
|
367
372
|
entries of each directory and its depth below its root, over every tracked entry under a declared
|
|
368
|
-
root plus the spec store docs/ai/specs walked from
|
|
373
|
+
root outside the kit's own folder ${KIT_FOLDER_ROOT} plus the spec store docs/ai/specs walked from
|
|
374
|
+
disk, and the files of each declared root.
|
|
369
375
|
|
|
370
376
|
A recorded entry is DEBT: a finding stops exactly when the regeneration would raise it, and a record
|
|
371
377
|
above the tree or gone warns until the regeneration lowers or removes it. Each declared root carries
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
// refuse through the same fail-closed lane.
|
|
5
5
|
//
|
|
6
6
|
// • SCOPE (fail-closed) — git-tracked files under a declared root carrying a declared extension,
|
|
7
|
-
// minus the excluded path-segment prefixes
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
// is
|
|
7
|
+
// minus the excluded path-segment prefixes and the kit's own folder scripts/agent-workflow
|
|
8
|
+
// (KIT_FOLDER_ROOT). Symlinks and submodule gitlinks are skipped BY KIND. An unmerged index, a
|
|
9
|
+
// non-UTF-8 in-scope FILENAME, an unverifiable in-scope file and a declared scope matching no
|
|
10
|
+
// tracked file, the kit's own folder included, are REFUSALS (exit 1); a failed enumeration is
|
|
11
|
+
// exit 2. The enumeration is NUL-delimited and every path test runs on BYTES, so a tracked path
|
|
12
|
+
// carrying a tab or a newline is judged byte-exactly instead of being mangled by line splitting.
|
|
12
13
|
// • COUNTING — lines, and the longest line in BYTES. Terminators never count, CR included.
|
|
13
14
|
//
|
|
14
15
|
// Dependency-free, Node >= 22. No side effects on import; the only child process is a read-only git
|
|
@@ -18,7 +19,7 @@ import { lstatSync, readdirSync, readFileSync } from 'node:fs';
|
|
|
18
19
|
import { join } from 'node:path';
|
|
19
20
|
import { spawnSync } from 'node:child_process';
|
|
20
21
|
import { configFail, configPathFor, scopeFail } from './source-size-refusal.mjs';
|
|
21
|
-
import { WHOLE_TREE_ROOT } from './source-size-config.mjs';
|
|
22
|
+
import { KIT_FOLDER_ROOT, WHOLE_TREE_ROOT } from './source-size-config.mjs';
|
|
22
23
|
import { SPEC_STORE_ROOT, walkSpecStore } from './source-size/index.mjs';
|
|
23
24
|
import { GIT_MAX_BUFFER, parseIndexEntries, resolveGitLocation, withGitPath } from './git-env.mjs';
|
|
24
25
|
|
|
@@ -27,6 +28,7 @@ const CR = 0x0d;
|
|
|
27
28
|
const SLASH = 0x2f;
|
|
28
29
|
|
|
29
30
|
const SPEC_STORE = Buffer.from(SPEC_STORE_ROOT, 'utf8');
|
|
31
|
+
const KIT_FOLDER = Buffer.from(KIT_FOLDER_ROOT, 'utf8');
|
|
30
32
|
const SYMLINK_MODE = '120000';
|
|
31
33
|
const GITLINK_MODE = '160000';
|
|
32
34
|
|
|
@@ -73,11 +75,12 @@ export const enumerateIndex = (cwd, deps = {}) => {
|
|
|
73
75
|
};
|
|
74
76
|
|
|
75
77
|
// resolveScope(cwd, config) → { files: [rel…] sorted, perRoot: Map<root, [rel…]>, layout: Map<root,
|
|
76
|
-
// [{ path, dir }…]>, emptyRoots: [root…] }; `layout` holds every entry under
|
|
77
|
-
// a binary string below the root
|
|
78
|
-
//
|
|
79
|
-
//
|
|
80
|
-
//
|
|
78
|
+
// [{ path, dir }…]>, emptyRoots: [root…], kitFolderRoots: [root…] }; `layout` holds every entry under
|
|
79
|
+
// a root, of any mode, as a binary string below the root; `kitFolderRoots` are the empty roots whose
|
|
80
|
+
// matches all lie inside the kit's own folder.
|
|
81
|
+
// Every exclusion is BY RULE (root / extension / exclude prefix / the kit's own folder) or BY KIND
|
|
82
|
+
// (symlink, gitlink); an in-scope path that cannot be addressed losslessly is a refusal, never a quiet
|
|
83
|
+
// skip. The root "." covers every tracked path.
|
|
81
84
|
export const resolveScope = (cwd, config, deps = {}) => {
|
|
82
85
|
const entries = enumerateIndex(cwd, deps);
|
|
83
86
|
const unmerged = entries.filter((e) => e.stage !== 0);
|
|
@@ -90,16 +93,22 @@ export const resolveScope = (cwd, config, deps = {}) => {
|
|
|
90
93
|
const perRoot = new Map(config.roots.map((rel) => [rel, []]));
|
|
91
94
|
const layout = new Map(config.roots.map((rel) => [rel, []]));
|
|
92
95
|
const files = [];
|
|
96
|
+
const kitMatched = new Set();
|
|
93
97
|
for (const entry of entries) {
|
|
94
98
|
const root = roots.find((r) => r.rel === WHOLE_TREE_ROOT || bufSegmentPrefix(entry.path, r.buf));
|
|
95
99
|
if (!root) continue;
|
|
96
100
|
if (excludes.some((ex) => bufSegmentPrefix(entry.path, ex))) continue;
|
|
101
|
+
const extended = extensions.some((ext) => bufEndsWith(entry.path, ext));
|
|
102
|
+
if (bufSegmentPrefix(entry.path, KIT_FOLDER)) {
|
|
103
|
+
if (extended) kitMatched.add(root.rel);
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
97
106
|
// Layout counts every entry of any mode, the spec store's aside: the store is a root of its own.
|
|
98
107
|
if (!bufSegmentPrefix(entry.path, SPEC_STORE)) {
|
|
99
108
|
const below = root.rel === WHOLE_TREE_ROOT ? entry.path : entry.path.subarray(root.buf.length + 1);
|
|
100
109
|
if (below.length > 0) layout.get(root.rel).push({ path: below.toString('latin1'), dir: false });
|
|
101
110
|
}
|
|
102
|
-
if (!
|
|
111
|
+
if (!extended) continue;
|
|
103
112
|
if (entry.mode === SYMLINK_MODE || entry.mode === GITLINK_MODE) continue;
|
|
104
113
|
const rel = decodeStrict(entry.path);
|
|
105
114
|
if (rel === null) {
|
|
@@ -109,13 +118,15 @@ export const resolveScope = (cwd, config, deps = {}) => {
|
|
|
109
118
|
perRoot.get(root.rel).push(rel);
|
|
110
119
|
}
|
|
111
120
|
// A config declaring no extension judges no file, and the check says so instead of refusing.
|
|
112
|
-
if (extensions.length === 0) return { files, perRoot, layout, emptyRoots: [] };
|
|
113
|
-
|
|
121
|
+
if (extensions.length === 0) return { files, perRoot, layout, emptyRoots: [], kitFolderRoots: [] };
|
|
122
|
+
// A scope the kit's own folder alone matches judges no line, and is no misdeclaration.
|
|
123
|
+
if (files.length === 0 && kitMatched.size === 0) {
|
|
114
124
|
throw scopeFail(`the declared scope matches ZERO tracked files (roots: ${config.roots.join(', ')}; extensions: ${config.extensions.join(', ')}) — an empty scope is a misdeclaration, never an empty green; either widen "roots" / "extensions" in ${configPathFor(cwd)}, or track a file the declared scope covers`);
|
|
115
125
|
}
|
|
116
126
|
files.sort();
|
|
117
127
|
for (const list of perRoot.values()) list.sort();
|
|
118
|
-
|
|
128
|
+
const emptyRoots = [...perRoot].filter(([, list]) => list.length === 0).map(([rel]) => rel);
|
|
129
|
+
return { files, perRoot, layout, emptyRoots, kitFolderRoots: emptyRoots.filter((rel) => kitMatched.has(rel)) };
|
|
119
130
|
};
|
|
120
131
|
|
|
121
132
|
// specStoreEntries(cwd) → the spec store's entries walked from disk, or null where it is absent. A
|