intentdna 1.7.4 → 1.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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/LICENSE +201 -0
- package/README.md +143 -194
- package/dist/assets/candidates.d.ts +124 -0
- package/dist/assets/candidates.js +1249 -0
- package/dist/assets/catalog.d.ts +101 -0
- package/dist/assets/catalog.js +311 -0
- package/dist/assets/evidence.d.ts +93 -0
- package/dist/assets/evidence.js +391 -0
- package/dist/assets/index.d.ts +4 -0
- package/dist/assets/index.js +4 -0
- package/dist/assets/metadata.d.ts +19 -0
- package/dist/assets/metadata.js +227 -0
- package/dist/cli/commands/assets.d.ts +65 -0
- package/dist/cli/commands/assets.js +2871 -0
- package/dist/cli/commands/auth.d.ts +322 -0
- package/dist/cli/commands/auth.js +1592 -0
- package/dist/cli/commands/cloud-auth-guidance.d.ts +2 -0
- package/dist/cli/commands/cloud-auth-guidance.js +4 -0
- package/dist/cli/commands/cloud.d.ts +1359 -0
- package/dist/cli/commands/cloud.js +8364 -0
- package/dist/cli/commands/evolve.js +18 -2
- package/dist/cli/commands/generate.js +25 -2
- package/dist/cli/commands/guard.d.ts +1 -1
- package/dist/cli/commands/guard.js +1 -1
- package/dist/cli/commands/guide.d.ts +15 -0
- package/dist/cli/commands/guide.js +1747 -0
- package/dist/cli/commands/init.d.ts +12 -0
- package/dist/cli/commands/init.js +95 -60
- package/dist/cli/commands/org.d.ts +16 -0
- package/dist/cli/commands/org.js +2393 -0
- package/dist/cli/commands/release.d.ts +59 -0
- package/dist/cli/commands/release.js +716 -0
- package/dist/cli/commands/report.d.ts +82 -0
- package/dist/cli/commands/report.js +1516 -0
- package/dist/cli/commands/run.d.ts +6 -1
- package/dist/cli/commands/run.js +95 -26
- package/dist/cli/commands/sync.d.ts +8 -1
- package/dist/cli/commands/sync.js +436 -141
- package/dist/cli/commands/templates.d.ts +64 -0
- package/dist/cli/commands/templates.js +2151 -1
- package/dist/cli/commands/workflow.d.ts +26 -0
- package/dist/cli/commands/workflow.js +3053 -0
- package/dist/cli/index.js +719 -42
- package/dist/compiler/cascade.js +4 -9
- package/dist/compiler/compile.js +1 -0
- package/dist/governance/evidence-capture-attribution.d.ts +12 -0
- package/dist/governance/evidence-capture-attribution.js +46 -0
- package/dist/governance/index.d.ts +2 -0
- package/dist/governance/index.js +1 -0
- package/dist/hooks/cli.d.ts +6 -0
- package/dist/hooks/cli.js +168 -12
- package/dist/hooks/enforce.d.ts +1 -0
- package/dist/hooks/protocol.d.ts +1 -1
- package/dist/hooks/protocol.js +1 -1
- package/dist/hooks/state.d.ts +41 -0
- package/dist/hooks/state.js +126 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/mcp/tools-state.js +2 -0
- package/dist/organization/index.d.ts +121 -0
- package/dist/organization/index.js +413 -0
- package/dist/runtime/claude-sync-target.d.ts +49 -0
- package/dist/runtime/claude-sync-target.js +280 -0
- package/dist/runtime/codex-adapter.d.ts +254 -0
- package/dist/runtime/codex-adapter.js +1204 -0
- package/dist/runtime/codex-sync-target.d.ts +33 -0
- package/dist/runtime/codex-sync-target.js +241 -0
- package/dist/runtime/index.d.ts +8 -0
- package/dist/runtime/index.js +4 -0
- package/dist/runtime/output-artifact-registry.d.ts +1 -1
- package/dist/runtime/output-artifact-registry.js +2 -0
- package/dist/runtime/settings-adapter.d.ts +1 -1
- package/dist/runtime/settings-adapter.js +1 -1
- package/dist/runtime/skill-adapter.d.ts +5 -1
- package/dist/runtime/skill-adapter.js +120 -34
- package/dist/runtime/sync-artifact-registry.d.ts +99 -0
- package/dist/runtime/sync-artifact-registry.js +194 -0
- package/dist/runtime/sync-target-plan.d.ts +45 -0
- package/dist/runtime/sync-target-plan.js +19 -0
- package/dist/schema/controller-registry.d.ts +8 -1
- package/dist/schema/controller-registry.js +8 -0
- package/dist/schema/types.d.ts +35 -23
- package/dist/schema/types.js +10 -1
- package/dist/schema/validate.js +22 -22
- package/dist/schema/validators/controllers.js +38 -20
- package/dist/schema/workflow-authoring-contract.d.ts +29 -0
- package/dist/schema/workflow-authoring-contract.js +109 -0
- package/dist/schema/yaml-parser.js +18 -0
- package/dist/templates/api-backend.dna.yaml +19 -0
- package/dist/templates/brainstorming-first.dna.yaml +19 -0
- package/dist/templates/code-cleanup.dna.yaml +19 -0
- package/dist/templates/code-review-pipeline.dna.yaml +18 -0
- package/dist/templates/documentation-writer.dna.yaml +19 -0
- package/dist/templates/flutter-behavior-lock.dna.yaml +19 -0
- package/dist/templates/flutter-refactoring-rescue.dna.yaml +19 -0
- package/dist/templates/flutter-rewrite-diagnosis-review.dna.yaml +210 -0
- package/dist/templates/flutter-rewrite-fix-review-loop.dna.yaml +260 -0
- package/dist/templates/flutter-rewrite-new.dna.yaml +506 -0
- package/dist/templates/flutter-rewrite.dna.yaml +20 -0
- package/dist/templates/frontend-quality.dna.yaml +19 -0
- package/dist/templates/full-pipeline.dna.yaml +20 -0
- package/dist/templates/marketplace.d.ts +92 -0
- package/dist/templates/marketplace.js +502 -0
- package/dist/templates/metadata.d.ts +25 -0
- package/dist/templates/metadata.js +136 -3
- package/dist/templates/mobile-dev.dna.yaml +19 -0
- package/dist/templates/multi-agent-handoff-coordination.dna.yaml +156 -0
- package/dist/templates/multi-perspective-review.dna.yaml +19 -0
- package/dist/templates/persistent-executor.dna.yaml +19 -0
- package/dist/templates/qa-loop.dna.yaml +18 -0
- package/dist/templates/release-evidence-gate.dna.yaml +131 -0
- package/dist/templates/requirements-gate.dna.yaml +19 -0
- package/dist/templates/research-orchestration.dna.yaml +19 -0
- package/dist/templates/root-cause-analysis.dna.yaml +19 -0
- package/dist/templates/safe-refactoring.dna.yaml +321 -0
- package/dist/templates/secure-dev.dna.yaml +19 -0
- package/dist/templates/subagent-parallel.dna.yaml +19 -0
- package/dist/templates/systematic-debugging.dna.yaml +19 -0
- package/dist/templates/tdd-strict.dna.yaml +19 -0
- package/dist/templates/ui-visual-regression-qa.dna.yaml +133 -0
- package/dist/templates/workflow-author.dna.yaml +302 -0
- package/dist/templates/workflow-blocked-scope-triage.dna.yaml +242 -0
- package/dist/templates/workflow-completion-audit.dna.yaml +254 -0
- package/dist/templates/workflow-cross-boundary-resource-approval.dna.yaml +249 -0
- package/dist/templates/workflow-evidence-review.dna.yaml +198 -0
- package/dist/templates/workflow-module-inventory.dna.yaml +257 -0
- package/dist/templates/workflow-runtime-smoke-review.dna.yaml +252 -0
- package/dist/templates/workflow-verification-command-routing.dna.yaml +278 -0
- package/dist/workflow/authoring-packet.d.ts +67 -0
- package/dist/workflow/authoring-packet.js +218 -0
- package/dist/workflow/draft.d.ts +159 -0
- package/dist/workflow/draft.js +800 -0
- package/dist/workflow/index.d.ts +3 -0
- package/dist/workflow/index.js +3 -0
- package/dist/workflow/suggestion-review.d.ts +65 -0
- package/dist/workflow/suggestion-review.js +245 -0
- package/package.json +1 -1
- package/spec/README.md +15 -48
- package/spec/codex-adapter-contract.md +176 -0
- package/spec/sync-target-plan.md +158 -0
- package/spec/workflow-capability-ir.md +153 -0
- package/spec/agent-dispatch-fix.md +0 -116
- package/spec/control-plane-convergence-handoff-2026-04-24.md +0 -432
- package/spec/flutter-rewrite-template-optimization.md +0 -301
- package/spec/foundation-hardening.md +0 -178
- package/spec/hooks-infra-harness-hardening.md +0 -741
- package/spec/multi-config.md +0 -172
- package/spec/parallel-isolation.md +0 -268
- package/spec/template-version-namespace-fix.md +0 -653
- package/spec/workflow-pipeline.md +0 -101
|
@@ -10,9 +10,21 @@ export interface InitOptions {
|
|
|
10
10
|
template?: string;
|
|
11
11
|
register?: string;
|
|
12
12
|
upgrade?: string | boolean;
|
|
13
|
+
projectDir?: string;
|
|
14
|
+
json?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface CreateConfigFromTemplateResult {
|
|
17
|
+
path: string;
|
|
18
|
+
template: string;
|
|
19
|
+
namespace?: string;
|
|
13
20
|
}
|
|
14
21
|
/**
|
|
15
22
|
* Calculate SHA256 hash of template content (truncated to 16 hex chars).
|
|
16
23
|
*/
|
|
17
24
|
export declare function calculateTemplateHash(content: string): string;
|
|
25
|
+
export declare function createConfigFromTemplate(input: {
|
|
26
|
+
template: string;
|
|
27
|
+
output?: string;
|
|
28
|
+
projectDir?: string;
|
|
29
|
+
}): Promise<CreateConfigFromTemplateResult>;
|
|
18
30
|
export declare function runInit(opts: InitOptions): Promise<number>;
|
|
@@ -3,32 +3,24 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Interactive wizard to generate a new DNA file.
|
|
5
5
|
*/
|
|
6
|
-
import { writeFile, readFile, readdir, mkdir, copyFile
|
|
7
|
-
import { resolve,
|
|
8
|
-
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { writeFile, readFile, readdir, mkdir, copyFile } from "node:fs/promises";
|
|
7
|
+
import { resolve, basename } from "node:path";
|
|
9
8
|
import { parseYAML } from "../../schema/yaml-parser.js";
|
|
10
9
|
import { listTemplateCatalog, calculateTemplateContentHash } from "../../templates/catalog.js";
|
|
11
10
|
import { sanitizeTemplateName } from "../util/version.js";
|
|
12
11
|
import { validateDNA } from "../../schema/validate.js";
|
|
13
12
|
import { askString, askChoice, askNumber, askYesNo, closePrompt } from "../util/prompt.js";
|
|
14
|
-
const TEMPLATES_DIR = resolve(dirname(fileURLToPath(import.meta.url)), "..", "..", "templates");
|
|
15
13
|
const PROJECT_TEMPLATES_DIR = ".dna/templates";
|
|
16
14
|
const MULTI_CONFIG_DIR = ".dna/configs";
|
|
17
|
-
async function
|
|
18
|
-
|
|
19
|
-
await access(path);
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
catch {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
async function listTemplates() {
|
|
27
|
-
const entries = await listTemplateCatalog();
|
|
15
|
+
async function listTemplates(projectDir = process.cwd()) {
|
|
16
|
+
const entries = await listTemplateCatalog({ projectDir });
|
|
28
17
|
return entries.map((entry) => ({
|
|
29
18
|
name: entry.name,
|
|
19
|
+
path: entry.path,
|
|
30
20
|
namespace: entry.namespace,
|
|
31
21
|
displayName: entry.displayName,
|
|
22
|
+
version: entry.version,
|
|
23
|
+
contentHash: entry.contentHash,
|
|
32
24
|
source: entry.source,
|
|
33
25
|
}));
|
|
34
26
|
}
|
|
@@ -55,13 +47,14 @@ function injectSourceTemplate(content, templateName, templateVersion, templateHa
|
|
|
55
47
|
/**
|
|
56
48
|
* Check namespace collision against existing configs in .dna/configs/.
|
|
57
49
|
*/
|
|
58
|
-
async function checkNamespaceAgainstExisting(namespace, templateName) {
|
|
50
|
+
async function checkNamespaceAgainstExisting(namespace, templateName, projectDir = process.cwd()) {
|
|
59
51
|
if (!namespace)
|
|
60
52
|
return;
|
|
61
53
|
try {
|
|
62
|
-
const
|
|
54
|
+
const configDir = resolve(projectDir, MULTI_CONFIG_DIR);
|
|
55
|
+
const files = await readdir(configDir);
|
|
63
56
|
for (const f of files.filter(f => f.endsWith(".yaml") || f.endsWith(".yml"))) {
|
|
64
|
-
const content = await readFile(resolve(
|
|
57
|
+
const content = await readFile(resolve(configDir, f), "utf-8");
|
|
65
58
|
const data = parseYAML(content);
|
|
66
59
|
const existingNs = typeof data.namespace === "string" ? data.namespace : undefined;
|
|
67
60
|
if (existingNs === namespace && f !== `${templateName}.yaml`) {
|
|
@@ -77,7 +70,7 @@ async function checkNamespaceAgainstExisting(namespace, templateName) {
|
|
|
77
70
|
}
|
|
78
71
|
/**
|
|
79
72
|
* Infer template name from a DNA config's id field.
|
|
80
|
-
*
|
|
73
|
+
* For example, a template id becomes its dashed template name.
|
|
81
74
|
*/
|
|
82
75
|
function inferTemplateName(id) {
|
|
83
76
|
if (!id.startsWith("template_"))
|
|
@@ -88,14 +81,14 @@ function inferTemplateName(id) {
|
|
|
88
81
|
* Auto-detect DNA config file(s) for upgrade.
|
|
89
82
|
* Priority: .dna/configs/*.yaml (multi-config) > legacy single-config
|
|
90
83
|
*/
|
|
91
|
-
async function autoDetectConfigsForUpgrade() {
|
|
84
|
+
async function autoDetectConfigsForUpgrade(projectDir = process.cwd()) {
|
|
92
85
|
const { detectDNAConfigs } = await import("../../compiler/index.js");
|
|
93
|
-
return detectDNAConfigs(
|
|
86
|
+
return detectDNAConfigs(projectDir);
|
|
94
87
|
}
|
|
95
88
|
/**
|
|
96
89
|
* Upgrade config from a newer template version while preserving user-filled variables.
|
|
97
90
|
*/
|
|
98
|
-
async function upgradeConfig(configPath, templateName) {
|
|
91
|
+
async function upgradeConfig(configPath, templateName, projectDir = process.cwd()) {
|
|
99
92
|
// 1. Read current config
|
|
100
93
|
const currentContent = await readFile(configPath, "utf-8");
|
|
101
94
|
const current = parseYAML(currentContent);
|
|
@@ -110,16 +103,14 @@ async function upgradeConfig(configPath, templateName) {
|
|
|
110
103
|
}
|
|
111
104
|
}
|
|
112
105
|
// 3. Load new template
|
|
113
|
-
const templates = await listTemplates();
|
|
106
|
+
const templates = await listTemplates(projectDir);
|
|
114
107
|
const found = templates.find((t) => t.name === templateName);
|
|
115
108
|
if (!found) {
|
|
116
109
|
process.stderr.write(`Unknown template: ${templateName}\n`);
|
|
117
110
|
process.stderr.write(`Available: ${templates.map((t) => t.name).join(", ")}\n`);
|
|
118
111
|
return 2;
|
|
119
112
|
}
|
|
120
|
-
|
|
121
|
-
const srcPath = resolve(srcDir, `${found.name}.dna.yaml`);
|
|
122
|
-
let newContent = await readFile(srcPath, "utf-8");
|
|
113
|
+
let newContent = await readFile(found.path, "utf-8");
|
|
123
114
|
// 4. Inject _source_template, _template_version, and _template_content_hash
|
|
124
115
|
const templateData = parseYAML(newContent);
|
|
125
116
|
const templateVersion = typeof templateData.version === "string" ? templateData.version : undefined;
|
|
@@ -143,10 +134,37 @@ async function upgradeConfig(configPath, templateName) {
|
|
|
143
134
|
process.stderr.write("\n");
|
|
144
135
|
return 0;
|
|
145
136
|
}
|
|
137
|
+
export async function createConfigFromTemplate(input) {
|
|
138
|
+
const projectDir = input.projectDir ?? process.cwd();
|
|
139
|
+
const templates = await listTemplates(projectDir);
|
|
140
|
+
const found = templates.find((t) => t.name === input.template);
|
|
141
|
+
if (!found) {
|
|
142
|
+
throw new Error(`Unknown template: ${input.template}\nAvailable: ${templates.map((t) => t.name).join(", ")}`);
|
|
143
|
+
}
|
|
144
|
+
const content = await readFile(found.path, "utf-8");
|
|
145
|
+
const templateData = parseYAML(content);
|
|
146
|
+
const templateVersion = typeof templateData.version === "string" ? templateData.version : undefined;
|
|
147
|
+
const templateHash = calculateTemplateHash(content);
|
|
148
|
+
const contentWithSource = injectSourceTemplate(content, found.name, templateVersion, templateHash);
|
|
149
|
+
const srcNs = typeof templateData.namespace === "string" ? templateData.namespace : undefined;
|
|
150
|
+
await checkNamespaceAgainstExisting(srcNs, found.name, projectDir);
|
|
151
|
+
const safeName = sanitizeTemplateName(found.name);
|
|
152
|
+
const outPath = input.output
|
|
153
|
+
? resolve(projectDir, input.output)
|
|
154
|
+
: resolve(projectDir, MULTI_CONFIG_DIR, `${safeName}.yaml`);
|
|
155
|
+
await mkdir(resolve(outPath, ".."), { recursive: true });
|
|
156
|
+
await writeFile(outPath, contentWithSource, "utf-8");
|
|
157
|
+
return {
|
|
158
|
+
path: outPath,
|
|
159
|
+
template: found.name,
|
|
160
|
+
namespace: found.namespace,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
146
163
|
export async function runInit(opts) {
|
|
164
|
+
const projectDir = opts.projectDir ?? process.cwd();
|
|
147
165
|
// Upgrade mode: update template(s) while preserving user variables
|
|
148
166
|
if (opts.upgrade !== undefined) {
|
|
149
|
-
const configPaths = await autoDetectConfigsForUpgrade();
|
|
167
|
+
const configPaths = await autoDetectConfigsForUpgrade(projectDir);
|
|
150
168
|
if (configPaths.length === 0) {
|
|
151
169
|
process.stderr.write("No DNA config found. Run `dna init --template <name>` first.\n");
|
|
152
170
|
return 2;
|
|
@@ -171,7 +189,7 @@ export async function runInit(opts) {
|
|
|
171
189
|
process.stderr.write(`Config for template "${opts.upgrade}" not found in: ${configPaths.map(p => basename(p)).join(", ")}\n`);
|
|
172
190
|
return 2;
|
|
173
191
|
}
|
|
174
|
-
return upgradeConfig(targetPath, opts.upgrade);
|
|
192
|
+
return upgradeConfig(targetPath, opts.upgrade, projectDir);
|
|
175
193
|
}
|
|
176
194
|
// --upgrade (no arg): upgrade all configs
|
|
177
195
|
let exitCode = 0;
|
|
@@ -185,7 +203,7 @@ export async function runInit(opts) {
|
|
|
185
203
|
process.stderr.write(`Cannot infer template for ${basename(configPath)}. Skipping.\n`);
|
|
186
204
|
continue;
|
|
187
205
|
}
|
|
188
|
-
const code = await upgradeConfig(configPath, templateName);
|
|
206
|
+
const code = await upgradeConfig(configPath, templateName, projectDir);
|
|
189
207
|
if (code !== 0)
|
|
190
208
|
exitCode = code;
|
|
191
209
|
}
|
|
@@ -206,22 +224,22 @@ export async function runInit(opts) {
|
|
|
206
224
|
return 2;
|
|
207
225
|
}
|
|
208
226
|
// Check namespace uniqueness against all existing templates
|
|
209
|
-
const existing = await listTemplates();
|
|
227
|
+
const existing = await listTemplates(projectDir);
|
|
210
228
|
const conflict = existing.find((t) => t.namespace === srcNs);
|
|
211
229
|
if (conflict) {
|
|
212
230
|
process.stderr.write(`Namespace "${srcNs}" already used by template "${conflict.name}" (${conflict.source})\n`);
|
|
213
231
|
return 2;
|
|
214
232
|
}
|
|
215
|
-
await mkdir(PROJECT_TEMPLATES_DIR, { recursive: true });
|
|
233
|
+
await mkdir(resolve(projectDir, PROJECT_TEMPLATES_DIR), { recursive: true });
|
|
216
234
|
const destFile = basename(srcPath).endsWith(".dna.yaml") ? basename(srcPath) : `${basename(srcPath, ".yaml")}.dna.yaml`;
|
|
217
|
-
const destPath = resolve(PROJECT_TEMPLATES_DIR, destFile);
|
|
235
|
+
const destPath = resolve(projectDir, PROJECT_TEMPLATES_DIR, destFile);
|
|
218
236
|
await copyFile(srcPath, destPath);
|
|
219
237
|
process.stderr.write(`Registered template: ${destPath} (namespace: ${srcNs})\n`);
|
|
220
238
|
return 0;
|
|
221
239
|
}
|
|
222
240
|
// Template mode: copy a pre-built template
|
|
223
241
|
if (opts.template) {
|
|
224
|
-
const templates = await listTemplates();
|
|
242
|
+
const templates = await listTemplates(projectDir);
|
|
225
243
|
if (opts.template === "list") {
|
|
226
244
|
process.stderr.write("Available templates:\n");
|
|
227
245
|
// Calculate column widths
|
|
@@ -238,35 +256,52 @@ export async function runInit(opts) {
|
|
|
238
256
|
}
|
|
239
257
|
return 0;
|
|
240
258
|
}
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
259
|
+
const result = await createConfigFromTemplate({
|
|
260
|
+
template: opts.template,
|
|
261
|
+
output: opts.output,
|
|
262
|
+
projectDir,
|
|
263
|
+
}).catch((err) => {
|
|
264
|
+
process.stderr.write(`${err instanceof Error ? err.message : String(err)}\n`);
|
|
265
|
+
return undefined;
|
|
266
|
+
});
|
|
267
|
+
if (!result)
|
|
245
268
|
return 2;
|
|
269
|
+
const packet = {
|
|
270
|
+
schema_version: "intentdna.init_result.v1",
|
|
271
|
+
mode: "template_init",
|
|
272
|
+
status: "created",
|
|
273
|
+
projectDir,
|
|
274
|
+
path: result.path,
|
|
275
|
+
template: result.template,
|
|
276
|
+
namespace: result.namespace,
|
|
277
|
+
commandEffects: {
|
|
278
|
+
mutation_performed: true,
|
|
279
|
+
network_performed: false,
|
|
280
|
+
runtime_authority: false,
|
|
281
|
+
online_required: false,
|
|
282
|
+
cloud_required: false,
|
|
283
|
+
syncs_harness: false,
|
|
284
|
+
executes_workflow: false,
|
|
285
|
+
},
|
|
286
|
+
boundaries: [
|
|
287
|
+
"dna init creates local DNA config only; it does not sync harness artifacts.",
|
|
288
|
+
"dna init does not execute workflows or make allow/warn/block/validate decisions.",
|
|
289
|
+
"Online and Supabase are not required for local template initialization.",
|
|
290
|
+
"Marketplace/template metadata distributes workflow assets; it is not runtime authority.",
|
|
291
|
+
],
|
|
292
|
+
nextCommands: [
|
|
293
|
+
"dna sync --dry-run",
|
|
294
|
+
"dna sync",
|
|
295
|
+
"dna report package --json",
|
|
296
|
+
],
|
|
297
|
+
};
|
|
298
|
+
if (opts.json) {
|
|
299
|
+
process.stdout.write(JSON.stringify(packet, null, 2) + "\n");
|
|
300
|
+
return 0;
|
|
246
301
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
// Inject _source_template and _template_version metadata for upgrade tracking
|
|
251
|
-
// Inject _source_template, _template_version, and _template_content_hash for upgrade tracking
|
|
252
|
-
const templateData = parseYAML(content);
|
|
253
|
-
const templateVersion = typeof templateData.version === "string" ? templateData.version : undefined;
|
|
254
|
-
const templateHash = calculateTemplateHash(content);
|
|
255
|
-
const contentWithSource = injectSourceTemplate(content, found.name, templateVersion, templateHash);
|
|
256
|
-
// Check namespace collision against existing configs
|
|
257
|
-
const srcData = parseYAML(content);
|
|
258
|
-
const srcNs = typeof srcData.namespace === "string" ? srcData.namespace : undefined;
|
|
259
|
-
await checkNamespaceAgainstExisting(srcNs, found.name);
|
|
260
|
-
// Default output: .dna/configs/<template-name>.yaml (multi-config)
|
|
261
|
-
const safeName = sanitizeTemplateName(found.name);
|
|
262
|
-
const outPath = opts.output || resolve(MULTI_CONFIG_DIR, `${safeName}.yaml`);
|
|
263
|
-
// Ensure output directory exists
|
|
264
|
-
const outDir = resolve(outPath, "..");
|
|
265
|
-
await mkdir(outDir, { recursive: true });
|
|
266
|
-
await writeFile(outPath, contentWithSource, "utf-8");
|
|
267
|
-
process.stderr.write(`Created ${outPath} from template '${found.name}'`);
|
|
268
|
-
if (found.namespace)
|
|
269
|
-
process.stderr.write(` (namespace: ${found.namespace})`);
|
|
302
|
+
process.stderr.write(`Created ${result.path} from template '${result.template}'`);
|
|
303
|
+
if (result.namespace)
|
|
304
|
+
process.stderr.write(` (namespace: ${result.namespace})`);
|
|
270
305
|
process.stderr.write("\n");
|
|
271
306
|
return 0;
|
|
272
307
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dna org — local organization/project asset management.
|
|
3
|
+
*/
|
|
4
|
+
export interface OrgOptions {
|
|
5
|
+
subcommand: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
project?: string;
|
|
9
|
+
asset?: string;
|
|
10
|
+
status?: string;
|
|
11
|
+
syncTarget?: string;
|
|
12
|
+
projectDir?: string;
|
|
13
|
+
apply?: boolean;
|
|
14
|
+
json?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function runOrg(opts: OrgOptions): Promise<number>;
|