busy-cli 0.1.2
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 +129 -0
- package/dist/builders/context.d.ts +50 -0
- package/dist/builders/context.d.ts.map +1 -0
- package/dist/builders/context.js +190 -0
- package/dist/cache/index.d.ts +100 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +270 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +463 -0
- package/dist/commands/package.d.ts +96 -0
- package/dist/commands/package.d.ts.map +1 -0
- package/dist/commands/package.js +285 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/loader.d.ts +6 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +361 -0
- package/dist/merge.d.ts +16 -0
- package/dist/merge.d.ts.map +1 -0
- package/dist/merge.js +102 -0
- package/dist/package/manifest.d.ts +59 -0
- package/dist/package/manifest.d.ts.map +1 -0
- package/dist/package/manifest.js +265 -0
- package/dist/parser.d.ts +28 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +220 -0
- package/dist/parsers/frontmatter.d.ts +14 -0
- package/dist/parsers/frontmatter.d.ts.map +1 -0
- package/dist/parsers/frontmatter.js +110 -0
- package/dist/parsers/imports.d.ts +48 -0
- package/dist/parsers/imports.d.ts.map +1 -0
- package/dist/parsers/imports.js +147 -0
- package/dist/parsers/links.d.ts +12 -0
- package/dist/parsers/links.d.ts.map +1 -0
- package/dist/parsers/links.js +79 -0
- package/dist/parsers/localdefs.d.ts +6 -0
- package/dist/parsers/localdefs.d.ts.map +1 -0
- package/dist/parsers/localdefs.js +132 -0
- package/dist/parsers/operations.d.ts +32 -0
- package/dist/parsers/operations.d.ts.map +1 -0
- package/dist/parsers/operations.js +313 -0
- package/dist/parsers/sections.d.ts +15 -0
- package/dist/parsers/sections.d.ts.map +1 -0
- package/dist/parsers/sections.js +173 -0
- package/dist/parsers/tools.d.ts +30 -0
- package/dist/parsers/tools.d.ts.map +1 -0
- package/dist/parsers/tools.js +178 -0
- package/dist/parsers/triggers.d.ts +35 -0
- package/dist/parsers/triggers.d.ts.map +1 -0
- package/dist/parsers/triggers.js +219 -0
- package/dist/providers/base.d.ts +60 -0
- package/dist/providers/base.d.ts.map +1 -0
- package/dist/providers/base.js +34 -0
- package/dist/providers/github.d.ts +18 -0
- package/dist/providers/github.d.ts.map +1 -0
- package/dist/providers/github.js +109 -0
- package/dist/providers/gitlab.d.ts +18 -0
- package/dist/providers/gitlab.d.ts.map +1 -0
- package/dist/providers/gitlab.js +101 -0
- package/dist/providers/index.d.ts +13 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +17 -0
- package/dist/providers/local.d.ts +31 -0
- package/dist/providers/local.d.ts.map +1 -0
- package/dist/providers/local.js +116 -0
- package/dist/providers/url.d.ts +16 -0
- package/dist/providers/url.d.ts.map +1 -0
- package/dist/providers/url.js +45 -0
- package/dist/registry/index.d.ts +99 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +320 -0
- package/dist/types/schema.d.ts +3259 -0
- package/dist/types/schema.d.ts.map +1 -0
- package/dist/types/schema.js +258 -0
- package/dist/utils/logger.d.ts +19 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +23 -0
- package/dist/utils/slugify.d.ts +14 -0
- package/dist/utils/slugify.d.ts.map +1 -0
- package/dist/utils/slugify.js +28 -0
- package/package.json +61 -0
- package/src/__tests__/cache.test.ts +393 -0
- package/src/__tests__/cli-package.test.ts +667 -0
- package/src/__tests__/fixtures/automated-workflow.busy.md +84 -0
- package/src/__tests__/fixtures/concept.busy.md +30 -0
- package/src/__tests__/fixtures/document.busy.md +44 -0
- package/src/__tests__/fixtures/simple-operation.busy.md +45 -0
- package/src/__tests__/fixtures/tool-document.busy.md +71 -0
- package/src/__tests__/fixtures/tool.busy.md +54 -0
- package/src/__tests__/imports.test.ts +244 -0
- package/src/__tests__/integration.test.ts +432 -0
- package/src/__tests__/operations.test.ts +408 -0
- package/src/__tests__/package-manifest.test.ts +455 -0
- package/src/__tests__/providers.test.ts +672 -0
- package/src/__tests__/registry.test.ts +402 -0
- package/src/__tests__/schema.test.ts +467 -0
- package/src/__tests__/tools.test.ts +376 -0
- package/src/__tests__/triggers.test.ts +312 -0
- package/src/builders/context.ts +294 -0
- package/src/cache/index.ts +312 -0
- package/src/cli/index.ts +514 -0
- package/src/commands/package.ts +392 -0
- package/src/index.ts +46 -0
- package/src/loader.ts +474 -0
- package/src/merge.ts +126 -0
- package/src/package/manifest.ts +349 -0
- package/src/parser.ts +278 -0
- package/src/parsers/frontmatter.ts +135 -0
- package/src/parsers/imports.ts +196 -0
- package/src/parsers/links.ts +108 -0
- package/src/parsers/localdefs.ts +166 -0
- package/src/parsers/operations.ts +404 -0
- package/src/parsers/sections.ts +230 -0
- package/src/parsers/tools.ts +215 -0
- package/src/parsers/triggers.ts +252 -0
- package/src/providers/base.ts +77 -0
- package/src/providers/github.ts +129 -0
- package/src/providers/gitlab.ts +121 -0
- package/src/providers/index.ts +25 -0
- package/src/providers/local.ts +129 -0
- package/src/providers/url.ts +56 -0
- package/src/registry/index.ts +408 -0
- package/src/types/schema.ts +369 -0
- package/src/utils/logger.ts +25 -0
- package/src/utils/slugify.ts +31 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/types/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB;;;;;GAKG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;EAKhB,CAAC;AAEZ,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD;;;GAGG;AACH,eAAO,MAAM,YAA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CAAC,OAAO,UAAU,CAAC,CAAC;AAC9C,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAGlE,MAAM,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAC9C,MAAM,MAAM,SAAS,GAAG,eAAe,CAAC;AAOxC,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;EA2B5B,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// NEW SCHEMAS - Matching busy-python models (source of truth)
|
|
4
|
+
// =============================================================================
|
|
5
|
+
/**
|
|
6
|
+
* Metadata schema - matches busy-python Metadata model
|
|
7
|
+
* Required: name, type, description
|
|
8
|
+
* Optional: provider (for tool documents)
|
|
9
|
+
* NOTE: Extends and Tags have been removed (not in busy-python)
|
|
10
|
+
*/
|
|
11
|
+
export const MetadataSchema = z.object({
|
|
12
|
+
name: z.string().min(1),
|
|
13
|
+
type: z.string().min(1),
|
|
14
|
+
description: z.string().min(1),
|
|
15
|
+
provider: z.string().optional(),
|
|
16
|
+
}).strict(); // Use strict to reject extra fields like extends/tags
|
|
17
|
+
/**
|
|
18
|
+
* Import schema - matches busy-python Import model
|
|
19
|
+
* Reference-style links: [ConceptName]: path/to/file.md[#anchor]
|
|
20
|
+
*/
|
|
21
|
+
export const ImportSchema = z.object({
|
|
22
|
+
conceptName: z.string().min(1),
|
|
23
|
+
path: z.string().min(1),
|
|
24
|
+
anchor: z.string().optional(),
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* LocalDefinition schema - matches busy-python LocalDefinition model
|
|
28
|
+
*/
|
|
29
|
+
export const LocalDefinitionSchema = z.object({
|
|
30
|
+
name: z.string().min(1),
|
|
31
|
+
content: z.string(),
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Step schema - matches busy-python Step model
|
|
35
|
+
* Steps have stepNumber, instruction, and optional operationReferences
|
|
36
|
+
*/
|
|
37
|
+
export const StepSchema = z.object({
|
|
38
|
+
stepNumber: z.number().int().min(1),
|
|
39
|
+
instruction: z.string().min(1),
|
|
40
|
+
operationReferences: z.array(z.string()).optional(),
|
|
41
|
+
});
|
|
42
|
+
/**
|
|
43
|
+
* Checklist schema - matches busy-python Checklist model
|
|
44
|
+
*/
|
|
45
|
+
export const ChecklistSchema = z.object({
|
|
46
|
+
items: z.array(z.string()),
|
|
47
|
+
});
|
|
48
|
+
/**
|
|
49
|
+
* Trigger schema - matches busy-python Trigger model
|
|
50
|
+
* Supports both time-based (alarm) and event-based triggers
|
|
51
|
+
*/
|
|
52
|
+
export const TriggerSchema = z.object({
|
|
53
|
+
rawText: z.string(),
|
|
54
|
+
triggerType: z.enum(['alarm', 'event']),
|
|
55
|
+
schedule: z.string().optional(), // cron expression for alarms
|
|
56
|
+
eventType: z.string().optional(), // event type for event triggers
|
|
57
|
+
filter: z.record(z.string()).optional(), // filter criteria
|
|
58
|
+
operation: z.string(), // operation to run
|
|
59
|
+
queueWhenPaused: z.boolean().default(true),
|
|
60
|
+
});
|
|
61
|
+
/**
|
|
62
|
+
* Operation schema (NEW) - matches busy-python Operation model
|
|
63
|
+
* Different from the old graph-based OperationSchema
|
|
64
|
+
*/
|
|
65
|
+
export const NewOperationSchema = z.object({
|
|
66
|
+
name: z.string().min(1),
|
|
67
|
+
inputs: z.array(z.string()).default([]),
|
|
68
|
+
outputs: z.array(z.string()).default([]),
|
|
69
|
+
steps: z.array(StepSchema).default([]),
|
|
70
|
+
checklist: ChecklistSchema.optional(),
|
|
71
|
+
});
|
|
72
|
+
/**
|
|
73
|
+
* Tool schema - matches busy-python Tool model
|
|
74
|
+
* Tools have provider mappings for external integrations
|
|
75
|
+
*/
|
|
76
|
+
export const ToolSchema = z.object({
|
|
77
|
+
name: z.string().min(1),
|
|
78
|
+
description: z.string(),
|
|
79
|
+
inputs: z.array(z.string()),
|
|
80
|
+
outputs: z.array(z.string()),
|
|
81
|
+
examples: z.array(z.string()).optional(),
|
|
82
|
+
providers: z.record(z.object({
|
|
83
|
+
action: z.string(),
|
|
84
|
+
parameters: z.record(z.any()).optional(),
|
|
85
|
+
})).optional(),
|
|
86
|
+
});
|
|
87
|
+
/**
|
|
88
|
+
* BusyDocument schema (NEW) - matches busy-python BusyDocument model
|
|
89
|
+
* This is the new document-centric schema, different from the graph-based one
|
|
90
|
+
*/
|
|
91
|
+
export const NewBusyDocumentSchema = z.object({
|
|
92
|
+
metadata: MetadataSchema,
|
|
93
|
+
imports: z.array(ImportSchema).default([]),
|
|
94
|
+
definitions: z.array(LocalDefinitionSchema).default([]),
|
|
95
|
+
setup: z.string().optional(),
|
|
96
|
+
operations: z.array(NewOperationSchema).default([]),
|
|
97
|
+
triggers: z.array(TriggerSchema).default([]),
|
|
98
|
+
});
|
|
99
|
+
/**
|
|
100
|
+
* ToolDocument schema - extends BusyDocument with tools array
|
|
101
|
+
*/
|
|
102
|
+
export const ToolDocumentSchema = NewBusyDocumentSchema.extend({
|
|
103
|
+
tools: z.array(ToolSchema).default([]),
|
|
104
|
+
});
|
|
105
|
+
// =============================================================================
|
|
106
|
+
// LEGACY SCHEMAS - Kept for graph functionality (may be refactored later)
|
|
107
|
+
// =============================================================================
|
|
108
|
+
// Base types
|
|
109
|
+
export const DocIdSchema = z.string();
|
|
110
|
+
export const SlugSchema = z.string();
|
|
111
|
+
export const SectionIdSchema = z.string(); //unique id in the parsed documents hierarchy.
|
|
112
|
+
export const ConceptIdSchema = z.string(); //conceptual reference, where it is in the object model eg: document.operations.evaluateDocument
|
|
113
|
+
// Section schema
|
|
114
|
+
export const SectionSchema = z.lazy(() => z.object({
|
|
115
|
+
kind: z.literal('section'),
|
|
116
|
+
id: SectionIdSchema,
|
|
117
|
+
docId: DocIdSchema,
|
|
118
|
+
slug: SlugSchema,
|
|
119
|
+
title: z.string(),
|
|
120
|
+
depth: z.number().int().min(1).max(6),
|
|
121
|
+
path: z.string(),
|
|
122
|
+
lineStart: z.number(),
|
|
123
|
+
lineEnd: z.number(),
|
|
124
|
+
content: z.string(),
|
|
125
|
+
children: z.array(SectionSchema),
|
|
126
|
+
}));
|
|
127
|
+
// ConceptBase schema - need to keep as regular object schema to allow .extend()
|
|
128
|
+
const ConceptBaseSchemaObject = z.object({
|
|
129
|
+
kind: z.enum(['concept', 'document', 'operation', 'checklist', 'tool', 'playbook', 'localdef', 'importdef', 'setup']),
|
|
130
|
+
id: ConceptIdSchema,
|
|
131
|
+
docId: DocIdSchema,
|
|
132
|
+
slug: z.string(),
|
|
133
|
+
name: z.string(),
|
|
134
|
+
content: z.string(),
|
|
135
|
+
types: z.array(ConceptIdSchema),
|
|
136
|
+
extends: z.array(ConceptIdSchema),
|
|
137
|
+
sectionRef: SectionIdSchema,
|
|
138
|
+
});
|
|
139
|
+
export const ConceptBaseSchema = z.lazy(() => ConceptBaseSchemaObject.extend({
|
|
140
|
+
children: z.array(ConceptBaseSchema),
|
|
141
|
+
}));
|
|
142
|
+
// LocalDef schema - extends ConceptBase (leaf node, no children)
|
|
143
|
+
export const LocalDefSchema = ConceptBaseSchemaObject.extend({
|
|
144
|
+
kind: z.literal('localdef'),
|
|
145
|
+
});
|
|
146
|
+
// Setup schema - extends ConceptBase (leaf node, no children)
|
|
147
|
+
export const SetupSchema = ConceptBaseSchemaObject.extend({
|
|
148
|
+
kind: z.literal('setup'),
|
|
149
|
+
});
|
|
150
|
+
// Operation schema (LEGACY) - extends ConceptBase (leaf node, no children)
|
|
151
|
+
// Used for graph-based representation
|
|
152
|
+
export const LegacyOperationSchema = ConceptBaseSchemaObject.extend({
|
|
153
|
+
kind: z.literal('operation'),
|
|
154
|
+
steps: z.array(z.string()), // Parsed step items (legacy: strings only)
|
|
155
|
+
checklist: z.array(z.string()), // Parsed checklist items
|
|
156
|
+
});
|
|
157
|
+
// Keep OperationSchema as the legacy schema for backward compatibility with loader
|
|
158
|
+
export const OperationSchema = LegacyOperationSchema;
|
|
159
|
+
// ImportDef schema - extends ConceptBase (leaf node, no children)
|
|
160
|
+
export const ImportDefSchema = ConceptBaseSchemaObject.extend({
|
|
161
|
+
kind: z.literal('importdef'),
|
|
162
|
+
label: z.string(),
|
|
163
|
+
target: SectionIdSchema,
|
|
164
|
+
resolved: ConceptIdSchema.optional(),
|
|
165
|
+
});
|
|
166
|
+
// BusyDocument schema (LEGACY) - graph-based representation
|
|
167
|
+
export const LegacyBusyDocumentSchema = ConceptBaseSchemaObject.extend({
|
|
168
|
+
kind: z.literal('document'),
|
|
169
|
+
imports: z.array(ImportDefSchema),
|
|
170
|
+
localdefs: z.array(LocalDefSchema),
|
|
171
|
+
setup: SetupSchema,
|
|
172
|
+
operations: z.array(LegacyOperationSchema)
|
|
173
|
+
});
|
|
174
|
+
// Keep BusyDocumentSchema as the legacy schema for backward compatibility with loader
|
|
175
|
+
export const BusyDocumentSchema = LegacyBusyDocumentSchema;
|
|
176
|
+
// Playbook schema - extends LegacyBusyDocument with ordered sequence of operations
|
|
177
|
+
export const PlaybookSchema = LegacyBusyDocumentSchema.extend({
|
|
178
|
+
kind: z.literal('playbook'),
|
|
179
|
+
sequence: z.array(ConceptIdSchema), // Ordered array of operation references
|
|
180
|
+
});
|
|
181
|
+
// Edge schema
|
|
182
|
+
export const EdgeRoleSchema = z.enum(['ref', 'calls', 'extends', 'imports']);
|
|
183
|
+
export const EdgeSchema = z.object({
|
|
184
|
+
from: z.string(),
|
|
185
|
+
to: z.string(),
|
|
186
|
+
role: EdgeRoleSchema,
|
|
187
|
+
});
|
|
188
|
+
// File schema - represents a parsed markdown file with its sections
|
|
189
|
+
export const FileSchema = z.object({
|
|
190
|
+
docId: DocIdSchema,
|
|
191
|
+
path: z.string(),
|
|
192
|
+
name: z.string(),
|
|
193
|
+
sections: z.array(SectionSchema),
|
|
194
|
+
});
|
|
195
|
+
// Repo schema (uses legacy schemas for graph functionality)
|
|
196
|
+
export const RepoSchema = z.object({
|
|
197
|
+
files: z.array(FileSchema), // Parsed files with their sections
|
|
198
|
+
concepts: z.array(ConceptBaseSchema), // All concepts (BusyDocuments, Playbooks, etc.)
|
|
199
|
+
localdefs: z.record(LocalDefSchema),
|
|
200
|
+
operations: z.record(LegacyOperationSchema),
|
|
201
|
+
imports: z.array(ImportDefSchema),
|
|
202
|
+
byId: z.record(z.union([SectionSchema, LocalDefSchema, LegacyOperationSchema, ConceptBaseSchema])),
|
|
203
|
+
byFile: z.record(// Renamed from byDoc for clarity
|
|
204
|
+
z.object({
|
|
205
|
+
concept: z.union([LegacyBusyDocumentSchema, PlaybookSchema]), // The concept defined in this file
|
|
206
|
+
bySlug: z.record(SectionSchema),
|
|
207
|
+
})),
|
|
208
|
+
edges: z.array(EdgeSchema),
|
|
209
|
+
});
|
|
210
|
+
// ContextPayload schema (uses legacy operation schema)
|
|
211
|
+
export const ContextPayloadSchema = z.object({
|
|
212
|
+
operation: LegacyOperationSchema,
|
|
213
|
+
calls: z.array(ConceptIdSchema),
|
|
214
|
+
symbols: z.record(z.object({
|
|
215
|
+
docId: DocIdSchema.optional(),
|
|
216
|
+
slug: SlugSchema.optional(),
|
|
217
|
+
})),
|
|
218
|
+
});
|
|
219
|
+
// Front-matter schema
|
|
220
|
+
// Type can be:
|
|
221
|
+
// - array of strings (plain): ["Document", "Concept"]
|
|
222
|
+
// - array with markdown links: ["[Document]", "[Concept]"]
|
|
223
|
+
// - single string (we'll normalize to array)
|
|
224
|
+
export const FrontMatterSchema = z.object({
|
|
225
|
+
Name: z.string(),
|
|
226
|
+
Type: z
|
|
227
|
+
.union([z.string(), z.array(z.string())])
|
|
228
|
+
.optional()
|
|
229
|
+
.transform((val) => {
|
|
230
|
+
if (!val)
|
|
231
|
+
return [];
|
|
232
|
+
if (typeof val === 'string')
|
|
233
|
+
return [val];
|
|
234
|
+
return val;
|
|
235
|
+
}),
|
|
236
|
+
Extends: z
|
|
237
|
+
.union([z.string(), z.array(z.string())])
|
|
238
|
+
.optional()
|
|
239
|
+
.transform((val) => {
|
|
240
|
+
if (!val)
|
|
241
|
+
return [];
|
|
242
|
+
if (typeof val === 'string')
|
|
243
|
+
return [val];
|
|
244
|
+
return val;
|
|
245
|
+
}),
|
|
246
|
+
Description: z.string().optional(),
|
|
247
|
+
Tags: z
|
|
248
|
+
.union([z.string(), z.array(z.string())])
|
|
249
|
+
.optional()
|
|
250
|
+
.transform((val) => {
|
|
251
|
+
if (!val)
|
|
252
|
+
return [];
|
|
253
|
+
if (typeof val === 'string')
|
|
254
|
+
return [val];
|
|
255
|
+
return val;
|
|
256
|
+
}),
|
|
257
|
+
});
|
|
258
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import createDebug from 'debug';
|
|
2
|
+
export declare const debug: {
|
|
3
|
+
parser: createDebug.Debugger;
|
|
4
|
+
frontmatter: createDebug.Debugger;
|
|
5
|
+
sections: createDebug.Debugger;
|
|
6
|
+
localdefs: createDebug.Debugger;
|
|
7
|
+
imports: createDebug.Debugger;
|
|
8
|
+
links: createDebug.Debugger;
|
|
9
|
+
context: createDebug.Debugger;
|
|
10
|
+
};
|
|
11
|
+
export declare function warn(message: string, context?: {
|
|
12
|
+
file?: string;
|
|
13
|
+
line?: number;
|
|
14
|
+
}): void;
|
|
15
|
+
export declare function error(message: string, context?: {
|
|
16
|
+
file?: string;
|
|
17
|
+
line?: number;
|
|
18
|
+
}): void;
|
|
19
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,OAAO,CAAC;AAEhC,eAAO,MAAM,KAAK;;;;;;;;CAQjB,CAAC;AAEF,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,QAK/E;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,QAKhF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import createDebug from 'debug';
|
|
2
|
+
export const debug = {
|
|
3
|
+
parser: createDebug('busy:parser'),
|
|
4
|
+
frontmatter: createDebug('busy:frontmatter'),
|
|
5
|
+
sections: createDebug('busy:sections'),
|
|
6
|
+
localdefs: createDebug('busy:localdefs'),
|
|
7
|
+
imports: createDebug('busy:imports'),
|
|
8
|
+
links: createDebug('busy:links'),
|
|
9
|
+
context: createDebug('busy:context'),
|
|
10
|
+
};
|
|
11
|
+
export function warn(message, context) {
|
|
12
|
+
const location = context?.file
|
|
13
|
+
? `${context.file}${context.line ? `:${context.line}` : ''}`
|
|
14
|
+
: '';
|
|
15
|
+
console.warn(`[WARN] ${location ? `${location}: ` : ''}${message}`);
|
|
16
|
+
}
|
|
17
|
+
export function error(message, context) {
|
|
18
|
+
const location = context?.file
|
|
19
|
+
? `${context.file}${context.line ? `:${context.line}` : ''}`
|
|
20
|
+
: '';
|
|
21
|
+
console.error(`[ERROR] ${location ? `${location}: ` : ''}${message}`);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalize a Name into a DocId
|
|
3
|
+
* Replaces spaces with underscores and removes dashes
|
|
4
|
+
*/
|
|
5
|
+
export declare function normalizeDocId(name: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* Create a slug from heading text using github-slugger
|
|
8
|
+
*/
|
|
9
|
+
export declare function createSlug(text: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Get basename of a file path without extension
|
|
12
|
+
*/
|
|
13
|
+
export declare function getBasename(filePath: string): string;
|
|
14
|
+
//# sourceMappingURL=slugify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slugify.d.ts","sourceRoot":"","sources":["../../src/utils/slugify.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAKnD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAG/C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIpD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import GithubSlugger from 'github-slugger';
|
|
2
|
+
const slugger = new GithubSlugger();
|
|
3
|
+
/**
|
|
4
|
+
* Normalize a Name into a DocId
|
|
5
|
+
* Replaces spaces with underscores and removes dashes
|
|
6
|
+
*/
|
|
7
|
+
export function normalizeDocId(name) {
|
|
8
|
+
return name
|
|
9
|
+
.toLowerCase()
|
|
10
|
+
.replace(/\s+/g, '_')
|
|
11
|
+
.replace(/-/g, '_');
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create a slug from heading text using github-slugger
|
|
15
|
+
*/
|
|
16
|
+
export function createSlug(text) {
|
|
17
|
+
slugger.reset();
|
|
18
|
+
return slugger.slug(text);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get basename of a file path without extension
|
|
22
|
+
*/
|
|
23
|
+
export function getBasename(filePath) {
|
|
24
|
+
const parts = filePath.split('/');
|
|
25
|
+
const fileName = parts[parts.length - 1];
|
|
26
|
+
return fileName.replace(/\.md$/, '');
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=slugify.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "busy-cli",
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "CLI for BUSY document framework - parse, validate, and manage BUSY workspaces",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"busy": "./dist/cli/index.js"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"import": "./dist/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"dev": "tsc --watch",
|
|
20
|
+
"test": "vitest",
|
|
21
|
+
"busy": "node ./dist/cli/index.js"
|
|
22
|
+
},
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/Bravo-Tensor/busy-lang.git",
|
|
26
|
+
"directory": "packages/busy-cli"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/Bravo-Tensor/busy-lang#readme",
|
|
29
|
+
"bugs": {
|
|
30
|
+
"url": "https://github.com/Bravo-Tensor/busy-lang/issues"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"zod": "^3.23.8",
|
|
34
|
+
"gray-matter": "^4.0.3",
|
|
35
|
+
"unified": "^11.0.5",
|
|
36
|
+
"remark-parse": "^11.0.0",
|
|
37
|
+
"remark-frontmatter": "^5.0.0",
|
|
38
|
+
"unist-util-visit": "^5.0.0",
|
|
39
|
+
"github-slugger": "^2.0.0",
|
|
40
|
+
"fast-glob": "^3.3.2",
|
|
41
|
+
"commander": "^12.1.0",
|
|
42
|
+
"debug": "^4.3.7"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/node": "^22.7.5",
|
|
46
|
+
"@types/debug": "^4.1.12",
|
|
47
|
+
"typescript": "^5.6.3",
|
|
48
|
+
"vitest": "^2.1.3"
|
|
49
|
+
},
|
|
50
|
+
"keywords": [
|
|
51
|
+
"busy",
|
|
52
|
+
"cli",
|
|
53
|
+
"parser",
|
|
54
|
+
"markdown",
|
|
55
|
+
"workspace",
|
|
56
|
+
"agent",
|
|
57
|
+
"prompt-engineering"
|
|
58
|
+
],
|
|
59
|
+
"author": "Bravo Tensor",
|
|
60
|
+
"license": "ISC"
|
|
61
|
+
}
|