@dadado/agent-kit-cli 4.4.4 → 4.4.7
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/dist/index.js +77 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18,8 +18,11 @@ var DEFAULT_PROTECTED_PATHS = [
|
|
|
18
18
|
".cursor/HANDOFF.md",
|
|
19
19
|
".cursor/plans/**",
|
|
20
20
|
".cursor/memory/**",
|
|
21
|
-
".cursor/context
|
|
21
|
+
".cursor/context/config.json",
|
|
22
|
+
".cursor/context/current/**",
|
|
23
|
+
".cursor/context/backups/**"
|
|
22
24
|
];
|
|
25
|
+
var LEGACY_CONTEXT_PROTECTED_GLOB = ".cursor/context/**";
|
|
23
26
|
var DOMAIN_PACK_IDS = [
|
|
24
27
|
"cybersec",
|
|
25
28
|
"devops",
|
|
@@ -116,11 +119,32 @@ function matchesAnyGlob(relPath, globs) {
|
|
|
116
119
|
}
|
|
117
120
|
|
|
118
121
|
// src/lifecycle/protected.ts
|
|
122
|
+
var CONTEXT_SESSION_GLOBS = [
|
|
123
|
+
".cursor/context/config.json",
|
|
124
|
+
".cursor/context/current/**",
|
|
125
|
+
".cursor/context/backups/**"
|
|
126
|
+
];
|
|
127
|
+
function normalizeProtectedGlobs(globs) {
|
|
128
|
+
const out = [];
|
|
129
|
+
let sawLegacyContext = false;
|
|
130
|
+
for (const raw of globs) {
|
|
131
|
+
const g = normalizeRelPath(raw);
|
|
132
|
+
if (g === LEGACY_CONTEXT_PROTECTED_GLOB) {
|
|
133
|
+
sawLegacyContext = true;
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
out.push(g);
|
|
137
|
+
}
|
|
138
|
+
if (sawLegacyContext) {
|
|
139
|
+
out.push(...CONTEXT_SESSION_GLOBS);
|
|
140
|
+
}
|
|
141
|
+
return [...new Set(out)];
|
|
142
|
+
}
|
|
119
143
|
function resolveProtectedGlobs(manifest) {
|
|
120
144
|
const fromManifest = manifest?.protected ?? [];
|
|
121
145
|
const overrides = (manifest?.overrides ?? []).map((o) => o.path);
|
|
122
146
|
const merged = [...DEFAULT_PROTECTED_PATHS, ...fromManifest, ...overrides];
|
|
123
|
-
return
|
|
147
|
+
return normalizeProtectedGlobs(merged);
|
|
124
148
|
}
|
|
125
149
|
function isProtectedPath(relPath, globs) {
|
|
126
150
|
return matchesAnyGlob(relPath, globs);
|
|
@@ -192,7 +216,7 @@ function buildManifest(input) {
|
|
|
192
216
|
const manifest = {
|
|
193
217
|
schemaVersion: 1,
|
|
194
218
|
version: input.version,
|
|
195
|
-
protected: input.protected ?? [...DEFAULT_PROTECTED_PATHS]
|
|
219
|
+
protected: normalizeProtectedGlobs(input.protected ?? [...DEFAULT_PROTECTED_PATHS])
|
|
196
220
|
};
|
|
197
221
|
if (input.profile) manifest.profile = input.profile;
|
|
198
222
|
if (input.packs?.length) manifest.packs = [...new Set(input.packs)].sort();
|
|
@@ -925,6 +949,32 @@ var L0_ARTIFACTS = [
|
|
|
925
949
|
target: ".cursor/commands/git-staging.md"
|
|
926
950
|
},
|
|
927
951
|
{ source: ".cursor/commands/git-prod.md", target: ".cursor/commands/git-prod.md" },
|
|
952
|
+
{
|
|
953
|
+
source: ".cursor/commands/plan-external-review.md",
|
|
954
|
+
target: ".cursor/commands/plan-external-review.md"
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
source: ".cursor/commands/plan-review-triage.md",
|
|
958
|
+
target: ".cursor/commands/plan-review-triage.md"
|
|
959
|
+
},
|
|
960
|
+
// Context (templates + example config; private config.json is not L0)
|
|
961
|
+
{
|
|
962
|
+
source: ".cursor/context/templates/plan-external-review-prompt.md",
|
|
963
|
+
target: ".cursor/context/templates/plan-external-review-prompt.md"
|
|
964
|
+
},
|
|
965
|
+
{
|
|
966
|
+
source: ".cursor/context/templates/plan-monitor.md",
|
|
967
|
+
target: ".cursor/context/templates/plan-monitor.md"
|
|
968
|
+
},
|
|
969
|
+
{
|
|
970
|
+
source: ".cursor/context/config.example.json",
|
|
971
|
+
target: ".cursor/context/config.example.json"
|
|
972
|
+
},
|
|
973
|
+
// Scripts (canonical launcher; consumers never receive repo-root scripts/)
|
|
974
|
+
{
|
|
975
|
+
source: ".cursor/scripts/plan-external-review.sh",
|
|
976
|
+
target: ".cursor/scripts/plan-external-review.sh"
|
|
977
|
+
},
|
|
928
978
|
// Secrets gate (structural)
|
|
929
979
|
{
|
|
930
980
|
source: ".cursor/hooks/pre-commit/check-secrets.sh",
|
|
@@ -2672,7 +2722,8 @@ import path28 from "path";
|
|
|
2672
2722
|
// src/plan-loop/external-review.ts
|
|
2673
2723
|
import { spawn as spawn3 } from "child_process";
|
|
2674
2724
|
import path25 from "path";
|
|
2675
|
-
var
|
|
2725
|
+
var CANONICAL_REL = path25.join(".cursor", "scripts", "plan-external-review.sh");
|
|
2726
|
+
var FALLBACK_REL = path25.join("scripts", "plan-external-review.sh");
|
|
2676
2727
|
function isPlanExhaustedReason(reason) {
|
|
2677
2728
|
const r = reason.trim().toLowerCase();
|
|
2678
2729
|
if (!r) return false;
|
|
@@ -2689,20 +2740,32 @@ function shouldArmExternalPlanReview(input) {
|
|
|
2689
2740
|
if (input.stopReason && isPlanExhaustedReason(input.stopReason)) return true;
|
|
2690
2741
|
return false;
|
|
2691
2742
|
}
|
|
2692
|
-
async function armExternalPlanReview(root,
|
|
2693
|
-
const spawnFn =
|
|
2694
|
-
const existsFn =
|
|
2695
|
-
const log =
|
|
2696
|
-
const
|
|
2697
|
-
|
|
2743
|
+
async function armExternalPlanReview(root, options = {}) {
|
|
2744
|
+
const spawnFn = options.spawnFn ?? spawn3;
|
|
2745
|
+
const existsFn = options.existsFn ?? fileExists;
|
|
2746
|
+
const log = options.log ?? ((line) => console.log(line));
|
|
2747
|
+
const force = options.force === true;
|
|
2748
|
+
const canonicalPath = path25.join(root, CANONICAL_REL);
|
|
2749
|
+
const fallbackPath = path25.join(root, FALLBACK_REL);
|
|
2750
|
+
let scriptPath = null;
|
|
2751
|
+
let scriptRel = CANONICAL_REL;
|
|
2752
|
+
if (await existsFn(canonicalPath)) {
|
|
2753
|
+
scriptPath = canonicalPath;
|
|
2754
|
+
scriptRel = CANONICAL_REL;
|
|
2755
|
+
} else if (await existsFn(fallbackPath)) {
|
|
2756
|
+
scriptPath = fallbackPath;
|
|
2757
|
+
scriptRel = FALLBACK_REL;
|
|
2758
|
+
}
|
|
2759
|
+
if (!scriptPath) {
|
|
2698
2760
|
log(
|
|
2699
|
-
`tip: ${
|
|
2761
|
+
`tip: ${CANONICAL_REL} missing (optional wrapper: ${FALLBACK_REL}). Manual: /plan-external-review (enable externalPlanReview in .cursor/context/config.json).`
|
|
2700
2762
|
);
|
|
2701
2763
|
return { invoked: false, exitCode: null, output: "" };
|
|
2702
2764
|
}
|
|
2703
2765
|
log("Plan exhausted: arming optional external plan review (opt-in handled by script)...");
|
|
2766
|
+
const args = force ? [scriptPath, "--force"] : [scriptPath];
|
|
2704
2767
|
return new Promise((resolve) => {
|
|
2705
|
-
const child = spawnFn("bash",
|
|
2768
|
+
const child = spawnFn("bash", args, {
|
|
2706
2769
|
cwd: root,
|
|
2707
2770
|
env: process.env
|
|
2708
2771
|
});
|
|
@@ -2720,14 +2783,14 @@ async function armExternalPlanReview(root, deps = {}) {
|
|
|
2720
2783
|
});
|
|
2721
2784
|
child.on("error", (err) => {
|
|
2722
2785
|
log(
|
|
2723
|
-
`tip: external plan review launcher failed (${err.message}). Manual: ${
|
|
2786
|
+
`tip: external plan review launcher failed (${err.message}). Manual: ${scriptRel} or /plan-external-review`
|
|
2724
2787
|
);
|
|
2725
2788
|
resolve({ invoked: true, exitCode: null, output });
|
|
2726
2789
|
});
|
|
2727
2790
|
child.on("close", (code) => {
|
|
2728
2791
|
if (code !== 0 && code !== null) {
|
|
2729
2792
|
log(
|
|
2730
|
-
`tip: external plan review exited ${code} (ignored; does not fail the loop). Manual: ${
|
|
2793
|
+
`tip: external plan review exited ${code} (ignored; does not fail the loop). Manual: ${scriptRel} or /plan-external-review`
|
|
2731
2794
|
);
|
|
2732
2795
|
}
|
|
2733
2796
|
resolve({ invoked: true, exitCode: code, output });
|
package/package.json
CHANGED