@hasna/instructions 0.4.39 → 0.4.42
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/cli/index.js +200 -161
- package/dist/index.js +326 -286
- package/dist/lib/instruction-graph.d.ts.map +1 -1
- package/dist/lib/session-render.d.ts +2 -0
- package/dist/lib/session-render.d.ts.map +1 -1
- package/dist/mcp/index.js +140 -135
- package/dist/server/cloud-auth.test.d.ts +2 -0
- package/dist/server/cloud-auth.test.d.ts.map +1 -0
- package/dist/server/cloud.d.ts +5 -2
- package/dist/server/cloud.d.ts.map +1 -1
- package/dist/server/cloud.test.d.ts +2 -0
- package/dist/server/cloud.test.d.ts.map +1 -0
- package/dist/server/index.js +185 -108
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1060,113 +1060,113 @@ import { basename, dirname, isAbsolute, join as join4, parse, relative, resolve
|
|
|
1060
1060
|
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/external.js
|
|
1061
1061
|
var exports_external = {};
|
|
1062
1062
|
__export(exports_external, {
|
|
1063
|
-
|
|
1064
|
-
DIRTY: () => DIRTY,
|
|
1065
|
-
EMPTY_PATH: () => EMPTY_PATH,
|
|
1066
|
-
INVALID: () => INVALID,
|
|
1067
|
-
NEVER: () => NEVER,
|
|
1068
|
-
OK: () => OK,
|
|
1069
|
-
ParseStatus: () => ParseStatus,
|
|
1070
|
-
Schema: () => ZodType,
|
|
1071
|
-
ZodAny: () => ZodAny,
|
|
1072
|
-
ZodArray: () => ZodArray,
|
|
1073
|
-
ZodBigInt: () => ZodBigInt,
|
|
1074
|
-
ZodBoolean: () => ZodBoolean,
|
|
1075
|
-
ZodBranded: () => ZodBranded,
|
|
1076
|
-
ZodCatch: () => ZodCatch,
|
|
1077
|
-
ZodDate: () => ZodDate,
|
|
1078
|
-
ZodDefault: () => ZodDefault,
|
|
1079
|
-
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
1080
|
-
ZodEffects: () => ZodEffects,
|
|
1081
|
-
ZodEnum: () => ZodEnum,
|
|
1082
|
-
ZodError: () => ZodError,
|
|
1083
|
-
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
1084
|
-
ZodFunction: () => ZodFunction,
|
|
1085
|
-
ZodIntersection: () => ZodIntersection,
|
|
1086
|
-
ZodIssueCode: () => ZodIssueCode,
|
|
1087
|
-
ZodLazy: () => ZodLazy,
|
|
1088
|
-
ZodLiteral: () => ZodLiteral,
|
|
1089
|
-
ZodMap: () => ZodMap,
|
|
1090
|
-
ZodNaN: () => ZodNaN,
|
|
1091
|
-
ZodNativeEnum: () => ZodNativeEnum,
|
|
1092
|
-
ZodNever: () => ZodNever,
|
|
1093
|
-
ZodNull: () => ZodNull,
|
|
1094
|
-
ZodNullable: () => ZodNullable,
|
|
1095
|
-
ZodNumber: () => ZodNumber,
|
|
1096
|
-
ZodObject: () => ZodObject,
|
|
1097
|
-
ZodOptional: () => ZodOptional,
|
|
1098
|
-
ZodParsedType: () => ZodParsedType,
|
|
1099
|
-
ZodPipeline: () => ZodPipeline,
|
|
1100
|
-
ZodPromise: () => ZodPromise,
|
|
1101
|
-
ZodReadonly: () => ZodReadonly,
|
|
1102
|
-
ZodRecord: () => ZodRecord,
|
|
1103
|
-
ZodSchema: () => ZodType,
|
|
1104
|
-
ZodSet: () => ZodSet,
|
|
1105
|
-
ZodString: () => ZodString,
|
|
1106
|
-
ZodSymbol: () => ZodSymbol,
|
|
1107
|
-
ZodTransformer: () => ZodEffects,
|
|
1108
|
-
ZodTuple: () => ZodTuple,
|
|
1109
|
-
ZodType: () => ZodType,
|
|
1110
|
-
ZodUndefined: () => ZodUndefined,
|
|
1111
|
-
ZodUnion: () => ZodUnion,
|
|
1112
|
-
ZodUnknown: () => ZodUnknown,
|
|
1113
|
-
ZodVoid: () => ZodVoid,
|
|
1114
|
-
addIssueToContext: () => addIssueToContext,
|
|
1115
|
-
any: () => anyType,
|
|
1116
|
-
array: () => arrayType,
|
|
1117
|
-
bigint: () => bigIntType,
|
|
1118
|
-
boolean: () => booleanType,
|
|
1119
|
-
coerce: () => coerce,
|
|
1120
|
-
custom: () => custom,
|
|
1121
|
-
date: () => dateType,
|
|
1122
|
-
datetimeRegex: () => datetimeRegex,
|
|
1123
|
-
defaultErrorMap: () => en_default,
|
|
1124
|
-
discriminatedUnion: () => discriminatedUnionType,
|
|
1125
|
-
effect: () => effectsType,
|
|
1126
|
-
enum: () => enumType,
|
|
1127
|
-
function: () => functionType,
|
|
1128
|
-
getErrorMap: () => getErrorMap,
|
|
1129
|
-
getParsedType: () => getParsedType,
|
|
1130
|
-
instanceof: () => instanceOfType,
|
|
1131
|
-
intersection: () => intersectionType,
|
|
1132
|
-
isAborted: () => isAborted,
|
|
1133
|
-
isAsync: () => isAsync,
|
|
1134
|
-
isDirty: () => isDirty,
|
|
1135
|
-
isValid: () => isValid,
|
|
1136
|
-
late: () => late,
|
|
1137
|
-
lazy: () => lazyType,
|
|
1138
|
-
literal: () => literalType,
|
|
1139
|
-
makeIssue: () => makeIssue,
|
|
1140
|
-
map: () => mapType,
|
|
1141
|
-
nan: () => nanType,
|
|
1142
|
-
nativeEnum: () => nativeEnumType,
|
|
1143
|
-
never: () => neverType,
|
|
1144
|
-
null: () => nullType,
|
|
1145
|
-
nullable: () => nullableType,
|
|
1146
|
-
number: () => numberType,
|
|
1147
|
-
object: () => objectType,
|
|
1148
|
-
objectUtil: () => objectUtil,
|
|
1149
|
-
oboolean: () => oboolean,
|
|
1150
|
-
onumber: () => onumber,
|
|
1151
|
-
optional: () => optionalType,
|
|
1152
|
-
ostring: () => ostring,
|
|
1153
|
-
pipeline: () => pipelineType,
|
|
1154
|
-
preprocess: () => preprocessType,
|
|
1155
|
-
promise: () => promiseType,
|
|
1156
|
-
quotelessJson: () => quotelessJson,
|
|
1157
|
-
record: () => recordType,
|
|
1158
|
-
set: () => setType,
|
|
1159
|
-
setErrorMap: () => setErrorMap,
|
|
1160
|
-
strictObject: () => strictObjectType,
|
|
1161
|
-
string: () => stringType,
|
|
1162
|
-
symbol: () => symbolType,
|
|
1163
|
-
transformer: () => effectsType,
|
|
1164
|
-
tuple: () => tupleType,
|
|
1165
|
-
undefined: () => undefinedType,
|
|
1166
|
-
union: () => unionType,
|
|
1167
|
-
unknown: () => unknownType,
|
|
1063
|
+
void: () => voidType,
|
|
1168
1064
|
util: () => util,
|
|
1169
|
-
|
|
1065
|
+
unknown: () => unknownType,
|
|
1066
|
+
union: () => unionType,
|
|
1067
|
+
undefined: () => undefinedType,
|
|
1068
|
+
tuple: () => tupleType,
|
|
1069
|
+
transformer: () => effectsType,
|
|
1070
|
+
symbol: () => symbolType,
|
|
1071
|
+
string: () => stringType,
|
|
1072
|
+
strictObject: () => strictObjectType,
|
|
1073
|
+
setErrorMap: () => setErrorMap,
|
|
1074
|
+
set: () => setType,
|
|
1075
|
+
record: () => recordType,
|
|
1076
|
+
quotelessJson: () => quotelessJson,
|
|
1077
|
+
promise: () => promiseType,
|
|
1078
|
+
preprocess: () => preprocessType,
|
|
1079
|
+
pipeline: () => pipelineType,
|
|
1080
|
+
ostring: () => ostring,
|
|
1081
|
+
optional: () => optionalType,
|
|
1082
|
+
onumber: () => onumber,
|
|
1083
|
+
oboolean: () => oboolean,
|
|
1084
|
+
objectUtil: () => objectUtil,
|
|
1085
|
+
object: () => objectType,
|
|
1086
|
+
number: () => numberType,
|
|
1087
|
+
nullable: () => nullableType,
|
|
1088
|
+
null: () => nullType,
|
|
1089
|
+
never: () => neverType,
|
|
1090
|
+
nativeEnum: () => nativeEnumType,
|
|
1091
|
+
nan: () => nanType,
|
|
1092
|
+
map: () => mapType,
|
|
1093
|
+
makeIssue: () => makeIssue,
|
|
1094
|
+
literal: () => literalType,
|
|
1095
|
+
lazy: () => lazyType,
|
|
1096
|
+
late: () => late,
|
|
1097
|
+
isValid: () => isValid,
|
|
1098
|
+
isDirty: () => isDirty,
|
|
1099
|
+
isAsync: () => isAsync,
|
|
1100
|
+
isAborted: () => isAborted,
|
|
1101
|
+
intersection: () => intersectionType,
|
|
1102
|
+
instanceof: () => instanceOfType,
|
|
1103
|
+
getParsedType: () => getParsedType,
|
|
1104
|
+
getErrorMap: () => getErrorMap,
|
|
1105
|
+
function: () => functionType,
|
|
1106
|
+
enum: () => enumType,
|
|
1107
|
+
effect: () => effectsType,
|
|
1108
|
+
discriminatedUnion: () => discriminatedUnionType,
|
|
1109
|
+
defaultErrorMap: () => en_default,
|
|
1110
|
+
datetimeRegex: () => datetimeRegex,
|
|
1111
|
+
date: () => dateType,
|
|
1112
|
+
custom: () => custom,
|
|
1113
|
+
coerce: () => coerce,
|
|
1114
|
+
boolean: () => booleanType,
|
|
1115
|
+
bigint: () => bigIntType,
|
|
1116
|
+
array: () => arrayType,
|
|
1117
|
+
any: () => anyType,
|
|
1118
|
+
addIssueToContext: () => addIssueToContext,
|
|
1119
|
+
ZodVoid: () => ZodVoid,
|
|
1120
|
+
ZodUnknown: () => ZodUnknown,
|
|
1121
|
+
ZodUnion: () => ZodUnion,
|
|
1122
|
+
ZodUndefined: () => ZodUndefined,
|
|
1123
|
+
ZodType: () => ZodType,
|
|
1124
|
+
ZodTuple: () => ZodTuple,
|
|
1125
|
+
ZodTransformer: () => ZodEffects,
|
|
1126
|
+
ZodSymbol: () => ZodSymbol,
|
|
1127
|
+
ZodString: () => ZodString,
|
|
1128
|
+
ZodSet: () => ZodSet,
|
|
1129
|
+
ZodSchema: () => ZodType,
|
|
1130
|
+
ZodRecord: () => ZodRecord,
|
|
1131
|
+
ZodReadonly: () => ZodReadonly,
|
|
1132
|
+
ZodPromise: () => ZodPromise,
|
|
1133
|
+
ZodPipeline: () => ZodPipeline,
|
|
1134
|
+
ZodParsedType: () => ZodParsedType,
|
|
1135
|
+
ZodOptional: () => ZodOptional,
|
|
1136
|
+
ZodObject: () => ZodObject,
|
|
1137
|
+
ZodNumber: () => ZodNumber,
|
|
1138
|
+
ZodNullable: () => ZodNullable,
|
|
1139
|
+
ZodNull: () => ZodNull,
|
|
1140
|
+
ZodNever: () => ZodNever,
|
|
1141
|
+
ZodNativeEnum: () => ZodNativeEnum,
|
|
1142
|
+
ZodNaN: () => ZodNaN,
|
|
1143
|
+
ZodMap: () => ZodMap,
|
|
1144
|
+
ZodLiteral: () => ZodLiteral,
|
|
1145
|
+
ZodLazy: () => ZodLazy,
|
|
1146
|
+
ZodIssueCode: () => ZodIssueCode,
|
|
1147
|
+
ZodIntersection: () => ZodIntersection,
|
|
1148
|
+
ZodFunction: () => ZodFunction,
|
|
1149
|
+
ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
|
|
1150
|
+
ZodError: () => ZodError,
|
|
1151
|
+
ZodEnum: () => ZodEnum,
|
|
1152
|
+
ZodEffects: () => ZodEffects,
|
|
1153
|
+
ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
|
|
1154
|
+
ZodDefault: () => ZodDefault,
|
|
1155
|
+
ZodDate: () => ZodDate,
|
|
1156
|
+
ZodCatch: () => ZodCatch,
|
|
1157
|
+
ZodBranded: () => ZodBranded,
|
|
1158
|
+
ZodBoolean: () => ZodBoolean,
|
|
1159
|
+
ZodBigInt: () => ZodBigInt,
|
|
1160
|
+
ZodArray: () => ZodArray,
|
|
1161
|
+
ZodAny: () => ZodAny,
|
|
1162
|
+
Schema: () => ZodType,
|
|
1163
|
+
ParseStatus: () => ParseStatus,
|
|
1164
|
+
OK: () => OK,
|
|
1165
|
+
NEVER: () => NEVER,
|
|
1166
|
+
INVALID: () => INVALID,
|
|
1167
|
+
EMPTY_PATH: () => EMPTY_PATH,
|
|
1168
|
+
DIRTY: () => DIRTY,
|
|
1169
|
+
BRAND: () => BRAND
|
|
1170
1170
|
});
|
|
1171
1171
|
|
|
1172
1172
|
// ../../node_modules/.bun/zod@3.25.76/node_modules/zod/v3/helpers/util.js
|
|
@@ -8138,10 +8138,6 @@ function applyTransform(source, output, context = {}) {
|
|
|
8138
8138
|
}
|
|
8139
8139
|
}
|
|
8140
8140
|
|
|
8141
|
-
// src/lib/asset-plan.ts
|
|
8142
|
-
import { createHash as createHash3 } from "crypto";
|
|
8143
|
-
import { isAbsolute as isAbsolute2, posix, resolve as resolve3 } from "path";
|
|
8144
|
-
|
|
8145
8141
|
// src/lib/provider-version.ts
|
|
8146
8142
|
function providerVersionSatisfies(version, range) {
|
|
8147
8143
|
const current = parseProviderVersion(version);
|
|
@@ -8186,6 +8182,8 @@ function compareProviderVersions(left, right) {
|
|
|
8186
8182
|
}
|
|
8187
8183
|
|
|
8188
8184
|
// src/lib/asset-plan.ts
|
|
8185
|
+
import { createHash as createHash3 } from "crypto";
|
|
8186
|
+
import { isAbsolute as isAbsolute2, posix, resolve as resolve3 } from "path";
|
|
8189
8187
|
var ASSET_PLAN_SCHEMA = "hasna.instructions.asset-plan/v1";
|
|
8190
8188
|
var ASSET_CAPABILITY_SCHEMA = "hasna.instructions.asset-capability/v1";
|
|
8191
8189
|
var ASSET_BUNDLE_SCHEMA = "hasna.instructions.asset-bundle/v1";
|
|
@@ -9593,16 +9591,51 @@ function indexHeader(tool, profile) {
|
|
|
9593
9591
|
].join(`
|
|
9594
9592
|
`);
|
|
9595
9593
|
}
|
|
9596
|
-
|
|
9594
|
+
var CLAUDE_PATHS_RULES_VERSION_RANGE = ">=2.1.84";
|
|
9595
|
+
function isCompiledClaudeGlobSource(adapter, source, providerVersion) {
|
|
9596
|
+
if (adapter.tool !== "claude")
|
|
9597
|
+
return false;
|
|
9598
|
+
if (providerVersion && !providerVersionSatisfies(providerVersion, CLAUDE_PATHS_RULES_VERSION_RANGE))
|
|
9599
|
+
return false;
|
|
9600
|
+
const compiledBinding = source.provenance?.["profileBinding"];
|
|
9601
|
+
if (!compiledBinding || typeof compiledBinding !== "object")
|
|
9602
|
+
return false;
|
|
9603
|
+
const activation = source.metadata?.["activation"];
|
|
9604
|
+
return activation?.mode === "glob";
|
|
9605
|
+
}
|
|
9606
|
+
function claudeGlobRuleFile(targetHome, index, source) {
|
|
9607
|
+
const globs = source.globs ?? [];
|
|
9608
|
+
if (globs.length === 0)
|
|
9609
|
+
throw new Error(`Claude glob source ${source.id} has no paths.`);
|
|
9610
|
+
const n = String(index + 1).padStart(2, "0");
|
|
9611
|
+
const relativePath = posix2.join("rules", `${n}-${source.normalizedId}.md`);
|
|
9612
|
+
const content = [
|
|
9613
|
+
"---",
|
|
9614
|
+
"paths:",
|
|
9615
|
+
...globs.map((glob) => ` - ${yamlQuote2(glob)}`),
|
|
9616
|
+
"---",
|
|
9617
|
+
"",
|
|
9618
|
+
sectionForSource(source),
|
|
9619
|
+
...source.resolvedRules.flatMap((rule) => ["", sectionForRule(source, rule)])
|
|
9620
|
+
].join(`
|
|
9621
|
+
`);
|
|
9622
|
+
return makeFile(targetHome, relativePath, "rule", content, [source.id, ...source.resolvedRules.map((rule) => rule.id)]);
|
|
9623
|
+
}
|
|
9624
|
+
function buildNativeImportFiles(targetHome, adapter, profile, sources, providerVersion) {
|
|
9597
9625
|
const indexFile = adapter.indexFile;
|
|
9598
|
-
const fragments = sources.flatMap((source, index2) =>
|
|
9599
|
-
|
|
9600
|
-
|
|
9601
|
-
|
|
9626
|
+
const fragments = sources.flatMap((source, index2) => {
|
|
9627
|
+
if (isCompiledClaudeGlobSource(adapter, source, providerVersion))
|
|
9628
|
+
return [];
|
|
9629
|
+
return [
|
|
9630
|
+
makeFile(targetHome, fragmentPath(adapter, index2, source), "fragment", sectionForSource(source), [source.id]),
|
|
9631
|
+
...source.resolvedRules.map((rule) => makeFile(targetHome, ruleFragmentPath(adapter, source, rule), "rule", sectionForRule(source, rule), [source.id, rule.id]))
|
|
9632
|
+
];
|
|
9633
|
+
});
|
|
9634
|
+
const conditionalRules = sources.flatMap((source, index2) => isCompiledClaudeGlobSource(adapter, source, providerVersion) ? [claudeGlobRuleFile(targetHome, index2, source)] : []);
|
|
9602
9635
|
const imports = fragments.map((file) => `@${importPath(indexFile, file.relativePath)}`);
|
|
9603
9636
|
const index = makeFile(targetHome, indexFile, "index", [indexHeader(adapter.tool, profile), ...imports].join(`
|
|
9604
9637
|
`), sources.map((source) => source.id));
|
|
9605
|
-
return [index, ...fragments];
|
|
9638
|
+
return [index, ...fragments, ...conditionalRules];
|
|
9606
9639
|
}
|
|
9607
9640
|
function buildFlattenedMarkdownFiles(targetHome, adapter, profile, sources) {
|
|
9608
9641
|
const content = [
|
|
@@ -9790,10 +9823,10 @@ function makeAntigravityRuleFile(targetHome, relativePath, content, sourceIds) {
|
|
|
9790
9823
|
}
|
|
9791
9824
|
return file;
|
|
9792
9825
|
}
|
|
9793
|
-
function buildFiles(targetHome, adapter, profile, sources, providerConfig) {
|
|
9826
|
+
function buildFiles(targetHome, adapter, profile, sources, providerConfig, providerVersion) {
|
|
9794
9827
|
switch (adapter.mode) {
|
|
9795
9828
|
case "native-imports":
|
|
9796
|
-
return buildNativeImportFiles(targetHome, adapter, profile, sources);
|
|
9829
|
+
return buildNativeImportFiles(targetHome, adapter, profile, sources, providerVersion);
|
|
9797
9830
|
case "flattened-markdown":
|
|
9798
9831
|
return buildFlattenedMarkdownFiles(targetHome, adapter, profile, sources);
|
|
9799
9832
|
case "cursor-mdc":
|
|
@@ -10040,7 +10073,7 @@ function planSessionRender(input) {
|
|
|
10040
10073
|
if (input.providerConfig && input.tool !== "opencode") {
|
|
10041
10074
|
throw new Error("Provider base config is supported only for OpenCode session renders.");
|
|
10042
10075
|
}
|
|
10043
|
-
const baseFiles = blocked ? [] : buildFiles(targetHome, adapter, input.profile, orderedSources, input.providerConfig);
|
|
10076
|
+
const baseFiles = blocked ? [] : buildFiles(targetHome, adapter, input.profile, orderedSources, input.providerConfig, input.provider_version);
|
|
10044
10077
|
const projectContext = blocked ? null : composeProjectContextSessionRender({
|
|
10045
10078
|
tool: input.tool,
|
|
10046
10079
|
adapter_mode: adapter.mode,
|
|
@@ -10665,7 +10698,12 @@ function capability(provider, providerVersionRange, selectedRepresentation, load
|
|
|
10665
10698
|
});
|
|
10666
10699
|
}
|
|
10667
10700
|
var DEFAULT_PROVIDER_CAPABILITIES = Object.freeze({
|
|
10668
|
-
claude: capability("claude", ">=1.0.0", "native-import", "CLAUDE.md @ imports
|
|
10701
|
+
claude: capability("claude", ">=1.0.0", "native-import", "CLAUDE.md @ imports plus path-gated rules", {
|
|
10702
|
+
activation_modes: ["always", "glob"],
|
|
10703
|
+
native_imports: true,
|
|
10704
|
+
conditional_artifacts: true,
|
|
10705
|
+
asset_surface: "code"
|
|
10706
|
+
}),
|
|
10669
10707
|
codex: capability("codex", ">=0.1.0", "flattened", "AGENTS.md", { asset_surface: "cli" }),
|
|
10670
10708
|
cursor: capability("cursor", ">=1.0.0", "cursor-rule", ".cursor/rules/*.mdc", { activation_modes: ["always", "glob"], conditional_artifacts: true, asset_surface: "ide" }),
|
|
10671
10709
|
opencode: capability("opencode", ">=1.0.0", "managed-fragment", "opencode.json instructions", { provider_variant: "v1-instructions", session_surface: "opencode-config-instructions" }),
|
|
@@ -11011,7 +11049,6 @@ function planProfileSessionRender(input) {
|
|
|
11011
11049
|
});
|
|
11012
11050
|
const {
|
|
11013
11051
|
profile_id: _profileId,
|
|
11014
|
-
provider_version: _providerVersion,
|
|
11015
11052
|
configs: _configs,
|
|
11016
11053
|
bindings: _bindings,
|
|
11017
11054
|
asset_configs: _assetConfigs,
|
|
@@ -13751,21 +13788,24 @@ function planFileResult(plan, file, targetHome, previousHashes, previousManifest
|
|
|
13751
13788
|
function assertNotSilentManagedWipeout(plan, results) {
|
|
13752
13789
|
if (plan.allowEmptySources)
|
|
13753
13790
|
return;
|
|
13754
|
-
const
|
|
13755
|
-
const underManagedDir = (relativePath) => relativePath === managedDir || relativePath.startsWith(`${managedDir}/`);
|
|
13756
|
-
const staleDeletions = results.filter((result) => result.action === "delete" && underManagedDir(result.relativePath));
|
|
13791
|
+
const staleDeletions = results.filter((result) => result.action === "delete" && isPlanManagedFile(plan, result.relativePath, result.role));
|
|
13757
13792
|
if (staleDeletions.length === 0)
|
|
13758
13793
|
return;
|
|
13759
|
-
const managedRetained = results.some((result) => result.action !== "delete" &&
|
|
13794
|
+
const managedRetained = results.some((result) => result.action !== "delete" && isPlanManagedFile(plan, result.relativePath, result.role));
|
|
13760
13795
|
if (managedRetained)
|
|
13761
13796
|
return;
|
|
13762
|
-
throw new SessionApplyError(`Session render plan for ${plan.tool} (${plan.adapter.mode}) would delete ${staleDeletions.length} ` +
|
|
13797
|
+
throw new SessionApplyError(`Session render plan for ${plan.tool} (${plan.adapter.mode}) would delete ${staleDeletions.length} ` + "previously managed file(s) and create or update none: " + `${staleDeletions.map((result) => result.relativePath).join(", ")}. ` + "Pass --allow-empty-sources only for explicit empty renders.");
|
|
13798
|
+
}
|
|
13799
|
+
function isPlanManagedFile(plan, relativePath, role) {
|
|
13800
|
+
const managedDir = plan.adapter.managedDir;
|
|
13801
|
+
if (relativePath === managedDir || relativePath.startsWith(`${managedDir}/`))
|
|
13802
|
+
return true;
|
|
13803
|
+
return plan.tool === "claude" && role === "rule" && relativePath.startsWith("rules/");
|
|
13763
13804
|
}
|
|
13764
13805
|
function planStaleFileResults(plan, targetHome, previousManifest, currentRelativePaths, options) {
|
|
13765
13806
|
if (!previousManifest)
|
|
13766
13807
|
return [];
|
|
13767
|
-
|
|
13768
|
-
return previousManifest.files.filter((file) => !currentRelativePaths.has(file.relativePath)).filter((file) => file.relativePath === plan.adapter.managedDir || file.relativePath.startsWith(managedPrefix)).map((file) => planStaleFileResult(file, targetHome, options)).filter((result) => result !== null);
|
|
13808
|
+
return previousManifest.files.filter((file) => !currentRelativePaths.has(file.relativePath)).filter((file) => isPlanManagedFile(plan, file.relativePath, file.role)).map((file) => planStaleFileResult(file, targetHome, options)).filter((result) => result !== null);
|
|
13769
13809
|
}
|
|
13770
13810
|
function planStaleFileResult(file, targetHome, options) {
|
|
13771
13811
|
const target = resolveManifestRelativePath(file.relativePath, targetHome);
|
|
@@ -15395,163 +15435,163 @@ function toPosix(path) {
|
|
|
15395
15435
|
return path.split("\\").join("/");
|
|
15396
15436
|
}
|
|
15397
15437
|
export {
|
|
15398
|
-
|
|
15399
|
-
AGENT_OPERATING_RULES_SENTINEL_PATTERN,
|
|
15400
|
-
ASSET_BUNDLE_SCHEMA,
|
|
15401
|
-
ASSET_CAPABILITY_DESCRIPTORS,
|
|
15402
|
-
ASSET_CAPABILITY_SCHEMA,
|
|
15403
|
-
ASSET_DESTINATION_STRATEGIES,
|
|
15404
|
-
ASSET_KINDS,
|
|
15405
|
-
ASSET_PLAN_SCHEMA,
|
|
15406
|
-
ASSET_ROLLBACK_POLICIES,
|
|
15407
|
-
ASSET_SCOPES,
|
|
15408
|
-
ASSET_UNINSTALL_POLICIES,
|
|
15409
|
-
AssetPlanValidationError,
|
|
15410
|
-
CODEWITH_NATIVE_IMPORTS_ENV,
|
|
15411
|
-
CODEWITH_SHARED_TODOS_STORAGE_POLICY_REFERENCE,
|
|
15412
|
-
CODEWITH_SHARED_TODOS_STORAGE_STANDARD_CONTENT,
|
|
15413
|
-
CODEWITH_SHARED_TODOS_STORAGE_STANDARD_SLUG,
|
|
15414
|
-
CONFIG_AGENTS,
|
|
15415
|
-
CONFIG_CATEGORIES,
|
|
15416
|
-
CONFIG_FORMATS,
|
|
15417
|
-
CONFIG_KINDS,
|
|
15418
|
-
CONFIG_TRANSFORMS,
|
|
15419
|
-
CloudConfigStore,
|
|
15420
|
-
CloudHttpError,
|
|
15421
|
-
ConfigApplyError,
|
|
15422
|
-
ConfigNotFoundError,
|
|
15423
|
-
DANGEROUS_OPERATION_GUARD_STANDARD_CONTENT,
|
|
15424
|
-
DANGEROUS_OPERATION_GUARD_STANDARD_SLUG,
|
|
15425
|
-
GLOBAL_AGENT_RULES_STANDARD_CONTENT,
|
|
15426
|
-
GLOBAL_AGENT_RULES_STANDARD_SLUG,
|
|
15427
|
-
INBOX_CONVERSATIONS_MINIMUM_VERSION,
|
|
15428
|
-
INSTRUCTION_ACTIVATION_MODES,
|
|
15429
|
-
INSTRUCTION_FALLBACKS,
|
|
15430
|
-
INSTRUCTION_GRAPH_PLAN_SCHEMA,
|
|
15431
|
-
InstructionGraphValidationError,
|
|
15432
|
-
KNOWN_CONFIGS,
|
|
15433
|
-
LEGACY_CONFIGS_COMPAT_VERSION,
|
|
15434
|
-
LEGACY_CONFIGS_EXECUTABLE,
|
|
15435
|
-
LEGACY_CONFIGS_PACKAGE,
|
|
15436
|
-
LocalConfigStore,
|
|
15437
|
-
PG_MIGRATIONS,
|
|
15438
|
-
PLATFORM_PROFILE_PRESETS,
|
|
15439
|
-
PROFILE_ASSET_BINDING_SCHEMA,
|
|
15440
|
-
PROFILE_CONFIG_BINDING_SCHEMA,
|
|
15441
|
-
PROJECT_CONFIG_FILES,
|
|
15442
|
-
PROJECT_CONTEXT_CACHE_PATH,
|
|
15443
|
-
PROJECT_CONTEXT_FRAGMENT_PATH,
|
|
15444
|
-
PROJECT_CONTEXT_LOCK_PATH,
|
|
15445
|
-
PROJECT_CONTEXT_MANAGED_COMMENT,
|
|
15446
|
-
PROJECT_CONTEXT_MANIFEST_PATH,
|
|
15447
|
-
PROJECT_CONTEXT_MAX_COMMANDS,
|
|
15448
|
-
PROJECT_CONTEXT_MAX_INPUT_BYTES,
|
|
15449
|
-
PROJECT_CONTEXT_MAX_RENDERED_BYTES,
|
|
15450
|
-
PROJECT_CONTEXT_SCHEMA,
|
|
15451
|
-
PROJECT_DASHBOARD_PROFILE_VARIABLES,
|
|
15452
|
-
PROJECT_DASHBOARD_STANDARD_CONTENT,
|
|
15453
|
-
PROJECT_DASHBOARD_STANDARD_SLUG,
|
|
15454
|
-
PROVIDER_CAPABILITIES,
|
|
15455
|
-
PROVIDER_CAPABILITY_DESCRIPTORS,
|
|
15456
|
-
PROVIDER_CAPABILITY_SCHEMA,
|
|
15457
|
-
ProfileNotFoundError,
|
|
15458
|
-
ProjectContextError,
|
|
15459
|
-
RAW_STORE_ROOT_ENV,
|
|
15460
|
-
SESSION_INSTRUCTION_LAYERS,
|
|
15461
|
-
SESSION_LAYER_RANK,
|
|
15462
|
-
SESSION_RENDER_MANAGED_MARKER,
|
|
15463
|
-
SESSION_RENDER_SCHEMA,
|
|
15464
|
-
SESSION_RENDER_TOOLS,
|
|
15465
|
-
SESSION_TOOL_ADAPTERS,
|
|
15466
|
-
SessionApplyError,
|
|
15467
|
-
TemplateRenderError,
|
|
15468
|
-
applyConfig,
|
|
15469
|
-
applyConfigs,
|
|
15470
|
-
applyConfigsWithReport,
|
|
15471
|
-
applyProjectContext,
|
|
15472
|
-
applySessionRender,
|
|
15473
|
-
applyTransform,
|
|
15474
|
-
assetBundleFromConfig,
|
|
15475
|
-
boundedReadPage,
|
|
15476
|
-
buildCodexAgentsMd,
|
|
15477
|
-
buildCursorMdc,
|
|
15478
|
-
buildOpenCodeAgentsMd,
|
|
15479
|
-
checkSessionRenderDrift,
|
|
15480
|
-
cleanSessionPathInput,
|
|
15481
|
-
compareAgentOperatingRulesVersions,
|
|
15482
|
-
compileAssetPlan,
|
|
15483
|
-
compileInstructionGraph,
|
|
15484
|
-
computeProjectContextSourceHash,
|
|
15485
|
-
configAssetDigest,
|
|
15486
|
-
configAssetLocator,
|
|
15487
|
-
currentArch2 as currentArch,
|
|
15488
|
-
currentHostname2 as currentHostname,
|
|
15489
|
-
currentOs,
|
|
15490
|
-
detectAgent,
|
|
15491
|
-
detectCategory,
|
|
15492
|
-
detectFormat,
|
|
15493
|
-
detectMachineContext,
|
|
15494
|
-
diffConfig,
|
|
15495
|
-
ensureCodewithSharedTodosStorageStandardConfig,
|
|
15496
|
-
ensureDangerousOperationGuardStandardConfig,
|
|
15497
|
-
ensureGlobalAgentRulesStandardConfig,
|
|
15498
|
-
ensurePlatformProfiles,
|
|
15499
|
-
ensureProjectDashboardStandardConfig,
|
|
15500
|
-
expandPath,
|
|
15501
|
-
exportConfigs,
|
|
15502
|
-
extractTemplateVars,
|
|
15503
|
-
getConfigsStatus,
|
|
15504
|
-
getRawStoreRoot,
|
|
15505
|
-
hasSecrets,
|
|
15506
|
-
importConfigs,
|
|
15507
|
-
inspectManagedSkillRuntimes,
|
|
15508
|
-
isApiTransport,
|
|
15509
|
-
isTemplate,
|
|
15510
|
-
legacyProfileConfigBinding,
|
|
15511
|
-
machineContextToVariables,
|
|
15512
|
-
normalizeBoundedReadOptions,
|
|
15513
|
-
normalizeOsFamily,
|
|
15514
|
-
normalizeProfileAssetBinding,
|
|
15515
|
-
normalizeProfileConfigBinding,
|
|
15516
|
-
now,
|
|
15517
|
-
parseAgentOperatingRulesVersion,
|
|
15518
|
-
parseProjectContextBundle,
|
|
15519
|
-
parseTemplateVars,
|
|
15520
|
-
planProfileSessionRender,
|
|
15521
|
-
planProjectContext,
|
|
15522
|
-
planSessionRender,
|
|
15523
|
-
previewConfigs,
|
|
15524
|
-
providerVersionSatisfies,
|
|
15525
|
-
reconcileManagedSkillRuntimes,
|
|
15526
|
-
redactContent,
|
|
15527
|
-
renderMachineAwareContent,
|
|
15528
|
-
renderMachineAwareContentPreview,
|
|
15529
|
-
renderTemplate,
|
|
15530
|
-
renderTemplatePreview,
|
|
15531
|
-
resolveAgentOperatingRulesPayload,
|
|
15532
|
-
resolveAssetDestination,
|
|
15533
|
-
resolveCloudConfig,
|
|
15534
|
-
resolveConfigStore,
|
|
15535
|
-
resolveProfileVariables,
|
|
15536
|
-
resolveSessionPath,
|
|
15537
|
-
resolveSessionTargetOwnership,
|
|
15538
|
-
restoreSessionRenderSnapshot,
|
|
15539
|
-
scanPackageManagerSecrets,
|
|
15540
|
-
scanSecrets,
|
|
15541
|
-
selectAssetCapability,
|
|
15542
|
-
selectProfileConfigsForSessionRender,
|
|
15543
|
-
selectProviderCapability,
|
|
15544
|
-
slugify,
|
|
15545
|
-
sourceFromConfig,
|
|
15546
|
-
sourceFromFilePath,
|
|
15547
|
-
sourcesFromIdentityExport,
|
|
15548
|
-
stripClaudeOnlySections,
|
|
15549
|
-
syncFromDir,
|
|
15550
|
-
syncKnown,
|
|
15551
|
-
syncProject,
|
|
15552
|
-
syncToDir,
|
|
15553
|
-
syncToDisk,
|
|
15554
|
-
templateizeMachineContent,
|
|
15438
|
+
uuid,
|
|
15555
15439
|
transformSkillContent,
|
|
15556
|
-
|
|
15440
|
+
templateizeMachineContent,
|
|
15441
|
+
syncToDisk,
|
|
15442
|
+
syncToDir,
|
|
15443
|
+
syncProject,
|
|
15444
|
+
syncKnown,
|
|
15445
|
+
syncFromDir,
|
|
15446
|
+
stripClaudeOnlySections,
|
|
15447
|
+
sourcesFromIdentityExport,
|
|
15448
|
+
sourceFromFilePath,
|
|
15449
|
+
sourceFromConfig,
|
|
15450
|
+
slugify,
|
|
15451
|
+
selectProviderCapability,
|
|
15452
|
+
selectProfileConfigsForSessionRender,
|
|
15453
|
+
selectAssetCapability,
|
|
15454
|
+
scanSecrets,
|
|
15455
|
+
scanPackageManagerSecrets,
|
|
15456
|
+
restoreSessionRenderSnapshot,
|
|
15457
|
+
resolveSessionTargetOwnership,
|
|
15458
|
+
resolveSessionPath,
|
|
15459
|
+
resolveProfileVariables,
|
|
15460
|
+
resolveConfigStore,
|
|
15461
|
+
resolveCloudConfig,
|
|
15462
|
+
resolveAssetDestination,
|
|
15463
|
+
resolveAgentOperatingRulesPayload,
|
|
15464
|
+
renderTemplatePreview,
|
|
15465
|
+
renderTemplate,
|
|
15466
|
+
renderMachineAwareContentPreview,
|
|
15467
|
+
renderMachineAwareContent,
|
|
15468
|
+
redactContent,
|
|
15469
|
+
reconcileManagedSkillRuntimes,
|
|
15470
|
+
providerVersionSatisfies,
|
|
15471
|
+
previewConfigs,
|
|
15472
|
+
planSessionRender,
|
|
15473
|
+
planProjectContext,
|
|
15474
|
+
planProfileSessionRender,
|
|
15475
|
+
parseTemplateVars,
|
|
15476
|
+
parseProjectContextBundle,
|
|
15477
|
+
parseAgentOperatingRulesVersion,
|
|
15478
|
+
now,
|
|
15479
|
+
normalizeProfileConfigBinding,
|
|
15480
|
+
normalizeProfileAssetBinding,
|
|
15481
|
+
normalizeOsFamily,
|
|
15482
|
+
normalizeBoundedReadOptions,
|
|
15483
|
+
machineContextToVariables,
|
|
15484
|
+
legacyProfileConfigBinding,
|
|
15485
|
+
isTemplate,
|
|
15486
|
+
isApiTransport,
|
|
15487
|
+
inspectManagedSkillRuntimes,
|
|
15488
|
+
importConfigs,
|
|
15489
|
+
hasSecrets,
|
|
15490
|
+
getRawStoreRoot,
|
|
15491
|
+
getConfigsStatus,
|
|
15492
|
+
extractTemplateVars,
|
|
15493
|
+
exportConfigs,
|
|
15494
|
+
expandPath,
|
|
15495
|
+
ensureProjectDashboardStandardConfig,
|
|
15496
|
+
ensurePlatformProfiles,
|
|
15497
|
+
ensureGlobalAgentRulesStandardConfig,
|
|
15498
|
+
ensureDangerousOperationGuardStandardConfig,
|
|
15499
|
+
ensureCodewithSharedTodosStorageStandardConfig,
|
|
15500
|
+
diffConfig,
|
|
15501
|
+
detectMachineContext,
|
|
15502
|
+
detectFormat,
|
|
15503
|
+
detectCategory,
|
|
15504
|
+
detectAgent,
|
|
15505
|
+
currentOs,
|
|
15506
|
+
currentHostname2 as currentHostname,
|
|
15507
|
+
currentArch2 as currentArch,
|
|
15508
|
+
configAssetLocator,
|
|
15509
|
+
configAssetDigest,
|
|
15510
|
+
computeProjectContextSourceHash,
|
|
15511
|
+
compileInstructionGraph,
|
|
15512
|
+
compileAssetPlan,
|
|
15513
|
+
compareAgentOperatingRulesVersions,
|
|
15514
|
+
cleanSessionPathInput,
|
|
15515
|
+
checkSessionRenderDrift,
|
|
15516
|
+
buildOpenCodeAgentsMd,
|
|
15517
|
+
buildCursorMdc,
|
|
15518
|
+
buildCodexAgentsMd,
|
|
15519
|
+
boundedReadPage,
|
|
15520
|
+
assetBundleFromConfig,
|
|
15521
|
+
applyTransform,
|
|
15522
|
+
applySessionRender,
|
|
15523
|
+
applyProjectContext,
|
|
15524
|
+
applyConfigsWithReport,
|
|
15525
|
+
applyConfigs,
|
|
15526
|
+
applyConfig,
|
|
15527
|
+
TemplateRenderError,
|
|
15528
|
+
SessionApplyError,
|
|
15529
|
+
SESSION_TOOL_ADAPTERS,
|
|
15530
|
+
SESSION_RENDER_TOOLS,
|
|
15531
|
+
SESSION_RENDER_SCHEMA,
|
|
15532
|
+
SESSION_RENDER_MANAGED_MARKER,
|
|
15533
|
+
SESSION_LAYER_RANK,
|
|
15534
|
+
SESSION_INSTRUCTION_LAYERS,
|
|
15535
|
+
RAW_STORE_ROOT_ENV,
|
|
15536
|
+
ProjectContextError,
|
|
15537
|
+
ProfileNotFoundError,
|
|
15538
|
+
PROVIDER_CAPABILITY_SCHEMA,
|
|
15539
|
+
PROVIDER_CAPABILITY_DESCRIPTORS,
|
|
15540
|
+
PROVIDER_CAPABILITIES,
|
|
15541
|
+
PROJECT_DASHBOARD_STANDARD_SLUG,
|
|
15542
|
+
PROJECT_DASHBOARD_STANDARD_CONTENT,
|
|
15543
|
+
PROJECT_DASHBOARD_PROFILE_VARIABLES,
|
|
15544
|
+
PROJECT_CONTEXT_SCHEMA,
|
|
15545
|
+
PROJECT_CONTEXT_MAX_RENDERED_BYTES,
|
|
15546
|
+
PROJECT_CONTEXT_MAX_INPUT_BYTES,
|
|
15547
|
+
PROJECT_CONTEXT_MAX_COMMANDS,
|
|
15548
|
+
PROJECT_CONTEXT_MANIFEST_PATH,
|
|
15549
|
+
PROJECT_CONTEXT_MANAGED_COMMENT,
|
|
15550
|
+
PROJECT_CONTEXT_LOCK_PATH,
|
|
15551
|
+
PROJECT_CONTEXT_FRAGMENT_PATH,
|
|
15552
|
+
PROJECT_CONTEXT_CACHE_PATH,
|
|
15553
|
+
PROJECT_CONFIG_FILES,
|
|
15554
|
+
PROFILE_CONFIG_BINDING_SCHEMA,
|
|
15555
|
+
PROFILE_ASSET_BINDING_SCHEMA,
|
|
15556
|
+
PLATFORM_PROFILE_PRESETS,
|
|
15557
|
+
PG_MIGRATIONS,
|
|
15558
|
+
LocalConfigStore,
|
|
15559
|
+
LEGACY_CONFIGS_PACKAGE,
|
|
15560
|
+
LEGACY_CONFIGS_EXECUTABLE,
|
|
15561
|
+
LEGACY_CONFIGS_COMPAT_VERSION,
|
|
15562
|
+
KNOWN_CONFIGS,
|
|
15563
|
+
InstructionGraphValidationError,
|
|
15564
|
+
INSTRUCTION_GRAPH_PLAN_SCHEMA,
|
|
15565
|
+
INSTRUCTION_FALLBACKS,
|
|
15566
|
+
INSTRUCTION_ACTIVATION_MODES,
|
|
15567
|
+
INBOX_CONVERSATIONS_MINIMUM_VERSION,
|
|
15568
|
+
GLOBAL_AGENT_RULES_STANDARD_SLUG,
|
|
15569
|
+
GLOBAL_AGENT_RULES_STANDARD_CONTENT,
|
|
15570
|
+
DANGEROUS_OPERATION_GUARD_STANDARD_SLUG,
|
|
15571
|
+
DANGEROUS_OPERATION_GUARD_STANDARD_CONTENT,
|
|
15572
|
+
ConfigNotFoundError,
|
|
15573
|
+
ConfigApplyError,
|
|
15574
|
+
CloudHttpError,
|
|
15575
|
+
CloudConfigStore,
|
|
15576
|
+
CONFIG_TRANSFORMS,
|
|
15577
|
+
CONFIG_KINDS,
|
|
15578
|
+
CONFIG_FORMATS,
|
|
15579
|
+
CONFIG_CATEGORIES,
|
|
15580
|
+
CONFIG_AGENTS,
|
|
15581
|
+
CODEWITH_SHARED_TODOS_STORAGE_STANDARD_SLUG,
|
|
15582
|
+
CODEWITH_SHARED_TODOS_STORAGE_STANDARD_CONTENT,
|
|
15583
|
+
CODEWITH_SHARED_TODOS_STORAGE_POLICY_REFERENCE,
|
|
15584
|
+
CODEWITH_NATIVE_IMPORTS_ENV,
|
|
15585
|
+
AssetPlanValidationError,
|
|
15586
|
+
ASSET_UNINSTALL_POLICIES,
|
|
15587
|
+
ASSET_SCOPES,
|
|
15588
|
+
ASSET_ROLLBACK_POLICIES,
|
|
15589
|
+
ASSET_PLAN_SCHEMA,
|
|
15590
|
+
ASSET_KINDS,
|
|
15591
|
+
ASSET_DESTINATION_STRATEGIES,
|
|
15592
|
+
ASSET_CAPABILITY_SCHEMA,
|
|
15593
|
+
ASSET_CAPABILITY_DESCRIPTORS,
|
|
15594
|
+
ASSET_BUNDLE_SCHEMA,
|
|
15595
|
+
AGENT_OPERATING_RULES_SENTINEL_PATTERN,
|
|
15596
|
+
AGENT_OPERATING_RULES_SEMANTIC_POLICY_KEY
|
|
15557
15597
|
};
|