@kuznai/inception-engine 0.6.2 → 0.8.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 +45 -8
- package/dist/config/agents.js +1 -0
- package/dist/config/manifest.js +6 -3
- package/dist/core/deploy.d.ts +6 -2
- package/dist/core/deploy.js +341 -31
- package/dist/core/detect.d.ts +2 -2
- package/dist/core/detect.js +5 -5
- package/dist/core/ownership.d.ts +19 -7
- package/dist/core/ownership.js +9 -3
- package/dist/core/preflight.d.ts +2 -2
- package/dist/core/preflight.js +27 -5
- package/dist/core/revert.d.ts +2 -1
- package/dist/core/revert.js +229 -37
- package/dist/index.js +46 -13
- package/dist/schemas/manifest.d.ts +68 -2
- package/dist/schemas/manifest.js +61 -21
- package/dist/schemas/registry.d.ts +112 -5
- package/dist/schemas/registry.js +23 -2
- package/dist/types.d.ts +49 -3
- package/package.json +4 -2
package/dist/schemas/manifest.js
CHANGED
|
@@ -10,6 +10,9 @@ const AGENT_IDS = [
|
|
|
10
10
|
];
|
|
11
11
|
export { AGENT_IDS };
|
|
12
12
|
const SAFE_NAME_RE = /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/;
|
|
13
|
+
// Target templates must start with a known placeholder to prevent raw absolute
|
|
14
|
+
// paths or directory traversal. e.g. "{home}/.claude/settings.json" is valid.
|
|
15
|
+
const TARGET_TEMPLATE_RE = /^\{(home|appdata|xdg_config)\}/;
|
|
13
16
|
// Standalone schema used for type derivation and single-ID validation (e.g. index.ts).
|
|
14
17
|
export const AgentIdSchema = z.enum(AGENT_IDS);
|
|
15
18
|
// Used inside SkillEntrySchema.agents so that enum failures embed the received
|
|
@@ -26,27 +29,62 @@ const agentIdElement = z
|
|
|
26
29
|
}
|
|
27
30
|
})
|
|
28
31
|
.pipe(AgentIdSchema);
|
|
32
|
+
const nameField = z
|
|
33
|
+
.string({ message: "name must be a non-empty string" })
|
|
34
|
+
.min(1, { message: "name must be a non-empty string" })
|
|
35
|
+
.regex(SAFE_NAME_RE, {
|
|
36
|
+
message: "name must contain only letters, digits, hyphens, underscores, and dots, and must not start with a dot",
|
|
37
|
+
});
|
|
38
|
+
const agentsField = z
|
|
39
|
+
.array(agentIdElement, { message: "agents must be a non-empty array" })
|
|
40
|
+
.min(1, { message: "agents must be a non-empty array" })
|
|
41
|
+
.transform((arr) => [...new Set(arr)]);
|
|
42
|
+
const sourcePathField = z
|
|
43
|
+
.string({ message: "path must be a non-empty string" })
|
|
44
|
+
.min(1, { message: "path must be a non-empty string" })
|
|
45
|
+
.refine((p) => !nodePath.isAbsolute(p), {
|
|
46
|
+
message: "path must be a relative path",
|
|
47
|
+
})
|
|
48
|
+
.refine((p) => !nodePath.normalize(p).startsWith(".."), {
|
|
49
|
+
message: "path must not escape the repository root",
|
|
50
|
+
});
|
|
51
|
+
const targetTemplateField = z
|
|
52
|
+
.string({ message: "target must be a non-empty string" })
|
|
53
|
+
.min(1, { message: "target must be a non-empty string" })
|
|
54
|
+
.refine((t) => TARGET_TEMPLATE_RE.test(t), {
|
|
55
|
+
message: "target must start with a known placeholder: {home}, {appdata}, or {xdg_config}",
|
|
56
|
+
});
|
|
29
57
|
export const SkillEntrySchema = z.object({
|
|
30
|
-
name:
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
.regex(SAFE_NAME_RE, {
|
|
34
|
-
message: "name must contain only letters, digits, hyphens, underscores, and dots, and must not start with a dot",
|
|
35
|
-
}),
|
|
36
|
-
path: z
|
|
37
|
-
.string({ message: "path must be a non-empty string" })
|
|
38
|
-
.min(1, { message: "path must be a non-empty string" })
|
|
39
|
-
.refine((p) => !nodePath.isAbsolute(p), {
|
|
40
|
-
message: "path must be a relative path",
|
|
41
|
-
})
|
|
42
|
-
.refine((p) => !nodePath.normalize(p).startsWith(".."), {
|
|
43
|
-
message: "path must not escape the repository root",
|
|
44
|
-
}),
|
|
45
|
-
agents: z
|
|
46
|
-
.array(agentIdElement, { message: "agents must be a non-empty array" })
|
|
47
|
-
.min(1, { message: "agents must be a non-empty array" })
|
|
48
|
-
.transform((arr) => [...new Set(arr)]),
|
|
58
|
+
name: nameField,
|
|
59
|
+
path: sourcePathField,
|
|
60
|
+
agents: agentsField,
|
|
49
61
|
});
|
|
62
|
+
export const FileEntrySchema = z.object({
|
|
63
|
+
name: nameField,
|
|
64
|
+
path: sourcePathField,
|
|
65
|
+
target: targetTemplateField,
|
|
66
|
+
agents: agentsField,
|
|
67
|
+
});
|
|
68
|
+
export const ConfigEntrySchema = z.object({
|
|
69
|
+
name: nameField,
|
|
70
|
+
target: targetTemplateField,
|
|
71
|
+
patch: z.record(z.string(), z.unknown()),
|
|
72
|
+
agents: agentsField,
|
|
73
|
+
});
|
|
74
|
+
export const McpServerEntrySchema = z
|
|
75
|
+
.object({
|
|
76
|
+
name: z
|
|
77
|
+
.string({ message: "mcpServers entry name must be a non-empty string" })
|
|
78
|
+
.min(1, { message: "mcpServers entry name must be a non-empty string" }),
|
|
79
|
+
})
|
|
80
|
+
.passthrough();
|
|
81
|
+
export const AgentRuleEntrySchema = z
|
|
82
|
+
.object({
|
|
83
|
+
name: z
|
|
84
|
+
.string({ message: "agentRules entry name must be a non-empty string" })
|
|
85
|
+
.min(1, { message: "agentRules entry name must be a non-empty string" }),
|
|
86
|
+
})
|
|
87
|
+
.passthrough();
|
|
50
88
|
export const ManifestSchema = z.object({
|
|
51
89
|
skills: z.array(SkillEntrySchema).superRefine((skills, ctx) => {
|
|
52
90
|
const seen = new Set();
|
|
@@ -61,8 +99,10 @@ export const ManifestSchema = z.object({
|
|
|
61
99
|
seen.add(skill.name);
|
|
62
100
|
}
|
|
63
101
|
}),
|
|
64
|
-
|
|
65
|
-
|
|
102
|
+
files: z.array(FileEntrySchema).default([]),
|
|
103
|
+
configs: z.array(ConfigEntrySchema).default([]),
|
|
104
|
+
mcpServers: z.array(McpServerEntrySchema).default([]),
|
|
105
|
+
agentRules: z.array(AgentRuleEntrySchema).default([]),
|
|
66
106
|
});
|
|
67
107
|
// Parses the --agents CLI flag: comma-separated agent IDs → AgentId[]
|
|
68
108
|
export const AgentListSchema = z
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
2
|
+
declare const SkillDirRegistryEntrySchema: z.ZodObject<{
|
|
3
|
+
kind: z.ZodLiteral<"skill-dir">;
|
|
3
4
|
source: z.ZodString;
|
|
4
5
|
skill: z.ZodString;
|
|
5
6
|
agent: z.ZodEnum<{
|
|
@@ -10,15 +11,90 @@ export declare const RegistryEntrySchema: z.ZodObject<{
|
|
|
10
11
|
opencode: "opencode";
|
|
11
12
|
"github-copilot": "github-copilot";
|
|
12
13
|
}>;
|
|
13
|
-
method: z.ZodEnum<{
|
|
14
|
+
method: z.ZodOptional<z.ZodEnum<{
|
|
14
15
|
symlink: "symlink";
|
|
15
16
|
copy: "copy";
|
|
17
|
+
}>>;
|
|
18
|
+
deployed: z.ZodString;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
declare const FileWriteRegistryEntrySchema: z.ZodObject<{
|
|
21
|
+
kind: z.ZodLiteral<"file-write">;
|
|
22
|
+
source: z.ZodString;
|
|
23
|
+
skill: z.ZodString;
|
|
24
|
+
agent: z.ZodEnum<{
|
|
25
|
+
"claude-code": "claude-code";
|
|
26
|
+
codex: "codex";
|
|
27
|
+
"gemini-cli": "gemini-cli";
|
|
28
|
+
antigravity: "antigravity";
|
|
29
|
+
opencode: "opencode";
|
|
30
|
+
"github-copilot": "github-copilot";
|
|
31
|
+
}>;
|
|
32
|
+
deployed: z.ZodString;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
declare const ConfigPatchRegistryEntrySchema: z.ZodObject<{
|
|
35
|
+
kind: z.ZodLiteral<"config-patch">;
|
|
36
|
+
patch: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
37
|
+
undoPatch: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
38
|
+
skill: z.ZodString;
|
|
39
|
+
agent: z.ZodEnum<{
|
|
40
|
+
"claude-code": "claude-code";
|
|
41
|
+
codex: "codex";
|
|
42
|
+
"gemini-cli": "gemini-cli";
|
|
43
|
+
antigravity: "antigravity";
|
|
44
|
+
opencode: "opencode";
|
|
45
|
+
"github-copilot": "github-copilot";
|
|
16
46
|
}>;
|
|
17
47
|
deployed: z.ZodString;
|
|
18
48
|
}, z.core.$strip>;
|
|
49
|
+
export declare const RegistryEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
50
|
+
kind: z.ZodLiteral<"skill-dir">;
|
|
51
|
+
source: z.ZodString;
|
|
52
|
+
skill: z.ZodString;
|
|
53
|
+
agent: z.ZodEnum<{
|
|
54
|
+
"claude-code": "claude-code";
|
|
55
|
+
codex: "codex";
|
|
56
|
+
"gemini-cli": "gemini-cli";
|
|
57
|
+
antigravity: "antigravity";
|
|
58
|
+
opencode: "opencode";
|
|
59
|
+
"github-copilot": "github-copilot";
|
|
60
|
+
}>;
|
|
61
|
+
method: z.ZodOptional<z.ZodEnum<{
|
|
62
|
+
symlink: "symlink";
|
|
63
|
+
copy: "copy";
|
|
64
|
+
}>>;
|
|
65
|
+
deployed: z.ZodString;
|
|
66
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
67
|
+
kind: z.ZodLiteral<"file-write">;
|
|
68
|
+
source: z.ZodString;
|
|
69
|
+
skill: z.ZodString;
|
|
70
|
+
agent: z.ZodEnum<{
|
|
71
|
+
"claude-code": "claude-code";
|
|
72
|
+
codex: "codex";
|
|
73
|
+
"gemini-cli": "gemini-cli";
|
|
74
|
+
antigravity: "antigravity";
|
|
75
|
+
opencode: "opencode";
|
|
76
|
+
"github-copilot": "github-copilot";
|
|
77
|
+
}>;
|
|
78
|
+
deployed: z.ZodString;
|
|
79
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
80
|
+
kind: z.ZodLiteral<"config-patch">;
|
|
81
|
+
patch: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
82
|
+
undoPatch: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
83
|
+
skill: z.ZodString;
|
|
84
|
+
agent: z.ZodEnum<{
|
|
85
|
+
"claude-code": "claude-code";
|
|
86
|
+
codex: "codex";
|
|
87
|
+
"gemini-cli": "gemini-cli";
|
|
88
|
+
antigravity: "antigravity";
|
|
89
|
+
opencode: "opencode";
|
|
90
|
+
"github-copilot": "github-copilot";
|
|
91
|
+
}>;
|
|
92
|
+
deployed: z.ZodString;
|
|
93
|
+
}, z.core.$strip>], "kind">;
|
|
19
94
|
export declare const RegistrySchema: z.ZodObject<{
|
|
20
95
|
version: z.ZodLiteral<1>;
|
|
21
|
-
deployments: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
96
|
+
deployments: z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
97
|
+
kind: z.ZodLiteral<"skill-dir">;
|
|
22
98
|
source: z.ZodString;
|
|
23
99
|
skill: z.ZodString;
|
|
24
100
|
agent: z.ZodEnum<{
|
|
@@ -29,12 +105,43 @@ export declare const RegistrySchema: z.ZodObject<{
|
|
|
29
105
|
opencode: "opencode";
|
|
30
106
|
"github-copilot": "github-copilot";
|
|
31
107
|
}>;
|
|
32
|
-
method: z.ZodEnum<{
|
|
108
|
+
method: z.ZodOptional<z.ZodEnum<{
|
|
33
109
|
symlink: "symlink";
|
|
34
110
|
copy: "copy";
|
|
111
|
+
}>>;
|
|
112
|
+
deployed: z.ZodString;
|
|
113
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
114
|
+
kind: z.ZodLiteral<"file-write">;
|
|
115
|
+
source: z.ZodString;
|
|
116
|
+
skill: z.ZodString;
|
|
117
|
+
agent: z.ZodEnum<{
|
|
118
|
+
"claude-code": "claude-code";
|
|
119
|
+
codex: "codex";
|
|
120
|
+
"gemini-cli": "gemini-cli";
|
|
121
|
+
antigravity: "antigravity";
|
|
122
|
+
opencode: "opencode";
|
|
123
|
+
"github-copilot": "github-copilot";
|
|
124
|
+
}>;
|
|
125
|
+
deployed: z.ZodString;
|
|
126
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
127
|
+
kind: z.ZodLiteral<"config-patch">;
|
|
128
|
+
patch: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
129
|
+
undoPatch: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
130
|
+
skill: z.ZodString;
|
|
131
|
+
agent: z.ZodEnum<{
|
|
132
|
+
"claude-code": "claude-code";
|
|
133
|
+
codex: "codex";
|
|
134
|
+
"gemini-cli": "gemini-cli";
|
|
135
|
+
antigravity: "antigravity";
|
|
136
|
+
opencode: "opencode";
|
|
137
|
+
"github-copilot": "github-copilot";
|
|
35
138
|
}>;
|
|
36
139
|
deployed: z.ZodString;
|
|
37
|
-
}, z.core.$strip>>;
|
|
140
|
+
}, z.core.$strip>], "kind">>;
|
|
38
141
|
}, z.core.$strip>;
|
|
142
|
+
export type SkillDirRegistryEntry = z.infer<typeof SkillDirRegistryEntrySchema>;
|
|
143
|
+
export type FileWriteRegistryEntry = z.infer<typeof FileWriteRegistryEntrySchema>;
|
|
144
|
+
export type ConfigPatchRegistryEntry = z.infer<typeof ConfigPatchRegistryEntrySchema>;
|
|
39
145
|
export type RegistryEntry = z.infer<typeof RegistryEntrySchema>;
|
|
40
146
|
export type Registry = z.infer<typeof RegistrySchema>;
|
|
147
|
+
export {};
|
package/dist/schemas/registry.js
CHANGED
|
@@ -1,12 +1,33 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { AgentIdSchema } from "./manifest.js";
|
|
3
|
-
|
|
3
|
+
const SkillDirRegistryEntrySchema = z.object({
|
|
4
|
+
kind: z.literal("skill-dir"),
|
|
4
5
|
source: z.string(),
|
|
5
6
|
skill: z.string(),
|
|
6
7
|
agent: AgentIdSchema,
|
|
7
|
-
method: z.enum(["symlink", "copy"]),
|
|
8
|
+
method: z.enum(["symlink", "copy"]).optional(),
|
|
8
9
|
deployed: z.string(),
|
|
9
10
|
});
|
|
11
|
+
const FileWriteRegistryEntrySchema = z.object({
|
|
12
|
+
kind: z.literal("file-write"),
|
|
13
|
+
source: z.string(),
|
|
14
|
+
skill: z.string(),
|
|
15
|
+
agent: AgentIdSchema,
|
|
16
|
+
deployed: z.string(),
|
|
17
|
+
});
|
|
18
|
+
const ConfigPatchRegistryEntrySchema = z.object({
|
|
19
|
+
kind: z.literal("config-patch"),
|
|
20
|
+
patch: z.record(z.string(), z.unknown()),
|
|
21
|
+
undoPatch: z.record(z.string(), z.unknown()),
|
|
22
|
+
skill: z.string(),
|
|
23
|
+
agent: AgentIdSchema,
|
|
24
|
+
deployed: z.string(),
|
|
25
|
+
});
|
|
26
|
+
export const RegistryEntrySchema = z.discriminatedUnion("kind", [
|
|
27
|
+
SkillDirRegistryEntrySchema,
|
|
28
|
+
FileWriteRegistryEntrySchema,
|
|
29
|
+
ConfigPatchRegistryEntrySchema,
|
|
30
|
+
]);
|
|
10
31
|
export const RegistrySchema = z.object({
|
|
11
32
|
version: z.literal(1),
|
|
12
33
|
deployments: z.record(z.string(), RegistryEntrySchema),
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AgentId } from "./schemas/manifest.ts";
|
|
2
|
-
export type { AgentId, Manifest, SkillEntry } from "./schemas/manifest.ts";
|
|
2
|
+
export type { AgentId, ConfigEntry, FileEntry, Manifest, SkillEntry, } from "./schemas/manifest.ts";
|
|
3
3
|
export interface AgentPaths {
|
|
4
4
|
posix: string[];
|
|
5
5
|
windows: string[];
|
|
@@ -17,6 +17,11 @@ export interface AgentConfig {
|
|
|
17
17
|
detectPaths: AgentPaths;
|
|
18
18
|
detectBinary: string | null;
|
|
19
19
|
provenance: AgentProvenance;
|
|
20
|
+
policyNote?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface PlanWarning {
|
|
23
|
+
kind: "confidence" | "collision" | "ambiguity";
|
|
24
|
+
message: string;
|
|
20
25
|
}
|
|
21
26
|
export interface SkillDirDeployAction {
|
|
22
27
|
kind: "skill-dir";
|
|
@@ -25,15 +30,56 @@ export interface SkillDirDeployAction {
|
|
|
25
30
|
source: string;
|
|
26
31
|
target: string;
|
|
27
32
|
method: "symlink" | "copy";
|
|
33
|
+
confidence: Confidence;
|
|
34
|
+
}
|
|
35
|
+
export interface FileWriteDeployAction {
|
|
36
|
+
kind: "file-write";
|
|
37
|
+
skill: string;
|
|
38
|
+
agent: AgentId;
|
|
39
|
+
source: string;
|
|
40
|
+
target: string;
|
|
41
|
+
confidence?: Confidence;
|
|
28
42
|
}
|
|
29
|
-
export
|
|
43
|
+
export interface ConfigPatchDeployAction {
|
|
44
|
+
kind: "config-patch";
|
|
45
|
+
skill: string;
|
|
46
|
+
agent: AgentId;
|
|
47
|
+
target: string;
|
|
48
|
+
patch: unknown;
|
|
49
|
+
confidence?: Confidence;
|
|
50
|
+
}
|
|
51
|
+
export type DeployAction = SkillDirDeployAction | FileWriteDeployAction | ConfigPatchDeployAction;
|
|
30
52
|
export interface SkillDirRevertAction {
|
|
31
53
|
kind: "skill-dir";
|
|
32
54
|
skill: string;
|
|
33
55
|
agent: AgentId;
|
|
34
56
|
target: string;
|
|
35
57
|
}
|
|
36
|
-
export
|
|
58
|
+
export interface FileWriteRevertAction {
|
|
59
|
+
kind: "file-write";
|
|
60
|
+
skill: string;
|
|
61
|
+
agent: AgentId;
|
|
62
|
+
target: string;
|
|
63
|
+
}
|
|
64
|
+
export interface ConfigPatchRevertAction {
|
|
65
|
+
kind: "config-patch";
|
|
66
|
+
skill: string;
|
|
67
|
+
agent: AgentId;
|
|
68
|
+
target: string;
|
|
69
|
+
}
|
|
70
|
+
export type RevertAction = SkillDirRevertAction | FileWriteRevertAction | ConfigPatchRevertAction;
|
|
71
|
+
export type PlannedChangeVerb = "create-symlink" | "copy-dir" | "write-file" | "patch-config" | "remove" | "unapply-patch";
|
|
72
|
+
export interface PlannedChange {
|
|
73
|
+
verb: PlannedChangeVerb;
|
|
74
|
+
kind: "skill-dir" | "file-write" | "config-patch";
|
|
75
|
+
skill: string;
|
|
76
|
+
agent: AgentId;
|
|
77
|
+
source?: string;
|
|
78
|
+
target: string;
|
|
79
|
+
method?: "symlink" | "copy";
|
|
80
|
+
patch?: Record<string, unknown>;
|
|
81
|
+
confidence?: Confidence;
|
|
82
|
+
}
|
|
37
83
|
export interface CliOptions {
|
|
38
84
|
command: "deploy" | "revert" | "help";
|
|
39
85
|
directory: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kuznai/inception-engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Deploy AI agent skills from a git repo to user home directories",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Damian Piątkowski",
|
|
@@ -31,14 +31,16 @@
|
|
|
31
31
|
"dist"
|
|
32
32
|
],
|
|
33
33
|
"engines": {
|
|
34
|
-
"node": ">=
|
|
34
|
+
"node": ">=22.3.0"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsc",
|
|
38
38
|
"typecheck": "tsc --noEmit",
|
|
39
39
|
"fmt": "biome format --write .",
|
|
40
40
|
"lint": "biome lint . --max-diagnostics none",
|
|
41
|
+
"predev": "node scripts/assert-direct-ts-node.mjs",
|
|
41
42
|
"dev": "node src/index.ts",
|
|
43
|
+
"pretest": "node scripts/assert-direct-ts-node.mjs",
|
|
42
44
|
"test": "node --test test/*.test.ts",
|
|
43
45
|
"prepublishOnly": "npm run typecheck && npm run lint && npm run build"
|
|
44
46
|
},
|