@archkit/cli 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 (87) hide show
  1. package/LICENSE +21 -0
  2. package/dist/.tsbuildinfo +1 -0
  3. package/dist/commands/build.d.ts +5 -0
  4. package/dist/commands/build.d.ts.map +1 -0
  5. package/dist/commands/build.js +33 -0
  6. package/dist/commands/build.js.map +1 -0
  7. package/dist/commands/context.d.ts +5 -0
  8. package/dist/commands/context.d.ts.map +1 -0
  9. package/dist/commands/context.js +31 -0
  10. package/dist/commands/context.js.map +1 -0
  11. package/dist/commands/deps.d.ts +5 -0
  12. package/dist/commands/deps.d.ts.map +1 -0
  13. package/dist/commands/deps.js +48 -0
  14. package/dist/commands/deps.js.map +1 -0
  15. package/dist/commands/knowledge.d.ts +18 -0
  16. package/dist/commands/knowledge.d.ts.map +1 -0
  17. package/dist/commands/knowledge.js +148 -0
  18. package/dist/commands/knowledge.js.map +1 -0
  19. package/dist/commands/query.d.ts +5 -0
  20. package/dist/commands/query.d.ts.map +1 -0
  21. package/dist/commands/query.js +59 -0
  22. package/dist/commands/query.js.map +1 -0
  23. package/dist/commands/scaffold.d.ts +2 -0
  24. package/dist/commands/scaffold.d.ts.map +1 -0
  25. package/dist/commands/scaffold.js +8 -0
  26. package/dist/commands/scaffold.js.map +1 -0
  27. package/dist/commands/show.d.ts +5 -0
  28. package/dist/commands/show.d.ts.map +1 -0
  29. package/dist/commands/show.js +54 -0
  30. package/dist/commands/show.js.map +1 -0
  31. package/dist/commands/stats.d.ts +5 -0
  32. package/dist/commands/stats.d.ts.map +1 -0
  33. package/dist/commands/stats.js +35 -0
  34. package/dist/commands/stats.js.map +1 -0
  35. package/dist/formatters/build.d.ts +4 -0
  36. package/dist/formatters/build.d.ts.map +1 -0
  37. package/dist/formatters/build.js +23 -0
  38. package/dist/formatters/build.js.map +1 -0
  39. package/dist/formatters/context.d.ts +4 -0
  40. package/dist/formatters/context.d.ts.map +1 -0
  41. package/dist/formatters/context.js +63 -0
  42. package/dist/formatters/context.js.map +1 -0
  43. package/dist/formatters/deps.d.ts +4 -0
  44. package/dist/formatters/deps.d.ts.map +1 -0
  45. package/dist/formatters/deps.js +47 -0
  46. package/dist/formatters/deps.js.map +1 -0
  47. package/dist/formatters/knowledge.d.ts +4 -0
  48. package/dist/formatters/knowledge.d.ts.map +1 -0
  49. package/dist/formatters/knowledge.js +126 -0
  50. package/dist/formatters/knowledge.js.map +1 -0
  51. package/dist/formatters/query.d.ts +4 -0
  52. package/dist/formatters/query.d.ts.map +1 -0
  53. package/dist/formatters/query.js +51 -0
  54. package/dist/formatters/query.js.map +1 -0
  55. package/dist/formatters/show.d.ts +4 -0
  56. package/dist/formatters/show.d.ts.map +1 -0
  57. package/dist/formatters/show.js +53 -0
  58. package/dist/formatters/show.js.map +1 -0
  59. package/dist/formatters/stats.d.ts +4 -0
  60. package/dist/formatters/stats.d.ts.map +1 -0
  61. package/dist/formatters/stats.js +29 -0
  62. package/dist/formatters/stats.js.map +1 -0
  63. package/dist/index.d.ts +3 -0
  64. package/dist/index.d.ts.map +1 -0
  65. package/dist/index.js +6 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/models/command-results.d.ts +47 -0
  68. package/dist/models/command-results.d.ts.map +1 -0
  69. package/dist/models/command-results.js +3 -0
  70. package/dist/models/command-results.js.map +1 -0
  71. package/dist/models/output-mode.d.ts +6 -0
  72. package/dist/models/output-mode.d.ts.map +1 -0
  73. package/dist/models/output-mode.js +3 -0
  74. package/dist/models/output-mode.js.map +1 -0
  75. package/dist/program.d.ts +3 -0
  76. package/dist/program.d.ts.map +1 -0
  77. package/dist/program.js +120 -0
  78. package/dist/program.js.map +1 -0
  79. package/dist/utils/command-output.d.ts +10 -0
  80. package/dist/utils/command-output.d.ts.map +1 -0
  81. package/dist/utils/command-output.js +60 -0
  82. package/dist/utils/command-output.js.map +1 -0
  83. package/dist/utils/output.d.ts +2 -0
  84. package/dist/utils/output.d.ts.map +1 -0
  85. package/dist/utils/output.js +15 -0
  86. package/dist/utils/output.js.map +1 -0
  87. package/package.json +45 -0
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const program_1 = require("./program");
5
+ void (0, program_1.buildProgram)().parseAsync(process.argv);
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,uCAAwC;AAExC,KAAK,IAAA,sBAAY,GAAE,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA"}
@@ -0,0 +1,47 @@
1
+ import type { ContextBundle } from '@archkit/context';
2
+ import type { ArchNode, GraphMeta, NodeType } from '@archkit/core';
3
+ import type { DepsResult, KnowledgeEntry, KnowledgeEntrySummary } from '@archkit/graph';
4
+ export interface BuildCommandResult {
5
+ repoPath: string;
6
+ meta: GraphMeta;
7
+ }
8
+ export interface StatsCommandResult {
9
+ repoPath: string;
10
+ meta: GraphMeta;
11
+ }
12
+ export interface QueryCommandMatch {
13
+ nodeId: string;
14
+ type: NodeType;
15
+ name: string;
16
+ file: string;
17
+ }
18
+ export interface QueryCommandResult {
19
+ term: string;
20
+ matches: QueryCommandMatch[];
21
+ }
22
+ export interface ShowCommandResult {
23
+ input: string;
24
+ node: ArchNode;
25
+ snippet: string;
26
+ }
27
+ export interface KnowledgeAddCommandResult {
28
+ action: 'add';
29
+ entry: KnowledgeEntry;
30
+ }
31
+ export interface KnowledgeListCommandResult {
32
+ action: 'list';
33
+ entries: KnowledgeEntrySummary[];
34
+ }
35
+ export interface KnowledgeShowCommandResult {
36
+ action: 'show';
37
+ entry: KnowledgeEntry;
38
+ }
39
+ export interface KnowledgeSearchCommandResult {
40
+ action: 'search';
41
+ query: string;
42
+ matches: KnowledgeEntrySummary[];
43
+ }
44
+ export type KnowledgeCommandResult = KnowledgeAddCommandResult | KnowledgeListCommandResult | KnowledgeShowCommandResult | KnowledgeSearchCommandResult;
45
+ export type DepsCommandResult = DepsResult;
46
+ export type ContextCommandResult = ContextBundle;
47
+ //# sourceMappingURL=command-results.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-results.d.ts","sourceRoot":"","sources":["../../src/models/command-results.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AAEvF,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,SAAS,CAAA;CAChB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,SAAS,CAAA;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,QAAQ,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,iBAAiB,EAAE,CAAA;CAC7B;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,QAAQ,CAAA;IACd,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,KAAK,CAAA;IACb,KAAK,EAAE,cAAc,CAAA;CACtB;AAED,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,qBAAqB,EAAE,CAAA;CACjC;AAED,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,cAAc,CAAA;CACtB;AAED,MAAM,WAAW,4BAA4B;IAC3C,MAAM,EAAE,QAAQ,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,qBAAqB,EAAE,CAAA;CACjC;AAED,MAAM,MAAM,sBAAsB,GAC9B,yBAAyB,GACzB,0BAA0B,GAC1B,0BAA0B,GAC1B,4BAA4B,CAAA;AAEhC,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAA;AAC1C,MAAM,MAAM,oBAAoB,GAAG,aAAa,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=command-results.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-results.js","sourceRoot":"","sources":["../../src/models/command-results.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ export type OutputMode = 'human' | 'json' | 'llm';
2
+ export interface OutputOptions {
3
+ json?: boolean;
4
+ format?: string;
5
+ }
6
+ //# sourceMappingURL=output-mode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output-mode.d.ts","sourceRoot":"","sources":["../../src/models/output-mode.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAA;AAEjD,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=output-mode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output-mode.js","sourceRoot":"","sources":["../../src/models/output-mode.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function buildProgram(): Command;
3
+ //# sourceMappingURL=program.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAiBnC,wBAAgB,YAAY,IAAI,OAAO,CAuHtC"}
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildProgram = buildProgram;
4
+ const commander_1 = require("commander");
5
+ const build_1 = require("./commands/build");
6
+ const context_1 = require("./commands/context");
7
+ const deps_1 = require("./commands/deps");
8
+ const knowledge_1 = require("./commands/knowledge");
9
+ const query_1 = require("./commands/query");
10
+ const show_1 = require("./commands/show");
11
+ const stats_1 = require("./commands/stats");
12
+ const output_1 = require("./utils/output");
13
+ function buildProgram() {
14
+ const program = new commander_1.Command();
15
+ program
16
+ .name('arch')
17
+ .description('Arch CLI')
18
+ .version('0.1.0')
19
+ .action(() => {
20
+ (0, output_1.printCliBanner)();
21
+ });
22
+ program
23
+ .command('build')
24
+ .description('Build the architecture graph')
25
+ .argument('[repoPath]', 'Repository path', '.')
26
+ .option('--json', 'Output JSON')
27
+ .option('--format <format>', 'Output format (human|llm)', 'human')
28
+ .action(async (repoPath, outputOptions) => {
29
+ await (0, build_1.runBuildCommand)(repoPath, outputOptions);
30
+ });
31
+ program
32
+ .command('stats')
33
+ .description('Display architecture statistics')
34
+ .argument('[repoPath]', 'Repository path', '.')
35
+ .option('--json', 'Output JSON')
36
+ .option('--format <format>', 'Output format (human|llm)', 'human')
37
+ .action(async (repoPath, outputOptions) => {
38
+ await (0, stats_1.runStatsCommand)(repoPath, outputOptions);
39
+ });
40
+ program
41
+ .command('query')
42
+ .description('Search for symbols')
43
+ .argument('[term]', 'Symbol query term')
44
+ .option('--json', 'Output JSON')
45
+ .option('--format <format>', 'Output format (human|llm)', 'human')
46
+ .action(async (term, outputOptions) => {
47
+ await (0, query_1.runQueryCommand)(term, outputOptions);
48
+ });
49
+ program
50
+ .command('deps')
51
+ .description('Show dependencies for a symbol')
52
+ .argument('[symbol]', 'Symbol name')
53
+ .option('--json', 'Output JSON')
54
+ .option('--format <format>', 'Output format (human|llm)', 'human')
55
+ .action(async (symbol, outputOptions) => {
56
+ await (0, deps_1.runDepsCommand)(symbol, outputOptions);
57
+ });
58
+ program
59
+ .command('show')
60
+ .description('Display a symbol snippet')
61
+ .argument('[symbol]', 'Symbol name')
62
+ .option('--json', 'Output JSON')
63
+ .option('--format <format>', 'Output format (human|llm)', 'human')
64
+ .action(async (symbol, outputOptions) => {
65
+ await (0, show_1.runShowCommand)(symbol, outputOptions);
66
+ });
67
+ program
68
+ .command('context')
69
+ .description('Compile context for a feature or symbol')
70
+ .argument('[query]', 'Context query')
71
+ .option('--json', 'Output JSON')
72
+ .option('--format <format>', 'Output format (human|llm)', 'human')
73
+ .action(async (query, outputOptions) => {
74
+ await (0, context_1.runContextCommand)(query, outputOptions);
75
+ });
76
+ const knowledgeCommand = program
77
+ .command('knowledge')
78
+ .description('Manage architecture knowledge entries');
79
+ knowledgeCommand
80
+ .command('add')
81
+ .description('Add a knowledge entry')
82
+ .requiredOption('--type <type>', 'Knowledge type')
83
+ .requiredOption('--title <title>', 'Knowledge title')
84
+ .requiredOption('--body <body>', 'Knowledge body')
85
+ .option('--feature <feature>', 'Feature group', 'general')
86
+ .option('--tags <tags>', 'Comma-separated tags')
87
+ .option('--json', 'Output JSON')
88
+ .option('--format <format>', 'Output format (human|llm)', 'human')
89
+ .action(async (options) => {
90
+ await (0, knowledge_1.runKnowledgeAddCommand)(options);
91
+ });
92
+ knowledgeCommand
93
+ .command('list')
94
+ .description('List knowledge entries')
95
+ .option('--json', 'Output JSON')
96
+ .option('--format <format>', 'Output format (human|llm)', 'human')
97
+ .action(async (outputOptions) => {
98
+ await (0, knowledge_1.runKnowledgeListCommand)(outputOptions);
99
+ });
100
+ knowledgeCommand
101
+ .command('show')
102
+ .description('Show a knowledge entry')
103
+ .argument('<id>', 'Knowledge entry id')
104
+ .option('--json', 'Output JSON')
105
+ .option('--format <format>', 'Output format (human|llm)', 'human')
106
+ .action(async (id, outputOptions) => {
107
+ await (0, knowledge_1.runKnowledgeShowCommand)(id, outputOptions);
108
+ });
109
+ knowledgeCommand
110
+ .command('search')
111
+ .description('Search knowledge entries')
112
+ .argument('<query>', 'Knowledge search query')
113
+ .option('--json', 'Output JSON')
114
+ .option('--format <format>', 'Output format (human|llm)', 'human')
115
+ .action(async (query, outputOptions) => {
116
+ await (0, knowledge_1.runKnowledgeSearchCommand)(query, outputOptions);
117
+ });
118
+ return program;
119
+ }
120
+ //# sourceMappingURL=program.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"program.js","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":";;AAiBA,oCAuHC;AAxID,yCAAmC;AACnC,4CAAkD;AAClD,gDAAsD;AACtD,0CAAgD;AAChD,oDAM6B;AAC7B,4CAAkD;AAClD,0CAAgD;AAChD,4CAAkD;AAElD,2CAA+C;AAE/C,SAAgB,YAAY;IAC1B,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAA;IAE7B,OAAO;SACJ,IAAI,CAAC,MAAM,CAAC;SACZ,WAAW,CAAC,UAAU,CAAC;SACvB,OAAO,CAAC,OAAO,CAAC;SAChB,MAAM,CAAC,GAAG,EAAE;QACX,IAAA,uBAAc,GAAE,CAAA;IAClB,CAAC,CAAC,CAAA;IAEJ,OAAO;SACJ,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,8BAA8B,CAAC;SAC3C,QAAQ,CAAC,YAAY,EAAE,iBAAiB,EAAE,GAAG,CAAC;SAC9C,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC;SAC/B,MAAM,CAAC,mBAAmB,EAAE,2BAA2B,EAAE,OAAO,CAAC;SACjE,MAAM,CAAC,KAAK,EAAE,QAAgB,EAAE,aAA4B,EAAE,EAAE;QAC/D,MAAM,IAAA,uBAAe,EAAC,QAAQ,EAAE,a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ode, OutputOptions } from '../models/output-mode';
2
+ export declare class CliCommandError extends Error {
3
+ readonly code: string;
4
+ readonly details?: unknown;
5
+ constructor(code: string, message: string, details?: unknown);
6
+ }
7
+ export declare function resolveOutputMode(options: OutputOptions, supportsLlm: boolean): OutputMode;
8
+ export declare function writeFormattedOutput(output: string): void;
9
+ export declare function handleCommandError(error: unknown, options: OutputOptions): void;
10
+ //# sourceMappingURL=command-output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-output.d.ts","sourceRoot":"","sources":["../../src/utils/command-output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAEtE,qBAAa,eAAgB,SAAQ,KAAK;IACxC,SAAgB,IAAI,EAAE,MAAM,CAAA;IAC5B,SAAgB,OAAO,CAAC,EAAE,OAAO,CAAA;gBAEd,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO;CAKpE;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,aAAa,EACtB,WAAW,EAAE,OAAO,GACnB,UAAU,CAyBZ;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEzD;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAqB/E"}
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CliCommandError = void 0;
4
+ exports.resolveOutputMode = resolveOutputMode;
5
+ exports.writeFormattedOutput = writeFormattedOutput;
6
+ exports.handleCommandError = handleCommandError;
7
+ class CliCommandError extends Error {
8
+ code;
9
+ details;
10
+ constructor(code, message, details) {
11
+ super(message);
12
+ this.code = code;
13
+ this.details = details;
14
+ }
15
+ }
16
+ exports.CliCommandError = CliCommandError;
17
+ function resolveOutputMode(options, supportsLlm) {
18
+ if (options.json) {
19
+ return 'json';
20
+ }
21
+ const requestedFormat = (options.format ?? 'human').toLocaleLowerCase();
22
+ if (requestedFormat === 'human') {
23
+ return 'human';
24
+ }
25
+ if (requestedFormat === 'llm') {
26
+ if (!supportsLlm) {
27
+ throw new CliCommandError('FORMAT_NOT_SUPPORTED', 'LLM format is not supported for this command.');
28
+ }
29
+ return 'llm';
30
+ }
31
+ throw new CliCommandError('INVALID_FORMAT', 'Invalid format. Supported values: human, llm.');
32
+ }
33
+ function writeFormattedOutput(output) {
34
+ console.log(output);
35
+ }
36
+ function handleCommandError(error, options) {
37
+ const cliError = toCliCommandError(error);
38
+ if (options.json) {
39
+ console.log(JSON.stringify({
40
+ error: {
41
+ code: cliError.code,
42
+ message: cliError.message,
43
+ },
44
+ }, null, 2));
45
+ }
46
+ else {
47
+ console.error(cliError.message);
48
+ }
49
+ process.exitCode = 1;
50
+ }
51
+ function toCliCommandError(error) {
52
+ if (error instanceof CliCommandError) {
53
+ return error;
54
+ }
55
+ if (error instanceof Error) {
56
+ return new CliCommandError('COMMAND_FAILED', error.message);
57
+ }
58
+ return new CliCommandError('COMMAND_FAILED', 'Command failed.');
59
+ }
60
+ //# sourceMappingURL=command-output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-output.js","sourceRoot":"","sources":["../../src/utils/command-output.ts"],"names":[],"mappings":";;;AAaA,8CA4BC;AAED,oDAEC;AAED,gDAqBC;AAlED,MAAa,eAAgB,SAAQ,KAAK;IACxB,IAAI,CAAQ;IACZ,OAAO,CAAU;IAEjC,YAAmB,IAAY,EAAE,OAAe,EAAE,OAAiB;QACjE,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;QAChB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;CACF;AATD,0CASC;AAED,SAAgB,iBAAiB,CAC/B,OAAsB,EACtB,WAAoB;IAEpB,IAAI,OAAO,CAAC,IAAI,EAAE,C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AAC,gBAAgB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IAC7D,CAAC;IAED,OAAO,IAAI,eAAe,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,CAAA;AACjE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function printCliBanner(): void;
2
+ //# sourceMappingURL=output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/utils/output.ts"],"names":[],"mappings":"AAAA,wBAAgB,cAAc,IAAI,IAAI,CAUrC"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.printCliBanner = printCliBanner;
4
+ function printCliBanner() {
5
+ console.log('Arch CLI');
6
+ console.log('');
7
+ console.log('Commands available:');
8
+ console.log('* build');
9
+ console.log('* stats');
10
+ console.log('* query');
11
+ console.log('* deps');
12
+ console.log('* show');
13
+ console.log('* context');
14
+ }
15
+ //# sourceMappingURL=output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/utils/output.ts"],"names":[],"mappings":";;AAAA,wCAUC;AAVD,SAAgB,cAAc;IAC5B,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IACvB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IACf,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAA;IAClC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACtB,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACtB,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACtB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IACrB,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IACrB,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAA;AAC1B,CAAC"}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@archkit/cli",
3
+ "version": "0.1.0",
4
+ "license": "MIT",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/brent-broeckx/arch.git",
8
+ "directory": "packages/arch-cli"
9
+ },
10
+ "homepage": "https://github.com/brent-broeckx/arch#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/brent-broeckx/arch/issues"
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "bin": {
21
+ "arch": "dist/index.js"
22
+ },
23
+ "main": "dist/index.js",
24
+ "types": "dist/index.d.ts",
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "require": "./dist/index.js",
29
+ "default": "./dist/index.js"
30
+ }
31
+ },
32
+ "dependencies": {
33
+ "commander": "^13.1.0",
34
+ "@archkit/context": "0.1.0",
35
+ "@archkit/core": "0.1.0",
36
+ "@archkit/graph": "0.1.0",
37
+ "@archkit/parser-ts": "0.1.0"
38
+ },
39
+ "scripts": {
40
+ "build": "tsc -p tsconfig.json",
41
+ "dev": "tsc -w -p tsconfig.json",
42
+ "lint": "echo \"No lint configured yet\"",
43
+ "typecheck": "tsc -p tsconfig.json --noEmit"
44
+ }
45
+ }