mano-coding 0.1.15

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.
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Extension SDK 公共契约 (DD-03)
3
+ */
4
+ export type JsonValue = null | boolean | number | string | readonly JsonValue[] | {
5
+ readonly [key: string]: JsonValue;
6
+ };
7
+ export type InputValue = string | boolean | number;
8
+ export type ExtensionOperation = 'create' | 'apply' | 'install' | 'configure' | 'remove';
9
+ export type CapabilityType = 'skill' | 'rule' | 'instruction' | 'mcp' | 'agent';
10
+ export type TargetId = 'cursor' | 'opencode' | 'claude-code' | 'codex' | 'codebuddy' | 'trae' | 'deepseek-harness';
11
+ export interface TargetRef {
12
+ id: TargetId;
13
+ scope: 'project';
14
+ hostVersion?: string;
15
+ }
16
+ export interface ProjectFileSystem {
17
+ readonly root: string;
18
+ readonly exists: boolean;
19
+ read(path: string): Promise<Uint8Array | undefined>;
20
+ write(path: string, content: Uint8Array | string): Promise<void>;
21
+ remove(path: string): Promise<void>;
22
+ mkdir(path: string): Promise<void>;
23
+ }
24
+ export interface CommandRegistration {
25
+ readonly name: string;
26
+ readonly executable: string;
27
+ readonly args?: readonly string[];
28
+ }
29
+ export type EnvironmentChange = {
30
+ readonly type: 'path';
31
+ readonly path: string;
32
+ readonly operation: 'prepend' | 'append';
33
+ } | {
34
+ readonly type: 'variable';
35
+ readonly name: string;
36
+ readonly value: string;
37
+ };
38
+ export interface UserInstallationFileSystem {
39
+ readonly root: string;
40
+ write(path: string, content: Uint8Array | string): Promise<void>;
41
+ remove(path: string): Promise<void>;
42
+ mkdir(path: string): Promise<void>;
43
+ registerCommand(command: CommandRegistration): Promise<void>;
44
+ registerEnvironment(change: EnvironmentChange): Promise<void>;
45
+ }
46
+ export interface ExecRequest {
47
+ readonly command: string;
48
+ readonly args?: readonly string[];
49
+ readonly cwd?: 'project' | 'installation';
50
+ readonly env?: Readonly<Record<string, string>>;
51
+ readonly timeoutMs?: number;
52
+ }
53
+ export interface ExecResult {
54
+ readonly exitCode: number;
55
+ readonly stdout: string;
56
+ readonly stderr: string;
57
+ }
58
+ export interface ProcessExecutor {
59
+ run(request: ExecRequest): Promise<ExecResult>;
60
+ }
61
+ export interface HttpClient {
62
+ fetch(url: string, init?: RequestInit): Promise<Response>;
63
+ }
64
+ export interface SecretReader {
65
+ get(name: string): Promise<string | undefined>;
66
+ }
67
+ export interface ExtensionLogger {
68
+ debug(message: string, fields?: Readonly<Record<string, JsonValue>>): void;
69
+ info(message: string, fields?: Readonly<Record<string, JsonValue>>): void;
70
+ warn(message: string, fields?: Readonly<Record<string, JsonValue>>): void;
71
+ }
72
+ export interface TargetDeliveryRequest {
73
+ readonly target: TargetRef;
74
+ readonly capabilityType: CapabilityType;
75
+ readonly id: string;
76
+ readonly source: string;
77
+ }
78
+ export interface TargetWriter {
79
+ deliver(request: TargetDeliveryRequest): Promise<void>;
80
+ }
81
+ export interface RollbackRegistrar {
82
+ defer(name: string, action: () => Promise<void>): void;
83
+ }
84
+ export interface ExtensionContext {
85
+ readonly mode: 'plan' | 'execute';
86
+ readonly operation: ExtensionOperation;
87
+ readonly package: {
88
+ readonly id: string;
89
+ readonly version: string;
90
+ readonly root: string;
91
+ };
92
+ readonly inputs: Readonly<Record<string, InputValue>>;
93
+ readonly project: ProjectFileSystem;
94
+ readonly user: UserInstallationFileSystem;
95
+ readonly exec: ProcessExecutor;
96
+ readonly http: HttpClient;
97
+ readonly secrets: SecretReader;
98
+ readonly log: ExtensionLogger;
99
+ readonly rollback: RollbackRegistrar;
100
+ readonly signal: AbortSignal;
101
+ }
102
+ export interface ProjectExtensionContext extends ExtensionContext {
103
+ }
104
+ export interface CapabilityDescriptor {
105
+ readonly packageId: string;
106
+ readonly id: string;
107
+ readonly type: CapabilityType;
108
+ readonly version: string;
109
+ readonly targets: readonly TargetRef[];
110
+ }
111
+ export interface CapabilityInstallContext extends ExtensionContext {
112
+ readonly capability: CapabilityDescriptor;
113
+ }
114
+ export interface CapabilityConfigureContext extends ExtensionContext {
115
+ readonly capability: CapabilityDescriptor;
116
+ readonly targets: TargetWriter;
117
+ }
118
+ export interface CapabilityRemoveContext extends ExtensionContext {
119
+ readonly capability: CapabilityDescriptor;
120
+ readonly resources: readonly ManagedResource[];
121
+ }
122
+ export interface CapabilityHealthContext extends ExtensionContext {
123
+ readonly capability: CapabilityDescriptor;
124
+ }
125
+ export interface ProjectResult {
126
+ readonly summary?: string;
127
+ readonly outputs?: Readonly<Record<string, JsonValue>>;
128
+ }
129
+ export type InstallResult = {
130
+ readonly kind: 'none';
131
+ } | {
132
+ readonly kind: 'user';
133
+ };
134
+ export interface ConfigureResult {
135
+ readonly summary?: string;
136
+ }
137
+ export interface ManagedResource {
138
+ readonly type: 'file' | 'config-entry';
139
+ readonly path: string;
140
+ readonly selector?: string;
141
+ readonly digest: string;
142
+ }
143
+ export interface RetainedSideEffect {
144
+ readonly description: string;
145
+ readonly reason: string;
146
+ }
147
+ export interface RemoveResult {
148
+ readonly summary?: string;
149
+ readonly retained?: readonly RetainedSideEffect[];
150
+ }
151
+ export interface HealthReport {
152
+ readonly status: 'healthy' | 'degraded' | 'broken';
153
+ readonly message?: string;
154
+ }
155
+ export declare abstract class ProjectExtension {
156
+ static readonly id: string;
157
+ abstract create(context: ProjectExtensionContext): Promise<ProjectResult>;
158
+ abstract apply(context: ProjectExtensionContext): Promise<ProjectResult>;
159
+ }
160
+ export declare abstract class CapabilityExtension {
161
+ static readonly id: string;
162
+ static readonly type: CapabilityType;
163
+ abstract install(context: CapabilityInstallContext): Promise<InstallResult>;
164
+ abstract configure(context: CapabilityConfigureContext, installation: InstallResult): Promise<ConfigureResult>;
165
+ abstract remove(context: CapabilityRemoveContext): Promise<RemoveResult>;
166
+ healthCheck?(context: CapabilityHealthContext): Promise<HealthReport>;
167
+ }
168
+ export declare class ExtensionError extends Error {
169
+ readonly code: string;
170
+ readonly safeMessage: string;
171
+ readonly details?: Readonly<Record<string, JsonValue>>;
172
+ readonly retryable?: boolean;
173
+ constructor(code: string, safeMessage: string, details?: Readonly<Record<string, JsonValue>>, retryable?: boolean);
174
+ }
175
+ //# sourceMappingURL=index.d.ts.map
package/dist/index.js ADDED
@@ -0,0 +1,31 @@
1
+ import { createRequire as __createRequire } from 'node:module';
2
+ const require = __createRequire(import.meta.url);
3
+
4
+
5
+ // packages/sdk/src/index.ts
6
+ var ProjectExtension = class {
7
+ static id;
8
+ };
9
+ var CapabilityExtension = class {
10
+ static id;
11
+ static type;
12
+ };
13
+ var ExtensionError = class extends Error {
14
+ code;
15
+ safeMessage;
16
+ details;
17
+ retryable;
18
+ constructor(code, safeMessage, details, retryable) {
19
+ super(safeMessage);
20
+ this.name = "ExtensionError";
21
+ this.code = code;
22
+ this.safeMessage = safeMessage;
23
+ this.details = details;
24
+ this.retryable = retryable;
25
+ }
26
+ };
27
+ export {
28
+ CapabilityExtension,
29
+ ExtensionError,
30
+ ProjectExtension
31
+ };
@@ -0,0 +1,206 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "installations.schema.json",
4
+ "title": "Mano Coding User Installations",
5
+ "type": "object",
6
+ "required": ["kind", "generatedBy", "machine", "updatedAt", "installations"],
7
+ "properties": {
8
+ "kind": { "const": "Installations" },
9
+ "generatedBy": { "$ref": "#/$defs/generatedBy" },
10
+ "machine": { "$ref": "#/$defs/machine" },
11
+ "updatedAt": { "$ref": "#/$defs/dateTime" },
12
+ "installations": {
13
+ "type": "array",
14
+ "items": { "$ref": "#/$defs/installation" }
15
+ }
16
+ },
17
+ "additionalProperties": false,
18
+ "$defs": {
19
+ "packageName": {
20
+ "type": "string",
21
+ "pattern": "^(?:@[a-z0-9][a-z0-9._-]*/)?[a-z0-9][a-z0-9._-]*$",
22
+ "maxLength": 214
23
+ },
24
+ "localId": {
25
+ "type": "string",
26
+ "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$",
27
+ "maxLength": 64
28
+ },
29
+ "semver": {
30
+ "type": "string",
31
+ "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(?:\\+[0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*)?$"
32
+ },
33
+ "integrity": {
34
+ "type": "string",
35
+ "pattern": "^(sha256|sha512)-[A-Za-z0-9+/]+={0,2}$",
36
+ "maxLength": 256
37
+ },
38
+ "digest": {
39
+ "type": "string",
40
+ "pattern": "^sha256:[a-f0-9]{64}$"
41
+ },
42
+ "dateTime": {
43
+ "type": "string",
44
+ "format": "date-time"
45
+ },
46
+ "absolutePath": {
47
+ "type": "string",
48
+ "minLength": 1,
49
+ "maxLength": 1024,
50
+ "pattern": "^(?!.*\\\\).+$",
51
+ "description": "Machine-local normalized absolute path; forward slashes only, even on Windows"
52
+ },
53
+ "generatedBy": {
54
+ "type": "object",
55
+ "required": ["cliVersion"],
56
+ "properties": {
57
+ "cliVersion": { "$ref": "#/$defs/semver" }
58
+ },
59
+ "additionalProperties": false
60
+ },
61
+ "machine": {
62
+ "type": "object",
63
+ "required": ["platform", "arch"],
64
+ "properties": {
65
+ "platform": { "enum": ["win32", "darwin", "linux"] },
66
+ "arch": { "enum": ["x64", "arm64"] }
67
+ },
68
+ "additionalProperties": false
69
+ },
70
+ "owner": {
71
+ "type": "object",
72
+ "required": ["kind", "packageId", "id"],
73
+ "properties": {
74
+ "kind": { "enum": ["project", "capability", "plugin"] },
75
+ "packageId": { "$ref": "#/$defs/packageName" },
76
+ "id": { "$ref": "#/$defs/localId" }
77
+ },
78
+ "additionalProperties": false
79
+ },
80
+ "command": {
81
+ "type": "object",
82
+ "required": ["name", "executable", "args"],
83
+ "properties": {
84
+ "name": { "type": "string", "minLength": 1, "maxLength": 128 },
85
+ "executable": { "$ref": "#/$defs/absolutePath" },
86
+ "args": {
87
+ "type": "array",
88
+ "items": { "type": "string", "maxLength": 1024 }
89
+ }
90
+ },
91
+ "additionalProperties": false
92
+ },
93
+ "pathEntry": {
94
+ "type": "object",
95
+ "required": ["path", "operation"],
96
+ "properties": {
97
+ "path": { "$ref": "#/$defs/absolutePath" },
98
+ "operation": { "enum": ["prepend", "append"] }
99
+ },
100
+ "additionalProperties": false
101
+ },
102
+ "environmentVariable": {
103
+ "type": "object",
104
+ "required": ["name", "valueDigest"],
105
+ "properties": {
106
+ "name": {
107
+ "type": "string",
108
+ "pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
109
+ "maxLength": 128
110
+ },
111
+ "valueDigest": { "$ref": "#/$defs/digest" }
112
+ },
113
+ "additionalProperties": false
114
+ },
115
+ "environment": {
116
+ "type": "object",
117
+ "required": ["pathEntries", "variables"],
118
+ "properties": {
119
+ "pathEntries": {
120
+ "type": "array",
121
+ "items": { "$ref": "#/$defs/pathEntry" }
122
+ },
123
+ "variables": {
124
+ "type": "array",
125
+ "items": { "$ref": "#/$defs/environmentVariable" }
126
+ }
127
+ },
128
+ "additionalProperties": false
129
+ },
130
+ "reference": {
131
+ "type": "object",
132
+ "required": ["projectRoot", "lockDigest", "lastSeenAt"],
133
+ "properties": {
134
+ "projectRoot": { "$ref": "#/$defs/absolutePath" },
135
+ "lockDigest": { "$ref": "#/$defs/digest" },
136
+ "lastSeenAt": { "$ref": "#/$defs/dateTime" }
137
+ },
138
+ "additionalProperties": false
139
+ },
140
+ "health": {
141
+ "type": "object",
142
+ "required": ["status"],
143
+ "properties": {
144
+ "status": { "enum": ["unknown", "healthy", "degraded", "broken"] },
145
+ "checkedAt": { "$ref": "#/$defs/dateTime" },
146
+ "message": { "type": "string", "minLength": 1, "maxLength": 500 }
147
+ },
148
+ "additionalProperties": false
149
+ },
150
+ "failure": {
151
+ "type": "object",
152
+ "required": ["code", "message", "failedAt"],
153
+ "properties": {
154
+ "code": { "type": "string", "minLength": 1, "maxLength": 128 },
155
+ "message": { "type": "string", "minLength": 1, "maxLength": 500 },
156
+ "failedAt": { "$ref": "#/$defs/dateTime" }
157
+ },
158
+ "additionalProperties": false
159
+ },
160
+ "installation": {
161
+ "type": "object",
162
+ "required": [
163
+ "owner",
164
+ "version",
165
+ "state",
166
+ "integrity",
167
+ "commands",
168
+ "environment",
169
+ "references",
170
+ "health",
171
+ "updatedAt"
172
+ ],
173
+ "properties": {
174
+ "owner": { "$ref": "#/$defs/owner" },
175
+ "version": { "$ref": "#/$defs/semver" },
176
+ "state": { "enum": ["ready", "failed"] },
177
+ "root": { "$ref": "#/$defs/absolutePath" },
178
+ "integrity": { "$ref": "#/$defs/integrity" },
179
+ "commands": {
180
+ "type": "array",
181
+ "items": { "$ref": "#/$defs/command" }
182
+ },
183
+ "environment": { "$ref": "#/$defs/environment" },
184
+ "references": {
185
+ "type": "array",
186
+ "items": { "$ref": "#/$defs/reference" }
187
+ },
188
+ "health": { "$ref": "#/$defs/health" },
189
+ "installedAt": { "$ref": "#/$defs/dateTime" },
190
+ "updatedAt": { "$ref": "#/$defs/dateTime" },
191
+ "failure": { "$ref": "#/$defs/failure" }
192
+ },
193
+ "additionalProperties": false,
194
+ "allOf": [
195
+ {
196
+ "if": {
197
+ "properties": { "state": { "const": "ready" } },
198
+ "required": ["state"]
199
+ },
200
+ "then": { "required": ["root", "installedAt"] },
201
+ "else": { "required": ["failure"] }
202
+ }
203
+ ]
204
+ }
205
+ }
206
+ }
@@ -0,0 +1,65 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "manifest.schema.json",
4
+ "title": "Mano Coding Template Manifest",
5
+ "type": "object",
6
+ "required": ["id", "version", "name", "description"],
7
+ "properties": {
8
+ "id": {
9
+ "type": "string",
10
+ "pattern": "^(?:@[a-z0-9][a-z0-9._-]*/)?[a-z0-9][a-z0-9._-]*$",
11
+ "maxLength": 214
12
+ },
13
+ "version": {
14
+ "type": "string",
15
+ "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(?:\\+[0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*)?$"
16
+ },
17
+ "name": {
18
+ "type": "string",
19
+ "minLength": 1,
20
+ "maxLength": 100
21
+ },
22
+ "description": {
23
+ "type": "string",
24
+ "minLength": 1,
25
+ "maxLength": 1000
26
+ },
27
+ "tasks": {
28
+ "type": "array",
29
+ "items": {
30
+ "type": "object",
31
+ "required": ["id", "command"],
32
+ "properties": {
33
+ "id": {
34
+ "type": "string",
35
+ "pattern": "^[a-zA-Z][a-zA-Z0-9_-]*$",
36
+ "maxLength": 64
37
+ },
38
+ "command": {
39
+ "type": "string",
40
+ "minLength": 1,
41
+ "maxLength": 256
42
+ },
43
+ "args": {
44
+ "type": "array",
45
+ "items": {
46
+ "type": "string"
47
+ }
48
+ },
49
+ "cwd": {
50
+ "type": "string",
51
+ "maxLength": 512
52
+ },
53
+ "env": {
54
+ "type": "object",
55
+ "additionalProperties": {
56
+ "type": "string"
57
+ }
58
+ }
59
+ },
60
+ "additionalProperties": false
61
+ }
62
+ }
63
+ },
64
+ "additionalProperties": false
65
+ }