atomism 0.1.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.
Files changed (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +210 -0
  3. package/dist/chunk-34O5KJWR.js +81 -0
  4. package/dist/chunk-34O5KJWR.js.map +1 -0
  5. package/dist/chunk-55AP34JO.js +116 -0
  6. package/dist/chunk-55AP34JO.js.map +1 -0
  7. package/dist/chunk-6MDHM2B4.js +17 -0
  8. package/dist/chunk-6MDHM2B4.js.map +1 -0
  9. package/dist/chunk-GU2R4KLP.js +43 -0
  10. package/dist/chunk-GU2R4KLP.js.map +1 -0
  11. package/dist/chunk-H7WC3NXZ.js +39 -0
  12. package/dist/chunk-H7WC3NXZ.js.map +1 -0
  13. package/dist/chunk-P33CQFMY.js +329 -0
  14. package/dist/chunk-P33CQFMY.js.map +1 -0
  15. package/dist/chunk-P6X7T4KA.js +200 -0
  16. package/dist/chunk-P6X7T4KA.js.map +1 -0
  17. package/dist/chunk-PLQJM2KT.js +9 -0
  18. package/dist/chunk-PLQJM2KT.js.map +1 -0
  19. package/dist/chunk-RS2IEGW3.js +10 -0
  20. package/dist/chunk-RS2IEGW3.js.map +1 -0
  21. package/dist/chunk-S6Z5G5DB.js +84 -0
  22. package/dist/chunk-S6Z5G5DB.js.map +1 -0
  23. package/dist/chunk-UVUDQ4XP.js +259 -0
  24. package/dist/chunk-UVUDQ4XP.js.map +1 -0
  25. package/dist/chunk-UWVZQSP4.js +597 -0
  26. package/dist/chunk-UWVZQSP4.js.map +1 -0
  27. package/dist/chunk-YKJO3ZFY.js +308 -0
  28. package/dist/chunk-YKJO3ZFY.js.map +1 -0
  29. package/dist/cli.d.ts +1 -0
  30. package/dist/cli.js +152 -0
  31. package/dist/cli.js.map +1 -0
  32. package/dist/create-atom-AXPDBYQL.js +153 -0
  33. package/dist/create-atom-AXPDBYQL.js.map +1 -0
  34. package/dist/escalate-BTEJT5NL.js +211 -0
  35. package/dist/escalate-BTEJT5NL.js.map +1 -0
  36. package/dist/extract-RPKCTINT.js +514 -0
  37. package/dist/extract-RPKCTINT.js.map +1 -0
  38. package/dist/graduate-453M7ZRQ.js +222 -0
  39. package/dist/graduate-453M7ZRQ.js.map +1 -0
  40. package/dist/helpers-PJPFPYBQ.js +11 -0
  41. package/dist/helpers-PJPFPYBQ.js.map +1 -0
  42. package/dist/history-OPD7NLZW.js +258 -0
  43. package/dist/history-OPD7NLZW.js.map +1 -0
  44. package/dist/import-generator-4CKRBMTE.js +1864 -0
  45. package/dist/import-generator-4CKRBMTE.js.map +1 -0
  46. package/dist/index.d.ts +230 -0
  47. package/dist/index.js +41 -0
  48. package/dist/index.js.map +1 -0
  49. package/dist/init-2FINDMYK.js +741 -0
  50. package/dist/init-2FINDMYK.js.map +1 -0
  51. package/dist/list-NEBVBGG3.js +71 -0
  52. package/dist/list-NEBVBGG3.js.map +1 -0
  53. package/dist/parser-3BILOSOO.js +157 -0
  54. package/dist/parser-3BILOSOO.js.map +1 -0
  55. package/dist/plan-DNVARHWH.js +249 -0
  56. package/dist/plan-DNVARHWH.js.map +1 -0
  57. package/dist/register-XTRMSH7Y.js +91 -0
  58. package/dist/register-XTRMSH7Y.js.map +1 -0
  59. package/dist/revert-J4CRDE2K.js +87 -0
  60. package/dist/revert-J4CRDE2K.js.map +1 -0
  61. package/dist/run-3GI3SBYL.js +188 -0
  62. package/dist/run-3GI3SBYL.js.map +1 -0
  63. package/dist/scan-generators-ST4TBEY7.js +375 -0
  64. package/dist/scan-generators-ST4TBEY7.js.map +1 -0
  65. package/dist/signatures-K5QIL4WG.js +258 -0
  66. package/dist/signatures-K5QIL4WG.js.map +1 -0
  67. package/dist/skills-assign-IHOXX4AI.js +182 -0
  68. package/dist/skills-assign-IHOXX4AI.js.map +1 -0
  69. package/dist/skills-load-JSD5UG2K.js +20 -0
  70. package/dist/skills-load-JSD5UG2K.js.map +1 -0
  71. package/dist/skills-scan-WACJFRJN.js +25 -0
  72. package/dist/skills-scan-WACJFRJN.js.map +1 -0
  73. package/dist/skills-suggest-JFI2NUJI.js +269 -0
  74. package/dist/skills-suggest-JFI2NUJI.js.map +1 -0
  75. package/dist/status-KQVSAZFR.js +111 -0
  76. package/dist/status-KQVSAZFR.js.map +1 -0
  77. package/dist/suggest-IFFJQFIW.js +183 -0
  78. package/dist/suggest-IFFJQFIW.js.map +1 -0
  79. package/dist/test-HP3FG3MO.js +152 -0
  80. package/dist/test-HP3FG3MO.js.map +1 -0
  81. package/dist/test-gen-2ZGPOP35.js +347 -0
  82. package/dist/test-gen-2ZGPOP35.js.map +1 -0
  83. package/dist/trust-4R26DULG.js +248 -0
  84. package/dist/trust-4R26DULG.js.map +1 -0
  85. package/dist/validate-generator-46H2LYYQ.js +410 -0
  86. package/dist/validate-generator-46H2LYYQ.js.map +1 -0
  87. package/dist/workflow-5UVLBS7J.js +655 -0
  88. package/dist/workflow-5UVLBS7J.js.map +1 -0
  89. package/package.json +84 -0
@@ -0,0 +1,91 @@
1
+ import {
2
+ isAtom,
3
+ loadAtomFromFile
4
+ } from "./chunk-P6X7T4KA.js";
5
+ import {
6
+ resolveAtomPath
7
+ } from "./chunk-RS2IEGW3.js";
8
+ import {
9
+ withErrorHandling
10
+ } from "./chunk-GU2R4KLP.js";
11
+ import {
12
+ fileExists,
13
+ getRegistryPath,
14
+ loadRegistry,
15
+ saveRegistry
16
+ } from "./chunk-YKJO3ZFY.js";
17
+ import "./chunk-PLQJM2KT.js";
18
+
19
+ // src/commands/register.ts
20
+ import { dirname } from "path";
21
+ import { readFile } from "fs/promises";
22
+ import { createHash } from "crypto";
23
+ import { zodToJsonSchema } from "zod-to-json-schema";
24
+ function zodToJson(schema) {
25
+ return zodToJsonSchema(schema, { target: "jsonSchema7" });
26
+ }
27
+ async function registerCommand(atomPath, options) {
28
+ const projectRoot = process.cwd();
29
+ const registryPath = getRegistryPath(projectRoot);
30
+ await withErrorHandling(options, async () => {
31
+ const absolutePath = resolveAtomPath(atomPath, projectRoot);
32
+ if (!await fileExists(absolutePath)) {
33
+ throw new Error(`Atom file not found: ${absolutePath}`);
34
+ }
35
+ const atom = await loadAtomFromFile(absolutePath);
36
+ const atomDir = dirname(absolutePath);
37
+ const testPath = resolveAtomPath(atom.tests.path, atomDir);
38
+ if (!await fileExists(testPath)) {
39
+ throw new Error(
40
+ `Test file not found: ${testPath}
41
+ Suggestion: Create the test file or update tests.path in your atom definition.`
42
+ );
43
+ }
44
+ const registry = await loadRegistry(registryPath);
45
+ const existingAtom = registry.atoms[atom.name];
46
+ const wasRegistered = !!existingAtom;
47
+ const inputSchema = zodToJson(atom.input);
48
+ const outputSchema = zodToJson(atom.output);
49
+ const atomContent = await readFile(absolutePath, "utf-8");
50
+ const contentHash = createHash("sha256").update(atomContent).digest("hex");
51
+ registry.atoms[atom.name] = {
52
+ name: atom.name,
53
+ description: atom.description,
54
+ path: absolutePath,
55
+ idempotent: atom.idempotent,
56
+ tests: atom.tests,
57
+ agent: atom.agent,
58
+ skill: atom.skill,
59
+ registeredAt: existingAtom?.registeredAt ?? (/* @__PURE__ */ new Date()).toISOString(),
60
+ inputSchema,
61
+ outputSchema,
62
+ contentHash,
63
+ // Preserve graduation info on update
64
+ graduated: existingAtom?.graduated ?? false,
65
+ generatorPath: existingAtom?.generatorPath,
66
+ graduatedAt: existingAtom?.graduatedAt
67
+ };
68
+ await saveRegistry(registryPath, registry);
69
+ const result = {
70
+ success: true,
71
+ atomName: atom.name,
72
+ path: absolutePath,
73
+ updated: wasRegistered
74
+ };
75
+ if (options.json) {
76
+ console.log(JSON.stringify(result, null, 2));
77
+ } else {
78
+ if (wasRegistered) {
79
+ console.log(`\u2713 Updated atom: ${atom.name}`);
80
+ } else {
81
+ console.log(`\u2713 Registered atom: ${atom.name}`);
82
+ }
83
+ console.log(` Path: ${absolutePath}`);
84
+ }
85
+ });
86
+ }
87
+ export {
88
+ isAtom,
89
+ registerCommand
90
+ };
91
+ //# sourceMappingURL=register-XTRMSH7Y.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/register.ts"],"sourcesContent":["import { dirname } from 'node:path';\nimport { readFile } from 'node:fs/promises';\nimport { createHash } from 'node:crypto';\nimport { z } from 'zod';\nimport { zodToJsonSchema } from 'zod-to-json-schema';\nimport { fileExists, loadRegistry, saveRegistry, getRegistryPath } from '../storage/index.js';\nimport { loadAtomFromFile } from '../atom/loader.js';\nimport { withErrorHandling } from './helpers.js';\nimport { resolveAtomPath } from '../utils/paths.js';\n\nexport interface RegisterOptions {\n json?: boolean;\n}\n\nexport interface RegisterResult {\n success: boolean;\n atomName: string;\n path: string;\n updated: boolean;\n}\n\n/**\n * Convert a Zod schema to JSON Schema for storage.\n * Note: Cast through 'any' for Zod 4 compatibility with zod-to-json-schema.\n */\nfunction zodToJson(schema: z.ZodType): Record<string, unknown> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return zodToJsonSchema(schema as any, { target: 'jsonSchema7' }) as Record<string, unknown>;\n}\n\n// Re-export isAtom from canonical location for backwards compatibility\nexport { isAtom } from '../atom/define.js';\n\n/**\n * Register an atom file into the project registry.\n */\nexport async function registerCommand(\n atomPath: string,\n options: RegisterOptions\n): Promise<void> {\n const projectRoot = process.cwd();\n const registryPath = getRegistryPath(projectRoot);\n\n await withErrorHandling(options, async () => {\n // Resolve atom path\n const absolutePath = resolveAtomPath(atomPath, projectRoot);\n\n // Check if atom file exists\n if (!(await fileExists(absolutePath))) {\n throw new Error(`Atom file not found: ${absolutePath}`);\n }\n\n // Load the atom from the file\n const atom = await loadAtomFromFile(absolutePath);\n\n // Validate test manifest - check if test file exists\n const atomDir = dirname(absolutePath);\n const testPath = resolveAtomPath(atom.tests.path, atomDir);\n\n if (!(await fileExists(testPath))) {\n throw new Error(\n `Test file not found: ${testPath}\\n` +\n `Suggestion: Create the test file or update tests.path in your atom definition.`\n );\n }\n\n // Load registry\n const registry = await loadRegistry(registryPath);\n\n // Check if already registered\n const existingAtom = registry.atoms[atom.name];\n const wasRegistered = !!existingAtom;\n\n // Convert Zod schemas to JSON Schema for storage\n const inputSchema = zodToJson(atom.input);\n const outputSchema = zodToJson(atom.output);\n\n // Compute content hash of atom file for integrity verification\n const atomContent = await readFile(absolutePath, 'utf-8');\n const contentHash = createHash('sha256').update(atomContent).digest('hex');\n\n // Add/update atom in registry (preserve graduation info if updating)\n registry.atoms[atom.name] = {\n name: atom.name,\n description: atom.description,\n path: absolutePath,\n idempotent: atom.idempotent,\n tests: atom.tests,\n agent: atom.agent,\n skill: atom.skill,\n registeredAt: existingAtom?.registeredAt ?? new Date().toISOString(),\n inputSchema,\n outputSchema,\n contentHash,\n // Preserve graduation info on update\n graduated: existingAtom?.graduated ?? false,\n generatorPath: existingAtom?.generatorPath,\n graduatedAt: existingAtom?.graduatedAt,\n };\n\n // Save registry\n await saveRegistry(registryPath, registry);\n\n // Output result\n const result: RegisterResult = {\n success: true,\n atomName: atom.name,\n path: absolutePath,\n updated: wasRegistered,\n };\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n if (wasRegistered) {\n console.log(`✓ Updated atom: ${atom.name}`);\n } else {\n console.log(`✓ Registered atom: ${atom.name}`);\n }\n console.log(` Path: ${absolutePath}`);\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAE3B,SAAS,uBAAuB;AAqBhC,SAAS,UAAU,QAA4C;AAE7D,SAAO,gBAAgB,QAAe,EAAE,QAAQ,cAAc,CAAC;AACjE;AAQA,eAAsB,gBACpB,UACA,SACe;AACf,QAAM,cAAc,QAAQ,IAAI;AAChC,QAAM,eAAe,gBAAgB,WAAW;AAEhD,QAAM,kBAAkB,SAAS,YAAY;AAE3C,UAAM,eAAe,gBAAgB,UAAU,WAAW;AAG1D,QAAI,CAAE,MAAM,WAAW,YAAY,GAAI;AACrC,YAAM,IAAI,MAAM,wBAAwB,YAAY,EAAE;AAAA,IACxD;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A,MAC5C,OAAO;AACL,gBAAQ,IAAI,2BAAsB,KAAK,IAAI,EAAE;AAAA,MAC/C;AACA,cAAQ,IAAI,WAAW,YAAY,EAAE;AAAA,IACvC;AAAA,EACF,CAAC;AACH;","names":[]}
@@ -0,0 +1,87 @@
1
+ import {
2
+ withErrorHandling
3
+ } from "./chunk-GU2R4KLP.js";
4
+ import {
5
+ getRegistryPath,
6
+ loadRegistry,
7
+ revertAtom,
8
+ saveRegistry
9
+ } from "./chunk-YKJO3ZFY.js";
10
+ import "./chunk-PLQJM2KT.js";
11
+
12
+ // src/commands/revert.ts
13
+ async function revertCommand(options) {
14
+ const projectRoot = process.cwd();
15
+ const registryPath = getRegistryPath(projectRoot);
16
+ await withErrorHandling(options, async () => {
17
+ if (!/^[a-z][a-z0-9_]*$/.test(options.atom)) {
18
+ throw new Error(
19
+ `Invalid atom name: ${options.atom}
20
+ Atom names must be snake_case`
21
+ );
22
+ }
23
+ const registry = await loadRegistry(registryPath);
24
+ const atom = registry.atoms[options.atom];
25
+ if (!atom) {
26
+ const availableAtoms = Object.keys(registry.atoms);
27
+ if (availableAtoms.length === 0) {
28
+ throw new Error(
29
+ `Atom '${options.atom}' not found. No atoms are registered.
30
+ Register an atom with: atomic register`
31
+ );
32
+ }
33
+ throw new Error(
34
+ `Atom '${options.atom}' not found.
35
+ Available atoms: ${availableAtoms.join(", ")}`
36
+ );
37
+ }
38
+ if (!atom.graduated) {
39
+ throw new Error(
40
+ `Atom '${options.atom}' is not graduated.
41
+ Only graduated atoms can be reverted.`
42
+ );
43
+ }
44
+ if (!options.json) {
45
+ console.log(`
46
+ Reverting atom: ${options.atom}`);
47
+ console.log(`\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500`);
48
+ console.log(`Generator: ${atom.generatorPath}`);
49
+ console.log(`Reverting to: handler-based execution`);
50
+ if (options.reason) {
51
+ console.log(`Reason: ${options.reason}`);
52
+ }
53
+ console.log("");
54
+ console.log("Note: Generator file will be preserved (not deleted).");
55
+ console.log("");
56
+ if (!options.yes) {
57
+ console.log("Use --yes to confirm reversion.");
58
+ console.log("");
59
+ return;
60
+ }
61
+ }
62
+ registry.atoms[options.atom] = revertAtom(atom);
63
+ await saveRegistry(registryPath, registry);
64
+ const result = {
65
+ success: true,
66
+ atom: options.atom,
67
+ reason: options.reason
68
+ };
69
+ if (options.json) {
70
+ console.log(JSON.stringify(result, null, 2));
71
+ } else {
72
+ console.log(`\u2713 Atom '${options.atom}' reverted to handler`);
73
+ console.log(` Path: ${atom.path}`);
74
+ if (options.reason) {
75
+ console.log(` Reason: ${options.reason}`);
76
+ }
77
+ console.log("");
78
+ console.log("Next steps:");
79
+ console.log(" 1. Test the atom with: atomic run " + options.atom);
80
+ console.log(" 2. Re-graduate later with: atomic graduate " + options.atom);
81
+ }
82
+ });
83
+ }
84
+ export {
85
+ revertCommand
86
+ };
87
+ //# sourceMappingURL=revert-J4CRDE2K.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/revert.ts"],"sourcesContent":["/**\n * Revert command for the atomic CLI.\n *\n * This module implements the `atomic revert` command which reverts\n * an atom from generator-based (deterministic) back to handler-based\n * (probabilistic) execution.\n *\n * @module revert\n */\n\nimport { loadRegistry, saveRegistry, getRegistryPath } from '../storage/index.js';\nimport { revertAtom } from '../schemas/registry.js';\nimport { withErrorHandling } from './helpers.js';\n\n/**\n * Options for the revert command.\n */\nexport interface RevertOptions {\n atom: string;\n reason?: string;\n json?: boolean;\n yes?: boolean;\n}\n\n/**\n * Result of reversion.\n */\nexport interface RevertResult {\n success: boolean;\n atom: string;\n reason?: string;\n error?: string;\n}\n\n/**\n * Revert an atom from generator back to handler.\n *\n * @param options - Command options\n */\nexport async function revertCommand(options: RevertOptions): Promise<void> {\n const projectRoot = process.cwd();\n const registryPath = getRegistryPath(projectRoot);\n\n await withErrorHandling(options, async () => {\n // Validate atom name\n if (!/^[a-z][a-z0-9_]*$/.test(options.atom)) {\n throw new Error(\n `Invalid atom name: ${options.atom}\\n` +\n 'Atom names must be snake_case'\n );\n }\n\n // Load registry\n const registry = await loadRegistry(registryPath);\n\n // Check if atom exists\n const atom = registry.atoms[options.atom];\n if (!atom) {\n const availableAtoms = Object.keys(registry.atoms);\n if (availableAtoms.length === 0) {\n throw new Error(\n `Atom '${options.atom}' not found. No atoms are registered.\\n` +\n 'Register an atom with: atomic register'\n );\n }\n throw new Error(\n `Atom '${options.atom}' not found.\\n` +\n `Available atoms: ${availableAtoms.join(', ')}`\n );\n }\n\n // Check if it's graduated\n if (!atom.graduated) {\n throw new Error(\n `Atom '${options.atom}' is not graduated.\\n` +\n 'Only graduated atoms can be reverted.'\n );\n }\n\n // Show what we're about to do\n if (!options.json) {\n console.log(`\\nReverting atom: ${options.atom}`);\n console.log(`─────────────────────────────────────────────`);\n console.log(`Generator: ${atom.generatorPath}`);\n console.log(`Reverting to: handler-based execution`);\n if (options.reason) {\n console.log(`Reason: ${options.reason}`);\n }\n console.log('');\n console.log('Note: Generator file will be preserved (not deleted).');\n console.log('');\n\n if (!options.yes) {\n console.log('Use --yes to confirm reversion.');\n console.log('');\n return;\n }\n }\n\n // Revert the atom\n registry.atoms[options.atom] = revertAtom(atom);\n\n // Save the registry\n await saveRegistry(registryPath, registry);\n\n const result: RevertResult = {\n success: true,\n atom: options.atom,\n reason: options.reason,\n };\n\n if (options.json) {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`✓ Atom '${options.atom}' reverted to handler`);\n console.log(` Path: ${atom.path}`);\n if (options.reason) {\n console.log(` Reason: ${options.reason}`);\n }\n console.log('');\n console.log('Next steps:');\n console.log(' 1. Test the atom with: atomic run ' + options.atom);\n console.log(' 2. Re-graduate later with: atomic graduate ' +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F;AAGA,aAAS,MAAM,QAAQ,IAAI,IAAI,WAAW,IAAI;AAG9C,UAAM,aAAa,cAAc,QAAQ;AAEzC,UAAM,SAAuB;AAAA,MAC3B,SAAS;AAAA,MACT,MAAM,QAAQ;AAAA,MACd,QAAQ,QAAQ;AAAA,IAClB;AAEA,QAAI,QAAQ,MAAM;AAChB,cAAQ,IAAI,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;AAAA,IAC7C,OAAO;AACL,cAAQ,IAAI,gBAAW,QAAQ,IAAI,uBAAuB;AAC1D,cAAQ,IAAI,WAAW,KAAK,IAAI,EAAE;AAClC,UAAI,QAAQ,QAAQ;AAClB,gBAAQ,IAAI,aAAa,QAAQ,MAAM,EAAE;AAAA,MAC3C;AACA,cAAQ,IAAI,EAAE;AACd,cAAQ,IAAI,aAAa;AACzB,cAAQ,IAAI,yCAAyC,QAAQ,IAAI;AACjE,cAAQ,IAAI,kDAAkD,QAAQ,IAAI;AAAA,IAC5E;AAAA,EACF,CAAC;AACH;","names":[]}
@@ -0,0 +1,188 @@
1
+ import {
2
+ executeAtom,
3
+ getAtomSkillNames
4
+ } from "./chunk-P33CQFMY.js";
5
+ import "./chunk-P6X7T4KA.js";
6
+ import {
7
+ resolveAtomPath
8
+ } from "./chunk-RS2IEGW3.js";
9
+ import {
10
+ getRegistryPath,
11
+ loadRegistry
12
+ } from "./chunk-YKJO3ZFY.js";
13
+ import {
14
+ formatLoadedSkills,
15
+ loadSkillsForAtom
16
+ } from "./chunk-55AP34JO.js";
17
+ import "./chunk-6MDHM2B4.js";
18
+ import "./chunk-UVUDQ4XP.js";
19
+ import {
20
+ fmt,
21
+ formatAtomError,
22
+ formatFailure,
23
+ formatSuccess
24
+ } from "./chunk-S6Z5G5DB.js";
25
+ import {
26
+ toErrorMessage
27
+ } from "./chunk-PLQJM2KT.js";
28
+
29
+ // src/commands/run.ts
30
+ import { readFile } from "fs/promises";
31
+ import { createHash } from "crypto";
32
+ async function runCommand(target, options) {
33
+ const projectRoot = process.cwd();
34
+ const registryPath = getRegistryPath(projectRoot);
35
+ const startTime = Date.now();
36
+ try {
37
+ const registry = await loadRegistry(registryPath);
38
+ let inputData = {};
39
+ if (options.input !== void 0) {
40
+ try {
41
+ inputData = JSON.parse(options.input);
42
+ } catch {
43
+ throw new Error(
44
+ `Invalid JSON input: ${options.input}
45
+ Provide valid JSON, e.g., --input '{"key": "value"}'`
46
+ );
47
+ }
48
+ }
49
+ const atomEntry = registry.atoms[target];
50
+ if (!atomEntry) {
51
+ const availableAtoms = Object.keys(registry.atoms);
52
+ if (availableAtoms.length === 0) {
53
+ throw new Error(
54
+ `Atom '${target}' not found. No atoms are registered.
55
+ Register an atom with: atomic register <path>`
56
+ );
57
+ }
58
+ throw new Error(
59
+ `Atom '${target}' not found.
60
+ Available atoms: ${availableAtoms.join(", ")}`
61
+ );
62
+ }
63
+ if (atomEntry.contentHash) {
64
+ const atomFilePath = resolveAtomPath(atomEntry.path, projectRoot);
65
+ try {
66
+ const currentContent = await readFile(atomFilePath, "utf-8");
67
+ const currentHash = createHash("sha256").update(currentContent).digest("hex");
68
+ if (currentHash !== atomEntry.contentHash) {
69
+ console.warn(
70
+ `Warning: Atom '${target}' has been modified since registration.
71
+ Re-register with: atomic register ${atomEntry.path}`
72
+ );
73
+ }
74
+ } catch {
75
+ }
76
+ }
77
+ if (options.cache && !atomEntry.idempotent) {
78
+ throw new Error(
79
+ `Cannot use --cache with non-idempotent atom '${target}'.
80
+ Only idempotent atoms can be cached.`
81
+ );
82
+ }
83
+ if (!atomEntry.graduated && !atomEntry.idempotent && !options.yes) {
84
+ throw new Error(
85
+ `Atom '${target}' is not idempotent.
86
+ Re-running may have side effects. Use --yes to confirm execution.`
87
+ );
88
+ }
89
+ let preloadedSkillResult;
90
+ if (!atomEntry.graduated) {
91
+ const skillNames = getAtomSkillNames(atomEntry);
92
+ preloadedSkillResult = await loadSkillsForAtom(skillNames);
93
+ if (!options.json) {
94
+ for (const line of formatLoadedSkills(preloadedSkillResult)) {
95
+ console.log(line);
96
+ }
97
+ }
98
+ }
99
+ const skillLoader = preloadedSkillResult ? async () => preloadedSkillResult : void 0;
100
+ const execResult = await executeAtom(
101
+ target,
102
+ inputData,
103
+ projectRoot,
104
+ skillLoader
105
+ );
106
+ const duration = Date.now() - startTime;
107
+ formatAndOutputResult(execResult, target, inputData, duration, options, atomEntry.graduated);
108
+ } catch (err) {
109
+ const duration = Date.now() - startTime;
110
+ outputCatchError(err, target, options, duration);
111
+ }
112
+ }
113
+ function formatAndOutputResult(execResult, target, inputData, duration, options, graduated) {
114
+ const runResult = {
115
+ success: execResult.success,
116
+ atomName: execResult.atomName,
117
+ input: inputData,
118
+ duration
119
+ };
120
+ if (execResult.success) {
121
+ runResult.output = execResult.output;
122
+ } else {
123
+ runResult.error = {
124
+ type: "execution",
125
+ message: execResult.error || "Unknown error",
126
+ recoverable: false
127
+ };
128
+ }
129
+ if (options.json) {
130
+ console.log(JSON.stringify(runResult, null, 2));
131
+ if (!execResult.success) {
132
+ process.exit(1);
133
+ }
134
+ return;
135
+ }
136
+ const displayName = graduated ? `${target} (generator)` : execResult.atomName;
137
+ if (execResult.success) {
138
+ console.log(formatSuccess(displayName, duration));
139
+ if (execResult.output != null) {
140
+ console.log(` ${fmt.gray("Output:")}`);
141
+ const outputStr = typeof execResult.output === "string" ? execResult.output : JSON.stringify(execResult.output, null, 2);
142
+ console.log(outputStr.split("\n").map((l) => ` ${l}`).join("\n"));
143
+ }
144
+ } else {
145
+ console.error(formatFailure(displayName));
146
+ console.error(formatAtomError({
147
+ type: "execution",
148
+ message: execResult.error || "Execution failed",
149
+ recoverable: false
150
+ }));
151
+ process.exit(1);
152
+ }
153
+ }
154
+ function outputCatchError(err, target, options, duration) {
155
+ if (options.json) {
156
+ let parsedInput = {};
157
+ try {
158
+ parsedInput = options.input ? JSON.parse(options.input) : {};
159
+ } catch {
160
+ parsedInput = options.input ?? {};
161
+ }
162
+ console.log(
163
+ JSON.stringify({
164
+ success: false,
165
+ atomName: target,
166
+ input: parsedInput,
167
+ error: {
168
+ type: "execution",
169
+ message: toErrorMessage(err),
170
+ recoverable: false
171
+ },
172
+ duration
173
+ })
174
+ );
175
+ process.exit(1);
176
+ } else {
177
+ console.error(formatAtomError({
178
+ type: "execution",
179
+ message: toErrorMessage(err),
180
+ recoverable: false
181
+ }));
182
+ process.exit(1);
183
+ }
184
+ }
185
+ export {
186
+ runCommand
187
+ };
188
+ //# sourceMappingURL=run-3GI3SBYL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/run.ts"],"sourcesContent":["/**\n * Run command implementation for the atomic CLI.\n *\n * This is a thin CLI wrapper around `executeAtom()` from `atom/execute.ts`.\n * It adds CLI-only concerns:\n * - Content-hash verification (drift detection)\n * - Non-idempotent confirmation gating (--yes flag)\n * - Skill loading progress output\n * - Human-readable and JSON output formatting\n *\n * All core execution logic (loading atoms/generators, input/output validation,\n * handler/generator execution, run recording) is delegated to `executeAtom()`.\n *\n * @module run\n */\n\nimport { readFile } from 'node:fs/promises';\nimport { createHash } from 'node:crypto';\nimport { loadRegistry, getRegistryPath } from '../storage/index.js';\nimport { formatAtomError, formatSuccess, formatFailure, fmt } from '../cli/format.js';\nimport { executeAtom, getAtomSkillNames, type AtomExecutionResult } from '../atom/execute.js';\nimport { loadSkillsForAtom, formatLoadedSkills } from './skills-load.js';\nimport type { SkillLoadResult } from '../atom/skills-load.js';\nimport { toErrorMessage } from '../utils/errors.js';\nimport { resolveAtomPath } from '../utils/paths.js';\n\n/**\n * Options for the run command.\n */\nexport interface RunOptions {\n json?: boolean;\n input?: string;\n cache?: boolean;\n yes?: boolean;\n}\n\n\n/**\n * Result of running an atom or capability.\n */\nexport interface RunResult<T = unknown> {\n success: boolean;\n atomName: string;\n input: unknown;\n output?: T;\n error?: {\n type: string;\n message: string;\n recoverable: boolean;\n suggestion?: string;\n };\n duration: number;\n}\n\n/**\n * Execute an atom by name.\n *\n * This is the CLI entry point. It performs CLI-only pre-flight checks\n * (content hash verification, idempotency gating, cache validation),\n * then delegates actual execution to `executeAtom()`, and formats the\n * result for human or JSON output.\n *\n * @param target - Atom name to execute\n * @param options - Command options including input, output format, etc.\n */\nexport async function runCommand(\n target: string,\n options: RunOptions\n): Promise<void> {\n const projectRoot = process.cwd();\n const registryPath = getRegistryPath(projectRoot);\n const startTime = Date.now();\n\n try {\n // Load registry (also validates storage is initialized)\n const registry = await loadRegistry(registryPath);\n\n // Parse input JSON (CLI concern — executeAtom receives parsed data)\n let inputData: unknown = {};\n if (options.input !== undefined) {\n try {\n inputData = JSON.parse(options.input);\n } catch {\n throw new Error(\n `Invalid JSON input: ${options.input}\\n` +\n `Provide valid JSON, e.g., --input '{\"key\": \"value\"}'`\n );\n }\n }\n\n // Look up atom (CLI provides detailed error with available atoms list)\n const atomEntry = registry.atoms[target];\n if (!atomEntry) {\n const availableAtoms = Object.keys(registry.atoms);\n if (availableAtoms.length === 0) {\n throw new Error(\n `Atom '${target}' not found. No atoms are registered.\\n` +\n `Register an atom with: atomic register <path>`\n );\n }\n throw new Error(\n `Atom '${target}' not found.\\n` +\n `Available atoms: ${availableAtoms.join(', ')}`\n );\n }\n\n // CLI-only: Verify atom file integrity via content hash (drift detection)\n if (atomEntry.contentHash) {\n const atomFilePath = resolveAtomPath(atomEntry.path, projectRoot);\n try {\n const currentContent = await readFile(atomFilePath, 'utf-8');\n const currentHash = createHash('sha256').update(currentContent).digest('hex');\n if (currentHash !== atomEntry.contentHash) {\n console.warn(\n `Warning: Atom '${target}' has been modified since registration.\\n` +\n ` Re-register with: atomic register ${atomEntry.path}`\n );\n }\n } catch {\n // File not found or unreadable — will be caught during execution\n }\n }\n\n // CLI-only: Check for cache flag with non-idempotent atom\n if (options.cache && !atomEntry.idempotent) {\n throw new Error(\n `Cannot use --cache with non-idempotent atom '${target}'.\\n` +\n `Only idempotent atoms can be cached.`\n );\n }\n\n // CLI-only: Non-idempotent confirmation gate (skip for graduated/generator atoms)\n if (!atomEntry.graduated && !atomEntry.idempotent && !options.yes) {\n throw new Error(\n `Atom '${target}' is not idempotent.\\n` +\n `Re-running may have side effects. Use --yes to confirm execution.`\n );\n }\n\n // CLI-only: Load skills and display progress before execution (handler atoms only)\n let preloadedSkillResult: SkillLoadResult | undefined;\n if (!atomEntry.graduated) {\n const skillNames = getAtomSkillNames(atomEntry);\n preloadedSkillResult = await loadSkillsForAtom(skillNames);\n\n if (!options.json) {\n for (const line of formatLoadedSkills(preloadedSkillResult)) {\n console.log(line);\n }\n }\n }\n\n // Delegate actual execution to executeAtom.\n // Pass a pre-loaded skill loader to avoid redundant skill loading.\n const skillLoader = preloadedSkillResult\n ? async () => preloadedSkillResult!\n : undefined;\n\n const execResult: AtomExecutionResult = await executeAtom(\n target,\n inputData,\n projectRoot,\n skillLoader\n );\n\n const duration = Date.now() - startTime;\n\n // Format and display result\n formatAndOutputResult(execResult, target, inputData, duration, options, atomEntry.graduated);\n } catch (err) {\n const duration = Date.now() - startTime;\n outputCatchError(err, target, options, duration);\n }\n}\n\n/**\n * Format an AtomExecutionResult for CLI output and display it.\n * Handles both JSON and human-readable output modes.\n */\nfunction formatAndOutputResult(\n execResult: AtomExecutionResult,\n target: string,\n inputData: unknown,\n duration: number,\n options: RunOptions,\n graduated?: boolean\n): void {\n // Build RunResult for JSON output\n const runResult: RunResult = {\n success: execResult.success,\n atomName: execResult.atomName,\n input: inputData,\n duration,\n };\n\n if (execResult.success) {\n runResult.output = execResult.output;\n } else {\n runResult.error = {\n type: 'execution',\n message: execResult.error || 'Unknown error',\n recoverable: false,\n };\n }\n\n if (options.json) {\n console.log(JSON.stringify(runResult, null, 2));\n if (!execResult.success) {\n process.exit(1);\n }\n return;\n }\n\n // Human-readable output\n const displayName = graduated\n ? `${target} (generator)`\n : execResult.atomName;\n\n if (execResult.success) {\n console.log(formatSuccess(displayName, duration));\n if (execResult.output != null) {\n console.log(` ${fmt.gray('Output:')}`);\n const outputStr = typeof execResult.output === 'string'\n ? execResult.output\n : JSON.stringify(execResult.output, null, 2);\n console.log(outputStr.split('\\n').map((l: string) => ` ${l}`).join('\\n'));\n }\n } else {\n console.error(formatFailure(displayName));\n console.error(formatAtomError({\n type: 'execution',\n message: execResult.error || 'Execution failed',\n recoverable: false,\n }));\n process.exit(1);\n }\n}\n\n/**\n * Handle errors caught by the outer try/catch (pre-flight failures).\n * Formats the error for JSON or human-readable output.\n */\nfunction outputCatchError(\n err: unknown,\n target: string,\n options: RunOptions,\n duration: number\n): void {\n if (options.json) {\n // Safely parse input — may fail if original error was caused by invalid JSON\n let parsedInput: unknown = {};\n try {\n parsedInput = options.input ? JSON.parse(options.input) : {};\n } catch {\n parsedInput = options.input ?? {};\n }\n\n console.log(\n JSON.stringify({\n success: false,\n atomName: target,\n input: parsedInput,\n error: {\n type: 'execution',\n message: toErrorMessage(err),\n recoverable: false,\n },\n duration,\n } satisfies RunResult)\n );\n process.exit(1);\n } else {\n console.error(formatAtomError({\n type: 'execution',\n message: toErrorMessage(err),\n recoverable: false,\n }));\n process.exit(1);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,SAAS,gBAAgB;AACzB,SAAS,kBAAkB;AAgD3B,eAAsB,WACpB,QACA,SACe;AACf,QAAM,cAAc,QAAQ,IAAI;AAChC,QAAM,eAAe,gBAAgB,WAAW;AAChD,QAAM,YAAY,KAAK,IAAI;AAE3B,MAAI;AAEF,UAAM,WAAW,MAAM,aAAa,YAAY;AAGhD,QAAI,YAAqB,CAAC;AAC1B,QAAI,QAAQ,UAAU,QAAW;AAC/B,UAAI;AACF,oBAAY,KAAK,MAAM,QAAQ,KAAK;AAAA,MACtC,QAAQ;AACN,cAAM,IAAI;AAAA,UACR,uBAAuB,QAAQ,KAAK;AAAA;AAAA,QAEtC;AAAA,MACF;AAAA,IACF;AAGA,UAAM,YAAY,SAAS,MAAM,MAAM;AACvC,QAAI,CAAC,WAAW;AACd,YAAM,iBAAiB,OAAO,KAAK,SAAS,KAAK;AACjD,UAAI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