Skip to content

Commit ff46f6d

Browse files
committed
fix: Bug fixes and improvements
1 parent aedce0f commit ff46f6d

File tree

12 files changed

+27
-26
lines changed

12 files changed

+27
-26
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codify-plugin-lib",
3-
"version": "1.0.181",
3+
"version": "1.0.182-beta5",
44
"description": "Library plugin library",
55
"main": "dist/index.js",
66
"typings": "dist/index.d.ts",

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ export * from './resource/parsed-resource-settings.js';
1212
export * from './resource/resource.js'
1313
export * from './resource/resource-settings.js'
1414
export * from './stateful-parameter/stateful-parameter.js'
15+
export * from './utils/functions.js'
1516
export * from './utils/index.js'
17+
export * from './utils/verbosity-level.js'
1618

1719
export async function runPlugin(plugin: Plugin) {
1820
const messageHandler = new MessageHandler(plugin);

src/plugin/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import { getPty } from '../pty/index.js';
2424
import { SequentialPty } from '../pty/seqeuntial-pty.js';
2525
import { Resource } from '../resource/resource.js';
2626
import { ResourceController } from '../resource/resource-controller.js';
27-
import { VerbosityLevel } from '../utils/internal-utils.js';
2827
import { ptyLocalStorage } from '../utils/pty-local-storage.js';
28+
import { VerbosityLevel } from '../utils/verbosity-level.js';
2929

3030
export class Plugin {
3131
planStorage: Map<string, Plan<any>>;

src/pty/background-pty.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import stripAnsi from 'strip-ansi';
77

88
import { debugLog } from '../utils/debug.js';
99
import { Shell, Utils } from '../utils/index.js';
10-
import { VerbosityLevel } from '../utils/internal-utils.js';
10+
import { VerbosityLevel } from '../utils/verbosity-level.js';
1111
import { IPty, SpawnError, SpawnOptions, SpawnResult } from './index.js';
1212
import { PromiseQueue } from './promise-queue.js';
1313

src/pty/seqeuntial-pty.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { EventEmitter } from 'node:events';
33
import stripAnsi from 'strip-ansi';
44

55
import { Shell, Utils } from '../utils/index.js';
6-
import { VerbosityLevel } from '../utils/internal-utils.js';
6+
import { VerbosityLevel } from '../utils/verbosity-level.js';
77
import { IPty, SpawnError, SpawnOptions, SpawnResult, SpawnStatus } from './index.js';
88

99
EventEmitter.defaultMaxListeners = 1000;
@@ -46,7 +46,7 @@ export class SequentialPty implements IPty {
4646
const initialCols = process.stdout.columns ?? 80;
4747
const initialRows = process.stdout.rows ?? 24;
4848

49-
const args = (options?.interactive ?? true) ? ['-i', '-c', `"${cmd}"`] : ['-c', `"${cmd}"`]
49+
const args = (options?.interactive ?? false) ? ['-i', '-c', cmd] : ['-c', cmd]
5050

5151
// Run the command in a pty for interactivity
5252
const mPty = pty.spawn(this.getDefaultShell(), args, {

src/pty/sequential-pty.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, expect, it } from 'vitest';
22
import { SequentialPty } from './seqeuntial-pty.js';
3-
import { VerbosityLevel } from '../utils/internal-utils.js';
3+
import { VerbosityLevel } from '../utils/verbosity-level.js';
44

55
describe('SequentialPty tests', () => {
66
it('Can launch a simple command', async () => {
@@ -52,7 +52,7 @@ describe('SequentialPty tests', () => {
5252
it('It can launch a command in interactive mode', async () => {
5353
const pty = new SequentialPty();
5454

55-
const resultSuccess = await pty.spawnSafe('ls', { interactive: false });
55+
const resultSuccess = await pty.spawnSafe('ls', { interactive: true });
5656
expect(resultSuccess).toMatchObject({
5757
status: 'success',
5858
exitCode: 0,

src/resource/resource-controller.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { CreatePlan, DestroyPlan, ModifyPlan } from '../plan/plan-types.js';
77
import { ParameterChange } from '../plan/change-set.js';
88
import { ResourceController } from './resource-controller.js';
99
import { TestConfig, testPlan, TestResource, TestStatefulParameter } from '../utils/test-utils.test.js';
10-
import { tildify, untildify } from '../utils/internal-utils.js';
10+
import { tildify, untildify } from '../utils/functions.js';
1111
import { ArrayStatefulParameter, StatefulParameter } from '../stateful-parameter/stateful-parameter.js';
1212
import { Plan } from '../plan/plan.js';
1313
import os from 'node:os';

src/resource/resource-settings.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
resolvePathWithVariables,
1111
tildify,
1212
untildify
13-
} from '../utils/internal-utils.js';
13+
} from '../utils/functions.js';
1414
import { RefreshContext } from './resource.js';
1515

1616
export interface InputTransformation {
Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,6 @@ import { ResourceConfig, StringIndexedObject } from 'codify-schemas';
22
import os from 'node:os';
33
import path from 'node:path';
44

5-
export const VerbosityLevel = new class {
6-
level = 0;
7-
8-
get() {
9-
return this.level;
10-
}
11-
12-
set(level: number) {
13-
this.level = level;
14-
}
15-
}
16-
17-
export function isDebug(): boolean {
18-
return process.env.DEBUG != null && process.env.DEBUG.includes('codify'); // TODO: replace with debug library
19-
}
20-
215
export function splitUserConfig<T extends StringIndexedObject>(
226
config: ResourceConfig & T
237
): { parameters: T; coreParameters: ResourceConfig } {

src/utils/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import { OS } from 'codify-schemas';
22
import os from 'node:os';
33
import path from 'node:path';
44

5+
export function isDebug(): boolean {
6+
return process.env.DEBUG != null && process.env.DEBUG.includes('codify'); // TODO: replace with debug library
7+
}
8+
59
export enum Shell {
610
ZSH = 'zsh',
711
BASH = 'bash',

0 commit comments

Comments
 (0)