@dezycro-ai/agent-plugin 2.1.1 → 2.2.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/README.md +14 -98
- package/dist/cli/dezycro.js +50 -0
- package/dist/cli/install.js +7 -0
- package/dist/dezycro-config.d.ts +52 -0
- package/dist/dezycro-config.js +167 -0
- package/dist/gateway/compact-cli.js +8 -0
- package/dist/gateway/proxy.js +35 -0
- package/dist/hooks/lib/router.js +14 -782
- package/dist/schemas/anthropic.d.ts +119 -0
- package/dist/schemas/anthropic.js +43 -0
- package/dist/schemas/dezycro.d.ts +19 -0
- package/dist/schemas/dezycro.js +22 -0
- package/dist/schemas/gateway.d.ts +40 -0
- package/dist/schemas/gateway.js +30 -0
- package/dist/schemas/gating.d.ts +32 -0
- package/dist/schemas/gating.js +15 -0
- package/dist/schemas/index.d.ts +14 -0
- package/dist/schemas/index.js +29 -0
- package/package.json +21 -13
- package/LICENSE +0 -18
- package/bin/resolve-auth.js +0 -112
- package/dist/hooks/lib/authoring.d.ts +0 -118
- package/dist/hooks/lib/authoring.js +0 -277
- package/dist/hooks/lib/command-bus.d.ts +0 -53
- package/dist/hooks/lib/command-bus.js +0 -318
- package/dist/hooks/lib/config.d.ts +0 -28
- package/dist/hooks/lib/config.js +0 -175
- package/dist/hooks/lib/controller-match.d.ts +0 -16
- package/dist/hooks/lib/controller-match.js +0 -96
- package/dist/hooks/lib/coverage.d.ts +0 -17
- package/dist/hooks/lib/coverage.js +0 -66
- package/dist/hooks/lib/hashing.d.ts +0 -8
- package/dist/hooks/lib/hashing.js +0 -49
- package/dist/hooks/lib/logging.d.ts +0 -13
- package/dist/hooks/lib/logging.js +0 -72
- package/dist/hooks/lib/publish-spec.d.ts +0 -17
- package/dist/hooks/lib/publish-spec.js +0 -64
- package/dist/hooks/lib/quality-gate.d.ts +0 -67
- package/dist/hooks/lib/quality-gate.js +0 -187
- package/dist/hooks/lib/router.d.ts +0 -32
- package/dist/hooks/lib/state.d.ts +0 -34
- package/dist/hooks/lib/state.js +0 -244
- package/dist/hooks/lib/undo.d.ts +0 -11
- package/dist/hooks/lib/undo.js +0 -71
- package/dist/hooks/lib/verify.d.ts +0 -28
- package/dist/hooks/lib/verify.js +0 -94
- package/dist/hooks/lib/workbook.d.ts +0 -21
- package/dist/hooks/lib/workbook.js +0 -77
- package/dist/hooks/types.d.ts +0 -278
- package/dist/hooks/types.js +0 -14
- package/install.js +0 -84
- package/setup.js +0 -53
package/dist/hooks/lib/config.js
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* config.ts — reads `.dezycro/config.json` and resolves Companion settings.
|
|
3
|
-
*
|
|
4
|
-
* Owns the named-preset constant table (TRD §7.2) for the workbook sweep
|
|
5
|
-
* confidence-threshold logic.
|
|
6
|
-
*/
|
|
7
|
-
'use strict';
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
-
}) : function(o, v) {
|
|
22
|
-
o["default"] = v;
|
|
23
|
-
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
-
var ownKeys = function(o) {
|
|
26
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
-
var ar = [];
|
|
28
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
-
return ar;
|
|
30
|
-
};
|
|
31
|
-
return ownKeys(o);
|
|
32
|
-
};
|
|
33
|
-
return function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
})();
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports._deepMerge = exports.DEFAULT_CONFIG = exports.PRESETS = void 0;
|
|
43
|
-
exports.deepMerge = deepMerge;
|
|
44
|
-
exports.load = load;
|
|
45
|
-
exports.resolveThresholds = resolveThresholds;
|
|
46
|
-
exports.findRepoRoot = findRepoRoot;
|
|
47
|
-
const fs = __importStar(require("fs"));
|
|
48
|
-
const path = __importStar(require("path"));
|
|
49
|
-
exports.PRESETS = Object.freeze({
|
|
50
|
-
conservative: { decision: 0.85, issue: 0.80, assumption: 0.90, taskStatus: 0.90 },
|
|
51
|
-
balanced: { decision: 0.75, issue: 0.70, assumption: 0.80, taskStatus: 0.85 },
|
|
52
|
-
aggressive: { decision: 0.60, issue: 0.55, assumption: 0.70, taskStatus: 0.75 },
|
|
53
|
-
});
|
|
54
|
-
exports.DEFAULT_CONFIG = Object.freeze({
|
|
55
|
-
companion: {
|
|
56
|
-
autoVerify: {
|
|
57
|
-
preTaskDone: true,
|
|
58
|
-
prePush: true,
|
|
59
|
-
postEditPulse: { enabled: true, threshold: 5 },
|
|
60
|
-
autoPublishSpecOnControllerChange: true,
|
|
61
|
-
controllerPaths: [
|
|
62
|
-
'**/controllers/**/*.{kt,java,py,go,ts,tsx,js,rs,rb,cs}',
|
|
63
|
-
'**/api/**/*.{kt,java,py,go,ts,tsx,js,rs,rb,cs}',
|
|
64
|
-
],
|
|
65
|
-
verifyTimeoutSeconds: 300,
|
|
66
|
-
publishSpecTimeoutSeconds: 300,
|
|
67
|
-
},
|
|
68
|
-
autoWorkbookUpdates: {
|
|
69
|
-
enabled: true,
|
|
70
|
-
preset: 'conservative',
|
|
71
|
-
maxAutoLogsPerTurn: 2,
|
|
72
|
-
maxAutoLogsPerSession: 10,
|
|
73
|
-
undoWindow: 'next-turn',
|
|
74
|
-
thresholds: {
|
|
75
|
-
decision: null,
|
|
76
|
-
issue: null,
|
|
77
|
-
assumption: null,
|
|
78
|
-
taskStatus: null,
|
|
79
|
-
},
|
|
80
|
-
trivialTurnCharCutoff: 600,
|
|
81
|
-
hashRingBufferSize: 32,
|
|
82
|
-
},
|
|
83
|
-
coverageNudges: {
|
|
84
|
-
enabled: true,
|
|
85
|
-
staleBaselineDays: 14,
|
|
86
|
-
fetchMode: 'async',
|
|
87
|
-
},
|
|
88
|
-
authoring: {
|
|
89
|
-
defaultDepth: 'adaptive',
|
|
90
|
-
existingWorkScan: true,
|
|
91
|
-
qualityGate: { enabled: true },
|
|
92
|
-
minViableContextGate: { enabled: true },
|
|
93
|
-
},
|
|
94
|
-
safeMode: false,
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
function isPlainObject(v) {
|
|
98
|
-
return v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
99
|
-
}
|
|
100
|
-
function deepMerge(base, override) {
|
|
101
|
-
if (!isPlainObject(override))
|
|
102
|
-
return override === undefined ? base : override;
|
|
103
|
-
const baseObj = (Array.isArray(base) ? [...base] : { ...base });
|
|
104
|
-
for (const key of Object.keys(override)) {
|
|
105
|
-
const b = baseObj[key];
|
|
106
|
-
const o = override[key];
|
|
107
|
-
if (isPlainObject(b) && isPlainObject(o)) {
|
|
108
|
-
baseObj[key] = deepMerge(b, o);
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
baseObj[key] = o;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return baseObj;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Load `.dezycro/config.json` from the given repo root, deep-merged with
|
|
118
|
-
* DEFAULT_CONFIG. Returns DEFAULT_CONFIG if the file is missing or unparseable.
|
|
119
|
-
*/
|
|
120
|
-
function load(repoRoot) {
|
|
121
|
-
const file = path.join(repoRoot, '.dezycro', 'config.json');
|
|
122
|
-
let raw;
|
|
123
|
-
try {
|
|
124
|
-
raw = fs.readFileSync(file, 'utf8');
|
|
125
|
-
}
|
|
126
|
-
catch (err) {
|
|
127
|
-
const e = err;
|
|
128
|
-
if (e.code === 'ENOENT')
|
|
129
|
-
return JSON.parse(JSON.stringify(exports.DEFAULT_CONFIG));
|
|
130
|
-
throw err;
|
|
131
|
-
}
|
|
132
|
-
let parsed;
|
|
133
|
-
try {
|
|
134
|
-
parsed = JSON.parse(raw);
|
|
135
|
-
}
|
|
136
|
-
catch {
|
|
137
|
-
return JSON.parse(JSON.stringify(exports.DEFAULT_CONFIG));
|
|
138
|
-
}
|
|
139
|
-
return deepMerge(JSON.parse(JSON.stringify(exports.DEFAULT_CONFIG)), parsed);
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Resolve per-type confidence thresholds for the workbook sweep, honoring
|
|
143
|
-
* `companion.autoWorkbookUpdates.preset` and any numeric overrides under
|
|
144
|
-
* `companion.autoWorkbookUpdates.thresholds.*`.
|
|
145
|
-
*/
|
|
146
|
-
function resolveThresholds(config) {
|
|
147
|
-
const ws = config?.companion?.autoWorkbookUpdates || {};
|
|
148
|
-
const presetName = (ws.preset || 'conservative');
|
|
149
|
-
const base = exports.PRESETS[presetName] || exports.PRESETS.conservative;
|
|
150
|
-
const overrides = ws.thresholds || {};
|
|
151
|
-
return {
|
|
152
|
-
decision: typeof overrides.decision === 'number' ? overrides.decision : base.decision,
|
|
153
|
-
issue: typeof overrides.issue === 'number' ? overrides.issue : base.issue,
|
|
154
|
-
assumption: typeof overrides.assumption === 'number' ? overrides.assumption : base.assumption,
|
|
155
|
-
taskStatus: typeof overrides.taskStatus === 'number' ? overrides.taskStatus : base.taskStatus,
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Find the nearest ancestor of `startDir` that contains a `.dezycro/`
|
|
160
|
-
* directory, returning that ancestor as the repo root. Returns null if not
|
|
161
|
-
* found before reaching the filesystem root.
|
|
162
|
-
*/
|
|
163
|
-
function findRepoRoot(startDir) {
|
|
164
|
-
let dir = path.resolve(startDir || process.cwd());
|
|
165
|
-
for (let i = 0; i < 64; i += 1) {
|
|
166
|
-
if (fs.existsSync(path.join(dir, '.dezycro')))
|
|
167
|
-
return dir;
|
|
168
|
-
const parent = path.dirname(dir);
|
|
169
|
-
if (parent === dir)
|
|
170
|
-
return null;
|
|
171
|
-
dir = parent;
|
|
172
|
-
}
|
|
173
|
-
return null;
|
|
174
|
-
}
|
|
175
|
-
exports._deepMerge = deepMerge;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* controller-match.ts — match file paths against `controllerPaths` globs from
|
|
3
|
-
* `.dezycro/config.json` (TRD §5.2).
|
|
4
|
-
*
|
|
5
|
-
* Minimal glob subset (stdlib only):
|
|
6
|
-
* - `**` zero or more path segments
|
|
7
|
-
* - `*` any chars within a single segment (no slashes)
|
|
8
|
-
* - `?` any single char within a single segment
|
|
9
|
-
* - `{a,b}` alternation (`*.{kt,java}`)
|
|
10
|
-
*
|
|
11
|
-
* Limitations: no character classes, no escaping, forward-slash only.
|
|
12
|
-
*/
|
|
13
|
-
export declare function expandAlternation(glob: string): string[];
|
|
14
|
-
export declare function globToRegex(glob: string): RegExp;
|
|
15
|
-
export declare function matchesControllerPath(filePath: string, globs: string[]): boolean;
|
|
16
|
-
export declare function selectControllers(filePaths: string[], globs: string[]): string[];
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* controller-match.ts — match file paths against `controllerPaths` globs from
|
|
3
|
-
* `.dezycro/config.json` (TRD §5.2).
|
|
4
|
-
*
|
|
5
|
-
* Minimal glob subset (stdlib only):
|
|
6
|
-
* - `**` zero or more path segments
|
|
7
|
-
* - `*` any chars within a single segment (no slashes)
|
|
8
|
-
* - `?` any single char within a single segment
|
|
9
|
-
* - `{a,b}` alternation (`*.{kt,java}`)
|
|
10
|
-
*
|
|
11
|
-
* Limitations: no character classes, no escaping, forward-slash only.
|
|
12
|
-
*/
|
|
13
|
-
'use strict';
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.expandAlternation = expandAlternation;
|
|
16
|
-
exports.globToRegex = globToRegex;
|
|
17
|
-
exports.matchesControllerPath = matchesControllerPath;
|
|
18
|
-
exports.selectControllers = selectControllers;
|
|
19
|
-
function normalizePath(p) {
|
|
20
|
-
return String(p || '').replace(/\\/g, '/');
|
|
21
|
-
}
|
|
22
|
-
function expandAlternation(glob) {
|
|
23
|
-
const m = glob.match(/\{([^{}]+)\}/);
|
|
24
|
-
if (!m || m.index === undefined)
|
|
25
|
-
return [glob];
|
|
26
|
-
const whole = m[0];
|
|
27
|
-
const inner = m[1];
|
|
28
|
-
const parts = inner.split(',');
|
|
29
|
-
const out = [];
|
|
30
|
-
for (const part of parts) {
|
|
31
|
-
const expanded = glob.slice(0, m.index) + part + glob.slice(m.index + whole.length);
|
|
32
|
-
out.push(...expandAlternation(expanded));
|
|
33
|
-
}
|
|
34
|
-
return out;
|
|
35
|
-
}
|
|
36
|
-
function globToRegex(glob) {
|
|
37
|
-
let re = '^';
|
|
38
|
-
for (let i = 0; i < glob.length; i += 1) {
|
|
39
|
-
const c = glob[i];
|
|
40
|
-
if (c === '*') {
|
|
41
|
-
if (glob[i + 1] === '*') {
|
|
42
|
-
i += 1;
|
|
43
|
-
if (glob[i + 1] === '/') {
|
|
44
|
-
i += 1;
|
|
45
|
-
re += '(?:.*/)?';
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
re += '.*';
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
re += '[^/]*';
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
else if (c === '?') {
|
|
56
|
-
re += '[^/]';
|
|
57
|
-
}
|
|
58
|
-
else if ('.+^$()|[]\\'.indexOf(c) !== -1) {
|
|
59
|
-
re += '\\' + c;
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
re += c;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
re += '$';
|
|
66
|
-
return new RegExp(re);
|
|
67
|
-
}
|
|
68
|
-
const _regexCache = new Map();
|
|
69
|
-
function compileGlob(glob) {
|
|
70
|
-
const hit = _regexCache.get(glob);
|
|
71
|
-
if (hit)
|
|
72
|
-
return hit;
|
|
73
|
-
const patterns = expandAlternation(glob).map(globToRegex);
|
|
74
|
-
_regexCache.set(glob, patterns);
|
|
75
|
-
return patterns;
|
|
76
|
-
}
|
|
77
|
-
function matchesControllerPath(filePath, globs) {
|
|
78
|
-
if (!filePath || !Array.isArray(globs) || globs.length === 0)
|
|
79
|
-
return false;
|
|
80
|
-
const norm = normalizePath(filePath);
|
|
81
|
-
for (const glob of globs) {
|
|
82
|
-
if (typeof glob !== 'string' || glob.length === 0)
|
|
83
|
-
continue;
|
|
84
|
-
const regexes = compileGlob(glob);
|
|
85
|
-
for (const re of regexes) {
|
|
86
|
-
if (re.test(norm))
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
function selectControllers(filePaths, globs) {
|
|
93
|
-
if (!Array.isArray(filePaths))
|
|
94
|
-
return [];
|
|
95
|
-
return filePaths.filter((p) => matchesControllerPath(p, globs));
|
|
96
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* coverage.ts — deterministic coverage-snapshot formatter (TRD §5.4.2).
|
|
3
|
-
*
|
|
4
|
-
* One-liner format:
|
|
5
|
-
* Coverage: N path[s] uncovered, M endpoint[s] not in spec, K baseline[s] stale
|
|
6
|
-
*
|
|
7
|
-
* Zero-count segments are omitted. If all counts are zero, returns null.
|
|
8
|
-
*/
|
|
9
|
-
import type { CoverageSnapshot } from '../types';
|
|
10
|
-
export declare function formatOneLiner(snapshot: CoverageSnapshot | null | undefined): string | null;
|
|
11
|
-
export declare function formatDelta(prev: CoverageSnapshot | null | undefined, next: CoverageSnapshot | null | undefined): string | null;
|
|
12
|
-
/**
|
|
13
|
-
* Detached coverage-fetch entry point. Deferred to V2.1 — for V2.0 the
|
|
14
|
-
* /dezycro:verify skill calls get_coverage_report directly and updates
|
|
15
|
-
* state via `companion-runner state --patch=…`.
|
|
16
|
-
*/
|
|
17
|
-
export declare function fetch(_featureId: string): Promise<null>;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* coverage.ts — deterministic coverage-snapshot formatter (TRD §5.4.2).
|
|
3
|
-
*
|
|
4
|
-
* One-liner format:
|
|
5
|
-
* Coverage: N path[s] uncovered, M endpoint[s] not in spec, K baseline[s] stale
|
|
6
|
-
*
|
|
7
|
-
* Zero-count segments are omitted. If all counts are zero, returns null.
|
|
8
|
-
*/
|
|
9
|
-
'use strict';
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.formatOneLiner = formatOneLiner;
|
|
12
|
-
exports.formatDelta = formatDelta;
|
|
13
|
-
exports.fetch = fetch;
|
|
14
|
-
function plural(n, word) {
|
|
15
|
-
return `${n} ${word}${n === 1 ? '' : 's'}`;
|
|
16
|
-
}
|
|
17
|
-
function snapshotCounts(snapshot) {
|
|
18
|
-
if (!snapshot || typeof snapshot !== 'object')
|
|
19
|
-
return null;
|
|
20
|
-
return {
|
|
21
|
-
uncoveredPaths: Number(snapshot.uncoveredPaths ?? 0) || 0,
|
|
22
|
-
endpointsNotInSpec: Number(snapshot.endpointsNotInSpec ?? 0) || 0,
|
|
23
|
-
staleBaselines: Number(snapshot.staleBaselines ?? 0) || 0,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
function formatOneLiner(snapshot) {
|
|
27
|
-
const c = snapshotCounts(snapshot);
|
|
28
|
-
if (!c)
|
|
29
|
-
return null;
|
|
30
|
-
const segments = [];
|
|
31
|
-
if (c.uncoveredPaths > 0)
|
|
32
|
-
segments.push(`${plural(c.uncoveredPaths, 'path')} uncovered`);
|
|
33
|
-
if (c.endpointsNotInSpec > 0)
|
|
34
|
-
segments.push(`${plural(c.endpointsNotInSpec, 'endpoint')} not in spec`);
|
|
35
|
-
if (c.staleBaselines > 0)
|
|
36
|
-
segments.push(`${plural(c.staleBaselines, 'baseline')} stale`);
|
|
37
|
-
if (segments.length === 0)
|
|
38
|
-
return null;
|
|
39
|
-
return `Coverage: ${segments.join(', ')}`;
|
|
40
|
-
}
|
|
41
|
-
function formatDelta(prev, next) {
|
|
42
|
-
const a = snapshotCounts(prev);
|
|
43
|
-
const b = snapshotCounts(next);
|
|
44
|
-
if (!b)
|
|
45
|
-
return null;
|
|
46
|
-
if (!a)
|
|
47
|
-
return formatOneLiner(next);
|
|
48
|
-
const deltas = [
|
|
49
|
-
['paths uncovered', b.uncoveredPaths - a.uncoveredPaths],
|
|
50
|
-
['endpoints not in spec', b.endpointsNotInSpec - a.endpointsNotInSpec],
|
|
51
|
-
['baselines stale', b.staleBaselines - a.staleBaselines],
|
|
52
|
-
];
|
|
53
|
-
const nonZero = deltas.filter(([, d]) => d !== 0);
|
|
54
|
-
if (nonZero.length === 0)
|
|
55
|
-
return null;
|
|
56
|
-
const parts = nonZero.map(([label, d]) => `${d > 0 ? '+' : ''}${d} ${label}`);
|
|
57
|
-
return `Coverage delta since last verify: ${parts.join(', ')}`;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Detached coverage-fetch entry point. Deferred to V2.1 — for V2.0 the
|
|
61
|
-
* /dezycro:verify skill calls get_coverage_report directly and updates
|
|
62
|
-
* state via `companion-runner state --patch=…`.
|
|
63
|
-
*/
|
|
64
|
-
async function fetch(_featureId) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* hashing.ts — content-hash dedup for auto-logged workbook items (TRD §3.4).
|
|
3
|
-
*
|
|
4
|
-
* SHA-1 of `lowercase(<entity-kind>::<summary>::<linked-task-id-or-empty>)`
|
|
5
|
-
* truncated to 16 hex chars.
|
|
6
|
-
*/
|
|
7
|
-
export type EntityKind = 'decision' | 'issue' | 'assumption' | 'task-status';
|
|
8
|
-
export declare function hashCandidate(entityKind: EntityKind | string, summary: string, linkedTaskId: string | null): string;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* hashing.ts — content-hash dedup for auto-logged workbook items (TRD §3.4).
|
|
3
|
-
*
|
|
4
|
-
* SHA-1 of `lowercase(<entity-kind>::<summary>::<linked-task-id-or-empty>)`
|
|
5
|
-
* truncated to 16 hex chars.
|
|
6
|
-
*/
|
|
7
|
-
'use strict';
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
-
}) : function(o, v) {
|
|
22
|
-
o["default"] = v;
|
|
23
|
-
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
-
var ownKeys = function(o) {
|
|
26
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
-
var ar = [];
|
|
28
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
-
return ar;
|
|
30
|
-
};
|
|
31
|
-
return ownKeys(o);
|
|
32
|
-
};
|
|
33
|
-
return function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
})();
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.hashCandidate = hashCandidate;
|
|
43
|
-
const crypto = __importStar(require("crypto"));
|
|
44
|
-
function hashCandidate(entityKind, summary, linkedTaskId) {
|
|
45
|
-
const kind = String(entityKind || '').toLowerCase().trim();
|
|
46
|
-
const text = String(summary || '').toLowerCase().trim().replace(/\s+/g, ' ');
|
|
47
|
-
const link = String(linkedTaskId || '').toLowerCase().trim();
|
|
48
|
-
return crypto.createHash('sha1').update(`${kind}::${text}::${link}`).digest('hex').slice(0, 16);
|
|
49
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* logging.ts — JSON-lines logger for Companion.
|
|
3
|
-
*
|
|
4
|
-
* Writes to `.dezycro/companion.log` per TRD §12 (Observability). Best-effort:
|
|
5
|
-
* never throws upstream — a logging failure must never break a hook.
|
|
6
|
-
*/
|
|
7
|
-
type Fields = Record<string, unknown> | undefined;
|
|
8
|
-
/** Append a single JSON-lines record to `<repoRoot>/.dezycro/companion.log`. */
|
|
9
|
-
export declare function append(repoRoot: string, record: Record<string, unknown>): void;
|
|
10
|
-
export declare function info(repoRoot: string, event: string, fields?: Fields): void;
|
|
11
|
-
export declare function warn(repoRoot: string, event: string, fields?: Fields): void;
|
|
12
|
-
export declare function error(repoRoot: string, event: string, fields?: Fields): void;
|
|
13
|
-
export {};
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* logging.ts — JSON-lines logger for Companion.
|
|
3
|
-
*
|
|
4
|
-
* Writes to `.dezycro/companion.log` per TRD §12 (Observability). Best-effort:
|
|
5
|
-
* never throws upstream — a logging failure must never break a hook.
|
|
6
|
-
*/
|
|
7
|
-
'use strict';
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
-
}) : function(o, v) {
|
|
22
|
-
o["default"] = v;
|
|
23
|
-
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
-
var ownKeys = function(o) {
|
|
26
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
-
var ar = [];
|
|
28
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
-
return ar;
|
|
30
|
-
};
|
|
31
|
-
return ownKeys(o);
|
|
32
|
-
};
|
|
33
|
-
return function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
})();
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.append = append;
|
|
43
|
-
exports.info = info;
|
|
44
|
-
exports.warn = warn;
|
|
45
|
-
exports.error = error;
|
|
46
|
-
const fs = __importStar(require("fs"));
|
|
47
|
-
const path = __importStar(require("path"));
|
|
48
|
-
const LOG_FILENAME = 'companion.log';
|
|
49
|
-
/** Append a single JSON-lines record to `<repoRoot>/.dezycro/companion.log`. */
|
|
50
|
-
function append(repoRoot, record) {
|
|
51
|
-
try {
|
|
52
|
-
const dezycroDir = path.join(repoRoot, '.dezycro');
|
|
53
|
-
if (!fs.existsSync(dezycroDir)) {
|
|
54
|
-
// We don't create the dir here — Companion init owns that.
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const line = JSON.stringify({ ts: new Date().toISOString(), ...record }) + '\n';
|
|
58
|
-
fs.appendFileSync(path.join(dezycroDir, LOG_FILENAME), line, { encoding: 'utf8' });
|
|
59
|
-
}
|
|
60
|
-
catch {
|
|
61
|
-
// Swallow — logging must never propagate.
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
function info(repoRoot, event, fields) {
|
|
65
|
-
append(repoRoot, { level: 'info', event, ...(fields || {}) });
|
|
66
|
-
}
|
|
67
|
-
function warn(repoRoot, event, fields) {
|
|
68
|
-
append(repoRoot, { level: 'warn', event, ...(fields || {}) });
|
|
69
|
-
}
|
|
70
|
-
function error(repoRoot, event, fields) {
|
|
71
|
-
append(repoRoot, { level: 'error', event, ...(fields || {}) });
|
|
72
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* publish-spec.ts — helper consumed by the `/dezycro:verify` skill to detect
|
|
3
|
-
* pending controller edits and announce + chain `/dezycro:publish-spec` before
|
|
4
|
-
* verifying (TRD §5.2).
|
|
5
|
-
*
|
|
6
|
-
* The hook layer does NOT run this. PostToolUse:edit sets `needsSpecPublish`
|
|
7
|
-
* + appends to `controllerEditsSinceLastPublish` (in router.ts); the verify
|
|
8
|
-
* skill reads via `needsPublishBeforeVerify`, announces, chains publish-spec,
|
|
9
|
-
* then runs verify. After publish-spec completes the skill clears the flags.
|
|
10
|
-
*/
|
|
11
|
-
export interface PublishCheckResult {
|
|
12
|
-
needed: boolean;
|
|
13
|
-
controllerPaths: string[];
|
|
14
|
-
lastEditTs: string | null;
|
|
15
|
-
}
|
|
16
|
-
export declare function needsPublishBeforeVerify(repoRoot: string | null | undefined): PublishCheckResult;
|
|
17
|
-
export declare function buildAnnouncement(controllerPaths: string[]): string;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* publish-spec.ts — helper consumed by the `/dezycro:verify` skill to detect
|
|
3
|
-
* pending controller edits and announce + chain `/dezycro:publish-spec` before
|
|
4
|
-
* verifying (TRD §5.2).
|
|
5
|
-
*
|
|
6
|
-
* The hook layer does NOT run this. PostToolUse:edit sets `needsSpecPublish`
|
|
7
|
-
* + appends to `controllerEditsSinceLastPublish` (in router.ts); the verify
|
|
8
|
-
* skill reads via `needsPublishBeforeVerify`, announces, chains publish-spec,
|
|
9
|
-
* then runs verify. After publish-spec completes the skill clears the flags.
|
|
10
|
-
*/
|
|
11
|
-
'use strict';
|
|
12
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
15
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
16
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
17
|
-
}
|
|
18
|
-
Object.defineProperty(o, k2, desc);
|
|
19
|
-
}) : (function(o, m, k, k2) {
|
|
20
|
-
if (k2 === undefined) k2 = k;
|
|
21
|
-
o[k2] = m[k];
|
|
22
|
-
}));
|
|
23
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
24
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
25
|
-
}) : function(o, v) {
|
|
26
|
-
o["default"] = v;
|
|
27
|
-
});
|
|
28
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
29
|
-
var ownKeys = function(o) {
|
|
30
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
31
|
-
var ar = [];
|
|
32
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
33
|
-
return ar;
|
|
34
|
-
};
|
|
35
|
-
return ownKeys(o);
|
|
36
|
-
};
|
|
37
|
-
return function (mod) {
|
|
38
|
-
if (mod && mod.__esModule) return mod;
|
|
39
|
-
var result = {};
|
|
40
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
41
|
-
__setModuleDefault(result, mod);
|
|
42
|
-
return result;
|
|
43
|
-
};
|
|
44
|
-
})();
|
|
45
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.needsPublishBeforeVerify = needsPublishBeforeVerify;
|
|
47
|
-
exports.buildAnnouncement = buildAnnouncement;
|
|
48
|
-
const state = __importStar(require("./state"));
|
|
49
|
-
function needsPublishBeforeVerify(repoRoot) {
|
|
50
|
-
if (!repoRoot)
|
|
51
|
-
return { needed: false, controllerPaths: [], lastEditTs: null };
|
|
52
|
-
const s = state.read(repoRoot);
|
|
53
|
-
const edits = Array.isArray(s.controllerEditsSinceLastPublish)
|
|
54
|
-
? s.controllerEditsSinceLastPublish
|
|
55
|
-
: [];
|
|
56
|
-
const controllerPaths = edits.map((e) => e && e.path).filter(Boolean);
|
|
57
|
-
const lastEditTs = edits.length > 0 ? (edits[edits.length - 1].editedTs || null) : null;
|
|
58
|
-
const needed = Boolean(s.needsSpecPublish) && controllerPaths.length > 0;
|
|
59
|
-
return { needed, controllerPaths, lastEditTs };
|
|
60
|
-
}
|
|
61
|
-
function buildAnnouncement(controllerPaths) {
|
|
62
|
-
const list = (controllerPaths || []).join(', ');
|
|
63
|
-
return 'Controllers changed since last published spec: ' + list + '. Publishing spec before verify.';
|
|
64
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* quality-gate.ts — deterministic TRD-approval checks + code-side enforcement
|
|
3
|
-
* of the P-9 LLM result. TRD §5.5.3 QUALITY_GATE and §6.9 enforcement notes.
|
|
4
|
-
*
|
|
5
|
-
* No LLM calls live here. The skill markdown is responsible for invoking P-9;
|
|
6
|
-
* `enforceP9Result` is the tamper-proof code-side guard run against P-9's
|
|
7
|
-
* structured output.
|
|
8
|
-
*/
|
|
9
|
-
export declare const INVENTION_KEYWORDS: readonly string[];
|
|
10
|
-
export interface RequiredHeading {
|
|
11
|
-
id: string;
|
|
12
|
-
pattern: RegExp;
|
|
13
|
-
}
|
|
14
|
-
export declare const REQUIRED_TRD_HEADINGS: readonly RequiredHeading[];
|
|
15
|
-
export declare const PLACEHOLDER_REGEX: RegExp;
|
|
16
|
-
export declare const MIN_TRD_LENGTH = 1000;
|
|
17
|
-
export declare const PILLAR_HEADING_REGEX: RegExp;
|
|
18
|
-
export declare const MIN_CONTEXT_CATEGORIES: readonly string[];
|
|
19
|
-
export declare const MIN_CONTEXT_EVIDENCE_CHARS = 80;
|
|
20
|
-
export declare const MIN_P9_SCORE = 0.85;
|
|
21
|
-
export declare function parsePrdPillarNames(prdContent: string | null | undefined): string[];
|
|
22
|
-
export interface BlockingIssue {
|
|
23
|
-
section: string;
|
|
24
|
-
issue: string;
|
|
25
|
-
required_fix: string;
|
|
26
|
-
}
|
|
27
|
-
export interface DeterministicGateResult {
|
|
28
|
-
passed: boolean;
|
|
29
|
-
blockingIssues: BlockingIssue[];
|
|
30
|
-
deterministic: true;
|
|
31
|
-
}
|
|
32
|
-
export declare function deterministicTrdGate(opts: {
|
|
33
|
-
trdContent: string | null | undefined;
|
|
34
|
-
prdContent: string | null | undefined;
|
|
35
|
-
}): DeterministicGateResult;
|
|
36
|
-
export interface MinContextGateInput {
|
|
37
|
-
discoverySummary: {
|
|
38
|
-
confirmed_context?: Record<string, string[]>;
|
|
39
|
-
likely_conventions?: Record<string, string[]>;
|
|
40
|
-
[extra: string]: unknown;
|
|
41
|
-
} | null;
|
|
42
|
-
answeredCategories: Record<string, string[]> | null;
|
|
43
|
-
}
|
|
44
|
-
export interface MinContextGateResult {
|
|
45
|
-
ready: boolean;
|
|
46
|
-
missing: Record<string, string[]>;
|
|
47
|
-
}
|
|
48
|
-
export declare function minContextGate(opts: MinContextGateInput): MinContextGateResult;
|
|
49
|
-
export interface P9Output {
|
|
50
|
-
approved?: boolean;
|
|
51
|
-
score?: number;
|
|
52
|
-
suspected_inventions?: Array<{
|
|
53
|
-
claim?: string;
|
|
54
|
-
}>;
|
|
55
|
-
blocking_issues?: Array<{
|
|
56
|
-
issue?: string;
|
|
57
|
-
}>;
|
|
58
|
-
}
|
|
59
|
-
export interface P9EnforcementResult {
|
|
60
|
-
passed: boolean;
|
|
61
|
-
reason: string | null;
|
|
62
|
-
score: number;
|
|
63
|
-
suspectedInventions: Array<{
|
|
64
|
-
claim?: string;
|
|
65
|
-
}>;
|
|
66
|
-
}
|
|
67
|
-
export declare function enforceP9Result(p9Output: P9Output | null | undefined): P9EnforcementResult;
|