@shrkcrft/cli 0.1.0-alpha.10 → 0.1.0-alpha.12
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/dist/commands/ask.command.d.ts.map +1 -1
- package/dist/commands/ask.command.js +10 -9
- package/dist/commands/command-catalog.d.ts.map +1 -1
- package/dist/commands/command-catalog.js +100 -1
- package/dist/commands/deps-audit.command.d.ts +23 -0
- package/dist/commands/deps-audit.command.d.ts.map +1 -0
- package/dist/commands/deps-audit.command.js +266 -0
- package/dist/commands/doctor.command.d.ts.map +1 -1
- package/dist/commands/doctor.command.js +60 -1
- package/dist/commands/graph-code-subverbs.d.ts.map +1 -1
- package/dist/commands/graph-code-subverbs.js +144 -26
- package/dist/commands/graph.command.d.ts.map +1 -1
- package/dist/commands/graph.command.js +3 -2
- package/dist/commands/help.command.d.ts.map +1 -1
- package/dist/commands/help.command.js +22 -1
- package/dist/commands/impact.command.d.ts.map +1 -1
- package/dist/commands/impact.command.js +3 -2
- package/dist/commands/move-plan.command.d.ts +23 -0
- package/dist/commands/move-plan.command.d.ts.map +1 -0
- package/dist/commands/move-plan.command.js +360 -0
- package/dist/commands/scaffold-validate.command.d.ts +22 -0
- package/dist/commands/scaffold-validate.command.d.ts.map +1 -0
- package/dist/commands/scaffold-validate.command.js +215 -0
- package/dist/commands/smart-context.command.d.ts +30 -0
- package/dist/commands/smart-context.command.d.ts.map +1 -0
- package/dist/commands/smart-context.command.js +3763 -0
- package/dist/commands/spike.command.d.ts +22 -0
- package/dist/commands/spike.command.d.ts.map +1 -0
- package/dist/commands/spike.command.js +235 -0
- package/dist/commands/watch.command.d.ts +26 -0
- package/dist/commands/watch.command.d.ts.map +1 -0
- package/dist/commands/watch.command.js +456 -0
- package/dist/dashboard/dashboard-api-server.d.ts.map +1 -1
- package/dist/dashboard/dashboard-api-server.js +25 -0
- package/dist/env/load-dotenv.d.ts +15 -0
- package/dist/env/load-dotenv.d.ts.map +1 -0
- package/dist/env/load-dotenv.js +70 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +83 -2
- package/dist/schemas/json-schemas.d.ts +384 -36
- package/dist/schemas/json-schemas.d.ts.map +1 -1
- package/dist/schemas/json-schemas.js +247 -36
- package/package.json +33 -30
package/dist/main.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { loadDotenv } from "./env/load-dotenv.js";
|
|
2
3
|
import { CommandRegistry, extractGlobalCwd, parseArgs, } from "./command-registry.js";
|
|
3
4
|
import { initCommand } from "./commands/init.command.js";
|
|
4
5
|
import { inspectCommand } from "./commands/inspect.command.js";
|
|
@@ -55,6 +56,12 @@ import { dashboardCommand } from "./commands/dashboard.command.js";
|
|
|
55
56
|
import { dashboardDiffCommand, dashboardExportCommand, } from "./commands/dashboard-export.command.js";
|
|
56
57
|
import { importCommand } from "./commands/import.command.js";
|
|
57
58
|
import { askCommand } from "./commands/ask.command.js";
|
|
59
|
+
import { smartContextCommand, smartContextEmbeddingsBuildCommand, smartContextEmbeddingsStatusCommand, smartContextListCommand, smartContextPlanAheadCommand, smartContextShowCommand, } from "./commands/smart-context.command.js";
|
|
60
|
+
import { spikeCommand } from "./commands/spike.command.js";
|
|
61
|
+
import { depsAuditCommand } from "./commands/deps-audit.command.js";
|
|
62
|
+
import { scaffoldValidateCommand } from "./commands/scaffold-validate.command.js";
|
|
63
|
+
import { movePlanCommand } from "./commands/move-plan.command.js";
|
|
64
|
+
import { watchCommand, watchListCommand, watchPruneCommand, watchStopCommand } from "./commands/watch.command.js";
|
|
58
65
|
import { mcpCommand } from "./commands/mcp.command.js";
|
|
59
66
|
import { versionCommand } from "./commands/version.command.js";
|
|
60
67
|
import { makeHelpCommand } from "./commands/help.command.js";
|
|
@@ -204,6 +211,20 @@ export function buildRegistry() {
|
|
|
204
211
|
registry.register(planParentCommand);
|
|
205
212
|
registry.register(devCommand);
|
|
206
213
|
registry.register(askCommand);
|
|
214
|
+
registry.register(smartContextCommand);
|
|
215
|
+
registry.registerSubcommand('smart-context', smartContextPlanAheadCommand);
|
|
216
|
+
registry.registerSubcommand('smart-context', smartContextListCommand);
|
|
217
|
+
registry.registerSubcommand('smart-context', smartContextShowCommand);
|
|
218
|
+
registry.registerSubcommand('smart-context', smartContextEmbeddingsBuildCommand);
|
|
219
|
+
registry.registerSubcommand('smart-context', smartContextEmbeddingsStatusCommand);
|
|
220
|
+
registry.register(spikeCommand);
|
|
221
|
+
registry.register(depsAuditCommand);
|
|
222
|
+
registry.register(scaffoldValidateCommand);
|
|
223
|
+
registry.register(movePlanCommand);
|
|
224
|
+
registry.register(watchCommand);
|
|
225
|
+
registry.registerSubcommand('watch', watchListCommand);
|
|
226
|
+
registry.registerSubcommand('watch', watchStopCommand);
|
|
227
|
+
registry.registerSubcommand('watch', watchPruneCommand);
|
|
207
228
|
registry.register(mcpCommand);
|
|
208
229
|
registry.register(versionCommand);
|
|
209
230
|
registry.register(qualityCommand);
|
|
@@ -804,9 +825,69 @@ if (isMain ||
|
|
|
804
825
|
entryPath.endsWith('shrk') ||
|
|
805
826
|
entryPath.endsWith('shrk.js') ||
|
|
806
827
|
entryPath.endsWith('shrk.cmd')) {
|
|
828
|
+
loadDotenv(process.cwd());
|
|
807
829
|
const argv = process.argv.slice(2);
|
|
808
|
-
|
|
830
|
+
const cleanShutdown = async (code) => {
|
|
831
|
+
// Best-effort teardown of shared native runtimes. Without this,
|
|
832
|
+
// commands that loaded native libs (ONNX via embeddings; Metal
|
|
833
|
+
// via node-llama-cpp) abort during `process.exit` AFTER the
|
|
834
|
+
// work completed — the user sees their result then `zsh: abort`.
|
|
835
|
+
// Dynamic imports keep these off the hot path for commands that
|
|
836
|
+
// never touched them.
|
|
837
|
+
try {
|
|
838
|
+
const mod = (await import('@shrkcrft/embeddings'));
|
|
839
|
+
if (typeof mod.disposeSemanticIndexPipeline === 'function') {
|
|
840
|
+
await mod.disposeSemanticIndexPipeline();
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
catch {
|
|
844
|
+
// Best-effort; never block the exit on teardown failure.
|
|
845
|
+
}
|
|
846
|
+
try {
|
|
847
|
+
const mod = (await import('@shrkcrft/ai'));
|
|
848
|
+
if (typeof mod.disposeLlamaCppRuntime === 'function') {
|
|
849
|
+
await mod.disposeLlamaCppRuntime();
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
catch {
|
|
853
|
+
// Best-effort.
|
|
854
|
+
}
|
|
855
|
+
// Flush stdio synchronously before bypassing C++ destructors.
|
|
856
|
+
// `_exit` skips all libc finalizers, which is exactly what we
|
|
857
|
+
// need (see below), but it also doesn't wait for buffered
|
|
858
|
+
// writes to drain. Two synchronous write callbacks force the
|
|
859
|
+
// current buffers through.
|
|
860
|
+
try {
|
|
861
|
+
await new Promise((resolve) => process.stdout.write('', () => resolve()));
|
|
862
|
+
await new Promise((resolve) => process.stderr.write('', () => resolve()));
|
|
863
|
+
}
|
|
864
|
+
catch {
|
|
865
|
+
// ignore flush failures
|
|
866
|
+
}
|
|
867
|
+
// Prefer `_exit` over `exit` on Node. Even after our explicit
|
|
868
|
+
// disposes above, node-llama-cpp's libggml-metal destructor
|
|
869
|
+
// still aborts in `__cxa_finalize_ranges` because the Metal
|
|
870
|
+
// device list isn't drained by the current dispose API
|
|
871
|
+
// (`GGML_ASSERT([rsets->data count] == 0)` fires from
|
|
872
|
+
// `ggml_metal_device_free`, surfacing as `zsh: abort` AFTER
|
|
873
|
+
// the user's result has already printed). `process._exit`
|
|
874
|
+
// skips the libc++ static-destructor pass entirely, which is
|
|
875
|
+
// safe here because we have already torn down the runtimes
|
|
876
|
+
// we care about above and the OS will reclaim the rest.
|
|
877
|
+
//
|
|
878
|
+
// Bun's process object doesn't expose `_exit`, but Bun also
|
|
879
|
+
// doesn't drive shutdown through libuv + libc++ static
|
|
880
|
+
// destructors the same way Node does, so the Metal crash
|
|
881
|
+
// doesn't reproduce there. Fall back to `process.exit` when
|
|
882
|
+
// `_exit` is unavailable.
|
|
883
|
+
const lowLevelExit = process._exit;
|
|
884
|
+
if (typeof lowLevelExit === 'function') {
|
|
885
|
+
lowLevelExit(code);
|
|
886
|
+
}
|
|
887
|
+
process.exit(code);
|
|
888
|
+
};
|
|
889
|
+
runCli(argv).then((code) => cleanShutdown(code), (err) => {
|
|
809
890
|
process.stderr.write(`Fatal: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
810
|
-
|
|
891
|
+
return cleanShutdown(1);
|
|
811
892
|
});
|
|
812
893
|
}
|